@primitive.ai/prim 0.1.0-alpha.120 → 0.1.0-alpha.121

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.
Files changed (46) hide show
  1. package/README.md +19 -9
  2. package/SKILL.md +7 -2
  3. package/dist/{chunk-HXICZG5J.js → chunk-2DNC2MUN.js} +4 -4
  4. package/dist/{chunk-NQFRQ56V.js → chunk-2PFJJO2M.js} +2 -2
  5. package/dist/{chunk-P2O7NLVN.js → chunk-4GYJHN26.js} +117 -18
  6. package/dist/{chunk-5BQ2NEMP.js → chunk-6DEROXLM.js} +2 -2
  7. package/dist/{chunk-CCGFRNAA.js → chunk-7LXRFXZG.js} +248 -127
  8. package/dist/{chunk-MWNRXAEB.js → chunk-AKGRY7OU.js} +1 -1
  9. package/dist/{chunk-L52OD62C.js → chunk-BHT6X3T5.js} +14 -8
  10. package/dist/{chunk-D235RJNO.js → chunk-DQ4I3FLF.js} +3 -3
  11. package/dist/{chunk-VOC4KOOP.js → chunk-DVHD6LBQ.js} +2 -2
  12. package/dist/{chunk-TC4FTRYO.js → chunk-HG7FJK7R.js} +2 -2
  13. package/dist/{chunk-GYQOZGGF.js → chunk-JXRJLHE4.js} +2 -2
  14. package/dist/{chunk-2AKDX4RU.js → chunk-JZC2LHS6.js} +1 -1
  15. package/dist/{chunk-YTF6OCF3.js → chunk-LQLP26RL.js} +5 -5
  16. package/dist/{chunk-EYBE724K.js → chunk-M4NZJCPQ.js} +4 -4
  17. package/dist/{chunk-R2NUH4B7.js → chunk-MRDY7VQP.js} +2 -2
  18. package/dist/{chunk-SLDZJD6Q.js → chunk-NMZSCSMY.js} +1 -1
  19. package/dist/{chunk-A6M2M5A2.js → chunk-NQZLXYTW.js} +1 -1
  20. package/dist/{chunk-LTTF4MBE.js → chunk-OXW6PSPT.js} +2 -2
  21. package/dist/{chunk-U67RBNIZ.js → chunk-S3ZIMGXV.js} +1 -1
  22. package/dist/{chunk-LBCPRHNG.js → chunk-WN7OURQ3.js} +1 -1
  23. package/dist/daemon/server.js +78 -16
  24. package/dist/hook-runtime/daemon/server.js +78 -16
  25. package/dist/hook-runtime/hooks/post-commit.js +88 -26
  26. package/dist/hook-runtime/hooks/post-rewrite.js +82 -20
  27. package/dist/hook-runtime/hooks/post-tool-use.js +82 -20
  28. package/dist/hook-runtime/hooks/pre-commit.js +9 -5
  29. package/dist/hook-runtime/hooks/pre-tool-use-worker.js +12 -8
  30. package/dist/hook-runtime/hooks/prim-hook.js +85 -23
  31. package/dist/hook-runtime/hooks/session-end.js +75 -13
  32. package/dist/hook-runtime/hooks/session-start.js +247 -176
  33. package/dist/hook-runtime/index.js +1147 -692
  34. package/dist/hook-runtime/statusline-main.js +76 -14
  35. package/dist/hooks/post-commit.js +7 -7
  36. package/dist/hooks/post-rewrite.js +6 -6
  37. package/dist/hooks/post-tool-use.js +15 -15
  38. package/dist/hooks/pre-commit.js +4 -4
  39. package/dist/hooks/pre-tool-use-worker.js +9 -9
  40. package/dist/hooks/prim-hook.js +17 -17
  41. package/dist/hooks/session-end.js +4 -4
  42. package/dist/hooks/session-start.js +11 -11
  43. package/dist/index.js +349 -98
  44. package/dist/statusline-main.js +76 -14
  45. package/package.json +3 -2
  46. package/skills/prim-welcome/SKILL.md +197 -0
@@ -1421,13 +1421,17 @@ async function daemonOrDirectGet(method, path, client, timeoutMs = DAEMON_HTTP_T
1421
1421
  }
1422
1422
 
1423
1423
  // src/lib/activation.ts
