@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,423 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { CONTEXT_BUNDLE_LIMITS, computeBundleManifestSha256, contextBundleManifestV1Schema, effectiveNodeContextV1Schema, } from "../../../shared/context-transfer.js";
|
|
6
|
+
import { redactSecretsWithFindings, redactSensitivePathsWithFindings, } from "../../../shared/preview.js";
|
|
7
|
+
import { evaluatePiSessionCapability, renderPiSessionJsonl, } from "../../../adapters/context-transfer/pi-session.js";
|
|
8
|
+
import { renderGenericHandoff, renderReadableTranscript, } from "./renderers.js";
|
|
9
|
+
import { computeCanonicalHash } from "../../../task/contract/hash.js";
|
|
10
|
+
import { readFileBoundarySafe } from "../path-safety.js";
|
|
11
|
+
function sha256(value) {
|
|
12
|
+
return createHash("sha256").update(value).digest("hex");
|
|
13
|
+
}
|
|
14
|
+
function canonicalJson(value) {
|
|
15
|
+
return `${JSON.stringify(value, null, 2)}\n`;
|
|
16
|
+
}
|
|
17
|
+
const sha256Hex = z.string().regex(/^[a-f0-9]{64}$/);
|
|
18
|
+
/** Strict shape of the materialized managed-task-contract component. */
|
|
19
|
+
const taskContractMaterialSchema = z
|
|
20
|
+
.object({
|
|
21
|
+
schemaVersion: z.literal(1),
|
|
22
|
+
taskId: z.string().min(1),
|
|
23
|
+
revision: z.number().int().nonnegative(),
|
|
24
|
+
projectionVersion: z.literal(1),
|
|
25
|
+
canonicalizerVersion: z.literal(1),
|
|
26
|
+
taskConfigSchemaVersion: z.literal(1),
|
|
27
|
+
sourceHashes: z
|
|
28
|
+
.object({
|
|
29
|
+
requirementSha256: sha256Hex,
|
|
30
|
+
constraintsSha256: sha256Hex,
|
|
31
|
+
referenceManifestSha256: sha256Hex.optional(),
|
|
32
|
+
requirementLedgerSha256: sha256Hex.optional(),
|
|
33
|
+
})
|
|
34
|
+
.strict(),
|
|
35
|
+
taskConfigSha256: sha256Hex,
|
|
36
|
+
canonicalHash: sha256Hex,
|
|
37
|
+
})
|
|
38
|
+
.strict();
|
|
39
|
+
/**
|
|
40
|
+
* Read a run-owned material with full path safety and TOCTOU protection:
|
|
41
|
+
* reject symlinked or hardlinked intermediates/final entry and non-regular
|
|
42
|
+
* files (device/FIFO), open with O_NOFOLLOW and read via the fd so a swapped
|
|
43
|
+
* path can never redirect the bundle to content outside the run. Hash/size
|
|
44
|
+
* verification still runs on the returned bytes.
|
|
45
|
+
*/
|
|
46
|
+
async function readBundleMaterial(runDir, relativePath) {
|
|
47
|
+
try {
|
|
48
|
+
return await readFileBoundarySafe({
|
|
49
|
+
boundaryRoot: path.resolve(runDir),
|
|
50
|
+
targetPath: path.resolve(runDir, ...relativePath.split("/")),
|
|
51
|
+
label: `context bundle material ${relativePath}`,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
throw new Error(`CONTEXT_COMPONENT_UNAVAILABLE: ${error instanceof Error ? error.message : String(error)}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function isTextualMedia(mediaType) {
|
|
59
|
+
const normalized = mediaType.split(";", 1)[0].trim().toLowerCase();
|
|
60
|
+
return (normalized.startsWith("text/") ||
|
|
61
|
+
normalized.includes("json") ||
|
|
62
|
+
normalized.includes("xml") ||
|
|
63
|
+
normalized.includes("yaml") ||
|
|
64
|
+
normalized.includes("javascript"));
|
|
65
|
+
}
|
|
66
|
+
function applyBundleSecurityPass(files, profile) {
|
|
67
|
+
let detectedFindingCount = 0;
|
|
68
|
+
let redactedFindingCount = 0;
|
|
69
|
+
let credentialFindingCount = 0;
|
|
70
|
+
let sensitivePathFindingCount = 0;
|
|
71
|
+
const securedFiles = files.map((file) => {
|
|
72
|
+
if (file.redaction === "omitted" || !isTextualMedia(file.mediaType)) {
|
|
73
|
+
return file;
|
|
74
|
+
}
|
|
75
|
+
const sourceText = file.bytes.toString("utf8");
|
|
76
|
+
const credentialScan = redactSecretsWithFindings(sourceText);
|
|
77
|
+
const pathScan = redactSensitivePathsWithFindings(sourceText);
|
|
78
|
+
const fileFindingCount = credentialScan.findingCount + pathScan.findingCount;
|
|
79
|
+
credentialFindingCount += credentialScan.findingCount;
|
|
80
|
+
sensitivePathFindingCount += pathScan.findingCount;
|
|
81
|
+
detectedFindingCount += fileFindingCount;
|
|
82
|
+
if (profile === "raw" || fileFindingCount === 0)
|
|
83
|
+
return file;
|
|
84
|
+
redactedFindingCount += fileFindingCount;
|
|
85
|
+
const redacted = redactSensitivePathsWithFindings(credentialScan.redacted).redacted;
|
|
86
|
+
return {
|
|
87
|
+
...file,
|
|
88
|
+
bytes: Buffer.from(redacted, "utf8"),
|
|
89
|
+
redaction: "redacted",
|
|
90
|
+
sourceSha256: sha256(file.bytes),
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
files: securedFiles,
|
|
95
|
+
detectedFindingCount,
|
|
96
|
+
redactedFindingCount,
|
|
97
|
+
credentialFindingCount,
|
|
98
|
+
sensitivePathFindingCount,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export async function buildContextBundle(input) {
|
|
102
|
+
const profile = input.profile ?? "redacted";
|
|
103
|
+
const target = input.target ?? "generic";
|
|
104
|
+
if (profile === "raw" && !input.rawAcknowledgement) {
|
|
105
|
+
throw new Error("RAW_EXPORT_ACKNOWLEDGEMENT_REQUIRED");
|
|
106
|
+
}
|
|
107
|
+
const receiptPath = path.join(input.runDir, input.nodeId, "context-receipts", `attempt-${input.attempt}.json`);
|
|
108
|
+
let receiptBytes;
|
|
109
|
+
try {
|
|
110
|
+
receiptBytes = await readFileBoundarySafe({
|
|
111
|
+
boundaryRoot: path.resolve(input.runDir),
|
|
112
|
+
targetPath: receiptPath,
|
|
113
|
+
label: "context receipt",
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
118
|
+
if (/missing|ENOENT|no such/i.test(message)) {
|
|
119
|
+
throw new Error("CONTEXT_RECEIPT_MISSING");
|
|
120
|
+
}
|
|
121
|
+
throw new Error(`CONTEXT_COMPONENT_UNAVAILABLE: ${message}`);
|
|
122
|
+
}
|
|
123
|
+
const receipt = effectiveNodeContextV1Schema.parse(JSON.parse(receiptBytes.toString("utf8")));
|
|
124
|
+
if (receipt.identity.runId !== input.runId ||
|
|
125
|
+
receipt.identity.nodeId !== input.nodeId ||
|
|
126
|
+
receipt.identity.attempt !== input.attempt) {
|
|
127
|
+
throw new Error("CONTEXT_COMPONENT_UNAVAILABLE: receipt ownership mismatch");
|
|
128
|
+
}
|
|
129
|
+
let files = [];
|
|
130
|
+
for (const component of receipt.orderedComponents) {
|
|
131
|
+
if (!component.materializedPath || component.inclusion === "omitted")
|
|
132
|
+
continue;
|
|
133
|
+
const source = await readBundleMaterial(input.runDir, component.materializedPath);
|
|
134
|
+
if (source.byteLength !== component.bytes ||
|
|
135
|
+
sha256(source) !== component.sha256) {
|
|
136
|
+
throw new Error("CONTEXT_COMPONENT_UNAVAILABLE: material hash mismatch");
|
|
137
|
+
}
|
|
138
|
+
if (component.kind === "task-contract") {
|
|
139
|
+
// Independently verify the materialized canonical hash: strictly parse
|
|
140
|
+
// the canonical-hash material (versions, sha256s, sourceHashes), then
|
|
141
|
+
// recompute computeCanonicalHash and require it to match both the
|
|
142
|
+
// material's claim and the receipt's authoritative hash. Without strict
|
|
143
|
+
// parsing, malformed materials (e.g. non-object sourceHashes) could be
|
|
144
|
+
// accepted as long as they carry a self-consistent hash.
|
|
145
|
+
let parsed;
|
|
146
|
+
try {
|
|
147
|
+
parsed = taskContractMaterialSchema.safeParse(JSON.parse(source.toString("utf8")));
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
throw new Error("CONTEXT_COMPONENT_UNAVAILABLE: task contract material is not valid JSON");
|
|
151
|
+
}
|
|
152
|
+
if (!parsed.success) {
|
|
153
|
+
throw new Error(`CONTEXT_COMPONENT_UNAVAILABLE: task contract material failed strict validation: ${parsed.error.issues
|
|
154
|
+
.map((issue) => issue.path.join("."))
|
|
155
|
+
.join(", ")}`);
|
|
156
|
+
}
|
|
157
|
+
const material = parsed.data;
|
|
158
|
+
const recomputed = computeCanonicalHash({
|
|
159
|
+
sourceHashes: material.sourceHashes,
|
|
160
|
+
taskConfigSha256: material.taskConfigSha256,
|
|
161
|
+
projectionVersion: material.projectionVersion,
|
|
162
|
+
canonicalizerVersion: material.canonicalizerVersion,
|
|
163
|
+
taskConfigSchemaVersion: material.taskConfigSchemaVersion,
|
|
164
|
+
});
|
|
165
|
+
if (recomputed !== material.canonicalHash ||
|
|
166
|
+
material.canonicalHash !== component.authoritativeSource?.sha256) {
|
|
167
|
+
throw new Error("CONTEXT_COMPONENT_UNAVAILABLE: task contract canonical hash mismatch");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const bundlePath = component.kind === "system-prompt"
|
|
171
|
+
? "context/system-prompt.md"
|
|
172
|
+
: component.kind === "user-prompt"
|
|
173
|
+
? "context/user-message.md"
|
|
174
|
+
: `context/components/${String(component.index).padStart(4, "0")}.bin`;
|
|
175
|
+
files.push({
|
|
176
|
+
path: bundlePath,
|
|
177
|
+
bytes: source,
|
|
178
|
+
mediaType: component.mediaType,
|
|
179
|
+
origin: component.source.identity,
|
|
180
|
+
redaction: "none",
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
files.push({
|
|
184
|
+
path: "context/receipt.json",
|
|
185
|
+
bytes: receiptBytes,
|
|
186
|
+
mediaType: "application/json",
|
|
187
|
+
origin: `${input.nodeId}/context-receipts/attempt-${input.attempt}.json`,
|
|
188
|
+
redaction: "none",
|
|
189
|
+
});
|
|
190
|
+
let sessionEventLines = [];
|
|
191
|
+
if (target === "readable") {
|
|
192
|
+
try {
|
|
193
|
+
sessionEventLines = (await readBundleMaterial(input.runDir, `${input.nodeId}/session-events.jsonl`)).toString("utf8").split(/\r?\n/).filter(Boolean);
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
// Only a genuinely absent event stream (missing file) is treated as "no
|
|
197
|
+
// events" for historical/non-Pi nodes. Any safety rejection (symlink /
|
|
198
|
+
// hardlink / non-regular material) must fail closed: an attacker must not
|
|
199
|
+
// be able to mask a tampered stream as "node had no events".
|
|
200
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
201
|
+
if (!/missing|no such|ENOENT|not found/i.test(message)) {
|
|
202
|
+
throw error;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const handoff = renderGenericHandoff({
|
|
207
|
+
runId: input.runId,
|
|
208
|
+
nodeId: input.nodeId,
|
|
209
|
+
attempt: input.attempt,
|
|
210
|
+
receipt,
|
|
211
|
+
profile,
|
|
212
|
+
});
|
|
213
|
+
files.push({
|
|
214
|
+
path: target === "readable" ? "transcript.md" : "handoff.md",
|
|
215
|
+
bytes: Buffer.from(target === "readable"
|
|
216
|
+
? renderReadableTranscript({ receipt, eventLines: sessionEventLines })
|
|
217
|
+
: handoff, "utf8"),
|
|
218
|
+
mediaType: "text/markdown; charset=utf-8",
|
|
219
|
+
origin: target === "readable"
|
|
220
|
+
? "loop-agent/readable-transcript-v1"
|
|
221
|
+
: "loop-agent/generic-handoff-v1",
|
|
222
|
+
redaction: "none",
|
|
223
|
+
});
|
|
224
|
+
const piCapability = target === "pi-session"
|
|
225
|
+
? evaluatePiSessionCapability(receipt)
|
|
226
|
+
: undefined;
|
|
227
|
+
if (target === "pi-session" && piCapability?.compatible) {
|
|
228
|
+
files.push({
|
|
229
|
+
path: "pi/session.jsonl",
|
|
230
|
+
bytes: Buffer.from(renderPiSessionJsonl({
|
|
231
|
+
receipt,
|
|
232
|
+
runId: input.runId,
|
|
233
|
+
nodeId: input.nodeId,
|
|
234
|
+
attempt: input.attempt,
|
|
235
|
+
}), "utf8"),
|
|
236
|
+
mediaType: "application/x-ndjson",
|
|
237
|
+
origin: "loop-agent/pi-session-adapter-v1",
|
|
238
|
+
redaction: "none",
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
const securityPass = applyBundleSecurityPass(files, profile);
|
|
242
|
+
files = securityPass.files;
|
|
243
|
+
files.sort((a, b) => a.path.localeCompare(b.path));
|
|
244
|
+
const totalBytes = files.reduce((total, file) => total + file.bytes.byteLength, 0);
|
|
245
|
+
if (files.length > CONTEXT_BUNDLE_LIMITS.fileCount ||
|
|
246
|
+
totalBytes > CONTEXT_BUNDLE_LIMITS.totalUncompressedBytes ||
|
|
247
|
+
files.some((file) => file.bytes.byteLength > CONTEXT_BUNDLE_LIMITS.singleFileBytes)) {
|
|
248
|
+
throw new Error("CONTEXT_BUNDLE_TOO_LARGE");
|
|
249
|
+
}
|
|
250
|
+
const runSpecBytes = await readBundleMaterial(input.runDir, "run.json");
|
|
251
|
+
const bundleSeed = {
|
|
252
|
+
runId: input.runId,
|
|
253
|
+
nodeId: input.nodeId,
|
|
254
|
+
attempt: input.attempt,
|
|
255
|
+
profile,
|
|
256
|
+
target,
|
|
257
|
+
contextDigest: receipt.contextDigest,
|
|
258
|
+
};
|
|
259
|
+
const manifestWithoutHash = {
|
|
260
|
+
schemaVersion: 1,
|
|
261
|
+
bundleId: `ctx-${sha256(JSON.stringify(bundleSeed)).slice(0, 24)}`,
|
|
262
|
+
createdAt: receipt.identity.capturedAt,
|
|
263
|
+
source: {
|
|
264
|
+
repoIdentity: sha256(path.resolve(input.runDir)).slice(0, 24),
|
|
265
|
+
runId: input.runId,
|
|
266
|
+
nodeId: input.nodeId,
|
|
267
|
+
attempt: input.attempt,
|
|
268
|
+
},
|
|
269
|
+
profile,
|
|
270
|
+
target,
|
|
271
|
+
reproducibility: {
|
|
272
|
+
level: target === "readable"
|
|
273
|
+
? "readable-transcript"
|
|
274
|
+
: piCapability?.reproducibility ?? "semantic-handoff",
|
|
275
|
+
reasons: [
|
|
276
|
+
"dispatch messages and runtime capability facts captured before model call",
|
|
277
|
+
...(piCapability?.reasonCodes ?? []),
|
|
278
|
+
],
|
|
279
|
+
limitations: [
|
|
280
|
+
"model output and external tool state are not deterministic",
|
|
281
|
+
...(piCapability?.limitations ?? []),
|
|
282
|
+
],
|
|
283
|
+
},
|
|
284
|
+
bindings: {
|
|
285
|
+
frozenRunSpecSha256: sha256(runSpecBytes),
|
|
286
|
+
contextReceiptSha256: sha256(receiptBytes),
|
|
287
|
+
contextDigest: receipt.contextDigest,
|
|
288
|
+
},
|
|
289
|
+
runtime: {
|
|
290
|
+
executor: receipt.runtime.executor,
|
|
291
|
+
...(receipt.runtime.resolvedModel
|
|
292
|
+
? { model: receipt.runtime.resolvedModel }
|
|
293
|
+
: {}),
|
|
294
|
+
skills: receipt.runtime.skills.map((id) => ({ id })),
|
|
295
|
+
extensions: receipt.runtime.extensions.map((id) => ({
|
|
296
|
+
id,
|
|
297
|
+
status: "resolved",
|
|
298
|
+
})),
|
|
299
|
+
tools: receipt.runtime.activeTools.map((name) => ({
|
|
300
|
+
name,
|
|
301
|
+
available: true,
|
|
302
|
+
})),
|
|
303
|
+
},
|
|
304
|
+
files: files.map((file) => ({
|
|
305
|
+
path: file.path,
|
|
306
|
+
sha256: sha256(file.bytes),
|
|
307
|
+
bytes: file.bytes.byteLength,
|
|
308
|
+
mediaType: file.mediaType,
|
|
309
|
+
origin: file.origin,
|
|
310
|
+
redaction: file.redaction,
|
|
311
|
+
...(file.sourceSha256 ? { sourceSha256: file.sourceSha256 } : {}),
|
|
312
|
+
})),
|
|
313
|
+
omissions: [],
|
|
314
|
+
security: {
|
|
315
|
+
secretScan: securityPass.detectedFindingCount > 0 ? "warning" : "pass",
|
|
316
|
+
findingCounts: {
|
|
317
|
+
detected: securityPass.detectedFindingCount,
|
|
318
|
+
credentials: securityPass.credentialFindingCount,
|
|
319
|
+
sensitivePaths: securityPass.sensitivePathFindingCount,
|
|
320
|
+
...(profile === "redacted"
|
|
321
|
+
? { redacted: securityPass.redactedFindingCount }
|
|
322
|
+
: {}),
|
|
323
|
+
},
|
|
324
|
+
...(input.rawAcknowledgement
|
|
325
|
+
? { rawAcknowledgement: input.rawAcknowledgement }
|
|
326
|
+
: {}),
|
|
327
|
+
},
|
|
328
|
+
};
|
|
329
|
+
const manifest = contextBundleManifestV1Schema.parse({
|
|
330
|
+
...manifestWithoutHash,
|
|
331
|
+
bundleSha256: computeBundleManifestSha256(manifestWithoutHash),
|
|
332
|
+
});
|
|
333
|
+
const archiveFiles = [
|
|
334
|
+
...files,
|
|
335
|
+
{
|
|
336
|
+
path: "manifest.json",
|
|
337
|
+
bytes: Buffer.from(canonicalJson(manifest), "utf8"),
|
|
338
|
+
mediaType: "application/json",
|
|
339
|
+
origin: "loop-agent/context-bundle-manifest-v1",
|
|
340
|
+
redaction: "none",
|
|
341
|
+
},
|
|
342
|
+
].sort((a, b) => a.path.localeCompare(b.path));
|
|
343
|
+
return { manifest, files, zipBytes: deterministicZip(archiveFiles) };
|
|
344
|
+
}
|
|
345
|
+
export async function writeContextBundleDirectory(bundle, outputDir) {
|
|
346
|
+
await mkdir(outputDir, { recursive: true });
|
|
347
|
+
for (const file of bundle.files) {
|
|
348
|
+
const target = path.resolve(outputDir, ...file.path.split("/"));
|
|
349
|
+
if (!target.startsWith(`${path.resolve(outputDir)}${path.sep}`)) {
|
|
350
|
+
throw new Error("unsafe bundle output path");
|
|
351
|
+
}
|
|
352
|
+
await mkdir(path.dirname(target), { recursive: true });
|
|
353
|
+
await writeFile(target, file.bytes, { flag: "wx" });
|
|
354
|
+
}
|
|
355
|
+
await writeFile(path.join(outputDir, "manifest.json"), canonicalJson(bundle.manifest), { flag: "wx" });
|
|
356
|
+
}
|
|
357
|
+
const CRC_TABLE = Array.from({ length: 256 }, (_, index) => {
|
|
358
|
+
let value = index;
|
|
359
|
+
for (let bit = 0; bit < 8; bit += 1) {
|
|
360
|
+
value = (value & 1) !== 0 ? 0xedb88320 ^ (value >>> 1) : value >>> 1;
|
|
361
|
+
}
|
|
362
|
+
return value >>> 0;
|
|
363
|
+
});
|
|
364
|
+
function crc32(bytes) {
|
|
365
|
+
let crc = 0xffffffff;
|
|
366
|
+
for (const byte of bytes)
|
|
367
|
+
crc = CRC_TABLE[(crc ^ byte) & 0xff] ^ (crc >>> 8);
|
|
368
|
+
return (crc ^ 0xffffffff) >>> 0;
|
|
369
|
+
}
|
|
370
|
+
function deterministicZip(files) {
|
|
371
|
+
const localParts = [];
|
|
372
|
+
const centralParts = [];
|
|
373
|
+
let offset = 0;
|
|
374
|
+
for (const file of files) {
|
|
375
|
+
const name = Buffer.from(file.path, "utf8");
|
|
376
|
+
const data = file.bytes;
|
|
377
|
+
const crc = crc32(data);
|
|
378
|
+
const local = Buffer.alloc(30);
|
|
379
|
+
local.writeUInt32LE(0x04034b50, 0);
|
|
380
|
+
local.writeUInt16LE(20, 4);
|
|
381
|
+
local.writeUInt16LE(0x0800, 6);
|
|
382
|
+
local.writeUInt16LE(0, 8);
|
|
383
|
+
local.writeUInt16LE(0, 10);
|
|
384
|
+
local.writeUInt16LE(33, 12);
|
|
385
|
+
local.writeUInt32LE(crc, 14);
|
|
386
|
+
local.writeUInt32LE(data.byteLength, 18);
|
|
387
|
+
local.writeUInt32LE(data.byteLength, 22);
|
|
388
|
+
local.writeUInt16LE(name.byteLength, 26);
|
|
389
|
+
local.writeUInt16LE(0, 28);
|
|
390
|
+
localParts.push(local, name, data);
|
|
391
|
+
const central = Buffer.alloc(46);
|
|
392
|
+
central.writeUInt32LE(0x02014b50, 0);
|
|
393
|
+
central.writeUInt16LE(20, 4);
|
|
394
|
+
central.writeUInt16LE(20, 6);
|
|
395
|
+
central.writeUInt16LE(0x0800, 8);
|
|
396
|
+
central.writeUInt16LE(0, 10);
|
|
397
|
+
central.writeUInt16LE(0, 12);
|
|
398
|
+
central.writeUInt16LE(33, 14);
|
|
399
|
+
central.writeUInt32LE(crc, 16);
|
|
400
|
+
central.writeUInt32LE(data.byteLength, 20);
|
|
401
|
+
central.writeUInt32LE(data.byteLength, 24);
|
|
402
|
+
central.writeUInt16LE(name.byteLength, 28);
|
|
403
|
+
central.writeUInt16LE(0, 30);
|
|
404
|
+
central.writeUInt16LE(0, 32);
|
|
405
|
+
central.writeUInt16LE(0, 34);
|
|
406
|
+
central.writeUInt16LE(0, 36);
|
|
407
|
+
central.writeUInt32LE(0, 38);
|
|
408
|
+
central.writeUInt32LE(offset, 42);
|
|
409
|
+
centralParts.push(central, name);
|
|
410
|
+
offset += local.byteLength + name.byteLength + data.byteLength;
|
|
411
|
+
}
|
|
412
|
+
const centralBytes = Buffer.concat(centralParts);
|
|
413
|
+
const end = Buffer.alloc(22);
|
|
414
|
+
end.writeUInt32LE(0x06054b50, 0);
|
|
415
|
+
end.writeUInt16LE(0, 4);
|
|
416
|
+
end.writeUInt16LE(0, 6);
|
|
417
|
+
end.writeUInt16LE(files.length, 8);
|
|
418
|
+
end.writeUInt16LE(files.length, 10);
|
|
419
|
+
end.writeUInt32LE(centralBytes.byteLength, 12);
|
|
420
|
+
end.writeUInt32LE(offset, 16);
|
|
421
|
+
end.writeUInt16LE(0, 20);
|
|
422
|
+
return Buffer.concat([...localParts, centralBytes, end]);
|
|
423
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { buildArtifactBindingGraph } from "../artifact-bindings.js";
|
|
3
|
+
import { readFileBoundarySafe } from "../path-safety.js";
|
|
4
|
+
import { locateDagRun, readDagRunSpec, readDagRunState, } from "../lifecycle.js";
|
|
5
|
+
import { executeDagArtifactOverrideRerun, planDagArtifactOverride, } from "../rerun-run.js";
|
|
6
|
+
import { buildContextBundle, } from "./context-bundle.js";
|
|
7
|
+
export async function buildDagRunContextBundle(input) {
|
|
8
|
+
const located = await locateDagRun(input.cwd, input.runId);
|
|
9
|
+
if (!located)
|
|
10
|
+
throw new Error(`dag run not found: ${input.runId}`);
|
|
11
|
+
return buildContextBundle({
|
|
12
|
+
runDir: located.runDir,
|
|
13
|
+
runId: input.runId,
|
|
14
|
+
nodeId: input.nodeId,
|
|
15
|
+
attempt: input.attempt,
|
|
16
|
+
profile: input.profile,
|
|
17
|
+
target: input.target,
|
|
18
|
+
...(input.rawAcknowledgement
|
|
19
|
+
? { rawAcknowledgement: input.rawAcknowledgement }
|
|
20
|
+
: {}),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export async function readRevisionParentArtifact(input) {
|
|
24
|
+
const located = await locateDagRun(input.cwd, input.runId);
|
|
25
|
+
if (!located || located.lifecycle !== "completed") {
|
|
26
|
+
throw new Error("artifact revision requires a completed parent run");
|
|
27
|
+
}
|
|
28
|
+
const spec = await readDagRunSpec(located.runDir);
|
|
29
|
+
const state = await readDagRunState(located.runDir);
|
|
30
|
+
const declaration = buildArtifactBindingGraph(spec).artifacts.find((entry) => entry.artifactId === input.artifactId &&
|
|
31
|
+
entry.producerNodeId === input.producerNodeId);
|
|
32
|
+
if (!declaration)
|
|
33
|
+
throw new Error("ARTIFACT_BINDING_UNAVAILABLE");
|
|
34
|
+
const fact = state.nodes[input.producerNodeId]?.declaredArtifacts?.find((entry) => entry.artifactId === input.artifactId);
|
|
35
|
+
if (fact?.status !== "materialized" || !fact.sha256 || !fact.revisionEligible) {
|
|
36
|
+
throw new Error("ARTIFACT_NOT_REVISION_ELIGIBLE");
|
|
37
|
+
}
|
|
38
|
+
const parentPath = path.resolve(located.runDir, ...declaration.path.split("/"));
|
|
39
|
+
const resolvedRunDir = path.resolve(located.runDir);
|
|
40
|
+
if (!parentPath.startsWith(`${resolvedRunDir}${path.sep}`)) {
|
|
41
|
+
throw new Error("ARTIFACT_REVISION_PATH_INVALID");
|
|
42
|
+
}
|
|
43
|
+
// Final regular single-link check (rejects symlink/hardlink/device/FIFO)
|
|
44
|
+
// on top of the per-segment boundary walk, with a TOCTOU-safe fd read.
|
|
45
|
+
const parentBytes = await readFileBoundarySafe({
|
|
46
|
+
boundaryRoot: resolvedRunDir,
|
|
47
|
+
targetPath: parentPath,
|
|
48
|
+
label: `artifact parent ${input.artifactId}`,
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
declaration,
|
|
52
|
+
parentSha256: fact.sha256,
|
|
53
|
+
parentBytes,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export async function planArtifactRevisionContinuation(input) {
|
|
57
|
+
return planDagArtifactOverride(input);
|
|
58
|
+
}
|
|
59
|
+
export async function executeArtifactRevisionContinuation(input) {
|
|
60
|
+
return executeDagArtifactOverrideRerun(input);
|
|
61
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
function textFromContent(content) {
|
|
2
|
+
if (typeof content === "string")
|
|
3
|
+
return content;
|
|
4
|
+
if (!Array.isArray(content))
|
|
5
|
+
return "";
|
|
6
|
+
return content
|
|
7
|
+
.map((part) => {
|
|
8
|
+
if (!part || typeof part !== "object")
|
|
9
|
+
return "";
|
|
10
|
+
const record = part;
|
|
11
|
+
if (record.type === "text" && typeof record.text === "string") {
|
|
12
|
+
return record.text;
|
|
13
|
+
}
|
|
14
|
+
if (record.type === "thinking" && typeof record.thinking === "string") {
|
|
15
|
+
return `[thinking captured]\n${record.thinking}`;
|
|
16
|
+
}
|
|
17
|
+
return "";
|
|
18
|
+
})
|
|
19
|
+
.filter(Boolean)
|
|
20
|
+
.join("\n");
|
|
21
|
+
}
|
|
22
|
+
export function renderGenericHandoff(input) {
|
|
23
|
+
const componentTable = input.receipt.orderedComponents.map((component) => `| ${component.index} | ${component.kind} | ${component.logicalName} | ${component.inclusion} | ${component.sha256} |`);
|
|
24
|
+
return [
|
|
25
|
+
"# Agent handoff",
|
|
26
|
+
"",
|
|
27
|
+
`- run: ${input.runId}`,
|
|
28
|
+
`- node: ${input.nodeId}`,
|
|
29
|
+
`- attempt: ${input.attempt}`,
|
|
30
|
+
`- context digest: ${input.receipt.contextDigest}`,
|
|
31
|
+
`- profile: ${input.profile}`,
|
|
32
|
+
"",
|
|
33
|
+
"## Resume instructions",
|
|
34
|
+
"",
|
|
35
|
+
"Use `context/system-prompt.md` as system/developer context and `context/user-message.md` as the user message. Read other materialized components in receipt order. Verify every payload hash against `manifest.json` before importing. The bundle restores captured inputs, not deterministic model output, credentials, or external tool state.",
|
|
36
|
+
"",
|
|
37
|
+
"## Ordered context index",
|
|
38
|
+
"",
|
|
39
|
+
"| # | kind | name | inclusion | source sha256 |",
|
|
40
|
+
"|---:|---|---|---|---|",
|
|
41
|
+
...componentTable,
|
|
42
|
+
"",
|
|
43
|
+
].join("\n");
|
|
44
|
+
}
|
|
45
|
+
export function renderReadableTranscript(input) {
|
|
46
|
+
const output = [
|
|
47
|
+
"# Node transcript",
|
|
48
|
+
"",
|
|
49
|
+
`Context digest: ${input.receipt.contextDigest}`,
|
|
50
|
+
"",
|
|
51
|
+
"The exact dispatched system and user messages are stored in `context/`. Missing thinking or tool events are not reconstructed.",
|
|
52
|
+
"",
|
|
53
|
+
];
|
|
54
|
+
let turn = 0;
|
|
55
|
+
const seenMessages = new Set();
|
|
56
|
+
for (const line of input.eventLines) {
|
|
57
|
+
let event;
|
|
58
|
+
try {
|
|
59
|
+
event = JSON.parse(line);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (event.type === "turn_start") {
|
|
65
|
+
turn += 1;
|
|
66
|
+
output.push(`## Turn ${turn}`, "");
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (event.type === "tool_execution_start") {
|
|
70
|
+
output.push(`### Tool call: ${String(event.toolName ?? "unknown")}`, "", "```json", JSON.stringify(event.args ?? null, null, 2), "```", "");
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (event.type === "tool_execution_end") {
|
|
74
|
+
output.push(`### Tool result: ${String(event.toolName ?? "unknown")}${event.isError === true ? " (error)" : ""}`, "", textFromContent(event.result?.content) || "[result not captured as text]", "");
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (event.type !== "message_end" || !event.message || typeof event.message !== "object") {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
const message = event.message;
|
|
81
|
+
const fingerprint = JSON.stringify(message);
|
|
82
|
+
if (seenMessages.has(fingerprint))
|
|
83
|
+
continue;
|
|
84
|
+
seenMessages.add(fingerprint);
|
|
85
|
+
const role = typeof message.role === "string" ? message.role : "unknown";
|
|
86
|
+
const body = textFromContent(message.content);
|
|
87
|
+
output.push(`### ${role}`, "", body || "[message content not captured]", "");
|
|
88
|
+
}
|
|
89
|
+
if (turn === 0 && seenMessages.size === 0) {
|
|
90
|
+
output.push("No session events were captured for this attempt.", "");
|
|
91
|
+
}
|
|
92
|
+
return output.join("\n");
|
|
93
|
+
}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { structuredContractOutputSchemaIds, } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Registry of node-level structured contract validators, keyed by the
|
|
4
|
+
* `structuredContractOutput.schemaId` declared on a DAG task.
|
|
5
|
+
*
|
|
6
|
+
* The executor looks the validator up here instead of hardcoding per-contract
|
|
7
|
+
* imports, so new contracts (backend-test manifests, coverage contracts, ...)
|
|
8
|
+
* can opt into producing-node self-validation without touching the executor.
|
|
9
|
+
*/
|
|
10
|
+
export const structuredContractValidationClassifications = [
|
|
11
|
+
"format",
|
|
12
|
+
"schema",
|
|
13
|
+
"truncated",
|
|
14
|
+
"semantic-repair",
|
|
15
|
+
"governance-blocked",
|
|
16
|
+
];
|
|
2
17
|
const validators = new Map();
|
|
3
18
|
export function registerStructuredContractValidator(schemaId, validator) {
|
|
4
19
|
if (validators.has(schemaId)) {
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* its schemaId in the contract output registry. Imported once by the node
|
|
4
4
|
* executor; keeps per-contract imports out of the executor.
|
|
5
5
|
*/
|
|
6
|
-
import { validateFrontendContractNodeOutput, validateFrontendPlanPatchNodeOutput,
|
|
6
|
+
import { validateFrontendContractNodeOutput, validateFrontendPlanPatchNodeOutput, } from "./frontend-implementation-contract.js";
|
|
7
7
|
import { registerStructuredContractValidator } from "./contract-output-registry.js";
|
|
8
8
|
registerStructuredContractValidator("frontend-implementation-contract-v1", validateFrontendContractNodeOutput);
|
|
9
9
|
registerStructuredContractValidator("frontend-implementation-contract-plan-patch-v1", validateFrontendPlanPatchNodeOutput);
|
|
10
|
-
registerStructuredContractValidator("frontend-implementation-contract-revision-patch-v1", validateFrontendRevisionPatchNodeOutput);
|