@janole/ai-sdk-provider-codex-asp 0.3.5 → 0.3.6

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.
package/dist/index.cjs CHANGED
@@ -935,7 +935,7 @@ var DynamicToolsDispatcher = class {
935
935
  // package.json
936
936
  var package_default = {
937
937
  name: "@janole/ai-sdk-provider-codex-asp",
938
- version: "0.3.5"};
938
+ version: "0.3.6"};
939
939
 
940
940
  // src/package-info.ts
941
941
  var PACKAGE_NAME = package_default.name;
@@ -1007,7 +1007,7 @@ var CodexEventMapper = class {
1007
1007
  "item/reasoning/textDelta": (p) => this.handleReasoningDelta(p),
1008
1008
  "item/reasoning/summaryTextDelta": (p) => this.handleReasoningDelta(p),
1009
1009
  "item/plan/delta": (p) => this.handleReasoningDelta(p),
1010
- "item/fileChange/outputDelta": (p) => this.handleReasoningDelta(p),
1010
+ "item/fileChange/outputDelta": (p) => this.handleFileChangeOutputDelta(p),
1011
1011
  "item/reasoning/summaryPartAdded": (p) => this.handleSummaryPartAdded(p),
1012
1012
  "turn/plan/updated": (p) => this.handlePlanUpdated(p),
1013
1013
  "item/commandExecution/outputDelta": (p) => this.handleCommandOutputDelta(p),
@@ -1143,12 +1143,38 @@ ${output}`;
1143
1143
  parts.push(...this.startDynamicToolCall(item));
1144
1144
  break;
1145
1145
  }
1146
+ case "fileChange": {
1147
+ this.ensureStreamStarted(parts);
1148
+ const toolName = "codex_file_change";
1149
+ this.openToolCalls.set(item.id, { toolName, output: "", droppedChars: 0 });
1150
+ parts.push(this.withMeta({
1151
+ type: "tool-call",
1152
+ toolCallId: item.id,
1153
+ toolName,
1154
+ input: JSON.stringify({ changes: item.changes, status: item.status }),
1155
+ providerExecuted: true,
1156
+ dynamic: true
1157
+ }));
1158
+ break;
1159
+ }
1160
+ case "webSearch": {
1161
+ this.ensureStreamStarted(parts);
1162
+ const toolName = "codex_web_search";
1163
+ this.openToolCalls.set(item.id, { toolName, output: "", droppedChars: 0 });
1164
+ parts.push(this.withMeta({
1165
+ type: "tool-call",
1166
+ toolCallId: item.id,
1167
+ toolName,
1168
+ input: JSON.stringify({ query: item.query, action: item.action ?? void 0 }),
1169
+ providerExecuted: true,
1170
+ dynamic: true
1171
+ }));
1172
+ break;
1173
+ }
1146
1174
  case "reasoning":
1147
1175
  case "plan":
1148
- case "fileChange":
1149
1176
  case "mcpToolCall":
1150
1177
  case "collabAgentToolCall":
1151
- case "webSearch":
1152
1178
  case "imageView":
1153
1179
  case "contextCompaction":
1154
1180
  case "enteredReviewMode":
@@ -1229,22 +1255,40 @@ ${output}`;
1229
1255
  }
1230
1256
  }));
1231
1257
  this.openToolCalls.delete(item.id);
1232
- } else if (item.type === "webSearch") {
1258
+ } else if (item.type === "fileChange" && this.openToolCalls.has(item.id)) {
1259
+ const tracked = this.openToolCalls.get(item.id);
1260
+ const toolName = tracked?.toolName ?? "codex_file_change";
1261
+ const output = tracked ? this.formatToolOutput(tracked.output, tracked.droppedChars) : "";
1262
+ parts.push(this.withMeta({
1263
+ type: "tool-result",
1264
+ toolCallId: item.id,
1265
+ toolName,
1266
+ result: { output, status: item.status, changes: item.changes }
1267
+ }));
1268
+ this.openToolCalls.delete(item.id);
1269
+ } else if (item.type === "webSearch" && this.openToolCalls.has(item.id)) {
1233
1270
  const webSearchSummary = this.formatWebSearchItemSummary(item);
1234
- if (webSearchSummary) {
1235
- this.emitReasoningDelta(parts, item.id, webSearchSummary);
1236
- }
1237
- if (this.openReasoningParts.has(item.id)) {
1238
- parts.push(this.withMeta({ type: "reasoning-end", id: item.id }));
1239
- this.openReasoningParts.delete(item.id);
1240
- }
1271
+ const tracked = this.openToolCalls.get(item.id);
1272
+ const toolName = tracked?.toolName ?? "codex_web_search";
1273
+ parts.push(this.withMeta({
1274
+ type: "tool-result",
1275
+ toolCallId: item.id,
1276
+ toolName,
1277
+ result: {
1278
+ output: webSearchSummary || "",
1279
+ query: item.query,
1280
+ action: item.action ?? void 0,
1281
+ summary: webSearchSummary || void 0
1282
+ }
1283
+ }));
1284
+ this.openToolCalls.delete(item.id);
1241
1285
  } else if (this.openReasoningParts.has(item.id)) {
1242
1286
  parts.push(this.withMeta({ type: "reasoning-end", id: item.id }));
1243
1287
  this.openReasoningParts.delete(item.id);
1244
1288
  }
1245
1289
  return parts;
1246
1290
  }
1247
- // item/reasoning/textDelta, item/reasoning/summaryTextDelta, item/plan/delta, item/fileChange/outputDelta
1291
+ // item/reasoning/textDelta, item/reasoning/summaryTextDelta, item/plan/delta
1248
1292
  handleReasoningDelta(params) {
1249
1293
  const delta = params ?? {};
1250
1294
  if (!delta.itemId || !delta.delta) {
@@ -1254,6 +1298,22 @@ ${output}`;
1254
1298
  this.emitReasoningDelta(parts, delta.itemId, delta.delta);
1255
1299
  return parts;
1256
1300
  }
1301
+ // item/fileChange/outputDelta
1302
+ handleFileChangeOutputDelta(params) {
1303
+ const delta = params ?? {};
1304
+ if (!delta.itemId || !delta.delta || !this.openToolCalls.has(delta.itemId)) {
1305
+ return [];
1306
+ }
1307
+ const tracked = this.openToolCalls.get(delta.itemId);
1308
+ this.appendTrackedOutput(tracked, delta.delta);
1309
+ return [this.withMeta({
1310
+ type: "tool-result",
1311
+ toolCallId: delta.itemId,
1312
+ toolName: tracked.toolName,
1313
+ result: { output: this.formatToolOutput(tracked.output, tracked.droppedChars) },
1314
+ preliminary: true
1315
+ })];
1316
+ }
1257
1317
  // item/reasoning/summaryPartAdded
1258
1318
  handleSummaryPartAdded(params) {
1259
1319
  const p = params ?? {};