@yagr/agent 0.2.5 → 0.2.7

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 (91) hide show
  1. package/dist/agent.d.ts +15 -1
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +35 -4
  4. package/dist/agent.js.map +1 -1
  5. package/dist/cli.js +124 -36
  6. package/dist/cli.js.map +1 -1
  7. package/dist/config/gateway-daemon.d.ts +10 -0
  8. package/dist/config/gateway-daemon.d.ts.map +1 -0
  9. package/dist/config/gateway-daemon.js +42 -0
  10. package/dist/config/gateway-daemon.js.map +1 -0
  11. package/dist/config/init-yagr-home.js +5 -4
  12. package/dist/config/init-yagr-home.js.map +1 -1
  13. package/dist/config/local-state.js +2 -2
  14. package/dist/config/local-state.js.map +1 -1
  15. package/dist/config/n8n-config-service.d.ts +10 -0
  16. package/dist/config/n8n-config-service.d.ts.map +1 -1
  17. package/dist/config/n8n-config-service.js +52 -4
  18. package/dist/config/n8n-config-service.js.map +1 -1
  19. package/dist/config/yagr-home.d.ts +4 -0
  20. package/dist/config/yagr-home.d.ts.map +1 -1
  21. package/dist/config/yagr-home.js +12 -4
  22. package/dist/config/yagr-home.js.map +1 -1
  23. package/dist/gateway/format-message.d.ts +25 -0
  24. package/dist/gateway/format-message.d.ts.map +1 -0
  25. package/dist/gateway/format-message.js +166 -0
  26. package/dist/gateway/format-message.js.map +1 -0
  27. package/dist/gateway/interactive-ui.d.ts.map +1 -1
  28. package/dist/gateway/interactive-ui.js +127 -15
  29. package/dist/gateway/interactive-ui.js.map +1 -1
  30. package/dist/gateway/manager.d.ts +7 -0
  31. package/dist/gateway/manager.d.ts.map +1 -1
  32. package/dist/gateway/manager.js +76 -0
  33. package/dist/gateway/manager.js.map +1 -1
  34. package/dist/gateway/telegram.d.ts.map +1 -1
  35. package/dist/gateway/telegram.js +70 -13
  36. package/dist/gateway/telegram.js.map +1 -1
  37. package/dist/gateway/webui.d.ts.map +1 -1
  38. package/dist/gateway/webui.js +19 -7
  39. package/dist/gateway/webui.js.map +1 -1
  40. package/dist/prompt/build-system-prompt.d.ts +11 -0
  41. package/dist/prompt/build-system-prompt.d.ts.map +1 -1
  42. package/dist/prompt/build-system-prompt.js +99 -55
  43. package/dist/prompt/build-system-prompt.js.map +1 -1
  44. package/dist/runtime/completion-gate.d.ts.map +1 -1
  45. package/dist/runtime/completion-gate.js +3 -2
  46. package/dist/runtime/completion-gate.js.map +1 -1
  47. package/dist/runtime/context-compaction.d.ts.map +1 -1
  48. package/dist/runtime/context-compaction.js +2 -7
  49. package/dist/runtime/context-compaction.js.map +1 -1
  50. package/dist/runtime/outcome.d.ts.map +1 -1
  51. package/dist/runtime/outcome.js +3 -0
  52. package/dist/runtime/outcome.js.map +1 -1
  53. package/dist/runtime/policy-hooks.d.ts +2 -0
  54. package/dist/runtime/policy-hooks.d.ts.map +1 -1
  55. package/dist/runtime/policy-hooks.js +42 -0
  56. package/dist/runtime/policy-hooks.js.map +1 -1
  57. package/dist/runtime/run-engine.d.ts +15 -1
  58. package/dist/runtime/run-engine.d.ts.map +1 -1
  59. package/dist/runtime/run-engine.js +264 -112
  60. package/dist/runtime/run-engine.js.map +1 -1
  61. package/dist/setup/setup-wizard.d.ts +1 -1
  62. package/dist/setup/setup-wizard.d.ts.map +1 -1
  63. package/dist/setup/setup-wizard.js +40 -5
  64. package/dist/setup/setup-wizard.js.map +1 -1
  65. package/dist/setup/start-launcher.d.ts +2 -21
  66. package/dist/setup/start-launcher.d.ts.map +1 -1
  67. package/dist/setup/start-launcher.js +14 -63
  68. package/dist/setup/start-launcher.js.map +1 -1
  69. package/dist/setup.d.ts +1 -0
  70. package/dist/setup.d.ts.map +1 -1
  71. package/dist/setup.js +31 -7
  72. package/dist/setup.js.map +1 -1
  73. package/dist/tools/build-tools.d.ts +9 -3
  74. package/dist/tools/build-tools.d.ts.map +1 -1
  75. package/dist/tools/n8nac.d.ts +7 -3
  76. package/dist/tools/n8nac.d.ts.map +1 -1
  77. package/dist/tools/n8nac.js +30 -5
  78. package/dist/tools/n8nac.js.map +1 -1
  79. package/dist/tools/present-workflow-result.d.ts +7 -0
  80. package/dist/tools/present-workflow-result.d.ts.map +1 -1
  81. package/dist/tools/present-workflow-result.js +84 -2
  82. package/dist/tools/present-workflow-result.js.map +1 -1
  83. package/dist/tools/workspace-utils.js +2 -2
  84. package/dist/tools/workspace-utils.js.map +1 -1
  85. package/dist/types.d.ts +2 -0
  86. package/dist/types.d.ts.map +1 -1
  87. package/dist/webui/app.js +23 -15
  88. package/dist/webui/app.js.map +2 -2
  89. package/dist/webui/styles.css +106 -34
  90. package/dist/webui/styles.css.map +2 -2
  91. package/package.json +2 -2
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];
@@ -26175,6 +26179,9 @@
26175
26179
  }
