@agentproto/runtime 4.0.0 → 4.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,476 @@
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
+ ## allowSharedCwd
149
+
150
+ Acknowledge that this nested spawn WILL run in place inside its parent's
151
+ working tree even when that tree has uncommitted changes and isn't an
152
+ isolated worktree — silencing the shared-dirty-cwd warning agent_start
153
+ otherwise returns in `warnings`. Only relevant for a delegated (depth > 0)
154
+ spawn with no `worktree` and no `sandbox`; ignored otherwise. Default false
155
+ = warn.
156
+
157
+ ## keepAlive
158
+
159
+ Exempt this session from the idle-reaper: it is never auto-retired for
160
+ sitting idle, no matter how long. For a supervisor that legitimately parks
161
+ — waiting on a child, waiting on a scheduled wake — idle looks identical to
162
+ finished, and the reaper would otherwise pull it out from under you.
163
+ Default false = today's behaviour. Toggle later with
164
+ `session_set_keepalive`.
165
+
166
+ ## options
167
+
168
+ Manifest-declared option id → value map (AIP-45 `options`), applied at
169
+ spawn time alongside `mode` — e.g. hermes' `skills` (string, prepended
170
+ before the subcommand) or a boolean flag appended when true. Each value is
171
+ validated against the option's declared `type`/`enum`/`min`/`max`; unknown
172
+ ids reject. Adapters that don't declare a given option id reject it.
173
+
174
+ ## skills
175
+
176
+ Normalized, adapter-agnostic skill ids for this session (e.g.
177
+ ['agentproto']). Merges with `~/.agentproto/config.json`'s
178
+ `defaults.skills` / `defaults.adapters.<slug>.skills` (global < per-adapter
179
+ < this field, which REPLACES rather than unions the config defaults when
180
+ provided — a deliberate exact set). Folded into `options.skills` using the
181
+ resolved adapter's declared shape (e.g. hermes' comma-joined `--skills
182
+ a,b`); adapters with no declared `skills` option (e.g. claude-code, which
183
+ auto-discovers from `~/.claude/skills`) ignore this — no-op.
184
+
185
+ ## model
186
+
187
+ Model identifier to pass to the adapter (e.g. 'claude-opus-4-8'). For ACP
188
+ adapters (claude-code) applied via session/set_config_option after
189
+ newSession — NOT via a CLI flag. Others may ignore it.
190
+
191
+ ## effort
192
+
193
+ Reasoning effort level (e.g. 'low', 'medium', 'high', 'xhigh', 'max',
194
+ 'ultracode'). IMPORTANT: effort is calibrated per model — the same label
195
+ maps to different compute budgets across models, and defaults differ by
196
+ model (Sonnet 4.6 / Opus 4.8 default 'high'; Opus 4.7 default 'xhigh').
197
+ 'max' and 'ultracode' are session-only. Omit to keep the model's own
198
+ default.
199
+
200
+ ## route
201
+
202
+ Billing route/gateway. This is independent of model and named access
203
+ profile.
204
+
205
+ ## access
206
+
207
+ Named auth profile to bill at initial spawn; resolved from the local
208
+ keychain.
209
+
210
+ ## posture
211
+
212
+ Canonical agent posture (plan, bypass, accept-edits, read-only) or native
213
+ harness mode.
214
+
215
+ ## contextProfile
216
+
217
+ Context intake profile (for example full or lean).
218
+
219
+ ## auth
220
+
221
+ Deterministic billing-auth mode + EXPLICIT credential for adapters that
222
+ declare it (today: claude-code). EXPLICIT credential selection, not
223
+ scrub-by-absence: `mode` picks 'subscription' (default) or 'api-key';
224
+ `token`/`apiKey` (matching the resolved mode) is the secret VALUE, merged
225
+ against `~/.agentproto/config.json`'s
226
+ `defaults.adapters.claude-code.auth` (this field's `mode` wins; the
227
+ credential for the resolved mode wins over the matching config field). For
228
+ claude-code, 'subscription' SETS CLAUDE_CODE_OAUTH_TOKEN to `token` (a
229
+ bearer token minted via `claude setup-token` — bills the Max/Pro
230
+ subscription, not API credits) and DELETES ANTHROPIC_API_KEY + the
231
+ cloud-provider redirect toggles + ANTHROPIC_BASE_URL. 'api-key' SETS
232
+ ANTHROPIC_API_KEY to `apiKey` and DELETES ANTHROPIC_AUTH_TOKEN — the
233
+ deliberate 'bill the API' choice. FAILS FAST (refuses the spawn, no
234
+ fallback) when the resolved mode has no credential configured anywhere. The
235
+ secret is never logged or echoed back — only a fingerprint appears on the
236
+ session descriptor / `agent_sessions_list`. Adapters that don't declare
237
+ this vocabulary ignore this field entirely. `source: "claude-code-oauth"`
238
+ (subscription mode, opt-in) instead reads the bearer FRESH on every spawn
239
+ from the local Claude Code login (Keychain / ~/.claude/.credentials.json) —
240
+ effectively self-refreshing; an explicit `token` still wins over it.
241
+
242
+ ## mcpServers
243
+
244
+ MCP servers to mount into the spawned agent's session at spawn time.
245
+ Forwarded verbatim to `session/new.mcpServers` on the ACP arm — gives the
246
+ child agent a host-chosen scoped toolset (e.g. the daemon's own
247
+ orchestration gateway so it can spawn + supervise sub-agents). Adapters
248
+ that don't model MCP mounting ignore it.
249
+
250
+ Each entry's `headers` are static HTTP headers sent with every request to
251
+ an `http`/`sse` server (ignored for `stdio`). `credentialRef` resolves a
252
+ brokered credential at spawn time into additional headers (typically
253
+ `Authorization`) — the secret never lives in env/config, and brokered
254
+ headers win on collision with `headers`. `args`/`env` are `stdio`-only
255
+ (argv and extra environment for the launched server; ignored for
256
+ `http`/`sse`).
257
+
258
+ ## orchestrator
259
+
260
+ Make this child a SCOPED orchestrator — auto-mount the daemon's own
261
+ orchestration MCP tools (start/prompt/wait/poll/output + subtree
262
+ list/kill) so it can spawn and supervise its OWN sub-agents. `true` = the
263
+ default curated subset; `{ tools: [...] }` narrows it. The daemon mints a
264
+ per-child scope-token, injects the scoped sub-gateway URL into the child's
265
+ session (alongside any `mcpServers` you pass), and revokes the token when
266
+ the session exits. Shell/fs/remote/import/terminal tools are NEVER exposed
267
+ this way.
268
+
269
+ The nested `tools` array is an explicit allowlist — narrows the
270
+ orchestration toolset to ⊆ the default subset; names outside the default
271
+ are dropped (a child can never widen its own scope). `maxDepth` (default 3,
272
+ hard ceiling 8) is the max recursion depth reachable through this child — a
273
+ spawn that would exceed it is rejected, and a recursive spawn can only
274
+ LOWER the inherited cap, never raise it. `maxChildren` (default 8) is the
275
+ max concurrently-alive sub-agents this child may spawn, same
276
+ lower-only rule for a recursive spawn.
277
+
278
+ ## notifyUrl
279
+
280
+ Optional per-session webhook URL. POSTed (fire-and-forget) on this
281
+ session's turn-end / awaiting-input / exited events, in addition to any
282
+ global notify URL.
283
+
284
+ ## wait
285
+
286
+ Block until the spawned session's first turn completes and include the
287
+ cleaned output in the response. Default false = return the descriptor
288
+ immediately. This blocks for the child's ENTIRE first turn (~40-90s+), not
289
+ just the spawn. Batching several `wait: true` calls in one turn does NOT
290
+ run them in parallel: harnesses that execute tool calls sequentially
291
+ serialize them, each wait blocking its slot until its child's turn ends.
292
+ For parallel fan-out spawn with `wait: false` (all spawns return in
293
+ seconds), then wait on completion separately via `agentproto sessions wait
294
+ <id> --until turn-end` (detached/background) or a completion policy via
295
+ `policy_attach`.
296
+
297
+ ## maxCostUsd
298
+
299
+ Hard ceiling on cumulative session cost (USD). The session is stopped at a
300
+ turn-end once exceeded.
301
+
302
+ ## costBudget
303
+
304
+ Windowed cost-budget cap (DISTINCT from `maxCostUsd`). Auto-attaches a
305
+ governance policy that trips `policy:failed` when the rolling windowed
306
+ spend for `scope` crosses `maxCostUsd`. Never kills the session — it trips
307
+ a policy for a supervisor to act on. `window` is a rolling window spec
308
+ ("5h"/"7d"/"P7D"); `scope` is `session` (this session only) or `profile`
309
+ (every session on its auth profile).
310
+
311
+ ## restartPolicy
312
+
313
+ Opt-in auto-restart policy. When set, an unexpected death (`crashed`
314
+ and/or `error`, per `on`) is automatically revived IN PLACE (reusing the
315
+ resume machinery — same session id, same conversation) after an
316
+ exponential backoff, up to a rolling-window crash-loop cap. Omit for
317
+ today's behaviour: a dead session stays dead until a human/orchestrator
318
+ prompts or restarts it.
319
+
320
+ `on` lists which automatic death reasons trigger a restart —
321
+ never a clean exit, an operator kill, an idle-reap, a daemon-restart death,
322
+ or a cost-budget kill, regardless of this list. `maxRetries` +
323
+ `windowMs` form the rolling-window crash-loop cap: give up once
324
+ `maxRetries` restarts have fired within `windowMs`. `baseDelayMs` is the
325
+ first restart's backoff delay, compounded by `factor` on each subsequent
326
+ restart up to the `maxDelayMs` ceiling. `resume` is reserved for a future
327
+ explicit resume-vs-fresh-spawn toggle; today's behaviour always revives in
328
+ place.
329
+
330
+ ## contextContinuity
331
+
332
+ Context-continuity policy for this session — controls warning,
333
+ opportunistic compaction, fresh-continuation, and hard-stop thresholds.
334
+ Resolved from global → per-adapter → explicit override.
335
+
336
+ ## role
337
+
338
+ Spawn-time role gating whether this child may itself delegate (spawn/drive
339
+ further children) and, if it can, which roles IT may in turn spawn.
340
+ Built-ins: 'executor' = leaf, cannot delegate — `orchestrator` is ignored
341
+ and `agent_start`/`agent_prompt` are stripped from its default toolset,
342
+ regardless of `promptAppend`. 'supervisor' = may delegate (today's default
343
+ behaviour). Custom roles installed as role packs (see `role_list`) resolve
344
+ the same way. A spawn made THROUGH an orchestrator is additionally gated by
345
+ the privilege lattice: the calling role may only spawn a role allowlisted
346
+ in its `spawnableRoles`, or — open mode, the default — at or below its own
347
+ `level` (never something MORE privileged than itself). Omit `role` to
348
+ derive from spawn depth (root spawns default to supervisor; spawns made
349
+ through an orchestrator default to executor — see
350
+ `defaultRoleDepthCutoff` in config.json's `defaults` block).
351
+
352
+ ## promptAppend
353
+
354
+ One-off runtime text layered ON TOP of the resolved role's disposition and
355
+ prepended to `prompt` — it specializes the disposition, it cannot replace
356
+ it, and it cannot re-open the tool gate (an executor asked to 'delegate
357
+ anyway' via this field still has no delegation tools).
358
+
359
+ ## deferredTools
360
+
361
+ Override deferred/lazy MCP tool loading for this spawn's daemon self-mount:
362
+ `true` hides every tool outside a small always-on set from `tools/list`
363
+ (still fully callable — use `tool_search` to look up a hidden tool's schema
364
+ by keyword before calling it), `false` keeps the full eager surface. Omit
365
+ to use the resolved role's own default ('executor' defaults ON, since it
366
+ can't delegate anyway and rarely needs the full ~190-tool surface); omit
367
+ AND spawn a role with no opinion to fall through to the daemon's own
368
+ boot-time `defaults.mcp.deferredTools` config.
369
+
370
+ ## browser
371
+
372
+ `"headless"` gives the spawned agent its own isolated headless Chrome
373
+ (1440x900, temporary profile) as a per-session `browser` MCP server
374
+ (chrome-devtools-mcp: navigate_page, take_screenshot, evaluate_script,
375
+ click, list_console_messages, …), torn down with the session (`true` =
376
+ `"headless"`). Works for any adapter that mounts stdio MCP servers; runs
377
+ inside the session's `commandSandbox` (`strict` ⇒ file:// only). `false` =
378
+ none. Omit to use the role / preset / `defaults.spawn.browser` default
379
+ (off). Not supported with `sandbox`.
380
+
381
+ ## trace
382
+
383
+ Emit Langfuse observability traces for this session (prompt/completion +
384
+ tool spans + tokens/cost). Off by default; requires langfuse eval-reporter
385
+ creds configured.
386
+
387
+ ## sandbox
388
+
389
+ Run this session inside a sandbox instead of on the host — pass a provider
390
+ slug (see `list_sandbox_providers`) or an inline AIP-36 SandboxDefinition
391
+ object. The daemon boots the sandbox, spawns `adapter` on the box's OWN
392
+ agentproto daemon, and proxies the conversation back onto this session —
393
+ `agent_prompt`/`agent_output`/`agent_kill` behave exactly as they do for a
394
+ local spawn, and the transcript stays readable here even after the box is
395
+ torn down. Omit to run locally (default). Pass an inline spec with `reuse:
396
+ "<sandboxId>"` (from a prior session's `sandboxId`) to reconnect to an
397
+ existing box instead — by default such a box is PAUSED (not killed) on
398
+ session close so it stays reusable; set `lifecycle.destroy_on` to always
399
+ kill it.
400
+
401
+ DO NOT CONFUSE with `commandSandbox` below — this field boots a WHOLE
402
+ SEPARATE machine/box; `commandSandbox` confines THIS host's own spawn argv
403
+ in place. The two are independent and combine (or not) freely;
404
+ `commandSandbox` is ignored for a `sandbox` spawn (the box's own daemon
405
+ would need to apply it).
406
+
407
+ ## appServe
408
+
409
+ Serve an agentproto app's UI from INSIDE the sandbox box and return its
410
+ public URL. Requires `sandbox` (rejected otherwise). The box daemon
411
+ installs the app (`app_install` on the in-box `dir`), launches `agentproto
412
+ app serve --host 0.0.0.0 --port <port>` detached through the box's
413
+ `command_execute`, and the spawn result + descriptor carry `appServe: {
414
+ appId, dir, port, url, ready }` — `url` is the provider-resolved public URL
415
+ for the served UI (the port is also added to the spec's `extraPorts` and
416
+ echoed in `sandboxPorts`).
417
+
418
+ ## commandSandbox
419
+
420
+ OS-level process confinement (macOS Seatbelt / Linux bubblewrap) for the
421
+ adapter's OWN spawned process on THIS host — NOT the `sandbox` field above,
422
+ which boots an entirely separate remote box. This wraps the exact argv
423
+ `adapter` spawns as (e.g. `claude`, `npx @agentclientprotocol/claude-agent-acp`)
424
+ so its process tree is denied filesystem access outside the session's `cwd`
425
+ — confinement an ACP permission seam can never provide, since it only sees
426
+ tool calls the adapter chooses to report, not what an in-process Bash
427
+ actually touches. `"off"` (default when omitted AND no
428
+ `.agentproto/command-sandbox.json` sets an `adapterSpawn.mode`) =
429
+ unconfined, unchanged behaviour. `"workspace"` = deny reads/writes to
430
+ $HOME outside the workspace (protects ~/.ssh, ~/.aws, credentials, …);
431
+ network stays allowed. `"strict"` = `"workspace"` + deny all network. A
432
+ workspace can set this same axis persistently via the `adapterSpawn` key of
433
+ `.agentproto/command-sandbox.json` (a DISTINCT key from the top-level
434
+ `mode` that key file also carries for `command_execute` — the two are never
435
+ shared; misconfiguring the whole-session adapter jail is a bigger blast
436
+ radius than misconfiguring one shell command) — this param, when set,
437
+ overrides that file. Ignored for a `sandbox` spawn. `"workspace"`/`"strict"`
438
+ with no backend installed for this platform (macOS needs `sandbox-exec`,
439
+ Linux needs `bwrap`) FAILS the spawn rather than silently running
440
+ unconfined.
441
+
442
+ ## worktree
443
+
444
+ Isolate this session in its OWN git worktree instead of spawning directly
445
+ in `cwd` — so a parallel agent can't collide on the working tree. `true`
446
+ provisions a worktree on a fresh branch `wt/<slug>` cut from origin/main
447
+ (slug auto-minted from `label`); pass `{ slug, base, async }` to pin either,
448
+ or opt into an early return (see `async` below). The daemon boots the
449
+ worktree (git worktree add + the repo's agentproto.json setup hooks) and
450
+ spawns `adapter` THERE; the session's cwd, and every path it edits, live
451
+ inside the worktree. Honoured only for a ROOT spawn (a spawn made THROUGH
452
+ an orchestrator inherits its parent's tree — no second worktree; an
453
+ EXPLICIT `worktree` on such a nested spawn is REJECTED, not silently
454
+ ignored — use `sandbox` to isolate a child) and only when `cwd` is inside a
455
+ git repo (nothing to isolate otherwise ⇒ spawns plain, no error). The
456
+ daemon's `worktrees.isolation` policy may force this ON for every root
457
+ spawn (`always`) or OFF (`never`, which REJECTS an explicit `worktree`).
458
+ Ignored for a `sandbox` spawn (the box already isolates). The worktree is
459
+ NOT auto-removed on session close — it holds the agent's work; tear it down
460
+ with `agentproto worktree rm|archive|gc`.
461
+
462
+ `slug` pins the worktree's slug (names its branch `wt/<slug>` and its
463
+ directory) — omit to auto-mint a collision-free one from the label. `base`
464
+ is the git ref the branch is cut from (default 'origin/main'). `async`
465
+ returns a real, registered session as soon as it's minted (status
466
+ "starting") instead of blocking `agent_start`'s response on `git worktree
467
+ add` + the repo's setup hooks, which can run minutes — provisioning + the
468
+ driver spawn continue in the background; poll the session's `status`
469
+ (flips to "running" on success, "error" with a readable `lastError` on
470
+ failure — it never sits in "starting" forever). Any `prompt` is held and
471
+ dispatched only once the tree and the driver session both exist.
472
+ Incompatible with `wait` (there is no first-turn output to block on yet) —
473
+ combining the two is rejected. Defaults to true for any spawn that
474
+ provisions a worktree, UNLESS this call also sets `wait` (which falls back
475
+ to the old synchronous path instead of conflicting). Pass `false`
476
+ 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": "4.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
  ],
@@ -147,34 +158,34 @@
147
158
  "@agentproto/agent": "0.2.4",
148
159
  "@agentproto/app-client": "0.4.0",
149
160
  "@agentproto/app-kit": "1.3.0",
150
- "@agentproto/apps": "0.13.0",
161
+ "@agentproto/apps": "0.13.1",
151
162
  "@agentproto/auth": "1.1.0",
152
- "@agentproto/driver": "0.2.4",
153
163
  "@agentproto/command-sandbox": "0.2.2",
154
- "@agentproto/driver-agent-cli": "2.5.0",
164
+ "@agentproto/driver": "0.2.4",
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.17",
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.6.1",
179
+ "@agentproto/secrets": "1.1.0",
180
+ "@agentproto/telemetry-langfuse": "0.2.15",
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.13.1",
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.5"
178
189
  },
179
190
  "devDependencies": {
180
191
  "@types/node": "^25.9.5",