@cjhyy/code-shell 0.1.0-alpha.0 → 0.1.0-alpha.2

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.
Files changed (281) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +8 -0
  3. package/dist/anthropic-P5VETAFI.cjs +10 -0
  4. package/dist/{anthropic-NENYS535.js → anthropic-W2GU3D76.js} +3 -2
  5. package/dist/arena/context/context-tools.d.ts +1 -1
  6. package/dist/arena/index.cjs +4 -4
  7. package/dist/arena/index.js +3 -3
  8. package/dist/arena/providers/index.d.ts +19 -3
  9. package/dist/arena/strategies/utils.d.ts +6 -1
  10. package/dist/arena/types.d.ts +10 -1
  11. package/dist/{arena-46QQ6BZQ.js → arena-ENHBHB2W.js} +5 -7
  12. package/dist/{arena-HZZZ2GJH.cjs → arena-HHDYYVHJ.cjs} +19 -21
  13. package/dist/{chunk-BE6IPRDM.js → chunk-2EUAE7AY.js} +1 -1
  14. package/dist/{chunk-WFQF3RT4.cjs → chunk-3CAZIWUA.cjs} +11 -8
  15. package/dist/{chunk-J5XW6UYL.js → chunk-5C5HIOML.js} +63 -4
  16. package/dist/chunk-75E4BBFC.js +224 -0
  17. package/dist/{chunk-ZJV3YSY3.cjs → chunk-BUJ5KYCI.cjs} +53 -11
  18. package/dist/{chunk-BMH65OVB.cjs → chunk-C7C7ZZY4.cjs} +8 -8
  19. package/dist/{chunk-KO2FPF7G.js → chunk-F5BS3GUC.js} +20 -2
  20. package/dist/chunk-FA5KD34T.js +54 -0
  21. package/dist/chunk-FV2ARONZ.cjs +224 -0
  22. package/dist/chunk-G76E5FOB.cjs +54 -0
  23. package/dist/{chunk-DICG4AB7.cjs → chunk-GZBD6QRS.cjs} +42 -3
  24. package/dist/{chunk-FVP7XJGS.cjs → chunk-HOXQLX5R.cjs} +406 -196
  25. package/dist/{chunk-4PKZPFCD.js → chunk-I57ZD5IQ.js} +47 -14
  26. package/dist/{chunk-7RMAR2Y3.js → chunk-ID6EJUHP.js} +1959 -473
  27. package/dist/chunk-JHNCK7JP.cjs +202 -0
  28. package/dist/{chunk-R32DJSJE.cjs → chunk-JHXNOB5G.cjs} +8 -5
  29. package/dist/{chunk-UK2SU23S.cjs → chunk-KOGV6PDQ.cjs} +20 -2
  30. package/dist/{chunk-VKGNCYRL.js → chunk-LMEKCQX4.js} +95 -13
  31. package/dist/{chunk-3EAEC566.cjs → chunk-M2QI5X3X.cjs} +51 -18
  32. package/dist/{chunk-YZ25SSWJ.js → chunk-M2SVOKC6.js} +46 -4
  33. package/dist/chunk-OMRGA6TI.js +4753 -0
  34. package/dist/{chunk-NG73UR3L.cjs → chunk-OP57WUWQ.cjs} +23 -1
  35. package/dist/{chunk-ZXYDDJEJ.js → chunk-OUC2DFA7.js} +2 -2
  36. package/dist/{chunk-6JOOLG6F.js → chunk-REFCCVDM.js} +5 -2
  37. package/dist/{chunk-O6F2EF2Z.js → chunk-SCDKLTN3.js} +41 -2
  38. package/dist/{chunk-BHGIJ2DJ.js → chunk-SW3L7HIM.js} +6 -3
  39. package/dist/chunk-TATCTZSB.cjs +4753 -0
  40. package/dist/{chunk-QHDYFC5U.cjs → chunk-VWFET3MG.cjs} +2132 -646
  41. package/dist/{chunk-3EUDE77E.cjs → chunk-X2DNIMPC.cjs} +19 -19
  42. package/dist/{chunk-SQZHPD3S.js → chunk-Y7TSCDF6.js} +297 -87
  43. package/dist/{chunk-WHRTARDJ.cjs → chunk-YAFCN7ZW.cjs} +112 -30
  44. package/dist/{chunk-LRAY5IYC.cjs → chunk-YD7XTI7T.cjs} +65 -6
  45. package/dist/{chunk-S74VVJBF.js → chunk-ZLPJJZUW.js} +23 -1
  46. package/dist/chunk-ZRVPCXI7.js +202 -0
  47. package/dist/cli/commands/builtin/advanced-commands.d.ts +1 -1
  48. package/dist/cli/commands/builtin/extra-commands.d.ts +2 -2
  49. package/dist/cli/commands/builtin/more-commands.d.ts +1 -3
  50. package/dist/cli/commands/registry.d.ts +8 -0
  51. package/dist/cli/cost-tracker.d.ts +6 -0
  52. package/dist/cli/main.cjs +3576 -2036
  53. package/dist/cli/main.js +3613 -2073
  54. package/dist/cli/onboarding.d.ts +67 -14
  55. package/dist/client-base-TOVE25FA.js +9 -0
  56. package/dist/client-base-VDDIADAC.cjs +9 -0
  57. package/dist/compaction-D3KV2NWY.cjs +31 -0
  58. package/dist/{compaction-CCHWA4G6.js → compaction-YNWCEF7B.js} +1 -2
  59. package/dist/context/manager.d.ts +9 -0
  60. package/dist/data/openrouter-models.d.ts +35 -0
  61. package/dist/data/openrouter-sync.d.ts +16 -0
  62. package/dist/{devtools-KIY3LWQJ.js → devtools-IRQQPIRY.js} +1 -1
  63. package/dist/{devtools-LRP47DDV.cjs → devtools-WTC3NFNE.cjs} +1 -1
  64. package/dist/engine/engine.d.ts +39 -4
  65. package/dist/engine/turn-loop.d.ts +13 -4
  66. package/dist/engine/turn-state.d.ts +6 -0
  67. package/dist/index.cjs +19 -28
  68. package/dist/index.d.ts +1 -1
  69. package/dist/index.js +28 -37
  70. package/dist/llm/client-base.d.ts +7 -0
  71. package/dist/llm/model-pool.d.ts +4 -0
  72. package/dist/logging/logger.d.ts +69 -8
  73. package/dist/manager-FWLOVEEK.cjs +7 -0
  74. package/dist/manager-GEXJLOIS.js +7 -0
  75. package/dist/{mcp-manager-OKXHHWYR.js → mcp-manager-37GQLFGX.js} +2 -2
  76. package/dist/mcp-manager-U77NEXBY.cjs +8 -0
  77. package/dist/memory-ADGOWADP.cjs +9 -0
  78. package/dist/memory-EPFDBPII.js +9 -0
  79. package/dist/native-ts/yoga-layout/index.d.ts +2 -2
  80. package/dist/{openai-5HQGBL4L.js → openai-RXU5URYI.js} +3 -2
  81. package/dist/openai-SQW4H2K4.cjs +10 -0
  82. package/dist/openrouter-models-OL725CL6.js +15 -0
  83. package/dist/openrouter-models-UM3AOGZ4.cjs +15 -0
  84. package/dist/openrouter-sync-CWD5VNW2.js +11 -0
  85. package/dist/openrouter-sync-HYZZC6RX.cjs +11 -0
  86. package/dist/product/index.cjs +12 -16
  87. package/dist/product/index.js +11 -15
  88. package/dist/product/types.d.ts +2 -7
  89. package/dist/protocol/types.d.ts +11 -3
  90. package/dist/{ink → render}/hooks/use-input.d.ts +1 -1
  91. package/dist/run/EngineRunner.d.ts +3 -1
  92. package/dist/run/RunManager.d.ts +6 -0
  93. package/dist/run/factory.d.ts +7 -1
  94. package/dist/run/index.cjs +12 -16
  95. package/dist/run/index.js +11 -15
  96. package/dist/session/memory.d.ts +23 -3
  97. package/dist/session/session-manager.d.ts +4 -1
  98. package/dist/{session-manager-UQKB564H.cjs → session-manager-HRSKENKB.cjs} +2 -2
  99. package/dist/{session-manager-JIIBCFTC.js → session-manager-NEKFEHF3.js} +1 -1
  100. package/dist/settings/manager.d.ts +9 -0
  101. package/dist/settings/schema.d.ts +48 -39
  102. package/dist/{tool-summary-J2ICNMWP.js → tool-summary-2RUFL5QK.js} +1 -1
  103. package/dist/{tool-summary-5P2GKRA4.cjs → tool-summary-RYNR4DDB.cjs} +2 -2
  104. package/dist/tool-system/builtin/agent-registry.d.ts +36 -0
  105. package/dist/tool-system/builtin/agent.d.ts +7 -26
  106. package/dist/tool-system/builtin/apply-patch/applier.d.ts +26 -0
  107. package/dist/tool-system/builtin/apply-patch/index.d.ts +19 -0
  108. package/dist/tool-system/builtin/apply-patch/parser.d.ts +17 -0
  109. package/dist/tool-system/builtin/apply-patch/seek-sequence.d.ts +18 -0
  110. package/dist/tool-system/builtin/apply-patch/types.d.ts +49 -0
  111. package/dist/tool-system/builtin/arena.d.ts +18 -5
  112. package/dist/tool-system/builtin/ask-user.d.ts +6 -6
  113. package/dist/tool-system/builtin/index.d.ts +11 -1
  114. package/dist/tool-system/builtin/tool-search.d.ts +2 -3
  115. package/dist/tool-system/context.d.ts +74 -0
  116. package/dist/tool-system/executor.d.ts +16 -0
  117. package/dist/tool-system/permission.d.ts +40 -5
  118. package/dist/tool-system/registry.d.ts +8 -0
  119. package/dist/types.d.ts +34 -1
  120. package/dist/ui/App.d.ts +1 -1
  121. package/dist/ui/components/AgentBlock.d.ts +1 -1
  122. package/dist/ui/components/AskUserPrompt.d.ts +7 -0
  123. package/dist/ui/components/MessageContent.d.ts +7 -3
  124. package/dist/ui/components/ModelManager.d.ts +35 -0
  125. package/dist/ui/components/ModelSelector.d.ts +10 -0
  126. package/dist/ui/components/OnboardingPrompt.d.ts +7 -0
  127. package/dist/ui/components/PermissionPrompt.d.ts +5 -2
  128. package/dist/ui/components/SessionPicker.d.ts +14 -0
  129. package/dist/ui/components/StatusLine.d.ts +4 -2
  130. package/dist/ui/components/ThemedBox.d.ts +1 -1
  131. package/dist/ui/components/ToolCall.d.ts +8 -1
  132. package/dist/ui/components/WelcomeTips.d.ts +5 -0
  133. package/dist/ui/onboarding-runner.d.ts +2 -0
  134. package/dist/ui/store.d.ts +1 -0
  135. package/dist/{updater-URVNPDPW.cjs → updater-M7L42ASZ.cjs} +4 -4
  136. package/dist/{updater-AVD4LKTQ.js → updater-ZRTONIR4.js} +4 -4
  137. package/dist/utils/debug.d.ts +17 -33
  138. package/package.json +4 -4
  139. package/dist/anthropic-XMTTVNSH.cjs +0 -9
  140. package/dist/bridge-4ZRXVWBN.js +0 -98
  141. package/dist/bridge-W476QDFH.cjs +0 -98
  142. package/dist/chunk-4RRUP4MM.js +0 -86
  143. package/dist/chunk-4SFPFHMG.js +0 -132
  144. package/dist/chunk-5LHVI777.cjs +0 -246
  145. package/dist/chunk-6ZIROYXX.js +0 -207
  146. package/dist/chunk-C7JBCO5V.js +0 -80
  147. package/dist/chunk-CSO5EOEP.cjs +0 -132
  148. package/dist/chunk-FGZGCFJX.cjs +0 -207
  149. package/dist/chunk-HD7MT5XU.cjs +0 -86
  150. package/dist/chunk-IMMTBZ33.cjs +0 -63
  151. package/dist/chunk-JT2WSQSR.cjs +0 -335
  152. package/dist/chunk-NZ4DQ72D.cjs +0 -664
  153. package/dist/chunk-OG4MIQJ6.js +0 -335
  154. package/dist/chunk-WRZJUQ5Z.js +0 -664
  155. package/dist/chunk-X4HAERTQ.js +0 -63
  156. package/dist/chunk-XHC2JMEC.cjs +0 -80
  157. package/dist/chunk-ZRSSGYA5.js +0 -246
  158. package/dist/compaction-44I55TLI.cjs +0 -32
  159. package/dist/coordinator-5HY7ALO2.js +0 -7
  160. package/dist/coordinator-INDLPVMF.cjs +0 -7
  161. package/dist/cost-tracker-IWYAUPXH.js +0 -9
  162. package/dist/cost-tracker-JXTJQQWE.cjs +0 -9
  163. package/dist/loader-DXFSUB4R.cjs +0 -91
  164. package/dist/loader-J5UID6CV.js +0 -91
  165. package/dist/manager-ETWDOCHN.cjs +0 -9
  166. package/dist/manager-HGMQNEJB.cjs +0 -11
  167. package/dist/manager-HUAQOORS.js +0 -9
  168. package/dist/manager-VJIZ2CQC.js +0 -11
  169. package/dist/mcp-manager-G4G2QASE.cjs +0 -8
  170. package/dist/memory-AP747G5H.js +0 -7
  171. package/dist/memory-BH3BYUN5.cjs +0 -7
  172. package/dist/onboarding-6WEPV7C2.js +0 -11
  173. package/dist/onboarding-QM5DY2TU.cjs +0 -11
  174. package/dist/openai-656VWUQW.cjs +0 -9
  175. package/dist/skills-63RBYQRX.js +0 -13
  176. package/dist/skills-V3BPLW3D.cjs +0 -13
  177. package/dist/token-counter-CHAXW5O7.cjs +0 -13
  178. package/dist/token-counter-DSOZGZ5Q.js +0 -13
  179. package/dist/utils/log.d.ts +0 -56
  180. package/dist/voice-KTZ7PAGO.js +0 -80
  181. package/dist/voice-KZE25GKB.cjs +0 -80
  182. /package/dist/{ink → render}/Ansi.d.ts +0 -0
  183. /package/dist/{ink → render}/bidi.d.ts +0 -0
  184. /package/dist/{ink → render}/clearTerminal.d.ts +0 -0
  185. /package/dist/{ink → render}/colorize.d.ts +0 -0
  186. /package/dist/{ink → render}/components/AlternateScreen.d.ts +0 -0
  187. /package/dist/{ink → render}/components/App.d.ts +0 -0
  188. /package/dist/{ink → render}/components/AppContext.d.ts +0 -0
  189. /package/dist/{ink → render}/components/Box.d.ts +0 -0
  190. /package/dist/{ink → render}/components/Button.d.ts +0 -0
  191. /package/dist/{ink → render}/components/ClockContext.d.ts +0 -0
  192. /package/dist/{ink → render}/components/CursorDeclarationContext.d.ts +0 -0
  193. /package/dist/{ink → render}/components/ErrorOverview.d.ts +0 -0
  194. /package/dist/{ink → render}/components/Link.d.ts +0 -0
  195. /package/dist/{ink → render}/components/Newline.d.ts +0 -0
  196. /package/dist/{ink → render}/components/NoSelect.d.ts +0 -0
  197. /package/dist/{ink → render}/components/RawAnsi.d.ts +0 -0
  198. /package/dist/{ink → render}/components/ScrollBox.d.ts +0 -0
  199. /package/dist/{ink → render}/components/Spacer.d.ts +0 -0
  200. /package/dist/{ink → render}/components/StdinContext.d.ts +0 -0
  201. /package/dist/{ink → render}/components/TerminalFocusContext.d.ts +0 -0
  202. /package/dist/{ink → render}/components/TerminalSizeContext.d.ts +0 -0
  203. /package/dist/{ink → render}/components/Text.d.ts +0 -0
  204. /package/dist/{ink → render}/constants.d.ts +0 -0
  205. /package/dist/{ink → render}/cursor.d.ts +0 -0
  206. /package/dist/{ink → render}/devtools.d.ts +0 -0
  207. /package/dist/{ink → render}/dom.d.ts +0 -0
  208. /package/dist/{ink → render}/events/click-event.d.ts +0 -0
  209. /package/dist/{ink → render}/events/dispatcher.d.ts +0 -0
  210. /package/dist/{ink → render}/events/emitter.d.ts +0 -0
  211. /package/dist/{ink → render}/events/event-handlers.d.ts +0 -0
  212. /package/dist/{ink → render}/events/event.d.ts +0 -0
  213. /package/dist/{ink → render}/events/focus-event.d.ts +0 -0
  214. /package/dist/{ink → render}/events/input-event.d.ts +0 -0
  215. /package/dist/{ink → render}/events/keyboard-event.d.ts +0 -0
  216. /package/dist/{ink → render}/events/paste-event.d.ts +0 -0
  217. /package/dist/{ink → render}/events/resize-event.d.ts +0 -0
  218. /package/dist/{ink → render}/events/terminal-event.d.ts +0 -0
  219. /package/dist/{ink → render}/events/terminal-focus-event.d.ts +0 -0
  220. /package/dist/{ink → render}/focus.d.ts +0 -0
  221. /package/dist/{ink → render}/frame.d.ts +0 -0
  222. /package/dist/{ink → render}/get-max-width.d.ts +0 -0
  223. /package/dist/{ink → render}/hit-test.d.ts +0 -0
  224. /package/dist/{ink → render}/hooks/use-animation-frame.d.ts +0 -0
  225. /package/dist/{ink → render}/hooks/use-app.d.ts +0 -0
  226. /package/dist/{ink → render}/hooks/use-declared-cursor.d.ts +0 -0
  227. /package/dist/{ink → render}/hooks/use-interval.d.ts +0 -0
  228. /package/dist/{ink → render}/hooks/use-search-highlight.d.ts +0 -0
  229. /package/dist/{ink → render}/hooks/use-selection.d.ts +0 -0
  230. /package/dist/{ink → render}/hooks/use-stdin.d.ts +0 -0
  231. /package/dist/{ink → render}/hooks/use-tab-status.d.ts +0 -0
  232. /package/dist/{ink → render}/hooks/use-terminal-focus.d.ts +0 -0
  233. /package/dist/{ink → render}/hooks/use-terminal-title.d.ts +0 -0
  234. /package/dist/{ink → render}/hooks/use-terminal-viewport.d.ts +0 -0
  235. /package/dist/{ink → render}/index.d.ts +0 -0
  236. /package/dist/{ink → render}/ink.d.ts +0 -0
  237. /package/dist/{ink → render}/instances.d.ts +0 -0
  238. /package/dist/{ink → render}/layout/engine.d.ts +0 -0
  239. /package/dist/{ink → render}/layout/geometry.d.ts +0 -0
  240. /package/dist/{ink → render}/layout/node.d.ts +0 -0
  241. /package/dist/{ink → render}/layout/yoga.d.ts +0 -0
  242. /package/dist/{ink → render}/line-width-cache.d.ts +0 -0
  243. /package/dist/{ink → render}/log-update.d.ts +0 -0
  244. /package/dist/{ink → render}/measure-element.d.ts +0 -0
  245. /package/dist/{ink → render}/measure-text.d.ts +0 -0
  246. /package/dist/{ink → render}/node-cache.d.ts +0 -0
  247. /package/dist/{ink → render}/optimizer.d.ts +0 -0
  248. /package/dist/{ink → render}/output.d.ts +0 -0
  249. /package/dist/{ink → render}/parse-keypress.d.ts +0 -0
  250. /package/dist/{ink → render}/reconciler.d.ts +0 -0
  251. /package/dist/{ink → render}/render-border.d.ts +0 -0
  252. /package/dist/{ink → render}/render-node-to-output.d.ts +0 -0
  253. /package/dist/{ink → render}/render-to-screen.d.ts +0 -0
  254. /package/dist/{ink → render}/renderer.d.ts +0 -0
  255. /package/dist/{ink → render}/root.d.ts +0 -0
  256. /package/dist/{ink → render}/screen.d.ts +0 -0
  257. /package/dist/{ink → render}/searchHighlight.d.ts +0 -0
  258. /package/dist/{ink → render}/selection.d.ts +0 -0
  259. /package/dist/{ink → render}/squash-text-nodes.d.ts +0 -0
  260. /package/dist/{ink → render}/stringWidth.d.ts +0 -0
  261. /package/dist/{ink → render}/styles.d.ts +0 -0
  262. /package/dist/{ink → render}/supports-hyperlinks.d.ts +0 -0
  263. /package/dist/{ink → render}/tabstops.d.ts +0 -0
  264. /package/dist/{ink → render}/terminal-focus-state.d.ts +0 -0
  265. /package/dist/{ink → render}/terminal-querier.d.ts +0 -0
  266. /package/dist/{ink → render}/terminal.d.ts +0 -0
  267. /package/dist/{ink → render}/termio/ansi.d.ts +0 -0
  268. /package/dist/{ink → render}/termio/csi.d.ts +0 -0
  269. /package/dist/{ink → render}/termio/dec.d.ts +0 -0
  270. /package/dist/{ink → render}/termio/esc.d.ts +0 -0
  271. /package/dist/{ink → render}/termio/osc.d.ts +0 -0
  272. /package/dist/{ink → render}/termio/parser.d.ts +0 -0
  273. /package/dist/{ink → render}/termio/sgr.d.ts +0 -0
  274. /package/dist/{ink → render}/termio/tokenize.d.ts +0 -0
  275. /package/dist/{ink → render}/termio/types.d.ts +0 -0
  276. /package/dist/{ink → render}/termio.d.ts +0 -0
  277. /package/dist/{ink → render}/useTerminalNotification.d.ts +0 -0
  278. /package/dist/{ink → render}/warn.d.ts +0 -0
  279. /package/dist/{ink → render}/widest-line.d.ts +0 -0
  280. /package/dist/{ink → render}/wrap-text.d.ts +0 -0
  281. /package/dist/{ink → render}/wrapAnsi.d.ts +0 -0
