Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"devDependencies": {
"@biomejs/biome": "2.6.9",
"@makingchatbots/genesys-cloud-architect-diagram-lib": "^1.7.2",
"@makingchatbots/genesys-cloud-architect-diagram-lib": "^1.8.0",
"@modelcontextprotocol/sdk": "^1.32.2",
"@resvg/resvg-wasm": "2.6.2",
"@types/node": "^26.6.11",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

184 changes: 92 additions & 92 deletions servers/genesys-cloud-architect-mcp.js

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion skills/architect-diagram/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,17 @@ message, a slide, or a frame for an animation. Pick Mermaid for a README or a PR
like the editor, does not. Say that
the red outline and tag are additions the editor does not draw. If the result lists
anything under `standIns`, say those boxes are drawn with the nearest look rather than
from an editor capture; when it is empty there is nothing more to add. Relay any
from an editor capture; when it is empty there is nothing more to add. If the result
has `cycleCuts`, the flow loops back on itself outside a Loop action and the picture
stops just before repeating: say the task does not end where the picture does, name
the action it goes back to (`reenters`) and the last one drawn (`after`), and trace
the loop with `flow_ir`. The field is absent when nothing was cut. Relay any
`notes`: a PNG that could not be written, actions with no configuration.

If the tool answers that a task "would draw more than 2000 action boxes", its branches
share or cross-link their targets and it cannot be drawn in the editor's layout: say so
and describe the task from `flow_ir` (or as Mermaid) instead of retrying.

For a sketch of a proposed change, or a flow the plugin cannot read, pass `graph` instead
of a flow id; the tool's description gives the shape and the kinds.

Expand Down Expand Up @@ -78,6 +86,13 @@ Virtual Agent, Disconnect. Not modelled at all: collapsed actions, left-to-right
shadows and selection states. An action type the renderer does not know draws as a gear
with the IR's description as its body.

An IVR menu task has no canvas in the editor (it is a form), so it is drawn as one box
named after the task with a pill per choice and each choice's action under it, dashed
back because a choice hands the caller on. That box is a stand-in too (`drawnAs:
"ivr_menu"`, no badge, `actionType: null`); highlight it with `<taskId>::start`. A
transfer shows its Failure path only, and the action a failed transfer continues at is
drawn below it.

Highlights are this renderer's addition, not an editor feature.

## Animating customers through a flow
Expand Down
29 changes: 27 additions & 2 deletions src/mcp-server/tools/flow-diagram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ export const flowDiagram: ToolFactory<ToolConfig, typeof inputSchema> = ({
"box a user names from a screenshot pass that badge number straight in " +
"(badge numbers appear only here, in the result's boxes, not in flow_ir). " +
"Deliver the PNG path (or the SVG inline), say which task and configuration " +
"it shows, and name any action the result lists under standIns. For a text " +
"it shows, and name any action the result lists under standIns. If the result " +
"has cycleCuts, the picture stops short of a loop in the flow: say so. For a text " +
"diagram that renders in markdown, use flow_ir and write Mermaid instead.",
annotations: {
title: "Flow Diagram",
Expand Down Expand Up @@ -318,7 +319,19 @@ export const flowDiagram: ToolFactory<ToolConfig, typeof inputSchema> = ({
entry: target.id === ir.entryTaskId,
};

diagram = diagramForTask(ir, fetched.configuration, target.id);
try {
diagram = diagramForTask(
ir,
fetched.configuration,
target.id,
);
} catch (e) {
// a task too tangled to draw (branches sharing their targets
// multiply the boxes); the message says so and points at flow_ir
return err(
`Cannot draw task "${target.name}" of flow "${flowId}": ${(e as Error).message}`,
);
}
flow = diagram.flow;
}

Expand Down Expand Up @@ -379,6 +392,16 @@ export const flowDiagram: ToolFactory<ToolConfig, typeof inputSchema> = ({
"description for an unknown type). Say so when delivering the picture.",
);
}
const cycleCuts = diagram?.cycleCuts ?? [];
if (cycleCuts.length > 0) {
notes.push(
"cycleCuts lists places where the flow loops back on itself outside a " +
"Loop action: the next action is one the sequence is already inside " +
"(`reenters`), so the picture stops after `after` instead of drawing " +
"it again. The task does NOT end where the picture does; say so, and " +
"trace the loop with flow_ir (the edge is marked backEdge there).",
);
}
const missingRaw = diagram?.missingConfiguration ?? 0;
if (missingRaw > 0) {
notes.push(
Expand Down Expand Up @@ -461,6 +484,8 @@ export const flowDiagram: ToolFactory<ToolConfig, typeof inputSchema> = ({
highlighted: Object.keys(highlightMap),
standIns,
hiddenOutputs,
// only when the picture stops short of the flow
...(cycleCuts.length > 0 ? { cycleCuts } : {}),
boxes,
...(notes.length > 0 ? { notes } : {}),
}),
Expand Down
Loading