Skip to content

feat: support native additional workspace directories - #346

Merged
xxchan merged 2 commits into
mainfrom
feat/additional-directories
Oct 11, 2026
Merged

xxchan merged 2 commits into
mainfrom
feat/additional-directories

Conversation

@xxchan

@xxchan xxchan commented Oct 11, 2026

Copy link
Copy Markdown
Member

Hosts can now pass SessionOptions.additionalDirectories instead of constructing native flags. Paths resolve relative to cwd, which remains primary; omitted or empty lists add no override.

Claude, Codex and Cursor map new and resumed sessions to their native settings. Kimi supports new sessions but explicitly refuses a nonempty list on resume because the native path ignores it. OpenCode v2 requires its advertised ACP capability; v1, Grok, Antigravity, Pi and Pi Durable refuse the option. Codex checks the returned workspace roots and preserves the existing sandbox mode; an explicit list replaces its native root configuration.

Project rule/instruction loading is separate from workspace access. The native evidence report records Claude's opt-in for additional CLAUDE.md files and Cursor's verified workspace metadata alongside the rule-marker probes that did not succeed. Exhaustive switches on RefusableSessionOption need the new value.

Validation: full check (1,649 unit tests), build, all five behavior backends, five native vendor cases, and native Claude/Codex/Kimi/OpenCode probes passed. Cursor create/resume workspace metadata was verified using the authorized existing xxwork login; usage and evidence limits are in the report.

Closes #338.

@xxchan
xxchan merged commit 99c5cd3 into main Oct 11, 2026
17 checks passed
@xxchan
xxchan deleted the feat/additional-directories branch October 11, 2026 06:50
@xxchan xxchan mentioned this pull request Oct 11, 2026
xxchan added a commit that referenced this pull request Oct 11, 2026
Release OAR and CLI 0.55.0. This PR changes only the two package version
fields.

Both additions come from comparing OAR with the Claude Agent SDK and the
codex SDK (#342): in common host scenarios OAR should be no worse than a
runtime's own SDK, without depending on it.

**Added: `SessionOptions.additionalDirectories`** (#338, #346)
- Extra workspace directories beside `cwd`, resolved relative to `cwd`,
through each runtime's own setting: claude `--add-dir`, codex
`runtimeWorkspaceRoots` (with `cwd` first; OAR refuses the open when
codex's answer does not confirm them), cursor `local.dirs`, and the ACP
`additionalDirectories` session parameter where the runtime declares it
(kimi, OpenCode v2).
- kimi applies them only when creating a session: a non-empty list on
resume is refused, because kimi ignores it there. OpenCode v1, grok,
antigravity, pi and pi-durable refuse the option
(`UnsupportedOptionError`).
- Give the list again on resume. Without it, claude drops the earlier
directories and codex restores its saved ones.
- It neither changes the sandbox mode nor isolates anything. Whether
project rules or instruction files in the extra directories load is the
runtime's own behavior and not guaranteed (claude loads their CLAUDE.md
only with `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1`).

**Added: `SessionOptions.outputSchema` and
`TurnOutcome.structuredOutput`** (#337, #349)
- A JSON Schema for the session's final output, passed through
unchanged. OAR never validates the schema or the output.
- claude applies it at launch to every turn, including turns it starts
on its own, and a completed turn carries claude's validated value as
`structuredOutput`. A completed claude turn can still lack the field
when the model never supplies a value: check for the field, not only
`kind`. When the model keeps producing invalid output, the turn fails
(`error_max_structured_output_retries`).
- grok carries it on every prompt, queued input and steer, and returns
its validated value; a value or schema error (`structuredOutputError`)
is a failed turn.
- codex sends it on every turn OAR starts and returns text only: the
provider enforces the schema and the host parses the text. Steered input
keeps the current turn's schema. `queue` is refused while a schema is
set, because a queued input cannot carry it. Turns codex starts by
itself for an active goal carry no schema.
- Other runtimes refuse the option.

**Behavior changes**
- `RefusableSessionOption` gains `"additionalDirectories"` and
`"outputSchema"`; hosts with an exhaustive `switch` need the new cases.
- `TurnOutcome`'s completed variant gains the optional
`structuredOutput`.
- On codex, `queue` is rejected `unsupported` in a session opened with
`outputSchema`.

Validation: #346 and #349 each passed all 17 checks on their final
heads, and each merged tree equals its CI tree. Lookout verified both
with no account, against real claude 2.1.296, codex 0.162.1, kimi 2.1.1
and grok 1.0.50 with a mock provider: directories in requests and
readbacks for new and resumed sessions in all three codex sandbox modes,
the refusal paths, valid and invalid structured output on each runtime,
queue and steer, and replay equal to live. Otter's native evidence and
probes are in `experiments/additional-directories-2026-10-11.md` and
`experiments/structured-output-2026-10-11.md`. After this PR passes CI
and merges, tag its exact squash commit as `v0.55.0` to trigger npm
trusted publishing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: exe.dev user <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SessionOptions.additionalDirectories, refused where a runtime has none

2 participants