@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,269 @@
|
|
|
1
|
+
import {
|
|
2
|
+
diffFreshness
|
|
3
|
+
} from "./chunk-4T5DJW54.js";
|
|
4
|
+
|
|
5
|
+
// src/break-cache-runtime.ts
|
|
6
|
+
import { randomUUID } from "crypto";
|
|
7
|
+
import { existsSync, readFileSync } from "fs";
|
|
8
|
+
import { appendFile, mkdir, readFile, rm, writeFile } from "fs/promises";
|
|
9
|
+
import { join } from "path";
|
|
10
|
+
import { formatDiagnosticError, isNodeErrorWithCode } from "@linghun/shared";
|
|
11
|
+
var BREAK_CACHE_ONCE_FILENAME = ".break-cache-once";
|
|
12
|
+
var BREAK_CACHE_ALWAYS_FILENAME = ".break-cache-always";
|
|
13
|
+
var BREAK_CACHE_EVENTS_FILENAME = "break-cache-events.jsonl";
|
|
14
|
+
var BREAK_CACHE_EVENTS_MAX_LINES = 200;
|
|
15
|
+
var BREAK_CACHE_EVENTS_TRIM_BATCH = 25;
|
|
16
|
+
var breakCacheEventLineCounts = /* @__PURE__ */ new Map();
|
|
17
|
+
function getBreakCacheDir(context) {
|
|
18
|
+
return join(context.projectPath, ".linghun");
|
|
19
|
+
}
|
|
20
|
+
function getBreakCacheOncePath(context) {
|
|
21
|
+
return join(getBreakCacheDir(context), BREAK_CACHE_ONCE_FILENAME);
|
|
22
|
+
}
|
|
23
|
+
function getBreakCacheAlwaysPath(context) {
|
|
24
|
+
return join(getBreakCacheDir(context), BREAK_CACHE_ALWAYS_FILENAME);
|
|
25
|
+
}
|
|
26
|
+
function getBreakCacheEventsPath(context) {
|
|
27
|
+
return join(getBreakCacheDir(context), BREAK_CACHE_EVENTS_FILENAME);
|
|
28
|
+
}
|
|
29
|
+
function readBreakCacheMarkerSync(context) {
|
|
30
|
+
try {
|
|
31
|
+
const alwaysPath = getBreakCacheAlwaysPath(context);
|
|
32
|
+
if (existsSync(alwaysPath)) {
|
|
33
|
+
const nonce = readFileSync(alwaysPath, "utf8").trim();
|
|
34
|
+
return { mode: "always", nonce: nonce || void 0 };
|
|
35
|
+
}
|
|
36
|
+
const oncePath = getBreakCacheOncePath(context);
|
|
37
|
+
if (existsSync(oncePath)) {
|
|
38
|
+
const nonce = readFileSync(oncePath, "utf8").trim();
|
|
39
|
+
return { mode: "once", nonce: nonce || void 0 };
|
|
40
|
+
}
|
|
41
|
+
} catch (error) {
|
|
42
|
+
logBreakCacheWarning(context, `read_marker_failed reason=${formatDiagnosticError(error)}`);
|
|
43
|
+
}
|
|
44
|
+
return { mode: "off" };
|
|
45
|
+
}
|
|
46
|
+
function readRecentBreakCacheEventsSync(context, limit) {
|
|
47
|
+
try {
|
|
48
|
+
const path = getBreakCacheEventsPath(context);
|
|
49
|
+
if (!existsSync(path)) return [];
|
|
50
|
+
const raw = readFileSync(path, "utf8");
|
|
51
|
+
const lines = raw.split(/\r?\n/).filter((line) => line.length > 0);
|
|
52
|
+
const recent = lines.slice(-Math.max(1, limit));
|
|
53
|
+
const events = [];
|
|
54
|
+
for (const line of recent) {
|
|
55
|
+
try {
|
|
56
|
+
const parsed = JSON.parse(line);
|
|
57
|
+
if (typeof parsed.action === "string" && typeof parsed.createdAt === "string") {
|
|
58
|
+
events.push({ action: parsed.action, createdAt: parsed.createdAt });
|
|
59
|
+
}
|
|
60
|
+
} catch (error) {
|
|
61
|
+
logBreakCacheWarning(
|
|
62
|
+
context,
|
|
63
|
+
`read_events_parse_failed reason=${formatDiagnosticError(error)}`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return events;
|
|
68
|
+
} catch (error) {
|
|
69
|
+
if (!isNodeErrorWithCode(error, "ENOENT")) {
|
|
70
|
+
logBreakCacheWarning(context, `read_events_failed reason=${formatDiagnosticError(error)}`);
|
|
71
|
+
}
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async function appendBreakCacheEvent(context, action) {
|
|
76
|
+
try {
|
|
77
|
+
await mkdir(getBreakCacheDir(context), { recursive: true });
|
|
78
|
+
const path = getBreakCacheEventsPath(context);
|
|
79
|
+
const currentCount = await getBreakCacheEventLineCount(path);
|
|
80
|
+
const event = { action, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
81
|
+
await appendFile(path, `${JSON.stringify(event)}
|
|
82
|
+
`, "utf8");
|
|
83
|
+
breakCacheEventLineCounts.set(path, currentCount + 1);
|
|
84
|
+
await truncateBreakCacheEventsIfNeeded(path);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
await appendRuntimeWarning(
|
|
87
|
+
context,
|
|
88
|
+
`break_cache_event_write_failed reason=${formatDiagnosticError(error)}`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async function getBreakCacheEventLineCount(path) {
|
|
93
|
+
const cached = breakCacheEventLineCounts.get(path);
|
|
94
|
+
if (typeof cached === "number") {
|
|
95
|
+
return cached;
|
|
96
|
+
}
|
|
97
|
+
const raw = await readFile(path, "utf8").catch((error) => {
|
|
98
|
+
if (!isNodeErrorWithCode(error, "ENOENT")) {
|
|
99
|
+
process.stderr.write(
|
|
100
|
+
`[linghun] break_cache_event_count_read_failed path=${path} reason=${formatDiagnosticError(error)}
|
|
101
|
+
`
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
return "";
|
|
105
|
+
});
|
|
106
|
+
const count = raw.split(/\r?\n/).filter((line) => line.length > 0).length;
|
|
107
|
+
breakCacheEventLineCounts.set(path, count);
|
|
108
|
+
return count;
|
|
109
|
+
}
|
|
110
|
+
async function truncateBreakCacheEventsIfNeeded(path) {
|
|
111
|
+
const currentCount = breakCacheEventLineCounts.get(path) ?? 0;
|
|
112
|
+
if (currentCount < BREAK_CACHE_EVENTS_MAX_LINES + BREAK_CACHE_EVENTS_TRIM_BATCH) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const raw = await readFile(path, "utf8").catch((error) => {
|
|
116
|
+
process.stderr.write(
|
|
117
|
+
`[linghun] break_cache_event_truncate_read_failed path=${path} reason=${formatDiagnosticError(error)}
|
|
118
|
+
`
|
|
119
|
+
);
|
|
120
|
+
return "";
|
|
121
|
+
});
|
|
122
|
+
const lines = raw.split(/\r?\n/).filter((line) => line.length > 0);
|
|
123
|
+
if (lines.length <= BREAK_CACHE_EVENTS_MAX_LINES) {
|
|
124
|
+
breakCacheEventLineCounts.set(path, lines.length);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const trimmed = lines.slice(-BREAK_CACHE_EVENTS_MAX_LINES).join("\n");
|
|
128
|
+
await writeFile(path, `${trimmed}
|
|
129
|
+
`, "utf8");
|
|
130
|
+
breakCacheEventLineCounts.set(path, BREAK_CACHE_EVENTS_MAX_LINES);
|
|
131
|
+
}
|
|
132
|
+
async function writeBreakCacheMarker(context, mode, nonce) {
|
|
133
|
+
await mkdir(getBreakCacheDir(context), { recursive: true });
|
|
134
|
+
const path = mode === "once" ? getBreakCacheOncePath(context) : getBreakCacheAlwaysPath(context);
|
|
135
|
+
await writeFile(path, nonce, "utf8");
|
|
136
|
+
}
|
|
137
|
+
async function clearBreakCacheMarker(context, mode) {
|
|
138
|
+
const targets = [];
|
|
139
|
+
if (mode === "once" || mode === "all") targets.push(getBreakCacheOncePath(context));
|
|
140
|
+
if (mode === "always" || mode === "all") targets.push(getBreakCacheAlwaysPath(context));
|
|
141
|
+
for (const target of targets) {
|
|
142
|
+
try {
|
|
143
|
+
if (existsSync(target)) {
|
|
144
|
+
await rm(target, { force: true });
|
|
145
|
+
}
|
|
146
|
+
} catch (error) {
|
|
147
|
+
await appendRuntimeWarning(
|
|
148
|
+
context,
|
|
149
|
+
`break_cache_marker_clear_failed path=${target} reason=${formatDiagnosticError(error)}`
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function makeFakeContextForPath(projectPath) {
|
|
155
|
+
return { projectPath };
|
|
156
|
+
}
|
|
157
|
+
var breakCacheTestHooks = {
|
|
158
|
+
writeMarker: (projectPath, mode, nonce) => writeBreakCacheMarker(makeFakeContextForPath(projectPath), mode, nonce),
|
|
159
|
+
clearMarker: (projectPath, mode) => clearBreakCacheMarker(makeFakeContextForPath(projectPath), mode),
|
|
160
|
+
readMarker: (projectPath) => readBreakCacheMarkerSync(makeFakeContextForPath(projectPath)),
|
|
161
|
+
consumeNonce: (projectPath) => consumeBreakCacheNonceForRequest(makeFakeContextForPath(projectPath)),
|
|
162
|
+
appendEvent: (projectPath, action) => appendBreakCacheEvent(makeFakeContextForPath(projectPath), action),
|
|
163
|
+
readRecentEvents: (projectPath, limit) => readRecentBreakCacheEventsSync(makeFakeContextForPath(projectPath), limit),
|
|
164
|
+
buildPromptCacheFields: async (projectPath, enabled, systemTtl) => {
|
|
165
|
+
if (!enabled) return {};
|
|
166
|
+
const nonce = await consumeBreakCacheNonceForRequest(makeFakeContextForPath(projectPath));
|
|
167
|
+
return {
|
|
168
|
+
promptCacheEnabled: true,
|
|
169
|
+
...systemTtl === "1h" ? { promptCacheTtl: "1h" } : {},
|
|
170
|
+
...nonce ? { cacheBreakNonce: nonce } : {}
|
|
171
|
+
};
|
|
172
|
+
},
|
|
173
|
+
paths: (projectPath) => {
|
|
174
|
+
const ctx = makeFakeContextForPath(projectPath);
|
|
175
|
+
return {
|
|
176
|
+
onceMarker: getBreakCacheOncePath(ctx),
|
|
177
|
+
alwaysMarker: getBreakCacheAlwaysPath(ctx),
|
|
178
|
+
eventsLog: getBreakCacheEventsPath(ctx)
|
|
179
|
+
};
|
|
180
|
+
},
|
|
181
|
+
eventsMaxLines: BREAK_CACHE_EVENTS_MAX_LINES
|
|
182
|
+
};
|
|
183
|
+
async function consumeBreakCacheNonceForRequest(context) {
|
|
184
|
+
const marker = readBreakCacheMarkerSync(context);
|
|
185
|
+
if (marker.mode === "off") return void 0;
|
|
186
|
+
const nonce = marker.nonce && marker.nonce.length > 0 ? marker.nonce : randomUUID();
|
|
187
|
+
if (marker.mode === "once") {
|
|
188
|
+
try {
|
|
189
|
+
await rm(getBreakCacheOncePath(context), { force: true });
|
|
190
|
+
} catch (error) {
|
|
191
|
+
await appendRuntimeWarning(
|
|
192
|
+
context,
|
|
193
|
+
`break_cache_once_consume_failed reason=${formatDiagnosticError(error)}`
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
await appendBreakCacheEvent(context, "once_consumed");
|
|
197
|
+
}
|
|
198
|
+
return nonce;
|
|
199
|
+
}
|
|
200
|
+
function logBreakCacheWarning(context, message) {
|
|
201
|
+
process.stderr.write(`[linghun] break_cache_warning project=${context.projectPath} ${message}
|
|
202
|
+
`);
|
|
203
|
+
}
|
|
204
|
+
async function appendRuntimeWarning(context, message) {
|
|
205
|
+
if (!context.sessionId) {
|
|
206
|
+
logBreakCacheWarning(context, message);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
try {
|
|
210
|
+
await context.store.appendEvent(context.sessionId, {
|
|
211
|
+
type: "system_event",
|
|
212
|
+
id: randomUUID(),
|
|
213
|
+
level: "warning",
|
|
214
|
+
message,
|
|
215
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
216
|
+
});
|
|
217
|
+
} catch (error) {
|
|
218
|
+
logBreakCacheWarning(
|
|
219
|
+
context,
|
|
220
|
+
`${message}; warning_write_failed=${formatDiagnosticError(error)}`
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
async function buildPromptCacheRequestFields(context) {
|
|
225
|
+
const config = context.config.promptCache;
|
|
226
|
+
if (!config.enabled) return {};
|
|
227
|
+
const nonce = await consumeBreakCacheNonceForRequest(context);
|
|
228
|
+
return {
|
|
229
|
+
promptCacheEnabled: true,
|
|
230
|
+
...config.systemTtl === "1h" ? { promptCacheTtl: "1h" } : {},
|
|
231
|
+
...nonce ? { cacheBreakNonce: nonce } : {}
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function formatBreakCacheStatus(context, current) {
|
|
235
|
+
const changed = diffFreshness(context.cache.lastFreshness, current);
|
|
236
|
+
const keys = changed.length > 0 ? changed : context.cache.lastFreshness?.changedKeys.length ? context.cache.lastFreshness.changedKeys : context.cache.history.at(-1)?.freshness.changedKeys ?? [];
|
|
237
|
+
const marker = readBreakCacheMarkerSync(context);
|
|
238
|
+
const recentEvents = readRecentBreakCacheEventsSync(context, 3);
|
|
239
|
+
return [
|
|
240
|
+
"Break-cache status",
|
|
241
|
+
`- systemPromptHash: ${current.systemPromptHash}`,
|
|
242
|
+
`- toolSchemaHash: ${current.toolSchemaHash}`,
|
|
243
|
+
`- mcpToolListHash: ${current.mcpToolListHash}`,
|
|
244
|
+
`- modelProviderHash: ${current.modelProviderHash}`,
|
|
245
|
+
`- reasoningEffortHash: ${current.reasoningEffortHash ?? "-"}`,
|
|
246
|
+
`- projectRulesHash: ${current.projectRulesHash ?? "-"}`,
|
|
247
|
+
`- memoryHash: ${current.memoryHash ?? "-"}`,
|
|
248
|
+
`- compactHash: ${current.compactHash ?? "-"}`,
|
|
249
|
+
`- pluginListHash: ${current.pluginListHash ?? "-"}`,
|
|
250
|
+
`- endpointProfileHash: ${current.endpointProfileHash ?? "-"}`,
|
|
251
|
+
`- cacheControlHash: ${current.cacheControlHash ?? "-"}`,
|
|
252
|
+
`- cacheTtlHash: ${current.cacheTtlHash ?? "-"}`,
|
|
253
|
+
`- prompt cache: enabled ${context.config.promptCache.enabled ? "yes" : "no"}; system ttl ${context.config.promptCache.systemTtl}`,
|
|
254
|
+
`- mode: ${marker.mode}${marker.nonce ? `; nonce ${marker.nonce.slice(0, 8)}\u2026` : ""}${marker.mode === "always" ? "\uFF08\u56FA\u5B9A break-cache namespace\uFF1B\u4E0D\u4F1A\u6BCF\u6B21\u8BF7\u6C42\u90FD\u7834\u574F\u7F13\u5B58\uFF09" : ""}`,
|
|
255
|
+
`- recent break-cache events: ${recentEvents.length === 0 ? "none" : recentEvents.map((event) => `${event.action}@${event.createdAt}`).join("; ")}`,
|
|
256
|
+
`- changed keys: ${keys.length > 0 ? keys.join(", ") : "none"}`,
|
|
257
|
+
"- usage: /break-cache status | once | always | off | --clear\uFF1Bmarker \u4E0E event \u4EC5\u8BB0\u5F55\u52A8\u4F5C\uFF0C\u4E0D\u8BB0\u5F55 prompt/key/raw request/response\u3002always=\u56FA\u5B9A nonce \u5207\u5230\u65B0 cache namespace\uFF08stable nonce\uFF09\uFF0C\u4E0D\u662F\u6BCF\u6B21\u8BF7\u6C42\u90FD\u7834\u574F\u7F13\u5B58\u3002",
|
|
258
|
+
"- suggestion: \u5982 system prompt / tool schema / MCP list / model/provider / memory / compact / plugin list / endpoint profile / cacheControl / cacheTtl \u53D8\u5316\uFF0C\u53EF\u8FD0\u884C /cache warmup \u6216 /cache refresh\uFF1B\u4E0D\u4F1A\u66FF\u4F60\u81EA\u52A8\u6267\u884C\u3002"
|
|
259
|
+
].join("\n");
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export {
|
|
263
|
+
appendBreakCacheEvent,
|
|
264
|
+
writeBreakCacheMarker,
|
|
265
|
+
clearBreakCacheMarker,
|
|
266
|
+
breakCacheTestHooks,
|
|
267
|
+
buildPromptCacheRequestFields,
|
|
268
|
+
formatBreakCacheStatus
|
|
269
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import {
|
|
2
|
+
selectActiveLessons
|
|
3
|
+
} from "./chunk-GDQQNPBP.js";
|
|
4
|
+
|
|
5
|
+
// src/failure-learning-presenter.ts
|
|
6
|
+
var CATEGORY_LABEL_ZH = {
|
|
7
|
+
provider_failure: "\u6A21\u578B\u8BF7\u6C42\u5931\u8D25",
|
|
8
|
+
tool_failure: "\u5DE5\u5177\u5931\u8D25",
|
|
9
|
+
verification_failure: "\u9A8C\u8BC1\u5931\u8D25",
|
|
10
|
+
git_operation_failure: "Git \u64CD\u4F5C\u5931\u8D25",
|
|
11
|
+
final_gate_downgrade: "\u6700\u7EC8\u56DE\u7B54\u964D\u7EA7",
|
|
12
|
+
report_guard: "\u62A5\u544A\u5B88\u536B\u672A\u6EE1\u8DB3",
|
|
13
|
+
resource_cap: "\u5E76\u53D1\u4E0A\u9650\u62D2\u7EDD"
|
|
14
|
+
};
|
|
15
|
+
var CATEGORY_LABEL_EN = {
|
|
16
|
+
provider_failure: "provider request failure",
|
|
17
|
+
tool_failure: "tool failure",
|
|
18
|
+
verification_failure: "verification failure",
|
|
19
|
+
git_operation_failure: "git operation failure",
|
|
20
|
+
final_gate_downgrade: "final answer downgrade",
|
|
21
|
+
report_guard: "report guard unmet",
|
|
22
|
+
resource_cap: "concurrency cap denied"
|
|
23
|
+
};
|
|
24
|
+
function categoryLabel(record, language) {
|
|
25
|
+
return language === "en-US" ? CATEGORY_LABEL_EN[record.category] : CATEGORY_LABEL_ZH[record.category];
|
|
26
|
+
}
|
|
27
|
+
function buildFailureLearningPanel(state, language) {
|
|
28
|
+
const isEn = language === "en-US";
|
|
29
|
+
const active = state.records.filter((r) => r.status === "active");
|
|
30
|
+
const resolved = state.records.filter((r) => r.status === "resolved").length;
|
|
31
|
+
const ignored = state.records.filter((r) => r.status === "ignored").length;
|
|
32
|
+
const lessons = selectActiveLessons(state);
|
|
33
|
+
const degraded = state.degradedWarnings.length;
|
|
34
|
+
const summary = [
|
|
35
|
+
isEn ? `Failure learning \xB7 active ${active.length} \xB7 resolved ${resolved} \xB7 ignored ${ignored}${degraded > 0 ? ` \xB7 degraded ${degraded}` : ""}` : `\u5931\u8D25\u5B66\u4E60 \xB7 \u6D3B\u8DC3 ${active.length} \xB7 \u5DF2\u89E3\u51B3 ${resolved} \xB7 \u5DF2\u5FFD\u7565 ${ignored}${degraded > 0 ? ` \xB7 \u964D\u7EA7 ${degraded}` : ""}`
|
|
36
|
+
];
|
|
37
|
+
if (active.length === 0) {
|
|
38
|
+
summary.push(
|
|
39
|
+
isEn ? "No active lessons from real failures yet." : "\u6682\u65E0\u6765\u81EA\u771F\u5B9E\u5931\u8D25\u7684\u6D3B\u8DC3\u6559\u8BAD\u3002"
|
|
40
|
+
);
|
|
41
|
+
} else {
|
|
42
|
+
for (const r of lessons.slice(0, 3)) {
|
|
43
|
+
summary.push(
|
|
44
|
+
isEn ? `[${categoryLabel(r, language)} \xD7${r.count}] avoid: ${r.avoidNextTime}` : `[${categoryLabel(r, language)} \xD7${r.count}] \u4E0B\u6B21\u907F\u514D\uFF1A${r.avoidNextTime}`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
summary.push(
|
|
48
|
+
isEn ? "These are historical risk hints, not proof anything is fixed." : "\u8FD9\u4E9B\u662F\u5386\u53F2\u98CE\u9669\u63D0\u793A\uFF0C\u4E0D\u4EE3\u8868\u95EE\u9898\u5DF2\u4FEE\u590D\u3002"
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
const actions = [];
|
|
52
|
+
if (active.length > 0) {
|
|
53
|
+
actions.push("/failures resolve <id>");
|
|
54
|
+
actions.push("/failures ignore <id>");
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
title: "/failures",
|
|
58
|
+
tone: active.length > 0 ? "warning" : "neutral",
|
|
59
|
+
summary,
|
|
60
|
+
actions,
|
|
61
|
+
detailsText: formatFailureLearningDetails(state, language)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function formatFailureLearningDetails(state, language) {
|
|
65
|
+
const isEn = language === "en-US";
|
|
66
|
+
const lines = [isEn ? "Failure learning (fact-based)" : "\u5931\u8D25\u5B66\u4E60\uFF08\u57FA\u4E8E\u4E8B\u5B9E\uFF09"];
|
|
67
|
+
if (state.degradedWarnings.length > 0) {
|
|
68
|
+
lines.push(isEn ? "- degraded warnings:" : "- \u964D\u7EA7\u8B66\u544A\uFF1A");
|
|
69
|
+
for (const warning of state.degradedWarnings) {
|
|
70
|
+
lines.push(` - ${warning}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const ordered = [...state.records].sort((a, b) => {
|
|
74
|
+
if (a.status !== b.status) {
|
|
75
|
+
const rank = (s) => s === "active" ? 0 : s === "ignored" ? 1 : 2;
|
|
76
|
+
return rank(a.status) - rank(b.status);
|
|
77
|
+
}
|
|
78
|
+
return b.lastSeen.localeCompare(a.lastSeen);
|
|
79
|
+
});
|
|
80
|
+
if (ordered.length === 0) {
|
|
81
|
+
lines.push(
|
|
82
|
+
isEn ? "- none; lessons are only recorded from real failure events (provider/tool/verification/git/final-gate/report-guard/resource-cap)." : "- \u65E0\uFF1B\u6559\u8BAD\u53EA\u6765\u81EA\u771F\u5B9E\u5931\u8D25\u4E8B\u4EF6\uFF08provider/tool/verification/git/final-gate/report-guard/resource-cap\uFF09\u3002"
|
|
83
|
+
);
|
|
84
|
+
return lines.join("\n");
|
|
85
|
+
}
|
|
86
|
+
for (const r of ordered.slice(0, 20)) {
|
|
87
|
+
lines.push(
|
|
88
|
+
`- ${r.id} [${categoryLabel(r, language)}] ${r.status} \xD7${r.count}${r.relatedTarget ? ` (${r.relatedTarget})` : ""}`
|
|
89
|
+
);
|
|
90
|
+
lines.push(` ${isEn ? "summary" : "\u6458\u8981"}: ${r.failureSummary}`);
|
|
91
|
+
lines.push(` ${isEn ? "root cause (inferred)" : "\u6839\u56E0(\u63A8\u65AD)"}: ${r.rootCauseGuess}`);
|
|
92
|
+
lines.push(` ${isEn ? "avoid next time" : "\u4E0B\u6B21\u907F\u514D"}: ${r.avoidNextTime}`);
|
|
93
|
+
lines.push(
|
|
94
|
+
` ${isEn ? "severity" : "\u4E25\u91CD\u5EA6"} ${r.severity}; first seen ${r.createdAt}; last seen ${r.lastSeen}; source ${r.sourceRef}`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
lines.push(
|
|
98
|
+
isEn ? "Note: inferred root causes are model guesses from evidence; treat as risk hints, not confirmed fixes. Use /failures resolve <id> after you actually fix it; /failures ignore <id> to mute." : "\u8BF4\u660E\uFF1A\u6839\u56E0\u4E3A\u57FA\u4E8E\u8BC1\u636E\u7684\u63A8\u65AD\uFF0C\u4E0D\u662F\u786E\u8BA4\u4E8B\u5B9E\uFF1B\u5F53\u4F5C\u98CE\u9669\u63D0\u793A\uFF0C\u4E0D\u4EE3\u8868\u5DF2\u4FEE\u590D\u3002\u771F\u6B63\u4FEE\u590D\u540E\u7528 /failures resolve <id>\uFF1B\u4E0D\u518D\u5173\u6CE8\u7528 /failures ignore <id>\u3002"
|
|
99
|
+
);
|
|
100
|
+
return lines.join("\n");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
buildFailureLearningPanel,
|
|
105
|
+
formatFailureLearningDetails
|
|
106
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/shell/stdout-flush-barrier.ts
|
|
2
|
+
async function flushStdout(stdout) {
|
|
3
|
+
if (!stdout) return;
|
|
4
|
+
if (!stdout.isTTY) return;
|
|
5
|
+
if (stdout.destroyed || stdout.closed) return;
|
|
6
|
+
if (stdout.writableLength === 0) return;
|
|
7
|
+
return new Promise((resolve) => {
|
|
8
|
+
const timeout = setTimeout(() => {
|
|
9
|
+
stdout.off("drain", onDrain);
|
|
10
|
+
resolve();
|
|
11
|
+
}, 100);
|
|
12
|
+
const onDrain = () => {
|
|
13
|
+
clearTimeout(timeout);
|
|
14
|
+
resolve();
|
|
15
|
+
};
|
|
16
|
+
stdout.once("drain", onDrain);
|
|
17
|
+
if (stdout.writable && !stdout.destroyed) {
|
|
18
|
+
stdout.write("", (error) => {
|
|
19
|
+
if (error) {
|
|
20
|
+
clearTimeout(timeout);
|
|
21
|
+
stdout.off("drain", onDrain);
|
|
22
|
+
resolve();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
} else {
|
|
26
|
+
clearTimeout(timeout);
|
|
27
|
+
stdout.off("drain", onDrain);
|
|
28
|
+
resolve();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async function writeSGRResetAndFlush(stdout) {
|
|
33
|
+
if (!stdout || stdout.destroyed || stdout.closed) return;
|
|
34
|
+
if (stdout.isTTY === false) return;
|
|
35
|
+
try {
|
|
36
|
+
const resetSequence = "\x1B[0m\x1B[?25h";
|
|
37
|
+
if (stdout.writable && !stdout.destroyed) {
|
|
38
|
+
stdout.write(resetSequence);
|
|
39
|
+
}
|
|
40
|
+
await flushStdout(stdout);
|
|
41
|
+
} catch {
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function drainStdin(stdin) {
|
|
45
|
+
if (!stdin || stdin.destroyed || stdin.closed) return;
|
|
46
|
+
if (!stdin.readable || stdin.readableLength === 0) return;
|
|
47
|
+
try {
|
|
48
|
+
while (stdin.readable && stdin.readableLength > 0) {
|
|
49
|
+
stdin.read();
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
flushStdout,
|
|
57
|
+
writeSGRResetAndFlush,
|
|
58
|
+
drainStdin
|
|
59
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createShellTheme
|
|
3
|
+
} from "./chunk-GC55DMZV.js";
|
|
4
|
+
import {
|
|
5
|
+
fitText
|
|
6
|
+
} from "./chunk-APJIC2O5.js";
|
|
7
|
+
|
|
8
|
+
// src/shell/components/SessionsPanel.tsx
|
|
9
|
+
import { Box, Text } from "@linghun/ink-runtime";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var HINT_TEXT = {
|
|
12
|
+
"zh-CN": {
|
|
13
|
+
title: "/sessions",
|
|
14
|
+
nav: "\u2191\u2193 \u9009\u62E9 \xB7 Enter \u6062\u590D \xB7 Esc \u5173\u95ED \xB7 / \u641C\u7D22 \xB7 Ctrl+V \u9884\u89C8",
|
|
15
|
+
empty: "\uFF08\u6682\u65E0\u53EF\u6062\u590D\u7684\u4F1A\u8BDD\uFF09",
|
|
16
|
+
noMatch: "\uFF08\u65E0\u5339\u914D\u7ED3\u679C\uFF09",
|
|
17
|
+
current: "[\u5F53\u524D]",
|
|
18
|
+
currentDisabled: "[\u5F53\u524D \xB7 \u4E0D\u53EF\u6062\u590D]",
|
|
19
|
+
today: "\u4ECA\u5929",
|
|
20
|
+
yesterday: "\u6628\u5929",
|
|
21
|
+
older: "\u66F4\u65E9",
|
|
22
|
+
search: "\u641C\u7D22\uFF1A",
|
|
23
|
+
previewTitle: "\u9884\u89C8 \xB7 Ctrl+V",
|
|
24
|
+
previewNav: "Esc \u8FD4\u56DE \xB7 Enter \u6062\u590D"
|
|
25
|
+
},
|
|
26
|
+
"en-US": {
|
|
27
|
+
title: "/sessions",
|
|
28
|
+
nav: "\u2191\u2193 select \xB7 Enter resume \xB7 Esc close \xB7 / search \xB7 Ctrl+V preview",
|
|
29
|
+
empty: "(no sessions to resume)",
|
|
30
|
+
noMatch: "(no matches)",
|
|
31
|
+
current: "[current]",
|
|
32
|
+
currentDisabled: "[current \xB7 cannot resume]",
|
|
33
|
+
today: "Today",
|
|
34
|
+
yesterday: "Yesterday",
|
|
35
|
+
older: "Older",
|
|
36
|
+
search: "Search: ",
|
|
37
|
+
previewTitle: "Preview \xB7 Ctrl+V",
|
|
38
|
+
previewNav: "Esc back \xB7 Enter resume"
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
function SessionsPanel({
|
|
42
|
+
panel,
|
|
43
|
+
controller: _controller,
|
|
44
|
+
width,
|
|
45
|
+
noColor,
|
|
46
|
+
language
|
|
47
|
+
}) {
|
|
48
|
+
const theme = createShellTheme(noColor);
|
|
49
|
+
const hint = HINT_TEXT[language] ?? HINT_TEXT["zh-CN"];
|
|
50
|
+
const cardWidth = Math.min(width, 84);
|
|
51
|
+
const innerWidth = Math.max(20, cardWidth - 4);
|
|
52
|
+
const getTimeGroup = (iso) => {
|
|
53
|
+
try {
|
|
54
|
+
const ms = new Date(iso).getTime();
|
|
55
|
+
if (Number.isNaN(ms)) return "older";
|
|
56
|
+
const now = /* @__PURE__ */ new Date();
|
|
57
|
+
const startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
|
|
58
|
+
const dayDiff = Math.round((startOfDay(now) - startOfDay(new Date(ms))) / 864e5);
|
|
59
|
+
if (dayDiff <= 0) return "today";
|
|
60
|
+
if (dayDiff === 1) return "yesterday";
|
|
61
|
+
return "older";
|
|
62
|
+
} catch {
|
|
63
|
+
return "older";
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const groupLabel = (g) => {
|
|
67
|
+
if (g === "today") return hint.today;
|
|
68
|
+
if (g === "yesterday") return hint.yesterday;
|
|
69
|
+
return hint.older;
|
|
70
|
+
};
|
|
71
|
+
const query = panel.searchQuery?.trim() ?? "";
|
|
72
|
+
const filtered = query ? panel.entries.filter(
|
|
73
|
+
(e) => e.title.toLowerCase().includes(query.toLowerCase()) || e.id.toLowerCase().includes(query.toLowerCase())
|
|
74
|
+
) : panel.entries;
|
|
75
|
+
if (panel.mode === "preview") {
|
|
76
|
+
const entry = panel.previewEntryId ? panel.entries.find((e) => e.id === panel.previewEntryId) : void 0;
|
|
77
|
+
if (!entry) {
|
|
78
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 1, marginTop: 1, width: cardWidth, children: [
|
|
79
|
+
/* @__PURE__ */ jsx(Text, { color: theme.dim ?? theme.muted, dimColor: true, children: "\u2500".repeat(Math.min(cardWidth, 80)) }),
|
|
80
|
+
/* @__PURE__ */ jsx(Text, { color: theme.dim ?? theme.muted, dimColor: true, children: fitText(hint.noMatch, innerWidth) })
|
|
81
|
+
] });
|
|
82
|
+
}
|
|
83
|
+
const ts = formatSessionTime(entry.updatedAt, language);
|
|
84
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 1, marginTop: 1, width: cardWidth, children: [
|
|
85
|
+
/* @__PURE__ */ jsx(Text, { color: theme.dim ?? theme.muted, dimColor: true, children: "\u2500".repeat(Math.min(cardWidth, 80)) }),
|
|
86
|
+
/* @__PURE__ */ jsx(Text, { bold: true, color: theme.accent, children: fitText(`${hint.previewTitle}: ${entry.title}`, innerWidth) }),
|
|
87
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, color: theme.muted, children: fitText(
|
|
88
|
+
`${ts} \xB7 ${entry.messageCount} ${language === "en-US" ? "msgs" : "\u6761"} \xB7 ${entry.id.slice(0, 10)}`,
|
|
89
|
+
innerWidth
|
|
90
|
+
) }),
|
|
91
|
+
/* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { dimColor: true, color: theme.muted, children: fitText(hint.previewNav, innerWidth) }) })
|
|
92
|
+
] });
|
|
93
|
+
}
|
|
94
|
+
const searchActive = panel.mode === "search";
|
|
95
|
+
const renderEntry = (entry, idx) => {
|
|
96
|
+
const active = idx === panel.cursor;
|
|
97
|
+
const currentMark = entry.isCurrent ? ` ${hint.currentDisabled}` : "";
|
|
98
|
+
const titleLine = `${active ? "\u25B8 " : " "}${entry.title}${currentMark}`;
|
|
99
|
+
const ts = formatSessionTime(entry.updatedAt, language);
|
|
100
|
+
const metaLine = ` ${ts} \xB7 ${entry.messageCount} ${language === "en-US" ? "msgs" : "\u6761"}`;
|
|
101
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
Text,
|
|
104
|
+
{
|
|
105
|
+
color: entry.isCurrent ? theme.dim ?? theme.muted : active ? theme.accent : void 0,
|
|
106
|
+
bold: active && !entry.isCurrent,
|
|
107
|
+
dimColor: entry.isCurrent,
|
|
108
|
+
children: fitText(titleLine, innerWidth)
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ jsx(Text, { color: theme.dim ?? theme.muted, dimColor: true, children: fitText(metaLine, innerWidth) })
|
|
112
|
+
] }, entry.id);
|
|
113
|
+
};
|
|
114
|
+
const renderList = () => {
|
|
115
|
+
if (filtered.length === 0) {
|
|
116
|
+
return /* @__PURE__ */ jsx(Text, { color: theme.dim ?? theme.muted, dimColor: true, children: fitText(query ? hint.noMatch : hint.empty, innerWidth) });
|
|
117
|
+
}
|
|
118
|
+
let lastGroup = "";
|
|
119
|
+
return filtered.map((entry, idx) => {
|
|
120
|
+
const group = getTimeGroup(entry.updatedAt);
|
|
121
|
+
const showHeader = group !== lastGroup;
|
|
122
|
+
lastGroup = group;
|
|
123
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
124
|
+
showHeader ? /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { bold: true, color: theme.muted, children: groupLabel(group) }) }) : null,
|
|
125
|
+
renderEntry(entry, idx)
|
|
126
|
+
] }, entry.id);
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 1, marginTop: 1, width: cardWidth, children: [
|
|
130
|
+
/* @__PURE__ */ jsx(Text, { color: theme.dim ?? theme.muted, dimColor: true, children: "\u2500".repeat(Math.min(cardWidth, 80)) }),
|
|
131
|
+
/* @__PURE__ */ jsx(Text, { color: theme.accent, bold: true, children: fitText(hint.title, innerWidth) }),
|
|
132
|
+
searchActive ? /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
|
|
133
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, color: theme.muted, children: hint.search }),
|
|
134
|
+
/* @__PURE__ */ jsx(Text, { children: query }),
|
|
135
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2588" })
|
|
136
|
+
] }) : /* @__PURE__ */ jsx(Text, { color: theme.dim ?? theme.muted, dimColor: true, children: fitText(
|
|
137
|
+
filtered.length < panel.entries.length ? `${hint.nav} \xB7 \u8FC7\u6EE4\u540E ${filtered.length}/${panel.entries.length}` : hint.nav,
|
|
138
|
+
innerWidth
|
|
139
|
+
) }),
|
|
140
|
+
renderList()
|
|
141
|
+
] });
|
|
142
|
+
}
|
|
143
|
+
function formatSessionTime(iso, language) {
|
|
144
|
+
try {
|
|
145
|
+
const t = new Date(iso).getTime();
|
|
146
|
+
const ms = Date.now() - t;
|
|
147
|
+
const min = Math.floor(ms / 6e4);
|
|
148
|
+
if (min < 1) return language === "en-US" ? "now" : "\u521A\u521A";
|
|
149
|
+
if (min < 60) return language === "en-US" ? `${min}m ago` : `${min} \u5206\u949F\u524D`;
|
|
150
|
+
const hr = Math.floor(min / 60);
|
|
151
|
+
if (hr < 24) return language === "en-US" ? `${hr}h ago` : `${hr} \u5C0F\u65F6\u524D`;
|
|
152
|
+
const day = Math.floor(hr / 24);
|
|
153
|
+
return language === "en-US" ? `${day}d ago` : `${day} \u5929\u524D`;
|
|
154
|
+
} catch {
|
|
155
|
+
return iso;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export {
|
|
160
|
+
SessionsPanel
|
|
161
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/prompt-stash.ts
|
|
2
|
+
function createPromptStash() {
|
|
3
|
+
return { text: void 0 };
|
|
4
|
+
}
|
|
5
|
+
function toggleStash(stash, currentText) {
|
|
6
|
+
if (currentText.length > 0) {
|
|
7
|
+
return { stash: { text: currentText }, bufferText: "" };
|
|
8
|
+
}
|
|
9
|
+
if (stash.text !== void 0) {
|
|
10
|
+
const restored = stash.text;
|
|
11
|
+
return { stash: { text: void 0 }, bufferText: restored };
|
|
12
|
+
}
|
|
13
|
+
return { stash, bufferText: void 0 };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
createPromptStash,
|
|
18
|
+
toggleStash
|
|
19
|
+
};
|