qlogicagent 0.2.1 → 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.
Files changed (226) hide show
  1. package/README.md +45 -45
  2. package/package.json +56 -42
  3. package/dist/agent/agent.d.ts +0 -43
  4. package/dist/agent/agent.js +0 -113
  5. package/dist/agent/tool-loop.d.ts +0 -64
  6. package/dist/agent/tool-loop.js +0 -575
  7. package/dist/agent/types.d.ts +0 -175
  8. package/dist/agent/types.js +0 -14
  9. package/dist/cli/main.d.ts +0 -11
  10. package/dist/cli/main.js +0 -23
  11. package/dist/cli/stdio-server.d.ts +0 -45
  12. package/dist/cli/stdio-server.js +0 -463
  13. package/dist/config/config.d.ts +0 -17
  14. package/dist/config/config.js +0 -21
  15. package/dist/contracts/hooks.d.ts +0 -120
  16. package/dist/contracts/hooks.js +0 -7
  17. package/dist/contracts/index.d.ts +0 -10
  18. package/dist/contracts/index.js +0 -10
  19. package/dist/contracts/planner.d.ts +0 -35
  20. package/dist/contracts/planner.js +0 -2
  21. package/dist/contracts/skill-candidate.d.ts +0 -63
  22. package/dist/contracts/skill-candidate.js +0 -195
  23. package/dist/contracts/todo.d.ts +0 -14
  24. package/dist/contracts/todo.js +0 -9
  25. package/dist/index.d.ts +0 -13
  26. package/dist/index.js +0 -15
  27. package/dist/llm/builtin-providers.d.ts +0 -10
  28. package/dist/llm/builtin-providers.js +0 -531
  29. package/dist/llm/index.d.ts +0 -15
  30. package/dist/llm/index.js +0 -14
  31. package/dist/llm/llm-client.d.ts +0 -43
  32. package/dist/llm/llm-client.js +0 -67
  33. package/dist/llm/model-catalog.d.ts +0 -53
  34. package/dist/llm/model-catalog.js +0 -191
  35. package/dist/llm/provider-def.d.ts +0 -59
  36. package/dist/llm/provider-def.js +0 -12
  37. package/dist/llm/provider-registry.d.ts +0 -54
  38. package/dist/llm/provider-registry.js +0 -147
  39. package/dist/llm/transport.d.ts +0 -62
  40. package/dist/llm/transport.js +0 -27
  41. package/dist/llm/transports/anthropic-messages.d.ts +0 -31
  42. package/dist/llm/transports/anthropic-messages.js +0 -293
  43. package/dist/llm/transports/openai-chat.d.ts +0 -36
  44. package/dist/llm/transports/openai-chat.js +0 -165
  45. package/dist/orchestration/agent-registry.d.ts +0 -41
  46. package/dist/orchestration/agent-registry.js +0 -116
  47. package/dist/orchestration/approval-aware-tool-plan.d.ts +0 -32
  48. package/dist/orchestration/approval-aware-tool-plan.js +0 -87
  49. package/dist/orchestration/context-compression.d.ts +0 -220
  50. package/dist/orchestration/context-compression.js +0 -583
  51. package/dist/orchestration/conversation-repair.d.ts +0 -61
  52. package/dist/orchestration/conversation-repair.js +0 -429
  53. package/dist/orchestration/curator-scheduler.d.ts +0 -119
  54. package/dist/orchestration/curator-scheduler.js +0 -135
  55. package/dist/orchestration/embedded-failover-policy.d.ts +0 -110
  56. package/dist/orchestration/embedded-failover-policy.js +0 -168
  57. package/dist/orchestration/error-classification.d.ts +0 -12
  58. package/dist/orchestration/error-classification.js +0 -77
  59. package/dist/orchestration/failover-classification.d.ts +0 -8
  60. package/dist/orchestration/failover-classification.js +0 -381
  61. package/dist/orchestration/failover-error.d.ts +0 -33
  62. package/dist/orchestration/failover-error.js +0 -198
  63. package/dist/orchestration/fork-subagent.d.ts +0 -100
  64. package/dist/orchestration/fork-subagent.js +0 -98
  65. package/dist/orchestration/index.d.ts +0 -120
  66. package/dist/orchestration/index.js +0 -267
  67. package/dist/orchestration/memory-flush-policy.d.ts +0 -57
  68. package/dist/orchestration/memory-flush-policy.js +0 -85
  69. package/dist/orchestration/memory-provider.d.ts +0 -14
  70. package/dist/orchestration/memory-provider.js +0 -2
  71. package/dist/orchestration/parallel-tool-calls.d.ts +0 -41
  72. package/dist/orchestration/parallel-tool-calls.js +0 -59
  73. package/dist/orchestration/prompt-cache-strategy.d.ts +0 -126
  74. package/dist/orchestration/prompt-cache-strategy.js +0 -228
  75. package/dist/orchestration/reactive-compact.d.ts +0 -73
  76. package/dist/orchestration/reactive-compact.js +0 -78
  77. package/dist/orchestration/retry-loop.d.ts +0 -22
  78. package/dist/orchestration/retry-loop.js +0 -24
  79. package/dist/orchestration/skill-candidate.d.ts +0 -52
  80. package/dist/orchestration/skill-candidate.js +0 -141
  81. package/dist/orchestration/skill-consolidation.d.ts +0 -123
  82. package/dist/orchestration/skill-consolidation.js +0 -220
  83. package/dist/orchestration/skill-improvement.d.ts +0 -59
  84. package/dist/orchestration/skill-improvement.js +0 -66
  85. package/dist/orchestration/skill-similarity.d.ts +0 -98
  86. package/dist/orchestration/skill-similarity.js +0 -131
  87. package/dist/orchestration/streaming-tool-executor.d.ts +0 -73
  88. package/dist/orchestration/streaming-tool-executor.js +0 -96
  89. package/dist/orchestration/team-orchestration.d.ts +0 -195
  90. package/dist/orchestration/team-orchestration.js +0 -369
  91. package/dist/orchestration/team-tool-loop-wiring.d.ts +0 -92
  92. package/dist/orchestration/team-tool-loop-wiring.js +0 -147
  93. package/dist/orchestration/tool-choice-policy.d.ts +0 -54
  94. package/dist/orchestration/tool-choice-policy.js +0 -164
  95. package/dist/orchestration/tool-loop-state.d.ts +0 -50
  96. package/dist/orchestration/tool-loop-state.js +0 -133
  97. package/dist/orchestration/tool-schema.d.ts +0 -39
  98. package/dist/orchestration/tool-schema.js +0 -297
  99. package/dist/orchestration/transcript-repair.d.ts +0 -42
  100. package/dist/orchestration/transcript-repair.js +0 -426
  101. package/dist/orchestration/turn-loop-guard.d.ts +0 -86
  102. package/dist/orchestration/turn-loop-guard.js +0 -92
  103. package/dist/orchestration/web-browser-policy.d.ts +0 -17
  104. package/dist/orchestration/web-browser-policy.js +0 -39
  105. package/dist/runtime/context-compression.d.ts +0 -61
  106. package/dist/runtime/context-compression.js +0 -274
  107. package/dist/runtime/hook-registry.d.ts +0 -12
  108. package/dist/runtime/hook-registry.js +0 -53
  109. package/dist/runtime/memory-hooks.d.ts +0 -23
  110. package/dist/runtime/memory-hooks.js +0 -65
  111. package/dist/runtime/tool-eligibility.d.ts +0 -59
  112. package/dist/runtime/tool-eligibility.js +0 -111
  113. package/dist/skills/index.d.ts +0 -108
  114. package/dist/skills/index.js +0 -82
  115. package/dist/skills/memory-extractor.d.ts +0 -64
  116. package/dist/skills/memory-extractor.js +0 -173
  117. package/dist/skills/memory-query-tool.d.ts +0 -43
  118. package/dist/skills/memory-query-tool.js +0 -127
  119. package/dist/skills/memory-store.d.ts +0 -66
  120. package/dist/skills/memory-store.js +0 -228
  121. package/dist/skills/memory-tool.d.ts +0 -67
  122. package/dist/skills/memory-tool.js +0 -192
  123. package/dist/skills/portable-tool.d.ts +0 -71
  124. package/dist/skills/portable-tool.js +0 -14
  125. package/dist/skills/qmemory-adapter.d.ts +0 -52
  126. package/dist/skills/qmemory-adapter.js +0 -165
  127. package/dist/skills/skill-frontmatter.d.ts +0 -19
  128. package/dist/skills/skill-frontmatter.js +0 -344
  129. package/dist/skills/skill-guard.d.ts +0 -23
  130. package/dist/skills/skill-guard.js +0 -229
  131. package/dist/skills/skill-loader.d.ts +0 -16
  132. package/dist/skills/skill-loader.js +0 -303
  133. package/dist/skills/skill-source.d.ts +0 -119
  134. package/dist/skills/skill-source.js +0 -126
  135. package/dist/skills/skill-types.d.ts +0 -199
  136. package/dist/skills/skill-types.js +0 -6
  137. package/dist/skills/think-tool.d.ts +0 -16
  138. package/dist/skills/think-tool.js +0 -59
  139. package/dist/skills/todo-tool.d.ts +0 -63
  140. package/dist/skills/todo-tool.js +0 -114
  141. package/dist/skills/tools/agent-tool.d.ts +0 -91
  142. package/dist/skills/tools/agent-tool.js +0 -142
  143. package/dist/skills/tools/apply-patch-tool.d.ts +0 -29
  144. package/dist/skills/tools/apply-patch-tool.js +0 -184
  145. package/dist/skills/tools/ask-user-tool.d.ts +0 -80
  146. package/dist/skills/tools/ask-user-tool.js +0 -121
  147. package/dist/skills/tools/brief-tool.d.ts +0 -74
  148. package/dist/skills/tools/brief-tool.js +0 -95
  149. package/dist/skills/tools/browser-tool.d.ts +0 -114
  150. package/dist/skills/tools/browser-tool.js +0 -155
  151. package/dist/skills/tools/checkpoint-tool.d.ts +0 -66
  152. package/dist/skills/tools/checkpoint-tool.js +0 -102
  153. package/dist/skills/tools/config-tool.d.ts +0 -63
  154. package/dist/skills/tools/config-tool.js +0 -143
  155. package/dist/skills/tools/cron-tool.d.ts +0 -116
  156. package/dist/skills/tools/cron-tool.js +0 -175
  157. package/dist/skills/tools/edit-tool.d.ts +0 -43
  158. package/dist/skills/tools/edit-tool.js +0 -70
  159. package/dist/skills/tools/exec-tool.d.ts +0 -102
  160. package/dist/skills/tools/exec-tool.js +0 -133
  161. package/dist/skills/tools/image-generate-tool.d.ts +0 -62
  162. package/dist/skills/tools/image-generate-tool.js +0 -67
  163. package/dist/skills/tools/instructions-tool.d.ts +0 -103
  164. package/dist/skills/tools/instructions-tool.js +0 -187
  165. package/dist/skills/tools/lsp-tool.d.ts +0 -153
  166. package/dist/skills/tools/lsp-tool.js +0 -227
  167. package/dist/skills/tools/mcp-client-types.d.ts +0 -269
  168. package/dist/skills/tools/mcp-client-types.js +0 -53
  169. package/dist/skills/tools/mcp-tool.d.ts +0 -249
  170. package/dist/skills/tools/mcp-tool.js +0 -503
  171. package/dist/skills/tools/memory-tool.d.ts +0 -74
  172. package/dist/skills/tools/memory-tool.js +0 -88
  173. package/dist/skills/tools/monitor-tool.d.ts +0 -113
  174. package/dist/skills/tools/monitor-tool.js +0 -131
  175. package/dist/skills/tools/music-generate-tool.d.ts +0 -55
  176. package/dist/skills/tools/music-generate-tool.js +0 -62
  177. package/dist/skills/tools/notify-tool.d.ts +0 -53
  178. package/dist/skills/tools/notify-tool.js +0 -62
  179. package/dist/skills/tools/patch-tool.d.ts +0 -45
  180. package/dist/skills/tools/patch-tool.js +0 -505
  181. package/dist/skills/tools/pdf-tool.d.ts +0 -66
  182. package/dist/skills/tools/pdf-tool.js +0 -88
  183. package/dist/skills/tools/plan-mode-tool.d.ts +0 -59
  184. package/dist/skills/tools/plan-mode-tool.js +0 -122
  185. package/dist/skills/tools/read-tool.d.ts +0 -51
  186. package/dist/skills/tools/read-tool.js +0 -84
  187. package/dist/skills/tools/repl-tool.d.ts +0 -70
  188. package/dist/skills/tools/repl-tool.js +0 -69
  189. package/dist/skills/tools/search-tool.d.ts +0 -112
  190. package/dist/skills/tools/search-tool.js +0 -225
  191. package/dist/skills/tools/send-message-tool.d.ts +0 -51
  192. package/dist/skills/tools/send-message-tool.js +0 -76
  193. package/dist/skills/tools/skill-list-tool.d.ts +0 -33
  194. package/dist/skills/tools/skill-list-tool.js +0 -54
  195. package/dist/skills/tools/skill-manage-tool.d.ts +0 -73
  196. package/dist/skills/tools/skill-manage-tool.js +0 -153
  197. package/dist/skills/tools/skill-view-tool.d.ts +0 -37
  198. package/dist/skills/tools/skill-view-tool.js +0 -72
  199. package/dist/skills/tools/sleep-tool.d.ts +0 -49
  200. package/dist/skills/tools/sleep-tool.js +0 -81
  201. package/dist/skills/tools/structured-output-tool.d.ts +0 -116
  202. package/dist/skills/tools/structured-output-tool.js +0 -176
  203. package/dist/skills/tools/task-tool.d.ts +0 -104
  204. package/dist/skills/tools/task-tool.js +0 -161
  205. package/dist/skills/tools/team-tool.d.ts +0 -89
  206. package/dist/skills/tools/team-tool.js +0 -105
  207. package/dist/skills/tools/tool-search-tool.d.ts +0 -51
  208. package/dist/skills/tools/tool-search-tool.js +0 -110
  209. package/dist/skills/tools/tts-tool.d.ts +0 -38
  210. package/dist/skills/tools/tts-tool.js +0 -45
  211. package/dist/skills/tools/video-edit-tool.d.ts +0 -69
  212. package/dist/skills/tools/video-edit-tool.js +0 -74
  213. package/dist/skills/tools/video-generate-tool.d.ts +0 -62
  214. package/dist/skills/tools/video-generate-tool.js +0 -66
  215. package/dist/skills/tools/video-merge-tool.d.ts +0 -105
  216. package/dist/skills/tools/video-merge-tool.js +0 -92
  217. package/dist/skills/tools/video-upscale-tool.d.ts +0 -45
  218. package/dist/skills/tools/video-upscale-tool.js +0 -52
  219. package/dist/skills/tools/web-fetch-tool.d.ts +0 -78
  220. package/dist/skills/tools/web-fetch-tool.js +0 -92
  221. package/dist/skills/tools/web-search-tool.d.ts +0 -57
  222. package/dist/skills/tools/web-search-tool.js +0 -86
  223. package/dist/skills/tools/worktree-tool.d.ts +0 -69
  224. package/dist/skills/tools/worktree-tool.js +0 -147
  225. package/dist/skills/tools/write-tool.d.ts +0 -45
  226. package/dist/skills/tools/write-tool.js +0 -81
