laya-system-one 1.1.0-alpha.1 → 1.2.0

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.
@@ -10,91 +10,91 @@
10
10
  {
11
11
  "index": 0,
12
12
  "package": "@sys-one/laya-model-chunk-00",
13
- "version": "1.1.0-alpha.1",
13
+ "version": "1.1.0",
14
14
  "bytes": 25165824,
15
15
  "sha256": "ef5fb331bbc913691ddb94c65efd4139bbad581870f00ceec697e27a1a277d68"
16
16
  },
17
17
  {
18
18
  "index": 1,
19
19
  "package": "@sys-one/laya-model-chunk-01",
20
- "version": "1.1.0-alpha.1",
20
+ "version": "1.1.0",
21
21
  "bytes": 25165824,
22
22
  "sha256": "197cf82966fa114b1c5480d67dfb0c69e2a29b26d9cdd260a15d34ed7e94bc3d"
23
23
  },
24
24
  {
25
25
  "index": 2,
26
26
  "package": "@sys-one/laya-model-chunk-02",
27
- "version": "1.1.0-alpha.1",
27
+ "version": "1.1.0",
28
28
  "bytes": 25165824,
29
29
  "sha256": "a72e60a93dfa4e93eedc45eb0bfc0c0ab48010db35d93acd613c2312e59c35e1"
30
30
  },
31
31
  {
32
32
  "index": 3,
33
33
  "package": "@sys-one/laya-model-chunk-03",
34
- "version": "1.1.0-alpha.1",
34
+ "version": "1.1.0",
35
35
  "bytes": 25165824,
36
36
  "sha256": "7db3119f56cc6a4874b0c300effc06ae0f2e4587486d4c6673d74375157426b6"
37
37
  },
38
38
  {
39
39
  "index": 4,
40
40
  "package": "@sys-one/laya-model-chunk-04",
41
- "version": "1.1.0-alpha.1",
41
+ "version": "1.1.0",
42
42
  "bytes": 25165824,
43
43
  "sha256": "b3c66e9ae3210f4a6b0e89e235e880b9eea6636afe33c90e21b07c4260dfea91"
44
44
  },
45
45
  {
46
46
  "index": 5,
47
47
  "package": "@sys-one/laya-model-chunk-05",
48
- "version": "1.1.0-alpha.1",
48
+ "version": "1.1.0",
49
49
  "bytes": 25165824,
50
50
  "sha256": "eb659ce78d4deb34107eff20b86339d77f5fd4e2ae3ccad625775528cd376b6c"
51
51
  },
52
52
  {
53
53
  "index": 6,
54
54
  "package": "@sys-one/laya-model-chunk-06",
55
- "version": "1.1.0-alpha.1",
55
+ "version": "1.1.0",
56
56
  "bytes": 25165824,
57
57
  "sha256": "9ac3fd26e588debb86e2368093e58272b9a318515b9eaebf07da8d1429dc5b62"
58
58
  },
59
59
  {
60
60
  "index": 7,
61
61
  "package": "@sys-one/laya-model-chunk-07",
62
- "version": "1.1.0-alpha.1",
62
+ "version": "1.1.0",
63
63
  "bytes": 25165824,
64
64
  "sha256": "40c158c978ba8285a69b41282308f108d24390734660935be69c6b58ea186b6a"
65
65
  },
66
66
  {
67
67
  "index": 8,
68
68
  "package": "@sys-one/laya-model-chunk-08",
69
- "version": "1.1.0-alpha.1",
69
+ "version": "1.1.0",
70
70
  "bytes": 25165824,
71
71
  "sha256": "d8ce88b2cc1c2f0bcb6f50414fb56741a21d3d2221db19c9fff8879f5e58668e"
72
72
  },
73
73
  {
74
74
  "index": 9,
75
75
  "package": "@sys-one/laya-model-chunk-09",
76
- "version": "1.1.0-alpha.1",
76
+ "version": "1.1.0",
77
77
  "bytes": 25165824,
78
78
  "sha256": "a83210739f94a9ffbf99c32aedd6e8ac68bcbe8be42d57485fff9534e2d8011b"
79
79
  },
