@sensigo/realm-cli 0.39.0 → 0.40.0

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 (77) hide show
  1. package/dist/agent/drive-failure.d.ts +62 -0
  2. package/dist/agent/drive-failure.d.ts.map +1 -0
  3. package/dist/agent/drive-failure.js +241 -0
  4. package/dist/agent/drive-failure.js.map +1 -0
  5. package/dist/agent/providers/agent-utils.d.ts +132 -0
  6. package/dist/agent/providers/agent-utils.d.ts.map +1 -1
  7. package/dist/agent/providers/agent-utils.js +348 -1
  8. package/dist/agent/providers/agent-utils.js.map +1 -1
  9. package/dist/agent/providers/anthropic-provider.d.ts +51 -1
  10. package/dist/agent/providers/anthropic-provider.d.ts.map +1 -1
  11. package/dist/agent/providers/anthropic-provider.js +109 -30
  12. package/dist/agent/providers/anthropic-provider.js.map +1 -1
  13. package/dist/agent/providers/llm-provider.d.ts +13 -1
  14. package/dist/agent/providers/llm-provider.d.ts.map +1 -1
  15. package/dist/agent/providers/llm-provider.js +8 -4
  16. package/dist/agent/providers/llm-provider.js.map +1 -1
  17. package/dist/agent/providers/openai-provider.d.ts +6 -1
  18. package/dist/agent/providers/openai-provider.d.ts.map +1 -1
  19. package/dist/agent/providers/openai-provider.js +75 -20
  20. package/dist/agent/providers/openai-provider.js.map +1 -1
  21. package/dist/agent/providers/openai-reasoning-provider.d.ts +4 -1
  22. package/dist/agent/providers/openai-reasoning-provider.d.ts.map +1 -1
  23. package/dist/agent/providers/openai-reasoning-provider.js +21 -6
  24. package/dist/agent/providers/openai-reasoning-provider.js.map +1 -1
  25. package/dist/agent/run-agent.d.ts +9 -0
  26. package/dist/agent/run-agent.d.ts.map +1 -1
  27. package/dist/agent/run-agent.js +775 -680
  28. package/dist/agent/run-agent.js.map +1 -1
  29. package/dist/agent/run-attach.d.ts.map +1 -1
  30. package/dist/agent/run-attach.js +26 -2
  31. package/dist/agent/run-attach.js.map +1 -1
  32. package/dist/agent/test-support/anthropic-stub.d.ts +45 -0
  33. package/dist/agent/test-support/anthropic-stub.d.ts.map +1 -0
  34. package/dist/agent/test-support/anthropic-stub.js +146 -0
  35. package/dist/agent/test-support/anthropic-stub.js.map +1 -0
  36. package/dist/agent/test-support/composed-journey.d.ts +40 -0
  37. package/dist/agent/test-support/composed-journey.d.ts.map +1 -0
  38. package/dist/agent/test-support/composed-journey.js +104 -0
  39. package/dist/agent/test-support/composed-journey.js.map +1 -0
  40. package/dist/agent/test-support/mcp-server-entry.d.ts +20 -0
  41. package/dist/agent/test-support/mcp-server-entry.d.ts.map +1 -0
  42. package/dist/agent/test-support/mcp-server-entry.js +39 -0
  43. package/dist/agent/test-support/mcp-server-entry.js.map +1 -0
  44. package/dist/agent/test-support/openai-stub.d.ts +47 -0
  45. package/dist/agent/test-support/openai-stub.d.ts.map +1 -0
  46. package/dist/agent/test-support/openai-stub.js +115 -0
  47. package/dist/agent/test-support/openai-stub.js.map +1 -0
  48. package/dist/commands/agent.d.ts.map +1 -1
  49. package/dist/commands/agent.js +17 -0
  50. package/dist/commands/agent.js.map +1 -1
  51. package/dist/commands/gc.d.ts.map +1 -1
  52. package/dist/commands/gc.js.map +1 -1
  53. package/dist/commands/inspect.d.ts.map +1 -1
  54. package/dist/commands/inspect.js +42 -0
  55. package/dist/commands/inspect.js.map +1 -1
  56. package/dist/commands/list.d.ts.map +1 -1
  57. package/dist/commands/list.js +35 -0
  58. package/dist/commands/list.js.map +1 -1
  59. package/dist/commands/purge.d.ts +22 -1
  60. package/dist/commands/purge.d.ts.map +1 -1
  61. package/dist/commands/purge.js +70 -42
  62. package/dist/commands/purge.js.map +1 -1
  63. package/dist/commands/register.d.ts.map +1 -1
  64. package/dist/commands/register.js +3 -1
  65. package/dist/commands/register.js.map +1 -1
  66. package/dist/commands/validate.d.ts.map +1 -1
  67. package/dist/commands/validate.js +7 -5
  68. package/dist/commands/validate.js.map +1 -1
  69. package/dist/commands/watch.d.ts.map +1 -1
  70. package/dist/commands/watch.js +6 -4
  71. package/dist/commands/watch.js.map +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/lib/loader-warnings.d.ts +22 -1
  74. package/dist/lib/loader-warnings.d.ts.map +1 -1
  75. package/dist/lib/loader-warnings.js +42 -2
  76. package/dist/lib/loader-warnings.js.map +1 -1
  77. package/package.json +5 -4
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import 'dotenv/config';
4
4
  import { Command } from 'commander';
