feat: enable jsonSerializable on internal RPC functions#310
Merged
Conversation
Opt 38 framework-internal RPC functions into the strict JSON wire/dump contract introduced in #301. Switches their on-wire encoding from structured-clone-es to plain JSON.stringify, makes their static dumps plain JSON, and surfaces non-serializable return values via DF0020 at the call site instead of silently coercing them. Also satisfies the DF0019 prerequisite for the five self-inspect functions that already declare an `agent` field. Skipped (return arbitrary user-supplied values or contain function references): commands-execute, docks-on-launch, agent-invoke-tool, self-inspect/get-docks, self-inspect/get-devtools-plugins. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
commit: |
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.
Description
Opt 38 framework-internal RPC functions into the strict JSON wire/dump contract from #301 — switches their on-wire encoding from
structured-clone-esto plainJSON.stringify, makes their static dumps plain JSON, and surfaces non-serializable return values viaDF0020at the call site instead of silent coercion. Also satisfies theDF0019prerequisite for the fiveself-inspectfunctions that already declare anagentfield.Coverage: 12 in
packages/core(messages, terminals, commands-list, rpc-server-list, public open-helpers, anonymous auth), 14 inpackages/rolldown, 5 inpackages/self-inspect, 2 inpackages/vite, and 5 indevframe/(open-helpers ×2, agent-list-tools, agent-list-resources, agent-read-resource).Skipped (return arbitrary user-supplied values or contain function references):
commands-execute,docks-on-launch,agent-invoke-tool,self-inspect/get-docks,self-inspect/get-devtools-plugins— the last two still throwDF0019because they declareagentwithoutjsonSerializable; flagged for a separate refactor (projection / type narrowing).Linked Issues
Builds on #301.
Additional context
Verified via
pnpm install && pnpm build && pnpm typecheck && pnpm test(450/450) andpnpm lint.🤖 Generated with Claude Code