80
80
  {
81
81
  "index": 10,
82
82
  "package": "@sys-one/laya-model-chunk-10",
83
- "version": "1.1.0-alpha.1",
83
+ "version": "1.1.0",
84
84
  "bytes": 25165824,
85
85
  "sha256": "c06ed434512a4a8d610d27f52a91bdfff46001eab2b586f11d65c506140753f0"
86
86
  },
87
87
  {
88
88
  "index": 11,
89
89
  "package": "@sys-one/laya-model-chunk-11",
90
- "version": "1.1.0-alpha.1",
90
+ "version": "1.1.0",
91
91
  "bytes": 25165824,
92
92
  "sha256": "44a0a9ad824ab26b8a1c5edb2d71c7283341e4bee5e1bfa4de2a4a9a813e9081"
93
93
  },
94
94
  {
95
95
  "index": 12,
96
96
  "package": "@sys-one/laya-model-chunk-12",
97
- "version": "1.1.0-alpha.1",
97
+ "version": "1.1.0",
98
98
  "bytes": 22135720,
99
99
  "sha256": "35e2c872c113e76456e6790f08c9714f2b83f8a049a550814efd5355640df5ce"
100
100
  }
@@ -103,5 +103,6 @@
103
103
  "npm": "https://registry.npmjs.org",
104
104
  "github": "https://github.com/italoalmeida0/laya-system-one/releases/download/v1.1.0/model.onnx",
105
105
  "githubLegacy": "https://github.com/italoalmeida0/laya-system-one/releases/download/v1.0.0/model.onnx"
106
- }
106
+ },
107
+ "modelVersion": "1.1.0"
107
108
  }
@@ -1,26 +1,26 @@
1
- {
2
- "encoder": "jhu-clsp/mmBERT-base",
3
- "head_layers": 2,
4
- "max_len": 1024,
5
- "head_max_len": 256,
6
- "max_prefixes": 6,
7
- "act_costs": {
8
- "escalate": 0.5
9
- },
10
- "cost_wrong_act": 3.0,
11
- "amp_dtype": "bf16",
12
- "model_name": "rl-agent",
13
- "temperature": [
14
- 1.0,
15
- 1.0,
16
- 1.0
17
- ],
18
- "temperature_by_options": {},
19
- "training": {
20
- "updates": 15987,
21
- "epochs_completed": 4,
22
- "hours": 4.97,
23
- "world_size": 1,
24
- "fine_tuned_from_checkpoint": false
25
- }
26
- }
1
+ {
2
+ "encoder": "jhu-clsp/mmBERT-base",
3
+ "head_layers": 2,
4
+ "max_len": 2048,
5
+ "head_max_len": 256,
6
+ "max_prefixes": 6,
7
+ "act_costs": {
8
+ "escalate": 0.5
9
+ },
10
+ "cost_wrong_act": 3,
11
+ "amp_dtype": "bf16",
12
+ "model_name": "rl-agent",
13
+ "temperature": [
14
+ 1,
15
+ 1,
16
+ 1
17
+ ],
18
+ "temperature_by_options": {},
19
+ "training": {
20
+ "updates": 15987,
21
+ "epochs_completed": 4,
22
+ "hours": 4.97,
23
+ "world_size": 1,
24
+ "fine_tuned_from_checkpoint": false
25
+ }
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "laya-system-one",
3
- "version": "1.1.0-alpha.1",
3
+ "version": "1.2.0",
4
4
  "description": "Self-contained System 1 decision engine: multilingual INT8 transformer served by a zero-dependency native binary (or the bundled pure-Rust WASM engine). TypeSafe Jev wire-compatible (/v1/systemone). Runs offline in Node.js, Bun and browsers.",
5
5
  "main": "./src/index.js",
6
6
  "module": "./src/index.js",
@@ -32,7 +32,7 @@
32
32
  "test:all": "npm run lint && npm run test:unit && npm run test:packaging && npm run test:integration && npm run test:e2e",
33
33
  "lint": "node ./tools/lint.js",
34
34
  "bundle": "node ./tools/make-bundle.js",
35
- "model:chunks": "node ./tools/model-chunks.js build --chunk-mb 24 --model-version $npm_package_version",
35
+ "model:chunks": "node ./tools/model-chunks.js build --chunk-mb 24",
36
36
  "model:assemble": "node ./tools/model-chunks.js assemble",
37
37
  "model:verify": "node ./tools/model-chunks.js verify",
38
38
  "model:publish": "node ./tools/model-chunks.js publish",
@@ -51,7 +51,9 @@
51
51
  "check": "node ./tools/local-check.js",
52
52
  "check:quick": "node ./tools/local-check.js --quick",
53
53
  "quick:check": "node ./tools/quick-check.js",
54
- "preflight": "node ./tools/preflight-publish.js"
54
+ "preflight": "node ./tools/preflight-publish.js",
55
+ "model:export": "python ./tools/export-model.py",
56
+ "model:diff": "node ./tools/model-diff.js"
55
57
  },
