@hivemagnus/ardent 3.1.4 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +479 -6
  2. package/dist/a2a-client.d.ts +26 -4
  3. package/dist/a2a-client.js +91 -23
  4. package/dist/a2a-push-inbox.d.ts +2 -0
  5. package/dist/a2a-push-inbox.js +7 -0
  6. package/dist/a2a-push.d.ts +1 -1
  7. package/dist/a2a-push.js +26 -18
  8. package/dist/a2a-server.d.ts +17 -0
  9. package/dist/a2a-server.js +91 -14
  10. package/dist/a2a.d.ts +19 -1
  11. package/dist/a2a.js +197 -27
  12. package/dist/api.d.ts +2 -0
  13. package/dist/api.js +160 -22
  14. package/dist/artifact-manifests.d.ts +344 -5
  15. package/dist/artifact-manifests.js +413 -20
  16. package/dist/artifact-transfer.d.ts +113 -0
  17. package/dist/artifact-transfer.js +517 -0
  18. package/dist/artifacts.d.ts +86 -0
  19. package/dist/artifacts.js +249 -1
  20. package/dist/backend-events.d.ts +2 -1
  21. package/dist/backend-events.js +1 -1
  22. package/dist/channel-catchup.d.ts +67 -0
  23. package/dist/channel-catchup.js +108 -0
  24. package/dist/channels.d.ts +35 -0
  25. package/dist/channels.js +152 -4
  26. package/dist/cli.js +28 -3
  27. package/dist/codex-protocol.d.ts +22 -0
  28. package/dist/codex-protocol.js +19 -0
  29. package/dist/codex.d.ts +32 -3
  30. package/dist/codex.js +91 -17
  31. package/dist/config.d.ts +25 -2
  32. package/dist/config.js +41 -4
  33. package/dist/development.d.ts +6 -6
  34. package/dist/execution-state.d.ts +245 -0
  35. package/dist/execution-state.js +236 -0
  36. package/dist/execution.d.ts +135 -0
  37. package/dist/execution.js +178 -0
  38. package/dist/index.d.ts +7 -4
  39. package/dist/index.js +5 -3
  40. package/dist/job-engine.d.ts +2 -1
  41. package/dist/job-engine.js +33 -4
  42. package/dist/lineage.d.ts +106 -0
  43. package/dist/lineage.js +145 -0
  44. package/dist/llamacpp.d.ts +32 -2
  45. package/dist/llamacpp.js +69 -33
  46. package/dist/mattermost.d.ts +8 -0
  47. package/dist/mattermost.js +250 -36
  48. package/dist/mission-tools.js +41 -5
  49. package/dist/missions.d.ts +5 -1
  50. package/dist/missions.js +10 -5
  51. package/dist/plugin-evidence.js +2 -1
  52. package/dist/plugin-sdk.d.ts +3 -0
  53. package/dist/plugin-sdk.js +3 -0
  54. package/dist/plugins.d.ts +108 -2
  55. package/dist/plugins.js +131 -1
  56. package/dist/preview.d.ts +1 -0
  57. package/dist/preview.js +4 -1
  58. package/dist/recovery.d.ts +155 -0
  59. package/dist/recovery.js +216 -0
  60. package/dist/research.d.ts +1 -1
  61. package/dist/retry.d.ts +143 -0
  62. package/dist/retry.js +127 -0
  63. package/dist/runtime.d.ts +56 -4
  64. package/dist/runtime.js +727 -125
  65. package/dist/store.d.ts +62 -7
  66. package/dist/store.js +86 -15
  67. package/dist/team-artifacts.d.ts +130 -112
  68. package/dist/team-artifacts.js +123 -151
  69. package/dist/team-child.d.ts +4 -1
  70. package/dist/team-child.js +21 -2
  71. package/dist/team-contract.d.ts +1 -1
  72. package/dist/telegram.d.ts +2 -0
  73. package/dist/telegram.js +83 -47
  74. package/dist/tool-scheduler.d.ts +84 -0
  75. package/dist/tool-scheduler.js +226 -0
  76. package/dist/tools.d.ts +78 -4
  77. package/dist/tools.js +34 -7
  78. package/package.json +15 -8
  79. package/profiles/assistant/config.yaml +2 -1
package/README.md CHANGED
@@ -9,13 +9,19 @@ App Server, calls typed tools, and keeps a durable journal of every task.
9
9
  What you get:
10
10
 
11
11
  - **Durable tasks** with idempotency keys, cancellation, deadlines, and a
