@iowarp/clio-coder 0.3.9 → 0.4.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/CHANGELOG.md +53 -0
- package/NOTICE +33 -0
- package/README.md +7 -2
- package/dist/{acp-7LOELQFP.js → acp-G5WJBNCT.js} +13 -12
- package/dist/{agents-FIBG2SHA.js → agents-FMV2Q5G4.js} +39 -36
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-OI4LIH2I.js → auth-3IDSJEIK.js} +16 -15
- package/dist/{builtins-AD25UL3C.js → builtins-XCZWXSC7.js} +3 -3
- package/dist/{chunk-IFBNV6H6.js → chunk-2ANTL7MR.js} +3 -3
- package/dist/{chunk-56KB5IJP.js → chunk-2OQE55CK.js} +3 -3
- package/dist/{chunk-N3PBVRTZ.js → chunk-32KWKNSF.js} +9 -7
- package/dist/{chunk-VKBMFOYV.js → chunk-36EJLSQQ.js} +23 -27
- package/dist/{chunk-465CC7FK.js → chunk-3BT2XMV4.js} +16 -13
- package/dist/{chunk-NQ6UCCOD.js → chunk-3URVFKWK.js} +7 -7
- package/dist/{chunk-WIE7ZOSW.js → chunk-3XML7CDN.js} +2 -2
- package/dist/chunk-42FMPA75.js +101 -0
- package/dist/{chunk-A2NJGIB3.js → chunk-5LXZXPKX.js} +2 -2
- package/dist/{chunk-HAY4ZE2P.js → chunk-5PSMVOLM.js} +2 -2
- package/dist/{chunk-JEQQR47K.js → chunk-6DB53AJS.js} +168 -9
- package/dist/{chunk-KV2AOLDF.js → chunk-76ONBSIA.js} +5 -25
- package/dist/{chunk-FALJGAWU.js → chunk-7MCTRUCE.js} +2 -2
- package/dist/{chunk-5T7RBWN2.js → chunk-AB44T6BB.js} +5 -5
- package/dist/chunk-B7OBL7PK.js +1405 -0
- package/dist/{chunk-B5CSFE7B.js → chunk-BBVJUZHB.js} +2 -2
- package/dist/{chunk-EQ63NRB7.js → chunk-BBVYXMFO.js} +2 -2
- package/dist/{chunk-O6I4CIEU.js → chunk-BKFJHQCA.js} +6 -6
- package/dist/chunk-BKFM6EJV.js +462 -0
- package/dist/chunk-BMS5RKQY.js +27 -0
- package/dist/{chunk-MV2VUEJC.js → chunk-BPKCPIL7.js} +2 -2
- package/dist/{chunk-TEO2TLVN.js → chunk-BUMFYQFY.js} +964 -1120
- package/dist/{chunk-BNAZZHFG.js → chunk-BYP5D4HI.js} +1 -1
- package/dist/chunk-C2LTL2W6.js +2447 -0
- package/dist/{chunk-EBOC7MT3.js → chunk-CODPRO7Q.js} +8 -8
- package/dist/{chunk-HPCTNZM2.js → chunk-CTJ4RNAA.js} +4 -4
- package/dist/{chunk-ODFEOB4F.js → chunk-CY6FY24N.js} +26 -8
- package/dist/{chunk-MIX5N5AC.js → chunk-DQITNCXG.js} +394 -154
- package/dist/{chunk-S4COXYBG.js → chunk-DYJP44XW.js} +129 -106
- package/dist/{chunk-N5XKWMDW.js → chunk-F4CKPOEQ.js} +6 -6
- package/dist/{chunk-AMKHQW3C.js → chunk-FEFIFZTL.js} +3 -3
- package/dist/{chunk-MV3K5QF2.js → chunk-GCSMB2KY.js} +2 -2
- package/dist/{chunk-7C6RYZGQ.js → chunk-GKF55TAZ.js} +3 -3
- package/dist/{chunk-B5XRQOLB.js → chunk-GR5G2PVF.js} +9 -8
- package/dist/{chunk-XDOQXGFO.js → chunk-GXNLGKAB.js} +64 -8
- package/dist/chunk-HHV2GANA.js +88 -0
- package/dist/{chunk-774ILSRL.js → chunk-HI63TFOG.js} +4 -3
- package/dist/{chunk-R7LNVMCS.js → chunk-HJJTYUHX.js} +64 -72
- package/dist/{chunk-RKRLDWD3.js → chunk-HLW2MRKE.js} +1 -1
- package/dist/{chunk-CA42X6KT.js → chunk-HWHKMHUA.js} +6 -6
- package/dist/chunk-HZHHCK24.js +1631 -0
- package/dist/{chunk-HJB5IUKP.js → chunk-I5VEOC6I.js} +12 -12
- package/dist/chunk-IBEBSCYA.js +564 -0
- package/dist/chunk-IQ7KR472.js +362 -0
- package/dist/{chunk-4H6ULJ3H.js → chunk-J4W7KFM7.js} +921 -990
- package/dist/{chunk-4LJX2PUC.js → chunk-JDG2WCRO.js} +5 -5
- package/dist/{chunk-NZU6YDNV.js → chunk-K5C3NCBD.js} +4 -4
- package/dist/{chunk-CGKSTWHD.js → chunk-K6BSR66V.js} +2 -1
- package/dist/{chunk-NNNWO6F2.js → chunk-KFZI4NIL.js} +93 -3
- package/dist/chunk-KMVISBZR.js +132 -0
- package/dist/{chunk-BVDVID7E.js → chunk-LDQ2ZF2M.js} +2 -2
- package/dist/{chunk-OEDBCISO.js → chunk-LQ3DZAMX.js} +2 -2
- package/dist/{chunk-PZ4I4JE2.js → chunk-LY4S7GJC.js} +124 -116
- package/dist/{chunk-3DUR4WUA.js → chunk-MLKNTWH2.js} +19 -19
- package/dist/chunk-NEKRRTYW.js +56 -0
- package/dist/{chunk-5DQRIYDZ.js → chunk-NHCZP4K7.js} +2 -2
- package/dist/chunk-NHLBIGRH.js +1506 -0
- package/dist/chunk-NQQH3YT7.js +302 -0
- package/dist/chunk-NYS75XW5.js +15 -0
- package/dist/{chunk-TD7UE2L5.js → chunk-O4XIVISU.js} +7 -7
- package/dist/{chunk-WXCJ7VME.js → chunk-O6TL7WWY.js} +6 -6
- package/dist/chunk-OQBA45DZ.js +97 -0
- package/dist/{chunk-LU7P4LHA.js → chunk-P3FOHJT4.js} +2 -2
- package/dist/chunk-PMZCIOCJ.js +25 -0
- package/dist/{chunk-I4HZDVNP.js → chunk-PQEFIJ36.js} +2 -2
- package/dist/{chunk-HKO36JWF.js → chunk-QBJA7R7N.js} +31 -3
- package/dist/chunk-QDC3K2U3.js +262 -0
- package/dist/{chunk-5HFBWUMU.js → chunk-QLFS5GO2.js} +4 -4
- package/dist/{chunk-GAYUJ7LE.js → chunk-QLL7ILRG.js} +41 -32
- package/dist/{chunk-LXPJXFM5.js → chunk-QREDIESB.js} +7 -7
- package/dist/chunk-QSNYB6ZV.js +195 -0
- package/dist/chunk-R346GLFC.js +31 -0
- package/dist/{chunk-VPTUJU4P.js → chunk-SJ5ZKQ4S.js} +2 -2
- package/dist/{chunk-QQ7EKM72.js → chunk-SP2RXXYO.js} +6 -54
- package/dist/chunk-SUCTJL45.js +45 -0
- package/dist/{chunk-5QKCQQ3E.js → chunk-SUW5DORT.js} +2 -2
- package/dist/chunk-T56WDKA5.js +183 -0
- package/dist/chunk-TVHHYFHE.js +255 -0
- package/dist/{chunk-IHKBWSXF.js → chunk-TZ3SGWZZ.js} +2 -2
- package/dist/{chunk-ECUO3KDP.js → chunk-U77AMWDL.js} +47 -7
- package/dist/{chunk-3UUY7R3Z.js → chunk-ULC6OTWO.js} +7 -7
- package/dist/{chunk-AEYBF3TB.js → chunk-UM7N4G5A.js} +2 -2
- package/dist/{chunk-3V5AYSEQ.js → chunk-UXMFQ54G.js} +43 -36
- package/dist/{chunk-YW7UVM5V.js → chunk-V5DHCITQ.js} +34 -1
- package/dist/{chunk-47CMYGET.js → chunk-VAZSBTKF.js} +2 -2
- package/dist/{chunk-3MRC2YSQ.js → chunk-VEO4AP2K.js} +2 -2
- package/dist/{chunk-PNY46YEY.js → chunk-VFA6GDY5.js} +47 -3
- package/dist/chunk-VO67MWHC.js +75 -0
- package/dist/{chunk-XK56QHLX.js → chunk-VPKWYKEY.js} +19 -5
- package/dist/{chunk-AD7Y7STJ.js → chunk-VYMXRQI6.js} +36 -22
- package/dist/{chunk-T3Z6VAAF.js → chunk-W5VSYASO.js} +19 -17
- package/dist/{chunk-5PVQ4SRS.js → chunk-WZR7K7ZX.js} +7 -123
- package/dist/{chunk-DG4M6ZUE.js → chunk-X3YGUTOB.js} +4 -4
- package/dist/chunk-X75E3D2N.js +686 -0
- package/dist/{chunk-P3JGPQFL.js → chunk-YDFRH54B.js} +4 -4
- package/dist/chunk-YJX4SHTD.js +40 -0
- package/dist/{chunk-ZI647VB5.js → chunk-YPI3QQCF.js} +2 -2
- package/dist/{chunk-YSEHGPCT.js → chunk-Z2RR6MAK.js} +3 -3
- package/dist/{chunk-HCBCAYZU.js → chunk-Z4TXYIEG.js} +5 -5
- package/dist/cli/index.js +47 -36
- package/dist/{clio-LT5V7SSZ.js → clio-2JXHBBY5.js} +7 -7
- package/dist/{code-nav-LMW275PA.js → code-nav-3YYRMYNF.js} +6 -6
- package/dist/{compile-cache-CVJMMODC.js → compile-cache-7FPE6PS3.js} +3 -3
- package/dist/{components-ZFA3SAER.js → components-RYZV4JGP.js} +5 -5
- package/dist/{config-RXS5T3JT.js → config-QZPCMYSO.js} +58 -50
- package/dist/{configure-2WYWSCSD.js → configure-TEGEBYCA.js} +21 -19
- package/dist/{context-I3BTOTCS.js → context-AV7OEZ4D.js} +11 -11
- package/dist/{context-MVOORGMF.js → context-E6H5RNMC.js} +49 -41
- package/dist/{context-PALKKQYL.js → context-GSXUE4CT.js} +25 -23
- package/dist/{context-clear-N2WOYZ2K.js → context-clear-SHIBYK6T.js} +48 -40
- package/dist/{context-working-set-MIEVECVZ.js → context-working-set-5ZGKPGZQ.js} +11 -10
- package/dist/{dispatch-runner-VVA4SRRH.js → dispatch-runner-EFMJT4LD.js} +88 -60
- package/dist/{docs-7LQ23DLM.js → docs-23KQS3XK.js} +5 -5
- package/dist/doctor-QOA5FNY5.js +313 -0
- package/dist/{eval-IJ5VEZDJ.js → eval-TFBYQH4H.js} +66 -64
- package/dist/eval-inventory-SXH7PDKX.js +316 -0
- package/dist/{evidence-L5APPXNV.js → evidence-ERGESKGN.js} +198 -44
- package/dist/{evolve-RGNKFJ52.js → evolve-VDXTSYCJ.js} +46 -38
- package/dist/{extensions-7WYWUX5A.js → extensions-7BGBHN57.js} +6 -6
- package/dist/{fleet-6CNVBZZP.js → fleet-2RRVDF2V.js} +189 -101
- package/dist/{fleet-commands-L2SXSYEI.js → fleet-commands-VJ726XIA.js} +10 -10
- package/dist/fleet-decisions-EPAPM3XJ.js +157 -0
- package/dist/{fleet-graph-2J3OOIPO.js → fleet-graph-JF5QOATM.js} +16 -15
- package/dist/fleet-inspect-VLY4S7QM.js +442 -0
- package/dist/{fleet-preflight-CZRJ4JP5.js → fleet-preflight-AIZUEJOY.js} +6 -5
- package/dist/{fleet-validate-C5RI6DP7.js → fleet-validate-AJRPDMDV.js} +20 -18
- package/dist/fleet-verify-JFEL2L3H.js +175 -0
- package/dist/fleet-view-ZCON35AG.js +102 -0
- package/dist/{init-VBN2ACVA.js → init-DN2WWLFE.js} +64 -56
- package/dist/install-XGLBQY5E.js +13 -0
- package/dist/interop-OZBKXAYL.js +114 -0
- package/dist/{library-JHGUMLY2.js → library-YWZG7IMW.js} +19 -18
- package/dist/{memory-K4OQIYWG.js → memory-I4C4HMLW.js} +48 -40
- package/dist/{models-2NCZUWDD.js → models-CEYXJBO6.js} +30 -28
- package/dist/{monitor-MMVTJABD.js → monitor-NZ6GCI3P.js} +53 -47
- package/dist/{orchestrator-ZKBPCHW6.js → orchestrator-GCGQ4N5I.js} +6311 -7145
- package/dist/panes-HMABYVO4.js +58 -0
- package/dist/panes-KY6W3V2E.js +103 -0
- package/dist/{paths-DBXMZMDU.js → paths-II4K7DNR.js} +5 -5
- package/dist/{reset-DD5JGOY3.js → reset-DQ6FGCSH.js} +13 -11
- package/dist/resources-BB3MVJMD.js +111 -0
- package/dist/{run-QEGNX7FL.js → run-H2GQDUER.js} +113 -82
- package/dist/{share-JKD3BQMW.js → share-GTJN6A5O.js} +18 -17
- package/dist/{skills-LMQIKDOZ.js → skills-L55TEW6R.js} +31 -24
- package/dist/{skills-eval-I7X2774U.js → skills-eval-XVXPH2JI.js} +61 -52
- package/dist/skills-inventory-S4MXPJFV.js +126 -0
- package/dist/slash-commands-ZSGASKJC.js +77 -0
- package/dist/{steer-CF5TDANS.js → steer-RZGSCY4R.js} +3 -3
- package/dist/{support-I7LOJLIF.js → support-PKEUNNQL.js} +4 -4
- package/dist/{targets-RUSR6B5Z.js → targets-NCPZ644J.js} +31 -29
- package/dist/{terminal-lease-QYVORFR4.js → terminal-lease-44SV3YCN.js} +4 -4
- package/dist/tools-DAF3DI3C.js +27 -0
- package/dist/{trace-ODOQIVIW.js → trace-FYVW2MQA.js} +149 -7
- package/dist/tui-primitives-2AKXQNZK.js +13 -0
- package/dist/{uninstall-ZJF5H5ZN.js → uninstall-DW2PNOIC.js} +5 -5
- package/dist/{upgrade-XANW3FXB.js → upgrade-3XPP6OQL.js} +26 -24
- package/dist/{usage-4H7ZRXQT.js → usage-3NLHGTU2.js} +57 -49
- package/dist/{verifiers-UZXNBZEB.js → verifiers-SSQONKRT.js} +171 -12
- package/dist/{verify-BVKWTNDL.js → verify-3U6J7FZI.js} +9 -9
- package/dist/{web-fetch-2YHJ3KTG.js → web-fetch-S7RR6GZ7.js} +3 -3
- package/dist/{wiki-generate-MY7WV2QI.js → wiki-generate-CEHYGPGQ.js} +67 -59
- package/dist/with-panes-MKB46MPQ.js +782 -0
- package/dist/worker/entry.js +101 -66
- package/docs/README.md +3 -2
- package/docs/acp.md +24 -3
- package/docs/alcf-provider.md +1 -1
- package/docs/architecture.md +2 -2
- package/docs/artifact-versions.md +4 -1
- package/docs/built-in-agents.md +1 -1
- package/docs/capacity-and-scheduling.md +43 -5
- package/docs/commands-and-modes.md +31 -2
- package/docs/configuration-and-targets.md +40 -10
- package/docs/context-engine.md +1 -1
- package/docs/development-pipeline.md +19 -0
- package/docs/dispatch-typed-intent.md +385 -0
- package/docs/documentation-coverage.md +2 -2
- package/docs/documentation-guide.md +1 -1
- package/docs/environment-variables.md +1 -0
- package/docs/eval-runner.md +1 -1
- package/docs/evals-internal.md +1 -1
- package/docs/evidence-and-memory.md +2 -2
- package/docs/evolution.md +1 -1
- package/docs/exit-codes-and-output.md +1 -1
- package/docs/extensions-and-sharing.md +25 -1
- package/docs/fleet-dispatch.md +22 -1
- package/docs/installation-and-lifecycle.md +15 -2
- package/docs/middleware-and-components.md +1 -1
- package/docs/model-catalog.md +10 -1
- package/docs/observability.md +3 -3
- package/docs/proactive-memory.md +1 -1
- package/docs/prompt-envelope-and-tools.md +1 -1
- package/docs/provider-adapter-cookbook.md +1 -1
- package/docs/safety-model.md +2 -2
- package/docs/scientific-validation.md +3 -3
- package/docs/session-lifecycle.md +1 -1
- package/docs/skills-marketplace.md +1 -1
- package/docs/tool-usage.md +18 -8
- package/docs/trace-store.md +1 -1
- package/docs/troubleshooting.md +1 -1
- package/docs/tui-design.md +1 -1
- package/docs/worker-dispatch-mechanics.md +1 -1
- package/package.json +4 -2
- package/src/cli/acp.ts +6 -2
- package/src/cli/argv.ts +25 -0
- package/src/cli/configure.ts +23 -21
- package/src/cli/doctor-panes.ts +124 -0
- package/src/cli/doctor-toolchain.ts +57 -0
- package/src/cli/doctor.ts +20 -1
- package/src/cli/eval-inventory.ts +436 -0
- package/src/cli/eval.ts +13 -0
- package/src/cli/evidence-detail.ts +88 -0
- package/src/cli/evidence-inventory.ts +183 -0
- package/src/cli/evidence.ts +30 -5
- package/src/cli/fleet-decisions.ts +69 -0
- package/src/cli/fleet-inspect.ts +334 -0
- package/src/cli/fleet-verify.ts +133 -0
- package/src/cli/fleet-view.ts +810 -0
- package/src/cli/fleet.ts +148 -37
- package/src/cli/index.ts +14 -2
- package/src/cli/interop-inspect.ts +128 -0
- package/src/cli/interop.ts +34 -0
- package/src/cli/panes.ts +35 -0
- package/src/cli/reset.ts +5 -2
- package/src/cli/run.ts +58 -0
- package/src/cli/skills-inventory.ts +185 -0
- package/src/cli/skills.ts +16 -13
- package/src/cli/tools.ts +321 -0
- package/src/cli/trace-inspect.ts +252 -0
- package/src/cli/trace.ts +23 -2
- package/src/cli/verifiers-inspect.ts +347 -0
- package/src/cli/verifiers.ts +9 -0
- package/src/core/bus-events.ts +4 -0
- package/src/core/config.ts +49 -0
- package/src/core/defaults.ts +93 -7
- package/src/core/response-schema.ts +44 -4
- package/src/core/theme-token-hex.ts +43 -0
- package/src/core/tool-names.ts +2 -1
- package/src/core/xdg.ts +1 -1
- package/src/domains/agents/fleets/build-review.md +0 -3
- package/src/domains/agents/fleets/build-test.md +0 -3
- package/src/domains/agents/result-contract-filesystem.ts +32 -0
- package/src/domains/agents/result-contract.ts +164 -35
- package/src/domains/config/classify.ts +3 -0
- package/src/domains/dispatch/admission-error.ts +9 -0
- package/src/domains/dispatch/admission.ts +22 -21
- package/src/domains/dispatch/capacity-lease.ts +21 -1
- package/src/domains/dispatch/council-topology.ts +398 -0
- package/src/domains/dispatch/extension.ts +222 -50
- package/src/domains/dispatch/fleet-node-prompt.ts +62 -0
- package/src/domains/dispatch/fleet-plan.ts +7 -2
- package/src/domains/dispatch/fleet-run.ts +64 -1
- package/src/domains/dispatch/gate-decisions.ts +11 -1
- package/src/domains/dispatch/gate-role-prompts.ts +9 -0
- package/src/domains/dispatch/gate-topology.ts +289 -0
- package/src/domains/dispatch/index.ts +19 -0
- package/src/domains/dispatch/intent-compatibility.ts +330 -0
- package/src/domains/dispatch/intent.ts +85 -1
- package/src/domains/dispatch/reservation-store.ts +24 -4
- package/src/domains/dispatch/run-event-journal-bridge.ts +149 -0
- package/src/domains/dispatch/run-event-journal.ts +598 -0
- package/src/domains/dispatch/state.ts +45 -1
- package/src/domains/dispatch/types.ts +13 -0
- package/src/domains/dispatch/validation.ts +33 -8
- package/src/domains/eval/compare/compare.ts +3 -16
- package/src/domains/eval/inventory.ts +113 -0
- package/src/domains/eval/schema/serving.ts +31 -0
- package/src/domains/evidence/store.ts +6 -0
- package/src/domains/memory/index.ts +0 -1
- package/src/domains/memory/task-memory-policy.ts +6 -10
- package/src/domains/memory/task-memory-telemetry.ts +1 -0
- package/src/domains/middleware/memory-intervention.ts +33 -21
- package/src/domains/mux/contract.ts +434 -0
- package/src/domains/mux/detect.ts +158 -0
- package/src/domains/mux/extension.ts +47 -0
- package/src/domains/mux/index.ts +96 -0
- package/src/domains/mux/manifest.ts +6 -0
- package/src/domains/mux/operations.ts +164 -0
- package/src/domains/mux/pane-registry.ts +90 -0
- package/src/domains/mux/protocol.ts +49 -0
- package/src/domains/mux/socket-client.ts +816 -0
- package/src/domains/mux/types.ts +222 -0
- package/src/domains/mux/viewer-command.ts +59 -0
- package/src/domains/mux/yazi/assets/init.lua +2 -0
- package/src/domains/mux/yazi/assets/plugins/git.yazi/LICENSE +21 -0
- package/src/domains/mux/yazi/assets/plugins/git.yazi/README.md +78 -0
- package/src/domains/mux/yazi/assets/plugins/git.yazi/main.lua +255 -0
- package/src/domains/mux/yazi/assets/plugins/git.yazi/types.lua +12 -0
- package/src/domains/mux/yazi/assets/yazi.toml +17 -0
- package/src/domains/mux/yazi/event-stream.ts +180 -0
- package/src/domains/mux/yazi/profile.ts +299 -0
- package/src/domains/mux/yazi/session.ts +228 -0
- package/src/domains/mux/yazi/theme.ts +30 -0
- package/src/domains/observability/cost.ts +21 -0
- package/src/domains/observability/index.ts +2 -0
- package/src/domains/observability/trace-store.ts +42 -0
- package/src/domains/providers/endpoint-capacity.ts +154 -22
- package/src/domains/providers/endpoint-slots-store.ts +189 -0
- package/src/domains/providers/extension.ts +20 -3
- package/src/domains/providers/index.ts +22 -0
- package/src/domains/providers/model-runtime-capabilities.ts +32 -0
- package/src/domains/providers/runtimes/boot-manifest.ts +1 -0
- package/src/domains/providers/runtimes/builtins.ts +2 -0
- package/src/domains/providers/runtimes/protocol/litellm.ts +375 -0
- package/src/domains/providers/support.ts +1 -0
- package/src/domains/providers/target-model-cache.ts +124 -0
- package/src/domains/resources/index.ts +3 -0
- package/src/domains/resources/skills/loader.ts +33 -0
- package/src/domains/safety/action-classifier.ts +6 -0
- package/src/domains/toolchain/archive.ts +175 -0
- package/src/domains/toolchain/contract.ts +28 -0
- package/src/domains/toolchain/extension.ts +47 -0
- package/src/domains/toolchain/index.ts +39 -0
- package/src/domains/toolchain/install.ts +327 -0
- package/src/domains/toolchain/manifest.ts +8 -0
- package/src/domains/toolchain/paths.ts +34 -0
- package/src/domains/toolchain/registry.ts +265 -0
- package/src/domains/toolchain/remove.ts +218 -0
- package/src/domains/toolchain/resolve.ts +182 -0
- package/src/domains/toolchain/types.ts +113 -0
- package/src/domains/toolchain/version.ts +88 -0
- package/src/engine/acp/server.ts +413 -70
- package/src/engine/acp/types.ts +19 -1
- package/src/engine/claude/sdk-module.ts +98 -0
- package/src/engine/claude/sdk-runtime.ts +19 -11
- package/src/engine/tui-primitives.ts +21 -0
- package/src/engine/tui.ts +1 -0
- package/src/engine/worker-runtime.ts +2 -13
- package/src/entry/boot-options.ts +2 -0
- package/src/entry/orchestrator.ts +103 -5
- package/src/entry/panes-activation.ts +31 -0
- package/src/entry/with-panes.ts +20 -0
- package/src/interactive/context-overlay.ts +1 -0
- package/src/interactive/cost-overlay.ts +2 -0
- package/src/interactive/council-grid.ts +1 -3
- package/src/interactive/council.ts +11 -0
- package/src/interactive/dispatch-board.ts +26 -16
- package/src/interactive/interactive-application.ts +153 -6
- package/src/interactive/interactive-input-runtime.ts +7 -0
- package/src/interactive/interactive-slash-runtime.ts +36 -6
- package/src/interactive/memory-overlay.ts +1 -0
- package/src/interactive/modal-marker.ts +170 -0
- package/src/interactive/mux-bridge.ts +214 -0
- package/src/interactive/overlay-frame.ts +58 -2
- package/src/interactive/overlay-general-openers.ts +1 -0
- package/src/interactive/overlay-key-routing.ts +14 -3
- package/src/interactive/overlay-lifecycle.ts +19 -3
- package/src/interactive/overlay-model-selectors.ts +40 -3
- package/src/interactive/overlay-permission-lifecycle.ts +90 -22
- package/src/interactive/overlay-transitions.ts +18 -4
- package/src/interactive/overlays/agents.ts +1 -0
- package/src/interactive/overlays/ask-user.ts +136 -30
- package/src/interactive/overlays/auth-dialog.ts +1 -0
- package/src/interactive/overlays/context-reset.ts +1 -0
- package/src/interactive/overlays/cwd-fallback.ts +1 -0
- package/src/interactive/overlays/decisions.ts +11 -11
- package/src/interactive/overlays/extensions.ts +1 -0
- package/src/interactive/overlays/fleet-run-approval.ts +1 -0
- package/src/interactive/overlays/handoff-review.ts +1 -0
- package/src/interactive/overlays/help-reference.ts +2 -0
- package/src/interactive/overlays/interop.ts +1 -0
- package/src/interactive/overlays/library-install-confirm.ts +1 -0
- package/src/interactive/overlays/library-tabs.ts +28 -0
- package/src/interactive/overlays/list-overlay.ts +10 -1
- package/src/interactive/overlays/message-picker.ts +1 -0
- package/src/interactive/overlays/model-scope.ts +86 -0
- package/src/interactive/overlays/model-selector.ts +1 -0
- package/src/interactive/overlays/prompts.ts +1 -0
- package/src/interactive/overlays/session-selector.ts +1 -0
- package/src/interactive/overlays/settings-sections.ts +30 -0
- package/src/interactive/overlays/settings.ts +579 -44
- package/src/interactive/overlays/side-question.ts +1 -0
- package/src/interactive/overlays/skills-hub.ts +3 -11
- package/src/interactive/overlays/tree-selector.ts +1 -0
- package/src/interactive/pane-policy.ts +46 -0
- package/src/interactive/panes-runtime.ts +292 -0
- package/src/interactive/renderers/compaction-summary.ts +29 -0
- package/src/interactive/renderers/worker-entry.ts +122 -14
- package/src/interactive/slash-commands.ts +251 -15
- package/src/interactive/tasks-overlay.ts +1 -0
- package/src/interactive/theme/tokens.ts +3 -14
- package/src/interactive/turn-context.ts +47 -2
- package/src/interactive/view/artifacts.ts +109 -1
- package/src/interactive/view/view-overlay.ts +1 -0
- package/src/interactive/watch-pane.ts +152 -0
- package/src/interactive/worker-progress.ts +7 -1
- package/src/interactive/worker-receipts.ts +19 -1
- package/src/interactive/worker-stream.ts +5 -0
- package/src/interactive/yazi-bridge.ts +444 -0
- package/src/tools/bootstrap.ts +26 -2
- package/src/tools/builtin-tool-catalog.ts +15 -0
- package/src/tools/compete-worktrees.ts +83 -2
- package/src/tools/core-bootstrap.ts +2 -1
- package/src/tools/dispatch-admission.ts +14 -3
- package/src/tools/dispatch-arguments.ts +20 -20
- package/src/tools/dispatch-run-events.ts +134 -19
- package/src/tools/dispatch-runner.ts +29 -7
- package/src/tools/dispatch-types.ts +15 -3
- package/src/tools/dispatch.ts +1 -1
- package/src/tools/executables.ts +17 -14
- package/src/tools/observation.ts +54 -4
- package/src/tools/panes-surface.ts +38 -0
- package/src/tools/panes.ts +112 -0
- package/src/tools/policy.ts +10 -1
- package/src/tools/presentation.ts +1 -0
- package/dist/chunk-D73KXYPF.js +0 -37
- package/dist/chunk-MLOK6ZOS.js +0 -2888
- package/dist/chunk-YKOFT37S.js +0 -279
- package/dist/doctor-TWBWFK5V.js +0 -165
|
@@ -5,24 +5,24 @@ import {
|
|
|
5
5
|
} from "./chunk-CFGTUFWB.js";
|
|
6
6
|
import {
|
|
7
7
|
credentialsPresent
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-P3FOHJT4.js";
|
|
9
9
|
import {
|
|
10
10
|
ceilChars,
|
|
11
11
|
estimateAgentMessageTokens,
|
|
12
12
|
toolSchemaChars
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
readSettings
|
|
16
|
-
} from "./chunk-PNY46YEY.js";
|
|
17
|
-
import {
|
|
18
|
-
sleep
|
|
19
|
-
} from "./chunk-FQ4SKYE4.js";
|
|
13
|
+
} from "./chunk-UM7N4G5A.js";
|
|
20
14
|
import {
|
|
21
15
|
getSharedBus
|
|
22
16
|
} from "./chunk-ZGVHUX3M.js";
|
|
23
17
|
import {
|
|
24
18
|
BusChannels
|
|
25
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-HLW2MRKE.js";
|
|
20
|
+
import {
|
|
21
|
+
readSettings
|
|
22
|
+
} from "./chunk-VFA6GDY5.js";
|
|
23
|
+
import {
|
|
24
|
+
sleep
|
|
25
|
+
} from "./chunk-FQ4SKYE4.js";
|
|
26
26
|
import {
|
|
27
27
|
CLIO_CONTEXT_WINDOW_WARN_BELOW,
|
|
28
28
|
CLIO_MIN_CONTEXT_WINDOW,
|
|
@@ -34,17 +34,17 @@ import {
|
|
|
34
34
|
registerBuiltinRuntimes,
|
|
35
35
|
requestLmStudioJson,
|
|
36
36
|
resolveLmStudioInstance
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-6DB53AJS.js";
|
|
38
38
|
import {
|
|
39
39
|
listKnownModelsForRuntime
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-HI63TFOG.js";
|
|
41
41
|
import {
|
|
42
42
|
authNotRequiredStatus,
|
|
43
43
|
openAuthStorage,
|
|
44
44
|
registerClioOAuthProviders,
|
|
45
45
|
resolveAuthTarget,
|
|
46
46
|
targetRequiresAuth
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-BBVYXMFO.js";
|
|
48
48
|
import {
|
|
49
49
|
withStateFileLock
|
|
50
50
|
} from "./chunk-IKCO5N3L.js";
|
|
@@ -52,10 +52,16 @@ import {
|
|
|
52
52
|
require_dist
|
|
53
53
|
} from "./chunk-APJ265NV.js";
|
|
54
54
|
import {
|
|
55
|
+
clioCacheDir,
|
|
55
56
|
clioConfigDir,
|
|
57
|
+
clioStateDir,
|
|
56
58
|
clioStatePath,
|
|
57
|
-
resolveClioDirs
|
|
58
|
-
|
|
59
|
+
resolveClioDirs,
|
|
60
|
+
stateRootRemoved
|
|
61
|
+
} from "./chunk-BYP5D4HI.js";
|
|
62
|
+
import {
|
|
63
|
+
safeResourceWrite
|
|
64
|
+
} from "./chunk-WEPFGWHJ.js";
|
|
59
65
|
import {
|
|
60
66
|
getRuntimeRegistry
|
|
61
67
|
} from "./chunk-NUGM5KR6.js";
|
|
@@ -102,6 +108,88 @@ function canonicalEndpointUrl(raw) {
|
|
|
102
108
|
}
|
|
103
109
|
}
|
|
104
110
|
|
|
111
|
+
// src/domains/providers/endpoint-slots-store.ts
|
|
112
|
+
init_esm_shims();
|
|
113
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
114
|
+
import { join } from "node:path";
|
|
115
|
+
var DEFAULT_ENDPOINT_SLOTS_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
116
|
+
var ENDPOINT_SLOTS_TTL_ENV_VAR = "CLIO_CODER_ENDPOINT_SLOTS_TTL_MS";
|
|
117
|
+
var MAX_ENDPOINT_SLOT_RECORDS = 64;
|
|
118
|
+
function endpointSlotsPath() {
|
|
119
|
+
return join(clioStateDir(), "endpoint-slots.json");
|
|
120
|
+
}
|
|
121
|
+
function endpointSlotsTtlMs(env = process.env) {
|
|
122
|
+
const raw = env[ENDPOINT_SLOTS_TTL_ENV_VAR]?.trim();
|
|
123
|
+
if (raw !== void 0 && /^[1-9]\d*$/.test(raw)) {
|
|
124
|
+
const parsed = Number(raw);
|
|
125
|
+
if (Number.isSafeInteger(parsed)) return parsed;
|
|
126
|
+
}
|
|
127
|
+
return DEFAULT_ENDPOINT_SLOTS_TTL_MS;
|
|
128
|
+
}
|
|
129
|
+
function validRecord(key, value) {
|
|
130
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
131
|
+
const record = value;
|
|
132
|
+
return record.endpointKey === key && typeof record.runtimeId === "string" && record.runtimeId.length > 0 && typeof record.slots === "number" && Number.isInteger(record.slots) && record.slots > 0 && typeof record.observedAt === "string" && Number.isFinite(Date.parse(record.observedAt));
|
|
133
|
+
}
|
|
134
|
+
function readRecords() {
|
|
135
|
+
const path = endpointSlotsPath();
|
|
136
|
+
if (!existsSync(path)) return [];
|
|
137
|
+
try {
|
|
138
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
139
|
+
if (parsed?.version !== 1 || typeof parsed.endpoints !== "object" || parsed.endpoints === null) return [];
|
|
140
|
+
return Object.entries(parsed.endpoints).filter(([key, value]) => validRecord(key, value)).map(([, value]) => ({ ...value }));
|
|
141
|
+
} catch {
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function fresh(record, nowMs, ttlMs) {
|
|
146
|
+
const observedMs = Date.parse(record.observedAt);
|
|
147
|
+
return observedMs <= nowMs && nowMs - observedMs < ttlMs;
|
|
148
|
+
}
|
|
149
|
+
function readDiscoveredEndpointSlots(options) {
|
|
150
|
+
const nowMs = options?.nowMs ?? Date.now();
|
|
151
|
+
const ttlMs = options?.ttlMs ?? endpointSlotsTtlMs();
|
|
152
|
+
const out = {};
|
|
153
|
+
for (const record of readRecords()) {
|
|
154
|
+
if (!fresh(record, nowMs, ttlMs)) continue;
|
|
155
|
+
out[record.endpointKey] = record;
|
|
156
|
+
}
|
|
157
|
+
return Object.freeze(out);
|
|
158
|
+
}
|
|
159
|
+
function writeRecords(records) {
|
|
160
|
+
const kept = [...records].sort((a, b) => Date.parse(b.observedAt) - Date.parse(a.observedAt)).slice(0, MAX_ENDPOINT_SLOT_RECORDS);
|
|
161
|
+
const file = {
|
|
162
|
+
version: 1,
|
|
163
|
+
endpoints: Object.fromEntries(kept.map((record) => [record.endpointKey, { ...record }]))
|
|
164
|
+
};
|
|
165
|
+
safeResourceWrite(endpointSlotsPath(), `${JSON.stringify(file, null, 2)}
|
|
166
|
+
`, { encoding: "utf8" });
|
|
167
|
+
}
|
|
168
|
+
async function recordDiscoveredEndpointSlots(entry, options) {
|
|
169
|
+
if (!Number.isInteger(entry.slots) || entry.slots <= 0) return;
|
|
170
|
+
if (entry.endpointKey.length === 0 || entry.runtimeId.length === 0) return;
|
|
171
|
+
if (stateRootRemoved()) return;
|
|
172
|
+
const nowMs = options?.nowMs ?? Date.now();
|
|
173
|
+
const ttlMs = options?.ttlMs ?? endpointSlotsTtlMs();
|
|
174
|
+
try {
|
|
175
|
+
await withStateFileLock(endpointSlotsPath(), () => {
|
|
176
|
+
if (stateRootRemoved()) return;
|
|
177
|
+
const kept = readRecords().filter(
|
|
178
|
+
(record) => record.endpointKey !== entry.endpointKey && fresh(record, nowMs, ttlMs)
|
|
179
|
+
);
|
|
180
|
+
kept.push({
|
|
181
|
+
endpointKey: entry.endpointKey,
|
|
182
|
+
runtimeId: entry.runtimeId,
|
|
183
|
+
slots: entry.slots,
|
|
184
|
+
observedAt: new Date(nowMs).toISOString()
|
|
185
|
+
});
|
|
186
|
+
writeRecords(kept);
|
|
187
|
+
});
|
|
188
|
+
} catch (error) {
|
|
189
|
+
options?.onError?.(error);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
105
193
|
// src/domains/providers/endpoint-capacity.ts
|
|
106
194
|
var UNBOUNDED_LOCAL_NATIVE_RUNTIMES = /* @__PURE__ */ new Set(["vllm", "sglang"]);
|
|
107
195
|
function canonicalEndpointKey(value) {
|
|
@@ -118,31 +206,80 @@ function endpointLabel(endpointKey) {
|
|
|
118
206
|
function positiveInteger(value) {
|
|
119
207
|
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : void 0;
|
|
120
208
|
}
|
|
121
|
-
function
|
|
122
|
-
const key = canonicalEndpointKey(
|
|
209
|
+
function endpointCapacityFor(input, priors = readDiscoveredEndpointSlots()) {
|
|
210
|
+
const key = canonicalEndpointKey(input.target);
|
|
123
211
|
if (key === null) return null;
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (
|
|
129
|
-
|
|
212
|
+
const label = endpointLabel(key);
|
|
213
|
+
const override = positiveInteger(input.target.maxConcurrentRequests);
|
|
214
|
+
if (override !== void 0) return { key, label, limit: override, source: "override" };
|
|
215
|
+
const discovered = positiveInteger(input.discoveredSlots);
|
|
216
|
+
if (discovered !== void 0) return { key, label, limit: discovered, source: "discovered" };
|
|
217
|
+
const prior = priors[key];
|
|
218
|
+
if (prior !== void 0 && prior.runtimeId === (input.runtime?.id ?? input.target.runtime)) {
|
|
219
|
+
return { key, label, limit: prior.slots, source: "discovered-prior" };
|
|
220
|
+
}
|
|
221
|
+
if (input.runtime?.tier !== "local-native" || UNBOUNDED_LOCAL_NATIVE_RUNTIMES.has(input.runtime.id)) return null;
|
|
222
|
+
return { key, label, limit: 1, source: "local-native-default" };
|
|
223
|
+
}
|
|
224
|
+
function endpointCapacityForStatus(status, priors = readDiscoveredEndpointSlots()) {
|
|
225
|
+
return endpointCapacityFor(
|
|
226
|
+
{
|
|
227
|
+
target: status.target,
|
|
228
|
+
runtime: status.runtime ?? null,
|
|
229
|
+
discoveredSlots: status.probeCapabilities?.parallelSlots
|
|
230
|
+
},
|
|
231
|
+
priors
|
|
232
|
+
);
|
|
130
233
|
}
|
|
131
234
|
function sourceRank(source) {
|
|
132
|
-
|
|
235
|
+
switch (source) {
|
|
236
|
+
case "override":
|
|
237
|
+
return 3;
|
|
238
|
+
case "discovered":
|
|
239
|
+
return 2;
|
|
240
|
+
case "discovered-prior":
|
|
241
|
+
return 1;
|
|
242
|
+
default:
|
|
243
|
+
return 0;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function foldCapacity(capacities, candidate) {
|
|
247
|
+
if (candidate === null) return;
|
|
248
|
+
const current = capacities[candidate.key];
|
|
249
|
+
if (current === void 0 || sourceRank(candidate.source) > sourceRank(current.source) || sourceRank(candidate.source) === sourceRank(current.source) && candidate.limit < current.limit) {
|
|
250
|
+
capacities[candidate.key] = candidate;
|
|
251
|
+
}
|
|
133
252
|
}
|
|
134
253
|
function endpointCapacitiesForStatuses(statuses) {
|
|
254
|
+
const priors = readDiscoveredEndpointSlots();
|
|
135
255
|
const capacities = {};
|
|
136
|
-
for (const status of statuses)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
256
|
+
for (const status of statuses) foldCapacity(capacities, endpointCapacityForStatus(status, priors));
|
|
257
|
+
return capacities;
|
|
258
|
+
}
|
|
259
|
+
function resolveEndpointCapacities(input) {
|
|
260
|
+
const priors = readDiscoveredEndpointSlots();
|
|
261
|
+
const capacities = {};
|
|
262
|
+
const covered = /* @__PURE__ */ new Set();
|
|
263
|
+
for (const status of input.statuses) {
|
|
264
|
+
covered.add(status.target.id);
|
|
265
|
+
foldCapacity(capacities, endpointCapacityForStatus(status, priors));
|
|
266
|
+
}
|
|
267
|
+
for (const target of input.targets ?? []) {
|
|
268
|
+
if (covered.has(target.id)) continue;
|
|
269
|
+
foldCapacity(
|
|
270
|
+
capacities,
|
|
271
|
+
endpointCapacityFor({ target, runtime: input.runtimeFor?.(target.runtime) ?? null }, priors)
|
|
272
|
+
);
|
|
143
273
|
}
|
|
144
274
|
return capacities;
|
|
145
275
|
}
|
|
276
|
+
function recordEndpointSlotsFromStatus(status, options) {
|
|
277
|
+
const key = canonicalEndpointKey(status.target);
|
|
278
|
+
const slots = positiveInteger(status.probeCapabilities?.parallelSlots);
|
|
279
|
+
const runtimeId = status.runtime?.id ?? status.target.runtime;
|
|
280
|
+
if (key === null || slots === void 0 || runtimeId === void 0) return Promise.resolve();
|
|
281
|
+
return recordDiscoveredEndpointSlots({ endpointKey: key, runtimeId, slots }, options);
|
|
282
|
+
}
|
|
146
283
|
var foregroundStreams = /* @__PURE__ */ new Map();
|
|
147
284
|
function registerForegroundStream(endpointKey) {
|
|
148
285
|
foregroundStreams.set(endpointKey, (foregroundStreams.get(endpointKey) ?? 0) + 1);
|
|
@@ -164,11 +301,11 @@ init_esm_shims();
|
|
|
164
301
|
|
|
165
302
|
// src/engine/apis/residency-lock.ts
|
|
166
303
|
init_esm_shims();
|
|
167
|
-
import { join } from "node:path";
|
|
304
|
+
import { join as join2 } from "node:path";
|
|
168
305
|
var LOCK_WAIT_MS = 12e4;
|
|
169
306
|
function lockTargetFor(targetKey) {
|
|
170
307
|
const key = canonicalEndpointKey(targetKey) ?? targetKey;
|
|
171
|
-
return
|
|
308
|
+
return join2(clioStatePath(), "residency-locks", key.replace(/[^a-zA-Z0-9._-]+/g, "_"));
|
|
172
309
|
}
|
|
173
310
|
async function withResidencyLock(targetKey, fn) {
|
|
174
311
|
return withStateFileLock(lockTargetFor(targetKey), fn, {
|
|
@@ -905,6 +1042,13 @@ function harmonyReasoningEffort(level) {
|
|
|
905
1042
|
if (level === "medium") return "medium";
|
|
906
1043
|
return "low";
|
|
907
1044
|
}
|
|
1045
|
+
var MEMORY_ALWAYS_ON_MODEL_MIN_OUTPUT_TOKENS = 4e3;
|
|
1046
|
+
function memoryInterventionModelMaxTokens(input) {
|
|
1047
|
+
const configured = Number.isSafeInteger(input.configuredMaxTokens) && input.configuredMaxTokens > 0 ? input.configuredMaxTokens : 1;
|
|
1048
|
+
const requested = input.thinkingMechanism === "always-on" ? Math.max(configured * 2, MEMORY_ALWAYS_ON_MODEL_MIN_OUTPUT_TOKENS) : configured;
|
|
1049
|
+
const modelCap = input.modelMaxTokens;
|
|
1050
|
+
return typeof modelCap === "number" && Number.isSafeInteger(modelCap) && modelCap > 0 ? Math.min(requested, modelCap) : requested;
|
|
1051
|
+
}
|
|
908
1052
|
function reasoningClassForMechanism(mechanism) {
|
|
909
1053
|
if (mechanism === "none") return "never";
|
|
910
1054
|
if (mechanism === "always-on") return "always";
|
|
@@ -1295,6 +1439,91 @@ function resolveTargetRuntimeCapabilities(target, runtime, wireModelId, capabili
|
|
|
1295
1439
|
});
|
|
1296
1440
|
}
|
|
1297
1441
|
|
|
1442
|
+
// src/domains/providers/target-model-cache.ts
|
|
1443
|
+
init_esm_shims();
|
|
1444
|
+
import { createHash } from "node:crypto";
|
|
1445
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
1446
|
+
import { join as join3 } from "node:path";
|
|
1447
|
+
var TARGET_MODEL_CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
1448
|
+
var TARGET_MODEL_CACHE_VERSION = 1;
|
|
1449
|
+
var TARGET_MODEL_CACHE_MAX_MODELS = 4096;
|
|
1450
|
+
var TARGET_MODEL_CACHE_MAX_MODEL_ID_CHARS = 1024;
|
|
1451
|
+
function targetCacheKey(targetId) {
|
|
1452
|
+
return createHash("sha256").update(targetId).digest("hex").slice(0, 24);
|
|
1453
|
+
}
|
|
1454
|
+
function targetModelSnapshotPath(targetId, cacheDir = clioCacheDir()) {
|
|
1455
|
+
return join3(cacheDir, "provider-target-models", `${targetCacheKey(targetId)}.json`);
|
|
1456
|
+
}
|
|
1457
|
+
function normalizedModels(models) {
|
|
1458
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1459
|
+
const out = [];
|
|
1460
|
+
for (const raw of models) {
|
|
1461
|
+
const model = raw.trim();
|
|
1462
|
+
if (model.length === 0 || model.length > TARGET_MODEL_CACHE_MAX_MODEL_ID_CHARS || seen.has(model)) continue;
|
|
1463
|
+
seen.add(model);
|
|
1464
|
+
out.push(model);
|
|
1465
|
+
if (out.length >= TARGET_MODEL_CACHE_MAX_MODELS) break;
|
|
1466
|
+
}
|
|
1467
|
+
return out;
|
|
1468
|
+
}
|
|
1469
|
+
function parseSnapshot(value) {
|
|
1470
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
1471
|
+
const row = value;
|
|
1472
|
+
if (row.version !== TARGET_MODEL_CACHE_VERSION) return null;
|
|
1473
|
+
if (typeof row.targetId !== "string" || row.targetId.length === 0) return null;
|
|
1474
|
+
if (typeof row.runtimeId !== "string" || row.runtimeId.length === 0) return null;
|
|
1475
|
+
if (row.url !== null && typeof row.url !== "string") return null;
|
|
1476
|
+
if (!Array.isArray(row.models) || row.models.some((model) => typeof model !== "string")) return null;
|
|
1477
|
+
if (typeof row.observedAt !== "string" || !Number.isFinite(Date.parse(row.observedAt))) return null;
|
|
1478
|
+
const models = normalizedModels(row.models);
|
|
1479
|
+
if (models.length !== row.models.length) return null;
|
|
1480
|
+
return {
|
|
1481
|
+
version: TARGET_MODEL_CACHE_VERSION,
|
|
1482
|
+
targetId: row.targetId,
|
|
1483
|
+
runtimeId: row.runtimeId,
|
|
1484
|
+
url: row.url,
|
|
1485
|
+
models,
|
|
1486
|
+
observedAt: row.observedAt
|
|
1487
|
+
};
|
|
1488
|
+
}
|
|
1489
|
+
function readTargetModelSnapshot(target, options = {}) {
|
|
1490
|
+
const path = targetModelSnapshotPath(target.id, options.cacheDir);
|
|
1491
|
+
if (!existsSync2(path)) return null;
|
|
1492
|
+
try {
|
|
1493
|
+
const snapshot = parseSnapshot(JSON.parse(readFileSync2(path, "utf8")));
|
|
1494
|
+
if (snapshot === null) return null;
|
|
1495
|
+
if (snapshot.targetId !== target.id || snapshot.runtimeId !== target.runtime) return null;
|
|
1496
|
+
if (snapshot.url !== (target.url ?? null)) return null;
|
|
1497
|
+
const observedMs = Date.parse(snapshot.observedAt);
|
|
1498
|
+
const nowMs = options.nowMs ?? Date.now();
|
|
1499
|
+
const ttlMs = options.ttlMs ?? TARGET_MODEL_CACHE_TTL_MS;
|
|
1500
|
+
if (observedMs > nowMs || nowMs - observedMs >= ttlMs) return null;
|
|
1501
|
+
return snapshot;
|
|
1502
|
+
} catch {
|
|
1503
|
+
return null;
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
function recordTargetModelSnapshot(target, models, options = {}) {
|
|
1507
|
+
if (target.id.length === 0 || target.runtime.length === 0) return false;
|
|
1508
|
+
const snapshot = {
|
|
1509
|
+
version: TARGET_MODEL_CACHE_VERSION,
|
|
1510
|
+
targetId: target.id,
|
|
1511
|
+
runtimeId: target.runtime,
|
|
1512
|
+
url: target.url ?? null,
|
|
1513
|
+
models: normalizedModels(models),
|
|
1514
|
+
observedAt: new Date(options.nowMs ?? Date.now()).toISOString()
|
|
1515
|
+
};
|
|
1516
|
+
try {
|
|
1517
|
+
safeResourceWrite(targetModelSnapshotPath(target.id, options.cacheDir), `${JSON.stringify(snapshot, null, 2)}
|
|
1518
|
+
`, {
|
|
1519
|
+
encoding: "utf8"
|
|
1520
|
+
});
|
|
1521
|
+
return true;
|
|
1522
|
+
} catch {
|
|
1523
|
+
return false;
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1298
1527
|
// src/domains/providers/eligibility.ts
|
|
1299
1528
|
init_esm_shims();
|
|
1300
1529
|
function isTargetEligibleRuntime(runtime) {
|
|
@@ -1400,6 +1629,105 @@ function canonicalizeWireModelId(status, requested) {
|
|
|
1400
1629
|
return matches.length === 1 ? matches[0] ?? requested : requested;
|
|
1401
1630
|
}
|
|
1402
1631
|
|
|
1632
|
+
// src/domains/providers/resolver.ts
|
|
1633
|
+
init_esm_shims();
|
|
1634
|
+
var GLOB_CHARS = /[*?[]/;
|
|
1635
|
+
function isThinkingLevel(token) {
|
|
1636
|
+
return VALID_THINKING_LEVELS.includes(token);
|
|
1637
|
+
}
|
|
1638
|
+
function splitThinkingSuffix(pattern) {
|
|
1639
|
+
const idx = pattern.lastIndexOf(":");
|
|
1640
|
+
if (idx === -1) return { base: pattern };
|
|
1641
|
+
const suffix = pattern.slice(idx + 1).trim();
|
|
1642
|
+
if (!isThinkingLevel(suffix)) return { base: pattern };
|
|
1643
|
+
const base = pattern.slice(0, idx).trim();
|
|
1644
|
+
return base ? { base, thinkingLevel: suffix } : { base: pattern };
|
|
1645
|
+
}
|
|
1646
|
+
function globToRegExp(glob) {
|
|
1647
|
+
let body = "^";
|
|
1648
|
+
for (let i = 0; i < glob.length; i++) {
|
|
1649
|
+
const ch = glob[i] ?? "";
|
|
1650
|
+
if (ch === "*") {
|
|
1651
|
+
body += ".*";
|
|
1652
|
+
} else if (ch === "?") {
|
|
1653
|
+
body += ".";
|
|
1654
|
+
} else if (ch === "[") {
|
|
1655
|
+
const close = glob.indexOf("]", i + 1);
|
|
1656
|
+
if (close === -1) {
|
|
1657
|
+
body += "\\[";
|
|
1658
|
+
continue;
|
|
1659
|
+
}
|
|
1660
|
+
body += `[${glob.slice(i + 1, close)}]`;
|
|
1661
|
+
i = close;
|
|
1662
|
+
} else if (/[.+^${}()|\\]/.test(ch)) {
|
|
1663
|
+
body += `\\${ch}`;
|
|
1664
|
+
} else {
|
|
1665
|
+
body += ch;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
body += "$";
|
|
1669
|
+
return new RegExp(body, "i");
|
|
1670
|
+
}
|
|
1671
|
+
function collectCandidates(providers) {
|
|
1672
|
+
const out = [];
|
|
1673
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1674
|
+
for (const status of providers.list()) {
|
|
1675
|
+
for (const model of modelIdsForStatus(status)) {
|
|
1676
|
+
const key = `${status.target.id}/${model}`;
|
|
1677
|
+
if (seen.has(key)) continue;
|
|
1678
|
+
seen.add(key);
|
|
1679
|
+
out.push({ target: status.target.id, model, full: key });
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
return out;
|
|
1683
|
+
}
|
|
1684
|
+
function pickFirst(candidates) {
|
|
1685
|
+
if (candidates.length === 0) return null;
|
|
1686
|
+
const head = candidates[0];
|
|
1687
|
+
if (!head) return null;
|
|
1688
|
+
return { ref: head, ambiguous: candidates.length > 1 };
|
|
1689
|
+
}
|
|
1690
|
+
function buildResult(pattern, pick, thinkingLevel) {
|
|
1691
|
+
if (!pick) {
|
|
1692
|
+
return { ref: null, error: `no models match pattern "${pattern}"` };
|
|
1693
|
+
}
|
|
1694
|
+
const ref = { target: pick.ref.target, model: pick.ref.model };
|
|
1695
|
+
if (thinkingLevel) ref.thinkingLevel = thinkingLevel;
|
|
1696
|
+
const result = { ref };
|
|
1697
|
+
if (pick.ambiguous) {
|
|
1698
|
+
result.warning = `pattern "${pattern}" matched multiple models; using ${pick.ref.full}`;
|
|
1699
|
+
}
|
|
1700
|
+
return result;
|
|
1701
|
+
}
|
|
1702
|
+
function resolveModelReference(rawPattern, providers) {
|
|
1703
|
+
const trimmed = rawPattern.trim();
|
|
1704
|
+
if (!trimmed) return { ref: null, error: "empty pattern" };
|
|
1705
|
+
const { base, thinkingLevel } = splitThinkingSuffix(trimmed);
|
|
1706
|
+
const candidates = collectCandidates(providers);
|
|
1707
|
+
if (candidates.length === 0) {
|
|
1708
|
+
return { ref: null, error: "no targets configured; add one with `clio-coder configure` or `clio-coder targets add`" };
|
|
1709
|
+
}
|
|
1710
|
+
const lower = base.toLowerCase();
|
|
1711
|
+
const exactFull = candidates.filter((c) => c.full.toLowerCase() === lower);
|
|
1712
|
+
if (exactFull.length > 0) return buildResult(base, pickFirst(exactFull), thinkingLevel);
|
|
1713
|
+
if (GLOB_CHARS.test(base)) {
|
|
1714
|
+
const re = globToRegExp(base);
|
|
1715
|
+
const globMatches = candidates.filter((c) => re.test(c.full) || re.test(c.model));
|
|
1716
|
+
return buildResult(base, pickFirst(globMatches), thinkingLevel);
|
|
1717
|
+
}
|
|
1718
|
+
const slashIdx = base.indexOf("/");
|
|
1719
|
+
if (slashIdx !== -1) {
|
|
1720
|
+
const ep = base.slice(0, slashIdx).toLowerCase();
|
|
1721
|
+
const mdl = base.slice(slashIdx + 1).toLowerCase();
|
|
1722
|
+
const epModel = candidates.filter((c) => c.target.toLowerCase() === ep && c.model.toLowerCase() === mdl);
|
|
1723
|
+
if (epModel.length > 0) return buildResult(base, pickFirst(epModel), thinkingLevel);
|
|
1724
|
+
}
|
|
1725
|
+
const exactModel = candidates.filter((c) => c.model.toLowerCase() === lower);
|
|
1726
|
+
if (exactModel.length > 0) return buildResult(base, pickFirst(exactModel), thinkingLevel);
|
|
1727
|
+
const partial = candidates.filter((c) => c.model.toLowerCase().includes(lower));
|
|
1728
|
+
return buildResult(base, pickFirst(partial), thinkingLevel);
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1403
1731
|
// src/domains/providers/runtime-resolution.ts
|
|
1404
1732
|
init_esm_shims();
|
|
1405
1733
|
function diagnostic(severity, code, message) {
|
|
@@ -3754,8 +4082,8 @@ function registerClioApiProviders() {
|
|
|
3754
4082
|
|
|
3755
4083
|
// src/domains/providers/knowledge-base-path.ts
|
|
3756
4084
|
init_esm_shims();
|
|
3757
|
-
import { existsSync, statSync } from "node:fs";
|
|
3758
|
-
import { delimiter, dirname, join as
|
|
4085
|
+
import { existsSync as existsSync3, statSync } from "node:fs";
|
|
4086
|
+
import { delimiter, dirname, join as join4 } from "node:path";
|
|
3759
4087
|
import { fileURLToPath } from "node:url";
|
|
3760
4088
|
var MODEL_CATALOG_OVERLAY_DIR = "model-catalog.d";
|
|
3761
4089
|
var MODEL_CATALOG_DIRS_ENV = "CLIO_CODER_MODEL_CATALOG_DIRS";
|
|
@@ -3769,19 +4097,19 @@ function isDirectory(path) {
|
|
|
3769
4097
|
function resolveProvidersModelsDir(importMetaUrl) {
|
|
3770
4098
|
const start = dirname(fileURLToPath(importMetaUrl));
|
|
3771
4099
|
const directCandidates = [
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
4100
|
+
join4(start, "models"),
|
|
4101
|
+
join4(start, "..", "domains", "providers", "models"),
|
|
4102
|
+
join4(start, "..", "providers-models")
|
|
3775
4103
|
];
|
|
3776
4104
|
for (const candidate of directCandidates) {
|
|
3777
4105
|
if (isDirectory(candidate)) return candidate;
|
|
3778
4106
|
}
|
|
3779
4107
|
let cursor = start;
|
|
3780
4108
|
for (let i = 0; i < 8; i++) {
|
|
3781
|
-
const packageJson =
|
|
3782
|
-
const sourceModels =
|
|
3783
|
-
const distModels =
|
|
3784
|
-
if (
|
|
4109
|
+
const packageJson = join4(cursor, "package.json");
|
|
4110
|
+
const sourceModels = join4(cursor, "src", "domains", "providers", "models");
|
|
4111
|
+
const distModels = join4(cursor, "dist", "providers-models");
|
|
4112
|
+
if (existsSync3(packageJson)) {
|
|
3785
4113
|
if (isDirectory(sourceModels)) return sourceModels;
|
|
3786
4114
|
if (isDirectory(distModels)) return distModels;
|
|
3787
4115
|
}
|
|
@@ -3811,8 +4139,8 @@ function resolveProviderModelCatalogDirs(importMetaUrl, options = {}) {
|
|
|
3811
4139
|
const bundled = resolveProvidersModelsDir(importMetaUrl);
|
|
3812
4140
|
const cwd = options.cwd ?? process.cwd();
|
|
3813
4141
|
const overlays = uniqueExistingDirs([
|
|
3814
|
-
|
|
3815
|
-
|
|
4142
|
+
join4(resolveClioDirs().config, MODEL_CATALOG_OVERLAY_DIR),
|
|
4143
|
+
join4(cwd, ".clio-coder", MODEL_CATALOG_OVERLAY_DIR),
|
|
3816
4144
|
...envOverlayDirs()
|
|
3817
4145
|
]);
|
|
3818
4146
|
return {
|
|
@@ -3831,7 +4159,7 @@ function resolveProviderKnowledgeBaseRoots(importMetaUrl, options = {}) {
|
|
|
3831
4159
|
|
|
3832
4160
|
// src/domains/providers/plugins.ts
|
|
3833
4161
|
init_esm_shims();
|
|
3834
|
-
import { join as
|
|
4162
|
+
import { join as join5 } from "node:path";
|
|
3835
4163
|
function extractPluginPackages(settings) {
|
|
3836
4164
|
if (!settings || typeof settings !== "object") return [];
|
|
3837
4165
|
const raw = settings.runtimePlugins;
|
|
@@ -3840,7 +4168,7 @@ function extractPluginPackages(settings) {
|
|
|
3840
4168
|
}
|
|
3841
4169
|
async function loadPluginRuntimes(registry, settings) {
|
|
3842
4170
|
const loaded = [];
|
|
3843
|
-
const pluginDir =
|
|
4171
|
+
const pluginDir = join5(clioConfigDir(), "runtimes");
|
|
3844
4172
|
const packages = extractPluginPackages(settings);
|
|
3845
4173
|
try {
|
|
3846
4174
|
const ids = await registry.loadFromDir(pluginDir, activateExternalPluginApiBridge);
|
|
@@ -3868,8 +4196,8 @@ async function loadPluginRuntimes(registry, settings) {
|
|
|
3868
4196
|
// src/domains/providers/types/knowledge-base.ts
|
|
3869
4197
|
init_esm_shims();
|
|
3870
4198
|
var import_yaml = __toESM(require_dist(), 1);
|
|
3871
|
-
import { readdirSync, readFileSync, statSync as statSync2 } from "node:fs";
|
|
3872
|
-
import { join as
|
|
4199
|
+
import { readdirSync, readFileSync as readFileSync3, statSync as statSync2 } from "node:fs";
|
|
4200
|
+
import { join as join6 } from "node:path";
|
|
3873
4201
|
var FileKnowledgeBase = class {
|
|
3874
4202
|
roots;
|
|
3875
4203
|
loaded = [];
|
|
@@ -3883,7 +4211,7 @@ var FileKnowledgeBase = class {
|
|
|
3883
4211
|
const files = collectYamlFiles(root.dir);
|
|
3884
4212
|
for (const file of files) {
|
|
3885
4213
|
const name = root.label ? `${root.label}:${file.name}` : file.name;
|
|
3886
|
-
const raw =
|
|
4214
|
+
const raw = readFileSync3(file.path, "utf8");
|
|
3887
4215
|
const parsed = (0, import_yaml.parse)(raw);
|
|
3888
4216
|
if (!Array.isArray(parsed)) {
|
|
3889
4217
|
throw new Error(`knowledge base file ${name} must be a YAML list of KnowledgeBaseEntry`);
|
|
@@ -3941,7 +4269,7 @@ function collectYamlFiles(dir, prefix = "") {
|
|
|
3941
4269
|
const out = [];
|
|
3942
4270
|
const entries = readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
3943
4271
|
for (const entry of entries) {
|
|
3944
|
-
const path =
|
|
4272
|
+
const path = join6(dir, entry.name);
|
|
3945
4273
|
const name = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
3946
4274
|
if (entry.isDirectory()) {
|
|
3947
4275
|
out.push(...collectYamlFiles(path, name));
|
|
@@ -4047,16 +4375,17 @@ function uniqueModels2(ids) {
|
|
|
4047
4375
|
}
|
|
4048
4376
|
return out;
|
|
4049
4377
|
}
|
|
4050
|
-
function discoveredModelsSource(probe, preservePreviousProbe, previous, desc) {
|
|
4378
|
+
function discoveredModelsSource(probe, preservePreviousProbe, previous, cachedModels, desc) {
|
|
4051
4379
|
if (probe?.models !== void 0) return "probe";
|
|
4052
4380
|
if (preservePreviousProbe && previous?.discoveredModels && previous.discoveredModels.length > 0) return "cache";
|
|
4381
|
+
if (cachedModels.length > 0) return "cache";
|
|
4053
4382
|
if (desc.knownModels && desc.knownModels.length > 0) return "runtime";
|
|
4054
4383
|
return "none";
|
|
4055
4384
|
}
|
|
4056
4385
|
function sameProbeIdentity(previous, next) {
|
|
4057
4386
|
return previous.id === next.id && previous.runtime === next.runtime && (previous.url ?? "") === (next.url ?? "") && (previous.defaultModel ?? "") === (next.defaultModel ?? "");
|
|
4058
4387
|
}
|
|
4059
|
-
function mergeProbeResult(desc, target, probe, previous) {
|
|
4388
|
+
function mergeProbeResult(desc, target, probe, previous, cachedModels = []) {
|
|
4060
4389
|
const probeSucceeded = probe?.ok ?? false;
|
|
4061
4390
|
const preservePrevious = !probeSucceeded && previous !== void 0 && sameProbeIdentity(previous.target, target);
|
|
4062
4391
|
const probeCapabilities = probe?.discoveredCapabilities ?? (preservePrevious ? previous.probeCapabilities : null) ?? null;
|
|
@@ -4065,12 +4394,12 @@ function mergeProbeResult(desc, target, probe, previous) {
|
|
|
4065
4394
|
const probeNotes = probe?.notes && probe.notes.length > 0 ? probe.notes : preservePrevious ? previous.probeNotes : void 0;
|
|
4066
4395
|
const probeSurfaces = probe?.surfaces ?? (preservePrevious ? previous.probeSurfaces : void 0);
|
|
4067
4396
|
const discoveredModels = uniqueModels2(
|
|
4068
|
-
probe?.models ?? (preservePrevious ? previous.discoveredModels : void 0) ?? desc.knownModels ?? []
|
|
4397
|
+
probe?.models ?? (preservePrevious ? previous.discoveredModels : void 0) ?? (cachedModels.length > 0 ? cachedModels : void 0) ?? desc.knownModels ?? []
|
|
4069
4398
|
);
|
|
4070
4399
|
const discoveredModelStates = probe?.modelStates ?? (preservePrevious ? previous.discoveredModelStates : null) ?? null;
|
|
4071
4400
|
const merge = {
|
|
4072
4401
|
discoveredModels,
|
|
4073
|
-
discoveredModelsSource: discoveredModelsSource(probe, preservePrevious, previous, desc),
|
|
4402
|
+
discoveredModelsSource: discoveredModelsSource(probe, preservePrevious, previous, cachedModels, desc),
|
|
4074
4403
|
discoveredModelStates,
|
|
4075
4404
|
probeCapabilities,
|
|
4076
4405
|
probeModelCapabilities,
|
|
@@ -4163,7 +4492,8 @@ function createProvidersBundle(context) {
|
|
|
4163
4492
|
return out2;
|
|
4164
4493
|
}
|
|
4165
4494
|
const availability = availabilityFor(desc, target, authStatusFor);
|
|
4166
|
-
const
|
|
4495
|
+
const cachedModels = readTargetModelSnapshot(target)?.models ?? [];
|
|
4496
|
+
const merge = mergeProbeResult(desc, target, probe, previous, cachedModels);
|
|
4167
4497
|
const { capabilities, contextWindowProvenance } = capabilitiesFor(desc, target, merge, kb);
|
|
4168
4498
|
const healthy = probe !== null ? probe.ok : null;
|
|
4169
4499
|
const unservedDefault = probe?.ok ? unservedDefaultModelReason(desc, target, merge) : null;
|
|
@@ -4251,6 +4581,10 @@ function createProvidersBundle(context) {
|
|
|
4251
4581
|
}
|
|
4252
4582
|
const status = buildStatus(target, desc, probeResult, previous);
|
|
4253
4583
|
statuses.set(target.id, status);
|
|
4584
|
+
if (probeResult.ok && probeResult.models !== void 0) {
|
|
4585
|
+
recordTargetModelSnapshot(target, probeResult.models);
|
|
4586
|
+
}
|
|
4587
|
+
void recordEndpointSlotsFromStatus(status);
|
|
4254
4588
|
context.bus.emit(BusChannels.ProviderHealth, { id: target.id, status });
|
|
4255
4589
|
return status;
|
|
4256
4590
|
}
|
|
@@ -4413,105 +4747,6 @@ var ProvidersManifest = {
|
|
|
4413
4747
|
dependsOn: ["config"]
|
|
4414
4748
|
};
|
|
4415
4749
|
|
|
4416
|
-
// src/domains/providers/resolver.ts
|
|
4417
|
-
init_esm_shims();
|
|
4418
|
-
var GLOB_CHARS = /[*?[]/;
|
|
4419
|
-
function isThinkingLevel(token) {
|
|
4420
|
-
return VALID_THINKING_LEVELS.includes(token);
|
|
4421
|
-
}
|
|
4422
|
-
function splitThinkingSuffix(pattern) {
|
|
4423
|
-
const idx = pattern.lastIndexOf(":");
|
|
4424
|
-
if (idx === -1) return { base: pattern };
|
|
4425
|
-
const suffix = pattern.slice(idx + 1).trim();
|
|
4426
|
-
if (!isThinkingLevel(suffix)) return { base: pattern };
|
|
4427
|
-
const base = pattern.slice(0, idx).trim();
|
|
4428
|
-
return base ? { base, thinkingLevel: suffix } : { base: pattern };
|
|
4429
|
-
}
|
|
4430
|
-
function globToRegExp(glob) {
|
|
4431
|
-
let body = "^";
|
|
4432
|
-
for (let i = 0; i < glob.length; i++) {
|
|
4433
|
-
const ch = glob[i] ?? "";
|
|
4434
|
-
if (ch === "*") {
|
|
4435
|
-
body += ".*";
|
|
4436
|
-
} else if (ch === "?") {
|
|
4437
|
-
body += ".";
|
|
4438
|
-
} else if (ch === "[") {
|
|
4439
|
-
const close = glob.indexOf("]", i + 1);
|
|
4440
|
-
if (close === -1) {
|
|
4441
|
-
body += "\\[";
|
|
4442
|
-
continue;
|
|
4443
|
-
}
|
|
4444
|
-
body += `[${glob.slice(i + 1, close)}]`;
|
|
4445
|
-
i = close;
|
|
4446
|
-
} else if (/[.+^${}()|\\]/.test(ch)) {
|
|
4447
|
-
body += `\\${ch}`;
|
|
4448
|
-
} else {
|
|
4449
|
-
body += ch;
|
|
4450
|
-
}
|
|
4451
|
-
}
|
|
4452
|
-
body += "$";
|
|
4453
|
-
return new RegExp(body, "i");
|
|
4454
|
-
}
|
|
4455
|
-
function collectCandidates(providers) {
|
|
4456
|
-
const out = [];
|
|
4457
|
-
const seen = /* @__PURE__ */ new Set();
|
|
4458
|
-
for (const status of providers.list()) {
|
|
4459
|
-
for (const model of modelIdsForStatus(status)) {
|
|
4460
|
-
const key = `${status.target.id}/${model}`;
|
|
4461
|
-
if (seen.has(key)) continue;
|
|
4462
|
-
seen.add(key);
|
|
4463
|
-
out.push({ target: status.target.id, model, full: key });
|
|
4464
|
-
}
|
|
4465
|
-
}
|
|
4466
|
-
return out;
|
|
4467
|
-
}
|
|
4468
|
-
function pickFirst(candidates) {
|
|
4469
|
-
if (candidates.length === 0) return null;
|
|
4470
|
-
const head = candidates[0];
|
|
4471
|
-
if (!head) return null;
|
|
4472
|
-
return { ref: head, ambiguous: candidates.length > 1 };
|
|
4473
|
-
}
|
|
4474
|
-
function buildResult(pattern, pick, thinkingLevel) {
|
|
4475
|
-
if (!pick) {
|
|
4476
|
-
return { ref: null, error: `no models match pattern "${pattern}"` };
|
|
4477
|
-
}
|
|
4478
|
-
const ref = { target: pick.ref.target, model: pick.ref.model };
|
|
4479
|
-
if (thinkingLevel) ref.thinkingLevel = thinkingLevel;
|
|
4480
|
-
const result = { ref };
|
|
4481
|
-
if (pick.ambiguous) {
|
|
4482
|
-
result.warning = `pattern "${pattern}" matched multiple models; using ${pick.ref.full}`;
|
|
4483
|
-
}
|
|
4484
|
-
return result;
|
|
4485
|
-
}
|
|
4486
|
-
function resolveModelReference(rawPattern, providers) {
|
|
4487
|
-
const trimmed = rawPattern.trim();
|
|
4488
|
-
if (!trimmed) return { ref: null, error: "empty pattern" };
|
|
4489
|
-
const { base, thinkingLevel } = splitThinkingSuffix(trimmed);
|
|
4490
|
-
const candidates = collectCandidates(providers);
|
|
4491
|
-
if (candidates.length === 0) {
|
|
4492
|
-
return { ref: null, error: "no targets configured; add one with `clio-coder configure` or `clio-coder targets add`" };
|
|
4493
|
-
}
|
|
4494
|
-
const lower = base.toLowerCase();
|
|
4495
|
-
const exactFull = candidates.filter((c) => c.full.toLowerCase() === lower);
|
|
4496
|
-
if (exactFull.length > 0) return buildResult(base, pickFirst(exactFull), thinkingLevel);
|
|
4497
|
-
if (GLOB_CHARS.test(base)) {
|
|
4498
|
-
const re = globToRegExp(base);
|
|
4499
|
-
const globMatches = candidates.filter((c) => re.test(c.full) || re.test(c.model));
|
|
4500
|
-
return buildResult(base, pickFirst(globMatches), thinkingLevel);
|
|
4501
|
-
}
|
|
4502
|
-
const slashIdx = base.indexOf("/");
|
|
4503
|
-
if (slashIdx !== -1) {
|
|
4504
|
-
const ep = base.slice(0, slashIdx).toLowerCase();
|
|
4505
|
-
const mdl = base.slice(slashIdx + 1).toLowerCase();
|
|
4506
|
-
const epModel = candidates.filter((c) => c.target.toLowerCase() === ep && c.model.toLowerCase() === mdl);
|
|
4507
|
-
if (epModel.length > 0) return buildResult(base, pickFirst(epModel), thinkingLevel);
|
|
4508
|
-
}
|
|
4509
|
-
const exactModel = candidates.filter((c) => c.model.toLowerCase() === lower);
|
|
4510
|
-
if (exactModel.length > 0) return buildResult(base, pickFirst(exactModel), thinkingLevel);
|
|
4511
|
-
const partial = candidates.filter((c) => c.model.toLowerCase().includes(lower));
|
|
4512
|
-
return buildResult(base, pickFirst(partial), thinkingLevel);
|
|
4513
|
-
}
|
|
4514
|
-
|
|
4515
4750
|
// src/domains/providers/index.ts
|
|
4516
4751
|
var ProvidersDomainModule = {
|
|
4517
4752
|
manifest: ProvidersManifest,
|
|
@@ -4524,8 +4759,10 @@ export {
|
|
|
4524
4759
|
resolveReservedOutputTokens,
|
|
4525
4760
|
canonicalEndpointKey,
|
|
4526
4761
|
endpointLabel,
|
|
4762
|
+
endpointCapacityFor,
|
|
4527
4763
|
endpointCapacityForStatus,
|
|
4528
4764
|
endpointCapacitiesForStatuses,
|
|
4765
|
+
resolveEndpointCapacities,
|
|
4529
4766
|
registerForegroundStream,
|
|
4530
4767
|
foregroundStreamUsage,
|
|
4531
4768
|
setResidencyNoticeSink,
|
|
@@ -4536,6 +4773,7 @@ export {
|
|
|
4536
4773
|
applyModelCapabilityPatch,
|
|
4537
4774
|
probeCapabilitiesForModel,
|
|
4538
4775
|
resolveModelCapabilities,
|
|
4776
|
+
memoryInterventionModelMaxTokens,
|
|
4539
4777
|
thinkingLevelChoiceLabel,
|
|
4540
4778
|
thinkingLevelFromChoiceLabel,
|
|
4541
4779
|
resolveModelRuntimeCapabilitiesForProviders,
|
|
@@ -4543,6 +4781,8 @@ export {
|
|
|
4543
4781
|
registerClioApiProviders,
|
|
4544
4782
|
resolveProviderKnowledgeBaseRoots,
|
|
4545
4783
|
loadPluginRuntimes,
|
|
4784
|
+
readTargetModelSnapshot,
|
|
4785
|
+
recordTargetModelSnapshot,
|
|
4546
4786
|
FileKnowledgeBase,
|
|
4547
4787
|
isOrchestratorEligibleRuntime,
|
|
4548
4788
|
isDispatchEligibleRuntime,
|
|
@@ -4560,4 +4800,4 @@ export {
|
|
|
4560
4800
|
normalizeCostProvenance,
|
|
4561
4801
|
ProvidersDomainModule
|
|
4562
4802
|
};
|
|
4563
|
-
//# sourceMappingURL=chunk-
|
|
4803
|
+
//# sourceMappingURL=chunk-DQITNCXG.js.map
|