@openclaw/voyage-provider 2026.8.1-beta.2 → 2026.9.1-beta.1

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.
@@ -1,5 +1,5 @@
1
- import { EMBEDDING_BATCH_ENDPOINT, applyEmbeddingBatchOutputLine, buildBatchHeaders, buildEmbeddingBatchGroupOptions, extractBatchErrorMessage, formatBatchErrorDetail, formatUnavailableBatchError, normalizeBatchBaseUrl, postJsonWithRetry, readEmbeddingBatchJsonl, resolveBatchCompletionFromStatus, resolveCompletedBatchResult, runEmbeddingBatchGroups, throwIfBatchCompletionError, throwIfBatchTerminalFailure, uploadBatchJsonlFile, withRemoteHttpResponse } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
2
- import { assertOkOrThrowProviderError, readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
1
+ import { EMBEDDING_BATCH_ENDPOINT, applyEmbeddingBatchOutputLine, buildBatchHeaders, buildEmbeddingBatchGroupOptions, extractBatchErrorMessage, formatBatchErrorDetail, formatUnavailableBatchError, postJsonWithRetry, readEmbeddingBatchJsonl, resolveBatchCompletionFromStatus, resolveCompletedBatchResult, resolveEmbeddingEndpointUrl, runEmbeddingBatchGroups, throwIfBatchCompletionError, throwIfBatchTerminalFailure, uploadBatchJsonlFile, withRemoteHttpResponse } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
2
+ import { assertOkOrThrowProviderError, createProviderOperationDeadline, readProviderJsonResponse, resolveProviderOperationTimeoutMs, waitProviderOperationPollInterval } from "openclaw/plugin-sdk/provider-http";
3
3
  import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
4
4
  import { normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  //#region extensions/voyage/embedding-batch.ts
@@ -7,20 +7,9 @@ const VOYAGE_BATCH_ENDPOINT = EMBEDDING_BATCH_ENDPOINT;
7
7
  const VOYAGE_BATCH_COMPLETION_WINDOW = "12h";
8
8
  const VOYAGE_BATCH_MAX_REQUESTS = 5e4;
9
9
  const VOYAGE_BATCH_RESPONSE_MAX_BYTES = 16 * 1024 * 1024;
10
- function resolveVoyageBatchDeps(overrides) {
11
- return {
12
- now: overrides?.now ?? Date.now,
13
- sleep: overrides?.sleep ?? (async (ms) => await new Promise((resolve) => {
14
- setTimeout(resolve, ms);
15
- })),
16
- postJsonWithRetry: overrides?.postJsonWithRetry ?? postJsonWithRetry,
17
- uploadBatchJsonlFile: overrides?.uploadBatchJsonlFile ?? uploadBatchJsonlFile,
18
- withRemoteHttpResponse: overrides?.withRemoteHttpResponse ?? withRemoteHttpResponse
19
- };
20
- }
21
10
  function buildVoyageBatchRequest(params) {
22
11
  return {
23
- url: `${normalizeBatchBaseUrl(params.client)}/${params.path}`,
12
+ url: resolveEmbeddingEndpointUrl(params.client.baseUrl, params.path),
24
13
  ssrfPolicy: params.client.ssrfPolicy,
25
14
  signal: params.signal,
26
15
  init: { headers: buildBatchHeaders(params.client, { json: true }) },
@@ -28,14 +17,13 @@ function buildVoyageBatchRequest(params) {
28
17
  };
29
18
  }
30
19
  async function submitVoyageBatch(params) {
31
- const baseUrl = normalizeBatchBaseUrl(params.client);
32
- const inputFileId = await params.deps.uploadBatchJsonlFile({
20
+ const inputFileId = await uploadBatchJsonlFile({
33
21
  client: params.client,
34
22
  requests: params.requests,
35
23
  errorPrefix: "voyage batch file upload failed"
36
24
  });
37
- return await params.deps.postJsonWithRetry({
38
- url: `${baseUrl}/batches`,
25
+ return await postJsonWithRetry({
26
+ url: resolveEmbeddingEndpointUrl(params.client.baseUrl, "batches"),
39
27
  headers: buildBatchHeaders(params.client, { json: true }),
40
28
  ssrfPolicy: params.client.ssrfPolicy,
41
29
  body: {
@@ -55,7 +43,7 @@ async function submitVoyageBatch(params) {
55
43
  });
56
44
  }
57
45
  async function fetchVoyageBatchStatus(params) {
58
- return await params.deps.withRemoteHttpResponse(buildVoyageBatchRequest({
46
+ return await withRemoteHttpResponse(buildVoyageBatchRequest({
59
47
  client: params.client,
60
48
  path: `batches/${params.batchId}`,
61
49
  signal: params.signal,
@@ -67,7 +55,7 @@ async function fetchVoyageBatchStatus(params) {
67
55
  }
68
56
  async function readVoyageBatchError(params) {
69
57
  try {
70
- return await params.deps.withRemoteHttpResponse(buildVoyageBatchRequest({
58
+ return await withRemoteHttpResponse(buildVoyageBatchRequest({
71
59
  client: params.client,
72
60
  path: `files/${params.errorFileId}/content`,
73
61
  onResponse: async (res) => {
@@ -83,20 +71,23 @@ async function readVoyageBatchError(params) {
83
71
  }
84
72
  }
85
73
  async function waitForVoyageBatch(params) {
86
- const deadline = params.deps.now() + params.timeoutMs;
74
+ const deadline = createProviderOperationDeadline({
75
+ label: `voyage batch ${params.batchId}`,
76
+ timeoutMs: params.timeoutMs
77
+ });
87
78
  let current = params.initial;
88
79
  while (true) {
89
80
  let status;
90
81
  if (current) status = current;
91
82
  else {
92
- const remainingRequestMs = deadline - params.deps.now();
93
- if (remainingRequestMs <= 0) throw new Error(`voyage batch ${params.batchId} timed out after ${params.timeoutMs}ms`);
94
- const signal = AbortSignal.timeout(Math.max(1, remainingRequestMs));
83
+ const signal = AbortSignal.timeout(resolveProviderOperationTimeoutMs({
84
+ deadline,
85
+ defaultTimeoutMs: params.timeoutMs
86
+ }));
95
87
  try {
96
88
  status = await fetchVoyageBatchStatus({
97
89
  client: params.client,
98
90
  batchId: params.batchId,
99
- deps: params.deps,
100
91
  signal
101
92
  });
102
93
  } catch (error) {
@@ -113,8 +104,7 @@ async function waitForVoyageBatch(params) {
113
104
  },
114
105
  readError: async (errorFileId) => await readVoyageBatchError({
115
106
  client: params.client,
116
- errorFileId,
117
- deps: params.deps
107
+ errorFileId
118
108
  })
119
109
  });
120
110
  if (state === "completed") return resolveBatchCompletionFromStatus({
@@ -130,21 +120,27 @@ async function waitForVoyageBatch(params) {
130
120
  },
131
121
  readError: async (errorFileId) => await readVoyageBatchError({
132
122
  client: params.client,
133
- errorFileId,
134
- deps: params.deps
123
+ errorFileId
135
124
  })
136
125
  });
137
126
  if (!params.wait) throw new Error(`voyage batch ${params.batchId} still ${state}; wait disabled`);
138
- const remainingMs = deadline - params.deps.now();
139
- if (remainingMs <= 0) throw new Error(`voyage batch ${params.batchId} timed out after ${params.timeoutMs}ms`);
140
- const waitMs = Math.min(params.pollIntervalMs, remainingMs);
127
+ const waitMs = Math.min(params.pollIntervalMs, resolveProviderOperationTimeoutMs({
128
+ deadline,
129
+ defaultTimeoutMs: params.timeoutMs
130
+ }));
141
131
  params.debug?.(`voyage batch ${params.batchId} ${state}; waiting ${waitMs}ms`);
142
- await params.deps.sleep(waitMs);
132
+ await waitProviderOperationPollInterval({
133
+ deadline,
134
+ pollIntervalMs: waitMs
135
+ });
136
+ resolveProviderOperationTimeoutMs({
137
+ deadline,
138
+ defaultTimeoutMs: params.timeoutMs
139
+ });
143
140
  current = void 0;
144
141
  }
145
142
  }
146
143
  async function runVoyageEmbeddingBatches(params) {
147
- const deps = resolveVoyageBatchDeps(params.deps);
148
144
  return await runEmbeddingBatchGroups({
149
145
  ...buildEmbeddingBatchGroupOptions(params, {
150
146
  maxRequests: VOYAGE_BATCH_MAX_REQUESTS,
@@ -154,8 +150,7 @@ async function runVoyageEmbeddingBatches(params) {
154
150
  const batchInfo = await submitVoyageBatch({
155
151
  client: params.client,
156
152
  requests: group,
157
- agentId: params.agentId,
158
- deps
153
+ agentId: params.agentId
159
154
  });
160
155
  if (!batchInfo.id) throw new Error("voyage batch create failed: missing batch id");
161
156
  const batchId = batchInfo.id;
@@ -171,8 +166,7 @@ async function runVoyageEmbeddingBatches(params) {
171
166
  status: batchInfo,
172
167
  readError: async (errorFileId) => await readVoyageBatchError({
173
168
  client: params.client,
174
- errorFileId,
175
- deps
169
+ errorFileId
176
170
  })
177
171
  });
178
172
  const completed = await resolveCompletedBatchResult({
@@ -186,15 +180,13 @@ async function runVoyageEmbeddingBatches(params) {
186
180
  pollIntervalMs,
187
181
  timeoutMs,
188
182
  debug: params.debug,
189
- initial: batchInfo,
190
- deps
183
+ initial: batchInfo
191
184
  })
192
185
  });
193
- const baseUrl = normalizeBatchBaseUrl(params.client);
194
186
  const errors = [];
195
187
  const remaining = new Set(group.map((request) => request.custom_id));
196
- await deps.withRemoteHttpResponse({
197
- url: `${baseUrl}/files/${completed.outputFileId}/content`,
188
+ await withRemoteHttpResponse({
189
+ url: resolveEmbeddingEndpointUrl(params.client.baseUrl, `files/${completed.outputFileId}/content`),
198
190
  ssrfPolicy: params.client.ssrfPolicy,
199
191
  init: { headers: buildBatchHeaders(params.client, { json: true }) },
200
192
  onResponse: async (contentRes) => {
@@ -1,4 +1,4 @@
1
- import { fetchRemoteEmbeddingVectors, normalizeEmbeddingModelWithPrefixes, resolveRemoteEmbeddingBearerClient } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
1
+ import { fetchRemoteEmbeddingVectors, normalizeEmbeddingModelWithPrefixes, resolveEmbeddingEndpointUrl, resolveRemoteEmbeddingBearerClient } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
2
2
  //#region extensions/voyage/embedding-provider.ts
3
3
  const DEFAULT_VOYAGE_EMBEDDING_MODEL = "voyage-4-large";
4
4
  const DEFAULT_VOYAGE_BASE_URL = "https://api.voyageai.com/v1";
@@ -16,7 +16,7 @@ function normalizeVoyageModel(model) {
16
16
  }
17
17
  async function createVoyageEmbeddingProvider(options) {
18
18
  const client = await resolveVoyageEmbeddingClient(options);
19
- const url = `${client.baseUrl.replace(/\/$/, "")}/embeddings`;
19
+ const url = resolveEmbeddingEndpointUrl(client.baseUrl, "embeddings");
20
20
  const embed = async (input, input_type, signal) => {
21
21
  if (input.length === 0) return [];
22
22
  const body = {
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { voyageMemoryEmbeddingProviderAdapter } from "./memory-embedding-adapter.js";
2
+ import { adaptMemoryEmbeddingProviderAdapter } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
2
3
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
3
4
  //#region extensions/voyage/index.ts
4
5
  var voyage_default = definePluginEntry({
@@ -6,7 +7,7 @@ var voyage_default = definePluginEntry({
6
7
  name: "Voyage Embeddings",
7
8
  description: "Voyage memory embedding provider plugin",
8
9
  register(api) {
9
- api.registerMemoryEmbeddingProvider(voyageMemoryEmbeddingProviderAdapter);
10
+ api.registerEmbeddingProvider(adaptMemoryEmbeddingProviderAdapter(voyageMemoryEmbeddingProviderAdapter));
10
11
  }
11
12
  });
12
13
  //#endregion
@@ -5,7 +5,7 @@
5
5
  },
6
6
  "enabledByDefault": true,
7
7
  "contracts": {
8
- "memoryEmbeddingProviders": ["voyage"]
8
+ "embeddingProviders": ["voyage"]
9
9
  },
10
10
  "setup": {
11
11
  "providers": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/voyage-provider",
3
- "version": "2026.8.1-beta.2",
3
+ "version": "2026.9.1-beta.1",
4
4
  "description": "OpenClaw Voyage embedding provider plugin.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,10 +18,10 @@
18
18
  "minHostVersion": ">=2026.7.2"
19
19
  },
20
20
  "compat": {
21
- "pluginApi": ">=2026.8.1-beta.2"
21
+ "pluginApi": ">=2026.9.1-beta.1"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.8.1-beta.2",
24
+ "openclawVersion": "2026.9.1-beta.1",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -38,7 +38,7 @@
38
38
  "README.md"
39
39
  ],
40
40
  "peerDependencies": {
41
- "openclaw": ">=2026.8.1-beta.2"
41
+ "openclaw": ">=2026.9.1-beta.1"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "openclaw": {