@tellegen/engine 0.2.0 → 0.4.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.
Files changed (60) hide show
  1. package/README.md +71 -20
  2. package/dist/data/populated_places.json +1 -0
  3. package/dist/generated/{contracts.d.ts → api-types.d.ts} +26 -18
  4. package/dist/generated/api-types.d.ts.map +1 -0
  5. package/dist/generated/api-types.js +8 -0
  6. package/dist/generated/api-types.js.map +1 -0
  7. package/dist/generated/study-schema.d.ts +2 -0
  8. package/dist/generated/study-schema.d.ts.map +1 -0
  9. package/dist/generated/study-schema.js +3 -0
  10. package/dist/generated/study-schema.js.map +1 -0
  11. package/dist/generated/study-types.d.ts +426 -0
  12. package/dist/generated/study-types.d.ts.map +1 -0
  13. package/dist/generated/study-types.js +4 -0
  14. package/dist/generated/study-types.js.map +1 -0
  15. package/dist/generated/synth-schema.d.ts +2 -0
  16. package/dist/generated/synth-schema.d.ts.map +1 -0
  17. package/dist/generated/synth-schema.js +3 -0
  18. package/dist/generated/synth-schema.js.map +1 -0
  19. package/dist/generated/synth-types.d.ts +482 -0
  20. package/dist/generated/synth-types.d.ts.map +1 -0
  21. package/dist/generated/synth-types.js +4 -0
  22. package/dist/generated/synth-types.js.map +1 -0
  23. package/dist/host.d.ts +35 -2
  24. package/dist/host.d.ts.map +1 -1
  25. package/dist/host.js +103 -17
  26. package/dist/host.js.map +1 -1
  27. package/dist/index.d.ts +549 -122
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +780 -109
  30. package/dist/index.js.map +1 -1
  31. package/dist/input-limit.d.ts +1 -1
  32. package/dist/input-limit.js +1 -1
  33. package/dist/module.d.ts +2 -0
  34. package/dist/module.d.ts.map +1 -1
  35. package/dist/module.js.map +1 -1
  36. package/dist/protocol.d.ts +182 -31
  37. package/dist/protocol.d.ts.map +1 -1
  38. package/dist/protocol.js +153 -26
  39. package/dist/protocol.js.map +1 -1
  40. package/dist/study-document.d.ts +46 -0
  41. package/dist/study-document.d.ts.map +1 -0
  42. package/dist/study-document.js +183 -0
  43. package/dist/study-document.js.map +1 -0
  44. package/dist/study-document.test.d.ts +2 -0
  45. package/dist/study-document.test.d.ts.map +1 -0
  46. package/dist/study-document.test.js +119 -0
  47. package/dist/study-document.test.js.map +1 -0
  48. package/dist/wasm-pkg/LICENSE +17 -4
  49. package/dist/wasm-pkg/tellegen.d.ts +332 -85
  50. package/dist/wasm-pkg/tellegen.js +1324 -250
  51. package/dist/wasm-pkg/tellegen_bg.wasm +0 -0
  52. package/dist/wasm-pkg/tellegen_bg.wasm.d.ts +57 -9
  53. package/dist/worker.js +20 -5
  54. package/dist/worker.js.map +1 -1
  55. package/package.json +32 -11
  56. package/dist/generated/contracts.d.ts.map +0 -1
  57. package/dist/generated/contracts.js +0 -8
  58. package/dist/generated/contracts.js.map +0 -1
  59. package/dist/wasm-pkg/LICENSE-APACHE +0 -201
  60. package/dist/wasm-pkg/LICENSE-MIT +0 -19
package/dist/host.d.ts CHANGED
@@ -4,10 +4,43 @@
4
4
  * calling thread; it serves environments without workers (SSR, Node) and is
5
5
  * the replay target when the worker errors before its first response — the
6
6
  * failure mode of a browser that cannot run module workers. */
