@juicesharp/rpiv-workflow 2.13.8 → 2.13.9

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 (111) hide show
  1. package/api.ts +4 -4
  2. package/audit-ctx.ts +4 -4
  3. package/audit-rows.ts +6 -6
  4. package/audit.ts +17 -17
  5. package/built-ins.ts +2 -2
  6. package/chain-state.ts +7 -7
  7. package/command-run.ts +12 -12
  8. package/command.ts +3 -3
  9. package/death-scene.ts +4 -4
  10. package/docs/embedding.md +1 -1
  11. package/events.ts +6 -6
  12. package/execution-host.ts +3 -3
  13. package/extension.ts +3 -3
  14. package/failure-memos.ts +3 -3
  15. package/index.ts +2 -2
  16. package/internal.ts +10 -10
  17. package/judge.ts +4 -4
  18. package/load/alias.ts +4 -4
  19. package/load/cache.ts +4 -4
  20. package/load/index.ts +19 -19
  21. package/load/issues.ts +2 -2
  22. package/load/legacy.ts +2 -2
  23. package/load/merge.ts +7 -7
  24. package/load/normalize.ts +2 -2
  25. package/load/resolve-default.ts +2 -2
  26. package/load/shape-guards.ts +1 -1
  27. package/load/skill-contract-phase.ts +4 -4
  28. package/loop-constructors.ts +6 -6
  29. package/loop-def.ts +3 -3
  30. package/loop-kinds.ts +10 -10
  31. package/loop-parallel.ts +9 -9
  32. package/loop-waves.ts +3 -3
  33. package/loop.ts +11 -11
  34. package/loops/constructors.ts +5 -5
  35. package/loops/derivations.ts +5 -5
  36. package/loops/introspection.ts +3 -3
  37. package/loops/panel.ts +4 -4
  38. package/loops/verify.ts +3 -3
  39. package/messages.ts +2 -2
  40. package/outcomes/collectors/directory-path.ts +4 -4
  41. package/outcomes/collectors/index.ts +7 -7
  42. package/outcomes/collectors/text-scan.ts +6 -6
  43. package/outcomes/collectors/tool-call.ts +5 -5
  44. package/outcomes/collectors/transcript-path.ts +5 -5
  45. package/outcomes/collectors/union.ts +4 -4
  46. package/outcomes/collectors/url.ts +5 -5
  47. package/outcomes/collectors/workspace-diff.ts +4 -4
  48. package/outcomes/git-commit.ts +4 -4
  49. package/outcomes/index.ts +4 -4
  50. package/outcomes/parsers/index.ts +1 -1
  51. package/outcomes/parsers/json-body.ts +3 -3
  52. package/outcomes/side-effect.ts +1 -1
  53. package/output-spec.ts +3 -3
  54. package/output.ts +1 -1
  55. package/package.json +2 -2
  56. package/preview.ts +5 -5
  57. package/registration.ts +24 -24
  58. package/routing-dsl.ts +3 -3
  59. package/routing.ts +2 -2
  60. package/runner/by-name.ts +4 -4
  61. package/runner/by-run-id.ts +6 -6
  62. package/runner/chain-advance.ts +10 -10
  63. package/runner/errors.ts +1 -1
  64. package/runner/failure.ts +5 -5
  65. package/runner/index.ts +6 -6
  66. package/runner/input-validation.ts +8 -8
  67. package/runner/preflight.ts +7 -7
  68. package/runner/resolve-stage.ts +4 -4
  69. package/runner/resume-entry.ts +9 -9
  70. package/runner/resume-loop.ts +9 -9
  71. package/runner/resume.ts +15 -15
  72. package/runner/run-context.ts +8 -8
  73. package/runner/run-stage.ts +26 -26
  74. package/runner/runner.ts +18 -18
  75. package/runner/script-stage.ts +12 -12
  76. package/schema-compat.ts +2 -2
  77. package/semaphore.ts +1 -1
  78. package/sessions/bash-strikes.ts +1 -1
  79. package/sessions/extraction.ts +16 -16
  80. package/sessions/halt-routing.ts +10 -10
  81. package/sessions/index.ts +3 -3
  82. package/sessions/locate.ts +3 -3
  83. package/sessions/reattach.ts +8 -8
  84. package/sessions/sessions.ts +9 -9
  85. package/sessions/spawn.ts +2 -2
  86. package/sessions/success-persist.ts +7 -7
  87. package/skill-contract.ts +3 -3
  88. package/skill-contracts/composition.ts +5 -5
  89. package/skill-contracts/extension-points.ts +3 -3
  90. package/skill-contracts/harvest.ts +6 -6
  91. package/skill-contracts/index.ts +6 -6
  92. package/skill-contracts/registry.ts +2 -2
  93. package/stage-def.ts +5 -5
  94. package/stage-errors.ts +1 -1
  95. package/stage-identity.ts +3 -3
  96. package/startup.ts +5 -5
  97. package/state/index.ts +2 -2
  98. package/state/names.ts +3 -3
  99. package/state/raw.ts +1 -1
  100. package/state/reads.ts +5 -5
  101. package/state/resolve.ts +3 -3
  102. package/state/state.ts +8 -8
  103. package/state/writes.ts +3 -3
  104. package/transcript.ts +1 -1
  105. package/typebox-adapter.ts +2 -2
  106. package/types.ts +11 -11
  107. package/validate/contract-compat.ts +8 -8
  108. package/validate/graph.ts +2 -2
  109. package/validate/stage-rules.ts +7 -7
  110. package/validate-output.ts +3 -3
  111. package/validate-workflow.ts +7 -7
