@zhixuan92/multi-model-agent-core 5.0.3 → 5.2.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/dist/bounded-execution/activity-tracker-types.d.ts +30 -15
- package/dist/bounded-execution/activity-tracker-types.d.ts.map +1 -1
- package/dist/bounded-execution/activity-tracker-types.js.map +1 -1
- package/dist/bounded-execution/activity-tracker.d.ts +2 -2
- package/dist/bounded-execution/activity-tracker.d.ts.map +1 -1
- package/dist/bounded-execution/activity-tracker.js +4 -5
- package/dist/bounded-execution/activity-tracker.js.map +1 -1
- package/dist/config/schema.d.ts +41 -2
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +1 -2
- package/dist/config/schema.js.map +1 -1
- package/dist/events/plain-log-entry.d.ts +1 -1
- package/dist/events/plain-log-entry.d.ts.map +1 -1
- package/dist/events/plain-log-entry.js +5 -1
- package/dist/events/plain-log-entry.js.map +1 -1
- package/dist/events/task-envelope.d.ts +5 -5
- package/dist/events/task-envelope.d.ts.map +1 -1
- package/dist/events/task-envelope.js +3 -6
- package/dist/events/task-envelope.js.map +1 -1
- package/dist/events/telemetry-uploader.d.ts +1 -1
- package/dist/events/telemetry-uploader.d.ts.map +1 -1
- package/dist/events/to-wire-record.d.ts +1 -1
- package/dist/events/to-wire-record.d.ts.map +1 -1
- package/dist/events/to-wire-record.js +1 -1
- package/dist/events/to-wire-record.js.map +1 -1
- package/dist/events/wire-schema.d.ts +38 -15
- package/dist/events/wire-schema.d.ts.map +1 -1
- package/dist/events/wire-schema.js +8 -8
- package/dist/events/wire-schema.js.map +1 -1
- package/dist/index.d.ts +13 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -17
- package/dist/index.js.map +1 -1
- package/dist/providers/agent-resolver.js +1 -1
- package/dist/providers/agent-resolver.js.map +1 -1
- package/dist/providers/claude-session.d.ts +2 -1
- package/dist/providers/claude-session.d.ts.map +1 -1
- package/dist/providers/claude-session.js +43 -2
- package/dist/providers/claude-session.js.map +1 -1
- package/dist/providers/codex-cli-session.d.ts +3 -2
- package/dist/providers/codex-cli-session.d.ts.map +1 -1
- package/dist/providers/codex-cli-session.js +5 -2
- package/dist/providers/codex-cli-session.js.map +1 -1
- package/dist/providers/provider-factory.d.ts +2 -2
- package/dist/providers/provider-factory.d.ts.map +1 -1
- package/dist/providers/provider-factory.js +12 -12
- package/dist/providers/provider-factory.js.map +1 -1
- package/dist/providers/runner-types.d.ts +3 -16
- package/dist/providers/runner-types.d.ts.map +1 -1
- package/dist/research/adapters/arxiv.d.ts.map +1 -1
- package/dist/research/adapters/arxiv.js +6 -1
- package/dist/research/adapters/arxiv.js.map +1 -1
- package/dist/research/index.d.ts +11 -1
- package/dist/research/index.d.ts.map +1 -1
- package/dist/research/index.js +8 -1
- package/dist/research/index.js.map +1 -1
- package/dist/stores/context-block-tool.d.ts +2 -3
- package/dist/stores/context-block-tool.d.ts.map +1 -1
- package/dist/stores/context-block-tool.js +1 -1
- package/dist/stores/context-block-tool.js.map +1 -1
- package/dist/stores/project-context-registry.d.ts +0 -9
- package/dist/stores/project-context-registry.d.ts.map +1 -1
- package/dist/stores/project-context-registry.js +0 -4
- package/dist/stores/project-context-registry.js.map +1 -1
- package/dist/types/brief-quality-policy.d.ts.map +1 -1
- package/dist/types/enums.d.ts +0 -9
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/enums.js +0 -10
- package/dist/types/enums.js.map +1 -1
- package/dist/types/goal.d.ts +47 -0
- package/dist/types/goal.d.ts.map +1 -0
- package/dist/types/goal.js +2 -0
- package/dist/types/goal.js.map +1 -0
- package/dist/types/run-result.d.ts +48 -23
- package/dist/types/run-result.d.ts.map +1 -1
- package/dist/types/run-result.js +3 -16
- package/dist/types/run-result.js.map +1 -1
- package/dist/types/stage-stats.d.ts +1 -1
- package/dist/types/stage-stats.d.ts.map +1 -1
- package/dist/types/stage-stats.js +2 -4
- package/dist/types/stage-stats.js.map +1 -1
- package/dist/types/task-spec.d.ts +14 -17
- package/dist/types/task-spec.d.ts.map +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/unified/reviewer-output-parser.d.ts +51 -0
- package/dist/unified/reviewer-output-parser.d.ts.map +1 -0
- package/dist/unified/reviewer-output-parser.js +39 -0
- package/dist/unified/reviewer-output-parser.js.map +1 -0
- package/dist/unified/skill-loader.d.ts +9 -0
- package/dist/unified/skill-loader.d.ts.map +1 -0
- package/dist/unified/skill-loader.js +45 -0
- package/dist/unified/skill-loader.js.map +1 -0
- package/dist/unified/task-input-schema.d.ts +217 -0
- package/dist/unified/task-input-schema.d.ts.map +1 -0
- package/dist/unified/task-input-schema.js +35 -0
- package/dist/unified/task-input-schema.js.map +1 -0
- package/dist/unified/task-registry.d.ts +23 -0
- package/dist/unified/task-registry.d.ts.map +1 -0
- package/dist/unified/task-registry.js +56 -0
- package/dist/unified/task-registry.js.map +1 -0
- package/dist/unified/two-phase-pipeline.d.ts +52 -0
- package/dist/unified/two-phase-pipeline.d.ts.map +1 -0
- package/dist/unified/two-phase-pipeline.js +95 -0
- package/dist/unified/two-phase-pipeline.js.map +1 -0
- package/dist/unified/type-registry.d.ts +13 -0
- package/dist/unified/type-registry.d.ts.map +1 -0
- package/dist/unified/type-registry.js +30 -0
- package/dist/unified/type-registry.js.map +1 -0
- package/dist/unified/worktree-manager.d.ts +43 -0
- package/dist/unified/worktree-manager.d.ts.map +1 -0
- package/dist/unified/worktree-manager.js +76 -0
- package/dist/unified/worktree-manager.js.map +1 -0
- package/package.json +5 -117
- package/dist/bounded-execution/file-artifact-check.d.ts +0 -7
- package/dist/bounded-execution/file-artifact-check.d.ts.map +0 -1
- package/dist/bounded-execution/file-artifact-check.js +0 -13
- package/dist/bounded-execution/file-artifact-check.js.map +0 -1
- package/dist/bounded-execution/progress-events-subscriber.d.ts +0 -33
- package/dist/bounded-execution/progress-events-subscriber.d.ts.map +0 -1
- package/dist/bounded-execution/progress-events-subscriber.js +0 -59
- package/dist/bounded-execution/progress-events-subscriber.js.map +0 -1
- package/dist/bounded-execution/progress-watchdog.d.ts +0 -43
- package/dist/bounded-execution/progress-watchdog.d.ts.map +0 -1
- package/dist/bounded-execution/progress-watchdog.js +0 -170
- package/dist/bounded-execution/progress-watchdog.js.map +0 -1
- package/dist/bounded-execution/real-diff.d.ts +0 -17
- package/dist/bounded-execution/real-diff.d.ts.map +0 -1
- package/dist/bounded-execution/real-diff.js +0 -59
- package/dist/bounded-execution/real-diff.js.map +0 -1
- package/dist/bounded-execution/scope-match.d.ts +0 -7
- package/dist/bounded-execution/scope-match.d.ts.map +0 -1
- package/dist/bounded-execution/scope-match.js +0 -28
- package/dist/bounded-execution/scope-match.js.map +0 -1
- package/dist/bounded-execution/stall-watchdog.d.ts +0 -18
- package/dist/bounded-execution/stall-watchdog.d.ts.map +0 -1
- package/dist/bounded-execution/stall-watchdog.js +0 -134
- package/dist/bounded-execution/stall-watchdog.js.map +0 -1
- package/dist/bounded-execution/wall-clock-guard.d.ts +0 -12
- package/dist/bounded-execution/wall-clock-guard.d.ts.map +0 -1
- package/dist/bounded-execution/wall-clock-guard.js +0 -27
- package/dist/bounded-execution/wall-clock-guard.js.map +0 -1
- package/dist/config/canonical-model-identity.d.ts +0 -9
- package/dist/config/canonical-model-identity.d.ts.map +0 -1
- package/dist/config/canonical-model-identity.js +0 -54
- package/dist/config/canonical-model-identity.js.map +0 -1
- package/dist/journal/default-schema.d.ts +0 -2
- package/dist/journal/default-schema.d.ts.map +0 -1
- package/dist/journal/default-schema.js +0 -27
- package/dist/journal/default-schema.js.map +0 -1
- package/dist/journal/types.d.ts +0 -22
- package/dist/journal/types.d.ts.map +0 -1
- package/dist/journal/types.js +0 -5
- package/dist/journal/types.js.map +0 -1
- package/dist/lifecycle/annotate-parser.d.ts +0 -11
- package/dist/lifecycle/annotate-parser.d.ts.map +0 -1
- package/dist/lifecycle/annotate-parser.js +0 -74
- package/dist/lifecycle/annotate-parser.js.map +0 -1
- package/dist/lifecycle/annotate-prompts.d.ts +0 -9
- package/dist/lifecycle/annotate-prompts.d.ts.map +0 -1
- package/dist/lifecycle/annotate-prompts.js +0 -95
- package/dist/lifecycle/annotate-prompts.js.map +0 -1
- package/dist/lifecycle/auto-commit.d.ts +0 -3
- package/dist/lifecycle/auto-commit.d.ts.map +0 -1
- package/dist/lifecycle/auto-commit.js +0 -5
- package/dist/lifecycle/auto-commit.js.map +0 -1
- package/dist/lifecycle/auto-register-context-block.d.ts +0 -11
- package/dist/lifecycle/auto-register-context-block.d.ts.map +0 -1
- package/dist/lifecycle/auto-register-context-block.js +0 -18
- package/dist/lifecycle/auto-register-context-block.js.map +0 -1
- package/dist/lifecycle/build-cancelled-result.d.ts +0 -11
- package/dist/lifecycle/build-cancelled-result.d.ts.map +0 -1
- package/dist/lifecycle/build-cancelled-result.js +0 -25
- package/dist/lifecycle/build-cancelled-result.js.map +0 -1
- package/dist/lifecycle/derive-completion.d.ts +0 -24
- package/dist/lifecycle/derive-completion.d.ts.map +0 -1
- package/dist/lifecycle/derive-completion.js +0 -66
- package/dist/lifecycle/derive-completion.js.map +0 -1
- package/dist/lifecycle/diff-tracker.d.ts +0 -88
- package/dist/lifecycle/diff-tracker.d.ts.map +0 -1
- package/dist/lifecycle/diff-tracker.js +0 -429
- package/dist/lifecycle/diff-tracker.js.map +0 -1
- package/dist/lifecycle/executor-output-types.d.ts +0 -53
- package/dist/lifecycle/executor-output-types.d.ts.map +0 -1
- package/dist/lifecycle/executor-output-types.js +0 -2
- package/dist/lifecycle/executor-output-types.js.map +0 -1
- package/dist/lifecycle/file-confinement-check.d.ts +0 -17
- package/dist/lifecycle/file-confinement-check.d.ts.map +0 -1
- package/dist/lifecycle/file-confinement-check.js +0 -44
- package/dist/lifecycle/file-confinement-check.js.map +0 -1
- package/dist/lifecycle/findings-parser.d.ts +0 -18
- package/dist/lifecycle/findings-parser.d.ts.map +0 -1
- package/dist/lifecycle/findings-parser.js +0 -143
- package/dist/lifecycle/findings-parser.js.map +0 -1
- package/dist/lifecycle/git-toplevel.d.ts +0 -12
- package/dist/lifecycle/git-toplevel.d.ts.map +0 -1
- package/dist/lifecycle/git-toplevel.js +0 -52
- package/dist/lifecycle/git-toplevel.js.map +0 -1
- package/dist/lifecycle/handlers/annotate-stage.d.ts +0 -35
- package/dist/lifecycle/handlers/annotate-stage.d.ts.map +0 -1
- package/dist/lifecycle/handlers/annotate-stage.js +0 -360
- package/dist/lifecycle/handlers/annotate-stage.js.map +0 -1
- package/dist/lifecycle/handlers/baseline-handlers.d.ts +0 -12
- package/dist/lifecycle/handlers/baseline-handlers.d.ts.map +0 -1
- package/dist/lifecycle/handlers/baseline-handlers.js +0 -281
- package/dist/lifecycle/handlers/baseline-handlers.js.map +0 -1
- package/dist/lifecycle/handlers/compose-commit-message.d.ts +0 -15
- package/dist/lifecycle/handlers/compose-commit-message.d.ts.map +0 -1
- package/dist/lifecycle/handlers/compose-commit-message.js +0 -227
- package/dist/lifecycle/handlers/compose-commit-message.js.map +0 -1
- package/dist/lifecycle/handlers/enrich-runtime-result.d.ts +0 -3
- package/dist/lifecycle/handlers/enrich-runtime-result.d.ts.map +0 -1
- package/dist/lifecycle/handlers/enrich-runtime-result.js +0 -239
- package/dist/lifecycle/handlers/enrich-runtime-result.js.map +0 -1
- package/dist/lifecycle/handlers/git-commit-handler.d.ts +0 -4
- package/dist/lifecycle/handlers/git-commit-handler.d.ts.map +0 -1
- package/dist/lifecycle/handlers/git-commit-handler.js +0 -202
- package/dist/lifecycle/handlers/git-commit-handler.js.map +0 -1
- package/dist/lifecycle/handlers/implement-stage.d.ts +0 -10
- package/dist/lifecycle/handlers/implement-stage.d.ts.map +0 -1
- package/dist/lifecycle/handlers/implement-stage.js +0 -228
- package/dist/lifecycle/handlers/implement-stage.js.map +0 -1
- package/dist/lifecycle/handlers/journal-review-prompt.d.ts +0 -7
- package/dist/lifecycle/handlers/journal-review-prompt.d.ts.map +0 -1
- package/dist/lifecycle/handlers/journal-review-prompt.js +0 -54
- package/dist/lifecycle/handlers/journal-review-prompt.js.map +0 -1
- package/dist/lifecycle/handlers/parse-review-report.d.ts +0 -15
- package/dist/lifecycle/handlers/parse-review-report.d.ts.map +0 -1
- package/dist/lifecycle/handlers/parse-review-report.js +0 -40
- package/dist/lifecycle/handlers/parse-review-report.js.map +0 -1
- package/dist/lifecycle/handlers/prepare-execution-context-handler.d.ts +0 -13
- package/dist/lifecycle/handlers/prepare-execution-context-handler.d.ts.map +0 -1
- package/dist/lifecycle/handlers/prepare-execution-context-handler.js +0 -83
- package/dist/lifecycle/handlers/prepare-execution-context-handler.js.map +0 -1
- package/dist/lifecycle/handlers/quality-review-prompt.d.ts +0 -7
- package/dist/lifecycle/handlers/quality-review-prompt.d.ts.map +0 -1
- package/dist/lifecycle/handlers/quality-review-prompt.js +0 -50
- package/dist/lifecycle/handlers/quality-review-prompt.js.map +0 -1
- package/dist/lifecycle/handlers/read-route-implementer.d.ts +0 -52
- package/dist/lifecycle/handlers/read-route-implementer.d.ts.map +0 -1
- package/dist/lifecycle/handlers/read-route-implementer.js +0 -109
- package/dist/lifecycle/handlers/read-route-implementer.js.map +0 -1
- package/dist/lifecycle/handlers/register-context-block-handlers.d.ts +0 -4
- package/dist/lifecycle/handlers/register-context-block-handlers.d.ts.map +0 -1
- package/dist/lifecycle/handlers/register-context-block-handlers.js +0 -35
- package/dist/lifecycle/handlers/register-context-block-handlers.js.map +0 -1
- package/dist/lifecycle/handlers/review-stage.d.ts +0 -4
- package/dist/lifecycle/handlers/review-stage.d.ts.map +0 -1
- package/dist/lifecycle/handlers/review-stage.js +0 -277
- package/dist/lifecycle/handlers/review-stage.js.map +0 -1
- package/dist/lifecycle/handlers/rework-prompt.d.ts +0 -6
- package/dist/lifecycle/handlers/rework-prompt.d.ts.map +0 -1
- package/dist/lifecycle/handlers/rework-prompt.js +0 -18
- package/dist/lifecycle/handlers/rework-prompt.js.map +0 -1
- package/dist/lifecycle/handlers/rework-stage.d.ts +0 -4
- package/dist/lifecycle/handlers/rework-stage.d.ts.map +0 -1
- package/dist/lifecycle/handlers/rework-stage.js +0 -191
- package/dist/lifecycle/handlers/rework-stage.js.map +0 -1
- package/dist/lifecycle/handlers/spec-review-prompt.d.ts +0 -8
- package/dist/lifecycle/handlers/spec-review-prompt.d.ts.map +0 -1
- package/dist/lifecycle/handlers/spec-review-prompt.js +0 -47
- package/dist/lifecycle/handlers/spec-review-prompt.js.map +0 -1
- package/dist/lifecycle/handlers/terminal-handlers.d.ts +0 -61
- package/dist/lifecycle/handlers/terminal-handlers.d.ts.map +0 -1
- package/dist/lifecycle/handlers/terminal-handlers.js +0 -327
- package/dist/lifecycle/handlers/terminal-handlers.js.map +0 -1
- package/dist/lifecycle/handlers/tier-policy.d.ts +0 -11
- package/dist/lifecycle/handlers/tier-policy.d.ts.map +0 -1
- package/dist/lifecycle/handlers/tier-policy.js +0 -12
- package/dist/lifecycle/handlers/tier-policy.js.map +0 -1
- package/dist/lifecycle/lifecycle-context.d.ts +0 -109
- package/dist/lifecycle/lifecycle-context.d.ts.map +0 -1
- package/dist/lifecycle/lifecycle-context.js +0 -2
- package/dist/lifecycle/lifecycle-context.js.map +0 -1
- package/dist/lifecycle/lifecycle-dispatcher.d.ts +0 -35
- package/dist/lifecycle/lifecycle-dispatcher.d.ts.map +0 -1
- package/dist/lifecycle/lifecycle-dispatcher.js +0 -64
- package/dist/lifecycle/lifecycle-dispatcher.js.map +0 -1
- package/dist/lifecycle/lifecycle-driver.d.ts +0 -16
- package/dist/lifecycle/lifecycle-driver.d.ts.map +0 -1
- package/dist/lifecycle/lifecycle-driver.js +0 -334
- package/dist/lifecycle/lifecycle-driver.js.map +0 -1
- package/dist/lifecycle/merge-stage-stats.d.ts +0 -62
- package/dist/lifecycle/merge-stage-stats.d.ts.map +0 -1
- package/dist/lifecycle/merge-stage-stats.js +0 -136
- package/dist/lifecycle/merge-stage-stats.js.map +0 -1
- package/dist/lifecycle/normalize-output-targets.d.ts +0 -2
- package/dist/lifecycle/normalize-output-targets.d.ts.map +0 -1
- package/dist/lifecycle/normalize-output-targets.js +0 -14
- package/dist/lifecycle/normalize-output-targets.js.map +0 -1
- package/dist/lifecycle/perform-implementation.d.ts +0 -3
- package/dist/lifecycle/perform-implementation.d.ts.map +0 -1
- package/dist/lifecycle/perform-implementation.js +0 -371
- package/dist/lifecycle/perform-implementation.js.map +0 -1
- package/dist/lifecycle/read-only-subtype-spec.d.ts +0 -18
- package/dist/lifecycle/read-only-subtype-spec.d.ts.map +0 -1
- package/dist/lifecycle/read-only-subtype-spec.js +0 -2
- package/dist/lifecycle/read-only-subtype-spec.js.map +0 -1
- package/dist/lifecycle/repo-commit-lock.d.ts +0 -20
- package/dist/lifecycle/repo-commit-lock.d.ts.map +0 -1
- package/dist/lifecycle/repo-commit-lock.js +0 -40
- package/dist/lifecycle/repo-commit-lock.js.map +0 -1
- package/dist/lifecycle/review-verdict-mapping.d.ts +0 -16
- package/dist/lifecycle/review-verdict-mapping.d.ts.map +0 -1
- package/dist/lifecycle/review-verdict-mapping.js +0 -24
- package/dist/lifecycle/review-verdict-mapping.js.map +0 -1
- package/dist/lifecycle/shared-compute.d.ts +0 -14
- package/dist/lifecycle/shared-compute.d.ts.map +0 -1
- package/dist/lifecycle/shared-compute.js +0 -51
- package/dist/lifecycle/shared-compute.js.map +0 -1
- package/dist/lifecycle/stage-idle-tracker.d.ts +0 -14
- package/dist/lifecycle/stage-idle-tracker.d.ts.map +0 -1
- package/dist/lifecycle/stage-idle-tracker.js +0 -17
- package/dist/lifecycle/stage-idle-tracker.js.map +0 -1
- package/dist/lifecycle/stage-io.d.ts +0 -157
- package/dist/lifecycle/stage-io.d.ts.map +0 -1
- package/dist/lifecycle/stage-io.js +0 -20
- package/dist/lifecycle/stage-io.js.map +0 -1
- package/dist/lifecycle/stage-labels.d.ts +0 -7
- package/dist/lifecycle/stage-labels.d.ts.map +0 -1
- package/dist/lifecycle/stage-labels.js +0 -19
- package/dist/lifecycle/stage-labels.js.map +0 -1
- package/dist/lifecycle/stage-plan-builder.d.ts +0 -4
- package/dist/lifecycle/stage-plan-builder.d.ts.map +0 -1
- package/dist/lifecycle/stage-plan-builder.js +0 -164
- package/dist/lifecycle/stage-plan-builder.js.map +0 -1
- package/dist/lifecycle/stage-plan-types.d.ts +0 -131
- package/dist/lifecycle/stage-plan-types.d.ts.map +0 -1
- package/dist/lifecycle/stage-plan-types.js +0 -28
- package/dist/lifecycle/stage-plan-types.js.map +0 -1
- package/dist/lifecycle/stage-progression.d.ts +0 -6
- package/dist/lifecycle/stage-progression.d.ts.map +0 -1
- package/dist/lifecycle/stage-progression.js +0 -100
- package/dist/lifecycle/stage-progression.js.map +0 -1
- package/dist/lifecycle/task-executor.d.ts +0 -24
- package/dist/lifecycle/task-executor.d.ts.map +0 -1
- package/dist/lifecycle/task-executor.js +0 -320
- package/dist/lifecycle/task-executor.js.map +0 -1
- package/dist/lifecycle/task-runner.d.ts +0 -66
- package/dist/lifecycle/task-runner.d.ts.map +0 -1
- package/dist/lifecycle/task-runner.js +0 -332
- package/dist/lifecycle/task-runner.js.map +0 -1
- package/dist/lifecycle/tool-category.d.ts +0 -2
- package/dist/lifecycle/tool-category.d.ts.map +0 -1
- package/dist/lifecycle/tool-category.js +0 -6
- package/dist/lifecycle/tool-category.js.map +0 -1
- package/dist/lifecycle/tool-config-types.d.ts +0 -32
- package/dist/lifecycle/tool-config-types.d.ts.map +0 -1
- package/dist/lifecycle/tool-config-types.js +0 -2
- package/dist/lifecycle/tool-config-types.js.map +0 -1
- package/dist/lifecycle/warm-followup.d.ts +0 -3
- package/dist/lifecycle/warm-followup.d.ts.map +0 -1
- package/dist/lifecycle/warm-followup.js +0 -16
- package/dist/lifecycle/warm-followup.js.map +0 -1
- package/dist/lifecycle/worker-output-contract.d.ts +0 -22
- package/dist/lifecycle/worker-output-contract.d.ts.map +0 -1
- package/dist/lifecycle/worker-output-contract.js +0 -91
- package/dist/lifecycle/worker-output-contract.js.map +0 -1
- package/dist/providers/assemble-run-result.d.ts +0 -17
- package/dist/providers/assemble-run-result.d.ts.map +0 -1
- package/dist/providers/assemble-run-result.js +0 -52
- package/dist/providers/assemble-run-result.js.map +0 -1
- package/dist/providers/skill-resolver.d.ts +0 -17
- package/dist/providers/skill-resolver.d.ts.map +0 -1
- package/dist/providers/skill-resolver.js +0 -123
- package/dist/providers/skill-resolver.js.map +0 -1
- package/dist/reporting/batch-persister.d.ts +0 -4
- package/dist/reporting/batch-persister.d.ts.map +0 -1
- package/dist/reporting/batch-persister.js +0 -11
- package/dist/reporting/batch-persister.js.map +0 -1
- package/dist/reporting/commit-stage-runner.d.ts +0 -12
- package/dist/reporting/commit-stage-runner.d.ts.map +0 -1
- package/dist/reporting/commit-stage-runner.js +0 -43
- package/dist/reporting/commit-stage-runner.js.map +0 -1
- package/dist/reporting/derive-investigate-status.d.ts +0 -15
- package/dist/reporting/derive-investigate-status.d.ts.map +0 -1
- package/dist/reporting/derive-investigate-status.js +0 -23
- package/dist/reporting/derive-investigate-status.js.map +0 -1
- package/dist/reporting/extract-fenced-json.d.ts +0 -7
- package/dist/reporting/extract-fenced-json.d.ts.map +0 -1
- package/dist/reporting/extract-fenced-json.js +0 -17
- package/dist/reporting/extract-fenced-json.js.map +0 -1
- package/dist/reporting/findings-headline.d.ts +0 -12
- package/dist/reporting/findings-headline.d.ts.map +0 -1
- package/dist/reporting/findings-headline.js +0 -40
- package/dist/reporting/findings-headline.js.map +0 -1
- package/dist/reporting/findings-outcome.d.ts +0 -13
- package/dist/reporting/findings-outcome.d.ts.map +0 -1
- package/dist/reporting/findings-outcome.js +0 -22
- package/dist/reporting/findings-outcome.js.map +0 -1
- package/dist/reporting/headline-composer.d.ts +0 -29
- package/dist/reporting/headline-composer.d.ts.map +0 -1
- package/dist/reporting/headline-composer.js +0 -10
- package/dist/reporting/headline-composer.js.map +0 -1
- package/dist/reporting/headline-templates/delegate.d.ts +0 -3
- package/dist/reporting/headline-templates/delegate.d.ts.map +0 -1
- package/dist/reporting/headline-templates/delegate.js +0 -42
- package/dist/reporting/headline-templates/delegate.js.map +0 -1
- package/dist/reporting/headline-templates/execute-plan.d.ts +0 -3
- package/dist/reporting/headline-templates/execute-plan.d.ts.map +0 -1
- package/dist/reporting/headline-templates/execute-plan.js +0 -26
- package/dist/reporting/headline-templates/execute-plan.js.map +0 -1
- package/dist/reporting/headline-templates/investigate.d.ts +0 -13
- package/dist/reporting/headline-templates/investigate.d.ts.map +0 -1
- package/dist/reporting/headline-templates/investigate.js +0 -53
- package/dist/reporting/headline-templates/investigate.js.map +0 -1
- package/dist/reporting/headline-templates/journal-recall.d.ts +0 -3
- package/dist/reporting/headline-templates/journal-recall.d.ts.map +0 -1
- package/dist/reporting/headline-templates/journal-recall.js +0 -9
- package/dist/reporting/headline-templates/journal-recall.js.map +0 -1
- package/dist/reporting/headline-templates/journal.d.ts +0 -3
- package/dist/reporting/headline-templates/journal.d.ts.map +0 -1
- package/dist/reporting/headline-templates/journal.js +0 -17
- package/dist/reporting/headline-templates/journal.js.map +0 -1
- package/dist/reporting/headline-templates/research.d.ts +0 -3
- package/dist/reporting/headline-templates/research.d.ts.map +0 -1
- package/dist/reporting/headline-templates/research.js +0 -22
- package/dist/reporting/headline-templates/research.js.map +0 -1
- package/dist/reporting/headline-text.d.ts +0 -36
- package/dist/reporting/headline-text.d.ts.map +0 -1
- package/dist/reporting/headline-text.js +0 -73
- package/dist/reporting/headline-text.js.map +0 -1
- package/dist/reporting/report-parser-slots/delegate-report.d.ts +0 -8
- package/dist/reporting/report-parser-slots/delegate-report.d.ts.map +0 -1
- package/dist/reporting/report-parser-slots/delegate-report.js +0 -12
- package/dist/reporting/report-parser-slots/delegate-report.js.map +0 -1
- package/dist/reporting/report-parser-slots/execute-plan-report.d.ts +0 -11
- package/dist/reporting/report-parser-slots/execute-plan-report.d.ts.map +0 -1
- package/dist/reporting/report-parser-slots/execute-plan-report.js +0 -7
- package/dist/reporting/report-parser-slots/execute-plan-report.js.map +0 -1
- package/dist/reporting/report-parser-slots/investigate-report.d.ts +0 -52
- package/dist/reporting/report-parser-slots/investigate-report.d.ts.map +0 -1
- package/dist/reporting/report-parser-slots/investigate-report.js +0 -307
- package/dist/reporting/report-parser-slots/investigate-report.js.map +0 -1
- package/dist/reporting/report-parser-slots/journal-report.d.ts +0 -19
- package/dist/reporting/report-parser-slots/journal-report.d.ts.map +0 -1
- package/dist/reporting/report-parser-slots/journal-report.js +0 -13
- package/dist/reporting/report-parser-slots/journal-report.js.map +0 -1
- package/dist/reporting/report-parser-slots/no-structured-report.d.ts +0 -10
- package/dist/reporting/report-parser-slots/no-structured-report.d.ts.map +0 -1
- package/dist/reporting/report-parser-slots/no-structured-report.js +0 -13
- package/dist/reporting/report-parser-slots/no-structured-report.js.map +0 -1
- package/dist/reporting/report-parser-slots/research-report.d.ts +0 -31
- package/dist/reporting/report-parser-slots/research-report.d.ts.map +0 -1
- package/dist/reporting/report-parser-slots/research-report.js +0 -50
- package/dist/reporting/report-parser-slots/research-report.js.map +0 -1
- package/dist/reporting/response-envelope-builder.d.ts +0 -32
- package/dist/reporting/response-envelope-builder.d.ts.map +0 -1
- package/dist/reporting/response-envelope-builder.js +0 -26
- package/dist/reporting/response-envelope-builder.js.map +0 -1
- package/dist/reporting/severity.d.ts +0 -62
- package/dist/reporting/severity.d.ts.map +0 -1
- package/dist/reporting/severity.js +0 -93
- package/dist/reporting/severity.js.map +0 -1
- package/dist/reporting/structured-report-parser.d.ts +0 -9
- package/dist/reporting/structured-report-parser.d.ts.map +0 -1
- package/dist/reporting/structured-report-parser.js +0 -8
- package/dist/reporting/structured-report-parser.js.map +0 -1
- package/dist/reporting/terminal-block-registrar.d.ts +0 -14
- package/dist/reporting/terminal-block-registrar.d.ts.map +0 -1
- package/dist/reporting/terminal-block-registrar.js +0 -17
- package/dist/reporting/terminal-block-registrar.js.map +0 -1
- package/dist/reporting/terminal-report-markdown.d.ts +0 -13
- package/dist/reporting/terminal-report-markdown.d.ts.map +0 -1
- package/dist/reporting/terminal-report-markdown.js +0 -31
- package/dist/reporting/terminal-report-markdown.js.map +0 -1
- package/dist/research/research-pre-loop.d.ts +0 -22
- package/dist/research/research-pre-loop.d.ts.map +0 -1
- package/dist/research/research-pre-loop.js +0 -50
- package/dist/research/research-pre-loop.js.map +0 -1
- package/dist/routing/read-route-criteria.d.ts +0 -36
- package/dist/routing/read-route-criteria.d.ts.map +0 -1
- package/dist/routing/read-route-criteria.js +0 -71
- package/dist/routing/read-route-criteria.js.map +0 -1
- package/dist/stores/batch-cache.d.ts +0 -29
- package/dist/stores/batch-cache.d.ts.map +0 -1
- package/dist/stores/batch-cache.js +0 -89
- package/dist/stores/batch-cache.js.map +0 -1
- package/dist/stores/batch-registry.d.ts +0 -138
- package/dist/stores/batch-registry.d.ts.map +0 -1
- package/dist/stores/batch-registry.js +0 -205
- package/dist/stores/batch-registry.js.map +0 -1
- package/dist/tool-surface/register-all-tools.d.ts +0 -4
- package/dist/tool-surface/register-all-tools.d.ts.map +0 -1
- package/dist/tool-surface/register-all-tools.js +0 -35
- package/dist/tool-surface/register-all-tools.js.map +0 -1
- package/dist/tool-surface/tool-surface-registry.d.ts +0 -28
- package/dist/tool-surface/tool-surface-registry.d.ts.map +0 -1
- package/dist/tool-surface/tool-surface-registry.js +0 -16
- package/dist/tool-surface/tool-surface-registry.js.map +0 -1
- package/dist/tools/audit/brief-slot.d.ts +0 -15
- package/dist/tools/audit/brief-slot.d.ts.map +0 -1
- package/dist/tools/audit/brief-slot.js +0 -69
- package/dist/tools/audit/brief-slot.js.map +0 -1
- package/dist/tools/audit/implementer-criteria.d.ts +0 -62
- package/dist/tools/audit/implementer-criteria.d.ts.map +0 -1
- package/dist/tools/audit/implementer-criteria.js +0 -121
- package/dist/tools/audit/implementer-criteria.js.map +0 -1
- package/dist/tools/audit/plan-audit-criteria.d.ts +0 -35
- package/dist/tools/audit/plan-audit-criteria.d.ts.map +0 -1
- package/dist/tools/audit/plan-audit-criteria.js +0 -159
- package/dist/tools/audit/plan-audit-criteria.js.map +0 -1
- package/dist/tools/audit/schema.d.ts +0 -61
- package/dist/tools/audit/schema.d.ts.map +0 -1
- package/dist/tools/audit/schema.js +0 -21
- package/dist/tools/audit/schema.js.map +0 -1
- package/dist/tools/audit/skill-audit-criteria.d.ts +0 -9
- package/dist/tools/audit/skill-audit-criteria.d.ts.map +0 -1
- package/dist/tools/audit/skill-audit-criteria.js +0 -52
- package/dist/tools/audit/skill-audit-criteria.js.map +0 -1
- package/dist/tools/audit/spec-audit-criteria.d.ts +0 -9
- package/dist/tools/audit/spec-audit-criteria.d.ts.map +0 -1
- package/dist/tools/audit/spec-audit-criteria.js +0 -55
- package/dist/tools/audit/spec-audit-criteria.js.map +0 -1
- package/dist/tools/audit/subtypes.d.ts +0 -4
- package/dist/tools/audit/subtypes.d.ts.map +0 -1
- package/dist/tools/audit/subtypes.js +0 -69
- package/dist/tools/audit/subtypes.js.map +0 -1
- package/dist/tools/audit/tool-config.d.ts +0 -7
- package/dist/tools/audit/tool-config.d.ts.map +0 -1
- package/dist/tools/audit/tool-config.js +0 -60
- package/dist/tools/audit/tool-config.js.map +0 -1
- package/dist/tools/criteria-types.d.ts +0 -27
- package/dist/tools/criteria-types.d.ts.map +0 -1
- package/dist/tools/criteria-types.js +0 -25
- package/dist/tools/criteria-types.js.map +0 -1
- package/dist/tools/debug/brief-slot.d.ts +0 -15
- package/dist/tools/debug/brief-slot.d.ts.map +0 -1
- package/dist/tools/debug/brief-slot.js +0 -10
- package/dist/tools/debug/brief-slot.js.map +0 -1
- package/dist/tools/debug/implementer-criteria.d.ts +0 -45
- package/dist/tools/debug/implementer-criteria.d.ts.map +0 -1
- package/dist/tools/debug/implementer-criteria.js +0 -97
- package/dist/tools/debug/implementer-criteria.js.map +0 -1
- package/dist/tools/debug/schema.d.ts +0 -60
- package/dist/tools/debug/schema.d.ts.map +0 -1
- package/dist/tools/debug/schema.js +0 -17
- package/dist/tools/debug/schema.js.map +0 -1
- package/dist/tools/debug/subtypes.d.ts +0 -4
- package/dist/tools/debug/subtypes.d.ts.map +0 -1
- package/dist/tools/debug/subtypes.js +0 -26
- package/dist/tools/debug/subtypes.js.map +0 -1
- package/dist/tools/debug/tool-config.d.ts +0 -7
- package/dist/tools/debug/tool-config.d.ts.map +0 -1
- package/dist/tools/debug/tool-config.js +0 -55
- package/dist/tools/debug/tool-config.js.map +0 -1
- package/dist/tools/delegate/brief-slot.d.ts +0 -17
- package/dist/tools/delegate/brief-slot.d.ts.map +0 -1
- package/dist/tools/delegate/brief-slot.js +0 -55
- package/dist/tools/delegate/brief-slot.js.map +0 -1
- package/dist/tools/delegate/implementer-criteria.d.ts +0 -53
- package/dist/tools/delegate/implementer-criteria.d.ts.map +0 -1
- package/dist/tools/delegate/implementer-criteria.js +0 -99
- package/dist/tools/delegate/implementer-criteria.js.map +0 -1
- package/dist/tools/delegate/schema.d.ts +0 -74
- package/dist/tools/delegate/schema.d.ts.map +0 -1
- package/dist/tools/delegate/schema.js +0 -23
- package/dist/tools/delegate/schema.js.map +0 -1
- package/dist/tools/delegate/tool-config.d.ts +0 -7
- package/dist/tools/delegate/tool-config.d.ts.map +0 -1
- package/dist/tools/delegate/tool-config.js +0 -44
- package/dist/tools/delegate/tool-config.js.map +0 -1
- package/dist/tools/execute-plan/barrel.d.ts +0 -2
- package/dist/tools/execute-plan/barrel.d.ts.map +0 -1
- package/dist/tools/execute-plan/barrel.js +0 -7
- package/dist/tools/execute-plan/barrel.js.map +0 -1
- package/dist/tools/execute-plan/brief-slot.d.ts +0 -19
- package/dist/tools/execute-plan/brief-slot.d.ts.map +0 -1
- package/dist/tools/execute-plan/brief-slot.js +0 -80
- package/dist/tools/execute-plan/brief-slot.js.map +0 -1
- package/dist/tools/execute-plan/implementer-criteria.d.ts +0 -57
- package/dist/tools/execute-plan/implementer-criteria.d.ts.map +0 -1
- package/dist/tools/execute-plan/implementer-criteria.js +0 -108
- package/dist/tools/execute-plan/implementer-criteria.js.map +0 -1
- package/dist/tools/execute-plan/plan-extractor.d.ts +0 -21
- package/dist/tools/execute-plan/plan-extractor.d.ts.map +0 -1
- package/dist/tools/execute-plan/plan-extractor.js +0 -96
- package/dist/tools/execute-plan/plan-extractor.js.map +0 -1
- package/dist/tools/execute-plan/tool-config.d.ts +0 -68
- package/dist/tools/execute-plan/tool-config.d.ts.map +0 -1
- package/dist/tools/execute-plan/tool-config.js +0 -107
- package/dist/tools/execute-plan/tool-config.js.map +0 -1
- package/dist/tools/index.d.ts +0 -8
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -14
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/investigate/brief-slot.d.ts +0 -15
- package/dist/tools/investigate/brief-slot.d.ts.map +0 -1
- package/dist/tools/investigate/brief-slot.js +0 -9
- package/dist/tools/investigate/brief-slot.js.map +0 -1
- package/dist/tools/investigate/implementer-criteria.d.ts +0 -52
- package/dist/tools/investigate/implementer-criteria.d.ts.map +0 -1
- package/dist/tools/investigate/implementer-criteria.js +0 -106
- package/dist/tools/investigate/implementer-criteria.js.map +0 -1
- package/dist/tools/investigate/schema.d.ts +0 -62
- package/dist/tools/investigate/schema.d.ts.map +0 -1
- package/dist/tools/investigate/schema.js +0 -13
- package/dist/tools/investigate/schema.js.map +0 -1
- package/dist/tools/investigate/subtypes.d.ts +0 -4
- package/dist/tools/investigate/subtypes.d.ts.map +0 -1
- package/dist/tools/investigate/subtypes.js +0 -26
- package/dist/tools/investigate/subtypes.js.map +0 -1
- package/dist/tools/investigate/tool-config.d.ts +0 -8
- package/dist/tools/investigate/tool-config.d.ts.map +0 -1
- package/dist/tools/investigate/tool-config.js +0 -68
- package/dist/tools/investigate/tool-config.js.map +0 -1
- package/dist/tools/journal/recall/brief-slot.d.ts +0 -7
- package/dist/tools/journal/recall/brief-slot.d.ts.map +0 -1
- package/dist/tools/journal/recall/brief-slot.js +0 -5
- package/dist/tools/journal/recall/brief-slot.js.map +0 -1
- package/dist/tools/journal/recall/implementer-criteria.d.ts +0 -9
- package/dist/tools/journal/recall/implementer-criteria.d.ts.map +0 -1
- package/dist/tools/journal/recall/implementer-criteria.js +0 -23
- package/dist/tools/journal/recall/implementer-criteria.js.map +0 -1
- package/dist/tools/journal/recall/schema.d.ts +0 -54
- package/dist/tools/journal/recall/schema.d.ts.map +0 -1
- package/dist/tools/journal/recall/schema.js +0 -10
- package/dist/tools/journal/recall/schema.js.map +0 -1
- package/dist/tools/journal/recall/subtypes.d.ts +0 -4
- package/dist/tools/journal/recall/subtypes.d.ts.map +0 -1
- package/dist/tools/journal/recall/subtypes.js +0 -25
- package/dist/tools/journal/recall/subtypes.js.map +0 -1
- package/dist/tools/journal/recall/tool-config.d.ts +0 -8
- package/dist/tools/journal/recall/tool-config.d.ts.map +0 -1
- package/dist/tools/journal/recall/tool-config.js +0 -46
- package/dist/tools/journal/recall/tool-config.js.map +0 -1
- package/dist/tools/journal/record/brief-slot.d.ts +0 -12
- package/dist/tools/journal/record/brief-slot.d.ts.map +0 -1
- package/dist/tools/journal/record/brief-slot.js +0 -24
- package/dist/tools/journal/record/brief-slot.js.map +0 -1
- package/dist/tools/journal/record/implementer-criteria.d.ts +0 -6
- package/dist/tools/journal/record/implementer-criteria.d.ts.map +0 -1
- package/dist/tools/journal/record/implementer-criteria.js +0 -20
- package/dist/tools/journal/record/implementer-criteria.js.map +0 -1
- package/dist/tools/journal/record/schema.d.ts +0 -55
- package/dist/tools/journal/record/schema.d.ts.map +0 -1
- package/dist/tools/journal/record/schema.js +0 -12
- package/dist/tools/journal/record/schema.js.map +0 -1
- package/dist/tools/journal/record/tool-config.d.ts +0 -7
- package/dist/tools/journal/record/tool-config.d.ts.map +0 -1
- package/dist/tools/journal/record/tool-config.js +0 -40
- package/dist/tools/journal/record/tool-config.js.map +0 -1
- package/dist/tools/read-route-prompt.d.ts +0 -113
- package/dist/tools/read-route-prompt.d.ts.map +0 -1
- package/dist/tools/read-route-prompt.js +0 -86
- package/dist/tools/read-route-prompt.js.map +0 -1
- package/dist/tools/register-context-block/schema.d.ts +0 -8
- package/dist/tools/register-context-block/schema.d.ts.map +0 -1
- package/dist/tools/register-context-block/schema.js +0 -7
- package/dist/tools/register-context-block/schema.js.map +0 -1
- package/dist/tools/register-context-block/tool-config.d.ts +0 -6
- package/dist/tools/register-context-block/tool-config.d.ts.map +0 -1
- package/dist/tools/register-context-block/tool-config.js +0 -39
- package/dist/tools/register-context-block/tool-config.js.map +0 -1
- package/dist/tools/research/brief-slot.d.ts +0 -37
- package/dist/tools/research/brief-slot.d.ts.map +0 -1
- package/dist/tools/research/brief-slot.js +0 -68
- package/dist/tools/research/brief-slot.js.map +0 -1
- package/dist/tools/research/implementer-criteria.d.ts +0 -13
- package/dist/tools/research/implementer-criteria.d.ts.map +0 -1
- package/dist/tools/research/implementer-criteria.js +0 -109
- package/dist/tools/research/implementer-criteria.js.map +0 -1
- package/dist/tools/research/schema.d.ts +0 -11
- package/dist/tools/research/schema.d.ts.map +0 -1
- package/dist/tools/research/schema.js +0 -59
- package/dist/tools/research/schema.js.map +0 -1
- package/dist/tools/research/subtypes.d.ts +0 -4
- package/dist/tools/research/subtypes.d.ts.map +0 -1
- package/dist/tools/research/subtypes.js +0 -25
- package/dist/tools/research/subtypes.js.map +0 -1
- package/dist/tools/research/tool-config.d.ts +0 -8
- package/dist/tools/research/tool-config.d.ts.map +0 -1
- package/dist/tools/research/tool-config.js +0 -48
- package/dist/tools/research/tool-config.js.map +0 -1
- package/dist/tools/research/two-turn-driver.d.ts +0 -16
- package/dist/tools/research/two-turn-driver.d.ts.map +0 -1
- package/dist/tools/research/two-turn-driver.js +0 -41
- package/dist/tools/research/two-turn-driver.js.map +0 -1
- package/dist/tools/retry/brief-slot.d.ts +0 -7
- package/dist/tools/retry/brief-slot.d.ts.map +0 -1
- package/dist/tools/retry/brief-slot.js +0 -2
- package/dist/tools/retry/brief-slot.js.map +0 -1
- package/dist/tools/retry/schema.d.ts +0 -54
- package/dist/tools/retry/schema.d.ts.map +0 -1
- package/dist/tools/retry/schema.js +0 -12
- package/dist/tools/retry/schema.js.map +0 -1
- package/dist/tools/retry/tool-config.d.ts +0 -7
- package/dist/tools/retry/tool-config.d.ts.map +0 -1
- package/dist/tools/retry/tool-config.js +0 -84
- package/dist/tools/retry/tool-config.js.map +0 -1
- package/dist/tools/review/brief-slot.d.ts +0 -11
- package/dist/tools/review/brief-slot.d.ts.map +0 -1
- package/dist/tools/review/brief-slot.js +0 -23
- package/dist/tools/review/brief-slot.js.map +0 -1
- package/dist/tools/review/implementer-criteria.d.ts +0 -48
- package/dist/tools/review/implementer-criteria.d.ts.map +0 -1
- package/dist/tools/review/implementer-criteria.js +0 -108
- package/dist/tools/review/implementer-criteria.js.map +0 -1
- package/dist/tools/review/schema.d.ts +0 -64
- package/dist/tools/review/schema.d.ts.map +0 -1
- package/dist/tools/review/schema.js +0 -17
- package/dist/tools/review/schema.js.map +0 -1
- package/dist/tools/review/subtypes.d.ts +0 -4
- package/dist/tools/review/subtypes.d.ts.map +0 -1
- package/dist/tools/review/subtypes.js +0 -27
- package/dist/tools/review/subtypes.js.map +0 -1
- package/dist/tools/review/tool-config.d.ts +0 -7
- package/dist/tools/review/tool-config.d.ts.map +0 -1
- package/dist/tools/review/tool-config.js +0 -94
- package/dist/tools/review/tool-config.js.map +0 -1
- package/dist/tools/shared-output.d.ts +0 -56
- package/dist/tools/shared-output.d.ts.map +0 -1
- package/dist/tools/shared-output.js +0 -33
- package/dist/tools/shared-output.js.map +0 -1
- package/dist/types/review-policy.d.ts +0 -2
- package/dist/types/review-policy.d.ts.map +0 -1
- package/dist/types/review-policy.js +0 -2
- package/dist/types/review-policy.js.map +0 -1
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
// v4.4.x — Rework stage.
|
|
2
|
-
//
|
|
3
|
-
// Fires only when reviewVerdict === 'changes_required'. Runs on the
|
|
4
|
-
// same standard session that did Implementing (full conversation
|
|
5
|
-
// continuity). Worker is asked to address the reviewer's concerns.
|
|
6
|
-
// Rework's WorkerOutput merges onto Implementing's per the spec's
|
|
7
|
-
// "Rework → Implementing field merge rules": summary/workerStatus/unresolved/commitMessage take Rework's
|
|
8
|
-
// values; filesChanged is the union of both phases.
|
|
9
|
-
import { reviewPayload } from '../stage-plan-types.js';
|
|
10
|
-
import { replaceLastRunResultPreservingTrackers, mergeStageStats } from '../merge-stage-stats.js';
|
|
11
|
-
import { reworkPrompt } from './rework-prompt.js';
|
|
12
|
-
import { buildWarmFollowupMessage } from '../warm-followup.js';
|
|
13
|
-
import { assembleRunResult } from '../../providers/assemble-run-result.js';
|
|
14
|
-
import { parseWorkerOutput } from '../worker-output-contract.js';
|
|
15
|
-
import { HUMAN_LABEL } from '../stage-labels.js';
|
|
16
|
-
import { startProgressWatchdog, recordPostHocSignals } from '../../bounded-execution/progress-watchdog.js';
|
|
17
|
-
function reworkSkip(comment, t0) {
|
|
18
|
-
return {
|
|
19
|
-
outcome: 'skip',
|
|
20
|
-
comment,
|
|
21
|
-
payload: null,
|
|
22
|
-
telemetry: { stageLabel: 'rework', durationMs: Date.now() - t0, costUSD: 0, turnsUsed: 0, stopReason: 'normal' },
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function reworkHalt(comment, t0) {
|
|
26
|
-
return {
|
|
27
|
-
outcome: 'halt',
|
|
28
|
-
comment,
|
|
29
|
-
payload: null,
|
|
30
|
-
telemetry: { stageLabel: 'rework', durationMs: Date.now() - t0, costUSD: 0, turnsUsed: 0, stopReason: 'transport_error' },
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export async function reworkHandler(state) {
|
|
34
|
-
const t0 = Date.now();
|
|
35
|
-
if (state.terminal)
|
|
36
|
-
return reworkSkip('rework skipped: terminal', t0);
|
|
37
|
-
if (state.reworkApplied !== undefined || state.reworkError !== undefined) {
|
|
38
|
-
return reworkSkip('rework already applied', t0);
|
|
39
|
-
}
|
|
40
|
-
if (reviewPayload(state).verdict !== 'changes_required') {
|
|
41
|
-
return reworkSkip('rework skipped: review verdict is not changes_required', t0);
|
|
42
|
-
}
|
|
43
|
-
const ctx = state.executionContext;
|
|
44
|
-
const task = state.task;
|
|
45
|
-
const last = state.lastRunResult;
|
|
46
|
-
if (!ctx || !task || !last)
|
|
47
|
-
return reworkSkip('rework skipped: missing context', t0);
|
|
48
|
-
const findings = reviewPayload(state).findings;
|
|
49
|
-
if (findings.length === 0) {
|
|
50
|
-
state.reworkApplied = false;
|
|
51
|
-
return reworkSkip('rework skipped: review produced no findings', t0);
|
|
52
|
-
}
|
|
53
|
-
let cumulativeDiff = '';
|
|
54
|
-
if (state.diffTracker) {
|
|
55
|
-
try {
|
|
56
|
-
cumulativeDiff = await state.diffTracker.cumulativeDiff();
|
|
57
|
-
}
|
|
58
|
-
catch { /* tolerated */ }
|
|
59
|
-
}
|
|
60
|
-
// Rework matches the implementer's tier — rework's job is to FIX the
|
|
61
|
-
// implementer's work, so it needs the same capability. Read implementer
|
|
62
|
-
// tier from executionContext.assignedTier; fall back to the implementing
|
|
63
|
-
// stage's gate payload, then 'standard' as a defensive last resort.
|
|
64
|
-
// Final fallback: if the matched tier has no provider configured, use
|
|
65
|
-
// whichever tier does (parity with reviewer's fallback behavior).
|
|
66
|
-
const desiredReworkTier = ctx.assignedTier
|
|
67
|
-
?? (state.gates?.['implement']?.payload?.agentTier)
|
|
68
|
-
?? 'standard';
|
|
69
|
-
const reworkTier = ctx.providers[desiredReworkTier]
|
|
70
|
-
? desiredReworkTier
|
|
71
|
-
: (ctx.providers['standard'] ? 'standard' : 'complex');
|
|
72
|
-
const provider = ctx.providers[reworkTier];
|
|
73
|
-
if (!provider) {
|
|
74
|
-
state.reworkError = `no provider available for tier ${reworkTier}`;
|
|
75
|
-
return reworkHalt(`no provider available for tier ${reworkTier}`, t0);
|
|
76
|
-
}
|
|
77
|
-
const concerns = findings.map((f) => `[${f.source}] ${f.text}`);
|
|
78
|
-
const promptCtx = {
|
|
79
|
-
brief: task.prompt ?? '',
|
|
80
|
-
workerOutput: last.output ?? '',
|
|
81
|
-
diff: cumulativeDiff,
|
|
82
|
-
planContext: task.planContext,
|
|
83
|
-
priorConcerns: concerns,
|
|
84
|
-
};
|
|
85
|
-
// Rework always resumes the implementer's thread — the systemPrompt,
|
|
86
|
-
// brief, prior output, and cumulative diff are already in conversation
|
|
87
|
-
// history. We send only the new instruction (reviewer deviations +
|
|
88
|
-
// fix action) wrapped in the standard warm-followup preamble.
|
|
89
|
-
const fullPrompt = buildWarmFollowupMessage(reworkPrompt(promptCtx))
|
|
90
|
-
+ '\n\nDo NOT run git history-mutating commands (commit / add / push / reset / rebase / etc.) — the Committing stage will handle persistence at the end.';
|
|
91
|
-
let result;
|
|
92
|
-
// Wire progress watchdog around the rework session.send.
|
|
93
|
-
const wdConfig = {
|
|
94
|
-
enabled: ctx.config?.defaults?.progressWatchdogEnabled ?? true,
|
|
95
|
-
thrashTurns: ctx.config?.defaults?.thrashTurns ?? 25,
|
|
96
|
-
thrashWallClockMs: ctx.config?.defaults?.thrashWallClockMs ?? 1_200_000,
|
|
97
|
-
thrashSoftWallClockMs: 600_000,
|
|
98
|
-
};
|
|
99
|
-
const wdState2 = { fired: false };
|
|
100
|
-
const wdController = ctx.stall.controller;
|
|
101
|
-
let disposeWd;
|
|
102
|
-
if (wdConfig.enabled) {
|
|
103
|
-
disposeWd = startProgressWatchdog({
|
|
104
|
-
state,
|
|
105
|
-
controller: wdController,
|
|
106
|
-
emit: (_event) => { },
|
|
107
|
-
config: wdConfig,
|
|
108
|
-
taskIndex: ctx.taskIndex,
|
|
109
|
-
batchId: ctx.batchId,
|
|
110
|
-
state2: wdState2,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
let turn;
|
|
114
|
-
try {
|
|
115
|
-
const session = ctx.getSession(reworkTier);
|
|
116
|
-
turn = await session.send(fullPrompt, { stageLabel: HUMAN_LABEL.rework });
|
|
117
|
-
result = assembleRunResult(turn);
|
|
118
|
-
}
|
|
119
|
-
catch (err) {
|
|
120
|
-
state.reworkError = err instanceof Error ? err.message : String(err);
|
|
121
|
-
disposeWd?.();
|
|
122
|
-
return reworkHalt(`rework session.send failed: ${state.reworkError}`, t0);
|
|
123
|
-
}
|
|
124
|
-
finally {
|
|
125
|
-
disposeWd?.();
|
|
126
|
-
}
|
|
127
|
-
if (wdConfig.enabled && turn !== undefined) {
|
|
128
|
-
await recordPostHocSignals(state, turn.turns ?? 0, wdConfig, (_event) => { }, ctx.taskIndex, ctx.batchId);
|
|
129
|
-
}
|
|
130
|
-
if (result.status !== 'ok') {
|
|
131
|
-
state.reworkError = `rework returned status: ${result.status}`;
|
|
132
|
-
return reworkHalt(state.reworkError, t0);
|
|
133
|
-
}
|
|
134
|
-
// Parse the Rework worker's WorkerOutput JSON block.
|
|
135
|
-
const reworked = parseWorkerOutput(result.output ?? '');
|
|
136
|
-
state.reworkApplied = true;
|
|
137
|
-
state.reworkOutput = result.output;
|
|
138
|
-
replaceLastRunResultPreservingTrackers(state, result);
|
|
139
|
-
// Apply merge rules: Rework owns summary/workerStatus/unresolved/commitMessage;
|
|
140
|
-
// filesChanged is the union of Implementing's + Rework's.
|
|
141
|
-
const merged = state.lastRunResult;
|
|
142
|
-
if (merged) {
|
|
143
|
-
const priorFilesChanged = (last.filesChanged) ?? [];
|
|
144
|
-
merged.summary = reworked.summary;
|
|
145
|
-
merged.workerStatus = reworked.workerSelfAssessment;
|
|
146
|
-
merged.filesChanged = Array.from(new Set([...priorFilesChanged, ...reworked.filesChanged]));
|
|
147
|
-
// v5: unresolved, commitMessage removed from worker output schema
|
|
148
|
-
merged.unresolved = reworked.unresolved ?? [];
|
|
149
|
-
if (reworked.commitMessage)
|
|
150
|
-
merged.commitMessage = reworked.commitMessage;
|
|
151
|
-
// Persist parsedCleanly from rework so enrichRuntimeResult can access it
|
|
152
|
-
merged.parsedCleanly = reworked.parsedCleanly;
|
|
153
|
-
}
|
|
154
|
-
mergeStageStats(state, 'rework', {
|
|
155
|
-
inputTokens: result.usage?.inputTokens ?? 0,
|
|
156
|
-
outputTokens: result.usage?.outputTokens ?? 0,
|
|
157
|
-
cachedReadTokens: result.usage?.cachedReadTokens ?? 0,
|
|
158
|
-
cachedNonReadTokens: result.usage?.cachedNonReadTokens ?? 0,
|
|
159
|
-
turnCount: result.turns ?? 1,
|
|
160
|
-
// `result` comes from assembleRunResult which writes the turn cost to
|
|
161
|
-
// top-level `actualCostUSD` (not a `costUSD` field). Reading the wrong
|
|
162
|
-
// field name was the historical cause of rework stages recording
|
|
163
|
-
// cost=null/0 in telemetry; canonical lookup is `actualCostUSD` with
|
|
164
|
-
// legacy `costUSD` as a safety fallback.
|
|
165
|
-
costUSD: result.actualCostUSD ?? result.costUSD ?? null,
|
|
166
|
-
durationMs: result.durationMs ?? null,
|
|
167
|
-
filesWrittenCount: Array.isArray(result.filesWritten) ? result.filesWritten.length : 0,
|
|
168
|
-
}, {
|
|
169
|
-
tier: reworkTier,
|
|
170
|
-
model: ctx.providers[reworkTier]?.config?.model ?? null,
|
|
171
|
-
});
|
|
172
|
-
const payload = {
|
|
173
|
-
workerSelfAssessment: reworked.workerSelfAssessment === 'done' ? 'done' : 'failed',
|
|
174
|
-
summary: reworked.summary ?? '',
|
|
175
|
-
filesChanged: state.lastRunResult?.filesChanged ?? [],
|
|
176
|
-
unaddressedFindingIds: [],
|
|
177
|
-
parsedCleanly: reworked.parsedCleanly,
|
|
178
|
-
};
|
|
179
|
-
return {
|
|
180
|
-
outcome: 'advance',
|
|
181
|
-
payload,
|
|
182
|
-
telemetry: {
|
|
183
|
-
stageLabel: 'rework',
|
|
184
|
-
durationMs: Date.now() - t0,
|
|
185
|
-
costUSD: result.actualCostUSD ?? null,
|
|
186
|
-
turnsUsed: result.turns ?? 1,
|
|
187
|
-
stopReason: 'normal',
|
|
188
|
-
},
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
//# sourceMappingURL=rework-stage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rework-stage.js","sourceRoot":"","sources":["../../../src/lifecycle/handlers/rework-stage.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MAAM,CAAC,CAAC,CAAC,QAAQ;QAClF,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,EAAE;QAC/B,YAAY,EAAG,KAAK,CAAC,aAAyD,EAAE,YAAY,IAAI,EAAE;QAClG,qBAAqB,EAAE,EAAE;QACzB,aAAa,EAAE,QAAQ,CAAC,aAAa;KACtC,CAAC;IACF,OAAO;QACL,OAAO,EAAE,SAAS;QAClB,OAAO;QACP,SAAS,EAAE;YACT,UAAU,EAAE,QAAQ;YACpB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE;YAC3B,OAAO,EAAG,MAA4C,CAAC,aAAa,IAAI,IAAI;YAC5E,SAAS,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;YAC5B,UAAU,EAAE,QAAQ;SACrB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spec-review-prompt.d.ts","sourceRoot":"","sources":["../../../src/lifecycle/handlers/spec-review-prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,QA0BlB,CAAC;AAET,wBAAgB,gBAAgB,CAAC,GAAG,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAkB7H"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export const OUTPUT_FORMAT = `
|
|
2
|
-
## Verdict
|
|
3
|
-
approved | changes_required
|
|
4
|
-
|
|
5
|
-
## Findings
|
|
6
|
-
Emit zero or more findings using EXACTLY this block format. Each finding is its own block.
|
|
7
|
-
|
|
8
|
-
## Finding N: <one-line claim>
|
|
9
|
-
- Severity: critical | high | medium | low
|
|
10
|
-
- Category: <one word — e.g. missing-step, wrong-file, broken-contract>
|
|
11
|
-
- Evidence: <verbatim excerpt from source, ≥20 chars — or (none) if inferable>
|
|
12
|
-
- Suggestion: <one sentence — how to fix it>
|
|
13
|
-
|
|
14
|
-
## Finding N+1:
|
|
15
|
-
...
|
|
16
|
-
|
|
17
|
-
If no findings, write "## Findings\n(none)".
|
|
18
|
-
|
|
19
|
-
## Outcome
|
|
20
|
-
found | clean
|
|
21
|
-
|
|
22
|
-
**Severity definitions (per spec-review):**
|
|
23
|
-
- **critical:** Plan step missed/wrong such that feature won't work
|
|
24
|
-
- **high:** Plan step partially implemented
|
|
25
|
-
- **medium:** Diverges in non-essential ways
|
|
26
|
-
- **low:** Cosmetic drift
|
|
27
|
-
`.trim();
|
|
28
|
-
export function specReviewPrompt(ctx) {
|
|
29
|
-
const diffContent = ctx.diff && ctx.diff.trim() ? ctx.diff : '(no diff available)';
|
|
30
|
-
return `You are the spec reviewer for this task.
|
|
31
|
-
|
|
32
|
-
Brief: ${ctx.brief}
|
|
33
|
-
|
|
34
|
-
Worker said: ${ctx.workerSummary}
|
|
35
|
-
|
|
36
|
-
Files changed: ${ctx.filesChanged.join(', ') || '(none)'}
|
|
37
|
-
|
|
38
|
-
Diff (authoritative — what actually changed on disk):
|
|
39
|
-
${diffContent}
|
|
40
|
-
|
|
41
|
-
Guardrails:
|
|
42
|
-
- do NOT claim files missing/untracked — the diff is authoritative
|
|
43
|
-
- test status is in Worker said; don't infer skipped from diff
|
|
44
|
-
|
|
45
|
-
${OUTPUT_FORMAT}`;
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=spec-review-prompt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spec-review-prompt.js","sourceRoot":"","sources":["../../../src/lifecycle/handlers/spec-review-prompt.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B5B,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,UAAU,gBAAgB,CAAC,GAAoF;IACnH,MAAM,WAAW,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC;IACnF,OAAO;;SAEA,GAAG,CAAC,KAAK;;eAEH,GAAG,CAAC,aAAa;;iBAEf,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ;;;EAGtD,WAAW;;;;;;EAMX,aAAa,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { LifecycleState } from '../stage-plan-types.js';
|
|
2
|
-
import type { StageGate, TerminalPayload } from '../stage-io.js';
|
|
3
|
-
/**
|
|
4
|
-
* Terminal-stage handlers (#45 Step 6).
|
|
5
|
-
*
|
|
6
|
-
* Four StagePlan rows:
|
|
7
|
-
* - 5.3.5 register_terminal_block — registers a context block carrying
|
|
8
|
-
* the terminal RuntimeRunResult so /retry can reference the prior task's
|
|
9
|
-
* output.
|
|
10
|
-
* - 5.4 emit_task_terminal — emits the per-task terminal event
|
|
11
|
-
* (task_done_summary) through ctx.bus.
|
|
12
|
-
* - 5.5 persist_to_batch_registry — marks the per-task state in the
|
|
13
|
-
* batch registry.
|
|
14
|
-
* - 6.1 flush_telemetry — drains the telemetry queue so failure
|
|
15
|
-
* events are persisted before the per-task terminal stage exits.
|
|
16
|
-
*
|
|
17
|
-
* Each handler is idempotent on its state-slot guard:
|
|
18
|
-
* - state.contextBlockId
|
|
19
|
-
* - state.taskTerminalEmitted
|
|
20
|
-
* - state.batchRegistryPersisted
|
|
21
|
-
* - state.telemetryFlushed
|
|
22
|
-
*
|
|
23
|
-
* Defensive no-ops on missing state.executionContext or
|
|
24
|
-
* state.lastRunResult. All four rows are marked runOnTerminal in the
|
|
25
|
-
* StagePlan, so they fire even on hard-fail paths.
|
|
26
|
-
*/
|
|
27
|
-
export declare function registerTerminalBlockHandler(state: LifecycleState): void;
|
|
28
|
-
export declare function emitTaskTerminalHandler(state: LifecycleState): void;
|
|
29
|
-
export declare function persistToBatchRegistryHandler(state: LifecycleState): void;
|
|
30
|
-
/**
|
|
31
|
-
* Row 5.6 — record_task_completed → envelope.seal.
|
|
32
|
-
*
|
|
33
|
-
* Seals the per-task envelope to finalize all accumulated state and
|
|
34
|
-
* trigger telemetry upload via TelemetryUploader subscriber. Idempotent on
|
|
35
|
-
* state.taskCompletedRecorded. No-op when the server hasn't supplied an
|
|
36
|
-
* envelope (CLI/test paths).
|
|
37
|
-
*/
|
|
38
|
-
export declare function recordTaskCompletedHandler(state: LifecycleState): Promise<void>;
|
|
39
|
-
export declare function flushTelemetryHandler(state: LifecycleState): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* v5 unified `terminalHandler` — single entry point that runs the five
|
|
42
|
-
* terminal side effects in idempotency-safe order and returns the
|
|
43
|
-
* `StageGate<TerminalPayload>` the v5 driver expects.
|
|
44
|
-
*
|
|
45
|
-
* The five sub-handlers above are this function's building blocks: one per
|
|
46
|
-
* side effect, kept individually exported so each can be unit-tested in
|
|
47
|
-
* isolation (tests/lifecycle/handlers/terminal-handlers.test.ts) and so
|
|
48
|
-
* observability AC tests can exercise per-side-effect failures
|
|
49
|
-
* (tests/acceptance/stage-io-observability.test.ts). The unified
|
|
50
|
-
* `terminalHandler` is what STAGE_PLAN's `terminal` stage actually invokes;
|
|
51
|
-
* it sequences the five sub-handlers in idempotency-safe order and folds
|
|
52
|
-
* their state-slot guards into the TerminalPayload shape. Per spec §4.7 the side-effect map carries one
|
|
53
|
-
* boolean per side effect — true = succeeded at least once for this state
|
|
54
|
-
* instance; false = attempted-and-failed or never-attempted-because-context-
|
|
55
|
-
* missing.
|
|
56
|
-
*
|
|
57
|
-
* Idempotency: re-invocation MUST be safe and return the same payload (each
|
|
58
|
-
* sub-handler short-circuits on its state-slot guard, e.g. `state.contextBlockId`).
|
|
59
|
-
*/
|
|
60
|
-
export declare function terminalHandler(state: LifecycleState): Promise<StageGate<TerminalPayload>>;
|
|
61
|
-
//# sourceMappingURL=terminal-handlers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-handlers.d.ts","sourceRoot":"","sources":["../../../src/lifecycle/handlers/terminal-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAUjE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAyBxE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAUnE;AAMD,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAkBzE;AAED;;;;;;;GAOG;AACH,wBAAsB,0BAA0B,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA2ErF;AAoED,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBhF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAwDhG"}
|
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
import { findModelProfile } from '../../config/model-profile-registry.js';
|
|
2
|
-
import { getRealFilesChanged } from '../../bounded-execution/real-diff.js';
|
|
3
|
-
import { deriveCompletion, extractCompletionInputs } from '../derive-completion.js';
|
|
4
|
-
import { TerminalBlockRegistrar } from '../../reporting/terminal-block-registrar.js';
|
|
5
|
-
import { renderTerminalReportMarkdown } from '../../reporting/terminal-report-markdown.js';
|
|
6
|
-
import { WRITE_ROUTES } from '../stage-io.js';
|
|
7
|
-
import { findEscapedWrites } from '../file-confinement-check.js';
|
|
8
|
-
/**
|
|
9
|
-
* Terminal-stage handlers (#45 Step 6).
|
|
10
|
-
*
|
|
11
|
-
* Four StagePlan rows:
|
|
12
|
-
* - 5.3.5 register_terminal_block — registers a context block carrying
|
|
13
|
-
* the terminal RuntimeRunResult so /retry can reference the prior task's
|
|
14
|
-
* output.
|
|
15
|
-
* - 5.4 emit_task_terminal — emits the per-task terminal event
|
|
16
|
-
* (task_done_summary) through ctx.bus.
|
|
17
|
-
* - 5.5 persist_to_batch_registry — marks the per-task state in the
|
|
18
|
-
* batch registry.
|
|
19
|
-
* - 6.1 flush_telemetry — drains the telemetry queue so failure
|
|
20
|
-
* events are persisted before the per-task terminal stage exits.
|
|
21
|
-
*
|
|
22
|
-
* Each handler is idempotent on its state-slot guard:
|
|
23
|
-
* - state.contextBlockId
|
|
24
|
-
* - state.taskTerminalEmitted
|
|
25
|
-
* - state.batchRegistryPersisted
|
|
26
|
-
* - state.telemetryFlushed
|
|
27
|
-
*
|
|
28
|
-
* Defensive no-ops on missing state.executionContext or
|
|
29
|
-
* state.lastRunResult. All four rows are marked runOnTerminal in the
|
|
30
|
-
* StagePlan, so they fire even on hard-fail paths.
|
|
31
|
-
*/
|
|
32
|
-
export function registerTerminalBlockHandler(state) {
|
|
33
|
-
if (state.contextBlockId)
|
|
34
|
-
return;
|
|
35
|
-
const ctx = state.executionContext;
|
|
36
|
-
const envelope = ctx?.envelope;
|
|
37
|
-
const store = ctx?.contextBlockStore;
|
|
38
|
-
const registry = ctx?.batchRegistry;
|
|
39
|
-
if (!envelope || !store || !registry)
|
|
40
|
-
return;
|
|
41
|
-
const snap = envelope.snapshot();
|
|
42
|
-
// Write routes (delegate / execute-plan / retry) produce code + a commit;
|
|
43
|
-
// their durable record is the diff, not a prose block. No registration.
|
|
44
|
-
if (WRITE_ROUTES.includes(snap.route))
|
|
45
|
-
return;
|
|
46
|
-
try {
|
|
47
|
-
const markdown = renderTerminalReportMarkdown(snap);
|
|
48
|
-
const registrar = new TerminalBlockRegistrar(store, registry);
|
|
49
|
-
const id = registrar.register({
|
|
50
|
-
batchId: snap.batchId, taskIndex: snap.taskIndex, route: snap.route, markdown,
|
|
51
|
-
});
|
|
52
|
-
if (id)
|
|
53
|
-
state.contextBlockId = id;
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
// Best-effort: registration is advisory and must not block seal/flush/persist.
|
|
57
|
-
envelope.recordValidationWarning({
|
|
58
|
-
rule: 'TerminalBlockRegisterFailed',
|
|
59
|
-
path: `${snap.route}:${snap.batchId}:${snap.taskIndex}`,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export function emitTaskTerminalHandler(state) {
|
|
64
|
-
if (state.taskTerminalEmitted)
|
|
65
|
-
return;
|
|
66
|
-
const ctx = state.executionContext;
|
|
67
|
-
if (!ctx)
|
|
68
|
-
return;
|
|
69
|
-
// The old `task_completed` named event was replaced by the sealed-envelope
|
|
70
|
-
// snapshot push inside envelope.seal() (see recordTaskCompletedHandler); the
|
|
71
|
-
// TelemetryUploader subscriber picks up that snapshot and runs toWireRecord.
|
|
72
|
-
// No bus.emit happens here — the envelope IS the event. This handler now only
|
|
73
|
-
// marks the idempotency flag so re-runs are no-ops.
|
|
74
|
-
state.taskTerminalEmitted = true;
|
|
75
|
-
}
|
|
76
|
-
export function persistToBatchRegistryHandler(state) {
|
|
77
|
-
if (state.batchRegistryPersisted)
|
|
78
|
-
return;
|
|
79
|
-
const ctx = state.executionContext;
|
|
80
|
-
if (!ctx)
|
|
81
|
-
return;
|
|
82
|
-
const registry = ctx.batchRegistry;
|
|
83
|
-
if (!registry || typeof registry.complete !== 'function') {
|
|
84
|
-
state.batchRegistryPersisted = true; // structural ack
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
registry.complete(ctx.taskIndex, state.lastRunResult);
|
|
89
|
-
}
|
|
90
|
-
catch {
|
|
91
|
-
// Persistence failure is non-fatal at the per-task boundary; retention
|
|
92
|
-
// sweep (row 6.3) reconciles via timer.
|
|
93
|
-
}
|
|
94
|
-
state.batchRegistryPersisted = true;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Row 5.6 — record_task_completed → envelope.seal.
|
|
98
|
-
*
|
|
99
|
-
* Seals the per-task envelope to finalize all accumulated state and
|
|
100
|
-
* trigger telemetry upload via TelemetryUploader subscriber. Idempotent on
|
|
101
|
-
* state.taskCompletedRecorded. No-op when the server hasn't supplied an
|
|
102
|
-
* envelope (CLI/test paths).
|
|
103
|
-
*/
|
|
104
|
-
export async function recordTaskCompletedHandler(state) {
|
|
105
|
-
if (state.taskCompletedRecorded)
|
|
106
|
-
return;
|
|
107
|
-
const ctx = state.executionContext;
|
|
108
|
-
if (!ctx)
|
|
109
|
-
return;
|
|
110
|
-
const envelope = ctx.envelope;
|
|
111
|
-
if (!envelope) {
|
|
112
|
-
state.taskCompletedRecorded = true;
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const real = await getRealFilesChanged(state);
|
|
116
|
-
const last = state.lastRunResult;
|
|
117
|
-
if (real.source === 'git_error') {
|
|
118
|
-
envelope.recordValidationWarning({ rule: 'GitDiffUnavailable', path: 'realFilesChanged' });
|
|
119
|
-
}
|
|
120
|
-
const completionInputs = extractCompletionInputs(state);
|
|
121
|
-
// Use deriveCompletion when implement gate is populated. commitKind being
|
|
122
|
-
// undefined is legitimate (read routes have no commit stage) — deriveCompletion
|
|
123
|
-
// handles those branches internally. Only fall back to workerStatus when the
|
|
124
|
-
// implement gate itself is missing (lifecycle never started, brief_too_vague paths).
|
|
125
|
-
const hasGateInputs = completionInputs.implementOutcome !== undefined;
|
|
126
|
-
let sealStatus;
|
|
127
|
-
if (hasGateInputs) {
|
|
128
|
-
const { completed } = deriveCompletion(completionInputs);
|
|
129
|
-
const hasConcerns = (state.executionContext?.envelope?.snapshot()?.findings ?? []).length > 0;
|
|
130
|
-
sealStatus = completed ? (hasConcerns ? 'done_with_concerns' : 'done') : 'failed';
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
// Fallback only when implement gate is missing entirely (brief_too_vague etc.)
|
|
134
|
-
const ws = (state.workerStatus ?? last?.workerStatus);
|
|
135
|
-
sealStatus = ws === 'done' ? 'done' : ws === 'done_with_concerns' ? 'done_with_concerns' : 'failed';
|
|
136
|
-
}
|
|
137
|
-
// Commit outcome (authoritative, from the commit gate) — computed BEFORE the
|
|
138
|
-
// confinement guard so it can corroborate the worker's self-reported writes.
|
|
139
|
-
// Carried onto the envelope below so the response's structuredReport surfaces
|
|
140
|
-
// the real SHA/message (the response is built from envelope snapshots).
|
|
141
|
-
const commitGate = state.gates?.['commit'];
|
|
142
|
-
const commitPayload = (commitGate?.outcome === 'advance' ? commitGate.payload : null);
|
|
143
|
-
const didCommit = commitPayload?.kind === 'committed';
|
|
144
|
-
// Confinement guard: a worker must only write under its dispatched cwd. A
|
|
145
|
-
// reported write that escaped (e.g. into a sibling git worktree / the daemon's
|
|
146
|
-
// startup cwd) is a real mislocation. BUT the worker-reported filesWritten
|
|
147
|
-
// string is unreliable — LLM workers routinely report normalized/relative/
|
|
148
|
-
// hallucinated absolute paths (e.g. "/repo/src/x.ts" or "/workspace/src/x.ts")
|
|
149
|
-
// for a file actually written under the dispatched cwd. So hard-fail ONLY when
|
|
150
|
-
// the worker claims an escaped write AND no commit landed in cwd (didCommit =
|
|
151
|
-
// false → the write is not in this repo → it genuinely wrote elsewhere). When a
|
|
152
|
-
// commit DID land in cwd, the self-reported path is a hallucination — record an
|
|
153
|
-
// advisory warning rather than failing a legitimate, committed task on an
|
|
154
|
-
// unreliable self-report string. (The git commit is the authoritative signal.)
|
|
155
|
-
let escapeErrorCode = null;
|
|
156
|
-
const escaped = findEscapedWrites(last?.filesWritten ?? [], ctx.cwd);
|
|
157
|
-
if (escaped.length > 0) {
|
|
158
|
-
envelope.recordValidationWarning({ rule: 'WorkerWriteEscapedCwd', path: escaped.join(', ') });
|
|
159
|
-
if (!didCommit) {
|
|
160
|
-
sealStatus = 'failed';
|
|
161
|
-
escapeErrorCode = 'tool_sandbox_cwd_violation';
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
envelope.seal({
|
|
165
|
-
status: sealStatus,
|
|
166
|
-
terminalAt: new Date().toISOString(),
|
|
167
|
-
stopReason: last?.terminationReason?.cause ?? null,
|
|
168
|
-
structuredError: last?.structuredError ?? null,
|
|
169
|
-
errorCode: escapeErrorCode ?? last?.errorCode ?? null,
|
|
170
|
-
realFilesChanged: real.files,
|
|
171
|
-
commitSha: didCommit ? (commitPayload?.commitSha ?? null) : null,
|
|
172
|
-
commitMessage: didCommit ? (commitPayload?.commitMessage ?? null) : null,
|
|
173
|
-
commitSkipReason: commitPayload?.kind === 'no_op' ? (commitPayload?.reason ?? null) : null,
|
|
174
|
-
contextBlockId: state.contextBlockId ?? null,
|
|
175
|
-
});
|
|
176
|
-
state.taskCompletedRecorded = true;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Synthesize an `implementing` stage entry from top-level RuntimeRunResult fields
|
|
180
|
-
* when the per-stage tracker hasn't populated it. Without this, the wire
|
|
181
|
-
* event ships with `stages: []` for every task, which violates the backend's
|
|
182
|
-
* R2.1 invariant ("empty stages only allowed for brief_too_vague|error")
|
|
183
|
-
* for any task that succeeded — every upload would 400.
|
|
184
|
-
*
|
|
185
|
-
* This is a fallback; it does not replace stats already populated by the
|
|
186
|
-
* runner-shell or lifecycle stage tracker.
|
|
187
|
-
*/
|
|
188
|
-
function ensureImplementingStage(rr, ctx) {
|
|
189
|
-
// Even when no LLM call ever fires (runner_crash, all_tiers_unavailable,
|
|
190
|
-
// dispatcher-no-result), the configured implementer model is known up
|
|
191
|
-
// front via ctx.implementerProvider.config. Stamp it into the synthesized
|
|
192
|
-
// stage and the top-level rr.models so the wire row reports the *intended*
|
|
193
|
-
// model instead of the literal 'custom' fallback in event-builder.
|
|
194
|
-
const fallbackModel = ctx.implementerProvider?.config?.model ?? null;
|
|
195
|
-
const fallbackFamily = fallbackModel ? findModelProfile(fallbackModel).family : null;
|
|
196
|
-
if (rr.models === undefined && fallbackModel !== null) {
|
|
197
|
-
rr.models = {
|
|
198
|
-
implementer: fallbackModel,
|
|
199
|
-
specReviewer: undefined,
|
|
200
|
-
qualityReviewer: undefined,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
const existing = (rr.stageStats?.implementing);
|
|
204
|
-
if (existing?.entered)
|
|
205
|
-
return;
|
|
206
|
-
const usage = rr.usage ?? { inputTokens: 0, outputTokens: 0, cachedReadTokens: 0, cachedNonReadTokens: 0 };
|
|
207
|
-
const synthesized = {
|
|
208
|
-
stage: 'implementing',
|
|
209
|
-
entered: true,
|
|
210
|
-
durationMs: rr.durationMs ?? 0,
|
|
211
|
-
costUSD: rr.cost?.costUSD ?? null,
|
|
212
|
-
agentTier: ctx.assignedTier ?? 'standard',
|
|
213
|
-
modelFamily: fallbackFamily,
|
|
214
|
-
model: fallbackModel,
|
|
215
|
-
maxIdleMs: 0,
|
|
216
|
-
totalIdleMs: 0,
|
|
217
|
-
activityEvents: 0,
|
|
218
|
-
inputTokens: usage.inputTokens ?? 0,
|
|
219
|
-
outputTokens: usage.outputTokens ?? 0,
|
|
220
|
-
cachedReadTokens: usage.cachedReadTokens ?? 0,
|
|
221
|
-
cachedNonReadTokens: usage.cachedNonReadTokens ?? 0,
|
|
222
|
-
turnCount: rr.turns ?? 0,
|
|
223
|
-
filesWrittenCount: Array.isArray(rr.filesWritten) ? rr.filesWritten.length : 0,
|
|
224
|
-
directoriesListed: 0,
|
|
225
|
-
};
|
|
226
|
-
rr.stageStats = {
|
|
227
|
-
...(rr.stageStats ?? {}),
|
|
228
|
-
implementing: synthesized,
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
export async function flushTelemetryHandler(state) {
|
|
232
|
-
if (state.telemetryFlushed)
|
|
233
|
-
return;
|
|
234
|
-
const ctx = state.executionContext;
|
|
235
|
-
if (!ctx)
|
|
236
|
-
return;
|
|
237
|
-
const recorder = ctx.recorder;
|
|
238
|
-
if (!recorder || typeof recorder.flush !== 'function') {
|
|
239
|
-
state.telemetryFlushed = true;
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
try {
|
|
243
|
-
await recorder.flush();
|
|
244
|
-
}
|
|
245
|
-
catch {
|
|
246
|
-
// Telemetry flush is best-effort; the recorder retains in-memory queue
|
|
247
|
-
// for the next opportunity.
|
|
248
|
-
}
|
|
249
|
-
state.telemetryFlushed = true;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* v5 unified `terminalHandler` — single entry point that runs the five
|
|
253
|
-
* terminal side effects in idempotency-safe order and returns the
|
|
254
|
-
* `StageGate<TerminalPayload>` the v5 driver expects.
|
|
255
|
-
*
|
|
256
|
-
* The five sub-handlers above are this function's building blocks: one per
|
|
257
|
-
* side effect, kept individually exported so each can be unit-tested in
|
|
258
|
-
* isolation (tests/lifecycle/handlers/terminal-handlers.test.ts) and so
|
|
259
|
-
* observability AC tests can exercise per-side-effect failures
|
|
260
|
-
* (tests/acceptance/stage-io-observability.test.ts). The unified
|
|
261
|
-
* `terminalHandler` is what STAGE_PLAN's `terminal` stage actually invokes;
|
|
262
|
-
* it sequences the five sub-handlers in idempotency-safe order and folds
|
|
263
|
-
* their state-slot guards into the TerminalPayload shape. Per spec §4.7 the side-effect map carries one
|
|
264
|
-
* boolean per side effect — true = succeeded at least once for this state
|
|
265
|
-
* instance; false = attempted-and-failed or never-attempted-because-context-
|
|
266
|
-
* missing.
|
|
267
|
-
*
|
|
268
|
-
* Idempotency: re-invocation MUST be safe and return the same payload (each
|
|
269
|
-
* sub-handler short-circuits on its state-slot guard, e.g. `state.contextBlockId`).
|
|
270
|
-
*/
|
|
271
|
-
export async function terminalHandler(state) {
|
|
272
|
-
const t0 = Date.now();
|
|
273
|
-
const flags = {
|
|
274
|
-
contextBlockId: null,
|
|
275
|
-
telemetryFlushed: false,
|
|
276
|
-
batchRegistryPersisted: false,
|
|
277
|
-
taskTerminalEmitted: false,
|
|
278
|
-
projectCleanupTicked: false,
|
|
279
|
-
};
|
|
280
|
-
try {
|
|
281
|
-
registerTerminalBlockHandler(state);
|
|
282
|
-
flags.contextBlockId = state.contextBlockId ?? null;
|
|
283
|
-
}
|
|
284
|
-
catch {
|
|
285
|
-
/* leave null on failure */
|
|
286
|
-
}
|
|
287
|
-
try {
|
|
288
|
-
await flushTelemetryHandler(state);
|
|
289
|
-
flags.telemetryFlushed = state.telemetryFlushed === true;
|
|
290
|
-
}
|
|
291
|
-
catch {
|
|
292
|
-
/* leave false */
|
|
293
|
-
}
|
|
294
|
-
try {
|
|
295
|
-
persistToBatchRegistryHandler(state);
|
|
296
|
-
flags.batchRegistryPersisted = state.batchRegistryPersisted === true;
|
|
297
|
-
}
|
|
298
|
-
catch {
|
|
299
|
-
/* leave false */
|
|
300
|
-
}
|
|
301
|
-
try {
|
|
302
|
-
emitTaskTerminalHandler(state);
|
|
303
|
-
flags.taskTerminalEmitted = state.taskTerminalEmitted === true;
|
|
304
|
-
}
|
|
305
|
-
catch {
|
|
306
|
-
/* leave false */
|
|
307
|
-
}
|
|
308
|
-
try {
|
|
309
|
-
await recordTaskCompletedHandler(state);
|
|
310
|
-
flags.projectCleanupTicked = true; // record-completed doubles as project activity tick
|
|
311
|
-
}
|
|
312
|
-
catch {
|
|
313
|
-
/* leave false */
|
|
314
|
-
}
|
|
315
|
-
return {
|
|
316
|
-
outcome: 'advance',
|
|
317
|
-
payload: flags,
|
|
318
|
-
telemetry: {
|
|
319
|
-
stageLabel: 'terminal',
|
|
320
|
-
durationMs: Date.now() - t0,
|
|
321
|
-
costUSD: 0,
|
|
322
|
-
turnsUsed: 0,
|
|
323
|
-
stopReason: 'normal',
|
|
324
|
-
},
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
//# sourceMappingURL=terminal-handlers.js.map
|