@openclaw/onnx 2026.10.10 → 2026.10.33
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-BoNZbqnR.mjs → artifacts-CD0XZUIN.mjs} +3 -2
- package/dist/.setup/{catalog-0M53kmJq.mjs → catalog-Bgbx4LHv.mjs} +2 -1
- package/dist/.setup/{cli-Dc9p3Cjs.mjs → cli-Bs1V3EDP.mjs} +5 -4
- package/dist/.setup/{model-loader-Dkk1GRxt.mjs → model-loader-C6GHyZWy.mjs} +13 -8
- package/dist/.setup/{protocol-0QYyt_af.mjs → protocol-lN8zQ8J3.mjs} +4 -2
- package/dist/.setup/{worker-client-cQ1VR-j4.mjs → worker-client-DUApeDD4.mjs} +6 -4
- package/dist/index.js +7 -5
- package/dist/src/inference.worker.js +4 -3
- package/package.json +4 -4
- package/dist/.source-module-urls/c006b803da4ad0d774d12fd121a0790ab987a6423243e5bb28b74c5ce87a8b57.json +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as OnnxWorkerError } from "./protocol-
|
|
1
|
+
import { t as OnnxWorkerError } from "./protocol-lN8zQ8J3.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Type } from "typebox";
|
|
4
4
|
import { Value } from "typebox/value";
|
|
5
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
6
6
|
import fs from "node:fs/promises";
|
|
7
7
|
import { readFileWindowFully, root, sha256File } from "openclaw/plugin-sdk/file-access-runtime";
|
|
8
|
-
|
|
8
|
+
//#region 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,4 +152,5 @@ async function downloadModel(root$1, model, signal) {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
+
//#endregion
|
|
155
156
|
export { verifyModel as i, readModelArtifact as n, resolveModelFiles as r, downloadModel as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
//#region extensions/onnx/src/catalog.ts
|
|
2
2
|
const MODELS = [
|
|
3
3
|
{
|
|
4
4
|
id: "gliclass-edge-v3.0",
|
|
@@ -169,4 +169,5 @@ const MODELS = [
|
|
|
169
169
|
function findModel(id) {
|
|
170
170
|
return MODELS.find((model) => model.id === id);
|
|
171
171
|
}
|
|
172
|
+
//#endregion
|
|
172
173
|
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-Bgbx4LHv.mjs";
|
|
2
|
+
import { n as createOnnxProvider, t as InferenceWorkerClient } from "./worker-client-DUApeDD4.mjs";
|
|
3
|
+
import { i as verifyModel, t as downloadModel } from "./artifacts-CD0XZUIN.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
|
|
5
|
+
//#region 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,4 +91,5 @@ function registerOnnxCli({ program }, settings, workerUrl, resolvePath) {
|
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
+
//#endregion
|
|
94
95
|
export { registerOnnxCli };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as findModel } from "./catalog-
|
|
2
|
-
import { i as UnsupportedInputError, t as OnnxWorkerError } from "./protocol-
|
|
3
|
-
import { n as readModelArtifact, r as resolveModelFiles } from "./artifacts-
|
|
1
|
+
import { n as findModel } from "./catalog-Bgbx4LHv.mjs";
|
|
2
|
+
import { i as UnsupportedInputError, t as OnnxWorkerError } from "./protocol-lN8zQ8J3.mjs";
|
|
3
|
+
import { n as readModelArtifact, r as resolveModelFiles } from "./artifacts-CD0XZUIN.mjs";
|
|
4
4
|
import { Tokenizer } from "@huggingface/tokenizers";
|
|
5
5
|
import { InferenceSession, Tensor } from "onnxruntime-node";
|
|
6
|
-
|
|
6
|
+
//#region 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,7 +15,8 @@ function encodeModelText(tokenizer, text, options) {
|
|
|
15
15
|
attention_mask: encoded.attention_mask
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region extensions/onnx/src/models/deberta.ts
|
|
19
20
|
function createDebertaAdapter({ session, tokenizer, maxTokens }) {
|
|
20
21
|
return { async classify({ text, labels, instructions, descriptions }) {
|
|
21
22
|
const premise = instructions ? `${instructions}\n${text}` : text;
|
|
@@ -58,7 +59,8 @@ function createDebertaAdapter({ session, tokenizer, maxTokens }) {
|
|
|
58
59
|
};
|
|
59
60
|
} };
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region extensions/onnx/src/models/gliclass.ts
|
|
62
64
|
function createGliclassAdapter(context) {
|
|
63
65
|
const labelToken = context.tokenizer.token_to_id("<<LABEL>>");
|
|
64
66
|
const separatorToken = context.tokenizer.token_to_id("<<SEP>>");
|
|
@@ -86,7 +88,8 @@ function createGliclassAdapter(context) {
|
|
|
86
88
|
};
|
|
87
89
|
} };
|
|
88
90
|
}
|
|
89
|
-
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region extensions/onnx/src/models/gliner.ts
|
|
90
93
|
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;
|
|
91
94
|
const RESERVED = /\[(?:P|L|C|E|R|DESCRIPTION|EXAMPLE|OUTPUT|SEP_TEXT|SEP_STRUCT)\]|[()]/u;
|
|
92
95
|
function indices(values) {
|
|
@@ -156,7 +159,8 @@ function createGlinerAdapter({ session, tokenizer, maxTokens }) {
|
|
|
156
159
|
};
|
|
157
160
|
} };
|
|
158
161
|
}
|
|
159
|
-
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region extensions/onnx/src/model-loader.ts
|
|
160
164
|
function jsonObject(data) {
|
|
161
165
|
const parsed = JSON.parse(data.toString("utf8"));
|
|
162
166
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) throw new OnnxWorkerError("model-integrity");
|
|
@@ -221,4 +225,5 @@ var ModelCache = class {
|
|
|
221
225
|
}
|
|
222
226
|
}
|
|
223
227
|
};
|
|
228
|
+
//#endregion
|
|
224
229
|
export { ModelCache };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { Value } from "typebox/value";
|
|
3
|
-
|
|
3
|
+
//#region extensions/onnx/src/models/types.ts
|
|
4
4
|
var UnsupportedInputError = class extends Error {};
|
|
5
|
-
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region extensions/onnx/src/protocol.ts
|
|
6
7
|
const ModelInputSchema = Type.Object({
|
|
7
8
|
text: Type.String({ maxLength: 262144 }),
|
|
8
9
|
labels: Type.Array(Type.String({
|
|
@@ -110,4 +111,5 @@ var OnnxWorkerError = class extends Error {
|
|
|
110
111
|
this.code = code;
|
|
111
112
|
}
|
|
112
113
|
};
|
|
114
|
+
//#endregion
|
|
113
115
|
export { UnsupportedInputError as i, parseWorkerReply as n, parseWorkerRequest as r, OnnxWorkerError as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as findModel } from "./catalog-
|
|
2
|
-
import { i as UnsupportedInputError, n as parseWorkerReply, r as parseWorkerRequest, t as OnnxWorkerError } from "./protocol-
|
|
1
|
+
import { n as findModel } from "./catalog-Bgbx4LHv.mjs";
|
|
2
|
+
import { i as UnsupportedInputError, n as parseWorkerReply, r as parseWorkerRequest, t as OnnxWorkerError } from "./protocol-lN8zQ8J3.mjs";
|
|
3
3
|
import { createDeferred } from "openclaw/plugin-sdk/concurrency-runtime";
|
|
4
4
|
import { resolveRuntimeWorkerArgv, spawnOomScoreAdjusted } from "openclaw/plugin-sdk/process-runtime";
|
|
5
|
-
|
|
5
|
+
//#region extensions/onnx/src/decisions.ts
|
|
6
6
|
function render(value) {
|
|
7
7
|
return typeof value === "string" ? value : JSON.stringify(value);
|
|
8
8
|
}
|
|
@@ -122,7 +122,8 @@ function createOnnxProvider(client, warn) {
|
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region extensions/onnx/src/worker-client.ts
|
|
126
127
|
function workerEnv() {
|
|
127
128
|
const env = {};
|
|
128
129
|
for (const key of [
|
|
@@ -324,4 +325,5 @@ var InferenceWorkerClient = class {
|
|
|
324
325
|
worker.child.kill("SIGKILL");
|
|
325
326
|
}
|
|
326
327
|
};
|
|
328
|
+
//#endregion
|
|
327
329
|
export { createOnnxProvider as n, InferenceWorkerClient as t };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as findModel } from "./.setup/catalog-
|
|
2
|
-
import { n as createOnnxProvider, t as InferenceWorkerClient } from "./.setup/worker-client-
|
|
1
|
+
import { n as findModel } from "./.setup/catalog-Bgbx4LHv.mjs";
|
|
2
|
+
import { n as createOnnxProvider, t as InferenceWorkerClient } from "./.setup/worker-client-DUApeDD4.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
6
6
|
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
7
7
|
import { Type } from "typebox";
|
|
8
|
-
|
|
8
|
+
//#region extensions/onnx/src/config.ts
|
|
9
9
|
const ConfigSchema = Type.Object({
|
|
10
10
|
modelDir: Type.Optional(Type.String({
|
|
11
11
|
minLength: 1,
|
|
@@ -33,7 +33,8 @@ function resolveOnnxConfig(config, resolvePath) {
|
|
|
33
33
|
maxLoadedModels
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region extensions/onnx/index.ts
|
|
37
38
|
function selectedModels(config) {
|
|
38
39
|
const selectors = [config.agents?.defaults?.decisionModel, ...Object.values(config.agents?.entries ?? {}).map((agent) => agent.decisionModel)];
|
|
39
40
|
return [...new Set(selectors.flatMap((selector) => {
|
|
@@ -71,7 +72,7 @@ var onnx_default = definePluginEntry({
|
|
|
71
72
|
});
|
|
72
73
|
api.lifecycle?.onDispose?.(() => client.stop());
|
|
73
74
|
api.registerCli(async (context) => {
|
|
74
|
-
const { registerOnnxCli } = await import("./.setup/cli-
|
|
75
|
+
const { registerOnnxCli } = await import("./.setup/cli-Bs1V3EDP.mjs");
|
|
75
76
|
registerOnnxCli(context, config, workerUrl, api.resolvePath);
|
|
76
77
|
}, { descriptors: [{
|
|
77
78
|
name: "onnx",
|
|
@@ -80,4 +81,5 @@ var onnx_default = definePluginEntry({
|
|
|
80
81
|
}] });
|
|
81
82
|
}
|
|
82
83
|
});
|
|
84
|
+
//#endregion
|
|
83
85
|
export { onnx_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as UnsupportedInputError, r as parseWorkerRequest, t as OnnxWorkerError } from "../.setup/protocol-
|
|
2
|
-
|
|
1
|
+
import { i as UnsupportedInputError, r as parseWorkerRequest, t as OnnxWorkerError } from "../.setup/protocol-lN8zQ8J3.mjs";
|
|
2
|
+
//#region extensions/onnx/src/inference.worker.ts
|
|
3
3
|
let config;
|
|
4
4
|
let cache;
|
|
5
5
|
let stopping = false;
|
|
@@ -53,7 +53,7 @@ async function handle(value) {
|
|
|
53
53
|
if (!cache) {
|
|
54
54
|
let implementation;
|
|
55
55
|
try {
|
|
56
|
-
implementation = await import("../.setup/model-loader-
|
|
56
|
+
implementation = await import("../.setup/model-loader-C6GHyZWy.mjs");
|
|
57
57
|
} catch {
|
|
58
58
|
throw new OnnxWorkerError("dependency-unavailable");
|
|
59
59
|
}
|
|
@@ -89,4 +89,5 @@ async function handle(value) {
|
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
+
//#endregion
|
|
92
93
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/onnx",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.33",
|
|
4
4
|
"description": "Local ONNX decision models for OpenClaw",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"minHostVersion": ">=2026.9.6"
|
|
29
29
|
},
|
|
30
30
|
"compat": {
|
|
31
|
-
"pluginApi": ">=2026.
|
|
31
|
+
"pluginApi": ">=2026.11.4"
|
|
32
32
|
},
|
|
33
33
|
"build": {
|
|
34
34
|
"bundledDist": false,
|
|
35
|
-
"openclawVersion": "2026.10.
|
|
35
|
+
"openclawVersion": "2026.10.33",
|
|
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.
|
|
63
|
+
"openclaw": ">=2026.11.4"
|
|
64
64
|
},
|
|
65
65
|
"peerDependenciesMeta": {
|
|
66
66
|
"openclaw": {
|
|
@@ -1 +0,0 @@
|
|
|
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-BoNZbqnR.mjs","sha256":"f9b8500c3bd96f75f706b9c1e1fe1e09a0bd02f7311f93604b6253d08638e065","facadeSource":null,"sources":["extensions/onnx/src/artifacts.ts"]},{"output":".setup/catalog-0M53kmJq.mjs","sha256":"25917d745fa90a2541e2a42f989b4355936e5531ac5b70df365297316ca6027f","facadeSource":null,"sources":["extensions/onnx/src/catalog.ts"]},{"output":".setup/cli-Dc9p3Cjs.mjs","sha256":"5d61e386b371cba9721002bea851ebe46f50a774c625985a47029049146f60fa","facadeSource":"extensions/onnx/src/cli.ts","sources":["extensions/onnx/src/cli.ts"]},{"output":".setup/model-loader-Dkk1GRxt.mjs","sha256":"53927e49867f12d6a4c144721c68106e4787c1a02454b277b1efd583d87e44e2","facadeSource":"extensions/onnx/src/model-loader.ts","sources":["extensions/onnx/src/model-loader.ts","extensions/onnx/src/models/deberta.ts","extensions/onnx/src/models/gliclass.ts","extensions/onnx/src/models/gliner.ts","extensions/onnx/src/models/tokenize.ts"]},{"output":".setup/protocol-0QYyt_af.mjs","sha256":"845f1eaf37b8243e54b1433a94a84afe6c9a9e73d4d4bd4dfe0cd6012bd5e897","facadeSource":null,"sources":["extensions/onnx/src/models/types.ts","extensions/onnx/src/protocol.ts"]},{"output":".setup/worker-client-cQ1VR-j4.mjs","sha256":"224d5a0653eadb4d55c498acbcbff87dabbcefa88026a57aece80eed31318749","facadeSource":null,"sources":["extensions/onnx/src/decisions.ts","extensions/onnx/src/worker-client.ts"]},{"output":"index.js","sha256":"ad177f1ba6aa0eee84b254e905ed4a2273e082391aadd53579435841c10659b2","facadeSource":"extensions/onnx/index.ts","sources":["extensions/onnx/index.ts","extensions/onnx/src/config.ts"]},{"output":"src/inference.worker.js","sha256":"efea4edae30e3dddfe13cd1150427046932a5fcd1cf1f733ca70c11438ea4d6f","facadeSource":"extensions/onnx/src/inference.worker.ts","sources":["extensions/onnx/src/inference.worker.ts"]}],"unrenderedSources":[]}
|