@tea-agent/loop-agent 0.1.0-fe-test.2 → 0.1.0-fe-test.4
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 +6 -3
- package/CHANGELOG.md +607 -93
- package/README.md +11 -5
- package/bin/loop-agent.js +7 -3
- package/dist/adapters/context-transfer/optional-pi-handoff.js +31 -0
- package/dist/adapters/context-transfer/pi-session.js +61 -0
- package/dist/application/dag/generate-task-dag.js +90 -21
- package/dist/application/dag/run-dag.js +41 -0
- package/dist/application/task-lifecycle/advance.js +40 -5
- package/dist/application/task-lifecycle/observe.js +171 -17
- package/dist/application/task-lifecycle/plan-transitions.js +42 -7
- package/dist/application/task-lifecycle/recommendations.js +13 -2
- package/dist/build-stamp.json +3 -3
- package/dist/cli/command-definitions.js +44 -10
- package/dist/cli/program.js +82 -6
- package/dist/cli/update/notifier.js +2 -2
- package/dist/cli/update/runtime-activity.js +1 -29
- package/dist/cli.js +2 -1
- package/dist/commands/client-recovery.js +11 -36
- package/dist/commands/dag-artifact.js +284 -0
- package/dist/commands/dag-context.js +184 -0
- package/dist/commands/dag-follow-up.js +138 -0
- package/dist/commands/dag-rerun-task.js +2 -0
- package/dist/commands/dag-rerun.js +261 -2
- package/dist/commands/init-model-catalog.js +486 -0
- package/dist/commands/init-upgrade.js +265 -97
- package/dist/commands/init.js +455 -28
- package/dist/commands/inspect-next.js +8 -0
- package/dist/commands/task-advance.js +73 -1
- package/dist/commands/task-source-prepare.js +5 -0
- package/dist/commands/task-status.js +1 -0
- package/dist/executors/dag-pi-executor.js +4321 -231
- package/dist/executors/pi-event-serializer.js +42 -1
- package/dist/executors/pi-executor.js +70 -6
- package/dist/executors/pi-extension-resolver.js +245 -0
- package/dist/executors/pi-playwright-cli-tool.js +74 -28
- package/dist/executors/pi-read-budget-policy.js +239 -0
- package/dist/executors/pi-sdk-executor.js +263 -59
- package/dist/executors/pi-writer-tool-policy.js +57 -1
- package/dist/executors/shell-executor.js +1443 -240
- package/dist/executors/shell-write-guard.js +14 -0
- package/dist/executors/workspace-write-snapshot.js +68 -0
- package/dist/governance/checks.js +1 -0
- package/dist/{worker → infrastructure}/console/app-data.js +4 -0
- package/dist/infrastructure/console/artifact-revision-store.js +430 -0
- package/dist/infrastructure/console/context-export-store.js +160 -0
- package/dist/infrastructure/console/dir-lock.js +132 -0
- package/dist/infrastructure/console/operation-store.js +417 -0
- package/dist/infrastructure/harness/artifact-store.js +10 -1
- package/dist/infrastructure/harness/atomic-write.js +35 -2
- package/dist/shared/context-transfer/artifact-revision.js +172 -0
- package/dist/shared/context-transfer.js +418 -0
- package/dist/shared/dag-failure-category.js +150 -0
- package/dist/shared/dag-prompt-override.js +27 -0
- package/dist/shared/openspec-spec.js +70 -4
- package/dist/shared/operator/capabilities.js +65 -4
- package/dist/shared/operator/safe-run-summary.js +1 -0
- package/dist/shared/path-safety.js +93 -0
- package/dist/shared/pi-context-pressure/checkpoint.js +116 -0
- package/dist/shared/pi-context-pressure/compaction-policy.js +151 -0
- package/dist/shared/pi-context-pressure/env.js +58 -0
- package/dist/shared/pi-context-pressure/extension.js +100 -0
- package/dist/shared/pi-context-pressure/index.js +7 -0
- package/dist/shared/pi-context-pressure/overflow.js +252 -0
- package/dist/shared/pi-context-pressure/sift-bridge.js +386 -0
- package/dist/shared/pi-context-pressure/telemetry.js +51 -0
- package/dist/shared/playwright-cli-command-policy.js +15 -0
- package/dist/shared/preview.js +28 -4
- package/dist/shared/update/console-notifier.js +100 -0
- package/dist/{cli → shared}/update/npm-client.js +70 -15
- package/dist/{cli → shared}/update/state.js +41 -13
- package/dist/task/config-types.js +125 -6
- package/dist/task/contract/adopt.js +4 -0
- package/dist/task/contract/apply.js +11 -1
- package/dist/task/contract/constants.js +3 -0
- package/dist/task/contract/diff.js +26 -0
- package/dist/task/contract/hash.js +3 -0
- package/dist/task/contract/import-revision.js +4 -0
- package/dist/task/contract/observe.js +25 -4
- package/dist/task/contract/paths.js +2 -1
- package/dist/task/contract/project.js +23 -1
- package/dist/task/contract/schema.js +9 -1
- package/dist/task/contract/transaction.js +12 -0
- package/dist/task/frontend-project-capability.js +203 -20
- package/dist/task/runtime.js +5 -2
- package/dist/task/source-prepare/build-draft.js +18 -3
- package/dist/task/source-prepare/completeness.js +188 -0
- package/dist/task/source-prepare/fragment-inventory.js +513 -0
- package/dist/task/source-prepare/index.js +3 -0
- package/dist/task/source-prepare/ledger-reconciliation.js +127 -0
- package/dist/task/source-prepare/ledger-review.js +214 -0
- package/dist/task/source-prepare/ledger.js +545 -0
- package/dist/task/source-prepare/parse-intent.js +24 -4
- package/dist/task/source-prepare/prepare.js +368 -2
- package/dist/task/source-prepare/semantic-intake.js +25 -5
- package/dist/task/source-prepare/source-fidelity-pi.js +384 -0
- package/dist/task/source-prepare/types.js +22 -0
- package/dist/task/source-references.js +22 -1
- package/dist/task/task-demand-routing.js +3 -0
- package/dist/worker/cli.js +18 -2
- package/dist/worker/console/chat/assistant-content.js +7 -0
- package/dist/worker/console/chat/chat-event-store.js +159 -18
- package/dist/worker/console/chat/chat-ui-policy.js +4 -2
- package/dist/worker/console/chat/context-panel.js +7 -0
- package/dist/worker/console/chat/deferred-turn.js +103 -0
- package/dist/worker/console/chat/goal-round-driver.js +72 -0
- package/dist/worker/console/chat/goals.js +300 -0
- package/dist/worker/console/chat/model-resolver.js +7 -4
- package/dist/worker/console/chat/operation-card.js +8 -1
- package/dist/worker/console/chat/pi-console-config.js +81 -10
- package/dist/worker/console/chat/pi-runtime.js +868 -30
- package/dist/worker/console/chat/provider-error.js +99 -0
- package/dist/worker/console/chat/repo-browser.js +101 -12
- package/dist/worker/console/chat/resource-preferences-store.js +1 -1
- package/dist/worker/console/chat/routes.js +1451 -145
- package/dist/worker/console/chat/sdd-data-alignment.js +222 -0
- package/dist/worker/console/chat/semantic-activity.js +25 -24
- package/dist/worker/console/chat/session-catalog.js +50 -0
- package/dist/worker/console/chat/session-stats.js +275 -0
- package/dist/worker/console/chat/session-store.js +348 -76
- package/dist/worker/console/chat/shortcuts.js +26 -3
- package/dist/worker/console/chat/sift-bridge.js +1 -0
- package/dist/worker/console/chat/todos.js +115 -0
- package/dist/worker/console/chat/tool-preview.js +42 -0
- package/dist/worker/console/chat/turn-process.js +185 -112
- package/dist/worker/console/chat/user-questions.js +266 -0
- package/dist/worker/console/chat/workspace-landing.js +79 -0
- package/dist/worker/console/console-handoff.js +82 -0
- package/dist/worker/console/console-update-and-init.js +115 -0
- package/dist/worker/console/console-update-runtime.js +84 -0
- package/dist/worker/console/context-transfer-diagnostics.js +198 -0
- package/dist/worker/console/dag-confirmation.js +1 -1
- package/dist/worker/console/dag-execution-receipt.js +54 -3
- package/dist/worker/console/doctor.js +1 -1
- package/dist/worker/console/draft-store.js +50 -1
- package/dist/worker/console/frontend-human-decision-adapter.js +19 -0
- package/dist/worker/console/frontend-split-operation-adapter.js +20 -0
- package/dist/worker/console/human-gate-token.js +1 -1
- package/dist/worker/console/index.js +6 -3
- package/dist/worker/console/inspect-split.js +18 -0
- package/dist/worker/console/interview/assessment.js +1 -1
- package/dist/worker/console/interview/session.js +1 -1
- package/dist/worker/console/native-directory-picker.js +13 -0
- package/dist/worker/console/operation-run-facts.js +19 -3
- package/dist/worker/console/operation-runner.js +45 -4
- package/dist/worker/console/operation-sse.js +1 -1
- package/dist/worker/console/operation-wait.js +1 -1
- package/dist/worker/console/operator-actions.js +534 -15
- package/dist/worker/console/operator-selection.js +6 -2
- package/dist/worker/console/operator-surface-health.js +2 -1
- package/dist/worker/console/operator-user-error.js +171 -2
- package/dist/worker/console/pi-plugins.catalog.json +73658 -0
- package/dist/worker/console/pi-plugins.js +238 -0
- package/dist/worker/console/pi-readiness.js +7 -6
- package/dist/worker/console/prd-intake-bridge.js +13 -0
- package/dist/worker/console/recovery-cta.js +4 -4
- package/dist/worker/console/recovery-error-copy.js +4 -4
- package/dist/worker/console/routes.js +1231 -10
- package/dist/worker/console/security.js +102 -13
- package/dist/worker/console/server.js +762 -159
- package/dist/worker/console/static/assets/{abnfDiagram-N423BO3Z-BmOEx0gA.js → abnfDiagram-N423BO3Z-BZogYNl1.js} +1 -1
- package/dist/worker/console/static/assets/{arc-BGiVVe8b.js → arc-DcJTLe2v.js} +1 -1
- package/dist/worker/console/static/assets/{architectureDiagram-T3A2C74G-nDdu4rgJ.js → architectureDiagram-T3A2C74G-B39EQQ9n.js} +1 -1
- package/dist/worker/console/static/assets/{blockDiagram-VBNYF7ZC-Bb5u0BWf.js → blockDiagram-VBNYF7ZC-CitCGV56.js} +1 -1
- package/dist/worker/console/static/assets/{c4Diagram-5PPSVZJV-BlhC0j94.js → c4Diagram-5PPSVZJV-rvWuOHLG.js} +1 -1
- package/dist/worker/console/static/assets/channel-CXqdP5pW.js +1 -0
- package/dist/worker/console/static/assets/{chunk-2GRJ4B5K-Ai8_qQXI.js → chunk-2GRJ4B5K-DGXplIJs.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-2Q5K7J3B-B9gyCjqX.js → chunk-2Q5K7J3B-ur9OqjPn.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5RXB4S5H-Bzbj3zGH.js → chunk-5RXB4S5H-D1KqU_Vi.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5VM5RSS4-BT415PvT.js → chunk-5VM5RSS4-BlVZrbtM.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-6Q2QTUOP-D_A5_5QL.js → chunk-6Q2QTUOP-BAzz3nQy.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-GF5L2VYU-srJkaP3f.js → chunk-GF5L2VYU-CP_nYuCV.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-JWPE2WC7-UYGvEP4l.js → chunk-JWPE2WC7-CWvKQ80X.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-KBJHAD2P-B8luBrrz.js → chunk-KBJHAD2P-CyUki8wp.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-RYQCIY6F-DN7wXZSq.js → chunk-RYQCIY6F-5NYzNKfY.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-XXDRQBXY-DXKyMuKS.js → chunk-XXDRQBXY-DHdUgjS-.js} +1 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-D9C3agF7.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-D9C3agF7.js +1 -0
- package/dist/worker/console/static/assets/{cose-bilkent-JH36ORCC-dqvoynXj.js → cose-bilkent-JH36ORCC-ANQ5g_t6.js} +1 -1
- package/dist/worker/console/static/assets/{cynefin-VYW2F7L2--PcyL34A.js → cynefin-VYW2F7L2-CruT_4-0.js} +1 -1
- package/dist/worker/console/static/assets/{cynefinDiagram-MW4NZA55-DvWs_hTY.js → cynefinDiagram-MW4NZA55-rbFo77ID.js} +1 -1
- package/dist/worker/console/static/assets/{dagre-VZM6K2ZE-DxeIxbyO.js → dagre-VZM6K2ZE-asstxBQs.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-7IWD3JNH-DPCG61Of.js → diagram-7IWD3JNH-DzTyBZwI.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-B4RE2ZJO-CmuU50-U.js → diagram-B4RE2ZJO-gw8ccH3B.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-LBJQPF4R-B61XLD_v.js → diagram-LBJQPF4R-B8RpZzOf.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-Q27KOJAE-BB7HTRRY.js → diagram-Q27KOJAE-B1zJkCS9.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-UB23O5K3-DvkboAIp.js → diagram-UB23O5K3-B6JLWZmO.js} +1 -1
- package/dist/worker/console/static/assets/{ebnfDiagram-BXEA7PRR-BdJ_y1fL.js → ebnfDiagram-BXEA7PRR-q2iZP-Ps.js} +1 -1
- package/dist/worker/console/static/assets/{erDiagram-JOGREHBK-9bUBZTRi.js → erDiagram-JOGREHBK-B3dbbktQ.js} +1 -1
- package/dist/worker/console/static/assets/{flowDiagram-UKHOOZJN-Dw4L4RBa.js → flowDiagram-UKHOOZJN-C-zc6-kB.js} +1 -1
- package/dist/worker/console/static/assets/{ganttDiagram-PKOTCBZU-Jr82N_QP.js → ganttDiagram-PKOTCBZU-BSolnot9.js} +1 -1
- package/dist/worker/console/static/assets/{gitGraphDiagram-DS77QQ5N-DAz9wFLr.js → gitGraphDiagram-DS77QQ5N-Bo8jGxTk.js} +1 -1
- package/dist/worker/console/static/assets/index-CAZ2fC_X.css +1 -0
- package/dist/worker/console/static/assets/index-DhfjOafu.js +449 -0
- package/dist/worker/console/static/assets/{infoDiagram-6WML65LV-CBB5Np7y.js → infoDiagram-6WML65LV-DQaZqJOH.js} +1 -1
- package/dist/worker/console/static/assets/{ishikawaDiagram-WSZJBQD7-D8IOp94y.js → ishikawaDiagram-WSZJBQD7-DsdX1WnE.js} +1 -1
- package/dist/worker/console/static/assets/{journeyDiagram-NVQOT4AX-Dgd3AHGG.js → journeyDiagram-NVQOT4AX-CP5EYDZL.js} +1 -1
- package/dist/worker/console/static/assets/{kanban-definition-27J2QSJJ-BmYOxLE9.js → kanban-definition-27J2QSJJ-DAm14Dr8.js} +1 -1
- package/dist/worker/console/static/assets/{linear-DfYTEF6J.js → linear-gZECoLc5.js} +1 -1
- package/dist/worker/console/static/assets/{mermaid.core-BjuFPRqa.js → mermaid.core-BRJNIM6p.js} +5 -5
- package/dist/worker/console/static/assets/{mindmap-definition-FAOFIHXS-CLyUViGd.js → mindmap-definition-FAOFIHXS-Cja3kLkR.js} +1 -1
- package/dist/worker/console/static/assets/{pegDiagram-VL7TDLO6-BvX2Di4-.js → pegDiagram-VL7TDLO6-22ZGFisL.js} +1 -1
- package/dist/worker/console/static/assets/{pieDiagram-7S7Q4E2Y-BFj0_OLv.js → pieDiagram-7S7Q4E2Y-BXin0Y1o.js} +1 -1
- package/dist/worker/console/static/assets/{quadrantDiagram-CIZ2JOQS-BIUrD_hx.js → quadrantDiagram-CIZ2JOQS-Cw6T69Yt.js} +1 -1
- package/dist/worker/console/static/assets/{railroadDiagram-AXF67PYL-CHBB48fj.js → railroadDiagram-AXF67PYL-C1-gTieN.js} +1 -1
- package/dist/worker/console/static/assets/{requirementDiagram-LRYGKXZP-sJrYw2Sf.js → requirementDiagram-LRYGKXZP--H5N2iI1.js} +1 -1
- package/dist/worker/console/static/assets/{sankeyDiagram-W5VNT64P-BzHH6fPR.js → sankeyDiagram-W5VNT64P-CgWAPeRz.js} +1 -1
- package/dist/worker/console/static/assets/{sequenceDiagram-SI44F4Z6-7QCnelCt.js → sequenceDiagram-SI44F4Z6-CrKqzGvt.js} +1 -1
- package/dist/worker/console/static/assets/{sizeCapture-X5ZJPWSS-sDYSxn72.js → sizeCapture-X5ZJPWSS-BB3wG06K.js} +1 -1
- package/dist/worker/console/static/assets/{stateDiagram-OKZ733FA-XpiUdwzm.js → stateDiagram-OKZ733FA-DjsGgdgY.js} +1 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-Tp7V0U4q.js +1 -0
- package/dist/worker/console/static/assets/{swimlanes-SLNWSIFB-DvqgNPzD.js → swimlanes-SLNWSIFB-DYKEbvAR.js} +2 -2
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-DUZWZWi8.js +8 -0
- package/dist/worker/console/static/assets/{timeline-definition-Z64GVDOM-2TyOYNx0.js → timeline-definition-Z64GVDOM-eQOb5k9Y.js} +1 -1
- package/dist/worker/console/static/assets/{vennDiagram-T6HMQDX7-B-nM6wM2.js → vennDiagram-T6HMQDX7-B2-l9FIu.js} +1 -1
- package/dist/worker/console/static/assets/{wardleyDiagram-T6FBY63Y-B86wPdbr.js → wardleyDiagram-T6FBY63Y-BX2Cda3l.js} +1 -1
- package/dist/worker/console/static/assets/{xychartDiagram-ELKLHX3M-Dr1C4AQz.js → xychartDiagram-ELKLHX3M-D9S892ph.js} +1 -1
- package/dist/worker/console/static/index.html +7 -2
- package/dist/worker/console/static-src/active-run-badge.js +17 -0
- package/dist/worker/console/static-src/app/console-types.js +68 -4
- package/dist/worker/console/static-src/app/useConsoleShell.js +30 -12
- package/dist/worker/console/static-src/app/useOperatorActions.js +43 -7
- package/dist/worker/console/static-src/app/useRecoveryActions.js +2 -2
- package/dist/worker/console/static-src/app/useRecoveryConsole.js +45 -10
- package/dist/worker/console/static-src/app/useRunProgress.js +54 -0
- package/dist/worker/console/static-src/app/useTaskWizard.js +74 -2
- package/dist/worker/console/static-src/night/useNightBoard.js +8 -5
- package/dist/worker/console/static-src/operator-chat/cards/failure-category-advice.js +25 -0
- package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +264 -13
- package/dist/worker/console/static-src/operator-chat/compaction-message.js +113 -0
- package/dist/worker/console/static-src/operator-chat/dag-progress-link.js +22 -0
- package/dist/worker/console/static-src/operator-chat/details-dag-actions.js +122 -0
- package/dist/worker/console/static-src/operator-chat/input-history.js +78 -0
- package/dist/worker/console/static-src/operator-chat/mutation-gate.js +1 -1
- package/dist/worker/console/static-src/operator-chat/open-preview-in-browser.js +338 -0
- package/dist/worker/console/static-src/operator-chat/refs.js +3 -0
- package/dist/worker/console/static-src/operator-chat/runtime-selection-labels.js +27 -0
- package/dist/worker/console/static-src/operator-chat/runtime-snapshot-store.js +10 -0
- package/dist/worker/console/static-src/operator-chat/spatial-overlay.js +1 -2
- package/dist/worker/console/static-src/operator-chat/turn-stream-controller.js +33 -1
- package/dist/worker/console/static-src/operator-chat/turn-submission.js +55 -0
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +448 -109
- package/dist/worker/console/static-src/operator-chat/useChatStream.js +344 -27
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +323 -11
- package/dist/worker/console/static-src/operator-chat/useComposer.js +45 -4
- package/dist/worker/console/static-src/operator-chat/useRepoBrowser.js +97 -13
- package/dist/worker/console/static-src/operator-chat/useRuntimeControls.js +57 -9
- package/dist/worker/console/static-src/operator-chat/useRuntimeSnapshot.js +8 -2
- package/dist/worker/console/static-src/operator-chat/useWorkspaceBrowserGate.js +4 -0
- package/dist/worker/console/static-src/operator-chat/workspace-layout-mode.js +3 -3
- package/dist/worker/console/static-src/operator-chat/workspace-reorder.js +18 -0
- package/dist/worker/console/static-src/pages/tasks/run-id-resolution.js +79 -0
- package/dist/worker/console/static-src/pages/tasks/run-ownership-verify.js +23 -0
- package/dist/worker/console/static-src/pages/tasks/run-panel-progress.js +216 -0
- package/dist/worker/console/static-src/shell/console-update-reload.js +52 -0
- package/dist/worker/console/static-src/shell/useWorkspaces.js +415 -0
- package/dist/worker/console/static-src/shell/workspace-route.js +356 -0
- package/dist/worker/console/workspace-context.js +399 -0
- package/dist/worker/console/workspace-registry.js +487 -0
- package/dist/worker/continuation/worker-continuation.js +278 -0
- package/dist/worker/loop-agent/loop-agent-client.js +7 -3
- package/dist/worker/materialize/frontend-split-task-materializer.js +72 -0
- package/dist/worker/materialize/harness-task-lineage.js +5 -2
- package/dist/worker/observability/init-runtime-activity.js +26 -0
- package/dist/worker/observability/read-model.js +26 -0
- package/dist/worker/observe/health.js +1 -1
- package/dist/worker/observe/node-input.js +160 -3
- package/dist/worker/observe/node-process.js +377 -0
- package/dist/worker/observe/node-transparency.js +572 -0
- package/dist/worker/observe/routes.js +278 -3
- package/dist/worker/observe/server.js +4 -0
- package/dist/worker/observe/shell-handler-keys.js +34 -0
- package/dist/worker/observe/static/api.js +154 -4
- package/dist/worker/observe/static/app.js +18 -70
- package/dist/worker/observe/static/constants.js +26 -19
- package/dist/worker/observe/static/dag-context-reason-labels.d.ts +9 -0
- package/dist/worker/observe/static/dag-context-reason-labels.js +139 -0
- package/dist/worker/observe/static/dag-helpers.js +4 -2
- package/dist/worker/observe/static/dag-history-labels.js +5 -0
- package/dist/worker/observe/static/dag-inspector-humanize.d.ts +16 -0
- package/dist/worker/observe/static/dag-inspector-humanize.js +339 -0
- package/dist/worker/observe/static/dag-node-purpose.d.ts +6 -0
- package/dist/worker/observe/static/dag-node-purpose.js +208 -0
- package/dist/worker/observe/static/format.js +60 -0
- package/dist/worker/observe/static/index.html +10 -5
- package/dist/worker/observe/static/inspect-bootstrap.d.ts +8 -0
- package/dist/worker/observe/static/inspect-bootstrap.js +57 -0
- package/dist/worker/observe/static/inspect-workspace.js +374 -0
- package/dist/worker/observe/static/kpi.js +2 -2
- package/dist/worker/observe/static/markdown-render.js +20 -1
- package/dist/worker/observe/static/operator-chrome.css +168 -24
- package/dist/worker/observe/static/operator-chrome.d.ts +30 -5
- package/dist/worker/observe/static/operator-chrome.js +354 -101
- package/dist/worker/observe/static/prompt-restart-candidates.d.ts +18 -0
- package/dist/worker/observe/static/prompt-restart-candidates.js +38 -0
- package/dist/worker/observe/static/relations.js +7 -7
- package/dist/worker/observe/static/router.d.ts +57 -0
- package/dist/worker/observe/static/router.js +67 -1
- package/dist/worker/observe/static/run-processing.js +4 -2
- package/dist/worker/observe/static/shell-chrome.js +2 -2
- package/dist/worker/observe/static/state.d.ts +50 -0
- package/dist/worker/observe/static/state.js +191 -1
- package/dist/worker/observe/static/styles.css +1720 -86
- package/dist/worker/observe/static/views/dag-graph.js +5 -3
- package/dist/worker/observe/static/views/dag-inspector.js +2601 -188
- package/dist/worker/observe/static/views/dag.d.ts +13 -0
- package/dist/worker/observe/static/views/dag.js +39 -18
- package/dist/worker/observe/static/views/dags.js +10 -6
- package/dist/worker/observe/static/views/dashboard.js +18 -8
- package/dist/worker/observe/static/views/failures.js +5 -2
- package/dist/worker/observe/static/views/night.js +2 -2
- package/dist/worker/observe/static/views/pool.js +8 -2
- package/dist/worker/observe/static/views/run.js +15 -4
- package/dist/worker/observe/static/views/session-timeline.js +386 -25
- package/dist/worker/observe/static/views/task.js +63 -3
- package/dist/worker/outcomes/adapters.js +19 -0
- package/dist/worker/outcomes/types.js +1 -0
- package/dist/worker/pool/attempt-lease.js +97 -66
- package/dist/worker/pool/begin-attempt-with-lease.js +1 -0
- package/dist/worker/pool/reconcile.js +46 -1
- package/dist/worker/pool/run-store.js +2 -0
- package/dist/worker/pool/state-projection.js +2 -0
- package/dist/worker/task-spec/workflow-routing.js +8 -3
- package/dist/workflows/dag/artifact-bindings.js +149 -0
- package/dist/workflows/dag/artifact-revision-schema-registry.js +31 -0
- package/dist/workflows/dag/backend-test-case-coverage-analysis.js +470 -31
- package/dist/workflows/dag/backend-test-markdown-workflow.js +189 -2
- package/dist/workflows/dag/backend-test-plan-protocol.js +210 -0
- package/dist/workflows/dag/backend-test-pytest-collection.js +168 -16
- package/dist/workflows/dag/backend-test-result-contract.js +5 -1
- package/dist/workflows/dag/backend-test-scenario-param.js +506 -73
- package/dist/workflows/dag/backend-test-scenario-partitions.js +135 -2
- package/dist/workflows/dag/backend-test-writer-completeness.js +131 -28
- package/dist/workflows/dag/budget-enforcement.js +10 -0
- package/dist/workflows/dag/context-receipt.js +305 -0
- package/dist/workflows/dag/context-transfer/context-bundle.js +423 -0
- package/dist/workflows/dag/context-transfer/operator-actions.js +61 -0
- package/dist/workflows/dag/context-transfer/renderers.js +93 -0
- package/dist/workflows/dag/contract-output-registry.js +15 -0
- package/dist/workflows/dag/contract-validator-registrations.js +1 -2
- package/dist/workflows/dag/convergence/controller.js +141 -0
- package/dist/workflows/dag/dag-retry-schema.js +138 -0
- package/dist/workflows/dag/dynamic-runtime/loop-until.js +1 -1
- package/dist/workflows/dag/dynamic-runtime/map.js +2 -1
- package/dist/workflows/dag/failure-category.js +7 -116
- package/dist/workflows/dag/frontend-closeout.js +221 -0
- package/dist/workflows/dag/frontend-design-policy.js +400 -0
- package/dist/workflows/dag/frontend-human-decision.js +182 -0
- package/dist/workflows/dag/frontend-implementation-contract.js +1377 -141
- package/dist/workflows/dag/frontend-plan-render.js +26 -1
- package/dist/workflows/dag/frontend-prewrite-gate.js +376 -318
- package/dist/workflows/dag/frontend-provider-capability-matrix.js +159 -0
- package/dist/workflows/dag/frontend-recovery-capsule.js +455 -0
- package/dist/workflows/dag/frontend-recovery-controller.js +226 -0
- package/dist/workflows/dag/frontend-recovery-lineage.js +178 -0
- package/dist/workflows/dag/frontend-recovery-plan.js +21 -10
- package/dist/workflows/dag/frontend-recovery-run.js +166 -34
- package/dist/workflows/dag/frontend-repair.js +7 -424
- package/dist/workflows/dag/frontend-review-context.js +348 -20
- package/dist/workflows/dag/frontend-review-findings.js +270 -0
- package/dist/workflows/dag/frontend-risk.js +15 -2
- package/dist/workflows/dag/frontend-shadow-dual-write.js +941 -0
- package/dist/workflows/dag/frontend-shape-capsule-store.js +191 -0
- package/dist/workflows/dag/frontend-shape-facts.js +419 -0
- package/dist/workflows/dag/frontend-shape.js +435 -0
- package/dist/workflows/dag/frontend-source-fidelity-ledger.js +108 -0
- package/dist/workflows/dag/frontend-split-application-service.js +203 -0
- package/dist/workflows/dag/frontend-split-orchestrator.js +899 -0
- package/dist/workflows/dag/frontend-test-case-checklist.js +53 -5
- package/dist/workflows/dag/frontend-test-case-manifest.js +11 -4
- package/dist/workflows/dag/frontend-test-case-quality.js +11 -16
- package/dist/workflows/dag/frontend-test-environment-probe.js +230 -0
- package/dist/workflows/dag/frontend-test-html-report.js +3 -1
- package/dist/workflows/dag/frontend-test-l5-report.js +3 -1
- package/dist/workflows/dag/frontend-test-layout.js +159 -0
- package/dist/workflows/dag/frontend-test-markdown.js +61 -0
- package/dist/workflows/dag/frontend-test-rerun-candidates.js +103 -0
- package/dist/workflows/dag/frontend-test-result-contract.js +188 -42
- package/dist/workflows/dag/frontend-test-standard-scenarios.js +70 -0
- package/dist/workflows/dag/frontend-typed-event-store.js +452 -0
- package/dist/workflows/dag/frontend-typed-event-transaction.js +180 -0
- package/dist/workflows/dag/frontend-verification-trace.js +281 -29
- package/dist/workflows/dag/frontend-worktree-diff.js +250 -17
- package/dist/workflows/dag/frontend-writer-admission.js +319 -0
- package/dist/workflows/dag/frontend-writer-rollback.js +32 -0
- package/dist/workflows/dag/frontend-writer-status.js +256 -0
- package/dist/workflows/dag/init-hybrid.js +1675 -721
- package/dist/workflows/dag/interrupt-request.js +10 -3
- package/dist/workflows/dag/lifecycle.js +3 -3
- package/dist/workflows/dag/node-execution.js +1141 -32
- package/dist/workflows/dag/path-safety.js +1 -0
- package/dist/workflows/dag/prompt.js +158 -7
- package/dist/workflows/dag/recovery-lease.js +170 -0
- package/dist/workflows/dag/report.js +37 -1
- package/dist/workflows/dag/rerun-feedback.js +526 -0
- package/dist/workflows/dag/rerun-plan.js +790 -28
- package/dist/workflows/dag/rerun-run.js +700 -21
- package/dist/workflows/dag/rerun-task.js +311 -14
- package/dist/workflows/dag/retry-policy.js +336 -101
- package/dist/workflows/dag/runner.js +596 -121
- package/dist/workflows/dag/scheduler.js +133 -20
- package/dist/workflows/dag/skill-snapshot.js +17 -0
- package/dist/workflows/dag/structured-output-repair.js +712 -0
- package/dist/workflows/dag/types.js +585 -31
- package/dist/workflows/dag/validate.js +93 -32
- package/docs/README.md +2 -0
- package/docs/architecture/evolution.md +45 -0
- package/docs/architecture/runtime-boundaries.md +8 -7
- package/docs/architecture/worker-and-feature.md +1 -1
- package/docs/examples/README.md +5 -0
- package/docs/init-surface.manifest.json +36 -12
- package/docs/operations/README.md +1 -1
- package/docs/operations/local-development-environment.md +22 -5
- package/docs/skills/vetted-skill-registry.md +16 -0
- package/docs/templates/README.md +4 -2
- package/docs/templates/agent-dag-report.schema.json +8 -2
- package/docs/templates/agent-dag.schema.json +95 -1
- package/docs/templates/backend-test-dag.json +278 -244
- package/docs/templates/frontend-implementation-contract.schema.json +684 -24
- package/docs/templates/frontend-implementation-dag.json +89 -0
- package/docs/templates/frontend-test-case-checklist.md +2 -2
- package/docs/templates/frontend-test-dag.json +8 -10
- package/docs/templates/frontend-test-dag.retrieve-context.prompt.md +1 -1
- package/docs/templates/init-managed-agents.md +13 -3
- package/docs/templates/product-line/task.yaml +1 -1
- package/docs/templates/spec-registry.schema.json +45 -0
- package/harness.json +2 -2
- package/package.json +19 -5
- package/scripts/next-info.mjs +356 -0
- package/scripts/next-publish-gate.mjs +238 -0
- package/scripts/release-source-binding.mjs +251 -0
- package/skills/analyze-product-requirements/SKILL.md +8 -5
- package/skills/analyze-product-requirements/references/acceptance-criteria.md +1 -1
- package/skills/analyze-product-requirements/references/clarification-and-knowledge.md +10 -6
- package/skills/analyze-product-requirements/references/example.md +50 -0
- package/skills/analyze-product-requirements/references/forward-test-cases.md +11 -7
- package/skills/analyze-product-requirements/references/kb-integration.md +5 -5
- package/skills/analyze-product-requirements/references/product-analysis-schema.md +8 -4
- package/skills/analyze-product-requirements/references/product-requirement-schema.md +2 -2
- package/skills/analyze-product-requirements/references/requirement-clarification-schema.md +1 -1
- package/skills/analyze-product-requirements/scripts/test-validators.mjs +11 -1
- package/skills/analyze-product-requirements/scripts/validate-product-analysis.mjs +20 -1
- package/skills/analyze-product-requirements/scripts/validate-requirement-clarification.mjs +9 -0
- package/skills/codebase-scout/SKILL.md +1 -1
- package/skills/fe-test-ui-scout/SKILL.md +65 -0
- package/skills/fe-test-ui-scout/references/ledger-schema.md +62 -0
- package/skills/fe-test-ui-scout/references/recon-protocol.md +54 -0
- package/skills/frontend-bounded-implement/SKILL.md +15 -14
- package/skills/frontend-bounded-implement/references/code-standards.md +19 -0
- package/skills/frontend-contract/SKILL.md +23 -0
- package/skills/frontend-contract/references/contract-protocol.md +34 -0
- package/skills/frontend-design-review/SKILL.md +22 -41
- package/skills/frontend-plan/SKILL.md +26 -0
- package/skills/frontend-plan/references/decision-contract.md +37 -0
- package/skills/frontend-plan/references/design-decisions.md +17 -0
- package/skills/frontend-review/SKILL.md +20 -15
- package/skills/frontend-review/references/review-findings.md +6 -7
- package/skills/frontend-scout/SKILL.md +25 -0
- package/skills/frontend-scout/references/design-evidence.md +16 -0
- package/skills/frontend-scout/references/scout-evidence.md +23 -0
- package/skills/frontend-verification/SKILL.md +1 -1
- package/skills/improve-codebase-architecture/SKILL.md +81 -0
- package/skills/improve-codebase-architecture/deepening.md +37 -0
- package/skills/improve-codebase-architecture/html-report.md +123 -0
- package/skills/improve-codebase-architecture/interface-design.md +44 -0
- package/skills/improve-codebase-architecture/language.md +53 -0
- package/skills/loop-agent/references/command-reference.md +32 -4
- package/skills/loop-agent/references/hybrid-dag.md +9 -2
- package/skills/playwright-cli/SKILL.md +23 -1
- package/skills/playwright-cli-case-generator/SKILL.md +50 -13
- package/dist/worker/console/operation-store.js +0 -169
- package/dist/worker/console/static/assets/channel-Tl-FkUqr.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-BaehtRk4.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-BaehtRk4.js +0 -1
- package/dist/worker/console/static/assets/index-B7Y-0g3J.css +0 -1
- package/dist/worker/console/static/assets/index-DkCrqaYg.js +0 -325
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-eEhq2A8Y.js +0 -1
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-la8AC7fo.js +0 -8
- package/dist/worker/console/static-src/operator-chat/activity-rail-presentation.js +0 -73
- package/dist/worker/console/static-src/operator-chat/useActivityRailTransition.js +0 -59
- package/skills/frontend-implementation/SKILL.md +0 -52
- package/skills/frontend-implementation/references/code-standards.md +0 -33
- package/skills/frontend-implementation/references/design-spec.md +0 -56
- package/skills/frontend-implementation/references/node-contracts.md +0 -31
- /package/dist/{worker → infrastructure}/console/repo-fingerprint.js +0 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { appendFile, chmod, mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
3
|
+
import { randomBytes } from "node:crypto";
|
|
4
|
+
import { assertSafeAppDataPath, readJsonIfExists, writeSecureJson, } from "../../infrastructure/console/app-data.js";
|
|
5
|
+
const diagnosticWriteChains = new Map();
|
|
6
|
+
function serializeDiagnostic(filePath, operation) {
|
|
7
|
+
const previous = diagnosticWriteChains.get(filePath) ?? Promise.resolve();
|
|
8
|
+
const next = previous.then(operation, operation);
|
|
9
|
+
diagnosticWriteChains.set(filePath, next.then(() => undefined, () => undefined));
|
|
10
|
+
return next;
|
|
11
|
+
}
|
|
12
|
+
function diagnosticsPath(appData) {
|
|
13
|
+
const repoNamespace = path.dirname(appData.operations);
|
|
14
|
+
return assertSafeAppDataPath(repoNamespace, path.join(repoNamespace, "context-transfer-diagnostics.json"));
|
|
15
|
+
}
|
|
16
|
+
function safeNonNegative(value) {
|
|
17
|
+
return Number.isFinite(value) && (value ?? 0) >= 0 ? Math.round(value ?? 0) : 0;
|
|
18
|
+
}
|
|
19
|
+
function safeReasonCode(value) {
|
|
20
|
+
if (!value)
|
|
21
|
+
return undefined;
|
|
22
|
+
const normalized = value.trim().slice(0, 96);
|
|
23
|
+
return /^[A-Za-z0-9_.-]+$/.test(normalized) ? normalized : "UNCLASSIFIED";
|
|
24
|
+
}
|
|
25
|
+
export async function recordContextTransferDiagnostic(input) {
|
|
26
|
+
const filePath = diagnosticsPath(input.appData);
|
|
27
|
+
return serializeDiagnostic(filePath, async () => {
|
|
28
|
+
const current = (await readJsonIfExists(filePath)) ?? {
|
|
29
|
+
schemaVersion: 1,
|
|
30
|
+
updatedAt: (input.now ?? new Date()).toISOString(),
|
|
31
|
+
counters: [],
|
|
32
|
+
};
|
|
33
|
+
const dimensions = {
|
|
34
|
+
outcome: input.dimensions.outcome,
|
|
35
|
+
...(input.dimensions.target ? { target: input.dimensions.target } : {}),
|
|
36
|
+
...(input.dimensions.profile ? { profile: input.dimensions.profile } : {}),
|
|
37
|
+
...(input.dimensions.diffKind ? { diffKind: input.dimensions.diffKind } : {}),
|
|
38
|
+
...(safeReasonCode(input.dimensions.reasonCode)
|
|
39
|
+
? { reasonCode: safeReasonCode(input.dimensions.reasonCode) }
|
|
40
|
+
: {}),
|
|
41
|
+
};
|
|
42
|
+
const key = JSON.stringify({ event: input.event, ...dimensions });
|
|
43
|
+
const existing = current.counters.find((counter) => JSON.stringify({ event: counter.event, ...dimensionsFromCounter(counter) }) === key);
|
|
44
|
+
if (existing) {
|
|
45
|
+
existing.count += 1;
|
|
46
|
+
existing.bytes += safeNonNegative(input.dimensions.bytes);
|
|
47
|
+
existing.durationMs += safeNonNegative(input.dimensions.durationMs);
|
|
48
|
+
existing.affectedNodeCount += safeNonNegative(input.dimensions.affectedNodeCount);
|
|
49
|
+
existing.importedNodeCount += safeNonNegative(input.dimensions.importedNodeCount);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
current.counters.push({
|
|
53
|
+
event: input.event,
|
|
54
|
+
...dimensions,
|
|
55
|
+
count: 1,
|
|
56
|
+
bytes: safeNonNegative(input.dimensions.bytes),
|
|
57
|
+
durationMs: safeNonNegative(input.dimensions.durationMs),
|
|
58
|
+
affectedNodeCount: safeNonNegative(input.dimensions.affectedNodeCount),
|
|
59
|
+
importedNodeCount: safeNonNegative(input.dimensions.importedNodeCount),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
current.updatedAt = (input.now ?? new Date()).toISOString();
|
|
63
|
+
await writeSecureJson(filePath, current);
|
|
64
|
+
return current;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function dimensionsFromCounter(counter) {
|
|
68
|
+
return {
|
|
69
|
+
outcome: counter.outcome,
|
|
70
|
+
...(counter.target ? { target: counter.target } : {}),
|
|
71
|
+
...(counter.profile ? { profile: counter.profile } : {}),
|
|
72
|
+
...(counter.diffKind ? { diffKind: counter.diffKind } : {}),
|
|
73
|
+
...(counter.reasonCode ? { reasonCode: counter.reasonCode } : {}),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export async function readContextTransferDiagnostics(appData) {
|
|
77
|
+
return readJsonIfExists(diagnosticsPath(appData));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Append-only lifecycle event log for context-transfer mutations
|
|
81
|
+
* (exec-plan observability: context_export.* / artifact_revision.* /
|
|
82
|
+
* artifact_rerun.*). Events carry ids, counts, bytes, duration and reason
|
|
83
|
+
* codes only — never prompt text, artifact content, secret finding values or
|
|
84
|
+
* host absolute paths. The Console emits only stages it truly observes;
|
|
85
|
+
* CLI-kernel-internal stages (capture, secret scan, adapters) stay in the
|
|
86
|
+
* kernel's own evidence.
|
|
87
|
+
*/
|
|
88
|
+
export const CONTEXT_TRANSFER_EVENT_LOG_LIMIT = 512;
|
|
89
|
+
const CONTEXT_TRANSFER_EVENT_NAME_PATTERN = /^(?:context_export|artifact_revision|artifact_rerun)\.[a-z][a-z_]{0,47}$/;
|
|
90
|
+
const CONTEXT_TRANSFER_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
|
|
91
|
+
export async function recordContextTransferEvent(input) {
|
|
92
|
+
const at = (input.now ?? new Date()).toISOString();
|
|
93
|
+
if (!CONTEXT_TRANSFER_EVENT_NAME_PATTERN.test(input.event)) {
|
|
94
|
+
return { recorded: false, total: 0 };
|
|
95
|
+
}
|
|
96
|
+
const fields = input.fields ?? {};
|
|
97
|
+
const entry = {
|
|
98
|
+
schemaVersion: 1,
|
|
99
|
+
at,
|
|
100
|
+
event: input.event,
|
|
101
|
+
...sanitizeLifecycleFields(fields),
|
|
102
|
+
};
|
|
103
|
+
const filePath = lifecycleEventsPath(input.appData);
|
|
104
|
+
return serializeDiagnostic(filePath, async () => {
|
|
105
|
+
await appendLifecycleEvent(filePath, entry);
|
|
106
|
+
const total = await countLifecycleEvents(filePath);
|
|
107
|
+
if (total > CONTEXT_TRANSFER_EVENT_LOG_LIMIT) {
|
|
108
|
+
await trimLifecycleEvents(filePath, CONTEXT_TRANSFER_EVENT_LOG_LIMIT);
|
|
109
|
+
return { recorded: true, total: CONTEXT_TRANSFER_EVENT_LOG_LIMIT };
|
|
110
|
+
}
|
|
111
|
+
return { recorded: true, total };
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
export async function readContextTransferEvents(appData) {
|
|
115
|
+
const filePath = lifecycleEventsPath(appData);
|
|
116
|
+
const raw = await readFile(filePath, "utf8").catch(() => "");
|
|
117
|
+
const events = [];
|
|
118
|
+
for (const line of raw.split("\n")) {
|
|
119
|
+
if (!line.trim())
|
|
120
|
+
continue;
|
|
121
|
+
try {
|
|
122
|
+
const parsed = JSON.parse(line);
|
|
123
|
+
if (parsed &&
|
|
124
|
+
typeof parsed === "object" &&
|
|
125
|
+
parsed.schemaVersion === 1 &&
|
|
126
|
+
typeof parsed.event === "string") {
|
|
127
|
+
events.push(parsed);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
// A torn final line after a crash must not break readers.
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return events;
|
|
135
|
+
}
|
|
136
|
+
function lifecycleEventsPath(appData) {
|
|
137
|
+
const repoNamespace = path.dirname(appData.operations);
|
|
138
|
+
return assertSafeAppDataPath(repoNamespace, path.join(repoNamespace, "context-transfer-events.jsonl"));
|
|
139
|
+
}
|
|
140
|
+
function safeLifecycleId(value) {
|
|
141
|
+
if (!value)
|
|
142
|
+
return undefined;
|
|
143
|
+
return CONTEXT_TRANSFER_ID_PATTERN.test(value) ? value : undefined;
|
|
144
|
+
}
|
|
145
|
+
function sanitizeLifecycleFields(fields) {
|
|
146
|
+
return {
|
|
147
|
+
...(safeLifecycleId(fields.runId) ? { runId: fields.runId } : {}),
|
|
148
|
+
...(safeLifecycleId(fields.nodeId) ? { nodeId: fields.nodeId } : {}),
|
|
149
|
+
...(safeLifecycleId(fields.exportId) ? { exportId: fields.exportId } : {}),
|
|
150
|
+
...(safeLifecycleId(fields.revisionId)
|
|
151
|
+
? { revisionId: fields.revisionId }
|
|
152
|
+
: {}),
|
|
153
|
+
...(safeLifecycleId(fields.operationId)
|
|
154
|
+
? { operationId: fields.operationId }
|
|
155
|
+
: {}),
|
|
156
|
+
...(fields.profile === "redacted" || fields.profile === "raw"
|
|
157
|
+
? { profile: fields.profile }
|
|
158
|
+
: {}),
|
|
159
|
+
...(fields.target === "generic" ||
|
|
160
|
+
fields.target === "pi-session" ||
|
|
161
|
+
fields.target === "pi-handoff" ||
|
|
162
|
+
fields.target === "readable"
|
|
163
|
+
? { target: fields.target }
|
|
164
|
+
: {}),
|
|
165
|
+
...(fields.bytes !== undefined
|
|
166
|
+
? { bytes: safeNonNegative(fields.bytes) }
|
|
167
|
+
: {}),
|
|
168
|
+
...(fields.durationMs !== undefined
|
|
169
|
+
? { durationMs: safeNonNegative(fields.durationMs) }
|
|
170
|
+
: {}),
|
|
171
|
+
...(safeReasonCode(fields.reasonCode)
|
|
172
|
+
? { reasonCode: safeReasonCode(fields.reasonCode) }
|
|
173
|
+
: {}),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
async function appendLifecycleEvent(filePath, entry) {
|
|
177
|
+
await mkdir(path.dirname(filePath), { recursive: true, mode: 0o700 });
|
|
178
|
+
await appendFile(filePath, `${JSON.stringify(entry)}\n`, { mode: 0o600 });
|
|
179
|
+
await chmod(filePath, 0o600).catch(() => undefined);
|
|
180
|
+
}
|
|
181
|
+
async function countLifecycleEvents(filePath) {
|
|
182
|
+
const raw = await readFile(filePath, "utf8").catch(() => "");
|
|
183
|
+
let total = 0;
|
|
184
|
+
for (const line of raw.split("\n")) {
|
|
185
|
+
if (line.trim())
|
|
186
|
+
total += 1;
|
|
187
|
+
}
|
|
188
|
+
return total;
|
|
189
|
+
}
|
|
190
|
+
async function trimLifecycleEvents(filePath, limit) {
|
|
191
|
+
const raw = await readFile(filePath, "utf8").catch(() => "");
|
|
192
|
+
const lines = raw.split("\n").filter((line) => line.trim());
|
|
193
|
+
const kept = lines.slice(-limit);
|
|
194
|
+
const tmp = `${filePath}.${randomBytes(8).toString("hex")}.tmp`;
|
|
195
|
+
await writeFile(tmp, `${kept.join("\n")}\n`, { mode: 0o600, flag: "wx" });
|
|
196
|
+
await rename(tmp, filePath);
|
|
197
|
+
await chmod(filePath, 0o600).catch(() => undefined);
|
|
198
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash, randomBytes } from "node:crypto";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { readJsonIfExists, sha256Utf8, writeSecureJson, } from "
|
|
3
|
+
import { readJsonIfExists, sha256Utf8, writeSecureJson, } from "../../infrastructure/console/app-data.js";
|
|
4
4
|
import { confirmationPayloadHash, issueHumanGateToken, verifyHumanGateToken, } from "./human-gate-token.js";
|
|
5
5
|
export const ALL_CONFIRMATION_CHALLENGES = [
|
|
6
6
|
"source",
|
|
@@ -20,7 +20,7 @@ import { randomBytes } from "node:crypto";
|
|
|
20
20
|
import { readFile } from "node:fs/promises";
|
|
21
21
|
import path from "node:path";
|
|
22
22
|
import { pathMatchesPattern } from "../../shared/git-progress.js";
|
|
23
|
-
import { readJsonIfExists, sha256Utf8, writeSecureJson, } from "
|
|
23
|
+
import { readJsonIfExists, sha256Utf8, writeSecureJson, } from "../../infrastructure/console/app-data.js";
|
|
24
24
|
import { hashDagBytes, } from "./dag-confirmation.js";
|
|
25
25
|
/**
|
|
26
26
|
* Structured verification command patterns for the G2 autonomous-execution
|
|
@@ -35,6 +35,32 @@ import { hashDagBytes, } from "./dag-confirmation.js";
|
|
|
35
35
|
* framework invocations that don't embed the word "verify".
|
|
36
36
|
*/
|
|
37
37
|
export const STRUCTURED_VERIFICATION_COMMAND_RE = /\b(vitest|jest|playwright|cypress|pytest|py-test|go\s+test|cargo\s+test|npm\s+run\s+(lint|typecheck|test|verify)|npm\s+(test|run\s+test)|check-repo\.sh|loop-agent-standard-verify)\b/i;
|
|
38
|
+
/**
|
|
39
|
+
* Deterministic shell preset keys whose executors are themselves structured
|
|
40
|
+
* verification/gate materializers: their shell.commands[] is empty and the
|
|
41
|
+
* preset alone carries the verification authority (hash-bound artifact
|
|
42
|
+
* gates, evidence validators, report finalize). Mirrors the named-shell
|
|
43
|
+
* handler registry in shell-executor.ts so preset-only workflows
|
|
44
|
+
* (frontend-test finalize/reports, backend-test pipeline, verify-evidence
|
|
45
|
+
* gates) pass the G2 autonomous execution gate without depending on node-id
|
|
46
|
+
* naming conventions.
|
|
47
|
+
*/
|
|
48
|
+
export const STRUCTURED_VERIFICATION_SHELL_PRESETS = new Set([
|
|
49
|
+
"frontendTestCaseChecklist",
|
|
50
|
+
"frontendTestCaseManifest",
|
|
51
|
+
"frontendTestEvidenceValidation",
|
|
52
|
+
"frontendTestResultFinalize",
|
|
53
|
+
"frontendTestL5Report",
|
|
54
|
+
"frontendTestHtmlReport",
|
|
55
|
+
"frontendTestReports",
|
|
56
|
+
"backendTestPipeline",
|
|
57
|
+
"verifyEvidence",
|
|
58
|
+
"repairArtifactGate",
|
|
59
|
+
"jacocoCoverage",
|
|
60
|
+
"requirementCoverageGate",
|
|
61
|
+
"jsonArtifactGate",
|
|
62
|
+
"verdictGate",
|
|
63
|
+
]);
|
|
38
64
|
export const DEFAULT_EXECUTION_RECEIPT_TTL_MS = 30 * 60 * 1000;
|
|
39
65
|
function normalizePathEntry(entry) {
|
|
40
66
|
return entry.trim().replace(/\\/g, "/").replace(/^\.\//, "");
|
|
@@ -150,13 +176,38 @@ export function deriveEligibilityFactsFromDagSpec(input) {
|
|
|
150
176
|
}));
|
|
151
177
|
const allWriteSetEntries = writers.flatMap((writer) => writer.writeSet);
|
|
152
178
|
const broadWriteSetRisk = allWriteSetEntries.some(isBroadWriteSetEntry);
|
|
153
|
-
const
|
|
154
|
-
|
|
179
|
+
const taskForbidden = input.forbiddenPaths.map(normalizePathEntry);
|
|
180
|
+
const forbiddenOverlapRisk = tasks.some((task) => stringList(task.writeSet).some((entry) => {
|
|
181
|
+
const normalizedEntry = normalizePathEntry(entry);
|
|
182
|
+
return stringList(task.forbiddenPaths).some((forbidden) => {
|
|
183
|
+
const normalizedForbidden = normalizePathEntry(forbidden);
|
|
184
|
+
const isTaskGlobal = taskForbidden.includes(normalizedForbidden);
|
|
185
|
+
if (isTaskGlobal) {
|
|
186
|
+
// Task-level forbidden paths are hard global boundaries. A broad
|
|
187
|
+
// writer that could include one is not autonomously eligible.
|
|
188
|
+
return (pathMatchesPattern(normalizedEntry, normalizedForbidden) ||
|
|
189
|
+
pathMatchesPattern(normalizedForbidden, normalizedEntry));
|
|
190
|
+
}
|
|
191
|
+
// Node-local forbidden paths may intentionally carve a narrower
|
|
192
|
+
// child (for example md/README.md) out of a broader writer
|
|
193
|
+
// writeSet. That exclusion is enforced by the runtime write guard.
|
|
194
|
+
// It is a conflict only when the writer entry itself is wholly
|
|
195
|
+
// inside the forbidden boundary.
|
|
196
|
+
return pathMatchesPattern(normalizedEntry, normalizedForbidden);
|
|
197
|
+
});
|
|
198
|
+
}));
|
|
155
199
|
const hasStructuredVerification = tasks.some((task) => {
|
|
156
200
|
if (task.executor !== "shell" || !task.shell)
|
|
157
201
|
return false;
|
|
158
202
|
if (/verify|verification/i.test(task.id ?? ""))
|
|
159
203
|
return true;
|
|
204
|
+
// Preset-only verification shells (empty commands[]): the preset key is
|
|
205
|
+
// the verification authority (frontend-test finalize, backend-test
|
|
206
|
+
// pipeline, evidence/artifact gates).
|
|
207
|
+
const shellRecord = task.shell;
|
|
208
|
+
const hasVerificationPreset = Object.keys(shellRecord).some((key) => STRUCTURED_VERIFICATION_SHELL_PRESETS.has(key));
|
|
209
|
+
if (hasVerificationPreset)
|
|
210
|
+
return true;
|
|
160
211
|
const commands = stringList(task.shell.commands);
|
|
161
212
|
return commands.some((command) => STRUCTURED_VERIFICATION_COMMAND_RE.test(command));
|
|
162
213
|
});
|
|
@@ -6,7 +6,7 @@ import { LoopAgentClient } from "../loop-agent/loop-agent-client.js";
|
|
|
6
6
|
import { preflightTargetRepo } from "../preflight.js";
|
|
7
7
|
import { probePiReadiness, } from "./pi-readiness.js";
|
|
8
8
|
import { DEFAULT_OBSERVE_BASE_URL, OBSERVE_START_COMMAND, probeAndClassifyObserve, } from "./observe-health-match.js";
|
|
9
|
-
import { repoFingerprintV1 } from "
|
|
9
|
+
import { repoFingerprintV1 } from "../../infrastructure/console/repo-fingerprint.js";
|
|
10
10
|
import { resolveSiblingLoopAgentBin } from "./sibling-controller.js";
|
|
11
11
|
import { defaultObserveStaticDir, ROUTES } from "../observe/routes.js";
|
|
12
12
|
import { deriveObserveRouteCapabilities } from "../observe/health.js";
|
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { readJsonIfExists, sha256Json, writeSecureJson, } from "
|
|
2
|
+
import { readJsonIfExists, sha256Json, writeSecureJson, } from "../../infrastructure/console/app-data.js";
|
|
3
|
+
/**
|
|
4
|
+
* 从任意上游载荷安全投影 ledger 摘要(未知形状丢弃,绝不抛错、绝不信任字段外的数据)。
|
|
5
|
+
* 供 DraftStore / prd-intake-bridge 把 prepare/advance 结果中的 ledger 摘要带入草稿。
|
|
6
|
+
*/
|
|
7
|
+
export function summarizeLedgerPayload(value) {
|
|
8
|
+
if (!value || typeof value !== "object")
|
|
9
|
+
return undefined;
|
|
10
|
+
const record = value;
|
|
11
|
+
if (record.present !== true)
|
|
12
|
+
return undefined;
|
|
13
|
+
const num = (key) => {
|
|
14
|
+
const raw = record[key];
|
|
15
|
+
return typeof raw === "number" && Number.isFinite(raw) ? raw : 0;
|
|
16
|
+
};
|
|
17
|
+
const gateRaw = record.gateStatus;
|
|
18
|
+
const gateStatus = gateRaw === "pass" || gateRaw === "fail" || gateRaw === "unknown"
|
|
19
|
+
? gateRaw
|
|
20
|
+
: "unknown";
|
|
21
|
+
const failureCode = typeof record.failureCode === "string" && record.failureCode
|
|
22
|
+
? record.failureCode
|
|
23
|
+
: null;
|
|
24
|
+
const rawExclusions = Array.isArray(record.exclusions) ? record.exclusions : [];
|
|
25
|
+
const exclusions = [];
|
|
26
|
+
for (const item of rawExclusions) {
|
|
27
|
+
if (!item || typeof item !== "object")
|
|
28
|
+
continue;
|
|
29
|
+
const entry = item;
|
|
30
|
+
const fragmentId = typeof entry.fragmentId === "string" ? entry.fragmentId : "";
|
|
31
|
+
const reason = typeof entry.reason === "string" ? entry.reason : "";
|
|
32
|
+
if (!fragmentId)
|
|
33
|
+
continue;
|
|
34
|
+
exclusions.push({ fragmentId, reason });
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
present: true,
|
|
38
|
+
fragmentCount: num("fragmentCount"),
|
|
39
|
+
canonicalRequirementCount: num("canonicalRequirementCount"),
|
|
40
|
+
contextOnlyCount: num("contextOnlyCount"),
|
|
41
|
+
duplicateCount: num("duplicateCount"),
|
|
42
|
+
unresolvedCount: num("unresolvedCount"),
|
|
43
|
+
conflictCount: num("conflictCount"),
|
|
44
|
+
gateStatus,
|
|
45
|
+
failureCode,
|
|
46
|
+
exclusions,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
3
49
|
function draftPath(appData, taskId) {
|
|
4
50
|
const safe = taskId.replace(/[^a-zA-Z0-9._-]+/g, "_");
|
|
5
51
|
return path.join(appData.drafts, `${safe}.json`);
|
|
@@ -86,6 +132,9 @@ export function toCanonicalDraftForCli(draft) {
|
|
|
86
132
|
if (draft.interviewAssessmentRef) {
|
|
87
133
|
canonical.interviewAssessmentRef = draft.interviewAssessmentRef;
|
|
88
134
|
}
|
|
135
|
+
// AC-BLOCK-002:canonical draft JSON 绝不携带 ledgerSummary 字段(strict
|
|
136
|
+
// taskContractDraftSchema 拒绝未知键)。摘要仅留在 prd-intake-bridge 响应与
|
|
137
|
+
// console-types 的 LedgerSummaryView(UI 视图模型),不进入持久化 draft。
|
|
89
138
|
return canonical;
|
|
90
139
|
}
|
|
91
140
|
export class DraftStore {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { parseFrontendHumanDecisionProjection } from "../../workflows/dag/frontend-human-decision.js";
|
|
2
|
+
/** Worker/Console persistence seam. Canonical validation and freshness remain in the workflow service. */
|
|
3
|
+
export function createFrontendHumanDecisionAdapter(store) {
|
|
4
|
+
return {
|
|
5
|
+
async load(operationId) {
|
|
6
|
+
const record = await store.get(operationId);
|
|
7
|
+
if (!record || record.revision === undefined || !record.frontendHumanDecision)
|
|
8
|
+
return undefined;
|
|
9
|
+
return { revision: record.revision, projection: parseFrontendHumanDecisionProjection(record.frontendHumanDecision) };
|
|
10
|
+
},
|
|
11
|
+
materialize(input) {
|
|
12
|
+
return store.materializeFrontendHumanDecision(input);
|
|
13
|
+
},
|
|
14
|
+
consume(input) {
|
|
15
|
+
return store.consumeFrontendHumanDecision(input);
|
|
16
|
+
},
|
|
17
|
+
initializeSplit: store.initializeFrontendHumanApprovedSplit.bind(store),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FrontendSplitOrchestrator, frontendSplitProjectionSchema, } from "../../workflows/dag/frontend-split-application-service.js";
|
|
2
|
+
/** Worker/Console boundary adapter. All orchestration policy remains canonical. */
|
|
3
|
+
export function createFrontendSplitOperationAdapter(dependencies) {
|
|
4
|
+
const ports = {
|
|
5
|
+
load: async (operationId) => {
|
|
6
|
+
const record = await dependencies.store.get(operationId);
|
|
7
|
+
return record?.frontendSplit === undefined ? undefined : frontendSplitProjectionSchema.parse(record.frontendSplit);
|
|
8
|
+
},
|
|
9
|
+
compareAndSwap: (input) => dependencies.store.compareAndSwapFrontendSplit(input),
|
|
10
|
+
materialize: async (request) => {
|
|
11
|
+
const result = await dependencies.materializer.materialize(request);
|
|
12
|
+
return { taskId: result.taskId, operationId: result.operationId };
|
|
13
|
+
},
|
|
14
|
+
schedule: dependencies.schedule,
|
|
15
|
+
auditStale: dependencies.auditStale,
|
|
16
|
+
loadChildCloseoutFacts: (input) => dependencies.store.loadChildCloseoutFacts(input),
|
|
17
|
+
settleAggregate: (input) => dependencies.store.settleFrontendSplitAggregate({ ...input, prepareAggregate: dependencies.prepareAggregate }),
|
|
18
|
+
};
|
|
19
|
+
return new FrontendSplitOrchestrator(ports);
|
|
20
|
+
}
|
|
@@ -85,7 +85,7 @@ export function verifyHumanGateToken(presented, expected, secret, now = new Date
|
|
|
85
85
|
* invalidates the token (defense against drift-then-confirm).
|
|
86
86
|
*/
|
|
87
87
|
import { createHash } from "node:crypto";
|
|
88
|
-
import { sha256Utf8 } from "
|
|
88
|
+
import { sha256Utf8 } from "../../infrastructure/console/app-data.js";
|
|
89
89
|
export function confirmationPayloadHash(b) {
|
|
90
90
|
const canonical = [
|
|
91
91
|
`dag=${b.dagSha256}`,
|
|
@@ -3,14 +3,17 @@ export { buildOperatorSurfaceHealthV1 } from "./operator-surface-health.js";
|
|
|
3
3
|
export { runConsoleDoctor, formatConsoleDoctorHuman } from "./doctor.js";
|
|
4
4
|
export { isLoopbackHost } from "./loopback.js";
|
|
5
5
|
export { shouldOpenConsoleBrowser, normalizeConsoleBrowserUrl, openSystemBrowser, maybeOpenConsoleBrowser, } from "./open-browser.js";
|
|
6
|
-
export { repoFingerprintV1, normalizeWorktreeRealpath, } from "
|
|
6
|
+
export { repoFingerprintV1, normalizeWorktreeRealpath, } from "../../infrastructure/console/repo-fingerprint.js";
|
|
7
7
|
export { buildObserveDeepLink } from "./observe-link.js";
|
|
8
8
|
export { classifyObserveHealth, probeAndClassifyObserve, capabilityForObserveTarget, OBSERVE_START_COMMAND, DEFAULT_OBSERVE_BASE_URL, } from "./observe-health-match.js";
|
|
9
9
|
export { allowedRecoveryCtas, classifyRecoveryFact, partitionRecoveryCtas, recoveryMatrixInvariants, } from "./recovery-cta.js";
|
|
10
10
|
export { createClosedResourceLoader, createInterviewResourceLoader, tryActivateTool, assertOfficialToolAllowed, listOfficialTools, OFFICIAL_DENIED_TOOL_IDS, INTERVIEW_ALLOWED_TOOLS, INTERVIEW_DENIED_TOOLS, authorizeInterviewTool, } from "./resource-loader.js";
|
|
11
11
|
export { resolveSiblingLoopAgentBin } from "./sibling-controller.js";
|
|
12
|
-
export { openConsoleAppData, defaultConsoleAppDataRoot } from "
|
|
13
|
-
export { OperationStore } from "
|
|
12
|
+
export { openConsoleAppData, defaultConsoleAppDataRoot } from "../../infrastructure/console/app-data.js";
|
|
13
|
+
export { OperationStore } from "../../infrastructure/console/operation-store.js";
|
|
14
|
+
export { createFrontendSplitOperationAdapter } from "./frontend-split-operation-adapter.js";
|
|
15
|
+
export { createFrontendHumanDecisionAdapter } from "./frontend-human-decision-adapter.js";
|
|
16
|
+
export { FrontendSplitTaskMaterializer } from "../materialize/frontend-split-task-materializer.js";
|
|
14
17
|
export { createOperationEventStore } from "./operation-sse.js";
|
|
15
18
|
export { DagConfirmationStore } from "./dag-confirmation.js";
|
|
16
19
|
export { DraftStore } from "./draft-store.js";
|
|
@@ -80,3 +80,21 @@ export function pickInspectNode(nodes, preferredNodeId) {
|
|
|
80
80
|
});
|
|
81
81
|
return running ?? nodes[0];
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Terminal DagRun effective/status values (mirrors observe read-model
|
|
85
|
+
* TERMINAL_RUN_STATUSES). A run that reached one of these states no longer
|
|
86
|
+
* needs live polling in the console split panel.
|
|
87
|
+
*/
|
|
88
|
+
export const TERMINAL_DAG_RUN_STATUSES = new Set([
|
|
89
|
+
"finished",
|
|
90
|
+
"failed",
|
|
91
|
+
"partial_failed",
|
|
92
|
+
"superseded",
|
|
93
|
+
"abandoned",
|
|
94
|
+
]);
|
|
95
|
+
export function isTerminalDagRun(dag) {
|
|
96
|
+
if (!dag)
|
|
97
|
+
return false;
|
|
98
|
+
const status = String(dag.effectiveStatus ?? dag.status ?? "").toLowerCase();
|
|
99
|
+
return TERMINAL_DAG_RUN_STATUSES.has(status);
|
|
100
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { readJsonIfExists, writeSecureJson, } from "
|
|
3
|
+
import { readJsonIfExists, writeSecureJson, } from "../../../infrastructure/console/app-data.js";
|
|
4
4
|
import { computeDraftSha256, } from "../draft-store.js";
|
|
5
5
|
function assessmentPath(appData, assessmentId) {
|
|
6
6
|
return path.join(appData.assessments, `${assessmentId}.json`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { readJsonIfExists, writeSecureJson, } from "
|
|
3
|
+
import { readJsonIfExists, writeSecureJson, } from "../../../infrastructure/console/app-data.js";
|
|
4
4
|
import { createInterviewResourceLoader, } from "./tools.js";
|
|
5
5
|
function sessionPath(appData, sessionId) {
|
|
6
6
|
return path.join(appData.interviews, `${sessionId}.json`);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DSH's native directory-picker adapter.
|
|
3
|
+
*
|
|
4
|
+
* The published DSH host package uses the modern Win32 IFileOpenDialog in a
|
|
5
|
+
* dedicated child process (plus osascript/Zenity/KDialog on other platforms),
|
|
6
|
+
* so the Console does not pay PowerShell startup cost or lose the chooser
|
|
7
|
+
* behind the browser window.
|
|
8
|
+
*/
|
|
9
|
+
import { pickNativeDirectory, } from "@deepseek-ai/dsh-host-directory-picker-native";
|
|
10
|
+
/** Open the host OS single-folder chooser. Cancellation is a null result. */
|
|
11
|
+
export async function pickNativeWorkspaceDirectory(signal, internals = {}) {
|
|
12
|
+
return pickNativeDirectory(signal, internals);
|
|
13
|
+
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* - A run summary is a projection only: it can never change the terminal
|
|
14
14
|
* operation state decided by the command envelope/exit facts.
|
|
15
15
|
*/
|
|
16
|
+
import { normalizeDagFailureCategory } from "../../shared/dag-failure-category.js";
|
|
16
17
|
import { scrubSecrets } from "./chat/explore-tools.js";
|
|
17
18
|
const RUN_SUMMARY_MAX_NODES = 20;
|
|
18
19
|
const RUN_SUMMARY_MAX_TEXT_CHARS = 600;
|
|
@@ -72,7 +73,13 @@ function safeNode(value) {
|
|
|
72
73
|
const status = boundedRedactedText(rec.status, 100);
|
|
73
74
|
if (!id || !status)
|
|
74
75
|
return undefined;
|
|
75
|
-
|
|
76
|
+
const rawCategory = boundedRedactedText(rec.failureCategory, 200);
|
|
77
|
+
if (!rawCategory)
|
|
78
|
+
return { id, status };
|
|
79
|
+
const category = normalizeDagFailureCategory(rawCategory, status);
|
|
80
|
+
if (category === "success" || category === "skipped")
|
|
81
|
+
return { id, status };
|
|
82
|
+
return { id, status, failureCategory: category };
|
|
76
83
|
}
|
|
77
84
|
/** Independent allowlist projection of a structured run summary. */
|
|
78
85
|
export function safeRunSummaryForProjection(value) {
|
|
@@ -117,13 +124,22 @@ export function safeRunSummaryForProjection(value) {
|
|
|
117
124
|
}
|
|
118
125
|
}
|
|
119
126
|
const verdict = boundedRedactedText(rec.verdict);
|
|
120
|
-
const
|
|
127
|
+
const rawFailureCategory = boundedRedactedText(rec.failureCategory, 200);
|
|
128
|
+
// Normalize the run-level category too (2026-08-23): raw codes like
|
|
129
|
+
// missing-api-key / nonzero-exit never matched the browser advice table.
|
|
130
|
+
const failureCategory = rawFailureCategory !== undefined
|
|
131
|
+
? normalizeDagFailureCategory(rawFailureCategory, status)
|
|
132
|
+
: undefined;
|
|
121
133
|
return {
|
|
122
134
|
runId,
|
|
123
135
|
status,
|
|
124
136
|
nodes,
|
|
125
137
|
...(verdict !== undefined ? { verdict } : {}),
|
|
126
|
-
...(failureCategory !== undefined
|
|
138
|
+
...(failureCategory !== undefined &&
|
|
139
|
+
failureCategory !== "success" &&
|
|
140
|
+
failureCategory !== "skipped"
|
|
141
|
+
? { failureCategory }
|
|
142
|
+
: {}),
|
|
127
143
|
...(outOfBounds.length > 0 ? { outOfBounds } : {}),
|
|
128
144
|
...(next ? { next } : {}),
|
|
129
145
|
};
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import { clipPreview, } from "
|
|
1
|
+
import { clipPreview, } from "../../infrastructure/console/operation-store.js";
|
|
2
2
|
import { stateEvent } from "./operation-sse.js";
|
|
3
3
|
import { extractTrustedRunFacts } from "./operation-run-facts.js";
|
|
4
|
+
/** Swallow-all invoker so observers can never break the state path. */
|
|
5
|
+
function notifySettled(deps, operation, state, info) {
|
|
6
|
+
if (!deps.onSettled)
|
|
7
|
+
return;
|
|
8
|
+
void Promise.resolve()
|
|
9
|
+
.then(() => deps.onSettled?.(operation, state, info))
|
|
10
|
+
.catch(() => undefined);
|
|
11
|
+
}
|
|
4
12
|
/**
|
|
5
13
|
* Execute a queued operation via LoopAgentClient (or inject).
|
|
6
14
|
* Timeout without proven exit → needs-reconcile (never Cancel).
|
|
@@ -42,6 +50,7 @@ export async function runOperation(operationId, deps) {
|
|
|
42
50
|
artifactName: `operation-${operationId}`,
|
|
43
51
|
expectJson: true,
|
|
44
52
|
timeoutMs: deps.defaultTimeoutMs,
|
|
53
|
+
env: deps.env,
|
|
45
54
|
onSpawn: (info) => {
|
|
46
55
|
// Chain onto the per-operation write lock; never fire-and-forget a
|
|
47
56
|
// rejected update (unhandled rejection can crash Console on Windows).
|
|
@@ -119,6 +128,10 @@ export async function runOperation(operationId, deps) {
|
|
|
119
128
|
message: finished.errorMessage,
|
|
120
129
|
state: "needs-reconcile",
|
|
121
130
|
});
|
|
131
|
+
notifySettled(deps, finished, "needs-reconcile", {
|
|
132
|
+
ok: false,
|
|
133
|
+
errorCode: finished.errorCode,
|
|
134
|
+
});
|
|
122
135
|
}
|
|
123
136
|
return finished;
|
|
124
137
|
}
|
|
@@ -169,9 +182,10 @@ async function finalizeFromWorkerResult(operationId, result, deps) {
|
|
|
169
182
|
// Supervisory timeout without classified CLI timeout → needs-reconcile
|
|
170
183
|
// Only mark timed-out when we have a machine timeout result after exit.
|
|
171
184
|
const state = result.exitCode !== null ? "timed-out" : "needs-reconcile";
|
|
172
|
-
const
|
|
185
|
+
const finishedAt = new Date().toISOString();
|
|
186
|
+
const patch = {
|
|
173
187
|
state,
|
|
174
|
-
finishedAt
|
|
188
|
+
finishedAt,
|
|
175
189
|
artifactRefs,
|
|
176
190
|
stdoutPreview: previewStdout,
|
|
177
191
|
stderrPreview: previewStderr,
|
|
@@ -186,7 +200,15 @@ async function finalizeFromWorkerResult(operationId, result, deps) {
|
|
|
186
200
|
...(runFacts.runSummary ? { runSummary: runFacts.runSummary } : {}),
|
|
187
201
|
}
|
|
188
202
|
: {}),
|
|
203
|
+
};
|
|
204
|
+
const current = await deps.store.get(operationId);
|
|
205
|
+
if (!current)
|
|
206
|
+
throw new Error(`operation not found: ${operationId}`);
|
|
207
|
+
await deps.beforeTerminal?.({ ...current, ...patch }, state, {
|
|
208
|
+
ok: false,
|
|
209
|
+
errorCode: patch.errorCode,
|
|
189
210
|
});
|
|
211
|
+
const updated = await deps.store.update(operationId, patch);
|
|
190
212
|
stateEvent(deps.events, updated, state, updated.errorMessage);
|
|
191
213
|
if (runFacts) {
|
|
192
214
|
appendSafeResultEvent(deps, operationId, state, {
|
|
@@ -202,6 +224,10 @@ async function finalizeFromWorkerResult(operationId, result, deps) {
|
|
|
202
224
|
data: { ok: false, exitCode: result.exitCode },
|
|
203
225
|
});
|
|
204
226
|
}
|
|
227
|
+
notifySettled(deps, updated, state, {
|
|
228
|
+
ok: false,
|
|
229
|
+
errorCode: updated.errorCode,
|
|
230
|
+
});
|
|
205
231
|
return updated;
|
|
206
232
|
}
|
|
207
233
|
const envelope = coerceEnvelope(result);
|
|
@@ -210,7 +236,7 @@ async function finalizeFromWorkerResult(operationId, result, deps) {
|
|
|
210
236
|
const processOk = envelope?.ok === true || (result.ok && result.exitCode === 0);
|
|
211
237
|
const ok = processOk && !businessBlock;
|
|
212
238
|
const state = ok ? "succeeded" : "failed";
|
|
213
|
-
const
|
|
239
|
+
const patch = {
|
|
214
240
|
state,
|
|
215
241
|
finishedAt: new Date().toISOString(),
|
|
216
242
|
artifactRefs,
|
|
@@ -238,9 +264,20 @@ async function finalizeFromWorkerResult(operationId, result, deps) {
|
|
|
238
264
|
...(runFacts.runSummary ? { runSummary: runFacts.runSummary } : {}),
|
|
239
265
|
}
|
|
240
266
|
: {}),
|
|
267
|
+
};
|
|
268
|
+
if (!operation)
|
|
269
|
+
throw new Error(`operation not found: ${operationId}`);
|
|
270
|
+
await deps.beforeTerminal?.({ ...operation, ...patch }, state, {
|
|
271
|
+
ok,
|
|
272
|
+
errorCode: patch.errorCode,
|
|
241
273
|
});
|
|
274
|
+
const updated = await deps.store.update(operationId, patch);
|
|
242
275
|
stateEvent(deps.events, updated, state, updated.errorMessage);
|
|
243
276
|
appendSafeResultEvent(deps, operationId, state, { ok, exitCode: result.exitCode }, runFacts);
|
|
277
|
+
notifySettled(deps, updated, state, {
|
|
278
|
+
ok,
|
|
279
|
+
errorCode: updated.errorCode,
|
|
280
|
+
});
|
|
244
281
|
if (ok && operation?.action === "dagRequestInterrupt") {
|
|
245
282
|
await projectInterruptRequestOntoTarget(operation, result.json, deps);
|
|
246
283
|
}
|
|
@@ -300,6 +337,10 @@ export function scheduleOperation(operationId, deps) {
|
|
|
300
337
|
})
|
|
301
338
|
.then((updated) => {
|
|
302
339
|
stateEvent(deps.events, updated, "needs-reconcile", message);
|
|
340
|
+
notifySettled(deps, updated, "needs-reconcile", {
|
|
341
|
+
ok: false,
|
|
342
|
+
errorCode: updated.errorCode,
|
|
343
|
+
});
|
|
303
344
|
})
|
|
304
345
|
.catch(() => {
|
|
305
346
|
// A failed canonical store update cannot be represented safely.
|