@openclaw/onnx 2026.11.5-beta.4 → 2026.11.10-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.
- package/dist/.setup/{artifacts-Ca0QH6_i.mjs → artifacts-DgGGpngs.mjs} +2 -3
- package/dist/.setup/{catalog-1BypY0zY.mjs → catalog-g9or975s.mjs} +1 -2
- package/dist/.setup/{cli-1ENeSnvV.mjs → cli-CKW-ZPXS.mjs} +4 -5
- package/dist/.setup/{model-loader-qxzJEnKc.mjs → model-loader-DDsav9p5.mjs} +5 -7
- package/dist/.setup/{protocol-YadX71Hf.mjs → protocol-CG1ILdRP.mjs} +2 -4
- package/dist/.setup/{worker-client-DkWtdqU9.mjs → worker-client-DU0fIUSF.mjs} +107 -94
- package/dist/.source-module-urls/c006b803da4ad0d774d12fd121a0790ab987a6423243e5bb28b74c5ce87a8b57.json +1 -1
- package/dist/index.js +5 -7
- package/dist/src/inference.worker.js +3 -4
- package/package.json +6 -6
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as OnnxWorkerError } from "./protocol-
|
|
1
|
+
import { t as OnnxWorkerError } from "./protocol-CG1ILdRP.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Type } from "typebox";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
5
|
import fs from "node:fs/promises";
|
|
6
6
|
import { readFileWindowFully, root, sha256File } from "openclaw/plugin-sdk/file-access-runtime";
|
|
7
7
|
import { Value } from "typebox/value";
|
|
8
|
-
|
|
8
|
+
// extensions/onnx/src/artifacts.ts
|
|
9
9
|
const ExportSchema = Type.Object({
|
|
10
10
|
modelId: Type.String(),
|
|
11
11
|
sourceRevision: Type.String({ pattern: "^[a-f0-9]{40}$" }),
|
|
@@ -152,5 +152,4 @@ async function downloadModel(root$1, model, signal) {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
//#endregion
|
|
156
155
|
export { verifyModel as i, readModelArtifact as n, resolveModelFiles as r, downloadModel as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// extensions/onnx/src/catalog.ts
|
|
2
2
|
function file(bytes, sha256, path = "model.onnx") {
|
|
3
3
|
return {
|
|
4
4
|
name: path.slice(path.lastIndexOf("/") + 1),
|
|
@@ -43,5 +43,4 @@ const MODELS = [
|
|
|
43
43
|
function findModel(id) {
|
|
44
44
|
return MODELS.find((model) => model.id === id);
|
|
45
45
|
}
|
|
46
|
-
//#endregion
|
|
47
46
|
export { findModel as n, MODELS as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as findModel, t as MODELS } from "./catalog-
|
|
2
|
-
import { n as createOnnxProvider, t as InferenceWorkerClient } from "./worker-client-
|
|
3
|
-
import { i as verifyModel, t as downloadModel } from "./artifacts-
|
|
1
|
+
import { n as findModel, t as MODELS } from "./catalog-g9or975s.mjs";
|
|
2
|
+
import { n as createOnnxProvider, t as InferenceWorkerClient } from "./worker-client-DU0fIUSF.mjs";
|
|
3
|
+
import { i as verifyModel, t as downloadModel } from "./artifacts-DgGGpngs.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
|
|
5
|
+
// extensions/onnx/src/cli.ts
|
|
6
6
|
function registerOnnxCli({ program }, settings, workerUrl, resolvePath) {
|
|
7
7
|
const root = program.command("onnx").description("Download, verify, and check local ONNX decision models");
|
|
8
8
|
const config = (options) => ({
|
|
@@ -91,5 +91,4 @@ function registerOnnxCli({ program }, settings, workerUrl, resolvePath) {
|
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
//#endregion
|
|
95
94
|
export { registerOnnxCli };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as findModel } from "./catalog-
|
|
2
|
-
import { n as UnsupportedInputError, t as OnnxWorkerError } from "./protocol-
|
|
3
|
-
import { n as readModelArtifact, r as resolveModelFiles } from "./artifacts-
|
|
1
|
+
import { n as findModel } from "./catalog-g9or975s.mjs";
|
|
2
|
+
import { n as UnsupportedInputError, t as OnnxWorkerError } from "./protocol-CG1ILdRP.mjs";
|
|
3
|
+
import { n as readModelArtifact, r as resolveModelFiles } from "./artifacts-DgGGpngs.mjs";
|
|
4
4
|
import { Tokenizer } from "@huggingface/tokenizers";
|
|
5
5
|
import { InferenceSession, Tensor } from "onnxruntime-node";
|
|
6
|
-
|
|
6
|
+
// extensions/onnx/src/models/tokenize.ts
|
|
7
7
|
function tokenIds(value) {
|
|
8
8
|
return Array.isArray(value) && value.every((id) => typeof id === "number" && Number.isSafeInteger(id) && id >= 0);
|
|
9
9
|
}
|
|
@@ -15,8 +15,7 @@ function encodeModelText(tokenizer, text, options) {
|
|
|
15
15
|
attention_mask: encoded.attention_mask
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
//#region extensions/onnx/src/model-loader.ts
|
|
18
|
+
// extensions/onnx/src/model-loader.ts
|
|
20
19
|
const WORDS = /(?:https?:\/\/[^\s]+|www\.[^\s]+)|[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}|@[a-z0-9_]+|[\p{L}\p{N}_]+(?:[-_][\p{L}\p{N}_]+)*|\S/giu;
|
|
21
20
|
const RESERVED = /\[(?:P|L|C|E|R|DESCRIPTION|EXAMPLE|OUTPUT|SEP_TEXT|SEP_STRUCT)\]|[()]/u;
|
|
22
21
|
function indices(values) {
|
|
@@ -210,5 +209,4 @@ var ModelCache = class {
|
|
|
210
209
|
}
|
|
211
210
|
}
|
|
212
211
|
};
|
|
213
|
-
//#endregion
|
|
214
212
|
export { ModelCache };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
// extensions/onnx/src/models/types.ts
|
|
2
2
|
var UnsupportedInputError = class extends Error {};
|
|
3
|
-
|
|
4
|
-
//#region extensions/onnx/src/protocol.ts
|
|
3
|
+
// extensions/onnx/src/protocol.ts
|
|
5
4
|
var OnnxWorkerError = class extends Error {
|
|
6
5
|
constructor(code) {
|
|
7
6
|
super(`ONNX worker: ${code}`);
|
|
8
7
|
this.code = code;
|
|
9
8
|
}
|
|
10
9
|
};
|
|
11
|
-
//#endregion
|
|
12
10
|
export { UnsupportedInputError as n, OnnxWorkerError as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as findModel } from "./catalog-
|
|
2
|
-
import { n as UnsupportedInputError, t as OnnxWorkerError } from "./protocol-
|
|
1
|
+
import { n as findModel } from "./catalog-g9or975s.mjs";
|
|
2
|
+
import { n as UnsupportedInputError, t as OnnxWorkerError } from "./protocol-CG1ILdRP.mjs";
|
|
3
3
|
import { resolveRuntimeWorkerArgv, spawnOomScoreAdjusted } from "openclaw/plugin-sdk/process-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { isDecisionBatchV1Representable, validateDecisionResultV2 } from "openclaw/plugin-sdk/decisions";
|
|
5
5
|
import { createDeferred } from "openclaw/plugin-sdk/concurrency-runtime";
|
|
6
6
|
import { Guard } from "typebox/guard";
|
|
7
|
-
|
|
7
|
+
// extensions/onnx/src/decision-codec.ts
|
|
8
8
|
function render(value) {
|
|
9
9
|
return typeof value === "string" ? value : JSON.stringify(value);
|
|
10
10
|
}
|
|
@@ -38,89 +38,109 @@ function probabilities(logits) {
|
|
|
38
38
|
const sum = weights.reduce((total, value) => total + value, 0);
|
|
39
39
|
return weights.map((value) => value / sum);
|
|
40
40
|
}
|
|
41
|
+
function encodeOnnxDecisionInputs(state, questions) {
|
|
42
|
+
const entries = Object.entries(questions);
|
|
43
|
+
const text = render(state);
|
|
44
|
+
return {
|
|
45
|
+
entries,
|
|
46
|
+
inputs: entries.map(([, question]) => {
|
|
47
|
+
const selected = rubric(question);
|
|
48
|
+
return {
|
|
49
|
+
text,
|
|
50
|
+
task: "decision",
|
|
51
|
+
...selected,
|
|
52
|
+
...question.instructions == null ? {} : { instructions: render(question.instructions) }
|
|
53
|
+
};
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function decodeOnnxDecisionResults(model, { entries, inputs }, results) {
|
|
58
|
+
const answers = /* @__PURE__ */ new Map();
|
|
59
|
+
let inputTokens = 0;
|
|
60
|
+
entries.forEach(([id, question], index) => {
|
|
61
|
+
const result = results[index];
|
|
62
|
+
const labels = inputs[index].labels;
|
|
63
|
+
const values = probabilities(result.logits);
|
|
64
|
+
inputTokens += result.inputTokens;
|
|
65
|
+
if (question.type === "boolean") answers.set(id, {
|
|
66
|
+
type: "boolean",
|
|
67
|
+
probabilityTrue: values[0]
|
|
68
|
+
});
|
|
69
|
+
else if (question.type === "score") {
|
|
70
|
+
const score = Math.min(values.length - 1, values.reduce((sum, value, position) => sum + value * position, 0));
|
|
71
|
+
answers.set(id, {
|
|
72
|
+
type: "score",
|
|
73
|
+
score,
|
|
74
|
+
probabilities: values
|
|
75
|
+
});
|
|
76
|
+
} else {
|
|
77
|
+
const best = values.indexOf(Math.max(...values));
|
|
78
|
+
answers.set(id, {
|
|
79
|
+
type: "choice",
|
|
80
|
+
choice: labels[best],
|
|
81
|
+
probabilities: Object.fromEntries(labels.map((label, position) => [label, values[position]]))
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return {
|
|
86
|
+
model,
|
|
87
|
+
answers: Object.fromEntries(answers),
|
|
88
|
+
usage: { inputTokens }
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
// extensions/onnx/src/decision-execution.ts
|
|
92
|
+
async function executeOnnxDecision(execution, client, warn) {
|
|
93
|
+
execution.signal.throwIfAborted();
|
|
94
|
+
if (!findModel(execution.modelId)) return {
|
|
95
|
+
status: "unavailable",
|
|
96
|
+
reason: "unsupported-input"
|
|
97
|
+
};
|
|
98
|
+
try {
|
|
99
|
+
const encoded = encodeOnnxDecisionInputs(execution.state, execution.questions);
|
|
100
|
+
const results = await client.classify(execution.modelId, encoded.inputs, execution.signal, execution.isAdmissible);
|
|
101
|
+
execution.signal.throwIfAborted();
|
|
102
|
+
return {
|
|
103
|
+
status: "ok",
|
|
104
|
+
result: decodeOnnxDecisionResults(execution.modelId, encoded, results)
|
|
105
|
+
};
|
|
106
|
+
} catch (error) {
|
|
107
|
+
execution.signal.throwIfAborted();
|
|
108
|
+
if (error instanceof UnsupportedInputError || error instanceof OnnxWorkerError && error.code === "unsupported-input") return {
|
|
109
|
+
status: "unavailable",
|
|
110
|
+
reason: "unsupported-input"
|
|
111
|
+
};
|
|
112
|
+
if (error instanceof OnnxWorkerError) {
|
|
113
|
+
if (error.code === "model-missing" || error.code === "model-integrity") warn(`ONNX model ${execution.modelId} is missing or invalid. Run openclaw onnx verify ${execution.modelId}; use download or prepare a local export as listed by openclaw onnx models.`);
|
|
114
|
+
else if (error.code === "dependency-unavailable") warn("ONNX Runtime is unavailable. Install the optional ONNX plugin dependencies for this platform.");
|
|
115
|
+
return {
|
|
116
|
+
status: "unavailable",
|
|
117
|
+
reason: "transport"
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
status: "unavailable",
|
|
122
|
+
reason: "invalid-response"
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// extensions/onnx/src/decisions.ts
|
|
127
|
+
/** The standalone CLI still consumes the V1 data contract. */
|
|
41
128
|
function createOnnxProvider(client, warn) {
|
|
42
129
|
return {
|
|
43
130
|
id: "onnx",
|
|
44
131
|
contractVersion: 1,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const text = render(batch.state);
|
|
54
|
-
const inputs = entries.map(([, question]) => {
|
|
55
|
-
const selected = rubric(question);
|
|
56
|
-
return {
|
|
57
|
-
text,
|
|
58
|
-
task: "decision",
|
|
59
|
-
...selected,
|
|
60
|
-
...question.instructions == null ? {} : { instructions: render(question.instructions) }
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
const results = await client.classify(context.model, inputs, context.signal, context.isAdmissible);
|
|
64
|
-
context.signal.throwIfAborted();
|
|
65
|
-
const answers = /* @__PURE__ */ new Map();
|
|
66
|
-
let inputTokens = 0;
|
|
67
|
-
entries.forEach(([id, question], index) => {
|
|
68
|
-
const result = results[index];
|
|
69
|
-
const labels = inputs[index].labels;
|
|
70
|
-
const values = probabilities(result.logits);
|
|
71
|
-
inputTokens += result.inputTokens;
|
|
72
|
-
if (question.type === "boolean") answers.set(id, {
|
|
73
|
-
type: "boolean",
|
|
74
|
-
probabilityTrue: values[0]
|
|
75
|
-
});
|
|
76
|
-
else if (question.type === "score") {
|
|
77
|
-
const score = Math.min(values.length - 1, values.reduce((sum, value, position) => sum + value * position, 0));
|
|
78
|
-
answers.set(id, {
|
|
79
|
-
type: "score",
|
|
80
|
-
score,
|
|
81
|
-
probabilities: values
|
|
82
|
-
});
|
|
83
|
-
} else {
|
|
84
|
-
const best = values.indexOf(Math.max(...values));
|
|
85
|
-
answers.set(id, {
|
|
86
|
-
type: "choice",
|
|
87
|
-
choice: labels[best],
|
|
88
|
-
probabilities: Object.fromEntries(labels.map((label, position) => [label, values[position]]))
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
return {
|
|
93
|
-
status: "ok",
|
|
94
|
-
result: {
|
|
95
|
-
model: context.model,
|
|
96
|
-
answers: Object.fromEntries(answers),
|
|
97
|
-
usage: { inputTokens }
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
} catch (error) {
|
|
101
|
-
context.signal.throwIfAborted();
|
|
102
|
-
if (error instanceof UnsupportedInputError || error instanceof OnnxWorkerError && error.code === "unsupported-input") return {
|
|
103
|
-
status: "unavailable",
|
|
104
|
-
reason: "unsupported-input"
|
|
105
|
-
};
|
|
106
|
-
if (error instanceof OnnxWorkerError) {
|
|
107
|
-
if (error.code === "model-missing" || error.code === "model-integrity") warn(`ONNX model ${context.model} is missing or invalid. Run openclaw onnx verify ${context.model}; use download or prepare a local export as listed by openclaw onnx models.`);
|
|
108
|
-
else if (error.code === "dependency-unavailable") warn("ONNX Runtime is unavailable. Install the optional ONNX plugin dependencies for this platform.");
|
|
109
|
-
return {
|
|
110
|
-
status: "unavailable",
|
|
111
|
-
reason: "transport"
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
status: "unavailable",
|
|
116
|
-
reason: "invalid-response"
|
|
117
|
-
};
|
|
118
|
-
}
|
|
132
|
+
evaluate(batch, context) {
|
|
133
|
+
return executeOnnxDecision({
|
|
134
|
+
modelId: context.model,
|
|
135
|
+
state: batch.state,
|
|
136
|
+
questions: batch.questions,
|
|
137
|
+
signal: context.signal,
|
|
138
|
+
isAdmissible: context.isAdmissible
|
|
139
|
+
}, client, warn);
|
|
119
140
|
}
|
|
120
141
|
};
|
|
121
142
|
}
|
|
122
143
|
function createPreparedOnnxProvider(client, warn) {
|
|
123
|
-
const legacy = createOnnxProvider(client, warn);
|
|
124
144
|
return {
|
|
125
145
|
id: "onnx",
|
|
126
146
|
contractVersion: 2,
|
|
@@ -179,32 +199,26 @@ function createPreparedOnnxProvider(client, warn) {
|
|
|
179
199
|
}
|
|
180
200
|
},
|
|
181
201
|
async evaluate(batch, context) {
|
|
182
|
-
|
|
183
|
-
if (!v1 || context.reasoning !== void 0 && context.reasoning !== "auto") return {
|
|
202
|
+
if (!isDecisionBatchV1Representable(batch) || context.reasoning !== void 0 && context.reasoning !== "auto") return {
|
|
184
203
|
status: "unavailable",
|
|
185
204
|
reason: "unsupported-input"
|
|
186
205
|
};
|
|
187
|
-
const outcome = await
|
|
188
|
-
|
|
189
|
-
|
|
206
|
+
const outcome = await executeOnnxDecision({
|
|
207
|
+
modelId: context.model.id,
|
|
208
|
+
state: batch.state.type === "text" ? batch.state.text : batch.state.value,
|
|
209
|
+
questions: batch.questions,
|
|
190
210
|
signal: context.signal,
|
|
191
|
-
deadlineMonotonicMs: context.deadlineMonotonicMs,
|
|
192
211
|
isAdmissible: context.isAdmissible
|
|
193
|
-
});
|
|
212
|
+
}, client, warn);
|
|
194
213
|
if (outcome.status !== "ok") return outcome;
|
|
195
|
-
|
|
196
|
-
return result ? {
|
|
197
|
-
status: "ok",
|
|
198
|
-
result
|
|
199
|
-
} : {
|
|
214
|
+
return validateDecisionResultV2(batch, outcome.result) ? outcome : {
|
|
200
215
|
status: "unavailable",
|
|
201
216
|
reason: "invalid-response"
|
|
202
217
|
};
|
|
203
218
|
}
|
|
204
219
|
};
|
|
205
220
|
}
|
|
206
|
-
|
|
207
|
-
//#region extensions/onnx/src/worker-client.ts
|
|
221
|
+
// extensions/onnx/src/worker-client.ts
|
|
208
222
|
function workerEnv() {
|
|
209
223
|
const env = {};
|
|
210
224
|
for (const key of [
|
|
@@ -383,5 +397,4 @@ var InferenceWorkerClient = class {
|
|
|
383
397
|
worker.child.kill("SIGKILL");
|
|
384
398
|
}
|
|
385
399
|
};
|
|
386
|
-
//#endregion
|
|
387
400
|
export { createOnnxProvider as n, createPreparedOnnxProvider as r, InferenceWorkerClient as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"entries":[{"output":"index.js","source":"extensions/onnx/index.ts"},{"output":"src/inference.worker.js","source":"extensions/onnx/src/inference.worker.ts"}],"chunks":[{"output":".setup/artifacts-
|
|
1
|
+
{"version":3,"entries":[{"output":"index.js","source":"extensions/onnx/index.ts"},{"output":"src/inference.worker.js","source":"extensions/onnx/src/inference.worker.ts"}],"chunks":[{"output":".setup/artifacts-DgGGpngs.mjs","sha256":"f24046fd61b468a1eeca5745cb1d1492cd181ed8b29e392030b21f9e6ea92580","facadeSource":null,"sources":["extensions/onnx/src/artifacts.ts"]},{"output":".setup/catalog-g9or975s.mjs","sha256":"987b247b64a95183a5c6d128f2c81cfcc9b24cd504376bb02658f7fb2fa41522","facadeSource":null,"sources":["extensions/onnx/src/catalog.ts"]},{"output":".setup/cli-CKW-ZPXS.mjs","sha256":"064f6d7c9343c169f3e497e6bf3633d2b09bb930f6b9ae374b72ef9d9d38a369","facadeSource":"extensions/onnx/src/cli.ts","sources":["extensions/onnx/src/cli.ts"]},{"output":".setup/model-loader-DDsav9p5.mjs","sha256":"0293e51b336449ee19d792f3c2bee6837dae8d30fe2f12ad9c85d9f9cbece661","facadeSource":"extensions/onnx/src/model-loader.ts","sources":["extensions/onnx/src/model-loader.ts","extensions/onnx/src/models/tokenize.ts"]},{"output":".setup/protocol-CG1ILdRP.mjs","sha256":"bd0d6764cdfe342a66c946c7bace8ce50ec6ca4bc6bbf154f6b828b0fd892cbc","facadeSource":null,"sources":["extensions/onnx/src/models/types.ts","extensions/onnx/src/protocol.ts"]},{"output":".setup/worker-client-DU0fIUSF.mjs","sha256":"837fc8d801e310e1092cad93964d304ef34ffc030ff8af0e11031038897df9c5","facadeSource":null,"sources":["extensions/onnx/src/decision-codec.ts","extensions/onnx/src/decision-execution.ts","extensions/onnx/src/decisions.ts","extensions/onnx/src/worker-client.ts"]},{"output":"index.js","sha256":"d47cb574f4a48520dd874cb28b9e8cba78707e1940e8d0b4b09da09d25938ca4","facadeSource":"extensions/onnx/index.ts","sources":["extensions/onnx/index.ts","extensions/onnx/src/config.ts"]},{"output":"src/inference.worker.js","sha256":"c098d4e340450e9e922ddd0c636d7dddb0e46df3e270ec77c1aa0ef043b936c1","facadeSource":"extensions/onnx/src/inference.worker.ts","sources":["extensions/onnx/src/inference.worker.ts"]}],"unrenderedSources":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { n as findModel } from "./.setup/catalog-
|
|
2
|
-
import { r as createPreparedOnnxProvider, t as InferenceWorkerClient } from "./.setup/worker-client-
|
|
1
|
+
import { n as findModel } from "./.setup/catalog-g9or975s.mjs";
|
|
2
|
+
import { r as createPreparedOnnxProvider, t as InferenceWorkerClient } from "./.setup/worker-client-DU0fIUSF.mjs";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
5
5
|
import { createPluginRuntimeProcessEntrypoint, resolveRuntimeWorkerUrl } from "openclaw/plugin-sdk/process-runtime";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
8
8
|
import { Type } from "typebox";
|
|
9
|
-
|
|
9
|
+
// extensions/onnx/src/config.ts
|
|
10
10
|
const ConfigSchema = Type.Object({
|
|
11
11
|
modelDir: Type.Optional(Type.String({
|
|
12
12
|
minLength: 1,
|
|
@@ -34,8 +34,7 @@ function resolveOnnxConfig(config, resolvePath) {
|
|
|
34
34
|
maxLoadedModels
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
//#region extensions/onnx/index.ts
|
|
37
|
+
// extensions/onnx/index.ts
|
|
39
38
|
function selectedModels(config) {
|
|
40
39
|
const selectors = [config.agents?.defaults?.decisionModel, ...Object.values(config.agents?.entries ?? {}).map((agent) => agent.decisionModel)];
|
|
41
40
|
return [...new Set(selectors.flatMap((selector) => {
|
|
@@ -73,7 +72,7 @@ var onnx_default = definePluginEntry({
|
|
|
73
72
|
});
|
|
74
73
|
api.lifecycle.onDispose?.(() => client.stop());
|
|
75
74
|
api.registerCli(async (context) => {
|
|
76
|
-
const { registerOnnxCli } = await import("./.setup/cli-
|
|
75
|
+
const { registerOnnxCli } = await import("./.setup/cli-CKW-ZPXS.mjs");
|
|
77
76
|
registerOnnxCli(context, config, workerUrl, api.resolvePath);
|
|
78
77
|
}, { descriptors: [{
|
|
79
78
|
name: "onnx",
|
|
@@ -82,5 +81,4 @@ var onnx_default = definePluginEntry({
|
|
|
82
81
|
}] });
|
|
83
82
|
}
|
|
84
83
|
});
|
|
85
|
-
//#endregion
|
|
86
84
|
export { onnx_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as UnsupportedInputError, t as OnnxWorkerError } from "../.setup/protocol-
|
|
2
|
-
|
|
1
|
+
import { n as UnsupportedInputError, t as OnnxWorkerError } from "../.setup/protocol-CG1ILdRP.mjs";
|
|
2
|
+
// extensions/onnx/src/inference.worker.ts
|
|
3
3
|
let config;
|
|
4
4
|
let cache;
|
|
5
5
|
let stopping = false;
|
|
@@ -45,7 +45,7 @@ async function handle(request) {
|
|
|
45
45
|
if (!cache) {
|
|
46
46
|
let implementation;
|
|
47
47
|
try {
|
|
48
|
-
implementation = await import("../.setup/model-loader-
|
|
48
|
+
implementation = await import("../.setup/model-loader-DDsav9p5.mjs");
|
|
49
49
|
} catch {
|
|
50
50
|
throw new OnnxWorkerError("dependency-unavailable");
|
|
51
51
|
}
|
|
@@ -76,5 +76,4 @@ async function handle(request) {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
//#endregion
|
|
80
79
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/onnx",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.10-beta.1",
|
|
4
4
|
"description": "Local ONNX decision models for OpenClaw",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@huggingface/tokenizers": "0.2.0",
|
|
12
|
-
"typebox": "1.4.
|
|
12
|
+
"typebox": "1.4.3"
|
|
13
13
|
},
|
|
14
14
|
"optionalDependencies": {
|
|
15
|
-
"onnxruntime-node": "1.
|
|
15
|
+
"onnxruntime-node": "1.31.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@openclaw/plugin-sdk": "workspace:*"
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"minHostVersion": ">=2026.9.6"
|
|
29
29
|
},
|
|
30
30
|
"compat": {
|
|
31
|
-
"pluginApi": ">=2026.11.
|
|
31
|
+
"pluginApi": ">=2026.11.10-beta.1"
|
|
32
32
|
},
|
|
33
33
|
"build": {
|
|
34
34
|
"bundledDist": false,
|
|
35
|
-
"openclawVersion": "2026.11.
|
|
35
|
+
"openclawVersion": "2026.11.10-beta.1",
|
|
36
36
|
"workerEntries": [
|
|
37
37
|
"./src/inference.worker.ts"
|
|
38
38
|
],
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"assets/activity.svg"
|
|
61
61
|
],
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"openclaw": ">=2026.11.
|
|
63
|
+
"openclaw": ">=2026.11.10-beta.1"
|
|
64
64
|
},
|
|
65
65
|
"peerDependenciesMeta": {
|
|
66
66
|
"openclaw": {
|