@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.
- package/README.md +11 -0
- package/dist/{chunk-7IPGD6CD.js → chunk-25DDRMWS.js} +2 -2
- package/dist/{chunk-B6EPQ4YH.js → chunk-2IRLFOEL.js} +123 -19
- package/dist/{chunk-WKLYYT63.js → chunk-2Q3OGSTV.js} +3 -3
- package/dist/{chunk-2DPLT2CQ.js → chunk-5LRKJTLA.js} +1 -1
- package/dist/{chunk-AN6XTFIN.js → chunk-6C3CCVDI.js} +2 -2
- package/dist/{chunk-NIQAVFP6.js → chunk-7VIMU2HR.js} +1 -1
- package/dist/{chunk-2DA2B4EC.js → chunk-EJPKZT5M.js} +2 -2
- package/dist/{chunk-HUZXBJJ5.js → chunk-FK7FJPWS.js} +1 -1
- package/dist/{chunk-QPMLAD2C.js → chunk-JJI7FU24.js} +2 -2
- package/dist/{chunk-PPZBEOWK.js → chunk-JJYS7IPD.js} +3 -3
- package/dist/{chunk-RT7DXMTN.js → chunk-K4JWJ6OM.js} +79 -266
- package/dist/{chunk-3X77XQGW.js → chunk-KGBMU76T.js} +1 -1
- package/dist/{chunk-JOR67B5T.js → chunk-O2WV5SQZ.js} +8 -8
- package/dist/{chunk-IL443QTF.js → chunk-X5BN67D2.js} +2 -2
- package/dist/{chunk-6QK75B7G.js → chunk-XG7S3LIL.js} +214 -11
- package/dist/{chunk-MN4X6RR6.js → chunk-XPS6LG6I.js} +5 -7
- package/dist/{chunk-BIAWZMCK.js → chunk-ZNLIGT3J.js} +2 -2
- package/dist/daemon/server.js +247 -180
- package/dist/hook-runtime/daemon/server.js +247 -180
- package/dist/hook-runtime/hooks/post-commit.js +114 -59
- package/dist/hook-runtime/hooks/post-rewrite.js +109 -54
- package/dist/hook-runtime/hooks/post-tool-use.js +256 -156
- package/dist/hook-runtime/hooks/pre-commit.js +177 -33
- package/dist/hook-runtime/hooks/pre-tool-use.js +237 -137
- package/dist/hook-runtime/hooks/prim-hook.js +281 -181
- package/dist/hook-runtime/hooks/session-start.js +209 -109
- package/dist/hook-runtime/index.js +615 -515
- package/dist/hook-runtime/statusline-main.js +71 -16
- package/dist/hooks/post-commit.js +7 -7
- package/dist/hooks/post-rewrite.js +6 -6
- package/dist/hooks/post-tool-use.js +13 -13
- package/dist/hooks/pre-commit.js +4 -4
- package/dist/hooks/pre-tool-use.js +10 -11
- package/dist/hooks/prim-hook.js +14 -14
- package/dist/hooks/session-end.js +4 -4
- package/dist/hooks/session-start.js +11 -11
- package/dist/index.js +20 -20
- package/dist/statusline-main.js +71 -16
- package/package.json +1 -1
|
@@ -57,13 +57,13 @@ import {
|
|
|
57
57
|
constants as constants3,
|
|
58
58
|
closeSync as closeSync4,
|
|
59
59
|
fstatSync as fstatSync2,
|
|
60
|
-
lstatSync as
|
|
60
|
+
lstatSync as lstatSync4,
|
|
61
61
|
openSync as openSync4,
|
|
62
|
-
readFileSync as
|
|
62
|
+
readFileSync as readFileSync12,
|
|
63
63
|
unlinkSync as unlinkSync2
|
|
64
64
|
} from "fs";
|
|
65
|
-
import { basename as basename3, dirname as
|
|
66
|
-
import { fileURLToPath } from "url";
|
|
65
|
+
import { basename as basename3, dirname as dirname10, isAbsolute as isAbsolute5, join as join13 } from "path";
|
|
66
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
67
67
|
|
|
68
68
|
// src/binding.ts
|
|
69
69
|
import { existsSync, readFileSync as readFileSync2 } from "fs";
|
|
@@ -379,21 +379,21 @@ function resolveOrg(args) {
|
|
|
379
379
|
import {
|
|
380
380
|
appendFileSync,
|
|
381
381
|
closeSync as closeSync2,
|
|
382
|
-
existsSync as
|
|
382
|
+
existsSync as existsSync6,
|
|
383
383
|
fstatSync,
|
|
384
384
|
mkdirSync as mkdirSync4,
|
|
385
385
|
openSync as openSync2,
|
|
386
386
|
opendirSync,
|
|
387
|
-
readFileSync as
|
|
387
|
+
readFileSync as readFileSync8,
|
|
388
388
|
readSync,
|
|
389
389
|
readdirSync as readdirSync2
|
|
390
390
|
} from "fs";
|
|
391
|
-
import { dirname as
|
|
391
|
+
import { dirname as dirname7, join as join9 } from "path";
|
|
392
392
|
|
|
393
393
|
// src/client.ts
|
|
394
394
|
import { createHash as createHash2 } from "crypto";
|
|
395
|
-
import { chmodSync, existsSync as
|
|
396
|
-
import { dirname as
|
|
395
|
+
import { chmodSync as chmodSync2, existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync6, rmSync as rmSync3 } from "fs";
|
|
396
|
+
import { dirname as dirname5 } from "path";
|
|
397
397
|
|
|
398
398
|
// src/lib/atomic-file.ts
|
|
399
399
|
import { randomUUID } from "crypto";
|
|
@@ -416,6 +416,61 @@ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as rea
|
|
|
416
416
|
import { dirname as dirname3, join as join4 } from "path";
|
|
417
417
|
var syncSleeper = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
|
418
418
|
|
|
419
|
+
// src/daemon/client-instance-id.ts
|
|
420
|
+
import { randomBytes as randomBytes2 } from "crypto";
|
|
421
|
+
import { chmodSync, lstatSync, readFileSync as readFileSync4 } from "fs";
|
|
422
|
+
import { join as join5 } from "path";
|
|
423
|
+
var INSTANCE_BODY_CHARS = 43;
|
|
424
|
+
var INSTANCE_PREFIX = "pci_";
|
|
425
|
+
var MAX_STORED_BYTES = INSTANCE_PREFIX.length + INSTANCE_BODY_CHARS + 1;
|
|
426
|
+
|
|
427
|
+
// src/lib/bin-path.ts
|
|
428
|
+
import { existsSync as existsSync3, readFileSync as readFileSync5 } from "fs";
|
|
429
|
+
import { dirname as dirname4, isAbsolute as isAbsolute2, join as join6 } from "path";
|
|
430
|
+
import { fileURLToPath } from "url";
|
|
431
|
+
var PKG_NAME = "@primitive.ai/prim";
|
|
432
|
+
var ROOT_WALK_LIMIT = 6;
|
|
433
|
+
var resolvedRoot;
|
|
434
|
+
function locateRoot() {
|
|
435
|
+
if (resolvedRoot !== void 0) {
|
|
436
|
+
return resolvedRoot;
|
|
437
|
+
}
|
|
438
|
+
let dir = dirname4(fileURLToPath(import.meta.url));
|
|
439
|
+
for (let depth = 0; depth < ROOT_WALK_LIMIT; depth++) {
|
|
440
|
+
const manifestPath = join6(dir, "package.json");
|
|
441
|
+
if (existsSync3(manifestPath)) {
|
|
442
|
+
try {
|
|
443
|
+
const manifest = JSON.parse(readFileSync5(manifestPath, "utf-8"));
|
|
444
|
+
if (manifest.name === PKG_NAME && manifest.bin) {
|
|
445
|
+
resolvedRoot = { dir, version: manifest.version, bin: manifest.bin };
|
|
446
|
+
return resolvedRoot;
|
|
447
|
+
}
|
|
448
|
+
} catch {
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
const parent = dirname4(dir);
|
|
452
|
+
if (parent === dir) {
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
dir = parent;
|
|
456
|
+
}
|
|
457
|
+
resolvedRoot = null;
|
|
458
|
+
return resolvedRoot;
|
|
459
|
+
}
|
|
460
|
+
function packageVersion() {
|
|
461
|
+
return locateRoot()?.version ?? null;
|
|
462
|
+
}
|
|
463
|
+
var PRIM_CONFIG_SHELL_RESOLVER = [
|
|
464
|
+
'prim_absolute() { case "$1" in [/]* ) ;; *) return 1 ;; esac; case "$1" in [[:space:]]*|*[[:space:]]|*[/][/]*|*[/].[/]*|*[/]..[/]*|*[/].|*[/]..|?*[/]) return 1 ;; esac; }; ',
|
|
465
|
+
'prim_config=${PRIM_CONFIG_DIR:-}; if ! prim_absolute "$prim_config"; then prim_config=${XDG_CONFIG_HOME:-}; if prim_absolute "$prim_config"; then ',
|
|
466
|
+
'case "$prim_config" in /) prim_config=/prim ;; *) prim_config="$prim_config/prim" ;; esac; ',
|
|
467
|
+
'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; ',
|
|
468
|
+
"fi; fi; "
|
|
469
|
+
].join("");
|
|
470
|
+
|
|
471
|
+
// src/lib/ingest-uploader.ts
|
|
472
|
+
var runtimeVersion = process.env.PRIM_RUNTIME_VERSION ?? packageVersion();
|
|
473
|
+
|
|
419
474
|
// src/client.ts
|
|
420
475
|
var DEFAULT_API_URL = "https://api.getprimitive.ai";
|
|
421
476
|
function getSiteUrl() {
|
|
@@ -428,17 +483,17 @@ var CLI_MANAGEMENT_RESPONSE_MAX_BYTES = 2 * 1024 * 1024;
|
|
|
428
483
|
|
|
429
484
|
// src/drain-progress.ts
|
|
430
485
|
import {
|
|
431
|
-
chmodSync as
|
|
432
|
-
existsSync as
|
|
433
|
-
readFileSync as
|
|
486
|
+
chmodSync as chmodSync3,
|
|
487
|
+
existsSync as existsSync5,
|
|
488
|
+
readFileSync as readFileSync7,
|
|
434
489
|
readdirSync,
|
|
435
490
|
rmSync as rmSync4,
|
|
436
491
|
rmdirSync
|
|
437
492
|
} from "fs";
|
|
438
|
-
import { basename, dirname as
|
|
493
|
+
import { basename, dirname as dirname6, join as join8 } from "path";
|
|
439
494
|
|
|
440
495
|
// src/journal.ts
|
|
441
|
-
var JOURNAL_DIR =
|
|
496
|
+
var JOURNAL_DIR = join9(primConfigDirectory(), "moves");
|
|
442
497
|
var UNBOUND_BUCKET = "_unbound";
|
|
443
498
|
var JOURNAL_BASENAME = "journal.ndjson";
|
|
444
499
|
var JOURNAL_STATS_SAMPLE_BYTES = 64 * 1024;
|
|
@@ -450,15 +505,15 @@ function envSlug(apiUrl) {
|
|
|
450
505
|
return slug;
|
|
451
506
|
}
|
|
452
507
|
function currentEnvDir() {
|
|
453
|
-
return
|
|
508
|
+
return join9(JOURNAL_DIR, envSlug(getSiteUrl()));
|
|
454
509
|
}
|
|
455
510
|
var DIR_MODE = 448;
|
|
456
511
|
var FILE_MODE = 384;
|
|
457
512
|
var SAFE_BUCKET = /^[A-Za-z0-9_-]+$/;
|
|
458
513
|
var RESERVED_BUCKETS = /* @__PURE__ */ new Set([UNBOUND_BUCKET, "_legacy"]);
|
|
459
514
|
function appendMoveToPath(path, move) {
|
|
460
|
-
const dir =
|
|
461
|
-
if (!
|
|
515
|
+
const dir = dirname7(path);
|
|
516
|
+
if (!existsSync6(dir)) {
|
|
462
517
|
mkdirSync4(dir, { recursive: true, mode: DIR_MODE });
|
|
463
518
|
}
|
|
464
519
|
appendFileSync(path, `${JSON.stringify(move)}
|
|
@@ -466,10 +521,10 @@ function appendMoveToPath(path, move) {
|
|
|
466
521
|
}
|
|
467
522
|
function bucketDir(orgId) {
|
|
468
523
|
const safe = orgId !== void 0 && SAFE_BUCKET.test(orgId) && !RESERVED_BUCKETS.has(orgId);
|
|
469
|
-
return
|
|
524
|
+
return join9(currentEnvDir(), safe ? orgId : UNBOUND_BUCKET);
|
|
470
525
|
}
|
|
471
526
|
function journalPath(orgId) {
|
|
472
|
-
return
|
|
527
|
+
return join9(bucketDir(orgId), JOURNAL_BASENAME);
|
|
473
528
|
}
|
|
474
529
|
function appendMove(move, orgId) {
|
|
475
530
|
appendMoveToPath(journalPath(orgId), move);
|
|
@@ -478,15 +533,15 @@ var FLUSHING_PREFIX = `${JOURNAL_BASENAME}.flushing.`;
|
|
|
478
533
|
|
|
479
534
|
// src/lib/activation.ts
|
|
480
535
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
481
|
-
import { existsSync as
|
|
536
|
+
import { existsSync as existsSync7, readFileSync as readFileSync9 } from "fs";
|
|
482
537
|
import { homedir as homedir2 } from "os";
|
|
483
|
-
import { join as
|
|
538
|
+
import { join as join10 } from "path";
|
|
484
539
|
|
|
485
540
|
// src/lib/git.ts
|
|
486
541
|
import { execFileSync } from "child_process";
|
|
487
542
|
import { createHash as createHash3 } from "crypto";
|
|
488
|
-
import { lstatSync, realpathSync } from "fs";
|
|
489
|
-
import { basename as basename2, dirname as
|
|
543
|
+
import { lstatSync as lstatSync2, realpathSync } from "fs";
|
|
544
|
+
import { basename as basename2, dirname as dirname8, isAbsolute as isAbsolute3, relative, resolve as resolve2, sep } from "path";
|
|
490
545
|
var GIT_TIMEOUT_MS = 1e3;
|
|
491
546
|
var GITHUB_OWNER_PATTERN = /^(?![A-Za-z0-9-]*--)[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/u;
|
|
492
547
|
var GITHUB_REPOSITORY_PATTERN = /^[A-Za-z0-9._-]{1,100}$/u;
|
|
@@ -634,10 +689,10 @@ function hasProjectPrimInstall(cwd) {
|
|
|
634
689
|
const root = gitToplevel(cwd);
|
|
635
690
|
if (root === null || root === homedir2()) return false;
|
|
636
691
|
for (const rel of PROJECT_INSTALL_FILES) {
|
|
637
|
-
const path =
|
|
638
|
-
if (
|
|
692
|
+
const path = join10(root, rel);
|
|
693
|
+
if (existsSync7(path)) {
|
|
639
694
|
try {
|
|
640
|
-
const content =
|
|
695
|
+
const content = readFileSync9(path, "utf-8");
|
|
641
696
|
if (PRIM_HOOK_BINS.some((bin) => content.includes(bin))) return true;
|
|
642
697
|
} catch {
|
|
643
698
|
}
|
|
@@ -19162,21 +19217,21 @@ import { execFileSync as execFileSync3 } from "child_process";
|
|
|
19162
19217
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
19163
19218
|
import {
|
|
19164
19219
|
constants as constants2,
|
|
19165
|
-
chmodSync as
|
|
19220
|
+
chmodSync as chmodSync4,
|
|
19166
19221
|
closeSync as closeSync3,
|
|
19167
19222
|
fchmodSync as fchmodSync2,
|
|
19168
19223
|
fsyncSync as fsyncSync2,
|
|
19169
19224
|
linkSync,
|
|
19170
|
-
lstatSync as
|
|
19225
|
+
lstatSync as lstatSync3,
|
|
19171
19226
|
mkdirSync as mkdirSync5,
|
|
19172
19227
|
openSync as openSync3,
|
|
19173
|
-
readFileSync as
|
|
19228
|
+
readFileSync as readFileSync10,
|
|
19174
19229
|
statSync as statSync2,
|
|
19175
19230
|
unlinkSync,
|
|
19176
19231
|
writeFileSync as writeFileSync3
|
|
19177
19232
|
} from "fs";
|
|
19178
|
-
import { dirname as
|
|
19179
|
-
var WORKSPACE_ID_RELATIVE_PATH =
|
|
19233
|
+
import { dirname as dirname9, isAbsolute as isAbsolute4, join as join11, resolve as resolve3 } from "path";
|
|
19234
|
+
var WORKSPACE_ID_RELATIVE_PATH = join11("prim", "workspace-id");
|
|
19180
19235
|
var MAX_ANCESTORS = 64;
|
|
19181
19236
|
var MAX_GIT_FILE_BYTES = 4096;
|
|
19182
19237
|
var MAX_ID_FILE_BYTES = 128;
|
|
@@ -19222,7 +19277,7 @@ function resolveWorkspaceIdPath(cwd) {
|
|
|
19222
19277
|
}
|
|
19223
19278
|
return {
|
|
19224
19279
|
status: "resolved",
|
|
19225
|
-
path:
|
|
19280
|
+
path: isAbsolute4(gitPath) ? resolve3(gitPath) : resolve3(cwd, gitPath)
|
|
19226
19281
|
};
|
|
19227
19282
|
} catch (error) {
|
|
19228
19283
|
const code = errorCode(error);
|
|
@@ -19235,19 +19290,19 @@ function resolveWorkspaceIdPath(cwd) {
|
|
|
19235
19290
|
function resolveFromFilesystem(cwd) {
|
|
19236
19291
|
let current = resolve3(cwd);
|
|
19237
19292
|
for (let depth = 0; depth < MAX_ANCESTORS; depth += 1) {
|
|
19238
|
-
const dotGit =
|
|
19293
|
+
const dotGit = join11(current, ".git");
|
|
19239
19294
|
try {
|
|
19240
|
-
const stat =
|
|
19295
|
+
const stat = lstatSync3(dotGit);
|
|
19241
19296
|
if (stat.isDirectory() && isGitDirectory(dotGit)) {
|
|
19242
|
-
return
|
|
19297
|
+
return join11(dotGit, WORKSPACE_ID_RELATIVE_PATH);
|
|
19243
19298
|
}
|
|
19244
19299
|
if (stat.isFile() && stat.size <= MAX_GIT_FILE_BYTES) {
|
|
19245
|
-
const contents =
|
|
19300
|
+
const contents = readFileSync10(dotGit, "utf8");
|
|
19246
19301
|
const match = /^gitdir: (.+?)(?:\r?\n)?$/.exec(contents);
|
|
19247
19302
|
if (match?.[1]) {
|
|
19248
|
-
const gitDirectory =
|
|
19303
|
+
const gitDirectory = isAbsolute4(match[1]) ? resolve3(match[1]) : resolve3(current, match[1]);
|
|
19249
19304
|
if (isGitDirectory(gitDirectory)) {
|
|
19250
|
-
return
|
|
19305
|
+
return join11(gitDirectory, WORKSPACE_ID_RELATIVE_PATH);
|
|
19251
19306
|
}
|
|
19252
19307
|
}
|
|
19253
19308
|
}
|
|
@@ -19258,7 +19313,7 @@ function resolveFromFilesystem(cwd) {
|
|
|
19258
19313
|
return null;
|
|
19259
19314
|
}
|
|
19260
19315
|
}
|
|
19261
|
-
const parent =
|
|
19316
|
+
const parent = dirname9(current);
|
|
19262
19317
|
if (parent === current) break;
|
|
19263
19318
|
current = parent;
|
|
19264
19319
|
}
|
|
@@ -19266,7 +19321,7 @@ function resolveFromFilesystem(cwd) {
|
|
|
19266
19321
|
}
|
|
19267
19322
|
function isGitDirectory(path) {
|
|
19268
19323
|
try {
|
|
19269
|
-
return statSync2(
|
|
19324
|
+
return statSync2(join11(path, "HEAD")).isFile();
|
|
19270
19325
|
} catch {
|
|
19271
19326
|
return false;
|
|
19272
19327
|
}
|
|
@@ -19274,7 +19329,7 @@ function isGitDirectory(path) {
|
|
|
19274
19329
|
function inspectPath(path) {
|
|
19275
19330
|
let stat;
|
|
19276
19331
|
try {
|
|
19277
|
-
stat =
|
|
19332
|
+
stat = lstatSync3(path);
|
|
19278
19333
|
} catch (error) {
|
|
19279
19334
|
const code = errorCode(error);
|
|
19280
19335
|
if (code === "ENOENT" || code === "ENOTDIR") return { status: "missing", path };
|
|
@@ -19285,7 +19340,7 @@ function inspectPath(path) {
|
|
|
19285
19340
|
return { status: "corrupt", path, reason: "invalid_content" };
|
|
19286
19341
|
}
|
|
19287
19342
|
try {
|
|
19288
|
-
const contents =
|
|
19343
|
+
const contents = readFileSync10(path, "utf8");
|
|
19289
19344
|
const workspaceId = contents.endsWith("\n") ? contents.slice(0, -1) : contents;
|
|
19290
19345
|
if ((contents === workspaceId || contents === `${workspaceId}
|
|
19291
19346
|
`) && isCanonicalWorkspaceId(workspaceId)) {
|
|
@@ -19302,14 +19357,14 @@ function inspectPath(path) {
|
|
|
19302
19357
|
}
|
|
19303
19358
|
}
|
|
19304
19359
|
function createWorkspaceId(path) {
|
|
19305
|
-
const parent =
|
|
19360
|
+
const parent = dirname9(path);
|
|
19306
19361
|
const workspaceId = randomUUID2();
|
|
19307
|
-
const temporaryPath =
|
|
19362
|
+
const temporaryPath = join11(parent, `.workspace-id-${process.pid}-${randomUUID2()}.tmp`);
|
|
19308
19363
|
let temporaryCreated = false;
|
|
19309
19364
|
let publishing = false;
|
|
19310
19365
|
try {
|
|
19311
19366
|
mkdirSync5(parent, { recursive: true, mode: 448 });
|
|
19312
|
-
|
|
19367
|
+
chmodSync4(parent, 448);
|
|
19313
19368
|
const fd = openSync3(
|
|
19314
19369
|
temporaryPath,
|
|
19315
19370
|
constants2.O_CREAT | constants2.O_EXCL | constants2.O_WRONLY,
|
|
@@ -19372,8 +19427,8 @@ var LEGACY_ENVELOPE_VERSION = 1;
|
|
|
19372
19427
|
var ENVELOPE_VERSION = LEGACY_ENVELOPE_VERSION;
|
|
19373
19428
|
|
|
19374
19429
|
// src/hooks/redact.ts
|
|
19375
|
-
import { existsSync as
|
|
19376
|
-
import { join as
|
|
19430
|
+
import { existsSync as existsSync8, readFileSync as readFileSync11, statSync as statSync3 } from "fs";
|
|
19431
|
+
import { join as join12 } from "path";
|
|
19377
19432
|
import { Worker } from "worker_threads";
|
|
19378
19433
|
var USER_HOME_RULES = [
|
|
19379
19434
|
{
|
|
@@ -19552,7 +19607,7 @@ function toRewriteMove(rewrite, cliVersion, cwd, context) {
|
|
|
19552
19607
|
}
|
|
19553
19608
|
|
|
19554
19609
|
// src/hooks/post-rewrite.ts
|
|
19555
|
-
var here =
|
|
19610
|
+
var here = dirname10(fileURLToPath2(import.meta.url));
|
|
19556
19611
|
var GIT_TIMEOUT_MS3 = 1e3;
|
|
19557
19612
|
var MAX_PAIRS_FILE_BYTES = 1048576;
|
|
19558
19613
|
var MAX_PAIRS_FILE_AGE_MS = 10 * 60 * 1e3;
|
|
@@ -19582,17 +19637,17 @@ function privatePairsFileStat(stat, now) {
|
|
|
19582
19637
|
}
|
|
19583
19638
|
function rewritePairsFromLauncher(env = process.env, now = Date.now()) {
|
|
19584
19639
|
const path = env.PRIM_REWRITE_PAIRS_FILE;
|
|
19585
|
-
if (!path || !
|
|
19640
|
+
if (!path || !isAbsolute5(path) || !PAIRS_FILE_RE.test(basename3(path))) return;
|
|
19586
19641
|
let fd;
|
|
19587
19642
|
try {
|
|
19588
|
-
const pathStat =
|
|
19643
|
+
const pathStat = lstatSync4(path);
|
|
19589
19644
|
if (!privatePairsFileStat(pathStat, now)) return;
|
|
19590
19645
|
fd = openSync4(path, constants3.O_RDONLY | constants3.O_NOFOLLOW);
|
|
19591
19646
|
const openStat = fstatSync2(fd);
|
|
19592
19647
|
if (!privatePairsFileStat(openStat, now) || openStat.dev !== pathStat.dev || openStat.ino !== pathStat.ino) {
|
|
19593
19648
|
return;
|
|
19594
19649
|
}
|
|
19595
|
-
const bytes =
|
|
19650
|
+
const bytes = readFileSync12(fd);
|
|
19596
19651
|
if (bytes.length !== openStat.size) return;
|
|
19597
19652
|
let text;
|
|
19598
19653
|
try {
|
|
@@ -19622,7 +19677,7 @@ function rewritePairsFromLauncher(env = process.env, now = Date.now()) {
|
|
|
19622
19677
|
}
|
|
19623
19678
|
function unlinkSnapshot(snapshot) {
|
|
19624
19679
|
try {
|
|
19625
|
-
const current =
|
|
19680
|
+
const current = lstatSync4(snapshot.path);
|
|
19626
19681
|
if (current.isFile() && !current.isSymbolicLink() && current.dev === snapshot.dev && current.ino === snapshot.ino) {
|
|
19627
19682
|
unlinkSync2(snapshot.path);
|
|
19628
19683
|
}
|
|
@@ -19648,14 +19703,14 @@ function validBranch(value) {
|
|
|
19648
19703
|
}
|
|
19649
19704
|
function resolveCliVersion() {
|
|
19650
19705
|
try {
|
|
19651
|
-
const pkg = JSON.parse(
|
|
19706
|
+
const pkg = JSON.parse(readFileSync12(join13(here, "..", "..", "package.json"), "utf-8"));
|
|
19652
19707
|
return pkg.version ?? "unknown";
|
|
19653
19708
|
} catch {
|
|
19654
19709
|
return "unknown";
|
|
19655
19710
|
}
|
|
19656
19711
|
}
|
|
19657
19712
|
function spawnBackgroundFlush() {
|
|
19658
|
-
const entry =
|
|
19713
|
+
const entry = join13(here, "..", "index.js");
|
|
19659
19714
|
spawn(process.execPath, [entry, "moves", "flush"], {
|
|
19660
19715
|
detached: true,
|
|
19661
19716
|
stdio: "ignore",
|