@primitive.ai/prim 0.1.0-alpha.98 → 0.1.0-alpha.99

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 (40) hide show
  1. package/README.md +11 -0
  2. package/dist/{chunk-7IPGD6CD.js → chunk-25DDRMWS.js} +2 -2
  3. package/dist/{chunk-B6EPQ4YH.js → chunk-2IRLFOEL.js} +123 -19
  4. package/dist/{chunk-WKLYYT63.js → chunk-2Q3OGSTV.js} +3 -3
  5. package/dist/{chunk-2DPLT2CQ.js → chunk-5LRKJTLA.js} +1 -1
  6. package/dist/{chunk-AN6XTFIN.js → chunk-6C3CCVDI.js} +2 -2
  7. package/dist/{chunk-NIQAVFP6.js → chunk-7VIMU2HR.js} +1 -1
  8. package/dist/{chunk-2DA2B4EC.js → chunk-EJPKZT5M.js} +2 -2
  9. package/dist/{chunk-HUZXBJJ5.js → chunk-FK7FJPWS.js} +1 -1
  10. package/dist/{chunk-QPMLAD2C.js → chunk-JJI7FU24.js} +2 -2
  11. package/dist/{chunk-PPZBEOWK.js → chunk-JJYS7IPD.js} +3 -3
  12. package/dist/{chunk-RT7DXMTN.js → chunk-K4JWJ6OM.js} +79 -266
  13. package/dist/{chunk-3X77XQGW.js → chunk-KGBMU76T.js} +1 -1
  14. package/dist/{chunk-JOR67B5T.js → chunk-O2WV5SQZ.js} +8 -8
  15. package/dist/{chunk-IL443QTF.js → chunk-X5BN67D2.js} +2 -2
  16. package/dist/{chunk-6QK75B7G.js → chunk-XG7S3LIL.js} +214 -11
  17. package/dist/{chunk-MN4X6RR6.js → chunk-XPS6LG6I.js} +5 -7
  18. package/dist/{chunk-BIAWZMCK.js → chunk-ZNLIGT3J.js} +2 -2
  19. package/dist/daemon/server.js +247 -180
  20. package/dist/hook-runtime/daemon/server.js +247 -180
  21. package/dist/hook-runtime/hooks/post-commit.js +114 -59
  22. package/dist/hook-runtime/hooks/post-rewrite.js +109 -54
  23. package/dist/hook-runtime/hooks/post-tool-use.js +256 -156
  24. package/dist/hook-runtime/hooks/pre-commit.js +177 -33
  25. package/dist/hook-runtime/hooks/pre-tool-use.js +237 -137
  26. package/dist/hook-runtime/hooks/prim-hook.js +281 -181
  27. package/dist/hook-runtime/hooks/session-start.js +209 -109
  28. package/dist/hook-runtime/index.js +615 -515
  29. package/dist/hook-runtime/statusline-main.js +71 -16
  30. package/dist/hooks/post-commit.js +7 -7
  31. package/dist/hooks/post-rewrite.js +6 -6
  32. package/dist/hooks/post-tool-use.js +13 -13
  33. package/dist/hooks/pre-commit.js +4 -4
  34. package/dist/hooks/pre-tool-use.js +10 -11
  35. package/dist/hooks/prim-hook.js +14 -14
  36. package/dist/hooks/session-end.js +4 -4
  37. package/dist/hooks/session-start.js +11 -11
  38. package/dist/index.js +20 -20
  39. package/dist/statusline-main.js +71 -16
  40. package/package.json +1 -1
@@ -52,8 +52,8 @@ var require_ucs2length = __commonJS({
52
52
  });
53
53
 
54
54
  // src/hooks/post-tool-use.ts
55
- import { readFileSync as readFileSync15 } from "fs";
56
- import { dirname as dirname12, join as join17 } from "path";
55
+ import { readFileSync as readFileSync16 } from "fs";
56
+ import { dirname as dirname12, join as join18 } from "path";
57
57
  import { fileURLToPath as fileURLToPath2 } from "url";
58
58
 
59
59
  // src/binding.ts
@@ -743,8 +743,8 @@ function decisionIngestionStatus(cwd) {
743
743
 
744
744
  // src/client.ts
745
745
  import { createHash as createHash3 } from "crypto";
746
- import { chmodSync, existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync5, rmSync as rmSync3 } from "fs";
747
- import { dirname as dirname5 } from "path";
746
+ import { chmodSync as chmodSync2, existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync7, rmSync as rmSync3 } from "fs";
747
+ import { dirname as dirname6 } from "path";
748
748
 
749
749
  // src/lib/atomic-file.ts
750
750
  import { randomUUID } from "crypto";
@@ -967,6 +967,174 @@ async function withFileLock(lockDir, operation, options = {}) {
967
967
  }
968
968
  }
969
969
 
