@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,800 @@
|
|
|
1
|
+
import {
|
|
2
|
+
executeCapability,
|
|
3
|
+
registerCapability,
|
|
4
|
+
registerCapabilityProvider,
|
|
5
|
+
setCapabilityConnectionResolver,
|
|
6
|
+
unregisterCapabilitiesByApp
|
|
7
|
+
} from "./chunk-QB4VWH7W.js";
|
|
8
|
+
import {
|
|
9
|
+
ensureSession,
|
|
10
|
+
showCommandPanel
|
|
11
|
+
} from "./chunk-JO5ANTMR.js";
|
|
12
|
+
import {
|
|
13
|
+
budgetToolResultTranscriptContent
|
|
14
|
+
} from "./chunk-64MJP6FK.js";
|
|
15
|
+
import {
|
|
16
|
+
truncateDisplay,
|
|
17
|
+
writeLine
|
|
18
|
+
} from "./chunk-OMZYPQVA.js";
|
|
19
|
+
|
|
20
|
+
// src/connector-runtime.ts
|
|
21
|
+
import { randomUUID } from "crypto";
|
|
22
|
+
import { readFile } from "fs/promises";
|
|
23
|
+
import { basename, relative, resolve } from "path";
|
|
24
|
+
var HTTP_TIMEOUT_MS = 5e3;
|
|
25
|
+
var runtimeByProject = /* @__PURE__ */ new Map();
|
|
26
|
+
function getRuntimeState(context) {
|
|
27
|
+
let state = runtimeByProject.get(context.projectPath);
|
|
28
|
+
if (!state) {
|
|
29
|
+
state = { apps: /* @__PURE__ */ new Map(), authConfigs: /* @__PURE__ */ new Map() };
|
|
30
|
+
runtimeByProject.set(context.projectPath, state);
|
|
31
|
+
}
|
|
32
|
+
return state;
|
|
33
|
+
}
|
|
34
|
+
function listAppConnectors(context) {
|
|
35
|
+
return [...getRuntimeState(context).apps.values()].sort((a, b) => a.appId.localeCompare(b.appId));
|
|
36
|
+
}
|
|
37
|
+
async function validateAppConnectorManifest(manifestPath, context) {
|
|
38
|
+
const localManifestPath = resolveProjectLocalManifestPath(manifestPath, context);
|
|
39
|
+
if (!localManifestPath.ok) return localManifestPath;
|
|
40
|
+
const manifest = await readConnectorManifest(localManifestPath.value);
|
|
41
|
+
if (!manifest.ok) return manifest;
|
|
42
|
+
const warnings = [];
|
|
43
|
+
if (manifest.value.transport !== "http") {
|
|
44
|
+
return {
|
|
45
|
+
ok: false,
|
|
46
|
+
error: `transport ${manifest.value.transport} is reserved; current App Bridge validate only supports Local HTTP.`
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (!manifest.value.baseUrl) {
|
|
50
|
+
return { ok: false, error: "HTTP connector requires baseUrl." };
|
|
51
|
+
}
|
|
52
|
+
const url = buildConnectorUrl(manifest.value.baseUrl, "");
|
|
53
|
+
if (!url.ok) return { ok: false, error: url.error };
|
|
54
|
+
const duplicateIds = findDuplicateCapabilityIds(manifest.value.capabilities);
|
|
55
|
+
if (duplicateIds.length > 0) {
|
|
56
|
+
return { ok: false, error: `duplicate capability id: ${duplicateIds.join(", ")}` };
|
|
57
|
+
}
|
|
58
|
+
const auth = resolveConnectorAuth(manifest.value.auth, context);
|
|
59
|
+
if (auth.type !== "none" && !auth.value) {
|
|
60
|
+
warnings.push(`auth ${auth.type} is not resolved yet; source=${auth.source}`);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
ok: true,
|
|
64
|
+
manifestPath: localManifestPath.value,
|
|
65
|
+
appId: manifest.value.appId,
|
|
66
|
+
name: manifest.value.name,
|
|
67
|
+
version: manifest.value.version,
|
|
68
|
+
transport: manifest.value.transport,
|
|
69
|
+
baseUrl: manifest.value.baseUrl,
|
|
70
|
+
capabilityCount: manifest.value.capabilities.length,
|
|
71
|
+
capabilityIds: manifest.value.capabilities.map((item) => item.id),
|
|
72
|
+
warnings
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async function connectAppConnector(manifestPath, context) {
|
|
76
|
+
const localManifestPath = resolveProjectLocalManifestPath(manifestPath, context);
|
|
77
|
+
if (!localManifestPath.ok) return localManifestPath;
|
|
78
|
+
const manifest = await readConnectorManifest(localManifestPath.value);
|
|
79
|
+
if (!manifest.ok) return manifest;
|
|
80
|
+
const auth = resolveConnectorAuth(manifest.value.auth, context);
|
|
81
|
+
if (auth.type !== "none" && !auth.value) {
|
|
82
|
+
return { ok: false, error: `auth ${auth.type} is missing; source=${auth.source}` };
|
|
83
|
+
}
|
|
84
|
+
if (manifest.value.transport !== "http") {
|
|
85
|
+
return {
|
|
86
|
+
ok: false,
|
|
87
|
+
error: `transport ${manifest.value.transport} is reserved; Phase 7.15 only connects Local HTTP.`
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (!manifest.value.baseUrl) {
|
|
91
|
+
return { ok: false, error: "HTTP connector requires baseUrl." };
|
|
92
|
+
}
|
|
93
|
+
const remote = await fetchConnectorJson(
|
|
94
|
+
manifest.value.baseUrl,
|
|
95
|
+
"/linghun/capabilities",
|
|
96
|
+
"GET",
|
|
97
|
+
auth
|
|
98
|
+
);
|
|
99
|
+
if (!remote.ok) return { ok: false, error: remote.error };
|
|
100
|
+
const remoteCapabilities = parseRemoteCapabilities(remote.value, manifest.value);
|
|
101
|
+
if (!remoteCapabilities.ok) return { ok: false, error: remoteCapabilities.error };
|
|
102
|
+
const merged = mergeCapabilities(manifest.value.capabilities, remoteCapabilities.value);
|
|
103
|
+
const state = {
|
|
104
|
+
appId: manifest.value.appId,
|
|
105
|
+
name: manifest.value.name,
|
|
106
|
+
version: manifest.value.version,
|
|
107
|
+
manifestPath: localManifestPath.value,
|
|
108
|
+
transport: manifest.value.transport,
|
|
109
|
+
baseUrl: manifest.value.baseUrl,
|
|
110
|
+
auth: { type: auth.type, source: auth.source },
|
|
111
|
+
status: "connected",
|
|
112
|
+
capabilityIds: merged.map((item) => item.id),
|
|
113
|
+
connectedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
114
|
+
};
|
|
115
|
+
disconnectAppConnector(manifest.value.appId, context);
|
|
116
|
+
for (const capability of merged) {
|
|
117
|
+
registerCapability(
|
|
118
|
+
{
|
|
119
|
+
...capability,
|
|
120
|
+
appId: manifest.value.appId,
|
|
121
|
+
transport: "http",
|
|
122
|
+
auth: manifest.value.auth.type
|
|
123
|
+
},
|
|
124
|
+
{ projectPath: context.projectPath }
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
const runtime = getRuntimeState(context);
|
|
128
|
+
runtime.apps.set(manifest.value.appId, state);
|
|
129
|
+
runtime.authConfigs.set(manifest.value.appId, manifest.value.auth);
|
|
130
|
+
return { ok: true, state, capabilityCount: state.capabilityIds.length };
|
|
131
|
+
}
|
|
132
|
+
function disconnectAppConnector(appId, context) {
|
|
133
|
+
const state = getRuntimeState(context);
|
|
134
|
+
const existed = state.apps.delete(appId);
|
|
135
|
+
state.authConfigs.delete(appId);
|
|
136
|
+
unregisterCapabilitiesByApp(appId, { projectPath: context.projectPath });
|
|
137
|
+
return existed;
|
|
138
|
+
}
|
|
139
|
+
function formatAppConnectorList(context) {
|
|
140
|
+
const apps = listAppConnectors(context);
|
|
141
|
+
if (apps.length === 0) return "Apps\n- \u5C1A\u672A\u8FDE\u63A5 app\u3002";
|
|
142
|
+
return ["Apps", ...apps.map((app) => formatAppSummary(app))].join("\n");
|
|
143
|
+
}
|
|
144
|
+
function formatAppConnectorDoctor(context, language = "zh-CN") {
|
|
145
|
+
const apps = listAppConnectors(context);
|
|
146
|
+
const isEn = language === "en-US";
|
|
147
|
+
if (apps.length === 0) {
|
|
148
|
+
return isEn ? "Apps doctor\n- No app connected." : "Apps doctor\n- \u5C1A\u672A\u8FDE\u63A5 app\u3002";
|
|
149
|
+
}
|
|
150
|
+
return [
|
|
151
|
+
"Apps doctor",
|
|
152
|
+
...apps.map(
|
|
153
|
+
(app) => `- ${sanitizeConnectorText(app.name)}: ${app.status}; transport=${app.transport}; auth=${app.auth.type}; authSource=${app.auth.source}; capabilities=${app.capabilityIds.length}`
|
|
154
|
+
),
|
|
155
|
+
"",
|
|
156
|
+
"Details",
|
|
157
|
+
...apps.map(
|
|
158
|
+
(app) => `- appId=${sanitizeConnectorText(app.appId)}; baseUrl=${redactBaseUrl(app.baseUrl)}; capabilities=${sanitizeConnectorText(app.capabilityIds.join(", "))}`
|
|
159
|
+
)
|
|
160
|
+
].join("\n");
|
|
161
|
+
}
|
|
162
|
+
async function handleAppsCommand(args, context, output) {
|
|
163
|
+
const action = args[0] ?? "list";
|
|
164
|
+
if (action === "list") {
|
|
165
|
+
showCommandPanel(context, output, {
|
|
166
|
+
title: "/apps",
|
|
167
|
+
tone: "neutral",
|
|
168
|
+
summary: formatAppConnectorList(context).split("\n"),
|
|
169
|
+
actions: [
|
|
170
|
+
"/apps validate <manifestPath>",
|
|
171
|
+
"/apps connect <manifestPath>",
|
|
172
|
+
"/apps test-run <manifestPath> <capabilityId> <json>",
|
|
173
|
+
"/apps doctor",
|
|
174
|
+
"/apps disconnect <appId>"
|
|
175
|
+
],
|
|
176
|
+
detailsText: formatAppConnectorList(context)
|
|
177
|
+
});
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (action === "doctor") {
|
|
181
|
+
const body = formatAppConnectorDoctor(context, context.language);
|
|
182
|
+
showCommandPanel(context, output, {
|
|
183
|
+
title: "/apps doctor",
|
|
184
|
+
tone: "neutral",
|
|
185
|
+
summary: body.split("\n").filter((line) => line && line !== "Details" && !line.startsWith("- appId=")),
|
|
186
|
+
actions: [
|
|
187
|
+
"/apps list",
|
|
188
|
+
"/apps validate <manifestPath>",
|
|
189
|
+
"/apps test-run <manifestPath> <capabilityId> <json>",
|
|
190
|
+
"/apps disconnect <appId>"
|
|
191
|
+
],
|
|
192
|
+
detailsText: body
|
|
193
|
+
});
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (action === "validate") {
|
|
197
|
+
const manifestPath = args.slice(1).join(" ");
|
|
198
|
+
if (!manifestPath) {
|
|
199
|
+
writeLine(output, usageText("validate", context.language));
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const result = await validateAppConnectorManifest(manifestPath, context);
|
|
203
|
+
const formatted = formatAppConnectorValidation(result, context.language);
|
|
204
|
+
showCommandPanel(context, output, {
|
|
205
|
+
title: "/apps validate",
|
|
206
|
+
tone: result.ok ? "neutral" : "warning",
|
|
207
|
+
summary: formatted.summary,
|
|
208
|
+
actions: [
|
|
209
|
+
"/apps connect <manifestPath>",
|
|
210
|
+
"/apps test-run <manifestPath> <capabilityId> <json>"
|
|
211
|
+
],
|
|
212
|
+
detailsText: formatted.detailsText
|
|
213
|
+
});
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (action === "connect") {
|
|
217
|
+
const manifestPath = args.slice(1).join(" ");
|
|
218
|
+
if (!manifestPath) {
|
|
219
|
+
writeLine(output, "\u7528\u6CD5\uFF1A/apps connect <manifestPath>");
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const result = await connectAppConnector(manifestPath, context);
|
|
223
|
+
if (!result.ok) {
|
|
224
|
+
writeLine(output, `App connect \u5931\u8D25\uFF1A${sanitizeConnectorText(result.error)}`);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
writeLine(
|
|
228
|
+
output,
|
|
229
|
+
`\u5DF2\u8FDE\u63A5 ${sanitizeConnectorText(result.state.name)}\uFF1B\u6CE8\u518C capability ${result.capabilityCount} \u4E2A\uFF1B\u5199\u5165/\u5916\u90E8 app \u64CD\u4F5C\u4F1A\u8D70\u6743\u9650\u786E\u8BA4\u3002`
|
|
230
|
+
);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (action === "test-run") {
|
|
234
|
+
const manifestPath = args[1];
|
|
235
|
+
const capabilityId = args[2];
|
|
236
|
+
const json = args.slice(3).join(" ");
|
|
237
|
+
if (!manifestPath || !capabilityId || !json) {
|
|
238
|
+
writeLine(output, usageText("test-run", context.language));
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const parsed = parseJsonInput(json);
|
|
242
|
+
if (!parsed.ok) {
|
|
243
|
+
writeLine(
|
|
244
|
+
output,
|
|
245
|
+
localizedLine(
|
|
246
|
+
context.language,
|
|
247
|
+
"App test-run input JSON invalid",
|
|
248
|
+
"App test-run input JSON \u65E0\u6548",
|
|
249
|
+
parsed.error
|
|
250
|
+
)
|
|
251
|
+
);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const connection = await connectAppConnector(manifestPath, context);
|
|
255
|
+
if (!connection.ok) {
|
|
256
|
+
writeLine(
|
|
257
|
+
output,
|
|
258
|
+
localizedLine(
|
|
259
|
+
context.language,
|
|
260
|
+
"App test-run connect failed",
|
|
261
|
+
"App test-run \u8FDE\u63A5\u5931\u8D25",
|
|
262
|
+
sanitizeConnectorText(connection.error)
|
|
263
|
+
)
|
|
264
|
+
);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
const definition = connection.state.capabilityIds.includes(capabilityId);
|
|
268
|
+
if (!definition) {
|
|
269
|
+
writeLine(
|
|
270
|
+
output,
|
|
271
|
+
localizedLine(
|
|
272
|
+
context.language,
|
|
273
|
+
"App test-run capability not found",
|
|
274
|
+
"App test-run \u672A\u627E\u5230 capability",
|
|
275
|
+
sanitizeConnectorText(capabilityId)
|
|
276
|
+
)
|
|
277
|
+
);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const result = await executeCapability(
|
|
281
|
+
{ capabilityId, input: parsed.value, source: "slash" },
|
|
282
|
+
context
|
|
283
|
+
);
|
|
284
|
+
const lines = context.language === "en-US" ? [
|
|
285
|
+
`Connected ${sanitizeConnectorText(connection.state.name)} and executed ${sanitizeConnectorText(capabilityId)}.`,
|
|
286
|
+
`Result: ${result.ok ? "ok" : "failed"}.`,
|
|
287
|
+
`Summary: ${sanitizeConnectorText(result.summary)}`,
|
|
288
|
+
"The app remains connected for follow-up /capabilities run or /apps disconnect."
|
|
289
|
+
] : [
|
|
290
|
+
`\u5DF2\u8FDE\u63A5 ${sanitizeConnectorText(connection.state.name)} \u5E76\u6267\u884C ${sanitizeConnectorText(capabilityId)}\u3002`,
|
|
291
|
+
`\u7ED3\u679C\uFF1A${result.ok ? "ok" : "failed"}\u3002`,
|
|
292
|
+
`\u6458\u8981\uFF1A${sanitizeConnectorText(result.summary)}`,
|
|
293
|
+
"app \u4FDD\u6301 connected\uFF0C\u53EF\u7EE7\u7EED /capabilities run \u6216 /apps disconnect\u3002"
|
|
294
|
+
];
|
|
295
|
+
showCommandPanel(context, output, {
|
|
296
|
+
title: "/apps test-run",
|
|
297
|
+
tone: result.ok ? "neutral" : "warning",
|
|
298
|
+
summary: lines,
|
|
299
|
+
actions: ["/capabilities run <capabilityId> <json>", "/apps disconnect <appId>"],
|
|
300
|
+
detailsText: [
|
|
301
|
+
...lines,
|
|
302
|
+
"",
|
|
303
|
+
`details: ${sanitizeConnectorText(result.details ?? "none")}`,
|
|
304
|
+
result.artifactRef ? `artifactRef: ${sanitizeConnectorText(result.artifactRef)}` : void 0,
|
|
305
|
+
result.previewRef ? `previewRef: ${sanitizeConnectorText(result.previewRef)}` : void 0,
|
|
306
|
+
result.rollbackRef ? `rollbackRef: ${sanitizeConnectorText(result.rollbackRef)}` : void 0
|
|
307
|
+
].filter((line) => Boolean(line)).join("\n")
|
|
308
|
+
});
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
if (action === "disconnect") {
|
|
312
|
+
const appId = args[1];
|
|
313
|
+
if (!appId) {
|
|
314
|
+
writeLine(output, "\u7528\u6CD5\uFF1A/apps disconnect <appId>");
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
const removed = disconnectAppConnector(appId, context);
|
|
318
|
+
writeLine(output, removed ? `\u5DF2\u65AD\u5F00 ${appId}\u3002` : `\u672A\u627E\u5230\u5DF2\u8FDE\u63A5 app\uFF1A${appId}`);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
writeLine(
|
|
322
|
+
output,
|
|
323
|
+
context.language === "en-US" ? "Usage: /apps list | /apps validate <manifestPath> | /apps connect <manifestPath> | /apps test-run <manifestPath> <capabilityId> <json> | /apps doctor | /apps disconnect <appId>" : "\u7528\u6CD5\uFF1A/apps list | /apps validate <manifestPath> | /apps connect <manifestPath> | /apps test-run <manifestPath> <capabilityId> <json> | /apps doctor | /apps disconnect <appId>"
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
function formatAppConnectorValidation(result, language) {
|
|
327
|
+
if (!result.ok) {
|
|
328
|
+
const line = language === "en-US" ? `Manifest validation failed: ${sanitizeConnectorText(result.error)}` : `Manifest \u6821\u9A8C\u5931\u8D25\uFF1A${sanitizeConnectorText(result.error)}`;
|
|
329
|
+
return { summary: [line], detailsText: line };
|
|
330
|
+
}
|
|
331
|
+
const warningLines = result.warnings.map(
|
|
332
|
+
(warning) => language === "en-US" ? `warning: ${sanitizeConnectorText(warning)}` : `\u8B66\u544A\uFF1A${sanitizeConnectorText(warning)}`
|
|
333
|
+
);
|
|
334
|
+
const summary = language === "en-US" ? [
|
|
335
|
+
`Manifest valid: ${sanitizeConnectorText(result.name)} (${sanitizeConnectorText(result.appId)}).`,
|
|
336
|
+
`transport=${result.transport}; capabilities=${result.capabilityCount}`,
|
|
337
|
+
...warningLines
|
|
338
|
+
] : [
|
|
339
|
+
`Manifest \u6709\u6548\uFF1A${sanitizeConnectorText(result.name)}\uFF08${sanitizeConnectorText(result.appId)}\uFF09\u3002`,
|
|
340
|
+
`transport=${result.transport}\uFF1Bcapabilities=${result.capabilityCount}`,
|
|
341
|
+
...warningLines
|
|
342
|
+
];
|
|
343
|
+
const details = [
|
|
344
|
+
...summary,
|
|
345
|
+
"",
|
|
346
|
+
`manifestPath=${sanitizeConnectorText(result.manifestPath)}`,
|
|
347
|
+
`version=${sanitizeConnectorText(result.version)}`,
|
|
348
|
+
`baseUrl=${redactBaseUrl(result.baseUrl)}`,
|
|
349
|
+
`capabilityIds=${sanitizeConnectorText(result.capabilityIds.join(", "))}`
|
|
350
|
+
];
|
|
351
|
+
return { summary, detailsText: details.join("\n") };
|
|
352
|
+
}
|
|
353
|
+
function usageText(action, language) {
|
|
354
|
+
if (action === "validate") {
|
|
355
|
+
return language === "en-US" ? "Usage: /apps validate <manifestPath>" : "\u7528\u6CD5\uFF1A/apps validate <manifestPath>";
|
|
356
|
+
}
|
|
357
|
+
return language === "en-US" ? "Usage: /apps test-run <manifestPath> <capabilityId> <json>" : "\u7528\u6CD5\uFF1A/apps test-run <manifestPath> <capabilityId> <json>";
|
|
358
|
+
}
|
|
359
|
+
function parseJsonInput(json) {
|
|
360
|
+
try {
|
|
361
|
+
const parsed = JSON.parse(json);
|
|
362
|
+
if (!isRecord(parsed)) return { ok: false, error: "input must be a JSON object." };
|
|
363
|
+
return { ok: true, value: parsed };
|
|
364
|
+
} catch (error) {
|
|
365
|
+
return { ok: false, error: formatUnknownError(error) };
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function localizedLine(language, enPrefix, zhPrefix, detail) {
|
|
369
|
+
return language === "en-US" ? `${enPrefix}: ${sanitizeConnectorText(detail)}` : `${zhPrefix}\uFF1A${sanitizeConnectorText(detail)}`;
|
|
370
|
+
}
|
|
371
|
+
function resolveProjectLocalManifestPath(manifestPath, context) {
|
|
372
|
+
const projectRoot = resolve(context.projectPath);
|
|
373
|
+
const resolved = resolve(projectRoot, manifestPath);
|
|
374
|
+
const rel = relative(projectRoot, resolved);
|
|
375
|
+
if (rel === "" || rel.startsWith("..") || resolve(rel) === rel) {
|
|
376
|
+
return { ok: false, error: "connector manifest must be inside the current project." };
|
|
377
|
+
}
|
|
378
|
+
return { ok: true, value: resolved };
|
|
379
|
+
}
|
|
380
|
+
async function readConnectorManifest(manifestPath) {
|
|
381
|
+
let raw = "";
|
|
382
|
+
try {
|
|
383
|
+
raw = await readFile(manifestPath, "utf8");
|
|
384
|
+
} catch (error) {
|
|
385
|
+
return { ok: false, error: `cannot read manifest: ${formatUnknownError(error)}` };
|
|
386
|
+
}
|
|
387
|
+
let parsed;
|
|
388
|
+
try {
|
|
389
|
+
parsed = JSON.parse(raw);
|
|
390
|
+
} catch (error) {
|
|
391
|
+
return { ok: false, error: `manifest JSON invalid: ${formatUnknownError(error)}` };
|
|
392
|
+
}
|
|
393
|
+
return parseConnectorManifest(parsed);
|
|
394
|
+
}
|
|
395
|
+
function parseConnectorManifest(input) {
|
|
396
|
+
if (!isRecord(input)) return { ok: false, error: "manifest must be an object." };
|
|
397
|
+
const appId = readNonEmptyString(input, "appId");
|
|
398
|
+
const name = readNonEmptyString(input, "name");
|
|
399
|
+
const version = readNonEmptyString(input, "version");
|
|
400
|
+
const transport = readNonEmptyString(input, "transport");
|
|
401
|
+
const auth = parseAuthConfig(input.auth);
|
|
402
|
+
if (!appId.ok) return appId;
|
|
403
|
+
if (!name.ok) return name;
|
|
404
|
+
if (!version.ok) return version;
|
|
405
|
+
if (!transport.ok) return transport;
|
|
406
|
+
if (!isCapabilityTransport(transport.value)) return { ok: false, error: "transport is invalid." };
|
|
407
|
+
if (!auth.ok) return auth;
|
|
408
|
+
const baseUrl = input.baseUrl === void 0 ? void 0 : readNonEmptyString(input, "baseUrl");
|
|
409
|
+
if (baseUrl && !baseUrl.ok) return baseUrl;
|
|
410
|
+
if (!Array.isArray(input.capabilities)) {
|
|
411
|
+
return { ok: false, error: "capabilities must be an array." };
|
|
412
|
+
}
|
|
413
|
+
const capabilities = [];
|
|
414
|
+
for (const item of input.capabilities) {
|
|
415
|
+
const parsed = parseCapabilityDefinition(item, appId.value, transport.value, auth.value.type);
|
|
416
|
+
if (!parsed.ok) return parsed;
|
|
417
|
+
capabilities.push(parsed.value);
|
|
418
|
+
}
|
|
419
|
+
if (capabilities.length === 0) {
|
|
420
|
+
return { ok: false, error: "capabilities must contain at least one capability." };
|
|
421
|
+
}
|
|
422
|
+
return {
|
|
423
|
+
ok: true,
|
|
424
|
+
value: {
|
|
425
|
+
appId: appId.value,
|
|
426
|
+
name: name.value,
|
|
427
|
+
version: version.value,
|
|
428
|
+
transport: transport.value,
|
|
429
|
+
baseUrl: baseUrl?.value,
|
|
430
|
+
auth: auth.value,
|
|
431
|
+
capabilities
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
function parseAuthConfig(input) {
|
|
436
|
+
if (!isRecord(input)) return { ok: false, error: "auth must be an object." };
|
|
437
|
+
const type = input.type;
|
|
438
|
+
if (type === "none") return { ok: true, value: { type } };
|
|
439
|
+
if (type !== "api_key" && type !== "local_token") {
|
|
440
|
+
return { ok: false, error: "auth.type is invalid." };
|
|
441
|
+
}
|
|
442
|
+
const config = { type };
|
|
443
|
+
for (const key of ["env", "projectConfigRef", "userConfigRef", "valueRef"]) {
|
|
444
|
+
const value = input[key];
|
|
445
|
+
if (value === void 0) continue;
|
|
446
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
447
|
+
return { ok: false, error: `auth.${key} must be a non-empty string.` };
|
|
448
|
+
}
|
|
449
|
+
config[key] = value.trim();
|
|
450
|
+
}
|
|
451
|
+
if (looksLikeRawSecret(input.value)) {
|
|
452
|
+
return {
|
|
453
|
+
ok: false,
|
|
454
|
+
error: "auth.value is not allowed; use env/projectConfigRef/userConfigRef."
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
return { ok: true, value: config };
|
|
458
|
+
}
|
|
459
|
+
function parseCapabilityDefinition(input, appId, transport, auth) {
|
|
460
|
+
if (!isRecord(input)) return { ok: false, error: "capability must be an object." };
|
|
461
|
+
const id = readNonEmptyString(input, "id");
|
|
462
|
+
const title = readNonEmptyString(input, "title");
|
|
463
|
+
const description = readNonEmptyString(input, "description");
|
|
464
|
+
const category = readNonEmptyString(input, "category");
|
|
465
|
+
const permission = input.permission;
|
|
466
|
+
const riskLevel = input.riskLevel;
|
|
467
|
+
if (!id.ok) return id;
|
|
468
|
+
if (!title.ok) return title;
|
|
469
|
+
if (!description.ok) return description;
|
|
470
|
+
if (!category.ok) return category;
|
|
471
|
+
if (!isCapabilityPermission(permission))
|
|
472
|
+
return { ok: false, error: "capability.permission is invalid." };
|
|
473
|
+
if (riskLevel !== "low" && riskLevel !== "medium" && riskLevel !== "high") {
|
|
474
|
+
return { ok: false, error: "capability.riskLevel is invalid." };
|
|
475
|
+
}
|
|
476
|
+
return {
|
|
477
|
+
ok: true,
|
|
478
|
+
value: {
|
|
479
|
+
id: id.value,
|
|
480
|
+
appId,
|
|
481
|
+
title: title.value,
|
|
482
|
+
description: description.value,
|
|
483
|
+
category: category.value,
|
|
484
|
+
intents: readStringArray(input.intents),
|
|
485
|
+
keywords: readStringArray(input.keywords),
|
|
486
|
+
transport,
|
|
487
|
+
auth,
|
|
488
|
+
permission,
|
|
489
|
+
riskLevel,
|
|
490
|
+
inputSchema: isRecord(input.inputSchema) ? input.inputSchema : { type: "object" },
|
|
491
|
+
outputSchema: isRecord(input.outputSchema) ? input.outputSchema : { type: "object" },
|
|
492
|
+
supportsRollback: input.supportsRollback === true,
|
|
493
|
+
supportsPreview: input.supportsPreview === true
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
function resolveConnectorAuth(auth, context) {
|
|
498
|
+
if (auth.type === "none") return { type: "none", source: "none" };
|
|
499
|
+
if (auth.env) {
|
|
500
|
+
const value = process.env[auth.env];
|
|
501
|
+
if (value) return { type: auth.type, source: "shell-env", value };
|
|
502
|
+
}
|
|
503
|
+
if (auth.projectConfigRef) {
|
|
504
|
+
const value = readConfigRef(context.config, auth.projectConfigRef);
|
|
505
|
+
if (value) return { type: auth.type, source: "project-config-ref", value };
|
|
506
|
+
}
|
|
507
|
+
if (auth.userConfigRef) {
|
|
508
|
+
const value = readConfigRef(context.config, auth.userConfigRef);
|
|
509
|
+
if (value) return { type: auth.type, source: "user-config-ref", value };
|
|
510
|
+
}
|
|
511
|
+
if (auth.valueRef) {
|
|
512
|
+
const value = readValueRef(auth.valueRef, context);
|
|
513
|
+
if (value) return { type: auth.type, source: "manifest-ref", value };
|
|
514
|
+
}
|
|
515
|
+
return { type: auth.type, source: "missing" };
|
|
516
|
+
}
|
|
517
|
+
function readValueRef(ref, context) {
|
|
518
|
+
if (ref.startsWith("env:")) {
|
|
519
|
+
return process.env[ref.slice("env:".length)];
|
|
520
|
+
}
|
|
521
|
+
if (ref.startsWith("settings.")) {
|
|
522
|
+
return readConfigRef(context.config, ref);
|
|
523
|
+
}
|
|
524
|
+
return void 0;
|
|
525
|
+
}
|
|
526
|
+
function readConfigRef(config, ref) {
|
|
527
|
+
if (!ref.startsWith("settings.")) return void 0;
|
|
528
|
+
let cursor = config;
|
|
529
|
+
for (const part of ref.slice("settings.".length).split(".")) {
|
|
530
|
+
if (!isRecord(cursor)) return void 0;
|
|
531
|
+
cursor = cursor[part];
|
|
532
|
+
}
|
|
533
|
+
return typeof cursor === "string" && cursor ? cursor : void 0;
|
|
534
|
+
}
|
|
535
|
+
async function fetchConnectorJson(baseUrl, path, method, auth, body) {
|
|
536
|
+
const url = buildConnectorUrl(baseUrl, path);
|
|
537
|
+
if (!url.ok) return url;
|
|
538
|
+
const controller = new AbortController();
|
|
539
|
+
const timeout = setTimeout(() => controller.abort(), HTTP_TIMEOUT_MS);
|
|
540
|
+
try {
|
|
541
|
+
const headers = { accept: "application/json" };
|
|
542
|
+
if (method === "POST") headers["content-type"] = "application/json";
|
|
543
|
+
if (auth.value) headers.authorization = `Bearer ${auth.value}`;
|
|
544
|
+
const response = await fetch(url.value, {
|
|
545
|
+
method,
|
|
546
|
+
headers,
|
|
547
|
+
body: body === void 0 ? void 0 : JSON.stringify(body),
|
|
548
|
+
signal: controller.signal
|
|
549
|
+
});
|
|
550
|
+
const text = await response.text();
|
|
551
|
+
if (!response.ok) {
|
|
552
|
+
return {
|
|
553
|
+
ok: false,
|
|
554
|
+
error: `HTTP ${response.status} from connector ${safeUrlLabel(url.value)}`
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
try {
|
|
558
|
+
return { ok: true, value: text ? JSON.parse(text) : {} };
|
|
559
|
+
} catch {
|
|
560
|
+
return { ok: false, error: "connector response is not valid JSON." };
|
|
561
|
+
}
|
|
562
|
+
} catch (error) {
|
|
563
|
+
return { ok: false, error: `connector unreachable: ${formatUnknownError(error)}` };
|
|
564
|
+
} finally {
|
|
565
|
+
clearTimeout(timeout);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function buildConnectorUrl(baseUrl, path) {
|
|
569
|
+
let url;
|
|
570
|
+
try {
|
|
571
|
+
url = new URL(baseUrl);
|
|
572
|
+
} catch {
|
|
573
|
+
return { ok: false, error: "baseUrl is invalid." };
|
|
574
|
+
}
|
|
575
|
+
if (url.protocol !== "http:") {
|
|
576
|
+
return { ok: false, error: "Phase 7.15 Local HTTP connector only supports http:// baseUrl." };
|
|
577
|
+
}
|
|
578
|
+
if (url.username || url.password) {
|
|
579
|
+
return { ok: false, error: "baseUrl must not contain username/password." };
|
|
580
|
+
}
|
|
581
|
+
if (!isLocalHost(url.hostname)) {
|
|
582
|
+
return { ok: false, error: "Local HTTP connector requires localhost/127.0.0.1/[::1]." };
|
|
583
|
+
}
|
|
584
|
+
url.pathname = `${url.pathname.replace(/\/$/, "")}${path}`;
|
|
585
|
+
url.search = "";
|
|
586
|
+
url.hash = "";
|
|
587
|
+
return { ok: true, value: url.toString() };
|
|
588
|
+
}
|
|
589
|
+
function parseRemoteCapabilities(input, manifest) {
|
|
590
|
+
const raw = isRecord(input) && Array.isArray(input.capabilities) ? input.capabilities : input;
|
|
591
|
+
if (!Array.isArray(raw)) return { ok: false, error: "remote capabilities response is invalid." };
|
|
592
|
+
const capabilities = [];
|
|
593
|
+
for (const item of raw) {
|
|
594
|
+
const parsed = parseCapabilityDefinition(item, manifest.appId, "http", manifest.auth.type);
|
|
595
|
+
if (!parsed.ok) return parsed;
|
|
596
|
+
capabilities.push(parsed.value);
|
|
597
|
+
}
|
|
598
|
+
return { ok: true, value: capabilities };
|
|
599
|
+
}
|
|
600
|
+
function mergeCapabilities(manifestCapabilities, remoteCapabilities) {
|
|
601
|
+
const byId = /* @__PURE__ */ new Map();
|
|
602
|
+
for (const capability of manifestCapabilities) byId.set(capability.id, capability);
|
|
603
|
+
for (const capability of remoteCapabilities) {
|
|
604
|
+
byId.set(capability.id, { ...byId.get(capability.id), ...capability });
|
|
605
|
+
}
|
|
606
|
+
return [...byId.values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
607
|
+
}
|
|
608
|
+
function findDuplicateCapabilityIds(capabilities) {
|
|
609
|
+
const seen = /* @__PURE__ */ new Set();
|
|
610
|
+
const duplicate = /* @__PURE__ */ new Set();
|
|
611
|
+
for (const capability of capabilities) {
|
|
612
|
+
if (seen.has(capability.id)) {
|
|
613
|
+
duplicate.add(capability.id);
|
|
614
|
+
continue;
|
|
615
|
+
}
|
|
616
|
+
seen.add(capability.id);
|
|
617
|
+
}
|
|
618
|
+
return [...duplicate].sort((a, b) => a.localeCompare(b));
|
|
619
|
+
}
|
|
620
|
+
async function executeHttpCapability(definition, request, context) {
|
|
621
|
+
const app = getRuntimeState(context).apps.get(definition.appId);
|
|
622
|
+
if (!app || app.status !== "connected" || !app.baseUrl) {
|
|
623
|
+
return buildConnectorExecutionResult(definition, "Connector is not connected.", false);
|
|
624
|
+
}
|
|
625
|
+
const auth = resolveConnectorAuthForState(app, context);
|
|
626
|
+
if (auth.type !== "none" && !auth.value) {
|
|
627
|
+
return buildConnectorExecutionResult(
|
|
628
|
+
definition,
|
|
629
|
+
`Connector auth missing; source=${auth.source}.`,
|
|
630
|
+
false
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
const response = await fetchConnectorJson(app.baseUrl, "/linghun/execute", "POST", auth, {
|
|
634
|
+
capabilityId: definition.id,
|
|
635
|
+
input: request.input,
|
|
636
|
+
metadata: {
|
|
637
|
+
requestId: randomUUID(),
|
|
638
|
+
source: request.source,
|
|
639
|
+
appId: definition.appId
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
if (!response.ok) return buildConnectorExecutionResult(definition, response.error, false);
|
|
643
|
+
return normalizeHttpExecutionResult(definition, response.value, context);
|
|
644
|
+
}
|
|
645
|
+
function resolveConnectorAuthForState(app, context) {
|
|
646
|
+
if (app.auth.type === "none") return { type: "none", source: "none" };
|
|
647
|
+
const manifestAuth = getRuntimeState(context).authConfigs.get(app.appId);
|
|
648
|
+
return resolveConnectorAuth(manifestAuth ?? { type: app.auth.type }, context);
|
|
649
|
+
}
|
|
650
|
+
async function normalizeHttpExecutionResult(definition, input, context) {
|
|
651
|
+
if (!isRecord(input)) {
|
|
652
|
+
return buildConnectorExecutionResult(
|
|
653
|
+
definition,
|
|
654
|
+
"Connector execute response is invalid.",
|
|
655
|
+
false
|
|
656
|
+
);
|
|
657
|
+
}
|
|
658
|
+
const ok = input.ok !== false;
|
|
659
|
+
const summary = typeof input.summary === "string" && input.summary.trim() ? truncateDisplay(sanitizeConnectorText(input.summary), 240) : ok ? "HTTP capability succeeded." : "HTTP capability failed.";
|
|
660
|
+
const sessionId = await ensureSession(context);
|
|
661
|
+
const artifactRef = await resolveConnectorArtifactRef(definition, input, context, sessionId);
|
|
662
|
+
return {
|
|
663
|
+
ok,
|
|
664
|
+
capabilityId: definition.id,
|
|
665
|
+
summary,
|
|
666
|
+
details: typeof input.details === "string" ? truncateDisplay(sanitizeConnectorText(input.details), 1e3) : "Connector response normalized; raw response omitted.",
|
|
667
|
+
artifactRef,
|
|
668
|
+
rollbackRef: typeof input.rollbackRef === "string" ? input.rollbackRef : void 0,
|
|
669
|
+
previewRef: typeof input.previewRef === "string" ? input.previewRef : void 0,
|
|
670
|
+
metadata: {
|
|
671
|
+
transport: definition.transport,
|
|
672
|
+
auth: definition.auth,
|
|
673
|
+
permission: definition.permission,
|
|
674
|
+
riskLevel: definition.riskLevel,
|
|
675
|
+
connectionStatus: "connected"
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
async function resolveConnectorArtifactRef(definition, response, context, sessionId) {
|
|
680
|
+
if (typeof response.artifactRef === "string" && response.artifactRef.trim()) {
|
|
681
|
+
return response.artifactRef;
|
|
682
|
+
}
|
|
683
|
+
const rawOutput = response.output ?? response.result ?? response.data;
|
|
684
|
+
if (rawOutput === void 0) return void 0;
|
|
685
|
+
const text = stringifyForBudget(rawOutput);
|
|
686
|
+
if (!text) return void 0;
|
|
687
|
+
const budgeted = await budgetToolResultTranscriptContent(
|
|
688
|
+
context,
|
|
689
|
+
sessionId,
|
|
690
|
+
`connector-${definition.id}`,
|
|
691
|
+
text
|
|
692
|
+
);
|
|
693
|
+
if (typeof budgeted !== "string" || !budgeted.startsWith("<persisted-tool-result>")) {
|
|
694
|
+
return void 0;
|
|
695
|
+
}
|
|
696
|
+
const artifact = context.evidence.find(
|
|
697
|
+
(item) => item.supportsClaims.includes(`toolUseId:connector-${definition.id}`)
|
|
698
|
+
);
|
|
699
|
+
return artifact?.fullOutputPath ?? artifact?.outputPath;
|
|
700
|
+
}
|
|
701
|
+
function buildConnectorExecutionResult(definition, summary, ok) {
|
|
702
|
+
return {
|
|
703
|
+
ok,
|
|
704
|
+
capabilityId: definition.id,
|
|
705
|
+
summary: sanitizeConnectorText(summary),
|
|
706
|
+
metadata: {
|
|
707
|
+
transport: definition.transport,
|
|
708
|
+
auth: definition.auth,
|
|
709
|
+
permission: definition.permission,
|
|
710
|
+
riskLevel: definition.riskLevel,
|
|
711
|
+
connectionStatus: ok ? "connected" : "not_connected"
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
function formatAppSummary(app) {
|
|
716
|
+
return `- ${sanitizeConnectorText(app.name)}: ${app.status}; transport=${app.transport}; capabilities=${app.capabilityIds.length}`;
|
|
717
|
+
}
|
|
718
|
+
function isRecord(input) {
|
|
719
|
+
return Boolean(input && typeof input === "object" && !Array.isArray(input));
|
|
720
|
+
}
|
|
721
|
+
function readNonEmptyString(input, key) {
|
|
722
|
+
const value = input[key];
|
|
723
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
724
|
+
return { ok: false, error: `${key} must be a non-empty string.` };
|
|
725
|
+
}
|
|
726
|
+
return { ok: true, value: value.trim() };
|
|
727
|
+
}
|
|
728
|
+
function readStringArray(input) {
|
|
729
|
+
if (!Array.isArray(input)) return [];
|
|
730
|
+
return input.filter((item) => typeof item === "string" && item.trim().length > 0);
|
|
731
|
+
}
|
|
732
|
+
function isCapabilityTransport(input) {
|
|
733
|
+
return input === "mock" || input === "mcp" || input === "plugin" || input === "desktop_bridge" || input === "http" || input === "websocket";
|
|
734
|
+
}
|
|
735
|
+
function isCapabilityPermission(input) {
|
|
736
|
+
return input === "read" || input === "write" || input === "bash" || input === "network" || input === "external_app";
|
|
737
|
+
}
|
|
738
|
+
function isLocalHost(hostname) {
|
|
739
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]";
|
|
740
|
+
}
|
|
741
|
+
function looksLikeRawSecret(input) {
|
|
742
|
+
return typeof input === "string" && input.trim().length > 0;
|
|
743
|
+
}
|
|
744
|
+
function stringifyForBudget(input) {
|
|
745
|
+
if (typeof input === "string") return input;
|
|
746
|
+
try {
|
|
747
|
+
return JSON.stringify(input);
|
|
748
|
+
} catch {
|
|
749
|
+
return void 0;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
function sanitizeConnectorText(input) {
|
|
753
|
+
return input.replace(
|
|
754
|
+
/(api[_-]?key|apiKey|token|Authorization)(\s*[:=]\s*)(Bearer\s+)?[^\s;&,)}\]]+/giu,
|
|
755
|
+
"$1$2***"
|
|
756
|
+
).replace(/Bearer\s+[A-Za-z0-9._~-]+/giu, "Bearer ***").replace(/sk-[A-Za-z0-9_-]+/gu, "sk-***");
|
|
757
|
+
}
|
|
758
|
+
function redactBaseUrl(baseUrl) {
|
|
759
|
+
if (!baseUrl) return "none";
|
|
760
|
+
const parsed = buildConnectorUrl(baseUrl, "");
|
|
761
|
+
if (!parsed.ok) return "invalid";
|
|
762
|
+
const url = new URL(parsed.value);
|
|
763
|
+
return `${url.protocol}//${url.hostname}${url.port ? `:${url.port}` : ""}/...`;
|
|
764
|
+
}
|
|
765
|
+
function safeUrlLabel(url) {
|
|
766
|
+
try {
|
|
767
|
+
const parsed = new URL(url);
|
|
768
|
+
return `${parsed.protocol}//${parsed.hostname}${parsed.port ? `:${parsed.port}` : ""}/${basename(parsed.pathname)}`;
|
|
769
|
+
} catch {
|
|
770
|
+
return "invalid-url";
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
function formatUnknownError(error) {
|
|
774
|
+
return error instanceof Error ? error.message : String(error);
|
|
775
|
+
}
|
|
776
|
+
registerCapabilityProvider({
|
|
777
|
+
transport: "http",
|
|
778
|
+
execute: executeHttpCapability
|
|
779
|
+
});
|
|
780
|
+
setCapabilityConnectionResolver((definition, context) => {
|
|
781
|
+
if (definition.transport !== "http" || !context) return void 0;
|
|
782
|
+
const app = getRuntimeState(context).apps.get(definition.appId);
|
|
783
|
+
if (!app) return void 0;
|
|
784
|
+
return {
|
|
785
|
+
capabilityId: definition.id,
|
|
786
|
+
transport: "http",
|
|
787
|
+
status: app.status === "connected" ? "connected" : "not_connected",
|
|
788
|
+
summary: app.status === "connected" ? `connected app ${app.name}` : "connector disconnected"
|
|
789
|
+
};
|
|
790
|
+
});
|
|
791
|
+
|
|
792
|
+
export {
|
|
793
|
+
listAppConnectors,
|
|
794
|
+
validateAppConnectorManifest,
|
|
795
|
+
connectAppConnector,
|
|
796
|
+
disconnectAppConnector,
|
|
797
|
+
formatAppConnectorList,
|
|
798
|
+
formatAppConnectorDoctor,
|
|
799
|
+
handleAppsCommand
|
|
800
|
+
};
|