@sensigo/realm 0.40.0 → 0.42.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 (42) hide show
  1. package/dist/adapters/gorgias-adapter.d.ts.map +1 -1
  2. package/dist/adapters/gorgias-adapter.js +39 -10
  3. package/dist/adapters/gorgias-adapter.js.map +1 -1
  4. package/dist/engine/execution-loop.d.ts.map +1 -1
  5. package/dist/engine/execution-loop.js +124 -21
  6. package/dist/engine/execution-loop.js.map +1 -1
  7. package/dist/engine/run-health.d.ts +1 -1
  8. package/dist/engine/run-health.d.ts.map +1 -1
  9. package/dist/engine/run-health.js +49 -4
  10. package/dist/engine/run-health.js.map +1 -1
  11. package/dist/index.d.ts +6 -2
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +7 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/types/run-record.d.ts +11 -1
  16. package/dist/types/run-record.d.ts.map +1 -1
  17. package/dist/types/run-record.js.map +1 -1
  18. package/dist/types/workflow-definition.d.ts +146 -10
  19. package/dist/types/workflow-definition.d.ts.map +1 -1
  20. package/dist/types/workflow-definition.js +225 -0
  21. package/dist/types/workflow-definition.js.map +1 -1
  22. package/dist/types/workflow-error.d.ts +45 -1
  23. package/dist/types/workflow-error.d.ts.map +1 -1
  24. package/dist/types/workflow-error.js +30 -1
  25. package/dist/types/workflow-error.js.map +1 -1
  26. package/dist/workflow/diagnostics.d.ts +19 -15
  27. package/dist/workflow/diagnostics.d.ts.map +1 -1
  28. package/dist/workflow/diagnostics.js +19 -28
  29. package/dist/workflow/diagnostics.js.map +1 -1
  30. package/dist/workflow/registrar.d.ts +68 -0
  31. package/dist/workflow/registrar.d.ts.map +1 -1
  32. package/dist/workflow/registrar.js +92 -5
  33. package/dist/workflow/registrar.js.map +1 -1
  34. package/dist/workflow/step-key-registry.d.ts +1258 -0
  35. package/dist/workflow/step-key-registry.d.ts.map +1 -0
  36. package/dist/workflow/step-key-registry.js +1217 -0
  37. package/dist/workflow/step-key-registry.js.map +1 -0
  38. package/dist/workflow/yaml-loader.d.ts +33 -0
  39. package/dist/workflow/yaml-loader.d.ts.map +1 -1
  40. package/dist/workflow/yaml-loader.js +1485 -1242
  41. package/dist/workflow/yaml-loader.js.map +1 -1
  42. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import type { WorkflowDefinition } from '../types/workflow-definition.js';