970
+ // src/daemon/client-instance-id.ts
971
+ import { randomBytes as randomBytes2 } from "crypto";
972
+ import { chmodSync, lstatSync as lstatSync2, readFileSync as readFileSync5 } from "fs";
973
+ import { join as join6 } from "path";
974
+ var CONFIG_DIRECTORY_MODE = 448;
975
+ var INSTANCE_FILE_MODE = 384;
976
+ var INSTANCE_ENTROPY_BYTES = 32;
977
+ var INSTANCE_BODY_CHARS = 43;
978
+ var INSTANCE_PREFIX = "pci_";
979
+ var CLIENT_INSTANCE_ID_RE = /^pci_[A-Za-z0-9_-]{43}$/u;
980
+ var MAX_STORED_BYTES = INSTANCE_PREFIX.length + INSTANCE_BODY_CHARS + 1;
981
+ function isClientInstanceId(value) {
982
+ return typeof value === "string" && CLIENT_INSTANCE_ID_RE.test(value);
983
+ }
984
+ function ensurePrivateConfigDirectory(configDir) {
985
+ ensureDurableDirectory(configDir, CONFIG_DIRECTORY_MODE);
986
+ const metadata = lstatSync2(configDir);
987
+ if (!metadata.isDirectory() || metadata.isSymbolicLink()) {
988
+ throw new Error("prim config path must be a private directory");
989
+ }
990
+ chmodSync(configDir, CONFIG_DIRECTORY_MODE);
991
+ syncDirectory(configDir);
992
+ }
993
+ function readExisting(path) {
994
+ let metadata;
995
+ try {
996
+ metadata = lstatSync2(path);
997
+ } catch (error) {
998
+ if (error.code === "ENOENT") {
999
+ return;
1000
+ }
1001
+ throw error;
1002
+ }
1003
+ if (!metadata.isFile() || metadata.isSymbolicLink()) {
1004
+ throw new Error("stored client instance identity is invalid");
1005
+ }
1006
+ chmodSync(path, INSTANCE_FILE_MODE);
1007
+ if (metadata.size > MAX_STORED_BYTES) {
1008
+ throw new Error("stored client instance identity is invalid");
1009
+ }
1010
+ const raw = readFileSync5(path, "utf8");
1011
+ const value = raw.endsWith("\n") ? raw.slice(0, -1) : raw;
1012
+ if (raw !== value && raw !== `${value}
1013
+ ` || !isClientInstanceId(value)) {
1014
+ throw new Error("stored client instance identity is invalid");
1015
+ }
1016
+ return value;
1017
+ }
1018
+ function atomicWrite(path, value) {
1019
+ atomicWriteFile(path, `${value}
1020
+ `, { mode: INSTANCE_FILE_MODE });
1021
+ }
1022
+ async function getOrCreateClientInstanceId(options) {
1023
+ const configDir = options.configDir;
1024
+ const path = join6(configDir, "client_instance_id");
1025
+ const lockPath = join6(configDir, "client-instance.lock");
1026
+ ensurePrivateConfigDirectory(configDir);
1027
+ return withFileLock(
1028
+ lockPath,
1029
+ () => {
1030
+ const existing = readExisting(path);
1031
+ if (existing !== void 0) {
1032
+ return existing;
1033
+ }
1034
+ const generated = `${INSTANCE_PREFIX}${randomBytes2(INSTANCE_ENTROPY_BYTES).toString(
1035
+ "base64url"
1036
+ )}`;
1037
+ if (!isClientInstanceId(generated)) {
1038
+ throw new Error("generated client instance identity is invalid");
1039
+ }
1040
+ atomicWrite(path, generated);
1041
+ return generated;
1042
+ },
1043
+ options.lockOptions
1044
+ );
1045
+ }
1046
+
1047
+ // src/lib/bin-path.ts
1048
+ import { existsSync as existsSync4, readFileSync as readFileSync6 } from "fs";
1049
+ import { dirname as dirname5, isAbsolute as isAbsolute3, join as join7 } from "path";
1050
+ import { fileURLToPath } from "url";
1051
+ var PKG_NAME = "@primitive.ai/prim";
1052
+ var ROOT_WALK_LIMIT = 6;
1053
+ var STABLE_HOOK_LAUNCHER_NAME = "prim-hook-launcher-v1";
1054
+ var resolvedRoot;
1055
+ function locateRoot() {
1056
+ if (resolvedRoot !== void 0) {
1057
+ return resolvedRoot;
1058
+ }
1059
+ let dir = dirname5(fileURLToPath(import.meta.url));
1060
+ for (let depth = 0; depth < ROOT_WALK_LIMIT; depth++) {
1061
+ const manifestPath = join7(dir, "package.json");
1062
+ if (existsSync4(manifestPath)) {
1063
+ try {
1064
+ const manifest = JSON.parse(readFileSync6(manifestPath, "utf-8"));
1065
+ if (manifest.name === PKG_NAME && manifest.bin) {
1066
+ resolvedRoot = { dir, version: manifest.version, bin: manifest.bin };
1067
+ return resolvedRoot;
1068
+ }
1069
+ } catch {
1070
+ }
1071
+ }
1072
+ const parent = dirname5(dir);
1073
+ if (parent === dir) {
1074
+ break;
1075
+ }
1076
+ dir = parent;
1077
+ }
1078
+ resolvedRoot = null;
1079
+ return resolvedRoot;
1080
+ }
1081
+ function packageVersion() {
1082
+ return locateRoot()?.version ?? null;
1083
+ }
1084
+ function shellQuote(value) {
1085
+ return `'${value.replaceAll("'", `'"'"'`)}'`;
1086
+ }
1087
+ var STABLE_HOOK_ARGUMENTS_RE = /^[-A-Za-z0-9_ ]*$/u;
1088
+ var STABLE_HOOK_BIN_RE = /^[A-Za-z0-9][A-Za-z0-9-]*$/u;
1089
+ var PRIM_CONFIG_SHELL_RESOLVER = [
1090
+ 'prim_absolute() { case "$1" in [/]* ) ;; *) return 1 ;; esac; case "$1" in [[:space:]]*|*[[:space:]]|*[/][/]*|*[/].[/]*|*[/]..[/]*|*[/].|*[/]..|?*[/]) return 1 ;; esac; }; ',
1091
+ 'prim_config=${PRIM_CONFIG_DIR:-}; if ! prim_absolute "$prim_config"; then prim_config=${XDG_CONFIG_HOME:-}; if prim_absolute "$prim_config"; then ',
1092
+ 'case "$prim_config" in /) prim_config=/prim ;; *) prim_config="$prim_config/prim" ;; esac; ',
1093
+ 'else prim_home=${HOME:-}; prim_absolute "$prim_home" || exit 78; case "$prim_home" in /) prim_config=/.config/prim ;; *) prim_config="$prim_home/.config/prim" ;; esac; ',
1094
+ "fi; fi; "
1095
+ ].join("");
1096
+ function stableHookCommand(bin, args = "") {
1097
+ if (!STABLE_HOOK_BIN_RE.test(bin) || !STABLE_HOOK_ARGUMENTS_RE.test(args)) {
1098
+ throw new Error("invalid stable hook command");
1099
+ }
1100
+ const resolver = [
1101
+ // #242 and earlier identify managed commands by this package marker. Keep
1102
+ // it as inert data during the rolling window so an older uninstall or
1103
+ // reinstall can remove the stable entry without invoking npm or PATH.
1104
+ `prim_legacy_reader='-p ${PKG_NAME}@stable prim-shim.sh ${bin} '; `,
1105
+ PRIM_CONFIG_SHELL_RESOLVER,
1106
+ `case "$prim_config" in /) prim_launcher=/${STABLE_HOOK_LAUNCHER_NAME} ;; *) prim_launcher="$prim_config/${STABLE_HOOK_LAUNCHER_NAME}" ;; esac; `,
1107
+ 'exec "$prim_launcher" "$@"'
1108
+ ].join("");
1109
+ const suffix = args ? ` ${args}` : "";
1110
+ return `/bin/sh -c ${shellQuote(resolver)} ${STABLE_HOOK_LAUNCHER_NAME} ${bin}${suffix}`;
1111
+ }
1112
+ function detachedHookShimCommand(bin, args = "") {
1113
+ return `payload=$(cat); { trap '' HUP; printf '%s' "$payload" | { ${stableHookCommand(bin, args)}; }; } </dev/null >/dev/null 2>&1 &`;
1114
+ }
1115
+
1116
+ // src/lib/ingest-uploader.ts
1117
+ var runtimeVersion = process.env.PRIM_RUNTIME_VERSION ?? packageVersion();
1118
+ var VERSION_RE = /^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?(?:\+[A-Za-z0-9.-]+)?$/u;
1119
+ var instanceId;
1120
+ async function ingestUploaderHeaders() {
1121
+ const headers = {};
1122
+ if (runtimeVersion && runtimeVersion.length <= 64 && VERSION_RE.test(runtimeVersion)) {
1123
+ headers["X-Prim-Uploader-Version"] = runtimeVersion;
1124
+ }
1125
+ instanceId ??= getOrCreateClientInstanceId({
1126
+ configDir: primConfigDirectory(),
1127
+ // Attribution must not consume the upload deadline waiting for another process.
1128
+ lockOptions: { timeoutMs: 0 }
1129
+ }).catch(() => {
1130
+ instanceId = void 0;
1131
+ return void 0;
1132
+ });
1133
+ const id = await instanceId;
1134
+ if (id) headers["X-Prim-Client-Instance-Id"] = id;
1135
+ return headers;
1136
+ }
1137
+
970
1138
  // src/lib/terminal-safe.ts
