branchora-sdk 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -51,7 +51,7 @@ ${block.content}
51
51
  };
52
52
  }
53
53
 
54
- // node_modules/zod/v4/classic/external.js
54
+ // ../../opt/toolchain/node_modules/zod/v4/classic/external.js
55
55
  var external_exports = {};
56
56
  __export(external_exports, {
57
57
  $brand: () => $brand,
@@ -314,7 +314,7 @@ __export(external_exports, {
314
314
  xor: () => xor
315
315
  });
316
316
 
317
- // node_modules/zod/v4/core/index.js
317
+ // ../../opt/toolchain/node_modules/zod/v4/core/index.js
318
318
  var core_exports2 = {};
319
319
  __export(core_exports2, {
320
320
  $ZodAny: () => $ZodAny,
@@ -631,7 +631,7 @@ __export(core_exports2, {
631
631
  withParser: () => withParser
632
632
  });
633
633
 
634
- // node_modules/zod/v4/core/util.js
634
+ // ../../opt/toolchain/node_modules/zod/v4/core/util.js
635
635
  var util_exports = {};
636
636
  __export(util_exports, {
637
637
  BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
@@ -1487,7 +1487,7 @@ function constantCatch(value) {
1487
1487
  return fn;
1488
1488
  }
1489
1489
 
1490
- // node_modules/zod/v4/core/core.js
1490
+ // ../../opt/toolchain/node_modules/zod/v4/core/core.js
1491
1491
  var _a;
1492
1492
  var NEVER = /* @__PURE__ */ Object.freeze({
1493
1493
  status: "aborted"
@@ -1609,7 +1609,7 @@ function config(newConfig) {
1609
1609
  return globalConfig;
1610
1610
  }
1611
1611
 
1612
- // node_modules/zod/v4/core/errors.js
1612
+ // ../../opt/toolchain/node_modules/zod/v4/core/errors.js
1613
1613
  function _getMessage() {
1614
1614
  const internals = this._zod;
1615
1615
  internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
@@ -1801,7 +1801,7 @@ function prettifyError(error62) {
1801
1801
  return lines.join("\n");
1802
1802
  }
1803
1803
 
1804
- // node_modules/zod/v4/core/parse.js
1804
+ // ../../opt/toolchain/node_modules/zod/v4/core/parse.js
1805
1805
  function finalizeParams(callee, params) {
1806
1806
  return { callee: params?.callee ?? callee, Err: params?.Err };
1807
1807
  }
@@ -1961,7 +1961,7 @@ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
1961
1961
  };
1962
1962
  var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
1963
1963
 
1964
- // node_modules/zod/v4/core/regexes.js
1964
+ // ../../opt/toolchain/node_modules/zod/v4/core/regexes.js
1965
1965
  var regexes_exports = {};
1966
1966
  __export(regexes_exports, {
1967
1967
  anyString: () => anyString,
@@ -2133,7 +2133,7 @@ var sha512_hex = /^[0-9a-fA-F]{128}$/;
2133
2133
  var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "==");
2134
2134
  var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
2135
2135
 
2136
- // node_modules/zod/v4/core/checks.js
2136
+ // ../../opt/toolchain/node_modules/zod/v4/core/checks.js
2137
2137
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
2138
2138
  var _a3;
2139
2139
  inst._zod ?? (inst._zod = {});
@@ -2609,7 +2609,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
2609
2609
  };
2610
2610
  });
2611
2611
 
2612
- // node_modules/zod/v4/core/doc.js
2612
+ // ../../opt/toolchain/node_modules/zod/v4/core/doc.js
2613
2613
  var Doc = class {
2614
2614
  constructor(args = [], closed = {}) {
2615
2615
  this.content = [];
@@ -2650,14 +2650,14 @@ ${content.join("\n")}
2650
2650
  }
2651
2651
  };
2652
2652
 
2653
- // node_modules/zod/v4/core/versions.js
2653
+ // ../../opt/toolchain/node_modules/zod/v4/core/versions.js
2654
2654
  var version = {
2655
2655
  major: 4,
2656
2656
  minor: 6,
2657
2657
  patch: 7
2658
2658
  };
2659
2659
 
2660
- // node_modules/zod/v4/core/schemas.js
2660
+ // ../../opt/toolchain/node_modules/zod/v4/core/schemas.js
2661
2661
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
2662
2662
  var _a3;
2663
2663
  inst ?? (inst = {});
@@ -5099,7 +5099,7 @@ function handleRefineResult(result, payload, input2, inst) {
5099
5099
  }
5100
5100
  }
5101
5101
 
5102
- // node_modules/zod/v4/core/memoizer.js
5102
+ // ../../opt/toolchain/node_modules/zod/v4/core/memoizer.js
5103
5103
  var $ZodCyclicError = class extends Error {
5104
5104
  constructor() {
5105
5105
  super(`Cannot parse a reference cycle that closes through a transform`);
@@ -5376,7 +5376,7 @@ function isBackEdge(ctx, value) {
5376
5376
  return backEdges !== void 0 && isRef(value) && backEdges.has(value);
5377
5377
  }
5378
5378
 
5379
- // node_modules/zod/v4/locales/index.js
5379
+ // ../../opt/toolchain/node_modules/zod/v4/locales/index.js
5380
5380
  var locales_exports = {};
5381
5381
  __export(locales_exports, {
5382
5382
  ar: () => ar_default,
@@ -5444,7 +5444,7 @@ __export(locales_exports, {
5444
5444
  zhTW: () => zh_TW_default
5445
5445
  });
5446
5446
 
5447
- // node_modules/zod/v4/locales/ar.js
5447
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ar.js
5448
5448
  var error = () => {
5449
5449
  const Sizable = {
5450
5450
  string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
@@ -5556,7 +5556,7 @@ function ar_default() {
5556
5556
  };
5557
5557
  }
5558
5558
 
5559
- // node_modules/zod/v4/locales/az.js
5559
+ // ../../opt/toolchain/node_modules/zod/v4/locales/az.js
5560
5560
  var error2 = () => {
5561
5561
  const Sizable = {
5562
5562
  string: { unit: "simvol", verb: "olmal\u0131d\u0131r" },
@@ -5667,7 +5667,7 @@ function az_default() {
5667
5667
  };
5668
5668
  }
5669
5669
 
5670
- // node_modules/zod/v4/locales/be.js
5670
+ // ../../opt/toolchain/node_modules/zod/v4/locales/be.js
5671
5671
  function getBelarusianPlural(count3, one, few, many) {
5672
5672
  const absCount = Math.abs(count3);
5673
5673
  const lastDigit = absCount % 10;
@@ -5836,7 +5836,7 @@ function be_default() {
5836
5836
  };
5837
5837
  }
5838
5838
 
5839
- // node_modules/zod/v4/locales/bg.js
5839
+ // ../../opt/toolchain/node_modules/zod/v4/locales/bg.js
5840
5840
  var error4 = () => {
5841
5841
  const Sizable = {
5842
5842
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" },
@@ -5962,7 +5962,7 @@ function bg_default() {
5962
5962
  };
5963
5963
  }
5964
5964
 
5965
- // node_modules/zod/v4/locales/bn.js
5965
+ // ../../opt/toolchain/node_modules/zod/v4/locales/bn.js
5966
5966
  var error5 = () => {
5967
5967
  const Sizable = {
5968
5968
  string: { unit: "\u0985\u0995\u09CD\u09B7\u09B0", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" },
@@ -6076,7 +6076,7 @@ function bn_default() {
6076
6076
  };
6077
6077
  }
6078
6078
 
6079
- // node_modules/zod/v4/locales/ca.js
6079
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ca.js
6080
6080
  var error6 = () => {
6081
6081
  const Sizable = {
6082
6082
  string: { unit: "car\xE0cters", verb: "contenir" },
@@ -6190,7 +6190,7 @@ function ca_default() {
6190
6190
  };
6191
6191
  }
6192
6192
 
6193
- // node_modules/zod/v4/locales/ckb.js
6193
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ckb.js
6194
6194
  var error7 = () => {
6195
6195
  const Sizable = {
6196
6196
  string: { unit: "\u067E\u06CC\u062A", verb: "\u0628\u06CE\u062A" },
@@ -6323,7 +6323,7 @@ function ckb_default() {
6323
6323
  };
6324
6324
  }
6325
6325
 
6326
- // node_modules/zod/v4/locales/cs.js
6326
+ // ../../opt/toolchain/node_modules/zod/v4/locales/cs.js
6327
6327
  var error8 = () => {
6328
6328
  const Sizable = {
6329
6329
  string: { unit: "znak\u016F", verb: "m\xEDt" },
@@ -6440,7 +6440,7 @@ function cs_default() {
6440
6440
  };
6441
6441
  }
6442
6442
 
6443
- // node_modules/zod/v4/locales/da.js
6443
+ // ../../opt/toolchain/node_modules/zod/v4/locales/da.js
6444
6444
  var error9 = () => {
6445
6445
  const Sizable = {
6446
6446
  string: { unit: "tegn", verb: "havde" },
@@ -6561,7 +6561,7 @@ function da_default() {
6561
6561
  };
6562
6562
  }
6563
6563
 
6564
- // node_modules/zod/v4/locales/de.js
6564
+ // ../../opt/toolchain/node_modules/zod/v4/locales/de.js
6565
6565
  var error10 = () => {
6566
6566
  const Sizable = {
6567
6567
  string: { unit: "Zeichen", verb: "zu haben" },
@@ -6675,7 +6675,7 @@ function de_default() {
6675
6675
  };
6676
6676
  }
6677
6677
 
6678
- // node_modules/zod/v4/locales/el.js
6678
+ // ../../opt/toolchain/node_modules/zod/v4/locales/el.js
6679
6679
  var error11 = () => {
6680
6680
  const Sizable = {
6681
6681
  string: { unit: "\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" },
@@ -6788,7 +6788,7 @@ function el_default() {
6788
6788
  };
6789
6789
  }
6790
6790
 
6791
- // node_modules/zod/v4/locales/en.js
6791
+ // ../../opt/toolchain/node_modules/zod/v4/locales/en.js
6792
6792
  var error12 = () => {
6793
6793
  const Sizable = {
6794
6794
  string: { unit: "characters", verb: "to have" },
@@ -6913,7 +6913,7 @@ function en_default() {
6913
6913
  };
6914
6914
  }
6915
6915
 
6916
- // node_modules/zod/v4/locales/eo.js
6916
+ // ../../opt/toolchain/node_modules/zod/v4/locales/eo.js
6917
6917
  var error13 = () => {
6918
6918
  const Sizable = {
6919
6919
  string: { unit: "karaktrojn", verb: "havi" },
@@ -7028,7 +7028,7 @@ function eo_default() {
7028
7028
  };
7029
7029
  }
7030
7030
 
7031
- // node_modules/zod/v4/locales/es.js
7031
+ // ../../opt/toolchain/node_modules/zod/v4/locales/es.js
7032
7032
  var error14 = () => {
7033
7033
  const Sizable = {
7034
7034
  string: { unit: "caracteres", verb: "tener" },
@@ -7165,7 +7165,7 @@ function es_default() {
7165
7165
  };
7166
7166
  }
7167
7167
 
7168
- // node_modules/zod/v4/locales/fa.js
7168
+ // ../../opt/toolchain/node_modules/zod/v4/locales/fa.js
7169
7169
  var error15 = () => {
7170
7170
  const Sizable = {
7171
7171
  string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
@@ -7285,7 +7285,7 @@ function fa_default() {
7285
7285
  };
7286
7286
  }
7287
7287
 
7288
- // node_modules/zod/v4/locales/fi.js
7288
+ // ../../opt/toolchain/node_modules/zod/v4/locales/fi.js
7289
7289
  var error16 = () => {
7290
7290
  const Sizable = {
7291
7291
  string: { unit: "merkki\xE4", subject: "merkkijonon" },
@@ -7403,7 +7403,7 @@ function fi_default() {
7403
7403
  };
7404
7404
  }
7405
7405
 
7406
- // node_modules/zod/v4/locales/fr.js
7406
+ // ../../opt/toolchain/node_modules/zod/v4/locales/fr.js
7407
7407
  var error17 = () => {
7408
7408
  const Sizable = {
7409
7409
  string: { unit: "caract\xE8res", verb: "avoir" },
@@ -7533,7 +7533,7 @@ function fr_default() {
7533
7533
  };
7534
7534
  }
7535
7535
 
7536
- // node_modules/zod/v4/locales/fr-CA.js
7536
+ // ../../opt/toolchain/node_modules/zod/v4/locales/fr-CA.js
7537
7537
  var error18 = () => {
7538
7538
  const Sizable = {
7539
7539
  string: { unit: "caract\xE8res", verb: "avoir" },
@@ -7646,7 +7646,7 @@ function fr_CA_default() {
7646
7646
  };
7647
7647
  }
7648
7648
 
7649
- // node_modules/zod/v4/locales/gu.js
7649
+ // ../../opt/toolchain/node_modules/zod/v4/locales/gu.js
7650
7650
  var error19 = () => {
7651
7651
  const Sizable = {
7652
7652
  string: { unit: "\u0A85\u0A95\u0ACD\u0AB7\u0AB0", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" },
@@ -7760,7 +7760,7 @@ function gu_default() {
7760
7760
  };
7761
7761
  }
7762
7762
 
7763
- // node_modules/zod/v4/locales/he.js
7763
+ // ../../opt/toolchain/node_modules/zod/v4/locales/he.js
7764
7764
  var error20 = () => {
7765
7765
  const TypeNames = {
7766
7766
  string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA", gender: "f" },
@@ -7962,7 +7962,7 @@ function he_default() {
7962
7962
  };
7963
7963
  }
7964
7964
 
7965
- // node_modules/zod/v4/locales/hi.js
7965
+ // ../../opt/toolchain/node_modules/zod/v4/locales/hi.js
7966
7966
  var error21 = () => {
7967
7967
  const Sizable = {
7968
7968
  string: { unit: "\u0905\u0915\u094D\u0937\u0930", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" },
@@ -8074,7 +8074,7 @@ function hi_default() {
8074
8074
  };
8075
8075
  }
8076
8076
 
8077
- // node_modules/zod/v4/locales/hr.js
8077
+ // ../../opt/toolchain/node_modules/zod/v4/locales/hr.js
8078
8078
  var error22 = () => {
8079
8079
  const Sizable = {
8080
8080
  string: { unit: "znakova", verb: "imati" },
@@ -8201,7 +8201,7 @@ function hr_default() {
8201
8201
  };
8202
8202
  }
8203
8203
 
8204
- // node_modules/zod/v4/locales/hu.js
8204
+ // ../../opt/toolchain/node_modules/zod/v4/locales/hu.js
8205
8205
  var error23 = () => {
8206
8206
  const Sizable = {
8207
8207
  string: { unit: "karakter", verb: "legyen" },
@@ -8315,7 +8315,7 @@ function hu_default() {
8315
8315
  };
8316
8316
  }
8317
8317
 
8318
- // node_modules/zod/v4/locales/hy.js
8318
+ // ../../opt/toolchain/node_modules/zod/v4/locales/hy.js
8319
8319
  function getArmenianPlural(count3, one, many) {
8320
8320
  return Math.abs(count3) === 1 ? one : many;
8321
8321
  }
@@ -8474,7 +8474,7 @@ function hy_default() {
8474
8474
  };
8475
8475
  }
8476
8476
 
8477
- // node_modules/zod/v4/locales/id.js
8477
+ // ../../opt/toolchain/node_modules/zod/v4/locales/id.js
8478
8478
  var error25 = () => {
8479
8479
  const Sizable = {
8480
8480
  string: { unit: "karakter", verb: "memiliki" },
@@ -8586,7 +8586,7 @@ function id_default() {
8586
8586
  };
8587
8587
  }
8588
8588
 
8589
- // node_modules/zod/v4/locales/is.js
8589
+ // ../../opt/toolchain/node_modules/zod/v4/locales/is.js
8590
8590
  var error26 = () => {
8591
8591
  const Sizable = {
8592
8592
  string: { unit: "stafi", verb: "a\xF0 hafa" },
@@ -8701,7 +8701,7 @@ function is_default() {
8701
8701
  };
8702
8702
  }
8703
8703
 
8704
- // node_modules/zod/v4/locales/it.js
8704
+ // ../../opt/toolchain/node_modules/zod/v4/locales/it.js
8705
8705
  var error27 = () => {
8706
8706
  const Sizable = {
8707
8707
  string: { unit: "caratteri", verb: "avere" },
@@ -8815,7 +8815,7 @@ function it_default() {
8815
8815
  };
8816
8816
  }
8817
8817
 
8818
- // node_modules/zod/v4/locales/ja.js
8818
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ja.js
8819
8819
  var error28 = () => {
8820
8820
  const Sizable = {
8821
8821
  string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" },
@@ -8928,7 +8928,7 @@ function ja_default() {
8928
8928
  };
8929
8929
  }
8930
8930
 
8931
- // node_modules/zod/v4/locales/ka.js
8931
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ka.js
8932
8932
  var error29 = () => {
8933
8933
  const Sizable = {
8934
8934
  string: { unit: "\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
@@ -9046,7 +9046,7 @@ function ka_default() {
9046
9046
  };
9047
9047
  }
9048
9048
 
9049
- // node_modules/zod/v4/locales/km.js
9049
+ // ../../opt/toolchain/node_modules/zod/v4/locales/km.js
9050
9050
  var error30 = () => {
9051
9051
  const Sizable = {
9052
9052
  string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
@@ -9162,12 +9162,12 @@ function km_default() {
9162
9162
  };
9163
9163
  }
9164
9164
 
9165
- // node_modules/zod/v4/locales/kh.js
9165
+ // ../../opt/toolchain/node_modules/zod/v4/locales/kh.js
9166
9166
  function kh_default() {
9167
9167
  return km_default();
9168
9168
  }
9169
9169
 
9170
- // node_modules/zod/v4/locales/kn.js
9170
+ // ../../opt/toolchain/node_modules/zod/v4/locales/kn.js
9171
9171
  var error31 = () => {
9172
9172
  const Sizable = {
9173
9173
  string: { unit: "\u0C85\u0C95\u0CCD\u0CB7\u0CB0\u0C97\u0CB3\u0CC1", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" },
@@ -9283,7 +9283,7 @@ function kn_default() {
9283
9283
  };
9284
9284
  }
9285
9285
 
9286
- // node_modules/zod/v4/locales/ko.js
9286
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ko.js
9287
9287
  var error32 = () => {
9288
9288
  const Sizable = {
9289
9289
  string: { unit: "\uBB38\uC790", verb: "to have" },
@@ -9400,7 +9400,7 @@ function ko_default() {
9400
9400
  };
9401
9401
  }
9402
9402
 
9403
- // node_modules/zod/v4/locales/lt.js
9403
+ // ../../opt/toolchain/node_modules/zod/v4/locales/lt.js
9404
9404
  var capitalizeFirstCharacter = (text) => {
9405
9405
  return text.charAt(0).toUpperCase() + text.slice(1);
9406
9406
  };
@@ -9608,7 +9608,7 @@ function lt_default() {
9608
9608
  };
9609
9609
  }
9610
9610
 
9611
- // node_modules/zod/v4/locales/mk.js
9611
+ // ../../opt/toolchain/node_modules/zod/v4/locales/mk.js
9612
9612
  var error34 = () => {
9613
9613
  const Sizable = {
9614
9614
  string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
@@ -9723,7 +9723,7 @@ function mk_default() {
9723
9723
  };
9724
9724
  }
9725
9725
 
9726
- // node_modules/zod/v4/locales/ms.js
9726
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ms.js
9727
9727
  var error35 = () => {
9728
9728
  const Sizable = {
9729
9729
  string: { unit: "aksara", verb: "mempunyai" },
@@ -9836,7 +9836,7 @@ function ms_default() {
9836
9836
  };
9837
9837
  }
9838
9838
 
9839
- // node_modules/zod/v4/locales/ne.js
9839
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ne.js
9840
9840
  var error36 = () => {
9841
9841
  const Sizable = {
9842
9842
  string: { unit: "\u0905\u0915\u094D\u0937\u0930", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" },
@@ -9948,7 +9948,7 @@ function ne_default() {
9948
9948
  };
9949
9949
  }
9950
9950
 
9951
- // node_modules/zod/v4/locales/nl.js
9951
+ // ../../opt/toolchain/node_modules/zod/v4/locales/nl.js
9952
9952
  var error37 = () => {
9953
9953
  const Sizable = {
9954
9954
  string: { unit: "tekens", verb: "heeft" },
@@ -10064,7 +10064,7 @@ function nl_default() {
10064
10064
  };
10065
10065
  }
10066
10066
 
10067
- // node_modules/zod/v4/locales/nn.js
10067
+ // ../../opt/toolchain/node_modules/zod/v4/locales/nn.js
10068
10068
  var error38 = () => {
10069
10069
  const Sizable = {
10070
10070
  string: { unit: "teikn", verb: "\xE5 ha" },
@@ -10178,7 +10178,7 @@ function nn_default() {
10178
10178
  };
10179
10179
  }
10180
10180
 
10181
- // node_modules/zod/v4/locales/no.js
10181
+ // ../../opt/toolchain/node_modules/zod/v4/locales/no.js
10182
10182
  var error39 = () => {
10183
10183
  const Sizable = {
10184
10184
  string: { unit: "tegn", verb: "\xE5 ha" },
@@ -10292,7 +10292,7 @@ function no_default() {
10292
10292
  };
10293
10293
  }
10294
10294
 
10295
- // node_modules/zod/v4/locales/ota.js
10295
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ota.js
10296
10296
  var error40 = () => {
10297
10297
  const Sizable = {
10298
10298
  string: { unit: "harf", verb: "olmal\u0131d\u0131r" },
@@ -10407,7 +10407,7 @@ function ota_default() {
10407
10407
  };
10408
10408
  }
10409
10409
 
10410
- // node_modules/zod/v4/locales/ps.js
10410
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ps.js
10411
10411
  var error41 = () => {
10412
10412
  const Sizable = {
10413
10413
  string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
@@ -10527,7 +10527,7 @@ function ps_default() {
10527
10527
  };
10528
10528
  }
10529
10529
 
10530
- // node_modules/zod/v4/locales/pl.js
10530
+ // ../../opt/toolchain/node_modules/zod/v4/locales/pl.js
10531
10531
  var error42 = () => {
10532
10532
  const Sizable = {
10533
10533
  string: { unit: "znak\xF3w", verb: "mie\u0107" },
@@ -10642,7 +10642,7 @@ function pl_default() {
10642
10642
  };
10643
10643
  }
10644
10644
 
10645
- // node_modules/zod/v4/locales/pt.js
10645
+ // ../../opt/toolchain/node_modules/zod/v4/locales/pt.js
10646
10646
  var error43 = () => {
10647
10647
  const Sizable = {
10648
10648
  string: { unit: "caracteres" },
@@ -10786,7 +10786,7 @@ function pt_default() {
10786
10786
  };
10787
10787
  }
10788
10788
 
10789
- // node_modules/zod/v4/locales/pt-BR.js
10789
+ // ../../opt/toolchain/node_modules/zod/v4/locales/pt-BR.js
10790
10790
  var error44 = () => {
10791
10791
  const Sizable = {
10792
10792
  string: { unit: "caracteres" },
@@ -10931,7 +10931,7 @@ function pt_BR_default() {
10931
10931
  };
10932
10932
  }
10933
10933
 
10934
- // node_modules/zod/v4/locales/ro.js
10934
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ro.js
10935
10935
  var error45 = () => {
10936
10936
  const Sizable = {
10937
10937
  string: { unit: "caractere", verb: "s\u0103 aib\u0103" },
@@ -11054,7 +11054,7 @@ function ro_default() {
11054
11054
  };
11055
11055
  }
11056
11056
 
11057
- // node_modules/zod/v4/locales/ru.js
11057
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ru.js
11058
11058
  function getRussianPlural(count3, one, few, many) {
11059
11059
  const absCount = Math.abs(count3);
11060
11060
  const lastDigit = absCount % 10;
@@ -11223,7 +11223,7 @@ function ru_default() {
11223
11223
  };
11224
11224
  }
11225
11225
 
11226
- // node_modules/zod/v4/locales/sk.js
11226
+ // ../../opt/toolchain/node_modules/zod/v4/locales/sk.js
11227
11227
  var error47 = () => {
11228
11228
  const Sizable = {
11229
11229
  string: { unit: "znakov", verb: "ma\u0165" },
@@ -11340,7 +11340,7 @@ function sk_default() {
11340
11340
  };
11341
11341
  }
11342
11342
 
11343
- // node_modules/zod/v4/locales/sl.js
11343
+ // ../../opt/toolchain/node_modules/zod/v4/locales/sl.js
11344
11344
  var error48 = () => {
11345
11345
  const Sizable = {
11346
11346
  string: { unit: "znakov", verb: "imeti" },
@@ -11455,7 +11455,7 @@ function sl_default() {
11455
11455
  };
11456
11456
  }
11457
11457
 
11458
- // node_modules/zod/v4/locales/sv.js
11458
+ // ../../opt/toolchain/node_modules/zod/v4/locales/sv.js
11459
11459
  var error49 = () => {
11460
11460
  const Sizable = {
11461
11461
  string: { unit: "tecken", verb: "att ha" },
@@ -11571,7 +11571,7 @@ function sv_default() {
11571
11571
  };
11572
11572
  }
11573
11573
 
11574
- // node_modules/zod/v4/locales/ta.js
11574
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ta.js
11575
11575
  var error50 = () => {
11576
11576
  const Sizable = {
11577
11577
  string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
@@ -11687,7 +11687,7 @@ function ta_default() {
11687
11687
  };
11688
11688
  }
11689
11689
 
11690
- // node_modules/zod/v4/locales/tg.js
11690
+ // ../../opt/toolchain/node_modules/zod/v4/locales/tg.js
11691
11691
  var error51 = () => {
11692
11692
  const Sizable = {
11693
11693
  string: { unit: "\u0430\u043B\u043E\u043C\u0430\u0442", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" },
@@ -11804,7 +11804,7 @@ function tg_default() {
11804
11804
  };
11805
11805
  }
11806
11806
 
11807
- // node_modules/zod/v4/locales/th.js
11807
+ // ../../opt/toolchain/node_modules/zod/v4/locales/th.js
11808
11808
  var error52 = () => {
11809
11809
  const Sizable = {
11810
11810
  string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
@@ -11920,7 +11920,7 @@ function th_default() {
11920
11920
  };
11921
11921
  }
11922
11922
 
11923
- // node_modules/zod/v4/locales/tk.js
11923
+ // ../../opt/toolchain/node_modules/zod/v4/locales/tk.js
11924
11924
  var error53 = () => {
11925
11925
  const Sizable = {
11926
11926
  string: { unit: "simwol", verb: "bolmaly" },
@@ -12028,7 +12028,7 @@ function tk_default() {
12028
12028
  };
12029
12029
  }
12030
12030
 
12031
- // node_modules/zod/v4/locales/tr.js
12031
+ // ../../opt/toolchain/node_modules/zod/v4/locales/tr.js
12032
12032
  var error54 = () => {
12033
12033
  const Sizable = {
12034
12034
  string: { unit: "karakter", verb: "olmal\u0131" },
@@ -12139,7 +12139,7 @@ function tr_default() {
12139
12139
  };
12140
12140
  }
12141
12141
 
12142
- // node_modules/zod/v4/locales/uk.js
12142
+ // ../../opt/toolchain/node_modules/zod/v4/locales/uk.js
12143
12143
  var error55 = () => {
12144
12144
  const Sizable = {
12145
12145
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
@@ -12253,12 +12253,12 @@ function uk_default() {
12253
12253
  };
12254
12254
  }
12255
12255
 
12256
- // node_modules/zod/v4/locales/ua.js
12256
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ua.js
12257
12257
  function ua_default() {
12258
12258
  return uk_default();
12259
12259
  }
12260
12260
 
12261
- // node_modules/zod/v4/locales/ur.js
12261
+ // ../../opt/toolchain/node_modules/zod/v4/locales/ur.js
12262
12262
  var error56 = () => {
12263
12263
  const Sizable = {
12264
12264
  string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
@@ -12374,7 +12374,7 @@ function ur_default() {
12374
12374
  };
12375
12375
  }
12376
12376
 
12377
- // node_modules/zod/v4/locales/uz.js
12377
+ // ../../opt/toolchain/node_modules/zod/v4/locales/uz.js
12378
12378
  var error57 = () => {
12379
12379
  const Sizable = {
12380
12380
  string: { unit: "belgi", verb: "bo\u2018lishi kerak" },
@@ -12488,7 +12488,7 @@ function uz_default() {
12488
12488
  };
12489
12489
  }
12490
12490
 
12491
- // node_modules/zod/v4/locales/vi.js
12491
+ // ../../opt/toolchain/node_modules/zod/v4/locales/vi.js
12492
12492
  var error58 = () => {
12493
12493
  const Sizable = {
12494
12494
  string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
@@ -12602,7 +12602,7 @@ function vi_default() {
12602
12602
  };
12603
12603
  }
12604
12604
 
12605
- // node_modules/zod/v4/locales/zh-CN.js
12605
+ // ../../opt/toolchain/node_modules/zod/v4/locales/zh-CN.js
12606
12606
  var error59 = () => {
12607
12607
  const Sizable = {
12608
12608
  string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
@@ -12717,7 +12717,7 @@ function zh_CN_default() {
12717
12717
  };
12718
12718
  }
12719
12719
 
12720
- // node_modules/zod/v4/locales/zh-TW.js
12720
+ // ../../opt/toolchain/node_modules/zod/v4/locales/zh-TW.js
12721
12721
  var error60 = () => {
12722
12722
  const Sizable = {
12723
12723
  string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
@@ -12830,7 +12830,7 @@ function zh_TW_default() {
12830
12830
  };
12831
12831
  }
12832
12832
 
12833
- // node_modules/zod/v4/locales/yo.js
12833
+ // ../../opt/toolchain/node_modules/zod/v4/locales/yo.js
12834
12834
  var error61 = () => {
12835
12835
  const Sizable = {
12836
12836
  string: { unit: "\xE0mi", verb: "n\xED" },
@@ -12943,7 +12943,7 @@ function yo_default() {
12943
12943
  };
12944
12944
  }
12945
12945
 
12946
- // node_modules/zod/v4/core/registries.js
12946
+ // ../../opt/toolchain/node_modules/zod/v4/core/registries.js
12947
12947
  var _a2;
12948
12948
  var $output = /* @__PURE__ */ Symbol("ZodOutput");
12949
12949
  var $input = /* @__PURE__ */ Symbol("ZodInput");
@@ -12993,7 +12993,7 @@ function registry() {
12993
12993
  (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
12994
12994
  var globalRegistry = globalThis.__zod_globalRegistry;
12995
12995
 
12996
- // node_modules/zod/v4/core/compile.js
12996
+ // ../../opt/toolchain/node_modules/zod/v4/core/compile.js
12997
12997
  var INVALID = Symbol.for("zod.compile.invalid");
12998
12998
  var FALLBACK_FLAG = Symbol.for("zod.compile.fallback");
12999
12999
  var ZodCompileAsyncError = class extends Error {
@@ -14603,7 +14603,7 @@ function generateTransformCheck(doc, ctx, schema, accessor) {
14603
14603
  return accessor;
14604
14604
  }
14605
14605
 
14606
- // node_modules/zod/v4/core/api.js
14606
+ // ../../opt/toolchain/node_modules/zod/v4/core/api.js
14607
14607
  function snapshotChecks(def) {
14608
14608
  if (def.checks)
14609
14609
  def.checks = [...def.checks];
@@ -15662,7 +15662,7 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
15662
15662
  return inst;
15663
15663
  }
15664
15664
 
15665
- // node_modules/zod/v4/core/to-json-schema.js
15665
+ // ../../opt/toolchain/node_modules/zod/v4/core/to-json-schema.js
15666
15666
  function assignProps(target, ...sources) {
15667
15667
  for (const source of sources) {
15668
15668
  for (const key of Reflect.ownKeys(source)) {
@@ -16192,7 +16192,7 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
16192
16192
  return finalize(ctx, schema);
16193
16193
  };
16194
16194
 
16195
- // node_modules/zod/v4/core/json-schema-processors.js
16195
+ // ../../opt/toolchain/node_modules/zod/v4/core/json-schema-processors.js
16196
16196
  var narrowMin = (agg, key, value) => {
16197
16197
  if (agg[key] === void 0 || value > agg[key])
16198
16198
  agg[key] = value;
@@ -16940,7 +16940,7 @@ function toJSONSchema(input2, params) {
16940
16940
  return finalize(ctx, input2);
16941
16941
  }
16942
16942
 
16943
- // node_modules/zod/v4/core/json-schema-generator.js
16943
+ // ../../opt/toolchain/node_modules/zod/v4/core/json-schema-generator.js
16944
16944
  var JSONSchemaGenerator = class {
16945
16945
  /** @deprecated Access via ctx instead */
16946
16946
  get metadataRegistry() {
@@ -17018,10 +17018,10 @@ var JSONSchemaGenerator = class {
17018
17018
  }
17019
17019
  };
17020
17020
 
17021
- // node_modules/zod/v4/core/json-schema.js
17021
+ // ../../opt/toolchain/node_modules/zod/v4/core/json-schema.js
17022
17022
  var json_schema_exports = {};
17023
17023
 
17024
- // node_modules/zod/v4/classic/schemas.js
17024
+ // ../../opt/toolchain/node_modules/zod/v4/classic/schemas.js
17025
17025
  var schemas_exports2 = {};
17026
17026
  __export(schemas_exports2, {
17027
17027
  ZodAny: () => ZodAny,
@@ -17202,7 +17202,7 @@ __export(schemas_exports2, {
17202
17202
  xor: () => xor
17203
17203
  });
17204
17204
 
17205
- // node_modules/zod/v4/classic/checks.js
17205
+ // ../../opt/toolchain/node_modules/zod/v4/classic/checks.js
17206
17206
  var checks_exports2 = {};
17207
17207
  __export(checks_exports2, {
17208
17208
  endsWith: () => _endsWith,
@@ -17237,7 +17237,7 @@ __export(checks_exports2, {
17237
17237
  uppercase: () => _uppercase
17238
17238
  });
17239
17239
 
17240
- // node_modules/zod/v4/classic/errors.js
17240
+ // ../../opt/toolchain/node_modules/zod/v4/classic/errors.js
17241
17241
  var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
17242
17242
  function _lazyMethod(proto, key, make) {
17243
17243
  Object.defineProperty(proto, key, {
@@ -17283,7 +17283,7 @@ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, void 0
17283
17283
  Parent: Error
17284
17284
  });
17285
17285
 
17286
- // node_modules/zod/v4/classic/parse.js
17286
+ // ../../opt/toolchain/node_modules/zod/v4/classic/parse.js
17287
17287
  var parse2 = /* @__PURE__ */ _parse(ZodRealError);
17288
17288
  var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
17289
17289
  var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -17297,7 +17297,7 @@ var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
17297
17297
  var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
17298
17298
  var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
17299
17299
 
17300
- // node_modules/zod/v4/classic/schemas.js
17300
+ // ../../opt/toolchain/node_modules/zod/v4/classic/schemas.js
17301
17301
  function _ensureDefaultLocale() {
17302
17302
  if (!globalConfig.localeError)
17303
17303
  config(en_default());
@@ -18762,7 +18762,7 @@ function preprocess(fn, schema) {
18762
18762
  });
18763
18763
  }
18764
18764
 
18765
- // node_modules/zod/v4/classic/compat.js
18765
+ // ../../opt/toolchain/node_modules/zod/v4/classic/compat.js
18766
18766
  var ZodIssueCode = {
18767
18767
  invalid_type: "invalid_type",
18768
18768
  too_big: "too_big",
@@ -18788,7 +18788,7 @@ var ZodFirstPartyTypeKind;
18788
18788
  /* @__PURE__ */ (function(ZodFirstPartyTypeKind2) {
18789
18789
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
18790
18790
 
18791
- // node_modules/zod/v4/classic/iso.js
18791
+ // ../../opt/toolchain/node_modules/zod/v4/classic/iso.js
18792
18792
  var iso_exports = {};
18793
18793
  __export(iso_exports, {
18794
18794
  ZodISODate: () => ZodISODate,
@@ -18813,7 +18813,7 @@ function duration2(params) {
18813
18813
  return _isoDuration(ZodISODuration, params);
18814
18814
  }
18815
18815
 
18816
- // node_modules/zod/v4/classic/from-json-schema.js
18816
+ // ../../opt/toolchain/node_modules/zod/v4/classic/from-json-schema.js
18817
18817
  var z = {
18818
18818
  ...schemas_exports2,
18819
18819
  ...checks_exports2,
@@ -19546,7 +19546,7 @@ function fromJSONSchema(schema, params) {
19546
19546
  return convertSchema(normalized, ctx);
19547
19547
  }
19548
19548
 
19549
- // node_modules/zod/v4/core/visit.js
19549
+ // ../../opt/toolchain/node_modules/zod/v4/core/visit.js
19550
19550
  var RESOLVING = Symbol("z.visit/resolving");
19551
19551
  function visit(schema, fnOrHandlers) {
19552
19552
  const fn = typeof fnOrHandlers === "function" ? fnOrHandlers : (node2, rewritten) => {
@@ -19701,7 +19701,7 @@ function visit(schema, fnOrHandlers) {
19701
19701
  return run(schema);
19702
19702
  }
19703
19703
 
19704
- // node_modules/zod/v4/classic/deep-partial.js
19704
+ // ../../opt/toolchain/node_modules/zod/v4/classic/deep-partial.js
19705
19705
  function deepPartial(schema) {
19706
19706
  return visit(schema, {
19707
19707
  object: (s) => s.partial(),
@@ -19713,7 +19713,7 @@ function deepPartial(schema) {
19713
19713
  });
19714
19714
  }
19715
19715
 
19716
- // node_modules/zod/v4/classic/in-out.js
19716
+ // ../../opt/toolchain/node_modules/zod/v4/classic/in-out.js
19717
19717
  function withChecks(side, checks) {
19718
19718
  if (!checks?.length)
19719
19719
  return side;
@@ -19743,7 +19743,7 @@ function output(schema) {
19743
19743
  });
19744
19744
  }
19745
19745
 
19746
- // node_modules/zod/v4/classic/coerce.js
19746
+ // ../../opt/toolchain/node_modules/zod/v4/classic/coerce.js
19747
19747
  var coerce_exports = {};
19748
19748
  __export(coerce_exports, {
19749
19749
  bigint: () => bigint3,
@@ -20023,6 +20023,23 @@ var evaluationSchema = external_exports.object({
20023
20023
  durationMs: external_exports.number().int().nonnegative().default(0)
20024
20024
  });
20025
20025
 
20026
+ // src/core/agent-identity.ts
20027
+ var AGENT_CAPABILITIES = [
20028
+ "git:read",
20029
+ "git:write",
20030
+ "git:review",
20031
+ "git:merge",
20032
+ "git:check",
20033
+ "execution:read",
20034
+ "execution:write"
20035
+ ];
20036
+ function matchesAgentBranch(branch, patterns) {
20037
+ if (!branchSchema.safeParse(branch).success) return false;
20038
+ return patterns.some(
20039
+ (pattern) => pattern === "*" || (pattern.endsWith("*") ? branch.startsWith(pattern.slice(0, -1)) : branch === pattern)
20040
+ );
20041
+ }
20042
+
20026
20043
  // src/sdk/client.ts
20027
20044
  var TraceGitError = class extends Error {
20028
20045
  constructor(code, message, status, details) {
@@ -20037,6 +20054,8 @@ var TraceGitClient = class {
20037
20054
  url;
20038
20055
  apiKey;
20039
20056
  transport;
20057
+ authenticatedAgent;
20058
+ pendingIdentity;
20040
20059
  constructor(options) {
20041
20060
  const url2 = new URL(options.url);
20042
20061
  if (url2.username || url2.password || url2.search || url2.hash || url2.protocol !== "https:" && !(url2.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(url2.hostname)))
@@ -20047,6 +20066,100 @@ var TraceGitClient = class {
20047
20066
  this.apiKey = options.apiKey;
20048
20067
  this.transport = options.fetch ?? globalThis.fetch.bind(globalThis);
20049
20068
  }
20069
+ get isAgentCredential() {
20070
+ return this.apiKey.startsWith("bag_") || this.authenticatedAgent !== void 0;
20071
+ }
20072
+ rememberIdentity(principal) {
20073
+ if (principal.source !== "agent") {
20074
+ if (this.isAgentCredential)
20075
+ throw new TraceGitError(
20076
+ "agent_identity_required",
20077
+ "Use an authenticated agent credential.",
20078
+ 403
20079
+ );
20080
+ return;
20081
+ }
20082
+ const identity = principal.agent;
20083
+ if (!identity || principal.id !== identity.agentId || principal.role !== "operator" || !idSchema.safeParse(principal.workspaceId).success || !idSchema.safeParse(identity.agentId).success || !idSchema.safeParse(identity.projectId).success || !idSchema.safeParse(identity.credentialId).success || !Number.isSafeInteger(identity.generation) || identity.generation < 1 || !Array.isArray(identity.capabilities) || identity.capabilities.some((value) => !AGENT_CAPABILITIES.includes(value)) || !Array.isArray(identity.writeBranches) || identity.writeBranches.some((value) => typeof value !== "string"))
20084
+ throw new TraceGitError(
20085
+ "invalid_agent_identity",
20086
+ "The service returned an invalid agent identity.",
20087
+ 502
20088
+ );
20089
+ if (this.authenticatedAgent && (this.authenticatedAgent.agentId !== identity.agentId || this.authenticatedAgent.projectId !== identity.projectId || this.authenticatedAgent.credentialId !== identity.credentialId))
20090
+ throw new TraceGitError(
20091
+ "invalid_agent_identity",
20092
+ "The credential identity changed unexpectedly.",
20093
+ 502
20094
+ );
20095
+ this.authenticatedAgent = {
20096
+ ...identity,
20097
+ capabilities: [...identity.capabilities],
20098
+ writeBranches: [...identity.writeBranches]
20099
+ };
20100
+ }
20101
+ /** Resolves machine authority once; every Worker operation still rechecks live authority. */
20102
+ async assignedAgent() {
20103
+ if (!this.authenticatedAgent && this.isAgentCredential) {
20104
+ this.pendingIdentity ??= this.agentIdentity().then((session) => session.principal.agent).catch((error62) => {
20105
+ this.pendingIdentity = void 0;
20106
+ throw error62;
20107
+ });
20108
+ await this.pendingIdentity;
20109
+ }
20110
+ return this.authenticatedAgent ? {
20111
+ ...this.authenticatedAgent,
20112
+ capabilities: [...this.authenticatedAgent.capabilities],
20113
+ writeBranches: [...this.authenticatedAgent.writeBranches]
20114
+ } : void 0;
20115
+ }
20116
+ async assertExecutionAgent(agentId) {
20117
+ const identity = await this.assignedAgent();
20118
+ if (identity && identity.agentId !== agentId)
20119
+ throw new TraceGitError(
20120
+ "agent_execution_scope",
20121
+ "Use the authenticated agent identity for execution evidence.",
20122
+ 403
20123
+ );
20124
+ if (identity && !identity.capabilities.includes("execution:write"))
20125
+ throw new TraceGitError(
20126
+ "agent_capability_required",
20127
+ "Execution writes are outside the agent grant.",
20128
+ 403
20129
+ );
20130
+ }
20131
+ assertAdministration() {
20132
+ if (this.isAgentCredential)
20133
+ throw new TraceGitError(
20134
+ "agent_administration_forbidden",
20135
+ "Agent credentials cannot provision identities or administer service grants.",
20136
+ 403
20137
+ );
20138
+ }
20139
+ async authorizeProject(projectId, capability, branch) {
20140
+ idSchema.parse(projectId);
20141
+ const identity = await this.assignedAgent();
20142
+ if (!identity) return;
20143
+ if (projectId !== identity.projectId)
20144
+ throw new TraceGitError(
20145
+ "agent_project_scope",
20146
+ "The credential is assigned to another project.",
20147
+ 403
20148
+ );
20149
+ if (capability && !identity.capabilities.includes(capability))
20150
+ throw new TraceGitError(
20151
+ "agent_capability_required",
20152
+ "The operation is outside the agent grant.",
20153
+ 403,
20154
+ { capability }
20155
+ );
20156
+ if (branch !== void 0 && !matchesAgentBranch(branch, identity.writeBranches))
20157
+ throw new TraceGitError(
20158
+ "agent_branch_scope",
20159
+ "The branch is outside the agent write grant.",
20160
+ 403
20161
+ );
20162
+ }
20050
20163
  async raw(path, init = {}) {
20051
20164
  if (!path.startsWith("/") || path.startsWith("//"))
20052
20165
  throw new Error("Expected an API-relative path");
@@ -20089,10 +20202,13 @@ var TraceGitClient = class {
20089
20202
  }
20090
20203
  }
20091
20204
  }
20092
- createAgent(options) {
20205
+ async createAgent(options) {
20206
+ this.assertAdministration();
20093
20207
  return this.request("/agents", "POST", { ...options, id: options.id ?? newId("agt") }, true);
20094
20208
  }
20095
20209
  async createRun(options) {
20210
+ await this.authorizeProject(options.projectId, "execution:write", options.branch ?? "main");
20211
+ await this.assertExecutionAgent(options.rootAgentId);
20096
20212
  const run = await this.request(
20097
20213
  "/runs",
20098
20214
  "POST",
@@ -20101,16 +20217,131 @@ var TraceGitClient = class {
20101
20217
  );
20102
20218
  return new TraceExecution(this, run.id, options.rootAgentId);
20103
20219
  }
20220
+ async createAgentRun(options) {
20221
+ const identity = await this.assignedAgent();
20222
+ if (!identity)
20223
+ throw new TraceGitError(
20224
+ "agent_identity_required",
20225
+ "Use an agent credential to start an assigned execution.",
20226
+ 403
20227
+ );
20228
+ return this.createRun({
20229
+ ...options,
20230
+ projectId: identity.projectId,
20231
+ rootAgentId: identity.agentId
20232
+ });
20233
+ }
20104
20234
  execution(runId, agentId) {
20105
20235
  return new TraceExecution(this, runId, agentId);
20106
20236
  }
20107
- events(events) {
20237
+ async events(events) {
20238
+ const identity = await this.assignedAgent();
20239
+ if (identity && events.some((event) => event.agentId !== identity.agentId))
20240
+ throw new TraceGitError(
20241
+ "agent_execution_scope",
20242
+ "Events must use the authenticated agent identity.",
20243
+ 403
20244
+ );
20245
+ if (identity && !identity.capabilities.includes("execution:write"))
20246
+ throw new TraceGitError(
20247
+ "agent_capability_required",
20248
+ "Execution writes are outside the agent grant.",
20249
+ 403
20250
+ );
20108
20251
  return this.request("/events", "POST", { events }, true);
20109
20252
  }
20110
- me() {
20111
- return this.request("/me");
20253
+ async me() {
20254
+ const result = await this.request("/me");
20255
+ this.rememberIdentity(result.principal);
20256
+ if (result.principal.source === "agent" && result.workspace.id !== result.principal.workspaceId)
20257
+ throw new TraceGitError(
20258
+ "invalid_agent_identity",
20259
+ "The agent workspace metadata is inconsistent.",
20260
+ 502
20261
+ );
20262
+ return result;
20263
+ }
20264
+ async agentIdentity() {
20265
+ const result = await this.request("/agent/me");
20266
+ if (result.principal.source !== "agent" || result.protocol !== "branchora.agents.v1" || result.headless !== true)
20267
+ throw new TraceGitError(
20268
+ "invalid_agent_identity",
20269
+ "The service did not return the headless agent protocol.",
20270
+ 502
20271
+ );
20272
+ this.rememberIdentity(result.principal);
20273
+ return result;
20274
+ }
20275
+ async repositoryAutomation(projectId) {
20276
+ await this.authorizeProject(projectId, "git:read");
20277
+ return this.request(`/projects/${encodeURIComponent(projectId)}/automation`);
20278
+ }
20279
+ async configureAgentRepository(projectId, expectedVersion = 0) {
20280
+ this.assertAdministration();
20281
+ idSchema.parse(projectId);
20282
+ return this.request(
20283
+ `/projects/${encodeURIComponent(projectId)}/automation`,
20284
+ "PUT",
20285
+ { mode: "agents-only", expectedVersion }
20286
+ );
20287
+ }
20288
+ async listAgentAccess(projectId) {
20289
+ this.assertAdministration();
20290
+ idSchema.parse(projectId);
20291
+ return this.request(`/projects/${encodeURIComponent(projectId)}/agent-access`);
20292
+ }
20293
+ async grantAgentAccess(projectId, agentId, options) {
20294
+ this.assertAdministration();
20295
+ idSchema.parse(projectId);
20296
+ idSchema.parse(agentId);
20297
+ return this.request(
20298
+ `/projects/${encodeURIComponent(projectId)}/agent-access/${encodeURIComponent(agentId)}`,
20299
+ "PUT",
20300
+ { ...options, expectedGeneration: options.expectedGeneration ?? 0 }
20301
+ );
20302
+ }
20303
+ async issueAgentCredential(projectId, agentId, name, expiresInHours = 24) {
20304
+ this.assertAdministration();
20305
+ idSchema.parse(projectId);
20306
+ idSchema.parse(agentId);
20307
+ return this.request(`/projects/${encodeURIComponent(projectId)}/agent-credentials`, "POST", {
20308
+ agentId,
20309
+ name,
20310
+ expiresInHours
20311
+ });
20312
+ }
20313
+ async listAgentCredentials(projectId) {
20314
+ this.assertAdministration();
20315
+ idSchema.parse(projectId);
20316
+ return this.request(`/projects/${encodeURIComponent(projectId)}/agent-credentials`);
20317
+ }
20318
+ async revokeAgentAccess(projectId, agentId) {
20319
+ this.assertAdministration();
20320
+ idSchema.parse(projectId);
20321
+ idSchema.parse(agentId);
20322
+ return this.request(
20323
+ `/projects/${encodeURIComponent(projectId)}/agent-access/${encodeURIComponent(agentId)}`,
20324
+ "DELETE"
20325
+ );
20326
+ }
20327
+ async revokeAgentCredential(projectId, credentialId) {
20328
+ this.assertAdministration();
20329
+ idSchema.parse(projectId);
20330
+ idSchema.parse(credentialId);
20331
+ return this.request(
20332
+ `/projects/${encodeURIComponent(projectId)}/agent-credentials/${encodeURIComponent(credentialId)}`,
20333
+ "DELETE"
20334
+ );
20112
20335
  }
20113
20336
  providerHeaders(runId, agentId, requestId = newId("req")) {
20337
+ if (this.isAgentCredential && !this.authenticatedAgent)
20338
+ throw new Error("Resolve agentIdentity() before creating provider headers.");
20339
+ if (this.authenticatedAgent && agentId !== this.authenticatedAgent.agentId)
20340
+ throw new TraceGitError(
20341
+ "agent_execution_scope",
20342
+ "Provider headers must use the authenticated agent identity.",
20343
+ 403
20344
+ );
20114
20345
  return {
20115
20346
  "x-tracegit-key": this.apiKey,
20116
20347
  "x-tracegit-run-id": runId,
@@ -20119,11 +20350,103 @@ var TraceGitClient = class {
20119
20350
  };
20120
20351
  }
20121
20352
  gitTransport(projectId) {
20353
+ idSchema.parse(projectId);
20354
+ if (this.isAgentCredential && !this.authenticatedAgent)
20355
+ throw new Error("Resolve agentIdentity() before creating a Git transport.");
20356
+ if (this.authenticatedAgent && projectId !== this.authenticatedAgent.projectId)
20357
+ throw new TraceGitError(
20358
+ "agent_project_scope",
20359
+ "Git transport must use the assigned project.",
20360
+ 403
20361
+ );
20122
20362
  return {
20123
- remote: `${this.url}/git/${projectId}`,
20363
+ remote: `${this.url}/git/${encodeURIComponent(projectId)}`,
20124
20364
  headers: { Authorization: `Bearer ${this.apiKey}` }
20125
20365
  };
20126
20366
  }
20367
+ async repositoryRefs(projectId) {
20368
+ await this.authorizeProject(projectId, "git:read");
20369
+ return this.request(`/projects/${encodeURIComponent(projectId)}/refs`);
20370
+ }
20371
+ async readRepositoryFile(projectId, path, ref) {
20372
+ await this.authorizeProject(projectId, "git:read");
20373
+ pathSchema.parse(path);
20374
+ const query = new URLSearchParams({ path, ...ref === void 0 ? {} : { ref } });
20375
+ return this.request(`/projects/${encodeURIComponent(projectId)}/file?${query}`);
20376
+ }
20377
+ async compareRepository(projectId, base, head) {
20378
+ await this.authorizeProject(projectId, "git:read");
20379
+ const query = new URLSearchParams({ base, head });
20380
+ return this.request(`/projects/${encodeURIComponent(projectId)}/compare?${query}`);
20381
+ }
20382
+ async createBranch(projectId, branch, from, operationId = newId("git")) {
20383
+ branchSchema.parse(branch);
20384
+ await this.authorizeProject(projectId, "git:write", branch);
20385
+ return this.request(
20386
+ `/projects/${encodeURIComponent(projectId)}/branches`,
20387
+ "POST",
20388
+ { operationId, branch, from },
20389
+ true
20390
+ );
20391
+ }
20392
+ async commitFiles(projectId, options) {
20393
+ branchSchema.parse(options.branch);
20394
+ if (options.expectedHead !== null) shaSchema.parse(options.expectedHead);
20395
+ for (const file2 of options.files) pathSchema.parse(file2.path);
20396
+ await this.authorizeProject(projectId, "git:write", options.branch);
20397
+ return this.request(
20398
+ `/projects/${encodeURIComponent(projectId)}/changes`,
20399
+ "POST",
20400
+ { ...options, operationId: options.operationId ?? newId("git") },
20401
+ true
20402
+ );
20403
+ }
20404
+ async listPullRequests(projectId) {
20405
+ await this.authorizeProject(projectId, "git:read");
20406
+ return this.request(`/projects/${encodeURIComponent(projectId)}/pulls`);
20407
+ }
20408
+ async pullRequest(projectId, pullId) {
20409
+ await this.authorizeProject(projectId, "git:read");
20410
+ idSchema.parse(pullId);
20411
+ return this.request(
20412
+ `/projects/${encodeURIComponent(projectId)}/pulls/${encodeURIComponent(pullId)}`
20413
+ );
20414
+ }
20415
+ async openPullRequest(projectId, options) {
20416
+ branchSchema.parse(options.sourceBranch);
20417
+ branchSchema.parse(options.targetBranch);
20418
+ await this.authorizeProject(projectId, "git:write", options.sourceBranch);
20419
+ return this.request(`/projects/${encodeURIComponent(projectId)}/pulls`, "POST", options);
20420
+ }
20421
+ async reviewPullRequest(projectId, pullId, options) {
20422
+ await this.authorizeProject(projectId, "git:review");
20423
+ idSchema.parse(pullId);
20424
+ shaSchema.parse(options.headSha);
20425
+ return this.request(
20426
+ `/projects/${encodeURIComponent(projectId)}/pulls/${encodeURIComponent(pullId)}/reviews`,
20427
+ "POST",
20428
+ options
20429
+ );
20430
+ }
20431
+ async recordCommitCheck(projectId, options) {
20432
+ await this.authorizeProject(projectId, "git:check");
20433
+ shaSchema.parse(options.commitSha);
20434
+ return this.request(`/projects/${encodeURIComponent(projectId)}/checks`, "POST", options);
20435
+ }
20436
+ async mergePullRequest(projectId, pullId, expectedVersion, operationId = newId("git")) {
20437
+ await this.authorizeProject(projectId, "git:merge");
20438
+ idSchema.parse(pullId);
20439
+ return this.request(
20440
+ `/projects/${encodeURIComponent(projectId)}/pulls/${encodeURIComponent(pullId)}/merge`,
20441
+ "POST",
20442
+ { expectedVersion, operationId },
20443
+ true
20444
+ );
20445
+ }
20446
+ publishRun(runId) {
20447
+ idSchema.parse(runId);
20448
+ return this.request(`/runs/${encodeURIComponent(runId)}/publish`, "POST", {});
20449
+ }
20127
20450
  createWallet(options) {
20128
20451
  return this.request(
20129
20452
  "/wallets",
@@ -20250,6 +20573,7 @@ var TraceExecution = class _TraceExecution {
20250
20573
  this.blocks = [...blocks];
20251
20574
  }
20252
20575
  async decision(options) {
20576
+ await this.client.assertExecutionAgent(this.agentId);
20253
20577
  const result = await this.client.request(
20254
20578
  `/runs/${this.runId}/decisions`,
20255
20579
  "POST",
@@ -20265,6 +20589,7 @@ var TraceExecution = class _TraceExecution {
20265
20589
  return result;
20266
20590
  }
20267
20591
  async instructions(content, source = "sdk-declared") {
20592
+ await this.client.assertExecutionAgent(this.agentId);
20268
20593
  return this.client.request(
20269
20594
  `/runs/${this.runId}/instructions`,
20270
20595
  "POST",
@@ -20280,6 +20605,7 @@ var TraceExecution = class _TraceExecution {
20280
20605
  );
20281
20606
  }
20282
20607
  async delegate(options) {
20608
+ await this.client.assertExecutionAgent(this.agentId);
20283
20609
  const agent = await this.client.createAgent(options);
20284
20610
  await this.client.request(
20285
20611
  `/runs/${this.runId}/agents`,
@@ -20294,6 +20620,7 @@ var TraceExecution = class _TraceExecution {
20294
20620
  return new _TraceExecution(this.client, this.runId, agent.id);
20295
20621
  }
20296
20622
  async generate(options) {
20623
+ await this.client.assertExecutionAgent(this.agentId);
20297
20624
  const shared = await buildSharedContext(this.blocks);
20298
20625
  const messages = [
20299
20626
  ...options.system ? [{ role: "system", content: options.system }] : [],
@@ -20348,6 +20675,7 @@ var TraceExecution = class _TraceExecution {
20348
20675
  });
20349
20676
  }
20350
20677
  async complete(status, reason) {
20678
+ await this.client.assertExecutionAgent(this.agentId);
20351
20679
  const detail = await this.client.request(`/runs/${this.runId}`);
20352
20680
  await this.client.request(`/runs/${this.runId}`, "PATCH", {
20353
20681
  status,
@@ -20367,6 +20695,7 @@ var TraceExecution = class _TraceExecution {
20367
20695
  /** Fetch adapter for provider SDKs. Every call goes through the economic gate. */
20368
20696
  instrumentedFetch(provider, providerKey, context = []) {
20369
20697
  return async (input2, init) => {
20698
+ await this.client.assertExecutionAgent(this.agentId);
20370
20699
  const request = new Request(input2, init);
20371
20700
  if (request.method !== "POST")
20372
20701
  throw new Error("Instrumented provider transport only accepts inference POST requests.");
@@ -21261,6 +21590,7 @@ async function describeContext(blocks, source = "sdk-block") {
21261
21590
  );
21262
21591
  }
21263
21592
  export {
21593
+ AGENT_CAPABILITIES,
21264
21594
  TraceGitClient as BranchoraClient,
21265
21595
  TraceGitError as BranchoraError,
21266
21596
  TraceExecution as BranchoraExecution,
@@ -21283,6 +21613,7 @@ export {
21283
21613
  kiroCapabilities,
21284
21614
  kiroEvents,
21285
21615
  kiroHookConfig,
21616
+ matchesAgentBranch,
21286
21617
  nanosToUsd,
21287
21618
  normalizeUsage,
21288
21619
  usdToNanos