@yagr/agent 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/config/n8n-config-service.d.ts +2 -0
  2. package/dist/config/n8n-config-service.d.ts.map +1 -1
  3. package/dist/config/n8n-config-service.js +31 -2
  4. package/dist/config/n8n-config-service.js.map +1 -1
  5. package/dist/prompt/build-system-prompt.d.ts.map +1 -1
  6. package/dist/prompt/build-system-prompt.js +4 -2
  7. package/dist/prompt/build-system-prompt.js.map +1 -1
  8. package/dist/runtime/completion-gate.d.ts.map +1 -1
  9. package/dist/runtime/completion-gate.js +3 -2
  10. package/dist/runtime/completion-gate.js.map +1 -1
  11. package/dist/runtime/outcome.d.ts.map +1 -1
  12. package/dist/runtime/outcome.js +3 -0
  13. package/dist/runtime/outcome.js.map +1 -1
  14. package/dist/runtime/policy-hooks.d.ts +2 -0
  15. package/dist/runtime/policy-hooks.d.ts.map +1 -1
  16. package/dist/runtime/policy-hooks.js +34 -0
  17. package/dist/runtime/policy-hooks.js.map +1 -1
  18. package/dist/runtime/run-engine.d.ts +3 -0
  19. package/dist/runtime/run-engine.d.ts.map +1 -1
  20. package/dist/runtime/run-engine.js +190 -85
  21. package/dist/runtime/run-engine.js.map +1 -1
  22. package/dist/tools/n8nac.d.ts +2 -0
  23. package/dist/tools/n8nac.d.ts.map +1 -1
  24. package/dist/tools/n8nac.js +24 -1
  25. package/dist/tools/n8nac.js.map +1 -1
  26. package/dist/tools/present-workflow-result.d.ts +3 -0
  27. package/dist/tools/present-workflow-result.d.ts.map +1 -1
  28. package/dist/tools/present-workflow-result.js +83 -1
  29. package/dist/tools/present-workflow-result.js.map +1 -1
  30. package/dist/webui/app.js +18 -13
  31. package/dist/webui/app.js.map +2 -2
  32. package/dist/webui/styles.css +72 -10
  33. package/dist/webui/styles.css.map +2 -2
  34. package/package.json +1 -1
@@ -1,6 +1,87 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
1
3
  import { tool } from 'ai';
2
4
  import { z } from 'zod';
5
+ import { getYagrHomeDir, getYagrLaunchDir } from '../config/yagr-home.js';
3
6
  import { emitToolEvent } from './observer.js';