5
5
  import { workflowCommands, runCommands, topLevelCommands } from './commands-registry.js';
6
6
  const program = new Command();
7
- program.name('realm').description('Realm workflow engine CLI').version('0.39.0');
7
+ program.name('realm').description('Realm workflow engine CLI').version('0.40.0');
8
8
  // realm workflow — operations on workflow definitions
9
9
  const workflowCmd = new Command('workflow').description('Manage workflow definitions');
10
10
  for (const cmd of workflowCommands)
@@ -1,5 +1,13 @@
1
1
  import { type LoaderWarning, type WarningCode } from '@sensigo/realm';
2
- /** Prints every warning via the single renderLoaderWarning format source. */
2
+ /**
3
+ * Prints every warning via the single renderLoaderWarning format source, correcting the
4
+ * "— ignored" claim for any warning this boundary will actually refuse.
5
+ *
6
+ * Resolved against DEFAULT_POLICY, which is the policy the boundary-reject itself uses. A warning
7
+ * that only fails under `--strict` still renders "— ignored" — see the report's design note; the
8
+ * `--strict` path prints its own "failing due to --strict" line, so the author is not left
9
+ * without an explanation.
10
+ */
3
11
  export declare function printLoaderWarnings(warnings: LoaderWarning[]): void;
4
12
  /**
5
13
  * The dormant issue #170 boundary-reject hook, factored ONCE so validate/register/watch can't
@@ -12,4 +20,17 @@ export declare function printLoaderWarnings(warnings: LoaderWarning[]): void;
12
20
  export declare function rejectOnErrorSeverity(warnings: LoaderWarning[], policy?: Record<WarningCode, 'warn' | 'error'>): boolean;
13
21
  /** True if `--strict` should fail the command given these accumulated warnings. */
14
22
  export declare function failsStrict(warnings: LoaderWarning[]): boolean;
23
+ /**
24
+ * Renders a load failure without saying "invalid" twice (issue #417).
25
+ *
26
+ * The loader's own message already begins `Invalid workflow: …`, so wrapping it in `Invalid: `
27
+ * produced `Invalid: Invalid workflow: Step 'x': …` — an author's first three words are the same
28
+ * word twice, before anything they can act on. Where the message announces itself, it is printed
29
+ * verbatim; where it does not (a non-loader error surfacing on the same path), the prefix still
30
+ * earns its place.
31
+ *
32
+ * Applies only to the message-echoing renders. The standalone strict-escalation lines have their
33
+ * own text and are untouched.
34
+ */
35
+ export declare function renderLoadFailure(message: string): string;
15
36
  //# sourceMappingURL=loader-warnings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader-warnings.d.ts","sourceRoot":"","sources":["../../src/lib/loader-warnings.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AAExB,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,IAAI,CAInE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,EAAE,EACzB,MAAM,GAAE,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAkB,GAC7D,OAAO,CAET;AAWD,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,OAAO,CAE9D"}
