Commit graph

5 commits

Author SHA1 Message Date
Simon Klee
26cfacbbf9
fix(cli-rs): fix the API types carbon found wrong in F.2
carbon-1: a union member that is itself a union with several tags joins the
outer tag, so SessionLogItem routes log.synced to LogSynced and its tag()
delegates to the inner enum.
carbon-2: Schema.NonEmptyArray(T) is Vec<T>, so form fields and tool
content are typed (FormField, ToolContent).
carbon-3: Ref_1 twins that Rust decodes the same as Ref share its type
(FormInfo, ShellInfo, FormAnswer, the inbox payloads, message parts).
carbon-4: untagged unions get a generated Deserialize that skips a member
whose required literal field holds another value, so an LSP server entry
with disabled: false keeps its command.
carbon-5: generated errors implement TaggedError, and DeclaredError::decode
checks the tag.

Call sites in crates/store and crates/ui follow the renamed types.
2026-11-04 19:51:14 +01:00
Simon Klee
a15b60f360
fix(cli-rs): expect 204 from no-content endpoints
The generator read httpApiStatus only through resolveAt, so the 50 endpoints whose
no-content success keeps 204 on its context annotations expected 200, as
resolveHttpApiStatus in httpapi-codegen does not. Every such call (reload, session
remove, permission reply, model switch) failed against a real server with
UnexpectedStatus 204. Tests that answered those calls with 200 now answer 204.
2026-11-04 19:17:11 +01:00
Simon Klee
7baefa3f36
fix(cli-rs): keep JSON key order in generated records
Records decoded into BTreeMap, which sorts keys. The TUI prints tool inputs in wire order (primitiveInputSummary, the fallback JSON title), so records are now IndexMap; serde_json already preserves order.
2026-11-04 18:34:12 +01:00
Simon Klee
0f63e545d7
chore(cli-rs): format the API generator and type the oracle's fetch
Prettier over script/gen/api.ts and script/rust; the oracle's fake fetch no
longer casts to typeof fetch, so bun check passes. Output is unchanged.
2026-11-04 18:20:48 +01:00
Simon Klee
cc409d1fcf
feat(cli-rs): generate the Rust API client from ClientApi
script/gen/api.ts compiles ClientApi with the Promise client's options and emits
types and one method per endpoint (166) into crates/api/src/generated. The
request core, errors, query encoding, and the reqwest transport are written
by hand. Tagged unions decode through a generated Deserialize that keeps
unknown members and routes rpc.* events.
2026-11-04 18:20:48 +01:00