@primitive.ai/prim 0.1.0-alpha.91 → 0.1.0-alpha.92
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/{chunk-EWZMDD44.js → chunk-26P57LAR.js} +19 -2
- package/dist/{chunk-HU4PW6I6.js → chunk-5HRR4AOR.js} +1 -1
- package/dist/{chunk-VW3FDYRT.js → chunk-ADUTW66W.js} +1 -1
- package/dist/{chunk-FOLKHXLJ.js → chunk-LGGMJYY4.js} +1 -1
- package/dist/daemon/server.js +10 -1
- package/dist/hook-runtime/daemon/server.js +10 -1
- package/dist/hook-runtime/hooks/post-tool-use.js +16 -16
- package/dist/hook-runtime/hooks/pre-tool-use.js +16 -16
- package/dist/hook-runtime/hooks/prim-hook.js +16 -16
- package/dist/hook-runtime/hooks/session-end.js +1 -1
- package/dist/hook-runtime/hooks/session-start.js +1 -1
- package/dist/hook-runtime/index.js +29 -3
- package/dist/hooks/post-tool-use.js +3 -3
- package/dist/hooks/pre-tool-use.js +3 -3
- package/dist/hooks/prim-hook.js +3 -3
- package/dist/hooks/session-end.js +2 -2
- package/dist/hooks/session-start.js +4 -4
- package/dist/index.js +12 -3
- package/package.json +1 -1
|
@@ -219,7 +219,7 @@ import {
|
|
|
219
219
|
utimesSync,
|
|
220
220
|
writeFileSync
|
|
221
221
|
} from "fs";
|
|
222
|
-
import { dirname as dirname2, isAbsolute as isAbsolute2, join as join2, resolve } from "path";
|
|
222
|
+
import { delimiter, dirname as dirname2, isAbsolute as isAbsolute2, join as join2, resolve } from "path";
|
|
223
223
|
var HOOK_RUNTIME_SCHEMA_VERSION = 1;
|
|
224
224
|
var DIRECTORY_MODE = 448;
|
|
225
225
|
var DATA_FILE_MODE = 384;
|
|
@@ -569,11 +569,28 @@ function writeRelease(sourceDir, releaseDir, manifest, releasesDir) {
|
|
|
569
569
|
rmSync(stagingDir, { recursive: true, force: true });
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
|
+
function stableNodePath(execPath = process.execPath, searchPath = process.env.PATH ?? "") {
|
|
573
|
+
let target;
|
|
574
|
+
try {
|
|
575
|
+
target = realpathSync(execPath);
|
|
576
|
+
} catch {
|
|
577
|
+
return execPath;
|
|
578
|
+
}
|
|
579
|
+
for (const directory of searchPath.split(delimiter)) {
|
|
580
|
+
if (!isAbsolute2(directory)) continue;
|
|
581
|
+
const candidate = join2(directory, "node");
|
|
582
|
+
try {
|
|
583
|
+
if (realpathSync(candidate) === target) return candidate;
|
|
584
|
+
} catch {
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return execPath;
|
|
588
|
+
}
|
|
572
589
|
function stageHookRuntime(options = {}) {
|
|
573
590
|
const root = packageRoot();
|
|
574
591
|
const sourceDir = options.sourceDir ?? (root ? join2(root, "dist", "hook-runtime") : null);
|
|
575
592
|
const version = options.version ?? packageVersion();
|
|
576
|
-
const nodePath = resolve(options.nodePath ??
|
|
593
|
+
const nodePath = resolve(options.nodePath ?? stableNodePath());
|
|
577
594
|
if (!sourceDir || !version || compareSemver(version, version) !== 0 || !isAbsolute2(nodePath) || /[\r\n]/u.test(nodePath)) {
|
|
578
595
|
throw new Error("cannot stage hook runtime: package identity is unavailable");
|
|
579
596
|
}
|
package/dist/daemon/server.js
CHANGED
|
@@ -19731,6 +19731,12 @@ function deadLetterReason(error) {
|
|
|
19731
19731
|
}
|
|
19732
19732
|
return void 0;
|
|
19733
19733
|
}
|
|
19734
|
+
function mayBeBatchSizeFailure(error) {
|
|
19735
|
+
if (error instanceof HttpError) {
|
|
19736
|
+
return error.status >= 500 && error.status !== 503;
|
|
19737
|
+
}
|
|
19738
|
+
return error instanceof Error && error.name === "TimeoutError";
|
|
19739
|
+
}
|
|
19734
19740
|
async function* rawJournalLines(input) {
|
|
19735
19741
|
let pending = [];
|
|
19736
19742
|
let pendingBytes = 0;
|
|
@@ -19772,7 +19778,7 @@ async function drainFlushingPath(flushingPath, client2, binding, options = {}) {
|
|
|
19772
19778
|
return { flushed: batch2.length, quarantined: 0 };
|
|
19773
19779
|
} catch (error) {
|
|
19774
19780
|
const reason = deadLetterReason(error);
|
|
19775
|
-
if (!reason) {
|
|
19781
|
+
if (!(reason || mayBeBatchSizeFailure(error))) {
|
|
19776
19782
|
throw error;
|
|
19777
19783
|
}
|
|
19778
19784
|
if (batch2.length > 1) {
|
|
@@ -19781,6 +19787,9 @@ async function drainFlushingPath(flushingPath, client2, binding, options = {}) {
|
|
|
19781
19787
|
const right = await postBatch(batch2.slice(midpoint));
|
|
19782
19788
|
return addDrainCounts(left, right);
|
|
19783
19789
|
}
|
|
19790
|
+
if (!reason) {
|
|
19791
|
+
throw error;
|
|
19792
|
+
}
|
|
19784
19793
|
const [move] = batch2;
|
|
19785
19794
|
const quarantined = quarantineMove(
|
|
19786
19795
|
flushingPath,
|
|
@@ -19731,6 +19731,12 @@ function deadLetterReason(error) {
|
|
|
19731
19731
|
}
|
|
19732
19732
|
return void 0;
|
|
19733
19733
|
}
|
|
19734
|
+
function mayBeBatchSizeFailure(error) {
|
|
19735
|
+
if (error instanceof HttpError) {
|
|
19736
|
+
return error.status >= 500 && error.status !== 503;
|
|
19737
|
+
}
|
|
19738
|
+
return error instanceof Error && error.name === "TimeoutError";
|
|
19739
|
+
}
|
|
19734
19740
|
async function* rawJournalLines(input) {
|
|
19735
19741
|
let pending = [];
|
|
19736
19742
|
let pendingBytes = 0;
|
|
@@ -19772,7 +19778,7 @@ async function drainFlushingPath(flushingPath, client2, binding, options = {}) {
|
|
|
19772
19778
|
return { flushed: batch2.length, quarantined: 0 };
|
|
19773
19779
|
} catch (error) {
|
|
19774
19780
|
const reason = deadLetterReason(error);
|
|
19775
|
-
if (!reason) {
|
|
19781
|
+
if (!(reason || mayBeBatchSizeFailure(error))) {
|
|
19776
19782
|
throw error;
|
|
19777
19783
|
}
|
|
19778
19784
|
if (batch2.length > 1) {
|
|
@@ -19781,6 +19787,9 @@ async function drainFlushingPath(flushingPath, client2, binding, options = {}) {
|
|
|
19781
19787
|
const right = await postBatch(batch2.slice(midpoint));
|
|
19782
19788
|
return addDrainCounts(left, right);
|
|
19783
19789
|
}
|
|
19790
|
+
if (!reason) {
|
|
19791
|
+
throw error;
|
|
19792
|
+
}
|
|
19784
19793
|
const [move] = batch2;
|
|
19785
19794
|
const quarantined = quarantineMove(
|
|
19786
19795
|
flushingPath,
|
|
@@ -20598,7 +20598,7 @@ import {
|
|
|
20598
20598
|
utimesSync,
|
|
20599
20599
|
writeFileSync as writeFileSync5
|
|
20600
20600
|
} from "fs";
|
|
20601
|
-
import { dirname as dirname8, isAbsolute as isAbsolute5, join as join11, resolve as resolve4 } from "path";
|
|
20601
|
+
import { delimiter, dirname as dirname8, isAbsolute as isAbsolute5, join as join11, resolve as resolve4 } from "path";
|
|
20602
20602
|
var RELEASE_PREFIX = "release-";
|
|
20603
20603
|
var MAX_MANIFEST_BYTES = 64 * 1024;
|
|
20604
20604
|
var RELEASE_GRACE_MS = 10 * 60 * 1e3;
|
|
@@ -22241,16 +22241,16 @@ var Lexer = class {
|
|
|
22241
22241
|
readHereDocDelimiter() {
|
|
22242
22242
|
const src = this.src;
|
|
22243
22243
|
const len = this.srcEnd;
|
|
22244
|
-
let
|
|
22244
|
+
let delimiter2 = "";
|
|
22245
22245
|
if (this.pos < len && src.charCodeAt(this.pos) === CH_SQUOTE) {
|
|
22246
22246
|
this.pos++;
|
|
22247
22247
|
const start = this.pos;
|
|
22248
22248
|
while (this.pos < len && src.charCodeAt(this.pos) !== CH_SQUOTE)
|
|
22249
22249
|
this.pos++;
|
|
22250
|
-
|
|
22250
|
+
delimiter2 = src.slice(start, this.pos);
|
|
22251
22251
|
if (this.pos < len)
|
|
22252
22252
|
this.pos++;
|
|
22253
|
-
this._hereDelim =
|
|
22253
|
+
this._hereDelim = delimiter2;
|
|
22254
22254
|
this._hereQuoted = true;
|
|
22255
22255
|
return;
|
|
22256
22256
|
} else if (this.pos < len && src.charCodeAt(this.pos) === CH_DQUOTE) {
|
|
@@ -22258,12 +22258,12 @@ var Lexer = class {
|
|
|
22258
22258
|
while (this.pos < len && src.charCodeAt(this.pos) !== CH_DQUOTE) {
|
|
22259
22259
|
if (src.charCodeAt(this.pos) === CH_BACKSLASH)
|
|
22260
22260
|
this.pos++;
|
|
22261
|
-
|
|
22261
|
+
delimiter2 += src[this.pos];
|
|
22262
22262
|
this.pos++;
|
|
22263
22263
|
}
|
|
22264
22264
|
if (this.pos < len)
|
|
22265
22265
|
this.pos++;
|
|
22266
|
-
this._hereDelim =
|
|
22266
|
+
this._hereDelim = delimiter2;
|
|
22267
22267
|
this._hereQuoted = true;
|
|
22268
22268
|
return;
|
|
22269
22269
|
} else if (this.pos < len && src.charCodeAt(this.pos) === CH_BACKSLASH) {
|
|
@@ -22274,11 +22274,11 @@ var Lexer = class {
|
|
|
22274
22274
|
if (c === CH_BACKSLASH)
|
|
22275
22275
|
this.pos++;
|
|
22276
22276
|
if (this.pos < len) {
|
|
22277
|
-
|
|
22277
|
+
delimiter2 += src[this.pos];
|
|
22278
22278
|
this.pos++;
|
|
22279
22279
|
}
|
|
22280
22280
|
}
|
|
22281
|
-
this._hereDelim =
|
|
22281
|
+
this._hereDelim = delimiter2;
|
|
22282
22282
|
this._hereQuoted = true;
|
|
22283
22283
|
return;
|
|
22284
22284
|
} else {
|
|
@@ -22310,9 +22310,9 @@ var Lexer = class {
|
|
|
22310
22310
|
}
|
|
22311
22311
|
this.pendingHereDocs.length = 0;
|
|
22312
22312
|
}
|
|
22313
|
-
readHereDocBody(
|
|
22313
|
+
readHereDocBody(delimiter2, strip) {
|
|
22314
22314
|
const bodyStart = this.pos;
|
|
22315
|
-
const bodyEnd = this.skipHereDocBody(
|
|
22315
|
+
const bodyEnd = this.skipHereDocBody(delimiter2, strip);
|
|
22316
22316
|
return this.src.slice(bodyStart, bodyEnd);
|
|
22317
22317
|
}
|
|
22318
22318
|
// Advance past the heredoc body and its delimiter line; return the body end
|
|
@@ -22320,10 +22320,10 @@ var Lexer = class {
|
|
|
22320
22320
|
// With parenEnds (inside $(...)), a line starting with the delimiter directly
|
|
22321
22321
|
// followed by ")" also terminates the body, resuming at the ")" — bash treats
|
|
22322
22322
|
// the substitution's closing paren as end-of-file for its heredocs.
|
|
22323
|
-
skipHereDocBody(
|
|
22323
|
+
skipHereDocBody(delimiter2, strip, parenEnds = false) {
|
|
22324
22324
|
const src = this.src;
|
|
22325
22325
|
const len = this.srcEnd;
|
|
22326
|
-
const dLen =
|
|
22326
|
+
const dLen = delimiter2.length;
|
|
22327
22327
|
while (this.pos < len) {
|
|
22328
22328
|
let lineStart = this.pos;
|
|
22329
22329
|
let lineEnd = src.indexOf("\n", this.pos);
|
|
@@ -22333,12 +22333,12 @@ var Lexer = class {
|
|
|
22333
22333
|
while (lineStart < lineEnd && src.charCodeAt(lineStart) === CH_TAB)
|
|
22334
22334
|
lineStart++;
|
|
22335
22335
|
}
|
|
22336
|
-
if (lineEnd - lineStart === dLen && src.startsWith(
|
|
22336
|
+
if (lineEnd - lineStart === dLen && src.startsWith(delimiter2, lineStart)) {
|
|
22337
22337
|
const bodyEnd = this.pos;
|
|
22338
22338
|
this.pos = lineEnd < len ? lineEnd + 1 : lineEnd;
|
|
22339
22339
|
return bodyEnd;
|
|
22340
22340
|
}
|
|
22341
|
-
if (parenEnds && lineEnd - lineStart > dLen && src.charCodeAt(lineStart + dLen) === CH_RPAREN && src.startsWith(
|
|
22341
|
+
if (parenEnds && lineEnd - lineStart > dLen && src.charCodeAt(lineStart + dLen) === CH_RPAREN && src.startsWith(delimiter2, lineStart)) {
|
|
22342
22342
|
const bodyEnd = this.pos;
|
|
22343
22343
|
this.pos = lineStart + dLen;
|
|
22344
22344
|
return bodyEnd;
|
|
@@ -25050,7 +25050,7 @@ function safeSedProgram(program) {
|
|
|
25050
25050
|
return true;
|
|
25051
25051
|
const match = /^(?:(?:\d+|\$)(?:,(?:\d+|\$))?)?s(.)(.*)$/s.exec(program);
|
|
25052
25052
|
if (!match || /[\\\nA-Za-z0-9]/.test(match[1])) return false;
|
|
25053
|
-
const
|
|
25053
|
+
const delimiter2 = match[1];
|
|
25054
25054
|
const tail = match[2];
|
|
25055
25055
|
let offset = 0;
|
|
25056
25056
|
for (let section = 0; section < 2; section += 1) {
|
|
@@ -25058,7 +25058,7 @@ function safeSedProgram(program) {
|
|
|
25058
25058
|
while (offset < tail.length) {
|
|
25059
25059
|
if (tail[offset] === "\\") {
|
|
25060
25060
|
offset += 2;
|
|
25061
|
-
} else if (tail[offset] ===
|
|
25061
|
+
} else if (tail[offset] === delimiter2) {
|
|
25062
25062
|
offset += 1;
|
|
25063
25063
|
closed = true;
|
|
25064
25064
|
break;
|
|
@@ -20260,7 +20260,7 @@ import {
|
|
|
20260
20260
|
utimesSync,
|
|
20261
20261
|
writeFileSync as writeFileSync4
|
|
20262
20262
|
} from "fs";
|
|
20263
|
-
import { dirname as dirname6, isAbsolute as isAbsolute4, join as join9, resolve as resolve3 } from "path";
|
|
20263
|
+
import { delimiter, dirname as dirname6, isAbsolute as isAbsolute4, join as join9, resolve as resolve3 } from "path";
|
|
20264
20264
|
var RELEASE_PREFIX = "release-";
|
|
20265
20265
|
var MAX_MANIFEST_BYTES = 64 * 1024;
|
|
20266
20266
|
var RELEASE_GRACE_MS = 10 * 60 * 1e3;
|
|
@@ -22363,16 +22363,16 @@ var Lexer = class {
|
|
|
22363
22363
|
readHereDocDelimiter() {
|
|
22364
22364
|
const src = this.src;
|
|
22365
22365
|
const len = this.srcEnd;
|
|
22366
|
-
let
|
|
22366
|
+
let delimiter2 = "";
|
|
22367
22367
|
if (this.pos < len && src.charCodeAt(this.pos) === CH_SQUOTE) {
|
|
22368
22368
|
this.pos++;
|
|
22369
22369
|
const start = this.pos;
|
|
22370
22370
|
while (this.pos < len && src.charCodeAt(this.pos) !== CH_SQUOTE)
|
|
22371
22371
|
this.pos++;
|
|
22372
|
-
|
|
22372
|
+
delimiter2 = src.slice(start, this.pos);
|
|
22373
22373
|
if (this.pos < len)
|
|
22374
22374
|
this.pos++;
|
|
22375
|
-
this._hereDelim =
|
|
22375
|
+
this._hereDelim = delimiter2;
|
|
22376
22376
|
this._hereQuoted = true;
|
|
22377
22377
|
return;
|
|
22378
22378
|
} else if (this.pos < len && src.charCodeAt(this.pos) === CH_DQUOTE) {
|
|
@@ -22380,12 +22380,12 @@ var Lexer = class {
|
|
|
22380
22380
|
while (this.pos < len && src.charCodeAt(this.pos) !== CH_DQUOTE) {
|
|
22381
22381
|
if (src.charCodeAt(this.pos) === CH_BACKSLASH)
|
|
22382
22382
|
this.pos++;
|
|
22383
|
-
|
|
22383
|
+
delimiter2 += src[this.pos];
|
|
22384
22384
|
this.pos++;
|
|
22385
22385
|
}
|
|
22386
22386
|
if (this.pos < len)
|
|
22387
22387
|
this.pos++;
|
|
22388
|
-
this._hereDelim =
|
|
22388
|
+
this._hereDelim = delimiter2;
|
|
22389
22389
|
this._hereQuoted = true;
|
|
22390
22390
|
return;
|
|
22391
22391
|
} else if (this.pos < len && src.charCodeAt(this.pos) === CH_BACKSLASH) {
|
|
@@ -22396,11 +22396,11 @@ var Lexer = class {
|
|
|
22396
22396
|
if (c === CH_BACKSLASH)
|
|
22397
22397
|
this.pos++;
|
|
22398
22398
|
if (this.pos < len) {
|
|
22399
|
-
|
|
22399
|
+
delimiter2 += src[this.pos];
|
|
22400
22400
|
this.pos++;
|
|
22401
22401
|
}
|
|
22402
22402
|
}
|
|
22403
|
-
this._hereDelim =
|
|
22403
|
+
this._hereDelim = delimiter2;
|
|
22404
22404
|
this._hereQuoted = true;
|
|
22405
22405
|
return;
|
|
22406
22406
|
} else {
|
|
@@ -22432,9 +22432,9 @@ var Lexer = class {
|
|
|
22432
22432
|
}
|
|
22433
22433
|
this.pendingHereDocs.length = 0;
|
|
22434
22434
|
}
|
|
22435
|
-
readHereDocBody(
|
|
22435
|
+
readHereDocBody(delimiter2, strip) {
|
|
22436
22436
|
const bodyStart = this.pos;
|
|
22437
|
-
const bodyEnd = this.skipHereDocBody(
|
|
22437
|
+
const bodyEnd = this.skipHereDocBody(delimiter2, strip);
|
|
22438
22438
|
return this.src.slice(bodyStart, bodyEnd);
|
|
22439
22439
|
}
|
|
22440
22440
|
// Advance past the heredoc body and its delimiter line; return the body end
|
|
@@ -22442,10 +22442,10 @@ var Lexer = class {
|
|
|
22442
22442
|
// With parenEnds (inside $(...)), a line starting with the delimiter directly
|
|
22443
22443
|
// followed by ")" also terminates the body, resuming at the ")" — bash treats
|
|
22444
22444
|
// the substitution's closing paren as end-of-file for its heredocs.
|
|
22445
|
-
skipHereDocBody(
|
|
22445
|
+
skipHereDocBody(delimiter2, strip, parenEnds = false) {
|
|
22446
22446
|
const src = this.src;
|
|
22447
22447
|
const len = this.srcEnd;
|
|
22448
|
-
const dLen =
|
|
22448
|
+
const dLen = delimiter2.length;
|
|
22449
22449
|
while (this.pos < len) {
|
|
22450
22450
|
let lineStart = this.pos;
|
|
22451
22451
|
let lineEnd = src.indexOf("\n", this.pos);
|
|
@@ -22455,12 +22455,12 @@ var Lexer = class {
|
|
|
22455
22455
|
while (lineStart < lineEnd && src.charCodeAt(lineStart) === CH_TAB)
|
|
22456
22456
|
lineStart++;
|
|
22457
22457
|
}
|
|
22458
|
-
if (lineEnd - lineStart === dLen && src.startsWith(
|
|
22458
|
+
if (lineEnd - lineStart === dLen && src.startsWith(delimiter2, lineStart)) {
|
|
22459
22459
|
const bodyEnd = this.pos;
|
|
22460
22460
|
this.pos = lineEnd < len ? lineEnd + 1 : lineEnd;
|
|
22461
22461
|
return bodyEnd;
|
|
22462
22462
|
}
|
|
22463
|
-
if (parenEnds && lineEnd - lineStart > dLen && src.charCodeAt(lineStart + dLen) === CH_RPAREN && src.startsWith(
|
|
22463
|
+
if (parenEnds && lineEnd - lineStart > dLen && src.charCodeAt(lineStart + dLen) === CH_RPAREN && src.startsWith(delimiter2, lineStart)) {
|
|
22464
22464
|
const bodyEnd = this.pos;
|
|
22465
22465
|
this.pos = lineStart + dLen;
|
|
22466
22466
|
return bodyEnd;
|
|
@@ -25172,7 +25172,7 @@ function safeSedProgram(program) {
|
|
|
25172
25172
|
return true;
|
|
25173
25173
|
const match = /^(?:(?:\d+|\$)(?:,(?:\d+|\$))?)?s(.)(.*)$/s.exec(program);
|
|
25174
25174
|
if (!match || /[\\\nA-Za-z0-9]/.test(match[1])) return false;
|
|
25175
|
-
const
|
|
25175
|
+
const delimiter2 = match[1];
|
|
25176
25176
|
const tail = match[2];
|
|
25177
25177
|
let offset = 0;
|
|
25178
25178
|
for (let section = 0; section < 2; section += 1) {
|
|
@@ -25180,7 +25180,7 @@ function safeSedProgram(program) {
|
|
|
25180
25180
|
while (offset < tail.length) {
|
|
25181
25181
|
if (tail[offset] === "\\") {
|
|
25182
25182
|
offset += 2;
|
|
25183
|
-
} else if (tail[offset] ===
|
|
25183
|
+
} else if (tail[offset] === delimiter2) {
|
|
25184
25184
|
offset += 1;
|
|
25185
25185
|
closed = true;
|
|
25186
25186
|
break;
|
|
@@ -20771,7 +20771,7 @@ import {
|
|
|
20771
20771
|
utimesSync,
|
|
20772
20772
|
writeFileSync as writeFileSync5
|
|
20773
20773
|
} from "fs";
|
|
20774
|
-
import { dirname as dirname9, isAbsolute as isAbsolute5, join as join12, resolve as resolve4 } from "path";
|
|
20774
|
+
import { delimiter, dirname as dirname9, isAbsolute as isAbsolute5, join as join12, resolve as resolve4 } from "path";
|
|
20775
20775
|
var RELEASE_PREFIX = "release-";
|
|
20776
20776
|
var MAX_MANIFEST_BYTES = 64 * 1024;
|
|
20777
20777
|
var RELEASE_GRACE_MS = 10 * 60 * 1e3;
|
|
@@ -22465,16 +22465,16 @@ var Lexer = class {
|
|
|
22465
22465
|
readHereDocDelimiter() {
|
|
22466
22466
|
const src = this.src;
|
|
22467
22467
|
const len = this.srcEnd;
|
|
22468
|
-
let
|
|
22468
|
+
let delimiter2 = "";
|
|
22469
22469
|
if (this.pos < len && src.charCodeAt(this.pos) === CH_SQUOTE) {
|
|
22470
22470
|
this.pos++;
|
|
22471
22471
|
const start = this.pos;
|
|
22472
22472
|
while (this.pos < len && src.charCodeAt(this.pos) !== CH_SQUOTE)
|
|
22473
22473
|
this.pos++;
|
|
22474
|
-
|
|
22474
|
+
delimiter2 = src.slice(start, this.pos);
|
|
22475
22475
|
if (this.pos < len)
|
|
22476
22476
|
this.pos++;
|
|
22477
|
-
this._hereDelim =
|
|
22477
|
+
this._hereDelim = delimiter2;
|
|
22478
22478
|
this._hereQuoted = true;
|
|
22479
22479
|
return;
|
|
22480
22480
|
} else if (this.pos < len && src.charCodeAt(this.pos) === CH_DQUOTE) {
|
|
@@ -22482,12 +22482,12 @@ var Lexer = class {
|
|
|
22482
22482
|
while (this.pos < len && src.charCodeAt(this.pos) !== CH_DQUOTE) {
|
|
22483
22483
|
if (src.charCodeAt(this.pos) === CH_BACKSLASH)
|
|
22484
22484
|
this.pos++;
|
|
22485
|
-
|
|
22485
|
+
delimiter2 += src[this.pos];
|
|
22486
22486
|
this.pos++;
|
|
22487
22487
|
}
|
|
22488
22488
|
if (this.pos < len)
|
|
22489
22489
|
this.pos++;
|
|
22490
|
-
this._hereDelim =
|
|
22490
|
+
this._hereDelim = delimiter2;
|
|
22491
22491
|
this._hereQuoted = true;
|
|
22492
22492
|
return;
|
|
22493
22493
|
} else if (this.pos < len && src.charCodeAt(this.pos) === CH_BACKSLASH) {
|
|
@@ -22498,11 +22498,11 @@ var Lexer = class {
|
|
|
22498
22498
|
if (c === CH_BACKSLASH)
|
|
22499
22499
|
this.pos++;
|
|
22500
22500
|
if (this.pos < len) {
|
|
22501
|
-
|
|
22501
|
+
delimiter2 += src[this.pos];
|
|
22502
22502
|
this.pos++;
|
|
22503
22503
|
}
|
|
22504
22504
|
}
|
|
22505
|
-
this._hereDelim =
|
|
22505
|
+
this._hereDelim = delimiter2;
|
|
22506
22506
|
this._hereQuoted = true;
|
|
22507
22507
|
return;
|
|
22508
22508
|
} else {
|
|
@@ -22534,9 +22534,9 @@ var Lexer = class {
|
|
|
22534
22534
|
}
|
|
22535
22535
|
this.pendingHereDocs.length = 0;
|
|
22536
22536
|
}
|
|
22537
|
-
readHereDocBody(
|
|
22537
|
+
readHereDocBody(delimiter2, strip) {
|
|
22538
22538
|
const bodyStart = this.pos;
|
|
22539
|
-
const bodyEnd = this.skipHereDocBody(
|
|
22539
|
+
const bodyEnd = this.skipHereDocBody(delimiter2, strip);
|
|
22540
22540
|
return this.src.slice(bodyStart, bodyEnd);
|
|
22541
22541
|
}
|
|
22542
22542
|
// Advance past the heredoc body and its delimiter line; return the body end
|
|
@@ -22544,10 +22544,10 @@ var Lexer = class {
|
|
|
22544
22544
|
// With parenEnds (inside $(...)), a line starting with the delimiter directly
|
|
22545
22545
|
// followed by ")" also terminates the body, resuming at the ")" — bash treats
|
|
22546
22546
|
// the substitution's closing paren as end-of-file for its heredocs.
|
|
22547
|
-
skipHereDocBody(
|
|
22547
|
+
skipHereDocBody(delimiter2, strip, parenEnds = false) {
|
|
22548
22548
|
const src = this.src;
|
|
22549
22549
|
const len = this.srcEnd;
|
|
22550
|
-
const dLen =
|
|
22550
|
+
const dLen = delimiter2.length;
|
|
22551
22551
|
while (this.pos < len) {
|
|
22552
22552
|
let lineStart = this.pos;
|
|
22553
22553
|
let lineEnd = src.indexOf("\n", this.pos);
|
|
@@ -22557,12 +22557,12 @@ var Lexer = class {
|
|
|
22557
22557
|
while (lineStart < lineEnd && src.charCodeAt(lineStart) === CH_TAB)
|
|
22558
22558
|
lineStart++;
|
|
22559
22559
|
}
|
|
22560
|
-
if (lineEnd - lineStart === dLen && src.startsWith(
|
|
22560
|
+
if (lineEnd - lineStart === dLen && src.startsWith(delimiter2, lineStart)) {
|
|
22561
22561
|
const bodyEnd = this.pos;
|
|
22562
22562
|
this.pos = lineEnd < len ? lineEnd + 1 : lineEnd;
|
|
22563
22563
|
return bodyEnd;
|
|
22564
22564
|
}
|
|
22565
|
-
if (parenEnds && lineEnd - lineStart > dLen && src.charCodeAt(lineStart + dLen) === CH_RPAREN && src.startsWith(
|
|
22565
|
+
if (parenEnds && lineEnd - lineStart > dLen && src.charCodeAt(lineStart + dLen) === CH_RPAREN && src.startsWith(delimiter2, lineStart)) {
|
|
22566
22566
|
const bodyEnd = this.pos;
|
|
22567
22567
|
this.pos = lineStart + dLen;
|
|
22568
22568
|
return bodyEnd;
|
|
@@ -25274,7 +25274,7 @@ function safeSedProgram(program) {
|
|
|
25274
25274
|
return true;
|
|
25275
25275
|
const match = /^(?:(?:\d+|\$)(?:,(?:\d+|\$))?)?s(.)(.*)$/s.exec(program);
|
|
25276
25276
|
if (!match || /[\\\nA-Za-z0-9]/.test(match[1])) return false;
|
|
25277
|
-
const
|
|
25277
|
+
const delimiter2 = match[1];
|
|
25278
25278
|
const tail = match[2];
|
|
25279
25279
|
let offset = 0;
|
|
25280
25280
|
for (let section = 0; section < 2; section += 1) {
|
|
@@ -25282,7 +25282,7 @@ function safeSedProgram(program) {
|
|
|
25282
25282
|
while (offset < tail.length) {
|
|
25283
25283
|
if (tail[offset] === "\\") {
|
|
25284
25284
|
offset += 2;
|
|
25285
|
-
} else if (tail[offset] ===
|
|
25285
|
+
} else if (tail[offset] === delimiter2) {
|
|
25286
25286
|
offset += 1;
|
|
25287
25287
|
closed = true;
|
|
25288
25288
|
break;
|
|
@@ -470,7 +470,7 @@ import {
|
|
|
470
470
|
utimesSync,
|
|
471
471
|
writeFileSync as writeFileSync3
|
|
472
472
|
} from "fs";
|
|
473
|
-
import { dirname as dirname4, isAbsolute as isAbsolute3, join as join6, resolve } from "path";
|
|
473
|
+
import { delimiter, dirname as dirname4, isAbsolute as isAbsolute3, join as join6, resolve } from "path";
|
|
474
474
|
|
|
475
475
|
// src/lib/file-lock.ts
|
|
476
476
|
import { randomBytes } from "crypto";
|
|
@@ -331,7 +331,7 @@ import {
|
|
|
331
331
|
utimesSync,
|
|
332
332
|
writeFileSync as writeFileSync3
|
|
333
333
|
} from "fs";
|
|
334
|
-
import { dirname as dirname4, isAbsolute as isAbsolute3, join as join5, resolve } from "path";
|
|
334
|
+
import { delimiter, dirname as dirname4, isAbsolute as isAbsolute3, join as join5, resolve } from "path";
|
|
335
335
|
|
|
336
336
|
// src/lib/file-lock.ts
|
|
337
337
|
import { randomBytes } from "crypto";
|
|
@@ -34963,7 +34963,7 @@ import {
|
|
|
34963
34963
|
utimesSync,
|
|
34964
34964
|
writeFileSync as writeFileSync6
|
|
34965
34965
|
} from "fs";
|
|
34966
|
-
import { dirname as dirname8, isAbsolute as isAbsolute5, join as join10, resolve as resolve5 } from "path";
|
|
34966
|
+
import { delimiter, dirname as dirname8, isAbsolute as isAbsolute5, join as join10, resolve as resolve5 } from "path";
|
|
34967
34967
|
var HOOK_RUNTIME_SCHEMA_VERSION = 1;
|
|
34968
34968
|
var DIRECTORY_MODE2 = 448;
|
|
34969
34969
|
var DATA_FILE_MODE = 384;
|
|
@@ -35313,11 +35313,28 @@ function writeRelease(sourceDir, releaseDir, manifest, releasesDir) {
|
|
|
35313
35313
|
rmSync4(stagingDir, { recursive: true, force: true });
|
|
35314
35314
|
}
|
|
35315
35315
|
}
|
|
35316
|
+
function stableNodePath(execPath = process.execPath, searchPath = process.env.PATH ?? "") {
|
|
35317
|
+
let target;
|
|
35318
|
+
try {
|
|
35319
|
+
target = realpathSync2(execPath);
|
|
35320
|
+
} catch {
|
|
35321
|
+
return execPath;
|
|
35322
|
+
}
|
|
35323
|
+
for (const directory of searchPath.split(delimiter)) {
|
|
35324
|
+
if (!isAbsolute5(directory)) continue;
|
|
35325
|
+
const candidate = join10(directory, "node");
|
|
35326
|
+
try {
|
|
35327
|
+
if (realpathSync2(candidate) === target) return candidate;
|
|
35328
|
+
} catch {
|
|
35329
|
+
}
|
|
35330
|
+
}
|
|
35331
|
+
return execPath;
|
|
35332
|
+
}
|
|
35316
35333
|
function stageHookRuntime(options = {}) {
|
|
35317
35334
|
const root = packageRoot();
|
|
35318
35335
|
const sourceDir = options.sourceDir ?? (root ? join10(root, "dist", "hook-runtime") : null);
|
|
35319
35336
|
const version = options.version ?? packageVersion();
|
|
35320
|
-
const nodePath = resolve5(options.nodePath ??
|
|
35337
|
+
const nodePath = resolve5(options.nodePath ?? stableNodePath());
|
|
35321
35338
|
if (!sourceDir || !version || compareSemver(version, version) !== 0 || !isAbsolute5(nodePath) || /[\r\n]/u.test(nodePath)) {
|
|
35322
35339
|
throw new Error("cannot stage hook runtime: package identity is unavailable");
|
|
35323
35340
|
}
|
|
@@ -48771,6 +48788,12 @@ function deadLetterReason(error) {
|
|
|
48771
48788
|
}
|
|
48772
48789
|
return void 0;
|
|
48773
48790
|
}
|
|
48791
|
+
function mayBeBatchSizeFailure(error) {
|
|
48792
|
+
if (error instanceof HttpError) {
|
|
48793
|
+
return error.status >= 500 && error.status !== 503;
|
|
48794
|
+
}
|
|
48795
|
+
return error instanceof Error && error.name === "TimeoutError";
|
|
48796
|
+
}
|
|
48774
48797
|
async function* rawJournalLines(input) {
|
|
48775
48798
|
let pending = [];
|
|
48776
48799
|
let pendingBytes = 0;
|
|
@@ -48812,7 +48835,7 @@ async function drainFlushingPath(flushingPath, client, binding, options = {}) {
|
|
|
48812
48835
|
return { flushed: batch2.length, quarantined: 0 };
|
|
48813
48836
|
} catch (error) {
|
|
48814
48837
|
const reason = deadLetterReason(error);
|
|
48815
|
-
if (!reason) {
|
|
48838
|
+
if (!(reason || mayBeBatchSizeFailure(error))) {
|
|
48816
48839
|
throw error;
|
|
48817
48840
|
}
|
|
48818
48841
|
if (batch2.length > 1) {
|
|
@@ -48821,6 +48844,9 @@ async function drainFlushingPath(flushingPath, client, binding, options = {}) {
|
|
|
48821
48844
|
const right = await postBatch(batch2.slice(midpoint));
|
|
48822
48845
|
return addDrainCounts(left, right);
|
|
48823
48846
|
}
|
|
48847
|
+
if (!reason) {
|
|
48848
|
+
throw error;
|
|
48849
|
+
}
|
|
48824
48850
|
const [move] = batch2;
|
|
48825
48851
|
const quarantined = quarantineMove(
|
|
48826
48852
|
flushingPath,
|
|
@@ -22,7 +22,7 @@ import "../chunk-ZB4F75SZ.js";
|
|
|
22
22
|
import {
|
|
23
23
|
appendCodexContext,
|
|
24
24
|
prepareCodexContext
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-ADUTW66W.js";
|
|
26
26
|
import "../chunk-WX52U7Z2.js";
|
|
27
27
|
import {
|
|
28
28
|
scrubFromCwd
|
|
@@ -45,8 +45,8 @@ import {
|
|
|
45
45
|
parseAgent,
|
|
46
46
|
readHookStdin,
|
|
47
47
|
shouldSuppressImportedCursorHandler
|
|
48
|
-
} from "../chunk-
|
|
49
|
-
import "../chunk-
|
|
48
|
+
} from "../chunk-5HRR4AOR.js";
|
|
49
|
+
import "../chunk-26P57LAR.js";
|
|
50
50
|
import {
|
|
51
51
|
currentBranch,
|
|
52
52
|
resolveRepositoryContext
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
appendCodexContext,
|
|
18
18
|
hasVisibleCodexMessage,
|
|
19
19
|
prepareCodexContext
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-ADUTW66W.js";
|
|
21
21
|
import "../chunk-WX52U7Z2.js";
|
|
22
22
|
import {
|
|
23
23
|
DEFAULT_RULES,
|
|
@@ -39,10 +39,10 @@ import {
|
|
|
39
39
|
parseAgent,
|
|
40
40
|
readHookStdin,
|
|
41
41
|
shouldSuppressImportedCursorHandler
|
|
42
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-5HRR4AOR.js";
|
|
43
43
|
import {
|
|
44
44
|
packageVersion
|
|
45
|
-
} from "../chunk-
|
|
45
|
+
} from "../chunk-26P57LAR.js";
|
|
46
46
|
import {
|
|
47
47
|
canonicalGitRoot,
|
|
48
48
|
canonicalRepositoryPath,
|
package/dist/hooks/prim-hook.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
import "../chunk-ZB4F75SZ.js";
|
|
29
29
|
import {
|
|
30
30
|
prepareCodexContext
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-ADUTW66W.js";
|
|
32
32
|
import "../chunk-WX52U7Z2.js";
|
|
33
33
|
import {
|
|
34
34
|
scrubFromCwd,
|
|
@@ -46,8 +46,8 @@ import {
|
|
|
46
46
|
parseAgent,
|
|
47
47
|
readHookStdin,
|
|
48
48
|
shouldSuppressImportedCursorHandler
|
|
49
|
-
} from "../chunk-
|
|
50
|
-
import "../chunk-
|
|
49
|
+
} from "../chunk-5HRR4AOR.js";
|
|
50
|
+
import "../chunk-26P57LAR.js";
|
|
51
51
|
import {
|
|
52
52
|
currentBranch,
|
|
53
53
|
resolveRepositoryContext
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
parseAgent,
|
|
5
5
|
readHookStdin,
|
|
6
6
|
shouldSuppressImportedCursorHandler
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-5HRR4AOR.js";
|
|
8
|
+
import "../chunk-26P57LAR.js";
|
|
9
9
|
import "../chunk-H4UNYFUC.js";
|
|
10
10
|
import {
|
|
11
11
|
daemonRequest
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
hasUsableCursorSkill,
|
|
8
8
|
refreshClaudePlugins,
|
|
9
9
|
warmBinCache
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-LGGMJYY4.js";
|
|
11
11
|
import {
|
|
12
12
|
buildHookOutput,
|
|
13
13
|
handoffHookOutput
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from "../chunk-EZXEWFDG.js";
|
|
24
24
|
import {
|
|
25
25
|
prepareCodexContext
|
|
26
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-ADUTW66W.js";
|
|
27
27
|
import "../chunk-WX52U7Z2.js";
|
|
28
28
|
import {
|
|
29
29
|
fetchAndCacheCollectScope,
|
|
@@ -40,10 +40,10 @@ import {
|
|
|
40
40
|
parseAgent,
|
|
41
41
|
readHookStdin,
|
|
42
42
|
shouldSuppressImportedCursorHandler
|
|
43
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-5HRR4AOR.js";
|
|
44
44
|
import {
|
|
45
45
|
binFile
|
|
46
|
-
} from "../chunk-
|
|
46
|
+
} from "../chunk-26P57LAR.js";
|
|
47
47
|
import {
|
|
48
48
|
gitToplevel
|
|
49
49
|
} from "../chunk-H4UNYFUC.js";
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
uninstallPostRewriteHookAtPath,
|
|
18
18
|
uninstallProjectPostCommitHook,
|
|
19
19
|
uninstallProjectPostRewriteHook
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-LGGMJYY4.js";
|
|
21
21
|
import {
|
|
22
22
|
requireDurableIngestAcknowledgement
|
|
23
23
|
} from "./chunk-FKXFUUWJ.js";
|
|
@@ -113,7 +113,7 @@ import {
|
|
|
113
113
|
stableHookCommand,
|
|
114
114
|
stageHookRuntime,
|
|
115
115
|
stripCommand
|
|
116
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-26P57LAR.js";
|
|
117
117
|
import {
|
|
118
118
|
canonicalGitRoot,
|
|
119
119
|
canonicalRepositoryPath,
|
|
@@ -7822,6 +7822,12 @@ function deadLetterReason(error) {
|
|
|
7822
7822
|
}
|
|
7823
7823
|
return void 0;
|
|
7824
7824
|
}
|
|
7825
|
+
function mayBeBatchSizeFailure(error) {
|
|
7826
|
+
if (error instanceof HttpError) {
|
|
7827
|
+
return error.status >= 500 && error.status !== 503;
|
|
7828
|
+
}
|
|
7829
|
+
return error instanceof Error && error.name === "TimeoutError";
|
|
7830
|
+
}
|
|
7825
7831
|
async function* rawJournalLines(input) {
|
|
7826
7832
|
let pending = [];
|
|
7827
7833
|
let pendingBytes = 0;
|
|
@@ -7863,7 +7869,7 @@ async function drainFlushingPath(flushingPath, client, binding, options = {}) {
|
|
|
7863
7869
|
return { flushed: batch2.length, quarantined: 0 };
|
|
7864
7870
|
} catch (error) {
|
|
7865
7871
|
const reason = deadLetterReason(error);
|
|
7866
|
-
if (!reason) {
|
|
7872
|
+
if (!(reason || mayBeBatchSizeFailure(error))) {
|
|
7867
7873
|
throw error;
|
|
7868
7874
|
}
|
|
7869
7875
|
if (batch2.length > 1) {
|
|
@@ -7872,6 +7878,9 @@ async function drainFlushingPath(flushingPath, client, binding, options = {}) {
|
|
|
7872
7878
|
const right = await postBatch(batch2.slice(midpoint));
|
|
7873
7879
|
return addDrainCounts(left, right);
|
|
7874
7880
|
}
|
|
7881
|
+
if (!reason) {
|
|
7882
|
+
throw error;
|
|
7883
|
+
}
|
|
7875
7884
|
const [move] = batch2;
|
|
7876
7885
|
const quarantined = quarantineMove(
|
|
7877
7886
|
flushingPath,
|
package/package.json
CHANGED