package/registration.ts CHANGED
@@ -61,12 +61,12 @@ export {
61
61
  type UnitSelector,
62
62
  type VerifySpec,
63
63
  type Workflow,
64
- } from "./api.js";
65
- export { registerBuiltIns, registerBuiltInsProvider } from "./built-ins.js";
64
+ } from "./api.ts";
65
+ export { registerBuiltIns, registerBuiltInsProvider } from "./built-ins.ts";
66
66
  // The shared dispatch predicate (and SkillStage type guard) — public so
67
67
  // extension points that key on a stage's skill identity (outcome derivers,
68
68
  // contract tooling) apply the same gate the loader/validator/harvest use.
69
- export { isDispatchingStage } from "./chain-state.js";
69
+ export { isDispatchingStage } from "./chain-state.ts";
70
70
  export {
71
71
  type LifecycleContext,
72
72
  type LifecycleListeners,
@@ -75,7 +75,7 @@ export {
75
75
  registerLifecycle,
76
76
  type StageRef,
77
77
  type UnitEvent,
78
- } from "./events.js";
78
+ } from "./events.ts";
79
79
  export {
80
80
  type Artifact,
81
81
  type ArtifactHandle,
@@ -84,20 +84,20 @@ export {
84
84
  inline,
85
85
  opaque,
86
86
  url,
87
- } from "./handle.js";
87
+ } from "./handle.ts";
88
88
  export type {
89
89
  ModelSelection,
90
90
  WorkflowHost,
91
91
  WorkflowHostContext,
92
92
  WorkflowSessionContext,
93
- } from "./host.js";
93
+ } from "./host.ts";
94
94
  // Only the contract data types are public — they're referenced by kept public
95
95
  // signatures (`JsonSchemaCapable` ← `typeboxSchema`, `JsonSchemaObject` ←
96
96
  // `ConsumesSpec`/`ProducesSpec.data`, `SchemaCompatResult` ← `canCompose`). The
97
97
  // low-level json-schema and schema-compat FUNCTIONS stay package-private (no
98
98
  // consumer needs them); internal callers import them from their source modules
99
99
  // directly.
100
- export type { JsonSchemaCapable, JsonSchemaObject } from "./json-schema.js";
100
+ export type { JsonSchemaCapable, JsonSchemaObject } from "./json-schema.ts";
101
101
  export {
102
102
  type AnyJudge,
103
103
  type FoldFn,
@@ -112,9 +112,9 @@ export {
112
112
  type PromptJudge,
113
113
  panelMembers,
114
114
  type SkillJudge,
115
- } from "./judge.js";
116
- export type { ConfigLayer, Issue, LoadedWorkflows, LoadIssue, OverlayPaths } from "./load/index.js";
117
- export { aliasSkills, loadWorkflows, projectOverlayPaths, userOverlayPaths } from "./load/index.js";
115
+ } from "./judge.ts";
116
+ export type { ConfigLayer, Issue, LoadedWorkflows, LoadIssue, OverlayPaths } from "./load/index.ts";
117
+ export { aliasSkills, loadWorkflows, projectOverlayPaths, userOverlayPaths } from "./load/index.ts";
118
118
  export {
119
119
  type AnyJudgeSpec,
120
120
  all,
@@ -141,7 +141,7 @@ export {
141
141
  type StageShape,
142
142
  verify,
143
143
  verifyShapeIssues,
144
- } from "./loop-constructors.js";
144
+ } from "./loop-constructors.ts";
145
145
  export {
146
146
  type DirectoryPathCollectorOpts,
147
147
  directoryPathCollector,
@@ -165,8 +165,8 @@ export {
165
165
  type WorkspaceDiffCollectorOpts,
166
166
  type WorkspaceDiffSnapshot,
167
167
  workspaceDiffCollector,
168
- } from "./outcomes/index.js";
169
- export type { Output, OutputMeta, RunView, Verdict } from "./output.js";
168
+ } from "./outcomes/index.ts";
169
+ export type { Output, OutputMeta, RunView, Verdict } from "./output.ts";
170
170
  // Producer-side surface — `output-spec.ts` is the ONE canonical import path
171
171
  // for collector/parser/outcome authoring types (`output.ts` keeps only the
172
172
  // envelope). `OutputSpec` is the deprecated pre-rename alias of `Outcome`.
