@cuylabs/agent-core 0.8.0 → 0.9.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 (68) hide show
  1. package/dist/{builder-UpOWQMW3.d.ts → builder-BgZ_j4Vs.d.ts} +2 -1
  2. package/dist/{chunk-RZITT45F.js → chunk-4QFNWPIF.js} +4 -4
  3. package/dist/{chunk-BFM2YHNM.js → chunk-5ARZJWD2.js} +74 -37
  4. package/dist/{chunk-KUVSERLJ.js → chunk-DXFBQMXP.js} +5 -2
  5. package/dist/{chunk-CAA7FHIH.js → chunk-EKR6PKXU.js} +0 -100
  6. package/dist/{chunk-IVUJDISU.js → chunk-GFTW23FV.js} +5 -14
  7. package/dist/{chunk-7VKQ4WPB.js → chunk-H3FUYU52.js} +11 -3
  8. package/dist/chunk-I6PKJ7XQ.js +292 -0
  9. package/dist/chunk-IYWQOJMQ.js +102 -0
  10. package/dist/{chunk-4BDA7DQY.js → chunk-J4QDGZIA.js} +19 -3
  11. package/dist/{chunk-7MUFEN4K.js → chunk-JLXG2SH7.js} +349 -3
  12. package/dist/{chunk-YSLSEQ6B.js → chunk-MAZ5DY5B.js} +18 -30
  13. package/dist/{chunk-P6YF7USR.js → chunk-MHKK374K.js} +12 -11
  14. package/dist/{chunk-VBWWUHWI.js → chunk-OFDKHNCX.js} +4 -1
  15. package/dist/{chunk-YUUJK53A.js → chunk-RKEW5WXI.js} +1 -1
  16. package/dist/{chunk-LRHOS4ZN.js → chunk-SPILYYDF.js} +3 -2
  17. package/dist/{chunk-RFEKJKTO.js → chunk-UDCZ673N.js} +321 -275
  18. package/dist/{chunk-BDBZ3SLK.js → chunk-UHCJEM2E.js} +39 -2
  19. package/dist/chunk-WGZAPU6N.js +929 -0
  20. package/dist/{chunk-N6HWIEEA.js → chunk-WKHDSSXG.js} +140 -23
  21. package/dist/index-BCqEGzBj.d.ts +251 -0
  22. package/dist/{index-CWSchSql.d.ts → index-DQuTZ8xL.d.ts} +290 -13
  23. package/dist/index.d.ts +23 -29
  24. package/dist/index.js +776 -490
  25. package/dist/{errors → inference/errors}/index.d.ts +2 -2
  26. package/dist/{errors → inference/errors}/index.js +1 -1
  27. package/dist/inference/index.d.ts +10 -9
  28. package/dist/inference/index.js +34 -8
  29. package/dist/middleware/index.d.ts +5 -4
  30. package/dist/middleware/index.js +3 -3
  31. package/dist/models/index.d.ts +18 -16
  32. package/dist/models/index.js +47 -11
  33. package/dist/models/reasoning/index.d.ts +4 -0
  34. package/dist/{reasoning → models/reasoning}/index.js +2 -3
  35. package/dist/plugin/index.d.ts +414 -0
  36. package/dist/plugin/index.js +32 -0
  37. package/dist/presets/index.d.ts +3 -3
  38. package/dist/presets/index.js +7 -5
  39. package/dist/prompt/index.d.ts +6 -5
  40. package/dist/prompt/index.js +3 -2
  41. package/dist/runner-CI-XeR16.d.ts +91 -0
  42. package/dist/runtime/index.d.ts +7 -6
  43. package/dist/runtime/index.js +6 -7
  44. package/dist/safety/index.d.ts +1 -1
  45. package/dist/safety/index.js +1 -1
  46. package/dist/{session-manager-B_CWGTsl.d.ts → session-manager-KbYt2WUh.d.ts} +8 -0
  47. package/dist/signal/index.js +1 -1
  48. package/dist/skill/index.d.ts +2 -2
  49. package/dist/skill/index.js +3 -3
  50. package/dist/storage/index.d.ts +2 -2
  51. package/dist/storage/index.js +1 -1
  52. package/dist/sub-agent/index.d.ts +10 -9
  53. package/dist/sub-agent/index.js +21 -4
  54. package/dist/tool/index.d.ts +19 -5
  55. package/dist/tool/index.js +2 -2
  56. package/dist/{tool-BHbyUAy3.d.ts → tool-CZWN3KbO.d.ts} +1 -10
  57. package/dist/{tool-DLXAR9Ce.d.ts → tool-DkhSCV2Y.d.ts} +1 -1
  58. package/dist/tracking/index.d.ts +1 -1
  59. package/dist/tracking/index.js +1 -1
  60. package/dist/{types-KKDrdU9Y.d.ts → types-BlOKk-Bb.d.ts} +9 -4
  61. package/dist/{types-BnpEOYV-.d.ts → types-BlZwmnuW.d.ts} +1 -1
  62. package/dist/{runner-e2YRcUoX.d.ts → types-DTSkxakL.d.ts} +3 -138
  63. package/dist/{types-QKHHQLLq.d.ts → types-DmDwi2zI.d.ts} +7 -4
  64. package/package.json +15 -9
  65. package/dist/chunk-DWYX7ASF.js +0 -26
  66. package/dist/chunk-SQU2AJHO.js +0 -305
  67. package/dist/reasoning/index.d.ts +0 -116
  68. package/dist/types-QA4WhEfz.d.ts +0 -138
