@primitive.ai/prim 0.1.0-alpha.106 → 0.1.0-alpha.108
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 +1 -1
- package/SKILL.md +42 -5
- package/dist/{chunk-6VFUHQ4J.js → chunk-AIAYIXBJ.js} +1 -1
- package/dist/{chunk-HT2CJ3YD.js → chunk-D24AUSVP.js} +65 -28
- package/dist/{chunk-4CO4A6NR.js → chunk-EQYIPUFX.js} +1 -1
- package/dist/{chunk-XY4CRWTF.js → chunk-FDXDV2AT.js} +3 -3
- package/dist/{chunk-FFYZ3XMX.js → chunk-GFJ4QIVR.js} +210 -117
- package/dist/{chunk-7GSBXHK4.js → chunk-LFZYNNQQ.js} +71 -7
- package/dist/{chunk-TPWJQD5E.js → chunk-QJOK2VOE.js} +1 -1
- package/dist/{chunk-72CQVK4E.js → chunk-RXD6LFA2.js} +1 -1
- package/dist/{chunk-LVRD562C.js → chunk-YQFJUBNU.js} +1 -1
- package/dist/daemon/server.js +210 -117
- package/dist/hook-runtime/daemon/server.js +210 -117
- package/dist/hook-runtime/hooks/post-commit.js +210 -117
- package/dist/hook-runtime/hooks/post-rewrite.js +210 -117
- package/dist/hook-runtime/hooks/post-tool-use.js +890 -749
- package/dist/hook-runtime/hooks/pre-tool-use.js +484 -343
- package/dist/hook-runtime/hooks/prim-hook.js +543 -402
- package/dist/hook-runtime/hooks/session-start.js +210 -117
- package/dist/hook-runtime/index.js +608 -354
- package/dist/hooks/post-commit.js +3 -3
- package/dist/hooks/post-rewrite.js +3 -3
- package/dist/hooks/post-tool-use.js +9 -9
- package/dist/hooks/pre-tool-use.js +6 -6
- package/dist/hooks/prim-hook.js +8 -8
- package/dist/hooks/session-start.js +3 -3
- package/dist/index.js +184 -71
- package/package.json +1 -1
|
@@ -1282,12 +1282,128 @@ function getClient() {
|
|
|
1282
1282
|
}
|
|
1283
1283
|
|
|
1284
1284
|
// src/demo/isolation.ts
|
|
1285
|
-
import { existsSync as
|
|
1285
|
+
import { existsSync as existsSync7 } from "fs";
|
|
1286
|
+
|
|
1287
|
+
// src/demo/diagnostics.ts
|
|
1288
|
+
import { existsSync as existsSync6 } from "fs";
|
|
1289
|
+
import { join as join9 } from "path";
|
|
1290
|
+
|
|
1291
|
+
// src/lib/hook-runtime.ts
|
|
1292
|
+
import { createHash as createHash3, randomBytes as randomBytes3 } from "crypto";
|
|
1293
|
+
import {
|
|
1294
|
+
constants as constants2,
|
|
1295
|
+
accessSync,
|
|
1296
|
+
chmodSync as chmodSync3,
|
|
1297
|
+
copyFileSync,
|
|
1298
|
+
existsSync as existsSync4,
|
|
1299
|
+
lstatSync as lstatSync2,
|
|
1300
|
+
mkdirSync as mkdirSync4,
|
|
1301
|
+
mkdtempSync,
|
|
1302
|
+
readFileSync as readFileSync6,
|
|
1303
|
+
readdirSync,
|
|
1304
|
+
realpathSync,
|
|
1305
|
+
renameSync as renameSync2,
|
|
1306
|
+
rmSync as rmSync4,
|
|
1307
|
+
statSync as statSync2,
|
|
1308
|
+
utimesSync,
|
|
1309
|
+
writeFileSync as writeFileSync3
|
|
1310
|
+
} from "fs";
|
|
1311
|
+
import { delimiter, dirname as dirname5, isAbsolute as isAbsolute3, join as join7, resolve as resolve2 } from "path";
|
|
1312
|
+
|
|
1313
|
+
// src/lib/git-hook-contract.ts
|
|
1314
|
+
var GIT_HOOK_ENTRYPOINT_CONTENT = `#!/bin/sh
|
|
1315
|
+
# prim git hook entrypoint v1 \u2014 managed by prim; do not edit.
|
|
1316
|
+
# Run by the "# >>> prim <hook> hook >>>" block in a Git hook file. Acts only
|
|
1317
|
+
# where prim is active (git config prim.active true) and never fails the hook.
|
|
1318
|
+
case "$0" in */*) prim_dir=\${0%/*} ;; *) exit 0 ;; esac
|
|
1319
|
+
prim_launcher="$prim_dir/${STABLE_HOOK_LAUNCHER_NAME}"
|
|
1320
|
+
[ -x "$prim_launcher" ] || exit 0
|
|
1321
|
+
[ "$(git config --get prim.active 2>/dev/null)" = "true" ] || exit 0
|
|
1322
|
+
prim_hook=\${1-}
|
|
1323
|
+
if [ "$#" -gt 0 ]; then shift; fi
|
|
1324
|
+
case "$prim_hook" in
|
|
1325
|
+
pre-commit)
|
|
1326
|
+
"$prim_launcher" prim-pre-commit "$@" || :
|
|
1327
|
+
;;
|
|
1328
|
+
post-commit)
|
|
1329
|
+
prim_sha=$(git rev-parse --verify HEAD 2>/dev/null) || exit 0
|
|
1330
|
+
case "$prim_sha" in *[!0-9a-f]* | "") exit 0 ;; esac
|
|
1331
|
+
case "\${#prim_sha}" in 40 | 64) ;; *) exit 0 ;; esac
|
|
1332
|
+
prim_branch=$(git symbolic-ref --quiet --short HEAD 2>/dev/null) || prim_branch=
|
|
1333
|
+
prim_observed=$(mktemp "\${TMPDIR:-/tmp}/prim-post-commit-observed.XXXXXXXX" 2>/dev/null) || prim_observed=
|
|
1334
|
+
(
|
|
1335
|
+
trap '' HUP
|
|
1336
|
+
trap 'if [ -n "$prim_observed" ]; then rm -f "$prim_observed"; fi' 0
|
|
1337
|
+
PRIM_COMMIT_SHA=$prim_sha PRIM_COMMIT_BRANCH=$prim_branch PRIM_COMMIT_OBSERVED_FILE=$prim_observed "$prim_launcher" prim-post-commit
|
|
1338
|
+
) </dev/null >/dev/null 2>&1 &
|
|
1339
|
+
;;
|
|
1340
|
+
post-rewrite)
|
|
1341
|
+
case "\${1-}" in amend | rebase) prim_source=$1 ;; *) exit 0 ;; esac
|
|
1342
|
+
prim_pairs=$(mktemp "\${TMPDIR:-/tmp}/prim-post-rewrite-pairs.XXXXXXXX" 2>/dev/null) || exit 0
|
|
1343
|
+
if ! chmod 600 "$prim_pairs" 2>/dev/null || ! cat >"$prim_pairs"; then
|
|
1344
|
+
rm -f "$prim_pairs"
|
|
1345
|
+
exit 0
|
|
1346
|
+
fi
|
|
1347
|
+
prim_branch=$(git symbolic-ref --quiet --short HEAD 2>/dev/null) || prim_branch=
|
|
1348
|
+
(
|
|
1349
|
+
trap '' HUP
|
|
1350
|
+
trap 'rm -f "$prim_pairs"' 0
|
|
1351
|
+
PRIM_REWRITE_SOURCE=$prim_source PRIM_REWRITE_BRANCH=$prim_branch PRIM_REWRITE_PAIRS_FILE=$prim_pairs "$prim_launcher" prim-post-rewrite
|
|
1352
|
+
) </dev/null >/dev/null 2>&1 &
|
|
1353
|
+
;;
|
|
1354
|
+
esac
|
|
1355
|
+
exit 0
|
|
1356
|
+
`;
|
|
1357
|
+
|
|
1358
|
+
// src/lib/hook-runtime.ts
|
|
1359
|
+
var RELEASE_PREFIX = "release-";
|
|
1360
|
+
var MAX_MANIFEST_BYTES = 64 * 1024;
|
|
1361
|
+
var RELEASE_GRACE_MS = 10 * 60 * 1e3;
|
|
1362
|
+
var HOOK_RUNTIME_ENTRIES = {
|
|
1363
|
+
// SessionStart self-healing resolves this exact CLI entry to run
|
|
1364
|
+
// `daemon ensure`; it must travel with the immutable hook release.
|
|
1365
|
+
prim: "dist/index.js",
|
|
1366
|
+
"prim-hook": "dist/hooks/prim-hook.js",
|
|
1367
|
+
"prim-pre-commit": "dist/hooks/pre-commit.js",
|
|
1368
|
+
"prim-post-commit": "dist/hooks/post-commit.js",
|
|
1369
|
+
"prim-post-rewrite": "dist/hooks/post-rewrite.js",
|
|
1370
|
+
"prim-pre-tool-use": "dist/hooks/pre-tool-use.js",
|
|
1371
|
+
"prim-post-tool-use": "dist/hooks/post-tool-use.js",
|
|
1372
|
+
"prim-session-start": "dist/hooks/session-start.js",
|
|
1373
|
+
"prim-session-end": "dist/hooks/session-end.js",
|
|
1374
|
+
"prim-daemon-server": "dist/daemon/server.js",
|
|
1375
|
+
"prim-statusline": "dist/statusline-main.js"
|
|
1376
|
+
};
|
|
1377
|
+
var SOURCE_ENTRIES = Object.fromEntries(
|
|
1378
|
+
Object.entries(HOOK_RUNTIME_ENTRIES).map(([bin, target]) => [
|
|
1379
|
+
bin,
|
|
1380
|
+
target.replace(/^dist\//u, "")
|
|
1381
|
+
])
|
|
1382
|
+
);
|
|
1383
|
+
var STABLE_HOOK_LAUNCHER_CONTENT = `#!/bin/sh
|
|
1384
|
+
set -eu
|
|
1385
|
+
case "$0" in */*) prim_launcher_dir=\${0%/*} ;; *) exit 78 ;; esac
|
|
1386
|
+
IFS= read -r prim_release_name < "$prim_launcher_dir/hook-runtime/current" || exit 69
|
|
1387
|
+
case "$prim_release_name" in ${RELEASE_PREFIX}*) ;; *) exit 69 ;; esac
|
|
1388
|
+
prim_release_id=\${prim_release_name#${RELEASE_PREFIX}}
|
|
1389
|
+
case "$prim_release_id" in *[!0-9a-f]*|"") exit 69 ;; esac
|
|
1390
|
+
[ "\${#prim_release_id}" -eq 64 ] || exit 69
|
|
1391
|
+
prim_release="$prim_launcher_dir/hook-runtime/releases/$prim_release_name"
|
|
1392
|
+
case "\${1-}" in
|
|
1393
|
+
${Object.entries(HOOK_RUNTIME_ENTRIES).map(([bin, entry]) => ` ${bin}) prim_entry="$prim_release/${entry}" ;;`).join("\n")}
|
|
1394
|
+
*) exit 64 ;;
|
|
1395
|
+
esac
|
|
1396
|
+
shift
|
|
1397
|
+
IFS= read -r prim_node < "$prim_release/node" || exit 69
|
|
1398
|
+
case "$prim_node" in /*) ;; *) exit 69 ;; esac
|
|
1399
|
+
[ -x "$prim_node" ] && [ -f "$prim_entry" ] || exit 69
|
|
1400
|
+
exec "$prim_node" "$prim_entry" "$@"
|
|
1401
|
+
`;
|
|
1286
1402
|
|
|
1287
1403
|
// src/demo/state.ts
|
|
1288
|
-
import { createHash as
|
|
1289
|
-
import { existsSync as
|
|
1290
|
-
import { join as
|
|
1404
|
+
import { createHash as createHash4, randomUUID as randomUUID2 } from "crypto";
|
|
1405
|
+
import { existsSync as existsSync5, lstatSync as lstatSync3, readFileSync as readFileSync7, readdirSync as readdirSync2 } from "fs";
|
|
1406
|
+
import { join as join8, resolve as resolve3 } from "path";
|
|
1291
1407
|
|
|
1292
1408
|
// src/generated/cli-http-v1.validators.js
|
|
1293
1409
|
var import_ucs2length = __toESM(require_ucs2length(), 1);
|
|
@@ -11378,8 +11494,9 @@ function validate43(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
11378
11494
|
}
|
|
11379
11495
|
validate43.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
11380
11496
|
var isDemoStatusResponse = validate44;
|
|
11381
|
-
var schema79 = { "type": "object", "properties": { "scenarioVersion": { "type": "number", "const": 1 }, "fictional": { "type": "boolean", "const": true }, "evaluation": { "type": "string", "const": "live" }, "runId": { "type": "string", "pattern": "^[a-zA-Z0-9]{1,64}$" }, "revision": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "stage": { "type": "string", "enum": ["ready", "checking", "blocked", "approved", "completed", "skipped", "expired"] }, "authorName": { "type": "string", "maxLength": 200 }, "email": { "type": "string", "enum": ["not_queued", "queued", "accepted", "failed", "suppressed"] }, "verdict": { "type": "string", "enum": ["block", "pass", "pending"] }, "reasonCode": { "type": "string", "maxLength": 100 }, "choice": { "type": "string", "enum": ["adhere", "supersede"] }, "reason": { "type": "string", "maxLength": 500 }, "approvedDigest": { "type": "string", "pattern": "^[a-f0-9]{64}$" } }, "required": ["scenarioVersion", "fictional", "evaluation", "runId", "revision", "stage", "authorName", "email"], "additionalProperties": false };
|
|
11497
|
+
var schema79 = { "type": "object", "properties": { "scenarioVersion": { "type": "number", "const": 1 }, "fictional": { "type": "boolean", "const": true }, "evaluation": { "type": "string", "const": "live" }, "runId": { "type": "string", "pattern": "^[a-zA-Z0-9]{1,64}$" }, "revision": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "stage": { "type": "string", "enum": ["ready", "checking", "blocked", "approved", "completed", "skipped", "expired"] }, "authorName": { "type": "string", "maxLength": 200 }, "story": { "type": "object", "properties": { "orgName": { "type": "string", "maxLength": 200 }, "recipient": { "type": "string", "format": "email", "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, "decisionDate": { "type": "string", "maxLength": 100 } }, "required": ["orgName", "recipient", "decisionDate"], "additionalProperties": false }, "email": { "type": "string", "enum": ["not_queued", "queued", "accepted", "failed", "suppressed"] }, "verdict": { "type": "string", "enum": ["block", "pass", "pending"] }, "reasonCode": { "type": "string", "maxLength": 100 }, "choice": { "type": "string", "enum": ["adhere", "supersede"] }, "reason": { "type": "string", "maxLength": 500 }, "approvedDigest": { "type": "string", "pattern": "^[a-f0-9]{64}$" } }, "required": ["scenarioVersion", "fictional", "evaluation", "runId", "revision", "stage", "authorName", "story", "email"], "additionalProperties": false };
|
|
11382
11498
|
var func34 = Object.prototype.hasOwnProperty;
|
|
11499
|
+
var pattern12 = new RegExp("^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$", "u");
|
|
11383
11500
|
function validate44(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
11384
11501
|
;
|
|
11385
11502
|
let vErrors = null;
|
|
@@ -11395,7 +11512,7 @@ function validate44(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
11395
11512
|
if (errors === _errs0) {
|
|
11396
11513
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
11397
11514
|
let missing0;
|
|
11398
|
-
if (data.scenarioVersion === void 0 && (missing0 = "scenarioVersion") || data.fictional === void 0 && (missing0 = "fictional") || data.evaluation === void 0 && (missing0 = "evaluation") || data.runId === void 0 && (missing0 = "runId") || data.revision === void 0 && (missing0 = "revision") || data.stage === void 0 && (missing0 = "stage") || data.authorName === void 0 && (missing0 = "authorName") || data.email === void 0 && (missing0 = "email")) {
|
|
11515
|
+
if (data.scenarioVersion === void 0 && (missing0 = "scenarioVersion") || data.fictional === void 0 && (missing0 = "fictional") || data.evaluation === void 0 && (missing0 = "evaluation") || data.runId === void 0 && (missing0 = "runId") || data.revision === void 0 && (missing0 = "revision") || data.stage === void 0 && (missing0 = "stage") || data.authorName === void 0 && (missing0 = "authorName") || data.story === void 0 && (missing0 = "story") || data.email === void 0 && (missing0 = "email")) {
|
|
11399
11516
|
validate44.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
11400
11517
|
return false;
|
|
11401
11518
|
} else {
|
|
@@ -11535,110 +11652,202 @@ function validate44(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
11535
11652
|
var valid1 = true;
|
|
11536
11653
|
}
|
|
11537
11654
|
if (valid1) {
|
|
11538
|
-
if (data.
|
|
11539
|
-
let data7 = data.
|
|
11655
|
+
if (data.story !== void 0) {
|
|
11656
|
+
let data7 = data.story;
|
|
11540
11657
|
const _errs17 = errors;
|
|
11541
|
-
if (
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11658
|
+
if (errors === _errs17) {
|
|
11659
|
+
if (data7 && typeof data7 == "object" && !Array.isArray(data7)) {
|
|
11660
|
+
let missing1;
|
|
11661
|
+
if (data7.orgName === void 0 && (missing1 = "orgName") || data7.recipient === void 0 && (missing1 = "recipient") || data7.decisionDate === void 0 && (missing1 = "decisionDate")) {
|
|
11662
|
+
validate44.errors = [{ instancePath: instancePath + "/story", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/story/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
|
|
11663
|
+
return false;
|
|
11664
|
+
} else {
|
|
11665
|
+
const _errs19 = errors;
|
|
11666
|
+
for (const key1 in data7) {
|
|
11667
|
+
if (!(key1 === "orgName" || key1 === "recipient" || key1 === "decisionDate")) {
|
|
11668
|
+
validate44.errors = [{ instancePath: instancePath + "/story", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/story/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }];
|
|
11669
|
+
return false;
|
|
11670
|
+
break;
|
|
11671
|
+
}
|
|
11672
|
+
}
|
|
11673
|
+
if (_errs19 === errors) {
|
|
11674
|
+
if (data7.orgName !== void 0) {
|
|
11675
|
+
let data8 = data7.orgName;
|
|
11676
|
+
const _errs20 = errors;
|
|
11677
|
+
if (errors === _errs20) {
|
|
11678
|
+
if (typeof data8 === "string") {
|
|
11679
|
+
if (func1(data8) > 200) {
|
|
11680
|
+
validate44.errors = [{ instancePath: instancePath + "/story/orgName", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/story/properties/orgName/maxLength", keyword: "maxLength", params: { limit: 200 }, message: "must NOT have more than 200 characters" }];
|
|
11681
|
+
return false;
|
|
11682
|
+
}
|
|
11683
|
+
} else {
|
|
11684
|
+
validate44.errors = [{ instancePath: instancePath + "/story/orgName", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/story/properties/orgName/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
11685
|
+
return false;
|
|
11686
|
+
}
|
|
11687
|
+
}
|
|
11688
|
+
var valid2 = _errs20 === errors;
|
|
11689
|
+
} else {
|
|
11690
|
+
var valid2 = true;
|
|
11691
|
+
}
|
|
11692
|
+
if (valid2) {
|
|
11693
|
+
if (data7.recipient !== void 0) {
|
|
11694
|
+
let data9 = data7.recipient;
|
|
11695
|
+
const _errs22 = errors;
|
|
11696
|
+
if (errors === _errs22) {
|
|
11697
|
+
if (errors === _errs22) {
|
|
11698
|
+
if (typeof data9 === "string") {
|
|
11699
|
+
if (!pattern12.test(data9)) {
|
|
11700
|
+
validate44.errors = [{ instancePath: instancePath + "/story/recipient", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/story/properties/recipient/pattern", keyword: "pattern", params: { pattern: "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, message: `must match pattern "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"` }];
|
|
11701
|
+
return false;
|
|
11702
|
+
}
|
|
11703
|
+
} else {
|
|
11704
|
+
validate44.errors = [{ instancePath: instancePath + "/story/recipient", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/story/properties/recipient/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
11705
|
+
return false;
|
|
11706
|
+
}
|
|
11707
|
+
}
|
|
11708
|
+
}
|
|
11709
|
+
var valid2 = _errs22 === errors;
|
|
11710
|
+
} else {
|
|
11711
|
+
var valid2 = true;
|
|
11712
|
+
}
|
|
11713
|
+
if (valid2) {
|
|
11714
|
+
if (data7.decisionDate !== void 0) {
|
|
11715
|
+
let data10 = data7.decisionDate;
|
|
11716
|
+
const _errs24 = errors;
|
|
11717
|
+
if (errors === _errs24) {
|
|
11718
|
+
if (typeof data10 === "string") {
|
|
11719
|
+
if (func1(data10) > 100) {
|
|
11720
|
+
validate44.errors = [{ instancePath: instancePath + "/story/decisionDate", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/story/properties/decisionDate/maxLength", keyword: "maxLength", params: { limit: 100 }, message: "must NOT have more than 100 characters" }];
|
|
11721
|
+
return false;
|
|
11722
|
+
}
|
|
11723
|
+
} else {
|
|
11724
|
+
validate44.errors = [{ instancePath: instancePath + "/story/decisionDate", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/story/properties/decisionDate/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
11725
|
+
return false;
|
|
11726
|
+
}
|
|
11727
|
+
}
|
|
11728
|
+
var valid2 = _errs24 === errors;
|
|
11729
|
+
} else {
|
|
11730
|
+
var valid2 = true;
|
|
11731
|
+
}
|
|
11732
|
+
}
|
|
11733
|
+
}
|
|
11734
|
+
}
|
|
11735
|
+
}
|
|
11736
|
+
} else {
|
|
11737
|
+
validate44.errors = [{ instancePath: instancePath + "/story", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/story/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
11738
|
+
return false;
|
|
11739
|
+
}
|
|
11548
11740
|
}
|
|
11549
11741
|
var valid1 = _errs17 === errors;
|
|
11550
11742
|
} else {
|
|
11551
11743
|
var valid1 = true;
|
|
11552
11744
|
}
|
|
11553
11745
|
if (valid1) {
|
|
11554
|
-
if (data.
|
|
11555
|
-
let
|
|
11556
|
-
const
|
|
11557
|
-
if (typeof
|
|
11558
|
-
validate44.errors = [{ instancePath: instancePath + "/
|
|
11746
|
+
if (data.email !== void 0) {
|
|
11747
|
+
let data11 = data.email;
|
|
11748
|
+
const _errs26 = errors;
|
|
11749
|
+
if (typeof data11 !== "string") {
|
|
11750
|
+
validate44.errors = [{ instancePath: instancePath + "/email", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/email/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
11559
11751
|
return false;
|
|
11560
11752
|
}
|
|
11561
|
-
if (!(
|
|
11562
|
-
validate44.errors = [{ instancePath: instancePath + "/
|
|
11753
|
+
if (!(data11 === "not_queued" || data11 === "queued" || data11 === "accepted" || data11 === "failed" || data11 === "suppressed")) {
|
|
11754
|
+
validate44.errors = [{ instancePath: instancePath + "/email", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/email/enum", keyword: "enum", params: { allowedValues: schema79.properties.email.enum }, message: "must be equal to one of the allowed values" }];
|
|
11563
11755
|
return false;
|
|
11564
11756
|
}
|
|
11565
|
-
var valid1 =
|
|
11757
|
+
var valid1 = _errs26 === errors;
|
|
11566
11758
|
} else {
|
|
11567
11759
|
var valid1 = true;
|
|
11568
11760
|
}
|
|
11569
11761
|
if (valid1) {
|
|
11570
|
-
if (data.
|
|
11571
|
-
let
|
|
11572
|
-
const
|
|
11573
|
-
if (
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
validate44.errors = [{ instancePath: instancePath + "/reasonCode", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/reasonCode/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
11581
|
-
return false;
|
|
11582
|
-
}
|
|
11762
|
+
if (data.verdict !== void 0) {
|
|
11763
|
+
let data12 = data.verdict;
|
|
11764
|
+
const _errs28 = errors;
|
|
11765
|
+
if (typeof data12 !== "string") {
|
|
11766
|
+
validate44.errors = [{ instancePath: instancePath + "/verdict", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/verdict/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
11767
|
+
return false;
|
|
11768
|
+
}
|
|
11769
|
+
if (!(data12 === "block" || data12 === "pass" || data12 === "pending")) {
|
|
11770
|
+
validate44.errors = [{ instancePath: instancePath + "/verdict", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/verdict/enum", keyword: "enum", params: { allowedValues: schema79.properties.verdict.enum }, message: "must be equal to one of the allowed values" }];
|
|
11771
|
+
return false;
|
|
11583
11772
|
}
|
|
11584
|
-
var valid1 =
|
|
11773
|
+
var valid1 = _errs28 === errors;
|
|
11585
11774
|
} else {
|
|
11586
11775
|
var valid1 = true;
|
|
11587
11776
|
}
|
|
11588
11777
|
if (valid1) {
|
|
11589
|
-
if (data.
|
|
11590
|
-
let
|
|
11591
|
-
const
|
|
11592
|
-
if (
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
|
|
11778
|
+
if (data.reasonCode !== void 0) {
|
|
11779
|
+
let data13 = data.reasonCode;
|
|
11780
|
+
const _errs30 = errors;
|
|
11781
|
+
if (errors === _errs30) {
|
|
11782
|
+
if (typeof data13 === "string") {
|
|
11783
|
+
if (func1(data13) > 100) {
|
|
11784
|
+
validate44.errors = [{ instancePath: instancePath + "/reasonCode", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/reasonCode/maxLength", keyword: "maxLength", params: { limit: 100 }, message: "must NOT have more than 100 characters" }];
|
|
11785
|
+
return false;
|
|
11786
|
+
}
|
|
11787
|
+
} else {
|
|
11788
|
+
validate44.errors = [{ instancePath: instancePath + "/reasonCode", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/reasonCode/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
11789
|
+
return false;
|
|
11790
|
+
}
|
|
11599
11791
|
}
|
|
11600
|
-
var valid1 =
|
|
11792
|
+
var valid1 = _errs30 === errors;
|
|
11601
11793
|
} else {
|
|
11602
11794
|
var valid1 = true;
|
|
11603
11795
|
}
|
|
11604
11796
|
if (valid1) {
|
|
11605
|
-
if (data.
|
|
11606
|
-
let
|
|
11607
|
-
const
|
|
11608
|
-
if (
|
|
11609
|
-
|
|
11610
|
-
|
|
11611
|
-
|
|
11612
|
-
|
|
11613
|
-
|
|
11614
|
-
|
|
11615
|
-
validate44.errors = [{ instancePath: instancePath + "/reason", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/reason/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
11616
|
-
return false;
|
|
11617
|
-
}
|
|
11797
|
+
if (data.choice !== void 0) {
|
|
11798
|
+
let data14 = data.choice;
|
|
11799
|
+
const _errs32 = errors;
|
|
11800
|
+
if (typeof data14 !== "string") {
|
|
11801
|
+
validate44.errors = [{ instancePath: instancePath + "/choice", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/choice/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
11802
|
+
return false;
|
|
11803
|
+
}
|
|
11804
|
+
if (!(data14 === "adhere" || data14 === "supersede")) {
|
|
11805
|
+
validate44.errors = [{ instancePath: instancePath + "/choice", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/choice/enum", keyword: "enum", params: { allowedValues: schema79.properties.choice.enum }, message: "must be equal to one of the allowed values" }];
|
|
11806
|
+
return false;
|
|
11618
11807
|
}
|
|
11619
|
-
var valid1 =
|
|
11808
|
+
var valid1 = _errs32 === errors;
|
|
11620
11809
|
} else {
|
|
11621
11810
|
var valid1 = true;
|
|
11622
11811
|
}
|
|
11623
11812
|
if (valid1) {
|
|
11624
|
-
if (data.
|
|
11625
|
-
let
|
|
11626
|
-
const
|
|
11627
|
-
if (errors ===
|
|
11628
|
-
if (typeof
|
|
11629
|
-
if (
|
|
11630
|
-
validate44.errors = [{ instancePath: instancePath + "/
|
|
11813
|
+
if (data.reason !== void 0) {
|
|
11814
|
+
let data15 = data.reason;
|
|
11815
|
+
const _errs34 = errors;
|
|
11816
|
+
if (errors === _errs34) {
|
|
11817
|
+
if (typeof data15 === "string") {
|
|
11818
|
+
if (func1(data15) > 500) {
|
|
11819
|
+
validate44.errors = [{ instancePath: instancePath + "/reason", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/reason/maxLength", keyword: "maxLength", params: { limit: 500 }, message: "must NOT have more than 500 characters" }];
|
|
11631
11820
|
return false;
|
|
11632
11821
|
}
|
|
11633
11822
|
} else {
|
|
11634
|
-
validate44.errors = [{ instancePath: instancePath + "/
|
|
11823
|
+
validate44.errors = [{ instancePath: instancePath + "/reason", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/reason/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
11635
11824
|
return false;
|
|
11636
11825
|
}
|
|
11637
11826
|
}
|
|
11638
|
-
var valid1 =
|
|
11827
|
+
var valid1 = _errs34 === errors;
|
|
11639
11828
|
} else {
|
|
11640
11829
|
var valid1 = true;
|
|
11641
11830
|
}
|
|
11831
|
+
if (valid1) {
|
|
11832
|
+
if (data.approvedDigest !== void 0) {
|
|
11833
|
+
let data16 = data.approvedDigest;
|
|
11834
|
+
const _errs36 = errors;
|
|
11835
|
+
if (errors === _errs36) {
|
|
11836
|
+
if (typeof data16 === "string") {
|
|
11837
|
+
if (!pattern5.test(data16)) {
|
|
11838
|
+
validate44.errors = [{ instancePath: instancePath + "/approvedDigest", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/approvedDigest/pattern", keyword: "pattern", params: { pattern: "^[a-f0-9]{64}$" }, message: 'must match pattern "^[a-f0-9]{64}$"' }];
|
|
11839
|
+
return false;
|
|
11840
|
+
}
|
|
11841
|
+
} else {
|
|
11842
|
+
validate44.errors = [{ instancePath: instancePath + "/approvedDigest", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/DemoStatusResponse/properties/approvedDigest/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
11843
|
+
return false;
|
|
11844
|
+
}
|
|
11845
|
+
}
|
|
11846
|
+
var valid1 = _errs36 === errors;
|
|
11847
|
+
} else {
|
|
11848
|
+
var valid1 = true;
|
|
11849
|
+
}
|
|
11850
|
+
}
|
|
11642
11851
|
}
|
|
11643
11852
|
}
|
|
11644
11853
|
}
|
|
@@ -12529,7 +12738,7 @@ function validate48(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
12529
12738
|
}
|
|
12530
12739
|
validate48.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
12531
12740
|
var schema89 = { "anyOf": [{ "type": "object", "properties": { "protocolVersion": { "type": "integer", "minimum": 1, "maximum": 2 }, "status": { "type": "string", "const": "empty" }, "hasMore": { "type": "boolean", "const": false } }, "required": ["protocolVersion", "status", "hasMore"], "additionalProperties": {} }, { "type": "object", "properties": { "protocolVersion": { "type": "integer", "minimum": 1, "maximum": 2 }, "status": { "type": "string", "const": "leased" }, "events": { "minItems": 1, "maxItems": 40, "type": "array", "items": { "type": "object", "properties": { "eventId": { "type": "string", "minLength": 1, "maxLength": 128 }, "leaseVersion": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, "shortId": { "type": "string", "pattern": "^[0-9a-f]{8}$" }, "decisionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "intent": { "type": "string" }, "webUrl": { "type": "string" }, "kind": { "type": "string", "enum": ["confirm_prompt", "publish_prompt"] } }, "required": ["eventId", "leaseVersion", "shortId", "intent", "webUrl"], "additionalProperties": {} } }, "hasMore": { "type": "boolean" } }, "required": ["protocolVersion", "status", "events", "hasMore"], "additionalProperties": {} }, { "type": "object", "properties": { "protocolVersion": { "type": "integer", "minimum": 1, "maximum": 2 }, "status": { "type": "string", "const": "unavailable" }, "reason": { "type": "string", "const": "organization_unbound" } }, "required": ["protocolVersion", "status", "reason"], "additionalProperties": {} }], "x-primitive-runtime-refinements": ["feedback_response_version_negotiation", "feedback_publish_prompt_decision_id", "unique_feedback_event_ids"] };
|
|
12532
|
-
var
|
|
12741
|
+
var pattern14 = new RegExp("^[0-9a-f]{8}$", "u");
|
|
12533
12742
|
function validate49(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
12534
12743
|
;
|
|
12535
12744
|
let vErrors = null;
|
|
@@ -12868,7 +13077,7 @@ function validate49(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
12868
13077
|
const _errs27 = errors;
|
|
12869
13078
|
if (errors === _errs27) {
|
|
12870
13079
|
if (typeof data9 === "string") {
|
|
12871
|
-
if (!
|
|
13080
|
+
if (!pattern14.test(data9)) {
|
|
12872
13081
|
const err24 = { instancePath: instancePath + "/events/" + i0 + "/shortId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/FeedbackLeaseResponse/anyOf/1/properties/events/items/properties/shortId/pattern", keyword: "pattern", params: { pattern: "^[0-9a-f]{8}$" }, message: 'must match pattern "^[0-9a-f]{8}$"' };
|
|
12873
13082
|
if (vErrors === null) {
|
|
12874
13083
|
vErrors = [err24];
|
|
@@ -13924,8 +14133,8 @@ function validate51(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
13924
14133
|
return errors === 0;
|
|
13925
14134
|
}
|
|
13926
14135
|
validate51.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
13927
|
-
var
|
|
13928
|
-
var
|
|
14136
|
+
var pattern15 = new RegExp("^[A-Za-z0-9]{1,128}$", "u");
|
|
14137
|
+
var pattern16 = new RegExp("^https:\\/\\/github\\.com\\/apps\\/primitive(?:-staging)?\\/installations\\/new\\?state=[0-9a-f]{64}$", "u");
|
|
13929
14138
|
function validate52(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
13930
14139
|
;
|
|
13931
14140
|
let vErrors = null;
|
|
@@ -14007,7 +14216,7 @@ function validate52(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
14007
14216
|
const _errs9 = errors;
|
|
14008
14217
|
if (errors === _errs9) {
|
|
14009
14218
|
if (typeof data3 === "string") {
|
|
14010
|
-
if (!
|
|
14219
|
+
if (!pattern15.test(data3)) {
|
|
14011
14220
|
validate52.errors = [{ instancePath: instancePath + "/intentId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartResponse/properties/intentId/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9]{1,128}$" }, message: 'must match pattern "^[A-Za-z0-9]{1,128}$"' }];
|
|
14012
14221
|
return false;
|
|
14013
14222
|
}
|
|
@@ -14026,7 +14235,7 @@ function validate52(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
14026
14235
|
const _errs11 = errors;
|
|
14027
14236
|
if (errors === _errs11) {
|
|
14028
14237
|
if (typeof data4 === "string") {
|
|
14029
|
-
if (!
|
|
14238
|
+
if (!pattern16.test(data4)) {
|
|
14030
14239
|
validate52.errors = [{ instancePath: instancePath + "/browserUrl", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartResponse/properties/browserUrl/pattern", keyword: "pattern", params: { pattern: "^https:\\/\\/github\\.com\\/apps\\/primitive(?:-staging)?\\/installations\\/new\\?state=[0-9a-f]{64}$" }, message: 'must match pattern "^https:\\/\\/github\\.com\\/apps\\/primitive(?:-staging)?\\/installations\\/new\\?state=[0-9a-f]{64}$"' }];
|
|
14031
14240
|
return false;
|
|
14032
14241
|
}
|
|
@@ -14434,7 +14643,7 @@ function validate54(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
14434
14643
|
const _errs3 = errors;
|
|
14435
14644
|
if (errors === _errs3) {
|
|
14436
14645
|
if (typeof data0 === "string") {
|
|
14437
|
-
if (!
|
|
14646
|
+
if (!pattern15.test(data0)) {
|
|
14438
14647
|
validate54.errors = [{ instancePath: instancePath + "/intentId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStatusRequest/properties/intentId/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9]{1,128}$" }, message: 'must match pattern "^[A-Za-z0-9]{1,128}$"' }];
|
|
14439
14648
|
return false;
|
|
14440
14649
|
}
|
|
@@ -16006,7 +16215,7 @@ function validate55(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
16006
16215
|
}
|
|
16007
16216
|
validate55.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
16008
16217
|
var schema103 = { "type": "object", "properties": { "batch": { "type": "array", "items": { "anyOf": [{ "type": "object", "properties": { "moveId": { "type": "string" }, "capturedAt": { "type": "number" }, "sessionId": { "type": "string" }, "invocationId": { "type": "string" }, "eventType": { "type": "string" }, "payload": {}, "env": {}, "repositoryContext": { "oneOf": [{ "type": "object", "properties": { "kind": { "type": "string", "const": "repository_bound" }, "repoSyncId": { "type": "string", "minLength": 1, "maxLength": 128 } }, "required": ["kind", "repoSyncId"], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "non_repository" } }, "required": ["kind"], "additionalProperties": false }] }, "capturedOrganizationId": { "type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9_-]+$" }, "captureAuthorityKind": { "type": "string", "enum": ["workos", "service_token"] }, "decisionLifecycleProtocolVersion": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, "producer": { "type": "string", "enum": ["claude_code", "codex", "cursor", "hermes"] }, "toolOutcome": { "type": "string", "enum": ["succeeded", "returned", "failed", "interrupted", "prevented", "unknown"] }, "envelopeVersion": { "type": "number", "const": 4 } }, "required": ["moveId", "capturedAt", "sessionId", "eventType", "capturedOrganizationId", "captureAuthorityKind", "decisionLifecycleProtocolVersion", "envelopeVersion"], "additionalProperties": {} }, { "type": "object", "properties": { "moveId": { "type": "string" }, "capturedAt": { "type": "number" }, "sessionId": { "type": "string" }, "invocationId": { "type": "string" }, "eventType": { "type": "string" }, "payload": {}, "env": {}, "repositoryContext": { "oneOf": [{ "type": "object", "properties": { "kind": { "type": "string", "const": "repository_bound" }, "repoSyncId": { "type": "string", "minLength": 1, "maxLength": 128 } }, "required": ["kind", "repoSyncId"], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "non_repository" } }, "required": ["kind"], "additionalProperties": false }] }, "capturedOrganizationId": { "type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9_-]+$" }, "captureAuthorityKind": { "type": "string", "enum": ["workos", "service_token"] }, "decisionLifecycleProtocolVersion": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, "producer": { "type": "string", "enum": ["claude_code", "codex", "cursor", "hermes"] }, "toolOutcome": { "type": "string", "enum": ["succeeded", "returned", "failed", "interrupted", "prevented", "unknown"] }, "envelopeVersion": { "type": "number", "exclusiveMaximum": 4 } }, "required": ["moveId", "capturedAt", "sessionId", "eventType"], "additionalProperties": {} }] } } }, "required": ["batch"], "additionalProperties": {} };
|
|
16009
|
-
var
|
|
16218
|
+
var pattern18 = new RegExp("^[A-Za-z0-9_-]+$", "u");
|
|
16010
16219
|
function validate56(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
16011
16220
|
;
|
|
16012
16221
|
let vErrors = null;
|
|
@@ -16367,7 +16576,7 @@ function validate56(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
16367
16576
|
}
|
|
16368
16577
|
errors++;
|
|
16369
16578
|
} else {
|
|
16370
|
-
if (!
|
|
16579
|
+
if (!pattern18.test(data11)) {
|
|
16371
16580
|
const err22 = { instancePath: instancePath + "/batch/" + i0 + "/capturedOrganizationId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/capturedOrganizationId/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9_-]+$" }, message: 'must match pattern "^[A-Za-z0-9_-]+$"' };
|
|
16372
16581
|
if (vErrors === null) {
|
|
16373
16582
|
vErrors = [err22];
|
|
@@ -16892,7 +17101,7 @@ function validate56(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
16892
17101
|
}
|
|
16893
17102
|
errors++;
|
|
16894
17103
|
} else {
|
|
16895
|
-
if (!
|
|
17104
|
+
if (!pattern18.test(data26)) {
|
|
16896
17105
|
const err58 = { instancePath: instancePath + "/batch/" + i0 + "/capturedOrganizationId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/capturedOrganizationId/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9_-]+$" }, message: 'must match pattern "^[A-Za-z0-9_-]+$"' };
|
|
16897
17106
|
if (vErrors === null) {
|
|
16898
17107
|
vErrors = [err58];
|
|
@@ -17135,10 +17344,10 @@ function validate56(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17135
17344
|
}
|
|
17136
17345
|
validate56.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
17137
17346
|
var schema105 = { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 3 }, "agent": { "type": "string", "enum": ["claude_code", "codex", "cursor", "hermes"] }, "sessionId": { "type": "string", "pattern": "^[A-Za-z0-9._:-]{1,128}$" }, "invocationId": { "type": "string", "pattern": "^[A-Za-z0-9._:-]{1,128}$" }, "repoSyncId": { "type": "string", "pattern": "^[A-Za-z0-9]{1,64}$" }, "paths": { "maxItems": 32, "type": "array", "items": { "type": "string" } }, "coverage": { "type": "string", "enum": ["complete", "unverified"] }, "branch": { "type": "string", "maxLength": 255, "pattern": "^(?!@?$)(?!\\/)(?!.*\\/$)(?!.*\\/\\/)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)[^/]*\\.lock(?:\\/|$))(?!.*\\.\\.)(?!.*@\\{)(?!.*[~^:?*\\\\]).+$" }, "clientMode": { "type": "string", "enum": ["block", "warn"] }, "clientVersion": { "type": "string", "maxLength": 32, "pattern": "^[A-Za-z0-9][A-Za-z0-9._+-]*$" }, "proposal": { "type": "string" } }, "required": ["protocolVersion", "agent", "sessionId", "invocationId", "repoSyncId", "paths", "coverage", "proposal"], "additionalProperties": false, "x-primitive-runtime-refinements": ["canonical_repository_paths", "unique_repository_paths", "complete_coverage_requires_path", "proposal_utf8_max_6144", "degrade_invalid_rollout_fields", "degrade_invalid_branch"] };
|
|
17138
|
-
var
|
|
17139
|
-
var
|
|
17140
|
-
var
|
|
17141
|
-
var
|
|
17347
|
+
var pattern20 = new RegExp("^[A-Za-z0-9._:-]{1,128}$", "u");
|
|
17348
|
+
var pattern22 = new RegExp("^[A-Za-z0-9]{1,64}$", "u");
|
|
17349
|
+
var pattern23 = new RegExp("^(?!@?$)(?!\\/)(?!.*\\/$)(?!.*\\/\\/)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)[^/]*\\.lock(?:\\/|$))(?!.*\\.\\.)(?!.*@\\{)(?!.*[~^:?*\\\\]).+$", "u");
|
|
17350
|
+
var pattern24 = new RegExp("^[A-Za-z0-9][A-Za-z0-9._+-]*$", "u");
|
|
17142
17351
|
function validate57(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
17143
17352
|
;
|
|
17144
17353
|
let vErrors = null;
|
|
@@ -17204,7 +17413,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17204
17413
|
const _errs8 = errors;
|
|
17205
17414
|
if (errors === _errs8) {
|
|
17206
17415
|
if (typeof data2 === "string") {
|
|
17207
|
-
if (!
|
|
17416
|
+
if (!pattern20.test(data2)) {
|
|
17208
17417
|
validate57.errors = [{ instancePath: instancePath + "/sessionId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightRequestV3/properties/sessionId/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9._:-]{1,128}$" }, message: 'must match pattern "^[A-Za-z0-9._:-]{1,128}$"' }];
|
|
17209
17418
|
return false;
|
|
17210
17419
|
}
|
|
@@ -17223,7 +17432,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17223
17432
|
const _errs10 = errors;
|
|
17224
17433
|
if (errors === _errs10) {
|
|
17225
17434
|
if (typeof data3 === "string") {
|
|
17226
|
-
if (!
|
|
17435
|
+
if (!pattern20.test(data3)) {
|
|
17227
17436
|
validate57.errors = [{ instancePath: instancePath + "/invocationId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightRequestV3/properties/invocationId/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9._:-]{1,128}$" }, message: 'must match pattern "^[A-Za-z0-9._:-]{1,128}$"' }];
|
|
17228
17437
|
return false;
|
|
17229
17438
|
}
|
|
@@ -17242,7 +17451,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17242
17451
|
const _errs12 = errors;
|
|
17243
17452
|
if (errors === _errs12) {
|
|
17244
17453
|
if (typeof data4 === "string") {
|
|
17245
|
-
if (!
|
|
17454
|
+
if (!pattern22.test(data4)) {
|
|
17246
17455
|
validate57.errors = [{ instancePath: instancePath + "/repoSyncId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightRequestV3/properties/repoSyncId/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9]{1,64}$" }, message: 'must match pattern "^[A-Za-z0-9]{1,64}$"' }];
|
|
17247
17456
|
return false;
|
|
17248
17457
|
}
|
|
@@ -17314,7 +17523,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17314
17523
|
validate57.errors = [{ instancePath: instancePath + "/branch", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightRequestV3/properties/branch/maxLength", keyword: "maxLength", params: { limit: 255 }, message: "must NOT have more than 255 characters" }];
|
|
17315
17524
|
return false;
|
|
17316
17525
|
} else {
|
|
17317
|
-
if (!
|
|
17526
|
+
if (!pattern23.test(data8)) {
|
|
17318
17527
|
validate57.errors = [{ instancePath: instancePath + "/branch", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightRequestV3/properties/branch/pattern", keyword: "pattern", params: { pattern: "^(?!@?$)(?!\\/)(?!.*\\/$)(?!.*\\/\\/)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)[^/]*\\.lock(?:\\/|$))(?!.*\\.\\.)(?!.*@\\{)(?!.*[~^:?*\\\\]).+$" }, message: 'must match pattern "^(?!@?$)(?!\\/)(?!.*\\/$)(?!.*\\/\\/)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)[^/]*\\.lock(?:\\/|$))(?!.*\\.\\.)(?!.*@\\{)(?!.*[~^:?*\\\\]).+$"' }];
|
|
17319
17528
|
return false;
|
|
17320
17529
|
}
|
|
@@ -17354,7 +17563,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17354
17563
|
validate57.errors = [{ instancePath: instancePath + "/clientVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightRequestV3/properties/clientVersion/maxLength", keyword: "maxLength", params: { limit: 32 }, message: "must NOT have more than 32 characters" }];
|
|
17355
17564
|
return false;
|
|
17356
17565
|
} else {
|
|
17357
|
-
if (!
|
|
17566
|
+
if (!pattern24.test(data10)) {
|
|
17358
17567
|
validate57.errors = [{ instancePath: instancePath + "/clientVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightRequestV3/properties/clientVersion/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9][A-Za-z0-9._+-]*$" }, message: 'must match pattern "^[A-Za-z0-9][A-Za-z0-9._+-]*$"' }];
|
|
17359
17568
|
return false;
|
|
17360
17569
|
}
|
|
@@ -17441,7 +17650,7 @@ function validate58(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17441
17650
|
const _errs5 = errors;
|
|
17442
17651
|
if (errors === _errs5) {
|
|
17443
17652
|
if (typeof data1 === "string") {
|
|
17444
|
-
if (!
|
|
17653
|
+
if (!pattern20.test(data1)) {
|
|
17445
17654
|
validate58.errors = [{ instancePath: instancePath + "/checkId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/checkId/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9._:-]{1,128}$" }, message: 'must match pattern "^[A-Za-z0-9._:-]{1,128}$"' }];
|
|
17446
17655
|
return false;
|
|
17447
17656
|
}
|
|
@@ -17738,8 +17947,8 @@ function validate58(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17738
17947
|
return errors === 0;
|
|
17739
17948
|
}
|
|
17740
17949
|
validate58.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
17741
|
-
var
|
|
17742
|
-
var
|
|
17950
|
+
var pattern26 = new RegExp("^[A-Za-z0-9._-]{1,128}$", "u");
|
|
17951
|
+
var pattern27 = new RegExp("^pci_[A-Za-z0-9_-]{43}$", "u");
|
|
17743
17952
|
function validate59(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
17744
17953
|
;
|
|
17745
17954
|
let vErrors = null;
|
|
@@ -17764,7 +17973,7 @@ function validate59(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17764
17973
|
const _errs3 = errors;
|
|
17765
17974
|
if (errors === _errs3) {
|
|
17766
17975
|
if (typeof data0 === "string") {
|
|
17767
|
-
if (!
|
|
17976
|
+
if (!pattern26.test(data0)) {
|
|
17768
17977
|
validate59.errors = [{ instancePath: instancePath + "/sessionId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PresenceHeartbeatRequest/properties/sessionId/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9._-]{1,128}$" }, message: 'must match pattern "^[A-Za-z0-9._-]{1,128}$"' }];
|
|
17769
17978
|
return false;
|
|
17770
17979
|
}
|
|
@@ -17783,7 +17992,7 @@ function validate59(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17783
17992
|
const _errs5 = errors;
|
|
17784
17993
|
if (errors === _errs5) {
|
|
17785
17994
|
if (typeof data1 === "string") {
|
|
17786
|
-
if (!
|
|
17995
|
+
if (!pattern27.test(data1)) {
|
|
17787
17996
|
validate59.errors = [{ instancePath: instancePath + "/clientInstanceId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PresenceHeartbeatRequest/properties/clientInstanceId/pattern", keyword: "pattern", params: { pattern: "^pci_[A-Za-z0-9_-]{43}$" }, message: 'must match pattern "^pci_[A-Za-z0-9_-]{43}$"' }];
|
|
17788
17997
|
return false;
|
|
17789
17998
|
}
|
|
@@ -18446,7 +18655,7 @@ function validate62(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18446
18655
|
return errors === 0;
|
|
18447
18656
|
}
|
|
18448
18657
|
validate62.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
18449
|
-
var
|
|
18658
|
+
var pattern28 = new RegExp("^(?![A-Za-z0-9-]*--)[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?\\/[A-Za-z0-9._-]{1,100}$", "u");
|
|
18450
18659
|
function validate63(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
18451
18660
|
;
|
|
18452
18661
|
let vErrors = null;
|
|
@@ -18480,7 +18689,7 @@ function validate63(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18480
18689
|
const _errs3 = errors;
|
|
18481
18690
|
if (errors === _errs3) {
|
|
18482
18691
|
if (typeof data0 === "string") {
|
|
18483
|
-
if (!
|
|
18692
|
+
if (!pattern28.test(data0)) {
|
|
18484
18693
|
validate63.errors = [{ instancePath: instancePath + "/repositoryFullName", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/RepositoryBindRequest/properties/repositoryFullName/pattern", keyword: "pattern", params: { pattern: "^(?![A-Za-z0-9-]*--)[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?\\/[A-Za-z0-9._-]{1,100}$" }, message: 'must match pattern "^(?![A-Za-z0-9-]*--)[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?\\/[A-Za-z0-9._-]{1,100}$"' }];
|
|
18485
18694
|
return false;
|
|
18486
18695
|
}
|
|
@@ -18545,7 +18754,7 @@ function validate64(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18545
18754
|
return errors === 0;
|
|
18546
18755
|
}
|
|
18547
18756
|
validate64.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
18548
|
-
var
|
|
18757
|
+
var pattern30 = new RegExp("^api_key_[A-Za-z0-9_-]+$", "u");
|
|
18549
18758
|
function validate65(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
18550
18759
|
;
|
|
18551
18760
|
let vErrors = null;
|
|
@@ -18631,7 +18840,7 @@ function validate65(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18631
18840
|
validate65.errors = [{ instancePath: instancePath + "/after", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/properties/after/minLength", keyword: "minLength", params: { limit: 9 }, message: "must NOT have fewer than 9 characters" }];
|
|
18632
18841
|
return false;
|
|
18633
18842
|
} else {
|
|
18634
|
-
if (!
|
|
18843
|
+
if (!pattern30.test(data2)) {
|
|
18635
18844
|
validate65.errors = [{ instancePath: instancePath + "/after", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/properties/after/pattern", keyword: "pattern", params: { pattern: "^api_key_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^api_key_[A-Za-z0-9_-]+$"' }];
|
|
18636
18845
|
return false;
|
|
18637
18846
|
}
|
|
@@ -18659,9 +18868,9 @@ function validate65(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18659
18868
|
return errors === 0;
|
|
18660
18869
|
}
|
|
18661
18870
|
validate65.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
18662
|
-
var
|
|
18663
|
-
var
|
|
18664
|
-
var
|
|
18871
|
+
var pattern32 = new RegExp("^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$", "u");
|
|
18872
|
+
var pattern33 = new RegExp("^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$", "u");
|
|
18873
|
+
var pattern34 = new RegExp("^[\\x21-\\x7e]+$", "u");
|
|
18665
18874
|
function validate66(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
18666
18875
|
;
|
|
18667
18876
|
let vErrors = null;
|
|
@@ -18733,7 +18942,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18733
18942
|
validate66.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/id/minLength", keyword: "minLength", params: { limit: 9 }, message: "must NOT have fewer than 9 characters" }];
|
|
18734
18943
|
return false;
|
|
18735
18944
|
} else {
|
|
18736
|
-
if (!
|
|
18945
|
+
if (!pattern30.test(data2)) {
|
|
18737
18946
|
validate66.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/id/pattern", keyword: "pattern", params: { pattern: "^api_key_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^api_key_[A-Za-z0-9_-]+$"' }];
|
|
18738
18947
|
return false;
|
|
18739
18948
|
}
|
|
@@ -18762,7 +18971,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18762
18971
|
validate66.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/name/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
18763
18972
|
return false;
|
|
18764
18973
|
} else {
|
|
18765
|
-
if (!
|
|
18974
|
+
if (!pattern32.test(data3)) {
|
|
18766
18975
|
validate66.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/name/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$" }, message: 'must match pattern "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$"' }];
|
|
18767
18976
|
return false;
|
|
18768
18977
|
}
|
|
@@ -18791,7 +19000,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18791
19000
|
validate66.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/obfuscatedValue/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
18792
19001
|
return false;
|
|
18793
19002
|
} else {
|
|
18794
|
-
if (!
|
|
19003
|
+
if (!pattern33.test(data4)) {
|
|
18795
19004
|
validate66.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/obfuscatedValue/pattern", keyword: "pattern", params: { pattern: "^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$" }, message: 'must match pattern "^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$"' }];
|
|
18796
19005
|
return false;
|
|
18797
19006
|
}
|
|
@@ -18831,7 +19040,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18831
19040
|
validate66.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/permissions/" + i1, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/permissions/items/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
18832
19041
|
return false;
|
|
18833
19042
|
} else {
|
|
18834
|
-
if (!
|
|
19043
|
+
if (!pattern34.test(data6)) {
|
|
18835
19044
|
validate66.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/permissions/" + i1, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/permissions/items/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e]+$" }, message: 'must match pattern "^[\\x21-\\x7e]+$"' }];
|
|
18836
19045
|
return false;
|
|
18837
19046
|
}
|
|
@@ -19117,7 +19326,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19117
19326
|
}
|
|
19118
19327
|
errors++;
|
|
19119
19328
|
} else {
|
|
19120
|
-
if (!
|
|
19329
|
+
if (!pattern30.test(data11)) {
|
|
19121
19330
|
const err12 = { instancePath: instancePath + "/nextCursor", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/nextCursor/anyOf/0/pattern", keyword: "pattern", params: { pattern: "^api_key_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^api_key_[A-Za-z0-9_-]+$"' };
|
|
19122
19331
|
if (vErrors === null) {
|
|
19123
19332
|
vErrors = [err12];
|
|
@@ -19229,7 +19438,7 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19229
19438
|
validate67.errors = [{ instancePath: instancePath + "/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/id/minLength", keyword: "minLength", params: { limit: 9 }, message: "must NOT have fewer than 9 characters" }];
|
|
19230
19439
|
return false;
|
|
19231
19440
|
} else {
|
|
19232
|
-
if (!
|
|
19441
|
+
if (!pattern30.test(data0)) {
|
|
19233
19442
|
validate67.errors = [{ instancePath: instancePath + "/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/id/pattern", keyword: "pattern", params: { pattern: "^api_key_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^api_key_[A-Za-z0-9_-]+$"' }];
|
|
19234
19443
|
return false;
|
|
19235
19444
|
}
|
|
@@ -19258,7 +19467,7 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19258
19467
|
validate67.errors = [{ instancePath: instancePath + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/name/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
19259
19468
|
return false;
|
|
19260
19469
|
} else {
|
|
19261
|
-
if (!
|
|
19470
|
+
if (!pattern32.test(data1)) {
|
|
19262
19471
|
validate67.errors = [{ instancePath: instancePath + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/name/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$" }, message: 'must match pattern "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$"' }];
|
|
19263
19472
|
return false;
|
|
19264
19473
|
}
|
|
@@ -19287,7 +19496,7 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19287
19496
|
validate67.errors = [{ instancePath: instancePath + "/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/obfuscatedValue/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
19288
19497
|
return false;
|
|
19289
19498
|
} else {
|
|
19290
|
-
if (!
|
|
19499
|
+
if (!pattern33.test(data2)) {
|
|
19291
19500
|
validate67.errors = [{ instancePath: instancePath + "/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/obfuscatedValue/pattern", keyword: "pattern", params: { pattern: "^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$" }, message: 'must match pattern "^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$"' }];
|
|
19292
19501
|
return false;
|
|
19293
19502
|
}
|
|
@@ -19327,7 +19536,7 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19327
19536
|
validate67.errors = [{ instancePath: instancePath + "/permissions/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/permissions/items/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
19328
19537
|
return false;
|
|
19329
19538
|
} else {
|
|
19330
|
-
if (!
|
|
19539
|
+
if (!pattern34.test(data4)) {
|
|
19331
19540
|
validate67.errors = [{ instancePath: instancePath + "/permissions/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/permissions/items/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e]+$" }, message: 'must match pattern "^[\\x21-\\x7e]+$"' }];
|
|
19332
19541
|
return false;
|
|
19333
19542
|
}
|
|
@@ -19635,7 +19844,7 @@ function validate68(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19635
19844
|
validate68.errors = [{ instancePath: instancePath + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/properties/name/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
19636
19845
|
return false;
|
|
19637
19846
|
} else {
|
|
19638
|
-
if (!
|
|
19847
|
+
if (!pattern32.test(data1)) {
|
|
19639
19848
|
validate68.errors = [{ instancePath: instancePath + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/properties/name/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$" }, message: 'must match pattern "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$"' }];
|
|
19640
19849
|
return false;
|
|
19641
19850
|
}
|
|
@@ -19688,7 +19897,7 @@ function validate68(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19688
19897
|
return errors === 0;
|
|
19689
19898
|
}
|
|
19690
19899
|
validate68.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
19691
|
-
var
|
|
19900
|
+
var pattern46 = new RegExp("^sk_[\\x21-\\x7e]+(?: [\\x21-\\x7e]+)*$", "u");
|
|
19692
19901
|
function validate69(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
19693
19902
|
;
|
|
19694
19903
|
let vErrors = null;
|
|
@@ -19749,7 +19958,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19749
19958
|
validate69.errors = [{ instancePath: instancePath + "/apiKey/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/id/minLength", keyword: "minLength", params: { limit: 9 }, message: "must NOT have fewer than 9 characters" }];
|
|
19750
19959
|
return false;
|
|
19751
19960
|
} else {
|
|
19752
|
-
if (!
|
|
19961
|
+
if (!pattern30.test(data1)) {
|
|
19753
19962
|
validate69.errors = [{ instancePath: instancePath + "/apiKey/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/id/pattern", keyword: "pattern", params: { pattern: "^api_key_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^api_key_[A-Za-z0-9_-]+$"' }];
|
|
19754
19963
|
return false;
|
|
19755
19964
|
}
|
|
@@ -19778,7 +19987,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19778
19987
|
validate69.errors = [{ instancePath: instancePath + "/apiKey/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/name/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
19779
19988
|
return false;
|
|
19780
19989
|
} else {
|
|
19781
|
-
if (!
|
|
19990
|
+
if (!pattern32.test(data2)) {
|
|
19782
19991
|
validate69.errors = [{ instancePath: instancePath + "/apiKey/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/name/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$" }, message: 'must match pattern "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$"' }];
|
|
19783
19992
|
return false;
|
|
19784
19993
|
}
|
|
@@ -19807,7 +20016,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19807
20016
|
validate69.errors = [{ instancePath: instancePath + "/apiKey/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/obfuscatedValue/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
19808
20017
|
return false;
|
|
19809
20018
|
} else {
|
|
19810
|
-
if (!
|
|
20019
|
+
if (!pattern33.test(data3)) {
|
|
19811
20020
|
validate69.errors = [{ instancePath: instancePath + "/apiKey/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/obfuscatedValue/pattern", keyword: "pattern", params: { pattern: "^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$" }, message: 'must match pattern "^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$"' }];
|
|
19812
20021
|
return false;
|
|
19813
20022
|
}
|
|
@@ -19847,7 +20056,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19847
20056
|
validate69.errors = [{ instancePath: instancePath + "/apiKey/permissions/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/permissions/items/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
19848
20057
|
return false;
|
|
19849
20058
|
} else {
|
|
19850
|
-
if (!
|
|
20059
|
+
if (!pattern34.test(data5)) {
|
|
19851
20060
|
validate69.errors = [{ instancePath: instancePath + "/apiKey/permissions/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/permissions/items/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e]+$" }, message: 'must match pattern "^[\\x21-\\x7e]+$"' }];
|
|
19852
20061
|
return false;
|
|
19853
20062
|
}
|
|
@@ -20109,7 +20318,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
20109
20318
|
validate69.errors = [{ instancePath: instancePath + "/secret", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/secret/minLength", keyword: "minLength", params: { limit: 4 }, message: "must NOT have fewer than 4 characters" }];
|
|
20110
20319
|
return false;
|
|
20111
20320
|
} else {
|
|
20112
|
-
if (!
|
|
20321
|
+
if (!pattern46.test(data10)) {
|
|
20113
20322
|
validate69.errors = [{ instancePath: instancePath + "/secret", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/secret/pattern", keyword: "pattern", params: { pattern: "^sk_[\\x21-\\x7e]+(?: [\\x21-\\x7e]+)*$" }, message: 'must match pattern "^sk_[\\x21-\\x7e]+(?: [\\x21-\\x7e]+)*$"' }];
|
|
20114
20323
|
return false;
|
|
20115
20324
|
}
|
|
@@ -20231,7 +20440,7 @@ function validate71(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
20231
20440
|
validate71.errors = [{ instancePath: instancePath + "/apiKeyId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeResponse/properties/apiKeyId/minLength", keyword: "minLength", params: { limit: 9 }, message: "must NOT have fewer than 9 characters" }];
|
|
20232
20441
|
return false;
|
|
20233
20442
|
} else {
|
|
20234
|
-
if (!
|
|
20443
|
+
if (!pattern30.test(data0)) {
|
|
20235
20444
|
validate71.errors = [{ instancePath: instancePath + "/apiKeyId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeResponse/properties/apiKeyId/pattern", keyword: "pattern", params: { pattern: "^api_key_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^api_key_[A-Za-z0-9_-]+$"' }];
|
|
20236
20445
|
return false;
|
|
20237
20446
|
}
|
|
@@ -20495,7 +20704,7 @@ function validate73(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
20495
20704
|
}
|
|
20496
20705
|
validate73.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
20497
20706
|
var schema139 = { "type": "object", "properties": { "protocol_version": { "type": "number", "const": 1 }, "issuer": { "type": "string", "format": "uri" }, "client_id": { "type": "string", "maxLength": 256, "pattern": "^client_[A-Za-z0-9_-]+$" }, "default_scopes": { "minItems": 4, "maxItems": 4, "type": "array", "items": { "type": "string", "enum": ["openid", "profile", "email", "offline_access"] } } }, "required": ["protocol_version", "issuer", "client_id", "default_scopes"], "additionalProperties": false, "x-primitive-runtime-refinements": ["canonical_https_origin", "exact_workos_connect_device_scopes"] };
|
|
20498
|
-
var
|
|
20707
|
+
var pattern49 = new RegExp("^client_[A-Za-z0-9_-]+$", "u");
|
|
20499
20708
|
function validate74(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
20500
20709
|
;
|
|
20501
20710
|
let vErrors = null;
|
|
@@ -20564,7 +20773,7 @@ function validate74(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
20564
20773
|
validate74.errors = [{ instancePath: instancePath + "/client_id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/properties/client_id/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" }];
|
|
20565
20774
|
return false;
|
|
20566
20775
|
} else {
|
|
20567
|
-
if (!
|
|
20776
|
+
if (!pattern49.test(data2)) {
|
|
20568
20777
|
validate74.errors = [{ instancePath: instancePath + "/client_id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/properties/client_id/pattern", keyword: "pattern", params: { pattern: "^client_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^client_[A-Za-z0-9_-]+$"' }];
|
|
20569
20778
|
return false;
|
|
20570
20779
|
}
|
|
@@ -20688,15 +20897,15 @@ validate75.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": f
|
|
|
20688
20897
|
|
|
20689
20898
|
// src/demo/state.ts
|
|
20690
20899
|
var RUN_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u;
|
|
20691
|
-
var demoDirectory = () =>
|
|
20900
|
+
var demoDirectory = () => join8(primConfigDirectory(), "demo");
|
|
20692
20901
|
var runPath = (id) => {
|
|
20693
20902
|
if (!RUN_ID.test(id)) throw new Error("invalid demo run ID");
|
|
20694
|
-
return
|
|
20903
|
+
return join8(demoDirectory(), "runs", `${id}.json`);
|
|
20695
20904
|
};
|
|
20696
20905
|
function readDemoJson(path) {
|
|
20697
|
-
const stat =
|
|
20906
|
+
const stat = lstatSync3(path);
|
|
20698
20907
|
if (!stat.isFile() || stat.size > 16384) throw new Error(`invalid demo state: ${path}`);
|
|
20699
|
-
return JSON.parse(
|
|
20908
|
+
return JSON.parse(readFileSync7(path, "utf8"));
|
|
20700
20909
|
}
|
|
20701
20910
|
function saveDemoJson(path, value) {
|
|
20702
20911
|
atomicWriteFile(path, `${JSON.stringify(value)}
|
|
@@ -20733,16 +20942,16 @@ function demoCommand(run, action, choice, reason) {
|
|
|
20733
20942
|
].map(quote).join(" ");
|
|
20734
20943
|
}
|
|
20735
20944
|
function sessionKey(agent2, session) {
|
|
20736
|
-
return
|
|
20945
|
+
return createHash4("sha256").update(`${agent2}\0${session}`).digest("hex");
|
|
20737
20946
|
}
|
|
20738
20947
|
function exclusionPath(key) {
|
|
20739
20948
|
if (!/^[0-9a-f]{64}$/u.test(key)) throw new Error("invalid demo session identity");
|
|
20740
|
-
return
|
|
20949
|
+
return join8(demoDirectory(), "excluded-sessions", `${key}.json`);
|
|
20741
20950
|
}
|
|
20742
20951
|
function sessionExcluded(agent2, session) {
|
|
20743
20952
|
if (typeof session !== "string" || !session) return false;
|
|
20744
20953
|
const path = exclusionPath(sessionKey(agent2, session));
|
|
20745
|
-
if (!
|
|
20954
|
+
if (!existsSync5(path)) return false;
|
|
20746
20955
|
const record = readDemoJson(path);
|
|
20747
20956
|
if (typeof record.runId !== "string" || !RUN_ID.test(record.runId)) {
|
|
20748
20957
|
throw new Error("invalid demo capture exclusion");
|
|
@@ -20775,42 +20984,86 @@ function demoArgv(command) {
|
|
|
20775
20984
|
}
|
|
20776
20985
|
}
|
|
20777
20986
|
|
|
20987
|
+
// src/demo/diagnostics.ts
|
|
20988
|
+
var observationPath = (id) => join9(demoDirectory(), "observations", `${id}.json`);
|
|
20989
|
+
function observeRun(id, observation) {
|
|
20990
|
+
try {
|
|
20991
|
+
saveDemoJson(observationPath(id), observation);
|
|
20992
|
+
} catch {
|
|
20993
|
+
process.stderr.write(
|
|
20994
|
+
"[prim] demo isolation diagnostic could not be saved; check access to Primitive's configuration directory.\n"
|
|
20995
|
+
);
|
|
20996
|
+
}
|
|
20997
|
+
}
|
|
20998
|
+
|
|
20778
20999
|
// src/demo/isolation.ts
|
|
20779
21000
|
function observeDemoInvocation(envelope, agent2, checkExclusion = true) {
|
|
20780
21001
|
const session = typeof envelope.session_id === "string" && envelope.session_id ? envelope.session_id : agent2 === "hermes" ? envelope.extra?.session_key : void 0;
|
|
20781
21002
|
let invocation = false;
|
|
20782
|
-
if (envelope.hook_event_name === "PreToolUse"
|
|
21003
|
+
if (envelope.hook_event_name === "PreToolUse") {
|
|
20783
21004
|
const tool = agent2 === "cursor" ? "Shell" : agent2 === "hermes" ? "terminal" : "Bash";
|
|
20784
21005
|
const input = envelope.tool_input;
|
|
20785
|
-
const command = input?.command;
|
|
20786
|
-
if (
|
|
21006
|
+
const command = input?.command ?? input?.cmd;
|
|
21007
|
+
if (typeof command === "string" && command.length < 8192) {
|
|
20787
21008
|
const argv = demoArgv(command);
|
|
20788
|
-
const id = argv?.[4];
|
|
20789
|
-
if (id && RUN_ID.test(id) &&
|
|
20790
|
-
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
|
|
20795
|
-
|
|
20796
|
-
|
|
20797
|
-
|
|
20798
|
-
return false;
|
|
20799
|
-
}
|
|
20800
|
-
if (action === "skip") return true;
|
|
20801
|
-
const key = sessionKey(agent2, session);
|
|
20802
|
-
if (run.agent && run.agent !== agent2 || run.binding && run.binding !== key) {
|
|
20803
|
-
run.acknowledgment = void 0;
|
|
20804
|
-
saveRun(run);
|
|
20805
|
-
return false;
|
|
20806
|
-
}
|
|
20807
|
-
saveDemoJson(exclusionPath(key), { runId: run.id });
|
|
20808
|
-
run.binding = key;
|
|
20809
|
-
run.agent = agent2;
|
|
20810
|
-
run.acknowledgment = { command, at: Date.now() };
|
|
20811
|
-
saveRun(run);
|
|
20812
|
-
return true;
|
|
21009
|
+
const id = argv?.[4] ?? command.match(/\x27([0-9a-f-]{36})\x27/u)?.[1];
|
|
21010
|
+
if (id && RUN_ID.test(id) && existsSync7(runPath(id))) {
|
|
21011
|
+
const identity = typeof session === "string" && session ? sessionKey(agent2, session) : void 0;
|
|
21012
|
+
const observed = (result, errorCode) => observeRun(id, {
|
|
21013
|
+
at: Date.now(),
|
|
21014
|
+
agent: agent2,
|
|
21015
|
+
runtimeVersion: packageVersion() ?? void 0,
|
|
21016
|
+
session: identity,
|
|
21017
|
+
result,
|
|
21018
|
+
...errorCode ? { errorCode } : {}
|
|
20813
21019
|
});
|
|
21020
|
+
const action = argv?.[3];
|
|
21021
|
+
const choice = argv?.[6];
|
|
21022
|
+
const reason = argv?.[8];
|
|
21023
|
+
const recognized = ["start", "attempt", "resolve", "status", "skip"].includes(action);
|
|
21024
|
+
const validChoice = action !== "resolve" || choice === "adhere" || choice === "supersede" && typeof reason === "string" && reason.trim().length > 0 && reason.length <= 500;
|
|
21025
|
+
const matches = (run) => !run.terminal && recognized && validChoice && demoCommand(run, action, choice, reason) === command;
|
|
21026
|
+
let candidate;
|
|
21027
|
+
try {
|
|
21028
|
+
candidate = readRun(id);
|
|
21029
|
+
} catch {
|
|
21030
|
+
}
|
|
21031
|
+
if (envelope.tool_name !== tool || typeof input?.command !== "string") {
|
|
21032
|
+
observed("tool-mismatch");
|
|
21033
|
+
} else if (!candidate || !matches(candidate)) {
|
|
21034
|
+
observed("command-mismatch");
|
|
21035
|
+
} else
|
|
21036
|
+
try {
|
|
21037
|
+
invocation = lockRun(id, (run) => {
|
|
21038
|
+
if (!matches(run)) {
|
|
21039
|
+
observed("command-mismatch");
|
|
21040
|
+
return false;
|
|
21041
|
+
}
|
|
21042
|
+
if (action === "skip") return true;
|
|
21043
|
+
if (!identity) {
|
|
21044
|
+
observed("session-missing");
|
|
21045
|
+
return false;
|
|
21046
|
+
}
|
|
21047
|
+
const key = identity;
|
|
21048
|
+
if (run.agent && run.agent !== agent2 || run.binding && run.binding !== key) {
|
|
21049
|
+
observed("session-mismatch");
|
|
21050
|
+
run.acknowledgment = void 0;
|
|
21051
|
+
saveRun(run);
|
|
21052
|
+
return false;
|
|
21053
|
+
}
|
|
21054
|
+
saveDemoJson(exclusionPath(key), { runId: run.id });
|
|
21055
|
+
run.binding = key;
|
|
21056
|
+
run.agent = agent2;
|
|
21057
|
+
run.acknowledgment = { command, at: Date.now() };
|
|
21058
|
+
saveRun(run);
|
|
21059
|
+
observed("acknowledged");
|
|
21060
|
+
return true;
|
|
21061
|
+
});
|
|
21062
|
+
} catch (error) {
|
|
21063
|
+
const code = error.code;
|
|
21064
|
+
observed("write-failed", code && /^[A-Z0-9_]{1,32}$/u.test(code) ? code : void 0);
|
|
21065
|
+
throw error;
|
|
21066
|
+
}
|
|
20814
21067
|
}
|
|
20815
21068
|
}
|
|
20816
21069
|
}
|
|
@@ -20819,15 +21072,15 @@ function observeDemoInvocation(envelope, agent2, checkExclusion = true) {
|
|
|
20819
21072
|
|
|
20820
21073
|
// src/lib/activation.ts
|
|
20821
21074
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
20822
|
-
import { existsSync as
|
|
21075
|
+
import { existsSync as existsSync8, readFileSync as readFileSync8 } from "fs";
|
|
20823
21076
|
import { homedir as homedir2 } from "os";
|
|
20824
|
-
import { join as
|
|
21077
|
+
import { join as join10 } from "path";
|
|
20825
21078
|
|
|
20826
21079
|
// src/lib/git.ts
|
|
20827
21080
|
import { execFileSync } from "child_process";
|
|
20828
|
-
import { createHash as
|
|
20829
|
-
import { lstatSync as
|
|
20830
|
-
import { basename, dirname as
|
|
21081
|
+
import { createHash as createHash5 } from "crypto";
|
|
21082
|
+
import { lstatSync as lstatSync4, realpathSync as realpathSync2 } from "fs";
|
|
21083
|
+
import { basename, dirname as dirname6, isAbsolute as isAbsolute4, relative, resolve as resolve4, sep } from "path";
|
|
20831
21084
|
var GIT_TIMEOUT_MS = 1e3;
|
|
20832
21085
|
var GITHUB_OWNER_PATTERN = /^(?![A-Za-z0-9-]*--)[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/u;
|
|
20833
21086
|
var GITHUB_REPOSITORY_PATTERN = /^[A-Za-z0-9._-]{1,100}$/u;
|
|
@@ -20876,7 +21129,7 @@ function githubRepositoryFullName(cwd) {
|
|
|
20876
21129
|
function canonicalGitRoot(cwd) {
|
|
20877
21130
|
try {
|
|
20878
21131
|
const top = gitToplevel(cwd);
|
|
20879
|
-
return top ?
|
|
21132
|
+
return top ? realpathSync2.native(top) : null;
|
|
20880
21133
|
} catch {
|
|
20881
21134
|
return null;
|
|
20882
21135
|
}
|
|
@@ -20903,16 +21156,16 @@ function normalizeOriginRemote(remote) {
|
|
|
20903
21156
|
}
|
|
20904
21157
|
}
|
|
20905
21158
|
function opaqueRepoKey(source, value) {
|
|
20906
|
-
return `repo_v1_${
|
|
21159
|
+
return `repo_v1_${createHash5("sha256").update(`${source}\0${value}`).digest("hex")}`;
|
|
20907
21160
|
}
|
|
20908
21161
|
function resolveRepositoryContext(cwd = process.cwd()) {
|
|
20909
21162
|
const top = gitToplevel(cwd);
|
|
20910
21163
|
if (!top) return null;
|
|
20911
21164
|
let repoRoot;
|
|
20912
21165
|
try {
|
|
20913
|
-
repoRoot =
|
|
21166
|
+
repoRoot = realpathSync2.native(top);
|
|
20914
21167
|
} catch {
|
|
20915
|
-
repoRoot =
|
|
21168
|
+
repoRoot = resolve4(top);
|
|
20916
21169
|
}
|
|
20917
21170
|
const origin = gitValue(repoRoot, ["config", "--get", "remote.origin.url"]);
|
|
20918
21171
|
const repoFullName = githubRepositoryFullName(repoRoot) ?? void 0;
|
|
@@ -20941,19 +21194,19 @@ function nearestExistingAncestor(path) {
|
|
|
20941
21194
|
let cursor = path;
|
|
20942
21195
|
while (true) {
|
|
20943
21196
|
try {
|
|
20944
|
-
|
|
21197
|
+
lstatSync4(cursor);
|
|
20945
21198
|
break;
|
|
20946
21199
|
} catch (error) {
|
|
20947
21200
|
const code = typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
20948
21201
|
if (code !== "ENOENT" && code !== "ENOTDIR") return null;
|
|
20949
|
-
const parent =
|
|
21202
|
+
const parent = dirname6(cursor);
|
|
20950
21203
|
if (parent === cursor) return null;
|
|
20951
21204
|
suffix.unshift(cursor.slice(parent.length + (parent.endsWith(sep) ? 0 : 1)));
|
|
20952
21205
|
cursor = parent;
|
|
20953
21206
|
}
|
|
20954
21207
|
}
|
|
20955
21208
|
try {
|
|
20956
|
-
return { real:
|
|
21209
|
+
return { real: realpathSync2.native(cursor), suffix };
|
|
20957
21210
|
} catch {
|
|
20958
21211
|
return null;
|
|
20959
21212
|
}
|
|
@@ -20962,13 +21215,13 @@ function canonicalRepositoryPathScoped(filePath, context, baseDir) {
|
|
|
20962
21215
|
if (!filePath || filePath !== filePath.trim() || filePath.includes("\0")) {
|
|
20963
21216
|
return { ok: false, reason: "invalid_path" };
|
|
20964
21217
|
}
|
|
20965
|
-
const absolute =
|
|
21218
|
+
const absolute = resolve4(baseDir, filePath);
|
|
20966
21219
|
const resolved = nearestExistingAncestor(absolute);
|
|
20967
21220
|
if (!resolved) return { ok: false, reason: "invalid_path" };
|
|
20968
|
-
const target =
|
|
21221
|
+
const target = resolve4(resolved.real, ...resolved.suffix);
|
|
20969
21222
|
const rel = relative(context.repoRoot, target);
|
|
20970
21223
|
if (!rel || rel === ".") return { ok: false, reason: "invalid_path" };
|
|
20971
|
-
if (
|
|
21224
|
+
if (isAbsolute4(rel) || rel === ".." || rel.startsWith(`..${sep}`)) {
|
|
20972
21225
|
return { ok: false, reason: "outside_repository" };
|
|
20973
21226
|
}
|
|
20974
21227
|
return { ok: true, file: sep === "/" ? rel : rel.split(sep).join("/") };
|
|
@@ -20976,26 +21229,26 @@ function canonicalRepositoryPathScoped(filePath, context, baseDir) {
|
|
|
20976
21229
|
function canonicalRepositoryPathLegacy(filePath, cwd, repositoryRoot = canonicalGitRoot(cwd)) {
|
|
20977
21230
|
if (!repositoryRoot || !filePath || [...filePath].some((char) => char < " " || char === "\x7F" || "~*?[]{}$`\\".includes(char)))
|
|
20978
21231
|
return null;
|
|
20979
|
-
const absolute =
|
|
21232
|
+
const absolute = resolve4(cwd, filePath);
|
|
20980
21233
|
let target;
|
|
20981
21234
|
try {
|
|
20982
|
-
const stat =
|
|
21235
|
+
const stat = lstatSync4(absolute);
|
|
20983
21236
|
if (!stat.isFile() || stat.isSymbolicLink()) return null;
|
|
20984
|
-
target =
|
|
21237
|
+
target = realpathSync2.native(absolute);
|
|
20985
21238
|
} catch (error) {
|
|
20986
21239
|
if (!(error instanceof Error) || error.code !== "ENOENT") {
|
|
20987
21240
|
return null;
|
|
20988
21241
|
}
|
|
20989
21242
|
try {
|
|
20990
|
-
const parent =
|
|
20991
|
-
if (!
|
|
20992
|
-
target =
|
|
21243
|
+
const parent = realpathSync2.native(dirname6(absolute));
|
|
21244
|
+
if (!lstatSync4(parent).isDirectory()) return null;
|
|
21245
|
+
target = resolve4(parent, basename(absolute));
|
|
20993
21246
|
} catch {
|
|
20994
21247
|
return null;
|
|
20995
21248
|
}
|
|
20996
21249
|
}
|
|
20997
21250
|
const rel = relative(repositoryRoot, target);
|
|
20998
|
-
if (!rel ||
|
|
21251
|
+
if (!rel || isAbsolute4(rel) || rel === ".." || rel.startsWith(`..${sep}`)) {
|
|
20999
21252
|
return null;
|
|
21000
21253
|
}
|
|
21001
21254
|
return sep === "/" ? rel : rel.split(sep).join("/");
|
|
@@ -21073,10 +21326,10 @@ function hasProjectPrimInstall(cwd) {
|
|
|
21073
21326
|
const root = gitToplevel(cwd);
|
|
21074
21327
|
if (root === null || root === homedir2()) return false;
|
|
21075
21328
|
for (const rel of PROJECT_INSTALL_FILES) {
|
|
21076
|
-
const path =
|
|
21077
|
-
if (
|
|
21329
|
+
const path = join10(root, rel);
|
|
21330
|
+
if (existsSync8(path)) {
|
|
21078
21331
|
try {
|
|
21079
|
-
const content =
|
|
21332
|
+
const content = readFileSync8(path, "utf-8");
|
|
21080
21333
|
if (PRIM_HOOK_BINS.some((bin) => content.includes(bin))) return true;
|
|
21081
21334
|
} catch {
|
|
21082
21335
|
}
|
|
@@ -21392,33 +21645,33 @@ function parseAgent(argv) {
|
|
|
21392
21645
|
}
|
|
21393
21646
|
|
|
21394
21647
|
// src/hooks/codex-context.ts
|
|
21395
|
-
import { createHash as
|
|
21648
|
+
import { createHash as createHash7, randomBytes as randomBytes5 } from "crypto";
|
|
21396
21649
|
import {
|
|
21397
|
-
chmodSync as
|
|
21398
|
-
existsSync as
|
|
21399
|
-
mkdirSync as
|
|
21400
|
-
readFileSync as
|
|
21401
|
-
readdirSync as
|
|
21402
|
-
renameSync as
|
|
21403
|
-
rmSync as
|
|
21404
|
-
statSync as
|
|
21650
|
+
chmodSync as chmodSync4,
|
|
21651
|
+
existsSync as existsSync9,
|
|
21652
|
+
mkdirSync as mkdirSync5,
|
|
21653
|
+
readFileSync as readFileSync9,
|
|
21654
|
+
readdirSync as readdirSync3,
|
|
21655
|
+
renameSync as renameSync3,
|
|
21656
|
+
rmSync as rmSync5,
|
|
21657
|
+
statSync as statSync3,
|
|
21405
21658
|
unlinkSync,
|
|
21406
|
-
writeFileSync as
|
|
21659
|
+
writeFileSync as writeFileSync4
|
|
21407
21660
|
} from "fs";
|
|
21408
|
-
import { join as
|
|
21661
|
+
import { join as join12 } from "path";
|
|
21409
21662
|
|
|
21410
21663
|
// src/daemon/client.ts
|
|
21411
21664
|
import { createConnection } from "net";
|
|
21412
|
-
import { join as
|
|
21665
|
+
import { join as join11 } from "path";
|
|
21413
21666
|
|
|
21414
21667
|
// src/daemon/principal.ts
|
|
21415
|
-
import { createHash as
|
|
21668
|
+
import { createHash as createHash6 } from "crypto";
|
|
21416
21669
|
var PRINCIPAL_COMPONENT_MAX_LENGTH = 512;
|
|
21417
21670
|
function boundedClaim(value) {
|
|
21418
21671
|
return typeof value === "string" && value.length > 0 && value.length <= PRINCIPAL_COMPONENT_MAX_LENGTH ? value : void 0;
|
|
21419
21672
|
}
|
|
21420
21673
|
function sha256(value) {
|
|
21421
|
-
return
|
|
21674
|
+
return createHash6("sha256").update(value).digest("hex");
|
|
21422
21675
|
}
|
|
21423
21676
|
function resolveDaemonPrincipal(token = resolveAuthCredential()?.token) {
|
|
21424
21677
|
if (!token) return void 0;
|
|
@@ -21459,7 +21712,7 @@ function parseDaemonResponseEnvelope(value) {
|
|
|
21459
21712
|
}
|
|
21460
21713
|
|
|
21461
21714
|
// src/daemon/client.ts
|
|
21462
|
-
var SOCK_PATH =
|
|
21715
|
+
var SOCK_PATH = join11(primConfigDirectory(), "sock");
|
|
21463
21716
|
var DEFAULT_TIMEOUT_MS2 = 250;
|
|
21464
21717
|
var nextRequestId = 1;
|
|
21465
21718
|
function daemonRequest(method, params = {}, opts = {}) {
|
|
@@ -21547,7 +21800,7 @@ function daemonRequest(method, params = {}, opts = {}) {
|
|
|
21547
21800
|
}
|
|
21548
21801
|
|
|
21549
21802
|
// src/daemon/decision-digest-cache.ts
|
|
21550
|
-
import { randomBytes as
|
|
21803
|
+
import { randomBytes as randomBytes4 } from "crypto";
|
|
21551
21804
|
var DECISION_DIGEST_CACHE_LIMIT = 100;
|
|
21552
21805
|
var DECISION_DIGEST_CACHE_WINDOW = "24h";
|
|
21553
21806
|
var DECISION_DIGEST_CACHE_PATH = `/api/cli/decisions/recent?limit=${String(DECISION_DIGEST_CACHE_LIMIT)}&since=${DECISION_DIGEST_CACHE_WINDOW}`;
|
|
@@ -21736,10 +21989,10 @@ function appendCodexContext(output, context) {
|
|
|
21736
21989
|
return next;
|
|
21737
21990
|
}
|
|
21738
21991
|
function stateRoot(namespace) {
|
|
21739
|
-
return
|
|
21992
|
+
return join12(primConfigDirectory(), namespace, "decision-digests");
|
|
21740
21993
|
}
|
|
21741
21994
|
function draftStateRoot(namespace) {
|
|
21742
|
-
return
|
|
21995
|
+
return join12(primConfigDirectory(), namespace, "decision-draft-deliveries");
|
|
21743
21996
|
}
|
|
21744
21997
|
function workspaceFor(cwd) {
|
|
21745
21998
|
try {
|
|
@@ -21750,13 +22003,13 @@ function workspaceFor(cwd) {
|
|
|
21750
22003
|
}
|
|
21751
22004
|
function statePath(args) {
|
|
21752
22005
|
const identity = `${args.siteUrl}\0${workspaceFor(args.cwd)}\0${args.sessionId}`;
|
|
21753
|
-
const key =
|
|
21754
|
-
return
|
|
22006
|
+
const key = createHash7("sha256").update(identity).digest("hex");
|
|
22007
|
+
return join12(stateRoot(args.namespace), `${key}.json`);
|
|
21755
22008
|
}
|
|
21756
22009
|
function draftStatePath(args) {
|
|
21757
22010
|
const identity = `${args.siteUrl}\0${workspaceFor(args.cwd)}\0${args.sessionId}\0${args.principalId}\0${args.organizationId}\0${args.credentialFingerprint}`;
|
|
21758
|
-
const key =
|
|
21759
|
-
return
|
|
22011
|
+
const key = createHash7("sha256").update(identity).digest("hex");
|
|
22012
|
+
return join12(draftStateRoot(args.namespace), `${key}.json`);
|
|
21760
22013
|
}
|
|
21761
22014
|
function parseState(value) {
|
|
21762
22015
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
@@ -21795,37 +22048,37 @@ function parseDraftState(value) {
|
|
|
21795
22048
|
};
|
|
21796
22049
|
}
|
|
21797
22050
|
function readState(path) {
|
|
21798
|
-
if (!
|
|
22051
|
+
if (!existsSync9(path)) return void 0;
|
|
21799
22052
|
try {
|
|
21800
|
-
return parseState(JSON.parse(
|
|
22053
|
+
return parseState(JSON.parse(readFileSync9(path, "utf8")));
|
|
21801
22054
|
} catch {
|
|
21802
22055
|
return void 0;
|
|
21803
22056
|
}
|
|
21804
22057
|
}
|
|
21805
22058
|
function readDraftState(path) {
|
|
21806
|
-
if (!
|
|
22059
|
+
if (!existsSync9(path)) return void 0;
|
|
21807
22060
|
try {
|
|
21808
|
-
return parseDraftState(JSON.parse(
|
|
22061
|
+
return parseDraftState(JSON.parse(readFileSync9(path, "utf8")));
|
|
21809
22062
|
} catch {
|
|
21810
22063
|
return void 0;
|
|
21811
22064
|
}
|
|
21812
22065
|
}
|
|
21813
22066
|
function writeStateFile(path, directory, state) {
|
|
21814
|
-
|
|
21815
|
-
|
|
21816
|
-
const temporary =
|
|
22067
|
+
mkdirSync5(directory, { recursive: true, mode: 448 });
|
|
22068
|
+
chmodSync4(directory, 448);
|
|
22069
|
+
const temporary = join12(
|
|
21817
22070
|
directory,
|
|
21818
|
-
`.${path.slice(directory.length + 1)}.tmp-${process.pid}-${
|
|
22071
|
+
`.${path.slice(directory.length + 1)}.tmp-${process.pid}-${randomBytes5(8).toString("hex")}`
|
|
21819
22072
|
);
|
|
21820
22073
|
try {
|
|
21821
|
-
|
|
22074
|
+
writeFileSync4(temporary, `${JSON.stringify(state)}
|
|
21822
22075
|
`, {
|
|
21823
22076
|
encoding: "utf8",
|
|
21824
22077
|
mode: 384,
|
|
21825
22078
|
flag: "wx"
|
|
21826
22079
|
});
|
|
21827
|
-
|
|
21828
|
-
|
|
22080
|
+
chmodSync4(temporary, 384);
|
|
22081
|
+
renameSync3(temporary, path);
|
|
21829
22082
|
} finally {
|
|
21830
22083
|
try {
|
|
21831
22084
|
unlinkSync(temporary);
|
|
@@ -21834,19 +22087,19 @@ function writeStateFile(path, directory, state) {
|
|
|
21834
22087
|
}
|
|
21835
22088
|
}
|
|
21836
22089
|
function cleanupStateFiles(directory, now) {
|
|
21837
|
-
if (!
|
|
22090
|
+
if (!existsSync9(directory)) return;
|
|
21838
22091
|
let names;
|
|
21839
22092
|
try {
|
|
21840
|
-
names =
|
|
22093
|
+
names = readdirSync3(directory);
|
|
21841
22094
|
} catch {
|
|
21842
22095
|
return;
|
|
21843
22096
|
}
|
|
21844
22097
|
const files = [];
|
|
21845
22098
|
const residue = [];
|
|
21846
22099
|
for (const name of names) {
|
|
21847
|
-
const path =
|
|
22100
|
+
const path = join12(directory, name);
|
|
21848
22101
|
try {
|
|
21849
|
-
const mtimeMs =
|
|
22102
|
+
const mtimeMs = statSync3(path).mtimeMs;
|
|
21850
22103
|
if (name.endsWith(".json")) {
|
|
21851
22104
|
files.push({ path, mtimeMs });
|
|
21852
22105
|
} else if ((name.includes(".json.tmp-") || name.endsWith(".json.lock")) && now - mtimeMs > CODEX_DIGEST_STATE_RETENTION_MS) {
|
|
@@ -21865,8 +22118,8 @@ function cleanupStateFiles(directory, now) {
|
|
|
21865
22118
|
}
|
|
21866
22119
|
for (const path of residue) {
|
|
21867
22120
|
try {
|
|
21868
|
-
if (now -
|
|
21869
|
-
|
|
22121
|
+
if (now - statSync3(path).mtimeMs > CODEX_DIGEST_STATE_RETENTION_MS) {
|
|
22122
|
+
rmSync5(path, { recursive: true, force: true });
|
|
21870
22123
|
}
|
|
21871
22124
|
} catch {
|
|
21872
22125
|
}
|
|
@@ -22149,126 +22402,14 @@ async function prepareCodexContext(options) {
|
|
|
22149
22402
|
}
|
|
22150
22403
|
|
|
22151
22404
|
// src/commands/cursor-install.ts
|
|
22152
|
-
import { existsSync as
|
|
22405
|
+
import { existsSync as existsSync11, readFileSync as readFileSync11 } from "fs";
|
|
22153
22406
|
import { homedir as homedir4 } from "os";
|
|
22154
|
-
import { isAbsolute as isAbsolute5, join as
|
|
22155
|
-
|
|
22156
|
-
// src/lib/hook-runtime.ts
|
|
22157
|
-
import { createHash as createHash7, randomBytes as randomBytes5 } from "crypto";
|
|
22158
|
-
import {
|
|
22159
|
-
constants as constants2,
|
|
22160
|
-
accessSync,
|
|
22161
|
-
chmodSync as chmodSync4,
|
|
22162
|
-
copyFileSync,
|
|
22163
|
-
existsSync as existsSync8,
|
|
22164
|
-
lstatSync as lstatSync4,
|
|
22165
|
-
mkdirSync as mkdirSync5,
|
|
22166
|
-
mkdtempSync,
|
|
22167
|
-
readFileSync as readFileSync9,
|
|
22168
|
-
readdirSync as readdirSync3,
|
|
22169
|
-
realpathSync as realpathSync2,
|
|
22170
|
-
renameSync as renameSync3,
|
|
22171
|
-
rmSync as rmSync5,
|
|
22172
|
-
statSync as statSync3,
|
|
22173
|
-
utimesSync,
|
|
22174
|
-
writeFileSync as writeFileSync4
|
|
22175
|
-
} from "fs";
|
|
22176
|
-
import { delimiter, dirname as dirname6, isAbsolute as isAbsolute4, join as join11, resolve as resolve4 } from "path";
|
|
22177
|
-
|
|
22178
|
-
// src/lib/git-hook-contract.ts
|
|
22179
|
-
var GIT_HOOK_ENTRYPOINT_CONTENT = `#!/bin/sh
|
|
22180
|
-
# prim git hook entrypoint v1 \u2014 managed by prim; do not edit.
|
|
22181
|
-
# Run by the "# >>> prim <hook> hook >>>" block in a Git hook file. Acts only
|
|
22182
|
-
# where prim is active (git config prim.active true) and never fails the hook.
|
|
22183
|
-
case "$0" in */*) prim_dir=\${0%/*} ;; *) exit 0 ;; esac
|
|
22184
|
-
prim_launcher="$prim_dir/${STABLE_HOOK_LAUNCHER_NAME}"
|
|
22185
|
-
[ -x "$prim_launcher" ] || exit 0
|
|
22186
|
-
[ "$(git config --get prim.active 2>/dev/null)" = "true" ] || exit 0
|
|
22187
|
-
prim_hook=\${1-}
|
|
22188
|
-
if [ "$#" -gt 0 ]; then shift; fi
|
|
22189
|
-
case "$prim_hook" in
|
|
22190
|
-
pre-commit)
|
|
22191
|
-
"$prim_launcher" prim-pre-commit "$@" || :
|
|
22192
|
-
;;
|
|
22193
|
-
post-commit)
|
|
22194
|
-
prim_sha=$(git rev-parse --verify HEAD 2>/dev/null) || exit 0
|
|
22195
|
-
case "$prim_sha" in *[!0-9a-f]* | "") exit 0 ;; esac
|
|
22196
|
-
case "\${#prim_sha}" in 40 | 64) ;; *) exit 0 ;; esac
|
|
22197
|
-
prim_branch=$(git symbolic-ref --quiet --short HEAD 2>/dev/null) || prim_branch=
|
|
22198
|
-
prim_observed=$(mktemp "\${TMPDIR:-/tmp}/prim-post-commit-observed.XXXXXXXX" 2>/dev/null) || prim_observed=
|
|
22199
|
-
(
|
|
22200
|
-
trap '' HUP
|
|
22201
|
-
trap 'if [ -n "$prim_observed" ]; then rm -f "$prim_observed"; fi' 0
|
|
22202
|
-
PRIM_COMMIT_SHA=$prim_sha PRIM_COMMIT_BRANCH=$prim_branch PRIM_COMMIT_OBSERVED_FILE=$prim_observed "$prim_launcher" prim-post-commit
|
|
22203
|
-
) </dev/null >/dev/null 2>&1 &
|
|
22204
|
-
;;
|
|
22205
|
-
post-rewrite)
|
|
22206
|
-
case "\${1-}" in amend | rebase) prim_source=$1 ;; *) exit 0 ;; esac
|
|
22207
|
-
prim_pairs=$(mktemp "\${TMPDIR:-/tmp}/prim-post-rewrite-pairs.XXXXXXXX" 2>/dev/null) || exit 0
|
|
22208
|
-
if ! chmod 600 "$prim_pairs" 2>/dev/null || ! cat >"$prim_pairs"; then
|
|
22209
|
-
rm -f "$prim_pairs"
|
|
22210
|
-
exit 0
|
|
22211
|
-
fi
|
|
22212
|
-
prim_branch=$(git symbolic-ref --quiet --short HEAD 2>/dev/null) || prim_branch=
|
|
22213
|
-
(
|
|
22214
|
-
trap '' HUP
|
|
22215
|
-
trap 'rm -f "$prim_pairs"' 0
|
|
22216
|
-
PRIM_REWRITE_SOURCE=$prim_source PRIM_REWRITE_BRANCH=$prim_branch PRIM_REWRITE_PAIRS_FILE=$prim_pairs "$prim_launcher" prim-post-rewrite
|
|
22217
|
-
) </dev/null >/dev/null 2>&1 &
|
|
22218
|
-
;;
|
|
22219
|
-
esac
|
|
22220
|
-
exit 0
|
|
22221
|
-
`;
|
|
22222
|
-
|
|
22223
|
-
// src/lib/hook-runtime.ts
|
|
22224
|
-
var RELEASE_PREFIX = "release-";
|
|
22225
|
-
var MAX_MANIFEST_BYTES = 64 * 1024;
|
|
22226
|
-
var RELEASE_GRACE_MS = 10 * 60 * 1e3;
|
|
22227
|
-
var HOOK_RUNTIME_ENTRIES = {
|
|
22228
|
-
// SessionStart self-healing resolves this exact CLI entry to run
|
|
22229
|
-
// `daemon ensure`; it must travel with the immutable hook release.
|
|
22230
|
-
prim: "dist/index.js",
|
|
22231
|
-
"prim-hook": "dist/hooks/prim-hook.js",
|
|
22232
|
-
"prim-pre-commit": "dist/hooks/pre-commit.js",
|
|
22233
|
-
"prim-post-commit": "dist/hooks/post-commit.js",
|
|
22234
|
-
"prim-post-rewrite": "dist/hooks/post-rewrite.js",
|
|
22235
|
-
"prim-pre-tool-use": "dist/hooks/pre-tool-use.js",
|
|
22236
|
-
"prim-post-tool-use": "dist/hooks/post-tool-use.js",
|
|
22237
|
-
"prim-session-start": "dist/hooks/session-start.js",
|
|
22238
|
-
"prim-session-end": "dist/hooks/session-end.js",
|
|
22239
|
-
"prim-daemon-server": "dist/daemon/server.js",
|
|
22240
|
-
"prim-statusline": "dist/statusline-main.js"
|
|
22241
|
-
};
|
|
22242
|
-
var SOURCE_ENTRIES = Object.fromEntries(
|
|
22243
|
-
Object.entries(HOOK_RUNTIME_ENTRIES).map(([bin, target]) => [
|
|
22244
|
-
bin,
|
|
22245
|
-
target.replace(/^dist\//u, "")
|
|
22246
|
-
])
|
|
22247
|
-
);
|
|
22248
|
-
var STABLE_HOOK_LAUNCHER_CONTENT = `#!/bin/sh
|
|
22249
|
-
set -eu
|
|
22250
|
-
case "$0" in */*) prim_launcher_dir=\${0%/*} ;; *) exit 78 ;; esac
|
|
22251
|
-
IFS= read -r prim_release_name < "$prim_launcher_dir/hook-runtime/current" || exit 69
|
|
22252
|
-
case "$prim_release_name" in ${RELEASE_PREFIX}*) ;; *) exit 69 ;; esac
|
|
22253
|
-
prim_release_id=\${prim_release_name#${RELEASE_PREFIX}}
|
|
22254
|
-
case "$prim_release_id" in *[!0-9a-f]*|"") exit 69 ;; esac
|
|
22255
|
-
[ "\${#prim_release_id}" -eq 64 ] || exit 69
|
|
22256
|
-
prim_release="$prim_launcher_dir/hook-runtime/releases/$prim_release_name"
|
|
22257
|
-
case "\${1-}" in
|
|
22258
|
-
${Object.entries(HOOK_RUNTIME_ENTRIES).map(([bin, entry]) => ` ${bin}) prim_entry="$prim_release/${entry}" ;;`).join("\n")}
|
|
22259
|
-
*) exit 64 ;;
|
|
22260
|
-
esac
|
|
22261
|
-
shift
|
|
22262
|
-
IFS= read -r prim_node < "$prim_release/node" || exit 69
|
|
22263
|
-
case "$prim_node" in /*) ;; *) exit 69 ;; esac
|
|
22264
|
-
[ -x "$prim_node" ] && [ -f "$prim_entry" ] || exit 69
|
|
22265
|
-
exec "$prim_node" "$prim_entry" "$@"
|
|
22266
|
-
`;
|
|
22407
|
+
import { isAbsolute as isAbsolute5, join as join14 } from "path";
|
|
22267
22408
|
|
|
22268
22409
|
// src/commands/claude-install.ts
|
|
22269
|
-
import { existsSync as
|
|
22410
|
+
import { existsSync as existsSync10, readFileSync as readFileSync10 } from "fs";
|
|
22270
22411
|
import { homedir as homedir3 } from "os";
|
|
22271
|
-
import { join as
|
|
22412
|
+
import { join as join13 } from "path";
|
|
22272
22413
|
var CAPTURE_BIN = "prim-hook";
|
|
22273
22414
|
var GATE_BIN = "prim-pre-tool-use";
|
|
22274
22415
|
var POST_TOOL_USE_BIN = "prim-post-tool-use";
|
|
@@ -22277,7 +22418,7 @@ var SESSION_END_BIN = "prim-session-end";
|
|
|
22277
22418
|
var STATUSLINE_BIN = "prim-statusline";
|
|
22278
22419
|
var STATUSLINE_ARGS = "";
|
|
22279
22420
|
var STATUSLINE_COMMAND = stableHookCommand(STATUSLINE_BIN, STATUSLINE_ARGS);
|
|
22280
|
-
var USER_SCOPE_PATH =
|
|
22421
|
+
var USER_SCOPE_PATH = join13(homedir3(), ".claude", "settings.json");
|
|
22281
22422
|
function projectRoot() {
|
|
22282
22423
|
return gitToplevel() ?? process.cwd();
|
|
22283
22424
|
}
|
|
@@ -22356,17 +22497,17 @@ function cursorConfigDirectory(env = process.env, home = homedir4(), platform =
|
|
|
22356
22497
|
const explicit = env.CURSOR_CONFIG_DIR?.trim();
|
|
22357
22498
|
if (explicit && isAbsolute5(explicit)) return explicit;
|
|
22358
22499
|
const xdg = env.XDG_CONFIG_HOME?.trim();
|
|
22359
|
-
if (platform !== "darwin" && xdg && isAbsolute5(xdg)) return
|
|
22360
|
-
return
|
|
22500
|
+
if (platform !== "darwin" && xdg && isAbsolute5(xdg)) return join14(xdg, "cursor");
|
|
22501
|
+
return join14(home, ".cursor");
|
|
22361
22502
|
}
|
|
22362
22503
|
function cursorHooksPath(scope, root = projectRoot()) {
|
|
22363
|
-
return scope === "user" ?
|
|
22504
|
+
return scope === "user" ? join14(cursorConfigDirectory(), "hooks.json") : join14(root, ".cursor", "hooks.json");
|
|
22364
22505
|
}
|
|
22365
22506
|
function plainObject(value) {
|
|
22366
22507
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22367
22508
|
}
|
|
22368
22509
|
function readCursorHooks(path) {
|
|
22369
|
-
if (!
|
|
22510
|
+
if (!existsSync11(path)) return {};
|
|
22370
22511
|
let parsed;
|
|
22371
22512
|
try {
|
|
22372
22513
|
parsed = JSON.parse(readFileSync11(path, "utf8"));
|
|
@@ -22906,8 +23047,8 @@ function demoteForMode(verdict, mode) {
|
|
|
22906
23047
|
import { Buffer as Buffer2 } from "buffer";
|
|
22907
23048
|
|
|
22908
23049
|
// src/hooks/redact.ts
|
|
22909
|
-
import { existsSync as
|
|
22910
|
-
import { join as
|
|
23050
|
+
import { existsSync as existsSync12, readFileSync as readFileSync12, statSync as statSync4 } from "fs";
|
|
23051
|
+
import { join as join15 } from "path";
|
|
22911
23052
|
import { Worker } from "worker_threads";
|
|
22912
23053
|
var USER_HOME_RULES = [
|
|
22913
23054
|
{
|