12
- per-task event journal in SQLite. Interrupted work is marked `unknown`,
13
- never silently replayed.
12
+ per-task event journal in SQLite. Interrupted work resumes from its last
13
+ verified step after a restart; an operation whose effect is uncertain is
14
+ held for a decision, never silently replayed (see
15
+ [Execution recovery](#execution-recovery)).
14
16
  - **Management API** (Hono, bearer-token protected) for tasks, sessions,
15
17
  config, identity, skills, peers, channels, and live event streams, including
16
18
  the reply text as the model writes it. The
17
19
  OpenAPI document is served at `/openapi.json` and pinned in
18
20
  [`openapi/ardent.json`](openapi/ardent.json).
21
+ - **Remote client** [`@hivemagnus/ardent-client`](client/README.md), released
22
+ with Ardent, for Node.js and browsers: submit and follow tasks across stream
23
+ reconnects, drive recovery decisions, read lineage, and download artifacts
24
+ with resumable, digest-verified transfers, directly or through Magnus.
19
25
  - **A2A protocol 1.0** server and client over JSON-RPC, HTTP+JSON, and gRPC,
20
26
  with authenticated peers, push notifications, and bounded "team missions"
21
27
  that scope which tools a peer may reach.
@@ -143,22 +149,83 @@ only the *names* of the environment variables that hold them.
143
149
  | `product` | `Ardent` | Shown in the profile summary. |
144
150
  | `timezone` | host zone, else `UTC` | IANA zone used for dates shown to the model. Job schedules carry their own zone. |
145
151
  | `identity.soul_file`, `identity.identity_file` | `SOUL.md`, `IDENTITY.md` | Persona files in the profile. |
146
- | `execution` | required | `backend: llamacpp \| codex`, step, tool-call, parallelism, and deadline limits. |
152
+ | `execution` | required | `backend: llamacpp \| codex`, step, tool-call, parallelism, and deadline limits. See [Tool scheduling](#tool-scheduling). |
153
+ | `execution.recovery.enabled` | `true` | Resume tasks interrupted by a crash or restart. `false` holds them as `unknown`, as before. See [Execution recovery](#execution-recovery). |
154
+ | `execution.recovery_max_new_deadline_seconds` | `deadline_seconds` | Longest deadline an operator may give `retry_with_new_deadline`, 1-86400. |
147
155
  | `providers.llamacpp` | required | `base_url`, `model`, `api_key_env`, `request_timeout_seconds`, optional `context_window_tokens`, `max_output_tokens`, `reasoning_effort`. |
148
- | `providers.codex` | required | `command`, `model`, `auth_mode: chatgpt \| api_key` (default `chatgpt`); `approval_policy: never` and `sandbox: read-only` are fixed. |
156
+ | `providers.codex` | required | `command`, `model`, `auth_mode: chatgpt \| api_key` (default `chatgpt`), `durable_threads` (default `true`: task threads are not ephemeral and their ids are recorded for recovery); `approval_policy: never` and `sandbox: read-only` are fixed. |
149
157
  | `memory` | `{ provider: none }` | See [HiveMem](#hivemem-memory). |
150
158
  | `research` | disabled | `enabled`, `searxng_url`, `firecrawl_url`, `firecrawl_token_env`. Enables the `news_search`, `news_article`, `news_collect`, and `news_capabilities` tools. |
151
159
  | `skills` | `directories: [skills]`, `enabled: []` | Only enabled skills are shown to the model. |
152
160
  | `a2a` | disabled | See [A2A](#a2a). |
153
161
  | `channels.telegram`, `channels.mattermost` | disabled | See [Chat channels](#chat-channels). |
154
162
  | `integrations.magnus_control` | disabled | See [Magnus Control tools](#magnus-control-tools). |
155
- | `artifacts.max_bytes` | `2097152` (2 MiB) | Largest artifact a task may store, up to 64 MiB. See [Team missions](#team-missions). |
163
+ | `artifacts.max_bytes` | `2097152` (2 MiB) | Largest artifact a task may store, export to a peer or import, up to 64 MiB. See [Artifact transfer v2](#artifact-transfer-v2-and-renditions). |
156
164
  | `plugins` | `[]` | See [Plugins](#plugins). |
157
165
  | `api` | `127.0.0.1:9910`, `ARDENT_API_TOKEN` | Management listener and the env var holding its bearer token. A non-loopback host is refused; put a TLS proxy in front instead. |
158
166
 
159
167
  `ardent config schema` prints the full JSON Schema, and `ardent config
160
168
  validate` checks a profile without starting it.
161
169
 
170
+ A few settings come from the environment rather than `config.yaml`:
171
+
172
+ | Variable | Default | Notes |
173
+ |---|---|---|
174
+ | `ARDENT_HOME` | `~/.ardent` | Root of the profiles directory and the shared model policy. |
175
+ | `ARDENT_API_TOKEN` | — | Management API bearer token (the name is `api.token_env`). |
176
+ | `ARDENT_INSTANCE_REF` | `local.<profile>` | The instance part of this runtime's qualified execution references (`hx1:ardent:<instance>:...`). Magnus sets `<node id>.<profile>`. 1 to 96 characters of `A-Z a-z 0-9 . _ -`; any other value stops the runtime from starting and is listed by `ardent config validate`. See [Execution ancestry](#execution-ancestry). |
177
+
178
+ ### Tool scheduling
179
+
180
+ Task concurrency and tool concurrency are separate settings:
181
+
182
+ | Key | Default | Notes |
183
+ |---|---|---|
184
+ | `execution.max_parallel_tasks` | `3` | Tasks running at once, 1-16. The runtime runs at most 4. |
185
+ | `execution.max_parallel_tool_calls` | `4` | Tool calls from one model turn in flight at once, 1-16. |
186
+ | `execution.max_parallel_tools` | none | Deprecated. Despite its name it limits tasks. It is used only when `max_parallel_tasks` is absent, and `ardent config validate` and `ardent doctor` then report the notice `execution.max_parallel_tools is deprecated: it limits tasks; set max_parallel_tasks`. A notice never makes the profile unready. |
187
+
188
+ The llama.cpp and Codex backends dispatch tool calls through the same scheduler:
189
+
190
+ - A call is *parallel-eligible* when its tool is a `read` tool that does not
191
+ declare `concurrency: 'serial'`, or any tool that declares
192
+ `concurrency: 'parallel'`. Every other call, including an unknown tool and
193
+ `team_ask_user`, is serial.
194
+ - Calls are admitted in the order the model emitted them (for Codex, the order
195
+ the calls arrive). Consecutive parallel-eligible calls overlap, at most
196
+ `max_parallel_tool_calls` at a time. A serial call is a barrier: it starts
197
+ after every earlier call has settled, and later calls wait for it. A write
198
+ therefore never overlaps anything unless its tool opts in.
199
+ - Each dispatch waits while the task is paused, checks `max_tool_calls` (for the
200
+ whole task), journals `tool_attempt`, waits for team admission, runs plugin
201
+ `beforeToolCall` hooks, invokes the tool, journals `tool_result` with the call
202
+ `id`, and then runs `afterToolCall` hooks.
203
+ - llama.cpp receives the results in the order it emitted the calls, each bound
204
+ to its call id. Codex binds each result to its own RPC request, and its
205
+ follow-up turn lists results in completion order.
206
+ - On cancellation, calls that were not dispatched settle as
207
+ `{ ok: false, code: 'CANCELLED', effect: 'none' }` and are journaled as
208
+ `tool_not_dispatched` (with a `reason`). A call already started keeps its
209
+ uncertainty, so a cancelled task with a started call that may have had an
210
+ effect (not a `read`, and not settled without effect, for example denied by a
211
+ plugin) is `unknown`, never `cancelled`. A call that would exceed
212
+ `max_tool_calls` is not dispatched and fails the task.
213
+
214
+ Each tool receives `ctx.idempotencyKey`, `sha256("<task id>:<call id>")` in
215
+ hex, as the third `invoke` argument (`defineTool` handlers receive it as their
216
+ third argument). A tool may forward it to its service so that a repeated
217
+ dispatch of the same model call is harmless. A tool can also declare
218
+ `idempotent: true` (repeating it with identical arguments and key is safe) and a
219
+ `reconcile(input, ctx, signal)` hook that asks its service what happened to an
220
+ interrupted call. [Execution recovery](#execution-recovery) re-dispatches an
221
+ interrupted idempotent call under the same key and asks `reconcile` before it
222
+ resumes a task; a tool that declares neither is held for an operator when one of
223
+ its calls is interrupted. `artifact_write` and `document_render` are idempotent
224
+ (a repeat under the same key returns the same registration) and reconcile from
225
+ their manifest row; `team_handoff`, `team_ask_user`, `team_propose_decision` and
226
+ `development_note` reconcile against their local journal rows. HiveMem writes
227
+ and `news_collect` declare neither, so they are held.
228
+
162
229
  ### HiveMem memory
163
230
 
164
231
  Memory is off by default. To use a HiveMem server:
@@ -202,6 +269,9 @@ channels:
202
269
  allowed_user_ids: [user-id]
203
270
  require_mention: true
204
271
  reply_mode: thread # thread | flat
272
+ catchup: # optional; these are the defaults
273
+ max_posts: 2000 # 1-10000 posts from others per walk
274
+ max_age_hours: 24 # older missed posts are skipped, not answered
205
275
  ```
206
276
 
207
277
  Telegram uses long polling; Mattermost uses its v4 REST and WebSocket APIs.
@@ -209,6 +279,37 @@ Both support `/help`, `/new`, `/status`, `/jobs`, `/model`, `/stop`, `/tasks`,
209
279
  and `/sources`. Each inbound message and outbound reply is journaled, so a
210
280
  restart never sends the same reply twice.
211
281
 
282
+ **Mattermost catch-up.** Posts missed while Ardent was stopped or its
283
+ WebSocket was down are recovered from history. Ardent keeps a boundary per
284
+ channel (the newest post up to which everything older is settled). On start,
285
+ after every reconnect, and every 30 seconds, it walks back from the newest post
286
+ to that boundary in pages of 200 (`before=<post id>`), then handles the posts
287
+ oldest first. This works with Mattermost and ChatterMost alike.
288
+
289
+ | Key | Default | Meaning |
290
+ |---|---|---|
291
+ | `catchup.max_posts` | `2000` (at most `10000`) | Posts from others that one walk reads. The bot's own posts do not count, but a walk reads at most `2 × max_posts / 200` pages. |
292
+ | `catchup.max_age_hours` | `24` | A missed post older than this is claimed as `skipped_stale` and not answered. |
293
+
294
+ Every eligible post in the walk ends in exactly one of four ways:
295
+
296
+ - **Answered.** It goes through the normal channel path: an atomic claim, then the task, then the reply.
297
+ - **Already claimed.** A live event, an earlier walk or an earlier run claimed it. It is never answered again, so a reply whose outcome is unknown is never replayed.
298
+ - **Skipped as stale.** The claim is recorded with `disposition` `skipped_stale`.
299
+ - **Lost to a permanent gap.** The gap is recorded as a row with `walk_bound` when the walk reached its bound before the boundary, or `retention` when the server no longer holds the history (for example, the `before` pivot disappeared).
300
+
301
+ The boundary moves only past posts settled in order, so an interrupted walk
302
+ resumes where it stopped. A channel seen for the first time is seeded without
303
+ answering its history.
304
+
305
+ Replies that the server rate-limits (`429`) wait out `Retry-After` under the
306
+ `mattermost` retry policy (see [Retries](#retries)). `GET /api/v1/status` reports the latest walk of each channel under
307
+ `channels.mattermost.catchup`:
308
+
309
+ - `state`: `idle`, `catching_up`, `complete` or `gap`.
310
+ - Counters: `recovered`, `skipped_stale`, `already_claimed` and `pages`.
311
+ - Gaps: the gap count and `last_gap`.
312
+
212
313
  ### A2A
213
314
 
214
315
  ```yaml
@@ -286,6 +387,37 @@ before you install it; `ardent jobs definitions status` and
286
387
  windows. The built-in handler is `news.collect` (requires `research`); plugins
287
388
  add more.
288
389
 
390
+ A window that asks to retry with `effect_status: "none"` waits
391
+ `retry_backoff_seconds · 2^(attempt-1)` with equal jitter (a random delay
392
+ between half and all of it), and only while the next attempt would start
393
+ before the job's next window is due; otherwise it ends `failed` with
394
+ `RETRY_DEADLINE`.
395
+
396
+ ### Retries
397
+
398
+ Every retry site in Ardent names a policy in [`src/retry.ts`](src/retry.ts),
399
+ built on the shared `@hivemagnus/hive-common/retry` helpers:
400
+
401
+ | Site | Attempts | Backoff | Repeated when |
402
+ |---|---|---|---|
403
+ | llama.cpp completion and token count | 3 | 250 ms → 4 s, equal jitter; `Retry-After` (seconds or HTTP date) up to 10 s | transport error or 408/425/429/5xx before any response byte is read |
404
+ | A2A Agent Card, Hermes team card, `getTask`, `listTasks`, extended card | 3 | 500 ms → 5 s, equal jitter | transport error or 408/425/429/5xx over HTTP |
405
+ | A2A `SendMessage` | 3 | 500 ms → 5 s, equal jitter | as above, always with the same `messageId` |
406
+ | A2A push delivery | 3 | `Retry-After` clamped to 1–5 s | 408/425/429/5xx (the callback did not accept the event) |
407
+ | Telegram Bot API | 4 | Telegram's `retry_after`, capped at 60 s | 429 with `retry_after` |
408
+ | Mattermost/ChatterMost REST | 3 | `Retry-After` up to 60 s (1 s without one) | 429 only (the request was not processed) |
409
+ | Artifact transfer pull (import) | 5 | 500 ms → 8 s, equal jitter; `Retry-After` up to 30 s | transport error, a dropped response or 408/425/429/5xx; each attempt resumes from the retained bytes with `Range` and `If-Range` |
410
+ | Codex turns, tools with a possible effect | 1 | — | never |
411
+
412
+ Nothing is repeated once its effect is uncertain, after any response byte was
413
+ consumed (a stream that fails mid-way is not restarted), past the deadline
414
+ (`RETRY_DEADLINE`; for model calls the task deadline and the request timeout),
415
+ or when the response carries `x-hive-retry: exhausted` (the gateway already
416
+ retried). Cancelling during a backoff wait ends the call at once. Model
417
+ retries are journaled as `model_retry` task events
418
+ (`{ step, operation, attempt, reason, delay_ms }`); A2A outbound calls,
419
+ push deliveries and Telegram deliveries record `attempts` on their rows.
420
+
289
421
  ### Model policy
290
422
 
291
423
  An optional, owner-only `$ARDENT_HOME/model-policy/active.json` selects the
@@ -305,6 +437,8 @@ is a starting point; compaction is disabled until you enable it.
305
437
  | `task.done` | The finished task | Its `result` is the authoritative answer |
306
438
 
307
439
  The stream closes after 60 seconds; reconnect to continue.
440
+ [`@hivemagnus/ardent-client`](client/README.md) does this for you
441
+ (`tasks.follow`).
308
442
 
309
443
  Live text works the same for every backend and caller:
310
444
  - It holds only what a user would see. Structured output, such as tool or research JSON, is never streamed.
@@ -387,6 +521,74 @@ a new artifact a revision of an earlier one. `GET /api/v1/tasks/{id}/artifacts`
387
521
  lists a task's manifests and `GET /api/v1/artifacts/{sha256}/manifest` returns
388
522
  the newest manifest for a digest; the bytes stay at `GET /api/v1/artifacts/{id}`.
389
523
 
524
+ ### Artifact transfer v2 and renditions
525
+
526
+ Artifacts up to `artifacts.max_bytes` (at most 64 MiB) move between agents
527
+ without inline task payloads, with bounded memory: every path streams. A
528
+ profile advertises `urn:hive:artifact-transfer:2` on its Agent Card
529
+ (`capabilities.extensions`, params `{max_bytes, range: true, renditions: true}`)
530
+ and `capabilities.artifact_transfer: 2` in `GET /api/v1/status`.
531
+
532
+ Manifest 1.1 is a strict superset of 1.0. It may add `rendition` (`role`
533
+ `original | preview | model_input`, `of_sha256`, `purpose`, `transform {name,
534
+ version, params}`) and `provenance.execution` (`root`, `task`, `step`, attribution
535
+ only). It is as immutable as 1.0 and is shown only to v2 consumers: the existing
536
+ manifest routes and the v1 descriptor still return 1.0, and stored 1.0 records
537
+ are never rewritten.
538
+
539
+ | Route | Purpose |
540
+ | --- | --- |
541
+ | `GET /api/v1/artifacts/{sha256}/content` | The bytes with `Accept-Ranges: bytes`, `ETag: "<sha256>"`, `Repr-Digest: sha-256=:<base64>:`, `X-Content-SHA256`, the manifest media type and `Content-Disposition: attachment; filename="<name>"`. One `Range` returns `206`, an unsatisfiable one `416`; an `If-Range` other than the ETag returns the whole artifact. |
542
+ | `GET /api/v1/artifacts/{sha256}/renditions` | `{renditions: [{sha256, role, mime, size, purpose, width?, height?, has_alpha?}]}`, the original first, the same for the original or any rendition. Pick one with HiveCommon `selectRendition`; `download` always means the original. |
543
+ | `GET /api/v1/artifacts/{sha256}/manifest/v2` | The newest manifest as 1.1. |
544
+ | `POST /api/v1/artifacts/imports {peer_id, a2a_task_id, artifact_id, task_id?}` | `202 {import_id}`: pull an artifact a configured peer exported from one of its completed tasks. |
545
+ | `GET /api/v1/artifacts/imports[/{id}]` | `{state: queued \| transferring \| verifying \| completed \| failed, received_bytes, size, attempts, error?}` |
546
+
547
+ An import resolves the peer's descriptor, negotiates `min(peer max_bytes, local
548
+ max_bytes)`, and appends to `<profile>/artifacts/.partial/<import id>`, committing
549
+ `received_bytes` after an fsync every 4 MiB. After an interruption or restart it
550
+ re-hashes the retained bytes as a stream and asks for the rest with `Range` and
551
+ `If-Range`; the gateway resumes unfinished imports when it starts. Transport
552
+ failures are retried under the `artifact_transfer` policy (see [Retries](#retries))
553
+ within the import's deadline; `attempts` counts runs and retries. The final
554
+ SHA-256 and size are verified: on `DIGEST_MISMATCH` the partial file is deleted,
555
+ nothing is registered and nothing is retried until an operator reissues the
556
+ import (`POST` again). The verified file is renamed into the content store (an
557
+ existing digest is kept) and registered with a manifest 1.1 whose lineage adds
558
+ the peer hop. Without `task_id`, the import records its own completed task.
559
+ `ardent artifact import --peer <id> --task <a2a task> --artifact <id>` runs one
560
+ from the command line and `ardent artifact imports` lists them.
561
+
562
+ A team export to a peer is limited by `artifacts.max_bytes`. Each export emits a
563
+ `Team artifact export v2` A2A artifact with one data part of media type
564
+ `application/vnd.hive.artifact-transfer.v2+json` carrying `{manifest_1_1,
565
+ content_path, renditions_path, size, sha256}`. Up to 2 MiB, the unchanged v1 text
566
+ descriptor (`Team artifact export`) is still emitted; above it, a v1 consumer gets
567
+ an explicit `TRANSFER_REQUIRES_V2` result that names the capability, and an
568
+ importer facing a peer without the URN fails the same way. On the A2A listener,
569
+ `/team/artifacts/{id}` serves the v1 full response without `Range` (verified as
570
+ it streams) and gains `Range` and the headers above; `/team/artifacts/{id}/manifest`
571
+ returns the 1.1 manifest and `/team/artifacts/{id}/renditions` the exported forms
572
+ with their export IDs. Renditions of an exported original are exported with it.
573
+
574
+ Plugins reach the same primitives through `ctx.runtime` (and types from
575
+ `@hivemagnus/ardent/plugin-sdk`):
576
+
577
+ - `ctx.runtime.artifacts.putStream(readable, {name, mediaType, expectedSha256?,
578
+ expectedSize?, maxBytes?, inspect?, signal?})` stores a stream (temporary file,
579
+ incremental SHA-256, size bound, fsync, rename) and returns the `Artifact`;
580
+ `openRead(sha256, {start?, end?}, {verify?})` returns `{stream, size, sha256,
581
+ start, end}`; `stat(sha256)` returns `{size}` or undefined.
582
+ - `ctx.runtime.artifactManifests.registerStream({taskId, name, mime, stream,
583
+ source, expectedSha256?, expectedSize?, revisesSha256?, ttlSeconds?, execution?})`
584
+ stores and registers an original with a manifest 1.1, checking its content as it
585
+ streams.
586
+ - `ctx.runtime.artifactManifests.registerRendition({originalSha256, role: preview |
587
+ model_input, purpose, transform, mime, bytes | stream, name?, width?, height?,
588
+ has_alpha?, producer?})` registers a separate rendition artifact linked to its
589
+ original; the original is never changed. `renditions(sha256)` lists the forms
590
+ and `manifestV2(sha256)` returns the 1.1 record.
591
+
390
592
  `development_note` stores an append-only development record: the agent's own
391
593
  note about how it works (`epistemic: agent_reported`).
392
594
 
@@ -431,6 +633,223 @@ It merges:
431
633
  `agent_ref` is the profile name. `ardent development list [--after CURSOR]
432
634
  [--limit N] [--kind KIND]` prints the same pages.
433
635
 
636
+ ### Execution recovery
637
+
638
+ After a crash or restart, every task that was `running` is evaluated before any
639
+ queued work starts. **A write is never repeated merely because execution
640
+ resumed**: an unknown effect needs reconciliation, never a retry. Each task is:
641
+
642
+ - **resumed under the same id**: it stays `running`, continues at the next
643
+ unfinished model step, and reuses completed model replies and settled tool
644
+ results;
645
+ - **reconciled first**: an interrupted tool call whose tool has a `reconcile`
646
+ hook is asked what happened before the task continues; or
647
+ - **held** as `unknown` (still terminal) with a recovery status and an
648
+ actionable reason, waiting for an operator decision or marked unsupported.
649
+
650
+ `TaskState` does not change. Tasks carry an optional `recovery` object (task
651
+ `GET` and list, and `GET /api/v1/tasks/{id}/recovery`), so older clients see
652
+ `running → completed` for a resumed task and `unknown` for a held one:
653
+
654
+ ```json
655
+ {"status": "awaiting_decision", "attempt": 1,
656
+ "reason": {"code": "UNSETTLED_EXTERNAL_WRITE", "message": "A tool call with a possible external effect was dispatched ..."},
657
+ "checkpoint": {"step": 0, "completed_calls": 1,
658
+ "pending_calls": [{"call_id": "call-1", "tool": "news_collect", "effect": "artifact-write", "dispatched_at": "2026-11-23T12:00:00.000Z", "reconcilable": false}]},
659
+ "actions": ["mark_applied", "mark_not_applied", "retry_with_new_deadline", "abandon"]}
660
+ ```
661
+
662
+ `status` is `ready` or `reconciling` (resuming), `resumed` (running again),
663
+ `awaiting_decision`, `unsupported`, or `resolved` (settled at startup, or
664
+ decided). `actions` lists only the decisions valid now. `GET /api/v1/status`
665
+ reports `recovery: { ready, reconciling, awaiting_decision, unsupported }`.
666
+
667
+ **How a task is planned.** Rules apply in order:
668
+
669
+ | Condition | Outcome | `reason.code` |
670
+ |---|---|---|
671
+ | Cancellation was requested | `cancelled`, or held when an effect is uncertain | `CANCELLED_DURING_OUTAGE` / `CANCELLED_WITH_UNSETTLED_EFFECT` |
672
+ | The deadline passed while stopped | `failed`, or held when an effect is uncertain; never extended | `DEADLINE_ELAPSED_DURING_OUTAGE` |
673
+ | `execution.recovery.enabled: false` | held, unsupported | `RECOVERY_DISABLED` |
674
+ | An extension `taskExecutor` with a possible effect ran, or a preview task | held, unsupported | `EXTENSION_EXECUTION_NOT_RESUMABLE` / `PREVIEW_NOT_RESUMABLE` |
675
+ | Codex | see the backend matrix | `CODEX_*` |
676
+ | llama.cpp, no checkpoint, no effectful tool dispatched | `ready`: restart from the beginning | `RESTART_NO_EFFECT` |
677
+ | llama.cpp, no checkpoint, an effectful tool dispatched (for example, from before this release) | held, unsupported | `NO_EXECUTION_CHECKPOINT` |
678
+ | A checkpoint fails its digest | held, unsupported | `CHECKPOINT_INVALID` |
679
+ | Every dispatched call settled, or the unsettled ones are reads or idempotent | `ready`: resume at the next step; unsettled reads and idempotent calls are dispatched again under the same idempotency key | `RESUME_FROM_CHECKPOINT` |
680
+ | An unsettled call whose tool can reconcile | `reconciling`: `applied` settles it with the service's result; `not_applied` tells the model it was not applied (it is not retried); `unknown` holds the task | `RECONCILE_INTERRUPTED_CALL` / `RECONCILIATION_INCONCLUSIVE` |
681
+ | Any other unsettled call with a possible effect | held, awaiting a decision | `UNSETTLED_EXTERNAL_WRITE` |
682
+
683
+ A call is *uncertain* when it was dispatched without a recorded outcome and is
684
+ not a `read`, or settled with an unknown effect. A call a plugin denied, that
685
+ settled without effect, or that was never dispatched leaves nothing uncertain.
686
+ Until the gateway knows a task's tools (plugins load after the journal opens),
687
+ a call that needs that check reports `reconciling` with `TOOL_CHECK_PENDING`;
688
+ the check runs before any queued work is admitted.
689
+
690
+ **Resuming.** A resumed task skips the queue transition, journals
691
+ `execution_resumed { attempt, from_step, reused_calls, redispatched_calls, mode }`,
692
+ reloads its transcript, evidence and tool-call count from its checkpoint, and
693
+ continues at the next step, ahead of queued work but still one task per caller
694
+ at a time. Tools, mission scope, memory grants, caller, context, ownership and
695
+ plugin task contexts are re-derived from their owning stores; the checkpoint
696
+ never supplies them, and the system prompt is rebuilt so policy and model
697
+ changes apply. A paused task stays paused and waits at its first boundary. The
698
+ deadline timer is re-armed from the stored deadline. Interrupted work does not
699
+ start again while admission is fenced for a rollback. A task the gateway's
700
+ shutdown deadline stops with nothing uncertain stays `running`
701
+ (`execution_suspended`) and resumes on the next start.
702
+
703
+ **Operator decisions.** `POST /api/v1/tasks/{id}/recovery`
704
+ `{ action, call_id?, result?, note?, deadline_seconds? }` resolves a task held
705
+ `awaiting_decision`. It is idempotent per task, attempt and action, and returns
706
+ the recovery object:
707
+
708
+ | Action | Effect |
709
+ |---|---|
710
+ | `mark_applied` | The pending call is settled `operator_applied` with `result` (at most 64 KiB, checked against the tool's output schema) or "result unavailable"; the work continues without dispatching it. |
711
+ | `mark_not_applied` | The pending call is settled `operator_not_applied`; the model is told it was not applied. |
712
+ | `retry_with_new_deadline` | The pending call is dispatched again under its original idempotency key, with a new deadline from now (`deadline_seconds`, at most `execution.recovery_max_new_deadline_seconds`). The only way to get a new deadline. |
713
+ | `abandon` | Records the decision; nothing continues. |
714
+
715
+ Because `unknown` is terminal, the first three create a **continuation task**:
716
+ the same caller, context, session and prompt (not added to the session again),
717
+ idempotency key `recovery:<original id>:<attempt + 1>`, an execution context
718
+ whose parent is the original task (`source: continuation`, listed in the
719
+ original's lineage `continuations`), and the original's checkpoint with the
720
+ pending call settled as decided. A mission continuation copies the mission and
721
+ its `TeamResult` names the continuation as `task_id` and lists the operator
722
+ decisions in `uncertain_effects`. The original's recovery becomes `resolved`
723
+ with `continuation_task_id`; the journals record `recovery_continued` and
724
+ `recovery_continuation_of`. `mark_*` keep the original deadline, so they are
725
+ offered only while it has not passed. A task held after a cancellation
726
+ request is never continued: a decision only records what the operator
727
+ established.
728
+
729
+ **Backends.**
730
+
731
+ | Backend | Recovery |
732
+ |---|---|
733
+ | llama.cpp | Full: checkpoints at every model reply and tool boundary, per the table above. |
734
+ | Codex | With `providers.codex.durable_threads` (default), thread and turn ids are recorded. (a) When no effectful call is unsettled, the protocol lock verifies thread recovery for the installed CLI, and `thread/read` lists every dynamic tool call in the thread with a settled invocation, the thread is resumed (`CODEX_THREAD_RESUME`). (b) When no effectful tool was ever dispatched, the task restarts on a fresh thread (`CODEX_RESTART_NO_EFFECT`). (c) Otherwise it is held unsupported (`CODEX_THREAD_NOT_VERIFIABLE`). `codex-protocol.lock.json` records `thread_resume_verified` and `thread_read_items_verified`; both are `false` for the observed CLI, so (a) is disabled and the reason says so. |
735
+ | Extension `taskExecutor` | Not resumable; held (`EXTENSION_EXECUTION_NOT_RESUMABLE`) when its effect is `possible`. |
736
+ | Preview | Not resumable (`PREVIEW_NOT_RESUMABLE`). |
737
+
738
+ **Never retried automatically:** a dispatched call with a possible effect and no
739
+ recorded outcome, unless its tool is idempotent or its own service reconciles
740
+ it; HiveMem writes; `news_collect`; extension executors; and anything after the
741
+ original deadline. A settled call is never dispatched again.
742
+
743
+ **State.** Three additive SQLite tables, written in the same transaction as the
744
+ journal event of each boundary: `execution_state` (the model transcript after
745
+ the last boundary, evidence, tool-call count and Codex thread ids, with a
746
+ digest), `tool_invocations` (one row per call: `dispatched` before invocation,
747
+ then settled with its result; compacted arguments, so file bytes stay in the
748
+ artifact store), and `task_recovery`. `model_result` events also carry `calls`
749
+ (id, name, compacted arguments). Execution checkpoints are separate from
750
+ context checkpoints; neither reads the other. Rolling back to 3.1.x ignores the
751
+ new tables and holds interrupted tasks as `unknown`.
752
+
753
+ **Channels.** A recovered task has no in-process handler waiting for it, so the
754
+ Telegram and Mattermost adapters answer its update themselves: at start and
755
+ whenever a task settles they find updates bound to a recovered task with no
756
+ recorded delivery, wait for the resumed task (or for the continuation an
757
+ operator decision creates), and reply through the usual record-before-send path.
758
+ The reply target (conversation, thread, message replied to) is stored with each
759
+ inbound claim (`channel_inbound.reply_target_json`). An update that already has
760
+ a delivery (queued, sent, failed or unknown) is never sent again, and a task
761
+ held awaiting a decision is not answered until its continuation finishes.
762
+ Updates claimed before this release have no stored target and are not answered.
763
+
764
+ **A2A peers.** The A2A surface publishes the outcome of a peer task whose
765
+ operation was recovered, through the same task store (GetTask, ListTasks) and
766
+ push sender as a live request:
767
+
768
+ | Operation | Peer task |
769
+ |---|---|
770
+ | Resumed, then completed | Answer, artifacts and `completed` (or `input_required`), as live. |
771
+ | Settled at startup (`failed`, `cancelled`) | `failed` or `canceled`. |
772
+ | Held `awaiting_decision` | Stays `working`; a status message gives the reason, and task metadata `ardentRecovery: { status, reason_code }`. |
773
+ | Continued after a decision | Follows the continuation: its answer and final state are published for the peer's original task, the A2A operation binding moves to the continuation, and `ardentRecovery.continuation_task_id` names it. |
774
+ | Held `unsupported`, or abandoned | `failed` with "Execution outcome is unknown: ...", as an interrupted task with an uncertain effect reports today. |
775
+
776
+ Each final state is claimed in `a2a_recovery_publications` before it is
777
+ published, so it and its push notification are sent at most once.
778
+
779
+ ### Execution ancestry
780
+
781
+ Every task accepted by this version has an execution context (execution
782
+ context v1 from `@hivemagnus/hive-common/execution`): the causal tree it
783
+ belongs to, across products. It is **attribution only**: tools, memory scope,
784
+ mission scope, team-child admission and artifacts are never selected from it.
785
+
786
+ ```json
787
+ {"v": 1, "request_id": "req-1", "root": "hx1:studio:inst-1:request:r-1",
788
+ "parent": "hx1:studio:inst-1:node:n-1", "self": "hx1:ardent:node-a.assistant:task:<task id>",
789
+ "deadline_ms": 1790431800000}
790
+ ```
791
+
792
+ - **Where it comes from.** `POST /api/v1/tasks`, `POST /api/v1/missions` and
793
+ `POST /api/v1/preview/tasks` take an optional `execution` field (else the
794
+ `x-hive-execution` header); an A2A message carries it as
795
+ `metadata.hiveExecution`. The task keeps the caller's `root` and
796
+ `request_id`, takes the caller's `self` as its `parent`, and its `self` is
797
+ always `hx1:ardent:<instance>:task:<task id>`, where the instance is
798
+ `ARDENT_INSTANCE_REF`. A missing, malformed or unknown-version value is
799
+ never rejected: the task gets a new root at its own reference. The context
800
+ is not part of the idempotency digest. `deadline_ms` is the earlier of the
801
+ caller's and the task's deadline; it does not change the task deadline.
802
+ - **Where it is kept.** The `task_execution` table (`self_ref`, `root_ref`,
803
+ `parent_ref`, `inputs_json`, `context_json` with the task's W3C trace,
804
+ `source`: `caller`, `a2a`, `minted` or `continuation`), written in the same
805
+ transaction as the task, and the `accepted` event's `execution`. A team
806
+ child's context is also stored next to its retained grant, outside the
807
+ grant's digest.
808
+ - **Where it goes.** Every llama.cpp request carries a new `x-request-id`, a
809
+ `traceparent` that is a child span of the task trace, and `x-hive-execution`
810
+ with `self` `hx1:ardent:<instance>:attempt:<task id>/<step>/<n>`, `attempt`
811
+ `n` and the deadline. `model_started` events journal `attempt`, `ref`,
812
+ `request_id` and `traceparent`, so a gateway's request log links back to the
813
+ task. `ArdentA2AClient.sendWithReceipt` / `send` / `sendStreaming` take
814
+ `{ execution }` and send it as `metadata.hiveExecution`, so the receiving
815
+ agent's task keeps the root and has the delegating task as its parent.
816
+ Tools receive it as `ctx.execution`, and plugin hooks as `execution` on the
817
+ task context and tool calls. `tool_attempt` events now record the tool's
818
+ `effect`.
819
+ - **Artifacts.** An artifact a task registers (`artifact_write`,
820
+ `document_render`, preview research briefs, plugin `register` /
821
+ `registerStream` calls, imports) is stored as manifest 1.1 with
822
+ `provenance.execution: {root, task, step?}`: the task's root, its task
823
+ reference and, while the task runs, the model step
824
+ (`hx1:ardent:<instance>:step:<task id>/<step>`). An imported artifact keeps
825
+ its producer's `execution`, and its import task takes the producer task as
826
+ parent. Every 1.0 view is unchanged, and a task without a context still
827
+ stores manifest 1.0. `ArtifactManifests.executionProvenance(taskId)` returns
828
+ the value.
829
+ - **Reading it.** Task responses (`GET /api/v1/tasks`, `GET /api/v1/tasks/{id}`)
830
+ include `execution` when the task has one. `GET /api/v1/tasks/{id}/lineage`
831
+ rebuilds what this profile knows:
832
+
833
+ ```json
834
+ {"task_id": "...", "execution": {"v": 1, "root": "...", "self": "..."}, "source": "caller",
835
+ "traceparent": "00-...-...-01", "parent": {"ref": "...", "local_task_id": "..."},
836
+ "children": [{"ref": "...", "local_task_id": "...", "source": "a2a", "created_ms": 0}],
837
+ "continuations": [],
838
+ "model_attempts": [{"step": 0, "attempt": 1, "backend": "llamacpp", "request_id": "...", "ref": "hx1:ardent:...:attempt:<id>/0/1", "started_ms": 0, "usage": null}],
839
+ "tools": [{"call_id": "call-1", "name": "artifact_write", "effect": "artifact-write", "state": "succeeded"}],
840
+ "artifacts": [{"sha256": "...", "name": "map.md", "mime": "text/markdown", "size": 12, "artifact_id": "...", "source": "manifest", "created_ms": 0,
841
+ "schema_version": "1.1", "execution": {"root": "...", "task": "...", "step": "..."}}]}
842
+ ```
843
+
844
+ `parent.local_task_id` is set when the parent is a task of this instance.
845
+ Tool `state` is `attempted`, `succeeded`, `failed`, `denied` or
846
+ `not_dispatched`. Artifacts come from the manifest table (`source:
847
+ manifest`, with renditions as `rendition_of`) and, for artifacts with no
848
+ manifest, the `artifact_registered` and `research_artifacts` events. Everything comes from SQLite, so lineage survives a
849
+ restart; a task accepted before this version has no `execution`, `parent`
850
+ or `children`, but still lists its model attempts, tools and artifacts.
851
+ The `/stream` events are unchanged apart from `accepted`.
852
+
434
853
  ## Plugins
435
854
 
436
855
  A plugin is an ES module whose default export (or named `plugin` export) is an
@@ -514,6 +933,55 @@ Additional hooks support extensions that retain an existing workflow contract:
514
933
  | `channelAdapter` | Replaces one enabled built-in channel consumer. Multiple owners are refused. Intake and delivery receive separate abort signals. |
515
934
  | `httpRoutes` | Adds explicit compatibility paths; overlapping core routes and authentication-boundary changes are refused. |
516
935
 
936
+ ### Lifecycle hooks
937
+
938
+ Message and tool lifecycle hooks let one extension follow a channel message
939
+ from receipt to delivery, and a tool call from invocation to its result or
940
+ cancellation, without replacing a channel adapter. Every hook is optional and
941
+ may be asynchronous. Each one gets a frozen copy of what it observes, and each
942
+ must settle within 5 seconds.
943
+
944
+ | Hook | When | Permitted | On a throw, rejection or timeout |
945
+ | --- | --- | --- | --- |
946
+ | `messageReceived(ctx, message)` | A built-in Telegram or Mattermost consumer has claimed a new, authenticated message, before command or task handling | Observe | Recorded; handling continues |
947
+ | `messagePersisted(ctx, message, task)` | The message's task is accepted and bound to it, before it runs | Observe | Recorded; the task runs |
948
+ | `transformOutbound(ctx, delivery)` | A reply is recorded for delivery, before it is sent | Return `{ text }` (1 byte to 64 KiB, not blank) to replace the text; return nothing to keep it. Transformations chain. When the text changes, the task journal records `outbound_transformed` with the sent text | The **original** text is sent, discarding every transformation; recorded |
949
+ | `messageDelivered(ctx, delivery, outcome)` | The delivery is recorded `sent`, `failed` or `unknown` | Observe | Recorded |
950
+ | `beforeToolCall(ctx, call)` | After context scoping, argument validation, the `tool_attempt` journal entry and team admission, before the tool is invoked | Return `{ deny: { code, message } }` to deny; the result is `{ ok: false, code, message, effect: 'none' }` and the journal records `tool_denied_by_plugin`. Anything else is ignored | The call is denied (`TOOL_DENIED_BY_PLUGIN`); recorded |
951
+ | `afterToolCall(ctx, call, result)` | The result is journaled, successful or not | Observe | Recorded; the task continues |
952
+ | `toolCallCancelled(ctx, call, { dispatched, effect })` | On cancellation, for calls not yet dispatched (`dispatched: false`, `effect: 'none'`) and calls in flight (`dispatched: true`; `effect: 'unknown'` unless the tool is `read`). Runs before `taskSettled` | Clean up | Recorded |
953
+
954
+ `message` is `{ platform, account, update_id, channel_type, caller, session_key,
955
+ received_ms, execution? }` and carries no message text. `delivery` is
956
+ `{ delivery_id, task_id, platform, account, update_id, text, attempt }`.
957
+ `call` is `{ task_id, call_id, name, arguments, effect, idempotency_key,
958
+ execution? }` with the validated arguments. `ctx.execution` and `execution` are
959
+ attribution for the causal tree a task belongs to (see
960
+ [Execution ancestry](#execution-ancestry)); they never grant access. They are
961
+ set for every task accepted by this version, and absent for older tasks and for
962
+ a channel `message`, which has no task yet.
963
+
964
+ Order: `before*` and `transform*` hooks run in plugin registration order, and
965
+ the first denial wins. Observers also run in registration order. Cleanup hooks
966
+ (`toolCallCancelled`, `taskSettled`, `drain`, `close`) run in reverse
967
+ registration order.
968
+
969
+ A failed hook is recorded as a `plugin_hook_failed` task event `{ plugin, hook }`.
970
+ For a message that never creates a task (a command such as `/help`), the
971
+ failure is recorded against the message's identity instead
972
+ (`runtime.store.pluginHookFailures(platform, account, update_id)`). An observer
973
+ failure never fails the task or the delivery. This includes
974
+ `observeToolResult`: a throwing `observeToolResult` is recorded and no longer
975
+ fails the task.
976
+
977
+ The hooks cannot widen authority. Context and mission scoping, plugin
978
+ `taskTools` and `filterTool`, and argument validation all happen before
979
+ `beforeToolCall`, which can only deny. A hook cannot change the arguments, the
980
+ result, the declared effect or the effect accounting, and `transformOutbound`
981
+ can change only the text of a reply that Ardent already decided to send.
982
+ Message hooks run for the built-in consumers; a plugin `channelAdapter` that
983
+ replaces one owns its own intake.
984
+
517
985
  An envelope extension uses `mission.extensions[plugin.name]` and action names
518
986
  `extension:<plugin-name>:<action>`. No extension is accepted without its configured
519
987
  validator. A codec may retain an old wire action while translating it into its
@@ -577,10 +1045,15 @@ npm run lint
577
1045
  npm test
578
1046
  npm run build
579
1047
  npm run openapi:check
580
- npm run pack:check # packs, installs, and smoke-tests the tarball
1048
+ npm run pack:check # packs, installs, and smoke-tests both tarballs
581
1049
  npm run verify # every gate CI runs, in order
582
1050
  ```
583
1051
 
1052
+ The repository is an npm workspace: `client/` is `@hivemagnus/ardent-client`,
1053
+ which carries Ardent's version. `npm run release:version -- X.Y.Z` bumps both,
1054
+ and `npm run version:check` (part of verify) fails when they differ. One
1055
+ `vX.Y.Z` tag publishes the runtime and then the client.
1056
+
584
1057
  ### Interoperability checks
585
1058
 
586
1059
  Run `npm run interop` from this standalone checkout. The runner installs pinned
@@ -2,7 +2,22 @@ import { type AgentCard, type ListTasksResponse, type SendMessageResult, type St
2
2
  import { type Client } from '@a2a-js/sdk/client';
3
3
  import type { ArdentConfig } from './config.js';
4
4
  import type { A2APushInbox } from './a2a-push-inbox.js';
5
+ import { type ExecutionContext } from './execution.js';
6
+ import { type AttemptFailure } from './retry.js';
7
+ /**
8
+ * What the last HTTP exchange of one A2A call looked like. The SDK reports failures as plain
9
+ * errors, so the fetch wrapper records the status, `Retry-After` and `x-hive-retry` it saw.
10
+ */
11
+ export declare class WireObservation {
12
+ failure: AttemptFailure | undefined;
13
+ reset(): void;
14
+ classify: () => AttemptFailure | undefined;
15
+ }
5
16
  export declare function fetchHermesTeamCard(card: AgentCard, authorization: string, signal?: AbortSignal): Promise<Record<string, unknown>>;
17
+ /** Per-message options. `execution` is the delegating task's context (attribution only). */
18
+ export type A2ASendOptions = {
19
+ execution?: ExecutionContext | undefined;
20
+ };
6
21
  export declare class ArdentA2AClient {
7
22
  readonly profileDir: string;
8
23
  readonly config: ArdentConfig;
@@ -10,10 +25,12 @@ export declare class ArdentA2AClient {
10
25
  readonly pushInbox?: A2APushInbox | undefined;
11
26
  readonly preferredTransports: string[];
12
27
  constructor(profileDir: string, config: ArdentConfig, env?: NodeJS.ProcessEnv, pushInbox?: A2APushInbox | undefined, preferredTransports?: string[]);
13
- open(peerId: string): Promise<{
28
+ /** Resolve the peer's card (retried as a read) and build a client whose HTTP exchanges are observed. */
29
+ open(peerId: string, signal?: AbortSignal): Promise<{
14
30
  card: AgentCard;
15
31
  client: Client;
16
32
  authorization: string;
33
+ observation: WireObservation;
17
34
  }>;
18
35
  teamControl(peerId: string, control: {
19
36
  version: '1.0';
@@ -21,14 +38,19 @@ export declare class ArdentA2AClient {
21
38
  key: string;
22
39
  payload: object;
23
40
  }): Promise<Record<string, unknown>>;
24
- send(peerId: string, prompt: string, signal?: AbortSignal, contextId?: string, taskId?: string): Promise<SendMessageResult>;
41
+ send(peerId: string, prompt: string, signal?: AbortSignal, contextId?: string, taskId?: string, options?: A2ASendOptions): Promise<SendMessageResult>;
25
42
  getTask(peerId: string, id: string, historyLength?: number): Promise<Task>;
26
43
  listTasks(peerId: string, pageSize?: number, pageToken?: string, contextId?: string): Promise<ListTasksResponse>;
27
44
  cancelTask(peerId: string, id: string): Promise<Task>;
28
45
  extendedCard(peerId: string): Promise<AgentCard>;
29
46
  subscribe(peerId: string, id: string, signal?: AbortSignal): AsyncGenerator<StreamResponse>;
30
- sendStreaming(peerId: string, prompt: string, signal?: AbortSignal): AsyncGenerator<StreamResponse>;
31
- sendWithReceipt(peerId: string, prompt: string, signal?: AbortSignal, contextId?: string, taskId?: string): Promise<{
47
+ sendStreaming(peerId: string, prompt: string, signal?: AbortSignal, options?: A2ASendOptions): AsyncGenerator<StreamResponse>;
48
+ /**
49
+ * Send one message. With `options.execution` (the delegating task's context)
50
+ * the message carries `metadata.hiveExecution`, so the receiving task keeps
51
+ * the root and takes the delegating task as its parent.
52
+ */
53
+ sendWithReceipt(peerId: string, prompt: string, signal?: AbortSignal, contextId?: string, taskId?: string, options?: A2ASendOptions): Promise<{
32
54
  result: SendMessageResult;
33
55
  outboundId?: string;
34
56
  }>;