Lines 225-265javascript
226 * Install `agentdb` + `better-sqlite3` as LOCAL project deps so the session-hook writer can
227 * `import('agentdb')` and get a native SQLite store (better-sqlite3 ships prebuilt binaries — no
228 * build tools — and gives true cross-process WAL concurrency so the hook and the MCP server share
229 * one live store). Best-effort: returns false (caller degrades to jsonl) if install fails.
231function installAgentdbLocally(projectRoot) {
232 if (isAgentdbInstalledLocally(projectRoot))
235 // Anchor npm to THIS project: without a package.json here, npm's prefix walk-up would
236 // install into (and mutate the lockfile of) the nearest ANCESTOR project (audit code#2).
237 const pkgJsonPath = join(projectRoot, 'package.json');
238 if (!existsSync(pkgJsonPath)) {
239 writeFileSync(pkgJsonPath, JSON.stringify({ name: 'dz-harness-project', private: true, version: '0.0.0' }, null, 2) + '\n');
241 // NB: use the ESM-imported execSync — `require()` is undefined in this ESM module (the
242 // original agentdb hooks failed silently for exactly this reason). stdio:'ignore' (not
243 // 'pipe') avoids execSync's 1 MB maxBuffer aborting the child on npm's verbose output.
244 // --save-exact: agentdb is alpha; a semver range would let a later `npm update` drift the
245 // local copy away from the version the MCP registration pins (audit gap G7).
246 execSync('npm install agentdb better-sqlite3 --save-exact --no-audit --no-fund --loglevel=error', {
247 cwd: projectRoot,
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
dist/setup.jsView on unpkg · L245 251 return isAgentdbInstalledLocally(projectRoot);
257/** Run full environment setup. */
258/** Marker that brackets the dz-harness section in a shared CLAUDE.md/AGENTS.md. */
259const DRIVER_MARKER_START = '<!-- dz-harness-driver:start -->';
260const DRIVER_MARKER_END = '<!-- dz-harness-driver:end -->';
262 * Operating instructions for a coding agent that should *drive* the dz CLI
263 * correctly. Inspired by Visa VVAH `--install-agents`: the toolkit ships its own
264 * "how to operate me" doc so agents use the CLI as intended rather than guessing.