7
+ const WORKFLOW_FILE_SUFFIX = '.workflow.ts';
8
+ const WORKFLOW_SCAN_SKIP_DIRS = new Set(['.git', 'dist', 'node_modules', 'docs', 'build']);
9
+ export function extractWorkflowMapHeader(source) {
10
+ const start = source.indexOf('<workflow-map>');
11
+ const end = source.indexOf('</workflow-map>');
12
+ if (start === -1 || end === -1 || end < start) {
13
+ return undefined;
14
+ }
15
+ return source.slice(start, end + '</workflow-map>'.length).trim();
16
+ }
17
+ function findWorkflowFileById(rootDir, workflowId) {
18
+ if (!rootDir || !fs.existsSync(rootDir)) {
19
+ return undefined;
20
+ }
21
+ const queue = [rootDir];
22
+ while (queue.length > 0) {
23
+ const currentDir = queue.shift();
24
+ if (!currentDir) {
25
+ continue;
26
+ }
27
+ let entries = [];
28
+ try {
29
+ entries = fs.readdirSync(currentDir, { withFileTypes: true });
30
+ }
31
+ catch {
32
+ continue;
33
+ }
34
+ for (const entry of entries) {
35
+ const fullPath = path.join(currentDir, entry.name);
36
+ if (entry.isDirectory()) {
37
+ if (!WORKFLOW_SCAN_SKIP_DIRS.has(entry.name)) {
38
+ queue.push(fullPath);
39
+ }
40
+ continue;
41
+ }
42
+ if (!entry.isFile() || !entry.name.endsWith(WORKFLOW_FILE_SUFFIX)) {
43
+ continue;
44
+ }
45
+ try {
46
+ const source = fs.readFileSync(fullPath, 'utf-8');
47
+ if (source.includes(`id: '${workflowId}'`) || source.includes(`id: "${workflowId}"`)) {
48
+ return fullPath;
49
+ }
50
+ }
51
+ catch {
52
+ continue;
53
+ }
54
+ }
55
+ }
56
+ return undefined;
57
+ }
58
+ export function resolveLocalWorkflowDiagram(workflowId) {
59
+ const candidateRoots = Array.from(new Set([getYagrHomeDir(), getYagrLaunchDir()]));
60
+ for (const rootDir of candidateRoots) {
61
+ const workflowFile = findWorkflowFileById(rootDir, workflowId);
62
+ if (!workflowFile) {
63
+ continue;
64
+ }
65
+ try {
66
+ const source = fs.readFileSync(workflowFile, 'utf-8');
67
+ const extracted = extractWorkflowMapHeader(source);
68
+ if (extracted) {
69
+ return extracted;
70
+ }
71
+ }
72
+ catch {
73
+ continue;
74
+ }
75
+ }
76
+ return undefined;
77
+ }
78
+ export function resolveWorkflowDiagram(workflowId, fallbackDiagram) {
79
+ const localDiagram = resolveLocalWorkflowDiagram(workflowId);
80
+ if (localDiagram) {
81
+ return localDiagram;
82
+ }
83
+ return fallbackDiagram;
84
+ }
4
85
  export function createPresentWorkflowResultTool(observer) {
5
86
  return tool({
6
87
  description: 'Present an n8n workflow to the user as a rich clickable card in the UI. ' +
@@ -14,6 +95,7 @@ export function createPresentWorkflowResultTool(observer) {
14
95
  diagram: z.string().optional().describe('ASCII art diagram of the workflow graph, typically the header block from the n8nac TypeScript output.'),
15
96
  }),
16
97
  execute: async ({ workflowId, workflowUrl, title, diagram }) => {
98
+ const resolvedDiagram = resolveWorkflowDiagram(workflowId, diagram);
17
99
  await emitToolEvent(observer, {
18
100
  type: 'embed',
19
101
  toolName: 'presentWorkflowResult',
@@ -21,7 +103,7 @@ export function createPresentWorkflowResultTool(observer) {
21
103
  workflowId,
22
104
  url: workflowUrl,
23
105
  title,
24
- diagram,
106
+ diagram: resolvedDiagram,
25
107
  });
26
108
  return { presented: true, workflowId };
27
109
  },
@@ -1 +1 @@
1
- {"version":3,"file":"present-workflow-result.js","sourceRoot":"","sources":["../../src/tools/present-workflow-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,UAAU,+BAA+B,CAAC,QAAgC;IAC9E,OAAO,IAAI,CAAC;QACV,WAAW,EACT,0EAA0E;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AAI,EAAE,UAAU;gBAChB,UAAU;gBACV,GAAG,EAAE,WAAW;gBAChB,KAAK;gBACL,OAAO,EAAE,eAAe;aACzB,CAAC,CAAC;YACH,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QACzC,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
package/dist/webui/app.js CHANGED
@@ -26123,8 +26123,11 @@
26123
26123
  ] })
26124
26124
  ] });
26125
26125
  }
26126
+ function normalizeWorkflowMapLine(line) {
26127
+ return line.replace(/^\s*\/\*+\s?/, "").replace(/^\s*\*\/?\s?/, "").replace(/^\s*\/\/?\s?/, "").replace(/\s*\*\/\s*$/, "").trimEnd();
26128
+ }
26126
26129
  function parseWorkflowMap(diagram) {
26127
- const lines = diagram.split("\n").map((l) => l.replace(/^\/\/\s?/, ""));
26130
+ const lines = diagram.split("\n").map(normalizeWorkflowMapLine);
26128
26131
  const nodeIndex = /* @__PURE__ */ new Map();
26129
26132
  let inNodeIndex = false;
26130
26133
  for (const line of lines) {
@@ -26136,7 +26139,7 @@
26136
26139
  inNodeIndex = false;
26137
26140
  continue;
26138
26141
  }
26139
- if (line.trim().startsWith("\u2500\u2500") || line.trim().startsWith("Property name")) continue;
26142
+ if (/^[\s\-_=─]+$/.test(line.trim()) || line.trim().startsWith("Property name")) continue;
26140
26143
  if (!inNodeIndex) continue;
26141
26144
  const match = line.match(/^\s*(\S+)\s{2,}(\S+)/);
26142
26145
  if (match) nodeIndex.set(match[1], match[2]);
@@ -26150,11 +26153,12 @@
26150
26153
  inRouting = true;
26151
26154
  continue;
26152
26155
  }
26153
- if (line.trim().startsWith("</workflow-map>") || line.trim().startsWith("AI CONNECTIONS")) break;
26156
+ if (line.trim().startsWith("<workflow-map>") || line.trim().startsWith("</workflow-map>")) continue;
26157
+ if (line.trim().startsWith("AI CONNECTIONS")) break;
26154
26158
  if (!inRouting) continue;
26155
- if (line.trim().startsWith("\u2500\u2500") || !line.trim()) continue;
26159
+ if (/^[\s\-_=─]+$/.test(line.trim()) || !line.trim()) continue;
26156
26160
  const isLoop = line.includes("(\u21A9 loop)");
