De-vendor pi-agent-core and slim cua-agent to a light wrapper - #17
Merged
Conversation
rgarcia
marked this pull request as ready for review
June 10, 2026 18:26
|
Firetiger deploy monitoring skipped This PR didn't match the auto-monitor filter configured on your GitHub connection:
Reason: PR affects To monitor this PR anyway, reply with |
8 tasks
…-core 0.79.1 De-vendor packages/agent: delete the ~6,750-line src/vendor snapshot and the vendoring script, depend on the published package (exact pin), and re-export its full surface from the package index with NodeExecutionEnv coming from the /node subpath. Pin @earendil-works/pi-ai to 0.79.1 in both packages/ai and packages/agent so the workspace resolves a single pi-ai instance and the registered yutori/tzafon providers keep working under the harness. Adapt to the released harness APIs: harness.agent never shipped upstream, so tests use getModel()/getTools()/getActiveTools(); steer/followUp/nextTurn/ setStreamOptions are async; model_select/thinking_level_select events are now model_update/thinking_level_update. Simplify the wrapper: - collapse CuaRuntimeController: drop the always-true tool-ownership branches, cache the resolved runtime spec instead of re-resolving it per provider request, hold one long-lived translator per spec, and share a single env auth default between CuaAgent and CuaAgentHarness - move the yutori screenshot payload append into cua-ai's payload middleware via a CuaPayloadContext.getScreenshot callback so wire-format knowledge stays in the provider layer - adopt pi's throw-on-failure tool contract in tools.ts and drop the dead translator types and the direct typebox dependency Packaging and release: emit .js relative specifiers in dist so the published ESM resolves under plain Node.js, run the full unit suite (minus live tests) in the release workflow, and add a post-pack ESM import smoke test against the packed cua-ai and cua-agent tarballs. Raise the node engines floor to 22.19.0 per pi 0.75.0. Release as @onkernel/cua-agent 0.3.0 on @onkernel/cua-ai 0.2.0. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Mirror the cua-ai packaging: dist/ is a single tsdown-bundled ESM file (deps external, including the pi-agent-core /node subpath re-export), source keeps extensionless imports, and tsc -b remains for typechecking only, emitting declarations to a gitignored dist-tsc/. The release workflow gains an explicit typecheck step since tsdown does not run the full type checker. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
rgarcia
force-pushed
the
hypeship/cua-agent-pi-devendor
branch
from
June 10, 2026 20:58
8981cd7 to
3c8846a
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
@earendil-works/pi-agent-core@0.79.1instead. pi deps are exact-pinned (pi-agent-core0.79.1,pi-ai0.79.1 in bothpackages/aiandpackages/agent) so the workspace resolves a single dedupedpi-aiand the provider registry stays unified. The full pi surface is still re-exported, now tracking npm;NodeExecutionEnvis re-exported from the/nodesubpath so existing imports keep working.CuaRuntimeController: removes the always-trueownsToolsbranches, caches the resolved runtime spec instead of re-resolving per provider request, holds one long-lived translator rebuilt on model change, and unifies the harness env-key default into a shared helper.cua-agentinto@onkernel/cua-ai's payload middleware:CuaPayloadContextgains optionalgetScreenshot, and the newyutoriCuaOnPayloadhook owns both native tool-set mapping and the screenshot append (with tests for idempotency and skip conditions).tools.tsadopts pi's throw-on-failure tool contract: failed browser actions throw (Actions failed: .../<action> failed: ...withcause) instead of triple-encoding errors into content, details, and a re-thrown object; dead translator types and the directtypeboxdep are removed.packages/agentdist/is now bundled with tsdown (single ESM file, deps external including the pi-agent-core/nodesubpath; source keeps extensionless imports,tsc -bstays for typechecking via a gitignoreddist-tsc/) so it resolves under plain Node; the release workflow now runs an explicittsc -btypecheck step (tsdown does not run the full checker), the full unit suite (excluding live tests), and packs both workspace tarballs for an ESM import smoke test before publishing.@onkernel/cua-agent0.3.0 with CHANGELOG notes for the breaking re-export drift (vendored snapshot replaced,harness.agentremoved, asyncsteer/followUp/nextTurn/setStreamOptions,model_select/thinking_level_selectevent renames, queue-mode accessors became methods, Result-basedExecutionEnv, Node >= 22.19.0).Rebased onto main after #18 merged (cua-ai 0.2.0, tsdown packaging, Node 22 CI). Publishing order still matters:
@onkernel/cua-ai@0.2.0must be on the registry before taggingcua-agent/v0.3.0— the workflow's dependency check and ESM smoke enforce this.Test plan
npm cifrom a clean tree resolves a single deduped@earendil-works/pi-ai@0.79.1npm run buildfor both@onkernel/cua-aiand@onkernel/cua-agentnpm test --workspace @onkernel/cua-agent -- --exclude "**/*.live.test.ts"(25/25)npm test --workspace @onkernel/cua-aipost-rebase (87 passed / 13 files, including the new yutori screenshot-middleware tests on top of the 0.2.0 API)CuaAgent,CuaAgentHarness,createCuaComputerTools,NodeExecutionEnv, and the wildcard pi re-exports import under plain Node ESMnpm run typecheck --workspace @onkernel/cua-agent(tsc -b project references) — green after the tsdown switchCUA_E2E_LIVE=1,packages/agent/test/e2e.live.test.ts) before publishing 0.3.0🤖 Generated with Claude Code
Note
High Risk
Major dependency swap and multiple documented harness/API breaks; publish order requires
@onkernel/cua-ai@0.2.0on npm first, and consumers must upgrade Node and await new harness APIs.Overview
@onkernel/cua-agent0.3.0 drops the vendored pi-agent-core tree (~6.7k lines) and depends on@earendil-works/pi-agent-core@0.79.1(with matchingpi-ai0.79.1). The package still re-exports the full pi surface plusNodeExecutionEnvfrom the/nodesubpath. Node is now>=22.19.0, builds use tsdown instead of plaintsc, and dist uses explicit.jsimports for plain Node ESM.Runtime behavior:
CuaRuntimeControlleris slimmer—one cached runtime spec, one translator rebuilt on model change, no vendored-onlyownsToolsbranches. Yutori screenshot injection moves to@onkernel/cua-aiviaCuaPayloadContext.getScreenshotandyutoriCuaOnPayload. Browser tools throw on failure (pi contract) instead of encoding errors in tool result content/details.Breaking for harness consumers: removed
harness.agent; asyncsteer/followUp/nextTurn/setStreamOptions; event renamesmodel_select→model_update,thinking_level_select→thinking_level_update; queue mode getters/setters → methods;ExecutionEnvis Result-based.Release CI adds typecheck, runs unit tests excluding
*.live.test.ts, packscua-ai+cua-agent, and runs an ESM import smoke test before publish. Docs/architecture now reference the published pi package instead of vendored core.Reviewed by Cursor Bugbot for commit 8981cd7. Bugbot is set up for automated code reviews on this repo. Configure here.