Skip to content

Collapse the packages into @onkernel/loop - #85

Open
rgarcia wants to merge 2 commits into
mainfrom
hypeship/loop-package-collapse
Open

Collapse the packages into @onkernel/loop#85
rgarcia wants to merge 2 commits into
mainfrom
hypeship/loop-package-collapse

Conversation

@rgarcia

@rgarcia rgarcia commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Three packages become one. @onkernel/cua-ai, @onkernel/cua-agent, and @onkernel/cua-pi-extension merge into @onkernel/loop, arranged along the framework-neutral boundary rather than the old package boundary. No behavior changes: this is restructuring plus renaming.

packages/ptywright is untouched.

Tree

packages/
├── loop/                      @onkernel/loop
│   └── src/
│       ├── core/              "."     canonical actions, tool declarations, catalog
│       │                              compiler, tool menu, tool manager, browser
│       │                              handle, translator/CDP executor
│       ├── pi/                "./pi"  attach()/compile(), model resolution, transport
│       │                              derivation, provider adapters (OpenAI computer_use,
│       │                              Anthropic browser/computer, Google interactions),
│       │                              provider retry, headers, api-keys
│       └── pi-extension/              registered through the package's own
│                                      pi.extensions field
└── ptywright/                 @onkernel/ptywright (development-only)

Exports:

  • . → the neutral core
  • ./pi → the pi binding
  • "pi": { "extensions": ["./src/pi-extension/index.ts"] } — pi reads the extension's TypeScript directly through jiti, so files ships src alongside dist

The catalog compiler, tool menu, and tool manager live in core/ with type-level pi imports (Api, Model, Tool, AgentTool). Strict boundary enforcement — core importing nothing from pi — is a follow-up; this change adds no new runtime pi imports to core/.

Rename rules applied

  • Product names: Cua*Loop* (CuaToolCatalogLoopToolCatalog, CuaExecutionResourcesLoopExecutionResources, compileCuaToolCatalogcompileLoopToolCatalog, CUA_*LOOP_*).
  • Domain concepts get a plain name rather than the product name: CuaActionComputerUseAction, CuaBrowserActionBrowserAction, CuaComputerActionComputerAction, CuaNativeSurfaceComputerUseNativeSurface.
  • Tool identities: namespace cuakloop, .v1 suffix kept — cua.browser.snapshot.v1kloop.browser.snapshot.v1. Model-facing tool names (browser_snapshot, browser_act, …) are unchanged. Transcripts recorded against an older build no longer resume; the package is pre-release and no migration is provided.
  • Files named after the old product are renamed too (packages/ai/src/cua.tspackages/loop/src/core/tools.ts).
  • LOOP_E2E_LIVE replaces CUA_E2E_LIVE.

Other changes

  • The package root no longer re-exports @earendil-works/pi-ai. Consumers compose with pi libraries directly; internal files import Model, Context, and Api from pi. ./pi still re-exports @earendil-works/pi-agent-core, as @onkernel/cua-agent did — dropping that is a behavior change and belongs with the auth follow-up.
  • ~40 cross-package import sites become relative imports. Root workspaces, scripts, and tsconfig project references updated; npm run typecheck no longer needs a prebuild, because the package's tsconfig maps its own name at source.
  • CI drops the two per-package unit jobs for one; release-cua-ai.yml and release-cua-agent.yml become release-loop.yml (tag prefix loop/v). The first publish under the new name is manual — npm binds a trusted publisher to a (repository, workflow filename) pair and a new name has none — so the workflow shape is in place but trusted-publisher config is deferred.
  • docs/, README.md, the package README, and the repo skills are updated. The retired packages' unreleased changelog entries are folded into the merged changelog so nothing unshipped is lost.
  • packages/loop/scripts/native-action-probe.ts looks for its fixture under packages/loop/examples/; the old path no longer exists.

Decision: api-keys.ts stays in the exported surface

It stays, under ./pi (packages/loop/src/pi/api-keys.ts), and is still exported. It resolves credentials per provider for pi-resolved models, so it is pi-coupled rather than neutral. Six examples and the provider preflight consume it, and inheriting auth from pi is a deferred follow-up — removing the export now would break consumers twice for a surface that is about to change anyway.

Verification

From a clean rm -rf dist dist-tsc dist-published and npm ci:

$ npm run typecheck
> tsc -b
(no output)

$ npm test --workspace @onkernel/loop
 Test Files  32 passed (32)
      Tests  415 passed (415)

No suite regressed. The three old unit runs covered 32 files (11 ai with 1 integration excluded, 18 agent with 2 live excluded, 6 extension) and the merged run covers the same 32; it/test block counts match exactly at 365.

Also verified: npm ci against the regenerated lockfile, npm pack --dry-run ships dist/index.js, dist/pi/index.js, and src/pi-extension/*.ts, and the native action probe loads its fixture from both the repo root and the package directory (it now fails on provider auth, not a missing file).

ptywright's native Zig build was not run locally; CI builds and tests it.


Note

High Risk
Large breaking rename and package consolidation affects every import, publish tag, and CI path; mistaken export or tarball layout would break npm consumers and pi extension loading despite claimed behavior parity.

Overview
Merges @onkernel/cua-ai, @onkernel/cua-agent, and @onkernel/cua-pi-extension into a single @onkernel/loop package arranged by src/core (catalog + Kernel execution), src/pi (attach/models/providers), and src/pi-extension (pi session integration). Workspaces, lockfile, and root build/typecheck scripts now target only packages/loop plus dev-only ptywright.

Breaking consumer surface: imports move to @onkernel/loop and @onkernel/loop/pi; product renames (compileLoopToolCatalog, loop.toolsets, LoopExecutionResources, etc.) and domain renames (ComputerUseAction); stable tool identity namespace cua.*kloop.* (model-facing tool names unchanged). The package root no longer re-exports @earendil-works/pi-ai. Live e2e env is LOOP_E2E_LIVE; pi CLI docs use --browser-tools and pi install npm:@onkernel/loop.

Release & CI: per-package unit jobs and release-cua-ai.yml / release-cua-agent.yml are removed in favor of one loop unit job (build, test, pack, ESM smoke on . and ./pi) and release-loop.yml on tags loop/v*. Docs, agent skills, and npm release notes describe the single-package flow; retired package trees are deleted from the repo.

Reviewed by Cursor Bugbot for commit 986ea0f. Bugbot is set up for automated code reviews on this repo. Configure here.

Merge @onkernel/cua-ai, @onkernel/cua-agent, and @onkernel/cua-pi-extension
into one package. The tree follows the framework-neutral boundary rather than
the old package boundary: src/core is the neutral core exported as ".",
src/pi is the pi binding exported as "./pi", and src/pi-extension is
registered through the package's own pi.extensions field.

Rename Cua* to Loop*, or to a plain domain name where the concept is computer
use rather than this product, and move tool identities from cua.*.v1 to
kloop.*.v1. Model-facing tool names are unchanged. Drop the pi-ai re-export
from the package root, replace the two release workflows with one, and update
the docs and the release skill.
The native action probe still looked for its fixture under packages/ai, so a
real xai probe failed from the repo root, and the docs skill still described
the three-package layout.
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