@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,172 @@
|
|
|
1
|
+
// src/agent-workflow-registry.ts
|
|
2
|
+
import { readFile, readdir } from "fs/promises";
|
|
3
|
+
import { extname, join } from "path";
|
|
4
|
+
import { builtInTools } from "@linghun/tools";
|
|
5
|
+
async function loadAgentRegistry(projectPath) {
|
|
6
|
+
return loadRegistryDir(join(projectPath, ".linghun", "agents"), parseAgentDefinition);
|
|
7
|
+
}
|
|
8
|
+
async function loadWorkflowRegistry(projectPath) {
|
|
9
|
+
return loadRegistryDir(join(projectPath, ".linghun", "workflows"), parseWorkflowDefinition);
|
|
10
|
+
}
|
|
11
|
+
function registryAgentToWorkflowTemplate(agent) {
|
|
12
|
+
return {
|
|
13
|
+
id: `agent:${agent.id}`,
|
|
14
|
+
purpose: agent.description,
|
|
15
|
+
risk: "medium",
|
|
16
|
+
writesFiles: (agent.allowedTools ?? []).some(
|
|
17
|
+
(tool) => ["Write", "Edit", "MultiEdit", "Bash"].includes(tool)
|
|
18
|
+
),
|
|
19
|
+
recommendedValidation: [],
|
|
20
|
+
steps: [`agent ${agent.id}: ${agent.prompt}`]
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function registryWorkflowToTemplate(workflow) {
|
|
24
|
+
return {
|
|
25
|
+
id: workflow.id,
|
|
26
|
+
purpose: workflow.description,
|
|
27
|
+
risk: workflow.steps.some((step) => step.action === "bash" || step.action === "write") ? "high" : "medium",
|
|
28
|
+
writesFiles: workflow.steps.some((step) => step.action === "write"),
|
|
29
|
+
recommendedValidation: workflow.steps.filter((step) => step.action === "verification" && step.level).map((step) => step.level),
|
|
30
|
+
steps: workflow.steps.map((step) => `${step.action}:${step.id}`)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async function loadRegistryDir(dir, parse) {
|
|
34
|
+
let entries;
|
|
35
|
+
try {
|
|
36
|
+
entries = await readdir(dir);
|
|
37
|
+
} catch {
|
|
38
|
+
return { ok: true, items: [], errors: [] };
|
|
39
|
+
}
|
|
40
|
+
const items = [];
|
|
41
|
+
const errors = [];
|
|
42
|
+
for (const name of entries.filter((entry) => [".json", ".md"].includes(extname(entry))).sort()) {
|
|
43
|
+
const path = join(dir, name);
|
|
44
|
+
try {
|
|
45
|
+
items.push(parse(await readFile(path, "utf8"), path));
|
|
46
|
+
} catch (error) {
|
|
47
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
48
|
+
errors.push(`${name}: ${message}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return { ok: errors.length === 0, items, errors };
|
|
52
|
+
}
|
|
53
|
+
function parseAgentDefinition(content, path) {
|
|
54
|
+
const value = parseRegistryContent(content, path);
|
|
55
|
+
const obj = asRecord(value, "agent definition");
|
|
56
|
+
const id = readRequiredString(obj, "id");
|
|
57
|
+
const name = readRequiredString(obj, "name");
|
|
58
|
+
const description = readRequiredString(obj, "description");
|
|
59
|
+
const prompt = readRequiredString(obj, "prompt");
|
|
60
|
+
const allowedTools = Array.isArray(obj.allowedTools) ? obj.allowedTools.map((item) => readAgentToolName(item, "allowedTools")) : void 0;
|
|
61
|
+
return {
|
|
62
|
+
id: assertSafeId(id, "id"),
|
|
63
|
+
name,
|
|
64
|
+
description,
|
|
65
|
+
prompt,
|
|
66
|
+
...typeof obj.model === "string" && obj.model.trim() ? { model: obj.model.trim() } : {},
|
|
67
|
+
...allowedTools ? { allowedTools } : {},
|
|
68
|
+
...typeof obj.maxTurns === "number" && Number.isInteger(obj.maxTurns) && obj.maxTurns > 0 ? { maxTurns: obj.maxTurns } : {},
|
|
69
|
+
path
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function parseWorkflowDefinition(content, path) {
|
|
73
|
+
const value = parseRegistryContent(content, path);
|
|
74
|
+
const obj = asRecord(value, "workflow definition");
|
|
75
|
+
const id = assertSafeId(readRequiredString(obj, "id"), "id");
|
|
76
|
+
const name = readRequiredString(obj, "name");
|
|
77
|
+
const description = readRequiredString(obj, "description");
|
|
78
|
+
if (!Array.isArray(obj.steps) || obj.steps.length === 0) {
|
|
79
|
+
throw new Error("steps must be a non-empty array");
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
id,
|
|
83
|
+
name,
|
|
84
|
+
description,
|
|
85
|
+
steps: obj.steps.map((step, index) => parseWorkflowStep(step, index)),
|
|
86
|
+
...asOptionalRecord(obj.inputs) ? { inputs: obj.inputs } : {},
|
|
87
|
+
...typeof obj.runInBackground === "boolean" ? { runInBackground: obj.runInBackground } : {},
|
|
88
|
+
path
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function parseWorkflowStep(value, index) {
|
|
92
|
+
const obj = asRecord(value, `steps[${index}]`);
|
|
93
|
+
const action = obj.action;
|
|
94
|
+
if (action !== "agent" && action !== "verification" && action !== "index" && action !== "details" && action !== "bash" && action !== "write") {
|
|
95
|
+
throw new Error(`steps[${index}].action is invalid`);
|
|
96
|
+
}
|
|
97
|
+
const step = {
|
|
98
|
+
id: assertSafeId(
|
|
99
|
+
typeof obj.id === "string" && obj.id.trim() ? obj.id.trim() : `step-${index + 1}`,
|
|
100
|
+
`steps[${index}].id`
|
|
101
|
+
),
|
|
102
|
+
action
|
|
103
|
+
};
|
|
104
|
+
if (typeof obj.role === "string") {
|
|
105
|
+
if (!isAgentTypeValue(obj.role)) throw new Error(`steps[${index}].role is invalid`);
|
|
106
|
+
step.role = obj.role;
|
|
107
|
+
}
|
|
108
|
+
if (typeof obj.task === "string") step.task = obj.task.trim();
|
|
109
|
+
if (typeof obj.level === "string") {
|
|
110
|
+
if (!["smoke", "focused", "typecheck", "test", "build", "lint"].includes(obj.level)) {
|
|
111
|
+
throw new Error(`steps[${index}].level is invalid`);
|
|
112
|
+
}
|
|
113
|
+
step.level = obj.level;
|
|
114
|
+
}
|
|
115
|
+
if (typeof obj.command === "string") step.command = obj.command.trim();
|
|
116
|
+
if (typeof obj.path === "string") step.path = obj.path.trim();
|
|
117
|
+
if (typeof obj.content === "string") step.content = obj.content.trim();
|
|
118
|
+
return step;
|
|
119
|
+
}
|
|
120
|
+
function parseRegistryContent(content, path) {
|
|
121
|
+
if (extname(path) === ".json") return JSON.parse(content);
|
|
122
|
+
const match = /^---\r?\n(?<frontmatter>[\s\S]*?)\r?\n---/.exec(content);
|
|
123
|
+
if (!match?.groups?.frontmatter) {
|
|
124
|
+
throw new Error("markdown registry files require JSON frontmatter between --- markers");
|
|
125
|
+
}
|
|
126
|
+
return JSON.parse(match.groups.frontmatter);
|
|
127
|
+
}
|
|
128
|
+
function asRecord(value, label) {
|
|
129
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
130
|
+
throw new Error(`${label} must be an object`);
|
|
131
|
+
}
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
function asOptionalRecord(value) {
|
|
135
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
136
|
+
}
|
|
137
|
+
function readRequiredString(obj, key) {
|
|
138
|
+
const value = obj[key];
|
|
139
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
140
|
+
throw new Error(`${key} must be a non-empty string`);
|
|
141
|
+
}
|
|
142
|
+
return value.trim();
|
|
143
|
+
}
|
|
144
|
+
function readArrayString(value, key) {
|
|
145
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
146
|
+
throw new Error(`${key} entries must be non-empty strings`);
|
|
147
|
+
}
|
|
148
|
+
return value.trim();
|
|
149
|
+
}
|
|
150
|
+
function readAgentToolName(value, key) {
|
|
151
|
+
const name = readArrayString(value, key);
|
|
152
|
+
if (!Object.prototype.hasOwnProperty.call(builtInTools, name)) {
|
|
153
|
+
throw new Error(`${key} contains invalid tool: ${name}`);
|
|
154
|
+
}
|
|
155
|
+
return name;
|
|
156
|
+
}
|
|
157
|
+
function assertSafeId(value, key) {
|
|
158
|
+
if (!/^[a-zA-Z0-9._-]{1,80}$/u.test(value)) {
|
|
159
|
+
throw new Error(`${key} must contain only letters, digits, dot, underscore, or dash`);
|
|
160
|
+
}
|
|
161
|
+
return value;
|
|
162
|
+
}
|
|
163
|
+
function isAgentTypeValue(value) {
|
|
164
|
+
return value === "explorer" || value === "planner" || value === "worker" || value === "verifier";
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export {
|
|
168
|
+
loadAgentRegistry,
|
|
169
|
+
loadWorkflowRegistry,
|
|
170
|
+
registryAgentToWorkflowTemplate,
|
|
171
|
+
registryWorkflowToTemplate
|
|
172
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fitText
|
|
3
|
+
} from "./chunk-APJIC2O5.js";
|
|
4
|
+
|
|
5
|
+
// src/shell/components/SlashSuggestions.tsx
|
|
6
|
+
import { Box, Text } from "@linghun/ink-runtime";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
function SlashSuggestions({
|
|
9
|
+
candidates,
|
|
10
|
+
selectedIndex,
|
|
11
|
+
theme,
|
|
12
|
+
language,
|
|
13
|
+
width,
|
|
14
|
+
hint
|
|
15
|
+
}) {
|
|
16
|
+
if (candidates.length === 0) return null;
|
|
17
|
+
const safeIndex = Math.max(0, Math.min(selectedIndex, candidates.length - 1));
|
|
18
|
+
const widest = candidates.reduce((acc, item) => Math.max(acc, item.slash.length), 0);
|
|
19
|
+
const colWidth = Math.min(Math.max(widest + 2, 12), 14);
|
|
20
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", width, children: [
|
|
21
|
+
candidates.map((item, index) => {
|
|
22
|
+
const title = language === "en-US" ? item.titleEn : item.titleZh;
|
|
23
|
+
const isSelected = index === safeIndex;
|
|
24
|
+
const marker = isSelected ? "\u203A" : " ";
|
|
25
|
+
const line = `${marker} ${item.slash.padEnd(colWidth, " ")}${title}`;
|
|
26
|
+
return /* @__PURE__ */ jsx(Text, { color: isSelected ? theme.accent : theme.muted, bold: isSelected, children: fitText(line, Math.max(20, width - 2)) }, item.slash);
|
|
27
|
+
}),
|
|
28
|
+
hint ? /* @__PURE__ */ jsx(Text, { color: theme.muted, children: fitText(hint, Math.max(20, width - 2)) }) : null
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
SlashSuggestions
|
|
34
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/shell/clipboard.ts
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
async function writeTextToClipboard(text, options = {}) {
|
|
4
|
+
return writeTextToClipboardWithDeps(text, clipboardCandidates(), pipeToCommand, options.stdout);
|
|
5
|
+
}
|
|
6
|
+
async function writeTextToClipboardWithDeps(text, candidates, pipe, stdout) {
|
|
7
|
+
const normalized = text.replace(/\r\n/g, "\n");
|
|
8
|
+
if (!normalized) return { ok: false, error: "empty selection" };
|
|
9
|
+
const osc52Written = writeOsc52(stdout, normalized);
|
|
10
|
+
const errors = [];
|
|
11
|
+
for (const candidate of candidates) {
|
|
12
|
+
const input = clipboardInputForCandidate(candidate, normalized);
|
|
13
|
+
const result = await pipe(candidate.command, candidate.args, input.text, input.encoding);
|
|
14
|
+
if (result.ok) return { ok: true, method: candidate.label };
|
|
15
|
+
if (result.error) errors.push(`${candidate.label}: ${result.error}`);
|
|
16
|
+
}
|
|
17
|
+
if (osc52Written && candidates.length === 0) return { ok: true, method: "osc52-best-effort" };
|
|
18
|
+
return {
|
|
19
|
+
ok: false,
|
|
20
|
+
error: errors.length > 0 ? `no supported clipboard command succeeded (${errors.join("; ")})${osc52Written ? "; OSC52 was attempted but cannot be acknowledged" : ""}` : osc52Written ? "OSC52 was attempted but cannot be acknowledged; no native clipboard command found" : "no supported clipboard command found"
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function clipboardCandidates() {
|
|
24
|
+
if (process.platform === "win32") return [{ command: "clip", args: [], label: "clip" }];
|
|
25
|
+
if (process.platform === "darwin") return [{ command: "pbcopy", args: [], label: "pbcopy" }];
|
|
26
|
+
return [
|
|
27
|
+
{ command: "wl-copy", args: [], label: "wl-copy" },
|
|
28
|
+
{ command: "xclip", args: ["-selection", "clipboard"], label: "xclip" },
|
|
29
|
+
{ command: "xsel", args: ["--clipboard", "--input"], label: "xsel" }
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
function pipeToCommand(command, args, text, encoding) {
|
|
33
|
+
return new Promise((resolve) => {
|
|
34
|
+
let settled = false;
|
|
35
|
+
let stderr = "";
|
|
36
|
+
let child;
|
|
37
|
+
try {
|
|
38
|
+
child = spawn(command, args, {
|
|
39
|
+
stdio: ["pipe", "ignore", "pipe"],
|
|
40
|
+
windowsHide: true
|
|
41
|
+
});
|
|
42
|
+
} catch (error) {
|
|
43
|
+
resolve({ ok: false, error: error instanceof Error ? error.message : String(error) });
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const finish = (result) => {
|
|
47
|
+
if (settled) return;
|
|
48
|
+
settled = true;
|
|
49
|
+
resolve(result);
|
|
50
|
+
};
|
|
51
|
+
child.once("error", (error) => finish({ ok: false, error: error.message }));
|
|
52
|
+
child.stderr?.on("data", (chunk) => {
|
|
53
|
+
stderr += chunk.toString();
|
|
54
|
+
});
|
|
55
|
+
child.once("close", (code) => {
|
|
56
|
+
if (code === 0) {
|
|
57
|
+
finish({ ok: true });
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
finish({ ok: false, error: stderr.trim() || `exit ${code ?? "unknown"}` });
|
|
61
|
+
});
|
|
62
|
+
child.stdin?.end(Buffer.from(text, encoding));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function clipboardInputForCandidate(candidate, text) {
|
|
66
|
+
if (process.platform === "win32" && candidate.command.toLowerCase() === "clip") {
|
|
67
|
+
return { text: `${text.replace(/\n/g, "\r\n")}\r
|
|
68
|
+
`, encoding: "utf16le" };
|
|
69
|
+
}
|
|
70
|
+
return { text, encoding: "utf8" };
|
|
71
|
+
}
|
|
72
|
+
function writeOsc52(stdout, text) {
|
|
73
|
+
if (!stdout || typeof stdout.write !== "function") return false;
|
|
74
|
+
try {
|
|
75
|
+
const payload = Buffer.from(text, "utf8").toString("base64");
|
|
76
|
+
const osc = `\x1B]52;c;${payload}\x07`;
|
|
77
|
+
const sequence = isTmux() ? wrapTmuxDcs(osc) : osc;
|
|
78
|
+
return stdout.write(sequence) !== false;
|
|
79
|
+
} catch {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function isTmux() {
|
|
84
|
+
return Boolean(process.env.TMUX);
|
|
85
|
+
}
|
|
86
|
+
function wrapTmuxDcs(osc) {
|
|
87
|
+
const escaped = osc.replace(/\x1B/g, "\x1B\x1B");
|
|
88
|
+
return `\x1BPtmux;${escaped}\x1B\\`;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
writeTextToClipboard,
|
|
93
|
+
writeTextToClipboardWithDeps
|
|
94
|
+
};
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import {
|
|
2
|
+
codebaseMemoryRequiredArgs
|
|
3
|
+
} from "./chunk-QLRTQHTR.js";
|
|
4
|
+
import {
|
|
5
|
+
truncateDisplay
|
|
6
|
+
} from "./chunk-OMZYPQVA.js";
|
|
7
|
+
|
|
8
|
+
// src/deferred-tools-catalog.ts
|
|
9
|
+
function codebaseMemoryRiskClass() {
|
|
10
|
+
return {
|
|
11
|
+
list_projects: "readonly",
|
|
12
|
+
index_status: "readonly",
|
|
13
|
+
search_code: "readonly",
|
|
14
|
+
get_architecture: "readonly",
|
|
15
|
+
get_code_snippet: "readonly",
|
|
16
|
+
query_graph: "readonly",
|
|
17
|
+
trace_path: "readonly",
|
|
18
|
+
search_graph: "readonly",
|
|
19
|
+
index_repository: "mutating",
|
|
20
|
+
detect_changes: "mutating"
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function getCodebaseMemoryToolRisk(tool) {
|
|
24
|
+
return codebaseMemoryRiskClass()[tool] ?? "unknown";
|
|
25
|
+
}
|
|
26
|
+
function validateCodebaseMemoryToolExecution(tool, input) {
|
|
27
|
+
const requiredArgs = codebaseMemoryRequiredArgs();
|
|
28
|
+
if (!(tool in requiredArgs)) {
|
|
29
|
+
return {
|
|
30
|
+
ok: false,
|
|
31
|
+
summary: `MCP deferred tool guard: ${tool} \u5C1A\u672A\u7ECF\u8FC7 discovery/schema/trust/runtime \u767B\u8BB0\uFF0C\u5DF2\u62D2\u7EDD\u6267\u884C\u3002\u8BF7\u5148\u8FD0\u884C /mcp doctor \u6216\u4F7F\u7528\u5DF2\u53D1\u73B0\u4E14\u53EF\u4FE1\u7684\u5DE5\u5177\u5165\u53E3\u3002`
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const missing = requiredArgs[tool]?.filter(
|
|
35
|
+
(key) => input[key] === void 0 || input[key] === null || input[key] === ""
|
|
36
|
+
);
|
|
37
|
+
if (missing && missing.length > 0) {
|
|
38
|
+
return {
|
|
39
|
+
ok: false,
|
|
40
|
+
summary: `MCP deferred tool guard: ${tool} \u7F3A\u5C11 required args\uFF1A${missing.join(", ")}\u3002\u5DF2\u62D2\u7EDD\u76F2\u6267\u884C\u3002`
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const schemaProblem = validateCodebaseMemoryToolSchema(tool, input);
|
|
44
|
+
if (schemaProblem) {
|
|
45
|
+
return { ok: false, summary: schemaProblem };
|
|
46
|
+
}
|
|
47
|
+
return { ok: true };
|
|
48
|
+
}
|
|
49
|
+
function validateCodebaseMemoryToolSchema(tool, input) {
|
|
50
|
+
const stringArgs = /* @__PURE__ */ new Set(["project", "projectName", "query", "path", "symbol", "from", "to", "repo_path"]);
|
|
51
|
+
const booleanArgs = /* @__PURE__ */ new Set(["force"]);
|
|
52
|
+
const numberArgs = /* @__PURE__ */ new Set(["limit", "max_depth"]);
|
|
53
|
+
for (const [key, value] of Object.entries(input)) {
|
|
54
|
+
if (stringArgs.has(key) && typeof value !== "string") {
|
|
55
|
+
return `MCP deferred tool guard: ${tool}.${key} \u5FC5\u987B\u662F string\uFF0C\u5DF2\u62D2\u7EDD\u6267\u884C\u3002`;
|
|
56
|
+
}
|
|
57
|
+
if (booleanArgs.has(key) && typeof value !== "boolean") {
|
|
58
|
+
return `MCP deferred tool guard: ${tool}.${key} \u5FC5\u987B\u662F boolean\uFF0C\u5DF2\u62D2\u7EDD\u6267\u884C\u3002`;
|
|
59
|
+
}
|
|
60
|
+
if (numberArgs.has(key) && typeof value !== "number") {
|
|
61
|
+
return `MCP deferred tool guard: ${tool}.${key} \u5FC5\u987B\u662F number\uFF0C\u5DF2\u62D2\u7EDD\u6267\u884C\u3002`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return void 0;
|
|
65
|
+
}
|
|
66
|
+
var CODEBASE_MEMORY_DESCRIPTIONS = {
|
|
67
|
+
list_projects: "List indexed projects in codebase-memory.",
|
|
68
|
+
index_status: "Get current index status (nodes/edges/status) for a project.",
|
|
69
|
+
detect_changes: "Detect uncovered file changes for a project's index.",
|
|
70
|
+
index_repository: "Build or refresh the codebase-memory index for a repo path.",
|
|
71
|
+
search_code: "Pattern search across an indexed project.",
|
|
72
|
+
get_architecture: "Project architecture summary (modules, entry points).",
|
|
73
|
+
get_code_snippet: "Read a code snippet by qualified name in an indexed project.",
|
|
74
|
+
query_graph: "Run a graph query (CALLS / IMPORTS) on an indexed project.",
|
|
75
|
+
trace_path: "Trace a function call chain from -> to in an indexed project.",
|
|
76
|
+
search_graph: "Find similar implementations / SIMILAR_TO entries in a project."
|
|
77
|
+
};
|
|
78
|
+
function listCodebaseMemoryDeferredTools() {
|
|
79
|
+
const required = codebaseMemoryRequiredArgs();
|
|
80
|
+
return Object.keys(required).sort((a, b) => a.localeCompare(b)).map((name) => ({
|
|
81
|
+
name,
|
|
82
|
+
kind: "codebase-memory",
|
|
83
|
+
description: CODEBASE_MEMORY_DESCRIPTIONS[name] ?? `codebase-memory tool: ${name}`,
|
|
84
|
+
requiredArgs: [...required[name]],
|
|
85
|
+
executable: true,
|
|
86
|
+
reason: "codebase-memory static whitelist; required args validated before execution."
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
function listMcpDeferredTools(context) {
|
|
90
|
+
if (!context.mcp.enabled) return [];
|
|
91
|
+
const enabledServers = new Set(
|
|
92
|
+
context.mcp.servers.filter((server) => server.status !== "disabled" && server.status !== "missing").map((server) => server.name)
|
|
93
|
+
);
|
|
94
|
+
return context.mcp.tools.filter((tool) => enabledServers.has(tool.server)).filter((tool) => tool.discovery === "discovered").filter((tool) => tool.schemaLoaded === true).filter((tool) => tool.trusted === true).map((tool) => {
|
|
95
|
+
const serverConfig = context.config.mcp.servers[tool.server];
|
|
96
|
+
const localStdio = isLocalStdioMcpServer(serverConfig);
|
|
97
|
+
const sse = serverConfig?.transport === "sse" && typeof serverConfig.url === "string" && serverConfig.url.trim();
|
|
98
|
+
return {
|
|
99
|
+
name: `mcp:${tool.server}:${tool.name}`,
|
|
100
|
+
kind: "mcp",
|
|
101
|
+
// truncate is already enforced by stabilizeMcpToolList; do not echo raw schema
|
|
102
|
+
description: tool.description || `MCP tool ${tool.server}:${tool.name}`,
|
|
103
|
+
requiredArgs: [],
|
|
104
|
+
executable: Boolean(localStdio || sse),
|
|
105
|
+
reason: localStdio ? "MCP server tool discovered (local stdio); JSON-RPC tools/call adapter available. Mutating use needs session permission." : sse ? "MCP server tool discovered (SSE/HTTP endpoint); JSON-RPC tools/list and tools/call adapter available. Mutating use needs session permission." : "MCP server tool discovered with schema and trusted, but server is not local stdio or SSE."
|
|
106
|
+
};
|
|
107
|
+
}).sort((a, b) => a.name.localeCompare(b.name));
|
|
108
|
+
}
|
|
109
|
+
function isLocalStdioMcpServer(server) {
|
|
110
|
+
if (!server) return false;
|
|
111
|
+
if (server.disabled === true) return false;
|
|
112
|
+
if (typeof server.command !== "string") return false;
|
|
113
|
+
if (server.command.trim() === "") return false;
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
function listSkillDeferredTools(context) {
|
|
117
|
+
if (!context.skills.enabled) return [];
|
|
118
|
+
const disabled = new Set(context.skills.disabledIds);
|
|
119
|
+
const trusted = new Set(context.skills.trustedIds);
|
|
120
|
+
return context.skills.skills.filter((skill) => !disabled.has(skill.id)).filter((skill) => trusted.has(skill.id)).map((skill) => ({
|
|
121
|
+
name: `skill:${skill.id}`,
|
|
122
|
+
kind: "skill",
|
|
123
|
+
description: truncateDisplay(
|
|
124
|
+
(skill.description ?? skill.name ?? skill.id).replace(/\s+/g, " "),
|
|
125
|
+
160
|
|
126
|
+
),
|
|
127
|
+
requiredArgs: [],
|
|
128
|
+
executable: false,
|
|
129
|
+
reason: skillManifestHasContribution(skill) ? "Skill manifest contributes commands/tools (enabled+trusted), but Linghun has no safe Skill executor adapter yet; review manifest manually or run /skills status." : "Skill manifest is metadata-only (no command/tool contribution); not executable. Run /skills status for details."
|
|
130
|
+
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
131
|
+
}
|
|
132
|
+
function skillManifestHasContribution(skill) {
|
|
133
|
+
const triggers = skill.triggers ?? [];
|
|
134
|
+
if (Array.isArray(triggers) && triggers.length > 0) return true;
|
|
135
|
+
const raw = skill;
|
|
136
|
+
if (Array.isArray(raw.commands) && raw.commands.length > 0) return true;
|
|
137
|
+
if (Array.isArray(raw.tools) && raw.tools.length > 0) return true;
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
function listPluginDeferredTools(context) {
|
|
141
|
+
if (!context.plugins.enabled) return [];
|
|
142
|
+
const disabled = new Set(context.plugins.disabledIds);
|
|
143
|
+
const trusted = new Set(context.plugins.trustedIds);
|
|
144
|
+
return context.plugins.plugins.filter((plugin) => !disabled.has(plugin.id)).filter((plugin) => trusted.has(plugin.id)).map((plugin) => ({
|
|
145
|
+
name: `plugin:${plugin.id}`,
|
|
146
|
+
kind: "plugin",
|
|
147
|
+
description: truncateDisplay(
|
|
148
|
+
(plugin.description ?? plugin.name ?? plugin.id).replace(/\s+/g, " "),
|
|
149
|
+
160
|
|
150
|
+
),
|
|
151
|
+
requiredArgs: [],
|
|
152
|
+
executable: false,
|
|
153
|
+
reason: pluginManifestHasContribution(plugin) ? "Plugin manifest contributes commands/tools (enabled+trusted), but Linghun has no safe Plugin executor adapter yet; review contributions manually or run /plugins doctor." : "Plugin manifest is metadata-only (no command/tool contribution); not executable. Run /plugins doctor for details."
|
|
154
|
+
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
155
|
+
}
|
|
156
|
+
function pluginManifestHasContribution(plugin) {
|
|
157
|
+
const c = plugin.contributions;
|
|
158
|
+
if (!c) return false;
|
|
159
|
+
return (c.commands?.length ?? 0) > 0 || (c.mcpServers?.length ?? 0) > 0 || (c.providers?.length ?? 0) > 0 || (c.hooks?.length ?? 0) > 0 || (c.workflows?.length ?? 0) > 0 || (c.skills?.length ?? 0) > 0;
|
|
160
|
+
}
|
|
161
|
+
function listDeferredTools(context) {
|
|
162
|
+
return [
|
|
163
|
+
...listCodebaseMemoryDeferredTools(),
|
|
164
|
+
...listMcpDeferredTools(context),
|
|
165
|
+
...listSkillDeferredTools(context),
|
|
166
|
+
...listPluginDeferredTools(context)
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
function snapshotDeferredTools(context) {
|
|
170
|
+
const tools = listDeferredTools(context);
|
|
171
|
+
const byKind = {
|
|
172
|
+
"codebase-memory": 0,
|
|
173
|
+
mcp: 0,
|
|
174
|
+
skill: 0,
|
|
175
|
+
plugin: 0
|
|
176
|
+
};
|
|
177
|
+
let executableCount = 0;
|
|
178
|
+
for (const tool of tools) {
|
|
179
|
+
byKind[tool.kind] += 1;
|
|
180
|
+
if (tool.executable) executableCount += 1;
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
184
|
+
total: tools.length,
|
|
185
|
+
byKind,
|
|
186
|
+
executableCount,
|
|
187
|
+
tools
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function snapshotDeferredToolsSummary(context) {
|
|
191
|
+
const snapshot = snapshotDeferredTools(context);
|
|
192
|
+
return {
|
|
193
|
+
total: snapshot.total,
|
|
194
|
+
byKind: snapshot.byKind,
|
|
195
|
+
executableCount: snapshot.executableCount
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
var DISCOVERED_NAME_MAX_LEN = 80;
|
|
199
|
+
var DISCOVERED_NAMES_MAX_COUNT = 32;
|
|
200
|
+
function sanitizeDiscoveredDeferredToolName(name) {
|
|
201
|
+
const cleaned = name.replace(/[^A-Za-z0-9_:.\-]/g, "_");
|
|
202
|
+
if (cleaned.length <= DISCOVERED_NAME_MAX_LEN) return cleaned;
|
|
203
|
+
return `${cleaned.slice(0, DISCOVERED_NAME_MAX_LEN)}\u2026`;
|
|
204
|
+
}
|
|
205
|
+
function snapshotDiscoveredDeferredToolsSummary(context) {
|
|
206
|
+
const sorted = Array.from(context.discoveredDeferredToolNames).sort();
|
|
207
|
+
const sanitized = sorted.map(sanitizeDiscoveredDeferredToolName);
|
|
208
|
+
if (sanitized.length <= DISCOVERED_NAMES_MAX_COUNT) {
|
|
209
|
+
return { total: sanitized.length, names: sanitized, truncated: false };
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
total: sanitized.length,
|
|
213
|
+
names: sanitized.slice(0, DISCOVERED_NAMES_MAX_COUNT),
|
|
214
|
+
truncated: true
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function searchDeferredTools(query, tools) {
|
|
218
|
+
const trimmed = query.trim().toLowerCase();
|
|
219
|
+
if (trimmed === "") return tools;
|
|
220
|
+
return tools.filter((tool) => {
|
|
221
|
+
const haystack = `${tool.name} ${tool.description} ${tool.kind}`.toLowerCase();
|
|
222
|
+
return haystack.includes(trimmed);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function findDeferredTool(toolName, tools) {
|
|
226
|
+
return tools.find((tool) => tool.name === toolName);
|
|
227
|
+
}
|
|
228
|
+
function deferredToolListHashInput(tools) {
|
|
229
|
+
return tools.map((tool) => ({
|
|
230
|
+
name: tool.name,
|
|
231
|
+
kind: tool.kind,
|
|
232
|
+
executable: tool.executable,
|
|
233
|
+
requiredArgs: [...tool.requiredArgs].sort((a, b) => a.localeCompare(b))
|
|
234
|
+
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
235
|
+
}
|
|
236
|
+
function formatDeferredToolsSystemReminder(language, snapshot) {
|
|
237
|
+
if (snapshot.total === 0) return void 0;
|
|
238
|
+
return language === "en-US" ? "Additional tools must be discovered via SearchExtraTools, then invoked via ExecuteExtraTool. Built-in tools (Read/Edit/Write/Bash/Grep/Glob/Todo) are still called directly." : "Additional tools must be discovered via SearchExtraTools, then invoked via ExecuteExtraTool.";
|
|
239
|
+
}
|
|
240
|
+
function isCodebaseMemoryToolName(name) {
|
|
241
|
+
return name in codebaseMemoryRequiredArgs();
|
|
242
|
+
}
|
|
243
|
+
function summarizeDeferredToolMatch(tool) {
|
|
244
|
+
return {
|
|
245
|
+
name: tool.name,
|
|
246
|
+
kind: tool.kind,
|
|
247
|
+
description: tool.description,
|
|
248
|
+
requiredArgs: tool.requiredArgs,
|
|
249
|
+
executable: tool.executable,
|
|
250
|
+
reason: tool.reason
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function parseMcpDeferredToolName(name) {
|
|
254
|
+
if (!name.startsWith("mcp:")) return void 0;
|
|
255
|
+
const rest = name.slice(4);
|
|
256
|
+
const idx = rest.indexOf(":");
|
|
257
|
+
if (idx <= 0) return void 0;
|
|
258
|
+
const server = rest.slice(0, idx);
|
|
259
|
+
const tool = rest.slice(idx + 1);
|
|
260
|
+
if (server.trim() === "" || tool.trim() === "") return void 0;
|
|
261
|
+
return { server, tool };
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export {
|
|
265
|
+
getCodebaseMemoryToolRisk,
|
|
266
|
+
validateCodebaseMemoryToolExecution,
|
|
267
|
+
isLocalStdioMcpServer,
|
|
268
|
+
listDeferredTools,
|
|
269
|
+
snapshotDeferredTools,
|
|
270
|
+
snapshotDeferredToolsSummary,
|
|
271
|
+
sanitizeDiscoveredDeferredToolName,
|
|
272
|
+
snapshotDiscoveredDeferredToolsSummary,
|
|
273
|
+
searchDeferredTools,
|
|
274
|
+
findDeferredTool,
|
|
275
|
+
deferredToolListHashInput,
|
|
276
|
+
formatDeferredToolsSystemReminder,
|
|
277
|
+
isCodebaseMemoryToolName,
|
|
278
|
+
summarizeDeferredToolMatch,
|
|
279
|
+
parseMcpDeferredToolName
|
|
280
|
+
};
|