@hivemagnus/ardent 3.2.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -923
- package/dist/a2a-client.js +3 -2
- package/dist/a2a-peers.d.ts +26 -0
- package/dist/a2a-peers.js +60 -18
- package/dist/a2a-push.d.ts +3 -1
- package/dist/a2a-push.js +5 -1
- package/dist/a2a-rate-limit.d.ts +3 -3
- package/dist/a2a-rate-limit.js +6 -3
- package/dist/a2a-server.d.ts +13 -1
- package/dist/a2a-server.js +20 -11
- package/dist/api.d.ts +12 -0
- package/dist/api.js +312 -131
- package/dist/artifact-transfer.js +3 -2
- package/dist/channel-catchup.d.ts +2 -2
- package/dist/channels.d.ts +6 -6
- package/dist/channels.js +4 -1
- package/dist/cli.js +106 -8
- package/dist/config.d.ts +9 -1
- package/dist/config.js +15 -6
- package/dist/development.d.ts +3 -3
- package/dist/development.js +2 -1
- package/dist/errors.d.ts +54 -0
- package/dist/errors.js +76 -0
- package/dist/identity.js +11 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/job-engine.d.ts +3 -0
- package/dist/job-engine.js +5 -0
- package/dist/journal.d.ts +90 -0
- package/dist/journal.js +395 -0
- package/dist/log.d.ts +11 -0
- package/dist/log.js +12 -0
- package/dist/mattermost.js +7 -2
- package/dist/memory.js +3 -2
- package/dist/metrics.d.ts +34 -0
- package/dist/metrics.js +73 -0
- package/dist/missions.js +2 -1
- package/dist/plugin-http.js +10 -1
- package/dist/plugin-sdk.d.ts +2 -0
- package/dist/plugin-sdk.js +2 -0
- package/dist/retention.d.ts +64 -0
- package/dist/retention.js +239 -0
- package/dist/runtime.d.ts +17 -1
- package/dist/runtime.js +52 -15
- package/dist/skills.js +5 -4
- package/dist/store.d.ts +42 -0
- package/dist/store.js +114 -14
- package/dist/telegram.js +5 -1
- package/package.json +8 -4
- package/profiles/assistant/config.yaml +1 -1
- package/dist/codex-output-budget.test.d.ts +0 -1
- package/dist/codex-output-budget.test.js +0 -29
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ What you get:
|
|
|
12
12
|
per-task event journal in SQLite. Interrupted work resumes from its last
|
|
13
13
|
verified step after a restart; an operation whose effect is uncertain is
|
|
14
14
|
held for a decision, never silently replayed (see
|
|
15
|
-
[Execution recovery](#execution-recovery)).
|
|
15
|
+
[Execution recovery](docs/recovery.md#execution-recovery)).
|
|
16
16
|
- **Management API** (Hono, bearer-token protected) for tasks, sessions,
|
|
17
17
|
config, identity, skills, peers, channels, and live event streams, including
|
|
18
18
|
the reply text as the model writes it. The
|
|
@@ -81,7 +81,7 @@ ARDENT_LLAMA_MODEL=your-model-name
|
|
|
81
81
|
EOF
|
|
82
82
|
ardent chat # interactive session
|
|
83
83
|
ardent run --prompt "Summarize RFC 9110 in three bullets"
|
|
84
|
-
ardent mission submit --mission-file mission.json # a team mission
|
|
84
|
+
ardent mission submit --mission-file mission.json # a team mission (docs/missions-and-artifacts.md)
|
|
85
85
|
ardent gateway run # management API, A2A, channels, jobs
|
|
86
86
|
```
|
|
87
87
|
|
|
@@ -90,10 +90,11 @@ ardent gateway run # management API, A2A, channels, jobs
|
|
|
90
90
|
### Under Magnus and in the Hive suite
|
|
91
91
|
|
|
92
92
|
Each [Magnus](https://github.com/ChefTaco/magnus) release is built and tested
|
|
93
|
-
against one pinned Ardent version
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
against one pinned Ardent version; Magnus's CHANGELOG names it, and
|
|
94
|
+
`npm run ardent:latest:check` in a Magnus checkout fails while that pin is older
|
|
95
|
+
than the latest Ardent release. Every Ardent release is followed by a Magnus
|
|
96
|
+
release that moves the pin, regenerates its Ardent contract and updates the
|
|
97
|
+
node agent; until then, managed nodes keep the pinned version.
|
|
97
98
|
|
|
98
99
|
Magnus installs that pinned package on a node and creates profiles with its
|
|
99
100
|
**New Agent** workflow, which always enables HiveMem. In a
|
|
@@ -104,925 +105,16 @@ Magnus installs that pinned package on a node and creates profiles with its
|
|
|
104
105
|
and Magnus's [Ardent guide](https://github.com/ChefTaco/magnus/blob/main/docs/ARDENT.md).
|
|
105
106
|
Ardent Project Studio and the UI reach those profiles only through Magnus.
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
## Documentation
|
|
108
109
|
|
|
109
|
-
|
|
110
|
-
reviewed immutable image ID or digest in a [Magnus](https://github.com/ChefTaco/magnus)
|
|
111
|
-
checkout:
|
|
110
|
+
The guides in [`docs/`](docs/):
|
|
112
111
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
models. The descriptor supplies literal launch arguments, an exact version
|
|
120
|
-
preflight and a read-only acceptance command for Hive's signed release matrix.
|
|
121
|
-
Local export does not publish or certify an artifact.
|
|
122
|
-
|
|
123
|
-
Select an existing profile explicitly with `--profile-path` and keep credentials
|
|
124
|
-
in an owned, mode `0600` environment file selected with `--env-file`. The native
|
|
125
|
-
launcher loads that file before Node starts, including `NODE_EXTRA_CA_CERTS`
|
|
126
|
-
when a private CA is required. It never evaluates the file as shell code.
|
|
127
|
-
Profile initialization is a separate operator action and refuses an existing
|
|
128
|
-
profile. Provider sign-in remains explicit.
|
|
129
|
-
|
|
130
|
-
`ardent --env-file FILE --profile-path DIR acceptance` checks the running
|
|
131
|
-
gateway's authenticated status, exact version, profile, backend and dependency
|
|
132
|
-
readiness. It returns bounded JSON without credentials or upstream diagnostics.
|
|
133
|
-
The default target is the profile's loopback management listener; an optional
|
|
134
|
-
`ARDENT_ACCEPTANCE_URL` must be an HTTPS origin, with an optional protected
|
|
135
|
-
`ARDENT_ACCEPTANCE_CA_FILE`. Redirects and nonlocal cleartext are refused.
|
|
136
|
-
Acceptance executes no model generation or tools. Verify scoped inference,
|
|
137
|
-
memory, skills and channel workflows separately before enabling consumers.
|
|
138
|
-
|
|
139
|
-
## Configuration
|
|
140
|
-
|
|
141
|
-
`config.yaml` (schema 1) is validated strictly; unknown keys are rejected. A
|
|
142
|
-
string of the form `${NAME}` is resolved from the environment (the profile
|
|
143
|
-
`.env` is loaded automatically). Secrets are never written to the config,
|
|
144
|
-
only the *names* of the environment variables that hold them.
|
|
145
|
-
|
|
146
|
-
| Key | Default | Notes |
|
|
147
|
-
|---|---|---|
|
|
148
|
-
| `profile`, `name` | required | Profile ID and display name. |
|
|
149
|
-
| `product` | `Ardent` | Shown in the profile summary. |
|
|
150
|
-
| `timezone` | host zone, else `UTC` | IANA zone used for dates shown to the model. Job schedules carry their own zone. |
|
|
151
|
-
| `identity.soul_file`, `identity.identity_file` | `SOUL.md`, `IDENTITY.md` | Persona files in the profile. |
|
|
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. |
|
|
155
|
-
| `providers.llamacpp` | required | `base_url`, `model`, `api_key_env`, `request_timeout_seconds`, optional `context_window_tokens`, `max_output_tokens`, `reasoning_effort`. |
|
|
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. |
|
|
157
|
-
| `memory` | `{ provider: none }` | See [HiveMem](#hivemem-memory). |
|
|
158
|
-
| `research` | disabled | `enabled`, `searxng_url`, `firecrawl_url`, `firecrawl_token_env`. Enables the `news_search`, `news_article`, `news_collect`, and `news_capabilities` tools. |
|
|
159
|
-
| `skills` | `directories: [skills]`, `enabled: []` | Only enabled skills are shown to the model. |
|
|
160
|
-
| `a2a` | disabled | See [A2A](#a2a). |
|
|
161
|
-
| `channels.telegram`, `channels.mattermost` | disabled | See [Chat channels](#chat-channels). |
|
|
162
|
-
| `integrations.magnus_control` | disabled | See [Magnus Control tools](#magnus-control-tools). |
|
|
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). |
|
|
164
|
-
| `plugins` | `[]` | See [Plugins](#plugins). |
|
|
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. |
|
|
166
|
-
|
|
167
|
-
`ardent config schema` prints the full JSON Schema, and `ardent config
|
|
168
|
-
validate` checks a profile without starting it.
|
|
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
|
-
|
|
229
|
-
### HiveMem memory
|
|
230
|
-
|
|
231
|
-
Memory is off by default. To use a HiveMem server:
|
|
232
|
-
|
|
233
|
-
```yaml
|
|
234
|
-
memory:
|
|
235
|
-
provider: hivemem
|
|
236
|
-
base_url: ${HIVEMEM_API_URL}
|
|
237
|
-
token_env: HIVEMEM_TOKEN
|
|
238
|
-
agent_id: assistant
|
|
239
|
-
workspace_id: ${HIVEMEM_WORKSPACE}
|
|
240
|
-
default_scope: private
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
Direct conversations then get `hivemem_status`, `hivemem_search`,
|
|
244
|
-
`hivemem_browse`, and explicit write tools. Peers never read private memory; a
|
|
245
|
-
validated team mission may grant read access to one shared `project:<id>`
|
|
246
|
-
scope.
|
|
247
|
-
|
|
248
|
-
To rotate the HiveMem credential without a restart, write the new token into the
|
|
249
|
-
profile environment file (`.env`, or the `--env-file` the gateway started with)
|
|
250
|
-
and call `POST /api/v1/memory/credential/reload` with no body or `{}`. The
|
|
251
|
-
gateway re-reads only the `token_env` variable, checks that it is a well-formed
|
|
252
|
-
JWT, and uses it for every later HiveMem request; requests in flight finish
|
|
253
|
-
with the previous token. It answers `{"reloaded": true, "token_env": "...",
|
|
254
|
-
"changed": true|false}`, `409` when memory is not `hivemem`, and `422` (the old
|
|
255
|
-
token stays in use) when the new value is missing or malformed.
|
|
256
|
-
|
|
257
|
-
### Chat channels
|
|
258
|
-
|
|
259
|
-
```yaml
|
|
260
|
-
channels:
|
|
261
|
-
telegram:
|
|
262
|
-
enabled: true
|
|
263
|
-
token_env: TELEGRAM_BOT_TOKEN
|
|
264
|
-
allowed_user_ids: [123456789] # only these users are answered
|
|
265
|
-
mattermost:
|
|
266
|
-
enabled: true
|
|
267
|
-
base_url: ${MATTERMOST_URL} # e.g. https://chat.example.com
|
|
268
|
-
token_env: MATTERMOST_TOKEN
|
|
269
|
-
allowed_user_ids: [user-id]
|
|
270
|
-
require_mention: true
|
|
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
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
Telegram uses long polling; Mattermost uses its v4 REST and WebSocket APIs.
|
|
278
|
-
Both support `/help`, `/new`, `/status`, `/jobs`, `/model`, `/stop`, `/tasks`,
|
|
279
|
-
and `/sources`. Each inbound message and outbound reply is journaled, so a
|
|
280
|
-
restart never sends the same reply twice.
|
|
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
|
-
|
|
313
|
-
### A2A
|
|
314
|
-
|
|
315
|
-
```yaml
|
|
316
|
-
a2a:
|
|
317
|
-
enabled: true
|
|
318
|
-
bindings: [jsonrpc, http-json, grpc]
|
|
319
|
-
public_url: ${ARDENT_A2A_PUBLIC_URL} # advertised origin, e.g. https://agent.example.com:9900
|
|
320
|
-
listen_host: 127.0.0.1
|
|
321
|
-
listen_port: 9900 # gRPC listens on listen_port + 1
|
|
322
|
-
peers_file: peers.yaml
|
|
323
|
-
skill: { id: research, name: Research, description: Sourced answers, tags: [research] }
|
|
324
|
-
hermes_compat: false
|
|
325
|
-
rate_limit: # all optional; these are the defaults
|
|
326
|
-
enabled: true
|
|
327
|
-
ip_requests_per_minute: 600 # every HTTP request, before authentication
|
|
328
|
-
ip_burst: 120
|
|
329
|
-
peer_requests_per_minute: 300 # after authentication, per peer (also gRPC)
|
|
330
|
-
peer_burst: 60
|
|
331
|
-
max_concurrent_tasks_per_peer: 16 # queued and running tasks
|
|
332
|
-
trusted_proxies: [] # proxies whose X-Forwarded-For is believed
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
A limited request is answered with `429` and `Retry-After`. The client address
|
|
336
|
-
is the socket address unless the connecting address is listed in
|
|
337
|
-
`trusted_proxies` (addresses or CIDR ranges). Behind a reverse proxy, all clients
|
|
338
|
-
otherwise share the proxy's address and one bucket, so list the proxy there.
|
|
339
|
-
gRPC requests count against the peer limit and the task cap; the address limit
|
|
340
|
-
covers HTTP only. Limits are kept in memory, per process.
|
|
341
|
-
|
|
342
|
-
Peers are listed in `peers.yaml` with the environment variables holding their
|
|
343
|
-
inbound and outbound bearer tokens. An ordinary peer task can reach only the
|
|
344
|
-
public news tools. A peer that sends a validated team mission envelope gets
|
|
345
|
-
the tools its `resources` allow (`public:news`, `magnus:fleet`,
|
|
346
|
-
`magnus:node:<id>`, or `tool:<name>` for any registered tool) and must return
|
|
347
|
-
a structured, evidence-checked team result.
|
|
348
|
-
|
|
349
|
-
`hermes_compat: true` additionally serves the authenticated
|
|
350
|
-
`/.well-known/hermes-team-card.json` discovery document and accepts Hermes
|
|
351
|
-
Agent's slash-style JSON-RPC method aliases (`message/send`, `tasks/get`, ...).
|
|
352
|
-
|
|
353
|
-
`ardent a2a discover <peer>` and `ardent a2a call <peer> --prompt TEXT` talk
|
|
354
|
-
to configured peers from the command line.
|
|
355
|
-
|
|
356
|
-
### Magnus Control tools
|
|
357
|
-
|
|
358
|
-
Read-only fleet tools for a [Magnus](https://github.com/ChefTaco/magnus)
|
|
359
|
-
Control API (fleet inventory, readiness, node health, dependency impact,
|
|
360
|
-
anomalies, command status, and more). Enable them with
|
|
361
|
-
`integrations.magnus_control.enabled: true` or `ARDENT_MAGNUS_CONTROL_TOOLS=true`.
|
|
362
|
-
The base URL comes only from `integrations.magnus_control.base_url` (default
|
|
363
|
-
`${ARDENT_MAGNUS_API_URL}`) and the read token from the env var named by
|
|
364
|
-
`token_env` (default `ARDENT_MAGNUS_READ_TOKEN`). Bearer tokens are sent only
|
|
365
|
-
over HTTPS or to loopback.
|
|
366
|
-
|
|
367
|
-
### Scheduled jobs
|
|
368
|
-
|
|
369
|
-
Put job definitions in `jobs/active.json` inside the profile:
|
|
370
|
-
|
|
371
|
-
```json
|
|
372
|
-
{
|
|
373
|
-
"schema_version": 1, "profile": "assistant", "revision": 1,
|
|
374
|
-
"jobs": [{
|
|
375
|
-
"id": "morning-news", "owner": "ardent", "enabled": true, "handler": "news.collect",
|
|
376
|
-
"schedule": { "cron": "30 6 * * *", "timezone": "Europe/Berlin", "missed_window": "skip", "catch_up_minutes": 0 },
|
|
377
|
-
"input": { "query": "open source AI agents", "max_articles": 3 },
|
|
378
|
-
"delivery": { "kind": "none" },
|
|
379
|
-
"policy": { "max_attempts": 2, "retry_backoff_seconds": 300 }
|
|
380
|
-
}]
|
|
381
|
-
}
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
`ardent jobs definitions validate --source /abs/path.json` checks a file
|
|
385
|
-
before you install it; `ardent jobs definitions status` and
|
|
386
|
-
`GET /api/v1/jobs/definitions/status` report the installed revision and recent
|
|
387
|
-
windows. The built-in handler is `news.collect` (requires `research`); plugins
|
|
388
|
-
add more.
|
|
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
|
-
|
|
421
|
-
### Model policy
|
|
422
|
-
|
|
423
|
-
An optional, owner-only `$ARDENT_HOME/model-policy/active.json` selects the
|
|
424
|
-
Codex model and reasoning effort and configures context compaction for all
|
|
425
|
-
profiles under that home. [`model-policy.default.json`](model-policy.default.json)
|
|
426
|
-
is a starting point; compaction is disabled until you enable it.
|
|
427
|
-
|
|
428
|
-
### Live task streams
|
|
429
|
-
|
|
430
|
-
`GET /api/v1/tasks/{id}/stream` is a server-sent event stream. It sends:
|
|
431
|
-
|
|
432
|
-
| Event | Data | Notes |
|
|
433
|
-
|---|---|---|
|
|
434
|
-
| `task.event` | A journal event | The event `id` is the journal sequence. Resume with `Last-Event-ID` or `?after=` |
|
|
435
|
-
| `task.text` | `{step, text}`: the visible reply text of the current model step | Sent on connect and when a new step starts showing text |
|
|
436
|
-
| `task.delta` | `{step, text}`: text to append | |
|
|
437
|
-
| `task.done` | The finished task | Its `result` is the authoritative answer |
|
|
438
|
-
|
|
439
|
-
The stream closes after 60 seconds; reconnect to continue.
|
|
440
|
-
[`@hivemagnus/ardent-client`](client/README.md) does this for you
|
|
441
|
-
(`tasks.follow`).
|
|
442
|
-
|
|
443
|
-
Live text works the same for every backend and caller:
|
|
444
|
-
- It holds only what a user would see. Structured output, such as tool or research JSON, is never streamed.
|
|
445
|
-
- It is not journaled and has no event id. A reconnect receives a `task.text` snapshot instead of a replay.
|
|
446
|
-
- Codex sends its answer as one piece when the turn completes.
|
|
447
|
-
|
|
448
|
-
`ardent chat` uses the same rule to print replies as they arrive.
|
|
449
|
-
|
|
450
|
-
### Team missions
|
|
451
|
-
|
|
452
|
-
`POST /api/v1/missions` runs a team mission locally, for a coordinator such as
|
|
453
|
-
a project studio. It is accepted like a task (`202 {task_id, state}`) and
|
|
454
|
-
streams on `/api/v1/tasks/{id}/stream` like any task.
|
|
455
|
-
|
|
456
|
-
```json
|
|
457
|
-
{
|
|
458
|
-
"objective": "Draft the opening scene",
|
|
459
|
-
"mission": { "id": "scene-1", "revision": 1, "parent_task": null, "constraints": [],
|
|
460
|
-
"allowed_actions": ["observe", "analyze", "create_artifact"],
|
|
461
|
-
"resources": ["project:adventure", "tool:artifact_write", "tool:team_handoff"],
|
|
462
|
-
"deadline": 1893456000, "acceptance_criteria": ["The scene is saved"], "expected_artifacts": [] },
|
|
463
|
-
"context_items": [{ "title": "Brief", "mime": "text/markdown", "text": "..." }],
|
|
464
|
-
"labels": { "project": "adventure" },
|
|
465
|
-
"session_id": "<a session opened with context: mission>",
|
|
466
|
-
"idempotency_key": "scene-1-turn-1"
|
|
467
|
-
}
|
|
468
|
-
```
|
|
469
|
-
|
|
470
|
-
- `mission` is the A2A team mission shape. The task runs in context `mission`,
|
|
471
|
-
and its tools follow the peer mission rule: `resources` grant tools, never
|
|
472
|
-
the model.
|
|
473
|
-
- The objective is at most 16,000 characters; `context_items` together at most
|
|
474
|
-
64 KiB. Context items reach the model as tool data, so the context fitter can
|
|
475
|
-
shorten them; the full text stays in the task journal.
|
|
476
|
-
- Memory reads use the agent's private scope plus one `project:<id>` grant.
|
|
477
|
-
Missions never write memory.
|
|
478
|
-
- A session for a mission is opened with `POST /api/v1/sessions`
|
|
479
|
-
`{key, context: "mission"}`.
|
|
480
|
-
- The task result is a `TeamResult` JSON document. A prose reply becomes a
|
|
481
|
-
`partial` result with the reply as `summary`; a reply carrying a
|
|
482
|
-
`team_result` is checked against the mission and the observed artifacts.
|
|
483
|
-
|
|
484
|
-
Mission tools are granted with `tool:<name>` resources. The coordination
|
|
485
|
-
tools only record a journal event; Ardent never acts on them itself:
|
|
486
|
-
|
|
487
|
-
| Tool | Journal event | Notes |
|
|
488
|
-
|---|---|---|
|
|
489
|
-
| `team_handoff {to_role, objective, deliverables?, note?}` | `team_handoff` | Asks the coordinator to give work to another role |
|
|
490
|
-
| `team_ask_user {question, options?}` | `team_ask_user` | Ends the turn; the result is `input_required` with a clarification |
|
|
491
|
-
| `team_propose_decision {title, statement, rationale?}` | `team_propose_decision` | A proposal; only the user decides |
|
|
492
|
-
| `artifact_write {name, mime, text \| base64 \| workspace_path, revises_sha256?}` | `artifact_registered` | Markdown, text, JSON, CSV, SVG, PNG, JPEG, WebP, PDF or DOCX, up to `artifacts.max_bytes`. `workspace_path` reads a file inside the profile's `workspace` |
|
|
493
|
-
| `document_render {source_markdown, format: pdf \| docx, name, revises_sha256?}` | `artifact_registered` | Markdown to PDF or DOCX, up to `artifacts.max_bytes`; see below |
|
|
494
|
-
| `development_note {kind, title, body, sources?}` | `development_note` | Also available in direct tasks; see below |
|
|
495
|
-
|
|
496
|
-
`document_render` reads GitHub-flavoured Markdown: headings, paragraphs, bold,
|
|
497
|
-
italic, strikethrough, inline code, links, bulleted, numbered and task lists,
|
|
498
|
-
block quotes, code blocks, tables and horizontal rules. It never fetches a URL
|
|
499
|
-
or reads a file. PDF output draws ` ```svg ` blocks as vector figures; images
|
|
500
|
-
keep only their alternative text. DOCX output is written with
|
|
501
|
-
[`@hivemagnus/canvas-word-codec`](https://www.npmjs.com/package/@hivemagnus/canvas-word-codec):
|
|
502
|
-
|
|
503
|
-
- Headings use Word's Heading 1-6 styles, so they appear in the navigation
|
|
504
|
-
pane; links to `http(s)` URLs become hyperlinks and other link targets are
|
|
505
|
-
kept as text after the label.
|
|
506
|
-
- Bulleted lists and numbered lists that start at 1 use Word numbering. Word
|
|
507
|
-
numbering here has one level, so nested lists are indented, and a numbered
|
|
508
|
-
list that starts elsewhere or has nested content gets its numbers as text.
|
|
509
|
-
- Tables keep their header row, column alignment and inline formatting; a
|
|
510
|
-
table longer than 100 rows continues in another table.
|
|
511
|
-
- PNG and JPEG images given as `data:` URIs are embedded. Other images become
|
|
512
|
-
an `[image: alt]` placeholder and ` ```svg ` figures a short note, since
|
|
513
|
-
DOCX output does not embed vector figures.
|
|
514
|
-
- Raw HTML is kept as literal text. A document beyond the DOCX exchange
|
|
515
|
-
limits (for example more than 100 table columns) fails with
|
|
516
|
-
`DOCX_RENDER_FAILED` and no effect.
|
|
517
|
-
|
|
518
|
-
Every registered artifact has an immutable manifest (digest, size, media type,
|
|
519
|
-
revision, provenance and the artifact it supersedes). `revises_sha256` makes
|
|
520
|
-
a new artifact a revision of an earlier one. `GET /api/v1/tasks/{id}/artifacts`
|
|
521
|
-
lists a task's manifests and `GET /api/v1/artifacts/{sha256}/manifest` returns
|
|
522
|
-
the newest manifest for a digest; the bytes stay at `GET /api/v1/artifacts/{id}`.
|
|
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
|
-
|
|
592
|
-
`development_note` stores an append-only development record: the agent's own
|
|
593
|
-
note about how it works (`epistemic: agent_reported`).
|
|
594
|
-
|
|
595
|
-
### Pause, preview and development history
|
|
596
|
-
|
|
597
|
-
**Pause and resume.** `POST /api/v1/tasks/{id}/pause` holds a queued or running
|
|
598
|
-
task: a queued task does not start (later tasks run instead), and a running
|
|
599
|
-
task stops at its next step boundary, before a model call, before a tool call
|
|
600
|
-
is journaled, or before it settles. The journal records `pause_requested`,
|
|
601
|
-
`paused` (with the boundary) and `resumed`. Both routes are idempotent, and the
|
|
602
|
-
deadline keeps running while a task is paused. `POST /api/v1/tasks/{id}/resume`
|
|
603
|
-
releases it. Locally, `ardent tasks pause <id>` holds a queued task and
|
|
604
|
-
`ardent tasks resume <id>` releases and runs it.
|
|
605
|
-
|
|
606
|
-
**Preview.** `POST /api/v1/preview/tasks` `{prompt, overrides: {soul?,
|
|
607
|
-
identity?, skills_enabled?, model?}, session_id?}` runs one task in context
|
|
608
|
-
`preview` with unsaved changes. A preview gets the read-only direct tools, no
|
|
609
|
-
mission tools and no memory tools. It never writes memory, development
|
|
610
|
-
records, identity or configuration, and any artifact it produces expires after
|
|
611
|
-
24 hours. It streams like any task; a session for it is opened with
|
|
612
|
-
`context: "preview"`. `ardent preview --prompt TEXT [--soul-file FILE]
|
|
613
|
-
[--identity-file FILE] [--skills a,b | --no-skills] [--model NAME]` does the
|
|
614
|
-
same locally.
|
|
615
|
-
|
|
616
|
-
**Development history.** `GET /api/v1/development?after=&limit=&kind=` returns
|
|
617
|
-
the agent's development in one portable record shape, oldest first, with a
|
|
618
|
-
`next` cursor:
|
|
619
|
-
|
|
620
|
-
```json
|
|
621
|
-
{"id": "dev_...", "agent_ref": "assistant", "kind": "self_understanding", "title": "...", "body": "...",
|
|
622
|
-
"author": "agent", "epistemic": "agent_reported", "before_sha256": null, "after_sha256": null,
|
|
623
|
-
"sources": [{"kind": "task", "ref": "..."}], "created_at": "2026-11-08T12:00:00.000Z"}
|
|
624
|
-
```
|
|
625
|
-
|
|
626
|
-
It merges:
|
|
627
|
-
- the agent's `development_note` records (`agent_reported`);
|
|
628
|
-
- operator notes from `POST /api/v1/development` (`operator_reported`);
|
|
629
|
-
- skill selection changes, with the configuration revisions before and after (`observed`);
|
|
630
|
-
- soul and identity edits from the retained identity history (`observed`);
|
|
631
|
-
- research method reflections (`observed`).
|
|
632
|
-
|
|
633
|
-
`agent_ref` is the profile name. `ardent development list [--after CURSOR]
|
|
634
|
-
[--limit N] [--kind KIND]` prints the same pages.
|
|
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
|
-
|
|
853
|
-
## Plugins
|
|
854
|
-
|
|
855
|
-
A plugin is an ES module whose default export (or named `plugin` export) is an
|
|
856
|
-
`ArdentPlugin` object, or an array of them:
|
|
857
|
-
|
|
858
|
-
```ts
|
|
859
|
-
import { definePlugin } from '@hivemagnus/ardent';
|
|
860
|
-
import { z } from 'zod';
|
|
861
|
-
|
|
862
|
-
export default definePlugin({
|
|
863
|
-
name: 'weather',
|
|
864
|
-
registerTools(ctx) {
|
|
865
|
-
ctx.tools.register(ctx.defineTool({
|
|
866
|
-
name: 'weather_now', description: 'Current weather for a city.',
|
|
867
|
-
input: z.object({ city: z.string().min(1) }).strict(),
|
|
868
|
-
output: z.object({ summary: z.string() }),
|
|
869
|
-
effect: 'read', contexts: ['direct'], timeoutMs: 10_000,
|
|
870
|
-
handler: async ({ city }, signal) => ({ summary: await lookUp(city, signal) }),
|
|
871
|
-
}));
|
|
872
|
-
},
|
|
873
|
-
routes(app, ctx) { // served under /api/v1/plugins/weather/
|
|
874
|
-
app.get('/health', c => c.json({ ok: true, profile: ctx.config.profile }));
|
|
875
|
-
},
|
|
876
|
-
cliCommands: { // ardent weather-check
|
|
877
|
-
'weather-check': { description: 'Probe the provider', run: async ({ print }) => print({ ok: true }) },
|
|
878
|
-
},
|
|
879
|
-
jobHandlers: ctx => ({ /* 'weather.daily': JobHandler */ }),
|
|
880
|
-
jobOwnership: ctx => async (job, now) => { /* throw to refuse a job window */ },
|
|
881
|
-
peerTool: (tool, task, envelope) => false, // allow a peer to call one of your tools
|
|
882
|
-
taskTools: ctx => [], // additions bound to the exact persisted task
|
|
883
|
-
filterTool: (ctx, tool) => true, // restrictive final filter
|
|
884
|
-
drain: async (ctx, timeoutMs) => true, // stop intake and await owned work
|
|
885
|
-
close: ctx => {}, // synchronous cleanup after a successful drain
|
|
886
|
-
});
|
|
887
|
-
```
|
|
888
|
-
|
|
889
|
-
Load it from config, as an npm package name (resolved from the profile
|
|
890
|
-
directory first, then from Ardent's own install), an absolute path, or a
|
|
891
|
-
`file://` URL:
|
|
892
|
-
|
|
893
|
-
```yaml
|
|
894
|
-
plugins: ['@example/ardent-weather', /opt/ardent/plugins/local.mjs]
|
|
895
|
-
```
|
|
896
|
-
|
|
897
|
-
Embedders that build the runtime themselves can call `registerPlugin()` before
|
|
898
|
-
loading plugins. Plugin tools join the profile's shared tool registry; a tool's
|
|
899
|
-
`contexts` decides whether direct, peer, or scheduled tasks may call it, and a
|
|
900
|
-
peer still needs an explicit mission grant (`tool:<name>`) or `peerTool`.
|
|
901
|
-
Plugin routes sit behind the same bearer-token check as the rest of the
|
|
902
|
-
management API.
|
|
903
|
-
|
|
904
|
-
A module may also export an asynchronous factory receiving `{ config, profileDir,
|
|
905
|
-
env }`. It returns a plugin or an array of plugins. This allows profile-specific
|
|
906
|
-
configuration and offline validation without constructing a runtime, claiming jobs,
|
|
907
|
-
or starting channel consumers. The CLI supplies the selected profile environment;
|
|
908
|
-
embedders can pass it as the third argument of `loadPlugins`.
|
|
909
|
-
|
|
910
|
-
Import supported extension primitives from `@hivemagnus/ardent/plugin-sdk` rather
|
|
911
|
-
than reaching into `dist`. This entry point includes the runtime, tool and job
|
|
912
|
-
contracts, profile/configuration helpers, provider clients, artifact and identity
|
|
913
|
-
helpers, and the application SQLite boundary (`SqliteDatabase`). Task additions retain their declared contexts and peer/mission grants. Preview
|
|
914
|
-
additions must be read-only. Restrictive filters apply to built-in and extension
|
|
915
|
-
tools; duplicate names cannot replace a tool silently. Stateful plugins must stop
|
|
916
|
-
intake and await their owned work in `drain`. A false or timed-out drain keeps the
|
|
917
|
-
journal open and ownership unsettled; `close` cannot bypass it. Cleanup runs in
|
|
918
|
-
reverse registration order, including partially initialized plugins.
|
|
919
|
-
|
|
920
|
-
Additional hooks support extensions that retain an existing workflow contract:
|
|
921
|
-
|
|
922
|
-
| Hook | Boundary |
|
|
923
|
-
| --- | --- |
|
|
924
|
-
| `systemPrompt` | Supplies trusted policy text; the full model input is still budgeted. |
|
|
925
|
-
| `allowMemory` | Can deny an admitted read; cannot grant a different scope. |
|
|
926
|
-
| `observeToolResult`, `beforeFinish`, `taskSettled` | Track actual task evidence, validate before success, and release task-local resources. |
|
|
927
|
-
| `teamEnvelope`, `admitTeamEnvelope` | Validate a legacy wire shape and apply extra admission restrictions. Identity, deadlines, parent reservations, constraints and resources remain core-validated. |
|
|
928
|
-
| `taskExecutor` | Runs one owned deterministic workflow. Attempts precede invocation in the journal; lost or unknown effects stay held across restart. Preview and mission execution cannot be replaced. |
|
|
929
|
-
| `inputImages` | Supplies at most five owned, digest-verified PNG/JPEG artifacts to a direct Codex task. Paths outside the selected profile's artifacts are rejected. |
|
|
930
|
-
| `teamEvidence` | Validates retained extension receipts. Artifacts require an exact mission grant and verified bytes; format-only citation aliases must target observed references. |
|
|
931
|
-
| `teamCard` | Describes private role capabilities without granting permissions or claiming backend readiness. |
|
|
932
|
-
| `prepareGateway`, `start` | Verify prior consumer ownership, then start background intake only in gateway mode. CLI inspection does not start consumers. |
|
|
933
|
-
| `channelAdapter` | Replaces one enabled built-in channel consumer. Multiple owners are refused. Intake and delivery receive separate abort signals. |
|
|
934
|
-
| `httpRoutes` | Adds explicit compatibility paths; overlapping core routes and authentication-boundary changes are refused. |
|
|
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
|
-
|
|
985
|
-
An envelope extension uses `mission.extensions[plugin.name]` and action names
|
|
986
|
-
`extension:<plugin-name>:<action>`. No extension is accepted without its configured
|
|
987
|
-
validator. A codec may retain an old wire action while translating it into its
|
|
988
|
-
own namespace; it cannot add a resource or substitute a core action grant.
|
|
989
|
-
Ardent retains the original wire envelope in its journal and revalidates it
|
|
990
|
-
when reading lifecycle controls or export receipts.
|
|
991
|
-
|
|
992
|
-
Normal plugin `routes` remain under `/api/v1/plugins/<name>/` and require the
|
|
993
|
-
management bearer token. `httpRoutes` declares each mount as `management` or
|
|
994
|
-
`independent`. Management aliases must remain under `/api/v1/` and inherit its
|
|
995
|
-
authentication. Independent device/webhook ingress must authenticate every
|
|
996
|
-
handler with its own credential and replay protection; it cannot use API,
|
|
997
|
-
health or A2A paths. All compatibility handlers receive a 1 MiB body bound and
|
|
998
|
-
share a bounded per-plugin rate bucket (600/minute, burst 120), applied before
|
|
999
|
-
handler authentication and parsing. Wildcard routes and middleware mounts are
|
|
1000
|
-
refused so an extension cannot intercept unrelated core requests.
|
|
1001
|
-
|
|
1002
|
-
HTTP mounts may set `rateLimit: { perMinute, burst }` for their authentication
|
|
1003
|
-
boundary. Defaults are 600 requests per minute and a burst of 120. Limits must be
|
|
1004
|
-
positive integers no greater than 6000 and 1200 respectively. All mounts from one
|
|
1005
|
-
plugin in the same boundary must agree; management and independent ingress retain
|
|
1006
|
-
separate buckets. This capacity is trusted plugin policy and grants no authentication
|
|
1007
|
-
or task authority. The one MiB body limit remains in force.
|
|
1008
|
-
|
|
1009
|
-
Offline job-validation contexts expose `runtimeAvailable: false`; their runtime
|
|
1010
|
-
and tool registry getters throw. CLI extensions receive `rawArgs` for their own
|
|
1011
|
-
option grammar, declare `valueOptions` to recognize values before the command, and can use `matches(invocation)` to select one subcommand while
|
|
1012
|
-
leaving other core subcommands available. Plugin code has the profile owner's
|
|
1013
|
-
process privileges: install only reviewed, pinned artifacts. These hooks preserve
|
|
1014
|
-
authority boundaries between tasks; they do not sandbox an untrusted plugin.
|
|
1015
|
-
|
|
1016
|
-
Job owner labels other than `ardent` remain external references and never admit
|
|
1017
|
-
work. A custom delivery kind requires its registered handler to validate the exact
|
|
1018
|
-
descriptor. Existing definition bytes, revisions and receipts need not be rewritten
|
|
1019
|
-
to rename an external scheduler. Historical channel labels also remain distinct;
|
|
1020
|
-
a compatibility adapter must retain its original platform, account and receipt
|
|
1021
|
-
identity instead of creating a second consumer under a renamed transport.
|
|
1022
|
-
|
|
1023
|
-
Extensions should
|
|
1024
|
-
use `ctx.runtime.store` for the active journal and must not introduce a second
|
|
1025
|
-
SQLite driver or rewrite another extension's state.
|
|
112
|
+
- [Configuration](docs/configuration.md): profile configuration, model backends, tools, memory, channels, A2A, Magnus Control tools, scheduled jobs, retries and model policy.
|
|
113
|
+
- [Management API](docs/management-api.md): authentication, errors, task lists, metrics, credential rotation, logs and live task streams.
|
|
114
|
+
- [Team missions and artifacts](docs/missions-and-artifacts.md): team missions, artifact transfer v2 and renditions, pause, preview and development history.
|
|
115
|
+
- [Execution recovery](docs/recovery.md): how interrupted tasks resume or are held, and execution ancestry.
|
|
116
|
+
- [Plugins](docs/plugins.md): the plugin API and its lifecycle hooks.
|
|
117
|
+
- [Operations](docs/operations.md): the native suite artifact, backup and retention, and journal quiescence.
|
|
1026
118
|
|
|
1027
119
|
## Security model
|
|
1028
120
|
|