mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-22 08:38:13 +02:00
fix: fix projection to TS when fetching agnet in MCP
This commit is contained in:
parent
3892b58486
commit
bbb4f91a27
12 changed files with 392 additions and 63 deletions
|
|
@ -25,8 +25,19 @@ import type {
|
|||
WireNode,
|
||||
} from "./types.ts";
|
||||
|
||||
export function parseCode(code: string, specs: NodeSpec[]): ParseResult {
|
||||
export function parseCode(
|
||||
code: string,
|
||||
specs: NodeSpec[],
|
||||
edgeFieldNames: string[] = [
|
||||
"label",
|
||||
"condition",
|
||||
"transition_speech",
|
||||
"transition_speech_type",
|
||||
"transition_speech_recording_id",
|
||||
],
|
||||
): ParseResult {
|
||||
const specByName = new Map(specs.map((s) => [s.name, s]));
|
||||
const allowedEdgeFieldNames = new Set(edgeFieldNames);
|
||||
const sourceFile = ts.createSourceFile(
|
||||
"workflow.ts",
|
||||
code,
|
||||
|
|
@ -335,6 +346,12 @@ export function parseCode(code: string, specs: NodeSpec[]): ParseResult {
|
|||
addError(stmt, "`edge` requires a non-empty `condition` string.");
|
||||
return;
|
||||
}
|
||||
for (const key of Object.keys(optsObj)) {
|
||||
if (!allowedEdgeFieldNames.has(key)) {
|
||||
addError(stmt, `Unknown edge field: \`${key}\`.`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
edges.push({
|
||||
id: `${src.id}-${tgt.id}`,
|
||||
source: src.id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue