@opencode-ai/ai 0.0.0-dev-17774 → 0.0.0-dev-17781

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.
@@ -270,15 +270,16 @@ const lowerToolChoice = (toolChoice) => ProviderShared.matchToolChoice("Anthropi
270
270
  required: () => ({ type: "any" }),
271
271
  tool: (name) => ({ type: "tool", name }),
272
272
  });
273
+ const scrubToolCallID = (id) => id.replace(/[^a-zA-Z0-9_-]/g, "_");
273
274
  const lowerToolCall = (part) => ({
274
275
  type: "tool_use",
275
- id: part.id,
276
+ id: scrubToolCallID(part.id),
276
277
  name: part.name,
277
278
  input: part.input,
278
279
  });
279
280
  const lowerServerToolCall = (part) => ({
280
281
  type: "server_tool_use",
281
- id: part.id,
282
+ id: scrubToolCallID(part.id),
282
283
  name: part.name,
283
284
  input: part.input,
284
285
  });
@@ -301,7 +302,7 @@ const lowerServerToolResult = Effect.fn("AnthropicMessages.lowerServerToolResult
301
302
  // Prefer the provider-owned replay payload; fall back to the result value for
302
303
  // histories constructed directly from provider events.
303
304
  const payload = part.providerMetadata?.anthropic?.["result"] ?? part.result.value;
304
- return { type: wireType, tool_use_id: part.id, content: payload };
305
+ return { type: wireType, tool_use_id: scrubToolCallID(part.id), content: payload };
305
306
  });
306
307
  const lowerMedia = Effect.fn("AnthropicMessages.lowerMedia")(function* (part) {
307
308
  const media = ProviderShared.normalizeMedia(part);
@@ -465,7 +466,7 @@ const lowerMessages = Effect.fn("AnthropicMessages.lowerMessages")(function* (re
465
466
  return yield* ProviderShared.unsupportedContent("Anthropic Messages", "tool", ["tool-result"]);
466
467
  content.push({
467
468
  type: "tool_result",
468
- tool_use_id: part.id,
469
+ tool_use_id: scrubToolCallID(part.id),
469
470
  content: yield* lowerToolResultContent(part),
470
471
  is_error: part.result.type === "error" ? true : undefined,
471
472
  cache_control: cacheControl(breakpoints, part.cache),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "0.0.0-dev-17774",
3
+ "version": "0.0.0-dev-17781",
4
4
  "name": "@opencode-ai/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@clack/prompts": "1.0.0-alpha.1",
32
32
  "@effect/platform-node": "4.0.0-rc.110",
33
- "@opencode-ai/http-recorder": "0.0.0-dev-17774",
33
+ "@opencode-ai/http-recorder": "0.0.0-dev-17781",
34
34
  "@tsconfig/bun": "1.0.9",
35
35
  "@types/bun": "1.3.13",
36
36
  "@typescript/native-preview": "7.0.0-dev.20251207.1",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@smithy/eventstream-codec": "4.2.14",
41
41
  "@smithy/util-utf8": "4.2.2",
42
- "@opencode-ai/schema": "0.0.0-dev-17774",
42
+ "@opencode-ai/schema": "0.0.0-dev-17781",
43
43
  "aws4fetch": "1.0.20",
44
44
  "effect": "4.0.0-rc.110",
45
45
  "google-auth-library": "10.5.0"