1424
- import { execFileSync as execFileSync2 } from "child_process";
1424
+ import { execFileSync as execFileSync3 } from "child_process";
1425
1425
  import { existsSync as existsSync4, readFileSync as readFileSync6 } from "fs";
1426
1426
  import { homedir as homedir2 } from "os";
1427
1427
  import { join as join8 } from "path";
1428
1428
 
1429
- // src/lib/git.ts
1429
+ // src/lib/demo-pause.ts
1430
1430
  import { execFileSync } from "child_process";
1431
+ var DEMO_PAUSE_MS = 30 * 6e4;
1432
+
1433
+ // src/lib/git.ts
1434
+ import { execFileSync as execFileSync2 } from "child_process";
1431
1435
  import { createHash as createHash4 } from "crypto";
1432
1436
  import { lstatSync as lstatSync2, realpathSync } from "fs";
1433
1437
  import { basename, dirname as dirname5, isAbsolute as isAbsolute3, relative, resolve as resolve2, sep } from "path";
@@ -1436,7 +1440,7 @@ var GITHUB_OWNER_PATTERN = /^(?![A-Za-z0-9-]*--)[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}
1436
1440
  var GITHUB_REPOSITORY_PATTERN = /^[A-Za-z0-9._-]{1,100}$/u;
1437
1441
  function gitToplevel(cwd) {
1438
1442
  try {
1439
- return execFileSync("git", ["rev-parse", "--show-toplevel"], {
1443
+ return execFileSync2("git", ["rev-parse", "--show-toplevel"], {
1440
1444
  cwd,
1441
1445
  encoding: "utf-8",
1442
1446
  stdio: ["ignore", "pipe", "ignore"],
@@ -1448,7 +1452,7 @@ function gitToplevel(cwd) {
1448
1452
  }
1449
1453
  function gitValue(cwd, args) {
1450
1454
  try {
1451
- const value = execFileSync("git", args, {
1455
+ const value = execFileSync2("git", args, {
1452
1456
  cwd,
1453
1457
  encoding: "utf-8",
1454
1458
  stdio: ["ignore", "pipe", "ignore"],
@@ -1569,7 +1573,7 @@ function isValidRepoSyncId(value) {
1569
1573
  }
1570
1574
  function localGitConfigValue(cwd, key) {
1571
1575
  try {
1572
- const value = execFileSync2("git", ["config", "--local", "--get", key], {
1576
+ const value = execFileSync3("git", ["config", "--local", "--get", key], {
1573
1577
  cwd,
1574
1578
  encoding: "utf-8",
1575
1579
  stdio: ["ignore", "pipe", "ignore"],
@@ -22725,7 +22725,7 @@ function readRun(id2) {
22725
22725
  "cleanup",
22726
22726
  "completed",
22727
22727
  "skipped"
22728
- ].includes(run.stage) || run.needsStatus !== void 0 && typeof run.needsStatus !== "boolean" || run.server !== void 0 && !isDemoStatusResponse(run.server) || run.receipt !== void 0 && (!Number.isSafeInteger(run.receipt.revision) || run.receipt.revision < 0 || !/^[a-f0-9]{64}$/u.test(run.receipt.appliedDigest)) || typeof run.terminal !== "boolean" || !Array.isArray(run.launcher) || run.launcher.length !== 2 || run.launcher.some((value) => typeof value !== "string" || !value.startsWith("/")) || run.agent !== void 0 && !["claude_code", "codex", "cursor", "hermes"].includes(run.agent)) {
22728
+ ].includes(run.stage) || run.needsStatus !== void 0 && typeof run.needsStatus !== "boolean" || run.server !== void 0 && !isDemoStatusResponse(run.server) || run.receipt !== void 0 && (!Number.isSafeInteger(run.receipt.revision) || run.receipt.revision < 0 || !/^[a-f0-9]{64}$/u.test(run.receipt.appliedDigest)) || typeof run.terminal !== "boolean" || !Array.isArray(run.launcher) || run.launcher.length !== 2 || run.launcher.some((value) => typeof value !== "string" || !value.startsWith("/")) || run.agent !== void 0 && !["claude_code", "codex", "cursor", "hermes"].includes(run.agent) || run.welcomeRepo !== void 0 && (typeof run.welcomeRepo !== "string" || !run.welcomeRepo.startsWith("/"))) {
22729
22729
  throw new Error("invalid demo run state");
22730
22730
  }
22731
22731
  return run;
@@ -22873,13 +22873,17 @@ function observeDemoInvocation(envelope, agent2, checkExclusion = true) {
22873
22873
  }
22874
22874
 
22875
22875
  // src/lib/activation.ts
22876
- import { execFileSync as execFileSync2 } from "child_process";
22876
+ import { execFileSync as execFileSync3 } from "child_process";
22877
22877
  import { existsSync as existsSync7, readFileSync as readFileSync5 } from "fs";
22878
22878
  import { homedir as homedir2 } from "os";
22879
22879
  import { join as join7 } from "path";
22880
22880
 
22881
- // src/lib/git.ts
22881
+ // src/lib/demo-pause.ts
22882
22882
  import { execFileSync } from "child_process";
22883
+ var DEMO_PAUSE_MS = 30 * 6e4;
22884
+
22885
+ // src/lib/git.ts
22886
+ import { execFileSync as execFileSync2 } from "child_process";
22883
22887
  import { createHash as createHash3 } from "crypto";
22884
22888
  import { lstatSync as lstatSync3, realpathSync as realpathSync2 } from "fs";
22885
22889
  import { basename, dirname as dirname5, isAbsolute as isAbsolute4, relative, resolve as resolve3, sep } from "path";
@@ -22888,7 +22892,7 @@ var GITHUB_OWNER_PATTERN = /^(?![A-Za-z0-9-]*--)[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}
22888
22892
  var GITHUB_REPOSITORY_PATTERN = /^[A-Za-z0-9._-]{1,100}$/u;
22889
22893
  function gitToplevel(cwd) {
22890
22894
  try {
22891
- return execFileSync("git", ["rev-parse", "--show-toplevel"], {
22895
+ return execFileSync2("git", ["rev-parse", "--show-toplevel"], {
22892
22896
  cwd,
22893
22897
  encoding: "utf-8",
22894
22898
  stdio: ["ignore", "pipe", "ignore"],
@@ -22900,7 +22904,7 @@ function gitToplevel(cwd) {
22900
22904
  }
22901
22905
  function gitValue(cwd, args) {
22902
22906
  try {
22903
- const value = execFileSync("git", args, {
22907
+ const value = execFileSync2("git", args, {
22904
22908
  cwd,
22905
22909
  encoding: "utf-8",
22906
22910
  stdio: ["ignore", "pipe", "ignore"],
@@ -23074,7 +23078,7 @@ var GIT_TIMEOUT_MS2 = 1e3;
23074
23078
  var REPO_SYNC_ID_RE = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
23075
23079
  function repoActiveFlag(cwd, strict = false) {
23076
23080
  try {
23077
- const value = execFileSync2("git", ["config", "--get", PRIM_ACTIVE_KEY], {
23081
+ const value = execFileSync3("git", ["config", "--get", PRIM_ACTIVE_KEY], {
23078
23082
  cwd,
23079
23083
  encoding: "utf-8",
23080
23084
  stdio: ["ignore", "pipe", "ignore"],
@@ -23095,7 +23099,7 @@ function isValidRepoSyncId(value) {
23095
23099
  }
23096
23100
  function localGitConfigValue(cwd, key) {
23097
23101
  try {
23098
- const value = execFileSync2("git", ["config", "--local", "--get", key], {
23102
+ const value = execFileSync3("git", ["config", "--local", "--get", key], {
23099
23103
  cwd,
23100
23104
  encoding: "utf-8",
23101
23105
  stdio: ["ignore", "pipe", "ignore"],
@@ -24582,7 +24586,7 @@ import { homedir as homedir4 } from "os";
24582
24586
  import { isAbsolute as isAbsolute5, join as join13 } from "path";
24583
24587
 
24584
24588
  // src/lib/preflight-host.ts
24585
- import { execFileSync as execFileSync3 } from "child_process";
24589
+ import { execFileSync as execFileSync4 } from "child_process";
24586
24590
 
24587
24591
  // src/commands/claude-install.ts
24588
24592
  import { existsSync as existsSync10, readFileSync as readFileSync10 } from "fs";
@@ -23935,7 +23935,7 @@ function readRun(id2) {
23935
23935
  "cleanup",
23936
23936
  "completed",
23937
23937
  "skipped"
23938
- ].includes(run.stage) || run.needsStatus !== void 0 && typeof run.needsStatus !== "boolean" || run.server !== void 0 && !isDemoStatusResponse(run.server) || run.receipt !== void 0 && (!Number.isSafeInteger(run.receipt.revision) || run.receipt.revision < 0 || !/^[a-f0-9]{64}$/u.test(run.receipt.appliedDigest)) || typeof run.terminal !== "boolean" || !Array.isArray(run.launcher) || run.launcher.length !== 2 || run.launcher.some((value) => typeof value !== "string" || !value.startsWith("/")) || run.agent !== void 0 && !["claude_code", "codex", "cursor", "hermes"].includes(run.agent)) {
23938
+ ].includes(run.stage) || run.needsStatus !== void 0 && typeof run.needsStatus !== "boolean" || run.server !== void 0 && !isDemoStatusResponse(run.server) || run.receipt !== void 0 && (!Number.isSafeInteger(run.receipt.revision) || run.receipt.revision < 0 || !/^[a-f0-9]{64}$/u.test(run.receipt.appliedDigest)) || typeof run.terminal !== "boolean" || !Array.isArray(run.launcher) || run.launcher.length !== 2 || run.launcher.some((value) => typeof value !== "string" || !value.startsWith("/")) || run.agent !== void 0 && !["claude_code", "codex", "cursor", "hermes"].includes(run.agent) || run.welcomeRepo !== void 0 && (typeof run.welcomeRepo !== "string" || !run.welcomeRepo.startsWith("/"))) {
23939
23939
  throw new Error("invalid demo run state");
23940
23940
  }
23941
23941
  return run;
@@ -24148,26 +24148,87 @@ function appendMove(move, orgId) {
24148
24148
  var FLUSHING_PREFIX = `${JOURNAL_BASENAME}.flushing.`;
24149
24149
 
24150
24150
  // src/lib/activation.ts
24151
- import { execFileSync as execFileSync2 } from "child_process";
24151
+ import { execFileSync as execFileSync3 } from "child_process";
24152
24152
  import { existsSync as existsSync11, readFileSync as readFileSync11 } from "fs";
24153
24153
  import { homedir as homedir2 } from "os";
24154
24154
  import { join as join13 } from "path";
24155
24155
 
24156
- // src/lib/git.ts
24156
+ // src/lib/demo-pause.ts
24157
24157
  import { execFileSync } from "child_process";
24158
+ var DEMO_PAUSE_MS = 30 * 6e4;
24159
+ var PAUSE_KEY = "prim.demoPause";
24160
+ var GIT_TIMEOUT_MS = 1e3;
24161
+ function git(cwd, args) {
24162
+ try {
24163
+ return execFileSync("git", args, {
24164
+ cwd,
24165
+ encoding: "utf-8",
24166
+ stdio: ["ignore", "pipe", "ignore"],
24167
+ timeout: GIT_TIMEOUT_MS
24168
+ });
24169
+ } catch {
24170
+ return void 0;
24171
+ }
24172
+ }
24173
+ function setLocal(cwd, key, value) {
24174
+ try {
24175
+ execFileSync(
24176
+ "git",
24177
+ value === null ? ["config", "--local", "--unset", key] : ["config", "--local", key, value],
24178
+ { cwd, stdio: ["ignore", "ignore", "pipe"], timeout: GIT_TIMEOUT_MS }
24179
+ );
24180
+ } catch (error) {
24181
+ if (value !== null || error.status !== 5) throw error;
24182
+ }
24183
+ }
24184
+ function parsePause(value) {
24185
+ const [runId = "", until, previous, state] = value.trim().split(" ");
24186
+ const flag = previous === "true" || previous === "false" ? previous : "unset";
24187
+ return { runId, until: Number(until) || 0, previous: flag, ending: state !== "active" };
24188
+ }
24189
+ function readCaptureConfig(cwd) {
24190
+ let active;
24191
+ let pause;
24192
+ const out = git(cwd, ["config", "--get-regexp", "^prim\\.(active|demopause)$"]) ?? "";
24193
+ for (const line of out.split("\n")) {
24194
+ const space3 = line.indexOf(" ");
24195
+ const key = line.slice(0, space3).toLowerCase();
24196
+ const value = line.slice(space3 + 1);
24197
+ if (key === "prim.active") active = value === "true" || value === "false" ? value : void 0;
24198
+ if (key === "prim.demopause") pause = parsePause(value);
24199
+ }
24200
+ return { active, pause };
24201
+ }
24202
+ function resumeCapture(cwd, pause) {
24203
+ setLocal(cwd, "prim.active", pause.previous === "unset" ? null : pause.previous);
24204
+ setLocal(cwd, PAUSE_KEY, null);
24205
+ }
24206
+ function healDemoPause(cwd, pause, options = {}) {
24207
+ if (pause.until > (options.now ?? Date.now()) && !(pause.ending && options.userPrompt))
24208
+ return false;
24209
+ try {
24210
+ resumeCapture(cwd, pause);
24211
+ return true;
24212
+ } catch {
24213
+ return false;
24214
+ }
24215
+ }
24216
+
24217
+ // src/lib/git.ts
24218
+ import { execFileSync as execFileSync2 } from "child_process";
24158
24219
  import { createHash as createHash5 } from "crypto";
24159
24220
  import { lstatSync as lstatSync4, realpathSync as realpathSync2 } from "fs";
24160
24221
  import { basename as basename2, dirname as dirname9, isAbsolute as isAbsolute4, relative, resolve as resolve4, sep } from "path";
24161
- var GIT_TIMEOUT_MS = 1e3;
24222
+ var GIT_TIMEOUT_MS2 = 1e3;
24162
24223
  var GITHUB_OWNER_PATTERN = /^(?![A-Za-z0-9-]*--)[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/u;
24163
24224
  var GITHUB_REPOSITORY_PATTERN = /^[A-Za-z0-9._-]{1,100}$/u;
24164
24225
  function gitToplevel(cwd) {
24165
24226
  try {
24166
- return execFileSync("git", ["rev-parse", "--show-toplevel"], {
24227
+ return execFileSync2("git", ["rev-parse", "--show-toplevel"], {
24167
24228
  cwd,
24168
24229
  encoding: "utf-8",
24169
24230
  stdio: ["ignore", "pipe", "ignore"],
24170
- timeout: GIT_TIMEOUT_MS
24231
+ timeout: GIT_TIMEOUT_MS2
24171
24232
  }).trim();
24172
24233
  } catch {
24173
24234
  return null;
@@ -24175,11 +24236,11 @@ function gitToplevel(cwd) {
24175
24236
  }
24176
24237
  function gitValue(cwd, args) {
24177
24238
  try {
24178
- const value = execFileSync("git", args, {
24239
+ const value = execFileSync2("git", args, {
24179
24240
  cwd,
24180
24241
  encoding: "utf-8",
24181
24242
  stdio: ["ignore", "pipe", "ignore"],
24182
- timeout: GIT_TIMEOUT_MS
24243
+ timeout: GIT_TIMEOUT_MS2
24183
24244
  }).trim();
24184
24245
  return value || void 0;
24185
24246
  } catch {
@@ -24371,17 +24432,17 @@ var PRIM_ACTIVE_KEY = "prim.active";
24371
24432
  var PRIM_REPO_SYNC_ID_KEY = "prim.repoSyncId";
24372
24433
  var PRIM_REPO_SYNC_REPOSITORY_KEY = "prim.repoSyncRepository";
24373
24434
  var PRIM_REPO_BINDING_STATE_KEY = "prim.repoBindingState";
24374
- var GIT_TIMEOUT_MS2 = 1e3;
24435
+ var GIT_TIMEOUT_MS3 = 1e3;
24375
24436
  var REPO_SYNC_ID_RE = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
24376
24437
  var PROJECT_INSTALL_FILES = [".claude/settings.json", ".codex/hooks.json", ".cursor/hooks.json"];
24377
24438
  var PRIM_HOOK_BINS = ["prim-hook", "prim-pre-tool-use", "prim-post-tool-use"];
24378
24439
  function repoActiveFlag(cwd, strict = false) {
24379
24440
  try {
24380
- const value = execFileSync2("git", ["config", "--get", PRIM_ACTIVE_KEY], {
24441
+ const value = execFileSync3("git", ["config", "--get", PRIM_ACTIVE_KEY], {
24381
24442
  cwd,
24382
24443
  encoding: "utf-8",
24383
24444
  stdio: ["ignore", "pipe", "ignore"],
24384
- timeout: GIT_TIMEOUT_MS2
24445
+ timeout: GIT_TIMEOUT_MS3
24385
24446
  }).trim();
24386
24447
  if (value === "true") return "true";
24387
24448
  if (value === "false") return "false";
@@ -24398,11 +24459,11 @@ function isValidRepoSyncId(value) {
24398
24459
  }
24399
24460
  function localGitConfigValue(cwd, key) {
24400
24461
  try {
24401
- const value = execFileSync2("git", ["config", "--local", "--get", key], {
24462
+ const value = execFileSync3("git", ["config", "--local", "--get", key], {
24402
24463
  cwd,
24403
24464
  encoding: "utf-8",
24404
24465
  stdio: ["ignore", "pipe", "ignore"],
24405
- timeout: GIT_TIMEOUT_MS2
24466
+ timeout: GIT_TIMEOUT_MS3
24406
24467
  }).trim();
24407
24468
  return value || void 0;
24408
24469
  } catch {
@@ -24439,8 +24500,9 @@ function hasProjectPrimInstall(cwd) {
24439
24500
  }
24440
24501
  return false;
24441
24502
  }
24442
- function isRepoActiveForCapture(cwd) {
24443
- const flag = repoActiveFlag(cwd);
24503
+ function isRepoActiveForCapture(cwd, options = {}) {
24504
+ let { active: flag, pause } = readCaptureConfig(cwd);
24505
+ if (pause && healDemoPause(cwd, pause, options)) flag = repoActiveFlag(cwd);
24444
24506
  if (flag === "true") return true;
24445
24507
  if (flag === "false") return false;
24446
24508
  return hasProjectPrimInstall(cwd);
@@ -24737,16 +24799,16 @@ function cachedCollectScopeAdmits(cwd, facts) {
24737
24799
  }
24738
24800
 
24739
24801
  // src/lib/commit-heartbeat.ts
24740
- import { execFileSync as execFileSync3 } from "child_process";
24802
+ import { execFileSync as execFileSync4 } from "child_process";
24741
24803
  import { mkdirSync as mkdirSync6, readFileSync as readFileSync12, readdirSync as readdirSync5, unlinkSync } from "fs";
24742
24804
  import { dirname as dirname10, join as join14, resolve as resolve5 } from "path";
24743
- var GIT_TIMEOUT_MS3 = 1e3;
24805
+ var GIT_TIMEOUT_MS4 = 1e3;
24744
24806
  function gitPath(cwd, relative3) {
24745
- const value = execFileSync3("git", ["rev-parse", "--git-path", relative3], {
24807
+ const value = execFileSync4("git", ["rev-parse", "--git-path", relative3], {
24746
24808
  cwd,
24747
24809
  encoding: "utf8",
24748
24810
  stdio: ["ignore", "pipe", "ignore"],
24749
- timeout: GIT_TIMEOUT_MS3
24811
+ timeout: GIT_TIMEOUT_MS4
24750
24812
  }).replace(/\r?\n$/u, "");
24751
24813
  if (value === "" || /[\0\r\n]/u.test(value)) throw new Error("Git returned an unsafe path");
24752
24814
  return resolve5(cwd, value);
@@ -24774,7 +24836,7 @@ function unattendedEnv(env = process.env) {
24774
24836
  }
24775
24837
 
24776
24838
  // src/lib/workspace-id.ts
24777
- import { execFileSync as execFileSync4 } from "child_process";
24839
+ import { execFileSync as execFileSync5 } from "child_process";
24778
24840
  import { randomUUID as randomUUID3 } from "crypto";
24779
24841
  import {
24780
24842
  constants as constants3,
@@ -24820,7 +24882,7 @@ function resolveWorkspaceIdPath(cwd) {
24820
24882
  if (fromFilesystem) return { status: "resolved", path: fromFilesystem };
24821
24883
  }
24822
24884
  try {
24823
- const output = execFileSync4(
24885
+ const output = execFileSync5(
24824
24886
  "git",
24825
24887
  ["rev-parse", "--is-inside-work-tree", "--git-path", WORKSPACE_ID_RELATIVE_PATH],
24826
24888
  {
@@ -25757,7 +25819,7 @@ import { homedir as homedir4 } from "os";
25757
25819
  import { isAbsolute as isAbsolute6, join as join19 } from "path";
25758
25820
 
25759
25821
  // src/lib/preflight-host.ts
25760
- import { execFileSync as execFileSync5 } from "child_process";
25822
+ import { execFileSync as execFileSync6 } from "child_process";
25761
25823
 
25762
25824
  // src/commands/claude-install.ts
25763
25825
  import { existsSync as existsSync13, readFileSync as readFileSync15 } from "fs";
@@ -36115,7 +36177,7 @@ async function main() {
36115
36177
  const cwd = parsed.cwd ?? process.cwd();
36116
36178
  const isClaudeStop = agent === "claude_code" && parsed.hook_event_name === "Stop";
36117
36179
  const isCodexContextEvent = agent === "codex" && (parsed.hook_event_name === "UserPromptSubmit" || parsed.hook_event_name === "Stop");
36118
- if (!isRepoActiveForCapture(cwd)) {
36180
+ if (!isRepoActiveForCapture(cwd, { userPrompt: parsed.hook_event_name === "UserPromptSubmit" })) {
36119
36181
  if (isClaudeStop || isCodexContextEvent || agent === "cursor") {
36120
36182
  await emitOutput(cursorPassiveOutput());
36121
36183
  }
@@ -389,26 +389,87 @@ function daemonRequest(method, params = {}, opts = {}) {
389
389
  }
390
390
 
391
391
  // src/lib/activation.ts
392
- import { execFileSync as execFileSync2 } from "child_process";
392
+ import { execFileSync as execFileSync3 } from "child_process";
393
393
  import { existsSync, readFileSync as readFileSync2 } from "fs";
394
394
  import { homedir as homedir2 } from "os";
395
395
  import { join as join4 } from "path";
396
396
 
397
- // src/lib/git.ts
397
+ // src/lib/demo-pause.ts
398
398
  import { execFileSync } from "child_process";
399
+ var DEMO_PAUSE_MS = 30 * 6e4;
400
+ var PAUSE_KEY = "prim.demoPause";
401
+ var GIT_TIMEOUT_MS = 1e3;
402
+ function git(cwd, args) {
403
+ try {
404
+ return execFileSync("git", args, {
405
+ cwd,
406
+ encoding: "utf-8",
407
+ stdio: ["ignore", "pipe", "ignore"],
408
+ timeout: GIT_TIMEOUT_MS
409
+ });
410
+ } catch {
411
+ return void 0;
412
+ }
413
+ }
414
+ function setLocal(cwd, key, value) {
415
+ try {
416
+ execFileSync(
417
+ "git",
418
+ value === null ? ["config", "--local", "--unset", key] : ["config", "--local", key, value],
419
+ { cwd, stdio: ["ignore", "ignore", "pipe"], timeout: GIT_TIMEOUT_MS }
420
+ );
421
+ } catch (error) {
422
+ if (value !== null || error.status !== 5) throw error;
423
+ }
424
+ }
425
+ function parsePause(value) {
426
+ const [runId = "", until, previous, state] = value.trim().split(" ");
427
+ const flag = previous === "true" || previous === "false" ? previous : "unset";
428
+ return { runId, until: Number(until) || 0, previous: flag, ending: state !== "active" };
429
+ }
430
+ function readCaptureConfig(cwd) {
431
+ let active;
432
+ let pause;
433
+ const out = git(cwd, ["config", "--get-regexp", "^prim\\.(active|demopause)$"]) ?? "";
434
+ for (const line of out.split("\n")) {
435
+ const space = line.indexOf(" ");
436
+ const key = line.slice(0, space).toLowerCase();
437
+ const value = line.slice(space + 1);
438
+ if (key === "prim.active") active = value === "true" || value === "false" ? value : void 0;
439
+ if (key === "prim.demopause") pause = parsePause(value);
440
+ }
441
+ return { active, pause };
442
+ }
443
+ function resumeCapture(cwd, pause) {
444
+ setLocal(cwd, "prim.active", pause.previous === "unset" ? null : pause.previous);
445
+ setLocal(cwd, PAUSE_KEY, null);
446
+ }
447
+ function healDemoPause(cwd, pause, options = {}) {
448
+ if (pause.until > (options.now ?? Date.now()) && !(pause.ending && options.userPrompt))
449
+ return false;
450
+ try {
451
+ resumeCapture(cwd, pause);
452
+ return true;
453
+ } catch {
454
+ return false;
455
+ }
456
+ }
457
+
458
+ // src/lib/git.ts
459
+ import { execFileSync as execFileSync2 } from "child_process";
399
460
  import { createHash as createHash3 } from "crypto";
400
461
  import { lstatSync, realpathSync } from "fs";
401
462
  import { basename, dirname, isAbsolute as isAbsolute2, relative, resolve, sep } from "path";
402
- var GIT_TIMEOUT_MS = 1e3;
463
+ var GIT_TIMEOUT_MS2 = 1e3;
403
464
  var GITHUB_OWNER_PATTERN = /^(?![A-Za-z0-9-]*--)[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/u;
404
465
  var GITHUB_REPOSITORY_PATTERN = /^[A-Za-z0-9._-]{1,100}$/u;
405
466
  function gitToplevel(cwd) {
406
467
  try {
407
- return execFileSync("git", ["rev-parse", "--show-toplevel"], {
468
+ return execFileSync2("git", ["rev-parse", "--show-toplevel"], {
408
469
  cwd,
409
470
  encoding: "utf-8",
410
471
  stdio: ["ignore", "pipe", "ignore"],
411
- timeout: GIT_TIMEOUT_MS
472
+ timeout: GIT_TIMEOUT_MS2
412
473
  }).trim();
413
474
  } catch {
414
475
  return null;
@@ -416,11 +477,11 @@ function gitToplevel(cwd) {
416
477
  }
417
478
  function gitValue(cwd, args) {
418
479
  try {
419
- const value = execFileSync("git", args, {
480
+ const value = execFileSync2("git", args, {
420
481
  cwd,
421
482
  encoding: "utf-8",
422
483
  stdio: ["ignore", "pipe", "ignore"],
423
- timeout: GIT_TIMEOUT_MS
484
+ timeout: GIT_TIMEOUT_MS2
424
485
  }).trim();
425
486
  return value || void 0;
426
487
  } catch {
@@ -499,16 +560,16 @@ function resolveRepositoryContext(cwd = process.cwd()) {
499
560
 
500
561
  // src/lib/activation.ts
501
562
  var PRIM_ACTIVE_KEY = "prim.active";
502
- var GIT_TIMEOUT_MS2 = 1e3;
563
+ var GIT_TIMEOUT_MS3 = 1e3;
503
564
  var PROJECT_INSTALL_FILES = [".claude/settings.json", ".codex/hooks.json", ".cursor/hooks.json"];
504
565
  var PRIM_HOOK_BINS = ["prim-hook", "prim-pre-tool-use", "prim-post-tool-use"];
505
566
  function repoActiveFlag(cwd, strict = false) {
506
567
  try {
507
- const value = execFileSync2("git", ["config", "--get", PRIM_ACTIVE_KEY], {
568
+ const value = execFileSync3("git", ["config", "--get", PRIM_ACTIVE_KEY], {
508
569
  cwd,
509
570
  encoding: "utf-8",
510
571
  stdio: ["ignore", "pipe", "ignore"],
511
- timeout: GIT_TIMEOUT_MS2
572
+ timeout: GIT_TIMEOUT_MS3
512
573
  }).trim();
513
574
  if (value === "true") return "true";
514
575
  if (value === "false") return "false";
@@ -535,8 +596,9 @@ function hasProjectPrimInstall(cwd) {
535
596
  }
536
597
  return false;
537
598
  }
538
- function isRepoActiveForCapture(cwd) {
539
- const flag = repoActiveFlag(cwd);
599
+ function isRepoActiveForCapture(cwd, options = {}) {
600
+ let { active: flag, pause } = readCaptureConfig(cwd);
601
+ if (pause && healDemoPause(cwd, pause, options)) flag = repoActiveFlag(cwd);
540
602
  if (flag === "true") return true;
541
603
  if (flag === "false") return false;
542
604
  return hasProjectPrimInstall(cwd);
@@ -730,7 +792,7 @@ exec "$prim_node" "$prim_entry" "$@"
730
792
  `;
731
793
 
732
794
  // src/lib/preflight-host.ts
733
- import { execFileSync as execFileSync3 } from "child_process";
795
+ import { execFileSync as execFileSync4 } from "child_process";
734
796
 
735
797
  // src/commands/claude-install.ts
736
798
  import { existsSync as existsSync5, readFileSync as readFileSync6 } from "fs";