26176
26180
  }
26177
26181
  }
26182
+ if (orderedNames.length === 0) {
26183
+ orderedNames.push(...nodeIndex.keys());
26184
+ }
26178
26185
  if (orderedNames.length === 0) return null;
26179
26186
  const layerMap = /* @__PURE__ */ new Map();
26180
26187
  for (const name2 of orderedNames) {
@@ -26260,8 +26267,8 @@
26260
26267
  height: svgH,
26261
26268
  children: [
26262
26269
  /* @__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" }) })
26270
+ /* @__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)" }) }),
26271
+ /* @__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
26272
  ] }),
26266
26273
  graph.edges.map((e, i) => {
26267
26274
  const src = graph.nodes.find((n) => n.id === e.from);
@@ -26280,7 +26287,7 @@
26280
26287
  {
26281
26288
  d: `M${x12},${y12} C${x12},${cpY} ${x22},${cpY} ${x22},${y22}`,
26282
26289
  fill: "none",
26283
- stroke: "#f59e0b",
26290
+ stroke: "var(--workflow-graph-loop)",
26284
26291
  strokeWidth: 1.5,
26285
26292
  strokeDasharray: "5 3",
26286
26293
  markerEnd: "url(#wf-loop-arrow)"
@@ -26298,7 +26305,7 @@
26298
26305
  {
26299
26306
  d: `M${x1},${y1} C${cx},${y1} ${cx},${y2} ${x2},${y2}`,
26300
26307
  fill: "none",
26301
- stroke: "#cbd5e1",
26308
+ stroke: "var(--workflow-graph-edge)",
26302
26309
  strokeWidth: 2,
26303
26310
  markerEnd: "url(#wf-arrow)"
26304
26311
  },
@@ -26318,7 +26325,7 @@
26318
26325
  height: NODE_H,
26319
26326
  rx: 10,
26320
26327
  ry: 10,
26321
- fill: "white",
26328
+ fill: "var(--workflow-graph-node-bg)",
26322
26329
  stroke: color2,
26323
26330
  strokeWidth: 2
26324
26331
  }
@@ -26331,7 +26338,7 @@
26331
26338
  textAnchor: "middle",
26332
26339
  fontSize: 11,
26333
26340
  fontWeight: 600,
26334
- fill: "#1e293b",
26341
+ fill: "var(--workflow-graph-node-text)",
26335
26342
  children: n.label.length > 18 ? `${n.label.slice(0, 16)}\u2026` : n.label
26336
26343
  }
26337
26344
  ),
@@ -26342,7 +26349,7 @@
26342
26349
  y: p.y + 36,
26343
26350
  textAnchor: "middle",
26344
26351
  fontSize: 9,
26345
- fill: "#94a3b8",
26352
+ fill: "var(--workflow-graph-node-muted)",
26346
26353
  children: n.type
26347
26354
  }
26348
26355
  )
@@ -26386,8 +26393,8 @@
26386
26393
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "workGlyphRing workGlyphRingB" })
26387
26394
  ] }),
26388
26395
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "workMeta", children: [
26389
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: message.statusLabel ?? "Yagr is working" }),
26390
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "muted", children: "Compact live trace, without dumping the full internal reasoning." })
26396
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: message.statusLabel ?? "Yagr is working\u2026" }),
26397
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "muted", children: elapsed ? `Running for ${elapsed}` : "Thinking, planning, and executing\u2026" })
26391
26398
  ] })
26392
26399
  ] }) : null,
26393
26400
  showProgress && visibleProgress.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "progressTicker", children: visibleProgress.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `progressTickerEntry ${entry.tone}`, children: [
@@ -26915,11 +26922,12 @@
26915
26922
  return;
26916
26923
  }
26917
26924
  if (streamEvent.type === "final") {
26925
+ const statusLabel = streamEvent.finalState === "stopped" ? "Stopped" : streamEvent.finalState === "failed_terminal" ? "Run failed" : streamEvent.finalState === "completed" ? "Completed" : "Needs attention";
26918
26926
  patchMessage(pendingId, {
26919
26927
  text: streamEvent.response,
26920
26928
  streaming: false,
26921
26929
  finalState: streamEvent.finalState,
26922
- statusLabel: streamEvent.finalState === "stopped" ? "Stopped" : streamEvent.requiredActions?.length ? "Needs attention" : "Completed",
26930
+ statusLabel,
26923
26931
  phase: void 0
26924
26932
  });
26925
26933
  setBusyLabel(void 0);