@primitive.ai/prim 0.1.0-alpha.106 → 0.1.0-alpha.107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4963,7 +4963,7 @@ var require_rc = __commonJS({
4963
4963
  "node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports, module) {
4964
4964
  "use strict";
4965
4965
  var cc = require_utils();
4966
- var join35 = __require("path").join;
4966
+ var join36 = __require("path").join;
4967
4967
  var deepExtend = require_deep_extend();
4968
4968
  var etc = "/etc";
4969
4969
  var win = process.platform === "win32";
@@ -4988,15 +4988,15 @@ var require_rc = __commonJS({
4988
4988
  }
4989
4989
  if (!win)
4990
4990
  [
4991
- join35(etc, name, "config"),
4992
- join35(etc, name + "rc")
4991
+ join36(etc, name, "config"),
4992
+ join36(etc, name + "rc")
4993
4993
  ].forEach(addConfigFile);
4994
4994
  if (home)
4995
4995
  [
4996
- join35(home, ".config", name, "config"),
4997
- join35(home, ".config", name),
4998
- join35(home, "." + name, "config"),
4999
- join35(home, "." + name + "rc")
4996
+ join36(home, ".config", name, "config"),
4997
+ join36(home, ".config", name),
4998
+ join36(home, "." + name, "config"),
4999
+ join36(home, "." + name + "rc")
5000
5000
  ].forEach(addConfigFile);
5001
5001
  addConfigFile(cc.find("." + name + "rc"));
5002
5002
  if (env4.config) addConfigFile(env4.config);
@@ -38542,14 +38542,24 @@ function registerCodexCommands(program3) {
38542
38542
  });
38543
38543
  codex.command("status").description("Report whether each prim surface (gate, capture) is installed per scope").action(() => {
38544
38544
  const result = performStatus2();
38545
+ const readiness = {
38546
+ configured: result.user.complete || result.project.complete,
38547
+ runtime: inspectHookRuntime(),
38548
+ trust: "unknown",
38549
+ hookExecution: "not-verified",
38550
+ passiveCapture: "not-verified"
38551
+ };
38545
38552
  const mark = (b) => b ? "\u2713" : "\u2717";
38546
- const line = (label2, s) => `[prim] ${label2}: gate ${mark(s.gate)} \xB7 capture ${mark(s.capture)} (${s.path})`;
38553
+ const line = (label2, s) => `[prim] ${label2}: ${!s.present ? "not installed (optional when another scope is complete)" : `configured gate ${mark(s.gate)} \xB7 capture ${mark(s.capture)}`} (${s.path})`;
38547
38554
  console.error(`${line("user", result.user)}
38548
38555
  ${line("project", result.project)}`);
38549
38556
  const uncovered = uncoveredWorktreeHooks(result);
38550
38557
  if (uncovered !== null)
38551
38558
  console.error(`[prim] warning: ${uncoveredWorktreeAdvice(uncovered)}`);
38552
- console.log(JSON.stringify(result, null, JSON_INDENT2));
38559
+ console.error(
38560
+ "[prim] Configuration is not proof of hook execution or capture. Use the pending tour\u2019s diagnosticAction to check isolation."
38561
+ );
38562
+ console.log(JSON.stringify({ ...result, readiness }, null, JSON_INDENT2));
38553
38563
  });
38554
38564
  }
38555
38565
 
@@ -43974,60 +43984,9 @@ function validate3(value) {
43974
43984
  return value;
43975
43985
  }
43976
43986
 
43977
- // src/demo/sandbox.ts
43978
- import {
43979
- existsSync as existsSync14,
43980
- lstatSync as lstatSync9,
43981
- mkdtempSync as mkdtempSync3,
43982
- readFileSync as readFileSync17,
43983
- readdirSync as readdirSync6,
43984
- realpathSync as realpathSync5,
43985
- rmdirSync,
43986
- unlinkSync as unlinkSync5
43987
- } from "fs";
43988
- import { tmpdir } from "os";
43989
- import { basename as basename4, dirname as dirname11, join as join22 } from "path";
43990
-
43991
- // src/demo/scenario.ts
43992
- var SAMPLE_NOTE = [
43993
- "Fictional engineering conversation:",
43994
- "Maya: Could we call fetch directly for the order service?",
43995
- "Ravi: Use the shared HTTP client for service calls. We need retries and request tracing to stay consistent.",
43996
- "Maya: Agreed. Let's reject direct fetch calls because they duplicate that policy.",
43997
- "Ravi: Also, the team demo is at three."
43998
- ].join("\n");
43999
- var SAMPLE_DECISIONS = [
44000
- {
44001
- id: "demo-http-client",
44002
- decision: "Use the shared HTTP client for service calls",
44003
- stage: "provisional",
44004
- source: "Fictional engineering conversation",
44005
- evidence: [
44006
- "Use the shared HTTP client for service calls. We need retries and request tracing to stay consistent.",
44007
- "Let's reject direct fetch calls because they duplicate that policy."
44008
- ],
44009
- rationale: "Centralize retries and request tracing.",
44010
- files: ["service.ts"],
44011
- scopeBasis: "Demo mapping from service calls to service.ts; the conversation names no file.",
44012
- alternativesRejected: ["Direct fetch calls with duplicated retry and tracing policy"]
44013
- },
44014
- {
44015
- id: "demo-order-repository",
44016
- decision: "Persist orders through the shared order repository",
44017
- stage: "adopted",
44018
- source: "User confirmation of this fictional proposal",
44019
- rationale: "Keep validation and persistence consistent across order writers.",
44020
- files: ["orders.ts"],
44021
- alternativesRejected: ["Direct local-storage writes that bypass repository validation"]
44022
- }
44023
- ];
44024
- var SAMPLE_FILES = {
44025
- "service.ts": 'import { http } from "./shared";\nexport const loadOrders = () => http.get("/orders");\n',
44026
- "orders.ts": "export const saveOrder = (_order: unknown) => {\n // TODO: persist this order.\n};\n",
44027
- "shared.ts": "// Fictional interfaces; this tour does not execute network or storage operations.\nexport declare const http: { get(path: string): Promise<unknown> };\nexport declare const orders: { save(order: unknown): void };\n"
44028
- };
44029
- var WARNING_EDIT = 'export const loadOrders = () => fetch("/orders");\n';
44030
- var REPOSITORY_EDIT = 'import { orders } from "./shared";\nexport const saveOrder = (order: unknown) => orders.save(order);\n';
43987
+ // src/demo/diagnostics.ts
43988
+ import { existsSync as existsSync14 } from "fs";
43989
+ import { join as join22 } from "path";
44031
43990
 
44032
43991
  // src/demo/state.ts
44033
43992
  import { createHash as createHash9, randomUUID as randomUUID3 } from "crypto";
@@ -44074,11 +44033,15 @@ function prepareRun(agent, terminal = false) {
44074
44033
  stage: "prepared",
44075
44034
  terminal,
44076
44035
  agent,
44036
+ preparationKey: preparationKey(agent),
44077
44037
  launcher: [process.execPath, resolve8(process.argv[1])]
44078
44038
  };
44079
44039
  saveRun(run);
44080
44040
  return run;
44081
44041
  }
44042
+ function preparationKey(agent) {
44043
+ return agent === "codex" && process.env.CODEX_THREAD_ID ? sessionKey(agent, `${process.env.CODEX_THREAD_ID}\0${process.cwd()}`) : void 0;
44044
+ }
44082
44045
  var quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
