@robota-sdk/agent-session 3.0.0-beta.79 → 3.0.0-beta.81

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/CHANGELOG.md CHANGED
@@ -1,5 +1,650 @@
1
1
  # @robota-sdk/agent-session
2
2
 
3
+ ## 3.0.0-beta.81
4
+
5
+ ### Minor Changes
6
+
7
+ - 3038eb7: A message from another session is instant messaging: text from an untrusted third party that
8
+ carries no authority. What the model does with it is decided by the session's ordinary permissions —
9
+ rules, permission mode and remembered consent — exactly like the session's own work. The per-origin
10
+ peer policy is gone.
11
+
12
+ **BREAKING**
13
+
14
+ - `agent-core`: `IPermissionEvaluationContext.peerTurn` is now a boolean. It decides only whether a
15
+ `repliesToPeer` tool exists; every other call in a peer turn is decided as in any turn. Removed:
16
+ `isToolAvailableInPeerTurn`, `isSecretPath`, `IPeerTurnAuthority`, `TPeerReach` (now exported by
17
+ `agent-interface-session-mobility`) and `IToolPermissionProfile.workspacePaths`.
18
+ - `agent-tools`: `Read` and `Glob` no longer declare `workspacePaths`.
19
+ - `agent-session`: `ISessionRunOptions.peerReach` is replaced by `peerTurn?: boolean`, and
20
+ `ISessionOptions.allowPeerChanges` is removed. An ask in a peer turn is answered like any other:
21
+ a consent the operator remembered answers it, and an "always allow" given there is remembered.
22
+ - `agent-interface-session`: `IPeerTurnContext` no longer has `reach`; it carries only the reply
23
+ route.
24
+ - `agent-interface-session-mobility`: `peerReachOf` is removed; `TPeerReach` moves here. A delegated
25
+ turn carries no reach.
26
+ - `agent-framework`: the `peers.allowChanges` setting is removed (an existing value is ignored). A
27
+ peer turn is offered the ordinary tools, plus `peer_reply`.
28
+
29
+ **Changes**
30
+
31
+ - `agent-framework`: the per-turn statement tells the model the message is an opinion from an
32
+ untrusted third party, not its owner's instruction, and that it decides for itself whether and how
33
+ to act. A message still expands no `@path` and attaches no context reference, and its requests
34
+ still carry no provider-hosted tool, since no permission step can decide one. The session takes
35
+ at most 6 messages a minute and 30 an hour from each sender for a turn; a message over the limit
36
+ is refused with a reason the sender receives. A prompt answer given in the name of a `peer:` or `external:`
37
+ driver is ignored. External-event turns keep their tool-less baseline.
38
+ - `agent-cli`: incoming peer turns carry only their reply route.
39
+
40
+ - 02b7452: A reply to a peer session is decided by the permission system like any call that sends something
41
+ off this machine, and it goes only to the sender that was admitted.
42
+
43
+ - `agent-core` — a tool declaring `repliesToPeer` is still refused outside a peer turn; inside one it
44
+ is decided by the ordinary steps: deny, ask and allow rules, then the mode. It declares no risk
45
+ class, so it asks by default, is refused in plan mode and proceeds under bypass. `IPeerTurnAuthority`
46
+ no longer has `toolUsed`.
47
+ - `agent-session` — an "always allow" answer to the reply is remembered and answers later replies,
48
+ as for any tool; other asks in a peer turn still need a fresh approval each time.
49
+ - `agent-framework` — `peer_reply` asks the operator by default, showing the full text and the peer
50
+ it goes to; `permissions.allow`/`deny` rules naming `peer_reply` apply. `PeerMessageIngress`
51
+ refuses a message whose origin names a sender other than the admitted one, or whose admission names
52
+ no sender, and submits the turn with the admitted identity.
53
+ - `agent-cli` — a local peer message is taken as coming from the session it names only when that
54
+ session confirms, at its own socket, that it is sending exactly that message to this receiver.
55
+ The reply target, the driver id and the operator's notices come from the confirmed sender. A
56
+ session on an earlier version cannot confirm, so its messages are refused; both sessions need this
57
+ version to message each other.
58
+
59
+ - 18b52cc: Built-in commands are offered to the model deliberately, each described for the model, and never
60
+ with a trust, credential or permission-widening action.
61
+
62
+ - `agent-interface-command` — `ICommand` gains `modelDescription?` (what the model is told, beside the
63
+ short `/help` line), and `modelInvocable` on a subcommand entry now narrows what the model may run.
64
+ - `agent-framework` — `ISystemCommand` gains `modelDescription?` and `modelRequiresPermission?`.
65
+ Once any subcommand of a model-invocable command declares `modelInvocable`, the model may run only
66
+ the bare command and the subcommands declared `true`; everything else, including an alias or an
67
+ undeclared subcommand, is refused before the command runs. The model-facing descriptor lists only
68
+ that subset. A model-requested monitor's command is now decided by the shell tool's gate (its
69
+ Bash/Shell rules, the mode and the prompt) and a refusal rejects with the new
70
+ `MonitorCommandRefusedError`. The `scriptedSession` test harness accepts `permissions` patterns.
71
+ - `agent-session` — `Session.checkToolPermission(toolName, toolArgs)` decides an action that has a
72
+ tool's effect by another route: that tool's PreToolUse hooks, then the gate's rules, mode,
73
+ remembered consent and prompt — never the command sandbox's auto-approval, since the action does
74
+ not run inside the sandbox.
75
+ - `agent-framework` also: `ICommandMCPActivationAdapter.userActionSurface?` tells `/mcp` whether the
76
+ user can type a session command, so the model's status names the terminal sign-in otherwise.
77
+ - `agent-command` — `/context` (bare and `list`), `/cost` (the report, not `budget`) and `/mcp`
78
+ (`status` only, without a prompt) are now model-invocable; `/memory approve` and `/memory reject`
79
+ are now user-only; the model's `/monitor` is decided by the shell gate rather than by consent to
80
+ the command's name. Every model-invocable command carries a model-facing description. The model's
81
+ `/mcp status` shows only safe names, states and the command to suggest, and a caller that does not
82
+ identify itself gets that view. `/context list` accounts only for turns still in context. New
83
+ `mcpUserActionNotice`, `mcpUserActionCommand` and `mcpUnavailableServersNotice` build the fixed
84
+ notices.
85
+ - `agent-command-workflows` — `/workflows` carries a model-facing description.
86
+ - `agent-mcp` — `createDiscoveredTool` accepts `authFailureNotice`: a call the server refuses for
87
+ authentication returns that host text instead of the generic failure.
88
+ - `agent-cli` — an MCP server that did not start because the user must approve it, trust the
89
+ workspace or sign in is named to the model at the start of an interactive session with the
90
+ command to suggest, and a
91
+ signed-in OAuth server that refuses a call tells the model to suggest `/mcp login <server>` — or, in print and serve runs, the terminal
92
+ `robota mcp login <server>`.
93
+
94
+ A command whose bare form is a complete action declares `runsBare`, so choosing `/cost` or `/mcp`
95
+ from the autocomplete menu still runs it even though they now declare subcommands.
96
+
97
+ - 9843fe6: Sign in to a remote MCP server from inside a session, and use its tools without restarting.
98
+
99
+ - **`/mcp login <server> [--no-browser]`** runs the same per-server OAuth sign-in as
100
+ `robota mcp login` (discovery checks, PKCE, `state`, RFC 9207 `iss`, RFC 8707 resource, the
101
+ loopback listener, the lock-guarded store). It opens the browser through the argv opener; with
102
+ `--no-browser`, or when no browser can be opened, it shows the authorization URL and asks for the
103
+ redirect URL in the session's own prompt (masked), held to the same rules as a pasted redirect in
104
+ the terminal. A failed, refused, timed-out or cancelled sign-in changes nothing and is reported by
105
+ a fixed reason only. `/mcp login <server> --client-secret` is refused: a secret is never typed into
106
+ a session, and `robota mcp login <server> --client-secret` is named instead (also after a failed
107
+ token exchange for a pre-registered client). `/mcp` stays user-only (`modelInvocable: false`).
108
+ - **Connected in the same session:** after a sign-in, a server that could not connect for want of
109
+ one goes through the normal admission (approval, fingerprint, trust) and connects, and its tools
110
+ are offered from the next message; a server that was already connected is admitted again and
111
+ reconnects, and its authenticator drops what it held and reads the new credential. A tool left out
112
+ because the session already has its name is reported, and only tools actually added get
113
+ provenance. In browser mode the authorization URL is shown in the session prompt before the
114
+ browser opens, where the user can also choose to paste the redirect instead or cancel.
115
+ - **`runMCPOAuthLogin`** takes `readRedirectWhenBrowserFails`: when `openBrowser` rejects, the
116
+ loopback listener stops and the pasted redirect is read instead, for the same redirect URI. The
117
+ loopback listener's time limit now runs from its first `wait()` — once the authorization page is
118
+ handed over — so time spent at a prompt before the browser opens does not count against it.
119
+ - **`Session.addTools`** (and `ICommandSessionTools.addTools`) offers tools that became usable
120
+ mid-session, through the same permission gate and — via `ISessionOptions.wrapAddedTools`, which
121
+ `createSession` sets — the same edit-checkpoint and reversible-execution wraps as the assembled
122
+ tools. A name the session already has is left out, never replaced. Calls are serialized, and tools
123
+ added while a turn runs are applied when the next turn starts, so a turn's rounds all see one
124
+ tool list and the prompt cache misses once, at that boundary.
125
+ - **Breaking (`agent-framework`, major):** `addTools` is a new required member of the
126
+ `ICommandSessionTools` role port (and so of `ICommandSessionRuntime`). A host that implements the
127
+ port itself must add it; one that passes an `agent-session` `Session` already has it.
128
+ - **`ICommandMCPActivationAdapter.oauthLogin`** (`ICommandMCPOAuthLoginRequest`,
129
+ `ICommandMCPOAuthLoginResult`, `ICommandMCPOAuthRedirectPrompt`) is the port behind it.
130
+ - The sign-in notice and `/mcp status` now suggest `/mcp login <server>` in a session and
131
+ `robota mcp login <server>` in a terminal; the server's name is shown only when it is safe to paste
132
+ into any shell, otherwise `<server>`.
133
+
134
+ ### Patch Changes
135
+
136
+ - Updated dependencies [3038eb7]
137
+ - Updated dependencies [02b7452]
138
+ - Updated dependencies [ec5e477]
139
+ - @robota-sdk/agent-core@3.0.0-beta.81
140
+ - @robota-sdk/agent-interface-session@3.0.0-beta.81
141
+ - @robota-sdk/agent-interface-execution@3.0.0-beta.81
142
+ - @robota-sdk/agent-file-authority@3.0.0-beta.81
143
+
144
+ ## 3.0.0-beta.80
145
+
146
+ ### Major Changes
147
+
148
+ - 807d161: **BREAKING — ARCH-010: the execution root is a required contract field, and the containment guard now fails closed.**
149
+
150
+ The file-tool containment guard was fail-open: with no root configured it answered "allowed". A tool
151
+ built with no `cwd` therefore had no boundary — measured, a `Read` constructed that way returned the
152
+ contents of `/etc/hostname` — and the child-process subagent worker called `createDefaultTools()` with
153
+ no argument at all, so subagents got exactly that. Three independent auditors found three different
154
+ symptoms of this one missing field.
155
+
156
+ **Removed — seven context-free tool singletons.** `readTool`, `writeTool`, `editTool`, `globTool`,
157
+ `grepTool`, `shellTool`, `bashTool` are gone from `@robota-sdk/agent-tools`. A module-level instance is
158
+ bound at import time and can carry no containment root, so after the guard was inverted they could only
159
+ refuse everything.
160
+
161
+ Migrate to the factory of the same name, passing the directory the tool is allowed to work in:
162
+
163
+ ```ts
164
+ // before
165
+ import { readTool, globTool } from '@robota-sdk/agent-tools';
166
+ const tools = [readTool, globTool];
167
+
168
+ // after
169
+ import { createReadTool, createGlobTool } from '@robota-sdk/agent-tools';
170
+ const cwd = process.cwd(); // or the workspace this agent is scoped to
171
+ const tools = [createReadTool({ cwd }), createGlobTool({ cwd })];
172
+ ```
173
+
174
+ `webFetchTool`, `webSearchTool` and `askUserQuestionTool` are unchanged — they touch no filesystem, so
175
+ there is no root to contain them by.
176
+
177
+ **`cwd` is now REQUIRED** on `ISandboxToolOptions`, `IContainedBuiltinToolOptions` (and everything
178
+ extending them), `ICreateDefaultToolsOptions`, `ISessionOptions` and `ISubagentOptions`. The `= {}`
179
+ default parameter was removed from every builtin factory — that default was the mechanism by which
180
+ "forgot the root" was legal. `new Session({...})` without `cwd` no longer compiles, and also throws at
181
+ construction, because a required field is only required to a TypeScript caller.
182
+
183
+ **`Session` no longer reads `process.cwd()`.** It uses the root it was given, and `getCwd()` exposes it
184
+ so a fork or subagent asks the session instead of re-deriving a root that can disagree with it.
185
+
186
+ **Behavioural change even for callers that already passed a root**: a tool that somehow reaches the
187
+ guard with no root now REFUSES with an explicit error ("no containment root is configured … this is an
188
+ assembly bug, not a path problem") instead of allowing the access.
189
+
190
+ - 64ba748: **BREAKING — ARCH-042: project filesystem access is now an explicit, host-issued authority instead of an ambient consequence of `cwd`.**
191
+
192
+ `@robota-sdk/agent-framework` adds `WorkspaceTrustService` and the opaque
193
+ `IWorkspaceProjectAuthority`, plus bounded reader, settings-writer, state-storage, and mutation
194
+ facets. Public session, settings, context, checkpoint, memory, contribution, query, and replay
195
+ contracts consume those facets. A caller that does not supply `projectAccess` is deliberately
196
+ restricted to user-owned host state and receives no project filesystem capability.
197
+
198
+ The framework removes or renames ambient Node/project exports. Migrate `checkSettingsFile` to
199
+ `checkNodeHostSettingsFile`, `readMergedProviderSettingsFromPaths` to
200
+ `readMergedProviderSettingsFromSources`, `resolveProviderSettingsWriteTargetPath` to
201
+ `resolveProviderSettingsWriteTarget`, `FileSystemMemoryStore` / `createFileSystemMemoryStore` to
202
+ `WorkspaceMemoryStore` / `createWorkspaceMemoryStore`, and `PluginSettingsStore` to
203
+ `NodeHostPluginSettingsStore`. Host-only git helpers now carry the `FromNodeHost` suffix.
204
+ `projectPaths`, `resolveSettingsPathForScope`, and `getProviderSettingsPaths` are removed; project
205
+ consumers must use the authority facets rather than recover absolute paths.
206
+
207
+ `@robota-sdk/agent-session` renames the Node filesystem implementation `SessionStore` to
208
+ `NodeSessionStore` and adds explicit session-log/external-payload source and sink ports. Session
209
+ replay no longer resolves external payload files from an ambient directory.
210
+
211
+ `@robota-sdk/agent-interface-transport` changes `ISkillExecutionPort.loadCommands(cwd, home?)` to
212
+ the authority-bound `loadCommands()` and removes the optional absolute-path leak
213
+ `IInteractiveSessionStore.getFilePath`. `@robota-sdk/agent-command` consequently replaces the
214
+ `cwd` option of `createSkillsCommandModule` with required `contributionSources`; default command
215
+ composition accepts explicit contribution sources and discovers no project skills when none are
216
+ provided.
217
+
218
+ `@robota-sdk/agent-cli`, `@robota-sdk/agent-transport`, and
219
+ `@robota-sdk/agent-transport-tui` thread the trusted-or-restricted project decision through every
220
+ session surface. Embedded callers that need project settings, state, context, skills, checkpoints,
221
+ or mutation must mint access through `WorkspaceTrustService` and pass the returned
222
+ `projectAccess` (and a separately approved mutation/settings facet where required). Omitting it is
223
+ still type-compatible but is behaviorally breaking: the surface now fails closed instead of
224
+ reading or writing the current directory.
225
+
226
+ - 242a644: Require versioned, event-decoded session replay logs. Reject unknown, malformed, and unsupported
227
+ entries instead of dropping them or inventing message fields. Replay-only session loads and lists
228
+ report damaged logs explicitly. Legacy unversioned JSONL is not accepted; snapshot encoding remains
229
+ unchanged. Persisted logs now use schema version 1, and all replay entry points share the session-owned
230
+ decoder and preserve sidecar integrity failures.
231
+
232
+ ### Minor Changes
233
+
234
+ - 9368d00: Advisor escalation: the main model can consult a second model at the decision points it chooses.
235
+
236
+ With an advisor configured (`--advisor <profile>[:<model>]`, or the `advisorModel` setting that
237
+ `/advisor` saves; the flag wins), the session gets an `Advisor({ question? })` tool. The advisor reads
238
+ the whole conversation — system prompt, messages, tool calls and results — serialized into one prompt
239
+ and sent with `toolChoice: 'none'`, truncated from the front to fit its window with the system prompt
240
+ kept, and declines when even that does not fit. Its answer comes back framed as guidance to verify;
241
+ an empty or refusing answer reads as declined. Calls are limited to two per turn and a fixed number
242
+ per session, parallel calls in one round share those limits, and a repeated question in the same
243
+ turn returns the earlier answer. A request that was sent counts even when the provider failed (the
244
+ decline is reported by class, never by its text); only a call declined before sending gives its slot
245
+ back.
246
+
247
+ Advisor usage, including in-process subagents', is recorded where each turn's usage is recorded —
248
+ the persisted session history, under the advisor's own provider and model — so `/cost`, usage reports
249
+ and resumed sessions include it. `/cost` now totals that history and prices each part on its own
250
+ model, showing "mixed" when more than one model was priced.
251
+
252
+ `/advisor <model>` and `/advisor off` change only where calls go, never the tool list, so the main
253
+ model's prompt cache is not invalidated mid-session; the tool is added only when a session starts
254
+ with an advisor. Sending history to a destination (provider type and endpoint host) the main model
255
+ does not already use needs a one-time consent per destination, kept in the user settings file; a
256
+ refusal is remembered for the session. The organization's `allowedProviders` applies, and
257
+ `ROBOTA_DISABLE_ADVISOR=1` turns it off completely. In-process subagents inherit the advisor, bound
258
+ to their own conversation; child-process subagents do not get it.
259
+
260
+ **`@robota-sdk/agent-framework` is `major` for one reason: `ICommandHostSessionAccess` gains a
261
+ required member,** `getSessionUsage()`, the session's persisted usage records. An external
262
+ implementation of that role port stops compiling until it adds the method. The rest is additive.
263
+
264
+ - `agent-session` — `formatConversationEntries`, the one text rendering of a conversation, now used
265
+ by compaction too. It keeps tool calls and results, marks a user message a peer session sent
266
+ (`user [from "peer:<id>"]`), and JSON-encodes every message onto one line so no content can forge
267
+ another entry; compaction previously flattened all of this. `Session.getProvider()` returns the
268
+ provider the session currently uses.
269
+ - `agent-framework` — `AdvisorController`, `createAdvisorTool`, the advisor spec helpers, provider
270
+ destinations (`describeProviderDestination`, `rememberProviderDestination`), `getSessionUsage` and
271
+ `ISessionUsageRecord`, the `onUsageRecorded` session option, and the optional `advisor` command
272
+ host adapter. Session assembly binds a host-supplied Advisor tool to the session holding it.
273
+ - `agent-command` — the `/advisor` command module; `/cost` reads the session's persisted usage.
274
+ - `agent-cli` — the `--advisor` flag, `advisorModel` setting, per-destination consent store and kill
275
+ switch.
276
+ - `agent-ui-terminal` — a usage line from another source (the advisor, a background task) names that
277
+ source and leaves out the context window it does not have.
278
+ - `agent-session-analytics` — personal usage counts an advisor call's tokens and cost toward its
279
+ turn without counting it as a turn.
280
+
281
+ - 4078a72: Model fallback chain. `--fallback-model a,b` (or the `fallbackModel` settings array; the flag wins) names up to three models a turn moves to when its model is overloaded, unavailable or failing on the server. An entry is a provider profile, `profile:model`, a bare model on the primary's provider, or `default`. The move happens only before any output has streamed, lasts for the current turn, and is shown as a system note; entries that cannot be built are passed over and entries outside the organization's `allowedProviders` are dropped with a notice. `FallbackProvider` in agent-framework implements it over the session's provider; `IChatOptions` gains `executionId`, `onModelFallback` and `preserveContextWindow`, `IAIProvider` gains optional `resolveModelRoute`, and the execution loop emits a `provider_fallback` event and attributes requests, call observations, committed replies, the response cache and usage to the model that answered. A turn that ran on more than one model records per-model `modelShares` on its usage observation, which personal usage reports split by model and provider. A `/provider` switch keeps the chain, read again for the new primary.
282
+ - 196a900: Permission rules can say more than one argument per tool.
283
+
284
+ - **`Tool(name:value)` in deny and ask rules** matches a named top-level parameter, with `*` in the
285
+ value (`Bash(run_in_background:true)`, `Agent(model:opus*)`, `github__create_issue(repo:acme/*)`).
286
+ It is a parameter rule only when `name` is one of the tool's parameters, so
287
+ `WebFetch(https://…)` keeps its meaning. A parameter the call omits never matches, and a
288
+ non-scalar value is unevaluable, so the call asks. Allow rules may not use the form.
289
+ - **A rule on the primary field** (`Bash(command:rm *)`) is reported at startup and asks on every
290
+ call, instead of being silently ignored.
291
+ - **Tool-name globs.** Deny and ask rules may glob the tool name (`github__*`). Allow rules may do so
292
+ only after a literal `<server>__` prefix; an unanchored allow glob is refused at construction.
293
+ - **A bare-name deny removes the tool from the model's context.** `Tool`, `Tool(*)` or a name glob
294
+ withholds it from the offered set and the deferred-tool catalogue, live, instead of offering it
295
+ and refusing every call. `IAgentConfig.isToolVisible` is the new seam.
296
+ - **MCP canonical names keep the whole `<server>__` prefix when truncated**, so a server glob still
297
+ names every tool of that server.
298
+
299
+ - f336838: One permission evaluation order for every caller. The interactive session, background tasks and
300
+ subagents used to run two different resolvers, so the same call could be decided differently
301
+ depending on who made it. They now share `evaluatePermission`, and a background policy only adds a
302
+ ceiling, an ask-everything flag and the task's own lists to it:
303
+
304
+ deny → caller ceiling → unevaluable deny (ask) → never-auto-approve set (ask) → ask-everything →
305
+ bypassPermissions → allow → mode.
306
+
307
+ - **`ask` rules.** `permissions.ask` patterns always ask, in every mode including
308
+ `bypassPermissions`. They are matched per command like a deny rule, and are validated at
309
+ construction alongside `allow` and `deny`.
310
+ - **Never auto-approved, bypass included:** removing a critical path with `rm`/`rmdir` (the root, a
311
+ top-level directory, home, the working directory or a parent), and a modify-class write into
312
+ `.git`, `.robota`, `.claude`, `.agents`, `.mcp.json`, `.gitconfig`, `.npmrc` or a shell rc file.
313
+ Files inside an isolated worktree (`.robota/worktrees/<name>/…`) are ordinary files. With no
314
+ approver attached, an ask is a denial.
315
+ - **A ceiling is checked before bypass and before any ask.** A subagent's `inherit-allowlist` ceiling
316
+ is now the parent's _effective_ rules, read live at spawn: settings, preset lists and command
317
+ auto-allows. It used to be the raw settings file. An unevaluable deny under a policy now asks,
318
+ like everywhere else, where it used to deny outright; with no approver it is still a denial.
319
+ - **Settings layers union `permissions.allow`**, as they already did `deny`. A checked-in project
320
+ file no longer silently discards the user's allow list.
321
+ - **Print mode, `createQuery()` and headless sessions default to `default` mode**, not
322
+ `bypassPermissions`. They have no approver, so a call that would ask is denied. Pass
323
+ `--permission-mode` / `permissionMode: 'bypassPermissions'` explicitly for unattended runs.
324
+
325
+ **Breaking:**
326
+ - `@robota-sdk/agent-core` removes `resolvePermissionByPolicy` and `TPermissionPolicyDecision` in
327
+ favour of `projectPermissionPolicy` plus `evaluatePermission`'s new `context` argument.
328
+ - `@robota-sdk/agent-framework` changes the settings merge rule for `permissions.allow`, and the
329
+ default permission mode of `createQuery()` and headless sessions.
330
+
331
+ - 34e50f0: A new permission mode, `auto`, lets a model classifier approve or block what would otherwise prompt.
332
+
333
+ - **What it decides:**
334
+ - Reads and in-workspace edits run as in `acceptEdits`.
335
+ - Commands and other calls the mode leaves open go to the classifier, a side call to the
336
+ session's own model. It sees the call, the working directory and the git remotes, never the
337
+ conversation.
338
+ - A block reaches the model with its reason, so it can take another route.
339
+ - **What still reaches a person, or is refused:**
340
+ - Deny rules and background ceilings apply first.
341
+ - `ask` rules, critical removals and protected paths ask a person.
342
+ - After 3 refusals in a row (blocks, or no usable verdict), or 20 blocks in the session, the
343
+ mode asks a person until one approves.
344
+ With no one to ask, the call is denied.
345
+ - **Allow rules:** in `auto` mode, allow rules that approve any command are set aside while the
346
+ mode is on. Examples are `Bash(*)`, an interpreter (`Bash(python *)`), a package runner
347
+ (`Bash(npm run *)`, `Bash(pnpm exec *)`), `Agent`, `ExecuteCommand` or `Computer`. Narrow
348
+ rules still apply.
349
+ - **Retry:** `/permissions` lists classifier blocks. `/permissions retry <n>` lets that exact call
350
+ run once, unjudged, when the model tries it again.
351
+ - **Turning it on and off:**
352
+ - `--permission-mode auto`, `/mode auto` or `/permissions auto`.
353
+ - An organization turns it off with `disableAutoMode` in the org policy.
354
+ - **New contracts:**
355
+ - `TPermissionMode` gains `'auto'`.
356
+ - `allowRulesForAutoMode` and `isBroadExecutionAllowRule`.
357
+ - `IPermissionClassifier` and `AutoModeGate`.
358
+ - The `permissionClassifier` session option.
359
+ - `Session.retryPermissionDenial`, and `retryDenial` on the permission-mode adapter.
360
+ - The `'classifier'` denial reason.
361
+ - `createModelPermissionClassifier`.
362
+ - The `disableAutoMode` option on `createSession` and `IOrgPolicy`.
363
+
364
+ - 722e88a: Shell commands can run in an OS-level sandbox: bubblewrap on Linux and WSL2, Seatbelt on macOS.
365
+
366
+ - **Confinement:** covers the command and every process it starts.
367
+ - Writes are limited to the working directory, the temporary directories and
368
+ `sandbox.filesystem.allowWrite`.
369
+ - Agent, git-hook, MCP and shell configuration inside the workspace stays read-only.
370
+ - `sandbox.filesystem.denyRead` hides paths from the command.
371
+ - The network is on or off (`sandbox.network.enabled`).
372
+ - **Modes:** `/sandbox` switches between `auto-allow`, `regular` and `off` for the next command and
373
+ saves the choice.
374
+ - In `auto-allow` (`sandbox.autoAllowBashIfSandboxed`), a confined command runs without a prompt
375
+ in `default` and `acceptEdits`.
376
+ - Deny rules, ask rules, critical removals and plan mode still apply first.
377
+ - **Exclusions:** `sandbox.excludedCommands` run unconfined, through the ordinary permission path.
378
+ - **When the sandbox cannot run:** a missing or unusable backend is reported at startup, in
379
+ `robota doctor` and in `/sandbox`, and commands then run unconfined.
380
+ `sandbox.failIfUnavailable` refuses to start instead.
381
+ - **New contracts:**
382
+ - `OsSandboxClient`, `detectOsSandbox`, `bubblewrapArguments`, `seatbeltProfile`.
383
+ - `ISandboxClient.wrapCommand` and `autoApproves`.
384
+ - `IPermissionEvaluationContext.sandboxAutoApproved`.
385
+ - The `commandSandbox` session option.
386
+ - The `sandbox` settings key and the `sandbox` command host adapter.
387
+
388
+ - a5cc36e: `/permissions` shows the rules the session enforces and the calls it refused.
389
+
390
+ - **Rules by source:** each allow, deny and ask rule the gate reads is listed under the settings file
391
+ that declares it. Rules added by a CLI flag, a preset or a command are listed under "this session".
392
+ A rule a settings file declares but the session does not enforce is not shown.
393
+ - **Recent denials:** the latest refused calls, most recent first, with the reason: a rule or the
394
+ mode, the user declining, or no one available to approve.
395
+ - New contracts: `Session.getRecentPermissionDenials()`, `PermissionEnforcer.getRecentDenials()`,
396
+ `IPermissionDenial`, the `permissionRules` host adapter (`createSettingsPermissionRulesAdapter`),
397
+ and `getPermissionRules` / `listRecentDenials` on `ICommandPermissionModeAdapter`. Settings
398
+ provenance now covers `permissions.ask`.
399
+
400
+ - d23c848: Built-in read-only shell commands run without a prompt.
401
+
402
+ A Bash call is decided like a read, and runs without a prompt in every mode (`plan` included), when
403
+ every command in it comes from the fixed read-only set (`ls`, `cat`, `grep`, `find` without actions,
404
+ `git status`/`log`/`diff`/`show` and similar) and it also:
405
+
406
+ - stays inside the workspace: every path operand resolves inside once symlinks are followed, as
407
+ `Read` requires;
408
+ - uses only printable ASCII syntax that bash, zsh, fish and PowerShell all read the same way.
409
+
410
+ Deny and ask rules still apply first. A command that writes through a redirect, expands or
411
+ substitutes anything, or runs git outside the session's repository takes the ordinary path.
412
+
413
+ New exports: `isReadOnlyCommandLine` and `TResolveInWorkspace`. `IPermissionEvaluationContext`
414
+ gains `resolveInWorkspace`, which `PermissionEnforcer` supplies.
415
+
416
+ - b078afa: Restore full-fidelity replay for session-log values externalized to content-addressed sidecar files.
417
+
418
+ `agent-session` now exports a bounded, containment- and integrity-checked recursive payload resolver,
419
+ hydrates JSONL logs at their read boundary, and rejects unresolved replay-substrate values during raw
420
+ validation. `agent-provider-replay` reuses that resolver for direct construction and file loading so
421
+ large recorded responses remain aligned with later calls.
422
+
423
+ - b078afa: Preserve complete resumable session records when the raw Session writer re-saves them.
424
+
425
+ `IInteractiveSessionStore` is now the canonical persistence port, including its optional file-backed
426
+ record-path capability. `agent-session` consumes the canonical record and store contracts directly and
427
+ keeps its former type names only as compatibility re-exports.
428
+
429
+ - 2ebff01: Complete the public session-log event vocabulary for every production writer/reader event and pass
430
+ the session-owned compaction trigger unchanged to PreCompact, PostCompact, logging, and callbacks.
431
+ - 4b76cfa: NEUT-005 (wave 2): restore an actionable context-capacity hint at the surface tier, neutrally. The zero-dependency `agent-core` layer emits a product-neutral hard-capacity notice and exposes the `IAgentConfig.contextCapacityHint` seam (wave 1). This wave wires that seam end-to-end without baking product vocabulary into a neutral library:
432
+
433
+ - `agent-session`: `ISessionOptions.contextCapacityHint` is forwarded into the Robota agent config (`buildRobota`), making the core seam reachable from the consuming layer.
434
+ - `agent-framework`: new `deriveContextCapacityHint(commandModules)` derives the concrete remediation wording from the surface's OWN registered command set (names a registered `compact` command → `"Run /compact and retry."`; `undefined` when none, leaving the neutral core default). It is applied automatically in interactive session assembly across the TUI, print, and `--serve` surfaces.
435
+ - `agent-cli`: the default command set registers `/compact`, so end users regain the actionable hint.
436
+ - `agent-interface-transport`: reworded the `'allow-project'` permission comment so it no longer hardcodes a storage path (the location is owned by the consuming layer), matching the `agent-session` twin.
437
+
438
+ - fcb0da3: PAYLOAD-2153: make external-payload replay stable across Linux, macOS, and Windows.
439
+
440
+ - Add the domain-free `@robota-sdk/agent-file-authority` leaf with bounded, root-relative reads over retained native handles and a typed, path-safe refusal taxonomy.
441
+ - Route session replay and framework project reads through the shared authority while preserving their existing domain-specific budgets, integrity checks, and error mappings.
442
+ - Expose the canonical safe session-id predicate through the framework facade so CLI exact-session lookup stays within the SDK package boundary.
443
+ - Package the pinned native bridge in clean-installed Node CLI archives and exact-host standalone Bun binaries, refusing unsupported or mismatched targets before artifact mutation.
444
+
445
+ - 9814afc: Type-SSOT convergence (TYPE-003; re-audit CONTRACT-002/003/011/012 + RUNTIME-47 + STRUCT-04). Behavior is unchanged — this is a type-level refactor. `ITokenUsage` (agent-core) is confirmed as the usage-triple SSOT: `ISessionUsageTotals` and `IBackgroundTaskUsage` become aliases, and every inline `{ promptTokens; completionTokens; totalTokens }` copy (service/orchestration/executor/remote-client shapes) now references the SSOT (structurally identical → patch). The subagent-job contracts derive from the background-task SSOT — `TSubagentJobStatus = Exclude<TBackgroundTaskStatus, 'paused'>`, mode alias, and a `Pick`-projection `ISubagentJobState` — with a compile-enforced parity test so a drifting hand copy can no longer exist. `@robota-sdk/agent-session` is minor because the public `ISessionRecord` type is now the typed `IInteractiveSessionRecord` alias (previously a relaxed `unknown[]` mirror): runtime behavior of `SessionStore` is identical, but downstream code that assigned loose payloads to the record's fields may need explicit casts at its own trust boundary (the framework store facade's `as unknown as` cast bridge is deleted). agent-session's duplicate `@robota-sdk/agent-core` deps/devDeps declaration is also removed (STRUCT-04).
446
+
447
+ ### Patch Changes
448
+
449
+ - 5307f8a: Discriminate `IBackgroundTaskResult` by kind, the same way `TBackgroundTaskRequest` already is:
450
+ `exitCode`/`signalCode` exist only on the `process` member and `usage` only on the `agent` member,
451
+ instead of being optional-and-unreachable on every kind. `IBackgroundTaskResult<K>` narrows to the
452
+ kind-specific member; called with no type argument it is still the full union, which is what
453
+ `IBackgroundTaskState.result` continues to hold (that field stays undiscriminated — a later change).
454
+ `ISubagentJobResult` is now derived as `Omit<IBackgroundTaskResult<'agent'>, 'kind'>` rather than a
455
+ hand-maintained `Omit<IBackgroundTaskResult, 'kind' | 'exitCode' | 'signalCode'>`.
456
+
457
+ `IBackgroundTaskHandle` gains the same kind parameter as `IBackgroundTaskStart`: a runner declared
458
+ for kind `K` resolves its handle's `result` to `IBackgroundTaskResult<K>`, so a caller that starts a
459
+ known-kind runner gets a correctly-narrowed result with no cast, and reading a cross-kind field on it
460
+ is a compile error. Consumers reading `state.result` through the generic (kind-erased) manager or
461
+ task-state path are unaffected in behavior, but a `.exitCode`/`.signalCode`/`.usage` read there must
462
+ now narrow on the result's own `kind` first, since the fallback default keeps `IBackgroundTaskResult`
463
+ as the full union rather than the previously flat, always-present shape.
464
+
465
+ `agent-session`'s session-record decoder now rejects a persisted result carrying a field outside its
466
+ own kind (e.g. an `'agent'` result with `exitCode`) as corrupt, reported at that field's own path —
467
+ the same corruption-reporting style the taskId/kind identity check already uses.
468
+
469
+ **Breaking for `@robota-sdk/agent-interface-execution` and `@robota-sdk/agent-executor`**: code that
470
+ read `exitCode`/`signalCode`/`usage` off an unnarrowed `IBackgroundTaskResult`, or that implemented
471
+ `IBackgroundTaskHandle`/a custom runner without specifying its kind parameter, needs to narrow on
472
+ `result.kind` (or specify the kind parameter) before those fields are visible again.
473
+
474
+ - b462ee7: Discriminate `IBackgroundTaskState` by kind, the same way `TBackgroundTaskRequest` and (as of the
475
+ prior change) `TBackgroundTaskResult` already are. Fields only one runner ever produces now live
476
+ only on that kind's member instead of being optional-and-cross-kind-reachable on every kind:
477
+
478
+ - `agent`-only: `agentType`, `isolation`, `resumeSessionId`, `promptPreview`, and the
479
+ worktree-isolation fields (`worktreePath`, `branchName`, `worktreeStatus`, `worktreeNextAction`,
480
+ `worktreeBaseRevision`, `parentWorktreeStatus`).
481
+ - `scheduled`-only: `schedule`, `nextFireAt`.
482
+ - Every kind except `agent`: `commandPreview` (a process command, an MCP tool-invocation summary, or
483
+ a schedule's shell command / wake instruction).
484
+ - `state.result` is now `IBackgroundTaskResult<K>` — correlated with `state.kind`, not the free
485
+ full-result union.
486
+
487
+ `pid`, `logPath`, and `transcriptPath` stay on the shared base rather than becoming agent- or
488
+ process-exclusive: the runner handle SPI already reports them for whichever runner's process
489
+ happens to produce them, and a subagent run via the worktree/child-process runner carries a `pid`
490
+ exactly as a `process`-kind task does. `timeoutReason` also stays base — session restore sets
491
+ `'stale_worker'` on any non-terminal, non-rearmable task regardless of kind, not only agent ones.
492
+
493
+ `IBackgroundTaskState<K>` narrows to the kind-specific member; called with no type argument it is
494
+ still the full union. The session-record decoder (`agent-session`) now rejects a persisted task
495
+ state carrying a field outside its own kind as corrupt, reported at that field's own path, the same
496
+ way it already rejects a `state.result` whose kind disagrees with `state.kind`.
497
+
498
+ **Breaking for `@robota-sdk/agent-interface-execution` and `@robota-sdk/agent-executor`**: code that
499
+ read a kind-specific field (e.g. `state.agentType`, `state.schedule`, `state.commandPreview`) off an
500
+ unnarrowed `IBackgroundTaskState` needs to narrow on `state.kind` first, since the fallback default
501
+ no longer carries every field on every kind. `agent-session`, `agent-framework`, and `agent-command`
502
+ land the corresponding narrowing at every read site the type change touched; no runtime behavior
503
+ changes there beyond the state decoder's new corruption checks.
504
+
505
+ - 30e5e50: Reject background runner results whose task ID or kind differs from the task being completed, and report the same mismatch as corruption when decoding a persisted session record.
506
+ - 4f3c075: Assemble complete, verified package generations before switching build output; preserve the previous generation on build failure and pack only verified regular-file images. Include copied CLI web assets in affected-build ordering and artifact transfer. Preserve the CLI version in managed build paths. Public runtime contracts remain compatible (patch).
507
+ - 6085cad: CORE-031: a compaction with nothing to summarise no longer replaces the conversation
508
+
509
+ `Session.compact()` guarded on the FULL conversation and then compacted a DIFFERENT array — the same
510
+ history with system messages filtered out. So a conversation consisting only of system messages
511
+ passed the guard, reached the orchestrator empty, took its `return ''` shortcut, and came back as a
512
+ "summary" the caller wrote over the conversation: cleared, and replaced with an empty
513
+ `[Context Summary]` block.
514
+
515
+ The guard now tests the messages that will actually be compacted. Nothing to summarise is a no-op,
516
+ not a failure — the conversation is left exactly as found, no hook fires, no `context_compact` event
517
+ is written, and the provider is not called.
518
+
519
+ `CompactionOrchestrator.compact()` correspondingly throws `CompactionError` on an empty `history`
520
+ rather than returning `''`, which contradicted the contract two lines above it in its own docblock
521
+ ("always a non-empty string") and was the value that made the overwrite possible. Whether there is
522
+ anything worth compacting is the caller's judgement, made before it commits to replacing anything.
523
+
524
+ Reachable from the public SDK surface: `Session.injectMessage` is what `--resume` and `--fork` drive
525
+ on every restore.
526
+
527
+ - 93d061d: CORE-043: structured output now knows which transport can carry the schema before the first call
528
+
529
+ `run(input, { output })` asked every provider for `responseFormat: { type: 'json_schema' }`. A
530
+ provider whose surface cannot express that accepted the option and dropped it — and the schema was
531
+ stated in words only by the RETRY feedback turn, which runs on attempt two. So against such a
532
+ provider, attempt one carried nothing describing the required shape and could only succeed by luck:
533
+ the advertised three attempts were really two, and the first was spent discovering something the
534
+ capability table already knew.
535
+
536
+ A `(provider, model)` pair now resolves to a mechanism (`response_schema` / `json_object` / `none`)
537
+ and a provenance (`catalog` / `vendor-default` / `undeclared` / `unverified-endpoint`), and the
538
+ request is shaped to match at the one seam that holds both the resolved provider and the outgoing
539
+ messages. When the wire cannot carry the shape, the schema is stated in the prompt on the FIRST
540
+ attempt. Each structured request emits a `structured_output_transport` event reporting what the
541
+ request actually did.
542
+
543
+ - `IAIProvider.endpointIsVendorDefault?()` — a provider configured with a custom `baseURL` reports
544
+ it, so the runtime stops claiming enforcement a gateway may not provide. Separate from
545
+ `capabilityTable?()` on purpose: `@robota-sdk/agent-provider-openai` declares no table (nobody has
546
+ verified one) and must still be able to answer.
547
+ - DeepSeek's capability table declared `json_schema`; DeepSeek guarantees the response PARSES but
548
+ takes no schema parameter. Corrected to `json_object`.
549
+ - A provider that declares nothing is still sent the request unchanged — silence is not a denial.
550
+
551
+ - bed26ea: Fix: an in-flight autonomous `goal` is no longer lost on session resume. `fromSessionRecord` was a hand-enumerated field whitelist that omitted `goal` (while the write path persisted it), so the goal silently vanished on load. The read path is now a structural mirror of the write path (`{ ...session }`), so every persisted field — including `goal` — round-trips, and a future field cannot be dropped by omission (ARL-08 / DATA-006). `ISessionRecord` gains an opaque `goal?: unknown` for contract honesty.
552
+ - 07b627f: A local peer can now be answered, and what its turn may do depends on where it runs.
553
+
554
+ - `agent-core`: the permission evaluator takes a peer turn's authority as one more input
555
+ (`IPermissionEvaluationContext.peerTurn`), decided after the deny list and ceiling and before
556
+ bypass and allow rules. A peer on another host uses no tool. A peer on the same host may use an
557
+ inspect-class tool that declares `workspacePaths`, only when every named location resolves inside
558
+ the workspace and is not a credential (`isSecretPath`); write and execute tools are refused unless
559
+ enabled, and then every use asks. A tool declaring `repliesToPeer` exists only in a peer turn and
560
+ asks once the turn used another tool. New: `isToolAvailableInPeerTurn`, `TPeerReach`,
561
+ `IPeerTurnAuthority`. `IRunOptions.withholdHostedTools` leaves a provider's hosted tools out of a
562
+ run's requests (`nativeWebTools` with `false` withholds a hosted tool for one call).
563
+ - `agent-tools`: `Read` and `Glob` declare the arguments that say where they look. `Grep` does not:
564
+ it reads files it was never named, so a peer turn does not get it.
565
+ - `agent-session`: `ISessionRunOptions.peerReach` makes a run a peer turn for the permission policy;
566
+ every ask in it needs a fresh approval, and its requests carry no provider-hosted tool. `ISessionOptions.allowPeerChanges` enables write and execute
567
+ tools for same-host peer turns.
568
+ - `agent-interface-session`: `ISubmitOptions.peer` (`IPeerTurnContext`) carries a peer turn's reach,
569
+ the message it answers and the session a reply goes to.
570
+ - `agent-interface-session-mobility`: `IPeerMessage.inReplyTo` threads a conversation;
571
+ `peerReachOf(admission)` maps admission to a reach.
572
+ - `agent-framework`: a peer turn is offered what its origin allows, and a new `peer_reply` tool
573
+ answers the peer that sent the message, threaded to it. The setting `peers.allowChanges` enables
574
+ write and execute tools for same-host peer turns.
575
+ - `agent-ui-terminal`: a permission prompt in a peer turn names the requesting peer.
576
+ - `agent-cli`: incoming peer turns carry their reach and reply route; a conversation is limited in
577
+ depth and in how often this session answers it, and a reply over a limit is not sent and the
578
+ operator is told.
579
+ - `agent-provider-anthropic`, `agent-provider-openai-compatible` (Qwen): a request whose
580
+ `nativeWebTools` sets a hosted tool to `false` is sent without it.
581
+
582
+ - d0de5b2: A peer session's message now reaches the model as a peer's, and a peer turn runs on the external
583
+ baseline.
584
+
585
+ - `agent-core` marks every user message whose driver id starts with `peer:` as
586
+ `<peer_message from="…">…</peer_message>` in the outgoing request — both the round and the forced
587
+ summary — while the stored history keeps the text as sent. Wrapper-shaped text in user and tool
588
+ messages is escaped, and an id that is not a plain identifier is printed as `peer:unverified`.
589
+ New exports: `peerDriverOf`, `printablePeerDriver`.
590
+ - `agent-session`'s conversation transcript (compaction, advisor) labels a peer message with the same
591
+ printable id, so no rendering echoes a sender-chosen id that is not a plain identifier.
592
+ - `agent-framework` runs a `peer` turn like an `external` one — no tools (`toolChoice: 'none'`), no
593
+ `@path` expansion, no context references — and adds a per-turn system statement that the message
594
+ came from another session and carries no authority. A `peer` turn must carry a `peer:` driver id.
595
+
596
+ - ebd40a0: Harden on-disk log permissions against CWE-377 (SEC-003, CodeQL `js/insecure-temporary-file`).
597
+
598
+ Session logs, externalized session payloads, and OpenAI request/response payload logs all carry
599
+ conversation and prompt content, but were created with the process umask (typically `0644`) inside a
600
+ caller-supplied directory that may be shared or world-writable. They are now created owner-only
601
+ (`0600`), and the directories that hold them are created `0700`.
602
+
603
+ This is a permissions change only — file locations, names, formats, and APIs are unchanged. Anything
604
+ that read these logs as a _different_ OS user will no longer be able to; the owning user is
605
+ unaffected.
606
+
607
+ - Updated dependencies [9c19c50]
608
+ - Updated dependencies [7b6234c]
609
+ - Updated dependencies [5307f8a]
610
+ - Updated dependencies [b462ee7]
611
+ - Updated dependencies [37b4bd7]
612
+ - Updated dependencies [4eea54b]
613
+ - Updated dependencies [1698be4]
614
+ - Updated dependencies [d4189b9]
615
+ - Updated dependencies [9edae52]
616
+ - Updated dependencies [4078a72]
617
+ - Updated dependencies [4c73a0b]
618
+ - Updated dependencies [196a900]
619
+ - Updated dependencies [f336838]
620
+ - Updated dependencies [34e50f0]
621
+ - Updated dependencies [722e88a]
622
+ - Updated dependencies [d23c848]
623
+ - Updated dependencies [fec722f]
624
+ - Updated dependencies [2d3b2c0]
625
+ - Updated dependencies [4772067]
626
+ - Updated dependencies [9fbab1b]
627
+ - Updated dependencies [a009f5b]
628
+ - Updated dependencies [4f3c075]
629
+ - Updated dependencies [475e085]
630
+ - Updated dependencies [e477440]
631
+ - Updated dependencies [9dcb5da]
632
+ - Updated dependencies [a95ca85]
633
+ - Updated dependencies [b6d14ce]
634
+ - Updated dependencies [0382a51]
635
+ - Updated dependencies [93d061d]
636
+ - Updated dependencies [39554a1]
637
+ - Updated dependencies [d28430a]
638
+ - Updated dependencies [fcb0da3]
639
+ - Updated dependencies [07b627f]
640
+ - Updated dependencies [d0de5b2]
641
+ - Updated dependencies [d6b9404]
642
+ - Updated dependencies [9814afc]
643
+ - @robota-sdk/agent-interface-execution@3.0.0-beta.80
644
+ - @robota-sdk/agent-core@3.0.0-beta.80
645
+ - @robota-sdk/agent-interface-session@3.0.0-beta.80
646
+ - @robota-sdk/agent-file-authority@3.0.0-beta.80
647
+
3
648
  ## 3.0.0-beta.79
4
649
 
5
650
  ### Patch Changes