@@ -1,7 +1,10 @@
1
1
  import {
2
- getModelId,
3
- getProviderId
4
- } from "./chunk-DWYX7ASF.js";
2
+ DEFAULT_RESOLVER_OPTIONS,
3
+ PatternCapabilitySource,
4
+ extractModelId,
5
+ extractProvider,
6
+ likelySupportsReasoning
7
+ } from "./chunk-I6PKJ7XQ.js";
5
8
 
6
9
  // src/models/resolver.ts
7
10
  function parseKey(input) {
@@ -179,258 +182,6 @@ function createResolver(directory) {
179
182
  };
180
183
  }
181
184
 
182
- // src/models/types.ts
183
- var SourcePriority = /* @__PURE__ */ ((SourcePriority3) => {
184
- SourcePriority3[SourcePriority3["UserConfig"] = 0] = "UserConfig";
185
- SourcePriority3[SourcePriority3["LocalCache"] = 1] = "LocalCache";
186
- SourcePriority3[SourcePriority3["BundledData"] = 2] = "BundledData";
187
- SourcePriority3[SourcePriority3["PatternMatch"] = 3] = "PatternMatch";
188
- SourcePriority3[SourcePriority3["RemoteAPI"] = 4] = "RemoteAPI";
189
- return SourcePriority3;
190
- })(SourcePriority || {});
191
- var DEFAULT_RESOLVER_OPTIONS = {
192
- enableRemoteFetch: false,
193
- remoteApiUrl: "https://models.dev",
194
- cachePath: ".agent-core/cache",
195
- cacheTtlMs: 60 * 60 * 1e3,
196
- // 1 hour
197
- networkTimeoutMs: 10 * 1e3,
198
- // 10 seconds
199
- modelOverrides: {}
200
- };
201
-
202
- // src/models/profiles.ts
203
- var REASONING_PATTERNS = [
204
- // OpenAI o-series
205
- {
206
- pattern: /^o[134]-?(mini|pro|preview)?$/i,
207
- provider: "openai",
208
- capabilities: { reasoning: true, toolCalling: true },
209
- compatibility: { supportsReasoningEffort: true, thinkingFormat: "openai" },
210
- confidence: 0.95
211
- },
212
- // OpenAI GPT-5.x
213
- {
214
- pattern: /gpt-?5(\.\d)?/i,
215
- provider: "openai",
216
- capabilities: { reasoning: true, toolCalling: true },
217
- compatibility: { supportsReasoningEffort: true, thinkingFormat: "openai" },
218
- confidence: 0.9
219
- },
220
- // DeepSeek R1 variants
221
- {
222
- pattern: /deepseek[_-]?r1|r1[_-]distill/i,
223
- capabilities: { reasoning: true, toolCalling: false },
224
- confidence: 0.95
225
- },
226
- // Anthropic Claude with thinking
227
- {
228
- pattern: /claude.*thinking|thinking.*claude/i,
229
- provider: "anthropic",
230
- capabilities: { reasoning: true, toolCalling: true },
231
- compatibility: { thinkingFormat: "anthropic" },
232
- confidence: 0.9
233
- },
234
- // Claude 4.x series (reasoning capable)
235
- {
236
- pattern: /claude[_-]?(opus|sonnet)[_-]?4/i,
237
- provider: "anthropic",
238
- capabilities: { reasoning: true, toolCalling: true },
239
- compatibility: { thinkingFormat: "anthropic" },
240
- confidence: 0.85
241
- },
242
- // Gemini thinking models
243
- {
244
- pattern: /gemini.*thinking|gemini[_-]?2\.5[_-]?pro/i,
245
- provider: "google",
246
- capabilities: { reasoning: true, toolCalling: true },
247
- compatibility: { thinkingFormat: "google" },
248
- confidence: 0.85
249
- },
250
- // Gemini 3.x (future-proofing)
251
- {
252
- pattern: /gemini[_-]?3/i,
253
- provider: "google",
254
- capabilities: { reasoning: true, toolCalling: true },
255
- compatibility: { thinkingFormat: "google" },
256
- confidence: 0.8
257
- },
258
- // Grok reasoning models
259
- {
260
- pattern: /grok[_-]?\d[_-]?(mini|reasoning)/i,
261
- provider: "xai",
262
- capabilities: { reasoning: true, toolCalling: true },
263
- confidence: 0.85
264
- },
265
- // Qwen thinking models
266
- {
267
- pattern: /qwen.*thinking|qwen3/i,
268
- capabilities: { reasoning: true, toolCalling: true },
269
- confidence: 0.8
270
- },
271
- // Generic reasoning/thinking in name
272
- {
273
- pattern: /reasoning|thinking/i,
274
- capabilities: { reasoning: true },
275
- confidence: 0.7
276
- }
277
- ];
278
- var PROVIDER_PATTERNS = [
279
- { pattern: /^(gpt|o[134]|chatgpt|davinci)/i, provider: "openai" },
280
- { pattern: /^claude/i, provider: "anthropic" },
281
- { pattern: /^gemini|^palm/i, provider: "google" },
282
- { pattern: /^grok/i, provider: "xai" },
283
- { pattern: /^deepseek/i, provider: "deepseek" },
284
- { pattern: /^mistral|^mixtral|codestral/i, provider: "mistral" },
285
- { pattern: /^llama/i, provider: "meta" },
286
- { pattern: /^qwen/i, provider: "alibaba" },
287
- { pattern: /^command/i, provider: "cohere" }
288
- ];
289
- var CONTEXT_WINDOW_PROFILES = [
290
- // Anthropic Claude 4.x — 200k
291
- { pattern: /claude[_-]?(opus|sonnet)[_-]?4/i, tokens: 2e5 },
292
- // Anthropic Claude 3.5 — 200k
293
- { pattern: /claude[_-]?3[._-]?5/i, tokens: 2e5 },
294
- // Anthropic Claude 3 Opus/Sonnet/Haiku — 200k
295
- { pattern: /claude[_-]?3/i, tokens: 2e5 },
296
- // Anthropic Claude 2 — 100k
297
- { pattern: /claude[_-]?2/i, tokens: 1e5 },
298
- // OpenAI o-series (o1, o3, o4) — 200k
299
- { pattern: /^o[134]-?(mini|pro|preview)?$/i, tokens: 2e5 },
300
- // OpenAI GPT-5.x — 1M
301
- { pattern: /gpt-?5/i, tokens: 1e6 },
302
- // OpenAI GPT-4o — 128k
303
- { pattern: /gpt-?4o/i, tokens: 128e3 },
304
- // OpenAI GPT-4 turbo — 128k
305
- { pattern: /gpt-?4[_-]?turbo/i, tokens: 128e3 },
306
- // OpenAI GPT-4 — 8k (original)
307
- { pattern: /gpt-?4(?!o|[_-]?turbo)/i, tokens: 8192 },
308
- // OpenAI GPT-3.5 turbo — 16k
309
- { pattern: /gpt-?3[._-]?5/i, tokens: 16384 },
310
- // Google Gemini 2.5 Pro — 1M
311
- { pattern: /gemini[_-]?2[._-]?5[_-]?pro/i, tokens: 1e6 },
312
- // Google Gemini 2.x Flash — 1M
313
- { pattern: /gemini[_-]?2.*flash/i, tokens: 1e6 },
314
- // Google Gemini 2.x Pro — 1M
315
- { pattern: /gemini[_-]?2[._-]?\d?[_-]?pro/i, tokens: 1e6 },
316
- // Google Gemini 1.5 Pro/Flash — 1M
317
- { pattern: /gemini[_-]?1[._-]?5/i, tokens: 1e6 },
318
- // xAI Grok 3+ — 128k
319
- { pattern: /grok[_-]?\d/i, tokens: 128e3 },
320
- // Mistral Large — 128k
321
- { pattern: /mistral[_-]?large/i, tokens: 128e3 },
322
- // Mistral Medium — 32k
323
- { pattern: /mistral[_-]?medium/i, tokens: 32768 },
324
- // Codestral — 256k
325
- { pattern: /codestral/i, tokens: 256e3 },
326
- // Mistral generic — 32k
327
- { pattern: /mistral|mixtral/i, tokens: 32768 },
328
- // DeepSeek R1/V3 — 128k
329
- { pattern: /deepseek/i, tokens: 128e3 },
330
- // Qwen 3 — 128k
331
- { pattern: /qwen/i, tokens: 128e3 },
332
- // Meta Llama 3 — 128k
333
- { pattern: /llama[_-]?3/i, tokens: 128e3 },
334
- // Cohere Command R+ — 128k
335
- { pattern: /command[_-]?r/i, tokens: 128e3 }
336
- ];
337
- function inferContextWindow(modelId) {
338
- const normalized = modelId.toLowerCase();
339
- for (const { pattern, tokens } of CONTEXT_WINDOW_PROFILES) {
340
- if (pattern.test(normalized)) {
341
- return tokens;
342
- }
343
- }
344
- return void 0;
345
- }
346
- function inferProvider(modelId) {
347
- const normalized = modelId.toLowerCase();
348
- for (const { pattern, provider } of PROVIDER_PATTERNS) {
349
- if (pattern.test(normalized)) {
350
- return provider;
351
- }
352
- }
353
- if (modelId.includes("/")) {
354
- return modelId.split("/")[0];
355
- }
356
- return void 0;
357
- }
358
- function matchPatterns(modelId, providerHint) {
359
- const normalized = modelId.toLowerCase();
360
- for (const rule of REASONING_PATTERNS) {
361
- if (rule.provider && providerHint && rule.provider !== providerHint) {
362
- continue;
363
- }
364
- const matches = typeof rule.pattern === "string" ? normalized.includes(rule.pattern.toLowerCase()) : rule.pattern.test(normalized);
365
- if (matches) {
366
- return { rule, confidence: rule.confidence };
367
- }
368
- }
369
- return void 0;
370
- }
371
- function createDefaultCapabilities() {
372
- return {
373
- reasoning: false,
374
- toolCalling: true,
375
- temperature: true,
376
- attachments: false,
377
- streaming: true,
378
- inputModalities: ["text"],
379
- outputModalities: ["text"]
380
- };
381
- }
382
- var PatternCapabilitySource = class {
383
- priority = 3 /* PatternMatch */;
384
- name = "Pattern Matching";
385
- async lookup(modelId, providerHint) {
386
- const provider = providerHint || inferProvider(modelId);
387
- const match = matchPatterns(modelId, provider);
388
- const baseCapabilities = createDefaultCapabilities();
389
- if (match) {
390
- const entry = {
391
- id: modelId,
392
- name: modelId,
393
- provider: match.rule.provider || provider || "unknown",
394
- capabilities: {
395
- ...baseCapabilities,
396
- ...match.rule.capabilities,
397
- contextWindow: inferContextWindow(modelId)
398
- },
399
- compatibility: match.rule.compatibility
400
- };
401
- return {
402
- entry,
403
- source: this.priority,
404
- confident: match.confidence > 0.8
405
- };
406
- }
407
- return {
408
- entry: {
409
- id: modelId,
410
- name: modelId,
411
- provider: provider || "unknown",
412
- capabilities: {
413
- ...baseCapabilities,
414
- contextWindow: inferContextWindow(modelId)
415
- }
416
- },
417
- source: this.priority,
418
- confident: false
419
- };
420
- }
421
- async isAvailable() {
422
- return true;
423
- }
424
- };
425
- function likelySupportsReasoning(modelId) {
426
- const match = matchPatterns(modelId);
427
- return match !== void 0 && match.rule.capabilities.reasoning === true;
428
- }
429
- function getProviderCompatibility(modelId, provider) {
430
- const match = matchPatterns(modelId, provider);
431
- return match?.rule.compatibility;
432
- }
433
-
434
185
  // src/models/overrides.ts
