@linghun/tui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/dist/agent-completion-finalizer.d.ts +31 -0
- package/dist/agent-completion-finalizer.d.ts.map +1 -0
- package/dist/agent-completion-finalizer.js +20 -0
- package/dist/agent-handoff-safety.d.ts +13 -0
- package/dist/agent-handoff-safety.d.ts.map +1 -0
- package/dist/agent-handoff-safety.js +43 -0
- package/dist/agent-workflow-registry.d.ts +45 -0
- package/dist/agent-workflow-registry.d.ts.map +1 -0
- package/dist/agent-workflow-registry.js +12 -0
- package/dist/architecture-boundary.d.ts +151 -0
- package/dist/architecture-boundary.d.ts.map +1 -0
- package/dist/architecture-boundary.js +24 -0
- package/dist/architecture-runtime.d.ts +56 -0
- package/dist/architecture-runtime.d.ts.map +1 -0
- package/dist/architecture-runtime.js +18 -0
- package/dist/background-control-runtime.d.ts +29 -0
- package/dist/background-control-runtime.d.ts.map +1 -0
- package/dist/background-control-runtime.js +148 -0
- package/dist/bash-subcommand-parser.d.ts +34 -0
- package/dist/bash-subcommand-parser.d.ts.map +1 -0
- package/dist/bash-subcommand-parser.js +8 -0
- package/dist/batch-tool-confirmation.d.ts +18 -0
- package/dist/batch-tool-confirmation.d.ts.map +1 -0
- package/dist/batch-tool-confirmation.js +100 -0
- package/dist/break-cache-runtime.d.ts +40 -0
- package/dist/break-cache-runtime.d.ts.map +1 -0
- package/dist/break-cache-runtime.js +17 -0
- package/dist/btw-runtime.d.ts +45 -0
- package/dist/btw-runtime.d.ts.map +1 -0
- package/dist/btw-runtime.js +14 -0
- package/dist/cache-command-runtime.d.ts +22 -0
- package/dist/cache-command-runtime.d.ts.map +1 -0
- package/dist/cache-command-runtime.js +33 -0
- package/dist/cache-freshness.d.ts +26 -0
- package/dist/cache-freshness.d.ts.map +1 -0
- package/dist/cache-freshness.js +14 -0
- package/dist/capability-runtime.d.ts +75 -0
- package/dist/capability-runtime.d.ts.map +1 -0
- package/dist/capability-runtime.js +97 -0
- package/dist/chunk-2FVEKTKN.js +86 -0
- package/dist/chunk-2YL5VKJ5.js +531 -0
- package/dist/chunk-3AKXDMVS.js +85 -0
- package/dist/chunk-3GCIXKCI.js +221 -0
- package/dist/chunk-3LT6OWQ2.js +258 -0
- package/dist/chunk-3XNUDLOM.js +91 -0
- package/dist/chunk-4EIC5BCT.js +475 -0
- package/dist/chunk-4EP3TUFF.js +238 -0
- package/dist/chunk-4I2NWBOM.js +117 -0
- package/dist/chunk-4K6UB524.js +443 -0
- package/dist/chunk-4T5DJW54.js +88 -0
- package/dist/chunk-4WHZ6JKD.js +8105 -0
- package/dist/chunk-5H7RRF7C.js +6 -0
- package/dist/chunk-64MJP6FK.js +558 -0
- package/dist/chunk-66BNE332.js +1617 -0
- package/dist/chunk-6CI6TKLN.js +50 -0
- package/dist/chunk-6RJVTUWI.js +16 -0
- package/dist/chunk-6SMM5CMP.js +100 -0
- package/dist/chunk-6USL33ZO.js +289 -0
- package/dist/chunk-7ZE5JFAZ.js +760 -0
- package/dist/chunk-AKPXMCVF.js +1373 -0
- package/dist/chunk-AO4CXI37.js +284 -0
- package/dist/chunk-APJIC2O5.js +150 -0
- package/dist/chunk-B4GQTZMT.js +607 -0
- package/dist/chunk-BFVPLGAC.js +93 -0
- package/dist/chunk-BOV4K7FP.js +588 -0
- package/dist/chunk-CFMSB6ST.js +59 -0
- package/dist/chunk-CFXB5SE5.js +502 -0
- package/dist/chunk-CRQORMFF.js +32 -0
- package/dist/chunk-CRSLDQOA.js +146 -0
- package/dist/chunk-CRW3636S.js +214 -0
- package/dist/chunk-D3UTL2QX.js +86 -0
- package/dist/chunk-D7TCSOAZ.js +331 -0
- package/dist/chunk-DDXS2RDZ.js +228 -0
- package/dist/chunk-DICVLZHH.js +144 -0
- package/dist/chunk-DNQN74CC.js +1186 -0
- package/dist/chunk-DTK5NBTV.js +912 -0
- package/dist/chunk-E72U7WW7.js +50 -0
- package/dist/chunk-EBACIBJP.js +356 -0
- package/dist/chunk-ECFLCY5V.js +530 -0
- package/dist/chunk-EORRZP3F.js +109 -0
- package/dist/chunk-F43AMWLZ.js +115 -0
- package/dist/chunk-F46N43MG.js +56 -0
- package/dist/chunk-F6TVBCZV.js +51 -0
- package/dist/chunk-FRIMDSRU.js +242 -0
- package/dist/chunk-FTAEPAVY.js +314 -0
- package/dist/chunk-GC55DMZV.js +156 -0
- package/dist/chunk-GCMH5P4W.js +422 -0
- package/dist/chunk-GDQQNPBP.js +251 -0
- package/dist/chunk-GKZYTPN2.js +279 -0
- package/dist/chunk-GLWTWEGX.js +272 -0
- package/dist/chunk-GMUCSNUD.js +586 -0
- package/dist/chunk-GTP2KPLY.js +167 -0
- package/dist/chunk-GW5YDCRZ.js +42 -0
- package/dist/chunk-H3T4EF5F.js +87 -0
- package/dist/chunk-HAEU6OTS.js +381 -0
- package/dist/chunk-HQIJGQYU.js +172 -0
- package/dist/chunk-HW2TBXVK.js +34 -0
- package/dist/chunk-HWD22O6F.js +94 -0
- package/dist/chunk-I3NTAIMF.js +280 -0
- package/dist/chunk-IN42UISW.js +372 -0
- package/dist/chunk-IWUIOLMF.js +82 -0
- package/dist/chunk-J7ZE2JKP.js +283 -0
- package/dist/chunk-JBLVBO3U.js +109 -0
- package/dist/chunk-JDWXC2OQ.js +800 -0
- package/dist/chunk-JGDIO2NF.js +74 -0
- package/dist/chunk-JHGWGH2C.js +182 -0
- package/dist/chunk-JLCPHVBN.js +42 -0
- package/dist/chunk-JO5ANTMR.js +6027 -0
- package/dist/chunk-JPXSFZFC.js +100 -0
- package/dist/chunk-JQCRCDOC.js +1195 -0
- package/dist/chunk-K4FSYBSY.js +41 -0
- package/dist/chunk-K56D3X7S.js +1225 -0
- package/dist/chunk-KI7C6ZOD.js +92 -0
- package/dist/chunk-KO64OFSG.js +58 -0
- package/dist/chunk-KQJHVJZB.js +227 -0
- package/dist/chunk-KTWV5JC5.js +59 -0
- package/dist/chunk-L4XXW6Y5.js +374 -0
- package/dist/chunk-L5GOCMZP.js +18 -0
- package/dist/chunk-LDABZV5V.js +278 -0
- package/dist/chunk-LHHKPGLX.js +903 -0
- package/dist/chunk-LL7LBRDL.js +60 -0
- package/dist/chunk-LQTVYUT3.js +421 -0
- package/dist/chunk-LVIM2PA7.js +663 -0
- package/dist/chunk-M4AIK2SP.js +215 -0
- package/dist/chunk-MLUIOBKL.js +420 -0
- package/dist/chunk-MOJL4X4L.js +47 -0
- package/dist/chunk-MVONSJEN.js +300 -0
- package/dist/chunk-N7G2X2LK.js +709 -0
- package/dist/chunk-NKFKOEYX.js +146 -0
- package/dist/chunk-NMNOAFFT.js +167 -0
- package/dist/chunk-NSIKYD3X.js +74 -0
- package/dist/chunk-O7EFPSMC.js +60 -0
- package/dist/chunk-O7S3HYE6.js +210 -0
- package/dist/chunk-OEYW3JE3.js +262 -0
- package/dist/chunk-OF3K3CU5.js +159 -0
- package/dist/chunk-OMZYPQVA.js +298 -0
- package/dist/chunk-OZMX3E35.js +248 -0
- package/dist/chunk-P277M7Z5.js +303 -0
- package/dist/chunk-P4CPRJLI.js +65 -0
- package/dist/chunk-PBIPV4LD.js +494 -0
- package/dist/chunk-PGNALDEH.js +2003 -0
- package/dist/chunk-PGWW3DVE.js +157 -0
- package/dist/chunk-QB4VWH7W.js +515 -0
- package/dist/chunk-QBCGAIU7.js +120 -0
- package/dist/chunk-QIU3FJPC.js +99 -0
- package/dist/chunk-QLRTQHTR.js +744 -0
- package/dist/chunk-QTDGRZMZ.js +171 -0
- package/dist/chunk-RBOQJFIZ.js +183 -0
- package/dist/chunk-RDGM4RUE.js +178 -0
- package/dist/chunk-RM5JDRCW.js +71 -0
- package/dist/chunk-RM5QMOFY.js +189 -0
- package/dist/chunk-RMLTVKOY.js +588 -0
- package/dist/chunk-RVY34HK4.js +79 -0
- package/dist/chunk-S3YWTBXL.js +43 -0
- package/dist/chunk-SJOS5PM6.js +64 -0
- package/dist/chunk-SOPYWTFV.js +90 -0
- package/dist/chunk-SQIBPLLV.js +15 -0
- package/dist/chunk-SRZIA6B4.js +136 -0
- package/dist/chunk-SYBNJZEL.js +250 -0
- package/dist/chunk-TFZEFIQT.js +17 -0
- package/dist/chunk-THZBFYAH.js +136 -0
- package/dist/chunk-TJLC3QAS.js +83 -0
- package/dist/chunk-TYF4GJR3.js +598 -0
- package/dist/chunk-UDQT5CWK.js +252 -0
- package/dist/chunk-UOHZQIVL.js +168 -0
- package/dist/chunk-URNQUECO.js +187 -0
- package/dist/chunk-UT2TYK2A.js +148 -0
- package/dist/chunk-UT5BOJKU.js +190 -0
- package/dist/chunk-V7GDHHBL.js +526 -0
- package/dist/chunk-VCSRBS47.js +133 -0
- package/dist/chunk-VIBENDE3.js +152 -0
- package/dist/chunk-VTQL23UM.js +302 -0
- package/dist/chunk-W3KHJNSH.js +281 -0
- package/dist/chunk-W6NU7ZAV.js +52 -0
- package/dist/chunk-WHFDDZHY.js +407 -0
- package/dist/chunk-WJWYRBWH.js +48 -0
- package/dist/chunk-WKMBK5UP.js +145 -0
- package/dist/chunk-WQMSRO4D.js +489 -0
- package/dist/chunk-WV6YJGZR.js +81 -0
- package/dist/chunk-WVAQYKGL.js +269 -0
- package/dist/chunk-X7A22JHP.js +106 -0
- package/dist/chunk-XFPNU42I.js +59 -0
- package/dist/chunk-YH6UIHNF.js +161 -0
- package/dist/chunk-YPQFSFYK.js +19 -0
- package/dist/chunk-YTQFOZRZ.js +110 -0
- package/dist/chunk-ZJK25VFP.js +506 -0
- package/dist/chunk-ZOSK2UEU.js +1555 -0
- package/dist/chunk-ZYSN7AWW.js +336 -0
- package/dist/chunk-ZZ2CNCXJ.js +282 -0
- package/dist/command-panel-runtime.d.ts +33 -0
- package/dist/command-panel-runtime.d.ts.map +1 -0
- package/dist/command-panel-runtime.js +80 -0
- package/dist/compact-cache-command-runtime.d.ts +38 -0
- package/dist/compact-cache-command-runtime.d.ts.map +1 -0
- package/dist/compact-cache-command-runtime.js +146 -0
- package/dist/compact-context.d.ts +35 -0
- package/dist/compact-context.d.ts.map +1 -0
- package/dist/compact-context.js +16 -0
- package/dist/compact-preflight-runtime.d.ts +46 -0
- package/dist/compact-preflight-runtime.d.ts.map +1 -0
- package/dist/compact-preflight-runtime.js +62 -0
- package/dist/connector-runtime.d.ts +72 -0
- package/dist/connector-runtime.d.ts.map +1 -0
- package/dist/connector-runtime.js +88 -0
- package/dist/context-estimator.d.ts +20 -0
- package/dist/context-estimator.d.ts.map +1 -0
- package/dist/context-estimator.js +18 -0
- package/dist/context-window-runtime.d.ts +12 -0
- package/dist/context-window-runtime.d.ts.map +1 -0
- package/dist/context-window-runtime.js +10 -0
- package/dist/deep-compact-runtime.d.ts +53 -0
- package/dist/deep-compact-runtime.d.ts.map +1 -0
- package/dist/deep-compact-runtime.js +35 -0
- package/dist/deferred-tools-catalog.d.ts +52 -0
- package/dist/deferred-tools-catalog.d.ts.map +1 -0
- package/dist/deferred-tools-catalog.js +42 -0
- package/dist/details-status-runtime.d.ts +48 -0
- package/dist/details-status-runtime.d.ts.map +1 -0
- package/dist/details-status-runtime.js +102 -0
- package/dist/evidence-runtime.d.ts +48 -0
- package/dist/evidence-runtime.d.ts.map +1 -0
- package/dist/evidence-runtime.js +92 -0
- package/dist/extension-command-runtime.d.ts +63 -0
- package/dist/extension-command-runtime.d.ts.map +1 -0
- package/dist/extension-command-runtime.js +67 -0
- package/dist/extension-slash-runtime.d.ts +11 -0
- package/dist/extension-slash-runtime.d.ts.map +1 -0
- package/dist/extension-slash-runtime.js +79 -0
- package/dist/external-editor-runtime.d.ts +32 -0
- package/dist/external-editor-runtime.d.ts.map +1 -0
- package/dist/external-editor-runtime.js +71 -0
- package/dist/failure-learning-command-runtime.d.ts +10 -0
- package/dist/failure-learning-command-runtime.d.ts.map +1 -0
- package/dist/failure-learning-command-runtime.js +78 -0
- package/dist/failure-learning-presenter.d.ts +6 -0
- package/dist/failure-learning-presenter.d.ts.map +1 -0
- package/dist/failure-learning-presenter.js +12 -0
- package/dist/failure-learning-runtime.d.ts +39 -0
- package/dist/failure-learning-runtime.d.ts.map +1 -0
- package/dist/failure-learning-runtime.js +39 -0
- package/dist/feature-flag-runtime.d.ts +8 -0
- package/dist/feature-flag-runtime.d.ts.map +1 -0
- package/dist/feature-flag-runtime.js +12 -0
- package/dist/feishu-long-connection-runtime.d.ts +12 -0
- package/dist/feishu-long-connection-runtime.d.ts.map +1 -0
- package/dist/feishu-long-connection-runtime.js +7 -0
- package/dist/final-answer-gate.d.ts +24 -0
- package/dist/final-answer-gate.d.ts.map +1 -0
- package/dist/final-answer-gate.js +26 -0
- package/dist/ghost-text.d.ts +16 -0
- package/dist/ghost-text.d.ts.map +1 -0
- package/dist/ghost-text.js +8 -0
- package/dist/git-branch-runtime.d.ts +14 -0
- package/dist/git-branch-runtime.d.ts.map +1 -0
- package/dist/git-branch-runtime.js +68 -0
- package/dist/git-command-runtime.d.ts +22 -0
- package/dist/git-command-runtime.d.ts.map +1 -0
- package/dist/git-command-runtime.js +89 -0
- package/dist/git-operation-runtime.d.ts +188 -0
- package/dist/git-operation-runtime.d.ts.map +1 -0
- package/dist/git-operation-runtime.js +45 -0
- package/dist/git-runtime.d.ts +113 -0
- package/dist/git-runtime.d.ts.map +1 -0
- package/dist/git-runtime.js +16 -0
- package/dist/git-slash-runtime.d.ts +38 -0
- package/dist/git-slash-runtime.d.ts.map +1 -0
- package/dist/git-slash-runtime.js +18 -0
- package/dist/git-tool-dispatch-runtime.d.ts +108 -0
- package/dist/git-tool-dispatch-runtime.d.ts.map +1 -0
- package/dist/git-tool-dispatch-runtime.js +25 -0
- package/dist/git-tool-runtime.d.ts +64 -0
- package/dist/git-tool-runtime.d.ts.map +1 -0
- package/dist/git-tool-runtime.js +36 -0
- package/dist/guard-wiring.d.ts +67 -0
- package/dist/guard-wiring.d.ts.map +1 -0
- package/dist/guard-wiring.js +21 -0
- package/dist/handoff-session-runtime.d.ts +11 -0
- package/dist/handoff-session-runtime.d.ts.map +1 -0
- package/dist/handoff-session-runtime.js +36 -0
- package/dist/index-result-presenter.d.ts +14 -0
- package/dist/index-result-presenter.d.ts.map +1 -0
- package/dist/index-result-presenter.js +28 -0
- package/dist/index-runtime.d.ts +64 -0
- package/dist/index-runtime.d.ts.map +1 -0
- package/dist/index-runtime.js +28 -0
- package/dist/index-tool-runtime.d.ts +44 -0
- package/dist/index-tool-runtime.d.ts.map +1 -0
- package/dist/index-tool-runtime.js +24 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2346 -0
- package/dist/job-agent-command-runtime.d.ts +127 -0
- package/dist/job-agent-command-runtime.d.ts.map +1 -0
- package/dist/job-agent-command-runtime.js +138 -0
- package/dist/job-runner-presenter.d.ts +32 -0
- package/dist/job-runner-presenter.d.ts.map +1 -0
- package/dist/job-runner-presenter.js +30 -0
- package/dist/job-runtime.d.ts +65 -0
- package/dist/job-runtime.d.ts.map +1 -0
- package/dist/job-runtime.js +88 -0
- package/dist/keybinding-runtime.d.ts +29 -0
- package/dist/keybinding-runtime.d.ts.map +1 -0
- package/dist/keybinding-runtime.js +14 -0
- package/dist/log-artifact.d.ts +55 -0
- package/dist/log-artifact.d.ts.map +1 -0
- package/dist/log-artifact.js +10 -0
- package/dist/mcp-index-command-runtime.d.ts +21 -0
- package/dist/mcp-index-command-runtime.d.ts.map +1 -0
- package/dist/mcp-index-command-runtime.js +18 -0
- package/dist/mcp-index-runtime.d.ts +106 -0
- package/dist/mcp-index-runtime.d.ts.map +1 -0
- package/dist/mcp-index-runtime.js +142 -0
- package/dist/mcp-sse-runtime.d.ts +13 -0
- package/dist/mcp-sse-runtime.d.ts.map +1 -0
- package/dist/mcp-sse-runtime.js +8 -0
- package/dist/mcp-stdio-runtime.d.ts +37 -0
- package/dist/mcp-stdio-runtime.d.ts.map +1 -0
- package/dist/mcp-stdio-runtime.js +15 -0
- package/dist/memory-command-runtime.d.ts +37 -0
- package/dist/memory-command-runtime.d.ts.map +1 -0
- package/dist/memory-command-runtime.js +88 -0
- package/dist/memory-eviction-runtime.d.ts +7 -0
- package/dist/memory-eviction-runtime.d.ts.map +1 -0
- package/dist/memory-eviction-runtime.js +12 -0
- package/dist/memory-extraction-runtime.d.ts +40 -0
- package/dist/memory-extraction-runtime.d.ts.map +1 -0
- package/dist/memory-extraction-runtime.js +20 -0
- package/dist/memory-rules-runtime.d.ts +15 -0
- package/dist/memory-rules-runtime.d.ts.map +1 -0
- package/dist/memory-rules-runtime.js +14 -0
- package/dist/meta-scheduler-complexity.d.ts +16 -0
- package/dist/meta-scheduler-complexity.d.ts.map +1 -0
- package/dist/meta-scheduler-complexity.js +37 -0
- package/dist/meta-scheduler-runtime.d.ts +288 -0
- package/dist/meta-scheduler-runtime.d.ts.map +1 -0
- package/dist/meta-scheduler-runtime.js +17 -0
- package/dist/model-command-runtime.d.ts +12 -0
- package/dist/model-command-runtime.d.ts.map +1 -0
- package/dist/model-command-runtime.js +84 -0
- package/dist/model-doctor-runtime.d.ts +81 -0
- package/dist/model-doctor-runtime.d.ts.map +1 -0
- package/dist/model-doctor-runtime.js +46 -0
- package/dist/model-loop-runtime.d.ts +189 -0
- package/dist/model-loop-runtime.d.ts.map +1 -0
- package/dist/model-loop-runtime.js +141 -0
- package/dist/model-prompt-runtime.d.ts +25 -0
- package/dist/model-prompt-runtime.d.ts.map +1 -0
- package/dist/model-prompt-runtime.js +33 -0
- package/dist/model-setup-runtime.d.ts +28 -0
- package/dist/model-setup-runtime.d.ts.map +1 -0
- package/dist/model-setup-runtime.js +26 -0
- package/dist/model-stream-runtime.d.ts +47 -0
- package/dist/model-stream-runtime.d.ts.map +1 -0
- package/dist/model-stream-runtime.js +136 -0
- package/dist/model-tool-runtime.d.ts +114 -0
- package/dist/model-tool-runtime.d.ts.map +1 -0
- package/dist/model-tool-runtime.js +144 -0
- package/dist/natural-command-bridge.d.ts +158 -0
- package/dist/natural-command-bridge.d.ts.map +1 -0
- package/dist/natural-command-bridge.js +36 -0
- package/dist/pending-details-presenter.d.ts +8 -0
- package/dist/pending-details-presenter.d.ts.map +1 -0
- package/dist/pending-details-presenter.js +12 -0
- package/dist/permission-approval-runtime.d.ts +28 -0
- package/dist/permission-approval-runtime.d.ts.map +1 -0
- package/dist/permission-approval-runtime.js +136 -0
- package/dist/permission-continuation-runtime.d.ts +90 -0
- package/dist/permission-continuation-runtime.d.ts.map +1 -0
- package/dist/permission-continuation-runtime.js +68 -0
- package/dist/permission-policy-engine.d.ts +51 -0
- package/dist/permission-policy-engine.d.ts.map +1 -0
- package/dist/permission-policy-engine.js +12 -0
- package/dist/permission-presenter.d.ts +13 -0
- package/dist/permission-presenter.d.ts.map +1 -0
- package/dist/permission-presenter.js +8 -0
- package/dist/persistent-history.d.ts +18 -0
- package/dist/persistent-history.d.ts.map +1 -0
- package/dist/persistent-history.js +126 -0
- package/dist/platform-security.d.ts +4 -0
- package/dist/platform-security.d.ts.map +1 -0
- package/dist/platform-security.js +10 -0
- package/dist/process-command-runtime.d.ts +9 -0
- package/dist/process-command-runtime.d.ts.map +1 -0
- package/dist/process-command-runtime.js +11 -0
- package/dist/process-guard.d.ts +56 -0
- package/dist/process-guard.d.ts.map +1 -0
- package/dist/process-guard.js +22 -0
- package/dist/prompt-command-runtime.d.ts +12 -0
- package/dist/prompt-command-runtime.d.ts.map +1 -0
- package/dist/prompt-command-runtime.js +10 -0
- package/dist/prompt-stash.d.ts +15 -0
- package/dist/prompt-stash.d.ts.map +1 -0
- package/dist/prompt-stash.js +8 -0
- package/dist/provider-circuit-breaker.d.ts +132 -0
- package/dist/provider-circuit-breaker.d.ts.map +1 -0
- package/dist/provider-circuit-breaker.js +31 -0
- package/dist/provider-loop-runtime.d.ts +18 -0
- package/dist/provider-loop-runtime.d.ts.map +1 -0
- package/dist/provider-loop-runtime.js +16 -0
- package/dist/remote-command-runtime.d.ts +47 -0
- package/dist/remote-command-runtime.d.ts.map +1 -0
- package/dist/remote-command-runtime.js +125 -0
- package/dist/remote-inbound-bridge-runtime.d.ts +152 -0
- package/dist/remote-inbound-bridge-runtime.d.ts.map +1 -0
- package/dist/remote-inbound-bridge-runtime.js +44 -0
- package/dist/remote-mcp-presenter.d.ts +5 -0
- package/dist/remote-mcp-presenter.d.ts.map +1 -0
- package/dist/remote-mcp-presenter.js +10 -0
- package/dist/remote-repl-bridge-runtime.d.ts +134 -0
- package/dist/remote-repl-bridge-runtime.d.ts.map +1 -0
- package/dist/remote-repl-bridge-runtime.js +20 -0
- package/dist/remote-transport.d.ts +50 -0
- package/dist/remote-transport.d.ts.map +1 -0
- package/dist/remote-transport.js +14 -0
- package/dist/request-lifecycle-presenter.d.ts +25 -0
- package/dist/request-lifecycle-presenter.d.ts.map +1 -0
- package/dist/request-lifecycle-presenter.js +22 -0
- package/dist/runner-runtime.d.ts +41 -0
- package/dist/runner-runtime.d.ts.map +1 -0
- package/dist/runner-runtime.js +35 -0
- package/dist/runtime-budget.d.ts +38 -0
- package/dist/runtime-budget.d.ts.map +1 -0
- package/dist/runtime-budget.js +78 -0
- package/dist/runtime-path-marker.d.ts +112 -0
- package/dist/runtime-path-marker.d.ts.map +1 -0
- package/dist/runtime-path-marker.js +18 -0
- package/dist/runtime-status-presenter.d.ts +22 -0
- package/dist/runtime-status-presenter.d.ts.map +1 -0
- package/dist/runtime-status-presenter.js +15 -0
- package/dist/runtime-status-snapshot.d.ts +52 -0
- package/dist/runtime-status-snapshot.d.ts.map +1 -0
- package/dist/runtime-status-snapshot.js +11 -0
- package/dist/runtime-utils.d.ts +2 -0
- package/dist/runtime-utils.d.ts.map +1 -0
- package/dist/runtime-utils.js +6 -0
- package/dist/shell/clipboard.d.ts +23 -0
- package/dist/shell/clipboard.d.ts.map +1 -0
- package/dist/shell/clipboard.js +8 -0
- package/dist/shell/components/AgentProgressTree.d.ts +9 -0
- package/dist/shell/components/AgentProgressTree.d.ts.map +1 -0
- package/dist/shell/components/AgentProgressTree.js +9 -0
- package/dist/shell/components/BackgroundTaskOverlay.d.ts +8 -0
- package/dist/shell/components/BackgroundTaskOverlay.d.ts.map +1 -0
- package/dist/shell/components/BackgroundTaskOverlay.js +8 -0
- package/dist/shell/components/BtwPanel.d.ts +16 -0
- package/dist/shell/components/BtwPanel.d.ts.map +1 -0
- package/dist/shell/components/BtwPanel.js +8 -0
- package/dist/shell/components/CommandPanel.d.ts +11 -0
- package/dist/shell/components/CommandPanel.d.ts.map +1 -0
- package/dist/shell/components/CommandPanel.js +8 -0
- package/dist/shell/components/Composer.d.ts +187 -0
- package/dist/shell/components/Composer.d.ts.map +1 -0
- package/dist/shell/components/Composer.js +99 -0
- package/dist/shell/components/ConfigPanel.d.ts +11 -0
- package/dist/shell/components/ConfigPanel.d.ts.map +1 -0
- package/dist/shell/components/ConfigPanel.js +8 -0
- package/dist/shell/components/CtrlOToExpand.d.ts +30 -0
- package/dist/shell/components/CtrlOToExpand.d.ts.map +1 -0
- package/dist/shell/components/CtrlOToExpand.js +16 -0
- package/dist/shell/components/HelpPanel.d.ts +19 -0
- package/dist/shell/components/HelpPanel.d.ts.map +1 -0
- package/dist/shell/components/HelpPanel.js +8 -0
- package/dist/shell/components/HistorySearchPanel.d.ts +14 -0
- package/dist/shell/components/HistorySearchPanel.d.ts.map +1 -0
- package/dist/shell/components/HistorySearchPanel.js +104 -0
- package/dist/shell/components/MessageMarkdown.d.ts +34 -0
- package/dist/shell/components/MessageMarkdown.d.ts.map +1 -0
- package/dist/shell/components/MessageMarkdown.js +18 -0
- package/dist/shell/components/MessageResponse.d.ts +14 -0
- package/dist/shell/components/MessageResponse.d.ts.map +1 -0
- package/dist/shell/components/MessageResponse.js +6 -0
- package/dist/shell/components/MouseInputRouter.d.ts +28 -0
- package/dist/shell/components/MouseInputRouter.d.ts.map +1 -0
- package/dist/shell/components/MouseInputRouter.js +84 -0
- package/dist/shell/components/NotificationStack.d.ts +19 -0
- package/dist/shell/components/NotificationStack.d.ts.map +1 -0
- package/dist/shell/components/NotificationStack.js +6 -0
- package/dist/shell/components/OutputLine.d.ts +19 -0
- package/dist/shell/components/OutputLine.d.ts.map +1 -0
- package/dist/shell/components/OutputLine.js +38 -0
- package/dist/shell/components/ProductBlock.d.ts +10 -0
- package/dist/shell/components/ProductBlock.d.ts.map +1 -0
- package/dist/shell/components/ProductBlock.js +12 -0
- package/dist/shell/components/ScrollViewport.d.ts +43 -0
- package/dist/shell/components/ScrollViewport.d.ts.map +1 -0
- package/dist/shell/components/ScrollViewport.js +86 -0
- package/dist/shell/components/SessionsPanel.d.ts +24 -0
- package/dist/shell/components/SessionsPanel.d.ts.map +1 -0
- package/dist/shell/components/SessionsPanel.js +8 -0
- package/dist/shell/components/ShellApp.d.ts +8 -0
- package/dist/shell/components/ShellApp.d.ts.map +1 -0
- package/dist/shell/components/ShellApp.js +45 -0
- package/dist/shell/components/ShortcutPanel.d.ts +14 -0
- package/dist/shell/components/ShortcutPanel.d.ts.map +1 -0
- package/dist/shell/components/ShortcutPanel.js +59 -0
- package/dist/shell/components/SlashSuggestions.d.ts +24 -0
- package/dist/shell/components/SlashSuggestions.d.ts.map +1 -0
- package/dist/shell/components/SlashSuggestions.js +7 -0
- package/dist/shell/components/StatusFooter.d.ts +30 -0
- package/dist/shell/components/StatusFooter.d.ts.map +1 -0
- package/dist/shell/components/StatusFooter.js +7 -0
- package/dist/shell/components/StatusTray.d.ts +9 -0
- package/dist/shell/components/StatusTray.d.ts.map +1 -0
- package/dist/shell/components/StatusTray.js +6 -0
- package/dist/shell/components/StructuredDiff.d.ts +9 -0
- package/dist/shell/components/StructuredDiff.d.ts.map +1 -0
- package/dist/shell/components/StructuredDiff.js +7 -0
- package/dist/shell/components/TaskListView.d.ts +9 -0
- package/dist/shell/components/TaskListView.d.ts.map +1 -0
- package/dist/shell/components/TaskListView.js +9 -0
- package/dist/shell/components/TaskSuggestionBar.d.ts +15 -0
- package/dist/shell/components/TaskSuggestionBar.d.ts.map +1 -0
- package/dist/shell/components/TaskSuggestionBar.js +8 -0
- package/dist/shell/components/UnseenMessagePill.d.ts +12 -0
- package/dist/shell/components/UnseenMessagePill.d.ts.map +1 -0
- package/dist/shell/components/UnseenMessagePill.js +6 -0
- package/dist/shell/components/WorkflowProgressView.d.ts +9 -0
- package/dist/shell/components/WorkflowProgressView.d.ts.map +1 -0
- package/dist/shell/components/WorkflowProgressView.js +9 -0
- package/dist/shell/components/useAnchoredCursor.d.ts +32 -0
- package/dist/shell/components/useAnchoredCursor.d.ts.map +1 -0
- package/dist/shell/components/useAnchoredCursor.js +6 -0
- package/dist/shell/hooks/useRenderThrottle.d.ts +2 -0
- package/dist/shell/hooks/useRenderThrottle.d.ts.map +1 -0
- package/dist/shell/hooks/useRenderThrottle.js +35 -0
- package/dist/shell/hooks/useScrollBatcher.d.ts +10 -0
- package/dist/shell/hooks/useScrollBatcher.d.ts.map +1 -0
- package/dist/shell/hooks/useScrollBatcher.js +23 -0
- package/dist/shell/hooks/useScrollRuntime.d.ts +2 -0
- package/dist/shell/hooks/useScrollRuntime.d.ts.map +1 -0
- package/dist/shell/hooks/useScrollRuntime.js +6 -0
- package/dist/shell/hyperlink-utils.d.ts +18 -0
- package/dist/shell/hyperlink-utils.d.ts.map +1 -0
- package/dist/shell/hyperlink-utils.js +8 -0
- package/dist/shell/ink-renderer.d.ts +18 -0
- package/dist/shell/ink-renderer.d.ts.map +1 -0
- package/dist/shell/ink-renderer.js +54 -0
- package/dist/shell/models/command-transcript-presenter.d.ts +73 -0
- package/dist/shell/models/command-transcript-presenter.d.ts.map +1 -0
- package/dist/shell/models/command-transcript-presenter.js +26 -0
- package/dist/shell/models/help-panel.d.ts +37 -0
- package/dist/shell/models/help-panel.d.ts.map +1 -0
- package/dist/shell/models/help-panel.js +10 -0
- package/dist/shell/models/permission-elevation.d.ts +65 -0
- package/dist/shell/models/permission-elevation.d.ts.map +1 -0
- package/dist/shell/models/permission-elevation.js +10 -0
- package/dist/shell/models/permission-explanation.d.ts +45 -0
- package/dist/shell/models/permission-explanation.d.ts.map +1 -0
- package/dist/shell/models/permission-explanation.js +14 -0
- package/dist/shell/models/session-panel.d.ts +22 -0
- package/dist/shell/models/session-panel.d.ts.map +1 -0
- package/dist/shell/models/session-panel.js +18 -0
- package/dist/shell/models/task-scroll-state.d.ts +24 -0
- package/dist/shell/models/task-scroll-state.d.ts.map +1 -0
- package/dist/shell/models/task-scroll-state.js +26 -0
- package/dist/shell/models/terminal-input-runtime.d.ts +37 -0
- package/dist/shell/models/terminal-input-runtime.d.ts.map +1 -0
- package/dist/shell/models/terminal-input-runtime.js +18 -0
- package/dist/shell/models/transcript-scroll-state.d.ts +57 -0
- package/dist/shell/models/transcript-scroll-state.d.ts.map +1 -0
- package/dist/shell/models/transcript-scroll-state.js +12 -0
- package/dist/shell/models/transcript-selection-state.d.ts +39 -0
- package/dist/shell/models/transcript-selection-state.d.ts.map +1 -0
- package/dist/shell/models/transcript-selection-state.js +25 -0
- package/dist/shell/models/wheel-acceleration.d.ts +52 -0
- package/dist/shell/models/wheel-acceleration.d.ts.map +1 -0
- package/dist/shell/models/wheel-acceleration.js +6 -0
- package/dist/shell/output-utils.d.ts +22 -0
- package/dist/shell/output-utils.d.ts.map +1 -0
- package/dist/shell/output-utils.js +12 -0
- package/dist/shell/plain-renderer.d.ts +12 -0
- package/dist/shell/plain-renderer.d.ts.map +1 -0
- package/dist/shell/plain-renderer.js +13 -0
- package/dist/shell/progress-views.d.ts +10 -0
- package/dist/shell/progress-views.d.ts.map +1 -0
- package/dist/shell/progress-views.js +17 -0
- package/dist/shell/stdout-flush-barrier.d.ts +39 -0
- package/dist/shell/stdout-flush-barrier.d.ts.map +1 -0
- package/dist/shell/stdout-flush-barrier.js +10 -0
- package/dist/shell/terminal-capability.d.ts +54 -0
- package/dist/shell/terminal-capability.d.ts.map +1 -0
- package/dist/shell/terminal-capability.js +10 -0
- package/dist/shell/terminal-interaction-runtime.d.ts +11 -0
- package/dist/shell/terminal-interaction-runtime.d.ts.map +1 -0
- package/dist/shell/terminal-interaction-runtime.js +38 -0
- package/dist/shell/terminal-state-recovery.d.ts +52 -0
- package/dist/shell/terminal-state-recovery.d.ts.map +1 -0
- package/dist/shell/terminal-state-recovery.js +11 -0
- package/dist/shell/text-utils.d.ts +40 -0
- package/dist/shell/text-utils.d.ts.map +1 -0
- package/dist/shell/text-utils.js +26 -0
- package/dist/shell/theme.d.ts +41 -0
- package/dist/shell/theme.d.ts.map +1 -0
- package/dist/shell/theme.js +8 -0
- package/dist/shell/types.d.ts +784 -0
- package/dist/shell/types.d.ts.map +1 -0
- package/dist/shell/types.js +0 -0
- package/dist/shell/view-model.d.ts +82 -0
- package/dist/shell/view-model.d.ts.map +1 -0
- package/dist/shell/view-model.js +48 -0
- package/dist/slash-command-runtime.d.ts +64 -0
- package/dist/slash-command-runtime.d.ts.map +1 -0
- package/dist/slash-command-runtime.js +186 -0
- package/dist/slash-dispatch.d.ts +48 -0
- package/dist/slash-dispatch.d.ts.map +1 -0
- package/dist/slash-dispatch.js +53 -0
- package/dist/startup-runtime.d.ts +48 -0
- package/dist/startup-runtime.d.ts.map +1 -0
- package/dist/startup-runtime.js +43 -0
- package/dist/terminal-readiness-presenter.d.ts +131 -0
- package/dist/terminal-readiness-presenter.d.ts.map +1 -0
- package/dist/terminal-readiness-presenter.js +16 -0
- package/dist/terminal-readiness-runtime.d.ts +5 -0
- package/dist/terminal-readiness-runtime.d.ts.map +1 -0
- package/dist/terminal-readiness-runtime.js +15 -0
- package/dist/terminal-setup-runtime.d.ts +34 -0
- package/dist/terminal-setup-runtime.d.ts.map +1 -0
- package/dist/terminal-setup-runtime.js +257 -0
- package/dist/tool-output-presenter.d.ts +38 -0
- package/dist/tool-output-presenter.d.ts.map +1 -0
- package/dist/tool-output-presenter.js +16 -0
- package/dist/tool-result-budget.d.ts +42 -0
- package/dist/tool-result-budget.d.ts.map +1 -0
- package/dist/tool-result-budget.js +11 -0
- package/dist/tui-agent-job-runtime.d.ts +38 -0
- package/dist/tui-agent-job-runtime.d.ts.map +1 -0
- package/dist/tui-agent-job-runtime.js +86 -0
- package/dist/tui-context-runtime.d.ts +426 -0
- package/dist/tui-context-runtime.d.ts.map +1 -0
- package/dist/tui-context-runtime.js +65 -0
- package/dist/tui-data-types.d.ts +923 -0
- package/dist/tui-data-types.d.ts.map +1 -0
- package/dist/tui-data-types.js +0 -0
- package/dist/tui-details-runtime.d.ts +25 -0
- package/dist/tui-details-runtime.d.ts.map +1 -0
- package/dist/tui-details-runtime.js +29 -0
- package/dist/tui-memory-runtime.d.ts +33 -0
- package/dist/tui-memory-runtime.d.ts.map +1 -0
- package/dist/tui-memory-runtime.js +58 -0
- package/dist/tui-messages.d.ts +4 -0
- package/dist/tui-messages.d.ts.map +1 -0
- package/dist/tui-messages.js +6 -0
- package/dist/tui-model-runtime.d.ts +30 -0
- package/dist/tui-model-runtime.d.ts.map +1 -0
- package/dist/tui-model-runtime.js +39 -0
- package/dist/tui-output-surface.d.ts +141 -0
- package/dist/tui-output-surface.d.ts.map +1 -0
- package/dist/tui-output-surface.js +55 -0
- package/dist/tui-permission-runtime.d.ts +62 -0
- package/dist/tui-permission-runtime.d.ts.map +1 -0
- package/dist/tui-permission-runtime.js +24 -0
- package/dist/tui-state-runtime.d.ts +21 -0
- package/dist/tui-state-runtime.d.ts.map +1 -0
- package/dist/tui-state-runtime.js +47 -0
- package/dist/turn-continuity-runtime.d.ts +30 -0
- package/dist/turn-continuity-runtime.d.ts.map +1 -0
- package/dist/turn-continuity-runtime.js +8 -0
- package/dist/undo-ring.d.ts +16 -0
- package/dist/undo-ring.d.ts.map +1 -0
- package/dist/undo-ring.js +12 -0
- package/dist/usage-stats-presenter.d.ts +17 -0
- package/dist/usage-stats-presenter.d.ts.map +1 -0
- package/dist/usage-stats-presenter.js +22 -0
- package/dist/user-state-signal-runtime.d.ts +33 -0
- package/dist/user-state-signal-runtime.d.ts.map +1 -0
- package/dist/user-state-signal-runtime.js +8 -0
- package/dist/verification-command-runtime.d.ts +25 -0
- package/dist/verification-command-runtime.d.ts.map +1 -0
- package/dist/verification-command-runtime.js +51 -0
- package/dist/verification-level.d.ts +93 -0
- package/dist/verification-level.d.ts.map +1 -0
- package/dist/verification-level.js +18 -0
- package/dist/workflow-agent-runtime-bridge.d.ts +169 -0
- package/dist/workflow-agent-runtime-bridge.d.ts.map +1 -0
- package/dist/workflow-agent-runtime-bridge.js +9 -0
- package/dist/workflow-command-runtime.d.ts +94 -0
- package/dist/workflow-command-runtime.d.ts.map +1 -0
- package/dist/workflow-command-runtime.js +114 -0
- package/dist/workflow-plan-schema.d.ts +161 -0
- package/dist/workflow-plan-schema.d.ts.map +1 -0
- package/dist/workflow-plan-schema.js +12 -0
- package/dist/workflow-planner-entry.d.ts +52 -0
- package/dist/workflow-planner-entry.d.ts.map +1 -0
- package/dist/workflow-planner-entry.js +328 -0
- package/dist/workflow-task-surface.d.ts +39 -0
- package/dist/workflow-task-surface.d.ts.map +1 -0
- package/dist/workflow-task-surface.js +7 -0
- package/dist/workspace-reference-cache.d.ts +110 -0
- package/dist/workspace-reference-cache.d.ts.map +1 -0
- package/dist/workspace-reference-cache.js +12 -0
- package/package.json +41 -0
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatIndexRuntimeRef
|
|
3
|
+
} from "./chunk-UT2TYK2A.js";
|
|
4
|
+
import {
|
|
5
|
+
withProviderRetry
|
|
6
|
+
} from "./chunk-EBACIBJP.js";
|
|
7
|
+
import {
|
|
8
|
+
createManualCompactBoundary
|
|
9
|
+
} from "./chunk-URNQUECO.js";
|
|
10
|
+
import {
|
|
11
|
+
estimateTranscriptContextChars
|
|
12
|
+
} from "./chunk-WV6YJGZR.js";
|
|
13
|
+
import {
|
|
14
|
+
sanitizeDiagnosticText,
|
|
15
|
+
sanitizeDisplayPaths,
|
|
16
|
+
truncateDisplay
|
|
17
|
+
} from "./chunk-OMZYPQVA.js";
|
|
18
|
+
|
|
19
|
+
// src/deep-compact-runtime.ts
|
|
20
|
+
import { randomUUID } from "crypto";
|
|
21
|
+
import { redactCommonSecrets } from "@linghun/shared";
|
|
22
|
+
var DEEP_COMPACT_EVENT_TYPE = "deep_compact_packet";
|
|
23
|
+
var DEEP_COMPACT_FAILURE_COOLDOWN_MS = 2 * 60 * 1e3;
|
|
24
|
+
var DEEP_COMPACT_SUMMARY_MAX_CHARS = 4e3;
|
|
25
|
+
var DEEP_COMPACT_RERUN_EVENT_THRESHOLD = 40;
|
|
26
|
+
var RECENT_TRANSCRIPT_TAIL_EVENTS = 24;
|
|
27
|
+
var EVENT_TEXT_LIMIT = 420;
|
|
28
|
+
async function maybeRunDeepCompactBeforeProvider(input) {
|
|
29
|
+
if (!input.gateway) {
|
|
30
|
+
return failMessage(input.context, "Deep compact unavailable: model gateway is not ready.");
|
|
31
|
+
}
|
|
32
|
+
const resumed = await input.context.store.resume(input.sessionId);
|
|
33
|
+
if (!shouldRunDeepCompact(input.context, resumed.transcript, input.trigger)) {
|
|
34
|
+
return input.context.cache.deepCompact ? { ok: true, packet: input.context.cache.deepCompact } : failMessage(input.context, "Deep compact skipped: transcript pressure is below trigger.");
|
|
35
|
+
}
|
|
36
|
+
return runDeepCompact({
|
|
37
|
+
...input,
|
|
38
|
+
transcript: resumed.transcript,
|
|
39
|
+
gateway: input.gateway,
|
|
40
|
+
signal: input.signal
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async function runDeepCompact(input) {
|
|
44
|
+
const now = Date.now();
|
|
45
|
+
if (input.context.cache.deepCompactCooldownUntil && input.context.cache.deepCompactCooldownUntil > now) {
|
|
46
|
+
return failMessage(
|
|
47
|
+
input.context,
|
|
48
|
+
"Deep compact is cooling down after a previous compact failure."
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
const requestMessages = buildDeepCompactRequestMessages(
|
|
52
|
+
input.context,
|
|
53
|
+
input.transcript,
|
|
54
|
+
input.trigger
|
|
55
|
+
);
|
|
56
|
+
const signal = input.signal ?? new AbortController().signal;
|
|
57
|
+
let summary = "";
|
|
58
|
+
try {
|
|
59
|
+
for await (const event of withProviderRetry(
|
|
60
|
+
input.gateway,
|
|
61
|
+
input.context.providerBreaker,
|
|
62
|
+
input.runtime.provider,
|
|
63
|
+
{
|
|
64
|
+
messages: requestMessages,
|
|
65
|
+
model: input.runtime.model,
|
|
66
|
+
toolChoice: "none"
|
|
67
|
+
},
|
|
68
|
+
signal
|
|
69
|
+
)) {
|
|
70
|
+
if (signal.aborted) {
|
|
71
|
+
return failMessage(input.context, "Deep compact cancelled by user interrupt.");
|
|
72
|
+
}
|
|
73
|
+
if (event.type === "assistant_text_delta") {
|
|
74
|
+
summary += event.text;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (event.type === "tool_use") {
|
|
78
|
+
await recordDeepCompactFailure(
|
|
79
|
+
input.context,
|
|
80
|
+
input.sessionId,
|
|
81
|
+
`compact_agent_tool_use_blocked:${event.name}`,
|
|
82
|
+
input.deps
|
|
83
|
+
);
|
|
84
|
+
return failMessage(
|
|
85
|
+
input.context,
|
|
86
|
+
"Deep compact failed because compact agent attempted tool_use while tools are disabled."
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
if (event.type === "error") {
|
|
90
|
+
await recordDeepCompactFailure(
|
|
91
|
+
input.context,
|
|
92
|
+
input.sessionId,
|
|
93
|
+
`compact_agent_error:${event.error.code}:${event.error.message}`,
|
|
94
|
+
input.deps
|
|
95
|
+
);
|
|
96
|
+
return failMessage(input.context, "Deep compact provider request failed.");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
} catch (error) {
|
|
100
|
+
if (signal.aborted) {
|
|
101
|
+
return failMessage(input.context, "Deep compact cancelled by user interrupt.");
|
|
102
|
+
}
|
|
103
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
104
|
+
await recordDeepCompactFailure(input.context, input.sessionId, reason, input.deps);
|
|
105
|
+
return failMessage(input.context, "Deep compact failed before provider request.");
|
|
106
|
+
}
|
|
107
|
+
const packet = createDeepCompactPacket({
|
|
108
|
+
context: input.context,
|
|
109
|
+
transcript: input.transcript,
|
|
110
|
+
summary,
|
|
111
|
+
runtime: input.runtime,
|
|
112
|
+
trigger: input.trigger
|
|
113
|
+
});
|
|
114
|
+
const preChars = estimateTranscriptContextChars(input.transcript);
|
|
115
|
+
const boundary = createManualCompactBoundary({
|
|
116
|
+
preCompactChars: preChars,
|
|
117
|
+
postCompactChars: Math.min(preChars, packet.summary.length),
|
|
118
|
+
preservedEvidenceRefs: packet.preservedEvidenceRefs,
|
|
119
|
+
preservedFiles: packet.preservedFiles,
|
|
120
|
+
handoffPacketId: input.context.memory.lastHandoff?.id
|
|
121
|
+
});
|
|
122
|
+
input.deps.recordCompactBoundary(input.context, boundary);
|
|
123
|
+
input.context.cache.deepCompact = packet;
|
|
124
|
+
input.context.cache.compacted = true;
|
|
125
|
+
input.context.cache.compactFailure = void 0;
|
|
126
|
+
input.context.cache.deepCompactCooldownUntil = void 0;
|
|
127
|
+
input.deps.refreshCacheFreshness(input.context);
|
|
128
|
+
await input.context.store.appendEvent(input.sessionId, {
|
|
129
|
+
type: DEEP_COMPACT_EVENT_TYPE,
|
|
130
|
+
packet,
|
|
131
|
+
createdAt: packet.createdAt
|
|
132
|
+
});
|
|
133
|
+
await input.deps.appendSystemEvent(
|
|
134
|
+
input.context,
|
|
135
|
+
input.sessionId,
|
|
136
|
+
`deep compact success: id ${packet.id}; scope ${packet.scope}; trigger ${packet.trigger}`,
|
|
137
|
+
"info"
|
|
138
|
+
);
|
|
139
|
+
return { ok: true, packet };
|
|
140
|
+
}
|
|
141
|
+
function shouldRunDeepCompact(context, transcript, trigger) {
|
|
142
|
+
if (trigger === "manual" || trigger === "workflow") {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
if (context.cache.deepCompact) {
|
|
146
|
+
let latestCompactIndex = -1;
|
|
147
|
+
for (let index = transcript.length - 1; index >= 0; index -= 1) {
|
|
148
|
+
if (transcript[index]?.type === DEEP_COMPACT_EVENT_TYPE) {
|
|
149
|
+
latestCompactIndex = index;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const laterEvents = latestCompactIndex >= 0 ? transcript.length - latestCompactIndex - 1 : transcript.length;
|
|
154
|
+
return laterEvents > DEEP_COMPACT_RERUN_EVENT_THRESHOLD;
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
function formatDeepCompactPromptSummary(packet) {
|
|
159
|
+
if (!packet) return void 0;
|
|
160
|
+
return [
|
|
161
|
+
`[Deep compact ${packet.id}]`,
|
|
162
|
+
`kind ${packet.kind}`,
|
|
163
|
+
`scope ${packet.scope}`,
|
|
164
|
+
`trigger ${packet.trigger}`,
|
|
165
|
+
`created at ${packet.createdAt}`,
|
|
166
|
+
`provider ${packet.provider}`,
|
|
167
|
+
`model ${packet.model}`,
|
|
168
|
+
`summary ${packet.summary}`,
|
|
169
|
+
`preserved evidence refs ${packet.preservedEvidenceRefs.join(", ") || "none"}`,
|
|
170
|
+
`preserved files ${packet.preservedFiles.join(", ") || "none"}`,
|
|
171
|
+
`active agents/workflows ${packet.activeAgentsWorkflows.join("; ") || "none"}`,
|
|
172
|
+
`needs-attention agents/workflows ${packet.needsAttentionAgentsWorkflows?.join("; ") || "none"}`,
|
|
173
|
+
`stale resumable agents/workflows ${packet.staleResumableAgentsWorkflows?.join("; ") || "none"}`,
|
|
174
|
+
`pending items ${packet.pendingItems.join("; ") || "none"}`,
|
|
175
|
+
`decisions ${packet.decisions.join("; ") || "none"}`,
|
|
176
|
+
`risks ${packet.risks.join("; ") || "none"}`,
|
|
177
|
+
"anti hallucination: Use deep compact only for context continuity; never treat it as PASS engineering evidence."
|
|
178
|
+
].join("\n");
|
|
179
|
+
}
|
|
180
|
+
function injectDeepCompactSummary(messages, packet) {
|
|
181
|
+
const summary = formatDeepCompactPromptSummary(packet);
|
|
182
|
+
if (!summary) return messages;
|
|
183
|
+
const summaryMessage = {
|
|
184
|
+
role: "user",
|
|
185
|
+
content: summary
|
|
186
|
+
};
|
|
187
|
+
if (messages[0]?.role === "system") {
|
|
188
|
+
return [messages[0], summaryMessage, ...messages.slice(1)];
|
|
189
|
+
}
|
|
190
|
+
return [summaryMessage, ...messages];
|
|
191
|
+
}
|
|
192
|
+
function createDeepCompactPacket(input) {
|
|
193
|
+
const context = input.context;
|
|
194
|
+
return {
|
|
195
|
+
id: `deep-${randomUUID().slice(0, 8)}`,
|
|
196
|
+
kind: "deep",
|
|
197
|
+
scope: "full transcript semantic compact",
|
|
198
|
+
summary: sanitizeDeepCompactText(
|
|
199
|
+
context,
|
|
200
|
+
input.summary.trim() || synthesizeFallbackSummary(context, input.transcript),
|
|
201
|
+
DEEP_COMPACT_SUMMARY_MAX_CHARS
|
|
202
|
+
),
|
|
203
|
+
preservedEvidenceRefs: unique(context.evidence.map((item) => item.id)).slice(0, 20),
|
|
204
|
+
preservedFiles: unique([
|
|
205
|
+
...context.recentlyMentionedFiles,
|
|
206
|
+
...context.tools.changedFiles,
|
|
207
|
+
...context.evidence.map((item) => item.source).filter((source) => source.includes(".") || source.includes("/"))
|
|
208
|
+
]).map((file) => sanitizeDeepCompactText(context, file, 180)).slice(0, 20),
|
|
209
|
+
activeAgentsWorkflows: collectActiveAgentsWorkflows(context),
|
|
210
|
+
needsAttentionAgentsWorkflows: collectNeedsAttentionAgentsWorkflows(context),
|
|
211
|
+
staleResumableAgentsWorkflows: collectStaleResumableAgentsWorkflows(context),
|
|
212
|
+
pendingItems: collectPendingItems(context),
|
|
213
|
+
decisions: collectDecisions(context),
|
|
214
|
+
risks: collectRisks(context),
|
|
215
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
216
|
+
model: input.runtime.model,
|
|
217
|
+
provider: input.runtime.provider,
|
|
218
|
+
trigger: input.trigger,
|
|
219
|
+
transcriptEventCount: input.transcript.length
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function isDeepCompactPacket(value) {
|
|
223
|
+
if (!value || typeof value !== "object") return false;
|
|
224
|
+
const obj = value;
|
|
225
|
+
return obj.kind === "deep" && obj.scope === "full transcript semantic compact" && typeof obj.id === "string" && typeof obj.summary === "string" && Array.isArray(obj.preservedEvidenceRefs) && Array.isArray(obj.preservedFiles) && Array.isArray(obj.activeAgentsWorkflows) && Array.isArray(obj.pendingItems) && Array.isArray(obj.decisions) && Array.isArray(obj.risks) && typeof obj.createdAt === "string" && typeof obj.model === "string" && typeof obj.provider === "string" && typeof obj.trigger === "string";
|
|
226
|
+
}
|
|
227
|
+
function buildDeepCompactRequestMessages(context, transcript, trigger) {
|
|
228
|
+
const outline = buildFullTranscriptSemanticOutline(context, transcript);
|
|
229
|
+
const state = [
|
|
230
|
+
`trigger ${trigger}`,
|
|
231
|
+
`transcript events ${transcript.length}`,
|
|
232
|
+
`project rules ${sanitizeDeepCompactText(context, context.memory.projectRulesSummary || "none", 300)}`,
|
|
233
|
+
`index ${formatIndexRuntimeRef(context.index)}`,
|
|
234
|
+
`cache freshness ${context.cache.lastFreshness?.changedKeys.join(", ") || "stable or unknown"}`,
|
|
235
|
+
`accepted memory ${context.memory.accepted.length}`,
|
|
236
|
+
`failure learning ${context.failureLearning.records.slice(0, 5).map((item) => sanitizeDeepCompactText(context, item.avoidNextTime, 180)).join("; ") || "none"}`
|
|
237
|
+
];
|
|
238
|
+
return [
|
|
239
|
+
{
|
|
240
|
+
role: "system",
|
|
241
|
+
content: [
|
|
242
|
+
"You are Linghun's deep context compact agent.",
|
|
243
|
+
"Summarize the full transcript semantically for a coding assistant resume/provider prompt.",
|
|
244
|
+
"Do not call tools. Do not request tools. Return text only.",
|
|
245
|
+
"Preserve: user goal, latest task, decisions, files/evidence refs, tool result summaries, agent/workflow state, failures, memory/cache/index freshness, and pending permissions.",
|
|
246
|
+
"Do not include secrets, absolute local paths, raw provider requests, or raw oversized tool results."
|
|
247
|
+
].join("\n")
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
role: "user",
|
|
251
|
+
content: [
|
|
252
|
+
"Create a concise deep compact summary from this deterministic full-transcript semantic outline.",
|
|
253
|
+
state.join("\n"),
|
|
254
|
+
outline.join("\n\n")
|
|
255
|
+
].join("\n\n")
|
|
256
|
+
}
|
|
257
|
+
];
|
|
258
|
+
}
|
|
259
|
+
function buildFullTranscriptSemanticOutline(context, transcript) {
|
|
260
|
+
const userMessages = [];
|
|
261
|
+
const assistantDecisions = [];
|
|
262
|
+
const toolSummaries = [];
|
|
263
|
+
const evidenceRefs = [];
|
|
264
|
+
const changedOrPreservedFiles = [];
|
|
265
|
+
const agentWorkflowEvents = [];
|
|
266
|
+
const verificationFailures = [];
|
|
267
|
+
const permissionsTodos = [];
|
|
268
|
+
const eventTypeCounts = /* @__PURE__ */ new Map();
|
|
269
|
+
for (const event of transcript) {
|
|
270
|
+
eventTypeCounts.set(event.type, (eventTypeCounts.get(event.type) ?? 0) + 1);
|
|
271
|
+
collectOutlineEvent(context, event, {
|
|
272
|
+
userMessages,
|
|
273
|
+
assistantDecisions,
|
|
274
|
+
toolSummaries,
|
|
275
|
+
evidenceRefs,
|
|
276
|
+
changedOrPreservedFiles,
|
|
277
|
+
agentWorkflowEvents,
|
|
278
|
+
verificationFailures,
|
|
279
|
+
permissionsTodos
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
const firstUser = transcript.find((event) => event.type === "user_message");
|
|
283
|
+
const latestUser = findLatestEvent(transcript, "user_message");
|
|
284
|
+
const recentTail = transcript.slice(-RECENT_TRANSCRIPT_TAIL_EVENTS).map((event) => summarizeTranscriptEvent(context, event));
|
|
285
|
+
return [
|
|
286
|
+
"Full transcript semantic outline:",
|
|
287
|
+
`event type counts: ${[...eventTypeCounts.entries()].map(([type, count]) => `${type}:${count}`).join(", ") || "none"}`,
|
|
288
|
+
`first user goal: ${firstUser?.type === "user_message" ? sanitizeDeepCompactText(context, firstUser.text, EVENT_TEXT_LIMIT) : "none"}`,
|
|
289
|
+
`latest user goal: ${latestUser?.type === "user_message" ? sanitizeDeepCompactText(context, latestUser.text, EVENT_TEXT_LIMIT) : "none"}`,
|
|
290
|
+
formatOutlineSection("key user requirements", userMessages, 24),
|
|
291
|
+
formatOutlineSection("assistant decisions", assistantDecisions, 24),
|
|
292
|
+
formatOutlineSection("tool calls and results", toolSummaries, 28),
|
|
293
|
+
formatOutlineSection("evidence refs", evidenceRefs, 20),
|
|
294
|
+
formatOutlineSection("changed or preserved files", changedOrPreservedFiles, 20),
|
|
295
|
+
formatOutlineSection("agent workflow events", agentWorkflowEvents, 20),
|
|
296
|
+
formatOutlineSection("verification and failure learning", verificationFailures, 20),
|
|
297
|
+
formatOutlineSection("pending permissions and todos", permissionsTodos, 20),
|
|
298
|
+
`recent tail: ${recentTail.join("\n") || "none"}`
|
|
299
|
+
];
|
|
300
|
+
}
|
|
301
|
+
function collectOutlineEvent(context, event, buckets) {
|
|
302
|
+
switch (event.type) {
|
|
303
|
+
case "user_message":
|
|
304
|
+
pushEarlyAndRecent(
|
|
305
|
+
buckets.userMessages,
|
|
306
|
+
`user:${sanitizeDeepCompactText(context, event.text, EVENT_TEXT_LIMIT)}`
|
|
307
|
+
);
|
|
308
|
+
break;
|
|
309
|
+
case "assistant_text_delta":
|
|
310
|
+
if (looksLikeDecision(event.text)) {
|
|
311
|
+
pushEarlyAndRecent(
|
|
312
|
+
buckets.assistantDecisions,
|
|
313
|
+
`assistant:${sanitizeDeepCompactText(context, event.text, EVENT_TEXT_LIMIT)}`
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
break;
|
|
317
|
+
case "tool_call_start":
|
|
318
|
+
pushEarlyAndRecent(
|
|
319
|
+
buckets.toolSummaries,
|
|
320
|
+
`tool_start:${event.name}:${sanitizeDeepCompactText(context, JSON.stringify(event.input), 220)}`
|
|
321
|
+
);
|
|
322
|
+
break;
|
|
323
|
+
case "tool_result":
|
|
324
|
+
pushEarlyAndRecent(buckets.toolSummaries, summarizeTranscriptEvent(context, event));
|
|
325
|
+
if (event.evidenceId) {
|
|
326
|
+
pushEarlyAndRecent(buckets.evidenceRefs, `evidence:${event.evidenceId}`);
|
|
327
|
+
}
|
|
328
|
+
break;
|
|
329
|
+
case "tool_call_end":
|
|
330
|
+
pushEarlyAndRecent(buckets.toolSummaries, summarizeTranscriptEvent(context, event));
|
|
331
|
+
if (event.output.fullOutputPath) {
|
|
332
|
+
pushEarlyAndRecent(buckets.changedOrPreservedFiles, "tool_output_artifact:[artifact]");
|
|
333
|
+
}
|
|
334
|
+
for (const file of event.output.changedFiles ?? []) {
|
|
335
|
+
pushEarlyAndRecent(
|
|
336
|
+
buckets.changedOrPreservedFiles,
|
|
337
|
+
sanitizeDeepCompactText(context, file, 180)
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
break;
|
|
341
|
+
case "evidence_record":
|
|
342
|
+
pushEarlyAndRecent(
|
|
343
|
+
buckets.evidenceRefs,
|
|
344
|
+
`${event.id}:${event.kind}:${sanitizeDeepCompactText(context, event.summary, EVENT_TEXT_LIMIT)}`
|
|
345
|
+
);
|
|
346
|
+
pushEarlyAndRecent(
|
|
347
|
+
buckets.changedOrPreservedFiles,
|
|
348
|
+
sanitizeDeepCompactText(context, event.source, 180)
|
|
349
|
+
);
|
|
350
|
+
break;
|
|
351
|
+
case "agent_start":
|
|
352
|
+
case "agent_end":
|
|
353
|
+
case "workflow_start":
|
|
354
|
+
case "workflow_step_result":
|
|
355
|
+
case "workflow_end":
|
|
356
|
+
pushEarlyAndRecent(buckets.agentWorkflowEvents, summarizeTranscriptEvent(context, event));
|
|
357
|
+
break;
|
|
358
|
+
case "verification_end":
|
|
359
|
+
pushEarlyAndRecent(buckets.verificationFailures, summarizeTranscriptEvent(context, event));
|
|
360
|
+
break;
|
|
361
|
+
case "system_event":
|
|
362
|
+
if (/fail|failure|failed|compact|cooldown|risk|decision|scope|blocked|失败|风险|阻断/iu.test(
|
|
363
|
+
event.message
|
|
364
|
+
)) {
|
|
365
|
+
pushEarlyAndRecent(buckets.verificationFailures, summarizeTranscriptEvent(context, event));
|
|
366
|
+
}
|
|
367
|
+
break;
|
|
368
|
+
case "permission_request":
|
|
369
|
+
case "permission_result":
|
|
370
|
+
case "todo_update":
|
|
371
|
+
pushEarlyAndRecent(buckets.permissionsTodos, summarizeTranscriptEvent(context, event));
|
|
372
|
+
break;
|
|
373
|
+
default:
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
function pushEarlyAndRecent(items, value, maxItems = 48) {
|
|
378
|
+
if (!value) return;
|
|
379
|
+
if (items.length < maxItems) {
|
|
380
|
+
items.push(value);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
const recentReserve = Math.max(1, Math.floor(maxItems / 3));
|
|
384
|
+
items.splice(maxItems - recentReserve, 1);
|
|
385
|
+
items.push(value);
|
|
386
|
+
}
|
|
387
|
+
function formatOutlineSection(name, items, maxItems) {
|
|
388
|
+
if (items.length === 0) return `${name}: none`;
|
|
389
|
+
const shown = items.slice(0, maxItems);
|
|
390
|
+
const omitted = Math.max(0, items.length - shown.length);
|
|
391
|
+
return `${name}: ${shown.join("\n")}${omitted > 0 ? `
|
|
392
|
+
${name} omitted: ${omitted}` : ""}`;
|
|
393
|
+
}
|
|
394
|
+
function findLatestEvent(transcript, type) {
|
|
395
|
+
for (let index = transcript.length - 1; index >= 0; index -= 1) {
|
|
396
|
+
const event = transcript[index];
|
|
397
|
+
if (event?.type === type) {
|
|
398
|
+
return event;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return void 0;
|
|
402
|
+
}
|
|
403
|
+
function looksLikeDecision(text) {
|
|
404
|
+
return /decid|decision|choose|chosen|plan|will|must|should|done|fixed|blocked|risk|决定|选择|计划|必须|应该|已|阻断|风险/iu.test(
|
|
405
|
+
text
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
function summarizeTranscriptEvent(context, event) {
|
|
409
|
+
switch (event.type) {
|
|
410
|
+
case "user_message":
|
|
411
|
+
return `user:${sanitizeDeepCompactText(context, event.text, EVENT_TEXT_LIMIT)}`;
|
|
412
|
+
case "assistant_text_delta":
|
|
413
|
+
return `assistant:${sanitizeDeepCompactText(context, event.text, EVENT_TEXT_LIMIT)}`;
|
|
414
|
+
case "tool_call_start":
|
|
415
|
+
return `tool_start:${event.name}:${sanitizeDeepCompactText(context, JSON.stringify(event.input), 220)}`;
|
|
416
|
+
case "tool_result":
|
|
417
|
+
return `tool_result:${event.toolName}:is error ${event.isError ? "yes" : "no"}; evidence ${event.evidenceId ?? "none"}; summary ${sanitizeDeepCompactText(context, summarizeToolResultContent(event.content), EVENT_TEXT_LIMIT)}`;
|
|
418
|
+
case "tool_call_end":
|
|
419
|
+
return `tool_end:${event.id}:truncated ${event.output.truncated ? "yes" : "no"}; full output path ${event.output.fullOutputPath ? "[artifact]" : "none"}; summary ${sanitizeDeepCompactText(context, event.output.text, EVENT_TEXT_LIMIT)}`;
|
|
420
|
+
case "verification_end":
|
|
421
|
+
return `verification:${event.report.status}:${sanitizeDeepCompactText(context, event.report.summary, EVENT_TEXT_LIMIT)}`;
|
|
422
|
+
case "todo_update":
|
|
423
|
+
return `todos:${event.items.map((item) => `${item.status}:${sanitizeDeepCompactText(context, item.content, 80)}`).join("; ")}`;
|
|
424
|
+
case "background_task_update":
|
|
425
|
+
return `background:${event.task.kind}:${event.task.status}:${sanitizeDeepCompactText(context, event.task.userVisibleSummary, EVENT_TEXT_LIMIT)}`;
|
|
426
|
+
case "agent_start":
|
|
427
|
+
return `agent_start:${sanitizeDeepCompactText(context, JSON.stringify(event.agent), EVENT_TEXT_LIMIT)}`;
|
|
428
|
+
case "agent_end":
|
|
429
|
+
return `agent_end:${event.status}:${sanitizeDeepCompactText(context, event.summary, EVENT_TEXT_LIMIT)}`;
|
|
430
|
+
case "workflow_start":
|
|
431
|
+
return `workflow_start:${sanitizeDeepCompactText(context, JSON.stringify(event.workflow), EVENT_TEXT_LIMIT)}`;
|
|
432
|
+
case "workflow_step_result":
|
|
433
|
+
return `workflow_step:${event.status}:${sanitizeDeepCompactText(context, event.summary, EVENT_TEXT_LIMIT)} evidence ${event.evidenceRefs.join(",")}`;
|
|
434
|
+
case "workflow_end":
|
|
435
|
+
return `workflow_end:${event.status}:${sanitizeDeepCompactText(context, event.summary, EVENT_TEXT_LIMIT)}`;
|
|
436
|
+
case "permission_request":
|
|
437
|
+
return `permission_request:${event.request.toolName}:${event.request.risk}:${sanitizeDeepCompactText(context, event.request.summary, 220)}`;
|
|
438
|
+
case "permission_result":
|
|
439
|
+
return `permission_result:${event.decision}:${sanitizeDeepCompactText(context, event.reason, 160)}`;
|
|
440
|
+
case DEEP_COMPACT_EVENT_TYPE:
|
|
441
|
+
return "deep_compact_packet:previous summary exists";
|
|
442
|
+
case "system_event":
|
|
443
|
+
return `system:${event.level}:${sanitizeDeepCompactText(context, event.message, EVENT_TEXT_LIMIT)}`;
|
|
444
|
+
default:
|
|
445
|
+
return `${event.type}:${sanitizeDeepCompactText(context, JSON.stringify(event), 220)}`;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
function summarizeToolResultContent(content) {
|
|
449
|
+
if (typeof content === "string") return content;
|
|
450
|
+
return JSON.stringify(content);
|
|
451
|
+
}
|
|
452
|
+
function synthesizeFallbackSummary(context, transcript) {
|
|
453
|
+
const latestUser = [...transcript].reverse().find((event) => event.type === "user_message");
|
|
454
|
+
const latestAssistant = [...transcript].reverse().find((event) => event.type === "assistant_text_delta");
|
|
455
|
+
const evidence = context.evidence.slice(0, 5).map((item) => `${item.id}:${item.summary}`).join("; ");
|
|
456
|
+
return [
|
|
457
|
+
`User goal/latest task: ${latestUser?.type === "user_message" ? latestUser.text : "continue current coding task"}`,
|
|
458
|
+
`Latest assistant state: ${latestAssistant?.type === "assistant_text_delta" ? latestAssistant.text : "none"}`,
|
|
459
|
+
`Evidence refs: ${evidence || "none"}`
|
|
460
|
+
].join("\n");
|
|
461
|
+
}
|
|
462
|
+
function sanitizeDeepCompactText(context, value, maxChars) {
|
|
463
|
+
const singleLine = value.replace(/\s+/g, " ");
|
|
464
|
+
const redacted = redactCommonSecrets(singleLine).replace(
|
|
465
|
+
/[A-Z]:[\\/][^\s"')\]}]+/gu,
|
|
466
|
+
"[local-path]"
|
|
467
|
+
);
|
|
468
|
+
return truncateDisplay(
|
|
469
|
+
sanitizeDisplayPaths(sanitizeDiagnosticText(redacted), context.projectPath),
|
|
470
|
+
maxChars
|
|
471
|
+
);
|
|
472
|
+
}
|
|
473
|
+
function collectActiveAgentsWorkflows(context) {
|
|
474
|
+
return [
|
|
475
|
+
...context.agents.filter((agent) => agent.status === "running").map(
|
|
476
|
+
(agent) => `agent:${agent.id}:${agent.status}:${sanitizeDeepCompactText(context, agent.summary || agent.task, 140)}`
|
|
477
|
+
),
|
|
478
|
+
...context.backgroundTasks.filter((task) => task.status === "running").map(
|
|
479
|
+
(task) => `${task.kind}:${task.id}:${task.status}:${sanitizeDeepCompactText(context, task.userVisibleSummary, 140)}`
|
|
480
|
+
)
|
|
481
|
+
].slice(0, 12);
|
|
482
|
+
}
|
|
483
|
+
function collectNeedsAttentionAgentsWorkflows(context) {
|
|
484
|
+
return [
|
|
485
|
+
...context.agents.filter((agent) => agent.status === "blocked").map(
|
|
486
|
+
(agent) => `agent:${agent.id}:${agent.status}:${sanitizeDeepCompactText(context, agent.summary || agent.task, 140)}`
|
|
487
|
+
),
|
|
488
|
+
...context.backgroundTasks.filter((task) => task.status === "paused" || task.status === "blocked").map(
|
|
489
|
+
(task) => `${task.kind}:${task.id}:${task.status}:${sanitizeDeepCompactText(context, task.userVisibleSummary, 140)}`
|
|
490
|
+
)
|
|
491
|
+
].slice(0, 12);
|
|
492
|
+
}
|
|
493
|
+
function collectStaleResumableAgentsWorkflows(context) {
|
|
494
|
+
return [
|
|
495
|
+
...context.agents.filter((agent) => agent.status === "stale").map(
|
|
496
|
+
(agent) => `agent:${agent.id}:${agent.status}:${sanitizeDeepCompactText(context, agent.summary || agent.task, 140)}`
|
|
497
|
+
),
|
|
498
|
+
...context.backgroundTasks.filter((task) => task.status === "stale").map(
|
|
499
|
+
(task) => `${task.kind}:${task.id}:${task.status}:${sanitizeDeepCompactText(context, task.userVisibleSummary, 140)}`
|
|
500
|
+
)
|
|
501
|
+
].slice(0, 12);
|
|
502
|
+
}
|
|
503
|
+
function collectPendingItems(context) {
|
|
504
|
+
return [
|
|
505
|
+
context.pendingLocalApproval ? `pending local approval:${context.pendingLocalApproval.kind}` : "",
|
|
506
|
+
context.pendingNaturalCommand ? "pending natural command" : "",
|
|
507
|
+
context.pendingAutopilot ? "pending autopilot" : "",
|
|
508
|
+
...context.tools.todos.filter((todo) => todo.status !== "completed").map((todo) => `todo:${todo.status}:${sanitizeDeepCompactText(context, todo.content, 140)}`)
|
|
509
|
+
].filter(Boolean).slice(0, 16);
|
|
510
|
+
}
|
|
511
|
+
function collectDecisions(context) {
|
|
512
|
+
return context.routeDecisions.slice(0, 8).map(
|
|
513
|
+
(item) => `${item.role}:${item.selectedProvider || "paused"}/${item.selectedModel || "paused"} fallback ${item.fallbackUsed ? "yes" : "no"}`
|
|
514
|
+
);
|
|
515
|
+
}
|
|
516
|
+
function collectRisks(context) {
|
|
517
|
+
return [
|
|
518
|
+
"Deep compact is context continuity only, not PASS engineering evidence.",
|
|
519
|
+
context.cache.compactFailure ? `compactFailure:${context.cache.compactFailure.reason}` : "",
|
|
520
|
+
...context.failureLearning.records.filter((item) => item.status === "active").slice(0, 5).map(
|
|
521
|
+
(item) => `${item.category}:${sanitizeDeepCompactText(context, item.avoidNextTime, 160)}`
|
|
522
|
+
)
|
|
523
|
+
].filter(Boolean);
|
|
524
|
+
}
|
|
525
|
+
async function recordDeepCompactFailure(context, sessionId, reason, deps) {
|
|
526
|
+
const cooldownUntilMs = Date.now() + DEEP_COMPACT_FAILURE_COOLDOWN_MS;
|
|
527
|
+
context.cache.deepCompactCooldownUntil = cooldownUntilMs;
|
|
528
|
+
context.cache.compactFailure = {
|
|
529
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
530
|
+
reason: sanitizeDeepCompactText(context, reason, 220),
|
|
531
|
+
blocked: true,
|
|
532
|
+
cooldownUntil: new Date(cooldownUntilMs).toISOString()
|
|
533
|
+
};
|
|
534
|
+
await deps.appendSystemEvent(
|
|
535
|
+
context,
|
|
536
|
+
sessionId,
|
|
537
|
+
`deep compact failed: blocked yes; reason ${context.cache.compactFailure.reason}; cooldown until ${context.cache.compactFailure.cooldownUntil}`,
|
|
538
|
+
"warning"
|
|
539
|
+
);
|
|
540
|
+
await deps.captureFailureLearning(context, sessionId, {
|
|
541
|
+
category: "resource_cap",
|
|
542
|
+
failureSummary: "deep compact failed before provider request",
|
|
543
|
+
rootCauseGuess: context.cache.compactFailure.reason,
|
|
544
|
+
avoidNextTime: "Do not continue with partial context after deep compact failure; retry after cooldown or reduce context pressure",
|
|
545
|
+
sourceRef: "system_event:deep_compact_failed",
|
|
546
|
+
relatedTarget: "deep compact",
|
|
547
|
+
severity: "medium"
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
function failMessage(context, english) {
|
|
551
|
+
return {
|
|
552
|
+
ok: false,
|
|
553
|
+
message: context.language === "en-US" ? english : english.replace(
|
|
554
|
+
"Deep compact unavailable: model gateway is not ready.",
|
|
555
|
+
"Deep compact \u4E0D\u53EF\u7528\uFF1A\u6A21\u578B\u7F51\u5173\u5C1A\u672A\u5C31\u7EEA\u3002"
|
|
556
|
+
).replace(
|
|
557
|
+
"Deep compact skipped: transcript pressure is below trigger.",
|
|
558
|
+
"Deep compact \u5DF2\u8DF3\u8FC7\uFF1Atranscript \u538B\u529B\u672A\u8FBE\u5230\u89E6\u53D1\u7EBF\u3002"
|
|
559
|
+
).replace(
|
|
560
|
+
"Deep compact is cooling down after a previous compact failure.",
|
|
561
|
+
"\u4E0A\u4E00\u6B21 deep compact \u5931\u8D25\u540E\u4ECD\u5728\u51B7\u5374\u4E2D\u3002"
|
|
562
|
+
).replace(
|
|
563
|
+
"Deep compact failed because compact agent attempted tool_use while tools are disabled.",
|
|
564
|
+
"Deep compact \u5931\u8D25\uFF1Acompact agent \u5728\u7981\u7528\u5DE5\u5177\u65F6\u5C1D\u8BD5\u4E86 tool_use\u3002"
|
|
565
|
+
).replace("Deep compact provider request failed.", "Deep compact provider \u8BF7\u6C42\u5931\u8D25\u3002").replace(
|
|
566
|
+
"Deep compact cancelled by user interrupt.",
|
|
567
|
+
"Deep compact \u5DF2\u88AB\u7528\u6237\u4E2D\u65AD\u53D6\u6D88\u3002"
|
|
568
|
+
).replace(
|
|
569
|
+
"Deep compact failed before provider request.",
|
|
570
|
+
"Deep compact \u5728 provider \u8BF7\u6C42\u524D\u5931\u8D25\u3002"
|
|
571
|
+
)
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
function unique(values) {
|
|
575
|
+
return [...new Set(values.filter(Boolean))];
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export {
|
|
579
|
+
DEEP_COMPACT_EVENT_TYPE,
|
|
580
|
+
maybeRunDeepCompactBeforeProvider,
|
|
581
|
+
runDeepCompact,
|
|
582
|
+
shouldRunDeepCompact,
|
|
583
|
+
formatDeepCompactPromptSummary,
|
|
584
|
+
injectDeepCompactSummary,
|
|
585
|
+
createDeepCompactPacket,
|
|
586
|
+
isDeepCompactPacket,
|
|
587
|
+
sanitizeDeepCompactText
|
|
588
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProcessGuard
|
|
3
|
+
} from "./chunk-JHGWGH2C.js";
|
|
4
|
+
import {
|
|
5
|
+
sanitizeDiagnosticText,
|
|
6
|
+
truncateDisplay
|
|
7
|
+
} from "./chunk-OMZYPQVA.js";
|
|
8
|
+
|
|
9
|
+
// src/process-command-runtime.ts
|
|
10
|
+
import { spawn } from "child_process";
|
|
11
|
+
import { basename } from "path";
|
|
12
|
+
function redactedPath(path) {
|
|
13
|
+
if (!path) {
|
|
14
|
+
return "-";
|
|
15
|
+
}
|
|
16
|
+
return `present:${sanitizeDiagnosticText(basename(path))}`;
|
|
17
|
+
}
|
|
18
|
+
async function runCommandCapture(command, args, cwd, timeoutMs) {
|
|
19
|
+
return new Promise((resolvePromise) => {
|
|
20
|
+
let child;
|
|
21
|
+
const guard = createProcessGuard();
|
|
22
|
+
try {
|
|
23
|
+
child = spawn(command, args, { cwd, shell: false, windowsHide: true });
|
|
24
|
+
guard.track(child, { label: `command:${command}` });
|
|
25
|
+
} catch (error) {
|
|
26
|
+
const nodeError = error;
|
|
27
|
+
resolvePromise({
|
|
28
|
+
exitCode: 127,
|
|
29
|
+
stdout: "",
|
|
30
|
+
stderr: "",
|
|
31
|
+
summary: sanitizeDiagnosticText(nodeError.message),
|
|
32
|
+
errorCode: nodeError.code
|
|
33
|
+
});
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const stdout = [];
|
|
37
|
+
const stderr = [];
|
|
38
|
+
const timer = setTimeout(() => {
|
|
39
|
+
guard.requestStop(false);
|
|
40
|
+
resolvePromise({
|
|
41
|
+
exitCode: 124,
|
|
42
|
+
stdout: Buffer.concat(stdout).toString("utf8"),
|
|
43
|
+
stderr: Buffer.concat(stderr).toString("utf8"),
|
|
44
|
+
summary: `\u547D\u4EE4\u8D85\u65F6\uFF1A${redactedPath(command)}`
|
|
45
|
+
});
|
|
46
|
+
}, timeoutMs);
|
|
47
|
+
child.stdout?.on("data", (chunk) => stdout.push(chunk));
|
|
48
|
+
child.stderr?.on("data", (chunk) => stderr.push(chunk));
|
|
49
|
+
child.on("error", (error) => {
|
|
50
|
+
clearTimeout(timer);
|
|
51
|
+
resolvePromise({
|
|
52
|
+
exitCode: 127,
|
|
53
|
+
stdout: "",
|
|
54
|
+
stderr: "",
|
|
55
|
+
summary: sanitizeDiagnosticText(error.message),
|
|
56
|
+
errorCode: error.code
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
child.on("close", (exitCode) => {
|
|
60
|
+
clearTimeout(timer);
|
|
61
|
+
const out = Buffer.concat(stdout).toString("utf8");
|
|
62
|
+
const err = Buffer.concat(stderr).toString("utf8");
|
|
63
|
+
resolvePromise({
|
|
64
|
+
exitCode: exitCode ?? 1,
|
|
65
|
+
stdout: out,
|
|
66
|
+
stderr: err,
|
|
67
|
+
summary: truncateDisplay(
|
|
68
|
+
sanitizeDiagnosticText(err || out || `exit ${exitCode}`).replace(/\s+/g, " "),
|
|
69
|
+
200
|
|
70
|
+
)
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
redactedPath,
|
|
78
|
+
runCommandCapture
|
|
79
|
+
};
|