@nanobpm/engine-wasm 0.8.6 → 0.9.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.
@@ -78,27 +78,26 @@ export type AdvancedAgentInstanceStatusFilter = {
78
78
  };
79
79
 
80
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.
81
+ * The outcome of appending a single history item from an update request's
82
+ * history batch.
83
+ *
87
84
  */
88
85
  export type AgentInstanceCreatedHistoryItem = {
89
86
  /**
90
- * The historyItemId of the corresponding request item, echoed back for correlation.
87
+ * The historyItemId of the corresponding item in the request, echoed back
88
+ * so callers can correlate response entries with request items by id.
89
+ *
91
90
  */
92
91
  historyItemId: string;
93
92
  /**
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.
93
+ * The system-generated key for the history item. When isDuplicate is true,
94
+ * this is the key of the original entry, not a new one.
96
95
  *
97
96
  */
98
- historyItemKey: AgentHistoryKey;
97
+ historyItemKey: AgentHistoryItemKey;
99
98
  /**
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.
99
+ * True if this item had already been recorded and no new AGENT_HISTORY event
100
+ * was created for it; false if a new event was created.
102
101
  *
103
102
  */
104
103
  isDuplicate: boolean;
@@ -109,22 +108,35 @@ export type AgentInstanceCreatedHistoryItem = {
109
108
  */
110
109
  export type AgentInstanceCreationRequest = {
111
110
  /**
112
- * The key of the AHSP or AI Agent Task element instance.
111
+ * The key of the AI Agent Sub-process or AI Agent Task element instance.
113
112
  * The engine uses this key to infer processInstanceKey, elementId,
114
113
  * processDefinitionKey, and tenantId.
115
114
  *
116
115
  */
117
116
  elementInstanceKey: ElementInstanceKey;
118
117
  /**
119
- * Static definition set once at creation.
118
+ * The key of the job activation during which this creation is being made.
119
+ * A creation must always be attributed to the active job that produced it.
120
+ *
120
121
  */
121
- definition: AgentInstanceDefinition;
122
+ jobKey: JobKey;
122
123
  /**
123
- * Limits for the agent execution. When omitted, all limits default to -1
124
- * (no limit).
124
+ * Opaque lease token received from the job activation response. Disambiguates
125
+ * this activation from any other activation of the same job: if the job is
126
+ * later retried, history items submitted under a superseded lease are discarded
127
+ * rather than committed.
125
128
  *
126
129
  */
127
- limits?: AgentInstanceLimits;
130
+ jobLease: string;
131
+ /**
132
+ * A batch of history items to append to the agent instance's conversation
133
+ * history, in request order. Each created item is echoed back in the
134
+ * response's createdHistory, positionally correlated. Must include a
135
+ * CONFIGURATION item establishing model, provider, and systemPrompt (and,
136
+ * if needed, limits).
137
+ *
138
+ */
139
+ history: Array<AgentInstanceHistoryItem>;
128
140
  };
129
141
 
130
142
  /**
@@ -135,12 +147,19 @@ export type AgentInstanceCreationResult = {
135
147
  * The system-generated key for the created agent instance.
136
148
  */
137
149
  agentInstanceKey: AgentInstanceKey;
150
+ /**
151
+ * One entry per history item submitted in the request, in request order.
152
+ *
153
+ */
154
+ createdHistory: Array<AgentInstanceCreatedHistoryItem>;
138
155
  };
139
156
 
140
157
  /**
141
- * The static definition of an agent instance, set once at creation.
158
+ * The definition of an agent instance. Set at creation, but can change later via a
159
+ * CONFIGURATION history item.
160
+ *
142
161
  */
143
- export type AgentInstanceDefinition = {
162
+ export type AgentInstanceDefinitionResult = {
144
163
  /**
145
164
  * The LLM model identifier (for example, gpt-4o).
146
165
  */
@@ -150,9 +169,25 @@ export type AgentInstanceDefinition = {
150
169
  */
151
170
  provider: string;
152
171
  /**
153
- * The system prompt configured for this agent instance.
172
+ * The system prompt configured for this agent instance, as content blocks.
173
+ */
174
+ systemPrompt: Array<AgentInstanceMessageContent>;
175
+ };
176
+
177
+ /**
178
+ * Document content
179
+ *
180
+ * A Camunda Document Store reference content block.
181
+ */
182
+ export type AgentInstanceDocumentContent = {
183
+ /**
184
+ * The content type discriminator.
185
+ */
186
+ contentType: string;
187
+ /**
188
+ * A reference to a document stored in the Camunda Document Store.
154
189
  */
155
- systemPrompt: string;
190
+ documentReference: DocumentReference;
156
191
  };
157
192
 
158
193
  /**
@@ -163,6 +198,10 @@ export type AgentInstanceFilter = {
163
198
  * The unique key of the agent instance.
164
199
  */
165
200
  agentInstanceKey?: AgentInstanceKeyFilterProperty;
201
+ /**
202
+ * The key of the agent definition this agent instance is an instance of.
203
+ */
204
+ agentDefinitionKey?: AgentDefinitionKeyFilterProperty;
166
205
  /**
167
206
  * The current status of the agent instance.
168
207
  */
@@ -175,6 +214,13 @@ export type AgentInstanceFilter = {
175
214
  * The key of the process instance that owns this agent instance.
176
215
  */
177
216
  processInstanceKey?: ProcessInstanceKeyFilterProperty;
217
+ /**
218
+ * The key of the root process instance. Filters agent instances belonging to a specific
219
+ * call hierarchy. The root process instance is the top-level ancestor in the process
220
+ * instance hierarchy.
221
+ *
222
+ */
223
+ rootProcessInstanceKey?: ProcessInstanceKeyFilterProperty;
178
224
  /**
179
225
  * The key of the process definition associated with this agent instance.
180
226
  */
@@ -216,6 +262,10 @@ export type AgentInstanceFilter = {
216
262
 
217
263
  /**
218
264
  * The commit status of a history item.
265
+ * COMMITTED: the producing job completed successfully.
266
+ * PENDING: the producing job is still active (in-flight).
267
+ * DISCARDED: the producing job failed; this item was superseded by a later activation.
268
+ *
219
269
  */
220
270
  export type AgentInstanceHistoryCommitStatusEnum = 'COMMITTED' | 'PENDING' | 'DISCARDED';
221
271
 
@@ -225,15 +275,25 @@ export type AgentInstanceHistoryCommitStatusEnum = 'COMMITTED' | 'PENDING' | 'DI
225
275
  export type AgentInstanceHistoryCommitStatusFilterProperty = AgentInstanceHistoryCommitStatusEnum | AdvancedAgentInstanceHistoryCommitStatusFilter;
226
276
 
227
277
  /**
228
- * Agent instance history item search filter. When commitStatus is omitted, only
229
- * COMMITTED history items are returned.
230
- *
278
+ * Agent instance history item search filter.
231
279
  */
232
280
  export type AgentInstanceHistoryFilter = {
281
+ /**
282
+ * The unique key of the history item.
283
+ */
284
+ historyItemKey?: AgentHistoryItemKeyFilterProperty;
233
285
  /**
234
286
  * The role of the history item.
235
287
  */
236
288
  role?: AgentInstanceHistoryRoleFilterProperty;
289
+ /**
290
+ * The key of the element instance under which the history item was produced.
291
+ */
292
+ elementInstanceKey?: ElementInstanceKeyFilterProperty;
293
+ /**
294
+ * The key of the job activation that produced the history item.
295
+ */
296
+ jobKey?: JobKeyFilterProperty;
237
297
  /**
238
298
  * Filter by loop iteration number.
239
299
  */
@@ -257,15 +317,17 @@ export type AgentInstanceHistoryFilter = {
257
317
  */
258
318
  export type AgentInstanceHistoryItem = {
259
319
  /**
260
- * Caller-assigned identifier used to detect and dedupe retries of the same item.
261
- * Must be non-blank.
320
+ * Caller-assigned identifier used to detect and dedupe retries of the same
321
+ * item. For example, when a retried job activation resubmits history items
322
+ * it already sent in an earlier attempt, those items are not rejected; they
323
+ * are flagged via isDuplicate in the response instead. Must be non-blank.
262
324
  *
263
325
  */
264
326
  historyItemId: string;
265
327
  /**
266
328
  * The loop iteration this item belongs to.
267
329
  */
268
- loopIteration: number;
330
+ loopIteration: LoopIterationId;
269
331
  /**
270
332
  * The role of this history item in the conversation.
271
333
  */
@@ -276,6 +338,10 @@ export type AgentInstanceHistoryItem = {
276
338
  content: Array<AgentInstanceMessageContent>;
277
339
  /**
278
340
  * Tool calls associated with this history item.
341
+ * For ASSISTANT items: tool calls dispatched by this LLM response.
342
+ * For TOOL_RESULT items: single-entry array referencing the originating tool call.
343
+ * Omit for USER items.
344
+ *
279
345
  */
280
346
  toolCalls?: Array<AgentInstanceToolCall> | null;
281
347
  /**
@@ -287,25 +353,36 @@ export type AgentInstanceHistoryItem = {
287
353
  */
288
354
  producedAt: string;
289
355
  /**
290
- * The complete list of tools available to the agent as of this entry. CONFIGURATION items only.
356
+ * The complete list of tools available to the agent as of this entry. CONFIGURATION
357
+ * items only; omit for other roles. Omit to leave the tool list unchanged; send an
358
+ * empty array to clear it.
359
+ *
291
360
  */
292
361
  tools?: Array<AgentTool> | null;
293
362
  /**
294
- * The LLM model identifier as of this entry. CONFIGURATION items only.
363
+ * The LLM model identifier as of this entry. CONFIGURATION items only; omit for other
364
+ * roles.
365
+ *
295
366
  */
296
- model?: string | null;
367
+ model?: string;
297
368
  /**
298
- * The LLM provider as of this entry. CONFIGURATION items only.
369
+ * The LLM provider as of this entry. CONFIGURATION items only; omit for other roles.
370
+ *
299
371
  */
300
- provider?: string | null;
372
+ provider?: string;
301
373
  /**
302
- * The operational limits as of this entry. CONFIGURATION items only.
374
+ * The operational limits as of this entry. CONFIGURATION items only; omit for other
375
+ * roles.
376
+ *
303
377
  */
304
378
  limits?: AgentInstanceLimits;
305
379
  /**
306
- * The system prompt as of this entry. CONFIGURATION items only.
380
+ * The system prompt, as content blocks, as of this entry. CONFIGURATION items only;
381
+ * omit for other roles. Omit to leave the system prompt unchanged; when present, must
382
+ * be non-empty.
383
+ *
307
384
  */
308
- systemPrompt?: string | null;
385
+ systemPrompt?: Array<AgentInstanceMessageContent> | null;
309
386
  };
310
387
 
311
388
  /**
@@ -313,15 +390,15 @@ export type AgentInstanceHistoryItem = {
313
390
  */
314
391
  export type AgentInstanceHistoryItemMetrics = {
315
392
  /**
316
- * Input tokens consumed by this LLM call.
393
+ * Input tokens consumed by this LLM call. Null when not provided.
317
394
  */
318
395
  inputTokens: number | null;
319
396
  /**
320
- * Output tokens produced by this LLM call.
397
+ * Output tokens produced by this LLM call. Null when not provided.
321
398
  */
322
399
  outputTokens: number | null;
323
400
  /**
324
- * Wall-clock duration of the LLM call in milliseconds.
401
+ * Wall-clock duration of the LLM call in milliseconds. Null when not provided.
325
402
  */
326
403
  durationMs: number | null;
327
404
  };
@@ -333,9 +410,11 @@ export type AgentInstanceHistoryItemResult = {
333
410
  /**
334
411
  * The unique key for this history item. Stable and sortable by creation order.
335
412
  */
336
- historyItemKey: AgentHistoryKey;
413
+ historyItemKey: AgentHistoryItemKey;
337
414
  /**
338
- * The client-supplied identifier this item was created with. Empty when none.
415
+ * The client-supplied identifier this item was created with. Empty for items that don't
416
+ * carry one.
417
+ *
339
418
  */
340
419
  historyItemId: string;
341
420
  /**
@@ -343,37 +422,21 @@ export type AgentInstanceHistoryItemResult = {
343
422
  */
344
423
  agentInstanceKey: AgentInstanceKey;
345
424
  /**
346
- * The element instance under which this item was produced.
425
+ * The key of the AI Agent Task or ad-hoc sub-process element instance under which this item was produced.
347
426
  */
348
427
  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
428
  /**
370
429
  * The key of the job activation during which this item was produced.
371
430
  */
372
431
  jobKey: JobKey;
432
+ /**
433
+ * The lease token of the activation that produced this item.
434
+ */
435
+ jobLease: string;
373
436
  /**
374
437
  * The loop iteration this item belongs to.
375
438
  */
376
- loopIteration: number;
439
+ loopIteration: LoopIterationId;
377
440
  /**
378
441
  * The role of this history item in the conversation.
379
442
  */
@@ -383,11 +446,14 @@ export type AgentInstanceHistoryItemResult = {
383
446
  */
384
447
  content: Array<AgentInstanceMessageContent>;
385
448
  /**
386
- * Tool calls for this item.
449
+ * Tool calls for this item. Empty for USER items and ASSISTANT items with no tool dispatches.
450
+ * ASSISTANT items: dispatched tool calls.
451
+ * TOOL_RESULT items: single-entry array referencing the originating tool call.
452
+ *
387
453
  */
388
454
  toolCalls: Array<AgentInstanceToolCall>;
389
455
  /**
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.
456
+ * Per-call token and latency metrics. Null when metrics were not provided at creation time.
391
457
  */
392
458
  metrics: AgentInstanceHistoryItemMetrics | null;
393
459
  /**
@@ -399,21 +465,34 @@ export type AgentInstanceHistoryItemResult = {
399
465
  */
400
466
  producedAt: string;
401
467
  /**
402
- * The complete list of tools available to the agent as of this entry.
468
+ * The complete list of tools available to the agent as of this entry. CONFIGURATION
469
+ * items only; empty for other roles.
470
+ *
403
471
  */
404
472
  tools: Array<AgentTool>;
405
473
  /**
406
- * The LLM model identifier as of this entry.
474
+ * The LLM model identifier as of this entry. CONFIGURATION items only; null for other
475
+ * roles.
476
+ *
407
477
  */
408
478
  model: string | null;
409
479
  /**
410
- * The LLM provider as of this entry.
480
+ * The LLM provider as of this entry. CONFIGURATION items only; null for other roles.
481
+ *
411
482
  */
412
483
  provider: string | null;
413
484
  /**
414
- * Whether this item was recorded as a duplicate of an earlier one.
485
+ * The operational limits as of this entry. CONFIGURATION items only; -1 on any field
486
+ * means "no limit configured" for other roles.
487
+ *
415
488
  */
416
- isDuplicate: boolean;
489
+ limits: AgentInstanceLimits;
490
+ /**
491
+ * The system prompt, as content blocks, as of this entry. CONFIGURATION items only;
492
+ * empty for other roles.
493
+ *
494
+ */
495
+ systemPrompt: Array<AgentInstanceMessageContent>;
417
496
  };
418
497
 
419
498
  /**
@@ -477,29 +556,15 @@ export type AgentInstanceLimits = {
477
556
  };
478
557
 
479
558
  /**
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
- *
559
+ * A single content block within a history item. Discriminated by `contentType`.
484
560
  */
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
- };
561
+ export type AgentInstanceMessageContent = ({
562
+ contentType: 'TEXT';
563
+ } & AgentInstanceTextContent) | ({
564
+ contentType: 'DOCUMENT';
565
+ } & AgentInstanceDocumentContent) | ({
566
+ contentType: 'OBJECT';
567
+ } & AgentInstanceObjectContent);
503
568
 
504
569
  /**
505
570
  * Aggregated metrics for an agent instance across all model calls.
@@ -524,28 +589,23 @@ export type AgentInstanceMetrics = {
524
589
  };
525
590
 
526
591
  /**
527
- * Metric increments to apply to the agent instance aggregate counters. The engine
528
- * accumulates these deltas into running totals on each UPDATED event. All fields
529
- * are optional; omit a field to leave the corresponding counter unchanged.
592
+ * Object content
593
+ *
594
+ * An arbitrary structured content block. Accepts any valid JSON value:
595
+ * objects, arrays, numbers, booleans, or strings.
596
+ * Use TEXT content for human-readable natural language;
597
+ * use OBJECT content for machine-readable structured data.
530
598
  *
531
599
  */
532
- export type AgentInstanceMetricsDelta = {
533
- /**
534
- * Increment to apply to the total input token counter.
535
- */
536
- inputTokens?: number;
600
+ export type AgentInstanceObjectContent = {
537
601
  /**
538
- * Increment to apply to the total output token counter.
602
+ * The content type discriminator.
539
603
  */
540
- outputTokens?: number;
541
- /**
542
- * Increment to apply to the total model call counter.
543
- */
544
- modelCalls?: number;
604
+ contentType: string;
545
605
  /**
546
- * Increment to apply to the total tool call counter.
606
+ * Arbitrary structured content — any valid JSON value (object, array, number, boolean, or string).
547
607
  */
548
- toolCalls?: number;
608
+ object: unknown;
549
609
  };
550
610
 
551
611
  export type AgentInstanceResult = {
@@ -553,13 +613,19 @@ export type AgentInstanceResult = {
553
613
  * The unique key for this agent instance.
554
614
  */
555
615
  agentInstanceKey: AgentInstanceKey;
616
+ /**
617
+ * The key of the agent definition this agent instance is an instance of.
618
+ */
619
+ agentDefinitionKey: AgentDefinitionKey;
556
620
  status: AgentInstanceStatusEnum;
557
621
  /**
558
- * The static definition of the agent, including model, provider, and system prompt.
622
+ * The definition of the agent, including model, provider, and system prompt. Set at
623
+ * creation, but can change later via a CONFIGURATION history item.
624
+ *
559
625
  */
560
- definition: AgentInstanceDefinition;
626
+ definition: AgentInstanceDefinitionResult;
561
627
  /**
562
- * Aggregated metrics across all iterations of this agent instance.
628
+ * Aggregated metrics across all loopIterations of this agent instance.
563
629
  */
564
630
  metrics: AgentInstanceMetrics;
565
631
  /**
@@ -665,11 +731,28 @@ export type AgentInstanceStatusEnum = 'UNKNOWN' | 'COMPLETED' | 'IDLE' | 'INITIA
665
731
  export type AgentInstanceStatusFilterProperty = AgentInstanceStatusEnum | AdvancedAgentInstanceStatusFilter;
666
732
 
667
733
  /**
668
- * A tool call associated with a history item.
734
+ * Text content
735
+ *
736
+ * A plain-text content block.
737
+ */
738
+ export type AgentInstanceTextContent = {
739
+ /**
740
+ * The content type discriminator.
741
+ */
742
+ contentType: string;
743
+ /**
744
+ * The text content.
745
+ */
746
+ text: string;
747
+ };
748
+
749
+ /**
750
+ * A tool call associated with a history item. Used in both ASSISTANT and TOOL_RESULT items.
751
+ *
669
752
  */
670
753
  export type AgentInstanceToolCall = {
671
754
  /**
672
- * The LLM-assigned tool call ID.
755
+ * The LLM-assigned tool call ID. Correlates ASSISTANT items to their matching TOOL_RESULT items.
673
756
  */
674
757
  toolCallId: string;
675
758
  /**
@@ -681,7 +764,9 @@ export type AgentInstanceToolCall = {
681
764
  */
682
765
  elementId: string | null;
683
766
  /**
684
- * The tool call arguments as provided by the LLM.
767
+ * The tool call arguments as provided by the LLM. May be null or populated on
768
+ * any item, including TOOL_RESULT.
769
+ *
685
770
  */
686
771
  arguments: {
687
772
  [key: string]: unknown;
@@ -689,9 +774,7 @@ export type AgentInstanceToolCall = {
689
774
  };
690
775
 
691
776
  /**
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.
777
+ * Request to update the mutable state of an agent instance.
695
778
  *
696
779
  */
697
780
  export type AgentInstanceUpdateRequest = {
@@ -700,7 +783,10 @@ export type AgentInstanceUpdateRequest = {
700
783
  * Used for ownership/equality validation against the stored agent instance
701
784
  * and, when the supplied key differs from the previous association (re-entry
702
785
  * of an ad-hoc sub-process or AI Agent task), appended to elementInstanceKeys
703
- * with the reverse link updated on the supplied element instance.
786
+ * with the reverse link updated on the supplied element instance. Only one
787
+ * element instance may hold this write claim at a time: any update from a
788
+ * different element instance is rejected while the current writer's job is
789
+ * still active.
704
790
  *
705
791
  */
706
792
  elementInstanceKey: ElementInstanceKey;
@@ -709,39 +795,23 @@ export type AgentInstanceUpdateRequest = {
709
795
  */
710
796
  status?: AgentInstanceUpdateStatusEnum;
711
797
  /**
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.
798
+ * The key of the job activation during which this update is being made.
799
+ * An update must always be attributed to the active job that produced it.
722
800
  *
723
801
  */
724
- jobLease?: string;
725
- /**
726
- * Metric increments to apply to the aggregate counters.
727
- */
728
- metrics?: AgentInstanceMetricsDelta;
802
+ jobKey: JobKey;
729
803
  /**
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.
804
+ * Opaque lease token received from the job activation response. Disambiguates
805
+ * this activation from any other activation of the same job: if the job is
806
+ * later retried, history items submitted under a superseded lease are discarded
807
+ * rather than committed.
738
808
  *
739
809
  */
740
- tools?: Array<AgentTool> | null;
810
+ jobLease: string;
741
811
  /**
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.
812
+ * A batch of history items to append to the agent instance's conversation
813
+ * history, in request order. Each created item is echoed back in the
814
+ * response's createdHistory, positionally correlated.
745
815
  *
746
816
  */
747
817
  history?: Array<AgentInstanceHistoryItem> | null;
@@ -4641,6 +4711,18 @@ export type GlobalListenerId = string;
4641
4711
  */
4642
4712
  export type GroupId = string;
4643
4713
 
4714
+ /**
4715
+ * A client-provided sequential integer identifying a loop iteration: one pass
4716
+ * through an AI agent's loop, during which the model reasons, selects tools,
4717
+ * evaluates the result, and decides whether to continue. One iteration covers
4718
+ * the input for the LLM call, the call itself, and the tools it dispatches;
4719
+ * the results of those tool calls are input to the next iteration. Must be a
4720
+ * positive integer, increasing with each loopIteration. Established by the
4721
+ * connector when appending the first history item of a loopIteration.
4722
+ *
4723
+ */
4724
+ export type LoopIterationId = number;
4725
+
4644
4726
  /**
4645
4727
  * The unique identifier of a mapping rule.
4646
4728
  */
@@ -5382,6 +5464,11 @@ export type ActivatedJobResult = {
5382
5464
  *
5383
5465
  */
5384
5466
  priority: number;
5467
+ /**
5468
+ * The lease token identifying this activation. This is null when the job was activated without a lease.
5469
+ *
5470
+ */
5471
+ leaseToken: string | null;
5385
5472
  };
5386
5473
 
5387
5474
  /**
@@ -5495,6 +5582,11 @@ export type JobActivationRequest = {
5495
5582
  *
5496
5583
  */
5497
5584
  tenantFilter?: TenantFilterEnum;
5585
+ /**
5586
+ * Whether to activate the jobs with a lease. When true, each activated job is assigned a distinct, opaque lease token, returned as ActivatedJobResult.leaseToken. The lease fences the complete, fail, and throw-error commands against a superseded activation of the same job. Once a job has been activated with a lease, it is served only to leasing workers of that job type. Omit or set to false to activate jobs without a lease.
5587
+ *
5588
+ */
5589
+ withLease?: boolean | null;
5498
5590
  };
5499
5591
 
5500
5592
  /**
@@ -5543,6 +5635,11 @@ export type JobCompletionRequest = {
5543
5635
  [key: string]: unknown;
5544
5636
  } | null;
5545
5637
  result?: JobResult;
5638
+ /**
5639
+ * The token identifying a leased job's activation, obtained from ActivatedJobResult.leaseToken. A leased job requires its matching token; missing or stale tokens are rejected. A job activated without a lease requires no token.
5640
+ *
5641
+ */
5642
+ leaseToken?: string | null;
5546
5643
  };
5547
5644
 
5548
5645
  export type JobErrorRequest = {
@@ -5563,6 +5660,11 @@ export type JobErrorRequest = {
5563
5660
  variables?: {
5564
5661
  [key: string]: unknown;
5565
5662
  } | null;
5663
+ /**
5664
+ * The token identifying a leased job's activation, obtained from ActivatedJobResult.leaseToken. A leased job requires its matching token; missing or stale tokens are rejected. A job activated without a lease requires no token.
5665
+ *
5666
+ */
5667
+ leaseToken?: string | null;
5566
5668
  };
5567
5669
 
5568
5670
  export type JobFailRequest = {
@@ -5585,6 +5687,11 @@ export type JobFailRequest = {
5585
5687
  variables?: {
5586
5688
  [key: string]: unknown;
5587
5689
  };
5690
+ /**
5691
+ * The token identifying a leased job's activation, obtained from ActivatedJobResult.leaseToken. A leased job requires its matching token; missing or stale tokens are rejected. A job activated without a lease requires no token.
5692
+ *
5693
+ */
5694
+ leaseToken?: string | null;
5588
5695
  };
5589
5696
 
5590
5697
  /**
@@ -5990,6 +6097,11 @@ export type JobUpdateBatchOperationRequest = {
5990
6097
  export type JobUpdateRequest = {
5991
6098
  changeset: JobChangeset;
5992
6099
  operationReference?: OperationReference;
6100
+ /**
6101
+ * The token identifying a leased job's activation, obtained from ActivatedJobResult.leaseToken. A supplied token is validated against the current lease. An update without a token applies to support operator and bulk updates, unlike complete, fail, and throw-error requests, which require a token for leased jobs.
6102
+ *
6103
+ */
6104
+ leaseToken?: string | null;
5993
6105
  };
5994
6106
 
5995
6107
  /**
@@ -6058,6 +6170,62 @@ export type _1Jobs1JobKey1Error = unknown;
6058
6170
 
6059
6171
  export type _1Jobs1JobKey1Failure = unknown;
6060
6172
 
6173
+ /**
6174
+ * Advanced filter
6175
+ *
6176
+ * Advanced AgentDefinitionKey filter.
6177
+ */
6178
+ export type AdvancedAgentDefinitionKeyFilter = {
6179
+ /**
6180
+ * Checks for equality with the provided value.
6181
+ */
6182
+ $eq?: AgentDefinitionKey;
6183
+ /**
6184
+ * Checks for inequality with the provided value.
6185
+ */
6186
+ $neq?: AgentDefinitionKey;
6187
+ /**
6188
+ * Checks if the current property exists.
6189
+ */
6190
+ $exists?: boolean;
6191
+ /**
6192
+ * Checks if the property matches any of the provided values.
6193
+ */
6194
+ $in?: Array<AgentDefinitionKey>;
6195
+ /**
6196
+ * Checks if the property matches none of the provided values.
6197
+ */
6198
+ $notIn?: Array<AgentDefinitionKey>;
6199
+ };
6200
+
6201
+ /**
6202
+ * Advanced filter
6203
+ *
6204
+ * Advanced AgentHistoryItemKey filter.
6205
+ */
6206
+ export type AdvancedAgentHistoryItemKeyFilter = {
6207
+ /**
6208
+ * Checks for equality with the provided value.
6209
+ */
6210
+ $eq?: AgentHistoryItemKey;
6211
+ /**
6212
+ * Checks for inequality with the provided value.
6213
+ */
6214
+ $neq?: AgentHistoryItemKey;
6215
+ /**
6216
+ * Checks if the current property exists.
6217
+ */
6218
+ $exists?: boolean;
6219
+ /**
6220
+ * Checks if the property matches any of the provided values.
6221
+ */
6222
+ $in?: Array<AgentHistoryItemKey>;
6223
+ /**
6224
+ * Checks if the property matches none of the provided values.
6225
+ */
6226
+ $notIn?: Array<AgentHistoryItemKey>;
6227
+ };
6228
+
6061
6229
  /**
6062
6230
  * Advanced filter
6063
6231
  *
@@ -6423,9 +6591,24 @@ export type AdvancedVariableKeyFilter = {
6423
6591
  };
6424
6592
 
6425
6593
  /**
6426
- * System-generated key for an agent instance history item.
6594
+ * System-generated key for an agent definition.
6595
+ */
6596
+ export type AgentDefinitionKey = LongKey;
6597
+
6598
+ /**
6599
+ * AgentDefinitionKey property with full advanced search capabilities.
6600
+ */
6601
+ export type AgentDefinitionKeyFilterProperty = AgentDefinitionKey | AdvancedAgentDefinitionKeyFilter;
6602
+
6603
+ /**
6604
+ * System-generated key for an agent history item.
6427
6605
  */
6428
- export type AgentHistoryKey = LongKey;
6606
+ export type AgentHistoryItemKey = LongKey;
6607
+
6608
+ /**
6609
+ * AgentHistoryItemKey property with full advanced search capabilities.
6610
+ */
6611
+ export type AgentHistoryItemKeyFilterProperty = AgentHistoryItemKey | AdvancedAgentHistoryItemKeyFilter;
6429
6612
 
6430
6613
  /**
6431
6614
  * System-generated key for an agent instance.
@@ -10042,6 +10225,10 @@ export type CreateAgentInstanceErrors = {
10042
10225
  *
10043
10226
  */
10044
10227
  404: ProblemDetail;
10228
+ /**
10229
+ * An agent instance already exists for the given element instance.
10230
+ */
10231
+ 409: ProblemDetail;
10045
10232
  /**
10046
10233
  * An internal error occurred while processing the request.
10047
10234
  */
@@ -10227,6 +10414,12 @@ export type SearchAgentInstanceHistoryErrors = {
10227
10414
  * Forbidden. The request is not allowed.
10228
10415
  */
10229
10416
  403: ProblemDetail;
10417
+ /**
10418
+ * The agent instance with the given key was not found.
10419
+ * More details are provided in the response body.
10420
+ *
10421
+ */
10422
+ 404: ProblemDetail;
10230
10423
  /**
10231
10424
  * An internal error occurred while processing the request.
10232
10425
  */