docs(sdk): add Pi connect sub-plan - #153
Open
ross-rl wants to merge 1 commit into
Open
Conversation
Adds `poss_plan_pi_sdk.md`, the grounded PR-by-PR plan for adding a native Pi connection (`@runloop/remote-agents-sdk/pi`) speaking the broker's `pi_json` protocol. Covers the broker contract as the SDK sees it (input classification, outbound event types, turn settlement at `agent_settled`, resume), a shared-primitive analysis, file-by-file scope for `sdk/src/pi/`, five sequenced PRs with acceptance criteria and real verification commands, and thirteen open questions each with a recommendation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
✅ Reflex agent status: Completed The agent completed its work. This PR was created by Reflex. This comment updates in place as the agent works. |
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.
What
Adds
poss_plan_pi_sdk.md— the grounded, PR-by-PR plan for adding a native Pi connection (@runloop/remote-agents-sdk/pi) to this SDK, speaking the broker'spi_jsonprotocol (protoAXON_ATTACH_PROTOCOL_PI = 6).Docs only. No code changes.
The plan contains:
turn/start/cancel/initialize/ Control passthrough), the twelve outboundevent_types, turn settlement atagent_settled(notagent_end, which can be followed by an auto-retry), the reservedbroker-id prefix, and broker-owned resume viasessionFile+switch_session.sdk/src/shared/is reused as-is, the one 8-line relaxation worth making, and what should explicitly not be abstracted yet.sdk/src/pi/(protocol/index.ts,types.ts,classify-pi-axon-event.ts,timeline-event-guards.ts,transport.ts,connection.ts), mirroringsdk/src/codex/.AGENTS.md.Headline decisions, for review:
AxonFrameTransport,runConnectionReadLoop,PendingRequestMap,createClassifier,resolveReplayTargetet al. are genuinely protocol-neutral and need no changes for Pi. The only lift worth doing is making the four replay-request callbacks onAxonFrameTransportOptionsoptional (Pi has no server-initiated requests, so it would otherwise pass four stubs) — ~8 lines, riding inside the connection PR rather than getting its own.BaseAxonConnection. The apparently-duplicatedconnect()/disconnect()residue across claude/codex/pi is not the same lines: Claude buffers control-request replay and requiresinitialize(), Codex sniffsthreadId/currentTurnId, Pi capturessessionFileand has no handshake. Abstracting needs ~6 template hooks to save mechanical field declarations. Revisit at agent deps: Bump @vitejs/plugin-react from 4.7.0 to 6.0.1 in /examples/claude-app #4.@earendil-works/*dependency, no codegen. Pi does exportRpcCommand/AgentEvent, but the type graph reaches@earendil-works/pi-aiand its five provider SDKs (openai,@anthropic-ai/sdk,@google/genai,@aws-sdk/client-bedrock-runtime,@mistralai/mistralai), andRpcResponse's members reference internal source paths that aren't addressable through any published subpath. Pi ships no JSON Schema, so codegen isn't an option either — same reason the broker hand-wrotepi-codes. Verified thatpi-agent-core'sAgentEventunion is field-for-field identical topi-codes/src/events.rs, so structural parity with the crate is a reviewable property.initialize()on the Pi connection. Pi has no handshake, and the broker'sInitializeinput just re-issuesget_statewith noid— so its ack can't be correlated and aninitialize()couldn't return the state it exists to fetch.getState(), publishing our own id-stampedget_stateas a Control frame, is strictly more capable. Pi is the first module to break the "connect()theninitialize()" pattern documented insdk/AGENTS.md, so the absence gets called out there.sdk/vitest.config.tsglobs onlysrc/**/*.test.ts, all of which are unit tests over__test-utils__/mock-axon.ts;grep -ri vbrowserreturns nothing; CI has no Runloop credentials andsmoke-tests.ymlonly dispatches torunloopai/remote-agents-sdk-smoke-testson release-please branches. Codex therefore has no e2e template to copy (and notably notimeline-event-guards.test.tseither, which claude and acp both have — so claude, not codex, is the test-layout parity target). The plan makes PR 5 a reproducible operator runbook plusfeature-examplescoverage, with vbrowser as the instrument for capturing evidence, rather than smuggling in new CI infrastructure under a test label.Why
The PI workstream needs Pi driveable from Reflex through the Runloop broker, on open-source models served from Runloop's dedicated Nebius endpoint (glm-5.2). This SDK is the client half. Planning it up front, against the actual broker diffs rather than against guesses, keeps the implementation PRs small and independently reviewable — and surfaces the decisions worth arguing about (types source, abstraction boundary, e2e shape) before any code is written.
Companion broker-side work in
runloopai/runloop: #10238 (merged — thepi-codescrate), #10243 (the Pi adapter), #10256 (protocol plumbing + thepi_jsonOpenAPI name).PR title format
docs(sdk): add Pi connect sub-plan— typedocs, scopesdk.Checklist
<type>(<scope>): <description>formatbun run checkpassesbun run buildpassesbun run testpasses — no new failures. Note:src/shared/pending-request-map.test.tsfails identically onmainin my sandbox (7 fake-timerafterEachhook timeouts), so it is pre-existing and unrelated to this docs-only change.sdk/AGENTS.mdandsdk/README.mdupdates are scoped into PR 3 of the plan.