@hongymagic/q 0.7.1 → 2026.226.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 (2) hide show
  1. package/dist/q.js +186 -120
  2. package/package.json +8 -6
package/dist/q.js CHANGED
@@ -6,25 +6,43 @@ var __getProtoOf = Object.getPrototypeOf;
6
6
  var __defProp = Object.defineProperty;
7
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ function __accessProp(key) {
10
+ return this[key];
11
+ }
12
+ var __toESMCache_node;
13
+ var __toESMCache_esm;
9
14
  var __toESM = (mod, isNodeMode, target) => {
15
+ var canCache = mod != null && typeof mod === "object";
16
+ if (canCache) {
17
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
18
+ var cached = cache.get(mod);
19
+ if (cached)
20
+ return cached;
21
+ }
10
22
  target = mod != null ? __create(__getProtoOf(mod)) : {};
11
23
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
12
24
  for (let key of __getOwnPropNames(mod))
13
25
  if (!__hasOwnProp.call(to, key))
14
26
  __defProp(to, key, {
15
- get: () => mod[key],
27
+ get: __accessProp.bind(mod, key),
16
28
  enumerable: true
17
29
  });
30
+ if (canCache)
31
+ cache.set(mod, to);
18
32
  return to;
19
33
  };
20
34
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
35
+ var __returnValue = (v) => v;
36
+ function __exportSetter(name, newValue) {
37
+ this[name] = __returnValue.bind(null, newValue);
38
+ }
21
39
  var __export = (target, all) => {
22
40
  for (var name in all)
23
41
  __defProp(target, name, {
24
42
  get: all[name],
25
43
  enumerable: true,
26
44
  configurable: true,
27
- set: (newValue) => all[name] = () => newValue
45
+ set: __exportSetter.bind(all, name)
28
46
  });
29
47
  };
