local-commander-agent 0.3.5 → 0.3.7

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/runtime/agent.mjs CHANGED
@@ -39,9 +39,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
39
39
  mod
40
40
  ));
41
41
 
42
- // node_modules/ws/lib/constants.js
42
+ // ../../node_modules/ws/lib/constants.js
43
43
  var require_constants = __commonJS({
44
- "node_modules/ws/lib/constants.js"(exports, module) {
44
+ "../../node_modules/ws/lib/constants.js"(exports, module) {
45
45
  "use strict";
46
46
  var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
47
47
  var hasBlob = typeof Blob !== "undefined";
@@ -62,9 +62,9 @@ var require_constants = __commonJS({
62
62
  }
63
63
  });
64
64
 
65
- // node_modules/ws/lib/buffer-util.js
65
+ // ../../node_modules/ws/lib/buffer-util.js
66
66
  var require_buffer_util = __commonJS({
67
- "node_modules/ws/lib/buffer-util.js"(exports, module) {
67
+ "../../node_modules/ws/lib/buffer-util.js"(exports, module) {
68
68
  "use strict";
69
69
  var { EMPTY_BUFFER } = require_constants();
70
70
  var FastBuffer = Buffer[Symbol.species];
@@ -137,9 +137,9 @@ var require_buffer_util = __commonJS({
137
137
  }
138
138
  });
139
139
 
140
- // node_modules/ws/lib/limiter.js
140
+ // ../../node_modules/ws/lib/limiter.js
141
141
  var require_limiter = __commonJS({
142
- "node_modules/ws/lib/limiter.js"(exports, module) {
142
+ "../../node_modules/ws/lib/limiter.js"(exports, module) {
143
143
  "use strict";
144
144
  var kDone = /* @__PURE__ */ Symbol("kDone");
145
145
  var kRun = /* @__PURE__ */ Symbol("kRun");
@@ -187,9 +187,9 @@ var require_limiter = __commonJS({
187
187
  }
188
188
  });
189
189
 
190
- // node_modules/ws/lib/permessage-deflate.js
190
+ // ../../node_modules/ws/lib/permessage-deflate.js
191
191
  var require_permessage_deflate = __commonJS({
192
- "node_modules/ws/lib/permessage-deflate.js"(exports, module) {
192
+ "../../node_modules/ws/lib/permessage-deflate.js"(exports, module) {
193
193
  "use strict";
194
194
  var zlib = __require("zlib");
195
195
  var bufferUtil = require_buffer_util();
@@ -570,9 +570,9 @@ var require_permessage_deflate = __commonJS({
570
570
  }
571
571
  });
572
572
 
573
- // node_modules/ws/lib/validation.js
573
+ // ../../node_modules/ws/lib/validation.js
574
574
  var require_validation = __commonJS({
575
- "node_modules/ws/lib/validation.js"(exports, module) {
575
+ "../../node_modules/ws/lib/validation.js"(exports, module) {
576
576
  "use strict";
577
577
  var { isUtf8 } = __require("buffer");
578
578
  var { hasBlob } = require_constants();
@@ -771,9 +771,9 @@ var require_validation = __commonJS({
771
771
  }
772
772
  });
773
773
 
774
- // node_modules/ws/lib/receiver.js
774
+ // ../../node_modules/ws/lib/receiver.js
775
775
  var require_receiver = __commonJS({
776
- "node_modules/ws/lib/receiver.js"(exports, module) {
776
+ "../../node_modules/ws/lib/receiver.js"(exports, module) {
777
777
  "use strict";
778
778
  var { Writable } = __require("stream");
779
779
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -1394,9 +1394,9 @@ var require_receiver = __commonJS({
1394
1394
  }
1395
1395
  });
1396
1396
 
1397
- // node_modules/ws/lib/sender.js
1397
+ // ../../node_modules/ws/lib/sender.js
1398
1398
  var require_sender = __commonJS({
1399
- "node_modules/ws/lib/sender.js"(exports, module) {
1399
+ "../../node_modules/ws/lib/sender.js"(exports, module) {
1400
1400
  "use strict";
1401
1401
  var { Duplex } = __require("stream");
1402
1402
  var { randomFillSync } = __require("crypto");
@@ -1887,9 +1887,9 @@ var require_sender = __commonJS({
1887
1887
  }
1888
1888
  });
1889
1889
 
1890
- // node_modules/ws/lib/event-target.js
1890
+ // ../../node_modules/ws/lib/event-target.js
1891
1891
  var require_event_target = __commonJS({
1892
- "node_modules/ws/lib/event-target.js"(exports, module) {
1892
+ "../../node_modules/ws/lib/event-target.js"(exports, module) {
1893
1893
  "use strict";
1894
1894
  var { kForOnEventAttribute, kListener } = require_constants();
1895
1895
  var kCode = /* @__PURE__ */ Symbol("kCode");
@@ -2116,9 +2116,9 @@ var require_event_target = __commonJS({
2116
2116
  }
2117
2117
  });
2118
2118
 
2119
- // node_modules/ws/lib/extension.js
2119
+ // ../../node_modules/ws/lib/extension.js
2120
2120
  var require_extension = __commonJS({
2121
- "node_modules/ws/lib/extension.js"(exports, module) {
2121
+ "../../node_modules/ws/lib/extension.js"(exports, module) {
2122
2122
  "use strict";
2123
2123
  var { tokenChars } = require_validation();
2124
2124
  function push(dest, name2, elem) {
@@ -2269,16 +2269,16 @@ var require_extension = __commonJS({
2269
2269
  }
2270
2270
  });
2271
2271
 
2272
- // node_modules/ws/lib/websocket.js
2272
+ // ../../node_modules/ws/lib/websocket.js
2273
2273
  var require_websocket = __commonJS({
2274
- "node_modules/ws/lib/websocket.js"(exports, module) {
2274
+ "../../node_modules/ws/lib/websocket.js"(exports, module) {
2275
2275
  "use strict";
2276
2276
  var EventEmitter = __require("events");
2277
2277
  var https = __require("https");
2278
2278
  var http = __require("http");
2279
2279
  var net = __require("net");
2280
2280
  var tls = __require("tls");
2281
- var { randomBytes: randomBytes4, createHash: createHash10 } = __require("crypto");
2281
+ var { randomBytes: randomBytes4, createHash: createHash11 } = __require("crypto");
2282
2282
  var { Duplex, Readable } = __require("stream");
2283
2283
  var { URL: URL2 } = __require("url");
2284
2284
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -2959,7 +2959,7 @@ var require_websocket = __commonJS({
2959
2959
  abortHandshake(websocket, socket, "Invalid Upgrade header");
2960
2960
  return;
2961
2961
  }
2962
- const digest4 = createHash10("sha1").update(key + GUID).digest("base64");
2962
+ const digest4 = createHash11("sha1").update(key + GUID).digest("base64");
2963
2963
  if (res.headers["sec-websocket-accept"] !== digest4) {
2964
2964
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
2965
2965
  return;
@@ -3178,9 +3178,9 @@ var require_websocket = __commonJS({
3178
3178
  }
3179
3179
  });
3180
3180
 
3181
- // node_modules/ws/lib/stream.js
3181
+ // ../../node_modules/ws/lib/stream.js
3182
3182
  var require_stream = __commonJS({
3183
- "node_modules/ws/lib/stream.js"(exports, module) {
3183
+ "../../node_modules/ws/lib/stream.js"(exports, module) {
3184
3184
  "use strict";
3185
3185
  var WebSocket2 = require_websocket();
3186
3186
  var { Duplex } = __require("stream");
@@ -3240,7 +3240,7 @@ var require_stream = __commonJS({
3240
3240
  };
3241
3241
  duplex._final = function(callback) {
3242
3242
  if (ws.readyState === ws.CONNECTING) {
3243
- ws.once("open", function open7() {
3243
+ ws.once("open", function open8() {
3244
3244
  duplex._final(callback);
3245
3245
  });
3246
3246
  return;
@@ -3261,7 +3261,7 @@ var require_stream = __commonJS({
3261
3261
  };
3262
3262
  duplex._write = function(chunk, encoding, callback) {
3263
3263
  if (ws.readyState === ws.CONNECTING) {
3264
- ws.once("open", function open7() {
3264
+ ws.once("open", function open8() {
3265
3265
  duplex._write(chunk, encoding, callback);
3266
3266
  });
3267
3267
  return;
@@ -3276,9 +3276,9 @@ var require_stream = __commonJS({
3276
3276
  }
3277
3277
  });
3278
3278
 
3279
- // node_modules/ws/lib/subprotocol.js
3279
+ // ../../node_modules/ws/lib/subprotocol.js
3280
3280
  var require_subprotocol = __commonJS({
3281
- "node_modules/ws/lib/subprotocol.js"(exports, module) {
3281
+ "../../node_modules/ws/lib/subprotocol.js"(exports, module) {
3282
3282
  "use strict";
3283
3283
  var { tokenChars } = require_validation();
3284
3284
  function parse3(header) {
@@ -3321,14 +3321,14 @@ var require_subprotocol = __commonJS({
3321
3321
  }
3322
3322
  });
3323
3323
 
3324
- // node_modules/ws/lib/websocket-server.js
3324
+ // ../../node_modules/ws/lib/websocket-server.js
3325
3325
  var require_websocket_server = __commonJS({
3326
- "node_modules/ws/lib/websocket-server.js"(exports, module) {
3326
+ "../../node_modules/ws/lib/websocket-server.js"(exports, module) {
3327
3327
  "use strict";
3328
3328
  var EventEmitter = __require("events");
3329
3329
  var http = __require("http");
3330
3330
  var { Duplex } = __require("stream");
3331
- var { createHash: createHash10 } = __require("crypto");
3331
+ var { createHash: createHash11 } = __require("crypto");
3332
3332
  var extension2 = require_extension();
3333
3333
  var PerMessageDeflate2 = require_permessage_deflate();
3334
3334
  var subprotocol2 = require_subprotocol();
@@ -3635,7 +3635,7 @@ var require_websocket_server = __commonJS({
3635
3635
  );
3636
3636
  }
3637
3637
  if (this._state > RUNNING) return abortHandshake(socket, 503);
3638
- const digest4 = createHash10("sha1").update(key + GUID).digest("base64");
3638
+ const digest4 = createHash11("sha1").update(key + GUID).digest("base64");
3639
3639
  const headers = [
3640
3640
  "HTTP/1.1 101 Switching Protocols",
3641
3641
  "Upgrade: websocket",
@@ -3723,9 +3723,9 @@ var require_websocket_server = __commonJS({
3723
3723
  });
3724
3724
 
3725
3725
  // agent/src/main.ts
3726
- import path12 from "node:path";
3726
+ import path14 from "node:path";
3727
3727
  import os3 from "node:os";
3728
- import { mkdir as mkdir5, open as open6, readFile as readFile5, rm as rm4 } from "node:fs/promises";
3728
+ import { mkdir as mkdir6, open as open7, readFile as readFile5, rm as rm5 } from "node:fs/promises";
3729
3729
  import { fileURLToPath } from "node:url";
3730
3730
 
3731
3731
  // packages/operations/src/crypto.ts
@@ -3858,7 +3858,7 @@ var Utf8OutputTailBuffer = class {
3858
3858
  }
3859
3859
  };
3860
3860
 
3861
- // node_modules/zod/v4/classic/external.js
3861
+ // ../../node_modules/zod/v4/classic/external.js
3862
3862
  var external_exports = {};
3863
3863
  __export(external_exports, {
3864
3864
  $brand: () => $brand,
@@ -4121,7 +4121,7 @@ __export(external_exports, {
4121
4121
  xor: () => xor
4122
4122
  });
4123
4123
 
4124
- // node_modules/zod/v4/core/index.js
4124
+ // ../../node_modules/zod/v4/core/index.js
4125
4125
  var core_exports2 = {};
4126
4126
  __export(core_exports2, {
4127
4127
  $ZodAny: () => $ZodAny,
@@ -4438,7 +4438,7 @@ __export(core_exports2, {
4438
4438
  withParser: () => withParser
4439
4439
  });
4440
4440
 
4441
- // node_modules/zod/v4/core/util.js
4441
+ // ../../node_modules/zod/v4/core/util.js
4442
4442
  var util_exports = {};
4443
4443
  __export(util_exports, {
4444
4444
  BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
@@ -4674,10 +4674,10 @@ function mergeDefs(...defs) {
4674
4674
  function cloneDef(schema) {
4675
4675
  return mergeDefs(schema._zod.def);
4676
4676
  }
4677
- function getElementAtPath(obj, path13) {
4678
- if (!path13)
4677
+ function getElementAtPath(obj, path15) {
4678
+ if (!path15)
4679
4679
  return obj;
4680
- return path13.reduce((acc, key) => acc?.[key], obj);
4680
+ return path15.reduce((acc, key) => acc?.[key], obj);
4681
4681
  }
4682
4682
  function promiseAllObject(promisesObj) {
4683
4683
  const keys = Object.keys(promisesObj);
@@ -5017,11 +5017,11 @@ function explicitlyAborted(x, startIndex = 0) {
5017
5017
  }
5018
5018
  return false;
5019
5019
  }
5020
- function prefixIssues(path13, issues) {
5020
+ function prefixIssues(path15, issues) {
5021
5021
  return issues.map((iss) => {
5022
5022
  var _a3;
5023
5023
  (_a3 = iss).path ?? (_a3.path = []);
5024
- iss.path.unshift(path13);
5024
+ iss.path.unshift(path15);
5025
5025
  return iss;
5026
5026
  });
5027
5027
  }
@@ -5281,7 +5281,7 @@ function constantCatch(value) {
5281
5281
  return fn;
5282
5282
  }
5283
5283
 
5284
- // node_modules/zod/v4/core/core.js
5284
+ // ../../node_modules/zod/v4/core/core.js
5285
5285
  var _a;
5286
5286
  var NEVER = /* @__PURE__ */ Object.freeze({
5287
5287
  status: "aborted"
@@ -5403,7 +5403,7 @@ function config(newConfig) {
5403
5403
  return globalConfig;
5404
5404
  }
5405
5405
 
5406
- // node_modules/zod/v4/core/errors.js
5406
+ // ../../node_modules/zod/v4/core/errors.js
5407
5407
  function _getMessage() {
5408
5408
  const internals = this._zod;
5409
5409
  internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
@@ -5471,16 +5471,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
5471
5471
  }
5472
5472
  function formatError(error62, mapper = (issue2) => issue2.message) {
5473
5473
  const fieldErrors = { _errors: [] };
5474
- const processError = (error63, path13 = []) => {
5474
+ const processError = (error63, path15 = []) => {
5475
5475
  for (const issue2 of error63.issues) {
5476
5476
  if (issue2.code === "invalid_union" && issue2.errors.length) {
5477
- issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
5477
+ issue2.errors.map((issues) => processError({ issues }, [...path15, ...issue2.path]));
5478
5478
  } else if (issue2.code === "invalid_key") {
5479
- processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
5479
+ processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
5480
5480
  } else if (issue2.code === "invalid_element") {
5481
- processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
5481
+ processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
5482
5482
  } else {
5483
- const fullpath = [...path13, ...issue2.path];
5483
+ const fullpath = [...path15, ...issue2.path];
5484
5484
  if (fullpath.length === 0) {
5485
5485
  fieldErrors._errors.push(mapper(issue2));
5486
5486
  } else {
@@ -5519,17 +5519,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
5519
5519
  }
5520
5520
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
5521
5521
  const result2 = { errors: [] };
5522
- const processError = (error63, path13 = []) => {
5522
+ const processError = (error63, path15 = []) => {
5523
5523
  var _a3;
5524
5524
  for (const issue2 of error63.issues) {
5525
5525
  if (issue2.code === "invalid_union" && issue2.errors.length) {
5526
- issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
5526
+ issue2.errors.map((issues) => processError({ issues }, [...path15, ...issue2.path]));
5527
5527
  } else if (issue2.code === "invalid_key") {
5528
- processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
5528
+ processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
5529
5529
  } else if (issue2.code === "invalid_element") {
5530
- processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
5530
+ processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
5531
5531
  } else {
5532
- const fullpath = [...path13, ...issue2.path];
5532
+ const fullpath = [...path15, ...issue2.path];
5533
5533
  if (fullpath.length === 0) {
5534
5534
  result2.errors.push(mapper(issue2));
5535
5535
  continue;
@@ -5568,8 +5568,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
5568
5568
  }
5569
5569
  function toDotPath(_path) {
5570
5570
  const segs = [];
5571
- const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
5572
- for (const seg of path13) {
5571
+ const path15 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
5572
+ for (const seg of path15) {
5573
5573
  if (typeof seg === "number")
5574
5574
  segs.push(`[${seg}]`);
5575
5575
  else if (typeof seg === "symbol")
@@ -5595,7 +5595,7 @@ function prettifyError(error62) {
5595
5595
  return lines.join("\n");
5596
5596
  }
5597
5597
 
5598
- // node_modules/zod/v4/core/parse.js
5598
+ // ../../node_modules/zod/v4/core/parse.js
5599
5599
  function finalizeParams(callee, params) {
5600
5600
  return { callee: params?.callee ?? callee, Err: params?.Err };
5601
5601
  }
@@ -5755,7 +5755,7 @@ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
5755
5755
  };
5756
5756
  var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
5757
5757
 
5758
- // node_modules/zod/v4/core/regexes.js
5758
+ // ../../node_modules/zod/v4/core/regexes.js
5759
5759
  var regexes_exports = {};
5760
5760
  __export(regexes_exports, {
5761
5761
  anyString: () => anyString,
@@ -5927,7 +5927,7 @@ var sha512_hex = /^[0-9a-fA-F]{128}$/;
5927
5927
  var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "==");
5928
5928
  var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
5929
5929
 
5930
- // node_modules/zod/v4/core/checks.js
5930
+ // ../../node_modules/zod/v4/core/checks.js
5931
5931
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
5932
5932
  var _a3;
5933
5933
  inst._zod ?? (inst._zod = {});
@@ -6403,7 +6403,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
6403
6403
  };
6404
6404
  });
6405
6405
 
6406
- // node_modules/zod/v4/core/doc.js
6406
+ // ../../node_modules/zod/v4/core/doc.js
6407
6407
  var Doc = class {
6408
6408
  constructor(args = [], closed = {}) {
6409
6409
  this.content = [];
@@ -6444,14 +6444,14 @@ ${content.join("\n")}
6444
6444
  }
6445
6445
  };
6446
6446
 
6447
- // node_modules/zod/v4/core/versions.js
6447
+ // ../../node_modules/zod/v4/core/versions.js
6448
6448
  var version = {
6449
6449
  major: 4,
6450
6450
  minor: 6,
6451
6451
  patch: 5
6452
6452
  };
6453
6453
 
6454
- // node_modules/zod/v4/core/schemas.js
6454
+ // ../../node_modules/zod/v4/core/schemas.js
6455
6455
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
6456
6456
  var _a3;
6457
6457
  inst ?? (inst = {});
@@ -8865,7 +8865,7 @@ function handleRefineResult(result2, payload, input2, inst) {
8865
8865
  }
8866
8866
  }
8867
8867
 
8868
- // node_modules/zod/v4/core/memoizer.js
8868
+ // ../../node_modules/zod/v4/core/memoizer.js
8869
8869
  var $ZodCyclicError = class extends Error {
8870
8870
  constructor() {
8871
8871
  super(`Cannot parse a reference cycle that closes through a transform`);
@@ -9142,7 +9142,7 @@ function isBackEdge(ctx, value) {
9142
9142
  return backEdges !== void 0 && isRef(value) && backEdges.has(value);
9143
9143
  }
9144
9144
 
9145
- // node_modules/zod/v4/locales/index.js
9145
+ // ../../node_modules/zod/v4/locales/index.js
9146
9146
  var locales_exports = {};
9147
9147
  __export(locales_exports, {
9148
9148
  ar: () => ar_default,
@@ -9210,7 +9210,7 @@ __export(locales_exports, {
9210
9210
  zhTW: () => zh_TW_default
9211
9211
  });
9212
9212
 
9213
- // node_modules/zod/v4/locales/ar.js
9213
+ // ../../node_modules/zod/v4/locales/ar.js
9214
9214
  var error = () => {
9215
9215
  const Sizable = {
9216
9216
  string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
@@ -9322,7 +9322,7 @@ function ar_default() {
9322
9322
  };
9323
9323
  }
9324
9324
 
9325
- // node_modules/zod/v4/locales/az.js
9325
+ // ../../node_modules/zod/v4/locales/az.js
9326
9326
  var error2 = () => {
9327
9327
  const Sizable = {
9328
9328
  string: { unit: "simvol", verb: "olmal\u0131d\u0131r" },
@@ -9433,7 +9433,7 @@ function az_default() {
9433
9433
  };
9434
9434
  }
9435
9435
 
9436
- // node_modules/zod/v4/locales/be.js
9436
+ // ../../node_modules/zod/v4/locales/be.js
9437
9437
  function getBelarusianPlural(count, one, few, many) {
9438
9438
  const absCount = Math.abs(count);
9439
9439
  const lastDigit = absCount % 10;
@@ -9602,7 +9602,7 @@ function be_default() {
9602
9602
  };
9603
9603
  }
9604
9604
 
9605
- // node_modules/zod/v4/locales/bg.js
9605
+ // ../../node_modules/zod/v4/locales/bg.js
9606
9606
  var error4 = () => {
9607
9607
  const Sizable = {
9608
9608
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" },
@@ -9728,7 +9728,7 @@ function bg_default() {
9728
9728
  };
9729
9729
  }
9730
9730
 
9731
- // node_modules/zod/v4/locales/bn.js
9731
+ // ../../node_modules/zod/v4/locales/bn.js
9732
9732
  var error5 = () => {
9733
9733
  const Sizable = {
9734
9734
  string: { unit: "\u0985\u0995\u09CD\u09B7\u09B0", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" },
@@ -9842,7 +9842,7 @@ function bn_default() {
9842
9842
  };
9843
9843
  }
9844
9844
 
9845
- // node_modules/zod/v4/locales/ca.js
9845
+ // ../../node_modules/zod/v4/locales/ca.js
9846
9846
  var error6 = () => {
9847
9847
  const Sizable = {
9848
9848
  string: { unit: "car\xE0cters", verb: "contenir" },
@@ -9956,7 +9956,7 @@ function ca_default() {
9956
9956
  };
9957
9957
  }
9958
9958
 
9959
- // node_modules/zod/v4/locales/ckb.js
9959
+ // ../../node_modules/zod/v4/locales/ckb.js
9960
9960
  var error7 = () => {
9961
9961
  const Sizable = {
9962
9962
  string: { unit: "\u067E\u06CC\u062A", verb: "\u0628\u06CE\u062A" },
@@ -10089,7 +10089,7 @@ function ckb_default() {
10089
10089
  };
10090
10090
  }
10091
10091
 
10092
- // node_modules/zod/v4/locales/cs.js
10092
+ // ../../node_modules/zod/v4/locales/cs.js
10093
10093
  var error8 = () => {
10094
10094
  const Sizable = {
10095
10095
  string: { unit: "znak\u016F", verb: "m\xEDt" },
@@ -10206,7 +10206,7 @@ function cs_default() {
10206
10206
  };
10207
10207
  }
10208
10208
 
10209
- // node_modules/zod/v4/locales/da.js
10209
+ // ../../node_modules/zod/v4/locales/da.js
10210
10210
  var error9 = () => {
10211
10211
  const Sizable = {
10212
10212
  string: { unit: "tegn", verb: "havde" },
@@ -10327,7 +10327,7 @@ function da_default() {
10327
10327
  };
10328
10328
  }
10329
10329
 
10330
- // node_modules/zod/v4/locales/de.js
10330
+ // ../../node_modules/zod/v4/locales/de.js
10331
10331
  var error10 = () => {
10332
10332
  const Sizable = {
10333
10333
  string: { unit: "Zeichen", verb: "zu haben" },
@@ -10441,7 +10441,7 @@ function de_default() {
10441
10441
  };
10442
10442
  }
10443
10443
 
10444
- // node_modules/zod/v4/locales/el.js
10444
+ // ../../node_modules/zod/v4/locales/el.js
10445
10445
  var error11 = () => {
10446
10446
  const Sizable = {
10447
10447
  string: { unit: "\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" },
@@ -10554,7 +10554,7 @@ function el_default() {
10554
10554
  };
10555
10555
  }
10556
10556
 
10557
- // node_modules/zod/v4/locales/en.js
10557
+ // ../../node_modules/zod/v4/locales/en.js
10558
10558
  var error12 = () => {
10559
10559
  const Sizable = {
10560
10560
  string: { unit: "characters", verb: "to have" },
@@ -10679,7 +10679,7 @@ function en_default() {
10679
10679
  };
10680
10680
  }
10681
10681
 
10682
- // node_modules/zod/v4/locales/eo.js
10682
+ // ../../node_modules/zod/v4/locales/eo.js
10683
10683
  var error13 = () => {
10684
10684
  const Sizable = {
10685
10685
  string: { unit: "karaktrojn", verb: "havi" },
@@ -10794,7 +10794,7 @@ function eo_default() {
10794
10794
  };
10795
10795
  }
10796
10796
 
10797
- // node_modules/zod/v4/locales/es.js
10797
+ // ../../node_modules/zod/v4/locales/es.js
10798
10798
  var error14 = () => {
10799
10799
  const Sizable = {
10800
10800
  string: { unit: "caracteres", verb: "tener" },
@@ -10931,7 +10931,7 @@ function es_default() {
10931
10931
  };
10932
10932
  }
10933
10933
 
10934
- // node_modules/zod/v4/locales/fa.js
10934
+ // ../../node_modules/zod/v4/locales/fa.js
10935
10935
  var error15 = () => {
10936
10936
  const Sizable = {
10937
10937
  string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
@@ -11051,7 +11051,7 @@ function fa_default() {
11051
11051
  };
11052
11052
  }
11053
11053
 
11054
- // node_modules/zod/v4/locales/fi.js
11054
+ // ../../node_modules/zod/v4/locales/fi.js
11055
11055
  var error16 = () => {
11056
11056
  const Sizable = {
11057
11057
  string: { unit: "merkki\xE4", subject: "merkkijonon" },
@@ -11169,7 +11169,7 @@ function fi_default() {
11169
11169
  };
11170
11170
  }
11171
11171
 
11172
- // node_modules/zod/v4/locales/fr.js
11172
+ // ../../node_modules/zod/v4/locales/fr.js
11173
11173
  var error17 = () => {
11174
11174
  const Sizable = {
11175
11175
  string: { unit: "caract\xE8res", verb: "avoir" },
@@ -11299,7 +11299,7 @@ function fr_default() {
11299
11299
  };
11300
11300
  }
11301
11301
 
11302
- // node_modules/zod/v4/locales/fr-CA.js
11302
+ // ../../node_modules/zod/v4/locales/fr-CA.js
11303
11303
  var error18 = () => {
11304
11304
  const Sizable = {
11305
11305
  string: { unit: "caract\xE8res", verb: "avoir" },
@@ -11412,7 +11412,7 @@ function fr_CA_default() {
11412
11412
  };
11413
11413
  }
11414
11414
 
11415
- // node_modules/zod/v4/locales/gu.js
11415
+ // ../../node_modules/zod/v4/locales/gu.js
11416
11416
  var error19 = () => {
11417
11417
  const Sizable = {
11418
11418
  string: { unit: "\u0A85\u0A95\u0ACD\u0AB7\u0AB0", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" },
@@ -11526,7 +11526,7 @@ function gu_default() {
11526
11526
  };
11527
11527
  }
11528
11528
 
11529
- // node_modules/zod/v4/locales/he.js
11529
+ // ../../node_modules/zod/v4/locales/he.js
11530
11530
  var error20 = () => {
11531
11531
  const TypeNames = {
11532
11532
  string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA", gender: "f" },
@@ -11728,7 +11728,7 @@ function he_default() {
11728
11728
  };
11729
11729
  }
11730
11730
 
11731
- // node_modules/zod/v4/locales/hi.js
11731
+ // ../../node_modules/zod/v4/locales/hi.js
11732
11732
  var error21 = () => {
11733
11733
  const Sizable = {
11734
11734
  string: { unit: "\u0905\u0915\u094D\u0937\u0930", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" },
@@ -11840,7 +11840,7 @@ function hi_default() {
11840
11840
  };
11841
11841
  }
11842
11842
 
11843
- // node_modules/zod/v4/locales/hr.js
11843
+ // ../../node_modules/zod/v4/locales/hr.js
11844
11844
  var error22 = () => {
11845
11845
  const Sizable = {
11846
11846
  string: { unit: "znakova", verb: "imati" },
@@ -11967,7 +11967,7 @@ function hr_default() {
11967
11967
  };
11968
11968
  }
11969
11969
 
11970
- // node_modules/zod/v4/locales/hu.js
11970
+ // ../../node_modules/zod/v4/locales/hu.js
11971
11971
  var error23 = () => {
11972
11972
  const Sizable = {
11973
11973
  string: { unit: "karakter", verb: "legyen" },
@@ -12081,7 +12081,7 @@ function hu_default() {
12081
12081
  };
12082
12082
  }
12083
12083
 
12084
- // node_modules/zod/v4/locales/hy.js
12084
+ // ../../node_modules/zod/v4/locales/hy.js
12085
12085
  function getArmenianPlural(count, one, many) {
12086
12086
  return Math.abs(count) === 1 ? one : many;
12087
12087
  }
@@ -12240,7 +12240,7 @@ function hy_default() {
12240
12240
  };
12241
12241
  }
12242
12242
 
12243
- // node_modules/zod/v4/locales/id.js
12243
+ // ../../node_modules/zod/v4/locales/id.js
12244
12244
  var error25 = () => {
12245
12245
  const Sizable = {
12246
12246
  string: { unit: "karakter", verb: "memiliki" },
@@ -12352,7 +12352,7 @@ function id_default() {
12352
12352
  };
12353
12353
  }
12354
12354
 
12355
- // node_modules/zod/v4/locales/is.js
12355
+ // ../../node_modules/zod/v4/locales/is.js
12356
12356
  var error26 = () => {
12357
12357
  const Sizable = {
12358
12358
  string: { unit: "stafi", verb: "a\xF0 hafa" },
@@ -12467,7 +12467,7 @@ function is_default() {
12467
12467
  };
12468
12468
  }
12469
12469
 
12470
- // node_modules/zod/v4/locales/it.js
12470
+ // ../../node_modules/zod/v4/locales/it.js
12471
12471
  var error27 = () => {
12472
12472
  const Sizable = {
12473
12473
  string: { unit: "caratteri", verb: "avere" },
@@ -12581,7 +12581,7 @@ function it_default() {
12581
12581
  };
12582
12582
  }
12583
12583
 
12584
- // node_modules/zod/v4/locales/ja.js
12584
+ // ../../node_modules/zod/v4/locales/ja.js
12585
12585
  var error28 = () => {
12586
12586
  const Sizable = {
12587
12587
  string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" },
@@ -12694,7 +12694,7 @@ function ja_default() {
12694
12694
  };
12695
12695
  }
12696
12696
 
12697
- // node_modules/zod/v4/locales/ka.js
12697
+ // ../../node_modules/zod/v4/locales/ka.js
12698
12698
  var error29 = () => {
12699
12699
  const Sizable = {
12700
12700
  string: { unit: "\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
@@ -12812,7 +12812,7 @@ function ka_default() {
12812
12812
  };
12813
12813
  }
12814
12814
 
12815
- // node_modules/zod/v4/locales/km.js
12815
+ // ../../node_modules/zod/v4/locales/km.js
12816
12816
  var error30 = () => {
12817
12817
  const Sizable = {
12818
12818
  string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
@@ -12928,12 +12928,12 @@ function km_default() {
12928
12928
  };
12929
12929
  }
12930
12930
 
12931
- // node_modules/zod/v4/locales/kh.js
12931
+ // ../../node_modules/zod/v4/locales/kh.js
12932
12932
  function kh_default() {
12933
12933
  return km_default();
12934
12934
  }
12935
12935
 
12936
- // node_modules/zod/v4/locales/kn.js
12936
+ // ../../node_modules/zod/v4/locales/kn.js
12937
12937
  var error31 = () => {
12938
12938
  const Sizable = {
12939
12939
  string: { unit: "\u0C85\u0C95\u0CCD\u0CB7\u0CB0\u0C97\u0CB3\u0CC1", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" },
@@ -13049,7 +13049,7 @@ function kn_default() {
13049
13049
  };
13050
13050
  }
13051
13051
 
13052
- // node_modules/zod/v4/locales/ko.js
13052
+ // ../../node_modules/zod/v4/locales/ko.js
13053
13053
  var error32 = () => {
13054
13054
  const Sizable = {
13055
13055
  string: { unit: "\uBB38\uC790", verb: "to have" },
@@ -13166,7 +13166,7 @@ function ko_default() {
13166
13166
  };
13167
13167
  }
13168
13168
 
13169
- // node_modules/zod/v4/locales/lt.js
13169
+ // ../../node_modules/zod/v4/locales/lt.js
13170
13170
  var capitalizeFirstCharacter = (text2) => {
13171
13171
  return text2.charAt(0).toUpperCase() + text2.slice(1);
13172
13172
  };
@@ -13374,7 +13374,7 @@ function lt_default() {
13374
13374
  };
13375
13375
  }
13376
13376
 
13377
- // node_modules/zod/v4/locales/mk.js
13377
+ // ../../node_modules/zod/v4/locales/mk.js
13378
13378
  var error34 = () => {
13379
13379
  const Sizable = {
13380
13380
  string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
@@ -13489,7 +13489,7 @@ function mk_default() {
13489
13489
  };
13490
13490
  }
13491
13491
 
13492
- // node_modules/zod/v4/locales/ms.js
13492
+ // ../../node_modules/zod/v4/locales/ms.js
13493
13493
  var error35 = () => {
13494
13494
  const Sizable = {
13495
13495
  string: { unit: "aksara", verb: "mempunyai" },
@@ -13602,7 +13602,7 @@ function ms_default() {
13602
13602
  };
13603
13603
  }
13604
13604
 
13605
- // node_modules/zod/v4/locales/ne.js
13605
+ // ../../node_modules/zod/v4/locales/ne.js
13606
13606
  var error36 = () => {
13607
13607
  const Sizable = {
13608
13608
  string: { unit: "\u0905\u0915\u094D\u0937\u0930", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" },
@@ -13714,7 +13714,7 @@ function ne_default() {
13714
13714
  };
13715
13715
  }
13716
13716
 
13717
- // node_modules/zod/v4/locales/nl.js
13717
+ // ../../node_modules/zod/v4/locales/nl.js
13718
13718
  var error37 = () => {
13719
13719
  const Sizable = {
13720
13720
  string: { unit: "tekens", verb: "heeft" },
@@ -13830,7 +13830,7 @@ function nl_default() {
13830
13830
  };
13831
13831
  }
13832
13832
 
13833
- // node_modules/zod/v4/locales/nn.js
13833
+ // ../../node_modules/zod/v4/locales/nn.js
13834
13834
  var error38 = () => {
13835
13835
  const Sizable = {
13836
13836
  string: { unit: "teikn", verb: "\xE5 ha" },
@@ -13944,7 +13944,7 @@ function nn_default() {
13944
13944
  };
13945
13945
  }
13946
13946
 
13947
- // node_modules/zod/v4/locales/no.js
13947
+ // ../../node_modules/zod/v4/locales/no.js
13948
13948
  var error39 = () => {
13949
13949
  const Sizable = {
13950
13950
  string: { unit: "tegn", verb: "\xE5 ha" },
@@ -14058,7 +14058,7 @@ function no_default() {
14058
14058
  };
14059
14059
  }
14060
14060
 
14061
- // node_modules/zod/v4/locales/ota.js
14061
+ // ../../node_modules/zod/v4/locales/ota.js
14062
14062
  var error40 = () => {
14063
14063
  const Sizable = {
14064
14064
  string: { unit: "harf", verb: "olmal\u0131d\u0131r" },
@@ -14173,7 +14173,7 @@ function ota_default() {
14173
14173
  };
14174
14174
  }
14175
14175
 
14176
- // node_modules/zod/v4/locales/ps.js
14176
+ // ../../node_modules/zod/v4/locales/ps.js
14177
14177
  var error41 = () => {
14178
14178
  const Sizable = {
14179
14179
  string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
@@ -14293,7 +14293,7 @@ function ps_default() {
14293
14293
  };
14294
14294
  }
14295
14295
 
14296
- // node_modules/zod/v4/locales/pl.js
14296
+ // ../../node_modules/zod/v4/locales/pl.js
14297
14297
  var error42 = () => {
14298
14298
  const Sizable = {
14299
14299
  string: { unit: "znak\xF3w", verb: "mie\u0107" },
@@ -14408,7 +14408,7 @@ function pl_default() {
14408
14408
  };
14409
14409
  }
14410
14410
 
14411
- // node_modules/zod/v4/locales/pt.js
14411
+ // ../../node_modules/zod/v4/locales/pt.js
14412
14412
  var error43 = () => {
14413
14413
  const Sizable = {
14414
14414
  string: { unit: "caracteres" },
@@ -14552,7 +14552,7 @@ function pt_default() {
14552
14552
  };
14553
14553
  }
14554
14554
 
14555
- // node_modules/zod/v4/locales/pt-BR.js
14555
+ // ../../node_modules/zod/v4/locales/pt-BR.js
14556
14556
  var error44 = () => {
14557
14557
  const Sizable = {
14558
14558
  string: { unit: "caracteres" },
@@ -14697,7 +14697,7 @@ function pt_BR_default() {
14697
14697
  };
14698
14698
  }
14699
14699
 
14700
- // node_modules/zod/v4/locales/ro.js
14700
+ // ../../node_modules/zod/v4/locales/ro.js
14701
14701
  var error45 = () => {
14702
14702
  const Sizable = {
14703
14703
  string: { unit: "caractere", verb: "s\u0103 aib\u0103" },
@@ -14820,7 +14820,7 @@ function ro_default() {
14820
14820
  };
14821
14821
  }
14822
14822
 
14823
- // node_modules/zod/v4/locales/ru.js
14823
+ // ../../node_modules/zod/v4/locales/ru.js
14824
14824
  function getRussianPlural(count, one, few, many) {
14825
14825
  const absCount = Math.abs(count);
14826
14826
  const lastDigit = absCount % 10;
@@ -14989,7 +14989,7 @@ function ru_default() {
14989
14989
  };
14990
14990
  }
14991
14991
 
14992
- // node_modules/zod/v4/locales/sk.js
14992
+ // ../../node_modules/zod/v4/locales/sk.js
14993
14993
  var error47 = () => {
14994
14994
  const Sizable = {
14995
14995
  string: { unit: "znakov", verb: "ma\u0165" },
@@ -15106,7 +15106,7 @@ function sk_default() {
15106
15106
  };
15107
15107
  }
15108
15108
 
15109
- // node_modules/zod/v4/locales/sl.js
15109
+ // ../../node_modules/zod/v4/locales/sl.js
15110
15110
  var error48 = () => {
15111
15111
  const Sizable = {
15112
15112
  string: { unit: "znakov", verb: "imeti" },
@@ -15221,7 +15221,7 @@ function sl_default() {
15221
15221
  };
15222
15222
  }
15223
15223
 
15224
- // node_modules/zod/v4/locales/sv.js
15224
+ // ../../node_modules/zod/v4/locales/sv.js
15225
15225
  var error49 = () => {
15226
15226
  const Sizable = {
15227
15227
  string: { unit: "tecken", verb: "att ha" },
@@ -15337,7 +15337,7 @@ function sv_default() {
15337
15337
  };
15338
15338
  }
15339
15339
 
15340
- // node_modules/zod/v4/locales/ta.js
15340
+ // ../../node_modules/zod/v4/locales/ta.js
15341
15341
  var error50 = () => {
15342
15342
  const Sizable = {
15343
15343
  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" },
@@ -15453,7 +15453,7 @@ function ta_default() {
15453
15453
  };
15454
15454
  }
15455
15455
 
15456
- // node_modules/zod/v4/locales/tg.js
15456
+ // ../../node_modules/zod/v4/locales/tg.js
15457
15457
  var error51 = () => {
15458
15458
  const Sizable = {
15459
15459
  string: { unit: "\u0430\u043B\u043E\u043C\u0430\u0442", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" },
@@ -15570,7 +15570,7 @@ function tg_default() {
15570
15570
  };
15571
15571
  }
15572
15572
 
15573
- // node_modules/zod/v4/locales/th.js
15573
+ // ../../node_modules/zod/v4/locales/th.js
15574
15574
  var error52 = () => {
15575
15575
  const Sizable = {
15576
15576
  string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
@@ -15686,7 +15686,7 @@ function th_default() {
15686
15686
  };
15687
15687
  }
15688
15688
 
15689
- // node_modules/zod/v4/locales/tk.js
15689
+ // ../../node_modules/zod/v4/locales/tk.js
15690
15690
  var error53 = () => {
15691
15691
  const Sizable = {
15692
15692
  string: { unit: "simwol", verb: "bolmaly" },
@@ -15794,7 +15794,7 @@ function tk_default() {
15794
15794
  };
15795
15795
  }
15796
15796
 
15797
- // node_modules/zod/v4/locales/tr.js
15797
+ // ../../node_modules/zod/v4/locales/tr.js
15798
15798
  var error54 = () => {
15799
15799
  const Sizable = {
15800
15800
  string: { unit: "karakter", verb: "olmal\u0131" },
@@ -15905,7 +15905,7 @@ function tr_default() {
15905
15905
  };
15906
15906
  }
15907
15907
 
15908
- // node_modules/zod/v4/locales/uk.js
15908
+ // ../../node_modules/zod/v4/locales/uk.js
15909
15909
  var error55 = () => {
15910
15910
  const Sizable = {
15911
15911
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
@@ -16019,12 +16019,12 @@ function uk_default() {
16019
16019
  };
16020
16020
  }
16021
16021
 
16022
- // node_modules/zod/v4/locales/ua.js
16022
+ // ../../node_modules/zod/v4/locales/ua.js
16023
16023
  function ua_default() {
16024
16024
  return uk_default();
16025
16025
  }
16026
16026
 
16027
- // node_modules/zod/v4/locales/ur.js
16027
+ // ../../node_modules/zod/v4/locales/ur.js
16028
16028
  var error56 = () => {
16029
16029
  const Sizable = {
16030
16030
  string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
@@ -16140,7 +16140,7 @@ function ur_default() {
16140
16140
  };
16141
16141
  }
16142
16142
 
16143
- // node_modules/zod/v4/locales/uz.js
16143
+ // ../../node_modules/zod/v4/locales/uz.js
16144
16144
  var error57 = () => {
16145
16145
  const Sizable = {
16146
16146
  string: { unit: "belgi", verb: "bo\u2018lishi kerak" },
@@ -16254,7 +16254,7 @@ function uz_default() {
16254
16254
  };
16255
16255
  }
16256
16256
 
16257
- // node_modules/zod/v4/locales/vi.js
16257
+ // ../../node_modules/zod/v4/locales/vi.js
16258
16258
  var error58 = () => {
16259
16259
  const Sizable = {
16260
16260
  string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
@@ -16368,7 +16368,7 @@ function vi_default() {
16368
16368
  };
16369
16369
  }
16370
16370
 
16371
- // node_modules/zod/v4/locales/zh-CN.js
16371
+ // ../../node_modules/zod/v4/locales/zh-CN.js
16372
16372
  var error59 = () => {
16373
16373
  const Sizable = {
16374
16374
  string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
@@ -16483,7 +16483,7 @@ function zh_CN_default() {
16483
16483
  };
16484
16484
  }
16485
16485
 
16486
- // node_modules/zod/v4/locales/zh-TW.js
16486
+ // ../../node_modules/zod/v4/locales/zh-TW.js
16487
16487
  var error60 = () => {
16488
16488
  const Sizable = {
16489
16489
  string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
@@ -16596,7 +16596,7 @@ function zh_TW_default() {
16596
16596
  };
16597
16597
  }
16598
16598
 
16599
- // node_modules/zod/v4/locales/yo.js
16599
+ // ../../node_modules/zod/v4/locales/yo.js
16600
16600
  var error61 = () => {
16601
16601
  const Sizable = {
16602
16602
  string: { unit: "\xE0mi", verb: "n\xED" },
@@ -16709,7 +16709,7 @@ function yo_default() {
16709
16709
  };
16710
16710
  }
16711
16711
 
16712
- // node_modules/zod/v4/core/registries.js
16712
+ // ../../node_modules/zod/v4/core/registries.js
16713
16713
  var _a2;
16714
16714
  var $output = /* @__PURE__ */ Symbol("ZodOutput");
16715
16715
  var $input = /* @__PURE__ */ Symbol("ZodInput");
@@ -16759,7 +16759,7 @@ function registry() {
16759
16759
  (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
16760
16760
  var globalRegistry = globalThis.__zod_globalRegistry;
16761
16761
 
16762
- // node_modules/zod/v4/core/compile.js
16762
+ // ../../node_modules/zod/v4/core/compile.js
16763
16763
  var INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
16764
16764
  var FALLBACK_FLAG = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
16765
16765
  var ZodCompileAsyncError = class extends Error {
@@ -18361,7 +18361,7 @@ function generateTransformCheck(doc, ctx, schema, accessor) {
18361
18361
  return accessor;
18362
18362
  }
18363
18363
 
18364
- // node_modules/zod/v4/core/api.js
18364
+ // ../../node_modules/zod/v4/core/api.js
18365
18365
  function snapshotChecks(def) {
18366
18366
  if (def.checks)
18367
18367
  def.checks = [...def.checks];
@@ -19420,7 +19420,7 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
19420
19420
  return inst;
19421
19421
  }
19422
19422
 
19423
- // node_modules/zod/v4/core/to-json-schema.js
19423
+ // ../../node_modules/zod/v4/core/to-json-schema.js
19424
19424
  function assignProps(target, ...sources) {
19425
19425
  for (const source of sources) {
19426
19426
  for (const key of Reflect.ownKeys(source)) {
@@ -19950,7 +19950,7 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
19950
19950
  return finalize(ctx, schema);
19951
19951
  };
19952
19952
 
19953
- // node_modules/zod/v4/core/json-schema-processors.js
19953
+ // ../../node_modules/zod/v4/core/json-schema-processors.js
19954
19954
  var narrowMin = (agg, key, value) => {
19955
19955
  if (agg[key] === void 0 || value > agg[key])
19956
19956
  agg[key] = value;
@@ -20698,7 +20698,7 @@ function toJSONSchema(input2, params) {
20698
20698
  return finalize(ctx, input2);
20699
20699
  }
20700
20700
 
20701
- // node_modules/zod/v4/core/json-schema-generator.js
20701
+ // ../../node_modules/zod/v4/core/json-schema-generator.js
20702
20702
  var JSONSchemaGenerator = class {
20703
20703
  /** @deprecated Access via ctx instead */
20704
20704
  get metadataRegistry() {
@@ -20776,10 +20776,10 @@ var JSONSchemaGenerator = class {
20776
20776
  }
20777
20777
  };
20778
20778
 
20779
- // node_modules/zod/v4/core/json-schema.js
20779
+ // ../../node_modules/zod/v4/core/json-schema.js
20780
20780
  var json_schema_exports = {};
20781
20781
 
20782
- // node_modules/zod/v4/classic/schemas.js
20782
+ // ../../node_modules/zod/v4/classic/schemas.js
20783
20783
  var schemas_exports2 = {};
20784
20784
  __export(schemas_exports2, {
20785
20785
  ZodAny: () => ZodAny,
@@ -20960,7 +20960,7 @@ __export(schemas_exports2, {
20960
20960
  xor: () => xor
20961
20961
  });
20962
20962
 
20963
- // node_modules/zod/v4/classic/checks.js
20963
+ // ../../node_modules/zod/v4/classic/checks.js
20964
20964
  var checks_exports2 = {};
20965
20965
  __export(checks_exports2, {
20966
20966
  endsWith: () => _endsWith,
@@ -20995,7 +20995,7 @@ __export(checks_exports2, {
20995
20995
  uppercase: () => _uppercase
20996
20996
  });
20997
20997
 
20998
- // node_modules/zod/v4/classic/errors.js
20998
+ // ../../node_modules/zod/v4/classic/errors.js
20999
20999
  var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
21000
21000
  function _lazyMethod(proto, key, make) {
21001
21001
  Object.defineProperty(proto, key, {
@@ -21041,7 +21041,7 @@ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, void 0
21041
21041
  Parent: Error
21042
21042
  });
21043
21043
 
21044
- // node_modules/zod/v4/classic/parse.js
21044
+ // ../../node_modules/zod/v4/classic/parse.js
21045
21045
  var parse2 = /* @__PURE__ */ _parse(ZodRealError);
21046
21046
  var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
21047
21047
  var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -21055,7 +21055,7 @@ var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
21055
21055
  var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
21056
21056
  var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
21057
21057
 
21058
- // node_modules/zod/v4/classic/schemas.js
21058
+ // ../../node_modules/zod/v4/classic/schemas.js
21059
21059
  function _ensureDefaultLocale() {
21060
21060
  if (!globalConfig.localeError)
21061
21061
  config(en_default());
@@ -22520,7 +22520,7 @@ function preprocess(fn, schema) {
22520
22520
  });
22521
22521
  }
22522
22522
 
22523
- // node_modules/zod/v4/classic/compat.js
22523
+ // ../../node_modules/zod/v4/classic/compat.js
22524
22524
  var ZodIssueCode = {
22525
22525
  invalid_type: "invalid_type",
22526
22526
  too_big: "too_big",
@@ -22546,7 +22546,7 @@ var ZodFirstPartyTypeKind;
22546
22546
  /* @__PURE__ */ (function(ZodFirstPartyTypeKind2) {
22547
22547
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
22548
22548
 
22549
- // node_modules/zod/v4/classic/iso.js
22549
+ // ../../node_modules/zod/v4/classic/iso.js
22550
22550
  var iso_exports = {};
22551
22551
  __export(iso_exports, {
22552
22552
  ZodISODate: () => ZodISODate,
@@ -22571,7 +22571,7 @@ function duration2(params) {
22571
22571
  return _isoDuration(ZodISODuration, params);
22572
22572
  }
22573
22573
 
22574
- // node_modules/zod/v4/classic/from-json-schema.js
22574
+ // ../../node_modules/zod/v4/classic/from-json-schema.js
22575
22575
  var z = {
22576
22576
  ...schemas_exports2,
22577
22577
  ...checks_exports2,
@@ -22671,13 +22671,13 @@ function resolveRef(ref, ctx) {
22671
22671
  if (!ref.startsWith("#")) {
22672
22672
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
22673
22673
  }
22674
- const path13 = ref.slice(1).split("/").filter(Boolean);
22675
- if (path13.length === 0) {
22674
+ const path15 = ref.slice(1).split("/").filter(Boolean);
22675
+ if (path15.length === 0) {
22676
22676
  return ctx.rootSchema;
22677
22677
  }
22678
22678
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
22679
- if (path13[0] === defsKey) {
22680
- const key = path13[1] === void 0 ? void 0 : decodeJSONPointerSegment(path13[1]);
22679
+ if (path15[0] === defsKey) {
22680
+ const key = path15[1] === void 0 ? void 0 : decodeJSONPointerSegment(path15[1]);
22681
22681
  if (!key || !ctx.defs[key]) {
22682
22682
  throw new Error(`Reference not found: ${ref}`);
22683
22683
  }
@@ -23304,7 +23304,7 @@ function fromJSONSchema(schema, params) {
23304
23304
  return convertSchema(normalized, ctx);
23305
23305
  }
23306
23306
 
23307
- // node_modules/zod/v4/core/visit.js
23307
+ // ../../node_modules/zod/v4/core/visit.js
23308
23308
  var RESOLVING = /* @__PURE__ */ Symbol("z.visit/resolving");
23309
23309
  function visit(schema, fnOrHandlers) {
23310
23310
  const fn = typeof fnOrHandlers === "function" ? fnOrHandlers : (node2, rewritten) => {
@@ -23459,7 +23459,7 @@ function visit(schema, fnOrHandlers) {
23459
23459
  return run(schema);
23460
23460
  }
23461
23461
 
23462
- // node_modules/zod/v4/classic/deep-partial.js
23462
+ // ../../node_modules/zod/v4/classic/deep-partial.js
23463
23463
  function deepPartial(schema) {
23464
23464
  return visit(schema, {
23465
23465
  object: (s) => s.partial(),
@@ -23471,7 +23471,7 @@ function deepPartial(schema) {
23471
23471
  });
23472
23472
  }
23473
23473
 
23474
- // node_modules/zod/v4/classic/in-out.js
23474
+ // ../../node_modules/zod/v4/classic/in-out.js
23475
23475
  function withChecks(side, checks) {
23476
23476
  if (!checks?.length)
23477
23477
  return side;
@@ -23501,7 +23501,7 @@ function output(schema) {
23501
23501
  });
23502
23502
  }
23503
23503
 
23504
- // node_modules/zod/v4/classic/coerce.js
23504
+ // ../../node_modules/zod/v4/classic/coerce.js
23505
23505
  var coerce_exports = {};
23506
23506
  __export(coerce_exports, {
23507
23507
  bigint: () => bigint3,
@@ -23529,7 +23529,7 @@ function date4(params) {
23529
23529
  // agent/src/guard-evidence.ts
23530
23530
  import { createHash as createHash2, createPublicKey as createPublicKey2, KeyObject } from "node:crypto";
23531
23531
 
23532
- // node_modules/jose/dist/webapi/lib/buffer_utils.js
23532
+ // ../../node_modules/jose/dist/webapi/lib/buffer_utils.js
23533
23533
  var encoder = new TextEncoder();
23534
23534
  var decoder = new TextDecoder();
23535
23535
  var strictDecoder = new TextDecoder("utf-8", { fatal: true });
@@ -23580,7 +23580,7 @@ function decodeBase64(encoded, url2 = false) {
23580
23580
  return bytes3;
23581
23581
  }
23582
23582
 
23583
- // node_modules/jose/dist/webapi/util/errors.js
23583
+ // ../../node_modules/jose/dist/webapi/util/errors.js
23584
23584
  var JOSEError = class extends Error {
23585
23585
  static code = "ERR_JOSE_GENERIC";
23586
23586
  code = "ERR_JOSE_GENERIC";
@@ -23608,7 +23608,7 @@ var JWSSignatureVerificationFailed = class extends JOSEError {
23608
23608
  }
23609
23609
  };
23610
23610
 
23611
- // node_modules/jose/dist/webapi/util/base64url.js
23611
+ // ../../node_modules/jose/dist/webapi/util/base64url.js
23612
23612
  var invalid = "The input to be decoded is not correctly encoded.";
23613
23613
  function decode3(input2) {
23614
23614
  try {
@@ -23621,7 +23621,7 @@ function encode4(input2) {
23621
23621
  return encodeBase64(typeof input2 == "string" ? encoder.encode(input2) : input2, true);
23622
23622
  }
23623
23623
 
23624
- // node_modules/jose/dist/webapi/lib/validate.js
23624
+ // ../../node_modules/jose/dist/webapi/lib/validate.js
23625
23625
  function assertUint8Array(input2, label) {
23626
23626
  if (!(input2 instanceof Uint8Array))
23627
23627
  throw new TypeError(`${label} must be an instance of Uint8Array`);
@@ -23722,7 +23722,7 @@ function serializeJoseHeader(Err, header) {
23722
23722
  return [parsed, serialized];
23723
23723
  }
23724
23724
 
23725
- // node_modules/jose/dist/webapi/lib/key.js
23725
+ // ../../node_modules/jose/dist/webapi/lib/key.js
23726
23726
  var tag = (key) => key[Symbol.toStringTag];
23727
23727
  var jwkMatchesOp = (entry, key, usage) => {
23728
23728
  const { alg } = entry;
@@ -23853,7 +23853,7 @@ async function rawKey(key, expected, usage, extractable = false) {
23853
23853
  return key instanceof Uint8Array && (key = await crypto.subtle.importKey("raw", key, expected, extractable, [usage])), checkCryptoKey(key, expected, usage), key;
23854
23854
  }
23855
23855
 
23856
- // node_modules/jose/dist/webapi/lib/key_descriptor.js
23856
+ // ../../node_modules/jose/dist/webapi/lib/key_descriptor.js
23857
23857
  function table(entries) {
23858
23858
  const out = { __proto__: null };
23859
23859
  for (const alg in entries)
@@ -23861,7 +23861,7 @@ function table(entries) {
23861
23861
  return out;
23862
23862
  }
23863
23863
 
23864
- // node_modules/jose/dist/webapi/lib/jws_algorithms.js
23864
+ // ../../node_modules/jose/dist/webapi/lib/jws_algorithms.js
23865
23865
  var sig = [["verify"], ["sign"]];
23866
23866
  function hmac(bits) {
23867
23867
  const subtle = { name: "HMAC", hash: `SHA-${bits}` };
@@ -23931,7 +23931,7 @@ function jwsAlgorithm(alg) {
23931
23931
  return entry;
23932
23932
  }
23933
23933
 
23934
- // node_modules/jose/dist/webapi/lib/jws_verify.js
23934
+ // ../../node_modules/jose/dist/webapi/lib/jws_verify.js
23935
23935
  function prepareVerify(options) {
23936
23936
  return [options && validateAlgorithms("algorithms", options.algorithms), options?.crit];
23937
23937
  }
@@ -23983,13 +23983,13 @@ async function verifyCompact(jws, shared, key) {
23983
23983
  return verifySignature({ payload, protected: protectedHeader, signature }, shared, key, encodeCompactUnencodedPayload);
23984
23984
  }
23985
23985
 
23986
- // node_modules/jose/dist/webapi/jws/compact/verify.js
23986
+ // ../../node_modules/jose/dist/webapi/jws/compact/verify.js
23987
23987
  async function compactVerify(jws, key, options) {
23988
23988
  const [result2] = await verifyCompact(jws, prepareVerify(options), key);
23989
23989
  return result2;
23990
23990
  }
23991
23991
 
23992
- // node_modules/jose/dist/webapi/lib/jws_sign.js
23992
+ // ../../node_modules/jose/dist/webapi/lib/jws_sign.js
23993
23993
  async function createSignature(input2, key, rejectUnencoded) {
23994
23994
  let [payload, protectedHeader, unprotectedHeader, crit] = input2, protectedHeaderString = "";
23995
23995
  if (protectedHeader !== void 0) {
@@ -24027,7 +24027,7 @@ async function createCompactSignature(payload, protectedHeader, crit, key, rejec
24027
24027
  return `${jws.protected}.${jws.payload}.${jws.signature}`;
24028
24028
  }
24029
24029
 
24030
- // node_modules/jose/dist/webapi/jws/compact/sign.js
24030
+ // ../../node_modules/jose/dist/webapi/jws/compact/sign.js
24031
24031
  var CompactSign = class {
24032
24032
  #payload;
24033
24033
  #protectedHeader;
@@ -25288,12 +25288,21 @@ async function planPermissionChange(current2, programs, input2) {
25288
25288
  workspace.permissions.writeFiles = change.enabled;
25289
25289
  detail = "File writes: " + (change.enabled ? "ALLOW" : "DENY");
25290
25290
  } else if (change.kind === "localhost") {
25291
+ if (workspace.fullAccess) {
25292
+ workspace.deniedLocalhostPorts = change.enabled ? (workspace.deniedLocalhostPorts ?? []).filter((port) => port !== change.port) : [.../* @__PURE__ */ new Set([...workspace.deniedLocalhostPorts ?? [], change.port])];
25293
+ if (workspace.deniedLocalhostPorts.length > 32) invalid2("PERMISSION_LIMIT");
25294
+ }
25291
25295
  workspace.localhostPorts = change.enabled ? [.../* @__PURE__ */ new Set([...workspace.localhostPorts, change.port])].sort((a, b) => a - b) : workspace.localhostPorts.filter((port) => port !== change.port);
25292
25296
  if (workspace.localhostPorts.length > 32) invalid2("PERMISSION_LIMIT");
25293
- workspace.permissions.localhost = workspace.localhostPorts.length > 0;
25297
+ workspace.permissions.localhost = workspace.fullAccess === true || workspace.localhostPorts.length > 0;
25294
25298
  resource = { rootHash: workspace.rootHash, kind: change.kind, port: change.port };
25295
25299
  detail = "Localhost port " + change.port + ": " + (change.enabled ? "ALLOW" : "DENY");
25296
25300
  } else {
25301
+ if (workspace.fullAccess) {
25302
+ const key = change.name.replace(/\.(exe|com|cmd|bat)$/i, "");
25303
+ workspace.deniedCommands = change.enabled ? (workspace.deniedCommands ?? []).filter((name2) => name2.replace(/\.(exe|com|cmd|bat)$/i, "") !== key) : [.../* @__PURE__ */ new Set([...workspace.deniedCommands ?? [], change.name])];
25304
+ if (workspace.deniedCommands.length > 32) invalid2("PERMISSION_LIMIT");
25305
+ }
25297
25306
  let executableIdentity = null;
25298
25307
  if (change.enabled) {
25299
25308
  const executable = change.executable;
@@ -25307,7 +25316,7 @@ async function planPermissionChange(current2, programs, input2) {
25307
25316
  if (workspace.allowedCommands.length > 32 || Object.keys(nextPrograms).length > 32) invalid2("PERMISSION_LIMIT");
25308
25317
  executableIdentity = { executable: canonical2, dev: stat.dev, ino: stat.ino, size: stat.size, mtimeMs: stat.mtimeMs, ctimeMs: stat.ctimeMs };
25309
25318
  } else workspace.allowedCommands = workspace.allowedCommands.filter((value) => value !== change.name);
25310
- workspace.permissions.executeCommands = workspace.allowedCommands.length > 0;
25319
+ workspace.permissions.executeCommands = workspace.fullAccess === true || workspace.allowedCommands.length > 0;
25311
25320
  resource = { rootHash: workspace.rootHash, kind: change.kind, name: change.name, executable: nextPrograms[change.name] ?? null, executableIdentity };
25312
25321
  detail = "Command " + permissionLabel(change.name) + ": " + (change.enabled ? "ALLOW" : "DENY") + "\nExact executable: " + permissionLabel(nextPrograms[change.name] ?? "not registered") + nonAsciiNotice(nextPrograms[change.name]) + "\nA permitted program can access resources available to your Windows account, including outside this folder. This is not an OS sandbox.";
25313
25322
  }
@@ -25679,9 +25688,12 @@ function validateState(value) {
25679
25688
  const pendingWorkspaceRevokes = value.pendingWorkspaceRevokes ?? [];
25680
25689
  if (!Array.isArray(pendingWorkspaceRevokes) || pendingWorkspaceRevokes.length > 32 || pendingWorkspaceRevokes.some((id) => typeof id !== "string" || !UUID.test(id) || id !== id.toLowerCase()) || new Set(pendingWorkspaceRevokes).size !== pendingWorkspaceRevokes.length) throw fail("STATE_CORRUPT");
25681
25690
  if (!programs || typeof programs !== "object" || Array.isArray(programs) || Object.keys(programs).length > 32 || Object.entries(programs).some(([name2, executable]) => !/^[a-z0-9_.-]{1,64}$/.test(name2) || typeof executable !== "string" || !path5.isAbsolute(executable) || executable.length > 4096 || /[\u0000-\u001f]/.test(executable))) throw fail("STATE_CORRUPT");
25682
- if (!Array.isArray(workspaces) || workspaces.length > 32 || workspaces.some((w) => !w || !UUID.test(w.workspaceGrantId) || typeof w.root !== "string" || !path5.isAbsolute(w.root) || w.root.length > 4096 || /[\u0000-\u001f]/.test(w.root) || !/^[a-f0-9]{64}$/.test(w.rootHash) || typeof w.displayName !== "string" || !w.displayName || w.displayName.length > 120 || w.policyVersion !== 1 || !w.permissions || w.permissions.readFiles !== true || typeof w.permissions.writeFiles !== "boolean" || typeof w.permissions.executeCommands !== "boolean" || typeof w.permissions.localhost !== "boolean" || !Array.isArray(w.allowedCommands) || w.allowedCommands.length > 32 || w.allowedCommands.some((name2) => typeof name2 !== "string" || !Object.hasOwn(programs, name2)) || new Set(w.allowedCommands).size !== w.allowedCommands.length || w.permissions.executeCommands !== w.allowedCommands.length > 0 || !Array.isArray(w.localhostPorts) || w.localhostPorts.length > 32 || w.localhostPorts.some((port) => !Number.isInteger(port) || port < 1 || port > 65535) || new Set(w.localhostPorts).size !== w.localhostPorts.length || w.permissions.localhost !== w.localhostPorts.length > 0)) throw fail("STATE_CORRUPT");
25691
+ if (!Array.isArray(workspaces) || workspaces.length > 32 || workspaces.some((w) => !w || !UUID.test(w.workspaceGrantId) || typeof w.root !== "string" || !path5.isAbsolute(w.root) || w.root.length > 4096 || /[\u0000-\u001f]/.test(w.root) || !/^[a-f0-9]{64}$/.test(w.rootHash) || typeof w.displayName !== "string" || !w.displayName || w.displayName.length > 120 || w.policyVersion !== 1 || !w.permissions || w.permissions.readFiles !== true || typeof w.permissions.writeFiles !== "boolean" || typeof w.permissions.executeCommands !== "boolean" || typeof w.permissions.localhost !== "boolean" || !Array.isArray(w.allowedCommands) || w.allowedCommands.length > 32 || w.allowedCommands.some((name2) => typeof name2 !== "string" || !Object.hasOwn(programs, name2)) || new Set(w.allowedCommands).size !== w.allowedCommands.length || w.permissions.executeCommands !== (w.fullAccess === true || w.allowedCommands.length > 0) || !Array.isArray(w.localhostPorts) || w.localhostPorts.length > 32 || w.localhostPorts.some((port) => !Number.isInteger(port) || port < 1 || port > 65535) || new Set(w.localhostPorts).size !== w.localhostPorts.length || w.permissions.localhost !== (w.fullAccess === true || w.localhostPorts.length > 0))) throw fail("STATE_CORRUPT");
25683
25692
  if (new Set(workspaces.map((w) => w.workspaceGrantId)).size !== workspaces.length || new Set(workspaces.map((w) => w.rootHash)).size !== workspaces.length) throw fail("STATE_CORRUPT");
25684
25693
  if (workspaces.some((w) => pendingWorkspaceRevokes.includes(w.workspaceGrantId))) throw fail("STATE_CORRUPT");
25694
+ for (const w of workspaces) {
25695
+ if (w.fullAccess !== void 0 && w.fullAccess !== true || w.deniedCommands !== void 0 && (!w.fullAccess || !Array.isArray(w.deniedCommands) || w.deniedCommands.length > 32 || w.deniedCommands.some((name2) => typeof name2 !== "string" || !/^[a-z0-9_.-]{1,64}$/.test(name2))) || w.deniedLocalhostPorts !== void 0 && (!w.fullAccess || !Array.isArray(w.deniedLocalhostPorts) || w.deniedLocalhostPorts.length > 32 || w.deniedLocalhostPorts.some((port) => !Number.isInteger(port) || port < 1 || port > 65535))) throw fail("STATE_CORRUPT");
25696
+ }
25685
25697
  return { version: 1, publicKeyPem: value.publicKeyPem, privateKeyPem: value.privateKeyPem, fingerprint: value.fingerprint, dataKey: value.dataKey, ...enrollment ? { enrollment } : {}, workspaces, programs, pendingWorkspaceRevokes, ...value.permissionHistory ? { permissionHistory: permissionHistory.data } : {}, ...policyBundle ? { policyBundle } : {}, ...approvals?.success ? { approvals: approvals.data } : {}, ...value.guardRequired ? { guardRequired: true } : {}, ...guard ? { guard } : {} };
25686
25698
  }
25687
25699
  async function noSymlinkChain(target) {
@@ -25752,9 +25764,23 @@ var WindowsPrivateStore = class _WindowsPrivateStore {
25752
25764
  } catch (error62) {
25753
25765
  if (error62.code !== "ENOENT") throw error62;
25754
25766
  }
25755
- const approved = /* @__PURE__ */ new Set([MARKER, "owner-state.dat", "owner-state.lock", "journal"]);
25767
+ const approved = /* @__PURE__ */ new Set([MARKER, "owner-state.dat", "owner-state.lock", "journal", "agent-process.json", "optimization"]);
25756
25768
  if (names.length && !names.includes(MARKER)) throw fail("STORE_DIRECTORY_UNKNOWN");
25757
25769
  if (names.some((name2) => !approved.has(name2))) throw fail("STORE_DIRECTORY_UNKNOWN");
25770
+ for (const name2 of ["agent-process.json", "optimization"]) {
25771
+ if (!names.includes(name2)) continue;
25772
+ const filename = path5.join(absolute2, name2), stat = await lstat3(filename);
25773
+ if (stat.isSymbolicLink() || (name2 === "optimization" ? !stat.isDirectory() : !stat.isFile() || stat.size < 1 || stat.size > 8192)) throw fail("STORE_DIRECTORY_INVALID");
25774
+ if (name2 === "agent-process.json") {
25775
+ let value;
25776
+ try {
25777
+ value = JSON.parse(await readFile2(filename, "utf8"));
25778
+ } catch {
25779
+ throw fail("STORE_DIRECTORY_INVALID");
25780
+ }
25781
+ if (!value || !Number.isSafeInteger(value.pid) || value.pid <= 0 || typeof value.runtimeDir !== "string" || !path5.isAbsolute(value.runtimeDir) || value.runtimeDir.length > 4096 || /[\u0000-\u001f]/.test(value.runtimeDir) || typeof value.version !== "string" || !/^[0-9]+\.[0-9]+\.[0-9]+(?:[-+][A-Za-z0-9.-]+)?$/.test(value.version) || typeof value.startedAt !== "string" || !Number.isFinite(Date.parse(value.startedAt))) throw fail("STORE_DIRECTORY_INVALID");
25782
+ }
25783
+ }
25758
25784
  await _WindowsPrivateStore.invoke(bridge, "init-directory", { path: absolute2 }, 5e3, false);
25759
25785
  const canonical2 = await realpath3(absolute2);
25760
25786
  if (!equalPath2(absolute2, canonical2) || (await lstat3(canonical2)).isSymbolicLink()) throw fail("STORE_DIRECTORY_INVALID");
@@ -26140,7 +26166,7 @@ var WindowsPrivateStore = class _WindowsPrivateStore {
26140
26166
  return this.run(async () => {
26141
26167
  const state = await this.readState();
26142
26168
  if (guardActive === false && state?.guardRequired) throw fail("GUARD_RESTART_REQUIRED");
26143
- return [...state?.workspaces ?? []].map((w) => ({ ...w, permissions: { ...w.permissions }, allowedCommands: [...w.allowedCommands], localhostPorts: [...w.localhostPorts] }));
26169
+ return structuredClone(state?.workspaces ?? []);
26144
26170
  });
26145
26171
  }
26146
26172
  loadPrograms() {
@@ -26164,7 +26190,7 @@ var WindowsPrivateStore = class _WindowsPrivateStore {
26164
26190
  const before = await this.rawHash();
26165
26191
  state.workspaces = state.workspaces.filter((w) => w.workspaceGrantId !== id);
26166
26192
  state.pendingWorkspaceRevokes = [...state.pendingWorkspaceRevokes ?? [], id];
26167
- for (const name2 of Object.keys(state.programs ?? {})) if (!state.workspaces.some((w) => w.allowedCommands.includes(name2))) delete state.programs[name2];
26193
+ for (const name2 of Object.keys(state.programs ?? {})) if (!state.workspaces.some((w) => w.allowedCommands.includes(name2) || w.deniedCommands?.includes(name2))) delete state.programs[name2];
26168
26194
  await this.writeState(state, before);
26169
26195
  }));
26170
26196
  }
@@ -26206,7 +26232,7 @@ var WindowsPrivateStore = class _WindowsPrivateStore {
26206
26232
  const before = await this.rawHash();
26207
26233
  state.workspaces = state.workspaces.map((w) => w.workspaceGrantId === verified.workspace.workspaceGrantId ? verified.workspace : w);
26208
26234
  state.programs = verified.programs;
26209
- for (const name2 of Object.keys(state.programs)) if (!state.workspaces.some((w) => w.allowedCommands.includes(name2))) delete state.programs[name2];
26235
+ for (const name2 of Object.keys(state.programs)) if (!state.workspaces.some((w) => w.allowedCommands.includes(name2) || w.deniedCommands?.includes(name2))) delete state.programs[name2];
26210
26236
  const record2 = {
26211
26237
  id: randomUUID3(),
26212
26238
  changedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -26253,7 +26279,8 @@ var WindowsPrivateStore = class _WindowsPrivateStore {
26253
26279
  rootHash,
26254
26280
  displayName: (path5.basename(root) || root).slice(0, 120),
26255
26281
  policyVersion: 1,
26256
- permissions: { readFiles: true, writeFiles: true, executeCommands: false, localhost: false },
26282
+ ...selected.mode === "all-drives" ? { fullAccess: true } : {},
26283
+ permissions: { readFiles: true, writeFiles: true, executeCommands: selected.mode === "all-drives", localhost: selected.mode === "all-drives" },
26257
26284
  allowedCommands: [],
26258
26285
  localhostPorts: []
26259
26286
  };
@@ -26309,7 +26336,7 @@ var WindowsPrivateStore = class _WindowsPrivateStore {
26309
26336
  // agent/src/tools.ts
26310
26337
  import { constants as constants3 } from "node:fs";
26311
26338
  import { lstat as lstat5, open as open4, readdir as readdir3, realpath as realpath5, rename as rename3, rm as rm3 } from "node:fs/promises";
26312
- import path9 from "node:path";
26339
+ import path10 from "node:path";
26313
26340
  import { createHash as createHash9, randomUUID as randomUUID4 } from "node:crypto";
26314
26341
 
26315
26342
  // src/guard.ts
@@ -26553,11 +26580,31 @@ function invokeRead(bridge, file2, maxBytes, prefix, signal) {
26553
26580
  });
26554
26581
  }
26555
26582
 
26583
+ // src/process.ts
26584
+ import { statSync } from "node:fs";
26585
+ import path8 from "node:path";
26586
+ var WINDOWS_LAUNCH_EXTENSIONS = [".com", ".exe", ".bat", ".cmd"];
26587
+ function resolveWindowsLauncher(commandName, env = process.env) {
26588
+ const extensions = (env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").map((ext) => ext.trim().toLowerCase()).filter((ext) => WINDOWS_LAUNCH_EXTENSIONS.includes(ext));
26589
+ for (const entry of (env.PATH ?? "").split(";")) {
26590
+ const dir = entry.trim().replace(/^"(.*)"$/, "$1");
26591
+ if (!path8.win32.isAbsolute(dir)) continue;
26592
+ for (const ext of extensions) {
26593
+ const file2 = path8.win32.join(dir, commandName + ext);
26594
+ try {
26595
+ if (statSync(file2).isFile()) return { file: file2, shell: ext === ".bat" || ext === ".cmd" };
26596
+ } catch {
26597
+ }
26598
+ }
26599
+ }
26600
+ return void 0;
26601
+ }
26602
+
26556
26603
  // agent/src/job-supervisor.ts
26557
26604
  import { spawn as spawn2 } from "node:child_process";
26558
- import path8 from "node:path";
26605
+ import path9 from "node:path";
26559
26606
  function absolute(value) {
26560
- return typeof value === "string" && value.length > 0 && value.length < 32767 && !value.includes("\0") && path8.isAbsolute(value) && path8.resolve(value) === value;
26607
+ return typeof value === "string" && value.length > 0 && value.length < 32767 && !value.includes("\0") && path9.isAbsolute(value) && path9.resolve(value) === value;
26561
26608
  }
26562
26609
  async function runSupervised(helper, request, options = {}) {
26563
26610
  if (process.platform !== "win32") throw Error("WINDOWS_SUPERVISOR_REQUIRED");
@@ -26573,7 +26620,7 @@ async function runSupervised(helper, request, options = {}) {
26573
26620
  let pid = null, outcome = null;
26574
26621
  let buffer = "", failure5 = null, closed = false, cancelSent = false;
26575
26622
  let killTimer, hardTimer;
26576
- const child = spawn2(helper, [], { cwd: path8.dirname(helper), stdio: ["pipe", "pipe", "pipe"], windowsHide: true, shell: false, env: buildChildEnvironment(process.env) });
26623
+ const child = spawn2(helper, [], { cwd: path9.dirname(helper), stdio: ["pipe", "pipe", "pipe"], windowsHide: true, shell: false, env: buildChildEnvironment(process.env) });
26577
26624
  const cancel = () => {
26578
26625
  if (closed || cancelSent) return;
26579
26626
  cancelSent = true;
@@ -26727,7 +26774,7 @@ var NativeTools = class {
26727
26774
  options;
26728
26775
  async readFile(file2, maxBytes, signal) {
26729
26776
  try {
26730
- return await readBoundedFile(file2, maxBytes, this.options.ownerBridgePath ?? path9.join(path9.dirname(this.options.helperPath), "OwnerBridge.exe"), signal);
26777
+ return await readBoundedFile(file2, maxBytes, this.options.ownerBridgePath ?? path10.join(path10.dirname(this.options.helperPath), "OwnerBridge.exe"), signal);
26731
26778
  } catch (error62) {
26732
26779
  if (error62.code === "ENOENT") throw error62;
26733
26780
  if (error62 instanceof Error && /^[A-Z_]{1,40}$/.test(error62.message)) fail2(error62.message);
@@ -26752,15 +26799,15 @@ var NativeTools = class {
26752
26799
  try {
26753
26800
  const canonical2 = await realpath5(workspace.root);
26754
26801
  if (!equalPath3(canonical2, workspace.root) || hash5(process.platform === "win32" ? canonical2.toLowerCase() : canonical2) !== workspace.rootHash) fail2("WORKSPACE_CHANGED");
26755
- const runtimeDirectory = path9.dirname(this.options.helperPath);
26802
+ const runtimeDirectory = path10.dirname(this.options.helperPath);
26756
26803
  const protectedPaths = [
26757
26804
  this.options.stateDirectory,
26758
26805
  this.options.helperPath,
26759
- ...["agent.mjs", "node.exe", "OwnerBridge.exe", "LocalCommanderAgent.exe"].map((name2) => path9.join(runtimeDirectory, name2))
26806
+ ...["agent.mjs", "node.exe", "OwnerBridge.exe", "LocalCommanderAgent.exe"].map((name2) => path10.join(runtimeDirectory, name2))
26760
26807
  ];
26761
26808
  if (this.options.ownerBridgePath) protectedPaths.push(this.options.ownerBridgePath);
26762
- if (process.platform === "win32" && process.env.LOCALAPPDATA && path9.isAbsolute(process.env.LOCALAPPDATA)) {
26763
- protectedPaths.push(path9.join(process.env.LOCALAPPDATA, "LocalCommander"));
26809
+ if (process.platform === "win32" && process.env.LOCALAPPDATA && path10.isAbsolute(process.env.LOCALAPPDATA)) {
26810
+ protectedPaths.push(path10.join(process.env.LOCALAPPDATA, "LocalCommander"));
26764
26811
  }
26765
26812
  guard = await PathGuard.create([canonical2], false, { protectedPaths });
26766
26813
  } catch (e) {
@@ -26792,7 +26839,7 @@ var NativeTools = class {
26792
26839
  const bytes3 = await this.readFile(filename, 1048576, signal), contents = utf8(bytes3), lines = contents.split(/\r?\n/);
26793
26840
  const selected = lines.slice(first - 1, Math.min(last, lines.length)).join("\n");
26794
26841
  if (Buffer.byteLength(selected) > 12e4) fail2("OUTPUT_LIMIT_EXCEEDED");
26795
- return result({ path: path9.relative(workspace.root, filename), sha256: hash5(bytes3), startLine: first, endLine: Math.min(last, lines.length), totalLines: lines.length, content: selected, truncated: last < lines.length });
26842
+ return result({ path: path10.relative(workspace.root, filename), sha256: hash5(bytes3), startLine: first, endLine: Math.min(last, lines.length), totalLines: lines.length, content: selected, truncated: last < lines.length });
26796
26843
  } };
26797
26844
  }
26798
26845
  if (call.name === "fs_write" || call.name === "fs_replace") {
@@ -26828,7 +26875,7 @@ var NativeTools = class {
26828
26875
  }
26829
26876
  const bytes3 = Buffer.from(contents, "utf8");
26830
26877
  if (bytes3.length > MAX_FILE_WRITE_BYTES) fail2("FILE_WRITE_LIMIT");
26831
- const temp = path9.join(path9.dirname(target), ".lc-write-" + randomUUID4() + ".tmp");
26878
+ const temp = path10.join(path10.dirname(target), ".lc-write-" + randomUUID4() + ".tmp");
26832
26879
  const handle = await open4(temp, constants3.O_CREAT | constants3.O_EXCL | constants3.O_WRONLY, 384);
26833
26880
  try {
26834
26881
  await handle.writeFile(bytes3);
@@ -26845,7 +26892,7 @@ var NativeTools = class {
26845
26892
  await link(temp, target);
26846
26893
  await rm3(temp);
26847
26894
  }
26848
- return result({ path: path9.relative(workspace.root, target), bytes: bytes3.length, sha256: hash5(bytes3), ...call.name === "fs_replace" ? { replacements } : {} });
26895
+ return result({ path: path10.relative(workspace.root, target), bytes: bytes3.length, sha256: hash5(bytes3), ...call.name === "fs_replace" ? { replacements } : {} });
26849
26896
  } catch (e) {
26850
26897
  await handle.close().catch(() => {
26851
26898
  });
@@ -26866,12 +26913,12 @@ var NativeTools = class {
26866
26913
  stopped(signal);
26867
26914
  if (matches2.length >= call.args.maxResults || scanned >= 300) break;
26868
26915
  try {
26869
- const filename = await guard.resolveExisting(path9.join(base, entry.path));
26916
+ const filename = await guard.resolveExisting(path10.join(base, entry.path));
26870
26917
  guard.assertSafeFile(filename);
26871
26918
  const data = utf8(await this.readFile(filename, 256e3, signal));
26872
26919
  scanned++;
26873
26920
  const lines = data.split(/\r?\n/);
26874
- for (let i = 0; i < lines.length && matches2.length < call.args.maxResults; i++) if ((call.args.caseSensitive ? lines[i] : lines[i].toLowerCase()).includes(query)) matches2.push({ path: path9.relative(workspace.root, filename), line: i + 1, text: lines[i].slice(0, 500) });
26921
+ for (let i = 0; i < lines.length && matches2.length < call.args.maxResults; i++) if ((call.args.caseSensitive ? lines[i] : lines[i].toLowerCase()).includes(query)) matches2.push({ path: path10.relative(workspace.root, filename), line: i + 1, text: lines[i].slice(0, 500) });
26875
26922
  } catch (error62) {
26876
26923
  if (error62 instanceof NativeToolError && ["FILE_READ_FAILED", "CANCELLED"].includes(error62.code)) throw error62;
26877
26924
  }
@@ -26881,7 +26928,7 @@ var NativeTools = class {
26881
26928
  }
26882
26929
  if (call.name === "localhost_request") {
26883
26930
  const url2 = new URL(call.args.url), port = Number(url2.port || (url2.protocol === "https:" ? 443 : 80));
26884
- if (!["http:", "https:"].includes(url2.protocol) || !["localhost", "127.0.0.1", "[::1]"].includes(url2.hostname) || url2.username || url2.password || url2.hash || !workspace.localhostPorts.includes(port) || this.options.protectedPorts?.includes(port)) fail2("LOCALHOST_NOT_ALLOWED");
26931
+ if (!["http:", "https:"].includes(url2.protocol) || !["localhost", "127.0.0.1", "[::1]"].includes(url2.hostname) || url2.username || url2.password || url2.hash || (workspace.fullAccess ? workspace.deniedLocalhostPorts?.includes(port) : !workspace.localhostPorts.includes(port)) || this.options.protectedPorts?.includes(port)) fail2("LOCALHOST_NOT_ALLOWED");
26885
26932
  const headers = {};
26886
26933
  for (const [name2, value] of Object.entries(call.args.headers ?? {})) {
26887
26934
  if (!/^[A-Za-z0-9-]+$/.test(name2) || /[\r\n]/.test(value) || ["host", "connection", "content-length", "transfer-encoding", "upgrade", "proxy-authorization", "proxy-connection"].includes(name2.toLowerCase()) || Object.keys(headers).some((k) => k.toLowerCase() === name2.toLowerCase())) fail2("INVALID_HTTP_HEADER");
@@ -26921,10 +26968,10 @@ var NativeTools = class {
26921
26968
  } };
26922
26969
  }
26923
26970
  if (call.name === "command_run") {
26924
- const cwd2 = await resolve(call.args.cwd, true), program = this.resolveProgram(call.args.command, workspace);
26971
+ const cwd2 = await resolve(call.args.cwd, true), program = await this.resolveProgram(call.args.command, workspace, call.args.args);
26925
26972
  const claims2 = writeClaim(cwd2);
26926
- return { call, claims: claims2, execution: { executable: program.executable, args: [...program.prefixArgs ?? [], ...call.args.args], cwd: cwd2 }, run: async (signal, onStarted, onOutput) => {
26927
- const r = await runSupervised(this.options.helperPath, { executable: program.executable, args: [...program.prefixArgs ?? [], ...call.args.args], cwd: cwd2, timeoutMs: call.args.timeoutMs, maxProcesses: 32 }, { signal, maxOutputBytes: 9e4, onStarted, onOutput });
26973
+ return { call, claims: claims2, execution: { ...program, cwd: cwd2 }, run: async (signal, onStarted, onOutput) => {
26974
+ const r = await runSupervised(this.options.helperPath, { ...program, cwd: cwd2, timeoutMs: call.args.timeoutMs, maxProcesses: 32 }, { signal, maxOutputBytes: 9e4, onStarted, onOutput });
26928
26975
  const { pid: _pid, ...output2 } = r;
26929
26976
  return { ...output2, resultCode: r.cancelled ? "CANCELLED" : r.timedOut ? "TIMEOUT" : r.exitCode === 0 ? "SUCCESS" : "USER_PROGRAM_FAILED" };
26930
26977
  } };
@@ -26938,20 +26985,20 @@ var NativeTools = class {
26938
26985
  else if (call.name === "git_diff") {
26939
26986
  argv = ["diff", "--no-ext-diff", "--no-textconv", ...call.args.staged ? ["--cached"] : []];
26940
26987
  if (call.args.file) {
26941
- const file2 = await resolve(path9.resolve(cwd, call.args.file));
26942
- const relative = path9.relative(cwd, file2);
26943
- if (relative.startsWith(".." + path9.sep) || relative === ".." || path9.isAbsolute(relative)) fail2("PATH_NOT_ALLOWED");
26988
+ const file2 = await resolve(path10.resolve(cwd, call.args.file));
26989
+ const relative = path10.relative(cwd, file2);
26990
+ if (relative.startsWith(".." + path10.sep) || relative === ".." || path10.isAbsolute(relative)) fail2("PATH_NOT_ALLOWED");
26944
26991
  argv.push("--", relative);
26945
26992
  } else argv.push("--stat");
26946
26993
  } else fail2("TOOL_MISSING");
26947
- const execution = common ? this.gitExecution(cwd, argv) : void 0;
26994
+ const execution = common ? await this.gitExecution(cwd, argv) : void 0;
26948
26995
  const runGit = (signal, onStarted, onOutput) => runSupervised(this.options.helperPath, { ...execution, timeoutMs: 1e4, maxProcesses: 8 }, { signal, maxOutputBytes: 9e4, onStarted, onOutput });
26949
26996
  return { call, claims, ...execution ? { execution } : {}, run: async (signal, onStarted, onOutput) => {
26950
26997
  if (call.name === "project_snapshot") {
26951
26998
  const listing = await this.list(guard, cwd, 1, 150, signal);
26952
26999
  let packageInfo = null;
26953
27000
  try {
26954
- const name2 = await guard.resolveExisting(path9.join(cwd, "package.json"));
27001
+ const name2 = await guard.resolveExisting(path10.join(cwd, "package.json"));
26955
27002
  guard.assertSafeFile(name2);
26956
27003
  const value = JSON.parse(utf8(await this.readFile(name2, 64e3, signal)));
26957
27004
  packageInfo = { name: typeof value.name === "string" ? value.name : null, version: typeof value.version === "string" ? value.version : null, scripts: value.scripts && typeof value.scripts === "object" ? Object.keys(value.scripts).slice(0, 100) : [] };
@@ -26967,15 +27014,53 @@ var NativeTools = class {
26967
27014
  return { ...output2, resultCode: r.exitCode === 0 ? "SUCCESS" : "GIT_FAILED" };
26968
27015
  } };
26969
27016
  }
26970
- resolveProgram(name2, workspace) {
26971
- const entry = Object.entries(this.options.programs).find(([key, value]) => key.toLowerCase() === name2.toLowerCase() || path9.isAbsolute(name2) && equalPath3(value.executable, path9.resolve(name2)));
26972
- if (!entry || !workspace.allowedCommands.some((v) => v.toLowerCase() === entry[0].toLowerCase()) || !path9.isAbsolute(entry[1].executable)) fail2("COMMAND_NOT_ALLOWED");
26973
- return { executable: entry[1].executable, prefixArgs: [...entry[1].prefixArgs ?? []] };
26974
- }
26975
- gitExecution(cwd, args) {
26976
- const program = this.options.programs.git;
26977
- if (!program || !path9.isAbsolute(program.executable)) fail2("GIT_NOT_INSTALLED");
26978
- return { executable: program.executable, args: ["--no-pager", "--no-optional-locks", "-c", "core.fsmonitor=false", "-c", "core.hooksPath=" + (process.platform === "win32" ? "NUL" : "/dev/null"), "-c", "diff.external=", ...args], cwd };
27017
+ async resolveProgram(name2, workspace, args) {
27018
+ const entry = Object.entries(this.options.programs).find(([key, value]) => key.toLowerCase() === name2.toLowerCase() || path10.isAbsolute(name2) && equalPath3(value.executable, path10.resolve(name2)));
27019
+ if (workspace.fullAccess) {
27020
+ const commandKey = (value) => path10.basename(value).toLowerCase().replace(/\.(exe|com|cmd|bat)$/i, "");
27021
+ const denied = new Set((workspace.deniedCommands ?? []).map(commandKey));
27022
+ if (denied.has(commandKey(name2)) || entry && denied.has(commandKey(entry[0]))) fail2("COMMAND_NOT_ALLOWED");
27023
+ const extension2 = path10.extname(name2).toLowerCase();
27024
+ const candidate = entry?.[1].executable ?? (path10.isAbsolute(name2) ? name2 : /^[\w.-]+$/.test(name2) ? resolveWindowsLauncher(
27025
+ commandKey(name2),
27026
+ [".exe", ".com", ".cmd", ".bat"].includes(extension2) ? { ...process.env, PATHEXT: extension2 } : process.env
27027
+ )?.file : void 0);
27028
+ if (!candidate || !path10.isAbsolute(candidate)) fail2("COMMAND_NOT_FOUND");
27029
+ const executable = await realpath5(candidate).catch(() => fail2("COMMAND_NOT_FOUND"));
27030
+ if (!(await lstat5(executable)).isFile()) fail2("COMMAND_NOT_FOUND");
27031
+ if (denied.has(commandKey(executable))) fail2("COMMAND_NOT_ALLOWED");
27032
+ for (const key of workspace.deniedCommands ?? []) {
27033
+ const configured = this.options.programs[key]?.executable;
27034
+ if (configured && equalPath3(executable, await realpath5(configured).catch(() => configured))) fail2("COMMAND_NOT_ALLOWED");
27035
+ }
27036
+ if (/\.(cmd|bat)$/i.test(executable)) {
27037
+ if ([executable, ...args].some((value) => /[&|<>^%!"\r\n]/.test(value))) fail2("INVALID_SCRIPT_ARGUMENTS");
27038
+ const literal2 = (value) => "'" + value.replaceAll("'", "''") + "'";
27039
+ const shell = path10.join(process.env.SystemRoot ?? "C:\\Windows", "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
27040
+ if (denied.has("powershell") || denied.has("cmd")) fail2("COMMAND_NOT_ALLOWED");
27041
+ const script = "& " + literal2(executable) + " @(" + args.map(literal2).join(",") + "); exit $LASTEXITCODE";
27042
+ return { executable: shell, args: ["-NoProfile", "-NonInteractive", "-EncodedCommand", Buffer.from(script, "utf16le").toString("base64")] };
27043
+ }
27044
+ if (!/\.(exe|com)$/i.test(executable)) fail2("COMMAND_NOT_ALLOWED");
27045
+ return { executable, args: [...entry?.[1].prefixArgs ?? [], ...args] };
27046
+ }
27047
+ if (!entry || !workspace.allowedCommands.some((v) => v.toLowerCase() === entry[0].toLowerCase()) || !path10.isAbsolute(entry[1].executable)) fail2("COMMAND_NOT_ALLOWED");
27048
+ return { executable: entry[1].executable, args: [...entry[1].prefixArgs ?? [], ...args] };
27049
+ }
27050
+ async gitExecution(cwd, args) {
27051
+ const configured = this.options.programs.git;
27052
+ const candidates = configured ? [configured.executable] : process.platform === "win32" ? [[process.env.ProgramFiles, "Git"], [process.env["ProgramFiles(x86)"], "Git"], [process.env.LOCALAPPDATA, "Programs/Git"]].filter(([root]) => root && path10.isAbsolute(root)).map(([root, suffix]) => path10.join(root, suffix, "cmd", "git.exe")) : [];
27053
+ for (const candidate of candidates) {
27054
+ if (!path10.isAbsolute(candidate)) continue;
27055
+ try {
27056
+ const stat = await lstat5(candidate);
27057
+ if (!stat.isFile() || stat.isSymbolicLink() || !equalPath3(candidate, await realpath5(candidate))) continue;
27058
+ } catch {
27059
+ continue;
27060
+ }
27061
+ return { executable: candidate, args: ["--no-pager", "--no-optional-locks", "-c", "core.fsmonitor=false", "-c", "core.hooksPath=" + (process.platform === "win32" ? "NUL" : "/dev/null"), "-c", "diff.external=", ...args], cwd };
27062
+ }
27063
+ fail2("GIT_NOT_INSTALLED");
26979
27064
  }
26980
27065
  async list(guard, root, depth, maxEntries, signal) {
26981
27066
  const entries = [], queue = [{ path: root, level: 0 }];
@@ -26992,7 +27077,7 @@ var NativeTools = class {
26992
27077
  break;
26993
27078
  }
26994
27079
  if (item.isSymbolicLink() || excluded.has(item.name.toLowerCase())) continue;
26995
- const candidate = path9.join(current2.path, item.name);
27080
+ const candidate = path10.join(current2.path, item.name);
26996
27081
  let resolved;
26997
27082
  try {
26998
27083
  resolved = await guard.resolveExisting(candidate);
@@ -27002,11 +27087,11 @@ var NativeTools = class {
27002
27087
  }
27003
27088
  if (!equalPath3(candidate, resolved)) continue;
27004
27089
  if (item.isDirectory()) {
27005
- entries.push({ path: path9.relative(root, resolved), type: "directory" });
27090
+ entries.push({ path: path10.relative(root, resolved), type: "directory" });
27006
27091
  if (current2.level < depth) queue.push({ path: resolved, level: current2.level + 1 });
27007
27092
  } else if (item.isFile()) {
27008
27093
  const stat = await lstat5(resolved);
27009
- entries.push({ path: path9.relative(root, resolved), type: "file", size: stat.size });
27094
+ entries.push({ path: path10.relative(root, resolved), type: "file", size: stat.size });
27010
27095
  }
27011
27096
  }
27012
27097
  if (truncated) break;
@@ -27016,7 +27101,7 @@ var NativeTools = class {
27016
27101
  async gitCommonDir(cwd, workspace, guard) {
27017
27102
  let directory = cwd;
27018
27103
  while (guard.isWithin(directory, workspace.root)) {
27019
- const dotGit = path9.join(directory, ".git");
27104
+ const dotGit = path10.join(directory, ".git");
27020
27105
  try {
27021
27106
  const stat = await lstat5(dotGit);
27022
27107
  if (stat.isSymbolicLink()) fail2("GIT_METADATA_CHANGED");
@@ -27025,14 +27110,14 @@ var NativeTools = class {
27025
27110
  else {
27026
27111
  const content = utf8(await this.readFile(dotGit, 4096)).trim();
27027
27112
  if (!content.startsWith("gitdir: ")) fail2("GIT_METADATA_CHANGED");
27028
- gitDir = await realpath5(path9.resolve(directory, content.slice(8)));
27113
+ gitDir = await realpath5(path10.resolve(directory, content.slice(8)));
27029
27114
  }
27030
27115
  if (guard.isWithin(gitDir, this.options.stateDirectory) || !guard.isWithin(gitDir, workspace.root) && (!workspace.gitCommonDir || !guard.isWithin(gitDir, workspace.gitCommonDir))) fail2("GIT_COMMON_DIRECTORY_NOT_APPROVED");
27031
27116
  let common = gitDir;
27032
27117
  try {
27033
- const content = utf8(await this.readFile(path9.join(gitDir, "commondir"), 4096)).trim();
27118
+ const content = utf8(await this.readFile(path10.join(gitDir, "commondir"), 4096)).trim();
27034
27119
  if (!content) fail2("GIT_METADATA_CHANGED");
27035
- common = await realpath5(path9.resolve(gitDir, content));
27120
+ common = await realpath5(path10.resolve(gitDir, content));
27036
27121
  } catch (e) {
27037
27122
  if (e.code !== "ENOENT") throw e;
27038
27123
  }
@@ -27043,22 +27128,22 @@ var NativeTools = class {
27043
27128
  if (e.code !== "ENOENT") throw e;
27044
27129
  }
27045
27130
  if (equalPath3(directory, workspace.root)) break;
27046
- directory = path9.dirname(directory);
27131
+ directory = path10.dirname(directory);
27047
27132
  }
27048
27133
  return null;
27049
27134
  }
27050
27135
  };
27051
27136
 
27052
27137
  // agent/src/scheduler.ts
27053
- import path10 from "node:path";
27138
+ import path11 from "node:path";
27054
27139
  import os2 from "node:os";
27055
27140
  function canonical(value) {
27056
- const p = path10.resolve(value);
27141
+ const p = path11.resolve(value);
27057
27142
  return process.platform === "win32" ? p.toLowerCase() : p;
27058
27143
  }
27059
27144
  function ancestor(a, b) {
27060
- const relative = path10.relative(a, b);
27061
- return relative === "" || !path10.isAbsolute(relative) && relative !== ".." && !relative.startsWith(".." + path10.sep);
27145
+ const relative = path11.relative(a, b);
27146
+ return relative === "" || !path11.isAbsolute(relative) && relative !== ".." && !relative.startsWith(".." + path11.sep);
27062
27147
  }
27063
27148
  function claimsConflict(a, b) {
27064
27149
  return a.some((x) => b.some((y) => (x.namespace ?? "filesystem") === (y.namespace ?? "filesystem") && (x.mode === "write" || y.mode === "write") && (ancestor(x.path, y.path) || ancestor(y.path, x.path))));
@@ -27078,7 +27163,7 @@ var NativeScheduler = class {
27078
27163
  schedule(id, claims, deadlineAt, run, signal) {
27079
27164
  if (!this.accepting) return Promise.reject(Error("AGENT_PAUSED"));
27080
27165
  if (!id || id.length > 100 || this.active.has(id) || this.waiting.some((j) => j.id === id)) return Promise.reject(Error("DUPLICATE_SCHEDULED_EXECUTION"));
27081
- if (!Array.isArray(claims) || !claims.length || claims.length > 32 || claims.some((c) => !c || !path10.isAbsolute(c.path) || !["read", "write"].includes(c.mode))) return Promise.reject(Error("INVALID_RESOURCE_CLAIM"));
27166
+ if (!Array.isArray(claims) || !claims.length || claims.length > 32 || claims.some((c) => !c || !path11.isAbsolute(c.path) || !["read", "write"].includes(c.mode))) return Promise.reject(Error("INVALID_RESOURCE_CLAIM"));
27082
27167
  const deadline = deadlineAt.getTime();
27083
27168
  if (!Number.isFinite(deadline) || deadline <= Date.now()) return Promise.reject(Error("ADMISSION_DEADLINE_EXPIRED"));
27084
27169
  if (signal?.aborted) return Promise.reject(Error("CANCELLED_BEFORE_ACCEPTANCE"));
@@ -27761,10 +27846,6 @@ var NativeRuntime = class {
27761
27846
  }
27762
27847
  async prepare(frame) {
27763
27848
  const binding2 = frame.binding;
27764
- if (this.paused || this.closing) {
27765
- this.send({ type: "not_accepted", version: 1, binding: binding2, code: "AGENT_PAUSED", provedNotStarted: true });
27766
- return;
27767
- }
27768
27849
  const existing = this.contexts.get(binding2.executionId);
27769
27850
  if (existing) {
27770
27851
  if (!sameBinding(existing.binding, binding2)) throw Error("IDEMPOTENCY_CONFLICT");
@@ -27772,15 +27853,15 @@ var NativeRuntime = class {
27772
27853
  if (entry?.state === "prepared" && !existing.launched) this.send({ type: "prepared", version: 1, binding: binding2 });
27773
27854
  return;
27774
27855
  }
27775
- if (this.contexts.size >= 256) {
27776
- this.send({ type: "not_accepted", version: 1, binding: binding2, code: "RESOURCE_BUSY", provedNotStarted: true });
27777
- return;
27778
- }
27856
+ let preparedHere = false;
27779
27857
  try {
27858
+ const stored = await this.options.journal.prepare({ executionId: binding2.executionId, operationId: binding2.operationId, sessionId: binding2.sessionId, tenantId: binding2.tenantId, grantId: binding2.grantId, deviceId: binding2.deviceId, connectionEpoch: binding2.connectionEpoch, workspaceGrantId: binding2.workspaceGrantId, policyVersion: binding2.policyVersion, payloadHash: binding2.payloadHash, deadlineAt: binding2.deadlineAt, ...binding2.accountId ? { accountId: binding2.accountId } : {} });
27859
+ preparedHere = stored.created;
27860
+ if (this.paused || this.closing) throw new NativeToolError("AGENT_PAUSED");
27861
+ if (this.contexts.size >= 256) throw new NativeToolError("RESOURCE_BUSY");
27780
27862
  const workspace = (await this.options.workspaces()).find((w) => w.workspaceGrantId === binding2.workspaceGrantId && w.policyVersion === binding2.policyVersion);
27781
27863
  if (!workspace) throw new NativeToolError("LOCAL_PERMISSION_REQUIRED");
27782
27864
  const tool = await this.options.tools.prepare(workspace, frame.tool);
27783
- const stored = await this.options.journal.prepare({ executionId: binding2.executionId, operationId: binding2.operationId, sessionId: binding2.sessionId, tenantId: binding2.tenantId, grantId: binding2.grantId, deviceId: binding2.deviceId, connectionEpoch: binding2.connectionEpoch, workspaceGrantId: binding2.workspaceGrantId, policyVersion: binding2.policyVersion, payloadHash: binding2.payloadHash, deadlineAt: binding2.deadlineAt, ...binding2.accountId ? { accountId: binding2.accountId } : {} });
27784
27865
  if (!stored.created) {
27785
27866
  if (!journalBinding(stored.entry, binding2)) throw Error("IDEMPOTENCY_CONFLICT");
27786
27867
  if (stored.entry.result) {
@@ -27870,12 +27951,14 @@ var NativeRuntime = class {
27870
27951
  if (!context.accepted) {
27871
27952
  if (context.guardPermit) await this.options.guard.rejected(context.guardPermit, safeCode(error62)).catch(() => {
27872
27953
  });
27954
+ let provedNotStarted = false;
27873
27955
  try {
27874
27956
  if (abort.signal.aborted) await this.options.journal.cancelPrepared(binding2.executionId);
27875
27957
  else await this.options.journal.reject(binding2.executionId);
27958
+ provedNotStarted = true;
27876
27959
  } catch {
27877
27960
  }
27878
- this.send({ type: "not_accepted", version: 1, binding: binding2, code: safeCode(error62), provedNotStarted: true });
27961
+ this.send({ type: "not_accepted", version: 1, binding: binding2, code: safeCode(error62), provedNotStarted });
27879
27962
  } else {
27880
27963
  const isCommand = frame.tool.name === "command_run" || frame.tool.name.startsWith("git_") || frame.tool.name === "project_snapshot";
27881
27964
  const uncertain = error62 instanceof Error && error62.message === "GUARD_EVIDENCE_FAILED" || isCommand && !(error62 instanceof NativeToolError);
@@ -27895,7 +27978,15 @@ var NativeRuntime = class {
27895
27978
  });
27896
27979
  this.options.onActivity?.();
27897
27980
  } catch (error62) {
27898
- this.send({ type: "not_accepted", version: 1, binding: binding2, code: error62 instanceof Error && error62.message === "IDEMPOTENCY_CONFLICT" ? "IDEMPOTENCY_CONFLICT" : safeCode(error62), provedNotStarted: false });
27981
+ let provedNotStarted = false;
27982
+ if (preparedHere) {
27983
+ try {
27984
+ await this.options.journal.reject(binding2.executionId);
27985
+ provedNotStarted = true;
27986
+ } catch {
27987
+ }
27988
+ }
27989
+ this.send({ type: "not_accepted", version: 1, binding: binding2, code: error62 instanceof Error && error62.message === "IDEMPOTENCY_CONFLICT" ? "IDEMPOTENCY_CONFLICT" : safeCode(error62), provedNotStarted });
27899
27990
  }
27900
27991
  }
27901
27992
  async control(frame) {
@@ -28055,7 +28146,7 @@ var NativeRelayBridge = class {
28055
28146
  // agent/src/relay-client.ts
28056
28147
  import { createPrivateKey as createPrivateKey2, randomUUID as randomUUID5, sign } from "node:crypto";
28057
28148
 
28058
- // node_modules/ws/wrapper.mjs
28149
+ // ../../node_modules/ws/wrapper.mjs
28059
28150
  var import_stream = __toESM(require_stream(), 1);
28060
28151
  var import_extension = __toESM(require_extension(), 1);
28061
28152
  var import_permessage_deflate = __toESM(require_permessage_deflate(), 1);
@@ -28523,8 +28614,8 @@ function canonicalOrigin2(value) {
28523
28614
  fail4("ORIGIN_INVALID");
28524
28615
  }
28525
28616
  }
28526
- function endpoint(origin, path13) {
28527
- return origin + path13;
28617
+ function endpoint(origin, path15) {
28618
+ return origin + path15;
28528
28619
  }
28529
28620
  function uuid17(value, code) {
28530
28621
  if (typeof value !== "string" || !UUID3.test(value)) fail4(code);
@@ -29027,14 +29118,14 @@ async function deliverGuardEvidence(target, packet, options = {}) {
29027
29118
  // agent/src/optimization-ledger.ts
29028
29119
  import { constants as constants4 } from "node:fs";
29029
29120
  import { lstat as lstat6, mkdir as mkdir4, open as open5, readFile as readFile4, realpath as realpath6 } from "node:fs/promises";
29030
- import path11 from "node:path";
29121
+ import path12 from "node:path";
29031
29122
  var MAX_LEDGER_BYTES = 64 * 1024 * 1024;
29032
29123
  var MAX_NOTICE_LEDGER_BYTES = 8 * 1024 * 1024;
29033
29124
  function failure4(code) {
29034
29125
  return Object.assign(new Error(code), { code });
29035
29126
  }
29036
29127
  async function safeDirectory2(directory) {
29037
- const absolute2 = path11.resolve(directory);
29128
+ const absolute2 = path12.resolve(directory);
29038
29129
  let current2 = absolute2;
29039
29130
  for (; ; ) {
29040
29131
  try {
@@ -29042,7 +29133,7 @@ async function safeDirectory2(directory) {
29042
29133
  } catch (error62) {
29043
29134
  if (error62.code !== "ENOENT") throw error62;
29044
29135
  }
29045
- const parent = path11.dirname(current2);
29136
+ const parent = path12.dirname(current2);
29046
29137
  if (parent === current2) break;
29047
29138
  current2 = parent;
29048
29139
  }
@@ -29067,8 +29158,8 @@ var OptimizationLedger = class _OptimizationLedger {
29067
29158
  closed = false;
29068
29159
  static async open(directory) {
29069
29160
  const dir = await safeDirectory2(directory);
29070
- const filename = path11.join(dir, "live-efficiency.v1.jsonl");
29071
- const noticesFilename = path11.join(dir, "live-efficiency-notices.v1.jsonl");
29161
+ const filename = path12.join(dir, "live-efficiency.v1.jsonl");
29162
+ const noticesFilename = path12.join(dir, "live-efficiency-notices.v1.jsonl");
29072
29163
  let existing = "";
29073
29164
  try {
29074
29165
  const stat = await lstat6(filename);
@@ -29200,8 +29291,144 @@ var OptimizationLedger = class _OptimizationLedger {
29200
29291
  }
29201
29292
  };
29202
29293
 
29294
+ // agent/src/monitor.ts
29295
+ import { createHash as createHash10, randomUUID as randomUUID7 } from "node:crypto";
29296
+ import { lstat as lstat7, mkdir as mkdir5, open as open6, rename as rename4, rm as rm4 } from "node:fs/promises";
29297
+ import path13 from "node:path";
29298
+ var ProductionMonitor = class {
29299
+ constructor(directory, stateDirectory, agentVersion3) {
29300
+ this.agentVersion = agentVersion3;
29301
+ const key = createHash10("sha256").update(path13.resolve(stateDirectory).toLowerCase()).digest("hex");
29302
+ this.file = path13.join(directory, key + ".json");
29303
+ }
29304
+ agentVersion;
29305
+ instanceId = randomUUID7();
29306
+ events = [];
29307
+ sessions = /* @__PURE__ */ new Map();
29308
+ sequence = 0;
29309
+ connection = {
29310
+ state: "starting",
29311
+ origin: null,
29312
+ epoch: null
29313
+ };
29314
+ writing = null;
29315
+ file;
29316
+ record(event, details = {}) {
29317
+ this.events.push({ seq: ++this.sequence, at: (/* @__PURE__ */ new Date()).toISOString(), event, ...details });
29318
+ if (this.events.length > 100) this.events.shift();
29319
+ }
29320
+ configureOrigin(origin) {
29321
+ try {
29322
+ const url2 = new URL(origin);
29323
+ if (url2.origin === origin && !url2.username && !url2.password && (url2.protocol === "https:" || url2.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(url2.hostname))) {
29324
+ this.connection.origin = url2.origin;
29325
+ }
29326
+ } catch {
29327
+ }
29328
+ }
29329
+ setConnection(state, connection) {
29330
+ if (connection) {
29331
+ try {
29332
+ this.configureOrigin(new URL(connection.url).origin.replace(/^ws/, "http"));
29333
+ } catch {
29334
+ }
29335
+ this.connection.epoch = connection.connectionEpoch;
29336
+ }
29337
+ this.connection.state = state;
29338
+ this.record(state);
29339
+ }
29340
+ request(request) {
29341
+ const payload = request.payload;
29342
+ const parsed = ExecutionBindingSchema.safeParse(payload?.binding);
29343
+ if (!parsed.success || parsed.data.tenantId !== request.tenantId || parsed.data.deviceId !== request.deviceId || parsed.data.executionId !== request.executionId || parsed.data.operationId !== request.operationId) return;
29344
+ const binding2 = parsed.data;
29345
+ this.sessions.delete(binding2.sessionId);
29346
+ this.sessions.set(binding2.sessionId, {
29347
+ sessionId: binding2.sessionId,
29348
+ workspaceGrantId: binding2.workspaceGrantId,
29349
+ lastSeenAt: (/* @__PURE__ */ new Date()).toISOString(),
29350
+ model: null
29351
+ });
29352
+ if (this.sessions.size > 32) this.sessions.delete(this.sessions.keys().next().value);
29353
+ const tool = ToolCallSchema.safeParse(payload?.tool);
29354
+ this.record(request.kind, {
29355
+ sessionId: binding2.sessionId,
29356
+ executionId: binding2.executionId,
29357
+ ...tool.success ? { tool: tool.data.name } : {}
29358
+ });
29359
+ }
29360
+ result(binding2, state, code) {
29361
+ this.record(["finished", "failed", "cancelled", "unknown"].includes(state) ? state : "result", {
29362
+ sessionId: binding2.sessionId,
29363
+ executionId: binding2.executionId,
29364
+ code: code === "SUCCESS" || ErrorCodeSchema.safeParse(code).success ? code : "RESULT"
29365
+ });
29366
+ }
29367
+ requestFailed() {
29368
+ this.record("request_failed");
29369
+ }
29370
+ connectionFailed(error62) {
29371
+ const code = error62 instanceof Error ? error62.message : "";
29372
+ this.record("connection_error", { code: [
29373
+ "RELAY_CONNECT_FAILED",
29374
+ "RELAY_CONNECT_CLOSED",
29375
+ "RELAY_CONNECT_TIMEOUT",
29376
+ "RELAY_HANDSHAKE_TIMEOUT",
29377
+ "RELAY_RESULT_TIMEOUT",
29378
+ "WORKSPACE_ACK_TIMEOUT"
29379
+ ].includes(code) ? code : "CONNECTION_FAILED" });
29380
+ }
29381
+ response(value) {
29382
+ const result2 = value;
29383
+ if (result2?.accepted === false) this.record("rejected", {
29384
+ code: ErrorCodeSchema.safeParse(result2.code).success ? String(result2.code) : "REJECTED"
29385
+ });
29386
+ }
29387
+ snapshot() {
29388
+ return {
29389
+ schemaVersion: 1,
29390
+ instanceId: this.instanceId,
29391
+ pid: process.pid,
29392
+ agentVersion: this.agentVersion,
29393
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
29394
+ connection: { ...this.connection },
29395
+ sessions: [...this.sessions.values()].map((session) => ({ ...session })),
29396
+ events: this.events.map((event) => ({ ...event }))
29397
+ };
29398
+ }
29399
+ flush() {
29400
+ if (this.writing) return this.writing;
29401
+ this.writing = (async () => {
29402
+ const directory = path13.dirname(this.file);
29403
+ await mkdir5(directory, { recursive: true, mode: 448 });
29404
+ const stat = await lstat7(directory);
29405
+ if (!stat.isDirectory() || stat.isSymbolicLink()) throw Error("MONITOR_DIRECTORY_INVALID");
29406
+ const temporary = this.file + "." + this.instanceId + ".tmp";
29407
+ const handle = await open6(temporary, "wx", 384);
29408
+ try {
29409
+ try {
29410
+ await handle.writeFile(JSON.stringify(this.snapshot()) + "\n");
29411
+ } finally {
29412
+ await handle.close();
29413
+ }
29414
+ await rename4(temporary, this.file);
29415
+ } finally {
29416
+ await rm4(temporary, { force: true });
29417
+ }
29418
+ })().finally(() => {
29419
+ this.writing = null;
29420
+ });
29421
+ return this.writing;
29422
+ }
29423
+ async close() {
29424
+ await this.writing?.catch(() => {
29425
+ });
29426
+ await this.flush();
29427
+ }
29428
+ };
29429
+
29203
29430
  // agent/src/main.ts
29204
- var AGENT_VERSION2 = true ? "0.3.5" : "0.3.2";
29431
+ var AGENT_VERSION2 = true ? "0.3.7" : "0.3.2";
29205
29432
  function processAlive(pid) {
29206
29433
  if (!Number.isInteger(pid) || pid <= 0) return false;
29207
29434
  try {
@@ -29212,11 +29439,11 @@ function processAlive(pid) {
29212
29439
  }
29213
29440
  }
29214
29441
  async function claimAgentProcess(stateDir, runtimeDir, version2) {
29215
- await mkdir5(stateDir, { recursive: true });
29216
- const file2 = path12.join(stateDir, "agent-process.json");
29442
+ await mkdir6(stateDir, { recursive: true });
29443
+ const file2 = path14.join(stateDir, "agent-process.json");
29217
29444
  for (let attempt = 0; attempt < 2; attempt += 1) {
29218
29445
  try {
29219
- const handle = await open6(file2, "wx", 384);
29446
+ const handle = await open7(file2, "wx", 384);
29220
29447
  try {
29221
29448
  await handle.writeFile(JSON.stringify({ pid: process.pid, runtimeDir, version: version2, startedAt: (/* @__PURE__ */ new Date()).toISOString() }) + "\n", "utf8");
29222
29449
  } finally {
@@ -29225,7 +29452,7 @@ async function claimAgentProcess(stateDir, runtimeDir, version2) {
29225
29452
  return async () => {
29226
29453
  try {
29227
29454
  const current2 = JSON.parse(await readFile5(file2, "utf8"));
29228
- if (current2.pid === process.pid) await rm4(file2, { force: true });
29455
+ if (current2.pid === process.pid) await rm5(file2, { force: true });
29229
29456
  } catch {
29230
29457
  }
29231
29458
  };
@@ -29238,7 +29465,7 @@ async function claimAgentProcess(stateDir, runtimeDir, version2) {
29238
29465
  } catch {
29239
29466
  }
29240
29467
  if (!stale) throw Error("AGENT_ALREADY_RUNNING");
29241
- await rm4(file2, { force: true });
29468
+ await rm5(file2, { force: true });
29242
29469
  }
29243
29470
  }
29244
29471
  throw Error("AGENT_ALREADY_RUNNING");
@@ -29261,6 +29488,7 @@ async function runAgent(options) {
29261
29488
  if (!Number.isInteger(delay) || delay < 0 || delay > 3e4) throw Error("RECONNECT_DELAY_INVALID");
29262
29489
  const identity = await options.store.load();
29263
29490
  if (!identity?.enrollment) throw Error("ENROLLMENT_MISSING");
29491
+ options.monitor?.configureOrigin(identity.enrollment.serverOrigin);
29264
29492
  await options.journal.recoverAfterRestart();
29265
29493
  await options.store.loadWorkspaces();
29266
29494
  } catch (error62) {
@@ -29270,6 +29498,7 @@ async function runAgent(options) {
29270
29498
  const runtime = new NativeRuntime({ journal: options.journal, tools: options.tools, scheduler: new NativeScheduler(), workspaces: () => options.store.loadWorkspaces(Boolean(options.guard)), guard: options.guard, efficiencyLedger: options.efficiencyLedger });
29271
29499
  let connection = null;
29272
29500
  const bridge = new NativeRelayBridge(runtime, (binding2, state, code, metrics) => {
29501
+ options.monitor?.result(binding2, state, code);
29273
29502
  if (!connection) throw Error("RELAY_SOCKET_CLOSED");
29274
29503
  return connection.sendTerminal(binding2, state, code, metrics);
29275
29504
  }, options.journal);
@@ -29281,11 +29510,21 @@ async function runAgent(options) {
29281
29510
  ready = resolve;
29282
29511
  });
29283
29512
  try {
29513
+ options.monitor?.setConnection("connecting");
29284
29514
  connection = await connect({ store: options.store, agentVersion: options.agentVersion, handleRequest: async (request) => {
29285
29515
  await readyPromise;
29286
- return bridge.handle(request);
29516
+ options.monitor?.request(request);
29517
+ try {
29518
+ const result2 = await bridge.handle(request);
29519
+ options.monitor?.response(result2);
29520
+ return result2;
29521
+ } catch (error62) {
29522
+ options.monitor?.requestFailed();
29523
+ throw error62;
29524
+ }
29287
29525
  } });
29288
29526
  await bridge.connected(connection);
29527
+ options.monitor?.setConnection("connected", connection);
29289
29528
  ready();
29290
29529
  if (options.signal.aborted) connection.close("agent_shutdown");
29291
29530
  else {
@@ -29307,9 +29546,11 @@ async function runAgent(options) {
29307
29546
  }
29308
29547
  } catch (error62) {
29309
29548
  ready();
29549
+ options.monitor?.connectionFailed(error62);
29310
29550
  if (error62 instanceof RelayClientError && ["RELAY_CONNECT_FAILED", "RELAY_CONNECT_CLOSED", "RELAY_CONNECT_TIMEOUT", "RELAY_HANDSHAKE_TIMEOUT"].includes(error62.code)) {
29311
29551
  } else throw error62;
29312
29552
  } finally {
29553
+ options.monitor?.setConnection("disconnected");
29313
29554
  connection?.close("agent_disconnect");
29314
29555
  await bridge.disconnected();
29315
29556
  connection = null;
@@ -29324,10 +29565,10 @@ async function runAgent(options) {
29324
29565
  async function main() {
29325
29566
  if (process.platform !== "win32") throw Error("WINDOWS_REQUIRED");
29326
29567
  const appData = process.env.LOCALAPPDATA;
29327
- if (!appData || !path12.isAbsolute(appData)) throw Error("APP_DATA_MISSING");
29328
- const stateDir = process.env.LC_AGENT_STATE_DIR ?? path12.join(appData, "LocalCommander", "Agent");
29329
- const binaryDir = path12.dirname(process.execPath);
29330
- const ownerBridgePath = process.env.LC_OWNER_BRIDGE ?? path12.join(binaryDir, "OwnerBridge.exe");
29568
+ if (!appData || !path14.isAbsolute(appData)) throw Error("APP_DATA_MISSING");
29569
+ const stateDir = process.env.LC_AGENT_STATE_DIR ?? path14.join(appData, "LocalCommander", "Agent");
29570
+ const binaryDir = path14.dirname(process.execPath);
29571
+ const ownerBridgePath = process.env.LC_OWNER_BRIDGE ?? path14.join(binaryDir, "OwnerBridge.exe");
29331
29572
  const store = await WindowsPrivateStore.open(stateDir, ownerBridgePath);
29332
29573
  const command = process.argv[2] ?? "run";
29333
29574
  if (command === "pair") {
@@ -29365,6 +29606,9 @@ async function main() {
29365
29606
  displayName: w.displayName,
29366
29607
  path: w.root,
29367
29608
  permissions: w.permissions,
29609
+ accessMode: w.fullAccess ? "full" : "scoped",
29610
+ deniedCommands: w.deniedCommands ?? [],
29611
+ deniedLocalhostPorts: w.deniedLocalhostPorts ?? [],
29368
29612
  allowedCommands: w.allowedCommands,
29369
29613
  executables: Object.fromEntries(w.allowedCommands.map((name2) => [name2, programs[name2]?.executable ?? null])),
29370
29614
  localhostPorts: w.localhostPorts,
@@ -29375,7 +29619,7 @@ async function main() {
29375
29619
  const args = process.argv.slice(3);
29376
29620
  if (command === "efficiency-report") {
29377
29621
  if (args.length) throw Error("AGENT_COMMAND_INVALID");
29378
- const ledger = await OptimizationLedger.open(path12.join(stateDir, "optimization"));
29622
+ const ledger = await OptimizationLedger.open(path14.join(stateDir, "optimization"));
29379
29623
  try {
29380
29624
  process.stdout.write(JSON.stringify(await ledger.report(), null, 2) + "\n");
29381
29625
  } finally {
@@ -29385,7 +29629,7 @@ async function main() {
29385
29629
  }
29386
29630
  if (command === "guard-configure") {
29387
29631
  if (args.length !== 1) throw Error("AGENT_COMMAND_INVALID");
29388
- const filename = await (await import("node:fs/promises")).realpath(path12.resolve(args[0]));
29632
+ const filename = await (await import("node:fs/promises")).realpath(path14.resolve(args[0]));
29389
29633
  const input2 = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(await readWindowsFile(ownerBridgePath, filename, 2e5)));
29390
29634
  if (!input2 || typeof input2 !== "object" || Object.keys(input2).sort().join(",") !== "compact,settings") throw Error("GUARD_CONFIGURATION_INVALID");
29391
29635
  await store.configureGuard(input2.settings, input2.compact);
@@ -29404,7 +29648,7 @@ async function main() {
29404
29648
  }
29405
29649
  if (command === "guard-evidence") {
29406
29650
  if (args.length) throw Error("AGENT_COMMAND_INVALID");
29407
- const journal = await NativeJournal.open(path12.join(stateDir, "journal"), new SecretBox({ "1": await store.loadDataKey() }));
29651
+ const journal = await NativeJournal.open(path14.join(stateDir, "journal"), new SecretBox({ "1": await store.loadDataKey() }));
29408
29652
  try {
29409
29653
  process.stdout.write(JSON.stringify(await journal.guardEvidence()) + "\n");
29410
29654
  } finally {
@@ -29416,7 +29660,7 @@ async function main() {
29416
29660
  if (args.length !== (command === "guard-export" ? 0 : 1)) throw Error("AGENT_COMMAND_INVALID");
29417
29661
  const identity = await store.load();
29418
29662
  if (!identity?.enrollment) throw Error("ENROLLMENT_MISSING");
29419
- const journal = await NativeJournal.open(path12.join(stateDir, "journal"), new SecretBox({ "1": await store.loadDataKey() }));
29663
+ const journal = await NativeJournal.open(path14.join(stateDir, "journal"), new SecretBox({ "1": await store.loadDataKey() }));
29420
29664
  try {
29421
29665
  const { tenantId, deviceId } = identity.enrollment;
29422
29666
  const records = (await journal.guardEvidence()).filter((record2) => record2.tenantId === tenantId && record2.deviceId === deviceId);
@@ -29454,25 +29698,41 @@ async function main() {
29454
29698
  if (args.length) throw Error("AGENT_COMMAND_INVALID");
29455
29699
  if (!(await store.load())?.enrollment) throw Error("ENROLLMENT_MISSING");
29456
29700
  const releaseProcess = await claimAgentProcess(stateDir, binaryDir, AGENT_VERSION2);
29701
+ const monitor = new ProductionMonitor(path14.join(appData, "LocalCommander", "Monitor"), stateDir, AGENT_VERSION2);
29702
+ const publishMonitor = () => monitor.flush().catch(() => {
29703
+ process.stderr.write("MONITOR_WRITE_FAILED\n");
29704
+ });
29705
+ await publishMonitor();
29706
+ const monitorTimer = setInterval(() => {
29707
+ void publishMonitor();
29708
+ }, 2e3);
29457
29709
  try {
29458
- const journal = await NativeJournal.open(path12.join(stateDir, "journal"), new SecretBox({ "1": await store.loadDataKey() }));
29459
- const efficiencyLedger = await OptimizationLedger.open(path12.join(stateDir, "optimization"));
29710
+ const journal = await NativeJournal.open(path14.join(stateDir, "journal"), new SecretBox({ "1": await store.loadDataKey() }));
29711
+ const efficiencyLedger = await OptimizationLedger.open(path14.join(stateDir, "optimization"));
29460
29712
  try {
29461
- const tools = new NativeTools({ stateDirectory: stateDir, helperPath: process.env.LC_JOB_HOST ?? path12.join(binaryDir, "JobHost.exe"), ownerBridgePath, programs: await store.loadPrograms() });
29713
+ const tools = new NativeTools({ stateDirectory: stateDir, helperPath: process.env.LC_JOB_HOST ?? path14.join(binaryDir, "JobHost.exe"), ownerBridgePath, programs: await store.loadPrograms() });
29462
29714
  const stop = new AbortController();
29463
29715
  process.once("SIGINT", () => stop.abort());
29464
29716
  process.once("SIGTERM", () => stop.abort());
29465
29717
  const guard = await NativeGuard.open(store, journal);
29466
- await runAgent({ store, journal, tools, signal: stop.signal, agentVersion: AGENT_VERSION2, guard, efficiencyLedger });
29718
+ await runAgent({ store, journal, tools, signal: stop.signal, agentVersion: AGENT_VERSION2, guard, efficiencyLedger, monitor });
29719
+ monitor.setConnection("stopped");
29467
29720
  } finally {
29468
29721
  await efficiencyLedger.close();
29469
29722
  await journal.close();
29470
29723
  }
29724
+ } catch (error62) {
29725
+ monitor.setConnection("failed");
29726
+ throw error62;
29471
29727
  } finally {
29728
+ clearInterval(monitorTimer);
29729
+ await monitor.close().catch(() => {
29730
+ process.stderr.write("MONITOR_WRITE_FAILED\n");
29731
+ });
29472
29732
  await releaseProcess();
29473
29733
  }
29474
29734
  }
29475
- if (process.argv[1] && path12.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
29735
+ if (process.argv[1] && path14.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
29476
29736
  void main().catch((error62) => {
29477
29737
  const code = error62 instanceof Error && /^[A-Z0-9_]{1,64}$/.test(error62.message) ? error62.message : "AGENT_START_FAILED";
29478
29738
  process.stderr.write(code + "\n");