@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,558 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyToolResultBudgetToMessages,
|
|
3
|
+
formatToolResultBudgetEvidenceSummary,
|
|
4
|
+
formatToolResultBudgetSystemEvent
|
|
5
|
+
} from "./chunk-O7S3HYE6.js";
|
|
6
|
+
import {
|
|
7
|
+
MAX_EVIDENCE_RECORDS
|
|
8
|
+
} from "./chunk-RDGM4RUE.js";
|
|
9
|
+
import {
|
|
10
|
+
LINGHUN_DEFAULT_TOOL_RESULT_CHARS,
|
|
11
|
+
LINGHUN_MAX_TOOL_RESULT_BYTES
|
|
12
|
+
} from "./chunk-IWUIOLMF.js";
|
|
13
|
+
import {
|
|
14
|
+
writeHandoffPacket
|
|
15
|
+
} from "./chunk-MLUIOBKL.js";
|
|
16
|
+
import {
|
|
17
|
+
deriveToolSupportsClaims
|
|
18
|
+
} from "./chunk-K56D3X7S.js";
|
|
19
|
+
import {
|
|
20
|
+
mergeFailureRecord,
|
|
21
|
+
writeFailureRecord
|
|
22
|
+
} from "./chunk-GDQQNPBP.js";
|
|
23
|
+
import {
|
|
24
|
+
classifyProviderFailure
|
|
25
|
+
} from "./chunk-OZMX3E35.js";
|
|
26
|
+
import {
|
|
27
|
+
truncateDisplay
|
|
28
|
+
} from "./chunk-OMZYPQVA.js";
|
|
29
|
+
import {
|
|
30
|
+
summarizeArchitectureCard
|
|
31
|
+
} from "./chunk-MVONSJEN.js";
|
|
32
|
+
|
|
33
|
+
// src/evidence-runtime.ts
|
|
34
|
+
import { randomUUID } from "crypto";
|
|
35
|
+
var TRANSCRIPT_TOOL_OUTPUT_PREVIEW_CHARS = 2e3;
|
|
36
|
+
var TRANSCRIPT_TOOL_OUTPUT_MAX_CHARS = 8e3;
|
|
37
|
+
var MAX_ROUND_ASSISTANT_CHARS_FOR_PROVIDER = 16e3;
|
|
38
|
+
var ROUND_ASSISTANT_HEAD_CHARS = 4e3;
|
|
39
|
+
var ROUND_ASSISTANT_TAIL_CHARS = 4e3;
|
|
40
|
+
function createEvidenceRecord(kind, summary, source, supportsClaims) {
|
|
41
|
+
return {
|
|
42
|
+
id: randomUUID(),
|
|
43
|
+
kind,
|
|
44
|
+
summary: truncateDisplay(summary.replace(/\s+/g, " "), 180),
|
|
45
|
+
source,
|
|
46
|
+
supportsClaims,
|
|
47
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function rememberEvidence(context, evidence) {
|
|
51
|
+
context.evidence.unshift(evidence);
|
|
52
|
+
context.evidence = context.evidence.slice(0, MAX_EVIDENCE_RECORDS);
|
|
53
|
+
}
|
|
54
|
+
function pickEvidence(evidence) {
|
|
55
|
+
return {
|
|
56
|
+
id: evidence.id,
|
|
57
|
+
kind: evidence.kind,
|
|
58
|
+
source: evidence.source,
|
|
59
|
+
summary: evidence.summary
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function truncateRoundAssistantForProvider(text, context) {
|
|
63
|
+
if (text.length <= MAX_ROUND_ASSISTANT_CHARS_FOR_PROVIDER) return text;
|
|
64
|
+
const head = text.slice(0, ROUND_ASSISTANT_HEAD_CHARS);
|
|
65
|
+
const tail = text.slice(-ROUND_ASSISTANT_TAIL_CHARS);
|
|
66
|
+
const omitted = text.length - ROUND_ASSISTANT_HEAD_CHARS - ROUND_ASSISTANT_TAIL_CHARS;
|
|
67
|
+
const separator = context.language === "en-US" ? `
|
|
68
|
+
|
|
69
|
+
[... ${omitted} characters omitted \u2014 full output preserved in artifact; use /details or Ctrl+O to inspect ...]
|
|
70
|
+
|
|
71
|
+
` : `
|
|
72
|
+
|
|
73
|
+
[... \u4E2D\u95F4\u7701\u7565 ${omitted} \u4E2A\u5B57\u7B26 \u2014 \u5B8C\u6574\u8F93\u51FA\u5DF2\u4FDD\u5B58\u5728 artifact \u4E2D\uFF1B\u7528 /details \u6216 Ctrl+O \u67E5\u770B ...]
|
|
74
|
+
|
|
75
|
+
`;
|
|
76
|
+
return head + separator + tail;
|
|
77
|
+
}
|
|
78
|
+
async function recordProviderFailureEvidence(context, sessionId, error, runtime) {
|
|
79
|
+
const code = error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : "PROVIDER_ERROR";
|
|
80
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
81
|
+
const failureKind = classifyProviderFailure(error);
|
|
82
|
+
const transitFailure = failureKind === "transit";
|
|
83
|
+
const summary = `provider failure: kind ${failureKind}; code ${code}; provider ${runtime.provider}; model ${runtime.model}; endpoint profile ${runtime.endpointProfile}; message ${sanitizeProviderFailureText(message)}`;
|
|
84
|
+
const evidence = createEvidenceRecord(
|
|
85
|
+
"command_output",
|
|
86
|
+
summary,
|
|
87
|
+
`provider:${runtime.provider}:failure`,
|
|
88
|
+
["provider_failure", code, runtime.provider, runtime.model, runtime.endpointProfile]
|
|
89
|
+
);
|
|
90
|
+
rememberEvidence(context, evidence);
|
|
91
|
+
await context.store.appendEvent(sessionId, {
|
|
92
|
+
type: "evidence_record",
|
|
93
|
+
...evidence
|
|
94
|
+
});
|
|
95
|
+
await appendSystemEvent(context, sessionId, summary, "warning");
|
|
96
|
+
context.lastProviderFailure = {
|
|
97
|
+
code,
|
|
98
|
+
kind: failureKind,
|
|
99
|
+
provider: runtime.provider,
|
|
100
|
+
model: runtime.model,
|
|
101
|
+
endpointProfile: runtime.endpointProfile,
|
|
102
|
+
summary: evidence.summary,
|
|
103
|
+
evidenceId: evidence.id,
|
|
104
|
+
createdAt: evidence.createdAt
|
|
105
|
+
};
|
|
106
|
+
await captureFailureLearning(context, sessionId, {
|
|
107
|
+
category: "provider_failure",
|
|
108
|
+
failureSummary: `provider request failed kind=${failureKind} code=${code} message=${sanitizeProviderFailureText(message)}`,
|
|
109
|
+
rootCauseGuess: transitFailure ? `provider/network transit failure with ${code}` : `model/provider request failed with ${code}`,
|
|
110
|
+
avoidNextTime: transitFailure ? "Retry later; if it repeats, check provider transit/gateway stability with /model doctor. Do not change provider route/env/key/model unless diagnostics point there." : code === "PROVIDER_RATE_LIMITED" ? "Back off / reduce request rate before retrying provider calls" : `Check provider config and request shape for ${code} before retrying; do not assume the request succeeded`,
|
|
111
|
+
sourceRef: `evidence:${evidence.id}`,
|
|
112
|
+
relatedTarget: code,
|
|
113
|
+
severity: "high"
|
|
114
|
+
});
|
|
115
|
+
return evidence;
|
|
116
|
+
}
|
|
117
|
+
async function recordModelToolFailureForMetaScheduler(context, sessionId, result) {
|
|
118
|
+
if (result.ok || result.pendingApproval) return;
|
|
119
|
+
if (isUserDecisionToolStop(result.text)) return;
|
|
120
|
+
await appendSystemEvent(
|
|
121
|
+
context,
|
|
122
|
+
sessionId,
|
|
123
|
+
`meta scheduler tool failure: tool ${result.tool}; evidence ${result.evidenceId ?? "none"}`,
|
|
124
|
+
"warning"
|
|
125
|
+
);
|
|
126
|
+
await captureFailureLearning(context, sessionId, {
|
|
127
|
+
category: "tool_failure",
|
|
128
|
+
failureSummary: `tool failed: ${result.tool}: ${truncateDisplay(result.text, 180)}`,
|
|
129
|
+
rootCauseGuess: `${result.tool} returned a failed result in the model tool loop`,
|
|
130
|
+
avoidNextTime: "Do not claim the tool action completed; inspect the failure, retry with corrected inputs, or explicitly degrade.",
|
|
131
|
+
sourceRef: result.evidenceId ? `evidence:${result.evidenceId}` : `tool:${result.tool}`,
|
|
132
|
+
relatedTarget: result.tool,
|
|
133
|
+
severity: "medium"
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function isUserDecisionToolStop(text) {
|
|
137
|
+
return /^(?:ask|denied|deny|rejected|cancelled|canceled|block):/iu.test(text.trim());
|
|
138
|
+
}
|
|
139
|
+
function sanitizeProviderFailureError(error) {
|
|
140
|
+
if (!(error instanceof Error)) {
|
|
141
|
+
return sanitizeProviderFailureText(String(error));
|
|
142
|
+
}
|
|
143
|
+
const sanitized = new Error(sanitizeProviderFailureText(error.message));
|
|
144
|
+
if ("suggestion" in error && typeof error.suggestion === "string") {
|
|
145
|
+
Object.assign(sanitized, { suggestion: error.suggestion });
|
|
146
|
+
}
|
|
147
|
+
return sanitized;
|
|
148
|
+
}
|
|
149
|
+
function sanitizeProviderFailureText(text) {
|
|
150
|
+
return text.replace(/sk-[A-Za-z0-9_-]+/gu, "sk-***").replace(/Bearer\s+[A-Za-z0-9._~-]+/giu, "Bearer ***").replace(/api[_-]?key=[^\s&]+/giu, "api_key=***").replace(/[A-Z]:[\\/][^\s]+/gu, "[local-path]").replace(/\/[^\s]*?(?:Linghun|linghun)[^\s]*/gu, "[local-path]");
|
|
151
|
+
}
|
|
152
|
+
async function recordToolFailureEvidence(context, sessionId, name, summary) {
|
|
153
|
+
const evidence = createEvidenceRecord(
|
|
154
|
+
"command_output",
|
|
155
|
+
`${name} failure: ${truncateDisplay(summary.replace(/\s+/g, " "), 140)}`,
|
|
156
|
+
`tool:${name}:failure`,
|
|
157
|
+
[name, "tool_failure"]
|
|
158
|
+
);
|
|
159
|
+
rememberEvidence(context, evidence);
|
|
160
|
+
await context.store.appendEvent(sessionId, {
|
|
161
|
+
type: "evidence_record",
|
|
162
|
+
...evidence
|
|
163
|
+
});
|
|
164
|
+
return evidence;
|
|
165
|
+
}
|
|
166
|
+
async function captureFailureLearning(context, sessionId, input) {
|
|
167
|
+
context.lastMetaSchedulerFailureLearningFulfilled = true;
|
|
168
|
+
if (input.category === "tool_failure") {
|
|
169
|
+
context.lastToolFailure = {
|
|
170
|
+
toolName: input.relatedTarget ?? "unknown",
|
|
171
|
+
summary: input.failureSummary
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
let record;
|
|
175
|
+
try {
|
|
176
|
+
({ record } = mergeFailureRecord(context.failureLearning, input));
|
|
177
|
+
await writeFailureRecord(context.failureLearning, record);
|
|
178
|
+
await appendSystemEvent(
|
|
179
|
+
context,
|
|
180
|
+
sessionId,
|
|
181
|
+
`failure_learning recorded category=${record.category} count=${record.count} severity=${record.severity}`,
|
|
182
|
+
"info"
|
|
183
|
+
);
|
|
184
|
+
} catch {
|
|
185
|
+
await appendSystemEvent(
|
|
186
|
+
context,
|
|
187
|
+
sessionId,
|
|
188
|
+
`failure_learning degraded warning=write_failed category=${record?.category ?? input.category}`,
|
|
189
|
+
"warning"
|
|
190
|
+
).catch(() => void 0);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
async function recordArchitectureRuntimeCard(context, sessionId, card) {
|
|
194
|
+
const evidence = createEvidenceRecord(
|
|
195
|
+
"command_output",
|
|
196
|
+
context.language === "en-US" ? `Architecture audit recorded: ${card.projectFacts.length} fact(s), ${card.verification.length} verification suggestion(s).` : `\u67B6\u6784\u5BA1\u8BA1\u5DF2\u8BB0\u5F55\uFF1A${card.projectFacts.length} \u6761\u4E8B\u5B9E\uFF0C${card.verification.length} \u6761\u9A8C\u8BC1\u5EFA\u8BAE\u3002`,
|
|
197
|
+
"architecture-runtime:v1",
|
|
198
|
+
["architecture_runtime", "architecture_card", card.target]
|
|
199
|
+
);
|
|
200
|
+
rememberEvidence(context, evidence);
|
|
201
|
+
await context.store.appendEvent(sessionId, {
|
|
202
|
+
type: "evidence_record",
|
|
203
|
+
...evidence
|
|
204
|
+
});
|
|
205
|
+
await appendSystemEvent(
|
|
206
|
+
context,
|
|
207
|
+
sessionId,
|
|
208
|
+
`architecture runtime triggered: evidence ${evidence.id}; target ${card.target}`,
|
|
209
|
+
"info"
|
|
210
|
+
);
|
|
211
|
+
if (context.memory.lastHandoff) {
|
|
212
|
+
context.memory.lastHandoff.currentArchitectureCard = summarizeArchitectureCard(card);
|
|
213
|
+
await writeHandoffPacket(context, context.memory.lastHandoff);
|
|
214
|
+
}
|
|
215
|
+
return evidence;
|
|
216
|
+
}
|
|
217
|
+
async function recordToolEvidence(context, sessionId, name, output, input) {
|
|
218
|
+
const kind = name === "Read" ? "file_read" : name === "Grep" || name === "Glob" ? "grep_result" : name === "Bash" || name === "Write" || name === "Edit" || name === "MultiEdit" ? "command_output" : null;
|
|
219
|
+
if (!kind) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
const readOnlyEvidence = name === "Read" || name === "Grep" || name === "Glob";
|
|
223
|
+
const evidence = createEvidenceRecord(
|
|
224
|
+
kind,
|
|
225
|
+
readOnlyEvidence ? formatReadOnlyToolEvidenceSummary(name, output, input) : `${name}: ${truncateDisplay(output.text.replace(/\s+/g, " "), 120)}`,
|
|
226
|
+
output.fullOutputPath ?? name,
|
|
227
|
+
[
|
|
228
|
+
...deriveToolSupportsClaims(name, input, output),
|
|
229
|
+
...readOnlyEvidence ? ["readonly_low_noise_evidence"] : []
|
|
230
|
+
]
|
|
231
|
+
);
|
|
232
|
+
rememberEvidence(context, evidence);
|
|
233
|
+
await context.store.appendEvent(sessionId, {
|
|
234
|
+
type: "evidence_record",
|
|
235
|
+
...evidence
|
|
236
|
+
});
|
|
237
|
+
return evidence;
|
|
238
|
+
}
|
|
239
|
+
function formatReadOnlyToolEvidenceSummary(name, output, input) {
|
|
240
|
+
const target = readToolEvidenceTarget(input);
|
|
241
|
+
const artifact = output.fullOutputPath ? "artifact=yes" : "artifact=no";
|
|
242
|
+
const bytes = output.text.length;
|
|
243
|
+
return `${name}: ${target}; output_chars=${bytes}; ${artifact}`;
|
|
244
|
+
}
|
|
245
|
+
function readToolEvidenceTarget(input) {
|
|
246
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) return "target=unspecified";
|
|
247
|
+
const record = input;
|
|
248
|
+
for (const key of ["path", "file_path", "pattern", "query"]) {
|
|
249
|
+
const value = record[key];
|
|
250
|
+
if (typeof value === "string" && value.trim()) {
|
|
251
|
+
return `${key}=${truncateDisplay(value.replace(/\s+/g, " "), 90)}`;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const paths = record.paths;
|
|
255
|
+
if (Array.isArray(paths)) {
|
|
256
|
+
const values = paths.filter((item) => typeof item === "string");
|
|
257
|
+
if (values.length > 0) {
|
|
258
|
+
return `paths=${truncateDisplay(values.slice(0, 3).join(","), 90)}`;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return "target=unspecified";
|
|
262
|
+
}
|
|
263
|
+
async function recordVerificationEvidence(context, sessionId, report) {
|
|
264
|
+
const supportsClaims = deriveVerificationSupportsClaims(report);
|
|
265
|
+
const evidence = {
|
|
266
|
+
id: randomUUID(),
|
|
267
|
+
kind: "test_result",
|
|
268
|
+
summary: `${formatVerificationEvidenceStatusSummary(report)} \u65E5\u5FD7\uFF1A${report.logPath ?? "\u65E0\u65E5\u5FD7"}`,
|
|
269
|
+
source: report.logPath ?? "Verification Runner",
|
|
270
|
+
supportsClaims,
|
|
271
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
272
|
+
};
|
|
273
|
+
rememberEvidence(context, evidence);
|
|
274
|
+
await context.store.appendEvent(sessionId, {
|
|
275
|
+
type: "evidence_record",
|
|
276
|
+
...evidence
|
|
277
|
+
});
|
|
278
|
+
if (report.status === "fail" || report.status === "partial" || report.status === "timeout") {
|
|
279
|
+
const failedCommand = report.commands.find(
|
|
280
|
+
(c) => c.status === "fail" || c.status === "timeout"
|
|
281
|
+
);
|
|
282
|
+
await captureFailureLearning(context, sessionId, {
|
|
283
|
+
category: "verification_failure",
|
|
284
|
+
failureSummary: `verification ${report.status}: ${report.summary}`,
|
|
285
|
+
rootCauseGuess: failedCommand ? `verification command failed (exit ${failedCommand.exitCode ?? "n/a"})` : `verification did not reach pass (${report.status})`,
|
|
286
|
+
avoidNextTime: "Fix the failing verification command and re-run it; do not claim verified/passed until status=pass",
|
|
287
|
+
sourceRef: `evidence:${evidence.id}`,
|
|
288
|
+
relatedTarget: failedCommand?.kind ?? "verification",
|
|
289
|
+
severity: report.status === "fail" ? "high" : "medium"
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function deriveVerificationSupportsClaims(report) {
|
|
294
|
+
if (report.status !== "pass") {
|
|
295
|
+
return ["verification attempted", `verification:${report.status}`, "\u672A\u901A\u8FC7\u9A8C\u8BC1", "\u9700\u8981\u590D\u6838"];
|
|
296
|
+
}
|
|
297
|
+
const hasRealPassedCommand = report.commands.some(
|
|
298
|
+
(command) => command.status === "pass" && command.synthetic !== true
|
|
299
|
+
);
|
|
300
|
+
const claims = new Set(
|
|
301
|
+
hasRealPassedCommand ? ["verification_passed"] : ["verification_self_check_passed", "verification_not_run"]
|
|
302
|
+
);
|
|
303
|
+
for (const command of report.commands) {
|
|
304
|
+
if (command.status !== "pass") continue;
|
|
305
|
+
if (command.kind === "test") {
|
|
306
|
+
claims.add("test_passed");
|
|
307
|
+
} else if (command.kind === "typecheck") {
|
|
308
|
+
claims.add("typecheck_passed");
|
|
309
|
+
} else if (command.kind === "build") {
|
|
310
|
+
claims.add("build_passed");
|
|
311
|
+
} else if (command.kind === "lint") {
|
|
312
|
+
claims.add("lint_passed");
|
|
313
|
+
} else if (command.kind === "smoke") {
|
|
314
|
+
claims.add(command.synthetic ? "smoke_ran" : "smoke_passed");
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return [...claims];
|
|
318
|
+
}
|
|
319
|
+
function formatVerificationEvidenceStatusSummary(report) {
|
|
320
|
+
const syntheticOnlyPass = report.status === "pass" && report.commands.length > 0 && report.commands.every((command) => command.synthetic === true || command.status !== "pass");
|
|
321
|
+
if (syntheticOnlyPass) {
|
|
322
|
+
return "SELF-CHECK\uFF1Asynthetic self-check \u5DF2\u901A\u8FC7\uFF1B\u771F\u5B9E\u9A8C\u8BC1\u672A\u8FD0\u884C\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u771F\u5B9E PASS \u8BC1\u636E\u3002";
|
|
323
|
+
}
|
|
324
|
+
const statusLabel = report.status.toUpperCase();
|
|
325
|
+
return new RegExp(`^${statusLabel}(?:\\s|:|\uFF1A)`, "u").test(report.summary) ? report.summary : `${statusLabel} ${report.summary}`;
|
|
326
|
+
}
|
|
327
|
+
async function recordToolResultBudgetEvidence(context, sessionId, record) {
|
|
328
|
+
const existing = context.evidence.find(
|
|
329
|
+
(item) => item.fullOutputPath === record.artifact.path || item.outputPath === record.artifact.path || item.summary.includes(record.artifact.relativePath)
|
|
330
|
+
);
|
|
331
|
+
if (existing) return existing.id;
|
|
332
|
+
const evidence = createEvidenceRecord(
|
|
333
|
+
"command_output",
|
|
334
|
+
formatToolResultBudgetEvidenceSummary(record),
|
|
335
|
+
record.artifact.relativePath,
|
|
336
|
+
["tool_result_budget", "artifact", `toolUseId:${record.toolUseId}`]
|
|
337
|
+
);
|
|
338
|
+
evidence.fullOutputPath = record.artifact.path;
|
|
339
|
+
evidence.outputPath = record.artifact.path;
|
|
340
|
+
rememberEvidence(context, evidence);
|
|
341
|
+
await context.store.appendEvent(sessionId, {
|
|
342
|
+
type: "evidence_record",
|
|
343
|
+
...evidence
|
|
344
|
+
});
|
|
345
|
+
await appendSystemEvent(context, sessionId, formatToolResultBudgetSystemEvent(record), "info");
|
|
346
|
+
return evidence.id;
|
|
347
|
+
}
|
|
348
|
+
async function appendBackgroundTaskEvent(context, sessionId, task) {
|
|
349
|
+
await context.store.appendEvent(sessionId, {
|
|
350
|
+
type: "background_task_update",
|
|
351
|
+
task,
|
|
352
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
async function appendSystemEvent(context, sessionId, message, level) {
|
|
356
|
+
await context.store.appendEvent(sessionId, {
|
|
357
|
+
type: "system_event",
|
|
358
|
+
id: randomUUID(),
|
|
359
|
+
level,
|
|
360
|
+
message,
|
|
361
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
async function appendRouteDecisionEvent(context, sessionId, decision) {
|
|
365
|
+
await appendSystemEvent(
|
|
366
|
+
context,
|
|
367
|
+
sessionId,
|
|
368
|
+
`Role route decision ${decision.id}: trigger ${decision.triggerReason}; role ${decision.role}; selected ${decision.selectedProvider || "paused"}/${decision.selectedModel || "paused"}; fallback candidates ${decision.fallbackCandidates.join(",") || "none"}; capabilities ${decision.requiredCapabilities.join("+")}; budget ${decision.maxCostCny === void 0 ? "unconfigured" : decision.maxCostCny}; fallback used ${decision.fallbackUsed ? "yes" : "no"}; budget stop ${decision.budgetStop ? "yes" : "no"}; stop ${decision.stopConditions.join("|") || "none"}`,
|
|
369
|
+
decision.stopConditions.length > 0 ? "warning" : "info"
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
function createToolEndEvent(id, output) {
|
|
373
|
+
return {
|
|
374
|
+
type: "tool_call_end",
|
|
375
|
+
id,
|
|
376
|
+
output: summarizeToolEndOutputForTranscript(output),
|
|
377
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
function summarizeToolEndOutputForTranscript(output) {
|
|
381
|
+
const text = compactToolEndTextForTranscript(
|
|
382
|
+
output.summary || output.preview || output.text || "tool call completed",
|
|
383
|
+
output.fullOutputPath
|
|
384
|
+
);
|
|
385
|
+
return {
|
|
386
|
+
text,
|
|
387
|
+
summary: output.summary === void 0 ? void 0 : compactToolEndTextForTranscript(output.summary, output.fullOutputPath),
|
|
388
|
+
preview: output.preview === void 0 ? void 0 : compactToolEndTextForTranscript(output.preview, output.fullOutputPath),
|
|
389
|
+
truncated: output.truncated,
|
|
390
|
+
fullOutputPath: output.fullOutputPath,
|
|
391
|
+
evidenceId: output.evidenceId,
|
|
392
|
+
changedFiles: output.changedFiles
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
function compactToolEndTextForTranscript(text, fullOutputPath) {
|
|
396
|
+
const bytes = Buffer.byteLength(text, "utf8");
|
|
397
|
+
if (text.length <= TRANSCRIPT_TOOL_OUTPUT_MAX_CHARS && bytes <= TRANSCRIPT_TOOL_OUTPUT_MAX_CHARS) {
|
|
398
|
+
return text;
|
|
399
|
+
}
|
|
400
|
+
return [
|
|
401
|
+
text.slice(0, TRANSCRIPT_TOOL_OUTPUT_PREVIEW_CHARS),
|
|
402
|
+
"",
|
|
403
|
+
`<transcript-tool-end-output-truncated originalChars=${text.length} originalBytes=${bytes}${fullOutputPath ? ` fullOutputPath=${fullOutputPath}` : ""}>`
|
|
404
|
+
].join("\n");
|
|
405
|
+
}
|
|
406
|
+
function compactToolOutputForTranscript(output) {
|
|
407
|
+
const text = typeof output.text === "string" ? output.text : "";
|
|
408
|
+
const textBytes = Buffer.byteLength(text, "utf8");
|
|
409
|
+
if (text.length <= TRANSCRIPT_TOOL_OUTPUT_MAX_CHARS && textBytes <= TRANSCRIPT_TOOL_OUTPUT_MAX_CHARS) {
|
|
410
|
+
const compactedDetails = typeof output.details === "string" && output.details.length > TRANSCRIPT_TOOL_OUTPUT_MAX_CHARS ? `<transcript-tool-output-details-truncated originalChars=${output.details.length}${output.fullOutputPath ? ` fullOutputPath=${output.fullOutputPath}` : ""}>` : output.details;
|
|
411
|
+
return compactedDetails === output.details ? output : { ...output, details: compactedDetails };
|
|
412
|
+
}
|
|
413
|
+
const preview = text.slice(0, TRANSCRIPT_TOOL_OUTPUT_PREVIEW_CHARS);
|
|
414
|
+
return {
|
|
415
|
+
...output,
|
|
416
|
+
text: [
|
|
417
|
+
preview,
|
|
418
|
+
"",
|
|
419
|
+
`<transcript-tool-output-truncated originalChars=${text.length} originalBytes=${textBytes}${output.fullOutputPath ? ` fullOutputPath=${output.fullOutputPath}` : ""}>`
|
|
420
|
+
].join("\n"),
|
|
421
|
+
details: typeof output.details === "string" && output.details.length > TRANSCRIPT_TOOL_OUTPUT_PREVIEW_CHARS ? `<transcript-tool-output-details-truncated originalChars=${output.details.length}${output.fullOutputPath ? ` fullOutputPath=${output.fullOutputPath}` : ""}>` : output.details,
|
|
422
|
+
data: compactToolOutputDataForTranscript(output.data),
|
|
423
|
+
truncated: true
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
function compactToolOutputDataForTranscript(data) {
|
|
427
|
+
if (!data || typeof data !== "object") return data;
|
|
428
|
+
const serialized = JSON.stringify(data);
|
|
429
|
+
if (serialized.length <= LINGHUN_DEFAULT_TOOL_RESULT_CHARS && Buffer.byteLength(serialized, "utf8") <= LINGHUN_MAX_TOOL_RESULT_BYTES) {
|
|
430
|
+
return data;
|
|
431
|
+
}
|
|
432
|
+
return {
|
|
433
|
+
truncated: true,
|
|
434
|
+
originalChars: serialized.length,
|
|
435
|
+
preview: serialized.slice(0, TRANSCRIPT_TOOL_OUTPUT_PREVIEW_CHARS)
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
function isToolOutputFailure(name, output) {
|
|
439
|
+
if (name === "Bash") {
|
|
440
|
+
const exitCode = output.data?.exitCode;
|
|
441
|
+
return typeof exitCode === "number" && exitCode !== 0;
|
|
442
|
+
}
|
|
443
|
+
return false;
|
|
444
|
+
}
|
|
445
|
+
async function appendDerivedToolEvents(context, sessionId, name, output) {
|
|
446
|
+
if (name === "Todo") {
|
|
447
|
+
await context.store.appendEvent(sessionId, {
|
|
448
|
+
type: "todo_update",
|
|
449
|
+
items: context.tools.todos,
|
|
450
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
if (name === "Diff" && isDiffSummary(output.data)) {
|
|
454
|
+
await context.store.appendEvent(sessionId, {
|
|
455
|
+
type: "diff_update",
|
|
456
|
+
summary: output.data,
|
|
457
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function isDiffSummary(value) {
|
|
462
|
+
return typeof value === "object" && value !== null && "changedFiles" in value;
|
|
463
|
+
}
|
|
464
|
+
function getToolResultBudgetState(context) {
|
|
465
|
+
context.toolResultBudgetState ??= { seenIds: /* @__PURE__ */ new Set(), replacements: /* @__PURE__ */ new Map() };
|
|
466
|
+
return context.toolResultBudgetState;
|
|
467
|
+
}
|
|
468
|
+
async function appendDeferredToolResultEvent(context, sessionId, toolUseId, dispatchName, content, isError, evidenceId) {
|
|
469
|
+
const budgetedContent = await budgetToolResultTranscriptContent(
|
|
470
|
+
context,
|
|
471
|
+
sessionId,
|
|
472
|
+
toolUseId,
|
|
473
|
+
content
|
|
474
|
+
);
|
|
475
|
+
await context.store.appendEvent(sessionId, {
|
|
476
|
+
type: "tool_result",
|
|
477
|
+
toolUseId,
|
|
478
|
+
toolName: dispatchName,
|
|
479
|
+
content: budgetedContent,
|
|
480
|
+
isError,
|
|
481
|
+
evidenceId,
|
|
482
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
async function appendToolResultEvent(context, sessionId, toolUseId, toolName, content, isError, evidenceId) {
|
|
486
|
+
const budgetedContent = await budgetToolResultTranscriptContent(
|
|
487
|
+
context,
|
|
488
|
+
sessionId,
|
|
489
|
+
toolUseId,
|
|
490
|
+
content
|
|
491
|
+
);
|
|
492
|
+
await context.store.appendEvent(sessionId, {
|
|
493
|
+
type: "tool_result",
|
|
494
|
+
toolUseId,
|
|
495
|
+
toolName,
|
|
496
|
+
content: budgetedContent,
|
|
497
|
+
isError,
|
|
498
|
+
evidenceId,
|
|
499
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
async function budgetToolResultTranscriptContent(context, sessionId, toolUseId, content) {
|
|
503
|
+
const contentText = stringifyToolResultContentForBudget(content);
|
|
504
|
+
if (!contentText || contentText.startsWith("<persisted-tool-result>")) return content;
|
|
505
|
+
if (contentText.length <= LINGHUN_DEFAULT_TOOL_RESULT_CHARS && Buffer.byteLength(contentText, "utf8") <= LINGHUN_MAX_TOOL_RESULT_BYTES) {
|
|
506
|
+
return content;
|
|
507
|
+
}
|
|
508
|
+
const budgeted = await applyToolResultBudgetToMessages(
|
|
509
|
+
[{ role: "tool", tool_call_id: toolUseId, content: contentText }],
|
|
510
|
+
{ projectPath: context.projectPath, sessionId }
|
|
511
|
+
);
|
|
512
|
+
for (const record of budgeted.records) {
|
|
513
|
+
await recordToolResultBudgetEvidence(context, sessionId, record);
|
|
514
|
+
}
|
|
515
|
+
const replacement = budgeted.messages[0];
|
|
516
|
+
return replacement?.role === "tool" ? replacement.content : content;
|
|
517
|
+
}
|
|
518
|
+
function stringifyToolResultContentForBudget(content) {
|
|
519
|
+
if (typeof content === "string") return content;
|
|
520
|
+
try {
|
|
521
|
+
return JSON.stringify(content);
|
|
522
|
+
} catch {
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export {
|
|
528
|
+
TRANSCRIPT_TOOL_OUTPUT_PREVIEW_CHARS,
|
|
529
|
+
TRANSCRIPT_TOOL_OUTPUT_MAX_CHARS,
|
|
530
|
+
MAX_ROUND_ASSISTANT_CHARS_FOR_PROVIDER,
|
|
531
|
+
ROUND_ASSISTANT_HEAD_CHARS,
|
|
532
|
+
ROUND_ASSISTANT_TAIL_CHARS,
|
|
533
|
+
createEvidenceRecord,
|
|
534
|
+
rememberEvidence,
|
|
535
|
+
pickEvidence,
|
|
536
|
+
truncateRoundAssistantForProvider,
|
|
537
|
+
recordProviderFailureEvidence,
|
|
538
|
+
recordModelToolFailureForMetaScheduler,
|
|
539
|
+
sanitizeProviderFailureError,
|
|
540
|
+
sanitizeProviderFailureText,
|
|
541
|
+
recordToolFailureEvidence,
|
|
542
|
+
captureFailureLearning,
|
|
543
|
+
recordArchitectureRuntimeCard,
|
|
544
|
+
recordToolEvidence,
|
|
545
|
+
recordVerificationEvidence,
|
|
546
|
+
recordToolResultBudgetEvidence,
|
|
547
|
+
appendBackgroundTaskEvent,
|
|
548
|
+
appendSystemEvent,
|
|
549
|
+
appendRouteDecisionEvent,
|
|
550
|
+
createToolEndEvent,
|
|
551
|
+
compactToolOutputForTranscript,
|
|
552
|
+
isToolOutputFailure,
|
|
553
|
+
appendDerivedToolEvents,
|
|
554
|
+
getToolResultBudgetState,
|
|
555
|
+
appendDeferredToolResultEvent,
|
|
556
|
+
appendToolResultEvent,
|
|
557
|
+
budgetToolResultTranscriptContent
|
|
558
|
+
};
|