44083
44046
  function demoCommand(run, action, choice, reason) {
44084
44047
  return [
@@ -44101,11 +44064,10 @@ function demoWelcomeCommand(run) {
44101
44064
  ].map(quote).join(" ");
44102
44065
  }
44103
44066
  function demoDiagnosticCommand(run) {
44104
- return [
44105
- process.execPath,
44106
- resolve8(process.argv[1]),
44107
- ...run.agent ? [run.agent === "claude_code" ? "claude" : run.agent, "status"] : ["doctor"]
44108
- ].map(quote).join(" ");
44067
+ return [process.execPath, resolve8(process.argv[1]), "demo", "status", run.id].map(quote).join(" ");
44068
+ }
44069
+ function demoResumeCommand(run) {
44070
+ return [process.execPath, resolve8(process.argv[1]), "demo", "resume", run.id].map(quote).join(" ");
44109
44071
  }
44110
44072
  function onboardingFinished() {
44111
44073
  const path9 = join21(demoDirectory(), "onboarding.json");
@@ -44124,12 +44086,112 @@ function pendingRuns() {
44124
44086
  if (!existsSync13(path9)) return [];
44125
44087
  return readdirSync5(path9).filter((name) => name.endsWith(".json") && RUN_ID.test(name.slice(0, -5))).map((name) => name.slice(0, -5)).filter((id) => !["completed", "skipped"].includes(readRun(id).stage));
44126
44088
  }
44089
+ function sessionKey(agent, session) {
44090
+ return createHash9("sha256").update(`${agent}\0${session}`).digest("hex");
44091
+ }
44127
44092
  function exclusionPath(key) {
44128
44093
  if (!/^[0-9a-f]{64}$/u.test(key)) throw new Error("invalid demo session identity");
44129
44094
  return join21(demoDirectory(), "excluded-sessions", `${key}.json`);
44130
44095
  }
44131
44096
  var lockRunAsync = (id, action) => withFileLock(`${runPath(id)}.lock`, () => action(readRun(id)), { timeoutMs: 500 });
44132
44097
 
44098
+ // src/demo/diagnostics.ts
44099
+ var observationPath = (id) => join22(demoDirectory(), "observations", `${id}.json`);
44100
+ function isolationDiagnostics(run) {
44101
+ let observation;
44102
+ let observationError;
44103
+ try {
44104
+ if (existsSync14(observationPath(run.id))) {
44105
+ const value = readDemoJson(observationPath(run.id));
44106
+ if (!value || !Number.isFinite(value.at) || !["claude_code", "codex", "cursor", "hermes"].includes(value.agent ?? "") || ![
44107
+ "acknowledged",
44108
+ "tool-mismatch",
44109
+ "command-mismatch",
44110
+ "session-mismatch",
44111
+ "session-missing",
44112
+ "write-failed"
44113
+ ].includes(value.result ?? "") || value.runtimeVersion !== void 0 && !/^[a-zA-Z0-9.+-]{1,80}$/u.test(value.runtimeVersion) || value.session !== void 0 && !/^[a-f0-9]{64}$/u.test(value.session) || value.errorCode !== void 0 && !/^[A-Z0-9_]{1,32}$/u.test(value.errorCode))
44114
+ throw new Error("invalid demo observation");
44115
+ observation = value;
44116
+ }
44117
+ } catch {
44118
+ observationError = "unreadable";
44119
+ }
44120
+ const expected = run.agent === "codex" && process.env.CODEX_THREAD_ID ? sessionKey(run.agent, process.env.CODEX_THREAD_ID) : void 0;
44121
+ return {
44122
+ runtime: inspectHookRuntime(),
44123
+ expectedEvent: "PreToolUse",
44124
+ expectedTool: run.agent === "cursor" ? "Shell" : run.agent === "hermes" ? "terminal" : "Bash",
44125
+ hookObservation: observation ? {
44126
+ at: observation.at,
44127
+ agent: observation.agent,
44128
+ runtimeVersion: observation.runtimeVersion ?? "unknown",
44129
+ result: observation.result,
44130
+ ageMs: Math.max(0, Date.now() - observation.at),
44131
+ sessionMatches: expected ? observation.session === expected : "unknown",
44132
+ ...observation.errorCode ? { errorCode: observation.errorCode } : {}
44133
+ } : null,
44134
+ ...observationError ? { observationError } : {},
44135
+ trust: "unknown",
44136
+ capture: run.binding ? "excluded-for-bound-session" : "not-verified"
44137
+ };
44138
+ }
44139
+
44140
+ // src/demo/sandbox.ts
44141
+ import {
44142
+ existsSync as existsSync15,
44143
+ lstatSync as lstatSync9,
44144
+ mkdtempSync as mkdtempSync3,
44145
+ readFileSync as readFileSync17,
44146
+ readdirSync as readdirSync6,
44147
+ realpathSync as realpathSync5,
44148
+ rmdirSync,
44149
+ unlinkSync as unlinkSync5
44150
+ } from "fs";
44151
+ import { tmpdir } from "os";
44152
+ import { basename as basename4, dirname as dirname11, join as join23 } from "path";
44153
+
44154
+ // src/demo/scenario.ts
44155
+ var SAMPLE_NOTE = [
44156
+ "Fictional engineering conversation:",
44157
+ "Maya: Could we call fetch directly for the order service?",
44158
+ "Ravi: Use the shared HTTP client for service calls. We need retries and request tracing to stay consistent.",
44159
+ "Maya: Agreed. Let's reject direct fetch calls because they duplicate that policy.",
44160
+ "Ravi: Also, the team demo is at three."
44161
+ ].join("\n");
44162
+ var SAMPLE_DECISIONS = [
44163
+ {
44164
+ id: "demo-http-client",
44165
+ decision: "Use the shared HTTP client for service calls",
44166
+ stage: "provisional",
44167
+ source: "Fictional engineering conversation",
44168
+ evidence: [
44169
+ "Use the shared HTTP client for service calls. We need retries and request tracing to stay consistent.",
44170
+ "Let's reject direct fetch calls because they duplicate that policy."
44171
+ ],
44172
+ rationale: "Centralize retries and request tracing.",
44173
+ files: ["service.ts"],
44174
+ scopeBasis: "Demo mapping from service calls to service.ts; the conversation names no file.",
44175
+ alternativesRejected: ["Direct fetch calls with duplicated retry and tracing policy"]
44176
+ },
44177
+ {
44178
+ id: "demo-order-repository",
44179
+ decision: "Persist orders through the shared order repository",
44180
+ stage: "adopted",
44181
+ source: "User confirmation of this fictional proposal",
44182
+ rationale: "Keep validation and persistence consistent across order writers.",
44183
+ files: ["orders.ts"],
44184
+ alternativesRejected: ["Direct local-storage writes that bypass repository validation"]
44185
+ }
44186
+ ];
44187
+ var SAMPLE_FILES = {
44188
+ "service.ts": 'import { http } from "./shared";\nexport const loadOrders = () => http.get("/orders");\n',
44189
+ "orders.ts": "export const saveOrder = (_order: unknown) => {\n // TODO: persist this order.\n};\n",
44190
+ "shared.ts": "// Fictional interfaces; this tour does not execute network or storage operations.\nexport declare const http: { get(path: string): Promise<unknown> };\nexport declare const orders: { save(order: unknown): void };\n"
44191
+ };
44192
+ var WARNING_EDIT = 'export const loadOrders = () => fetch("/orders");\n';
44193
+ var REPOSITORY_EDIT = 'import { orders } from "./shared";\nexport const saveOrder = (order: unknown) => orders.save(order);\n';
44194
+
44133
44195
  // src/demo/story.ts
44134
44196
  var DEMO_TASK = "Implement CSV export for customer records, including name and email.";
44135
44197
  var DEMO_ORIGINAL = "Exclude customer email addresses from CSV exports";
@@ -44164,7 +44226,7 @@ function inspectSandbox(run) {
44164
44226
  }
44165
44227
  const allowed = allowedFiles(run);
44166
44228
  for (const name of readdirSync6(sandbox.path)) {
44167
- const path9 = join22(sandbox.path, name);
44229
+ const path9 = join23(sandbox.path, name);
44168
44230
  const file = lstatSync9(path9);
44169
44231
  if (!Object.hasOwn(allowed, name) || !file.isFile() || file.nlink !== 1 || file.size > 16384 || !allowed[name].includes(readFileSync17(path9, "utf8"))) {
44170
44232
  throw new Error(`unexpected demo contents; retained ${sandbox.path}`);
@@ -44174,7 +44236,7 @@ function inspectSandbox(run) {
44174
44236
  }
44175
44237
  function createSandbox(run) {
44176
44238
  if (!run.sandbox) {
44177
- const path9 = mkdtempSync3(join22(realpathSync5(tmpdir()), "prim-demo-"));
44239
+ const path9 = mkdtempSync3(join23(realpathSync5(tmpdir()), "prim-demo-"));
44178
44240
  const stat = lstatSync9(path9);
44179
44241
  run.sandbox = { path: path9, device: stat.dev, inode: stat.ino };
44180
44242
  saveRun(run);
@@ -44187,17 +44249,17 @@ function createSandbox(run) {
44187
44249
  "decisions.json": decisionBytes(false)
44188
44250
  };
44189
44251
  for (const [name, content] of Object.entries(files)) {
44190
- const path9 = join22(root, name);
44191
- if (!existsSync14(path9)) atomicWriteFile(path9, content, { mode: 384 });
44252
+ const path9 = join23(root, name);
44253
+ if (!existsSync15(path9)) atomicWriteFile(path9, content, { mode: 384 });
44192
44254
  }
44193
44255
  }
44194
44256
  function writeSample(run, name, bytes) {
44195
44257
  const root = inspectSandbox(run);
44196
44258
  if (!allowedFiles(run)[name].includes(bytes)) throw new Error("unsupported demo edit");
44197
- atomicWriteFile(join22(root, name), bytes, { mode: 384 });
44259
+ atomicWriteFile(join23(root, name), bytes, { mode: 384 });
44198
44260
  }
44199
44261
  function readSample(run, name) {
44200
- return readFileSync17(join22(inspectSandbox(run), name), "utf8");
44262
+ return readFileSync17(join23(inspectSandbox(run), name), "utf8");
44201
44263
  }
44202
44264
  function cleanSandbox(run) {
44203
44265
  if (!run.sandbox) return;
@@ -44211,7 +44273,7 @@ function cleanSandbox(run) {
44211
44273
  const root = inspectSandbox(run);
44212
44274
  for (const name of readdirSync6(root)) {
44213
44275
  inspectSandbox(run);
44214
- unlinkSync5(join22(root, name));
44276
+ unlinkSync5(join23(root, name));
44215
44277
  }
44216
44278
  rmdirSync(root);
44217
44279
  run.sandbox = void 0;
@@ -44235,7 +44297,7 @@ function compactDiff(before, after) {
44235
44297
  }
44236
44298
  function demoTrustGuidance(agent) {
44237
44299
  if (agent === "codex")
44238
- return "Check /hooks in Codex. Approve only if a trust action is offered. If hooks are already active, retry the exact standalone command once; do not keep asking for trust or a new session. If still pending, run diagnosticAction and inspect hook errors.";
44300
+ return "Check /hooks in Codex. Approve only if a trust action is offered. If hooks are already active, retry the exact standalone command once; do not keep asking for trust or a new session. If still pending, run diagnosticAction once. Inspect its expected PreToolUse/Bash event and runtime; UserPromptSubmit does not acknowledge the tour. Do not prepare a new run.";
44239
44301
  if (agent === "hermes")
44240
44302
  return "Approve the installed prim hooks when Hermes prompts, then retry the exact nextAction.";
44241
44303
  if (agent === "cursor")
@@ -44274,7 +44336,7 @@ function resultFor2(run) {
44274
44336
  };
44275
44337
  }
44276
44338
  function present(run) {
44277
- if (run.stage === "prepared") return "Tour ready. Run nextAction to check session isolation.";
44339
+ if (run.stage === "prepared") return "Tour prepared \u2192 Isolation pending \u2192 Story not started.";
44278
44340
  if (run.stage === "skipped") return "Tour skipped. Owned sample files removed.";
44279
44341
  if (run.stage === "prompt")
44280
44342
  return `${label}
@@ -44400,7 +44462,30 @@ async function finishResolution(run, choice, reason) {
44400
44462
  finishOnboarding("completed");
44401
44463
  }
44402
44464
  }
44465
+ function pendingIsolation(run, isolation, action, choice, reason) {
44466
+ return {
44467
+ fictional: true,
44468
+ evaluation: "live",
44469
+ runId: run.id,
44470
+ stage: "pending",
44471
+ isolation,
44472
+ ...action === "status" ? { resumeAction: demoResumeCommand(run) } : { nextAction: demoCommand(run, action, choice, reason) },
44473
+ diagnostics: isolationDiagnostics(run),
44474
+ ...action === "status" ? {} : { diagnosticAction: demoDiagnosticCommand(run) },
44475
+ skipAction: demoCommand(run, "skip"),
44476
+ presentation: `Tour prepared \u2192 **Isolation pending** \u2192 ${run.stage === "prepared" ? "Story not started" : "Story paused"}.
44477
+
44478
+ ${isolation}. Checking the installed pre-tool hook before continuing.`,
44479
+ guidance: demoTrustGuidance(run.agent),
44480
+ recovery: `${action === "status" ? "Use this evidence to repair the hook before resumeAction." : "Run diagnosticAction once."} If no hook observation exists, the CLI has no evidence this command reached its installed pre-tool hook. Check the host hook event/error view and configuration-directory access; absence of a log is not proof of healthy hooks. Retry only after a repair, using this run. Never fabricate acknowledgment or read sample files.`
44481
+ };
44482
+ }
44403
44483
  async function advanceDemo(id, action, choice, reason) {
44484
+ if (action === "status") {
44485
+ const run = readRun(id);
44486
+ if (!run.terminal && !run.acknowledgment)
44487
+ return pendingIsolation(run, "acknowledgment-missing", action);
44488
+ }
44404
44489
  return await lockRunAsync(id, async (run) => {
44405
44490
  if (action === "resolve") requireResolution(choice, reason);
44406
44491
  if (action === "skip") {
@@ -44418,19 +44503,8 @@ async function advanceDemo(id, action, choice, reason) {
44418
44503
  throw new Error(
44419
44504
  `Legacy tour: clean up with ${demoCommand(run, "skip")}, then run prim demo again`
44420
44505
  );
44421
- const isolation = consumeAcknowledgment(run, action, choice, reason);
44422
- if (isolation)
44423
- return {
44424
- fictional: true,
44425
- evaluation: "live",
44426
- runId: id,
44427
- stage: "pending",
44428
- isolation,
44429
- nextAction: demoCommand(run, action, choice, reason),
44430
- diagnosticAction: demoDiagnosticCommand(run),
44431
- skipAction: demoCommand(run, "skip"),
44432
- presentation: `Session isolation pending (${isolation}). ${demoTrustGuidance(run.agent)}`
44433
- };
44506
+ const isolation = action === "status" && !run.terminal && !run.acknowledgment ? "acknowledgment-missing" : consumeAcknowledgment(run, action, choice, reason);
44507
+ if (isolation) return pendingIsolation(run, isolation, action, choice, reason);
44434
44508
  if (action === "status") {
44435
44509
  const server = run.server ? await demoStatus(run.server.runId) : void 0;
44436
44510
  return { ...handoff(run), ...server ? { server } : {} };
@@ -44503,9 +44577,19 @@ function parseAgent(value) {
44503
44577
  }
44504
44578
  function reportError(error) {
44505
44579
  const message = terminalSafeLine(error instanceof Error ? error.message : String(error));
44580
+ const code = error?.code;
44506
44581
  process.stderr.write(`[prim] demo: ${message}
44507
44582
  `);
44508
- printJson2({ fictional: true, evaluation: "live", stage: "error", message });
44583
+ printJson2({
44584
+ fictional: true,
44585
+ evaluation: "live",
44586
+ stage: "error",
44587
+ message,
44588
+ ...code === "EPERM" || code === "EACCES" ? {
44589
+ code,
44590
+ recovery: "The host denied access to Primitive local state. Run the same action with the configuration-directory access authorized for setup, within host policy. Do not create another run or change permissions recursively."
44591
+ } : {}
44592
+ });
44509
44593
  process.exitCode = 1;
44510
44594
  }
44511
44595
  async function terminalTour(run) {
@@ -44539,35 +44623,76 @@ async function terminalTour(run) {
44539
44623
  }
44540
44624
  }
44541
44625
  function registerDemoCommands(program3) {
44542
- const demo = program3.command("demo").description("Experience your Decision protecting a fictional teammate change").option("--agent <agent>", "calling agent; requires session isolation").option("--details", "include supporting story detail").action(async (options, command) => {
44626
+ const demo = program3.command("demo").description("Experience your Decision protecting a fictional teammate change").option("--agent <agent>", "calling agent; requires session isolation").option("--details", "include supporting story detail").option("--resume-pending", "reuse a pending tour prepared in this Codex session").action(async (options, command) => {
44543
44627
  try {
44544
44628
  const agent = parseAgent(options.agent);
44545
44629
  const terminal = !agent && !isNonInteractive(command.optsWithGlobals()) && !!process.stdin.isTTY && !!process.stderr.isTTY && !process.env.CLAUDECODE && !process.env.CODEX_THREAD_ID && !process.env.CURSOR_AGENT && !process.env.HERMES_INTERACTIVE;
44546
- const recovery = pendingRuns().map(
44547
- (id) => lockRun(id, (run2) => ({
44548
- runId: id,
44549
- skipAction: demoCommand(
44550
- { ...run2, launcher: [process.execPath, resolve9(process.argv[1])] },
44551
- "skip"
44552
- )
44553
- }))
44554
- );
44555
- const run = prepareRun(agent, terminal);
44630
+ const runs = pendingRuns().map(readRun);
44631
+ const recovery = runs.map((run2) => ({
44632
+ runId: run2.id,
44633
+ resumeAction: run2.version === 2 ? demoResumeCommand(run2) : void 0,
44634
+ skipAction: demoCommand(
44635
+ { ...run2, launcher: [process.execPath, resolve9(process.argv[1])] },
44636
+ "skip"
44637
+ )
44638
+ }));
44639
+ const key = preparationKey(agent);
44640
+ const pending = options.resumePending && key ? runs.find(
44641
+ (run2) => run2.version === 2 && run2.preparationKey === key && run2.agent === agent
44642
+ ) : void 0;
44643
+ const run = pending ? lockRun(pending.id, (run2) => {
44644
+ run2.launcher = [process.execPath, resolve9(process.argv[1])];
44645
+ run2.acknowledgment = void 0;
44646
+ saveRun(run2);
44647
+ return run2;
44648
+ }) : prepareRun(agent, terminal);
44556
44649
  if (terminal) {
44557
44650
  const result = await terminalTour(run);
44558
44651
  if (!process.stdout.isTTY) printJson2(result);
44559
44652
  return;
44560
44653
  }
44561
- process.stderr.write("[prim] Tour ready \u2192 run nextAction to check session isolation.\n");
44654
+ process.stderr.write(
44655
+ "[prim] Tour prepared \u2192 verify isolation to continue. Follow nextAction.\n"
44656
+ );
44562
44657
  printJson2({
44563
- ...handoff(run),
44564
- instructions: "Run nextAction exactly as a standalone command. Render presentation once, preserving diagrams. At awaitUserPrompt, wait for the user to enter that task before running attemptAction. At the block, wait for adhere or supersede; supersede requires the user's own reason and approval of the displayed replacement. Append --reason and the reason using the same single-quoted argv format (escape an apostrophe as '\\''). Never invent a reason, delegate this tour, or save fictional samples to memory or real Decisions. On completion display success before following welcome. A new session resumes passive capture.",
44658
+ fictional: true,
44659
+ evaluation: "live",
44660
+ runId: run.id,
44661
+ stage: run.stage,
44662
+ nextAction: demoCommand(run, run.stage === "prepared" ? "start" : "status"),
44663
+ skipAction: demoCommand(run, "skip"),
44664
+ statusAction: demoDiagnosticCommand(run),
44665
+ presentation: `Tour prepared \u2192 Isolation pending \u2192 ${run.stage === "prepared" ? "Story not started" : "Story paused"}.`,
44666
+ instructions: "Continue nextAction now within the authorized setup request; do not stop at welcome or ask whether to begin. Run nextAction exactly as a standalone command with the same authorized local-state access as setup. Render presentation once, preserving diagrams. At awaitUserPrompt, wait for the user to enter that task before running attemptAction. At the block, wait for adhere or supersede; supersede requires the user's own reason and approval of the displayed replacement. Append --reason and the reason using the same single-quoted argv format (escape an apostrophe as '\\''). Never invent a reason, delegate this tour, or save fictional samples to memory or real Decisions. On completion display success before following welcome. A new session resumes passive capture.",
44565
44667
  recoverableRuns: recovery
44566
44668
  });
44567
44669
  } catch (error) {
44568
44670
  reportError(error);
44569
44671
  }
44570
44672
  });
44673
+ demo.command("resume <runId>").description("Recover this run's launcher without revealing story content").action((id) => {
44674
+ try {
44675
+ printJson2(
44676
+ lockRun(id, (run) => {
44677
+ if (run.version !== 2) throw new Error("Legacy tour must be skipped before replay");
44678
+ run.launcher = [process.execPath, resolve9(process.argv[1])];
44679
+ run.acknowledgment = void 0;
44680
+ saveRun(run);
44681
+ return {
44682
+ fictional: true,
44683
+ evaluation: "live",
44684
+ runId: id,
44685
+ stage: "pending",
44686
+ nextAction: demoCommand(run, run.stage === "prepared" ? "start" : "status"),
44687
+ diagnosticAction: demoDiagnosticCommand(run),
44688
+ presentation: "Run nextAction to verify isolation and resume this tour."
44689
+ };
44690
+ })
44691
+ );
44692
+ } catch (error) {
44693
+ reportError(error);
44694
+ }
44695
+ });
44571
44696
  for (const action of ["start", "attempt", "resolve", "status", "skip"]) {
44572
44697
  const sub = demo.command(`${action} ${action === "skip" ? "[runId]" : "<runId>"}`);
44573
44698
  if (action === "resolve")
@@ -44594,7 +44719,7 @@ function registerDemoCommands(program3) {
44594
44719
  }
44595
44720
 
44596
44721
  // src/commands/doctor.ts
44597
- import { existsSync as existsSync18 } from "fs";
44722
+ import { existsSync as existsSync19 } from "fs";
44598
44723
 
44599
44724
  // src/decisions/feedback.ts
44600
44725
  var FEEDBACK_PROTOCOL_VERSION = 2;
@@ -44746,7 +44871,7 @@ async function inspectJournalDelivery(buckets, options = {}) {
44746
44871
  import {
44747
44872
  appendFileSync,
44748
44873
  closeSync as closeSync5,
44749
- existsSync as existsSync16,
44874
+ existsSync as existsSync17,
44750
44875
  fstatSync as fstatSync2,
44751
44876
  mkdirSync as mkdirSync11,
44752
44877
  openSync as openSync5,
@@ -44755,18 +44880,18 @@ import {
44755
44880
  readSync as readSync2,
44756
44881
  readdirSync as readdirSync8
44757
44882
  } from "fs";
44758
- import { dirname as dirname13, join as join24 } from "path";
44883
+ import { dirname as dirname13, join as join25 } from "path";
44759
44884
 
44760
44885
  // src/drain-progress.ts
44761
44886
  import {
44762
44887
  chmodSync as chmodSync6,
44763
- existsSync as existsSync15,
44888
+ existsSync as existsSync16,
44764
44889
  readFileSync as readFileSync18,
44765
44890
  readdirSync as readdirSync7,
44766
44891
  rmSync as rmSync6,
44767
44892
  rmdirSync as rmdirSync2
44768
44893
  } from "fs";
44769
- import { basename as basename5, dirname as dirname12, join as join23 } from "path";
44894
+ import { basename as basename5, dirname as dirname12, join as join24 } from "path";
44770
44895
  var DIRECTORY_MODE3 = 448;
44771
44896
  var FILE_MODE2 = 384;
44772
44897
  var DRAIN_PROGRESS_DIRNAME = "drain-progress";
@@ -44775,10 +44900,10 @@ function rotationIdentity(stat) {
44775
44900
  return { size: stat.size, ino: stat.ino, dev: stat.dev };
44776
44901
  }
44777
44902
  function drainProgressDirectory(flushingPath) {
44778
- return join23(dirname12(flushingPath), DRAIN_PROGRESS_DIRNAME);
44903
+ return join24(dirname12(flushingPath), DRAIN_PROGRESS_DIRNAME);
44779
44904
  }
44780
44905
  function drainProgressPath(flushingPath) {
44781
- return join23(drainProgressDirectory(flushingPath), `${basename5(flushingPath)}.json`);
44906
+ return join24(drainProgressDirectory(flushingPath), `${basename5(flushingPath)}.json`);
44782
44907
  }
44783
44908
  function isByteCount(value) {
44784
44909
  return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
@@ -44823,7 +44948,7 @@ function removeDrainCheckpoint(flushingPath) {
44823
44948
  removeEmptyDirectory(drainProgressDirectory(flushingPath));
44824
44949
  }
44825
44950
  function sweepOrphanedDrainCheckpoints(bucketDirectory) {
44826
- const directory = join23(bucketDirectory, DRAIN_PROGRESS_DIRNAME);
44951
+ const directory = join24(bucketDirectory, DRAIN_PROGRESS_DIRNAME);
44827
44952
  let names;
44828
44953
  try {
44829
44954
  names = readdirSync7(directory);
@@ -44832,11 +44957,11 @@ function sweepOrphanedDrainCheckpoints(bucketDirectory) {
44832
44957
  }
44833
44958
  for (const name of names) {
44834
44959
  const rotation = CHECKPOINT_NAME.exec(name)?.[1];
44835
- if (rotation === void 0 || existsSync15(join23(bucketDirectory, rotation))) {
44960
+ if (rotation === void 0 || existsSync16(join24(bucketDirectory, rotation))) {
44836
44961
  continue;
44837
44962
  }
44838
44963
  try {
44839
- rmSync6(join23(directory, name), { force: true });
44964
+ rmSync6(join24(directory, name), { force: true });
44840
44965
  } catch {
44841
44966
  }
44842
44967
  }
@@ -44847,7 +44972,7 @@ function sweepOrphanedDrainCheckpoints(bucketDirectory) {
44847
44972
  }
44848
44973
 
44849
44974
  // src/journal.ts
44850
- var JOURNAL_DIR = join24(primConfigDirectory(), "moves");
44975
+ var JOURNAL_DIR = join25(primConfigDirectory(), "moves");
44851
44976
  var JOURNAL_BASENAME = "journal.ndjson";
44852
44977
  var JOURNAL_STATS_SAMPLE_BYTES = 64 * 1024;
44853
44978
  var PENDING_STATS_MAX_FILES = 128;
@@ -44859,7 +44984,7 @@ function envSlug(apiUrl) {
44859
44984
  return slug;
44860
44985
  }
44861
44986
  function currentEnvDir() {
44862
- return join24(JOURNAL_DIR, envSlug(getSiteUrl()));
44987
+ return join25(JOURNAL_DIR, envSlug(getSiteUrl()));
44863
44988
  }
44864
44989
  function parseMoves(content) {
44865
44990
  const moves = [];
@@ -44875,7 +45000,7 @@ function parseMoves(content) {
44875
45000
  return moves;
44876
45001
  }
44877
45002
  function readMovesFromPath(path9) {
44878
- if (!existsSync16(path9)) {
45003
+ if (!existsSync17(path9)) {
44879
45004
  return [];
44880
45005
  }
44881
45006
  return parseMoves(readFileSync19(path9, "utf-8"));
@@ -44883,15 +45008,15 @@ function readMovesFromPath(path9) {
44883
45008
  function listBuckets() {
44884
45009
  const out = [];
44885
45010
  const envDir = currentEnvDir();
44886
- if (!existsSync16(envDir)) {
45011
+ if (!existsSync17(envDir)) {
44887
45012
  return out;
44888
45013
  }
44889
45014
  for (const entry of readdirSync8(envDir, { withFileTypes: true })) {
44890
45015
  if (!entry.isDirectory()) {
44891
45016
  continue;
44892
45017
  }
44893
- const path9 = join24(envDir, entry.name, JOURNAL_BASENAME);
44894
- if (existsSync16(path9)) {
45018
+ const path9 = join25(envDir, entry.name, JOURNAL_BASENAME);
45019
+ if (existsSync17(path9)) {
44895
45020
  out.push({ bucket: entry.name, path: path9 });
44896
45021
  }
44897
45022
  }
@@ -44953,7 +45078,7 @@ function parseFlushingPid(name) {
44953
45078
  return Number.isSafeInteger(pid) && pid > 0 ? pid : void 0;
44954
45079
  }
44955
45080
  function listFlushingInDir(dir, bucket, options = {}) {
44956
- if (!existsSync16(dir)) {
45081
+ if (!existsSync17(dir)) {
44957
45082
  return [];
44958
45083
  }
44959
45084
  const out = [];
@@ -44967,7 +45092,7 @@ function listFlushingInDir(dir, bucket, options = {}) {
44967
45092
  entry = entries.readSync();
44968
45093
  continue;
44969
45094
  }
44970
- const path9 = join24(dir, entry.name);
45095
+ const path9 = join25(dir, entry.name);
44971
45096
  let sample;
44972
45097
  try {
44973
45098
  sample = sampleJournalFile(path9, remainingBytes, { fromDrainCheckpoint: true });
@@ -44994,7 +45119,7 @@ function listFlushingInDir(dir, bucket, options = {}) {
44994
45119
  }
44995
45120
  function listFlushing(options = {}) {
44996
45121
  const envDir = currentEnvDir();
44997
- if (!existsSync16(envDir)) {
45122
+ if (!existsSync17(envDir)) {
44998
45123
  return [];
44999
45124
  }
45000
45125
  const out = [];
@@ -45005,7 +45130,7 @@ function listFlushing(options = {}) {
45005
45130
  break;
45006
45131
  }
45007
45132
  if (entry.isDirectory()) {
45008
- const found = listFlushingInDir(join24(envDir, entry.name), entry.name, {
45133
+ const found = listFlushingInDir(join25(envDir, entry.name), entry.name, {
45009
45134
  sampleBytes: remainingBytes,
45010
45135
  maxFiles: maxFiles - out.length
45011
45136
  });
@@ -45020,12 +45145,12 @@ function listFlushing(options = {}) {
45020
45145
  }
45021
45146
  function sweepOrphanedDrainProgress() {
45022
45147
  const envDir = currentEnvDir();
45023
- if (!existsSync16(envDir)) {
45148
+ if (!existsSync17(envDir)) {
45024
45149
  return;
45025
45150
  }
45026
45151
  for (const entry of readdirSync8(envDir, { withFileTypes: true })) {
45027
45152
  if (entry.isDirectory()) {
45028
- sweepOrphanedDrainCheckpoints(join24(envDir, entry.name));
45153
+ sweepOrphanedDrainCheckpoints(join25(envDir, entry.name));
45029
45154
  }
45030
45155
  }
45031
45156
  }
@@ -45074,9 +45199,9 @@ function pendingJournalStats() {
45074
45199
  }
45075
45200
 
45076
45201
  // src/commands/hermes-install.ts
45077
- import { existsSync as existsSync17, readFileSync as readFileSync20, rmSync as rmSync7, statSync as statSync4 } from "fs";
45202
+ import { existsSync as existsSync18, readFileSync as readFileSync20, rmSync as rmSync7, statSync as statSync4 } from "fs";
45078
45203
  import { homedir as homedir9 } from "os";
45079
- import { join as join25 } from "path";
45204
+ import { join as join26 } from "path";
45080
45205
 
45081
45206
  // node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/identity.js
45082
45207
  var ALIAS = /* @__PURE__ */ Symbol.for("yaml.alias");
@@ -51355,13 +51480,13 @@ var JSON_INDENT3 = 2;
51355
51480
  var CONFIG_MODE = 384;
51356
51481
  var PRIM_BINS4 = [CAPTURE_BIN4, GATE_BIN4, POST_TOOL_USE_BIN3, SESSION_START_BIN4, SESSION_END_BIN3];
51357
51482
  function hermesHome() {
51358
- return process.env.HERMES_HOME ?? join25(homedir9(), ".hermes");
51483
+ return process.env.HERMES_HOME ?? join26(homedir9(), ".hermes");
51359
51484
  }
51360
51485
  function configPath() {
51361
- return join25(hermesHome(), "config.yaml");
51486
+ return join26(hermesHome(), "config.yaml");
51362
51487
  }
51363
51488
  function legacyShimPath() {
51364
- return join25(hermesHome(), "agent-hooks", "prim-shim.sh");
51489
+ return join26(hermesHome(), "agent-hooks", "prim-shim.sh");
51365
51490
  }
51366
51491
  function commandFor2(bin) {
51367
51492
  return stableHookCommand(bin, HERMES_ARGS);
@@ -51475,7 +51600,7 @@ function hookRuntimeResolutions3(hooks) {
51475
51600
  }
51476
51601
  function inspectHookRuntimeResolutions4() {
51477
51602
  const path9 = configPath();
51478
- if (!existsSync17(path9)) return [];
51603
+ if (!existsSync18(path9)) return [];
51479
51604
  return hookRuntimeResolutions3(readHooks(parseHermesDocument(readFileSync20(path9, "utf8"))));
51480
51605
  }
51481
51606
  function entryMatchesRegistration3(owned, registration) {
@@ -51745,7 +51870,7 @@ function assertMergeValid(before, after, expectedHooks) {
51745
51870
  }
51746
51871
  }
51747
51872
  function readConfigSnapshot(path9) {
51748
- if (!existsSync17(path9)) return { exists: false, mode: CONFIG_MODE, raw: "" };
51873
+ if (!existsSync18(path9)) return { exists: false, mode: CONFIG_MODE, raw: "" };
51749
51874
  return {
51750
51875
  exists: true,
51751
51876
  mode: statSync4(path9).mode & 511,
@@ -51811,7 +51936,7 @@ function performInstall4(opts) {
51811
51936
  }
51812
51937
  function performUninstall4() {
51813
51938
  const path9 = configPath();
51814
- if (!existsSync17(path9)) {
51939
+ if (!existsSync18(path9)) {
51815
51940
  removeLegacyShim();
51816
51941
  return { path: path9, gate: false, capture: false, autoAccept: false, changed: false };
51817
51942
  }
@@ -51836,7 +51961,7 @@ function performUninstall4() {
51836
51961
  }
51837
51962
  function performStatus4() {
51838
51963
  const path9 = configPath();
51839
- const raw = existsSync17(path9) ? readFileSync20(path9, "utf8") : "";
51964
+ const raw = existsSync18(path9) ? readFileSync20(path9, "utf8") : "";
51840
51965
  const hooks = raw ? readHooks(parseHermesDocument(raw)) : {};
51841
51966
  return {
51842
51967
  path: path9,
@@ -51925,7 +52050,7 @@ function checkAuth() {
51925
52050
  return classifyAuthCredential(
51926
52051
  credential,
51927
52052
  storedCredential ? getTokenExpiresAt() : void 0,
51928
- storedCredential && existsSync18(REFRESH_TOKEN_PATH)
52053
+ storedCredential && existsSync19(REFRESH_TOKEN_PATH)
51929
52054
  );
51930
52055
  }
51931
52056
  function classifyDaemonHealth(snapshot, options = {}) {
@@ -52245,7 +52370,7 @@ function managedHookRemedy(inspection) {
52245
52370
  }
52246
52371
  return "run `prim hooks install`";
52247
52372
  case "unsupported_interpreter":
52248
- return "verify the hook interpreter; direct shell hooks need a supported shebang (for example #!/bin/sh); Husky v9 must use its .husky/_ dispatcher";
52373
+ return "existing hook preserved: add a supported shebang (for example #!/bin/sh) to a direct shell hook, or run the repository\u2019s Husky prepare script so Husky v9 selects .husky/_; then rerun prim setup. Primitive does not rewrite an unknown interpreter or change core.hooksPath silently";
52249
52374
  case "entrypoint_missing":
52250
52375
  return "run `prim enable` to stage the hook runtime";
52251
52376
  default:
@@ -52725,12 +52850,12 @@ function registerDoctorCommands(program3, dependencies = {}) {
52725
52850
  }
52726
52851
 
52727
52852
  // src/commands/moves.ts
52728
- import { existsSync as existsSync20, mkdirSync as mkdirSync13, unlinkSync as unlinkSync7, writeFileSync as writeFileSync9 } from "fs";
52729
- import { join as join28 } from "path";
52853
+ import { existsSync as existsSync21, mkdirSync as mkdirSync13, unlinkSync as unlinkSync7, writeFileSync as writeFileSync9 } from "fs";
52854
+ import { join as join29 } from "path";
52730
52855
 
52731
52856
  // src/flusher.ts
52732
52857
  import { createReadStream, renameSync as renameSync6, statSync as statSync5, unlinkSync as unlinkSync6 } from "fs";
52733
- import { dirname as dirname15, join as join27 } from "path";
52858
+ import { dirname as dirname15, join as join28 } from "path";
52734
52859
 
52735
52860
  // src/dead-letter.ts
52736
52861
  import { createHash as createHash11, randomBytes as randomBytes7 } from "crypto";
@@ -52738,7 +52863,7 @@ import {
52738
52863
  constants as constants6,
52739
52864
  chmodSync as chmodSync7,
52740
52865
  closeSync as closeSync6,
52741
- existsSync as existsSync19,
52866
+ existsSync as existsSync20,
52742
52867
  fchmodSync as fchmodSync3,
52743
52868
  fsyncSync as fsyncSync3,
52744
52869
  mkdirSync as mkdirSync12,
@@ -52747,16 +52872,16 @@ import {
52747
52872
  rmSync as rmSync8,
52748
52873
  writeFileSync as writeFileSync8
52749
52874
  } from "fs";
52750
- import { dirname as dirname14, join as join26 } from "path";
52875
+ import { dirname as dirname14, join as join27 } from "path";
52751
52876
  var DIRECTORY_MODE4 = 448;
52752
52877
  var FILE_MODE3 = 384;
52753
52878
  var DEAD_LETTER_DIRNAME = "dead-letter";
52754
52879
  function deadLetterDirectoryForRotation(flushingPath) {
52755
- return join26(dirname14(flushingPath), DEAD_LETTER_DIRNAME);
52880
+ return join27(dirname14(flushingPath), DEAD_LETTER_DIRNAME);
52756
52881
  }
52757
52882
  function deadLetterPathForRawLine(flushingPath, rawLine) {
52758
52883
  const quarantineId = createHash11("sha256").update(rawLine).digest("hex");
52759
- return join26(deadLetterDirectoryForRotation(flushingPath), `raw-${quarantineId}.json`);
52884
+ return join27(deadLetterDirectoryForRotation(flushingPath), `raw-${quarantineId}.json`);
52760
52885
  }
52761
52886
  function ensureDeadLetterDirectory(flushingPath, persistDirectory) {
52762
52887
  const directory = deadLetterDirectoryForRotation(flushingPath);
@@ -52766,11 +52891,11 @@ function ensureDeadLetterDirectory(flushingPath, persistDirectory) {
52766
52891
  return directory;
52767
52892
  }
52768
52893
  function persistDeadLetter(directory, path9, quarantineId, record3, persistDirectory) {
52769
- if (existsSync19(path9)) {
52894
+ if (existsSync20(path9)) {
52770
52895
  persistDirectory(directory);
52771
52896
  return;
52772
52897
  }
52773
- const temporaryPath = join26(
52898
+ const temporaryPath = join27(
52774
52899
  directory,
52775
52900
  `.${quarantineId}.${String(process.pid)}.${randomBytes7(8).toString("hex")}.tmp`
52776
52901
  );
@@ -52802,7 +52927,7 @@ function quarantineMove(flushingPath, move, reason, now = Date.now, options = {}
52802
52927
  reason,
52803
52928
  move
52804
52929
  };
52805
- const path9 = join26(directory, `${record3.quarantineId}.json`);
52930
+ const path9 = join27(directory, `${record3.quarantineId}.json`);
52806
52931
  persistDeadLetter(directory, path9, record3.quarantineId, record3, persistDirectory);
52807
52932
  return record3;
52808
52933
  }
@@ -53226,7 +53351,7 @@ async function flushOnce() {
53226
53351
  return inspection.retainedBuckets.length > 0 ? { flushed: total, quarantined, retained: inspection.retainedBuckets } : { flushed: total, quarantined };
53227
53352
  }
53228
53353
  var flushInFlight;
53229
- var FLUSH_LOCK_PATH = join27(dirname15(JOURNAL_DIR), ".flush.lock");
53354
+ var FLUSH_LOCK_PATH = join28(dirname15(JOURNAL_DIR), ".flush.lock");
53230
53355
  var FLUSH_LOCK_TIMEOUT_MS = 250;
53231
53356
  function isFlushLockContended(error) {
53232
53357
  return error instanceof Error && error.message.startsWith("timed out waiting for file lock");
@@ -53358,19 +53483,19 @@ function registerMovesCommands(program3) {
53358
53483
  }
53359
53484
  });
53360
53485
  moves.command("bind").description("Pin the current directory to an org via .prim/workspace.json").requiredOption("--orgId <orgId>", "Convex organization id").action((opts) => {
53361
- const dir = join28(process.cwd(), ".prim");
53362
- if (!existsSync20(dir)) {
53486
+ const dir = join29(process.cwd(), ".prim");
53487
+ if (!existsSync21(dir)) {
53363
53488
  mkdirSync13(dir, { recursive: true, mode: DIR_MODE });
53364
53489
  }
53365
- const file = join28(process.cwd(), WORKSPACE_FILE);
53490
+ const file = join29(process.cwd(), WORKSPACE_FILE);
53366
53491
  writeFileSync9(file, JSON.stringify({ orgId: opts.orgId, boundAt: Date.now() }, null, 2), {
53367
53492
  mode: FILE_MODE4
53368
53493
  });
53369
53494
  console.log(`[prim] bound ${process.cwd()} to org ${opts.orgId}`);
53370
53495
  });
53371
53496
  moves.command("drop").description("Remove the .prim/workspace.json binding from the cwd").action(() => {
53372
- const file = join28(process.cwd(), WORKSPACE_FILE);
53373
- if (!existsSync20(file)) {
53497
+ const file = join29(process.cwd(), WORKSPACE_FILE);
53498
+ if (!existsSync21(file)) {
53374
53499
  console.log("[prim] no workspace binding in cwd");
53375
53500
  return;
53376
53501
  }
@@ -53500,31 +53625,31 @@ function registerReconcileCommands(program3) {
53500
53625
 
53501
53626
  // src/commands/session.ts
53502
53627
  import {
53503
- existsSync as existsSync22,
53628
+ existsSync as existsSync23,
53504
53629
  mkdirSync as mkdirSync14,
53505
53630
  readFileSync as readFileSync22,
53506
53631
  readdirSync as readdirSync9,
53507
53632
  unlinkSync as unlinkSync8,
53508
53633
  writeFileSync as writeFileSync10
53509
53634
  } from "fs";
53510
- import { join as join30 } from "path";
53635
+ import { join as join31 } from "path";
53511
53636
 
53512
53637
  // src/binding.ts
53513
- import { existsSync as existsSync21, readFileSync as readFileSync21 } from "fs";
53514
- import { dirname as dirname16, join as join29 } from "path";
53638
+ import { existsSync as existsSync22, readFileSync as readFileSync21 } from "fs";
53639
+ import { dirname as dirname16, join as join30 } from "path";
53515
53640
  var PRIM_CONFIG_DIR = primConfigDirectory();
53516
- var SESSIONS_DIR = join29(PRIM_CONFIG_DIR, "sessions");
53641
+ var SESSIONS_DIR = join30(PRIM_CONFIG_DIR, "sessions");
53517
53642
 
53518
53643
  // src/commands/session.ts
53519
53644
  var DIR_MODE2 = 448;
53520
53645
  var FILE_MODE5 = 384;
53521
53646
  function ensureDir() {
53522
- if (!existsSync22(SESSIONS_DIR)) {
53647
+ if (!existsSync23(SESSIONS_DIR)) {
53523
53648
  mkdirSync14(SESSIONS_DIR, { recursive: true, mode: DIR_MODE2 });
53524
53649
  }
53525
53650
  }
53526
53651
  function markerPath(sessionId) {
53527
- return join30(SESSIONS_DIR, `${sessionId}.json`);
53652
+ return join31(SESSIONS_DIR, `${sessionId}.json`);
53528
53653
  }
53529
53654
  function registerSessionCommands(program3) {
53530
53655
  const session = program3.command("session").description("Decision Event Pipeline \u2014 session binding markers");
@@ -53540,7 +53665,7 @@ function registerSessionCommands(program3) {
53540
53665
  console.log(`[prim] session ${sessionId} bound to org ${opts.orgId}`);
53541
53666
  });
53542
53667
  session.command("list").description("List active session markers").action(() => {
53543
- if (!existsSync22(SESSIONS_DIR)) {
53668
+ if (!existsSync23(SESSIONS_DIR)) {
53544
53669
  console.log("[prim] no session markers");
53545
53670
  return;
53546
53671
  }
@@ -53552,7 +53677,7 @@ function registerSessionCommands(program3) {
53552
53677
  for (const f of files) {
53553
53678
  const sessionId = f.replace(/\.json$/, "");
53554
53679
  try {
53555
- const m = JSON.parse(readFileSync22(join30(SESSIONS_DIR, f), "utf-8"));
53680
+ const m = JSON.parse(readFileSync22(join31(SESSIONS_DIR, f), "utf-8"));
53556
53681
  console.log(`${sessionId} org=${m.orgId}`);
53557
53682
  } catch {
53558
53683
  }
@@ -53560,7 +53685,7 @@ function registerSessionCommands(program3) {
53560
53685
  });
53561
53686
  session.command("drop <sessionId>").description("Remove a session marker").action((sessionId) => {
53562
53687
  const p = markerPath(sessionId);
53563
- if (!existsSync22(p)) {
53688
+ if (!existsSync23(p)) {
53564
53689
  console.log(`[prim] no marker for session ${sessionId}`);
53565
53690
  return;
53566
53691
  }
@@ -53571,8 +53696,8 @@ function registerSessionCommands(program3) {
53571
53696
 
53572
53697
  // src/commands/setup.ts
53573
53698
  import { spawnSync as spawnSync2 } from "child_process";
53574
- import { existsSync as existsSync23, readFileSync as readFileSync23 } from "fs";
53575
- import { join as join31 } from "path";
53699
+ import { existsSync as existsSync24, readFileSync as readFileSync23 } from "fs";
53700
+ import { join as join32 } from "path";
53576
53701
  var EXIT_INCOMPLETE = 1;
53577
53702
  var EXIT_USAGE3 = 2;
53578
53703
  var SETUP_ORCHESTRATOR_ENV = "PRIM_SETUP_ORCHESTRATOR";
@@ -53710,8 +53835,8 @@ function detectProjectConflicts(agent, run, globalHooksActive) {
53710
53835
  let preCommit;
53711
53836
  try {
53712
53837
  const root = gitToplevel();
53713
- const path9 = root && join31(root, ".git", "hooks", "pre-commit");
53714
- if (path9 && existsSync23(path9)) preCommit = readFileSync23(path9, "utf-8");
53838
+ const path9 = root && join32(root, ".git", "hooks", "pre-commit");
53839
+ if (path9 && existsSync24(path9)) preCommit = readFileSync23(path9, "utf-8");
53715
53840
  } catch {
53716
53841
  }
53717
53842
  if (projectHooksConflict(globalHooksActive, preCommit)) conflicts.push(CONFLICT_HOOKS);
@@ -53728,6 +53853,7 @@ function detectAgent(env4) {
53728
53853
  if (env4.HERMES_INTERACTIVE) {
53729
53854
  return "hermes";
53730
53855
  }
53856
+ if (env4.CODEX_THREAD_ID) return "codex";
53731
53857
  if (env4.CURSOR_AGENT) {
53732
53858
  return "cursor";
53733
53859
  }
@@ -53762,7 +53888,7 @@ function registerSetupCommand(program3, dependencies = {}) {
53762
53888
  ).option(
53763
53889
  "--migrate",
53764
53890
  "with the default user scope, remove any project-scoped prim config in this repo (else just warn)"
53765
- ).option("--no-daemon", "stop and disable the companion daemon").option("--details", "show full installation diagnostics and child output").option("--skip-demo", "skip the optional author story and remember that choice").action((opts) => {
53891
+ ).option("--no-daemon", "stop and disable the companion daemon").option("--details", "show full human installation diagnostics on STDERR").option("--skip-demo", "skip the optional author story and remember that choice").action((opts) => {
53766
53892
  const { agent: agentInput, detected } = resolveAgent(opts.agent, process.env);
53767
53893
  if (agentInput !== "claude" && agentInput !== "codex" && agentInput !== "cursor" && agentInput !== "hermes") {
53768
53894
  process.stderr.write(
@@ -53788,25 +53914,21 @@ function registerSetupCommand(program3, dependencies = {}) {
53788
53914
  const self = process.argv[1];
53789
53915
  const globals = program3.optsWithGlobals();
53790
53916
  const run = dependencies.run ?? ((args, capture = false) => {
53791
- const compact = !opts.details;
53792
- const structuredChild = args.includes("demo") || args[0] === "welcome";
53793
53917
  const childArgs = opts.details ? args.filter((arg) => arg !== "--compact") : args;
53794
53918
  const r = spawnSync2(
53795
53919
  process.execPath,
53796
53920
  [self, ...childArgs],
53797
53921
  setupStepSpawnOptions(capture, process.env, {
53798
53922
  startsDaemon: opts.daemon,
53799
- compact: compact || structuredChild
53923
+ compact: true
53800
53924
  })
53801
53925
  );
53802
- if (!capture && opts.details && structuredChild && r.stdout)
53803
- process.stdout.write(r.stdout);
53804
- if (!capture && compact && r.status !== 0 && r.stdout) process.stderr.write(r.stdout);
53926
+ if (!capture && r.status !== 0 && r.stdout) process.stderr.write(r.stdout);
53805
53927
  if (r.error) process.stderr.write(`[prim] ${r.error.message}
53806
53928
  `);
53807
53929
  return {
53808
53930
  code: r.status ?? 1,
53809
- stdout: capture || compact || structuredChild ? r.stdout ?? "" : ""
53931
+ stdout: r.stdout ?? ""
53810
53932
  };
53811
53933
  });
53812
53934
  const results = {};
@@ -53887,11 +54009,13 @@ function registerSetupCommand(program3, dependencies = {}) {
53887
54009
  const { code } = run(enableArgs);
53888
54010
  results[enableStep.key] = code === 0 ? "ok" : enableStep.required ? "failed" : "skipped";
53889
54011
  }
54012
+ let health;
53890
54013
  const healthStep = setupSteps.find((candidate) => candidate.key === "health");
53891
54014
  if (healthStep) {
53892
54015
  note(`${healthStep.label} \xB7 verifying\u2026`);
53893
- const { code } = run(healthStep.args);
53894
- results[healthStep.key] = code === 0 ? "ok" : healthStep.required ? "failed" : "skipped";
54016
+ const { code, stdout } = run(healthStep.args);
54017
+ health = setupChildPayload(stdout);
54018
+ results[healthStep.key] = code !== 0 || health?.status === "fail" ? healthStep.required ? "failed" : "skipped" : health?.status === "warn" ? "warn" : "ok";
53895
54019
  }
53896
54020
  const installationSucceeded = !Object.values(results).includes("failed");
53897
54021
  let tourDue = false;
@@ -53930,6 +54054,7 @@ function registerSetupCommand(program3, dependencies = {}) {
53930
54054
  const demoResult = run([
53931
54055
  ...globals.nonInteractive ? ["--non-interactive"] : [],
53932
54056
  "demo",
54057
+ "--resume-pending",
53933
54058
  ...agentDriven ? ["--agent", agent] : []
53934
54059
  ]);
53935
54060
  onboarding = setupChildPayload(demoResult.stdout) ?? {
@@ -53946,6 +54071,16 @@ function registerSetupCommand(program3, dependencies = {}) {
53946
54071
  setup: true,
53947
54072
  status: failed.length ? "incomplete" : "complete",
53948
54073
  steps: results,
54074
+ ...health ? { health } : {},
54075
+ readiness: {
54076
+ installation: failed.length ? "incomplete" : "installed",
54077
+ health: results.health ?? "not-checked",
54078
+ passiveCapture: "not-verified",
54079
+ onboarding: onboarding?.stage ?? (opts.skipDemo ? "skipped" : "not-due")
54080
+ },
54081
+ ...onboarding?.nextAction ? {
54082
+ instructions: "Setup installation is complete. Continue nextAction now; onboarding is pending. Render each presentation once. Do not stop at welcome, repeat raw output, or claim passive capture is verified."
54083
+ } : {},
53949
54084
  welcome: setupChildPayload(welcomeResult.stdout),
53950
54085
  ...onboarding ? { onboarding, nextAction: onboarding.nextAction } : {}
53951
54086
  });
@@ -53966,7 +54101,7 @@ import { createHash as createHash13 } from "crypto";
53966
54101
  import {
53967
54102
  constants as constants8,
53968
54103
  closeSync as closeSync8,
53969
- existsSync as existsSync25,
54104
+ existsSync as existsSync26,
53970
54105
  fstatSync as fstatSync4,
53971
54106
  lstatSync as lstatSync11,
53972
54107
  openSync as openSync8,
@@ -53977,7 +54112,7 @@ import {
53977
54112
  unlinkSync as unlinkSync9
53978
54113
  } from "fs";
53979
54114
  import { homedir as homedir11 } from "os";
53980
- import { dirname as dirname18, join as join33, resolve as resolve11 } from "path";
54115
+ import { dirname as dirname18, join as join34, resolve as resolve11 } from "path";
53981
54116
  import { fileURLToPath as fileURLToPath5 } from "url";
53982
54117
 
53983
54118
  // src/commands/claude-plugin.ts
@@ -53985,7 +54120,7 @@ import { createHash as createHash12 } from "crypto";
53985
54120
  import {
53986
54121
  constants as constants7,
53987
54122
  closeSync as closeSync7,
53988
- existsSync as existsSync24,
54123
+ existsSync as existsSync25,
53989
54124
  fstatSync as fstatSync3,
53990
54125
  lstatSync as lstatSync10,
53991
54126
  mkdirSync as mkdirSync15,
@@ -53998,15 +54133,15 @@ import {
53998
54133
  rmdirSync as rmdirSync3
53999
54134
  } from "fs";
54000
54135
  import { homedir as homedir10 } from "os";
54001
- import { dirname as dirname17, isAbsolute as isAbsolute9, join as join32, relative as relative3, resolve as resolve10, sep as sep3 } from "path";
54136
+ import { dirname as dirname17, isAbsolute as isAbsolute9, join as join33, relative as relative3, resolve as resolve10, sep as sep3 } from "path";
54002
54137
  import { fileURLToPath as fileURLToPath4 } from "url";
54003
54138
  var __dirname4 = dirname17(fileURLToPath4(import.meta.url));
54004
54139
  var PLUGIN_DESCRIPTION = "Primitive decision-graph guidance for the prim CLI \u2014 a model-invoked skill installed by prim skill install.";
54005
54140
  var MAX_MANIFEST_BYTES2 = 64 * 1024;
54006
54141
  var MAX_SKILL_BYTES = 1024 * 1024;
54007
54142
  function pluginDirFor(cwd, scope) {
54008
- const base = scope === "user" ? join32(homedir10(), ".claude") : join32(gitToplevel(cwd) ?? cwd, ".claude");
54009
- return join32(base, "skills", "prim");
54143
+ const base = scope === "user" ? join33(homedir10(), ".claude") : join33(gitToplevel(cwd) ?? cwd, ".claude");
54144
+ return join33(base, "skills", "prim");
54010
54145
  }
54011
54146
  function resolvePluginDir(cwd, scope) {
54012
54147
  if (scope && scope !== "user" && scope !== "project") {
@@ -54019,7 +54154,7 @@ function packageVersion2() {
54019
54154
  let dir = __dirname4;
54020
54155
  while (dir !== dirname17(dir)) {
54021
54156
  const p = resolve10(dir, "package.json");
54022
- if (existsSync24(p)) return JSON.parse(readFileSync24(p, "utf-8")).version;
54157
+ if (existsSync25(p)) return JSON.parse(readFileSync24(p, "utf-8")).version;
54023
54158
  dir = dirname17(dir);
54024
54159
  }
54025
54160
  return "0.0.0";
@@ -54034,12 +54169,12 @@ function renderClaudePlugin() {
54034
54169
  return { manifest: pluginManifest(version), skill: loadSkill(), version };
54035
54170
  }
54036
54171
  function removeDirIfEmpty(dir) {
54037
- if (existsSync24(dir) && readdirSync10(dir).length === 0) rmdirSync3(dir);
54172
+ if (existsSync25(dir) && readdirSync10(dir).length === 0) rmdirSync3(dir);
54038
54173
  }
54039
54174
  function pluginPaths(dir) {
54040
54175
  return {
54041
- manifestPath: join32(dir, ".claude-plugin", "plugin.json"),
54042
- skillPath: join32(dir, "SKILL.md")
54176
+ manifestPath: join33(dir, ".claude-plugin", "plugin.json"),
54177
+ skillPath: join33(dir, "SKILL.md")
54043
54178
  };
54044
54179
  }
54045
54180
  function installClaudePlugin(cwd, opts) {
@@ -54047,8 +54182,8 @@ function installClaudePlugin(cwd, opts) {
54047
54182
  if (dir === null) return 1;
54048
54183
  const { manifestPath, skillPath } = pluginPaths(dir);
54049
54184
  const { manifest, skill } = renderClaudePlugin();
54050
- const manifestCurrent = existsSync24(manifestPath) ? readFileSync24(manifestPath, "utf-8") : null;
54051
- const skillCurrent = existsSync24(skillPath) ? readFileSync24(skillPath, "utf-8") : null;
54185
+ const manifestCurrent = existsSync25(manifestPath) ? readFileSync24(manifestPath, "utf-8") : null;
54186
+ const skillCurrent = existsSync25(skillPath) ? readFileSync24(skillPath, "utf-8") : null;
54052
54187
  if (manifestCurrent === manifest && skillCurrent === skill) {
54053
54188
  console.log("No changes \u2014 prim skill plugin already up to date.");
54054
54189
  return 0;
@@ -54057,7 +54192,7 @@ function installClaudePlugin(cwd, opts) {
54057
54192
  console.log(`Would write plugin to ${dir} (.claude-plugin/plugin.json + SKILL.md)`);
54058
54193
  return 0;
54059
54194
  }
54060
- mkdirSync15(join32(dir, ".claude-plugin"), { recursive: true });
54195
+ mkdirSync15(join33(dir, ".claude-plugin"), { recursive: true });
54061
54196
  atomicWrite5(manifestPath, manifest);
54062
54197
  atomicWrite5(skillPath, skill);
54063
54198
  console.log(`Installed prim skill plugin at ${dir}`);
@@ -54071,13 +54206,13 @@ function uninstallClaudePlugin(cwd, opts) {
54071
54206
  const dir = resolvePluginDir(cwd, opts.scope);
54072
54207
  if (dir === null) return 1;
54073
54208
  const { manifestPath, skillPath } = pluginPaths(dir);
54074
- if (!existsSync24(manifestPath) && !existsSync24(skillPath)) {
54209
+ if (!existsSync25(manifestPath) && !existsSync25(skillPath)) {
54075
54210
  console.log(`prim skill plugin not present at ${dir}`);
54076
54211
  return 0;
54077
54212
  }
54078
54213
  rmSync9(manifestPath, { force: true });
54079
54214
  rmSync9(skillPath, { force: true });
54080
- removeDirIfEmpty(join32(dir, ".claude-plugin"));
54215
+ removeDirIfEmpty(join33(dir, ".claude-plugin"));
54081
54216
  removeDirIfEmpty(dir);
54082
54217
  console.log(`Removed prim skill plugin from ${dir}`);
54083
54218
  return 0;
@@ -54086,7 +54221,7 @@ function statusClaudePlugin(cwd, opts) {
54086
54221
  const dir = resolvePluginDir(cwd, opts.scope);
54087
54222
  if (dir === null) return 1;
54088
54223
  const { skillPath } = pluginPaths(dir);
54089
- const installed = existsSync24(skillPath);
54224
+ const installed = existsSync25(skillPath);
54090
54225
  if (opts.json) {
54091
54226
  printJson({ installed, target: dir });
54092
54227
  return installed ? 0 : 1;
@@ -54128,14 +54263,14 @@ function sha2563(content) {
54128
54263
  }
54129
54264
  function cursorSkillDirectory(cwd, scope) {
54130
54265
  const base = scope === "user" ? cursorConfigDirectory() : gitToplevel(cwd) ?? cwd;
54131
- return join33(base, scope === "user" ? "skills" : ".cursor/skills", "prim");
54266
+ return join34(base, scope === "user" ? "skills" : ".cursor/skills", "prim");
54132
54267
  }
54133
54268
  function cursorSkillPaths(cwd, scope) {
54134
54269
  const directory = cursorSkillDirectory(cwd, scope);
54135
54270
  return {
54136
54271
  directory,
54137
- skill: join33(directory, "SKILL.md"),
54138
- manifest: join33(directory, CURSOR_SKILL_MANIFEST)
54272
+ skill: join34(directory, "SKILL.md"),
54273
+ manifest: join34(directory, CURSOR_SKILL_MANIFEST)
54139
54274
  };
54140
54275
  }
54141
54276
  function readCursorSkillManifest(path9) {
@@ -54154,7 +54289,7 @@ function readCursorSkillManifest(path9) {
54154
54289
  function cursorSkillStatus(cwd, scope) {
54155
54290
  const paths = cursorSkillPaths(cwd, scope);
54156
54291
  const manifest = readCursorSkillManifest(paths.manifest);
54157
- const content = existsSync25(paths.skill) ? readFileSync25(paths.skill, "utf8") : void 0;
54292
+ const content = existsSync26(paths.skill) ? readFileSync25(paths.skill, "utf8") : void 0;
54158
54293
  const owned = manifest !== void 0;
54159
54294
  const installed = owned && content !== void 0 && sha2563(content) === manifest.contentSha256;
54160
54295
  return {
@@ -54172,8 +54307,8 @@ function validCursorSkillScope(scope) {
54172
54307
  function installCursorSkill(cwd, opts) {
54173
54308
  const paths = cursorSkillPaths(cwd, opts.scope);
54174
54309
  const status = cursorSkillStatus(cwd, opts.scope);
54175
- const manifestExists = existsSync25(paths.manifest);
54176
- const skillExists = existsSync25(paths.skill);
54310
+ const manifestExists = existsSync26(paths.manifest);
54311
+ const skillExists = existsSync26(paths.skill);
54177
54312
  if (manifestExists && !status.owned || !manifestExists && skillExists || status.edited) {
54178
54313
  console.error(`Refusing to overwrite a foreign or edited Cursor skill at ${paths.skill}`);
54179
54314
  return 1;
@@ -54210,8 +54345,8 @@ function uninstallCursorSkill(cwd, scope) {
54210
54345
  console.error(`Refusing to remove an edited Cursor skill at ${paths.skill}`);
54211
54346
  return 1;
54212
54347
  }
54213
- if (existsSync25(paths.skill)) unlinkSync9(paths.skill);
54214
- if (existsSync25(paths.manifest)) unlinkSync9(paths.manifest);
54348
+ if (existsSync26(paths.skill)) unlinkSync9(paths.skill);
54349
+ if (existsSync26(paths.manifest)) unlinkSync9(paths.manifest);
54215
54350
  try {
54216
54351
  if (readdirSync11(paths.directory).length === 0) rmdirSync4(paths.directory);
54217
54352
  } catch {
@@ -54220,10 +54355,10 @@ function uninstallCursorSkill(cwd, scope) {
54220
54355
  return 0;
54221
54356
  }
54222
54357
  function userTargetFor(agent) {
54223
- if (agent === "claude") return join33(homedir11(), ".claude", "CLAUDE.md");
54224
- if (agent === "codex") return join33(homedir11(), ".codex", "AGENTS.md");
54358
+ if (agent === "claude") return join34(homedir11(), ".claude", "CLAUDE.md");
54359
+ if (agent === "codex") return join34(homedir11(), ".codex", "AGENTS.md");
54225
54360
  if (agent === "hermes") {
54226
- return join33(process.env.HERMES_HOME ?? join33(homedir11(), ".hermes"), ".hermes.md");
54361
+ return join34(process.env.HERMES_HOME ?? join34(homedir11(), ".hermes"), ".hermes.md");
54227
54362
  }
54228
54363
  return null;
54229
54364
  }
@@ -54231,13 +54366,13 @@ function loadSkill() {
54231
54366
  let dir = __dirname5;
54232
54367
  while (dir !== dirname18(dir)) {
54233
54368
  const p = resolve11(dir, "SKILL.md");
54234
- if (existsSync25(p)) return readFileSync25(p, "utf-8");
54369
+ if (existsSync26(p)) return readFileSync25(p, "utf-8");
54235
54370
  dir = dirname18(dir);
54236
54371
  }
54237
54372
  throw new Error("SKILL.md not found in package");
54238
54373
  }
54239
54374
  function detectTargets(cwd) {
54240
- return TARGET_CANDIDATES.filter((p) => existsSync25(resolve11(cwd, p)));
54375
+ return TARGET_CANDIDATES.filter((p) => existsSync26(resolve11(cwd, p)));
54241
54376
  }
54242
54377
  function detectNewline(content) {
54243
54378
  return content.includes("\r\n") ? "\r\n" : "\n";
@@ -54303,7 +54438,7 @@ function runInstall(cwd, opts) {
54303
54438
  }
54304
54439
  const target = resolveTarget(cwd, opts);
54305
54440
  if (target === null) return 1;
54306
- const existing = existsSync25(target) ? readFileSync25(target, "utf-8") : "";
54441
+ const existing = existsSync26(target) ? readFileSync25(target, "utf-8") : "";
54307
54442
  const eol = existing ? detectNewline(existing) : "\n";
54308
54443
  const block = composeBlock(loadSkill(), eol);
54309
54444
  const next = applyBlock(existing, block, eol);
@@ -54327,7 +54462,7 @@ function runUninstall(cwd, opts) {
54327
54462
  }
54328
54463
  const target = resolveTarget(cwd, opts);
54329
54464
  if (target === null) return 1;
54330
- if (!existsSync25(target)) {
54465
+ if (!existsSync26(target)) {
54331
54466
  console.log(`Skill block not present at ${target}`);
54332
54467
  return 0;
54333
54468
  }
@@ -54355,7 +54490,7 @@ function runStatus(cwd, opts) {
54355
54490
  }
54356
54491
  const target = resolveTarget(cwd, opts);
54357
54492
  if (target === null) return 1;
54358
- const fileExists = existsSync25(target);
54493
+ const fileExists = existsSync26(target);
54359
54494
  let installed = false;
54360
54495
  if (fileExists) {
54361
54496
  const content = readFileSync25(target, "utf-8");
@@ -54821,7 +54956,7 @@ function registerWelcomeCommand(program3, deps = { getClient }) {
54821
54956
  const agent = resolveWelcomeAgent(options.agent, process.env);
54822
54957
  if (options.deferSeeding) {
54823
54958
  process.stderr.write(
54824
- "Welcome to Primitive. Setup is complete; the optional author story comes before real Decision seeding.\n"
54959
+ "Primitive installed \u2192 session isolation next \u2192 story \u2192 real Decisions. Follow setup\u2019s nextAction.\n"
54825
54960
  );
54826
54961
  printJson({ welcomed: true, onboarding: "demo", seedingDeferred: true });
54827
54962
  return;
@@ -54978,10 +55113,10 @@ import { spawn as spawn5 } from "child_process";
54978
55113
  import { readFileSync as readFileSync27 } from "fs";
54979
55114
 
54980
55115
  // src/daemon/health.ts
54981
- import { chmodSync as chmodSync8, existsSync as existsSync26, mkdirSync as mkdirSync16, renameSync as renameSync7, writeFileSync as writeFileSync11 } from "fs";
54982
- import { dirname as dirname20, join as join34 } from "path";
55116
+ import { chmodSync as chmodSync8, existsSync as existsSync27, mkdirSync as mkdirSync16, renameSync as renameSync7, writeFileSync as writeFileSync11 } from "fs";
55117
+ import { dirname as dirname20, join as join35 } from "path";
54983
55118
  var HEARTBEAT_FRESH_MS = 9e4;
54984
- var DAEMON_HEALTH_PATH = join34(primConfigDirectory(), "daemon-health.json");
55119
+ var DAEMON_HEALTH_PATH = join35(primConfigDirectory(), "daemon-health.json");
54985
55120
 
54986
55121
  // src/lib/background-flush.ts
54987
55122
  function record2(value) {