@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
|
@@ -54,7 +54,7 @@ var require_ucs2length = __commonJS({
|
|
|
54
54
|
// src/hooks/prim-hook.ts
|
|
55
55
|
import { spawn } from "child_process";
|
|
56
56
|
import { readFileSync as readFileSync18 } from "fs";
|
|
57
|
-
import { dirname as dirname13, join as
|
|
57
|
+
import { dirname as dirname13, join as join21 } from "path";
|
|
58
58
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
59
59
|
|
|
60
60
|
// src/binding.ts
|
|
@@ -1535,12 +1535,128 @@ async function acknowledgeDecisionFeedback(input, dependencies = {}) {
|
|
|
1535
1535
|
}
|
|
1536
1536
|
|
|
1537
1537
|
// src/demo/isolation.ts
|
|
1538
|
-
import { existsSync as
|
|
1538
|
+
import { existsSync as existsSync8 } from "fs";
|
|
1539
|
+
|
|
1540
|
+
// src/demo/diagnostics.ts
|
|
1541
|
+
import { existsSync as existsSync7 } from "fs";
|
|
1542
|
+
import { join as join10 } from "path";
|
|
1543
|
+
|
|
1544
|
+
// src/lib/hook-runtime.ts
|
|
1545
|
+
import { createHash as createHash3, randomBytes as randomBytes3 } from "crypto";
|
|
1546
|
+
import {
|
|
1547
|
+
constants as constants2,
|
|
1548
|
+
accessSync,
|
|
1549
|
+
chmodSync as chmodSync3,
|
|
1550
|
+
copyFileSync,
|
|
1551
|
+
existsSync as existsSync5,
|
|
1552
|
+
lstatSync as lstatSync2,
|
|
1553
|
+
mkdirSync as mkdirSync4,
|
|
1554
|
+
mkdtempSync,
|
|
1555
|
+
readFileSync as readFileSync7,
|
|
1556
|
+
readdirSync,
|
|
1557
|
+
realpathSync,
|
|
1558
|
+
renameSync as renameSync2,
|
|
1559
|
+
rmSync as rmSync4,
|
|
1560
|
+
statSync as statSync2,
|
|
1561
|
+
utimesSync,
|
|
1562
|
+
writeFileSync as writeFileSync3
|
|
1563
|
+
} from "fs";
|
|
1564
|
+
import { delimiter, dirname as dirname6, isAbsolute as isAbsolute3, join as join8, resolve as resolve2 } from "path";
|
|
1565
|
+
|
|
1566
|
+
// src/lib/git-hook-contract.ts
|
|
1567
|
+
var GIT_HOOK_ENTRYPOINT_CONTENT = `#!/bin/sh
|
|
1568
|
+
# prim git hook entrypoint v1 \u2014 managed by prim; do not edit.
|
|
1569
|
+
# Run by the "# >>> prim <hook> hook >>>" block in a Git hook file. Acts only
|
|
1570
|
+
# where prim is active (git config prim.active true) and never fails the hook.
|
|
1571
|
+
case "$0" in */*) prim_dir=\${0%/*} ;; *) exit 0 ;; esac
|
|
1572
|
+
prim_launcher="$prim_dir/${STABLE_HOOK_LAUNCHER_NAME}"
|
|
1573
|
+
[ -x "$prim_launcher" ] || exit 0
|
|
1574
|
+
[ "$(git config --get prim.active 2>/dev/null)" = "true" ] || exit 0
|
|
1575
|
+
prim_hook=\${1-}
|
|
1576
|
+
if [ "$#" -gt 0 ]; then shift; fi
|
|
1577
|
+
case "$prim_hook" in
|
|
1578
|
+
pre-commit)
|
|
1579
|
+
"$prim_launcher" prim-pre-commit "$@" || :
|
|
1580
|
+
;;
|
|
1581
|
+
post-commit)
|
|
1582
|
+
prim_sha=$(git rev-parse --verify HEAD 2>/dev/null) || exit 0
|
|
1583
|
+
case "$prim_sha" in *[!0-9a-f]* | "") exit 0 ;; esac
|
|
1584
|
+
case "\${#prim_sha}" in 40 | 64) ;; *) exit 0 ;; esac
|
|
1585
|
+
prim_branch=$(git symbolic-ref --quiet --short HEAD 2>/dev/null) || prim_branch=
|
|
1586
|
+
prim_observed=$(mktemp "\${TMPDIR:-/tmp}/prim-post-commit-observed.XXXXXXXX" 2>/dev/null) || prim_observed=
|
|
1587
|
+
(
|
|
1588
|
+
trap '' HUP
|
|
1589
|
+
trap 'if [ -n "$prim_observed" ]; then rm -f "$prim_observed"; fi' 0
|
|
1590
|
+
PRIM_COMMIT_SHA=$prim_sha PRIM_COMMIT_BRANCH=$prim_branch PRIM_COMMIT_OBSERVED_FILE=$prim_observed "$prim_launcher" prim-post-commit
|
|
1591
|
+
) </dev/null >/dev/null 2>&1 &
|
|
1592
|
+
;;
|
|
1593
|
+
post-rewrite)
|
|
1594
|
+
case "\${1-}" in amend | rebase) prim_source=$1 ;; *) exit 0 ;; esac
|
|
1595
|
+
prim_pairs=$(mktemp "\${TMPDIR:-/tmp}/prim-post-rewrite-pairs.XXXXXXXX" 2>/dev/null) || exit 0
|
|
1596
|
+
if ! chmod 600 "$prim_pairs" 2>/dev/null || ! cat >"$prim_pairs"; then
|
|
1597
|
+
rm -f "$prim_pairs"
|
|
1598
|
+
exit 0
|
|
1599
|
+
fi
|
|
1600
|
+
prim_branch=$(git symbolic-ref --quiet --short HEAD 2>/dev/null) || prim_branch=
|
|
1601
|
+
(
|
|
1602
|
+
trap '' HUP
|
|
1603
|
+
trap 'rm -f "$prim_pairs"' 0
|
|
1604
|
+
PRIM_REWRITE_SOURCE=$prim_source PRIM_REWRITE_BRANCH=$prim_branch PRIM_REWRITE_PAIRS_FILE=$prim_pairs "$prim_launcher" prim-post-rewrite
|
|
1605
|
+
) </dev/null >/dev/null 2>&1 &
|
|
1606
|
+
;;
|
|
1607
|
+
esac
|
|
1608
|
+
exit 0
|
|
1609
|
+
`;
|
|
1610
|
+
|
|
1611
|
+
// src/lib/hook-runtime.ts
|
|
1612
|
+
var RELEASE_PREFIX = "release-";
|
|
1613
|
+
var MAX_MANIFEST_BYTES = 64 * 1024;
|
|
1614
|
+
var RELEASE_GRACE_MS = 10 * 60 * 1e3;
|
|
1615
|
+
var HOOK_RUNTIME_ENTRIES = {
|
|
1616
|
+
// SessionStart self-healing resolves this exact CLI entry to run
|
|
1617
|
+
// `daemon ensure`; it must travel with the immutable hook release.
|
|
1618
|
+
prim: "dist/index.js",
|
|
1619
|
+
"prim-hook": "dist/hooks/prim-hook.js",
|
|
1620
|
+
"prim-pre-commit": "dist/hooks/pre-commit.js",
|
|
1621
|
+
"prim-post-commit": "dist/hooks/post-commit.js",
|
|
1622
|
+
"prim-post-rewrite": "dist/hooks/post-rewrite.js",
|
|
1623
|
+
"prim-pre-tool-use": "dist/hooks/pre-tool-use.js",
|
|
1624
|
+
"prim-post-tool-use": "dist/hooks/post-tool-use.js",
|
|
1625
|
+
"prim-session-start": "dist/hooks/session-start.js",
|
|
1626
|
+
"prim-session-end": "dist/hooks/session-end.js",
|
|
1627
|
+
"prim-daemon-server": "dist/daemon/server.js",
|
|
1628
|
+
"prim-statusline": "dist/statusline-main.js"
|
|
1629
|
+
};
|
|
1630
|
+
var SOURCE_ENTRIES = Object.fromEntries(
|
|
1631
|
+
Object.entries(HOOK_RUNTIME_ENTRIES).map(([bin, target]) => [
|
|
1632
|
+
bin,
|
|
1633
|
+
target.replace(/^dist\//u, "")
|
|
1634
|
+
])
|
|
1635
|
+
);
|
|
1636
|
+
var STABLE_HOOK_LAUNCHER_CONTENT = `#!/bin/sh
|
|
1637
|
+
set -eu
|
|
1638
|
+
case "$0" in */*) prim_launcher_dir=\${0%/*} ;; *) exit 78 ;; esac
|
|
1639
|
+
IFS= read -r prim_release_name < "$prim_launcher_dir/hook-runtime/current" || exit 69
|
|
1640
|
+
case "$prim_release_name" in ${RELEASE_PREFIX}*) ;; *) exit 69 ;; esac
|
|
1641
|
+
prim_release_id=\${prim_release_name#${RELEASE_PREFIX}}
|
|
1642
|
+
case "$prim_release_id" in *[!0-9a-f]*|"") exit 69 ;; esac
|
|
1643
|
+
[ "\${#prim_release_id}" -eq 64 ] || exit 69
|
|
1644
|
+
prim_release="$prim_launcher_dir/hook-runtime/releases/$prim_release_name"
|
|
1645
|
+
case "\${1-}" in
|
|
1646
|
+
${Object.entries(HOOK_RUNTIME_ENTRIES).map(([bin, entry]) => ` ${bin}) prim_entry="$prim_release/${entry}" ;;`).join("\n")}
|
|
1647
|
+
*) exit 64 ;;
|
|
1648
|
+
esac
|
|
1649
|
+
shift
|
|
1650
|
+
IFS= read -r prim_node < "$prim_release/node" || exit 69
|
|
1651
|
+
case "$prim_node" in /*) ;; *) exit 69 ;; esac
|
|
1652
|
+
[ -x "$prim_node" ] && [ -f "$prim_entry" ] || exit 69
|
|
1653
|
+
exec "$prim_node" "$prim_entry" "$@"
|
|
1654
|
+
`;
|
|
1539
1655
|
|
|
1540
1656
|
// src/demo/state.ts
|
|
1541
|
-
import { createHash as
|
|
1542
|
-
import { existsSync as
|
|
1543
|
-
import { join as
|
|
1657
|
+
import { createHash as createHash4, randomUUID as randomUUID2 } from "crypto";
|
|
1658
|
+
import { existsSync as existsSync6, lstatSync as lstatSync3, readFileSync as readFileSync8, readdirSync as readdirSync2 } from "fs";
|
|
1659
|
+
import { join as join9, resolve as resolve3 } from "path";
|
|
1544
1660
|
|
|
1545
1661
|
// src/generated/cli-http-v1.validators.js
|
|
1546
1662
|
var import_ucs2length = __toESM(require_ucs2length(), 1);
|
|
@@ -11631,8 +11747,9 @@ function validate43(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
11631
11747
|
}
|
|
11632
11748
|
validate43.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
11633
11749
|
var isDemoStatusResponse = validate44;
|
|
11634
|
-
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 };
|
|
11750
|
+
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 };
|
|
11635
11751
|
var func34 = Object.prototype.hasOwnProperty;
|
|
11752
|
+
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");
|
|
11636
11753
|
function validate44(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
11637
11754
|
;
|
|
11638
11755
|
let vErrors = null;
|
|
@@ -11648,7 +11765,7 @@ function validate44(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
11648
11765
|
if (errors === _errs0) {
|
|
11649
11766
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
11650
11767
|
let missing0;
|
|
11651
|
-
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")) {
|
|
11768
|
+
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")) {
|
|
11652
11769
|
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 + "'" }];
|
|
11653
11770
|
return false;
|
|
11654
11771
|
} else {
|
|
@@ -11788,110 +11905,202 @@ function validate44(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
11788
11905
|
var valid1 = true;
|
|
11789
11906
|
}
|
|
11790
11907
|
if (valid1) {
|
|
11791
|
-
if (data.
|
|
11792
|
-
let data7 = data.
|
|
11908
|
+
if (data.story !== void 0) {
|
|
11909
|
+
let data7 = data.story;
|
|
11793
11910
|
const _errs17 = errors;
|
|
11794
|
-
if (
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11911
|
+
if (errors === _errs17) {
|
|
11912
|
+
if (data7 && typeof data7 == "object" && !Array.isArray(data7)) {
|
|
11913
|
+
let missing1;
|
|
11914
|
+
if (data7.orgName === void 0 && (missing1 = "orgName") || data7.recipient === void 0 && (missing1 = "recipient") || data7.decisionDate === void 0 && (missing1 = "decisionDate")) {
|
|
11915
|
+
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 + "'" }];
|
|
11916
|
+
return false;
|
|
11917
|
+
} else {
|
|
11918
|
+
const _errs19 = errors;
|
|
11919
|
+
for (const key1 in data7) {
|
|
11920
|
+
if (!(key1 === "orgName" || key1 === "recipient" || key1 === "decisionDate")) {
|
|
11921
|
+
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" }];
|
|
11922
|
+
return false;
|
|
11923
|
+
break;
|
|
11924
|
+
}
|
|
11925
|
+
}
|
|
11926
|
+
if (_errs19 === errors) {
|
|
11927
|
+
if (data7.orgName !== void 0) {
|
|
11928
|
+
let data8 = data7.orgName;
|
|
11929
|
+
const _errs20 = errors;
|
|
11930
|
+
if (errors === _errs20) {
|
|
11931
|
+
if (typeof data8 === "string") {
|
|
11932
|
+
if (func1(data8) > 200) {
|
|
11933
|
+
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" }];
|
|
11934
|
+
return false;
|
|
11935
|
+
}
|
|
11936
|
+
} else {
|
|
11937
|
+
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" }];
|
|
11938
|
+
return false;
|
|
11939
|
+
}
|
|
11940
|
+
}
|
|
11941
|
+
var valid2 = _errs20 === errors;
|
|
11942
|
+
} else {
|
|
11943
|
+
var valid2 = true;
|
|
11944
|
+
}
|
|
11945
|
+
if (valid2) {
|
|
11946
|
+
if (data7.recipient !== void 0) {
|
|
11947
|
+
let data9 = data7.recipient;
|
|
11948
|
+
const _errs22 = errors;
|
|
11949
|
+
if (errors === _errs22) {
|
|
11950
|
+
if (errors === _errs22) {
|
|
11951
|
+
if (typeof data9 === "string") {
|
|
11952
|
+
if (!pattern12.test(data9)) {
|
|
11953
|
+
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,}$"` }];
|
|
11954
|
+
return false;
|
|
11955
|
+
}
|
|
11956
|
+
} else {
|
|
11957
|
+
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" }];
|
|
11958
|
+
return false;
|
|
11959
|
+
}
|
|
11960
|
+
}
|
|
11961
|
+
}
|
|
11962
|
+
var valid2 = _errs22 === errors;
|
|
11963
|
+
} else {
|
|
11964
|
+
var valid2 = true;
|
|
11965
|
+
}
|
|
11966
|
+
if (valid2) {
|
|
11967
|
+
if (data7.decisionDate !== void 0) {
|
|
11968
|
+
let data10 = data7.decisionDate;
|
|
11969
|
+
const _errs24 = errors;
|
|
11970
|
+
if (errors === _errs24) {
|
|
11971
|
+
if (typeof data10 === "string") {
|
|
11972
|
+
if (func1(data10) > 100) {
|
|
11973
|
+
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" }];
|
|
11974
|
+
return false;
|
|
11975
|
+
}
|
|
11976
|
+
} else {
|
|
11977
|
+
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" }];
|
|
11978
|
+
return false;
|
|
11979
|
+
}
|
|
11980
|
+
}
|
|
11981
|
+
var valid2 = _errs24 === errors;
|
|
11982
|
+
} else {
|
|
11983
|
+
var valid2 = true;
|
|
11984
|
+
}
|
|
11985
|
+
}
|
|
11986
|
+
}
|
|
11987
|
+
}
|
|
11988
|
+
}
|
|
11989
|
+
} else {
|
|
11990
|
+
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" }];
|
|
11991
|
+
return false;
|
|
11992
|
+
}
|
|
11801
11993
|
}
|
|
11802
11994
|
var valid1 = _errs17 === errors;
|
|
11803
11995
|
} else {
|
|
11804
11996
|
var valid1 = true;
|
|
11805
11997
|
}
|
|
11806
11998
|
if (valid1) {
|
|
11807
|
-
if (data.
|
|
11808
|
-
let
|
|
11809
|
-
const
|
|
11810
|
-
if (typeof
|
|
11811
|
-
validate44.errors = [{ instancePath: instancePath + "/
|
|
11999
|
+
if (data.email !== void 0) {
|
|
12000
|
+
let data11 = data.email;
|
|
12001
|
+
const _errs26 = errors;
|
|
12002
|
+
if (typeof data11 !== "string") {
|
|
12003
|
+
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" }];
|
|
11812
12004
|
return false;
|
|
11813
12005
|
}
|
|
11814
|
-
if (!(
|
|
11815
|
-
validate44.errors = [{ instancePath: instancePath + "/
|
|
12006
|
+
if (!(data11 === "not_queued" || data11 === "queued" || data11 === "accepted" || data11 === "failed" || data11 === "suppressed")) {
|
|
12007
|
+
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" }];
|
|
11816
12008
|
return false;
|
|
11817
12009
|
}
|
|
11818
|
-
var valid1 =
|
|
12010
|
+
var valid1 = _errs26 === errors;
|
|
11819
12011
|
} else {
|
|
11820
12012
|
var valid1 = true;
|
|
11821
12013
|
}
|
|
11822
12014
|
if (valid1) {
|
|
11823
|
-
if (data.
|
|
11824
|
-
let
|
|
11825
|
-
const
|
|
11826
|
-
if (
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
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" }];
|
|
11830
|
-
return false;
|
|
11831
|
-
}
|
|
11832
|
-
} else {
|
|
11833
|
-
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" }];
|
|
11834
|
-
return false;
|
|
11835
|
-
}
|
|
12015
|
+
if (data.verdict !== void 0) {
|
|
12016
|
+
let data12 = data.verdict;
|
|
12017
|
+
const _errs28 = errors;
|
|
12018
|
+
if (typeof data12 !== "string") {
|
|
12019
|
+
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" }];
|
|
12020
|
+
return false;
|
|
11836
12021
|
}
|
|
11837
|
-
|
|
12022
|
+
if (!(data12 === "block" || data12 === "pass" || data12 === "pending")) {
|
|
12023
|
+
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" }];
|
|
12024
|
+
return false;
|
|
12025
|
+
}
|
|
12026
|
+
var valid1 = _errs28 === errors;
|
|
11838
12027
|
} else {
|
|
11839
12028
|
var valid1 = true;
|
|
11840
12029
|
}
|
|
11841
12030
|
if (valid1) {
|
|
11842
|
-
if (data.
|
|
11843
|
-
let
|
|
11844
|
-
const
|
|
11845
|
-
if (
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
12031
|
+
if (data.reasonCode !== void 0) {
|
|
12032
|
+
let data13 = data.reasonCode;
|
|
12033
|
+
const _errs30 = errors;
|
|
12034
|
+
if (errors === _errs30) {
|
|
12035
|
+
if (typeof data13 === "string") {
|
|
12036
|
+
if (func1(data13) > 100) {
|
|
12037
|
+
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" }];
|
|
12038
|
+
return false;
|
|
12039
|
+
}
|
|
12040
|
+
} else {
|
|
12041
|
+
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" }];
|
|
12042
|
+
return false;
|
|
12043
|
+
}
|
|
11852
12044
|
}
|
|
11853
|
-
var valid1 =
|
|
12045
|
+
var valid1 = _errs30 === errors;
|
|
11854
12046
|
} else {
|
|
11855
12047
|
var valid1 = true;
|
|
11856
12048
|
}
|
|
11857
12049
|
if (valid1) {
|
|
11858
|
-
if (data.
|
|
11859
|
-
let
|
|
11860
|
-
const
|
|
11861
|
-
if (
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
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" }];
|
|
11865
|
-
return false;
|
|
11866
|
-
}
|
|
11867
|
-
} else {
|
|
11868
|
-
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" }];
|
|
11869
|
-
return false;
|
|
11870
|
-
}
|
|
12050
|
+
if (data.choice !== void 0) {
|
|
12051
|
+
let data14 = data.choice;
|
|
12052
|
+
const _errs32 = errors;
|
|
12053
|
+
if (typeof data14 !== "string") {
|
|
12054
|
+
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" }];
|
|
12055
|
+
return false;
|
|
11871
12056
|
}
|
|
11872
|
-
|
|
12057
|
+
if (!(data14 === "adhere" || data14 === "supersede")) {
|
|
12058
|
+
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" }];
|
|
12059
|
+
return false;
|
|
12060
|
+
}
|
|
12061
|
+
var valid1 = _errs32 === errors;
|
|
11873
12062
|
} else {
|
|
11874
12063
|
var valid1 = true;
|
|
11875
12064
|
}
|
|
11876
12065
|
if (valid1) {
|
|
11877
|
-
if (data.
|
|
11878
|
-
let
|
|
11879
|
-
const
|
|
11880
|
-
if (errors ===
|
|
11881
|
-
if (typeof
|
|
11882
|
-
if (
|
|
11883
|
-
validate44.errors = [{ instancePath: instancePath + "/
|
|
12066
|
+
if (data.reason !== void 0) {
|
|
12067
|
+
let data15 = data.reason;
|
|
12068
|
+
const _errs34 = errors;
|
|
12069
|
+
if (errors === _errs34) {
|
|
12070
|
+
if (typeof data15 === "string") {
|
|
12071
|
+
if (func1(data15) > 500) {
|
|
12072
|
+
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" }];
|
|
11884
12073
|
return false;
|
|
11885
12074
|
}
|
|
11886
12075
|
} else {
|
|
11887
|
-
validate44.errors = [{ instancePath: instancePath + "/
|
|
12076
|
+
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" }];
|
|
11888
12077
|
return false;
|
|
11889
12078
|
}
|
|
11890
12079
|
}
|
|
11891
|
-
var valid1 =
|
|
12080
|
+
var valid1 = _errs34 === errors;
|
|
11892
12081
|
} else {
|
|
11893
12082
|
var valid1 = true;
|
|
11894
12083
|
}
|
|
12084
|
+
if (valid1) {
|
|
12085
|
+
if (data.approvedDigest !== void 0) {
|
|
12086
|
+
let data16 = data.approvedDigest;
|
|
12087
|
+
const _errs36 = errors;
|
|
12088
|
+
if (errors === _errs36) {
|
|
12089
|
+
if (typeof data16 === "string") {
|
|
12090
|
+
if (!pattern5.test(data16)) {
|
|
12091
|
+
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}$"' }];
|
|
12092
|
+
return false;
|
|
12093
|
+
}
|
|
12094
|
+
} else {
|
|
12095
|
+
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" }];
|
|
12096
|
+
return false;
|
|
12097
|
+
}
|
|
12098
|
+
}
|
|
12099
|
+
var valid1 = _errs36 === errors;
|
|
12100
|
+
} else {
|
|
12101
|
+
var valid1 = true;
|
|
12102
|
+
}
|
|
12103
|
+
}
|
|
11895
12104
|
}
|
|
11896
12105
|
}
|
|
11897
12106
|
}
|
|
@@ -12782,7 +12991,7 @@ function validate48(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
12782
12991
|
}
|
|
12783
12992
|
validate48.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
12784
12993
|
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"] };
|
|
12785
|
-
var
|
|
12994
|
+
var pattern14 = new RegExp("^[0-9a-f]{8}$", "u");
|
|
12786
12995
|
function validate49(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
12787
12996
|
;
|
|
12788
12997
|
let vErrors = null;
|
|
@@ -13121,7 +13330,7 @@ function validate49(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
13121
13330
|
const _errs27 = errors;
|
|
13122
13331
|
if (errors === _errs27) {
|
|
13123
13332
|
if (typeof data9 === "string") {
|
|
13124
|
-
if (!
|
|
13333
|
+
if (!pattern14.test(data9)) {
|
|
13125
13334
|
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}$"' };
|
|
13126
13335
|
if (vErrors === null) {
|
|
13127
13336
|
vErrors = [err24];
|
|
@@ -14177,8 +14386,8 @@ function validate51(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
14177
14386
|
return errors === 0;
|
|
14178
14387
|
}
|
|
14179
14388
|
validate51.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
14180
|
-
var
|
|
14181
|
-
var
|
|
14389
|
+
var pattern15 = new RegExp("^[A-Za-z0-9]{1,128}$", "u");
|
|
14390
|
+
var pattern16 = new RegExp("^https:\\/\\/github\\.com\\/apps\\/primitive(?:-staging)?\\/installations\\/new\\?state=[0-9a-f]{64}$", "u");
|
|
14182
14391
|
function validate52(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
14183
14392
|
;
|
|
14184
14393
|
let vErrors = null;
|
|
@@ -14260,7 +14469,7 @@ function validate52(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
14260
14469
|
const _errs9 = errors;
|
|
14261
14470
|
if (errors === _errs9) {
|
|
14262
14471
|
if (typeof data3 === "string") {
|
|
14263
|
-
if (!
|
|
14472
|
+
if (!pattern15.test(data3)) {
|
|
14264
14473
|
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}$"' }];
|
|
14265
14474
|
return false;
|
|
14266
14475
|
}
|
|
@@ -14279,7 +14488,7 @@ function validate52(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
14279
14488
|
const _errs11 = errors;
|
|
14280
14489
|
if (errors === _errs11) {
|
|
14281
14490
|
if (typeof data4 === "string") {
|
|
14282
|
-
if (!
|
|
14491
|
+
if (!pattern16.test(data4)) {
|
|
14283
14492
|
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}$"' }];
|
|
14284
14493
|
return false;
|
|
14285
14494
|
}
|
|
@@ -14687,7 +14896,7 @@ function validate54(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
14687
14896
|
const _errs3 = errors;
|
|
14688
14897
|
if (errors === _errs3) {
|
|
14689
14898
|
if (typeof data0 === "string") {
|
|
14690
|
-
if (!
|
|
14899
|
+
if (!pattern15.test(data0)) {
|
|
14691
14900
|
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}$"' }];
|
|
14692
14901
|
return false;
|
|
14693
14902
|
}
|
|
@@ -16259,7 +16468,7 @@ function validate55(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
16259
16468
|
}
|
|
16260
16469
|
validate55.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
16261
16470
|
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": {} };
|
|
16262
|
-
var
|
|
16471
|
+
var pattern18 = new RegExp("^[A-Za-z0-9_-]+$", "u");
|
|
16263
16472
|
function validate56(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
16264
16473
|
;
|
|
16265
16474
|
let vErrors = null;
|
|
@@ -16620,7 +16829,7 @@ function validate56(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
16620
16829
|
}
|
|
16621
16830
|
errors++;
|
|
16622
16831
|
} else {
|
|
16623
|
-
if (!
|
|
16832
|
+
if (!pattern18.test(data11)) {
|
|
16624
16833
|
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_-]+$"' };
|
|
16625
16834
|
if (vErrors === null) {
|
|
16626
16835
|
vErrors = [err22];
|
|
@@ -17145,7 +17354,7 @@ function validate56(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17145
17354
|
}
|
|
17146
17355
|
errors++;
|
|
17147
17356
|
} else {
|
|
17148
|
-
if (!
|
|
17357
|
+
if (!pattern18.test(data26)) {
|
|
17149
17358
|
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_-]+$"' };
|
|
17150
17359
|
if (vErrors === null) {
|
|
17151
17360
|
vErrors = [err58];
|
|
@@ -17388,10 +17597,10 @@ function validate56(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17388
17597
|
}
|
|
17389
17598
|
validate56.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
17390
17599
|
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"] };
|
|
17391
|
-
var
|
|
17392
|
-
var
|
|
17393
|
-
var
|
|
17394
|
-
var
|
|
17600
|
+
var pattern20 = new RegExp("^[A-Za-z0-9._:-]{1,128}$", "u");
|
|
17601
|
+
var pattern22 = new RegExp("^[A-Za-z0-9]{1,64}$", "u");
|
|
17602
|
+
var pattern23 = new RegExp("^(?!@?$)(?!\\/)(?!.*\\/$)(?!.*\\/\\/)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)[^/]*\\.lock(?:\\/|$))(?!.*\\.\\.)(?!.*@\\{)(?!.*[~^:?*\\\\]).+$", "u");
|
|
17603
|
+
var pattern24 = new RegExp("^[A-Za-z0-9][A-Za-z0-9._+-]*$", "u");
|
|
17395
17604
|
function validate57(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
17396
17605
|
;
|
|
17397
17606
|
let vErrors = null;
|
|
@@ -17457,7 +17666,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17457
17666
|
const _errs8 = errors;
|
|
17458
17667
|
if (errors === _errs8) {
|
|
17459
17668
|
if (typeof data2 === "string") {
|
|
17460
|
-
if (!
|
|
17669
|
+
if (!pattern20.test(data2)) {
|
|
17461
17670
|
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}$"' }];
|
|
17462
17671
|
return false;
|
|
17463
17672
|
}
|
|
@@ -17476,7 +17685,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17476
17685
|
const _errs10 = errors;
|
|
17477
17686
|
if (errors === _errs10) {
|
|
17478
17687
|
if (typeof data3 === "string") {
|
|
17479
|
-
if (!
|
|
17688
|
+
if (!pattern20.test(data3)) {
|
|
17480
17689
|
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}$"' }];
|
|
17481
17690
|
return false;
|
|
17482
17691
|
}
|
|
@@ -17495,7 +17704,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17495
17704
|
const _errs12 = errors;
|
|
17496
17705
|
if (errors === _errs12) {
|
|
17497
17706
|
if (typeof data4 === "string") {
|
|
17498
|
-
if (!
|
|
17707
|
+
if (!pattern22.test(data4)) {
|
|
17499
17708
|
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}$"' }];
|
|
17500
17709
|
return false;
|
|
17501
17710
|
}
|
|
@@ -17567,7 +17776,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17567
17776
|
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" }];
|
|
17568
17777
|
return false;
|
|
17569
17778
|
} else {
|
|
17570
|
-
if (!
|
|
17779
|
+
if (!pattern23.test(data8)) {
|
|
17571
17780
|
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(?:\\/|$))(?!.*\\.\\.)(?!.*@\\{)(?!.*[~^:?*\\\\]).+$"' }];
|
|
17572
17781
|
return false;
|
|
17573
17782
|
}
|
|
@@ -17607,7 +17816,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17607
17816
|
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" }];
|
|
17608
17817
|
return false;
|
|
17609
17818
|
} else {
|
|
17610
|
-
if (!
|
|
17819
|
+
if (!pattern24.test(data10)) {
|
|
17611
17820
|
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._+-]*$"' }];
|
|
17612
17821
|
return false;
|
|
17613
17822
|
}
|
|
@@ -17694,7 +17903,7 @@ function validate58(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17694
17903
|
const _errs5 = errors;
|
|
17695
17904
|
if (errors === _errs5) {
|
|
17696
17905
|
if (typeof data1 === "string") {
|
|
17697
|
-
if (!
|
|
17906
|
+
if (!pattern20.test(data1)) {
|
|
17698
17907
|
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}$"' }];
|
|
17699
17908
|
return false;
|
|
17700
17909
|
}
|
|
@@ -17991,8 +18200,8 @@ function validate58(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
17991
18200
|
return errors === 0;
|
|
17992
18201
|
}
|
|
17993
18202
|
validate58.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
17994
|
-
var
|
|
17995
|
-
var
|
|
18203
|
+
var pattern26 = new RegExp("^[A-Za-z0-9._-]{1,128}$", "u");
|
|
18204
|
+
var pattern27 = new RegExp("^pci_[A-Za-z0-9_-]{43}$", "u");
|
|
17996
18205
|
function validate59(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
17997
18206
|
;
|
|
17998
18207
|
let vErrors = null;
|
|
@@ -18017,7 +18226,7 @@ function validate59(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18017
18226
|
const _errs3 = errors;
|
|
18018
18227
|
if (errors === _errs3) {
|
|
18019
18228
|
if (typeof data0 === "string") {
|
|
18020
|
-
if (!
|
|
18229
|
+
if (!pattern26.test(data0)) {
|
|
18021
18230
|
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}$"' }];
|
|
18022
18231
|
return false;
|
|
18023
18232
|
}
|
|
@@ -18036,7 +18245,7 @@ function validate59(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18036
18245
|
const _errs5 = errors;
|
|
18037
18246
|
if (errors === _errs5) {
|
|
18038
18247
|
if (typeof data1 === "string") {
|
|
18039
|
-
if (!
|
|
18248
|
+
if (!pattern27.test(data1)) {
|
|
18040
18249
|
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}$"' }];
|
|
18041
18250
|
return false;
|
|
18042
18251
|
}
|
|
@@ -18699,7 +18908,7 @@ function validate62(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18699
18908
|
return errors === 0;
|
|
18700
18909
|
}
|
|
18701
18910
|
validate62.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
18702
|
-
var
|
|
18911
|
+
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");
|
|
18703
18912
|
function validate63(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
18704
18913
|
;
|
|
18705
18914
|
let vErrors = null;
|
|
@@ -18733,7 +18942,7 @@ function validate63(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18733
18942
|
const _errs3 = errors;
|
|
18734
18943
|
if (errors === _errs3) {
|
|
18735
18944
|
if (typeof data0 === "string") {
|
|
18736
|
-
if (!
|
|
18945
|
+
if (!pattern28.test(data0)) {
|
|
18737
18946
|
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}$"' }];
|
|
18738
18947
|
return false;
|
|
18739
18948
|
}
|
|
@@ -18798,7 +19007,7 @@ function validate64(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18798
19007
|
return errors === 0;
|
|
18799
19008
|
}
|
|
18800
19009
|
validate64.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
18801
|
-
var
|
|
19010
|
+
var pattern30 = new RegExp("^api_key_[A-Za-z0-9_-]+$", "u");
|
|
18802
19011
|
function validate65(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
18803
19012
|
;
|
|
18804
19013
|
let vErrors = null;
|
|
@@ -18884,7 +19093,7 @@ function validate65(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18884
19093
|
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" }];
|
|
18885
19094
|
return false;
|
|
18886
19095
|
} else {
|
|
18887
|
-
if (!
|
|
19096
|
+
if (!pattern30.test(data2)) {
|
|
18888
19097
|
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_-]+$"' }];
|
|
18889
19098
|
return false;
|
|
18890
19099
|
}
|
|
@@ -18912,9 +19121,9 @@ function validate65(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18912
19121
|
return errors === 0;
|
|
18913
19122
|
}
|
|
18914
19123
|
validate65.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
18915
|
-
var
|
|
18916
|
-
var
|
|
18917
|
-
var
|
|
19124
|
+
var pattern32 = new RegExp("^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$", "u");
|
|
19125
|
+
var pattern33 = new RegExp("^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$", "u");
|
|
19126
|
+
var pattern34 = new RegExp("^[\\x21-\\x7e]+$", "u");
|
|
18918
19127
|
function validate66(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
18919
19128
|
;
|
|
18920
19129
|
let vErrors = null;
|
|
@@ -18986,7 +19195,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
18986
19195
|
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" }];
|
|
18987
19196
|
return false;
|
|
18988
19197
|
} else {
|
|
18989
|
-
if (!
|
|
19198
|
+
if (!pattern30.test(data2)) {
|
|
18990
19199
|
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_-]+$"' }];
|
|
18991
19200
|
return false;
|
|
18992
19201
|
}
|
|
@@ -19015,7 +19224,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19015
19224
|
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" }];
|
|
19016
19225
|
return false;
|
|
19017
19226
|
} else {
|
|
19018
|
-
if (!
|
|
19227
|
+
if (!pattern32.test(data3)) {
|
|
19019
19228
|
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])?$"' }];
|
|
19020
19229
|
return false;
|
|
19021
19230
|
}
|
|
@@ -19044,7 +19253,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19044
19253
|
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" }];
|
|
19045
19254
|
return false;
|
|
19046
19255
|
} else {
|
|
19047
|
-
if (!
|
|
19256
|
+
if (!pattern33.test(data4)) {
|
|
19048
19257
|
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]+$"' }];
|
|
19049
19258
|
return false;
|
|
19050
19259
|
}
|
|
@@ -19084,7 +19293,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19084
19293
|
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" }];
|
|
19085
19294
|
return false;
|
|
19086
19295
|
} else {
|
|
19087
|
-
if (!
|
|
19296
|
+
if (!pattern34.test(data6)) {
|
|
19088
19297
|
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]+$"' }];
|
|
19089
19298
|
return false;
|
|
19090
19299
|
}
|
|
@@ -19370,7 +19579,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19370
19579
|
}
|
|
19371
19580
|
errors++;
|
|
19372
19581
|
} else {
|
|
19373
|
-
if (!
|
|
19582
|
+
if (!pattern30.test(data11)) {
|
|
19374
19583
|
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_-]+$"' };
|
|
19375
19584
|
if (vErrors === null) {
|
|
19376
19585
|
vErrors = [err12];
|
|
@@ -19482,7 +19691,7 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19482
19691
|
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" }];
|
|
19483
19692
|
return false;
|
|
19484
19693
|
} else {
|
|
19485
|
-
if (!
|
|
19694
|
+
if (!pattern30.test(data0)) {
|
|
19486
19695
|
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_-]+$"' }];
|
|
19487
19696
|
return false;
|
|
19488
19697
|
}
|
|
@@ -19511,7 +19720,7 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19511
19720
|
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" }];
|
|
19512
19721
|
return false;
|
|
19513
19722
|
} else {
|
|
19514
|
-
if (!
|
|
19723
|
+
if (!pattern32.test(data1)) {
|
|
19515
19724
|
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])?$"' }];
|
|
19516
19725
|
return false;
|
|
19517
19726
|
}
|
|
@@ -19540,7 +19749,7 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19540
19749
|
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" }];
|
|
19541
19750
|
return false;
|
|
19542
19751
|
} else {
|
|
19543
|
-
if (!
|
|
19752
|
+
if (!pattern33.test(data2)) {
|
|
19544
19753
|
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]+$"' }];
|
|
19545
19754
|
return false;
|
|
19546
19755
|
}
|
|
@@ -19580,7 +19789,7 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19580
19789
|
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" }];
|
|
19581
19790
|
return false;
|
|
19582
19791
|
} else {
|
|
19583
|
-
if (!
|
|
19792
|
+
if (!pattern34.test(data4)) {
|
|
19584
19793
|
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]+$"' }];
|
|
19585
19794
|
return false;
|
|
19586
19795
|
}
|
|
@@ -19888,7 +20097,7 @@ function validate68(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19888
20097
|
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" }];
|
|
19889
20098
|
return false;
|
|
19890
20099
|
} else {
|
|
19891
|
-
if (!
|
|
20100
|
+
if (!pattern32.test(data1)) {
|
|
19892
20101
|
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])?$"' }];
|
|
19893
20102
|
return false;
|
|
19894
20103
|
}
|
|
@@ -19941,7 +20150,7 @@ function validate68(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
19941
20150
|
return errors === 0;
|
|
19942
20151
|
}
|
|
19943
20152
|
validate68.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
19944
|
-
var
|
|
20153
|
+
var pattern46 = new RegExp("^sk_[\\x21-\\x7e]+(?: [\\x21-\\x7e]+)*$", "u");
|
|
19945
20154
|
function validate69(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
19946
20155
|
;
|
|
19947
20156
|
let vErrors = null;
|
|
@@ -20002,7 +20211,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
20002
20211
|
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" }];
|
|
20003
20212
|
return false;
|
|
20004
20213
|
} else {
|
|
20005
|
-
if (!
|
|
20214
|
+
if (!pattern30.test(data1)) {
|
|
20006
20215
|
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_-]+$"' }];
|
|
20007
20216
|
return false;
|
|
20008
20217
|
}
|
|
@@ -20031,7 +20240,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
20031
20240
|
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" }];
|
|
20032
20241
|
return false;
|
|
20033
20242
|
} else {
|
|
20034
|
-
if (!
|
|
20243
|
+
if (!pattern32.test(data2)) {
|
|
20035
20244
|
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])?$"' }];
|
|
20036
20245
|
return false;
|
|
20037
20246
|
}
|
|
@@ -20060,7 +20269,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
20060
20269
|
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" }];
|
|
20061
20270
|
return false;
|
|
20062
20271
|
} else {
|
|
20063
|
-
if (!
|
|
20272
|
+
if (!pattern33.test(data3)) {
|
|
20064
20273
|
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]+$"' }];
|
|
20065
20274
|
return false;
|
|
20066
20275
|
}
|
|
@@ -20100,7 +20309,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
20100
20309
|
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" }];
|
|
20101
20310
|
return false;
|
|
20102
20311
|
} else {
|
|
20103
|
-
if (!
|
|
20312
|
+
if (!pattern34.test(data5)) {
|
|
20104
20313
|
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]+$"' }];
|
|
20105
20314
|
return false;
|
|
20106
20315
|
}
|
|
@@ -20362,7 +20571,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
20362
20571
|
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" }];
|
|
20363
20572
|
return false;
|
|
20364
20573
|
} else {
|
|
20365
|
-
if (!
|
|
20574
|
+
if (!pattern46.test(data10)) {
|
|
20366
20575
|
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]+)*$"' }];
|
|
20367
20576
|
return false;
|
|
20368
20577
|
}
|
|
@@ -20484,7 +20693,7 @@ function validate71(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
20484
20693
|
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" }];
|
|
20485
20694
|
return false;
|
|
20486
20695
|
} else {
|
|
20487
|
-
if (!
|
|
20696
|
+
if (!pattern30.test(data0)) {
|
|
20488
20697
|
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_-]+$"' }];
|
|
20489
20698
|
return false;
|
|
20490
20699
|
}
|
|
@@ -20748,7 +20957,7 @@ function validate73(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
20748
20957
|
}
|
|
20749
20958
|
validate73.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
20750
20959
|
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"] };
|
|
20751
|
-
var
|
|
20960
|
+
var pattern49 = new RegExp("^client_[A-Za-z0-9_-]+$", "u");
|
|
20752
20961
|
function validate74(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
20753
20962
|
;
|
|
20754
20963
|
let vErrors = null;
|
|
@@ -20817,7 +21026,7 @@ function validate74(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
20817
21026
|
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" }];
|
|
20818
21027
|
return false;
|
|
20819
21028
|
} else {
|
|
20820
|
-
if (!
|
|
21029
|
+
if (!pattern49.test(data2)) {
|
|
20821
21030
|
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_-]+$"' }];
|
|
20822
21031
|
return false;
|
|
20823
21032
|
}
|
|
@@ -20941,15 +21150,15 @@ validate75.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": f
|
|
|
20941
21150
|
|
|
20942
21151
|
// src/demo/state.ts
|
|
20943
21152
|
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;
|
|
20944
|
-
var demoDirectory = () =>
|
|
21153
|
+
var demoDirectory = () => join9(primConfigDirectory(), "demo");
|
|
20945
21154
|
var runPath = (id) => {
|
|
20946
21155
|
if (!RUN_ID.test(id)) throw new Error("invalid demo run ID");
|
|
20947
|
-
return
|
|
21156
|
+
return join9(demoDirectory(), "runs", `${id}.json`);
|
|
20948
21157
|
};
|
|
20949
21158
|
function readDemoJson(path) {
|
|
20950
|
-
const stat =
|
|
21159
|
+
const stat = lstatSync3(path);
|
|
20951
21160
|
if (!stat.isFile() || stat.size > 16384) throw new Error(`invalid demo state: ${path}`);
|
|
20952
|
-
return JSON.parse(
|
|
21161
|
+
return JSON.parse(readFileSync8(path, "utf8"));
|
|
20953
21162
|
}
|
|
20954
21163
|
function saveDemoJson(path, value) {
|
|
20955
21164
|
atomicWriteFile(path, `${JSON.stringify(value)}
|
|
@@ -20986,16 +21195,16 @@ function demoCommand(run, action, choice, reason) {
|
|
|
20986
21195
|
].map(quote).join(" ");
|
|
20987
21196
|
}
|
|
20988
21197
|
function sessionKey(agent, session) {
|
|
20989
|
-
return
|
|
21198
|
+
return createHash4("sha256").update(`${agent}\0${session}`).digest("hex");
|
|
20990
21199
|
}
|
|
20991
21200
|
function exclusionPath(key) {
|
|
20992
21201
|
if (!/^[0-9a-f]{64}$/u.test(key)) throw new Error("invalid demo session identity");
|
|
20993
|
-
return
|
|
21202
|
+
return join9(demoDirectory(), "excluded-sessions", `${key}.json`);
|
|
20994
21203
|
}
|
|
20995
21204
|
function sessionExcluded(agent, session) {
|
|
20996
21205
|
if (typeof session !== "string" || !session) return false;
|
|
20997
21206
|
const path = exclusionPath(sessionKey(agent, session));
|
|
20998
|
-
if (!
|
|
21207
|
+
if (!existsSync6(path)) return false;
|
|
20999
21208
|
const record = readDemoJson(path);
|
|
21000
21209
|
if (typeof record.runId !== "string" || !RUN_ID.test(record.runId)) {
|
|
21001
21210
|
throw new Error("invalid demo capture exclusion");
|
|
@@ -21028,42 +21237,86 @@ function demoArgv(command) {
|
|
|
21028
21237
|
}
|
|
21029
21238
|
}
|
|
21030
21239
|
|
|
21240
|
+
// src/demo/diagnostics.ts
|
|
21241
|
+
var observationPath = (id) => join10(demoDirectory(), "observations", `${id}.json`);
|
|
21242
|
+
function observeRun(id, observation) {
|
|
21243
|
+
try {
|
|
21244
|
+
saveDemoJson(observationPath(id), observation);
|
|
21245
|
+
} catch {
|
|
21246
|
+
process.stderr.write(
|
|
21247
|
+
"[prim] demo isolation diagnostic could not be saved; check access to Primitive's configuration directory.\n"
|
|
21248
|
+
);
|
|
21249
|
+
}
|
|
21250
|
+
}
|
|
21251
|
+
|
|
21031
21252
|
// src/demo/isolation.ts
|
|
21032
21253
|
function observeDemoInvocation(envelope, agent, checkExclusion = true) {
|
|
21033
21254
|
const session = typeof envelope.session_id === "string" && envelope.session_id ? envelope.session_id : agent === "hermes" ? envelope.extra?.session_key : void 0;
|
|
21034
21255
|
let invocation = false;
|
|
21035
|
-
if (envelope.hook_event_name === "PreToolUse"
|
|
21256
|
+
if (envelope.hook_event_name === "PreToolUse") {
|
|
21036
21257
|
const tool = agent === "cursor" ? "Shell" : agent === "hermes" ? "terminal" : "Bash";
|
|
21037
21258
|
const input = envelope.tool_input;
|
|
21038
|
-
const command = input?.command;
|
|
21039
|
-
if (
|
|
21259
|
+
const command = input?.command ?? input?.cmd;
|
|
21260
|
+
if (typeof command === "string" && command.length < 8192) {
|
|
21040
21261
|
const argv = demoArgv(command);
|
|
21041
|
-
const id = argv?.[4];
|
|
21042
|
-
if (id && RUN_ID.test(id) &&
|
|
21043
|
-
|
|
21044
|
-
|
|
21045
|
-
|
|
21046
|
-
|
|
21047
|
-
|
|
21048
|
-
|
|
21049
|
-
|
|
21050
|
-
|
|
21051
|
-
return false;
|
|
21052
|
-
}
|
|
21053
|
-
if (action === "skip") return true;
|
|
21054
|
-
const key = sessionKey(agent, session);
|
|
21055
|
-
if (run.agent && run.agent !== agent || run.binding && run.binding !== key) {
|
|
21056
|
-
run.acknowledgment = void 0;
|
|
21057
|
-
saveRun(run);
|
|
21058
|
-
return false;
|
|
21059
|
-
}
|
|
21060
|
-
saveDemoJson(exclusionPath(key), { runId: run.id });
|
|
21061
|
-
run.binding = key;
|
|
21062
|
-
run.agent = agent;
|
|
21063
|
-
run.acknowledgment = { command, at: Date.now() };
|
|
21064
|
-
saveRun(run);
|
|
21065
|
-
return true;
|
|
21262
|
+
const id = argv?.[4] ?? command.match(/\x27([0-9a-f-]{36})\x27/u)?.[1];
|
|
21263
|
+
if (id && RUN_ID.test(id) && existsSync8(runPath(id))) {
|
|
21264
|
+
const identity = typeof session === "string" && session ? sessionKey(agent, session) : void 0;
|
|
21265
|
+
const observed = (result, errorCode2) => observeRun(id, {
|
|
21266
|
+
at: Date.now(),
|
|
21267
|
+
agent,
|
|
21268
|
+
runtimeVersion: packageVersion() ?? void 0,
|
|
21269
|
+
session: identity,
|
|
21270
|
+
result,
|
|
21271
|
+
...errorCode2 ? { errorCode: errorCode2 } : {}
|
|
21066
21272
|
});
|
|
21273
|
+
const action = argv?.[3];
|
|
21274
|
+
const choice = argv?.[6];
|
|
21275
|
+
const reason = argv?.[8];
|
|
21276
|
+
const recognized = ["start", "attempt", "resolve", "status", "skip"].includes(action);
|
|
21277
|
+
const validChoice = action !== "resolve" || choice === "adhere" || choice === "supersede" && typeof reason === "string" && reason.trim().length > 0 && reason.length <= 500;
|
|
21278
|
+
const matches = (run) => !run.terminal && recognized && validChoice && demoCommand(run, action, choice, reason) === command;
|
|
21279
|
+
let candidate;
|
|
21280
|
+
try {
|
|
21281
|
+
candidate = readRun(id);
|
|
21282
|
+
} catch {
|
|
21283
|
+
}
|
|
21284
|
+
if (envelope.tool_name !== tool || typeof input?.command !== "string") {
|
|
21285
|
+
observed("tool-mismatch");
|
|
21286
|
+
} else if (!candidate || !matches(candidate)) {
|
|
21287
|
+
observed("command-mismatch");
|
|
21288
|
+
} else
|
|
21289
|
+
try {
|
|
21290
|
+
invocation = lockRun(id, (run) => {
|
|
21291
|
+
if (!matches(run)) {
|
|
21292
|
+
observed("command-mismatch");
|
|
21293
|
+
return false;
|
|
21294
|
+
}
|
|
21295
|
+
if (action === "skip") return true;
|
|
21296
|
+
if (!identity) {
|
|
21297
|
+
observed("session-missing");
|
|
21298
|
+
return false;
|
|
21299
|
+
}
|
|
21300
|
+
const key = identity;
|
|
21301
|
+
if (run.agent && run.agent !== agent || run.binding && run.binding !== key) {
|
|
21302
|
+
observed("session-mismatch");
|
|
21303
|
+
run.acknowledgment = void 0;
|
|
21304
|
+
saveRun(run);
|
|
21305
|
+
return false;
|
|
21306
|
+
}
|
|
21307
|
+
saveDemoJson(exclusionPath(key), { runId: run.id });
|
|
21308
|
+
run.binding = key;
|
|
21309
|
+
run.agent = agent;
|
|
21310
|
+
run.acknowledgment = { command, at: Date.now() };
|
|
21311
|
+
saveRun(run);
|
|
21312
|
+
observed("acknowledged");
|
|
21313
|
+
return true;
|
|
21314
|
+
});
|
|
21315
|
+
} catch (error) {
|
|
21316
|
+
const code = error.code;
|
|
21317
|
+
observed("write-failed", code && /^[A-Z0-9_]{1,32}$/u.test(code) ? code : void 0);
|
|
21318
|
+
throw error;
|
|
21319
|
+
}
|
|
21067
21320
|
}
|
|
21068
21321
|
}
|
|
21069
21322
|
}
|
|
@@ -21074,30 +21327,30 @@ function observeDemoInvocation(envelope, agent, checkExclusion = true) {
|
|
|
21074
21327
|
import {
|
|
21075
21328
|
appendFileSync,
|
|
21076
21329
|
closeSync as closeSync2,
|
|
21077
|
-
existsSync as
|
|
21330
|
+
existsSync as existsSync10,
|
|
21078
21331
|
fstatSync,
|
|
21079
|
-
mkdirSync as
|
|
21332
|
+
mkdirSync as mkdirSync5,
|
|
21080
21333
|
openSync as openSync2,
|
|
21081
21334
|
opendirSync,
|
|
21082
|
-
readFileSync as
|
|
21335
|
+
readFileSync as readFileSync10,
|
|
21083
21336
|
readSync,
|
|
21084
|
-
readdirSync as
|
|
21337
|
+
readdirSync as readdirSync4
|
|
21085
21338
|
} from "fs";
|
|
21086
|
-
import { dirname as
|
|
21339
|
+
import { dirname as dirname8, join as join12 } from "path";
|
|
21087
21340
|
|
|
21088
21341
|
// src/drain-progress.ts
|
|
21089
21342
|
import {
|
|
21090
|
-
chmodSync as
|
|
21091
|
-
existsSync as
|
|
21092
|
-
readFileSync as
|
|
21093
|
-
readdirSync as
|
|
21094
|
-
rmSync as
|
|
21343
|
+
chmodSync as chmodSync4,
|
|
21344
|
+
existsSync as existsSync9,
|
|
21345
|
+
readFileSync as readFileSync9,
|
|
21346
|
+
readdirSync as readdirSync3,
|
|
21347
|
+
rmSync as rmSync5,
|
|
21095
21348
|
rmdirSync
|
|
21096
21349
|
} from "fs";
|
|
21097
|
-
import { basename, dirname as
|
|
21350
|
+
import { basename, dirname as dirname7, join as join11 } from "path";
|
|
21098
21351
|
|
|
21099
21352
|
// src/journal.ts
|
|
21100
|
-
var JOURNAL_DIR =
|
|
21353
|
+
var JOURNAL_DIR = join12(primConfigDirectory(), "moves");
|
|
21101
21354
|
var UNBOUND_BUCKET = "_unbound";
|
|
21102
21355
|
var JOURNAL_BASENAME = "journal.ndjson";
|
|
21103
21356
|
var JOURNAL_STATS_SAMPLE_BYTES = 64 * 1024;
|
|
@@ -21109,26 +21362,26 @@ function envSlug(apiUrl) {
|
|
|
21109
21362
|
return slug;
|
|
21110
21363
|
}
|
|
21111
21364
|
function currentEnvDir() {
|
|
21112
|
-
return
|
|
21365
|
+
return join12(JOURNAL_DIR, envSlug(getSiteUrl()));
|
|
21113
21366
|
}
|
|
21114
21367
|
var DIR_MODE = 448;
|
|
21115
21368
|
var FILE_MODE2 = 384;
|
|
21116
21369
|
var SAFE_BUCKET = /^[A-Za-z0-9_-]+$/;
|
|
21117
21370
|
var RESERVED_BUCKETS = /* @__PURE__ */ new Set([UNBOUND_BUCKET, "_legacy"]);
|
|
21118
21371
|
function appendMoveToPath(path, move) {
|
|
21119
|
-
const dir =
|
|
21120
|
-
if (!
|
|
21121
|
-
|
|
21372
|
+
const dir = dirname8(path);
|
|
21373
|
+
if (!existsSync10(dir)) {
|
|
21374
|
+
mkdirSync5(dir, { recursive: true, mode: DIR_MODE });
|
|
21122
21375
|
}
|
|
21123
21376
|
appendFileSync(path, `${JSON.stringify(move)}
|
|
21124
21377
|
`, { mode: FILE_MODE2 });
|
|
21125
21378
|
}
|
|
21126
21379
|
function bucketDir(orgId) {
|
|
21127
21380
|
const safe = orgId !== void 0 && SAFE_BUCKET.test(orgId) && !RESERVED_BUCKETS.has(orgId);
|
|
21128
|
-
return
|
|
21381
|
+
return join12(currentEnvDir(), safe ? orgId : UNBOUND_BUCKET);
|
|
21129
21382
|
}
|
|
21130
21383
|
function journalPath(orgId) {
|
|
21131
|
-
return
|
|
21384
|
+
return join12(bucketDir(orgId), JOURNAL_BASENAME);
|
|
21132
21385
|
}
|
|
21133
21386
|
function appendMove(move, orgId) {
|
|
21134
21387
|
appendMoveToPath(journalPath(orgId), move);
|
|
@@ -21137,15 +21390,15 @@ var FLUSHING_PREFIX = `${JOURNAL_BASENAME}.flushing.`;
|
|
|
21137
21390
|
|
|
21138
21391
|
// src/lib/activation.ts
|
|
21139
21392
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
21140
|
-
import { existsSync as
|
|
21393
|
+
import { existsSync as existsSync11, readFileSync as readFileSync11 } from "fs";
|
|
21141
21394
|
import { homedir as homedir2 } from "os";
|
|
21142
|
-
import { join as
|
|
21395
|
+
import { join as join13 } from "path";
|
|
21143
21396
|
|
|
21144
21397
|
// src/lib/git.ts
|
|
21145
21398
|
import { execFileSync } from "child_process";
|
|
21146
|
-
import { createHash as
|
|
21147
|
-
import { lstatSync as
|
|
21148
|
-
import { basename as basename2, dirname as
|
|
21399
|
+
import { createHash as createHash5 } from "crypto";
|
|
21400
|
+
import { lstatSync as lstatSync4, realpathSync as realpathSync2 } from "fs";
|
|
21401
|
+
import { basename as basename2, dirname as dirname9, isAbsolute as isAbsolute4, relative, resolve as resolve4, sep } from "path";
|
|
21149
21402
|
var GIT_TIMEOUT_MS = 1e3;
|
|
21150
21403
|
var GITHUB_OWNER_PATTERN = /^(?![A-Za-z0-9-]*--)[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/u;
|
|
21151
21404
|
var GITHUB_REPOSITORY_PATTERN = /^[A-Za-z0-9._-]{1,100}$/u;
|
|
@@ -21194,19 +21447,19 @@ function githubRepositoryFullName(cwd) {
|
|
|
21194
21447
|
function canonicalGitRoot(cwd) {
|
|
21195
21448
|
try {
|
|
21196
21449
|
const top = gitToplevel(cwd);
|
|
21197
|
-
return top ?
|
|
21450
|
+
return top ? realpathSync2.native(top) : null;
|
|
21198
21451
|
} catch {
|
|
21199
21452
|
return null;
|
|
21200
21453
|
}
|
|
21201
21454
|
}
|
|
21202
21455
|
function relatedWorktreeTarget(path, cwd, origin) {
|
|
21203
|
-
let parent =
|
|
21456
|
+
let parent = dirname9(resolve4(cwd, path));
|
|
21204
21457
|
while (true) {
|
|
21205
21458
|
try {
|
|
21206
|
-
|
|
21459
|
+
realpathSync2.native(parent);
|
|
21207
21460
|
break;
|
|
21208
21461
|
} catch {
|
|
21209
|
-
const next =
|
|
21462
|
+
const next = dirname9(parent);
|
|
21210
21463
|
if (next === parent) return null;
|
|
21211
21464
|
parent = next;
|
|
21212
21465
|
}
|
|
@@ -21216,7 +21469,7 @@ function relatedWorktreeTarget(path, cwd, origin) {
|
|
|
21216
21469
|
const common = (root) => {
|
|
21217
21470
|
const value = gitValue(root, ["rev-parse", "--git-common-dir"]);
|
|
21218
21471
|
try {
|
|
21219
|
-
return value ?
|
|
21472
|
+
return value ? realpathSync2.native(resolve4(root, value)) : void 0;
|
|
21220
21473
|
} catch {
|
|
21221
21474
|
return void 0;
|
|
21222
21475
|
}
|
|
@@ -21246,16 +21499,16 @@ function normalizeOriginRemote(remote) {
|
|
|
21246
21499
|
}
|
|
21247
21500
|
}
|
|
21248
21501
|
function opaqueRepoKey(source, value) {
|
|
21249
|
-
return `repo_v1_${
|
|
21502
|
+
return `repo_v1_${createHash5("sha256").update(`${source}\0${value}`).digest("hex")}`;
|
|
21250
21503
|
}
|
|
21251
21504
|
function resolveRepositoryContext(cwd = process.cwd()) {
|
|
21252
21505
|
const top = gitToplevel(cwd);
|
|
21253
21506
|
if (!top) return null;
|
|
21254
21507
|
let repoRoot;
|
|
21255
21508
|
try {
|
|
21256
|
-
repoRoot =
|
|
21509
|
+
repoRoot = realpathSync2.native(top);
|
|
21257
21510
|
} catch {
|
|
21258
|
-
repoRoot =
|
|
21511
|
+
repoRoot = resolve4(top);
|
|
21259
21512
|
}
|
|
21260
21513
|
const origin = gitValue(repoRoot, ["config", "--get", "remote.origin.url"]);
|
|
21261
21514
|
const repoFullName = githubRepositoryFullName(repoRoot) ?? void 0;
|
|
@@ -21284,19 +21537,19 @@ function nearestExistingAncestor(path) {
|
|
|
21284
21537
|
let cursor = path;
|
|
21285
21538
|
while (true) {
|
|
21286
21539
|
try {
|
|
21287
|
-
|
|
21540
|
+
lstatSync4(cursor);
|
|
21288
21541
|
break;
|
|
21289
21542
|
} catch (error) {
|
|
21290
21543
|
const code = typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
21291
21544
|
if (code !== "ENOENT" && code !== "ENOTDIR") return null;
|
|
21292
|
-
const parent =
|
|
21545
|
+
const parent = dirname9(cursor);
|
|
21293
21546
|
if (parent === cursor) return null;
|
|
21294
21547
|
suffix.unshift(cursor.slice(parent.length + (parent.endsWith(sep) ? 0 : 1)));
|
|
21295
21548
|
cursor = parent;
|
|
21296
21549
|
}
|
|
21297
21550
|
}
|
|
21298
21551
|
try {
|
|
21299
|
-
return { real:
|
|
21552
|
+
return { real: realpathSync2.native(cursor), suffix };
|
|
21300
21553
|
} catch {
|
|
21301
21554
|
return null;
|
|
21302
21555
|
}
|
|
@@ -21305,13 +21558,13 @@ function canonicalRepositoryPathScoped(filePath, context, baseDir) {
|
|
|
21305
21558
|
if (!filePath || filePath !== filePath.trim() || filePath.includes("\0")) {
|
|
21306
21559
|
return { ok: false, reason: "invalid_path" };
|
|
21307
21560
|
}
|
|
21308
|
-
const absolute =
|
|
21561
|
+
const absolute = resolve4(baseDir, filePath);
|
|
21309
21562
|
const resolved = nearestExistingAncestor(absolute);
|
|
21310
21563
|
if (!resolved) return { ok: false, reason: "invalid_path" };
|
|
21311
|
-
const target =
|
|
21564
|
+
const target = resolve4(resolved.real, ...resolved.suffix);
|
|
21312
21565
|
const rel = relative(context.repoRoot, target);
|
|
21313
21566
|
if (!rel || rel === ".") return { ok: false, reason: "invalid_path" };
|
|
21314
|
-
if (
|
|
21567
|
+
if (isAbsolute4(rel) || rel === ".." || rel.startsWith(`..${sep}`)) {
|
|
21315
21568
|
return { ok: false, reason: "outside_repository" };
|
|
21316
21569
|
}
|
|
21317
21570
|
return { ok: true, file: sep === "/" ? rel : rel.split(sep).join("/") };
|
|
@@ -21319,26 +21572,26 @@ function canonicalRepositoryPathScoped(filePath, context, baseDir) {
|
|
|
21319
21572
|
function canonicalRepositoryPathLegacy(filePath, cwd, repositoryRoot = canonicalGitRoot(cwd)) {
|
|
21320
21573
|
if (!repositoryRoot || !filePath || [...filePath].some((char) => char < " " || char === "\x7F" || "~*?[]{}$`\\".includes(char)))
|
|
21321
21574
|
return null;
|
|
21322
|
-
const absolute =
|
|
21575
|
+
const absolute = resolve4(cwd, filePath);
|
|
21323
21576
|
let target;
|
|
21324
21577
|
try {
|
|
21325
|
-
const stat =
|
|
21578
|
+
const stat = lstatSync4(absolute);
|
|
21326
21579
|
if (!stat.isFile() || stat.isSymbolicLink()) return null;
|
|
21327
|
-
target =
|
|
21580
|
+
target = realpathSync2.native(absolute);
|
|
21328
21581
|
} catch (error) {
|
|
21329
21582
|
if (!(error instanceof Error) || error.code !== "ENOENT") {
|
|
21330
21583
|
return null;
|
|
21331
21584
|
}
|
|
21332
21585
|
try {
|
|
21333
|
-
const parent =
|
|
21334
|
-
if (!
|
|
21335
|
-
target =
|
|
21586
|
+
const parent = realpathSync2.native(dirname9(absolute));
|
|
21587
|
+
if (!lstatSync4(parent).isDirectory()) return null;
|
|
21588
|
+
target = resolve4(parent, basename2(absolute));
|
|
21336
21589
|
} catch {
|
|
21337
21590
|
return null;
|
|
21338
21591
|
}
|
|
21339
21592
|
}
|
|
21340
21593
|
const rel = relative(repositoryRoot, target);
|
|
21341
|
-
if (!rel ||
|
|
21594
|
+
if (!rel || isAbsolute4(rel) || rel === ".." || rel.startsWith(`..${sep}`)) {
|
|
21342
21595
|
return null;
|
|
21343
21596
|
}
|
|
21344
21597
|
return sep === "/" ? rel : rel.split(sep).join("/");
|
|
@@ -21413,10 +21666,10 @@ function hasProjectPrimInstall(cwd) {
|
|
|
21413
21666
|
const root = gitToplevel(cwd);
|
|
21414
21667
|
if (root === null || root === homedir2()) return false;
|
|
21415
21668
|
for (const rel of PROJECT_INSTALL_FILES) {
|
|
21416
|
-
const path =
|
|
21417
|
-
if (
|
|
21669
|
+
const path = join13(root, rel);
|
|
21670
|
+
if (existsSync11(path)) {
|
|
21418
21671
|
try {
|
|
21419
|
-
const content =
|
|
21672
|
+
const content = readFileSync11(path, "utf-8");
|
|
21420
21673
|
if (PRIM_HOOK_BINS.some((bin) => content.includes(bin))) return true;
|
|
21421
21674
|
} catch {
|
|
21422
21675
|
}
|
|
@@ -21723,8 +21976,8 @@ function cachedCollectScopeAdmits(cwd, facts) {
|
|
|
21723
21976
|
|
|
21724
21977
|
// src/lib/commit-heartbeat.ts
|
|
21725
21978
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
21726
|
-
import { mkdirSync as
|
|
21727
|
-
import { dirname as
|
|
21979
|
+
import { mkdirSync as mkdirSync6, readFileSync as readFileSync12, readdirSync as readdirSync5, unlinkSync } from "fs";
|
|
21980
|
+
import { dirname as dirname10, join as join14, resolve as resolve5 } from "path";
|
|
21728
21981
|
var GIT_TIMEOUT_MS3 = 1e3;
|
|
21729
21982
|
function gitPath(cwd, relative3) {
|
|
21730
21983
|
const value = execFileSync3("git", ["rev-parse", "--git-path", relative3], {
|
|
@@ -21734,11 +21987,11 @@ function gitPath(cwd, relative3) {
|
|
|
21734
21987
|
timeout: GIT_TIMEOUT_MS3
|
|
21735
21988
|
}).replace(/\r?\n$/u, "");
|
|
21736
21989
|
if (value === "" || /[\0\r\n]/u.test(value)) throw new Error("Git returned an unsafe path");
|
|
21737
|
-
return
|
|
21990
|
+
return resolve5(cwd, value);
|
|
21738
21991
|
}
|
|
21739
21992
|
function ensurePrivateParent(path) {
|
|
21740
|
-
|
|
21741
|
-
|
|
21993
|
+
mkdirSync6(dirname10(dirname10(path)), { recursive: true, mode: 448 });
|
|
21994
|
+
mkdirSync6(dirname10(path), { recursive: true, mode: 448 });
|
|
21742
21995
|
}
|
|
21743
21996
|
function writeStamp(path, at) {
|
|
21744
21997
|
ensurePrivateParent(path);
|
|
@@ -21762,22 +22015,22 @@ function unattendedEnv(env = process.env) {
|
|
|
21762
22015
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
21763
22016
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
21764
22017
|
import {
|
|
21765
|
-
constants as
|
|
21766
|
-
chmodSync as
|
|
22018
|
+
constants as constants3,
|
|
22019
|
+
chmodSync as chmodSync5,
|
|
21767
22020
|
closeSync as closeSync3,
|
|
21768
22021
|
fchmodSync as fchmodSync2,
|
|
21769
22022
|
fsyncSync as fsyncSync2,
|
|
21770
22023
|
linkSync,
|
|
21771
|
-
lstatSync as
|
|
21772
|
-
mkdirSync as
|
|
22024
|
+
lstatSync as lstatSync5,
|
|
22025
|
+
mkdirSync as mkdirSync7,
|
|
21773
22026
|
openSync as openSync3,
|
|
21774
|
-
readFileSync as
|
|
21775
|
-
statSync as
|
|
22027
|
+
readFileSync as readFileSync13,
|
|
22028
|
+
statSync as statSync3,
|
|
21776
22029
|
unlinkSync as unlinkSync2,
|
|
21777
|
-
writeFileSync as
|
|
22030
|
+
writeFileSync as writeFileSync4
|
|
21778
22031
|
} from "fs";
|
|
21779
|
-
import { dirname as
|
|
21780
|
-
var WORKSPACE_ID_RELATIVE_PATH =
|
|
22032
|
+
import { dirname as dirname11, isAbsolute as isAbsolute5, join as join15, resolve as resolve6 } from "path";
|
|
22033
|
+
var WORKSPACE_ID_RELATIVE_PATH = join15("prim", "workspace-id");
|
|
21781
22034
|
var MAX_ANCESTORS = 64;
|
|
21782
22035
|
var MAX_GIT_FILE_BYTES = 4096;
|
|
21783
22036
|
var MAX_ID_FILE_BYTES = 128;
|
|
@@ -21823,7 +22076,7 @@ function resolveWorkspaceIdPath(cwd) {
|
|
|
21823
22076
|
}
|
|
21824
22077
|
return {
|
|
21825
22078
|
status: "resolved",
|
|
21826
|
-
path:
|
|
22079
|
+
path: isAbsolute5(gitPath2) ? resolve6(gitPath2) : resolve6(cwd, gitPath2)
|
|
21827
22080
|
};
|
|
21828
22081
|
} catch (error) {
|
|
21829
22082
|
const code = errorCode(error);
|
|
@@ -21834,21 +22087,21 @@ function resolveWorkspaceIdPath(cwd) {
|
|
|
21834
22087
|
}
|
|
21835
22088
|
}
|
|
21836
22089
|
function resolveFromFilesystem(cwd) {
|
|
21837
|
-
let current =
|
|
22090
|
+
let current = resolve6(cwd);
|
|
21838
22091
|
for (let depth = 0; depth < MAX_ANCESTORS; depth += 1) {
|
|
21839
|
-
const dotGit =
|
|
22092
|
+
const dotGit = join15(current, ".git");
|
|
21840
22093
|
try {
|
|
21841
|
-
const stat =
|
|
22094
|
+
const stat = lstatSync5(dotGit);
|
|
21842
22095
|
if (stat.isDirectory() && isGitDirectory(dotGit)) {
|
|
21843
|
-
return
|
|
22096
|
+
return join15(dotGit, WORKSPACE_ID_RELATIVE_PATH);
|
|
21844
22097
|
}
|
|
21845
22098
|
if (stat.isFile() && stat.size <= MAX_GIT_FILE_BYTES) {
|
|
21846
|
-
const contents =
|
|
22099
|
+
const contents = readFileSync13(dotGit, "utf8");
|
|
21847
22100
|
const match = /^gitdir: (.+?)(?:\r?\n)?$/.exec(contents);
|
|
21848
22101
|
if (match?.[1]) {
|
|
21849
|
-
const gitDirectory =
|
|
22102
|
+
const gitDirectory = isAbsolute5(match[1]) ? resolve6(match[1]) : resolve6(current, match[1]);
|
|
21850
22103
|
if (isGitDirectory(gitDirectory)) {
|
|
21851
|
-
return
|
|
22104
|
+
return join15(gitDirectory, WORKSPACE_ID_RELATIVE_PATH);
|
|
21852
22105
|
}
|
|
21853
22106
|
}
|
|
21854
22107
|
}
|
|
@@ -21859,7 +22112,7 @@ function resolveFromFilesystem(cwd) {
|
|
|
21859
22112
|
return null;
|
|
21860
22113
|
}
|
|
21861
22114
|
}
|
|
21862
|
-
const parent =
|
|
22115
|
+
const parent = dirname11(current);
|
|
21863
22116
|
if (parent === current) break;
|
|
21864
22117
|
current = parent;
|
|
21865
22118
|
}
|
|
@@ -21867,7 +22120,7 @@ function resolveFromFilesystem(cwd) {
|
|
|
21867
22120
|
}
|
|
21868
22121
|
function isGitDirectory(path) {
|
|
21869
22122
|
try {
|
|
21870
|
-
return
|
|
22123
|
+
return statSync3(join15(path, "HEAD")).isFile();
|
|
21871
22124
|
} catch {
|
|
21872
22125
|
return false;
|
|
21873
22126
|
}
|
|
@@ -21875,7 +22128,7 @@ function isGitDirectory(path) {
|
|
|
21875
22128
|
function inspectPath(path) {
|
|
21876
22129
|
let stat;
|
|
21877
22130
|
try {
|
|
21878
|
-
stat =
|
|
22131
|
+
stat = lstatSync5(path);
|
|
21879
22132
|
} catch (error) {
|
|
21880
22133
|
const code = errorCode(error);
|
|
21881
22134
|
if (code === "ENOENT" || code === "ENOTDIR") return { status: "missing", path };
|
|
@@ -21886,7 +22139,7 @@ function inspectPath(path) {
|
|
|
21886
22139
|
return { status: "corrupt", path, reason: "invalid_content" };
|
|
21887
22140
|
}
|
|
21888
22141
|
try {
|
|
21889
|
-
const contents =
|
|
22142
|
+
const contents = readFileSync13(path, "utf8");
|
|
21890
22143
|
const workspaceId = contents.endsWith("\n") ? contents.slice(0, -1) : contents;
|
|
21891
22144
|
if ((contents === workspaceId || contents === `${workspaceId}
|
|
21892
22145
|
`) && isCanonicalWorkspaceId(workspaceId)) {
|
|
@@ -21903,22 +22156,22 @@ function inspectPath(path) {
|
|
|
21903
22156
|
}
|
|
21904
22157
|
}
|
|
21905
22158
|
function createWorkspaceId(path) {
|
|
21906
|
-
const parent =
|
|
22159
|
+
const parent = dirname11(path);
|
|
21907
22160
|
const workspaceId = randomUUID3();
|
|
21908
|
-
const temporaryPath =
|
|
22161
|
+
const temporaryPath = join15(parent, `.workspace-id-${process.pid}-${randomUUID3()}.tmp`);
|
|
21909
22162
|
let temporaryCreated = false;
|
|
21910
22163
|
let publishing = false;
|
|
21911
22164
|
try {
|
|
21912
|
-
|
|
21913
|
-
|
|
22165
|
+
mkdirSync7(parent, { recursive: true, mode: 448 });
|
|
22166
|
+
chmodSync5(parent, 448);
|
|
21914
22167
|
const fd = openSync3(
|
|
21915
22168
|
temporaryPath,
|
|
21916
|
-
|
|
22169
|
+
constants3.O_CREAT | constants3.O_EXCL | constants3.O_WRONLY,
|
|
21917
22170
|
384
|
|
21918
22171
|
);
|
|
21919
22172
|
temporaryCreated = true;
|
|
21920
22173
|
try {
|
|
21921
|
-
|
|
22174
|
+
writeFileSync4(fd, `${workspaceId}
|
|
21922
22175
|
`, "utf8");
|
|
21923
22176
|
fchmodSync2(fd, 384);
|
|
21924
22177
|
fsyncSync2(fd);
|
|
@@ -21975,33 +22228,33 @@ function parseAgent(argv) {
|
|
|
21975
22228
|
}
|
|
21976
22229
|
|
|
21977
22230
|
// src/hooks/codex-context.ts
|
|
21978
|
-
import { createHash as
|
|
22231
|
+
import { createHash as createHash7, randomBytes as randomBytes5 } from "crypto";
|
|
21979
22232
|
import {
|
|
21980
|
-
chmodSync as
|
|
21981
|
-
existsSync as
|
|
21982
|
-
mkdirSync as
|
|
21983
|
-
readFileSync as
|
|
21984
|
-
readdirSync as
|
|
21985
|
-
renameSync as
|
|
21986
|
-
rmSync as
|
|
21987
|
-
statSync as
|
|
22233
|
+
chmodSync as chmodSync6,
|
|
22234
|
+
existsSync as existsSync12,
|
|
22235
|
+
mkdirSync as mkdirSync8,
|
|
22236
|
+
readFileSync as readFileSync14,
|
|
22237
|
+
readdirSync as readdirSync6,
|
|
22238
|
+
renameSync as renameSync3,
|
|
22239
|
+
rmSync as rmSync6,
|
|
22240
|
+
statSync as statSync4,
|
|
21988
22241
|
unlinkSync as unlinkSync3,
|
|
21989
|
-
writeFileSync as
|
|
22242
|
+
writeFileSync as writeFileSync5
|
|
21990
22243
|
} from "fs";
|
|
21991
|
-
import { join as
|
|
22244
|
+
import { join as join17 } from "path";
|
|
21992
22245
|
|
|
21993
22246
|
// src/daemon/client.ts
|
|
21994
22247
|
import { createConnection } from "net";
|
|
21995
|
-
import { join as
|
|
22248
|
+
import { join as join16 } from "path";
|
|
21996
22249
|
|
|
21997
22250
|
// src/daemon/principal.ts
|
|
21998
|
-
import { createHash as
|
|
22251
|
+
import { createHash as createHash6 } from "crypto";
|
|
21999
22252
|
var PRINCIPAL_COMPONENT_MAX_LENGTH = 512;
|
|
22000
22253
|
function boundedClaim(value) {
|
|
22001
22254
|
return typeof value === "string" && value.length > 0 && value.length <= PRINCIPAL_COMPONENT_MAX_LENGTH ? value : void 0;
|
|
22002
22255
|
}
|
|
22003
22256
|
function sha256(value) {
|
|
22004
|
-
return
|
|
22257
|
+
return createHash6("sha256").update(value).digest("hex");
|
|
22005
22258
|
}
|
|
22006
22259
|
function resolveDaemonPrincipal(token = resolveAuthCredential()?.token) {
|
|
22007
22260
|
if (!token) return void 0;
|
|
@@ -22042,7 +22295,7 @@ function parseDaemonResponseEnvelope(value) {
|
|
|
22042
22295
|
}
|
|
22043
22296
|
|
|
22044
22297
|
// src/daemon/client.ts
|
|
22045
|
-
var SOCK_PATH =
|
|
22298
|
+
var SOCK_PATH = join16(primConfigDirectory(), "sock");
|
|
22046
22299
|
var DEFAULT_TIMEOUT_MS2 = 250;
|
|
22047
22300
|
var nextRequestId = 1;
|
|
22048
22301
|
function daemonRequest(method, params = {}, opts = {}) {
|
|
@@ -22130,7 +22383,7 @@ function daemonRequest(method, params = {}, opts = {}) {
|
|
|
22130
22383
|
}
|
|
22131
22384
|
|
|
22132
22385
|
// src/daemon/decision-digest-cache.ts
|
|
22133
|
-
import { randomBytes as
|
|
22386
|
+
import { randomBytes as randomBytes4 } from "crypto";
|
|
22134
22387
|
var DECISION_DIGEST_CACHE_LIMIT = 100;
|
|
22135
22388
|
var DECISION_DIGEST_CACHE_WINDOW = "24h";
|
|
22136
22389
|
var DECISION_DIGEST_CACHE_PATH = `/api/cli/decisions/recent?limit=${String(DECISION_DIGEST_CACHE_LIMIT)}&since=${DECISION_DIGEST_CACHE_WINDOW}`;
|
|
@@ -22289,10 +22542,10 @@ var STATE_VERSION = 1;
|
|
|
22289
22542
|
var DRAFT_STATE_VERSION = 2;
|
|
22290
22543
|
var NO_CURSOR = -1;
|
|
22291
22544
|
function stateRoot(namespace) {
|
|
22292
|
-
return
|
|
22545
|
+
return join17(primConfigDirectory(), namespace, "decision-digests");
|
|
22293
22546
|
}
|
|
22294
22547
|
function draftStateRoot(namespace) {
|
|
22295
|
-
return
|
|
22548
|
+
return join17(primConfigDirectory(), namespace, "decision-draft-deliveries");
|
|
22296
22549
|
}
|
|
22297
22550
|
function workspaceFor(cwd) {
|
|
22298
22551
|
try {
|
|
@@ -22303,13 +22556,13 @@ function workspaceFor(cwd) {
|
|
|
22303
22556
|
}
|
|
22304
22557
|
function statePath(args) {
|
|
22305
22558
|
const identity = `${args.siteUrl}\0${workspaceFor(args.cwd)}\0${args.sessionId}`;
|
|
22306
|
-
const key =
|
|
22307
|
-
return
|
|
22559
|
+
const key = createHash7("sha256").update(identity).digest("hex");
|
|
22560
|
+
return join17(stateRoot(args.namespace), `${key}.json`);
|
|
22308
22561
|
}
|
|
22309
22562
|
function draftStatePath(args) {
|
|
22310
22563
|
const identity = `${args.siteUrl}\0${workspaceFor(args.cwd)}\0${args.sessionId}\0${args.principalId}\0${args.organizationId}\0${args.credentialFingerprint}`;
|
|
22311
|
-
const key =
|
|
22312
|
-
return
|
|
22564
|
+
const key = createHash7("sha256").update(identity).digest("hex");
|
|
22565
|
+
return join17(draftStateRoot(args.namespace), `${key}.json`);
|
|
22313
22566
|
}
|
|
22314
22567
|
function parseState(value) {
|
|
22315
22568
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
@@ -22348,37 +22601,37 @@ function parseDraftState(value) {
|
|
|
22348
22601
|
};
|
|
22349
22602
|
}
|
|
22350
22603
|
function readState(path) {
|
|
22351
|
-
if (!
|
|
22604
|
+
if (!existsSync12(path)) return void 0;
|
|
22352
22605
|
try {
|
|
22353
|
-
return parseState(JSON.parse(
|
|
22606
|
+
return parseState(JSON.parse(readFileSync14(path, "utf8")));
|
|
22354
22607
|
} catch {
|
|
22355
22608
|
return void 0;
|
|
22356
22609
|
}
|
|
22357
22610
|
}
|
|
22358
22611
|
function readDraftState(path) {
|
|
22359
|
-
if (!
|
|
22612
|
+
if (!existsSync12(path)) return void 0;
|
|
22360
22613
|
try {
|
|
22361
|
-
return parseDraftState(JSON.parse(
|
|
22614
|
+
return parseDraftState(JSON.parse(readFileSync14(path, "utf8")));
|
|
22362
22615
|
} catch {
|
|
22363
22616
|
return void 0;
|
|
22364
22617
|
}
|
|
22365
22618
|
}
|
|
22366
22619
|
function writeStateFile(path, directory, state) {
|
|
22367
|
-
|
|
22368
|
-
|
|
22369
|
-
const temporary =
|
|
22620
|
+
mkdirSync8(directory, { recursive: true, mode: 448 });
|
|
22621
|
+
chmodSync6(directory, 448);
|
|
22622
|
+
const temporary = join17(
|
|
22370
22623
|
directory,
|
|
22371
|
-
`.${path.slice(directory.length + 1)}.tmp-${process.pid}-${
|
|
22624
|
+
`.${path.slice(directory.length + 1)}.tmp-${process.pid}-${randomBytes5(8).toString("hex")}`
|
|
22372
22625
|
);
|
|
22373
22626
|
try {
|
|
22374
|
-
|
|
22627
|
+
writeFileSync5(temporary, `${JSON.stringify(state)}
|
|
22375
22628
|
`, {
|
|
22376
22629
|
encoding: "utf8",
|
|
22377
22630
|
mode: 384,
|
|
22378
22631
|
flag: "wx"
|
|
22379
22632
|
});
|
|
22380
|
-
|
|
22381
|
-
|
|
22633
|
+
chmodSync6(temporary, 384);
|
|
22634
|
+
renameSync3(temporary, path);
|
|
22382
22635
|
} finally {
|
|
22383
22636
|
try {
|
|
22384
22637
|
unlinkSync3(temporary);
|
|
@@ -22387,19 +22640,19 @@ function writeStateFile(path, directory, state) {
|
|
|
22387
22640
|
}
|
|
22388
22641
|
}
|
|
22389
22642
|
function cleanupStateFiles(directory, now) {
|
|
22390
|
-
if (!
|
|
22643
|
+
if (!existsSync12(directory)) return;
|
|
22391
22644
|
let names;
|
|
22392
22645
|
try {
|
|
22393
|
-
names =
|
|
22646
|
+
names = readdirSync6(directory);
|
|
22394
22647
|
} catch {
|
|
22395
22648
|
return;
|
|
22396
22649
|
}
|
|
22397
22650
|
const files = [];
|
|
22398
22651
|
const residue = [];
|
|
22399
22652
|
for (const name of names) {
|
|
22400
|
-
const path =
|
|
22653
|
+
const path = join17(directory, name);
|
|
22401
22654
|
try {
|
|
22402
|
-
const mtimeMs =
|
|
22655
|
+
const mtimeMs = statSync4(path).mtimeMs;
|
|
22403
22656
|
if (name.endsWith(".json")) {
|
|
22404
22657
|
files.push({ path, mtimeMs });
|
|
22405
22658
|
} else if ((name.includes(".json.tmp-") || name.endsWith(".json.lock")) && now - mtimeMs > CODEX_DIGEST_STATE_RETENTION_MS) {
|
|
@@ -22418,8 +22671,8 @@ function cleanupStateFiles(directory, now) {
|
|
|
22418
22671
|
}
|
|
22419
22672
|
for (const path of residue) {
|
|
22420
22673
|
try {
|
|
22421
|
-
if (now -
|
|
22422
|
-
|
|
22674
|
+
if (now - statSync4(path).mtimeMs > CODEX_DIGEST_STATE_RETENTION_MS) {
|
|
22675
|
+
rmSync6(path, { recursive: true, force: true });
|
|
22423
22676
|
}
|
|
22424
22677
|
} catch {
|
|
22425
22678
|
}
|
|
@@ -22735,126 +22988,14 @@ async function processCodexMessageContext(envelope, deps = defaultDeps) {
|
|
|
22735
22988
|
}
|
|
22736
22989
|
|
|
22737
22990
|
// src/commands/cursor-install.ts
|
|
22738
|
-
import { existsSync as
|
|
22991
|
+
import { existsSync as existsSync14, readFileSync as readFileSync16 } from "fs";
|
|
22739
22992
|
import { homedir as homedir4 } from "os";
|
|
22740
|
-
import { isAbsolute as isAbsolute6, join as
|
|
22741
|
-
|
|
22742
|
-
// src/lib/hook-runtime.ts
|
|
22743
|
-
import { createHash as createHash7, randomBytes as randomBytes5 } from "crypto";
|
|
22744
|
-
import {
|
|
22745
|
-
constants as constants3,
|
|
22746
|
-
accessSync,
|
|
22747
|
-
chmodSync as chmodSync6,
|
|
22748
|
-
copyFileSync,
|
|
22749
|
-
existsSync as existsSync11,
|
|
22750
|
-
lstatSync as lstatSync5,
|
|
22751
|
-
mkdirSync as mkdirSync8,
|
|
22752
|
-
mkdtempSync,
|
|
22753
|
-
readFileSync as readFileSync14,
|
|
22754
|
-
readdirSync as readdirSync6,
|
|
22755
|
-
realpathSync as realpathSync2,
|
|
22756
|
-
renameSync as renameSync3,
|
|
22757
|
-
rmSync as rmSync6,
|
|
22758
|
-
statSync as statSync4,
|
|
22759
|
-
utimesSync,
|
|
22760
|
-
writeFileSync as writeFileSync5
|
|
22761
|
-
} from "fs";
|
|
22762
|
-
import { delimiter, dirname as dirname11, isAbsolute as isAbsolute5, join as join16, resolve as resolve6 } from "path";
|
|
22763
|
-
|
|
22764
|
-
// src/lib/git-hook-contract.ts
|
|
22765
|
-
var GIT_HOOK_ENTRYPOINT_CONTENT = `#!/bin/sh
|
|
22766
|
-
# prim git hook entrypoint v1 \u2014 managed by prim; do not edit.
|
|
22767
|
-
# Run by the "# >>> prim <hook> hook >>>" block in a Git hook file. Acts only
|
|
22768
|
-
# where prim is active (git config prim.active true) and never fails the hook.
|
|
22769
|
-
case "$0" in */*) prim_dir=\${0%/*} ;; *) exit 0 ;; esac
|
|
22770
|
-
prim_launcher="$prim_dir/${STABLE_HOOK_LAUNCHER_NAME}"
|
|
22771
|
-
[ -x "$prim_launcher" ] || exit 0
|
|
22772
|
-
[ "$(git config --get prim.active 2>/dev/null)" = "true" ] || exit 0
|
|
22773
|
-
prim_hook=\${1-}
|
|
22774
|
-
if [ "$#" -gt 0 ]; then shift; fi
|
|
22775
|
-
case "$prim_hook" in
|
|
22776
|
-
pre-commit)
|
|
22777
|
-
"$prim_launcher" prim-pre-commit "$@" || :
|
|
22778
|
-
;;
|
|
22779
|
-
post-commit)
|
|
22780
|
-
prim_sha=$(git rev-parse --verify HEAD 2>/dev/null) || exit 0
|
|
22781
|
-
case "$prim_sha" in *[!0-9a-f]* | "") exit 0 ;; esac
|
|
22782
|
-
case "\${#prim_sha}" in 40 | 64) ;; *) exit 0 ;; esac
|
|
22783
|
-
prim_branch=$(git symbolic-ref --quiet --short HEAD 2>/dev/null) || prim_branch=
|
|
22784
|
-
prim_observed=$(mktemp "\${TMPDIR:-/tmp}/prim-post-commit-observed.XXXXXXXX" 2>/dev/null) || prim_observed=
|
|
22785
|
-
(
|
|
22786
|
-
trap '' HUP
|
|
22787
|
-
trap 'if [ -n "$prim_observed" ]; then rm -f "$prim_observed"; fi' 0
|
|
22788
|
-
PRIM_COMMIT_SHA=$prim_sha PRIM_COMMIT_BRANCH=$prim_branch PRIM_COMMIT_OBSERVED_FILE=$prim_observed "$prim_launcher" prim-post-commit
|
|
22789
|
-
) </dev/null >/dev/null 2>&1 &
|
|
22790
|
-
;;
|
|
22791
|
-
post-rewrite)
|
|
22792
|
-
case "\${1-}" in amend | rebase) prim_source=$1 ;; *) exit 0 ;; esac
|
|
22793
|
-
prim_pairs=$(mktemp "\${TMPDIR:-/tmp}/prim-post-rewrite-pairs.XXXXXXXX" 2>/dev/null) || exit 0
|
|
22794
|
-
if ! chmod 600 "$prim_pairs" 2>/dev/null || ! cat >"$prim_pairs"; then
|
|
22795
|
-
rm -f "$prim_pairs"
|
|
22796
|
-
exit 0
|
|
22797
|
-
fi
|
|
22798
|
-
prim_branch=$(git symbolic-ref --quiet --short HEAD 2>/dev/null) || prim_branch=
|
|
22799
|
-
(
|
|
22800
|
-
trap '' HUP
|
|
22801
|
-
trap 'rm -f "$prim_pairs"' 0
|
|
22802
|
-
PRIM_REWRITE_SOURCE=$prim_source PRIM_REWRITE_BRANCH=$prim_branch PRIM_REWRITE_PAIRS_FILE=$prim_pairs "$prim_launcher" prim-post-rewrite
|
|
22803
|
-
) </dev/null >/dev/null 2>&1 &
|
|
22804
|
-
;;
|
|
22805
|
-
esac
|
|
22806
|
-
exit 0
|
|
22807
|
-
`;
|
|
22808
|
-
|
|
22809
|
-
// src/lib/hook-runtime.ts
|
|
22810
|
-
var RELEASE_PREFIX = "release-";
|
|
22811
|
-
var MAX_MANIFEST_BYTES = 64 * 1024;
|
|
22812
|
-
var RELEASE_GRACE_MS = 10 * 60 * 1e3;
|
|
22813
|
-
var HOOK_RUNTIME_ENTRIES = {
|
|
22814
|
-
// SessionStart self-healing resolves this exact CLI entry to run
|
|
22815
|
-
// `daemon ensure`; it must travel with the immutable hook release.
|
|
22816
|
-
prim: "dist/index.js",
|
|
22817
|
-
"prim-hook": "dist/hooks/prim-hook.js",
|
|
22818
|
-
"prim-pre-commit": "dist/hooks/pre-commit.js",
|
|
22819
|
-
"prim-post-commit": "dist/hooks/post-commit.js",
|
|
22820
|
-
"prim-post-rewrite": "dist/hooks/post-rewrite.js",
|
|
22821
|
-
"prim-pre-tool-use": "dist/hooks/pre-tool-use.js",
|
|
22822
|
-
"prim-post-tool-use": "dist/hooks/post-tool-use.js",
|
|
22823
|
-
"prim-session-start": "dist/hooks/session-start.js",
|
|
22824
|
-
"prim-session-end": "dist/hooks/session-end.js",
|
|
22825
|
-
"prim-daemon-server": "dist/daemon/server.js",
|
|
22826
|
-
"prim-statusline": "dist/statusline-main.js"
|
|
22827
|
-
};
|
|
22828
|
-
var SOURCE_ENTRIES = Object.fromEntries(
|
|
22829
|
-
Object.entries(HOOK_RUNTIME_ENTRIES).map(([bin, target]) => [
|
|
22830
|
-
bin,
|
|
22831
|
-
target.replace(/^dist\//u, "")
|
|
22832
|
-
])
|
|
22833
|
-
);
|
|
22834
|
-
var STABLE_HOOK_LAUNCHER_CONTENT = `#!/bin/sh
|
|
22835
|
-
set -eu
|
|
22836
|
-
case "$0" in */*) prim_launcher_dir=\${0%/*} ;; *) exit 78 ;; esac
|
|
22837
|
-
IFS= read -r prim_release_name < "$prim_launcher_dir/hook-runtime/current" || exit 69
|
|
22838
|
-
case "$prim_release_name" in ${RELEASE_PREFIX}*) ;; *) exit 69 ;; esac
|
|
22839
|
-
prim_release_id=\${prim_release_name#${RELEASE_PREFIX}}
|
|
22840
|
-
case "$prim_release_id" in *[!0-9a-f]*|"") exit 69 ;; esac
|
|
22841
|
-
[ "\${#prim_release_id}" -eq 64 ] || exit 69
|
|
22842
|
-
prim_release="$prim_launcher_dir/hook-runtime/releases/$prim_release_name"
|
|
22843
|
-
case "\${1-}" in
|
|
22844
|
-
${Object.entries(HOOK_RUNTIME_ENTRIES).map(([bin, entry]) => ` ${bin}) prim_entry="$prim_release/${entry}" ;;`).join("\n")}
|
|
22845
|
-
*) exit 64 ;;
|
|
22846
|
-
esac
|
|
22847
|
-
shift
|
|
22848
|
-
IFS= read -r prim_node < "$prim_release/node" || exit 69
|
|
22849
|
-
case "$prim_node" in /*) ;; *) exit 69 ;; esac
|
|
22850
|
-
[ -x "$prim_node" ] && [ -f "$prim_entry" ] || exit 69
|
|
22851
|
-
exec "$prim_node" "$prim_entry" "$@"
|
|
22852
|
-
`;
|
|
22993
|
+
import { isAbsolute as isAbsolute6, join as join19 } from "path";
|
|
22853
22994
|
|
|
22854
22995
|
// src/commands/claude-install.ts
|
|
22855
|
-
import { existsSync as
|
|
22996
|
+
import { existsSync as existsSync13, readFileSync as readFileSync15 } from "fs";
|
|
22856
22997
|
import { homedir as homedir3 } from "os";
|
|
22857
|
-
import { join as
|
|
22998
|
+
import { join as join18 } from "path";
|
|
22858
22999
|
var CAPTURE_BIN = "prim-hook";
|
|
22859
23000
|
var GATE_BIN = "prim-pre-tool-use";
|
|
22860
23001
|
var POST_TOOL_USE_BIN = "prim-post-tool-use";
|
|
@@ -22863,7 +23004,7 @@ var SESSION_END_BIN = "prim-session-end";
|
|
|
22863
23004
|
var STATUSLINE_BIN = "prim-statusline";
|
|
22864
23005
|
var STATUSLINE_ARGS = "";
|
|
22865
23006
|
var STATUSLINE_COMMAND = stableHookCommand(STATUSLINE_BIN, STATUSLINE_ARGS);
|
|
22866
|
-
var USER_SCOPE_PATH =
|
|
23007
|
+
var USER_SCOPE_PATH = join18(homedir3(), ".claude", "settings.json");
|
|
22867
23008
|
function projectRoot() {
|
|
22868
23009
|
return gitToplevel() ?? process.cwd();
|
|
22869
23010
|
}
|
|
@@ -22942,17 +23083,17 @@ function cursorConfigDirectory(env = process.env, home = homedir4(), platform2 =
|
|
|
22942
23083
|
const explicit = env.CURSOR_CONFIG_DIR?.trim();
|
|
22943
23084
|
if (explicit && isAbsolute6(explicit)) return explicit;
|
|
22944
23085
|
const xdg = env.XDG_CONFIG_HOME?.trim();
|
|
22945
|
-
if (platform2 !== "darwin" && xdg && isAbsolute6(xdg)) return
|
|
22946
|
-
return
|
|
23086
|
+
if (platform2 !== "darwin" && xdg && isAbsolute6(xdg)) return join19(xdg, "cursor");
|
|
23087
|
+
return join19(home, ".cursor");
|
|
22947
23088
|
}
|
|
22948
23089
|
function cursorHooksPath(scope, root = projectRoot()) {
|
|
22949
|
-
return scope === "user" ?
|
|
23090
|
+
return scope === "user" ? join19(cursorConfigDirectory(), "hooks.json") : join19(root, ".cursor", "hooks.json");
|
|
22950
23091
|
}
|
|
22951
23092
|
function plainObject(value) {
|
|
22952
23093
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22953
23094
|
}
|
|
22954
23095
|
function readCursorHooks(path) {
|
|
22955
|
-
if (!
|
|
23096
|
+
if (!existsSync14(path)) return {};
|
|
22956
23097
|
let parsed;
|
|
22957
23098
|
try {
|
|
22958
23099
|
parsed = JSON.parse(readFileSync16(path, "utf8"));
|
|
@@ -23226,8 +23367,8 @@ function extractFileTargets(toolName, toolInput, agent = "claude_code") {
|
|
|
23226
23367
|
}
|
|
23227
23368
|
|
|
23228
23369
|
// src/hooks/redact.ts
|
|
23229
|
-
import { existsSync as
|
|
23230
|
-
import { join as
|
|
23370
|
+
import { existsSync as existsSync15, readFileSync as readFileSync17, statSync as statSync5 } from "fs";
|
|
23371
|
+
import { join as join20 } from "path";
|
|
23231
23372
|
import { Worker } from "worker_threads";
|
|
23232
23373
|
var USER_HOME_RULES = [
|
|
23233
23374
|
{
|
|
@@ -23303,8 +23444,8 @@ function normalizedWorkspaceFlags(value) {
|
|
|
23303
23444
|
return [...new Set(`g${requested}`)].sort().join("");
|
|
23304
23445
|
}
|
|
23305
23446
|
function loadWorkspaceRules(cwd) {
|
|
23306
|
-
const path =
|
|
23307
|
-
if (!
|
|
23447
|
+
const path = join20(cwd, WORKSPACE_FILE2);
|
|
23448
|
+
if (!existsSync15(path)) return [];
|
|
23308
23449
|
let cfg;
|
|
23309
23450
|
try {
|
|
23310
23451
|
if (statSync5(path).size > MAX_WORKSPACE_CONFIG_BYTES) {
|
|
@@ -28332,14 +28473,14 @@ function emitOutput(output, acknowledge) {
|
|
|
28332
28473
|
}
|
|
28333
28474
|
function resolveCliVersion() {
|
|
28334
28475
|
try {
|
|
28335
|
-
const pkg = JSON.parse(readFileSync18(
|
|
28476
|
+
const pkg = JSON.parse(readFileSync18(join21(here, "..", "..", "package.json"), "utf-8"));
|
|
28336
28477
|
return pkg.version ?? "unknown";
|
|
28337
28478
|
} catch {
|
|
28338
28479
|
return "unknown";
|
|
28339
28480
|
}
|
|
28340
28481
|
}
|
|
28341
28482
|
function spawnBackgroundFlush() {
|
|
28342
|
-
const entry =
|
|
28483
|
+
const entry = join21(here, "..", "index.js");
|
|
28343
28484
|
spawn(process.execPath, [entry, "moves", "flush"], {
|
|
28344
28485
|
detached: true,
|
|
28345
28486
|
stdio: "ignore",
|