@nanobpm/engine-wasm 0.8.7 → 0.9.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 +54 -4
- package/lean/nanobpmn_engine.d.ts +67 -46
- package/lean/nanobpmn_engine.js +251 -100
- package/lean/nanobpmn_engine_bg.wasm +0 -0
- package/lean/nanobpmn_engine_bg.wasm.d.ts +11 -7
- package/package.json +1 -1
- package/readmodel/nanobpmn_engine.d.ts +67 -46
- package/readmodel/nanobpmn_engine.js +251 -100
- package/readmodel/nanobpmn_engine_bg.wasm +0 -0
- package/readmodel/nanobpmn_engine_bg.wasm.d.ts +11 -7
- package/readmodel-types/types.gen.d.ts +436 -178
|
@@ -13,7 +13,7 @@ export class TestEngine {
|
|
|
13
13
|
* (key, type, instance/element, retries, variables) for the dispatch loop to
|
|
14
14
|
* hand to worker handlers. The host owns the wall clock via `tickNow`.
|
|
15
15
|
*/
|
|
16
|
-
activateJobs(job_type: string, max_jobs: number, timeout_ms: number, worker: string): string;
|
|
16
|
+
activateJobs(job_type: string, max_jobs: number, timeout_ms: number, worker: string, with_lease?: boolean | null): string;
|
|
17
17
|
/**
|
|
18
18
|
* Advance the virtual clock by `by_ms` milliseconds, firing any timers that
|
|
19
19
|
* become due and expiring any lapsed job locks.
|
|
@@ -39,8 +39,9 @@ export class TestEngine {
|
|
|
39
39
|
*/
|
|
40
40
|
cancelInstance(instance_key: string): string;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
42
|
+
* Legacy embedded-only completion extension. It neither commits history nor
|
|
43
|
+
* advances BPMN; canonical workers complete their owning job instead.
|
|
44
|
+
* Returns the snapshot.
|
|
44
45
|
*/
|
|
45
46
|
completeAgentInstance(agent_instance_key: string): string;
|
|
46
47
|
/**
|
|
@@ -64,13 +65,13 @@ export class TestEngine {
|
|
|
64
65
|
* like `completeJob` — e.g. the agent's final
|
|
65
66
|
* decision when it signals `completionConditionFulfilled`.
|
|
66
67
|
*/
|
|
67
|
-
completeAgentJob(job_key: string, variables_json: string, agent_result_json: string): string;
|
|
68
|
+
completeAgentJob(job_key: string, variables_json: string, agent_result_json: string, lease_token?: string | null): string;
|
|
68
69
|
/**
|
|
69
70
|
* Complete a waiting job by key, merging `variables_json` (a JSON object
|
|
70
71
|
* string) into the instance. The job is activated first if it has not been
|
|
71
72
|
* already, so the UI can complete a freshly-created job directly.
|
|
72
73
|
*/
|
|
73
|
-
completeJob(job_key: string, variables_json: string): string;
|
|
74
|
+
completeJob(job_key: string, variables_json: string, lease_token?: string | null): string;
|
|
74
75
|
/**
|
|
75
76
|
* Complete a waiting user task by key, merging `variables_json` into the
|
|
76
77
|
* instance before the parked token resumes. The task must be in the
|
|
@@ -87,17 +88,9 @@ export class TestEngine {
|
|
|
87
88
|
*/
|
|
88
89
|
correlateMessage(message_name: string, correlation_key: string, variables_json: string): string;
|
|
89
90
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* systemPrompt? }`, `limits` is `{ maxTokens?, maxModelCalls?, maxToolCalls? }`
|
|
94
|
-
* (omitted limits default to unlimited), and `history` is an initial batch of
|
|
95
|
-
* turns (see the turn shape on `updateAgentInstance`). `jobKey`/`jobLease`
|
|
96
|
-
* are the activation's job attribution: **required** for an `external`
|
|
97
|
-
* (job-backed) agent element, where the CREATE is rejected unless they
|
|
98
|
-
* reference that element's ACTIVATED job with a matching lease token and
|
|
99
|
-
* `elementInstanceKey` (#1099); unused for the engine-native
|
|
100
|
-
* `aiAgentTask`/`aiAgentSubProcess` variants. Returns the snapshot.
|
|
91
|
+
* Create an agent using `{ elementInstanceKey, jobKey, jobLease, history }`.
|
|
92
|
+
* History must establish its CONFIGURATION. Returns the canonical creation
|
|
93
|
+
* result with `agentInstanceKey` and positionally correlated `createdHistory`.
|
|
101
94
|
*/
|
|
102
95
|
createAgentInstance(request_json: string): string;
|
|
103
96
|
/**
|
|
@@ -149,11 +142,26 @@ export class TestEngine {
|
|
|
149
142
|
*/
|
|
150
143
|
debugStep(): string;
|
|
151
144
|
/**
|
|
152
|
-
* Parse and deploy a BPMN resource
|
|
153
|
-
*
|
|
154
|
-
*
|
|
145
|
+
* Parse and deploy a BPMN **or** DMN resource — the one entry point accepts
|
|
146
|
+
* both (issue #1158). A BPMN process resource deploys as before and returns
|
|
147
|
+
* `{ "processIds": [...], "snapshot": {...} }`. A DMN decision resource (no
|
|
148
|
+
* `<process>` element) is routed to decision deployment and returns the same
|
|
149
|
+
* shape as the `deployDecision` method
|
|
150
|
+
* (`{ "decisionRequirementsId": ..., "decisionRequirementsKey": ..., "version": N, "decisions": [{ "decisionId", "decisionName", "decisionKey", "version" }], "snapshot": {...} }`),
|
|
151
|
+
* so a `zeebe:calledDecision` on a business rule task can finally resolve.
|
|
152
|
+
* On failure it throws a JS error carrying the parse/deploy message for the
|
|
153
|
+
* format the document most resembles.
|
|
155
154
|
*/
|
|
156
155
|
deploy(xml: string): string;
|
|
156
|
+
/**
|
|
157
|
+
* Parse and deploy a DMN decision-requirements resource explicitly. Registers
|
|
158
|
+
* every `<decision>` it contains (by id) so a business rule task's
|
|
159
|
+
* `zeebe:calledDecision` resolves and `evaluateDecision` can run it. Returns a
|
|
160
|
+
* JSON object
|
|
161
|
+
* `{ "decisionRequirementsId": ..., "decisionRequirementsKey": ..., "version": N, "decisions": [{ "decisionId", "decisionName", "decisionKey", "version" }], "snapshot": {...} }`
|
|
162
|
+
* on success, or throws a JS error carrying the parse/deploy failure message.
|
|
163
|
+
*/
|
|
164
|
+
deployDecision(xml: string): string;
|
|
157
165
|
/**
|
|
158
166
|
* Deploy a single `form-js` `.form` resource (the verbatim form-js JSON
|
|
159
167
|
* document). Mirrors the native deploy decomposition, which registers a
|
|
@@ -182,6 +190,18 @@ export class TestEngine {
|
|
|
182
190
|
* on success, or throws a JS error carrying the deploy failure message.
|
|
183
191
|
*/
|
|
184
192
|
deployResource(resource_name: string, content: string): string;
|
|
193
|
+
/**
|
|
194
|
+
* Evaluate a deployed decision by id against the given variables — the
|
|
195
|
+
* standalone counterpart to a business rule task's in-line evaluation. The
|
|
196
|
+
* decision must already be deployed (via `deploy`/`deployDecision`). Read-only:
|
|
197
|
+
* it evaluates and returns the result without mutating engine state or
|
|
198
|
+
* recording a decision instance. `variables_json` is a JSON object string
|
|
199
|
+
* (`"{}"` / `""` for none). Returns
|
|
200
|
+
* `{ "decisionId": ..., "decisionKey": ..., "output": <value> }` on success,
|
|
201
|
+
* or throws a JS error carrying an "unknown decision" or evaluation-failure
|
|
202
|
+
* message.
|
|
203
|
+
*/
|
|
204
|
+
evaluateDecision(decision_id: string, variables_json: string): string;
|
|
185
205
|
/**
|
|
186
206
|
* The full ordered event log emitted so far, as a JSON array of
|
|
187
207
|
* `{ seq, now, type, ...payload }`. Useful for a step-through / trace view.
|
|
@@ -191,7 +211,7 @@ export class TestEngine {
|
|
|
191
211
|
* Fail a waiting job by key with the given remaining `retries` and message.
|
|
192
212
|
* With no retries left this raises an incident (visible in the snapshot).
|
|
193
213
|
*/
|
|
194
|
-
failJob(job_key: string, retries: number, message: string): string;
|
|
214
|
+
failJob(job_key: string, retries: number, message: string, lease_token?: string | null): string;
|
|
195
215
|
/**
|
|
196
216
|
* The latest deployed form for `form_key`, as a `FormResult` JSON object
|
|
197
217
|
* (`{ tenantId, formId, schema, version, formKey }`), or JSON `null` when no
|
|
@@ -228,6 +248,11 @@ export class TestEngine {
|
|
|
228
248
|
* Create a fresh, empty simulated engine. The virtual clock starts at 0.
|
|
229
249
|
*/
|
|
230
250
|
constructor();
|
|
251
|
+
/**
|
|
252
|
+
* Restore a complete trace returned by `events()`, using the core journal
|
|
253
|
+
* decoder and replay engine. Replaces this simulation only after decoding succeeds.
|
|
254
|
+
*/
|
|
255
|
+
replayEvents(events_json: string): string;
|
|
231
256
|
/**
|
|
232
257
|
* Discard all engine state (deployed definitions, instances, jobs, timers,
|
|
233
258
|
* the event log and the virtual clock), returning the engine to the same
|
|
@@ -308,7 +333,7 @@ export class TestEngine {
|
|
|
308
333
|
* raised. The job is activated first if needed, so the UI can throw an
|
|
309
334
|
* error directly from a freshly-created job. Returns the snapshot.
|
|
310
335
|
*/
|
|
311
|
-
throwError(job_key: string, error_code: string, error_message: string): string;
|
|
336
|
+
throwError(job_key: string, error_code: string, error_message: string, lease_token?: string | null): string;
|
|
312
337
|
/**
|
|
313
338
|
* Set the engine clock to a wall-clock instant (ms), then trigger due timers
|
|
314
339
|
* and expire lapsed job locks. The embedded host calls this with `Date.now()`
|
|
@@ -322,29 +347,21 @@ export class TestEngine {
|
|
|
322
347
|
*/
|
|
323
348
|
unassignUserTask(user_task_key: string): string;
|
|
324
349
|
/**
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
* status?, metrics?, tools?, jobKey?, jobLease?, history? }`. `tools` is a
|
|
331
|
-
* nullable changeset: omit it to leave the stored set unchanged, pass `null`
|
|
332
|
-
* to clear it, or an array to replace it. `jobKey`/`jobLease` are the
|
|
333
|
-
* activation's job attribution, stamped onto every appended turn (as the
|
|
334
|
-
* gateway does). A turn is `{ loopIteration?, producedAt?, role?, content?,
|
|
335
|
-
* systemPrompt?, historyItemId?, model?, provider? }`, where `producedAt` is
|
|
336
|
-
* an RFC-3339 `date-time` string (the REST spelling; a bare epoch-millis
|
|
337
|
-
* number is also accepted); `content` items are `{ contentType?, text?,
|
|
338
|
-
* documentReference?, object? }`, where `object` is arbitrary JSON (the REST
|
|
339
|
-
* wire shape). Returns the snapshot.
|
|
340
|
-
*/
|
|
341
|
-
updateAgentInstance(request_json: string): string;
|
|
350
|
+
* Update an agent with `{ elementInstanceKey, jobKey, jobLease, status?, history? }`.
|
|
351
|
+
* Configuration and metrics are submitted through history, never top-level fields.
|
|
352
|
+
* Returns `createdHistory`; the engine owns pending/commit/discard semantics.
|
|
353
|
+
*/
|
|
354
|
+
updateAgentInstance(agent_instance_key: string, request_json: string): string;
|
|
342
355
|
/**
|
|
343
356
|
* Set a job's remaining retries by key. Used to recover a job parked on a
|
|
344
357
|
* no-retries incident before resolving that incident; does not by itself
|
|
345
358
|
* unblock the job. Returns the snapshot.
|
|
346
359
|
*/
|
|
347
|
-
updateRetries(job_key: string, retries: number): string;
|
|
360
|
+
updateRetries(job_key: string, retries: number, lease_token?: string | null): string;
|
|
361
|
+
/**
|
|
362
|
+
* Update an activated job's timeout, optionally checking its opaque lease.
|
|
363
|
+
*/
|
|
364
|
+
updateTimeout(job_key: string, timeout_ms: number, lease_token?: string | null): string;
|
|
348
365
|
/**
|
|
349
366
|
* Update a user task's attributes from a JSON changeset object. Recognised
|
|
350
367
|
* keys (all optional): `candidateGroups` / `candidateUsers` (string arrays),
|
|
@@ -368,14 +385,14 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
368
385
|
export interface InitOutput {
|
|
369
386
|
readonly memory: WebAssembly.Memory;
|
|
370
387
|
readonly __wbg_testengine_free: (a: number, b: number) => void;
|
|
371
|
-
readonly testengine_activateJobs: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
388
|
+
readonly testengine_activateJobs: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
372
389
|
readonly testengine_advanceTime: (a: number, b: number, c: number) => void;
|
|
373
390
|
readonly testengine_assignUserTask: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
374
391
|
readonly testengine_broadcastSignal: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
375
392
|
readonly testengine_cancelInstance: (a: number, b: number, c: number, d: number) => void;
|
|
376
393
|
readonly testengine_completeAgentInstance: (a: number, b: number, c: number, d: number) => void;
|
|
377
|
-
readonly testengine_completeAgentJob: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
378
|
-
readonly testengine_completeJob: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
394
|
+
readonly testengine_completeAgentJob: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
395
|
+
readonly testengine_completeJob: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
379
396
|
readonly testengine_completeUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
380
397
|
readonly testengine_correlateMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
381
398
|
readonly testengine_createAgentInstance: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -386,16 +403,19 @@ export interface InitOutput {
|
|
|
386
403
|
readonly testengine_debugResume: (a: number, b: number) => void;
|
|
387
404
|
readonly testengine_debugStep: (a: number, b: number) => void;
|
|
388
405
|
readonly testengine_deploy: (a: number, b: number, c: number, d: number) => void;
|
|
406
|
+
readonly testengine_deployDecision: (a: number, b: number, c: number, d: number) => void;
|
|
389
407
|
readonly testengine_deployForm: (a: number, b: number, c: number, d: number) => void;
|
|
390
408
|
readonly testengine_deployResource: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
409
|
+
readonly testengine_evaluateDecision: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
391
410
|
readonly testengine_events: (a: number, b: number) => void;
|
|
392
|
-
readonly testengine_failJob: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
411
|
+
readonly testengine_failJob: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
393
412
|
readonly testengine_getFormByKey: (a: number, b: number, c: number, d: number) => void;
|
|
394
413
|
readonly testengine_getResourceByKey: (a: number, b: number, c: number, d: number) => void;
|
|
395
414
|
readonly testengine_migrate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
396
415
|
readonly testengine_modify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
397
416
|
readonly testengine_new: () => number;
|
|
398
417
|
readonly testengine_now: (a: number) => number;
|
|
418
|
+
readonly testengine_replayEvents: (a: number, b: number, c: number, d: number) => void;
|
|
399
419
|
readonly testengine_reset: (a: number) => void;
|
|
400
420
|
readonly testengine_resolveIncident: (a: number, b: number, c: number, d: number) => void;
|
|
401
421
|
readonly testengine_searchAgentInstanceHistory: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
@@ -405,11 +425,12 @@ export interface InitOutput {
|
|
|
405
425
|
readonly testengine_searchVariables: (a: number, b: number, c: number, d: number) => void;
|
|
406
426
|
readonly testengine_setVariables: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
407
427
|
readonly testengine_snapshot: (a: number, b: number) => void;
|
|
408
|
-
readonly testengine_throwError: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
428
|
+
readonly testengine_throwError: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
409
429
|
readonly testengine_tickNow: (a: number, b: number, c: number) => void;
|
|
410
430
|
readonly testengine_unassignUserTask: (a: number, b: number, c: number, d: number) => void;
|
|
411
|
-
readonly testengine_updateAgentInstance: (a: number, b: number, c: number, d: number) => void;
|
|
412
|
-
readonly testengine_updateRetries: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
431
|
+
readonly testengine_updateAgentInstance: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
432
|
+
readonly testengine_updateRetries: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
433
|
+
readonly testengine_updateTimeout: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
413
434
|
readonly testengine_updateUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
414
435
|
readonly sqlite3_os_init: () => number;
|
|
415
436
|
readonly sqlite3_os_end: () => number;
|