feat(sdk): add optional computer field to hostConfig v2 (Project Computers PR1)#2548
Conversation
…mputers PR1)
Adds `computer?: null | { kind: "personal"; toolset: "bash"; workdir?: string }`
to the hostConfig v2 surface, following the progressiveToolDiscovery pattern:
absent (or null) omits the key entirely, so existing rows hash byte-identically
to pre-feature rows — confirmed by the untouched golden vectors in the
regenerated parity fixture.
- types: HostConfigComputer + input/canonical fields; public HostComputer,
HostJson.computer, HostInit.computer; exported from internal + public barrels
- canonicalize: null → undefined collapse, literal validation, unknown-key
rejection (hash hygiene), workdir trim with empty-after-trim → absent
- Host builder: property, constructor init, setComputer() sugar, round-trip
- eval wire: normalizeSdkEvalHostConfigForWire strips computer on both input
shapes — evals never carry a personal computer (mutable per-user state;
backend run-start rejection lands in PR2)
- tests: canonicalization absent/null/personal/workdir + validation, wire
stripping + hash independence, Host round-trips, new golden parity vector
Plan: mcpjam-backend docs/project-computers.md (MCPJam/mcpjam-backend#485).
https://claude.ai/code/session_01Jf7p3Q1YQN8sKzi3hTzcuh
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (6)
WalkthroughThis pull request introduces a personal cloud workstation configuration model to HostConfig v2. The change adds a Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Resolves the hostConfig v2 conflict with #2511 (builtInToolIds). Both 'computer' (this branch) and 'builtInToolIds' (main) are independent optional dimensions, so the resolution is a union: keep both fields in types.ts / canonicalize.ts, both golden rows in the fixture generator, and both describe blocks in the canonicalize test (the latter two auto-merged). Regenerated the parity fixture (17 vectors) and bumped EXPECTED_INPUT_HASH to the combined value. Added the .changeset entry for 'computer' that PR1 was missing (mirrors #2511's). https://claude.ai/code/session_01Jf7p3Q1YQN8sKzi3hTzcuh
Internal previewPreview URL: https://mcp-inspector-pr-2548.up.railway.app |
First implementation slice of Project Computers (plan: MCPJam/mcpjam-backend#485,
docs/project-computers.md). SDK only — no backend, server, or UI changes; those land as PR2–PR4 per the phased rollout.What
Adds one optional field to the hostConfig v2 surface:
following the
progressiveToolDiscoverypattern exactly: absent (ornull) writes no key, so every existing host config hashes byte-identically to before this change. The regenerated parity fixture proves it — all 14 pre-existing golden vectors kept their pinned canonical JSON and sha256; the only fixture changes are the newcomputerrow and the drift-guard__inputHash.Changes
types.ts—HostConfigComputer;computer?: HostConfigComputer | nullonHostConfigInputV2,computer?: HostConfigComputeronCanonicalHostConfigV2.canonicalize.ts—canonicalizeComputer(): collapsesnull→ undefined (an editor "clear" hashes identically to never-set), validates thekind/toolsetliterals, rejects unknown keys (typo defense + keeps stray keys out of the hashed canonical JSON), trimsworkdirwith empty-after-trim collapsing to absent.host.ts/public-types.ts— publicHostComputertype,computeronHostJson/HostInit/theHostbuilder, plussetComputer()sugar (defaults to the only MVP shape;nulldetaches). Round-trips throughtoJSON().sdk-evals-normalizer.ts—normalizeSdkEvalHostConfigForWirenow stripscomputeron both accepted input shapes (canonical input andHost.toJSON()snapshot). A personal computer is mutable per-user state, so an eval that shells into it isn't reproducible — evals never carry the field. The backend's belt-and-suspenders run-start rejection lands in PR2.HostConfigComputerexported fromhost-config/internal,HostComputerfrom the public entries.Tests
computerstripped from both input shapes; wire hash provably independent of the computer the host carried.Hostbuilder:setComputer()attach/detach and fulltoJSON()round-trip with workdir normalization.computer-personal-with-untrimmed-workdiradded via the fixture generator;EXPECTED_INPUT_HASHbumped.SDK suite: 84 files, 1377 passed. Workspace typechecks (
npm run typecheck,typecheck:client) clean.https://claude.ai/code/session_01Jf7p3Q1YQN8sKzi3hTzcuh
Generated by Claude Code
Note
Low Risk
SDK-only schema extension with backward-compatible hashing; eval wire explicitly drops the new field so ingestion behavior for existing evals stays unchanged until backend PR2.
Overview
Adds an optional
computerdimension to HostConfig v2 so a host can declare a personal cloud workstation (chatbashtool + web terminal):{ kind: "personal"; toolset: "bash"; workdir?: string }, withnull/absent normalized so existing configs keep the sameconfigHash.Canonicalization introduces
canonicalizeComputer()(literal validation, unknown-key rejection,workdirtrim) and wires it intocanonicalizeHostConfigV2. The publicHostsurface gainscomputer,setComputer(), andHostComputerexports onHostJson/HostInit.Eval wire:
normalizeSdkEvalHostConfigForWirenow stripscomputer(with runtime server ids) so eval transport hashes ignore per-user machine state.Coverage includes unit tests, a new parity golden row, and a minor
@mcpjam/sdkchangeset.Reviewed by Cursor Bugbot for commit 29d4f99. Bugbot is set up for automated code reviews on this repo. Configure here.