@tea-agent/loop-agent 0.1.0-fe-test.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/AGENTS.md +114 -0
- package/CHANGELOG.md +2283 -0
- package/README.md +177 -0
- package/bin/agent-worker.js +22 -0
- package/bin/loop-agent.js +57 -0
- package/dist/adapters/aimax.js +91 -0
- package/dist/adapters/context.js +32 -0
- package/dist/adapters/index.js +29 -0
- package/dist/adapters/loop-agent.js +192 -0
- package/dist/adapters/types.js +1 -0
- package/dist/application/context-usage/skill-resolution-stats.js +263 -0
- package/dist/application/dag/args.js +486 -0
- package/dist/application/dag/generate-task-dag.js +408 -0
- package/dist/application/dag/report-dag.js +14 -0
- package/dist/application/dag/run-dag.js +109 -0
- package/dist/application/dag/validate-dag.js +166 -0
- package/dist/application/evaluation/alias.js +184 -0
- package/dist/application/evaluation/budget.js +192 -0
- package/dist/application/evaluation/campaign-hash.js +47 -0
- package/dist/application/evaluation/campaign-matrix.js +372 -0
- package/dist/application/evaluation/campaign-scorecard.js +135 -0
- package/dist/application/evaluation/campaign.js +370 -0
- package/dist/application/evaluation/candidate-hash.js +75 -0
- package/dist/application/evaluation/candidate.js +69 -0
- package/dist/application/evaluation/corpus-hash.js +38 -0
- package/dist/application/evaluation/corpus.js +56 -0
- package/dist/application/evaluation/experiment.js +294 -0
- package/dist/application/evaluation/ignition.js +198 -0
- package/dist/application/evaluation/integrity-audit.js +162 -0
- package/dist/application/evaluation/outer-loop.js +132 -0
- package/dist/application/evaluation/pi-cell-executor.js +39 -0
- package/dist/application/evaluation/private-verifier.js +46 -0
- package/dist/application/evaluation/promotion-policy.js +151 -0
- package/dist/application/evaluation/proposer.js +98 -0
- package/dist/application/evaluation/replay.js +289 -0
- package/dist/application/evaluation/types.js +652 -0
- package/dist/application/loop/run-action.js +19 -0
- package/dist/application/task-lifecycle/advance.js +1204 -0
- package/dist/application/task-lifecycle/gates.js +130 -0
- package/dist/application/task-lifecycle/index.js +7 -0
- package/dist/application/task-lifecycle/observe.js +424 -0
- package/dist/application/task-lifecycle/plan-transitions.js +251 -0
- package/dist/application/task-lifecycle/recommendations.js +180 -0
- package/dist/application/task-lifecycle/record.js +73 -0
- package/dist/application/task-lifecycle/types.js +1 -0
- package/dist/build-stamp.json +6 -0
- package/dist/cli/catalog.js +24 -0
- package/dist/cli/command-definitions.js +659 -0
- package/dist/cli/help.js +56 -0
- package/dist/cli/index.js +5 -0
- package/dist/cli/program.js +647 -0
- package/dist/cli/router.js +13 -0
- package/dist/cli/update/init-surface-notifier.js +167 -0
- package/dist/cli/update/notifier.js +117 -0
- package/dist/cli/update/npm-client.js +151 -0
- package/dist/cli/update/policy.js +92 -0
- package/dist/cli/update/runtime-activity.js +29 -0
- package/dist/cli/update/state.js +68 -0
- package/dist/cli-governance/active-residue-check.js +38 -0
- package/dist/cli.js +57 -0
- package/dist/commands/client-recovery.js +1373 -0
- package/dist/commands/closeout.js +13 -0
- package/dist/commands/coverage-audit.js +14 -0
- package/dist/commands/coverage-report.js +50 -0
- package/dist/commands/cursor-prompt.js +182 -0
- package/dist/commands/dag-approve.js +142 -0
- package/dist/commands/dag-final-verification.js +76 -0
- package/dist/commands/dag-init-hybrid.js +57 -0
- package/dist/commands/dag-reconcile-run.js +5 -0
- package/dist/commands/dag-reconcile-tasks.js +51 -0
- package/dist/commands/dag-reject.js +91 -0
- package/dist/commands/dag-report.js +76 -0
- package/dist/commands/dag-request-interrupt.js +20 -0
- package/dist/commands/dag-rerun-task.js +19 -0
- package/dist/commands/dag-rerun.js +111 -0
- package/dist/commands/dag-resume.js +35 -0
- package/dist/commands/dag-run-task.js +12 -0
- package/dist/commands/dag-validate.js +20 -0
- package/dist/commands/dag-workflow-compile.js +91 -0
- package/dist/commands/dag-workflow-plan.js +130 -0
- package/dist/commands/dag-workflow-validate.js +66 -0
- package/dist/commands/delegate.js +130 -0
- package/dist/commands/docs-archive.js +5 -0
- package/dist/commands/docs-audit.js +6 -0
- package/dist/commands/doctor.js +283 -0
- package/dist/commands/eval.js +1398 -0
- package/dist/commands/examples.js +90 -0
- package/dist/commands/goal.js +92 -0
- package/dist/commands/handoff-check.js +5 -0
- package/dist/commands/harvest.js +44 -0
- package/dist/commands/import-prd.js +81 -0
- package/dist/commands/init-upgrade.js +3085 -0
- package/dist/commands/init.js +3630 -0
- package/dist/commands/inspect.js +11 -0
- package/dist/commands/instructions.js +223 -0
- package/dist/commands/knowledge.js +162 -0
- package/dist/commands/loop-benchmark.js +72 -0
- package/dist/commands/loop.js +251 -0
- package/dist/commands/new-task.js +5 -0
- package/dist/commands/operator.js +44 -0
- package/dist/commands/pi-prompt.js +174 -0
- package/dist/commands/pi-reuse-benchmark.js +153 -0
- package/dist/commands/plan-list.js +5 -0
- package/dist/commands/plan.js +50 -0
- package/dist/commands/promote-run.js +29 -0
- package/dist/commands/reference-index.js +16 -0
- package/dist/commands/run-dag-progress.js +123 -0
- package/dist/commands/run-dag.js +22 -0
- package/dist/commands/spine.js +38 -0
- package/dist/commands/stats.js +113 -0
- package/dist/commands/status.js +57 -0
- package/dist/commands/study-init.js +192 -0
- package/dist/commands/task-advance.js +366 -0
- package/dist/commands/task-contract.js +269 -0
- package/dist/commands/task-source-prepare.js +479 -0
- package/dist/commands/task-status.js +133 -0
- package/dist/commands/workflow.js +259 -0
- package/dist/commands/worktree-create.js +31 -0
- package/dist/commands/worktree-list.js +5 -0
- package/dist/commands/worktree-remove.js +26 -0
- package/dist/executors/config-core.js +5 -0
- package/dist/executors/config.js +2 -0
- package/dist/executors/dag-pi-executor.js +1277 -0
- package/dist/executors/dag-static-executor.js +42 -0
- package/dist/executors/dag.js +3 -0
- package/dist/executors/index.js +6 -0
- package/dist/executors/model-routing.js +71 -0
- package/dist/executors/pi-defaults.js +9 -0
- package/dist/executors/pi-event-serializer.js +65 -0
- package/dist/executors/pi-executor.js +981 -0
- package/dist/executors/pi-playwright-cli-tool.js +1006 -0
- package/dist/executors/pi-prompt-transport.js +198 -0
- package/dist/executors/pi-reuse-benchmark.js +316 -0
- package/dist/executors/pi-runtime-reuse.js +29 -0
- package/dist/executors/pi-sdk-executor.js +722 -0
- package/dist/executors/pi-sdk.js +1 -0
- package/dist/executors/pi-writer-tool-policy.js +266 -0
- package/dist/executors/pi.js +3 -0
- package/dist/executors/playwright-cli-launcher.js +63 -0
- package/dist/executors/process-tree.js +33 -0
- package/dist/executors/shell-executor.js +3055 -0
- package/dist/executors/shell-presets.js +99 -0
- package/dist/executors/shell-verification.js +262 -0
- package/dist/executors/shell-write-guard.js +543 -0
- package/dist/executors/shell.js +3 -0
- package/dist/executors/static.js +1 -0
- package/dist/governance/checks.js +437 -0
- package/dist/governance/document-index-closure.js +164 -0
- package/dist/governance/exec-plans.js +549 -0
- package/dist/governance/harness.js +9 -0
- package/dist/governance/index.js +3 -0
- package/dist/governance/manifest-types.js +254 -0
- package/dist/governance/manifest.js +2 -0
- package/dist/governance/path-guard.js +69 -0
- package/dist/governance/path-guards.js +2 -0
- package/dist/governance/profiles.js +3 -0
- package/dist/governance/requirement-coverage.js +425 -0
- package/dist/governance/skill-safety.js +135 -0
- package/dist/governance/spine-audit.js +155 -0
- package/dist/infrastructure/evaluation/alias-store.js +199 -0
- package/dist/infrastructure/evaluation/campaign-store.js +154 -0
- package/dist/infrastructure/evaluation/candidate-store.js +439 -0
- package/dist/infrastructure/evaluation/corpus-store.js +181 -0
- package/dist/infrastructure/evaluation/experiment-store.js +124 -0
- package/dist/infrastructure/evaluation/ignition-store.js +82 -0
- package/dist/infrastructure/evaluation/private-verifier-store.js +145 -0
- package/dist/infrastructure/evaluation/proposer-store.js +78 -0
- package/dist/infrastructure/evaluation/store.js +40 -0
- package/dist/infrastructure/harness/active-residue-policy.js +73 -0
- package/dist/infrastructure/harness/artifact-store.js +72 -0
- package/dist/infrastructure/harness/atomic-write.js +50 -0
- package/dist/infrastructure/harness/completed-facts-guard.js +40 -0
- package/dist/infrastructure/harness/loop-action-store.js +20 -0
- package/dist/infrastructure/harness/loop-store.js +41 -0
- package/dist/infrastructure/harness/one-shot-run-store.js +94 -0
- package/dist/infrastructure/harness/task-store.js +108 -0
- package/dist/records/closeout.js +2 -0
- package/dist/records/harvest.js +215 -0
- package/dist/records/index.js +3 -0
- package/dist/records/one-shot-runs.js +386 -0
- package/dist/records/promotion.js +200 -0
- package/dist/shared/artifacts-core.js +107 -0
- package/dist/shared/artifacts.js +2 -0
- package/dist/shared/context-files.js +32 -0
- package/dist/shared/context.js +2 -0
- package/dist/shared/copy-dir.js +17 -0
- package/dist/shared/git-progress.js +172 -0
- package/dist/shared/index.js +5 -0
- package/dist/shared/logger.js +17 -0
- package/dist/shared/one-shot-prompt-args.js +98 -0
- package/dist/shared/openspec-spec.js +125 -0
- package/dist/shared/operator/capabilities.js +2659 -0
- package/dist/shared/operator/command-lifecycle.js +94 -0
- package/dist/shared/operator/envelope.js +59 -0
- package/dist/shared/operator/index.js +5 -0
- package/dist/shared/operator/registry.js +38 -0
- package/dist/shared/operator/types.js +5 -0
- package/dist/shared/output-truncation.js +37 -0
- package/dist/shared/package-metadata.js +530 -0
- package/dist/shared/path-refs.js +31 -0
- package/dist/shared/pi-retry-settings.js +23 -0
- package/dist/shared/playwright-cli-command-policy.js +41 -0
- package/dist/shared/preview.js +39 -0
- package/dist/shared/prompts.js +26 -0
- package/dist/shared/reference-context.js +264 -0
- package/dist/shared/resilient-git.js +133 -0
- package/dist/shared/runtime-activity.js +6 -0
- package/dist/shared/timeout-policy.js +24 -0
- package/dist/shared/timeout.js +1 -0
- package/dist/shared/types.js +5 -0
- package/dist/sidecars/cursor-prompt/executor.js +428 -0
- package/dist/sidecars/cursor-prompt/index.js +3 -0
- package/dist/sidecars/cursor-prompt/stream.js +121 -0
- package/dist/task/config-types.js +235 -0
- package/dist/task/config.js +2 -0
- package/dist/task/contract/adopt.js +166 -0
- package/dist/task/contract/apply.js +326 -0
- package/dist/task/contract/canonicalize.js +60 -0
- package/dist/task/contract/constants.js +30 -0
- package/dist/task/contract/diff.js +177 -0
- package/dist/task/contract/hash.js +42 -0
- package/dist/task/contract/import-revision.js +96 -0
- package/dist/task/contract/index.js +17 -0
- package/dist/task/contract/journal.js +155 -0
- package/dist/task/contract/lock.js +153 -0
- package/dist/task/contract/observe.js +296 -0
- package/dist/task/contract/paths.js +19 -0
- package/dist/task/contract/project.js +185 -0
- package/dist/task/contract/recover.js +312 -0
- package/dist/task/contract/request-ledger.js +37 -0
- package/dist/task/contract/schema.js +153 -0
- package/dist/task/contract/transaction.js +160 -0
- package/dist/task/contract/types.js +1 -0
- package/dist/task/contract/validate-draft.js +106 -0
- package/dist/task/dag-source-paths.js +50 -0
- package/dist/task/delegate.js +208 -0
- package/dist/task/frontend-preflight.js +131 -0
- package/dist/task/frontend-project-capability.js +570 -0
- package/dist/task/goal-audit.js +51 -0
- package/dist/task/goal-policy.js +8 -0
- package/dist/task/goal.js +3 -0
- package/dist/task/ids.js +1 -0
- package/dist/task/index.js +12 -0
- package/dist/task/lifecycle.js +1 -0
- package/dist/task/operator/capabilities.js +6 -0
- package/dist/task/operator/envelope.js +2 -0
- package/dist/task/operator/index.js +5 -0
- package/dist/task/operator/registry.js +2 -0
- package/dist/task/operator/types.js +1 -0
- package/dist/task/paths.js +1 -0
- package/dist/task/read-model.js +140 -0
- package/dist/task/runtime.js +708 -0
- package/dist/task/source-prepare/artifact-meta.js +137 -0
- package/dist/task/source-prepare/build-draft.js +232 -0
- package/dist/task/source-prepare/completeness.js +248 -0
- package/dist/task/source-prepare/index.js +10 -0
- package/dist/task/source-prepare/parse-intent.js +496 -0
- package/dist/task/source-prepare/path-policy.js +197 -0
- package/dist/task/source-prepare/placeholder-paths.js +77 -0
- package/dist/task/source-prepare/prepare.js +920 -0
- package/dist/task/source-prepare/reference-integrity.js +290 -0
- package/dist/task/source-prepare/semantic-intake.js +717 -0
- package/dist/task/source-prepare/types.js +7 -0
- package/dist/task/source-references.js +228 -0
- package/dist/task/source-state.js +1 -0
- package/dist/task/state.js +41 -0
- package/dist/task/subagent-guidance.js +1 -0
- package/dist/task/task-demand-routing.js +443 -0
- package/dist/task/workflow-state-types.js +92 -0
- package/dist/task/worktree-cleanup.js +140 -0
- package/dist/task/worktree.js +388 -0
- package/dist/verification/maven/cache.js +142 -0
- package/dist/verification/maven/index.js +120 -0
- package/dist/verification/maven/plan-commands.js +421 -0
- package/dist/verification/maven/pom-static.js +136 -0
- package/dist/verification/maven/scope-resolve.js +153 -0
- package/dist/verification/maven/stale.js +130 -0
- package/dist/verification/maven/types.js +23 -0
- package/dist/verification/maven/workspace-graph.js +322 -0
- package/dist/worker/cli.js +957 -0
- package/dist/worker/closeout/apply.js +73 -0
- package/dist/worker/closeout/preview.js +30 -0
- package/dist/worker/console/app-data.js +316 -0
- package/dist/worker/console/chat/artifact-card.js +30 -0
- package/dist/worker/console/chat/assistant-content.js +121 -0
- package/dist/worker/console/chat/chat-event-store.js +981 -0
- package/dist/worker/console/chat/chat-ui-policy.js +25 -0
- package/dist/worker/console/chat/compaction-errors.js +64 -0
- package/dist/worker/console/chat/composer-draft-store.js +45 -0
- package/dist/worker/console/chat/context-panel.js +54 -0
- package/dist/worker/console/chat/contract-apply-receipt-store.js +174 -0
- package/dist/worker/console/chat/explore-tools.js +299 -0
- package/dist/worker/console/chat/human-gate-card.js +45 -0
- package/dist/worker/console/chat/interview-adapter.js +149 -0
- package/dist/worker/console/chat/mcp-inventory.js +221 -0
- package/dist/worker/console/chat/model-resolver.js +215 -0
- package/dist/worker/console/chat/operation-card.js +92 -0
- package/dist/worker/console/chat/pi-console-config.js +376 -0
- package/dist/worker/console/chat/pi-runtime.js +2446 -0
- package/dist/worker/console/chat/repo-browser.js +140 -0
- package/dist/worker/console/chat/repo-walk.js +125 -0
- package/dist/worker/console/chat/resource-loader.js +59 -0
- package/dist/worker/console/chat/resource-preferences-store.js +152 -0
- package/dist/worker/console/chat/routes.js +3137 -0
- package/dist/worker/console/chat/runtime-context.js +102 -0
- package/dist/worker/console/chat/runtime-selection.js +96 -0
- package/dist/worker/console/chat/semantic-activity.js +489 -0
- package/dist/worker/console/chat/session-store.js +484 -0
- package/dist/worker/console/chat/shortcuts.js +217 -0
- package/dist/worker/console/chat/tool-adapter.js +131 -0
- package/dist/worker/console/chat/tool-preview.js +247 -0
- package/dist/worker/console/chat/tools.js +212 -0
- package/dist/worker/console/chat/turn-execution-registry.js +82 -0
- package/dist/worker/console/chat/turn-process.js +346 -0
- package/dist/worker/console/chat/usage.js +165 -0
- package/dist/worker/console/chat/workspace-landing.js +103 -0
- package/dist/worker/console/dag-confirmation.js +347 -0
- package/dist/worker/console/dag-execution-receipt.js +393 -0
- package/dist/worker/console/doctor.js +230 -0
- package/dist/worker/console/draft-store.js +158 -0
- package/dist/worker/console/harness-pi-model-matrix.js +137 -0
- package/dist/worker/console/human-gate-token.js +130 -0
- package/dist/worker/console/index.js +17 -0
- package/dist/worker/console/inspect-split.js +82 -0
- package/dist/worker/console/interview/assessment.js +67 -0
- package/dist/worker/console/interview/grill-me.js +277 -0
- package/dist/worker/console/interview/session.js +100 -0
- package/dist/worker/console/interview/tools.js +109 -0
- package/dist/worker/console/loopback.js +16 -0
- package/dist/worker/console/mutation-gate-receipt-store.js +184 -0
- package/dist/worker/console/night-aux-ticker.js +146 -0
- package/dist/worker/console/observe-health-match.js +179 -0
- package/dist/worker/console/observe-link.js +42 -0
- package/dist/worker/console/open-browser.js +134 -0
- package/dist/worker/console/operation-run-facts.js +190 -0
- package/dist/worker/console/operation-runner.js +353 -0
- package/dist/worker/console/operation-sse.js +184 -0
- package/dist/worker/console/operation-store.js +169 -0
- package/dist/worker/console/operation-wait.js +355 -0
- package/dist/worker/console/operator-actions.js +3768 -0
- package/dist/worker/console/operator-selection.js +105 -0
- package/dist/worker/console/operator-surface-health.js +24 -0
- package/dist/worker/console/operator-user-error.js +45 -0
- package/dist/worker/console/pi-readiness.js +288 -0
- package/dist/worker/console/prd-identity.js +102 -0
- package/dist/worker/console/prd-intake-bridge.js +441 -0
- package/dist/worker/console/prd-reference-discovery.js +124 -0
- package/dist/worker/console/recovery-cta.js +320 -0
- package/dist/worker/console/recovery-error-copy.js +198 -0
- package/dist/worker/console/recovery-selection.js +107 -0
- package/dist/worker/console/repo-fingerprint.js +35 -0
- package/dist/worker/console/resolve-dag-run-for-task.js +115 -0
- package/dist/worker/console/resource-loader.js +95 -0
- package/dist/worker/console/routes.js +475 -0
- package/dist/worker/console/security.js +170 -0
- package/dist/worker/console/server.js +357 -0
- package/dist/worker/console/sibling-controller.js +33 -0
- package/dist/worker/console/static/assets/abnfDiagram-N423BO3Z-BmOEx0gA.js +1 -0
- package/dist/worker/console/static/assets/arc-BGiVVe8b.js +1 -0
- package/dist/worker/console/static/assets/architectureDiagram-T3A2C74G-nDdu4rgJ.js +36 -0
- package/dist/worker/console/static/assets/blockDiagram-VBNYF7ZC-Bb5u0BWf.js +132 -0
- package/dist/worker/console/static/assets/c4Diagram-5PPSVZJV-BlhC0j94.js +10 -0
- package/dist/worker/console/static/assets/channel-Tl-FkUqr.js +1 -0
- package/dist/worker/console/static/assets/chunk-2GRJ4B5K-Ai8_qQXI.js +1 -0
- package/dist/worker/console/static/assets/chunk-2Q5K7J3B-B9gyCjqX.js +1 -0
- package/dist/worker/console/static/assets/chunk-5RXB4S5H-Bzbj3zGH.js +231 -0
- package/dist/worker/console/static/assets/chunk-5VM5RSS4-BT415PvT.js +15 -0
- package/dist/worker/console/static/assets/chunk-6Q2QTUOP-D_A5_5QL.js +88 -0
- package/dist/worker/console/static/assets/chunk-GF5L2VYU-srJkaP3f.js +206 -0
- package/dist/worker/console/static/assets/chunk-JWPE2WC7-UYGvEP4l.js +1 -0
- package/dist/worker/console/static/assets/chunk-KBJHAD2P-B8luBrrz.js +1 -0
- package/dist/worker/console/static/assets/chunk-RYQCIY6F-DN7wXZSq.js +1 -0
- package/dist/worker/console/static/assets/chunk-XXDRQBXY-DXKyMuKS.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-BaehtRk4.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-BaehtRk4.js +1 -0
- package/dist/worker/console/static/assets/cose-bilkent-JH36ORCC-dqvoynXj.js +1 -0
- package/dist/worker/console/static/assets/cynefin-VYW2F7L2--PcyL34A.js +166 -0
- package/dist/worker/console/static/assets/cynefinDiagram-MW4NZA55-DvWs_hTY.js +62 -0
- package/dist/worker/console/static/assets/cytoscape.esm-yzknjiTM.js +321 -0
- package/dist/worker/console/static/assets/dagre-VZM6K2ZE-DxeIxbyO.js +4 -0
- package/dist/worker/console/static/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/worker/console/static/assets/diagram-7IWD3JNH-DPCG61Of.js +30 -0
- package/dist/worker/console/static/assets/diagram-B4RE2ZJO-CmuU50-U.js +3 -0
- package/dist/worker/console/static/assets/diagram-LBJQPF4R-B61XLD_v.js +24 -0
- package/dist/worker/console/static/assets/diagram-Q27KOJAE-BB7HTRRY.js +24 -0
- package/dist/worker/console/static/assets/diagram-UB23O5K3-DvkboAIp.js +41 -0
- package/dist/worker/console/static/assets/ebnfDiagram-BXEA7PRR-BdJ_y1fL.js +1 -0
- package/dist/worker/console/static/assets/erDiagram-JOGREHBK-9bUBZTRi.js +85 -0
- package/dist/worker/console/static/assets/flowDiagram-UKHOOZJN-Dw4L4RBa.js +156 -0
- package/dist/worker/console/static/assets/ganttDiagram-PKOTCBZU-Jr82N_QP.js +292 -0
- package/dist/worker/console/static/assets/gitGraphDiagram-DS77QQ5N-DAz9wFLr.js +106 -0
- package/dist/worker/console/static/assets/graph-DOmOIIwC.js +1 -0
- package/dist/worker/console/static/assets/index-B7Y-0g3J.css +1 -0
- package/dist/worker/console/static/assets/index-DkCrqaYg.js +325 -0
- package/dist/worker/console/static/assets/infoDiagram-6WML65LV-CBB5Np7y.js +2 -0
- package/dist/worker/console/static/assets/init-Gi6I4Gst.js +1 -0
- package/dist/worker/console/static/assets/ishikawaDiagram-WSZJBQD7-D8IOp94y.js +70 -0
- package/dist/worker/console/static/assets/journeyDiagram-NVQOT4AX-Dgd3AHGG.js +139 -0
- package/dist/worker/console/static/assets/kanban-definition-27J2QSJJ-BmYOxLE9.js +89 -0
- package/dist/worker/console/static/assets/layout-D-LzfAck.js +1 -0
- package/dist/worker/console/static/assets/linear-DfYTEF6J.js +1 -0
- package/dist/worker/console/static/assets/map-DxJ2ADlA.js +1 -0
- package/dist/worker/console/static/assets/mermaid.core-BjuFPRqa.js +308 -0
- package/dist/worker/console/static/assets/mindmap-definition-FAOFIHXS-CLyUViGd.js +96 -0
- package/dist/worker/console/static/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/worker/console/static/assets/pegDiagram-VL7TDLO6-BvX2Di4-.js +1 -0
- package/dist/worker/console/static/assets/pieDiagram-7S7Q4E2Y-BFj0_OLv.js +39 -0
- package/dist/worker/console/static/assets/quadrantDiagram-CIZ2JOQS-BIUrD_hx.js +7 -0
- package/dist/worker/console/static/assets/railroadDiagram-AXF67PYL-CHBB48fj.js +1 -0
- package/dist/worker/console/static/assets/requirementDiagram-LRYGKXZP-sJrYw2Sf.js +84 -0
- package/dist/worker/console/static/assets/sankeyDiagram-W5VNT64P-BzHH6fPR.js +40 -0
- package/dist/worker/console/static/assets/sequenceDiagram-SI44F4Z6-7QCnelCt.js +162 -0
- package/dist/worker/console/static/assets/sizeCapture-X5ZJPWSS-sDYSxn72.js +1 -0
- package/dist/worker/console/static/assets/stateDiagram-OKZ733FA-XpiUdwzm.js +1 -0
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-eEhq2A8Y.js +1 -0
- package/dist/worker/console/static/assets/swimlanes-SLNWSIFB-DvqgNPzD.js +2 -0
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-la8AC7fo.js +8 -0
- package/dist/worker/console/static/assets/timeline-definition-Z64GVDOM-2TyOYNx0.js +120 -0
- package/dist/worker/console/static/assets/vennDiagram-T6HMQDX7-B-nM6wM2.js +34 -0
- package/dist/worker/console/static/assets/wardleyDiagram-T6FBY63Y-B86wPdbr.js +78 -0
- package/dist/worker/console/static/assets/xychartDiagram-ELKLHX3M-Dr1C4AQz.js +7 -0
- package/dist/worker/console/static/favicon.svg +37 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/worker/console/static/fonts/katex/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/worker/console/static/index.html +15 -0
- package/dist/worker/console/static-src/app/console-types.js +184 -0
- package/dist/worker/console/static-src/app/useConsoleShell.js +101 -0
- package/dist/worker/console/static-src/app/useOperatorActions.js +324 -0
- package/dist/worker/console/static-src/app/usePrdImport.js +172 -0
- package/dist/worker/console/static-src/app/useRecoveryActions.js +289 -0
- package/dist/worker/console/static-src/app/useRecoveryConsole.js +425 -0
- package/dist/worker/console/static-src/app/useTaskWizard.js +296 -0
- package/dist/worker/console/static-src/chat-markdown-security.js +38 -0
- package/dist/worker/console/static-src/chat-view-types.js +2 -0
- package/dist/worker/console/static-src/night/night-types.js +24 -0
- package/dist/worker/console/static-src/night/useNightBoard.js +94 -0
- package/dist/worker/console/static-src/night/useNightWizard.js +171 -0
- package/dist/worker/console/static-src/night-prepare-result.js +118 -0
- package/dist/worker/console/static-src/operator-chat/activity-journey.js +125 -0
- package/dist/worker/console/static-src/operator-chat/activity-rail-presentation.js +73 -0
- package/dist/worker/console/static-src/operator-chat/activity-references.js +20 -0
- package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +420 -0
- package/dist/worker/console/static-src/operator-chat/format.js +71 -0
- package/dist/worker/console/static-src/operator-chat/landing-density.js +23 -0
- package/dist/worker/console/static-src/operator-chat/mutation-gate.js +45 -0
- package/dist/worker/console/static-src/operator-chat/refs.js +86 -0
- package/dist/worker/console/static-src/operator-chat/resource-auto-invocation.js +91 -0
- package/dist/worker/console/static-src/operator-chat/resource-diagnostics.js +204 -0
- package/dist/worker/console/static-src/operator-chat/runtime-snapshot-store.js +257 -0
- package/dist/worker/console/static-src/operator-chat/session-title-watcher.js +128 -0
- package/dist/worker/console/static-src/operator-chat/sidebar-split.js +90 -0
- package/dist/worker/console/static-src/operator-chat/slash-palette-layout.js +24 -0
- package/dist/worker/console/static-src/operator-chat/slash-palette-nav.js +141 -0
- package/dist/worker/console/static-src/operator-chat/spatial-overlay.js +38 -0
- package/dist/worker/console/static-src/operator-chat/tools-catalog.js +77 -0
- package/dist/worker/console/static-src/operator-chat/turn-stream-controller.js +690 -0
- package/dist/worker/console/static-src/operator-chat/turn-submission.js +158 -0
- package/dist/worker/console/static-src/operator-chat/types.js +1 -0
- package/dist/worker/console/static-src/operator-chat/useActivityRailTransition.js +59 -0
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +495 -0
- package/dist/worker/console/static-src/operator-chat/useChatStream.js +780 -0
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +280 -0
- package/dist/worker/console/static-src/operator-chat/useComposer.js +257 -0
- package/dist/worker/console/static-src/operator-chat/useInterview.js +108 -0
- package/dist/worker/console/static-src/operator-chat/useOverlayFocus.js +84 -0
- package/dist/worker/console/static-src/operator-chat/useRepoBrowser.js +148 -0
- package/dist/worker/console/static-src/operator-chat/useRuntimeControls.js +358 -0
- package/dist/worker/console/static-src/operator-chat/useRuntimeSnapshot.js +196 -0
- package/dist/worker/console/static-src/operator-chat/useWorkspaceLayout.js +58 -0
- package/dist/worker/console/static-src/operator-chat/workspace-layout-mode.js +35 -0
- package/dist/worker/console/static-src/prd-file-import.js +218 -0
- package/dist/worker/console/vite.config.js +27 -0
- package/dist/worker/console/workflow-kinds.js +46 -0
- package/dist/worker/delivery/final-verification.js +302 -0
- package/dist/worker/delivery/git-transaction.js +497 -0
- package/dist/worker/delivery/package.js +537 -0
- package/dist/worker/delivery/verification-bundle.js +544 -0
- package/dist/worker/feature/acceptance-policy.js +227 -0
- package/dist/worker/feature/advance.js +301 -0
- package/dist/worker/feature/decision-loader.js +99 -0
- package/dist/worker/feature/discover.js +14 -0
- package/dist/worker/feature/doctor.js +223 -0
- package/dist/worker/feature/fullstack-validate.js +337 -0
- package/dist/worker/feature/next-action.js +140 -0
- package/dist/worker/feature/profile-schema.js +47 -0
- package/dist/worker/feature/ready-plan-projection.js +82 -0
- package/dist/worker/feature/reducer.js +137 -0
- package/dist/worker/feature/review.js +678 -0
- package/dist/worker/feature/run.js +390 -0
- package/dist/worker/feature/scaffold.js +812 -0
- package/dist/worker/feature/types.js +1 -0
- package/dist/worker/follow-up/approve.js +273 -0
- package/dist/worker/follow-up/factory.js +234 -0
- package/dist/worker/follow-up/paths.js +25 -0
- package/dist/worker/follow-up/policy.js +26 -0
- package/dist/worker/follow-up/schema.js +93 -0
- package/dist/worker/follow-up/store.js +96 -0
- package/dist/worker/loop-agent/command-result.js +1 -0
- package/dist/worker/loop-agent/controller-protocol.js +143 -0
- package/dist/worker/loop-agent/loop-agent-client.js +489 -0
- package/dist/worker/loop-agent/parse-json.js +14 -0
- package/dist/worker/materialize/harness-task-lifecycle-probe.js +126 -0
- package/dist/worker/materialize/harness-task-lineage.js +220 -0
- package/dist/worker/materialize/harness-task-materializer.js +648 -0
- package/dist/worker/metrics/projector.js +139 -0
- package/dist/worker/observability/dag-execution-trajectory.js +591 -0
- package/dist/worker/observability/event-history.js +216 -0
- package/dist/worker/observability/event-store.js +83 -0
- package/dist/worker/observability/events.js +79 -0
- package/dist/worker/observability/interrupt-eligibility.js +264 -0
- package/dist/worker/observability/progress-composite.js +34 -0
- package/dist/worker/observability/read-model.js +2499 -0
- package/dist/worker/observability/snapshot-store.js +43 -0
- package/dist/worker/observability/types.js +1 -0
- package/dist/worker/observe/dag-node-execution-output.js +180 -0
- package/dist/worker/observe/dag-run-artifacts.js +90 -0
- package/dist/worker/observe/health.js +58 -0
- package/dist/worker/observe/night-jobs.js +104 -0
- package/dist/worker/observe/node-input.js +441 -0
- package/dist/worker/observe/paths.js +174 -0
- package/dist/worker/observe/routes.js +1077 -0
- package/dist/worker/observe/server.js +117 -0
- package/dist/worker/observe/spec-evidence.js +398 -0
- package/dist/worker/observe/static/api.js +117 -0
- package/dist/worker/observe/static/app.js +169 -0
- package/dist/worker/observe/static/constants.js +182 -0
- package/dist/worker/observe/static/copy.js +67 -0
- package/dist/worker/observe/static/custom-select.js +567 -0
- package/dist/worker/observe/static/dag-edge-routing.js +368 -0
- package/dist/worker/observe/static/dag-helpers.js +161 -0
- package/dist/worker/observe/static/dag-history-labels.js +95 -0
- package/dist/worker/observe/static/dag-layout.d.ts +36 -0
- package/dist/worker/observe/static/dag-layout.js +163 -0
- package/dist/worker/observe/static/dag-model.js +145 -0
- package/dist/worker/observe/static/dom.js +220 -0
- package/dist/worker/observe/static/favicon.svg +37 -0
- package/dist/worker/observe/static/format-pool.d.ts +71 -0
- package/dist/worker/observe/static/format-pool.js +153 -0
- package/dist/worker/observe/static/format.js +347 -0
- package/dist/worker/observe/static/index.html +409 -0
- package/dist/worker/observe/static/kpi.js +78 -0
- package/dist/worker/observe/static/markdown-render.js +124 -0
- package/dist/worker/observe/static/operator-chrome.css +517 -0
- package/dist/worker/observe/static/operator-chrome.d.ts +83 -0
- package/dist/worker/observe/static/operator-chrome.js +623 -0
- package/dist/worker/observe/static/relations.js +133 -0
- package/dist/worker/observe/static/router.js +156 -0
- package/dist/worker/observe/static/run-processing.js +148 -0
- package/dist/worker/observe/static/shell-chrome.js +65 -0
- package/dist/worker/observe/static/state.js +496 -0
- package/dist/worker/observe/static/styles.css +3567 -0
- package/dist/worker/observe/static/views/batch.js +227 -0
- package/dist/worker/observe/static/views/dag-graph.js +508 -0
- package/dist/worker/observe/static/views/dag-inspector.js +1722 -0
- package/dist/worker/observe/static/views/dag-trajectory.js +313 -0
- package/dist/worker/observe/static/views/dag.js +483 -0
- package/dist/worker/observe/static/views/dags.js +877 -0
- package/dist/worker/observe/static/views/dashboard.js +747 -0
- package/dist/worker/observe/static/views/failures.js +143 -0
- package/dist/worker/observe/static/views/feature.js +492 -0
- package/dist/worker/observe/static/views/night.js +201 -0
- package/dist/worker/observe/static/views/pool.js +708 -0
- package/dist/worker/observe/static/views/run.js +453 -0
- package/dist/worker/observe/static/views/session-timeline.js +771 -0
- package/dist/worker/observe/static/views/shell.js +7 -0
- package/dist/worker/observe/static/views/task.js +315 -0
- package/dist/worker/observe/static/views/timeline.js +163 -0
- package/dist/worker/outcomes/adapters.js +153 -0
- package/dist/worker/outcomes/declared-artifacts.js +103 -0
- package/dist/worker/outcomes/evidence-tokens.js +29 -0
- package/dist/worker/outcomes/gate.js +40 -0
- package/dist/worker/outcomes/projector.js +227 -0
- package/dist/worker/outcomes/registry.js +1 -0
- package/dist/worker/outcomes/store.js +131 -0
- package/dist/worker/outcomes/types.js +79 -0
- package/dist/worker/pool/attempt-identity.js +41 -0
- package/dist/worker/pool/attempt-lease.js +184 -0
- package/dist/worker/pool/attempt-transition.js +210 -0
- package/dist/worker/pool/begin-attempt-with-lease.js +26 -0
- package/dist/worker/pool/begin-attempt.js +35 -0
- package/dist/worker/pool/doctor.js +165 -0
- package/dist/worker/pool/failure-routing.js +182 -0
- package/dist/worker/pool/migrate-state.js +303 -0
- package/dist/worker/pool/reconcile.js +285 -0
- package/dist/worker/pool/recovery-decision.js +163 -0
- package/dist/worker/pool/run-owner-store.js +126 -0
- package/dist/worker/pool/run-store.js +360 -0
- package/dist/worker/pool/runtime-reconcile-inventory.js +127 -0
- package/dist/worker/pool/state-projection.js +57 -0
- package/dist/worker/pool/types.js +17 -0
- package/dist/worker/pool/validation.js +144 -0
- package/dist/worker/preflight.js +157 -0
- package/dist/worker/profile-mapping.js +76 -0
- package/dist/worker/progress-reporter.js +63 -0
- package/dist/worker/report/morning-report.js +155 -0
- package/dist/worker/repos/repo-resolver.js +23 -0
- package/dist/worker/run-task/execute-prepared-task.js +178 -0
- package/dist/worker/run-task/run-task.js +912 -0
- package/dist/worker/runner/run-ready.js +561 -0
- package/dist/worker/runner/single-task-attempt.js +176 -0
- package/dist/worker/scheduler/admission.js +547 -0
- package/dist/worker/scheduler/auto-followup.js +99 -0
- package/dist/worker/scheduler/cli.js +644 -0
- package/dist/worker/scheduler/clock-install/darwin-launchd.js +238 -0
- package/dist/worker/scheduler/clock-install/linux-systemd-user.js +224 -0
- package/dist/worker/scheduler/clock-install/types.js +1 -0
- package/dist/worker/scheduler/clock-install/win32-schtasks.js +227 -0
- package/dist/worker/scheduler/clock-install.js +284 -0
- package/dist/worker/scheduler/clock.js +420 -0
- package/dist/worker/scheduler/dispatcher.js +503 -0
- package/dist/worker/scheduler/doctor.js +431 -0
- package/dist/worker/scheduler/evidence.js +170 -0
- package/dist/worker/scheduler/git-base.js +90 -0
- package/dist/worker/scheduler/index.js +25 -0
- package/dist/worker/scheduler/lease.js +114 -0
- package/dist/worker/scheduler/lifecycle.js +348 -0
- package/dist/worker/scheduler/lock.js +80 -0
- package/dist/worker/scheduler/morning-window.js +191 -0
- package/dist/worker/scheduler/night-git-finalizer.js +114 -0
- package/dist/worker/scheduler/night-harvest.js +412 -0
- package/dist/worker/scheduler/paths.js +92 -0
- package/dist/worker/scheduler/prepared-attempt-recovery.js +471 -0
- package/dist/worker/scheduler/recovery.js +277 -0
- package/dist/worker/scheduler/reservation.js +146 -0
- package/dist/worker/scheduler/retry.js +199 -0
- package/dist/worker/scheduler/scheduler-loop.js +272 -0
- package/dist/worker/scheduler/store.js +275 -0
- package/dist/worker/scheduler/traceability.js +54 -0
- package/dist/worker/scheduler/trigger.js +258 -0
- package/dist/worker/scheduler/types.js +369 -0
- package/dist/worker/scheduler/workspace-adapter.js +128 -0
- package/dist/worker/task-graph/acceptance-schema.js +40 -0
- package/dist/worker/task-graph/ready-planner.js +267 -0
- package/dist/worker/task-graph/ready-queue.js +23 -0
- package/dist/worker/task-graph/task-graph-schema.js +59 -0
- package/dist/worker/task-graph/types.js +1 -0
- package/dist/worker/task-graph/validate.js +293 -0
- package/dist/worker/task-spec/complexity-mapping.js +8 -0
- package/dist/worker/task-spec/schema.js +125 -0
- package/dist/worker/task-spec/types.js +1 -0
- package/dist/worker/task-spec/validate.js +391 -0
- package/dist/worker/task-spec/workflow-routing.js +149 -0
- package/dist/workflows/dag/authoring.js +8 -0
- package/dist/workflows/dag/authority-surface.js +138 -0
- package/dist/workflows/dag/backend-test-analysis-contract.js +507 -0
- package/dist/workflows/dag/backend-test-case-coverage-analysis.js +1985 -0
- package/dist/workflows/dag/backend-test-case-manifest.js +638 -0
- package/dist/workflows/dag/backend-test-classification-contract.js +38 -0
- package/dist/workflows/dag/backend-test-contract-envelope.js +205 -0
- package/dist/workflows/dag/backend-test-coverage-contract.js +202 -0
- package/dist/workflows/dag/backend-test-execution-contract.js +715 -0
- package/dist/workflows/dag/backend-test-gap-fill.js +205 -0
- package/dist/workflows/dag/backend-test-intake-context.js +178 -0
- package/dist/workflows/dag/backend-test-layout.js +133 -0
- package/dist/workflows/dag/backend-test-markdown-workflow.js +1984 -0
- package/dist/workflows/dag/backend-test-module-stem.js +26 -0
- package/dist/workflows/dag/backend-test-pytest-collection.js +859 -0
- package/dist/workflows/dag/backend-test-result-contract.js +1030 -0
- package/dist/workflows/dag/backend-test-scenario-param.js +1670 -0
- package/dist/workflows/dag/backend-test-scenario-partitions.js +249 -0
- package/dist/workflows/dag/backend-test-semantic-review-contract.js +36 -0
- package/dist/workflows/dag/backend-test-stability-contract.js +57 -0
- package/dist/workflows/dag/backend-test-writer-completeness.js +1058 -0
- package/dist/workflows/dag/budget-enforcement.js +67 -0
- package/dist/workflows/dag/canvas-observer.js +474 -0
- package/dist/workflows/dag/context-policy.js +137 -0
- package/dist/workflows/dag/contract-output-registry.js +14 -0
- package/dist/workflows/dag/contract-validator-registrations.js +10 -0
- package/dist/workflows/dag/controller-identity.js +104 -0
- package/dist/workflows/dag/convergence/controller.js +596 -0
- package/dist/workflows/dag/decision-envelope.js +557 -0
- package/dist/workflows/dag/decision-evidence.js +153 -0
- package/dist/workflows/dag/decision-gates.js +1 -0
- package/dist/workflows/dag/dynamic-runtime/condition.js +48 -0
- package/dist/workflows/dag/dynamic-runtime/loop-until.js +161 -0
- package/dist/workflows/dag/dynamic-runtime/map.js +435 -0
- package/dist/workflows/dag/dynamic-runtime/reduction.js +72 -0
- package/dist/workflows/dag/dynamic-runtime/shared.js +203 -0
- package/dist/workflows/dag/event-observer.js +132 -0
- package/dist/workflows/dag/executor-registry.js +23 -0
- package/dist/workflows/dag/facts.js +4 -0
- package/dist/workflows/dag/failure-category.js +118 -0
- package/dist/workflows/dag/failure-routing.js +105 -0
- package/dist/workflows/dag/final-verification.js +180 -0
- package/dist/workflows/dag/frontend-implementation-contract.js +1911 -0
- package/dist/workflows/dag/frontend-lint-baseline.js +474 -0
- package/dist/workflows/dag/frontend-plan-render.js +90 -0
- package/dist/workflows/dag/frontend-prewrite-gate.js +1011 -0
- package/dist/workflows/dag/frontend-project-capability.js +1 -0
- package/dist/workflows/dag/frontend-recovery-plan.js +73 -0
- package/dist/workflows/dag/frontend-recovery-root-manifest.js +123 -0
- package/dist/workflows/dag/frontend-recovery-run.js +539 -0
- package/dist/workflows/dag/frontend-repair.js +541 -0
- package/dist/workflows/dag/frontend-review-context.js +116 -0
- package/dist/workflows/dag/frontend-risk.js +161 -0
- package/dist/workflows/dag/frontend-test-case-checklist.js +343 -0
- package/dist/workflows/dag/frontend-test-case-manifest.js +104 -0
- package/dist/workflows/dag/frontend-test-case-quality.js +105 -0
- package/dist/workflows/dag/frontend-test-html-report.js +174 -0
- package/dist/workflows/dag/frontend-test-l5-report.js +177 -0
- package/dist/workflows/dag/frontend-test-result-contract.js +487 -0
- package/dist/workflows/dag/frontend-verification-trace.js +275 -0
- package/dist/workflows/dag/frontend-worktree-diff.js +201 -0
- package/dist/workflows/dag/frontend-writer-recovery.js +106 -0
- package/dist/workflows/dag/frontend-writer-rollback.js +821 -0
- package/dist/workflows/dag/governance-constants.js +5 -0
- package/dist/workflows/dag/governance-profile.js +413 -0
- package/dist/workflows/dag/index.js +6 -0
- package/dist/workflows/dag/init-hybrid.js +7345 -0
- package/dist/workflows/dag/interrupt-request.js +559 -0
- package/dist/workflows/dag/knowledge-curator.js +165 -0
- package/dist/workflows/dag/l5-report-metrics.js +33 -0
- package/dist/workflows/dag/lifecycle.js +855 -0
- package/dist/workflows/dag/liveness-policy.js +251 -0
- package/dist/workflows/dag/node-execution.js +1081 -0
- package/dist/workflows/dag/observer-compose.js +52 -0
- package/dist/workflows/dag/output-protocol.js +356 -0
- package/dist/workflows/dag/project-governance-context.js +514 -0
- package/dist/workflows/dag/prompt-source.js +88 -0
- package/dist/workflows/dag/prompt.js +348 -0
- package/dist/workflows/dag/reconcile-run.js +145 -0
- package/dist/workflows/dag/reconcile-tasks.js +404 -0
- package/dist/workflows/dag/recovery-recommendation.js +329 -0
- package/dist/workflows/dag/repair-artifact.js +363 -0
- package/dist/workflows/dag/report.js +1229 -0
- package/dist/workflows/dag/rerun-plan.js +614 -0
- package/dist/workflows/dag/rerun-run.js +556 -0
- package/dist/workflows/dag/rerun-task.js +370 -0
- package/dist/workflows/dag/retry-policy.js +263 -0
- package/dist/workflows/dag/run-store.js +41 -0
- package/dist/workflows/dag/runner.js +1069 -0
- package/dist/workflows/dag/runtime-contract.js +87 -0
- package/dist/workflows/dag/runtime.js +5 -0
- package/dist/workflows/dag/scheduler.js +497 -0
- package/dist/workflows/dag/sdd-embedded.js +128 -0
- package/dist/workflows/dag/skill-instructions.js +478 -0
- package/dist/workflows/dag/skill-snapshot.js +553 -0
- package/dist/workflows/dag/skills.js +41 -0
- package/dist/workflows/dag/spec.js +3 -0
- package/dist/workflows/dag/task-contract-binding.js +138 -0
- package/dist/workflows/dag/task-demand-routing.js +1 -0
- package/dist/workflows/dag/topo.js +30 -0
- package/dist/workflows/dag/types.js +1145 -0
- package/dist/workflows/dag/upstream-artifacts.js +98 -0
- package/dist/workflows/dag/validate.js +998 -0
- package/dist/workflows/dag/workspace-checkpoint.js +186 -0
- package/dist/workflows/dynamic/artifacts.js +65 -0
- package/dist/workflows/dynamic/compile.js +371 -0
- package/dist/workflows/dynamic/compileTypes.js +1 -0
- package/dist/workflows/dynamic/errors.js +5 -0
- package/dist/workflows/dynamic/index.js +7 -0
- package/dist/workflows/dynamic/profiles.js +156 -0
- package/dist/workflows/dynamic/spec.js +115 -0
- package/dist/workflows/dynamic/validate.js +275 -0
- package/dist/workflows/loop/actions/dag-action.js +129 -0
- package/dist/workflows/loop/actions/pi-review.js +267 -0
- package/dist/workflows/loop/actions/shared.js +157 -0
- package/dist/workflows/loop/actions/shell-verify.js +82 -0
- package/dist/workflows/loop/actions/types.js +1 -0
- package/dist/workflows/loop/actions/workflow-action.js +255 -0
- package/dist/workflows/loop/actions.js +160 -0
- package/dist/workflows/loop/benchmark.js +510 -0
- package/dist/workflows/loop/closeout.js +135 -0
- package/dist/workflows/loop/context.js +47 -0
- package/dist/workflows/loop/events.js +26 -0
- package/dist/workflows/loop/hash.js +32 -0
- package/dist/workflows/loop/index.js +8 -0
- package/dist/workflows/loop/paths.js +17 -0
- package/dist/workflows/loop/policy/auto-policy.js +112 -0
- package/dist/workflows/loop/policy/path-patterns.js +13 -0
- package/dist/workflows/loop/rounds.js +81 -0
- package/dist/workflows/loop/signals.js +52 -0
- package/dist/workflows/loop/state.js +116 -0
- package/dist/workflows/loop/templates.js +54 -0
- package/dist/workflows/loop/types.js +28 -0
- package/docs/README.md +82 -0
- package/docs/architecture/README.md +35 -0
- package/docs/architecture/dag-execution.md +165 -0
- package/docs/architecture/evolution.md +108 -0
- package/docs/architecture/facts-and-state.md +74 -0
- package/docs/architecture/runtime-boundaries.md +226 -0
- package/docs/architecture/system-overview.md +100 -0
- package/docs/architecture/worker-and-feature.md +122 -0
- package/docs/governance/README.md +18 -0
- package/docs/governance/harness-methodology-debugging.md +177 -0
- package/docs/governance/harness-methodology-tdd.md +130 -0
- package/docs/governance/harness-methodology-verification.md +27 -0
- package/docs/init-surface.manifest.json +358 -0
- package/docs/operations/README.md +15 -0
- package/docs/operations/local-development-environment.md +77 -0
- package/docs/skills/README.md +7 -0
- package/docs/skills/vetted-skill-registry.md +49 -0
- package/docs/templates/README.md +67 -0
- package/docs/templates/adr.md +60 -0
- package/docs/templates/agent-dag-authority-surface-audit.prompt.md +94 -0
- package/docs/templates/agent-dag-decision-envelope.schema.json +213 -0
- package/docs/templates/agent-dag-decision-gate-dogfood-report.md +117 -0
- package/docs/templates/agent-dag-decision-gate.prompt.md +246 -0
- package/docs/templates/agent-dag-process-supervisor.prompt.md +98 -0
- package/docs/templates/agent-dag-report.schema.json +473 -0
- package/docs/templates/agent-dag-review-verdict.prompt.md +68 -0
- package/docs/templates/agent-dag.base.json +190 -0
- package/docs/templates/agent-dag.final-verification.json +185 -0
- package/docs/templates/agent-dag.schema.json +590 -0
- package/docs/templates/agent-dag.supervised-implementation.json +640 -0
- package/docs/templates/agent-worker-production-readiness-checklist.md +47 -0
- package/docs/templates/backend-test-analysis.schema.json +37 -0
- package/docs/templates/backend-test-case-manifest.schema.json +223 -0
- package/docs/templates/backend-test-dag.classify.prompt.md +75 -0
- package/docs/templates/backend-test-dag.generate-pytest.prompt.md +41 -0
- package/docs/templates/backend-test-dag.json +671 -0
- package/docs/templates/backend-test-dag.retrospect.prompt.md +165 -0
- package/docs/templates/backend-test-dag.review-cases.prompt.md +36 -0
- package/docs/templates/backend-test-execution.schema.json +138 -0
- package/docs/templates/backend-test-result.schema.json +99 -0
- package/docs/templates/branch-merge-report.md +115 -0
- package/docs/templates/evaluation/agents-map-slim-v1.candidate.json +9 -0
- package/docs/templates/evaluation/agents-map-slim-v1.md +87 -0
- package/docs/templates/evaluation/agents-map-verbose-v0.candidate.json +9 -0
- package/docs/templates/evaluation/agents-map-verbose-v0.md +153 -0
- package/docs/templates/evaluation/campaign-budget-v1.json +12 -0
- package/docs/templates/evaluation/campaign-dogfood-v0.json +24 -0
- package/docs/templates/evaluation/campaign-evidence-v1.json +44 -0
- package/docs/templates/evaluation/context-policy-baseline-v1.json +17 -0
- package/docs/templates/evaluation/context-policy-role-specialized-v1.json +28 -0
- package/docs/templates/evaluation/corpus-dogfood-v0.manifest.json +118 -0
- package/docs/templates/evaluation/matrix-dag-dry-run-v1.json +21 -0
- package/docs/templates/evaluation/matrix-fixture-v1.json +10 -0
- package/docs/templates/evaluation/private-verifier-dogfood-v0.json +16 -0
- package/docs/templates/exec-plan.md +66 -0
- package/docs/templates/feature-spec.md +53 -0
- package/docs/templates/frontend-design-contract.md +68 -0
- package/docs/templates/frontend-eval/fixtures/failures/01-type-build-error.md +17 -0
- package/docs/templates/frontend-eval/fixtures/failures/02-unit-component-test-fail.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/03-fixture-schema-drift.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/04-missing-loading-empty-error-state.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/05-forbidden-write-writeset-expansion.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/06-unapproved-dependency-add.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/07-mock-production-on.md +21 -0
- package/docs/templates/frontend-eval/fixtures/functional/01-simple-component-style.md +29 -0
- package/docs/templates/frontend-eval/fixtures/functional/02-form-validation.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/03-list-detail-page.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/04-api-mock.md +29 -0
- package/docs/templates/frontend-eval/fixtures/functional/05-permission-auth-gated-ui.md +27 -0
- package/docs/templates/frontend-eval/fixtures/functional/06-ssr-server-client-boundary.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/07-shared-public-component-api.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/08-pure-local-no-remote.md +27 -0
- package/docs/templates/frontend-eval/metrics.md +138 -0
- package/docs/templates/frontend-eval/smoke-targets.md +53 -0
- package/docs/templates/frontend-implementation-contract.schema.json +35 -0
- package/docs/templates/frontend-task-constraints.md +62 -0
- package/docs/templates/frontend-task-requirement.md +104 -0
- package/docs/templates/frontend-test-case-checklist.md +44 -0
- package/docs/templates/frontend-test-case.example.md +143 -0
- package/docs/templates/frontend-test-dag.generate-cases.prompt.md +63 -0
- package/docs/templates/frontend-test-dag.json +409 -0
- package/docs/templates/frontend-test-dag.retrieve-context.prompt.md +21 -0
- package/docs/templates/frontend-test-dag.retrospect.prompt.md +5 -0
- package/docs/templates/frontend-test-dag.review-cases.prompt.md +5 -0
- package/docs/templates/frontend-test-dag.review-execution.prompt.md +3 -0
- package/docs/templates/frontend-test-standard-scenarios.v1.json +159 -0
- package/docs/templates/harness.schema.json +351 -0
- package/docs/templates/hybrid-dag.json +188 -0
- package/docs/templates/init-evolution-review.md +35 -0
- package/docs/templates/init-managed-agents.md +157 -0
- package/docs/templates/interactive-ui-round2-experiment.md +66 -0
- package/docs/templates/knowledge-graph-bootstrap-dag.json +118 -0
- package/docs/templates/knowledge-sync-dag.json +178 -0
- package/docs/templates/knowledge-sync-draft.schema.json +71 -0
- package/docs/templates/product-line/AGENTS.md +9 -0
- package/docs/templates/product-line/README.md +42 -0
- package/docs/templates/product-line/acceptance.yaml +23 -0
- package/docs/templates/product-line/closeout.yaml +9 -0
- package/docs/templates/product-line/design.md +13 -0
- package/docs/templates/product-line/feature-scaffold-batch.example.yaml +31 -0
- package/docs/templates/product-line/feature.yaml +11 -0
- package/docs/templates/product-line/links.md +10 -0
- package/docs/templates/product-line/requirement.md +17 -0
- package/docs/templates/product-line/scaffold-samples/README.md +36 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/acceptance.yaml +16 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/design.md +14 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/feature.yaml +14 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/requirement.md +6 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/tasks/BE-IMPL-001.yaml +83 -0
- package/docs/templates/product-line/scaffold-samples/backend-only/tasks/task-graph.yaml +14 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/acceptance.yaml +18 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/design.md +18 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/feature.yaml +14 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/requirement.md +6 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/tasks/BE-IMPL-001.yaml +84 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/tasks/CONTRACT-001.yaml +84 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/tasks/FE-IMPL-001.yaml +86 -0
- package/docs/templates/product-line/scaffold-samples/fe-with-api/tasks/task-graph.yaml +40 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/acceptance.yaml +16 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/design.md +14 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/feature.yaml +14 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/requirement.md +6 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/tasks/FE-IMPL-001.yaml +85 -0
- package/docs/templates/product-line/scaffold-samples/frontend-only/tasks/task-graph.yaml +14 -0
- package/docs/templates/product-line/task-graph.yaml +23 -0
- package/docs/templates/product-line/task.yaml +68 -0
- package/docs/templates/product-line/test-plan.md +7 -0
- package/docs/templates/production-readiness-checklist.md +57 -0
- package/docs/templates/progress-log.md +27 -0
- package/docs/templates/project-start-checklist.md +9 -0
- package/docs/templates/qa-report.md +48 -0
- package/docs/templates/sprint-contract.md +29 -0
- package/docs/templates/worker-dogfood-evidence.md +80 -0
- package/docs/templates/worker-dogfood-setup.md +68 -0
- package/examples/decision-gate-agent-dag.json +177 -0
- package/examples/example-dag.json +46 -0
- package/examples/hybrid-loop-agent-dag.json +189 -0
- package/examples/l5-report-coms-process-definition.html +322 -0
- package/examples/l5-report-demo.html +79 -0
- package/harness.json +90 -0
- package/package.json +98 -0
- package/scripts/kb-bootstrap-init-skeleton.sh +241 -0
- package/scripts/kb-graph-incremental-prepare.mjs +386 -0
- package/scripts/kb-graph-materialize.mjs +105 -0
- package/scripts/kb-graph-promote.mjs +164 -0
- package/scripts/kb-query.mjs +554 -0
- package/skills/agent-worker/SKILL.md +48 -0
- package/skills/agent-worker/references/agent-worker-operator.md +159 -0
- package/skills/ai-engineering-context/SKILL.md +48 -0
- package/skills/analyze-product-dependencies/SKILL.md +108 -0
- package/skills/analyze-product-dependencies/references/api-documentation-schema.md +35 -0
- package/skills/analyze-product-dependencies/references/dependency-analysis-schema.md +38 -0
- package/skills/analyze-product-dependencies/references/example.md +76 -0
- package/skills/analyze-product-dependencies/references/forward-test-cases.md +110 -0
- package/skills/analyze-product-dependencies/references/input-contract.md +34 -0
- package/skills/analyze-product-dependencies/references/kb-integration.md +64 -0
- package/skills/analyze-product-dependencies/references/scouting-rules.md +76 -0
- package/skills/analyze-product-dependencies/scripts/test-validators.mjs +460 -0
- package/skills/analyze-product-dependencies/scripts/validate-api-documentation.mjs +194 -0
- package/skills/analyze-product-dependencies/scripts/validate-dependency-analysis.mjs +200 -0
- package/skills/analyze-product-dependencies/scripts/validate-product-requirement-input.mjs +90 -0
- package/skills/analyze-product-dependencies/scripts/validation-helpers.mjs +138 -0
- package/skills/analyze-product-requirements/SKILL.md +145 -0
- package/skills/analyze-product-requirements/references/acceptance-criteria.md +87 -0
- package/skills/analyze-product-requirements/references/clarification-and-knowledge.md +70 -0
- package/skills/analyze-product-requirements/references/example.md +104 -0
- package/skills/analyze-product-requirements/references/forward-test-cases.md +144 -0
- package/skills/analyze-product-requirements/references/kb-integration.md +56 -0
- package/skills/analyze-product-requirements/references/product-analysis-schema.md +41 -0
- package/skills/analyze-product-requirements/references/product-requirement-schema.md +42 -0
- package/skills/analyze-product-requirements/references/requirement-clarification-schema.md +66 -0
- package/skills/analyze-product-requirements/scripts/compute-source-identity.mjs +35 -0
- package/skills/analyze-product-requirements/scripts/test-validators.mjs +501 -0
- package/skills/analyze-product-requirements/scripts/validate-product-analysis.mjs +100 -0
- package/skills/analyze-product-requirements/scripts/validate-product-requirement.mjs +109 -0
- package/skills/analyze-product-requirements/scripts/validate-requirement-clarification.mjs +109 -0
- package/skills/analyze-product-requirements/scripts/validation-helpers.mjs +175 -0
- package/skills/browser-tools/SKILL.md +196 -0
- package/skills/browser-tools/browser-content.js +103 -0
- package/skills/browser-tools/browser-cookies.js +35 -0
- package/skills/browser-tools/browser-eval.js +53 -0
- package/skills/browser-tools/browser-hn-scraper.js +108 -0
- package/skills/browser-tools/browser-nav.js +44 -0
- package/skills/browser-tools/browser-pick.js +162 -0
- package/skills/browser-tools/browser-screenshot.js +34 -0
- package/skills/browser-tools/browser-start.js +86 -0
- package/skills/browser-tools/package-lock.json +2556 -0
- package/skills/browser-tools/package.json +19 -0
- package/skills/code-review-core/SKILL.md +20 -0
- package/skills/codebase-scout/SKILL.md +19 -0
- package/skills/frontend-bounded-implement/SKILL.md +53 -0
- package/skills/frontend-design-review/SKILL.md +79 -0
- package/skills/frontend-design-review/references/review-checklist.md +43 -0
- package/skills/frontend-implementation/SKILL.md +52 -0
- package/skills/frontend-implementation/references/code-standards.md +33 -0
- package/skills/frontend-implementation/references/design-spec.md +56 -0
- package/skills/frontend-implementation/references/node-contracts.md +31 -0
- package/skills/frontend-review/SKILL.md +55 -0
- package/skills/frontend-review/references/review-findings.md +50 -0
- package/skills/frontend-verification/SKILL.md +61 -0
- package/skills/frontend-verification/references/verification-checklist.md +48 -0
- package/skills/grill-me/SKILL.md +10 -0
- package/skills/grill-with-docs/SKILL.md +80 -0
- package/skills/grill-with-docs/adr-format.md +58 -0
- package/skills/grill-with-docs/context-format.md +52 -0
- package/skills/init-capability-evolution/SKILL.md +70 -0
- package/skills/local-jacoco-coverage/SKILL.md +281 -0
- package/skills/local-jacoco-coverage/references/requirement-to-source-mapping.md +85 -0
- package/skills/local-jacoco-coverage/references/runtime-alignment.md +106 -0
- package/skills/local-jacoco-coverage/scripts/run-coverage-analysis.sh +148 -0
- package/skills/local-jacoco-coverage/scripts/start-jacoco-agent.sh +110 -0
- package/skills/loop-agent/SKILL.md +68 -0
- package/skills/loop-agent/references/README.md +67 -0
- package/skills/loop-agent/references/command-reference.md +645 -0
- package/skills/loop-agent/references/docs-converge.md +126 -0
- package/skills/loop-agent/references/harness-policy.md +289 -0
- package/skills/loop-agent/references/hybrid-dag.md +245 -0
- package/skills/loop-agent/references/learned/README.md +21 -0
- package/skills/loop-agent/references/long-running-loop.md +57 -0
- package/skills/loop-agent/references/model-routing.md +45 -0
- package/skills/loop-agent/references/multi-worktree.md +54 -0
- package/skills/loop-agent/references/one-shot-runs.md +84 -0
- package/skills/loop-agent/references/orchestrator-and-interventions.md +175 -0
- package/skills/loop-agent/references/pi-prompt.md +23 -0
- package/skills/loop-agent/references/pi-subagent-assisted-mode.md +84 -0
- package/skills/loop-agent/references/post-implementation-and-patterns.md +54 -0
- package/skills/loop-agent/references/source-and-plan-practice.md +169 -0
- package/skills/loop-agent/references/task-workflow.md +104 -0
- package/skills/loop-agent/references/verification-and-failure-handling.md +148 -0
- package/skills/playwright-cli/SKILL.md +93 -0
- package/skills/playwright-cli/references/element-attributes.md +23 -0
- package/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/skills/playwright-cli/references/request-mocking.md +87 -0
- package/skills/playwright-cli/references/running-code.md +241 -0
- package/skills/playwright-cli/references/session-management.md +225 -0
- package/skills/playwright-cli/references/storage-state.md +275 -0
- package/skills/playwright-cli/references/test-generation.md +433 -0
- package/skills/playwright-cli/references/tracing.md +5 -0
- package/skills/playwright-cli/references/video-recording.md +5 -0
- package/skills/playwright-cli-case-generator/SKILL.md +108 -0
- package/skills/requesting-code-review/SKILL.md +101 -0
- package/skills/requesting-code-review/code-reviewer.md +168 -0
- package/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/systematic-debugging/SKILL.md +312 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/test-driven-development/SKILL.md +27 -0
- package/skills/using-git-worktrees/SKILL.md +215 -0
- package/skills/verification-before-completion/SKILL.md +154 -0
- package/skills/webapp-testing/SKILL.md +19 -0
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executable Turn stream ownership / notice / abort controller.
|
|
3
|
+
*
|
|
4
|
+
* Production path for useChatStream: tests drive this same module rather than a
|
|
5
|
+
* parallel state machine or source-regex-only contracts.
|
|
6
|
+
*
|
|
7
|
+
* Constraints preserved here:
|
|
8
|
+
* - transport uncertainty is never accepted:false / rejected
|
|
9
|
+
* - same clientRequestId is never reminted during ambiguous retry/reconcile
|
|
10
|
+
* - Stop never disposes Session (no dispose call site in this module)
|
|
11
|
+
* - notice paths (adopt / 正在停止… / abort-pending) never escalate via setError
|
|
12
|
+
* - default request paths target real Operator Chat API (no Mock activation)
|
|
13
|
+
*/
|
|
14
|
+
import { createPendingSubmission, isRuntimeBusyUnion, isSubmissionCurrent, isTerminalTurnState, } from "./turn-submission.js";
|
|
15
|
+
/** Real Operator Chat API path templates (production defaults; Mock off). */
|
|
16
|
+
export const OPERATOR_CHAT_REAL_PATHS = {
|
|
17
|
+
turns: "/api/operator/v1/chat/sessions/:sessionId/turns",
|
|
18
|
+
state: "/api/operator/v1/chat/sessions/:sessionId/state",
|
|
19
|
+
events: "/api/operator/v1/chat/sessions/:sessionId/events",
|
|
20
|
+
abort: "/api/operator/v1/chat/sessions/:sessionId/turns/:turnId/abort",
|
|
21
|
+
};
|
|
22
|
+
export function operatorChatTurnsUrl(origin, sessionId) {
|
|
23
|
+
return `${origin}/api/operator/v1/chat/sessions/${encodeURIComponent(sessionId)}/turns`;
|
|
24
|
+
}
|
|
25
|
+
export function operatorChatStateUrl(origin, sessionId) {
|
|
26
|
+
return `${origin}/api/operator/v1/chat/sessions/${encodeURIComponent(sessionId)}/state`;
|
|
27
|
+
}
|
|
28
|
+
export function operatorChatEventsUrl(origin, sessionId) {
|
|
29
|
+
return `${origin}/api/operator/v1/chat/sessions/${encodeURIComponent(sessionId)}/events`;
|
|
30
|
+
}
|
|
31
|
+
export function operatorChatAbortUrl(origin, sessionId, turnId) {
|
|
32
|
+
return `${origin}/api/operator/v1/chat/sessions/${encodeURIComponent(sessionId)}/turns/${encodeURIComponent(turnId)}/abort`;
|
|
33
|
+
}
|
|
34
|
+
export function createTurnOwnershipBag(seed) {
|
|
35
|
+
return {
|
|
36
|
+
submitInFlight: false,
|
|
37
|
+
pendingSubmission: null,
|
|
38
|
+
activeTurnId: null,
|
|
39
|
+
streaming: false,
|
|
40
|
+
assistantId: null,
|
|
41
|
+
stoppingTurnId: null,
|
|
42
|
+
settledTurnIds: new Set(),
|
|
43
|
+
turnAssistantIds: new Map(),
|
|
44
|
+
sessionId: null,
|
|
45
|
+
sessionGeneration: 0,
|
|
46
|
+
submitGeneration: 0,
|
|
47
|
+
stopInFlight: false,
|
|
48
|
+
stopRequested: false,
|
|
49
|
+
abortPostedTurnIds: new Set(),
|
|
50
|
+
releasedClientRequestIds: new Set(),
|
|
51
|
+
...seed,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** Whether a second concurrent send is blocked by ownership / busy. */
|
|
55
|
+
export function isSubmitOwnershipBusy(bag) {
|
|
56
|
+
return bag.streaming || bag.submitInFlight || Boolean(bag.pendingSubmission);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Release submit ownership. Optionally scoped to a clientRequestId so a stale
|
|
60
|
+
* release cannot clear a newer pending submission.
|
|
61
|
+
* Independent of React streaming projection — terminal evidence always clears
|
|
62
|
+
* pendingSubmission/submitInFlight for the matching clientRequestId.
|
|
63
|
+
*/
|
|
64
|
+
export function releaseSubmitOwnership(bag, pendingClientRequestId) {
|
|
65
|
+
const pending = bag.pendingSubmission;
|
|
66
|
+
if (pendingClientRequestId &&
|
|
67
|
+
pending &&
|
|
68
|
+
pending.clientRequestId !== pendingClientRequestId) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
bag.submitInFlight = false;
|
|
72
|
+
if (!pendingClientRequestId ||
|
|
73
|
+
pending?.clientRequestId === pendingClientRequestId) {
|
|
74
|
+
if (pending?.clientRequestId) {
|
|
75
|
+
bag.releasedClientRequestIds.add(pending.clientRequestId);
|
|
76
|
+
}
|
|
77
|
+
else if (pendingClientRequestId) {
|
|
78
|
+
bag.releasedClientRequestIds.add(pendingClientRequestId);
|
|
79
|
+
}
|
|
80
|
+
bag.pendingSubmission = null;
|
|
81
|
+
}
|
|
82
|
+
// Ownership release clears durable stop intent for this submission.
|
|
83
|
+
if (!bag.pendingSubmission) {
|
|
84
|
+
bag.stopRequested = false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** Mark durable client Stop intent (survives ambiguous create-turn). */
|
|
88
|
+
export function markStopRequested(bag) {
|
|
89
|
+
bag.stopRequested = true;
|
|
90
|
+
}
|
|
91
|
+
/** Clear durable Stop intent (terminal / no-active / rejected / after abort). */
|
|
92
|
+
export function clearStopRequested(bag) {
|
|
93
|
+
bag.stopRequested = false;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Decide whether a real POST /abort should run for a newly known turnId.
|
|
97
|
+
* Coalesces to one abort per turnId. Never remints clientRequestId.
|
|
98
|
+
*/
|
|
99
|
+
export function shouldPostAbortForTurn(bag, turnId) {
|
|
100
|
+
if (!turnId)
|
|
101
|
+
return false;
|
|
102
|
+
if (bag.abortPostedTurnIds.has(turnId))
|
|
103
|
+
return false;
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
/** Record that a real POST /abort was issued for turnId (idempotent coalesce). */
|
|
107
|
+
export function noteAbortPosted(bag, turnId) {
|
|
108
|
+
if (turnId)
|
|
109
|
+
bag.abortPostedTurnIds.add(turnId);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* After accepted / adopt-active / bind-active yields a turnId, if stopRequested
|
|
113
|
+
* is still set, schedule exactly one abort for that turn (caller issues POST).
|
|
114
|
+
* Returns the turnId to abort, or null when no abort is needed.
|
|
115
|
+
*/
|
|
116
|
+
export function consumeStopIntentForAbort(bag, turnId) {
|
|
117
|
+
if (!bag.stopRequested)
|
|
118
|
+
return null;
|
|
119
|
+
if (!shouldPostAbortForTurn(bag, turnId))
|
|
120
|
+
return null;
|
|
121
|
+
noteAbortPosted(bag, turnId);
|
|
122
|
+
bag.stoppingTurnId = turnId;
|
|
123
|
+
bag.activeTurnId = turnId;
|
|
124
|
+
// Intent stays until terminal/no-active/rejected clears it; abort in-flight
|
|
125
|
+
// still represents the same durable client Stop.
|
|
126
|
+
return turnId;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Release ownership lease from terminal evidence even when React streaming is
|
|
130
|
+
* already false (SSE may have projected idle before /state bind). Scoped by
|
|
131
|
+
* clientRequestId so a newer pending submission is never cleared.
|
|
132
|
+
*/
|
|
133
|
+
export function releaseOwnershipOnTerminalEvidence(bag, input) {
|
|
134
|
+
const pending = bag.pendingSubmission;
|
|
135
|
+
if (pending && pending.clientRequestId !== input.clientRequestId) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
if (input.turnId) {
|
|
139
|
+
bag.settledTurnIds.add(input.turnId);
|
|
140
|
+
}
|
|
141
|
+
releaseSubmitOwnership(bag, input.clientRequestId);
|
|
142
|
+
clearStopRequested(bag);
|
|
143
|
+
if (input.markIdle !== false) {
|
|
144
|
+
// Streaming may already be false; still clear ownership-related fields.
|
|
145
|
+
bag.streaming = false;
|
|
146
|
+
bag.activeTurnId = null;
|
|
147
|
+
bag.assistantId = null;
|
|
148
|
+
bag.stoppingTurnId = null;
|
|
149
|
+
}
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
/** Acquire synchronous submit ownership before the first await (AC-001). */
|
|
153
|
+
export function beginSubmitOwnership(bag, input) {
|
|
154
|
+
bag.submitInFlight = true;
|
|
155
|
+
const submitGeneration = ++bag.submitGeneration;
|
|
156
|
+
const pending = createPendingSubmission({
|
|
157
|
+
clientRequestId: input.clientRequestId,
|
|
158
|
+
submitGeneration,
|
|
159
|
+
sessionId: input.sessionId,
|
|
160
|
+
sessionGeneration: input.sessionGeneration,
|
|
161
|
+
text: input.text,
|
|
162
|
+
images: input.images,
|
|
163
|
+
assistantId: input.assistantId,
|
|
164
|
+
userMessageId: input.userMessageId,
|
|
165
|
+
});
|
|
166
|
+
bag.pendingSubmission = pending;
|
|
167
|
+
bag.sessionId = input.sessionId;
|
|
168
|
+
bag.sessionGeneration = input.sessionGeneration;
|
|
169
|
+
return pending;
|
|
170
|
+
}
|
|
171
|
+
export function applyAcceptedOwnership(bag, input) {
|
|
172
|
+
if (!isSubmissionCurrent({
|
|
173
|
+
pending: input.pending,
|
|
174
|
+
sessionId: bag.sessionId,
|
|
175
|
+
sessionGeneration: bag.sessionGeneration,
|
|
176
|
+
submitGeneration: bag.submitGeneration,
|
|
177
|
+
})) {
|
|
178
|
+
input.pending.resolveOutcome({ kind: "stale" });
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
input.pending.acceptedTurnId = input.turnId;
|
|
182
|
+
bag.activeTurnId = input.turnId;
|
|
183
|
+
bag.turnAssistantIds.set(input.turnId, input.assistantId);
|
|
184
|
+
bag.streaming = true;
|
|
185
|
+
// Keep pendingSubmission until terminal/idle so Stop-before-202 can observe it.
|
|
186
|
+
// Drop only the in-flight gate for new sends after acceptance.
|
|
187
|
+
bag.submitInFlight = false;
|
|
188
|
+
input.pending.resolveOutcome({
|
|
189
|
+
kind: "accepted",
|
|
190
|
+
turnId: input.turnId,
|
|
191
|
+
});
|
|
192
|
+
input.ui?.setStreaming(true);
|
|
193
|
+
input.ui?.setStreamingAssistantId(input.assistantId);
|
|
194
|
+
input.ui?.setPendingImages([]);
|
|
195
|
+
input.ui?.watchSessionTitle?.(input.sessionId);
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* TURN_ACTIVE adopt: non-fatal notice only. Never escalates via setError(message).
|
|
200
|
+
* Preserves local draft and binds the active turn.
|
|
201
|
+
*/
|
|
202
|
+
export function applyAdoptActiveOwnership(bag, input) {
|
|
203
|
+
input.pending.resolveOutcome({
|
|
204
|
+
kind: "adopt-active",
|
|
205
|
+
activeTurn: { turnId: input.activeTurnId },
|
|
206
|
+
message: input.message,
|
|
207
|
+
});
|
|
208
|
+
releaseSubmitOwnership(bag, input.pending.clientRequestId);
|
|
209
|
+
if (!input.current)
|
|
210
|
+
return;
|
|
211
|
+
input.ui?.clearEmptyAssistant(input.assistantId);
|
|
212
|
+
input.ui?.setInput(input.text);
|
|
213
|
+
input.ui?.setPendingImages(input.images);
|
|
214
|
+
bag.activeTurnId = input.activeTurnId;
|
|
215
|
+
bag.assistantId = null;
|
|
216
|
+
bag.streaming = true;
|
|
217
|
+
input.ui?.setStreaming(true);
|
|
218
|
+
input.ui?.setStreamingAssistantId(null);
|
|
219
|
+
// Clear any prior fatal error; adopt is non-fatal.
|
|
220
|
+
input.notice.setError(null);
|
|
221
|
+
input.notice.showNotice(input.message);
|
|
222
|
+
}
|
|
223
|
+
export function applyRejectedOwnership(bag, input) {
|
|
224
|
+
input.pending.resolveOutcome({
|
|
225
|
+
kind: "rejected",
|
|
226
|
+
message: input.message,
|
|
227
|
+
});
|
|
228
|
+
releaseSubmitOwnership(bag, input.pending.clientRequestId);
|
|
229
|
+
if (!input.current)
|
|
230
|
+
return;
|
|
231
|
+
const formatted = input.ui?.formatError
|
|
232
|
+
? input.ui.formatError(input.message)
|
|
233
|
+
: input.message;
|
|
234
|
+
input.ui?.setError(formatted);
|
|
235
|
+
bag.streaming = false;
|
|
236
|
+
bag.assistantId = null;
|
|
237
|
+
input.ui?.setStreaming(false);
|
|
238
|
+
input.ui?.setStreamingAssistantId(null);
|
|
239
|
+
input.ui?.clearEmptyAssistant(input.assistantId);
|
|
240
|
+
input.ui?.setInput(input.text);
|
|
241
|
+
input.ui?.setPendingImages(input.images);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Settle a create-turn outcome onto ownership.
|
|
245
|
+
* Ambiguous leaves pending/busy for reconcile — never applyRejected / release.
|
|
246
|
+
*/
|
|
247
|
+
export function settleCreateTurnOutcome(bag, outcome, ctx) {
|
|
248
|
+
const current = isSubmissionCurrent({
|
|
249
|
+
pending: ctx.pending,
|
|
250
|
+
sessionId: bag.sessionId,
|
|
251
|
+
sessionGeneration: bag.sessionGeneration,
|
|
252
|
+
submitGeneration: bag.submitGeneration,
|
|
253
|
+
});
|
|
254
|
+
if (outcome.kind === "accepted") {
|
|
255
|
+
const applied = applyAcceptedOwnership(bag, {
|
|
256
|
+
turnId: outcome.turnId,
|
|
257
|
+
assistantId: ctx.assistantId,
|
|
258
|
+
pending: ctx.pending,
|
|
259
|
+
sessionId: ctx.sessionId,
|
|
260
|
+
ui: ctx.acceptedUi,
|
|
261
|
+
});
|
|
262
|
+
// AC-R5-001: Stop during create → exactly one abort once turnId is known.
|
|
263
|
+
if (applied) {
|
|
264
|
+
const abortTurnId = consumeStopIntentForAbort(bag, outcome.turnId);
|
|
265
|
+
if (abortTurnId)
|
|
266
|
+
ctx.onAutoAbort?.(abortTurnId);
|
|
267
|
+
}
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
if (outcome.kind === "adopt-active") {
|
|
271
|
+
// AC-FINAL-001: for a still-current submission, consume durable stop
|
|
272
|
+
// intent before applyAdoptActiveOwnership → releaseSubmitOwnership
|
|
273
|
+
// clears stopRequested.
|
|
274
|
+
// Stale late adopt-active (newer submit already advanced generation)
|
|
275
|
+
// must not write old turnId into abortPostedTurnIds or fire onAutoAbort.
|
|
276
|
+
const abortTurnId = current
|
|
277
|
+
? consumeStopIntentForAbort(bag, outcome.activeTurn.turnId)
|
|
278
|
+
: null;
|
|
279
|
+
applyAdoptActiveOwnership(bag, {
|
|
280
|
+
activeTurnId: outcome.activeTurn.turnId,
|
|
281
|
+
message: outcome.message,
|
|
282
|
+
assistantId: ctx.assistantId,
|
|
283
|
+
text: ctx.text,
|
|
284
|
+
images: ctx.images,
|
|
285
|
+
pending: ctx.pending,
|
|
286
|
+
current,
|
|
287
|
+
notice: ctx.notice,
|
|
288
|
+
ui: ctx.adoptUi,
|
|
289
|
+
});
|
|
290
|
+
if (abortTurnId)
|
|
291
|
+
ctx.onAutoAbort?.(abortTurnId);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
if (outcome.kind === "rejected") {
|
|
295
|
+
applyRejectedOwnership(bag, {
|
|
296
|
+
message: outcome.message,
|
|
297
|
+
assistantId: ctx.assistantId,
|
|
298
|
+
text: ctx.text,
|
|
299
|
+
images: ctx.images,
|
|
300
|
+
pending: ctx.pending,
|
|
301
|
+
current,
|
|
302
|
+
ui: ctx.rejectedUi,
|
|
303
|
+
});
|
|
304
|
+
clearStopRequested(bag);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (outcome.kind === "stale") {
|
|
308
|
+
ctx.pending.resolveOutcome(outcome);
|
|
309
|
+
releaseSubmitOwnership(bag, ctx.pending.clientRequestId);
|
|
310
|
+
clearStopRequested(bag);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
// ambiguous — leave pending/busy for reconcile; do not release ownership
|
|
314
|
+
// or forge idle. clientRequestId stays on pendingSubmission.
|
|
315
|
+
// Durable stopRequested (if set) survives until bind/accept/terminal.
|
|
316
|
+
ctx.pending.resolveOutcome(outcome);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Apply continuous /state reconcile decision for a still-owned pending submission.
|
|
320
|
+
* Same clientRequestId only — never mints a new id or re-POSTs Prompt.
|
|
321
|
+
*/
|
|
322
|
+
export function applyPendingReconcileDecision(bag, decision, state, opts) {
|
|
323
|
+
const pending = bag.pendingSubmission;
|
|
324
|
+
if (!pending)
|
|
325
|
+
return "held";
|
|
326
|
+
if (decision.action === "bind-active") {
|
|
327
|
+
const alreadyBound = Boolean(pending.acceptedTurnId);
|
|
328
|
+
if (!alreadyBound) {
|
|
329
|
+
// US-BUSY-ACTIVE-BOUND: keep streaming/busy with same id.
|
|
330
|
+
pending.acceptedTurnId = decision.turnId;
|
|
331
|
+
bag.activeTurnId = decision.turnId;
|
|
332
|
+
bag.turnAssistantIds.set(decision.turnId, pending.assistantId);
|
|
333
|
+
bag.streaming = true;
|
|
334
|
+
bag.submitInFlight = false;
|
|
335
|
+
// Retain pendingSubmission until terminal/non-acceptance release.
|
|
336
|
+
}
|
|
337
|
+
// AC-R5-001: durable stopRequested survives ambiguous create; bind-active
|
|
338
|
+
// must fire exactly one real abort for the bound turnId.
|
|
339
|
+
const abortTurnId = consumeStopIntentForAbort(bag, decision.turnId);
|
|
340
|
+
if (abortTurnId)
|
|
341
|
+
opts?.onAutoAbort?.(abortTurnId);
|
|
342
|
+
return alreadyBound ? "held" : "bound";
|
|
343
|
+
}
|
|
344
|
+
if (decision.action === "release-terminal" ||
|
|
345
|
+
decision.action === "release-not-accepted") {
|
|
346
|
+
// Terminal / not-accepted release clears ownership even after bind-active
|
|
347
|
+
// set acceptedTurnId (pendingSubmission held until this release).
|
|
348
|
+
// Independent of React streaming projection (AC-R5-002).
|
|
349
|
+
if (decision.action === "release-terminal") {
|
|
350
|
+
bag.settledTurnIds.add(decision.turnId);
|
|
351
|
+
}
|
|
352
|
+
releaseSubmitOwnership(bag, pending.clientRequestId);
|
|
353
|
+
clearStopRequested(bag);
|
|
354
|
+
const stillBusy = isRuntimeBusyUnion(state);
|
|
355
|
+
if (!stillBusy) {
|
|
356
|
+
bag.streaming = false;
|
|
357
|
+
bag.activeTurnId = null;
|
|
358
|
+
bag.assistantId = null;
|
|
359
|
+
bag.stoppingTurnId = null;
|
|
360
|
+
opts?.markIdle?.();
|
|
361
|
+
}
|
|
362
|
+
return "released";
|
|
363
|
+
}
|
|
364
|
+
// hold: keep pending clientRequestId + busy; no applyRejected.
|
|
365
|
+
const activeTurnId = state?.activeTurn?.turnId ?? state?.activeTurnId ?? null;
|
|
366
|
+
if (activeTurnId)
|
|
367
|
+
bag.activeTurnId = activeTurnId;
|
|
368
|
+
return "held";
|
|
369
|
+
}
|
|
370
|
+
export const STOPPING_NOTICE = "正在停止…";
|
|
371
|
+
export const ABORT_PENDING_NOTICE = "正在停止…";
|
|
372
|
+
export const ABORT_INCOMPLETE_NOTICE = "停止请求未完成,正在与服务端对账…";
|
|
373
|
+
export const ABORT_FAILED_NOTICE = "停止请求失败,正在与服务端对账…";
|
|
374
|
+
/**
|
|
375
|
+
* Emit non-fatal stop-before-turnId notice. Never calls setError.
|
|
376
|
+
* Stop never disposes Session (no dispose in this module).
|
|
377
|
+
*/
|
|
378
|
+
export function emitStoppingNotice(notice) {
|
|
379
|
+
notice.showNotice(STOPPING_NOTICE);
|
|
380
|
+
}
|
|
381
|
+
export function classifyAbortResponse(input) {
|
|
382
|
+
if (input.networkError) {
|
|
383
|
+
return { action: "keep-busy-notice", message: ABORT_FAILED_NOTICE };
|
|
384
|
+
}
|
|
385
|
+
const terminalState = input.body.turn?.state;
|
|
386
|
+
if (input.body.accepted === true &&
|
|
387
|
+
isTerminalTurnState(terminalState)) {
|
|
388
|
+
return { action: "terminal-idle", turnId: input.turnId };
|
|
389
|
+
}
|
|
390
|
+
if (input.body.error?.code === "TURN_ABORT_PENDING") {
|
|
391
|
+
return { action: "abort-pending-notice" };
|
|
392
|
+
}
|
|
393
|
+
if (input.body.error?.code === "CHAT_TURN_OWNER_LOST" ||
|
|
394
|
+
input.body.error?.code === "OWNER_LOST") {
|
|
395
|
+
return { action: "owner-lost-reconcile" };
|
|
396
|
+
}
|
|
397
|
+
if (!input.httpOk) {
|
|
398
|
+
return { action: "keep-busy-notice", message: ABORT_INCOMPLETE_NOTICE };
|
|
399
|
+
}
|
|
400
|
+
return { action: "noop" };
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Apply abort decision. Notice paths use showNotice only — never setError.
|
|
404
|
+
* Session dispose is intentionally absent.
|
|
405
|
+
*/
|
|
406
|
+
export function applyAbortDecision(bag, decision, notice, opts) {
|
|
407
|
+
const current = opts?.sessionStillCurrent !== false;
|
|
408
|
+
if (decision.action === "terminal-idle") {
|
|
409
|
+
if (!current)
|
|
410
|
+
return;
|
|
411
|
+
bag.settledTurnIds.add(decision.turnId);
|
|
412
|
+
bag.streaming = false;
|
|
413
|
+
bag.activeTurnId = null;
|
|
414
|
+
bag.assistantId = null;
|
|
415
|
+
bag.stoppingTurnId = null;
|
|
416
|
+
opts?.markIdle?.();
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
if (decision.action === "abort-pending-notice") {
|
|
420
|
+
// Non-fatal; keep busy.
|
|
421
|
+
notice.showNotice(ABORT_PENDING_NOTICE);
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
if (decision.action === "owner-lost-reconcile") {
|
|
425
|
+
if (!current)
|
|
426
|
+
return;
|
|
427
|
+
if (!opts?.runtimeBusy) {
|
|
428
|
+
if (bag.stoppingTurnId) {
|
|
429
|
+
bag.settledTurnIds.add(bag.stoppingTurnId);
|
|
430
|
+
}
|
|
431
|
+
bag.streaming = false;
|
|
432
|
+
bag.activeTurnId = null;
|
|
433
|
+
bag.assistantId = null;
|
|
434
|
+
bag.stoppingTurnId = null;
|
|
435
|
+
opts?.markIdle?.();
|
|
436
|
+
}
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
if (decision.action === "keep-busy-notice") {
|
|
440
|
+
notice.showNotice(decision.message);
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Simulate the double-POST ambiguous → /state bind → terminal release path
|
|
446
|
+
* for executable ownership tests. Reuses one clientRequestId throughout.
|
|
447
|
+
*/
|
|
448
|
+
export function simulateAmbiguousBindRelease(input) {
|
|
449
|
+
const assistantId = input.assistantId ?? "a-test";
|
|
450
|
+
const bag = createTurnOwnershipBag({
|
|
451
|
+
sessionId: input.sessionId,
|
|
452
|
+
sessionGeneration: 1,
|
|
453
|
+
});
|
|
454
|
+
const phases = [];
|
|
455
|
+
const pending = beginSubmitOwnership(bag, {
|
|
456
|
+
clientRequestId: input.clientRequestId,
|
|
457
|
+
sessionId: input.sessionId,
|
|
458
|
+
sessionGeneration: 1,
|
|
459
|
+
text: "hello",
|
|
460
|
+
images: [],
|
|
461
|
+
assistantId,
|
|
462
|
+
userMessageId: "u-test",
|
|
463
|
+
});
|
|
464
|
+
bag.streaming = true;
|
|
465
|
+
// After double-POST ambiguous: settle without release.
|
|
466
|
+
settleCreateTurnOutcome(bag, { kind: "ambiguous", message: "transport unclear" }, {
|
|
467
|
+
assistantId,
|
|
468
|
+
text: "hello",
|
|
469
|
+
images: [],
|
|
470
|
+
pending,
|
|
471
|
+
sessionId: input.sessionId,
|
|
472
|
+
notice: { showNotice: () => { }, setError: () => { } },
|
|
473
|
+
});
|
|
474
|
+
phases.push("pending-ambiguous");
|
|
475
|
+
// /state active bind with same clientRequestId.
|
|
476
|
+
const bound = applyPendingReconcileDecision(bag, { action: "bind-active", turnId: input.turnId }, {
|
|
477
|
+
activeTurn: {
|
|
478
|
+
turnId: input.turnId,
|
|
479
|
+
clientRequestId: input.clientRequestId,
|
|
480
|
+
state: "running",
|
|
481
|
+
},
|
|
482
|
+
});
|
|
483
|
+
if (bound !== "bound") {
|
|
484
|
+
throw new Error("expected bind-active");
|
|
485
|
+
}
|
|
486
|
+
phases.push("bound-active");
|
|
487
|
+
// Terminal release frees both ownership refs.
|
|
488
|
+
const released = applyPendingReconcileDecision(bag, {
|
|
489
|
+
action: "release-terminal",
|
|
490
|
+
turnId: input.turnId,
|
|
491
|
+
state: "settled",
|
|
492
|
+
}, {
|
|
493
|
+
latestTurn: {
|
|
494
|
+
turnId: input.turnId,
|
|
495
|
+
clientRequestId: input.clientRequestId,
|
|
496
|
+
state: "settled",
|
|
497
|
+
},
|
|
498
|
+
runtime: {
|
|
499
|
+
isStreaming: false,
|
|
500
|
+
isPromptRunning: false,
|
|
501
|
+
isCompacting: false,
|
|
502
|
+
isBashRunning: false,
|
|
503
|
+
},
|
|
504
|
+
});
|
|
505
|
+
if (released !== "released") {
|
|
506
|
+
throw new Error("expected release-terminal");
|
|
507
|
+
}
|
|
508
|
+
phases.push("released-terminal");
|
|
509
|
+
return { bag, clientRequestId: input.clientRequestId, phases };
|
|
510
|
+
}
|
|
511
|
+
/** True when production defaults do not activate a Mock handler. */
|
|
512
|
+
export function isMockActivationOffByDefault() {
|
|
513
|
+
// No production Mock switch exists in this controller; real paths only.
|
|
514
|
+
return true;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Production-path Stop: set durable stopRequested synchronously before any
|
|
518
|
+
* await. If turnId is already known, coalesce to one POST /abort. If not,
|
|
519
|
+
* intent survives until accepted/adopt/bind-active yields a turnId.
|
|
520
|
+
* Never remints clientRequestId; never disposes Session.
|
|
521
|
+
*/
|
|
522
|
+
export function requestStopOnOwnership(bag, hooks) {
|
|
523
|
+
markStopRequested(bag);
|
|
524
|
+
const turnId = bag.activeTurnId ??
|
|
525
|
+
bag.pendingSubmission?.acceptedTurnId ??
|
|
526
|
+
null;
|
|
527
|
+
if (turnId) {
|
|
528
|
+
const abortTurnId = consumeStopIntentForAbort(bag, turnId);
|
|
529
|
+
if (abortTurnId) {
|
|
530
|
+
hooks.notice && emitStoppingNotice(hooks.notice);
|
|
531
|
+
void hooks.postAbort(abortTurnId);
|
|
532
|
+
return { abortedTurnId: abortTurnId, stopRequested: true };
|
|
533
|
+
}
|
|
534
|
+
return { abortedTurnId: null, stopRequested: true };
|
|
535
|
+
}
|
|
536
|
+
// No turnId yet (create in flight / ambiguous) — durable intent only.
|
|
537
|
+
hooks.notice && emitStoppingNotice(hooks.notice);
|
|
538
|
+
return { abortedTurnId: null, stopRequested: true };
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* After create settles or /state bind, honor durable stopRequested with at
|
|
542
|
+
* most one abort per turnId. Same clientRequestId; no second create-turn POST.
|
|
543
|
+
*/
|
|
544
|
+
export function honorStopIntentAfterBind(bag, turnId, hooks) {
|
|
545
|
+
const abortTurnId = consumeStopIntentForAbort(bag, turnId);
|
|
546
|
+
if (!abortTurnId)
|
|
547
|
+
return null;
|
|
548
|
+
void hooks.postAbort(abortTurnId);
|
|
549
|
+
return abortTurnId;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Drive bind-active then terminal (or reverse order) against the production
|
|
553
|
+
* ownership helpers. Proves lease release is independent of React streaming.
|
|
554
|
+
*/
|
|
555
|
+
export function runBindAndTerminalReleaseOrders(input) {
|
|
556
|
+
const bag = createTurnOwnershipBag({
|
|
557
|
+
sessionId: input.sessionId,
|
|
558
|
+
sessionGeneration: 1,
|
|
559
|
+
});
|
|
560
|
+
const pending = beginSubmitOwnership(bag, {
|
|
561
|
+
clientRequestId: input.clientRequestId,
|
|
562
|
+
sessionId: input.sessionId,
|
|
563
|
+
sessionGeneration: 1,
|
|
564
|
+
text: "hello",
|
|
565
|
+
images: [],
|
|
566
|
+
assistantId: "a-orch",
|
|
567
|
+
userMessageId: "u-orch",
|
|
568
|
+
});
|
|
569
|
+
bag.streaming = true;
|
|
570
|
+
settleCreateTurnOutcome(bag, { kind: "ambiguous", message: "transport unclear" }, {
|
|
571
|
+
assistantId: "a-orch",
|
|
572
|
+
text: "hello",
|
|
573
|
+
images: [],
|
|
574
|
+
pending,
|
|
575
|
+
sessionId: input.sessionId,
|
|
576
|
+
notice: { showNotice: () => { }, setError: () => { } },
|
|
577
|
+
});
|
|
578
|
+
const bindState = {
|
|
579
|
+
activeTurn: {
|
|
580
|
+
turnId: input.turnId,
|
|
581
|
+
clientRequestId: input.clientRequestId,
|
|
582
|
+
state: "running",
|
|
583
|
+
},
|
|
584
|
+
};
|
|
585
|
+
const terminalState = {
|
|
586
|
+
latestTurn: {
|
|
587
|
+
turnId: input.turnId,
|
|
588
|
+
clientRequestId: input.clientRequestId,
|
|
589
|
+
state: "settled",
|
|
590
|
+
},
|
|
591
|
+
runtime: {
|
|
592
|
+
isStreaming: false,
|
|
593
|
+
isPromptRunning: false,
|
|
594
|
+
isCompacting: false,
|
|
595
|
+
isBashRunning: false,
|
|
596
|
+
},
|
|
597
|
+
};
|
|
598
|
+
if (input.order === "bind-first") {
|
|
599
|
+
applyPendingReconcileDecision(bag, { action: "bind-active", turnId: input.turnId }, bindState);
|
|
600
|
+
applyPendingReconcileDecision(bag, {
|
|
601
|
+
action: "release-terminal",
|
|
602
|
+
turnId: input.turnId,
|
|
603
|
+
state: "settled",
|
|
604
|
+
}, terminalState);
|
|
605
|
+
}
|
|
606
|
+
else if (input.order === "terminal-first") {
|
|
607
|
+
// Terminal SSE evidence before /state bind: release by clientRequestId.
|
|
608
|
+
releaseOwnershipOnTerminalEvidence(bag, {
|
|
609
|
+
clientRequestId: input.clientRequestId,
|
|
610
|
+
turnId: input.turnId,
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
else {
|
|
614
|
+
// React streaming already false (SSE projected idle) must not skip lease.
|
|
615
|
+
bag.streaming = false;
|
|
616
|
+
releaseOwnershipOnTerminalEvidence(bag, {
|
|
617
|
+
clientRequestId: input.clientRequestId,
|
|
618
|
+
turnId: input.turnId,
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
return {
|
|
622
|
+
bag,
|
|
623
|
+
clientRequestId: input.clientRequestId,
|
|
624
|
+
busyAfter: isSubmitOwnershipBusy(bag),
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Production orchestration: Stop during ambiguous create → bind-active → one abort.
|
|
629
|
+
* Reuses original clientRequestId; no second create-turn POST; no Session dispose.
|
|
630
|
+
*/
|
|
631
|
+
export function runStopDuringAmbiguousThenBind(input) {
|
|
632
|
+
const abortCalls = [];
|
|
633
|
+
const bag = createTurnOwnershipBag({
|
|
634
|
+
sessionId: input.sessionId,
|
|
635
|
+
sessionGeneration: 1,
|
|
636
|
+
});
|
|
637
|
+
const pending = beginSubmitOwnership(bag, {
|
|
638
|
+
clientRequestId: input.clientRequestId,
|
|
639
|
+
sessionId: input.sessionId,
|
|
640
|
+
sessionGeneration: 1,
|
|
641
|
+
text: "stop-race",
|
|
642
|
+
images: [],
|
|
643
|
+
assistantId: "a-stop",
|
|
644
|
+
userMessageId: "u-stop",
|
|
645
|
+
});
|
|
646
|
+
bag.streaming = true;
|
|
647
|
+
// create-turn still ambiguous / unresolved — Stop sets durable intent.
|
|
648
|
+
const hooks = {
|
|
649
|
+
postAbort: (turnId) => {
|
|
650
|
+
abortCalls.push(turnId);
|
|
651
|
+
input.postAbort(turnId);
|
|
652
|
+
},
|
|
653
|
+
notice: { showNotice: () => { }, setError: () => { } },
|
|
654
|
+
};
|
|
655
|
+
requestStopOnOwnership(bag, hooks);
|
|
656
|
+
// Ambiguous settle leaves pending + stopRequested.
|
|
657
|
+
settleCreateTurnOutcome(bag, { kind: "ambiguous", message: "unclear" }, {
|
|
658
|
+
assistantId: "a-stop",
|
|
659
|
+
text: "stop-race",
|
|
660
|
+
images: [],
|
|
661
|
+
pending,
|
|
662
|
+
sessionId: input.sessionId,
|
|
663
|
+
notice: hooks.notice,
|
|
664
|
+
onAutoAbort: (turnId) => void hooks.postAbort(turnId),
|
|
665
|
+
});
|
|
666
|
+
const stopRequestedAfterAmbiguous = bag.stopRequested;
|
|
667
|
+
const abortCallsAfterAmbiguous = abortCalls.length;
|
|
668
|
+
// /state bind-active → exactly one abort; same clientRequestId; no remint.
|
|
669
|
+
applyPendingReconcileDecision(bag, { action: "bind-active", turnId: input.turnId }, {
|
|
670
|
+
activeTurn: {
|
|
671
|
+
turnId: input.turnId,
|
|
672
|
+
clientRequestId: input.clientRequestId,
|
|
673
|
+
state: "running",
|
|
674
|
+
},
|
|
675
|
+
}, {
|
|
676
|
+
onAutoAbort: (turnId) => void hooks.postAbort(turnId),
|
|
677
|
+
});
|
|
678
|
+
// Repeated Stop / bind-time auto-abort coalesce to one.
|
|
679
|
+
requestStopOnOwnership(bag, hooks);
|
|
680
|
+
honorStopIntentAfterBind(bag, input.turnId, hooks);
|
|
681
|
+
return {
|
|
682
|
+
bag,
|
|
683
|
+
clientRequestId: input.clientRequestId,
|
|
684
|
+
abortCalls,
|
|
685
|
+
// Orchestration never issues a second create-turn POST.
|
|
686
|
+
createTurnPosts: 0,
|
|
687
|
+
stopRequestedAfterAmbiguous,
|
|
688
|
+
abortCallsAfterAmbiguous,
|
|
689
|
+
};
|
|
690
|
+
}
|