Skip to content

Internal npm Consumer App

Consume agentOS as packed npm packages instead of source workspace paths.

A tiny downstream TypeScript app that installs a packed @agent-os/kernel tarball plus the explicit effect peer, then typechecks and runs a smoke import.

  1. From the agentOS repo, build tarballs:

    Terminal window
    bun run pack:internal
  2. In a separate consumer app, install one packed package and its peer:

    Terminal window
    npm install /path/to/dist/internal-npm/tarballs/agent-os-kernel-0.2.9.tgz effect@^3.21.0
    npm install -D typescript
  3. Add a NodeNext tsconfig.json:

    {
    "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "strict": true,
    "skipLibCheck": true
    },
    "include": ["index.ts"]
    }
  4. Import only package entrypoints:

    import { Effect } from "effect";
    import { ABORT, reasonOf } from "@agent-os/kernel";
    import { makePreClaim } from "@agent-os/kernel/effect-claim";
    const claim = makePreClaim({
    operationRef: "operation:tutorial",
    scopeRef: { kind: "session", scopeId: "session:tutorial" },
    effectAuthorityRef: { authorityId: "tutorial.proof", authorityClass: "effect" },
    originRef: { originId: "internal-npm-consumer", originKind: "tutorial" },
    });
    await Effect.runPromise(
    Effect.succeed({ reason: reasonOf(ABORT.TOOL_ERROR), phase: claim.phase }),
    );
  5. Run:

    Terminal window
    npm exec tsc -- -p tsconfig.json
    node smoke.mjs

    A minimal smoke.mjs can import the packed package at runtime:

    const kernel = await import("@agent-os/kernel");
    if (kernel.reasonOf(kernel.ABORT.TOOL_ERROR) !== "tool_error") {
    throw new Error("agentOS packed consumer proof failed");
    }

The installed package manifest points at dist:

main: ./dist/index.js
types: ./dist/index.d.ts
exports ./effect-claim -> ./dist/effect-claim.js
peerDependencies.effect: ^3.21.0

The consumer typecheck and smoke import pass without workspace:, file:, packages/*, or @agent-os/*/src imports.

Add read-only operations with ops view.