@agentproto/runtime 4.0.0 → 5.1.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.
@@ -0,0 +1,494 @@
1
+ # agent_start
2
+
3
+ Spawn a long-running agent CLI (claude-code, hermes, …) on the host. The
4
+ session stays alive across multiple turns — call `agent_prompt` to continue
5
+ the conversation. Returns the session id + initial descriptor.
6
+
7
+ This doc holds the field-level detail cut from the tool's schema to keep
8
+ `tools/list` cheap. Each schema field description ends with a pointer like
9
+ `Details: tool_help {name:"agent_start", topic:"worktree"}` — pass that
10
+ `topic` to get just one section, or omit it for the whole doc.
11
+
12
+ ## adapter
13
+
14
+ Adapter slug — one of the installed `@agentproto/adapter-*` packages (e.g.
15
+ 'claude-code', 'hermes', 'aider'). Omit only when `presetId` names a saved
16
+ preset with an adapter.
17
+
18
+ ## harness
19
+
20
+ Canonical harness slug — alias for `adapter`. Accepts the same values; use
21
+ whichever field your caller produces.
22
+
23
+ ## presetId
24
+
25
+ Saved user spawn preset id from `agentproto preset list`. Its adapter and
26
+ decomposed axes are applied first; explicit fields on this call override it.
27
+
28
+ ## workspaceSlug
29
+
30
+ Workspace slug from `agentproto workspace list`. The daemon resolves it to
31
+ an absolute path. Omit to use the `cwd` field or the active workspace.
32
+
33
+ ## cwd
34
+
35
+ Absolute path to spawn the agent in. Wins over `workspaceSlug` when both are
36
+ set.
37
+
38
+ ## prompt
39
+
40
+ Optional initial prompt. The session is spawned and the prompt dispatched
41
+ in one shot — equivalent to `start` then `prompt` back-to-back. Skip to
42
+ spawn idle.
43
+
44
+ ## label
45
+
46
+ Free-text label that surfaces in `agent_sessions_list` and the UI — useful
47
+ for tagging sessions with a conversation id or operator name.
48
+
49
+ ## mode
50
+
51
+ Manifest-declared mode id (AIP-45 `modes`) applied at spawn time, BEFORE the
52
+ child process starts — e.g. claude-code's 'plan' (read-only: reasons and
53
+ proposes but does not edit or run commands), 'accept-edits',
54
+ 'bypass-permissions'; codex's 'read-only' / 'full-access'; mastracode/
55
+ opencode's 'plan' / 'build'. Adapters that don't declare `modes` (e.g.
56
+ hermes) reject ANY value here — only pass this for adapters known to
57
+ support it. Omit for the adapter's normal interactive mode.
58
+
59
+ ## origin
60
+
61
+ Source label for this spawn — the calling channel/harness (codex, cowork,
62
+ vscode, cron, …). Descriptor-only: groups the session under a source node
63
+ in the tree. In-repo callers set it; the mcp-bridge can auto-stamp it from
64
+ the host clientInfo.
65
+
66
+ ## parentSessionId
67
+
68
+ Parent-lineage hint: attribute this spawn to a logical parent session so it
69
+ nests under that node in the sessions tree instead of appearing as a
70
+ depth-0 root. Pass the `id` of the session doing the spawning (e.g. an
71
+ agent-to-agent `agent_start`). The child's `depth` is derived from the
72
+ parent (parent depth + 1); you don't set it. Ignored when this call arrives
73
+ through the scoped orchestrator gateway — that path derives the parent from
74
+ its own token, which always wins over this hint.
75
+
76
+ ## attach
77
+
78
+ Parent-attach control, mirroring `worktree`. By DEFAULT (omitted) a spawn
79
+ attaches under the session that made it — the daemon derives that parent
80
+ from the trusted caller id, so a supervisor's executors nest instead of
81
+ appearing as depth-0 roots, no `parentSessionId` needed. Pass `false` to
82
+ launch an INDEPENDENT root (no parent) — the deliberate detached spawn.
83
+ `true` forces attach even under an `on-request` daemon policy; `{ parent:
84
+ "<id>" }` pins an explicit parent. Ignored when this call arrives through
85
+ the scoped orchestrator gateway (the scope token wins). Descriptor-only
86
+ lineage: never relaxes a depth-gated worktree/role guard.
87
+
88
+ ## boardId
89
+
90
+ Task-board pin for the spawned child, stamped onto its descriptor as
91
+ `meta.boardId`. The Task ledger resolves the child's default board from
92
+ this BEFORE walking `parentSessionId` lineage — so a client spawning
93
+ several depth-0 root sessions (no shared lineage) can join them all onto
94
+ ONE shared board. An explicit `boardId` passed on a task verb still wins
95
+ over this pin. Omit for the lineage-derived `tree:<root>` default.
96
+
97
+ ## idempotencyKey
98
+
99
+ Caller-declared 'this is the same logical spawn' token — a PROMISE, not a
100
+ guess. A retried agent_start call (e.g. after a slow/lost response) that
101
+ repeats the same `idempotencyKey` for the same `adapter`+`cwd` within
102
+ ~10min of a successful spawn gets that SAME session's descriptor back
103
+ instead of forking a second process — the response carries `deduped: true`
104
+ and `dedupeSource: "explicit"` so you can tell. Always wins over the
105
+ daemon's own derived key (see `dedupe` below) when both would apply.
106
+ Omitting this does NOT mean 'spawn unconditionally' — see `dedupe`.
107
+
108
+ ## dedupe
109
+
110
+ Per-call override for the daemon's `spawn.dedupe` policy — what happens
111
+ when NO `idempotencyKey` is supplied. By DEFAULT (`spawn.dedupe: "always"`)
112
+ a spawn that carries a `label` gets an IMPLICIT key derived from that label
113
+ plus a hash of `prompt`, and dedupes against it exactly like an explicit
114
+ key — set `dedupeSource: "implicit"` on the response (alongside `deduped:
115
+ true`) so you can tell it wasn't your own promise that matched. A spawn
116
+ with no `label` is never touched by this — deliberate parallel fan-out into
117
+ one cwd (a real, exercised pattern here) needs no label and stays exactly
118
+ as many sessions as you asked for. Pass `dedupe: false` to opt this ONE
119
+ spawn out of implicit derivation regardless of policy — the escape hatch,
120
+ mirroring `attach: false` / `worktree: false`. `dedupe: true` forces
121
+ derivation even under an `"on-request"` daemon policy, mirroring `attach:
122
+ true`. Unrelated and NOT covered by this flag: a `worktree` spawn that
123
+ lands in a worktree another LIVE session already occupies under the same
124
+ `label` is always refused (`dedupeSource: "worktree-cwd"`) — a shared
125
+ worktree, unlike a shared plain cwd, is never a legitimate fan-out.
126
+
127
+ ## permissionHold
128
+
129
+ Start the session in permission-hold mode: every ACP permission request the
130
+ agent raises (Write, Bash, …) is SURFACED and HELD in the cross-session
131
+ inbox (`permissions_list` / `permissions_respond`) instead of
132
+ auto-answered, and the agent blocks until a human/orchestrator approves or
133
+ denies it. Default false = today's auto-answer behaviour. ACP adapters
134
+ only; others ignore it.
135
+
136
+ ## notifyParentOnCrash
137
+
138
+ Opt this spawn into a direct in-band crash notice to its parent: if THIS
139
+ session later crashes (adapter process gone between turns), the parent
140
+ (`parentSessionId`, direct or inherited) is told via `[child-crashed]
141
+ <label/id>: <reason> — <lastError>` — enqueued immediately if the parent is
142
+ alive and idle, or queued for its next turn (never interrupting an
143
+ in-flight one) if it's busy. Default false. The free external webhook
144
+ (`notifyUrl`) already fires on any crash regardless of this flag — this
145
+ only adds the direct signal into the parent's OWN session, for a delegating
146
+ supervisor that wants to react to a child's death without polling.
147
+
148
+ ## sentinel
149
+
150
+ Set `false` to opt this spawn out of sentinel auto-link (AIP-60 §6): when the
151
+ session opens a PR (via `command_execute`'s `gh pr create` stamper, or either
152
+ `pr-provenance-reconciler.ts` lane discovering one), the daemon normally
153
+ creates a sentinel watching that PR for this session — `match:
154
+ github:owner/repo#N` with the default PR type set, `until:
155
+ subject_terminal`, `label: auto:pr#N`, `group: <this session id>`, delivered
156
+ back to this session at `next-turn` urgency. `sentinel: false` disables that
157
+ for this session specifically, regardless of the daemon's
158
+ `sentinel.autoWatchPrs` config. Default (unset) = allowed, still subject to
159
+ that config default (which itself defaults to `true` only when `local-gh`
160
+ (the host's authenticated `gh` CLI) is usable). The auto-created sentinel is
161
+ NOT torn down if this session later exits for good — its provider-side watch
162
+ keeps running and events park/orphan through the same dead-session path
163
+ every sentinel uses; `sentinel_list` / `agentproto sentinel list` still shows
164
+ it, filterable by `group: <session id>`.
165
+
166
+ ## allowSharedCwd
167
+
168
+ Acknowledge that this nested spawn WILL run in place inside its parent's
169
+ working tree even when that tree has uncommitted changes and isn't an
170
+ isolated worktree — silencing the shared-dirty-cwd warning agent_start
171
+ otherwise returns in `warnings`. Only relevant for a delegated (depth > 0)
172
+ spawn with no `worktree` and no `sandbox`; ignored otherwise. Default false
173
+ = warn.
174
+
175
+ ## keepAlive
176
+
177
+ Exempt this session from the idle-reaper: it is never auto-retired for
178
+ sitting idle, no matter how long. For a supervisor that legitimately parks
179
+ — waiting on a child, waiting on a scheduled wake — idle looks identical to
180
+ finished, and the reaper would otherwise pull it out from under you.
181
+ Default false = today's behaviour. Toggle later with
182
+ `session_set_keepalive`.
183
+
184
+ ## options
185
+
186
+ Manifest-declared option id → value map (AIP-45 `options`), applied at
187
+ spawn time alongside `mode` — e.g. hermes' `skills` (string, prepended
188
+ before the subcommand) or a boolean flag appended when true. Each value is
189
+ validated against the option's declared `type`/`enum`/`min`/`max`; unknown
190
+ ids reject. Adapters that don't declare a given option id reject it.
191
+
192
+ ## skills
193
+
194
+ Normalized, adapter-agnostic skill ids for this session (e.g.
195
+ ['agentproto']). Merges with `~/.agentproto/config.json`'s
196
+ `defaults.skills` / `defaults.adapters.<slug>.skills` (global < per-adapter
197
+ < this field, which REPLACES rather than unions the config defaults when
198
+ provided — a deliberate exact set). Folded into `options.skills` using the
199
+ resolved adapter's declared shape (e.g. hermes' comma-joined `--skills
200
+ a,b`); adapters with no declared `skills` option (e.g. claude-code, which
201
+ auto-discovers from `~/.claude/skills`) ignore this — no-op.
202
+
203
+ ## model
204
+
205
+ Model identifier to pass to the adapter (e.g. 'claude-opus-4-8'). For ACP
206
+ adapters (claude-code) applied via session/set_config_option after
207
+ newSession — NOT via a CLI flag. Others may ignore it.
208
+
209
+ ## effort
210
+
211
+ Reasoning effort level (e.g. 'low', 'medium', 'high', 'xhigh', 'max',
212
+ 'ultracode'). IMPORTANT: effort is calibrated per model — the same label
213
+ maps to different compute budgets across models, and defaults differ by
214
+ model (Sonnet 4.6 / Opus 4.8 default 'high'; Opus 4.7 default 'xhigh').
215
+ 'max' and 'ultracode' are session-only. Omit to keep the model's own
216
+ default.
217
+
218
+ ## route
219
+
220
+ Billing route/gateway. This is independent of model and named access
221
+ profile.
222
+
223
+ ## access
224
+
225
+ Named auth profile to bill at initial spawn; resolved from the local
226
+ keychain.
227
+
228
+ ## posture
229
+
230
+ Canonical agent posture (plan, bypass, accept-edits, read-only) or native
231
+ harness mode.
232
+
233
+ ## contextProfile
234
+
235
+ Context intake profile (for example full or lean).
236
+
237
+ ## auth
238
+
239
+ Deterministic billing-auth mode + EXPLICIT credential for adapters that
240
+ declare it (today: claude-code). EXPLICIT credential selection, not
241
+ scrub-by-absence: `mode` picks 'subscription' (default) or 'api-key';
242
+ `token`/`apiKey` (matching the resolved mode) is the secret VALUE, merged
243
+ against `~/.agentproto/config.json`'s
244
+ `defaults.adapters.claude-code.auth` (this field's `mode` wins; the
245
+ credential for the resolved mode wins over the matching config field). For
246
+ claude-code, 'subscription' SETS CLAUDE_CODE_OAUTH_TOKEN to `token` (a
247
+ bearer token minted via `claude setup-token` — bills the Max/Pro
248
+ subscription, not API credits) and DELETES ANTHROPIC_API_KEY + the
249
+ cloud-provider redirect toggles + ANTHROPIC_BASE_URL. 'api-key' SETS
250
+ ANTHROPIC_API_KEY to `apiKey` and DELETES ANTHROPIC_AUTH_TOKEN — the
251
+ deliberate 'bill the API' choice. FAILS FAST (refuses the spawn, no
252
+ fallback) when the resolved mode has no credential configured anywhere. The
253
+ secret is never logged or echoed back — only a fingerprint appears on the
254
+ session descriptor / `agent_sessions_list`. Adapters that don't declare
255
+ this vocabulary ignore this field entirely. `source: "claude-code-oauth"`
256
+ (subscription mode, opt-in) instead reads the bearer FRESH on every spawn
257
+ from the local Claude Code login (Keychain / ~/.claude/.credentials.json) —
258
+ effectively self-refreshing; an explicit `token` still wins over it.
259
+
260
+ ## mcpServers
261
+
262
+ MCP servers to mount into the spawned agent's session at spawn time.
263
+ Forwarded verbatim to `session/new.mcpServers` on the ACP arm — gives the
264
+ child agent a host-chosen scoped toolset (e.g. the daemon's own
265
+ orchestration gateway so it can spawn + supervise sub-agents). Adapters
266
+ that don't model MCP mounting ignore it.
267
+
268
+ Each entry's `headers` are static HTTP headers sent with every request to
269
+ an `http`/`sse` server (ignored for `stdio`). `credentialRef` resolves a
270
+ brokered credential at spawn time into additional headers (typically
271
+ `Authorization`) — the secret never lives in env/config, and brokered
272
+ headers win on collision with `headers`. `args`/`env` are `stdio`-only
273
+ (argv and extra environment for the launched server; ignored for
274
+ `http`/`sse`).
275
+
276
+ ## orchestrator
277
+
278
+ Make this child a SCOPED orchestrator — auto-mount the daemon's own
279
+ orchestration MCP tools (start/prompt/wait/poll/output + subtree
280
+ list/kill) so it can spawn and supervise its OWN sub-agents. `true` = the
281
+ default curated subset; `{ tools: [...] }` narrows it. The daemon mints a
282
+ per-child scope-token, injects the scoped sub-gateway URL into the child's
283
+ session (alongside any `mcpServers` you pass), and revokes the token when
284
+ the session exits. Shell/fs/remote/import/terminal tools are NEVER exposed
285
+ this way.
286
+
287
+ The nested `tools` array is an explicit allowlist — narrows the
288
+ orchestration toolset to ⊆ the default subset; names outside the default
289
+ are dropped (a child can never widen its own scope). `maxDepth` (default 3,
290
+ hard ceiling 8) is the max recursion depth reachable through this child — a
291
+ spawn that would exceed it is rejected, and a recursive spawn can only
292
+ LOWER the inherited cap, never raise it. `maxChildren` (default 8) is the
293
+ max concurrently-alive sub-agents this child may spawn, same
294
+ lower-only rule for a recursive spawn.
295
+
296
+ ## notifyUrl
297
+
298
+ Optional per-session webhook URL. POSTed (fire-and-forget) on this
299
+ session's turn-end / awaiting-input / exited events, in addition to any
300
+ global notify URL.
301
+
302
+ ## wait
303
+
304
+ Block until the spawned session's first turn completes and include the
305
+ cleaned output in the response. Default false = return the descriptor
306
+ immediately. This blocks for the child's ENTIRE first turn (~40-90s+), not
307
+ just the spawn. Batching several `wait: true` calls in one turn does NOT
308
+ run them in parallel: harnesses that execute tool calls sequentially
309
+ serialize them, each wait blocking its slot until its child's turn ends.
310
+ For parallel fan-out spawn with `wait: false` (all spawns return in
311
+ seconds), then wait on completion separately via `agentproto sessions wait
312
+ <id> --until turn-end` (detached/background) or a completion policy via
313
+ `policy_attach`.
314
+
315
+ ## maxCostUsd
316
+
317
+ Hard ceiling on cumulative session cost (USD). The session is stopped at a
318
+ turn-end once exceeded.
319
+
320
+ ## costBudget
321
+
322
+ Windowed cost-budget cap (DISTINCT from `maxCostUsd`). Auto-attaches a
323
+ governance policy that trips `policy:failed` when the rolling windowed
324
+ spend for `scope` crosses `maxCostUsd`. Never kills the session — it trips
325
+ a policy for a supervisor to act on. `window` is a rolling window spec
326
+ ("5h"/"7d"/"P7D"); `scope` is `session` (this session only) or `profile`
327
+ (every session on its auth profile).
328
+
329
+ ## restartPolicy
330
+
331
+ Opt-in auto-restart policy. When set, an unexpected death (`crashed`
332
+ and/or `error`, per `on`) is automatically revived IN PLACE (reusing the
333
+ resume machinery — same session id, same conversation) after an
334
+ exponential backoff, up to a rolling-window crash-loop cap. Omit for
335
+ today's behaviour: a dead session stays dead until a human/orchestrator
336
+ prompts or restarts it.
337
+
338
+ `on` lists which automatic death reasons trigger a restart —
339
+ never a clean exit, an operator kill, an idle-reap, a daemon-restart death,
340
+ or a cost-budget kill, regardless of this list. `maxRetries` +
341
+ `windowMs` form the rolling-window crash-loop cap: give up once
342
+ `maxRetries` restarts have fired within `windowMs`. `baseDelayMs` is the
343
+ first restart's backoff delay, compounded by `factor` on each subsequent
344
+ restart up to the `maxDelayMs` ceiling. `resume` is reserved for a future
345
+ explicit resume-vs-fresh-spawn toggle; today's behaviour always revives in
346
+ place.
347
+
348
+ ## contextContinuity
349
+
350
+ Context-continuity policy for this session — controls warning,
351
+ opportunistic compaction, fresh-continuation, and hard-stop thresholds.
352
+ Resolved from global → per-adapter → explicit override.
353
+
354
+ ## role
355
+
356
+ Spawn-time role gating whether this child may itself delegate (spawn/drive
357
+ further children) and, if it can, which roles IT may in turn spawn.
358
+ Built-ins: 'executor' = leaf, cannot delegate — `orchestrator` is ignored
359
+ and `agent_start`/`agent_prompt` are stripped from its default toolset,
360
+ regardless of `promptAppend`. 'supervisor' = may delegate (today's default
361
+ behaviour). Custom roles installed as role packs (see `role_list`) resolve
362
+ the same way. A spawn made THROUGH an orchestrator is additionally gated by
363
+ the privilege lattice: the calling role may only spawn a role allowlisted
364
+ in its `spawnableRoles`, or — open mode, the default — at or below its own
365
+ `level` (never something MORE privileged than itself). Omit `role` to
366
+ derive from spawn depth (root spawns default to supervisor; spawns made
367
+ through an orchestrator default to executor — see
368
+ `defaultRoleDepthCutoff` in config.json's `defaults` block).
369
+
370
+ ## promptAppend
371
+
372
+ One-off runtime text layered ON TOP of the resolved role's disposition and
373
+ prepended to `prompt` — it specializes the disposition, it cannot replace
374
+ it, and it cannot re-open the tool gate (an executor asked to 'delegate
375
+ anyway' via this field still has no delegation tools).
376
+
377
+ ## deferredTools
378
+
379
+ Override deferred/lazy MCP tool loading for this spawn's daemon self-mount:
380
+ `true` hides every tool outside a small always-on set from `tools/list`
381
+ (still fully callable — use `tool_search` to look up a hidden tool's schema
382
+ by keyword before calling it), `false` keeps the full eager surface. Omit
383
+ to use the resolved role's own default ('executor' defaults ON, since it
384
+ can't delegate anyway and rarely needs the full ~190-tool surface); omit
385
+ AND spawn a role with no opinion to fall through to the daemon's own
386
+ boot-time `defaults.mcp.deferredTools` config.
387
+
388
+ ## browser
389
+
390
+ `"headless"` gives the spawned agent its own isolated headless Chrome
391
+ (1440x900, temporary profile) as a per-session `browser` MCP server
392
+ (chrome-devtools-mcp: navigate_page, take_screenshot, evaluate_script,
393
+ click, list_console_messages, …), torn down with the session (`true` =
394
+ `"headless"`). Works for any adapter that mounts stdio MCP servers; runs
395
+ inside the session's `commandSandbox` (`strict` ⇒ file:// only). `false` =
396
+ none. Omit to use the role / preset / `defaults.spawn.browser` default
397
+ (off). Not supported with `sandbox`.
398
+
399
+ ## trace
400
+
401
+ Emit Langfuse observability traces for this session (prompt/completion +
402
+ tool spans + tokens/cost). Off by default; requires langfuse eval-reporter
403
+ creds configured.
404
+
405
+ ## sandbox
406
+
407
+ Run this session inside a sandbox instead of on the host — pass a provider
408
+ slug (see `list_sandbox_providers`) or an inline AIP-36 SandboxDefinition
409
+ object. The daemon boots the sandbox, spawns `adapter` on the box's OWN
410
+ agentproto daemon, and proxies the conversation back onto this session —
411
+ `agent_prompt`/`agent_output`/`agent_kill` behave exactly as they do for a
412
+ local spawn, and the transcript stays readable here even after the box is
413
+ torn down. Omit to run locally (default). Pass an inline spec with `reuse:
414
+ "<sandboxId>"` (from a prior session's `sandboxId`) to reconnect to an
415
+ existing box instead — by default such a box is PAUSED (not killed) on
416
+ session close so it stays reusable; set `lifecycle.destroy_on` to always
417
+ kill it.
418
+
419
+ DO NOT CONFUSE with `commandSandbox` below — this field boots a WHOLE
420
+ SEPARATE machine/box; `commandSandbox` confines THIS host's own spawn argv
421
+ in place. The two are independent and combine (or not) freely;
422
+ `commandSandbox` is ignored for a `sandbox` spawn (the box's own daemon
423
+ would need to apply it).
424
+
425
+ ## appServe
426
+
427
+ Serve an agentproto app's UI from INSIDE the sandbox box and return its
428
+ public URL. Requires `sandbox` (rejected otherwise). The box daemon
429
+ installs the app (`app_install` on the in-box `dir`), launches `agentproto
430
+ app serve --host 0.0.0.0 --port <port>` detached through the box's
431
+ `command_execute`, and the spawn result + descriptor carry `appServe: {
432
+ appId, dir, port, url, ready }` — `url` is the provider-resolved public URL
433
+ for the served UI (the port is also added to the spec's `extraPorts` and
434
+ echoed in `sandboxPorts`).
435
+
436
+ ## commandSandbox
437
+
438
+ OS-level process confinement (macOS Seatbelt / Linux bubblewrap) for the
439
+ adapter's OWN spawned process on THIS host — NOT the `sandbox` field above,
440
+ which boots an entirely separate remote box. This wraps the exact argv
441
+ `adapter` spawns as (e.g. `claude`, `npx @agentclientprotocol/claude-agent-acp`)
442
+ so its process tree is denied filesystem access outside the session's `cwd`
443
+ — confinement an ACP permission seam can never provide, since it only sees
444
+ tool calls the adapter chooses to report, not what an in-process Bash
445
+ actually touches. `"off"` (default when omitted AND no
446
+ `.agentproto/command-sandbox.json` sets an `adapterSpawn.mode`) =
447
+ unconfined, unchanged behaviour. `"workspace"` = deny reads/writes to
448
+ $HOME outside the workspace (protects ~/.ssh, ~/.aws, credentials, …);
449
+ network stays allowed. `"strict"` = `"workspace"` + deny all network. A
450
+ workspace can set this same axis persistently via the `adapterSpawn` key of
451
+ `.agentproto/command-sandbox.json` (a DISTINCT key from the top-level
452
+ `mode` that key file also carries for `command_execute` — the two are never
453
+ shared; misconfiguring the whole-session adapter jail is a bigger blast
454
+ radius than misconfiguring one shell command) — this param, when set,
455
+ overrides that file. Ignored for a `sandbox` spawn. `"workspace"`/`"strict"`
456
+ with no backend installed for this platform (macOS needs `sandbox-exec`,
457
+ Linux needs `bwrap`) FAILS the spawn rather than silently running
458
+ unconfined.
459
+
460
+ ## worktree
461
+
462
+ Isolate this session in its OWN git worktree instead of spawning directly
463
+ in `cwd` — so a parallel agent can't collide on the working tree. `true`
464
+ provisions a worktree on a fresh branch `wt/<slug>` cut from origin/main
465
+ (slug auto-minted from `label`); pass `{ slug, base, async }` to pin either,
466
+ or opt into an early return (see `async` below). The daemon boots the
467
+ worktree (git worktree add + the repo's agentproto.json setup hooks) and
468
+ spawns `adapter` THERE; the session's cwd, and every path it edits, live
469
+ inside the worktree. Honoured only for a ROOT spawn (a spawn made THROUGH
470
+ an orchestrator inherits its parent's tree — no second worktree; an
471
+ EXPLICIT `worktree` on such a nested spawn is REJECTED, not silently
472
+ ignored — use `sandbox` to isolate a child) and only when `cwd` is inside a
473
+ git repo (nothing to isolate otherwise ⇒ spawns plain, no error). The
474
+ daemon's `worktrees.isolation` policy may force this ON for every root
475
+ spawn (`always`) or OFF (`never`, which REJECTS an explicit `worktree`).
476
+ Ignored for a `sandbox` spawn (the box already isolates). The worktree is
477
+ NOT auto-removed on session close — it holds the agent's work; tear it down
478
+ with `agentproto worktree rm|archive|gc`.
479
+
480
+ `slug` pins the worktree's slug (names its branch `wt/<slug>` and its
481
+ directory) — omit to auto-mint a collision-free one from the label. `base`
482
+ is the git ref the branch is cut from (default 'origin/main'). `async`
483
+ returns a real, registered session as soon as it's minted (status
484
+ "starting") instead of blocking `agent_start`'s response on `git worktree
485
+ add` + the repo's setup hooks, which can run minutes — provisioning + the
486
+ driver spawn continue in the background; poll the session's `status`
487
+ (flips to "running" on success, "error" with a readable `lastError` on
488
+ failure — it never sits in "starting" forever). Any `prompt` is held and
489
+ dispatched only once the tree and the driver session both exist.
490
+ Incompatible with `wait` (there is no first-turn output to block on yet) —
491
+ combining the two is rejected. Defaults to true for any spawn that
492
+ provisions a worktree, UNLESS this call also sets `wait` (which falls back
493
+ to the old synchronous path instead of conflicting). Pass `false`
494
+ explicitly to force the old blocking ok/fail contract even without `wait`.
@@ -0,0 +1,47 @@
1
+ # app_run
2
+
3
+ Run an installed app's agents as live sessions — one `agent_start`-equivalent
4
+ spawn per selected agent, grouped under a fresh appRunId. Re-reads the app's
5
+ directory first, so a stale install record (paths moved, a workflow renamed)
6
+ is refreshed before spawning — the same refreshed paths are what make
7
+ `workflow_run_file` work against this app's WORKFLOW.md files. Poll with
8
+ `app_status`, kill with `app_stop`.
9
+
10
+ ## adapter support
11
+
12
+ The AGENT.md frontmatter `model` becomes each spawn's model when `model` is
13
+ omitted here; if neither is set, the adapter keeps its default. With the
14
+ default adapter `mastra-agent` (or any other adapter whose manifest
15
+ declares an `agent` option), each spawn is also pointed straight at the
16
+ agent's emitted AGENT.md via that option. Any OTHER adapter (`claude-code`,
17
+ `hermes`, `codex`, ...) declares no such option, so its spawn is built FROM
18
+ the AGENT.md instead: the AGENT.md body becomes the system/prefix of the
19
+ first prompt (a `prompt` arg is appended after it). An explicit `model` arg
20
+ here always wins. `cwd` is still the app's dir, and the daemon's own MCP
21
+ gateway is still mounted for adapters that get it by default (claude-code,
22
+ hermes) — see `shouldInjectDaemonSelfMount` — so the spawned agent still
23
+ reaches `app_data_*`/`mcp_imported_call` natively.
24
+
25
+ ## orchestration
26
+
27
+ Pass `sequence` to run agents ONE-AT-A-TIME in the given order (each waits
28
+ for its predecessor's session to reach a terminal state, bounded ~60×2s,
29
+ before the next spawns) — the scout→tailor workflow. By default the tool
30
+ waits for the whole sequence, preserving existing behaviour. Pass
31
+ `wait:false` to return the appRunId after the first session spawns and
32
+ continue the remaining sequence in the background; follow it with
33
+ `app_status`. Without `sequence`, `agents` spawn concurrently (legacy
34
+ behaviour). When `sequence` is set every agent still lives under the SAME
35
+ appRunId and is awaited (unless `wait:false`); the run is marked `ended`
36
+ once the last completes.
37
+
38
+ ## runner selection
39
+
40
+ `adapter`/`harness`/`model` are passed through to every spawn and mirrored
41
+ onto the run record for observability. `harness` is the canonical slug and
42
+ defaults `adapter` to itself when `adapter` is absent; a bare `adapter`
43
+ sets `harness` to itself; both default to `mastra-agent`. `access.profileRef`
44
+ pins a named auth profile (see `agent_start.access`) on every spawn this
45
+ run makes — needed when an adapter's default credential profile is
46
+ disabled on this host. An unresolvable adapter is collected as a per-agent
47
+ error rather than failing the whole run.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentproto/runtime",
3
- "version": "4.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "@agentproto/runtime — long-running gateway that turns an agentproto workspace into a live runtime. Composes @agentproto/mcp-server (CRUD verbs) with HTTP transport, HEARTBEAT.md autonomy loop, and append-only conversation persistence. Drop a workspace dir, point your MCP client at it, and the agent ticks on its own.",
5
5
  "keywords": [
6
6
  "agentproto",
@@ -125,10 +125,21 @@
125
125
  "types": "./dist/app-ui-delivery.d.ts",
126
126
  "import": "./dist/app-ui-delivery.mjs",
127
127
  "default": "./dist/app-ui-delivery.mjs"
128
+ },
129
+ "./app-ui-build": {
130
+ "types": "./dist/app-ui-build.d.ts",
131
+ "import": "./dist/app-ui-build.mjs",
132
+ "default": "./dist/app-ui-build.mjs"
133
+ },
134
+ "./app-ui-placeholder": {
135
+ "types": "./dist/app-ui-placeholder.d.ts",
136
+ "import": "./dist/app-ui-placeholder.mjs",
137
+ "default": "./dist/app-ui-placeholder.mjs"
128
138
  }
129
139
  },
130
140
  "files": [
131
141
  "dist",
142
+ "docs",
132
143
  "README.md",
133
144
  "LICENSE"
134
145
  ],
@@ -146,35 +157,35 @@
146
157
  "@agentproto/acp": "0.9.0",
147
158
  "@agentproto/agent": "0.2.4",
148
159
  "@agentproto/app-client": "0.4.0",
149
- "@agentproto/app-kit": "1.3.0",
150
- "@agentproto/apps": "0.13.0",
160
+ "@agentproto/app-kit": "1.3.1",
151
161
  "@agentproto/auth": "1.1.0",
162
+ "@agentproto/apps": "0.15.0",
152
163
  "@agentproto/driver": "0.2.4",
153
164
  "@agentproto/command-sandbox": "0.2.2",
154
- "@agentproto/driver-agent-cli": "2.5.0",
165
+ "@agentproto/driver-agent-cli": "2.5.1",
155
166
  "@agentproto/driver-http": "0.1.8",
156
- "@agentproto/eval-reporters": "0.2.16",
167
+ "@agentproto/eval-reporters": "0.2.18",
157
168
  "@agentproto/manifest": "0.2.2",
158
169
  "@agentproto/mcp-server": "0.4.0",
159
- "@agentproto/model-catalog": "0.11.0",
170
+ "@agentproto/model-catalog": "0.11.1",
160
171
  "@agentproto/plugin-local-browser": "0.3.0",
161
172
  "@agentproto/provider-kit": "0.4.5",
162
173
  "@agentproto/provider-presets": "0.7.0",
163
- "@agentproto/providers-store": "0.3.18",
174
+ "@agentproto/providers-store": "0.3.19",
164
175
  "@agentproto/redaction": "0.2.2",
165
- "@agentproto/routine": "0.3.0",
166
176
  "@agentproto/review": "0.2.0",
167
- "@agentproto/secrets": "1.0.0",
168
- "@agentproto/telemetry-langfuse": "0.2.14",
177
+ "@agentproto/routine": "0.3.0",
178
+ "@agentproto/sandbox": "0.7.0",
179
+ "@agentproto/secrets": "1.1.0",
180
+ "@agentproto/telemetry-langfuse": "0.2.16",
169
181
  "@agentproto/tool": "0.3.1",
170
- "@agentproto/workflow-loader": "0.2.4",
171
182
  "@agentproto/workflow": "0.7.0",
172
- "@agentproto/workspace-brain": "0.4.8",
173
- "@agentproto/workflow-runtime": "0.13.0",
174
- "@agentproto/sandbox": "0.6.0"
183
+ "@agentproto/workflow-loader": "0.2.4",
184
+ "@agentproto/workflow-runtime": "0.14.0",
185
+ "@agentproto/workspace-brain": "0.4.8"
175
186
  },
176
187
  "optionalDependencies": {
177
- "@agentproto/sandbox-e2b": "0.5.4"
188
+ "@agentproto/sandbox-e2b": "0.5.7"
178
189
  },
179
190
  "devDependencies": {
180
191
  "@types/node": "^25.9.5",
@@ -183,9 +194,9 @@
183
194
  "typescript": "^5.9.3",
184
195
  "vite-node": "^3.2.4",
185
196
  "vitest": "^3.2.7",
186
- "@agentproto/rendezvous": "0.2.3",
187
197
  "@agentproto/tooling": "0.1.0",
188
- "@agentproto/transcript-fixtures": "0.3.0"
198
+ "@agentproto/transcript-fixtures": "0.3.0",
199
+ "@agentproto/rendezvous": "0.2.3"
189
200
  },
190
201
  "scripts": {
191
202
  "dev": "tsup --watch",