@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,531 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatCooldownDoctorLine
|
|
3
|
+
} from "./chunk-EBACIBJP.js";
|
|
4
|
+
import {
|
|
5
|
+
formatProviderFailureKindLabel
|
|
6
|
+
} from "./chunk-OZMX3E35.js";
|
|
7
|
+
|
|
8
|
+
// src/model-doctor-runtime.ts
|
|
9
|
+
import { readFile } from "fs/promises";
|
|
10
|
+
import {
|
|
11
|
+
defaultConfig,
|
|
12
|
+
getProjectSettingsPath,
|
|
13
|
+
isDefaultPlaceholderModel,
|
|
14
|
+
lastProviderEnvMerge,
|
|
15
|
+
lastProviderEnvWarning,
|
|
16
|
+
readProviderEnvValues
|
|
17
|
+
} from "@linghun/config";
|
|
18
|
+
import {
|
|
19
|
+
resolveAnthropicContextEditingDiagnostic,
|
|
20
|
+
resolveEffectiveEndpointProfile,
|
|
21
|
+
resolveProviderBaseUrlDiagnostic,
|
|
22
|
+
resolveProviderRuntimeContract
|
|
23
|
+
} from "@linghun/providers";
|
|
24
|
+
import { normalizeDeepSeekModelName } from "@linghun/shared";
|
|
25
|
+
function maskSecret(secret) {
|
|
26
|
+
if (secret.length <= 8) return "****";
|
|
27
|
+
return `${secret.slice(0, 3)}\u2026${secret.slice(-4)}`;
|
|
28
|
+
}
|
|
29
|
+
function getProviderEnvKeyName(providerType) {
|
|
30
|
+
return providerType === "deepseek" ? "LINGHUN_DEEPSEEK_API_KEY" : "LINGHUN_OPENAI_API_KEY";
|
|
31
|
+
}
|
|
32
|
+
function getProviderKeySource(providerId, providerType, projectSettingsApiKeyProviders, providerEnvApiKeyProviders) {
|
|
33
|
+
const envName = getProviderEnvKeyName(providerType);
|
|
34
|
+
if (process.env[envName]) return "shell-env";
|
|
35
|
+
if (providerEnvApiKeyProviders.has(providerId)) {
|
|
36
|
+
return process.env.LINGHUN_CONFIG_DIR ? "config-dir-provider-env" : "user-provider-env";
|
|
37
|
+
}
|
|
38
|
+
if (projectSettingsApiKeyProviders.has(providerId)) return "project-settings-legacy";
|
|
39
|
+
return "merged-config";
|
|
40
|
+
}
|
|
41
|
+
async function readProjectSettingsApiKeyProviders(projectPath) {
|
|
42
|
+
try {
|
|
43
|
+
const raw = await readFile(getProjectSettingsPath(projectPath), "utf8");
|
|
44
|
+
const parsed = JSON.parse(raw);
|
|
45
|
+
return new Set(
|
|
46
|
+
Object.entries(parsed.providers ?? {}).filter(([, provider]) => typeof provider.apiKey === "string" && provider.apiKey.length > 0).map(([providerId]) => providerId)
|
|
47
|
+
);
|
|
48
|
+
} catch {
|
|
49
|
+
return /* @__PURE__ */ new Set();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function readProviderEnvApiKeyProviders() {
|
|
53
|
+
try {
|
|
54
|
+
const values = await readProviderEnvValues();
|
|
55
|
+
return /* @__PURE__ */ new Set([
|
|
56
|
+
...values.LINGHUN_OPENAI_API_KEY ? ["openai-compatible"] : [],
|
|
57
|
+
...values.LINGHUN_DEEPSEEK_API_KEY ? ["deepseek"] : []
|
|
58
|
+
]);
|
|
59
|
+
} catch {
|
|
60
|
+
return /* @__PURE__ */ new Set();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function isModelRole(value) {
|
|
64
|
+
return ["planner", "executor", "reviewer", "verifier", "summarizer", "vision", "image"].includes(
|
|
65
|
+
value
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function getRoleRoute(config, role) {
|
|
69
|
+
const route = config.modelRoutes.routes.find((item) => item.role === role);
|
|
70
|
+
if (route) {
|
|
71
|
+
return route;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
role,
|
|
75
|
+
provider: "",
|
|
76
|
+
primaryModel: "",
|
|
77
|
+
fallbackModels: [],
|
|
78
|
+
requiredCapabilities: ["text"],
|
|
79
|
+
allowTools: false,
|
|
80
|
+
allowWrite: false,
|
|
81
|
+
allowBash: false,
|
|
82
|
+
requireApprovalBeforeRun: true
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function isDefaultExecutorRoute(route, _config) {
|
|
86
|
+
const defaultExecutorRoute = defaultConfig.modelRoutes.routes.find((r) => r.role === "executor");
|
|
87
|
+
if (!defaultExecutorRoute) return false;
|
|
88
|
+
return route.provider === defaultExecutorRoute.provider && route.primaryModel === defaultExecutorRoute.primaryModel;
|
|
89
|
+
}
|
|
90
|
+
function formatModelRouteSummary(config) {
|
|
91
|
+
const routes = config.modelRoutes.routes.map(
|
|
92
|
+
(route) => `${route.role}:${route.provider || "unknown"}/${route.primaryModel || "unconfigured"}`
|
|
93
|
+
).slice(0, 4);
|
|
94
|
+
return `\u89D2\u8272\u8DEF\u7531\u6458\u8981\uFF1A${routes.length > 0 ? routes.join("\uFF1B") : "\u672A\u914D\u7F6E"}`;
|
|
95
|
+
}
|
|
96
|
+
function formatModelRoutes(config) {
|
|
97
|
+
return [
|
|
98
|
+
"Model routes\uFF08\u591A\u6A21\u578B\u6309\u89D2\u8272\u89E6\u53D1\uFF0C\u4E0D\u9ED8\u8BA4\u4E71\u5F00\uFF09",
|
|
99
|
+
...config.modelRoutes.routes.map(
|
|
100
|
+
(route) => [
|
|
101
|
+
`- ${route.role}: provider ${route.provider || "\u672A\u914D\u7F6E"}`,
|
|
102
|
+
`model ${route.primaryModel || "\u672A\u914D\u7F6E"}`,
|
|
103
|
+
`capabilities ${route.requiredCapabilities.join("+") || "none"}`,
|
|
104
|
+
`availability ${formatRouteAvailability(route)}`,
|
|
105
|
+
`tool route hint ${route.allowTools ? "yes" : "no"}`,
|
|
106
|
+
`write route hint ${route.allowWrite ? "yes" : "no"}`,
|
|
107
|
+
`bash route hint ${route.allowBash ? "yes" : "no"}`,
|
|
108
|
+
`budget ${route.maxCostCny === void 0 ? "unconfigured" : `estimated <= ${route.maxCostCny} CNY`}`
|
|
109
|
+
].join(" ")
|
|
110
|
+
),
|
|
111
|
+
"\u63D0\u793A\uFF1Aroute hint \u53EA\u662F\u5019\u9009\u80FD\u529B\u63D0\u793A\uFF0C\u6700\u7EC8\u5DE5\u5177\u6267\u884C\u4ECD\u7531\u6743\u9650\u6A21\u5F0F\u548C permission gate \u51B3\u5B9A\u3002",
|
|
112
|
+
"\u63D0\u793A\uFF1A/model route doctor \u8BCA\u65AD\u7F3A provider\u3001\u80FD\u529B\u4E0D\u8DB3\u548C\u9884\u7B97\u914D\u7F6E\u3002"
|
|
113
|
+
].join("\n");
|
|
114
|
+
}
|
|
115
|
+
function formatRouteAvailability(route) {
|
|
116
|
+
const capabilityText = route.requiredCapabilities.join("+") || "none";
|
|
117
|
+
if (!route.provider && !route.primaryModel) {
|
|
118
|
+
return route.requiredCapabilities.includes("vision") || route.requiredCapabilities.includes("image") ? `reserved/disabled (${capabilityText} provider/model \u672A\u914D\u7F6E\uFF1B\u4E0D\u662F\u53EF\u7528\u80FD\u529B)` : "unconfigured (provider/model \u672A\u914D\u7F6E)";
|
|
119
|
+
}
|
|
120
|
+
if (!route.provider || !route.primaryModel) {
|
|
121
|
+
return "unconfigured (provider \u6216 model \u7F3A\u5931)";
|
|
122
|
+
}
|
|
123
|
+
return "configured";
|
|
124
|
+
}
|
|
125
|
+
function collectReservedMultimodalRoutes(config) {
|
|
126
|
+
return config.modelRoutes.routes.filter(
|
|
127
|
+
(route) => (route.requiredCapabilities.includes("vision") || route.requiredCapabilities.includes("image")) && !route.provider && !route.primaryModel
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
function hasOpenAiCompatibleProviderSetupProblem(provider) {
|
|
131
|
+
return provider.type === "openai-compatible" && (!provider.baseUrl || !provider.apiKey || !provider.model || provider.model === "openai-compatible-model");
|
|
132
|
+
}
|
|
133
|
+
function hasOpenAiCompatibleDoctorProblem(config) {
|
|
134
|
+
const provider = config.providers["openai-compatible"];
|
|
135
|
+
return Boolean(
|
|
136
|
+
provider && (!provider.baseUrl || !provider.apiKey || !provider.model || provider.model === "openai-compatible-model")
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
function hasOpenAiCompatiblePlaceholderProblem(config) {
|
|
140
|
+
return config.providers["openai-compatible"]?.model === "openai-compatible-model";
|
|
141
|
+
}
|
|
142
|
+
function collectPlaceholderModelHits(config) {
|
|
143
|
+
const providers = [];
|
|
144
|
+
for (const [providerId, provider] of Object.entries(config.providers)) {
|
|
145
|
+
if (isDefaultPlaceholderModel(provider.model)) {
|
|
146
|
+
providers.push({ providerId, model: provider.model });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const routes = [];
|
|
150
|
+
for (const route of config.modelRoutes.routes) {
|
|
151
|
+
if (isDefaultPlaceholderModel(route.primaryModel)) {
|
|
152
|
+
routes.push({ role: route.role, field: "primary", model: route.primaryModel });
|
|
153
|
+
}
|
|
154
|
+
for (const fallbackModel of route.fallbackModels) {
|
|
155
|
+
if (isDefaultPlaceholderModel(fallbackModel)) {
|
|
156
|
+
routes.push({ role: route.role, field: "fallback", model: fallbackModel });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return { providers, routes };
|
|
161
|
+
}
|
|
162
|
+
async function formatModelRouteDoctor(context) {
|
|
163
|
+
const isEn = context.language === "en-US";
|
|
164
|
+
const lines = [isEn ? "Model route doctor" : "\u6A21\u578B\u8DEF\u7531\u8BCA\u65AD"];
|
|
165
|
+
const projectSettingsApiKeyProviders = await readProjectSettingsApiKeyProviders(
|
|
166
|
+
context.projectPath
|
|
167
|
+
);
|
|
168
|
+
const providerEnvApiKeyProviders = await readProviderEnvApiKeyProviders();
|
|
169
|
+
if (lastProviderEnvWarning) {
|
|
170
|
+
lines.push(
|
|
171
|
+
`WARN: provider.env \u8BFB\u53D6\u5931\u8D25\uFF1B\u8DEF\u5F84 ${lastProviderEnvWarning.path}\uFF1B\u539F\u56E0 ${lastProviderEnvWarning.reason}\uFF1B\u8BF7\u4FEE\u6B63\u540E\u91CD\u542F Linghun \u6216\u91CD\u65B0\u8FD0\u884C /model setup\u3002`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
if (lastProviderEnvMerge?.applied) {
|
|
175
|
+
const ids = lastProviderEnvMerge.providerIds;
|
|
176
|
+
lines.push(
|
|
177
|
+
`- provider.env merge: applied yes; overrode model routes ${lastProviderEnvMerge.overrodeModelRoutes ? "yes" : "no"}; overrode default model ${lastProviderEnvMerge.overrodeDefaultModel ? "yes" : "no"}; providers ${ids.length > 0 ? ids.join(",") : "none"} (provider.env / complete shell env can select the fresh-project default route; explicit project modelRoutes stay project-scoped. \u5B89\u5168\u63D0\u793A\uFF1Aprovider.env \u542B\u654F\u611F\u51ED\u636E\uFF0C\u4E0D\u8981 cat/type \u5230\u4E3B\u5C4F\u3001\u65E5\u5FD7\u6216\u62A5\u544A)`
|
|
178
|
+
);
|
|
179
|
+
} else if (lastProviderEnvMerge && !lastProviderEnvMerge.applied) {
|
|
180
|
+
lines.push(
|
|
181
|
+
"- provider.env merge: applied no (~/.linghun/provider.env \u672A\u8986\u76D6\u9879\u76EE settings\uFF1B\u5982\u9700\u5207\u6362 provider \u8BF7\u4F7F\u7528 /model setup)"
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
const placeholderHits = collectPlaceholderModelHits(context.config);
|
|
185
|
+
if (placeholderHits.providers.length > 0 || placeholderHits.routes.length > 0) {
|
|
186
|
+
const providerHits = placeholderHits.providers.map((hit) => `${hit.providerId} -> ${hit.model}`).join(",");
|
|
187
|
+
const routeHits = placeholderHits.routes.map((hit) => `${hit.role}.${hit.field} -> ${hit.model}`).join(",");
|
|
188
|
+
lines.push(
|
|
189
|
+
`- WARN placeholder model: providers=[${providerHits || "none"}] routes=[${routeHits || "none"}] (\u8FD9\u4E9B\u662F\u5360\u4F4D/\u672A\u6210\u719F\u6A21\u578B\u540D\uFF1Bsmoke \u524D\u8BF7\u7528 LINGHUN_DEEPSEEK_MODEL/LINGHUN_DEFAULT_MODEL \u66FF\u6362\u4E3A\u73B0\u5F79\u6A21\u578B\u540D\uFF0C\u4F8B\u5982 deepseek-chat/deepseek-reasoner)`
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
const reservedMultimodalRoutes = collectReservedMultimodalRoutes(context.config);
|
|
193
|
+
if (reservedMultimodalRoutes.length > 0) {
|
|
194
|
+
const roles = reservedMultimodalRoutes.map((route) => `${route.role}(${route.requiredCapabilities.join("+")})`).join(",");
|
|
195
|
+
lines.push(
|
|
196
|
+
`- reserved multimodal routes: ${roles} provider/model \u672A\u914D\u7F6E\uFF1Bstatus/doctor \u5C06\u5176\u6807\u8BB0\u4E3A reserved/disabled\uFF0C\u4E0D\u662F\u53EF\u7528\u80FD\u529B\u3002`
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
lines.push(
|
|
200
|
+
`- prompt cache: enabled ${context.config.promptCache.enabled ? "yes" : "no"}; system ttl ${context.config.promptCache.systemTtl} (5m \u9ED8\u8BA4 cache_control \u65E0 ttl \u5B57\u9762\u91CF\uFF1B1h \u624D\u663E\u5F0F\u5199 ttl)`
|
|
201
|
+
);
|
|
202
|
+
if (context.deferredToolsSummary) {
|
|
203
|
+
const summary = context.deferredToolsSummary;
|
|
204
|
+
lines.push(
|
|
205
|
+
`- deferred tools: total ${summary.total}; executable ${summary.executableCount}; codebase-memory ${summary.byKind["codebase-memory"]}; mcp ${summary.byKind.mcp}; skill ${summary.byKind.skill}; plugin ${summary.byKind.plugin} (SearchExtraTools/ExecuteExtraTool \u5165\u53E3\uFF1Bbuilt-in \u5DE5\u5177\u4E0D\u8D70\u8BE5\u6D3E\u53D1)`
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
if (context.discoveredDeferredToolsSummary) {
|
|
209
|
+
const ds = context.discoveredDeferredToolsSummary;
|
|
210
|
+
if (ds.total === 0) {
|
|
211
|
+
lines.push(
|
|
212
|
+
"- discoveredDeferredTools: 0 (\u672C session \u8FD8\u6CA1\u8FD0\u884C\u8FC7 SearchExtraTools\uFF1BExecuteExtraTool \u73B0\u5728\u4F1A\u5168\u90E8\u62D2\u7EDD\u3002\u8BF7\u5148 SearchExtraTools)"
|
|
213
|
+
);
|
|
214
|
+
} else {
|
|
215
|
+
const visible = ds.names.join(",");
|
|
216
|
+
const tail = ds.truncated ? `,\u2026+${ds.total - ds.names.length} more` : "";
|
|
217
|
+
lines.push(
|
|
218
|
+
`- discovered deferred tools: total ${ds.total}; names [${visible}${tail}] (\u672C session \u7ECF SearchExtraTools \u8BB0\u5F55\u8FC7\u7684\u5DE5\u5177\u540D\uFF1Bsession \u91CD\u542F\u5373\u6E05\u96F6)`
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
lines.push("- providers:");
|
|
223
|
+
for (const [providerId, provider] of Object.entries(context.config.providers)) {
|
|
224
|
+
const contract = resolveProviderRuntimeContract({ id: providerId, ...provider });
|
|
225
|
+
const endpointProfile = contract.endpointProfile;
|
|
226
|
+
const compatibilityProfile = contract.compatibilityProfile ?? provider.compatibilityProfile ?? (provider.type === "deepseek" ? "deepseek" : "strict_openai_compatible");
|
|
227
|
+
const reasoningLevel = provider.reasoningLevel;
|
|
228
|
+
const reasoningSentLocal = Boolean(
|
|
229
|
+
reasoningLevel && (endpointProfile === "responses" || endpointProfile === "anthropic_messages" || compatibilityProfile === "permissive_openai_compatible")
|
|
230
|
+
);
|
|
231
|
+
const reasoningPlain = !reasoningLevel ? context.language === "en-US" ? "Reasoning not configured" : "\u672A\u914D\u7F6E\u63A8\u7406\u7B49\u7EA7" : reasoningSentLocal ? context.language === "en-US" ? `Reasoning ${reasoningLevel} sent` : `\u63A8\u7406 ${reasoningLevel} \u5DF2\u53D1\u9001` : context.language === "en-US" ? `Reasoning ${reasoningLevel} not sent (gateway or model rejects it)` : `\u63A8\u7406 ${reasoningLevel} \u4E0D\u4F1A\u53D1\u9001\uFF08\u5F53\u524D\u7F51\u5173\u6216\u6A21\u578B\u4E0D\u63A5\u53D7\uFF09`;
|
|
232
|
+
const reasoningTechnical = reasoningLevel ? endpointProfile === "responses" ? `effective/sent reasoning.effort=${reasoningLevel}` : endpointProfile === "anthropic_messages" ? `effective/sent thinking.budget_tokens=${reasoningLevel === "Low" ? "1024" : reasoningLevel === "Medium" ? "4096" : reasoningLevel === "High" ? "8192" : reasoningLevel}` : compatibilityProfile === "permissive_openai_compatible" ? `effective/sent reasoning.effort=${reasoningLevel}` : `ignored/unsupported/\u672A\u751F\u6548 compatibility profile ${compatibilityProfile}` : "not configured/\u672A\u751F\u6548";
|
|
233
|
+
const reasoningStatus = `${reasoningTechnical} (${reasoningPlain})`;
|
|
234
|
+
const baseUrlDiagnostic = resolveProviderBaseUrlDiagnostic(
|
|
235
|
+
provider.baseUrl,
|
|
236
|
+
endpointProfile
|
|
237
|
+
);
|
|
238
|
+
const keySource = provider.apiKey ? getProviderKeySource(providerId, provider.type, projectSettingsApiKeyProviders, providerEnvApiKeyProviders) : void 0;
|
|
239
|
+
const decision = resolveEffectiveEndpointProfile({
|
|
240
|
+
requestEndpointProfile: void 0,
|
|
241
|
+
configEndpointProfile: provider.endpointProfile,
|
|
242
|
+
configBaseUrl: provider.baseUrl,
|
|
243
|
+
configModel: provider.model,
|
|
244
|
+
requestModel: void 0
|
|
245
|
+
});
|
|
246
|
+
lines.push(
|
|
247
|
+
` - ${providerId}: type ${provider.type}; provider ${providerId}; model ${provider.model || "missing"}; runtime profile ${contract.profile}; endpoint profile ${contract.endpointProfile}; compatibility ${contract.compatibilityProfile}; base URL ${provider.baseUrl ? "present" : "missing"}; endpoint path ${baseUrlDiagnostic.endpointPath}; tools ${contract.supportsTools ? "enabled" : "disabled"}; tool schema ${contract.toolSchemaShape}; tool result ${contract.toolResultShape}; retry ${contract.retryStatuses.join("/")}x${contract.maxAttempts}; timeout ${contract.requestTimeoutMs}ms; idle timeout ${contract.streamIdleTimeoutMs}ms; include usage ${contract.includeUsage ? "yes" : "no"}; reasoning ${reasoningStatus}; api key ${provider.apiKey && keySource ? `present source ${keySource} masked ${maskSecret(provider.apiKey)}` : "missing source missing"}`
|
|
248
|
+
);
|
|
249
|
+
lines.push(` endpoint profile decision: source ${decision.source}; reason ${decision.reason}`);
|
|
250
|
+
if (provider.type === "openai-compatible") {
|
|
251
|
+
lines.push(
|
|
252
|
+
" openai-compatible endpoint hint: root baseUrl + responses \u53EF\u80FD\u53EF\u7528\uFF1Bchat_completions \u901A\u5E38\u9700\u8981 /v1 root\uFF1B\u5982\u679C\u8FD4\u56DE content type text/html\uFF0CbaseUrl \u53EF\u80FD\u586B\u5230\u4E86\u7F51\u9875\u767B\u5F55\u9875\u6216\u5C11\u4E86 /v1\u3002"
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
if (!contract.supportsTools) {
|
|
256
|
+
const reason = contract.endpointProfile === "anthropic_messages" ? "anthropic_messages profile \u5DF2\u539F\u751F\u652F\u6301 tools\uFF0C\u4F46\u5F53\u524D provider \u663E\u5F0F\u58F0\u660E supports tools false\uFF1B\u5982\u9700\u542F\u7528\u8BF7\u628A\u914D\u7F6E\u6539\u4E3A supportsTools true \u6216\u5220\u9664\u8BE5\u5B57\u6BB5" : `runtime contract supports tools false (profile ${contract.profile})`;
|
|
257
|
+
lines.push(` tools disabled reason: ${reason}`);
|
|
258
|
+
}
|
|
259
|
+
if (contract.endpointProfile === "anthropic_messages" && contract.supportsTools) {
|
|
260
|
+
lines.push(
|
|
261
|
+
" anthropic tools: enabled; schema anthropic_tools(input_schema); tool choice auto/none; sort name-asc(stable for prompt cache)"
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
if (contract.endpointProfile === "anthropic_messages") {
|
|
265
|
+
const promptCacheEnabled = context.config.promptCache.enabled;
|
|
266
|
+
const ttl = context.config.promptCache.systemTtl;
|
|
267
|
+
lines.push(
|
|
268
|
+
` anthropic prompt cache: cache_control ${promptCacheEnabled ? `injected; ttl ${ttl === "1h" ? "1h" : "5m-default(no ttl literal)"}` : "off"}; usage fields cache_creation.ephemeral_5m_input_tokens/ephemeral_1h_input_tokens (read-only when emitted by upstream)`
|
|
269
|
+
);
|
|
270
|
+
const contextEditing = resolveAnthropicContextEditingDiagnostic(
|
|
271
|
+
{
|
|
272
|
+
contextEditingEnabled: provider.contextEditingEnabled,
|
|
273
|
+
anthropicBetaHeaders: provider.anthropicBetaHeaders
|
|
274
|
+
},
|
|
275
|
+
contract
|
|
276
|
+
);
|
|
277
|
+
lines.push(
|
|
278
|
+
` anthropic context editing: enabled ${contextEditing.enabled ? "yes" : "no"}; sendable ${contextEditing.sendable ? "yes" : "no"}; beta headers ${contextEditing.betaHeaderCount}; reason ${contextEditing.disabledReason ?? "ok"} (cache_edits/cache_reference body \u5B57\u6BB5 hard-disabled)`
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
if (projectSettingsApiKeyProviders.has(providerId)) {
|
|
282
|
+
lines.push(
|
|
283
|
+
` WARN: project settings provider ${providerId} contains apiKey; project .linghun/settings.json \u4E0D\u5EFA\u8BAE\u4FDD\u5B58 apiKey\uFF0C\u8BF7\u8FC1\u79FB\u5230\u73AF\u5883\u53D8\u91CF\u6216\u79C1\u6709\u914D\u7F6E\u3002`
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
if (decision.warnings.length > 0) {
|
|
287
|
+
for (const warning of decision.warnings) {
|
|
288
|
+
lines.push(` warning: ${warning}`);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (baseUrlDiagnostic.hasQueryOrFragment) {
|
|
292
|
+
lines.push(
|
|
293
|
+
" warning: baseUrl \u5305\u542B query/fragment\uFF1Bdoctor \u4E0D\u663E\u793A\u539F\u503C\uFF0C\u8BF7\u6539\u4E3A\u4E0D\u542B query/fragment \u7684 root baseUrl\u3002"
|
|
294
|
+
);
|
|
295
|
+
lines.push(` recommendation: ${baseUrlDiagnostic.recommendation}`);
|
|
296
|
+
}
|
|
297
|
+
if (baseUrlDiagnostic.fullEndpointSuffix) {
|
|
298
|
+
lines.push(
|
|
299
|
+
` warning: baseUrl \u5305\u542B\u5B8C\u6574 endpoint suffix ${baseUrlDiagnostic.fullEndpointSuffix}\uFF1B\u5DF2\u6309 root baseUrl \u8BCA\u65AD\uFF0C\u6700\u7EC8 endpoint path ${baseUrlDiagnostic.endpointPath}`
|
|
300
|
+
);
|
|
301
|
+
lines.push(` recommendation: ${baseUrlDiagnostic.recommendation}`);
|
|
302
|
+
if (baseUrlDiagnostic.profileMismatch) {
|
|
303
|
+
lines.push(
|
|
304
|
+
` profile/baseUrl \u4E0D\u5339\u914D\uFF1AbaseUrl suffix ${baseUrlDiagnostic.fullEndpointSuffix}\uFF0Cendpoint profile ${endpointProfile}`
|
|
305
|
+
);
|
|
306
|
+
} else if (provider.endpointProfile && provider.endpointProfile !== endpointProfile) {
|
|
307
|
+
lines.push(
|
|
308
|
+
` profile/baseUrl \u4E0D\u5339\u914D\uFF1AbaseUrl suffix ${baseUrlDiagnostic.fullEndpointSuffix}\uFF0Cconfigured endpoint profile ${provider.endpointProfile}\uFF0Cruntime endpoint profile ${endpointProfile}`
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
for (const route of context.config.modelRoutes.routes) {
|
|
314
|
+
const problems = diagnoseRoute(route, context.config);
|
|
315
|
+
const level = getRouteDoctorLevel(route, problems, context.config);
|
|
316
|
+
lines.push(
|
|
317
|
+
`- ${route.role}: ${level}${problems.length === 0 ? "" : `\uFF1A${problems.join("\uFF1B")}`} provider ${route.provider || "\u672A\u914D\u7F6E"} model ${route.primaryModel || "\u672A\u914D\u7F6E"} fallback ${route.fallbackModels.length > 0 ? route.fallbackModels.join(",") : "\u672A\u914D\u7F6E"}`
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
if (context.routeDecisions.length > 0) {
|
|
321
|
+
lines.push(isEn ? "- recent route decisions:" : "- \u6700\u8FD1\u8DEF\u7531\u51B3\u7B56\uFF1A");
|
|
322
|
+
for (const decision of context.routeDecisions.slice(0, 3)) {
|
|
323
|
+
lines.push(
|
|
324
|
+
` - ${decision.role}: trigger ${decision.triggerReason}; selected ${decision.selectedProvider || "paused"}/${decision.selectedModel || "paused"}; fallback used ${decision.fallbackUsed ? "yes" : "no"}; stop ${decision.stopConditions.length > 0 ? decision.stopConditions.join("|") : "none"}`
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (context.providerBreaker) {
|
|
329
|
+
const cooldownLine = formatCooldownDoctorLine(context.providerBreaker, context.language);
|
|
330
|
+
if (cooldownLine) {
|
|
331
|
+
lines.push(`- ${cooldownLine}`);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if (context.lastProviderFailure) {
|
|
335
|
+
const failure = context.lastProviderFailure;
|
|
336
|
+
const failureKind = toProviderFailureKind(failure.kind);
|
|
337
|
+
const humanKind = formatProviderFailureKindLabel(failureKind, context.language);
|
|
338
|
+
if (isEn) {
|
|
339
|
+
lines.push(
|
|
340
|
+
`- last model-service failure: kind ${humanKind}; code ${failure.code}; provider ${failure.provider}; model ${failure.model}; endpoint profile ${failure.endpointProfile}; details: /details evidence`
|
|
341
|
+
);
|
|
342
|
+
if (failure.kind === "quota_or_balance_exhausted") {
|
|
343
|
+
lines.push(
|
|
344
|
+
"- quota/balance note: this is an upstream error classification, not a balance query."
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
} else {
|
|
348
|
+
lines.push(
|
|
349
|
+
`- \u6700\u8FD1\u6A21\u578B\u670D\u52A1\u5931\u8D25\uFF1A\u7C7B\u578B ${humanKind}\uFF1Bcode ${failure.code}\uFF1B\u670D\u52A1\u5546 ${failure.provider}\uFF1B\u6A21\u578B ${failure.model}\uFF1B\u63A5\u53E3\u7C7B\u578B ${failure.endpointProfile}\uFF1B\u8BE6\u60C5\uFF1A/details evidence`
|
|
350
|
+
);
|
|
351
|
+
if (failure.kind === "quota_or_balance_exhausted") {
|
|
352
|
+
lines.push("- \u989D\u5EA6/\u4F59\u989D\u8BF4\u660E\uFF1A\u8FD9\u662F\u4E0A\u6E38\u9519\u8BEF\u5206\u7C7B\uFF0C\u4E0D\u662F Linghun \u67E5\u8BE2\u4F59\u989D\u7684\u7ED3\u679C\u3002");
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (context.lastProviderFallbackAttempt) {
|
|
357
|
+
const attempt = context.lastProviderFallbackAttempt;
|
|
358
|
+
const reason = formatProviderFailureKindLabel(
|
|
359
|
+
toProviderFailureKind(attempt.reasonKind),
|
|
360
|
+
context.language
|
|
361
|
+
);
|
|
362
|
+
const statusText = context.language === "en-US" ? attempt.status : attempt.status === "attempted" ? "\u5DF2\u5C1D\u8BD5" : attempt.status === "succeeded" ? "\u5DF2\u6210\u529F" : "\u5DF2\u5931\u8D25";
|
|
363
|
+
lines.push(
|
|
364
|
+
isEn ? `- last fallback attempt: ${statusText}; ${attempt.fromProvider}/${attempt.fromModel} -> ${attempt.toProvider}/${attempt.toModel}; reason ${reason}; code ${attempt.reasonCode}` : `- \u6700\u8FD1\u5907\u7528\u6A21\u578B\u5C1D\u8BD5\uFF1A\u72B6\u6001 ${statusText}\uFF1B${attempt.fromProvider}/${attempt.fromModel} -> ${attempt.toProvider}/${attempt.toModel}\uFF1B\u539F\u56E0 ${reason}\uFF1Bcode ${attempt.reasonCode}`
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
if (hasOpenAiCompatibleDoctorProblem(context.config)) {
|
|
368
|
+
lines.push(
|
|
369
|
+
"- openai-compatible \u4FEE\u590D\uFF1A\u8BBE\u7F6E LINGHUN_OPENAI_BASE_URL\u3001LINGHUN_OPENAI_API_KEY\u3001LINGHUN_OPENAI_MODEL \u540E\u91CD\u542F Linghun\u3002"
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
if (hasOpenAiCompatiblePlaceholderProblem(context.config)) {
|
|
373
|
+
lines.push(
|
|
374
|
+
"- openai-compatible \u5360\u4F4D\u63D0\u793A\uFF1A\u8BF7\u68C0\u67E5 .linghun/settings.json\uFF0C\u907F\u514D openai-compatible-model \u5360\u4F4D\u503C\u8986\u76D6\u771F\u5B9E\u6A21\u578B\u3002"
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
lines.push(
|
|
378
|
+
"- budget: \u672A\u914D\u7F6E\u9884\u7B97\u53EA\u4F5C\u4E3A WARN\uFF1B\u91D1\u989D\u4EC5\u5728 /usage \u6216 /stats \u4E2D\u4EE5 estimated \u5C55\u793A\uFF0C\u72B6\u6001\u680F\u4E0D\u4F1A\u663E\u793A\u91D1\u989D\u3002"
|
|
379
|
+
);
|
|
380
|
+
lines.push(
|
|
381
|
+
"- handoff: \u89D2\u8272\u95F4\u53EA\u4F20 summary/evidence/diff/verification/keyFiles\uFF0C\u4E0D\u4F20\u5B8C\u6574 transcript/memory/index/logs\u3002"
|
|
382
|
+
);
|
|
383
|
+
return lines.join("\n");
|
|
384
|
+
}
|
|
385
|
+
function toProviderFailureKind(value) {
|
|
386
|
+
if (value === "rate_limit" || value === "quota_or_balance_exhausted" || value === "schema" || value === "auth" || value === "not_found" || value === "gateway" || value === "transit" || value === "timeout" || value === "abort" || value === "reasoning_unsupported") {
|
|
387
|
+
return value;
|
|
388
|
+
}
|
|
389
|
+
return "generic";
|
|
390
|
+
}
|
|
391
|
+
function diagnoseRoute(route, config) {
|
|
392
|
+
const problems = diagnoseConcreteRoute(route, route.primaryModel, route.provider, config);
|
|
393
|
+
if (route.primaryModel && isDefaultPlaceholderModel(route.primaryModel)) {
|
|
394
|
+
problems.push(`\u6A21\u578B placeholder \u672A\u66FF\u6362\u4E3A\u73B0\u5F79\u6A21\u578B\uFF1A${route.primaryModel}`);
|
|
395
|
+
}
|
|
396
|
+
if (route.fallbackModels.length === 0) {
|
|
397
|
+
problems.push("fallbackModels \u672A\u914D\u7F6E");
|
|
398
|
+
}
|
|
399
|
+
for (const fallbackModel of route.fallbackModels) {
|
|
400
|
+
const fallbackProvider = inferProviderForRouteModel(fallbackModel, config);
|
|
401
|
+
const fallbackProblems = diagnoseConcreteRoute(route, fallbackModel, fallbackProvider, config);
|
|
402
|
+
if (isDefaultPlaceholderModel(fallbackModel)) {
|
|
403
|
+
fallbackProblems.push(`\u6A21\u578B placeholder \u672A\u66FF\u6362\u4E3A\u73B0\u5F79\u6A21\u578B\uFF1A${fallbackModel}`);
|
|
404
|
+
}
|
|
405
|
+
if (getRouteBlockingProblems(fallbackProblems).length > 0) {
|
|
406
|
+
problems.push(
|
|
407
|
+
`fallback \u4E0D\u53EF\u7528 ${fallbackModel}\uFF1A${getRouteBlockingProblems(fallbackProblems).join("/")}`
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
if (route.maxCostCny === void 0) {
|
|
412
|
+
problems.push("\u9884\u7B97\u672A\u914D\u7F6E");
|
|
413
|
+
}
|
|
414
|
+
if ((route.role === "planner" || route.role === "reviewer" || route.role === "vision") && route.allowWrite) {
|
|
415
|
+
problems.push("\u6743\u9650\u8FC7\u5BBD\uFF1A\u4E0D\u5E94\u5199\u6587\u4EF6");
|
|
416
|
+
}
|
|
417
|
+
if ((route.role === "vision" || route.role === "image" || route.role === "planner") && route.allowBash) {
|
|
418
|
+
problems.push("\u6743\u9650\u8FC7\u5BBD\uFF1A\u4E0D\u5E94\u6267\u884C Bash");
|
|
419
|
+
}
|
|
420
|
+
return problems;
|
|
421
|
+
}
|
|
422
|
+
function diagnoseConcreteRoute(route, model, providerId, config) {
|
|
423
|
+
const problems = [];
|
|
424
|
+
const provider = providerId ? config.providers[providerId] : void 0;
|
|
425
|
+
if (!providerId) {
|
|
426
|
+
problems.push("\u7F3A provider");
|
|
427
|
+
} else if (!provider) {
|
|
428
|
+
problems.push("provider \u672A\u914D\u7F6E");
|
|
429
|
+
}
|
|
430
|
+
if (!model) {
|
|
431
|
+
problems.push("\u7F3A\u6A21\u578B");
|
|
432
|
+
}
|
|
433
|
+
if (provider?.type === "openai-compatible") {
|
|
434
|
+
if (!provider.baseUrl) problems.push("openai-compatible \u7F3A baseUrl");
|
|
435
|
+
if (!provider.apiKey) problems.push("openai-compatible \u7F3A apiKey");
|
|
436
|
+
if (!provider.model || provider.model === "openai-compatible-model") {
|
|
437
|
+
problems.push("openai-compatible \u7F3A\u5DF2\u786E\u8BA4\u6A21\u578B");
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
for (const capability of route.requiredCapabilities) {
|
|
441
|
+
if (!routeSupportsCapability({ ...route, primaryModel: model }, capability)) {
|
|
442
|
+
problems.push(
|
|
443
|
+
capability === "tools" ? "\u80FD\u529B\u4E0D\u8DB3\uFF1Atools/tool calling" : `\u80FD\u529B\u4E0D\u8DB3\uFF1A${capability}`
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return problems;
|
|
448
|
+
}
|
|
449
|
+
function getRouteDoctorLevel(route, problems, config) {
|
|
450
|
+
const primaryProblems = diagnoseConcreteRoute(route, route.primaryModel, route.provider, config);
|
|
451
|
+
if (route.primaryModel && isDefaultPlaceholderModel(route.primaryModel)) {
|
|
452
|
+
primaryProblems.push(`\u6A21\u578B placeholder \u672A\u66FF\u6362\u4E3A\u73B0\u5F79\u6A21\u578B\uFF1A${route.primaryModel}`);
|
|
453
|
+
}
|
|
454
|
+
const primaryBlocking = getRouteBlockingProblems(primaryProblems);
|
|
455
|
+
if (primaryBlocking.length > 0) {
|
|
456
|
+
const hasUsableFallback = route.fallbackModels.some((fallbackModel) => {
|
|
457
|
+
const fallbackProvider = inferProviderForRouteModel(fallbackModel, config);
|
|
458
|
+
const fallbackProblems = diagnoseConcreteRoute(
|
|
459
|
+
route,
|
|
460
|
+
fallbackModel,
|
|
461
|
+
fallbackProvider,
|
|
462
|
+
config
|
|
463
|
+
);
|
|
464
|
+
if (isDefaultPlaceholderModel(fallbackModel)) {
|
|
465
|
+
fallbackProblems.push(`\u6A21\u578B placeholder \u672A\u66FF\u6362\u4E3A\u73B0\u5F79\u6A21\u578B\uFF1A${fallbackModel}`);
|
|
466
|
+
}
|
|
467
|
+
return getRouteBlockingProblems(fallbackProblems).length === 0;
|
|
468
|
+
});
|
|
469
|
+
return hasUsableFallback ? "WARN" : "BLOCK";
|
|
470
|
+
}
|
|
471
|
+
return problems.length > 0 ? "WARN" : "ok";
|
|
472
|
+
}
|
|
473
|
+
function getRouteBlockingProblems(problems) {
|
|
474
|
+
return problems.filter(
|
|
475
|
+
(problem) => problem !== "\u9884\u7B97\u672A\u914D\u7F6E" && problem !== "fallbackModels \u672A\u914D\u7F6E" && (problem.startsWith("\u7F3A") || problem.includes("\u672A\u914D\u7F6E") || problem.includes("\u7F3A ") || problem.includes("\u7F3A\u5DF2\u786E\u8BA4") || problem.includes("\u4E0D\u5339\u914D") || problem.startsWith("\u80FD\u529B\u4E0D\u8DB3") || // D.13J tail fix(Block D):placeholder 模型属于 blocking,不能被当成可用 route。
|
|
476
|
+
problem.startsWith("\u6A21\u578B placeholder"))
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
function routeSupportsCapability(route, capability) {
|
|
480
|
+
if (capability === "text") {
|
|
481
|
+
return Boolean(route.primaryModel);
|
|
482
|
+
}
|
|
483
|
+
if (capability === "vision") {
|
|
484
|
+
return /vision|vl|gpt-4o|claude|qwen|glm|kimi/i.test(route.primaryModel);
|
|
485
|
+
}
|
|
486
|
+
if (capability === "image") {
|
|
487
|
+
return /image|dall|gpt-image|flux|sd|comfy/i.test(route.primaryModel);
|
|
488
|
+
}
|
|
489
|
+
if (capability === "tools") {
|
|
490
|
+
return route.allowTools;
|
|
491
|
+
}
|
|
492
|
+
if (capability === "thinking") {
|
|
493
|
+
return /pro|reason|thinking|claude|gpt/i.test(route.primaryModel);
|
|
494
|
+
}
|
|
495
|
+
if (capability === "promptCache") {
|
|
496
|
+
return /claude|gpt|deepseek/i.test(route.primaryModel);
|
|
497
|
+
}
|
|
498
|
+
return false;
|
|
499
|
+
}
|
|
500
|
+
function inferProviderForRouteModel(model, config) {
|
|
501
|
+
const normalized = normalizeDeepSeekModelName(model);
|
|
502
|
+
for (const [providerId, provider] of Object.entries(config.providers)) {
|
|
503
|
+
if (provider.model === model || provider.model === normalized) {
|
|
504
|
+
return providerId;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
return "openai-compatible";
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
export {
|
|
511
|
+
maskSecret,
|
|
512
|
+
getProviderKeySource,
|
|
513
|
+
readProjectSettingsApiKeyProviders,
|
|
514
|
+
readProviderEnvApiKeyProviders,
|
|
515
|
+
isModelRole,
|
|
516
|
+
getRoleRoute,
|
|
517
|
+
isDefaultExecutorRoute,
|
|
518
|
+
formatModelRouteSummary,
|
|
519
|
+
formatModelRoutes,
|
|
520
|
+
hasOpenAiCompatibleProviderSetupProblem,
|
|
521
|
+
hasOpenAiCompatibleDoctorProblem,
|
|
522
|
+
hasOpenAiCompatiblePlaceholderProblem,
|
|
523
|
+
collectPlaceholderModelHits,
|
|
524
|
+
formatModelRouteDoctor,
|
|
525
|
+
diagnoseRoute,
|
|
526
|
+
diagnoseConcreteRoute,
|
|
527
|
+
getRouteDoctorLevel,
|
|
528
|
+
getRouteBlockingProblems,
|
|
529
|
+
routeSupportsCapability,
|
|
530
|
+
inferProviderForRouteModel
|
|
531
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// src/shell/models/help-panel.ts
|
|
2
|
+
var CORE_ENTRIES_ZH = [
|
|
3
|
+
{ slash: "/help", description: "\u67E5\u770B\u547D\u4EE4\u5E2E\u52A9\uFF08all / advanced / details \u5207\u6362\u5206\u7EC4\uFF09" },
|
|
4
|
+
{ slash: "/model", description: "\u67E5\u770B / \u5207\u6362\u6267\u884C\u6A21\u578B\u4E0E reasoning level" },
|
|
5
|
+
{ slash: "/permissions", description: "\u67E5\u770B\u6743\u9650\u89C4\u5219\u4E0E\u6700\u8FD1\u88AB\u62D2\u5217\u8868" },
|
|
6
|
+
{ slash: "/mode", description: "\u5207\u6362\u6743\u9650\u6A21\u5F0F\uFF08default / auto / plan / full-access\uFF09" },
|
|
7
|
+
{ slash: "/config", description: "\u6253\u5F00\u914D\u7F6E\u9762\u677F\uFF08model / language / permissions \u7B49\uFF09" },
|
|
8
|
+
{ slash: "/index", description: "\u67E5\u770B\u4EE3\u7801\u7D22\u5F15\u72B6\u6001\u4E0E\u5237\u65B0\u5165\u53E3" },
|
|
9
|
+
{ slash: "/details", description: "\u6253\u5F00\u6700\u8FD1\u8F93\u51FA / evidence / background \u8BE6\u60C5\u9762\u677F" },
|
|
10
|
+
{ slash: "/exit", description: "\u9000\u51FA Linghun" }
|
|
11
|
+
];
|
|
12
|
+
var CORE_ENTRIES_EN = [
|
|
13
|
+
{ slash: "/help", description: "Show command help (all / advanced / details groups)" },
|
|
14
|
+
{ slash: "/model", description: "Show / switch executor model and reasoning level" },
|
|
15
|
+
{ slash: "/permissions", description: "Inspect permission rules and recent denials" },
|
|
16
|
+
{ slash: "/mode", description: "Switch permission mode (default / auto / plan / full-access)" },
|
|
17
|
+
{ slash: "/config", description: "Open the config panel (model / language / permissions ...)" },
|
|
18
|
+
{ slash: "/index", description: "Show codebase index status and refresh entry" },
|
|
19
|
+
{ slash: "/details", description: "Open recent output / evidence / background details panel" },
|
|
20
|
+
{ slash: "/exit", description: "Exit Linghun" }
|
|
21
|
+
];
|
|
22
|
+
var ADVANCED_ENTRIES_ZH = [
|
|
23
|
+
{ slash: "/agents", description: "\u67E5\u770B\u56E2\u961F\u667A\u80FD\u4F53\u4E0E\u540E\u53F0 agent \u72B6\u6001" },
|
|
24
|
+
{ slash: "/background", description: "\u67E5\u770B\u540E\u53F0\u4EFB\u52A1\u5217\u8868\u4E0E\u8BE6\u60C5" },
|
|
25
|
+
{ slash: "/job", description: "\u7BA1\u7406\u540E\u53F0\u4EFB\u52A1\uFF08start / pause / cancel\uFF09" },
|
|
26
|
+
{ slash: "/batch", description: "\u542F\u52A8\u9694\u79BB worktree batch \u667A\u80FD\u4F53" },
|
|
27
|
+
{ slash: "/skills", description: "\u7BA1\u7406\u6280\u80FD\u4E0E\u542F\u7528\u72B6\u6001" },
|
|
28
|
+
{ slash: "/workflows", description: "\u67E5\u770B workflow \u72B6\u6001\u4E0E\u89E6\u53D1\u5165\u53E3" },
|
|
29
|
+
{ slash: "/handoff", description: "\u5BFC\u51FA\u4F1A\u8BDD handoff packet" },
|
|
30
|
+
{ slash: "/branch", description: "\u57FA\u4E8E handoff \u521B\u5EFA\u4F1A\u8BDD\u5206\u652F\uFF08\u4E0D\u662F git \u5206\u652F\uFF09" },
|
|
31
|
+
{ slash: "/git", description: "\u67E5\u770B git \u72B6\u6001\u3001\u7A33\u5B9A\u70B9\u5EFA\u8BAE\u3001worktree \u6458\u8981\uFF08\u53EA\u8BFB\uFF09" },
|
|
32
|
+
{ slash: "/worktree", description: "\u67E5\u770B git worktree \u5217\u8868\uFF08\u53EA\u8BFB\uFF09" },
|
|
33
|
+
{ slash: "/checkpoint", description: "\u67E5\u770B Linghun snapshot checkpoint / \u7A33\u5B9A\u70B9\u5EFA\u8BAE" },
|
|
34
|
+
{ slash: "/cache", description: "\u67E5\u770B cache \u4F7F\u7528\u60C5\u51B5\u4E0E\u51B7\u70ED\u5206\u5E03" }
|
|
35
|
+
];
|
|
36
|
+
var ADVANCED_ENTRIES_EN = [
|
|
37
|
+
{ slash: "/agents", description: "Inspect teammate agents and background agent status" },
|
|
38
|
+
{ slash: "/background", description: "List background tasks and inspect details" },
|
|
39
|
+
{ slash: "/job", description: "Manage background jobs (start / pause / cancel)" },
|
|
40
|
+
{ slash: "/batch", description: "Run isolated worktree batch agents" },
|
|
41
|
+
{ slash: "/skills", description: "Manage skills and their enabled state" },
|
|
42
|
+
{ slash: "/workflows", description: "Inspect workflow status and trigger entries" },
|
|
43
|
+
{ slash: "/handoff", description: "Export the session handoff packet" },
|
|
44
|
+
{ slash: "/branch", description: "Create a session branch from handoff (not a git branch)" },
|
|
45
|
+
{
|
|
46
|
+
slash: "/git",
|
|
47
|
+
description: "Show git status, stable-point hints, worktree summary (read-only)"
|
|
48
|
+
},
|
|
49
|
+
{ slash: "/worktree", description: "List git worktrees (read-only)" },
|
|
50
|
+
{ slash: "/checkpoint", description: "Inspect Linghun snapshot checkpoints / stable points" },
|
|
51
|
+
{ slash: "/cache", description: "Inspect cache usage and hot / cold distribution" }
|
|
52
|
+
];
|
|
53
|
+
var DETAILS_ENTRIES_ZH = [
|
|
54
|
+
{ slash: "/details", description: "\u5C55\u5F00\u6700\u8FD1\u6B63\u6587 / evidence / background \u8BE6\u60C5" },
|
|
55
|
+
{ slash: "/cache-log", description: "\u67E5\u770B cache log \u8BE6\u60C5" },
|
|
56
|
+
{ slash: "/break-cache", description: "\u8BCA\u65AD cache hash \u6F02\u79FB" },
|
|
57
|
+
{ slash: "/model doctor", description: "\u8FD0\u884C\u6A21\u578B\u8DEF\u7531\u8BCA\u65AD" },
|
|
58
|
+
{ slash: "/model route", description: "\u67E5\u770B / \u8C03\u6574\u6A21\u578B\u8DEF\u7531" },
|
|
59
|
+
{ slash: "/index doctor", description: "\u8FD0\u884C\u7D22\u5F15\u8BCA\u65AD" }
|
|
60
|
+
];
|
|
61
|
+
var DETAILS_ENTRIES_EN = [
|
|
62
|
+
{ slash: "/details", description: "Expand recent body / evidence / background details" },
|
|
63
|
+
{ slash: "/cache-log", description: "Inspect cache log details" },
|
|
64
|
+
{ slash: "/break-cache", description: "Diagnose cache hash drift" },
|
|
65
|
+
{ slash: "/model doctor", description: "Run model route diagnostics" },
|
|
66
|
+
{ slash: "/model route", description: "Inspect / adjust model routes" },
|
|
67
|
+
{ slash: "/index doctor", description: "Run codebase index diagnostics" }
|
|
68
|
+
];
|
|
69
|
+
function getHelpPanelEntries(group, language) {
|
|
70
|
+
if (group === "core") return language === "en-US" ? CORE_ENTRIES_EN : CORE_ENTRIES_ZH;
|
|
71
|
+
if (group === "advanced") return language === "en-US" ? ADVANCED_ENTRIES_EN : ADVANCED_ENTRIES_ZH;
|
|
72
|
+
return language === "en-US" ? DETAILS_ENTRIES_EN : DETAILS_ENTRIES_ZH;
|
|
73
|
+
}
|
|
74
|
+
function buildHelpPanelData(group, cursor, scrollOffset, language) {
|
|
75
|
+
const entries = getHelpPanelEntries(group, language);
|
|
76
|
+
const safe = entries.length === 0 ? 0 : Math.min(Math.max(0, cursor), entries.length - 1);
|
|
77
|
+
return { group, cursor: safe, scrollOffset, entries };
|
|
78
|
+
}
|
|
79
|
+
var HELP_PANEL_GROUPS = ["core", "advanced", "details"];
|
|
80
|
+
|
|
81
|
+
export {
|
|
82
|
+
getHelpPanelEntries,
|
|
83
|
+
buildHelpPanelData,
|
|
84
|
+
HELP_PANEL_GROUPS
|
|
85
|
+
};
|