Skip to content

feat(plugin-protocol): add protocol foundations (stack 1/7)#73

Open
wanglongan587 wants to merge 10 commits into
ora-space:mainfrom
wanglongan587:pick-0717-01-protocol
Open

feat(plugin-protocol): add protocol foundations (stack 1/7)#73
wanglongan587 wants to merge 10 commits into
ora-space:mainfrom
wanglongan587:pick-0717-01-protocol

Conversation

@wanglongan587

@wanglongan587 wanglongan587 commented Jul 18, 2026

Copy link
Copy Markdown

Summary

  • Add ora-plugin-protocol foundations: identity/manifest, binary frame codec, agent DTOs, lifecycle handshake, strict JSON-RPC, method registry, validation + golden fixtures.
  • Includes a small unrelated .gitignore tweak from the branch root (1 line).

Stack

Test plan

  • cargo test -p ora-plugin-protocol
  • cargo fmt --all -- --check

Made with Cursor

wanglongan587 and others added 9 commits July 20, 2026 11:32
Establish validated plugin identifiers and strict manifest parsing.
Add the v1 Agent and Workbench package model for later wire contracts.

Co-authored-by: Cursor <cursoragent@cursor.com>
Define the bounded five-byte frame format and cover split, coalesced,
and malformed input behavior before adding JSON-RPC messages.

Co-authored-by: Cursor <cursoragent@cursor.com>
Introduce opaque IDs, page limits, and JSON-safe numeric leaf types so
lifecycle and Agent contract modules can share one validated value layer.
Add the closed Agent request/response/event shapes on top of leaf types so
lifecycle stream envelopes and method registry can reference one contract.
Add initialize/activate/deactivate/stream/exit DTOs and invariants so Host
and private bootstrap share one wire lifecycle contract.
Add request/response/error framing helpers on top of the binary frame codec
so Host and plugin runtimes share one JSON-RPC parse/reject matrix.
Register the closed Agent method set and invocation semantics so SDK and
runtime dispatch share one method catalog.
Close the protocol crate with cross-field Agent validators, TypeScript export
helpers, and checked-in Frame/Agent golden fixtures for drift detection.
@wanglongan587
wanglongan587 force-pushed the pick-0717-01-protocol branch from b2a922f to beffb5d Compare July 20, 2026 03:45
@EricWvi
EricWvi marked this pull request as ready for review July 20, 2026 06:06
Comment thread crates/plugin-protocol/src/json_rpc.rs Outdated

/// Parses the Request profile while retaining arbitrary ids for the required fatal diagnostic.
fn parse_request(object: &Map<String, Value>) -> Result<JsonRpcRequest, JsonRpcParseError> {
require_allowed_fields(object, &["jsonrpc", "id", "method", "params"])?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当前不兼容 envelope 字段会先被 require_allowed_fields 判定为 UnknownField,因此后面的 FrameEnvelopeMismatch 分支无法到达。虽然消息仍然会被拒绝,但这会导致错误分类与代码表达的设计不一致;如果后续 process/manager 对两类错误采用不同处置策略,mismatch 策略将永远不会触发。
请确认这两类错误是否需要区分:如果需要,建议调整检查顺序并更新测试;如果不需要,建议删除 FrameEnvelopeMismatch 和不可达检查,统一使用 UnknownField。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

检视意见合理:require_allowed_fields 会先把 result/error 等判成 UnknownField,导致 FrameEnvelopeMismatch 不可达。我将调整检查顺序并补测试。

FrameEnvelopeMismatch was unreachable because require_allowed_fields
rejected result/error/method/params first. Check shape incompatibilities
first so mismatch and unknown-field failures stay distinct.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

2 participants