971
1139
  function replaceIsolatedSurrogates(value) {
972
1140
  let out = "";
@@ -1017,7 +1185,7 @@ var DEFAULT_API_URL = "https://api.getprimitive.ai";
1017
1185
  var AUTH_EXPIRED_MESSAGE = "Authentication expired. Run `prim auth login` to re-authenticate.";
1018
1186
  function readTrimmed2(path) {
1019
1187
  try {
1020
- const value = readFileSync5(path, "utf8").trim();
1188
+ const value = readFileSync7(path, "utf8").trim();
1021
1189
  return value || void 0;
1022
1190
  } catch {
1023
1191
  return void 0;
@@ -1033,16 +1201,16 @@ function expiresAtFor(token, expiresIn) {
1033
1201
  return expiresIn === void 0 ? jwtExpiresAt(token) : Date.now() + expiresIn * 1e3;
1034
1202
  }
1035
1203
  function ensureConfigDirectory() {
1036
- const directory = dirname5(TOKEN_FILE_PATH);
1204
+ const directory = dirname6(TOKEN_FILE_PATH);
1037
1205
  mkdirSync3(directory, { recursive: true, mode: CONFIG_DIR_MODE });
1038
- chmodSync(directory, CONFIG_DIR_MODE);
1206
+ chmodSync2(directory, CONFIG_DIR_MODE);
1039
1207
  }
1040
- function atomicWrite(path, content) {
1208
+ function atomicWrite2(path, content) {
1041
1209
  ensureConfigDirectory();
1042
1210
  atomicWriteFile(path, content, { mode: CREDENTIAL_FILE_MODE });
1043
1211
  }
1044
1212
  function removeCredentialFile(path) {
1045
- if (!existsSync4(path)) return false;
1213
+ if (!existsSync5(path)) return false;
1046
1214
  rmSync3(path, { force: true });
1047
1215
  return true;
1048
1216
  }
@@ -1076,7 +1244,7 @@ function credentialFamilyMetadata(accessToken, refreshToken2, metadata) {
1076
1244
  return metadata === void 0 ? legacyBrokerCredentialMetadata(accessToken, refreshToken2) : { ...metadata, ...hashes };
1077
1245
  }
1078
1246
  function writeCredentialMigrationSentinel() {
1079
- atomicWrite(
1247
+ atomicWrite2(
1080
1248
  CREDENTIAL_MIGRATION_PATH,
1081
1249
  `${JSON.stringify({
1082
1250
  version: CREDENTIAL_MIGRATION_VERSION,
@@ -1094,7 +1262,7 @@ function bindLegacyBrokerGeneration(accessToken, refreshToken2, metadata) {
1094
1262
  return { state: "invalid" };
1095
1263
  }
1096
1264
  if (metadata.metadata === void 0) {
1097
- atomicWrite(CREDENTIAL_FAMILY_PATH, `${JSON.stringify(familyMetadata)}
1265
+ atomicWrite2(CREDENTIAL_FAMILY_PATH, `${JSON.stringify(familyMetadata)}
1098
1266
  `);
1099
1267
  }
1100
1268
  const migrationState = readCredentialMigrationState();
@@ -1109,14 +1277,14 @@ function preserveMarkerlessLegacyGeneration() {
1109
1277
  const refreshToken2 = readTrimmed2(REFRESH_TOKEN_PATH);
1110
1278
  if (!(accessToken && refreshToken2)) return;
1111
1279
  const familyMetadata = legacyBrokerCredentialMetadata(accessToken, refreshToken2);
1112
- atomicWrite(CREDENTIAL_FAMILY_PATH, `${JSON.stringify(familyMetadata)}
1280
+ atomicWrite2(CREDENTIAL_FAMILY_PATH, `${JSON.stringify(familyMetadata)}
1113
1281
  `);
1114
1282
  }
1115
1283
  function terminalFingerprint() {
1116
1284
  return readTrimmed2(TERMINAL_REFRESH_PATH);
1117
1285
  }
1118
1286
  function writeTerminalFingerprint(refreshToken2) {
1119
- atomicWrite(TERMINAL_REFRESH_PATH, `${refreshFingerprint(refreshToken2)}
1287
+ atomicWrite2(TERMINAL_REFRESH_PATH, `${refreshFingerprint(refreshToken2)}
1120
1288
  `);
1121
1289
  }
1122
1290
  function clearTerminalFingerprint() {
@@ -1141,24 +1309,24 @@ function commitCredentialsUnlocked(credentials) {
1141
1309
  if (credentials.metadata !== void 0) {
1142
1310
  preserveMarkerlessLegacyGeneration();
1143
1311
  writeCredentialMigrationSentinel();
1144
- atomicWrite(CREDENTIAL_FAMILY_PATH, `${JSON.stringify(familyMetadata)}
1312
+ atomicWrite2(CREDENTIAL_FAMILY_PATH, `${JSON.stringify(familyMetadata)}
1145
1313
  `);
1146
- atomicWrite(CREDENTIAL_METADATA_PATH, `${JSON.stringify(familyMetadata)}
1314
+ atomicWrite2(CREDENTIAL_METADATA_PATH, `${JSON.stringify(familyMetadata)}
1147
1315
  `);
1148
- atomicWrite(REFRESH_TOKEN_PATH, `${refreshToken2}
1316
+ atomicWrite2(REFRESH_TOKEN_PATH, `${refreshToken2}
1149
1317
  `);
1150
1318
  } else {
1151
- atomicWrite(REFRESH_TOKEN_PATH, `${refreshToken2}
1319
+ atomicWrite2(REFRESH_TOKEN_PATH, `${refreshToken2}
1152
1320
  `);
1153
- atomicWrite(CREDENTIAL_FAMILY_PATH, `${JSON.stringify(familyMetadata)}
1321
+ atomicWrite2(CREDENTIAL_FAMILY_PATH, `${JSON.stringify(familyMetadata)}
1154
1322
  `);
1155
1323
  removeCredentialFile(CREDENTIAL_METADATA_PATH);
1156
1324
  }
1157
1325
  const expiresAt = expiresAtFor(accessToken, credentials.expiresIn);
1158
1326
  if (expiresAt === void 0) removeCredentialFile(TOKEN_EXPIRES_PATH);
1159
- else atomicWrite(TOKEN_EXPIRES_PATH, `${expiresAt}
1327
+ else atomicWrite2(TOKEN_EXPIRES_PATH, `${expiresAt}
1160
1328
  `);
1161
- atomicWrite(TOKEN_FILE_PATH, `${accessToken}
1329
+ atomicWrite2(TOKEN_FILE_PATH, `${accessToken}
1162
1330
  `);
1163
1331
  clearTerminalFingerprint();
1164
1332
  _cachedCredential = { token: accessToken, source: "token_file" };
@@ -1392,12 +1560,13 @@ function selectedCredential() {
1392
1560
  }
1393
1561
  return _cachedCredential;
1394
1562
  }
1395
- function fetchWithToken(method, path, body, options, token, siteUrl) {
1563
+ async function fetchWithToken(method, path, body, options, token, siteUrl) {
1396
1564
  return fetch(`${siteUrl}${path}`, {
1397
1565
  method,
1398
1566
  headers: {
1399
1567
  Authorization: `Bearer ${token}`,
1400
- "Content-Type": "application/json"
1568
+ "Content-Type": "application/json",
1569
+ ...method === "POST" && path === "/api/cli/moves/ingest" ? await ingestUploaderHeaders() : {}
1401
1570
  },
1402
1571
  body: body === void 0 ? void 0 : JSON.stringify(body),
1403
1572
  signal: options?.signal
@@ -20030,21 +20199,21 @@ import { execFileSync as execFileSync3 } from "child_process";
20030
20199
  import { randomUUID as randomUUID2 } from "crypto";
20031
20200
  import {
20032
20201
  constants as constants2,
20033
- chmodSync as chmodSync2,
20202
+ chmodSync as chmodSync3,
20034
20203
  closeSync as closeSync2,
20035
20204
  fchmodSync as fchmodSync2,
20036
20205
  fsyncSync as fsyncSync2,
20037
20206
  linkSync,
20038
- lstatSync as lstatSync2,
20207
+ lstatSync as lstatSync3,
20039
20208
  mkdirSync as mkdirSync4,
20040
20209
  openSync as openSync2,
20041
- readFileSync as readFileSync6,
20210
+ readFileSync as readFileSync8,
20042
20211
  statSync as statSync2,
20043
20212
  unlinkSync,
20044
20213
  writeFileSync as writeFileSync3
20045
20214
  } from "fs";
20046
- import { dirname as dirname6, isAbsolute as isAbsolute3, join as join7, resolve as resolve3 } from "path";
20047
- var WORKSPACE_ID_RELATIVE_PATH = join7("prim", "workspace-id");
20215
+ import { dirname as dirname7, isAbsolute as isAbsolute4, join as join9, resolve as resolve3 } from "path";
20216
+ var WORKSPACE_ID_RELATIVE_PATH = join9("prim", "workspace-id");
20048
20217
  var MAX_ANCESTORS = 64;
20049
20218
  var MAX_GIT_FILE_BYTES = 4096;
20050
20219
  var MAX_ID_FILE_BYTES = 128;
@@ -20090,7 +20259,7 @@ function resolveWorkspaceIdPath(cwd) {
20090
20259
  }
20091
20260
  return {
20092
20261
  status: "resolved",
20093
- path: isAbsolute3(gitPath) ? resolve3(gitPath) : resolve3(cwd, gitPath)
20262
+ path: isAbsolute4(gitPath) ? resolve3(gitPath) : resolve3(cwd, gitPath)
20094
20263
  };
20095
20264
  } catch (error) {
20096
20265
  const code = errorCode(error);
@@ -20103,19 +20272,19 @@ function resolveWorkspaceIdPath(cwd) {
20103
20272
  function resolveFromFilesystem(cwd) {
20104
20273
  let current = resolve3(cwd);
20105
20274
  for (let depth = 0; depth < MAX_ANCESTORS; depth += 1) {
20106
- const dotGit = join7(current, ".git");
20275
+ const dotGit = join9(current, ".git");
20107
20276
  try {
20108
- const stat = lstatSync2(dotGit);
20277
+ const stat = lstatSync3(dotGit);
20109
20278
  if (stat.isDirectory() && isGitDirectory(dotGit)) {
20110
- return join7(dotGit, WORKSPACE_ID_RELATIVE_PATH);
20279
+ return join9(dotGit, WORKSPACE_ID_RELATIVE_PATH);
20111
20280
  }
20112
20281
  if (stat.isFile() && stat.size <= MAX_GIT_FILE_BYTES) {
20113
- const contents = readFileSync6(dotGit, "utf8");
20282
+ const contents = readFileSync8(dotGit, "utf8");
20114
20283
  const match = /^gitdir: (.+?)(?:\r?\n)?$/.exec(contents);
20115
20284
  if (match?.[1]) {
20116
- const gitDirectory = isAbsolute3(match[1]) ? resolve3(match[1]) : resolve3(current, match[1]);
20285
+ const gitDirectory = isAbsolute4(match[1]) ? resolve3(match[1]) : resolve3(current, match[1]);
20117
20286
  if (isGitDirectory(gitDirectory)) {
20118
- return join7(gitDirectory, WORKSPACE_ID_RELATIVE_PATH);
20287
+ return join9(gitDirectory, WORKSPACE_ID_RELATIVE_PATH);
20119
20288
  }
20120
20289
  }
20121
20290
  }
@@ -20126,7 +20295,7 @@ function resolveFromFilesystem(cwd) {
20126
20295
  return null;
20127
20296
  }
20128
20297
  }
20129
- const parent = dirname6(current);
20298
+ const parent = dirname7(current);
20130
20299
  if (parent === current) break;
20131
20300
  current = parent;
20132
20301
  }
@@ -20134,7 +20303,7 @@ function resolveFromFilesystem(cwd) {
20134
20303
  }
20135
20304
  function isGitDirectory(path) {
20136
20305
  try {
20137
- return statSync2(join7(path, "HEAD")).isFile();
20306
+ return statSync2(join9(path, "HEAD")).isFile();
20138
20307
  } catch {
20139
20308
  return false;
20140
20309
  }
@@ -20142,7 +20311,7 @@ function isGitDirectory(path) {
20142
20311
  function inspectPath(path) {
20143
20312
  let stat;
20144
20313
  try {
20145
- stat = lstatSync2(path);
20314
+ stat = lstatSync3(path);
20146
20315
  } catch (error) {
20147
20316
  const code = errorCode(error);
20148
20317
  if (code === "ENOENT" || code === "ENOTDIR") return { status: "missing", path };
@@ -20153,7 +20322,7 @@ function inspectPath(path) {
20153
20322
  return { status: "corrupt", path, reason: "invalid_content" };
20154
20323
  }
20155
20324
  try {
20156
- const contents = readFileSync6(path, "utf8");
20325
+ const contents = readFileSync8(path, "utf8");
20157
20326
  const workspaceId = contents.endsWith("\n") ? contents.slice(0, -1) : contents;
20158
20327
  if ((contents === workspaceId || contents === `${workspaceId}
20159
20328
  `) && isCanonicalWorkspaceId(workspaceId)) {
@@ -20170,14 +20339,14 @@ function inspectPath(path) {
20170
20339
  }
20171
20340
  }
20172
20341
  function createWorkspaceId(path) {
20173
- const parent = dirname6(path);
20342
+ const parent = dirname7(path);
20174
20343
  const workspaceId = randomUUID2();
20175
- const temporaryPath = join7(parent, `.workspace-id-${process.pid}-${randomUUID2()}.tmp`);
20344
+ const temporaryPath = join9(parent, `.workspace-id-${process.pid}-${randomUUID2()}.tmp`);
20176
20345
  let temporaryCreated = false;
20177
20346
  let publishing = false;
20178
20347
  try {
20179
20348
  mkdirSync4(parent, { recursive: true, mode: 448 });
20180
- chmodSync2(parent, 448);
20349
+ chmodSync3(parent, 448);
20181
20350
  const fd = openSync2(
20182
20351
  temporaryPath,
20183
20352
  constants2.O_CREAT | constants2.O_EXCL | constants2.O_WRONLY,
@@ -20242,12 +20411,12 @@ function parseAgent(argv) {
20242
20411
  }
20243
20412
 
20244
20413
  // src/hooks/codex-context.ts
20245
- import { createHash as createHash5, randomBytes as randomBytes3 } from "crypto";
20414
+ import { createHash as createHash5, randomBytes as randomBytes4 } from "crypto";
20246
20415
  import {
20247
- chmodSync as chmodSync3,
20416
+ chmodSync as chmodSync4,
20248
20417
  existsSync as existsSync6,
20249
20418
  mkdirSync as mkdirSync5,
20250
- readFileSync as readFileSync8,
20419
+ readFileSync as readFileSync9,
20251
20420
  readdirSync,
20252
20421
  renameSync as renameSync2,
20253
20422
  rmSync as rmSync4,
@@ -20255,11 +20424,11 @@ import {
20255
20424
  unlinkSync as unlinkSync2,
20256
20425
  writeFileSync as writeFileSync4
20257
20426
  } from "fs";
20258
- import { join as join10 } from "path";
20427
+ import { join as join11 } from "path";
20259
20428
 
20260
20429
  // src/daemon/client.ts
20261
20430
  import { createConnection } from "net";
20262
- import { join as join8 } from "path";
20431
+ import { join as join10 } from "path";
20263
20432
 
20264
20433
  // src/daemon/principal.ts
20265
20434
  import { createHash as createHash4 } from "crypto";
@@ -20309,7 +20478,7 @@ function parseDaemonResponseEnvelope(value) {
20309
20478
  }
20310
20479
 
20311
20480
  // src/daemon/client.ts
20312
- var SOCK_PATH = join8(primConfigDirectory(), "sock");
20481
+ var SOCK_PATH = join10(primConfigDirectory(), "sock");
20313
20482
  var DEFAULT_TIMEOUT_MS2 = 250;
20314
20483
  var nextRequestId = 1;
20315
20484
  function daemonRequest(method, params = {}, opts = {}) {
@@ -20397,7 +20566,7 @@ function daemonRequest(method, params = {}, opts = {}) {
20397
20566
  }
20398
20567
 
20399
20568
  // src/daemon/decision-digest-cache.ts
20400
- import { randomBytes as randomBytes2 } from "crypto";
20569
+ import { randomBytes as randomBytes3 } from "crypto";
20401
20570
  var DECISION_DIGEST_CACHE_LIMIT = 100;
20402
20571
  var DECISION_DIGEST_CACHE_WINDOW = "24h";
20403
20572
  var DECISION_DIGEST_CACHE_PATH = `/api/cli/decisions/recent?limit=${String(DECISION_DIGEST_CACHE_LIMIT)}&since=${DECISION_DIGEST_CACHE_WINDOW}`;
@@ -20409,75 +20578,6 @@ function isActionablePrivateDraft(row) {
20409
20578
  return typeof candidate.id === "string" && SAFE_PRIVATE_DRAFT_ID.test(candidate.id) && typeof candidate.intent === "string" && candidate.authorIsSelf === true && candidate.stage === "draft" && (candidate.intentKind === void 0 || candidate.intentKind === "change");
20410
20579
  }
20411
20580
 
20412
- // src/lib/bin-path.ts
20413
- import { existsSync as existsSync5, readFileSync as readFileSync7 } from "fs";
20414
- import { dirname as dirname7, isAbsolute as isAbsolute4, join as join9 } from "path";
20415
- import { fileURLToPath } from "url";
20416
- var PKG_NAME = "@primitive.ai/prim";
20417
- var ROOT_WALK_LIMIT = 6;
20418
- var STABLE_HOOK_LAUNCHER_NAME = "prim-hook-launcher-v1";
20419
- var resolvedRoot;
20420
- function locateRoot() {
20421
- if (resolvedRoot !== void 0) {
20422
- return resolvedRoot;
20423
- }
20424
- let dir = dirname7(fileURLToPath(import.meta.url));
20425
- for (let depth = 0; depth < ROOT_WALK_LIMIT; depth++) {
20426
- const manifestPath = join9(dir, "package.json");
20427
- if (existsSync5(manifestPath)) {
20428
- try {
20429
- const manifest = JSON.parse(readFileSync7(manifestPath, "utf-8"));
20430
- if (manifest.name === PKG_NAME && manifest.bin) {
20431
- resolvedRoot = { dir, version: manifest.version, bin: manifest.bin };
20432
- return resolvedRoot;
20433
- }
20434
- } catch {
20435
- }
20436
- }
20437
- const parent = dirname7(dir);
20438
- if (parent === dir) {
20439
- break;
20440
- }
20441
- dir = parent;
20442
- }
20443
- resolvedRoot = null;
20444
- return resolvedRoot;
20445
- }
20446
- function packageVersion() {
20447
- return locateRoot()?.version ?? null;
20448
- }
20449
- function shellQuote(value) {
20450
- return `'${value.replaceAll("'", `'"'"'`)}'`;
20451
- }
20452
- var STABLE_HOOK_ARGUMENTS_RE = /^[-A-Za-z0-9_ ]*$/u;
20453
- var STABLE_HOOK_BIN_RE = /^[A-Za-z0-9][A-Za-z0-9-]*$/u;
20454
- var PRIM_CONFIG_SHELL_RESOLVER = [
20455
- 'prim_absolute() { case "$1" in [/]* ) ;; *) return 1 ;; esac; case "$1" in [[:space:]]*|*[[:space:]]|*[/][/]*|*[/].[/]*|*[/]..[/]*|*[/].|*[/]..|?*[/]) return 1 ;; esac; }; ',
20456
- 'prim_config=${PRIM_CONFIG_DIR:-}; if ! prim_absolute "$prim_config"; then prim_config=${XDG_CONFIG_HOME:-}; if prim_absolute "$prim_config"; then ',
20457
- 'case "$prim_config" in /) prim_config=/prim ;; *) prim_config="$prim_config/prim" ;; esac; ',
20458
- 'else prim_home=${HOME:-}; prim_absolute "$prim_home" || exit 78; case "$prim_home" in /) prim_config=/.config/prim ;; *) prim_config="$prim_home/.config/prim" ;; esac; ',
20459
- "fi; fi; "
20460
- ].join("");
20461
- function stableHookCommand(bin, args = "") {
20462
- if (!STABLE_HOOK_BIN_RE.test(bin) || !STABLE_HOOK_ARGUMENTS_RE.test(args)) {
20463
- throw new Error("invalid stable hook command");
20464
- }
20465
- const resolver = [
20466
- // #242 and earlier identify managed commands by this package marker. Keep
20467
- // it as inert data during the rolling window so an older uninstall or
20468
- // reinstall can remove the stable entry without invoking npm or PATH.
20469
- `prim_legacy_reader='-p ${PKG_NAME}@stable prim-shim.sh ${bin} '; `,
20470
- PRIM_CONFIG_SHELL_RESOLVER,
20471
- `case "$prim_config" in /) prim_launcher=/${STABLE_HOOK_LAUNCHER_NAME} ;; *) prim_launcher="$prim_config/${STABLE_HOOK_LAUNCHER_NAME}" ;; esac; `,
20472
- 'exec "$prim_launcher" "$@"'
20473
- ].join("");
20474
- const suffix = args ? ` ${args}` : "";
20475
- return `/bin/sh -c ${shellQuote(resolver)} ${STABLE_HOOK_LAUNCHER_NAME} ${bin}${suffix}`;
20476
- }
20477
- function detachedHookShimCommand(bin, args = "") {
20478
- return `payload=$(cat); { trap '' HUP; printf '%s' "$payload" | { ${stableHookCommand(bin, args)}; }; } </dev/null >/dev/null 2>&1 &`;
20479
- }
20480
-
20481
20581
  // src/lib/ansi.ts
20482
20582
  var ANSI_CODES = {
20483
20583
  yellow: "\x1B[33m",
@@ -20679,10 +20779,10 @@ function appendCodexContext(output, context) {
20679
20779
  return next;
20680
20780
  }
20681
20781
  function stateRoot(namespace) {
20682
- return join10(primConfigDirectory(), namespace, "decision-digests");
20782
+ return join11(primConfigDirectory(), namespace, "decision-digests");
20683
20783
  }
20684
20784
  function draftStateRoot(namespace) {
20685
- return join10(primConfigDirectory(), namespace, "decision-draft-deliveries");
20785
+ return join11(primConfigDirectory(), namespace, "decision-draft-deliveries");
20686
20786
  }
20687
20787
  function workspaceFor(cwd) {
20688
20788
  try {
@@ -20694,12 +20794,12 @@ function workspaceFor(cwd) {
20694
20794
  function statePath(args) {
20695
20795
  const identity = `${args.siteUrl}\0${workspaceFor(args.cwd)}\0${args.sessionId}`;
20696
20796
  const key = createHash5("sha256").update(identity).digest("hex");
20697
- return join10(stateRoot(args.namespace), `${key}.json`);
20797
+ return join11(stateRoot(args.namespace), `${key}.json`);
20698
20798
  }
20699
20799
  function draftStatePath(args) {
20700
20800
  const identity = `${args.siteUrl}\0${workspaceFor(args.cwd)}\0${args.sessionId}\0${args.principalId}\0${args.organizationId}\0${args.credentialFingerprint}`;
20701
20801
  const key = createHash5("sha256").update(identity).digest("hex");
20702
- return join10(draftStateRoot(args.namespace), `${key}.json`);
20802
+ return join11(draftStateRoot(args.namespace), `${key}.json`);
20703
20803
  }
20704
20804
  function parseState(value) {
20705
20805
  if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
@@ -20740,7 +20840,7 @@ function parseDraftState(value) {
20740
20840
  function readState(path) {
20741
20841
  if (!existsSync6(path)) return void 0;
20742
20842
  try {
20743
- return parseState(JSON.parse(readFileSync8(path, "utf8")));
20843
+ return parseState(JSON.parse(readFileSync9(path, "utf8")));
20744
20844
  } catch {
20745
20845
  return void 0;
20746
20846
  }
@@ -20748,17 +20848,17 @@ function readState(path) {
20748
20848
  function readDraftState(path) {
20749
20849
  if (!existsSync6(path)) return void 0;
20750
20850
  try {
20751
- return parseDraftState(JSON.parse(readFileSync8(path, "utf8")));
20851
+ return parseDraftState(JSON.parse(readFileSync9(path, "utf8")));
20752
20852
  } catch {
20753
20853
  return void 0;
20754
20854
  }
20755
20855
  }
20756
20856
  function writeStateFile(path, directory, state) {
20757
20857
  mkdirSync5(directory, { recursive: true, mode: 448 });
20758
- chmodSync3(directory, 448);
20759
- const temporary = join10(
20858
+ chmodSync4(directory, 448);
20859
+ const temporary = join11(
20760
20860
  directory,
20761
- `.${path.slice(directory.length + 1)}.tmp-${process.pid}-${randomBytes3(8).toString("hex")}`
20861
+ `.${path.slice(directory.length + 1)}.tmp-${process.pid}-${randomBytes4(8).toString("hex")}`
20762
20862
  );
20763
20863
  try {
20764
20864
  writeFileSync4(temporary, `${JSON.stringify(state)}
@@ -20767,7 +20867,7 @@ function writeStateFile(path, directory, state) {
20767
20867
  mode: 384,
20768
20868
  flag: "wx"
20769
20869
  });
20770
- chmodSync3(temporary, 384);
20870
+ chmodSync4(temporary, 384);
20771
20871
  renameSync2(temporary, path);
20772
20872
  } finally {
20773
20873
  try {
@@ -20787,7 +20887,7 @@ function cleanupStateFiles(directory, now) {
20787
20887
  const files = [];
20788
20888
  const residue = [];
20789
20889
  for (const name of names) {
20790
- const path = join10(directory, name);
20890
+ const path = join11(directory, name);
20791
20891
  try {
20792
20892
  const mtimeMs = statSync3(path).mtimeMs;
20793
20893
  if (name.endsWith(".json")) {
@@ -21092,22 +21192,22 @@ async function prepareCodexContext(options) {
21092
21192
  }
21093
21193
 
21094
21194
  // src/commands/cursor-install.ts
21095
- import { existsSync as existsSync9, readFileSync as readFileSync11 } from "fs";
21195
+ import { existsSync as existsSync9, readFileSync as readFileSync12 } from "fs";
21096
21196
  import { homedir as homedir4 } from "os";
21097
- import { isAbsolute as isAbsolute6, join as join13 } from "path";
21197
+ import { isAbsolute as isAbsolute6, join as join14 } from "path";
21098
21198
 
21099
21199
  // src/lib/hook-runtime.ts
21100
- import { createHash as createHash6, randomBytes as randomBytes4 } from "crypto";
21200
+ import { createHash as createHash6, randomBytes as randomBytes5 } from "crypto";
21101
21201
  import {
21102
21202
  constants as constants3,
21103
21203
  accessSync,
21104
- chmodSync as chmodSync4,
21204
+ chmodSync as chmodSync5,
21105
21205
  copyFileSync,
21106
21206
  existsSync as existsSync7,
21107
- lstatSync as lstatSync3,
21207
+ lstatSync as lstatSync4,
21108
21208
  mkdirSync as mkdirSync6,
21109
21209
  mkdtempSync,
21110
- readFileSync as readFileSync9,
21210
+ readFileSync as readFileSync10,
21111
21211
  readdirSync as readdirSync2,
21112
21212
  realpathSync as realpathSync2,
21113
21213
  renameSync as renameSync3,
@@ -21116,7 +21216,7 @@ import {
21116
21216
  utimesSync,
21117
21217
  writeFileSync as writeFileSync5
21118
21218
  } from "fs";
21119
- import { delimiter, dirname as dirname8, isAbsolute as isAbsolute5, join as join11, resolve as resolve4 } from "path";
21219
+ import { delimiter, dirname as dirname8, isAbsolute as isAbsolute5, join as join12, resolve as resolve4 } from "path";
21120
21220
 
21121
21221
  // src/lib/git-hook-contract.ts
21122
21222
  var GIT_HOOK_ENTRYPOINT_CONTENT = `#!/bin/sh
@@ -21209,9 +21309,9 @@ exec "$prim_node" "$prim_entry" "$@"
21209
21309
  `;
21210
21310
 
21211
21311
  // src/commands/claude-install.ts
21212
- import { existsSync as existsSync8, readFileSync as readFileSync10 } from "fs";
21312
+ import { existsSync as existsSync8, readFileSync as readFileSync11 } from "fs";
21213
21313
  import { homedir as homedir3 } from "os";
21214
- import { join as join12 } from "path";
21314
+ import { join as join13 } from "path";
21215
21315
  var CAPTURE_BIN = "prim-hook";
21216
21316
  var GATE_BIN = "prim-pre-tool-use";
21217
21317
  var POST_TOOL_USE_BIN = "prim-post-tool-use";
@@ -21220,7 +21320,7 @@ var SESSION_END_BIN = "prim-session-end";
21220
21320
  var STATUSLINE_BIN = "prim-statusline";
21221
21321
  var STATUSLINE_ARGS = "";
21222
21322
  var STATUSLINE_COMMAND = stableHookCommand(STATUSLINE_BIN, STATUSLINE_ARGS);
21223
- var USER_SCOPE_PATH = join12(homedir3(), ".claude", "settings.json");
21323
+ var USER_SCOPE_PATH = join13(homedir3(), ".claude", "settings.json");
21224
21324
  function projectRoot() {
21225
21325
  return gitToplevel() ?? process.cwd();
21226
21326
  }
@@ -21299,11 +21399,11 @@ function cursorConfigDirectory(env = process.env, home = homedir4(), platform2 =
21299
21399
  const explicit = env.CURSOR_CONFIG_DIR?.trim();
21300
21400
  if (explicit && isAbsolute6(explicit)) return explicit;
21301
21401
  const xdg = env.XDG_CONFIG_HOME?.trim();
21302
- if (platform2 !== "darwin" && xdg && isAbsolute6(xdg)) return join13(xdg, "cursor");
21303
- return join13(home, ".cursor");
21402
+ if (platform2 !== "darwin" && xdg && isAbsolute6(xdg)) return join14(xdg, "cursor");
21403
+ return join14(home, ".cursor");
21304
21404
  }
21305
21405
  function cursorHooksPath(scope, root = projectRoot()) {
21306
- return scope === "user" ? join13(cursorConfigDirectory(), "hooks.json") : join13(root, ".cursor", "hooks.json");
21406
+ return scope === "user" ? join14(cursorConfigDirectory(), "hooks.json") : join14(root, ".cursor", "hooks.json");
21307
21407
  }
21308
21408
  function plainObject(value) {
21309
21409
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -21312,7 +21412,7 @@ function readCursorHooks(path) {
21312
21412
  if (!existsSync9(path)) return {};
21313
21413
  let parsed;
21314
21414
  try {
21315
- parsed = JSON.parse(readFileSync11(path, "utf8"));
21415
+ parsed = JSON.parse(readFileSync12(path, "utf8"));
21316
21416
  } catch {
21317
21417
  throw new Error(`invalid Cursor hooks JSON at ${path}`);
21318
21418
  }
@@ -21532,8 +21632,8 @@ function extractFileTargets(toolName, toolInput, agent = "claude_code") {
21532
21632
  }
21533
21633
 
21534
21634
  // src/hooks/redact.ts
21535
- import { existsSync as existsSync10, readFileSync as readFileSync12, statSync as statSync5 } from "fs";
21536
- import { join as join14 } from "path";
21635
+ import { existsSync as existsSync10, readFileSync as readFileSync13, statSync as statSync5 } from "fs";
21636
+ import { join as join15 } from "path";
21537
21637
  import { Worker } from "worker_threads";
21538
21638
  var USER_HOME_RULES = [
21539
21639
  {
@@ -21609,7 +21709,7 @@ function normalizedWorkspaceFlags(value) {
21609
21709
  return [...new Set(`g${requested}`)].sort().join("");
21610
21710
  }
21611
21711
  function loadWorkspaceRules(cwd) {
21612
- const path = join14(cwd, WORKSPACE_FILE2);
21712
+ const path = join15(cwd, WORKSPACE_FILE2);
21613
21713
  if (!existsSync10(path)) return [];
21614
21714
  let cfg;
21615
21715
  try {
@@ -21617,7 +21717,7 @@ function loadWorkspaceRules(cwd) {
21617
21717
  debugRedaction(`ignoring oversized ${WORKSPACE_FILE2}`);
21618
21718
  return [];
21619
21719
  }
21620
- cfg = JSON.parse(readFileSync12(path, "utf-8"));
21720
+ cfg = JSON.parse(readFileSync13(path, "utf-8"));
21621
21721
  } catch {
21622
21722
  debugRedaction(`ignoring unparseable ${WORKSPACE_FILE2}`);
21623
21723
  return [];
@@ -26548,25 +26648,25 @@ import {
26548
26648
  mkdirSync as mkdirSync7,
26549
26649
  openSync as openSync3,
26550
26650
  opendirSync,
26551
- readFileSync as readFileSync14,
26651
+ readFileSync as readFileSync15,
26552
26652
  readSync,
26553
26653
  readdirSync as readdirSync4
26554
26654
  } from "fs";
26555
- import { dirname as dirname11, join as join16 } from "path";
26655
+ import { dirname as dirname11, join as join17 } from "path";
26556
26656
 
26557
26657
  // src/drain-progress.ts
26558
26658
  import {
26559
- chmodSync as chmodSync5,
26659
+ chmodSync as chmodSync6,
26560
26660
  existsSync as existsSync11,
26561
- readFileSync as readFileSync13,
26661
+ readFileSync as readFileSync14,
26562
26662
  readdirSync as readdirSync3,
26563
26663
  rmSync as rmSync6,
26564
26664
  rmdirSync
26565
26665
  } from "fs";
26566
- import { basename as basename2, dirname as dirname10, join as join15 } from "path";
26666
+ import { basename as basename2, dirname as dirname10, join as join16 } from "path";
26567
26667
 
26568
26668
  // src/journal.ts
26569
- var JOURNAL_DIR = join16(primConfigDirectory(), "moves");
26669
+ var JOURNAL_DIR = join17(primConfigDirectory(), "moves");
26570
26670
  var UNBOUND_BUCKET = "_unbound";
26571
26671
  var JOURNAL_BASENAME = "journal.ndjson";
26572
26672
  var JOURNAL_STATS_SAMPLE_BYTES = 64 * 1024;
@@ -26578,7 +26678,7 @@ function envSlug(apiUrl) {
26578
26678
  return slug;
26579
26679
  }
26580
26680
  function currentEnvDir() {
26581
- return join16(JOURNAL_DIR, envSlug(getSiteUrl()));
26681
+ return join17(JOURNAL_DIR, envSlug(getSiteUrl()));
26582
26682
  }
26583
26683
  var DIR_MODE = 448;
26584
26684
  var FILE_MODE2 = 384;
@@ -26594,10 +26694,10 @@ function appendMoveToPath(path, move) {
26594
26694
  }
26595
26695
  function bucketDir(orgId) {
26596
26696
  const safe = orgId !== void 0 && SAFE_BUCKET.test(orgId) && !RESERVED_BUCKETS.has(orgId);
26597
- return join16(currentEnvDir(), safe ? orgId : UNBOUND_BUCKET);
26697
+ return join17(currentEnvDir(), safe ? orgId : UNBOUND_BUCKET);
26598
26698
  }
26599
26699
  function journalPath(orgId) {
26600
- return join16(bucketDir(orgId), JOURNAL_BASENAME);
26700
+ return join17(bucketDir(orgId), JOURNAL_BASENAME);
26601
26701
  }
26602
26702
  function appendMove(move, orgId) {
26603
26703
  appendMoveToPath(journalPath(orgId), move);
@@ -26769,7 +26869,7 @@ function editingToolsFor(agent) {
26769
26869
  var here = dirname12(fileURLToPath2(import.meta.url));
26770
26870
  function resolveCliVersion() {
26771
26871
  try {
26772
- const pkg = JSON.parse(readFileSync15(join17(here, "..", "..", "package.json"), "utf-8"));
26872
+ const pkg = JSON.parse(readFileSync16(join18(here, "..", "..", "package.json"), "utf-8"));
26773
26873
  return pkg.version ?? "unknown";
26774
26874
  } catch {
26775
26875
  return "unknown";