435
186
  function normalizeKey(value) {
436
187
  const trimmed = value?.trim();
@@ -466,6 +217,9 @@ function applyCapabilityOverride(entry, override) {
466
217
  }
467
218
 
468
219
  // src/models/cache/adapters.ts
220
+ function logLocalStorageWarning(error) {
221
+ console.warn("[agent-core] Failed to write to localStorage:", error);
222
+ }
469
223
  function isNodeEnvironment() {
470
224
  return typeof process !== "undefined" && process.versions != null && process.versions.node != null;
471
225
  }
@@ -530,7 +284,7 @@ var LocalStorageAdapter = class {
530
284
  try {
531
285
  localStorage.setItem(this.key, JSON.stringify(data));
532
286
  } catch (error) {
533
- console.warn("[agent-core] Failed to write to localStorage:", error);
287
+ logLocalStorageWarning(error);
534
288
  }
535
289
  }
536
290
  async clear() {
@@ -572,6 +326,9 @@ function isExpired(data) {
572
326
  }
573
327
 
574
328
  // src/models/cache/manager.ts
329
+ function logCapabilityCacheWarning(error) {
330
+ console.warn("[agent-core] Failed to load capability cache:", error);
331
+ }
575
332
  var CapabilityCache = class {
576
333
  adapter;
577
334
  memoryCache = /* @__PURE__ */ new Map();
@@ -592,7 +349,7 @@ var CapabilityCache = class {
592
349
  }
593
350
  }
594
351
  } catch (error) {
595
- console.warn("[agent-core] Failed to load capability cache:", error);
352
+ logCapabilityCacheWarning(error);
596
353
  }
597
354
  this.loaded = true;
598
355
  }
