@primitive.ai/prim 0.1.0-alpha.94 → 0.1.0-alpha.96

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.
Files changed (40) hide show
  1. package/README.md +7 -4
  2. package/dist/{chunk-UKUAAAXE.js → chunk-27ADT6FQ.js} +2 -2
  3. package/dist/{chunk-OTHKG76J.js → chunk-35FMRWJH.js} +1 -1
  4. package/dist/{chunk-DXJQR4QI.js → chunk-4GHANPWQ.js} +2 -2
  5. package/dist/{chunk-WUXFLE7X.js → chunk-7KABYYWG.js} +64 -66
  6. package/dist/{chunk-LFFLHSQO.js → chunk-CU7RW7XU.js} +63 -6
  7. package/dist/{chunk-H4UNYFUC.js → chunk-DHOQGHKQ.js} +184 -1
  8. package/dist/{chunk-2GP5UFV7.js → chunk-DWRSEC34.js} +5 -3
  9. package/dist/{chunk-O7YAW7G6.js → chunk-FVDBULGZ.js} +9 -11
  10. package/dist/{chunk-G2VMA2QO.js → chunk-LY6NJ7KL.js} +6 -4
  11. package/dist/{chunk-ZB4F75SZ.js → chunk-MXVCP33E.js} +5 -1
  12. package/dist/{chunk-TYAHC25F.js → chunk-QCBB5HFX.js} +1 -1
  13. package/dist/{chunk-IMK4JKTA.js → chunk-RK4ZS3HG.js} +2 -2
  14. package/dist/{chunk-ZU563PQI.js → chunk-ROLYLXJS.js} +2 -2
  15. package/dist/{chunk-OH3EZXYX.js → chunk-UO2U6IKF.js} +1 -1
  16. package/dist/{chunk-K7D2EYBS.js → chunk-URLLSALP.js} +2 -2
  17. package/dist/{chunk-FXF4JWK2.js → chunk-XEDJ5N3M.js} +17 -2
  18. package/dist/{chunk-AXQQMX2U.js → chunk-Y5W4TZM7.js} +2 -2
  19. package/dist/{chunk-ICM2XCXS.js → chunk-YYE2NLWX.js} +2 -2
  20. package/dist/{chunk-DSWT6BCC.js → chunk-Z6NPNLOT.js} +825 -665
  21. package/dist/daemon/server.js +836 -540
  22. package/dist/hook-runtime/daemon/server.js +836 -540
  23. package/dist/hook-runtime/hooks/post-commit.js +836 -540
  24. package/dist/hook-runtime/hooks/post-rewrite.js +836 -540
  25. package/dist/hook-runtime/hooks/post-tool-use.js +1160 -791
  26. package/dist/hook-runtime/hooks/pre-tool-use.js +2060 -1751
  27. package/dist/hook-runtime/hooks/prim-hook.js +1257 -856
  28. package/dist/hook-runtime/hooks/session-end.js +179 -129
  29. package/dist/hook-runtime/hooks/session-start.js +938 -640
  30. package/dist/hook-runtime/index.js +892 -554
  31. package/dist/hooks/post-commit.js +11 -11
  32. package/dist/hooks/post-rewrite.js +10 -10
  33. package/dist/hooks/post-tool-use.js +20 -20
  34. package/dist/hooks/pre-commit.js +4 -4
  35. package/dist/hooks/pre-tool-use.js +29 -17
  36. package/dist/hooks/prim-hook.js +22 -18
  37. package/dist/hooks/session-end.js +11 -5
  38. package/dist/hooks/session-start.js +26 -22
  39. package/dist/index.js +79 -60
  40. package/package.json +1 -1
