Add a Go generator under sdk/typescript/gen that walks the Go types
exposed over the HTTP API and SSE stream, builds a JSON Schema for them
and emits TypeScript declarations into sdk/typescript/src/generated.
Output is committed; task check-ts fails when it drifts from the Go
source.
Runtime events now live in a single registry (pkg/runtime.EventTypes),
used by both the remote client and the generator, with a test that
every *Event struct is registered.
Comments and doc comments that drifted from the code after refactors, limited to the serve api request path (sessions, run, steer, resume, elicitation, permissions) and the core runtime it drives: the agent loop, streaming, hooks and tool dispatch, compaction, forked skills, and model overrides.
With track_usage on, the Chat Completions adapter held stop/length back
until the usage chunk but never stored it, so a provider length came out
as stop and, with no usage chunk, the reason was dropped. Store the held
reason, re-emit it on the usage chunk, and emit it before io.EOF when no
usage chunk arrives.
Refs #4624
The endpoint checks behind preserve_reasoning, explicit prompt-cache
breakpoints and consecutive-message merging read only base_url, so a
client pointed at a local server through OPENAI_BASE_URL was treated as
api.openai.com. Use the endpoint NewClient resolved when base_url is unset.
Fixes#4594
Signed-off-by: Yeongbin Jeong <oyobbeb@gmail.com>
A property schema with no "type" got "type": "object" injected, first by
SchemaToMap for every provider and again by the OpenAI strict-mode
normalizer. For an enum or const node that makes the schema reject every
allowed value: pydantic emits {"enum": ["auto", 0, 1]} for
Literal["auto", 0, 1], and after conversion no value of "mode" validates,
while the tool is still sent with strict: true.
Derive the type from the enum/const values instead; other typeless nodes
still default to "object". When the OpenAI normalizer makes an optional
enum/const property required, wrap it in anyOf with null, since a "null"
type next to enum/const still rejects null. Required properties keep
"null" in their type when the enum/const lists it.
Signed-off-by: jaeminbird <jaeminbird@gmail.com>
The harness runs Claude Code in print mode, where AskUserQuestion and
the plan mode tools are disabled: Claude Code asked its questions in
plain text and ended the turn.
For each turn, the Claude Code driver now serves a permission_prompt
tool from an MCP server on loopback and hands it to the CLI as its
permission prompt tool. Claude Code then offers AskUserQuestion and plan
mode, and consults the tool before AskUserQuestion and ExitPlanMode
only. The driver turns them into elicitation forms and answers with the
user's choices, or with a denial when the form is declined or
dismissed.
The server requires a bearer token kept in a 0600 MCP config file, sets
a 24 hour tool timeout (Claude Code otherwise abandons an HTTP tool
call after 60 seconds), and ends open questions with the turn. Through
the new optional harness.Eliciter capability, the runtime passes an
elicitation handler only when someone can answer: serve mcp, A2A and
background agents keep plain text questions.
Signed-off-by: Sayt-0 <louis.dal-moro-compta@epita.fr>
Remove the implicit 500-byte tool-result cutoff so relevance judges can assess the same evidence recorded for the agent. Cover boundary lengths, tail and middle evidence, UTF-8, and large outputs.
Closes#4770
Assisted-By: docker-agent
Signed-off-by: melmennaoui <mohamed.elmennaoui@docker.com>
The elicitation dialog rendered neither multi-select enums (an array
field whose items carry an enum or anyOf choices) nor titled choices
(oneOf with const and title), two shapes of the MCP elicitation spec
that the ACP bridge already accepts. Such fields fell back to a plain
text input.
Multi-select fields now render as checkboxes: up and down move between
the options, Space or a click toggles one, default values start
checked, and minItems and maxItems are validated. The submitted value
is the list of checked values, in option order. Titled choices show
their title with their description below, and submit their const.
Signed-off-by: Sayt-0 <louis.dal-moro-compta@epita.fr>
Anthropic documents the model_context_window_exceeded stop reason as
"treat the response as truncated", and returns it without a beta header
on Sonnet 4.5 and newer. Both adapters fell through to the default: the
Anthropic adapter reported stop, or tool_calls when a tool_use block had
started (so a cut-off tool call looked complete), and Bedrock reported
stop. Map it to length, like max_tokens.
Signed-off-by: jaeminbird <jaeminbird@gmail.com>
transfer_task (and handoff, run_skill, the background-agent and session tools) are
declared with a host-owned RuntimeHandler and no in-process Handler. Code Mode still
wrapped them into run_tools_with_javascript, so a script call failed in invokeTool with
`tool "transfer_task" is not available in code mode` while the direct tool was gone:
with code_mode_tools: true, an agent with sub_agents could not delegate at all (#4713).
Treat a non-empty RuntimeHandler like the existing exclusions: the tool is returned next
to run_tools_with_javascript and the runtime dispatches it through its handler, exactly
as without Code Mode. Tools with an in-process Handler keep being wrapped.
The regression test pins that the runtime-handled tool stays direct, is not declared in
the script functions, and keeps its RuntimeHandler.
Register Lunaroute at https://gw.lunaroute.com/v1 with LUNAROUTE_API_KEY
and glm-5.3 as its default model. Support credential-based provider
selection, direct authenticated model discovery, and the existing OpenAI-compatible request path.
Document provider setup and limitations, add an example configuration,
and cover credential handling, model discovery, and provider requests
with tests.
Closes#4749
makeAllRequired made optional properties nullable by rewriting
"type": "array" to ["array", "null"]. OpenAI's Responses API with
strict: true rejects that form with an opaque "Invalid schema for
function" error when the property lives in an object reached through a
$defs entry that itself contains a $ref or an anyOf of $refs (for
example the Notion MCP server's query-sessions tool).
Express nullable array and object properties, both newly nullable and
already declared as a type pair, as {"anyOf": [<schema>, {"type":
"null"}]}, the form already used for $ref properties. Scalars keep the
["T", "null"] form. fixSchemaArrayItems now also looks inside the anyOf
variants so arrays without items keep getting a default.
Signed-off-by: Simon Ferquel's Clanker <simonferquel-clanker@users.noreply.github.com>
CreateToolSet built the child environment as the toolset's vars followed by os.Environ(), and
exec.Cmd keeps the last value for a duplicate key, so every key the host also exported won: a
toolset's `env: {GITHUB_TOKEN: org-scoped}` silently ran with the host's personal token, and
PATH/HOME/HTTPS_PROXY pins were no-ops. shell, script and background-jobs toolsets document and
implement the opposite precedence ("configured toolset env still wins on key collisions",
pkg/tools/builtin/shell/shell.go), and a test pins it for script toolsets. LSP had the same
order.
Prepend the host environment instead, and pin the order with a unit test in the mcp package.
Adds orcarouter as a first-class built-in alias provider, mirroring the
existing openrouter entry:
- aliases.go: register orcarouter with base_url https://api.orcarouter.ai/v1
and ORCAROUTER_API_KEY
- config/auto.go: register orcarouter in cloudProviders (auto-selection) and
DefaultModels (orcarouter/auto adaptive router)
- openai client: treat orcarouter as an open-model host so consecutive
system messages are merged before sending
- docs: new providers/orcarouter page, plus rows in the provider overview,
and configuration/models provider list
- agent-schema.json: document the new alias in the provider description
- tests: cover the alias config, auto-selection, default model, and max
tokens for orcarouter
Rebased onto current main, retaining canonical provider IDs and adding
navigation, a runnable example, and hermetic provider wire regressions.
Gate the OrcaRouter live-API test behind explicit opt-in so configured
credentials alone never trigger paid inference during normal tests.
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: JinhaoSong322 <jinhao.song@myflashcloud.com>
Signed-off-by: Arnaud Héritier <aheritier@users.noreply.github.com>