@@ -897,12 +654,8 @@ var RemoteCapabilitySource = class {
897
654
  };
898
655
 
899
656
  // src/models/capability-resolver.ts
900
- function extractModelId(model) {
901
- return getModelId(model);
902
- }
903
- function extractProvider(model) {
904
- const provider = getProviderId(model);
905
- return provider ?? inferProvider(extractModelId(model));
657
+ function logCapabilityResolverWarning(message, error) {
658
+ console.warn(message, error);
906
659
  }
907
660
  var ModelCapabilityResolver = class {
908
661
  options;
@@ -935,7 +688,10 @@ var ModelCapabilityResolver = class {
935
688
  );
936
689
  if (remoteSource) {
937
690
  remoteSource.refresh().catch((err) => {
938
- console.warn("[agent-core] Background refresh failed:", err);
691
+ logCapabilityResolverWarning(
692
+ "[agent-core] Background refresh failed:",
693
+ err
694
+ );
939
695
  });
940
696
  }
941
697
  }
@@ -966,7 +722,10 @@ var ModelCapabilityResolver = class {
966
722
  }
967
723
  }
968
724
  } catch (error) {
969
- console.warn(`[agent-core] Source ${source.name} failed:`, error);
725
+ logCapabilityResolverWarning(
726
+ `[agent-core] Source ${source.name} failed:`,
727
+ error
728
+ );
970
729
  }