56
58
  "repository": {
57
59
  "type": "git",
@@ -79,25 +81,25 @@
79
81
  "homepage": "https://github.com/italoalmeida0/laya-system-one#readme",
80
82
  "dependencies": {},
81
83
  "optionalDependencies": {
82
- "@sys-one/laya-serve-darwin-arm64": "1.1.0-alpha.1",
83
- "@sys-one/laya-serve-darwin-x64": "1.1.0-alpha.1",
84
- "@sys-one/laya-serve-win32-x64": "1.1.0-alpha.1",
85
- "@sys-one/laya-serve-win32-arm64": "1.1.0-alpha.1",
86
- "@sys-one/laya-serve-linux-x64": "1.1.0-alpha.1",
87
- "@sys-one/laya-serve-linux-arm64": "1.1.0-alpha.1",
88
- "@sys-one/laya-serve-universal": "1.1.0-alpha.1",
89
- "@sys-one/laya-model-chunk-00": "1.1.0-alpha.1",
90
- "@sys-one/laya-model-chunk-01": "1.1.0-alpha.1",
91
- "@sys-one/laya-model-chunk-02": "1.1.0-alpha.1",
92
- "@sys-one/laya-model-chunk-03": "1.1.0-alpha.1",
93
- "@sys-one/laya-model-chunk-04": "1.1.0-alpha.1",
94
- "@sys-one/laya-model-chunk-05": "1.1.0-alpha.1",
95
- "@sys-one/laya-model-chunk-06": "1.1.0-alpha.1",
96
- "@sys-one/laya-model-chunk-07": "1.1.0-alpha.1",
97
- "@sys-one/laya-model-chunk-08": "1.1.0-alpha.1",
98
- "@sys-one/laya-model-chunk-09": "1.1.0-alpha.1",
99
- "@sys-one/laya-model-chunk-10": "1.1.0-alpha.1",
100
- "@sys-one/laya-model-chunk-11": "1.1.0-alpha.1",
101
- "@sys-one/laya-model-chunk-12": "1.1.0-alpha.1"
84
+ "@sys-one/laya-serve-darwin-arm64": "1.2.0",
85
+ "@sys-one/laya-serve-darwin-x64": "1.2.0",
86
+ "@sys-one/laya-serve-win32-x64": "1.2.0",
87
+ "@sys-one/laya-serve-win32-arm64": "1.2.0",
88
+ "@sys-one/laya-serve-linux-x64": "1.2.0",
89
+ "@sys-one/laya-serve-linux-arm64": "1.2.0",
90
+ "@sys-one/laya-serve-universal": "1.2.0",
91
+ "@sys-one/laya-model-chunk-00": "1.1.0",
92
+ "@sys-one/laya-model-chunk-01": "1.1.0",
93
+ "@sys-one/laya-model-chunk-02": "1.1.0",
94
+ "@sys-one/laya-model-chunk-03": "1.1.0",
95
+ "@sys-one/laya-model-chunk-04": "1.1.0",
96
+ "@sys-one/laya-model-chunk-05": "1.1.0",
97
+ "@sys-one/laya-model-chunk-06": "1.1.0",
98
+ "@sys-one/laya-model-chunk-07": "1.1.0",
99
+ "@sys-one/laya-model-chunk-08": "1.1.0",
100
+ "@sys-one/laya-model-chunk-09": "1.1.0",
101
+ "@sys-one/laya-model-chunk-10": "1.1.0",
102
+ "@sys-one/laya-model-chunk-11": "1.1.0",
103
+ "@sys-one/laya-model-chunk-12": "1.1.0"
102
104
  }
103
105
  }
