@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,1373 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildTranscriptScreenBuffer,
|
|
3
|
+
selectionLineIndexesForBlock,
|
|
4
|
+
selectionLineRangesForBlock
|
|
5
|
+
} from "./chunk-NKFKOEYX.js";
|
|
6
|
+
import {
|
|
7
|
+
buildHelpPanelData
|
|
8
|
+
} from "./chunk-3AKXDMVS.js";
|
|
9
|
+
import {
|
|
10
|
+
buildElevationOptions
|
|
11
|
+
} from "./chunk-H3T4EF5F.js";
|
|
12
|
+
import {
|
|
13
|
+
explainHowToUpdate,
|
|
14
|
+
explainPolicyVerdict,
|
|
15
|
+
explainSemantic
|
|
16
|
+
} from "./chunk-NSIKYD3X.js";
|
|
17
|
+
import {
|
|
18
|
+
buildAgentProgressTreeView,
|
|
19
|
+
buildBackgroundTaskOverlayView,
|
|
20
|
+
buildTaskListView,
|
|
21
|
+
buildWorkflowProgressView
|
|
22
|
+
} from "./chunk-FRIMDSRU.js";
|
|
23
|
+
import {
|
|
24
|
+
formatPermissionModeLabel,
|
|
25
|
+
permissionModeColor,
|
|
26
|
+
permissionModeSymbol
|
|
27
|
+
} from "./chunk-KI7C6ZOD.js";
|
|
28
|
+
import {
|
|
29
|
+
sanitizeMainScreenLeakage
|
|
30
|
+
} from "./chunk-3GCIXKCI.js";
|
|
31
|
+
import {
|
|
32
|
+
SLASH_COMMAND_REGISTRY
|
|
33
|
+
} from "./chunk-PGNALDEH.js";
|
|
34
|
+
import {
|
|
35
|
+
formatElapsedSince
|
|
36
|
+
} from "./chunk-UDQT5CWK.js";
|
|
37
|
+
import {
|
|
38
|
+
DEFAULT_KEYBINDINGS
|
|
39
|
+
} from "./chunk-6SMM5CMP.js";
|
|
40
|
+
import {
|
|
41
|
+
calculateContextPercentages
|
|
42
|
+
} from "./chunk-K4FSYBSY.js";
|
|
43
|
+
import {
|
|
44
|
+
truncateMiddle
|
|
45
|
+
} from "./chunk-APJIC2O5.js";
|
|
46
|
+
|
|
47
|
+
// src/shell/view-model.ts
|
|
48
|
+
import { basename } from "path";
|
|
49
|
+
import { TOGGLE_DETAILS_KEYBIND } from "@linghun/shared";
|
|
50
|
+
var shellText = {
|
|
51
|
+
"zh-CN": {
|
|
52
|
+
brand: "LingHun",
|
|
53
|
+
project: (name) => `\u9879\u76EE\uFF1A${name}`,
|
|
54
|
+
model: (name) => `\u6A21\u578B\uFF1A${name}`,
|
|
55
|
+
permission: (mode) => `\u6743\u9650\uFF1A${mode}`,
|
|
56
|
+
trust: (value) => `\u4FE1\u4EFB\uFF1A${value}`,
|
|
57
|
+
placeholder: "\u6211\u80FD\u5E2E\u60A8\u505A\u70B9\u4EC0\u4E48\uFF1F",
|
|
58
|
+
taskPlaceholder: "\u7EE7\u7EED\u8F93\u5165\u2026",
|
|
59
|
+
setupPlaceholder: "\u6309 Enter \u5F00\u59CB\u914D\u7F6E\u6A21\u578B",
|
|
60
|
+
setupApiKeyPlaceholder: "\u7C98\u8D34 API Key\uFF08\u8F93\u5165\u4F1A\u88AB\u906E\u853D\uFF09",
|
|
61
|
+
setupBaseUrlPlaceholder: "\u8F93\u5165 Base URL\uFF0C\u56DE\u8F66\u786E\u8BA4",
|
|
62
|
+
setupModelPlaceholder: "\u8F93\u5165\u6A21\u578B\u540D\uFF0C\u56DE\u8F66\u786E\u8BA4",
|
|
63
|
+
setupReasoningPlaceholder: "\u9009\u62E9 reasoning level\uFF08low/medium/high\uFF09\uFF0C\u56DE\u8F66\u786E\u8BA4",
|
|
64
|
+
setupAuxModelPlaceholder: "\u8F93\u5165\u8F85\u52A9\u6A21\u578B\uFF0C\u7559\u7A7A\u8DF3\u8FC7",
|
|
65
|
+
setupConfirmPlaceholder: "y \u786E\u8BA4 \xB7 n \u91CD\u586B",
|
|
66
|
+
setupStepApiKey: "\u914D\u7F6E \xB7 API Key",
|
|
67
|
+
setupStepBaseUrl: "\u914D\u7F6E \xB7 Base URL",
|
|
68
|
+
setupStepModel: "\u914D\u7F6E \xB7 Model",
|
|
69
|
+
setupStepReasoning: "\u914D\u7F6E \xB7 Reasoning",
|
|
70
|
+
setupStepAuxModel: "\u914D\u7F6E \xB7 Aux Model",
|
|
71
|
+
setupStepConfirm: "\u914D\u7F6E \xB7 \u786E\u8BA4",
|
|
72
|
+
permissionPlaceholder: "\u9009\u62E9\u64CD\u4F5C\uFF1Ay \u540C\u610F \xB7 n \u62D2\u7EDD \xB7 d \u8BE6\u60C5 \xB7 Esc \u53D6\u6D88",
|
|
73
|
+
permissionActionYes: "\u540C\u610F",
|
|
74
|
+
permissionActionNo: "\u62D2\u7EDD",
|
|
75
|
+
permissionActionDetails: "\u8BE6\u60C5",
|
|
76
|
+
permissionActionCancel: "\u53D6\u6D88",
|
|
77
|
+
submittedHint: "\u5DF2\u901A\u8FC7\u540C\u4E00\u6761 TUI controller \u8DEF\u5F84\u63D0\u4EA4\u3002",
|
|
78
|
+
setupHint: "\u8FD8\u6CA1\u6709\u6A21\u578B\u914D\u7F6E\u3002\u6309 Enter \u5F00\u59CB\uFF0C\u6216\u8BF4\u201C\u6211\u8981\u914D\u7F6E\u6A21\u578B\u201D\u3002",
|
|
79
|
+
routeTitle: "\u9879\u76EE\u6A21\u578B\u8DEF\u7531\u9700\u8981\u5904\u7406",
|
|
80
|
+
routeSummary: (problem) => `${problem}\u3002\u8FD9\u662F\u9879\u76EE\u7EA7 route/settings \u95EE\u9898\uFF0C\u4E0D\u8981\u91CD\u590D\u586B\u5199\u7528\u6237 API key\u3002`,
|
|
81
|
+
routeNextAction: "\u7528 /model doctor \u67E5\u770B\u8BE6\u60C5\uFF0C\u6216\u8C03\u6574\u672C\u4ED3\u5E93 .linghun/settings.json\u3002",
|
|
82
|
+
trustUnknown: "\u4FE1\u4EFB?",
|
|
83
|
+
trustTrusted: "\u5DF2\u4FE1\u4EFB",
|
|
84
|
+
trustRestricted: "\u53D7\u9650",
|
|
85
|
+
index: (status) => `\u7D22\u5F15\uFF1A${status}`,
|
|
86
|
+
background: (count) => `\u540E\u53F0\uFF1A${count}`,
|
|
87
|
+
backgroundShort: (count) => `\u540E\u53F0:${count}`,
|
|
88
|
+
latestOutputTitle: "\u6700\u8FD1\u8F93\u51FA",
|
|
89
|
+
noVisibleOutput: "\u6CA1\u6709\u53EF\u89C1\u8F93\u51FA\u3002",
|
|
90
|
+
latestOutputNext: `\u6309 ${TOGGLE_DETAILS_KEYBIND} \u67E5\u770B\u5B8C\u6574\u8FD0\u884C\u65F6\u8F93\u51FA\uFF08\u6216 /details\uFF09\u3002`,
|
|
91
|
+
detailsHint: `${TOGGLE_DETAILS_KEYBIND} \u67E5\u770B\u5B8C\u6574\u5185\u5BB9`,
|
|
92
|
+
errorTitle: (tool) => `${tool} \u5931\u8D25`,
|
|
93
|
+
errorDetailsHint: `${TOGGLE_DETAILS_KEYBIND} \u67E5\u770B\u5B8C\u6574\u9519\u8BEF`,
|
|
94
|
+
activityError: "\u8BF7\u6C42\u5931\u8D25\uFF0C\u53EF\u91CD\u8BD5\u6216\u7528 /model doctor \u6392\u67E5\u3002",
|
|
95
|
+
activityCompleted: "\u5DF2\u5B8C\u6210\u3002",
|
|
96
|
+
denied: (tool) => `\u5DF2\u62D2\u7EDD ${tool}\uFF0C\u5DE5\u5177\u672A\u6267\u884C\u3002`,
|
|
97
|
+
cancelled: (tool) => `\u5DF2\u53D6\u6D88 ${tool}\uFF0C\u5DE5\u5177\u672A\u6267\u884C\u3002`
|
|
98
|
+
},
|
|
99
|
+
"en-US": {
|
|
100
|
+
brand: "LingHun",
|
|
101
|
+
project: (name) => `Project: ${name}`,
|
|
102
|
+
model: (name) => `Model: ${name}`,
|
|
103
|
+
permission: (mode) => `Permission: ${mode}`,
|
|
104
|
+
trust: (value) => `Trust: ${value}`,
|
|
105
|
+
placeholder: "What can I help you with?",
|
|
106
|
+
taskPlaceholder: "Continue\u2026",
|
|
107
|
+
setupPlaceholder: "Press Enter to configure a model",
|
|
108
|
+
setupApiKeyPlaceholder: "Paste API key (input is masked)",
|
|
109
|
+
setupBaseUrlPlaceholder: "Enter Base URL, press Enter",
|
|
110
|
+
setupModelPlaceholder: "Enter model name, press Enter",
|
|
111
|
+
setupReasoningPlaceholder: "Pick reasoning level (low/medium/high), press Enter",
|
|
112
|
+
setupAuxModelPlaceholder: "Enter aux model, leave blank to skip",
|
|
113
|
+
setupConfirmPlaceholder: "y to confirm \xB7 n to redo",
|
|
114
|
+
setupStepApiKey: "Setup \xB7 API key",
|
|
115
|
+
setupStepBaseUrl: "Setup \xB7 Base URL",
|
|
116
|
+
setupStepModel: "Setup \xB7 Model",
|
|
117
|
+
setupStepReasoning: "Setup \xB7 Reasoning",
|
|
118
|
+
setupStepAuxModel: "Setup \xB7 Aux model",
|
|
119
|
+
setupStepConfirm: "Setup \xB7 Confirm",
|
|
120
|
+
permissionPlaceholder: "Choose: y allow \xB7 n deny \xB7 d details \xB7 Esc cancel",
|
|
121
|
+
permissionActionYes: "Allow",
|
|
122
|
+
permissionActionNo: "Deny",
|
|
123
|
+
permissionActionDetails: "Details",
|
|
124
|
+
permissionActionCancel: "Cancel",
|
|
125
|
+
submittedHint: "Submitted through the shared TUI controller.",
|
|
126
|
+
setupHint: 'No model configured. Press Enter, or say "configure provider".',
|
|
127
|
+
routeTitle: "Project model route needs attention",
|
|
128
|
+
routeSummary: (problem) => `${problem}. This is a project-scoped route/settings issue; do not re-enter the user API key.`,
|
|
129
|
+
routeNextAction: "Use /model doctor for details, or update this repo's .linghun/settings.json.",
|
|
130
|
+
trustUnknown: "trust?",
|
|
131
|
+
trustTrusted: "trusted",
|
|
132
|
+
trustRestricted: "restricted",
|
|
133
|
+
index: (status) => `Index: ${status}`,
|
|
134
|
+
background: (count) => `Background: ${count}`,
|
|
135
|
+
backgroundShort: (count) => `BG:${count}`,
|
|
136
|
+
latestOutputTitle: "Latest output",
|
|
137
|
+
noVisibleOutput: "No visible output.",
|
|
138
|
+
latestOutputNext: `Press ${TOGGLE_DETAILS_KEYBIND} for full runtime output (or /details).`,
|
|
139
|
+
detailsHint: `${TOGGLE_DETAILS_KEYBIND} for details`,
|
|
140
|
+
errorTitle: (tool) => `${tool} failed`,
|
|
141
|
+
errorDetailsHint: `${TOGGLE_DETAILS_KEYBIND} for full error`,
|
|
142
|
+
activityError: "Request failed. Retry or use /model doctor.",
|
|
143
|
+
activityCompleted: "Completed.",
|
|
144
|
+
denied: (tool) => `Denied ${tool}; tool was not executed.`,
|
|
145
|
+
cancelled: (tool) => `Cancelled ${tool}; tool was not executed.`
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
function createShellViewModel(context, options = {}) {
|
|
149
|
+
const language = context.language;
|
|
150
|
+
const width = normalizeWidth(options.width);
|
|
151
|
+
const height = normalizeHeight(options.height);
|
|
152
|
+
const projectName = truncateMiddle(
|
|
153
|
+
basename(context.projectPath) || context.projectPath,
|
|
154
|
+
width <= 40 ? 18 : 28
|
|
155
|
+
);
|
|
156
|
+
const setupNeeded = options.setupNeeded ?? false;
|
|
157
|
+
const text = shellText[language];
|
|
158
|
+
const hasCommandPanel = Boolean(context.commandPanelState);
|
|
159
|
+
const effectiveViewMode = options.viewMode ?? (options.submitted ? "pending" : options.outputBlocks?.length || options.activity || options.permission || options.denialFeedback || hasCommandPanel ? "task" : "home");
|
|
160
|
+
const effectiveActivity = options.activity ?? (options.submitted ? {
|
|
161
|
+
phase: "thinking",
|
|
162
|
+
text: language === "en-US" ? "Submitting request\u2026" : "\u63D0\u4EA4\u8BF7\u6C42\u2026",
|
|
163
|
+
language,
|
|
164
|
+
elapsed: formatElapsedSince(
|
|
165
|
+
new Date(options.submittedStartedAt ?? Date.now()).toISOString()
|
|
166
|
+
)
|
|
167
|
+
} : context.lastModelRequest ? deriveBackgroundActivityFallback(context, language) : void 0);
|
|
168
|
+
const setupActiveFlow = Boolean(context.pendingModelSetup?.step);
|
|
169
|
+
const setupHint = setupNeeded && effectiveViewMode !== "home" && !setupActiveFlow ? text.setupHint : void 0;
|
|
170
|
+
const blocks = [];
|
|
171
|
+
const ctrlOExpandState = context.ctrlOExpandState;
|
|
172
|
+
if (options.projectRouteProblem) {
|
|
173
|
+
blocks.push(createProjectRouteBlock(language, options.projectRouteProblem));
|
|
174
|
+
}
|
|
175
|
+
const taskRuntimeSummary = void 0;
|
|
176
|
+
if (!options.permission && !setupActiveFlow) {
|
|
177
|
+
const allOutputBlocks = options.outputBlocks ?? [];
|
|
178
|
+
const isEmptyAssistantStreamBlock = (b) => b.keep === true && b.kind === "details" && (b.fullText ?? "").trim().length === 0 && !b.title;
|
|
179
|
+
const isEphemeral = (b) => !b.keep && b.status !== "fail" && b.status !== "blocked";
|
|
180
|
+
const ephemeralIndices = allOutputBlocks.map((b, i) => isEphemeral(b) ? i : -1).filter((i) => i >= 0);
|
|
181
|
+
const maxEphemeral = 20;
|
|
182
|
+
const dropEphemeralIndices = new Set(
|
|
183
|
+
ephemeralIndices.length > maxEphemeral ? ephemeralIndices.slice(0, ephemeralIndices.length - maxEphemeral) : []
|
|
184
|
+
);
|
|
185
|
+
const selectedBlocks = allOutputBlocks.filter((b, i) => {
|
|
186
|
+
if (isEmptyAssistantStreamBlock(b)) return false;
|
|
187
|
+
if (dropEphemeralIndices.has(i)) return false;
|
|
188
|
+
return true;
|
|
189
|
+
});
|
|
190
|
+
const groupedBlocks = groupTranscriptToolBlocks(selectedBlocks, language);
|
|
191
|
+
const outputWithHints = groupedBlocks.map(
|
|
192
|
+
(b) => applyCtrlOExpandState(addDetailsHint(b, language), ctrlOExpandState)
|
|
193
|
+
);
|
|
194
|
+
blocks.push(...outputWithHints);
|
|
195
|
+
}
|
|
196
|
+
if (options.denialFeedback) {
|
|
197
|
+
const denialText = options.denialFeedback.kind === "denied" ? text.denied(options.denialFeedback.toolName) : text.cancelled(options.denialFeedback.toolName);
|
|
198
|
+
blocks.push({
|
|
199
|
+
id: "denial-feedback",
|
|
200
|
+
kind: "details",
|
|
201
|
+
status: "partial",
|
|
202
|
+
title: denialText,
|
|
203
|
+
summary: denialText
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
const fittedBlocks = blocks.map((block) => fitBlockToWidth(block, width));
|
|
207
|
+
const transcriptSelectionState = context.transcriptSelectionState;
|
|
208
|
+
const transcriptRows = transcriptSelectionState ? buildTranscriptScreenBuffer(fittedBlocks, Math.max(8, width - 4)).rows : [];
|
|
209
|
+
const fullFittedBlocks = transcriptSelectionState ? fittedBlocks.map((block) => {
|
|
210
|
+
const selectionLineIndexes = selectionLineIndexesForBlock(
|
|
211
|
+
transcriptSelectionState,
|
|
212
|
+
transcriptRows,
|
|
213
|
+
block.id
|
|
214
|
+
);
|
|
215
|
+
const selectionLineRanges = selectionLineRangesForBlock(
|
|
216
|
+
transcriptSelectionState,
|
|
217
|
+
transcriptRows,
|
|
218
|
+
block.id
|
|
219
|
+
);
|
|
220
|
+
return selectionLineIndexes.length > 0 || selectionLineRanges.length > 0 ? { ...block, selectionLineIndexes, selectionLineRanges } : block;
|
|
221
|
+
}) : fittedBlocks;
|
|
222
|
+
const viewMode = effectiveViewMode;
|
|
223
|
+
const homeVision = "";
|
|
224
|
+
const setupStep = context.pendingModelSetup?.step;
|
|
225
|
+
const setupActive = Boolean(setupStep);
|
|
226
|
+
const setupPlaceholderByStep = {
|
|
227
|
+
apiKey: text.setupApiKeyPlaceholder,
|
|
228
|
+
baseUrl: text.setupBaseUrlPlaceholder,
|
|
229
|
+
model: text.setupModelPlaceholder,
|
|
230
|
+
reasoning: text.setupReasoningPlaceholder,
|
|
231
|
+
auxModel: text.setupAuxModelPlaceholder,
|
|
232
|
+
confirm: text.setupConfirmPlaceholder
|
|
233
|
+
};
|
|
234
|
+
const setupStepLabelByStep = {
|
|
235
|
+
apiKey: text.setupStepApiKey,
|
|
236
|
+
baseUrl: text.setupStepBaseUrl,
|
|
237
|
+
model: text.setupStepModel,
|
|
238
|
+
reasoning: text.setupStepReasoning,
|
|
239
|
+
auxModel: text.setupStepAuxModel,
|
|
240
|
+
confirm: text.setupStepConfirm
|
|
241
|
+
};
|
|
242
|
+
const composerPlaceholder = options.permission ? text.permissionPlaceholder : setupStep ? setupPlaceholderByStep[setupStep] ?? text.placeholder : text.placeholder;
|
|
243
|
+
const composerSetupStepLabel = setupStep ? setupStepLabelByStep[setupStep] : void 0;
|
|
244
|
+
const cyclePermHint = language === "en-US" ? "(Shift+Tab switch mode)" : "\uFF08Shift+Tab \u5207\u6362\u6A21\u5F0F\uFF09";
|
|
245
|
+
const taskFooter = viewMode === "home" ? void 0 : buildTaskFooterView({
|
|
246
|
+
language,
|
|
247
|
+
width,
|
|
248
|
+
permissionModeLabel: formatPermissionModeLabel(context.permissionMode, language),
|
|
249
|
+
permissionMode: context.permissionMode,
|
|
250
|
+
cyclePermHint,
|
|
251
|
+
effectiveModel: context.model,
|
|
252
|
+
setupNeeded,
|
|
253
|
+
cacheHitRate: context.cache?.history?.at(-1)?.hitRate ?? null,
|
|
254
|
+
indexStatus: context.index.status,
|
|
255
|
+
reasoningLevel: options.reasoningLevel,
|
|
256
|
+
reasoningSent: options.reasoningSent,
|
|
257
|
+
estimatedCostCny: sumFiniteNumbers(
|
|
258
|
+
(context.roleUsage ?? []).map((usage) => usage.estimatedCny)
|
|
259
|
+
),
|
|
260
|
+
contextUsageLabel: context.cache.compactPressure ? calculateContextPercentages(
|
|
261
|
+
Math.ceil(context.cache.compactPressure.estimatedChars / 4),
|
|
262
|
+
Math.ceil(context.cache.compactPressure.maxChars / 4)
|
|
263
|
+
).label : void 0,
|
|
264
|
+
isRemoteMode: context.remote?.enabled ?? false
|
|
265
|
+
});
|
|
266
|
+
const failBlocksForSuggestions = fullFittedBlocks.filter(
|
|
267
|
+
(b) => b.status === "fail" || b.status === "blocked"
|
|
268
|
+
);
|
|
269
|
+
const taskSuggestions = viewMode === "home" ? void 0 : buildTaskSuggestions({
|
|
270
|
+
language,
|
|
271
|
+
setupHint,
|
|
272
|
+
failBlocks: failBlocksForSuggestions,
|
|
273
|
+
slashCandidates: options.slashCandidates
|
|
274
|
+
// 修正 v3 #6:不在 SuggestionBar 暴露 14 panel 作为 configHints
|
|
275
|
+
}).filter((item) => !context.handledTaskSuggestionIds?.has(item.id));
|
|
276
|
+
const taskSuggestionCursor = taskSuggestions && taskSuggestions.length > 0 ? Math.max(
|
|
277
|
+
0,
|
|
278
|
+
Math.min(context.taskSuggestionCursor ?? 0, Math.max(0, taskSuggestions.length - 1))
|
|
279
|
+
) : 0;
|
|
280
|
+
const configPanel = options.configPanelState ? mapConfigPanelState(options.configPanelState, language) : void 0;
|
|
281
|
+
const commandPanel = context.commandPanelState ?? void 0;
|
|
282
|
+
const transcriptScroll = effectiveViewMode === "home" ? void 0 : context.transcriptScrollState ?? {
|
|
283
|
+
scrollOffset: 0,
|
|
284
|
+
stickToBottom: true
|
|
285
|
+
};
|
|
286
|
+
updateUnseenTranscriptCount(context, effectiveViewMode, transcriptScroll, fullFittedBlocks.length);
|
|
287
|
+
const agentProgressTree = buildAgentProgressTreeView(context);
|
|
288
|
+
const taskListView = buildTaskListView(context);
|
|
289
|
+
const visibleWorkState = deriveVisibleWorkState(context);
|
|
290
|
+
const workflowProgressView = visibleWorkState.multiAgentWorkflowRunning ? void 0 : buildWorkflowProgressView(context);
|
|
291
|
+
const backgroundTaskOverlay = buildBackgroundTaskOverlayView(
|
|
292
|
+
context,
|
|
293
|
+
options.backgroundSummaries ?? []
|
|
294
|
+
);
|
|
295
|
+
const unseenMessageCount = effectiveViewMode === "home" || !visibleWorkState.scrollDetached ? 0 : visibleWorkState.unseenCount;
|
|
296
|
+
const streamingAssistantText = selectStreamingAssistantText(context, fullFittedBlocks);
|
|
297
|
+
return {
|
|
298
|
+
language,
|
|
299
|
+
projectName,
|
|
300
|
+
projectPath: context.projectPath,
|
|
301
|
+
keybindings: context.keybindings ?? DEFAULT_KEYBINDINGS,
|
|
302
|
+
width,
|
|
303
|
+
height,
|
|
304
|
+
mode: "ink",
|
|
305
|
+
themeMode: options.noColor ? "no-color" : "color",
|
|
306
|
+
viewMode,
|
|
307
|
+
brand: text.brand,
|
|
308
|
+
homeVision,
|
|
309
|
+
setupHint,
|
|
310
|
+
activity: effectiveActivity,
|
|
311
|
+
permission: options.permission ? withPermissionActions(options.permission, language, context) : void 0,
|
|
312
|
+
status: {
|
|
313
|
+
project: text.project(projectName),
|
|
314
|
+
model: text.model(truncateMiddle(context.model || "--", width <= 40 ? 12 : 22)),
|
|
315
|
+
permission: text.permission(formatPermissionModeLabel(context.permissionMode, language)),
|
|
316
|
+
trust: text.trust(formatTrust(context, language)),
|
|
317
|
+
index: formatIndex(context.index.status, language),
|
|
318
|
+
background: formatBackground(
|
|
319
|
+
context.backgroundTasks.filter((task) => task.status === "running").length,
|
|
320
|
+
language,
|
|
321
|
+
width
|
|
322
|
+
)
|
|
323
|
+
},
|
|
324
|
+
composer: {
|
|
325
|
+
placeholder: composerPlaceholder,
|
|
326
|
+
taskPlaceholder: text.taskPlaceholder,
|
|
327
|
+
submittedHint: text.submittedHint,
|
|
328
|
+
masking: context.pendingModelSetup?.step === "apiKey",
|
|
329
|
+
setupActive,
|
|
330
|
+
setupStep: composerSetupStepLabel,
|
|
331
|
+
busy: computeComposerBusy({
|
|
332
|
+
submitted: options.submitted,
|
|
333
|
+
activity: effectiveActivity,
|
|
334
|
+
context
|
|
335
|
+
}),
|
|
336
|
+
busyHint: computeComposerBusy({
|
|
337
|
+
submitted: options.submitted,
|
|
338
|
+
activity: effectiveActivity,
|
|
339
|
+
context
|
|
340
|
+
}) ? language === "en-US" ? "Still working on the previous request. Press Ctrl+C to interrupt, then send again." : "\u6B63\u5728\u5904\u7406\u4E0A\u4E00\u6761\uFF0C\u6309 Ctrl+C \u53EF\u4E2D\u65AD\uFF0C\u7A0D\u540E\u518D\u53D1\u3002" : void 0
|
|
341
|
+
},
|
|
342
|
+
blocks: fullFittedBlocks,
|
|
343
|
+
transcriptVirtualRange: void 0,
|
|
344
|
+
streamingAssistantText,
|
|
345
|
+
ctrlOExpand: ctrlOExpandState?.active ? { active: true, ...ctrlOExpandState.blockId ? { blockId: ctrlOExpandState.blockId } : {} } : { active: false },
|
|
346
|
+
limitations: options.limitations ?? [],
|
|
347
|
+
taskFooter,
|
|
348
|
+
taskRuntimeSummary: taskRuntimeSummary ? fitBlockToWidth(taskRuntimeSummary, width) : void 0,
|
|
349
|
+
agentProgressTree,
|
|
350
|
+
taskListView,
|
|
351
|
+
visibleWorkState,
|
|
352
|
+
workflowProgressView,
|
|
353
|
+
backgroundTaskOverlay,
|
|
354
|
+
taskSuggestions: taskSuggestions && taskSuggestions.length > 0 ? taskSuggestions : void 0,
|
|
355
|
+
taskSuggestionCursor,
|
|
356
|
+
configPanel,
|
|
357
|
+
commandPanel,
|
|
358
|
+
transcriptScroll,
|
|
359
|
+
transcriptViewportGeometry: context.transcriptViewportGeometry,
|
|
360
|
+
unseenMessageCount,
|
|
361
|
+
helpPanel: (() => {
|
|
362
|
+
const state = context.helpPanelState;
|
|
363
|
+
if (!state) return void 0;
|
|
364
|
+
return buildHelpPanelData(state.group, state.cursor, state.scrollOffset ?? 0, language);
|
|
365
|
+
})(),
|
|
366
|
+
btwPanel: context.btwPanelState,
|
|
367
|
+
sessionsPanel: context.sessionsPanelState,
|
|
368
|
+
notifications: (() => {
|
|
369
|
+
const ctxNotifs = context.notifications;
|
|
370
|
+
if (!ctxNotifs || ctxNotifs.length === 0) return void 0;
|
|
371
|
+
const now = Date.now();
|
|
372
|
+
const live = ctxNotifs.filter((n) => {
|
|
373
|
+
if (typeof n.timeoutMs !== "number") return true;
|
|
374
|
+
if (typeof n.createdAt !== "number") return true;
|
|
375
|
+
return n.createdAt + n.timeoutMs > now;
|
|
376
|
+
});
|
|
377
|
+
if (live.length !== ctxNotifs.length) {
|
|
378
|
+
context.notifications = live;
|
|
379
|
+
}
|
|
380
|
+
return live.length > 0 ? [...live] : void 0;
|
|
381
|
+
})()
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
function sumFiniteNumbers(values) {
|
|
385
|
+
const finite = values.filter((value) => Number.isFinite(value));
|
|
386
|
+
if (finite.length === 0) return void 0;
|
|
387
|
+
return finite.reduce((total, value) => total + value, 0);
|
|
388
|
+
}
|
|
389
|
+
function selectStreamingAssistantText(context, blocks) {
|
|
390
|
+
if (context.briefMode) return void 0;
|
|
391
|
+
const streaming = context.streamingAssistant;
|
|
392
|
+
if (!streaming) return void 0;
|
|
393
|
+
const text = streaming.text.trimEnd();
|
|
394
|
+
if (!text) return void 0;
|
|
395
|
+
const matchingFinalBlock = blocks.find(
|
|
396
|
+
(block) => block.id === streaming.id && block.messageKind === "assistant_text"
|
|
397
|
+
);
|
|
398
|
+
if ((matchingFinalBlock?.fullText ?? "").trimEnd() === text) return void 0;
|
|
399
|
+
return streaming.text;
|
|
400
|
+
}
|
|
401
|
+
function groupTranscriptToolBlocks(blocks, language) {
|
|
402
|
+
const result = [];
|
|
403
|
+
let group = [];
|
|
404
|
+
const flush = () => {
|
|
405
|
+
if (group.length >= 3) {
|
|
406
|
+
result.push(createGroupedToolBlock(group, language));
|
|
407
|
+
} else {
|
|
408
|
+
result.push(...group);
|
|
409
|
+
}
|
|
410
|
+
group = [];
|
|
411
|
+
};
|
|
412
|
+
for (const block of blocks) {
|
|
413
|
+
if (classifyToolGroupingBlock(block)) {
|
|
414
|
+
group.push(block);
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
flush();
|
|
418
|
+
result.push(block);
|
|
419
|
+
}
|
|
420
|
+
flush();
|
|
421
|
+
return result;
|
|
422
|
+
}
|
|
423
|
+
function classifyToolGroupingBlock(block) {
|
|
424
|
+
if (block.status === "fail" || block.status === "blocked") return void 0;
|
|
425
|
+
const text = `${block.title}
|
|
426
|
+
${block.summary}
|
|
427
|
+
${block.fullText ?? ""}`.trim();
|
|
428
|
+
if (/^(?:Read\(|读取摘要|Read summary)/iu.test(text)) return "read";
|
|
429
|
+
if (/^(?:Grep\(|Glob\(|搜索摘要|文件搜索摘要|Search summary|File search summary)/iu.test(text)) {
|
|
430
|
+
return "search";
|
|
431
|
+
}
|
|
432
|
+
if (/(?:已发现\s+\d+\s+个扩展工具|扩展工具调用(?:完成|失败)|Found\s+\d+\s+extension tool|Extension tool (?:finished|call failed))/iu.test(
|
|
433
|
+
text
|
|
434
|
+
)) {
|
|
435
|
+
return "extension";
|
|
436
|
+
}
|
|
437
|
+
if (/(?:已(?:启动|停止|检查|更新)后台智能体|智能体已完成|background agent|agent completed|Checked background agents|Stopped \d+ background agent)/iu.test(
|
|
438
|
+
text
|
|
439
|
+
)) {
|
|
440
|
+
return "agent";
|
|
441
|
+
}
|
|
442
|
+
if (/(?:工作流已完成|已启动后台工作流|工作流结果已记录|Workflow completed|Started a background workflow|Recorded the workflow result|多智能体协作|Multi-agent collaboration)/iu.test(
|
|
443
|
+
text
|
|
444
|
+
)) {
|
|
445
|
+
return "workflow";
|
|
446
|
+
}
|
|
447
|
+
if (/(?:验证已结束|Verification finished)/iu.test(text)) return "verification";
|
|
448
|
+
return void 0;
|
|
449
|
+
}
|
|
450
|
+
function createGroupedToolBlock(blocks, language) {
|
|
451
|
+
const counts = /* @__PURE__ */ new Map();
|
|
452
|
+
for (const block of blocks) {
|
|
453
|
+
const kind = classifyToolGroupingBlock(block);
|
|
454
|
+
if (!kind) continue;
|
|
455
|
+
counts.set(kind, (counts.get(kind) ?? 0) + 1);
|
|
456
|
+
}
|
|
457
|
+
const summary = formatToolGroupSummary(counts, blocks.length, language);
|
|
458
|
+
const details = blocks.map((block, index) => {
|
|
459
|
+
const body = (block.fullText ?? block.summary ?? block.title).trim();
|
|
460
|
+
return `${index + 1}. ${body}`;
|
|
461
|
+
}).join("\n\n");
|
|
462
|
+
return {
|
|
463
|
+
id: `tool-group-${blocks[0]?.id ?? Date.now()}-${blocks.length}`,
|
|
464
|
+
kind: "tool",
|
|
465
|
+
status: blocks.some((block) => block.status === "partial") ? "partial" : "info",
|
|
466
|
+
title: "",
|
|
467
|
+
summary,
|
|
468
|
+
fullText: details,
|
|
469
|
+
nextAction: shellText[language].detailsHint,
|
|
470
|
+
ctrlOCollapsed: true,
|
|
471
|
+
messageKind: "tool_result_success"
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function formatToolGroupSummary(counts, fallbackCount, language) {
|
|
475
|
+
const ordered = [
|
|
476
|
+
"read",
|
|
477
|
+
"search",
|
|
478
|
+
"extension",
|
|
479
|
+
"agent",
|
|
480
|
+
"workflow",
|
|
481
|
+
"verification"
|
|
482
|
+
];
|
|
483
|
+
const zhLabels = {
|
|
484
|
+
read: "\u8BFB\u53D6",
|
|
485
|
+
search: "\u641C\u7D22",
|
|
486
|
+
extension: "\u6269\u5C55\u5DE5\u5177",
|
|
487
|
+
agent: "\u540E\u53F0\u667A\u80FD\u4F53",
|
|
488
|
+
workflow: "\u5DE5\u4F5C\u6D41",
|
|
489
|
+
verification: "\u9A8C\u8BC1"
|
|
490
|
+
};
|
|
491
|
+
const enLabels = {
|
|
492
|
+
read: "read",
|
|
493
|
+
search: "search",
|
|
494
|
+
extension: "extension",
|
|
495
|
+
agent: "agent",
|
|
496
|
+
workflow: "workflow",
|
|
497
|
+
verification: "verification"
|
|
498
|
+
};
|
|
499
|
+
const parts = ordered.flatMap((kind) => {
|
|
500
|
+
const count = counts.get(kind) ?? 0;
|
|
501
|
+
if (count <= 0) return [];
|
|
502
|
+
return language === "en-US" ? [`${enLabels[kind]} ${count}`] : [`${zhLabels[kind]} ${count} \u9879`];
|
|
503
|
+
});
|
|
504
|
+
if (language === "en-US") {
|
|
505
|
+
return `Tool activity grouped: ${parts.join(", ") || `${fallbackCount} item(s)`}.`;
|
|
506
|
+
}
|
|
507
|
+
return `\u5DE5\u5177\u6D3B\u52A8\u5DF2\u5206\u7EC4\uFF1A${parts.join("\uFF0C") || `${fallbackCount} \u9879`}\u3002`;
|
|
508
|
+
}
|
|
509
|
+
function updateUnseenTranscriptCount(context, viewMode, scroll, blockCount) {
|
|
510
|
+
const state = context;
|
|
511
|
+
const previousCount = state.lastTranscriptBlockCount ?? blockCount;
|
|
512
|
+
const delta = Math.max(0, blockCount - previousCount);
|
|
513
|
+
const detached = viewMode !== "home" && scroll?.stickToBottom === false;
|
|
514
|
+
if (!detached) {
|
|
515
|
+
state.unseenMessageCount = 0;
|
|
516
|
+
} else if (delta > 0) {
|
|
517
|
+
state.unseenMessageCount = (state.unseenMessageCount ?? 0) + delta;
|
|
518
|
+
}
|
|
519
|
+
state.lastTranscriptBlockCount = blockCount;
|
|
520
|
+
}
|
|
521
|
+
var CONFIG_PANELS = [
|
|
522
|
+
{
|
|
523
|
+
id: "model",
|
|
524
|
+
slash: "/model",
|
|
525
|
+
titleZh: "\u6A21\u578B",
|
|
526
|
+
titleEn: "Model",
|
|
527
|
+
summaryZh: "\u67E5\u770B\u5F53\u524D\u6A21\u578B / provider / \u89D2\u8272\u8DEF\u7531\u3002",
|
|
528
|
+
summaryEn: "Show current model / provider / role routing."
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
id: "language",
|
|
532
|
+
slash: "/language",
|
|
533
|
+
titleZh: "\u8BED\u8A00",
|
|
534
|
+
titleEn: "Language",
|
|
535
|
+
summaryZh: "\u5207\u6362 zh-CN / en-US \u4F53\u9A8C\u3002",
|
|
536
|
+
summaryEn: "Switch zh-CN / en-US UI."
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
id: "permissions",
|
|
540
|
+
slash: "/permissions",
|
|
541
|
+
titleZh: "\u6743\u9650\u89C4\u5219",
|
|
542
|
+
titleEn: "Permissions",
|
|
543
|
+
summaryZh: "\u67E5\u770B / \u7F16\u8F91 allow / ask / deny \u89C4\u5219\u3002",
|
|
544
|
+
summaryEn: "View / edit allow / ask / deny rules."
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
id: "memory",
|
|
548
|
+
slash: "/memory",
|
|
549
|
+
titleZh: "\u8BB0\u5FC6",
|
|
550
|
+
titleEn: "Memory",
|
|
551
|
+
summaryZh: "\u67E5\u770B LINGHUN.md / \u5019\u9009 / \u5DF2\u63A5\u53D7\u8BB0\u5FC6\u3002",
|
|
552
|
+
summaryEn: "Show LINGHUN.md / candidate / accepted memory."
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
id: "index",
|
|
556
|
+
slash: "/index",
|
|
557
|
+
titleZh: "\u7D22\u5F15",
|
|
558
|
+
titleEn: "Index",
|
|
559
|
+
summaryZh: "\u67E5\u770B codebase \u7D22\u5F15\u72B6\u6001\u4E0E\u8BCA\u65AD\u3002",
|
|
560
|
+
summaryEn: "Show codebase index status and doctor."
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
id: "mcp",
|
|
564
|
+
slash: "/mcp",
|
|
565
|
+
titleZh: "MCP",
|
|
566
|
+
titleEn: "MCP",
|
|
567
|
+
summaryZh: "\u67E5\u770B MCP server \u4E0E\u5DE5\u5177\u3002",
|
|
568
|
+
summaryEn: "Show MCP servers and tools."
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
id: "cache",
|
|
572
|
+
slash: "/cache",
|
|
573
|
+
titleZh: "\u7F13\u5B58",
|
|
574
|
+
titleEn: "Cache",
|
|
575
|
+
summaryZh: "\u67E5\u770B\u7F13\u5B58\u547D\u4E2D\u4E0E\u65E5\u5FD7\u3002",
|
|
576
|
+
summaryEn: "Show cache hit and log."
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
id: "background",
|
|
580
|
+
slash: "/background",
|
|
581
|
+
titleZh: "\u540E\u53F0\u4EFB\u52A1",
|
|
582
|
+
titleEn: "Background",
|
|
583
|
+
summaryZh: "\u67E5\u770B\u540E\u53F0 job \u4E0E\u8FDC\u7A0B\u4EFB\u52A1\u3002",
|
|
584
|
+
summaryEn: "Show background jobs and remote tasks."
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
id: "remote",
|
|
588
|
+
slash: "/remote",
|
|
589
|
+
titleZh: "\u8FDC\u7A0B",
|
|
590
|
+
titleEn: "Remote",
|
|
591
|
+
summaryZh: "\u67E5\u770B\u8FDC\u7A0B\u4F1A\u8BDD\u4E0E\u63A7\u5236\u5E73\u9762\u3002",
|
|
592
|
+
summaryEn: "Show remote sessions and control plane."
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
id: "hooks",
|
|
596
|
+
slash: "/doctor",
|
|
597
|
+
titleZh: "Hooks",
|
|
598
|
+
titleEn: "Hooks",
|
|
599
|
+
summaryZh: "\u67E5\u770B hooks \u542F\u7528\u4E0E\u8BCA\u65AD\u3002",
|
|
600
|
+
summaryEn: "Show hook enablement and doctor."
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
id: "plugins",
|
|
604
|
+
slash: "/plugins",
|
|
605
|
+
titleZh: "\u63D2\u4EF6",
|
|
606
|
+
titleEn: "Plugins",
|
|
607
|
+
summaryZh: "\u67E5\u770B\u63D2\u4EF6 manifest \u4E0E\u8BCA\u65AD\u3002",
|
|
608
|
+
summaryEn: "Show plugin manifests and doctor."
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
id: "skills",
|
|
612
|
+
slash: "/skills",
|
|
613
|
+
titleZh: "\u6280\u80FD",
|
|
614
|
+
titleEn: "Skills",
|
|
615
|
+
summaryZh: "\u67E5\u770B\u672C\u5730 skill \u6458\u8981\u3002",
|
|
616
|
+
summaryEn: "Show local skill summaries."
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
id: "workflows",
|
|
620
|
+
slash: "/workflows",
|
|
621
|
+
titleZh: "\u5DE5\u4F5C\u6D41",
|
|
622
|
+
titleEn: "Workflows",
|
|
623
|
+
summaryZh: "\u67E5\u770B\u53EF\u7528\u5DE5\u4F5C\u6D41\u6A21\u677F\u3002",
|
|
624
|
+
summaryEn: "Show available workflow templates."
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
id: "trust",
|
|
628
|
+
slash: "/trust",
|
|
629
|
+
titleZh: "\u4FE1\u4EFB",
|
|
630
|
+
titleEn: "Trust",
|
|
631
|
+
summaryZh: "\u67E5\u770B / \u8C03\u6574\u672C\u9879\u76EE\u4FE1\u4EFB\u7EA7\u522B\u3002",
|
|
632
|
+
summaryEn: "Show / adjust project trust level."
|
|
633
|
+
}
|
|
634
|
+
];
|
|
635
|
+
function buildConfigPanelActions(panelId, language) {
|
|
636
|
+
const isEn = language === "en-US";
|
|
637
|
+
if (panelId === "language") {
|
|
638
|
+
return [
|
|
639
|
+
{ id: "lang-zh", label: isEn ? "Switch to Chinese (zh-CN)" : "\u5207\u6362\u5230\u4E2D\u6587 (zh-CN)" },
|
|
640
|
+
{ id: "lang-en", label: isEn ? "Switch to English (en-US)" : "\u5207\u6362\u5230\u82F1\u6587 (en-US)" }
|
|
641
|
+
];
|
|
642
|
+
}
|
|
643
|
+
return [];
|
|
644
|
+
}
|
|
645
|
+
function mapConfigPanelState(state, language) {
|
|
646
|
+
if (state.phase === "panel_detail") {
|
|
647
|
+
const panel = CONFIG_PANELS.find((p) => p.id === state.panelId);
|
|
648
|
+
if (!panel) return void 0;
|
|
649
|
+
const actions = buildConfigPanelActions(state.panelId, language);
|
|
650
|
+
return {
|
|
651
|
+
phase: "panel_detail",
|
|
652
|
+
panel: {
|
|
653
|
+
id: panel.id,
|
|
654
|
+
title: language === "en-US" ? panel.titleEn : panel.titleZh,
|
|
655
|
+
summary: language === "en-US" ? panel.summaryEn : panel.summaryZh
|
|
656
|
+
},
|
|
657
|
+
actionCursor: Math.min(Math.max(0, state.actionCursor), Math.max(0, actions.length - 1)),
|
|
658
|
+
scrollOffset: state.scrollOffset ?? 0,
|
|
659
|
+
actions
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
const panels = CONFIG_PANELS.map((p) => ({
|
|
663
|
+
id: p.id,
|
|
664
|
+
slash: p.slash,
|
|
665
|
+
title: language === "en-US" ? p.titleEn : p.titleZh,
|
|
666
|
+
summary: language === "en-US" ? p.summaryEn : p.summaryZh
|
|
667
|
+
}));
|
|
668
|
+
const total = panels.length;
|
|
669
|
+
const cursor = total === 0 ? 0 : Math.min(Math.max(0, state.phase === "panel_list" ? state.cursor : 0), total - 1);
|
|
670
|
+
return { phase: "panel_list", cursor, scrollOffset: state.scrollOffset ?? 0, panels };
|
|
671
|
+
}
|
|
672
|
+
function computeComposerBusy(args) {
|
|
673
|
+
const { submitted, activity, context } = args;
|
|
674
|
+
const hasActiveAbort = Boolean(
|
|
675
|
+
context.activeAbortController
|
|
676
|
+
);
|
|
677
|
+
const phase = activity?.phase;
|
|
678
|
+
if (phase === "thinking" || phase === "tool_running" || phase === "continuing" || phase === "permission_waiting") {
|
|
679
|
+
return true;
|
|
680
|
+
}
|
|
681
|
+
if (submitted) return true;
|
|
682
|
+
if (hasActiveAbort) return true;
|
|
683
|
+
return false;
|
|
684
|
+
}
|
|
685
|
+
function withPermissionActions(permission, language, context) {
|
|
686
|
+
if (permission.actions && permission.actions.length > 0) return permission;
|
|
687
|
+
const existingRules = context.permissions?.rules ?? [];
|
|
688
|
+
const elevation = buildElevationOptions({
|
|
689
|
+
toolName: permission.toolName,
|
|
690
|
+
scope: permission.scope,
|
|
691
|
+
risk: permission.risk,
|
|
692
|
+
existingRules,
|
|
693
|
+
language
|
|
694
|
+
});
|
|
695
|
+
const visibleIds = /* @__PURE__ */ new Set(["allow_once", "allow_always_tool", "deny", "details"]);
|
|
696
|
+
const actions = elevation.filter((o) => visibleIds.has(o.id)).map((o) => ({
|
|
697
|
+
id: o.id,
|
|
698
|
+
label: o.id === "allow_once" ? language === "zh-CN" ? "\u662F" : "Yes" : o.id === "allow_always_tool" ? buildAllowAlwaysLabel(permission.toolName, language) : o.id === "details" ? language === "zh-CN" ? "\u8BE6\u60C5" : "Details" : language === "zh-CN" ? "\u5426" : "No",
|
|
699
|
+
shortcut: o.shortcut
|
|
700
|
+
}));
|
|
701
|
+
return { ...permission, actions };
|
|
702
|
+
}
|
|
703
|
+
function buildOneShotPermissionActions(language) {
|
|
704
|
+
const isEn = language === "en-US";
|
|
705
|
+
return [
|
|
706
|
+
{ id: "allow_once", label: isEn ? "Yes" : "\u662F", shortcut: "y" },
|
|
707
|
+
{ id: "deny", label: isEn ? "No" : "\u5426", shortcut: "n" },
|
|
708
|
+
{ id: "details", label: isEn ? "Details" : "\u8BE6\u60C5", shortcut: "d" }
|
|
709
|
+
];
|
|
710
|
+
}
|
|
711
|
+
function buildAllowAlwaysLabel(toolName, language) {
|
|
712
|
+
const isEn = language === "en-US";
|
|
713
|
+
if (toolName === "Bash") {
|
|
714
|
+
return isEn ? "Allow future similar Bash actions" : "\u5141\u8BB8\u4EE5\u540E\u8FD9\u7C7B Bash \u64CD\u4F5C";
|
|
715
|
+
}
|
|
716
|
+
if (toolName === "Write" || toolName === "Edit" || toolName === "MultiEdit") {
|
|
717
|
+
return isEn ? "Allow future similar file changes" : "\u5141\u8BB8\u4EE5\u540E\u8FD9\u7C7B\u6587\u4EF6\u4FEE\u6539";
|
|
718
|
+
}
|
|
719
|
+
return isEn ? "Allow future similar actions" : "\u5141\u8BB8\u4EE5\u540E\u8FD9\u7C7B\u64CD\u4F5C";
|
|
720
|
+
}
|
|
721
|
+
function getComposerPlaceholder(language) {
|
|
722
|
+
return shellText[language].placeholder;
|
|
723
|
+
}
|
|
724
|
+
var EMBEDDED_FOLD_HINTS = [
|
|
725
|
+
"\u8F93\u51FA\u5DF2\u6298\u53E0\uFF0C\u6309 Ctrl+O \u5C55\u5F00\u3002",
|
|
726
|
+
"Output folded. Press Ctrl+O to expand."
|
|
727
|
+
];
|
|
728
|
+
function stripEmbeddedFoldHint(text) {
|
|
729
|
+
if (!text) return { text, stripped: false };
|
|
730
|
+
const lines = text.split("\n");
|
|
731
|
+
let stripped = false;
|
|
732
|
+
const kept = lines.filter((line) => {
|
|
733
|
+
const trimmed = line.replace(/^[-\s]+/, "").trim();
|
|
734
|
+
if (EMBEDDED_FOLD_HINTS.includes(trimmed) || /^\[stdout\]\s*\.\.\.\s*(?:更多输出已隐藏;按 Ctrl\+O 展开。|more output hidden; press Ctrl\+O to expand\.)$/iu.test(
|
|
735
|
+
trimmed
|
|
736
|
+
)) {
|
|
737
|
+
stripped = true;
|
|
738
|
+
return false;
|
|
739
|
+
}
|
|
740
|
+
return true;
|
|
741
|
+
});
|
|
742
|
+
return { text: kept.join("\n").trim(), stripped };
|
|
743
|
+
}
|
|
744
|
+
function hasPresenterHiddenSummary(text) {
|
|
745
|
+
if (/^\s*\.\.\.\s*(?:另有 \d+ 项在详情中。|\d+ more item\(s\) in details\.)/mu.test(text)) {
|
|
746
|
+
return true;
|
|
747
|
+
}
|
|
748
|
+
const firstLine = text.split(/\r?\n/u).find((line) => line.trim().length > 0) ?? "";
|
|
749
|
+
if (/^(?:Read\(|Read\b|读取)/u.test(firstLine)) {
|
|
750
|
+
const readTotalMatch = text.match(/(?:总计|total)\s+(\d+)\s+(?:行|line(?:\(s\))?)/iu);
|
|
751
|
+
if (readTotalMatch) {
|
|
752
|
+
const readTotal = Number(readTotalMatch[1]);
|
|
753
|
+
return Number.isFinite(readTotal) && readTotal > 100;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
const statMatch = text.match(
|
|
757
|
+
/^[-\s]*(?:(?:窗口|window)\s+(\d+)\/(\d+)\s+(?:行|line\(s\))|(\d+)\s+(?:行|line\(s\)))/mu
|
|
758
|
+
);
|
|
759
|
+
if (!statMatch) return false;
|
|
760
|
+
const shown = Number(statMatch[1] ?? statMatch[3]);
|
|
761
|
+
const total = statMatch[2] ? Number(statMatch[2]) : shown;
|
|
762
|
+
if (!Number.isFinite(shown) || !Number.isFinite(total)) return false;
|
|
763
|
+
if (/^(?:Bash\(|Bash\b)/u.test(firstLine)) return total > 5;
|
|
764
|
+
if (/^(?:Read\(|Read\b|读取)/u.test(firstLine)) return total > 100 || shown < total;
|
|
765
|
+
if (/^(?:Grep\b|Glob\b|找到\b|Found\b)/u.test(firstLine)) return total > 0;
|
|
766
|
+
if (/^(?:Write|Edit|MultiEdit)(?:\(|\b)/u.test(firstLine)) return true;
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
769
|
+
function createOutputBlock(text, language, id = `output-${Date.now()}`) {
|
|
770
|
+
const rawNormalized = sanitizeMainScreenLeakage(
|
|
771
|
+
redactSensitiveText(text.replace(/\r/g, "").trim()),
|
|
772
|
+
language
|
|
773
|
+
);
|
|
774
|
+
const foldHintStripped = stripEmbeddedFoldHint(rawNormalized);
|
|
775
|
+
const normalized = foldHintStripped.text;
|
|
776
|
+
const explicitFold = foldHintStripped.stripped;
|
|
777
|
+
const copy = shellText[language];
|
|
778
|
+
const summary = (explicitFold ? summarizeExplicitFold(normalized) : normalized) || copy.noVisibleOutput;
|
|
779
|
+
const nonEmptyLineCount = normalized.split("\n").filter((line) => line.trim().length > 0).length;
|
|
780
|
+
const toolResultLike = isToolResultLike(normalized);
|
|
781
|
+
const hasMore = explicitFold || hasPresenterHiddenSummary(normalized) || toolResultLike && normalized.length > 0 && (nonEmptyLineCount >= 6 || normalized.length > summary.length + 16);
|
|
782
|
+
return {
|
|
783
|
+
id,
|
|
784
|
+
kind: "details",
|
|
785
|
+
status: "info",
|
|
786
|
+
// D13E-P3 empty title: drop the fixed "最近输出" / "Latest output" title
|
|
787
|
+
// for normal outputs so ProductBlock renders only the summary line and
|
|
788
|
+
// adjacent normal outputs breathe instead of stacking duplicate banners.
|
|
789
|
+
title: "",
|
|
790
|
+
summary,
|
|
791
|
+
nextAction: hasMore ? copy.detailsHint : void 0,
|
|
792
|
+
// Preserve the full body so /details can reveal it. The summary keeps the
|
|
793
|
+
// first non-empty line for the inline block; multi-line outputs (e.g. the
|
|
794
|
+
// /model doctor body with provider.env merge / endpointPath / providers)
|
|
795
|
+
// are no longer truncated to the first line at this boundary.
|
|
796
|
+
fullText: normalized,
|
|
797
|
+
messageKind: toolResultLike ? "tool_result_success" : "assistant_text"
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
function isToolResultLike(text) {
|
|
801
|
+
return /^(?:工具\s+\w+\s+已完成|Tool\s+\w+\s+completed|(?:Bash|Read|Grep|Glob|Write|Edit|MultiEdit)\(|(?:Bash|Read|Grep|Glob|Write|Edit|MultiEdit|Todo|Diff)\s+(?:摘要|summary)|Todo[::]|搜索摘要|文件搜索摘要|读取摘要|Bash 已结束|Search summary|File search summary|Read summary|Bash finished)/u.test(
|
|
802
|
+
text.trim()
|
|
803
|
+
);
|
|
804
|
+
}
|
|
805
|
+
function summarizeExplicitFold(text) {
|
|
806
|
+
const lines = text.split("\n");
|
|
807
|
+
const nonEmpty = lines.filter((line) => line.trim().length > 0);
|
|
808
|
+
if (nonEmpty.length <= 1) return nonEmpty[0] ?? text;
|
|
809
|
+
return nonEmpty.slice(0, 5).join("\n");
|
|
810
|
+
}
|
|
811
|
+
function createCompactBoundaryBlock(preChars, postChars, language) {
|
|
812
|
+
const freedPct = preChars > 0 ? Math.round((preChars - postChars) / preChars * 100) : 0;
|
|
813
|
+
const freedK = Math.max(0, Math.round((preChars - postChars) / 1024));
|
|
814
|
+
const copy = shellText[language];
|
|
815
|
+
const title = language === "en-US" ? `Conversation compacted \xB7 ~${freedK}K chars freed (${freedPct}%)` : `\u5BF9\u8BDD\u5DF2\u538B\u7F29 \xB7 \u91CA\u653E\u7EA6 ${freedK}K \u5B57\u7B26 (${freedPct}%)`;
|
|
816
|
+
return {
|
|
817
|
+
id: `compact-boundary-${Date.now()}`,
|
|
818
|
+
kind: "details",
|
|
819
|
+
status: "info",
|
|
820
|
+
title,
|
|
821
|
+
summary: "",
|
|
822
|
+
messageKind: "compact_boundary"
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
function addDetailsHint(block, language) {
|
|
826
|
+
const copy = shellText[language];
|
|
827
|
+
const fullText = block.fullText ?? "";
|
|
828
|
+
const summary = block.summary ?? "";
|
|
829
|
+
const nonEmptyLines = fullText.split("\n").filter((line) => line.trim().length > 0).length;
|
|
830
|
+
const toolResultLike = isToolResultLike(fullText);
|
|
831
|
+
const messageKind = block.messageKind;
|
|
832
|
+
const foldableNonAssistant = messageKind !== void 0 && messageKind !== "assistant_text" && messageKind !== "assistant_thinking" && messageKind !== "user_text";
|
|
833
|
+
const isFailLike = block.status === "fail" || block.status === "blocked";
|
|
834
|
+
const hasMore = fullText.length > 0 && (Boolean(block.nextAction && /Ctrl\+O/i.test(block.nextAction)) || Boolean(block.ctrlOCollapsed) || isFailLike && (nonEmptyLines >= 2 || fullText.length > summary.length + 16) || foldableNonAssistant && nonEmptyLines >= 2 || toolResultLike && (nonEmptyLines >= 6 || fullText.length > summary.length + 16));
|
|
835
|
+
if (!hasMore) return block;
|
|
836
|
+
const existingCtrlOHint = block.nextAction && /Ctrl\+O/i.test(block.nextAction);
|
|
837
|
+
const nonCtrlOAction = block.nextAction && !existingCtrlOHint;
|
|
838
|
+
if (nonCtrlOAction) return block;
|
|
839
|
+
return {
|
|
840
|
+
...block,
|
|
841
|
+
nextAction: block.nextAction ?? (isFailLike ? copy.errorDetailsHint : copy.detailsHint),
|
|
842
|
+
ctrlOCollapsed: true
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
function applyCtrlOExpandState(block, state) {
|
|
846
|
+
if (!state?.active) return block;
|
|
847
|
+
if (state.blockId && state.blockId !== block.id) return block;
|
|
848
|
+
const fullText = (block.fullText ?? "").trim();
|
|
849
|
+
if (!fullText) return block;
|
|
850
|
+
return {
|
|
851
|
+
...block,
|
|
852
|
+
summary: fullText,
|
|
853
|
+
nextAction: void 0,
|
|
854
|
+
ctrlOCollapsed: false
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
function mapRequestActivityToView(context) {
|
|
858
|
+
const phase = context.requestActivityPhase;
|
|
859
|
+
if (!phase) return void 0;
|
|
860
|
+
const phaseMap = {
|
|
861
|
+
request_started: "thinking",
|
|
862
|
+
request_started_report: "thinking",
|
|
863
|
+
waiting_first_delta: "thinking",
|
|
864
|
+
provider_retrying: "thinking",
|
|
865
|
+
tool_running: "tool_running",
|
|
866
|
+
continuing_after_tool: "continuing",
|
|
867
|
+
verifying_final_answer: "continuing",
|
|
868
|
+
permission_waiting: "permission_waiting",
|
|
869
|
+
request_failed: "error",
|
|
870
|
+
error: "error",
|
|
871
|
+
failed: "error",
|
|
872
|
+
completed: "completed",
|
|
873
|
+
request_completed: "completed"
|
|
874
|
+
};
|
|
875
|
+
const mapped = phaseMap[phase];
|
|
876
|
+
if (!mapped) return void 0;
|
|
877
|
+
if (context.briefMode && (mapped === "thinking" || mapped === "continuing")) {
|
|
878
|
+
return void 0;
|
|
879
|
+
}
|
|
880
|
+
const toolName = context.requestActivityToolName;
|
|
881
|
+
const retryInfo = context.retryInfo;
|
|
882
|
+
const textMap = {
|
|
883
|
+
"zh-CN": {
|
|
884
|
+
thinking: "\u601D\u8003\u4E2D\u2026",
|
|
885
|
+
provider_retrying: retryInfo ? `\u91CD\u8BD5\u8BF7\u6C42 ${retryInfo.attempt}/${retryInfo.max} \xB7 ${retryInfo.delaySec}s \u540E\u7EE7\u7EED` : "\u91CD\u8BD5\u8BF7\u6C42\u2026",
|
|
886
|
+
tool_running: toolName ? `\u8FD0\u884C ${toolName}\u2026` : "\u8FD0\u884C\u5DE5\u5177\u2026",
|
|
887
|
+
continuing: "\u6574\u7406\u5DE5\u5177\u7ED3\u679C\u2026",
|
|
888
|
+
verifying_final_answer: "\u9A8C\u8BC1\u56DE\u7B54\u2026",
|
|
889
|
+
permission_waiting: "\u7B49\u5F85\u6743\u9650\u786E\u8BA4",
|
|
890
|
+
error: shellText["zh-CN"].activityError,
|
|
891
|
+
completed: shellText["zh-CN"].activityCompleted
|
|
892
|
+
},
|
|
893
|
+
"en-US": {
|
|
894
|
+
thinking: "Thinking\u2026",
|
|
895
|
+
provider_retrying: retryInfo ? `Retry request ${retryInfo.attempt}/${retryInfo.max} \xB7 ${retryInfo.delaySec}s remaining` : "Retrying\u2026",
|
|
896
|
+
tool_running: toolName ? `Running ${toolName}\u2026` : "Running tool\u2026",
|
|
897
|
+
continuing: "Reviewing tool result\u2026",
|
|
898
|
+
verifying_final_answer: "Verifying answer\u2026",
|
|
899
|
+
permission_waiting: "Waiting for permission",
|
|
900
|
+
error: shellText["en-US"].activityError,
|
|
901
|
+
completed: shellText["en-US"].activityCompleted
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
const texts = textMap[context.language] ?? textMap["en-US"];
|
|
905
|
+
const thinkingLabelMap = {
|
|
906
|
+
"zh-CN": {
|
|
907
|
+
request_started: "\u8FDE\u63A5\u6A21\u578B\u2026",
|
|
908
|
+
request_started_report: "\u751F\u6210\u62A5\u544A\u2026",
|
|
909
|
+
waiting_first_delta: "\u7B49\u5F85\u6A21\u578B\u54CD\u5E94\u2026"
|
|
910
|
+
},
|
|
911
|
+
"en-US": {
|
|
912
|
+
request_started: "Connecting model\u2026",
|
|
913
|
+
request_started_report: "Generating report\u2026",
|
|
914
|
+
waiting_first_delta: "Waiting for model response\u2026"
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
const thinkingLabels = thinkingLabelMap[context.language] ?? thinkingLabelMap["en-US"];
|
|
918
|
+
const startedAt = context.requestActivityStartedAt;
|
|
919
|
+
let elapsed;
|
|
920
|
+
if (startedAt && mapped !== "completed" && mapped !== "error") {
|
|
921
|
+
elapsed = formatElapsedSince(new Date(startedAt).toISOString());
|
|
922
|
+
}
|
|
923
|
+
return {
|
|
924
|
+
phase: mapped,
|
|
925
|
+
text: texts[phase] ?? texts[mapped] ?? "",
|
|
926
|
+
toolName: toolName ?? void 0,
|
|
927
|
+
toolTarget: context.requestActivityToolTarget,
|
|
928
|
+
elapsed,
|
|
929
|
+
language: context.language,
|
|
930
|
+
totalLines: context.requestActivityToolLines,
|
|
931
|
+
totalBytes: context.requestActivityToolBytes,
|
|
932
|
+
thinkingLabel: thinkingLabels[phase]
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
function deriveBackgroundActivityFallback(context, language) {
|
|
936
|
+
const runningAgents = (context.agents ?? []).filter((a) => a.status === "running");
|
|
937
|
+
const runningWorkflows = (context.workflows?.activeRuns ?? []).filter(
|
|
938
|
+
(r) => r.status === "running"
|
|
939
|
+
);
|
|
940
|
+
const activeRun = context.workflows?.activeRun;
|
|
941
|
+
const runningBgTasks = (context.backgroundTasks ?? []).filter((t) => t.status === "running");
|
|
942
|
+
if (runningAgents.length > 0) {
|
|
943
|
+
const elapsed = formatElapsedForFirstTimestamp(runningAgents.map((agent) => agent.startedAt));
|
|
944
|
+
const text = language === "en-US" ? runningAgents.length === 1 ? `Waiting for agent ${runningAgents[0].displayName ?? runningAgents[0].addressableName ?? ""}\u2026` : `${runningAgents.length} agents still working\u2026` : runningAgents.length === 1 ? `\u7B49\u5F85\u5B50\u667A\u80FD\u4F53 ${runningAgents[0].displayName ?? runningAgents[0].addressableName ?? ""}\u2026` : `${runningAgents.length} \u4E2A\u667A\u80FD\u4F53\u4ECD\u5728\u5DE5\u4F5C\u2026`;
|
|
945
|
+
return { phase: "continuing", text, language, elapsed };
|
|
946
|
+
}
|
|
947
|
+
if (runningWorkflows.length > 0 || activeRun && activeRun.status === "running") {
|
|
948
|
+
const elapsed = formatElapsedForFirstTimestamp([
|
|
949
|
+
...runningWorkflows.map((run) => run.startedAt),
|
|
950
|
+
activeRun && activeRun.status === "running" ? activeRun.startedAt : void 0
|
|
951
|
+
]);
|
|
952
|
+
const hasMultiAgent = runningWorkflows.some((r) => r.multiAgent === true) || activeRun && activeRun.status === "running" && activeRun.multiAgent === true;
|
|
953
|
+
const text = hasMultiAgent ? language === "en-US" ? "Multi-agent collaboration running\u2026" : "\u591A\u667A\u80FD\u4F53\u534F\u4F5C\u8FDB\u884C\u4E2D\u2026" : language === "en-US" ? "Workflow running\u2026" : "\u5DE5\u4F5C\u6D41\u8FD0\u884C\u4E2D\u2026";
|
|
954
|
+
return { phase: "continuing", text, language, elapsed };
|
|
955
|
+
}
|
|
956
|
+
if (runningBgTasks.length > 0) {
|
|
957
|
+
const elapsed = formatElapsedForFirstTimestamp(runningBgTasks.map((task) => task.startedAt));
|
|
958
|
+
const text = language === "en-US" ? `${runningBgTasks.length} background task(s) running\u2026` : `${runningBgTasks.length} \u4E2A\u540E\u53F0\u4EFB\u52A1\u8FD0\u884C\u4E2D\u2026`;
|
|
959
|
+
return { phase: "continuing", text, language, elapsed };
|
|
960
|
+
}
|
|
961
|
+
return void 0;
|
|
962
|
+
}
|
|
963
|
+
function formatElapsedForFirstTimestamp(values) {
|
|
964
|
+
const timestamps = values.map((value) => value ? Date.parse(value) : Number.NaN).filter((value) => Number.isFinite(value));
|
|
965
|
+
if (timestamps.length === 0) return void 0;
|
|
966
|
+
return formatElapsedSince(new Date(Math.min(...timestamps)).toISOString());
|
|
967
|
+
}
|
|
968
|
+
function deriveVisibleWorkState(context) {
|
|
969
|
+
const requestPhase = context.requestActivityPhase;
|
|
970
|
+
const activeAbort = context.activeAbortController;
|
|
971
|
+
const hasActiveAbort = Boolean(activeAbort && activeAbort.signal?.aborted !== true);
|
|
972
|
+
const runningAgents = (context.agents ?? []).filter((a) => a.status === "running");
|
|
973
|
+
const runningBackgroundTasks = (context.backgroundTasks ?? []).filter((t) => t.status === "running");
|
|
974
|
+
const allActiveRuns = [
|
|
975
|
+
...context.workflows?.activeRuns ?? [],
|
|
976
|
+
...context.workflows?.activeRun ? [context.workflows.activeRun] : []
|
|
977
|
+
];
|
|
978
|
+
const runningWorkflows = allActiveRuns.filter((r) => r.status === "running");
|
|
979
|
+
const hasMultiAgentWorkflow = runningWorkflows.some((r) => r.multiAgent === true) || runningAgents.length > 0 && runningWorkflows.length > 0 && !runningWorkflows.some((r) => r.phaseGateConfirmed);
|
|
980
|
+
const hasExplicitWorkflow = runningWorkflows.some((r) => r.phaseGateConfirmed === true);
|
|
981
|
+
const mainChainActive = hasActiveAbort || requestPhase !== void 0 && requestPhase !== "completed" && requestPhase !== "request_completed";
|
|
982
|
+
const pendingCompletionCount = (context.agentCompletions?.notices ?? []).filter(
|
|
983
|
+
(n) => !n.reportedAt
|
|
984
|
+
).length;
|
|
985
|
+
const scrollState = context.transcriptScrollState;
|
|
986
|
+
const scrollDetached = scrollState ? scrollState.stickToBottom === false : false;
|
|
987
|
+
const unseenCount = context.unseenMessageCount ?? 0;
|
|
988
|
+
return {
|
|
989
|
+
mainRequestActive: mainChainActive,
|
|
990
|
+
userInputPending: requestPhase === "request_started" || requestPhase === "waiting_first_delta",
|
|
991
|
+
toolsRunning: requestPhase === "tool_running",
|
|
992
|
+
agentsRunning: runningAgents.length,
|
|
993
|
+
backgroundTasksRunning: runningBackgroundTasks.length,
|
|
994
|
+
explicitWorkflowRunning: hasExplicitWorkflow,
|
|
995
|
+
multiAgentWorkflowRunning: hasMultiAgentWorkflow,
|
|
996
|
+
pendingCompletionCount,
|
|
997
|
+
scrollDetached,
|
|
998
|
+
unseenCount
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
function mapPendingApprovalToPermission(context) {
|
|
1002
|
+
const approval = context.pendingLocalApproval;
|
|
1003
|
+
if (!approval) return void 0;
|
|
1004
|
+
if (approval.kind === "index_ignore_write") {
|
|
1005
|
+
const path = approval.plan?.path ?? ".linghunignore";
|
|
1006
|
+
const isEn = context.language === "en-US";
|
|
1007
|
+
return {
|
|
1008
|
+
toolName: "Write",
|
|
1009
|
+
reason: "",
|
|
1010
|
+
risk: "medium",
|
|
1011
|
+
scope: [path],
|
|
1012
|
+
hint: "",
|
|
1013
|
+
actionSummary: isEn ? `Edit file: ${path}` : `\u4FEE\u6539\u6587\u4EF6\uFF1A${path}`,
|
|
1014
|
+
actions: buildOneShotPermissionActions(context.language),
|
|
1015
|
+
explanationLines: buildPermissionExplanationLines("mutating", "medium", context.language)
|
|
1016
|
+
};
|
|
1017
|
+
}
|
|
1018
|
+
if (approval.kind === "index_tool") {
|
|
1019
|
+
const isEn = context.language === "en-US";
|
|
1020
|
+
const action = approval.indexAction === "repair" ? "repair" : approval.indexAction === "init fast" ? "init fast" : "refresh";
|
|
1021
|
+
const actionSummary = isEn ? action === "repair" ? "Repair and refresh the codebase index" : action === "init fast" ? "Initialize the codebase index in fast mode" : "Refresh (rebuild) the codebase index" : action === "repair" ? "\u4FEE\u590D\u5E76\u5237\u65B0\u4EE3\u7801\u7D22\u5F15" : action === "init fast" ? "\u5FEB\u901F\u521D\u59CB\u5316\u4EE3\u7801\u7D22\u5F15" : "\u5237\u65B0\uFF08\u91CD\u5EFA\uFF09\u4EE3\u7801\u7D22\u5F15";
|
|
1022
|
+
return {
|
|
1023
|
+
toolName: action === "repair" ? "\u4FEE\u590D\u4EE3\u7801\u7D22\u5F15" : action === "init fast" ? "\u521D\u59CB\u5316\u4EE3\u7801\u7D22\u5F15" : "\u5237\u65B0\u4EE3\u7801\u7D22\u5F15",
|
|
1024
|
+
reason: "",
|
|
1025
|
+
risk: "medium",
|
|
1026
|
+
scope: [],
|
|
1027
|
+
hint: "",
|
|
1028
|
+
actionSummary,
|
|
1029
|
+
actions: buildOneShotPermissionActions(context.language),
|
|
1030
|
+
explanationLines: buildPermissionExplanationLines("mutating", "medium", context.language)
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
if (approval.kind === "memory_mutation") {
|
|
1034
|
+
const isEn = context.language === "en-US";
|
|
1035
|
+
const action = approval.mutation?.action ?? "update";
|
|
1036
|
+
return {
|
|
1037
|
+
toolName: "Write",
|
|
1038
|
+
reason: "",
|
|
1039
|
+
risk: "medium",
|
|
1040
|
+
scope: [],
|
|
1041
|
+
hint: "",
|
|
1042
|
+
actionSummary: isEn ? `Update controlled memory: ${action}` : `\u66F4\u65B0\u53D7\u63A7\u8BB0\u5FC6\uFF1A${action}`,
|
|
1043
|
+
actions: buildOneShotPermissionActions(context.language),
|
|
1044
|
+
explanationLines: buildPermissionExplanationLines("mutating", "medium", context.language)
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
if (approval.kind === "break_cache_mutation") {
|
|
1048
|
+
const isEn = context.language === "en-US";
|
|
1049
|
+
const action = approval.action ?? "update";
|
|
1050
|
+
return {
|
|
1051
|
+
toolName: "Write",
|
|
1052
|
+
reason: "",
|
|
1053
|
+
risk: "medium",
|
|
1054
|
+
scope: [".linghun/break-cache"],
|
|
1055
|
+
hint: "",
|
|
1056
|
+
actionSummary: isEn ? `Update break-cache marker: ${action}` : `\u66F4\u65B0 break-cache marker\uFF1A${action}`,
|
|
1057
|
+
actions: buildOneShotPermissionActions(context.language),
|
|
1058
|
+
explanationLines: buildPermissionExplanationLines("mutating", "medium", context.language)
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
if (approval.kind === "image_generation") {
|
|
1062
|
+
const isEn = context.language === "en-US";
|
|
1063
|
+
return {
|
|
1064
|
+
toolName: "Write",
|
|
1065
|
+
reason: "",
|
|
1066
|
+
risk: "medium",
|
|
1067
|
+
scope: approval.assetPath ? [approval.assetPath] : [".linghun/assets"],
|
|
1068
|
+
hint: "",
|
|
1069
|
+
actionSummary: isEn ? "Write image metadata" : "\u5199\u5165 image metadata",
|
|
1070
|
+
actions: buildOneShotPermissionActions(context.language),
|
|
1071
|
+
explanationLines: buildPermissionExplanationLines("mutating", "medium", context.language)
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
if (approval.kind === "git_stable_point") {
|
|
1075
|
+
const isEn = context.language === "en-US";
|
|
1076
|
+
return {
|
|
1077
|
+
toolName: "GitStablePointCreate",
|
|
1078
|
+
reason: "",
|
|
1079
|
+
risk: "medium",
|
|
1080
|
+
scope: [],
|
|
1081
|
+
hint: "",
|
|
1082
|
+
actionSummary: isEn ? "Create a stable point (git commit / snapshot) for the workspace" : "\u4E3A\u5DE5\u4F5C\u533A\u521B\u5EFA\u7A33\u5B9A\u70B9\uFF08git commit / snapshot\uFF09",
|
|
1083
|
+
actions: buildOneShotPermissionActions(context.language),
|
|
1084
|
+
explanationLines: buildPermissionExplanationLines("mutating", "medium", context.language)
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
if (approval.kind === "model_tool_use" || approval.kind === "architecture_drift" || approval.kind === "agent_tool_use") {
|
|
1088
|
+
const toolName = approval.toolName ?? "unknown";
|
|
1089
|
+
const verdict = approval.verdict;
|
|
1090
|
+
const fallbackSemantic = inferSemanticByToolName(toolName);
|
|
1091
|
+
const semantic = verdict?.semantic ?? fallbackSemantic;
|
|
1092
|
+
const risk = toolName === "Bash" ? "high" : "medium";
|
|
1093
|
+
const explanationLines = verdict ? buildPermissionExplanationLinesFromVerdict(
|
|
1094
|
+
{
|
|
1095
|
+
semantic,
|
|
1096
|
+
pathSafety: verdict.pathSafety,
|
|
1097
|
+
redactedSummary: verdict.redactedSummary,
|
|
1098
|
+
reason: verdict.reason
|
|
1099
|
+
},
|
|
1100
|
+
risk,
|
|
1101
|
+
context.language
|
|
1102
|
+
) : buildPermissionExplanationLines(fallbackSemantic, risk, context.language);
|
|
1103
|
+
return {
|
|
1104
|
+
toolName,
|
|
1105
|
+
reason: "",
|
|
1106
|
+
risk,
|
|
1107
|
+
scope: [],
|
|
1108
|
+
hint: "",
|
|
1109
|
+
actionSummary: approval.kind === "architecture_drift" ? buildArchitectureDriftActionSummary(
|
|
1110
|
+
context.language,
|
|
1111
|
+
toolName,
|
|
1112
|
+
approval.toolCall?.input
|
|
1113
|
+
) : buildPermissionActionSummary(context.language, toolName, approval.toolCall?.input),
|
|
1114
|
+
actions: approval.kind === "model_tool_use" ? [] : buildOneShotPermissionActions(context.language),
|
|
1115
|
+
explanationLines: approval.kind === "agent_tool_use" ? [
|
|
1116
|
+
context.language === "en-US" ? `Child agent ${approval.agentId ?? "unknown"} requested this tool.` : `\u5B50 agent ${approval.agentId ?? "unknown"} \u8BF7\u6C42\u8BE5\u5DE5\u5177\u3002`,
|
|
1117
|
+
...explanationLines
|
|
1118
|
+
] : explanationLines
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
return void 0;
|
|
1122
|
+
}
|
|
1123
|
+
function buildPermissionExplanationLinesFromVerdict(verdict, risk, language) {
|
|
1124
|
+
const isEn = language === "en-US";
|
|
1125
|
+
const lines = [];
|
|
1126
|
+
lines.push(...explainPolicyVerdict(verdict, language));
|
|
1127
|
+
if (risk === "high") {
|
|
1128
|
+
lines.push(isEn ? "Risk: high \u2014 review carefully." : "\u98CE\u9669\uFF1A\u9AD8 \u2014 \u8BF7\u4ED4\u7EC6\u786E\u8BA4\u3002");
|
|
1129
|
+
} else if (risk === "medium") {
|
|
1130
|
+
lines.push(isEn ? "Risk: medium." : "\u98CE\u9669\uFF1A\u4E2D\u3002");
|
|
1131
|
+
} else {
|
|
1132
|
+
lines.push(isEn ? "Risk: low." : "\u98CE\u9669\uFF1A\u4F4E\u3002");
|
|
1133
|
+
}
|
|
1134
|
+
return lines.filter((line, idx, arr) => arr.indexOf(line) === idx);
|
|
1135
|
+
}
|
|
1136
|
+
function inferSemanticByToolName(toolName) {
|
|
1137
|
+
if (toolName === "Bash") return "destructive";
|
|
1138
|
+
if (toolName === "Write" || toolName === "Edit" || toolName === "MultiEdit") return "mutating";
|
|
1139
|
+
if (toolName === "Read" || toolName === "Glob" || toolName === "Grep") return "readonly";
|
|
1140
|
+
if (toolName === "WebSearch" || toolName === "WebFetch") return "network";
|
|
1141
|
+
return "unknown";
|
|
1142
|
+
}
|
|
1143
|
+
function buildPermissionExplanationLines(semantic, risk, language) {
|
|
1144
|
+
const isEn = language === "en-US";
|
|
1145
|
+
const lines = [];
|
|
1146
|
+
lines.push(explainSemantic(semantic, language));
|
|
1147
|
+
if (risk === "high") {
|
|
1148
|
+
lines.push(isEn ? "Risk: high \u2014 review carefully." : "\u98CE\u9669\uFF1A\u9AD8 \u2014 \u8BF7\u4ED4\u7EC6\u786E\u8BA4\u3002");
|
|
1149
|
+
} else if (risk === "medium") {
|
|
1150
|
+
lines.push(isEn ? "Risk: medium." : "\u98CE\u9669\uFF1A\u4E2D\u3002");
|
|
1151
|
+
} else {
|
|
1152
|
+
lines.push(isEn ? "Risk: low." : "\u98CE\u9669\uFF1A\u4F4E\u3002");
|
|
1153
|
+
}
|
|
1154
|
+
lines.push(explainHowToUpdate(language));
|
|
1155
|
+
return lines;
|
|
1156
|
+
}
|
|
1157
|
+
function buildPermissionActionSummary(language, toolName, input) {
|
|
1158
|
+
const zh = language === "zh-CN";
|
|
1159
|
+
const obj = input && typeof input === "object" ? input : {};
|
|
1160
|
+
const str = (key) => {
|
|
1161
|
+
const v = obj[key];
|
|
1162
|
+
return typeof v === "string" && v.length > 0 ? v : void 0;
|
|
1163
|
+
};
|
|
1164
|
+
if (toolName === "Bash") {
|
|
1165
|
+
const command = str("command");
|
|
1166
|
+
if (command) return zh ? `\u8FD0\u884C\u7EC8\u7AEF\u547D\u4EE4\uFF1A${command}` : `Run terminal command: ${command}`;
|
|
1167
|
+
}
|
|
1168
|
+
if (toolName === "Write" || toolName === "Edit" || toolName === "MultiEdit") {
|
|
1169
|
+
const path = str("file_path") ?? str("path");
|
|
1170
|
+
if (path) return zh ? `\u4FEE\u6539\u6587\u4EF6\uFF1A${path}` : `Edit file: ${path}`;
|
|
1171
|
+
}
|
|
1172
|
+
if (toolName === "Read") {
|
|
1173
|
+
const path = str("path") ?? str("file_path");
|
|
1174
|
+
if (path) return zh ? `\u8BFB\u53D6\u6587\u4EF6\uFF1A${path}` : `Read file: ${path}`;
|
|
1175
|
+
}
|
|
1176
|
+
if (toolName === "Glob" || toolName === "Grep") {
|
|
1177
|
+
const target = str("pattern") ?? str("path");
|
|
1178
|
+
if (target) return zh ? `\u641C\u7D22\uFF1A${target}` : `Search: ${target}`;
|
|
1179
|
+
}
|
|
1180
|
+
if (toolName === "WebSearch") {
|
|
1181
|
+
const query = str("query");
|
|
1182
|
+
if (query) return zh ? `\u641C\u7D22\u7F51\u9875\uFF1A${query}` : `Web search: ${query}`;
|
|
1183
|
+
}
|
|
1184
|
+
if (toolName === "WebFetch") {
|
|
1185
|
+
const url = str("url");
|
|
1186
|
+
if (url) return zh ? `\u6293\u53D6\u7F51\u9875\uFF1A${url}` : `Web fetch: ${url}`;
|
|
1187
|
+
}
|
|
1188
|
+
return zh ? `\u4F7F\u7528\u5DE5\u5177\uFF1A${toolName}` : `Use tool: ${toolName}`;
|
|
1189
|
+
}
|
|
1190
|
+
function buildArchitectureDriftActionSummary(language, toolName, input) {
|
|
1191
|
+
const action = buildPermissionActionSummary(language, toolName, input);
|
|
1192
|
+
return language === "en-US" ? `Confirm scope change: ${action}` : `\u786E\u8BA4\u8303\u56F4\u53D8\u5316\uFF1A${action}`;
|
|
1193
|
+
}
|
|
1194
|
+
function createProjectRouteBlock(language, problem) {
|
|
1195
|
+
const text = shellText[language];
|
|
1196
|
+
return {
|
|
1197
|
+
id: "project-route-problem",
|
|
1198
|
+
kind: "setup",
|
|
1199
|
+
status: "blocked",
|
|
1200
|
+
title: text.routeTitle,
|
|
1201
|
+
summary: text.routeSummary(problem),
|
|
1202
|
+
nextAction: text.routeNextAction
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
function formatTrust(context, language) {
|
|
1206
|
+
const text = shellText[language];
|
|
1207
|
+
if (!context.config.workspaceTrust.recorded) {
|
|
1208
|
+
return text.trustUnknown;
|
|
1209
|
+
}
|
|
1210
|
+
return context.config.workspaceTrust.level === "trusted" ? text.trustTrusted : text.trustRestricted;
|
|
1211
|
+
}
|
|
1212
|
+
function formatIndex(status, language) {
|
|
1213
|
+
const trimmed = (status ?? "").trim();
|
|
1214
|
+
if (!trimmed || trimmed.toLowerCase() === "unknown") {
|
|
1215
|
+
return language === "en-US" ? "Index?" : "\u7D22\u5F15?";
|
|
1216
|
+
}
|
|
1217
|
+
return shellText[language].index(truncateMiddle(trimmed, 10));
|
|
1218
|
+
}
|
|
1219
|
+
function formatBackground(count, language, width) {
|
|
1220
|
+
if (count === 0) return "";
|
|
1221
|
+
if (width < 60) {
|
|
1222
|
+
return shellText[language].backgroundShort(count);
|
|
1223
|
+
}
|
|
1224
|
+
return shellText[language].background(count);
|
|
1225
|
+
}
|
|
1226
|
+
var KNOWN_SLASH_COMMANDS = new Set(
|
|
1227
|
+
SLASH_COMMAND_REGISTRY.map((entry) => entry.slash)
|
|
1228
|
+
);
|
|
1229
|
+
function isKnownSlashCommand(command) {
|
|
1230
|
+
if (!command.startsWith("/")) return false;
|
|
1231
|
+
if (KNOWN_SLASH_COMMANDS.has(command)) return true;
|
|
1232
|
+
const head = command.split(/\s+/, 1)[0];
|
|
1233
|
+
return Boolean(head && KNOWN_SLASH_COMMANDS.has(head));
|
|
1234
|
+
}
|
|
1235
|
+
function buildTaskSuggestions(inputs) {
|
|
1236
|
+
const suggestions = [];
|
|
1237
|
+
if (inputs.failBlocks?.length) {
|
|
1238
|
+
const latest = inputs.failBlocks[inputs.failBlocks.length - 1];
|
|
1239
|
+
suggestions.push({
|
|
1240
|
+
id: `tool_error:details:${latest?.id ?? "latest"}`,
|
|
1241
|
+
source: "tool_error",
|
|
1242
|
+
label: inputs.language === "en-US" ? "Show full error output" : "\u67E5\u770B\u5B8C\u6574\u9519\u8BEF",
|
|
1243
|
+
hint: inputs.language === "en-US" ? `Press ${TOGGLE_DETAILS_KEYBIND} for the latest failure output (or /details)` : `\u6309 ${TOGGLE_DETAILS_KEYBIND} \u67E5\u770B\u6700\u8FD1\u4E00\u6B21\u5931\u8D25\u8F93\u51FA\uFF08\u6216 /details\uFF09`,
|
|
1244
|
+
action: { kind: "slash", command: "/details" }
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
if (inputs.setupHint) {
|
|
1248
|
+
suggestions.push({
|
|
1249
|
+
id: "setup:resume",
|
|
1250
|
+
source: "setup",
|
|
1251
|
+
label: inputs.language === "en-US" ? "Continue model setup" : "\u7EE7\u7EED\u6A21\u578B\u914D\u7F6E",
|
|
1252
|
+
hint: inputs.setupHint,
|
|
1253
|
+
action: { kind: "slash", command: "/model" }
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
for (const hint of inputs.configHints ?? []) {
|
|
1257
|
+
if (!isKnownSlashCommand(hint.slash)) continue;
|
|
1258
|
+
suggestions.push({
|
|
1259
|
+
id: `config:${hint.id}`,
|
|
1260
|
+
source: "config",
|
|
1261
|
+
label: hint.label,
|
|
1262
|
+
action: { kind: "slash", command: hint.slash }
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
for (const candidate of inputs.slashCandidates ?? []) {
|
|
1266
|
+
if (!isKnownSlashCommand(candidate.slash)) continue;
|
|
1267
|
+
suggestions.push({
|
|
1268
|
+
id: `slash:${candidate.slash}`,
|
|
1269
|
+
source: "slash",
|
|
1270
|
+
label: candidate.slash,
|
|
1271
|
+
hint: candidate.label,
|
|
1272
|
+
action: { kind: "slash", command: candidate.slash }
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1276
|
+
return suggestions.filter((item) => {
|
|
1277
|
+
if (seen.has(item.id)) return false;
|
|
1278
|
+
seen.add(item.id);
|
|
1279
|
+
return true;
|
|
1280
|
+
}).slice(0, 4);
|
|
1281
|
+
}
|
|
1282
|
+
function buildTaskFooterView(input) {
|
|
1283
|
+
const modelInfo = formatFooterModel(
|
|
1284
|
+
input.language,
|
|
1285
|
+
input.effectiveModel,
|
|
1286
|
+
input.setupNeeded,
|
|
1287
|
+
input.width
|
|
1288
|
+
);
|
|
1289
|
+
return {
|
|
1290
|
+
permissionMode: `${permissionModeSymbol(input.permissionMode)} ${input.permissionModeLabel}`,
|
|
1291
|
+
permissionModeColor: permissionModeColor(input.permissionMode),
|
|
1292
|
+
cyclePermHint: input.cyclePermHint,
|
|
1293
|
+
model: modelInfo.text,
|
|
1294
|
+
modelDim: modelInfo.dim,
|
|
1295
|
+
cache: formatFooterCache(input.language, input.cacheHitRate),
|
|
1296
|
+
cacheTone: formatFooterCacheTone(input.cacheHitRate),
|
|
1297
|
+
index: formatFooterIndex(input.language, input.indexStatus),
|
|
1298
|
+
reasoning: formatFooterReasoning(input.language, input.reasoningLevel, input.reasoningSent),
|
|
1299
|
+
contextUsage: input.contextUsageLabel,
|
|
1300
|
+
cost: formatFooterCost(input.language, input.estimatedCostCny),
|
|
1301
|
+
isRemoteMode: input.isRemoteMode
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
function formatFooterModel(language, effectiveModel, setupNeeded, width) {
|
|
1305
|
+
const label = language === "en-US" ? "Model" : "\u6A21\u578B";
|
|
1306
|
+
const trimmed = (effectiveModel ?? "").trim();
|
|
1307
|
+
const placeholders = /* @__PURE__ */ new Set(["", "unknown", "setup-needed", "openai-compatible-model"]);
|
|
1308
|
+
if (setupNeeded || placeholders.has(trimmed.toLowerCase()))
|
|
1309
|
+
return { text: `${label} --`, dim: true };
|
|
1310
|
+
return { text: `${label} ${truncateMiddle(trimmed, width <= 60 ? 12 : 22)}`, dim: false };
|
|
1311
|
+
}
|
|
1312
|
+
function formatFooterCache(language, hitRate) {
|
|
1313
|
+
const label = language === "en-US" ? "Cache" : "\u7F13\u5B58";
|
|
1314
|
+
if (hitRate === null || hitRate === void 0) return `${label}?`;
|
|
1315
|
+
return `${label} ${Math.max(0, Math.min(100, Math.round(hitRate * 100)))}%`;
|
|
1316
|
+
}
|
|
1317
|
+
function formatFooterCacheTone(hitRate) {
|
|
1318
|
+
if (hitRate === null || hitRate === void 0) return "dim";
|
|
1319
|
+
return Math.max(0, Math.min(100, Math.round(hitRate * 100))) < 50 ? "warning" : "default";
|
|
1320
|
+
}
|
|
1321
|
+
function formatFooterIndex(language, status) {
|
|
1322
|
+
const label = language === "en-US" ? "Index" : "\u7D22\u5F15";
|
|
1323
|
+
const trimmed = (status ?? "").trim();
|
|
1324
|
+
if (!trimmed || trimmed.toLowerCase() === "unknown")
|
|
1325
|
+
return language === "en-US" ? "Index?" : "\u7D22\u5F15?";
|
|
1326
|
+
if (trimmed === "refresh_completed_but_unverified") return `${label} refresh`;
|
|
1327
|
+
return `${label} ${truncateMiddle(trimmed, 10)}`;
|
|
1328
|
+
}
|
|
1329
|
+
function formatFooterReasoning(language, level, sent) {
|
|
1330
|
+
if (!level || sent === false) return void 0;
|
|
1331
|
+
const trimmed = level.trim();
|
|
1332
|
+
if (!trimmed) return void 0;
|
|
1333
|
+
return `${language === "en-US" ? "Reasoning" : "\u63A8\u7406"} ${truncateMiddle(trimmed, 12)}`;
|
|
1334
|
+
}
|
|
1335
|
+
function formatFooterCost(language, estimatedCostCny) {
|
|
1336
|
+
if (!Number.isFinite(estimatedCostCny)) return void 0;
|
|
1337
|
+
return `${language === "en-US" ? "cost" : "\u8D39\u7528"} \xA5${Math.max(0, estimatedCostCny ?? 0).toFixed(4)} est`;
|
|
1338
|
+
}
|
|
1339
|
+
function normalizeWidth(width) {
|
|
1340
|
+
if (!width || !Number.isFinite(width)) return 80;
|
|
1341
|
+
return Math.max(30, Math.floor(width));
|
|
1342
|
+
}
|
|
1343
|
+
function normalizeHeight(height) {
|
|
1344
|
+
if (!height || !Number.isFinite(height)) return 24;
|
|
1345
|
+
return Math.max(10, Math.floor(height));
|
|
1346
|
+
}
|
|
1347
|
+
function fitBlockToWidth(block, width) {
|
|
1348
|
+
const contentWidth = Math.max(18, width - (width < 60 ? 4 : 10));
|
|
1349
|
+
const isMessageBlock = block.messageKind === "assistant_text" || block.messageKind === "assistant_thinking" || block.messageKind === "tool_result_success" || block.messageKind === "tool_result_error" || block.messageKind === "tool_result_cancelled" || block.messageKind === "tool_result_rejected" || block.messageKind === "diagnostic" || block.messageKind === "local_command_output";
|
|
1350
|
+
return {
|
|
1351
|
+
...block,
|
|
1352
|
+
title: truncateMiddle(block.title, contentWidth),
|
|
1353
|
+
summary: isMessageBlock ? block.summary : fitLine(block.summary, contentWidth),
|
|
1354
|
+
detail: block.detail ? isMessageBlock ? block.detail : fitLine(block.detail, contentWidth) : void 0,
|
|
1355
|
+
nextAction: block.nextAction ? fitLine(block.nextAction, contentWidth) : void 0
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1358
|
+
function fitLine(value, width) {
|
|
1359
|
+
return truncateMiddle(value.replace(/\s+/gu, " ").trim(), width);
|
|
1360
|
+
}
|
|
1361
|
+
function redactSensitiveText(value) {
|
|
1362
|
+
return value.replace(/sk-[A-Za-z0-9_-]{8,}/gu, "[masked-key]").replace(/(api[_-]?key\s*[=:]\s*)\S+/giu, "$1[masked-key]").replace(/(authorization\s*:\s*bearer\s+)\S+/giu, "$1[masked-key]").replace(/\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/giu, "Bearer [masked-key]");
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
export {
|
|
1366
|
+
createShellViewModel,
|
|
1367
|
+
buildConfigPanelActions,
|
|
1368
|
+
getComposerPlaceholder,
|
|
1369
|
+
createOutputBlock,
|
|
1370
|
+
createCompactBoundaryBlock,
|
|
1371
|
+
mapRequestActivityToView,
|
|
1372
|
+
mapPendingApprovalToPermission
|
|
1373
|
+
};
|