@@ -1,246 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
2
-
3
- var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
4
-
5
- // src/cli/cost-tracker.ts
6
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
7
- var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
8
- function pricing(input, output) {
9
- return { input, output, cacheRead: input * 0.1, cacheWrite: input * 1.25 };
10
- }
11
- var MODEL_PRICING = {
12
- // Anthropic (per 1M tokens, USD)
13
- "claude-opus-4.6": { input: 15, output: 75, cacheRead: 1.5, cacheWrite: 18.75 },
14
- "claude-opus-4-6": { input: 15, output: 75, cacheRead: 1.5, cacheWrite: 18.75 },
15
- // alias
16
- "claude-opus-4.5": { input: 15, output: 75, cacheRead: 1.5, cacheWrite: 18.75 },
17
- "claude-opus-4.1": { input: 15, output: 75, cacheRead: 1.5, cacheWrite: 18.75 },
18
- "claude-opus-4": { input: 15, output: 75, cacheRead: 1.5, cacheWrite: 18.75 },
19
- "claude-sonnet-4.6": { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
20
- "claude-sonnet-4-6": { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
21
- // alias
22
- "claude-sonnet-4.5": { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
23
- "claude-sonnet-4": { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
24
- "claude-3.7-sonnet": { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
25
- "claude-3-7-sonnet": { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
26
- "claude-3.5-haiku": { input: 0.8, output: 4, cacheRead: 0.08, cacheWrite: 1 },
27
- "claude-haiku-4.5": { input: 1, output: 5, cacheRead: 0.1, cacheWrite: 1.25 },
28
- "claude-haiku-4-5": { input: 1, output: 5, cacheRead: 0.1, cacheWrite: 1.25 },
29
- // alias
30
- // OpenAI
31
- "gpt-5.4": pricing(5, 20),
32
- "gpt-5.4-mini": pricing(1.5, 6),
33
- "gpt-5.4-pro": pricing(10, 40),
34
- "gpt-5": pricing(5, 20),
35
- "gpt-4o": pricing(2.5, 10),
36
- "gpt-4o-mini": pricing(0.15, 0.6),
37
- "gpt-4.1": pricing(2, 8),
38
- "gpt-4.1-mini": pricing(0.4, 1.6),
39
- "o4-mini": pricing(1.1, 4.4),
40
- "o3": pricing(10, 40),
41
- "o3-mini": pricing(1.1, 4.4),
42
- // Google
43
- "gemini-2.5-pro": pricing(1.25, 10),
44
- "gemini-2.5-pro-preview": pricing(1.25, 10),
45
- "gemini-2.5-flash": pricing(0.15, 0.6),
46
- "gemini-3.1-pro-preview": pricing(2, 10),
47
- "gemini-3-flash-preview": pricing(0.15, 0.6),
48
- "gemini-2.0-flash": pricing(0.1, 0.4),
49
- // DeepSeek
50
- "deepseek-v3.2": pricing(0.14, 0.28),
51
- "deepseek-chat": pricing(0.14, 0.28),
52
- "deepseek-r1": pricing(0.55, 2.19),
53
- "deepseek-reasoner": pricing(0.55, 2.19),
54
- // Qwen
55
- "qwen3-coder": pricing(0.3, 0.6),
56
- "qwen3-235b-a22b": pricing(0.3, 1.2),
57
- "qwen3-30b-a3b": pricing(0.1, 0.3),
58
- "qwen3-max": pricing(0.5, 2),
59
- // Meta
60
- "llama-4-maverick": pricing(0.2, 0.8),
61
- "llama-4-scout": pricing(0.15, 0.4),
62
- // Mistral
63
- "devstral-medium": pricing(0.5, 1.5),
64
- "mistral-large": pricing(2, 6),
65
- "devstral-small": pricing(0.1, 0.3)
66
- };
67
- var DEFAULT_PRICING = pricing(3, 15);
68
- function getCanonicalName(model) {
69
- const slashIdx = model.lastIndexOf("/");
70
- const base = slashIdx >= 0 ? model.slice(slashIdx + 1) : model;
71
- return base.replace(/-\d{8}$/, "");
72
- }
73
- var CostTracker = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this); }
74
- __init() {this.records = []}
75
- __init2() {this.sessionStart = Date.now()}
76
- __init3() {this._hasUnknownModel = false}
77
- record(model, promptTokens, completionTokens, isSubAgent = false, cacheReadTokens = 0, cacheWriteTokens = 0) {
78
- const canonical = getCanonicalName(model);
79
- if (!MODEL_PRICING[canonical] && !MODEL_PRICING[model]) {
80
- this._hasUnknownModel = true;
81
- }
82
- this.records.push({
83
- model: canonical,
84
- promptTokens,
85
- completionTokens,
86
- cacheReadTokens,
87
- cacheWriteTokens,
88
- totalTokens: promptTokens + completionTokens,
89
- timestamp: Date.now(),
90
- isSubAgent
91
- });
92
- }
93
- getTotalTokens() {
94
- let prompt = 0;
95
- let completion = 0;
96
- for (const r of this.records) {
97
- prompt += r.promptTokens;
98
- completion += r.completionTokens;
99
- }
100
- return { prompt, completion, total: prompt + completion };
101
- }
102
- getEstimatedCost() {
103
- let totalCost = 0;
104
- for (const r of this.records) {
105
- const p = _nullishCoalesce(MODEL_PRICING[r.model], () => ( DEFAULT_PRICING));
106
- const uncachedInput = Math.max(0, r.promptTokens - r.cacheReadTokens - r.cacheWriteTokens);
107
- totalCost += uncachedInput / 1e6 * p.input;
108
- totalCost += r.completionTokens / 1e6 * p.output;
109
- totalCost += r.cacheReadTokens / 1e6 * p.cacheRead;
110
- totalCost += r.cacheWriteTokens / 1e6 * p.cacheWrite;
111
- }
112
- return totalCost;
113
- }
114
- getRequestCount() {
115
- return this.records.length;
116
- }
117
- getSessionDuration() {
118
- return Date.now() - this.sessionStart;
119
- }
120
- /** Estimate cost for a specific set of tokens without recording them. */
121
- estimateForTokens(model, promptTokens, completionTokens, cacheReadTokens = 0, cacheWriteTokens = 0) {
122
- const canonical = getCanonicalName(model);
123
- const p = _nullishCoalesce(_nullishCoalesce(MODEL_PRICING[canonical], () => ( MODEL_PRICING[model])), () => ( DEFAULT_PRICING));
124
- const uncachedInput = Math.max(0, promptTokens - cacheReadTokens - cacheWriteTokens);
125
- return uncachedInput / 1e6 * p.input + completionTokens / 1e6 * p.output + cacheReadTokens / 1e6 * p.cacheRead + cacheWriteTokens / 1e6 * p.cacheWrite;
126
- }
127
- /**
128
- * Get total cache token counts.
129
- */
130
- getCacheTokens() {
131
- let cacheRead = 0;
132
- let cacheWrite = 0;
133
- for (const r of this.records) {
134
- cacheRead += r.cacheReadTokens;
135
- cacheWrite += r.cacheWriteTokens;
136
- }
137
- return { cacheRead, cacheWrite };
138
- }
139
- /**
140
- * Format a styled cost summary for terminal display.
141
- */
142
- formatSummary() {
143
- const tokens = this.getTotalTokens();
144
- const cache = this.getCacheTokens();
145
- const cost = this.getEstimatedCost();
146
- const requests = this.getRequestCount();
147
- const duration = this.getSessionDuration();
148
- const lines = [];
149
- lines.push(` ${_chalk2.default.bold.cyan("Cost Summary")}`);
150
- lines.push(_chalk2.default.dim(" \u2500".repeat(25)));
151
- lines.push(` ${_chalk2.default.dim("Requests:")} ${_chalk2.default.white(String(requests))}`);
152
- lines.push(` ${_chalk2.default.dim("Input tokens:")} ${_chalk2.default.white(formatNumber(tokens.prompt))}`);
153
- lines.push(` ${_chalk2.default.dim("Output tokens:")} ${_chalk2.default.white(formatNumber(tokens.completion))}`);
154
- if (cache.cacheRead > 0 || cache.cacheWrite > 0) {
155
- lines.push(` ${_chalk2.default.dim("Cache read:")} ${_chalk2.default.white(formatNumber(cache.cacheRead))}`);
156
- lines.push(` ${_chalk2.default.dim("Cache write:")} ${_chalk2.default.white(formatNumber(cache.cacheWrite))}`);
157
- }
158
- lines.push(` ${_chalk2.default.dim("Total cost:")} ${_chalk2.default.green(formatCost(cost))}`);
159
- lines.push(` ${_chalk2.default.dim("Duration:")} ${_chalk2.default.white(formatDuration(duration))}`);
160
- const modelMap = /* @__PURE__ */ new Map();
161
- for (const r of this.records) {
162
- const existing = _nullishCoalesce(modelMap.get(r.model), () => ( { prompt: 0, completion: 0, cacheRead: 0, cacheWrite: 0, count: 0 }));
163
- existing.prompt += r.promptTokens;
164
- existing.completion += r.completionTokens;
165
- existing.cacheRead += r.cacheReadTokens;
166
- existing.cacheWrite += r.cacheWriteTokens;
167
- existing.count++;
168
- modelMap.set(r.model, existing);
169
- }
170
- if (modelMap.size >= 1) {
171
- lines.push("");
172
- lines.push(` ${_chalk2.default.dim("By model:")}`);
173
- for (const [model, stats] of modelMap) {
174
- const p = _nullishCoalesce(MODEL_PRICING[model], () => ( DEFAULT_PRICING));
175
- const uncachedInput = Math.max(0, stats.prompt - stats.cacheRead - stats.cacheWrite);
176
- const modelCost = uncachedInput / 1e6 * p.input + stats.completion / 1e6 * p.output + stats.cacheRead / 1e6 * p.cacheRead + stats.cacheWrite / 1e6 * p.cacheWrite;
177
- const tokenDetail = `${formatNumber(stats.prompt)} in, ${formatNumber(stats.completion)} out` + (stats.cacheRead > 0 ? `, ${formatNumber(stats.cacheRead)} cache` : "");
178
- lines.push(
179
- ` ${_chalk2.default.dim(model)} \u2014 ${tokenDetail}, ${formatCost(modelCost)} (${stats.count} reqs)`
180
- );
181
- }
182
- }
183
- if (this._hasUnknownModel) {
184
- lines.push("");
185
- lines.push(_chalk2.default.dim(" (costs may be inaccurate due to usage of unknown models)"));
186
- }
187
- return lines.join("\n");
188
- }
189
- /**
190
- * Format a compact one-line cost display for the prompt footer.
191
- */
192
- formatCompact() {
193
- const tokens = this.getTotalTokens();
194
- const cost = this.getEstimatedCost();
195
- return _chalk2.default.dim(
196
- `tokens: ${formatNumber(tokens.total)} | cost: ${formatCost(cost)}`
197
- );
198
- }
199
- reset() {
200
- this.records = [];
201
- this.sessionStart = Date.now();
202
- }
203
- /** Serialize cost state for session persistence. */
204
- serialize() {
205
- const tokens = this.getTotalTokens();
206
- return {
207
- records: this.records,
208
- sessionStart: this.sessionStart,
209
- totalPromptTokens: tokens.prompt,
210
- totalCompletionTokens: tokens.completion,
211
- estimatedCost: this.getEstimatedCost()
212
- };
213
- }
214
- /** Restore cost state from a previous session. */
215
- restore(state) {
216
- this.records = _nullishCoalesce(state.records, () => ( []));
217
- this.sessionStart = _nullishCoalesce(state.sessionStart, () => ( Date.now()));
218
- }
219
- }, _class);
220
- function formatCost(cost) {
221
- if (cost >= 0.5) return `$${Math.round(cost * 100) / 100}`;
222
- if (cost >= 0.01) return `$${cost.toFixed(4)}`;
223
- if (cost > 0) return `$${cost.toFixed(6)}`;
224
- return "$0.00";
225
- }
226
- function formatNumber(n) {
227
- if (n >= 1e6) return (n / 1e6).toFixed(1) + "M";
228
- if (n >= 1e3) return (n / 1e3).toFixed(1) + "K";
229
- return String(n);
230
- }
231
- function formatDuration(ms) {
232
- const s = Math.floor(ms / 1e3);
233
- if (s < 60) return `${s}s`;
234
- const m = Math.floor(s / 60);
235
- const rs = s % 60;
236
- if (m < 60) return `${m}m ${rs}s`;
237
- const h = Math.floor(m / 60);
238
- const rm = m % 60;
239
- return `${h}h ${rm}m`;
240
- }
241
- var costTracker = new CostTracker();
242
-
243
-
244
-
245
-
246
- exports.CostTracker = CostTracker; exports.costTracker = costTracker;
@@ -1,207 +0,0 @@
1
- import {
2
- __esm,
3
- __export,
4
- init_esm_shims
5
- } from "./chunk-DI7RDLOS.js";
6
-
7
- // src/settings/schema.ts
8
- import { z } from "zod";
9
- function validateSettings(raw) {
10
- return SettingsSchema.parse(raw);
11
- }
12
- var SettingsSchema;
13
- var init_schema = __esm({
14
- "src/settings/schema.ts"() {
15
- "use strict";
16
- init_esm_shims();
17
- SettingsSchema = z.object({
18
- agent: z.object({
19
- // Use z.string() instead of z.enum() to allow custom presets registered via registerPreset()
20
- preset: z.string().default("terminal-coding"),
21
- enabledBuiltinTools: z.array(z.string()).default([]),
22
- disabledBuiltinTools: z.array(z.string()).default([]),
23
- customSystemPrompt: z.string().optional(),
24
- appendSystemPrompt: z.string().optional()
25
- }).default({}),
26
- model: z.object({
27
- provider: z.string().default("openai"),
28
- name: z.string().default("anthropic/claude-opus-4-6"),
29
- apiKey: z.string().optional(),
30
- baseUrl: z.string().default("https://openrouter.ai/api/v1"),
31
- temperature: z.number().min(0).max(2).default(0.3),
32
- maxTokens: z.number().default(8192)
33
- }).default({}),
34
- models: z.array(
35
- z.object({
36
- key: z.string(),
37
- label: z.string().optional(),
38
- provider: z.string(),
39
- model: z.string(),
40
- baseUrl: z.string().optional(),
41
- apiKey: z.string().optional(),
42
- maxOutputTokens: z.number().optional()
43
- })
44
- ).default([]),
45
- permissions: z.object({
46
- defaultMode: z.enum(["default", "acceptEdits", "dontAsk", "bypassPermissions", "auto", "plan"]).default("default"),
47
- rules: z.array(
48
- z.object({
49
- tool: z.string(),
50
- argsPattern: z.record(z.string()).optional(),
51
- decision: z.enum(["allow", "deny", "ask"]),
52
- reason: z.string().optional()
53
- })
54
- ).default([])
55
- }).default({}),
56
- context: z.object({
57
- maxTokens: z.number().default(2e5),
58
- compactAtRatio: z.number().default(0.6),
59
- summarizeAtRatio: z.number().default(0.8)
60
- }).default({}),
61
- session: z.object({
62
- storageDir: z.string().optional(),
63
- maxHistory: z.number().default(100)
64
- }).default({}),
65
- mcpServers: z.record(
66
- z.object({
67
- name: z.string(),
68
- command: z.string().optional(),
69
- args: z.array(z.string()).optional(),
70
- env: z.record(z.string()).optional(),
71
- url: z.string().optional(),
72
- transport: z.enum(["stdio", "sse", "streamable-http", "inprocess"]).optional(),
73
- headers: z.record(z.string()).optional()
74
- })
75
- ).default({}),
76
- instructions: z.object({
77
- fileName: z.string().default("CODESHELL.md"),
78
- scanDirs: z.array(z.string()).default([]),
79
- compatFileNames: z.array(z.string()).default(["CLAUDE.md"]),
80
- ignoreGitBoundary: z.boolean().default(false)
81
- }).default({}),
82
- arena: z.object({
83
- participants: z.array(
84
- z.union([
85
- // Short form: just a model pool key
86
- z.string(),
87
- // Full form: explicit config (backward compat)
88
- z.object({
89
- name: z.string(),
90
- model: z.string(),
91
- provider: z.string().optional(),
92
- apiKey: z.string().optional(),
93
- baseUrl: z.string().optional()
94
- })
95
- ])
96
- ).default([])
97
- }).default({}),
98
- search: z.object({
99
- provider: z.enum(["serper", "tavily", "searxng"]).default("serper"),
100
- apiKey: z.string().optional(),
101
- baseUrl: z.string().optional()
102
- }).default({}),
103
- output: z.object({
104
- format: z.enum(["text", "json", "jsonl", "stream-json"]).default("text")
105
- }).default({})
106
- }).passthrough();
107
- }
108
- });
109
-
110
- // src/settings/manager.ts
111
- var manager_exports = {};
112
- __export(manager_exports, {
113
- SettingsManager: () => SettingsManager
114
- });
115
- import { readFileSync, existsSync } from "fs";
116
- import { join } from "path";
117
- import { homedir } from "os";
118
- function merge(base, override) {
119
- const result = { ...base };
120
- for (const [key, value] of Object.entries(override)) {
121
- if (value === null) {
122
- delete result[key];
123
- } else if (typeof value === "object" && !Array.isArray(value) && typeof result[key] === "object" && !Array.isArray(result[key]) && result[key] !== null) {
124
- result[key] = merge(
125
- result[key],
126
- value
127
- );
128
- } else {
129
- result[key] = value;
130
- }
131
- }
132
- return result;
133
- }
134
- var SettingsManager;
135
- var init_manager = __esm({
136
- "src/settings/manager.ts"() {
137
- init_esm_shims();
138
- init_schema();
139
- SettingsManager = class {
140
- constructor(cwd = process.cwd()) {
141
- this.cwd = cwd;
142
- }
143
- sources = [];
144
- merged = null;
145
- /**
146
- * Load settings from all sources.
147
- */
148
- load(flagOverrides) {
149
- this.sources = [];
150
- this.loadJsonFile(join(homedir(), ".code-shell", "settings.managed.json"), "managed", 0);
151
- this.loadJsonFile(join(homedir(), ".code-shell", "settings.json"), "user", 1);
152
- this.loadJsonFile(join(homedir(), ".claude", "settings.json"), "user", 1);
153
- this.loadJsonFile(join(this.cwd, ".code-shell", "settings.json"), "project", 2);
154
- this.loadJsonFile(join(this.cwd, ".claude", "settings.json"), "project", 2);
155
- this.loadJsonFile(join(this.cwd, ".code-shell", "settings.local.json"), "local", 3);
156
- this.loadJsonFile(join(this.cwd, ".claude", "settings.local.json"), "local", 3);
157
- if (flagOverrides && Object.keys(flagOverrides).length > 0) {
158
- this.sources.push({ name: "flag", priority: 4, data: flagOverrides });
159
- }
160
- this.sources.sort((a, b) => a.priority - b.priority);
161
- const raw = this.deepMerge();
162
- this.merged = validateSettings(raw);
163
- return this.merged;
164
- }
165
- /**
166
- * Get current effective settings.
167
- */
168
- get() {
169
- if (!this.merged) return this.load();
170
- return this.merged;
171
- }
172
- /**
173
- * Invalidate cached merge.
174
- */
175
- invalidate() {
176
- this.merged = null;
177
- }
178
- loadJsonFile(path, name, priority) {
179
- if (!existsSync(path)) return;
180
- try {
181
- const content = readFileSync(path, "utf-8");
182
- const data = JSON.parse(content);
183
- if (typeof data === "object" && data !== null) {
184
- this.sources.push({ name, priority, data });
185
- }
186
- } catch {
187
- }
188
- }
189
- deepMerge() {
190
- let result = {};
191
- for (const source of this.sources) {
192
- result = merge(result, source.data);
193
- }
194
- return result;
195
- }
196
- };
197
- }
198
- });
199
-
200
- export {
201
- SettingsSchema,
202
- validateSettings,
203
- init_schema,
204
- SettingsManager,
205
- manager_exports,
206
- init_manager
207
- };
@@ -1,80 +0,0 @@
1
- import {
2
- init_esm_shims
3
- } from "./chunk-DI7RDLOS.js";
4
-
5
- // src/agent/coordinator.ts
6
- init_esm_shims();
7
- var AgentCoordinator = class {
8
- agents = /* @__PURE__ */ new Map();
9
- inbox = /* @__PURE__ */ new Map();
10
- /** Register a named agent. */
11
- register(id, name, description) {
12
- this.agents.set(name, {
13
- id,
14
- name,
15
- status: "running",
16
- description,
17
- startedAt: Date.now()
18
- });
19
- if (!this.inbox.has(name)) {
20
- this.inbox.set(name, []);
21
- }
22
- }
23
- /** Mark an agent as completed. */
24
- complete(name, result) {
25
- const agent = this.agents.get(name);
26
- if (agent) {
27
- agent.status = "completed";
28
- agent.completedAt = Date.now();
29
- agent.result = result;
30
- }
31
- }
32
- /** Mark an agent as failed. */
33
- fail(name) {
34
- const agent = this.agents.get(name);
35
- if (agent) {
36
- agent.status = "failed";
37
- agent.completedAt = Date.now();
38
- }
39
- }
40
- /** Get agent info by name. */
41
- get(name) {
42
- return this.agents.get(name);
43
- }
44
- /** List all agents. */
45
- list() {
46
- return [...this.agents.values()];
47
- }
48
- /** List active (running) agents. */
49
- listActive() {
50
- return [...this.agents.values()].filter((a) => a.status === "running");
51
- }
52
- /** Send a message to a named agent. */
53
- send(from, to, content) {
54
- if (!this.agents.has(to)) return false;
55
- const messages = this.inbox.get(to) ?? [];
56
- messages.push({ from, to, content, timestamp: Date.now() });
57
- this.inbox.set(to, messages);
58
- return true;
59
- }
60
- /** Read messages for a named agent (drains the inbox). */
61
- receive(name) {
62
- const messages = this.inbox.get(name) ?? [];
63
- this.inbox.set(name, []);
64
- return messages;
65
- }
66
- /** Peek at messages without draining. */
67
- peek(name) {
68
- return this.inbox.get(name) ?? [];
69
- }
70
- /** Reset all state. */
71
- reset() {
72
- this.agents.clear();
73
- this.inbox.clear();
74
- }
75
- };
76
- var agentCoordinator = new AgentCoordinator();
77
-
78
- export {
79
- agentCoordinator
80
- };
@@ -1,132 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
4
-
5
- // src/skills/index.ts
6
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
7
-
8
- // src/skills/scanner.ts
9
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
10
- var _fs = require('fs');
11
- var _path = require('path');
12
- var _os = require('os');
13
- function scanSkills(cwd) {
14
- const skills = [];
15
- const seen = /* @__PURE__ */ new Set();
16
- const dirs = [
17
- // Project-level
18
- _path.join.call(void 0, cwd, ".code-shell", "skills"),
19
- _path.join.call(void 0, cwd, ".claude", "skills"),
20
- // User-level
21
- _path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "skills"),
22
- _path.join.call(void 0, _os.homedir.call(void 0, ), ".claude", "skills")
23
- ];
24
- for (const dir of dirs) {
25
- if (!_fs.existsSync.call(void 0, dir)) continue;
26
- try {
27
- const files = _fs.readdirSync.call(void 0, dir).filter(
28
- (f) => f.endsWith(".md") && _fs.statSync.call(void 0, _path.join.call(void 0, dir, f)).isFile()
29
- );
30
- for (const file of files) {
31
- const filePath = _path.resolve.call(void 0, _path.join.call(void 0, dir, file));
32
- if (seen.has(filePath)) continue;
33
- seen.add(filePath);
34
- const skill = parseSkillFile(filePath);
35
- if (skill) skills.push(skill);
36
- }
37
- } catch (e) {
38
- }
39
- }
40
- return skills;
41
- }
42
- function parseSkillFile(filePath) {
43
- try {
44
- const raw = _fs.readFileSync.call(void 0, filePath, "utf-8");
45
- const match = raw.match(/^---\n([\s\S]*?)\n---\n\n?([\s\S]*)$/);
46
- if (!match) return null;
47
- const frontmatter = match[1];
48
- const content = match[2].trim();
49
- const name = extractField(frontmatter, "name");
50
- if (!name) return null;
51
- const description = _nullishCoalesce(extractField(frontmatter, "description"), () => ( ""));
52
- const whenToUse = _nullishCoalesce(extractField(frontmatter, "when_to_use"), () => ( ""));
53
- const keywords = extractList(frontmatter, "keywords");
54
- const tools = extractList(frontmatter, "tools");
55
- const intents = extractList(frontmatter, "intents");
56
- return {
57
- name,
58
- description,
59
- triggers: { keywords, tools, intents },
60
- whenToUse,
61
- content,
62
- filePath
63
- };
64
- } catch (e2) {
65
- return null;
66
- }
67
- }
68
- function extractField(frontmatter, field) {
69
- const match = frontmatter.match(new RegExp(`^${field}:\\s*(.+)$`, "m"));
70
- return _optionalChain([match, 'optionalAccess', _ => _[1], 'optionalAccess', _2 => _2.trim, 'call', _3 => _3()]);
71
- }
72
- function extractList(frontmatter, field) {
73
- const match = frontmatter.match(new RegExp(`${field}:\\s*\\[([^\\]]+)\\]`));
74
- if (!match) return [];
75
- return match[1].split(",").map((s) => s.trim().replace(/^['"]|['"]$/g, ""));
76
- }
77
-
78
- // src/skills/matcher.ts
79
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
80
- function matchSkillsByInput(skills, input) {
81
- const inputLower = input.toLowerCase();
82
- const results = [];
83
- for (const skill of skills) {
84
- let bestScore = 0;
85
- let matchedBy = "";
86
- if (skill.triggers.keywords) {
87
- for (const kw of skill.triggers.keywords) {
88
- if (inputLower.includes(kw.toLowerCase())) {
89
- const score = kw.length / input.length * 10 + 5;
90
- if (score > bestScore) {
91
- bestScore = score;
92
- matchedBy = "keyword";
93
- }
94
- }
95
- }
96
- }
97
- if (skill.triggers.intents) {
98
- for (const intent of skill.triggers.intents) {
99
- if (inputLower.includes(intent.toLowerCase())) {
100
- const score = 8;
101
- if (score > bestScore) {
102
- bestScore = score;
103
- matchedBy = "intent";
104
- }
105
- }
106
- }
107
- }
108
- if (bestScore > 0) {
109
- results.push({ skill, score: bestScore, matchedBy });
110
- }
111
- }
112
- return results.sort((a, b) => b.score - a.score);
113
- }
114
- function matchSkillsByTool(skills, toolName) {
115
- return skills.filter((s) => _optionalChain([s, 'access', _4 => _4.triggers, 'access', _5 => _5.tools, 'optionalAccess', _6 => _6.includes, 'call', _7 => _7(toolName)])).map((skill) => ({ skill, score: 10, matchedBy: "tool" }));
116
- }
117
- function buildSkillListing(skills) {
118
- if (skills.length === 0) return "";
119
- const lines = skills.map(
120
- (s) => `- **${s.name}**: ${s.description}${s.whenToUse ? ` \u2014 Use when: ${s.whenToUse}` : ""}`
121
- );
122
- return `# Available Skills
123
-
124
- ${lines.join("\n")}`;
125
- }
126
-
127
-
128
-
129
-
130
-
131
-
132
- exports.scanSkills = scanSkills; exports.matchSkillsByInput = matchSkillsByInput; exports.matchSkillsByTool = matchSkillsByTool; exports.buildSkillListing = buildSkillListing;