feat(protocol): add runtime/capabilities - #242
Merged
Merged
Conversation
initialize() already reports capabilities, but every flag in it is a protocol feature — threadResume, workspaceDiff, reviewActions. No client can ask the question that actually matters before trusting a runtime: where will this write, and what will it stop to ask me about? Adds `runtime/capabilities`, kept separate from initialize on purpose. That one answers "which methods work"; this one answers "what authority does this runtime hold over my machine". The split is also the rule for where the next field goes. Both the CLI and the app-server build the payload through one function in core, and a test asserts they agree field-for-field on the same settings — sandbox posture, write scope, contract status, rule counts, ledger path. The alignment plan's P0 is that permissions and tool execution are not a unified runtime capability; this makes that claim executable instead of aspirational. VS Code and the LSP are thin protocol clients, so they get the server's answer verbatim. Two deliberate choices in the payload: - writeScope reports ["<everything: sandbox disabled>"] under danger-full-access, not []. An empty array reads as "writes nowhere", the exact opposite of the truth and the worst thing this could get wrong. - Permission rules are reported as counts, not contents. The rules can hold user paths; a count answers "is anything configured" without handing them out. `deepcode doctor` now prints the same declaration, so it cannot describe a posture the runtime does not have. Adding the capability flag broke three client fixtures at compile time, which is the signal working as intended. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
9 tasks
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.
Summary
PR 5 of
docs/FLOATBOAT_ADOPTION_PLAN.md§2.C. Additive protocol method — no existing call changes shape.initialize()already reports capabilities, but every flag in it is a protocol feature (threadResume,workspaceDiff,reviewActions). No client can ask the question that actually matters before it starts trusting a runtime: where will this write, and what will it stop to ask me about?The distinction is load-bearing
initializeruntime/capabilitiesKeeping them apart is also the rule for where the next field goes: describes the server's implementation →
initialize; describes the authority → here.docs/design/app-server-v1.mdstates that rule so it survives me.This makes the alignment plan's P0 executable
CODEX_ALIGNMENT_PLAN.mdlists "permissions and tool execution are not a unified runtime capability" as P0 — different hosts resolve the same settings differently.The CLI (
RuntimeHost.capabilities) and the app-server (capabilitiesFor) both build the payload through one function in core, andapps/server/src/capabilities.test.tsasserts they agree field-for-field on the same settings: sandbox posture, write scope, contract status, rule counts, ledger path. If they ever drift, it fails there rather than in someone's workspace.VS Code and the LSP are thin protocol clients over the app-server (
apps/vscode/src/extension.ts:1,apps/lsp/src/handler.ts:1), so they receive the server's answer verbatim and are equal by construction. Stating that rather than claiming four independently-verified hosts — only two resolve policy on their own.Two deliberate choices in the payload
writeScopereports["<everything: sandbox disabled>"]underdanger-full-access, not[]. An empty array reads as "writes nowhere" — the exact opposite of the truth, and the most dangerous thing this declaration could get wrong.Permission rules are reported as counts, not contents. The rules can hold user paths; a count answers "is anything configured" without handing them to every client that asks. There's a test asserting a rule name never appears in the serialized payload.
Also
deepcode doctorprints the same declaration from the same builder, so it cannot describe a posture the runtime does not have — including the file-contract warnings from #239.Adding the capability flag broke three client fixtures at compile time (desktop, LSP, VS Code). That's the signal working as intended; all three updated.
Test plan
pnpm test— 1360 passed, 16 skipped (+23: 914 core, 47 server, 31 protocol)pnpm typecheck·pnpm lint·pnpm format:check·pnpm build·node scripts/check-docs.mjsabsent/loaded/invalidall surface; modules map to enabled/disabledDocumentation
docs/design/app-server-v1.md— method added to the table, plus a section on theinitializedistinction, the payload shape, and the two choices aboveRelease notes label
release-notes:featureRelated
Plan §2.C (PR 5). Research:
docs/research/floatboat.md§4.4(3). AddressesCODEX_ALIGNMENT_PLAN.mdP0 "权限与工具执行不是运行时统一能力".🤖 Generated with Claude Code