okstra 0.174.0 → 0.175.1
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/README.md +18 -9
- package/bin/okstra +8 -4
- package/dist/cli-registry.d.mts +16 -0
- package/dist/cli-registry.mjs +560 -0
- package/dist/cli-registry.mjs.map +1 -0
- package/dist/commands/execute/agent-prompt.d.mts +1 -0
- package/{src → dist}/commands/execute/agent-prompt.mjs +10 -11
- package/dist/commands/execute/agent-prompt.mjs.map +1 -0
- package/dist/commands/execute/codex-dispatch.d.mts +3 -0
- package/dist/commands/execute/codex-dispatch.mjs +6 -0
- package/dist/commands/execute/codex-dispatch.mjs.map +1 -0
- package/dist/commands/execute/codex-run.d.mts +3 -0
- package/{src → dist}/commands/execute/codex-run.mjs +30 -37
- package/dist/commands/execute/codex-run.mjs.map +1 -0
- package/dist/commands/execute/convergence.d.mts +1 -0
- package/{src → dist}/commands/execute/convergence.mjs +15 -16
- package/dist/commands/execute/convergence.mjs.map +1 -0
- package/dist/commands/execute/error-log.d.mts +1 -0
- package/{src → dist}/commands/execute/error-log.mjs +2 -3
- package/dist/commands/execute/error-log.mjs.map +1 -0
- package/dist/commands/execute/git-reconcile.d.mts +1 -0
- package/{src → dist}/commands/execute/git-reconcile.mjs +10 -11
- package/dist/commands/execute/git-reconcile.mjs.map +1 -0
- package/dist/commands/execute/handoff.d.mts +1 -0
- package/{src → dist}/commands/execute/handoff.mjs +10 -11
- package/dist/commands/execute/handoff.mjs.map +1 -0
- package/dist/commands/execute/incremental-carry.d.mts +1 -0
- package/{src → dist}/commands/execute/incremental-carry.mjs +2 -3
- package/dist/commands/execute/incremental-carry.mjs.map +1 -0
- package/dist/commands/execute/incremental-scope.d.mts +1 -0
- package/{src → dist}/commands/execute/incremental-scope.mjs +2 -3
- package/dist/commands/execute/incremental-scope.mjs.map +1 -0
- package/dist/commands/execute/integrate-stages.d.mts +1 -0
- package/{src → dist}/commands/execute/integrate-stages.mjs +10 -11
- package/dist/commands/execute/integrate-stages.mjs.map +1 -0
- package/dist/commands/execute/pane-title.d.mts +1 -0
- package/dist/commands/execute/pane-title.mjs +20 -0
- package/dist/commands/execute/pane-title.mjs.map +1 -0
- package/dist/commands/execute/plan-items.d.mts +1 -0
- package/dist/commands/execute/plan-items.mjs +9 -0
- package/dist/commands/execute/plan-items.mjs.map +1 -0
- package/dist/commands/execute/plan-validate.d.mts +1 -0
- package/dist/commands/execute/plan-validate.mjs +68 -0
- package/dist/commands/execute/plan-validate.mjs.map +1 -0
- package/dist/commands/execute/plan-verify.d.mts +1 -0
- package/{src → dist}/commands/execute/plan-verify.mjs +13 -16
- package/dist/commands/execute/plan-verify.mjs.map +1 -0
- package/dist/commands/execute/render-bundle.d.mts +3 -0
- package/{src → dist}/commands/execute/render-bundle.mjs +65 -61
- package/dist/commands/execute/render-bundle.mjs.map +1 -0
- package/dist/commands/execute/run.d.mts +24 -0
- package/dist/commands/execute/run.mjs +196 -0
- package/dist/commands/execute/run.mjs.map +1 -0
- package/dist/commands/execute/spawn-followups.d.mts +1 -0
- package/{src → dist}/commands/execute/spawn-followups.mjs +6 -7
- package/dist/commands/execute/spawn-followups.mjs.map +1 -0
- package/dist/commands/execute/team.d.mts +3 -0
- package/{src → dist}/commands/execute/team.mjs +29 -36
- package/dist/commands/execute/team.mjs.map +1 -0
- package/dist/commands/execute/token-usage.d.mts +1 -0
- package/{src → dist}/commands/execute/token-usage.mjs +2 -3
- package/dist/commands/execute/token-usage.mjs.map +1 -0
- package/dist/commands/execute/wizard.d.mts +8 -0
- package/dist/commands/execute/wizard.mjs +191 -0
- package/dist/commands/execute/wizard.mjs.map +1 -0
- package/dist/commands/execute/worker-audit-check.d.mts +1 -0
- package/{src → dist}/commands/execute/worker-audit-check.mjs +11 -12
- package/dist/commands/execute/worker-audit-check.mjs.map +1 -0
- package/dist/commands/execute/worker-dispatch.d.mts +7 -0
- package/{src → dist}/commands/execute/worker-dispatch.mjs +34 -46
- package/dist/commands/execute/worker-dispatch.mjs.map +1 -0
- package/dist/commands/execute/worker-state.d.mts +1 -0
- package/{src → dist}/commands/execute/worker-state.mjs +15 -16
- package/dist/commands/execute/worker-state.mjs.map +1 -0
- package/dist/commands/execute/worktree-lookup.d.mts +1 -0
- package/{src → dist}/commands/execute/worktree-lookup.mjs +38 -37
- package/dist/commands/execute/worktree-lookup.mjs.map +1 -0
- package/dist/commands/execute/worktree-status.d.mts +1 -0
- package/{src → dist}/commands/execute/worktree-status.mjs +52 -46
- package/dist/commands/execute/worktree-status.mjs.map +1 -0
- package/dist/commands/inspect/code-review.d.mts +1 -0
- package/{src → dist}/commands/inspect/code-review.mjs +16 -19
- package/dist/commands/inspect/code-review.mjs.map +1 -0
- package/dist/commands/inspect/container.d.mts +1 -0
- package/{src → dist}/commands/inspect/container.mjs +11 -13
- package/dist/commands/inspect/container.mjs.map +1 -0
- package/dist/commands/inspect/context-cost.d.mts +1 -0
- package/{src → dist}/commands/inspect/context-cost.mjs +11 -13
- package/dist/commands/inspect/context-cost.mjs.map +1 -0
- package/dist/commands/inspect/design-prep.d.mts +1 -0
- package/{src → dist}/commands/inspect/design-prep.mjs +10 -11
- package/dist/commands/inspect/design-prep.mjs.map +1 -0
- package/dist/commands/inspect/error-report.d.mts +1 -0
- package/{src → dist}/commands/inspect/error-report.mjs +11 -13
- package/dist/commands/inspect/error-report.mjs.map +1 -0
- package/dist/commands/inspect/error-zip.d.mts +1 -0
- package/{src → dist}/commands/inspect/error-zip.mjs +11 -12
- package/dist/commands/inspect/error-zip.mjs.map +1 -0
- package/dist/commands/inspect/log-report.d.mts +1 -0
- package/{src → dist}/commands/inspect/log-report.mjs +11 -13
- package/dist/commands/inspect/log-report.mjs.map +1 -0
- package/dist/commands/inspect/profile-show.d.mts +1 -0
- package/{src → dist}/commands/inspect/profile-show.mjs +10 -11
- package/dist/commands/inspect/profile-show.mjs.map +1 -0
- package/dist/commands/inspect/recap.d.mts +1 -0
- package/{src → dist}/commands/inspect/recap.mjs +11 -13
- package/dist/commands/inspect/recap.mjs.map +1 -0
- package/dist/commands/inspect/resolve-task-key.d.mts +1 -0
- package/{src → dist}/commands/inspect/resolve-task-key.mjs +11 -13
- package/dist/commands/inspect/resolve-task-key.mjs.map +1 -0
- package/dist/commands/inspect/rollup.d.mts +1 -0
- package/{src → dist}/commands/inspect/rollup.mjs +11 -13
- package/dist/commands/inspect/rollup.mjs.map +1 -0
- package/dist/commands/inspect/run-audit.d.mts +1 -0
- package/{src → dist}/commands/inspect/run-audit.mjs +11 -12
- package/dist/commands/inspect/run-audit.mjs.map +1 -0
- package/dist/commands/inspect/set-work-status.d.mts +1 -0
- package/{src → dist}/commands/inspect/set-work-status.mjs +11 -13
- package/dist/commands/inspect/set-work-status.mjs.map +1 -0
- package/dist/commands/inspect/stage-map.d.mts +1 -0
- package/dist/commands/inspect/stage-map.mjs +110 -0
- package/dist/commands/inspect/stage-map.mjs.map +1 -0
- package/dist/commands/inspect/task-list.d.mts +1 -0
- package/dist/commands/inspect/task-list.mjs +103 -0
- package/dist/commands/inspect/task-list.mjs.map +1 -0
- package/dist/commands/inspect/task-show.d.mts +1 -0
- package/dist/commands/inspect/task-show.mjs +108 -0
- package/dist/commands/inspect/task-show.mjs.map +1 -0
- package/dist/commands/inspect/time-report.d.mts +1 -0
- package/{src → dist}/commands/inspect/time-report.mjs +11 -13
- package/dist/commands/inspect/time-report.mjs.map +1 -0
- package/dist/commands/inspect/usage-report.d.mts +1 -0
- package/{src → dist}/commands/inspect/usage-report.mjs +11 -13
- package/dist/commands/inspect/usage-report.mjs.map +1 -0
- package/dist/commands/inspect/user-response.d.mts +1 -0
- package/{src → dist}/commands/inspect/user-response.mjs +10 -11
- package/dist/commands/inspect/user-response.mjs.map +1 -0
- package/dist/commands/inspect/worker-liveness.d.mts +1 -0
- package/{src → dist}/commands/inspect/worker-liveness.mjs +11 -13
- package/dist/commands/inspect/worker-liveness.mjs.map +1 -0
- package/dist/commands/lifecycle/check-project.d.mts +21 -0
- package/dist/commands/lifecycle/check-project.mjs +175 -0
- package/dist/commands/lifecycle/check-project.mjs.map +1 -0
- package/dist/commands/lifecycle/config.d.mts +1 -0
- package/dist/commands/lifecycle/config.mjs +369 -0
- package/dist/commands/lifecycle/config.mjs.map +1 -0
- package/dist/commands/lifecycle/doctor.d.mts +10 -0
- package/dist/commands/lifecycle/doctor.mjs +317 -0
- package/dist/commands/lifecycle/doctor.mjs.map +1 -0
- package/dist/commands/lifecycle/install.d.mts +17 -0
- package/dist/commands/lifecycle/install.mjs +1077 -0
- package/dist/commands/lifecycle/install.mjs.map +1 -0
- package/dist/commands/lifecycle/migrate.d.mts +1 -0
- package/{src → dist}/commands/lifecycle/migrate.mjs +10 -11
- package/dist/commands/lifecycle/migrate.mjs.map +1 -0
- package/dist/commands/lifecycle/model.d.mts +1 -0
- package/dist/commands/lifecycle/model.mjs +22 -0
- package/dist/commands/lifecycle/model.mjs.map +1 -0
- package/dist/commands/lifecycle/paths.d.mts +1 -0
- package/dist/commands/lifecycle/paths.mjs +102 -0
- package/dist/commands/lifecycle/paths.mjs.map +1 -0
- package/dist/commands/lifecycle/preflight.d.mts +1 -0
- package/dist/commands/lifecycle/preflight.mjs +124 -0
- package/dist/commands/lifecycle/preflight.mjs.map +1 -0
- package/dist/commands/lifecycle/setup.d.mts +1 -0
- package/dist/commands/lifecycle/setup.mjs +297 -0
- package/dist/commands/lifecycle/setup.mjs.map +1 -0
- package/dist/commands/lifecycle/uninstall.d.mts +4 -0
- package/dist/commands/lifecycle/uninstall.mjs +262 -0
- package/dist/commands/lifecycle/uninstall.mjs.map +1 -0
- package/dist/commands/manager.d.mts +3 -0
- package/{src → dist}/commands/manager.mjs +25 -32
- package/dist/commands/manager.mjs.map +1 -0
- package/dist/commands/memory/memory.d.mts +1 -0
- package/dist/commands/memory/memory.mjs +569 -0
- package/dist/commands/memory/memory.mjs.map +1 -0
- package/dist/commands/pr/pr.d.mts +33 -0
- package/dist/commands/pr/pr.mjs +296 -0
- package/dist/commands/pr/pr.mjs.map +1 -0
- package/dist/commands/report/agent-activity.d.mts +1 -0
- package/{src → dist}/commands/report/agent-activity.mjs +11 -12
- package/dist/commands/report/agent-activity.mjs.map +1 -0
- package/dist/commands/report/finalize.d.mts +4 -0
- package/{src → dist}/commands/report/finalize.mjs +25 -32
- package/dist/commands/report/finalize.mjs.map +1 -0
- package/dist/commands/report/inject-report-index.d.mts +1 -0
- package/{src → dist}/commands/report/inject-report-index.mjs +6 -7
- package/dist/commands/report/inject-report-index.mjs.map +1 -0
- package/dist/commands/report/render-final-report.d.mts +1 -0
- package/{src → dist}/commands/report/render-final-report.mjs +6 -7
- package/dist/commands/report/render-final-report.mjs.map +1 -0
- package/dist/commands/report/render-views.d.mts +1 -0
- package/{src → dist}/commands/report/render-views.mjs +6 -7
- package/dist/commands/report/render-views.mjs.map +1 -0
- package/dist/commands/report/translate.d.mts +1 -0
- package/{src → dist}/commands/report/translate.mjs +6 -7
- package/dist/commands/report/translate.mjs.map +1 -0
- package/dist/lib/helper-scripts.d.mts +3 -0
- package/{src → dist}/lib/helper-scripts.mjs +11 -14
- package/dist/lib/helper-scripts.mjs.map +1 -0
- package/dist/lib/host-registry-client.d.mts +25 -0
- package/dist/lib/host-registry-client.mjs +152 -0
- package/dist/lib/host-registry-client.mjs.map +1 -0
- package/dist/lib/install-assets.d.mts +8 -0
- package/{src → dist}/lib/install-assets.mjs +17 -20
- package/dist/lib/install-assets.mjs.map +1 -0
- package/dist/lib/okstra-dirs.d.mts +4 -0
- package/{src → dist}/lib/okstra-dirs.mjs +3 -6
- package/dist/lib/okstra-dirs.mjs.map +1 -0
- package/dist/lib/paths.d.mts +4 -0
- package/dist/lib/paths.mjs +78 -0
- package/dist/lib/paths.mjs.map +1 -0
- package/dist/lib/proc.d.mts +3 -0
- package/dist/lib/proc.mjs +31 -0
- package/dist/lib/proc.mjs.map +1 -0
- package/dist/lib/python-helper.d.mts +8 -0
- package/dist/lib/python-helper.mjs +123 -0
- package/dist/lib/python-helper.mjs.map +1 -0
- package/dist/lib/runtime-manifest.d.mts +7 -0
- package/dist/lib/runtime-manifest.mjs +73 -0
- package/dist/lib/runtime-manifest.mjs.map +1 -0
- package/dist/lib/skill-catalog.d.mts +4 -0
- package/dist/lib/skill-catalog.mjs +50 -0
- package/dist/lib/skill-catalog.mjs.map +1 -0
- package/dist/lib/types.d.mts +129 -0
- package/dist/lib/types.mjs +2 -0
- package/dist/lib/types.mjs.map +1 -0
- package/dist/lib/version.d.mts +2 -0
- package/dist/lib/version.mjs +27 -0
- package/dist/lib/version.mjs.map +1 -0
- package/docs/architecture/storage-model.md +4 -0
- package/docs/architecture.md +7 -1
- package/docs/cli.md +26 -6
- package/docs/contributor-change-matrix.md +2 -2
- package/docs/project-structure-overview.md +16 -7
- package/docs/task-process/README.md +2 -0
- package/docs/task-process/implementation-planning.md +1 -1
- package/docs/task-process/implementation.md +1 -1
- package/package.json +11 -5
- package/runtime/BUILD.json +2 -2
- package/runtime/agents/workers/claude-worker.md +2 -1
- package/runtime/agents/workers/report-writer-worker.md +3 -1
- package/runtime/agents/workers/translator-worker.md +3 -1
- package/runtime/bin/lib/okstra/cli.sh +12 -0
- package/runtime/bin/lib/okstra/globals.sh +3 -0
- package/runtime/bin/lib/okstra/usage.sh +4 -4
- package/runtime/bin/okstra-error-log.py +27 -0
- package/runtime/bin/okstra-provider-exec.py +217 -5
- package/runtime/bin/okstra.sh +10 -0
- package/runtime/prompts/lead/convergence.md +27 -18
- package/runtime/prompts/lead/okstra-lead-contract.md +3 -1
- package/runtime/prompts/lead/plan-body-verification.md +10 -3
- package/runtime/prompts/lead/team-contract.md +1 -1
- package/runtime/prompts/profiles/change-impact-analysis.md +16 -0
- package/runtime/prompts/profiles/error-analysis.md +20 -0
- package/runtime/prompts/profiles/feature-analysis.md +16 -0
- package/runtime/prompts/profiles/final-verification.md +16 -0
- package/runtime/prompts/profiles/implementation-option-selection.md +16 -0
- package/runtime/prompts/profiles/implementation-planning.md +20 -0
- package/runtime/prompts/profiles/implementation.md +15 -0
- package/runtime/prompts/profiles/improvement-discovery.md +16 -0
- package/runtime/prompts/profiles/project-analysis.md +16 -0
- package/runtime/prompts/profiles/release-handoff.md +4 -0
- package/runtime/prompts/profiles/requirements-discovery.md +20 -0
- package/runtime/prompts/wizard/prompts.ko.json +18 -0
- package/runtime/python/okstra_ctl/adapters/dispatch/cli_wrapper.py +8 -0
- package/runtime/python/okstra_ctl/adapters/dispatch/cmux.py +8 -0
- package/runtime/python/okstra_ctl/adapters/dispatch/native_team.py +13 -0
- package/runtime/python/okstra_ctl/adapters/hosts/antigravity/adapter.py +2 -2
- package/runtime/python/okstra_ctl/adapters/hosts/claude-code/adapter.py +25 -5
- package/runtime/python/okstra_ctl/adapters/hosts/codex/adapter.py +2 -2
- package/runtime/python/okstra_ctl/adapters/hosts/external/adapter.py +4 -1
- package/runtime/python/okstra_ctl/adapters/hosts/grok/adapter.py +2 -2
- package/runtime/python/okstra_ctl/adapters/hosts/kimi/adapter.py +2 -2
- package/runtime/python/okstra_ctl/adapters/providers/antigravity/adapter.py +79 -11
- package/runtime/python/okstra_ctl/adapters/providers/claude/adapter.py +95 -25
- package/runtime/python/okstra_ctl/adapters/providers/codex/adapter.py +59 -14
- package/runtime/python/okstra_ctl/adapters/providers/grok/adapter.py +55 -9
- package/runtime/python/okstra_ctl/adapters/providers/kimi/adapter.py +51 -12
- package/runtime/python/okstra_ctl/agent_activity.py +5 -1
- package/runtime/python/okstra_ctl/agent_invocation.py +608 -14
- package/runtime/python/okstra_ctl/agent_prompt_cli.py +249 -50
- package/runtime/python/okstra_ctl/application/resolve_assignment.py +53 -12
- package/runtime/python/okstra_ctl/assignment_environment.py +102 -0
- package/runtime/python/okstra_ctl/assignment_resolver.py +790 -0
- package/runtime/python/okstra_ctl/attempt_evidence.py +342 -0
- package/runtime/python/okstra_ctl/convergence.py +409 -3
- package/runtime/python/okstra_ctl/convergence_engine.py +248 -15
- package/runtime/python/okstra_ctl/convergence_store.py +170 -1
- package/runtime/python/okstra_ctl/dispatch_core.py +1092 -63
- package/runtime/python/okstra_ctl/dispatch_state.py +696 -11
- package/runtime/python/okstra_ctl/doctor.py +14 -0
- package/runtime/python/okstra_ctl/domain/host.py +32 -1
- package/runtime/python/okstra_ctl/domain/provider.py +212 -6
- package/runtime/python/okstra_ctl/domain/role.py +125 -0
- package/runtime/python/okstra_ctl/domain/wizard/interaction.py +13 -0
- package/runtime/python/okstra_ctl/domain/worker_exec.py +34 -1
- package/runtime/python/okstra_ctl/domain/worker_role.py +13 -3
- package/runtime/python/okstra_ctl/domain/worker_stream.py +24 -0
- package/runtime/python/okstra_ctl/error_log_write.py +9 -0
- package/runtime/python/okstra_ctl/error_report.py +21 -1
- package/runtime/python/okstra_ctl/execution_identity.py +529 -0
- package/runtime/python/okstra_ctl/execution_manifest.py +1281 -0
- package/runtime/python/okstra_ctl/execution_mutation_audit.py +619 -0
- package/runtime/python/okstra_ctl/index.py +6 -2
- package/runtime/python/okstra_ctl/initial_prompt_materialization.py +43 -3
- package/runtime/python/okstra_ctl/legacy_model_selection.py +490 -0
- package/runtime/python/okstra_ctl/model_cli.py +278 -0
- package/runtime/python/okstra_ctl/model_defaults.py +46 -0
- package/runtime/python/okstra_ctl/model_discovery.py +26 -7
- package/runtime/python/okstra_ctl/model_pool.py +501 -0
- package/runtime/python/okstra_ctl/models.py +47 -27
- package/runtime/python/okstra_ctl/mutation_recovery.py +293 -0
- package/runtime/python/okstra_ctl/pane_title.py +151 -0
- package/runtime/python/okstra_ctl/ports/host_model.py +48 -17
- package/runtime/python/okstra_ctl/ports/worker_dispatch.py +4 -0
- package/runtime/python/okstra_ctl/registry/provider_registry.py +8 -4
- package/runtime/python/okstra_ctl/render.py +78 -10
- package/runtime/python/okstra_ctl/render_final_report.py +19 -0
- package/runtime/python/okstra_ctl/report_contract.py +39 -0
- package/runtime/python/okstra_ctl/report_finalize.py +16 -0
- package/runtime/python/okstra_ctl/report_html/render.py +1 -0
- package/runtime/python/okstra_ctl/role_requirements.py +217 -0
- package/runtime/python/okstra_ctl/run.py +1207 -258
- package/runtime/python/okstra_ctl/run_index_row.py +7 -1
- package/runtime/python/okstra_ctl/time_report.py +38 -4
- package/runtime/python/okstra_ctl/usage_identity.py +86 -0
- package/runtime/python/okstra_ctl/usage_report.py +15 -3
- package/runtime/python/okstra_ctl/wizard.py +1253 -62
- package/runtime/python/okstra_ctl/worker_audit_ledger.py +68 -65
- package/runtime/python/okstra_ctl/worker_request.py +7 -1
- package/runtime/python/okstra_ctl/worker_runner.py +130 -5
- package/runtime/python/okstra_ctl/workers.py +7 -5
- package/runtime/python/okstra_ctl/write_policy.py +571 -0
- package/runtime/schemas/convergence-groups-v2.0.schema.json +128 -0
- package/runtime/schemas/execution-manifest-v2.schema.json +340 -0
- package/runtime/schemas/final-report-v2.0.schema.json +25 -0
- package/runtime/skills/okstra-run/SKILL.md +9 -9
- package/runtime/templates/report-writer-prompt-preamble.md +2 -0
- package/runtime/templates/reports/final-report-v2.template.md +7 -1
- package/runtime/templates/reports/html/base.template.html +21 -0
- package/runtime/templates/reports/html/i18n/en.json +4 -0
- package/runtime/templates/reports/html/i18n/ko.json +4 -0
- package/runtime/templates/worker-prompt-preamble.md +6 -2
- package/runtime/validators/lib/fixtures.sh +49 -16
- package/runtime/validators/validate-run.py +429 -35
- package/runtime/validators/validate_session_conformance.py +25 -7
- package/src/cli-registry.mjs +0 -539
- package/src/commands/execute/codex-dispatch.mjs +0 -10
- package/src/commands/execute/plan-items.mjs +0 -9
- package/src/commands/execute/plan-validate.mjs +0 -68
- package/src/commands/execute/run.mjs +0 -208
- package/src/commands/execute/wizard.mjs +0 -167
- package/src/commands/inspect/stage-map.mjs +0 -98
- package/src/commands/inspect/task-list.mjs +0 -97
- package/src/commands/inspect/task-show.mjs +0 -100
- package/src/commands/lifecycle/check-project.mjs +0 -187
- package/src/commands/lifecycle/config.mjs +0 -385
- package/src/commands/lifecycle/doctor.mjs +0 -308
- package/src/commands/lifecycle/install.mjs +0 -1170
- package/src/commands/lifecycle/paths.mjs +0 -104
- package/src/commands/lifecycle/preflight.mjs +0 -125
- package/src/commands/lifecycle/setup.mjs +0 -333
- package/src/commands/lifecycle/uninstall.mjs +0 -279
- package/src/commands/memory/memory.mjs +0 -524
- package/src/commands/pr/pr.mjs +0 -261
- package/src/lib/host-registry-client.mjs +0 -176
- package/src/lib/paths.mjs +0 -86
- package/src/lib/proc.mjs +0 -31
- package/src/lib/python-helper.mjs +0 -142
- package/src/lib/runtime-manifest.mjs +0 -70
- package/src/lib/skill-catalog.mjs +0 -53
- package/src/lib/version.mjs +0 -20
- /package/{src → dist}/commands/pr/default.md +0 -0
|
@@ -122,15 +122,21 @@ from okstra_ctl.worker_prompt_contract import ( # noqa: E402
|
|
|
122
122
|
PromptRecord,
|
|
123
123
|
validate_initial_prompt_records,
|
|
124
124
|
)
|
|
125
|
+
from okstra_ctl.domain.role import RoleCatalogError, role_for_duty # noqa: E402
|
|
125
126
|
from okstra_ctl.agent_invocation import ( # noqa: E402
|
|
126
127
|
AgentInvocationError,
|
|
127
128
|
agent_model_assignment_from_payload,
|
|
129
|
+
invocation_execution_identity_from_manifest,
|
|
128
130
|
verify_agent_invocation,
|
|
129
131
|
)
|
|
132
|
+
from okstra_ctl.execution_identity import ExecutionManifestError # noqa: E402
|
|
133
|
+
from okstra_ctl.execution_manifest import ( # noqa: E402
|
|
134
|
+
validate_execution_manifest_payload,
|
|
135
|
+
)
|
|
130
136
|
from okstra_ctl.lead_events import LeadEventParseError, read_lead_events # noqa: E402
|
|
131
137
|
from okstra_ctl.worker_audit_ledger import ( # noqa: E402
|
|
132
138
|
READING_CONFIRMATION_HEADING_RE,
|
|
133
|
-
|
|
139
|
+
worker_results_audit_findings,
|
|
134
140
|
)
|
|
135
141
|
from validate_analysis_report import validate_analysis_report # noqa: E402
|
|
136
142
|
from okstra_ctl.convergence_engine import ( # noqa: E402
|
|
@@ -151,6 +157,30 @@ _AGENT_DISPATCH_DIGEST_KEYS = (
|
|
|
151
157
|
"instructionDigest",
|
|
152
158
|
"promptDigest",
|
|
153
159
|
)
|
|
160
|
+
_V2_AGENT_DISPATCH_IDENTITY_KEYS = (
|
|
161
|
+
"participantRef",
|
|
162
|
+
"roleExecutionRef",
|
|
163
|
+
"executionLabel",
|
|
164
|
+
"dutyId",
|
|
165
|
+
"invocationRef",
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def _validate_execution_identity_v2(
|
|
170
|
+
run_manifest: Mapping[str, Any],
|
|
171
|
+
failures: list[str],
|
|
172
|
+
) -> None:
|
|
173
|
+
version = run_manifest.get("schemaVersion")
|
|
174
|
+
identity_version = run_manifest.get("executionIdentityVersion")
|
|
175
|
+
if version in {1, "1", "1.0"} and identity_version is None:
|
|
176
|
+
return
|
|
177
|
+
if version != "2.0" or identity_version != 2:
|
|
178
|
+
failures.append("execution identity v2: mixed execution identity version")
|
|
179
|
+
return
|
|
180
|
+
try:
|
|
181
|
+
validate_execution_manifest_payload(run_manifest)
|
|
182
|
+
except ExecutionManifestError as exc:
|
|
183
|
+
failures.append(f"execution identity v2: {exc}")
|
|
154
184
|
|
|
155
185
|
|
|
156
186
|
def _validate_agent_dispatch_contract(
|
|
@@ -169,6 +199,28 @@ def _validate_agent_dispatch_contract(
|
|
|
169
199
|
if not isinstance(assignments, Mapping):
|
|
170
200
|
failures.append("agent invocation metadata is missing: invocationAssignments")
|
|
171
201
|
return
|
|
202
|
+
manifest_version = run_manifest.get("schemaVersion")
|
|
203
|
+
execution_identity_version = run_manifest.get("executionIdentityVersion")
|
|
204
|
+
if manifest_version == "2.0" and execution_identity_version == 2:
|
|
205
|
+
uses_v2_identity = True
|
|
206
|
+
elif (
|
|
207
|
+
manifest_version in {None, 1, "1", "1.0"}
|
|
208
|
+
and execution_identity_version is None
|
|
209
|
+
):
|
|
210
|
+
uses_v2_identity = False
|
|
211
|
+
else:
|
|
212
|
+
failures.append("agent dispatch contract mixes v1 and v2 execution identity")
|
|
213
|
+
return
|
|
214
|
+
canonical_invocations = {
|
|
215
|
+
row.get("invocationRef"): row
|
|
216
|
+
for row in run_manifest.get("invocations") or []
|
|
217
|
+
if isinstance(row, Mapping)
|
|
218
|
+
} if uses_v2_identity else {}
|
|
219
|
+
canonical_attempts = {
|
|
220
|
+
(row.get("invocationRef"), row.get("attempt"))
|
|
221
|
+
for row in run_manifest.get("attempts") or []
|
|
222
|
+
if isinstance(row, Mapping)
|
|
223
|
+
} if uses_v2_identity else set()
|
|
172
224
|
worker_dispatches = [
|
|
173
225
|
row for row in (team_state.get("workerDispatches") or [])
|
|
174
226
|
if isinstance(row, Mapping) and row.get("invocationId")
|
|
@@ -179,13 +231,15 @@ def _validate_agent_dispatch_contract(
|
|
|
179
231
|
]
|
|
180
232
|
dispatches = [*worker_dispatches, *agent_dispatches]
|
|
181
233
|
ids: dict[str, Mapping[str, Any]] = {}
|
|
234
|
+
seen_dispatch_ids: set[str] = set()
|
|
182
235
|
for row in dispatches:
|
|
183
236
|
dispatch_id = str(row.get("dispatchId") or "").strip()
|
|
184
237
|
missing = [
|
|
185
238
|
key for key in (
|
|
186
|
-
"dispatchId", "
|
|
239
|
+
"dispatchId", "audience", "invocationId",
|
|
187
240
|
"assignmentRef", "promptMetadataPath", "modelExecutionValue",
|
|
188
241
|
"enforcementMode", *_AGENT_DISPATCH_DIGEST_KEYS,
|
|
242
|
+
*(_V2_AGENT_DISPATCH_IDENTITY_KEYS if uses_v2_identity else ("workerId",)),
|
|
189
243
|
)
|
|
190
244
|
if not str(row.get(key) or "").strip()
|
|
191
245
|
]
|
|
@@ -195,10 +249,43 @@ def _validate_agent_dispatch_contract(
|
|
|
195
249
|
+ ", ".join(missing)
|
|
196
250
|
)
|
|
197
251
|
continue
|
|
198
|
-
if
|
|
252
|
+
if uses_v2_identity:
|
|
253
|
+
if "workerId" in row or row.get("executionIdentityVersion") != 2:
|
|
254
|
+
failures.append(
|
|
255
|
+
f"agent dispatch {dispatch_id} mixes v1 and v2 execution identity"
|
|
256
|
+
)
|
|
257
|
+
continue
|
|
258
|
+
attempt = row.get("attempt")
|
|
259
|
+
if (
|
|
260
|
+
not isinstance(attempt, int)
|
|
261
|
+
or isinstance(attempt, bool)
|
|
262
|
+
or attempt < 1
|
|
263
|
+
):
|
|
264
|
+
failures.append(
|
|
265
|
+
f"agent dispatch {dispatch_id}: v2 attempt must be positive"
|
|
266
|
+
)
|
|
267
|
+
continue
|
|
268
|
+
if dispatch_id != f"{row['invocationId']}:attempt-{attempt}":
|
|
269
|
+
failures.append(
|
|
270
|
+
f"agent dispatch {dispatch_id}: dispatchId does not match v2 attempt"
|
|
271
|
+
)
|
|
272
|
+
continue
|
|
273
|
+
elif any(
|
|
274
|
+
key in row
|
|
275
|
+
for key in (
|
|
276
|
+
"executionIdentityVersion",
|
|
277
|
+
"attempt",
|
|
278
|
+
*_V2_AGENT_DISPATCH_IDENTITY_KEYS,
|
|
279
|
+
)
|
|
280
|
+
):
|
|
281
|
+
failures.append(
|
|
282
|
+
f"agent dispatch {dispatch_id} mixes v1 and v2 execution identity"
|
|
283
|
+
)
|
|
284
|
+
continue
|
|
285
|
+
if dispatch_id in seen_dispatch_ids:
|
|
199
286
|
failures.append(f"agent dispatch ID is duplicated: {dispatch_id}")
|
|
200
287
|
continue
|
|
201
|
-
|
|
288
|
+
seen_dispatch_ids.add(dispatch_id)
|
|
202
289
|
assignment_ref = str(row["assignmentRef"])
|
|
203
290
|
try:
|
|
204
291
|
assignment = agent_model_assignment_from_payload(
|
|
@@ -207,6 +294,118 @@ def _validate_agent_dispatch_contract(
|
|
|
207
294
|
except AgentInvocationError as exc:
|
|
208
295
|
failures.append(f"agent dispatch {dispatch_id}: {exc}")
|
|
209
296
|
continue
|
|
297
|
+
execution_identity = None
|
|
298
|
+
if uses_v2_identity:
|
|
299
|
+
try:
|
|
300
|
+
execution_identity = invocation_execution_identity_from_manifest(
|
|
301
|
+
run_manifest,
|
|
302
|
+
assignment=assignment,
|
|
303
|
+
assignment_ref=assignment_ref,
|
|
304
|
+
duty_id=str(row["dutyId"]),
|
|
305
|
+
)
|
|
306
|
+
except AgentInvocationError as exc:
|
|
307
|
+
failures.append(f"agent dispatch {dispatch_id}: {exc}")
|
|
308
|
+
continue
|
|
309
|
+
if (
|
|
310
|
+
execution_identity is None
|
|
311
|
+
or row.get("participantRef") != execution_identity.participant_ref
|
|
312
|
+
or row.get("roleExecutionRef") != execution_identity.role_execution_ref
|
|
313
|
+
):
|
|
314
|
+
failures.append(
|
|
315
|
+
f"agent dispatch {dispatch_id}: v2 identity does not match "
|
|
316
|
+
"a canonical role execution"
|
|
317
|
+
)
|
|
318
|
+
continue
|
|
319
|
+
if row.get("executionLabel") != execution_identity.execution_label:
|
|
320
|
+
failures.append(
|
|
321
|
+
f"agent dispatch {dispatch_id}: executionLabel does not match "
|
|
322
|
+
"canonical role execution"
|
|
323
|
+
)
|
|
324
|
+
continue
|
|
325
|
+
dispatch_kind = row.get("dispatchKind") or row.get("kind")
|
|
326
|
+
if not isinstance(dispatch_kind, str) or not dispatch_kind:
|
|
327
|
+
failures.append(
|
|
328
|
+
f"agent dispatch {dispatch_id}: dispatchKind is missing"
|
|
329
|
+
)
|
|
330
|
+
continue
|
|
331
|
+
invocation = canonical_invocations.get(row.get("invocationRef"))
|
|
332
|
+
if not isinstance(invocation, Mapping) or any((
|
|
333
|
+
invocation.get("participantRef") != row.get("participantRef"),
|
|
334
|
+
invocation.get("roleExecutionRef") != row.get("roleExecutionRef"),
|
|
335
|
+
invocation.get("dutyId") != row.get("dutyId"),
|
|
336
|
+
invocation.get("dispatchKind") != dispatch_kind,
|
|
337
|
+
invocation.get("inputDigest") != row.get("promptDigest"),
|
|
338
|
+
)):
|
|
339
|
+
failures.append(
|
|
340
|
+
f"agent dispatch {dispatch_id}: does not match canonical invocation"
|
|
341
|
+
)
|
|
342
|
+
continue
|
|
343
|
+
if row.get("writePolicyDigest") != invocation.get("writePolicyDigest"):
|
|
344
|
+
failures.append(
|
|
345
|
+
f"agent dispatch {dispatch_id}: writePolicyDigest does not "
|
|
346
|
+
"match canonical invocation"
|
|
347
|
+
)
|
|
348
|
+
continue
|
|
349
|
+
if row.get("writeEnforcement") != invocation.get("writeEnforcement"):
|
|
350
|
+
failures.append(
|
|
351
|
+
f"agent dispatch {dispatch_id}: writeEnforcement does not "
|
|
352
|
+
"match canonical invocation"
|
|
353
|
+
)
|
|
354
|
+
continue
|
|
355
|
+
mutation_mode = invocation.get("writeEnforcement", {}).get(
|
|
356
|
+
"mutationAudit"
|
|
357
|
+
) if isinstance(invocation.get("writeEnforcement"), Mapping) else None
|
|
358
|
+
snapshot_value = row.get("mutationAuditSnapshotPath")
|
|
359
|
+
if mutation_mode == "batch" and not (
|
|
360
|
+
isinstance(snapshot_value, str) and snapshot_value.strip()
|
|
361
|
+
):
|
|
362
|
+
failures.append(
|
|
363
|
+
f"agent dispatch {dispatch_id}: mutation audit snapshot is missing"
|
|
364
|
+
)
|
|
365
|
+
continue
|
|
366
|
+
if mutation_mode == "none" and snapshot_value not in (None, ""):
|
|
367
|
+
failures.append(
|
|
368
|
+
f"agent dispatch {dispatch_id}: exact-path dispatch has a "
|
|
369
|
+
"mutation audit snapshot"
|
|
370
|
+
)
|
|
371
|
+
continue
|
|
372
|
+
if (row.get("invocationRef"), attempt) not in canonical_attempts:
|
|
373
|
+
failures.append(
|
|
374
|
+
f"agent dispatch {dispatch_id}: has no canonical invocation attempt"
|
|
375
|
+
)
|
|
376
|
+
continue
|
|
377
|
+
status_path_raw = row.get("statusSidecarPath")
|
|
378
|
+
if isinstance(status_path_raw, str) and status_path_raw.strip():
|
|
379
|
+
status_path = _resolve_prompt_record_path(
|
|
380
|
+
project_root, status_path_raw
|
|
381
|
+
)
|
|
382
|
+
try:
|
|
383
|
+
status = json.loads(status_path.read_text(encoding="utf-8"))
|
|
384
|
+
except (OSError, json.JSONDecodeError):
|
|
385
|
+
failures.append(
|
|
386
|
+
f"agent dispatch {dispatch_id}: wrapper status is missing or invalid"
|
|
387
|
+
)
|
|
388
|
+
continue
|
|
389
|
+
status_identity = {
|
|
390
|
+
key: status.get(key)
|
|
391
|
+
for key in (*_V2_AGENT_DISPATCH_IDENTITY_KEYS, "attempt")
|
|
392
|
+
} if isinstance(status, Mapping) else {}
|
|
393
|
+
dispatch_identity = {
|
|
394
|
+
key: row.get(key)
|
|
395
|
+
for key in (*_V2_AGENT_DISPATCH_IDENTITY_KEYS, "attempt")
|
|
396
|
+
}
|
|
397
|
+
if (
|
|
398
|
+
not isinstance(status, Mapping)
|
|
399
|
+
or status.get("schemaVersion") != "2.0"
|
|
400
|
+
or status.get("executionIdentityVersion") != 2
|
|
401
|
+
or status_identity != dispatch_identity
|
|
402
|
+
):
|
|
403
|
+
failures.append(
|
|
404
|
+
f"agent dispatch {dispatch_id}: wrapper status identity "
|
|
405
|
+
"does not match dispatch"
|
|
406
|
+
)
|
|
407
|
+
continue
|
|
408
|
+
ids[dispatch_id] = row
|
|
210
409
|
metadata_path = _resolve_prompt_record_path(
|
|
211
410
|
project_root, str(row["promptMetadataPath"])
|
|
212
411
|
)
|
|
@@ -216,9 +415,20 @@ def _validate_agent_dispatch_contract(
|
|
|
216
415
|
expected_run_manifest_path=run_manifest_path,
|
|
217
416
|
expected_assignment=assignment,
|
|
218
417
|
expected_invocation_id=str(row["invocationId"]),
|
|
219
|
-
expected_worker_id=
|
|
418
|
+
expected_worker_id=(
|
|
419
|
+
None if uses_v2_identity else str(row["workerId"])
|
|
420
|
+
),
|
|
220
421
|
expected_assignment_ref=assignment_ref,
|
|
221
422
|
expected_audience=str(row["audience"]),
|
|
423
|
+
expected_participant_ref=(
|
|
424
|
+
str(row["participantRef"]) if uses_v2_identity else None
|
|
425
|
+
),
|
|
426
|
+
expected_role_execution_ref=(
|
|
427
|
+
str(row["roleExecutionRef"]) if uses_v2_identity else None
|
|
428
|
+
),
|
|
429
|
+
expected_invocation_ref=(
|
|
430
|
+
str(row["invocationRef"]) if uses_v2_identity else None
|
|
431
|
+
),
|
|
222
432
|
)
|
|
223
433
|
failures.extend(
|
|
224
434
|
f"agent dispatch {dispatch_id}: {error}" for error in errors
|
|
@@ -258,10 +468,23 @@ def _validate_agent_dispatch_contract(
|
|
|
258
468
|
else "host-native prompt delivery cannot be marked verified"
|
|
259
469
|
)
|
|
260
470
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
471
|
+
if uses_v2_identity:
|
|
472
|
+
role_executions = {
|
|
473
|
+
row.get("roleExecutionRef"): row
|
|
474
|
+
for row in run_manifest.get("roleExecutions") or []
|
|
475
|
+
if isinstance(row, Mapping)
|
|
476
|
+
}
|
|
477
|
+
lead_ids = {
|
|
478
|
+
dispatch_id for dispatch_id, row in ids.items()
|
|
479
|
+
if row.get("audience") == "lead"
|
|
480
|
+
and isinstance(role_executions.get(row.get("roleExecutionRef")), Mapping)
|
|
481
|
+
and role_executions[row["roleExecutionRef"]].get("role") == "leader"
|
|
482
|
+
}
|
|
483
|
+
else:
|
|
484
|
+
lead_ids = {
|
|
485
|
+
dispatch_id for dispatch_id, row in ids.items()
|
|
486
|
+
if row.get("audience") == "lead" and row.get("workerId") == "lead"
|
|
487
|
+
}
|
|
265
488
|
if not lead_ids:
|
|
266
489
|
failures.append("accepted lead result has no lead dispatch record")
|
|
267
490
|
|
|
@@ -277,6 +500,22 @@ def _validate_agent_dispatch_contract(
|
|
|
277
500
|
if dispatch_id not in ids or not result_path:
|
|
278
501
|
failures.append("agent result link has no matching dispatch record")
|
|
279
502
|
continue
|
|
503
|
+
if uses_v2_identity:
|
|
504
|
+
dispatch = ids[dispatch_id]
|
|
505
|
+
identity_keys = (*_V2_AGENT_DISPATCH_IDENTITY_KEYS, "attempt")
|
|
506
|
+
link_identity = {key: link.get(key) for key in identity_keys}
|
|
507
|
+
dispatch_identity = {key: dispatch.get(key) for key in identity_keys}
|
|
508
|
+
if "workerId" in link or link_identity != dispatch_identity:
|
|
509
|
+
failures.append(
|
|
510
|
+
f"agent result link identity does not match dispatch: {dispatch_id}"
|
|
511
|
+
)
|
|
512
|
+
continue
|
|
513
|
+
elif any(
|
|
514
|
+
key in link
|
|
515
|
+
for key in (*_V2_AGENT_DISPATCH_IDENTITY_KEYS, "attempt")
|
|
516
|
+
):
|
|
517
|
+
failures.append("agent result link mixes v1 and v2 execution identity")
|
|
518
|
+
continue
|
|
280
519
|
dispatch_link_counts[dispatch_id] = dispatch_link_counts.get(dispatch_id, 0) + 1
|
|
281
520
|
previous = paths.setdefault(result_path, dispatch_id)
|
|
282
521
|
if previous != dispatch_id:
|
|
@@ -296,7 +535,11 @@ def _validate_agent_dispatch_contract(
|
|
|
296
535
|
worker_result = str(worker.get("resultPath") or "").strip()
|
|
297
536
|
worker_dispatch_ids = {
|
|
298
537
|
dispatch_id for dispatch_id, row in ids.items()
|
|
299
|
-
if
|
|
538
|
+
if (
|
|
539
|
+
row.get("assignmentRef") == f"initial/{worker_id}"
|
|
540
|
+
if uses_v2_identity
|
|
541
|
+
else row.get("workerId") == worker_id
|
|
542
|
+
)
|
|
300
543
|
}
|
|
301
544
|
if worker_id and not worker_dispatch_ids:
|
|
302
545
|
failures.append(
|
|
@@ -590,13 +833,16 @@ def update_validation_metadata(
|
|
|
590
833
|
validation_status: str,
|
|
591
834
|
failures: list[str],
|
|
592
835
|
report_data: Mapping[str, Any] | None = None,
|
|
836
|
+
advisories: list[str] | None = None,
|
|
593
837
|
) -> None:
|
|
594
838
|
checked_at = utc_now()
|
|
839
|
+
advisories = list(advisories or [])
|
|
595
840
|
|
|
596
841
|
team_state.setdefault("validator", {})
|
|
597
842
|
team_state["validator"]["status"] = validation_status
|
|
598
843
|
team_state["validator"]["lastValidatedAt"] = checked_at
|
|
599
844
|
team_state["validator"]["failures"] = failures
|
|
845
|
+
team_state["validator"]["advisories"] = advisories
|
|
600
846
|
|
|
601
847
|
run_manifest.setdefault("validation", {})
|
|
602
848
|
run_manifest["validation"]["required"] = True
|
|
@@ -604,6 +850,8 @@ def update_validation_metadata(
|
|
|
604
850
|
run_manifest["validation"]["lastCheckedAt"] = checked_at
|
|
605
851
|
run_manifest["validation"]["passed"] = validation_status == "passed"
|
|
606
852
|
run_manifest["validation"]["failures"] = failures
|
|
853
|
+
# Reported, not blocking — a passing run can carry these.
|
|
854
|
+
run_manifest["validation"]["advisories"] = advisories
|
|
607
855
|
run_manifest["status"] = (
|
|
608
856
|
"completed" if validation_status == "passed" else "contract-violated"
|
|
609
857
|
)
|
|
@@ -709,35 +957,127 @@ def _persisted_prompt_records(
|
|
|
709
957
|
project_root: Path,
|
|
710
958
|
selected_ids: set[str],
|
|
711
959
|
team_state: dict,
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
960
|
+
run_manifest: Mapping[str, Any],
|
|
961
|
+
) -> tuple[list[PromptRecord], list[str]]:
|
|
962
|
+
uses_v2_identity = (
|
|
963
|
+
run_manifest.get("schemaVersion") == "2.0"
|
|
964
|
+
and run_manifest.get("executionIdentityVersion") == 2
|
|
716
965
|
)
|
|
966
|
+
dispatches = team_state.get("workerDispatches")
|
|
967
|
+
if uses_v2_identity:
|
|
968
|
+
source = [
|
|
969
|
+
*(dispatches if isinstance(dispatches, list) else []),
|
|
970
|
+
*(
|
|
971
|
+
team_state.get("agentDispatches")
|
|
972
|
+
if isinstance(team_state.get("agentDispatches"), list)
|
|
973
|
+
else []
|
|
974
|
+
),
|
|
975
|
+
]
|
|
976
|
+
else:
|
|
977
|
+
source = dispatches if isinstance(dispatches, list) and dispatches else (
|
|
978
|
+
team_state.get("workers") or []
|
|
979
|
+
)
|
|
717
980
|
records: list[PromptRecord] = []
|
|
718
981
|
seen: set[tuple[str, str, str]] = set()
|
|
982
|
+
errors: list[str] = []
|
|
983
|
+
role_executions = {
|
|
984
|
+
str(row.get("roleExecutionRef") or ""): row
|
|
985
|
+
for row in run_manifest.get("roleExecutions") or []
|
|
986
|
+
if isinstance(row, Mapping)
|
|
987
|
+
} if uses_v2_identity else {}
|
|
719
988
|
for worker in source:
|
|
720
989
|
if not isinstance(worker, dict):
|
|
721
990
|
continue
|
|
722
|
-
|
|
991
|
+
assignment_ref = str(worker.get("assignmentRef") or "").strip()
|
|
992
|
+
worker_id = (
|
|
993
|
+
assignment_ref.removeprefix("initial/")
|
|
994
|
+
if uses_v2_identity and assignment_ref.startswith("initial/")
|
|
995
|
+
else str(worker.get("workerId") or "").strip()
|
|
996
|
+
)
|
|
723
997
|
prompt_value = str(worker.get("promptPath") or "").strip()
|
|
724
|
-
if worker_id not in selected_ids
|
|
998
|
+
if worker_id not in selected_ids:
|
|
725
999
|
continue
|
|
726
|
-
|
|
1000
|
+
if not prompt_value:
|
|
1001
|
+
errors.append(f"{worker_id}: persisted initial prompt path is missing")
|
|
1002
|
+
continue
|
|
1003
|
+
dispatch_kind = str(
|
|
1004
|
+
worker.get("kind") or worker.get("dispatchKind") or ""
|
|
1005
|
+
).strip()
|
|
727
1006
|
if not dispatch_kind:
|
|
728
1007
|
dispatch_kind = _fallback_dispatch_kind(prompt_value)
|
|
1008
|
+
duty_id = ""
|
|
1009
|
+
if uses_v2_identity:
|
|
1010
|
+
execution = role_executions.get(
|
|
1011
|
+
str(worker.get("roleExecutionRef") or "").strip()
|
|
1012
|
+
)
|
|
1013
|
+
participant_ref = str(worker.get("participantRef") or "").strip()
|
|
1014
|
+
duty_id = str(worker.get("dutyId") or "").strip()
|
|
1015
|
+
audience = str(worker.get("audience") or "").strip()
|
|
1016
|
+
assignments = run_manifest.get("invocationAssignments")
|
|
1017
|
+
assignment = (
|
|
1018
|
+
assignments.get(assignment_ref)
|
|
1019
|
+
if isinstance(assignments, Mapping)
|
|
1020
|
+
else None
|
|
1021
|
+
)
|
|
1022
|
+
if not isinstance(execution, Mapping):
|
|
1023
|
+
errors.append(
|
|
1024
|
+
f"{worker_id}: persisted prompt has unknown roleExecutionRef"
|
|
1025
|
+
)
|
|
1026
|
+
continue
|
|
1027
|
+
try:
|
|
1028
|
+
expected_role = role_for_duty(duty_id)
|
|
1029
|
+
except RoleCatalogError as exc:
|
|
1030
|
+
errors.append(f"{worker_id}: {exc}")
|
|
1031
|
+
continue
|
|
1032
|
+
if (
|
|
1033
|
+
execution.get("participantRef") != participant_ref
|
|
1034
|
+
or execution.get("role") != expected_role
|
|
1035
|
+
or execution.get("executionLabel") != worker.get("executionLabel")
|
|
1036
|
+
or not isinstance(assignment, Mapping)
|
|
1037
|
+
or execution.get("provider") != assignment.get("provider")
|
|
1038
|
+
or not isinstance(execution.get("binding"), Mapping)
|
|
1039
|
+
or execution["binding"].get("resolvedExecutionValue")
|
|
1040
|
+
!= assignment.get("modelExecutionValue")
|
|
1041
|
+
):
|
|
1042
|
+
errors.append(
|
|
1043
|
+
f"{worker_id}: persisted prompt identity does not match role execution"
|
|
1044
|
+
)
|
|
1045
|
+
continue
|
|
1046
|
+
if audience != duty_id:
|
|
1047
|
+
errors.append(
|
|
1048
|
+
f"{worker_id}: persisted prompt audience does not match duty"
|
|
1049
|
+
)
|
|
1050
|
+
continue
|
|
729
1051
|
identity = (worker_id, dispatch_kind, prompt_value)
|
|
730
1052
|
if identity in seen:
|
|
731
1053
|
continue
|
|
732
1054
|
seen.add(identity)
|
|
1055
|
+
metadata_value = str(worker.get("promptMetadataPath") or "").strip()
|
|
733
1056
|
records.append(
|
|
734
1057
|
PromptRecord(
|
|
735
1058
|
worker_id=worker_id,
|
|
736
1059
|
dispatch_kind=dispatch_kind,
|
|
737
1060
|
path=_resolve_prompt_record_path(project_root, prompt_value),
|
|
1061
|
+
expected_model=(
|
|
1062
|
+
str(worker.get("modelExecutionValue") or "").strip() or None
|
|
1063
|
+
if uses_v2_identity else None
|
|
1064
|
+
),
|
|
1065
|
+
metadata_path=(
|
|
1066
|
+
_resolve_prompt_record_path(project_root, metadata_value)
|
|
1067
|
+
if uses_v2_identity and metadata_value else None
|
|
1068
|
+
),
|
|
1069
|
+
expected_duty_audience=(duty_id if uses_v2_identity else None),
|
|
738
1070
|
)
|
|
739
1071
|
)
|
|
740
|
-
|
|
1072
|
+
if uses_v2_identity:
|
|
1073
|
+
recorded_ids = {record.worker_id for record in records}
|
|
1074
|
+
missing_ids = sorted(selected_ids - recorded_ids)
|
|
1075
|
+
if missing_ids:
|
|
1076
|
+
errors.append(
|
|
1077
|
+
"no persisted initial prompt records for selected role executions: "
|
|
1078
|
+
+ ", ".join(missing_ids)
|
|
1079
|
+
)
|
|
1080
|
+
return records, errors
|
|
741
1081
|
|
|
742
1082
|
|
|
743
1083
|
def _markdown_section(text: str, heading: str) -> str:
|
|
@@ -863,15 +1203,16 @@ def _validate_initial_analysis_prompts(
|
|
|
863
1203
|
team_state = data.get("teamState") or {}
|
|
864
1204
|
manifest = dict(run_manifest)
|
|
865
1205
|
manifest["taskType"] = task_type
|
|
866
|
-
records = _persisted_prompt_records(
|
|
1206
|
+
records, collection_errors = _persisted_prompt_records(
|
|
867
1207
|
project_root=project_root,
|
|
868
1208
|
selected_ids=selected_ids,
|
|
869
1209
|
team_state=team_state,
|
|
1210
|
+
run_manifest=run_manifest,
|
|
870
1211
|
)
|
|
871
|
-
errors = validate_initial_prompt_records(
|
|
1212
|
+
errors = [*collection_errors, *validate_initial_prompt_records(
|
|
872
1213
|
manifest=manifest,
|
|
873
1214
|
records=records,
|
|
874
|
-
)
|
|
1215
|
+
)]
|
|
875
1216
|
if task_type == "improvement-discovery":
|
|
876
1217
|
errors.extend(
|
|
877
1218
|
_validate_improvement_primary_assignments(
|
|
@@ -2638,22 +2979,30 @@ def _report_run_seq(report_path: Path) -> str | None:
|
|
|
2638
2979
|
|
|
2639
2980
|
|
|
2640
2981
|
def validate_worker_results_audit(
|
|
2641
|
-
report_path: Path,
|
|
2982
|
+
report_path: Path,
|
|
2983
|
+
task_type: str,
|
|
2984
|
+
failures: list[str],
|
|
2985
|
+
advisories: list[str] | None = None,
|
|
2642
2986
|
) -> None:
|
|
2643
2987
|
"""Enforce the worker audit sidecar contract at Phase 7.
|
|
2644
2988
|
|
|
2645
2989
|
The rules themselves live in `okstra_ctl.worker_audit_ledger` so that
|
|
2646
2990
|
`okstra worker-audit-check` can apply the identical checks mid-run, while
|
|
2647
|
-
the worker session is still alive and can fix its own citations.
|
|
2648
|
-
wrapper adds
|
|
2649
|
-
|
|
2991
|
+
the worker session is still alive and can fix its own citations. This
|
|
2992
|
+
wrapper adds the Phase 7 anchor — the run directory and this run's seq, both
|
|
2993
|
+
read off the report path — and routes the citation-ledger findings to
|
|
2994
|
+
*advisories*, which do not fail the run. Mid-run the worker can still fix a
|
|
2995
|
+
citation; at Phase 7 the only remedy left is to void a finished run over a
|
|
2996
|
+
spelling, so the finding is reported instead.
|
|
2650
2997
|
"""
|
|
2651
|
-
|
|
2998
|
+
blocking, ledger = worker_results_audit_findings(
|
|
2652
2999
|
# `report_path` is `runs/<task-type>/reports/final-report-...md`.
|
|
2653
3000
|
report_path.parent.parent,
|
|
2654
3001
|
task_type,
|
|
2655
3002
|
_report_run_seq(report_path),
|
|
2656
|
-
)
|
|
3003
|
+
)
|
|
3004
|
+
failures.extend(blocking)
|
|
3005
|
+
(advisories if advisories is not None else failures).extend(ledger)
|
|
2657
3006
|
|
|
2658
3007
|
|
|
2659
3008
|
def validate_team_state_usage(team_state: dict, failures: list[str]) -> None:
|
|
@@ -3080,6 +3429,13 @@ def validate_final_report_data(
|
|
|
3080
3429
|
return data
|
|
3081
3430
|
|
|
3082
3431
|
manifest = run_manifest or {}
|
|
3432
|
+
if data.get("executionIdentityVersion") == 2 or data.get("executionRoles"):
|
|
3433
|
+
try:
|
|
3434
|
+
from okstra_ctl.report_contract import assert_execution_roles_match_manifest
|
|
3435
|
+
|
|
3436
|
+
assert_execution_roles_match_manifest(data, manifest)
|
|
3437
|
+
except ValueError as exc:
|
|
3438
|
+
failures.append(str(exc))
|
|
3083
3439
|
_validate_approval_context(data, manifest, failures, report_path)
|
|
3084
3440
|
_validate_activity_contract_plan_limits(data, manifest, failures)
|
|
3085
3441
|
|
|
@@ -3373,7 +3729,17 @@ _ADVISORY_ONLY_KINDS = {"d"}
|
|
|
3373
3729
|
# Stop reasons that justify promoting a still-broken planner-fixable item to the
|
|
3374
3730
|
# user: the self-fix budget ran out, or a round produced no net resolution so
|
|
3375
3731
|
# further rounds would repeat themselves.
|
|
3376
|
-
|
|
3732
|
+
#
|
|
3733
|
+
# `cause-group-recurrence` is the legacy spelling of that same exhaustion
|
|
3734
|
+
# (plan-body-verification.md "Loop termination"). A pre-activity-contract report
|
|
3735
|
+
# carrying it is a report whose loop stopped because the cause kept recurring —
|
|
3736
|
+
# refusing it here left such a run with no exit at all: the loop may not run
|
|
3737
|
+
# again, and the surviving item may not be promoted either.
|
|
3738
|
+
# `_validate_activity_contract_plan_limits` still forbids a NEW v1 run from
|
|
3739
|
+
# emitting it, so this admits the legacy shape without reopening it.
|
|
3740
|
+
_SELF_FIX_EXHAUSTED_REASONS = frozenset(
|
|
3741
|
+
{"max-rounds-reached", "no-progress", "cause-group-recurrence"}
|
|
3742
|
+
)
|
|
3377
3743
|
|
|
3378
3744
|
|
|
3379
3745
|
def _is_variation_point_item(item: dict) -> bool:
|
|
@@ -4758,10 +5124,11 @@ def _items_resolved_in_round(plan_items: object, round_number: int) -> set[str]:
|
|
|
4758
5124
|
def _detect_self_fix_recurrence(pbv: dict) -> list[str]:
|
|
4759
5125
|
"""Rounds that re-target ground the previous round already worked, unresolved.
|
|
4760
5126
|
|
|
4761
|
-
`no-progress`
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
5127
|
+
`no-progress` is judged at the round's end from what it resolved. Repeating
|
|
5128
|
+
the previous round's *unresolved* remainder is the same conclusion reached
|
|
5129
|
+
one dispatch earlier — the observed shape was two rounds spent on one
|
|
5130
|
+
identical seven-item set. This names that shape so the loop can exit on it
|
|
5131
|
+
rather than paying for the round that proves it.
|
|
4765
5132
|
|
|
4766
5133
|
Advisory only. Narrowing onto what the last round genuinely left open is
|
|
4767
5134
|
legitimate progress, and the rule separating that from re-digging the same
|
|
@@ -4790,8 +5157,8 @@ def _detect_self_fix_recurrence(pbv: dict) -> list[str]:
|
|
|
4790
5157
|
f"self-fix round {round_number} re-targets only items round "
|
|
4791
5158
|
f"{round_number - 1} left unresolved ({', '.join(sorted(current))}) "
|
|
4792
5159
|
"— the previous round's correction did not move this cause. "
|
|
4793
|
-
"Consider exiting with `
|
|
4794
|
-
"
|
|
5160
|
+
"Consider exiting with `no-progress` instead of spending the "
|
|
5161
|
+
"remaining budget on the same ground."
|
|
4795
5162
|
)
|
|
4796
5163
|
return warnings
|
|
4797
5164
|
|
|
@@ -7898,11 +8265,16 @@ def _validate_session_conformance(
|
|
|
7898
8265
|
task_type: str,
|
|
7899
8266
|
claude_projects_dir: str | None,
|
|
7900
8267
|
failures: list[str],
|
|
8268
|
+
advisories: list[str] | None = None,
|
|
7901
8269
|
) -> None:
|
|
7902
8270
|
"""prompts/lead/okstra-lead-contract.md의 PROGRESS / activity / heartbeat /
|
|
7903
8271
|
implementation entry guard 사후 검사를 위임하고 실패를
|
|
7904
8272
|
``session-conformance: `` 접두로 folding 한다. 설계:
|
|
7905
8273
|
docs/superpowers/specs/2026-06-10-blocking-contract-posthoc-conformance-design.md
|
|
8274
|
+
|
|
8275
|
+
PROGRESS 서술 라인 누락은 ``result.advisories`` 로 돌아오며 run 을
|
|
8276
|
+
실패시키지 않는다 — 그 라인을 쓸 세션은 이 검사가 도는 시점에 이미 끝나 있어
|
|
8277
|
+
남은 구제책이 phase 폐기뿐이다.
|
|
7906
8278
|
"""
|
|
7907
8279
|
_validators_dir = Path(__file__).resolve().parent
|
|
7908
8280
|
if str(_validators_dir) not in sys.path:
|
|
@@ -7924,6 +8296,9 @@ def _validate_session_conformance(
|
|
|
7924
8296
|
claude_projects_dir=Path(claude_projects_dir) if claude_projects_dir else None,
|
|
7925
8297
|
)
|
|
7926
8298
|
failures.extend(f"session-conformance: {err}" for err in result.errors)
|
|
8299
|
+
(advisories if advisories is not None else failures).extend(
|
|
8300
|
+
f"session-conformance: {note}" for note in result.advisories
|
|
8301
|
+
)
|
|
7927
8302
|
|
|
7928
8303
|
|
|
7929
8304
|
def _validate_forbidden_actions(
|
|
@@ -8677,8 +9052,21 @@ def main() -> int:
|
|
|
8677
9052
|
print(f"validate-run: Phase 7 auto-recovery skipped — {msg}", file=sys.stderr)
|
|
8678
9053
|
|
|
8679
9054
|
failures: list[str] = []
|
|
9055
|
+
# Findings that are reported but do not fail the run.
|
|
9056
|
+
#
|
|
9057
|
+
# The line is whether a remedy still exists at Phase 7. A defect in the
|
|
9058
|
+
# report is fixable — re-author it and re-render. A defect in what a
|
|
9059
|
+
# *finished session* wrote down is not: the worker that would restate its
|
|
9060
|
+
# citation and the lead pane that would emit its PROGRESS line have both
|
|
9061
|
+
# ended, so the only remaining move is to void the phase. That blocks the
|
|
9062
|
+
# next phase without establishing that any conclusion in the report is
|
|
9063
|
+
# wrong. Those findings are surfaced and carried in the run manifest
|
|
9064
|
+
# instead — currently the worker citation ledger and the PROGRESS narration
|
|
9065
|
+
# lines.
|
|
9066
|
+
advisories: list[str] = []
|
|
8680
9067
|
if autofix_state == "accuracy-failed":
|
|
8681
9068
|
failures.extend(autofix_messages)
|
|
9069
|
+
_validate_execution_identity_v2(run_manifest, failures)
|
|
8682
9070
|
contract = extract_contract(run_manifest, task_manifest, failures)
|
|
8683
9071
|
concurrent_run_authorized = bool(
|
|
8684
9072
|
(run_manifest.get("concurrentRun") or {}).get("detected")
|
|
@@ -8743,7 +9131,7 @@ def main() -> int:
|
|
|
8743
9131
|
failures,
|
|
8744
9132
|
)
|
|
8745
9133
|
if task_type:
|
|
8746
|
-
validate_worker_results_audit(report_path, task_type, failures)
|
|
9134
|
+
validate_worker_results_audit(report_path, task_type, failures, advisories)
|
|
8747
9135
|
_validate_session_conformance(
|
|
8748
9136
|
team_state,
|
|
8749
9137
|
team_state_path,
|
|
@@ -8753,6 +9141,7 @@ def main() -> int:
|
|
|
8753
9141
|
task_type,
|
|
8754
9142
|
args.claude_projects_dir,
|
|
8755
9143
|
failures,
|
|
9144
|
+
advisories,
|
|
8756
9145
|
)
|
|
8757
9146
|
_validate_forbidden_actions(
|
|
8758
9147
|
team_state,
|
|
@@ -8850,6 +9239,7 @@ def main() -> int:
|
|
|
8850
9239
|
validation_status,
|
|
8851
9240
|
failures,
|
|
8852
9241
|
report_data=validation_data,
|
|
9242
|
+
advisories=advisories,
|
|
8853
9243
|
)
|
|
8854
9244
|
|
|
8855
9245
|
write_json(team_state_path, team_state)
|
|
@@ -8876,10 +9266,14 @@ def main() -> int:
|
|
|
8876
9266
|
+ "\n"
|
|
8877
9267
|
)
|
|
8878
9268
|
|
|
9269
|
+
for note in advisories:
|
|
9270
|
+
print(f"validate-run: advisory — {note}", file=sys.stderr)
|
|
9271
|
+
|
|
8879
9272
|
result = {
|
|
8880
9273
|
"validationStatus": validation_status,
|
|
8881
9274
|
"finalRunStatus": run_manifest.get("status"),
|
|
8882
9275
|
"failures": failures,
|
|
9276
|
+
"advisories": advisories,
|
|
8883
9277
|
"teamStatePath": str(team_state_path),
|
|
8884
9278
|
"reportPath": str(report_path),
|
|
8885
9279
|
}
|