Repository navigation
refactor(protocol): unify contracts and coordinate peer compatibility - #389
Open
NianJiuZst wants to merge 7 commits into
Open
NianJiuZst wants to merge 7 commits into
NianJiuZst wants to merge 7 commits into
Conversation
…licies Refs Tencent#388. Derive extension contracts and validators from the Rust catalog, enforce exhaustive handler and execution policies, and preserve evaluation settlement across caller deadlines.
NianJiuZst
marked this pull request as ready for review
October 21, 2026 17:26
Centralize version requirements, check the live daemon and target extension before dispatch, and expose component-specific availability and recovery guidance. Merge current main while retaining cooperation and download cleanup behavior.
This branch has not been deployed
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.
Closes #388 when the agreed implementation is merged. This updates the existing RFC implementation; architecture and rollout remain maintainer decisions.
Problem and resulting behavior
Protocol changes currently require editing Rust payloads, TypeScript mirrors, schema exports, dispatch registrations and policy lists separately. Independently updated CLI, daemon and browser-extension installations can also accept a connection while lacking a requested feature.
This PR makes Rust the source for shared contracts and versioned feature requirements. Generated types and validators keep source definitions aligned. Runtime preflight checks reject unsupported optional features before dispatch and identify the component to update, while omitted options retain their existing behavior.
Implementation
A single Rust method catalog declares wire names, owners, effects, parameter/result types and explicit feature lists. Typed extension handlers, extension policies and daemon scheduling policies must cover their method sets.
scripts/protocol.mjsgenerates 45 extension methods, 222 contract definitions and 116 standalone schemas.protocol:checkdetects missing, changed or unexpected generated files without modifying source files.Schemars exports input and output contracts separately. Generated immutable normalizers accept legacy nulls for optional typed fields while preserving arbitrary JSON/dictionary nulls. Ajv standalone validators run in MV3 without a runtime schema compiler.
Envelope/parameter validation runs before handlers. Invalid results report
protocol_errorwitheffect_state: "unknown"; they do not imply safe retry. Failed session-start result validation cleans up the allocated session.bsk-protocol/src/compatibility.rscentralizes the existing feature requirements:Older extensions already implement request-help; their responses remain authoritative. The 1.3 daemon requirement prevents its legacy environment override from disabling that path.
The CLI probes the daemon over the same IPC connection used for the action. The daemon checks the actual target extension connection before registering/sending the request. Cancellation during preflight drops the probe without dispatching the action.
unsupported_featureerrors include the feature, component, required/actual protocol,effect_state: "none"and actionable recovery. Updating bsk/restarting its daemon is distinguished from updating the affected browser profile. A store update can remain pending while other supported features are used.bsk status --jsonpreserves existing top-level fields and adds per-daemon/per-browsercompatibilityinformation. The daemon's status wire payload is unchanged.bsk doctorreports limitations and reminds the agent to reload updated Skill instructions. Popup guidance consumes generated requirements too.Integrated main
b63f551209caba4d7debfc12215b2b7c118bad49, including cooperation, guarded browser mutations and download completion signals. The existing cooperation cleanup test now waits for its response rather than a fixed number of microtasks. An existing updater-test lint was fixed by consuming its byte buffers instead of cloning them.See version compatibility and protocol ownership.
Validation — 2026-10-23
macOS ARM64; Rust 1.94.1, Node 26.10.0, pnpm 10.17.0; Chrome for Testing 153.0.8010.12.
Out-of-tree process checks cover daemon protocols 1.0–1.4, unsupported major/invalid versions, same-connection preflight, cancellation during the probe, old/new target profiles, omitted-option behavior, and availability after reconnection. Unsupported features produce no corresponding outgoing action frame.
Released CLI 0.2.1/0.3.3 binaries and extension 0.2.1/0.3.3 ZIPs were downloaded from GitHub Releases and verified against published SHA-256 digests. Browser runs used private daemon homes and owned Chrome profiles. Unpacked extension copies changed only the localhost WebSocket endpoint for isolation.
The current full-stack run also rejected action recording during active video; the video still finalized with nonzero bytes.
No new test scripts, fixtures, screenshots or logs are committed. The browser-gated skips, Windows behavior and hosted CI are not counted as local passes. Hosted checks are tracked separately on the pushed head.
Compatibility boundaries
cooperation_sync_required; the old CLI must be updated forcooperate sync, and that workflow needs a daemon that understands it. The mixed-version browser runs verified this rejection rather than counting it as a successful click.tool.cooperateparameters are generated; its existing arbitrary-JSON result remains unconstrained until a shared result type is defined.