@juicesharp/rpiv-workflow 2.2.0 → 2.3.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.
- package/audit-ctx.ts +7 -7
- package/audit.ts +29 -29
- package/chain-state.ts +14 -3
- package/death-scene.ts +9 -9
- package/docs/workflow-authoring.md +2 -2
- package/events.ts +1 -1
- package/failure-memos.ts +4 -4
- package/handle.ts +16 -1
- package/host.ts +1 -1
- package/loop-def.ts +1 -1
- package/loop-kinds.ts +12 -12
- package/loop-parallel.ts +15 -15
- package/loop-waves.ts +3 -3
- package/loop.ts +32 -30
- package/messages.ts +30 -17
- package/outcomes/collectors/workspace-diff.ts +3 -3
- package/outcomes/git-commit.ts +11 -4
- package/output-spec.ts +7 -7
- package/package.json +2 -2
- package/preview.ts +8 -1
- package/registration.ts +3 -3
- package/routing.ts +1 -1
- package/runner/chain-advance.ts +49 -25
- package/runner/errors.ts +1 -1
- package/runner/failure.ts +22 -23
- package/runner/preflight.ts +3 -6
- package/runner/resolve-stage.ts +3 -3
- package/runner/resume-entry.ts +5 -5
- package/runner/resume-loop.ts +5 -5
- package/runner/resume.ts +1 -1
- package/runner/run-stage.ts +69 -64
- package/runner/runner.ts +4 -4
- package/runner/script-stage.ts +17 -17
- package/sessions/bash-strikes.ts +9 -9
- package/sessions/extraction.ts +19 -12
- package/sessions/halt-routing.ts +14 -14
- package/sessions/index.ts +1 -1
- package/sessions/reattach.ts +10 -10
- package/sessions/sessions.ts +29 -23
- package/sessions/spawn.ts +5 -5
- package/sessions/success-persist.ts +3 -3
- package/stage-def.ts +2 -2
- package/stage-errors.ts +1 -1
- package/state/index.ts +1 -1
- package/state/names.ts +1 -1
- package/state/reads.ts +1 -1
- package/state/state.ts +4 -4
- package/state/writes.ts +2 -2
- package/types.ts +16 -16
package/types.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Per-stage / per-phase sessions extend a shared `SessionContext` base
|
|
18
18
|
* (cwd, runId, state, prompt, skill). The audit layer pins its dependency
|
|
19
|
-
* on this base structurally via `
|
|
19
|
+
* on this base structurally via `AuditContext = Pick<SessionContext, ...>`.
|
|
20
20
|
*
|
|
21
21
|
* Lives apart from runner.ts / sessions.ts so both can reference the same
|
|
22
22
|
* shapes without a runtime import cycle (type-only refs back via this
|
|
@@ -239,13 +239,13 @@ export interface RunWorkflowOptions {
|
|
|
239
239
|
signal?: AbortSignal;
|
|
240
240
|
/**
|
|
241
241
|
* Per-stage model-override resolver, injected by the embedder. Threaded onto
|
|
242
|
-
* `RunContext.resolveModel` → every `
|
|
242
|
+
* `RunContext.resolveModel` → every `StageSessionContext.model`; the host applies it
|
|
243
243
|
* at child-session creation. Undefined ⇒ host default for every stage.
|
|
244
244
|
*/
|
|
245
245
|
resolveModel?: (id: { stage: string; skill: string }) => ModelSelection | undefined;
|
|
246
246
|
/**
|
|
247
247
|
* Worktree-digest override for the validation-retry gate — threaded
|
|
248
|
-
* onto `RunContext.worktreeDigest` → every `
|
|
248
|
+
* onto `RunContext.worktreeDigest` → every `StageSessionContext.worktreeDigest`.
|
|
249
249
|
* Undefined ⇒ the built-in `computeWorktreeDigest` (git + artifacts).
|
|
250
250
|
*/
|
|
251
251
|
worktreeDigest?: (cwd: string) => string | undefined;
|
|
@@ -361,7 +361,7 @@ export interface RunContext {
|
|
|
361
361
|
* lacks a stage `inputSchema` (a harvested `consumes.data` is the
|
|
362
362
|
* stage's own `inputSchema` re-derived, already covered by
|
|
363
363
|
* `ensureInputValid`);
|
|
364
|
-
* - `effectiveOutputSchema` (threaded onto `
|
|
364
|
+
* - `effectiveOutputSchema` (threaded onto `StageSessionContext`) sources a
|
|
365
365
|
* declared `produces.data` as the output schema when the stage carries
|
|
366
366
|
* no `outputSchema` of its own.
|
|
367
367
|
* Fail-soft: both degrade (no validation, never throw) when absent.
|
|
@@ -370,7 +370,7 @@ export interface RunContext {
|
|
|
370
370
|
/**
|
|
371
371
|
* Resolve a per-stage model override, injected by the embedder (rpiv-pi maps
|
|
372
372
|
* each `{ stage, skill }` to its model/effort override). The runner threads
|
|
373
|
-
* the result onto every `
|
|
373
|
+
* the result onto every `StageSessionContext.model`; the host applies it at child
|
|
374
374
|
* creation (NOT via global mutation). Undefined ⇒ host default.
|
|
375
375
|
*/
|
|
376
376
|
resolveModel?: (id: { stage: string; skill: string }) => ModelSelection | undefined;
|
|
@@ -381,13 +381,13 @@ export interface RunContext {
|
|
|
381
381
|
* writer at failure time (death-scene.ts) — the ONLY reader. Undefined for
|
|
382
382
|
* programmatic embedders / no provider, in which case the writer degrades
|
|
383
383
|
* silently (no artifact, no warning). Threaded provider → executor →
|
|
384
|
-
* `RunContext` → `SessionContext` → `
|
|
384
|
+
* `RunContext` → `SessionContext` → `AuditContext` → `auditFor`.
|
|
385
385
|
*/
|
|
386
386
|
readSessionBranch?: (file: string) => BranchEntry[] | undefined;
|
|
387
387
|
/**
|
|
388
388
|
* Worktree-digest resolver injected by the embedder (tests / programmatic
|
|
389
389
|
* embedders that want to stub the filesystem). Threaded onto every
|
|
390
|
-
* `
|
|
390
|
+
* `StageSessionContext.worktreeDigest` and read by the validation-retry gate
|
|
391
391
|
* (`packages/rpiv-workflow/sessions/extraction.ts` mechanism-1 +
|
|
392
392
|
* `packages/rpiv-workflow/runner/run-stage.ts` mechanism-2) via
|
|
393
393
|
* `resolveDigest` (`worktree-digest.ts`). Undefined ⇒ the built-in
|
|
@@ -409,7 +409,7 @@ export interface RunContext {
|
|
|
409
409
|
lifecycle: LifecycleDispatcher;
|
|
410
410
|
/**
|
|
411
411
|
* Optional cooperative-cancellation signal from `RunWorkflowOptions.signal`.
|
|
412
|
-
* Checked at the between-stage seam (top of `
|
|
412
|
+
* Checked at the between-stage seam (top of `dispatchStageOrRecordFailure`, before
|
|
413
413
|
* the start stage and before every routed next stage). An aborted signal
|
|
414
414
|
* records an `"aborted"` terminal row and unwinds — it does NOT interrupt a
|
|
415
415
|
* stage already streaming (Pi owns the live session).
|
|
@@ -418,9 +418,9 @@ export interface RunContext {
|
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
/**
|
|
421
|
-
* Per-stage / per-unit common base. Extended by `
|
|
422
|
-
* thread their identity through `
|
|
423
|
-
* `
|
|
421
|
+
* Per-stage / per-unit common base. Extended by `StageSessionContext` (loop units
|
|
422
|
+
* thread their identity through `StageSessionContext.unit`); consumed in pick form by
|
|
423
|
+
* `AuditContext` (audit.ts) so the audit layer pins its dependency on this shape
|
|
424
424
|
* structurally instead of duplicating the field list.
|
|
425
425
|
*
|
|
426
426
|
* `stageName` is the workflow stage's record key — the value that lands
|
|
@@ -464,10 +464,10 @@ export interface SessionContext {
|
|
|
464
464
|
/**
|
|
465
465
|
* Host-injected persisted-session branch reader, threaded from
|
|
466
466
|
* `RunContext.readSessionBranch`. Read by the death-scene artifact writer
|
|
467
|
-
* (`writeDeathSceneArtifact`) via `
|
|
467
|
+
* (`writeDeathSceneArtifact`) via `AuditContext`; absent for programmatic
|
|
468
468
|
* embedders (the writer degrades silently). Travels FURTHER than
|
|
469
|
-
* `resolveModel` — into `SessionContext` → `
|
|
470
|
-
* because the writer reads it from `
|
|
469
|
+
* `resolveModel` — into `SessionContext` → `AuditContext` → `auditFor` —
|
|
470
|
+
* because the writer reads it from `AuditContext` at failure time.
|
|
471
471
|
*/
|
|
472
472
|
readSessionBranch?: (file: string) => BranchEntry[] | undefined;
|
|
473
473
|
}
|
|
@@ -490,7 +490,7 @@ export interface UnitRef {
|
|
|
490
490
|
label: string;
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
-
export interface
|
|
493
|
+
export interface StageSessionContext extends SessionContext {
|
|
494
494
|
stage: StageDef;
|
|
495
495
|
/**
|
|
496
496
|
* Registered skill-contract registry, threaded from
|
|
@@ -549,7 +549,7 @@ export interface StageSession extends SessionContext {
|
|
|
549
549
|
* `undefined` ⇒ the `BASH_TIMEOUT_STRIKES` module default. Pin to `0` in a
|
|
550
550
|
* watchdog-contract test to force immediate exhaustion; pin to `N` to drive
|
|
551
551
|
* a multi-strike recovery without mutating env. Now the SOLE strike surface
|
|
552
|
-
* on `
|
|
552
|
+
* on `StageSessionContext`: the mutable accounting (used counter + reasons
|
|
553
553
|
* accumulator) lives in the private `StrikeBudget` value object held in
|
|
554
554
|
* `sessions/bash-strikes.ts`, keyed off this session (read once at first
|
|
555
555
|
* consume to resolve the budget's ceiling). Immutable per-activation.
|