1
+ {"version":3,"file":"loader-warnings.d.ts","sourceRoot":"","sources":["../../src/lib/loader-warnings.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AAiBxB;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,IAAI,CASnE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,EAAE,EACzB,MAAM,GAAE,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAkB,GAC7D,OAAO,CAET;AAWD,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,OAAO,CAE9D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD"}
@@ -3,10 +3,35 @@
3
3
  // only caller of renderLoaderWarning — no command hand-rolls a `⚠ ` string), and the dormant
4
4
  // #170 boundary-reject is factored into ONE shared helper so validate/register/watch can't drift.
5
5
  import { renderLoaderWarning, resolveSeverity, DEFAULT_POLICY, } from '@sensigo/realm';
6
- /** Prints every warning via the single renderLoaderWarning format source. */
6
+ /**
7
+ * The unknown-key warning is minted with "— ignored", which is true of the LENIENT loader
8
+ * (run/agent/listen really do ignore the key and carry on) and false here: the only callers of
9
+ * this function are validate/register/watch, and post-#170 those three REFUSE a workflow whose
10
+ * warning resolves to 'error'. Printing "— ignored" one line above "escalated to an error" tells
11
+ * the author the opposite of what is about to happen to them.
12
+ *
13
+ * Substituted at the RENDER, not the mint, precisely because the mint is shared with the lenient
14
+ * path — where the original wording is true and worth keeping. The did-you-mean fragment is
15
+ * untouched: it is the most useful half of the line and the reason the author can fix this in one
16
+ * edit.
17
+ */
18
+ const IGNORED_CLAUSE = '— ignored';
19
+ const REFUSED_CLAUSE = '— REFUSED below';
20
+ /**
21
+ * Prints every warning via the single renderLoaderWarning format source, correcting the
22
+ * "— ignored" claim for any warning this boundary will actually refuse.
23
+ *
24
+ * Resolved against DEFAULT_POLICY, which is the policy the boundary-reject itself uses. A warning
25
+ * that only fails under `--strict` still renders "— ignored" — see the report's design note; the
26
+ * `--strict` path prints its own "failing due to --strict" line, so the author is not left
27
+ * without an explanation.
28
+ */
7
29
  export function printLoaderWarnings(warnings) {
8
30
  for (const w of warnings) {
9
- console.warn(renderLoaderWarning(w));
31
+ const line = renderLoaderWarning(w);
32
+ console.warn(resolveSeverity(w.code, DEFAULT_POLICY) === 'error'
33
+ ? line.replace(IGNORED_CLAUSE, REFUSED_CLAUSE)
34
+ : line);
10
35
  }
11
36
  }
12
37
  /**
@@ -30,4 +55,19 @@ const ALL_ERROR_POLICY = Object.fromEntries(Object.keys(DEFAULT_POLICY).map((cod
30
55
  export function failsStrict(warnings) {
31
56
  return rejectOnErrorSeverity(warnings, ALL_ERROR_POLICY);
32
57
  }
58
+ /**
59
+ * Renders a load failure without saying "invalid" twice (issue #417).
60
+ *
61
+ * The loader's own message already begins `Invalid workflow: …`, so wrapping it in `Invalid: `
62
+ * produced `Invalid: Invalid workflow: Step 'x': …` — an author's first three words are the same
63
+ * word twice, before anything they can act on. Where the message announces itself, it is printed
64
+ * verbatim; where it does not (a non-loader error surfacing on the same path), the prefix still
65
+ * earns its place.
66
+ *
67
+ * Applies only to the message-echoing renders. The standalone strict-escalation lines have their
68
+ * own text and are untouched.
69
+ */
70
+ export function renderLoadFailure(message) {
71
+ return message.startsWith('Invalid workflow:') ? message : `Invalid: ${message}`;
72
+ }
33
73
  //# sourceMappingURL=loader-warnings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader-warnings.js","sourceRoot":"","sources":["../../src/lib/loader-warnings.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,gGAAgG;AAChG,6FAA6F;AAC7F,kGAAkG;AAClG,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,GAGf,MAAM,gBAAgB,CAAC;AAExB,6EAA6E;AAC7E,MAAM,UAAU,mBAAmB,CAAC,QAAyB;IAC3D,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAyB,EACzB,SAAgD,cAAc;IAE9D,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,OAAO,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CAAC,KAAK,OAAO,CAAC,CAAC;AAC3E,CAAC;AAED;;;;GAIG;AACH,MAAM,gBAAgB,GAA0C,MAAM,CAAC,WAAW,CAC/E,MAAM,CAAC,IAAI,CAAC,cAAc,CAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CACrC,CAAC;AAE3C,mFAAmF;AACnF,MAAM,UAAU,WAAW,CAAC,QAAyB;IACnD,OAAO,qBAAqB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,OAAO,EAAE,CAAC;AACnF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sensigo/realm-cli",
3
- "version": "0.39.0",
3
+ "version": "0.40.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -55,6 +55,7 @@
55
55
  }
56
56
  },
57
57
  "devDependencies": {
58
+ "@anthropic-ai/sdk": "^0.120.0",
58
59
  "@types/js-yaml": "^4.0.9",
59
60
  "@types/node": "^26.1.1",
60
61
  "openai": "^6.34.0",
@@ -63,9 +64,9 @@
63
64
  "vitest": "^4.1.0"
64
65
  },
65
66
  "dependencies": {
66
- "@sensigo/realm": "^0.39.0",
67
- "@sensigo/realm-mcp": "^0.39.0",
68
- "@sensigo/realm-testing": "^0.39.0",
67
+ "@sensigo/realm": "^0.40.0",
68
+ "@sensigo/realm-mcp": "^0.40.0",
69
+ "@sensigo/realm-testing": "^0.40.0",
69
70
  "@modelcontextprotocol/sdk": "1.30.0",
70
71
  "chalk": "^5.0.0",
71
72
  "commander": "^15.0.0",