Skip to content

Split Ambion package into application, host, protocol, and Node entry points - #73

Open
andreisavu wants to merge 1 commit into
mainfrom
codex/audit-and-classify-exports-in-index.ts
Open

Split Ambion package into application, host, protocol, and Node entry points#73
andreisavu wants to merge 1 commit into
mainfrom
codex/audit-and-classify-exports-in-index.ts

Conversation

@andreisavu

Copy link
Copy Markdown
Contributor

Motivation

  • Reduce the default package surface to the small, application-facing vocabulary (the five primitives) and the minimal types required to use them.
  • Surface advanced host concerns (runtimes, transports, persistence), wire protocol shapes, and Node filesystem adapters at explicit subpaths to make integration contracts clear and avoid leaking implementation details.
  • Remove implementation classes and alias re-exports from the default entry point so hosts consume implementation-only APIs from explicit subpaths.

Description

  • Shrunk the default entry point (packages/ambion/src/index.ts) to export only the application primitives (defineAgent, defineHuman, defineTool, defineWorkspace, startSession) and the narrow set of types needed to call them and consume their results.
  • Added explicit entry modules packages/ambion/src/host.ts, packages/ambion/src/protocol.ts, and packages/ambion/src/node.ts, and wired package.json exports for ./host, ./protocol, and ./node so hosts and adapters import the correct surface.
  • Replaced the publicly exported SeatActor class with a host-facing factory createSeatActor(...) and removed direct re-exports of Pi internals from the application default export, keeping those in src/internal.ts for tests and internal usage.
  • Moved wire types/validators to the protocol entry point, runtime and storage adapters (including sqliteSessions) to the host entry point, and Node workspace adapters (memoryBackend, directoryBackend) to the node entry point.
  • Updated the Cloudflare adapter and tests to import from the new explicit entry points and adjusted many tests to import internal-only helpers from the internal module where appropriate.
  • Added a package API test (packages/ambion/test/package.test.ts) that asserts exact export lists for the default application entry point and the host, protocol, and node entry points to prevent API regressions.

Testing

  • Ran TypeScript checks for the package: pnpm --filter @ambionframework/ambion run check:types — succeeded.
  • Built the package: pnpm --filter @ambionframework/ambion run build — succeeded and emitted the new dist artifacts for the new entry points.
  • Ran the Ambion test suite: pnpm --filter @ambionframework/ambion test — executed for the ambion package (no failures observed in this run).
  • Attempted Cloudflare package typecheck: pnpm --filter @ambionframework/cloudflare run check:types — failed in this environment due to missing Cloudflare-specific type libraries and local package install; this is an environment/dependency issue rather than a change in the adapter code.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant