Skip to content

feat: enable jsonSerializable on internal RPC functions#310

Merged
antfu merged 1 commit intomainfrom
antfu/rpc-json-serial
May 7, 2026
Merged

feat: enable jsonSerializable on internal RPC functions#310
antfu merged 1 commit intomainfrom
antfu/rpc-json-serial

Conversation

@antfu
Copy link
Copy Markdown
Member

@antfu antfu commented May 7, 2026

Description

Opt 38 framework-internal RPC functions into the strict JSON wire/dump contract from #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 silent coercion. Also satisfies the DF0019 prerequisite for the five self-inspect functions that already declare an agent field.

Coverage: 12 in packages/core (messages, terminals, commands-list, rpc-server-list, public open-helpers, anonymous auth), 14 in packages/rolldown, 5 in packages/self-inspect, 2 in packages/vite, and 5 in devframe/ (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 throw DF0019 because they declare agent without jsonSerializable; 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) and pnpm lint.

🤖 Generated with Claude Code

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>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 7, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@vitejs/devtools@310
npm i https://pkg.pr.new/@vitejs/devtools-kit@310
npm i https://pkg.pr.new/@vitejs/devtools-rolldown@310
npm i https://pkg.pr.new/@vitejs/devtools-self-inspect@310

commit: 28bd543

@antfu antfu merged commit 64d109d into main May 7, 2026
9 checks passed
@antfu antfu deleted the antfu/rpc-json-serial branch May 7, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant