Skip to content

test: verify /acp works in pi-web (SDK embedded host) - #222

Open
ranxianglei wants to merge 1 commit into
masterfrom
2026-08-25_pi-web-acp-verification
Open

test: verify /acp works in pi-web (SDK embedded host)#222
ranxianglei wants to merge 1 commit into
masterfrom
2026-08-25_pi-web-acp-verification

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Context

Issue #17 asks to verify the extension works in pi-web, especially the /acp command. pi-web is an embedded host: it runs the pi SDK inside its own node process and drives the agent through AgentSession.prompt(), surfacing extension output via a UI context whose notify() reaches the web chat.

This PR adds the first pi-web integration test, which verifies /acp end-to-end against the real pi SDK (no real pi-web app required).

What the test does (tests/pi-web-acp.test.ts)

  1. Builds a DefaultResourceLoader with the extension factory, calls reload() (a caller-supplied loader is not auto-reloaded by createAgentSession — a non-obvious SDK behavior).
  2. createAgentSession({ resourceLoader, sessionManager }).
  3. session.bindExtensions({ uiContext, mode: "rpc" }) with a capturing notify.
  4. Drives /acp, /acp-status, /acp-search, /acp-subagents through session.prompt(...).
  5. Asserts the ACP status panel is delivered via ctx.ui.notify.

Findings

  • /acp works 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.
  • Extension commands are resolved before model/API-key validation in AgentSession.prompt(), so /acp runs even when no model is selected.
  • Caveat: output visibility in the actual pi-web UI depends on pi-web wiring uiContext.notify to its web chat (the extension side is correct).

Verification

  • npm run typecheck — clean
  • npm test — 432 pass (incl. 2 new pi-web tests)

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.
@github-actions

Copy link
Copy Markdown

📦 Built Extension Artifact

Branch: 2026-08-25_pi-web-acp-verification (d5b421a)

Option A — Install from npm PR tag (recommended)

pi install npm:billion-context-pi@pr-222

Each push to this PR publishes a new version under the pr-222 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pi-pr222.tgz
pi install ./package

This comment is automatically updated on each push.

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.

1 participant