@nanobpm/engine-wasm 0.8.1 → 0.8.5

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.
@@ -38,6 +38,11 @@ export class TestEngine {
38
38
  * `Terminated`. Returns the snapshot.
39
39
  */
40
40
  cancelInstance(instance_key: string): string;
41
+ /**
42
+ * Complete an AgentInstance by its dedicated key, driving it to the terminal
43
+ * `COMPLETED` status. Returns the snapshot.
44
+ */
45
+ completeAgentInstance(agent_instance_key: string): string;
41
46
  /**
42
47
  * Complete an ad-hoc sub-process **agent** job — the container's
43
48
  * JOB_WORKER job (Camunda's agentic `aiagent-job-worker`) — carrying the
@@ -81,6 +86,15 @@ export class TestEngine {
81
86
  * in-browser equivalent of an app publishing a message. Returns the snapshot.
82
87
  */
83
88
  correlateMessage(message_name: string, correlation_key: string, variables_json: string): string;
89
+ /**
90
+ * Reconcile / create an AgentInstance for an already-activated agent task.
91
+ * `request_json` is `{ elementInstanceKey, definition?, limits?, history? }`
92
+ * where `definition` is `{ model?, provider?, systemPrompt? }`, `limits` is
93
+ * `{ maxTokens?, maxModelCalls?, maxToolCalls? }` (omitted limits default to
94
+ * unlimited), and `history` is an initial batch of turns (see the turn shape
95
+ * on `updateAgentInstance`). Returns the snapshot.
96
+ */
97
+ createAgentInstance(request_json: string): string;
84
98
  /**
85
99
  * Start a new instance of `process_id`, seeding it with the given variables
86
100
  * (a JSON object string; pass `"{}"` or `""` for none). `version` selects a
@@ -243,6 +257,24 @@ export class TestEngine {
243
257
  * Returns the snapshot.
244
258
  */
245
259
  unassignUserTask(user_task_key: string): string;
260
+ /**
261
+ * Advance an AgentInstance: set its `status` (a REST spelling other than
262
+ * `COMPLETED`, which is reachable only through `completeAgentInstance` and is
263
+ * rejected here with a targeted error), accumulate `metrics`, optionally
264
+ * replace `tools`, and append a `history` batch. `request_json` is
265
+ * `{ agentInstanceKey, elementInstanceKey, elementId, processInstanceKey,
266
+ * status?, metrics?, tools?, jobKey?, jobLease?, history? }`. `tools` is a
267
+ * nullable changeset: omit it to leave the stored set unchanged, pass `null`
268
+ * to clear it, or an array to replace it. `jobKey`/`jobLease` are the
269
+ * activation's job attribution, stamped onto every appended turn (as the
270
+ * gateway does). A turn is `{ loopIteration?, producedAt?, role?, content?,
271
+ * systemPrompt?, historyItemId?, model?, provider? }`, where `producedAt` is
272
+ * an RFC-3339 `date-time` string (the REST spelling; a bare epoch-millis
273
+ * number is also accepted); `content` items are `{ contentType?, text?,
274
+ * documentReference?, object? }`, where `object` is arbitrary JSON (the REST
275
+ * wire shape). Returns the snapshot.
276
+ */
277
+ updateAgentInstance(request_json: string): string;
246
278
  /**
247
279
  * Set a job's remaining retries by key. Used to recover a job parked on a
248
280
  * no-retries incident before resolving that incident; does not by itself
@@ -277,10 +309,12 @@ export interface InitOutput {
277
309
  readonly testengine_assignUserTask: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
278
310
  readonly testengine_broadcastSignal: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
279
311
  readonly testengine_cancelInstance: (a: number, b: number, c: number, d: number) => void;
312
+ readonly testengine_completeAgentInstance: (a: number, b: number, c: number, d: number) => void;
280
313
  readonly testengine_completeAgentJob: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
281
314
  readonly testengine_completeJob: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
282
315
  readonly testengine_completeUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
283
316
  readonly testengine_correlateMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
317
+ readonly testengine_createAgentInstance: (a: number, b: number, c: number, d: number) => void;
284
318
  readonly testengine_createInstance: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
285
319
  readonly testengine_debugClear: (a: number) => void;
286
320
  readonly testengine_debugCreateInstance: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
@@ -303,6 +337,7 @@ export interface InitOutput {
303
337
  readonly testengine_throwError: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
304
338
  readonly testengine_tickNow: (a: number, b: number, c: number) => void;
305
339
  readonly testengine_unassignUserTask: (a: number, b: number, c: number, d: number) => void;
340
+ readonly testengine_updateAgentInstance: (a: number, b: number, c: number, d: number) => void;
306
341
  readonly testengine_updateRetries: (a: number, b: number, c: number, d: number, e: number) => void;
307
342
  readonly testengine_updateUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
308
343
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
@@ -190,6 +190,38 @@ export class TestEngine {
190
190
  wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
191
191
  }
192
192
  }
193
+ /**
194
+ * Complete an AgentInstance by its dedicated key, driving it to the terminal
195
+ * `COMPLETED` status. Returns the snapshot.
196
+ * @param {string} agent_instance_key
197
+ * @returns {string}
198
+ */
199
+ completeAgentInstance(agent_instance_key) {
200
+ let deferred3_0;
201
+ let deferred3_1;
202
+ try {
203
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
204
+ const ptr0 = passStringToWasm0(agent_instance_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
205
+ const len0 = WASM_VECTOR_LEN;
206
+ wasm.testengine_completeAgentInstance(retptr, this.__wbg_ptr, ptr0, len0);
207
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
208
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
209
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
210
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
211
+ var ptr2 = r0;
212
+ var len2 = r1;
213
+ if (r3) {
214
+ ptr2 = 0; len2 = 0;
215
+ throw takeObject(r2);
216
+ }
217
+ deferred3_0 = ptr2;
218
+ deferred3_1 = len2;
219
+ return getStringFromWasm0(ptr2, len2);
220
+ } finally {
221
+ wasm.__wbindgen_add_to_stack_pointer(16);
222
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
223
+ }
224
+ }
193
225
  /**
194
226
  * Complete an ad-hoc sub-process **agent** job — the container's
195
227
  * JOB_WORKER job (Camunda's agentic `aiagent-job-worker`) — carrying the
@@ -359,6 +391,42 @@ export class TestEngine {
359
391
  wasm.__wbindgen_export3(deferred5_0, deferred5_1, 1);
360
392
  }
361
393
  }
394
+ /**
395
+ * Reconcile / create an AgentInstance for an already-activated agent task.
396
+ * `request_json` is `{ elementInstanceKey, definition?, limits?, history? }`
397
+ * where `definition` is `{ model?, provider?, systemPrompt? }`, `limits` is
398
+ * `{ maxTokens?, maxModelCalls?, maxToolCalls? }` (omitted limits default to
399
+ * unlimited), and `history` is an initial batch of turns (see the turn shape
400
+ * on `updateAgentInstance`). Returns the snapshot.
401
+ * @param {string} request_json
402
+ * @returns {string}
403
+ */
404
+ createAgentInstance(request_json) {
405
+ let deferred3_0;
406
+ let deferred3_1;
407
+ try {
408
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
409
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
410
+ const len0 = WASM_VECTOR_LEN;
411
+ wasm.testengine_createAgentInstance(retptr, this.__wbg_ptr, ptr0, len0);
412
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
413
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
414
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
415
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
416
+ var ptr2 = r0;
417
+ var len2 = r1;
418
+ if (r3) {
419
+ ptr2 = 0; len2 = 0;
420
+ throw takeObject(r2);
421
+ }
422
+ deferred3_0 = ptr2;
423
+ deferred3_1 = len2;
424
+ return getStringFromWasm0(ptr2, len2);
425
+ } finally {
426
+ wasm.__wbindgen_add_to_stack_pointer(16);
427
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
428
+ }
429
+ }
362
430
  /**
363
431
  * Start a new instance of `process_id`, seeding it with the given variables
364
432
  * (a JSON object string; pass `"{}"` or `""` for none). `version` selects a
@@ -1030,6 +1098,51 @@ export class TestEngine {
1030
1098
  wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
1031
1099
  }
1032
1100
  }
1101
+ /**
1102
+ * Advance an AgentInstance: set its `status` (a REST spelling other than
1103
+ * `COMPLETED`, which is reachable only through `completeAgentInstance` and is
1104
+ * rejected here with a targeted error), accumulate `metrics`, optionally
1105
+ * replace `tools`, and append a `history` batch. `request_json` is
1106
+ * `{ agentInstanceKey, elementInstanceKey, elementId, processInstanceKey,
1107
+ * status?, metrics?, tools?, jobKey?, jobLease?, history? }`. `tools` is a
1108
+ * nullable changeset: omit it to leave the stored set unchanged, pass `null`
1109
+ * to clear it, or an array to replace it. `jobKey`/`jobLease` are the
1110
+ * activation's job attribution, stamped onto every appended turn (as the
1111
+ * gateway does). A turn is `{ loopIteration?, producedAt?, role?, content?,
1112
+ * systemPrompt?, historyItemId?, model?, provider? }`, where `producedAt` is
1113
+ * an RFC-3339 `date-time` string (the REST spelling; a bare epoch-millis
1114
+ * number is also accepted); `content` items are `{ contentType?, text?,
1115
+ * documentReference?, object? }`, where `object` is arbitrary JSON (the REST
1116
+ * wire shape). Returns the snapshot.
1117
+ * @param {string} request_json
1118
+ * @returns {string}
1119
+ */
1120
+ updateAgentInstance(request_json) {
1121
+ let deferred3_0;
1122
+ let deferred3_1;
1123
+ try {
1124
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1125
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1126
+ const len0 = WASM_VECTOR_LEN;
1127
+ wasm.testengine_updateAgentInstance(retptr, this.__wbg_ptr, ptr0, len0);
1128
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1129
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1130
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1131
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1132
+ var ptr2 = r0;
1133
+ var len2 = r1;
1134
+ if (r3) {
1135
+ ptr2 = 0; len2 = 0;
1136
+ throw takeObject(r2);
1137
+ }
1138
+ deferred3_0 = ptr2;
1139
+ deferred3_1 = len2;
1140
+ return getStringFromWasm0(ptr2, len2);
1141
+ } finally {
1142
+ wasm.__wbindgen_add_to_stack_pointer(16);
1143
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
1144
+ }
1145
+ }
1033
1146
  /**
1034
1147
  * Set a job's remaining retries by key. Used to recover a job parked on a
1035
1148
  * no-retries incident before resolving that incident; does not by itself
Binary file
@@ -7,10 +7,12 @@ 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_completeAgentInstance: (a: number, b: number, c: number, d: number) => void;
10
11
  export const testengine_completeAgentJob: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
11
12
  export const testengine_completeJob: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
12
13
  export const testengine_completeUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
13
14
  export const testengine_correlateMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
15
+ export const testengine_createAgentInstance: (a: number, b: number, c: number, d: number) => void;
14
16
  export const testengine_createInstance: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
15
17
  export const testengine_debugClear: (a: number) => void;
16
18
  export const testengine_debugCreateInstance: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
@@ -33,6 +35,7 @@ export const testengine_snapshot: (a: number, b: number) => void;
33
35
  export const testengine_throwError: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
34
36
  export const testengine_tickNow: (a: number, b: number, c: number) => void;
35
37
  export const testengine_unassignUserTask: (a: number, b: number, c: number, d: number) => void;
38
+ export const testengine_updateAgentInstance: (a: number, b: number, c: number, d: number) => void;
36
39
  export const testengine_updateRetries: (a: number, b: number, c: number, d: number, e: number) => void;
37
40
  export const testengine_updateUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
38
41
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanobpm/engine-wasm",
3
- "version": "0.8.1",
3
+ "version": "0.8.5",
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. Published as two subpath entrypoints — a lean baseline engine (default) and a read-model engine (the gateway's C8-style REST read surface). 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",
@@ -38,6 +38,11 @@ export class TestEngine {
38
38
  * `Terminated`. Returns the snapshot.
39
39
  */
40
40
  cancelInstance(instance_key: string): string;
41
+ /**
42
+ * Complete an AgentInstance by its dedicated key, driving it to the terminal
43
+ * `COMPLETED` status. Returns the snapshot.
44
+ */
45
+ completeAgentInstance(agent_instance_key: string): string;
41
46
  /**
42
47
  * Complete an ad-hoc sub-process **agent** job — the container's
43
48
  * JOB_WORKER job (Camunda's agentic `aiagent-job-worker`) — carrying the
@@ -81,6 +86,15 @@ export class TestEngine {
81
86
  * in-browser equivalent of an app publishing a message. Returns the snapshot.
82
87
  */
83
88
  correlateMessage(message_name: string, correlation_key: string, variables_json: string): string;
89
+ /**
90
+ * Reconcile / create an AgentInstance for an already-activated agent task.
91
+ * `request_json` is `{ elementInstanceKey, definition?, limits?, history? }`
92
+ * where `definition` is `{ model?, provider?, systemPrompt? }`, `limits` is
93
+ * `{ maxTokens?, maxModelCalls?, maxToolCalls? }` (omitted limits default to
94
+ * unlimited), and `history` is an initial batch of turns (see the turn shape
95
+ * on `updateAgentInstance`). Returns the snapshot.
96
+ */
97
+ createAgentInstance(request_json: string): string;
84
98
  /**
85
99
  * Start a new instance of `process_id`, seeding it with the given variables
86
100
  * (a JSON object string; pass `"{}"` or `""` for none). `version` selects a
@@ -224,6 +238,29 @@ export class TestEngine {
224
238
  * incident re-creates the service-task job). Returns the snapshot.
225
239
  */
226
240
  resolveIncident(incident_key: string): string;
241
+ /**
242
+ * The AgentHistory turns for `agent_instance_key`, as an
243
+ * `AgentInstanceHistorySearchQueryResult` JSON object (`{ items, page }`),
244
+ * in the engine's canonical `(loopIteration, producedAt, historyItemKey)`
245
+ * order. `filter_json` is `{ commitStatus? }` where `commitStatus` is a REST
246
+ * spelling or array of them; **omitting it defaults to COMMITTED only**
247
+ * (PENDING/DISCARDED surface only when asked for explicitly). Accepts the
248
+ * canonical REST envelope `{ "filter": { commitStatus? } }` as well as the
249
+ * top-level shorthand. Mirrors
250
+ * `POST /agent-instances/{agentInstanceKey}/history/search`.
251
+ */
252
+ searchAgentInstanceHistory(agent_instance_key: string, filter_json: string): string;
253
+ /**
254
+ * The AgentInstances matching an optional filter, as an
255
+ * `AgentInstanceSearchQueryResult` JSON object (`{ items, page }`). The
256
+ * filter is `{ agentInstanceKey?, agentDefinitionKey?, processInstanceKey?,
257
+ * rootProcessInstanceKey?, processDefinitionKey?, status?, elementId?,
258
+ * tenantId? }` (`status` a REST spelling, e.g. `"INITIALIZING"`); an
259
+ * empty/absent filter returns every instance. Accepts the canonical REST
260
+ * envelope `{ "filter": { … } }` as well as the top-level shorthand.
261
+ * Mirrors `POST /agent-instances/search`.
262
+ */
263
+ searchAgentInstances(filter_json: string): string;
227
264
  /**
228
265
  * All process instances, as a `ProcessInstanceSearchQueryResult` JSON object
229
266
  * (`{ items: [...], page: {...} }`). The request body is shape-validated like
@@ -279,6 +316,24 @@ export class TestEngine {
279
316
  * Returns the snapshot.
280
317
  */
281
318
  unassignUserTask(user_task_key: string): string;
319
+ /**
320
+ * Advance an AgentInstance: set its `status` (a REST spelling other than
321
+ * `COMPLETED`, which is reachable only through `completeAgentInstance` and is
322
+ * rejected here with a targeted error), accumulate `metrics`, optionally
323
+ * replace `tools`, and append a `history` batch. `request_json` is
324
+ * `{ agentInstanceKey, elementInstanceKey, elementId, processInstanceKey,
325
+ * status?, metrics?, tools?, jobKey?, jobLease?, history? }`. `tools` is a
326
+ * nullable changeset: omit it to leave the stored set unchanged, pass `null`
327
+ * to clear it, or an array to replace it. `jobKey`/`jobLease` are the
328
+ * activation's job attribution, stamped onto every appended turn (as the
329
+ * gateway does). A turn is `{ loopIteration?, producedAt?, role?, content?,
330
+ * systemPrompt?, historyItemId?, model?, provider? }`, where `producedAt` is
331
+ * an RFC-3339 `date-time` string (the REST spelling; a bare epoch-millis
332
+ * number is also accepted); `content` items are `{ contentType?, text?,
333
+ * documentReference?, object? }`, where `object` is arbitrary JSON (the REST
334
+ * wire shape). Returns the snapshot.
335
+ */
336
+ updateAgentInstance(request_json: string): string;
282
337
  /**
283
338
  * Set a job's remaining retries by key. Used to recover a job parked on a
284
339
  * no-retries incident before resolving that incident; does not by itself
@@ -313,10 +368,12 @@ export interface InitOutput {
313
368
  readonly testengine_assignUserTask: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
314
369
  readonly testengine_broadcastSignal: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
315
370
  readonly testengine_cancelInstance: (a: number, b: number, c: number, d: number) => void;
371
+ readonly testengine_completeAgentInstance: (a: number, b: number, c: number, d: number) => void;
316
372
  readonly testengine_completeAgentJob: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
317
373
  readonly testengine_completeJob: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
318
374
  readonly testengine_completeUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
319
375
  readonly testengine_correlateMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
376
+ readonly testengine_createAgentInstance: (a: number, b: number, c: number, d: number) => void;
320
377
  readonly testengine_createInstance: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
321
378
  readonly testengine_debugClear: (a: number) => void;
322
379
  readonly testengine_debugCreateInstance: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
@@ -336,6 +393,8 @@ export interface InitOutput {
336
393
  readonly testengine_now: (a: number) => number;
337
394
  readonly testengine_reset: (a: number) => void;
338
395
  readonly testengine_resolveIncident: (a: number, b: number, c: number, d: number) => void;
396
+ readonly testengine_searchAgentInstanceHistory: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
397
+ readonly testengine_searchAgentInstances: (a: number, b: number, c: number, d: number) => void;
339
398
  readonly testengine_searchProcessInstances: (a: number, b: number, c: number, d: number) => void;
340
399
  readonly testengine_searchUserTasks: (a: number, b: number, c: number, d: number) => void;
341
400
  readonly testengine_searchVariables: (a: number, b: number, c: number, d: number) => void;
@@ -344,6 +403,7 @@ export interface InitOutput {
344
403
  readonly testengine_throwError: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
345
404
  readonly testengine_tickNow: (a: number, b: number, c: number) => void;
346
405
  readonly testengine_unassignUserTask: (a: number, b: number, c: number, d: number) => void;
406
+ readonly testengine_updateAgentInstance: (a: number, b: number, c: number, d: number) => void;
347
407
  readonly testengine_updateRetries: (a: number, b: number, c: number, d: number, e: number) => void;
348
408
  readonly testengine_updateUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
349
409
  readonly sqlite3_os_init: () => number;
@@ -190,6 +190,38 @@ export class TestEngine {
190
190
  wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
191
191
  }
192
192
  }
193
+ /**
194
+ * Complete an AgentInstance by its dedicated key, driving it to the terminal
195
+ * `COMPLETED` status. Returns the snapshot.
196
+ * @param {string} agent_instance_key
197
+ * @returns {string}
198
+ */
199
+ completeAgentInstance(agent_instance_key) {
200
+ let deferred3_0;
201
+ let deferred3_1;
202
+ try {
203
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
204
+ const ptr0 = passStringToWasm0(agent_instance_key, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
205
+ const len0 = WASM_VECTOR_LEN;
206
+ wasm.testengine_completeAgentInstance(retptr, this.__wbg_ptr, ptr0, len0);
207
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
208
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
209
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
210
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
211
+ var ptr2 = r0;
212
+ var len2 = r1;
213
+ if (r3) {
214
+ ptr2 = 0; len2 = 0;
215
+ throw takeObject(r2);
216
+ }
217
+ deferred3_0 = ptr2;
218
+ deferred3_1 = len2;
219
+ return getStringFromWasm0(ptr2, len2);
220
+ } finally {
221
+ wasm.__wbindgen_add_to_stack_pointer(16);
222
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
223
+ }
224
+ }
193
225
  /**
194
226
  * Complete an ad-hoc sub-process **agent** job — the container's
195
227
  * JOB_WORKER job (Camunda's agentic `aiagent-job-worker`) — carrying the
@@ -359,6 +391,42 @@ export class TestEngine {
359
391
  wasm.__wbindgen_export4(deferred5_0, deferred5_1, 1);
360
392
  }
361
393
  }
394
+ /**
395
+ * Reconcile / create an AgentInstance for an already-activated agent task.
396
+ * `request_json` is `{ elementInstanceKey, definition?, limits?, history? }`
397
+ * where `definition` is `{ model?, provider?, systemPrompt? }`, `limits` is
398
+ * `{ maxTokens?, maxModelCalls?, maxToolCalls? }` (omitted limits default to
399
+ * unlimited), and `history` is an initial batch of turns (see the turn shape
400
+ * on `updateAgentInstance`). Returns the snapshot.
401
+ * @param {string} request_json
402
+ * @returns {string}
403
+ */
404
+ createAgentInstance(request_json) {
405
+ let deferred3_0;
406
+ let deferred3_1;
407
+ try {
408
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
409
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
410
+ const len0 = WASM_VECTOR_LEN;
411
+ wasm.testengine_createAgentInstance(retptr, this.__wbg_ptr, ptr0, len0);
412
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
413
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
414
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
415
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
416
+ var ptr2 = r0;
417
+ var len2 = r1;
418
+ if (r3) {
419
+ ptr2 = 0; len2 = 0;
420
+ throw takeObject(r2);
421
+ }
422
+ deferred3_0 = ptr2;
423
+ deferred3_1 = len2;
424
+ return getStringFromWasm0(ptr2, len2);
425
+ } finally {
426
+ wasm.__wbindgen_add_to_stack_pointer(16);
427
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
428
+ }
429
+ }
362
430
  /**
363
431
  * Start a new instance of `process_id`, seeding it with the given variables
364
432
  * (a JSON object string; pass `"{}"` or `""` for none). `version` selects a
@@ -925,6 +993,86 @@ export class TestEngine {
925
993
  wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
926
994
  }
927
995
  }
996
+ /**
997
+ * The AgentHistory turns for `agent_instance_key`, as an
998
+ * `AgentInstanceHistorySearchQueryResult` JSON object (`{ items, page }`),
999
+ * in the engine's canonical `(loopIteration, producedAt, historyItemKey)`
1000
+ * order. `filter_json` is `{ commitStatus? }` where `commitStatus` is a REST
1001
+ * spelling or array of them; **omitting it defaults to COMMITTED only**
1002
+ * (PENDING/DISCARDED surface only when asked for explicitly). Accepts the
1003
+ * canonical REST envelope `{ "filter": { commitStatus? } }` as well as the
1004
+ * top-level shorthand. Mirrors
1005
+ * `POST /agent-instances/{agentInstanceKey}/history/search`.
1006
+ * @param {string} agent_instance_key
1007
+ * @param {string} filter_json
1008
+ * @returns {string}
1009
+ */
1010
+ searchAgentInstanceHistory(agent_instance_key, filter_json) {
1011
+ let deferred4_0;
1012
+ let deferred4_1;
1013
+ try {
1014
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1015
+ const ptr0 = passStringToWasm0(agent_instance_key, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1016
+ const len0 = WASM_VECTOR_LEN;
1017
+ const ptr1 = passStringToWasm0(filter_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1018
+ const len1 = WASM_VECTOR_LEN;
1019
+ wasm.testengine_searchAgentInstanceHistory(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
1020
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1021
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1022
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1023
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1024
+ var ptr3 = r0;
1025
+ var len3 = r1;
1026
+ if (r3) {
1027
+ ptr3 = 0; len3 = 0;
1028
+ throw takeObject(r2);
1029
+ }
1030
+ deferred4_0 = ptr3;
1031
+ deferred4_1 = len3;
1032
+ return getStringFromWasm0(ptr3, len3);
1033
+ } finally {
1034
+ wasm.__wbindgen_add_to_stack_pointer(16);
1035
+ wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
1036
+ }
1037
+ }
1038
+ /**
1039
+ * The AgentInstances matching an optional filter, as an
1040
+ * `AgentInstanceSearchQueryResult` JSON object (`{ items, page }`). The
1041
+ * filter is `{ agentInstanceKey?, agentDefinitionKey?, processInstanceKey?,
1042
+ * rootProcessInstanceKey?, processDefinitionKey?, status?, elementId?,
1043
+ * tenantId? }` (`status` a REST spelling, e.g. `"INITIALIZING"`); an
1044
+ * empty/absent filter returns every instance. Accepts the canonical REST
1045
+ * envelope `{ "filter": { … } }` as well as the top-level shorthand.
1046
+ * Mirrors `POST /agent-instances/search`.
1047
+ * @param {string} filter_json
1048
+ * @returns {string}
1049
+ */
1050
+ searchAgentInstances(filter_json) {
1051
+ let deferred3_0;
1052
+ let deferred3_1;
1053
+ try {
1054
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1055
+ const ptr0 = passStringToWasm0(filter_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1056
+ const len0 = WASM_VECTOR_LEN;
1057
+ wasm.testengine_searchAgentInstances(retptr, this.__wbg_ptr, ptr0, len0);
1058
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1059
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1060
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1061
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1062
+ var ptr2 = r0;
1063
+ var len2 = r1;
1064
+ if (r3) {
1065
+ ptr2 = 0; len2 = 0;
1066
+ throw takeObject(r2);
1067
+ }
1068
+ deferred3_0 = ptr2;
1069
+ deferred3_1 = len2;
1070
+ return getStringFromWasm0(ptr2, len2);
1071
+ } finally {
1072
+ wasm.__wbindgen_add_to_stack_pointer(16);
1073
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
1074
+ }
1075
+ }
928
1076
  /**
929
1077
  * All process instances, as a `ProcessInstanceSearchQueryResult` JSON object
930
1078
  * (`{ items: [...], page: {...} }`). The request body is shape-validated like
@@ -1201,6 +1349,51 @@ export class TestEngine {
1201
1349
  wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
1202
1350
  }
1203
1351
  }
1352
+ /**
1353
+ * Advance an AgentInstance: set its `status` (a REST spelling other than
1354
+ * `COMPLETED`, which is reachable only through `completeAgentInstance` and is
1355
+ * rejected here with a targeted error), accumulate `metrics`, optionally
1356
+ * replace `tools`, and append a `history` batch. `request_json` is
1357
+ * `{ agentInstanceKey, elementInstanceKey, elementId, processInstanceKey,
1358
+ * status?, metrics?, tools?, jobKey?, jobLease?, history? }`. `tools` is a
1359
+ * nullable changeset: omit it to leave the stored set unchanged, pass `null`
1360
+ * to clear it, or an array to replace it. `jobKey`/`jobLease` are the
1361
+ * activation's job attribution, stamped onto every appended turn (as the
1362
+ * gateway does). A turn is `{ loopIteration?, producedAt?, role?, content?,
1363
+ * systemPrompt?, historyItemId?, model?, provider? }`, where `producedAt` is
1364
+ * an RFC-3339 `date-time` string (the REST spelling; a bare epoch-millis
1365
+ * number is also accepted); `content` items are `{ contentType?, text?,
1366
+ * documentReference?, object? }`, where `object` is arbitrary JSON (the REST
1367
+ * wire shape). Returns the snapshot.
1368
+ * @param {string} request_json
1369
+ * @returns {string}
1370
+ */
1371
+ updateAgentInstance(request_json) {
1372
+ let deferred3_0;
1373
+ let deferred3_1;
1374
+ try {
1375
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1376
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1377
+ const len0 = WASM_VECTOR_LEN;
1378
+ wasm.testengine_updateAgentInstance(retptr, this.__wbg_ptr, ptr0, len0);
1379
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1380
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1381
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1382
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1383
+ var ptr2 = r0;
1384
+ var len2 = r1;
1385
+ if (r3) {
1386
+ ptr2 = 0; len2 = 0;
1387
+ throw takeObject(r2);
1388
+ }
1389
+ deferred3_0 = ptr2;
1390
+ deferred3_1 = len2;
1391
+ return getStringFromWasm0(ptr2, len2);
1392
+ } finally {
1393
+ wasm.__wbindgen_add_to_stack_pointer(16);
1394
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
1395
+ }
1396
+ }
1204
1397
  /**
1205
1398
  * Set a job's remaining retries by key. Used to recover a job parked on a
1206
1399
  * no-retries incident before resolving that incident; does not by itself
Binary file
@@ -7,10 +7,12 @@ 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_completeAgentInstance: (a: number, b: number, c: number, d: number) => void;
10
11
  export const testengine_completeAgentJob: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
11
12
  export const testengine_completeJob: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
12
13
  export const testengine_completeUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
13
14
  export const testengine_correlateMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
15
+ export const testengine_createAgentInstance: (a: number, b: number, c: number, d: number) => void;
14
16
  export const testengine_createInstance: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
15
17
  export const testengine_debugClear: (a: number) => void;
16
18
  export const testengine_debugCreateInstance: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
@@ -30,6 +32,8 @@ export const testengine_new: () => number;
30
32
  export const testengine_now: (a: number) => number;
31
33
  export const testengine_reset: (a: number) => void;
32
34
  export const testengine_resolveIncident: (a: number, b: number, c: number, d: number) => void;
35
+ export const testengine_searchAgentInstanceHistory: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
36
+ export const testengine_searchAgentInstances: (a: number, b: number, c: number, d: number) => void;
33
37
  export const testengine_searchProcessInstances: (a: number, b: number, c: number, d: number) => void;
34
38
  export const testengine_searchUserTasks: (a: number, b: number, c: number, d: number) => void;
35
39
  export const testengine_searchVariables: (a: number, b: number, c: number, d: number) => void;
@@ -38,6 +42,7 @@ export const testengine_snapshot: (a: number, b: number) => void;
38
42
  export const testengine_throwError: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
39
43
  export const testengine_tickNow: (a: number, b: number, c: number) => void;
40
44
  export const testengine_unassignUserTask: (a: number, b: number, c: number, d: number) => void;
45
+ export const testengine_updateAgentInstance: (a: number, b: number, c: number, d: number) => void;
41
46
  export const testengine_updateRetries: (a: number, b: number, c: number, d: number, e: number) => void;
42
47
  export const testengine_updateUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
43
48
  export const sqlite3_os_init: () => number;
@@ -4,6 +4,54 @@ export type ClientOptions = {
4
4
  baseUrl: '{schema}://{host}:{port}/v2' | (string & {});
5
5
  };
6
6
 
7
+ /**
8
+ * Advanced filter
9
+ *
10
+ * Advanced AgentInstanceHistoryCommitStatusEnum filter.
11
+ */
12
+ export type AdvancedAgentInstanceHistoryCommitStatusFilter = {
13
+ /**
14
+ * Checks for equality with the provided value.
15
+ */
16
+ $eq?: AgentInstanceHistoryCommitStatusEnum;
17
+ /**
18
+ * Checks for inequality with the provided value.
19
+ */
20
+ $neq?: AgentInstanceHistoryCommitStatusEnum;
21
+ /**
22
+ * Checks if the current property exists.
23
+ */
24
+ $exists?: boolean;
25
+ /**
26
+ * Checks if the property matches any of the provided values.
27
+ */
28
+ $in?: Array<AgentInstanceHistoryCommitStatusEnum>;
29
+ };
30
+
31
+ /**
32
+ * Advanced filter
33
+ *
34
+ * Advanced AgentInstanceHistoryRoleEnum filter.
35
+ */
36
+ export type AdvancedAgentInstanceHistoryRoleFilter = {
37
+ /**
38
+ * Checks for equality with the provided value.
39
+ */
40
+ $eq?: AgentInstanceHistoryRoleEnum;
41
+ /**
42
+ * Checks for inequality with the provided value.
43
+ */
44
+ $neq?: AgentInstanceHistoryRoleEnum;
45
+ /**
46
+ * Checks if the current property exists.
47
+ */
48
+ $exists?: boolean;
49
+ /**
50
+ * Checks if the property matches any of the provided values.
51
+ */
52
+ $in?: Array<AgentInstanceHistoryRoleEnum>;
53
+ };
54
+
7
55
  /**
8
56
  * Advanced filter
9
57
  *
@@ -29,6 +77,33 @@ export type AdvancedAgentInstanceStatusFilter = {
29
77
  $like?: LikeFilter;
30
78
  };
31
79
 
80
+ /**
81
+ * The type of a single content block.
82
+ */
83
+ export type AgentInstanceContentTypeEnum = 'TEXT' | 'DOCUMENT' | 'OBJECT';
84
+
85
+ /**
86
+ * The outcome of appending a single history item from an update request's history batch.
87
+ */
88
+ export type AgentInstanceCreatedHistoryItem = {
89
+ /**
90
+ * The historyItemId of the corresponding request item, echoed back for correlation.
91
+ */
92
+ historyItemId: string;
93
+ /**
94
+ * The system-generated key for the history item. When isDuplicate is true, this is
95
+ * the key of the original entry, not a new one.
96
+ *
97
+ */
98
+ historyItemKey: AgentHistoryKey;
99
+ /**
100
+ * True if this item had already been recorded and no new AGENT_HISTORY event was
101
+ * created for it; false if a new event was created.
102
+ *
103
+ */
104
+ isDuplicate: boolean;
105
+ };
106
+
32
107
  /**
33
108
  * Request to create a new agent instance.
34
109
  */
@@ -139,6 +214,250 @@ export type AgentInstanceFilter = {
139
214
  processDefinitionVersionTag?: StringFilterProperty;
140
215
  };
141
216
 
217
+ /**
218
+ * The commit status of a history item.
219
+ */
220
+ export type AgentInstanceHistoryCommitStatusEnum = 'COMMITTED' | 'PENDING' | 'DISCARDED';
221
+
222
+ /**
223
+ * AgentInstanceHistoryCommitStatusEnum property with full advanced search capabilities.
224
+ */
225
+ export type AgentInstanceHistoryCommitStatusFilterProperty = AgentInstanceHistoryCommitStatusEnum | AdvancedAgentInstanceHistoryCommitStatusFilter;
226
+
227
+ /**
228
+ * Agent instance history item search filter. When commitStatus is omitted, only
229
+ * COMMITTED history items are returned.
230
+ *
231
+ */
232
+ export type AgentInstanceHistoryFilter = {
233
+ /**
234
+ * The role of the history item.
235
+ */
236
+ role?: AgentInstanceHistoryRoleFilterProperty;
237
+ /**
238
+ * Filter by loop iteration number.
239
+ */
240
+ loopIteration?: IntegerFilterProperty;
241
+ /**
242
+ * The commit status of the history item. Defaults to COMMITTED only.
243
+ * Include PENDING or DISCARDED explicitly to debug in-flight or failed activations.
244
+ *
245
+ */
246
+ commitStatus?: AgentInstanceHistoryCommitStatusFilterProperty;
247
+ /**
248
+ * The timestamp when the history item was produced.
249
+ */
250
+ producedAt?: DateTimeFilterProperty;
251
+ };
252
+
253
+ /**
254
+ * A single history item to append to the agent instance's conversation history,
255
+ * submitted as part of the batch on an agent instance update request.
256
+ *
257
+ */
258
+ export type AgentInstanceHistoryItem = {
259
+ /**
260
+ * Caller-assigned identifier used to detect and dedupe retries of the same item.
261
+ * Must be non-blank.
262
+ *
263
+ */
264
+ historyItemId: string;
265
+ /**
266
+ * The loop iteration this item belongs to.
267
+ */
268
+ loopIteration: number;
269
+ /**
270
+ * The role of this history item in the conversation.
271
+ */
272
+ role: AgentInstanceHistoryRoleEnum;
273
+ /**
274
+ * The content blocks of this history item.
275
+ */
276
+ content: Array<AgentInstanceMessageContent>;
277
+ /**
278
+ * Tool calls associated with this history item.
279
+ */
280
+ toolCalls?: Array<AgentInstanceToolCall> | null;
281
+ /**
282
+ * Per-call token and latency metrics. Present on ASSISTANT items only.
283
+ */
284
+ metrics?: AgentInstanceHistoryItemMetrics | null;
285
+ /**
286
+ * The agent-side timestamp of when this message was produced.
287
+ */
288
+ producedAt: string;
289
+ /**
290
+ * The complete list of tools available to the agent as of this entry. CONFIGURATION items only.
291
+ */
292
+ tools?: Array<AgentTool> | null;
293
+ /**
294
+ * The LLM model identifier as of this entry. CONFIGURATION items only.
295
+ */
296
+ model?: string | null;
297
+ /**
298
+ * The LLM provider as of this entry. CONFIGURATION items only.
299
+ */
300
+ provider?: string | null;
301
+ /**
302
+ * The operational limits as of this entry. CONFIGURATION items only.
303
+ */
304
+ limits?: AgentInstanceLimits;
305
+ /**
306
+ * The system prompt as of this entry. CONFIGURATION items only.
307
+ */
308
+ systemPrompt?: string | null;
309
+ };
310
+
311
+ /**
312
+ * Per-call token and latency metrics for an ASSISTANT history item.
313
+ */
314
+ export type AgentInstanceHistoryItemMetrics = {
315
+ /**
316
+ * Input tokens consumed by this LLM call.
317
+ */
318
+ inputTokens: number | null;
319
+ /**
320
+ * Output tokens produced by this LLM call.
321
+ */
322
+ outputTokens: number | null;
323
+ /**
324
+ * Wall-clock duration of the LLM call in milliseconds.
325
+ */
326
+ durationMs: number | null;
327
+ };
328
+
329
+ /**
330
+ * A single conversation history item belonging to an agent instance.
331
+ */
332
+ export type AgentInstanceHistoryItemResult = {
333
+ /**
334
+ * The unique key for this history item. Stable and sortable by creation order.
335
+ */
336
+ historyItemKey: AgentHistoryKey;
337
+ /**
338
+ * The client-supplied identifier this item was created with. Empty when none.
339
+ */
340
+ historyItemId: string;
341
+ /**
342
+ * The key of the agent instance this item belongs to.
343
+ */
344
+ agentInstanceKey: AgentInstanceKey;
345
+ /**
346
+ * The element instance under which this item was produced.
347
+ */
348
+ elementInstanceKey: ElementInstanceKey;
349
+ /**
350
+ * The owning process instance key.
351
+ */
352
+ processInstanceKey: ProcessInstanceKey;
353
+ /**
354
+ * The root process instance key.
355
+ */
356
+ rootProcessInstanceKey: ProcessInstanceKey;
357
+ /**
358
+ * The process definition key.
359
+ */
360
+ processDefinitionKey: ProcessDefinitionKey;
361
+ /**
362
+ * The BPMN process ID of the process definition.
363
+ */
364
+ processDefinitionId: ProcessDefinitionId;
365
+ /**
366
+ * The tenant ID of this history item.
367
+ */
368
+ tenantId: TenantId;
369
+ /**
370
+ * The key of the job activation during which this item was produced.
371
+ */
372
+ jobKey: JobKey;
373
+ /**
374
+ * The loop iteration this item belongs to.
375
+ */
376
+ loopIteration: number;
377
+ /**
378
+ * The role of this history item in the conversation.
379
+ */
380
+ role: AgentInstanceHistoryRoleEnum;
381
+ /**
382
+ * The content blocks of this history item.
383
+ */
384
+ content: Array<AgentInstanceMessageContent>;
385
+ /**
386
+ * Tool calls for this item.
387
+ */
388
+ toolCalls: Array<AgentInstanceToolCall>;
389
+ /**
390
+ * Per-call token and latency metrics. Present on ASSISTANT items (zeroed when the request omitted metrics at creation time); null for USER, TOOL_RESULT, and CONFIGURATION turns.
391
+ */
392
+ metrics: AgentInstanceHistoryItemMetrics | null;
393
+ /**
394
+ * The commit status of this history item.
395
+ */
396
+ commitStatus: AgentInstanceHistoryCommitStatusEnum;
397
+ /**
398
+ * The agent-side timestamp of when this message was produced.
399
+ */
400
+ producedAt: string;
401
+ /**
402
+ * The complete list of tools available to the agent as of this entry.
403
+ */
404
+ tools: Array<AgentTool>;
405
+ /**
406
+ * The LLM model identifier as of this entry.
407
+ */
408
+ model: string | null;
409
+ /**
410
+ * The LLM provider as of this entry.
411
+ */
412
+ provider: string | null;
413
+ /**
414
+ * Whether this item was recorded as a duplicate of an earlier one.
415
+ */
416
+ isDuplicate: boolean;
417
+ };
418
+
419
+ /**
420
+ * The role of a history item in the agent conversation.
421
+ */
422
+ export type AgentInstanceHistoryRoleEnum = 'USER' | 'ASSISTANT' | 'TOOL_RESULT' | 'CONFIGURATION';
423
+
424
+ /**
425
+ * AgentInstanceHistoryRoleEnum property with full advanced search capabilities.
426
+ */
427
+ export type AgentInstanceHistoryRoleFilterProperty = AgentInstanceHistoryRoleEnum | AdvancedAgentInstanceHistoryRoleFilter;
428
+
429
+ /**
430
+ * Agent instance history search request.
431
+ */
432
+ export type AgentInstanceHistorySearchQuery = SearchQueryRequest & {
433
+ /**
434
+ * Sort field criteria.
435
+ */
436
+ sort?: Array<AgentInstanceHistorySearchQuerySortRequest>;
437
+ /**
438
+ * The history item search filters.
439
+ */
440
+ filter?: AgentInstanceHistoryFilter;
441
+ };
442
+
443
+ /**
444
+ * Agent instance history search response.
445
+ */
446
+ export type AgentInstanceHistorySearchQueryResult = SearchQueryResponse & {
447
+ /**
448
+ * The matching history items.
449
+ */
450
+ items: Array<AgentInstanceHistoryItemResult>;
451
+ };
452
+
453
+ export type AgentInstanceHistorySearchQuerySortRequest = {
454
+ /**
455
+ * The field to sort by.
456
+ */
457
+ field: 'producedAt' | 'historyItemKey' | 'loopIteration';
458
+ order?: SortOrderEnum;
459
+ };
460
+
142
461
  /**
143
462
  * The configured limits for an agent instance, set once at creation.
144
463
  */
@@ -157,6 +476,31 @@ export type AgentInstanceLimits = {
157
476
  maxTokens: number;
158
477
  };
159
478
 
479
+ /**
480
+ * A single content block within a history item. The `contentType` discriminator selects which
481
+ * payload field carries the content: TEXT → `text`, DOCUMENT → `documentReference`,
482
+ * OBJECT → `object`.
483
+ *
484
+ */
485
+ export type AgentInstanceMessageContent = {
486
+ /**
487
+ * Which payload field carries this block's content.
488
+ */
489
+ contentType: AgentInstanceContentTypeEnum;
490
+ /**
491
+ * The plain-text payload. Present when contentType is TEXT.
492
+ */
493
+ text?: string | null;
494
+ /**
495
+ * An opaque reference to a stored document. Present when contentType is DOCUMENT.
496
+ */
497
+ documentReference?: string | null;
498
+ /**
499
+ * Arbitrary structured content (any valid JSON value). Present when contentType is OBJECT.
500
+ */
501
+ object?: unknown;
502
+ };
503
+
160
504
  /**
161
505
  * Aggregated metrics for an agent instance across all model calls.
162
506
  */
@@ -306,7 +650,7 @@ export type AgentInstanceSearchQuerySortRequest = {
306
650
  /**
307
651
  * The field to sort by.
308
652
  */
309
- field: 'creationDate' | 'lastUpdatedDate' | 'completionDate' | 'status';
653
+ field: 'agentInstanceKey' | 'agentDefinitionKey' | 'status' | 'elementId' | 'processInstanceKey' | 'rootProcessInstanceKey' | 'processDefinitionKey' | 'tenantId' | 'creationDate' | 'lastUpdatedDate' | 'completionDate';
310
654
  order?: SortOrderEnum;
311
655
  };
312
656
 
@@ -321,7 +665,33 @@ export type AgentInstanceStatusEnum = 'UNKNOWN' | 'COMPLETED' | 'IDLE' | 'INITIA
321
665
  export type AgentInstanceStatusFilterProperty = AgentInstanceStatusEnum | AdvancedAgentInstanceStatusFilter;
322
666
 
323
667
  /**
324
- * Request to update the mutable state of an agent instance.
668
+ * A tool call associated with a history item.
669
+ */
670
+ export type AgentInstanceToolCall = {
671
+ /**
672
+ * The LLM-assigned tool call ID.
673
+ */
674
+ toolCallId: string;
675
+ /**
676
+ * The LLM-visible tool name.
677
+ */
678
+ toolName: string;
679
+ /**
680
+ * The BPMN element ID handling this tool.
681
+ */
682
+ elementId: string | null;
683
+ /**
684
+ * The tool call arguments as provided by the LLM.
685
+ */
686
+ arguments: {
687
+ [key: string]: unknown;
688
+ } | null;
689
+ };
690
+
691
+ /**
692
+ * Request to update the mutable state of an agent instance: advance its status and
693
+ * append a batch of history items to its conversation history. Each created history
694
+ * item is echoed back in the response's createdHistory, positionally correlated.
325
695
  *
326
696
  */
327
697
  export type AgentInstanceUpdateRequest = {
@@ -338,17 +708,55 @@ export type AgentInstanceUpdateRequest = {
338
708
  * The new status of the agent instance.
339
709
  */
340
710
  status?: AgentInstanceUpdateStatusEnum;
711
+ /**
712
+ * The key of the job activation during which this update is being made. Attributed
713
+ * to each appended history item so a later retry can supersede in-flight items.
714
+ *
715
+ */
716
+ jobKey?: JobKey;
717
+ /**
718
+ * Lease token received from the job activation response, disambiguating this
719
+ * activation from any other of the same job. It is the activation's lease
720
+ * deadline serialized as a decimal string (an unsigned 64-bit integer), so
721
+ * the server rejects any non-numeric value with 400.
722
+ *
723
+ */
724
+ jobLease?: string;
341
725
  /**
342
726
  * Metric increments to apply to the aggregate counters.
343
727
  */
344
728
  metrics?: AgentInstanceMetricsDelta;
345
729
  /**
346
- * The complete list of tools available to the agent, replacing any previously
347
- * stored tools. When provided, the engine replaces the existing tool list with
348
- * this value.
730
+ * The complete list of tools available to the agent. Interpreted as a nullable
731
+ * changeset with three distinct cases:
732
+ * * omitted (field absent) — no change; the stored tool list is left untouched.
733
+ * * null — clears the tool set, replacing any previously stored tools with an
734
+ * empty list.
735
+ * * array — replaces the existing tool list with exactly this value.
736
+ * Note that null and an empty array are equivalent (both clear the set); omitting
737
+ * the field is the only way to leave the existing tools unchanged.
349
738
  *
350
739
  */
351
740
  tools?: Array<AgentTool> | null;
741
+ /**
742
+ * A batch of history items to append to the agent instance's conversation history,
743
+ * in request order. Each created item is echoed back in the response's createdHistory,
744
+ * positionally correlated.
745
+ *
746
+ */
747
+ history?: Array<AgentInstanceHistoryItem> | null;
748
+ };
749
+
750
+ /**
751
+ * Response returned after successfully updating an agent instance.
752
+ */
753
+ export type AgentInstanceUpdateResult = {
754
+ /**
755
+ * One entry per history item submitted in the request, in request order.
756
+ * Empty when no history items were submitted.
757
+ *
758
+ */
759
+ createdHistory: Array<AgentInstanceCreatedHistoryItem>;
352
760
  };
353
761
 
354
762
  /**
@@ -381,6 +789,8 @@ export type _1AgentInstances1Search = unknown;
381
789
 
382
790
  export type _1AgentInstances1AgentInstanceKey = unknown;
383
791
 
792
+ export type _1AgentInstances1AgentInstanceKey1History1Search = unknown;
793
+
384
794
  /**
385
795
  * Advanced filter
386
796
  *
@@ -3418,6 +3828,10 @@ export type ElementInstanceWaitStateResult = {
3418
3828
  * Message details, present when waitStateType is MESSAGE.
3419
3829
  */
3420
3830
  messageDetails: MessageWaitStateDetails | null;
3831
+ /**
3832
+ * User task details, present when waitStateType is USER_TASK.
3833
+ */
3834
+ userTaskDetails: UserTaskWaitStateDetails | null;
3421
3835
  };
3422
3836
 
3423
3837
  export type JobWaitStateDetails = {
@@ -3454,6 +3868,17 @@ export type MessageWaitStateDetails = {
3454
3868
  correlationKey: string | null;
3455
3869
  };
3456
3870
 
3871
+ export type UserTaskWaitStateDetails = {
3872
+ /**
3873
+ * The key of the user task.
3874
+ */
3875
+ taskKey: UserTaskKey;
3876
+ /**
3877
+ * The due date of the user task, if set.
3878
+ */
3879
+ dueDate: string | null;
3880
+ };
3881
+
3457
3882
  /**
3458
3883
  * The BPMN element type of a waiting element instance.
3459
3884
  */
@@ -3467,7 +3892,7 @@ export type WaitStateElementTypeFilterProperty = WaitStateElementTypeEnum | Adva
3467
3892
  /**
3468
3893
  * The type of waiting state an element instance is in.
3469
3894
  */
3470
- export type WaitStateTypeEnum = 'JOB' | 'MESSAGE';
3895
+ export type WaitStateTypeEnum = 'JOB' | 'MESSAGE' | 'USER_TASK';
3471
3896
 
3472
3897
  /**
3473
3898
  * Wait state type property with full advanced search capabilities.
@@ -5519,6 +5944,11 @@ export type JobSearchResult = {
5519
5944
  *
5520
5945
  */
5521
5946
  priority: number;
5947
+ /**
5948
+ * nano extension (not part of the Camunda 8 API). The declared read-set — the `fetchVariables` names the worker asked for on the most recent durable activation of this job that declared a non-empty set — recorded on the `JobActivated` event as engine-native read provenance for post-hoc reification / data-dependency analysis. It is not cleared by a subsequent fetch-all re-activation. `null`/absent when no durable activation has declared a set (fetch-all / undeclared reads) or the activation was not durably recorded (e.g. leader-local activation, which does not export `JobActivated`).
5949
+ *
5950
+ */
5951
+ fetchedVariables?: Array<string> | null;
5522
5952
  };
5523
5953
 
5524
5954
  /**
@@ -5992,6 +6422,11 @@ export type AdvancedVariableKeyFilter = {
5992
6422
  $notIn?: Array<VariableKey>;
5993
6423
  };
5994
6424
 
6425
+ /**
6426
+ * System-generated key for an agent instance history item.
6427
+ */
6428
+ export type AgentHistoryKey = LongKey;
6429
+
5995
6430
  /**
5996
6431
  * System-generated key for an agent instance.
5997
6432
  */
@@ -9725,7 +10160,7 @@ export type UpdateAgentInstanceResponses = {
9725
10160
  /**
9726
10161
  * The agent instance was updated successfully.
9727
10162
  */
9728
- 204: void;
10163
+ 200: AgentInstanceUpdateResult;
9729
10164
  };
9730
10165
 
9731
10166
  export type UpdateAgentInstanceResponse = UpdateAgentInstanceResponses[keyof UpdateAgentInstanceResponses];
@@ -9767,6 +10202,48 @@ export type SearchAgentInstancesResponses = {
9767
10202
 
9768
10203
  export type SearchAgentInstancesResponse = SearchAgentInstancesResponses[keyof SearchAgentInstancesResponses];
9769
10204
 
10205
+ export type SearchAgentInstanceHistoryData = {
10206
+ body?: AgentInstanceHistorySearchQuery;
10207
+ path: {
10208
+ /**
10209
+ * The key of the agent instance whose history to search.
10210
+ */
10211
+ agentInstanceKey: AgentInstanceKey;
10212
+ };
10213
+ query?: never;
10214
+ url: '/agent-instances/{agentInstanceKey}/history/search';
10215
+ };
10216
+
10217
+ export type SearchAgentInstanceHistoryErrors = {
10218
+ /**
10219
+ * The provided data is not valid.
10220
+ */
10221
+ 400: ProblemDetail;
10222
+ /**
10223
+ * The request lacks valid authentication credentials.
10224
+ */
10225
+ 401: ProblemDetail;
10226
+ /**
10227
+ * Forbidden. The request is not allowed.
10228
+ */
10229
+ 403: ProblemDetail;
10230
+ /**
10231
+ * An internal error occurred while processing the request.
10232
+ */
10233
+ 500: ProblemDetail;
10234
+ };
10235
+
10236
+ export type SearchAgentInstanceHistoryError = SearchAgentInstanceHistoryErrors[keyof SearchAgentInstanceHistoryErrors];
10237
+
10238
+ export type SearchAgentInstanceHistoryResponses = {
10239
+ /**
10240
+ * The agent instance history search result.
10241
+ */
10242
+ 200: AgentInstanceHistorySearchQueryResult;
10243
+ };
10244
+
10245
+ export type SearchAgentInstanceHistoryResponse = SearchAgentInstanceHistoryResponses[keyof SearchAgentInstanceHistoryResponses];
10246
+
9770
10247
  export type SearchAuditLogsData = {
9771
10248
  body?: AuditLogSearchQueryRequest;
9772
10249
  path?: never;