@opencode-ai/ai 0.0.0-dev-17886 → 0.0.0-dev-17891

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.
@@ -225,7 +225,6 @@ export declare const protocol: Protocol<{
225
225
  } | undefined;
226
226
  }, {
227
227
  hasToolCalls: boolean;
228
- nextToolCallId: number;
229
228
  lifecycle: Lifecycle.State;
230
229
  }>;
231
230
  export declare const route: Route<{
@@ -468,7 +468,6 @@ const step = (state, event) => {
468
468
  const events = [];
469
469
  let hasToolCalls = nextState.hasToolCalls;
470
470
  let lifecycle = nextState.lifecycle;
471
- let nextToolCallId = nextState.nextToolCallId;
472
471
  let reasoningSignature = nextState.reasoningSignature;
473
472
  let textSignature = nextState.textSignature;
474
473
  for (const part of candidate.content.parts) {
@@ -491,7 +490,9 @@ const step = (state, event) => {
491
490
  }
492
491
  if ("functionCall" in part) {
493
492
  const input = part.functionCall.args === undefined ? {} : part.functionCall.args;
494
- const id = `tool_${nextToolCallId++}`;
493
+ // Gemini 2.0+ and Vertex supply a unique function call ID on the part; when omitted (e.g. Gemini 1.5),
494
+ // generate a globally unique ID rather than a per-request counter to prevent cross-request collisions in downstream registries.
495
+ const id = part.functionCall.id ?? `tool_${crypto.randomUUID().replaceAll("-", "")}`;
495
496
  const metadata = {
496
497
  ...(part.functionCall.id === undefined ? {} : { functionCallId: part.functionCall.id }),
497
498
  ...(part.thoughtSignature === undefined ? {} : { thoughtSignature: part.thoughtSignature }),
@@ -512,7 +513,6 @@ const step = (state, event) => {
512
513
  ...nextState,
513
514
  hasToolCalls,
514
515
  lifecycle,
515
- nextToolCallId,
516
516
  reasoningSignature,
517
517
  textSignature,
518
518
  finishReason: candidate.finishReason ?? nextState.finishReason,
@@ -535,7 +535,7 @@ export const protocol = Protocol.make({
535
535
  },
536
536
  stream: {
537
537
  event: Protocol.jsonEvent(GeminiEvent),
538
- initial: () => ({ hasToolCalls: false, nextToolCallId: 0, lifecycle: Lifecycle.initial() }),
538
+ initial: () => ({ hasToolCalls: false, lifecycle: Lifecycle.initial() }),
539
539
  step,
540
540
  onHalt: finish,
541
541
  },
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-17886",
3
+ "version": "0.0.0-dev-17891",
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-17886",
33
+ "@opencode-ai/http-recorder": "0.0.0-dev-17891",
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-17886",
42
+ "@opencode-ai/schema": "0.0.0-dev-17891",
43
43
  "aws4fetch": "1.0.20",
44
44
  "effect": "4.0.0-rc.110",
45
45
  "google-auth-library": "10.5.0"