@@ -182,8 +182,8 @@ export {
182
182
  type ParseContext,
183
183
  type ParseResult,
184
184
  type SnapshotContext,
185
- } from "./output-spec.js";
186
- export { eq, gt, gte, lt, lte, type NumericPredicate, type Predicate } from "./predicates.js";
185
+ } from "./output-spec.ts";
186
+ export { eq, gt, gte, lt, lte, type NumericPredicate, type Predicate } from "./predicates.ts";
187
187
  export type {
188
188
  ConsumesReadSpec,
189
189
  ConsumesSpec,
@@ -192,7 +192,7 @@ export type {
192
192
  SchemaCompatResult,
193
193
  SkillContract,
194
194
  SkillContractMap,
195
- } from "./skill-contract.js";
195
+ } from "./skill-contract.ts";
196
196
  export {
197
197
  canCompose,
198
198
  getBucketKindMappings,
@@ -203,7 +203,7 @@ export {
203
203
  registerOutcomeDeriver,
204
204
  registerSkillContracts,
205
205
  registerSkillContractsProvider,
206
- } from "./skill-contracts/index.js";
206
+ } from "./skill-contracts/index.ts";
207
207
  export {
208
208
  type LoopCapRow,
209
209
  listArtifacts,
@@ -223,21 +223,21 @@ export {
223
223
  summarizeRun,
224
224
  type WorkflowHeader,
225
225
  type WorkflowStage,
226
- } from "./state/index.js";
226
+ } from "./state/index.ts";
227
227
  // The persisted-session branch shape the host-injected `readSessionBranch`
228
228
  // reader returns (`WorkflowExecutionProvider.readSessionBranch` /
229
229
  // `RunContext.readSessionBranch`). Re-exported so the rpiv-pi host can name the
230
230
  // return type when it narrows `SessionManager.open(file).getBranch()`.
231
- export type { BranchEntry } from "./transcript.js";
232
- export { DEFAULT_TRIGGER, type RunTrigger } from "./triggers.js";
233
- export { typeboxSchema } from "./typebox-adapter.js";
231
+ export type { BranchEntry } from "./transcript.ts";
232
+ export { DEFAULT_TRIGGER, type RunTrigger } from "./triggers.ts";
233
+ export { typeboxSchema } from "./typebox-adapter.ts";
234
234
  // `RunState` is deliberately NOT here — it is runner-private; user contexts
235
235
  // use the deep-readonly `RunView`. Test fixtures that must construct one
236
236
  // import it from `@juicesharp/rpiv-workflow/internal`.
237
- export type { RunTermination } from "./types.js";
238
- export { type SchemaValidationFailure, validateOutputData } from "./validate-output.js";
237
+ export type { RunTermination } from "./types.ts";
238
+ export { type SchemaValidationFailure, validateOutputData } from "./validate-output.ts";
239
239
  export {
240
240
  type ValidationIssueCode,
241
241
  validateWorkflow,
242
242
  type WorkflowValidationIssue,
243
- } from "./validate-workflow.js";
243
+ } from "./validate-workflow.ts";
package/routing-dsl.ts CHANGED
@@ -6,9 +6,9 @@
6
6
  * EXECUTION lives in routing.ts — this module is authoring-surface only.
7
7
  */
8
8
 
9
- import { markSymbol, readSymbol, requireNonEmptyString, throwInvalid } from "./internal-utils.js";
10
- import type { Output, RunView } from "./output.js";
11
- import type { NumericPredicate } from "./predicates.js";
9
+ import { markSymbol, readSymbol, requireNonEmptyString, throwInvalid } from "./internal-utils.ts";
10
+ import type { Output, RunView } from "./output.ts";
11
+ import type { NumericPredicate } from "./predicates.ts";
12
12
 
13
13
  /**
14
14
  * Runtime context handed to an `EdgeFn`. The sole context shape for both
package/routing.ts CHANGED
@@ -19,8 +19,8 @@
19
19
  * any other halt site.
20
20
  */
21
21
 
22
- import { type EdgeContext, type EdgeFn, STOP, type Workflow } from "./api.js";
23
- import { formatError } from "./internal-utils.js";
22
+ import { type EdgeContext, type EdgeFn, STOP, type Workflow } from "./api.ts";
23
+ import { formatError } from "./internal-utils.ts";
24
24
 
25
25
  /**
26
26
  * Three-way return from `nextStage`. Matches the convention established by
package/runner/by-name.ts CHANGED
@@ -19,10 +19,10 @@
19
19
  * loader's "never throws" guarantee. Callers branch on `result.success`.
20
20
  */
21
21
 
22
- import type { WorkflowHostContext } from "../host.js";
23
- import { findWorkflow, loadWorkflows } from "../load/index.js";
24
- import type { RunWorkflowOptions, RunWorkflowResult } from "../types.js";
25
- import { runWorkflow } from "./runner.js";
22
+ import type { WorkflowHostContext } from "../host.ts";
23
+ import { findWorkflow, loadWorkflows } from "../load/index.ts";
24
+ import type { RunWorkflowOptions, RunWorkflowResult } from "../types.ts";
25
+ import { runWorkflow } from "./runner.ts";
26
26
 
27
27
  /**
28
28
  * Options for `runWorkflowByName` — the full `RunWorkflowOptions` surface
@@ -32,12 +32,12 @@
32
32
  * no-JSONL refusals once while leaving in-run failures to the stage machinery).
33
33
  */
34
34
 