2
+ import type { RunRecord } from '../types/run-record.js';
2
3
  export interface WorkflowRegistrar {
3
4
  /** Persist a WorkflowDefinition under its id, overwriting any previous registration. */
4
5
  register(definition: WorkflowDefinition): Promise<void>;
@@ -16,5 +17,72 @@ export declare class JsonWorkflowStore implements WorkflowRegistrar {
16
17
  register(definition: WorkflowDefinition): Promise<void>;
17
18
  get(workflowId: string): Promise<WorkflowDefinition>;
18
19
  list(): Promise<WorkflowDefinition[]>;
20
+ /**
21
+ * Everything `list()` returns, plus what it silently drops (issue #427).
22
+ *
23
+ * `list()` skips a file it cannot parse, which is right for a caller that just wants the
24
+ * definitions and wrong for an operator asking what is in their registry: realm cannot audit
25
+ * what it cannot read, and saying nothing about it is how a broken entry stays invisible.
26
+ *
27
+ * `mismatched` covers a second invisible case. `<id>.json` is the write convention, but a
28
+ * hand-edited file can carry an inner id that differs from its basename — and since anything
29
+ * resolving a workflow by id resolves by FILENAME, such an entry is reachable under a name
30
+ * this list would not print. Disclosed rather than corrected.
31
+ *
32
+ * Additive and CONCRETE: `WorkflowRegistrar` is untouched, so no other implementation has to
33
+ * grow a method to satisfy a read surface only the CLI uses.
34
+ */
35
+ listWithDiagnostics(): Promise<{
36
+ workflows: WorkflowDefinition[];
37
+ unreadable: Array<{
38
+ file: string;
39
+ reason: string;
40
+ }>;
41
+ mismatched: Array<{
42
+ file: string;
43
+ id: string;
44
+ }>;
45
+ }>;
19
46
  }
47
+ /**
48
+ * Fetches the workflow definition a run-context resolution needs, wrapping a
49
+ * `STATE_WORKFLOW_NOT_FOUND` throw with the one-time-register remedy (issue #456) — the ONE
50
+ * chokepoint every run-context site (`respond`, `resume`, `replay`, `drain`, `agent --run-id`,
51
+ * and the MCP `submit_human_response`/`execute_step`/`append_trace` tools) calls, instead of each
52
+ * hand-wrapping its own raw `store.get(run.workflow_id)`.
53
+ *
54
+ * The `store` and `run` parameters are narrowed to exactly what this function uses
55
+ * (`Pick<WorkflowRegistrar, 'get'>` / `Pick<RunRecord, 'workflow_id'>`) — by necessity, not taste:
56
+ * `resolveRunAttach`'s own dependency type IS that narrower `Pick` (its test doubles are get-only,
57
+ * and a full `WorkflowRegistrar` parameter here would not compile at that call site). Every other
58
+ * caller passes a full registrar and a full run record, both structurally assignable to the
59
+ * narrower type.
60
+ *
61
+ * HEDGED reasoning, moved here from `run-attach.ts`'s inline comment (its call site now just
62
+ * points back here): this function genuinely cannot know WHY the workflow is missing. A wiped
63
+ * store, a different `$HOME`, and a run created from a file without `--register` all mint the
64
+ * identical `STATE_WORKFLOW_NOT_FOUND` from the registrar — so the remedy says "most often",
65
+ * never "because". Keyed on the stable error CODE, never on message text.
66
+ *
67
+ * PRECONDITION — run-context resolution ONLY. A by-id lookup with no run behind it (`start_run`,
68
+ * `start_run_batch`, `get_workflow_protocol`) must never call this: there the hedge would be
69
+ * false — "this run was created from a file without --register" presumes a run that does not
70
+ * exist yet.
71
+ *
72
+ * Every OTHER `WorkflowError` (e.g. `STATE_LEGACY_FORMAT`, which already carries its own correct
73
+ * "Re-register it with: …" remedy) passes through completely untouched, by identity — wrapping it
74
+ * would double-remedy. A non-`WorkflowError` throw also passes through untouched.
75
+ *
76
+ * issue #493 seam: if definition snapshots ever land on the run record, the snapshot-wins
77
+ * resolution order belongs INSIDE this function — every run-context caller updates for free.
78
+ *
79
+ * @param store Anything that can `.get()` a workflow by id.
80
+ * @param run The run whose `workflow_id` to resolve.
81
+ * @param opts `retryVerb` — the verb this call site's remedy should recommend retrying with
82
+ * (e.g. `'re-attach'`, `'respond again'`, `'resume again'`, `'replay again'`,
83
+ * `'drain again'`, or the MCP-neutral `'retry'`).
84
+ */
85
+ export declare function getWorkflowForRun(store: Pick<WorkflowRegistrar, 'get'>, run: Pick<RunRecord, 'workflow_id'>, opts: {
86
+ retryVerb: string;
87
+ }): Promise<WorkflowDefinition>;
20
88
  //# sourceMappingURL=registrar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registrar.d.ts","sourceRoot":"","sources":["../../src/workflow/registrar.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAK1E,MAAM,WAAW,iBAAiB;IAChC,wFAAwF;IACxF,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,8EAA8E;IAC9E,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACrD,qCAAqC;IACrC,IAAI,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;CACvC;AAED;;GAEG;AACH,qBAAa,iBAAkB,YAAW,iBAAiB;IACzD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;gBAEjB,OAAO,CAAC,EAAE,MAAM;IAKtB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAOvD,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgCpD,IAAI,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;CAa5C"}
1
+ {"version":3,"file":"registrar.d.ts","sourceRoot":"","sources":["../../src/workflow/registrar.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAKxD,MAAM,WAAW,iBAAiB;IAChC,wFAAwF;IACxF,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,8EAA8E;IAC9E,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACrD,qCAAqC;IACrC,IAAI,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;CACvC;AAED;;GAEG;AACH,qBAAa,iBAAkB,YAAW,iBAAiB;IACzD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;gBAEjB,OAAO,CAAC,EAAE,MAAM;IAKtB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAOvD,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgCpD,IAAI,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAQ3C;;;;;;;;;;;;;;OAcG;IACG,mBAAmB,IAAI,OAAO,CAAC;QACnC,SAAS,EAAE,kBAAkB,EAAE,CAAC;QAChC,UAAU,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACpD,UAAU,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACjD,CAAC;CAqBH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,EACrC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,EACnC,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CAoB7B"}
@@ -45,18 +45,105 @@ export class JsonWorkflowStore {
45
45
  return parsed;
46
46
  }
47
47
  async list() {
48
+ // Re-expressed over listWithDiagnostics (issue #427) so there is ONE directory walk and one
49
+ // parse policy. The interface contract is unchanged — callers that only want the readable
50
+ // definitions still get exactly those, and the skipped files stay skipped here.
51
+ const { workflows } = await this.listWithDiagnostics();
52
+ return workflows;
53
+ }
54
+ /**
55
+ * Everything `list()` returns, plus what it silently drops (issue #427).
56
+ *
57
+ * `list()` skips a file it cannot parse, which is right for a caller that just wants the
58
+ * definitions and wrong for an operator asking what is in their registry: realm cannot audit
59
+ * what it cannot read, and saying nothing about it is how a broken entry stays invisible.
60
+ *
61
+ * `mismatched` covers a second invisible case. `<id>.json` is the write convention, but a
62
+ * hand-edited file can carry an inner id that differs from its basename — and since anything
63
+ * resolving a workflow by id resolves by FILENAME, such an entry is reachable under a name
64
+ * this list would not print. Disclosed rather than corrected.
65
+ *
66
+ * Additive and CONCRETE: `WorkflowRegistrar` is untouched, so no other implementation has to
67
+ * grow a method to satisfy a read surface only the CLI uses.
68
+ */
69
+ async listWithDiagnostics() {
48
70
  const entries = readdirSync(this.dir).filter((f) => f.endsWith('.json'));
49
- const results = [];
71
+ const workflows = [];
72
+ const unreadable = [];
73
+ const mismatched = [];
50
74
  for (const entry of entries) {
75
+ let parsed;
51
76
  try {
52
77
  const raw = readFileSync(join(this.dir, entry), 'utf8');
53
- results.push(JSON.parse(raw));
78
+ parsed = JSON.parse(raw);
79
+ }
80
+ catch (err) {
81
+ unreadable.push({ file: entry, reason: err instanceof Error ? err.message : String(err) });
82
+ continue;
54
83
  }
55
- catch {
56
- // Skip files that fail to parse
84
+ workflows.push(parsed);
85
+ if (entry !== `${String(parsed.id)}.json`) {
86
+ mismatched.push({ file: entry, id: String(parsed.id) });
57
87
  }
58
88
  }
59
- return results;
89
+ return { workflows, unreadable, mismatched };
90
+ }
91
+ }
92
+ /**
93
+ * Fetches the workflow definition a run-context resolution needs, wrapping a
94
+ * `STATE_WORKFLOW_NOT_FOUND` throw with the one-time-register remedy (issue #456) — the ONE
95
+ * chokepoint every run-context site (`respond`, `resume`, `replay`, `drain`, `agent --run-id`,
96
+ * and the MCP `submit_human_response`/`execute_step`/`append_trace` tools) calls, instead of each
97
+ * hand-wrapping its own raw `store.get(run.workflow_id)`.
98
+ *
99
+ * The `store` and `run` parameters are narrowed to exactly what this function uses
100
+ * (`Pick<WorkflowRegistrar, 'get'>` / `Pick<RunRecord, 'workflow_id'>`) — by necessity, not taste:
101
+ * `resolveRunAttach`'s own dependency type IS that narrower `Pick` (its test doubles are get-only,
102
+ * and a full `WorkflowRegistrar` parameter here would not compile at that call site). Every other
103
+ * caller passes a full registrar and a full run record, both structurally assignable to the
104
+ * narrower type.
105
+ *
106
+ * HEDGED reasoning, moved here from `run-attach.ts`'s inline comment (its call site now just
107
+ * points back here): this function genuinely cannot know WHY the workflow is missing. A wiped
108
+ * store, a different `$HOME`, and a run created from a file without `--register` all mint the
109
+ * identical `STATE_WORKFLOW_NOT_FOUND` from the registrar — so the remedy says "most often",
110
+ * never "because". Keyed on the stable error CODE, never on message text.
111
+ *
112
+ * PRECONDITION — run-context resolution ONLY. A by-id lookup with no run behind it (`start_run`,
113
+ * `start_run_batch`, `get_workflow_protocol`) must never call this: there the hedge would be
114
+ * false — "this run was created from a file without --register" presumes a run that does not
115
+ * exist yet.
116
+ *
117
+ * Every OTHER `WorkflowError` (e.g. `STATE_LEGACY_FORMAT`, which already carries its own correct
118
+ * "Re-register it with: …" remedy) passes through completely untouched, by identity — wrapping it
119
+ * would double-remedy. A non-`WorkflowError` throw also passes through untouched.
120
+ *
121
+ * issue #493 seam: if definition snapshots ever land on the run record, the snapshot-wins
122
+ * resolution order belongs INSIDE this function — every run-context caller updates for free.
123
+ *
124
+ * @param store Anything that can `.get()` a workflow by id.
125
+ * @param run The run whose `workflow_id` to resolve.
126
+ * @param opts `retryVerb` — the verb this call site's remedy should recommend retrying with
127
+ * (e.g. `'re-attach'`, `'respond again'`, `'resume again'`, `'replay again'`,
128
+ * `'drain again'`, or the MCP-neutral `'retry'`).
129
+ */
130
+ export async function getWorkflowForRun(store, run, opts) {
131
+ try {
132
+ return await store.get(run.workflow_id);
133
+ }
134
+ catch (err) {
135
+ if (err instanceof WorkflowError && err.code === 'STATE_WORKFLOW_NOT_FOUND') {
136
+ throw new WorkflowError(`${err.message} — most often this run was created from a file without --register. ` +
137
+ `Register the workflow (realm workflow register <file>) and ${opts.retryVerb}.`, {
138
+ code: err.code,
139
+ category: err.category,
140
+ agentAction: err.agentAction,
141
+ retryable: err.retryable,
142
+ details: err.details,
143
+ ...(err.warnings !== undefined ? { warnings: err.warnings } : {}),
144
+ });
145
+ }
146
+ throw err;
60
147
  }
61
148
  }
62
149
  //# sourceMappingURL=registrar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"registrar.js","sourceRoot":"","sources":["../../src/workflow/registrar.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAW3D;;GAEG;AACH,MAAM,OAAO,iBAAiB;IACX,GAAG,CAAS;IAE7B,YAAY,OAAgB;QAC1B,IAAI,CAAC,GAAG,GAAG,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC7D,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,UAA8B;QAC3C,MAAM,eAAe,CACnB,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,EAAE,OAAO,CAAC,EACv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