@vectorize-io/hindsight-coding-agents 0.2.1 → 0.3.0

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.
package/dist/installer.js CHANGED
@@ -5,13 +5,13 @@ import { execFileSync as execFileSync6 } from "child_process";
5
5
  import {
6
6
  copyFileSync,
7
7
  cpSync as cpSync2,
8
- existsSync as existsSync8,
8
+ existsSync as existsSync9,
9
9
  mkdirSync as mkdirSync3,
10
10
  mkdtempSync,
11
11
  readFileSync as readFileSync10,
12
12
  readSync as readSync4,
13
13
  realpathSync,
14
- rmSync,
14
+ rmSync as rmSync2,
15
15
  writeFileSync as writeFileSync2
16
16
  } from "fs";
17
17
  import { homedir as homedir9, tmpdir as tmpdir3 } from "os";
@@ -20,10 +20,11 @@ import { dirname as dirname8, join as join13 } from "path";
20
20
  import { fileURLToPath as fileURLToPath5, pathToFileURL } from "url";
21
21
 
22
22
  // src/core/hook.ts
23
- import { existsSync, readFileSync as readFileSync3 } from "fs";
23
+ import { existsSync as existsSync2, readFileSync as readFileSync3 } from "fs";
24
24
 
25
25
  // src/core/bank.ts
26
26
  import { execFileSync } from "child_process";
27
+ import { existsSync } from "fs";
27
28
  import { homedir } from "os";
28
29
  import { basename, dirname, join, normalize, sep } from "path";
29
30
 
@@ -86,6 +87,10 @@ function diag(harness, event, extra = {}) {
86
87
  }
87
88
  }
88
89
 
90
+ // src/core/hindsight.ts
91
+ var RETRY_AFTER_FLOOR_MS = 10 * 1e3;
92
+ var RETRY_AFTER_CEILING_MS = 60 * 1e3;
93
+
89
94
  // src/core/brand.ts
90
95
  function brandWord() {
91
96
  const start = [0, 116, 217];
@@ -101,7 +106,7 @@ function brandWord() {
101
106
  }
102
107
 
103
108
  // src/core/session-cache.ts
104
- import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
109
+ import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync, rmSync, writeFileSync } from "fs";
105
110
  import { tmpdir as tmpdir2 } from "os";
106
111
  import { dirname as dirname4, join as join5 } from "path";
107
112
 
@@ -330,13 +335,13 @@ import { execFileSync as execFileSync4 } from "child_process";
330
335
 
331
336
  // src/core/survey.ts
332
337
  import { spawn as realSpawn3 } from "child_process";
333
- import { accessSync, constants, existsSync as existsSync2 } from "fs";
338
+ import { accessSync, constants, existsSync as existsSync3 } from "fs";
334
339
  import { homedir as homedir3 } from "os";
335
340
  import { delimiter, dirname as dirname6, join as join7 } from "path";
336
341
  import { fileURLToPath as fileURLToPath3 } from "url";
337
342
 
338
343
  // src/core/skill-sync.ts
339
- import { cpSync, existsSync as existsSync3, readFileSync as readFileSync5 } from "fs";
344
+ import { cpSync, existsSync as existsSync4, readFileSync as readFileSync5 } from "fs";
340
345
  import { homedir as homedir4 } from "os";
341
346
  import { dirname as dirname7, join as join8 } from "path";
342
347
  import { fileURLToPath as fileURLToPath4 } from "url";
@@ -471,14 +476,14 @@ function readCopilotTranscript(path) {
471
476
  }
472
477
 
473
478
  // src/core/transcript-grok.ts
474
- import { existsSync as existsSync4, readFileSync as readFileSync7, readdirSync } from "fs";
479
+ import { existsSync as existsSync5, readFileSync as readFileSync7, readdirSync } from "fs";
475
480
  import { homedir as homedir5 } from "os";
476
481
  import { join as join9 } from "path";