35
- import type { WorkflowHostContext } from "../host.js";
36
- import { findWorkflow, loadWorkflows } from "../load/index.js";
37
- import { MSG_LOAD_ABORTED, MSG_RESUME_WORKFLOW_GONE, MSG_RUN_NOT_FOUND } from "../messages.js";
38
- import { resolveRun } from "../state/index.js";
39
- import type { RunWorkflowResult } from "../types.js";
40
- import { type ResumeWorkflowOptions, resumeWorkflow } from "./runner.js";
35
+ import type { WorkflowHostContext } from "../host.ts";
36
+ import { findWorkflow, loadWorkflows } from "../load/index.ts";
37
+ import { MSG_LOAD_ABORTED, MSG_RESUME_WORKFLOW_GONE, MSG_RUN_NOT_FOUND } from "../messages.ts";
38
+ import { resolveRun } from "../state/index.ts";
39
+ import type { RunWorkflowResult } from "../types.ts";
40
+ import { type ResumeWorkflowOptions, resumeWorkflow } from "./runner.ts";
41
41
 
42
42
  /**
43
43
  * Options for `resumeWorkflowByRunId` — the full `ResumeWorkflowOptions` surface
@@ -11,22 +11,22 @@
11
11
  * spelled as a module cycle.
12
12
  */
13
13
 
14
- import { type EdgeTarget, PROGRESS_VALUES, type ProgressValue, type StageDef, takeRouteNote } from "../api.js";
15
- import { auditCtxFor, failedArgs, recordFatalFailure } from "../audit.js";
16
- import { resolveSkill } from "../chain-state.js";
17
- import { lifecycleCtxFor, skillStageRef } from "../events.js";
18
- import { nowIso } from "../internal-utils.js";
14
+ import { type EdgeTarget, PROGRESS_VALUES, type ProgressValue, type StageDef, takeRouteNote } from "../api.ts";
15
+ import { auditCtxFor, failedArgs, recordFatalFailure } from "../audit.ts";
16
+ import { resolveSkill } from "../chain-state.ts";
17
+ import { lifecycleCtxFor, skillStageRef } from "../events.ts";
18
+ import { nowIso } from "../internal-utils.ts";
19
19
  import {
20
20
  FAIL_BACKWARD_JUMP_EXHAUSTED,
21
21
  FAIL_GATE_STOP,
22
22
  type FailureText,
23
23
  MSG_CHAIN_ADVANCE_FAILED,
24
24
  MSG_ROUTING_AUDIT_DROPPED,
25
- } from "../messages.js";
26
- import { edgeIsDecision, nextStage } from "../routing.js";
27
- import { appendRoutingDecision } from "../state/index.js";
28
- import type { RunContext, RunState, WorkflowHostContext } from "../types.js";
29
- import { type ChainOutcome, finalizeWorkflow, haltChain } from "./failure.js";
25
+ } from "../messages.ts";
26
+ import { edgeIsDecision, nextStage } from "../routing.ts";
27
+ import { appendRoutingDecision } from "../state/index.ts";
28
+ import type { RunContext, RunState, WorkflowHostContext } from "../types.ts";
29
+ import { type ChainOutcome, finalizeWorkflow, haltChain } from "./failure.ts";
30
30
 
31
31
  /**
32
32
  * The walk continuation injected by the composition site
package/runner/errors.ts CHANGED
@@ -7,4 +7,4 @@
7
7
  * (`dispatchStageOrRecordFailure`, run-stage.ts) catches it as before.
8
8
  */
9
9
 
10
- export { haltPreflight, invariantPreflight, StagePreflightError } from "../stage-errors.js";
10
+ export { haltPreflight, invariantPreflight, StagePreflightError } from "../stage-errors.ts";
package/runner/failure.ts CHANGED
@@ -12,11 +12,11 @@ import {
12
12
  notifyPartialArtifacts,
13
13
  recordFatalFailure,
14
14
  terminate,
15
- } from "../audit.js";
16
- import { formatError, isAbortError } from "../internal-utils.js";
17
- import { FAIL_WORKFLOW_ABORTED, MSG_STAGE_THREW, MSG_WORKFLOW_COMPLETE } from "../messages.js";
18
- import type { RunContext, UnitRef, WorkflowHostContext } from "../types.js";
19
- import { StagePreflightError } from "./errors.js";
15
+ } from "../audit.ts";
16
+ import { formatError, isAbortError } from "../internal-utils.ts";
17
+ import { FAIL_WORKFLOW_ABORTED, MSG_STAGE_THREW, MSG_WORKFLOW_COMPLETE } from "../messages.ts";
18
+ import type { RunContext, UnitRef, WorkflowHostContext } from "../types.ts";
19
+ import { StagePreflightError } from "./errors.ts";
20
20
 
21
21
  /**
22
22
  * Explicit result of one chain-walk step, threaded up through
package/runner/index.ts CHANGED
@@ -4,15 +4,15 @@
4
4
  * the symbols the package itself needs to publish.
5
5
  */
6
6
 
