@openclaw/onnx 2026.10.10 → 2026.11.5-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/README.md +5 -4
- package/dist/.setup/{artifacts-BoNZbqnR.mjs → artifacts-DgGGpngs.mjs} +2 -2
- package/dist/.setup/catalog-g9or975s.mjs +46 -0
- package/dist/.setup/{cli-Dc9p3Cjs.mjs → cli-wozJmsLz.mjs} +3 -3
- package/dist/.setup/model-loader-DDsav9p5.mjs +212 -0
- package/dist/.setup/protocol-CG1ILdRP.mjs +10 -0
- package/dist/.setup/{worker-client-cQ1VR-j4.mjs → worker-client-C6PMT6Zd.mjs} +120 -62
- package/dist/.source-module-urls/c006b803da4ad0d774d12fd121a0790ab987a6423243e5bb28b74c5ce87a8b57.json +1 -1
- package/dist/index.js +9 -8
- package/dist/scripts/export-gliclass-instruct.py +4 -24
- package/dist/src/inference.worker.js +8 -21
- package/openclaw.plugin.json +14 -0
- package/package.json +5 -5
- package/dist/.setup/catalog-0M53kmJq.mjs +0 -172
- package/dist/.setup/model-loader-Dkk1GRxt.mjs +0 -224
- package/dist/.setup/protocol-0QYyt_af.mjs +0 -113
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { Type } from "typebox";
|
|
2
|
-
import { Value } from "typebox/value";
|
|
3
|
-
// extensions/onnx/src/models/types.ts
|
|
4
|
-
var UnsupportedInputError = class extends Error {};
|
|
5
|
-
// extensions/onnx/src/protocol.ts
|
|
6
|
-
const ModelInputSchema = Type.Object({
|
|
7
|
-
text: Type.String({ maxLength: 262144 }),
|
|
8
|
-
labels: Type.Array(Type.String({
|
|
9
|
-
minLength: 1,
|
|
10
|
-
maxLength: 16384
|
|
11
|
-
}), {
|
|
12
|
-
minItems: 2,
|
|
13
|
-
maxItems: 64
|
|
14
|
-
}),
|
|
15
|
-
task: Type.String({
|
|
16
|
-
minLength: 1,
|
|
17
|
-
maxLength: 1024
|
|
18
|
-
}),
|
|
19
|
-
instructions: Type.Optional(Type.String({ maxLength: 16384 })),
|
|
20
|
-
descriptions: Type.Optional(Type.Record(Type.String(), Type.String({ maxLength: 16384 })))
|
|
21
|
-
}, { additionalProperties: false });
|
|
22
|
-
const ConfigSchema = Type.Object({
|
|
23
|
-
modelDir: Type.String({
|
|
24
|
-
minLength: 1,
|
|
25
|
-
maxLength: 4096
|
|
26
|
-
}),
|
|
27
|
-
threads: Type.Integer({
|
|
28
|
-
minimum: 1,
|
|
29
|
-
maximum: 8
|
|
30
|
-
}),
|
|
31
|
-
maxLoadedModels: Type.Integer({
|
|
32
|
-
minimum: 1,
|
|
33
|
-
maximum: 5
|
|
34
|
-
})
|
|
35
|
-
}, { additionalProperties: false });
|
|
36
|
-
const RequestSchema = Type.Union([
|
|
37
|
-
Type.Object({
|
|
38
|
-
kind: Type.Literal("init"),
|
|
39
|
-
config: ConfigSchema
|
|
40
|
-
}, { additionalProperties: false }),
|
|
41
|
-
Type.Object({
|
|
42
|
-
kind: Type.Literal("classify"),
|
|
43
|
-
id: Type.Integer({ minimum: 1 }),
|
|
44
|
-
model: Type.String({
|
|
45
|
-
minLength: 1,
|
|
46
|
-
maxLength: 128
|
|
47
|
-
}),
|
|
48
|
-
inputs: Type.Array(ModelInputSchema, {
|
|
49
|
-
minItems: 1,
|
|
50
|
-
maxItems: 32
|
|
51
|
-
})
|
|
52
|
-
}, { additionalProperties: false }),
|
|
53
|
-
Type.Object({
|
|
54
|
-
kind: Type.Literal("warm"),
|
|
55
|
-
id: Type.Integer({ minimum: 1 }),
|
|
56
|
-
models: Type.Array(Type.String({
|
|
57
|
-
minLength: 1,
|
|
58
|
-
maxLength: 128
|
|
59
|
-
}), { maxItems: 5 })
|
|
60
|
-
}, { additionalProperties: false })
|
|
61
|
-
]);
|
|
62
|
-
const ErrorCodeSchema = Type.Union([
|
|
63
|
-
Type.Literal("unsupported-input"),
|
|
64
|
-
Type.Literal("model-missing"),
|
|
65
|
-
Type.Literal("model-integrity"),
|
|
66
|
-
Type.Literal("dependency-unavailable"),
|
|
67
|
-
Type.Literal("runtime")
|
|
68
|
-
]);
|
|
69
|
-
const ReplySchema = Type.Union([
|
|
70
|
-
Type.Object({ kind: Type.Literal("ready") }, { additionalProperties: false }),
|
|
71
|
-
Type.Object({
|
|
72
|
-
kind: Type.Literal("results"),
|
|
73
|
-
id: Type.Integer({ minimum: 1 }),
|
|
74
|
-
results: Type.Array(Type.Object({
|
|
75
|
-
logits: Type.Array(Type.Number(), {
|
|
76
|
-
minItems: 2,
|
|
77
|
-
maxItems: 64
|
|
78
|
-
}),
|
|
79
|
-
inputTokens: Type.Integer({ minimum: 1 })
|
|
80
|
-
}, { additionalProperties: false }), { maxItems: 32 })
|
|
81
|
-
}, { additionalProperties: false }),
|
|
82
|
-
Type.Object({
|
|
83
|
-
kind: Type.Literal("warmed"),
|
|
84
|
-
id: Type.Integer({ minimum: 1 })
|
|
85
|
-
}, { additionalProperties: false }),
|
|
86
|
-
Type.Object({
|
|
87
|
-
kind: Type.Literal("error"),
|
|
88
|
-
id: Type.Integer({ minimum: 1 }),
|
|
89
|
-
code: ErrorCodeSchema
|
|
90
|
-
}, { additionalProperties: false })
|
|
91
|
-
]);
|
|
92
|
-
function parseWorkerRequest(value) {
|
|
93
|
-
if (!Value.Check(RequestSchema, value)) throw new Error("Invalid ONNX worker request");
|
|
94
|
-
if (value.kind === "classify") {
|
|
95
|
-
let bytes = 0;
|
|
96
|
-
for (const input of value.inputs) {
|
|
97
|
-
bytes += Buffer.byteLength(JSON.stringify(input));
|
|
98
|
-
if (bytes > 1048576) throw new Error("ONNX inputs exceed one MiB");
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return value;
|
|
102
|
-
}
|
|
103
|
-
function parseWorkerReply(value) {
|
|
104
|
-
if (!Value.Check(ReplySchema, value)) throw new Error("Invalid ONNX worker reply");
|
|
105
|
-
return value;
|
|
106
|
-
}
|
|
107
|
-
var OnnxWorkerError = class extends Error {
|
|
108
|
-
constructor(code) {
|
|
109
|
-
super(`ONNX worker: ${code}`);
|
|
110
|
-
this.code = code;
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
export { UnsupportedInputError as i, parseWorkerReply as n, parseWorkerRequest as r, OnnxWorkerError as t };
|