@serii84/vertex-partner-provider 1.0.30 → 1.0.32

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/index.js +8 -8
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Vertex Partner Provider for OpenCode
3
- * v1.0.30 - Use @ai-sdk/openai instead of openai-compatible
3
+ * v1.0.32 - Always include delta (required by OpenAI format)
4
4
  */
5
5
 
6
6
  const fs = require('fs');
@@ -16,7 +16,7 @@ function debugLog(...args) {
16
16
  fs.appendFileSync(DEBUG_FILE, `[${timestamp}] ${message}\n`);
17
17
  }
18
18
 
19
- const { createOpenAI } = require('@ai-sdk/openai');
19
+ const { createOpenAICompatible } = require('@ai-sdk/openai-compatible');
20
20
  const { GoogleAuth } = require('google-auth-library');
21
21
 
22
22
  let authClient = null;
@@ -60,17 +60,18 @@ function cleanResponse(parsed) {
60
60
  }
61
61
  }
62
62
 
63
- // Clean up delta - remove null values and non-standard fields
64
- // Don't include delta on finish chunks at all
65
- if (choice.delta && !choice.finish_reason) {
63
+ // Clean up delta - always include it (OpenAI format requires delta on all streaming chunks)
64
+ if (choice.delta) {
66
65
  const cleanDelta = {};
67
66
  if (choice.delta.role) cleanDelta.role = choice.delta.role;
68
67
  if (choice.delta.content) cleanDelta.content = choice.delta.content;
69
68
  else if (choice.delta.reasoning_content) cleanDelta.content = choice.delta.reasoning_content;
70
69
  if (choice.delta.tool_calls) cleanDelta.tool_calls = choice.delta.tool_calls;
71
70
  cleanChoice.delta = cleanDelta;
71
+ } else {
72
+ // Always include delta, even if empty (required by OpenAI format)
73
+ cleanChoice.delta = {};
72
74
  }
73
- // Note: intentionally NOT including delta on finish chunks
74
75
 
75
76
  if (choice.message) {
76
77
  const cleanMessage = { role: choice.message.role };
@@ -277,11 +278,10 @@ function createVertexPartner(options = {}) {
277
278
  }
278
279
  };
279
280
 
280
- const provider = createOpenAI({
281
+ const provider = createOpenAICompatible({
281
282
  name: `vertex-${publisher}`,
282
283
  baseURL,
283
284
  fetch: authFetch,
284
- compatibility: 'compatible', // Use compatible mode for non-OpenAI endpoints
285
285
  });
286
286
 
287
287
  const wrappedProvider = (modelId) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serii84/vertex-partner-provider",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "Vertex AI partner models (GLM, Kimi, DeepSeek) for OpenCode",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,7 +10,7 @@
10
10
  "author": "",
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "@ai-sdk/openai": "^1.3.22",
13
+ "@ai-sdk/openai-compatible": "^2.0.4",
14
14
  "google-auth-library": "^10.5.0"
15
15
  }
16
16
  }