Repository navigation
feat: expose native structured output controls - #349
Merged
Merged
Conversation
Merged
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]>
xxchan
added a commit
that referenced
this pull request
Oct 12, 2026
…y host-set limits and schema failures (#356) Closes #336. Closes #339. Both come from Lookout's comparison with the Claude Agent SDK (#342). **#336: `launchArgs` that collide with flags OAR manages are refused at open** (`UnsupportedOptionError` on `launchArgs`, before claude starts), with the option to use instead: - `--continue`/`-c` and `--session-id`: claude exited next to OAR's own `--session-id` (`failed: runtime exited`); - `--resume`/`-r`: use `SessionOptions.resume`; - `--fork-session`: the conversation forked but `Session.id` kept the old id, so resuming by it returned to the original; - `--permission-mode`: silently overridden by OAR's `--dangerously-skip-permissions`; - `--print`/`-p`, `--input-format`, `--output-format`: OAR drives claude over stream-json; - `--json-schema`: use `SessionOptions.outputSchema` (#349). Long flags are matched in their `--flag=value` form too. Everything else still passes unchecked. **#339: host-set limits and schemas get their own `FailureClass`:** - `limit_reached`: claude's result subtypes `error_max_turns` and `error_max_budget_usd`; - `output_schema`: claude's `error_max_structured_output_retries` and grok's `structuredOutputError` (both were `unknown`). `failureAdvice` says not to retry either until the host changes the limit or the schema; `failureText` words them. - A claude error result's `reason` is now its subtype followed by claude's own `errors` text (`error_max_turns: Reached maximum number of turns (2)`, `error_max_structured_output_retries: Failed to provide valid structured output after 5 attempts ...`), for every `error_*` result. It used to be the subtype alone. - Cost is not passed through in this PR: claude's `total_cost_usd` is computed at list price (`costBasis: "list"`), which is not what a subscriber pays. Reopen if a host needs it. **Behavior changes:** `FailureClass` gains `limit_reached` and `output_schema` (exhaustive switches need the cases); turns that were `unknown` in those situations now carry the new classes; claude error reasons are longer; `launchArgs` with those flags are refused instead of breaking the session. **Tests:** each refused flag and its `=` form, other flags passing (`tests/claude/claude-launch-args.test.ts`); the subtype mapping and the reason text (`tests/failure-mapping.test.ts`); the recorded claude and grok structured-output failures now `output_schema`. Lint, typecheck and the unit suite pass. 🤖 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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hosts can now request native structured output with
SessionOptions.outputSchema. Claude applies its process flag, Codex supplies the schema on every OARturn/start, and Grok carries it on every prompt, queue drain and steer. Claude and Grok native values are preserved on completedTurnOutcome.structuredOutput, including throughpromptAndWait, status, SessionView and JSON record replay. Other core runtimes explicitly refuse the option. Claude can complete without a structured value even with a schema; hosts must check field presence as well as the outcome kind.Codex returns text and delegates schema enforcement to the provider; OAR does not parse or validate it. Its queue cannot carry a schema and is refused when the option is set. Native goal continuations remain unschematized. Native validation failures retain their diagnostic evidence and remain failed turns. The runtime matrix, per-runtime pages, README and dated report document these boundaries; probes and scrubbed native fixtures are included.
Closes #337.
Validation: