@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,280 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { buildTurnProcessGroups, hydrateSessionThread, selectRecentTurnGroups, } from "../../chat/turn-process.js";
|
|
3
|
+
import { createChatSseEventApplier, } from "./chat-sse-events.js";
|
|
4
|
+
import { taskContextUnchanged } from "./format.js";
|
|
5
|
+
const EMPTY_USAGE = {
|
|
6
|
+
inputTokens: 0,
|
|
7
|
+
outputTokens: 0,
|
|
8
|
+
cacheReadTokens: 0,
|
|
9
|
+
cacheWriteTokens: 0,
|
|
10
|
+
totalTokens: 0,
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Thread state + SSE block parsing. The event-application logic itself lives
|
|
14
|
+
* in chat-sse-events.ts (createChatSseEventApplier); this hook owns the state
|
|
15
|
+
* slices it patches and the derived timeline projections.
|
|
16
|
+
*/
|
|
17
|
+
export function useChatThread(params) {
|
|
18
|
+
const { origin, refs, sessionId, setError, onReconcile } = params;
|
|
19
|
+
// setProcessOpen remains on the hook API for session lifecycle close/reset
|
|
20
|
+
// (UI-08); the SSE applier must not open the process panel.
|
|
21
|
+
void params.setProcessOpen;
|
|
22
|
+
const [messages, setMessages] = useState([]);
|
|
23
|
+
const [toolCalls, setToolCalls] = useState([]);
|
|
24
|
+
const [operationCards, setOperationCards] = useState([]);
|
|
25
|
+
const [artifactCards, setArtifactCards] = useState([]);
|
|
26
|
+
const [historyLimit, setHistoryLimit] = useState(50);
|
|
27
|
+
const [unread, setUnread] = useState(0);
|
|
28
|
+
const [humanGateCards, setHumanGateCards] = useState([]);
|
|
29
|
+
const [interview, setInterview] = useState(null);
|
|
30
|
+
const [taskContext, setTaskContext] = useState(null);
|
|
31
|
+
const [contextLoading, setContextLoading] = useState(false);
|
|
32
|
+
const [usage, setUsage] = useState(EMPTY_USAGE);
|
|
33
|
+
const [streaming, setStreaming] = useState(false);
|
|
34
|
+
/** Assistant bubble id for the in-flight turn; only this row shows the streaming cursor. */
|
|
35
|
+
const [streamingAssistantId, setStreamingAssistantId] = useState(null);
|
|
36
|
+
const [showSystemInMessages] = useState(false);
|
|
37
|
+
// All inputs are stable (state setters + the memoized refs bag), so the
|
|
38
|
+
// applier identity is stable across renders.
|
|
39
|
+
const applyChatSseEvent = useMemo(() => createChatSseEventApplier({
|
|
40
|
+
refs,
|
|
41
|
+
onReconcile,
|
|
42
|
+
setError,
|
|
43
|
+
setInterview,
|
|
44
|
+
setHumanGateCards,
|
|
45
|
+
setArtifactCards,
|
|
46
|
+
setStreaming,
|
|
47
|
+
setStreamingAssistantId,
|
|
48
|
+
setUnread,
|
|
49
|
+
setOperationCards,
|
|
50
|
+
setUsage,
|
|
51
|
+
setMessages,
|
|
52
|
+
setToolCalls,
|
|
53
|
+
}), [refs, onReconcile, setError]);
|
|
54
|
+
/** Parse + apply one raw SSE block (frames separated by \n\n). Returns the
|
|
55
|
+
* eventId if the block carried an `id:` line (for Last-Event-ID tracking). */
|
|
56
|
+
const applySseBlock = useCallback((block, assistantId, options) => {
|
|
57
|
+
if ((options?.targetSessionId &&
|
|
58
|
+
refs.sessionRef.current?.sessionId !== options.targetSessionId) ||
|
|
59
|
+
(options?.generation !== undefined &&
|
|
60
|
+
refs.sessionGenerationRef.current !== options.generation))
|
|
61
|
+
return null;
|
|
62
|
+
const lines = block.split("\n");
|
|
63
|
+
let eventName = "message";
|
|
64
|
+
let dataStr = "";
|
|
65
|
+
let eventId = null;
|
|
66
|
+
for (const line of lines) {
|
|
67
|
+
if (line.startsWith("event: "))
|
|
68
|
+
eventName = line.slice(7).trim();
|
|
69
|
+
else if (line.startsWith("data: "))
|
|
70
|
+
dataStr += line.slice(6);
|
|
71
|
+
else if (line.startsWith("id: "))
|
|
72
|
+
eventId = line.slice(4).trim();
|
|
73
|
+
}
|
|
74
|
+
if (!dataStr)
|
|
75
|
+
return eventId;
|
|
76
|
+
let data;
|
|
77
|
+
try {
|
|
78
|
+
data = JSON.parse(dataStr);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return eventId;
|
|
82
|
+
}
|
|
83
|
+
const dedupeId = eventId ?? (typeof data.eventId === "string" ? data.eventId : null);
|
|
84
|
+
if (dedupeId) {
|
|
85
|
+
if (refs.seenEventIdsRef.current.has(dedupeId))
|
|
86
|
+
return dedupeId;
|
|
87
|
+
refs.seenEventIdsRef.current.add(dedupeId);
|
|
88
|
+
}
|
|
89
|
+
applyChatSseEvent(eventName, data, assistantId, options);
|
|
90
|
+
return eventId ?? dedupeId;
|
|
91
|
+
}, [applyChatSseEvent, refs]);
|
|
92
|
+
const loadTaskContext = useCallback(async (targetSessionId, options) => {
|
|
93
|
+
const background = options?.background === true;
|
|
94
|
+
if (!background)
|
|
95
|
+
setContextLoading(true);
|
|
96
|
+
try {
|
|
97
|
+
const res = await fetch(`${origin}/api/operator/v1/chat/sessions/${encodeURIComponent(targetSessionId)}/context`, { credentials: "include" });
|
|
98
|
+
if (!res.ok)
|
|
99
|
+
return;
|
|
100
|
+
const body = (await res.json());
|
|
101
|
+
if (body.context &&
|
|
102
|
+
refs.sessionRef.current?.sessionId === targetSessionId) {
|
|
103
|
+
setTaskContext((prev) => taskContextUnchanged(prev, body.context) ? prev : body.context);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
if (!background)
|
|
108
|
+
setContextLoading(false);
|
|
109
|
+
}
|
|
110
|
+
}, [origin, refs]);
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
if (sessionId)
|
|
113
|
+
void loadTaskContext(sessionId);
|
|
114
|
+
}, [sessionId, loadTaskContext]);
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (!sessionId)
|
|
117
|
+
return;
|
|
118
|
+
const timer = window.setTimeout(() => {
|
|
119
|
+
void loadTaskContext(sessionId, { background: true });
|
|
120
|
+
}, 350);
|
|
121
|
+
return () => window.clearTimeout(timer);
|
|
122
|
+
}, [sessionId, operationCards, humanGateCards, interview, loadTaskContext]);
|
|
123
|
+
const timelineMessages = useMemo(() => messages.filter((m) => m.role !== "system" || showSystemInMessages), [messages, showSystemInMessages]);
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
const onVisibility = () => {
|
|
126
|
+
if (!document.hidden)
|
|
127
|
+
setUnread(0);
|
|
128
|
+
};
|
|
129
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
130
|
+
return () => document.removeEventListener("visibilitychange", onVisibility);
|
|
131
|
+
}, []);
|
|
132
|
+
const processSummary = useMemo(() => {
|
|
133
|
+
if (toolCalls.length === 0)
|
|
134
|
+
return null;
|
|
135
|
+
const running = toolCalls.filter((t) => t.status === "running");
|
|
136
|
+
const errored = toolCalls.filter((t) => t.status === "error");
|
|
137
|
+
const current = running[running.length - 1];
|
|
138
|
+
let statusLabel = "完成";
|
|
139
|
+
let statusKind = "ok";
|
|
140
|
+
if (errored.length > 0) {
|
|
141
|
+
statusLabel = `${errored.length} 次出错`;
|
|
142
|
+
statusKind = "error";
|
|
143
|
+
}
|
|
144
|
+
else if (running.length > 0) {
|
|
145
|
+
statusLabel = current ? `${current.toolName} 运行中` : "运行中";
|
|
146
|
+
statusKind = "running";
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
// Completed is default/neutral; not shown as a permanent green success chip.
|
|
150
|
+
statusLabel = "";
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
count: toolCalls.length,
|
|
154
|
+
statusLabel,
|
|
155
|
+
statusKind,
|
|
156
|
+
};
|
|
157
|
+
}, [toolCalls]);
|
|
158
|
+
const turnGroups = useMemo(() => {
|
|
159
|
+
const all = buildTurnProcessGroups({
|
|
160
|
+
messages: timelineMessages,
|
|
161
|
+
toolCalls,
|
|
162
|
+
streaming,
|
|
163
|
+
activeAssistantId: streamingAssistantId,
|
|
164
|
+
});
|
|
165
|
+
return selectRecentTurnGroups(all, historyLimit);
|
|
166
|
+
}, [
|
|
167
|
+
timelineMessages,
|
|
168
|
+
toolCalls,
|
|
169
|
+
streaming,
|
|
170
|
+
streamingAssistantId,
|
|
171
|
+
historyLimit,
|
|
172
|
+
]);
|
|
173
|
+
const visibleMessages = useMemo(() => {
|
|
174
|
+
const next = [];
|
|
175
|
+
for (const group of turnGroups) {
|
|
176
|
+
if (group.user)
|
|
177
|
+
next.push(group.user);
|
|
178
|
+
next.push(...group.assistants);
|
|
179
|
+
}
|
|
180
|
+
return next;
|
|
181
|
+
}, [turnGroups]);
|
|
182
|
+
/** Reset all session-scoped projections before adopting a fresh session. */
|
|
183
|
+
const resetForNewSession = useCallback(() => {
|
|
184
|
+
setMessages([]);
|
|
185
|
+
setToolCalls([]);
|
|
186
|
+
setOperationCards([]);
|
|
187
|
+
setHumanGateCards([]);
|
|
188
|
+
setArtifactCards([]);
|
|
189
|
+
setInterview(null);
|
|
190
|
+
setTaskContext(null);
|
|
191
|
+
setUsage(EMPTY_USAGE);
|
|
192
|
+
setStreaming(false);
|
|
193
|
+
setStreamingAssistantId(null);
|
|
194
|
+
setUnread(0);
|
|
195
|
+
setHistoryLimit(50);
|
|
196
|
+
refs.usageResponseKeysRef.current = new Set();
|
|
197
|
+
}, [refs]);
|
|
198
|
+
/** Adopt a freshly activated session's hydrated thread + streaming flags. */
|
|
199
|
+
const applyActivatedSession = useCallback((next) => {
|
|
200
|
+
setMessages(next.messages);
|
|
201
|
+
setToolCalls(next.toolCalls);
|
|
202
|
+
setOperationCards([]);
|
|
203
|
+
setHumanGateCards([]);
|
|
204
|
+
setArtifactCards([]);
|
|
205
|
+
setTaskContext(null);
|
|
206
|
+
setInterview(null);
|
|
207
|
+
setUsage(EMPTY_USAGE);
|
|
208
|
+
refs.usageResponseKeysRef.current = new Set();
|
|
209
|
+
setStreaming(next.streaming);
|
|
210
|
+
setStreamingAssistantId(null);
|
|
211
|
+
setUnread(0);
|
|
212
|
+
setHistoryLimit(50);
|
|
213
|
+
}, [refs]);
|
|
214
|
+
/** Reconcile recovery (AC-001/AC-002/AC-003): reload the canonical session
|
|
215
|
+
* facts (session-store messages + event-ring tail cursor) and REPLACE the
|
|
216
|
+
* thread projection. Never calls applyActivatedSession: that would clear the
|
|
217
|
+
* operation/human-gate/artifact/interview cards, which the reconnected tail
|
|
218
|
+
* stream will not replay (they live in the ring, already consumed). */
|
|
219
|
+
const recoverSession = useCallback(async (targetSessionId) => {
|
|
220
|
+
try {
|
|
221
|
+
const res = await fetch(`${origin}/api/operator/v1/chat/sessions/${encodeURIComponent(targetSessionId)}`, { credentials: "include" });
|
|
222
|
+
if (!res.ok)
|
|
223
|
+
return false;
|
|
224
|
+
const body = (await res.json());
|
|
225
|
+
if (!body.session ||
|
|
226
|
+
refs.sessionRef.current?.sessionId !== targetSessionId)
|
|
227
|
+
return false;
|
|
228
|
+
const activeTurnId = body.session.activeTurnId ?? null;
|
|
229
|
+
refs.activeTurnIdRef.current = activeTurnId;
|
|
230
|
+
refs.streamingRef.current = Boolean(activeTurnId);
|
|
231
|
+
// Resume the events stream from the snapshot tail so the next
|
|
232
|
+
// reconnect never immediately re-expires (AC-003). The refs below
|
|
233
|
+
// are reset so any follow-up tail replay re-applies cleanly.
|
|
234
|
+
refs.lastEventIdRef.current = body.lastEventId ?? null;
|
|
235
|
+
refs.seenEventIdsRef.current = new Set();
|
|
236
|
+
refs.turnAssistantIdsRef.current = new Map();
|
|
237
|
+
refs.sealedAssistantIdsRef.current = new Set();
|
|
238
|
+
const hydrated = hydrateSessionThread(body.session.messages ?? []);
|
|
239
|
+
setMessages(hydrated.messages);
|
|
240
|
+
setToolCalls(hydrated.toolCalls);
|
|
241
|
+
setStreamingAssistantId(null);
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
// Reload failed: keep the old cursor; the next stream reopen will
|
|
246
|
+
// trigger another reconcile and retry (best-effort recovery).
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
}, [origin, refs, setMessages, setToolCalls, setStreamingAssistantId]);
|
|
250
|
+
return {
|
|
251
|
+
messages,
|
|
252
|
+
setMessages,
|
|
253
|
+
toolCalls,
|
|
254
|
+
setToolCalls,
|
|
255
|
+
operationCards,
|
|
256
|
+
artifactCards,
|
|
257
|
+
historyLimit,
|
|
258
|
+
setHistoryLimit,
|
|
259
|
+
unread,
|
|
260
|
+
humanGateCards,
|
|
261
|
+
interview,
|
|
262
|
+
setInterview,
|
|
263
|
+
taskContext,
|
|
264
|
+
contextLoading,
|
|
265
|
+
usage,
|
|
266
|
+
streaming,
|
|
267
|
+
setStreaming,
|
|
268
|
+
streamingAssistantId,
|
|
269
|
+
setStreamingAssistantId,
|
|
270
|
+
visibleMessages,
|
|
271
|
+
turnGroups,
|
|
272
|
+
processSummary,
|
|
273
|
+
applyChatSseEvent,
|
|
274
|
+
applySseBlock,
|
|
275
|
+
loadTaskContext,
|
|
276
|
+
resetForNewSession,
|
|
277
|
+
applyActivatedSession,
|
|
278
|
+
recoverSession,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
2
|
+
import { filterSlashCommands, mergeSlashCommands, } from "../../chat/shortcuts.js";
|
|
3
|
+
import { confirmationToken } from "./format.js";
|
|
4
|
+
import { clampShortcutIndex } from "./slash-palette-nav.js";
|
|
5
|
+
import { attachRuntimeSnapshotController } from "./useRuntimeSnapshot.js";
|
|
6
|
+
/** Composer state: input text, @file palette, image attachments, /shortcuts,
|
|
7
|
+
* IME composition guards, auto-grow and server-side draft sync. */
|
|
8
|
+
export function useComposer(params) {
|
|
9
|
+
const { origin, sessionId, refs, setError } = params;
|
|
10
|
+
const [input, setInputState] = useState("");
|
|
11
|
+
const [fileOptions, setFileOptions] = useState([]);
|
|
12
|
+
const [pendingImages, setPendingImages] = useState([]);
|
|
13
|
+
const [shortcutOpen, setShortcutOpen] = useState(false);
|
|
14
|
+
/** Any composer text that starts with `/` should reveal the palette,
|
|
15
|
+
* including draft restore. Escape can still close it without clearing. */
|
|
16
|
+
const setInput = useCallback((value) => {
|
|
17
|
+
if (typeof value === "function") {
|
|
18
|
+
setInputState((prev) => {
|
|
19
|
+
const next = value(prev);
|
|
20
|
+
setShortcutOpen(next.startsWith("/"));
|
|
21
|
+
return next;
|
|
22
|
+
});
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
setInputState(value);
|
|
26
|
+
setShortcutOpen(value.startsWith("/"));
|
|
27
|
+
}, []);
|
|
28
|
+
const [shortcutIndex, setShortcutIndex] = useState(0);
|
|
29
|
+
const [dynamicCommands, setDynamicCommands] = useState([]);
|
|
30
|
+
const [dynamicCommandsLoading, setDynamicCommandsLoading] = useState(false);
|
|
31
|
+
const [dynamicCommandsError, setDynamicCommandsError] = useState(null);
|
|
32
|
+
const [commandsEpoch, setCommandsEpoch] = useState(0);
|
|
33
|
+
const textareaRef = useRef(null);
|
|
34
|
+
/** Active session generation for /commands; bumped immediately on switch (AC-2). */
|
|
35
|
+
const commandsSessionRef = useRef(sessionId);
|
|
36
|
+
const commandsGenerationRef = useRef(0);
|
|
37
|
+
const handleInputChange = useCallback((value) => {
|
|
38
|
+
setInput(value);
|
|
39
|
+
setShortcutOpen(value.startsWith("/"));
|
|
40
|
+
setShortcutIndex(0);
|
|
41
|
+
}, []);
|
|
42
|
+
// Immediate invalidation on A→B even when B palette never opens (AC-2).
|
|
43
|
+
useLayoutEffect(() => {
|
|
44
|
+
commandsSessionRef.current = sessionId;
|
|
45
|
+
commandsGenerationRef.current += 1;
|
|
46
|
+
setDynamicCommands([]);
|
|
47
|
+
setDynamicCommandsError(null);
|
|
48
|
+
setDynamicCommandsLoading(false);
|
|
49
|
+
}, [sessionId]);
|
|
50
|
+
const loadDynamicCommands = useCallback(async () => {
|
|
51
|
+
if (!sessionId) {
|
|
52
|
+
setDynamicCommands([]);
|
|
53
|
+
setDynamicCommandsError(null);
|
|
54
|
+
setDynamicCommandsLoading(false);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const target = sessionId;
|
|
58
|
+
const generation = commandsGenerationRef.current;
|
|
59
|
+
commandsSessionRef.current = target;
|
|
60
|
+
setDynamicCommandsLoading(true);
|
|
61
|
+
setDynamicCommandsError(null);
|
|
62
|
+
const isCurrent = () => commandsSessionRef.current === target &&
|
|
63
|
+
commandsGenerationRef.current === generation;
|
|
64
|
+
try {
|
|
65
|
+
const res = await fetch(`${origin}/api/operator/v1/chat/sessions/${encodeURIComponent(target)}/commands`, { credentials: "include" });
|
|
66
|
+
if (!isCurrent())
|
|
67
|
+
return;
|
|
68
|
+
if (!res.ok) {
|
|
69
|
+
setDynamicCommandsError("动态命令加载失败");
|
|
70
|
+
setDynamicCommands([]);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const body = (await res.json().catch(() => null));
|
|
74
|
+
const items = [];
|
|
75
|
+
for (const raw of body?.commands ?? []) {
|
|
76
|
+
const source = raw.source;
|
|
77
|
+
if (source !== "extension" &&
|
|
78
|
+
source !== "prompt" &&
|
|
79
|
+
source !== "skill") {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const command = String(raw.command ?? raw.name ?? "").trim();
|
|
83
|
+
if (!command)
|
|
84
|
+
continue;
|
|
85
|
+
items.push({
|
|
86
|
+
command: command.startsWith("/") ? command : `/${command}`,
|
|
87
|
+
label: String(raw.label ?? raw.name ?? command),
|
|
88
|
+
description: String(raw.description ?? ""),
|
|
89
|
+
source,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (!isCurrent())
|
|
93
|
+
return;
|
|
94
|
+
setDynamicCommands(items);
|
|
95
|
+
// Compact server fail-soft / partial-source warning; local Operator/Web still merge.
|
|
96
|
+
const warning = typeof body?.warning === "string" ? body.warning.trim() : "";
|
|
97
|
+
setDynamicCommandsError(warning ? warning.slice(0, 160) : null);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
if (!isCurrent())
|
|
101
|
+
return;
|
|
102
|
+
setDynamicCommandsError("动态命令加载失败");
|
|
103
|
+
setDynamicCommands([]);
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
if (isCurrent()) {
|
|
107
|
+
setDynamicCommandsLoading(false);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}, [origin, sessionId]);
|
|
111
|
+
// Lazy-load dynamic commands when slash palette opens or session changes.
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
if (!sessionId)
|
|
114
|
+
return;
|
|
115
|
+
if (!shortcutOpen && commandsEpoch === 0)
|
|
116
|
+
return;
|
|
117
|
+
void loadDynamicCommands();
|
|
118
|
+
}, [sessionId, shortcutOpen, commandsEpoch, loadDynamicCommands]);
|
|
119
|
+
const retryDynamicCommands = useCallback(() => {
|
|
120
|
+
setCommandsEpoch((n) => n + 1);
|
|
121
|
+
void loadDynamicCommands();
|
|
122
|
+
}, [loadDynamicCommands]);
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
if (!sessionId)
|
|
125
|
+
return;
|
|
126
|
+
const match = input
|
|
127
|
+
.slice(0, textareaRef.current?.selectionStart ?? input.length)
|
|
128
|
+
.match(/(?:^|\s)@([^\s@]*)$/);
|
|
129
|
+
if (!match) {
|
|
130
|
+
setFileOptions([]);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const timer = window.setTimeout(() => {
|
|
134
|
+
void fetch(`${origin}/api/operator/v1/chat/sessions/${encodeURIComponent(sessionId)}/files?q=${encodeURIComponent(match[1] ?? "")}`)
|
|
135
|
+
.then((r) => (r.ok ? r.json() : null))
|
|
136
|
+
.then((body) => setFileOptions((body?.files ?? []).map((item) => item.path)));
|
|
137
|
+
}, 150);
|
|
138
|
+
return () => window.clearTimeout(timer);
|
|
139
|
+
}, [origin, sessionId, input]);
|
|
140
|
+
const insertFileReference = useCallback((file) => {
|
|
141
|
+
const caret = textareaRef.current?.selectionStart ?? input.length;
|
|
142
|
+
const before = input.slice(0, caret);
|
|
143
|
+
const start = before.search(/@[^\s@]*$/);
|
|
144
|
+
if (start < 0)
|
|
145
|
+
return;
|
|
146
|
+
setInput(`${input.slice(0, start)}@${file} ${input.slice(caret)}`);
|
|
147
|
+
setFileOptions([]);
|
|
148
|
+
}, [input]);
|
|
149
|
+
const addImagesFromFiles = useCallback((files) => {
|
|
150
|
+
for (const file of Array.from(files).slice(0, 4)) {
|
|
151
|
+
if (!file.type.startsWith("image/") || file.size > 5 * 1024 * 1024) {
|
|
152
|
+
setError("图片仅支持 PNG/JPEG/GIF/WebP,单张不超过 5 MiB");
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
const reader = new FileReader();
|
|
156
|
+
reader.onload = () => {
|
|
157
|
+
const value = String(reader.result ?? "");
|
|
158
|
+
const data = value.slice(value.indexOf(",") + 1);
|
|
159
|
+
setPendingImages((items) => [
|
|
160
|
+
...items,
|
|
161
|
+
{
|
|
162
|
+
name: file.name,
|
|
163
|
+
type: "image",
|
|
164
|
+
mimeType: file.type,
|
|
165
|
+
data,
|
|
166
|
+
},
|
|
167
|
+
].slice(0, 4));
|
|
168
|
+
};
|
|
169
|
+
reader.readAsDataURL(file);
|
|
170
|
+
}
|
|
171
|
+
}, [setError]);
|
|
172
|
+
const removeImage = useCallback((image) => {
|
|
173
|
+
setPendingImages((items) => items.filter((item) => item !== image));
|
|
174
|
+
}, []);
|
|
175
|
+
// Auto-grow textarea height.
|
|
176
|
+
useLayoutEffect(() => {
|
|
177
|
+
const ta = textareaRef.current;
|
|
178
|
+
if (!ta)
|
|
179
|
+
return;
|
|
180
|
+
ta.style.height = "auto";
|
|
181
|
+
ta.style.height = `${Math.min(ta.scrollHeight, 280)}px`;
|
|
182
|
+
}, [input]);
|
|
183
|
+
// Debounced server-side composer draft sync.
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
if (!sessionId)
|
|
186
|
+
return;
|
|
187
|
+
const timer = window.setTimeout(() => {
|
|
188
|
+
void fetch(`${origin}/api/operator/v1/chat/sessions/${encodeURIComponent(sessionId)}/draft`, {
|
|
189
|
+
method: "PUT",
|
|
190
|
+
credentials: "include",
|
|
191
|
+
headers: {
|
|
192
|
+
"content-type": "application/json",
|
|
193
|
+
"x-loop-console-confirmation": confirmationToken(),
|
|
194
|
+
},
|
|
195
|
+
body: JSON.stringify({ text: input }),
|
|
196
|
+
});
|
|
197
|
+
}, 400);
|
|
198
|
+
return () => window.clearTimeout(timer);
|
|
199
|
+
}, [origin, sessionId, input]);
|
|
200
|
+
const mergedCommands = useMemo(() => mergeSlashCommands(dynamicCommands), [dynamicCommands]);
|
|
201
|
+
const filteredShortcuts = useMemo(() => input.startsWith("/")
|
|
202
|
+
? filterSlashCommands(mergedCommands, input)
|
|
203
|
+
: [], [input, mergedCommands]);
|
|
204
|
+
// Keep the active option index inside the current candidate range (UI-12
|
|
205
|
+
// AC-011): dynamic loads completing/failing empty, retries, session
|
|
206
|
+
// switches, late responses and search shrink all funnel through
|
|
207
|
+
// filteredShortcuts.length. The clamped index always matches a rendered
|
|
208
|
+
// `oc-shortcut-option-${globalIndex}` id (same source of truth).
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
setShortcutIndex((index) => clampShortcutIndex(index, filteredShortcuts.length));
|
|
211
|
+
}, [filteredShortcuts.length]);
|
|
212
|
+
const onCompositionStart = useCallback(() => {
|
|
213
|
+
refs.isComposingRef.current = true;
|
|
214
|
+
}, [refs]);
|
|
215
|
+
const onCompositionEnd = useCallback(() => {
|
|
216
|
+
refs.isComposingRef.current = false;
|
|
217
|
+
refs.compositionEndedAtRef.current = Date.now();
|
|
218
|
+
}, [refs]);
|
|
219
|
+
/** IME guard used by the ChatComposer keyboard wrapper (mirrors OperatorChat). */
|
|
220
|
+
const isComposingNow = useCallback(() => {
|
|
221
|
+
return refs.isComposingRef.current;
|
|
222
|
+
}, [refs]);
|
|
223
|
+
/** 100ms post-composition window (mirrors OperatorChat). */
|
|
224
|
+
const recentlyComposedNow = useCallback(() => {
|
|
225
|
+
return Date.now() - refs.compositionEndedAtRef.current < 100;
|
|
226
|
+
}, [refs]);
|
|
227
|
+
// Bind the shared runtime snapshot to the active session (the composer owns
|
|
228
|
+
// origin + sessionId + refs in a writable file; the snapshot store is
|
|
229
|
+
// consumed by ChatComposer / panels / runtime-context popover).
|
|
230
|
+
useEffect(() => {
|
|
231
|
+
attachRuntimeSnapshotController({ origin, sessionId, refs });
|
|
232
|
+
}, [origin, sessionId, refs]);
|
|
233
|
+
return {
|
|
234
|
+
input,
|
|
235
|
+
setInput,
|
|
236
|
+
handleInputChange,
|
|
237
|
+
fileOptions,
|
|
238
|
+
pendingImages,
|
|
239
|
+
setPendingImages,
|
|
240
|
+
addImagesFromFiles,
|
|
241
|
+
removeImage,
|
|
242
|
+
shortcutOpen,
|
|
243
|
+
setShortcutOpen,
|
|
244
|
+
shortcutIndex,
|
|
245
|
+
setShortcutIndex,
|
|
246
|
+
filteredShortcuts,
|
|
247
|
+
dynamicCommandsLoading,
|
|
248
|
+
dynamicCommandsError,
|
|
249
|
+
retryDynamicCommands,
|
|
250
|
+
insertFileReference,
|
|
251
|
+
textareaRef,
|
|
252
|
+
onCompositionStart,
|
|
253
|
+
onCompositionEnd,
|
|
254
|
+
isComposingNow,
|
|
255
|
+
recentlyComposedNow,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
import { confirmationToken } from "./format.js";
|
|
3
|
+
/** Requirement Interview actions (grill-me flow) driven from the chat surface. */
|
|
4
|
+
export function useInterview(params) {
|
|
5
|
+
const { origin, refs, thread, setError } = params;
|
|
6
|
+
const { interview, setInterview } = thread;
|
|
7
|
+
const [interviewAnswer, setInterviewAnswer] = useState("");
|
|
8
|
+
const startInterview = useCallback(async () => {
|
|
9
|
+
const active = refs.sessionRef.current;
|
|
10
|
+
if (!active)
|
|
11
|
+
return;
|
|
12
|
+
const taskId = window.prompt("Task ID(例如 2026-07-26-my-task)")?.trim();
|
|
13
|
+
if (!taskId)
|
|
14
|
+
return;
|
|
15
|
+
const res = await fetch(`${origin}/api/operator/v1/chat/sessions/${active.sessionId}/interviews`, {
|
|
16
|
+
method: "POST",
|
|
17
|
+
headers: {
|
|
18
|
+
"Content-Type": "application/json",
|
|
19
|
+
"x-loop-console-confirmation": confirmationToken(),
|
|
20
|
+
},
|
|
21
|
+
credentials: "include",
|
|
22
|
+
body: JSON.stringify({ taskId }),
|
|
23
|
+
});
|
|
24
|
+
const body = (await res.json());
|
|
25
|
+
if (!res.ok) {
|
|
26
|
+
setError(body.error?.message ?? `HTTP ${res.status}`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
setInterview({
|
|
30
|
+
interviewSessionId: body.interview?.sessionId,
|
|
31
|
+
taskId,
|
|
32
|
+
state: body.interview?.state,
|
|
33
|
+
question: body.question,
|
|
34
|
+
draft: body.draft?.draft,
|
|
35
|
+
draftSha256: body.draft?.draftSha256,
|
|
36
|
+
assessment: body.assessment,
|
|
37
|
+
});
|
|
38
|
+
}, [origin, refs, setInterview, setError]);
|
|
39
|
+
const answerInterview = useCallback(async (response) => {
|
|
40
|
+
const active = refs.sessionRef.current;
|
|
41
|
+
if (!active || !interview?.interviewSessionId || !interview.question)
|
|
42
|
+
return;
|
|
43
|
+
const res = await fetch(`${origin}/api/operator/v1/chat/sessions/${active.sessionId}/interviews/${interview.interviewSessionId}/answers`, {
|
|
44
|
+
method: "POST",
|
|
45
|
+
headers: {
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
"x-loop-console-confirmation": confirmationToken(),
|
|
48
|
+
},
|
|
49
|
+
credentials: "include",
|
|
50
|
+
body: JSON.stringify({
|
|
51
|
+
questionId: interview.question.id,
|
|
52
|
+
response,
|
|
53
|
+
...(response === "override" ? { text: interviewAnswer } : {}),
|
|
54
|
+
}),
|
|
55
|
+
});
|
|
56
|
+
const body = (await res.json());
|
|
57
|
+
if (!res.ok) {
|
|
58
|
+
setError(body.error?.message ?? `HTTP ${res.status}`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
setInterview((current) => ({
|
|
62
|
+
...(current ?? {}),
|
|
63
|
+
state: body.interview?.state,
|
|
64
|
+
question: body.question,
|
|
65
|
+
draft: body.draft?.draft,
|
|
66
|
+
draftSha256: body.draft?.draftSha256,
|
|
67
|
+
assessment: body.assessment,
|
|
68
|
+
taskKindRecommendation: body.taskKindRecommendation ?? current?.taskKindRecommendation,
|
|
69
|
+
}));
|
|
70
|
+
setInterviewAnswer("");
|
|
71
|
+
}, [origin, refs, interview, interviewAnswer, setInterview, setError]);
|
|
72
|
+
const confirmTaskKind = useCallback(async () => {
|
|
73
|
+
const active = refs.sessionRef.current;
|
|
74
|
+
if (!active ||
|
|
75
|
+
!interview?.interviewSessionId ||
|
|
76
|
+
!interview.taskKindRecommendation)
|
|
77
|
+
return;
|
|
78
|
+
const res = await fetch(`${origin}/api/operator/v1/chat/sessions/${active.sessionId}/interviews/${interview.interviewSessionId}/task-kind/confirm`, {
|
|
79
|
+
method: "POST",
|
|
80
|
+
headers: {
|
|
81
|
+
"Content-Type": "application/json",
|
|
82
|
+
"x-loop-console-confirmation": confirmationToken(),
|
|
83
|
+
},
|
|
84
|
+
credentials: "include",
|
|
85
|
+
body: JSON.stringify({ taskKind: interview.taskKindRecommendation }),
|
|
86
|
+
});
|
|
87
|
+
const body = (await res.json());
|
|
88
|
+
if (!res.ok) {
|
|
89
|
+
setError(body.error?.message ?? `HTTP ${res.status}`);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
setInterview((current) => ({
|
|
93
|
+
...(current ?? {}),
|
|
94
|
+
confirmedTaskKind: current?.taskKindRecommendation,
|
|
95
|
+
taskKindRecommendation: undefined,
|
|
96
|
+
draft: body.draft?.draft,
|
|
97
|
+
draftSha256: body.draft?.draftSha256,
|
|
98
|
+
assessment: body.assessment,
|
|
99
|
+
}));
|
|
100
|
+
}, [origin, refs, interview, setInterview, setError]);
|
|
101
|
+
return {
|
|
102
|
+
interviewAnswer,
|
|
103
|
+
setInterviewAnswer,
|
|
104
|
+
startInterview,
|
|
105
|
+
answerInterview,
|
|
106
|
+
confirmTaskKind,
|
|
107
|
+
};
|
|
108
|
+
}
|