@linghun/tui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/dist/agent-completion-finalizer.d.ts +31 -0
- package/dist/agent-completion-finalizer.d.ts.map +1 -0
- package/dist/agent-completion-finalizer.js +20 -0
- package/dist/agent-handoff-safety.d.ts +13 -0
- package/dist/agent-handoff-safety.d.ts.map +1 -0
- package/dist/agent-handoff-safety.js +43 -0
- package/dist/agent-workflow-registry.d.ts +45 -0
- package/dist/agent-workflow-registry.d.ts.map +1 -0
- package/dist/agent-workflow-registry.js +12 -0
- package/dist/architecture-boundary.d.ts +151 -0
- package/dist/architecture-boundary.d.ts.map +1 -0
- package/dist/architecture-boundary.js +24 -0
- package/dist/architecture-runtime.d.ts +56 -0
- package/dist/architecture-runtime.d.ts.map +1 -0
- package/dist/architecture-runtime.js +18 -0
- package/dist/background-control-runtime.d.ts +29 -0
- package/dist/background-control-runtime.d.ts.map +1 -0
- package/dist/background-control-runtime.js +148 -0
- package/dist/bash-subcommand-parser.d.ts +34 -0
- package/dist/bash-subcommand-parser.d.ts.map +1 -0
- package/dist/bash-subcommand-parser.js +8 -0
- package/dist/batch-tool-confirmation.d.ts +18 -0
- package/dist/batch-tool-confirmation.d.ts.map +1 -0
- package/dist/batch-tool-confirmation.js +100 -0
- package/dist/break-cache-runtime.d.ts +40 -0
- package/dist/break-cache-runtime.d.ts.map +1 -0
- package/dist/break-cache-runtime.js +17 -0
- package/dist/btw-runtime.d.ts +45 -0
- package/dist/btw-runtime.d.ts.map +1 -0
- package/dist/btw-runtime.js +14 -0
- package/dist/cache-command-runtime.d.ts +22 -0
- package/dist/cache-command-runtime.d.ts.map +1 -0
- package/dist/cache-command-runtime.js +33 -0
- package/dist/cache-freshness.d.ts +26 -0
- package/dist/cache-freshness.d.ts.map +1 -0
- package/dist/cache-freshness.js +14 -0
- package/dist/capability-runtime.d.ts +75 -0
- package/dist/capability-runtime.d.ts.map +1 -0
- package/dist/capability-runtime.js +97 -0
- package/dist/chunk-2FVEKTKN.js +86 -0
- package/dist/chunk-2YL5VKJ5.js +531 -0
- package/dist/chunk-3AKXDMVS.js +85 -0
- package/dist/chunk-3GCIXKCI.js +221 -0
- package/dist/chunk-3LT6OWQ2.js +258 -0
- package/dist/chunk-3XNUDLOM.js +91 -0
- package/dist/chunk-4EIC5BCT.js +475 -0
- package/dist/chunk-4EP3TUFF.js +238 -0
- package/dist/chunk-4I2NWBOM.js +117 -0
- package/dist/chunk-4K6UB524.js +443 -0
- package/dist/chunk-4T5DJW54.js +88 -0
- package/dist/chunk-4WHZ6JKD.js +8105 -0
- package/dist/chunk-5H7RRF7C.js +6 -0
- package/dist/chunk-64MJP6FK.js +558 -0
- package/dist/chunk-66BNE332.js +1617 -0
- package/dist/chunk-6CI6TKLN.js +50 -0
- package/dist/chunk-6RJVTUWI.js +16 -0
- package/dist/chunk-6SMM5CMP.js +100 -0
- package/dist/chunk-6USL33ZO.js +289 -0
- package/dist/chunk-7ZE5JFAZ.js +760 -0
- package/dist/chunk-AKPXMCVF.js +1373 -0
- package/dist/chunk-AO4CXI37.js +284 -0
- package/dist/chunk-APJIC2O5.js +150 -0
- package/dist/chunk-B4GQTZMT.js +607 -0
- package/dist/chunk-BFVPLGAC.js +93 -0
- package/dist/chunk-BOV4K7FP.js +588 -0
- package/dist/chunk-CFMSB6ST.js +59 -0
- package/dist/chunk-CFXB5SE5.js +502 -0
- package/dist/chunk-CRQORMFF.js +32 -0
- package/dist/chunk-CRSLDQOA.js +146 -0
- package/dist/chunk-CRW3636S.js +214 -0
- package/dist/chunk-D3UTL2QX.js +86 -0
- package/dist/chunk-D7TCSOAZ.js +331 -0
- package/dist/chunk-DDXS2RDZ.js +228 -0
- package/dist/chunk-DICVLZHH.js +144 -0
- package/dist/chunk-DNQN74CC.js +1186 -0
- package/dist/chunk-DTK5NBTV.js +912 -0
- package/dist/chunk-E72U7WW7.js +50 -0
- package/dist/chunk-EBACIBJP.js +356 -0
- package/dist/chunk-ECFLCY5V.js +530 -0
- package/dist/chunk-EORRZP3F.js +109 -0
- package/dist/chunk-F43AMWLZ.js +115 -0
- package/dist/chunk-F46N43MG.js +56 -0
- package/dist/chunk-F6TVBCZV.js +51 -0
- package/dist/chunk-FRIMDSRU.js +242 -0
- package/dist/chunk-FTAEPAVY.js +314 -0
- package/dist/chunk-GC55DMZV.js +156 -0
- package/dist/chunk-GCMH5P4W.js +422 -0
- package/dist/chunk-GDQQNPBP.js +251 -0
- package/dist/chunk-GKZYTPN2.js +279 -0
- package/dist/chunk-GLWTWEGX.js +272 -0
- package/dist/chunk-GMUCSNUD.js +586 -0
- package/dist/chunk-GTP2KPLY.js +167 -0
- package/dist/chunk-GW5YDCRZ.js +42 -0
- package/dist/chunk-H3T4EF5F.js +87 -0
- package/dist/chunk-HAEU6OTS.js +381 -0
- package/dist/chunk-HQIJGQYU.js +172 -0
- package/dist/chunk-HW2TBXVK.js +34 -0
- package/dist/chunk-HWD22O6F.js +94 -0
- package/dist/chunk-I3NTAIMF.js +280 -0
- package/dist/chunk-IN42UISW.js +372 -0
- package/dist/chunk-IWUIOLMF.js +82 -0
- package/dist/chunk-J7ZE2JKP.js +283 -0
- package/dist/chunk-JBLVBO3U.js +109 -0
- package/dist/chunk-JDWXC2OQ.js +800 -0
- package/dist/chunk-JGDIO2NF.js +74 -0
- package/dist/chunk-JHGWGH2C.js +182 -0
- package/dist/chunk-JLCPHVBN.js +42 -0
- package/dist/chunk-JO5ANTMR.js +6027 -0
- package/dist/chunk-JPXSFZFC.js +100 -0
- package/dist/chunk-JQCRCDOC.js +1195 -0
- package/dist/chunk-K4FSYBSY.js +41 -0
- package/dist/chunk-K56D3X7S.js +1225 -0
- package/dist/chunk-KI7C6ZOD.js +92 -0
- package/dist/chunk-KO64OFSG.js +58 -0
- package/dist/chunk-KQJHVJZB.js +227 -0
- package/dist/chunk-KTWV5JC5.js +59 -0
- package/dist/chunk-L4XXW6Y5.js +374 -0
- package/dist/chunk-L5GOCMZP.js +18 -0
- package/dist/chunk-LDABZV5V.js +278 -0
- package/dist/chunk-LHHKPGLX.js +903 -0
- package/dist/chunk-LL7LBRDL.js +60 -0
- package/dist/chunk-LQTVYUT3.js +421 -0
- package/dist/chunk-LVIM2PA7.js +663 -0
- package/dist/chunk-M4AIK2SP.js +215 -0
- package/dist/chunk-MLUIOBKL.js +420 -0
- package/dist/chunk-MOJL4X4L.js +47 -0
- package/dist/chunk-MVONSJEN.js +300 -0
- package/dist/chunk-N7G2X2LK.js +709 -0
- package/dist/chunk-NKFKOEYX.js +146 -0
- package/dist/chunk-NMNOAFFT.js +167 -0
- package/dist/chunk-NSIKYD3X.js +74 -0
- package/dist/chunk-O7EFPSMC.js +60 -0
- package/dist/chunk-O7S3HYE6.js +210 -0
- package/dist/chunk-OEYW3JE3.js +262 -0
- package/dist/chunk-OF3K3CU5.js +159 -0
- package/dist/chunk-OMZYPQVA.js +298 -0
- package/dist/chunk-OZMX3E35.js +248 -0
- package/dist/chunk-P277M7Z5.js +303 -0
- package/dist/chunk-P4CPRJLI.js +65 -0
- package/dist/chunk-PBIPV4LD.js +494 -0
- package/dist/chunk-PGNALDEH.js +2003 -0
- package/dist/chunk-PGWW3DVE.js +157 -0
- package/dist/chunk-QB4VWH7W.js +515 -0
- package/dist/chunk-QBCGAIU7.js +120 -0
- package/dist/chunk-QIU3FJPC.js +99 -0
- package/dist/chunk-QLRTQHTR.js +744 -0
- package/dist/chunk-QTDGRZMZ.js +171 -0
- package/dist/chunk-RBOQJFIZ.js +183 -0
- package/dist/chunk-RDGM4RUE.js +178 -0
- package/dist/chunk-RM5JDRCW.js +71 -0
- package/dist/chunk-RM5QMOFY.js +189 -0
- package/dist/chunk-RMLTVKOY.js +588 -0
- package/dist/chunk-RVY34HK4.js +79 -0
- package/dist/chunk-S3YWTBXL.js +43 -0
- package/dist/chunk-SJOS5PM6.js +64 -0
- package/dist/chunk-SOPYWTFV.js +90 -0
- package/dist/chunk-SQIBPLLV.js +15 -0
- package/dist/chunk-SRZIA6B4.js +136 -0
- package/dist/chunk-SYBNJZEL.js +250 -0
- package/dist/chunk-TFZEFIQT.js +17 -0
- package/dist/chunk-THZBFYAH.js +136 -0
- package/dist/chunk-TJLC3QAS.js +83 -0
- package/dist/chunk-TYF4GJR3.js +598 -0
- package/dist/chunk-UDQT5CWK.js +252 -0
- package/dist/chunk-UOHZQIVL.js +168 -0
- package/dist/chunk-URNQUECO.js +187 -0
- package/dist/chunk-UT2TYK2A.js +148 -0
- package/dist/chunk-UT5BOJKU.js +190 -0
- package/dist/chunk-V7GDHHBL.js +526 -0
- package/dist/chunk-VCSRBS47.js +133 -0
- package/dist/chunk-VIBENDE3.js +152 -0
- package/dist/chunk-VTQL23UM.js +302 -0
- package/dist/chunk-W3KHJNSH.js +281 -0
- package/dist/chunk-W6NU7ZAV.js +52 -0
- package/dist/chunk-WHFDDZHY.js +407 -0
- package/dist/chunk-WJWYRBWH.js +48 -0
- package/dist/chunk-WKMBK5UP.js +145 -0
- package/dist/chunk-WQMSRO4D.js +489 -0
- package/dist/chunk-WV6YJGZR.js +81 -0
- package/dist/chunk-WVAQYKGL.js +269 -0
- package/dist/chunk-X7A22JHP.js +106 -0
- package/dist/chunk-XFPNU42I.js +59 -0
- package/dist/chunk-YH6UIHNF.js +161 -0
- package/dist/chunk-YPQFSFYK.js +19 -0
- package/dist/chunk-YTQFOZRZ.js +110 -0
- package/dist/chunk-ZJK25VFP.js +506 -0
- package/dist/chunk-ZOSK2UEU.js +1555 -0
- package/dist/chunk-ZYSN7AWW.js +336 -0
- package/dist/chunk-ZZ2CNCXJ.js +282 -0
- package/dist/command-panel-runtime.d.ts +33 -0
- package/dist/command-panel-runtime.d.ts.map +1 -0
- package/dist/command-panel-runtime.js +80 -0
- package/dist/compact-cache-command-runtime.d.ts +38 -0
- package/dist/compact-cache-command-runtime.d.ts.map +1 -0
- package/dist/compact-cache-command-runtime.js +146 -0
- package/dist/compact-context.d.ts +35 -0
- package/dist/compact-context.d.ts.map +1 -0
- package/dist/compact-context.js +16 -0
- package/dist/compact-preflight-runtime.d.ts +46 -0
- package/dist/compact-preflight-runtime.d.ts.map +1 -0
- package/dist/compact-preflight-runtime.js +62 -0
- package/dist/connector-runtime.d.ts +72 -0
- package/dist/connector-runtime.d.ts.map +1 -0
- package/dist/connector-runtime.js +88 -0
- package/dist/context-estimator.d.ts +20 -0
- package/dist/context-estimator.d.ts.map +1 -0
- package/dist/context-estimator.js +18 -0
- package/dist/context-window-runtime.d.ts +12 -0
- package/dist/context-window-runtime.d.ts.map +1 -0
- package/dist/context-window-runtime.js +10 -0
- package/dist/deep-compact-runtime.d.ts +53 -0
- package/dist/deep-compact-runtime.d.ts.map +1 -0
- package/dist/deep-compact-runtime.js +35 -0
- package/dist/deferred-tools-catalog.d.ts +52 -0
- package/dist/deferred-tools-catalog.d.ts.map +1 -0
- package/dist/deferred-tools-catalog.js +42 -0
- package/dist/details-status-runtime.d.ts +48 -0
- package/dist/details-status-runtime.d.ts.map +1 -0
- package/dist/details-status-runtime.js +102 -0
- package/dist/evidence-runtime.d.ts +48 -0
- package/dist/evidence-runtime.d.ts.map +1 -0
- package/dist/evidence-runtime.js +92 -0
- package/dist/extension-command-runtime.d.ts +63 -0
- package/dist/extension-command-runtime.d.ts.map +1 -0
- package/dist/extension-command-runtime.js +67 -0
- package/dist/extension-slash-runtime.d.ts +11 -0
- package/dist/extension-slash-runtime.d.ts.map +1 -0
- package/dist/extension-slash-runtime.js +79 -0
- package/dist/external-editor-runtime.d.ts +32 -0
- package/dist/external-editor-runtime.d.ts.map +1 -0
- package/dist/external-editor-runtime.js +71 -0
- package/dist/failure-learning-command-runtime.d.ts +10 -0
- package/dist/failure-learning-command-runtime.d.ts.map +1 -0
- package/dist/failure-learning-command-runtime.js +78 -0
- package/dist/failure-learning-presenter.d.ts +6 -0
- package/dist/failure-learning-presenter.d.ts.map +1 -0
- package/dist/failure-learning-presenter.js +12 -0
- package/dist/failure-learning-runtime.d.ts +39 -0
- package/dist/failure-learning-runtime.d.ts.map +1 -0
- package/dist/failure-learning-runtime.js +39 -0
- package/dist/feature-flag-runtime.d.ts +8 -0
- package/dist/feature-flag-runtime.d.ts.map +1 -0
- package/dist/feature-flag-runtime.js +12 -0
- package/dist/feishu-long-connection-runtime.d.ts +12 -0
- package/dist/feishu-long-connection-runtime.d.ts.map +1 -0
- package/dist/feishu-long-connection-runtime.js +7 -0
- package/dist/final-answer-gate.d.ts +24 -0
- package/dist/final-answer-gate.d.ts.map +1 -0
- package/dist/final-answer-gate.js +26 -0
- package/dist/ghost-text.d.ts +16 -0
- package/dist/ghost-text.d.ts.map +1 -0
- package/dist/ghost-text.js +8 -0
- package/dist/git-branch-runtime.d.ts +14 -0
- package/dist/git-branch-runtime.d.ts.map +1 -0
- package/dist/git-branch-runtime.js +68 -0
- package/dist/git-command-runtime.d.ts +22 -0
- package/dist/git-command-runtime.d.ts.map +1 -0
- package/dist/git-command-runtime.js +89 -0
- package/dist/git-operation-runtime.d.ts +188 -0
- package/dist/git-operation-runtime.d.ts.map +1 -0
- package/dist/git-operation-runtime.js +45 -0
- package/dist/git-runtime.d.ts +113 -0
- package/dist/git-runtime.d.ts.map +1 -0
- package/dist/git-runtime.js +16 -0
- package/dist/git-slash-runtime.d.ts +38 -0
- package/dist/git-slash-runtime.d.ts.map +1 -0
- package/dist/git-slash-runtime.js +18 -0
- package/dist/git-tool-dispatch-runtime.d.ts +108 -0
- package/dist/git-tool-dispatch-runtime.d.ts.map +1 -0
- package/dist/git-tool-dispatch-runtime.js +25 -0
- package/dist/git-tool-runtime.d.ts +64 -0
- package/dist/git-tool-runtime.d.ts.map +1 -0
- package/dist/git-tool-runtime.js +36 -0
- package/dist/guard-wiring.d.ts +67 -0
- package/dist/guard-wiring.d.ts.map +1 -0
- package/dist/guard-wiring.js +21 -0
- package/dist/handoff-session-runtime.d.ts +11 -0
- package/dist/handoff-session-runtime.d.ts.map +1 -0
- package/dist/handoff-session-runtime.js +36 -0
- package/dist/index-result-presenter.d.ts +14 -0
- package/dist/index-result-presenter.d.ts.map +1 -0
- package/dist/index-result-presenter.js +28 -0
- package/dist/index-runtime.d.ts +64 -0
- package/dist/index-runtime.d.ts.map +1 -0
- package/dist/index-runtime.js +28 -0
- package/dist/index-tool-runtime.d.ts +44 -0
- package/dist/index-tool-runtime.d.ts.map +1 -0
- package/dist/index-tool-runtime.js +24 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2346 -0
- package/dist/job-agent-command-runtime.d.ts +127 -0
- package/dist/job-agent-command-runtime.d.ts.map +1 -0
- package/dist/job-agent-command-runtime.js +138 -0
- package/dist/job-runner-presenter.d.ts +32 -0
- package/dist/job-runner-presenter.d.ts.map +1 -0
- package/dist/job-runner-presenter.js +30 -0
- package/dist/job-runtime.d.ts +65 -0
- package/dist/job-runtime.d.ts.map +1 -0
- package/dist/job-runtime.js +88 -0
- package/dist/keybinding-runtime.d.ts +29 -0
- package/dist/keybinding-runtime.d.ts.map +1 -0
- package/dist/keybinding-runtime.js +14 -0
- package/dist/log-artifact.d.ts +55 -0
- package/dist/log-artifact.d.ts.map +1 -0
- package/dist/log-artifact.js +10 -0
- package/dist/mcp-index-command-runtime.d.ts +21 -0
- package/dist/mcp-index-command-runtime.d.ts.map +1 -0
- package/dist/mcp-index-command-runtime.js +18 -0
- package/dist/mcp-index-runtime.d.ts +106 -0
- package/dist/mcp-index-runtime.d.ts.map +1 -0
- package/dist/mcp-index-runtime.js +142 -0
- package/dist/mcp-sse-runtime.d.ts +13 -0
- package/dist/mcp-sse-runtime.d.ts.map +1 -0
- package/dist/mcp-sse-runtime.js +8 -0
- package/dist/mcp-stdio-runtime.d.ts +37 -0
- package/dist/mcp-stdio-runtime.d.ts.map +1 -0
- package/dist/mcp-stdio-runtime.js +15 -0
- package/dist/memory-command-runtime.d.ts +37 -0
- package/dist/memory-command-runtime.d.ts.map +1 -0
- package/dist/memory-command-runtime.js +88 -0
- package/dist/memory-eviction-runtime.d.ts +7 -0
- package/dist/memory-eviction-runtime.d.ts.map +1 -0
- package/dist/memory-eviction-runtime.js +12 -0
- package/dist/memory-extraction-runtime.d.ts +40 -0
- package/dist/memory-extraction-runtime.d.ts.map +1 -0
- package/dist/memory-extraction-runtime.js +20 -0
- package/dist/memory-rules-runtime.d.ts +15 -0
- package/dist/memory-rules-runtime.d.ts.map +1 -0
- package/dist/memory-rules-runtime.js +14 -0
- package/dist/meta-scheduler-complexity.d.ts +16 -0
- package/dist/meta-scheduler-complexity.d.ts.map +1 -0
- package/dist/meta-scheduler-complexity.js +37 -0
- package/dist/meta-scheduler-runtime.d.ts +288 -0
- package/dist/meta-scheduler-runtime.d.ts.map +1 -0
- package/dist/meta-scheduler-runtime.js +17 -0
- package/dist/model-command-runtime.d.ts +12 -0
- package/dist/model-command-runtime.d.ts.map +1 -0
- package/dist/model-command-runtime.js +84 -0
- package/dist/model-doctor-runtime.d.ts +81 -0
- package/dist/model-doctor-runtime.d.ts.map +1 -0
- package/dist/model-doctor-runtime.js +46 -0
- package/dist/model-loop-runtime.d.ts +189 -0
- package/dist/model-loop-runtime.d.ts.map +1 -0
- package/dist/model-loop-runtime.js +141 -0
- package/dist/model-prompt-runtime.d.ts +25 -0
- package/dist/model-prompt-runtime.d.ts.map +1 -0
- package/dist/model-prompt-runtime.js +33 -0
- package/dist/model-setup-runtime.d.ts +28 -0
- package/dist/model-setup-runtime.d.ts.map +1 -0
- package/dist/model-setup-runtime.js +26 -0
- package/dist/model-stream-runtime.d.ts +47 -0
- package/dist/model-stream-runtime.d.ts.map +1 -0
- package/dist/model-stream-runtime.js +136 -0
- package/dist/model-tool-runtime.d.ts +114 -0
- package/dist/model-tool-runtime.d.ts.map +1 -0
- package/dist/model-tool-runtime.js +144 -0
- package/dist/natural-command-bridge.d.ts +158 -0
- package/dist/natural-command-bridge.d.ts.map +1 -0
- package/dist/natural-command-bridge.js +36 -0
- package/dist/pending-details-presenter.d.ts +8 -0
- package/dist/pending-details-presenter.d.ts.map +1 -0
- package/dist/pending-details-presenter.js +12 -0
- package/dist/permission-approval-runtime.d.ts +28 -0
- package/dist/permission-approval-runtime.d.ts.map +1 -0
- package/dist/permission-approval-runtime.js +136 -0
- package/dist/permission-continuation-runtime.d.ts +90 -0
- package/dist/permission-continuation-runtime.d.ts.map +1 -0
- package/dist/permission-continuation-runtime.js +68 -0
- package/dist/permission-policy-engine.d.ts +51 -0
- package/dist/permission-policy-engine.d.ts.map +1 -0
- package/dist/permission-policy-engine.js +12 -0
- package/dist/permission-presenter.d.ts +13 -0
- package/dist/permission-presenter.d.ts.map +1 -0
- package/dist/permission-presenter.js +8 -0
- package/dist/persistent-history.d.ts +18 -0
- package/dist/persistent-history.d.ts.map +1 -0
- package/dist/persistent-history.js +126 -0
- package/dist/platform-security.d.ts +4 -0
- package/dist/platform-security.d.ts.map +1 -0
- package/dist/platform-security.js +10 -0
- package/dist/process-command-runtime.d.ts +9 -0
- package/dist/process-command-runtime.d.ts.map +1 -0
- package/dist/process-command-runtime.js +11 -0
- package/dist/process-guard.d.ts +56 -0
- package/dist/process-guard.d.ts.map +1 -0
- package/dist/process-guard.js +22 -0
- package/dist/prompt-command-runtime.d.ts +12 -0
- package/dist/prompt-command-runtime.d.ts.map +1 -0
- package/dist/prompt-command-runtime.js +10 -0
- package/dist/prompt-stash.d.ts +15 -0
- package/dist/prompt-stash.d.ts.map +1 -0
- package/dist/prompt-stash.js +8 -0
- package/dist/provider-circuit-breaker.d.ts +132 -0
- package/dist/provider-circuit-breaker.d.ts.map +1 -0
- package/dist/provider-circuit-breaker.js +31 -0
- package/dist/provider-loop-runtime.d.ts +18 -0
- package/dist/provider-loop-runtime.d.ts.map +1 -0
- package/dist/provider-loop-runtime.js +16 -0
- package/dist/remote-command-runtime.d.ts +47 -0
- package/dist/remote-command-runtime.d.ts.map +1 -0
- package/dist/remote-command-runtime.js +125 -0
- package/dist/remote-inbound-bridge-runtime.d.ts +152 -0
- package/dist/remote-inbound-bridge-runtime.d.ts.map +1 -0
- package/dist/remote-inbound-bridge-runtime.js +44 -0
- package/dist/remote-mcp-presenter.d.ts +5 -0
- package/dist/remote-mcp-presenter.d.ts.map +1 -0
- package/dist/remote-mcp-presenter.js +10 -0
- package/dist/remote-repl-bridge-runtime.d.ts +134 -0
- package/dist/remote-repl-bridge-runtime.d.ts.map +1 -0
- package/dist/remote-repl-bridge-runtime.js +20 -0
- package/dist/remote-transport.d.ts +50 -0
- package/dist/remote-transport.d.ts.map +1 -0
- package/dist/remote-transport.js +14 -0
- package/dist/request-lifecycle-presenter.d.ts +25 -0
- package/dist/request-lifecycle-presenter.d.ts.map +1 -0
- package/dist/request-lifecycle-presenter.js +22 -0
- package/dist/runner-runtime.d.ts +41 -0
- package/dist/runner-runtime.d.ts.map +1 -0
- package/dist/runner-runtime.js +35 -0
- package/dist/runtime-budget.d.ts +38 -0
- package/dist/runtime-budget.d.ts.map +1 -0
- package/dist/runtime-budget.js +78 -0
- package/dist/runtime-path-marker.d.ts +112 -0
- package/dist/runtime-path-marker.d.ts.map +1 -0
- package/dist/runtime-path-marker.js +18 -0
- package/dist/runtime-status-presenter.d.ts +22 -0
- package/dist/runtime-status-presenter.d.ts.map +1 -0
- package/dist/runtime-status-presenter.js +15 -0
- package/dist/runtime-status-snapshot.d.ts +52 -0
- package/dist/runtime-status-snapshot.d.ts.map +1 -0
- package/dist/runtime-status-snapshot.js +11 -0
- package/dist/runtime-utils.d.ts +2 -0
- package/dist/runtime-utils.d.ts.map +1 -0
- package/dist/runtime-utils.js +6 -0
- package/dist/shell/clipboard.d.ts +23 -0
- package/dist/shell/clipboard.d.ts.map +1 -0
- package/dist/shell/clipboard.js +8 -0
- package/dist/shell/components/AgentProgressTree.d.ts +9 -0
- package/dist/shell/components/AgentProgressTree.d.ts.map +1 -0
- package/dist/shell/components/AgentProgressTree.js +9 -0
- package/dist/shell/components/BackgroundTaskOverlay.d.ts +8 -0
- package/dist/shell/components/BackgroundTaskOverlay.d.ts.map +1 -0
- package/dist/shell/components/BackgroundTaskOverlay.js +8 -0
- package/dist/shell/components/BtwPanel.d.ts +16 -0
- package/dist/shell/components/BtwPanel.d.ts.map +1 -0
- package/dist/shell/components/BtwPanel.js +8 -0
- package/dist/shell/components/CommandPanel.d.ts +11 -0
- package/dist/shell/components/CommandPanel.d.ts.map +1 -0
- package/dist/shell/components/CommandPanel.js +8 -0
- package/dist/shell/components/Composer.d.ts +187 -0
- package/dist/shell/components/Composer.d.ts.map +1 -0
- package/dist/shell/components/Composer.js +99 -0
- package/dist/shell/components/ConfigPanel.d.ts +11 -0
- package/dist/shell/components/ConfigPanel.d.ts.map +1 -0
- package/dist/shell/components/ConfigPanel.js +8 -0
- package/dist/shell/components/CtrlOToExpand.d.ts +30 -0
- package/dist/shell/components/CtrlOToExpand.d.ts.map +1 -0
- package/dist/shell/components/CtrlOToExpand.js +16 -0
- package/dist/shell/components/HelpPanel.d.ts +19 -0
- package/dist/shell/components/HelpPanel.d.ts.map +1 -0
- package/dist/shell/components/HelpPanel.js +8 -0
- package/dist/shell/components/HistorySearchPanel.d.ts +14 -0
- package/dist/shell/components/HistorySearchPanel.d.ts.map +1 -0
- package/dist/shell/components/HistorySearchPanel.js +104 -0
- package/dist/shell/components/MessageMarkdown.d.ts +34 -0
- package/dist/shell/components/MessageMarkdown.d.ts.map +1 -0
- package/dist/shell/components/MessageMarkdown.js +18 -0
- package/dist/shell/components/MessageResponse.d.ts +14 -0
- package/dist/shell/components/MessageResponse.d.ts.map +1 -0
- package/dist/shell/components/MessageResponse.js +6 -0
- package/dist/shell/components/MouseInputRouter.d.ts +28 -0
- package/dist/shell/components/MouseInputRouter.d.ts.map +1 -0
- package/dist/shell/components/MouseInputRouter.js +84 -0
- package/dist/shell/components/NotificationStack.d.ts +19 -0
- package/dist/shell/components/NotificationStack.d.ts.map +1 -0
- package/dist/shell/components/NotificationStack.js +6 -0
- package/dist/shell/components/OutputLine.d.ts +19 -0
- package/dist/shell/components/OutputLine.d.ts.map +1 -0
- package/dist/shell/components/OutputLine.js +38 -0
- package/dist/shell/components/ProductBlock.d.ts +10 -0
- package/dist/shell/components/ProductBlock.d.ts.map +1 -0
- package/dist/shell/components/ProductBlock.js +12 -0
- package/dist/shell/components/ScrollViewport.d.ts +43 -0
- package/dist/shell/components/ScrollViewport.d.ts.map +1 -0
- package/dist/shell/components/ScrollViewport.js +86 -0
- package/dist/shell/components/SessionsPanel.d.ts +24 -0
- package/dist/shell/components/SessionsPanel.d.ts.map +1 -0
- package/dist/shell/components/SessionsPanel.js +8 -0
- package/dist/shell/components/ShellApp.d.ts +8 -0
- package/dist/shell/components/ShellApp.d.ts.map +1 -0
- package/dist/shell/components/ShellApp.js +45 -0
- package/dist/shell/components/ShortcutPanel.d.ts +14 -0
- package/dist/shell/components/ShortcutPanel.d.ts.map +1 -0
- package/dist/shell/components/ShortcutPanel.js +59 -0
- package/dist/shell/components/SlashSuggestions.d.ts +24 -0
- package/dist/shell/components/SlashSuggestions.d.ts.map +1 -0
- package/dist/shell/components/SlashSuggestions.js +7 -0
- package/dist/shell/components/StatusFooter.d.ts +30 -0
- package/dist/shell/components/StatusFooter.d.ts.map +1 -0
- package/dist/shell/components/StatusFooter.js +7 -0
- package/dist/shell/components/StatusTray.d.ts +9 -0
- package/dist/shell/components/StatusTray.d.ts.map +1 -0
- package/dist/shell/components/StatusTray.js +6 -0
- package/dist/shell/components/StructuredDiff.d.ts +9 -0
- package/dist/shell/components/StructuredDiff.d.ts.map +1 -0
- package/dist/shell/components/StructuredDiff.js +7 -0
- package/dist/shell/components/TaskListView.d.ts +9 -0
- package/dist/shell/components/TaskListView.d.ts.map +1 -0
- package/dist/shell/components/TaskListView.js +9 -0
- package/dist/shell/components/TaskSuggestionBar.d.ts +15 -0
- package/dist/shell/components/TaskSuggestionBar.d.ts.map +1 -0
- package/dist/shell/components/TaskSuggestionBar.js +8 -0
- package/dist/shell/components/UnseenMessagePill.d.ts +12 -0
- package/dist/shell/components/UnseenMessagePill.d.ts.map +1 -0
- package/dist/shell/components/UnseenMessagePill.js +6 -0
- package/dist/shell/components/WorkflowProgressView.d.ts +9 -0
- package/dist/shell/components/WorkflowProgressView.d.ts.map +1 -0
- package/dist/shell/components/WorkflowProgressView.js +9 -0
- package/dist/shell/components/useAnchoredCursor.d.ts +32 -0
- package/dist/shell/components/useAnchoredCursor.d.ts.map +1 -0
- package/dist/shell/components/useAnchoredCursor.js +6 -0
- package/dist/shell/hooks/useRenderThrottle.d.ts +2 -0
- package/dist/shell/hooks/useRenderThrottle.d.ts.map +1 -0
- package/dist/shell/hooks/useRenderThrottle.js +35 -0
- package/dist/shell/hooks/useScrollBatcher.d.ts +10 -0
- package/dist/shell/hooks/useScrollBatcher.d.ts.map +1 -0
- package/dist/shell/hooks/useScrollBatcher.js +23 -0
- package/dist/shell/hooks/useScrollRuntime.d.ts +2 -0
- package/dist/shell/hooks/useScrollRuntime.d.ts.map +1 -0
- package/dist/shell/hooks/useScrollRuntime.js +6 -0
- package/dist/shell/hyperlink-utils.d.ts +18 -0
- package/dist/shell/hyperlink-utils.d.ts.map +1 -0
- package/dist/shell/hyperlink-utils.js +8 -0
- package/dist/shell/ink-renderer.d.ts +18 -0
- package/dist/shell/ink-renderer.d.ts.map +1 -0
- package/dist/shell/ink-renderer.js +54 -0
- package/dist/shell/models/command-transcript-presenter.d.ts +73 -0
- package/dist/shell/models/command-transcript-presenter.d.ts.map +1 -0
- package/dist/shell/models/command-transcript-presenter.js +26 -0
- package/dist/shell/models/help-panel.d.ts +37 -0
- package/dist/shell/models/help-panel.d.ts.map +1 -0
- package/dist/shell/models/help-panel.js +10 -0
- package/dist/shell/models/permission-elevation.d.ts +65 -0
- package/dist/shell/models/permission-elevation.d.ts.map +1 -0
- package/dist/shell/models/permission-elevation.js +10 -0
- package/dist/shell/models/permission-explanation.d.ts +45 -0
- package/dist/shell/models/permission-explanation.d.ts.map +1 -0
- package/dist/shell/models/permission-explanation.js +14 -0
- package/dist/shell/models/session-panel.d.ts +22 -0
- package/dist/shell/models/session-panel.d.ts.map +1 -0
- package/dist/shell/models/session-panel.js +18 -0
- package/dist/shell/models/task-scroll-state.d.ts +24 -0
- package/dist/shell/models/task-scroll-state.d.ts.map +1 -0
- package/dist/shell/models/task-scroll-state.js +26 -0
- package/dist/shell/models/terminal-input-runtime.d.ts +37 -0
- package/dist/shell/models/terminal-input-runtime.d.ts.map +1 -0
- package/dist/shell/models/terminal-input-runtime.js +18 -0
- package/dist/shell/models/transcript-scroll-state.d.ts +57 -0
- package/dist/shell/models/transcript-scroll-state.d.ts.map +1 -0
- package/dist/shell/models/transcript-scroll-state.js +12 -0
- package/dist/shell/models/transcript-selection-state.d.ts +39 -0
- package/dist/shell/models/transcript-selection-state.d.ts.map +1 -0
- package/dist/shell/models/transcript-selection-state.js +25 -0
- package/dist/shell/models/wheel-acceleration.d.ts +52 -0
- package/dist/shell/models/wheel-acceleration.d.ts.map +1 -0
- package/dist/shell/models/wheel-acceleration.js +6 -0
- package/dist/shell/output-utils.d.ts +22 -0
- package/dist/shell/output-utils.d.ts.map +1 -0
- package/dist/shell/output-utils.js +12 -0
- package/dist/shell/plain-renderer.d.ts +12 -0
- package/dist/shell/plain-renderer.d.ts.map +1 -0
- package/dist/shell/plain-renderer.js +13 -0
- package/dist/shell/progress-views.d.ts +10 -0
- package/dist/shell/progress-views.d.ts.map +1 -0
- package/dist/shell/progress-views.js +17 -0
- package/dist/shell/stdout-flush-barrier.d.ts +39 -0
- package/dist/shell/stdout-flush-barrier.d.ts.map +1 -0
- package/dist/shell/stdout-flush-barrier.js +10 -0
- package/dist/shell/terminal-capability.d.ts +54 -0
- package/dist/shell/terminal-capability.d.ts.map +1 -0
- package/dist/shell/terminal-capability.js +10 -0
- package/dist/shell/terminal-interaction-runtime.d.ts +11 -0
- package/dist/shell/terminal-interaction-runtime.d.ts.map +1 -0
- package/dist/shell/terminal-interaction-runtime.js +38 -0
- package/dist/shell/terminal-state-recovery.d.ts +52 -0
- package/dist/shell/terminal-state-recovery.d.ts.map +1 -0
- package/dist/shell/terminal-state-recovery.js +11 -0
- package/dist/shell/text-utils.d.ts +40 -0
- package/dist/shell/text-utils.d.ts.map +1 -0
- package/dist/shell/text-utils.js +26 -0
- package/dist/shell/theme.d.ts +41 -0
- package/dist/shell/theme.d.ts.map +1 -0
- package/dist/shell/theme.js +8 -0
- package/dist/shell/types.d.ts +784 -0
- package/dist/shell/types.d.ts.map +1 -0
- package/dist/shell/types.js +0 -0
- package/dist/shell/view-model.d.ts +82 -0
- package/dist/shell/view-model.d.ts.map +1 -0
- package/dist/shell/view-model.js +48 -0
- package/dist/slash-command-runtime.d.ts +64 -0
- package/dist/slash-command-runtime.d.ts.map +1 -0
- package/dist/slash-command-runtime.js +186 -0
- package/dist/slash-dispatch.d.ts +48 -0
- package/dist/slash-dispatch.d.ts.map +1 -0
- package/dist/slash-dispatch.js +53 -0
- package/dist/startup-runtime.d.ts +48 -0
- package/dist/startup-runtime.d.ts.map +1 -0
- package/dist/startup-runtime.js +43 -0
- package/dist/terminal-readiness-presenter.d.ts +131 -0
- package/dist/terminal-readiness-presenter.d.ts.map +1 -0
- package/dist/terminal-readiness-presenter.js +16 -0
- package/dist/terminal-readiness-runtime.d.ts +5 -0
- package/dist/terminal-readiness-runtime.d.ts.map +1 -0
- package/dist/terminal-readiness-runtime.js +15 -0
- package/dist/terminal-setup-runtime.d.ts +34 -0
- package/dist/terminal-setup-runtime.d.ts.map +1 -0
- package/dist/terminal-setup-runtime.js +257 -0
- package/dist/tool-output-presenter.d.ts +38 -0
- package/dist/tool-output-presenter.d.ts.map +1 -0
- package/dist/tool-output-presenter.js +16 -0
- package/dist/tool-result-budget.d.ts +42 -0
- package/dist/tool-result-budget.d.ts.map +1 -0
- package/dist/tool-result-budget.js +11 -0
- package/dist/tui-agent-job-runtime.d.ts +38 -0
- package/dist/tui-agent-job-runtime.d.ts.map +1 -0
- package/dist/tui-agent-job-runtime.js +86 -0
- package/dist/tui-context-runtime.d.ts +426 -0
- package/dist/tui-context-runtime.d.ts.map +1 -0
- package/dist/tui-context-runtime.js +65 -0
- package/dist/tui-data-types.d.ts +923 -0
- package/dist/tui-data-types.d.ts.map +1 -0
- package/dist/tui-data-types.js +0 -0
- package/dist/tui-details-runtime.d.ts +25 -0
- package/dist/tui-details-runtime.d.ts.map +1 -0
- package/dist/tui-details-runtime.js +29 -0
- package/dist/tui-memory-runtime.d.ts +33 -0
- package/dist/tui-memory-runtime.d.ts.map +1 -0
- package/dist/tui-memory-runtime.js +58 -0
- package/dist/tui-messages.d.ts +4 -0
- package/dist/tui-messages.d.ts.map +1 -0
- package/dist/tui-messages.js +6 -0
- package/dist/tui-model-runtime.d.ts +30 -0
- package/dist/tui-model-runtime.d.ts.map +1 -0
- package/dist/tui-model-runtime.js +39 -0
- package/dist/tui-output-surface.d.ts +141 -0
- package/dist/tui-output-surface.d.ts.map +1 -0
- package/dist/tui-output-surface.js +55 -0
- package/dist/tui-permission-runtime.d.ts +62 -0
- package/dist/tui-permission-runtime.d.ts.map +1 -0
- package/dist/tui-permission-runtime.js +24 -0
- package/dist/tui-state-runtime.d.ts +21 -0
- package/dist/tui-state-runtime.d.ts.map +1 -0
- package/dist/tui-state-runtime.js +47 -0
- package/dist/turn-continuity-runtime.d.ts +30 -0
- package/dist/turn-continuity-runtime.d.ts.map +1 -0
- package/dist/turn-continuity-runtime.js +8 -0
- package/dist/undo-ring.d.ts +16 -0
- package/dist/undo-ring.d.ts.map +1 -0
- package/dist/undo-ring.js +12 -0
- package/dist/usage-stats-presenter.d.ts +17 -0
- package/dist/usage-stats-presenter.d.ts.map +1 -0
- package/dist/usage-stats-presenter.js +22 -0
- package/dist/user-state-signal-runtime.d.ts +33 -0
- package/dist/user-state-signal-runtime.d.ts.map +1 -0
- package/dist/user-state-signal-runtime.js +8 -0
- package/dist/verification-command-runtime.d.ts +25 -0
- package/dist/verification-command-runtime.d.ts.map +1 -0
- package/dist/verification-command-runtime.js +51 -0
- package/dist/verification-level.d.ts +93 -0
- package/dist/verification-level.d.ts.map +1 -0
- package/dist/verification-level.js +18 -0
- package/dist/workflow-agent-runtime-bridge.d.ts +169 -0
- package/dist/workflow-agent-runtime-bridge.d.ts.map +1 -0
- package/dist/workflow-agent-runtime-bridge.js +9 -0
- package/dist/workflow-command-runtime.d.ts +94 -0
- package/dist/workflow-command-runtime.d.ts.map +1 -0
- package/dist/workflow-command-runtime.js +114 -0
- package/dist/workflow-plan-schema.d.ts +161 -0
- package/dist/workflow-plan-schema.d.ts.map +1 -0
- package/dist/workflow-plan-schema.js +12 -0
- package/dist/workflow-planner-entry.d.ts +52 -0
- package/dist/workflow-planner-entry.d.ts.map +1 -0
- package/dist/workflow-planner-entry.js +328 -0
- package/dist/workflow-task-surface.d.ts +39 -0
- package/dist/workflow-task-surface.d.ts.map +1 -0
- package/dist/workflow-task-surface.js +7 -0
- package/dist/workspace-reference-cache.d.ts +110 -0
- package/dist/workspace-reference-cache.d.ts.map +1 -0
- package/dist/workspace-reference-cache.js +12 -0
- package/package.json +41 -0
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
// src/tool-output-presenter.ts
|
|
2
|
+
var TODO_OUTPUT_ITEM_LIMIT = 8;
|
|
3
|
+
var BASH_TAIL_LINE_LIMIT = 0;
|
|
4
|
+
var PRIMARY_PREVIEW_LINE_CAP = 5;
|
|
5
|
+
var RAW_TOOL_USE_PATTERNS = [
|
|
6
|
+
/<tool_use(?:_error)?\b[\s\S]*?<\/tool_use(?:_error)?>/giu,
|
|
7
|
+
/<tool_use(?:_error)?\b[^>]*\/>/giu,
|
|
8
|
+
/<tool_uses\b[\s\S]*?<\/tool_uses>/giu,
|
|
9
|
+
/```(?:json|xml)?\s*[\s\S]*?\btool_use(?:_id)?\b[\s\S]*?```/giu,
|
|
10
|
+
/\{[\s\S]{0,400}?"type"\s*:\s*"tool_use"[\s\S]{0,1600}?\}/giu
|
|
11
|
+
];
|
|
12
|
+
var RAW_TOOL_XML_START = /<tool_use(?:_error)?\b|<tool_uses\b/iu;
|
|
13
|
+
var RAW_TOOL_PREFIXES = [
|
|
14
|
+
"<",
|
|
15
|
+
"<t",
|
|
16
|
+
"<to",
|
|
17
|
+
"<too",
|
|
18
|
+
"<tool",
|
|
19
|
+
"<tool_",
|
|
20
|
+
"<tool_u",
|
|
21
|
+
"<tool_us",
|
|
22
|
+
"<tool_use_",
|
|
23
|
+
"<tool_use_e",
|
|
24
|
+
"<tool_use_er",
|
|
25
|
+
"<tool_use_err",
|
|
26
|
+
"<tool_use_erro"
|
|
27
|
+
];
|
|
28
|
+
var INTERNAL_STREAM_LABEL_REPLACEMENTS = [
|
|
29
|
+
["RunVerification", { "zh-CN": "\u9A8C\u8BC1\u547D\u4EE4", "en-US": "verification command" }]
|
|
30
|
+
];
|
|
31
|
+
var INTERNAL_STREAM_LABEL_PREFIXES = INTERNAL_STREAM_LABEL_REPLACEMENTS.flatMap(
|
|
32
|
+
([label]) => Array.from({ length: label.length - 1 }, (_, index) => label.slice(0, index + 1))
|
|
33
|
+
).sort((a, b) => b.length - a.length);
|
|
34
|
+
function createLayeredToolOutput(name, output, language, evidenceId) {
|
|
35
|
+
const preview = createToolOutputPreview(name, output.preview ?? output.text, language, output);
|
|
36
|
+
const truncated = Boolean(preview.truncated || output.truncated);
|
|
37
|
+
return {
|
|
38
|
+
layer: "primary",
|
|
39
|
+
toolName: name,
|
|
40
|
+
summary: sanitizeToolSummaryForPrimary(
|
|
41
|
+
output.summary ?? createToolSummary(name, output, language),
|
|
42
|
+
language
|
|
43
|
+
),
|
|
44
|
+
preview: preview.text,
|
|
45
|
+
details: output.details,
|
|
46
|
+
truncated,
|
|
47
|
+
fullOutputPath: output.fullOutputPath,
|
|
48
|
+
evidenceId: evidenceId ?? output.evidenceId
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function formatToolOutput(name, output, language, evidenceId) {
|
|
52
|
+
const layered = createLayeredToolOutput(name, output, language, evidenceId);
|
|
53
|
+
const lead = formatPrimaryToolLead(name, output, layered, language);
|
|
54
|
+
const lines = lead ? [lead] : [];
|
|
55
|
+
const textLen = output.text?.length ?? 0;
|
|
56
|
+
if (textLen > 1e4) {
|
|
57
|
+
const approxTokens = Math.round(textLen / 4);
|
|
58
|
+
lines.push(
|
|
59
|
+
language === "en-US" ? `\u26A0 Large response \xB7 ~${approxTokens} tokens` : `\u26A0 \u5927\u54CD\u5E94 \xB7 ~${approxTokens} tokens`
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
if (layered.preview) {
|
|
63
|
+
lines.push(layered.preview);
|
|
64
|
+
}
|
|
65
|
+
const bashEnd = formatBashEndSummary(name, output, language);
|
|
66
|
+
if (bashEnd) {
|
|
67
|
+
lines.push(bashEnd);
|
|
68
|
+
}
|
|
69
|
+
return lines.join("\n");
|
|
70
|
+
}
|
|
71
|
+
function formatPrimaryToolLead(name, output, layered, language) {
|
|
72
|
+
const metadata = output.data && typeof output.data === "object" ? output.data : void 0;
|
|
73
|
+
const count = readNumber(metadata, "count");
|
|
74
|
+
const totalLines = readNumber(metadata, "totalLines") ?? readNumber(metadata, "contentLines");
|
|
75
|
+
const visibleLines = readNumber(metadata, "windowLines") ?? readNumber(metadata, "lines") ?? lineCount(output.text);
|
|
76
|
+
if (isEditingTool(name)) {
|
|
77
|
+
const changedFiles = readStringList(metadata, "changedFiles");
|
|
78
|
+
const filePart = changedFiles.length > 0 ? `**${changedFiles[0]}**` : "";
|
|
79
|
+
const addedLines = readNumber(metadata, "addedLines") ?? 0;
|
|
80
|
+
const removedLines = readNumber(metadata, "removedLines") ?? 0;
|
|
81
|
+
const patchPart = `+${addedLines} -${removedLines}`;
|
|
82
|
+
if (language === "en-US") {
|
|
83
|
+
return filePart ? `${name}(${filePart}) ${patchPart}` : `${name} ${patchPart}`;
|
|
84
|
+
}
|
|
85
|
+
return filePart ? `${name}(${filePart}) ${patchPart}` : `${name} ${patchPart}`;
|
|
86
|
+
}
|
|
87
|
+
if (language === "en-US") {
|
|
88
|
+
if (name === "Grep") return `Found **${count ?? 0}** matches.`;
|
|
89
|
+
if (name === "Glob") return `Found **${count ?? visibleLines}** files.`;
|
|
90
|
+
if (name === "Read") {
|
|
91
|
+
const readFile = readStringValue(metadata, "file") ?? readStringValue(metadata, "path");
|
|
92
|
+
const lineLabel = `**${totalLines ?? visibleLines}** lines`;
|
|
93
|
+
return readFile ? `Read(${readFile}) ${lineLabel}.` : `Read ${lineLabel}.`;
|
|
94
|
+
}
|
|
95
|
+
if (name === "Bash") return formatBashLead(metadata, language);
|
|
96
|
+
if (name === "WebSearch") return formatWebSearchLead(output, language);
|
|
97
|
+
if (name === "WebFetch") return formatWebFetchLead(output, language);
|
|
98
|
+
const enStructured = tryExtractLeadText(output.text);
|
|
99
|
+
if (enStructured) return `${name}: ${enStructured}`;
|
|
100
|
+
return `${name} summary: ${layered.summary}`;
|
|
101
|
+
}
|
|
102
|
+
if (name === "Grep") return `\u627E\u5230 **${count ?? 0}** \u5904\u5339\u914D\u3002`;
|
|
103
|
+
if (name === "Glob") return `\u627E\u5230 **${count ?? visibleLines}** \u4E2A\u6587\u4EF6\u3002`;
|
|
104
|
+
if (name === "Read") {
|
|
105
|
+
const readFile = readStringValue(metadata, "file") ?? readStringValue(metadata, "path");
|
|
106
|
+
const lineLabel = `**${totalLines ?? visibleLines}** \u884C`;
|
|
107
|
+
return readFile ? `Read(${readFile}) ${lineLabel}` : `\u8BFB\u53D6 ${lineLabel}`;
|
|
108
|
+
}
|
|
109
|
+
if (name === "Bash") return formatBashLead(metadata, language);
|
|
110
|
+
if (name === "WebSearch") return formatWebSearchLead(output, language);
|
|
111
|
+
if (name === "WebFetch") return formatWebFetchLead(output, language);
|
|
112
|
+
const zhStructured = tryExtractLeadText(output.text);
|
|
113
|
+
if (zhStructured) return `${name}\uFF1A${zhStructured}`;
|
|
114
|
+
return `${name} \u6458\u8981\uFF1A${layered.summary}`;
|
|
115
|
+
}
|
|
116
|
+
function lineCount(value) {
|
|
117
|
+
if (!value) return 0;
|
|
118
|
+
return value.split(/\r?\n/u).filter((line) => line.trim().length > 0).length;
|
|
119
|
+
}
|
|
120
|
+
function formatBashLead(metadata, language) {
|
|
121
|
+
const command = readStringValue(metadata, "command") ?? "";
|
|
122
|
+
const exitCode = readNumber(metadata, "exitCode");
|
|
123
|
+
const shortCmd = command.length > 60 ? `${command.slice(0, 57)}...` : command;
|
|
124
|
+
const cmdPart = shortCmd ? `Bash(${shortCmd})` : "Bash";
|
|
125
|
+
if (exitCode === void 0) {
|
|
126
|
+
return cmdPart;
|
|
127
|
+
}
|
|
128
|
+
if (exitCode === 0) {
|
|
129
|
+
return `${cmdPart} \u2713`;
|
|
130
|
+
}
|
|
131
|
+
return language === "en-US" ? `${cmdPart} \u2717 exit ${exitCode}` : `${cmdPart} \u2717 \u9000\u51FA ${exitCode}`;
|
|
132
|
+
}
|
|
133
|
+
function formatBashEndSummary(name, output, language) {
|
|
134
|
+
if (name !== "Bash") return void 0;
|
|
135
|
+
const data = output.data && typeof output.data === "object" ? output.data : void 0;
|
|
136
|
+
const exitCode = data && typeof data.exitCode === "number" ? data.exitCode : void 0;
|
|
137
|
+
if (exitCode === void 0) return void 0;
|
|
138
|
+
if (exitCode === 0) return void 0;
|
|
139
|
+
return language === "en-US" ? `Exit code ${exitCode}` : `\u9000\u51FA\u7801 ${exitCode}`;
|
|
140
|
+
}
|
|
141
|
+
function formatWebSearchLead(output, language) {
|
|
142
|
+
const data = output.data && typeof output.data === "object" ? output.data : void 0;
|
|
143
|
+
const searches = typeof data?.searches === "number" ? data.searches : typeof data?.count === "number" ? data.count : void 0;
|
|
144
|
+
const duration = typeof data?.duration === "number" ? data.duration : typeof data?.durationMs === "number" ? data.durationMs / 1e3 : void 0;
|
|
145
|
+
const parts = [];
|
|
146
|
+
if (searches !== void 0) {
|
|
147
|
+
parts.push(
|
|
148
|
+
language === "en-US" ? `${searches} ${searches === 1 ? "search" : "searches"}` : `\u6267\u884C ${searches} \u6B21\u641C\u7D22`
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
if (duration !== void 0) {
|
|
152
|
+
parts.push(language === "en-US" ? `${duration.toFixed(1)}s` : `${duration.toFixed(1)}s`);
|
|
153
|
+
}
|
|
154
|
+
if (parts.length === 0) {
|
|
155
|
+
return language === "en-US" ? "WebSearch completed" : "WebSearch \u5DF2\u5B8C\u6210";
|
|
156
|
+
}
|
|
157
|
+
return parts.join(language === "en-US" ? " in " : " \xB7 ");
|
|
158
|
+
}
|
|
159
|
+
function formatWebFetchLead(output, language) {
|
|
160
|
+
const data = output.data && typeof output.data === "object" ? output.data : void 0;
|
|
161
|
+
const size = typeof data?.size === "number" ? data.size : typeof data?.contentLength === "number" ? data.contentLength : void 0;
|
|
162
|
+
const status = typeof data?.status === "number" ? data.status : typeof data?.statusCode === "number" ? data.statusCode : void 0;
|
|
163
|
+
const statusText = typeof data?.statusText === "string" ? data.statusText : void 0;
|
|
164
|
+
const parts = [];
|
|
165
|
+
if (size !== void 0) {
|
|
166
|
+
const kb = size >= 1024 ? `${(size / 1024).toFixed(1)}KB` : `${size}B`;
|
|
167
|
+
parts.push(language === "en-US" ? `Received ${kb}` : `\u6536\u5230 ${kb}`);
|
|
168
|
+
}
|
|
169
|
+
if (status !== void 0) {
|
|
170
|
+
const code = statusText ? `${status} ${statusText}` : String(status);
|
|
171
|
+
parts.push(code);
|
|
172
|
+
}
|
|
173
|
+
if (parts.length === 0) {
|
|
174
|
+
return language === "en-US" ? "WebFetch completed" : "WebFetch \u5DF2\u5B8C\u6210";
|
|
175
|
+
}
|
|
176
|
+
return parts.join(" \xB7 ");
|
|
177
|
+
}
|
|
178
|
+
function redactBannerArg(value) {
|
|
179
|
+
return value.replace(/\bBearer\s+[A-Za-z0-9._~+/=-]+/gi, "Bearer ***").replace(/\b(Authorization)\s*:\s*(?!Bearer\b)[^\s"'&]+/gi, "$1: ***").replace(
|
|
180
|
+
/\b([A-Z0-9_]*(?:API_KEY|APIKEY|TOKEN|SECRET|PASSWORD|PASSWD|PWD|KEY))=\S+/g,
|
|
181
|
+
"$1=***"
|
|
182
|
+
).replace(/\b(api[_-]?key)=[^\s&"']+/gi, "$1=***").replace(/\b(token)=[^\s&"']+/gi, "$1=***").replace(/\b(key)=[^\s&"']+/gi, "$1=***").replace(/\bsk-[A-Za-z0-9_-]{8,}/g, "sk-***").replace(
|
|
183
|
+
/\b(--?(?:log|log-path|output|output-path|checkpoint-id|checkpoint)\s+)(?:"[^"]*"|'[^']*'|\S+)/giu,
|
|
184
|
+
"$1***"
|
|
185
|
+
).replace(/\bchk_[A-Za-z0-9_-]+\b/gu, "checkpoint-id").replace(/[A-Za-z]:[\\/][^\s"']*(?:log|full-output)[^\s"']*/giu, "[output-log]").replace(/\{[^{}]*(?:"schema"|"raw"|"debug")[\s\S]*\}/giu, "{...}");
|
|
186
|
+
}
|
|
187
|
+
function formatToolStart(name, input) {
|
|
188
|
+
const obj = input && typeof input === "object" ? input : {};
|
|
189
|
+
const str = (key) => {
|
|
190
|
+
const v = obj[key];
|
|
191
|
+
return typeof v === "string" && v.length > 0 ? v : void 0;
|
|
192
|
+
};
|
|
193
|
+
const clamp = (value) => value.length > 120 ? `${value.slice(0, 117)}...` : value;
|
|
194
|
+
let arg;
|
|
195
|
+
if (name === "Bash") {
|
|
196
|
+
arg = str("command");
|
|
197
|
+
} else if (name === "Read") {
|
|
198
|
+
arg = str("path") ?? str("file_path");
|
|
199
|
+
} else if (name === "Write" || name === "Edit" || name === "MultiEdit") {
|
|
200
|
+
arg = str("file_path") ?? str("path");
|
|
201
|
+
} else if (name === "Grep") {
|
|
202
|
+
arg = "search";
|
|
203
|
+
} else if (name === "Glob") {
|
|
204
|
+
arg = "files";
|
|
205
|
+
}
|
|
206
|
+
if (!arg) return void 0;
|
|
207
|
+
return `${name}(${clamp(redactBannerArg(arg))})`;
|
|
208
|
+
}
|
|
209
|
+
function sanitizeAssistantPrimaryText(text, language) {
|
|
210
|
+
const result = sanitizeAssistantPrimaryTextWithMetadata(text, language);
|
|
211
|
+
return result.text;
|
|
212
|
+
}
|
|
213
|
+
function sanitizeAssistantPrimaryTextWithMetadata(text, language) {
|
|
214
|
+
let sanitized = text;
|
|
215
|
+
let removed = false;
|
|
216
|
+
let replacedInternalLabel = false;
|
|
217
|
+
for (const pattern of RAW_TOOL_USE_PATTERNS) {
|
|
218
|
+
sanitized = sanitized.replace(pattern, () => {
|
|
219
|
+
removed = true;
|
|
220
|
+
return "";
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
for (const [label, replacement] of INTERNAL_STREAM_LABEL_REPLACEMENTS) {
|
|
224
|
+
if (sanitized.includes(label)) {
|
|
225
|
+
sanitized = sanitized.split(label).join(replacement[language]);
|
|
226
|
+
replacedInternalLabel = true;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (!removed) {
|
|
230
|
+
return {
|
|
231
|
+
text: replacedInternalLabel ? sanitized : text,
|
|
232
|
+
removedRawToolProtocol: false
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
const compact = sanitized.replace(/\n{3,}/gu, "\n\n");
|
|
236
|
+
const note = language === "en-US" ? "[Tool call details hidden.]\n" : "[\u5DE5\u5177\u8C03\u7528\u7EC6\u8282\u5DF2\u9690\u85CF\u3002]\n";
|
|
237
|
+
return {
|
|
238
|
+
text: compact.trim().length > 0 ? `${note}${compact}` : note,
|
|
239
|
+
removedRawToolProtocol: true
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function createAssistantPrimaryTextSanitizer(language) {
|
|
243
|
+
let pending = "";
|
|
244
|
+
let removedRawToolProtocol = false;
|
|
245
|
+
function sanitizeBuffered(text) {
|
|
246
|
+
if (!text) return "";
|
|
247
|
+
const combined = pending + text;
|
|
248
|
+
const holdAt = findPendingRawToolStart(combined) ?? findRawToolPrefixAtEnd(combined);
|
|
249
|
+
if (holdAt !== void 0) {
|
|
250
|
+
pending = combined.slice(holdAt);
|
|
251
|
+
const result2 = sanitizeAssistantPrimaryTextWithMetadata(combined.slice(0, holdAt), language);
|
|
252
|
+
removedRawToolProtocol ||= result2.removedRawToolProtocol;
|
|
253
|
+
return result2.text;
|
|
254
|
+
}
|
|
255
|
+
const internalLabelPrefix = findInternalStreamLabelPrefixAtEnd(combined);
|
|
256
|
+
if (internalLabelPrefix) {
|
|
257
|
+
pending = internalLabelPrefix;
|
|
258
|
+
const result2 = sanitizeAssistantPrimaryTextWithMetadata(
|
|
259
|
+
combined.slice(0, -internalLabelPrefix.length),
|
|
260
|
+
language
|
|
261
|
+
);
|
|
262
|
+
removedRawToolProtocol ||= result2.removedRawToolProtocol;
|
|
263
|
+
return result2.text;
|
|
264
|
+
}
|
|
265
|
+
pending = "";
|
|
266
|
+
const result = sanitizeAssistantPrimaryTextWithMetadata(combined, language);
|
|
267
|
+
removedRawToolProtocol ||= result.removedRawToolProtocol;
|
|
268
|
+
return result.text;
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
push: sanitizeBuffered,
|
|
272
|
+
flush() {
|
|
273
|
+
const result = pending ? sanitizeAssistantPrimaryTextWithMetadata(pending, language) : { text: "", removedRawToolProtocol: false };
|
|
274
|
+
removedRawToolProtocol ||= result.removedRawToolProtocol;
|
|
275
|
+
pending = "";
|
|
276
|
+
return result.text;
|
|
277
|
+
},
|
|
278
|
+
hadRawToolProtocol() {
|
|
279
|
+
return removedRawToolProtocol;
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function findInternalStreamLabelPrefixAtEnd(text) {
|
|
284
|
+
return INTERNAL_STREAM_LABEL_PREFIXES.find((prefix) => text.endsWith(prefix));
|
|
285
|
+
}
|
|
286
|
+
function findPendingRawToolStart(text) {
|
|
287
|
+
const match = RAW_TOOL_XML_START.exec(text);
|
|
288
|
+
if (!match || match.index < 0) return void 0;
|
|
289
|
+
const start = match.index;
|
|
290
|
+
const tail = text.slice(start).toLowerCase();
|
|
291
|
+
if (tail.startsWith("<tool_uses")) {
|
|
292
|
+
return tail.includes("</tool_uses>") ? void 0 : start;
|
|
293
|
+
}
|
|
294
|
+
if (tail.startsWith("<tool_use_error")) {
|
|
295
|
+
if (tail.includes("/>")) return void 0;
|
|
296
|
+
return tail.includes("</tool_use_error>") ? void 0 : start;
|
|
297
|
+
}
|
|
298
|
+
if (tail.includes("/>")) return void 0;
|
|
299
|
+
return tail.includes("</tool_use>") ? void 0 : start;
|
|
300
|
+
}
|
|
301
|
+
function findRawToolPrefixAtEnd(text) {
|
|
302
|
+
const lower = text.toLowerCase();
|
|
303
|
+
for (const prefix of RAW_TOOL_PREFIXES) {
|
|
304
|
+
if (lower.endsWith(prefix)) return text.length - prefix.length;
|
|
305
|
+
}
|
|
306
|
+
return void 0;
|
|
307
|
+
}
|
|
308
|
+
function stripLegacyFoldHints(text) {
|
|
309
|
+
if (!text) return text;
|
|
310
|
+
const kept = text.split(/\r?\n/u).filter((line) => {
|
|
311
|
+
const trimmed = line.replace(/^[-\s]+/u, "").trim();
|
|
312
|
+
return !(trimmed === "\u8F93\u51FA\u5DF2\u6298\u53E0\uFF0C\u6309 Ctrl+O \u5C55\u5F00\u3002" || trimmed === "Output folded. Press Ctrl+O to expand." || /^\[stdout\]\s*\.\.\.\s*(?:更多输出已隐藏;按 Ctrl\+O 展开。|more output hidden; press Ctrl\+O to expand\.)$/iu.test(
|
|
313
|
+
trimmed
|
|
314
|
+
));
|
|
315
|
+
});
|
|
316
|
+
return kept.join("\n").trim();
|
|
317
|
+
}
|
|
318
|
+
function createToolSummary(name, output, language) {
|
|
319
|
+
const changed = output.changedFiles?.length ?? 0;
|
|
320
|
+
if (language === "en-US") {
|
|
321
|
+
const suffix2 = changed > 0 ? `; changed ${changed} file${changed === 1 ? "" : "s"}` : "";
|
|
322
|
+
return `${name} completed${output.truncated ? " with truncated main output" : ""}${suffix2}.`;
|
|
323
|
+
}
|
|
324
|
+
const suffix = changed > 0 ? `\uFF1B\u6539\u52A8 ${changed} \u4E2A\u6587\u4EF6` : "";
|
|
325
|
+
return `${name} \u5DF2\u5B8C\u6210${output.truncated ? "\uFF0C\u4E3B\u8F93\u51FA\u5DF2\u622A\u65AD" : ""}${suffix}\u3002`;
|
|
326
|
+
}
|
|
327
|
+
function sanitizeToolSummaryForPrimary(summary, language) {
|
|
328
|
+
if (language === "en-US") {
|
|
329
|
+
return summary.replace(/\bchangedFiles=(\d+)/gu, "changed files: $1").replace(/\bcontentLines=(\d+)/gu, "content lines: $1").replace(/\bselectedLines=(\d+)/gu, "selected lines: $1").replace(/\bwindowLines=(\d+)/gu, "window lines: $1");
|
|
330
|
+
}
|
|
331
|
+
return summary.replace(/\bchangedFiles=(\d+)/gu, "\u6539\u52A8\u6587\u4EF6\uFF1A$1").replace(/\bcontentLines=(\d+)/gu, "\u5185\u5BB9\u884C\u6570\uFF1A$1").replace(/\bselectedLines=(\d+)/gu, "\u9009\u4E2D\u884C\u6570\uFF1A$1").replace(/\bwindowLines=(\d+)/gu, "\u7A97\u53E3\u884C\u6570\uFF1A$1");
|
|
332
|
+
}
|
|
333
|
+
function createToolOutputPreview(name, text, language, output) {
|
|
334
|
+
const cleanedText = stripLegacyFoldHints(text);
|
|
335
|
+
if (name === "Todo") {
|
|
336
|
+
const structured = createTodoSurfacePreview(output, language);
|
|
337
|
+
if (structured) return structured;
|
|
338
|
+
const lines = cleanedText.split(/\r?\n/u);
|
|
339
|
+
if (lines.length <= TODO_OUTPUT_ITEM_LIMIT) {
|
|
340
|
+
return { text: cleanedText, truncated: false };
|
|
341
|
+
}
|
|
342
|
+
const remaining = lines.length - TODO_OUTPUT_ITEM_LIMIT;
|
|
343
|
+
return {
|
|
344
|
+
text: [
|
|
345
|
+
...lines.slice(0, TODO_OUTPUT_ITEM_LIMIT),
|
|
346
|
+
language === "en-US" ? `... ${remaining} more todo item(s) hidden from main output.` : `... \u4E3B\u8F93\u51FA\u5DF2\u9690\u85CF ${remaining} \u6761 Todo\u3002`
|
|
347
|
+
].join("\n"),
|
|
348
|
+
truncated: true
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
if (isSummaryFirstTool(name)) {
|
|
352
|
+
return createSummaryFirstPreview(name, cleanedText, language, output);
|
|
353
|
+
}
|
|
354
|
+
const unwrapped = tryUnwrapStructuredText(cleanedText);
|
|
355
|
+
if (unwrapped) return { text: unwrapped, truncated: cleanedText.length > 2e3 };
|
|
356
|
+
return { text: cleanedText, truncated: false };
|
|
357
|
+
}
|
|
358
|
+
function tryUnwrapStructuredText(text) {
|
|
359
|
+
if (text.length < 3) return void 0;
|
|
360
|
+
try {
|
|
361
|
+
const parsed = JSON.parse(text);
|
|
362
|
+
if (typeof parsed !== "object" || parsed === null) return void 0;
|
|
363
|
+
const obj = parsed;
|
|
364
|
+
if (typeof obj.content === "string" && obj.content.length > 0) {
|
|
365
|
+
return obj.content;
|
|
366
|
+
}
|
|
367
|
+
if (typeof obj.text === "string" && obj.text.length > 0) {
|
|
368
|
+
return obj.text;
|
|
369
|
+
}
|
|
370
|
+
if (typeof obj.result === "string" && obj.result.length > 0) {
|
|
371
|
+
return obj.result;
|
|
372
|
+
}
|
|
373
|
+
if (Array.isArray(obj.content) && obj.content.length > 0) {
|
|
374
|
+
const parts = obj.content.filter(
|
|
375
|
+
(item) => typeof item === "object" && item !== null
|
|
376
|
+
).map(
|
|
377
|
+
(item) => typeof item.text === "string" ? item.text : typeof item.content === "string" ? item.content : ""
|
|
378
|
+
).filter(Boolean);
|
|
379
|
+
if (parts.length > 0) return parts.join("\n");
|
|
380
|
+
}
|
|
381
|
+
if (Object.keys(obj).length >= 2) {
|
|
382
|
+
return JSON.stringify(obj, null, 2);
|
|
383
|
+
}
|
|
384
|
+
return void 0;
|
|
385
|
+
} catch {
|
|
386
|
+
return void 0;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
function tryExtractLeadText(text) {
|
|
390
|
+
if (!text || text.length < 3) return void 0;
|
|
391
|
+
const unwrapped = tryUnwrapStructuredText(text);
|
|
392
|
+
const source = unwrapped ?? text;
|
|
393
|
+
const firstLine = source.split("\n")[0]?.trim() ?? "";
|
|
394
|
+
if (!firstLine) return void 0;
|
|
395
|
+
return firstLine.length > 80 ? `${firstLine.slice(0, 77)}...` : firstLine;
|
|
396
|
+
}
|
|
397
|
+
function createTodoSurfacePreview(output, language) {
|
|
398
|
+
const items = readTodoItems(output?.data);
|
|
399
|
+
if (!items) return void 0;
|
|
400
|
+
if (items.length === 0) {
|
|
401
|
+
return {
|
|
402
|
+
text: language === "en-US" ? "Todo: no active tasks." : "Todo\uFF1A\u6682\u65E0\u4EFB\u52A1\u3002",
|
|
403
|
+
truncated: false
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
const counts = {
|
|
407
|
+
in_progress: items.filter((item) => item.status === "in_progress").length,
|
|
408
|
+
pending: items.filter((item) => item.status === "pending").length,
|
|
409
|
+
completed: items.filter((item) => item.status === "completed").length,
|
|
410
|
+
blocked: items.filter((item) => item.status === "blocked").length
|
|
411
|
+
};
|
|
412
|
+
const activeItems = items.filter(
|
|
413
|
+
(item) => item.status === "in_progress" || item.status === "blocked"
|
|
414
|
+
);
|
|
415
|
+
const parts = language === "en-US" ? [
|
|
416
|
+
`${counts.in_progress} in progress`,
|
|
417
|
+
`${counts.blocked} blocked`,
|
|
418
|
+
`${counts.pending} pending`,
|
|
419
|
+
`${counts.completed} done`
|
|
420
|
+
] : [
|
|
421
|
+
`\u8FDB\u884C\u4E2D ${counts.in_progress}`,
|
|
422
|
+
`\u963B\u585E ${counts.blocked}`,
|
|
423
|
+
`\u5F85\u529E ${counts.pending}`,
|
|
424
|
+
`\u5B8C\u6210 ${counts.completed}`
|
|
425
|
+
];
|
|
426
|
+
const lines = [
|
|
427
|
+
language === "en-US" ? `Todo: ${parts.join(" \xB7 ")}` : `Todo\uFF1A${parts.join(" \xB7 ")}`
|
|
428
|
+
];
|
|
429
|
+
const displayItems = activeItems.slice(0, PRIMARY_PREVIEW_LINE_CAP - 1);
|
|
430
|
+
for (const item of displayItems) {
|
|
431
|
+
const label = language === "en-US" ? item.status.replace("_", " ") : item.status === "in_progress" ? "\u8FDB\u884C\u4E2D" : "\u963B\u585E";
|
|
432
|
+
lines.push(` ${label}: ${item.content}`);
|
|
433
|
+
}
|
|
434
|
+
const hiddenCount = items.length - displayItems.length;
|
|
435
|
+
if (hiddenCount > 0) {
|
|
436
|
+
lines.push(
|
|
437
|
+
language === "en-US" ? `... ${hiddenCount} more item(s) in details.` : `... \u53E6\u6709 ${hiddenCount} \u9879\u5728\u8BE6\u60C5\u4E2D\u3002`
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
return { text: lines.join("\n"), truncated: hiddenCount > 0 };
|
|
441
|
+
}
|
|
442
|
+
function readTodoItems(data) {
|
|
443
|
+
if (!data || typeof data !== "object") return void 0;
|
|
444
|
+
const items = data.items;
|
|
445
|
+
if (!Array.isArray(items)) return void 0;
|
|
446
|
+
return items.filter((item) => {
|
|
447
|
+
if (!item || typeof item !== "object") return false;
|
|
448
|
+
const record = item;
|
|
449
|
+
return typeof record.content === "string" && (record.status === "pending" || record.status === "in_progress" || record.status === "completed" || record.status === "blocked");
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
function isSummaryFirstTool(name) {
|
|
453
|
+
return name === "Read" || name === "Glob" || name === "Grep" || name === "Bash" || name === "Write" || name === "Edit" || name === "MultiEdit";
|
|
454
|
+
}
|
|
455
|
+
function createSummaryFirstPreview(name, text, language, output) {
|
|
456
|
+
const lines = text.length > 0 ? text.split(/\r?\n/u) : [];
|
|
457
|
+
const metadata = output?.data && typeof output.data === "object" ? output.data : void 0;
|
|
458
|
+
const count = readNumber(metadata, "count");
|
|
459
|
+
const dataLines = readNumber(metadata, "lines");
|
|
460
|
+
const windowLines = readNumber(metadata, "windowLines");
|
|
461
|
+
const totalLines = readNumber(metadata, "totalLines");
|
|
462
|
+
const contentLines = readNumber(metadata, "contentLines");
|
|
463
|
+
const exitCode = readNumber(metadata, "exitCode");
|
|
464
|
+
const stats = [
|
|
465
|
+
formatToolLineStat(name, {
|
|
466
|
+
language,
|
|
467
|
+
visibleLines: dataLines ?? lines.length,
|
|
468
|
+
windowLines,
|
|
469
|
+
totalLines,
|
|
470
|
+
contentLines,
|
|
471
|
+
truncated: Boolean(output?.truncated)
|
|
472
|
+
})
|
|
473
|
+
];
|
|
474
|
+
if (count !== void 0) {
|
|
475
|
+
stats.push(language === "en-US" ? `${count} match(es)` : `${count} \u6761\u7ED3\u679C`);
|
|
476
|
+
}
|
|
477
|
+
if (name === "Bash" && looksLikeMojibake(text)) {
|
|
478
|
+
stats.push(language === "en-US" ? "possible encoding issue" : "\u7591\u4F3C\u7F16\u7801\u95EE\u9898");
|
|
479
|
+
}
|
|
480
|
+
if (isEditingTool(name)) {
|
|
481
|
+
const addedLines = readNumber(metadata, "addedLines") ?? 0;
|
|
482
|
+
const removedLines = readNumber(metadata, "removedLines") ?? 0;
|
|
483
|
+
const changedFiles = readStringList(metadata, "changedFiles");
|
|
484
|
+
const readGuard = readStringValue(metadata, "readGuard");
|
|
485
|
+
stats.push(
|
|
486
|
+
language === "en-US" ? `patch +${addedLines} -${removedLines}` : `\u8865\u4E01 +${addedLines} -${removedLines}`
|
|
487
|
+
);
|
|
488
|
+
if (changedFiles.length > 0) {
|
|
489
|
+
stats.push(
|
|
490
|
+
language === "en-US" ? `changed ${changedFiles.length} file${changedFiles.length === 1 ? "" : "s"}` : `\u6539\u52A8\u6587\u4EF6 ${changedFiles.length}`
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
const hasHiddenContent = Boolean(output?.truncated) || Boolean(output?.details) || Boolean(output?.fullOutputPath) || lines.length > 100 || text.length > 1e4;
|
|
495
|
+
if (hasHiddenContent) {
|
|
496
|
+
const tail = name === "Bash" && !looksLikeMojibake(text) ? formatBashTail(lines, language) : [];
|
|
497
|
+
const diffFence = isEditingTool(name) ? extractCompactDiffFence(output?.details) : "";
|
|
498
|
+
return {
|
|
499
|
+
text: [`- ${stats.join("; ")}`, ...tail, diffFence].filter(Boolean).join("\n"),
|
|
500
|
+
truncated: true
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
if (name === "Bash" && !looksLikeMojibake(text)) {
|
|
504
|
+
const tail = formatBashTail(lines, language);
|
|
505
|
+
if (tail.length > 0) {
|
|
506
|
+
return { text: [`- ${stats.join("; ")}`, ...tail].join("\n"), truncated: false };
|
|
507
|
+
}
|
|
508
|
+
if (text.trim().length > 0) {
|
|
509
|
+
const nonEmpty = lines.filter((l) => l.trim().length > 0);
|
|
510
|
+
if (nonEmpty.length > PRIMARY_PREVIEW_LINE_CAP) {
|
|
511
|
+
const capped = nonEmpty.slice(0, PRIMARY_PREVIEW_LINE_CAP).join("\n");
|
|
512
|
+
return {
|
|
513
|
+
text: [`- ${stats.join("; ")}`, capped].join("\n"),
|
|
514
|
+
truncated: true
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
return { text: [`- ${stats.join("; ")}`, text].join("\n"), truncated: false };
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
return { text: `- ${stats.join("; ")}`, truncated: false };
|
|
521
|
+
}
|
|
522
|
+
function formatToolLineStat(name, input) {
|
|
523
|
+
if (name !== "Read" || input.totalLines === void 0) {
|
|
524
|
+
return input.language === "en-US" ? `${input.visibleLines} line(s)` : `${input.visibleLines} \u884C`;
|
|
525
|
+
}
|
|
526
|
+
const windowLines = input.windowLines ?? input.visibleLines;
|
|
527
|
+
const contentLines = input.contentLines ?? input.totalLines;
|
|
528
|
+
if (input.truncated) {
|
|
529
|
+
return input.language === "en-US" ? `window ${windowLines}/${input.totalLines} line(s); content ${contentLines} line(s)` : `\u7A97\u53E3 ${windowLines}/${input.totalLines} \u884C\uFF1B\u5185\u5BB9 ${contentLines} \u884C`;
|
|
530
|
+
}
|
|
531
|
+
return input.language === "en-US" ? `total ${input.totalLines} line(s); content ${contentLines} line(s)` : `\u603B\u8BA1 ${input.totalLines} \u884C\uFF1B\u5185\u5BB9 ${contentLines} \u884C`;
|
|
532
|
+
}
|
|
533
|
+
function formatBashTail(lines, language) {
|
|
534
|
+
if (BASH_TAIL_LINE_LIMIT === 0) return [];
|
|
535
|
+
const tail = lines.map((line) => line.trimEnd()).filter((line) => line.trim().length > 0).slice(-BASH_TAIL_LINE_LIMIT);
|
|
536
|
+
if (tail.length === 0) return [];
|
|
537
|
+
const title = language === "en-US" ? "tail:" : "\u5C3E\u90E8\uFF1A";
|
|
538
|
+
return [`- ${title}`, ...tail.map((line) => ` ${line}`)];
|
|
539
|
+
}
|
|
540
|
+
function readNumber(value, key) {
|
|
541
|
+
if (!value) return void 0;
|
|
542
|
+
const item = value[key];
|
|
543
|
+
return typeof item === "number" ? item : void 0;
|
|
544
|
+
}
|
|
545
|
+
function readStringValue(value, key) {
|
|
546
|
+
if (!value) return void 0;
|
|
547
|
+
const item = value[key];
|
|
548
|
+
return typeof item === "string" ? item : void 0;
|
|
549
|
+
}
|
|
550
|
+
function readStringList(value, key) {
|
|
551
|
+
if (!value) return [];
|
|
552
|
+
const item = value[key];
|
|
553
|
+
return Array.isArray(item) ? item.filter((entry) => typeof entry === "string") : [];
|
|
554
|
+
}
|
|
555
|
+
function isEditingTool(name) {
|
|
556
|
+
return name === "Write" || name === "Edit" || name === "MultiEdit";
|
|
557
|
+
}
|
|
558
|
+
var EDIT_DIFF_PREVIEW_LINES = 24;
|
|
559
|
+
function extractCompactDiffFence(details) {
|
|
560
|
+
if (!details) return "";
|
|
561
|
+
const beforeIdx = details.indexOf("--- before");
|
|
562
|
+
const afterIdx = details.indexOf("+++ after");
|
|
563
|
+
if (beforeIdx < 0 || afterIdx < 0) return "";
|
|
564
|
+
const removedRaw = details.slice(beforeIdx, afterIdx).split("\n").slice(1).filter((l) => l.startsWith("- ") || l.startsWith("- "));
|
|
565
|
+
const addedRaw = details.slice(afterIdx).split("\n").slice(1).filter((l) => l.startsWith("+ ") || l.startsWith("+ "));
|
|
566
|
+
if (removedRaw.length === 0 && addedRaw.length === 0) return "";
|
|
567
|
+
const diffLines = [];
|
|
568
|
+
for (const line of removedRaw.slice(0, EDIT_DIFF_PREVIEW_LINES)) {
|
|
569
|
+
diffLines.push(line);
|
|
570
|
+
}
|
|
571
|
+
for (const line of addedRaw.slice(0, EDIT_DIFF_PREVIEW_LINES - diffLines.length)) {
|
|
572
|
+
diffLines.push(line);
|
|
573
|
+
}
|
|
574
|
+
if (diffLines.length === 0) return "";
|
|
575
|
+
return "```diff\n" + diffLines.join("\n") + "\n```";
|
|
576
|
+
}
|
|
577
|
+
function looksLikeMojibake(text) {
|
|
578
|
+
return /(?:�|Ã.|Â.|Ð.|Ñ.|Ž|¤|¦|µ|¥|¡|¿|乱码|mojibake)/u.test(text);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export {
|
|
582
|
+
createLayeredToolOutput,
|
|
583
|
+
formatToolOutput,
|
|
584
|
+
formatToolStart,
|
|
585
|
+
sanitizeAssistantPrimaryText,
|
|
586
|
+
sanitizeAssistantPrimaryTextWithMetadata,
|
|
587
|
+
createAssistantPrimaryTextSanitizer
|
|
588
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeSGRResetAndFlush
|
|
3
|
+
} from "./chunk-XFPNU42I.js";
|
|
4
|
+
|
|
5
|
+
// src/shell/terminal-state-recovery.ts
|
|
6
|
+
function createTerminalStateSnapshot() {
|
|
7
|
+
return {
|
|
8
|
+
cursorVisible: true,
|
|
9
|
+
mouseEnabled: false,
|
|
10
|
+
alternateScreen: false,
|
|
11
|
+
timestamp: Date.now()
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
async function recoverTerminalState(stdout, options = {}) {
|
|
15
|
+
if (!stdout || stdout.destroyed || stdout.closed) return;
|
|
16
|
+
if (stdout.isTTY === false) return;
|
|
17
|
+
const { exitAlternateScreen = false, logError } = options;
|
|
18
|
+
try {
|
|
19
|
+
const recoverySequences = [];
|
|
20
|
+
recoverySequences.push("\x1B[?25h");
|
|
21
|
+
recoverySequences.push("\x1B[?1000l");
|
|
22
|
+
recoverySequences.push("\x1B[?1002l");
|
|
23
|
+
recoverySequences.push("\x1B[?1003l");
|
|
24
|
+
recoverySequences.push("\x1B[?1006l");
|
|
25
|
+
recoverySequences.push("\x1B[?1004l");
|
|
26
|
+
recoverySequences.push("\x1B[?2004l");
|
|
27
|
+
recoverySequences.push("\x1B[0m");
|
|
28
|
+
if (exitAlternateScreen) {
|
|
29
|
+
recoverySequences.push("\x1B[?1049l");
|
|
30
|
+
}
|
|
31
|
+
recoverySequences.push("\r\x1B[K");
|
|
32
|
+
const fullSequence = recoverySequences.join("");
|
|
33
|
+
if (stdout.writable && !stdout.destroyed) {
|
|
34
|
+
stdout.write(fullSequence, (error) => {
|
|
35
|
+
if (error && logError) {
|
|
36
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
37
|
+
logError(`Terminal state recovery write failed: ${message}`);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
await writeSGRResetAndFlush(stdout);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
if (logError) {
|
|
44
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
45
|
+
logError(`Terminal state recovery failed: ${message}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function createTerminalStateRecoveryHandler(stdout, options = {}) {
|
|
50
|
+
return async () => {
|
|
51
|
+
await recoverTerminalState(stdout, options);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
createTerminalStateSnapshot,
|
|
57
|
+
recoverTerminalState,
|
|
58
|
+
createTerminalStateRecoveryHandler
|
|
59
|
+
};
|