7
- export type { RunWorkflowOptions, RunWorkflowResult } from "../types.js";
8
- export { type RunWorkflowByNameOptions, runWorkflowByName } from "./by-name.js";
9
- export { type ResumeWorkflowByRunIdOptions, resumeWorkflowByRunId } from "./by-run-id.js";
10
- export { StagePreflightError } from "./errors.js";
7
+ export type { RunWorkflowOptions, RunWorkflowResult } from "../types.ts";
8
+ export { type RunWorkflowByNameOptions, runWorkflowByName } from "./by-name.ts";
9
+ export { type ResumeWorkflowByRunIdOptions, resumeWorkflowByRunId } from "./by-run-id.ts";
10
+ export { StagePreflightError } from "./errors.ts";
11
11
  export {
12
12
  MAX_BACKWARD_JUMPS,
13
13
  MAX_ITERATIONS,
14
14
  MAX_LAPS,
15
15
  type RunBudgetOptions,
16
16
  validateRunBudgets,
17
- } from "./run-context.js";
18
- export { type ResumeWorkflowOptions, resumeWorkflow, runWorkflow } from "./runner.js";
17
+ } from "./run-context.ts";
18
+ export { type ResumeWorkflowOptions, resumeWorkflow, runWorkflow } from "./runner.ts";
@@ -16,10 +16,10 @@
16
16
  * halting only on timeouts.
17
17
  */
18
18
 
19
- import { formatError, withTimeout } from "../internal-utils.js";
20
- import { isJsonSchemaObject, jsonSchemaToStandard } from "../json-schema.js";
21
- import { ERR_SCHEMA_TIMEOUT, FAIL_INPUT_VALIDATION } from "../messages.js";
22
- import type { RunContext } from "../types.js";
19
+ import { formatError, withTimeout } from "../internal-utils.ts";
20
+ import { isJsonSchemaObject, jsonSchemaToStandard } from "../json-schema.ts";
21
+ import { ERR_SCHEMA_TIMEOUT, FAIL_INPUT_VALIDATION } from "../messages.ts";
22
+ import type { RunContext } from "../types.ts";
23
23
  import {
24
24
  DEFAULT_VALIDATION_RETRY_TIMEOUT_MS,
25
25
  describeFailure,
@@ -28,10 +28,10 @@ import {
28
28
  SchemaTimeoutError,
29
29
  type ValidationResult,
30
30
  validateOutputData,
31
- } from "../validate-output.js";
32
- import { clampRange } from "../validation-bounds.js";
33
- import { haltPreflight } from "./errors.js";
34
- import type { ResolvedStage } from "./resolve-stage.js";
31
+ } from "../validate-output.ts";
32
+ import { clampRange } from "../validation-bounds.ts";
33
+ import { haltPreflight } from "./errors.ts";
34
+ import type { ResolvedStage } from "./resolve-stage.ts";
35
35
 
36
36
  // ---------------------------------------------------------------------------
37
37
  // Shared helper
@@ -9,18 +9,18 @@
9
9
  * of re-probing `def.prompt` — the slot-priority rule lives in one place.
10
10
  */
11
11
 
12
- import { currentPrimaryArtifact } from "../chain-state.js";
13
- import { type AnyJudge, panelMembers } from "../judge.js";
12
+ import { currentPrimaryArtifact } from "../chain-state.ts";
13
+ import { type AnyJudge, panelMembers } from "../judge.ts";
14
14
  import {
15
15
  FAIL_MISSING_ARTIFACT,
16
16
  FAIL_MISSING_NAMED_READ,
17
17
  FAIL_SKILL_NOT_REGISTERED,
18
18
  MSG_STAGE_THREW,
19
- } from "../messages.js";
20
- import { readName } from "../stage-def.js";
21
- import type { RunContext } from "../types.js";
22
- import { haltPreflight, invariantPreflight } from "./errors.js";
23
- import type { ResolvedStage } from "./resolve-stage.js";
19
+ } from "../messages.ts";
20
+ import { readName } from "../stage-def.ts";
21
+ import type { RunContext } from "../types.ts";
22
+ import { haltPreflight, invariantPreflight } from "./errors.ts";
23
+ import type { ResolvedStage } from "./resolve-stage.ts";
24
24
 
25
25
  /**
26
26
  * The skill-path preflight sequence, in its load-bearing order:
@@ -6,10 +6,10 @@
6
6
  * comment; the ordering now lives in exactly one place (`stageModeOf`).
7
7
  */
8
8
 
9
- import type { LoopDef, StageDef } from "../api.js";
10
- import { resolveSkill } from "../chain-state.js";
11
- import { effectiveLoopOf } from "../loop-constructors.js";
12
- import type { RunContext } from "../types.js";
9
+ import type { LoopDef, StageDef } from "../api.ts";
10
+ import { resolveSkill } from "../chain-state.ts";
11
+ import { effectiveLoopOf } from "../loop-constructors.ts";
12
+ import type { RunContext } from "../types.ts";
13
13
 
14
14
  /**
15
15
  * How a stage's BODY is dispatched:
@@ -5,20 +5,20 @@
5
5
  * `resume-loop.ts` (which owns the loop-trailer arm's dispatch).
6
6
  */
7
7
 