26157
- const arrowMatch = line.match(/^(\s*)\.out\(\d+\)\s+→\s*(\S+)/) ?? line.match(/^(\s*)→\s*(\S+)/);
26161
+ const arrowMatch = line.match(/^(\s*)\.out\(\d+\)\s+(?:→|->)\s*(\S+)/) ?? line.match(/^(\s*)(?:→|->)\s*(\S+)/);
26158
26162
  if (arrowMatch) {
26159
26163
  const depth = Math.floor(arrowMatch[1].length / 2);
26160
26164
  const name2 = arrowMatch[2];
@@ -26260,8 +26264,8 @@
26260
26264
  height: svgH,
26261
26265
  children: [
26262
26266
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("defs", { children: [
26263
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("marker", { id: "wf-arrow", markerWidth: "8", markerHeight: "6", refX: "8", refY: "3", orient: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M0,0 L8,3 L0,6", fill: "#94a3b8" }) }),
26264
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("marker", { id: "wf-loop-arrow", markerWidth: "8", markerHeight: "6", refX: "8", refY: "3", orient: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M0,0 L8,3 L0,6", fill: "#f59e0b" }) })
26267
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("marker", { id: "wf-arrow", markerWidth: "8", markerHeight: "6", refX: "8", refY: "3", orient: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M0,0 L8,3 L0,6", fill: "var(--workflow-graph-edge)" }) }),
26268
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("marker", { id: "wf-loop-arrow", markerWidth: "8", markerHeight: "6", refX: "8", refY: "3", orient: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M0,0 L8,3 L0,6", fill: "var(--workflow-graph-loop)" }) })
26265
26269
  ] }),
26266
26270
  graph.edges.map((e, i) => {
26267
26271
  const src = graph.nodes.find((n) => n.id === e.from);
@@ -26280,7 +26284,7 @@
26280
26284
  {
26281
26285
  d: `M${x12},${y12} C${x12},${cpY} ${x22},${cpY} ${x22},${y22}`,
26282
26286
  fill: "none",
26283
- stroke: "#f59e0b",
26287
+ stroke: "var(--workflow-graph-loop)",
26284
26288
  strokeWidth: 1.5,
26285
26289
  strokeDasharray: "5 3",
26286
26290
  markerEnd: "url(#wf-loop-arrow)"
@@ -26298,7 +26302,7 @@
26298
26302
  {
26299
26303
  d: `M${x1},${y1} C${cx},${y1} ${cx},${y2} ${x2},${y2}`,
26300
26304
  fill: "none",
26301
- stroke: "#cbd5e1",
26305
+ stroke: "var(--workflow-graph-edge)",
26302
26306
  strokeWidth: 2,
26303
26307
  markerEnd: "url(#wf-arrow)"
26304
26308
  },
@@ -26318,7 +26322,7 @@
26318
26322
  height: NODE_H,
26319
26323
  rx: 10,
26320
26324
  ry: 10,
26321
- fill: "white",
26325
+ fill: "var(--workflow-graph-node-bg)",
26322
26326
  stroke: color2,
26323
26327
  strokeWidth: 2
26324
26328
  }
@@ -26331,7 +26335,7 @@
26331
26335
  textAnchor: "middle",
26332
26336
  fontSize: 11,
26333
26337
  fontWeight: 600,
26334
- fill: "#1e293b",
26338
+ fill: "var(--workflow-graph-node-text)",
26335
26339
  children: n.label.length > 18 ? `${n.label.slice(0, 16)}\u2026` : n.label
26336
26340
  }
26337
26341
  ),
@@ -26342,7 +26346,7 @@
26342
26346
  y: p.y + 36,
26343
26347
  textAnchor: "middle",
26344
26348
  fontSize: 9,
26345
- fill: "#94a3b8",
26349
+ fill: "var(--workflow-graph-node-muted)",
26346
26350
  children: n.type
26347
26351
  }
26348
26352
  )
@@ -26915,11 +26919,12 @@
26915
26919
  return;
26916
26920
  }
26917
26921
  if (streamEvent.type === "final") {
26922
+ const statusLabel = streamEvent.finalState === "stopped" ? "Stopped" : streamEvent.finalState === "failed_terminal" ? "Run failed" : streamEvent.requiredActions?.length ? "Needs attention" : "Completed";
26918
26923
  patchMessage(pendingId, {
26919
26924
  text: streamEvent.response,
26920
26925
  streaming: false,
26921
26926
  finalState: streamEvent.finalState,
26922
- statusLabel: streamEvent.finalState === "stopped" ? "Stopped" : streamEvent.requiredActions?.length ? "Needs attention" : "Completed",
26927
+ statusLabel,
26923
26928
  phase: void 0
26924
26929
  });
26925
26930
  setBusyLabel(void 0);