7
- import { type EngineRequest } from "./protocol.js";
7
+ import { type EngineRequest, type EngineValue } from "./protocol.js";
8
+ /** An engine answer with the time the executing thread spent producing it.
9
+ * `engineMs` is null when the host cannot separate it from transfer time. */
10
+ export interface TimedEngineValue {
11
+ value: EngineValue;
12
+ engineMs: number | null;
13
+ }
8
14
  export interface EngineHost {
9
- call(req: EngineRequest): Promise<string | null>;
15
+ /** Where requests execute: a dedicated worker, or the calling thread. A
16
+ * worker host that had to fall back to the calling thread reports
17
+ * `"direct"` from then on, so a caller can say the page may pause. */
18
+ readonly kind: "worker" | "direct";
19
+ call(req: EngineRequest): Promise<EngineValue>;
20
+ /** `call`, also reporting engine-side time for latency breakdowns. */
21
+ callTimed?(req: EngineRequest): Promise<TimedEngineValue>;
22
+ /** Finish the current exact trial, then preserve a cancelled planning record. */
23
+ requestStop?(): void;
24
+ /** Stop this host's current work. Returns false for the direct host, whose
25
+ * synchronous wasm call cannot be interrupted. Callers still check the
26
+ * signal after that call and discard an aborted result before publishing
27
+ * state. */
28
+ cancel?(reason: Error): boolean;
10
29
  }
30
+ /** Run a request and report engine time, on any host. */
31
+ export declare function callTimed(host: EngineHost, req: EngineRequest): Promise<TimedEngineValue>;
11
32
  export declare const directHost: EngineHost;
12
33
  export declare function engineHost(): EngineHost;
34
+ /** A separate worker host for interruptible long running work. Terminating it
35
+ * does not invalidate the interactive studies held by the shared host. A
36
+ * runtime without Worker falls back to synchronous wasm: cancellation then
37
+ * takes effect after the call returns, before the caller publishes its result. */
38
+ export declare function isolatedEngineHost(): EngineHost;
39
+ /** The long-lived host for synthetic grid generation: a third worker, so
40
+ * cancelling a generation (which terminates it) never touches the studies of
41
+ * the interactive host, and the places table loads once per worker rather
42
+ * than once per run. Created on first use, dropped by `cancel` or a crash,
43
+ * and created again for the next session. Without Worker support it runs on
44
+ * the calling thread, where a stop takes effect between stages. */
45
+ export declare function synthEngineHost(): EngineHost;
13
46
  //# sourceMappingURL=host.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;+DAK+D;AAG/D,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAClD;AAID,eAAO,MAAM,UAAU,EAAE,UAIxB,CAAC;AA+EF,wBAAgB,UAAU,IAAI,UAAU,CAGvC"}
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;+DAK+D;AAG/D,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,WAAW,EAGjB,MAAM,eAAe,CAAC;AAEvB;6EAC6E;AAC7E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB;;0EAEsE;IACtE,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACnC,IAAI,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC/C,sEAAsE;IACtE,SAAS,CAAC,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC1D,iFAAiF;IACjF,WAAW,CAAC,IAAI,IAAI,CAAC;IACrB;;;gBAGY;IACZ,MAAM,CAAC,CAAC,MAAM,EAAE,KAAK,GAAG,OAAO,CAAC;CACjC;AAID,yDAAyD;AACzD,wBAAsB,SAAS,CAC7B,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,aAAa,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAG3B;AAaD,eAAO,MAAM,UAAU,EAAE,UAWxB,CAAC;AAyHF,wBAAgB,UAAU,IAAI,UAAU,CAGvC;AAED;;;kFAGkF;AAClF,wBAAgB,kBAAkB,IAAI,UAAU,CAG/C;AAID;;;;;mEAKmE;AACnE,wBAAgB,eAAe,IAAI,UAAU,CAK5C"}
package/dist/host.js CHANGED
@@ -5,14 +5,35 @@
5
5
  * the replay target when the worker errors before its first response — the
6
6
  * failure mode of a browser that cannot run module workers. */
7
7
  import { engineModule } from "./module.js";