8
- import type { Workflow } from "../api.js";
8
+ import type { Workflow } from "../api.ts";
9
9
  import {
10
10
  ERR_RESUME_MALFORMED_ROW,
11
11
  ERR_RESUME_NO_ROWS,
12
12
  ERR_RESUME_STAGE_GONE,
13
13
  ERR_RESUME_VERSION_MISMATCH,
14
- } from "../messages.js";
15
- import { STOP } from "../routing-dsl.js";
16
- import { STATE_SCHEMA_VERSION } from "../state/index.js";
17
- import type { RunContext, WorkflowHostContext } from "../types.js";
18
- import { recordEntryThrow } from "./failure.js";
19
- import type { ReconstructResult } from "./resume.js";
20
- import { recordLoopDriftFailure, resumeLoopStage } from "./resume-loop.js";
21
- import { advance, buildLoopDeps, dispatchStageOrRecordFailure, resumeStageWithSession } from "./run-stage.js";
14
+ } from "../messages.ts";
15
+ import { STOP } from "../routing-dsl.ts";
16
+ import { STATE_SCHEMA_VERSION } from "../state/index.ts";
17
+ import type { RunContext, WorkflowHostContext } from "../types.ts";
18
+ import { recordEntryThrow } from "./failure.ts";
19
+ import type { ReconstructResult } from "./resume.ts";
20
+ import { recordLoopDriftFailure, resumeLoopStage } from "./resume-loop.ts";
21
+ import { advance, buildLoopDeps, dispatchStageOrRecordFailure, resumeStageWithSession } from "./run-stage.ts";
22
22
 
23
23
  /**
24
24
  * Pick the chain re-entry thunk from the trail trailer. Dispatch keys on the
@@ -17,15 +17,15 @@
17
17
  * probe pull is the documented harmless deterministic double-pull.
18
18
  */
19
19
 
20
- import { auditCtxFor, failedArgs, recordFatalFailure } from "../audit.js";
21
- import { resolveSkill } from "../chain-state.js";
22
- import { announceLoopStart, pendingFanoutIndices, runFanoutResume, runLoop } from "../loop.js";
23
- import { effectiveLoopOf, freezesEntryArgsOf } from "../loop-constructors.js";
24
- import { buildLoopEntry, type LoopDeps, sequentialStrategyOf } from "../loop-kinds.js";
25
- import { ensureUnitDeps } from "../loop-waves.js";
26
- import { FAIL_MISSING_ARTIFACT, type FailureText, MSG_RESUME_LOOP_MISMATCH } from "../messages.js";
27
- import type { RunContext, WorkflowHostContext } from "../types.js";
28
- import type { LoopResumePoint } from "./resume.js";
20
+ import { auditCtxFor, failedArgs, recordFatalFailure } from "../audit.ts";
21
+ import { resolveSkill } from "../chain-state.ts";
22
+ import { announceLoopStart, pendingFanoutIndices, runFanoutResume, runLoop } from "../loop.ts";
23
+ import { effectiveLoopOf, freezesEntryArgsOf } from "../loop-constructors.ts";
24
+ import { buildLoopEntry, type LoopDeps, sequentialStrategyOf } from "../loop-kinds.ts";
25
+ import { ensureUnitDeps } from "../loop-waves.ts";
26
+ import { FAIL_MISSING_ARTIFACT, type FailureText, MSG_RESUME_LOOP_MISMATCH } from "../messages.ts";
27
+ import type { RunContext, WorkflowHostContext } from "../types.ts";
28
+ import type { LoopResumePoint } from "./resume.ts";
29
29
 
30
30
  export async function resumeLoopStage(
31
31
  ctx: WorkflowHostContext,
package/runner/resume.ts CHANGED
@@ -24,15 +24,15 @@
24
24
  * re-entry hands it straight back to `runLoop`.
25
25
  */
26
26
 
27
- import type { LoopDef, StageDef, Unit, Workflow } from "../api.js";
28
- import { applyStageSuccess, rollLastSession } from "../audit-rows.js";
29
- import { stageEntryArgs } from "../chain-state.js";
30
- import { pushFailureMemo } from "../failure-memos.js";
31
- import type { Artifact } from "../handle.js";
32
- import { formatError } from "../internal-utils.js";
33
- import { panelMembers } from "../judge.js";
34
- import { projectResult, publishPanelVerdict } from "../loop.js";
35
- import { effectiveLoopOf, freezesEntryArgsOf } from "../loop-constructors.js";
27
+ import type { LoopDef, StageDef, Unit, Workflow } from "../api.ts";
28
+ import { applyStageSuccess, rollLastSession } from "../audit-rows.ts";
29
+ import { stageEntryArgs } from "../chain-state.ts";
30
+ import { pushFailureMemo } from "../failure-memos.ts";
31
+ import type { Artifact } from "../handle.ts";
32
+ import { formatError } from "../internal-utils.ts";
33
+ import { panelMembers } from "../judge.ts";
34
+ import { projectResult, publishPanelVerdict } from "../loop.ts";
35
+ import { effectiveLoopOf, freezesEntryArgsOf } from "../loop-constructors.ts";
36
36
  import {
37
37
  advanceCursor,
38
38
  foldFanoutCompletion,
@@ -41,18 +41,18 @@ import {
41
41
  type LoopCursor,
42
42
  sequentialStrategyOf,
43
43
  unitTagOf,
44
- } from "../loop-kinds.js";
45
- import { ERR_RESUME_LOOP_MISMATCH } from "../messages.js";
46
- import { failedOutput, type Output, outputMeta } from "../output.js";
44
+ } from "../loop-kinds.ts";
45
+ import { ERR_RESUME_LOOP_MISMATCH } from "../messages.ts";
46
+ import { failedOutput, type Output, outputMeta } from "../output.ts";
47
47
  import {
48
48
  type RoutingDecision,
49
49
  readAllStagesForResume,
50
50
  STATE_SCHEMA_VERSION,
51
51
  type WorkflowHeader,
52
52
  type WorkflowStage,
53
- } from "../state/index.js";
54
- import type { RunState } from "../types.js";
55
- import { freshRunState } from "./run-context.js";
53
+ } from "../state/index.ts";
54
+ import type { RunState } from "../types.ts";
55
+ import { freshRunState } from "./run-context.ts";
56
56
 
