@proxysoul/soulforge 2.14.2 → 2.14.3

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.
@@ -49520,7 +49520,7 @@ var package_default;
49520
49520
  var init_package = __esm(() => {
49521
49521
  package_default = {
49522
49522
  name: "@proxysoul/soulforge",
49523
- version: "2.14.2",
49523
+ version: "2.14.3",
49524
49524
  description: "Graph-powered code intelligence \u2014 multi-agent coding with codebase-aware AI",
49525
49525
  repository: {
49526
49526
  type: "git",
@@ -51412,760 +51412,12 @@ var init_custom = __esm(() => {
51412
51412
  init_secrets();
51413
51413
  });
51414
51414
 
51415
- // node_modules/@ai-sdk/deepseek/dist/index.mjs
51416
- function convertToDeepSeekChatMessages({
51417
- prompt,
51418
- responseFormat
51419
- }) {
51420
- var _a21;
51421
- const messages = [];
51422
- const warnings = [];
51423
- if ((responseFormat == null ? undefined : responseFormat.type) === "json") {
51424
- if (responseFormat.schema == null) {
51425
- messages.push({
51426
- role: "system",
51427
- content: "Return JSON."
51428
- });
51429
- } else {
51430
- messages.push({
51431
- role: "system",
51432
- content: "Return JSON that conforms to the following schema: " + JSON.stringify(responseFormat.schema)
51433
- });
51434
- warnings.push({
51435
- type: "compatibility",
51436
- feature: "responseFormat JSON schema",
51437
- details: "JSON response schema is injected into the system message."
51438
- });
51439
- }
51440
- }
51441
- let lastUserMessageIndex = -1;
51442
- for (let i = prompt.length - 1;i >= 0; i--) {
51443
- if (prompt[i].role === "user") {
51444
- lastUserMessageIndex = i;
51445
- break;
51446
- }
51447
- }
51448
- let index = -1;
51449
- for (const { role, content } of prompt) {
51450
- index++;
51451
- switch (role) {
51452
- case "system": {
51453
- messages.push({ role: "system", content });
51454
- break;
51455
- }
51456
- case "user": {
51457
- let userContent = "";
51458
- for (const part of content) {
51459
- if (part.type === "text") {
51460
- userContent += part.text;
51461
- } else {
51462
- warnings.push({
51463
- type: "unsupported",
51464
- feature: `user message part type: ${part.type}`
51465
- });
51466
- }
51467
- }
51468
- messages.push({
51469
- role: "user",
51470
- content: userContent
51471
- });
51472
- break;
51473
- }
51474
- case "assistant": {
51475
- let text2 = "";
51476
- let reasoning;
51477
- const toolCalls = [];
51478
- for (const part of content) {
51479
- switch (part.type) {
51480
- case "text": {
51481
- text2 += part.text;
51482
- break;
51483
- }
51484
- case "reasoning": {
51485
- if (index <= lastUserMessageIndex) {
51486
- break;
51487
- }
51488
- if (reasoning == null) {
51489
- reasoning = part.text;
51490
- } else {
51491
- reasoning += part.text;
51492
- }
51493
- break;
51494
- }
51495
- case "tool-call": {
51496
- toolCalls.push({
51497
- id: part.toolCallId,
51498
- type: "function",
51499
- function: {
51500
- name: part.toolName,
51501
- arguments: JSON.stringify(part.input)
51502
- }
51503
- });
51504
- break;
51505
- }
51506
- }
51507
- }
51508
- messages.push({
51509
- role: "assistant",
51510
- content: text2,
51511
- reasoning_content: reasoning,
51512
- tool_calls: toolCalls.length > 0 ? toolCalls : undefined
51513
- });
51514
- break;
51515
- }
51516
- case "tool": {
51517
- for (const toolResponse of content) {
51518
- if (toolResponse.type === "tool-approval-response") {
51519
- continue;
51520
- }
51521
- const output = toolResponse.output;
51522
- let contentValue;
51523
- switch (output.type) {
51524
- case "text":
51525
- case "error-text":
51526
- contentValue = output.value;
51527
- break;
51528
- case "execution-denied":
51529
- contentValue = (_a21 = output.reason) != null ? _a21 : "Tool execution denied.";
51530
- break;
51531
- case "content":
51532
- case "json":
51533
- case "error-json":
51534
- contentValue = JSON.stringify(output.value);
51535
- break;
51536
- }
51537
- messages.push({
51538
- role: "tool",
51539
- tool_call_id: toolResponse.toolCallId,
51540
- content: contentValue
51541
- });
51542
- }
51543
- break;
51544
- }
51545
- default: {
51546
- warnings.push({
51547
- type: "unsupported",
51548
- feature: `message role: ${role}`
51549
- });
51550
- break;
51551
- }
51552
- }
51553
- }
51554
- return { messages, warnings };
51555
- }
51556
- function convertDeepSeekUsage(usage) {
51557
- var _a21, _b16, _c, _d, _e;
51558
- if (usage == null) {
51559
- return {
51560
- inputTokens: {
51561
- total: undefined,
51562
- noCache: undefined,
51563
- cacheRead: undefined,
51564
- cacheWrite: undefined
51565
- },
51566
- outputTokens: {
51567
- total: undefined,
51568
- text: undefined,
51569
- reasoning: undefined
51570
- },
51571
- raw: undefined
51572
- };
51573
- }
51574
- const promptTokens = (_a21 = usage.prompt_tokens) != null ? _a21 : 0;
51575
- const completionTokens = (_b16 = usage.completion_tokens) != null ? _b16 : 0;
51576
- const cacheReadTokens = (_c = usage.prompt_cache_hit_tokens) != null ? _c : 0;
51577
- const reasoningTokens = (_e = (_d = usage.completion_tokens_details) == null ? undefined : _d.reasoning_tokens) != null ? _e : 0;
51578
- return {
51579
- inputTokens: {
51580
- total: promptTokens,
51581
- noCache: promptTokens - cacheReadTokens,
51582
- cacheRead: cacheReadTokens,
51583
- cacheWrite: undefined
51584
- },
51585
- outputTokens: {
51586
- total: completionTokens,
51587
- text: completionTokens - reasoningTokens,
51588
- reasoning: reasoningTokens
51589
- },
51590
- raw: usage
51591
- };
51592
- }
51593
- function prepareTools5({
51594
- tools,
51595
- toolChoice
51596
- }) {
51597
- tools = (tools == null ? undefined : tools.length) ? tools : undefined;
51598
- const toolWarnings = [];
51599
- if (tools == null) {
51600
- return { tools: undefined, toolChoice: undefined, toolWarnings };
51601
- }
51602
- const deepseekTools = [];
51603
- for (const tool2 of tools) {
51604
- if (tool2.type === "provider") {
51605
- toolWarnings.push({
51606
- type: "unsupported",
51607
- feature: `provider-defined tool ${tool2.id}`
51608
- });
51609
- } else {
51610
- deepseekTools.push({
51611
- type: "function",
51612
- function: {
51613
- name: tool2.name,
51614
- description: tool2.description,
51615
- parameters: tool2.inputSchema,
51616
- ...tool2.strict != null ? { strict: tool2.strict } : {}
51617
- }
51618
- });
51619
- }
51620
- }
51621
- if (toolChoice == null) {
51622
- return { tools: deepseekTools, toolChoice: undefined, toolWarnings };
51623
- }
51624
- const type = toolChoice == null ? undefined : toolChoice.type;
51625
- switch (type) {
51626
- case "auto":
51627
- case "none":
51628
- case "required":
51629
- return { tools: deepseekTools, toolChoice: type, toolWarnings };
51630
- case "tool":
51631
- return {
51632
- tools: deepseekTools,
51633
- toolChoice: {
51634
- type: "function",
51635
- function: { name: toolChoice.toolName }
51636
- },
51637
- toolWarnings
51638
- };
51639
- default: {
51640
- return {
51641
- tools: deepseekTools,
51642
- toolChoice: undefined,
51643
- toolWarnings: [
51644
- ...toolWarnings,
51645
- {
51646
- type: "unsupported",
51647
- feature: `tool choice type: ${type}`
51648
- }
51649
- ]
51650
- };
51651
- }
51652
- }
51653
- }
51654
- function getResponseMetadata5({
51655
- id,
51656
- model,
51657
- created
51658
- }) {
51659
- return {
51660
- id: id != null ? id : undefined,
51661
- modelId: model != null ? model : undefined,
51662
- timestamp: created != null ? new Date(created * 1000) : undefined
51663
- };
51664
- }
51665
- function mapDeepSeekFinishReason(finishReason) {
51666
- switch (finishReason) {
51667
- case "stop":
51668
- return "stop";
51669
- case "length":
51670
- return "length";
51671
- case "content_filter":
51672
- return "content-filter";
51673
- case "tool_calls":
51674
- return "tool-calls";
51675
- case "insufficient_system_resource":
51676
- return "error";
51677
- default:
51678
- return "other";
51679
- }
51680
- }
51681
- function createDeepSeek(options = {}) {
51682
- var _a21;
51683
- const baseURL = withoutTrailingSlash((_a21 = options.baseURL) != null ? _a21 : "https://api.deepseek.com");
51684
- const getHeaders = () => withUserAgentSuffix({
51685
- Authorization: `Bearer ${loadApiKey({
51686
- apiKey: options.apiKey,
51687
- environmentVariableName: "DEEPSEEK_API_KEY",
51688
- description: "DeepSeek API key"
51689
- })}`,
51690
- ...options.headers
51691
- }, `ai-sdk/deepseek/${VERSION8}`);
51692
- const createLanguageModel = (modelId) => {
51693
- return new DeepSeekChatLanguageModel(modelId, {
51694
- provider: `deepseek.chat`,
51695
- url: ({ path }) => `${baseURL}${path}`,
51696
- headers: getHeaders,
51697
- fetch: options.fetch
51698
- });
51699
- };
51700
- const provider = (modelId) => createLanguageModel(modelId);
51701
- provider.specificationVersion = "v3";
51702
- provider.languageModel = createLanguageModel;
51703
- provider.chat = createLanguageModel;
51704
- provider.embeddingModel = (modelId) => {
51705
- throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
51706
- };
51707
- provider.textEmbeddingModel = provider.embeddingModel;
51708
- provider.imageModel = (modelId) => {
51709
- throw new NoSuchModelError({ modelId, modelType: "imageModel" });
51710
- };
51711
- return provider;
51712
- }
51713
- var tokenUsageSchema, deepSeekErrorSchema, deepseekChatResponseSchema, deepseekChatChunkSchema, deepseekLanguageModelOptions, DeepSeekChatLanguageModel = class {
51714
- constructor(modelId, config2) {
51715
- this.specificationVersion = "v3";
51716
- this.supportedUrls = {};
51717
- this.modelId = modelId;
51718
- this.config = config2;
51719
- this.failedResponseHandler = createJsonErrorResponseHandler({
51720
- errorSchema: deepSeekErrorSchema,
51721
- errorToMessage: (error48) => error48.error.message
51722
- });
51723
- }
51724
- get provider() {
51725
- return this.config.provider;
51726
- }
51727
- get providerOptionsName() {
51728
- return this.config.provider.split(".")[0].trim();
51729
- }
51730
- async getArgs({
51731
- prompt,
51732
- maxOutputTokens,
51733
- temperature,
51734
- topP,
51735
- topK,
51736
- frequencyPenalty,
51737
- presencePenalty,
51738
- providerOptions,
51739
- stopSequences,
51740
- responseFormat,
51741
- seed,
51742
- toolChoice,
51743
- tools
51744
- }) {
51745
- var _a21, _b16;
51746
- const deepseekOptions = (_a21 = await parseProviderOptions({
51747
- provider: this.providerOptionsName,
51748
- providerOptions,
51749
- schema: deepseekLanguageModelOptions
51750
- })) != null ? _a21 : {};
51751
- const { messages, warnings } = convertToDeepSeekChatMessages({
51752
- prompt,
51753
- responseFormat
51754
- });
51755
- if (topK != null) {
51756
- warnings.push({ type: "unsupported", feature: "topK" });
51757
- }
51758
- if (seed != null) {
51759
- warnings.push({ type: "unsupported", feature: "seed" });
51760
- }
51761
- const {
51762
- tools: deepseekTools,
51763
- toolChoice: deepseekToolChoices,
51764
- toolWarnings
51765
- } = prepareTools5({
51766
- tools,
51767
- toolChoice
51768
- });
51769
- return {
51770
- args: {
51771
- model: this.modelId,
51772
- max_tokens: maxOutputTokens,
51773
- temperature,
51774
- top_p: topP,
51775
- frequency_penalty: frequencyPenalty,
51776
- presence_penalty: presencePenalty,
51777
- response_format: (responseFormat == null ? undefined : responseFormat.type) === "json" ? { type: "json_object" } : undefined,
51778
- stop: stopSequences,
51779
- messages,
51780
- tools: deepseekTools,
51781
- tool_choice: deepseekToolChoices,
51782
- thinking: ((_b16 = deepseekOptions.thinking) == null ? undefined : _b16.type) != null ? { type: deepseekOptions.thinking.type } : undefined
51783
- },
51784
- warnings: [...warnings, ...toolWarnings]
51785
- };
51786
- }
51787
- async doGenerate(options) {
51788
- var _a21, _b16, _c, _d;
51789
- const { args, warnings } = await this.getArgs({ ...options });
51790
- const {
51791
- responseHeaders,
51792
- value: responseBody,
51793
- rawValue: rawResponse
51794
- } = await postJsonToApi({
51795
- url: this.config.url({
51796
- path: "/chat/completions",
51797
- modelId: this.modelId
51798
- }),
51799
- headers: combineHeaders(this.config.headers(), options.headers),
51800
- body: args,
51801
- failedResponseHandler: this.failedResponseHandler,
51802
- successfulResponseHandler: createJsonResponseHandler(deepseekChatResponseSchema),
51803
- abortSignal: options.abortSignal,
51804
- fetch: this.config.fetch
51805
- });
51806
- const choice2 = responseBody.choices[0];
51807
- const content = [];
51808
- const reasoning = choice2.message.reasoning_content;
51809
- if (reasoning != null && reasoning.length > 0) {
51810
- content.push({
51811
- type: "reasoning",
51812
- text: reasoning
51813
- });
51814
- }
51815
- if (choice2.message.tool_calls != null) {
51816
- for (const toolCall of choice2.message.tool_calls) {
51817
- content.push({
51818
- type: "tool-call",
51819
- toolCallId: (_a21 = toolCall.id) != null ? _a21 : generateId(),
51820
- toolName: toolCall.function.name,
51821
- input: toolCall.function.arguments
51822
- });
51823
- }
51824
- }
51825
- const text2 = choice2.message.content;
51826
- if (text2 != null && text2.length > 0) {
51827
- content.push({ type: "text", text: text2 });
51828
- }
51829
- return {
51830
- content,
51831
- finishReason: {
51832
- unified: mapDeepSeekFinishReason(choice2.finish_reason),
51833
- raw: (_b16 = choice2.finish_reason) != null ? _b16 : undefined
51834
- },
51835
- usage: convertDeepSeekUsage(responseBody.usage),
51836
- providerMetadata: {
51837
- [this.providerOptionsName]: {
51838
- promptCacheHitTokens: (_c = responseBody.usage) == null ? undefined : _c.prompt_cache_hit_tokens,
51839
- promptCacheMissTokens: (_d = responseBody.usage) == null ? undefined : _d.prompt_cache_miss_tokens
51840
- }
51841
- },
51842
- request: { body: args },
51843
- response: {
51844
- ...getResponseMetadata5(responseBody),
51845
- headers: responseHeaders,
51846
- body: rawResponse
51847
- },
51848
- warnings
51849
- };
51850
- }
51851
- async doStream(options) {
51852
- const { args, warnings } = await this.getArgs({ ...options });
51853
- const body = {
51854
- ...args,
51855
- stream: true,
51856
- stream_options: { include_usage: true }
51857
- };
51858
- const { responseHeaders, value: response } = await postJsonToApi({
51859
- url: this.config.url({
51860
- path: "/chat/completions",
51861
- modelId: this.modelId
51862
- }),
51863
- headers: combineHeaders(this.config.headers(), options.headers),
51864
- body,
51865
- failedResponseHandler: this.failedResponseHandler,
51866
- successfulResponseHandler: createEventSourceResponseHandler(deepseekChatChunkSchema),
51867
- abortSignal: options.abortSignal,
51868
- fetch: this.config.fetch
51869
- });
51870
- const toolCalls = [];
51871
- let finishReason = {
51872
- unified: "other",
51873
- raw: undefined
51874
- };
51875
- let usage = undefined;
51876
- let isFirstChunk = true;
51877
- const providerOptionsName = this.providerOptionsName;
51878
- let isActiveReasoning = false;
51879
- let isActiveText = false;
51880
- return {
51881
- stream: response.pipeThrough(new TransformStream({
51882
- start(controller) {
51883
- controller.enqueue({ type: "stream-start", warnings });
51884
- },
51885
- transform(chunk, controller) {
51886
- var _a21, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
51887
- if (options.includeRawChunks) {
51888
- controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
51889
- }
51890
- if (!chunk.success) {
51891
- finishReason = { unified: "error", raw: undefined };
51892
- controller.enqueue({ type: "error", error: chunk.error });
51893
- return;
51894
- }
51895
- const value = chunk.value;
51896
- if ("error" in value) {
51897
- finishReason = { unified: "error", raw: undefined };
51898
- controller.enqueue({ type: "error", error: value.error.message });
51899
- return;
51900
- }
51901
- if (isFirstChunk) {
51902
- isFirstChunk = false;
51903
- controller.enqueue({
51904
- type: "response-metadata",
51905
- ...getResponseMetadata5(value)
51906
- });
51907
- }
51908
- if (value.usage != null) {
51909
- usage = value.usage;
51910
- }
51911
- const choice2 = value.choices[0];
51912
- if ((choice2 == null ? undefined : choice2.finish_reason) != null) {
51913
- finishReason = {
51914
- unified: mapDeepSeekFinishReason(choice2.finish_reason),
51915
- raw: choice2.finish_reason
51916
- };
51917
- }
51918
- if ((choice2 == null ? undefined : choice2.delta) == null) {
51919
- return;
51920
- }
51921
- const delta = choice2.delta;
51922
- const reasoningContent = delta.reasoning_content;
51923
- if (reasoningContent) {
51924
- if (!isActiveReasoning) {
51925
- controller.enqueue({
51926
- type: "reasoning-start",
51927
- id: "reasoning-0"
51928
- });
51929
- isActiveReasoning = true;
51930
- }
51931
- controller.enqueue({
51932
- type: "reasoning-delta",
51933
- id: "reasoning-0",
51934
- delta: reasoningContent
51935
- });
51936
- }
51937
- if (delta.content) {
51938
- if (!isActiveText) {
51939
- controller.enqueue({ type: "text-start", id: "txt-0" });
51940
- isActiveText = true;
51941
- }
51942
- if (isActiveReasoning) {
51943
- controller.enqueue({
51944
- type: "reasoning-end",
51945
- id: "reasoning-0"
51946
- });
51947
- isActiveReasoning = false;
51948
- }
51949
- controller.enqueue({
51950
- type: "text-delta",
51951
- id: "txt-0",
51952
- delta: delta.content
51953
- });
51954
- }
51955
- if (delta.tool_calls != null) {
51956
- if (isActiveReasoning) {
51957
- controller.enqueue({
51958
- type: "reasoning-end",
51959
- id: "reasoning-0"
51960
- });
51961
- isActiveReasoning = false;
51962
- }
51963
- for (const toolCallDelta of delta.tool_calls) {
51964
- const index = toolCallDelta.index;
51965
- if (toolCalls[index] == null) {
51966
- if (toolCallDelta.id == null) {
51967
- throw new InvalidResponseDataError({
51968
- data: toolCallDelta,
51969
- message: `Expected 'id' to be a string.`
51970
- });
51971
- }
51972
- if (((_a21 = toolCallDelta.function) == null ? undefined : _a21.name) == null) {
51973
- throw new InvalidResponseDataError({
51974
- data: toolCallDelta,
51975
- message: `Expected 'function.name' to be a string.`
51976
- });
51977
- }
51978
- controller.enqueue({
51979
- type: "tool-input-start",
51980
- id: toolCallDelta.id,
51981
- toolName: toolCallDelta.function.name
51982
- });
51983
- toolCalls[index] = {
51984
- id: toolCallDelta.id,
51985
- type: "function",
51986
- function: {
51987
- name: toolCallDelta.function.name,
51988
- arguments: (_b16 = toolCallDelta.function.arguments) != null ? _b16 : ""
51989
- },
51990
- hasFinished: false
51991
- };
51992
- const toolCall2 = toolCalls[index];
51993
- if (((_c = toolCall2.function) == null ? undefined : _c.name) != null && ((_d = toolCall2.function) == null ? undefined : _d.arguments) != null) {
51994
- if (toolCall2.function.arguments.length > 0) {
51995
- controller.enqueue({
51996
- type: "tool-input-delta",
51997
- id: toolCall2.id,
51998
- delta: toolCall2.function.arguments
51999
- });
52000
- }
52001
- if (isParsableJson(toolCall2.function.arguments)) {
52002
- controller.enqueue({
52003
- type: "tool-input-end",
52004
- id: toolCall2.id
52005
- });
52006
- controller.enqueue({
52007
- type: "tool-call",
52008
- toolCallId: (_e = toolCall2.id) != null ? _e : generateId(),
52009
- toolName: toolCall2.function.name,
52010
- input: toolCall2.function.arguments
52011
- });
52012
- toolCall2.hasFinished = true;
52013
- }
52014
- }
52015
- continue;
52016
- }
52017
- const toolCall = toolCalls[index];
52018
- if (toolCall.hasFinished) {
52019
- continue;
52020
- }
52021
- if (((_f = toolCallDelta.function) == null ? undefined : _f.arguments) != null) {
52022
- toolCall.function.arguments += (_h = (_g = toolCallDelta.function) == null ? undefined : _g.arguments) != null ? _h : "";
52023
- }
52024
- controller.enqueue({
52025
- type: "tool-input-delta",
52026
- id: toolCall.id,
52027
- delta: (_i = toolCallDelta.function.arguments) != null ? _i : ""
52028
- });
52029
- if (((_j = toolCall.function) == null ? undefined : _j.name) != null && ((_k = toolCall.function) == null ? undefined : _k.arguments) != null && isParsableJson(toolCall.function.arguments)) {
52030
- controller.enqueue({
52031
- type: "tool-input-end",
52032
- id: toolCall.id
52033
- });
52034
- controller.enqueue({
52035
- type: "tool-call",
52036
- toolCallId: (_l = toolCall.id) != null ? _l : generateId(),
52037
- toolName: toolCall.function.name,
52038
- input: toolCall.function.arguments
52039
- });
52040
- toolCall.hasFinished = true;
52041
- }
52042
- }
52043
- }
52044
- },
52045
- flush(controller) {
52046
- var _a21, _b16, _c;
52047
- if (isActiveReasoning) {
52048
- controller.enqueue({ type: "reasoning-end", id: "reasoning-0" });
52049
- }
52050
- if (isActiveText) {
52051
- controller.enqueue({ type: "text-end", id: "txt-0" });
52052
- }
52053
- for (const toolCall of toolCalls.filter((toolCall2) => !toolCall2.hasFinished)) {
52054
- controller.enqueue({
52055
- type: "tool-input-end",
52056
- id: toolCall.id
52057
- });
52058
- controller.enqueue({
52059
- type: "tool-call",
52060
- toolCallId: (_a21 = toolCall.id) != null ? _a21 : generateId(),
52061
- toolName: toolCall.function.name,
52062
- input: toolCall.function.arguments
52063
- });
52064
- }
52065
- controller.enqueue({
52066
- type: "finish",
52067
- finishReason,
52068
- usage: convertDeepSeekUsage(usage),
52069
- providerMetadata: {
52070
- [providerOptionsName]: {
52071
- promptCacheHitTokens: (_b16 = usage == null ? undefined : usage.prompt_cache_hit_tokens) != null ? _b16 : undefined,
52072
- promptCacheMissTokens: (_c = usage == null ? undefined : usage.prompt_cache_miss_tokens) != null ? _c : undefined
52073
- }
52074
- }
52075
- });
52076
- }
52077
- })),
52078
- request: { body },
52079
- response: { headers: responseHeaders }
52080
- };
52081
- }
52082
- }, VERSION8 = "2.0.29", deepseek;
52083
- var init_dist10 = __esm(() => {
52084
- init_dist();
52085
- init_dist3();
52086
- init_dist();
52087
- init_dist3();
52088
- init_dist3();
52089
- init_v4();
52090
- init_v4();
52091
- tokenUsageSchema = exports_external.object({
52092
- prompt_tokens: exports_external.number().nullish(),
52093
- completion_tokens: exports_external.number().nullish(),
52094
- prompt_cache_hit_tokens: exports_external.number().nullish(),
52095
- prompt_cache_miss_tokens: exports_external.number().nullish(),
52096
- total_tokens: exports_external.number().nullish(),
52097
- completion_tokens_details: exports_external.object({
52098
- reasoning_tokens: exports_external.number().nullish()
52099
- }).nullish()
52100
- }).nullish();
52101
- deepSeekErrorSchema = exports_external.object({
52102
- error: exports_external.object({
52103
- message: exports_external.string(),
52104
- type: exports_external.string().nullish(),
52105
- param: exports_external.any().nullish(),
52106
- code: exports_external.union([exports_external.string(), exports_external.number()]).nullish()
52107
- })
52108
- });
52109
- deepseekChatResponseSchema = exports_external.object({
52110
- id: exports_external.string().nullish(),
52111
- created: exports_external.number().nullish(),
52112
- model: exports_external.string().nullish(),
52113
- choices: exports_external.array(exports_external.object({
52114
- message: exports_external.object({
52115
- role: exports_external.literal("assistant").nullish(),
52116
- content: exports_external.string().nullish(),
52117
- reasoning_content: exports_external.string().nullish(),
52118
- tool_calls: exports_external.array(exports_external.object({
52119
- id: exports_external.string().nullish(),
52120
- function: exports_external.object({
52121
- name: exports_external.string(),
52122
- arguments: exports_external.string()
52123
- })
52124
- })).nullish()
52125
- }),
52126
- finish_reason: exports_external.string().nullish()
52127
- })),
52128
- usage: tokenUsageSchema
52129
- });
52130
- deepseekChatChunkSchema = lazySchema(() => zodSchema(exports_external.union([
52131
- exports_external.object({
52132
- id: exports_external.string().nullish(),
52133
- created: exports_external.number().nullish(),
52134
- model: exports_external.string().nullish(),
52135
- choices: exports_external.array(exports_external.object({
52136
- delta: exports_external.object({
52137
- role: exports_external.enum(["assistant"]).nullish(),
52138
- content: exports_external.string().nullish(),
52139
- reasoning_content: exports_external.string().nullish(),
52140
- tool_calls: exports_external.array(exports_external.object({
52141
- index: exports_external.number(),
52142
- id: exports_external.string().nullish(),
52143
- function: exports_external.object({
52144
- name: exports_external.string().nullish(),
52145
- arguments: exports_external.string().nullish()
52146
- })
52147
- })).nullish()
52148
- }).nullish(),
52149
- finish_reason: exports_external.string().nullish()
52150
- })),
52151
- usage: tokenUsageSchema
52152
- }),
52153
- deepSeekErrorSchema
52154
- ])));
52155
- deepseekLanguageModelOptions = exports_external.object({
52156
- thinking: exports_external.object({
52157
- type: exports_external.enum(["enabled", "disabled"]).optional()
52158
- }).optional()
52159
- });
52160
- deepseek = createDeepSeek();
52161
- });
52162
-
52163
51415
  // src/core/llm/providers/deepseek.ts
52164
- var deepseek2;
51416
+ var deepseek;
52165
51417
  var init_deepseek = __esm(() => {
52166
- init_dist10();
51418
+ init_dist9();
52167
51419
  init_secrets();
52168
- deepseek2 = {
51420
+ deepseek = {
52169
51421
  id: "deepseek",
52170
51422
  name: "DeepSeek",
52171
51423
  envVar: "DEEPSEEK_API_KEY",
@@ -52179,9 +51431,12 @@ var init_deepseek = __esm(() => {
52179
51431
  if (!apiKey) {
52180
51432
  throw new Error("DEEPSEEK_API_KEY is not set");
52181
51433
  }
52182
- return createDeepSeek({
51434
+ const provider = createOpenAICompatible({
51435
+ name: "deepseek",
51436
+ baseURL: "https://api.deepseek.com/v1",
52183
51437
  apiKey
52184
- })(modelId);
51438
+ });
51439
+ return provider.chatModel(modelId);
52185
51440
  },
52186
51441
  async fetchModels() {
52187
51442
  const apiKey = getProviderApiKey("DEEPSEEK_API_KEY");
@@ -52237,7 +51492,7 @@ function createFireworks(options = {}) {
52237
51492
  description: "Fireworks API key"
52238
51493
  })}`,
52239
51494
  ...options.headers
52240
- }, `ai-sdk/fireworks/${VERSION9}`);
51495
+ }, `ai-sdk/fireworks/${VERSION8}`);
52241
51496
  const getCommonModelConfig = (modelType) => ({
52242
51497
  provider: `fireworks.${modelType}`,
52243
51498
  url: ({ path }) => `${baseURL}${path}`,
@@ -52464,8 +51719,8 @@ var asyncSubmitResponseSchema, asyncPollResponseSchema, DEFAULT_POLL_INTERVAL_MI
52464
51719
  }
52465
51720
  throw new Error(`Fireworks image generation timed out after ${pollTimeoutMillis}ms`);
52466
51721
  }
52467
- }, VERSION9 = "2.0.46", fireworksErrorSchema, fireworksErrorStructure, defaultBaseURL = "https://api.fireworks.ai/inference/v1", fireworks;
52468
- var init_dist11 = __esm(() => {
51722
+ }, VERSION8 = "2.0.46", fireworksErrorSchema, fireworksErrorStructure, defaultBaseURL = "https://api.fireworks.ai/inference/v1", fireworks;
51723
+ var init_dist10 = __esm(() => {
52469
51724
  init_dist3();
52470
51725
  init_dist3();
52471
51726
  init_v4();
@@ -52531,7 +51786,7 @@ var init_dist11 = __esm(() => {
52531
51786
  // src/core/llm/providers/fireworks.ts
52532
51787
  var fireworks2;
52533
51788
  var init_fireworks = __esm(() => {
52534
- init_dist11();
51789
+ init_dist10();
52535
51790
  init_secrets();
52536
51791
  fireworks2 = {
52537
51792
  id: "fireworks",
@@ -53112,7 +52367,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
53112
52367
  function getModelPath(modelId) {
53113
52368
  return modelId.includes("/") ? modelId : `models/${modelId}`;
53114
52369
  }
53115
- function prepareTools6({
52370
+ function prepareTools5({
53116
52371
  tools,
53117
52372
  toolChoice,
53118
52373
  modelId
@@ -53535,7 +52790,7 @@ function createGoogleGenerativeAI(options = {}) {
53535
52790
  description: "Google Generative AI"
53536
52791
  }),
53537
52792
  ...options.headers
53538
- }, `ai-sdk/google/${VERSION10}`);
52793
+ }, `ai-sdk/google/${VERSION9}`);
53539
52794
  const createChatModel = (modelId) => {
53540
52795
  var _a24;
53541
52796
  return new GoogleGenerativeAILanguageModel(modelId, {
@@ -53596,7 +52851,7 @@ function createGoogleGenerativeAI(options = {}) {
53596
52851
  provider.tools = googleTools;
53597
52852
  return provider;
53598
52853
  }
53599
- var VERSION10 = "3.0.64", googleErrorDataSchema, googleFailedResponseHandler, googleEmbeddingContentPartSchema, googleEmbeddingModelOptions, GoogleGenerativeAIEmbeddingModel = class {
52854
+ var VERSION9 = "3.0.64", googleErrorDataSchema, googleFailedResponseHandler, googleEmbeddingContentPartSchema, googleEmbeddingModelOptions, GoogleGenerativeAIEmbeddingModel = class {
53600
52855
  constructor(modelId, config2) {
53601
52856
  this.specificationVersion = "v3";
53602
52857
  this.maxEmbeddingsPerCall = 2048;
@@ -53888,7 +53143,7 @@ var VERSION10 = "3.0.64", googleErrorDataSchema, googleFailedResponseHandler, go
53888
53143
  tools: googleTools2,
53889
53144
  toolConfig: googleToolConfig,
53890
53145
  toolWarnings
53891
- } = prepareTools6({
53146
+ } = prepareTools5({
53892
53147
  tools,
53893
53148
  toolChoice,
53894
53149
  modelId: this.modelId
@@ -55006,7 +54261,7 @@ var VERSION10 = "3.0.64", googleErrorDataSchema, googleFailedResponseHandler, go
55006
54261
  };
55007
54262
  }
55008
54263
  }, googleOperationSchema, googleVideoModelOptionsSchema, google;
55009
- var init_dist12 = __esm(() => {
54264
+ var init_dist11 = __esm(() => {
55010
54265
  init_dist3();
55011
54266
  init_dist();
55012
54267
  init_dist3();
@@ -55317,7 +54572,7 @@ var init_dist12 = __esm(() => {
55317
54572
  // src/core/llm/providers/google.ts
55318
54573
  var google2;
55319
54574
  var init_google = __esm(() => {
55320
- init_dist12();
54575
+ init_dist11();
55321
54576
  init_secrets();
55322
54577
  google2 = {
55323
54578
  id: "google",
@@ -55528,7 +54783,7 @@ function convertToGroqChatMessages(prompt) {
55528
54783
  }
55529
54784
  return messages;
55530
54785
  }
55531
- function getResponseMetadata6({
54786
+ function getResponseMetadata5({
55532
54787
  id,
55533
54788
  model,
55534
54789
  created
@@ -55545,7 +54800,7 @@ function isBrowserSearchSupportedModel(modelId) {
55545
54800
  function getSupportedModelsString() {
55546
54801
  return BROWSER_SEARCH_SUPPORTED_MODELS.join(", ");
55547
54802
  }
55548
- function prepareTools7({
54803
+ function prepareTools6({
55549
54804
  tools,
55550
54805
  toolChoice,
55551
54806
  modelId
@@ -55641,7 +54896,7 @@ function createGroq(options = {}) {
55641
54896
  description: "Groq"
55642
54897
  })}`,
55643
54898
  ...options.headers
55644
- }, `ai-sdk/groq/${VERSION11}`);
54899
+ }, `ai-sdk/groq/${VERSION10}`);
55645
54900
  const createChatModel = (modelId) => new GroqChatLanguageModel(modelId, {
55646
54901
  provider: "groq.chat",
55647
54902
  url: ({ path }) => `${baseURL}${path}`,
@@ -55731,7 +54986,7 @@ var groqLanguageModelOptions, groqErrorDataSchema, groqFailedResponseHandler, BR
55731
54986
  tools: groqTools2,
55732
54987
  toolChoice: groqToolChoice,
55733
54988
  toolWarnings
55734
- } = prepareTools7({ tools, toolChoice, modelId: this.modelId });
54989
+ } = prepareTools6({ tools, toolChoice, modelId: this.modelId });
55735
54990
  return {
55736
54991
  args: {
55737
54992
  model: this.modelId,
@@ -55817,7 +55072,7 @@ var groqLanguageModelOptions, groqErrorDataSchema, groqFailedResponseHandler, BR
55817
55072
  },
55818
55073
  usage: convertGroqUsage(response.usage),
55819
55074
  response: {
55820
- ...getResponseMetadata6(response),
55075
+ ...getResponseMetadata5(response),
55821
55076
  headers: responseHeaders,
55822
55077
  body: rawResponse
55823
55078
  },
@@ -55884,7 +55139,7 @@ var groqLanguageModelOptions, groqErrorDataSchema, groqFailedResponseHandler, BR
55884
55139
  isFirstChunk = false;
55885
55140
  controller.enqueue({
55886
55141
  type: "response-metadata",
55887
- ...getResponseMetadata6(value)
55142
+ ...getResponseMetadata5(value)
55888
55143
  });
55889
55144
  }
55890
55145
  if (((_a21 = value.x_groq) == null ? undefined : _a21.usage) != null) {
@@ -56138,8 +55393,8 @@ var groqLanguageModelOptions, groqErrorDataSchema, groqFailedResponseHandler, BR
56138
55393
  }
56139
55394
  };
56140
55395
  }
56141
- }, groqTranscriptionResponseSchema, browserSearch, groqTools, VERSION11 = "3.0.35", groq;
56142
- var init_dist13 = __esm(() => {
55396
+ }, groqTranscriptionResponseSchema, browserSearch, groqTools, VERSION10 = "3.0.35", groq;
55397
+ var init_dist12 = __esm(() => {
56143
55398
  init_dist();
56144
55399
  init_dist3();
56145
55400
  init_dist();
@@ -56291,7 +55546,7 @@ var init_dist13 = __esm(() => {
56291
55546
  // src/core/llm/providers/groq.ts
56292
55547
  var groq2;
56293
55548
  var init_groq = __esm(() => {
56294
- init_dist13();
55549
+ init_dist12();
56295
55550
  init_secrets();
56296
55551
  groq2 = {
56297
55552
  id: "groq",
@@ -57943,7 +57198,7 @@ var __defProp3, __defProps, __getOwnPropDescs, __getOwnPropSymbols, __hasOwnProp
57943
57198
  });
57944
57199
  }
57945
57200
  return () => `${prefix}${separator}${generator()}`;
57946
- }, generateId2, FETCH_FAILED_ERROR_MESSAGES2, VERSION12 = "4.0.4", suspectProtoRx2, suspectConstructorRx2, ignoreOverride2, defaultOptions2, getDefaultOptions2 = (options) => typeof options === "string" ? __spreadProps(__spreadValues({}, defaultOptions2), {
57201
+ }, generateId2, FETCH_FAILED_ERROR_MESSAGES2, VERSION11 = "4.0.4", suspectProtoRx2, suspectConstructorRx2, ignoreOverride2, defaultOptions2, getDefaultOptions2 = (options) => typeof options === "string" ? __spreadProps(__spreadValues({}, defaultOptions2), {
57947
57202
  name: options
57948
57203
  }) : __spreadValues(__spreadValues({}, defaultOptions2), options), parseCatchDef2 = (def, refs) => {
57949
57204
  return parseDef2(def.innerType._def, refs);
@@ -58181,7 +57436,7 @@ var __defProp3, __defProps, __getOwnPropDescs, __getOwnPropSymbols, __hasOwnProp
58181
57436
  try {
58182
57437
  const response = await fetch2(url2, {
58183
57438
  method: "POST",
58184
- headers: withUserAgentSuffix2(headers, `ai-sdk/provider-utils/${VERSION12}`, getRuntimeEnvironmentUserAgent2()),
57439
+ headers: withUserAgentSuffix2(headers, `ai-sdk/provider-utils/${VERSION11}`, getRuntimeEnvironmentUserAgent2()),
58185
57440
  body: body.content,
58186
57441
  signal: abortSignal
58187
57442
  });
@@ -59167,7 +58422,7 @@ var __defProp3, __defProps, __getOwnPropDescs, __getOwnPropSymbols, __hasOwnProp
59167
58422
  };
59168
58423
  }
59169
58424
  }, llmgateway;
59170
- var init_dist14 = __esm(() => {
58425
+ var init_dist13 = __esm(() => {
59171
58426
  init_v4();
59172
58427
  init_v3();
59173
58428
  init_v3();
@@ -59805,7 +59060,7 @@ var init_context_windows = __esm(() => {
59805
59060
  // src/core/llm/providers/llmgateway.ts
59806
59061
  var llmgateway2;
59807
59062
  var init_llmgateway = __esm(() => {
59808
- init_dist14();
59063
+ init_dist13();
59809
59064
  init_secrets();
59810
59065
  init_context_windows();
59811
59066
  llmgateway2 = {
@@ -59991,7 +59246,7 @@ function getErrorMessage4(error48) {
59991
59246
  return JSON.stringify(error48);
59992
59247
  }
59993
59248
  var marker25 = "vercel.ai.error", symbol25, _a25, _b19, AISDKError3, name25 = "AI_APICallError", marker26, symbol26, _a26, _b24, APICallError3, name26 = "AI_EmptyResponseBodyError", marker35, symbol35, _a35, _b34, EmptyResponseBodyError3, name35 = "AI_InvalidArgumentError", marker45, symbol45, _a45, _b44, InvalidArgumentError4, name45 = "AI_InvalidPromptError", marker55, symbol55, _a55, _b54, InvalidPromptError3, name55 = "AI_InvalidResponseDataError", marker65, symbol65, _a65, _b64, InvalidResponseDataError3, name65 = "AI_JSONParseError", marker75, symbol75, _a75, _b74, JSONParseError3, name75 = "AI_LoadAPIKeyError", marker85, symbol85, _a85, _b84, LoadAPIKeyError3, name84 = "AI_LoadSettingError", marker94, symbol94, _a94, _b93, LoadSettingError3, name94 = "AI_NoContentGeneratedError", marker104, symbol104, _a104, _b103, NoContentGeneratedError3, name104 = "AI_NoSuchModelError", marker114, symbol114, _a114, _b113, NoSuchModelError3, name114 = "AI_TooManyEmbeddingValuesForCallError", marker124, symbol124, _a124, _b123, TooManyEmbeddingValuesForCallError3, name124 = "AI_TypeValidationError", marker134, symbol134, _a134, _b133, TypeValidationError3, name134 = "AI_UnsupportedFunctionalityError", marker144, symbol144, _a144, _b143, UnsupportedFunctionalityError3;
59994
- var init_dist15 = __esm(() => {
59249
+ var init_dist14 = __esm(() => {
59995
59250
  symbol25 = Symbol.for(marker25);
59996
59251
  AISDKError3 = class _AISDKError3 extends (_b19 = Error, _a25 = symbol25, _b19) {
59997
59252
  constructor({
@@ -60227,7 +59482,7 @@ Error message: ${getErrorMessage4(cause)}`,
60227
59482
  });
60228
59483
 
60229
59484
  // node_modules/@standard-schema/spec/dist/index.js
60230
- var init_dist16 = () => {};
59485
+ var init_dist15 = () => {};
60231
59486
 
60232
59487
  // node_modules/vercel-minimax-ai-provider/node_modules/@ai-sdk/anthropic/node_modules/@ai-sdk/provider-utils/dist/index.mjs
60233
59488
  function combineHeaders3(...headers) {
@@ -61408,7 +60663,7 @@ var btoa4, atob4, name27 = "AI_DownloadError", marker27, symbol27, _a27, _b20, D
61408
60663
  });
61409
60664
  }
61410
60665
  return () => `${prefix}${separator}${generator()}`;
61411
- }, generateId3, FETCH_FAILED_ERROR_MESSAGES3, VERSION13 = "4.0.3", suspectProtoRx3, suspectConstructorRx3, ignoreOverride3, defaultOptions3, getDefaultOptions3 = (options) => typeof options === "string" ? {
60666
+ }, generateId3, FETCH_FAILED_ERROR_MESSAGES3, VERSION12 = "4.0.3", suspectProtoRx3, suspectConstructorRx3, ignoreOverride3, defaultOptions3, getDefaultOptions3 = (options) => typeof options === "string" ? {
61412
60667
  ...defaultOptions3,
61413
60668
  name: options
61414
60669
  } : {
@@ -61661,7 +60916,7 @@ var btoa4, atob4, name27 = "AI_DownloadError", marker27, symbol27, _a27, _b20, D
61661
60916
  try {
61662
60917
  const response = await fetch2(url2, {
61663
60918
  method: "POST",
61664
- headers: withUserAgentSuffix3(headers, `ai-sdk/provider-utils/${VERSION13}`, getRuntimeEnvironmentUserAgent3()),
60919
+ headers: withUserAgentSuffix3(headers, `ai-sdk/provider-utils/${VERSION12}`, getRuntimeEnvironmentUserAgent3()),
61665
60920
  body: body.content,
61666
60921
  signal: abortSignal
61667
60922
  });
@@ -61802,22 +61057,22 @@ var btoa4, atob4, name27 = "AI_DownloadError", marker27, symbol27, _a27, _b20, D
61802
61057
  rawValue: parsedResult.rawValue
61803
61058
  };
61804
61059
  };
61805
- var init_dist17 = __esm(() => {
61806
- init_dist15();
61807
- init_dist15();
61808
- init_dist15();
61809
- init_dist15();
61810
- init_dist15();
61811
- init_dist15();
61060
+ var init_dist16 = __esm(() => {
61061
+ init_dist14();
61062
+ init_dist14();
61063
+ init_dist14();
61064
+ init_dist14();
61065
+ init_dist14();
61066
+ init_dist14();
61812
61067
  init_v4();
61813
61068
  init_v3();
61814
61069
  init_v3();
61815
61070
  init_v3();
61816
61071
  init_stream();
61072
+ init_dist14();
61073
+ init_dist14();
61074
+ init_dist14();
61817
61075
  init_dist15();
61818
- init_dist15();
61819
- init_dist15();
61820
- init_dist16();
61821
61076
  ({ btoa: btoa4, atob: atob4 } = globalThis);
61822
61077
  marker27 = `vercel.ai.error.${name27}`;
61823
61078
  symbol27 = Symbol.for(marker27);
@@ -61904,7 +61159,7 @@ function getCacheControl4(providerMetadata) {
61904
61159
  const cacheControlValue = (_a28 = anthropic3 == null ? undefined : anthropic3.cacheControl) != null ? _a28 : anthropic3 == null ? undefined : anthropic3.cache_control;
61905
61160
  return cacheControlValue;
61906
61161
  }
61907
- async function prepareTools8({
61162
+ async function prepareTools7({
61908
61163
  tools,
61909
61164
  toolChoice,
61910
61165
  disableParallelToolUse,
@@ -63357,7 +62612,7 @@ var anthropicErrorDataSchema3, anthropicFailedResponseHandler3, anthropicMessage
63357
62612
  toolChoice: anthropicToolChoice,
63358
62613
  toolWarnings,
63359
62614
  betas: toolsBetas
63360
- } = await prepareTools8(jsonResponseTool != null ? {
62615
+ } = await prepareTools7(jsonResponseTool != null ? {
63361
62616
  tools: [...tools != null ? tools : [], jsonResponseTool],
63362
62617
  toolChoice: { type: "required" },
63363
62618
  disableParallelToolUse: true,
@@ -64431,47 +63686,47 @@ var anthropicErrorDataSchema3, anthropicFailedResponseHandler3, anthropicMessage
64431
63686
  }
64432
63687
  }, bash_20241022InputSchema3, bash_202410223, bash_20250124InputSchema3, bash_202501243, computer_20241022InputSchema3, computer_202410223, computer_20250124InputSchema3, computer_202501243, memory_20250818InputSchema3, memory_202508183, textEditor_20241022InputSchema3, textEditor_202410223, textEditor_20250124InputSchema3, textEditor_202501243, textEditor_20250429InputSchema3, textEditor_202504293, toolSearchBm25_20251119OutputSchema3, toolSearchBm25_20251119InputSchema3, factory73;
64433
63688
  var init_internal2 = __esm(() => {
64434
- init_dist15();
64435
- init_dist17();
64436
- init_dist17();
63689
+ init_dist14();
63690
+ init_dist16();
63691
+ init_dist16();
64437
63692
  init_v4();
64438
- init_dist17();
63693
+ init_dist16();
64439
63694
  init_v4();
64440
63695
  init_v4();
64441
- init_dist15();
64442
- init_dist17();
63696
+ init_dist14();
63697
+ init_dist16();
64443
63698
  init_v4();
64444
- init_dist17();
64445
- init_dist17();
63699
+ init_dist16();
63700
+ init_dist16();
64446
63701
  init_v4();
64447
- init_dist17();
63702
+ init_dist16();
64448
63703
  init_v4();
64449
- init_dist17();
64450
- init_dist15();
64451
- init_dist17();
64452
- init_dist17();
63704
+ init_dist16();
63705
+ init_dist14();
63706
+ init_dist16();
63707
+ init_dist16();
64453
63708
  init_v4();
64454
- init_dist17();
63709
+ init_dist16();
64455
63710
  init_v4();
64456
- init_dist17();
63711
+ init_dist16();
64457
63712
  init_v4();
64458
- init_dist17();
63713
+ init_dist16();
64459
63714
  init_v4();
64460
- init_dist17();
63715
+ init_dist16();
64461
63716
  init_v4();
64462
- init_dist17();
63717
+ init_dist16();
64463
63718
  init_v4();
64464
- init_dist17();
63719
+ init_dist16();
64465
63720
  init_v4();
64466
- init_dist17();
63721
+ init_dist16();
64467
63722
  init_v4();
64468
- init_dist17();
63723
+ init_dist16();
64469
63724
  init_v4();
64470
- init_dist17();
63725
+ init_dist16();
64471
63726
  init_v4();
64472
- init_dist17();
63727
+ init_dist16();
64473
63728
  init_v4();
64474
- init_dist17();
63729
+ init_dist16();
64475
63730
  init_v4();
64476
63731
  anthropicErrorDataSchema3 = lazySchema2(() => zodSchema3(exports_external.object({
64477
63732
  type: exports_external.literal("error"),
@@ -65516,7 +64771,7 @@ function getErrorMessage5(error48) {
65516
64771
  return JSON.stringify(error48);
65517
64772
  }
65518
64773
  var marker28 = "vercel.ai.error", symbol28, _a28, _b21, AISDKError4, name28 = "AI_APICallError", marker29, symbol29, _a29, _b25, APICallError4, name29 = "AI_EmptyResponseBodyError", marker36, symbol36, _a36, _b35, EmptyResponseBodyError4, name36 = "AI_InvalidArgumentError", marker46, symbol46, _a46, _b45, InvalidArgumentError5, name46 = "AI_InvalidPromptError", marker56, symbol56, _a56, _b55, InvalidPromptError4, name56 = "AI_InvalidResponseDataError", marker66, symbol66, _a66, _b65, InvalidResponseDataError4, name66 = "AI_JSONParseError", marker76, symbol76, _a76, _b75, JSONParseError4, name76 = "AI_LoadAPIKeyError", marker86, symbol86, _a86, _b85, LoadAPIKeyError4, name85 = "AI_LoadSettingError", marker95, symbol95, _a95, _b94, LoadSettingError4, name95 = "AI_NoContentGeneratedError", marker105, symbol105, _a105, _b104, NoContentGeneratedError4, name105 = "AI_NoSuchModelError", marker115, symbol115, _a115, _b114, NoSuchModelError4, name115 = "AI_TooManyEmbeddingValuesForCallError", marker125, symbol125, _a125, _b124, TooManyEmbeddingValuesForCallError4, name125 = "AI_TypeValidationError", marker135, symbol135, _a135, _b134, TypeValidationError4, name135 = "AI_UnsupportedFunctionalityError", marker145, symbol145, _a145, _b144, UnsupportedFunctionalityError4;
65519
- var init_dist18 = __esm(() => {
64774
+ var init_dist17 = __esm(() => {
65520
64775
  symbol28 = Symbol.for(marker28);
65521
64776
  AISDKError4 = class _AISDKError4 extends (_b21 = Error, _a28 = symbol28, _b21) {
65522
64777
  constructor({
@@ -66872,7 +66127,7 @@ var btoa5, atob5, name30 = "AI_DownloadError", marker30, symbol30, _a30, _b26, D
66872
66127
  });
66873
66128
  }
66874
66129
  return () => `${prefix}${separator}${generator()}`;
66875
- }, generateId4, FETCH_FAILED_ERROR_MESSAGES4, VERSION14 = "4.0.4", suspectProtoRx4, suspectConstructorRx4, ignoreOverride4, defaultOptions4, getDefaultOptions4 = (options) => typeof options === "string" ? {
66130
+ }, generateId4, FETCH_FAILED_ERROR_MESSAGES4, VERSION13 = "4.0.4", suspectProtoRx4, suspectConstructorRx4, ignoreOverride4, defaultOptions4, getDefaultOptions4 = (options) => typeof options === "string" ? {
66876
66131
  ...defaultOptions4,
66877
66132
  name: options
66878
66133
  } : {
@@ -67125,7 +66380,7 @@ var btoa5, atob5, name30 = "AI_DownloadError", marker30, symbol30, _a30, _b26, D
67125
66380
  try {
67126
66381
  const response = await fetch2(url2, {
67127
66382
  method: "POST",
67128
- headers: withUserAgentSuffix4(headers, `ai-sdk/provider-utils/${VERSION14}`, getRuntimeEnvironmentUserAgent4()),
66383
+ headers: withUserAgentSuffix4(headers, `ai-sdk/provider-utils/${VERSION13}`, getRuntimeEnvironmentUserAgent4()),
67129
66384
  body: body.content,
67130
66385
  signal: abortSignal
67131
66386
  });
@@ -67266,23 +66521,23 @@ var btoa5, atob5, name30 = "AI_DownloadError", marker30, symbol30, _a30, _b26, D
67266
66521
  rawValue: parsedResult.rawValue
67267
66522
  };
67268
66523
  };
67269
- var init_dist19 = __esm(() => {
67270
- init_dist18();
67271
- init_dist18();
67272
- init_dist18();
67273
- init_dist18();
67274
- init_dist18();
67275
- init_dist18();
67276
- init_dist18();
66524
+ var init_dist18 = __esm(() => {
66525
+ init_dist17();
66526
+ init_dist17();
66527
+ init_dist17();
66528
+ init_dist17();
66529
+ init_dist17();
66530
+ init_dist17();
66531
+ init_dist17();
67277
66532
  init_v4();
67278
66533
  init_v3();
67279
66534
  init_v3();
67280
66535
  init_v3();
67281
66536
  init_stream();
67282
- init_dist18();
67283
- init_dist18();
67284
- init_dist18();
67285
- init_dist16();
66537
+ init_dist17();
66538
+ init_dist17();
66539
+ init_dist17();
66540
+ init_dist15();
67286
66541
  ({ btoa: btoa5, atob: atob5 } = globalThis);
67287
66542
  marker30 = `vercel.ai.error.${name30}`;
67288
66543
  symbol30 = Symbol.for(marker30);
@@ -67586,7 +66841,7 @@ function mapMinimaxFinishReason(finishReason) {
67586
66841
  return "other";
67587
66842
  }
67588
66843
  }
67589
- function prepareTools9({
66844
+ function prepareTools8({
67590
66845
  tools,
67591
66846
  toolChoice
67592
66847
  }) {
@@ -67640,7 +66895,7 @@ function prepareTools9({
67640
66895
  }
67641
66896
  }
67642
66897
  }
67643
- function getResponseMetadata7({
66898
+ function getResponseMetadata6({
67644
66899
  id,
67645
66900
  model,
67646
66901
  created
@@ -67739,7 +66994,7 @@ var minimaxAnthropic, minimaxChatProviderOptions, minimaxErrorDataSchema, defaul
67739
66994
  tools: openaiTools2,
67740
66995
  toolChoice: openaiToolChoice,
67741
66996
  toolWarnings
67742
- } = prepareTools9({
66997
+ } = prepareTools8({
67743
66998
  tools,
67744
66999
  toolChoice
67745
67000
  });
@@ -67845,7 +67100,7 @@ var minimaxAnthropic, minimaxChatProviderOptions, minimaxErrorDataSchema, defaul
67845
67100
  providerMetadata,
67846
67101
  request: { body },
67847
67102
  response: {
67848
- ...getResponseMetadata7(responseBody),
67103
+ ...getResponseMetadata6(responseBody),
67849
67104
  headers: responseHeaders,
67850
67105
  body: rawResponse
67851
67106
  },
@@ -67911,7 +67166,7 @@ var minimaxAnthropic, minimaxChatProviderOptions, minimaxErrorDataSchema, defaul
67911
67166
  isFirstChunk = false;
67912
67167
  controller.enqueue({
67913
67168
  type: "response-metadata",
67914
- ...getResponseMetadata7(value)
67169
+ ...getResponseMetadata6(value)
67915
67170
  });
67916
67171
  }
67917
67172
  if (value.usage != null) {
@@ -68104,19 +67359,19 @@ var minimaxAnthropic, minimaxChatProviderOptions, minimaxErrorDataSchema, defaul
68104
67359
  };
68105
67360
  }
68106
67361
  }, openaiCompatibleTokenUsageSchema2, MinimaxChatResponseSchema, chunkBaseSchema2, createOpenAICompatibleChatChunkSchema2 = (errorSchema) => exports_external.union([chunkBaseSchema2, errorSchema]), minimax, minimaxOpenAI;
68107
- var init_dist20 = __esm(() => {
67362
+ var init_dist19 = __esm(() => {
68108
67363
  init_internal2();
67364
+ init_dist17();
68109
67365
  init_dist18();
68110
- init_dist19();
67366
+ init_dist17();
68111
67367
  init_dist18();
68112
- init_dist19();
67368
+ init_dist17();
68113
67369
  init_dist18();
68114
- init_dist19();
68115
67370
  init_v4();
68116
67371
  init_v4();
67372
+ init_dist17();
68117
67373
  init_dist18();
68118
- init_dist19();
68119
- init_dist18();
67374
+ init_dist17();
68120
67375
  minimaxAnthropic = createMinimaxAnthropic();
68121
67376
  minimaxChatProviderOptions = exports_external.object({
68122
67377
  user: exports_external.string().optional(),
@@ -68198,7 +67453,7 @@ var init_dist20 = __esm(() => {
68198
67453
  // src/core/llm/providers/minimax.ts
68199
67454
  var minimax2;
68200
67455
  var init_minimax = __esm(() => {
68201
- init_dist20();
67456
+ init_dist19();
68202
67457
  init_secrets();
68203
67458
  minimax2 = {
68204
67459
  id: "minimax",
@@ -68408,7 +67663,7 @@ function convertToMistralChatMessages(prompt) {
68408
67663
  }
68409
67664
  return messages;
68410
67665
  }
68411
- function getResponseMetadata8({
67666
+ function getResponseMetadata7({
68412
67667
  id,
68413
67668
  model,
68414
67669
  created
@@ -68432,7 +67687,7 @@ function mapMistralFinishReason(finishReason) {
68432
67687
  return "other";
68433
67688
  }
68434
67689
  }
68435
- function prepareTools10({
67690
+ function prepareTools9({
68436
67691
  tools,
68437
67692
  toolChoice
68438
67693
  }) {
@@ -68523,7 +67778,7 @@ function createMistral(options = {}) {
68523
67778
  description: "Mistral"
68524
67779
  })}`,
68525
67780
  ...options.headers
68526
- }, `ai-sdk/mistral/${VERSION15}`);
67781
+ }, `ai-sdk/mistral/${VERSION14}`);
68527
67782
  const createChatModel = (modelId) => new MistralChatLanguageModel(modelId, {
68528
67783
  provider: "mistral.chat",
68529
67784
  baseURL,
@@ -68636,7 +67891,7 @@ var mistralLanguageModelOptions, mistralErrorDataSchema, mistralFailedResponseHa
68636
67891
  tools: mistralTools,
68637
67892
  toolChoice: mistralToolChoice,
68638
67893
  toolWarnings
68639
- } = prepareTools10({
67894
+ } = prepareTools9({
68640
67895
  tools,
68641
67896
  toolChoice
68642
67897
  });
@@ -68706,7 +67961,7 @@ var mistralLanguageModelOptions, mistralErrorDataSchema, mistralFailedResponseHa
68706
67961
  usage: convertMistralUsage(response.usage),
68707
67962
  request: { body },
68708
67963
  response: {
68709
- ...getResponseMetadata8(response),
67964
+ ...getResponseMetadata7(response),
68710
67965
  headers: responseHeaders,
68711
67966
  body: rawResponse
68712
67967
  },
@@ -68752,7 +68007,7 @@ var mistralLanguageModelOptions, mistralErrorDataSchema, mistralFailedResponseHa
68752
68007
  isFirstChunk = false;
68753
68008
  controller.enqueue({
68754
68009
  type: "response-metadata",
68755
- ...getResponseMetadata8(value)
68010
+ ...getResponseMetadata7(value)
68756
68011
  });
68757
68012
  }
68758
68013
  if (value.usage != null) {
@@ -68907,8 +68162,8 @@ var mistralLanguageModelOptions, mistralErrorDataSchema, mistralFailedResponseHa
68907
68162
  response: { headers: responseHeaders, body: rawValue }
68908
68163
  };
68909
68164
  }
68910
- }, MistralTextEmbeddingResponseSchema, VERSION15 = "3.0.30", mistral;
68911
- var init_dist21 = __esm(() => {
68165
+ }, MistralTextEmbeddingResponseSchema, VERSION14 = "3.0.30", mistral;
68166
+ var init_dist20 = __esm(() => {
68912
68167
  init_dist();
68913
68168
  init_dist3();
68914
68169
  init_dist3();
@@ -69024,7 +68279,7 @@ var init_dist21 = __esm(() => {
69024
68279
  // src/core/llm/providers/mistral.ts
69025
68280
  var mistral2;
69026
68281
  var init_mistral = __esm(() => {
69027
- init_dist21();
68282
+ init_dist20();
69028
68283
  init_secrets();
69029
68284
  mistral2 = {
69030
68285
  id: "mistral",
@@ -71624,7 +70879,7 @@ var __defProp4, __defProps2, __getOwnPropDescs2, __getOwnPropSymbols2, __hasOwnP
71624
70879
  });
71625
70880
  }
71626
70881
  return () => `${prefix}${separator}${generator()}`;
71627
- }, generateId5, FETCH_FAILED_ERROR_MESSAGES5, BUN_ERROR_CODES2, VERSION16 = "4.0.23", getOriginalFetch3 = () => globalThis.fetch, getFromApi2 = async ({
70882
+ }, generateId5, FETCH_FAILED_ERROR_MESSAGES5, BUN_ERROR_CODES2, VERSION15 = "4.0.23", getOriginalFetch3 = () => globalThis.fetch, getFromApi2 = async ({
71628
70883
  url: url2,
71629
70884
  headers = {},
71630
70885
  successfulResponseHandler,
@@ -71635,7 +70890,7 @@ var __defProp4, __defProps2, __getOwnPropDescs2, __getOwnPropSymbols2, __hasOwnP
71635
70890
  try {
71636
70891
  const response = await fetch2(url2, {
71637
70892
  method: "GET",
71638
- headers: withUserAgentSuffix5(headers, `ai-sdk/provider-utils/${VERSION16}`, getRuntimeEnvironmentUserAgent5()),
70893
+ headers: withUserAgentSuffix5(headers, `ai-sdk/provider-utils/${VERSION15}`, getRuntimeEnvironmentUserAgent5()),
71639
70894
  signal: abortSignal
71640
70895
  });
71641
70896
  const responseHeaders = extractResponseHeaders5(response);
@@ -71924,7 +71179,7 @@ var __defProp4, __defProps2, __getOwnPropDescs2, __getOwnPropSymbols2, __hasOwnP
71924
71179
  try {
71925
71180
  const response = await fetch2(url2, {
71926
71181
  method: "POST",
71927
- headers: withUserAgentSuffix5(headers, `ai-sdk/provider-utils/${VERSION16}`, getRuntimeEnvironmentUserAgent5()),
71182
+ headers: withUserAgentSuffix5(headers, `ai-sdk/provider-utils/${VERSION15}`, getRuntimeEnvironmentUserAgent5()),
71928
71183
  body: body.content,
71929
71184
  signal: abortSignal
71930
71185
  });
@@ -73421,7 +72676,7 @@ var __defProp4, __defProps2, __getOwnPropDescs2, __getOwnPropSymbols2, __hasOwnP
73421
72676
  });
73422
72677
  }
73423
72678
  }, openrouter;
73424
- var init_dist22 = __esm(() => {
72679
+ var init_dist21 = __esm(() => {
73425
72680
  init_v4();
73426
72681
  init_v3();
73427
72682
  init_v3();
@@ -74248,7 +73503,7 @@ Error message: ${getErrorMessage6(cause)}`,
74248
73503
  // src/core/llm/providers/openrouter.ts
74249
73504
  var openrouter2;
74250
73505
  var init_openrouter = __esm(() => {
74251
- init_dist22();
73506
+ init_dist21();
74252
73507
  init_secrets();
74253
73508
  init_context_windows();
74254
73509
  openrouter2 = {
@@ -75229,7 +74484,7 @@ function convertXaiChatUsage(usage) {
75229
74484
  raw: usage
75230
74485
  };
75231
74486
  }
75232
- function getResponseMetadata9({
74487
+ function getResponseMetadata8({
75233
74488
  id,
75234
74489
  model,
75235
74490
  created,
@@ -75257,7 +74512,7 @@ function mapXaiFinishReason(finishReason) {
75257
74512
  return "other";
75258
74513
  }
75259
74514
  }
75260
- function prepareTools11({
74515
+ function prepareTools10({
75261
74516
  tools,
75262
74517
  toolChoice
75263
74518
  }) {
@@ -75696,7 +74951,7 @@ function createXai(options = {}) {
75696
74951
  description: "xAI API key"
75697
74952
  })}`,
75698
74953
  ...options.headers
75699
- }, `ai-sdk/xai/${VERSION17}`);
74954
+ }, `ai-sdk/xai/${VERSION16}`);
75700
74955
  const createChatLanguageModel = (modelId) => {
75701
74956
  return new XaiChatLanguageModel(modelId, {
75702
74957
  provider: "xai.chat",
@@ -75799,7 +75054,7 @@ var webSourceSchema, xSourceSchema, newsSourceSchema, rssSourceSchema, searchSou
75799
75054
  tools: xaiTools2,
75800
75055
  toolChoice: xaiToolChoice,
75801
75056
  toolWarnings
75802
- } = prepareTools11({
75057
+ } = prepareTools10({
75803
75058
  tools,
75804
75059
  toolChoice
75805
75060
  });
@@ -75942,7 +75197,7 @@ var webSourceSchema, xSourceSchema, newsSourceSchema, rssSourceSchema, searchSou
75942
75197
  },
75943
75198
  request: { body },
75944
75199
  response: {
75945
- ...getResponseMetadata9(response),
75200
+ ...getResponseMetadata8(response),
75946
75201
  headers: responseHeaders,
75947
75202
  body: rawResponse
75948
75203
  },
@@ -76030,7 +75285,7 @@ var webSourceSchema, xSourceSchema, newsSourceSchema, rssSourceSchema, searchSou
76030
75285
  if (isFirstChunk) {
76031
75286
  controller.enqueue({
76032
75287
  type: "response-metadata",
76033
- ...getResponseMetadata9(value)
75288
+ ...getResponseMetadata8(value)
76034
75289
  });
76035
75290
  isFirstChunk = false;
76036
75291
  }
@@ -76561,7 +75816,7 @@ var webSourceSchema, xSourceSchema, newsSourceSchema, rssSourceSchema, searchSou
76561
75816
  },
76562
75817
  request: { body },
76563
75818
  response: {
76564
- ...getResponseMetadata9(response),
75819
+ ...getResponseMetadata8(response),
76565
75820
  headers: responseHeaders,
76566
75821
  body: rawResponse
76567
75822
  },
@@ -76623,7 +75878,7 @@ var webSourceSchema, xSourceSchema, newsSourceSchema, rssSourceSchema, searchSou
76623
75878
  if (isFirstChunk) {
76624
75879
  controller.enqueue({
76625
75880
  type: "response-metadata",
76626
- ...getResponseMetadata9(event.response)
75881
+ ...getResponseMetadata8(event.response)
76627
75882
  });
76628
75883
  isFirstChunk = false;
76629
75884
  }
@@ -76998,7 +76253,7 @@ var webSourceSchema, xSourceSchema, newsSourceSchema, rssSourceSchema, searchSou
76998
76253
  response: { headers: responseHeaders }
76999
76254
  };
77000
76255
  }
77001
- }, codeExecutionOutputSchema, codeExecutionToolFactory, codeExecution2 = (args = {}) => codeExecutionToolFactory(args), viewImageOutputSchema, viewImageToolFactory, viewImage = (args = {}) => viewImageToolFactory(args), viewXVideoOutputSchema, viewXVideoToolFactory, viewXVideo = (args = {}) => viewXVideoToolFactory(args), xaiTools, VERSION17 = "3.0.83", nonEmptyStringSchema, resolutionSchema, modeSchema, baseFields, editVideoSchema, extendVideoSchema, referenceToVideoSchema, autoDetectSchema, xaiVideoModelOptions, runtimeSchema, xaiVideoModelOptionsSchema, RESOLUTION_MAP, XaiVideoModel = class {
76256
+ }, codeExecutionOutputSchema, codeExecutionToolFactory, codeExecution2 = (args = {}) => codeExecutionToolFactory(args), viewImageOutputSchema, viewImageToolFactory, viewImage = (args = {}) => viewImageToolFactory(args), viewXVideoOutputSchema, viewXVideoToolFactory, viewXVideo = (args = {}) => viewXVideoToolFactory(args), xaiTools, VERSION16 = "3.0.83", nonEmptyStringSchema, resolutionSchema, modeSchema, baseFields, editVideoSchema, extendVideoSchema, referenceToVideoSchema, autoDetectSchema, xaiVideoModelOptions, runtimeSchema, xaiVideoModelOptionsSchema, RESOLUTION_MAP, XaiVideoModel = class {
77002
76257
  constructor(modelId, config2) {
77003
76258
  this.modelId = modelId;
77004
76259
  this.config = config2;
@@ -77238,7 +76493,7 @@ var webSourceSchema, xSourceSchema, newsSourceSchema, rssSourceSchema, searchSou
77238
76493
  }
77239
76494
  }
77240
76495
  }, xaiCreateVideoResponseSchema, xaiVideoStatusResponseSchema, xai;
77241
- var init_dist23 = __esm(() => {
76496
+ var init_dist22 = __esm(() => {
77242
76497
  init_dist();
77243
76498
  init_dist3();
77244
76499
  init_dist();
@@ -78043,7 +77298,7 @@ var init_dist23 = __esm(() => {
78043
77298
  // src/core/llm/providers/xai.ts
78044
77299
  var xai2;
78045
77300
  var init_xai = __esm(() => {
78046
- init_dist23();
77301
+ init_dist22();
78047
77302
  init_secrets();
78048
77303
  xai2 = {
78049
77304
  id: "xai",
@@ -78157,7 +77412,7 @@ var init_providers = __esm(() => {
78157
77412
  init_proxy();
78158
77413
  init_vercel_gateway();
78159
77414
  init_xai();
78160
- BUILTIN_PROVIDERS = [llmgateway2, anthropic2, proxy, vercelGatewayProvider, openai2, xai2, google2, groq2, deepseek2, mistral2, bedrock2, fireworks2, minimax2, codex, copilot, githubModels, openrouter2, opencodeZen, opencodeGo, ollama, lmstudio];
77415
+ BUILTIN_PROVIDERS = [llmgateway2, anthropic2, proxy, vercelGatewayProvider, openai2, xai2, google2, groq2, deepseek, mistral2, bedrock2, fireworks2, minimax2, codex, copilot, githubModels, openrouter2, opencodeZen, opencodeGo, ollama, lmstudio];
78161
77416
  allProviders = [...BUILTIN_PROVIDERS];
78162
77417
  providerMap = new Map(allProviders.map((p) => [p.id, p]));
78163
77418
  changeListeners = [];
@@ -78293,11 +77548,15 @@ async function buildV2Summary(opts) {
78293
77548
  });
78294
77549
  gapFill = genResult.text;
78295
77550
  const gu = genResult.usage;
78296
- if (gu)
77551
+ if (gu) {
77552
+ const details = gu.inputTokenDetails;
78297
77553
  llmUsage = {
78298
77554
  inputTokens: gu.inputTokens ?? 0,
78299
- outputTokens: gu.outputTokens ?? 0
77555
+ outputTokens: gu.outputTokens ?? 0,
77556
+ cacheReadTokens: details?.cacheReadTokens ?? 0,
77557
+ cacheWriteTokens: details?.cacheWriteTokens ?? 0
78300
77558
  };
77559
+ }
78301
77560
  } catch (err) {
78302
77561
  logBackgroundError("compaction-summarize", err instanceof Error ? err.message : String(err));
78303
77562
  return {