@sensigo/realm 0.15.0 → 0.17.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 (69) hide show
  1. package/dist/adapters/adapter-utils.d.ts +6 -0
  2. package/dist/adapters/adapter-utils.d.ts.map +1 -1
  3. package/dist/adapters/adapter-utils.js +21 -0
  4. package/dist/adapters/adapter-utils.js.map +1 -1
  5. package/dist/adapters/file-adapter.d.ts +1 -1
  6. package/dist/adapters/file-adapter.d.ts.map +1 -1
  7. package/dist/adapters/file-adapter.js +10 -2
  8. package/dist/adapters/file-adapter.js.map +1 -1
  9. package/dist/adapters/gorgias-adapter.d.ts +6 -4
  10. package/dist/adapters/gorgias-adapter.d.ts.map +1 -1
  11. package/dist/adapters/gorgias-adapter.js +102 -18
  12. package/dist/adapters/gorgias-adapter.js.map +1 -1
  13. package/dist/adapters/notion-adapter.d.ts +1 -0
  14. package/dist/adapters/notion-adapter.d.ts.map +1 -1
  15. package/dist/adapters/notion-adapter.js +7 -6
  16. package/dist/adapters/notion-adapter.js.map +1 -1
  17. package/dist/adapters/slack-adapter.d.ts.map +1 -1
  18. package/dist/adapters/slack-adapter.js +11 -0
  19. package/dist/adapters/slack-adapter.js.map +1 -1
  20. package/dist/engine/backoff.d.ts +4 -0
  21. package/dist/engine/backoff.d.ts.map +1 -0
  22. package/dist/engine/backoff.js +18 -0
  23. package/dist/engine/backoff.js.map +1 -0
  24. package/dist/engine/capability.d.ts +52 -0
  25. package/dist/engine/capability.d.ts.map +1 -0
  26. package/dist/engine/capability.js +76 -0
  27. package/dist/engine/capability.js.map +1 -0
  28. package/dist/engine/claim-liveness.d.ts +86 -0
  29. package/dist/engine/claim-liveness.d.ts.map +1 -0
  30. package/dist/engine/claim-liveness.js +108 -0
  31. package/dist/engine/claim-liveness.js.map +1 -0
  32. package/dist/engine/execution-loop.d.ts.map +1 -1
  33. package/dist/engine/execution-loop.js +137 -33
  34. package/dist/engine/execution-loop.js.map +1 -1
  35. package/dist/engine/reclaim-step.d.ts +37 -0
  36. package/dist/engine/reclaim-step.d.ts.map +1 -0
  37. package/dist/engine/reclaim-step.js +122 -0
  38. package/dist/engine/reclaim-step.js.map +1 -0
  39. package/dist/evidence/snapshot.d.ts +5 -0
  40. package/dist/evidence/snapshot.d.ts.map +1 -1
  41. package/dist/evidence/snapshot.js +3 -0
  42. package/dist/evidence/snapshot.js.map +1 -1
  43. package/dist/index.d.ts +8 -1
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +5 -1
  46. package/dist/index.js.map +1 -1
  47. package/dist/store/atomic-write.d.ts +29 -0
  48. package/dist/store/atomic-write.d.ts.map +1 -0
  49. package/dist/store/atomic-write.js +51 -0
  50. package/dist/store/atomic-write.js.map +1 -0
  51. package/dist/store/json-file-store.d.ts +2 -0
  52. package/dist/store/json-file-store.d.ts.map +1 -1
  53. package/dist/store/json-file-store.js +51 -23
  54. package/dist/store/json-file-store.js.map +1 -1
  55. package/dist/store/store-interface.d.ts +9 -0
  56. package/dist/store/store-interface.d.ts.map +1 -1
  57. package/dist/types/run-record.d.ts +60 -0
  58. package/dist/types/run-record.d.ts.map +1 -1
  59. package/dist/types/workflow-definition.d.ts +10 -0
  60. package/dist/types/workflow-definition.d.ts.map +1 -1
  61. package/dist/types/workflow-error.d.ts +1 -1
  62. package/dist/types/workflow-error.d.ts.map +1 -1
  63. package/dist/types/workflow-error.js.map +1 -1
  64. package/dist/workflow/registrar.d.ts.map +1 -1
  65. package/dist/workflow/registrar.js +3 -2
  66. package/dist/workflow/registrar.js.map +1 -1
  67. package/dist/workflow/yaml-loader.js +38 -0
  68. package/dist/workflow/yaml-loader.js.map +1 -1
  69. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"slack-adapter.js","sourceRoot":"","sources":["../../src/adapters/slack-adapter.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAO3D;;;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AM,EAAE,EAAE;gBACxE,IAAI,EAAE,wBAAwB;gBAC9B,QAAQ,EAAE,QAAQ;gBAClB,WAAW,EAAE,gBAAgB;gBAC7B,SAAS,EAAE,KAAK;aACjB,CAAC,CAAC;QACL,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,MAAM,CACV,UAAkB,EAClB,OAAgC,EAChC,OAAgC,EAChC,OAAqB;QAErB,MAAM,IAAI,aAAa,CAAC,sCAAsC,EAAE;YAC9D,IAAI,EAAE,wBAAwB;YAC9B,QAAQ,EAAE,QAAQ;YAClB,WAAW,EAAE,gBAAgB;YAC7B,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ import type { RetryConfig } from '../types/workflow-definition.js';
2
+ /** Computes the delay (ms) before a retry attempt based on the configured backoff strategy. */
3
+ export declare function computeBackoff(config: RetryConfig, attemptNum: number): number;
4
+ //# sourceMappingURL=backoff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backoff.d.ts","sourceRoot":"","sources":["../../src/engine/backoff.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,+FAA+F;AAC/F,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAe9E"}
@@ -0,0 +1,18 @@
1
+ /** Computes the delay (ms) before a retry attempt based on the configured backoff strategy. */
2
+ export function computeBackoff(config, attemptNum) {
3
+ const backoff = config.backoff ?? 'fixed';
4
+ const base = config.base_delay_ms ?? 0;
5
+ let delay;
6
+ switch (backoff) {
7
+ case 'linear':
8
+ delay = base * attemptNum;
9
+ break;
10
+ case 'exponential':
11
+ delay = base * Math.pow(2, attemptNum - 1);
12
+ break;
13
+ default: // 'fixed'
14
+ delay = base;
15
+ }
16
+ return config.max_delay_ms !== undefined ? Math.min(delay, config.max_delay_ms) : delay;
17
+ }
18
+ //# sourceMappingURL=backoff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backoff.js","sourceRoot":"","sources":["../../src/engine/backoff.ts"],"names":[],"mappings":"AAOA,+FAA+F;AAC/F,MAAM,UAAU,cAAc,CAAC,MAAmB,EAAE,UAAkB;IACpE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC;IAC1C,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,IAAI,CAAC,CAAC;IACvC,IAAI,KAAa,CAAC;IAClB,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,QAAQ;YACX,KAAK,GAAG,IAAI,GAAG,UAAU,CAAC;YAC1B,MAAM;QACR,KAAK,aAAa;YAChB,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC;YAC3C,MAAM;QACR,SAAS,UAAU;YACjB,KAAK,GAAG,IAAI,CAAC;IACjB,CAAC;IACD,OAAO,MAAM,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1F,CAAC"}
@@ -0,0 +1,52 @@
1
+ import type { WorkflowDefinition, StepDefinition } from '../types/workflow-definition.js';
2
+ import type { RunRecord } from '../types/run-record.js';
3
+ import type { ExtensionRegistry } from '../extensions/registry.js';
4
+ /** The single handler/adapter an auto step requires. `step` is the step name (StepDefinition carries none). */
5
+ export interface Requirement {
6
+ step: string;
7
+ kind: 'handler' | 'adapter';
8
+ name: string;
9
+ }
10
+ /**
11
+ * The capability requirement a step imposes on the executing registry, or `undefined` if it imposes none.
12
+ *
13
+ * Mirrors the dispatch precedence in the execution loop EXACTLY (uses_service → adapter; else handler),
14
+ * and ONLY for `execution: 'auto'` steps — agent/guard/finalizer steps and the built-in agent dispatcher
15
+ * impose no registry requirement. For an adapter step whose service is absent from `definition.services`,
16
+ * returns `undefined`: that is a workflow-authoring bug surfaced elsewhere (service-not-found), not a
17
+ * capability gap the runner can fix by registering an adapter.
18
+ */
19
+ export declare function requirementForStep(step: string, stepDef: StepDefinition, definition: WorkflowDefinition): Requirement | undefined;
20
+ /**
21
+ * Part B pre-flight: the auto-step requirements the given registry CANNOT satisfy. Pure — `registry.has`
22
+ * is a Map lookup, no dispatch. Callers WARN on a non-empty result at run creation; they never REFUSE
23
+ * (a run can be created against one runner and executed by a differently-provisioned one — see #134).
24
+ */
25
+ export declare function unmetCapabilities(definition: WorkflowDefinition, registry: ExtensionRegistry): Requirement[];
26
+ /**
27
+ * Advisory warning line for one unmet capability — shared by every run-creating path (#134) so the
28
+ * pre-flight warning phrasing can never drift between start_run, start_run_batch, CLI run, and the
29
+ * run-agent create path. Advisory ONLY: names the gap and its recoverable consequence; never a refusal.
30
+ */
31
+ export declare function capabilityWarning(requirement: Requirement): string;
32
+ /** A capability-blocked step surfaced by {@link findCapabilityBlockedSteps}. */
33
+ export interface CapabilityBlockInfo {
34
+ step: string;
35
+ requirement: {
36
+ kind: 'handler' | 'adapter';
37
+ name: string;
38
+ };
39
+ code: string;
40
+ at: string;
41
+ }
42
+ /**
43
+ * Part A recovery detection: steps parked by a mid-run not-registered failure that are STILL eligible.
44
+ *
45
+ * Definition-free by design — reads only `capability_blocks` and the four step sets. A marker is reported
46
+ * only when its step is eligible-but-unclaimed (∉ completed ∪ in_progress ∪ failed ∪ skipped). This
47
+ * cross-check makes a stale marker self-suppress: if the step has since completed (or been claimed) on a
48
+ * correctly-provisioned runner, its marker is silently ignored, so CLEARING the marker on recovery is
49
+ * hygiene, not correctness. Returns [] for legacy/capability-clean records (no `capability_blocks`).
50
+ */
51
+ export declare function findCapabilityBlockedSteps(run: RunRecord): CapabilityBlockInfo[];
52
+ //# sourceMappingURL=capability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../src/engine/capability.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC1F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,+GAA+G;AAC/G,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,kBAAkB,GAC7B,WAAW,GAAG,SAAS,CAWzB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,kBAAkB,EAC9B,QAAQ,EAAE,iBAAiB,GAC1B,WAAW,EAAE,CASf;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAMlE;AAED,gFAAgF;AAChF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE;QAAE,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,SAAS,GAAG,mBAAmB,EAAE,CAehF"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * The capability requirement a step imposes on the executing registry, or `undefined` if it imposes none.
3
+ *
4
+ * Mirrors the dispatch precedence in the execution loop EXACTLY (uses_service → adapter; else handler),
5
+ * and ONLY for `execution: 'auto'` steps — agent/guard/finalizer steps and the built-in agent dispatcher
6
+ * impose no registry requirement. For an adapter step whose service is absent from `definition.services`,
7
+ * returns `undefined`: that is a workflow-authoring bug surfaced elsewhere (service-not-found), not a
8
+ * capability gap the runner can fix by registering an adapter.
9
+ */
10
+ export function requirementForStep(step, stepDef, definition) {
11
+ if (stepDef.execution !== 'auto')
12
+ return undefined;
13
+ if (stepDef.uses_service !== undefined) {
14
+ const service = definition.services?.[stepDef.uses_service];
15
+ if (service === undefined)
16
+ return undefined;
17
+ return { step, kind: 'adapter', name: service.adapter };
18
+ }
19
+ if (stepDef.handler !== undefined) {
20
+ return { step, kind: 'handler', name: stepDef.handler };
21
+ }
22
+ return undefined;
23
+ }
24
+ /**
25
+ * Part B pre-flight: the auto-step requirements the given registry CANNOT satisfy. Pure — `registry.has`
26
+ * is a Map lookup, no dispatch. Callers WARN on a non-empty result at run creation; they never REFUSE
27
+ * (a run can be created against one runner and executed by a differently-provisioned one — see #134).
28
+ */
29
+ export function unmetCapabilities(definition, registry) {
30
+ const unmet = [];
31
+ for (const [step, stepDef] of Object.entries(definition.steps)) {
32
+ const requirement = requirementForStep(step, stepDef, definition);
33
+ if (requirement !== undefined && !registry.has(requirement.kind, requirement.name)) {
34
+ unmet.push(requirement);
35
+ }
36
+ }
37
+ return unmet;
38
+ }
39
+ /**
40
+ * Advisory warning line for one unmet capability — shared by every run-creating path (#134) so the
41
+ * pre-flight warning phrasing can never drift between start_run, start_run_batch, CLI run, and the
42
+ * run-agent create path. Advisory ONLY: names the gap and its recoverable consequence; never a refusal.
43
+ */
44
+ export function capabilityWarning(requirement) {
45
+ return (`Step '${requirement.step}' needs ${requirement.kind} '${requirement.name}', which is not ` +
46
+ `registered in this runner. If reached it will block recoverably (not fail) until a runner that ` +
47
+ `provides this ${requirement.kind} executes it — load the missing extension or run on a capable runner.`);
48
+ }
49
+ /**
50
+ * Part A recovery detection: steps parked by a mid-run not-registered failure that are STILL eligible.
51
+ *
52
+ * Definition-free by design — reads only `capability_blocks` and the four step sets. A marker is reported
53
+ * only when its step is eligible-but-unclaimed (∉ completed ∪ in_progress ∪ failed ∪ skipped). This
54
+ * cross-check makes a stale marker self-suppress: if the step has since completed (or been claimed) on a
55
+ * correctly-provisioned runner, its marker is silently ignored, so CLEARING the marker on recovery is
56
+ * hygiene, not correctness. Returns [] for legacy/capability-clean records (no `capability_blocks`).
57
+ */
58
+ export function findCapabilityBlockedSteps(run) {
59
+ const blocks = run.capability_blocks;
60
+ if (blocks === undefined)
61
+ return [];
62
+ const settled = new Set([
63
+ ...run.completed_steps,
64
+ ...run.in_progress_steps,
65
+ ...run.failed_steps,
66
+ ...run.skipped_steps,
67
+ ]);
68
+ const blocked = [];
69
+ for (const [step, block] of Object.entries(blocks)) {
70
+ if (settled.has(step))
71
+ continue;
72
+ blocked.push({ step, requirement: block.requirement, code: block.code, at: block.at });
73
+ }
74
+ return blocked;
75
+ }
76
+ //# sourceMappingURL=capability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability.js","sourceRoot":"","sources":["../../src/engine/capability.ts"],"names":[],"mappings":"AAqBA;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAY,EACZ,OAAuB,EACvB,UAA8B;IAE9B,IAAI,OAAO,CAAC,SAAS,KAAK,MAAM;QAAE,OAAO,SAAS,CAAC;IACnD,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC5D,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC5C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1D,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,KAAK,SAA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AAG,GAAG,CAAC,aAAa;KACrB,CAAC,CAAC;IACH,MAAM,OAAO,GAA0B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,SAAS;QAChC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,86 @@
1
+ import type { RunRecord, ClaimRecord } from '../types/run-record.js';
2
+ import type { WorkflowDefinition, StepDefinition } from '../types/workflow-definition.js';
3
+ /**
4
+ * Default execution timeout (issue A3) enforced on every `execution: 'auto'` step that declares no
5
+ * `timeout_seconds` — bounds a hung adapter/handler call so it fails loudly (`STEP_TIMEOUT`)
6
+ * instead of pinning the runner forever. Generous (1 hour, GitHub-Actions-style): it guards against
7
+ * a genuine hang, not normal-operation latency. Also now the basis of the claim-deadline DETECTION
8
+ * horizon in `computeClaimDeadline` below, so detection tracks the real enforcement bound. See
9
+ * plans/execution-timeout-a3-design.md for the full rationale.
10
+ */
11
+ export declare const DEFAULT_EXECUTION_TIMEOUT_SECONDS = 3600;
12
+ /**
13
+ * Whether `step`'s dispatch must be bounded by a timeout (issue A3). Pure: `execution === 'auto'`,
14
+ * period. Deliberately NOT conjoined with `hasFinalizers` — that conjunct is correct for
15
+ * *detection*'s claim horizon below (a claim may legitimately be held through a finalizer drain),
16
+ * but would be WRONG for *enforcement*: it would leave every auto step in a finalizer-bearing
17
+ * workflow completely unbounded — the exact hang this feature exists to prevent. Do NOT re-add a
18
+ * `hasFinalizers`/finalizer conjunct here (this split was the Design Reviewer's blocking-fix).
19
+ */
20
+ export declare function shouldEnforceTimeout(step: StepDefinition): boolean;
21
+ /**
22
+ * @deprecated Superseded by `DEFAULT_EXECUTION_TIMEOUT_SECONDS`; retained for API compatibility.
23
+ * Assumed handler wall-clock bound when a step declares no `timeout_seconds`. Biased large.
24
+ */
25
+ export declare const DEFAULT_STEP_TIMEOUT_SECONDS = 300;
26
+ /** Added to a step's `timeout_seconds` to absorb scheduling / clock skew before a claim is stale. */
27
+ export declare const RECLAIM_MARGIN_SECONDS = 60;
28
+ /**
29
+ * Minimum staleness horizon. A concrete claim is never `claim_stale` sooner than this, even for a
30
+ * fast handler — so a live-but-slow runner is not mislabeled. Biased large: too-large only delays
31
+ * the label (Phase 1 gates no action); too-small risks flagging live work. (Concrete deadlines are
32
+ * set ONLY for finalizer-free auto steps, so the worst-case finalizer-drain span never applies to a
33
+ * deadline-carrying claim — finalizer-bearing steps get `deadline: null` → `claim_unknown_age`.)
34
+ */
35
+ export declare const RECLAIM_FLOOR_SECONDS = 900;
36
+ /**
37
+ * Computes the claim deadline for `stepName` at claim time. A CONCRETE deadline is returned ONLY
38
+ * for a reliably time-boundable claim: an `execution: 'auto'` (handler-driven) step in a workflow
39
+ * with NO `execution: 'finalizer'` steps (so no finalizer drain can legitimately extend the claim
40
+ * past the seal). Every other claim returns `null` (→ `claim_unknown_age`): agent steps have no
41
+ * reliable wall-clock bound (the dispatcher returns instantly; `timeout_seconds` is advisory), and
42
+ * any step in a finalizer-bearing workflow may hold its claim through the terminal drain.
43
+ *
44
+ * The horizon is the WORST-CASE wall-clock across every retry attempt (issue #101 follow-up —
45
+ * Design Reviewer finding #4 from the A3 debate): a single-attempt bound understates a retrying
46
+ * step's real claim span (`max_attempts × per-attempt-timeout + the declared backoffs between
47
+ * attempts`), so a legitimately-retrying step could be labeled `claim_stale` — and, if
48
+ * `idempotent`, become eligible for a premature `realm run reclaim --all --force` re-drive —
49
+ * while still on an early attempt. For `n = 1` (no `retry:`, or `max_attempts: 1`) this reduces
50
+ * EXACTLY to the prior single-attempt formula `max(RECLAIM_FLOOR, perAttemptSec + MARGIN)`, so
51
+ * non-retry steps' horizons are byte-unchanged. This uses the DECLARED backoff schedule only — a
52
+ * runtime `retry_after` (rate-limit 429 override, applied in execution-loop.ts) is not knowable at
53
+ * claim time; the horizon stays a best-effort, floored, advisory bound (Phase 1 gates no action on
54
+ * this label) and does not attempt to model `retry_after`.
55
+ */
56
+ export declare function computeClaimDeadline(definition: WorkflowDefinition, stepName: string, now: Date): string | null;
57
+ /**
58
+ * Returns a NEW claims record with `stepName` removed (a fresh object — never mutates the input,
59
+ * so it is safe to use on a value spread from the prior record). Used at the settle/seal sites to
60
+ * delete the claim clock in the SAME record mutation that removes the step from
61
+ * `in_progress_steps`. Returns `{}` when the last claim is removed (harmless; detection ignores a
62
+ * run with no in-progress steps). A missed delete self-heals: `claimStep` overwrites `claims[S]`.
63
+ */
64
+ export declare function omitClaim(claims: Record<string, ClaimRecord> | undefined, stepName: string): Record<string, ClaimRecord>;
65
+ /**
66
+ * The 3-state liveness classification of a single in-progress claim (issue #101):
67
+ * - `healthy` — a concrete deadline that has not yet passed (a live runner is presumed on it).
68
+ * - `claim_stale` — a concrete deadline that has passed (the runner is presumed dead).
69
+ * - `claim_unknown_age` — no claim record, or a `null` deadline (agent / finalizer-bearing /
70
+ * legacy run). Detect-only, human-judged, NEVER auto-reclaimed.
71
+ */
72
+ export type ClaimState = 'healthy' | 'claim_stale' | 'claim_unknown_age';
73
+ /** Classifies a single claim record against `now`. Definition-free (reads only the stored deadline). */
74
+ export declare function classifyClaim(claim: ClaimRecord | undefined, now: Date): ClaimState;
75
+ /** A classified in-progress claim: the step, its liveness state, and its stored deadline. */
76
+ export interface InProgressClaimInfo {
77
+ step: string;
78
+ state: ClaimState;
79
+ deadline: string | null;
80
+ }
81
+ /**
82
+ * Classifies every in-progress claim on a run. Definition-free — works even when the workflow
83
+ * definition is unresolved (detection reads the stored per-claim deadline, not the definition).
84
+ */
85
+ export declare function classifyInProgressClaims(run: RunRecord, now?: Date): InProgressClaimInfo[];
86
+ //# sourceMappingURL=claim-liveness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim-liveness.d.ts","sourceRoot":"","sources":["../../src/engine/claim-liveness.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAG1F;;;;;;;GAOG;AACH,eAAO,MAAM,iCAAiC,OAAO,CAAC;AAEtD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAElE;AAKD;;;GAGG;AACH,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAChD,qGAAqG;AACrG,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,kBAAkB,EAC9B,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,IAAI,GACR,MAAM,GAAG,IAAI,CAgBf;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,SAAS,EAC/C,QAAQ,EAAE,MAAM,GACf,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAI7B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,mBAAmB,CAAC;AAEzE,wGAAwG;AACxG,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,EAAE,GAAG,EAAE,IAAI,GAAG,UAAU,CAGnF;AAED,6FAA6F;AAC7F,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,SAAS,EACd,GAAG,GAAE,IAAiB,GACrB,mBAAmB,EAAE,CAKvB"}
@@ -0,0 +1,108 @@
1
+ import { computeBackoff } from './backoff.js';
2
+ /**
3
+ * Default execution timeout (issue A3) enforced on every `execution: 'auto'` step that declares no
4
+ * `timeout_seconds` — bounds a hung adapter/handler call so it fails loudly (`STEP_TIMEOUT`)
5
+ * instead of pinning the runner forever. Generous (1 hour, GitHub-Actions-style): it guards against
6
+ * a genuine hang, not normal-operation latency. Also now the basis of the claim-deadline DETECTION
7
+ * horizon in `computeClaimDeadline` below, so detection tracks the real enforcement bound. See
8
+ * plans/execution-timeout-a3-design.md for the full rationale.
9
+ */
10
+ export const DEFAULT_EXECUTION_TIMEOUT_SECONDS = 3600; // 1 hour
11
+ /**
12
+ * Whether `step`'s dispatch must be bounded by a timeout (issue A3). Pure: `execution === 'auto'`,
13
+ * period. Deliberately NOT conjoined with `hasFinalizers` — that conjunct is correct for
14
+ * *detection*'s claim horizon below (a claim may legitimately be held through a finalizer drain),
15
+ * but would be WRONG for *enforcement*: it would leave every auto step in a finalizer-bearing
16
+ * workflow completely unbounded — the exact hang this feature exists to prevent. Do NOT re-add a
17
+ * `hasFinalizers`/finalizer conjunct here (this split was the Design Reviewer's blocking-fix).
18
+ */
19
+ export function shouldEnforceTimeout(step) {
20
+ return step.execution === 'auto';
21
+ }
22
+ // --- Deadline constants (Phase 1: the deadline drives the DETECTION DISPLAY only; it gates no
23
+ // action, so a too-large horizon merely delays a `claim_stale` label — bias LARGE).
24
+ /**
25
+ * @deprecated Superseded by `DEFAULT_EXECUTION_TIMEOUT_SECONDS`; retained for API compatibility.
26
+ * Assumed handler wall-clock bound when a step declares no `timeout_seconds`. Biased large.
27
+ */
28
+ export const DEFAULT_STEP_TIMEOUT_SECONDS = 300; // 5 min
29
+ /** Added to a step's `timeout_seconds` to absorb scheduling / clock skew before a claim is stale. */
30
+ export const RECLAIM_MARGIN_SECONDS = 60; // 1 min
31
+ /**
32
+ * Minimum staleness horizon. A concrete claim is never `claim_stale` sooner than this, even for a
33
+ * fast handler — so a live-but-slow runner is not mislabeled. Biased large: too-large only delays
34
+ * the label (Phase 1 gates no action); too-small risks flagging live work. (Concrete deadlines are
35
+ * set ONLY for finalizer-free auto steps, so the worst-case finalizer-drain span never applies to a
36
+ * deadline-carrying claim — finalizer-bearing steps get `deadline: null` → `claim_unknown_age`.)
37
+ */
38
+ export const RECLAIM_FLOOR_SECONDS = 900; // 15 min
39
+ /**
40
+ * Computes the claim deadline for `stepName` at claim time. A CONCRETE deadline is returned ONLY
41
+ * for a reliably time-boundable claim: an `execution: 'auto'` (handler-driven) step in a workflow
42
+ * with NO `execution: 'finalizer'` steps (so no finalizer drain can legitimately extend the claim
43
+ * past the seal). Every other claim returns `null` (→ `claim_unknown_age`): agent steps have no
44
+ * reliable wall-clock bound (the dispatcher returns instantly; `timeout_seconds` is advisory), and
45
+ * any step in a finalizer-bearing workflow may hold its claim through the terminal drain.
46
+ *
47
+ * The horizon is the WORST-CASE wall-clock across every retry attempt (issue #101 follow-up —
48
+ * Design Reviewer finding #4 from the A3 debate): a single-attempt bound understates a retrying
49
+ * step's real claim span (`max_attempts × per-attempt-timeout + the declared backoffs between
50
+ * attempts`), so a legitimately-retrying step could be labeled `claim_stale` — and, if
51
+ * `idempotent`, become eligible for a premature `realm run reclaim --all --force` re-drive —
52
+ * while still on an early attempt. For `n = 1` (no `retry:`, or `max_attempts: 1`) this reduces
53
+ * EXACTLY to the prior single-attempt formula `max(RECLAIM_FLOOR, perAttemptSec + MARGIN)`, so
54
+ * non-retry steps' horizons are byte-unchanged. This uses the DECLARED backoff schedule only — a
55
+ * runtime `retry_after` (rate-limit 429 override, applied in execution-loop.ts) is not knowable at
56
+ * claim time; the horizon stays a best-effort, floored, advisory bound (Phase 1 gates no action on
57
+ * this label) and does not attempt to model `retry_after`.
58
+ */
59
+ export function computeClaimDeadline(definition, stepName, now) {
60
+ const step = definition.steps[stepName];
61
+ if (step === undefined)
62
+ return null;
63
+ const hasFinalizers = Object.values(definition.steps).some((s) => s.execution === 'finalizer');
64
+ if (step.execution !== 'auto' || hasFinalizers)
65
+ return null;
66
+ const n = step.retry?.max_attempts ?? 1;
67
+ const perAttemptSec = step.timeout_seconds ?? DEFAULT_EXECUTION_TIMEOUT_SECONDS;
68
+ // Backoffs occur BETWEEN attempts: n-1 of them, for attemptNum 1..n-1 (matches the retry loop's
69
+ // schedule in execution-loop.ts). computeBackoff returns ms; the horizon is seconds.
70
+ let backoffSec = 0;
71
+ if (step.retry !== undefined) {
72
+ for (let a = 1; a < n; a++)
73
+ backoffSec += computeBackoff(step.retry, a) / 1000;
74
+ }
75
+ const worstCaseSec = n * perAttemptSec + backoffSec;
76
+ const horizonSeconds = Math.max(RECLAIM_FLOOR_SECONDS, worstCaseSec + RECLAIM_MARGIN_SECONDS);
77
+ return new Date(now.getTime() + horizonSeconds * 1000).toISOString();
78
+ }
79
+ /**
80
+ * Returns a NEW claims record with `stepName` removed (a fresh object — never mutates the input,
81
+ * so it is safe to use on a value spread from the prior record). Used at the settle/seal sites to
82
+ * delete the claim clock in the SAME record mutation that removes the step from
83
+ * `in_progress_steps`. Returns `{}` when the last claim is removed (harmless; detection ignores a
84
+ * run with no in-progress steps). A missed delete self-heals: `claimStep` overwrites `claims[S]`.
85
+ */
86
+ export function omitClaim(claims, stepName) {
87
+ if (claims === undefined)
88
+ return {};
89
+ const { [stepName]: _removed, ...rest } = claims;
90
+ return rest;
91
+ }
92
+ /** Classifies a single claim record against `now`. Definition-free (reads only the stored deadline). */
93
+ export function classifyClaim(claim, now) {
94
+ if (claim === undefined || claim.deadline === null)
95
+ return 'claim_unknown_age';
96
+ return now.getTime() > new Date(claim.deadline).getTime() ? 'claim_stale' : 'healthy';
97
+ }
98
+ /**
99
+ * Classifies every in-progress claim on a run. Definition-free — works even when the workflow
100
+ * definition is unresolved (detection reads the stored per-claim deadline, not the definition).
101
+ */
102
+ export function classifyInProgressClaims(run, now = new Date()) {
103
+ return run.in_progress_steps.map((step) => {
104
+ const claim = run.claims?.[step];
105
+ return { step, state: classifyClaim(claim, now), deadline: claim?.deadline ?? null };
106
+ });
107
+ }
108
+ //# sourceMappingURL=claim-liveness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim-liveness.js","sourceRoot":"","sources":["../../src/engine/claim-liveness.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,IAAI,CAAC,CAAC,SAAS;AAEhE;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAoB;IACvD,OAAO,IAAI,CAAC,SAAS,KAAK,MAAM,CAAC;AACnC,CAAC;AAED,+FAA+F;AAC/F,oFAAoF;AAEpF;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC,CAAC,QAAQ;AACzD,qGAAqG;AACrG,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC,CAAC,QAAQ;AAClD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC,CAAC,SAAS;AAEnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAA8B,EAC9B,QAAgB,EAChB,GAAS;IAET,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACpC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,WAAW,CAA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