57
57
  /** Trailing open generation — everything `resume-loop.ts` needs to re-enter `runLoop`. */
58
58
  export interface LoopResumePoint {
@@ -6,14 +6,14 @@
6
6
  * construction site without importing each other.
7
7
  */
8
8
 
9
- import type { Workflow } from "../api.js";
10
- import { LifecycleDispatcher, type LifecycleListeners } from "../events.js";
11
- import type { ModelSelection, WorkflowHost } from "../host.js";
12
- import { MSG_BUDGET_INVALID } from "../messages.js";
13
- import { getSkillContracts } from "../skill-contracts/index.js";
14
- import type { BranchEntry } from "../transcript.js";
15
- import type { RunTrigger } from "../triggers.js";
16
- import type { RunContext, RunState } from "../types.js";
9
+ import type { Workflow } from "../api.ts";
10
+ import { LifecycleDispatcher, type LifecycleListeners } from "../events.ts";
11
+ import type { ModelSelection, WorkflowHost } from "../host.ts";
12
+ import { MSG_BUDGET_INVALID } from "../messages.ts";
13
+ import { getSkillContracts } from "../skill-contracts/index.ts";
14
+ import type { BranchEntry } from "../transcript.ts";
15
+ import type { RunTrigger } from "../triggers.ts";
16
+ import type { RunContext, RunState } from "../types.ts";
17
17
 
18
18
  // ---------------------------------------------------------------------------
19
19
  // Policy constants
@@ -20,16 +20,16 @@
20
20
  * JSONL failure row via failure.ts.
21
21
  */
22
22
 
23
- import type { StageDef, Unit } from "../api.js";
24
- import { auditCtxFor, failedArgs, notifyPartialArtifacts, recordFatalFailure, runIdentityOf } from "../audit.js";
25
- import { currentPrimaryArtifact, resolveStagePrompt, stageEntryArgs } from "../chain-state.js";
26
- import { lifecycleCtxFor, skillStageRef } from "../events.js";
27
- import { failureMemoSuffix } from "../failure-memos.js";
28
- import { formatError } from "../internal-utils.js";
29
- import { announceLoopStart, runLoop } from "../loop.js";
30
- import { freezesEntryArgsOf } from "../loop-constructors.js";
31
- import { buildLoopEntry, freshCursor, type LoopDeps, type LoopEntry } from "../loop-kinds.js";
32
- import { ensureUnitDeps } from "../loop-waves.js";
23
+ import type { StageDef, Unit } from "../api.ts";
24
+ import { auditCtxFor, failedArgs, notifyPartialArtifacts, recordFatalFailure, runIdentityOf } from "../audit.ts";
25
+ import { currentPrimaryArtifact, resolveStagePrompt, stageEntryArgs } from "../chain-state.ts";
26
+ import { lifecycleCtxFor, skillStageRef } from "../events.ts";
27
+ import { failureMemoSuffix } from "../failure-memos.ts";
28
+ import { formatError } from "../internal-utils.ts";
29
+ import { announceLoopStart, runLoop } from "../loop.ts";
30
+ import { freezesEntryArgsOf } from "../loop-constructors.ts";
31
+ import { buildLoopEntry, freshCursor, type LoopDeps, type LoopEntry } from "../loop-kinds.ts";
32
+ import { ensureUnitDeps } from "../loop-waves.ts";
33
33
  import {
34
34
  FAIL_FANOUT_ALL_FAILED,
35
35
  FAIL_LOOP_CAP_HALT,
@@ -38,31 +38,31 @@ import {
38
38
  MSG_CONTINUE_FALLBACK,
39
39
  MSG_RESUME_SESSION_FALLBACK,
40
40
  MSG_SNAPSHOT_FAILED,
41
- } from "../messages.js";
41
+ } from "../messages.ts";
42
42
  import {
43
43
  continueStageSession,
44
44
  executeStageSession,
45
45
  locateSessionFile,
46
46
  reattachStageSession,
47
- } from "../sessions/index.js";
48
- import { forkChildSession, reattachChildSession } from "../sessions/spawn.js";
49
- import type { SkillContractMap } from "../skill-contract.js";
50
- import { effectiveOutputSchemaOf } from "../stage-identity.js";
51
- import type { WorkflowStage } from "../state/index.js";
52
- import type { RunContext, RunState, StageSessionContext, WorkflowHostContext } from "../types.js";
53
- import { resolveDigest } from "../worktree-digest.js";
54
- import { advanceChain, type ChainDeps } from "./chain-advance.js";
55
- import { type ChainOutcome, haltChain, recordAbortedAtSeam, recordEntryThrow, withStageEntryGuard } from "./failure.js";
56
- import { ensureContractInputValid, ensureInputValid } from "./input-validation.js";
57
- import { ensureLoopNotContinue, runLoopPreflights, runSingleStagePreflights } from "./preflight.js";
58
- import { type ResolvedStage, resolveStage } from "./resolve-stage.js";
59
- import { runScript } from "./script-stage.js";
47
+ } from "../sessions/index.ts";
48
+ import { forkChildSession, reattachChildSession } from "../sessions/spawn.ts";
49
+ import type { SkillContractMap } from "../skill-contract.ts";
50
+ import { effectiveOutputSchemaOf } from "../stage-identity.ts";
51
+ import type { WorkflowStage } from "../state/index.ts";
52
+ import type { RunContext, RunState, StageSessionContext, WorkflowHostContext } from "../types.ts";
53
+ import { resolveDigest } from "../worktree-digest.ts";
54
+ import { advanceChain, type ChainDeps } from "./chain-advance.ts";
55
+ import { type ChainOutcome, haltChain, recordAbortedAtSeam, recordEntryThrow, withStageEntryGuard } from "./failure.ts";
56
+ import { ensureContractInputValid, ensureInputValid } from "./input-validation.ts";
57
+ import { ensureLoopNotContinue, runLoopPreflights, runSingleStagePreflights } from "./preflight.ts";
58
+ import { type ResolvedStage, resolveStage } from "./resolve-stage.ts";
59
+ import { runScript } from "./script-stage.ts";
60
60
 
