@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,50 @@
|
|
|
1
|
+
// src/feature-flag-runtime.ts
|
|
2
|
+
var DEFAULT_FEATURE_FLAGS = {
|
|
3
|
+
experimentalDeferredSkillExecution: false,
|
|
4
|
+
experimentalDeferredPluginExecution: false,
|
|
5
|
+
localReplBridge: true,
|
|
6
|
+
memoryIncludes: true,
|
|
7
|
+
customKeybindings: true
|
|
8
|
+
};
|
|
9
|
+
function getFeatureFlags(context) {
|
|
10
|
+
const raw = context?.config;
|
|
11
|
+
return {
|
|
12
|
+
...DEFAULT_FEATURE_FLAGS,
|
|
13
|
+
...raw?.features ? parseFeatureFlags(raw.features) : {},
|
|
14
|
+
...parseFeatureFlagEnv()
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function isFeatureEnabled(name, context) {
|
|
18
|
+
return getFeatureFlags(context)[name] === true;
|
|
19
|
+
}
|
|
20
|
+
function formatFeatureFlags(flags) {
|
|
21
|
+
return Object.entries(flags).sort(([left], [right]) => left.localeCompare(right)).map(([name, enabled]) => `- ${name}: ${enabled ? "enabled" : "disabled"}`);
|
|
22
|
+
}
|
|
23
|
+
function parseFeatureFlags(raw) {
|
|
24
|
+
const parsed = {};
|
|
25
|
+
for (const key of Object.keys(DEFAULT_FEATURE_FLAGS)) {
|
|
26
|
+
if (typeof raw[key] === "boolean") parsed[key] = raw[key];
|
|
27
|
+
}
|
|
28
|
+
return parsed;
|
|
29
|
+
}
|
|
30
|
+
function parseFeatureFlagEnv() {
|
|
31
|
+
const raw = process.env.LINGHUN_FEATURE_FLAGS;
|
|
32
|
+
if (!raw) return {};
|
|
33
|
+
const flags = {};
|
|
34
|
+
for (const item of raw.split(",")) {
|
|
35
|
+
const [name, value] = item.split("=").map((part) => part.trim());
|
|
36
|
+
if (!isFeatureFlagName(name)) continue;
|
|
37
|
+
flags[name] = value === "1" || value === "true" || value === "on";
|
|
38
|
+
}
|
|
39
|
+
return flags;
|
|
40
|
+
}
|
|
41
|
+
function isFeatureFlagName(value) {
|
|
42
|
+
return Boolean(value && value in DEFAULT_FEATURE_FLAGS);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
DEFAULT_FEATURE_FLAGS,
|
|
47
|
+
getFeatureFlags,
|
|
48
|
+
isFeatureEnabled,
|
|
49
|
+
formatFeatureFlags
|
|
50
|
+
};
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classifyProviderFailure
|
|
3
|
+
} from "./chunk-OZMX3E35.js";
|
|
4
|
+
|
|
5
|
+
// src/provider-circuit-breaker.ts
|
|
6
|
+
import { readPositiveIntEnv } from "@linghun/shared";
|
|
7
|
+
import { LinghunError } from "@linghun/core";
|
|
8
|
+
var BREAKER_FAILURE_THRESHOLD = 5;
|
|
9
|
+
var BREAKER_COOLDOWN_MS = readPositiveIntEnv("LINGHUN_PROVIDER_BREAKER_COOLDOWN_MS", 12e4);
|
|
10
|
+
var PROVIDER_ACTIVE_LIMIT = readPositiveIntEnv("LINGHUN_PROVIDER_ACTIVE_LIMIT", 3);
|
|
11
|
+
var RECOVERABLE_CODES = /* @__PURE__ */ new Set([
|
|
12
|
+
"PROVIDER_SERVER_ERROR",
|
|
13
|
+
"PROVIDER_RATE_LIMITED",
|
|
14
|
+
"PROVIDER_REQUEST_TIMEOUT",
|
|
15
|
+
"PROVIDER_STREAM_TIMEOUT",
|
|
16
|
+
"PROVIDER_NETWORK_ERROR",
|
|
17
|
+
"PROVIDER_STREAM_ERROR",
|
|
18
|
+
"PROVIDER_STREAM_DECODE_ERROR",
|
|
19
|
+
"PROVIDER_RETRY_EXHAUSTED",
|
|
20
|
+
"PROVIDER_NON_SSE_STREAM",
|
|
21
|
+
"PROVIDER_MALFORMED_STREAM",
|
|
22
|
+
"PROVIDER_PARTIAL_TOOL_CALL",
|
|
23
|
+
"PROVIDER_QUOTA_EXHAUSTED"
|
|
24
|
+
]);
|
|
25
|
+
function createProviderCircuitBreakerState() {
|
|
26
|
+
return { entries: /* @__PURE__ */ new Map() };
|
|
27
|
+
}
|
|
28
|
+
function makeBreakerKey(providerId, model) {
|
|
29
|
+
return `${providerId}::${model}`;
|
|
30
|
+
}
|
|
31
|
+
function isRecoverableProviderFailure(errorCode) {
|
|
32
|
+
return RECOVERABLE_CODES.has(errorCode);
|
|
33
|
+
}
|
|
34
|
+
function checkProviderGate(state, providerId, model) {
|
|
35
|
+
const cooldown = checkProviderCooldown(state, providerId, model);
|
|
36
|
+
if (cooldown.blocked) {
|
|
37
|
+
return {
|
|
38
|
+
allowed: false,
|
|
39
|
+
reason: "cooldown",
|
|
40
|
+
remainingMs: cooldown.remainingMs,
|
|
41
|
+
reasonCode: cooldown.reasonCode
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const key = makeBreakerKey(providerId, model);
|
|
45
|
+
const entry = state.entries.get(key);
|
|
46
|
+
const limit = entry?.activeLimit ?? PROVIDER_ACTIVE_LIMIT;
|
|
47
|
+
const count = entry?.activeCount ?? 0;
|
|
48
|
+
if (count >= limit) {
|
|
49
|
+
return { allowed: false, reason: "at_capacity", activeCount: count, activeLimit: limit };
|
|
50
|
+
}
|
|
51
|
+
return { allowed: true };
|
|
52
|
+
}
|
|
53
|
+
function acquireProviderSlot(state, providerId, model) {
|
|
54
|
+
const key = makeBreakerKey(providerId, model);
|
|
55
|
+
const existing = state.entries.get(key);
|
|
56
|
+
const limit = existing?.activeLimit ?? PROVIDER_ACTIVE_LIMIT;
|
|
57
|
+
const count = existing?.activeCount ?? 0;
|
|
58
|
+
if (count >= limit) return false;
|
|
59
|
+
state.entries.set(key, {
|
|
60
|
+
providerId,
|
|
61
|
+
model,
|
|
62
|
+
state: existing?.state ?? "closed",
|
|
63
|
+
consecutiveFailures: existing?.consecutiveFailures ?? 0,
|
|
64
|
+
lastFailureAt: existing?.lastFailureAt ?? 0,
|
|
65
|
+
cooldownUntil: existing?.cooldownUntil ?? 0,
|
|
66
|
+
reasonCode: existing?.reasonCode ?? "",
|
|
67
|
+
activeCount: count + 1,
|
|
68
|
+
activeLimit: limit
|
|
69
|
+
});
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
function releaseProviderSlot(state, providerId, model) {
|
|
73
|
+
const key = makeBreakerKey(providerId, model);
|
|
74
|
+
const existing = state.entries.get(key);
|
|
75
|
+
if (!existing) return;
|
|
76
|
+
const count = Math.max(0, existing.activeCount - 1);
|
|
77
|
+
if (count === 0 && existing.state === "closed" && existing.consecutiveFailures === 0 && existing.cooldownUntil === 0) {
|
|
78
|
+
state.entries.delete(key);
|
|
79
|
+
} else {
|
|
80
|
+
state.entries.set(key, { ...existing, activeCount: count });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function recordProviderFailure(state, providerId, model, errorCode) {
|
|
84
|
+
if (!isRecoverableProviderFailure(errorCode)) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
const key = makeBreakerKey(providerId, model);
|
|
88
|
+
const existing = state.entries.get(key);
|
|
89
|
+
const previousState = existing?.state ?? "closed";
|
|
90
|
+
const now = Date.now();
|
|
91
|
+
const consecutiveFailures = (existing?.consecutiveFailures ?? 0) + 1;
|
|
92
|
+
const cooldownUntil = consecutiveFailures >= BREAKER_FAILURE_THRESHOLD ? now + BREAKER_COOLDOWN_MS : 0;
|
|
93
|
+
const breakerState = cooldownUntil > 0 ? "open" : "closed";
|
|
94
|
+
state.entries.set(key, {
|
|
95
|
+
providerId,
|
|
96
|
+
model,
|
|
97
|
+
state: breakerState,
|
|
98
|
+
consecutiveFailures,
|
|
99
|
+
lastFailureAt: now,
|
|
100
|
+
cooldownUntil,
|
|
101
|
+
reasonCode: errorCode,
|
|
102
|
+
activeCount: existing?.activeCount ?? 0,
|
|
103
|
+
activeLimit: existing?.activeLimit ?? PROVIDER_ACTIVE_LIMIT
|
|
104
|
+
});
|
|
105
|
+
return breakerState === "open" && previousState !== "open";
|
|
106
|
+
}
|
|
107
|
+
function clearProviderBreaker(state, providerId, model) {
|
|
108
|
+
const key = makeBreakerKey(providerId, model);
|
|
109
|
+
const existing = state.entries.get(key);
|
|
110
|
+
const count = existing?.activeCount ?? 0;
|
|
111
|
+
if (count > 0) {
|
|
112
|
+
state.entries.set(key, {
|
|
113
|
+
providerId,
|
|
114
|
+
model,
|
|
115
|
+
state: "closed",
|
|
116
|
+
consecutiveFailures: 0,
|
|
117
|
+
lastFailureAt: 0,
|
|
118
|
+
cooldownUntil: 0,
|
|
119
|
+
reasonCode: "",
|
|
120
|
+
activeCount: count,
|
|
121
|
+
activeLimit: existing?.activeLimit ?? PROVIDER_ACTIVE_LIMIT
|
|
122
|
+
});
|
|
123
|
+
} else {
|
|
124
|
+
state.entries.delete(key);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function checkProviderCooldown(state, providerId, model) {
|
|
128
|
+
const key = makeBreakerKey(providerId, model);
|
|
129
|
+
const entry = state.entries.get(key);
|
|
130
|
+
if (!entry || entry.cooldownUntil === 0) {
|
|
131
|
+
return { blocked: false };
|
|
132
|
+
}
|
|
133
|
+
const now = Date.now();
|
|
134
|
+
if (now >= entry.cooldownUntil) {
|
|
135
|
+
entry.state = "half-open";
|
|
136
|
+
entry.cooldownUntil = 0;
|
|
137
|
+
entry.consecutiveFailures = 0;
|
|
138
|
+
state.entries.set(key, entry);
|
|
139
|
+
return { blocked: false };
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
blocked: true,
|
|
143
|
+
remainingMs: entry.cooldownUntil - now,
|
|
144
|
+
reasonCode: entry.reasonCode,
|
|
145
|
+
entry
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function formatCooldownMessage(providerId, model, remainingMs, language) {
|
|
149
|
+
const seconds = Math.ceil(remainingMs / 1e3);
|
|
150
|
+
if (language === "en-US") {
|
|
151
|
+
return [
|
|
152
|
+
`Model service ${providerId}/${model} is temporarily unstable and waiting before retry.`,
|
|
153
|
+
`Retry available in ~${seconds}s.`,
|
|
154
|
+
"You can run /model doctor to diagnose, or switch provider/model with /model."
|
|
155
|
+
].join(" ");
|
|
156
|
+
}
|
|
157
|
+
return [
|
|
158
|
+
`\u6A21\u578B\u670D\u52A1 ${providerId}/${model} \u6682\u65F6\u4E0D\u7A33\u5B9A\uFF0C\u6B63\u5728\u7B49\u5F85\u6062\u590D\u3002`,
|
|
159
|
+
`\u7EA6 ${seconds} \u79D2\u540E\u53EF\u91CD\u8BD5\u3002`,
|
|
160
|
+
"\u53EF\u8FD0\u884C /model doctor \u8BCA\u65AD\uFF0C\u6216\u7528 /model \u5207\u6362\u670D\u52A1\u5546\u6216\u6A21\u578B\u3002"
|
|
161
|
+
].join("");
|
|
162
|
+
}
|
|
163
|
+
function formatCooldownDoctorLine(state, language) {
|
|
164
|
+
const now = Date.now();
|
|
165
|
+
const active = [];
|
|
166
|
+
for (const entry of state.entries.values()) {
|
|
167
|
+
if (entry.cooldownUntil > now) {
|
|
168
|
+
const seconds = Math.ceil((entry.cooldownUntil - now) / 1e3);
|
|
169
|
+
active.push(
|
|
170
|
+
language === "en-US" ? `${entry.providerId}/${entry.model} waiting=${seconds}s reason=${entry.reasonCode}` : `${entry.providerId}/${entry.model} \u7B49\u5F85=${seconds}\u79D2 \u539F\u56E0=${entry.reasonCode}`
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (active.length === 0) {
|
|
175
|
+
return void 0;
|
|
176
|
+
}
|
|
177
|
+
const prefix = language === "en-US" ? "Active model-service cooldown" : "\u6A21\u578B\u670D\u52A1\u7B49\u5F85\u6062\u590D";
|
|
178
|
+
return `${prefix}: ${active.join("; ")}`;
|
|
179
|
+
}
|
|
180
|
+
var BREAKER_CONSTANTS = {
|
|
181
|
+
FAILURE_THRESHOLD: BREAKER_FAILURE_THRESHOLD,
|
|
182
|
+
COOLDOWN_MS: BREAKER_COOLDOWN_MS,
|
|
183
|
+
PROVIDER_ACTIVE_LIMIT,
|
|
184
|
+
RECOVERABLE_CODES
|
|
185
|
+
};
|
|
186
|
+
var RETRYABLE_KINDS = /* @__PURE__ */ new Set([
|
|
187
|
+
"gateway",
|
|
188
|
+
"transit",
|
|
189
|
+
"timeout",
|
|
190
|
+
"rate_limit"
|
|
191
|
+
]);
|
|
192
|
+
function shouldAttemptSameProviderRetry(kind) {
|
|
193
|
+
return RETRYABLE_KINDS.has(kind);
|
|
194
|
+
}
|
|
195
|
+
function getProviderErrorCode(error) {
|
|
196
|
+
if (error instanceof LinghunError) return error.code;
|
|
197
|
+
if (error instanceof Error && "code" in error && typeof error.code === "string") {
|
|
198
|
+
return error.code;
|
|
199
|
+
}
|
|
200
|
+
if (typeof error === "object" && error !== null && "code" in error && typeof error.code === "string") {
|
|
201
|
+
return error.code;
|
|
202
|
+
}
|
|
203
|
+
return "PROVIDER_ERROR";
|
|
204
|
+
}
|
|
205
|
+
var PROVIDER_RETRY_BASE_MS = 500;
|
|
206
|
+
var PROVIDER_RETRY_MAX_MS = 32e3;
|
|
207
|
+
var PROVIDER_RETRY_MAX_ATTEMPTS = 3;
|
|
208
|
+
var PROVIDER_GATE_WAIT_MS_MIN = 1e3;
|
|
209
|
+
var PROVIDER_GATE_WAIT_JITTER_MS = 2e3;
|
|
210
|
+
function sleepAbortable(ms, signal) {
|
|
211
|
+
return new Promise((resolve) => {
|
|
212
|
+
if (signal?.aborted) {
|
|
213
|
+
resolve();
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const timer = setTimeout(resolve, ms);
|
|
217
|
+
if (signal) {
|
|
218
|
+
signal.addEventListener("abort", () => {
|
|
219
|
+
clearTimeout(timer);
|
|
220
|
+
resolve();
|
|
221
|
+
}, { once: true });
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
async function* withProviderRetry(gateway, state, provider, request, signal, opts) {
|
|
226
|
+
const maxRetries = opts?.maxRetries ?? PROVIDER_RETRY_MAX_ATTEMPTS;
|
|
227
|
+
const baseDelayMs = opts?.baseDelayMs ?? PROVIDER_RETRY_BASE_MS;
|
|
228
|
+
const maxDelayMs = opts?.maxDelayMs ?? PROVIDER_RETRY_MAX_MS;
|
|
229
|
+
const model = request.model ?? "";
|
|
230
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
231
|
+
if (signal?.aborted) {
|
|
232
|
+
yield {
|
|
233
|
+
type: "error",
|
|
234
|
+
error: new LinghunError({ code: "ABORT_ERR", message: "Request aborted.", recoverable: false })
|
|
235
|
+
};
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (!opts?.skipGate) {
|
|
239
|
+
const gate = checkProviderGate(state, provider, model);
|
|
240
|
+
if (!gate.allowed) {
|
|
241
|
+
if (gate.reason === "at_capacity") {
|
|
242
|
+
await sleepAbortable(
|
|
243
|
+
PROVIDER_GATE_WAIT_MS_MIN + Math.random() * PROVIDER_GATE_WAIT_JITTER_MS,
|
|
244
|
+
signal
|
|
245
|
+
);
|
|
246
|
+
attempt -= 1;
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
if (gate.reason === "cooldown") {
|
|
250
|
+
yield {
|
|
251
|
+
type: "error",
|
|
252
|
+
error: new LinghunError({
|
|
253
|
+
code: gate.reasonCode,
|
|
254
|
+
message: `Provider ${provider}/${model} is in cooldown (${Math.ceil(gate.remainingMs / 1e3)}s remaining).`,
|
|
255
|
+
recoverable: true,
|
|
256
|
+
suggestion: "Wait for cooldown to expire, or switch provider/model with /model."
|
|
257
|
+
})
|
|
258
|
+
};
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const slotAcquired = acquireProviderSlot(state, provider, model);
|
|
264
|
+
if (!slotAcquired) {
|
|
265
|
+
await sleepAbortable(
|
|
266
|
+
PROVIDER_GATE_WAIT_MS_MIN + Math.random() * PROVIDER_GATE_WAIT_JITTER_MS,
|
|
267
|
+
signal
|
|
268
|
+
);
|
|
269
|
+
attempt -= 1;
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
let streamError;
|
|
273
|
+
let streamCompleted = false;
|
|
274
|
+
const pendingToolUses = [];
|
|
275
|
+
try {
|
|
276
|
+
for await (const event of gateway.stream(provider, request, signal ?? new AbortController().signal)) {
|
|
277
|
+
if (event.type === "error") {
|
|
278
|
+
streamError = event.error;
|
|
279
|
+
pendingToolUses.length = 0;
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
if (event.type === "tool_use") {
|
|
283
|
+
pendingToolUses.push(event);
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
yield event;
|
|
287
|
+
if (event.type === "message_stop") {
|
|
288
|
+
streamCompleted = true;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
} catch (error) {
|
|
292
|
+
streamError = error;
|
|
293
|
+
pendingToolUses.length = 0;
|
|
294
|
+
} finally {
|
|
295
|
+
releaseProviderSlot(state, provider, model);
|
|
296
|
+
}
|
|
297
|
+
if (!streamError && !streamCompleted) {
|
|
298
|
+
streamError = new LinghunError({
|
|
299
|
+
code: "PROVIDER_STREAM_ERROR",
|
|
300
|
+
message: `Provider ${provider}/${model} stream ended before message_stop.`,
|
|
301
|
+
recoverable: true
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
if (!streamError) {
|
|
305
|
+
clearProviderBreaker(state, provider, model);
|
|
306
|
+
for (const ev of pendingToolUses) yield ev;
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (signal?.aborted) {
|
|
310
|
+
yield {
|
|
311
|
+
type: "error",
|
|
312
|
+
error: new LinghunError({ code: "ABORT_ERR", message: "Request aborted.", recoverable: false })
|
|
313
|
+
};
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const kind = classifyProviderFailure(streamError);
|
|
317
|
+
const code = getProviderErrorCode(streamError);
|
|
318
|
+
recordProviderFailure(state, provider, model, code);
|
|
319
|
+
if (!shouldAttemptSameProviderRetry(kind) || attempt >= maxRetries) {
|
|
320
|
+
const error = streamError instanceof LinghunError ? streamError : new LinghunError({
|
|
321
|
+
code,
|
|
322
|
+
message: streamError instanceof Error ? streamError.message : String(streamError),
|
|
323
|
+
recoverable: kind === "gateway" || kind === "transit" || kind === "timeout"
|
|
324
|
+
});
|
|
325
|
+
yield { type: "error", error };
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
const baseDelay = Math.min(baseDelayMs * 2 ** attempt, maxDelayMs);
|
|
329
|
+
const jitter = Math.random() * 0.25 * baseDelay;
|
|
330
|
+
const delayMs = baseDelay + jitter;
|
|
331
|
+
opts?.onRetry?.({
|
|
332
|
+
attempt: attempt + 1,
|
|
333
|
+
maxAttempts: maxRetries,
|
|
334
|
+
delayMs,
|
|
335
|
+
kind,
|
|
336
|
+
code
|
|
337
|
+
});
|
|
338
|
+
await sleepAbortable(delayMs, signal);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export {
|
|
343
|
+
createProviderCircuitBreakerState,
|
|
344
|
+
makeBreakerKey,
|
|
345
|
+
isRecoverableProviderFailure,
|
|
346
|
+
checkProviderGate,
|
|
347
|
+
acquireProviderSlot,
|
|
348
|
+
releaseProviderSlot,
|
|
349
|
+
recordProviderFailure,
|
|
350
|
+
clearProviderBreaker,
|
|
351
|
+
checkProviderCooldown,
|
|
352
|
+
formatCooldownMessage,
|
|
353
|
+
formatCooldownDoctorLine,
|
|
354
|
+
BREAKER_CONSTANTS,
|
|
355
|
+
withProviderRetry
|
|
356
|
+
};
|