@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,110 @@
|
|
|
1
|
+
// src/prompt-command-runtime.ts
|
|
2
|
+
var PROMPT_COMMANDS = {
|
|
3
|
+
"/commit": {
|
|
4
|
+
name: "/commit",
|
|
5
|
+
promptCommand: true,
|
|
6
|
+
description: "Ask the model to review the current git diff and prepare a safe commit plan.",
|
|
7
|
+
buildPrompt: (args, language) => createPromptCommandText(
|
|
8
|
+
language,
|
|
9
|
+
"/commit",
|
|
10
|
+
args,
|
|
11
|
+
[
|
|
12
|
+
"Inspect git status and diff before making any claim.",
|
|
13
|
+
"Summarize changed files and risk.",
|
|
14
|
+
"Suggest a concise commit message.",
|
|
15
|
+
"Only run git commit if the user explicitly confirms and permissions allow it."
|
|
16
|
+
]
|
|
17
|
+
)
|
|
18
|
+
},
|
|
19
|
+
"/init": {
|
|
20
|
+
name: "/init",
|
|
21
|
+
promptCommand: true,
|
|
22
|
+
description: "Ask the model to explore the project and draft Linghun project instructions.",
|
|
23
|
+
buildPrompt: (args, language) => createPromptCommandText(
|
|
24
|
+
language,
|
|
25
|
+
"/init",
|
|
26
|
+
args,
|
|
27
|
+
[
|
|
28
|
+
"Ask for scope if the target instructions file or project boundary is unclear.",
|
|
29
|
+
"Explore the repository structure with read/search tools.",
|
|
30
|
+
"Draft minimal project instructions aligned with existing style.",
|
|
31
|
+
"Write files only after evidence and permission approval.",
|
|
32
|
+
"Summarize created or updated files and validation gaps."
|
|
33
|
+
]
|
|
34
|
+
)
|
|
35
|
+
},
|
|
36
|
+
"/security-review": {
|
|
37
|
+
name: "/security-review",
|
|
38
|
+
promptCommand: true,
|
|
39
|
+
description: "Ask the model to review git diff for security risks and produce a report.",
|
|
40
|
+
buildPrompt: (args, language) => createPromptCommandText(
|
|
41
|
+
language,
|
|
42
|
+
"/security-review",
|
|
43
|
+
args,
|
|
44
|
+
[
|
|
45
|
+
"Collect git diff and relevant changed files.",
|
|
46
|
+
"Check for SQL injection, XSS, RCE, path traversal, auth bypass, secret leakage, and unsafe deserialization.",
|
|
47
|
+
"Separate confirmed findings from false positives and uncertain risks.",
|
|
48
|
+
"Produce a Markdown report in the answer unless the user explicitly asks to write a file."
|
|
49
|
+
]
|
|
50
|
+
)
|
|
51
|
+
},
|
|
52
|
+
"/commit-push-pr": {
|
|
53
|
+
name: "/commit-push-pr",
|
|
54
|
+
promptCommand: true,
|
|
55
|
+
description: "Ask the model to guide branch, commit, push, and PR creation.",
|
|
56
|
+
buildPrompt: (args, language) => createPromptCommandText(
|
|
57
|
+
language,
|
|
58
|
+
"/commit-push-pr",
|
|
59
|
+
args,
|
|
60
|
+
[
|
|
61
|
+
"Inspect git status, branch, remotes, and available gh CLI before acting.",
|
|
62
|
+
"Create or reuse a safe branch only with user approval.",
|
|
63
|
+
"Commit, push, and create a PR only through explicit tool calls and permission gates.",
|
|
64
|
+
"Use heredoc or file-based bodies for long commit/PR text to avoid shell quoting mistakes.",
|
|
65
|
+
"Report exact commands run and any blocked step."
|
|
66
|
+
]
|
|
67
|
+
)
|
|
68
|
+
},
|
|
69
|
+
"/init-verifiers": {
|
|
70
|
+
name: "/init-verifiers",
|
|
71
|
+
promptCommand: true,
|
|
72
|
+
description: "Ask the model to design project-specific verification helpers.",
|
|
73
|
+
buildPrompt: (args, language) => createPromptCommandText(
|
|
74
|
+
language,
|
|
75
|
+
"/init-verifiers",
|
|
76
|
+
args,
|
|
77
|
+
[
|
|
78
|
+
"Detect the project language, package manager, and existing verification scripts.",
|
|
79
|
+
"Prefer existing scripts before proposing new tools.",
|
|
80
|
+
"Ask before installing dependencies or changing config.",
|
|
81
|
+
"If creating verifier instructions, keep them minimal and project-specific.",
|
|
82
|
+
"Summarize runnable verification commands and remaining gaps."
|
|
83
|
+
]
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
function findPromptCommand(command) {
|
|
88
|
+
return PROMPT_COMMANDS[command];
|
|
89
|
+
}
|
|
90
|
+
function buildPromptCommandUserText(command, args, language) {
|
|
91
|
+
return PROMPT_COMMANDS[command]?.buildPrompt(args, language);
|
|
92
|
+
}
|
|
93
|
+
function createPromptCommandText(language, command, args, steps) {
|
|
94
|
+
const userArgs = args.join(" ").trim() || "(none)";
|
|
95
|
+
const header = language === "en-US" ? `PromptCommand ${command}: execute through Linghun's normal model/tool loop.` : `PromptCommand ${command}\uFF1A\u901A\u8FC7 Linghun \u73B0\u6709\u6A21\u578B/\u5DE5\u5177\u4E3B\u5FAA\u73AF\u6267\u884C\u3002`;
|
|
96
|
+
const constraints = language === "en-US" ? "Do not bypass Start Gate, Plan, permissions, evidence, or final-answer verification. Do not claim actions were executed until tool results prove them." : "\u4E0D\u5F97\u7ED5\u8FC7 Start Gate\u3001Plan\u3001\u6743\u9650\u3001\u8BC1\u636E\u6216\u6700\u7EC8\u56DE\u7B54\u6821\u9A8C\u3002\u6CA1\u6709\u5DE5\u5177\u7ED3\u679C\u8BC1\u660E\u524D\uFF0C\u4E0D\u5F97\u58F0\u79F0\u5DF2\u6267\u884C\u52A8\u4F5C\u3002";
|
|
97
|
+
return [
|
|
98
|
+
header,
|
|
99
|
+
`CommandArgs=${userArgs}`,
|
|
100
|
+
constraints,
|
|
101
|
+
"Steps:",
|
|
102
|
+
...steps.map((step, index) => `${index + 1}. ${step}`)
|
|
103
|
+
].join("\n");
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export {
|
|
107
|
+
PROMPT_COMMANDS,
|
|
108
|
+
findPromptCommand,
|
|
109
|
+
buildPromptCommandUserText
|
|
110
|
+
};
|
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
// src/workspace-reference-cache.ts
|
|
2
|
+
import { createHash } from "crypto";
|
|
3
|
+
import { lstat, open, opendir, readdir, stat } from "fs/promises";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
var DEFAULT_FILE_HASH_BYTES = 256 * 1024;
|
|
6
|
+
var DEFAULT_IGNORE_FILE_BYTES = 64 * 1024;
|
|
7
|
+
var DEFAULT_TOP_LEVEL_ENTRY_LIMIT = 80;
|
|
8
|
+
var HARD_SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
9
|
+
".git",
|
|
10
|
+
".linghun/cache",
|
|
11
|
+
".next",
|
|
12
|
+
".turbo",
|
|
13
|
+
".cache",
|
|
14
|
+
"build",
|
|
15
|
+
"cache",
|
|
16
|
+
"coverage",
|
|
17
|
+
"dist",
|
|
18
|
+
"node_modules",
|
|
19
|
+
"out",
|
|
20
|
+
"target"
|
|
21
|
+
]);
|
|
22
|
+
var IGNORE_FILES = [".linghunignore", ".cbmignore", ".gitignore"];
|
|
23
|
+
var DEFAULT_WATCHED_FILES = [
|
|
24
|
+
"README.md",
|
|
25
|
+
"package.json",
|
|
26
|
+
"LINGHUN.md",
|
|
27
|
+
"CLAUDE.md",
|
|
28
|
+
".linghun/settings.json",
|
|
29
|
+
".linghunignore",
|
|
30
|
+
".cbmignore",
|
|
31
|
+
".gitignore"
|
|
32
|
+
];
|
|
33
|
+
var DEFAULT_WATCHED_DIRECTORIES = [".", ".linghun"];
|
|
34
|
+
async function getWorkspaceReferenceSnapshot(cache, input, scan = scanWorkspaceReference) {
|
|
35
|
+
const inputHash = stableHash({
|
|
36
|
+
projectPath: input.projectPath,
|
|
37
|
+
dimensions: input.dimensions,
|
|
38
|
+
runtimeStatus: input.runtimeStatus,
|
|
39
|
+
toolCapabilitySummary: input.toolCapabilitySummary,
|
|
40
|
+
evidenceRefs: input.evidenceRefs ?? [],
|
|
41
|
+
logRefs: input.logRefs ?? [],
|
|
42
|
+
watchedFiles: input.watchedFiles ?? DEFAULT_WATCHED_FILES,
|
|
43
|
+
watchedDirectories: input.watchedDirectories ?? DEFAULT_WATCHED_DIRECTORIES,
|
|
44
|
+
fileHashBytes: input.fileHashBytes ?? DEFAULT_FILE_HASH_BYTES
|
|
45
|
+
});
|
|
46
|
+
if (cache._pendingProbe && cache._pendingProbeInputHash === inputHash) {
|
|
47
|
+
return cache._pendingProbe;
|
|
48
|
+
}
|
|
49
|
+
const promise = _getWorkspaceReferenceSnapshotInner(cache, input, scan);
|
|
50
|
+
cache._pendingProbe = promise;
|
|
51
|
+
cache._pendingProbeInputHash = inputHash;
|
|
52
|
+
try {
|
|
53
|
+
return await promise;
|
|
54
|
+
} finally {
|
|
55
|
+
if (cache._pendingProbe === promise) {
|
|
56
|
+
cache._pendingProbe = void 0;
|
|
57
|
+
cache._pendingProbeInputHash = void 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function _getWorkspaceReferenceSnapshotInner(cache, input, scan) {
|
|
62
|
+
try {
|
|
63
|
+
if (cache.latest) {
|
|
64
|
+
const probe = await probeWorkspaceReference(input);
|
|
65
|
+
if (workspaceReferenceProbeMatches(cache.latest, input.dimensions, probe)) {
|
|
66
|
+
cache.hits += 1;
|
|
67
|
+
return { ...cache.latest, source: "hit", changedKeys: [] };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const scanned = await scan(input);
|
|
71
|
+
const key = workspaceReferenceKey(scanned);
|
|
72
|
+
const previous = cache.latest;
|
|
73
|
+
if (previous?.key === key) {
|
|
74
|
+
cache.hits += 1;
|
|
75
|
+
return { ...previous, source: "hit", changedKeys: [] };
|
|
76
|
+
}
|
|
77
|
+
const changedKeys = diffWorkspaceReference(previous, key, scanned);
|
|
78
|
+
const snapshot = {
|
|
79
|
+
key,
|
|
80
|
+
source: previous ? "stale" : "miss",
|
|
81
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
82
|
+
changedKeys,
|
|
83
|
+
dimensions: scanned.dimensions,
|
|
84
|
+
files: scanned.files,
|
|
85
|
+
directories: scanned.directories,
|
|
86
|
+
runtimeStatus: scanned.runtimeStatus,
|
|
87
|
+
toolCapabilitySummary: truncateText(input.toolCapabilitySummary, 2e3),
|
|
88
|
+
evidenceRefs: sanitizeRefs(scanned.evidenceRefs),
|
|
89
|
+
logRefs: sanitizeRefs(scanned.logRefs),
|
|
90
|
+
workspaceSnapshot: attachWorkspaceSnapshotChangedSummary(
|
|
91
|
+
scanned.workspaceSnapshot,
|
|
92
|
+
previous?.workspaceSnapshot
|
|
93
|
+
)
|
|
94
|
+
};
|
|
95
|
+
cache.latest = snapshot;
|
|
96
|
+
cache.misses += 1;
|
|
97
|
+
return snapshot;
|
|
98
|
+
} catch (error) {
|
|
99
|
+
cache.failures += 1;
|
|
100
|
+
const hasPrev = Boolean(cache.latest);
|
|
101
|
+
const fallbackSource = hasPrev ? "fallback-stale" : "fallback-empty";
|
|
102
|
+
return {
|
|
103
|
+
key: cache.latest?.key ?? "fallback",
|
|
104
|
+
source: fallbackSource,
|
|
105
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
106
|
+
changedKeys: ["workspaceReferenceUnavailable", fallbackSource],
|
|
107
|
+
dimensions: input.dimensions,
|
|
108
|
+
files: cache.latest?.files ?? [],
|
|
109
|
+
directories: cache.latest?.directories ?? [],
|
|
110
|
+
runtimeStatus: input.runtimeStatus,
|
|
111
|
+
toolCapabilitySummary: truncateText(input.toolCapabilitySummary, 2e3),
|
|
112
|
+
evidenceRefs: sanitizeRefs(input.evidenceRefs ?? []),
|
|
113
|
+
logRefs: sanitizeRefs(input.logRefs ?? []),
|
|
114
|
+
workspaceSnapshot: cache.latest?.workspaceSnapshot,
|
|
115
|
+
error: error instanceof Error ? error.message : String(error)
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function createWorkspaceReferenceCache() {
|
|
120
|
+
return { hits: 0, misses: 0, failures: 0 };
|
|
121
|
+
}
|
|
122
|
+
function workspaceReferenceHash(snapshot) {
|
|
123
|
+
if (!snapshot) {
|
|
124
|
+
return stableHash("none");
|
|
125
|
+
}
|
|
126
|
+
return stableHash({
|
|
127
|
+
key: snapshot.key,
|
|
128
|
+
changedKeys: snapshot.changedKeys,
|
|
129
|
+
source: snapshot.source
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function isFallbackWorkspaceReferenceSnapshot(snapshot) {
|
|
133
|
+
if (!snapshot) return false;
|
|
134
|
+
return snapshot.source === "fallback" || snapshot.source === "fallback-stale" || snapshot.source === "fallback-empty";
|
|
135
|
+
}
|
|
136
|
+
async function scanWorkspaceReference(input) {
|
|
137
|
+
const watchedFiles = input.watchedFiles ?? DEFAULT_WATCHED_FILES;
|
|
138
|
+
const watchedDirectories = input.watchedDirectories ?? DEFAULT_WATCHED_DIRECTORIES;
|
|
139
|
+
const fileHashBytes = input.fileHashBytes ?? DEFAULT_FILE_HASH_BYTES;
|
|
140
|
+
const [files, directories, workspaceSnapshot] = await Promise.all([
|
|
141
|
+
Promise.all(watchedFiles.map((path) => summarizeFile(input.projectPath, path, fileHashBytes))),
|
|
142
|
+
Promise.all(watchedDirectories.map((path) => summarizeDirectory(input.projectPath, path))),
|
|
143
|
+
summarizeWorkspaceSnapshotLite(input.projectPath, fileHashBytes)
|
|
144
|
+
]);
|
|
145
|
+
return {
|
|
146
|
+
dimensions: input.dimensions,
|
|
147
|
+
files,
|
|
148
|
+
directories,
|
|
149
|
+
runtimeStatus: input.runtimeStatus,
|
|
150
|
+
toolCapabilitySummary: truncateText(input.toolCapabilitySummary, 2e3),
|
|
151
|
+
evidenceRefs: sanitizeRefs(input.evidenceRefs ?? []),
|
|
152
|
+
logRefs: sanitizeRefs(input.logRefs ?? []),
|
|
153
|
+
workspaceSnapshot
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
async function probeWorkspaceReference(input) {
|
|
157
|
+
const watchedFiles = input.watchedFiles ?? DEFAULT_WATCHED_FILES;
|
|
158
|
+
const watchedDirectories = input.watchedDirectories ?? DEFAULT_WATCHED_DIRECTORIES;
|
|
159
|
+
const fileHashBytes = input.fileHashBytes ?? DEFAULT_FILE_HASH_BYTES;
|
|
160
|
+
const [files, directories, workspaceSnapshot] = await Promise.all([
|
|
161
|
+
Promise.all(watchedFiles.map((path) => summarizeFile(input.projectPath, path, fileHashBytes))),
|
|
162
|
+
Promise.all(watchedDirectories.map((path) => summarizeDirectory(input.projectPath, path))),
|
|
163
|
+
summarizeWorkspaceSnapshotLite(input.projectPath, fileHashBytes)
|
|
164
|
+
]);
|
|
165
|
+
return { files, directories, workspaceSnapshot };
|
|
166
|
+
}
|
|
167
|
+
function workspaceReferenceProbeMatches(previous, dimensions, probe) {
|
|
168
|
+
return stableHash(previous.dimensions) === stableHash(dimensions) && stableHash(previous.files.map((file) => fileStatKey(file))) === stableHash(probe.files.map((file) => fileStatKey(file))) && stableHash(previous.directories) === stableHash(probe.directories) && (!previous.workspaceSnapshot || stableHash(stripWorkspaceSnapshotChangedSummary(previous.workspaceSnapshot)) === stableHash(stripWorkspaceSnapshotChangedSummary(probe.workspaceSnapshot)));
|
|
169
|
+
}
|
|
170
|
+
function fileStatKey(file) {
|
|
171
|
+
return {
|
|
172
|
+
path: file.path,
|
|
173
|
+
exists: file.exists,
|
|
174
|
+
readable: file.readable,
|
|
175
|
+
size: file.size,
|
|
176
|
+
mtimeMs: file.mtimeMs
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
async function summarizeFile(projectPath, relativePath, maxHashBytes) {
|
|
180
|
+
const normalized = normalizeRelativePath(relativePath);
|
|
181
|
+
const absolutePath = join(projectPath, normalized);
|
|
182
|
+
try {
|
|
183
|
+
const fileStat = await stat(absolutePath);
|
|
184
|
+
if (!fileStat.isFile()) {
|
|
185
|
+
return missingFile(normalized);
|
|
186
|
+
}
|
|
187
|
+
const bounded = await readFilePrefix(absolutePath, fileStat.size, maxHashBytes);
|
|
188
|
+
const hash = stableHash({
|
|
189
|
+
size: fileStat.size,
|
|
190
|
+
mtimeMs: Math.trunc(fileStat.mtimeMs),
|
|
191
|
+
contentHash: sha256(bounded),
|
|
192
|
+
truncated: fileStat.size > bounded.length
|
|
193
|
+
});
|
|
194
|
+
return {
|
|
195
|
+
path: normalized,
|
|
196
|
+
exists: true,
|
|
197
|
+
readable: true,
|
|
198
|
+
size: fileStat.size,
|
|
199
|
+
mtimeMs: Math.trunc(fileStat.mtimeMs),
|
|
200
|
+
hash
|
|
201
|
+
};
|
|
202
|
+
} catch {
|
|
203
|
+
return missingFile(normalized);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function missingFile(path) {
|
|
207
|
+
return { path, exists: false, readable: false, size: 0, mtimeMs: 0, hash: stableHash("missing") };
|
|
208
|
+
}
|
|
209
|
+
async function summarizeDirectory(projectPath, relativePath) {
|
|
210
|
+
const normalized = normalizeRelativePath(relativePath);
|
|
211
|
+
try {
|
|
212
|
+
const entries = await readdir(join(projectPath, normalized), { withFileTypes: true });
|
|
213
|
+
const files = entries.filter((entry) => entry.isFile()).length;
|
|
214
|
+
const directories = entries.filter((entry) => entry.isDirectory()).length;
|
|
215
|
+
const entryHash = stableHash(
|
|
216
|
+
entries.map((entry) => ({
|
|
217
|
+
name: entry.name,
|
|
218
|
+
kind: entry.isDirectory() ? "dir" : entry.isFile() ? "file" : "other"
|
|
219
|
+
})).sort((a, b) => `${a.kind}:${a.name}`.localeCompare(`${b.kind}:${b.name}`))
|
|
220
|
+
);
|
|
221
|
+
return { path: normalized, readable: true, files, directories, entryHash };
|
|
222
|
+
} catch {
|
|
223
|
+
return {
|
|
224
|
+
path: normalized,
|
|
225
|
+
readable: false,
|
|
226
|
+
files: 0,
|
|
227
|
+
directories: 0,
|
|
228
|
+
entryHash: stableHash("missing")
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function workspaceReferenceKey(scan) {
|
|
233
|
+
return stableHash({
|
|
234
|
+
dimensions: scan.dimensions,
|
|
235
|
+
files: scan.files,
|
|
236
|
+
directories: scan.directories,
|
|
237
|
+
workspaceSnapshot: stripWorkspaceSnapshotChangedSummary(scan.workspaceSnapshot),
|
|
238
|
+
runtimeStatus: scan.runtimeStatus,
|
|
239
|
+
toolCapabilitySummary: scan.toolCapabilitySummary,
|
|
240
|
+
evidenceRefs: scan.evidenceRefs,
|
|
241
|
+
logRefs: scan.logRefs
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function diffWorkspaceReference(previous, key, scan) {
|
|
245
|
+
if (!previous) {
|
|
246
|
+
return [];
|
|
247
|
+
}
|
|
248
|
+
const changed = /* @__PURE__ */ new Set();
|
|
249
|
+
if (previous.key !== key) changed.add("workspaceReferenceHash");
|
|
250
|
+
for (const [name, value] of Object.entries(scan.dimensions)) {
|
|
251
|
+
if (previous.dimensions[name] !== value) {
|
|
252
|
+
changed.add(name);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (stableHash(previous.files) !== stableHash(scan.files)) changed.add("fileStatHash");
|
|
256
|
+
if (stableHash(previous.directories) !== stableHash(scan.directories)) {
|
|
257
|
+
changed.add("directorySummaryHash");
|
|
258
|
+
}
|
|
259
|
+
if (stableHash(stripWorkspaceSnapshotChangedSummary(previous.workspaceSnapshot)) !== stableHash(stripWorkspaceSnapshotChangedSummary(scan.workspaceSnapshot))) {
|
|
260
|
+
changed.add("workspaceSnapshotHash");
|
|
261
|
+
}
|
|
262
|
+
return [...changed].sort((a, b) => a.localeCompare(b));
|
|
263
|
+
}
|
|
264
|
+
async function summarizeWorkspaceSnapshotLite(projectPath, fileHashBytes) {
|
|
265
|
+
const entries = [];
|
|
266
|
+
const counts = { files: 0, directories: 0, symlinks: 0, other: 0, ignored: 0, storedEntries: 0 };
|
|
267
|
+
let partial = false;
|
|
268
|
+
const ignoreSources = await readIgnoreSources(projectPath);
|
|
269
|
+
const directory = await opendir(projectPath);
|
|
270
|
+
try {
|
|
271
|
+
for await (const entry of directory) {
|
|
272
|
+
const relativePath = normalizeRelativePath(entry.name);
|
|
273
|
+
const ignoredReason = getIgnoredReason(relativePath, entry.name, ignoreSources);
|
|
274
|
+
if (ignoredReason) {
|
|
275
|
+
counts.ignored += 1;
|
|
276
|
+
if (entries.length >= DEFAULT_TOP_LEVEL_ENTRY_LIMIT) {
|
|
277
|
+
partial = true;
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
entries.push({
|
|
281
|
+
path: relativePath,
|
|
282
|
+
kind: entry.isDirectory() ? "directory" : entry.isFile() ? "file" : "other",
|
|
283
|
+
size: 0,
|
|
284
|
+
mtimeMs: 0,
|
|
285
|
+
ignoredReason
|
|
286
|
+
});
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
if (entries.length >= DEFAULT_TOP_LEVEL_ENTRY_LIMIT) {
|
|
290
|
+
partial = true;
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
const absolutePath = join(projectPath, entry.name);
|
|
294
|
+
const entryStat = await lstat(absolutePath);
|
|
295
|
+
const kind = entryStat.isSymbolicLink() ? "symlink" : entryStat.isDirectory() ? "directory" : entryStat.isFile() ? "file" : "other";
|
|
296
|
+
incrementWorkspaceSnapshotCount(counts, kind);
|
|
297
|
+
entries.push({
|
|
298
|
+
path: relativePath,
|
|
299
|
+
kind,
|
|
300
|
+
size: entryStat.size,
|
|
301
|
+
mtimeMs: Math.trunc(entryStat.mtimeMs),
|
|
302
|
+
hashPrefix: kind === "file" ? await hashFilePrefix(absolutePath, entryStat.size, fileHashBytes) : void 0
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
} finally {
|
|
306
|
+
await directory.close().catch(() => void 0);
|
|
307
|
+
}
|
|
308
|
+
counts.storedEntries = entries.length;
|
|
309
|
+
return {
|
|
310
|
+
schemaVersion: 1,
|
|
311
|
+
root: ".",
|
|
312
|
+
bounded: true,
|
|
313
|
+
partial,
|
|
314
|
+
limits: { topLevelEntryLimit: DEFAULT_TOP_LEVEL_ENTRY_LIMIT, fileHashBytes },
|
|
315
|
+
counts,
|
|
316
|
+
ignoreSources: ignoreSources.map(({ path, readable, hashPrefix }) => ({
|
|
317
|
+
path,
|
|
318
|
+
readable,
|
|
319
|
+
hashPrefix
|
|
320
|
+
})),
|
|
321
|
+
entries: entries.sort((a, b) => a.path.localeCompare(b.path))
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
async function readIgnoreSources(projectPath) {
|
|
325
|
+
return Promise.all(
|
|
326
|
+
IGNORE_FILES.map(async (path) => {
|
|
327
|
+
const absolutePath = join(projectPath, path);
|
|
328
|
+
try {
|
|
329
|
+
const fileStat = await stat(absolutePath);
|
|
330
|
+
if (!fileStat.isFile()) {
|
|
331
|
+
return { path, readable: false, patterns: [] };
|
|
332
|
+
}
|
|
333
|
+
const content = await readFilePrefix(
|
|
334
|
+
absolutePath,
|
|
335
|
+
fileStat.size,
|
|
336
|
+
DEFAULT_IGNORE_FILE_BYTES
|
|
337
|
+
);
|
|
338
|
+
return {
|
|
339
|
+
path,
|
|
340
|
+
readable: true,
|
|
341
|
+
patterns: parseIgnorePatterns(content.toString("utf8")),
|
|
342
|
+
hashPrefix: sha256(content).slice(0, 12)
|
|
343
|
+
};
|
|
344
|
+
} catch {
|
|
345
|
+
return { path, readable: false, patterns: [] };
|
|
346
|
+
}
|
|
347
|
+
})
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
function getIgnoredReason(relativePath, name, ignoreSources) {
|
|
351
|
+
if (HARD_SKIP_DIRS.has(relativePath) || HARD_SKIP_DIRS.has(name)) {
|
|
352
|
+
return `hard-skip:${name}`;
|
|
353
|
+
}
|
|
354
|
+
for (const source of ignoreSources) {
|
|
355
|
+
if (!source.readable) {
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
const matched = source.patterns.find(
|
|
359
|
+
(pattern) => ignorePatternMatches(pattern, relativePath, name)
|
|
360
|
+
);
|
|
361
|
+
if (matched) {
|
|
362
|
+
return `${source.path}:${matched}`;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return void 0;
|
|
366
|
+
}
|
|
367
|
+
function parseIgnorePatterns(content) {
|
|
368
|
+
return content.split(/\r?\n/u).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#") && !line.startsWith("!")).slice(0, 200);
|
|
369
|
+
}
|
|
370
|
+
function ignorePatternMatches(pattern, relativePath, name) {
|
|
371
|
+
const normalized = normalizeRelativePath(pattern).replace(/^\//, "");
|
|
372
|
+
const directoryPattern = pattern.endsWith("/") ? normalized.replace(/\/$/, "") : normalized;
|
|
373
|
+
if (!directoryPattern) {
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
const path = normalizeRelativePath(relativePath);
|
|
377
|
+
if (!directoryPattern.includes("*")) {
|
|
378
|
+
return path === directoryPattern || name === directoryPattern || path.startsWith(`${directoryPattern}/`);
|
|
379
|
+
}
|
|
380
|
+
const regex = globPatternToRegExp(directoryPattern);
|
|
381
|
+
return regex.test(path) || regex.test(name);
|
|
382
|
+
}
|
|
383
|
+
function globPatternToRegExp(pattern) {
|
|
384
|
+
let source = "";
|
|
385
|
+
for (let index = 0; index < pattern.length; index += 1) {
|
|
386
|
+
const char = pattern[index];
|
|
387
|
+
if (char === "*") {
|
|
388
|
+
const next = pattern[index + 1];
|
|
389
|
+
if (next === "*") {
|
|
390
|
+
source += ".*";
|
|
391
|
+
index += 1;
|
|
392
|
+
} else {
|
|
393
|
+
source += "[^/]*";
|
|
394
|
+
}
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
source += escapeRegExp(char ?? "");
|
|
398
|
+
}
|
|
399
|
+
return new RegExp(`^(?:${source})(?:/.*)?$`, "u");
|
|
400
|
+
}
|
|
401
|
+
function escapeRegExp(value) {
|
|
402
|
+
return value.replace(/[\\^$+?.()|[\]{}]/gu, "\\$&");
|
|
403
|
+
}
|
|
404
|
+
function incrementWorkspaceSnapshotCount(counts, kind) {
|
|
405
|
+
if (kind === "file") counts.files += 1;
|
|
406
|
+
if (kind === "directory") counts.directories += 1;
|
|
407
|
+
if (kind === "symlink") counts.symlinks += 1;
|
|
408
|
+
if (kind === "other") counts.other += 1;
|
|
409
|
+
}
|
|
410
|
+
function attachWorkspaceSnapshotChangedSummary(current, previous) {
|
|
411
|
+
if (!current) {
|
|
412
|
+
return void 0;
|
|
413
|
+
}
|
|
414
|
+
return {
|
|
415
|
+
...current,
|
|
416
|
+
changedSummary: diffWorkspaceSnapshotLite(previous, current)
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
function diffWorkspaceSnapshotLite(previous, current) {
|
|
420
|
+
if (!previous) {
|
|
421
|
+
return { added: 0, modified: 0, deleted: 0, changedKeys: [] };
|
|
422
|
+
}
|
|
423
|
+
const previousEntries = new Map(previous.entries.map((entry) => [entry.path, stableHash(entry)]));
|
|
424
|
+
const currentEntries = new Map(current.entries.map((entry) => [entry.path, stableHash(entry)]));
|
|
425
|
+
let added = 0;
|
|
426
|
+
let modified = 0;
|
|
427
|
+
let deleted = 0;
|
|
428
|
+
for (const [path, hash] of currentEntries) {
|
|
429
|
+
const previousHash = previousEntries.get(path);
|
|
430
|
+
if (!previousHash) {
|
|
431
|
+
added += 1;
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
if (previousHash !== hash) {
|
|
435
|
+
modified += 1;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
for (const path of previousEntries.keys()) {
|
|
439
|
+
if (!currentEntries.has(path)) {
|
|
440
|
+
deleted += 1;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
const changedKeys = [
|
|
444
|
+
...added > 0 ? ["workspaceSnapshotAdded"] : [],
|
|
445
|
+
...modified > 0 ? ["workspaceSnapshotModified"] : [],
|
|
446
|
+
...deleted > 0 ? ["workspaceSnapshotDeleted"] : []
|
|
447
|
+
];
|
|
448
|
+
return { added, modified, deleted, changedKeys };
|
|
449
|
+
}
|
|
450
|
+
function stripWorkspaceSnapshotChangedSummary(snapshot) {
|
|
451
|
+
if (!snapshot) {
|
|
452
|
+
return void 0;
|
|
453
|
+
}
|
|
454
|
+
const { changedSummary: _changedSummary, ...rest } = snapshot;
|
|
455
|
+
return rest;
|
|
456
|
+
}
|
|
457
|
+
async function hashFilePrefix(absolutePath, size, maxBytes) {
|
|
458
|
+
return sha256(await readFilePrefix(absolutePath, size, maxBytes)).slice(0, 12);
|
|
459
|
+
}
|
|
460
|
+
async function readFilePrefix(absolutePath, size, maxBytes) {
|
|
461
|
+
const bytesToRead = Math.max(0, Math.min(size, maxBytes));
|
|
462
|
+
if (bytesToRead === 0) {
|
|
463
|
+
return Buffer.alloc(0);
|
|
464
|
+
}
|
|
465
|
+
const handle = await open(absolutePath, "r");
|
|
466
|
+
try {
|
|
467
|
+
const buffer = Buffer.alloc(bytesToRead);
|
|
468
|
+
const { bytesRead } = await handle.read(buffer, 0, bytesToRead, 0);
|
|
469
|
+
return buffer.subarray(0, bytesRead);
|
|
470
|
+
} finally {
|
|
471
|
+
await handle.close();
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
function sanitizeRefs(refs) {
|
|
475
|
+
return refs.map((ref) => truncateText(ref.replace(/\s+/g, " "), 240)).slice(0, 20);
|
|
476
|
+
}
|
|
477
|
+
function normalizeRelativePath(path) {
|
|
478
|
+
const normalized = path.replaceAll("\\", "/").replace(/^\.\//, "").replace(/\/$/, "");
|
|
479
|
+
return normalized || ".";
|
|
480
|
+
}
|
|
481
|
+
function truncateText(text, max) {
|
|
482
|
+
if (text.length <= max) return text;
|
|
483
|
+
return `${text.slice(0, Math.max(0, max - 1))}\u2026`;
|
|
484
|
+
}
|
|
485
|
+
function stableHash(value) {
|
|
486
|
+
return sha256(Buffer.from(stableStringify(value), "utf8")).slice(0, 12);
|
|
487
|
+
}
|
|
488
|
+
function sha256(value) {
|
|
489
|
+
return createHash("sha256").update(value).digest("hex");
|
|
490
|
+
}
|
|
491
|
+
function stableStringify(value) {
|
|
492
|
+
if (Array.isArray(value)) {
|
|
493
|
+
return `[${value.map((item) => stableStringify(item)).join(",")}]`;
|
|
494
|
+
}
|
|
495
|
+
if (value && typeof value === "object") {
|
|
496
|
+
return `{${Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => `${key}:${stableStringify(item)}`).join(",")}}`;
|
|
497
|
+
}
|
|
498
|
+
return JSON.stringify(value) ?? String(value);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export {
|
|
502
|
+
getWorkspaceReferenceSnapshot,
|
|
503
|
+
createWorkspaceReferenceCache,
|
|
504
|
+
workspaceReferenceHash,
|
|
505
|
+
isFallbackWorkspaceReferenceSnapshot
|
|
506
|
+
};
|