@nanobpm/engine-wasm 0.8.5 → 0.8.7

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.
@@ -88,11 +88,16 @@ export class TestEngine {
88
88
  correlateMessage(message_name: string, correlation_key: string, variables_json: string): string;
89
89
  /**
90
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.
91
+ * `request_json` is `{ elementInstanceKey, jobKey?, jobLease?, definition?,
92
+ * limits?, history? }` where `definition` is `{ model?, provider?,
93
+ * systemPrompt? }`, `limits` is `{ maxTokens?, maxModelCalls?, maxToolCalls? }`
94
+ * (omitted limits default to unlimited), and `history` is an initial batch of
95
+ * turns (see the turn shape on `updateAgentInstance`). `jobKey`/`jobLease`
96
+ * are the activation's job attribution: **required** for an `external`
97
+ * (job-backed) agent element, where the CREATE is rejected unless they
98
+ * reference that element's ACTIVATED job with a matching lease token and
99
+ * `elementInstanceKey` (#1099); unused for the engine-native
100
+ * `aiAgentTask`/`aiAgentSubProcess` variants. Returns the snapshot.
96
101
  */
97
102
  createAgentInstance(request_json: string): string;
98
103
  /**
@@ -393,11 +393,16 @@ export class TestEngine {
393
393
  }
394
394
  /**
395
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.
396
+ * `request_json` is `{ elementInstanceKey, jobKey?, jobLease?, definition?,
397
+ * limits?, history? }` where `definition` is `{ model?, provider?,
398
+ * systemPrompt? }`, `limits` is `{ maxTokens?, maxModelCalls?, maxToolCalls? }`
399
+ * (omitted limits default to unlimited), and `history` is an initial batch of
400
+ * turns (see the turn shape on `updateAgentInstance`). `jobKey`/`jobLease`
401
+ * are the activation's job attribution: **required** for an `external`
402
+ * (job-backed) agent element, where the CREATE is rejected unless they
403
+ * reference that element's ACTIVATED job with a matching lease token and
404
+ * `elementInstanceKey` (#1099); unused for the engine-native
405
+ * `aiAgentTask`/`aiAgentSubProcess` variants. Returns the snapshot.
401
406
  * @param {string} request_json
402
407
  * @returns {string}
403
408
  */
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanobpm/engine-wasm",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
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",
@@ -88,11 +88,16 @@ export class TestEngine {
88
88
  correlateMessage(message_name: string, correlation_key: string, variables_json: string): string;
89
89
  /**
90
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.
91
+ * `request_json` is `{ elementInstanceKey, jobKey?, jobLease?, definition?,
92
+ * limits?, history? }` where `definition` is `{ model?, provider?,
93
+ * systemPrompt? }`, `limits` is `{ maxTokens?, maxModelCalls?, maxToolCalls? }`
94
+ * (omitted limits default to unlimited), and `history` is an initial batch of
95
+ * turns (see the turn shape on `updateAgentInstance`). `jobKey`/`jobLease`
96
+ * are the activation's job attribution: **required** for an `external`
97
+ * (job-backed) agent element, where the CREATE is rejected unless they
98
+ * reference that element's ACTIVATED job with a matching lease token and
99
+ * `elementInstanceKey` (#1099); unused for the engine-native
100
+ * `aiAgentTask`/`aiAgentSubProcess` variants. Returns the snapshot.
96
101
  */
97
102
  createAgentInstance(request_json: string): string;
98
103
  /**
@@ -393,11 +393,16 @@ export class TestEngine {
393
393
  }
394
394
  /**
395
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.
396
+ * `request_json` is `{ elementInstanceKey, jobKey?, jobLease?, definition?,
397
+ * limits?, history? }` where `definition` is `{ model?, provider?,
398
+ * systemPrompt? }`, `limits` is `{ maxTokens?, maxModelCalls?, maxToolCalls? }`
399
+ * (omitted limits default to unlimited), and `history` is an initial batch of
400
+ * turns (see the turn shape on `updateAgentInstance`). `jobKey`/`jobLease`
401
+ * are the activation's job attribution: **required** for an `external`
402
+ * (job-backed) agent element, where the CREATE is rejected unless they
403
+ * reference that element's ACTIVATED job with a matching lease token and
404
+ * `elementInstanceKey` (#1099); unused for the engine-native
405
+ * `aiAgentTask`/`aiAgentSubProcess` variants. Returns the snapshot.
401
406
  * @param {string} request_json
402
407
  * @returns {string}
403
408
  */
Binary file
@@ -125,6 +125,28 @@ export type AgentInstanceCreationRequest = {
125
125
  *
126
126
  */
127
127
  limits?: AgentInstanceLimits;
128
+ /**
129
+ * The key of the agent job whose activation authorizes this create. Optional:
130
+ * supply it for an `external` (job-backed) agent element to lease-gate the
131
+ * create, and the server then rejects the create unless it references that
132
+ * element's ACTIVATED job with a matching lease token and elementInstanceKey.
133
+ * A jobless create (omit, or `0`) is always allowed on this REST create surface,
134
+ * which carries no history batch; when supplied it is always validated. Omit (or `0`) for the engine-native
135
+ * `aiAgentTask` / `aiAgentSubProcess` variants, whose AgentInstance is auto-minted
136
+ * at activation.
137
+ *
138
+ */
139
+ jobKey?: JobKey;
140
+ /**
141
+ * Lease token received from the job activation response, disambiguating this
142
+ * activation from any other of the same job. A per-activation staleness handle
143
+ * (a monotonic value distinct from the job's lease deadline, not a
144
+ * cryptographically unguessable secret), serialized as a decimal string (an
145
+ * unsigned 64-bit integer), so the server rejects any non-numeric value with 400.
146
+ * Required alongside `jobKey` whenever a `jobKey` is supplied.
147
+ *
148
+ */
149
+ jobLease?: string;
128
150
  };
129
151
 
130
152
  /**
@@ -711,14 +733,20 @@ export type AgentInstanceUpdateRequest = {
711
733
  /**
712
734
  * The key of the job activation during which this update is being made. Attributed
713
735
  * to each appended history item so a later retry can supersede in-flight items.
736
+ * Required when the request carries a history batch (a history-bearing update needs
737
+ * a job context); may be omitted for a history-free update (a pure status/metrics
738
+ * advance). When supplied it is always validated against the element's ACTIVATED
739
+ * job and matching lease token.
714
740
  *
715
741
  */
716
742
  jobKey?: JobKey;
717
743
  /**
718
744
  * 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.
745
+ * activation from any other of the same job. A per-activation staleness handle
746
+ * (a monotonic value distinct from the job's lease deadline, not a
747
+ * cryptographically unguessable secret), serialized as a decimal string (an
748
+ * unsigned 64-bit integer), so the server rejects any non-numeric value with 400.
749
+ * Required alongside `jobKey` whenever a `jobKey` is supplied, and validated then.
722
750
  *
723
751
  */
724
752
  jobLease?: string;
@@ -10037,8 +10065,9 @@ export type CreateAgentInstanceErrors = {
10037
10065
  */
10038
10066
  403: ProblemDetail;
10039
10067
  /**
10040
- * The elementInstanceKey does not correspond to an active element instance.
10041
- * More details are provided in the response body.
10068
+ * The elementInstanceKey does not correspond to an active element instance, or —
10069
+ * for a lease-gated `external` create — the referenced job is not active or its
10070
+ * lease token does not match. More details are provided in the response body.
10042
10071
  *
10043
10072
  */
10044
10073
  404: ProblemDetail;
@@ -10143,8 +10172,9 @@ export type UpdateAgentInstanceErrors = {
10143
10172
  */
10144
10173
  403: ProblemDetail;
10145
10174
  /**
10146
- * The agent instance with the given key was not found.
10147
- * More details are provided in the response body.
10175
+ * The agent instance with the given key was not found, or the job context
10176
+ * supplied with the update references a job that is not active or whose lease
10177
+ * token does not match. More details are provided in the response body.
10148
10178
  *
10149
10179
  */
10150
10180
  404: ProblemDetail;