@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
|
@@ -3,6 +3,7 @@ import { humanGateCardFromEventPayload, mergeHumanGateCardState, } from "../../c
|
|
|
3
3
|
import { mergeOperationCardState, operationFromEventPayload, } from "../../chat/operation-card.js";
|
|
4
4
|
import { requestId } from "./format.js";
|
|
5
5
|
import { parseAssistantContent } from "../../chat/assistant-content.js";
|
|
6
|
+
import { sortChatTimelineMessages, upsertCompactionMessage, } from "./compaction-message.js";
|
|
6
7
|
/** Shared handler for a single parsed Chat SSE event (M1 reconnect).
|
|
7
8
|
*
|
|
8
9
|
* Used by BOTH the inline prompt POST SSE and the background reconnect
|
|
@@ -10,7 +11,9 @@ import { parseAssistantContent } from "../../chat/assistant-content.js";
|
|
|
10
11
|
* original request would have. `assistantId` is the in-flight assistant
|
|
11
12
|
* message id to patch for streaming text; reconnect creates one if none. */
|
|
12
13
|
export function createChatSseEventApplier(deps) {
|
|
13
|
-
const { refs, onReconcile, setError, setInterview, setHumanGateCards, setArtifactCards, setStreaming, setStreamingAssistantId, setUnread, setOperationCards, setUsage, setMessages, setToolCalls, } = deps;
|
|
14
|
+
const { refs, onReconcile, setError, setInterview, setHumanGateCards, setArtifactCards, setStreaming, setTurnPhase = () => undefined, setDeferredTurn = () => undefined, setDeferredTurns = () => undefined, setStreamingAssistantId, setUnread, setOperationCards, setUsage, onTelemetryRefresh, setMessages, setToolCalls, setPendingQuestion = () => undefined, setTodos = () => undefined, setGoal = () => undefined, } = deps;
|
|
15
|
+
let queueOwner;
|
|
16
|
+
let queueRevision = -1;
|
|
14
17
|
return (eventName, data, assistantId, options) => {
|
|
15
18
|
if (options?.generation !== undefined &&
|
|
16
19
|
refs.sessionGenerationRef.current !== options.generation)
|
|
@@ -42,6 +45,47 @@ export function createChatSseEventApplier(deps) {
|
|
|
42
45
|
const payload = data.data && typeof data.data === "object"
|
|
43
46
|
? data.data
|
|
44
47
|
: data;
|
|
48
|
+
if (eventName === "todo_updated" || eventName === "todo_cleared") {
|
|
49
|
+
const todos = Array.isArray(payload.todos) ? payload.todos : [];
|
|
50
|
+
setTodos(todos.filter((item) => Boolean(item) && typeof item === "object" && typeof item.content === "string" && (item.status === "pending" || item.status === "in_progress" || item.status === "completed")));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (eventName === "goal_changed" || eventName === "goal_cleared") {
|
|
54
|
+
if (eventName === "goal_cleared") {
|
|
55
|
+
setGoal(null);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const candidate = payload.goal;
|
|
59
|
+
if (candidate && typeof candidate === "object") {
|
|
60
|
+
const goal = candidate;
|
|
61
|
+
if (typeof goal.goalId === "string" &&
|
|
62
|
+
typeof goal.objective === "string" &&
|
|
63
|
+
typeof goal.revision === "number") {
|
|
64
|
+
// SSE snapshots are durable only. A live change event means this
|
|
65
|
+
// browser process still owns activation unless the phase stopped it.
|
|
66
|
+
setGoal((current) => ({
|
|
67
|
+
...goal,
|
|
68
|
+
armed: goal.phase === "active" ? (current?.armed ?? true) : false,
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if ((eventName === "question_requested" ||
|
|
75
|
+
eventName === "question_resolved" ||
|
|
76
|
+
eventName === "question_cancelled") &&
|
|
77
|
+
payload.question &&
|
|
78
|
+
typeof payload.question === "object") {
|
|
79
|
+
const question = payload.question;
|
|
80
|
+
if (typeof question.requestId === "string" &&
|
|
81
|
+
typeof question.sessionId === "string" &&
|
|
82
|
+
question.sessionId === refs.sessionRef.current?.sessionId) {
|
|
83
|
+
setPendingQuestion(eventName === "question_requested" && question.status === "pending"
|
|
84
|
+
? question
|
|
85
|
+
: null);
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
45
89
|
const turnId = typeof data.turnId === "string" ? data.turnId : undefined;
|
|
46
90
|
const eventSeq = typeof data.seq === "number" && Number.isFinite(data.seq)
|
|
47
91
|
? data.seq
|
|
@@ -49,6 +93,109 @@ export function createChatSseEventApplier(deps) {
|
|
|
49
93
|
const eventAt = typeof data.at === "string" && Number.isFinite(Date.parse(data.at))
|
|
50
94
|
? Date.parse(data.at)
|
|
51
95
|
: Date.now();
|
|
96
|
+
if (eventName === "queue_update") {
|
|
97
|
+
const revision = typeof payload.revision === "number" ? payload.revision : -1;
|
|
98
|
+
const owner = refs.sessionRef.current?.sessionId;
|
|
99
|
+
if (owner !== queueOwner) {
|
|
100
|
+
queueOwner = owner;
|
|
101
|
+
queueRevision = -1;
|
|
102
|
+
}
|
|
103
|
+
if (revision < queueRevision)
|
|
104
|
+
return;
|
|
105
|
+
queueRevision = revision;
|
|
106
|
+
setDeferredTurn(payload.deferredTurn && typeof payload.deferredTurn === "object"
|
|
107
|
+
? payload.deferredTurn
|
|
108
|
+
: null);
|
|
109
|
+
if (Array.isArray(payload.deferredTurns)) {
|
|
110
|
+
setDeferredTurns(payload.deferredTurns);
|
|
111
|
+
}
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (eventName === "user_message") {
|
|
115
|
+
const acceptedClientRequestId = typeof payload.clientRequestId === "string"
|
|
116
|
+
? payload.clientRequestId
|
|
117
|
+
: undefined;
|
|
118
|
+
const message = payload.message && typeof payload.message === "object"
|
|
119
|
+
? payload.message
|
|
120
|
+
: null;
|
|
121
|
+
if (message &&
|
|
122
|
+
typeof message.id === "string" &&
|
|
123
|
+
typeof message.text === "string") {
|
|
124
|
+
if (payload.steering === true && turnId) {
|
|
125
|
+
if (acceptedClientRequestId) {
|
|
126
|
+
setDeferredTurn((current) => current?.clientRequestId === acceptedClientRequestId ? null : current);
|
|
127
|
+
setDeferredTurns((current) => current.filter((item) => item.clientRequestId !== acceptedClientRequestId));
|
|
128
|
+
}
|
|
129
|
+
const previousAssistantId = refs.turnAssistantIdsRef.current.get(turnId);
|
|
130
|
+
if (previousAssistantId) {
|
|
131
|
+
refs.sealedAssistantIdsRef.current.add(previousAssistantId);
|
|
132
|
+
const continuationId = `assistant-after-user-${message.id}`;
|
|
133
|
+
refs.turnAssistantIdsRef.current.set(turnId, continuationId);
|
|
134
|
+
setStreamingAssistantId(continuationId);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const createdAt = typeof message.at === "string" && Number.isFinite(Date.parse(message.at))
|
|
138
|
+
? Date.parse(message.at)
|
|
139
|
+
: Date.now();
|
|
140
|
+
setMessages((messages) => {
|
|
141
|
+
const existing = messages.some((item) => item.id === message.id);
|
|
142
|
+
const next = existing
|
|
143
|
+
? messages.map((item) => item.id === message.id
|
|
144
|
+
? {
|
|
145
|
+
...item,
|
|
146
|
+
...(eventSeq === undefined ? {} : { eventSeq }),
|
|
147
|
+
...(turnId ? { turnId } : {}),
|
|
148
|
+
}
|
|
149
|
+
: item)
|
|
150
|
+
: [
|
|
151
|
+
...messages,
|
|
152
|
+
{
|
|
153
|
+
id: message.id,
|
|
154
|
+
role: "user",
|
|
155
|
+
text: message.text,
|
|
156
|
+
createdAt,
|
|
157
|
+
...(eventSeq === undefined ? {} : { eventSeq }),
|
|
158
|
+
...(turnId ? { turnId } : {}),
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
return sortChatTimelineMessages(next);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (eventName === "compact" ||
|
|
167
|
+
eventName === "compaction_start" ||
|
|
168
|
+
eventName === "compaction_end") {
|
|
169
|
+
const recoveredOverflow = eventName === "compaction_end" &&
|
|
170
|
+
payload.status === "completed" &&
|
|
171
|
+
payload.reason === "overflow" &&
|
|
172
|
+
payload.willRetry === true;
|
|
173
|
+
setMessages((messages) => {
|
|
174
|
+
return upsertCompactionMessage(messages, {
|
|
175
|
+
eventId: typeof data.eventId === "string" ? data.eventId : undefined,
|
|
176
|
+
kind: eventName,
|
|
177
|
+
at: new Date(eventAt).toISOString(),
|
|
178
|
+
seq: eventSeq,
|
|
179
|
+
turnId,
|
|
180
|
+
data: payload,
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
if (recoveredOverflow &&
|
|
184
|
+
turnId &&
|
|
185
|
+
(!replay || refs.activeTurnIdRef.current === turnId)) {
|
|
186
|
+
const compactionId = typeof payload.compactionId === "string" && payload.compactionId
|
|
187
|
+
? payload.compactionId
|
|
188
|
+
: typeof data.eventId === "string"
|
|
189
|
+
? data.eventId
|
|
190
|
+
: `${turnId}-${eventSeq ?? eventAt}`;
|
|
191
|
+
const previousId = refs.turnAssistantIdsRef.current.get(turnId) ?? assistantId;
|
|
192
|
+
const continuationId = `assistant-after-compact-${compactionId}`;
|
|
193
|
+
refs.sealedAssistantIdsRef.current.add(previousId);
|
|
194
|
+
refs.turnAssistantIdsRef.current.set(turnId, continuationId);
|
|
195
|
+
setStreamingAssistantId(continuationId);
|
|
196
|
+
}
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
52
199
|
if (turnId &&
|
|
53
200
|
(eventName === "agent_start" || eventName === "message_update") &&
|
|
54
201
|
refs.settledTurnIdsRef.current.has(turnId)) {
|
|
@@ -151,8 +298,19 @@ export function createChatSseEventApplier(deps) {
|
|
|
151
298
|
refs.settledTurnIdsRef.current.delete(turnId);
|
|
152
299
|
refs.activeTurnIdRef.current = turnId;
|
|
153
300
|
}
|
|
301
|
+
if (refs.stopRequestedRef.current &&
|
|
302
|
+
(!turnId ||
|
|
303
|
+
turnId === refs.stoppingTurnIdRef.current ||
|
|
304
|
+
turnId === refs.activeTurnIdRef.current)) {
|
|
305
|
+
refs.streamingRef.current = false;
|
|
306
|
+
setStreaming(false);
|
|
307
|
+
setTurnPhase("idle");
|
|
308
|
+
setStreamingAssistantId(null);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
154
311
|
refs.streamingRef.current = true;
|
|
155
312
|
setStreaming(true);
|
|
313
|
+
setTurnPhase("running");
|
|
156
314
|
setStreamingAssistantId(resolvedAssistantId);
|
|
157
315
|
return;
|
|
158
316
|
}
|
|
@@ -164,10 +322,24 @@ export function createChatSseEventApplier(deps) {
|
|
|
164
322
|
// (M4.4). It must not prematurely close the visible turn.
|
|
165
323
|
if (eventName === "agent_end")
|
|
166
324
|
return;
|
|
325
|
+
const pending = refs.pendingSubmissionRef.current;
|
|
326
|
+
if (pending && turnId && pending.acceptedTurnId === turnId) {
|
|
327
|
+
refs.releasedClientRequestIdsRef.current.add(pending.clientRequestId);
|
|
328
|
+
refs.pendingSubmissionRef.current = null;
|
|
329
|
+
refs.submitInFlightRef.current = false;
|
|
330
|
+
}
|
|
331
|
+
if (!turnId ||
|
|
332
|
+
turnId === refs.stoppingTurnIdRef.current ||
|
|
333
|
+
turnId === refs.activeTurnIdRef.current) {
|
|
334
|
+
refs.stoppingTurnIdRef.current = null;
|
|
335
|
+
refs.stopRequestedRef.current = false;
|
|
336
|
+
}
|
|
167
337
|
if (turnId === refs.activeTurnIdRef.current)
|
|
168
338
|
refs.activeTurnIdRef.current = null;
|
|
169
339
|
refs.streamingRef.current = false;
|
|
340
|
+
refs.assistantIdRef.current = null;
|
|
170
341
|
setStreaming(false);
|
|
342
|
+
setTurnPhase("idle");
|
|
171
343
|
setStreamingAssistantId(null);
|
|
172
344
|
if (eventName === "agent_settled" &&
|
|
173
345
|
!replay &&
|
|
@@ -199,10 +371,21 @@ export function createChatSseEventApplier(deps) {
|
|
|
199
371
|
return true;
|
|
200
372
|
return assistantOwnsTools;
|
|
201
373
|
}));
|
|
374
|
+
if (!replay)
|
|
375
|
+
onTelemetryRefresh?.();
|
|
202
376
|
return;
|
|
203
377
|
}
|
|
204
378
|
if (eventName === "operation-ref" || eventName === "operation-status") {
|
|
205
379
|
const operation = operationFromEventPayload(payload);
|
|
380
|
+
// R9: tombstones are session-scoped. The same operation may be linked
|
|
381
|
+
// to another session, but delayed frames cannot resurrect it here.
|
|
382
|
+
const currentSessionId = refs.sessionRef.current?.sessionId;
|
|
383
|
+
if (operation &&
|
|
384
|
+
currentSessionId &&
|
|
385
|
+
refs.unlinkedOperationIdsRef.current
|
|
386
|
+
.get(currentSessionId)
|
|
387
|
+
?.has(operation.operationId))
|
|
388
|
+
return;
|
|
206
389
|
if (operation) {
|
|
207
390
|
const toolCallId = typeof payload.toolCallId === "string"
|
|
208
391
|
? payload.toolCallId
|
|
@@ -219,6 +402,23 @@ export function createChatSseEventApplier(deps) {
|
|
|
219
402
|
}
|
|
220
403
|
return;
|
|
221
404
|
}
|
|
405
|
+
if (eventName === "operation-unlinked") {
|
|
406
|
+
// R8 AC-001/AC-R8-001: durable tombstone — the server persisted an
|
|
407
|
+
// operation-unlinked event that OVERSHADOWS any earlier operation-ref.
|
|
408
|
+
// Drop the card from the projection; replay/recovery can never
|
|
409
|
+
// resurrect it because the tombstone is appended after the ref in
|
|
410
|
+
// the same ring.
|
|
411
|
+
const operationId = typeof payload.operationId === "string" ? payload.operationId : "";
|
|
412
|
+
const currentSessionId = refs.sessionRef.current?.sessionId;
|
|
413
|
+
if (operationId && currentSessionId) {
|
|
414
|
+
const sessionTombstones = refs.unlinkedOperationIdsRef.current.get(currentSessionId) ??
|
|
415
|
+
new Set();
|
|
416
|
+
sessionTombstones.add(operationId);
|
|
417
|
+
refs.unlinkedOperationIdsRef.current.set(currentSessionId, sessionTombstones);
|
|
418
|
+
setOperationCards((current) => current.filter((card) => card.operationId !== operationId));
|
|
419
|
+
}
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
222
422
|
if (eventName === "usage") {
|
|
223
423
|
if (replay)
|
|
224
424
|
return;
|
|
@@ -276,14 +476,9 @@ export function createChatSseEventApplier(deps) {
|
|
|
276
476
|
const nextId = requestId("a");
|
|
277
477
|
if (turnId)
|
|
278
478
|
refs.turnAssistantIdsRef.current.set(turnId, nextId);
|
|
279
|
-
//
|
|
280
|
-
//
|
|
281
|
-
//
|
|
282
|
-
// turn end as orphans (phantom trailing tool cards).
|
|
283
|
-
const sealedAssistantId = resolvedAssistantId;
|
|
284
|
-
setToolCalls((prev) => prev.map((t) => t.assistantMessageId === sealedAssistantId
|
|
285
|
-
? { ...t, assistantMessageId: nextId }
|
|
286
|
-
: t));
|
|
479
|
+
// Existing tools remain attached to the assistant stage that emitted
|
|
480
|
+
// them. Moving them to this continuation changes user-visible order;
|
|
481
|
+
// turn-process uses eventSeq to interleave both stable nodes instead.
|
|
287
482
|
resolvedAssistantId = nextId;
|
|
288
483
|
setStreamingAssistantId(nextId);
|
|
289
484
|
}
|
|
@@ -293,28 +488,39 @@ export function createChatSseEventApplier(deps) {
|
|
|
293
488
|
setMessages((m) => {
|
|
294
489
|
const exists = m.some((msg) => msg.id === assistantIdForEvent);
|
|
295
490
|
if (exists) {
|
|
296
|
-
return m.map((msg) => {
|
|
491
|
+
return sortChatTimelineMessages(m.map((msg) => {
|
|
297
492
|
if (msg.id !== assistantIdForEvent)
|
|
298
493
|
return msg;
|
|
299
494
|
return {
|
|
300
495
|
...msg,
|
|
301
496
|
text,
|
|
497
|
+
eventSeq: msg.eventSeq === undefined
|
|
498
|
+
? eventSeq
|
|
499
|
+
: eventSeq === undefined
|
|
500
|
+
? msg.eventSeq
|
|
501
|
+
: Math.min(msg.eventSeq, eventSeq),
|
|
502
|
+
updatedSeq: eventSeq ?? msg.updatedSeq,
|
|
503
|
+
...(turnId ? { turnId } : {}),
|
|
302
504
|
...(content ? { content } : {}),
|
|
303
505
|
};
|
|
304
|
-
});
|
|
506
|
+
}));
|
|
305
507
|
}
|
|
306
508
|
// Reconnect path: the assistant message may not exist yet
|
|
307
509
|
// (e.g. only tool_call events arrived). Append a placeholder.
|
|
308
|
-
return [
|
|
510
|
+
return sortChatTimelineMessages([
|
|
309
511
|
...m,
|
|
310
512
|
{
|
|
311
513
|
id: assistantIdForEvent,
|
|
312
514
|
role: "assistant",
|
|
313
515
|
text,
|
|
314
516
|
createdAt: eventAt,
|
|
517
|
+
...(eventSeq === undefined
|
|
518
|
+
? {}
|
|
519
|
+
: { eventSeq, updatedSeq: eventSeq }),
|
|
520
|
+
...(turnId ? { turnId } : {}),
|
|
315
521
|
...(content ? { content } : {}),
|
|
316
522
|
},
|
|
317
|
-
];
|
|
523
|
+
]);
|
|
318
524
|
});
|
|
319
525
|
if (eventName === "message_end")
|
|
320
526
|
sealedIds.add(assistantIdForEvent);
|
|
@@ -414,6 +620,51 @@ export function createChatSseEventApplier(deps) {
|
|
|
414
620
|
});
|
|
415
621
|
}
|
|
416
622
|
else if (eventName === "error") {
|
|
623
|
+
const candidate = payload.providerError && typeof payload.providerError === "object"
|
|
624
|
+
? payload.providerError
|
|
625
|
+
: undefined;
|
|
626
|
+
if (candidate &&
|
|
627
|
+
typeof candidate.message === "string" &&
|
|
628
|
+
typeof candidate.raw === "string" &&
|
|
629
|
+
(candidate.category === "authentication" ||
|
|
630
|
+
candidate.category === "context-overflow" ||
|
|
631
|
+
candidate.category === "rate-limit" ||
|
|
632
|
+
candidate.category === "provider")) {
|
|
633
|
+
// Session hydration already restores the durable card; retained replay
|
|
634
|
+
// must not add a second synthetic row on top of it.
|
|
635
|
+
if (replay)
|
|
636
|
+
return;
|
|
637
|
+
const providerError = candidate;
|
|
638
|
+
const errorContent = parseAssistantContent(payload.content);
|
|
639
|
+
const id = turnId && eventSeq !== undefined
|
|
640
|
+
? `provider-error-${turnId}-${eventSeq}`
|
|
641
|
+
: requestId("provider-error");
|
|
642
|
+
setMessages((messages) => {
|
|
643
|
+
if (messages.some((message) => message.id === id))
|
|
644
|
+
return messages;
|
|
645
|
+
const activeAlreadyOwnsContent = messages.some((message) => message.id === resolvedAssistantId &&
|
|
646
|
+
Boolean(message.content?.length));
|
|
647
|
+
return sortChatTimelineMessages([
|
|
648
|
+
...messages,
|
|
649
|
+
{
|
|
650
|
+
id,
|
|
651
|
+
role: "assistant",
|
|
652
|
+
kind: "provider-error",
|
|
653
|
+
text: providerError.message,
|
|
654
|
+
createdAt: eventAt,
|
|
655
|
+
...(eventSeq === undefined
|
|
656
|
+
? {}
|
|
657
|
+
: { eventSeq, updatedSeq: eventSeq }),
|
|
658
|
+
...(turnId ? { turnId } : {}),
|
|
659
|
+
providerError,
|
|
660
|
+
...(!activeAlreadyOwnsContent && errorContent
|
|
661
|
+
? { content: errorContent }
|
|
662
|
+
: {}),
|
|
663
|
+
},
|
|
664
|
+
]);
|
|
665
|
+
});
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
417
668
|
setError(typeof payload.message === "string" ? payload.message : "chat error");
|
|
418
669
|
}
|
|
419
670
|
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
function finiteToken(value) {
|
|
2
|
+
return typeof value === "number" && Number.isFinite(value)
|
|
3
|
+
? Math.max(0, Math.floor(value))
|
|
4
|
+
: undefined;
|
|
5
|
+
}
|
|
6
|
+
/** Project legacy final snapshots and lifecycle events to one stable row. */
|
|
7
|
+
export function compactionMessageFromEvent(item) {
|
|
8
|
+
const data = item.data && typeof item.data === "object"
|
|
9
|
+
? item.data
|
|
10
|
+
: {};
|
|
11
|
+
const eventId = typeof item.eventId === "string" ? item.eventId : undefined;
|
|
12
|
+
const compactionId = typeof data.compactionId === "string" && data.compactionId
|
|
13
|
+
? data.compactionId
|
|
14
|
+
: eventId;
|
|
15
|
+
if (!compactionId)
|
|
16
|
+
return undefined;
|
|
17
|
+
const status = data.status === "running" ||
|
|
18
|
+
data.status === "completed" ||
|
|
19
|
+
data.status === "failed" ||
|
|
20
|
+
data.status === "aborted"
|
|
21
|
+
? data.status
|
|
22
|
+
: "completed";
|
|
23
|
+
const reason = data.reason === "manual" ||
|
|
24
|
+
data.reason === "threshold" ||
|
|
25
|
+
data.reason === "overflow"
|
|
26
|
+
? data.reason
|
|
27
|
+
: "manual";
|
|
28
|
+
const summary = typeof data.summary === "string" ? data.summary : "";
|
|
29
|
+
const errorMessage = typeof data.errorMessage === "string" ? data.errorMessage : undefined;
|
|
30
|
+
return {
|
|
31
|
+
id: `compaction-${compactionId}`,
|
|
32
|
+
role: "assistant",
|
|
33
|
+
kind: "compaction",
|
|
34
|
+
text: summary ||
|
|
35
|
+
errorMessage ||
|
|
36
|
+
(status === "completed"
|
|
37
|
+
? "历史上下文已精简,关键决策与当前任务已保留。"
|
|
38
|
+
: ""),
|
|
39
|
+
createdAt: Date.parse(item.at ?? "") || Date.now(),
|
|
40
|
+
...(item.seq === undefined ? {} : { eventSeq: item.seq, updatedSeq: item.seq }),
|
|
41
|
+
...(item.turnId ? { turnId: item.turnId } : {}),
|
|
42
|
+
compaction: {
|
|
43
|
+
compactionId,
|
|
44
|
+
status,
|
|
45
|
+
reason,
|
|
46
|
+
willRetry: data.willRetry === true,
|
|
47
|
+
...(finiteToken(data.tokensBefore) === undefined
|
|
48
|
+
? {}
|
|
49
|
+
: { tokensBefore: finiteToken(data.tokensBefore) }),
|
|
50
|
+
...(finiteToken(data.estimatedTokensAfter) === undefined
|
|
51
|
+
? {}
|
|
52
|
+
: { estimatedTokensAfter: finiteToken(data.estimatedTokensAfter) }),
|
|
53
|
+
...(typeof data.firstKeptEntryId === "string" && data.firstKeptEntryId
|
|
54
|
+
? { firstKeptEntryId: data.firstKeptEntryId }
|
|
55
|
+
: {}),
|
|
56
|
+
...(errorMessage ? { errorMessage } : {}),
|
|
57
|
+
...(eventId ? { eventId } : {}),
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** Stable chronological order: server sequence first, legacy time/id fallback. */
|
|
62
|
+
export function sortChatTimelineMessages(messages) {
|
|
63
|
+
return [...messages].sort((a, b) => {
|
|
64
|
+
if (a.eventSeq !== undefined &&
|
|
65
|
+
b.eventSeq !== undefined &&
|
|
66
|
+
a.eventSeq !== b.eventSeq) {
|
|
67
|
+
return a.eventSeq - b.eventSeq;
|
|
68
|
+
}
|
|
69
|
+
if (a.createdAt !== b.createdAt)
|
|
70
|
+
return a.createdAt - b.createdAt;
|
|
71
|
+
if (a.eventSeq !== undefined && b.eventSeq === undefined)
|
|
72
|
+
return 1;
|
|
73
|
+
if (a.eventSeq === undefined && b.eventSeq !== undefined)
|
|
74
|
+
return -1;
|
|
75
|
+
// Modern JS sort is stable; keep insertion order for indistinguishable
|
|
76
|
+
// legacy rows instead of inventing chronology from random ids.
|
|
77
|
+
return 0;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export function upsertCompactionMessage(messages, item) {
|
|
81
|
+
const next = compactionMessageFromEvent(item);
|
|
82
|
+
if (!next)
|
|
83
|
+
return messages;
|
|
84
|
+
const existing = messages.find((message) => message.id === next.id);
|
|
85
|
+
const result = existing
|
|
86
|
+
? messages.map((message) => message.id === next.id
|
|
87
|
+
? {
|
|
88
|
+
...message,
|
|
89
|
+
...next,
|
|
90
|
+
createdAt: Math.min(message.createdAt, next.createdAt),
|
|
91
|
+
eventSeq: message.eventSeq === undefined
|
|
92
|
+
? next.eventSeq
|
|
93
|
+
: next.eventSeq === undefined
|
|
94
|
+
? message.eventSeq
|
|
95
|
+
: Math.min(message.eventSeq, next.eventSeq),
|
|
96
|
+
...(message.updatedSeq !== undefined ||
|
|
97
|
+
message.eventSeq !== undefined ||
|
|
98
|
+
next.updatedSeq !== undefined ||
|
|
99
|
+
next.eventSeq !== undefined
|
|
100
|
+
? {
|
|
101
|
+
updatedSeq: Math.max(message.updatedSeq ?? message.eventSeq ?? 0, next.updatedSeq ?? next.eventSeq ?? 0),
|
|
102
|
+
}
|
|
103
|
+
: {}),
|
|
104
|
+
text: next.text || message.text,
|
|
105
|
+
compaction: {
|
|
106
|
+
...message.compaction,
|
|
107
|
+
...next.compaction,
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
: message)
|
|
111
|
+
: [...messages, next];
|
|
112
|
+
return sortChatTimelineMessages(result);
|
|
113
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function compareOperationOrder(left, right) {
|
|
2
|
+
const leftTime = Date.parse(left.updatedAt);
|
|
3
|
+
const rightTime = Date.parse(right.updatedAt);
|
|
4
|
+
if (Number.isFinite(leftTime) && Number.isFinite(rightTime) && leftTime !== rightTime) {
|
|
5
|
+
return leftTime - rightTime;
|
|
6
|
+
}
|
|
7
|
+
return ((left.updatedSeq ?? left.eventSeq ?? 0) -
|
|
8
|
+
(right.updatedSeq ?? right.eventSeq ?? 0));
|
|
9
|
+
}
|
|
10
|
+
export function latestDagRunId(cards) {
|
|
11
|
+
let latest;
|
|
12
|
+
for (const card of cards) {
|
|
13
|
+
if (!card.dagRunId)
|
|
14
|
+
continue;
|
|
15
|
+
if (!latest || compareOperationOrder(card, latest) > 0)
|
|
16
|
+
latest = card;
|
|
17
|
+
}
|
|
18
|
+
return latest?.dagRunId ?? null;
|
|
19
|
+
}
|
|
20
|
+
export function dagRunIdForActivity(cards, activityRef) {
|
|
21
|
+
return cards.find((card) => (card.activityRef ?? `operation:${card.operationId}`) === activityRef)?.dagRunId;
|
|
22
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
function resolveDagId(id) {
|
|
2
|
+
const value = typeof id === "function" ? id() : id;
|
|
3
|
+
return value?.trim() || null;
|
|
4
|
+
}
|
|
5
|
+
export function createDetailsDagActions(params) {
|
|
6
|
+
const fetchImpl = params.fetchFn ?? fetch;
|
|
7
|
+
let pending = false;
|
|
8
|
+
let error = null;
|
|
9
|
+
const completionListeners = new Set();
|
|
10
|
+
const emitState = () => params.onStateChange?.({ pending, error });
|
|
11
|
+
const emitCompletion = (outcome, identity, message) => {
|
|
12
|
+
for (const listener of [...completionListeners]) {
|
|
13
|
+
try {
|
|
14
|
+
listener(outcome, identity, message);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// a listener throwing must never break the request path
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const run = (action, issue) => {
|
|
22
|
+
const sessionId = resolveDagId(params.sessionId);
|
|
23
|
+
const operationId = resolveDagId(params.operationId);
|
|
24
|
+
if (!sessionId || !operationId || pending)
|
|
25
|
+
return false;
|
|
26
|
+
const identity = {
|
|
27
|
+
action,
|
|
28
|
+
workspaceId: resolveDagId(params.workspaceId ?? null),
|
|
29
|
+
sessionId,
|
|
30
|
+
operationId,
|
|
31
|
+
};
|
|
32
|
+
pending = true;
|
|
33
|
+
error = null;
|
|
34
|
+
emitState();
|
|
35
|
+
void (async () => {
|
|
36
|
+
try {
|
|
37
|
+
const result = await issue(identity);
|
|
38
|
+
if (!result.ok) {
|
|
39
|
+
error = result.message ?? `DAG 关联操作失败`;
|
|
40
|
+
params.onFailure?.(identity, error);
|
|
41
|
+
emitCompletion("failure", identity, error);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
params.onSuccess?.(identity);
|
|
45
|
+
emitCompletion("success", identity);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
error = err instanceof Error ? err.message : String(err);
|
|
49
|
+
params.onFailure?.(identity, error);
|
|
50
|
+
emitCompletion("failure", identity, error);
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
pending = false;
|
|
54
|
+
emitState();
|
|
55
|
+
}
|
|
56
|
+
})();
|
|
57
|
+
return true;
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
get pending() {
|
|
61
|
+
return pending;
|
|
62
|
+
},
|
|
63
|
+
get error() {
|
|
64
|
+
return error;
|
|
65
|
+
},
|
|
66
|
+
subscribe(listener) {
|
|
67
|
+
completionListeners.add(listener);
|
|
68
|
+
return () => completionListeners.delete(listener);
|
|
69
|
+
},
|
|
70
|
+
onAddDag() {
|
|
71
|
+
return run("add", async (identity) => {
|
|
72
|
+
// AC-002: session-scoped mutations carry the session's durable
|
|
73
|
+
// owning workspace so a global active-workspace switch can never
|
|
74
|
+
// retarget the link to another workspace's store.
|
|
75
|
+
const ownerQuery = identity.workspaceId
|
|
76
|
+
? `?workspaceId=${encodeURIComponent(identity.workspaceId)}`
|
|
77
|
+
: "";
|
|
78
|
+
const res = await fetchImpl(`/api/operator/v1/chat/sessions/${encodeURIComponent(identity.sessionId)}/operation-links${ownerQuery}`, {
|
|
79
|
+
method: "POST",
|
|
80
|
+
credentials: "same-origin",
|
|
81
|
+
headers: {
|
|
82
|
+
"Content-Type": "application/json",
|
|
83
|
+
"x-loop-console-confirmation": params.confirmationToken(),
|
|
84
|
+
},
|
|
85
|
+
body: JSON.stringify({ operationId: identity.operationId }),
|
|
86
|
+
});
|
|
87
|
+
if (!res.ok) {
|
|
88
|
+
const body = (await res.json().catch(() => ({})));
|
|
89
|
+
return {
|
|
90
|
+
ok: false,
|
|
91
|
+
message: body.error?.message ??
|
|
92
|
+
`添加 DAG 关联失败(HTTP ${res.status})`,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return { ok: true };
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
onRemoveDag() {
|
|
99
|
+
return run("remove", async (identity) => {
|
|
100
|
+
const ownerQuery = identity.workspaceId
|
|
101
|
+
? `?workspaceId=${encodeURIComponent(identity.workspaceId)}`
|
|
102
|
+
: "";
|
|
103
|
+
const res = await fetchImpl(`/api/operator/v1/chat/sessions/${encodeURIComponent(identity.sessionId)}/operation-links/${encodeURIComponent(identity.operationId)}${ownerQuery}`, {
|
|
104
|
+
method: "DELETE",
|
|
105
|
+
credentials: "same-origin",
|
|
106
|
+
headers: {
|
|
107
|
+
"x-loop-console-confirmation": params.confirmationToken(),
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
if (!res.ok && res.status !== 404) {
|
|
111
|
+
const body = (await res.json().catch(() => ({})));
|
|
112
|
+
return {
|
|
113
|
+
ok: false,
|
|
114
|
+
message: body.error?.message ??
|
|
115
|
+
`移除 DAG 关联失败(HTTP ${res.status})`,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return { ok: true };
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|