test: verify /acp works in pi-web (SDK embedded host) - #222
Open
ranxianglei wants to merge 1 commit into
Open
Conversation
Simulates a pi-web host via the real pi SDK (createAgentSession + DefaultResourceLoader with the extension factory + bindExtensions with a capturing uiContext). Drives /acp, /acp-status, /acp-search, /acp-subagents through AgentSession.prompt() and asserts the status panel is delivered via ctx.ui.notify. Guards against regressions in the pi-web/SDK path.
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-222Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr222.tgz
pi install ./packageThis comment is automatically updated on each push. |
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.
Context
Issue #17 asks to verify the extension works in pi-web, especially the
/acpcommand. pi-web is an embedded host: it runs the pi SDK inside its own node process and drives the agent throughAgentSession.prompt(), surfacing extension output via a UI context whosenotify()reaches the web chat.This PR adds the first pi-web integration test, which verifies
/acpend-to-end against the real pi SDK (no real pi-web app required).What the test does (
tests/pi-web-acp.test.ts)DefaultResourceLoaderwith the extension factory, callsreload()(a caller-supplied loader is not auto-reloaded bycreateAgentSession— a non-obvious SDK behavior).createAgentSession({ resourceLoader, sessionManager }).session.bindExtensions({ uiContext, mode: "rpc" })with a capturingnotify./acp,/acp-status,/acp-search,/acp-subagentsthroughsession.prompt(...).ctx.ui.notify.Findings
/acpworks in pi-web. The handler uses only host-agnostic APIs (ctx.ui.notify,ctx.getContextUsage?.(),ctx.getSystemPrompt?.(),ctx.model) — all optional-chained, no CLI-only assumptions.AgentSession.prompt(), so/acpruns even when no model is selected.uiContext.notifyto its web chat (the extension side is correct).Verification
npm run typecheck— cleannpm test— 432 pass (incl. 2 new pi-web tests)