@@ -1,531 +0,0 @@
1
- /**
2
- * Builtin provider definitions — hardcoded fallback list (~30 providers).
3
- *
4
- * This is Layer 1 (lowest priority) of the three-layer merge strategy.
5
- * Used when remote model catalog is unavailable.
6
- *
7
- * Aligned with Hermes hermes_cli/models.py hardcoded fallback.
8
- */
9
- export const BUILTIN_PROVIDERS = [
10
- // ── Tier 1: Major Chinese providers ──────────────────────────────────
11
- {
12
- id: "deepseek",
13
- name: "DeepSeek",
14
- transport: "openai-chat",
15
- baseUrl: "https://api.deepseek.com",
16
- apiKeyEnvVars: ["DEEPSEEK_API_KEY"],
17
- authType: "bearer",
18
- isAggregator: false,
19
- defaultModel: "deepseek-chat",
20
- models: [
21
- {
22
- id: "deepseek-chat",
23
- name: "DeepSeek Chat V3",
24
- contextWindow: 64000,
25
- maxOutput: 8192,
26
- toolCall: true,
27
- reasoning: false,
28
- vision: false,
29
- costInput: 0.27,
30
- costOutput: 1.1,
31
- },
32
- {
33
- id: "deepseek-reasoner",
34
- name: "DeepSeek R1",
35
- contextWindow: 64000,
36
- maxOutput: 8192,
37
- toolCall: true,
38
- reasoning: true,
39
- vision: false,
40
- costInput: 0.55,
41
- costOutput: 2.19,
42
- },
43
- ],
44
- },
45
- {
46
- id: "qwen",
47
- name: "Alibaba Qwen (DashScope)",
48
- transport: "openai-chat",
49
- baseUrl: "https://dashscope.aliyuncs.com/compatible-mode",
50
- apiKeyEnvVars: ["DASHSCOPE_API_KEY", "QWEN_API_KEY"],
51
- authType: "bearer",
52
- isAggregator: false,
53
- defaultModel: "qwen-plus",
54
- models: [
55
- {
56
- id: "qwen-plus",
57
- name: "Qwen Plus",
58
- contextWindow: 131072,
59
- maxOutput: 8192,
60
- toolCall: true,
61
- reasoning: false,
62
- vision: false,
63
- costInput: 0.8,
64
- costOutput: 2.0,
65
- },
66
- {
67
- id: "qwen-max",
68
- name: "Qwen Max",
69
- contextWindow: 32768,
70
- maxOutput: 8192,
71
- toolCall: true,
72
- reasoning: false,
73
- vision: false,
74
- costInput: 2.0,
75
- costOutput: 6.0,
76
- },
77
- {
78
- id: "qwen-turbo",
79
- name: "Qwen Turbo",
80
- contextWindow: 131072,
81
- maxOutput: 8192,
82
- toolCall: true,
83
- reasoning: false,
84
- vision: false,
85
- costInput: 0.3,
86
- costOutput: 0.6,
87
- },
88
- {
89
- id: "qwq-plus",
90
- name: "QwQ Plus (Reasoning)",
91
- contextWindow: 131072,
92
- maxOutput: 8192,
93
- toolCall: true,
94
- reasoning: true,
95
- vision: false,
96
- costInput: 0.8,
97
- costOutput: 2.0,
98
- },
99
- ],
100
- },
101
- {
102
- id: "zhipu",
103
- name: "智谱 GLM (Zhipu)",
104
- transport: "openai-chat",
105
- baseUrl: "https://open.bigmodel.cn/api/paas",
106
- apiKeyEnvVars: ["ZHIPU_API_KEY", "GLM_API_KEY"],
107
- authType: "bearer",
108
- isAggregator: false,
109
- defaultModel: "glm-4-plus",
110
- models: [
111
- {
112
- id: "glm-4-plus",
113
- name: "GLM-4 Plus",
114
- contextWindow: 128000,
115
- maxOutput: 4096,
116
- toolCall: true,
117
- reasoning: false,
118
- vision: false,
119
- costInput: 0.5,
120
- costOutput: 0.5,
121
- },
122
- ],
123
- },
124
- {
125
- id: "minimax",
126
- name: "MiniMax",
127
- transport: "openai-chat",
128
- baseUrl: "https://api.minimax.chat",
129
- apiKeyEnvVars: ["MINIMAX_API_KEY"],
130
- authType: "bearer",
131
- isAggregator: false,
132
- defaultModel: "MiniMax-Text-01",
133
- models: [
134
- {
135
- id: "MiniMax-Text-01",
136
- name: "MiniMax Text 01",
137
- contextWindow: 1000000,
138
- maxOutput: 65536,
139
- toolCall: true,
140
- reasoning: false,
141
- vision: false,
142
- costInput: 1.0,
143
- costOutput: 8.0,
144
- },
145
- ],
146
- },
147
- {
148
- id: "moonshot",
149
- name: "Moonshot (Kimi)",
150
- transport: "openai-chat",
151
- baseUrl: "https://api.moonshot.cn",
152
- apiKeyEnvVars: ["MOONSHOT_API_KEY"],
153
- authType: "bearer",
154
- isAggregator: false,
155
- defaultModel: "moonshot-v1-128k",
156
- // Moonshot API rejects temperature=0; omit when zero
157
- omitZeroTemperature: true,
158
- models: [
159
- {
160
- id: "moonshot-v1-128k",
161
- name: "Moonshot V1 128K",
162
- contextWindow: 128000,
163
- maxOutput: 4096,
164
- toolCall: true,
165
- reasoning: false,
166
- vision: false,
167
- costInput: 0.6,
168
- costOutput: 0.6,
169
- },
170
- ],
171
- },
172
- {
173
- id: "doubao",
174
- name: "豆包 (Doubao/Volcengine)",
175
- transport: "openai-chat",
176
- baseUrl: "https://ark.cn-beijing.volces.com/api",
177
- apiKeyEnvVars: ["ARK_API_KEY", "DOUBAO_API_KEY"],
178
- authType: "bearer",
179
- isAggregator: false,
180
- defaultModel: "doubao-1.5-pro-32k",
181
- models: [
182
- {
183
- id: "doubao-1.5-pro-32k",
184
- name: "Doubao 1.5 Pro 32K",
185
- contextWindow: 32768,
186
- maxOutput: 4096,
187
- toolCall: true,
188
- reasoning: false,
189
- vision: false,
190
- costInput: 0.8,
191
- costOutput: 2.0,
192
- },
193
- ],
194
- },
195
- {
196
- id: "baichuan",
197
- name: "百川 (Baichuan)",
198
- transport: "openai-chat",
199
- baseUrl: "https://api.baichuan-ai.com",
200
- apiKeyEnvVars: ["BAICHUAN_API_KEY"],
201
- authType: "bearer",
202
- isAggregator: false,
203
- defaultModel: "Baichuan4",
204
- models: [
205
- {
206
- id: "Baichuan4",
207
- name: "Baichuan 4",
208
- contextWindow: 32768,
209
- maxOutput: 4096,
210
- toolCall: true,
211
- reasoning: false,
212
- vision: false,
213
- costInput: 1.0,
214
- costOutput: 1.0,
215
- },
216
- ],
217
- },
218
- {
219
- id: "stepfun",
220
- name: "阶跃星辰 (StepFun)",
221
- transport: "openai-chat",
222
- baseUrl: "https://api.stepfun.com",
223
- apiKeyEnvVars: ["STEPFUN_API_KEY"],
224
- authType: "bearer",
225
- isAggregator: false,
226
- defaultModel: "step-2-16k",
227
- models: [
228
- {
229
- id: "step-2-16k",
230
- name: "Step 2 16K",
231
- contextWindow: 16384,
232
- maxOutput: 4096,
233
- toolCall: true,
234
- reasoning: false,
235
- vision: false,
236
- costInput: 0.38,
237
- costOutput: 0.12,
238
- },
239
- ],
240
- },
241
- // ── Tier 2: Major International providers ────────────────────────────
242
- {
243
- id: "openai",
244
- name: "OpenAI",
245
- transport: "openai-chat",
246
- baseUrl: "https://api.openai.com",
247
- apiKeyEnvVars: ["OPENAI_API_KEY"],
248
- authType: "bearer",
249
- isAggregator: false,
250
- defaultModel: "gpt-4o",
251
- models: [
252
- {
253
- id: "gpt-4o",
254
- name: "GPT-4o",
255
- contextWindow: 128000,
256
- maxOutput: 16384,
257
- toolCall: true,
258
- reasoning: false,
259
- vision: true,
260
- costInput: 2.5,
261
- costOutput: 10.0,
262
- },
263
- {
264
- id: "gpt-4o-mini",
265
- name: "GPT-4o Mini",
266
- contextWindow: 128000,
267
- maxOutput: 16384,
268
- toolCall: true,
269
- reasoning: false,
270
- vision: true,
271
- costInput: 0.15,
272
- costOutput: 0.6,
273
- },
274
- {
275
- id: "o3-mini",
276
- name: "o3-mini",
277
- contextWindow: 200000,
278
- maxOutput: 100000,
279
- toolCall: true,
280
- reasoning: true,
281
- vision: false,
282
- costInput: 1.1,
283
- costOutput: 4.4,
284
- },
285
- ],
286
- },
287
- {
288
- id: "anthropic",
289
- name: "Anthropic",
290
- transport: "anthropic-messages",
291
- baseUrl: "https://api.anthropic.com",
292
- apiKeyEnvVars: ["ANTHROPIC_API_KEY"],
293
- authType: "x-api-key",
294
- isAggregator: false,
295
- defaultModel: "claude-sonnet-4-20250514",
296
- models: [
297
- {
298
- id: "claude-sonnet-4-20250514",
299
- name: "Claude Sonnet 4",
300
- contextWindow: 200000,
301
- maxOutput: 16384,
302
- toolCall: true,
303
- reasoning: true,
304
- vision: true,
305
- costInput: 3.0,
306
- costOutput: 15.0,
307
- },
308
- {
309
- id: "claude-opus-4-20250514",
310
- name: "Claude Opus 4",
311
- contextWindow: 200000,
312
- maxOutput: 32768,
313
- toolCall: true,
314
- reasoning: true,
315
- vision: true,
316
- costInput: 15.0,
317
- costOutput: 75.0,
318
- },
319
- {
320
- id: "claude-3-5-haiku-20241022",
321
- name: "Claude 3.5 Haiku",
322
- contextWindow: 200000,
323
- maxOutput: 8192,
324
- toolCall: true,
325
- reasoning: false,
326
- vision: true,
327
- costInput: 0.8,
328
- costOutput: 4.0,
329
- },
330
- ],
331
- },
332
- {
333
- id: "google",
334
- name: "Google Gemini",
335
- transport: "openai-chat",
336
- baseUrl: "https://generativelanguage.googleapis.com/v1beta/openai",
337
- apiKeyEnvVars: ["GOOGLE_API_KEY", "GEMINI_API_KEY"],
338
- authType: "bearer",
339
- isAggregator: false,
340
- defaultModel: "gemini-2.5-flash",
341
- models: [
342
- {
343
- id: "gemini-2.5-flash",
344
- name: "Gemini 2.5 Flash",
345
- contextWindow: 1048576,
346
- maxOutput: 65536,
347
- toolCall: true,
348
- reasoning: true,
349
- vision: true,
350
- costInput: 0.15,
351
- costOutput: 0.6,
352
- },
353
- {
354
- id: "gemini-2.5-pro",
355
- name: "Gemini 2.5 Pro",
356
- contextWindow: 1048576,
357
- maxOutput: 65536,
358
- toolCall: true,
359
- reasoning: true,
360
- vision: true,
361
- costInput: 1.25,
362
- costOutput: 10.0,
363
- },
364
- ],
365
- },
366
- {
367
- id: "mistral",
368
- name: "Mistral AI",
369
- transport: "openai-chat",
370
- baseUrl: "https://api.mistral.ai",
371
- apiKeyEnvVars: ["MISTRAL_API_KEY"],
372
- authType: "bearer",
373
- isAggregator: false,
374
- defaultModel: "mistral-large-latest",
375
- models: [
376
- {
377
- id: "mistral-large-latest",
378
- name: "Mistral Large",
379
- contextWindow: 128000,
380
- maxOutput: 8192,
381
- toolCall: true,
382
- reasoning: false,
383
- vision: false,
384
- costInput: 2.0,
385
- costOutput: 6.0,
386
- },
387
- ],
388
- },
389
- {
390
- id: "xai",
391
- name: "xAI (Grok)",
392
- transport: "openai-chat",
393
- baseUrl: "https://api.x.ai",
394
- apiKeyEnvVars: ["XAI_API_KEY"],
395
- authType: "bearer",
396
- isAggregator: false,
397
- defaultModel: "grok-3-mini-fast",
398
- models: [
399
- {
400
- id: "grok-3-mini-fast",
401
- name: "Grok 3 Mini Fast",
402
- contextWindow: 131072,
403
- maxOutput: 8192,
404
- toolCall: true,
405
- reasoning: true,
406
- vision: false,
407
- costInput: 0.3,
408
- costOutput: 0.5,
409
- },
410
- ],
411
- },
412
- // ── Tier 3: Aggregators ──────────────────────────────────────────────
413
- {
414
- id: "siliconflow",
415
- name: "硅基流动 (SiliconFlow)",
416
- transport: "openai-chat",
417
- baseUrl: "https://api.siliconflow.cn",
418
- apiKeyEnvVars: ["SILICONFLOW_API_KEY", "SF_API_KEY"],
419
- authType: "bearer",
420
- isAggregator: true,
421
- defaultModel: "deepseek-ai/DeepSeek-V3",
422
- models: [
423
- {
424
- id: "deepseek-ai/DeepSeek-V3",
425
- name: "DeepSeek V3 (via SiliconFlow)",
426
- contextWindow: 64000,
427
- maxOutput: 8192,
428
- toolCall: true,
429
- reasoning: false,
430
- vision: false,
431
- costInput: 0.5,
432
- costOutput: 2.0,
433
- },
434
- {
435
- id: "Qwen/Qwen3-235B-A22B",
436
- name: "Qwen3 235B (via SiliconFlow)",
437
- contextWindow: 131072,
438
- maxOutput: 8192,
439
- toolCall: true,
440
- reasoning: true,
441
- vision: false,
442
- costInput: 1.0,
443
- costOutput: 4.0,
444
- },
445
- ],
446
- },
447
- {
448
- id: "openrouter",
449
- name: "OpenRouter",
450
- transport: "openai-chat",
451
- baseUrl: "https://openrouter.ai/api",
452
- apiKeyEnvVars: ["OPENROUTER_API_KEY"],
453
- authType: "bearer",
454
- isAggregator: true,
455
- defaultModel: "anthropic/claude-sonnet-4",
456
- extraHeaders: {
457
- "HTTP-Referer": "https://claw.bot",
458
- "X-Title": "XiaozhiClaw",
459
- },
460
- models: [
461
- {
462
- id: "anthropic/claude-sonnet-4",
463
- name: "Claude Sonnet 4 (via OpenRouter)",
464
- contextWindow: 200000,
465
- maxOutput: 16384,
466
- toolCall: true,
467
- reasoning: true,
468
- vision: true,
469
- costInput: 3.0,
470
- costOutput: 15.0,
471
- },
472
- {
473
- id: "deepseek/deepseek-chat",
474
- name: "DeepSeek V3 (via OpenRouter)",
475
- contextWindow: 64000,
476
- maxOutput: 8192,
477
- toolCall: true,
478
- reasoning: false,
479
- vision: false,
480
- costInput: 0.27,
481
- costOutput: 1.1,
482
- },
483
- ],
484
- },
485
- {
486
- id: "groq",
487
- name: "Groq",
488
- transport: "openai-chat",
489
- baseUrl: "https://api.groq.com/openai",
490
- apiKeyEnvVars: ["GROQ_API_KEY"],
491
- authType: "bearer",
492
- isAggregator: true,
493
- defaultModel: "llama-3.3-70b-versatile",
494
- models: [
495
- {
496
- id: "llama-3.3-70b-versatile",
497
- name: "Llama 3.3 70B (via Groq)",
498
- contextWindow: 131072,
499
- maxOutput: 8192,
500
- toolCall: true,
501
- reasoning: false,
502
- vision: false,
503
- costInput: 0.59,
504
- costOutput: 0.79,
505
- },
506
- ],
507
- },
508
- {
509
- id: "together",
510
- name: "Together AI",
511
- transport: "openai-chat",
512
- baseUrl: "https://api.together.xyz",
513
- apiKeyEnvVars: ["TOGETHER_API_KEY"],
514
- authType: "bearer",
515
- isAggregator: true,
516
- defaultModel: "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
517
- models: [
518
- {
519
- id: "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
520
- name: "Llama 3.1 70B Turbo (via Together)",
521
- contextWindow: 131072,
522
- maxOutput: 8192,
523
- toolCall: true,
524
- reasoning: false,
525
- vision: false,
526
- costInput: 0.88,
527
- costOutput: 0.88,
528
- },
529
- ],
530
- },
531
- ];
@@ -1,15 +0,0 @@
1
- /**
2
- * LLM Provider layer — public API surface.
3
- *
4
- * Provides: ProviderDef + LLMTransport + ProviderRegistry + LLMClient factory
5
- */
6
- export type { ProviderDef, ModelInfo, TransportType, AuthType } from "./provider-def.js";
7
- export type { LLMTransport, LLMRequest, LLMChunk, AccumulatedToolCall, } from "./transport.js";
8
- export { accumulateToolCalls } from "./transport.js";
9
- export { ProviderRegistry } from "./provider-registry.js";
10
- export { BUILTIN_PROVIDERS } from "./builtin-providers.js";
11
- export { ModelCatalog } from "./model-catalog.js";
12
- export type { LLMClientConfig, LLMClient } from "./llm-client.js";
13
- export { createLLMClient, autoDetectProvider } from "./llm-client.js";
14
- export { OpenAIChatTransport } from "./transports/openai-chat.js";
15
- export { AnthropicMessagesTransport } from "./transports/anthropic-messages.js";
package/dist/llm/index.js DELETED
@@ -1,14 +0,0 @@
1
- /**
2
- * LLM Provider layer — public API surface.
3
- *
4
- * Provides: ProviderDef + LLMTransport + ProviderRegistry + LLMClient factory
5
- */
6
- export { accumulateToolCalls } from "./transport.js";
7
- // Registry
8
- export { ProviderRegistry } from "./provider-registry.js";
9
- export { BUILTIN_PROVIDERS } from "./builtin-providers.js";
10
- export { ModelCatalog } from "./model-catalog.js";
11
- export { createLLMClient, autoDetectProvider } from "./llm-client.js";
12
- // Transports
13
- export { OpenAIChatTransport } from "./transports/openai-chat.js";
14
- export { AnthropicMessagesTransport } from "./transports/anthropic-messages.js";
@@ -1,43 +0,0 @@
1
- /**
2
- * LLM Client factory — resolves ProviderDef → creates LLMTransport instance.
3
- *
4
- * Replaces the old createAdminInferProxyClient() call chain.
5
- * User API key + ProviderDef → direct provider connection.
6
- */
7
- import type { ProviderDef } from "./provider-def.js";
8
- import type { LLMTransport } from "./transport.js";
9
- import { ProviderRegistry } from "./provider-registry.js";
10
- export interface LLMClientConfig {
11
- /** Provider id, e.g. "deepseek" */
12
- provider: string;
13
- /** Model id, e.g. "deepseek-chat" */
14
- model: string;
15
- /** User API key */
16
- apiKey: string;
17
- /** Optional base URL override */
18
- baseUrl?: string;
19
- }
20
- export interface LLMClient {
21
- transport: LLMTransport;
22
- apiKey: string;
23
- resolvedModel: string;
24
- providerDef: ProviderDef;
25
- }
26
- /**
27
- * Create an LLM client from config + registry.
28
- *
29
- * 1. Look up provider in registry
30
- * 2. Apply baseUrl override if provided
31
- * 3. Instantiate the correct transport
32
- */
33
- export declare function createLLMClient(config: LLMClientConfig, registry: ProviderRegistry): LLMClient;
34
- /**
35
- * Auto-detect provider from API key environment variables.
36
- * Scans registry for providers whose env vars are set.
37
- * Returns the first match.
38
- */
39
- export declare function autoDetectProvider(registry: ProviderRegistry): {
40
- providerId: string;
41
- apiKey: string;
42
- defaultModel: string;
43
- } | undefined;
@@ -1,67 +0,0 @@
1
- /**
2
- * LLM Client factory — resolves ProviderDef → creates LLMTransport instance.
3
- *
4
- * Replaces the old createAdminInferProxyClient() call chain.
5
- * User API key + ProviderDef → direct provider connection.
6
- */
7
- import { OpenAIChatTransport } from "./transports/openai-chat.js";
8
- import { AnthropicMessagesTransport } from "./transports/anthropic-messages.js";
9
- /**
10
- * Create an LLM client from config + registry.
11
- *
12
- * 1. Look up provider in registry
13
- * 2. Apply baseUrl override if provided
14
- * 3. Instantiate the correct transport
15
- */
16
- export function createLLMClient(config, registry) {
17
- // Apply user overrides to registry
18
- if (config.baseUrl) {
19
- registry.applyOverride(config.provider, { baseUrl: config.baseUrl });
20
- }
21
- const providerDef = registry.getProvider(config.provider);
22
- if (!providerDef) {
23
- throw new Error(`Unknown LLM provider: "${config.provider}". ` +
24
- `Available: ${registry.listProviders().map((p) => p.id).join(", ")}`);
25
- }
26
- const baseUrl = config.baseUrl ?? providerDef.baseUrl;
27
- const transport = createTransport(providerDef, baseUrl);
28
- return {
29
- transport,
30
- apiKey: config.apiKey,
31
- resolvedModel: config.model,
32
- providerDef,
33
- };
34
- }
35
- /**
36
- * Auto-detect provider from API key environment variables.
37
- * Scans registry for providers whose env vars are set.
38
- * Returns the first match.
39
- */
40
- export function autoDetectProvider(registry) {
41
- for (const provider of registry.listProviders()) {
42
- const key = registry.resolveApiKey(provider.id);
43
- if (key) {
44
- return {
45
- providerId: provider.id,
46
- apiKey: key,
47
- defaultModel: provider.defaultModel ?? provider.models?.[0]?.id ?? "",
48
- };
49
- }
50
- }
51
- return undefined;
52
- }
53
- function createTransport(providerDef, baseUrl) {
54
- switch (providerDef.transport) {
55
- case "openai-chat":
56
- return new OpenAIChatTransport({
57
- baseUrl,
58
- extraHeaders: providerDef.extraHeaders,
59
- supportsStreamOptions: providerDef.supportsStreamOptions,
60
- omitZeroTemperature: providerDef.omitZeroTemperature,
61
- });
62
- case "anthropic-messages":
63
- return new AnthropicMessagesTransport({ baseUrl });
64
- default:
65
- throw new Error(`Unsupported transport type: "${providerDef.transport}" for provider "${providerDef.id}"`);
66
- }
67
- }