@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
|
@@ -4963,7 +4963,7 @@ var require_rc = __commonJS({
|
|
|
4963
4963
|
"node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports, module) {
|
|
4964
4964
|
"use strict";
|
|
4965
4965
|
var cc = require_utils();
|
|
4966
|
-
var
|
|
4966
|
+
var join36 = __require("path").join;
|
|
4967
4967
|
var deepExtend = require_deep_extend();
|
|
4968
4968
|
var etc = "/etc";
|
|
4969
4969
|
var win = process.platform === "win32";
|
|
@@ -4988,15 +4988,15 @@ var require_rc = __commonJS({
|
|
|
4988
4988
|
}
|
|
4989
4989
|
if (!win)
|
|
4990
4990
|
[
|
|
4991
|
-
|
|
4992
|
-
|
|
4991
|
+
join36(etc, name, "config"),
|
|
4992
|
+
join36(etc, name + "rc")
|
|
4993
4993
|
].forEach(addConfigFile);
|
|
4994
4994
|
if (home)
|
|
4995
4995
|
[
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
4996
|
+
join36(home, ".config", name, "config"),
|
|
4997
|
+
join36(home, ".config", name),
|
|
4998
|
+
join36(home, "." + name, "config"),
|
|
4999
|
+
join36(home, "." + name + "rc")
|
|
5000
5000
|
].forEach(addConfigFile);
|
|
5001
5001
|
addConfigFile(cc.find("." + name + "rc"));
|
|
5002
5002
|
if (env4.config) addConfigFile(env4.config);
|
|
@@ -24435,8 +24435,9 @@ function validate43(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
24435
24435
|
}
|
|
24436
24436
|
validate43.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
24437
24437
|
var isDemoStatusResponse = validate44;
|
|
24438
|
-
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 };
|
|
24438
|
+
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 };
|
|
24439
24439
|
var func34 = Object.prototype.hasOwnProperty;
|
|
24440
|
+
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");
|
|
24440
24441
|
function validate44(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
24441
24442
|
;
|
|
24442
24443
|
let vErrors = null;
|
|
@@ -24452,7 +24453,7 @@ function validate44(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
24452
24453
|
if (errors === _errs0) {
|
|
24453
24454
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
24454
24455
|
let missing0;
|
|
24455
|
-
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")) {
|
|
24456
|
+
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")) {
|
|
24456
24457
|
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 + "'" }];
|
|
24457
24458
|
return false;
|
|
24458
24459
|
} else {
|
|
@@ -24592,110 +24593,202 @@ function validate44(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
24592
24593
|
var valid1 = true;
|
|
24593
24594
|
}
|
|
24594
24595
|
if (valid1) {
|
|
24595
|
-
if (data.
|
|
24596
|
-
let data7 = data.
|
|
24596
|
+
if (data.story !== void 0) {
|
|
24597
|
+
let data7 = data.story;
|
|
24597
24598
|
const _errs17 = errors;
|
|
24598
|
-
if (
|
|
24599
|
-
|
|
24600
|
-
|
|
24601
|
-
|
|
24602
|
-
|
|
24603
|
-
|
|
24604
|
-
|
|
24599
|
+
if (errors === _errs17) {
|
|
24600
|
+
if (data7 && typeof data7 == "object" && !Array.isArray(data7)) {
|
|
24601
|
+
let missing1;
|
|
24602
|
+
if (data7.orgName === void 0 && (missing1 = "orgName") || data7.recipient === void 0 && (missing1 = "recipient") || data7.decisionDate === void 0 && (missing1 = "decisionDate")) {
|
|
24603
|
+
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 + "'" }];
|
|
24604
|
+
return false;
|
|
24605
|
+
} else {
|
|
24606
|
+
const _errs19 = errors;
|
|
24607
|
+
for (const key1 in data7) {
|
|
24608
|
+
if (!(key1 === "orgName" || key1 === "recipient" || key1 === "decisionDate")) {
|
|
24609
|
+
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" }];
|
|
24610
|
+
return false;
|
|
24611
|
+
break;
|
|
24612
|
+
}
|
|
24613
|
+
}
|
|
24614
|
+
if (_errs19 === errors) {
|
|
24615
|
+
if (data7.orgName !== void 0) {
|
|
24616
|
+
let data8 = data7.orgName;
|
|
24617
|
+
const _errs20 = errors;
|
|
24618
|
+
if (errors === _errs20) {
|
|
24619
|
+
if (typeof data8 === "string") {
|
|
24620
|
+
if (func1(data8) > 200) {
|
|
24621
|
+
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" }];
|
|
24622
|
+
return false;
|
|
24623
|
+
}
|
|
24624
|
+
} else {
|
|
24625
|
+
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" }];
|
|
24626
|
+
return false;
|
|
24627
|
+
}
|
|
24628
|
+
}
|
|
24629
|
+
var valid2 = _errs20 === errors;
|
|
24630
|
+
} else {
|
|
24631
|
+
var valid2 = true;
|
|
24632
|
+
}
|
|
24633
|
+
if (valid2) {
|
|
24634
|
+
if (data7.recipient !== void 0) {
|
|
24635
|
+
let data9 = data7.recipient;
|
|
24636
|
+
const _errs22 = errors;
|
|
24637
|
+
if (errors === _errs22) {
|
|
24638
|
+
if (errors === _errs22) {
|
|
24639
|
+
if (typeof data9 === "string") {
|
|
24640
|
+
if (!pattern12.test(data9)) {
|
|
24641
|
+
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,}$"` }];
|
|
24642
|
+
return false;
|
|
24643
|
+
}
|
|
24644
|
+
} else {
|
|
24645
|
+
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" }];
|
|
24646
|
+
return false;
|
|
24647
|
+
}
|
|
24648
|
+
}
|
|
24649
|
+
}
|
|
24650
|
+
var valid2 = _errs22 === errors;
|
|
24651
|
+
} else {
|
|
24652
|
+
var valid2 = true;
|
|
24653
|
+
}
|
|
24654
|
+
if (valid2) {
|
|
24655
|
+
if (data7.decisionDate !== void 0) {
|
|
24656
|
+
let data10 = data7.decisionDate;
|
|
24657
|
+
const _errs24 = errors;
|
|
24658
|
+
if (errors === _errs24) {
|
|
24659
|
+
if (typeof data10 === "string") {
|
|
24660
|
+
if (func1(data10) > 100) {
|
|
24661
|
+
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" }];
|
|
24662
|
+
return false;
|
|
24663
|
+
}
|
|
24664
|
+
} else {
|
|
24665
|
+
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" }];
|
|
24666
|
+
return false;
|
|
24667
|
+
}
|
|
24668
|
+
}
|
|
24669
|
+
var valid2 = _errs24 === errors;
|
|
24670
|
+
} else {
|
|
24671
|
+
var valid2 = true;
|
|
24672
|
+
}
|
|
24673
|
+
}
|
|
24674
|
+
}
|
|
24675
|
+
}
|
|
24676
|
+
}
|
|
24677
|
+
} else {
|
|
24678
|
+
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" }];
|
|
24679
|
+
return false;
|
|
24680
|
+
}
|
|
24605
24681
|
}
|
|
24606
24682
|
var valid1 = _errs17 === errors;
|
|
24607
24683
|
} else {
|
|
24608
24684
|
var valid1 = true;
|
|
24609
24685
|
}
|
|
24610
24686
|
if (valid1) {
|
|
24611
|
-
if (data.
|
|
24612
|
-
let
|
|
24613
|
-
const
|
|
24614
|
-
if (typeof
|
|
24615
|
-
validate44.errors = [{ instancePath: instancePath + "/
|
|
24687
|
+
if (data.email !== void 0) {
|
|
24688
|
+
let data11 = data.email;
|
|
24689
|
+
const _errs26 = errors;
|
|
24690
|
+
if (typeof data11 !== "string") {
|
|
24691
|
+
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" }];
|
|
24616
24692
|
return false;
|
|
24617
24693
|
}
|
|
24618
|
-
if (!(
|
|
24619
|
-
validate44.errors = [{ instancePath: instancePath + "/
|
|
24694
|
+
if (!(data11 === "not_queued" || data11 === "queued" || data11 === "accepted" || data11 === "failed" || data11 === "suppressed")) {
|
|
24695
|
+
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" }];
|
|
24620
24696
|
return false;
|
|
24621
24697
|
}
|
|
24622
|
-
var valid1 =
|
|
24698
|
+
var valid1 = _errs26 === errors;
|
|
24623
24699
|
} else {
|
|
24624
24700
|
var valid1 = true;
|
|
24625
24701
|
}
|
|
24626
24702
|
if (valid1) {
|
|
24627
|
-
if (data.
|
|
24628
|
-
let
|
|
24629
|
-
const
|
|
24630
|
-
if (
|
|
24631
|
-
|
|
24632
|
-
|
|
24633
|
-
|
|
24634
|
-
|
|
24635
|
-
|
|
24636
|
-
|
|
24637
|
-
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" }];
|
|
24638
|
-
return false;
|
|
24639
|
-
}
|
|
24703
|
+
if (data.verdict !== void 0) {
|
|
24704
|
+
let data12 = data.verdict;
|
|
24705
|
+
const _errs28 = errors;
|
|
24706
|
+
if (typeof data12 !== "string") {
|
|
24707
|
+
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" }];
|
|
24708
|
+
return false;
|
|
24709
|
+
}
|
|
24710
|
+
if (!(data12 === "block" || data12 === "pass" || data12 === "pending")) {
|
|
24711
|
+
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" }];
|
|
24712
|
+
return false;
|
|
24640
24713
|
}
|
|
24641
|
-
var valid1 =
|
|
24714
|
+
var valid1 = _errs28 === errors;
|
|
24642
24715
|
} else {
|
|
24643
24716
|
var valid1 = true;
|
|
24644
24717
|
}
|
|
24645
24718
|
if (valid1) {
|
|
24646
|
-
if (data.
|
|
24647
|
-
let
|
|
24648
|
-
const
|
|
24649
|
-
if (
|
|
24650
|
-
|
|
24651
|
-
|
|
24652
|
-
|
|
24653
|
-
|
|
24654
|
-
|
|
24655
|
-
|
|
24719
|
+
if (data.reasonCode !== void 0) {
|
|
24720
|
+
let data13 = data.reasonCode;
|
|
24721
|
+
const _errs30 = errors;
|
|
24722
|
+
if (errors === _errs30) {
|
|
24723
|
+
if (typeof data13 === "string") {
|
|
24724
|
+
if (func1(data13) > 100) {
|
|
24725
|
+
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" }];
|
|
24726
|
+
return false;
|
|
24727
|
+
}
|
|
24728
|
+
} else {
|
|
24729
|
+
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" }];
|
|
24730
|
+
return false;
|
|
24731
|
+
}
|
|
24656
24732
|
}
|
|
24657
|
-
var valid1 =
|
|
24733
|
+
var valid1 = _errs30 === errors;
|
|
24658
24734
|
} else {
|
|
24659
24735
|
var valid1 = true;
|
|
24660
24736
|
}
|
|
24661
24737
|
if (valid1) {
|
|
24662
|
-
if (data.
|
|
24663
|
-
let
|
|
24664
|
-
const
|
|
24665
|
-
if (
|
|
24666
|
-
|
|
24667
|
-
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
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" }];
|
|
24673
|
-
return false;
|
|
24674
|
-
}
|
|
24738
|
+
if (data.choice !== void 0) {
|
|
24739
|
+
let data14 = data.choice;
|
|
24740
|
+
const _errs32 = errors;
|
|
24741
|
+
if (typeof data14 !== "string") {
|
|
24742
|
+
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" }];
|
|
24743
|
+
return false;
|
|
24744
|
+
}
|
|
24745
|
+
if (!(data14 === "adhere" || data14 === "supersede")) {
|
|
24746
|
+
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" }];
|
|
24747
|
+
return false;
|
|
24675
24748
|
}
|
|
24676
|
-
var valid1 =
|
|
24749
|
+
var valid1 = _errs32 === errors;
|
|
24677
24750
|
} else {
|
|
24678
24751
|
var valid1 = true;
|
|
24679
24752
|
}
|
|
24680
24753
|
if (valid1) {
|
|
24681
|
-
if (data.
|
|
24682
|
-
let
|
|
24683
|
-
const
|
|
24684
|
-
if (errors ===
|
|
24685
|
-
if (typeof
|
|
24686
|
-
if (
|
|
24687
|
-
validate44.errors = [{ instancePath: instancePath + "/
|
|
24754
|
+
if (data.reason !== void 0) {
|
|
24755
|
+
let data15 = data.reason;
|
|
24756
|
+
const _errs34 = errors;
|
|
24757
|
+
if (errors === _errs34) {
|
|
24758
|
+
if (typeof data15 === "string") {
|
|
24759
|
+
if (func1(data15) > 500) {
|
|
24760
|
+
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" }];
|
|
24688
24761
|
return false;
|
|
24689
24762
|
}
|
|
24690
24763
|
} else {
|
|
24691
|
-
validate44.errors = [{ instancePath: instancePath + "/
|
|
24764
|
+
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" }];
|
|
24692
24765
|
return false;
|
|
24693
24766
|
}
|
|
24694
24767
|
}
|
|
24695
|
-
var valid1 =
|
|
24768
|
+
var valid1 = _errs34 === errors;
|
|
24696
24769
|
} else {
|
|
24697
24770
|
var valid1 = true;
|
|
24698
24771
|
}
|
|
24772
|
+
if (valid1) {
|
|
24773
|
+
if (data.approvedDigest !== void 0) {
|
|
24774
|
+
let data16 = data.approvedDigest;
|
|
24775
|
+
const _errs36 = errors;
|
|
24776
|
+
if (errors === _errs36) {
|
|
24777
|
+
if (typeof data16 === "string") {
|
|
24778
|
+
if (!pattern5.test(data16)) {
|
|
24779
|
+
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}$"' }];
|
|
24780
|
+
return false;
|
|
24781
|
+
}
|
|
24782
|
+
} else {
|
|
24783
|
+
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" }];
|
|
24784
|
+
return false;
|
|
24785
|
+
}
|
|
24786
|
+
}
|
|
24787
|
+
var valid1 = _errs36 === errors;
|
|
24788
|
+
} else {
|
|
24789
|
+
var valid1 = true;
|
|
24790
|
+
}
|
|
24791
|
+
}
|
|
24699
24792
|
}
|
|
24700
24793
|
}
|
|
24701
24794
|
}
|
|
@@ -25586,7 +25679,7 @@ function validate48(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
25586
25679
|
}
|
|
25587
25680
|
validate48.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
25588
25681
|
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"] };
|
|
25589
|
-
var
|
|
25682
|
+
var pattern14 = new RegExp("^[0-9a-f]{8}$", "u");
|
|
25590
25683
|
function validate49(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
25591
25684
|
;
|
|
25592
25685
|
let vErrors = null;
|
|
@@ -25925,7 +26018,7 @@ function validate49(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
25925
26018
|
const _errs27 = errors;
|
|
25926
26019
|
if (errors === _errs27) {
|
|
25927
26020
|
if (typeof data9 === "string") {
|
|
25928
|
-
if (!
|
|
26021
|
+
if (!pattern14.test(data9)) {
|
|
25929
26022
|
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}$"' };
|
|
25930
26023
|
if (vErrors === null) {
|
|
25931
26024
|
vErrors = [err24];
|
|
@@ -26983,8 +27076,8 @@ function validate51(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
26983
27076
|
}
|
|
26984
27077
|
validate51.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
26985
27078
|
var isGitHubInstallIntentStartResponse = validate52;
|
|
26986
|
-
var
|
|
26987
|
-
var
|
|
27079
|
+
var pattern15 = new RegExp("^[A-Za-z0-9]{1,128}$", "u");
|
|
27080
|
+
var pattern16 = new RegExp("^https:\\/\\/github\\.com\\/apps\\/primitive(?:-staging)?\\/installations\\/new\\?state=[0-9a-f]{64}$", "u");
|
|
26988
27081
|
function validate52(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
26989
27082
|
;
|
|
26990
27083
|
let vErrors = null;
|
|
@@ -27066,7 +27159,7 @@ function validate52(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
27066
27159
|
const _errs9 = errors;
|
|
27067
27160
|
if (errors === _errs9) {
|
|
27068
27161
|
if (typeof data3 === "string") {
|
|
27069
|
-
if (!
|
|
27162
|
+
if (!pattern15.test(data3)) {
|
|
27070
27163
|
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}$"' }];
|
|
27071
27164
|
return false;
|
|
27072
27165
|
}
|
|
@@ -27085,7 +27178,7 @@ function validate52(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
27085
27178
|
const _errs11 = errors;
|
|
27086
27179
|
if (errors === _errs11) {
|
|
27087
27180
|
if (typeof data4 === "string") {
|
|
27088
|
-
if (!
|
|
27181
|
+
if (!pattern16.test(data4)) {
|
|
27089
27182
|
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}$"' }];
|
|
27090
27183
|
return false;
|
|
27091
27184
|
}
|
|
@@ -27493,7 +27586,7 @@ function validate54(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
27493
27586
|
const _errs3 = errors;
|
|
27494
27587
|
if (errors === _errs3) {
|
|
27495
27588
|
if (typeof data0 === "string") {
|
|
27496
|
-
if (!
|
|
27589
|
+
if (!pattern15.test(data0)) {
|
|
27497
27590
|
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}$"' }];
|
|
27498
27591
|
return false;
|
|
27499
27592
|
}
|
|
@@ -29067,7 +29160,7 @@ function validate55(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
29067
29160
|
validate55.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
29068
29161
|
var isMoveIngestRequest = validate56;
|
|
29069
29162
|
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": {} };
|
|
29070
|
-
var
|
|
29163
|
+
var pattern18 = new RegExp("^[A-Za-z0-9_-]+$", "u");
|
|
29071
29164
|
function validate56(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
29072
29165
|
;
|
|
29073
29166
|
let vErrors = null;
|
|
@@ -29428,7 +29521,7 @@ function validate56(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
29428
29521
|
}
|
|
29429
29522
|
errors++;
|
|
29430
29523
|
} else {
|
|
29431
|
-
if (!
|
|
29524
|
+
if (!pattern18.test(data11)) {
|
|
29432
29525
|
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_-]+$"' };
|
|
29433
29526
|
if (vErrors === null) {
|
|
29434
29527
|
vErrors = [err22];
|
|
@@ -29953,7 +30046,7 @@ function validate56(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
29953
30046
|
}
|
|
29954
30047
|
errors++;
|
|
29955
30048
|
} else {
|
|
29956
|
-
if (!
|
|
30049
|
+
if (!pattern18.test(data26)) {
|
|
29957
30050
|
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_-]+$"' };
|
|
29958
30051
|
if (vErrors === null) {
|
|
29959
30052
|
vErrors = [err58];
|
|
@@ -30196,10 +30289,10 @@ function validate56(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
30196
30289
|
}
|
|
30197
30290
|
validate56.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
30198
30291
|
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"] };
|
|
30199
|
-
var
|
|
30200
|
-
var
|
|
30201
|
-
var
|
|
30202
|
-
var
|
|
30292
|
+
var pattern20 = new RegExp("^[A-Za-z0-9._:-]{1,128}$", "u");
|
|
30293
|
+
var pattern22 = new RegExp("^[A-Za-z0-9]{1,64}$", "u");
|
|
30294
|
+
var pattern23 = new RegExp("^(?!@?$)(?!\\/)(?!.*\\/$)(?!.*\\/\\/)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)[^/]*\\.lock(?:\\/|$))(?!.*\\.\\.)(?!.*@\\{)(?!.*[~^:?*\\\\]).+$", "u");
|
|
30295
|
+
var pattern24 = new RegExp("^[A-Za-z0-9][A-Za-z0-9._+-]*$", "u");
|
|
30203
30296
|
function validate57(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
30204
30297
|
;
|
|
30205
30298
|
let vErrors = null;
|
|
@@ -30265,7 +30358,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
30265
30358
|
const _errs8 = errors;
|
|
30266
30359
|
if (errors === _errs8) {
|
|
30267
30360
|
if (typeof data2 === "string") {
|
|
30268
|
-
if (!
|
|
30361
|
+
if (!pattern20.test(data2)) {
|
|
30269
30362
|
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}$"' }];
|
|
30270
30363
|
return false;
|
|
30271
30364
|
}
|
|
@@ -30284,7 +30377,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
30284
30377
|
const _errs10 = errors;
|
|
30285
30378
|
if (errors === _errs10) {
|
|
30286
30379
|
if (typeof data3 === "string") {
|
|
30287
|
-
if (!
|
|
30380
|
+
if (!pattern20.test(data3)) {
|
|
30288
30381
|
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}$"' }];
|
|
30289
30382
|
return false;
|
|
30290
30383
|
}
|
|
@@ -30303,7 +30396,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
30303
30396
|
const _errs12 = errors;
|
|
30304
30397
|
if (errors === _errs12) {
|
|
30305
30398
|
if (typeof data4 === "string") {
|
|
30306
|
-
if (!
|
|
30399
|
+
if (!pattern22.test(data4)) {
|
|
30307
30400
|
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}$"' }];
|
|
30308
30401
|
return false;
|
|
30309
30402
|
}
|
|
@@ -30375,7 +30468,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
30375
30468
|
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" }];
|
|
30376
30469
|
return false;
|
|
30377
30470
|
} else {
|
|
30378
|
-
if (!
|
|
30471
|
+
if (!pattern23.test(data8)) {
|
|
30379
30472
|
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(?:\\/|$))(?!.*\\.\\.)(?!.*@\\{)(?!.*[~^:?*\\\\]).+$"' }];
|
|
30380
30473
|
return false;
|
|
30381
30474
|
}
|
|
@@ -30415,7 +30508,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
30415
30508
|
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" }];
|
|
30416
30509
|
return false;
|
|
30417
30510
|
} else {
|
|
30418
|
-
if (!
|
|
30511
|
+
if (!pattern24.test(data10)) {
|
|
30419
30512
|
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._+-]*$"' }];
|
|
30420
30513
|
return false;
|
|
30421
30514
|
}
|
|
@@ -30502,7 +30595,7 @@ function validate58(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
30502
30595
|
const _errs5 = errors;
|
|
30503
30596
|
if (errors === _errs5) {
|
|
30504
30597
|
if (typeof data1 === "string") {
|
|
30505
|
-
if (!
|
|
30598
|
+
if (!pattern20.test(data1)) {
|
|
30506
30599
|
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}$"' }];
|
|
30507
30600
|
return false;
|
|
30508
30601
|
}
|
|
@@ -30799,8 +30892,8 @@ function validate58(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
30799
30892
|
return errors === 0;
|
|
30800
30893
|
}
|
|
30801
30894
|
validate58.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
30802
|
-
var
|
|
30803
|
-
var
|
|
30895
|
+
var pattern26 = new RegExp("^[A-Za-z0-9._-]{1,128}$", "u");
|
|
30896
|
+
var pattern27 = new RegExp("^pci_[A-Za-z0-9_-]{43}$", "u");
|
|
30804
30897
|
function validate59(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
30805
30898
|
;
|
|
30806
30899
|
let vErrors = null;
|
|
@@ -30825,7 +30918,7 @@ function validate59(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
30825
30918
|
const _errs3 = errors;
|
|
30826
30919
|
if (errors === _errs3) {
|
|
30827
30920
|
if (typeof data0 === "string") {
|
|
30828
|
-
if (!
|
|
30921
|
+
if (!pattern26.test(data0)) {
|
|
30829
30922
|
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}$"' }];
|
|
30830
30923
|
return false;
|
|
30831
30924
|
}
|
|
@@ -30844,7 +30937,7 @@ function validate59(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
30844
30937
|
const _errs5 = errors;
|
|
30845
30938
|
if (errors === _errs5) {
|
|
30846
30939
|
if (typeof data1 === "string") {
|
|
30847
|
-
if (!
|
|
30940
|
+
if (!pattern27.test(data1)) {
|
|
30848
30941
|
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}$"' }];
|
|
30849
30942
|
return false;
|
|
30850
30943
|
}
|
|
@@ -31508,7 +31601,7 @@ function validate62(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
31508
31601
|
return errors === 0;
|
|
31509
31602
|
}
|
|
31510
31603
|
validate62.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
31511
|
-
var
|
|
31604
|
+
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");
|
|
31512
31605
|
function validate63(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
31513
31606
|
;
|
|
31514
31607
|
let vErrors = null;
|
|
@@ -31542,7 +31635,7 @@ function validate63(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
31542
31635
|
const _errs3 = errors;
|
|
31543
31636
|
if (errors === _errs3) {
|
|
31544
31637
|
if (typeof data0 === "string") {
|
|
31545
|
-
if (!
|
|
31638
|
+
if (!pattern28.test(data0)) {
|
|
31546
31639
|
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}$"' }];
|
|
31547
31640
|
return false;
|
|
31548
31641
|
}
|
|
@@ -31607,7 +31700,7 @@ function validate64(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
31607
31700
|
return errors === 0;
|
|
31608
31701
|
}
|
|
31609
31702
|
validate64.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
31610
|
-
var
|
|
31703
|
+
var pattern30 = new RegExp("^api_key_[A-Za-z0-9_-]+$", "u");
|
|
31611
31704
|
function validate65(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
31612
31705
|
;
|
|
31613
31706
|
let vErrors = null;
|
|
@@ -31693,7 +31786,7 @@ function validate65(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
31693
31786
|
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" }];
|
|
31694
31787
|
return false;
|
|
31695
31788
|
} else {
|
|
31696
|
-
if (!
|
|
31789
|
+
if (!pattern30.test(data2)) {
|
|
31697
31790
|
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_-]+$"' }];
|
|
31698
31791
|
return false;
|
|
31699
31792
|
}
|
|
@@ -31721,9 +31814,9 @@ function validate65(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
31721
31814
|
return errors === 0;
|
|
31722
31815
|
}
|
|
31723
31816
|
validate65.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
31724
|
-
var
|
|
31725
|
-
var
|
|
31726
|
-
var
|
|
31817
|
+
var pattern32 = new RegExp("^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$", "u");
|
|
31818
|
+
var pattern33 = new RegExp("^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$", "u");
|
|
31819
|
+
var pattern34 = new RegExp("^[\\x21-\\x7e]+$", "u");
|
|
31727
31820
|
function validate66(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
31728
31821
|
;
|
|
31729
31822
|
let vErrors = null;
|
|
@@ -31795,7 +31888,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
31795
31888
|
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" }];
|
|
31796
31889
|
return false;
|
|
31797
31890
|
} else {
|
|
31798
|
-
if (!
|
|
31891
|
+
if (!pattern30.test(data2)) {
|
|
31799
31892
|
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_-]+$"' }];
|
|
31800
31893
|
return false;
|
|
31801
31894
|
}
|
|
@@ -31824,7 +31917,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
31824
31917
|
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" }];
|
|
31825
31918
|
return false;
|
|
31826
31919
|
} else {
|
|
31827
|
-
if (!
|
|
31920
|
+
if (!pattern32.test(data3)) {
|
|
31828
31921
|
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])?$"' }];
|
|
31829
31922
|
return false;
|
|
31830
31923
|
}
|
|
@@ -31853,7 +31946,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
31853
31946
|
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" }];
|
|
31854
31947
|
return false;
|
|
31855
31948
|
} else {
|
|
31856
|
-
if (!
|
|
31949
|
+
if (!pattern33.test(data4)) {
|
|
31857
31950
|
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]+$"' }];
|
|
31858
31951
|
return false;
|
|
31859
31952
|
}
|
|
@@ -31893,7 +31986,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
31893
31986
|
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" }];
|
|
31894
31987
|
return false;
|
|
31895
31988
|
} else {
|
|
31896
|
-
if (!
|
|
31989
|
+
if (!pattern34.test(data6)) {
|
|
31897
31990
|
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]+$"' }];
|
|
31898
31991
|
return false;
|
|
31899
31992
|
}
|
|
@@ -32179,7 +32272,7 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
32179
32272
|
}
|
|
32180
32273
|
errors++;
|
|
32181
32274
|
} else {
|
|
32182
|
-
if (!
|
|
32275
|
+
if (!pattern30.test(data11)) {
|
|
32183
32276
|
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_-]+$"' };
|
|
32184
32277
|
if (vErrors === null) {
|
|
32185
32278
|
vErrors = [err12];
|
|
@@ -32291,7 +32384,7 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
32291
32384
|
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" }];
|
|
32292
32385
|
return false;
|
|
32293
32386
|
} else {
|
|
32294
|
-
if (!
|
|
32387
|
+
if (!pattern30.test(data0)) {
|
|
32295
32388
|
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_-]+$"' }];
|
|
32296
32389
|
return false;
|
|
32297
32390
|
}
|
|
@@ -32320,7 +32413,7 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
32320
32413
|
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" }];
|
|
32321
32414
|
return false;
|
|
32322
32415
|
} else {
|
|
32323
|
-
if (!
|
|
32416
|
+
if (!pattern32.test(data1)) {
|
|
32324
32417
|
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])?$"' }];
|
|
32325
32418
|
return false;
|
|
32326
32419
|
}
|
|
@@ -32349,7 +32442,7 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
32349
32442
|
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" }];
|
|
32350
32443
|
return false;
|
|
32351
32444
|
} else {
|
|
32352
|
-
if (!
|
|
32445
|
+
if (!pattern33.test(data2)) {
|
|
32353
32446
|
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]+$"' }];
|
|
32354
32447
|
return false;
|
|
32355
32448
|
}
|
|
@@ -32389,7 +32482,7 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
32389
32482
|
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" }];
|
|
32390
32483
|
return false;
|
|
32391
32484
|
} else {
|
|
32392
|
-
if (!
|
|
32485
|
+
if (!pattern34.test(data4)) {
|
|
32393
32486
|
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]+$"' }];
|
|
32394
32487
|
return false;
|
|
32395
32488
|
}
|
|
@@ -32697,7 +32790,7 @@ function validate68(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
32697
32790
|
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" }];
|
|
32698
32791
|
return false;
|
|
32699
32792
|
} else {
|
|
32700
|
-
if (!
|
|
32793
|
+
if (!pattern32.test(data1)) {
|
|
32701
32794
|
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])?$"' }];
|
|
32702
32795
|
return false;
|
|
32703
32796
|
}
|
|
@@ -32750,7 +32843,7 @@ function validate68(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
32750
32843
|
return errors === 0;
|
|
32751
32844
|
}
|
|
32752
32845
|
validate68.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
32753
|
-
var
|
|
32846
|
+
var pattern46 = new RegExp("^sk_[\\x21-\\x7e]+(?: [\\x21-\\x7e]+)*$", "u");
|
|
32754
32847
|
function validate69(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
32755
32848
|
;
|
|
32756
32849
|
let vErrors = null;
|
|
@@ -32811,7 +32904,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
32811
32904
|
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" }];
|
|
32812
32905
|
return false;
|
|
32813
32906
|
} else {
|
|
32814
|
-
if (!
|
|
32907
|
+
if (!pattern30.test(data1)) {
|
|
32815
32908
|
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_-]+$"' }];
|
|
32816
32909
|
return false;
|
|
32817
32910
|
}
|
|
@@ -32840,7 +32933,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
32840
32933
|
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" }];
|
|
32841
32934
|
return false;
|
|
32842
32935
|
} else {
|
|
32843
|
-
if (!
|
|
32936
|
+
if (!pattern32.test(data2)) {
|
|
32844
32937
|
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])?$"' }];
|
|
32845
32938
|
return false;
|
|
32846
32939
|
}
|
|
@@ -32869,7 +32962,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
32869
32962
|
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" }];
|
|
32870
32963
|
return false;
|
|
32871
32964
|
} else {
|
|
32872
|
-
if (!
|
|
32965
|
+
if (!pattern33.test(data3)) {
|
|
32873
32966
|
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]+$"' }];
|
|
32874
32967
|
return false;
|
|
32875
32968
|
}
|
|
@@ -32909,7 +33002,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
32909
33002
|
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" }];
|
|
32910
33003
|
return false;
|
|
32911
33004
|
} else {
|
|
32912
|
-
if (!
|
|
33005
|
+
if (!pattern34.test(data5)) {
|
|
32913
33006
|
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]+$"' }];
|
|
32914
33007
|
return false;
|
|
32915
33008
|
}
|
|
@@ -33171,7 +33264,7 @@ function validate69(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
33171
33264
|
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" }];
|
|
33172
33265
|
return false;
|
|
33173
33266
|
} else {
|
|
33174
|
-
if (!
|
|
33267
|
+
if (!pattern46.test(data10)) {
|
|
33175
33268
|
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]+)*$"' }];
|
|
33176
33269
|
return false;
|
|
33177
33270
|
}
|
|
@@ -33293,7 +33386,7 @@ function validate71(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
33293
33386
|
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" }];
|
|
33294
33387
|
return false;
|
|
33295
33388
|
} else {
|
|
33296
|
-
if (!
|
|
33389
|
+
if (!pattern30.test(data0)) {
|
|
33297
33390
|
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_-]+$"' }];
|
|
33298
33391
|
return false;
|
|
33299
33392
|
}
|
|
@@ -33557,7 +33650,7 @@ function validate73(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
33557
33650
|
}
|
|
33558
33651
|
validate73.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
33559
33652
|
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"] };
|
|
33560
|
-
var
|
|
33653
|
+
var pattern49 = new RegExp("^client_[A-Za-z0-9_-]+$", "u");
|
|
33561
33654
|
function validate74(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
33562
33655
|
;
|
|
33563
33656
|
let vErrors = null;
|
|
@@ -33626,7 +33719,7 @@ function validate74(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
33626
33719
|
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" }];
|
|
33627
33720
|
return false;
|
|
33628
33721
|
} else {
|
|
33629
|
-
if (!
|
|
33722
|
+
if (!pattern49.test(data2)) {
|
|
33630
33723
|
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_-]+$"' }];
|
|
33631
33724
|
return false;
|
|
33632
33725
|
}
|
|
@@ -38542,14 +38635,24 @@ function registerCodexCommands(program3) {
|
|
|
38542
38635
|
});
|
|
38543
38636
|
codex.command("status").description("Report whether each prim surface (gate, capture) is installed per scope").action(() => {
|
|
38544
38637
|
const result = performStatus2();
|
|
38638
|
+
const readiness = {
|
|
38639
|
+
configured: result.user.complete || result.project.complete,
|
|
38640
|
+
runtime: inspectHookRuntime(),
|
|
38641
|
+
trust: "unknown",
|
|
38642
|
+
hookExecution: "not-verified",
|
|
38643
|
+
passiveCapture: "not-verified"
|
|
38644
|
+
};
|
|
38545
38645
|
const mark = (b) => b ? "\u2713" : "\u2717";
|
|
38546
|
-
const line = (label2, s) => `[prim] ${label2}: gate ${mark(s.gate)} \xB7 capture ${mark(s.capture)} (${s.path})`;
|
|
38646
|
+
const line = (label2, s) => `[prim] ${label2}: ${!s.present ? "not installed (optional when another scope is complete)" : `configured gate ${mark(s.gate)} \xB7 capture ${mark(s.capture)}`} (${s.path})`;
|
|
38547
38647
|
console.error(`${line("user", result.user)}
|
|
38548
38648
|
${line("project", result.project)}`);
|
|
38549
38649
|
const uncovered = uncoveredWorktreeHooks(result);
|
|
38550
38650
|
if (uncovered !== null)
|
|
38551
38651
|
console.error(`[prim] warning: ${uncoveredWorktreeAdvice(uncovered)}`);
|
|
38552
|
-
console.
|
|
38652
|
+
console.error(
|
|
38653
|
+
"[prim] Configuration is not proof of hook execution or capture. Use the pending tour\u2019s diagnosticAction to check isolation."
|
|
38654
|
+
);
|
|
38655
|
+
console.log(JSON.stringify({ ...result, readiness }, null, JSON_INDENT2));
|
|
38553
38656
|
});
|
|
38554
38657
|
}
|
|
38555
38658
|
|
|
@@ -43974,60 +44077,9 @@ function validate3(value) {
|
|
|
43974
44077
|
return value;
|
|
43975
44078
|
}
|
|
43976
44079
|
|
|
43977
|
-
// src/demo/
|
|
43978
|
-
import {
|
|
43979
|
-
|
|
43980
|
-
lstatSync as lstatSync9,
|
|
43981
|
-
mkdtempSync as mkdtempSync3,
|
|
43982
|
-
readFileSync as readFileSync17,
|
|
43983
|
-
readdirSync as readdirSync6,
|
|
43984
|
-
realpathSync as realpathSync5,
|
|
43985
|
-
rmdirSync,
|
|
43986
|
-
unlinkSync as unlinkSync5
|
|
43987
|
-
} from "fs";
|
|
43988
|
-
import { tmpdir } from "os";
|
|
43989
|
-
import { basename as basename4, dirname as dirname11, join as join22 } from "path";
|
|
43990
|
-
|
|
43991
|
-
// src/demo/scenario.ts
|
|
43992
|
-
var SAMPLE_NOTE = [
|
|
43993
|
-
"Fictional engineering conversation:",
|
|
43994
|
-
"Maya: Could we call fetch directly for the order service?",
|
|
43995
|
-
"Ravi: Use the shared HTTP client for service calls. We need retries and request tracing to stay consistent.",
|
|
43996
|
-
"Maya: Agreed. Let's reject direct fetch calls because they duplicate that policy.",
|
|
43997
|
-
"Ravi: Also, the team demo is at three."
|
|
43998
|
-
].join("\n");
|
|
43999
|
-
var SAMPLE_DECISIONS = [
|
|
44000
|
-
{
|
|
44001
|
-
id: "demo-http-client",
|
|
44002
|
-
decision: "Use the shared HTTP client for service calls",
|
|
44003
|
-
stage: "provisional",
|
|
44004
|
-
source: "Fictional engineering conversation",
|
|
44005
|
-
evidence: [
|
|
44006
|
-
"Use the shared HTTP client for service calls. We need retries and request tracing to stay consistent.",
|
|
44007
|
-
"Let's reject direct fetch calls because they duplicate that policy."
|
|
44008
|
-
],
|
|
44009
|
-
rationale: "Centralize retries and request tracing.",
|
|
44010
|
-
files: ["service.ts"],
|
|
44011
|
-
scopeBasis: "Demo mapping from service calls to service.ts; the conversation names no file.",
|
|
44012
|
-
alternativesRejected: ["Direct fetch calls with duplicated retry and tracing policy"]
|
|
44013
|
-
},
|
|
44014
|
-
{
|
|
44015
|
-
id: "demo-order-repository",
|
|
44016
|
-
decision: "Persist orders through the shared order repository",
|
|
44017
|
-
stage: "adopted",
|
|
44018
|
-
source: "User confirmation of this fictional proposal",
|
|
44019
|
-
rationale: "Keep validation and persistence consistent across order writers.",
|
|
44020
|
-
files: ["orders.ts"],
|
|
44021
|
-
alternativesRejected: ["Direct local-storage writes that bypass repository validation"]
|
|
44022
|
-
}
|
|
44023
|
-
];
|
|
44024
|
-
var SAMPLE_FILES = {
|
|
44025
|
-
"service.ts": 'import { http } from "./shared";\nexport const loadOrders = () => http.get("/orders");\n',
|
|
44026
|
-
"orders.ts": "export const saveOrder = (_order: unknown) => {\n // TODO: persist this order.\n};\n",
|
|
44027
|
-
"shared.ts": "// Fictional interfaces; this tour does not execute network or storage operations.\nexport declare const http: { get(path: string): Promise<unknown> };\nexport declare const orders: { save(order: unknown): void };\n"
|
|
44028
|
-
};
|
|
44029
|
-
var WARNING_EDIT = 'export const loadOrders = () => fetch("/orders");\n';
|
|
44030
|
-
var REPOSITORY_EDIT = 'import { orders } from "./shared";\nexport const saveOrder = (order: unknown) => orders.save(order);\n';
|
|
44080
|
+
// src/demo/diagnostics.ts
|
|
44081
|
+
import { existsSync as existsSync14 } from "fs";
|
|
44082
|
+
import { join as join22 } from "path";
|
|
44031
44083
|
|
|
44032
44084
|
// src/demo/state.ts
|
|
44033
44085
|
import { createHash as createHash9, randomUUID as randomUUID3 } from "crypto";
|
|
@@ -44074,11 +44126,15 @@ function prepareRun(agent, terminal = false) {
|
|
|
44074
44126
|
stage: "prepared",
|
|
44075
44127
|
terminal,
|
|
44076
44128
|
agent,
|
|
44129
|
+
preparationKey: preparationKey(agent),
|
|
44077
44130
|
launcher: [process.execPath, resolve8(process.argv[1])]
|
|
44078
44131
|
};
|
|
44079
44132
|
saveRun(run);
|
|
44080
44133
|
return run;
|
|
44081
44134
|
}
|
|
44135
|
+
function preparationKey(agent) {
|
|
44136
|
+
return agent === "codex" && process.env.CODEX_THREAD_ID ? sessionKey(agent, `${process.env.CODEX_THREAD_ID}\0${process.cwd()}`) : void 0;
|
|
44137
|
+
}
|
|
44082
44138
|
var quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
44083
44139
|
function demoCommand(run, action, choice, reason) {
|
|
44084
44140
|
return [
|
|
@@ -44101,11 +44157,10 @@ function demoWelcomeCommand(run) {
|
|
|
44101
44157
|
].map(quote).join(" ");
|
|
44102
44158
|
}
|
|
44103
44159
|
function demoDiagnosticCommand(run) {
|
|
44104
|
-
return [
|
|
44105
|
-
|
|
44106
|
-
|
|
44107
|
-
|
|
44108
|
-
].map(quote).join(" ");
|
|
44160
|
+
return [process.execPath, resolve8(process.argv[1]), "demo", "status", run.id].map(quote).join(" ");
|
|
44161
|
+
}
|
|
44162
|
+
function demoResumeCommand(run) {
|
|
44163
|
+
return [process.execPath, resolve8(process.argv[1]), "demo", "resume", run.id].map(quote).join(" ");
|
|
44109
44164
|
}
|
|
44110
44165
|
function onboardingFinished() {
|
|
44111
44166
|
const path9 = join21(demoDirectory(), "onboarding.json");
|
|
@@ -44124,15 +44179,116 @@ function pendingRuns() {
|
|
|
44124
44179
|
if (!existsSync13(path9)) return [];
|
|
44125
44180
|
return readdirSync5(path9).filter((name) => name.endsWith(".json") && RUN_ID.test(name.slice(0, -5))).map((name) => name.slice(0, -5)).filter((id) => !["completed", "skipped"].includes(readRun(id).stage));
|
|
44126
44181
|
}
|
|
44182
|
+
function sessionKey(agent, session) {
|
|
44183
|
+
return createHash9("sha256").update(`${agent}\0${session}`).digest("hex");
|
|
44184
|
+
}
|
|
44127
44185
|
function exclusionPath(key) {
|
|
44128
44186
|
if (!/^[0-9a-f]{64}$/u.test(key)) throw new Error("invalid demo session identity");
|
|
44129
44187
|
return join21(demoDirectory(), "excluded-sessions", `${key}.json`);
|
|
44130
44188
|
}
|
|
44131
44189
|
var lockRunAsync = (id, action) => withFileLock(`${runPath(id)}.lock`, () => action(readRun(id)), { timeoutMs: 500 });
|
|
44132
44190
|
|
|
44191
|
+
// src/demo/diagnostics.ts
|
|
44192
|
+
var observationPath = (id) => join22(demoDirectory(), "observations", `${id}.json`);
|
|
44193
|
+
function isolationDiagnostics(run) {
|
|
44194
|
+
let observation;
|
|
44195
|
+
let observationError;
|
|
44196
|
+
try {
|
|
44197
|
+
if (existsSync14(observationPath(run.id))) {
|
|
44198
|
+
const value = readDemoJson(observationPath(run.id));
|
|
44199
|
+
if (!value || !Number.isFinite(value.at) || !["claude_code", "codex", "cursor", "hermes"].includes(value.agent ?? "") || ![
|
|
44200
|
+
"acknowledged",
|
|
44201
|
+
"tool-mismatch",
|
|
44202
|
+
"command-mismatch",
|
|
44203
|
+
"session-mismatch",
|
|
44204
|
+
"session-missing",
|
|
44205
|
+
"write-failed"
|
|
44206
|
+
].includes(value.result ?? "") || value.runtimeVersion !== void 0 && !/^[a-zA-Z0-9.+-]{1,80}$/u.test(value.runtimeVersion) || value.session !== void 0 && !/^[a-f0-9]{64}$/u.test(value.session) || value.errorCode !== void 0 && !/^[A-Z0-9_]{1,32}$/u.test(value.errorCode))
|
|
44207
|
+
throw new Error("invalid demo observation");
|
|
44208
|
+
observation = value;
|
|
44209
|
+
}
|
|
44210
|
+
} catch {
|
|
44211
|
+
observationError = "unreadable";
|
|
44212
|
+
}
|
|
44213
|
+
const expected = run.agent === "codex" && process.env.CODEX_THREAD_ID ? sessionKey(run.agent, process.env.CODEX_THREAD_ID) : void 0;
|
|
44214
|
+
return {
|
|
44215
|
+
runtime: inspectHookRuntime(),
|
|
44216
|
+
expectedEvent: "PreToolUse",
|
|
44217
|
+
expectedTool: run.agent === "cursor" ? "Shell" : run.agent === "hermes" ? "terminal" : "Bash",
|
|
44218
|
+
hookObservation: observation ? {
|
|
44219
|
+
at: observation.at,
|
|
44220
|
+
agent: observation.agent,
|
|
44221
|
+
runtimeVersion: observation.runtimeVersion ?? "unknown",
|
|
44222
|
+
result: observation.result,
|
|
44223
|
+
ageMs: Math.max(0, Date.now() - observation.at),
|
|
44224
|
+
sessionMatches: expected ? observation.session === expected : "unknown",
|
|
44225
|
+
...observation.errorCode ? { errorCode: observation.errorCode } : {}
|
|
44226
|
+
} : null,
|
|
44227
|
+
...observationError ? { observationError } : {},
|
|
44228
|
+
trust: "unknown",
|
|
44229
|
+
capture: run.binding ? "excluded-for-bound-session" : "not-verified"
|
|
44230
|
+
};
|
|
44231
|
+
}
|
|
44232
|
+
|
|
44233
|
+
// src/demo/sandbox.ts
|
|
44234
|
+
import {
|
|
44235
|
+
existsSync as existsSync15,
|
|
44236
|
+
lstatSync as lstatSync9,
|
|
44237
|
+
mkdtempSync as mkdtempSync3,
|
|
44238
|
+
readFileSync as readFileSync17,
|
|
44239
|
+
readdirSync as readdirSync6,
|
|
44240
|
+
realpathSync as realpathSync5,
|
|
44241
|
+
rmdirSync,
|
|
44242
|
+
unlinkSync as unlinkSync5
|
|
44243
|
+
} from "fs";
|
|
44244
|
+
import { tmpdir } from "os";
|
|
44245
|
+
import { basename as basename4, dirname as dirname11, join as join23 } from "path";
|
|
44246
|
+
|
|
44247
|
+
// src/demo/scenario.ts
|
|
44248
|
+
var SAMPLE_NOTE = [
|
|
44249
|
+
"Fictional engineering conversation:",
|
|
44250
|
+
"Maya: Could we call fetch directly for the order service?",
|
|
44251
|
+
"Ravi: Use the shared HTTP client for service calls. We need retries and request tracing to stay consistent.",
|
|
44252
|
+
"Maya: Agreed. Let's reject direct fetch calls because they duplicate that policy.",
|
|
44253
|
+
"Ravi: Also, the team demo is at three."
|
|
44254
|
+
].join("\n");
|
|
44255
|
+
var SAMPLE_DECISIONS = [
|
|
44256
|
+
{
|
|
44257
|
+
id: "demo-http-client",
|
|
44258
|
+
decision: "Use the shared HTTP client for service calls",
|
|
44259
|
+
stage: "provisional",
|
|
44260
|
+
source: "Fictional engineering conversation",
|
|
44261
|
+
evidence: [
|
|
44262
|
+
"Use the shared HTTP client for service calls. We need retries and request tracing to stay consistent.",
|
|
44263
|
+
"Let's reject direct fetch calls because they duplicate that policy."
|
|
44264
|
+
],
|
|
44265
|
+
rationale: "Centralize retries and request tracing.",
|
|
44266
|
+
files: ["service.ts"],
|
|
44267
|
+
scopeBasis: "Demo mapping from service calls to service.ts; the conversation names no file.",
|
|
44268
|
+
alternativesRejected: ["Direct fetch calls with duplicated retry and tracing policy"]
|
|
44269
|
+
},
|
|
44270
|
+
{
|
|
44271
|
+
id: "demo-order-repository",
|
|
44272
|
+
decision: "Persist orders through the shared order repository",
|
|
44273
|
+
stage: "adopted",
|
|
44274
|
+
source: "User confirmation of this fictional proposal",
|
|
44275
|
+
rationale: "Keep validation and persistence consistent across order writers.",
|
|
44276
|
+
files: ["orders.ts"],
|
|
44277
|
+
alternativesRejected: ["Direct local-storage writes that bypass repository validation"]
|
|
44278
|
+
}
|
|
44279
|
+
];
|
|
44280
|
+
var SAMPLE_FILES = {
|
|
44281
|
+
"service.ts": 'import { http } from "./shared";\nexport const loadOrders = () => http.get("/orders");\n',
|
|
44282
|
+
"orders.ts": "export const saveOrder = (_order: unknown) => {\n // TODO: persist this order.\n};\n",
|
|
44283
|
+
"shared.ts": "// Fictional interfaces; this tour does not execute network or storage operations.\nexport declare const http: { get(path: string): Promise<unknown> };\nexport declare const orders: { save(order: unknown): void };\n"
|
|
44284
|
+
};
|
|
44285
|
+
var WARNING_EDIT = 'export const loadOrders = () => fetch("/orders");\n';
|
|
44286
|
+
var REPOSITORY_EDIT = 'import { orders } from "./shared";\nexport const saveOrder = (order: unknown) => orders.save(order);\n';
|
|
44287
|
+
|
|
44133
44288
|
// src/demo/story.ts
|
|
44134
44289
|
var DEMO_TASK = "Implement CSV export for customer records, including name and email.";
|
|
44135
|
-
var DEMO_ORIGINAL = "Exclude customer email addresses from
|
|
44290
|
+
var DEMO_ORIGINAL = "Exclude customer contact information e.g. email addresses from public-facing data pipelines";
|
|
44291
|
+
var DEMO_RATIONALE = "Customer contact details are collected for account communication, not public distribution. Keeping them out of public-facing pipelines supports our data-minimization and purpose-limitation obligations and reduces the risk of unauthorized disclosure.";
|
|
44136
44292
|
var DEMO_REPLACEMENT = "Allow customer names and email addresses in CSV exports";
|
|
44137
44293
|
var DEMO_INITIAL = '// Fictional customer export project.\nexport const customerCsv = "";\n';
|
|
44138
44294
|
var DEMO_ADHERE = '// Fictional customer export project.\nexport const customerCsv = "name\\nAvery";\n';
|
|
@@ -44164,7 +44320,7 @@ function inspectSandbox(run) {
|
|
|
44164
44320
|
}
|
|
44165
44321
|
const allowed = allowedFiles(run);
|
|
44166
44322
|
for (const name of readdirSync6(sandbox.path)) {
|
|
44167
|
-
const path9 =
|
|
44323
|
+
const path9 = join23(sandbox.path, name);
|
|
44168
44324
|
const file = lstatSync9(path9);
|
|
44169
44325
|
if (!Object.hasOwn(allowed, name) || !file.isFile() || file.nlink !== 1 || file.size > 16384 || !allowed[name].includes(readFileSync17(path9, "utf8"))) {
|
|
44170
44326
|
throw new Error(`unexpected demo contents; retained ${sandbox.path}`);
|
|
@@ -44174,7 +44330,7 @@ function inspectSandbox(run) {
|
|
|
44174
44330
|
}
|
|
44175
44331
|
function createSandbox(run) {
|
|
44176
44332
|
if (!run.sandbox) {
|
|
44177
|
-
const path9 = mkdtempSync3(
|
|
44333
|
+
const path9 = mkdtempSync3(join23(realpathSync5(tmpdir()), "prim-demo-"));
|
|
44178
44334
|
const stat = lstatSync9(path9);
|
|
44179
44335
|
run.sandbox = { path: path9, device: stat.dev, inode: stat.ino };
|
|
44180
44336
|
saveRun(run);
|
|
@@ -44187,17 +44343,17 @@ function createSandbox(run) {
|
|
|
44187
44343
|
"decisions.json": decisionBytes(false)
|
|
44188
44344
|
};
|
|
44189
44345
|
for (const [name, content] of Object.entries(files)) {
|
|
44190
|
-
const path9 =
|
|
44191
|
-
if (!
|
|
44346
|
+
const path9 = join23(root, name);
|
|
44347
|
+
if (!existsSync15(path9)) atomicWriteFile(path9, content, { mode: 384 });
|
|
44192
44348
|
}
|
|
44193
44349
|
}
|
|
44194
44350
|
function writeSample(run, name, bytes) {
|
|
44195
44351
|
const root = inspectSandbox(run);
|
|
44196
44352
|
if (!allowedFiles(run)[name].includes(bytes)) throw new Error("unsupported demo edit");
|
|
44197
|
-
atomicWriteFile(
|
|
44353
|
+
atomicWriteFile(join23(root, name), bytes, { mode: 384 });
|
|
44198
44354
|
}
|
|
44199
44355
|
function readSample(run, name) {
|
|
44200
|
-
return readFileSync17(
|
|
44356
|
+
return readFileSync17(join23(inspectSandbox(run), name), "utf8");
|
|
44201
44357
|
}
|
|
44202
44358
|
function cleanSandbox(run) {
|
|
44203
44359
|
if (!run.sandbox) return;
|
|
@@ -44211,7 +44367,7 @@ function cleanSandbox(run) {
|
|
|
44211
44367
|
const root = inspectSandbox(run);
|
|
44212
44368
|
for (const name of readdirSync6(root)) {
|
|
44213
44369
|
inspectSandbox(run);
|
|
44214
|
-
unlinkSync5(
|
|
44370
|
+
unlinkSync5(join23(root, name));
|
|
44215
44371
|
}
|
|
44216
44372
|
rmdirSync(root);
|
|
44217
44373
|
run.sandbox = void 0;
|
|
@@ -44235,7 +44391,7 @@ function compactDiff(before, after) {
|
|
|
44235
44391
|
}
|
|
44236
44392
|
function demoTrustGuidance(agent) {
|
|
44237
44393
|
if (agent === "codex")
|
|
44238
|
-
return "Check /hooks in Codex. Approve only if a trust action is offered. If hooks are already active, retry the exact standalone command once; do not keep asking for trust or a new session. If still pending, run diagnosticAction and
|
|
44394
|
+
return "Check /hooks in Codex. Approve only if a trust action is offered. If hooks are already active, retry the exact standalone command once; do not keep asking for trust or a new session. If still pending, run diagnosticAction once. Inspect its expected PreToolUse/Bash event and runtime; UserPromptSubmit does not acknowledge the tour. Do not prepare a new run.";
|
|
44239
44395
|
if (agent === "hermes")
|
|
44240
44396
|
return "Approve the installed prim hooks when Hermes prompts, then retry the exact nextAction.";
|
|
44241
44397
|
if (agent === "cursor")
|
|
@@ -44274,34 +44430,55 @@ function resultFor2(run) {
|
|
|
44274
44430
|
};
|
|
44275
44431
|
}
|
|
44276
44432
|
function present(run) {
|
|
44277
|
-
if (run.stage === "prepared") return "Tour
|
|
44433
|
+
if (run.stage === "prepared") return "Tour prepared \u2192 Isolation pending \u2192 Story not started.";
|
|
44278
44434
|
if (run.stage === "skipped") return "Tour skipped. Owned sample files removed.";
|
|
44435
|
+
const server = run.server;
|
|
44436
|
+
if (!server) throw new Error("Start the story first");
|
|
44279
44437
|
if (run.stage === "prompt")
|
|
44280
|
-
return
|
|
44281
|
-
|
|
44282
|
-
Imagine you\u2019re a new engineer joining a team. In this story, you previously authored a Decision; now experience it as the new engineer. We\u2019ll email the outcome to your signed-in address.
|
|
44283
|
-
${diagram("[1 Enter task] \u2192 [2 Your Decision stops it] \u2192 [3 Choose \u2192 Email]")}
|
|
44284
|
-
|
|
44285
|
-
Enter this prompt in this chat:
|
|
44438
|
+
return `[DEMO] How Primitive Catches Conflicts
|
|
44286
44439
|
|
|
44287
|
-
|
|
44288
|
-
|
|
44289
|
-
|
|
44440
|
+
You're a new engineer on ${safeMarkdown(server.story.orgName)}'s team.
|
|
44441
|
+
And you've been tasked with implementing CSV export functionality for customer records.
|
|
44442
|
+
Enter this prompt to do so:
|
|
44443
|
+
${DEMO_TASK}`;
|
|
44290
44444
|
if (run.stage === "conflict")
|
|
44291
|
-
return
|
|
44445
|
+
return `[DEMO] Primitive Caught a Conflict
|
|
44292
44446
|
|
|
44293
|
-
|
|
44294
|
-
${
|
|
44447
|
+
You proposed:
|
|
44448
|
+
"${DEMO_TASK}"
|
|
44295
44449
|
|
|
44296
|
-
|
|
44297
|
-
|
|
44450
|
+
But this conflicts with ${safeMarkdown(server.authorName)}'s Decision from ${safeMarkdown(server.story.decisionDate)}:
|
|
44451
|
+
Intent: ${DEMO_ORIGINAL}
|
|
44452
|
+
Rationale ${DEMO_RATIONALE}
|
|
44298
44453
|
|
|
44299
|
-
\`\`\`
|
|
44454
|
+
\`\`\`
|
|
44300
44455
|
${readSample(run, "customers.ts").trimEnd()}
|
|
44301
44456
|
\`\`\`
|
|
44302
44457
|
|
|
44303
|
-
|
|
44304
|
-
|
|
44458
|
+
You can either:
|
|
44459
|
+
- Accept ${safeMarkdown(server.authorName)}'s Decision and export only names, or
|
|
44460
|
+
- Supercede ${safeMarkdown(server.authorName)}'s Decision and proceed with exporting both names and email addresses`;
|
|
44461
|
+
if (run.stage === "completed") {
|
|
44462
|
+
const accepted = server.choice === "adhere";
|
|
44463
|
+
const after = accepted ? DEMO_ADHERE : DEMO_SUPERSEDE;
|
|
44464
|
+
return `[DEMO] ${accepted ? "Accepted" : "Superceded"} ${safeMarkdown(server.authorName)}'s Decision
|
|
44465
|
+
|
|
44466
|
+
Implemented CSV Export with ${accepted ? "only names" : "both names and email addresses"}:
|
|
44467
|
+
\`\`\`
|
|
44468
|
+
${compactDiff(DEMO_INITIAL, after)}
|
|
44469
|
+
\`\`\`
|
|
44470
|
+
|
|
44471
|
+
Check ${safeMarkdown(server.story.recipient)} for details regarding this Decision.
|
|
44472
|
+
|
|
44473
|
+
Start a new session and continue working to begin capturing Decisions.
|
|
44474
|
+
Or, you can explore existing Decisions by prompting your agent e.g.:
|
|
44475
|
+
- Show me my team's recent decisions and summarize what each one settled.
|
|
44476
|
+
- Pick the most load-bearing decision in our graph and walk me through its blast radius \u2014 what would changing it disturb?
|
|
44477
|
+
- Before I refactor, check which prior decisions govern the files I'm about to touch.
|
|
44478
|
+
- Find a file governed by one of our decisions, try a conflicting edit, and show me what the conflict gate says. Don't keep the change.
|
|
44479
|
+
- Is anything in our decision graph under review or waiting on me? Show me what needs attention.`;
|
|
44480
|
+
}
|
|
44481
|
+
if (run.stage === "cleanup") {
|
|
44305
44482
|
const choice = run.server?.choice;
|
|
44306
44483
|
const after = choice === "adhere" ? DEMO_ADHERE : DEMO_SUPERSEDE;
|
|
44307
44484
|
return `${label}
|
|
@@ -44314,7 +44491,7 @@ Your Decision \u2192 ${choice === "adhere" ? "preserved" : "replacement + your r
|
|
|
44314
44491
|
${compactDiff(DEMO_INITIAL, after)}
|
|
44315
44492
|
\`\`\`
|
|
44316
44493
|
|
|
44317
|
-
|
|
44494
|
+
Sample cleanup still needs attention. ${run.server?.email === "accepted" ? "The provider accepted the email; inbox delivery is not confirmed." : "Queued is not inbox delivery."}
|
|
44318
44495
|
|
|
44319
44496
|
${run.binding ? captureNotice : "Ready for your real Decisions."}`;
|
|
44320
44497
|
}
|
|
@@ -44335,7 +44512,8 @@ function handoff(run) {
|
|
|
44335
44512
|
supersede: {
|
|
44336
44513
|
command: demoCommand(run, "resolve", "supersede"),
|
|
44337
44514
|
requiredArgument: "--reason <user-provided reason>",
|
|
44338
|
-
replacement: DEMO_REPLACEMENT
|
|
44515
|
+
replacement: DEMO_REPLACEMENT,
|
|
44516
|
+
prompt: `What's your rationale for superceding ${safeMarkdown(run.server?.authorName ?? "the author")}'s existing Decision?`
|
|
44339
44517
|
}
|
|
44340
44518
|
}
|
|
44341
44519
|
};
|
|
@@ -44400,7 +44578,30 @@ async function finishResolution(run, choice, reason) {
|
|
|
44400
44578
|
finishOnboarding("completed");
|
|
44401
44579
|
}
|
|
44402
44580
|
}
|
|
44581
|
+
function pendingIsolation(run, isolation, action, choice, reason) {
|
|
44582
|
+
return {
|
|
44583
|
+
fictional: true,
|
|
44584
|
+
evaluation: "live",
|
|
44585
|
+
runId: run.id,
|
|
44586
|
+
stage: "pending",
|
|
44587
|
+
isolation,
|
|
44588
|
+
...action === "status" ? { resumeAction: demoResumeCommand(run) } : { nextAction: demoCommand(run, action, choice, reason) },
|
|
44589
|
+
diagnostics: isolationDiagnostics(run),
|
|
44590
|
+
...action === "status" ? {} : { diagnosticAction: demoDiagnosticCommand(run) },
|
|
44591
|
+
skipAction: demoCommand(run, "skip"),
|
|
44592
|
+
presentation: `Tour prepared \u2192 **Isolation pending** \u2192 ${run.stage === "prepared" ? "Story not started" : "Story paused"}.
|
|
44593
|
+
|
|
44594
|
+
${isolation}. Checking the installed pre-tool hook before continuing.`,
|
|
44595
|
+
guidance: demoTrustGuidance(run.agent),
|
|
44596
|
+
recovery: `${action === "status" ? "Use this evidence to repair the hook before resumeAction." : "Run diagnosticAction once."} If no hook observation exists, the CLI has no evidence this command reached its installed pre-tool hook. Check the host hook event/error view and configuration-directory access; absence of a log is not proof of healthy hooks. Retry only after a repair, using this run. Never fabricate acknowledgment or read sample files.`
|
|
44597
|
+
};
|
|
44598
|
+
}
|
|
44403
44599
|
async function advanceDemo(id, action, choice, reason) {
|
|
44600
|
+
if (action === "status") {
|
|
44601
|
+
const run = readRun(id);
|
|
44602
|
+
if (!run.terminal && !run.acknowledgment)
|
|
44603
|
+
return pendingIsolation(run, "acknowledgment-missing", action);
|
|
44604
|
+
}
|
|
44404
44605
|
return await lockRunAsync(id, async (run) => {
|
|
44405
44606
|
if (action === "resolve") requireResolution(choice, reason);
|
|
44406
44607
|
if (action === "skip") {
|
|
@@ -44418,19 +44619,8 @@ async function advanceDemo(id, action, choice, reason) {
|
|
|
44418
44619
|
throw new Error(
|
|
44419
44620
|
`Legacy tour: clean up with ${demoCommand(run, "skip")}, then run prim demo again`
|
|
44420
44621
|
);
|
|
44421
|
-
const isolation = consumeAcknowledgment(run, action, choice, reason);
|
|
44422
|
-
if (isolation)
|
|
44423
|
-
return {
|
|
44424
|
-
fictional: true,
|
|
44425
|
-
evaluation: "live",
|
|
44426
|
-
runId: id,
|
|
44427
|
-
stage: "pending",
|
|
44428
|
-
isolation,
|
|
44429
|
-
nextAction: demoCommand(run, action, choice, reason),
|
|
44430
|
-
diagnosticAction: demoDiagnosticCommand(run),
|
|
44431
|
-
skipAction: demoCommand(run, "skip"),
|
|
44432
|
-
presentation: `Session isolation pending (${isolation}). ${demoTrustGuidance(run.agent)}`
|
|
44433
|
-
};
|
|
44622
|
+
const isolation = action === "status" && !run.terminal && !run.acknowledgment ? "acknowledgment-missing" : consumeAcknowledgment(run, action, choice, reason);
|
|
44623
|
+
if (isolation) return pendingIsolation(run, isolation, action, choice, reason);
|
|
44434
44624
|
if (action === "status") {
|
|
44435
44625
|
const server = run.server ? await demoStatus(run.server.runId) : void 0;
|
|
44436
44626
|
return { ...handoff(run), ...server ? { server } : {} };
|
|
@@ -44503,9 +44693,19 @@ function parseAgent(value) {
|
|
|
44503
44693
|
}
|
|
44504
44694
|
function reportError(error) {
|
|
44505
44695
|
const message = terminalSafeLine(error instanceof Error ? error.message : String(error));
|
|
44696
|
+
const code = error?.code;
|
|
44506
44697
|
process.stderr.write(`[prim] demo: ${message}
|
|
44507
44698
|
`);
|
|
44508
|
-
printJson2({
|
|
44699
|
+
printJson2({
|
|
44700
|
+
fictional: true,
|
|
44701
|
+
evaluation: "live",
|
|
44702
|
+
stage: "error",
|
|
44703
|
+
message,
|
|
44704
|
+
...code === "EPERM" || code === "EACCES" ? {
|
|
44705
|
+
code,
|
|
44706
|
+
recovery: "The host denied access to Primitive local state. Run the same action with the configuration-directory access authorized for setup, within host policy. Do not create another run or change permissions recursively."
|
|
44707
|
+
} : {}
|
|
44708
|
+
});
|
|
44509
44709
|
process.exitCode = 1;
|
|
44510
44710
|
}
|
|
44511
44711
|
async function terminalTour(run) {
|
|
@@ -44513,7 +44713,7 @@ async function terminalTour(run) {
|
|
|
44513
44713
|
const show = (result) => {
|
|
44514
44714
|
const text = result.presentation.replace(/^```(?:text|ts|diff)?\n/gmu, "").replace(/```/gu, "").replace(/\*\*(.*?)\*\*/gu, (_match, title) => bold(title));
|
|
44515
44715
|
process.stderr.write(
|
|
44516
|
-
`${text.replace("
|
|
44716
|
+
`${text.replace("[DEMO] Primitive Caught a Conflict", color("[DEMO] Primitive Caught a Conflict", "red")).replace("PASS \u2014 CSV export implemented", color("PASS \u2014 CSV export implemented", "green"))}
|
|
44517
44717
|
`
|
|
44518
44718
|
);
|
|
44519
44719
|
if (["completed", "skipped"].includes(result.stage) && "nextAction" in result) {
|
|
@@ -44529,45 +44729,89 @@ async function terminalTour(run) {
|
|
|
44529
44729
|
if (task.trim() !== DEMO_TASK) return show(await advanceDemo(run.id, "skip"));
|
|
44530
44730
|
const blocked = show(await advanceDemo(run.id, "attempt"));
|
|
44531
44731
|
if (blocked.stage !== "conflict") return blocked;
|
|
44532
|
-
const
|
|
44732
|
+
const answer = (await rl.question("Accept or Supercede? [accept/supercede/skip] ")).trim().toLowerCase();
|
|
44733
|
+
const choice = answer === "accept" ? "adhere" : answer === "supercede" ? "supersede" : answer;
|
|
44533
44734
|
if (choice !== "adhere" && choice !== "supersede")
|
|
44534
44735
|
return show(await advanceDemo(run.id, "skip"));
|
|
44535
|
-
const reason = choice === "supersede" ? await rl.question(
|
|
44736
|
+
const reason = choice === "supersede" ? await rl.question(
|
|
44737
|
+
`What's your rationale for superceding ${terminalSafeLine("server" in blocked ? blocked.server?.authorName ?? "the author" : "the author")}'s existing Decision? `
|
|
44738
|
+
) : void 0;
|
|
44536
44739
|
return show(await advanceDemo(run.id, "resolve", choice, reason));
|
|
44537
44740
|
} finally {
|
|
44538
44741
|
rl.close();
|
|
44539
44742
|
}
|
|
44540
44743
|
}
|
|
44541
44744
|
function registerDemoCommands(program3) {
|
|
44542
|
-
const demo = program3.command("demo").description("Experience your Decision protecting a fictional teammate change").option("--agent <agent>", "calling agent; requires session isolation").option("--details", "include supporting story detail").action(async (options, command) => {
|
|
44745
|
+
const demo = program3.command("demo").description("Experience your Decision protecting a fictional teammate change").option("--agent <agent>", "calling agent; requires session isolation").option("--details", "include supporting story detail").option("--resume-pending", "reuse a pending tour prepared in this Codex session").action(async (options, command) => {
|
|
44543
44746
|
try {
|
|
44544
44747
|
const agent = parseAgent(options.agent);
|
|
44545
44748
|
const terminal = !agent && !isNonInteractive(command.optsWithGlobals()) && !!process.stdin.isTTY && !!process.stderr.isTTY && !process.env.CLAUDECODE && !process.env.CODEX_THREAD_ID && !process.env.CURSOR_AGENT && !process.env.HERMES_INTERACTIVE;
|
|
44546
|
-
const
|
|
44547
|
-
|
|
44548
|
-
|
|
44549
|
-
|
|
44550
|
-
|
|
44551
|
-
|
|
44552
|
-
|
|
44553
|
-
|
|
44554
|
-
);
|
|
44555
|
-
const
|
|
44749
|
+
const runs = pendingRuns().map(readRun);
|
|
44750
|
+
const recovery = runs.map((run2) => ({
|
|
44751
|
+
runId: run2.id,
|
|
44752
|
+
resumeAction: run2.version === 2 ? demoResumeCommand(run2) : void 0,
|
|
44753
|
+
skipAction: demoCommand(
|
|
44754
|
+
{ ...run2, launcher: [process.execPath, resolve9(process.argv[1])] },
|
|
44755
|
+
"skip"
|
|
44756
|
+
)
|
|
44757
|
+
}));
|
|
44758
|
+
const key = preparationKey(agent);
|
|
44759
|
+
const pending = options.resumePending && key ? runs.find(
|
|
44760
|
+
(run2) => run2.version === 2 && run2.preparationKey === key && run2.agent === agent
|
|
44761
|
+
) : void 0;
|
|
44762
|
+
const run = pending ? lockRun(pending.id, (run2) => {
|
|
44763
|
+
run2.launcher = [process.execPath, resolve9(process.argv[1])];
|
|
44764
|
+
run2.acknowledgment = void 0;
|
|
44765
|
+
saveRun(run2);
|
|
44766
|
+
return run2;
|
|
44767
|
+
}) : prepareRun(agent, terminal);
|
|
44556
44768
|
if (terminal) {
|
|
44557
44769
|
const result = await terminalTour(run);
|
|
44558
44770
|
if (!process.stdout.isTTY) printJson2(result);
|
|
44559
44771
|
return;
|
|
44560
44772
|
}
|
|
44561
|
-
process.stderr.write(
|
|
44773
|
+
process.stderr.write(
|
|
44774
|
+
"[prim] Tour prepared \u2192 verify isolation to continue. Follow nextAction.\n"
|
|
44775
|
+
);
|
|
44562
44776
|
printJson2({
|
|
44563
|
-
|
|
44564
|
-
|
|
44777
|
+
fictional: true,
|
|
44778
|
+
evaluation: "live",
|
|
44779
|
+
runId: run.id,
|
|
44780
|
+
stage: run.stage,
|
|
44781
|
+
nextAction: demoCommand(run, run.stage === "prepared" ? "start" : "status"),
|
|
44782
|
+
skipAction: demoCommand(run, "skip"),
|
|
44783
|
+
statusAction: demoDiagnosticCommand(run),
|
|
44784
|
+
presentation: `Tour prepared \u2192 Isolation pending \u2192 ${run.stage === "prepared" ? "Story not started" : "Story paused"}.`,
|
|
44785
|
+
instructions: "Continue nextAction now within the authorized setup request; do not stop at welcome or ask whether to begin. Run nextAction exactly as a standalone command with the same authorized local-state access as setup. Render presentation once, preserving diagrams. At awaitUserPrompt, wait for the user to enter that task before running attemptAction. At the block, wait for adhere or supersede; supersede requires the user's own reason and approval of the displayed replacement. Append --reason and the reason using the same single-quoted argv format (escape an apostrophe as '\\''). Never invent a reason, delegate this tour, or save fictional samples to memory or real Decisions. On completion display success before following welcome. A new session resumes passive capture.",
|
|
44565
44786
|
recoverableRuns: recovery
|
|
44566
44787
|
});
|
|
44567
44788
|
} catch (error) {
|
|
44568
44789
|
reportError(error);
|
|
44569
44790
|
}
|
|
44570
44791
|
});
|
|
44792
|
+
demo.command("resume <runId>").description("Recover this run's launcher without revealing story content").action((id) => {
|
|
44793
|
+
try {
|
|
44794
|
+
printJson2(
|
|
44795
|
+
lockRun(id, (run) => {
|
|
44796
|
+
if (run.version !== 2) throw new Error("Legacy tour must be skipped before replay");
|
|
44797
|
+
run.launcher = [process.execPath, resolve9(process.argv[1])];
|
|
44798
|
+
run.acknowledgment = void 0;
|
|
44799
|
+
saveRun(run);
|
|
44800
|
+
return {
|
|
44801
|
+
fictional: true,
|
|
44802
|
+
evaluation: "live",
|
|
44803
|
+
runId: id,
|
|
44804
|
+
stage: "pending",
|
|
44805
|
+
nextAction: demoCommand(run, run.stage === "prepared" ? "start" : "status"),
|
|
44806
|
+
diagnosticAction: demoDiagnosticCommand(run),
|
|
44807
|
+
presentation: "Run nextAction to verify isolation and resume this tour."
|
|
44808
|
+
};
|
|
44809
|
+
})
|
|
44810
|
+
);
|
|
44811
|
+
} catch (error) {
|
|
44812
|
+
reportError(error);
|
|
44813
|
+
}
|
|
44814
|
+
});
|
|
44571
44815
|
for (const action of ["start", "attempt", "resolve", "status", "skip"]) {
|
|
44572
44816
|
const sub = demo.command(`${action} ${action === "skip" ? "[runId]" : "<runId>"}`);
|
|
44573
44817
|
if (action === "resolve")
|
|
@@ -44594,7 +44838,7 @@ function registerDemoCommands(program3) {
|
|
|
44594
44838
|
}
|
|
44595
44839
|
|
|
44596
44840
|
// src/commands/doctor.ts
|
|
44597
|
-
import { existsSync as
|
|
44841
|
+
import { existsSync as existsSync19 } from "fs";
|
|
44598
44842
|
|
|
44599
44843
|
// src/decisions/feedback.ts
|
|
44600
44844
|
var FEEDBACK_PROTOCOL_VERSION = 2;
|
|
@@ -44746,7 +44990,7 @@ async function inspectJournalDelivery(buckets, options = {}) {
|
|
|
44746
44990
|
import {
|
|
44747
44991
|
appendFileSync,
|
|
44748
44992
|
closeSync as closeSync5,
|
|
44749
|
-
existsSync as
|
|
44993
|
+
existsSync as existsSync17,
|
|
44750
44994
|
fstatSync as fstatSync2,
|
|
44751
44995
|
mkdirSync as mkdirSync11,
|
|
44752
44996
|
openSync as openSync5,
|
|
@@ -44755,18 +44999,18 @@ import {
|
|
|
44755
44999
|
readSync as readSync2,
|
|
44756
45000
|
readdirSync as readdirSync8
|
|
44757
45001
|
} from "fs";
|
|
44758
|
-
import { dirname as dirname13, join as
|
|
45002
|
+
import { dirname as dirname13, join as join25 } from "path";
|
|
44759
45003
|
|
|
44760
45004
|
// src/drain-progress.ts
|
|
44761
45005
|
import {
|
|
44762
45006
|
chmodSync as chmodSync6,
|
|
44763
|
-
existsSync as
|
|
45007
|
+
existsSync as existsSync16,
|
|
44764
45008
|
readFileSync as readFileSync18,
|
|
44765
45009
|
readdirSync as readdirSync7,
|
|
44766
45010
|
rmSync as rmSync6,
|
|
44767
45011
|
rmdirSync as rmdirSync2
|
|
44768
45012
|
} from "fs";
|
|
44769
|
-
import { basename as basename5, dirname as dirname12, join as
|
|
45013
|
+
import { basename as basename5, dirname as dirname12, join as join24 } from "path";
|
|
44770
45014
|
var DIRECTORY_MODE3 = 448;
|
|
44771
45015
|
var FILE_MODE2 = 384;
|
|
44772
45016
|
var DRAIN_PROGRESS_DIRNAME = "drain-progress";
|
|
@@ -44775,10 +45019,10 @@ function rotationIdentity(stat) {
|
|
|
44775
45019
|
return { size: stat.size, ino: stat.ino, dev: stat.dev };
|
|
44776
45020
|
}
|
|
44777
45021
|
function drainProgressDirectory(flushingPath) {
|
|
44778
|
-
return
|
|
45022
|
+
return join24(dirname12(flushingPath), DRAIN_PROGRESS_DIRNAME);
|
|
44779
45023
|
}
|
|
44780
45024
|
function drainProgressPath(flushingPath) {
|
|
44781
|
-
return
|
|
45025
|
+
return join24(drainProgressDirectory(flushingPath), `${basename5(flushingPath)}.json`);
|
|
44782
45026
|
}
|
|
44783
45027
|
function isByteCount(value) {
|
|
44784
45028
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
@@ -44823,7 +45067,7 @@ function removeDrainCheckpoint(flushingPath) {
|
|
|
44823
45067
|
removeEmptyDirectory(drainProgressDirectory(flushingPath));
|
|
44824
45068
|
}
|
|
44825
45069
|
function sweepOrphanedDrainCheckpoints(bucketDirectory) {
|
|
44826
|
-
const directory =
|
|
45070
|
+
const directory = join24(bucketDirectory, DRAIN_PROGRESS_DIRNAME);
|
|
44827
45071
|
let names;
|
|
44828
45072
|
try {
|
|
44829
45073
|
names = readdirSync7(directory);
|
|
@@ -44832,11 +45076,11 @@ function sweepOrphanedDrainCheckpoints(bucketDirectory) {
|
|
|
44832
45076
|
}
|
|
44833
45077
|
for (const name of names) {
|
|
44834
45078
|
const rotation = CHECKPOINT_NAME.exec(name)?.[1];
|
|
44835
|
-
if (rotation === void 0 ||
|
|
45079
|
+
if (rotation === void 0 || existsSync16(join24(bucketDirectory, rotation))) {
|
|
44836
45080
|
continue;
|
|
44837
45081
|
}
|
|
44838
45082
|
try {
|
|
44839
|
-
rmSync6(
|
|
45083
|
+
rmSync6(join24(directory, name), { force: true });
|
|
44840
45084
|
} catch {
|
|
44841
45085
|
}
|
|
44842
45086
|
}
|
|
@@ -44847,7 +45091,7 @@ function sweepOrphanedDrainCheckpoints(bucketDirectory) {
|
|
|
44847
45091
|
}
|
|
44848
45092
|
|
|
44849
45093
|
// src/journal.ts
|
|
44850
|
-
var JOURNAL_DIR =
|
|
45094
|
+
var JOURNAL_DIR = join25(primConfigDirectory(), "moves");
|
|
44851
45095
|
var JOURNAL_BASENAME = "journal.ndjson";
|
|
44852
45096
|
var JOURNAL_STATS_SAMPLE_BYTES = 64 * 1024;
|
|
44853
45097
|
var PENDING_STATS_MAX_FILES = 128;
|
|
@@ -44859,7 +45103,7 @@ function envSlug(apiUrl) {
|
|
|
44859
45103
|
return slug;
|
|
44860
45104
|
}
|
|
44861
45105
|
function currentEnvDir() {
|
|
44862
|
-
return
|
|
45106
|
+
return join25(JOURNAL_DIR, envSlug(getSiteUrl()));
|
|
44863
45107
|
}
|
|
44864
45108
|
function parseMoves(content) {
|
|
44865
45109
|
const moves = [];
|
|
@@ -44875,7 +45119,7 @@ function parseMoves(content) {
|
|
|
44875
45119
|
return moves;
|
|
44876
45120
|
}
|
|
44877
45121
|
function readMovesFromPath(path9) {
|
|
44878
|
-
if (!
|
|
45122
|
+
if (!existsSync17(path9)) {
|
|
44879
45123
|
return [];
|
|
44880
45124
|
}
|
|
44881
45125
|
return parseMoves(readFileSync19(path9, "utf-8"));
|
|
@@ -44883,15 +45127,15 @@ function readMovesFromPath(path9) {
|
|
|
44883
45127
|
function listBuckets() {
|
|
44884
45128
|
const out = [];
|
|
44885
45129
|
const envDir = currentEnvDir();
|
|
44886
|
-
if (!
|
|
45130
|
+
if (!existsSync17(envDir)) {
|
|
44887
45131
|
return out;
|
|
44888
45132
|
}
|
|
44889
45133
|
for (const entry of readdirSync8(envDir, { withFileTypes: true })) {
|
|
44890
45134
|
if (!entry.isDirectory()) {
|
|
44891
45135
|
continue;
|
|
44892
45136
|
}
|
|
44893
|
-
const path9 =
|
|
44894
|
-
if (
|
|
45137
|
+
const path9 = join25(envDir, entry.name, JOURNAL_BASENAME);
|
|
45138
|
+
if (existsSync17(path9)) {
|
|
44895
45139
|
out.push({ bucket: entry.name, path: path9 });
|
|
44896
45140
|
}
|
|
44897
45141
|
}
|
|
@@ -44953,7 +45197,7 @@ function parseFlushingPid(name) {
|
|
|
44953
45197
|
return Number.isSafeInteger(pid) && pid > 0 ? pid : void 0;
|
|
44954
45198
|
}
|
|
44955
45199
|
function listFlushingInDir(dir, bucket, options = {}) {
|
|
44956
|
-
if (!
|
|
45200
|
+
if (!existsSync17(dir)) {
|
|
44957
45201
|
return [];
|
|
44958
45202
|
}
|
|
44959
45203
|
const out = [];
|
|
@@ -44967,7 +45211,7 @@ function listFlushingInDir(dir, bucket, options = {}) {
|
|
|
44967
45211
|
entry = entries.readSync();
|
|
44968
45212
|
continue;
|
|
44969
45213
|
}
|
|
44970
|
-
const path9 =
|
|
45214
|
+
const path9 = join25(dir, entry.name);
|
|
44971
45215
|
let sample;
|
|
44972
45216
|
try {
|
|
44973
45217
|
sample = sampleJournalFile(path9, remainingBytes, { fromDrainCheckpoint: true });
|
|
@@ -44994,7 +45238,7 @@ function listFlushingInDir(dir, bucket, options = {}) {
|
|
|
44994
45238
|
}
|
|
44995
45239
|
function listFlushing(options = {}) {
|
|
44996
45240
|
const envDir = currentEnvDir();
|
|
44997
|
-
if (!
|
|
45241
|
+
if (!existsSync17(envDir)) {
|
|
44998
45242
|
return [];
|
|
44999
45243
|
}
|
|
45000
45244
|
const out = [];
|
|
@@ -45005,7 +45249,7 @@ function listFlushing(options = {}) {
|
|
|
45005
45249
|
break;
|
|
45006
45250
|
}
|
|
45007
45251
|
if (entry.isDirectory()) {
|
|
45008
|
-
const found = listFlushingInDir(
|
|
45252
|
+
const found = listFlushingInDir(join25(envDir, entry.name), entry.name, {
|
|
45009
45253
|
sampleBytes: remainingBytes,
|
|
45010
45254
|
maxFiles: maxFiles - out.length
|
|
45011
45255
|
});
|
|
@@ -45020,12 +45264,12 @@ function listFlushing(options = {}) {
|
|
|
45020
45264
|
}
|
|
45021
45265
|
function sweepOrphanedDrainProgress() {
|
|
45022
45266
|
const envDir = currentEnvDir();
|
|
45023
|
-
if (!
|
|
45267
|
+
if (!existsSync17(envDir)) {
|
|
45024
45268
|
return;
|
|
45025
45269
|
}
|
|
45026
45270
|
for (const entry of readdirSync8(envDir, { withFileTypes: true })) {
|
|
45027
45271
|
if (entry.isDirectory()) {
|
|
45028
|
-
sweepOrphanedDrainCheckpoints(
|
|
45272
|
+
sweepOrphanedDrainCheckpoints(join25(envDir, entry.name));
|
|
45029
45273
|
}
|
|
45030
45274
|
}
|
|
45031
45275
|
}
|
|
@@ -45074,9 +45318,9 @@ function pendingJournalStats() {
|
|
|
45074
45318
|
}
|
|
45075
45319
|
|
|
45076
45320
|
// src/commands/hermes-install.ts
|
|
45077
|
-
import { existsSync as
|
|
45321
|
+
import { existsSync as existsSync18, readFileSync as readFileSync20, rmSync as rmSync7, statSync as statSync4 } from "fs";
|
|
45078
45322
|
import { homedir as homedir9 } from "os";
|
|
45079
|
-
import { join as
|
|
45323
|
+
import { join as join26 } from "path";
|
|
45080
45324
|
|
|
45081
45325
|
// node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/identity.js
|
|
45082
45326
|
var ALIAS = /* @__PURE__ */ Symbol.for("yaml.alias");
|
|
@@ -51355,13 +51599,13 @@ var JSON_INDENT3 = 2;
|
|
|
51355
51599
|
var CONFIG_MODE = 384;
|
|
51356
51600
|
var PRIM_BINS4 = [CAPTURE_BIN4, GATE_BIN4, POST_TOOL_USE_BIN3, SESSION_START_BIN4, SESSION_END_BIN3];
|
|
51357
51601
|
function hermesHome() {
|
|
51358
|
-
return process.env.HERMES_HOME ??
|
|
51602
|
+
return process.env.HERMES_HOME ?? join26(homedir9(), ".hermes");
|
|
51359
51603
|
}
|
|
51360
51604
|
function configPath() {
|
|
51361
|
-
return
|
|
51605
|
+
return join26(hermesHome(), "config.yaml");
|
|
51362
51606
|
}
|
|
51363
51607
|
function legacyShimPath() {
|
|
51364
|
-
return
|
|
51608
|
+
return join26(hermesHome(), "agent-hooks", "prim-shim.sh");
|
|
51365
51609
|
}
|
|
51366
51610
|
function commandFor2(bin) {
|
|
51367
51611
|
return stableHookCommand(bin, HERMES_ARGS);
|
|
@@ -51475,7 +51719,7 @@ function hookRuntimeResolutions3(hooks) {
|
|
|
51475
51719
|
}
|
|
51476
51720
|
function inspectHookRuntimeResolutions4() {
|
|
51477
51721
|
const path9 = configPath();
|
|
51478
|
-
if (!
|
|
51722
|
+
if (!existsSync18(path9)) return [];
|
|
51479
51723
|
return hookRuntimeResolutions3(readHooks(parseHermesDocument(readFileSync20(path9, "utf8"))));
|
|
51480
51724
|
}
|
|
51481
51725
|
function entryMatchesRegistration3(owned, registration) {
|
|
@@ -51745,7 +51989,7 @@ function assertMergeValid(before, after, expectedHooks) {
|
|
|
51745
51989
|
}
|
|
51746
51990
|
}
|
|
51747
51991
|
function readConfigSnapshot(path9) {
|
|
51748
|
-
if (!
|
|
51992
|
+
if (!existsSync18(path9)) return { exists: false, mode: CONFIG_MODE, raw: "" };
|
|
51749
51993
|
return {
|
|
51750
51994
|
exists: true,
|
|
51751
51995
|
mode: statSync4(path9).mode & 511,
|
|
@@ -51811,7 +52055,7 @@ function performInstall4(opts) {
|
|
|
51811
52055
|
}
|
|
51812
52056
|
function performUninstall4() {
|
|
51813
52057
|
const path9 = configPath();
|
|
51814
|
-
if (!
|
|
52058
|
+
if (!existsSync18(path9)) {
|
|
51815
52059
|
removeLegacyShim();
|
|
51816
52060
|
return { path: path9, gate: false, capture: false, autoAccept: false, changed: false };
|
|
51817
52061
|
}
|
|
@@ -51836,7 +52080,7 @@ function performUninstall4() {
|
|
|
51836
52080
|
}
|
|
51837
52081
|
function performStatus4() {
|
|
51838
52082
|
const path9 = configPath();
|
|
51839
|
-
const raw =
|
|
52083
|
+
const raw = existsSync18(path9) ? readFileSync20(path9, "utf8") : "";
|
|
51840
52084
|
const hooks = raw ? readHooks(parseHermesDocument(raw)) : {};
|
|
51841
52085
|
return {
|
|
51842
52086
|
path: path9,
|
|
@@ -51925,7 +52169,7 @@ function checkAuth() {
|
|
|
51925
52169
|
return classifyAuthCredential(
|
|
51926
52170
|
credential,
|
|
51927
52171
|
storedCredential ? getTokenExpiresAt() : void 0,
|
|
51928
|
-
storedCredential &&
|
|
52172
|
+
storedCredential && existsSync19(REFRESH_TOKEN_PATH)
|
|
51929
52173
|
);
|
|
51930
52174
|
}
|
|
51931
52175
|
function classifyDaemonHealth(snapshot, options = {}) {
|
|
@@ -52245,7 +52489,7 @@ function managedHookRemedy(inspection) {
|
|
|
52245
52489
|
}
|
|
52246
52490
|
return "run `prim hooks install`";
|
|
52247
52491
|
case "unsupported_interpreter":
|
|
52248
|
-
return "
|
|
52492
|
+
return "existing hook preserved: add a supported shebang (for example #!/bin/sh) to a direct shell hook, or run the repository\u2019s Husky prepare script so Husky v9 selects .husky/_; then rerun prim setup. Primitive does not rewrite an unknown interpreter or change core.hooksPath silently";
|
|
52249
52493
|
case "entrypoint_missing":
|
|
52250
52494
|
return "run `prim enable` to stage the hook runtime";
|
|
52251
52495
|
default:
|
|
@@ -52725,12 +52969,12 @@ function registerDoctorCommands(program3, dependencies = {}) {
|
|
|
52725
52969
|
}
|
|
52726
52970
|
|
|
52727
52971
|
// src/commands/moves.ts
|
|
52728
|
-
import { existsSync as
|
|
52729
|
-
import { join as
|
|
52972
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync13, unlinkSync as unlinkSync7, writeFileSync as writeFileSync9 } from "fs";
|
|
52973
|
+
import { join as join29 } from "path";
|
|
52730
52974
|
|
|
52731
52975
|
// src/flusher.ts
|
|
52732
52976
|
import { createReadStream, renameSync as renameSync6, statSync as statSync5, unlinkSync as unlinkSync6 } from "fs";
|
|
52733
|
-
import { dirname as dirname15, join as
|
|
52977
|
+
import { dirname as dirname15, join as join28 } from "path";
|
|
52734
52978
|
|
|
52735
52979
|
// src/dead-letter.ts
|
|
52736
52980
|
import { createHash as createHash11, randomBytes as randomBytes7 } from "crypto";
|
|
@@ -52738,7 +52982,7 @@ import {
|
|
|
52738
52982
|
constants as constants6,
|
|
52739
52983
|
chmodSync as chmodSync7,
|
|
52740
52984
|
closeSync as closeSync6,
|
|
52741
|
-
existsSync as
|
|
52985
|
+
existsSync as existsSync20,
|
|
52742
52986
|
fchmodSync as fchmodSync3,
|
|
52743
52987
|
fsyncSync as fsyncSync3,
|
|
52744
52988
|
mkdirSync as mkdirSync12,
|
|
@@ -52747,16 +52991,16 @@ import {
|
|
|
52747
52991
|
rmSync as rmSync8,
|
|
52748
52992
|
writeFileSync as writeFileSync8
|
|
52749
52993
|
} from "fs";
|
|
52750
|
-
import { dirname as dirname14, join as
|
|
52994
|
+
import { dirname as dirname14, join as join27 } from "path";
|
|
52751
52995
|
var DIRECTORY_MODE4 = 448;
|
|
52752
52996
|
var FILE_MODE3 = 384;
|
|
52753
52997
|
var DEAD_LETTER_DIRNAME = "dead-letter";
|
|
52754
52998
|
function deadLetterDirectoryForRotation(flushingPath) {
|
|
52755
|
-
return
|
|
52999
|
+
return join27(dirname14(flushingPath), DEAD_LETTER_DIRNAME);
|
|
52756
53000
|
}
|
|
52757
53001
|
function deadLetterPathForRawLine(flushingPath, rawLine) {
|
|
52758
53002
|
const quarantineId = createHash11("sha256").update(rawLine).digest("hex");
|
|
52759
|
-
return
|
|
53003
|
+
return join27(deadLetterDirectoryForRotation(flushingPath), `raw-${quarantineId}.json`);
|
|
52760
53004
|
}
|
|
52761
53005
|
function ensureDeadLetterDirectory(flushingPath, persistDirectory) {
|
|
52762
53006
|
const directory = deadLetterDirectoryForRotation(flushingPath);
|
|
@@ -52766,11 +53010,11 @@ function ensureDeadLetterDirectory(flushingPath, persistDirectory) {
|
|
|
52766
53010
|
return directory;
|
|
52767
53011
|
}
|
|
52768
53012
|
function persistDeadLetter(directory, path9, quarantineId, record3, persistDirectory) {
|
|
52769
|
-
if (
|
|
53013
|
+
if (existsSync20(path9)) {
|
|
52770
53014
|
persistDirectory(directory);
|
|
52771
53015
|
return;
|
|
52772
53016
|
}
|
|
52773
|
-
const temporaryPath =
|
|
53017
|
+
const temporaryPath = join27(
|
|
52774
53018
|
directory,
|
|
52775
53019
|
`.${quarantineId}.${String(process.pid)}.${randomBytes7(8).toString("hex")}.tmp`
|
|
52776
53020
|
);
|
|
@@ -52802,7 +53046,7 @@ function quarantineMove(flushingPath, move, reason, now = Date.now, options = {}
|
|
|
52802
53046
|
reason,
|
|
52803
53047
|
move
|
|
52804
53048
|
};
|
|
52805
|
-
const path9 =
|
|
53049
|
+
const path9 = join27(directory, `${record3.quarantineId}.json`);
|
|
52806
53050
|
persistDeadLetter(directory, path9, record3.quarantineId, record3, persistDirectory);
|
|
52807
53051
|
return record3;
|
|
52808
53052
|
}
|
|
@@ -53226,7 +53470,7 @@ async function flushOnce() {
|
|
|
53226
53470
|
return inspection.retainedBuckets.length > 0 ? { flushed: total, quarantined, retained: inspection.retainedBuckets } : { flushed: total, quarantined };
|
|
53227
53471
|
}
|
|
53228
53472
|
var flushInFlight;
|
|
53229
|
-
var FLUSH_LOCK_PATH =
|
|
53473
|
+
var FLUSH_LOCK_PATH = join28(dirname15(JOURNAL_DIR), ".flush.lock");
|
|
53230
53474
|
var FLUSH_LOCK_TIMEOUT_MS = 250;
|
|
53231
53475
|
function isFlushLockContended(error) {
|
|
53232
53476
|
return error instanceof Error && error.message.startsWith("timed out waiting for file lock");
|
|
@@ -53358,19 +53602,19 @@ function registerMovesCommands(program3) {
|
|
|
53358
53602
|
}
|
|
53359
53603
|
});
|
|
53360
53604
|
moves.command("bind").description("Pin the current directory to an org via .prim/workspace.json").requiredOption("--orgId <orgId>", "Convex organization id").action((opts) => {
|
|
53361
|
-
const dir =
|
|
53362
|
-
if (!
|
|
53605
|
+
const dir = join29(process.cwd(), ".prim");
|
|
53606
|
+
if (!existsSync21(dir)) {
|
|
53363
53607
|
mkdirSync13(dir, { recursive: true, mode: DIR_MODE });
|
|
53364
53608
|
}
|
|
53365
|
-
const file =
|
|
53609
|
+
const file = join29(process.cwd(), WORKSPACE_FILE);
|
|
53366
53610
|
writeFileSync9(file, JSON.stringify({ orgId: opts.orgId, boundAt: Date.now() }, null, 2), {
|
|
53367
53611
|
mode: FILE_MODE4
|
|
53368
53612
|
});
|
|
53369
53613
|
console.log(`[prim] bound ${process.cwd()} to org ${opts.orgId}`);
|
|
53370
53614
|
});
|
|
53371
53615
|
moves.command("drop").description("Remove the .prim/workspace.json binding from the cwd").action(() => {
|
|
53372
|
-
const file =
|
|
53373
|
-
if (!
|
|
53616
|
+
const file = join29(process.cwd(), WORKSPACE_FILE);
|
|
53617
|
+
if (!existsSync21(file)) {
|
|
53374
53618
|
console.log("[prim] no workspace binding in cwd");
|
|
53375
53619
|
return;
|
|
53376
53620
|
}
|
|
@@ -53500,31 +53744,31 @@ function registerReconcileCommands(program3) {
|
|
|
53500
53744
|
|
|
53501
53745
|
// src/commands/session.ts
|
|
53502
53746
|
import {
|
|
53503
|
-
existsSync as
|
|
53747
|
+
existsSync as existsSync23,
|
|
53504
53748
|
mkdirSync as mkdirSync14,
|
|
53505
53749
|
readFileSync as readFileSync22,
|
|
53506
53750
|
readdirSync as readdirSync9,
|
|
53507
53751
|
unlinkSync as unlinkSync8,
|
|
53508
53752
|
writeFileSync as writeFileSync10
|
|
53509
53753
|
} from "fs";
|
|
53510
|
-
import { join as
|
|
53754
|
+
import { join as join31 } from "path";
|
|
53511
53755
|
|
|
53512
53756
|
// src/binding.ts
|
|
53513
|
-
import { existsSync as
|
|
53514
|
-
import { dirname as dirname16, join as
|
|
53757
|
+
import { existsSync as existsSync22, readFileSync as readFileSync21 } from "fs";
|
|
53758
|
+
import { dirname as dirname16, join as join30 } from "path";
|
|
53515
53759
|
var PRIM_CONFIG_DIR = primConfigDirectory();
|
|
53516
|
-
var SESSIONS_DIR =
|
|
53760
|
+
var SESSIONS_DIR = join30(PRIM_CONFIG_DIR, "sessions");
|
|
53517
53761
|
|
|
53518
53762
|
// src/commands/session.ts
|
|
53519
53763
|
var DIR_MODE2 = 448;
|
|
53520
53764
|
var FILE_MODE5 = 384;
|
|
53521
53765
|
function ensureDir() {
|
|
53522
|
-
if (!
|
|
53766
|
+
if (!existsSync23(SESSIONS_DIR)) {
|
|
53523
53767
|
mkdirSync14(SESSIONS_DIR, { recursive: true, mode: DIR_MODE2 });
|
|
53524
53768
|
}
|
|
53525
53769
|
}
|
|
53526
53770
|
function markerPath(sessionId) {
|
|
53527
|
-
return
|
|
53771
|
+
return join31(SESSIONS_DIR, `${sessionId}.json`);
|
|
53528
53772
|
}
|
|
53529
53773
|
function registerSessionCommands(program3) {
|
|
53530
53774
|
const session = program3.command("session").description("Decision Event Pipeline \u2014 session binding markers");
|
|
@@ -53540,7 +53784,7 @@ function registerSessionCommands(program3) {
|
|
|
53540
53784
|
console.log(`[prim] session ${sessionId} bound to org ${opts.orgId}`);
|
|
53541
53785
|
});
|
|
53542
53786
|
session.command("list").description("List active session markers").action(() => {
|
|
53543
|
-
if (!
|
|
53787
|
+
if (!existsSync23(SESSIONS_DIR)) {
|
|
53544
53788
|
console.log("[prim] no session markers");
|
|
53545
53789
|
return;
|
|
53546
53790
|
}
|
|
@@ -53552,7 +53796,7 @@ function registerSessionCommands(program3) {
|
|
|
53552
53796
|
for (const f of files) {
|
|
53553
53797
|
const sessionId = f.replace(/\.json$/, "");
|
|
53554
53798
|
try {
|
|
53555
|
-
const m = JSON.parse(readFileSync22(
|
|
53799
|
+
const m = JSON.parse(readFileSync22(join31(SESSIONS_DIR, f), "utf-8"));
|
|
53556
53800
|
console.log(`${sessionId} org=${m.orgId}`);
|
|
53557
53801
|
} catch {
|
|
53558
53802
|
}
|
|
@@ -53560,7 +53804,7 @@ function registerSessionCommands(program3) {
|
|
|
53560
53804
|
});
|
|
53561
53805
|
session.command("drop <sessionId>").description("Remove a session marker").action((sessionId) => {
|
|
53562
53806
|
const p = markerPath(sessionId);
|
|
53563
|
-
if (!
|
|
53807
|
+
if (!existsSync23(p)) {
|
|
53564
53808
|
console.log(`[prim] no marker for session ${sessionId}`);
|
|
53565
53809
|
return;
|
|
53566
53810
|
}
|
|
@@ -53571,8 +53815,8 @@ function registerSessionCommands(program3) {
|
|
|
53571
53815
|
|
|
53572
53816
|
// src/commands/setup.ts
|
|
53573
53817
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
53574
|
-
import { existsSync as
|
|
53575
|
-
import { join as
|
|
53818
|
+
import { existsSync as existsSync24, readFileSync as readFileSync23 } from "fs";
|
|
53819
|
+
import { join as join32 } from "path";
|
|
53576
53820
|
var EXIT_INCOMPLETE = 1;
|
|
53577
53821
|
var EXIT_USAGE3 = 2;
|
|
53578
53822
|
var SETUP_ORCHESTRATOR_ENV = "PRIM_SETUP_ORCHESTRATOR";
|
|
@@ -53710,8 +53954,8 @@ function detectProjectConflicts(agent, run, globalHooksActive) {
|
|
|
53710
53954
|
let preCommit;
|
|
53711
53955
|
try {
|
|
53712
53956
|
const root = gitToplevel();
|
|
53713
|
-
const path9 = root &&
|
|
53714
|
-
if (path9 &&
|
|
53957
|
+
const path9 = root && join32(root, ".git", "hooks", "pre-commit");
|
|
53958
|
+
if (path9 && existsSync24(path9)) preCommit = readFileSync23(path9, "utf-8");
|
|
53715
53959
|
} catch {
|
|
53716
53960
|
}
|
|
53717
53961
|
if (projectHooksConflict(globalHooksActive, preCommit)) conflicts.push(CONFLICT_HOOKS);
|
|
@@ -53728,6 +53972,7 @@ function detectAgent(env4) {
|
|
|
53728
53972
|
if (env4.HERMES_INTERACTIVE) {
|
|
53729
53973
|
return "hermes";
|
|
53730
53974
|
}
|
|
53975
|
+
if (env4.CODEX_THREAD_ID) return "codex";
|
|
53731
53976
|
if (env4.CURSOR_AGENT) {
|
|
53732
53977
|
return "cursor";
|
|
53733
53978
|
}
|
|
@@ -53762,7 +54007,7 @@ function registerSetupCommand(program3, dependencies = {}) {
|
|
|
53762
54007
|
).option(
|
|
53763
54008
|
"--migrate",
|
|
53764
54009
|
"with the default user scope, remove any project-scoped prim config in this repo (else just warn)"
|
|
53765
|
-
).option("--no-daemon", "stop and disable the companion daemon").option("--details", "show full installation diagnostics
|
|
54010
|
+
).option("--no-daemon", "stop and disable the companion daemon").option("--details", "show full human installation diagnostics on STDERR").option("--skip-demo", "skip the optional author story and remember that choice").action((opts) => {
|
|
53766
54011
|
const { agent: agentInput, detected } = resolveAgent(opts.agent, process.env);
|
|
53767
54012
|
if (agentInput !== "claude" && agentInput !== "codex" && agentInput !== "cursor" && agentInput !== "hermes") {
|
|
53768
54013
|
process.stderr.write(
|
|
@@ -53788,25 +54033,21 @@ function registerSetupCommand(program3, dependencies = {}) {
|
|
|
53788
54033
|
const self = process.argv[1];
|
|
53789
54034
|
const globals = program3.optsWithGlobals();
|
|
53790
54035
|
const run = dependencies.run ?? ((args, capture = false) => {
|
|
53791
|
-
const compact = !opts.details;
|
|
53792
|
-
const structuredChild = args.includes("demo") || args[0] === "welcome";
|
|
53793
54036
|
const childArgs = opts.details ? args.filter((arg) => arg !== "--compact") : args;
|
|
53794
54037
|
const r = spawnSync2(
|
|
53795
54038
|
process.execPath,
|
|
53796
54039
|
[self, ...childArgs],
|
|
53797
54040
|
setupStepSpawnOptions(capture, process.env, {
|
|
53798
54041
|
startsDaemon: opts.daemon,
|
|
53799
|
-
compact:
|
|
54042
|
+
compact: true
|
|
53800
54043
|
})
|
|
53801
54044
|
);
|
|
53802
|
-
if (!capture &&
|
|
53803
|
-
process.stdout.write(r.stdout);
|
|
53804
|
-
if (!capture && compact && r.status !== 0 && r.stdout) process.stderr.write(r.stdout);
|
|
54045
|
+
if (!capture && r.status !== 0 && r.stdout) process.stderr.write(r.stdout);
|
|
53805
54046
|
if (r.error) process.stderr.write(`[prim] ${r.error.message}
|
|
53806
54047
|
`);
|
|
53807
54048
|
return {
|
|
53808
54049
|
code: r.status ?? 1,
|
|
53809
|
-
stdout:
|
|
54050
|
+
stdout: r.stdout ?? ""
|
|
53810
54051
|
};
|
|
53811
54052
|
});
|
|
53812
54053
|
const results = {};
|
|
@@ -53887,11 +54128,13 @@ function registerSetupCommand(program3, dependencies = {}) {
|
|
|
53887
54128
|
const { code } = run(enableArgs);
|
|
53888
54129
|
results[enableStep.key] = code === 0 ? "ok" : enableStep.required ? "failed" : "skipped";
|
|
53889
54130
|
}
|
|
54131
|
+
let health;
|
|
53890
54132
|
const healthStep = setupSteps.find((candidate) => candidate.key === "health");
|
|
53891
54133
|
if (healthStep) {
|
|
53892
54134
|
note(`${healthStep.label} \xB7 verifying\u2026`);
|
|
53893
|
-
const { code } = run(healthStep.args);
|
|
53894
|
-
|
|
54135
|
+
const { code, stdout } = run(healthStep.args);
|
|
54136
|
+
health = setupChildPayload(stdout);
|
|
54137
|
+
results[healthStep.key] = code !== 0 || health?.status === "fail" ? healthStep.required ? "failed" : "skipped" : health?.status === "warn" ? "warn" : "ok";
|
|
53895
54138
|
}
|
|
53896
54139
|
const installationSucceeded = !Object.values(results).includes("failed");
|
|
53897
54140
|
let tourDue = false;
|
|
@@ -53930,6 +54173,7 @@ function registerSetupCommand(program3, dependencies = {}) {
|
|
|
53930
54173
|
const demoResult = run([
|
|
53931
54174
|
...globals.nonInteractive ? ["--non-interactive"] : [],
|
|
53932
54175
|
"demo",
|
|
54176
|
+
"--resume-pending",
|
|
53933
54177
|
...agentDriven ? ["--agent", agent] : []
|
|
53934
54178
|
]);
|
|
53935
54179
|
onboarding = setupChildPayload(demoResult.stdout) ?? {
|
|
@@ -53946,6 +54190,16 @@ function registerSetupCommand(program3, dependencies = {}) {
|
|
|
53946
54190
|
setup: true,
|
|
53947
54191
|
status: failed.length ? "incomplete" : "complete",
|
|
53948
54192
|
steps: results,
|
|
54193
|
+
...health ? { health } : {},
|
|
54194
|
+
readiness: {
|
|
54195
|
+
installation: failed.length ? "incomplete" : "installed",
|
|
54196
|
+
health: results.health ?? "not-checked",
|
|
54197
|
+
passiveCapture: "not-verified",
|
|
54198
|
+
onboarding: onboarding?.stage ?? (opts.skipDemo ? "skipped" : "not-due")
|
|
54199
|
+
},
|
|
54200
|
+
...onboarding?.nextAction ? {
|
|
54201
|
+
instructions: "Setup installation is complete. Continue nextAction now; onboarding is pending. Render each presentation once. Do not stop at welcome, repeat raw output, or claim passive capture is verified."
|
|
54202
|
+
} : {},
|
|
53949
54203
|
welcome: setupChildPayload(welcomeResult.stdout),
|
|
53950
54204
|
...onboarding ? { onboarding, nextAction: onboarding.nextAction } : {}
|
|
53951
54205
|
});
|
|
@@ -53966,7 +54220,7 @@ import { createHash as createHash13 } from "crypto";
|
|
|
53966
54220
|
import {
|
|
53967
54221
|
constants as constants8,
|
|
53968
54222
|
closeSync as closeSync8,
|
|
53969
|
-
existsSync as
|
|
54223
|
+
existsSync as existsSync26,
|
|
53970
54224
|
fstatSync as fstatSync4,
|
|
53971
54225
|
lstatSync as lstatSync11,
|
|
53972
54226
|
openSync as openSync8,
|
|
@@ -53977,7 +54231,7 @@ import {
|
|
|
53977
54231
|
unlinkSync as unlinkSync9
|
|
53978
54232
|
} from "fs";
|
|
53979
54233
|
import { homedir as homedir11 } from "os";
|
|
53980
|
-
import { dirname as dirname18, join as
|
|
54234
|
+
import { dirname as dirname18, join as join34, resolve as resolve11 } from "path";
|
|
53981
54235
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
53982
54236
|
|
|
53983
54237
|
// src/commands/claude-plugin.ts
|
|
@@ -53985,7 +54239,7 @@ import { createHash as createHash12 } from "crypto";
|
|
|
53985
54239
|
import {
|
|
53986
54240
|
constants as constants7,
|
|
53987
54241
|
closeSync as closeSync7,
|
|
53988
|
-
existsSync as
|
|
54242
|
+
existsSync as existsSync25,
|
|
53989
54243
|
fstatSync as fstatSync3,
|
|
53990
54244
|
lstatSync as lstatSync10,
|
|
53991
54245
|
mkdirSync as mkdirSync15,
|
|
@@ -53998,15 +54252,15 @@ import {
|
|
|
53998
54252
|
rmdirSync as rmdirSync3
|
|
53999
54253
|
} from "fs";
|
|
54000
54254
|
import { homedir as homedir10 } from "os";
|
|
54001
|
-
import { dirname as dirname17, isAbsolute as isAbsolute9, join as
|
|
54255
|
+
import { dirname as dirname17, isAbsolute as isAbsolute9, join as join33, relative as relative3, resolve as resolve10, sep as sep3 } from "path";
|
|
54002
54256
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
54003
54257
|
var __dirname4 = dirname17(fileURLToPath4(import.meta.url));
|
|
54004
54258
|
var PLUGIN_DESCRIPTION = "Primitive decision-graph guidance for the prim CLI \u2014 a model-invoked skill installed by prim skill install.";
|
|
54005
54259
|
var MAX_MANIFEST_BYTES2 = 64 * 1024;
|
|
54006
54260
|
var MAX_SKILL_BYTES = 1024 * 1024;
|
|
54007
54261
|
function pluginDirFor(cwd, scope) {
|
|
54008
|
-
const base = scope === "user" ?
|
|
54009
|
-
return
|
|
54262
|
+
const base = scope === "user" ? join33(homedir10(), ".claude") : join33(gitToplevel(cwd) ?? cwd, ".claude");
|
|
54263
|
+
return join33(base, "skills", "prim");
|
|
54010
54264
|
}
|
|
54011
54265
|
function resolvePluginDir(cwd, scope) {
|
|
54012
54266
|
if (scope && scope !== "user" && scope !== "project") {
|
|
@@ -54019,7 +54273,7 @@ function packageVersion2() {
|
|
|
54019
54273
|
let dir = __dirname4;
|
|
54020
54274
|
while (dir !== dirname17(dir)) {
|
|
54021
54275
|
const p = resolve10(dir, "package.json");
|
|
54022
|
-
if (
|
|
54276
|
+
if (existsSync25(p)) return JSON.parse(readFileSync24(p, "utf-8")).version;
|
|
54023
54277
|
dir = dirname17(dir);
|
|
54024
54278
|
}
|
|
54025
54279
|
return "0.0.0";
|
|
@@ -54034,12 +54288,12 @@ function renderClaudePlugin() {
|
|
|
54034
54288
|
return { manifest: pluginManifest(version), skill: loadSkill(), version };
|
|
54035
54289
|
}
|
|
54036
54290
|
function removeDirIfEmpty(dir) {
|
|
54037
|
-
if (
|
|
54291
|
+
if (existsSync25(dir) && readdirSync10(dir).length === 0) rmdirSync3(dir);
|
|
54038
54292
|
}
|
|
54039
54293
|
function pluginPaths(dir) {
|
|
54040
54294
|
return {
|
|
54041
|
-
manifestPath:
|
|
54042
|
-
skillPath:
|
|
54295
|
+
manifestPath: join33(dir, ".claude-plugin", "plugin.json"),
|
|
54296
|
+
skillPath: join33(dir, "SKILL.md")
|
|
54043
54297
|
};
|
|
54044
54298
|
}
|
|
54045
54299
|
function installClaudePlugin(cwd, opts) {
|
|
@@ -54047,8 +54301,8 @@ function installClaudePlugin(cwd, opts) {
|
|
|
54047
54301
|
if (dir === null) return 1;
|
|
54048
54302
|
const { manifestPath, skillPath } = pluginPaths(dir);
|
|
54049
54303
|
const { manifest, skill } = renderClaudePlugin();
|
|
54050
|
-
const manifestCurrent =
|
|
54051
|
-
const skillCurrent =
|
|
54304
|
+
const manifestCurrent = existsSync25(manifestPath) ? readFileSync24(manifestPath, "utf-8") : null;
|
|
54305
|
+
const skillCurrent = existsSync25(skillPath) ? readFileSync24(skillPath, "utf-8") : null;
|
|
54052
54306
|
if (manifestCurrent === manifest && skillCurrent === skill) {
|
|
54053
54307
|
console.log("No changes \u2014 prim skill plugin already up to date.");
|
|
54054
54308
|
return 0;
|
|
@@ -54057,7 +54311,7 @@ function installClaudePlugin(cwd, opts) {
|
|
|
54057
54311
|
console.log(`Would write plugin to ${dir} (.claude-plugin/plugin.json + SKILL.md)`);
|
|
54058
54312
|
return 0;
|
|
54059
54313
|
}
|
|
54060
|
-
mkdirSync15(
|
|
54314
|
+
mkdirSync15(join33(dir, ".claude-plugin"), { recursive: true });
|
|
54061
54315
|
atomicWrite5(manifestPath, manifest);
|
|
54062
54316
|
atomicWrite5(skillPath, skill);
|
|
54063
54317
|
console.log(`Installed prim skill plugin at ${dir}`);
|
|
@@ -54071,13 +54325,13 @@ function uninstallClaudePlugin(cwd, opts) {
|
|
|
54071
54325
|
const dir = resolvePluginDir(cwd, opts.scope);
|
|
54072
54326
|
if (dir === null) return 1;
|
|
54073
54327
|
const { manifestPath, skillPath } = pluginPaths(dir);
|
|
54074
|
-
if (!
|
|
54328
|
+
if (!existsSync25(manifestPath) && !existsSync25(skillPath)) {
|
|
54075
54329
|
console.log(`prim skill plugin not present at ${dir}`);
|
|
54076
54330
|
return 0;
|
|
54077
54331
|
}
|
|
54078
54332
|
rmSync9(manifestPath, { force: true });
|
|
54079
54333
|
rmSync9(skillPath, { force: true });
|
|
54080
|
-
removeDirIfEmpty(
|
|
54334
|
+
removeDirIfEmpty(join33(dir, ".claude-plugin"));
|
|
54081
54335
|
removeDirIfEmpty(dir);
|
|
54082
54336
|
console.log(`Removed prim skill plugin from ${dir}`);
|
|
54083
54337
|
return 0;
|
|
@@ -54086,7 +54340,7 @@ function statusClaudePlugin(cwd, opts) {
|
|
|
54086
54340
|
const dir = resolvePluginDir(cwd, opts.scope);
|
|
54087
54341
|
if (dir === null) return 1;
|
|
54088
54342
|
const { skillPath } = pluginPaths(dir);
|
|
54089
|
-
const installed =
|
|
54343
|
+
const installed = existsSync25(skillPath);
|
|
54090
54344
|
if (opts.json) {
|
|
54091
54345
|
printJson({ installed, target: dir });
|
|
54092
54346
|
return installed ? 0 : 1;
|
|
@@ -54128,14 +54382,14 @@ function sha2563(content) {
|
|
|
54128
54382
|
}
|
|
54129
54383
|
function cursorSkillDirectory(cwd, scope) {
|
|
54130
54384
|
const base = scope === "user" ? cursorConfigDirectory() : gitToplevel(cwd) ?? cwd;
|
|
54131
|
-
return
|
|
54385
|
+
return join34(base, scope === "user" ? "skills" : ".cursor/skills", "prim");
|
|
54132
54386
|
}
|
|
54133
54387
|
function cursorSkillPaths(cwd, scope) {
|
|
54134
54388
|
const directory = cursorSkillDirectory(cwd, scope);
|
|
54135
54389
|
return {
|
|
54136
54390
|
directory,
|
|
54137
|
-
skill:
|
|
54138
|
-
manifest:
|
|
54391
|
+
skill: join34(directory, "SKILL.md"),
|
|
54392
|
+
manifest: join34(directory, CURSOR_SKILL_MANIFEST)
|
|
54139
54393
|
};
|
|
54140
54394
|
}
|
|
54141
54395
|
function readCursorSkillManifest(path9) {
|
|
@@ -54154,7 +54408,7 @@ function readCursorSkillManifest(path9) {
|
|
|
54154
54408
|
function cursorSkillStatus(cwd, scope) {
|
|
54155
54409
|
const paths = cursorSkillPaths(cwd, scope);
|
|
54156
54410
|
const manifest = readCursorSkillManifest(paths.manifest);
|
|
54157
|
-
const content =
|
|
54411
|
+
const content = existsSync26(paths.skill) ? readFileSync25(paths.skill, "utf8") : void 0;
|
|
54158
54412
|
const owned = manifest !== void 0;
|
|
54159
54413
|
const installed = owned && content !== void 0 && sha2563(content) === manifest.contentSha256;
|
|
54160
54414
|
return {
|
|
@@ -54172,8 +54426,8 @@ function validCursorSkillScope(scope) {
|
|
|
54172
54426
|
function installCursorSkill(cwd, opts) {
|
|
54173
54427
|
const paths = cursorSkillPaths(cwd, opts.scope);
|
|
54174
54428
|
const status = cursorSkillStatus(cwd, opts.scope);
|
|
54175
|
-
const manifestExists =
|
|
54176
|
-
const skillExists =
|
|
54429
|
+
const manifestExists = existsSync26(paths.manifest);
|
|
54430
|
+
const skillExists = existsSync26(paths.skill);
|
|
54177
54431
|
if (manifestExists && !status.owned || !manifestExists && skillExists || status.edited) {
|
|
54178
54432
|
console.error(`Refusing to overwrite a foreign or edited Cursor skill at ${paths.skill}`);
|
|
54179
54433
|
return 1;
|
|
@@ -54210,8 +54464,8 @@ function uninstallCursorSkill(cwd, scope) {
|
|
|
54210
54464
|
console.error(`Refusing to remove an edited Cursor skill at ${paths.skill}`);
|
|
54211
54465
|
return 1;
|
|
54212
54466
|
}
|
|
54213
|
-
if (
|
|
54214
|
-
if (
|
|
54467
|
+
if (existsSync26(paths.skill)) unlinkSync9(paths.skill);
|
|
54468
|
+
if (existsSync26(paths.manifest)) unlinkSync9(paths.manifest);
|
|
54215
54469
|
try {
|
|
54216
54470
|
if (readdirSync11(paths.directory).length === 0) rmdirSync4(paths.directory);
|
|
54217
54471
|
} catch {
|
|
@@ -54220,10 +54474,10 @@ function uninstallCursorSkill(cwd, scope) {
|
|
|
54220
54474
|
return 0;
|
|
54221
54475
|
}
|
|
54222
54476
|
function userTargetFor(agent) {
|
|
54223
|
-
if (agent === "claude") return
|
|
54224
|
-
if (agent === "codex") return
|
|
54477
|
+
if (agent === "claude") return join34(homedir11(), ".claude", "CLAUDE.md");
|
|
54478
|
+
if (agent === "codex") return join34(homedir11(), ".codex", "AGENTS.md");
|
|
54225
54479
|
if (agent === "hermes") {
|
|
54226
|
-
return
|
|
54480
|
+
return join34(process.env.HERMES_HOME ?? join34(homedir11(), ".hermes"), ".hermes.md");
|
|
54227
54481
|
}
|
|
54228
54482
|
return null;
|
|
54229
54483
|
}
|
|
@@ -54231,13 +54485,13 @@ function loadSkill() {
|
|
|
54231
54485
|
let dir = __dirname5;
|
|
54232
54486
|
while (dir !== dirname18(dir)) {
|
|
54233
54487
|
const p = resolve11(dir, "SKILL.md");
|
|
54234
|
-
if (
|
|
54488
|
+
if (existsSync26(p)) return readFileSync25(p, "utf-8");
|
|
54235
54489
|
dir = dirname18(dir);
|
|
54236
54490
|
}
|
|
54237
54491
|
throw new Error("SKILL.md not found in package");
|
|
54238
54492
|
}
|
|
54239
54493
|
function detectTargets(cwd) {
|
|
54240
|
-
return TARGET_CANDIDATES.filter((p) =>
|
|
54494
|
+
return TARGET_CANDIDATES.filter((p) => existsSync26(resolve11(cwd, p)));
|
|
54241
54495
|
}
|
|
54242
54496
|
function detectNewline(content) {
|
|
54243
54497
|
return content.includes("\r\n") ? "\r\n" : "\n";
|
|
@@ -54303,7 +54557,7 @@ function runInstall(cwd, opts) {
|
|
|
54303
54557
|
}
|
|
54304
54558
|
const target = resolveTarget(cwd, opts);
|
|
54305
54559
|
if (target === null) return 1;
|
|
54306
|
-
const existing =
|
|
54560
|
+
const existing = existsSync26(target) ? readFileSync25(target, "utf-8") : "";
|
|
54307
54561
|
const eol = existing ? detectNewline(existing) : "\n";
|
|
54308
54562
|
const block = composeBlock(loadSkill(), eol);
|
|
54309
54563
|
const next = applyBlock(existing, block, eol);
|
|
@@ -54327,7 +54581,7 @@ function runUninstall(cwd, opts) {
|
|
|
54327
54581
|
}
|
|
54328
54582
|
const target = resolveTarget(cwd, opts);
|
|
54329
54583
|
if (target === null) return 1;
|
|
54330
|
-
if (!
|
|
54584
|
+
if (!existsSync26(target)) {
|
|
54331
54585
|
console.log(`Skill block not present at ${target}`);
|
|
54332
54586
|
return 0;
|
|
54333
54587
|
}
|
|
@@ -54355,7 +54609,7 @@ function runStatus(cwd, opts) {
|
|
|
54355
54609
|
}
|
|
54356
54610
|
const target = resolveTarget(cwd, opts);
|
|
54357
54611
|
if (target === null) return 1;
|
|
54358
|
-
const fileExists =
|
|
54612
|
+
const fileExists = existsSync26(target);
|
|
54359
54613
|
let installed = false;
|
|
54360
54614
|
if (fileExists) {
|
|
54361
54615
|
const content = readFileSync25(target, "utf-8");
|
|
@@ -54821,7 +55075,7 @@ function registerWelcomeCommand(program3, deps = { getClient }) {
|
|
|
54821
55075
|
const agent = resolveWelcomeAgent(options.agent, process.env);
|
|
54822
55076
|
if (options.deferSeeding) {
|
|
54823
55077
|
process.stderr.write(
|
|
54824
|
-
"
|
|
55078
|
+
"Primitive installed \u2192 session isolation next \u2192 story \u2192 real Decisions. Follow setup\u2019s nextAction.\n"
|
|
54825
55079
|
);
|
|
54826
55080
|
printJson({ welcomed: true, onboarding: "demo", seedingDeferred: true });
|
|
54827
55081
|
return;
|
|
@@ -54978,10 +55232,10 @@ import { spawn as spawn5 } from "child_process";
|
|
|
54978
55232
|
import { readFileSync as readFileSync27 } from "fs";
|
|
54979
55233
|
|
|
54980
55234
|
// src/daemon/health.ts
|
|
54981
|
-
import { chmodSync as chmodSync8, existsSync as
|
|
54982
|
-
import { dirname as dirname20, join as
|
|
55235
|
+
import { chmodSync as chmodSync8, existsSync as existsSync27, mkdirSync as mkdirSync16, renameSync as renameSync7, writeFileSync as writeFileSync11 } from "fs";
|
|
55236
|
+
import { dirname as dirname20, join as join35 } from "path";
|
|
54983
55237
|
var HEARTBEAT_FRESH_MS = 9e4;
|
|
54984
|
-
var DAEMON_HEALTH_PATH =
|
|
55238
|
+
var DAEMON_HEALTH_PATH = join35(primConfigDirectory(), "daemon-health.json");
|
|
54985
55239
|
|
|
54986
55240
|
// src/lib/background-flush.ts
|
|
54987
55241
|
function record2(value) {
|