Files
openprose__prose/vitest.config.ts
Jose Montes de Oca 9248d949e7 chore: ship skill examples as copyable scaffolding (#123)
The open-prose skill ships as a plain folder, so everything under
skills/open-prose/examples/ reaches every install. Each runtime example
shipped a committed replay/ state-dir (around 480 binary world-model files), a
generator, and a test suite wired to the workspace through a dist alias with no
local package.json. That machinery is internal validation, not the template a
user lifts: it cannot run from a copied folder, and it shipped generated
artifacts nobody should copy.

Keep the shipped examples to what a user actually adapts, and move the
validation into the repo's test tree:

- Move each example's tests, generator, and committed replay/ into
  tests/open-prose/examples/<name>/. The shipped example is now its .prose
  contracts under src/, a README, and a .gitignore.
- Re-point the vitest include and the test scripts; the byte-deterministic
  offline coverage runs unchanged, just rooted under tests/.
- Rewrite the example READMEs to point at the reactor CLI for producing and
  replaying a run, and drop the stale committed-fixture sections.
- Update the examples-gate workflow description to match the new layout.

No language, CLI, or runtime behavior changes, and the example contracts are
untouched. Verified with the offline gate (REACTOR_OFFLINE=1): the conformance
suite, the relocated example tests, and the eval harness all pass.
2026-06-05 19:44:15 -04:00

62 lines
2.4 KiB
TypeScript

import { fileURLToPath } from "node:url";
import { defineConfig } from "vitest/config";
// Root vitest config for the OpenProse skill conformance corpus and the
// example ledger-replay tests.
//
// 1. The conformance tests under `tests/open-prose/**` (contract-markdown,
// compiler/IR, concepts, forme, tenets, primitives, state,
// responsibility-runtime, skill-meta, examples) assert that
// `skills/open-prose/**` embodies the Intelligent-React end-state. They are
// repo-root tests with no owning package.
//
// 2. The deterministic ledger-replay tests under
// `tests/open-prose/examples/**/*.test.ts` drive the REAL `@openprose/reactor`
// reconciler over a committed `replay/` state-dir at zero model spend. They
// have no local `node_modules`, so the public `@openprose/reactor` subpaths
// are aliased to the prebuilt workspace dist (the SAME bytes a consumer
// imports). The packages must be built first (`pnpm build`).
//
// The optional `*.live.test.ts` bodies are key-gated and are EXCLUDED from this
// offline gate entirely (they passing-skip offline, but excluding them keeps the
// gate hermetic and avoids loading the live agent-render adapter).
const reactorDist = (sub: string) =>
fileURLToPath(new URL(`./packages/reactor/dist/${sub}`, import.meta.url));
export default defineConfig({
resolve: {
// Order matters: more-specific subpaths must precede the bare barrel.
// The 0.3.0 ideal surface is six subpaths: `.`, /agents, /adapters, /run,
// /run/types, /internals.
alias: [
{
find: "@openprose/reactor/agents",
replacement: reactorDist("agents/index.js"),
},
{
find: "@openprose/reactor/adapters",
replacement: reactorDist("adapters/index.js"),
},
{
find: "@openprose/reactor/run/types",
replacement: reactorDist("run/types.js"),
},
{
find: "@openprose/reactor/run",
replacement: reactorDist("run/index.js"),
},
{
find: "@openprose/reactor/internals",
replacement: reactorDist("internals/index.js"),
},
{ find: "@openprose/reactor", replacement: reactorDist("index.js") },
],
},
test: {
environment: "node",
include: ["tests/open-prose/**/*.test.ts"],
// Tier-3 live tests are key-gated and never run in the offline gate.
exclude: ["**/*.live.test.ts", "**/node_modules/**"],
},
});