Feature/plugin sp2#40
Open
Rhythmarvin wants to merge 15 commits into
Open
Conversation
Contributor
Author
EricWvi
force-pushed
the
feature/plugin-sp2
branch
from
July 14, 2026 08:49
66dc67f to
86f3093
Compare
- Remove protocol.ts in favor of local inline interfaces - getNums now returns generic JsonRpcRequest with jsonrpc/id/method/params - returnNums uses local success/error response types - Add root export '.' mapping to package.json - Bump version to 0.1.4
Replace local JsonRpcRequest/JsonRpcSuccessResponse with PluginJsonRpcRequest/PluginJsonRpcSuccessResponse from the generated types directory — keeping the protocol DTOs as the single source of truth.
- PluginId: publisher.name grammar, Windows device name rejection, 128-byte max - AgentProviderId: 1..=63 bytes, no dots/underscores/Unicode - AgentProviderKey: structured (PluginId, AgentProviderId) pair - PluginKindManifest: Agent/Workbench discriminated union - ManifestValidity, RuntimeCompatibility, RuntimeSupport, IntegrityStatus - PluginLimits: all budget values, with_dynamic_limits tightening - ts-rs wiring for TypeScript type generation - 49 unit tests
- FrameType enum (Request=1, Response=2, Notification=3) - Explicit i32::to_be_bytes/from_be_bytes encode/decode (no repr(C)) - HEADER_LEN=5, MAX_PAYLOAD_BYTES=8MiB constants - $/initialize params (17 fields) and result (5 field echo) - $/activate, $/deactivate, $/exit, $/cancelRequest DTOs - Golden Vector verification tests (4 valid + 4 invalid) - 21 unit tests
- Generic JsonRpcRequest/Response/Notification types - Duplicate key detection at any depth (max 64) - Batch array rejection, depth exceeding, version mismatch - Type/envelope mismatch matrix (Request/Response/Notification) - Error code constants (-32700 through -32800) - RpcValidationError with is_session_fatal classifier - build_error_response/build_fatal_diagnostic builders - 28 unit tests
- 16 leaf newtypes with transparent JSON encoding - AgentScope discriminated union (global/project/worktree) - 8 request DTOs and all response DTOs - AgentEvent 6-variant enum with 'kind' tag - AgentTurnResult, AgentFinishReason, AgentUsage, CancelDisposition - AgentBusinessFailureKind (10 author + ProviderFailure) - AGENT_METHODS static registry with idempotency/streaming/safety flags - agent-contract-golden.json fixture - 14 unit tests
- Delete old /host NDJSON API (getNums/returnNums) - Add ./agent export: defineAgentPlugin identity helper - Add ExtensionContext (8 fields), PluginLogger, SubscriptionStore - Add AgentProvider interface (8 methods: 6 Promise + 2 AsyncGenerator) - Add AgentBusinessError with WeakSet brand factory - Add console guard (console.* -> stderr redirect) - Add ./types export with full Agent Contract v1 DTO definitions - Update package.json exports map (./agent, ./types, no wildcard)
- Pack CLI: Bun build to staging directory, metafile capture, input/output validation - Validate CLI: filesystem audit (symlinks, node_modules, .node addons) - Allowlist check: only package.json, dist/index.js, README*/LICENSE* - Private runtime detection in bundle - Relocation test (copy to temp dir, verify self-contained) - SDK package export verification tests
- transport/frame.rs: runtime-aware encode/decode, FrameError with From impl - transport/reader.rs: incremental FrameReader (AwaitingHeader -> AwaitingPayload state machine) - transport/writer.rs: single-owner FrameWriter with tokio mpsc channel + oneshot ack - EOF semantics: finish() with partial-data detection - Golden vector tests, byte-by-byte, multiple frames, partial header/payload - Fuzz test: 12 malicious byte sequences (no panic, no overflow) - 15 unit tests
…handshake
- Private package ("private": true, not publishable)
- internal/reader.ts: incremental 5-byte FrameReader with ring buffer
- internal/writer.ts: FrameWriter with writeInt32BE/writeInt8
- rpc/transport.ts: createTransport() with start/send/onMessage
- lifecycle/handshake.ts: createInitializeWaiter, createActivateWaiter
- bootstrap/bootstrap.ts: full 10-step entry sequence ($/initialize -> $/activate -> Running)
- Deactivate handler: shutdownSignal + LIFO dispose
- Exit handler: drain + process.exit(0)
…l management - rpc/dispatcher.ts: method registration, -32601 fallback, async handler error mapping - rpc/client.ts: call()/notify() + pending Map + timeout + handleResponse - executor/ordinary.ts: bounded executor with -32010 ServerBusy, AsyncGenerator serialization - cancellation/transport.ts: per-invocation AbortController, $/cancelRequest handler - cancellation/business.ts: safety executor with capacity >= maxActiveTurns - cancelConversation handler: Accepted/AlreadyStopped, concurrent duplicate dedup - Private package export verification tests
- RuntimeState: 11-variant enum with associated data (Stopped through CrashLoop) - DrainTrigger, DrainProgress, StopReason, ProcessExit, SpawnToken - validate_transition() with 16 legal edges and generation guard - RuntimeActor: bounded mpsc mailbox, ActorCommand/ActorEvent types - Command handler: start/stop/reset_crash_loop with single-flight support - Event handler: generation guard, crash recording with sliding window - PluginRuntimeSupervisor: per-plugin actor registry, ActorHandle API - 18 unit tests
- PendingTable: request-id -> PendingEntry map with capacity enforcement - WriteState: Queued -> WriteStarted -> Written -> Cancelling - TerminationIntent: ExplicitCancel/HostStop/Backpressure/HardDeadline (first-wins) - FatalSettlementCause: ConnectionLost/ProcessExited (write-once) - build_initialize_request: full 17-field JSON-RPC builder - build_activate/deactivate/exit/cancel_request builders - InitializeLimits, parse_initialize_response, parse_activate_response - 15 unit tests
…e facade - StreamValidator: seq validation (starts at 1, strict increment, gap/duplicate rejection) - InvocationOutcome: 10 caller-facing result variants - settle_outcome(): full matrix (WriteState x idempotency x Intent x FatalCause) - RuntimeAssetStore: versioned asset deployment with leasing - AssetIdentity: locked Bun version, SHA-256 verification - AgentPluginRuntime trait: start/stop/invoke/reset_crash_loop - FakeRuntime for management-plane testing - 22 unit tests
- Cargo.lock: add hex crate (plugin-protocol Golden Vector tests) - pnpm-lock.yaml: reflect plugin-sdk exports update and plugin-runtime package
Rhythmarvin
force-pushed
the
feature/plugin-sp2
branch
from
July 17, 2026 03:22
75b5a84 to
cc408c6
Compare
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
引入插件系统基础设施:Rust 侧 plugin-manager 通过 stdin/stdout JSON-RPC 驱动 Bun 插件进程,协议类型由 ts-rs 自动生成到 @ora-space/plugin-sdk。
What Changed
Rust
Plugin SDK (@ora-space/plugin-sdk)
使用方式
import { getNums, returnNums } from "@ora-space/plugin-sdk/host";
import type { PluginJsonRpcRequest } from "@ora-space/plugin-sdk";