@nanobpm/engine-wasm 0.2.0 → 0.3.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.
- package/nanobpmn_engine.d.ts +23 -0
- package/nanobpmn_engine.js +55 -0
- package/nanobpmn_engine_bg.wasm +0 -0
- package/nanobpmn_engine_bg.wasm.d.ts +1 -0
- package/package.json +1 -1
package/nanobpmn_engine.d.ts
CHANGED
|
@@ -38,6 +38,28 @@ export class TestEngine {
|
|
|
38
38
|
* `Terminated`. Returns the snapshot.
|
|
39
39
|
*/
|
|
40
40
|
cancelInstance(instance_key: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Complete an ad-hoc sub-process **agent** job — the container's
|
|
43
|
+
* JOB_WORKER job (Camunda's agentic `aiagent-job-worker`) — carrying the
|
|
44
|
+
* agent's activate-element instructions so the engine runs the selected
|
|
45
|
+
* inner "tools" this turn (ADR 0023 seam 2/3; Camunda `JobResult` /
|
|
46
|
+
* `activateElements[]`). This is the browser seam that the plain
|
|
47
|
+
* `completeJob` deliberately omits (it always sends
|
|
48
|
+
* `adhoc_result: None`).
|
|
49
|
+
*
|
|
50
|
+
* `agent_result_json` shape (camelCase, mirroring Camunda's agentic
|
|
51
|
+
* `JobResult`):
|
|
52
|
+
* ```json
|
|
53
|
+
* { "activateElements": [{ "elementId": "toolA", "variables": { "q": 1 } }],
|
|
54
|
+
* "completionConditionFulfilled": false,
|
|
55
|
+
* "cancelRemainingInstances": false }
|
|
56
|
+
* ```
|
|
57
|
+
* Empty/whitespace ⇒ a no-op result, so the container completes this turn
|
|
58
|
+
* (no tool activated). `variables_json` merges instance variables exactly
|
|
59
|
+
* like `completeJob` — e.g. the agent's final
|
|
60
|
+
* decision when it signals `completionConditionFulfilled`.
|
|
61
|
+
*/
|
|
62
|
+
completeAgentJob(job_key: string, variables_json: string, agent_result_json: string): string;
|
|
41
63
|
/**
|
|
42
64
|
* Complete a waiting job by key, merging `variables_json` (a JSON object
|
|
43
65
|
* string) into the instance. The job is activated first if it has not been
|
|
@@ -173,6 +195,7 @@ export interface InitOutput {
|
|
|
173
195
|
readonly testengine_assignUserTask: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
174
196
|
readonly testengine_broadcastSignal: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
175
197
|
readonly testengine_cancelInstance: (a: number, b: number, c: number, d: number) => void;
|
|
198
|
+
readonly testengine_completeAgentJob: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
176
199
|
readonly testengine_completeJob: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
177
200
|
readonly testengine_completeUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
178
201
|
readonly testengine_correlateMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
package/nanobpmn_engine.js
CHANGED
|
@@ -190,6 +190,61 @@ export class TestEngine {
|
|
|
190
190
|
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Complete an ad-hoc sub-process **agent** job — the container's
|
|
195
|
+
* JOB_WORKER job (Camunda's agentic `aiagent-job-worker`) — carrying the
|
|
196
|
+
* agent's activate-element instructions so the engine runs the selected
|
|
197
|
+
* inner "tools" this turn (ADR 0023 seam 2/3; Camunda `JobResult` /
|
|
198
|
+
* `activateElements[]`). This is the browser seam that the plain
|
|
199
|
+
* `completeJob` deliberately omits (it always sends
|
|
200
|
+
* `adhoc_result: None`).
|
|
201
|
+
*
|
|
202
|
+
* `agent_result_json` shape (camelCase, mirroring Camunda's agentic
|
|
203
|
+
* `JobResult`):
|
|
204
|
+
* ```json
|
|
205
|
+
* { "activateElements": [{ "elementId": "toolA", "variables": { "q": 1 } }],
|
|
206
|
+
* "completionConditionFulfilled": false,
|
|
207
|
+
* "cancelRemainingInstances": false }
|
|
208
|
+
* ```
|
|
209
|
+
* Empty/whitespace ⇒ a no-op result, so the container completes this turn
|
|
210
|
+
* (no tool activated). `variables_json` merges instance variables exactly
|
|
211
|
+
* like `completeJob` — e.g. the agent's final
|
|
212
|
+
* decision when it signals `completionConditionFulfilled`.
|
|
213
|
+
* @param {string} job_key
|
|
214
|
+
* @param {string} variables_json
|
|
215
|
+
* @param {string} agent_result_json
|
|
216
|
+
* @returns {string}
|
|
217
|
+
*/
|
|
218
|
+
completeAgentJob(job_key, variables_json, agent_result_json) {
|
|
219
|
+
let deferred5_0;
|
|
220
|
+
let deferred5_1;
|
|
221
|
+
try {
|
|
222
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
223
|
+
const ptr0 = passStringToWasm0(job_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
224
|
+
const len0 = WASM_VECTOR_LEN;
|
|
225
|
+
const ptr1 = passStringToWasm0(variables_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
226
|
+
const len1 = WASM_VECTOR_LEN;
|
|
227
|
+
const ptr2 = passStringToWasm0(agent_result_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
228
|
+
const len2 = WASM_VECTOR_LEN;
|
|
229
|
+
wasm.testengine_completeAgentJob(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
230
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
231
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
232
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
233
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
234
|
+
var ptr4 = r0;
|
|
235
|
+
var len4 = r1;
|
|
236
|
+
if (r3) {
|
|
237
|
+
ptr4 = 0; len4 = 0;
|
|
238
|
+
throw takeObject(r2);
|
|
239
|
+
}
|
|
240
|
+
deferred5_0 = ptr4;
|
|
241
|
+
deferred5_1 = len4;
|
|
242
|
+
return getStringFromWasm0(ptr4, len4);
|
|
243
|
+
} finally {
|
|
244
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
245
|
+
wasm.__wbindgen_export3(deferred5_0, deferred5_1, 1);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
193
248
|
/**
|
|
194
249
|
* Complete a waiting job by key, merging `variables_json` (a JSON object
|
|
195
250
|
* string) into the instance. The job is activated first if it has not been
|
package/nanobpmn_engine_bg.wasm
CHANGED
|
Binary file
|
|
@@ -7,6 +7,7 @@ export const testengine_advanceTime: (a: number, b: number, c: number) => void;
|
|
|
7
7
|
export const testengine_assignUserTask: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
8
8
|
export const testengine_broadcastSignal: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
9
9
|
export const testengine_cancelInstance: (a: number, b: number, c: number, d: number) => void;
|
|
10
|
+
export const testengine_completeAgentJob: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
10
11
|
export const testengine_completeJob: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
11
12
|
export const testengine_completeUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
12
13
|
export const testengine_correlateMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nanobpm/engine-wasm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "The nanobpmn engine (engine-core) compiled to WebAssembly for in-browser BPMN execution: deploy a diagram, start instances, activate/complete jobs, and read live snapshots/traces. The substrate for the Bojtos demo framework (ADR 0043) and the console test-run panel.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|