@@ -53,8 +53,8 @@ var require_ucs2length = __commonJS({
53
53
 
54
54
  // src/hooks/prim-hook.ts
55
55
  import { spawn } from "child_process";
56
- import { readFileSync as readFileSync15 } from "fs";
57
- import { dirname as dirname12, join as join17 } from "path";
56
+ import { readFileSync as readFileSync16 } from "fs";
57
+ import { dirname as dirname13, join as join18 } from "path";
58
58
  import { fileURLToPath as fileURLToPath2 } from "url";
59
59
 
60
60
  // src/binding.ts
@@ -613,14 +613,14 @@ function throwIfAborted(signal) {
613
613
  }
614
614
  async function defaultSleep(ms, signal) {
615
615
  if (!signal) {
616
- await new Promise((resolve6) => setTimeout(resolve6, ms));
616
+ await new Promise((resolve7) => setTimeout(resolve7, ms));
617
617
  return;
618
618
  }
619
619
  throwIfAborted(signal);
620
- await new Promise((resolve6, reject) => {
620
+ await new Promise((resolve7, reject) => {
621
621
  const timer = setTimeout(() => {
622
622
  signal.removeEventListener("abort", onAbort);
623
- resolve6();
623
+ resolve7();
624
624
  }, ms);
625
625
  const onAbort = () => {
626
626
  clearTimeout(timer);
@@ -1467,6 +1467,31 @@ function canonicalGitRoot(cwd) {
1467
1467
  return null;
1468
1468
  }
1469
1469
  }
1470
+ function relatedWorktreeTarget(path, cwd, origin) {
1471
+ let parent = dirname7(resolve2(cwd, path));
1472
+ while (true) {
1473
+ try {
1474
+ realpathSync.native(parent);
1475
+ break;
1476
+ } catch {
1477
+ const next = dirname7(parent);
1478
+ if (next === parent) return null;
1479
+ parent = next;
1480
+ }
1481
+ }
1482
+ const target = resolveRepositoryContext(parent);
1483
+ if (!target || !target.repoKey || target.repoKey !== origin.repoKey) return null;
1484
+ const common = (root) => {
1485
+ const value = gitValue(root, ["rev-parse", "--git-common-dir"]);
1486
+ try {
1487
+ return value ? realpathSync.native(resolve2(root, value)) : void 0;
1488
+ } catch {
1489
+ return void 0;
1490
+ }
1491
+ };
1492
+ const originCommon = common(origin.repoRoot);
1493
+ return originCommon && originCommon === common(target.repoRoot) ? target : null;
1494
+ }
1470
1495
  function normalizeOriginRemote(remote) {
1471
1496
  const value = remote.trim();
1472
1497
  if (!value) return void 0;
@@ -12756,7 +12781,6 @@ function validate45(data, { instancePath = "", parentData, parentDataProperty, r
12756
12781
  return errors === 0;
12757
12782
  }
12758
12783
  validate45.evaluated = { "dynamicProps": true, "dynamicItems": false };
12759
- var schema83 = { "anyOf": [{ "type": "object", "properties": { "error": { "type": "string", "const": "Unauthorized" } }, "required": ["error"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "const": "interactive_workos_authority_required" } }, "required": ["error"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "const": "feature_disabled" }, "feature": { "type": "string", "const": "github-connect" } }, "required": ["error", "feature"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "enum": ["github_connect_unavailable", "feature_check_unavailable"] }, "feature": { "type": "string", "const": "github-connect" } }, "required": ["error", "feature"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "const": "WorkOS identity authority is temporarily unavailable" } }, "required": ["error"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "const": "github_install_intent_conflict" } }, "required": ["error"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "const": "github_install_intent_rate_limited" }, "retryAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": ["error", "retryAt"], "additionalProperties": false }] };
12760
12784
  function validate46(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
12761
12785
  ;
12762
12786
  let vErrors = null;
@@ -12906,7 +12930,7 @@ function validate46(data, { instancePath = "", parentData, parentDataProperty, r
12906
12930
  if (errors === _errs12) {
12907
12931
  if (data && typeof data == "object" && !Array.isArray(data)) {
12908
12932
  let missing2;
12909
- if (data.error === void 0 && (missing2 = "error") || data.feature === void 0 && (missing2 = "feature")) {
12933
+ if (data.error === void 0 && (missing2 = "error")) {
12910
12934
  const err10 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/2/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" };
12911
12935
  if (vErrors === null) {
12912
12936
  vErrors = [err10];
@@ -12917,7 +12941,7 @@ function validate46(data, { instancePath = "", parentData, parentDataProperty, r
12917
12941
  } else {
12918
12942
  const _errs14 = errors;
12919
12943
  for (const key2 in data) {
12920
- if (!(key2 === "error" || key2 === "feature")) {
12944
+ if (!(key2 === "error")) {
12921
12945
  const err11 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/2/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" };
12922
12946
  if (vErrors === null) {
12923
12947
  vErrors = [err11];
@@ -12931,7 +12955,6 @@ function validate46(data, { instancePath = "", parentData, parentDataProperty, r
12931
12955
  if (_errs14 === errors) {
12932
12956
  if (data.error !== void 0) {
12933
12957
  let data2 = data.error;
12934
- const _errs15 = errors;
12935
12958
  if (typeof data2 !== "string") {
12936
12959
  const err12 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/2/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" };
12937
12960
  if (vErrors === null) {
@@ -12941,8 +12964,8 @@ function validate46(data, { instancePath = "", parentData, parentDataProperty, r
12941
12964
  }
12942
12965
  errors++;
12943
12966
  }
12944
- if ("feature_disabled" !== data2) {
12945
- const err13 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/2/properties/error/const", keyword: "const", params: { allowedValue: "feature_disabled" }, message: "must be equal to constant" };
12967
+ if ("github_connect_unavailable" !== data2) {
12968
+ const err13 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/2/properties/error/const", keyword: "const", params: { allowedValue: "github_connect_unavailable" }, message: "must be equal to constant" };
12946
12969
  if (vErrors === null) {
12947
12970
  vErrors = [err13];
12948
12971
  } else {
@@ -12950,45 +12973,15 @@ function validate46(data, { instancePath = "", parentData, parentDataProperty, r
12950
12973
  }
12951
12974
  errors++;
12952
12975
  }
12953
- var valid4 = _errs15 === errors;
12954
- } else {
12955
- var valid4 = true;
12956
- }
12957
- if (valid4) {
12958
- if (data.feature !== void 0) {
12959
- let data3 = data.feature;
12960
- const _errs17 = errors;
12961
- if (typeof data3 !== "string") {
12962
- const err14 = { instancePath: instancePath + "/feature", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/2/properties/feature/type", keyword: "type", params: { type: "string" }, message: "must be string" };
12963
- if (vErrors === null) {
12964
- vErrors = [err14];
12965
- } else {
12966
- vErrors.push(err14);
12967
- }
12968
- errors++;
12969
- }
12970
- if ("github-connect" !== data3) {
12971
- const err15 = { instancePath: instancePath + "/feature", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/2/properties/feature/const", keyword: "const", params: { allowedValue: "github-connect" }, message: "must be equal to constant" };
12972
- if (vErrors === null) {
12973
- vErrors = [err15];
12974
- } else {
12975
- vErrors.push(err15);
12976
- }
12977
- errors++;
12978
- }
12979
- var valid4 = _errs17 === errors;
12980
- } else {
12981
- var valid4 = true;
12982
- }
12983
12976
  }
12984
12977
  }
12985
12978
  }
12986
12979
  } else {
12987
- const err16 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/2/type", keyword: "type", params: { type: "object" }, message: "must be object" };
12980
+ const err14 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/2/type", keyword: "type", params: { type: "object" }, message: "must be object" };
12988
12981
  if (vErrors === null) {
12989
- vErrors = [err16];
12982
+ vErrors = [err14];
12990
12983
  } else {
12991
- vErrors.push(err16);
12984
+ vErrors.push(err14);
12992
12985
  }
12993
12986
  errors++;
12994
12987
  }
@@ -13000,148 +12993,117 @@ function validate46(data, { instancePath = "", parentData, parentDataProperty, r
13000
12993
  props0 = true;
13001
12994
  }
13002
12995
  }
13003
- const _errs19 = errors;
13004
- if (errors === _errs19) {
12996
+ const _errs17 = errors;
12997
+ if (errors === _errs17) {
13005
12998
  if (data && typeof data == "object" && !Array.isArray(data)) {
13006
12999
  let missing3;
13007
- if (data.error === void 0 && (missing3 = "error") || data.feature === void 0 && (missing3 = "feature")) {
13008
- const err17 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/3/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" };
13000
+ if (data.error === void 0 && (missing3 = "error")) {
13001
+ const err15 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/3/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" };
13009
13002
  if (vErrors === null) {
13010
- vErrors = [err17];
13003
+ vErrors = [err15];
13011
13004
  } else {
13012
- vErrors.push(err17);
13005
+ vErrors.push(err15);
13013
13006
  }
13014
13007
  errors++;
13015
13008
  } else {
13016
- const _errs21 = errors;
13009
+ const _errs19 = errors;
13017
13010
  for (const key3 in data) {
13018
- if (!(key3 === "error" || key3 === "feature")) {
13019
- const err18 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
13011
+ if (!(key3 === "error")) {
13012
+ const err16 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
13020
13013
  if (vErrors === null) {
13021
- vErrors = [err18];
13014
+ vErrors = [err16];
13022
13015
  } else {
13023
- vErrors.push(err18);
13016
+ vErrors.push(err16);
13024
13017
  }
13025
13018
  errors++;
13026
13019
  break;
13027
13020
  }
13028
13021
  }
13029
- if (_errs21 === errors) {
13022
+ if (_errs19 === errors) {
13030
13023
  if (data.error !== void 0) {
13031
- let data4 = data.error;
13032
- const _errs22 = errors;
13033
- if (typeof data4 !== "string") {
13034
- const err19 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/3/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" };
13024
+ let data3 = data.error;
13025
+ if (typeof data3 !== "string") {
13026
+ const err17 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/3/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" };
13035
13027
  if (vErrors === null) {
13036
- vErrors = [err19];
13028
+ vErrors = [err17];
13037
13029
  } else {
13038
- vErrors.push(err19);
13030
+ vErrors.push(err17);
13039
13031
  }
13040
13032
  errors++;
13041
13033
  }
13042
- if (!(data4 === "github_connect_unavailable" || data4 === "feature_check_unavailable")) {
13043
- const err20 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/3/properties/error/enum", keyword: "enum", params: { allowedValues: schema83.anyOf[3].properties.error.enum }, message: "must be equal to one of the allowed values" };
13034
+ if ("WorkOS identity authority is temporarily unavailable" !== data3) {
13035
+ const err18 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/3/properties/error/const", keyword: "const", params: { allowedValue: "WorkOS identity authority is temporarily unavailable" }, message: "must be equal to constant" };
13044
13036
  if (vErrors === null) {
13045
- vErrors = [err20];
13037
+ vErrors = [err18];
13046
13038
  } else {
13047
- vErrors.push(err20);
13039
+ vErrors.push(err18);
13048
13040
  }
13049
13041
  errors++;
13050
13042
  }
13051
- var valid5 = _errs22 === errors;
13052
- } else {
13053
- var valid5 = true;
13054
- }
13055
- if (valid5) {
13056
- if (data.feature !== void 0) {
13057
- let data5 = data.feature;
13058
- const _errs24 = errors;
13059
- if (typeof data5 !== "string") {
13060
- const err21 = { instancePath: instancePath + "/feature", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/3/properties/feature/type", keyword: "type", params: { type: "string" }, message: "must be string" };
13061
- if (vErrors === null) {
13062
- vErrors = [err21];
13063
- } else {
13064
- vErrors.push(err21);
13065
- }
13066
- errors++;
13067
- }
13068
- if ("github-connect" !== data5) {
13069
- const err22 = { instancePath: instancePath + "/feature", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/3/properties/feature/const", keyword: "const", params: { allowedValue: "github-connect" }, message: "must be equal to constant" };
13070
- if (vErrors === null) {
13071
- vErrors = [err22];
13072
- } else {
13073
- vErrors.push(err22);
13074
- }
13075
- errors++;
13076
- }
13077
- var valid5 = _errs24 === errors;
13078
- } else {
13079
- var valid5 = true;
13080
- }
13081
13043
  }
13082
13044
  }
13083
13045
  }
13084
13046
  } else {
13085
- const err23 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
13047
+ const err19 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
13086
13048
  if (vErrors === null) {
13087
- vErrors = [err23];
13049
+ vErrors = [err19];
13088
13050
  } else {
13089
- vErrors.push(err23);
13051
+ vErrors.push(err19);
13090
13052
  }
13091
13053
  errors++;
13092
13054
  }
13093
13055
  }
13094
- var _valid0 = _errs19 === errors;
13056
+ var _valid0 = _errs17 === errors;
13095
13057
  valid1 = valid1 || _valid0;
13096
13058
  if (_valid0) {
13097
13059
  if (props0 !== true) {
13098
13060
  props0 = true;
13099
13061
  }
13100
13062
  }
13101
- const _errs26 = errors;
13102
- if (errors === _errs26) {
13063
+ const _errs22 = errors;
13064
+ if (errors === _errs22) {
13103
13065
  if (data && typeof data == "object" && !Array.isArray(data)) {
13104
13066
  let missing4;
13105
13067
  if (data.error === void 0 && (missing4 = "error")) {
13106
- const err24 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/4/required", keyword: "required", params: { missingProperty: missing4 }, message: "must have required property '" + missing4 + "'" };
13068
+ const err20 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/4/required", keyword: "required", params: { missingProperty: missing4 }, message: "must have required property '" + missing4 + "'" };
13107
13069
  if (vErrors === null) {
13108
- vErrors = [err24];
13070
+ vErrors = [err20];
13109
13071
  } else {
13110
- vErrors.push(err24);
13072
+ vErrors.push(err20);
13111
13073
  }
13112
13074
  errors++;
13113
13075
  } else {
13114
- const _errs28 = errors;
13076
+ const _errs24 = errors;
13115
13077
  for (const key4 in data) {
13116
13078
  if (!(key4 === "error")) {
13117
- const err25 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/4/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key4 }, message: "must NOT have additional properties" };
13079
+ const err21 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/4/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key4 }, message: "must NOT have additional properties" };
13118
13080
  if (vErrors === null) {
13119
- vErrors = [err25];
13081
+ vErrors = [err21];
13120
13082
  } else {
13121
- vErrors.push(err25);
13083
+ vErrors.push(err21);
13122
13084
  }
13123
13085
  errors++;
13124
13086
  break;
13125
13087
  }
13126
13088
  }
13127
- if (_errs28 === errors) {
13089
+ if (_errs24 === errors) {
13128
13090
  if (data.error !== void 0) {
13129
- let data6 = data.error;
13130
- if (typeof data6 !== "string") {
13131
- const err26 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/4/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" };
13091
+ let data4 = data.error;
13092
+ if (typeof data4 !== "string") {
13093
+ const err22 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/4/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" };
13132
13094
  if (vErrors === null) {
13133
- vErrors = [err26];
13095
+ vErrors = [err22];
13134
13096
  } else {
13135
- vErrors.push(err26);
13097
+ vErrors.push(err22);
13136
13098
  }
13137
13099
  errors++;
13138
13100
  }
13139
- if ("WorkOS identity authority is temporarily unavailable" !== data6) {
13140
- const err27 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/4/properties/error/const", keyword: "const", params: { allowedValue: "WorkOS identity authority is temporarily unavailable" }, message: "must be equal to constant" };
13101
+ if ("github_install_intent_conflict" !== data4) {
13102
+ const err23 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/4/properties/error/const", keyword: "const", params: { allowedValue: "github_install_intent_conflict" }, message: "must be equal to constant" };
13141
13103
  if (vErrors === null) {
13142
- vErrors = [err27];
13104
+ vErrors = [err23];
13143
13105
  } else {
13144
- vErrors.push(err27);
13106
+ vErrors.push(err23);
13145
13107
  }
13146
13108
  errors++;
13147
13109
  }
@@ -13149,195 +13111,128 @@ function validate46(data, { instancePath = "", parentData, parentDataProperty, r
13149
13111
  }
13150
13112
  }
13151
13113
  } else {
13152
- const err28 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/4/type", keyword: "type", params: { type: "object" }, message: "must be object" };
13114
+ const err24 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/4/type", keyword: "type", params: { type: "object" }, message: "must be object" };
13153
13115
  if (vErrors === null) {
13154
- vErrors = [err28];
13116
+ vErrors = [err24];
13155
13117
  } else {
13156
- vErrors.push(err28);
13118
+ vErrors.push(err24);
13157
13119
  }
13158
13120
  errors++;
13159
13121
  }
13160
13122
  }
13161
- var _valid0 = _errs26 === errors;
13123
+ var _valid0 = _errs22 === errors;
13162
13124
  valid1 = valid1 || _valid0;
13163
13125
  if (_valid0) {
13164
13126
  if (props0 !== true) {
13165
13127
  props0 = true;
13166
13128
  }
13167
13129
  }
13168
- const _errs31 = errors;
13169
- if (errors === _errs31) {
13130
+ const _errs27 = errors;
13131
+ if (errors === _errs27) {
13170
13132
  if (data && typeof data == "object" && !Array.isArray(data)) {
13171
13133
  let missing5;
13172
- if (data.error === void 0 && (missing5 = "error")) {
13173
- const err29 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/required", keyword: "required", params: { missingProperty: missing5 }, message: "must have required property '" + missing5 + "'" };
13134
+ if (data.error === void 0 && (missing5 = "error") || data.retryAt === void 0 && (missing5 = "retryAt")) {
13135
+ const err25 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/required", keyword: "required", params: { missingProperty: missing5 }, message: "must have required property '" + missing5 + "'" };
13174
13136
  if (vErrors === null) {
13175
- vErrors = [err29];
13137
+ vErrors = [err25];
13176
13138
  } else {
13177
- vErrors.push(err29);
13139
+ vErrors.push(err25);
13178
13140
  }
13179
13141
  errors++;
13180
13142
  } else {
13181
- const _errs33 = errors;
13143
+ const _errs29 = errors;
13182
13144
  for (const key5 in data) {
13183
- if (!(key5 === "error")) {
13184
- const err30 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key5 }, message: "must NOT have additional properties" };
13185
- if (vErrors === null) {
13186
- vErrors = [err30];
13187
- } else {
13188
- vErrors.push(err30);
13189
- }
13190
- errors++;
13191
- break;
13192
- }
13193
- }
13194
- if (_errs33 === errors) {
13195
- if (data.error !== void 0) {
13196
- let data7 = data.error;
13197
- if (typeof data7 !== "string") {
13198
- const err31 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" };
13199
- if (vErrors === null) {
13200
- vErrors = [err31];
13201
- } else {
13202
- vErrors.push(err31);
13203
- }
13204
- errors++;
13205
- }
13206
- if ("github_install_intent_conflict" !== data7) {
13207
- const err32 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/properties/error/const", keyword: "const", params: { allowedValue: "github_install_intent_conflict" }, message: "must be equal to constant" };
13208
- if (vErrors === null) {
13209
- vErrors = [err32];
13210
- } else {
13211
- vErrors.push(err32);
13212
- }
13213
- errors++;
13214
- }
13215
- }
13216
- }
13217
- }
13218
- } else {
13219
- const err33 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/type", keyword: "type", params: { type: "object" }, message: "must be object" };
13220
- if (vErrors === null) {
13221
- vErrors = [err33];
13222
- } else {
13223
- vErrors.push(err33);
13224
- }
13225
- errors++;
13226
- }
13227
- }
13228
- var _valid0 = _errs31 === errors;
13229
- valid1 = valid1 || _valid0;
13230
- if (_valid0) {
13231
- if (props0 !== true) {
13232
- props0 = true;
13233
- }
13234
- }
13235
- const _errs36 = errors;
13236
- if (errors === _errs36) {
13237
- if (data && typeof data == "object" && !Array.isArray(data)) {
13238
- let missing6;
13239
- if (data.error === void 0 && (missing6 = "error") || data.retryAt === void 0 && (missing6 = "retryAt")) {
13240
- const err34 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/required", keyword: "required", params: { missingProperty: missing6 }, message: "must have required property '" + missing6 + "'" };
13241
- if (vErrors === null) {
13242
- vErrors = [err34];
13243
- } else {
13244
- vErrors.push(err34);
13245
- }
13246
- errors++;
13247
- } else {
13248
- const _errs38 = errors;
13249
- for (const key6 in data) {
13250
- if (!(key6 === "error" || key6 === "retryAt")) {
13251
- const err35 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key6 }, message: "must NOT have additional properties" };
13145
+ if (!(key5 === "error" || key5 === "retryAt")) {
13146
+ const err26 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key5 }, message: "must NOT have additional properties" };
13252
13147
  if (vErrors === null) {
13253
- vErrors = [err35];
13148
+ vErrors = [err26];
13254
13149
  } else {
13255
- vErrors.push(err35);
13150
+ vErrors.push(err26);
13256
13151
  }
13257
13152
  errors++;
13258
13153
  break;
13259
13154
  }
13260
13155
  }
13261
- if (_errs38 === errors) {
13156
+ if (_errs29 === errors) {
13262
13157
  if (data.error !== void 0) {
13263
- let data8 = data.error;
13264
- const _errs39 = errors;
13265
- if (typeof data8 !== "string") {
13266
- const err36 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" };
13158
+ let data5 = data.error;
13159
+ const _errs30 = errors;
13160
+ if (typeof data5 !== "string") {
13161
+ const err27 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" };
13267
13162
  if (vErrors === null) {
13268
- vErrors = [err36];
13163
+ vErrors = [err27];
13269
13164
  } else {
13270
- vErrors.push(err36);
13165
+ vErrors.push(err27);
13271
13166
  }
13272
13167
  errors++;
13273
13168
  }
13274
- if ("github_install_intent_rate_limited" !== data8) {
13275
- const err37 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/properties/error/const", keyword: "const", params: { allowedValue: "github_install_intent_rate_limited" }, message: "must be equal to constant" };
13169
+ if ("github_install_intent_rate_limited" !== data5) {
13170
+ const err28 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/properties/error/const", keyword: "const", params: { allowedValue: "github_install_intent_rate_limited" }, message: "must be equal to constant" };
13276
13171
  if (vErrors === null) {
13277
- vErrors = [err37];
13172
+ vErrors = [err28];
13278
13173
  } else {
13279
- vErrors.push(err37);
13174
+ vErrors.push(err28);
13280
13175
  }
13281
13176
  errors++;
13282
13177
  }
13283
- var valid8 = _errs39 === errors;
13178
+ var valid7 = _errs30 === errors;
13284
13179
  } else {
13285
- var valid8 = true;
13180
+ var valid7 = true;
13286
13181
  }
13287
- if (valid8) {
13182
+ if (valid7) {
13288
13183
  if (data.retryAt !== void 0) {
13289
- let data9 = data.retryAt;
13290
- const _errs41 = errors;
13291
- if (!(typeof data9 == "number" && (!(data9 % 1) && !isNaN(data9)) && isFinite(data9))) {
13292
- const err38 = { instancePath: instancePath + "/retryAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/properties/retryAt/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
13184
+ let data6 = data.retryAt;
13185
+ const _errs32 = errors;
13186
+ if (!(typeof data6 == "number" && (!(data6 % 1) && !isNaN(data6)) && isFinite(data6))) {
13187
+ const err29 = { instancePath: instancePath + "/retryAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/properties/retryAt/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
13293
13188
  if (vErrors === null) {
13294
- vErrors = [err38];
13189
+ vErrors = [err29];
13295
13190
  } else {
13296
- vErrors.push(err38);
13191
+ vErrors.push(err29);
13297
13192
  }
13298
13193
  errors++;
13299
13194
  }
13300
- if (errors === _errs41) {
13301
- if (typeof data9 == "number" && isFinite(data9)) {
13302
- if (data9 > 9007199254740991 || isNaN(data9)) {
13303
- const err39 = { instancePath: instancePath + "/retryAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/properties/retryAt/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
13195
+ if (errors === _errs32) {
13196
+ if (typeof data6 == "number" && isFinite(data6)) {
13197
+ if (data6 > 9007199254740991 || isNaN(data6)) {
13198
+ const err30 = { instancePath: instancePath + "/retryAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/properties/retryAt/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
13304
13199
  if (vErrors === null) {
13305
- vErrors = [err39];
13200
+ vErrors = [err30];
13306
13201
  } else {
13307
- vErrors.push(err39);
13202
+ vErrors.push(err30);
13308
13203
  }
13309
13204
  errors++;
13310
13205
  } else {
13311
- if (data9 < 0 || isNaN(data9)) {
13312
- const err40 = { instancePath: instancePath + "/retryAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/properties/retryAt/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
13206
+ if (data6 < 0 || isNaN(data6)) {
13207
+ const err31 = { instancePath: instancePath + "/retryAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/properties/retryAt/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
13313
13208
  if (vErrors === null) {
13314
- vErrors = [err40];
13209
+ vErrors = [err31];
13315
13210
  } else {
13316
- vErrors.push(err40);
13211
+ vErrors.push(err31);
13317
13212
  }
13318
13213
  errors++;
13319
13214
  }
13320
13215
  }
13321
13216
  }
13322
13217
  }
13323
- var valid8 = _errs41 === errors;
13218
+ var valid7 = _errs32 === errors;
13324
13219
  } else {
13325
- var valid8 = true;
13220
+ var valid7 = true;
13326
13221
  }
13327
13222
  }
13328
13223
  }
13329
13224
  }
13330
13225
  } else {
13331
- const err41 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/type", keyword: "type", params: { type: "object" }, message: "must be object" };
13226
+ const err32 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/type", keyword: "type", params: { type: "object" }, message: "must be object" };
13332
13227
  if (vErrors === null) {
13333
- vErrors = [err41];
13228
+ vErrors = [err32];
13334
13229
  } else {
13335
- vErrors.push(err41);
13230
+ vErrors.push(err32);
13336
13231
  }
13337
13232
  errors++;
13338
13233
  }
13339
13234
  }
13340
- var _valid0 = _errs36 === errors;
13235
+ var _valid0 = _errs27 === errors;
13341
13236
  valid1 = valid1 || _valid0;
13342
13237
  if (_valid0) {
13343
13238
  if (props0 !== true) {
@@ -13345,11 +13240,11 @@ function validate46(data, { instancePath = "", parentData, parentDataProperty, r
13345
13240
  }
13346
13241
  }
13347
13242
  if (!valid1) {
13348
- const err42 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
13243
+ const err33 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
13349
13244
  if (vErrors === null) {
13350
- vErrors = [err42];
13245
+ vErrors = [err33];
13351
13246
  } else {
13352
- vErrors.push(err42);
13247
+ vErrors.push(err33);
13353
13248
  }
13354
13249
  errors++;
13355
13250
  validate46.errors = vErrors;
@@ -15451,7 +15346,7 @@ function validate50(data, { instancePath = "", parentData, parentDataProperty, r
15451
15346
  return errors === 0;
15452
15347
  }
15453
15348
  validate50.evaluated = { "dynamicProps": true, "dynamicItems": false };
15454
- var schema93 = { "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": {}, "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": {}, "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": {} };
15349
+ var schema93 = { "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": {} };
15455
15350
  var pattern8 = new RegExp("^[A-Za-z0-9_-]+$", "u");
15456
15351
  function validate51(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
15457
15352
  ;
@@ -15578,13 +15473,18 @@ function validate51(data, { instancePath = "", parentData, parentDataProperty, r
15578
15473
  var valid4 = true;
15579
15474
  }
15580
15475
  if (valid4) {
15581
- if (data1.capturedOrganizationId !== void 0) {
15582
- let data7 = data1.capturedOrganizationId;
15476
+ if (data1.repositoryContext !== void 0) {
15477
+ let data7 = data1.repositoryContext;
15583
15478
  const _errs20 = errors;
15584
- if (errors === _errs20) {
15585
- if (typeof data7 === "string") {
15586
- if (func1(data7) > 128) {
15587
- const err6 = { 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/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" };
15479
+ const _errs21 = errors;
15480
+ let valid5 = false;
15481
+ let passing0 = null;
15482
+ const _errs22 = errors;
15483
+ if (errors === _errs22) {
15484
+ if (data7 && typeof data7 == "object" && !Array.isArray(data7)) {
15485
+ let missing2;
15486
+ if (data7.kind === void 0 && (missing2 = "kind") || data7.repoSyncId === void 0 && (missing2 = "repoSyncId")) {
15487
+ const err6 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf/0/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" };
15588
15488
  if (vErrors === null) {
15589
15489
  vErrors = [err6];
15590
15490
  } else {
@@ -15592,184 +15492,392 @@ function validate51(data, { instancePath = "", parentData, parentDataProperty, r
15592
15492
  }
15593
15493
  errors++;
15594
15494
  } else {
15595
- if (func1(data7) < 1) {
15596
- const err7 = { 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/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
15597
- if (vErrors === null) {
15598
- vErrors = [err7];
15599
- } else {
15600
- vErrors.push(err7);
15601
- }
15602
- errors++;
15603
- } else {
15604
- if (!pattern8.test(data7)) {
15605
- const err8 = { 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_-]+$"' };
15495
+ const _errs24 = errors;
15496
+ for (const key0 in data7) {
15497
+ if (!(key0 === "kind" || key0 === "repoSyncId")) {
15498
+ const err7 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf/0/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
15606
15499
  if (vErrors === null) {
15607
- vErrors = [err8];
15500
+ vErrors = [err7];
15608
15501
  } else {
15609
- vErrors.push(err8);
15502
+ vErrors.push(err7);
15610
15503
  }
15611
15504
  errors++;
15505
+ break;
15506
+ }
15507
+ }
15508
+ if (_errs24 === errors) {
15509
+ if (data7.kind !== void 0) {
15510
+ let data8 = data7.kind;
15511
+ const _errs25 = errors;
15512
+ if (typeof data8 !== "string") {
15513
+ const err8 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/kind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf/0/properties/kind/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15514
+ if (vErrors === null) {
15515
+ vErrors = [err8];
15516
+ } else {
15517
+ vErrors.push(err8);
15518
+ }
15519
+ errors++;
15520
+ }
15521
+ if ("repository_bound" !== data8) {
15522
+ const err9 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/kind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf/0/properties/kind/const", keyword: "const", params: { allowedValue: "repository_bound" }, message: "must be equal to constant" };
15523
+ if (vErrors === null) {
15524
+ vErrors = [err9];
15525
+ } else {
15526
+ vErrors.push(err9);
15527
+ }
15528
+ errors++;
15529
+ }
15530
+ var valid6 = _errs25 === errors;
15531
+ } else {
15532
+ var valid6 = true;
15533
+ }
15534
+ if (valid6) {
15535
+ if (data7.repoSyncId !== void 0) {
15536
+ let data9 = data7.repoSyncId;
15537
+ const _errs27 = errors;
15538
+ if (errors === _errs27) {
15539
+ if (typeof data9 === "string") {
15540
+ if (func1(data9) > 128) {
15541
+ const err10 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/repoSyncId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf/0/properties/repoSyncId/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" };
15542
+ if (vErrors === null) {
15543
+ vErrors = [err10];
15544
+ } else {
15545
+ vErrors.push(err10);
15546
+ }
15547
+ errors++;
15548
+ } else {
15549
+ if (func1(data9) < 1) {
15550
+ const err11 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/repoSyncId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf/0/properties/repoSyncId/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
15551
+ if (vErrors === null) {
15552
+ vErrors = [err11];
15553
+ } else {
15554
+ vErrors.push(err11);
15555
+ }
15556
+ errors++;
15557
+ }
15558
+ }
15559
+ } else {
15560
+ const err12 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/repoSyncId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf/0/properties/repoSyncId/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15561
+ if (vErrors === null) {
15562
+ vErrors = [err12];
15563
+ } else {
15564
+ vErrors.push(err12);
15565
+ }
15566
+ errors++;
15567
+ }
15568
+ }
15569
+ var valid6 = _errs27 === errors;
15570
+ } else {
15571
+ var valid6 = true;
15572
+ }
15612
15573
  }
15613
15574
  }
15614
15575
  }
15615
15576
  } else {
15616
- const err9 = { 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/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15577
+ const err13 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf/0/type", keyword: "type", params: { type: "object" }, message: "must be object" };
15617
15578
  if (vErrors === null) {
15618
- vErrors = [err9];
15579
+ vErrors = [err13];
15619
15580
  } else {
15620
- vErrors.push(err9);
15581
+ vErrors.push(err13);
15621
15582
  }
15622
15583
  errors++;
15623
15584
  }
15624
15585
  }
15625
- var valid4 = _errs20 === errors;
15626
- } else {
15627
- var valid4 = true;
15628
- }
15629
- if (valid4) {
15630
- if (data1.captureAuthorityKind !== void 0) {
15631
- let data8 = data1.captureAuthorityKind;
15632
- const _errs22 = errors;
15633
- if (typeof data8 !== "string") {
15634
- const err10 = { instancePath: instancePath + "/batch/" + i0 + "/captureAuthorityKind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/captureAuthorityKind/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15635
- if (vErrors === null) {
15636
- vErrors = [err10];
15637
- } else {
15638
- vErrors.push(err10);
15639
- }
15640
- errors++;
15641
- }
15642
- if (!(data8 === "workos" || data8 === "service_token")) {
15643
- const err11 = { instancePath: instancePath + "/batch/" + i0 + "/captureAuthorityKind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/captureAuthorityKind/enum", keyword: "enum", params: { allowedValues: schema93.properties.batch.items.anyOf[0].properties.captureAuthorityKind.enum }, message: "must be equal to one of the allowed values" };
15644
- if (vErrors === null) {
15645
- vErrors = [err11];
15646
- } else {
15647
- vErrors.push(err11);
15648
- }
15649
- errors++;
15650
- }
15651
- var valid4 = _errs22 === errors;
15652
- } else {
15653
- var valid4 = true;
15586
+ var _valid1 = _errs22 === errors;
15587
+ if (_valid1) {
15588
+ valid5 = true;
15589
+ passing0 = 0;
15590
+ var props0 = true;
15654
15591
  }
15655
- if (valid4) {
15656
- if (data1.decisionLifecycleProtocolVersion !== void 0) {
15657
- let data9 = data1.decisionLifecycleProtocolVersion;
15658
- const _errs24 = errors;
15659
- if (!(typeof data9 == "number" && (!(data9 % 1) && !isNaN(data9)) && isFinite(data9))) {
15660
- const err12 = { instancePath: instancePath + "/batch/" + i0 + "/decisionLifecycleProtocolVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/decisionLifecycleProtocolVersion/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
15592
+ const _errs29 = errors;
15593
+ if (errors === _errs29) {
15594
+ if (data7 && typeof data7 == "object" && !Array.isArray(data7)) {
15595
+ let missing3;
15596
+ if (data7.kind === void 0 && (missing3 = "kind")) {
15597
+ const err14 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf/1/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" };
15661
15598
  if (vErrors === null) {
15662
- vErrors = [err12];
15599
+ vErrors = [err14];
15663
15600
  } else {
15664
- vErrors.push(err12);
15601
+ vErrors.push(err14);
15665
15602
  }
15666
15603
  errors++;
15667
- }
15668
- if (errors === _errs24) {
15669
- if (typeof data9 == "number" && isFinite(data9)) {
15670
- if (data9 > 9007199254740991 || isNaN(data9)) {
15671
- const err13 = { instancePath: instancePath + "/batch/" + i0 + "/decisionLifecycleProtocolVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/decisionLifecycleProtocolVersion/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
15604
+ } else {
15605
+ const _errs31 = errors;
15606
+ for (const key1 in data7) {
15607
+ if (!(key1 === "kind")) {
15608
+ const err15 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf/1/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" };
15672
15609
  if (vErrors === null) {
15673
- vErrors = [err13];
15610
+ vErrors = [err15];
15674
15611
  } else {
15675
- vErrors.push(err13);
15612
+ vErrors.push(err15);
15676
15613
  }
15677
15614
  errors++;
15678
- } else {
15679
- if (data9 < 1 || isNaN(data9)) {
15680
- const err14 = { instancePath: instancePath + "/batch/" + i0 + "/decisionLifecycleProtocolVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/decisionLifecycleProtocolVersion/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
15615
+ break;
15616
+ }
15617
+ }
15618
+ if (_errs31 === errors) {
15619
+ if (data7.kind !== void 0) {
15620
+ let data10 = data7.kind;
15621
+ if (typeof data10 !== "string") {
15622
+ const err16 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/kind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf/1/properties/kind/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15623
+ if (vErrors === null) {
15624
+ vErrors = [err16];
15625
+ } else {
15626
+ vErrors.push(err16);
15627
+ }
15628
+ errors++;
15629
+ }
15630
+ if ("non_repository" !== data10) {
15631
+ const err17 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/kind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf/1/properties/kind/const", keyword: "const", params: { allowedValue: "non_repository" }, message: "must be equal to constant" };
15681
15632
  if (vErrors === null) {
15682
- vErrors = [err14];
15633
+ vErrors = [err17];
15683
15634
  } else {
15684
- vErrors.push(err14);
15635
+ vErrors.push(err17);
15685
15636
  }
15686
15637
  errors++;
15687
15638
  }
15688
15639
  }
15689
15640
  }
15690
15641
  }
15691
- var valid4 = _errs24 === errors;
15692
15642
  } else {
15693
- var valid4 = true;
15643
+ const err18 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf/1/type", keyword: "type", params: { type: "object" }, message: "must be object" };
15644
+ if (vErrors === null) {
15645
+ vErrors = [err18];
15646
+ } else {
15647
+ vErrors.push(err18);
15648
+ }
15649
+ errors++;
15694
15650
  }
15695
- if (valid4) {
15696
- if (data1.producer !== void 0) {
15697
- let data10 = data1.producer;
15698
- const _errs26 = errors;
15699
- if (typeof data10 !== "string") {
15700
- const err15 = { instancePath: instancePath + "/batch/" + i0 + "/producer", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/producer/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15701
- if (vErrors === null) {
15702
- vErrors = [err15];
15651
+ }
15652
+ var _valid1 = _errs29 === errors;
15653
+ if (_valid1 && valid5) {
15654
+ valid5 = false;
15655
+ passing0 = [passing0, 1];
15656
+ } else {
15657
+ if (_valid1) {
15658
+ valid5 = true;
15659
+ passing0 = 1;
15660
+ if (props0 !== true) {
15661
+ props0 = true;
15662
+ }
15663
+ }
15664
+ }
15665
+ if (!valid5) {
15666
+ const err19 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/repositoryContext/oneOf", keyword: "oneOf", params: { passingSchemas: passing0 }, message: "must match exactly one schema in oneOf" };
15667
+ if (vErrors === null) {
15668
+ vErrors = [err19];
15669
+ } else {
15670
+ vErrors.push(err19);
15671
+ }
15672
+ errors++;
15673
+ } else {
15674
+ errors = _errs21;
15675
+ if (vErrors !== null) {
15676
+ if (_errs21) {
15677
+ vErrors.length = _errs21;
15678
+ } else {
15679
+ vErrors = null;
15680
+ }
15681
+ }
15682
+ }
15683
+ var valid4 = _errs20 === errors;
15684
+ } else {
15685
+ var valid4 = true;
15686
+ }
15687
+ if (valid4) {
15688
+ if (data1.capturedOrganizationId !== void 0) {
15689
+ let data11 = data1.capturedOrganizationId;
15690
+ const _errs34 = errors;
15691
+ if (errors === _errs34) {
15692
+ if (typeof data11 === "string") {
15693
+ if (func1(data11) > 128) {
15694
+ const err20 = { 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/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" };
15695
+ if (vErrors === null) {
15696
+ vErrors = [err20];
15703
15697
  } else {
15704
- vErrors.push(err15);
15698
+ vErrors.push(err20);
15705
15699
  }
15706
15700
  errors++;
15701
+ } else {
15702
+ if (func1(data11) < 1) {
15703
+ const err21 = { 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/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
15704
+ if (vErrors === null) {
15705
+ vErrors = [err21];
15706
+ } else {
15707
+ vErrors.push(err21);
15708
+ }
15709
+ errors++;
15710
+ } else {
15711
+ if (!pattern8.test(data11)) {
15712
+ 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_-]+$"' };
15713
+ if (vErrors === null) {
15714
+ vErrors = [err22];
15715
+ } else {
15716
+ vErrors.push(err22);
15717
+ }
15718
+ errors++;
15719
+ }
15720
+ }
15721
+ }
15722
+ } else {
15723
+ const err23 = { 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/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15724
+ if (vErrors === null) {
15725
+ vErrors = [err23];
15726
+ } else {
15727
+ vErrors.push(err23);
15728
+ }
15729
+ errors++;
15730
+ }
15731
+ }
15732
+ var valid4 = _errs34 === errors;
15733
+ } else {
15734
+ var valid4 = true;
15735
+ }
15736
+ if (valid4) {
15737
+ if (data1.captureAuthorityKind !== void 0) {
15738
+ let data12 = data1.captureAuthorityKind;
15739
+ const _errs36 = errors;
15740
+ if (typeof data12 !== "string") {
15741
+ const err24 = { instancePath: instancePath + "/batch/" + i0 + "/captureAuthorityKind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/captureAuthorityKind/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15742
+ if (vErrors === null) {
15743
+ vErrors = [err24];
15744
+ } else {
15745
+ vErrors.push(err24);
15707
15746
  }
15708
- if (!(data10 === "claude_code" || data10 === "codex" || data10 === "cursor" || data10 === "hermes")) {
15709
- const err16 = { instancePath: instancePath + "/batch/" + i0 + "/producer", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/producer/enum", keyword: "enum", params: { allowedValues: schema93.properties.batch.items.anyOf[0].properties.producer.enum }, message: "must be equal to one of the allowed values" };
15747
+ errors++;
15748
+ }
15749
+ if (!(data12 === "workos" || data12 === "service_token")) {
15750
+ const err25 = { instancePath: instancePath + "/batch/" + i0 + "/captureAuthorityKind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/captureAuthorityKind/enum", keyword: "enum", params: { allowedValues: schema93.properties.batch.items.anyOf[0].properties.captureAuthorityKind.enum }, message: "must be equal to one of the allowed values" };
15751
+ if (vErrors === null) {
15752
+ vErrors = [err25];
15753
+ } else {
15754
+ vErrors.push(err25);
15755
+ }
15756
+ errors++;
15757
+ }
15758
+ var valid4 = _errs36 === errors;
15759
+ } else {
15760
+ var valid4 = true;
15761
+ }
15762
+ if (valid4) {
15763
+ if (data1.decisionLifecycleProtocolVersion !== void 0) {
15764
+ let data13 = data1.decisionLifecycleProtocolVersion;
15765
+ const _errs38 = errors;
15766
+ if (!(typeof data13 == "number" && (!(data13 % 1) && !isNaN(data13)) && isFinite(data13))) {
15767
+ const err26 = { instancePath: instancePath + "/batch/" + i0 + "/decisionLifecycleProtocolVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/decisionLifecycleProtocolVersion/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
15710
15768
  if (vErrors === null) {
15711
- vErrors = [err16];
15769
+ vErrors = [err26];
15712
15770
  } else {
15713
- vErrors.push(err16);
15771
+ vErrors.push(err26);
15714
15772
  }
15715
15773
  errors++;
15716
15774
  }
15717
- var valid4 = _errs26 === errors;
15775
+ if (errors === _errs38) {
15776
+ if (typeof data13 == "number" && isFinite(data13)) {
15777
+ if (data13 > 9007199254740991 || isNaN(data13)) {
15778
+ const err27 = { instancePath: instancePath + "/batch/" + i0 + "/decisionLifecycleProtocolVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/decisionLifecycleProtocolVersion/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
15779
+ if (vErrors === null) {
15780
+ vErrors = [err27];
15781
+ } else {
15782
+ vErrors.push(err27);
15783
+ }
15784
+ errors++;
15785
+ } else {
15786
+ if (data13 < 1 || isNaN(data13)) {
15787
+ const err28 = { instancePath: instancePath + "/batch/" + i0 + "/decisionLifecycleProtocolVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/decisionLifecycleProtocolVersion/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
15788
+ if (vErrors === null) {
15789
+ vErrors = [err28];
15790
+ } else {
15791
+ vErrors.push(err28);
15792
+ }
15793
+ errors++;
15794
+ }
15795
+ }
15796
+ }
15797
+ }
15798
+ var valid4 = _errs38 === errors;
15718
15799
  } else {
15719
15800
  var valid4 = true;
15720
15801
  }
15721
15802
  if (valid4) {
15722
- if (data1.toolOutcome !== void 0) {
15723
- let data11 = data1.toolOutcome;
15724
- const _errs28 = errors;
15725
- if (typeof data11 !== "string") {
15726
- const err17 = { instancePath: instancePath + "/batch/" + i0 + "/toolOutcome", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/toolOutcome/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15803
+ if (data1.producer !== void 0) {
15804
+ let data14 = data1.producer;
15805
+ const _errs40 = errors;
15806
+ if (typeof data14 !== "string") {
15807
+ const err29 = { instancePath: instancePath + "/batch/" + i0 + "/producer", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/producer/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15727
15808
  if (vErrors === null) {
15728
- vErrors = [err17];
15809
+ vErrors = [err29];
15729
15810
  } else {
15730
- vErrors.push(err17);
15811
+ vErrors.push(err29);
15731
15812
  }
15732
15813
  errors++;
15733
15814
  }
15734
- if (!(data11 === "succeeded" || data11 === "returned" || data11 === "failed" || data11 === "interrupted" || data11 === "prevented" || data11 === "unknown")) {
15735
- const err18 = { instancePath: instancePath + "/batch/" + i0 + "/toolOutcome", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/toolOutcome/enum", keyword: "enum", params: { allowedValues: schema93.properties.batch.items.anyOf[0].properties.toolOutcome.enum }, message: "must be equal to one of the allowed values" };
15815
+ if (!(data14 === "claude_code" || data14 === "codex" || data14 === "cursor" || data14 === "hermes")) {
15816
+ const err30 = { instancePath: instancePath + "/batch/" + i0 + "/producer", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/producer/enum", keyword: "enum", params: { allowedValues: schema93.properties.batch.items.anyOf[0].properties.producer.enum }, message: "must be equal to one of the allowed values" };
15736
15817
  if (vErrors === null) {
15737
- vErrors = [err18];
15818
+ vErrors = [err30];
15738
15819
  } else {
15739
- vErrors.push(err18);
15820
+ vErrors.push(err30);
15740
15821
  }
15741
15822
  errors++;
15742
15823
  }
15743
- var valid4 = _errs28 === errors;
15824
+ var valid4 = _errs40 === errors;
15744
15825
  } else {
15745
15826
  var valid4 = true;
15746
15827
  }
15747
15828
  if (valid4) {
15748
- if (data1.envelopeVersion !== void 0) {
15749
- let data12 = data1.envelopeVersion;
15750
- const _errs30 = errors;
15751
- if (!(typeof data12 == "number" && isFinite(data12))) {
15752
- const err19 = { instancePath: instancePath + "/batch/" + i0 + "/envelopeVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/envelopeVersion/type", keyword: "type", params: { type: "number" }, message: "must be number" };
15829
+ if (data1.toolOutcome !== void 0) {
15830
+ let data15 = data1.toolOutcome;
15831
+ const _errs42 = errors;
15832
+ if (typeof data15 !== "string") {
15833
+ const err31 = { instancePath: instancePath + "/batch/" + i0 + "/toolOutcome", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/toolOutcome/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15753
15834
  if (vErrors === null) {
15754
- vErrors = [err19];
15835
+ vErrors = [err31];
15755
15836
  } else {
15756
- vErrors.push(err19);
15837
+ vErrors.push(err31);
15757
15838
  }
15758
15839
  errors++;
15759
15840
  }
15760
- if (4 !== data12) {
15761
- const err20 = { instancePath: instancePath + "/batch/" + i0 + "/envelopeVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/envelopeVersion/const", keyword: "const", params: { allowedValue: 4 }, message: "must be equal to constant" };
15841
+ if (!(data15 === "succeeded" || data15 === "returned" || data15 === "failed" || data15 === "interrupted" || data15 === "prevented" || data15 === "unknown")) {
15842
+ const err32 = { instancePath: instancePath + "/batch/" + i0 + "/toolOutcome", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/toolOutcome/enum", keyword: "enum", params: { allowedValues: schema93.properties.batch.items.anyOf[0].properties.toolOutcome.enum }, message: "must be equal to one of the allowed values" };
15762
15843
  if (vErrors === null) {
15763
- vErrors = [err20];
15844
+ vErrors = [err32];
15764
15845
  } else {
15765
- vErrors.push(err20);
15846
+ vErrors.push(err32);
15766
15847
  }
15767
15848
  errors++;
15768
15849
  }
15769
- var valid4 = _errs30 === errors;
15850
+ var valid4 = _errs42 === errors;
15770
15851
  } else {
15771
15852
  var valid4 = true;
15772
15853
  }
15854
+ if (valid4) {
15855
+ if (data1.envelopeVersion !== void 0) {
15856
+ let data16 = data1.envelopeVersion;
15857
+ const _errs44 = errors;
15858
+ if (!(typeof data16 == "number" && isFinite(data16))) {
15859
+ const err33 = { instancePath: instancePath + "/batch/" + i0 + "/envelopeVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/envelopeVersion/type", keyword: "type", params: { type: "number" }, message: "must be number" };
15860
+ if (vErrors === null) {
15861
+ vErrors = [err33];
15862
+ } else {
15863
+ vErrors.push(err33);
15864
+ }
15865
+ errors++;
15866
+ }
15867
+ if (4 !== data16) {
15868
+ const err34 = { instancePath: instancePath + "/batch/" + i0 + "/envelopeVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/properties/envelopeVersion/const", keyword: "const", params: { allowedValue: 4 }, message: "must be equal to constant" };
15869
+ if (vErrors === null) {
15870
+ vErrors = [err34];
15871
+ } else {
15872
+ vErrors.push(err34);
15873
+ }
15874
+ errors++;
15875
+ }
15876
+ var valid4 = _errs44 === errors;
15877
+ } else {
15878
+ var valid4 = true;
15879
+ }
15880
+ }
15773
15881
  }
15774
15882
  }
15775
15883
  }
@@ -15782,11 +15890,11 @@ function validate51(data, { instancePath = "", parentData, parentDataProperty, r
15782
15890
  }
15783
15891
  }
15784
15892
  } else {
15785
- const err21 = { instancePath: instancePath + "/batch/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/type", keyword: "type", params: { type: "object" }, message: "must be object" };
15893
+ const err35 = { instancePath: instancePath + "/batch/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/0/type", keyword: "type", params: { type: "object" }, message: "must be object" };
15786
15894
  if (vErrors === null) {
15787
- vErrors = [err21];
15895
+ vErrors = [err35];
15788
15896
  } else {
15789
- vErrors.push(err21);
15897
+ vErrors.push(err35);
15790
15898
  }
15791
15899
  errors++;
15792
15900
  }
@@ -15794,296 +15902,509 @@ function validate51(data, { instancePath = "", parentData, parentDataProperty, r
15794
15902
  var _valid0 = _errs7 === errors;
15795
15903
  valid3 = valid3 || _valid0;
15796
15904
  if (_valid0) {
15797
- var props0 = true;
15905
+ var props1 = true;
15798
15906
  }
15799
- const _errs32 = errors;
15800
- if (errors === _errs32) {
15907
+ const _errs46 = errors;
15908
+ if (errors === _errs46) {
15801
15909
  if (data1 && typeof data1 == "object" && !Array.isArray(data1)) {
15802
- let missing2;
15803
- if (data1.moveId === void 0 && (missing2 = "moveId") || data1.capturedAt === void 0 && (missing2 = "capturedAt") || data1.sessionId === void 0 && (missing2 = "sessionId") || data1.eventType === void 0 && (missing2 = "eventType")) {
15804
- const err22 = { instancePath: instancePath + "/batch/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" };
15910
+ let missing4;
15911
+ if (data1.moveId === void 0 && (missing4 = "moveId") || data1.capturedAt === void 0 && (missing4 = "capturedAt") || data1.sessionId === void 0 && (missing4 = "sessionId") || data1.eventType === void 0 && (missing4 = "eventType")) {
15912
+ const err36 = { instancePath: instancePath + "/batch/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/required", keyword: "required", params: { missingProperty: missing4 }, message: "must have required property '" + missing4 + "'" };
15805
15913
  if (vErrors === null) {
15806
- vErrors = [err22];
15914
+ vErrors = [err36];
15807
15915
  } else {
15808
- vErrors.push(err22);
15916
+ vErrors.push(err36);
15809
15917
  }
15810
15918
  errors++;
15811
15919
  } else {
15812
15920
  if (data1.moveId !== void 0) {
15813
- const _errs35 = errors;
15921
+ const _errs49 = errors;
15814
15922
  if (typeof data1.moveId !== "string") {
15815
- const err23 = { instancePath: instancePath + "/batch/" + i0 + "/moveId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/moveId/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15923
+ const err37 = { instancePath: instancePath + "/batch/" + i0 + "/moveId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/moveId/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15816
15924
  if (vErrors === null) {
15817
- vErrors = [err23];
15925
+ vErrors = [err37];
15818
15926
  } else {
15819
- vErrors.push(err23);
15927
+ vErrors.push(err37);
15820
15928
  }
15821
15929
  errors++;
15822
15930
  }
15823
- var valid5 = _errs35 === errors;
15931
+ var valid8 = _errs49 === errors;
15824
15932
  } else {
15825
- var valid5 = true;
15933
+ var valid8 = true;
15826
15934
  }
15827
- if (valid5) {
15935
+ if (valid8) {
15828
15936
  if (data1.capturedAt !== void 0) {
15829
- let data14 = data1.capturedAt;
15830
- const _errs37 = errors;
15831
- if (!(typeof data14 == "number" && isFinite(data14))) {
15832
- const err24 = { instancePath: instancePath + "/batch/" + i0 + "/capturedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/capturedAt/type", keyword: "type", params: { type: "number" }, message: "must be number" };
15937
+ let data18 = data1.capturedAt;
15938
+ const _errs51 = errors;
15939
+ if (!(typeof data18 == "number" && isFinite(data18))) {
15940
+ const err38 = { instancePath: instancePath + "/batch/" + i0 + "/capturedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/capturedAt/type", keyword: "type", params: { type: "number" }, message: "must be number" };
15833
15941
  if (vErrors === null) {
15834
- vErrors = [err24];
15942
+ vErrors = [err38];
15835
15943
  } else {
15836
- vErrors.push(err24);
15944
+ vErrors.push(err38);
15837
15945
  }
15838
15946
  errors++;
15839
15947
  }
15840
- var valid5 = _errs37 === errors;
15948
+ var valid8 = _errs51 === errors;
15841
15949
  } else {
15842
- var valid5 = true;
15950
+ var valid8 = true;
15843
15951
  }
15844
- if (valid5) {
15952
+ if (valid8) {
15845
15953
  if (data1.sessionId !== void 0) {
15846
- const _errs39 = errors;
15954
+ const _errs53 = errors;
15847
15955
  if (typeof data1.sessionId !== "string") {
15848
- const err25 = { instancePath: instancePath + "/batch/" + i0 + "/sessionId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/sessionId/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15956
+ const err39 = { instancePath: instancePath + "/batch/" + i0 + "/sessionId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/sessionId/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15849
15957
  if (vErrors === null) {
15850
- vErrors = [err25];
15958
+ vErrors = [err39];
15851
15959
  } else {
15852
- vErrors.push(err25);
15960
+ vErrors.push(err39);
15853
15961
  }
15854
15962
  errors++;
15855
15963
  }
15856
- var valid5 = _errs39 === errors;
15964
+ var valid8 = _errs53 === errors;
15857
15965
  } else {
15858
- var valid5 = true;
15966
+ var valid8 = true;
15859
15967
  }
15860
- if (valid5) {
15968
+ if (valid8) {
15861
15969
  if (data1.invocationId !== void 0) {
15862
- const _errs41 = errors;
15970
+ const _errs55 = errors;
15863
15971
  if (typeof data1.invocationId !== "string") {
15864
- const err26 = { instancePath: instancePath + "/batch/" + i0 + "/invocationId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/invocationId/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15972
+ const err40 = { instancePath: instancePath + "/batch/" + i0 + "/invocationId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/invocationId/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15865
15973
  if (vErrors === null) {
15866
- vErrors = [err26];
15974
+ vErrors = [err40];
15867
15975
  } else {
15868
- vErrors.push(err26);
15976
+ vErrors.push(err40);
15869
15977
  }
15870
15978
  errors++;
15871
15979
  }
15872
- var valid5 = _errs41 === errors;
15980
+ var valid8 = _errs55 === errors;
15873
15981
  } else {
15874
- var valid5 = true;
15982
+ var valid8 = true;
15875
15983
  }
15876
- if (valid5) {
15984
+ if (valid8) {
15877
15985
  if (data1.eventType !== void 0) {
15878
- const _errs43 = errors;
15986
+ const _errs57 = errors;
15879
15987
  if (typeof data1.eventType !== "string") {
15880
- const err27 = { instancePath: instancePath + "/batch/" + i0 + "/eventType", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/eventType/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15988
+ const err41 = { instancePath: instancePath + "/batch/" + i0 + "/eventType", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/eventType/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15881
15989
  if (vErrors === null) {
15882
- vErrors = [err27];
15990
+ vErrors = [err41];
15883
15991
  } else {
15884
- vErrors.push(err27);
15992
+ vErrors.push(err41);
15885
15993
  }
15886
15994
  errors++;
15887
15995
  }
15888
- var valid5 = _errs43 === errors;
15996
+ var valid8 = _errs57 === errors;
15889
15997
  } else {
15890
- var valid5 = true;
15998
+ var valid8 = true;
15891
15999
  }
15892
- if (valid5) {
15893
- if (data1.capturedOrganizationId !== void 0) {
15894
- let data18 = data1.capturedOrganizationId;
15895
- const _errs45 = errors;
15896
- if (errors === _errs45) {
15897
- if (typeof data18 === "string") {
15898
- if (func1(data18) > 128) {
15899
- const err28 = { 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/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" };
16000
+ if (valid8) {
16001
+ if (data1.repositoryContext !== void 0) {
16002
+ let data22 = data1.repositoryContext;
16003
+ const _errs59 = errors;
16004
+ const _errs60 = errors;
16005
+ let valid9 = false;
16006
+ let passing1 = null;
16007
+ const _errs61 = errors;
16008
+ if (errors === _errs61) {
16009
+ if (data22 && typeof data22 == "object" && !Array.isArray(data22)) {
16010
+ let missing5;
16011
+ if (data22.kind === void 0 && (missing5 = "kind") || data22.repoSyncId === void 0 && (missing5 = "repoSyncId")) {
16012
+ const err42 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf/0/required", keyword: "required", params: { missingProperty: missing5 }, message: "must have required property '" + missing5 + "'" };
15900
16013
  if (vErrors === null) {
15901
- vErrors = [err28];
16014
+ vErrors = [err42];
15902
16015
  } else {
15903
- vErrors.push(err28);
16016
+ vErrors.push(err42);
15904
16017
  }
15905
16018
  errors++;
15906
16019
  } else {
15907
- if (func1(data18) < 1) {
15908
- const err29 = { 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/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
15909
- if (vErrors === null) {
15910
- vErrors = [err29];
15911
- } else {
15912
- vErrors.push(err29);
15913
- }
15914
- errors++;
15915
- } else {
15916
- if (!pattern8.test(data18)) {
15917
- const err30 = { 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_-]+$"' };
16020
+ const _errs63 = errors;
16021
+ for (const key2 in data22) {
16022
+ if (!(key2 === "kind" || key2 === "repoSyncId")) {
16023
+ const err43 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf/0/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" };
15918
16024
  if (vErrors === null) {
15919
- vErrors = [err30];
16025
+ vErrors = [err43];
15920
16026
  } else {
15921
- vErrors.push(err30);
16027
+ vErrors.push(err43);
15922
16028
  }
15923
16029
  errors++;
16030
+ break;
16031
+ }
16032
+ }
16033
+ if (_errs63 === errors) {
16034
+ if (data22.kind !== void 0) {
16035
+ let data23 = data22.kind;
16036
+ const _errs64 = errors;
16037
+ if (typeof data23 !== "string") {
16038
+ const err44 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/kind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf/0/properties/kind/type", keyword: "type", params: { type: "string" }, message: "must be string" };
16039
+ if (vErrors === null) {
16040
+ vErrors = [err44];
16041
+ } else {
16042
+ vErrors.push(err44);
16043
+ }
16044
+ errors++;
16045
+ }
16046
+ if ("repository_bound" !== data23) {
16047
+ const err45 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/kind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf/0/properties/kind/const", keyword: "const", params: { allowedValue: "repository_bound" }, message: "must be equal to constant" };
16048
+ if (vErrors === null) {
16049
+ vErrors = [err45];
16050
+ } else {
16051
+ vErrors.push(err45);
16052
+ }
16053
+ errors++;
16054
+ }
16055
+ var valid10 = _errs64 === errors;
16056
+ } else {
16057
+ var valid10 = true;
16058
+ }
16059
+ if (valid10) {
16060
+ if (data22.repoSyncId !== void 0) {
16061
+ let data24 = data22.repoSyncId;
16062
+ const _errs66 = errors;
16063
+ if (errors === _errs66) {
16064
+ if (typeof data24 === "string") {
16065
+ if (func1(data24) > 128) {
16066
+ const err46 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/repoSyncId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf/0/properties/repoSyncId/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" };
16067
+ if (vErrors === null) {
16068
+ vErrors = [err46];
16069
+ } else {
16070
+ vErrors.push(err46);
16071
+ }
16072
+ errors++;
16073
+ } else {
16074
+ if (func1(data24) < 1) {
16075
+ const err47 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/repoSyncId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf/0/properties/repoSyncId/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
16076
+ if (vErrors === null) {
16077
+ vErrors = [err47];
16078
+ } else {
16079
+ vErrors.push(err47);
16080
+ }
16081
+ errors++;
16082
+ }
16083
+ }
16084
+ } else {
16085
+ const err48 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/repoSyncId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf/0/properties/repoSyncId/type", keyword: "type", params: { type: "string" }, message: "must be string" };
16086
+ if (vErrors === null) {
16087
+ vErrors = [err48];
16088
+ } else {
16089
+ vErrors.push(err48);
16090
+ }
16091
+ errors++;
16092
+ }
16093
+ }
16094
+ var valid10 = _errs66 === errors;
16095
+ } else {
16096
+ var valid10 = true;
16097
+ }
15924
16098
  }
15925
16099
  }
15926
16100
  }
15927
16101
  } else {
15928
- const err31 = { 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/type", keyword: "type", params: { type: "string" }, message: "must be string" };
16102
+ const err49 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf/0/type", keyword: "type", params: { type: "object" }, message: "must be object" };
15929
16103
  if (vErrors === null) {
15930
- vErrors = [err31];
16104
+ vErrors = [err49];
15931
16105
  } else {
15932
- vErrors.push(err31);
16106
+ vErrors.push(err49);
15933
16107
  }
15934
16108
  errors++;
15935
16109
  }
15936
16110
  }
15937
- var valid5 = _errs45 === errors;
15938
- } else {
15939
- var valid5 = true;
15940
- }
15941
- if (valid5) {
15942
- if (data1.captureAuthorityKind !== void 0) {
15943
- let data19 = data1.captureAuthorityKind;
15944
- const _errs47 = errors;
15945
- if (typeof data19 !== "string") {
15946
- const err32 = { instancePath: instancePath + "/batch/" + i0 + "/captureAuthorityKind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/captureAuthorityKind/type", keyword: "type", params: { type: "string" }, message: "must be string" };
15947
- if (vErrors === null) {
15948
- vErrors = [err32];
16111
+ var _valid2 = _errs61 === errors;
16112
+ if (_valid2) {
16113
+ valid9 = true;
16114
+ passing1 = 0;
16115
+ var props2 = true;
16116
+ }
16117
+ const _errs68 = errors;
16118
+ if (errors === _errs68) {
16119
+ if (data22 && typeof data22 == "object" && !Array.isArray(data22)) {
16120
+ let missing6;
16121
+ if (data22.kind === void 0 && (missing6 = "kind")) {
16122
+ const err50 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf/1/required", keyword: "required", params: { missingProperty: missing6 }, message: "must have required property '" + missing6 + "'" };
16123
+ if (vErrors === null) {
16124
+ vErrors = [err50];
16125
+ } else {
16126
+ vErrors.push(err50);
16127
+ }
16128
+ errors++;
15949
16129
  } else {
15950
- vErrors.push(err32);
16130
+ const _errs70 = errors;
16131
+ for (const key3 in data22) {
16132
+ if (!(key3 === "kind")) {
16133
+ const err51 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf/1/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
16134
+ if (vErrors === null) {
16135
+ vErrors = [err51];
16136
+ } else {
16137
+ vErrors.push(err51);
16138
+ }
16139
+ errors++;
16140
+ break;
16141
+ }
16142
+ }
16143
+ if (_errs70 === errors) {
16144
+ if (data22.kind !== void 0) {
16145
+ let data25 = data22.kind;
16146
+ if (typeof data25 !== "string") {
16147
+ const err52 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/kind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf/1/properties/kind/type", keyword: "type", params: { type: "string" }, message: "must be string" };
16148
+ if (vErrors === null) {
16149
+ vErrors = [err52];
16150
+ } else {
16151
+ vErrors.push(err52);
16152
+ }
16153
+ errors++;
16154
+ }
16155
+ if ("non_repository" !== data25) {
16156
+ const err53 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext/kind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf/1/properties/kind/const", keyword: "const", params: { allowedValue: "non_repository" }, message: "must be equal to constant" };
16157
+ if (vErrors === null) {
16158
+ vErrors = [err53];
16159
+ } else {
16160
+ vErrors.push(err53);
16161
+ }
16162
+ errors++;
16163
+ }
16164
+ }
16165
+ }
15951
16166
  }
15952
- errors++;
15953
- }
15954
- if (!(data19 === "workos" || data19 === "service_token")) {
15955
- const err33 = { instancePath: instancePath + "/batch/" + i0 + "/captureAuthorityKind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/captureAuthorityKind/enum", keyword: "enum", params: { allowedValues: schema93.properties.batch.items.anyOf[1].properties.captureAuthorityKind.enum }, message: "must be equal to one of the allowed values" };
16167
+ } else {
16168
+ const err54 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf/1/type", keyword: "type", params: { type: "object" }, message: "must be object" };
15956
16169
  if (vErrors === null) {
15957
- vErrors = [err33];
16170
+ vErrors = [err54];
15958
16171
  } else {
15959
- vErrors.push(err33);
16172
+ vErrors.push(err54);
15960
16173
  }
15961
16174
  errors++;
15962
16175
  }
15963
- var valid5 = _errs47 === errors;
16176
+ }
16177
+ var _valid2 = _errs68 === errors;
16178
+ if (_valid2 && valid9) {
16179
+ valid9 = false;
16180
+ passing1 = [passing1, 1];
15964
16181
  } else {
15965
- var valid5 = true;
16182
+ if (_valid2) {
16183
+ valid9 = true;
16184
+ passing1 = 1;
16185
+ if (props2 !== true) {
16186
+ props2 = true;
16187
+ }
16188
+ }
15966
16189
  }
15967
- if (valid5) {
15968
- if (data1.decisionLifecycleProtocolVersion !== void 0) {
15969
- let data20 = data1.decisionLifecycleProtocolVersion;
15970
- const _errs49 = errors;
15971
- if (!(typeof data20 == "number" && (!(data20 % 1) && !isNaN(data20)) && isFinite(data20))) {
15972
- const err34 = { instancePath: instancePath + "/batch/" + i0 + "/decisionLifecycleProtocolVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/decisionLifecycleProtocolVersion/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
15973
- if (vErrors === null) {
15974
- vErrors = [err34];
15975
- } else {
15976
- vErrors.push(err34);
15977
- }
15978
- errors++;
16190
+ if (!valid9) {
16191
+ const err55 = { instancePath: instancePath + "/batch/" + i0 + "/repositoryContext", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/repositoryContext/oneOf", keyword: "oneOf", params: { passingSchemas: passing1 }, message: "must match exactly one schema in oneOf" };
16192
+ if (vErrors === null) {
16193
+ vErrors = [err55];
16194
+ } else {
16195
+ vErrors.push(err55);
16196
+ }
16197
+ errors++;
16198
+ } else {
16199
+ errors = _errs60;
16200
+ if (vErrors !== null) {
16201
+ if (_errs60) {
16202
+ vErrors.length = _errs60;
16203
+ } else {
16204
+ vErrors = null;
15979
16205
  }
15980
- if (errors === _errs49) {
15981
- if (typeof data20 == "number" && isFinite(data20)) {
15982
- if (data20 > 9007199254740991 || isNaN(data20)) {
15983
- const err35 = { instancePath: instancePath + "/batch/" + i0 + "/decisionLifecycleProtocolVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/decisionLifecycleProtocolVersion/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
16206
+ }
16207
+ }
16208
+ var valid8 = _errs59 === errors;
16209
+ } else {
16210
+ var valid8 = true;
16211
+ }
16212
+ if (valid8) {
16213
+ if (data1.capturedOrganizationId !== void 0) {
16214
+ let data26 = data1.capturedOrganizationId;
16215
+ const _errs73 = errors;
16216
+ if (errors === _errs73) {
16217
+ if (typeof data26 === "string") {
16218
+ if (func1(data26) > 128) {
16219
+ const err56 = { 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/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" };
16220
+ if (vErrors === null) {
16221
+ vErrors = [err56];
16222
+ } else {
16223
+ vErrors.push(err56);
16224
+ }
16225
+ errors++;
16226
+ } else {
16227
+ if (func1(data26) < 1) {
16228
+ const err57 = { 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/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
15984
16229
  if (vErrors === null) {
15985
- vErrors = [err35];
16230
+ vErrors = [err57];
15986
16231
  } else {
15987
- vErrors.push(err35);
16232
+ vErrors.push(err57);
15988
16233
  }
15989
16234
  errors++;
15990
16235
  } else {
15991
- if (data20 < 1 || isNaN(data20)) {
15992
- const err36 = { instancePath: instancePath + "/batch/" + i0 + "/decisionLifecycleProtocolVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/decisionLifecycleProtocolVersion/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
16236
+ if (!pattern8.test(data26)) {
16237
+ 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_-]+$"' };
15993
16238
  if (vErrors === null) {
15994
- vErrors = [err36];
16239
+ vErrors = [err58];
15995
16240
  } else {
15996
- vErrors.push(err36);
16241
+ vErrors.push(err58);
15997
16242
  }
15998
16243
  errors++;
15999
16244
  }
16000
16245
  }
16001
16246
  }
16247
+ } else {
16248
+ const err59 = { 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/type", keyword: "type", params: { type: "string" }, message: "must be string" };
16249
+ if (vErrors === null) {
16250
+ vErrors = [err59];
16251
+ } else {
16252
+ vErrors.push(err59);
16253
+ }
16254
+ errors++;
16002
16255
  }
16003
- var valid5 = _errs49 === errors;
16256
+ }
16257
+ var valid8 = _errs73 === errors;
16258
+ } else {
16259
+ var valid8 = true;
16260
+ }
16261
+ if (valid8) {
16262
+ if (data1.captureAuthorityKind !== void 0) {
16263
+ let data27 = data1.captureAuthorityKind;
16264
+ const _errs75 = errors;
16265
+ if (typeof data27 !== "string") {
16266
+ const err60 = { instancePath: instancePath + "/batch/" + i0 + "/captureAuthorityKind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/captureAuthorityKind/type", keyword: "type", params: { type: "string" }, message: "must be string" };
16267
+ if (vErrors === null) {
16268
+ vErrors = [err60];
16269
+ } else {
16270
+ vErrors.push(err60);
16271
+ }
16272
+ errors++;
16273
+ }
16274
+ if (!(data27 === "workos" || data27 === "service_token")) {
16275
+ const err61 = { instancePath: instancePath + "/batch/" + i0 + "/captureAuthorityKind", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/captureAuthorityKind/enum", keyword: "enum", params: { allowedValues: schema93.properties.batch.items.anyOf[1].properties.captureAuthorityKind.enum }, message: "must be equal to one of the allowed values" };
16276
+ if (vErrors === null) {
16277
+ vErrors = [err61];
16278
+ } else {
16279
+ vErrors.push(err61);
16280
+ }
16281
+ errors++;
16282
+ }
16283
+ var valid8 = _errs75 === errors;
16004
16284
  } else {
16005
- var valid5 = true;
16285
+ var valid8 = true;
16006
16286
  }
16007
- if (valid5) {
16008
- if (data1.producer !== void 0) {
16009
- let data21 = data1.producer;
16010
- const _errs51 = errors;
16011
- if (typeof data21 !== "string") {
16012
- const err37 = { instancePath: instancePath + "/batch/" + i0 + "/producer", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/producer/type", keyword: "type", params: { type: "string" }, message: "must be string" };
16287
+ if (valid8) {
16288
+ if (data1.decisionLifecycleProtocolVersion !== void 0) {
16289
+ let data28 = data1.decisionLifecycleProtocolVersion;
16290
+ const _errs77 = errors;
16291
+ if (!(typeof data28 == "number" && (!(data28 % 1) && !isNaN(data28)) && isFinite(data28))) {
16292
+ const err62 = { instancePath: instancePath + "/batch/" + i0 + "/decisionLifecycleProtocolVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/decisionLifecycleProtocolVersion/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
16013
16293
  if (vErrors === null) {
16014
- vErrors = [err37];
16294
+ vErrors = [err62];
16015
16295
  } else {
16016
- vErrors.push(err37);
16296
+ vErrors.push(err62);
16017
16297
  }
16018
16298
  errors++;
16019
16299
  }
16020
- if (!(data21 === "claude_code" || data21 === "codex" || data21 === "cursor" || data21 === "hermes")) {
16021
- const err38 = { instancePath: instancePath + "/batch/" + i0 + "/producer", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/producer/enum", keyword: "enum", params: { allowedValues: schema93.properties.batch.items.anyOf[1].properties.producer.enum }, message: "must be equal to one of the allowed values" };
16022
- if (vErrors === null) {
16023
- vErrors = [err38];
16024
- } else {
16025
- vErrors.push(err38);
16300
+ if (errors === _errs77) {
16301
+ if (typeof data28 == "number" && isFinite(data28)) {
16302
+ if (data28 > 9007199254740991 || isNaN(data28)) {
16303
+ const err63 = { instancePath: instancePath + "/batch/" + i0 + "/decisionLifecycleProtocolVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/decisionLifecycleProtocolVersion/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
16304
+ if (vErrors === null) {
16305
+ vErrors = [err63];
16306
+ } else {
16307
+ vErrors.push(err63);
16308
+ }
16309
+ errors++;
16310
+ } else {
16311
+ if (data28 < 1 || isNaN(data28)) {
16312
+ const err64 = { instancePath: instancePath + "/batch/" + i0 + "/decisionLifecycleProtocolVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/decisionLifecycleProtocolVersion/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
16313
+ if (vErrors === null) {
16314
+ vErrors = [err64];
16315
+ } else {
16316
+ vErrors.push(err64);
16317
+ }
16318
+ errors++;
16319
+ }
16320
+ }
16026
16321
  }
16027
- errors++;
16028
16322
  }
16029
- var valid5 = _errs51 === errors;
16323
+ var valid8 = _errs77 === errors;
16030
16324
  } else {
16031
- var valid5 = true;
16325
+ var valid8 = true;
16032
16326
  }
16033
- if (valid5) {
16034
- if (data1.toolOutcome !== void 0) {
16035
- let data22 = data1.toolOutcome;
16036
- const _errs53 = errors;
16037
- if (typeof data22 !== "string") {
16038
- const err39 = { instancePath: instancePath + "/batch/" + i0 + "/toolOutcome", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/toolOutcome/type", keyword: "type", params: { type: "string" }, message: "must be string" };
16327
+ if (valid8) {
16328
+ if (data1.producer !== void 0) {
16329
+ let data29 = data1.producer;
16330
+ const _errs79 = errors;
16331
+ if (typeof data29 !== "string") {
16332
+ const err65 = { instancePath: instancePath + "/batch/" + i0 + "/producer", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/producer/type", keyword: "type", params: { type: "string" }, message: "must be string" };
16039
16333
  if (vErrors === null) {
16040
- vErrors = [err39];
16334
+ vErrors = [err65];
16041
16335
  } else {
16042
- vErrors.push(err39);
16336
+ vErrors.push(err65);
16043
16337
  }
16044
16338
  errors++;
16045
16339
  }
16046
- if (!(data22 === "succeeded" || data22 === "returned" || data22 === "failed" || data22 === "interrupted" || data22 === "prevented" || data22 === "unknown")) {
16047
- const err40 = { instancePath: instancePath + "/batch/" + i0 + "/toolOutcome", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/toolOutcome/enum", keyword: "enum", params: { allowedValues: schema93.properties.batch.items.anyOf[1].properties.toolOutcome.enum }, message: "must be equal to one of the allowed values" };
16340
+ if (!(data29 === "claude_code" || data29 === "codex" || data29 === "cursor" || data29 === "hermes")) {
16341
+ const err66 = { instancePath: instancePath + "/batch/" + i0 + "/producer", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/producer/enum", keyword: "enum", params: { allowedValues: schema93.properties.batch.items.anyOf[1].properties.producer.enum }, message: "must be equal to one of the allowed values" };
16048
16342
  if (vErrors === null) {
16049
- vErrors = [err40];
16343
+ vErrors = [err66];
16050
16344
  } else {
16051
- vErrors.push(err40);
16345
+ vErrors.push(err66);
16052
16346
  }
16053
16347
  errors++;
16054
16348
  }
16055
- var valid5 = _errs53 === errors;
16349
+ var valid8 = _errs79 === errors;
16056
16350
  } else {
16057
- var valid5 = true;
16351
+ var valid8 = true;
16058
16352
  }
16059
- if (valid5) {
16060
- if (data1.envelopeVersion !== void 0) {
16061
- let data23 = data1.envelopeVersion;
16062
- const _errs55 = errors;
16063
- if (errors === _errs55) {
16064
- if (typeof data23 == "number" && isFinite(data23)) {
16065
- if (data23 >= 4 || isNaN(data23)) {
16066
- const err41 = { instancePath: instancePath + "/batch/" + i0 + "/envelopeVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/envelopeVersion/exclusiveMaximum", keyword: "exclusiveMaximum", params: { comparison: "<", limit: 4 }, message: "must be < 4" };
16353
+ if (valid8) {
16354
+ if (data1.toolOutcome !== void 0) {
16355
+ let data30 = data1.toolOutcome;
16356
+ const _errs81 = errors;
16357
+ if (typeof data30 !== "string") {
16358
+ const err67 = { instancePath: instancePath + "/batch/" + i0 + "/toolOutcome", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/toolOutcome/type", keyword: "type", params: { type: "string" }, message: "must be string" };
16359
+ if (vErrors === null) {
16360
+ vErrors = [err67];
16361
+ } else {
16362
+ vErrors.push(err67);
16363
+ }
16364
+ errors++;
16365
+ }
16366
+ if (!(data30 === "succeeded" || data30 === "returned" || data30 === "failed" || data30 === "interrupted" || data30 === "prevented" || data30 === "unknown")) {
16367
+ const err68 = { instancePath: instancePath + "/batch/" + i0 + "/toolOutcome", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/toolOutcome/enum", keyword: "enum", params: { allowedValues: schema93.properties.batch.items.anyOf[1].properties.toolOutcome.enum }, message: "must be equal to one of the allowed values" };
16368
+ if (vErrors === null) {
16369
+ vErrors = [err68];
16370
+ } else {
16371
+ vErrors.push(err68);
16372
+ }
16373
+ errors++;
16374
+ }
16375
+ var valid8 = _errs81 === errors;
16376
+ } else {
16377
+ var valid8 = true;
16378
+ }
16379
+ if (valid8) {
16380
+ if (data1.envelopeVersion !== void 0) {
16381
+ let data31 = data1.envelopeVersion;
16382
+ const _errs83 = errors;
16383
+ if (errors === _errs83) {
16384
+ if (typeof data31 == "number" && isFinite(data31)) {
16385
+ if (data31 >= 4 || isNaN(data31)) {
16386
+ const err69 = { instancePath: instancePath + "/batch/" + i0 + "/envelopeVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/envelopeVersion/exclusiveMaximum", keyword: "exclusiveMaximum", params: { comparison: "<", limit: 4 }, message: "must be < 4" };
16387
+ if (vErrors === null) {
16388
+ vErrors = [err69];
16389
+ } else {
16390
+ vErrors.push(err69);
16391
+ }
16392
+ errors++;
16393
+ }
16394
+ } else {
16395
+ const err70 = { instancePath: instancePath + "/batch/" + i0 + "/envelopeVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/envelopeVersion/type", keyword: "type", params: { type: "number" }, message: "must be number" };
16067
16396
  if (vErrors === null) {
16068
- vErrors = [err41];
16397
+ vErrors = [err70];
16069
16398
  } else {
16070
- vErrors.push(err41);
16399
+ vErrors.push(err70);
16071
16400
  }
16072
16401
  errors++;
16073
16402
  }
16074
- } else {
16075
- const err42 = { instancePath: instancePath + "/batch/" + i0 + "/envelopeVersion", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/properties/envelopeVersion/type", keyword: "type", params: { type: "number" }, message: "must be number" };
16076
- if (vErrors === null) {
16077
- vErrors = [err42];
16078
- } else {
16079
- vErrors.push(err42);
16080
- }
16081
- errors++;
16082
16403
  }
16404
+ var valid8 = _errs83 === errors;
16405
+ } else {
16406
+ var valid8 = true;
16083
16407
  }
16084
- var valid5 = _errs55 === errors;
16085
- } else {
16086
- var valid5 = true;
16087
16408
  }
16088
16409
  }
16089
16410
  }
@@ -16097,28 +16418,28 @@ function validate51(data, { instancePath = "", parentData, parentDataProperty, r
16097
16418
  }
16098
16419
  }
16099
16420
  } else {
16100
- const err43 = { instancePath: instancePath + "/batch/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/type", keyword: "type", params: { type: "object" }, message: "must be object" };
16421
+ const err71 = { instancePath: instancePath + "/batch/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf/1/type", keyword: "type", params: { type: "object" }, message: "must be object" };
16101
16422
  if (vErrors === null) {
16102
- vErrors = [err43];
16423
+ vErrors = [err71];
16103
16424
  } else {
16104
- vErrors.push(err43);
16425
+ vErrors.push(err71);
16105
16426
  }
16106
16427
  errors++;
16107
16428
  }
16108
16429
  }
16109
- var _valid0 = _errs32 === errors;
16430
+ var _valid0 = _errs46 === errors;
16110
16431
  valid3 = valid3 || _valid0;
16111
16432
  if (_valid0) {
16112
- if (props0 !== true) {
16113
- props0 = true;
16433
+ if (props1 !== true) {
16434
+ props1 = true;
16114
16435
  }
16115
16436
  }
16116
16437
  if (!valid3) {
16117
- const err44 = { instancePath: instancePath + "/batch/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
16438
+ const err72 = { instancePath: instancePath + "/batch/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/MoveIngestRequest/properties/batch/items/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
16118
16439
  if (vErrors === null) {
16119
- vErrors = [err44];
16440
+ vErrors = [err72];
16120
16441
  } else {
16121
- vErrors.push(err44);
16442
+ vErrors.push(err72);
16122
16443
  }
16123
16444
  errors++;
16124
16445
  validate51.errors = vErrors;
@@ -19748,6 +20069,37 @@ function cachedCollectScopeAdmits(cwd, facts) {
19748
20069
  );
19749
20070
  }
19750
20071
 
20072
+ // src/lib/commit-heartbeat.ts
20073
+ import { execFileSync as execFileSync3 } from "child_process";
20074
+ import { mkdirSync as mkdirSync5, readFileSync as readFileSync8, readdirSync as readdirSync3, unlinkSync } from "fs";
20075
+ import { dirname as dirname8, join as join9, resolve as resolve3 } from "path";
20076
+ var GIT_TIMEOUT_MS3 = 1e3;
20077
+ function gitPath(cwd, relative3) {
20078
+ const value = execFileSync3("git", ["rev-parse", "--git-path", relative3], {
20079
+ cwd,
20080
+ encoding: "utf8",
20081
+ stdio: ["ignore", "pipe", "ignore"],
20082
+ timeout: GIT_TIMEOUT_MS3
20083
+ }).replace(/\r?\n$/u, "");
20084
+ if (value === "" || /[\0\r\n]/u.test(value)) throw new Error("Git returned an unsafe path");
20085
+ return resolve3(cwd, value);
20086
+ }
20087
+ function ensurePrivateParent(path) {
20088
+ mkdirSync5(dirname8(dirname8(path)), { recursive: true, mode: 448 });
20089
+ mkdirSync5(dirname8(path), { recursive: true, mode: 448 });
20090
+ }
20091
+ function writeStamp(path, at) {
20092
+ ensurePrivateParent(path);
20093
+ atomicWriteFile(path, `${JSON.stringify({ at })}
20094
+ `, { mode: 384 });
20095
+ }
20096
+ function recordConversationCaptured(cwd, agent) {
20097
+ try {
20098
+ writeStamp(gitPath(cwd, `prim/conversation-captured/${agent}`), Date.now());
20099
+ } catch {
20100
+ }
20101
+ }
20102
+
19751
20103
  // src/lib/unattended.ts
19752
20104
  var UNATTENDED_ENV = "PRIM_UNATTENDED";
19753
20105
  function unattendedEnv(env = process.env) {
@@ -19755,7 +20107,7 @@ function unattendedEnv(env = process.env) {
19755
20107
  }
19756
20108
 
19757
20109
  // src/lib/workspace-id.ts
19758
- import { execFileSync as execFileSync3 } from "child_process";
20110
+ import { execFileSync as execFileSync4 } from "child_process";
19759
20111
  import { randomUUID as randomUUID2 } from "crypto";
19760
20112
  import {
19761
20113
  constants as constants2,
@@ -19765,15 +20117,15 @@ import {
19765
20117
  fsyncSync as fsyncSync2,
19766
20118
  linkSync,
19767
20119
  lstatSync as lstatSync2,
19768
- mkdirSync as mkdirSync5,
20120
+ mkdirSync as mkdirSync6,
19769
20121
  openSync as openSync3,
19770
- readFileSync as readFileSync8,
20122
+ readFileSync as readFileSync9,
19771
20123
  statSync as statSync2,
19772
- unlinkSync,
20124
+ unlinkSync as unlinkSync2,
19773
20125
  writeFileSync as writeFileSync3
19774
20126
  } from "fs";
19775
- import { dirname as dirname8, isAbsolute as isAbsolute3, join as join9, resolve as resolve3 } from "path";
19776
- var WORKSPACE_ID_RELATIVE_PATH = join9("prim", "workspace-id");
20127
+ import { dirname as dirname9, isAbsolute as isAbsolute3, join as join10, resolve as resolve4 } from "path";
20128
+ var WORKSPACE_ID_RELATIVE_PATH = join10("prim", "workspace-id");
19777
20129
  var MAX_ANCESTORS = 64;
19778
20130
  var MAX_GIT_FILE_BYTES = 4096;
19779
20131
  var MAX_ID_FILE_BYTES = 128;
@@ -19801,7 +20153,7 @@ function resolveWorkspaceIdPath(cwd) {
19801
20153
  if (fromFilesystem) return { status: "resolved", path: fromFilesystem };
19802
20154
  }
19803
20155
  try {
19804
- const output = execFileSync3(
20156
+ const output = execFileSync4(
19805
20157
  "git",
19806
20158
  ["rev-parse", "--is-inside-work-tree", "--git-path", WORKSPACE_ID_RELATIVE_PATH],
19807
20159
  {
@@ -19813,13 +20165,13 @@ function resolveWorkspaceIdPath(cwd) {
19813
20165
  windowsHide: true
19814
20166
  }
19815
20167
  );
19816
- const [insideWorktree, gitPath, ...extra] = output.trim().split(/\r?\n/);
19817
- if (insideWorktree !== "true" || !gitPath || extra.length > 0 || gitPath.includes("\0")) {
20168
+ const [insideWorktree, gitPath2, ...extra] = output.trim().split(/\r?\n/);
20169
+ if (insideWorktree !== "true" || !gitPath2 || extra.length > 0 || gitPath2.includes("\0")) {
19818
20170
  return { status: "not_git" };
19819
20171
  }
19820
20172
  return {
19821
20173
  status: "resolved",
19822
- path: isAbsolute3(gitPath) ? resolve3(gitPath) : resolve3(cwd, gitPath)
20174
+ path: isAbsolute3(gitPath2) ? resolve4(gitPath2) : resolve4(cwd, gitPath2)
19823
20175
  };
19824
20176
  } catch (error) {
19825
20177
  const code = errorCode(error);
@@ -19830,21 +20182,21 @@ function resolveWorkspaceIdPath(cwd) {
19830
20182
  }
19831
20183
  }
19832
20184
  function resolveFromFilesystem(cwd) {
19833
- let current = resolve3(cwd);
20185
+ let current = resolve4(cwd);
19834
20186
  for (let depth = 0; depth < MAX_ANCESTORS; depth += 1) {
19835
- const dotGit = join9(current, ".git");
20187
+ const dotGit = join10(current, ".git");
19836
20188
  try {
19837
20189
  const stat = lstatSync2(dotGit);
19838
20190
  if (stat.isDirectory() && isGitDirectory(dotGit)) {
19839
- return join9(dotGit, WORKSPACE_ID_RELATIVE_PATH);
20191
+ return join10(dotGit, WORKSPACE_ID_RELATIVE_PATH);
19840
20192
  }
19841
20193
  if (stat.isFile() && stat.size <= MAX_GIT_FILE_BYTES) {
19842
- const contents = readFileSync8(dotGit, "utf8");
20194
+ const contents = readFileSync9(dotGit, "utf8");
19843
20195
  const match = /^gitdir: (.+?)(?:\r?\n)?$/.exec(contents);
19844
20196
  if (match?.[1]) {
19845
- const gitDirectory = isAbsolute3(match[1]) ? resolve3(match[1]) : resolve3(current, match[1]);
20197
+ const gitDirectory = isAbsolute3(match[1]) ? resolve4(match[1]) : resolve4(current, match[1]);
19846
20198
  if (isGitDirectory(gitDirectory)) {
19847
- return join9(gitDirectory, WORKSPACE_ID_RELATIVE_PATH);
20199
+ return join10(gitDirectory, WORKSPACE_ID_RELATIVE_PATH);
19848
20200
  }
19849
20201
  }
19850
20202
  }
@@ -19855,7 +20207,7 @@ function resolveFromFilesystem(cwd) {
19855
20207
  return null;
19856
20208
  }
19857
20209
  }
19858
- const parent = dirname8(current);
20210
+ const parent = dirname9(current);
19859
20211
  if (parent === current) break;
19860
20212
  current = parent;
19861
20213
  }
@@ -19863,7 +20215,7 @@ function resolveFromFilesystem(cwd) {
19863
20215
  }
19864
20216
  function isGitDirectory(path) {
19865
20217
  try {
19866
- return statSync2(join9(path, "HEAD")).isFile();
20218
+ return statSync2(join10(path, "HEAD")).isFile();
19867
20219
  } catch {
19868
20220
  return false;
19869
20221
  }
@@ -19882,7 +20234,7 @@ function inspectPath(path) {
19882
20234
  return { status: "corrupt", path, reason: "invalid_content" };
19883
20235
  }
19884
20236
  try {
19885
- const contents = readFileSync8(path, "utf8");
20237
+ const contents = readFileSync9(path, "utf8");
19886
20238
  const workspaceId = contents.endsWith("\n") ? contents.slice(0, -1) : contents;
19887
20239
  if ((contents === workspaceId || contents === `${workspaceId}
19888
20240
  `) && isCanonicalWorkspaceId(workspaceId)) {
@@ -19899,13 +20251,13 @@ function inspectPath(path) {
19899
20251
  }
19900
20252
  }
19901
20253
  function createWorkspaceId(path) {
19902
- const parent = dirname8(path);
20254
+ const parent = dirname9(path);
19903
20255
  const workspaceId = randomUUID2();
19904
- const temporaryPath = join9(parent, `.workspace-id-${process.pid}-${randomUUID2()}.tmp`);
20256
+ const temporaryPath = join10(parent, `.workspace-id-${process.pid}-${randomUUID2()}.tmp`);
19905
20257
  let temporaryCreated = false;
19906
20258
  let publishing = false;
19907
20259
  try {
19908
- mkdirSync5(parent, { recursive: true, mode: 448 });
20260
+ mkdirSync6(parent, { recursive: true, mode: 448 });
19909
20261
  chmodSync3(parent, 448);
19910
20262
  const fd = openSync3(
19911
20263
  temporaryPath,
@@ -19935,7 +20287,7 @@ function createWorkspaceId(path) {
19935
20287
  } finally {
19936
20288
  if (temporaryCreated) {
19937
20289
  try {
19938
- unlinkSync(temporaryPath);
20290
+ unlinkSync2(temporaryPath);
19939
20291
  } catch {
19940
20292
  }
19941
20293
  }
@@ -19975,20 +20327,20 @@ import { createHash as createHash5, randomBytes as randomBytes3 } from "crypto";
19975
20327
  import {
19976
20328
  chmodSync as chmodSync4,
19977
20329
  existsSync as existsSync8,
19978
- mkdirSync as mkdirSync6,
19979
- readFileSync as readFileSync10,
19980
- readdirSync as readdirSync3,
20330
+ mkdirSync as mkdirSync7,
20331
+ readFileSync as readFileSync11,
20332
+ readdirSync as readdirSync4,
19981
20333
  renameSync as renameSync2,
19982
20334
  rmSync as rmSync5,
19983
20335
  statSync as statSync3,
19984
- unlinkSync as unlinkSync2,
20336
+ unlinkSync as unlinkSync3,
19985
20337
  writeFileSync as writeFileSync4
19986
20338
  } from "fs";
19987
- import { join as join12 } from "path";
20339
+ import { join as join13 } from "path";
19988
20340
 
19989
20341
  // src/daemon/client.ts
19990
20342
  import { createConnection } from "net";
19991
- import { join as join10 } from "path";
20343
+ import { join as join11 } from "path";
19992
20344
 
19993
20345
  // src/daemon/principal.ts
19994
20346
  import { createHash as createHash4 } from "crypto";
@@ -20038,7 +20390,7 @@ function parseDaemonResponseEnvelope(value) {
20038
20390
  }
20039
20391
 
20040
20392
  // src/daemon/client.ts
20041
- var SOCK_PATH = join10(primConfigDirectory(), "sock");
20393
+ var SOCK_PATH = join11(primConfigDirectory(), "sock");
20042
20394
  var DEFAULT_TIMEOUT_MS2 = 250;
20043
20395
  var nextRequestId = 1;
20044
20396
  function daemonRequest(method, params = {}, opts = {}) {
@@ -20051,7 +20403,7 @@ function daemonRequest(method, params = {}, opts = {}) {
20051
20403
  ...caller ? { caller } : {}
20052
20404
  };
20053
20405
  const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS2;
20054
- return new Promise((resolve6) => {
20406
+ return new Promise((resolve7) => {
20055
20407
  let settled = false;
20056
20408
  let socket;
20057
20409
  let buffer = Buffer.alloc(0);
@@ -20066,7 +20418,7 @@ function daemonRequest(method, params = {}, opts = {}) {
20066
20418
  } catch {
20067
20419
  }
20068
20420
  }
20069
- resolve6(value);
20421
+ resolve7(value);
20070
20422
  };
20071
20423
  const timer = setTimeout(() => settle(null), timeoutMs);
20072
20424
  timer.unref();
@@ -20139,8 +20491,8 @@ function isActionablePrivateDraft(row) {
20139
20491
  }
20140
20492
 
20141
20493
  // src/lib/bin-path.ts
20142
- import { existsSync as existsSync7, readFileSync as readFileSync9 } from "fs";
20143
- import { dirname as dirname9, isAbsolute as isAbsolute4, join as join11 } from "path";
20494
+ import { existsSync as existsSync7, readFileSync as readFileSync10 } from "fs";
20495
+ import { dirname as dirname10, isAbsolute as isAbsolute4, join as join12 } from "path";
20144
20496
  import { fileURLToPath } from "url";
20145
20497
  var PKG_NAME = "@primitive.ai/prim";
20146
20498
  var ROOT_WALK_LIMIT = 6;
@@ -20150,12 +20502,12 @@ function locateRoot() {
20150
20502
  if (resolvedRoot !== void 0) {
20151
20503
  return resolvedRoot;
20152
20504
  }
20153
- let dir = dirname9(fileURLToPath(import.meta.url));
20505
+ let dir = dirname10(fileURLToPath(import.meta.url));
20154
20506
  for (let depth = 0; depth < ROOT_WALK_LIMIT; depth++) {
20155
- const manifestPath = join11(dir, "package.json");
20507
+ const manifestPath = join12(dir, "package.json");
20156
20508
  if (existsSync7(manifestPath)) {
20157
20509
  try {
20158
- const manifest = JSON.parse(readFileSync9(manifestPath, "utf-8"));
20510
+ const manifest = JSON.parse(readFileSync10(manifestPath, "utf-8"));
20159
20511
  if (manifest.name === PKG_NAME && manifest.bin) {
20160
20512
  resolvedRoot = { dir, version: manifest.version, bin: manifest.bin };
20161
20513
  return resolvedRoot;
@@ -20163,7 +20515,7 @@ function locateRoot() {
20163
20515
  } catch {
20164
20516
  }
20165
20517
  }
20166
- const parent = dirname9(dir);
20518
+ const parent = dirname10(dir);
20167
20519
  if (parent === dir) {
20168
20520
  break;
20169
20521
  }
@@ -20354,10 +20706,10 @@ var STATE_VERSION = 1;
20354
20706
  var DRAFT_STATE_VERSION = 2;
20355
20707
  var NO_CURSOR = -1;
20356
20708
  function stateRoot(namespace) {
20357
- return join12(primConfigDirectory(), namespace, "decision-digests");
20709
+ return join13(primConfigDirectory(), namespace, "decision-digests");
20358
20710
  }
20359
20711
  function draftStateRoot(namespace) {
20360
- return join12(primConfigDirectory(), namespace, "decision-draft-deliveries");
20712
+ return join13(primConfigDirectory(), namespace, "decision-draft-deliveries");
20361
20713
  }
20362
20714
  function workspaceFor(cwd) {
20363
20715
  try {
@@ -20369,12 +20721,12 @@ function workspaceFor(cwd) {
20369
20721
  function statePath(args) {
20370
20722
  const identity = `${args.siteUrl}\0${workspaceFor(args.cwd)}\0${args.sessionId}`;
20371
20723
  const key = createHash5("sha256").update(identity).digest("hex");
20372
- return join12(stateRoot(args.namespace), `${key}.json`);
20724
+ return join13(stateRoot(args.namespace), `${key}.json`);
20373
20725
  }
20374
20726
  function draftStatePath(args) {
20375
20727
  const identity = `${args.siteUrl}\0${workspaceFor(args.cwd)}\0${args.sessionId}\0${args.principalId}\0${args.organizationId}\0${args.credentialFingerprint}`;
20376
20728
  const key = createHash5("sha256").update(identity).digest("hex");
20377
- return join12(draftStateRoot(args.namespace), `${key}.json`);
20729
+ return join13(draftStateRoot(args.namespace), `${key}.json`);
20378
20730
  }
20379
20731
  function parseState(value) {
20380
20732
  if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
@@ -20415,7 +20767,7 @@ function parseDraftState(value) {
20415
20767
  function readState(path) {
20416
20768
  if (!existsSync8(path)) return void 0;
20417
20769
  try {
20418
- return parseState(JSON.parse(readFileSync10(path, "utf8")));
20770
+ return parseState(JSON.parse(readFileSync11(path, "utf8")));
20419
20771
  } catch {
20420
20772
  return void 0;
20421
20773
  }
@@ -20423,15 +20775,15 @@ function readState(path) {
20423
20775
  function readDraftState(path) {
20424
20776
  if (!existsSync8(path)) return void 0;
20425
20777
  try {
20426
- return parseDraftState(JSON.parse(readFileSync10(path, "utf8")));
20778
+ return parseDraftState(JSON.parse(readFileSync11(path, "utf8")));
20427
20779
  } catch {
20428
20780
  return void 0;
20429
20781
  }
20430
20782
  }
20431
20783
  function writeStateFile(path, directory, state) {
20432
- mkdirSync6(directory, { recursive: true, mode: 448 });
20784
+ mkdirSync7(directory, { recursive: true, mode: 448 });
20433
20785
  chmodSync4(directory, 448);
20434
- const temporary = join12(
20786
+ const temporary = join13(
20435
20787
  directory,
20436
20788
  `.${path.slice(directory.length + 1)}.tmp-${process.pid}-${randomBytes3(8).toString("hex")}`
20437
20789
  );
@@ -20446,7 +20798,7 @@ function writeStateFile(path, directory, state) {
20446
20798
  renameSync2(temporary, path);
20447
20799
  } finally {
20448
20800
  try {
20449
- unlinkSync2(temporary);
20801
+ unlinkSync3(temporary);
20450
20802
  } catch {
20451
20803
  }
20452
20804
  }
@@ -20455,14 +20807,14 @@ function cleanupStateFiles(directory, now) {
20455
20807
  if (!existsSync8(directory)) return;
20456
20808
  let names;
20457
20809
  try {
20458
- names = readdirSync3(directory);
20810
+ names = readdirSync4(directory);
20459
20811
  } catch {
20460
20812
  return;
20461
20813
  }
20462
20814
  const files = [];
20463
20815
  const residue = [];
20464
20816
  for (const name of names) {
20465
- const path = join12(directory, name);
20817
+ const path = join13(directory, name);
20466
20818
  try {
20467
20819
  const mtimeMs = statSync3(path).mtimeMs;
20468
20820
  if (name.endsWith(".json")) {
@@ -20477,7 +20829,7 @@ function cleanupStateFiles(directory, now) {
20477
20829
  const excess = files.filter((file) => !stale.some((candidate) => candidate.path === file.path)).sort((a, b) => a.mtimeMs - b.mtimeMs).slice(0, Math.max(0, files.length - CODEX_DIGEST_STATE_MAX_FILES));
20478
20830
  for (const file of [...stale, ...excess]) {
20479
20831
  try {
20480
- unlinkSync2(file.path);
20832
+ unlinkSync3(file.path);
20481
20833
  } catch {
20482
20834
  }
20483
20835
  }
@@ -20800,9 +21152,9 @@ async function processCodexMessageContext(envelope, deps = defaultDeps) {
20800
21152
  }
20801
21153
 
20802
21154
  // src/commands/cursor-install.ts
20803
- import { existsSync as existsSync11, readFileSync as readFileSync13 } from "fs";
21155
+ import { existsSync as existsSync11, readFileSync as readFileSync14 } from "fs";
20804
21156
  import { homedir as homedir4 } from "os";
20805
- import { isAbsolute as isAbsolute6, join as join15 } from "path";
21157
+ import { isAbsolute as isAbsolute6, join as join16 } from "path";
20806
21158
 
20807
21159
  // src/lib/hook-runtime.ts
20808
21160
  import { createHash as createHash6, randomBytes as randomBytes4 } from "crypto";
@@ -20813,10 +21165,10 @@ import {
20813
21165
  copyFileSync,
20814
21166
  existsSync as existsSync9,
20815
21167
  lstatSync as lstatSync3,
20816
- mkdirSync as mkdirSync7,
21168
+ mkdirSync as mkdirSync8,
20817
21169
  mkdtempSync,
20818
- readFileSync as readFileSync11,
20819
- readdirSync as readdirSync4,
21170
+ readFileSync as readFileSync12,
21171
+ readdirSync as readdirSync5,
20820
21172
  realpathSync as realpathSync2,
20821
21173
  renameSync as renameSync3,
20822
21174
  rmSync as rmSync6,
@@ -20824,7 +21176,7 @@ import {
20824
21176
  utimesSync,
20825
21177
  writeFileSync as writeFileSync5
20826
21178
  } from "fs";
20827
- import { delimiter, dirname as dirname10, isAbsolute as isAbsolute5, join as join13, resolve as resolve4 } from "path";
21179
+ import { delimiter, dirname as dirname11, isAbsolute as isAbsolute5, join as join14, resolve as resolve5 } from "path";
20828
21180
 
20829
21181
  // src/lib/git-hook-contract.ts
20830
21182
  var GIT_HOOK_ENTRYPOINT_CONTENT = `#!/bin/sh
@@ -20917,9 +21269,9 @@ exec "$prim_node" "$prim_entry" "$@"
20917
21269
  `;
20918
21270
 
20919
21271
  // src/commands/claude-install.ts
20920
- import { existsSync as existsSync10, readFileSync as readFileSync12 } from "fs";
21272
+ import { existsSync as existsSync10, readFileSync as readFileSync13 } from "fs";
20921
21273
  import { homedir as homedir3 } from "os";
20922
- import { join as join14 } from "path";
21274
+ import { join as join15 } from "path";
20923
21275
  var CAPTURE_BIN = "prim-hook";
20924
21276
  var GATE_BIN = "prim-pre-tool-use";
20925
21277
  var POST_TOOL_USE_BIN = "prim-post-tool-use";
@@ -20928,7 +21280,7 @@ var SESSION_END_BIN = "prim-session-end";
20928
21280
  var STATUSLINE_BIN = "prim-statusline";
20929
21281
  var STATUSLINE_ARGS = "";
20930
21282
  var STATUSLINE_COMMAND = stableHookCommand(STATUSLINE_BIN, STATUSLINE_ARGS);
20931
- var USER_SCOPE_PATH = join14(homedir3(), ".claude", "settings.json");
21283
+ var USER_SCOPE_PATH = join15(homedir3(), ".claude", "settings.json");
20932
21284
  function projectRoot() {
20933
21285
  return gitToplevel() ?? process.cwd();
20934
21286
  }
@@ -21007,11 +21359,11 @@ function cursorConfigDirectory(env = process.env, home = homedir4(), platform2 =
21007
21359
  const explicit = env.CURSOR_CONFIG_DIR?.trim();
21008
21360
  if (explicit && isAbsolute6(explicit)) return explicit;
21009
21361
  const xdg = env.XDG_CONFIG_HOME?.trim();
21010
- if (platform2 !== "darwin" && xdg && isAbsolute6(xdg)) return join15(xdg, "cursor");
21011
- return join15(home, ".cursor");
21362
+ if (platform2 !== "darwin" && xdg && isAbsolute6(xdg)) return join16(xdg, "cursor");
21363
+ return join16(home, ".cursor");
21012
21364
  }
21013
21365
  function cursorHooksPath(scope, root = projectRoot()) {
21014
- return scope === "user" ? join15(cursorConfigDirectory(), "hooks.json") : join15(root, ".cursor", "hooks.json");
21366
+ return scope === "user" ? join16(cursorConfigDirectory(), "hooks.json") : join16(root, ".cursor", "hooks.json");
21015
21367
  }
21016
21368
  function plainObject(value) {
21017
21369
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -21020,7 +21372,7 @@ function readCursorHooks(path) {
21020
21372
  if (!existsSync11(path)) return {};
21021
21373
  let parsed;
21022
21374
  try {
21023
- parsed = JSON.parse(readFileSync13(path, "utf8"));
21375
+ parsed = JSON.parse(readFileSync14(path, "utf8"));
21024
21376
  } catch {
21025
21377
  throw new Error(`invalid Cursor hooks JSON at ${path}`);
21026
21378
  }
@@ -21143,13 +21495,13 @@ function buildHookOutput(options) {
21143
21495
  return output;
21144
21496
  }
21145
21497
  function writeHookOutput(output, stream = process.stdout) {
21146
- return new Promise((resolve6) => {
21498
+ return new Promise((resolve7) => {
21147
21499
  let settled = false;
21148
21500
  const finish = (ok, retainErrorListener = false) => {
21149
21501
  if (settled) return;
21150
21502
  settled = true;
21151
21503
  if (!retainErrorListener) stream.off("error", onError);
21152
- resolve6(ok);
21504
+ resolve7(ok);
21153
21505
  };
21154
21506
  const onError = () => {
21155
21507
  if (settled) {
@@ -21290,6 +21642,254 @@ function extractFileTargets(toolName, toolInput, agent = "claude_code") {
21290
21642
  return { paths, complete: paths.length > 0 };
21291
21643
  }
21292
21644
 
21645
+ // src/hooks/redact.ts
21646
+ import { existsSync as existsSync12, readFileSync as readFileSync15, statSync as statSync5 } from "fs";
21647
+ import { join as join17 } from "path";
21648
+ import { Worker } from "worker_threads";
21649
+ var USER_HOME_RULES = [
21650
+ {
21651
+ pattern: /\/Users\/[^/\\\s"'`]+/g,
21652
+ reason: "user-home-path",
21653
+ replacement: "/Users/__redacted_user__"
21654
+ },
21655
+ {
21656
+ pattern: /\/home\/[^/\\\s"'`]+/g,
21657
+ reason: "user-home-path",
21658
+ replacement: "/home/__redacted_user__"
21659
+ },
21660
+ {
21661
+ pattern: /([A-Za-z]:\\Users\\)[^/\\\s"'`]+/gi,
21662
+ reason: "user-home-path",
21663
+ replacement: "$1__redacted_user__"
21664
+ },
21665
+ {
21666
+ pattern: /\/root(?=\/|$)/g,
21667
+ reason: "user-home-path",
21668
+ replacement: "/__redacted_user__"
21669
+ }
21670
+ ];
21671
+ var DEFAULT_RULES = [
21672
+ { pattern: /Bearer\s+[A-Za-z0-9._~+/=-]+/gi, reason: "bearer-token" },
21673
+ {
21674
+ pattern: /\bsk-(?:(?:ant|proj)-)?[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
21675
+ reason: "sk-api-key"
21676
+ },
21677
+ {
21678
+ pattern: /-----BEGIN [A-Z ]+PRIVATE KEY-----[\s\S]+?-----END [A-Z ]+PRIVATE KEY-----/g,
21679
+ reason: "private-key"
21680
+ },
21681
+ { pattern: /xox[abprs]-[A-Za-z0-9-]{10,}/g, reason: "slack-token" },
21682
+ {
21683
+ pattern: /\b(?:gh[pousr]_[A-Za-z0-9]{36,}|github_pat_[A-Za-z0-9_]{50,})\b/g,
21684
+ reason: "github-pat"
21685
+ },
21686
+ { pattern: /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/g, reason: "aws-access-key" },
21687
+ {
21688
+ pattern: /\bAWS_(?:SECRET_ACCESS_KEY|SESSION_TOKEN)"?\s*[:=]\s*["']?[A-Za-z0-9/+=]{20,}["']?/gi,
21689
+ reason: "aws-secret"
21690
+ },
21691
+ { pattern: /\bAIza[0-9A-Za-z_-]{35}(?![0-9A-Za-z_-])/g, reason: "gcp-api-key" },
21692
+ {
21693
+ pattern: /\bya29\.[0-9A-Za-z_-]{20,}(?![0-9A-Za-z_-])/g,
21694
+ reason: "gcp-oauth-token"
21695
+ },
21696
+ {
21697
+ pattern: /\beyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*(?![A-Za-z0-9_-])/g,
21698
+ reason: "jwt"
21699
+ },
21700
+ { pattern: /\bBasic\s+[A-Za-z0-9+/]+={0,2}/gi, reason: "basic-auth" },
21701
+ { pattern: /\bhttps?:\/\/[^/\s:@]+:[^/\s@]+@/gi, reason: "basic-auth" },
21702
+ ...USER_HOME_RULES
21703
+ ];
21704
+ var MAX_SCRUB_LEN = 256e3;
21705
+ var MAX_WORKSPACE_CONFIG_BYTES = 64 * 1024;
21706
+ var MAX_WORKSPACE_RULES = 32;
21707
+ var MAX_WORKSPACE_PATTERN_LENGTH = 512;
21708
+ var MAX_WORKSPACE_REASON_LENGTH = 64;
21709
+ var WORKSPACE_RULE_TIMEOUT_MS = 250;
21710
+ var WORKSPACE_FILE2 = ".prim/redaction.json";
21711
+ var SAFE_REASON_RE = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u;
21712
+ var SAFE_WORKSPACE_FLAGS_RE = /^[gimsu]*$/u;
21713
+ function debugRedaction(message) {
21714
+ writeHookDebug(`redaction: ${message}`);
21715
+ }
21716
+ function normalizedWorkspaceFlags(value) {
21717
+ if (value !== void 0 && typeof value !== "string") return null;
21718
+ const requested = value ?? "";
21719
+ if (!SAFE_WORKSPACE_FLAGS_RE.test(requested)) return null;
21720
+ return [...new Set(`g${requested}`)].sort().join("");
21721
+ }
21722
+ function loadWorkspaceRules(cwd) {
21723
+ const path = join17(cwd, WORKSPACE_FILE2);
21724
+ if (!existsSync12(path)) return [];
21725
+ let cfg;
21726
+ try {
21727
+ if (statSync5(path).size > MAX_WORKSPACE_CONFIG_BYTES) {
21728
+ debugRedaction(`ignoring oversized ${WORKSPACE_FILE2}`);
21729
+ return [];
21730
+ }
21731
+ cfg = JSON.parse(readFileSync15(path, "utf-8"));
21732
+ } catch {
21733
+ debugRedaction(`ignoring unparseable ${WORKSPACE_FILE2}`);
21734
+ return [];
21735
+ }
21736
+ if (!Array.isArray(cfg.rules)) return [];
21737
+ const compiled = [];
21738
+ for (const candidate of cfg.rules.slice(0, MAX_WORKSPACE_RULES)) {
21739
+ if (!candidate || typeof candidate !== "object") continue;
21740
+ const { pattern, reason } = candidate;
21741
+ const flags = normalizedWorkspaceFlags(candidate.flags);
21742
+ if (typeof pattern !== "string" || pattern.length === 0 || pattern.length > MAX_WORKSPACE_PATTERN_LENGTH || typeof reason !== "string" || reason.length === 0 || reason.length > MAX_WORKSPACE_REASON_LENGTH || !SAFE_REASON_RE.test(reason) || flags === null) {
21743
+ debugRedaction("skipping invalid workspace rule metadata");
21744
+ continue;
21745
+ }
21746
+ try {
21747
+ compiled.push({ pattern: new RegExp(pattern, flags), reason });
21748
+ } catch {
21749
+ debugRedaction(`skipping invalid workspace rule ${reason}`);
21750
+ }
21751
+ }
21752
+ return compiled;
21753
+ }
21754
+ function applyRules(input, rules) {
21755
+ if (input.length > MAX_SCRUB_LEN) return "<REDACTED:oversized>";
21756
+ let out = input;
21757
+ for (const rule of rules) {
21758
+ out = out.replace(rule.pattern, rule.replacement ?? `<REDACTED:${rule.reason}>`);
21759
+ }
21760
+ return out;
21761
+ }
21762
+ var REDACTED_OBJECT_KEY = "<REDACTED:object-key>";
21763
+ function redactedObjectKey(input, transform) {
21764
+ return transform(input) === input ? input : REDACTED_OBJECT_KEY;
21765
+ }
21766
+ function uniqueObjectKey(output, key) {
21767
+ let candidate = key;
21768
+ let suffix = 2;
21769
+ while (Object.hasOwn(output, candidate)) candidate = `${key}_${suffix++}`;
21770
+ return candidate;
21771
+ }
21772
+ function mapStrings(value, transform) {
21773
+ if (typeof value === "string") return transform(value);
21774
+ if (Array.isArray(value)) return value.map((item) => mapStrings(item, transform));
21775
+ if (value && typeof value === "object") {
21776
+ const out = /* @__PURE__ */ Object.create(null);
21777
+ for (const [key, item] of Object.entries(value)) {
21778
+ out[uniqueObjectKey(out, redactedObjectKey(key, transform))] = mapStrings(item, transform);
21779
+ }
21780
+ return out;
21781
+ }
21782
+ return value;
21783
+ }
21784
+ function scrub(value, rules = DEFAULT_RULES) {
21785
+ return mapStrings(value, (input) => applyRules(input, rules));
21786
+ }
21787
+ function debugDetail(value) {
21788
+ try {
21789
+ return String(value instanceof Error ? value.message : value);
21790
+ } catch {
21791
+ return "unprintable detail";
21792
+ }
21793
+ }
21794
+ function writeHookDebug(context, ...details) {
21795
+ if (!process.env.PRIM_HOOK_DEBUG) return;
21796
+ const raw = details.length > 0 ? `${context}: ${details.map(debugDetail).join(": ")}` : context;
21797
+ const normalized = terminalSafeLine(raw);
21798
+ const message = boundedHealthError(scrub(normalized, DEFAULT_RULES)) ?? context;
21799
+ process.stderr.write(`[prim-hook] ${message === `${context}:` ? context : message}
21800
+ `);
21801
+ }
21802
+ function redactEveryString(value, reason) {
21803
+ return mapStrings(value, () => `<REDACTED:${reason}>`);
21804
+ }
21805
+ var WORKSPACE_REDACTION_WORKER = String.raw`
21806
+ const { parentPort, workerData } = require("node:worker_threads");
21807
+ const REDACTED_OBJECT_KEY = "<REDACTED:object-key>";
21808
+ const rules = workerData.rules.map((rule) => ({
21809
+ pattern: new RegExp(rule.source, rule.flags),
21810
+ reason: rule.reason,
21811
+ }));
21812
+ function redact(input) {
21813
+ let output = input;
21814
+ for (const rule of rules) {
21815
+ output = output.replace(rule.pattern, "<REDACTED:" + rule.reason + ">");
21816
+ }
21817
+ return output;
21818
+ }
21819
+ function objectKey(input) {
21820
+ return redact(input) === input ? input : REDACTED_OBJECT_KEY;
21821
+ }
21822
+ function uniqueKey(output, key) {
21823
+ let candidate = key;
21824
+ let suffix = 2;
21825
+ while (Object.hasOwn(output, candidate)) candidate = key + "_" + suffix++;
21826
+ return candidate;
21827
+ }
21828
+ function walk(value) {
21829
+ if (typeof value === "string") {
21830
+ return redact(value);
21831
+ }
21832
+ if (Array.isArray(value)) return value.map(walk);
21833
+ if (value && typeof value === "object") {
21834
+ const output = Object.create(null);
21835
+ for (const [key, item] of Object.entries(value)) {
21836
+ output[uniqueKey(output, objectKey(key))] = walk(item);
21837
+ }
21838
+ return output;
21839
+ }
21840
+ return value;
21841
+ }
21842
+ parentPort.postMessage(walk(workerData.value));
21843
+ `;
21844
+ function applyWorkspaceRules(value, rules) {
21845
+ const serialized = rules.map(({ pattern, reason }) => ({
21846
+ source: pattern.source,
21847
+ flags: pattern.flags,
21848
+ reason
21849
+ }));
21850
+ return new Promise((resolve7) => {
21851
+ let worker;
21852
+ try {
21853
+ worker = new Worker(WORKSPACE_REDACTION_WORKER, {
21854
+ eval: true,
21855
+ workerData: { value, rules: serialized }
21856
+ });
21857
+ } catch {
21858
+ resolve7(redactEveryString(value, "workspace-rule-failed"));
21859
+ return;
21860
+ }
21861
+ let settled = false;
21862
+ const finish = (result) => {
21863
+ if (settled) return;
21864
+ settled = true;
21865
+ clearTimeout(timer);
21866
+ void worker.terminate();
21867
+ resolve7(result);
21868
+ };
21869
+ const failClosed = () => finish(redactEveryString(value, "workspace-rule-failed"));
21870
+ const timer = setTimeout(failClosed, WORKSPACE_RULE_TIMEOUT_MS);
21871
+ worker.once("message", finish);
21872
+ worker.once("error", failClosed);
21873
+ worker.once("exit", (code) => {
21874
+ if (code !== 0) failClosed();
21875
+ });
21876
+ });
21877
+ }
21878
+ async function scrubFromCwd(value, cwd) {
21879
+ const defaultScrubbed = scrub(value, DEFAULT_RULES);
21880
+ const workspaceRules = loadWorkspaceRules(cwd);
21881
+ return workspaceRules.length === 0 ? defaultScrubbed : await applyWorkspaceRules(defaultScrubbed, workspaceRules);
21882
+ }
21883
+ function scrubEnvironmentPaths(environment) {
21884
+ const scrubPath = (value) => value === void 0 ? void 0 : applyRules(value, USER_HOME_RULES);
21885
+ return {
21886
+ ...environment,
21887
+ cwd: scrubPath(environment.cwd) ?? environment.cwd,
21888
+ ...environment.repoRoot === void 0 ? {} : { repoRoot: scrubPath(environment.repoRoot) },
21889
+ ...environment.gitRoot === void 0 ? {} : { gitRoot: scrubPath(environment.gitRoot) }
21890
+ };
21891
+ }
21892
+
21293
21893
  // node_modules/.pnpm/unbash@4.0.3/node_modules/unbash/dist/chars.js
21294
21894
  var CH_TAB = 9;
21295
21895
  var CH_NL = 10;
@@ -25144,7 +25744,7 @@ var COMMAND_OPTIONS = {
25144
25744
  longOptionalValues: set("--color")
25145
25745
  },
25146
25746
  grep: {
25147
- shortFlags: "EFGHIPRTUVabcdhLlnqrsuvwxyZz",
25747
+ shortFlags: "EFGHIPRTUVabcdhiLlnoqrsuvwxyZz",
25148
25748
  shortValues: "ABCDefm",
25149
25749
  longFlags: set(
25150
25750
  "--basic-regexp --binary-files-without-match --byte-offset --count --extended-regexp --files-with-matches --files-without-match --fixed-regexp --fixed-strings --help --ignore-case --initial-tab --invert-match --line-buffered --line-number --line-regexp --null --null-data --only-matching --perl-regexp --quiet --recursive --silent --unix-byte-offsets --version --with-filename --word-regexp"
@@ -25155,12 +25755,14 @@ var COMMAND_OPTIONS = {
25155
25755
  longOptionalValues: set("--color")
25156
25756
  },
25157
25757
  head: {
25758
+ numericCount: true,
25158
25759
  shortFlags: "qvz",
25159
25760
  shortValues: "cn",
25160
25761
  longFlags: set("--help --quiet --verbose --version --zero-terminated"),
25161
25762
  longValues: set("--bytes --lines")
25162
25763
  },
25163
25764
  tail: {
25765
+ numericCount: true,
25164
25766
  shortFlags: "Fqsvz",
25165
25767
  shortValues: "cn",
25166
25768
  longFlags: set("--help --quiet --retry --silent --verbose --version --zero-terminated"),
@@ -25185,6 +25787,7 @@ var COMMAND_OPTIONS = {
25185
25787
  }
25186
25788
  };
25187
25789
  var GIT_INSPECTION_OPTIONS = {
25790
+ numericCount: true,
25188
25791
  shortFlags: "abcdfhiklmnprstuvwz",
25189
25792
  shortValues: "ABCGLMSU",
25190
25793
  longFlags: set(
@@ -25327,6 +25930,7 @@ function parseOptions(args, spec) {
25327
25930
  optionsEnded = true;
25328
25931
  continue;
25329
25932
  }
25933
+ if (spec.numericCount && /^-\d+$/.test(arg)) continue;
25330
25934
  if (arg.startsWith("--")) {
25331
25935
  const separator = arg.indexOf("=");
25332
25936
  const option = separator === -1 ? arg : arg.slice(0, separator);
@@ -25721,10 +26325,11 @@ function analyzeShellTargets(source) {
25721
26325
  // src/hooks/file-refs.ts
25722
26326
  var MAX_PREFLIGHT_FILE_TARGETS = 25;
25723
26327
  function primitiveMetadataForResolution(resolution) {
25724
- const shouldAttach = resolution.fileRefs.length > 0 || resolution.rejected.length > 0 || resolution.targetsIncomplete || resolution.targetsTruncated || resolution.shellMutation !== void 0;
26328
+ const shouldAttach = resolution.fileRefs.length > 0 || (resolution.targetCheckouts?.length ?? 0) > 0 || resolution.rejected.length > 0 || resolution.targetsIncomplete || resolution.targetsTruncated || resolution.shellMutation !== void 0;
25725
26329
  if (!shouldAttach) return;
25726
26330
  return {
25727
26331
  fileRefs: [...resolution.fileRefs],
26332
+ ...resolution.targetCheckouts ? { targetCheckouts: resolution.targetCheckouts } : {},
25728
26333
  ...resolution.rejected.length > 0 || resolution.targetsIncomplete ? { fileRefsIncomplete: true } : {},
25729
26334
  ...resolution.targetsTruncated ? { fileRefsTruncated: true } : {},
25730
26335
  ...resolution.shellMutation !== void 0 ? { shellMutation: resolution.shellMutation } : {}
@@ -25749,13 +26354,55 @@ function resolveHookFileRefs(args) {
25749
26354
  const targetsTruncated = uniqueRawPaths.length > MAX_PREFLIGHT_FILE_TARGETS;
25750
26355
  const fileRefs = /* @__PURE__ */ new Set();
25751
26356
  const rejected = [];
26357
+ const targets = /* @__PURE__ */ new Map();
25752
26358
  for (const path of uniqueRawPaths.slice(0, MAX_PREFLIGHT_FILE_TARGETS)) {
25753
26359
  const canonical = canonicalRepositoryPath(path, args.repository, args.cwd);
25754
26360
  if (canonical.ok) fileRefs.add(canonical.file);
25755
- else rejected.push({ path, reason: canonical.reason });
26361
+ else {
26362
+ const target = args.captureTargets && canonical.reason === "outside_repository" ? relatedWorktreeTarget(path, args.cwd, args.repository) : null;
26363
+ const resolved = target ? canonicalRepositoryPath(path, target, args.cwd) : null;
26364
+ if (target && resolved?.ok && isRepoActiveForCapture(target.repoRoot) && repoSyncId(target.repoRoot) === args.repository.repoSyncId && args.repository.repoSyncId && cachedCollectScopeAdmits(target.repoRoot, {
26365
+ repository: target.repoFullName,
26366
+ branch: currentBranch(target.repoRoot),
26367
+ agent: args.agent,
26368
+ paths: [resolved.file],
26369
+ pathsComplete: true
26370
+ })) {
26371
+ const group = targets.get(target.repoRoot) ?? { repository: target, fileRefs: [] };
26372
+ group.fileRefs.push(resolved.file);
26373
+ targets.set(target.repoRoot, group);
26374
+ } else rejected.push({ path, reason: canonical.reason });
26375
+ }
26376
+ }
26377
+ const targetCheckouts = [];
26378
+ if (targets.size > 0) {
26379
+ if (fileRefs.size > 0)
26380
+ targets.set(args.repository.repoRoot, {
26381
+ repository: args.repository,
26382
+ fileRefs: [...fileRefs]
26383
+ });
26384
+ for (const { repository, fileRefs: paths } of targets.values()) {
26385
+ const identity = getOrCreateWorkspaceId(repository.repoRoot);
26386
+ const binding = repoSyncId(repository.repoRoot);
26387
+ if (identity.status !== "ready" || !binding) {
26388
+ rejected.push({ path: repository.repoRoot, reason: "invalid_path" });
26389
+ continue;
26390
+ }
26391
+ const root = scrubEnvironmentPaths({
26392
+ cwd: repository.repoRoot,
26393
+ gitRoot: repository.repoRoot
26394
+ }).gitRoot;
26395
+ targetCheckouts.push({
26396
+ gitRoot: root,
26397
+ workspaceId: identity.workspaceId,
26398
+ repoSyncId: binding,
26399
+ fileRefs: paths
26400
+ });
26401
+ }
25756
26402
  }
25757
26403
  return {
25758
26404
  fileRefs: [...fileRefs],
26405
+ ...targetCheckouts.length > 0 ? { targetCheckouts } : {},
25759
26406
  rejected,
25760
26407
  targetsIncomplete: nativeTargets?.complete === false,
25761
26408
  targetsTruncated,
@@ -25769,7 +26416,8 @@ function enrichHookPayloadWithFileRefs(args) {
25769
26416
  toolInput: args.parsed.tool_input,
25770
26417
  agent: args.agent,
25771
26418
  cwd: args.cwd,
25772
- repository: args.repository
26419
+ repository: args.repository,
26420
+ captureTargets: true
25773
26421
  });
25774
26422
  const primitive = primitiveMetadataForResolution(resolution);
25775
26423
  if (!primitive) return { parsed: args.parsed, resolution };
@@ -25787,7 +26435,7 @@ function enrichHookPayloadWithFileRefs(args) {
25787
26435
  // src/hooks/hook-stdin.ts
25788
26436
  var DEFAULT_MAX_BYTES = 1024 * 1024;
25789
26437
  function readHookStdin(timeoutMs = 1e3, maxBytes = DEFAULT_MAX_BYTES) {
25790
- return new Promise((resolve6, reject) => {
26438
+ return new Promise((resolve7, reject) => {
25791
26439
  const chunks = [];
25792
26440
  let bytes = 0;
25793
26441
  let settled = false;
@@ -25799,7 +26447,7 @@ function readHookStdin(timeoutMs = 1e3, maxBytes = DEFAULT_MAX_BYTES) {
25799
26447
  process.stdin.removeAllListeners("end");
25800
26448
  process.stdin.removeAllListeners("error");
25801
26449
  if (error) reject(error);
25802
- else resolve6(Buffer.concat(chunks, bytes).toString("utf-8"));
26450
+ else resolve7(Buffer.concat(chunks, bytes).toString("utf-8"));
25803
26451
  };
25804
26452
  const timer = setTimeout(() => finish(new Error("stdin read timeout")), timeoutMs);
25805
26453
  process.stdin.on("data", (chunk) => {
@@ -25818,7 +26466,7 @@ function readHookStdin(timeoutMs = 1e3, maxBytes = DEFAULT_MAX_BYTES) {
25818
26466
  // src/hooks/normalize.ts
25819
26467
  import { createHash as createHash7 } from "crypto";
25820
26468
  import { realpathSync as realpathSync3 } from "fs";
25821
- import { isAbsolute as isAbsolute8, resolve as resolve5 } from "path";
26469
+ import { isAbsolute as isAbsolute8, resolve as resolve6 } from "path";
25822
26470
  var HERMES_EVENT_MAP = {
25823
26471
  on_session_start: "SessionStart",
25824
26472
  on_session_end: "SessionEnd",
@@ -25875,7 +26523,7 @@ function pathIdentity(path) {
25875
26523
  try {
25876
26524
  return realpathSync3.native(path);
25877
26525
  } catch {
25878
- return resolve5(path);
26526
+ return resolve6(path);
25879
26527
  }
25880
26528
  }
25881
26529
  function resolveCursorCwd(parsed) {
@@ -25900,7 +26548,7 @@ function resolveCursorCwd(parsed) {
25900
26548
  if (rawToolCwd && !isAbsolute8(rawToolCwd) && !base) {
25901
26549
  throw new TypeError("relative Cursor tool cwd has no workspace base");
25902
26550
  }
25903
- const toolCwd = rawToolCwd ? pathIdentity(isAbsolute8(rawToolCwd) ? rawToolCwd : resolve5(base, rawToolCwd)) : void 0;
26551
+ const toolCwd = rawToolCwd ? pathIdentity(isAbsolute8(rawToolCwd) ? rawToolCwd : resolve6(base, rawToolCwd)) : void 0;
25904
26552
  const selected = toolCwd ?? envelopeCwd ?? (roots.length === 1 ? roots[0] : expectedRepo);
25905
26553
  if (!selected) {
25906
26554
  throw new TypeError("Cursor hook envelope has no unambiguous workspace");
@@ -25980,254 +26628,6 @@ import { platform } from "os";
25980
26628
  // src/protocol/move.ts
25981
26629
  var AGENT_ENVELOPE_VERSION = 3;
25982
26630
 
25983
- // src/hooks/redact.ts
25984
- import { existsSync as existsSync12, readFileSync as readFileSync14, statSync as statSync5 } from "fs";
25985
- import { join as join16 } from "path";
25986
- import { Worker } from "worker_threads";
25987
- var USER_HOME_RULES = [
25988
- {
25989
- pattern: /\/Users\/[^/\\\s"'`]+/g,
25990
- reason: "user-home-path",
25991
- replacement: "/Users/__redacted_user__"
25992
- },
25993
- {
25994
- pattern: /\/home\/[^/\\\s"'`]+/g,
25995
- reason: "user-home-path",
25996
- replacement: "/home/__redacted_user__"
25997
- },
25998
- {
25999
- pattern: /([A-Za-z]:\\Users\\)[^/\\\s"'`]+/gi,
26000
- reason: "user-home-path",
26001
- replacement: "$1__redacted_user__"
26002
- },
26003
- {
26004
- pattern: /\/root(?=\/|$)/g,
26005
- reason: "user-home-path",
26006
- replacement: "/__redacted_user__"
26007
- }
26008
- ];
26009
- var DEFAULT_RULES = [
26010
- { pattern: /Bearer\s+[A-Za-z0-9._~+/=-]+/gi, reason: "bearer-token" },
26011
- {
26012
- pattern: /\bsk-(?:(?:ant|proj)-)?[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
26013
- reason: "sk-api-key"
26014
- },
26015
- {
26016
- pattern: /-----BEGIN [A-Z ]+PRIVATE KEY-----[\s\S]+?-----END [A-Z ]+PRIVATE KEY-----/g,
26017
- reason: "private-key"
26018
- },
26019
- { pattern: /xox[abprs]-[A-Za-z0-9-]{10,}/g, reason: "slack-token" },
26020
- {
26021
- pattern: /\b(?:gh[pousr]_[A-Za-z0-9]{36,}|github_pat_[A-Za-z0-9_]{50,})\b/g,
26022
- reason: "github-pat"
26023
- },
26024
- { pattern: /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/g, reason: "aws-access-key" },
26025
- {
26026
- pattern: /\bAWS_(?:SECRET_ACCESS_KEY|SESSION_TOKEN)"?\s*[:=]\s*["']?[A-Za-z0-9/+=]{20,}["']?/gi,
26027
- reason: "aws-secret"
26028
- },
26029
- { pattern: /\bAIza[0-9A-Za-z_-]{35}(?![0-9A-Za-z_-])/g, reason: "gcp-api-key" },
26030
- {
26031
- pattern: /\bya29\.[0-9A-Za-z_-]{20,}(?![0-9A-Za-z_-])/g,
26032
- reason: "gcp-oauth-token"
26033
- },
26034
- {
26035
- pattern: /\beyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*(?![A-Za-z0-9_-])/g,
26036
- reason: "jwt"
26037
- },
26038
- { pattern: /\bBasic\s+[A-Za-z0-9+/]+={0,2}/gi, reason: "basic-auth" },
26039
- { pattern: /\bhttps?:\/\/[^/\s:@]+:[^/\s@]+@/gi, reason: "basic-auth" },
26040
- ...USER_HOME_RULES
26041
- ];
26042
- var MAX_SCRUB_LEN = 256e3;
26043
- var MAX_WORKSPACE_CONFIG_BYTES = 64 * 1024;
26044
- var MAX_WORKSPACE_RULES = 32;
26045
- var MAX_WORKSPACE_PATTERN_LENGTH = 512;
26046
- var MAX_WORKSPACE_REASON_LENGTH = 64;
26047
- var WORKSPACE_RULE_TIMEOUT_MS = 250;
26048
- var WORKSPACE_FILE2 = ".prim/redaction.json";
26049
- var SAFE_REASON_RE = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u;
26050
- var SAFE_WORKSPACE_FLAGS_RE = /^[gimsu]*$/u;
26051
- function debugRedaction(message) {
26052
- writeHookDebug(`redaction: ${message}`);
26053
- }
26054
- function normalizedWorkspaceFlags(value) {
26055
- if (value !== void 0 && typeof value !== "string") return null;
26056
- const requested = value ?? "";
26057
- if (!SAFE_WORKSPACE_FLAGS_RE.test(requested)) return null;
26058
- return [...new Set(`g${requested}`)].sort().join("");
26059
- }
26060
- function loadWorkspaceRules(cwd) {
26061
- const path = join16(cwd, WORKSPACE_FILE2);
26062
- if (!existsSync12(path)) return [];
26063
- let cfg;
26064
- try {
26065
- if (statSync5(path).size > MAX_WORKSPACE_CONFIG_BYTES) {
26066
- debugRedaction(`ignoring oversized ${WORKSPACE_FILE2}`);
26067
- return [];
26068
- }
26069
- cfg = JSON.parse(readFileSync14(path, "utf-8"));
26070
- } catch {
26071
- debugRedaction(`ignoring unparseable ${WORKSPACE_FILE2}`);
26072
- return [];
26073
- }
26074
- if (!Array.isArray(cfg.rules)) return [];
26075
- const compiled = [];
26076
- for (const candidate of cfg.rules.slice(0, MAX_WORKSPACE_RULES)) {
26077
- if (!candidate || typeof candidate !== "object") continue;
26078
- const { pattern, reason } = candidate;
26079
- const flags = normalizedWorkspaceFlags(candidate.flags);
26080
- if (typeof pattern !== "string" || pattern.length === 0 || pattern.length > MAX_WORKSPACE_PATTERN_LENGTH || typeof reason !== "string" || reason.length === 0 || reason.length > MAX_WORKSPACE_REASON_LENGTH || !SAFE_REASON_RE.test(reason) || flags === null) {
26081
- debugRedaction("skipping invalid workspace rule metadata");
26082
- continue;
26083
- }
26084
- try {
26085
- compiled.push({ pattern: new RegExp(pattern, flags), reason });
26086
- } catch {
26087
- debugRedaction(`skipping invalid workspace rule ${reason}`);
26088
- }
26089
- }
26090
- return compiled;
26091
- }
26092
- function applyRules(input, rules) {
26093
- if (input.length > MAX_SCRUB_LEN) return "<REDACTED:oversized>";
26094
- let out = input;
26095
- for (const rule of rules) {
26096
- out = out.replace(rule.pattern, rule.replacement ?? `<REDACTED:${rule.reason}>`);
26097
- }
26098
- return out;
26099
- }
26100
- var REDACTED_OBJECT_KEY = "<REDACTED:object-key>";
26101
- function redactedObjectKey(input, transform) {
26102
- return transform(input) === input ? input : REDACTED_OBJECT_KEY;
26103
- }
26104
- function uniqueObjectKey(output, key) {
26105
- let candidate = key;
26106
- let suffix = 2;
26107
- while (Object.hasOwn(output, candidate)) candidate = `${key}_${suffix++}`;
26108
- return candidate;
26109
- }
26110
- function mapStrings(value, transform) {
26111
- if (typeof value === "string") return transform(value);
26112
- if (Array.isArray(value)) return value.map((item) => mapStrings(item, transform));
26113
- if (value && typeof value === "object") {
26114
- const out = /* @__PURE__ */ Object.create(null);
26115
- for (const [key, item] of Object.entries(value)) {
26116
- out[uniqueObjectKey(out, redactedObjectKey(key, transform))] = mapStrings(item, transform);
26117
- }
26118
- return out;
26119
- }
26120
- return value;
26121
- }
26122
- function scrub(value, rules = DEFAULT_RULES) {
26123
- return mapStrings(value, (input) => applyRules(input, rules));
26124
- }
26125
- function debugDetail(value) {
26126
- try {
26127
- return String(value instanceof Error ? value.message : value);
26128
- } catch {
26129
- return "unprintable detail";
26130
- }
26131
- }
26132
- function writeHookDebug(context, ...details) {
26133
- if (!process.env.PRIM_HOOK_DEBUG) return;
26134
- const raw = details.length > 0 ? `${context}: ${details.map(debugDetail).join(": ")}` : context;
26135
- const normalized = terminalSafeLine(raw);
26136
- const message = boundedHealthError(scrub(normalized, DEFAULT_RULES)) ?? context;
26137
- process.stderr.write(`[prim-hook] ${message === `${context}:` ? context : message}
26138
- `);
26139
- }
26140
- function redactEveryString(value, reason) {
26141
- return mapStrings(value, () => `<REDACTED:${reason}>`);
26142
- }
26143
- var WORKSPACE_REDACTION_WORKER = String.raw`
26144
- const { parentPort, workerData } = require("node:worker_threads");
26145
- const REDACTED_OBJECT_KEY = "<REDACTED:object-key>";
26146
- const rules = workerData.rules.map((rule) => ({
26147
- pattern: new RegExp(rule.source, rule.flags),
26148
- reason: rule.reason,
26149
- }));
26150
- function redact(input) {
26151
- let output = input;
26152
- for (const rule of rules) {
26153
- output = output.replace(rule.pattern, "<REDACTED:" + rule.reason + ">");
26154
- }
26155
- return output;
26156
- }
26157
- function objectKey(input) {
26158
- return redact(input) === input ? input : REDACTED_OBJECT_KEY;
26159
- }
26160
- function uniqueKey(output, key) {
26161
- let candidate = key;
26162
- let suffix = 2;
26163
- while (Object.hasOwn(output, candidate)) candidate = key + "_" + suffix++;
26164
- return candidate;
26165
- }
26166
- function walk(value) {
26167
- if (typeof value === "string") {
26168
- return redact(value);
26169
- }
26170
- if (Array.isArray(value)) return value.map(walk);
26171
- if (value && typeof value === "object") {
26172
- const output = Object.create(null);
26173
- for (const [key, item] of Object.entries(value)) {
26174
- output[uniqueKey(output, objectKey(key))] = walk(item);
26175
- }
26176
- return output;
26177
- }
26178
- return value;
26179
- }
26180
- parentPort.postMessage(walk(workerData.value));
26181
- `;
26182
- function applyWorkspaceRules(value, rules) {
26183
- const serialized = rules.map(({ pattern, reason }) => ({
26184
- source: pattern.source,
26185
- flags: pattern.flags,
26186
- reason
26187
- }));
26188
- return new Promise((resolve6) => {
26189
- let worker;
26190
- try {
26191
- worker = new Worker(WORKSPACE_REDACTION_WORKER, {
26192
- eval: true,
26193
- workerData: { value, rules: serialized }
26194
- });
26195
- } catch {
26196
- resolve6(redactEveryString(value, "workspace-rule-failed"));
26197
- return;
26198
- }
26199
- let settled = false;
26200
- const finish = (result) => {
26201
- if (settled) return;
26202
- settled = true;
26203
- clearTimeout(timer);
26204
- void worker.terminate();
26205
- resolve6(result);
26206
- };
26207
- const failClosed = () => finish(redactEveryString(value, "workspace-rule-failed"));
26208
- const timer = setTimeout(failClosed, WORKSPACE_RULE_TIMEOUT_MS);
26209
- worker.once("message", finish);
26210
- worker.once("error", failClosed);
26211
- worker.once("exit", (code) => {
26212
- if (code !== 0) failClosed();
26213
- });
26214
- });
26215
- }
26216
- async function scrubFromCwd(value, cwd) {
26217
- const defaultScrubbed = scrub(value, DEFAULT_RULES);
26218
- const workspaceRules = loadWorkspaceRules(cwd);
26219
- return workspaceRules.length === 0 ? defaultScrubbed : await applyWorkspaceRules(defaultScrubbed, workspaceRules);
26220
- }
26221
- function scrubEnvironmentPaths(environment) {
26222
- const scrubPath = (value) => value === void 0 ? void 0 : applyRules(value, USER_HOME_RULES);
26223
- return {
26224
- ...environment,
26225
- cwd: scrubPath(environment.cwd) ?? environment.cwd,
26226
- ...environment.repoRoot === void 0 ? {} : { repoRoot: scrubPath(environment.repoRoot) },
26227
- ...environment.gitRoot === void 0 ? {} : { gitRoot: scrubPath(environment.gitRoot) }
26228
- };
26229
- }
26230
-
26231
26631
  // src/hooks/prim-hook-core.ts
26232
26632
  var CORRELATED_TOOL_EVENTS = /* @__PURE__ */ new Set([
26233
26633
  "PostToolUse",
@@ -26341,7 +26741,7 @@ function shouldFlushAfter(eventType, agent = "claude_code") {
26341
26741
  }
26342
26742
 
26343
26743
  // src/hooks/prim-hook.ts
26344
- var here = dirname12(fileURLToPath2(import.meta.url));
26744
+ var here = dirname13(fileURLToPath2(import.meta.url));
26345
26745
  var outputAttempted = false;
26346
26746
  function emitOutput(output, acknowledge) {
26347
26747
  outputAttempted = true;
@@ -26349,14 +26749,14 @@ function emitOutput(output, acknowledge) {
26349
26749
  }
26350
26750
  function resolveCliVersion() {
26351
26751
  try {
26352
- const pkg = JSON.parse(readFileSync15(join17(here, "..", "..", "package.json"), "utf-8"));
26752
+ const pkg = JSON.parse(readFileSync16(join18(here, "..", "..", "package.json"), "utf-8"));
26353
26753
  return pkg.version ?? "unknown";
26354
26754
  } catch {
26355
26755
  return "unknown";
26356
26756
  }
26357
26757
  }
26358
26758
  function spawnBackgroundFlush() {
26359
- const entry = join17(here, "..", "index.js");
26759
+ const entry = join18(here, "..", "index.js");
26360
26760
  spawn(process.execPath, [entry, "moves", "flush"], {
26361
26761
  detached: true,
26362
26762
  stdio: "ignore",
@@ -26420,6 +26820,7 @@ async function main() {
26420
26820
  };
26421
26821
  const { orgId } = resolveOrg({ sessionId: move.sessionId, cwd });
26422
26822
  appendMove(move, orgId);
26823
+ if (move.eventType === "UserPromptSubmit") recordConversationCaptured(cwd, agent);
26423
26824
  if (shouldFlushAfter(move.eventType, agent)) {
26424
26825
  spawnBackgroundFlush();
26425
26826
  }