971
730
  }
972
731
  if (!bestResult?.entry) {
@@ -1094,15 +853,298 @@ function configureResolver(options) {
1094
853
  defaultResolver = new ModelCapabilityResolver(options);
1095
854
  }
1096
855
 
856
+ // src/models/reasoning/types.ts
857
+ var STANDARD_LEVELS = ["off", "low", "medium", "high"];
858
+ var EXTENDED_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh"];
859
+ var FIXED_LEVELS = ["medium"];
860
+ function shouldIncludeReasoningSummary() {
861
+ if (typeof process !== "undefined" && process.env) {
862
+ return process.env.CODE_AGENT_DISABLE_REASONING_SUMMARY !== "true";
863
+ }
864
+ return true;
865
+ }
866
+
867
+ // src/models/reasoning/providers.ts
868
+ function buildOpenAIOptions(level, compat) {
869
+ if (level === "off") return void 0;
870
+ const options = {};
871
+ if (compat?.supportsReasoningEffort !== false) {
872
+ options.reasoningEffort = level;
873
+ }
874
+ if (shouldIncludeReasoningSummary()) {
875
+ options.reasoningSummary = "auto";
876
+ }
877
+ return options;
878
+ }
879
+ var ANTHROPIC_BUDGETS = {
880
+ off: 0,
881
+ minimal: 2e3,
882
+ low: 4e3,
883
+ medium: 8e3,
884
+ high: 16e3,
885
+ xhigh: 31999
886
+ };
887
+ function buildAnthropicOptions(level) {
888
+ if (level === "off") return void 0;
889
+ return {
890
+ thinking: {
891
+ type: "enabled",
892
+ budgetTokens: ANTHROPIC_BUDGETS[level]
893
+ }
894
+ };
895
+ }
896
+ var GOOGLE_BUDGETS = {
897
+ off: 0,
898
+ minimal: 2e3,
899
+ low: 4e3,
900
+ medium: 8e3,
901
+ high: 16e3,
902
+ xhigh: 24576
903
+ };
904
+ function buildGoogleOptions(level, modelId) {
905
+ if (level === "off") return void 0;
906
+ if (modelId?.includes("gemini-3") || modelId?.includes("gemini-4")) {
907
+ return {
908
+ thinkingConfig: {
909
+ includeThoughts: true,
910
+ thinkingLevel: level === "high" || level === "xhigh" ? "high" : "low"
911
+ }
912
+ };
913
+ }
914
+ return {
915
+ thinkingConfig: {
916
+ includeThoughts: true,
917
+ thinkingBudget: GOOGLE_BUDGETS[level]
918
+ }
919
+ };
920
+ }
921
+ function buildXAIOptions(level) {
922
+ if (level === "off") return void 0;
923
+ return { reasoningEffort: level };
924
+ }
925
+ function buildGroqOptions(level) {
926
+ if (level === "off") return void 0;
927
+ return {
928
+ includeThoughts: true,
929
+ thinkingLevel: level === "high" || level === "xhigh" ? "high" : "low"
930
+ };
931
+ }
932
+ var BEDROCK_ANTHROPIC_BUDGETS = {
933
+ off: 0,
934
+ minimal: 2e3,
935
+ low: 4e3,
936
+ medium: 8e3,
937
+ high: 16e3,
938
+ xhigh: 31999
939
+ };
940
+ function buildBedrockOptions(level, modelId) {
941
+ if (level === "off") return void 0;
942
+ if (modelId?.includes("anthropic") || modelId?.includes("claude")) {
943
+ return {
944
+ reasoningConfig: {
945
+ type: "enabled",
946
+ budgetTokens: BEDROCK_ANTHROPIC_BUDGETS[level]
947
+ }
948
+ };
949
+ }
950
+ return {
951
+ reasoningConfig: {
952
+ type: "enabled",
953
+ maxReasoningEffort: level
954
+ }
955
+ };
956
+ }
957
+ function buildOpenRouterOptions(level) {
958
+ if (level === "off") return void 0;
959
+ return {
960
+ reasoning: { effort: level }
961
+ };
962
+ }
963
+ var PROVIDER_KEY_MAP = {
964
+ "openai.chat": "openai",
965
+ "openai.responses": "openai",
966
+ "anthropic.messages": "anthropic",
967
+ "google.generative-ai": "google",
968
+ "bedrock": "bedrock",
969
+ "azure": "azure",
970
+ "xai": "xai",
971
+ "deepinfra": "deepinfra",
972
+ "togetherai": "togetherai",
973
+ "groq": "groq",
974
+ "mistral": "mistral"
975
+ };
976
+ function getProviderOptionsKey(provider) {
977
+ return PROVIDER_KEY_MAP[provider] || provider.split(".")[0] || "unknown";
978
+ }
979
+
980
+ // src/models/reasoning/config.ts
981
+ async function getReasoningConfig(model) {
982
+ const resolver = getDefaultResolver();
983
+ const result = await resolver.resolve(model);
984
+ const { capabilities, compatibility } = result.entry;
985
+ const provider = extractProvider(model);
986
+ const modelId = extractModelId(model).toLowerCase();
987
+ if (!capabilities.reasoning) {
988
+ return {
989
+ supportsReasoning: false,
990
+ availableLevels: ["off"],
991
+ getProviderOptions: () => void 0
992
+ };
993
+ }
994
+ if (provider?.includes("openai") || modelId.includes("gpt") || modelId.match(/^o[134]/)) {
995
+ if (modelId === "o1-mini") {
996
+ return {
997
+ supportsReasoning: true,
998
+ availableLevels: FIXED_LEVELS,
999
+ getProviderOptions: () => void 0
1000
+ };
1001
+ }
1002
+ const isAdvanced = modelId.includes("gpt-5") || modelId.includes("o3") || modelId.includes("o4");
1003
+ return {
1004
+ supportsReasoning: true,
1005
+ availableLevels: isAdvanced ? EXTENDED_LEVELS : STANDARD_LEVELS,
1006
+ getProviderOptions: (level) => buildOpenAIOptions(level, compatibility)
1007
+ };
1008
+ }
1009
+ if (provider?.includes("anthropic") || modelId.includes("claude")) {
1010
+ return {
1011
+ supportsReasoning: true,
1012
+ availableLevels: ["off", "low", "medium", "high"],
1013
+ getProviderOptions: buildAnthropicOptions
1014
+ };
1015
+ }
1016
+ if (provider?.includes("google") || modelId.includes("gemini")) {
1017
+ return {
1018
+ supportsReasoning: true,
1019
+ availableLevels: STANDARD_LEVELS,
1020
+ getProviderOptions: (level) => buildGoogleOptions(level, modelId)
1021
+ };
1022
+ }
1023
+ if (provider?.includes("xai") || modelId.includes("grok")) {
1024
+ return {
1025
+ supportsReasoning: true,
1026
+ availableLevels: STANDARD_LEVELS,
1027
+ getProviderOptions: buildXAIOptions
1028
+ };
1029
+ }
1030
+ if (provider?.includes("bedrock")) {
1031
+ return {
1032
+ supportsReasoning: true,
1033
+ availableLevels: STANDARD_LEVELS,
1034
+ getProviderOptions: (level) => buildBedrockOptions(level, modelId)
1035
+ };
1036
+ }
1037
+ if (provider?.includes("groq")) {
1038
+ return {
1039
+ supportsReasoning: true,
1040
+ availableLevels: ["off", "low", "high"],
1041
+ getProviderOptions: buildGroqOptions
1042
+ };
1043
+ }
1044
+ if (provider?.includes("openrouter")) {
1045
+ return {
1046
+ supportsReasoning: true,
1047
+ availableLevels: STANDARD_LEVELS,
1048
+ getProviderOptions: buildOpenRouterOptions
1049
+ };
1050
+ }
1051
+ if (modelId.includes("r1") || modelId.includes("deepseek")) {
1052
+ return {
1053
+ supportsReasoning: true,
1054
+ availableLevels: FIXED_LEVELS,
1055
+ getProviderOptions: () => void 0
1056
+ };
1057
+ }
1058
+ return {
1059
+ supportsReasoning: true,
1060
+ availableLevels: STANDARD_LEVELS,
1061
+ getProviderOptions: (level) => buildOpenAIOptions(level, compatibility)
1062
+ };
1063
+ }
1064
+ function getReasoningConfigSync(model) {
1065
+ const modelId = extractModelId(model).toLowerCase();
1066
+ const provider = extractProvider(model) || "";
1067
+ const supportsReasoning2 = modelId.match(/^o[134]/) !== null || modelId.includes("gpt-5") || modelId.includes("r1") || modelId.includes("thinking") || modelId.includes("reasoning") || modelId.includes("grok") && modelId.includes("mini");
1068
+ if (!supportsReasoning2) {
1069
+ return {
1070
+ supportsReasoning: false,
1071
+ availableLevels: ["off"],
1072
+ getProviderOptions: () => void 0
1073
+ };
1074
+ }
1075
+ const isOpenAI = provider.includes("openai") || !!modelId.match(/^o[134]/) || modelId.includes("gpt");
1076
+ const isAnthropic = provider.includes("anthropic") || modelId.includes("claude");
1077
+ const isGoogle = provider.includes("google") || modelId.includes("gemini");
1078
+ const isXAI = provider.includes("xai") || modelId.includes("grok");
1079
+ const isBedrock = provider.includes("bedrock");
1080
+ const isGroq = provider.includes("groq");
1081
+ const isOpenRouter = provider.includes("openrouter");
1082
+ return {
1083
+ supportsReasoning: true,
1084
+ availableLevels: STANDARD_LEVELS,
1085
+ getProviderOptions: (level) => {
1086
+ if (level === "off") return void 0;
1087
+ if (isOpenAI) {
1088
+ const opts = { reasoningEffort: level };
1089
+ if (shouldIncludeReasoningSummary()) opts.reasoningSummary = "auto";
1090
+ return opts;
1091
+ }
1092
+ if (isAnthropic) return buildAnthropicOptions(level);
1093
+ if (isGoogle) return buildGoogleOptions(level, modelId);
1094
+ if (isXAI) return buildXAIOptions(level);
1095
+ if (isBedrock) return buildBedrockOptions(level, modelId);
1096
+ if (isGroq) return buildGroqOptions(level);
1097
+ if (isOpenRouter) return buildOpenRouterOptions(level);
1098
+ const defaultOpts = { reasoningEffort: level };
1099
+ if (shouldIncludeReasoningSummary()) defaultOpts.reasoningSummary = "auto";
1100
+ return defaultOpts;
1101
+ }
1102
+ };
1103
+ }
1104
+ async function buildReasoningOptions(model, level) {
1105
+ if (level === "off") return void 0;
1106
+ const config = await getReasoningConfig(model);
1107
+ if (!config.supportsReasoning) return void 0;
1108
+ const effectiveLevel = config.availableLevels.includes(level) ? level : config.availableLevels[config.availableLevels.length - 1];
1109
+ const options = config.getProviderOptions(effectiveLevel);
1110
+ if (!options) return void 0;
1111
+ const provider = extractProvider(model) || "";
1112
+ const providerKey = getProviderOptionsKey(provider);
1113
+ return { [providerKey]: options };
1114
+ }
1115
+ function buildReasoningOptionsSync(model, level) {
1116
+ if (level === "off") return void 0;
1117
+ const config = getReasoningConfigSync(model);
1118
+ if (!config.supportsReasoning) return void 0;
1119
+ const effectiveLevel = config.availableLevels.includes(level) ? level : config.availableLevels[config.availableLevels.length - 1];
1120
+ const options = config.getProviderOptions(effectiveLevel);
1121
+ if (!options) return void 0;
1122
+ const provider = extractProvider(model) || "";
1123
+ const providerKey = getProviderOptionsKey(provider);
1124
+ return { [providerKey]: options };
1125
+ }
1126
+ async function supportsReasoning(model) {
1127
+ const resolver = getDefaultResolver();
1128
+ return resolver.supportsReasoning(model);
1129
+ }
1130
+ function supportsReasoningSync(model) {
1131
+ return likelySupportsReasoning(extractModelId(model));
1132
+ }
1133
+
1097
1134
  export {
1135
+ STANDARD_LEVELS,
1136
+ EXTENDED_LEVELS,
1137
+ FIXED_LEVELS,
1138
+ shouldIncludeReasoningSummary,
1139
+ buildOpenAIOptions,
1140
+ buildAnthropicOptions,
1141
+ buildGoogleOptions,
1142
+ buildXAIOptions,
1143
+ buildGroqOptions,
1144
+ buildBedrockOptions,
1145
+ buildOpenRouterOptions,
1146
+ getProviderOptionsKey,
1098
1147
  createResolver,
1099
- SourcePriority,
1100
- DEFAULT_RESOLVER_OPTIONS,
1101
- inferContextWindow,
1102
- inferProvider,
1103
- PatternCapabilitySource,
1104
- likelySupportsReasoning,
1105
- getProviderCompatibility,
1106
1148
  findCapabilityOverride,
1107
1149
  applyCapabilityOverride,
1108
1150
  CapabilityCache,
@@ -1110,9 +1152,13 @@ export {
1110
1152
  getNetworkStatus,
1111
1153
  RemoteCapabilityFetcher,
1112
1154
  RemoteCapabilitySource,
1113
- extractModelId,
1114
- extractProvider,
1115
1155
  ModelCapabilityResolver,
1116
1156
  getDefaultResolver,
1117
- configureResolver
1157
+ configureResolver,
1158
+ getReasoningConfig,
1159
+ getReasoningConfigSync,
1160
+ buildReasoningOptions,
1161
+ buildReasoningOptionsSync,
1162
+ supportsReasoning,
1163
+ supportsReasoningSync
1118
1164
  };