477
482
  var CHAT_HISTORY = "chat_history.jsonl";
478
483
  function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME || join9(homedir5(), ".grok")) {
479
484
  const sessionsDir = join9(grokHome, "sessions");
480
485
  const direct = join9(sessionsDir, encodeURIComponent(cwd), sessionId, CHAT_HISTORY);
481
- if (existsSync4(direct)) return direct;
486
+ if (existsSync5(direct)) return direct;
482
487
  try {
483
488
  for (const candidate of readdirSync(sessionsDir)) {
484
489
  const directory = join9(sessionsDir, candidate);
@@ -518,7 +523,7 @@ function readGrokTranscript(path) {
518
523
  }
519
524
 
520
525
  // src/core/transcript-devin.ts
521
- import { existsSync as existsSync5 } from "fs";
526
+ import { existsSync as existsSync6 } from "fs";
522
527
  import { createRequire } from "module";
523
528
  import { homedir as homedir6 } from "os";
524
529
  import { join as join10 } from "path";
@@ -560,7 +565,7 @@ function readDevinTranscript(sessionId, dbPath = devinSessionDb()) {
560
565
  diag("devin-cli", "sqlite_unavailable", { node: process.version, dbPath });
561
566
  return [];
562
567
  }
563
- if (!existsSync5(dbPath)) {
568
+ if (!existsSync6(dbPath)) {
564
569
  diag("devin-cli", "session_db_missing", { dbPath });
565
570
  return [];
566
571
  }
@@ -868,7 +873,7 @@ var HOOK_HARNESSES = {
868
873
  // src/core/history.ts
869
874
  import {
870
875
  closeSync as closeSync2,
871
- existsSync as existsSync6,
876
+ existsSync as existsSync7,
872
877
  openSync as openSync2,
873
878
  readdirSync as readdirSync2,
874
879
  readFileSync as readFileSync8,
@@ -920,14 +925,14 @@ function firstLine(path, cap = 1e6) {
920
925
  }
921
926
  }
922
927
  function jsonlFiles(dir) {
923
- if (!existsSync6(dir)) return [];
928
+ if (!existsSync7(dir)) return [];
924
929
  return readdirSync2(dir).filter((f) => f.endsWith(".jsonl")).map((f) => join11(dir, f));
925
930
  }
926
931
  function claudeHistory(repoDir, home) {
927
932
  const root = join11(home, ".claude", "projects");
928
933
  const exact = claudeProjectDir(repoDir, home);
929
934
  const prefix = exact + "-";
930
- const dirs = existsSync6(root) ? readdirSync2(root).map((d) => join11(root, d)).filter((d) => d === exact || d.startsWith(prefix)) : [];
935
+ const dirs = existsSync7(root) ? readdirSync2(root).map((d) => join11(root, d)).filter((d) => d === exact || d.startsWith(prefix)) : [];
931
936
  const sessions = [];
932
937
  let unattributed = 0;
933
938
  for (const file of dirs.flatMap(jsonlFiles)) {
@@ -948,7 +953,7 @@ function claudeHistory(repoDir, home) {
948
953
  }
949
954
  function codexHistory(repoDir, home) {
950
955
  const root = join11(home, ".codex", "sessions");
951
- if (!existsSync6(root)) return { supported: true, sessions: [] };
956
+ if (!existsSync7(root)) return { supported: true, sessions: [] };
952
957
  const files = [];
953
958
  const walk = (dir) => {
954
959
  for (const entry of readdirSync2(dir)) {
@@ -996,7 +1001,7 @@ function importLocalHistory(harness, repoDir, home = homedir7()) {
996
1001
  }
997
1002
 
998
1003
  // src/core/legacy.ts
999
- import { existsSync as existsSync7, readFileSync as readFileSync9 } from "fs";
1004
+ import { existsSync as existsSync8, readFileSync as readFileSync9 } from "fs";
1000
1005
  import { homedir as homedir8 } from "os";
1001
1006
  import { join as join12 } from "path";
1002
1007
  var LEGACY_CONFIG_FILES = {
@@ -1019,7 +1024,7 @@ function readLegacyEndpoint(home = homedir8(), prefer = []) {
1019
1024
  }
1020
1025
  function readOne(harness, home) {
1021
1026
  const source = legacyConfigPath(harness, home);
1022
- if (!existsSync7(source)) return void 0;
1027
+ if (!existsSync8(source)) return void 0;
1023
1028
  let raw;
1024
1029
  try {
1025
1030
  raw = JSON.parse(readFileSync9(source, "utf8"));
@@ -1266,7 +1271,7 @@ function parseJsonc(text) {
1266
1271
  }
1267
1272
  function writeJson(path, value) {
1268
1273
  mkdirSync3(dirname8(path), { recursive: true });
1269
- if (existsSync8(path) && !existsSync8(`${path}.hindsight-backup`)) {
1274
+ if (existsSync9(path) && !existsSync9(`${path}.hindsight-backup`)) {
1270
1275
  copyFileSync(path, `${path}.hindsight-backup`);
1271
1276
  }
1272
1277
  writeFileSync2(path, JSON.stringify(value, null, 2) + "\n");
@@ -1308,14 +1313,14 @@ function stripHarnessHooks(hooks, harness) {
1308
1313
  }
1309
1314
  function installSkill(c, harness, skillsBase) {
1310
1315
  const src = join13(c.pkgRoot, "skill");
1311
- if (!existsSync8(join13(src, "SKILL.md"))) return;
1316
+ if (!existsSync9(join13(src, "SKILL.md"))) return;
1312
1317
  const dst = join13(skillsBase, "hindsight-coding-agent");
1313
1318
  mkdirSync3(skillsBase, { recursive: true });
1314
1319
  cpSync2(src, dst, { recursive: true });
1315
1320
  c.log?.(`${harness}: skill installed at ${dst}`);
1316
1321
  }
1317
1322
  function uninstallSkill(c, skillsBase) {
1318
- rmSync(join13(skillsBase, "hindsight-coding-agent"), { recursive: true, force: true });
1323
+ rmSync2(join13(skillsBase, "hindsight-coding-agent"), { recursive: true, force: true });
1319
1324
  }
1320
1325
  function onPath2(bin) {
1321
1326
  try {
@@ -1335,7 +1340,7 @@ function runClinePlugin(args) {
1335
1340
  }
1336
1341
  var opencode = {
1337
1342
  name: "opencode",
1338
- detect: (c) => onPath2("opencode") || existsSync8(join13(c.home, ".config", "opencode")),
1343
+ detect: (c) => onPath2("opencode") || existsSync9(join13(c.home, ".config", "opencode")),
1339
1344
  install(c) {
1340
1345
  const path = join13(c.home, ".config", "opencode", "opencode.json");
1341
1346
  const cfg = readJson(path);
@@ -1346,7 +1351,7 @@ var opencode = {
1346
1351
  },
1347
1352
  uninstall(c) {
1348
1353
  const path = join13(c.home, ".config", "opencode", "opencode.json");
1349
- if (!existsSync8(path)) return;
1354
+ if (!existsSync9(path)) return;
1350
1355
  const cfg = readJson(path);
1351
1356
  if (Array.isArray(cfg.plugin)) {
1352
1357
  cfg.plugin = cfg.plugin.filter((p) => !String(p).includes(MARKER));
@@ -1356,19 +1361,43 @@ var opencode = {
1356
1361
  c.log?.("opencode: plugin entry removed");
1357
1362
  }
1358
1363
  };
1364
+ var primeAgent = {
1365
+ name: "prime-agent",
1366
+ detect: (c) => onPath2("prime-agent") || existsSync9(join13(c.home, ".prime", "agent")),
1367
+ install(c) {
1368
+ const path = join13(c.home, ".prime", "agent", "settings.json");
1369
+ const cfg = readJson(path);
1370
+ const entry = join13(c.pkgRoot, "dist", "prime-agent.js");
1371
+ const exts = Array.isArray(cfg.extensions) ? cfg.extensions : [];
1372
+ cfg.extensions = [...exts.filter((p) => !String(p).includes(MARKER)), entry];
1373
+ writeJson(path, cfg);
1374
+ c.log?.(`prime-agent: extension registered in ${path}`);
1375
+ },
1376
+ uninstall(c) {
1377
+ const path = join13(c.home, ".prime", "agent", "settings.json");
1378
+ if (!existsSync9(path)) return;
1379
+ const cfg = readJson(path);
1380
+ if (Array.isArray(cfg.extensions)) {
1381
+ cfg.extensions = cfg.extensions.filter((p) => !String(p).includes(MARKER));
1382
+ if (!cfg.extensions.length) delete cfg.extensions;
1383
+ writeJson(path, cfg);
1384
+ }
1385
+ c.log?.("prime-agent: extension entry removed");
1386
+ }
1387
+ };
1359
1388
  var KILO_CONFIG_CANDIDATES = ["kilo.jsonc", "kilo.json", "opencode.json"];
1360
1389
  function kiloConfigPath(c) {
1361
1390
  const dir = join13(c.home, ".config", "kilo");
1362
- const existing = KILO_CONFIG_CANDIDATES.map((f) => join13(dir, f)).find((p) => existsSync8(p));
1391
+ const existing = KILO_CONFIG_CANDIDATES.map((f) => join13(dir, f)).find((p) => existsSync9(p));
1363
1392
  return existing ?? join13(dir, "kilo.json");
1364
1393
  }
1365
1394
  var kilo = {
1366
1395
  name: "kilo",
1367
- detect: (c) => onPath2("kilo") || existsSync8(join13(c.home, ".config", "kilo")),
1396
+ detect: (c) => onPath2("kilo") || existsSync9(join13(c.home, ".config", "kilo")),
1368
1397
  install(c) {
1369
1398
  const path = kiloConfigPath(c);
1370
1399
  let cfg = {};
1371
- if (existsSync8(path)) {
1400
+ if (existsSync9(path)) {
1372
1401
  const parsed = parseJsonc(readFileSync10(path, "utf8"));
1373
1402
  if (!parsed) {
1374
1403
  c.log?.(`kilo: SKIPPED \u2014 could not parse ${path}; add the plugin entry manually`);
@@ -1384,7 +1413,7 @@ var kilo = {
1384
1413
  },
1385
1414
  uninstall(c) {
1386
1415
  const path = kiloConfigPath(c);
1387
- if (!existsSync8(path)) return;
1416
+ if (!existsSync9(path)) return;
1388
1417
  const cfg = parseJsonc(readFileSync10(path, "utf8"));
1389
1418
  if (!cfg || !Array.isArray(cfg.plugin)) return;
1390
1419
  cfg.plugin = cfg.plugin.filter((p) => !String(p).includes(MARKER));
@@ -1395,7 +1424,7 @@ var kilo = {
1395
1424
  };
1396
1425
  var claudeCode = {
1397
1426
  name: "claude-code",
1398
- detect: (c) => onPath2("claude") || existsSync8(join13(c.home, ".claude")),
1427
+ detect: (c) => onPath2("claude") || existsSync9(join13(c.home, ".claude")),
1399
1428
  install(c) {
1400
1429
  const path = join13(c.home, ".claude", "settings.json");
1401
1430
  const settings = readJson(path);
@@ -1426,7 +1455,7 @@ var claudeCode = {
1426
1455
  },
1427
1456
  uninstall(c) {
1428
1457
  const path = join13(c.home, ".claude", "settings.json");
1429
- if (existsSync8(path)) {
1458
+ if (existsSync9(path)) {
1430
1459
  const settings = readJson(path);
1431
1460
  if (settings.hooks) {
1432
1461
  stripHarnessHooks(settings.hooks, "claude-code");
@@ -1450,7 +1479,7 @@ function defaultClaudeMcp(args) {
1450
1479
  }
1451
1480
  var codex = {
1452
1481
  name: "codex",
1453
- detect: (c) => onPath2("codex") || existsSync8(join13(c.home, ".codex")),
1482
+ detect: (c) => onPath2("codex") || existsSync9(join13(c.home, ".codex")),
1454
1483
  install(c) {
1455
1484
  const hooksPath = join13(c.home, ".codex", "hooks.json");
1456
1485
  const cfg = readJson(hooksPath);
@@ -1459,7 +1488,7 @@ var codex = {
1459
1488
  writeJson(hooksPath, cfg);
1460
1489
  c.log?.(`codex: hooks merged into ${hooksPath}`);
1461
1490
  const tomlPath = join13(c.home, ".codex", "config.toml");
1462
- let toml = existsSync8(tomlPath) ? readFileSync10(tomlPath, "utf8") : "";
1491
+ let toml = existsSync9(tomlPath) ? readFileSync10(tomlPath, "utf8") : "";
1463
1492
  const additions = [];
1464
1493
  if (!/^\s*(codex_hooks|hooks)\s*=/m.test(toml)) {
1465
1494
  if (/^\[features\]/m.test(toml)) {
@@ -1478,7 +1507,7 @@ args = ["${join13(c.dist, "mcp-server.js")}"]`
1478
1507
  );
1479
1508
  }
1480
1509
  if (additions.length) {
1481
- if (existsSync8(tomlPath) && !existsSync8(`${tomlPath}.hindsight-backup`)) {
1510
+ if (existsSync9(tomlPath) && !existsSync9(`${tomlPath}.hindsight-backup`)) {
1482
1511
  copyFileSync(tomlPath, `${tomlPath}.hindsight-backup`);
1483
1512
  }
1484
1513
  mkdirSync3(dirname8(tomlPath), { recursive: true });
@@ -1490,7 +1519,7 @@ args = ["${join13(c.dist, "mcp-server.js")}"]`
1490
1519
  },
1491
1520
  uninstall(c) {
1492
1521
  const hooksPath = join13(c.home, ".codex", "hooks.json");
1493
- if (existsSync8(hooksPath)) {
1522
+ if (existsSync9(hooksPath)) {
1494
1523
  const cfg = readJson(hooksPath);
1495
1524
  if (cfg.hooks) {
1496
1525
  stripHarnessHooks(cfg.hooks, "codex");
@@ -1499,7 +1528,7 @@ args = ["${join13(c.dist, "mcp-server.js")}"]`
1499
1528
  }
1500
1529
  uninstallSkill(c, join13(c.home, ".agents", "skills"));
1501
1530
  const tomlPath = join13(c.home, ".codex", "config.toml");
1502
- if (existsSync8(tomlPath)) {
1531
+ if (existsSync9(tomlPath)) {
1503
1532
  const toml = readFileSync10(tomlPath, "utf8");
1504
1533
  const cleaned = toml.replace(
1505
1534
  /\n?\[mcp_servers\.hindsight\]\ncommand = "node"\nargs = \[[^\]]*\]\n?/g,
@@ -1566,7 +1595,7 @@ var antigravity = {
1566
1595
  },
1567
1596
  uninstall(c) {
1568
1597
  const hooksPath = join13(c.home, ".gemini", "config", "hooks.json");
1569
- if (existsSync8(hooksPath)) {
1598
+ if (existsSync9(hooksPath)) {
1570
1599
  const hooks = readJson(hooksPath);
1571
1600
  if (hooks[MARKER]) {
1572
1601
  stripHarnessHooks(hooks[MARKER], "antigravity-cli");
@@ -1578,7 +1607,7 @@ var antigravity = {
1578
1607
  writeJson(hooksPath, hooks);
1579
1608
  }
1580
1609
  const mcpPath = join13(c.home, ".gemini", "config", "mcp_config.json");
1581
- if (existsSync8(mcpPath)) {
1610
+ if (existsSync9(mcpPath)) {
1582
1611
  const mcp = readJson(mcpPath);
1583
1612
  if (mcp.mcpServers?.hindsight) {
1584
1613
  delete mcp.mcpServers.hindsight;
@@ -1586,7 +1615,7 @@ var antigravity = {
1586
1615
  }
1587
1616
  }
1588
1617
  const settingsPath = join13(c.home, ".gemini", "antigravity-cli", "settings.json");
1589
- if (existsSync8(settingsPath)) {
1618
+ if (existsSync9(settingsPath)) {
1590
1619
  const settings = readJson(settingsPath);
1591
1620
  if (JSON.stringify(settings.statusLine ?? {}).includes(MARKER)) {
1592
1621
  delete settings.statusLine;
@@ -1625,15 +1654,15 @@ function stageRuntime(c) {
1625
1654
  }
1626
1655
  };
1627
1656
  if (same(c.pkgRoot, target)) return c;
1628
- if (!existsSync8(join13(c.dist, "installer.js"))) return c;
1657
+ if (!existsSync9(join13(c.dist, "installer.js"))) return c;
1629
1658
  try {
1630
- rmSync(join13(target, "dist"), { recursive: true, force: true });
1659
+ rmSync2(join13(target, "dist"), { recursive: true, force: true });
1631
1660
  mkdirSync3(target, { recursive: true });
1632
1661
  cpSync2(c.dist, join13(target, "dist"), { recursive: true });
1633
1662
  const skill = join13(c.pkgRoot, "skill");
1634
- if (existsSync8(skill)) cpSync2(skill, join13(target, "skill"), { recursive: true });
1663
+ if (existsSync9(skill)) cpSync2(skill, join13(target, "skill"), { recursive: true });
1635
1664
  const pkgJson = join13(c.pkgRoot, "package.json");
1636
- if (existsSync8(pkgJson)) copyFileSync(pkgJson, join13(target, "package.json"));
1665
+ if (existsSync9(pkgJson)) copyFileSync(pkgJson, join13(target, "package.json"));
1637
1666
  c.log?.(`runtime staged at ${target}`);
1638
1667
  return { ...c, pkgRoot: target, dist: join13(target, "dist") };
1639
1668
  } catch (error) {
@@ -1809,7 +1838,7 @@ function reportDaemonPrereqs(c) {
1809
1838
  }
1810
1839
  var devin = {
1811
1840
  name: "devin-cli",
1812
- detect: (c) => onPath2("devin") || existsSync8(join13(c.home, ".config", "devin")),
1841
+ detect: (c) => onPath2("devin") || existsSync9(join13(c.home, ".config", "devin")),
1813
1842
  // Devin is the ONLY harness whose hooks never hand over a transcript: they carry a session id and
1814
1843
  // nothing else, so retain can only work by reading the CLI's own sessions.db. That makes SQLite
1815
1844
  // support a hard prerequisite here — and one worth checking now, because the alternative is an
@@ -1842,7 +1871,7 @@ var devin = {
1842
1871
  },
1843
1872
  uninstall(c) {
1844
1873
  const configPath = join13(c.home, ".config", "devin", "config.json");
1845
- if (existsSync8(configPath)) {
1874
+ if (existsSync9(configPath)) {
1846
1875
  const config = readJson(configPath);
1847
1876
  if (config.hooks) {
1848
1877
  stripHarnessHooks(config.hooks, "devin-cli");
@@ -1851,7 +1880,7 @@ var devin = {
1851
1880
  }
1852
1881
  }
1853
1882
  const mcpPath = join13(c.home, ".config", "devin", "mcp_config.json");
1854
- if (existsSync8(mcpPath)) {
1883
+ if (existsSync9(mcpPath)) {
1855
1884
  const mcp = readJson(mcpPath);
1856
1885
  if (mcp.mcpServers?.hindsight) {
1857
1886
  delete mcp.mcpServers.hindsight;
@@ -1863,7 +1892,7 @@ var devin = {
1863
1892
  };
1864
1893
  var cursor = {
1865
1894
  name: "cursor-cli",
1866
- detect: (c) => onPath2("cursor-agent") || existsSync8(join13(c.home, ".cursor")),
1895
+ detect: (c) => onPath2("cursor-agent") || existsSync9(join13(c.home, ".cursor")),
1867
1896
  install(c) {
1868
1897
  const hooksPath = join13(c.home, ".cursor", "hooks.json");
1869
1898
  const cfg = readJson(hooksPath);
@@ -1882,7 +1911,7 @@ var cursor = {
1882
1911
  },
1883
1912
  uninstall(c) {
1884
1913
  const hooksPath = join13(c.home, ".cursor", "hooks.json");
1885
- if (existsSync8(hooksPath)) {
1914
+ if (existsSync9(hooksPath)) {
1886
1915
  const cfg = readJson(hooksPath);
1887
1916
  if (cfg.hooks) {
1888
1917
  stripHarnessHooks(cfg.hooks, "cursor-cli");
@@ -1891,7 +1920,7 @@ var cursor = {
1891
1920
  }
1892
1921
  }
1893
1922
  const mcpPath = join13(c.home, ".cursor", "mcp.json");
1894
- if (existsSync8(mcpPath)) {
1923
+ if (existsSync9(mcpPath)) {
1895
1924
  const mcp = readJson(mcpPath);
1896
1925
  if (mcp.mcpServers?.hindsight) {
1897
1926
  delete mcp.mcpServers.hindsight;
@@ -1904,7 +1933,7 @@ var cursor = {
1904
1933
  };
1905
1934
  var copilot = {
1906
1935
  name: "copilot-cli",
1907
- detect: (c) => onPath2("copilot") || existsSync8(join13(c.home, ".copilot")),
1936
+ detect: (c) => onPath2("copilot") || existsSync9(join13(c.home, ".copilot")),
1908
1937
  install(c) {
1909
1938
  const hooksPath = join13(c.home, ".copilot", "hooks", "hindsight-coding-agents.json");
1910
1939
  const hooks = {};
@@ -1921,11 +1950,11 @@ var copilot = {
1921
1950
  c.log?.(`copilot-cli: hooks installed at ${hooksPath}, MCP into ${mcpPath}`);
1922
1951
  },
1923
1952
  uninstall(c) {
1924
- rmSync(join13(c.home, ".copilot", "hooks", "hindsight-coding-agents.json"), {
1953
+ rmSync2(join13(c.home, ".copilot", "hooks", "hindsight-coding-agents.json"), {
1925
1954
  force: true
1926
1955
  });
1927
1956
  const mcpPath = join13(c.home, ".copilot", "mcp-config.json");
1928
- if (existsSync8(mcpPath)) {
1957
+ if (existsSync9(mcpPath)) {
1929
1958
  const mcp = readJson(mcpPath);
1930
1959
  if (mcp.mcpServers?.hindsight) {
1931
1960
  delete mcp.mcpServers.hindsight;
@@ -1941,10 +1970,10 @@ var GROK_MARKER_END = "# HINDSIGHT_CODING_AGENTS_GROK_END";
1941
1970
  var GROK_BLOCK_RE = new RegExp(`\\n?${GROK_MARKER_START}[\\s\\S]*?${GROK_MARKER_END}\\n?`);
1942
1971
  var grok = {
1943
1972
  name: "grok-build",
1944
- detect: (c) => onPath2("grok") || existsSync8(join13(c.home, ".grok")),
1973
+ detect: (c) => onPath2("grok") || existsSync9(join13(c.home, ".grok")),
1945
1974
  install(c) {
1946
1975
  const path = join13(c.home, ".grok", "config.toml");
1947
- const existing = existsSync8(path) ? readFileSync10(path, "utf8") : "";
1976
+ const existing = existsSync9(path) ? readFileSync10(path, "utf8") : "";
1948
1977
  const withoutOurs = existing.replace(GROK_BLOCK_RE, "\n");
1949
1978
  const command = (entry) => JSON.stringify(`node "${join13(c.dist, entry)}"`);
1950
1979
  const tomlString = (value) => JSON.stringify(value);
@@ -1973,7 +2002,7 @@ command = "node"
1973
2002
  args = [${tomlString(join13(c.dist, "mcp-server.js"))}]
1974
2003
  ${GROK_MARKER_END}
1975
2004
  `;
1976
- if (existsSync8(path) && !existsSync8(`${path}.hindsight-backup`))
2005
+ if (existsSync9(path) && !existsSync9(`${path}.hindsight-backup`))
1977
2006
  copyFileSync(path, `${path}.hindsight-backup`);
1978
2007
  mkdirSync3(dirname8(path), { recursive: true });
1979
2008
  writeFileSync2(path, `${withoutOurs.replace(/\n*$/, "\n")}${block}`);
@@ -1982,7 +2011,7 @@ ${GROK_MARKER_END}
1982
2011
  },
1983
2012
  uninstall(c) {
1984
2013
  const path = join13(c.home, ".grok", "config.toml");
1985
- if (existsSync8(path)) {
2014
+ if (existsSync9(path)) {
1986
2015
  const existing = readFileSync10(path, "utf8");
1987
2016
  const cleaned = existing.replace(GROK_BLOCK_RE, "\n");
1988
2017
  if (cleaned !== existing) writeFileSync2(path, cleaned);
@@ -1998,14 +2027,14 @@ function removeLegacyClineHooks(c) {
1998
2027
  const hooksDir = join13(c.home, "Documents", "Cline", "Hooks");
1999
2028
  for (const event of CLINE_OLD_HOOK_EVENTS) {
2000
2029
  const path = join13(hooksDir, event);
2001
- if (existsSync8(path) && readFileSync10(path, "utf8").includes(CLINE_HOOK_MARKER)) {
2002
- rmSync(path, { force: true });
2030
+ if (existsSync9(path) && readFileSync10(path, "utf8").includes(CLINE_HOOK_MARKER)) {
2031
+ rmSync2(path, { force: true });
2003
2032
  }
2004
2033
  }
2005
2034
  }
2006
2035
  var cline = {
2007
2036
  name: "cline-cli",
2008
- detect: (c) => onPath2("cline") || existsSync8(join13(c.home, ".cline")),
2037
+ detect: (c) => onPath2("cline") || existsSync9(join13(c.home, ".cline")),
2009
2038
  install(c) {
2010
2039
  removeLegacyClineHooks(c);
2011
2040
  const installed = (c.clinePlugin ?? runClinePlugin)([
@@ -2034,7 +2063,7 @@ var cline = {
2034
2063
  removeLegacyClineHooks(c);
2035
2064
  (c.clinePlugin ?? runClinePlugin)(["plugin", "uninstall", CLINE_PLUGIN_NAME]);
2036
2065
  const mcpPath = join13(c.home, ".cline", "data", "settings", "cline_mcp_settings.json");
2037
- if (existsSync8(mcpPath)) {
2066
+ if (existsSync9(mcpPath)) {
2038
2067
  const mcp = readJson(mcpPath);
2039
2068
  if (mcp.mcpServers?.hindsight) {
2040
2069
  delete mcp.mcpServers.hindsight;
@@ -2048,6 +2077,7 @@ var cline = {
2048
2077
  var INSTALLERS = [
2049
2078
  opencode,
2050
2079
  kilo,
2080
+ primeAgent,
2051
2081
  claudeCode,
2052
2082
  codex,
2053
2083
  antigravity,