package/src/agent.js CHANGED
@@ -165,6 +165,7 @@ export class Laya {
165
165
  port: options.port,
166
166
  apiKey: options.apiKey,
167
167
  threads: options.threads,
168
+ maxLen: options.maxLen,
168
169
  });
169
170
  await srv.start();
170
171
  return new LayaNative(srv, options);
@@ -307,6 +308,7 @@ export class LayaNative {
307
308
  port: options.port,
308
309
  apiKey: options.apiKey,
309
310
  threads: options.threads,
311
+ maxLen: options.maxLen,
310
312
  });
311
313
  await srv.start();
312
314
  return new LayaNative(srv, options);
@@ -136,6 +136,28 @@ function binaryCandidates() {
136
136
  return { exe, slots };
137
137
  }
138
138
 
139
+ /**
140
+ * The argument list for the native server. Pure, so the precedence between an
141
+ * explicit option, LAYA_MAX_LEN and the config file can be tested without
142
+ * spawning anything - a dropped option here silently leaves long inputs
143
+ * truncated with no error anywhere.
144
+ */
145
+ export function buildServerArgs({ modelDir, host, port, threads, apiKey, maxLen } = {}) {
146
+ const args = [
147
+ '--model-dir', modelDir,
148
+ '--host', host,
149
+ '--port', String(port),
150
+ '--threads', String(threads),
151
+ ];
152
+ // Token budget: an explicit option wins, then LAYA_MAX_LEN, then whatever
153
+ // the config file says (the binary applies that last fallback itself, so we
154
+ // only pass a value when the caller asked for one).
155
+ const budget = maxLen ?? (process.env.LAYA_MAX_LEN ? Number(process.env.LAYA_MAX_LEN) : null);
156
+ if (Number.isFinite(budget) && budget > 0) args.push('--max-len', String(budget));
157
+ if (apiKey) args.push('--api-key', apiKey);
158
+ return args;
159
+ }
160
+
139
161
  /**
140
162
  * Make sure a resolved binary is executable, and return it.
141
163
  *
@@ -209,6 +231,7 @@ export class NativeServer {
209
231
  this.port = options.port ?? 0;
210
232
  this.apiKey = options.apiKey || null;
211
233
  this.threads = options.threads ?? 0;
234
+ this.maxLen = options.maxLen ?? null;
212
235
  this.proc = null;
213
236
  this.url = null;
214
237
  }
@@ -232,12 +255,14 @@ export class NativeServer {
232
255
  ? bundledLib + ':' + spawnEnv.LD_LIBRARY_PATH
233
256
  : bundledLib;
234
257
  }
235
- const args = [
236
- '--model-dir', modelDir,
237
- '--host', this.host,
238
- '--port', String(this.port),
239
- '--threads', String(this.threads),
240
- ];
258
+ const args = buildServerArgs({
259
+ modelDir,
260
+ host: this.host,
261
+ port: this.port,
262
+ threads: this.threads,
263
+ apiKey: this.apiKey,
264
+ maxLen: this.maxLen
265
+ });
241
266
  if (this.apiKey) args.push('--api-key', this.apiKey);
242
267
  return new Promise((resolve, reject) => {
243
268
  const proc = spawn(bin, args, {