30
48
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -8082,7 +8100,6 @@ var init_base = __esm(() => {
8082
8100
  // node_modules/yoctocolors/index.js
8083
8101
  var init_yoctocolors = __esm(() => {
8084
8102
  init_base();
8085
- init_base();
8086
8103
  });
8087
8104
 
8088
8105
  // node_modules/execa/lib/verbose/default.js
@@ -14574,7 +14591,7 @@ import { parseArgs } from "node:util";
14574
14591
  // package.json
14575
14592
  var package_default = {
14576
14593
  name: "@hongymagic/q",
14577
- version: "0.7.1",
14594
+ version: "2026.226.0",
14578
14595
  description: "Quick AI answers from the command line",
14579
14596
  main: "dist/q.js",
14580
14597
  type: "module",
@@ -14618,18 +14635,20 @@ var package_default = {
14618
14635
  "build:darwin-x64": "bun build --compile --minify --target=bun-darwin-x64 ./src/cli.ts --outfile dist/q-darwin-x64",
14619
14636
  "build:linux-x64": "bun build --compile --minify --target=bun-linux-x64 ./src/cli.ts --outfile dist/q-linux-x64",
14620
14637
  "build:linux-arm64": "bun build --compile --minify --target=bun-linux-arm64 ./src/cli.ts --outfile dist/q-linux-arm64",
14621
- "build:windows-x64": "bun build --compile --minify --target=bun-windows-x64 ./src/cli.ts --outfile dist/q-windows-x64.exe"
14638
+ "build:windows-x64": "bun build --compile --minify --target=bun-windows-x64 ./src/cli.ts --outfile dist/q-windows-x64.exe",
14639
+ release: "bun run scripts/release.ts",
14640
+ "release:dry": "bun run scripts/release.ts --dry-run"
14622
14641
  },
14623
14642
  dependencies: {
14624
- "@ai-sdk/amazon-bedrock": "4.0.64",
14643
+ "@ai-sdk/amazon-bedrock": "4.0.65",
14625
14644
  "@ai-sdk/anthropic": "3.0.47",
14626
- "@ai-sdk/azure": "3.0.34",
14645
+ "@ai-sdk/azure": "3.0.35",
14627
14646
  "@ai-sdk/google": "3.0.31",
14628
14647
  "@ai-sdk/groq": "3.0.24",
14629
- "@ai-sdk/openai": "3.0.33",
14648
+ "@ai-sdk/openai": "3.0.34",
14630
14649
  "@ai-sdk/openai-compatible": "2.0.30",
14631
14650
  "@t3-oss/env-core": "0.13.10",
14632
- ai: "6.0.99",
14651
+ ai: "6.0.101",
14633
14652
  clipboardy: "5.3.1",
14634
14653
  "ollama-ai-provider-v2": "3.3.1",
14635
14654
  zod: "4.3.6"
@@ -40851,6 +40870,7 @@ var modelMaxImagesPerCall = {
40851
40870
  "chatgpt-image-latest": 10
40852
40871
  };
40853
40872
  var defaultResponseFormatPrefixes = [
40873
+ "chatgpt-image-",
40854
40874
  "gpt-image-1-mini",
40855
40875
  "gpt-image-1.5",
40856
40876
  "gpt-image-1"
@@ -41492,7 +41512,7 @@ async function convertToOpenAIResponsesInput({
41492
41512
  hasShellTool = false,
41493
41513
  hasApplyPatchTool = false
41494
41514
  }) {
41495
- var _a16, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
41515
+ var _a16, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
41496
41516
  const input = [];
41497
41517
  const warnings = [];
41498
41518
  const processedApprovalIds = /* @__PURE__ */ new Set;
@@ -41571,7 +41591,9 @@ async function convertToOpenAIResponsesInput({
41571
41591
  for (const part of content) {
41572
41592
  switch (part.type) {
41573
41593
  case "text": {
41574
- const id = (_b16 = (_a16 = part.providerOptions) == null ? undefined : _a16[providerOptionsName]) == null ? undefined : _b16.itemId;
41594
+ const providerOpts = (_a16 = part.providerOptions) == null ? undefined : _a16[providerOptionsName];
41595
+ const id = providerOpts == null ? undefined : providerOpts.itemId;
41596
+ const phase = providerOpts == null ? undefined : providerOpts.phase;
41575
41597
  if (hasConversation && id != null) {
41576
41598
  break;
41577
41599
  }
@@ -41582,12 +41604,13 @@ async function convertToOpenAIResponsesInput({
41582
41604
  input.push({
41583
41605
  role: "assistant",
41584
41606
  content: [{ type: "output_text", text: part.text }],
41585
- id
41607
+ id,
41608
+ ...phase != null && { phase }
41586
41609
  });
41587
41610
  break;
41588
41611
  }
41589
41612
  case "tool-call": {
41590
- const id = (_g = (_d = (_c = part.providerOptions) == null ? undefined : _c[providerOptionsName]) == null ? undefined : _d.itemId) != null ? _g : (_f = (_e = part.providerMetadata) == null ? undefined : _e[providerOptionsName]) == null ? undefined : _f.itemId;
41613
+ const id = (_f = (_c = (_b16 = part.providerOptions) == null ? undefined : _b16[providerOptionsName]) == null ? undefined : _c.itemId) != null ? _f : (_e = (_d = part.providerMetadata) == null ? undefined : _d[providerOptionsName]) == null ? undefined : _e.itemId;
41591
41614
  if (hasConversation && id != null) {
41592
41615
  break;
41593
41616
  }
@@ -41693,7 +41716,7 @@ async function convertToOpenAIResponsesInput({
41693
41716
  break;
41694
41717
  }
41695
41718
  if (store) {
41696
- const itemId = (_j = (_i = (_h = part.providerOptions) == null ? undefined : _h[providerOptionsName]) == null ? undefined : _i.itemId) != null ? _j : part.toolCallId;
41719
+ const itemId = (_i = (_h = (_g = part.providerOptions) == null ? undefined : _g[providerOptionsName]) == null ? undefined : _h.itemId) != null ? _i : part.toolCallId;
41697
41720
  input.push({ type: "item_reference", id: itemId });
41698
41721
  } else {
41699
41722
  warnings.push({
@@ -41787,7 +41810,7 @@ async function convertToOpenAIResponsesInput({
41787
41810
  }
41788
41811
  const output = part.output;
41789
41812
  if (output.type === "execution-denied") {
41790
- const approvalId = (_l = (_k = output.providerOptions) == null ? undefined : _k.openai) == null ? undefined : _l.approvalId;
41813
+ const approvalId = (_k = (_j = output.providerOptions) == null ? undefined : _j.openai) == null ? undefined : _k.approvalId;
41791
41814
  if (approvalId) {
41792
41815
  continue;
41793
41816
  }
@@ -41844,7 +41867,7 @@ async function convertToOpenAIResponsesInput({
41844
41867
  contentValue = output.value;
41845
41868
  break;
41846
41869
  case "execution-denied":
41847
- contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
41870
+ contentValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
41848
41871
  break;
41849
41872
  case "json":
41850
41873
  case "error-json":
@@ -41965,7 +41988,8 @@ var openaiResponsesChunkSchema = lazySchema(() => zodSchema(exports_external.uni
41965
41988
  item: exports_external.discriminatedUnion("type", [
41966
41989
  exports_external.object({
41967
41990
  type: exports_external.literal("message"),
41968
- id: exports_external.string()
41991
+ id: exports_external.string(),
41992
+ phase: exports_external.enum(["commentary", "final_answer"]).nullish()
41969
41993
  }),
41970
41994
  exports_external.object({
41971
41995
  type: exports_external.literal("reasoning"),
@@ -42078,7 +42102,8 @@ var openaiResponsesChunkSchema = lazySchema(() => zodSchema(exports_external.uni
42078
42102
  item: exports_external.discriminatedUnion("type", [
42079
42103
  exports_external.object({
42080
42104
  type: exports_external.literal("message"),
42081
- id: exports_external.string()
42105
+ id: exports_external.string(),
42106
+ phase: exports_external.enum(["commentary", "final_answer"]).nullish()
42082
42107
  }),
42083
42108
  exports_external.object({
42084
42109
  type: exports_external.literal("reasoning"),
@@ -42371,6 +42396,7 @@ var openaiResponsesResponseSchema = lazySchema(() => zodSchema(exports_external.
42371
42396
  type: exports_external.literal("message"),
42372
42397
  role: exports_external.literal("assistant"),
42373
42398
  id: exports_external.string(),
42399
+ phase: exports_external.enum(["commentary", "final_answer"]).nullish(),
42374
42400
  content: exports_external.array(exports_external.object({
42375
42401
  type: exports_external.literal("output_text"),
42376
42402
  text: exports_external.string(),
@@ -43533,6 +43559,7 @@ var OpenAIResponsesLanguageModel = class {
43533
43559
  }
43534
43560
  const providerMetadata2 = {
43535
43561
  itemId: part.id,
43562
+ ...part.phase != null && { phase: part.phase },
43536
43563
  ...contentPart.annotations.length > 0 && {
43537
43564
  annotations: contentPart.annotations
43538
43565
  }
@@ -43841,6 +43868,7 @@ var OpenAIResponsesLanguageModel = class {
43841
43868
  let responseId = null;
43842
43869
  const ongoingToolCalls = {};
43843
43870
  const ongoingAnnotations = [];
43871
+ let activeMessagePhase;
43844
43872
  let hasFunctionCall = false;
43845
43873
  const activeReasoning = {};
43846
43874
  let serviceTier;
@@ -43850,7 +43878,7 @@ var OpenAIResponsesLanguageModel = class {
43850
43878
  controller.enqueue({ type: "stream-start", warnings });
43851
43879
  },
43852
43880
  transform(chunk, controller) {
43853
- var _a16, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
43881
+ var _a16, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
43854
43882
  if (options.includeRawChunks) {
43855
43883
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
43856
43884
  }
@@ -43982,12 +44010,16 @@ var OpenAIResponsesLanguageModel = class {
43982
44010
  };
43983
44011
  } else if (value.item.type === "shell_call_output") {} else if (value.item.type === "message") {
43984
44012
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
44013
+ activeMessagePhase = (_a16 = value.item.phase) != null ? _a16 : undefined;
43985
44014
  controller.enqueue({
43986
44015
  type: "text-start",
43987
44016
  id: value.item.id,
43988
44017
  providerMetadata: {
43989
44018
  [providerOptionsName]: {
43990
- itemId: value.item.id
44019
+ itemId: value.item.id,
44020
+ ...value.item.phase != null && {
44021
+ phase: value.item.phase
44022
+ }
43991
44023
  }
43992
44024
  }
43993
44025
  });
@@ -44002,19 +44034,22 @@ var OpenAIResponsesLanguageModel = class {
44002
44034
  providerMetadata: {
44003
44035
  [providerOptionsName]: {
44004
44036
  itemId: value.item.id,
44005
- reasoningEncryptedContent: (_a16 = value.item.encrypted_content) != null ? _a16 : null
44037
+ reasoningEncryptedContent: (_b16 = value.item.encrypted_content) != null ? _b16 : null
44006
44038
  }
44007
44039
  }
44008
44040
  });
44009
44041
  }
44010
44042
  } else if (isResponseOutputItemDoneChunk(value)) {
44011
44043
  if (value.item.type === "message") {
44044
+ const phase = (_c = value.item.phase) != null ? _c : activeMessagePhase;
44045
+ activeMessagePhase = undefined;
44012
44046
  controller.enqueue({
44013
44047
  type: "text-end",
44014
44048
  id: value.item.id,
44015
44049
  providerMetadata: {
44016
44050
  [providerOptionsName]: {
44017
44051
  itemId: value.item.id,
44052
+ ...phase != null && { phase },
44018
44053
  ...ongoingAnnotations.length > 0 && {
44019
44054
  annotations: ongoingAnnotations
44020
44055
  }
@@ -44077,13 +44112,13 @@ var OpenAIResponsesLanguageModel = class {
44077
44112
  toolName: toolNameMapping.toCustomToolName("file_search"),
44078
44113
  result: {
44079
44114
  queries: value.item.queries,
44080
- results: (_c = (_b16 = value.item.results) == null ? undefined : _b16.map((result) => ({
44115
+ results: (_e = (_d = value.item.results) == null ? undefined : _d.map((result) => ({
44081
44116
  attributes: result.attributes,
44082
44117
  fileId: result.file_id,
44083
44118
  filename: result.filename,
44084
44119
  score: result.score,
44085
44120
  text: result.text
44086
- }))) != null ? _c : null
44121
+ }))) != null ? _e : null
44087
44122
  }
44088
44123
  });
44089
44124
  } else if (value.item.type === "code_interpreter_call") {
@@ -44107,8 +44142,8 @@ var OpenAIResponsesLanguageModel = class {
44107
44142
  });
44108
44143
  } else if (value.item.type === "mcp_call") {
44109
44144
  ongoingToolCalls[value.output_index] = undefined;
44110
- const approvalRequestId = (_d = value.item.approval_request_id) != null ? _d : undefined;
44111
- const aliasedToolCallId = approvalRequestId != null ? (_f = (_e = approvalRequestIdToDummyToolCallIdFromStream.get(approvalRequestId)) != null ? _e : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _f : value.item.id : value.item.id;
44145
+ const approvalRequestId = (_f = value.item.approval_request_id) != null ? _f : undefined;
44146
+ const aliasedToolCallId = approvalRequestId != null ? (_h = (_g = approvalRequestIdToDummyToolCallIdFromStream.get(approvalRequestId)) != null ? _g : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _h : value.item.id : value.item.id;
44112
44147
  const toolName = `mcp.${value.item.name}`;
44113
44148
  controller.enqueue({
44114
44149
  type: "tool-call",
@@ -44178,8 +44213,8 @@ var OpenAIResponsesLanguageModel = class {
44178
44213
  ongoingToolCalls[value.output_index] = undefined;
44179
44214
  } else if (value.item.type === "mcp_approval_request") {
44180
44215
  ongoingToolCalls[value.output_index] = undefined;
44181
- const dummyToolCallId = (_i = (_h = (_g = self2.config).generateId) == null ? undefined : _h.call(_g)) != null ? _i : generateId();
44182
- const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : value.item.id;
44216
+ const dummyToolCallId = (_k = (_j = (_i = self2.config).generateId) == null ? undefined : _j.call(_i)) != null ? _k : generateId();
44217
+ const approvalRequestId = (_l = value.item.approval_request_id) != null ? _l : value.item.id;
44183
44218
  approvalRequestIdToDummyToolCallIdFromStream.set(approvalRequestId, dummyToolCallId);
44184
44219
  const toolName = `mcp.${value.item.name}`;
44185
44220
  controller.enqueue({
@@ -44259,7 +44294,7 @@ var OpenAIResponsesLanguageModel = class {
44259
44294
  providerMetadata: {
44260
44295
  [providerOptionsName]: {
44261
44296
  itemId: value.item.id,
44262
- reasoningEncryptedContent: (_k = value.item.encrypted_content) != null ? _k : null
44297
+ reasoningEncryptedContent: (_m = value.item.encrypted_content) != null ? _m : null
44263
44298
  }
44264
44299
  }
44265
44300
  });
@@ -44363,7 +44398,7 @@ var OpenAIResponsesLanguageModel = class {
44363
44398
  id: value.item_id,
44364
44399
  delta: value.delta
44365
44400
  });
44366
- if (((_m = (_l = options.providerOptions) == null ? undefined : _l[providerOptionsName]) == null ? undefined : _m.logprobs) && value.logprobs) {
44401
+ if (((_o = (_n = options.providerOptions) == null ? undefined : _n[providerOptionsName]) == null ? undefined : _o.logprobs) && value.logprobs) {
44367
44402
  logprobs.push(value.logprobs);
44368
44403
  }
44369
44404
  } else if (value.type === "response.reasoning_summary_part.added") {
@@ -44390,7 +44425,7 @@ var OpenAIResponsesLanguageModel = class {
44390
44425
  providerMetadata: {
44391
44426
  [providerOptionsName]: {
44392
44427
  itemId: value.item_id,
44393
- reasoningEncryptedContent: (_o = (_n = activeReasoning[value.item_id]) == null ? undefined : _n.encryptedContent) != null ? _o : null
44428
+ reasoningEncryptedContent: (_q = (_p = activeReasoning[value.item_id]) == null ? undefined : _p.encryptedContent) != null ? _q : null
44394
44429
  }
44395
44430
  }
44396
44431
  });
@@ -44424,10 +44459,10 @@ var OpenAIResponsesLanguageModel = class {
44424
44459
  } else if (isResponseFinishedChunk(value)) {
44425
44460
  finishReason = {
44426
44461
  unified: mapOpenAIResponseFinishReason({
44427
- finishReason: (_p = value.response.incomplete_details) == null ? undefined : _p.reason,
44462
+ finishReason: (_r = value.response.incomplete_details) == null ? undefined : _r.reason,
44428
44463
  hasFunctionCall
44429
44464
  }),
44430
- raw: (_r = (_q = value.response.incomplete_details) == null ? undefined : _q.reason) != null ? _r : undefined
44465
+ raw: (_t = (_s = value.response.incomplete_details) == null ? undefined : _s.reason) != null ? _t : undefined
44431
44466
  };
44432
44467
  usage = value.response.usage;
44433
44468
  if (typeof value.response.service_tier === "string") {
@@ -44439,7 +44474,7 @@ var OpenAIResponsesLanguageModel = class {
44439
44474
  controller.enqueue({
44440
44475
  type: "source",
44441
44476
  sourceType: "url",
44442
- id: (_u = (_t = (_s = self2.config).generateId) == null ? undefined : _t.call(_s)) != null ? _u : generateId(),
44477
+ id: (_w = (_v = (_u = self2.config).generateId) == null ? undefined : _v.call(_u)) != null ? _w : generateId(),
44443
44478
  url: value.annotation.url,
44444
44479
  title: value.annotation.title
44445
44480
  });
@@ -44447,7 +44482,7 @@ var OpenAIResponsesLanguageModel = class {
44447
44482
  controller.enqueue({
44448
44483
  type: "source",
44449
44484
  sourceType: "document",
44450
- id: (_x = (_w = (_v = self2.config).generateId) == null ? undefined : _w.call(_v)) != null ? _x : generateId(),
44485
+ id: (_z = (_y = (_x = self2.config).generateId) == null ? undefined : _y.call(_x)) != null ? _z : generateId(),
44451
44486
  mediaType: "text/plain",
44452
44487
  title: value.annotation.filename,
44453
44488
  filename: value.annotation.filename,
@@ -44463,7 +44498,7 @@ var OpenAIResponsesLanguageModel = class {
44463
44498
  controller.enqueue({
44464
44499
  type: "source",
44465
44500
  sourceType: "document",
44466
- id: (_A = (_z = (_y = self2.config).generateId) == null ? undefined : _z.call(_y)) != null ? _A : generateId(),
44501
+ id: (_C = (_B = (_A = self2.config).generateId) == null ? undefined : _B.call(_A)) != null ? _C : generateId(),
44467
44502
  mediaType: "text/plain",
44468
44503
  title: value.annotation.filename,
44469
44504
  filename: value.annotation.filename,
@@ -44479,7 +44514,7 @@ var OpenAIResponsesLanguageModel = class {
44479
44514
  controller.enqueue({
44480
44515
  type: "source",
44481
44516
  sourceType: "document",
44482
- id: (_D = (_C = (_B = self2.config).generateId) == null ? undefined : _C.call(_B)) != null ? _D : generateId(),
44517
+ id: (_F = (_E = (_D = self2.config).generateId) == null ? undefined : _E.call(_D)) != null ? _F : generateId(),
44483
44518
  mediaType: "application/octet-stream",
44484
44519
  title: value.annotation.file_id,
44485
44520
  filename: value.annotation.file_id,
@@ -44590,7 +44625,7 @@ var azureOpenaiTools = {
44590
44625
  imageGeneration,
44591
44626
  webSearchPreview
44592
44627
  };
44593
- var VERSION4 = "3.0.34";
44628
+ var VERSION4 = "3.0.35";
44594
44629
  function createAzure(options = {}) {
44595
44630
  var _a16;
44596
44631
  const getHeaders = () => {
@@ -46950,7 +46985,8 @@ async function prepareTools3({
46950
46985
  toolWarnings.push({ type: "unsupported", feature: `tool ${tool2.id}` });
46951
46986
  }
46952
46987
  }
46953
- for (const tool2 of functionTools) {
46988
+ const filteredFunctionTools = (toolChoice == null ? undefined : toolChoice.type) === "tool" ? functionTools.filter((t) => t.name === toolChoice.toolName) : functionTools;
46989
+ for (const tool2 of filteredFunctionTools) {
46954
46990
  bedrockTools.push({
46955
46991
  toolSpec: {
46956
46992
  name: tool2.name,
@@ -48458,7 +48494,7 @@ var bedrockImageResponseSchema = exports_external.object({
48458
48494
  details: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
48459
48495
  preview: exports_external.unknown().optional()
48460
48496
  });
48461
- var VERSION5 = "4.0.64";
48497
+ var VERSION5 = "4.0.65";
48462
48498
  function createSigV4FetchFunction(getCredentials, fetch2 = globalThis.fetch) {
48463
48499
  return async (input, init) => {
48464
48500
  var _a16, _b16;
@@ -54429,6 +54465,7 @@ var modelMaxImagesPerCall3 = {
54429
54465
  "chatgpt-image-latest": 10
54430
54466
  };
54431
54467
  var defaultResponseFormatPrefixes2 = [
54468
+ "chatgpt-image-",
54432
54469
  "gpt-image-1-mini",
54433
54470
  "gpt-image-1.5",
54434
54471
  "gpt-image-1"
@@ -54996,7 +55033,7 @@ async function convertToOpenAIResponsesInput2({
54996
55033
  hasShellTool = false,
54997
55034
  hasApplyPatchTool = false
54998
55035
  }) {
54999
- var _a16, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
55036
+ var _a16, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
55000
55037
  const input = [];
55001
55038
  const warnings = [];
55002
55039
  const processedApprovalIds = /* @__PURE__ */ new Set;
@@ -55075,7 +55112,9 @@ async function convertToOpenAIResponsesInput2({
55075
55112
  for (const part of content) {
55076
55113
  switch (part.type) {
55077
55114
  case "text": {
55078
- const id = (_b16 = (_a16 = part.providerOptions) == null ? undefined : _a16[providerOptionsName]) == null ? undefined : _b16.itemId;
55115
+ const providerOpts = (_a16 = part.providerOptions) == null ? undefined : _a16[providerOptionsName];
55116
+ const id = providerOpts == null ? undefined : providerOpts.itemId;
55117
+ const phase = providerOpts == null ? undefined : providerOpts.phase;
55079
55118
  if (hasConversation && id != null) {
55080
55119
  break;
55081
55120
  }
@@ -55086,12 +55125,13 @@ async function convertToOpenAIResponsesInput2({
55086
55125
  input.push({
55087
55126
  role: "assistant",
55088
55127
  content: [{ type: "output_text", text: part.text }],
55089
- id
55128
+ id,
55129
+ ...phase != null && { phase }
55090
55130
  });
55091
55131
  break;
55092
55132
  }
55093
55133
  case "tool-call": {
55094
- const id = (_g = (_d = (_c = part.providerOptions) == null ? undefined : _c[providerOptionsName]) == null ? undefined : _d.itemId) != null ? _g : (_f = (_e = part.providerMetadata) == null ? undefined : _e[providerOptionsName]) == null ? undefined : _f.itemId;
55134
+ const id = (_f = (_c = (_b16 = part.providerOptions) == null ? undefined : _b16[providerOptionsName]) == null ? undefined : _c.itemId) != null ? _f : (_e = (_d = part.providerMetadata) == null ? undefined : _d[providerOptionsName]) == null ? undefined : _e.itemId;
55095
55135
  if (hasConversation && id != null) {
55096
55136
  break;
55097
55137
  }
@@ -55197,7 +55237,7 @@ async function convertToOpenAIResponsesInput2({
55197
55237
  break;
55198
55238
  }
55199
55239
  if (store) {
55200
- const itemId = (_j = (_i = (_h = part.providerOptions) == null ? undefined : _h[providerOptionsName]) == null ? undefined : _i.itemId) != null ? _j : part.toolCallId;
55240
+ const itemId = (_i = (_h = (_g = part.providerOptions) == null ? undefined : _g[providerOptionsName]) == null ? undefined : _h.itemId) != null ? _i : part.toolCallId;
55201
55241
  input.push({ type: "item_reference", id: itemId });
55202
55242
  } else {
55203
55243
  warnings.push({
@@ -55291,7 +55331,7 @@ async function convertToOpenAIResponsesInput2({
55291
55331
  }
55292
55332
  const output = part.output;
55293
55333
  if (output.type === "execution-denied") {
55294
- const approvalId = (_l = (_k = output.providerOptions) == null ? undefined : _k.openai) == null ? undefined : _l.approvalId;
55334
+ const approvalId = (_k = (_j = output.providerOptions) == null ? undefined : _j.openai) == null ? undefined : _k.approvalId;
55295
55335
  if (approvalId) {
55296
55336
  continue;
55297
55337
  }
@@ -55348,7 +55388,7 @@ async function convertToOpenAIResponsesInput2({
55348
55388
  contentValue = output.value;
55349
55389
  break;
55350
55390
  case "execution-denied":
55351
- contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
55391
+ contentValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
55352
55392
  break;
55353
55393
  case "json":
55354
55394
  case "error-json":
@@ -55469,7 +55509,8 @@ var openaiResponsesChunkSchema2 = lazySchema(() => zodSchema(exports_external.un
55469
55509
  item: exports_external.discriminatedUnion("type", [
55470
55510
  exports_external.object({
55471
55511
  type: exports_external.literal("message"),
55472
- id: exports_external.string()
55512
+ id: exports_external.string(),
55513
+ phase: exports_external.enum(["commentary", "final_answer"]).nullish()
55473
55514
  }),
55474
55515
  exports_external.object({
55475
55516
  type: exports_external.literal("reasoning"),
@@ -55582,7 +55623,8 @@ var openaiResponsesChunkSchema2 = lazySchema(() => zodSchema(exports_external.un
55582
55623
  item: exports_external.discriminatedUnion("type", [
55583
55624
  exports_external.object({
55584
55625
  type: exports_external.literal("message"),
55585
- id: exports_external.string()
55626
+ id: exports_external.string(),
55627
+ phase: exports_external.enum(["commentary", "final_answer"]).nullish()
55586
55628
  }),
55587
55629
  exports_external.object({
55588
55630
  type: exports_external.literal("reasoning"),
@@ -55875,6 +55917,7 @@ var openaiResponsesResponseSchema2 = lazySchema(() => zodSchema(exports_external
55875
55917
  type: exports_external.literal("message"),
55876
55918
  role: exports_external.literal("assistant"),
55877
55919
  id: exports_external.string(),
55920
+ phase: exports_external.enum(["commentary", "final_answer"]).nullish(),
55878
55921
  content: exports_external.array(exports_external.object({
55879
55922
  type: exports_external.literal("output_text"),
55880
55923
  text: exports_external.string(),
@@ -56836,6 +56879,7 @@ var OpenAIResponsesLanguageModel2 = class {
56836
56879
  }
56837
56880
  const providerMetadata2 = {
56838
56881
  itemId: part.id,
56882
+ ...part.phase != null && { phase: part.phase },
56839
56883
  ...contentPart.annotations.length > 0 && {
56840
56884
  annotations: contentPart.annotations
56841
56885
  }
@@ -57144,6 +57188,7 @@ var OpenAIResponsesLanguageModel2 = class {
57144
57188
  let responseId = null;
57145
57189
  const ongoingToolCalls = {};
57146
57190
  const ongoingAnnotations = [];
57191
+ let activeMessagePhase;
57147
57192
  let hasFunctionCall = false;
57148
57193
  const activeReasoning = {};
57149
57194
  let serviceTier;
@@ -57153,7 +57198,7 @@ var OpenAIResponsesLanguageModel2 = class {
57153
57198
  controller.enqueue({ type: "stream-start", warnings });
57154
57199
  },
57155
57200
  transform(chunk, controller) {
57156
- var _a16, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
57201
+ var _a16, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
57157
57202
  if (options.includeRawChunks) {
57158
57203
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
57159
57204
  }
@@ -57285,12 +57330,16 @@ var OpenAIResponsesLanguageModel2 = class {
57285
57330
  };
57286
57331
  } else if (value.item.type === "shell_call_output") {} else if (value.item.type === "message") {
57287
57332
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
57333
+ activeMessagePhase = (_a16 = value.item.phase) != null ? _a16 : undefined;
57288
57334
  controller.enqueue({
57289
57335
  type: "text-start",
57290
57336
  id: value.item.id,
57291
57337
  providerMetadata: {
57292
57338
  [providerOptionsName]: {
57293
- itemId: value.item.id
57339
+ itemId: value.item.id,
57340
+ ...value.item.phase != null && {
57341
+ phase: value.item.phase
57342
+ }
57294
57343
  }
57295
57344
  }
57296
57345
  });
@@ -57305,19 +57354,22 @@ var OpenAIResponsesLanguageModel2 = class {
57305
57354
  providerMetadata: {
57306
57355
  [providerOptionsName]: {
57307
57356
  itemId: value.item.id,
57308
- reasoningEncryptedContent: (_a16 = value.item.encrypted_content) != null ? _a16 : null
57357
+ reasoningEncryptedContent: (_b16 = value.item.encrypted_content) != null ? _b16 : null
57309
57358
  }
57310
57359
  }
57311
57360
  });
57312
57361
  }
57313
57362
  } else if (isResponseOutputItemDoneChunk2(value)) {
57314
57363
  if (value.item.type === "message") {
57364
+ const phase = (_c = value.item.phase) != null ? _c : activeMessagePhase;
57365
+ activeMessagePhase = undefined;
57315
57366
  controller.enqueue({
57316
57367
  type: "text-end",
57317
57368
  id: value.item.id,
57318
57369
  providerMetadata: {
57319
57370
  [providerOptionsName]: {
57320
57371
  itemId: value.item.id,
57372
+ ...phase != null && { phase },
57321
57373
  ...ongoingAnnotations.length > 0 && {
57322
57374
  annotations: ongoingAnnotations
57323
57375
  }
@@ -57380,13 +57432,13 @@ var OpenAIResponsesLanguageModel2 = class {
57380
57432
  toolName: toolNameMapping.toCustomToolName("file_search"),
57381
57433
  result: {
57382
57434
  queries: value.item.queries,
57383
- results: (_c = (_b16 = value.item.results) == null ? undefined : _b16.map((result) => ({
57435
+ results: (_e = (_d = value.item.results) == null ? undefined : _d.map((result) => ({
57384
57436
  attributes: result.attributes,
57385
57437
  fileId: result.file_id,
57386
57438
  filename: result.filename,
57387
57439
  score: result.score,
57388
57440
  text: result.text
57389
- }))) != null ? _c : null
57441
+ }))) != null ? _e : null
57390
57442
  }
57391
57443
  });
57392
57444
  } else if (value.item.type === "code_interpreter_call") {
@@ -57410,8 +57462,8 @@ var OpenAIResponsesLanguageModel2 = class {
57410
57462
  });
57411
57463
  } else if (value.item.type === "mcp_call") {
57412
57464
  ongoingToolCalls[value.output_index] = undefined;
57413
- const approvalRequestId = (_d = value.item.approval_request_id) != null ? _d : undefined;
57414
- const aliasedToolCallId = approvalRequestId != null ? (_f = (_e = approvalRequestIdToDummyToolCallIdFromStream.get(approvalRequestId)) != null ? _e : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _f : value.item.id : value.item.id;
57465
+ const approvalRequestId = (_f = value.item.approval_request_id) != null ? _f : undefined;
57466
+ const aliasedToolCallId = approvalRequestId != null ? (_h = (_g = approvalRequestIdToDummyToolCallIdFromStream.get(approvalRequestId)) != null ? _g : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _h : value.item.id : value.item.id;
57415
57467
  const toolName = `mcp.${value.item.name}`;
57416
57468
  controller.enqueue({
57417
57469
  type: "tool-call",
@@ -57481,8 +57533,8 @@ var OpenAIResponsesLanguageModel2 = class {
57481
57533
  ongoingToolCalls[value.output_index] = undefined;
57482
57534
  } else if (value.item.type === "mcp_approval_request") {
57483
57535
  ongoingToolCalls[value.output_index] = undefined;
57484
- const dummyToolCallId = (_i = (_h = (_g = self2.config).generateId) == null ? undefined : _h.call(_g)) != null ? _i : generateId();
57485
- const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : value.item.id;
57536
+ const dummyToolCallId = (_k = (_j = (_i = self2.config).generateId) == null ? undefined : _j.call(_i)) != null ? _k : generateId();
57537
+ const approvalRequestId = (_l = value.item.approval_request_id) != null ? _l : value.item.id;
57486
57538
  approvalRequestIdToDummyToolCallIdFromStream.set(approvalRequestId, dummyToolCallId);
57487
57539
  const toolName = `mcp.${value.item.name}`;
57488
57540
  controller.enqueue({
@@ -57562,7 +57614,7 @@ var OpenAIResponsesLanguageModel2 = class {
57562
57614
  providerMetadata: {
57563
57615
  [providerOptionsName]: {
57564
57616
  itemId: value.item.id,
57565
- reasoningEncryptedContent: (_k = value.item.encrypted_content) != null ? _k : null
57617
+ reasoningEncryptedContent: (_m = value.item.encrypted_content) != null ? _m : null
57566
57618
  }
57567
57619
  }
57568
57620
  });
@@ -57666,7 +57718,7 @@ var OpenAIResponsesLanguageModel2 = class {
57666
57718
  id: value.item_id,
57667
57719
  delta: value.delta
57668
57720
  });
57669
- if (((_m = (_l = options.providerOptions) == null ? undefined : _l[providerOptionsName]) == null ? undefined : _m.logprobs) && value.logprobs) {
57721
+ if (((_o = (_n = options.providerOptions) == null ? undefined : _n[providerOptionsName]) == null ? undefined : _o.logprobs) && value.logprobs) {
57670
57722
  logprobs.push(value.logprobs);
57671
57723
  }
57672
57724
  } else if (value.type === "response.reasoning_summary_part.added") {
@@ -57693,7 +57745,7 @@ var OpenAIResponsesLanguageModel2 = class {
57693
57745
  providerMetadata: {
57694
57746
  [providerOptionsName]: {
57695
57747
  itemId: value.item_id,
57696
- reasoningEncryptedContent: (_o = (_n = activeReasoning[value.item_id]) == null ? undefined : _n.encryptedContent) != null ? _o : null
57748
+ reasoningEncryptedContent: (_q = (_p = activeReasoning[value.item_id]) == null ? undefined : _p.encryptedContent) != null ? _q : null
57697
57749
  }
57698
57750
  }
57699
57751
  });
@@ -57727,10 +57779,10 @@ var OpenAIResponsesLanguageModel2 = class {
57727
57779
  } else if (isResponseFinishedChunk2(value)) {
57728
57780
  finishReason = {
57729
57781
  unified: mapOpenAIResponseFinishReason2({
57730
- finishReason: (_p = value.response.incomplete_details) == null ? undefined : _p.reason,
57782
+ finishReason: (_r = value.response.incomplete_details) == null ? undefined : _r.reason,
57731
57783
  hasFunctionCall
57732
57784
  }),
57733
- raw: (_r = (_q = value.response.incomplete_details) == null ? undefined : _q.reason) != null ? _r : undefined
57785
+ raw: (_t = (_s = value.response.incomplete_details) == null ? undefined : _s.reason) != null ? _t : undefined
57734
57786
  };
57735
57787
  usage = value.response.usage;
57736
57788
  if (typeof value.response.service_tier === "string") {
@@ -57742,7 +57794,7 @@ var OpenAIResponsesLanguageModel2 = class {
57742
57794
  controller.enqueue({
57743
57795
  type: "source",
57744
57796
  sourceType: "url",
57745
- id: (_u = (_t = (_s = self2.config).generateId) == null ? undefined : _t.call(_s)) != null ? _u : generateId(),
57797
+ id: (_w = (_v = (_u = self2.config).generateId) == null ? undefined : _v.call(_u)) != null ? _w : generateId(),
57746
57798
  url: value.annotation.url,
57747
57799
  title: value.annotation.title
57748
57800
  });
@@ -57750,7 +57802,7 @@ var OpenAIResponsesLanguageModel2 = class {
57750
57802
  controller.enqueue({
57751
57803
  type: "source",
57752
57804
  sourceType: "document",
57753
- id: (_x = (_w = (_v = self2.config).generateId) == null ? undefined : _w.call(_v)) != null ? _x : generateId(),
57805
+ id: (_z = (_y = (_x = self2.config).generateId) == null ? undefined : _y.call(_x)) != null ? _z : generateId(),
57754
57806
  mediaType: "text/plain",
57755
57807
  title: value.annotation.filename,
57756
57808
  filename: value.annotation.filename,
@@ -57766,7 +57818,7 @@ var OpenAIResponsesLanguageModel2 = class {
57766
57818
  controller.enqueue({
57767
57819
  type: "source",
57768
57820
  sourceType: "document",
57769
- id: (_A = (_z = (_y = self2.config).generateId) == null ? undefined : _z.call(_y)) != null ? _A : generateId(),
57821
+ id: (_C = (_B = (_A = self2.config).generateId) == null ? undefined : _B.call(_A)) != null ? _C : generateId(),
57770
57822
  mediaType: "text/plain",
57771
57823
  title: value.annotation.filename,
57772
57824
  filename: value.annotation.filename,
@@ -57782,7 +57834,7 @@ var OpenAIResponsesLanguageModel2 = class {
57782
57834
  controller.enqueue({
57783
57835
  type: "source",
57784
57836
  sourceType: "document",
57785
- id: (_D = (_C = (_B = self2.config).generateId) == null ? undefined : _C.call(_B)) != null ? _D : generateId(),
57837
+ id: (_F = (_E = (_D = self2.config).generateId) == null ? undefined : _E.call(_D)) != null ? _F : generateId(),
57786
57838
  mediaType: "application/octet-stream",
57787
57839
  title: value.annotation.file_id,
57788
57840
  filename: value.annotation.file_id,
@@ -58174,7 +58226,7 @@ var OpenAITranscriptionModel2 = class {
58174
58226
  };
58175
58227
  }
58176
58228
  };
58177
- var VERSION8 = "3.0.33";
58229
+ var VERSION8 = "3.0.34";
58178
58230
  function createOpenAI(options = {}) {
58179
58231
  var _a16, _b16;
58180
58232
  const baseURL = (_a16 = withoutTrailingSlash(loadOptionalSetting({
@@ -61453,6 +61505,16 @@ var RetryError = class extends AISDKError {
61453
61505
  }
61454
61506
  };
61455
61507
  _a19 = symbol19;
61508
+ function asArray(value) {
61509
+ return value === undefined ? [] : Array.isArray(value) ? value : [value];
61510
+ }
61511
+ async function notify(options) {
61512
+ for (const callback of asArray(options.callbacks)) {
61513
+ try {
61514
+ await callback(options.event);
61515
+ } catch (_ignored) {}
61516
+ }
61517
+ }
61456
61518
  function formatWarning({
61457
61519
  warning,
61458
61520
  provider,
@@ -61737,7 +61799,7 @@ function detectMediaType({
61737
61799
  }
61738
61800
  return;
61739
61801
  }
61740
- var VERSION11 = "6.0.99";
61802
+ var VERSION11 = "6.0.101";
61741
61803
  var download = async ({
61742
61804
  url: url2,
61743
61805
  maxBytes,
@@ -61830,9 +61892,6 @@ function convertDataContentToBase64String(content) {
61830
61892
  }
61831
61893
  return convertUint8ArrayToBase64(content);
61832
61894
  }
61833
- function asArray(value) {
61834
- return value === undefined ? [] : Array.isArray(value) ? value : [value];
61835
- }
61836
61895
  async function convertToLanguageModelPrompt({
61837
61896
  prompt,
61838
61897
  supportedUrls,
@@ -63087,9 +63146,7 @@ async function executeToolCall({
63087
63146
  tracer,
63088
63147
  fn: async (span) => {
63089
63148
  let output;
63090
- try {
63091
- await (onToolCallStart == null ? undefined : onToolCallStart(baseCallbackEvent));
63092
- } catch (_ignored) {}
63149
+ await notify({ event: baseCallbackEvent, callbacks: onToolCallStart });
63093
63150
  const startTime = now();
63094
63151
  try {
63095
63152
  const stream = executeTool({
@@ -63116,14 +63173,15 @@ async function executeToolCall({
63116
63173
  }
63117
63174
  } catch (error48) {
63118
63175
  const durationMs2 = now() - startTime;
63119
- try {
63120
- await (onToolCallFinish == null ? undefined : onToolCallFinish({
63176
+ await notify({
63177
+ event: {
63121
63178
  ...baseCallbackEvent,
63122
63179
  success: false,
63123
63180
  error: error48,
63124
63181
  durationMs: durationMs2
63125
- }));
63126
- } catch (_ignored) {}
63182
+ },
63183
+ callbacks: onToolCallFinish
63184
+ });
63127
63185
  recordErrorOnSpan(span, error48);
63128
63186
  return {
63129
63187
  type: "tool-error",
@@ -63136,14 +63194,15 @@ async function executeToolCall({
63136
63194
  };
63137
63195
  }
63138
63196
  const durationMs = now() - startTime;
63139
- try {
63140
- await (onToolCallFinish == null ? undefined : onToolCallFinish({
63197
+ await notify({
63198
+ event: {
63141
63199
  ...baseCallbackEvent,
63142
63200
  success: true,
63143
63201
  output,
63144
63202
  durationMs
63145
- }));
63146
- } catch (_ignored) {}
63203
+ },
63204
+ callbacks: onToolCallFinish
63205
+ });
63147
63206
  try {
63148
63207
  span.setAttributes(await selectTelemetryAttributes({
63149
63208
  telemetry,
@@ -64838,7 +64897,9 @@ function processUIMessageStream({
64838
64897
  break;
64839
64898
  }
64840
64899
  case "tool-input-error": {
64841
- if (chunk.dynamic) {
64900
+ const existingPart = state.message.parts.filter(isToolUIPart).find((p) => p.toolCallId === chunk.toolCallId);
64901
+ const isDynamic = existingPart != null ? existingPart.type === "dynamic-tool" : !!chunk.dynamic;
64902
+ if (isDynamic) {
64842
64903
  updateDynamicToolPart({
64843
64904
  toolCallId: chunk.toolCallId,
64844
64905
  toolName: chunk.toolName,
@@ -65855,7 +65916,7 @@ var DefaultStreamTextResult = class {
65855
65916
  },
65856
65917
  providerMetadata: part.providerMetadata
65857
65918
  });
65858
- await (onStepFinish == null ? undefined : onStepFinish(currentStepResult));
65919
+ await notify({ event: currentStepResult, callbacks: onStepFinish });
65859
65920
  logWarnings({
65860
65921
  warnings: recordedWarnings,
65861
65922
  provider: modelInfo.provider,
@@ -65890,34 +65951,37 @@ var DefaultStreamTextResult = class {
65890
65951
  self2._totalUsage.resolve(totalUsage);
65891
65952
  self2._steps.resolve(recordedSteps);
65892
65953
  const finalStep = recordedSteps[recordedSteps.length - 1];
65893
- await (onFinish == null ? undefined : onFinish({
65894
- stepNumber: finalStep.stepNumber,
65895
- model: finalStep.model,
65896
- functionId: finalStep.functionId,
65897
- metadata: finalStep.metadata,
65898
- experimental_context: finalStep.experimental_context,
65899
- finishReason: finalStep.finishReason,
65900
- rawFinishReason: finalStep.rawFinishReason,
65901
- totalUsage,
65902
- usage: finalStep.usage,
65903
- content: finalStep.content,
65904
- text: finalStep.text,
65905
- reasoningText: finalStep.reasoningText,
65906
- reasoning: finalStep.reasoning,
65907
- files: finalStep.files,
65908
- sources: finalStep.sources,
65909
- toolCalls: finalStep.toolCalls,
65910
- staticToolCalls: finalStep.staticToolCalls,
65911
- dynamicToolCalls: finalStep.dynamicToolCalls,
65912
- toolResults: finalStep.toolResults,
65913
- staticToolResults: finalStep.staticToolResults,
65914
- dynamicToolResults: finalStep.dynamicToolResults,
65915
- request: finalStep.request,
65916
- response: finalStep.response,
65917
- warnings: finalStep.warnings,
65918
- providerMetadata: finalStep.providerMetadata,
65919
- steps: recordedSteps
65920
- }));
65954
+ await notify({
65955
+ event: {
65956
+ stepNumber: finalStep.stepNumber,
65957
+ model: finalStep.model,
65958
+ functionId: finalStep.functionId,
65959
+ metadata: finalStep.metadata,
65960
+ experimental_context: finalStep.experimental_context,
65961
+ finishReason: finalStep.finishReason,
65962
+ rawFinishReason: finalStep.rawFinishReason,
65963
+ totalUsage,
65964
+ usage: finalStep.usage,
65965
+ content: finalStep.content,
65966
+ text: finalStep.text,
65967
+ reasoningText: finalStep.reasoningText,
65968
+ reasoning: finalStep.reasoning,
65969
+ files: finalStep.files,
65970
+ sources: finalStep.sources,
65971
+ toolCalls: finalStep.toolCalls,
65972
+ staticToolCalls: finalStep.staticToolCalls,
65973
+ dynamicToolCalls: finalStep.dynamicToolCalls,
65974
+ toolResults: finalStep.toolResults,
65975
+ staticToolResults: finalStep.staticToolResults,
65976
+ dynamicToolResults: finalStep.dynamicToolResults,
65977
+ request: finalStep.request,
65978
+ response: finalStep.response,
65979
+ warnings: finalStep.warnings,
65980
+ providerMetadata: finalStep.providerMetadata,
65981
+ steps: recordedSteps
65982
+ },
65983
+ callbacks: onFinish
65984
+ });
65921
65985
  rootSpan.setAttributes(await selectTelemetryAttributes({
65922
65986
  telemetry,
65923
65987
  attributes: {
@@ -66035,8 +66099,8 @@ var DefaultStreamTextResult = class {
66035
66099
  prompt,
66036
66100
  messages
66037
66101
  });
66038
- try {
66039
- await (onStart == null ? undefined : onStart({
66102
+ await notify({
66103
+ event: {
66040
66104
  model: modelInfo,
66041
66105
  system,
66042
66106
  prompt,
@@ -66062,8 +66126,9 @@ var DefaultStreamTextResult = class {
66062
66126
  include,
66063
66127
  ...callbackTelemetryProps,
66064
66128
  experimental_context
66065
- }));
66066
- } catch (_ignored) {}
66129
+ },
66130
+ callbacks: onStart
66131
+ });
66067
66132
  const initialMessages = initialPrompt.messages;
66068
66133
  const initialResponseMessages = [];
66069
66134
  const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
@@ -66226,8 +66291,8 @@ var DefaultStreamTextResult = class {
66226
66291
  const stepMessages = (_g = prepareStepResult == null ? undefined : prepareStepResult.messages) != null ? _g : stepInputMessages;
66227
66292
  const stepSystem = (_h = prepareStepResult == null ? undefined : prepareStepResult.system) != null ? _h : initialPrompt.system;
66228
66293
  const stepProviderOptions = mergeObjects(providerOptions, prepareStepResult == null ? undefined : prepareStepResult.providerOptions);
66229
- try {
66230
- await (onStepStart == null ? undefined : onStepStart({
66294
+ await notify({
66295
+ event: {
66231
66296
  stepNumber: recordedSteps.length,
66232
66297
  model: stepModelInfo,
66233
66298
  system: stepSystem,
@@ -66245,8 +66310,9 @@ var DefaultStreamTextResult = class {
66245
66310
  include,
66246
66311
  ...callbackTelemetryProps,
66247
66312
  experimental_context
66248
- }));
66249
- } catch (_ignored) {}
66313
+ },
66314
+ callbacks: onStepStart
66315
+ });
66250
66316
  const {
66251
66317
  result: { stream: stream2, response, request },
66252
66318
  doStreamSpan,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hongymagic/q",
3
- "version": "0.7.1",
3
+ "version": "2026.226.0",
4
4
  "description": "Quick AI answers from the command line",
5
5
  "main": "dist/q.js",
6
6
  "type": "module",
@@ -44,18 +44,20 @@
44
44
  "build:darwin-x64": "bun build --compile --minify --target=bun-darwin-x64 ./src/cli.ts --outfile dist/q-darwin-x64",
45
45
  "build:linux-x64": "bun build --compile --minify --target=bun-linux-x64 ./src/cli.ts --outfile dist/q-linux-x64",
46
46
  "build:linux-arm64": "bun build --compile --minify --target=bun-linux-arm64 ./src/cli.ts --outfile dist/q-linux-arm64",
47
- "build:windows-x64": "bun build --compile --minify --target=bun-windows-x64 ./src/cli.ts --outfile dist/q-windows-x64.exe"
47
+ "build:windows-x64": "bun build --compile --minify --target=bun-windows-x64 ./src/cli.ts --outfile dist/q-windows-x64.exe",
48
+ "release": "bun run scripts/release.ts",
49
+ "release:dry": "bun run scripts/release.ts --dry-run"
48
50
  },
49
51
  "dependencies": {
50
- "@ai-sdk/amazon-bedrock": "4.0.64",
52
+ "@ai-sdk/amazon-bedrock": "4.0.65",
51
53
  "@ai-sdk/anthropic": "3.0.47",
52
- "@ai-sdk/azure": "3.0.34",
54
+ "@ai-sdk/azure": "3.0.35",
53
55
  "@ai-sdk/google": "3.0.31",
54
56
  "@ai-sdk/groq": "3.0.24",
55
- "@ai-sdk/openai": "3.0.33",
57
+ "@ai-sdk/openai": "3.0.34",
56
58
  "@ai-sdk/openai-compatible": "2.0.30",
57
59
  "@t3-oss/env-core": "0.13.10",
58
- "ai": "6.0.99",
60
+ "ai": "6.0.101",
59
61
  "clipboardy": "5.3.1",
60
62
  "ollama-ai-provider-v2": "3.3.1",
61
63
  "zod": "4.3.6"