@tea-agent/loop-agent 0.51.0 → 0.52.0-next.10
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/CHANGELOG.md +123 -5
- package/dist/build-stamp.json +3 -3
- package/dist/cli/command-definitions.js +1 -75
- package/dist/cli/help.js +1 -1
- package/dist/cli/program.js +1 -28
- package/dist/commands/init-accepted-merge.js +46 -0
- package/dist/commands/init-upgrade.js +115 -2
- package/dist/commands/init.js +79 -12
- package/dist/executors/pi-sdk-executor.js +3 -3
- package/dist/governance/path-guard.js +2 -0
- package/dist/records/harvest.js +1 -1
- package/dist/shared/git-progress.js +3 -0
- package/dist/shared/operator/capabilities.js +0 -122
- package/dist/shared/pi-context-pressure/checkpoint.js +94 -24
- package/dist/shared/pi-context-pressure/compaction-policy.js +152 -66
- package/dist/shared/pi-context-pressure/extension.js +25 -8
- package/dist/shared/pi-context-pressure/index.js +1 -1
- package/dist/shared/pi-context-pressure/telemetry.js +10 -0
- package/dist/shared/update/npm-client.js +14 -3
- package/dist/task/config-types.js +5 -10
- package/dist/task/delegate.js +1 -1
- package/dist/task/read-model.js +0 -4
- package/dist/task/runtime.js +0 -1
- package/dist/task/worktree.js +1 -1
- package/dist/worker/console/chat/api-workbench-core.js +17 -6
- package/dist/worker/console/chat/api-workbench.js +2 -0
- package/dist/worker/console/chat/assistant-content.js +21 -3
- package/dist/worker/console/chat/chat-event-projection.js +6 -0
- package/dist/worker/console/chat/chat-event-store.js +32 -2
- package/dist/worker/console/chat/chat-references.js +4 -0
- package/dist/worker/console/chat/compaction-errors.js +14 -2
- package/dist/worker/console/chat/context-insights.js +41 -4
- package/dist/worker/console/chat/context-usage.js +4 -1
- package/dist/worker/console/chat/pi-runtime/custom-tools/apiworkbench-tools.js +65 -3
- package/dist/worker/console/chat/pi-runtime/custom-tools/browser-tools.js +2 -2
- package/dist/worker/console/chat/pi-runtime/extension-bindings.js +39 -0
- package/dist/worker/console/chat/pi-runtime/sdk-bindings.js +4 -0
- package/dist/worker/console/chat/pi-runtime.js +389 -191
- package/dist/worker/console/chat/repo-browser.js +5 -2
- package/dist/worker/console/chat/repo-preview-kind.js +16 -6
- package/dist/worker/console/chat/routes.js +299 -25
- package/dist/worker/console/chat/scheduled-goal-request.js +1 -1
- package/dist/worker/console/chat/subagents/jobs.js +115 -4
- package/dist/worker/console/chat/terminal-sessions.js +52 -6
- package/dist/worker/console/chat/tool-exposure-catalog.js +1 -1
- package/dist/worker/console/chat/tool-presentation.js +17 -10
- package/dist/worker/console/chat/tool-preview.js +22 -0
- package/dist/worker/console/chat/turn-process.js +49 -0
- package/dist/worker/console/chat/vcp-prompt.js +14 -9
- package/dist/worker/console/chat/workspace-changes.js +17 -0
- package/dist/worker/console/console-update-runtime.js +5 -1
- package/dist/worker/console/operator-actions.js +7 -6
- package/dist/worker/console/operator-user-error.js +5 -1
- package/dist/worker/console/pi-compaction-settings.js +220 -0
- package/dist/worker/console/routes.js +1 -1
- package/dist/worker/console/server.js +148 -6
- package/dist/worker/console/static/assets/FilePreviewDocx-ybM3ZqSl.js +9 -0
- package/dist/worker/console/static/assets/abnfDiagram-N423BO3Z-CT26sIgH.js +1 -0
- package/dist/worker/console/static/assets/{arc-Bkf_oc0_.js → arc-CPwLqDB0.js} +1 -1
- package/dist/worker/console/static/assets/architectureDiagram-T3A2C74G-CzTSMPU_.js +36 -0
- package/dist/worker/console/static/assets/{blockDiagram-VBNYF7ZC-D62uVvbI.js → blockDiagram-VBNYF7ZC-BfgbtJLH.js} +1 -1
- package/dist/worker/console/static/assets/{c4Diagram-5PPSVZJV-Iq0Y8Afx.js → c4Diagram-5PPSVZJV-B9pTjB8U.js} +1 -1
- package/dist/worker/console/static/assets/channel-DtYRMDck.js +1 -0
- package/dist/worker/console/static/assets/{chunk-2GRJ4B5K-D1TxRE3k.js → chunk-2GRJ4B5K-xORV8QsC.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-2Q5K7J3B-BE-DHkAO.js → chunk-2Q5K7J3B-BzpYWAHK.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5RXB4S5H-t0iYO8Cc.js → chunk-5RXB4S5H-D8zcRP6c.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5VM5RSS4-Clo2nExi.js → chunk-5VM5RSS4-DVEXxzQJ.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-6Q2QTUOP-C7bSpo-3.js → chunk-6Q2QTUOP-CKZOJU2z.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-GF5L2VYU-DorZaymh.js → chunk-GF5L2VYU-Cgx34Dj8.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-JWPE2WC7-Ch_4HvyJ.js → chunk-JWPE2WC7-ehcSKOcx.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-KBJHAD2P-yaSoFe-3.js → chunk-KBJHAD2P-CiY9emCG.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-RYQCIY6F-QpjaXecS.js → chunk-RYQCIY6F-Bk9X-ksQ.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-XXDRQBXY-B3t6cycg.js → chunk-XXDRQBXY-DC0xXfHy.js} +1 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-DyesHbs5.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-DyesHbs5.js +1 -0
- package/dist/worker/console/static/assets/cose-bilkent-JH36ORCC-C_EVg5l9.js +1 -0
- package/dist/worker/console/static/assets/{cynefin-VYW2F7L2-CP8LtrOl.js → cynefin-VYW2F7L2-BIFL8KrA.js} +1 -1
- package/dist/worker/console/static/assets/cynefinDiagram-MW4NZA55-DjtUYOlE.js +62 -0
- package/dist/worker/console/static/assets/{dagre-VZM6K2ZE-BK0ua9V8.js → dagre-VZM6K2ZE-D2aN2V9t.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-7IWD3JNH-t9-HP13j.js → diagram-7IWD3JNH-D_twhmFi.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-B4RE2ZJO-L5Sg9jMD.js → diagram-B4RE2ZJO-ChzncqLV.js} +1 -1
- package/dist/worker/console/static/assets/diagram-LBJQPF4R-B6LO-bF2.js +24 -0
- package/dist/worker/console/static/assets/diagram-Q27KOJAE-GrzM7AFc.js +24 -0
- package/dist/worker/console/static/assets/diagram-UB23O5K3-Bv-lntaq.js +41 -0
- package/dist/worker/console/static/assets/docx-preview-CAbT0VNs.js +23 -0
- package/dist/worker/console/static/assets/docxPreview-D_T4B7qe.js +1 -0
- package/dist/worker/console/static/assets/ebnfDiagram-BXEA7PRR-BvD2jkO_.js +1 -0
- package/dist/worker/console/static/assets/{erDiagram-JOGREHBK-CNOuj3BO.js → erDiagram-JOGREHBK-BirPCcmA.js} +1 -1
- package/dist/worker/console/static/assets/{flowDiagram-UKHOOZJN-h_Cyayai.js → flowDiagram-UKHOOZJN-Chu1YnGQ.js} +1 -1
- package/dist/worker/console/static/assets/ganttDiagram-PKOTCBZU-Djn17xhB.js +292 -0
- package/dist/worker/console/static/assets/gitGraphDiagram-DS77QQ5N-Bx1qbGHx.js +106 -0
- package/dist/worker/console/static/assets/infoDiagram-6WML65LV-D-TLMqmb.js +2 -0
- package/dist/worker/console/static/assets/{ishikawaDiagram-WSZJBQD7-DAdf5lHp.js → ishikawaDiagram-WSZJBQD7-DbJoh-6T.js} +1 -1
- package/dist/worker/console/static/assets/{journeyDiagram-NVQOT4AX-BQbGtg66.js → journeyDiagram-NVQOT4AX-DsyokZ6e.js} +1 -1
- package/dist/worker/console/static/assets/{kanban-definition-27J2QSJJ-CetLubYc.js → kanban-definition-27J2QSJJ-DlzXTxic.js} +1 -1
- package/dist/worker/console/static/assets/{linear-DLZOjaVz.js → linear-ClnZn3vw.js} +1 -1
- package/dist/worker/console/static/assets/main-D-ZQ4gLb.css +1 -0
- package/dist/worker/console/static/assets/main-fc3P1HID.js +645 -0
- package/dist/worker/console/static/assets/{mermaid.core-B_xZl_gM.js → mermaid.core-DqSlcvbf.js} +5 -5
- package/dist/worker/console/static/assets/{mindmap-definition-FAOFIHXS-Dzo3dzp0.js → mindmap-definition-FAOFIHXS-CSFbzpiX.js} +1 -1
- package/dist/worker/console/static/assets/pegDiagram-VL7TDLO6-DK80yQqe.js +1 -0
- package/dist/worker/console/static/assets/{pieDiagram-7S7Q4E2Y-Cp3YrVzQ.js → pieDiagram-7S7Q4E2Y-DWX7SFGb.js} +1 -1
- package/dist/worker/console/static/assets/{quadrantDiagram-CIZ2JOQS-4tI5mUgW.js → quadrantDiagram-CIZ2JOQS-BEPPhtXs.js} +1 -1
- package/dist/worker/console/static/assets/railroadDiagram-AXF67PYL-Ck_s6fQn.js +1 -0
- package/dist/worker/console/static/assets/{requirementDiagram-LRYGKXZP-DY-0JqdT.js → requirementDiagram-LRYGKXZP-CYig27Rj.js} +1 -1
- package/dist/worker/console/static/assets/{sankeyDiagram-W5VNT64P-DuJIzRKC.js → sankeyDiagram-W5VNT64P-u-0aSx5s.js} +1 -1
- package/dist/worker/console/static/assets/{sequenceDiagram-SI44F4Z6-BTbVJ85l.js → sequenceDiagram-SI44F4Z6-NsEJI9sM.js} +1 -1
- package/dist/worker/console/static/assets/{sheet-workbook-BPPh1uLw.js → sheet-workbook-kZ_HK4Sg.js} +2 -2
- package/dist/worker/console/static/assets/sizeCapture-X5ZJPWSS-8vneVM5U.js +1 -0
- package/dist/worker/console/static/assets/stateDiagram-OKZ733FA-CMIobUBh.js +1 -0
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-Bd0pHHKP.js +1 -0
- package/dist/worker/console/static/assets/swimlanes-SLNWSIFB-D4Qzt6ug.js +2 -0
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-BzmSZnl_.js +8 -0
- package/dist/worker/console/static/assets/{timeline-definition-Z64GVDOM-GR6lxokn.js → timeline-definition-Z64GVDOM-DMb1LpED.js} +1 -1
- package/dist/worker/console/static/assets/{vennDiagram-T6HMQDX7-DEkwyzsF.js → vennDiagram-T6HMQDX7-C_9eFOs3.js} +1 -1
- package/dist/worker/console/static/assets/{wardleyDiagram-T6FBY63Y-W5jnvEJ3.js → wardleyDiagram-T6FBY63Y-DJYMe3uT.js} +1 -1
- package/dist/worker/console/static/assets/{xychartDiagram-ELKLHX3M-cqsloioo.js → xychartDiagram-ELKLHX3M-Cv_1Mi3u.js} +1 -1
- package/dist/worker/console/static/docx-preview.html +25 -0
- package/dist/worker/console/static/index.html +3 -2
- package/dist/worker/console/static/vcp/fonts/README.md +28 -0
- package/dist/worker/console/static/vcp/vendor/vcp-engine-v1.js +4 -4
- package/dist/worker/console/static-src/operator-chat/StateDot.js +17 -0
- package/dist/worker/console/static-src/operator-chat/changed-file-diff.js +15 -0
- package/dist/worker/console/static-src/operator-chat/chat-font-size.js +90 -0
- package/dist/worker/console/static-src/operator-chat/chat-session-order.js +96 -0
- package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +8 -1
- package/dist/worker/console/static-src/operator-chat/compaction-message.js +4 -0
- package/dist/worker/console/static-src/operator-chat/details-rail-surfaces.js +2 -0
- package/dist/worker/console/static-src/operator-chat/file-touch.js +107 -0
- package/dist/worker/console/static-src/operator-chat/format-file-size.js +26 -0
- package/dist/worker/console/static-src/operator-chat/open-preview-in-browser.js +44 -0
- package/dist/worker/console/static-src/operator-chat/reference-display.js +7 -1
- package/dist/worker/console/static-src/operator-chat/tasks-auto-open.js +100 -0
- package/dist/worker/console/static-src/operator-chat/tasks-layout-tween.js +103 -0
- package/dist/worker/console/static-src/operator-chat/tasks-model.js +657 -0
- package/dist/worker/console/static-src/operator-chat/tasks-view-glide.js +96 -0
- package/dist/worker/console/static-src/operator-chat/turn-group-equality.js +1 -0
- package/dist/worker/console/static-src/operator-chat/use-auto-animate.js +61 -0
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +194 -47
- package/dist/worker/console/static-src/operator-chat/useChatStream.js +4 -0
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +18 -0
- package/dist/worker/console/static-src/operator-chat/useRepoBrowser.js +111 -21
- package/dist/worker/console/static-src/operator-chat/useRuntimeControls.js +91 -47
- package/dist/worker/console/static-src/operator-chat/useVcpPreferences.js +1 -1
- package/dist/worker/console/static-src/operator-chat/user-turn-anchors-merge.js +50 -0
- package/dist/worker/console/static-src/operator-chat/vcp-fonts.js +180 -22
- package/dist/worker/console/static-src/operator-chat/vcp-frame.js +3 -3
- package/dist/worker/console/static-src/shell/console-update-progress.js +16 -0
- package/dist/worker/console/static-src/shell/console-update-reload.js +4 -1
- package/dist/worker/console/static-src/shell/workspace-route.js +0 -2
- package/dist/worker/console/vite.config.js +5 -1
- package/dist/worker/console/workspace-registry.js +62 -19
- package/dist/worker/observe/static/operator-chrome.js +0 -1
- package/dist/worker/scheduler/git-base.js +3 -0
- package/dist/worker/scheduler/night-git-finalizer.js +1 -1
- package/dist/worker/scheduler/night-harvest.js +1 -1
- package/dist/worker/scheduler/prepared-attempt-recovery.js +1 -1
- package/dist/worker/scheduler/scheduled-goal-evidence.js +1 -1
- package/dist/workflows/dag/backend-test-scenario-param.js +60 -4
- package/dist/workflows/dag/dynamic-runtime/reduction.js +7 -2
- package/dist/workflows/dag/frontend-test-framework-adapters.js +11 -2
- package/dist/workflows/script/windows/guest.js +13 -2
- package/dist/workflows/script/windows/native.js +21 -3
- package/docs/architecture/dag-execution.md +2 -13
- package/docs/architecture/facts-and-state.md +2 -3
- package/docs/architecture/runtime-boundaries.md +2 -2
- package/package.json +9 -7
- package/resource-catalog.v1.json +6 -6
- package/scripts/patch-pi-sdk-windows-hide.mjs +3 -3
- package/skills/loop-agent/references/command-reference.md +2 -41
- package/skills/loop-agent/references/harness-policy.md +3 -30
- package/skills/loop-agent/references/long-running-loop.md +6 -54
- package/dist/application/loop/run-action.js +0 -19
- package/dist/commands/dag-workflow-compile.js +0 -93
- package/dist/commands/dag-workflow-plan.js +0 -132
- package/dist/commands/dag-workflow-validate.js +0 -68
- package/dist/commands/loop-benchmark.js +0 -74
- package/dist/commands/loop.js +0 -251
- package/dist/commands/workflow.js +0 -259
- package/dist/infrastructure/harness/loop-store.js +0 -41
- package/dist/worker/console/static/assets/abnfDiagram-N423BO3Z-FQePHM07.js +0 -1
- package/dist/worker/console/static/assets/architectureDiagram-T3A2C74G-p_mwm8cd.js +0 -36
- package/dist/worker/console/static/assets/channel-CIBAg8WF.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-B4xQrSmv.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-B4xQrSmv.js +0 -1
- package/dist/worker/console/static/assets/cose-bilkent-JH36ORCC-BPXf8ZYr.js +0 -1
- package/dist/worker/console/static/assets/cynefinDiagram-MW4NZA55-CNsL9N2-.js +0 -62
- package/dist/worker/console/static/assets/diagram-LBJQPF4R-BipWFRgs.js +0 -24
- package/dist/worker/console/static/assets/diagram-Q27KOJAE-T2p4xa38.js +0 -24
- package/dist/worker/console/static/assets/diagram-UB23O5K3-CVwz6LVu.js +0 -41
- package/dist/worker/console/static/assets/ebnfDiagram-BXEA7PRR-CybQrGSA.js +0 -1
- package/dist/worker/console/static/assets/ganttDiagram-PKOTCBZU-D411_55h.js +0 -292
- package/dist/worker/console/static/assets/gitGraphDiagram-DS77QQ5N-DpVtzs9z.js +0 -106
- package/dist/worker/console/static/assets/index-B7cwOTL9.js +0 -649
- package/dist/worker/console/static/assets/index-CATbSkPc.css +0 -1
- package/dist/worker/console/static/assets/infoDiagram-6WML65LV-D74Uvx6K.js +0 -2
- package/dist/worker/console/static/assets/pegDiagram-VL7TDLO6-CSwoBOpM.js +0 -1
- package/dist/worker/console/static/assets/railroadDiagram-AXF67PYL-n0Mt3Yia.js +0 -1
- package/dist/worker/console/static/assets/sizeCapture-X5ZJPWSS-Dmf1pC7B.js +0 -1
- package/dist/worker/console/static/assets/stateDiagram-OKZ733FA-4-jdPUHD.js +0 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-DojWfYnC.js +0 -1
- package/dist/worker/console/static/assets/swimlanes-SLNWSIFB-DNhjjaAU.js +0 -2
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-CJo4AKWH.js +0 -8
- package/dist/worker/console/static/vcp/fonts/Lanxi-/345/217/257/345/256/213.woff2 +0 -0
- package/dist/worker/console/static/vcp/fonts/Lanxi-/346/234/227/345/256/213.woff2 +0 -0
- package/dist/worker/console/static/vcp/fonts/Lanxi-/350/266/205/347/262/227/351/273/221.woff2 +0 -0
- package/dist/workflows/dynamic/compile.js +0 -371
- package/dist/workflows/dynamic/compileTypes.js +0 -1
- package/dist/workflows/dynamic/errors.js +0 -5
- package/dist/workflows/dynamic/profiles.js +0 -156
- package/dist/workflows/dynamic/spec.js +0 -115
- package/dist/workflows/dynamic/validate.js +0 -275
- package/dist/workflows/loop/actions/dag-action.js +0 -129
- package/dist/workflows/loop/actions/pi-review.js +0 -267
- package/dist/workflows/loop/actions/shared.js +0 -157
- package/dist/workflows/loop/actions/shell-verify.js +0 -82
- package/dist/workflows/loop/actions/types.js +0 -1
- package/dist/workflows/loop/actions/workflow-action.js +0 -255
- package/dist/workflows/loop/actions.js +0 -160
- package/dist/workflows/loop/benchmark.js +0 -513
- package/dist/workflows/loop/closeout.js +0 -135
- package/dist/workflows/loop/context.js +0 -47
- package/dist/workflows/loop/events.js +0 -26
- package/dist/workflows/loop/hash.js +0 -32
- package/dist/workflows/loop/index.js +0 -8
- package/dist/workflows/loop/paths.js +0 -17
- package/dist/workflows/loop/policy/auto-policy.js +0 -112
- package/dist/workflows/loop/policy/path-patterns.js +0 -13
- package/dist/workflows/loop/rounds.js +0 -81
- package/dist/workflows/loop/signals.js +0 -52
- package/dist/workflows/loop/state.js +0 -116
- package/dist/workflows/loop/templates.js +0 -54
- package/dist/workflows/loop/types.js +0 -28
- /package/dist/workflows/{dynamic/artifacts.js → dag/dynamic-runtime/reduction-artifacts.js} +0 -0
|
@@ -1,11 +1,116 @@
|
|
|
1
1
|
import { buildNightJobDetail, buildNightJobsList } from "../../../observe/night-jobs.js";
|
|
2
|
+
import { getCommandToolArgs, getCommandToolResult, isShellTool } from "../tool-preview.js";
|
|
2
3
|
export function scopeWorkspaceJobs(jobs, workspaceId) {
|
|
3
4
|
const items = jobs.filter((job) => job.workspaceId === workspaceId);
|
|
4
5
|
return { items, omitted: jobs.length - items.length };
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Project Console terminal sessions into the background-jobs shape.
|
|
9
|
+
*
|
|
10
|
+
* DSH's drawer lists the HOST's client jobs — the long-running commands a
|
|
11
|
+
* reader started and wants to watch. Loop's equivalent live surface is the
|
|
12
|
+
* terminal registry: a PTY session carries a name, a start time, an exit code
|
|
13
|
+
* and a readable output buffer, which is exactly a job row. Scheduler night
|
|
14
|
+
* jobs are merged in separately because they carry different facts (feature /
|
|
15
|
+
* task / worker run) and are often empty on a working machine.
|
|
16
|
+
*/
|
|
17
|
+
export function projectTerminalJobs(terminals, workspaceId) {
|
|
18
|
+
return terminals.map((session) => ({
|
|
19
|
+
jobId: session.sessionId,
|
|
20
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
21
|
+
featureId: "",
|
|
22
|
+
taskId: session.name || session.sessionId,
|
|
23
|
+
status: session.exited ? (session.exitCode === 0 ? "completed" : "failed") : "running",
|
|
24
|
+
startedAt: session.createdAt,
|
|
25
|
+
nextAction: session.exited ? "已结束" : "运行中",
|
|
26
|
+
source: "terminal",
|
|
27
|
+
shell: session.shell,
|
|
28
|
+
terminalSessionId: session.sessionId,
|
|
29
|
+
ownerSessionId: session.ownerSessionId,
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Project a session's event ring into background-job rows.
|
|
34
|
+
*
|
|
35
|
+
* DSH's drawer lists the long-running commands of the session — the rows read
|
|
36
|
+
* `pshw npm run test:fast` with a state dot and an elapsed time. In Loop those
|
|
37
|
+
* commands are SHELL TOOL CALLS (`bash` / `powershell` / `pwsh`), which the
|
|
38
|
+
* event ring already records as `tool_call` → `tool_result` pairs. Projecting
|
|
39
|
+
* them here means the drawer shows real work with no new backend surface.
|
|
40
|
+
*
|
|
41
|
+
* Only shell tools are projected: a read/grep call is not something a reader
|
|
42
|
+
* watches, and the ring deliberately caps its retained tail, so this is a
|
|
43
|
+
* bounded projection of recent activity rather than a durable job registry.
|
|
44
|
+
*/
|
|
45
|
+
export function projectShellToolJobs(events, ownerSessionId, workspaceId) {
|
|
46
|
+
const byCallId = new Map();
|
|
47
|
+
const order = [];
|
|
48
|
+
for (const event of events) {
|
|
49
|
+
const payload = event.data;
|
|
50
|
+
const toolCallId = typeof payload.toolCallId === "string" ? payload.toolCallId : undefined;
|
|
51
|
+
const toolName = typeof payload.toolName === "string" ? payload.toolName : undefined;
|
|
52
|
+
if (!toolCallId || !isShellTool(toolName))
|
|
53
|
+
continue;
|
|
54
|
+
if (event.kind === "tool_call") {
|
|
55
|
+
if (byCallId.has(toolCallId))
|
|
56
|
+
continue;
|
|
57
|
+
// The preview is the bounded one-line command the UI already prints,
|
|
58
|
+
// so the job row shows exactly what the timeline shows.
|
|
59
|
+
const args = getCommandToolArgs(toolName, payload.argsPreview);
|
|
60
|
+
const name = args?.description?.trim() || args?.command?.trim() || toolName;
|
|
61
|
+
byCallId.set(toolCallId, {
|
|
62
|
+
toolCallId,
|
|
63
|
+
name: name.split(/\r?\n/)[0].slice(0, 160),
|
|
64
|
+
startedAt: event.at,
|
|
65
|
+
failed: false,
|
|
66
|
+
});
|
|
67
|
+
order.push(toolCallId);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (event.kind === "tool_result" || event.kind === "tool_update") {
|
|
71
|
+
const current = byCallId.get(toolCallId);
|
|
72
|
+
if (!current)
|
|
73
|
+
continue;
|
|
74
|
+
const result = getCommandToolResult(payload.resultPreview);
|
|
75
|
+
if (result.exitCode !== undefined)
|
|
76
|
+
current.exitCode = result.exitCode;
|
|
77
|
+
if (event.kind === "tool_result") {
|
|
78
|
+
current.finishedAt = event.at;
|
|
79
|
+
if (result.exitCode !== undefined && result.exitCode !== 0)
|
|
80
|
+
current.failed = true;
|
|
81
|
+
}
|
|
82
|
+
if (result.output)
|
|
83
|
+
current.output = result.output.slice(0, 2000);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return order
|
|
87
|
+
.map((toolCallId) => byCallId.get(toolCallId))
|
|
88
|
+
// Newest first: the drawer is a recency list, not a full audit trail
|
|
89
|
+
// (the event ring only retains a bounded tail anyway).
|
|
90
|
+
.sort((a, b) => (b.finishedAt ?? b.startedAt).localeCompare(a.finishedAt ?? a.startedAt))
|
|
91
|
+
.slice(0, 20)
|
|
92
|
+
.map((job) => ({
|
|
93
|
+
jobId: job.toolCallId,
|
|
94
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
95
|
+
featureId: "",
|
|
96
|
+
taskId: job.name,
|
|
97
|
+
status: job.finishedAt ? (job.failed ? "failed" : "completed") : "running",
|
|
98
|
+
startedAt: job.startedAt,
|
|
99
|
+
...(job.finishedAt ? { finishedAt: job.finishedAt } : {}),
|
|
100
|
+
nextAction: job.finishedAt ? "已结束" : "运行中",
|
|
101
|
+
source: "terminal",
|
|
102
|
+
shell: "pwsh",
|
|
103
|
+
terminalSessionId: job.toolCallId,
|
|
104
|
+
ownerSessionId,
|
|
105
|
+
...(job.output ? { outputRef: job.output } : {}),
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
export async function listWorkspaceJobs(repoRoot, terminals = [], workspaceId) {
|
|
109
|
+
const terminal = projectTerminalJobs(terminals, workspaceId);
|
|
110
|
+
if (!repoRoot)
|
|
111
|
+
return terminal;
|
|
112
|
+
const scheduler = await buildNightJobsList(repoRoot)
|
|
113
|
+
.then((list) => Promise.all(list.schedules.map(async (schedule) => {
|
|
9
114
|
const detail = schedule.currentExecutionId
|
|
10
115
|
? await buildNightJobDetail(repoRoot, schedule.scheduleId).catch(() => null)
|
|
11
116
|
: null;
|
|
@@ -23,6 +128,12 @@ export async function listWorkspaceJobs(repoRoot) {
|
|
|
23
128
|
...(execution?.dagRunId ? { dagRunId: execution.dagRunId } : {}),
|
|
24
129
|
...(execution?.evidenceArchivePath ? { outputRef: execution.evidenceArchivePath } : {}),
|
|
25
130
|
nextAction: schedule.nextAction,
|
|
131
|
+
source: "scheduler",
|
|
26
132
|
};
|
|
27
|
-
}))
|
|
133
|
+
})))
|
|
134
|
+
.catch(() => []);
|
|
135
|
+
// Live rows first (a running command is what the reader is watching), then
|
|
136
|
+
// running scheduler jobs, then everything settled.
|
|
137
|
+
const rank = (job) => job.status === "running" || job.status === "working" ? (job.source === "terminal" ? 0 : 1) : 2;
|
|
138
|
+
return [...terminal, ...scheduler].sort((a, b) => rank(a) - rank(b));
|
|
28
139
|
}
|
|
@@ -31,6 +31,26 @@ const IS_WINDOWS = process.platform === "win32";
|
|
|
31
31
|
function firstExisting(paths) {
|
|
32
32
|
return paths.find((p) => existsSync(p));
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolve a bare executable name through PATH.
|
|
36
|
+
*
|
|
37
|
+
* Git Bash is not always installed under `C:\Program Files\Git`; portable
|
|
38
|
+
* installs, Scoop/Chocolatey packages and custom prefixes all put
|
|
39
|
+
* `bash.exe` somewhere else but on PATH. Without this fallback a real,
|
|
40
|
+
* usable bash reads as "not available on this platform".
|
|
41
|
+
*/
|
|
42
|
+
function findOnPath(name) {
|
|
43
|
+
const pathValue = process.env.PATH ?? process.env.Path ?? "";
|
|
44
|
+
const separator = IS_WINDOWS ? ";" : ":";
|
|
45
|
+
for (const entry of pathValue.split(separator)) {
|
|
46
|
+
if (!entry)
|
|
47
|
+
continue;
|
|
48
|
+
const candidate = `${entry.replace(/[\\/]+$/, "")}${IS_WINDOWS ? "\\" : "/"}${name}`;
|
|
49
|
+
if (existsSync(candidate))
|
|
50
|
+
return candidate;
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
34
54
|
/** Windows PowerShell 5+ or pwsh 7; prefer pwsh 7 when installed. */
|
|
35
55
|
function resolvePowershell() {
|
|
36
56
|
if (IS_WINDOWS) {
|
|
@@ -85,10 +105,15 @@ function resolveBash() {
|
|
|
85
105
|
"C:\\Program Files\\Git\\bin\\bash.exe",
|
|
86
106
|
"C:\\Program Files (x86)\\Git\\bin\\bash.exe",
|
|
87
107
|
"C:\\Program Files\\Git\\usr\\bin\\bash.exe",
|
|
88
|
-
])
|
|
108
|
+
]) ??
|
|
109
|
+
(process.env.GIT_INSTALL_ROOT
|
|
110
|
+
? firstExisting([`${process.env.GIT_INSTALL_ROOT.replace(/[\\/]+$/, "")}\\bin\\bash.exe`])
|
|
111
|
+
: undefined) ??
|
|
112
|
+
findOnPath("bash.exe");
|
|
89
113
|
return file ? { file, args: ["-i", "-l"] } : undefined;
|
|
90
114
|
}
|
|
91
|
-
const file = firstExisting(["/bin/bash", "/usr/bin/bash", "/usr/local/bin/bash", "/opt/homebrew/bin/bash"])
|
|
115
|
+
const file = firstExisting(["/bin/bash", "/usr/bin/bash", "/usr/local/bin/bash", "/opt/homebrew/bin/bash"]) ??
|
|
116
|
+
findOnPath("bash");
|
|
92
117
|
return file ? { file, args: ["-i"] } : undefined;
|
|
93
118
|
}
|
|
94
119
|
/** zsh: macOS default shell; on Linux only when installed. */
|
|
@@ -206,6 +231,21 @@ export class TerminalSessionRegistry {
|
|
|
206
231
|
rows: options.rows ?? 30,
|
|
207
232
|
env: process.env ?? {},
|
|
208
233
|
encoding: "utf8",
|
|
234
|
+
/*
|
|
235
|
+
* winpty allocates a REAL console host window — the black box that
|
|
236
|
+
* flashed on every terminal session — while ConPTY keeps the
|
|
237
|
+
* session headless. node-pty picks ConPTY automatically from
|
|
238
|
+
* Windows build 18309, and `useConpty` is deprecated and ignored
|
|
239
|
+
* in 1.2 (microsoft/node-pty#871), so passing it documents the
|
|
240
|
+
* intent rather than flipping a switch.
|
|
241
|
+
*
|
|
242
|
+
* `useConptyDll` (the bundled conpty.dll) is NOT a drop-in
|
|
243
|
+
* improvement: measured on Windows 10.0.26300 it starts the shell
|
|
244
|
+
* but stops delivering output, so readAll/subscribe see the banner
|
|
245
|
+
* and nothing else. Two terminal tests catch that. Keep the system
|
|
246
|
+
* ConPTY; left undefined on other platforms.
|
|
247
|
+
*/
|
|
248
|
+
...(IS_WINDOWS ? { useConpty: true } : {}),
|
|
209
249
|
});
|
|
210
250
|
}
|
|
211
251
|
catch (error) {
|
|
@@ -288,13 +328,19 @@ export class TerminalSessionRegistry {
|
|
|
288
328
|
/** Full buffered output (post-trim prefix may be incomplete). */
|
|
289
329
|
readAll(sessionId) {
|
|
290
330
|
const entry = this.mustGet(sessionId);
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
331
|
+
/*
|
|
332
|
+
* If the caller reads before any real PTY output has arrived, the banner
|
|
333
|
+
* injection in onData hasn't fired yet. Fold it into the BUFFER, not just
|
|
334
|
+
* this response: consuming it here used to drop the banner for every
|
|
335
|
+
* later read, so a reader who opened the panel once and refreshed saw a
|
|
336
|
+
* terminal that had silently lost its startup banner.
|
|
337
|
+
*/
|
|
294
338
|
if (entry.pendingBanner !== undefined) {
|
|
295
|
-
|
|
339
|
+
entry.buffer.unshift(entry.pendingBanner);
|
|
340
|
+
entry.bufferChars += entry.pendingBanner.length;
|
|
296
341
|
entry.pendingBanner = undefined;
|
|
297
342
|
}
|
|
343
|
+
const text = entry.buffer.join("");
|
|
298
344
|
return {
|
|
299
345
|
text,
|
|
300
346
|
truncated: entry.info.totalOutputChars > entry.bufferChars,
|
|
@@ -67,7 +67,7 @@ export const PI_DATA_TOOLS = Object.freeze([
|
|
|
67
67
|
"sql_query", "sql_exec", "sql_schema", "sql_stats", "sql_health", "sql_connections",
|
|
68
68
|
]);
|
|
69
69
|
export const PI_API_TOOLS = Object.freeze([
|
|
70
|
-
"api_collections", "api_scan", "api_send", "api_environments", "api_history",
|
|
70
|
+
"api_collections", "api_scan", "api_send", "api_environments", "api_history", "api_debug",
|
|
71
71
|
]);
|
|
72
72
|
/** Lightweight directory. Registered only in API candidate mode; never sends a request. */
|
|
73
73
|
export const PI_API_CAPABILITY_TOOL = "apiCapabilities";
|
|
@@ -12,22 +12,29 @@ export function toolRecord(value) {
|
|
|
12
12
|
export function patchRows(patch) {
|
|
13
13
|
const lines = patch.replace(/\r\n/g, "\n").split("\n");
|
|
14
14
|
let inHunk = false;
|
|
15
|
+
let oldLine, newLine;
|
|
15
16
|
const rows = [];
|
|
16
17
|
for (const line of lines) {
|
|
17
18
|
if (line.startsWith("@@")) {
|
|
19
|
+
const header = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(line);
|
|
18
20
|
if (inHunk)
|
|
19
21
|
rows.push({ kind: "gap", text: "⋯" });
|
|
22
|
+
oldLine = header ? Number(header[1]) : undefined;
|
|
23
|
+
newLine = header ? Number(header[2]) : undefined;
|
|
20
24
|
inHunk = true;
|
|
21
25
|
continue;
|
|
22
26
|
}
|
|
23
27
|
if (!inHunk)
|
|
24
28
|
continue;
|
|
25
|
-
if (line.startsWith("+"))
|
|
26
|
-
rows.push({ kind: "add", text: line.slice(1) });
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
if (line.startsWith("+")) {
|
|
30
|
+
rows.push({ kind: "add", text: line.slice(1), ...(newLine !== undefined ? { newLine: newLine++ } : {}) });
|
|
31
|
+
}
|
|
32
|
+
else if (line.startsWith("-")) {
|
|
33
|
+
rows.push({ kind: "del", text: line.slice(1), ...(oldLine !== undefined ? { oldLine: oldLine++ } : {}) });
|
|
34
|
+
}
|
|
35
|
+
else if (line.startsWith(" ")) {
|
|
36
|
+
rows.push({ kind: "context", text: line.slice(1), ...(oldLine !== undefined ? { oldLine: oldLine++ } : {}), ...(newLine !== undefined ? { newLine: newLine++ } : {}) });
|
|
37
|
+
}
|
|
31
38
|
}
|
|
32
39
|
return rows;
|
|
33
40
|
}
|
|
@@ -43,10 +50,10 @@ export function replacementRows(before, after) {
|
|
|
43
50
|
if (head === oldLines.length && head === newLines.length)
|
|
44
51
|
return before === after ? [] : [{ kind: "gap", text: "仅换行格式或末尾换行发生变化" }];
|
|
45
52
|
return [
|
|
46
|
-
...oldLines.slice(Math.max(0, head - 3), head).map(text => ({ kind: "context", text })),
|
|
47
|
-
...oldLines.slice(head, oldLines.length - tail).map(text => ({ kind: "del", text })),
|
|
48
|
-
...newLines.slice(head, newLines.length - tail).map(text => ({ kind: "add", text })),
|
|
49
|
-
...newLines.slice(newLines.length - tail, newLines.length - tail + 3).map(text => ({ kind: "context", text })),
|
|
53
|
+
...oldLines.slice(Math.max(0, head - 3), head).map((text, i) => ({ kind: "context", text, oldLine: Math.max(0, head - 3) + i + 1, newLine: Math.max(0, head - 3) + i + 1 })),
|
|
54
|
+
...oldLines.slice(head, oldLines.length - tail).map((text, i) => ({ kind: "del", text, oldLine: head + i + 1 })),
|
|
55
|
+
...newLines.slice(head, newLines.length - tail).map((text, i) => ({ kind: "add", text, newLine: head + i + 1 })),
|
|
56
|
+
...newLines.slice(newLines.length - tail, newLines.length - tail + 3).map((text, i) => ({ kind: "context", text, oldLine: oldLines.length - tail + i + 1, newLine: newLines.length - tail + i + 1 })),
|
|
50
57
|
];
|
|
51
58
|
}
|
|
52
59
|
export function fileToolPreview(value) {
|
|
@@ -160,6 +160,22 @@ function adapterPreview(toolName, input, maxLen) {
|
|
|
160
160
|
const bits = [path, symbol, line].filter(Boolean);
|
|
161
161
|
return clampOneLine(bits.join(" · "), maxLen);
|
|
162
162
|
}
|
|
163
|
+
if (name === "api_send" || name === "api_debug") {
|
|
164
|
+
const method = fieldString(input, "method");
|
|
165
|
+
const url = fieldString(input, "url");
|
|
166
|
+
if (method && url)
|
|
167
|
+
return clampOneLine(method + " " + url, maxLen);
|
|
168
|
+
if (url)
|
|
169
|
+
return clampOneLine(url, maxLen);
|
|
170
|
+
const action = fieldString(input, "action");
|
|
171
|
+
if (action)
|
|
172
|
+
return clampOneLine(action, maxLen);
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
if (name === "api_scan" || name === "api_collections" || name === "api_environments" || name === "api_history") {
|
|
176
|
+
const action = fieldString(input, "action");
|
|
177
|
+
return action ? clampOneLine(action, maxLen) : undefined;
|
|
178
|
+
}
|
|
163
179
|
// Family prefixes (pi-lens / codegraph) — generic field heuristic below.
|
|
164
180
|
return undefined;
|
|
165
181
|
}
|
|
@@ -304,6 +320,9 @@ export function getAskUserQuestionSummary(args, result) {
|
|
|
304
320
|
export function getToolPresentation(toolName) {
|
|
305
321
|
const raw = toolName?.trim() || "Tool";
|
|
306
322
|
const name = raw.toLowerCase();
|
|
323
|
+
if (name.startsWith("api_")) {
|
|
324
|
+
return { kind: "api", label: name === "api_send" ? "API 请求" : name === "api_scan" ? "API 扫描" : name === "api_debug" ? "API 诊断" : "API" };
|
|
325
|
+
}
|
|
307
326
|
if (name === "powershell" || name === "pwsh")
|
|
308
327
|
return { kind: "bash", label: "PowerShell" };
|
|
309
328
|
if (name === "bash" || name === "shell" || name.includes("exec_command")) {
|
|
@@ -373,6 +392,9 @@ export function getToolSectionLabels(toolName) {
|
|
|
373
392
|
if (isAskUserQuestionTool(toolName)) {
|
|
374
393
|
return { argsLabel: "提问", resultLabel: "您的回答" };
|
|
375
394
|
}
|
|
395
|
+
if (name.startsWith("api_")) {
|
|
396
|
+
return { argsLabel: "请求", resultLabel: "响应" };
|
|
397
|
+
}
|
|
376
398
|
return { argsLabel: "入参", resultLabel: "结果" };
|
|
377
399
|
}
|
|
378
400
|
/**
|
|
@@ -5,6 +5,8 @@ import { getDisplayableAssistantBlocks, joinAssistantText, parseAssistantContent
|
|
|
5
5
|
import { dagProgressActivityForTool, semanticActivityForTool, } from "./semantic-activity.js";
|
|
6
6
|
import { compareChatOrder } from "./turn-order.js";
|
|
7
7
|
import { ensureLinkedSubmissionOrder } from "./timeline-message-order.js";
|
|
8
|
+
import { fileToolPreview, toolRecord } from "./tool-presentation.js";
|
|
9
|
+
import { summarizeTurnFileEdits } from "./workspace-changes.js";
|
|
8
10
|
/** Cumulative argument updates may refresh preparing calls, never regress dispatched/settled ones. */
|
|
9
11
|
export function upsertPreparingTools(existing, content, meta) {
|
|
10
12
|
let next = existing;
|
|
@@ -396,6 +398,8 @@ function fillProcessDetails(group) {
|
|
|
396
398
|
}
|
|
397
399
|
continue;
|
|
398
400
|
}
|
|
401
|
+
if (block.type !== "toolCall")
|
|
402
|
+
continue;
|
|
399
403
|
const tool = group.tools.find((entry) => entry.id === block.toolCallId);
|
|
400
404
|
if (!tool || usedToolIds.has(tool.id))
|
|
401
405
|
continue;
|
|
@@ -509,6 +513,47 @@ function fillProcessDetails(group) {
|
|
|
509
513
|
content: split.answerBlocks,
|
|
510
514
|
};
|
|
511
515
|
}
|
|
516
|
+
function deriveToolWorkspaceChanges(group) {
|
|
517
|
+
if (group.live)
|
|
518
|
+
return undefined;
|
|
519
|
+
const byDisplay = new Map();
|
|
520
|
+
for (const tool of group.tools) {
|
|
521
|
+
if ((tool.toolName !== "edit" && tool.toolName !== "write") || tool.status !== "ok" || tool.interrupted)
|
|
522
|
+
continue;
|
|
523
|
+
const args = toolRecord(tool.args);
|
|
524
|
+
const rawPath = typeof args?.path === "string" ? args.path : typeof args?.file_path === "string" ? args.file_path : "";
|
|
525
|
+
if (!rawPath || args?.pathTruncated === true)
|
|
526
|
+
continue;
|
|
527
|
+
const display = rawPath.replace(/\\/g, "/");
|
|
528
|
+
const preview = fileToolPreview(tool.resultText ?? tool.result);
|
|
529
|
+
const added = preview?.added ?? 0;
|
|
530
|
+
const deleted = preview?.removed ?? 0;
|
|
531
|
+
const existing = byDisplay.get(display);
|
|
532
|
+
if (existing) {
|
|
533
|
+
existing.added += added;
|
|
534
|
+
existing.deleted += deleted;
|
|
535
|
+
if (existing.firstChangedLine === undefined && preview?.firstChangedLine !== undefined) {
|
|
536
|
+
existing.firstChangedLine = preview.firstChangedLine;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
else {
|
|
540
|
+
byDisplay.set(display, {
|
|
541
|
+
path: rawPath,
|
|
542
|
+
display,
|
|
543
|
+
added,
|
|
544
|
+
deleted,
|
|
545
|
+
...(preview?.firstChangedLine !== undefined ? { firstChangedLine: preview.firstChangedLine } : {}),
|
|
546
|
+
status: tool.toolName === "write" ? "added" : "modified",
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return summarizeTurnFileEdits({
|
|
551
|
+
sessionId: "",
|
|
552
|
+
turnId: group.turnId ?? group.key,
|
|
553
|
+
files: [...byDisplay.values()],
|
|
554
|
+
failedTurn: group.turnState === "failed" || group.turnState === "aborted",
|
|
555
|
+
});
|
|
556
|
+
}
|
|
512
557
|
export function buildTurnProcessGroups(input) {
|
|
513
558
|
const visible = ensureLinkedSubmissionOrder(input.messages
|
|
514
559
|
.filter((m) => m.role === "user" || m.role === "assistant")
|
|
@@ -647,6 +692,10 @@ export function buildTurnProcessGroups(input) {
|
|
|
647
692
|
group.conversationItems = (input.conversationNodes ?? [])
|
|
648
693
|
.filter((node) => node.location.kind !== "session" && node.location.turnId === group.turnId)
|
|
649
694
|
.map((node) => ({ kind: node.kind, node }));
|
|
695
|
+
// Old Git snapshots and fallback counts do not prove this turn edited these files.
|
|
696
|
+
group.workspaceChanges =
|
|
697
|
+
(group.turnId ? input.workspaceChanges?.find(item => item.turnId === group.turnId && item.source === "tool-events") : undefined) ??
|
|
698
|
+
deriveToolWorkspaceChanges(group);
|
|
650
699
|
if (group.conversationItems.some((item) => item.kind === "turn-error")) {
|
|
651
700
|
group.processItems = group.processItems.filter((item) => item.kind !== "provider-error");
|
|
652
701
|
}
|
|
@@ -19,8 +19,10 @@ VCP 已启用,但它不是默认输出格式。每次回答先在内部选择
|
|
|
19
19
|
- 所有 CSS 放在卡片内的 <style>\` 中,并且选择器必须以 \`#vcp-root\` 开头,避免影响页面其他内容。
|
|
20
20
|
- 先提炼信息,再排版:只保留与问题直接相关的内容;优先使用标题、短段落、列表和少量数据卡,不要堆砌装饰。
|
|
21
21
|
- 控制密度:每个区块只表达一个重点;段落保持短句;避免重复结论、冗长说明和大面积空白。
|
|
22
|
-
-
|
|
23
|
-
-
|
|
22
|
+
- 保持可读:正文与标题默认只用 \`Vcp-Sans\`(系统黑体链);需要衬线观感时用 \`Vcp-Serif\`,随笔/引言可用 \`Vcp-Kai\`,数字、时间戳和代码用 \`Vcp-Mono\`。
|
|
23
|
+
- 字体最多用一种表现字体(\`Vcp-Serif\` 或 \`Vcp-Kai\`)加一种系统黑体;不要同时混排三种以上字体。
|
|
24
|
+
- 全部字体使用 normal 字重:靠字号、字距和颜色建立层级,不要靠加粗。标题 font-weight 不要超过 600,正文保持 400;不要使用 700/800/900 或 \`Lanxi-HeiTiBold\` 堆叠标题。
|
|
25
|
+
- 不要使用超细、超粗、装饰字体处理正文、数据、表格和小字,也不要用 text-shadow 描边模拟粗体。
|
|
24
26
|
- 颜色控制在中性底色加一个主色和一个强调色;阴影、圆角、渐变只在有助于层次时使用。
|
|
25
27
|
- 表格只放必要列;移动端优先,避免依赖固定宽度、横向滚动或过小字号。
|
|
26
28
|
- 只有确实需要交互时才使用 <button onclick="input('待输入指令')">文本</button>\`;不要伪造交互。
|
|
@@ -28,22 +30,25 @@ VCP 已启用,但它不是默认输出格式。每次回答先在内部选择
|
|
|
28
30
|
- 不编造数据、链接、状态或图片;不确定的信息明确标注。
|
|
29
31
|
|
|
30
32
|
【可用字体】
|
|
31
|
-
- \`
|
|
32
|
-
- \`
|
|
33
|
-
- \`
|
|
34
|
-
- \`
|
|
35
|
-
- \`Lanxi-
|
|
33
|
+
- \`Vcp-Sans\`(默认):系统黑体链,macOS 命中苹方,Windows 命中微软雅黑;用于正文、标题、表格和说明文字。
|
|
34
|
+
- \`Vcp-Serif\`:系统中宋/衬线链,macOS 命中宋体,Windows 命中中易宋体;用于杂志标题或精装正文,不要用于小字和数据。
|
|
35
|
+
- \`Vcp-Kai\`:系统楷体链,用于短文、随笔和引言,不用于数据和小字。
|
|
36
|
+
- \`Vcp-Mono\`:系统等宽链,用于代码、指标数字、时间戳。
|
|
37
|
+
- \`Lanxi-HeiTi\`、\`Lanxi-HeiTiBold\`:内置黑体,作为 \`Vcp-Sans\` 不可用时的兜底。
|
|
38
|
+
- \`Lanxi-WenKai\`:内置文楷,系统楷体不可用或需要统一字形时使用。
|
|
39
|
+
- 也可以直接写系统字体族名(如 \`PingFang SC\`、\`Songti SC\`、\`Microsoft YaHei\`、\`SimSun\`、\`Menlo\`、\`Consolas\`),但必须同时给出通用兜底,例如 \`font-family:'Songti SC',SimSun,serif\`;不确定时优先用上面的 \`Vcp-*\` 别名。
|
|
40
|
+
- 不要在卡片里重复声明 \`@font-face\` 或引用外部字体服务;宿主已经提供上述字体。`;
|
|
36
41
|
if (styleSlug && styleSlug !== "auto") {
|
|
37
42
|
const styleHints = {
|
|
38
43
|
"porcelain-data": "【当前指定风格:青瓷数据 (porcelain-data)】冷调青瓷蓝灰为主色,明度映射数值,网格清晰克制,适合数据看板与时序推导。",
|
|
39
44
|
"editorial-minimal": "【当前指定风格:极简杂志 (editorial-minimal)】高对比度衬线大标题、宽裕留白、商务精装杂志版式,突出权威与沉静。",
|
|
40
|
-
"warm-minimal": "【当前指定风格:暖调极简 (warm-minimal)
|
|
45
|
+
"warm-minimal": "【当前指定风格:暖调极简 (warm-minimal)】暖米白无彩色纸质底色,`Vcp-Serif` 标题搭配 `Vcp-Sans` 正文,微阴影与优雅留白。",
|
|
41
46
|
"ink-letter": "【当前指定风格:笺信书札 (ink-letter)】宣纸信笺质感,水墨色系,将数据以书信与随札的形式抒写,叙事与事实并重。",
|
|
42
47
|
"wabi-sabi": "【当前指定风格:侘寂留白 (wabi-sabi)】不对称枯寂纸感,天然留白与残缺美,适合散文随笔与诗意文字。",
|
|
43
48
|
"cyberpunk-neon": "【当前指定风格:赛博朋克 (cyberpunk-neon)】深色暗底,高亮荧光霓虹色,HUD 网格与等宽代码,适合极客与科技内容。",
|
|
44
49
|
"wire-news": "【当前指定风格:电讯报刊 (wire-news)】报刊网格排版,单点警示红,灰阶承载主干,适合快讯、榜单速递与要点汇编。",
|
|
45
50
|
"pop-flat": "【当前指定风格:波普色块 (pop-flat)】高饱和几何撞色,扁平明亮,适合活泼年轻化的消费与内容呈现。",
|
|
46
|
-
"brutalism": "【当前指定风格:粗野主义 (brutalism)
|
|
51
|
+
"brutalism": "【当前指定风格:粗野主义 (brutalism)】直角硬阴影,粗黑描边,超大字号对比(靠字号而非字重),凸显先锋与力量感。",
|
|
47
52
|
"y2k-glass": "【当前指定风格:透光玻璃 (y2k-glass)】未来复古毛玻璃拟态,高饱和渐变光晕与半透明描边,适合时尚与创意展示。",
|
|
48
53
|
};
|
|
49
54
|
const hint = styleHints[styleSlug];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Only confirmed edit/write results belong to a turn. Never infer ownership from Git.
|
|
2
|
+
export function summarizeTurnFileEdits(input) {
|
|
3
|
+
const files = input.files.filter(file => file.path).sort((a, b) => a.display.localeCompare(b.display));
|
|
4
|
+
if (files.length === 0)
|
|
5
|
+
return undefined;
|
|
6
|
+
return {
|
|
7
|
+
sessionId: input.sessionId,
|
|
8
|
+
turnId: input.turnId,
|
|
9
|
+
...(input.turnNumber === undefined ? {} : { turnNumber: input.turnNumber }),
|
|
10
|
+
files,
|
|
11
|
+
total: files.length,
|
|
12
|
+
added: files.reduce((sum, file) => sum + file.added, 0),
|
|
13
|
+
deleted: files.reduce((sum, file) => sum + file.deleted, 0),
|
|
14
|
+
source: "tool-events",
|
|
15
|
+
...(input.failedTurn ? { failedTurn: true } : {}),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -6,7 +6,7 @@ import { readInitRuntimeActivity } from "../observability/init-runtime-activity.
|
|
|
6
6
|
import { performConsoleUpdateAndInit, } from "./console-update-and-init.js";
|
|
7
7
|
import { isOperationOccupied, } from "../../infrastructure/console/operation-store.js";
|
|
8
8
|
export function createConsoleUpdateExecutor(input) {
|
|
9
|
-
return async (channel, operationId, progress) => {
|
|
9
|
+
return async (channel, operationId, progress, acknowledgeInterruption = false) => {
|
|
10
10
|
const currentVersion = readPackageVersion(input.packageRoot);
|
|
11
11
|
if (!currentVersion) {
|
|
12
12
|
return {
|
|
@@ -28,6 +28,10 @@ export function createConsoleUpdateExecutor(input) {
|
|
|
28
28
|
return performConsoleUpdateAndInit({
|
|
29
29
|
currentVersion,
|
|
30
30
|
preflight: async () => {
|
|
31
|
+
// An explicit human confirmation covers known and unobservable
|
|
32
|
+
// activity across workspaces. Never cache it for later updates.
|
|
33
|
+
if (acknowledgeInterruption === true)
|
|
34
|
+
return { ok: true };
|
|
31
35
|
const scopes = (await input.workspaceActivity?.()) ??
|
|
32
36
|
(input.operations
|
|
33
37
|
? [{ repoRoot: input.repoRoot, operations: input.operations }]
|
|
@@ -793,7 +793,7 @@ function contextTransferSettledObserver(ctx, action, actionParams) {
|
|
|
793
793
|
}).catch(() => undefined);
|
|
794
794
|
};
|
|
795
795
|
}
|
|
796
|
-
export async function acceptConsoleUpdateAndInit(ctx, clientRequestId, channel) {
|
|
796
|
+
export async function acceptConsoleUpdateAndInit(ctx, clientRequestId, channel, acknowledgeInterruption = false) {
|
|
797
797
|
if (!ctx.consoleUpdateExecutor) {
|
|
798
798
|
return {
|
|
799
799
|
kind: "error",
|
|
@@ -809,7 +809,7 @@ export async function acceptConsoleUpdateAndInit(ctx, clientRequestId, channel)
|
|
|
809
809
|
const created = await ctx.operations.create({
|
|
810
810
|
clientRequestId,
|
|
811
811
|
action: "consoleUpdateAndInit",
|
|
812
|
-
actionParams: { channel },
|
|
812
|
+
actionParams: { channel, ...(acknowledgeInterruption ? { acknowledgeInterruption: true } : {}) },
|
|
813
813
|
});
|
|
814
814
|
if (created.kind === "conflict") {
|
|
815
815
|
return {
|
|
@@ -857,7 +857,7 @@ export async function acceptConsoleUpdateAndInit(ctx, clientRequestId, channel)
|
|
|
857
857
|
message: progress.message,
|
|
858
858
|
data: { progress },
|
|
859
859
|
});
|
|
860
|
-
});
|
|
860
|
+
}, acknowledgeInterruption);
|
|
861
861
|
const state = result.state;
|
|
862
862
|
const next = await ctx.operations.update(operationId, {
|
|
863
863
|
state,
|
|
@@ -1081,14 +1081,15 @@ export async function dispatchOperatorAction(ctx, req) {
|
|
|
1081
1081
|
if (!req.clientRequestId?.trim()) {
|
|
1082
1082
|
return invalid(action, "clientRequestId is required");
|
|
1083
1083
|
}
|
|
1084
|
-
if (Object.keys(p).some((key) => key !== "channel")
|
|
1085
|
-
|
|
1084
|
+
if (Object.keys(p).some((key) => key !== "channel" && key !== "acknowledgeInterruption") ||
|
|
1085
|
+
(p.acknowledgeInterruption !== undefined && typeof p.acknowledgeInterruption !== "boolean")) {
|
|
1086
|
+
return invalid(action, "channel and boolean acknowledgeInterruption may be provided");
|
|
1086
1087
|
}
|
|
1087
1088
|
const channel = p.channel ?? "latest";
|
|
1088
1089
|
if (channel !== "latest" && channel !== "next") {
|
|
1089
1090
|
return invalid(action, "channel must be latest or next");
|
|
1090
1091
|
}
|
|
1091
|
-
return acceptConsoleUpdateAndInit(ctx, req.clientRequestId, channel);
|
|
1092
|
+
return acceptConsoleUpdateAndInit(ctx, req.clientRequestId, channel, p.acknowledgeInterruption === true);
|
|
1092
1093
|
}
|
|
1093
1094
|
if (["prepareScheduledTask", "prepareScheduledGoal", "confirmScheduledGoal", "scheduledGoalGet", "scheduledGoalList", "cancelScheduledGoal"].includes(action)) {
|
|
1094
1095
|
try {
|
|
@@ -137,9 +137,13 @@ const CONTEXT_TRANSFER_CODE_COPY = [
|
|
|
137
137
|
pattern: /\bUPDATE_LOCKED\b/,
|
|
138
138
|
copy: "另一个 loop-agent 更新正在进行(UPDATE_LOCKED),请等待其结束后重试。",
|
|
139
139
|
},
|
|
140
|
+
{ pattern: /\binstall-timeout\b/, copy: "新版本安装超时。下载依赖或安装耗时超过上限;可重试更新。若反复出现,请检查 npm 日志。" },
|
|
141
|
+
{ pattern: /\binstall-permission-denied\b/, copy: "安装目录权限不足。请检查 npm 全局安装目录的权限后重试。" },
|
|
142
|
+
{ pattern: /\binstall-disk-full\b/, copy: "磁盘空间不足,无法安装新版本。请释放空间后重试。" },
|
|
143
|
+
{ pattern: /\binstall-network-failed\b/, copy: "安装时网络连接失败。请检查 npm 使用的网络与 registry 后重试;Console 代理设置不控制 npm。" },
|
|
140
144
|
{
|
|
141
145
|
pattern: /\bINSTALL_FAILED\b/,
|
|
142
|
-
copy: "新版本安装失败(INSTALL_FAILED
|
|
146
|
+
copy: "新版本安装失败(INSTALL_FAILED)。可重试更新;若仍失败,请查看 npm 日志确认原因。",
|
|
143
147
|
},
|
|
144
148
|
{
|
|
145
149
|
pattern: /\bINSTALL_VERIFICATION_FAILED\b/,
|