refactor(pocket-pi)!: full unmodified pi is the sole default; remove trimmed path - #7
Merged
Conversation
…trimmed path Pocket Pi now IS the full, unmodified pi-coding-agent. The trimmed "agent loop + stubbed pi-ai + native streamFns" path — a pre-Path-B artifact from before the real pi ran on QuickJS — is gone. Every `PiRuntime::new()` embeds and loads the whole pi bundle (globalThis.PiFull) plus a host harness; there is one path. - **Embedded by default.** The gzip'd full bundle (~1.8 MB) is `include_bytes!`'d unconditionally (no more `embed-full-pi` feature; flate2 is a normal dep) and COMMITTED, so `cargo build` — including from cat's vendored submodule — works with only Rust, no Node. `new()` decompresses + evaluates it, then the harness. - **Host harness (js/src/pi-full/host.ts → PocketPi global).** Reimplements `PocketPi.boot/prompt` on `createAgentSession`: the boot config's `tools` become a pi extension whose `execute` calls back to native Rust via `host.tool`, and pi's session events map to the host's compact vocabulary (start/text/tool_start/ end/error) via `host.emit`. So the `register_tool` + `boot` + `prompt` + `on_event` API is unchanged — hosts (cat) keep working, now on real pi. - Removed: `agent.bundle.js` + `js/src/trimmed/**`, the trimmed bundle build step, `load_full_pi`/`load_plugin_ts`, the `plugin` example. `self_contained` example simplified (embedding is the default now). - Tests reworked: dropped the scripted/trimmed tests; the full-pi bundle tests no longer need `run_module` (embedded) and the offline ones are un-ignored; `new_embeds_and_loads_full_pi` covers the default. `live_openai_turn` now validates the harness end-to-end (boot/prompt → real gpt-5.6 turn → "pong"). 22 tests pass, clippy `-D warnings` clean. BREAKING CHANGE: the trimmed/scripted path and `load_full_pi`/`load_plugin_ts` are removed; `PiRuntime::new()` always loads the full pi. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…bundle) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Pocket Pi now is the full, unmodified pi-coding-agent. The trimmed "agent loop + stubbed pi-ai + native streamFns" path — a pre-Path-B artifact from before real pi ran on QuickJS — is gone. There is one path.
What changed
include_bytes!'d unconditionally (no moreembed-full-pifeature) and committed, socargo build— including from cat's vendored submodule — works with only Rust, no Node.PiRuntime::new()decompresses + evaluates it, then a host harness.js/src/pi-full/host.tsreimplementsPocketPi.boot/promptoncreateAgentSession: the boot config'stoolsbecome a pi extension whoseexecutecalls native Rust viahost.tool(that's how cat'slook_at_screenreaches the agent); pi's session events map to the host vocabulary (start/text/tool_start/end/error) viahost.emit. Soregister_tool+boot+prompt+on_eventare unchanged — cat keeps working, now on real pi.agent.bundle.js+js/src/trimmed/**, the trimmed build step,load_full_pi/load_plugin_ts, thepluginexample.Verification
-D warningsclean.live_openai_turnnow validates the harness end-to-end:boot/prompt→ real gpt-5.6 turn →"pong".Breaking
PiRuntime::new()always loads the full pi; the trimmed/scripted path andload_full_pi/load_plugin_tsare removed. cat migrates in its own repo (itsregister_tool/boot/prompt/on_eventusage is unchanged).🤖 Generated with Claude Code