61
61
  // Re-exported for the package barrel + existing consumers; the class itself
62
62
  // lives in the leaf errors.ts so preflight/input-validation can throw it
63
63
  // without importing this module back.
64
- export { StagePreflightError } from "./errors.js";
65
- export type { ResolvedStage } from "./resolve-stage.js";
64
+ export { StagePreflightError } from "./errors.ts";
65
+ export type { ResolvedStage } from "./resolve-stage.ts";
66
66
 
67
67
  // ---------------------------------------------------------------------------
68
68
  // Walk composition — the ONE place the mutual recursion is wired
package/runner/runner.ts CHANGED
@@ -18,20 +18,20 @@
18
18
  * `## Phase N:` subdivision inside an implement plan artifact.
19
19
  */
20
20
 
21
- import type { Workflow } from "../api.js";
22
- import { currentPrimaryArtifact } from "../chain-state.js";
23
- import { type LifecycleListeners, lifecycleCtxFor } from "../events.js";
24
- import { getWorkflowExecutionProvider } from "../execution-host.js";
25
- import { handleToString } from "../handle.js";
26
- import type { ModelSelection, WorkflowHost, WorkflowHostContext } from "../host.js";
27
- import { nowIso } from "../internal-utils.js";
21
+ import type { Workflow } from "../api.ts";
22
+ import { currentPrimaryArtifact } from "../chain-state.ts";
23
+ import { type LifecycleListeners, lifecycleCtxFor } from "../events.ts";
24
+ import { getWorkflowExecutionProvider } from "../execution-host.ts";
25
+ import { handleToString } from "../handle.ts";
26
+ import type { ModelSelection, WorkflowHost, WorkflowHostContext } from "../host.ts";
27
+ import { nowIso } from "../internal-utils.ts";
28
28
  import {
29
29
  MSG_HEADER_WRITE_FAILED,
30
30
  MSG_NAME_COLLISION,
31
31
  MSG_NAME_INDEX_WRITE_FAILED,
32
32
  MSG_NAME_INVALID,
33
- } from "../messages.js";
34
- import { pruneOrphanedChildSessions } from "../sessions/index.js";
33
+ } from "../messages.ts";
34
+ import { pruneOrphanedChildSessions } from "../sessions/index.ts";
35
35
  import {
36
36
  appendHeader,
37
37
  type ClaimResult,
@@ -41,15 +41,15 @@ import {
41
41
  releaseName,
42
42
  STATE_SCHEMA_VERSION,
43
43
  type WorkflowHeader,
44
- } from "../state/index.js";
45
- import { childSessionsDir } from "../state/paths.js";
46
- import type { BranchEntry } from "../transcript.js";
47
- import { DEFAULT_TRIGGER } from "../triggers.js";
48
- import type { RunContext, RunWorkflowOptions, RunWorkflowResult } from "../types.js";
49
- import { reconstructState } from "./resume.js";
50
- import { resumeRefusalError, selectResumeEntry } from "./resume-entry.js";
51
- import { buildRunContext, freshRunState, validateRunBudgets } from "./run-context.js";
52
- import { dispatchStageOrRecordFailure } from "./run-stage.js";
44
+ } from "../state/index.ts";
45
+ import { childSessionsDir } from "../state/paths.ts";
46
+ import type { BranchEntry } from "../transcript.ts";
47
+ import { DEFAULT_TRIGGER } from "../triggers.ts";
48
+ import type { RunContext, RunWorkflowOptions, RunWorkflowResult } from "../types.ts";
49
+ import { reconstructState } from "./resume.ts";
50
+ import { resumeRefusalError, selectResumeEntry } from "./resume-entry.ts";
51
+ import { buildRunContext, freshRunState, validateRunBudgets } from "./run-context.ts";
52
+ import { dispatchStageOrRecordFailure } from "./run-stage.ts";
53
53
 
54
54
  // ---------------------------------------------------------------------------
55
55
  // Shared tail — executeRun