8
- import { runRequest, } from "./protocol.js";
9
- const directStudies = new Map();
8
+ import { emptyHandles, runRequest, } from "./protocol.js";
9
+ const directHandles = emptyHandles();
10
+ /** Run a request and report engine time, on any host. */
11
+ export async function callTimed(host, req) {
12
+ if (host.callTimed)
13
+ return host.callTimed(req);
14
+ return { value: await host.call(req), engineMs: null };
15
+ }
16
+ async function runTimed(handles, req, cancelled) {
17
+ const mod = await engineModule();
18
+ const started = performance.now();
19
+ const value = await runRequest(mod, handles, req, cancelled);
20
+ return { value, engineMs: performance.now() - started };
21
+ }
10
22
  export const directHost = {
23
+ kind: "direct",
11
24
  async call(req) {
12
- return runRequest(await engineModule(), directStudies, req);
25
+ return runRequest(await engineModule(), directHandles, req);
26
+ },
27
+ callTimed(req) {
28
+ return runTimed(directHandles, req);
29
+ },
30
+ cancel() {
31
+ return false;
13
32
  },
14
33
  };
15
34
  class WorkerHost {
35
+ fallback;
36
+ retire;
16
37
  #worker;
17
38
  #seq = 0;
18
39
  #pending = new Map();
@@ -21,7 +42,9 @@ class WorkerHost {
21
42
  * answered (requests reroute there), without one when it crashed mid
22
43
  * session (requests reject; the next engineHost() spawns a fresh worker). */
23
44
  #failed = null;
24
- constructor(worker) {
45
+ constructor(worker, fallback = directHost, retire = retireShared) {
46
+ this.fallback = fallback;
47
+ this.retire = retire;
25
48
  this.#worker = worker;
26
49
  worker.onmessage = (ev) => {
27
50
  this.#answered = true;
@@ -29,7 +52,10 @@ class WorkerHost {
29
52
  if (pending) {
30
53
  this.#pending.delete(ev.data.id);
31
54
  if (ev.data.ok)
32
- pending.resolve(ev.data.value);
55
+ pending.resolve({
56
+ value: ev.data.value,
57
+ engineMs: ev.data.worker_ms ?? null,
58
+ });
33
59
  else
34
60
  pending.reject(new Error(ev.data.error));
35
61
  }
@@ -43,6 +69,9 @@ class WorkerHost {
43
69
  worker.onerror = () => this.#fail(new Error("engine worker failed"));
44
70
  worker.onmessageerror = () => this.#fail(new Error("engine worker message failed"));
45
71
  }
72
+ get kind() {
73
+ return this.#failed?.forward?.kind ?? "worker";
74
+ }
46
75
  #fail(error) {
47
76
  if (this.#failed)
48
77
  return;
@@ -53,26 +82,27 @@ class WorkerHost {
53
82
  // The worker never started (module workers unsupported, script blocked):
54
83
  // everything moves to the main thread, including the pending requests —
55
84
  // their study handles stay valid because the caller allocated them.
56
- this.#failed = { forward: directHost, error };
57
- if (activeHost === this)
58
- activeHost = directHost;
85
+ this.#failed = { forward: this.fallback, error };
86
+ this.retire(this, this.fallback);
59
87
  for (const p of pending)
60
- directHost.call(p.req).then(p.resolve, p.reject);
88
+ callTimed(this.fallback, p.req).then(p.resolve, p.reject);
61
89
  return;
62
90
  }
63
91
  // A crash mid session loses the worker's studies; callers see their next
64
92
  // call fail, drop the study handle, and rebuild against a fresh worker.
65
93
  this.#failed = { forward: null, error };
66
- if (activeHost === this)
67
- activeHost = null;
94
+ this.retire(this, null);
68
95
  for (const p of pending)
69
96
  p.reject(error);
70
97
  }
71
- call(req) {
98
+ async call(req) {
99
+ return (await this.callTimed(req)).value;
100
+ }
101
+ callTimed(req) {
72
102
  const failed = this.#failed;
73
103
  if (failed) {
74
104
  return failed.forward
75
- ? failed.forward.call(req)
105
+ ? callTimed(failed.forward, req)
76
106
  : Promise.reject(failed.error);
77
107
  }
78
108
  return new Promise((resolve, reject) => {
@@ -82,20 +112,76 @@ class WorkerHost {
82
112
  this.#worker.postMessage(msg);
83
113
  });
84
114
  }
115
+ requestStop() {
116
+ for (const [id, pending] of this.#pending) {
117
+ if (pending.req.op === "study_document_run")
118
+ this.#worker.postMessage({ op: "cancel_study_operation", id });
119
+ }
120
+ this.#failed?.forward?.requestStop?.();
121
+ }
122
+ cancel(reason) {
123
+ if (this.#failed)
124
+ return false;
125
+ const pending = [...this.#pending.values()];
126
+ this.#pending.clear();
127
+ this.#worker.terminate();
128
+ this.#failed = { forward: null, error: reason };
129
+ this.retire(this, null);
130
+ for (const call of pending)
131
+ call.reject(reason);
132
+ return true;
133
+ }
85
134
  }
86
135
  let activeHost = null;
136
+ function retireShared(host, replacement) {
137
+ if (activeHost === host)
138
+ activeHost = replacement;
139
+ }
87
140
  export function engineHost() {
88
141
  activeHost ??= createHost();
89
142
  return activeHost;
90
143
  }
91
- function createHost() {
144
+ /** A separate worker host for interruptible long running work. Terminating it
145
+ * does not invalidate the interactive studies held by the shared host. A
146
+ * runtime without Worker falls back to synchronous wasm: cancellation then
147
+ * takes effect after the call returns, before the caller publishes its result. */
148
+ export function isolatedEngineHost() {
149
+ const fallback = isolatedDirectHost();
150
+ return createHost(fallback);
151
+ }
152
+ let activeSynthHost = null;
153
+ /** The long-lived host for synthetic grid generation: a third worker, so
154
+ * cancelling a generation (which terminates it) never touches the studies of
155
+ * the interactive host, and the places table loads once per worker rather
156
+ * than once per run. Created on first use, dropped by `cancel` or a crash,
157
+ * and created again for the next session. Without Worker support it runs on
158
+ * the calling thread, where a stop takes effect between stages. */
159
+ export function synthEngineHost() {
160
+ activeSynthHost ??= createHost(isolatedDirectHost(), (host, replacement) => {
161
+ if (activeSynthHost === host)
162
+ activeSynthHost = replacement;
163
+ });
164
+ return activeSynthHost;
165
+ }
166
+ function isolatedDirectHost() {
167
+ let stopped = false;
168
+ const handles = emptyHandles();
169
+ return {
170
+ kind: "direct",
171
+ async call(req) { return runRequest(await engineModule(), handles, req, () => stopped); },
172
+ callTimed(req) { return runTimed(handles, req, () => stopped); },
173
+ requestStop() { stopped = true; },
174
+ cancel() { stopped = true; return false; },
175
+ };
176
+ }
177
+ function createHost(fallback = directHost, retire = retireShared) {
92
178
  if (typeof Worker === "undefined")
93
- return directHost;
179
+ return fallback;
94
180
  try {
95
- return new WorkerHost(new Worker(new URL("./worker.js", import.meta.url), { type: "module" }));
181
+ return new WorkerHost(new Worker(new URL("./worker.js", import.meta.url), { type: "module" }), fallback, retire);
96
182
  }
97
183
  catch {
98
- return directHost;
184
+ return fallback;
99
185
  }
100
186
  }
101
187
  //# sourceMappingURL=host.js.map
package/dist/host.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;+DAK+D;AAE/D,OAAO,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,UAAU,GAIX,MAAM,eAAe,CAAC;AAMvB,MAAM,aAAa,GAAG,IAAI,GAAG,EAAqB,CAAC;AAEnD,MAAM,CAAC,MAAM,UAA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