description: "Shared subprocess and direct-agent harness for keyless example smoke tests, for test authors booting real Loader compositions."
English | 中文
Use dsh-loader-smoke to boot an application fixture from its real bin and cordis.yml in an isolated temporary directory, with captured output and cleanup. runFixtureTurn drives one task through the configured root agent and returns the final assistant text plus token usage. Tests can select zero-build source execution or built-package execution, so local and CI smoke tests use the intended consumer path for each environment. This support-tier library is for test authors, not product integrations.
This package boots an application fixture the way an installed consumer would and lets a test watch the result: choose source or built mode, launch the bin with its config from an isolated cwd, and either wait for a clean exit or drive one task through the root agent.
runLoaderSmoke takes bin and config paths, optional complete bin arguments, environment overrides, stdin, pre-run setup, and pre-cleanup inspection. It owns the isolated cwd, DSH homes, diagnostics, deadline, termination, EOF, and cleanup, and returns both streams after a zero exit or rejects with both streams on failure:
const result = await runLoaderSmoke({
label: 'acp-agent',
tempDirPrefix: 'acp-smoke-',
binScript: '/abs/path/to/src/bin.ts',
configPath: '/abs/path/to/cordis.yml',
tsconfigPath: '/abs/path/to/tsconfig.json',
})
Set expectedExitCode when the scenario pins a designed failure surface — a one-shot turn ending in an error result — and a run that exits any other way, including succeeding, still fails the smoke.
Profile integration drivers use the repository-only tests/fixtures/production-profile.ts helper. It loads the named shipped profile and its bundle patches through loadProfile, reconciles the profile's module fallback, and passes the bundle patches followed by the test's *.patch.yml files to the root cordis:include mounted by boot. Those patches should contain only the test provider or model, isolated persistence paths, and subject-specific changes. Package-level unit tests that need an agent loop without profile integration mount dsh-agent-loop-testkit locally instead.
runFixtureTurn(ctx, options) drives one task through exactly one configured root agent: it waits for the task to reach the durable inbox, forwards canonical events to your observer, flushes the session, and returns the final assistant text plus accumulated usage. Example-local drivers keep configuration, rendering, and assertion ownership.
resolveExampleLaunch picks the artifact an example bin boots from. src mode runs the bin under tsx with TSX_TSCONFIG_PATH set, so workspace imports resolve through the tsconfig paths map — the zero-build dev path. lib mode runs the built lib/ bin under plain Node, so bare package plugins resolve through real package exports, exactly as an installed consumer resolves them. The mode comes from an explicit value or DSH_EXAMPLE_MODE (CI sets lib, dev leaves it unset); anything else fails loud.
pnpm run build before selecting DSH_EXAMPLE_MODE=lib; the owning package manifest must also declare every package named by the config.maxBuffer — a runaway child is terminated at that ceiling rather than at a smoke-chosen budget.Read these pages when the package-level contract is not enough. They move from the harness to the composition it boots and the fixtures it serves.
runFixtureTurn drives.None, as the test harness submits only the consuming test's ordinary user task and delegates prompt and tool composition to the loaded tree.
None beyond the loaded tree; the helper neither changes the request prefix nor retains state across runs.
These limits define when the harness needs special care. They are current package constraints, not a task backlog.
maxBuffer — a runaway child is terminated at that ceiling rather than at a smoke-chosen budget.