@moxt-ai/cli 0.12.6 → 0.12.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/dist/index.cjs CHANGED
@@ -9431,8 +9431,8 @@ var init_local_file_source = __esm({
9431
9431
  const requested = resolveWithin(root, relativeWorkingDirectory);
9432
9432
  const workingDirectory = await (0, import_promises11.realpath)(requested);
9433
9433
  assertContained(root, workingDirectory);
9434
- const stat10 = await (0, import_promises11.lstat)(workingDirectory);
9435
- if (!stat10.isDirectory())
9434
+ const stat9 = await (0, import_promises11.lstat)(workingDirectory);
9435
+ if (!stat9.isDirectory())
9436
9436
  throw new Error("Local file working directory is not a directory");
9437
9437
  return new _LocalFileSource(root, workingDirectory);
9438
9438
  }
@@ -9452,8 +9452,8 @@ var init_local_file_source = __esm({
9452
9452
  return { kind: "directory", name: entry.name, path: path6 };
9453
9453
  if (!entry.isFile())
9454
9454
  return void 0;
9455
- const stat10 = await (0, import_promises11.lstat)(absolute);
9456
- return { kind: "file", name: entry.name, path: path6, size: stat10.size };
9455
+ const stat9 = await (0, import_promises11.lstat)(absolute);
9456
+ return { kind: "file", name: entry.name, path: path6, size: stat9.size };
9457
9457
  }));
9458
9458
  const entries = candidates2.filter((entry) => entry !== void 0).sort(compareEntries);
9459
9459
  return page(entries, cursor, limit);
@@ -9487,8 +9487,8 @@ var init_local_file_source = __esm({
9487
9487
  if (!entry.isFile())
9488
9488
  continue;
9489
9489
  if (normalizedQuery === "" || path6.toLocaleLowerCase().includes(normalizedQuery)) {
9490
- const stat10 = await (0, import_promises11.lstat)(absolute);
9491
- matches.push({ kind: "file", name: entry.name, path: path6, size: stat10.size });
9490
+ const stat9 = await (0, import_promises11.lstat)(absolute);
9491
+ matches.push({ kind: "file", name: entry.name, path: path6, size: stat9.size });
9492
9492
  }
9493
9493
  }
9494
9494
  }
@@ -9498,8 +9498,8 @@ var init_local_file_source = __esm({
9498
9498
  }
9499
9499
  async read(path6) {
9500
9500
  const file3 = await this.resolveFile(path6);
9501
- const stat10 = await (0, import_promises11.lstat)(file3);
9502
- if (stat10.size > maximumReadBytes)
9501
+ const stat9 = await (0, import_promises11.lstat)(file3);
9502
+ if (stat9.size > maximumReadBytes)
9503
9503
  throw new Error("Local file exceeds the preview size limit");
9504
9504
  const buffer2 = await (0, import_promises11.readFile)(file3);
9505
9505
  const binary = buffer2.includes(0) || !isUtf8(buffer2);
@@ -9508,17 +9508,17 @@ var init_local_file_source = __esm({
9508
9508
  encoding: binary ? "base64" : "utf8",
9509
9509
  name: (0, import_node_path9.basename)(file3),
9510
9510
  path: portable((0, import_node_path9.relative)(this.workingDirectory, file3)),
9511
- size: stat10.size
9511
+ size: stat9.size
9512
9512
  };
9513
9513
  }
9514
9514
  async validate(path6, kind = "file") {
9515
9515
  const target = kind === "directory" ? await this.resolveDirectory(path6) : await this.resolveFile(path6);
9516
- const stat10 = await (0, import_promises11.lstat)(target);
9516
+ const stat9 = await (0, import_promises11.lstat)(target);
9517
9517
  return {
9518
9518
  kind,
9519
9519
  name: (0, import_node_path9.basename)(target),
9520
9520
  path: portable((0, import_node_path9.relative)(this.workingDirectory, target)),
9521
- ...kind === "file" ? { size: stat10.size } : {}
9521
+ ...kind === "file" ? { size: stat9.size } : {}
9522
9522
  };
9523
9523
  }
9524
9524
  async validateImage(path6) {
@@ -68289,7 +68289,7 @@ ${captureLines}` : capture.stack;
68289
68289
  }
68290
68290
  });
68291
68291
 
68292
- // node_modules/.pnpm/@moxt-ai+mobius@0.0.40/node_modules/@moxt-ai/mobius/dist/index.js
68292
+ // node_modules/.pnpm/@moxt-ai+mobius@0.0.41/node_modules/@moxt-ai/mobius/dist/index.js
68293
68293
  var dist_exports2 = {};
68294
68294
  __export(dist_exports2, {
68295
68295
  AcpExecutionError: () => AcpExecutionError,
@@ -78523,7 +78523,7 @@ function factoryWhitespace2(effects, ok22) {
78523
78523
  }
78524
78524
  function tokenizeDefinition2(effects, ok22, nok) {
78525
78525
  const self = this;
78526
- let identifier3;
78526
+ let identifier2;
78527
78527
  return start;
78528
78528
  function start(code) {
78529
78529
  effects.enter("definition");
@@ -78542,7 +78542,7 @@ function tokenizeDefinition2(effects, ok22, nok) {
78542
78542
  )(code);
78543
78543
  }
78544
78544
  function labelAfter(code) {
78545
- identifier3 = normalizeIdentifier2(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1));
78545
+ identifier2 = normalizeIdentifier2(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1));
78546
78546
  if (code === 58) {
78547
78547
  effects.enter("definitionMarker");
78548
78548
  effects.consume(code);
@@ -78576,7 +78576,7 @@ function tokenizeDefinition2(effects, ok22, nok) {
78576
78576
  function afterWhitespace(code) {
78577
78577
  if (code === null || markdownLineEnding2(code)) {
78578
78578
  effects.exit("definition");
78579
- self.parser.defined.push(identifier3);
78579
+ self.parser.defined.push(identifier2);
78580
78580
  return ok22(code);
78581
78581
  }
78582
78582
  return nok(code);
@@ -81749,6 +81749,26 @@ function decodeSessionRow(row) {
81749
81749
  readPrompted(Reflect.get(row, "prompted"))
81750
81750
  );
81751
81751
  }
81752
+ async function waitForAcpProcessCapacity(completion, signal) {
81753
+ signal.throwIfAborted();
81754
+ const cancelled = Promise.withResolvers();
81755
+ const cancel = () => {
81756
+ try {
81757
+ signal.throwIfAborted();
81758
+ } catch (error622) {
81759
+ cancelled.reject(error622);
81760
+ }
81761
+ };
81762
+ signal.addEventListener("abort", cancel, { once: true });
81763
+ if (signal.aborted) {
81764
+ cancel();
81765
+ }
81766
+ try {
81767
+ await Promise.race([completion, cancelled.promise]);
81768
+ } finally {
81769
+ signal.removeEventListener("abort", cancel);
81770
+ }
81771
+ }
81752
81772
  function readableWebStream(input22) {
81753
81773
  let streamOpen = true;
81754
81774
  return new ReadableStream({
@@ -82100,19 +82120,8 @@ function agentDigest(agent) {
82100
82120
  })
82101
82121
  );
82102
82122
  }
82103
- async function workspaceDigest(path22) {
82104
- const metadata = await (0, import_promises22.stat)(path22);
82105
- if (!metadata.isDirectory()) {
82106
- throw new LocalBotAuthorizationError("binding_incompatible", "The Bot workspace is not a directory");
82107
- }
82108
- return digest(
82109
- JSON.stringify({
82110
- changedAtMilliseconds: metadata.ctimeMs,
82111
- device: metadata.dev,
82112
- inode: metadata.ino,
82113
- path: path22
82114
- })
82115
- );
82123
+ function workspaceDigest(path22) {
82124
+ return digest(path22);
82116
82125
  }
82117
82126
  function exactTargets(left, right) {
82118
82127
  if (left.length !== right.length) {
@@ -82146,6 +82155,16 @@ function rowInteger(row, key) {
82146
82155
  }
82147
82156
  return value;
82148
82157
  }
82158
+ function rowHasInteger(row, key) {
82159
+ const value = Reflect.get(row, key);
82160
+ if (value === null) {
82161
+ return false;
82162
+ }
82163
+ if (typeof value !== "number" || !Number.isSafeInteger(value)) {
82164
+ throw new LocalBotAuthorizationError("local_grant_invalid", "The local Bot grant is invalid");
82165
+ }
82166
+ return true;
82167
+ }
82149
82168
  function parseTargets(encoded) {
82150
82169
  let value;
82151
82170
  try {
@@ -82394,7 +82413,7 @@ function isContainedPath(root, candidate) {
82394
82413
  }
82395
82414
  async function readJsonRecord(path22, maximumBytes) {
82396
82415
  try {
82397
- const handle = await (0, import_promises25.open)(path22, "r");
82416
+ const handle = await (0, import_promises24.open)(path22, "r");
82398
82417
  try {
82399
82418
  const metadata = await handle.stat();
82400
82419
  if (!metadata.isFile() || metadata.size > maximumBytes) {
@@ -82491,7 +82510,7 @@ function verifyPackageLockEntry(lock, definition22, verifyDependencyClosure) {
82491
82510
  }
82492
82511
  }
82493
82512
  async function verifyRequiredDependency(rootPath, lock, definition22) {
82494
- const dependencyRoot = await (0, import_promises25.realpath)(packagePath(rootPath, definition22.packageName));
82513
+ const dependencyRoot = await (0, import_promises24.realpath)(packagePath(rootPath, definition22.packageName));
82495
82514
  if (!isContainedPath(rootPath, dependencyRoot)) {
82496
82515
  throw new ManagedNpmPackageError(
82497
82516
  "managed_package_verification_failed",
@@ -82520,8 +82539,8 @@ async function validateManagedNpmPackage(root, definition22) {
82520
82539
  }
82521
82540
  }
82522
82541
  async function validateManagedNpmPackageContents(root, definition22) {
82523
- const rootPath = await (0, import_promises25.realpath)(root);
82524
- const packageRoot = await (0, import_promises25.realpath)(packagePath(rootPath, definition22.packageName));
82542
+ const rootPath = await (0, import_promises24.realpath)(root);
82543
+ const packageRoot = await (0, import_promises24.realpath)(packagePath(rootPath, definition22.packageName));
82525
82544
  if (!isContainedPath(rootPath, packageRoot)) {
82526
82545
  throw new ManagedNpmPackageError(
82527
82546
  "managed_package_verification_failed",
@@ -82592,8 +82611,8 @@ async function validateAgentHome(path22) {
82592
82611
  throw new AgentProbeError("agent_environment_invalid", "The configured Agent home is invalid");
82593
82612
  }
82594
82613
  try {
82595
- const resolved = await (0, import_promises26.realpath)(path22);
82596
- const metadata = await (0, import_promises26.stat)(resolved);
82614
+ const resolved = await (0, import_promises25.realpath)(path22);
82615
+ const metadata = await (0, import_promises25.stat)(resolved);
82597
82616
  if (!metadata.isDirectory() || typeof process.getuid === "function" && metadata.uid !== process.getuid()) {
82598
82617
  throw new Error("Agent home is not a user-owned directory");
82599
82618
  }
@@ -82710,7 +82729,7 @@ async function hashFile(path22, signal) {
82710
82729
  async function readManifest(path22) {
82711
82730
  let handle;
82712
82731
  try {
82713
- handle = await (0, import_promises28.open)(path22, "r");
82732
+ handle = await (0, import_promises27.open)(path22, "r");
82714
82733
  } catch (error622) {
82715
82734
  throw new ManagedAgentArchiveError(
82716
82735
  "managed_archive_verification_failed",
@@ -82749,8 +82768,8 @@ async function readManifest(path22) {
82749
82768
  }
82750
82769
  async function validateManagedAgentArchive(root, definition22, signal) {
82751
82770
  try {
82752
- const rootPath = await (0, import_promises28.realpath)(root);
82753
- const rootMetadata = await (0, import_promises28.stat)(rootPath);
82771
+ const rootPath = await (0, import_promises27.realpath)(root);
82772
+ const rootMetadata = await (0, import_promises27.stat)(rootPath);
82754
82773
  if (!rootMetadata.isDirectory() || typeof process.getuid === "function" && rootMetadata.uid !== process.getuid()) {
82755
82774
  throw new Error("Managed Agent root is not user-owned");
82756
82775
  }
@@ -83383,9 +83402,9 @@ function parseChannelArgument(arguments_) {
83383
83402
  async function resolveDefaultWorkspace(path22) {
83384
83403
  const requestedWorkspace = (0, import_node_path23.resolve)(path22);
83385
83404
  try {
83386
- await (0, import_promises24.mkdir)(requestedWorkspace, { recursive: true, mode: 448 });
83387
- const defaultWorkspace = await (0, import_promises24.realpath)(requestedWorkspace);
83388
- const metadata = await (0, import_promises24.stat)(defaultWorkspace);
83405
+ await (0, import_promises23.mkdir)(requestedWorkspace, { recursive: true, mode: 448 });
83406
+ const defaultWorkspace = await (0, import_promises23.realpath)(requestedWorkspace);
83407
+ const metadata = await (0, import_promises23.stat)(defaultWorkspace);
83389
83408
  if (!metadata.isDirectory()) {
83390
83409
  throw new PairingClientError("invalid_workspace", "The default workspace is not a directory");
83391
83410
  }
@@ -83475,10 +83494,10 @@ async function claimPairing(options, defaultWorkspace, localAgents, installableA
83475
83494
  }
83476
83495
  async function persistConnection(channelId, relayOrigin, runtimeCredential2, defaultWorkspace, environment) {
83477
83496
  const connectionsDirectory = (0, import_node_path23.join)(readStateDirectory(environment), "connections");
83478
- await (0, import_promises24.mkdir)(connectionsDirectory, { mode: 448, recursive: true });
83497
+ await (0, import_promises23.mkdir)(connectionsDirectory, { mode: 448, recursive: true });
83479
83498
  const connectionPath = (0, import_node_path23.join)(connectionsDirectory, `${channelId}.json`);
83480
83499
  const temporaryPath = (0, import_node_path23.join)(connectionsDirectory, `.${channelId}.${(0, import_node_crypto14.randomUUID)()}.tmp`);
83481
- await (0, import_promises24.writeFile)(
83500
+ await (0, import_promises23.writeFile)(
83482
83501
  temporaryPath,
83483
83502
  `${JSON.stringify(
83484
83503
  {
@@ -83493,7 +83512,7 @@ async function persistConnection(channelId, relayOrigin, runtimeCredential2, def
83493
83512
  `,
83494
83513
  { flag: "wx", mode: 384 }
83495
83514
  );
83496
- await (0, import_promises24.rename)(temporaryPath, connectionPath);
83515
+ await (0, import_promises23.rename)(temporaryPath, connectionPath);
83497
83516
  return connectionPath;
83498
83517
  }
83499
83518
  function decodeSavedConnection(value, expectedChannelId) {
@@ -83517,7 +83536,7 @@ function decodeSavedConnection(value, expectedChannelId) {
83517
83536
  async function readSavedConnection(channelId, environment) {
83518
83537
  const connectionPath = (0, import_node_path23.join)(readStateDirectory(environment), "connections", `${channelId}.json`);
83519
83538
  let encoded = "";
83520
- const handle = await (0, import_promises24.open)(connectionPath, "r");
83539
+ const handle = await (0, import_promises23.open)(connectionPath, "r");
83521
83540
  try {
83522
83541
  const metadata = await handle.stat();
83523
83542
  if (!metadata.isFile() || metadata.size > MAX_CONNECTION_FILE_LENGTH) {
@@ -86493,9 +86512,9 @@ function loadMobiusRuntimeConnection(environment = process.env) {
86493
86512
  async function resolveWorkspace(path22) {
86494
86513
  const requested = (0, import_node_path40.resolve)(path22);
86495
86514
  try {
86496
- await (0, import_promises30.mkdir)(requested, { recursive: true, mode: 448 });
86497
- const resolved = await (0, import_promises30.realpath)(requested);
86498
- const metadata = await (0, import_promises30.stat)(resolved);
86515
+ await (0, import_promises29.mkdir)(requested, { recursive: true, mode: 448 });
86516
+ const resolved = await (0, import_promises29.realpath)(requested);
86517
+ const metadata = await (0, import_promises29.stat)(resolved);
86499
86518
  if (!metadata.isDirectory()) {
86500
86519
  throw new MobiusRuntimeConfigurationError("The Runtime workspace is not a directory");
86501
86520
  }
@@ -86512,7 +86531,7 @@ async function createMobiusRuntimeEngine(connection, signal, environment = proce
86512
86531
  const relayUrl = relayUrlFromConnection(connection);
86513
86532
  const defaultWorkspace = await resolveWorkspace(connection.defaultWorkspace);
86514
86533
  const auditDatabasePath = (0, import_node_path40.resolve)(connection.auditDatabasePath);
86515
- await (0, import_promises30.mkdir)((0, import_node_path40.dirname)(auditDatabasePath), { recursive: true, mode: 448 });
86534
+ await (0, import_promises29.mkdir)((0, import_node_path40.dirname)(auditDatabasePath), { recursive: true, mode: 448 });
86516
86535
  const inventory = await discoverLocalAgentInventory({
86517
86536
  defaultWorkspace,
86518
86537
  environment,
@@ -86534,9 +86553,9 @@ async function createMobiusRuntimeEngine(connection, signal, environment = proce
86534
86553
  )
86535
86554
  );
86536
86555
  }
86537
- var import_node_path16, import_node_url, import_node_fs4, import_node_child_process9, import_node_fs5, import_promises20, import_node_path17, import_node_os11, import_node_path18, import_node_child_process10, import_promises21, import_node_path19, import_node_url2, import_node_fs6, import_node_path20, import_node_sqlite, import_node_fs7, import_node_path21, import_node_sqlite2, import_node_crypto11, import_node_crypto12, import_promises22, import_node_sqlite3, import_node_crypto13, import_node_net2, import_promises23, import_node_net3, import_node_path22, import_undici, import_node_crypto14, import_promises24, import_node_os12, import_node_path23, import_undici2, import_promises25, import_node_path24, import_node_path25, import_node_path26, import_promises26, import_node_path27, import_promises27, import_node_path28, import_node_path29, import_node_crypto15, import_node_fs8, import_promises28, import_node_path30, import_undici3, import_undici4, import_node_path31, import_node_path32, import_node_child_process11, import_node_path33, import_node_path34, import_node_crypto16, import_node_path35, import_node_util6, import_undici5, import_undici6, import_node_fs9, import_node_path36, import_node_crypto17, import_undici7, import_promises29, import_node_os13, import_node_path37, import_node_crypto18, import_node_path38, import_node_child_process12, import_node_crypto19, import_undici8, import_undici9, import_node_crypto20, import_node_fs10, import_node_path39, import_node_sqlite4, import_promises30, import_node_path40, __defProp2, __export2, createAcpClient, external_exports2, core_exports22, util_exports2, Cached2, EVALUATING2, captureStackTrace2, allowsEval2, getParsedType2, propertyKeyTypes2, primitiveTypes2, NUMBER_FORMAT_RANGES2, BIGINT_FORMAT_RANGES2, highSurrogate2, Class2, installing2, broke2, breaker2, CONSTANT_CATCH2, _a4, NEVER2, _zodDesc2, _E2, $brand2, $ZodAsyncError2, $ZodEncodeError2, globalConfig2, _messageDesc2, _issuesDesc2, _installedToString2, initializer3, $ZodError2, $ZodRealError2, _parse3, parse4, _parseAsync3, parseAsync3, _safeParse2, safeParse3, _safeParseAsync2, safeParseAsync3, COMPILE_INVALID2, COMPILE_FALLBACK2, validate2, validateAsync3, _encode3, encode3, _decode3, decode4, _encodeAsync3, encodeAsync3, _decodeAsync3, decodeAsync3, _safeEncode2, safeEncode3, _safeDecode2, safeDecode3, _safeEncodeAsync2, safeEncodeAsync3, _safeDecodeAsync2, safeDecodeAsync3, regexes_exports2, cuid4, cuid23, ulid3, xid3, ksuid3, nanoid3, duration3, extendedDuration2, guid3, uuid3, uuid42, uuid62, uuid72, email3, html5Email2, rfc5322Email2, unicodeEmail2, idnEmail2, browserEmail2, _emoji3, ipv43, ipv63, mac3, cidrv43, cidrv63, base643, base64url3, hostname5, domain2, httpProtocol2, e1643, creditCard3, iban3, dateSource2, date5, anyString2, string6, bigint4, integer2, number4, boolean4, _null4, _undefined4, lowercase2, uppercase2, hex3, md5_hex2, md5_base642, md5_base64url2, sha1_hex2, sha1_base642, sha1_base64url2, sha256_hex2, sha256_base642, sha256_base64url2, sha384_hex2, sha384_base642, sha384_base64url2, sha512_hex2, sha512_base642, sha512_base64url2, $ZodCheck2, _whenHasSize2, _whenHasLength2, numericOriginMap2, $ZodCheckLessThan2, $ZodCheckGreaterThan2, $ZodCheckMultipleOf2, $ZodCheckNumberFormat2, $ZodCheckBigIntFormat2, $ZodCheckMaxSize2, $ZodCheckMinSize2, $ZodCheckSizeEquals2, $ZodCheckMaxLength2, $ZodCheckMinLength2, $ZodCheckLengthEquals2, $ZodCheckStringFormat2, $ZodCheckRegex2, $ZodCheckLowerCase2, $ZodCheckUpperCase2, $ZodCheckIncludes2, $ZodCheckStartsWith2, $ZodCheckEndsWith2, $ZodCheckProperty2, $ZodCheckMimeType2, $ZodCheckOverwrite2, Doc2, version2, $ZodType2, toStandardResult2, $ZodString2, $ZodStringFormat2, $ZodGUID2, $ZodUUID2, $ZodEmail2, URL_BAD_FORMAT2, URL_UNPARSEABLE2, asciiTabOrNewline2, $ZodURL2, $ZodEmoji2, $ZodNanoID2, $ZodCUID3, $ZodCUID22, $ZodULID2, $ZodXID2, $ZodKSUID2, $ZodISODateTime2, $ZodISODate2, $ZodISOTime2, $ZodISODuration2, $ZodIPv42, ipv6Alphabet2, $ZodIPv62, $ZodMAC2, $ZodCIDRv42, $ZodCIDRv62, base64Charset2, $ZodBase642, base64urlCharset2, $ZodBase64URL2, $ZodE1642, CC_SANITIZE2, $ZodCreditCard2, $ZodIBAN2, $ZodJWT2, $ZodCustomStringFormat2, $ZodNumber2, $ZodNumberFormat2, $ZodBoolean2, $ZodBigInt2, $ZodBigIntFormat2, $ZodSymbol2, $ZodUndefined2, $ZodNull2, $ZodAny2, $ZodUnknown2, $ZodNever2, $ZodVoid2, $ZodDate2, $ZodArray2, NO_SYMBOL_KEYS2, $ZodObject2, $ZodObjectJIT2, $ZodUnion2, $ZodXor2, $ZodDiscriminatedUnion2, $ZodIntersection2, $ZodTuple2, $ZodRecord2, $ZodMap2, $ZodSet2, $ZodEnum2, $ZodLiteral2, $ZodFile2, $ZodTransform2, $ZodOptional2, $ZodExactOptional2, $ZodNullable2, $ZodDefault2, $ZodPrefault2, $ZodNonOptional2, $ZodSuccess2, $ZodCatch2, $ZodNaN2, $ZodPipe2, $ZodCodec2, $ZodPreprocess2, $ZodReadonly2, $ZodTemplateLiteral2, $ZodFunction2, $ZodPromise2, $ZodLazy2, $ZodCustom2, $ZodProperties, $ZodCyclicError2, STATE2, NO_ISSUES2, recursive2, NONE2, ASSUMED2, PROVEN2, handoff2, open5, memo2, locales_exports2, error62, error210, error310, error410, error510, error63, error72, error82, error92, error102, error112, error122, error132, error142, error152, error162, error172, error182, error192, error202, error212, error222, error232, error242, error252, error262, error272, error282, error292, error302, error312, error322, capitalizeFirstCharacter2, error332, error342, error352, error362, error372, error382, error392, error402, error412, error422, error432, error442, error452, error462, error472, error482, error492, error502, error512, error522, error532, error542, error552, error562, error572, error582, error592, error602, error612, _a22, $output2, $input2, $ZodRegistry2, globalRegistry2, INVALID2, FALLBACK_FLAG2, ZodCompileAsyncError2, ZodCompileUnsupportedError2, WHEN_DEFAULTED_CHECKS2, PATTERN_IS_COMPLETE2, TimePrecision2, FOLDABLE_KEYS2, UNION_KEYS2, createToJSONSchemaMethod2, createStandardJSONSchemaMethod2, narrowMin2, narrowMax2, narrowBoth2, addDivisor2, addPattern2, intersectMime2, setFormat2, minContributor2, maxContributor2, formatContributor2, contributors2, formatMap2, exactPatterns2, exactPattern2, stringProcessor2, numberProcessor2, booleanProcessor2, bigintProcessor2, symbolProcessor2, nullProcessor2, undefinedProcessor2, voidProcessor2, neverProcessor2, anyProcessor2, unknownProcessor2, dateProcessor2, enumProcessor2, literalProcessor2, nanProcessor2, templateLiteralProcessor2, fileProcessor2, successProcessor2, customProcessor2, functionProcessor2, transformProcessor2, mapProcessor2, setProcessor2, arrayProcessor2, objectProcessor2, propertiesProcessor, unionProcessor2, intersectionProcessor2, tupleProcessor2, pendingRecords2, recordProcessor2, nullableProcessor2, nonoptionalProcessor2, UNREPRESENTABLE_DEFAULT2, defaultProcessor2, prefaultProcessor2, catchProcessor2, pipeProcessor2, readonlyProcessor2, promiseProcessor2, optionalProcessor2, lazyProcessor2, allProcessors2, JSONSchemaGenerator2, json_schema_exports2, schemas_exports22, checks_exports22, _installedErrorProtos2, initializer22, ZodError2, ZodRealError2, parse22, parseAsync22, safeParse22, safeParseAsync22, encode22, decode22, encodeAsync22, decodeAsync22, safeEncode22, safeDecode22, safeEncodeAsync22, safeDecodeAsync22, ZodType2, _ZodString2, ZodString2, ZodStringFormat2, ZodISODateTime2, ZodISODate2, ZodISOTime2, ZodISODuration2, ZodEmail2, ZodGUID2, ZodUUID2, ZodURL2, ZodEmoji2, ZodNanoID2, ZodCUID3, ZodCUID22, ZodULID2, ZodXID2, ZodKSUID2, ZodIPv42, ZodMAC2, ZodIPv62, ZodCIDRv42, ZodCIDRv62, ZodBase642, ZodBase64URL2, ZodE1642, ZodCreditCard2, ZodIBAN2, ZodJWT2, ZodCustomStringFormat2, ZodNumber2, ZodNumberFormat2, ZodBoolean2, ZodBigInt2, ZodBigIntFormat2, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown2, ZodNever2, ZodVoid2, ZodDate2, ZodArray2, ZodObject2, ZodUnion2, ZodXor2, ZodDiscriminatedUnion2, ZodIntersection2, ZodTuple2, ZodRecord2, ZodMap2, ZodSet2, ZodEnum2, ZodLiteral2, ZodFile2, ZodTransform2, ZodOptional2, ZodExactOptional2, ZodNullable2, ZodDefault2, ZodPrefault2, ZodNonOptional2, ZodSuccess2, ZodCatch2, ZodNaN2, ZodPipe2, ZodCodec2, ZodPreprocess2, ZodReadonly2, ZodTemplateLiteral2, ZodLazy2, ZodPromise2, ZodFunction2, ZodCustom2, ZodProperties, describe22, meta22, ZodInstanceOf2, stringbool2, ZodIssueCode2, ZodFirstPartyTypeKind2, iso_exports2, z2, RECOGNIZED_KEYS2, SCHEMA_KEYWORDS2, SCHEMA_MAP_KEYWORDS2, fullTime2, RESOLVING2, coerce_exports2, TOKEN_COUNT, promptUsageSchema, quotaTokenCountSchema, promptMetadataSchema, agentPromptResponseSchema, WORKSPACE_LIST_KIND, WORKSPACE_ENTRIES_KIND, SESSION_PREPARE_KIND, SESSION_READY_KIND, SESSION_CONFIGURE_KIND, SESSION_CONFIG_UPDATED_KIND, SESSION_USAGE_UPDATED_KIND, SESSION_COMMANDS_UPDATED_KIND, SESSION_INFO_UPDATED_KIND, SESSION_PERMISSION_REQUESTED_KIND, SESSION_PERMISSION_RESPOND_KIND, SESSION_PERMISSION_RESOLVED_KIND, SESSION_ELICITATION_REQUESTED_KIND, SESSION_ELICITATION_RESPOND_KIND, SESSION_ELICITATION_RESOLVED_KIND, SESSION_OPERATION_FAILED_KIND, AGENT_CONTENT_KIND, AGENT_INSTALL_REQUEST_KIND, AGENT_INSTALL_CANCEL_KIND, AGENT_INSTALL_STARTED_KIND, AGENT_INSTALL_PROGRESS_KIND, AGENT_INSTALL_COMPLETED_KIND, AGENT_INSTALL_FAILED_KIND, AGENT_INSTALL_CANCELLED_KIND, AGENT_SETTINGS_DISCOVER_KIND, AGENT_SETTINGS_DISCOVERED_KIND, AGENT_SETTINGS_DISCOVERY_FAILED_KIND, IDENTIFIER_PATTERN, DIRECTORY_IDENTIFIER_PATTERN, IDENTIFIER, DIRECTORY_IDENTIFIER, SHORT_TEXT, LONG_TEXT, workspaceEntrySchema, configValueSchema, sessionConfigOptionSchema, sessionConfigOptionsSchema, agentSettingsDiscoverCommandSchema, agentSettingsDiscoveredEventSchema, agentSettingsDiscoveryFailedEventSchema, sessionConfigurationSelectionSchema, sessionConfigurationSelectionsSchema, sessionCapabilitiesSchema, sessionCommandSchema, permissionOptionSchema, elicitationOptionSchema, elicitationFieldSchema, displayContentSchema, recordedDisplayContentSchema, promptImageSchema, promptResourceSchema, workspaceListCommandSchema, workspaceEntriesEventSchema, sessionIdentityFields, sessionPrepareCommandSchema, runtimeTimingsSchema, sessionReadyEventSchema, sessionConfigureCommandSchema, sessionConfigUpdatedEventSchema, sessionContextUsageUpdatedEventSchema, sessionPromptUsageUpdatedEventSchema, sessionUsageUpdatedEventSchema, sessionCommandsUpdatedEventSchema, sessionInfoUpdatedEventSchema, sessionPermissionRequestedEventSchema, sessionPermissionRespondCommandSchema, sessionPermissionResolvedEventSchema, sessionElicitationRequestedEventSchema, sessionElicitationRespondCommandSchema, sessionElicitationResolvedEventSchema, sessionOperationFailedEventSchema, agentContentEventSchema, agentInstallIdentityFields, agentInstallRequestCommandSchema, agentInstallCancelCommandSchema, agentInstallStartedEventSchema, installationStageSchema, agentInstallProgressEventSchema, agentInstallCompletedEventSchema, agentInstallFailedEventSchema, agentInstallCancelledEventSchema, decodeAgentDisplayContentValue, decodeRecordedAgentContentValue, decodePromptImagesValue, decodePromptResourcesValue, decodeSessionConfigurationSelections, encode32, decodeAgentSettingsDiscoverCommand, encodeAgentSettingsDiscoveredEvent, encodeAgentSettingsDiscoveryFailedEvent, decodeWorkspaceListCommand, encodeWorkspaceEntriesEvent, decodeSessionPrepareCommand, encodeSessionReadyEvent, decodeSessionConfigureCommand, encodeSessionConfigUpdatedEvent, encodeSessionUsageUpdatedEvent, encodeSessionCommandsUpdatedEvent, encodeSessionInfoUpdatedEvent, encodeSessionPermissionRequestedEvent, decodeSessionPermissionRespondCommand, encodeSessionPermissionResolvedEvent, encodeSessionElicitationRequestedEvent, decodeSessionElicitationRespondCommand, encodeSessionElicitationResolvedEvent, encodeSessionOperationFailedEvent, encodeAgentContentEvent, decodeAgentInstallRequestCommand, decodeAgentInstallCancelCommand, encodeAgentInstallStartedEvent, encodeAgentInstallProgressEvent, encodeAgentInstallCompletedEvent, encodeAgentInstallFailedEvent, encodeAgentInstallCancelledEvent, SESSION_PROMPT_KIND, SESSION_CANCEL_KIND, RUNTIME_LIVENESS_READY_KIND, RUNTIME_HEARTBEAT_KIND, RUNTIME_HEARTBEAT_ACK_KIND, RUNTIME_DELIVERY_KIND, RUNTIME_DELIVERY_RECEIVED_KIND, RUNTIME_DELIVERY_COMMITTED_KIND, SESSION_STARTED_KIND, AGENT_MESSAGE_DELTA_KIND, AGENT_ACTIVITY_KIND, AGENT_ACTIVITY_DETAIL_LIMIT, AGENT_ACTIVITY_RECORDED_FIELD_LIMIT, AGENT_ACTIVITY_RECORDED_DETAIL_LIMIT, AGENT_ACTIVITY_LOCATION_LIMIT, AGENT_ACTIVITY_LOCATION_LENGTH_LIMIT, SESSION_COMPLETED_KIND, SESSION_FAILED_KIND, SessionPromptDisposition, IDENTIFIER_PATTERN2, DIRECTORY_IDENTIFIER_PATTERN2, MAX_PROMPT_LENGTH, MAX_PROMPT_ATTACHMENT_LENGTH, MAX_EVENT_TEXT_LENGTH, MAX_RUNTIME_DELIVERY_PAYLOAD_LENGTH, ACTIVITY_TYPES, ACTIVITY_STATUSES, TOOL_KINDS, ProtocolMessageError, BOT_BINDING_APPROVAL_REQUEST_KIND, BOT_BINDING_APPROVED_KIND, BOT_BINDING_UNAVAILABLE_KIND, BOT_SESSION_PROMPT_KIND, IDENTIFIER_PATTERN3, DIRECTORY_IDENTIFIER_PATTERN3, TOKEN_PATTERN, SHA256_PATTERN, MAX_INSTRUCTIONS_LENGTH, BotDeliveryTargetReference, BotCompletionDeliveryPolicy, NoBotCompletionDeliveryPolicy, RequiredBotCompletionDeliveryPolicy, BotReplyRoute, OwnerBotReplyRoute, BotConnectionReplyRoute, BotExecutionBindingApprovalRequest, BotExecutionBindingApprovedEvent, BotExecutionBindingUnavailableEvent, BotSessionPromptCommand, MOBIUS_API_PREFIX, API_PREFIX_PATTERN, MobiusApiConfigurationError, SESSION_HISTORY_CHARACTER_LIMIT, SESSION_HISTORY_MESSAGE_LIMIT, SESSION_HISTORY_PREVIEW_MESSAGE_LIMIT, SESSION_HISTORY_IMAGE_CHARACTER_LIMIT, historyImage, historyMessage, sessionHistorySchema, NATIVE_SESSION_REQUEST_KIND, NATIVE_SESSION_RESULT_KIND, NATIVE_SESSION_CANCEL_KIND, NATIVE_SESSION_TURN_FORK_REQUEST_KIND, NATIVE_SESSION_TURN_FORK_KIND, identifier, directoryId, envelope, identity, turnForkIdentity, nativeSessionTurnForkRequestSchema, nativeSessionTurnForkCommandSchema, nativeSessionCommandSchema, nativeSessionEntrySchema, resultEnvelope, nativeSessionResultSchema, nativeSessionCancelSchema, decodeNativeSessionCommand, encodeNativeSessionResult, decodeNativeSessionCancel, decodeNativeSessionTurnForkCommand, SESSION_EVENT_KIND, SESSION_EVENT_ACK_KIND, SESSION_EVENT_COMMITTED_KIND, SESSION_EVENT_DEFERRED_KIND, SESSION_EVENT_REJECTED_KIND, SessionEventRejectionCode, IDENTIFIER_PATTERN4, CURSOR_PATTERN, MAX_RECORDED_EVENT_LENGTH, DECIMAL_SEQUENCE_PATTERN, eventSourceSchema, eventEnvelopeSchema, committedEventSchema, eventAcknowledgementSchema, eventDeferredSchema, eventRejectionSchema, encode4, decodeSessionEventEnvelope, encodeSessionEventEnvelope, decodeSessionEventAcknowledgement, decodeSessionEventDeferred, decodeSessionEventRejection, DEFAULT_OUTPUT_LIMIT_BYTES, PROCESS_GRACEFUL_STOP_TIMEOUT_MILLISECONDS, PROCESS_FORCED_STOP_TIMEOUT_MILLISECONDS, PROCESS_TABLE_TIMEOUT_MILLISECONDS, PROCESS_TABLE_OUTPUT_LIMIT_BYTES, PROCESS_EXIT_CHECK_ATTEMPTS, GRACEFUL_STOP_SIGNAL, FORCED_STOP_SIGNAL, ExecutableIdentity, ResolvedExecutable, ProcessExecutionError, ProcessResult, LocalAgentDefinition, InstallableAgentDefinition, MissingAgentDefinition, AgentIntegrationDefinition, LocalAgentCatalogSnapshot, LocalAgentCatalogError, LocalAgentCatalog, MAX_LOCAL_RASTER_BYTES, PNG_SIGNATURE, JPEG_SIGNATURE, GIF87_SIGNATURE, GIF89_SIGNATURE, RIFF_SIGNATURE, WEBP_SIGNATURE, LocalRasterImage, AccumulatingOperationMetrics, unmeasuredOperationMetrics, IMAGE_MARKER, TRUNCATION_MARKER, AcpActivity, ActivityIdentity, AcpActivityTracker, emptyOptions2, characterEntities2, own22, hasOwnProperty2, asciiAlpha2, asciiAlphanumeric2, asciiAtext2, asciiDigit2, asciiHexDigit2, asciiPunctuation2, unicodePunctuation2, unicodeWhitespace2, content3, document4, containerConstruct2, attention2, autolink2, blankLine2, blockQuote2, characterEscape2, characterReference2, nonLazyContinuation2, codeFenced2, codeIndented2, furtherStart2, codeText2, SpliceBuffer2, content22, continuationConstruct2, definition2, titleBefore2, hardBreakEscape2, headingAtx2, htmlBlockNames2, htmlRawNames2, htmlFlow2, blankLineBefore2, nonLazyContinuationStart2, htmlText2, labelEnd2, resourceConstruct2, referenceFullConstruct2, referenceCollapsedConstruct2, labelStartImage2, labelStartLink2, lineEnding2, thematicBreak2, list2, listItemPrefixWhitespaceConstruct2, indentConstruct2, setextUnderline2, flow3, resolver2, string42, text3, constructs_exports2, document22, contentInitial2, flowInitial2, flow22, string52, text22, insideSpan2, attentionMarkers2, disable2, search2, characterEscapeOrReference2, own32, convert2, empty2, CONTINUE2, EXIT2, SKIP2, path2, title, nativeSessionIdSchema, nativeSessionInfoSchema, nativeSessionPageSchema, AGENT_DEFAULT_REASONING_EFFORT, MAXIMUM_CONFIG_OPTIONS, SessionConfigProtocolError, StandardSessionConfigProtocol, standardSessionConfigProtocol, LEGACY_MODEL_CONFIG_ID, LEGACY_REASONING_EFFORT_CONFIG_ID, GrokBuildSessionConfigProtocol, grokBuildSessionConfigProtocol, AcpHistoryReplay, AcpStoredSession, AcpStoredSessionLookup, MissingAcpStoredSession, FoundAcpStoredSession, DeletedAcpStoredSession, MemoryAcpSessionStore, SqliteAcpSessionStore, PROCESS_STOP_TIMEOUT_MILLISECONDS, MAX_PRE_SESSION_UPDATES, MAX_PRE_SESSION_UPDATE_BYTES, SESSION_CONTROL_COMMAND_ID, NullAcpSessionObserver, AcpPreparedSession, AcpAgentSettingsSnapshot, AcpExecutionError, RetryableAcpInitializationError, AcpTurnState, IdleAcpTurn, RunningAcpTurn, PendingPermission, PendingElicitation, AcpProcessSession, AcpSessionManager, AuditStore, LocalAuthorizationError, LOCAL_BOT_GRANT_LIFETIME_MILLISECONDS, identifier2, savedApprovalSchema, LocalBotAuthorizationError, LocalBotGrant, LocalBotGrantStore, ActiveBotExecutionContext, BotExecutionContextLease, BotExecutionContextRegistry, BOT_IPC_RESPONSE_LIMIT, BOT_IPC_TIMEOUT_MILLISECONDS, BotMessageCommandError, BOT_IPC_REQUEST_LIMIT, BOT_IPC_TIMEOUT_MILLISECONDS2, BOT_RELAY_TIMEOUT_MILLISECONDS, IDENTIFIER_PATTERN5, WINDOWS_NAMED_PIPE_PREFIX, BotOutboundIpcRequest, BotOutboundIpcServer, AgentDiscovery, AvailableAgent, UnavailableAgent, UnavailableInstalledAgent, MissingAdapter, MissingAgent, AgentProbeFailed, IntegrationProbeFailed, IncompatibleAdapter, AuthenticationRequiredAgent, LocalAgentInventory, INSTALL_TIMEOUT_MILLISECONDS, PACKAGE_METADATA_LIMIT_BYTES, PACKAGE_LOCK_LIMIT_BYTES, ManagedNpmPackageDefinition, SriManagedNpmPackageDefinition, SriManagedNpmDependencyDefinition, ManagedNpmPackageError, ManagedNpmPackageInstaller, VERSION_PROBE_TIMEOUT_MILLISECONDS, ACP_PROBE_TIMEOUT_MILLISECONDS, DEFAULT_PROMPT_TIMEOUT_MILLISECONDS, LocalAgentSpecification, DirectAcpAgentDefinition, BridgedAcpAgentDefinition, ClaudeCodeAgentSpecification, CodexAgentSpecification, AgentProbeError, COPILOT_CLI_TESTED_VERSION, CopilotCliAgentSpecification, CURSOR_CLI_TESTED_VERSION, CursorCliAgentSpecification, DeepSeekHarnessManagedPackage, DEEPSEEK_HARNESS_PACKAGE, DeepSeekHarnessAgentSpecification, GEMINI_CLI_TESTED_VERSION, GeminiCliAgentSpecification, GROK_BUILD_MANAGED_VERSION, GrokBuildManagedPackage, GROK_DARWIN_ARM64_PACKAGE, GROK_DARWIN_X64_PACKAGE, GROK_LINUX_ARM64_PACKAGE, GROK_LINUX_X64_PACKAGE, GrokBuildAgentSpecification, HERMES_TESTED_VERSION, HermesAgentSpecification, configuredHttpProxy, configuredHttpsProxy, environmentProxyDispatcher, ARCHIVE_DOWNLOAD_LIMIT_BYTES, ARCHIVE_DOWNLOAD_TIMEOUT_MILLISECONDS, MANIFEST_LIMIT_BYTES, ManagedAgentArchiveDefinition, ZipManagedAgentArchiveDefinition, TarGzipManagedAgentArchiveDefinition, ManagedAgentArchiveError, OPENCODE_MANAGED_VERSION, OpenCodeAgentSpecification, PI_ACP_PACKAGE, PI_AGENT_PACKAGE, ACP_PROBE_TIMEOUT_MILLISECONDS2, PROMPT_TIMEOUT_MILLISECONDS, PiAgentSpecification, WORKBUDDY_MANAGED_VERSION, WorkBuddyManagedPackage, WORKBUDDY_MANAGED_PACKAGE, WORKBUDDY_MACOS_EXECUTABLE_PATH, WorkBuddyAgentSpecification, ACP_OUTPUT_LIMIT_BYTES, VerifiedAcpReadiness, DiscoveryAcpHandler, ManagedAdapterInstallError, ManagedAdapterInstaller, VerifiedAgentExecutable, PAIRING_TIMEOUT_MILLISECONDS, PAIRING_CODE_PATTERN, IDENTIFIER_PATTERN6, TOKEN_PATTERN2, MAX_CONNECTION_FILE_LENGTH, CLAIM_RESPONSE_KEYS, REDEEM_RESPONSE_KEYS, LEGACY_SAVED_CONNECTION_KEYS, SAVED_CONNECTION_KEYS, PairingClientError, CATALOG_UPDATE_TIMEOUT_MILLISECONDS, AgentCatalogPublishError, INSTALLATION_DEADLINE_MILLISECONDS, AgentInstallation, RequestedInstallation, RunningInstallation, SucceededInstallation, FailedInstallation, CancelledInstallation, InstallationManagerError, NullInstallationAudit, InstallationJob, AgentInstallationManager, FixedInstallationExecutor, MobiusError, MobiusProtocolError, MobiusValidationError, IDENTIFIER_PATTERN7, MobiusArtifactUploadRequest, MobiusArtifact, MobiusUploadingArtifact, MobiusArtifactUpload, MobiusAvailableArtifact, MobiusExpiredArtifact, MobiusRuntimePairingLifecycle, UPLOAD_TIMEOUT_MILLISECONDS, RuntimeArtifactUploadError, UploadedRuntimeArtifact, WorkspaceDirectoryListing, WorkspaceDirectoryService, AppliedBotContext, EmbeddedBotContextApplicator, responseSchema, threadSchema, turnsSchema, itemTypeSchema, userMessageSchema, textSchema, imageSchema, agentMessageSchema, NativeSessionService, ARTIFACT_SCHEME, ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS, MAX_AGENT_IMAGE_BASE64_LENGTH, MAX_AGENT_RESOURCE_BYTE_LENGTH, IDENTIFIER_PATTERN8, PromptArtifactError, ResolvedPromptArtifacts, PromptArtifactReference, CONNECTION_TIMEOUT_MILLISECONDS, RelayConnectionError, MAX_DIAGNOSTIC_TEXT_LENGTH, RelayConnectionDiagnostics, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS, HEARTBEAT_INTERVAL_MILLISECONDS, RelayLivenessState, UnsupportedRelayLivenessState, AwaitingHeartbeatAckState, WaitingForHeartbeatState, FinishedRelayLivenessState, RelayConnectionLiveness, DEFAULT_OUTBOX_LIMITS, SessionEventOutboxCapacityError, RuntimeDeliveryInboxCapacityError, StoredRuntimeDelivery, SessionEventOutbox, SystemDaemonTimer, systemDaemonTimer, RELAY_RECONNECT_DELAY_MILLISECONDS, AGENT_ACTIVITY_COALESCING_MILLISECONDS, ACTIVE_TURN_RECONCILIATION_TIMEOUT_MILLISECONDS, ACTIVE_TURN_RECONCILIATION_CLOSE_CODE, DaemonAcpObserver, AuditInstallationEvents, DaemonInstallationObserver, ResolvedSessionDirectories, ActiveDaemonTurn, ActiveTurnReconciliationError, DaemonSessionEventConnectionState, DisconnectedDaemonSessionEventState, ConnectedDaemonSessionEventState, SESSION_EVENT_REPLAY_WINDOW, SESSION_EVENT_SOURCE_REPLAY_WINDOW, SESSION_EVENT_REPLAY_BYTE_LIMIT, InFlightSessionEvent, DaemonSessionEventPublisher, CoalescingDaemonActivityPublisher, IDENTIFIER_PATTERN9, RUNTIME_CREDENTIAL_PATTERN, MobiusRuntimeConfigurationError, MobiusRuntimeState, IdleMobiusRuntimeState, RunningMobiusRuntimeState, FinishedMobiusRuntimeState, MobiusRuntimeEngine;
86556
+ var import_node_path16, import_node_url, import_node_fs4, import_node_child_process9, import_node_fs5, import_promises20, import_node_path17, import_node_os11, import_node_path18, import_node_child_process10, import_promises21, import_node_path19, import_node_url2, import_node_fs6, import_node_path20, import_node_sqlite, import_node_fs7, import_node_path21, import_node_sqlite2, import_node_crypto11, import_node_crypto12, import_node_sqlite3, import_node_crypto13, import_node_net2, import_promises22, import_node_net3, import_node_path22, import_undici, import_node_crypto14, import_promises23, import_node_os12, import_node_path23, import_undici2, import_promises24, import_node_path24, import_node_path25, import_node_path26, import_promises25, import_node_path27, import_promises26, import_node_path28, import_node_path29, import_node_crypto15, import_node_fs8, import_promises27, import_node_path30, import_undici3, import_undici4, import_node_path31, import_node_path32, import_node_child_process11, import_node_path33, import_node_path34, import_node_crypto16, import_node_path35, import_node_util6, import_undici5, import_undici6, import_node_fs9, import_node_path36, import_node_crypto17, import_undici7, import_promises28, import_node_os13, import_node_path37, import_node_crypto18, import_node_path38, import_node_child_process12, import_node_crypto19, import_undici8, import_undici9, import_node_crypto20, import_node_fs10, import_node_path39, import_node_sqlite4, import_promises29, import_node_path40, __defProp2, __export2, createAcpClient, external_exports2, core_exports22, util_exports2, Cached2, EVALUATING2, captureStackTrace2, allowsEval2, getParsedType2, propertyKeyTypes2, primitiveTypes2, NUMBER_FORMAT_RANGES2, BIGINT_FORMAT_RANGES2, highSurrogate2, Class2, installing2, broke2, breaker2, CONSTANT_CATCH2, _a4, NEVER2, _zodDesc2, _E2, $brand2, $ZodAsyncError2, $ZodEncodeError2, globalConfig2, _messageDesc2, _issuesDesc2, _installedToString2, initializer3, $ZodError2, $ZodRealError2, _parse3, parse4, _parseAsync3, parseAsync3, _safeParse2, safeParse3, _safeParseAsync2, safeParseAsync3, COMPILE_INVALID2, COMPILE_FALLBACK2, validate2, validateAsync3, _encode3, encode3, _decode3, decode4, _encodeAsync3, encodeAsync3, _decodeAsync3, decodeAsync3, _safeEncode2, safeEncode3, _safeDecode2, safeDecode3, _safeEncodeAsync2, safeEncodeAsync3, _safeDecodeAsync2, safeDecodeAsync3, regexes_exports2, cuid4, cuid23, ulid3, xid3, ksuid3, nanoid3, duration3, extendedDuration2, guid3, uuid3, uuid42, uuid62, uuid72, email3, html5Email2, rfc5322Email2, unicodeEmail2, idnEmail2, browserEmail2, _emoji3, ipv43, ipv63, mac3, cidrv43, cidrv63, base643, base64url3, hostname5, domain2, httpProtocol2, e1643, creditCard3, iban3, dateSource2, date5, anyString2, string6, bigint4, integer2, number4, boolean4, _null4, _undefined4, lowercase2, uppercase2, hex3, md5_hex2, md5_base642, md5_base64url2, sha1_hex2, sha1_base642, sha1_base64url2, sha256_hex2, sha256_base642, sha256_base64url2, sha384_hex2, sha384_base642, sha384_base64url2, sha512_hex2, sha512_base642, sha512_base64url2, $ZodCheck2, _whenHasSize2, _whenHasLength2, numericOriginMap2, $ZodCheckLessThan2, $ZodCheckGreaterThan2, $ZodCheckMultipleOf2, $ZodCheckNumberFormat2, $ZodCheckBigIntFormat2, $ZodCheckMaxSize2, $ZodCheckMinSize2, $ZodCheckSizeEquals2, $ZodCheckMaxLength2, $ZodCheckMinLength2, $ZodCheckLengthEquals2, $ZodCheckStringFormat2, $ZodCheckRegex2, $ZodCheckLowerCase2, $ZodCheckUpperCase2, $ZodCheckIncludes2, $ZodCheckStartsWith2, $ZodCheckEndsWith2, $ZodCheckProperty2, $ZodCheckMimeType2, $ZodCheckOverwrite2, Doc2, version2, $ZodType2, toStandardResult2, $ZodString2, $ZodStringFormat2, $ZodGUID2, $ZodUUID2, $ZodEmail2, URL_BAD_FORMAT2, URL_UNPARSEABLE2, asciiTabOrNewline2, $ZodURL2, $ZodEmoji2, $ZodNanoID2, $ZodCUID3, $ZodCUID22, $ZodULID2, $ZodXID2, $ZodKSUID2, $ZodISODateTime2, $ZodISODate2, $ZodISOTime2, $ZodISODuration2, $ZodIPv42, ipv6Alphabet2, $ZodIPv62, $ZodMAC2, $ZodCIDRv42, $ZodCIDRv62, base64Charset2, $ZodBase642, base64urlCharset2, $ZodBase64URL2, $ZodE1642, CC_SANITIZE2, $ZodCreditCard2, $ZodIBAN2, $ZodJWT2, $ZodCustomStringFormat2, $ZodNumber2, $ZodNumberFormat2, $ZodBoolean2, $ZodBigInt2, $ZodBigIntFormat2, $ZodSymbol2, $ZodUndefined2, $ZodNull2, $ZodAny2, $ZodUnknown2, $ZodNever2, $ZodVoid2, $ZodDate2, $ZodArray2, NO_SYMBOL_KEYS2, $ZodObject2, $ZodObjectJIT2, $ZodUnion2, $ZodXor2, $ZodDiscriminatedUnion2, $ZodIntersection2, $ZodTuple2, $ZodRecord2, $ZodMap2, $ZodSet2, $ZodEnum2, $ZodLiteral2, $ZodFile2, $ZodTransform2, $ZodOptional2, $ZodExactOptional2, $ZodNullable2, $ZodDefault2, $ZodPrefault2, $ZodNonOptional2, $ZodSuccess2, $ZodCatch2, $ZodNaN2, $ZodPipe2, $ZodCodec2, $ZodPreprocess2, $ZodReadonly2, $ZodTemplateLiteral2, $ZodFunction2, $ZodPromise2, $ZodLazy2, $ZodCustom2, $ZodProperties, $ZodCyclicError2, STATE2, NO_ISSUES2, recursive2, NONE2, ASSUMED2, PROVEN2, handoff2, open5, memo2, locales_exports2, error62, error210, error310, error410, error510, error63, error72, error82, error92, error102, error112, error122, error132, error142, error152, error162, error172, error182, error192, error202, error212, error222, error232, error242, error252, error262, error272, error282, error292, error302, error312, error322, capitalizeFirstCharacter2, error332, error342, error352, error362, error372, error382, error392, error402, error412, error422, error432, error442, error452, error462, error472, error482, error492, error502, error512, error522, error532, error542, error552, error562, error572, error582, error592, error602, error612, _a22, $output2, $input2, $ZodRegistry2, globalRegistry2, INVALID2, FALLBACK_FLAG2, ZodCompileAsyncError2, ZodCompileUnsupportedError2, WHEN_DEFAULTED_CHECKS2, PATTERN_IS_COMPLETE2, TimePrecision2, FOLDABLE_KEYS2, UNION_KEYS2, createToJSONSchemaMethod2, createStandardJSONSchemaMethod2, narrowMin2, narrowMax2, narrowBoth2, addDivisor2, addPattern2, intersectMime2, setFormat2, minContributor2, maxContributor2, formatContributor2, contributors2, formatMap2, exactPatterns2, exactPattern2, stringProcessor2, numberProcessor2, booleanProcessor2, bigintProcessor2, symbolProcessor2, nullProcessor2, undefinedProcessor2, voidProcessor2, neverProcessor2, anyProcessor2, unknownProcessor2, dateProcessor2, enumProcessor2, literalProcessor2, nanProcessor2, templateLiteralProcessor2, fileProcessor2, successProcessor2, customProcessor2, functionProcessor2, transformProcessor2, mapProcessor2, setProcessor2, arrayProcessor2, objectProcessor2, propertiesProcessor, unionProcessor2, intersectionProcessor2, tupleProcessor2, pendingRecords2, recordProcessor2, nullableProcessor2, nonoptionalProcessor2, UNREPRESENTABLE_DEFAULT2, defaultProcessor2, prefaultProcessor2, catchProcessor2, pipeProcessor2, readonlyProcessor2, promiseProcessor2, optionalProcessor2, lazyProcessor2, allProcessors2, JSONSchemaGenerator2, json_schema_exports2, schemas_exports22, checks_exports22, _installedErrorProtos2, initializer22, ZodError2, ZodRealError2, parse22, parseAsync22, safeParse22, safeParseAsync22, encode22, decode22, encodeAsync22, decodeAsync22, safeEncode22, safeDecode22, safeEncodeAsync22, safeDecodeAsync22, ZodType2, _ZodString2, ZodString2, ZodStringFormat2, ZodISODateTime2, ZodISODate2, ZodISOTime2, ZodISODuration2, ZodEmail2, ZodGUID2, ZodUUID2, ZodURL2, ZodEmoji2, ZodNanoID2, ZodCUID3, ZodCUID22, ZodULID2, ZodXID2, ZodKSUID2, ZodIPv42, ZodMAC2, ZodIPv62, ZodCIDRv42, ZodCIDRv62, ZodBase642, ZodBase64URL2, ZodE1642, ZodCreditCard2, ZodIBAN2, ZodJWT2, ZodCustomStringFormat2, ZodNumber2, ZodNumberFormat2, ZodBoolean2, ZodBigInt2, ZodBigIntFormat2, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown2, ZodNever2, ZodVoid2, ZodDate2, ZodArray2, ZodObject2, ZodUnion2, ZodXor2, ZodDiscriminatedUnion2, ZodIntersection2, ZodTuple2, ZodRecord2, ZodMap2, ZodSet2, ZodEnum2, ZodLiteral2, ZodFile2, ZodTransform2, ZodOptional2, ZodExactOptional2, ZodNullable2, ZodDefault2, ZodPrefault2, ZodNonOptional2, ZodSuccess2, ZodCatch2, ZodNaN2, ZodPipe2, ZodCodec2, ZodPreprocess2, ZodReadonly2, ZodTemplateLiteral2, ZodLazy2, ZodPromise2, ZodFunction2, ZodCustom2, ZodProperties, describe22, meta22, ZodInstanceOf2, stringbool2, ZodIssueCode2, ZodFirstPartyTypeKind2, iso_exports2, z2, RECOGNIZED_KEYS2, SCHEMA_KEYWORDS2, SCHEMA_MAP_KEYWORDS2, fullTime2, RESOLVING2, coerce_exports2, TOKEN_COUNT, promptUsageSchema, quotaTokenCountSchema, promptMetadataSchema, agentPromptResponseSchema, WORKSPACE_LIST_KIND, WORKSPACE_ENTRIES_KIND, SESSION_PREPARE_KIND, SESSION_READY_KIND, SESSION_CONFIGURE_KIND, SESSION_CONFIG_UPDATED_KIND, SESSION_USAGE_UPDATED_KIND, SESSION_COMMANDS_UPDATED_KIND, SESSION_INFO_UPDATED_KIND, SESSION_PERMISSION_REQUESTED_KIND, SESSION_PERMISSION_RESPOND_KIND, SESSION_PERMISSION_RESOLVED_KIND, SESSION_ELICITATION_REQUESTED_KIND, SESSION_ELICITATION_RESPOND_KIND, SESSION_ELICITATION_RESOLVED_KIND, SESSION_OPERATION_FAILED_KIND, AGENT_CONTENT_KIND, AGENT_INSTALL_REQUEST_KIND, AGENT_INSTALL_CANCEL_KIND, AGENT_INSTALL_STARTED_KIND, AGENT_INSTALL_PROGRESS_KIND, AGENT_INSTALL_COMPLETED_KIND, AGENT_INSTALL_FAILED_KIND, AGENT_INSTALL_CANCELLED_KIND, AGENT_SETTINGS_DISCOVER_KIND, AGENT_SETTINGS_DISCOVERED_KIND, AGENT_SETTINGS_DISCOVERY_FAILED_KIND, IDENTIFIER_PATTERN, DIRECTORY_IDENTIFIER_PATTERN, IDENTIFIER, DIRECTORY_IDENTIFIER, SHORT_TEXT, LONG_TEXT, workspaceEntrySchema, configValueSchema, sessionConfigOptionSchema, sessionConfigOptionsSchema, agentSettingsDiscoverCommandSchema, agentSettingsDiscoveredEventSchema, agentSettingsDiscoveryFailedEventSchema, sessionConfigurationSelectionSchema, sessionConfigurationSelectionsSchema, sessionCapabilitiesSchema, sessionCommandSchema, permissionOptionSchema, elicitationOptionSchema, elicitationFieldSchema, displayContentSchema, recordedDisplayContentSchema, promptImageSchema, promptResourceSchema, workspaceListCommandSchema, workspaceEntriesEventSchema, sessionIdentityFields, sessionPrepareCommandSchema, runtimeTimingsSchema, sessionReadyEventSchema, sessionConfigureCommandSchema, sessionConfigUpdatedEventSchema, sessionContextUsageUpdatedEventSchema, sessionPromptUsageUpdatedEventSchema, sessionUsageUpdatedEventSchema, sessionCommandsUpdatedEventSchema, sessionInfoUpdatedEventSchema, sessionPermissionRequestedEventSchema, sessionPermissionRespondCommandSchema, sessionPermissionResolvedEventSchema, sessionElicitationRequestedEventSchema, sessionElicitationRespondCommandSchema, sessionElicitationResolvedEventSchema, sessionOperationFailedEventSchema, agentContentEventSchema, agentInstallIdentityFields, agentInstallRequestCommandSchema, agentInstallCancelCommandSchema, agentInstallStartedEventSchema, installationStageSchema, agentInstallProgressEventSchema, agentInstallCompletedEventSchema, agentInstallFailedEventSchema, agentInstallCancelledEventSchema, decodeAgentDisplayContentValue, decodeRecordedAgentContentValue, decodePromptImagesValue, decodePromptResourcesValue, decodeSessionConfigurationSelections, encode32, decodeAgentSettingsDiscoverCommand, encodeAgentSettingsDiscoveredEvent, encodeAgentSettingsDiscoveryFailedEvent, decodeWorkspaceListCommand, encodeWorkspaceEntriesEvent, decodeSessionPrepareCommand, encodeSessionReadyEvent, decodeSessionConfigureCommand, encodeSessionConfigUpdatedEvent, encodeSessionUsageUpdatedEvent, encodeSessionCommandsUpdatedEvent, encodeSessionInfoUpdatedEvent, encodeSessionPermissionRequestedEvent, decodeSessionPermissionRespondCommand, encodeSessionPermissionResolvedEvent, encodeSessionElicitationRequestedEvent, decodeSessionElicitationRespondCommand, encodeSessionElicitationResolvedEvent, encodeSessionOperationFailedEvent, encodeAgentContentEvent, decodeAgentInstallRequestCommand, decodeAgentInstallCancelCommand, encodeAgentInstallStartedEvent, encodeAgentInstallProgressEvent, encodeAgentInstallCompletedEvent, encodeAgentInstallFailedEvent, encodeAgentInstallCancelledEvent, SESSION_PROMPT_KIND, SESSION_CANCEL_KIND, RUNTIME_LIVENESS_READY_KIND, RUNTIME_HEARTBEAT_KIND, RUNTIME_HEARTBEAT_ACK_KIND, RUNTIME_DELIVERY_KIND, RUNTIME_DELIVERY_RECEIVED_KIND, RUNTIME_DELIVERY_COMMITTED_KIND, SESSION_STARTED_KIND, AGENT_MESSAGE_DELTA_KIND, AGENT_ACTIVITY_KIND, AGENT_ACTIVITY_DETAIL_LIMIT, AGENT_ACTIVITY_RECORDED_FIELD_LIMIT, AGENT_ACTIVITY_RECORDED_DETAIL_LIMIT, AGENT_ACTIVITY_LOCATION_LIMIT, AGENT_ACTIVITY_LOCATION_LENGTH_LIMIT, SESSION_COMPLETED_KIND, SESSION_FAILED_KIND, SessionPromptDisposition, IDENTIFIER_PATTERN2, DIRECTORY_IDENTIFIER_PATTERN2, MAX_PROMPT_LENGTH, MAX_PROMPT_ATTACHMENT_LENGTH, MAX_EVENT_TEXT_LENGTH, MAX_RUNTIME_DELIVERY_PAYLOAD_LENGTH, ACTIVITY_TYPES, ACTIVITY_STATUSES, TOOL_KINDS, ProtocolMessageError, BOT_BINDING_APPROVAL_REQUEST_KIND, BOT_BINDING_APPROVED_KIND, BOT_BINDING_UNAVAILABLE_KIND, BOT_SESSION_PROMPT_KIND, IDENTIFIER_PATTERN3, DIRECTORY_IDENTIFIER_PATTERN3, TOKEN_PATTERN, SHA256_PATTERN, MAX_INSTRUCTIONS_LENGTH, BotDeliveryTargetReference, BotCompletionDeliveryPolicy, NoBotCompletionDeliveryPolicy, RequiredBotCompletionDeliveryPolicy, BotReplyRoute, OwnerBotReplyRoute, BotConnectionReplyRoute, BotExecutionBindingApprovalRequest, BotExecutionBindingApprovedEvent, BotExecutionBindingUnavailableEvent, BotSessionPromptCommand, MOBIUS_API_PREFIX, API_PREFIX_PATTERN, MobiusApiConfigurationError, SESSION_HISTORY_CHARACTER_LIMIT, SESSION_HISTORY_MESSAGE_LIMIT, SESSION_HISTORY_PREVIEW_MESSAGE_LIMIT, SESSION_HISTORY_IMAGE_CHARACTER_LIMIT, historyImage, historyMessage, sessionHistorySchema, NATIVE_SESSION_REQUEST_KIND, NATIVE_SESSION_RESULT_KIND, NATIVE_SESSION_CANCEL_KIND, NATIVE_SESSION_TURN_FORK_REQUEST_KIND, NATIVE_SESSION_TURN_FORK_KIND, identifier, directoryId, envelope, identity, turnForkIdentity, nativeSessionTurnForkRequestSchema, nativeSessionTurnForkCommandSchema, nativeSessionCommandSchema, nativeSessionEntrySchema, resultEnvelope, nativeSessionResultSchema, nativeSessionCancelSchema, decodeNativeSessionCommand, encodeNativeSessionResult, decodeNativeSessionCancel, decodeNativeSessionTurnForkCommand, SESSION_EVENT_KIND, SESSION_EVENT_ACK_KIND, SESSION_EVENT_COMMITTED_KIND, SESSION_EVENT_DEFERRED_KIND, SESSION_EVENT_REJECTED_KIND, SessionEventRejectionCode, IDENTIFIER_PATTERN4, CURSOR_PATTERN, MAX_RECORDED_EVENT_LENGTH, DECIMAL_SEQUENCE_PATTERN, eventSourceSchema, eventEnvelopeSchema, committedEventSchema, eventAcknowledgementSchema, eventDeferredSchema, eventRejectionSchema, encode4, decodeSessionEventEnvelope, encodeSessionEventEnvelope, decodeSessionEventAcknowledgement, decodeSessionEventDeferred, decodeSessionEventRejection, DEFAULT_OUTPUT_LIMIT_BYTES, PROCESS_GRACEFUL_STOP_TIMEOUT_MILLISECONDS, PROCESS_FORCED_STOP_TIMEOUT_MILLISECONDS, PROCESS_TABLE_TIMEOUT_MILLISECONDS, PROCESS_TABLE_OUTPUT_LIMIT_BYTES, PROCESS_EXIT_CHECK_ATTEMPTS, GRACEFUL_STOP_SIGNAL, FORCED_STOP_SIGNAL, ExecutableIdentity, ResolvedExecutable, ProcessExecutionError, ProcessResult, LocalAgentDefinition, InstallableAgentDefinition, MissingAgentDefinition, AgentIntegrationDefinition, LocalAgentCatalogSnapshot, LocalAgentCatalogError, LocalAgentCatalog, MAX_LOCAL_RASTER_BYTES, PNG_SIGNATURE, JPEG_SIGNATURE, GIF87_SIGNATURE, GIF89_SIGNATURE, RIFF_SIGNATURE, WEBP_SIGNATURE, LocalRasterImage, AccumulatingOperationMetrics, unmeasuredOperationMetrics, IMAGE_MARKER, TRUNCATION_MARKER, AcpActivity, ActivityIdentity, AcpActivityTracker, emptyOptions2, characterEntities2, own22, hasOwnProperty2, asciiAlpha2, asciiAlphanumeric2, asciiAtext2, asciiDigit2, asciiHexDigit2, asciiPunctuation2, unicodePunctuation2, unicodeWhitespace2, content3, document4, containerConstruct2, attention2, autolink2, blankLine2, blockQuote2, characterEscape2, characterReference2, nonLazyContinuation2, codeFenced2, codeIndented2, furtherStart2, codeText2, SpliceBuffer2, content22, continuationConstruct2, definition2, titleBefore2, hardBreakEscape2, headingAtx2, htmlBlockNames2, htmlRawNames2, htmlFlow2, blankLineBefore2, nonLazyContinuationStart2, htmlText2, labelEnd2, resourceConstruct2, referenceFullConstruct2, referenceCollapsedConstruct2, labelStartImage2, labelStartLink2, lineEnding2, thematicBreak2, list2, listItemPrefixWhitespaceConstruct2, indentConstruct2, setextUnderline2, flow3, resolver2, string42, text3, constructs_exports2, document22, contentInitial2, flowInitial2, flow22, string52, text22, insideSpan2, attentionMarkers2, disable2, search2, characterEscapeOrReference2, own32, convert2, empty2, CONTINUE2, EXIT2, SKIP2, path2, title, nativeSessionIdSchema, nativeSessionInfoSchema, nativeSessionPageSchema, AGENT_DEFAULT_REASONING_EFFORT, MAXIMUM_CONFIG_OPTIONS, SessionConfigProtocolError, StandardSessionConfigProtocol, standardSessionConfigProtocol, LEGACY_MODEL_CONFIG_ID, LEGACY_REASONING_EFFORT_CONFIG_ID, GrokBuildSessionConfigProtocol, grokBuildSessionConfigProtocol, AcpHistoryReplay, AcpStoredSession, AcpStoredSessionLookup, MissingAcpStoredSession, FoundAcpStoredSession, DeletedAcpStoredSession, MemoryAcpSessionStore, SqliteAcpSessionStore, PROCESS_STOP_TIMEOUT_MILLISECONDS, MAX_ACP_PROCESSES, MAX_PRE_SESSION_UPDATES, MAX_PRE_SESSION_UPDATE_BYTES, SESSION_CONTROL_COMMAND_ID, NullAcpSessionObserver, AcpPreparedSession, AcpAgentSettingsSnapshot, AcpExecutionError, RetryableAcpInitializationError, AcpProcessCapacityLease, AcpProcessCapacityWaiter, AcpProcessCapacityLock, AcpTurnState, IdleAcpTurn, RunningAcpTurn, PendingPermission, PendingElicitation, AcpProcessSession, AcpProcessEvictionCandidate, MissingAcpProcessEvictionCandidate, FoundAcpProcessEvictionCandidate, FoundAcpSessionProcessEvictionCandidate, FoundAcpNativeBrowserProcessEvictionCandidate, AcpSessionManager, AuditStore, LocalAuthorizationError, LOCAL_BOT_GRANT_LIFETIME_MILLISECONDS, LocalBotAuthorizationError, LocalBotGrant, LocalBotGrantStore, ActiveBotExecutionContext, BotExecutionContextLease, BotExecutionContextRegistry, BOT_IPC_RESPONSE_LIMIT, BOT_IPC_TIMEOUT_MILLISECONDS, BotMessageCommandError, BOT_IPC_REQUEST_LIMIT, BOT_IPC_TIMEOUT_MILLISECONDS2, BOT_RELAY_TIMEOUT_MILLISECONDS, IDENTIFIER_PATTERN5, WINDOWS_NAMED_PIPE_PREFIX, BotOutboundIpcRequest, BotOutboundIpcServer, AgentDiscovery, AvailableAgent, UnavailableAgent, UnavailableInstalledAgent, MissingAdapter, MissingAgent, AgentProbeFailed, IntegrationProbeFailed, IncompatibleAdapter, AuthenticationRequiredAgent, LocalAgentInventory, INSTALL_TIMEOUT_MILLISECONDS, PACKAGE_METADATA_LIMIT_BYTES, PACKAGE_LOCK_LIMIT_BYTES, ManagedNpmPackageDefinition, SriManagedNpmPackageDefinition, SriManagedNpmDependencyDefinition, ManagedNpmPackageError, ManagedNpmPackageInstaller, VERSION_PROBE_TIMEOUT_MILLISECONDS, ACP_PROBE_TIMEOUT_MILLISECONDS, DEFAULT_PROMPT_TIMEOUT_MILLISECONDS, LocalAgentSpecification, DirectAcpAgentDefinition, BridgedAcpAgentDefinition, ClaudeCodeAgentSpecification, CodexAgentSpecification, AgentProbeError, COPILOT_CLI_TESTED_VERSION, CopilotCliAgentSpecification, CURSOR_CLI_TESTED_VERSION, CursorCliAgentSpecification, DeepSeekHarnessManagedPackage, DEEPSEEK_HARNESS_PACKAGE, DeepSeekHarnessAgentSpecification, GEMINI_CLI_TESTED_VERSION, GeminiCliAgentSpecification, GROK_BUILD_MANAGED_VERSION, GrokBuildManagedPackage, GROK_DARWIN_ARM64_PACKAGE, GROK_DARWIN_X64_PACKAGE, GROK_LINUX_ARM64_PACKAGE, GROK_LINUX_X64_PACKAGE, GrokBuildAgentSpecification, HERMES_TESTED_VERSION, HermesAgentSpecification, configuredHttpProxy, configuredHttpsProxy, environmentProxyDispatcher, ARCHIVE_DOWNLOAD_LIMIT_BYTES, ARCHIVE_DOWNLOAD_TIMEOUT_MILLISECONDS, MANIFEST_LIMIT_BYTES, ManagedAgentArchiveDefinition, ZipManagedAgentArchiveDefinition, TarGzipManagedAgentArchiveDefinition, ManagedAgentArchiveError, OPENCODE_MANAGED_VERSION, OpenCodeAgentSpecification, PI_ACP_PACKAGE, PI_AGENT_PACKAGE, ACP_PROBE_TIMEOUT_MILLISECONDS2, PROMPT_TIMEOUT_MILLISECONDS, PiAgentSpecification, WORKBUDDY_MANAGED_VERSION, WorkBuddyManagedPackage, WORKBUDDY_MANAGED_PACKAGE, WORKBUDDY_MACOS_EXECUTABLE_PATH, WorkBuddyAgentSpecification, ACP_OUTPUT_LIMIT_BYTES, VerifiedAcpReadiness, DiscoveryAcpHandler, ManagedAdapterInstallError, ManagedAdapterInstaller, VerifiedAgentExecutable, PAIRING_TIMEOUT_MILLISECONDS, PAIRING_CODE_PATTERN, IDENTIFIER_PATTERN6, TOKEN_PATTERN2, MAX_CONNECTION_FILE_LENGTH, CLAIM_RESPONSE_KEYS, REDEEM_RESPONSE_KEYS, LEGACY_SAVED_CONNECTION_KEYS, SAVED_CONNECTION_KEYS, PairingClientError, CATALOG_UPDATE_TIMEOUT_MILLISECONDS, AgentCatalogPublishError, INSTALLATION_DEADLINE_MILLISECONDS, AgentInstallation, RequestedInstallation, RunningInstallation, SucceededInstallation, FailedInstallation, CancelledInstallation, InstallationManagerError, NullInstallationAudit, InstallationJob, AgentInstallationManager, FixedInstallationExecutor, MobiusError, MobiusProtocolError, MobiusValidationError, IDENTIFIER_PATTERN7, MobiusArtifactUploadRequest, MobiusArtifact, MobiusUploadingArtifact, MobiusArtifactUpload, MobiusAvailableArtifact, MobiusExpiredArtifact, MobiusRuntimePairingLifecycle, UPLOAD_TIMEOUT_MILLISECONDS, RuntimeArtifactUploadError, UploadedRuntimeArtifact, WorkspaceDirectoryListing, WorkspaceDirectoryService, AppliedBotContext, EmbeddedBotContextApplicator, responseSchema, threadSchema, turnsSchema, itemTypeSchema, userMessageSchema, textSchema, imageSchema, agentMessageSchema, NativeSessionService, ARTIFACT_SCHEME, ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS, MAX_AGENT_IMAGE_BASE64_LENGTH, MAX_AGENT_RESOURCE_BYTE_LENGTH, IDENTIFIER_PATTERN8, PromptArtifactError, ResolvedPromptArtifacts, PromptArtifactReference, CONNECTION_TIMEOUT_MILLISECONDS, RelayConnectionError, MAX_DIAGNOSTIC_TEXT_LENGTH, RelayConnectionDiagnostics, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS, HEARTBEAT_INTERVAL_MILLISECONDS, RelayLivenessState, UnsupportedRelayLivenessState, AwaitingHeartbeatAckState, WaitingForHeartbeatState, FinishedRelayLivenessState, RelayConnectionLiveness, DEFAULT_OUTBOX_LIMITS, SessionEventOutboxCapacityError, RuntimeDeliveryInboxCapacityError, StoredRuntimeDelivery, SessionEventOutbox, SystemDaemonTimer, systemDaemonTimer, RELAY_RECONNECT_DELAY_MILLISECONDS, AGENT_ACTIVITY_COALESCING_MILLISECONDS, ACTIVE_TURN_RECONCILIATION_TIMEOUT_MILLISECONDS, ACTIVE_TURN_RECONCILIATION_CLOSE_CODE, DaemonAcpObserver, AuditInstallationEvents, DaemonInstallationObserver, ResolvedSessionDirectories, ActiveDaemonTurn, ActiveTurnReconciliationError, DaemonSessionEventConnectionState, DisconnectedDaemonSessionEventState, ConnectedDaemonSessionEventState, SESSION_EVENT_REPLAY_WINDOW, SESSION_EVENT_SOURCE_REPLAY_WINDOW, SESSION_EVENT_REPLAY_BYTE_LIMIT, InFlightSessionEvent, DaemonSessionEventPublisher, CoalescingDaemonActivityPublisher, IDENTIFIER_PATTERN9, RUNTIME_CREDENTIAL_PATTERN, MobiusRuntimeConfigurationError, MobiusRuntimeState, IdleMobiusRuntimeState, RunningMobiusRuntimeState, FinishedMobiusRuntimeState, MobiusRuntimeEngine;
86538
86557
  var init_dist2 = __esm({
86539
- "node_modules/.pnpm/@moxt-ai+mobius@0.0.40/node_modules/@moxt-ai/mobius/dist/index.js"() {
86558
+ "node_modules/.pnpm/@moxt-ai+mobius@0.0.41/node_modules/@moxt-ai/mobius/dist/index.js"() {
86540
86559
  "use strict";
86541
86560
  init_cjs_shims();
86542
86561
  init_acp();
@@ -86563,33 +86582,32 @@ var init_dist2 = __esm({
86563
86582
  import_node_sqlite2 = require("node:sqlite");
86564
86583
  import_node_crypto11 = require("node:crypto");
86565
86584
  import_node_crypto12 = require("node:crypto");
86566
- import_promises22 = require("node:fs/promises");
86567
86585
  import_node_sqlite3 = require("node:sqlite");
86568
86586
  import_node_crypto13 = require("node:crypto");
86569
86587
  import_node_net2 = require("node:net");
86570
- import_promises23 = require("node:fs/promises");
86588
+ import_promises22 = require("node:fs/promises");
86571
86589
  import_node_net3 = require("node:net");
86572
86590
  import_node_path22 = require("node:path");
86573
86591
  import_undici = __toESM(require_undici(), 1);
86574
86592
  import_node_crypto14 = require("node:crypto");
86575
- import_promises24 = require("node:fs/promises");
86593
+ import_promises23 = require("node:fs/promises");
86576
86594
  import_node_os12 = require("node:os");
86577
86595
  import_node_path23 = require("node:path");
86578
86596
  import_undici2 = __toESM(require_undici(), 1);
86579
- import_promises25 = require("node:fs/promises");
86597
+ import_promises24 = require("node:fs/promises");
86580
86598
  import_node_path24 = require("node:path");
86581
86599
  import_node_path25 = require("node:path");
86582
86600
  import_node_path26 = require("node:path");
86583
86601
  init_acp();
86584
- import_promises26 = require("node:fs/promises");
86602
+ import_promises25 = require("node:fs/promises");
86585
86603
  import_node_path27 = require("node:path");
86586
- import_promises27 = require("node:fs/promises");
86604
+ import_promises26 = require("node:fs/promises");
86587
86605
  import_node_path28 = require("node:path");
86588
86606
  init_acp();
86589
86607
  import_node_path29 = require("node:path");
86590
86608
  import_node_crypto15 = require("node:crypto");
86591
86609
  import_node_fs8 = require("node:fs");
86592
- import_promises28 = require("node:fs/promises");
86610
+ import_promises27 = require("node:fs/promises");
86593
86611
  import_node_path30 = require("node:path");
86594
86612
  import_undici3 = __toESM(require_undici(), 1);
86595
86613
  import_undici4 = __toESM(require_undici(), 1);
@@ -86609,7 +86627,7 @@ var init_dist2 = __esm({
86609
86627
  import_node_path36 = require("node:path");
86610
86628
  import_node_crypto17 = require("node:crypto");
86611
86629
  import_undici7 = __toESM(require_undici(), 1);
86612
- import_promises29 = require("node:fs/promises");
86630
+ import_promises28 = require("node:fs/promises");
86613
86631
  import_node_os13 = require("node:os");
86614
86632
  import_node_path37 = require("node:path");
86615
86633
  import_node_crypto18 = require("node:crypto");
@@ -86622,7 +86640,7 @@ var init_dist2 = __esm({
86622
86640
  import_node_fs10 = require("node:fs");
86623
86641
  import_node_path39 = require("node:path");
86624
86642
  import_node_sqlite4 = require("node:sqlite");
86625
- import_promises30 = require("node:fs/promises");
86643
+ import_promises29 = require("node:fs/promises");
86626
86644
  import_node_path40 = require("node:path");
86627
86645
  __defProp2 = Object.defineProperty;
86628
86646
  __export2 = (target, all22) => {
@@ -103713,6 +103731,7 @@ ${content32.join("\n")}
103713
103731
  };
103714
103732
  };
103715
103733
  PROCESS_STOP_TIMEOUT_MILLISECONDS = 1e3;
103734
+ MAX_ACP_PROCESSES = 10;
103716
103735
  MAX_PRE_SESSION_UPDATES = 100;
103717
103736
  MAX_PRE_SESSION_UPDATE_BYTES = 1024 * 1024;
103718
103737
  SESSION_CONTROL_COMMAND_ID = "session-control";
@@ -103771,6 +103790,71 @@ ${content32.join("\n")}
103771
103790
  this.name = "RetryableAcpInitializationError";
103772
103791
  }
103773
103792
  };
103793
+ AcpProcessCapacityLease = class {
103794
+ #releaseCapacity;
103795
+ #released = false;
103796
+ constructor(releaseCapacity) {
103797
+ this.#releaseCapacity = releaseCapacity;
103798
+ }
103799
+ release = () => {
103800
+ if (this.#released) {
103801
+ return;
103802
+ }
103803
+ this.#released = true;
103804
+ this.#releaseCapacity();
103805
+ };
103806
+ };
103807
+ AcpProcessCapacityWaiter = class {
103808
+ completion = Promise.withResolvers();
103809
+ signal;
103810
+ constructor(signal) {
103811
+ this.signal = signal;
103812
+ }
103813
+ cancel = () => {
103814
+ try {
103815
+ this.signal.throwIfAborted();
103816
+ } catch (error622) {
103817
+ this.completion.reject(error622);
103818
+ }
103819
+ };
103820
+ };
103821
+ AcpProcessCapacityLock = class {
103822
+ #locked = false;
103823
+ #waiters = [];
103824
+ acquire = async (signal) => {
103825
+ signal.throwIfAborted();
103826
+ if (!this.#locked) {
103827
+ this.#locked = true;
103828
+ return new AcpProcessCapacityLease(this.#release);
103829
+ }
103830
+ const waiter = new AcpProcessCapacityWaiter(signal);
103831
+ this.#waiters.push(waiter);
103832
+ signal.addEventListener("abort", waiter.cancel, { once: true });
103833
+ if (signal.aborted) {
103834
+ waiter.cancel();
103835
+ }
103836
+ try {
103837
+ return await waiter.completion.promise;
103838
+ } finally {
103839
+ signal.removeEventListener("abort", waiter.cancel);
103840
+ const index22 = this.#waiters.indexOf(waiter);
103841
+ if (index22 >= 0) {
103842
+ this.#waiters.splice(index22, 1);
103843
+ }
103844
+ }
103845
+ };
103846
+ #release = () => {
103847
+ while (this.#waiters.length > 0) {
103848
+ const waiter = this.#waiters.shift();
103849
+ if (waiter === void 0 || waiter.signal.aborted) {
103850
+ continue;
103851
+ }
103852
+ waiter.completion.resolve(new AcpProcessCapacityLease(this.#release));
103853
+ return;
103854
+ }
103855
+ this.#locked = false;
103856
+ };
103857
+ };
103774
103858
  AcpTurnState = class {
103775
103859
  };
103776
103860
  IdleAcpTurn = class extends AcpTurnState {
@@ -104941,20 +105025,23 @@ ${content32.join("\n")}
104941
105025
  }
104942
105026
  };
104943
105027
  close = async () => {
104944
- await this.cancelPendingInteractions();
104945
- if (this.#capabilities.closeSession && this.#nativeSessionId.length > 0) {
104946
- try {
104947
- await this.#connection.agent.request(
104948
- methods.agent.session.close,
104949
- { sessionId: this.#nativeSessionId },
104950
- {
104951
- cancellationSignal: AbortSignal.timeout(PROCESS_STOP_TIMEOUT_MILLISECONDS)
104952
- }
104953
- );
104954
- } catch {
105028
+ try {
105029
+ await this.cancelPendingInteractions();
105030
+ if (this.#capabilities.closeSession && this.#nativeSessionId.length > 0) {
105031
+ try {
105032
+ await this.#connection.agent.request(
105033
+ methods.agent.session.close,
105034
+ { sessionId: this.#nativeSessionId },
105035
+ {
105036
+ cancellationSignal: AbortSignal.timeout(PROCESS_STOP_TIMEOUT_MILLISECONDS)
105037
+ }
105038
+ );
105039
+ } catch {
105040
+ }
104955
105041
  }
105042
+ } finally {
105043
+ await this.closeProcess();
104956
105044
  }
104957
- await this.closeProcess();
104958
105045
  };
104959
105046
  closeProcess = async (capturedProcesses = []) => {
104960
105047
  try {
@@ -105061,6 +105148,31 @@ ${content32.join("\n")}
105061
105148
  }
105062
105149
  };
105063
105150
  };
105151
+ AcpProcessEvictionCandidate = class {
105152
+ };
105153
+ MissingAcpProcessEvictionCandidate = class extends AcpProcessEvictionCandidate {
105154
+ };
105155
+ FoundAcpProcessEvictionCandidate = class extends AcpProcessEvictionCandidate {
105156
+ runtime;
105157
+ constructor(runtime) {
105158
+ super();
105159
+ this.runtime = runtime;
105160
+ }
105161
+ };
105162
+ FoundAcpSessionProcessEvictionCandidate = class extends FoundAcpProcessEvictionCandidate {
105163
+ sessionId;
105164
+ constructor(sessionId, runtime) {
105165
+ super(runtime);
105166
+ this.sessionId = sessionId;
105167
+ }
105168
+ };
105169
+ FoundAcpNativeBrowserProcessEvictionCandidate = class extends FoundAcpProcessEvictionCandidate {
105170
+ sessionId;
105171
+ constructor(sessionId, runtime) {
105172
+ super(runtime);
105173
+ this.sessionId = sessionId;
105174
+ }
105175
+ };
105064
105176
  AcpSessionManager = class {
105065
105177
  #activeCommandIds = /* @__PURE__ */ new Map();
105066
105178
  #agentSettingsObserver = new NullAcpSessionObserver();
@@ -105069,10 +105181,18 @@ ${content32.join("\n")}
105069
105181
  #nativeBrowserPreparing = /* @__PURE__ */ new Map();
105070
105182
  #nativeBrowserSessions = /* @__PURE__ */ new Map();
105071
105183
  #nativeBrowserStore = new MemoryAcpSessionStore();
105184
+ #nativeBrowserUseCounts = /* @__PURE__ */ new Map();
105072
105185
  #activeSessionIds = /* @__PURE__ */ new Set();
105073
105186
  #cancellationRequests = /* @__PURE__ */ new Map();
105074
105187
  #preparing = /* @__PURE__ */ new Map();
105188
+ #processCapacityChanged = Promise.withResolvers();
105189
+ #processCapacityLock = new AcpProcessCapacityLock();
105190
+ #retainedProcesses = /* @__PURE__ */ new Map();
105191
+ #retiringProcessCount = 0;
105192
+ #sessionUseCounts = /* @__PURE__ */ new Map();
105075
105193
  #sessions = /* @__PURE__ */ new Map();
105194
+ #startingProcessCount = 0;
105195
+ #transientProcessCount = 0;
105076
105196
  #store;
105077
105197
  #observer;
105078
105198
  constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore()) {
@@ -105082,18 +105202,230 @@ ${content32.join("\n")}
105082
105202
  setObserver = (observer) => {
105083
105203
  this.#observer = observer;
105084
105204
  };
105205
+ #notifyProcessCapacityChanged() {
105206
+ const changed = this.#processCapacityChanged;
105207
+ this.#processCapacityChanged = Promise.withResolvers();
105208
+ changed.resolve();
105209
+ }
105210
+ #touchSession(sessionId) {
105211
+ const runtime = this.#sessions.get(sessionId);
105212
+ if (runtime === void 0) {
105213
+ return;
105214
+ }
105215
+ this.#touchProcess(runtime);
105216
+ }
105217
+ #touchExpectedSession(sessionId, expected) {
105218
+ if (this.#sessions.get(sessionId) !== expected) {
105219
+ return;
105220
+ }
105221
+ this.#touchProcess(expected);
105222
+ }
105223
+ #touchNativeBrowserSession(sessionId) {
105224
+ const runtime = this.#nativeBrowserSessions.get(sessionId);
105225
+ if (runtime === void 0) {
105226
+ return;
105227
+ }
105228
+ this.#touchProcess(runtime);
105229
+ }
105230
+ #touchExpectedNativeBrowserSession(sessionId, expected) {
105231
+ if (this.#nativeBrowserSessions.get(sessionId) !== expected) {
105232
+ return;
105233
+ }
105234
+ this.#touchProcess(expected);
105235
+ }
105236
+ #touchProcess(runtime) {
105237
+ const retained = this.#retainedProcesses.get(runtime);
105238
+ if (retained === void 0) {
105239
+ return;
105240
+ }
105241
+ this.#retainedProcesses.delete(runtime);
105242
+ this.#retainedProcesses.set(runtime, retained);
105243
+ }
105244
+ #beginSessionUse(sessionId) {
105245
+ this.#sessionUseCounts.set(sessionId, (this.#sessionUseCounts.get(sessionId) ?? 0) + 1);
105246
+ this.#touchSession(sessionId);
105247
+ }
105248
+ #endSessionUse(sessionId) {
105249
+ const count = this.#sessionUseCounts.get(sessionId) ?? 0;
105250
+ if (count <= 1) {
105251
+ this.#sessionUseCounts.delete(sessionId);
105252
+ } else {
105253
+ this.#sessionUseCounts.set(sessionId, count - 1);
105254
+ }
105255
+ this.#touchSession(sessionId);
105256
+ this.#notifyProcessCapacityChanged();
105257
+ }
105258
+ #beginNativeBrowserUse(sessionId) {
105259
+ this.#nativeBrowserUseCounts.set(sessionId, (this.#nativeBrowserUseCounts.get(sessionId) ?? 0) + 1);
105260
+ this.#touchNativeBrowserSession(sessionId);
105261
+ }
105262
+ #endNativeBrowserUse(sessionId) {
105263
+ const count = this.#nativeBrowserUseCounts.get(sessionId) ?? 0;
105264
+ if (count <= 1) {
105265
+ this.#nativeBrowserUseCounts.delete(sessionId);
105266
+ } else {
105267
+ this.#nativeBrowserUseCounts.set(sessionId, count - 1);
105268
+ }
105269
+ this.#touchNativeBrowserSession(sessionId);
105270
+ this.#notifyProcessCapacityChanged();
105271
+ }
105272
+ #isNativeSessionOperationActive(sessionId) {
105273
+ const stored = this.#store.read(sessionId);
105274
+ return stored instanceof FoundAcpStoredSession && this.#nativeOperations.has(`${stored.session.agentId}:${stored.session.nativeSessionId}`);
105275
+ }
105276
+ #leastRecentlyUsedEvictionCandidate() {
105277
+ for (const candidate of this.#retainedProcesses.values()) {
105278
+ if (candidate instanceof FoundAcpSessionProcessEvictionCandidate) {
105279
+ if (this.#activeSessionIds.has(candidate.sessionId) || this.#cancellationRequests.has(candidate.sessionId) || this.#preparing.has(candidate.sessionId) || (this.#sessionUseCounts.get(candidate.sessionId) ?? 0) > 0 || this.#isNativeSessionOperationActive(candidate.sessionId)) {
105280
+ continue;
105281
+ }
105282
+ return candidate;
105283
+ }
105284
+ if (candidate instanceof FoundAcpNativeBrowserProcessEvictionCandidate && !this.#nativeBrowserPreparing.has(candidate.sessionId) && (this.#nativeBrowserUseCounts.get(candidate.sessionId) ?? 0) === 0) {
105285
+ return candidate;
105286
+ }
105287
+ }
105288
+ return new MissingAcpProcessEvictionCandidate();
105289
+ }
105290
+ #ownedProcessCount() {
105291
+ return this.#retainedProcesses.size + this.#startingProcessCount + this.#transientProcessCount + this.#retiringProcessCount;
105292
+ }
105293
+ async #retireProcess(runtime, retained, close) {
105294
+ if (retained) {
105295
+ this.#retainedProcesses.delete(runtime);
105296
+ this.#retiringProcessCount += 1;
105297
+ }
105298
+ try {
105299
+ await close();
105300
+ } finally {
105301
+ if (retained) {
105302
+ this.#retiringProcessCount -= 1;
105303
+ this.#notifyProcessCapacityChanged();
105304
+ }
105305
+ }
105306
+ }
105307
+ async #retireSessionProcess(sessionId, runtime, close) {
105308
+ const retained = this.#sessions.get(sessionId) === runtime;
105309
+ if (retained) {
105310
+ this.#sessions.delete(sessionId);
105311
+ }
105312
+ await this.#retireProcess(runtime, retained, close);
105313
+ }
105314
+ async #retireNativeBrowserProcess(sessionId, runtime, close) {
105315
+ const retained = this.#nativeBrowserSessions.get(sessionId) === runtime;
105316
+ if (retained) {
105317
+ this.#nativeBrowserSessions.delete(sessionId);
105318
+ this.#nativeBrowserStore.remove(sessionId);
105319
+ }
105320
+ await this.#retireProcess(runtime, retained, close);
105321
+ }
105322
+ async #reserveProcessCapacity(signal) {
105323
+ const lease = await this.#processCapacityLock.acquire(signal);
105324
+ try {
105325
+ for (; ; ) {
105326
+ signal.throwIfAborted();
105327
+ if (this.#ownedProcessCount() < MAX_ACP_PROCESSES) {
105328
+ this.#startingProcessCount += 1;
105329
+ return;
105330
+ }
105331
+ const candidate = this.#leastRecentlyUsedEvictionCandidate();
105332
+ if (candidate instanceof FoundAcpSessionProcessEvictionCandidate) {
105333
+ await this.#retireSessionProcess(
105334
+ candidate.sessionId,
105335
+ candidate.runtime,
105336
+ async () => await candidate.runtime.close()
105337
+ );
105338
+ continue;
105339
+ }
105340
+ if (candidate instanceof FoundAcpNativeBrowserProcessEvictionCandidate) {
105341
+ await this.#retireNativeBrowserProcess(
105342
+ candidate.sessionId,
105343
+ candidate.runtime,
105344
+ async () => await candidate.runtime.close()
105345
+ );
105346
+ continue;
105347
+ }
105348
+ const changed = this.#processCapacityChanged.promise;
105349
+ await waitForAcpProcessCapacity(changed, signal);
105350
+ }
105351
+ } finally {
105352
+ lease.release();
105353
+ }
105354
+ }
105355
+ async #startRetainedSessionProcess(options, start) {
105356
+ await this.#reserveProcessCapacity(options.signal);
105357
+ try {
105358
+ const runtime = await start();
105359
+ this.#startingProcessCount -= 1;
105360
+ this.#sessions.set(options.sessionId, runtime);
105361
+ this.#retainedProcesses.set(
105362
+ runtime,
105363
+ new FoundAcpSessionProcessEvictionCandidate(options.sessionId, runtime)
105364
+ );
105365
+ this.#notifyProcessCapacityChanged();
105366
+ return runtime;
105367
+ } catch (error622) {
105368
+ this.#startingProcessCount -= 1;
105369
+ this.#notifyProcessCapacityChanged();
105370
+ throw error622;
105371
+ }
105372
+ }
105373
+ async #startRetainedNativeBrowserProcess(options, start) {
105374
+ await this.#reserveProcessCapacity(options.signal);
105375
+ try {
105376
+ const runtime = await start();
105377
+ this.#startingProcessCount -= 1;
105378
+ this.#nativeBrowserSessions.set(options.sessionId, runtime);
105379
+ this.#retainedProcesses.set(
105380
+ runtime,
105381
+ new FoundAcpNativeBrowserProcessEvictionCandidate(options.sessionId, runtime)
105382
+ );
105383
+ this.#notifyProcessCapacityChanged();
105384
+ return runtime;
105385
+ } catch (error622) {
105386
+ this.#startingProcessCount -= 1;
105387
+ this.#notifyProcessCapacityChanged();
105388
+ throw error622;
105389
+ }
105390
+ }
105391
+ async #runWithTransientProcess(signal, start, operation, close) {
105392
+ await this.#reserveProcessCapacity(signal);
105393
+ let runtime;
105394
+ try {
105395
+ runtime = await start();
105396
+ } catch (error622) {
105397
+ this.#startingProcessCount -= 1;
105398
+ this.#notifyProcessCapacityChanged();
105399
+ throw error622;
105400
+ }
105401
+ this.#startingProcessCount -= 1;
105402
+ this.#transientProcessCount += 1;
105403
+ this.#notifyProcessCapacityChanged();
105404
+ try {
105405
+ return await operation(runtime);
105406
+ } finally {
105407
+ try {
105408
+ await close(runtime);
105409
+ } finally {
105410
+ this.#transientProcessCount -= 1;
105411
+ this.#notifyProcessCapacityChanged();
105412
+ }
105413
+ }
105414
+ }
105085
105415
  async #startNativeBrowserPreparation(options) {
105086
105416
  const operation = (async () => {
105087
105417
  try {
105088
- const runtime = await AcpProcessSession.startNativeSessionBrowser(
105418
+ return await this.#startRetainedNativeBrowserProcess(
105089
105419
  options,
105090
- () => this.#nativeBrowserObserver,
105091
- this.#nativeBrowserStore
105420
+ async () => await AcpProcessSession.startNativeSessionBrowser(
105421
+ options,
105422
+ () => this.#nativeBrowserObserver,
105423
+ this.#nativeBrowserStore
105424
+ )
105092
105425
  );
105093
- this.#nativeBrowserSessions.set(options.sessionId, runtime);
105094
- return runtime;
105095
105426
  } finally {
105096
105427
  this.#nativeBrowserPreparing.delete(options.sessionId);
105428
+ this.#notifyProcessCapacityChanged();
105097
105429
  }
105098
105430
  })();
105099
105431
  this.#nativeBrowserPreparing.set(options.sessionId, operation);
@@ -105102,18 +105434,18 @@ ${content32.join("\n")}
105102
105434
  async #replaceNativeBrowserPreparation(existing, options) {
105103
105435
  const operation = (async () => {
105104
105436
  try {
105105
- this.#nativeBrowserSessions.delete(options.sessionId);
105106
- await existing.close();
105107
- this.#nativeBrowserStore.remove(options.sessionId);
105108
- const runtime = await AcpProcessSession.startNativeSessionBrowser(
105437
+ await this.#retireNativeBrowserProcess(options.sessionId, existing, async () => await existing.close());
105438
+ return await this.#startRetainedNativeBrowserProcess(
105109
105439
  options,
105110
- () => this.#nativeBrowserObserver,
105111
- this.#nativeBrowserStore
105440
+ async () => await AcpProcessSession.startNativeSessionBrowser(
105441
+ options,
105442
+ () => this.#nativeBrowserObserver,
105443
+ this.#nativeBrowserStore
105444
+ )
105112
105445
  );
105113
- this.#nativeBrowserSessions.set(options.sessionId, runtime);
105114
- return runtime;
105115
105446
  } finally {
105116
105447
  this.#nativeBrowserPreparing.delete(options.sessionId);
105448
+ this.#notifyProcessCapacityChanged();
105117
105449
  }
105118
105450
  })();
105119
105451
  this.#nativeBrowserPreparing.set(options.sessionId, operation);
@@ -105122,11 +105454,13 @@ ${content32.join("\n")}
105122
105454
  async #startPreparation(options, metrics = unmeasuredOperationMetrics) {
105123
105455
  const operation = (async () => {
105124
105456
  try {
105125
- const runtime = await AcpProcessSession.start(options, () => this.#observer, this.#store, metrics);
105126
- this.#sessions.set(options.sessionId, runtime);
105127
- return runtime;
105457
+ return await this.#startRetainedSessionProcess(
105458
+ options,
105459
+ async () => await AcpProcessSession.start(options, () => this.#observer, this.#store, metrics)
105460
+ );
105128
105461
  } finally {
105129
105462
  this.#preparing.delete(options.sessionId);
105463
+ this.#notifyProcessCapacityChanged();
105130
105464
  }
105131
105465
  })();
105132
105466
  this.#preparing.set(options.sessionId, operation);
@@ -105135,17 +105469,19 @@ ${content32.join("\n")}
105135
105469
  async #startSessionForkAtTurnPreparation(options, sourceNativeSessionId, forkPoint) {
105136
105470
  const operation = (async () => {
105137
105471
  try {
105138
- const runtime = await AcpProcessSession.startSessionForkAtTurn(
105472
+ return await this.#startRetainedSessionProcess(
105139
105473
  options,
105140
- sourceNativeSessionId,
105141
- forkPoint,
105142
- () => this.#observer,
105143
- this.#store
105474
+ async () => await AcpProcessSession.startSessionForkAtTurn(
105475
+ options,
105476
+ sourceNativeSessionId,
105477
+ forkPoint,
105478
+ () => this.#observer,
105479
+ this.#store
105480
+ )
105144
105481
  );
105145
- this.#sessions.set(options.sessionId, runtime);
105146
- return runtime;
105147
105482
  } finally {
105148
105483
  this.#preparing.delete(options.sessionId);
105484
+ this.#notifyProcessCapacityChanged();
105149
105485
  }
105150
105486
  })();
105151
105487
  this.#preparing.set(options.sessionId, operation);
@@ -105154,14 +105490,19 @@ ${content32.join("\n")}
105154
105490
  async #replacePreparation(existing, options, metrics) {
105155
105491
  const operation = (async () => {
105156
105492
  try {
105157
- this.#sessions.delete(options.sessionId);
105158
- await metrics.measure("runtime-replacement-close", async () => await existing.close());
105493
+ await this.#retireSessionProcess(
105494
+ options.sessionId,
105495
+ existing,
105496
+ async () => await metrics.measure("runtime-replacement-close", async () => await existing.close())
105497
+ );
105159
105498
  this.#store.remove(options.sessionId);
105160
- const runtime = await AcpProcessSession.start(options, () => this.#observer, this.#store, metrics);
105161
- this.#sessions.set(options.sessionId, runtime);
105162
- return runtime;
105499
+ return await this.#startRetainedSessionProcess(
105500
+ options,
105501
+ async () => await AcpProcessSession.start(options, () => this.#observer, this.#store, metrics)
105502
+ );
105163
105503
  } finally {
105164
105504
  this.#preparing.delete(options.sessionId);
105505
+ this.#notifyProcessCapacityChanged();
105165
105506
  }
105166
105507
  })();
105167
105508
  this.#preparing.set(options.sessionId, operation);
@@ -105171,10 +105512,12 @@ ${content32.join("\n")}
105171
105512
  const desiredConfigOptions = existing.prepared().configOptions;
105172
105513
  const operation = (async () => {
105173
105514
  try {
105174
- this.#sessions.delete(options.sessionId);
105175
- await existing.close();
105515
+ await this.#retireSessionProcess(options.sessionId, existing, async () => await existing.close());
105176
105516
  this.#store.remove(options.sessionId);
105177
- const runtime = await AcpProcessSession.start(options, () => this.#observer, this.#store);
105517
+ const runtime = await this.#startRetainedSessionProcess(
105518
+ options,
105519
+ async () => await AcpProcessSession.start(options, () => this.#observer, this.#store)
105520
+ );
105178
105521
  try {
105179
105522
  for (const desired of desiredConfigOptions) {
105180
105523
  const current2 = runtime.prepared().configOptions.find((option2) => option2.id === desired.id);
@@ -105206,14 +105549,14 @@ ${content32.join("\n")}
105206
105549
  }
105207
105550
  }
105208
105551
  } catch (error622) {
105209
- await runtime.close();
105552
+ await this.#retireSessionProcess(options.sessionId, runtime, async () => await runtime.close());
105210
105553
  this.#store.remove(options.sessionId);
105211
105554
  throw error622;
105212
105555
  }
105213
- this.#sessions.set(options.sessionId, runtime);
105214
105556
  return runtime;
105215
105557
  } finally {
105216
105558
  this.#preparing.delete(options.sessionId);
105559
+ this.#notifyProcessCapacityChanged();
105217
105560
  }
105218
105561
  })();
105219
105562
  this.#preparing.set(options.sessionId, operation);
@@ -105235,6 +105578,7 @@ ${content32.join("\n")}
105235
105578
  if (pending !== void 0) {
105236
105579
  const runtime2 = await metrics.measure("session-preparation-wait", async () => await pending);
105237
105580
  if (runtime2.belongsTo(options.agent.id, options.cwd, options.additionalDirectories)) {
105581
+ this.#touchExpectedSession(options.sessionId, runtime2);
105238
105582
  return runtime2.prepared();
105239
105583
  }
105240
105584
  return await this.prepareSession(options, metrics);
@@ -105242,6 +105586,7 @@ ${content32.join("\n")}
105242
105586
  const existing = this.#sessions.get(options.sessionId);
105243
105587
  if (existing !== void 0) {
105244
105588
  if (existing.belongsTo(options.agent.id, options.cwd, options.additionalDirectories)) {
105589
+ this.#touchExpectedSession(options.sessionId, existing);
105245
105590
  return existing.prepared();
105246
105591
  }
105247
105592
  if (!existing.canRebind()) {
@@ -105262,22 +105607,24 @@ ${content32.join("\n")}
105262
105607
  * authoritative settings. Its identity and store are private to this
105263
105608
  * operation and never become a Mobius Session.
105264
105609
  */
105265
- inspectAgentSettings = async (options) => {
105266
- const runtime = await AcpProcessSession.start(
105610
+ inspectAgentSettings = async (options) => await this.#runWithTransientProcess(
105611
+ options.signal,
105612
+ async () => await AcpProcessSession.start(
105267
105613
  {
105268
105614
  ...options,
105269
105615
  sessionId: `agent-settings-${crypto.randomUUID()}`
105270
105616
  },
105271
105617
  () => this.#agentSettingsObserver,
105272
105618
  new MemoryAcpSessionStore()
105273
- );
105274
- try {
105619
+ ),
105620
+ (runtime) => {
105275
105621
  const prepared = runtime.prepared();
105276
- return new AcpAgentSettingsSnapshot(prepared.agentName, prepared.agentVersion, prepared.configOptions);
105277
- } finally {
105278
- await runtime.close();
105279
- }
105280
- };
105622
+ return Promise.resolve(
105623
+ new AcpAgentSettingsSnapshot(prepared.agentName, prepared.agentVersion, prepared.configOptions)
105624
+ );
105625
+ },
105626
+ async (runtime) => await runtime.close()
105627
+ );
105281
105628
  /**
105282
105629
  * @deprecated Retained for the Bot-scoped legacy Agent-configuration API.
105283
105630
  * Use inspectAgentSettings for Agent-scoped settings discovery.
@@ -105286,18 +105633,20 @@ ${content32.join("\n")}
105286
105633
  if (this.#preparing.has(options.sessionId) || this.#sessions.has(options.sessionId)) {
105287
105634
  throw new AcpExecutionError("The configuration inspection session is already in use", {}, "session_busy");
105288
105635
  }
105289
- const runtime = await this.#startPreparation(options, metrics);
105636
+ this.#beginSessionUse(options.sessionId);
105290
105637
  try {
105291
- return runtime.prepared();
105292
- } finally {
105293
- if (this.#sessions.get(options.sessionId) === runtime) {
105294
- this.#sessions.delete(options.sessionId);
105295
- }
105638
+ const runtime = await this.#startPreparation(options, metrics);
105296
105639
  try {
105297
- await runtime.close();
105640
+ return runtime.prepared();
105298
105641
  } finally {
105299
- this.#store.remove(options.sessionId);
105642
+ try {
105643
+ await this.#retireSessionProcess(options.sessionId, runtime, async () => await runtime.close());
105644
+ } finally {
105645
+ this.#store.remove(options.sessionId);
105646
+ }
105300
105647
  }
105648
+ } finally {
105649
+ this.#endSessionUse(options.sessionId);
105301
105650
  }
105302
105651
  };
105303
105652
  prepareExecutionSession = async (options) => {
@@ -105318,6 +105667,7 @@ ${content32.join("\n")}
105318
105667
  );
105319
105668
  }
105320
105669
  if (existing.usesEnvironment(options.agent.environment)) {
105670
+ this.#touchExpectedSession(options.sessionId, existing);
105321
105671
  return existing.prepared();
105322
105672
  }
105323
105673
  if (!existing.canRebind()) {
@@ -105334,6 +105684,7 @@ ${content32.join("\n")}
105334
105684
  if (pending !== void 0) {
105335
105685
  const runtime2 = await pending;
105336
105686
  if (runtime2.belongsTo(options.agent.id, options.cwd, options.additionalDirectories)) {
105687
+ this.#touchExpectedNativeBrowserSession(options.sessionId, runtime2);
105337
105688
  return runtime2.prepared();
105338
105689
  }
105339
105690
  return await this.prepareNativeSessionBrowser(options);
@@ -105341,6 +105692,7 @@ ${content32.join("\n")}
105341
105692
  const existing = this.#nativeBrowserSessions.get(options.sessionId);
105342
105693
  if (existing !== void 0) {
105343
105694
  if (existing.belongsTo(options.agent.id, options.cwd, options.additionalDirectories)) {
105695
+ this.#touchExpectedNativeBrowserSession(options.sessionId, existing);
105344
105696
  return existing.prepared();
105345
105697
  }
105346
105698
  if (!existing.canRebind()) {
@@ -105357,8 +105709,13 @@ ${content32.join("\n")}
105357
105709
  return runtime.prepared();
105358
105710
  };
105359
105711
  configureSession = async (options) => {
105360
- const runtime = await this.ensureSession(options);
105361
- return await runtime.configure(options);
105712
+ this.#beginSessionUse(options.sessionId);
105713
+ try {
105714
+ const runtime = await this.ensureSession(options);
105715
+ return await runtime.configure(options);
105716
+ } finally {
105717
+ this.#endSessionUse(options.sessionId);
105718
+ }
105362
105719
  };
105363
105720
  cancelPrompt = async (sessionId) => {
105364
105721
  const existing = this.#cancellationRequests.get(sessionId);
@@ -105374,6 +105731,8 @@ ${content32.join("\n")}
105374
105731
  } finally {
105375
105732
  if (this.#sessions.get(sessionId) === runtime) {
105376
105733
  this.#sessions.delete(sessionId);
105734
+ this.#retainedProcesses.delete(runtime);
105735
+ this.#notifyProcessCapacityChanged();
105377
105736
  }
105378
105737
  }
105379
105738
  }
@@ -105463,10 +105822,7 @@ ${content32.join("\n")}
105463
105822
  return this.#cancellationRequests.has(options.sessionId) ? { stopReason: "cancelled" } : result;
105464
105823
  } catch (error622) {
105465
105824
  if (this.#cancellationRequests.has(options.sessionId)) {
105466
- if (this.#sessions.get(options.sessionId) === runtime) {
105467
- this.#sessions.delete(options.sessionId);
105468
- }
105469
- await runtime.closeProcess();
105825
+ await this.#cancellationRequests.get(options.sessionId);
105470
105826
  return { stopReason: "cancelled" };
105471
105827
  }
105472
105828
  throw error622;
@@ -105474,8 +105830,11 @@ ${content32.join("\n")}
105474
105830
  } catch (error622) {
105475
105831
  const failedRuntime = this.#sessions.get(options.sessionId);
105476
105832
  if (failedRuntime !== void 0) {
105477
- this.#sessions.delete(options.sessionId);
105478
- await failedRuntime.close();
105833
+ await this.#retireSessionProcess(
105834
+ options.sessionId,
105835
+ failedRuntime,
105836
+ async () => await failedRuntime.close()
105837
+ );
105479
105838
  }
105480
105839
  if (this.#cancellationRequests.has(options.sessionId)) {
105481
105840
  return { stopReason: "cancelled" };
@@ -105496,6 +105855,8 @@ ${content32.join("\n")}
105496
105855
  this.#activeCommandIds.delete(options.sessionId);
105497
105856
  }
105498
105857
  this.#cancellationRequests.delete(options.sessionId);
105858
+ this.#touchSession(options.sessionId);
105859
+ this.#notifyProcessCapacityChanged();
105499
105860
  }
105500
105861
  }
105501
105862
  };
@@ -105514,11 +105875,16 @@ ${content32.join("\n")}
105514
105875
  await runtime.respondElicitation(options);
105515
105876
  };
105516
105877
  close = async () => {
105517
- const sessions = [...this.#sessions.values()];
105518
- const nativeBrowserSessions = [...this.#nativeBrowserSessions.values()];
105519
- this.#sessions.clear();
105520
- this.#nativeBrowserSessions.clear();
105521
- await Promise.all([...sessions, ...nativeBrowserSessions].map(async (session) => await session.close()));
105878
+ const sessions = [...this.#sessions.entries()];
105879
+ const nativeBrowserSessions = [...this.#nativeBrowserSessions.entries()];
105880
+ await Promise.all([
105881
+ ...sessions.map(
105882
+ async ([sessionId, runtime]) => await this.#retireSessionProcess(sessionId, runtime, async () => await runtime.close())
105883
+ ),
105884
+ ...nativeBrowserSessions.map(
105885
+ async ([sessionId, runtime]) => await this.#retireNativeBrowserProcess(sessionId, runtime, async () => await runtime.close())
105886
+ )
105887
+ ]);
105522
105888
  };
105523
105889
  hasPreparedSession = (sessionId, agentId, cwd, additionalDirectories) => this.#sessions.get(sessionId)?.belongsTo(agentId, cwd, additionalDirectories) === true;
105524
105890
  ensureSession = async (options) => {
@@ -105531,6 +105897,7 @@ ${content32.join("\n")}
105531
105897
  "session_identity_mismatch"
105532
105898
  );
105533
105899
  }
105900
+ this.#touchExpectedSession(options.sessionId, existing);
105534
105901
  return existing;
105535
105902
  }
105536
105903
  await this.prepareSession(options);
@@ -105550,6 +105917,7 @@ ${content32.join("\n")}
105550
105917
  "session_identity_mismatch"
105551
105918
  );
105552
105919
  }
105920
+ this.#touchExpectedNativeBrowserSession(options.sessionId, existing);
105553
105921
  return existing;
105554
105922
  }
105555
105923
  await this.prepareNativeSessionBrowser(options);
@@ -105559,7 +105927,14 @@ ${content32.join("\n")}
105559
105927
  }
105560
105928
  return started;
105561
105929
  }
105562
- listNativeSessions = async (options, cursor) => await (await this.#ensureNativeSessionBrowser(options)).listNativeSessions(cursor, options.signal);
105930
+ listNativeSessions = async (options, cursor) => {
105931
+ this.#beginNativeBrowserUse(options.sessionId);
105932
+ try {
105933
+ return await (await this.#ensureNativeSessionBrowser(options)).listNativeSessions(cursor, options.signal);
105934
+ } finally {
105935
+ this.#endNativeBrowserUse(options.sessionId);
105936
+ }
105937
+ };
105563
105938
  previewNativeSession = async (options, nativeSessionId) => {
105564
105939
  const key = `${options.agent.id}:${nativeSessionId}`;
105565
105940
  const linked = this.#store.findNative(options.agent.id, nativeSessionId);
@@ -105572,17 +105947,19 @@ ${content32.join("\n")}
105572
105947
  }
105573
105948
  this.#nativeOperations.add(key);
105574
105949
  try {
105575
- const runtime = await AcpProcessSession.startNativeSessionBrowser(
105576
- options,
105577
- () => this.#nativeBrowserObserver,
105578
- new MemoryAcpSessionStore()
105950
+ return await this.#runWithTransientProcess(
105951
+ options.signal,
105952
+ async () => await AcpProcessSession.startNativeSessionBrowser(
105953
+ options,
105954
+ () => this.#nativeBrowserObserver,
105955
+ new MemoryAcpSessionStore()
105956
+ ),
105957
+ async (runtime) => {
105958
+ runtime.selectNativeSession(nativeSessionId);
105959
+ return await runtime.loadHistory(options.signal);
105960
+ },
105961
+ async (runtime) => await runtime.closeProcess()
105579
105962
  );
105580
- try {
105581
- runtime.selectNativeSession(nativeSessionId);
105582
- return await runtime.loadHistory(options.signal);
105583
- } finally {
105584
- await runtime.closeProcess();
105585
- }
105586
105963
  } finally {
105587
105964
  this.#nativeOperations.delete(key);
105588
105965
  }
@@ -105602,36 +105979,46 @@ ${content32.join("\n")}
105602
105979
  }
105603
105980
  const existing = linked[0];
105604
105981
  if (origin.kind === "import" && existing !== void 0) {
105605
- const runtime = await this.ensureSession({
105606
- ...options,
105607
- sessionId: existing.sessionId
105608
- });
105609
- if (this.#activeSessionIds.has(existing.sessionId) || this.#nativeOperations.has(key)) {
105610
- throw new AcpExecutionError(
105611
- "Wait for the native session's running operation to finish",
105612
- {},
105613
- "session_busy"
105614
- );
105615
- }
105616
- this.#nativeOperations.add(key);
105982
+ this.#beginSessionUse(existing.sessionId);
105617
105983
  try {
105618
- const history = await runtime.loadHistory(options.signal);
105619
- return {
105620
- prepared: runtime.prepared(),
105621
- sessionId: existing.sessionId,
105622
- history
105623
- };
105624
- } catch (error622) {
105625
- this.#sessions.delete(existing.sessionId);
105626
- await runtime.closeProcess();
105627
- throw error622;
105984
+ const runtime = await this.ensureSession({
105985
+ ...options,
105986
+ sessionId: existing.sessionId
105987
+ });
105988
+ if (this.#activeSessionIds.has(existing.sessionId) || this.#nativeOperations.has(key)) {
105989
+ throw new AcpExecutionError(
105990
+ "Wait for the native session's running operation to finish",
105991
+ {},
105992
+ "session_busy"
105993
+ );
105994
+ }
105995
+ this.#nativeOperations.add(key);
105996
+ try {
105997
+ const history = await runtime.loadHistory(options.signal);
105998
+ return {
105999
+ prepared: runtime.prepared(),
106000
+ sessionId: existing.sessionId,
106001
+ history
106002
+ };
106003
+ } catch (error622) {
106004
+ await this.#retireSessionProcess(
106005
+ existing.sessionId,
106006
+ runtime,
106007
+ async () => await runtime.closeProcess()
106008
+ );
106009
+ throw error622;
106010
+ } finally {
106011
+ this.#nativeOperations.delete(key);
106012
+ this.#notifyProcessCapacityChanged();
106013
+ }
105628
106014
  } finally {
105629
- this.#nativeOperations.delete(key);
106015
+ this.#endSessionUse(existing.sessionId);
105630
106016
  }
105631
106017
  }
105632
106018
  if (this.#sessions.has(options.sessionId) || this.#preparing.has(options.sessionId) || this.#store.read(options.sessionId) instanceof FoundAcpStoredSession || this.#store.read(options.sessionId) instanceof DeletedAcpStoredSession) {
105633
106019
  throw new AcpExecutionError("The destination conversation already exists", {}, "session_identity_mismatch");
105634
106020
  }
106021
+ this.#beginSessionUse(options.sessionId);
105635
106022
  this.#nativeOperations.add(key);
105636
106023
  try {
105637
106024
  const runtime = await this.#startPreparation({ ...options, origin });
@@ -105645,23 +106032,23 @@ ${content32.join("\n")}
105645
106032
  history
105646
106033
  };
105647
106034
  } catch (error622) {
105648
- this.#sessions.delete(options.sessionId);
105649
106035
  this.#store.remove(options.sessionId);
105650
- await runtime.closeProcess();
106036
+ await this.#retireSessionProcess(options.sessionId, runtime, async () => await runtime.closeProcess());
105651
106037
  throw error622;
105652
106038
  } finally {
105653
106039
  this.#nativeOperations.delete(openedKey);
106040
+ this.#notifyProcessCapacityChanged();
105654
106041
  }
105655
106042
  } catch (error622) {
105656
106043
  this.#store.remove(options.sessionId);
105657
106044
  const runtime = this.#sessions.get(options.sessionId);
105658
- this.#sessions.delete(options.sessionId);
105659
106045
  if (runtime !== void 0) {
105660
- await runtime.closeProcess();
106046
+ await this.#retireSessionProcess(options.sessionId, runtime, async () => await runtime.closeProcess());
105661
106047
  }
105662
106048
  throw error622;
105663
106049
  } finally {
105664
106050
  this.#nativeOperations.delete(key);
106051
+ this.#endSessionUse(options.sessionId);
105665
106052
  }
105666
106053
  };
105667
106054
  forkSessionAtTurn = async (options, sourceSessionId, forkPoint) => {
@@ -105699,6 +106086,7 @@ ${content32.join("\n")}
105699
106086
  if (this.#sessions.has(options.sessionId) || this.#preparing.has(options.sessionId) || this.#store.read(options.sessionId) instanceof FoundAcpStoredSession || this.#store.read(options.sessionId) instanceof DeletedAcpStoredSession) {
105700
106087
  throw new AcpExecutionError("The destination conversation already exists", {}, "session_identity_mismatch");
105701
106088
  }
106089
+ this.#beginSessionUse(options.sessionId);
105702
106090
  this.#nativeOperations.add(key);
105703
106091
  try {
105704
106092
  const runtime = await this.#startSessionForkAtTurnPreparation(
@@ -105715,48 +106103,58 @@ ${content32.join("\n")}
105715
106103
  sessionId: options.sessionId
105716
106104
  };
105717
106105
  } catch (error622) {
105718
- this.#sessions.delete(options.sessionId);
105719
106106
  this.#store.remove(options.sessionId);
105720
- await runtime.closeProcess();
106107
+ await this.#retireSessionProcess(options.sessionId, runtime, async () => await runtime.closeProcess());
105721
106108
  throw error622;
105722
106109
  } finally {
105723
106110
  this.#nativeOperations.delete(openedKey);
106111
+ this.#notifyProcessCapacityChanged();
105724
106112
  }
105725
106113
  } finally {
105726
106114
  this.#nativeOperations.delete(key);
106115
+ this.#endSessionUse(options.sessionId);
105727
106116
  }
105728
106117
  };
105729
106118
  deleteNativeSession = async (options, nativeSessionId) => {
105730
- const runtime = await this.#ensureNativeSessionBrowser(options);
105731
- const key = `${options.agent.id}:${nativeSessionId}`;
105732
- const linked = this.#store.findNative(options.agent.id, nativeSessionId);
105733
- if (this.#nativeOperations.has(key) || linked.some((entry) => this.#activeSessionIds.has(entry.sessionId) || this.#preparing.has(entry.sessionId))) {
105734
- throw new AcpExecutionError(
105735
- "Wait for the native session's running operation to finish",
105736
- {},
105737
- "session_busy"
105738
- );
105739
- }
105740
- this.#nativeOperations.add(key);
106119
+ this.#beginNativeBrowserUse(options.sessionId);
105741
106120
  try {
105742
- for (const entry of linked) {
105743
- const active = this.#sessions.get(entry.sessionId);
105744
- if (active !== void 0 && active !== runtime) {
105745
- this.#sessions.delete(entry.sessionId);
105746
- await active.close();
106121
+ const runtime = await this.#ensureNativeSessionBrowser(options);
106122
+ const key = `${options.agent.id}:${nativeSessionId}`;
106123
+ const linked = this.#store.findNative(options.agent.id, nativeSessionId);
106124
+ if (this.#nativeOperations.has(key) || linked.some(
106125
+ (entry) => this.#activeSessionIds.has(entry.sessionId) || this.#preparing.has(entry.sessionId)
106126
+ )) {
106127
+ throw new AcpExecutionError(
106128
+ "Wait for the native session's running operation to finish",
106129
+ {},
106130
+ "session_busy"
106131
+ );
106132
+ }
106133
+ this.#nativeOperations.add(key);
106134
+ try {
106135
+ for (const entry of linked) {
106136
+ const active = this.#sessions.get(entry.sessionId);
106137
+ if (active !== void 0 && active !== runtime) {
106138
+ await this.#retireSessionProcess(entry.sessionId, active, async () => await active.close());
106139
+ }
106140
+ }
106141
+ options.signal.throwIfAborted();
106142
+ await runtime.deleteNativeSession(nativeSessionId, options.signal);
106143
+ const deleted = this.#store.markDeleted(options.agent.id, nativeSessionId);
106144
+ if (runtime.nativeSessionId() === nativeSessionId) {
106145
+ await this.#retireNativeBrowserProcess(
106146
+ options.sessionId,
106147
+ runtime,
106148
+ async () => await runtime.close()
106149
+ );
105747
106150
  }
106151
+ return deleted;
106152
+ } finally {
106153
+ this.#nativeOperations.delete(key);
106154
+ this.#notifyProcessCapacityChanged();
105748
106155
  }
105749
- options.signal.throwIfAborted();
105750
- await runtime.deleteNativeSession(nativeSessionId, options.signal);
105751
- const deleted = this.#store.markDeleted(options.agent.id, nativeSessionId);
105752
- if (runtime.nativeSessionId() === nativeSessionId) {
105753
- this.#nativeBrowserSessions.delete(options.sessionId);
105754
- this.#nativeBrowserStore.remove(options.sessionId);
105755
- await runtime.close();
105756
- }
105757
- return deleted;
105758
106156
  } finally {
105759
- this.#nativeOperations.delete(key);
106157
+ this.#endNativeBrowserUse(options.sessionId);
105760
106158
  }
105761
106159
  };
105762
106160
  };
@@ -105811,18 +106209,6 @@ ${content32.join("\n")}
105811
106209
  }
105812
106210
  };
105813
106211
  LOCAL_BOT_GRANT_LIFETIME_MILLISECONDS = 90 * 24 * 60 * 60 * 1e3;
105814
- identifier2 = external_exports2.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/);
105815
- savedApprovalSchema = external_exports2.object({
105816
- local_grant_id: identifier2,
105817
- bot_id: identifier2,
105818
- binding_id: identifier2,
105819
- binding_revision: external_exports2.number().int().positive(),
105820
- agent_ref: identifier2,
105821
- workspace_ref: external_exports2.string().min(1).max(2048),
105822
- revocation_epoch: external_exports2.number().int().nonnegative(),
105823
- agent_identity_digest: external_exports2.string().regex(/^[a-f0-9]{64}$/),
105824
- workspace_identity_digest: external_exports2.string().regex(/^[a-f0-9]{64}$/)
105825
- }).readonly();
105826
106212
  LocalBotAuthorizationError = class extends Error {
105827
106213
  code;
105828
106214
  constructor(code, message, options = {}) {
@@ -105865,17 +106251,6 @@ ${content32.join("\n")}
105865
106251
  };
105866
106252
  LocalBotGrantStore = class {
105867
106253
  #database;
105868
- static containsBot = (path22, botId) => {
105869
- const database = new import_node_sqlite3.DatabaseSync(path22, { readOnly: true });
105870
- try {
105871
- if (database.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'local_bot_grants'").get() === void 0) {
105872
- return false;
105873
- }
105874
- return database.prepare("SELECT local_grant_id FROM local_bot_grants WHERE bot_id = ? LIMIT 1").get(botId) !== void 0;
105875
- } finally {
105876
- database.close();
105877
- }
105878
- };
105879
106254
  constructor(path22) {
105880
106255
  this.#database = new import_node_sqlite3.DatabaseSync(path22);
105881
106256
  this.#database.exec(`
@@ -105913,78 +106288,6 @@ ${content32.join("\n")}
105913
106288
  ) STRICT;
105914
106289
  `);
105915
106290
  }
105916
- /** Only the local CLI may invoke this explicit approval transition. */
105917
- reapprove = async (botId, catalog, directories, bindingAuthorityId, now, signal) => {
105918
- signal.throwIfAborted();
105919
- if (!identifier2.safeParse(botId).success) {
105920
- throw new LocalBotAuthorizationError("invalid_request", "The Bot ID is invalid");
105921
- }
105922
- const row = this.#database.prepare("SELECT * FROM local_bot_grants WHERE bot_id = ? ORDER BY binding_revision DESC LIMIT 1").get(botId);
105923
- if (row === void 0) {
105924
- throw new LocalBotAuthorizationError("bot_not_found", "This machine has no saved approval for that Bot");
105925
- }
105926
- const parsed = savedApprovalSchema.safeParse(row);
105927
- if (!parsed.success) {
105928
- throw new LocalBotAuthorizationError("local_grant_invalid", "The saved Bot approval is invalid", {
105929
- cause: parsed.error
105930
- });
105931
- }
105932
- const saved = parsed.data;
105933
- const agent = catalog.find(saved.agent_ref);
105934
- if (!agent.capabilities.embeddedContextPrompt) {
105935
- throw new LocalBotAuthorizationError("binding_incompatible", "The local Agent cannot apply Bot context");
105936
- }
105937
- const [adapterUnchanged, agentUnchanged] = await Promise.all([
105938
- revalidateExecutable(agent.adapterIdentity),
105939
- revalidateExecutable(agent.agentIdentity)
105940
- ]);
105941
- signal.throwIfAborted();
105942
- if (!adapterUnchanged || !agentUnchanged) {
105943
- throw new LocalBotAuthorizationError(
105944
- "binding_incompatible",
105945
- "The local Agent executable changed before approval"
105946
- );
105947
- }
105948
- const workspacePath = await directories.resolve(bindingAuthorityId, saved.workspace_ref, signal);
105949
- const workspaceIdentityDigest = await workspaceDigest(workspacePath);
105950
- signal.throwIfAborted();
105951
- this.#database.exec("BEGIN IMMEDIATE");
105952
- try {
105953
- const result = this.#database.prepare(`UPDATE local_bot_grants
105954
- SET agent_identity_digest = ?, workspace_identity_digest = ?, workspace_path = ?,
105955
- revoked_at = NULL, expires_at = ?, revocation_epoch = revocation_epoch + 1
105956
- WHERE local_grant_id = ? AND revocation_epoch = ?
105957
- AND agent_identity_digest = ? AND workspace_identity_digest = ?
105958
- AND binding_revision = (SELECT MAX(binding_revision) FROM local_bot_grants WHERE bot_id = ?)`).run(
105959
- agentDigest(agent),
105960
- workspaceIdentityDigest,
105961
- workspacePath,
105962
- now + LOCAL_BOT_GRANT_LIFETIME_MILLISECONDS,
105963
- saved.local_grant_id,
105964
- saved.revocation_epoch,
105965
- saved.agent_identity_digest,
105966
- saved.workspace_identity_digest,
105967
- botId
105968
- );
105969
- if (result.changes !== 1) {
105970
- throw new LocalBotAuthorizationError(
105971
- "binding_not_approved",
105972
- "The Bot binding changed during approval; run the command again"
105973
- );
105974
- }
105975
- this.#database.prepare(`INSERT INTO audit_events (recorded_at, event, command_id, session_id, details_json)
105976
- VALUES (?, 'bot_binding_locally_reapproved', ?, '', ?)`).run(
105977
- new Date(now).toISOString(),
105978
- saved.binding_id,
105979
- JSON.stringify({ botId, bindingId: saved.binding_id, agentRef: saved.agent_ref })
105980
- );
105981
- this.#database.exec("COMMIT");
105982
- } catch (cause) {
105983
- this.#database.exec("ROLLBACK");
105984
- throw cause;
105985
- }
105986
- return { bindingId: saved.binding_id, workspacePath, agentRef: saved.agent_ref };
105987
- };
105988
106291
  approve = async (request2, catalog, directories, bindingAuthorityId, now, signal) => {
105989
106292
  signal.throwIfAborted();
105990
106293
  const existing = this.#database.prepare(
@@ -106074,8 +106377,7 @@ ${content32.join("\n")}
106074
106377
  WHERE grants.local_grant_id = ? AND grants.bot_id = ?
106075
106378
  AND behavior_revision_id = ? AND behavior_digest = ?
106076
106379
  AND binding_id = ? AND binding_revision = ?
106077
- AND agent_ref = ?
106078
- AND revoked_at IS NULL AND expires_at > ?`
106380
+ AND agent_ref = ?`
106079
106381
  ).get(
106080
106382
  command.localGrantId,
106081
106383
  command.botId,
@@ -106083,8 +106385,7 @@ ${content32.join("\n")}
106083
106385
  command.behaviorDigest,
106084
106386
  command.bindingId,
106085
106387
  command.bindingRevision,
106086
- command.agentId,
106087
- now
106388
+ command.agentId
106088
106389
  );
106089
106390
  if (row === void 0) {
106090
106391
  throw new LocalBotAuthorizationError(
@@ -106097,14 +106398,14 @@ ${content32.join("\n")}
106097
106398
  if (!exactTargets(approvedTargets, requestedTargets)) {
106098
106399
  throw new LocalBotAuthorizationError(
106099
106400
  "binding_not_approved",
106100
- "The Bot execution target policy changed after local approval"
106401
+ "The Bot execution target policy differs from its binding"
106101
106402
  );
106102
106403
  }
106103
106404
  const approvedConfigurations = parseSessionConfigurations(rowString(row, "session_configurations_json"));
106104
106405
  if (!exactSessionConfigurations(approvedConfigurations, command.sessionConfigurations)) {
106105
106406
  throw new LocalBotAuthorizationError(
106106
106407
  "binding_not_approved",
106107
- "The Bot Agent configuration changed after local approval"
106408
+ "The Bot Agent configuration differs from its binding"
106108
106409
  );
106109
106410
  }
106110
106411
  const agent = catalog.find(command.agentId);
@@ -106113,17 +106414,29 @@ ${content32.join("\n")}
106113
106414
  revalidateExecutable(agent.agentIdentity)
106114
106415
  ]);
106115
106416
  signal.throwIfAborted();
106417
+ if (!adapterUnchanged || !agentUnchanged) {
106418
+ throw new LocalBotAuthorizationError(
106419
+ "binding_incompatible",
106420
+ "The local Agent executable changed while the Runtime is active; restart the Runtime"
106421
+ );
106422
+ }
106116
106423
  const workspaceRef = rowString(row, "workspace_ref");
106117
106424
  const workspacePath = await directories.resolve(bindingAuthorityId, workspaceRef, signal);
106118
106425
  const currentAgentDigest = agentDigest(agent);
106119
- const currentWorkspaceDigest = await workspaceDigest(workspacePath);
106426
+ const currentWorkspaceDigest = workspaceDigest(workspacePath);
106120
106427
  signal.throwIfAborted();
106121
- if (!adapterUnchanged || !agentUnchanged || currentAgentDigest !== rowString(row, "agent_identity_digest") || currentWorkspaceDigest !== rowString(row, "workspace_identity_digest") || workspacePath !== rowString(row, "workspace_path")) {
106122
- this.revoke(rowString(row, "local_grant_id"), now);
106123
- throw new LocalBotAuthorizationError(
106124
- "binding_not_approved",
106125
- "The Bot execution target changed and requires local approval"
106428
+ let expiresAt = rowInteger(row, "expires_at");
106429
+ let revocationEpoch = rowInteger(row, "revocation_epoch");
106430
+ if (currentAgentDigest !== rowString(row, "agent_identity_digest") || currentWorkspaceDigest !== rowString(row, "workspace_identity_digest") || workspacePath !== rowString(row, "workspace_path") || expiresAt <= now || rowHasInteger(row, "revoked_at")) {
106431
+ const refreshed = this.refreshTarget(
106432
+ rowString(row, "local_grant_id"),
106433
+ currentAgentDigest,
106434
+ currentWorkspaceDigest,
106435
+ workspacePath,
106436
+ now
106126
106437
  );
106438
+ expiresAt = refreshed.expiresAt;
106439
+ revocationEpoch = refreshed.revocationEpoch;
106127
106440
  }
106128
106441
  if (command.behaviorInstructions.length > 0 && !agent.capabilities.embeddedContextPrompt) {
106129
106442
  throw new LocalBotAuthorizationError(
@@ -106144,8 +106457,8 @@ ${content32.join("\n")}
106144
106457
  workspacePath,
106145
106458
  currentWorkspaceDigest,
106146
106459
  approvedTargets,
106147
- rowInteger(row, "expires_at"),
106148
- rowInteger(row, "revocation_epoch")
106460
+ expiresAt,
106461
+ revocationEpoch
106149
106462
  );
106150
106463
  };
106151
106464
  recordUnavailable = (request2, code, message, now) => {
@@ -106188,16 +106501,65 @@ ${content32.join("\n")}
106188
106501
  return {
106189
106502
  agent,
106190
106503
  agentIdentityDigest: agentDigest(agent),
106191
- workspaceIdentityDigest: await workspaceDigest(workspacePath),
106504
+ workspaceIdentityDigest: workspaceDigest(workspacePath),
106192
106505
  workspacePath
106193
106506
  };
106194
106507
  };
106195
- revoke = (localGrantId, now) => {
106196
- this.#database.prepare(
106197
- `UPDATE local_bot_grants
106198
- SET revoked_at = COALESCE(revoked_at, ?), revocation_epoch = revocation_epoch + 1
106199
- WHERE local_grant_id = ? AND revoked_at IS NULL`
106200
- ).run(now, localGrantId);
106508
+ refreshTarget = (localGrantId, agentIdentityDigest, workspaceIdentityDigest, workspacePath, now) => {
106509
+ const expiresAt = now + LOCAL_BOT_GRANT_LIFETIME_MILLISECONDS;
106510
+ this.#database.exec("BEGIN IMMEDIATE");
106511
+ try {
106512
+ const current2 = this.#database.prepare("SELECT * FROM local_bot_grants WHERE local_grant_id = ?").get(localGrantId);
106513
+ if (current2 === void 0) {
106514
+ throw new LocalBotAuthorizationError("local_grant_invalid", "The local Bot grant is missing");
106515
+ }
106516
+ const currentExpiresAt = rowInteger(current2, "expires_at");
106517
+ const currentRevocationEpoch = rowInteger(current2, "revocation_epoch");
106518
+ if (agentIdentityDigest === rowString(current2, "agent_identity_digest") && workspaceIdentityDigest === rowString(current2, "workspace_identity_digest") && workspacePath === rowString(current2, "workspace_path") && currentExpiresAt > now && !rowHasInteger(current2, "revoked_at")) {
106519
+ this.#database.exec("COMMIT");
106520
+ return { expiresAt: currentExpiresAt, revocationEpoch: currentRevocationEpoch };
106521
+ }
106522
+ const result = this.#database.prepare(
106523
+ `UPDATE local_bot_grants
106524
+ SET agent_identity_digest = ?, workspace_identity_digest = ?, workspace_path = ?,
106525
+ expires_at = ?, revoked_at = NULL, revocation_epoch = revocation_epoch + 1
106526
+ WHERE local_grant_id = ? AND revocation_epoch = ?`
106527
+ ).run(
106528
+ agentIdentityDigest,
106529
+ workspaceIdentityDigest,
106530
+ workspacePath,
106531
+ expiresAt,
106532
+ localGrantId,
106533
+ currentRevocationEpoch
106534
+ );
106535
+ if (result.changes !== 1) {
106536
+ throw new LocalBotAuthorizationError(
106537
+ "local_grant_invalid",
106538
+ "The local Bot grant target could not be refreshed"
106539
+ );
106540
+ }
106541
+ this.#database.prepare(
106542
+ `INSERT INTO audit_events (recorded_at, event, command_id, session_id, details_json)
106543
+ VALUES (?, 'bot_binding_target_refreshed', ?, '', ?)`
106544
+ ).run(
106545
+ new Date(now).toISOString(),
106546
+ rowString(current2, "binding_id"),
106547
+ JSON.stringify({
106548
+ agentIdentityChanged: agentIdentityDigest !== rowString(current2, "agent_identity_digest"),
106549
+ bindingId: rowString(current2, "binding_id"),
106550
+ botId: rowString(current2, "bot_id"),
106551
+ expired: currentExpiresAt <= now,
106552
+ revived: rowHasInteger(current2, "revoked_at"),
106553
+ workspaceIdentityChanged: workspaceIdentityDigest !== rowString(current2, "workspace_identity_digest"),
106554
+ workspacePathChanged: workspacePath !== rowString(current2, "workspace_path")
106555
+ })
106556
+ );
106557
+ this.#database.exec("COMMIT");
106558
+ return { expiresAt, revocationEpoch: currentRevocationEpoch + 1 };
106559
+ } catch (cause) {
106560
+ this.#database.exec("ROLLBACK");
106561
+ throw cause;
106562
+ }
106201
106563
  };
106202
106564
  };
106203
106565
  ActiveBotExecutionContext = class {
@@ -106343,8 +106705,8 @@ ${content32.join("\n")}
106343
106705
  listen = async (signal) => {
106344
106706
  signal.throwIfAborted();
106345
106707
  if (this.#usesFilesystemSocket) {
106346
- await (0, import_promises23.mkdir)((0, import_node_path22.dirname)(this.#socketPath), { mode: 448, recursive: true });
106347
- await (0, import_promises23.unlink)(this.#socketPath).catch((error622) => {
106708
+ await (0, import_promises22.mkdir)((0, import_node_path22.dirname)(this.#socketPath), { mode: 448, recursive: true });
106709
+ await (0, import_promises22.unlink)(this.#socketPath).catch((error622) => {
106348
106710
  if (!isRecord8(error622) || error622["code"] !== "ENOENT") {
106349
106711
  throw error622;
106350
106712
  }
@@ -106359,7 +106721,7 @@ ${content32.join("\n")}
106359
106721
  });
106360
106722
  });
106361
106723
  if (this.#usesFilesystemSocket) {
106362
- await (0, import_promises23.chmod)(this.#socketPath, 384);
106724
+ await (0, import_promises22.chmod)(this.#socketPath, 384);
106363
106725
  }
106364
106726
  signal.addEventListener("abort", this.abort, { once: true });
106365
106727
  if (signal.aborted) {
@@ -106379,7 +106741,7 @@ ${content32.join("\n")}
106379
106741
  });
106380
106742
  }
106381
106743
  if (this.#usesFilesystemSocket) {
106382
- await (0, import_promises23.unlink)(this.#socketPath).catch((error622) => {
106744
+ await (0, import_promises22.unlink)(this.#socketPath).catch((error622) => {
106383
106745
  if (!isRecord8(error622) || error622["code"] !== "ENOENT") {
106384
106746
  throw error622;
106385
106747
  }
@@ -106619,7 +106981,7 @@ ${content32.join("\n")}
106619
106981
  install = async (root, definition22, environment, signal) => {
106620
106982
  signal.throwIfAborted();
106621
106983
  try {
106622
- const metadata = await (0, import_promises25.stat)(root);
106984
+ const metadata = await (0, import_promises24.stat)(root);
106623
106985
  if (metadata.isDirectory()) {
106624
106986
  return await validateManagedNpmPackage(root, definition22);
106625
106987
  }
@@ -106629,8 +106991,8 @@ ${content32.join("\n")}
106629
106991
  }
106630
106992
  }
106631
106993
  const parent = (0, import_node_path24.dirname)(root);
106632
- await (0, import_promises25.mkdir)(parent, { mode: 448, recursive: true });
106633
- const staging = await (0, import_promises25.mkdtemp)((0, import_node_path24.join)(parent, `.${definition22.version}.staging-`));
106994
+ await (0, import_promises24.mkdir)(parent, { mode: 448, recursive: true });
106995
+ const staging = await (0, import_promises24.mkdtemp)((0, import_node_path24.join)(parent, `.${definition22.version}.staging-`));
106634
106996
  try {
106635
106997
  const npm = await findExecutableOnPath(process.platform === "win32" ? "npm.cmd" : "npm", environment);
106636
106998
  if (npm === null) {
@@ -106680,12 +107042,12 @@ ${content32.join("\n")}
106680
107042
  timeoutMilliseconds: INSTALL_TIMEOUT_MILLISECONDS
106681
107043
  });
106682
107044
  await Promise.all([
106683
- (0, import_promises25.rm)((0, import_node_path24.join)(staging, ".npm-cache"), { force: true, recursive: true }),
106684
- (0, import_promises25.rm)((0, import_node_path24.join)(staging, "home"), { force: true, recursive: true })
107045
+ (0, import_promises24.rm)((0, import_node_path24.join)(staging, ".npm-cache"), { force: true, recursive: true }),
107046
+ (0, import_promises24.rm)((0, import_node_path24.join)(staging, "home"), { force: true, recursive: true })
106685
107047
  ]);
106686
107048
  await validateManagedNpmPackage(staging, definition22);
106687
107049
  try {
106688
- await (0, import_promises25.rename)(staging, root);
107050
+ await (0, import_promises24.rename)(staging, root);
106689
107051
  } catch (error622) {
106690
107052
  try {
106691
107053
  return await validateManagedNpmPackage(root, definition22);
@@ -106711,7 +107073,7 @@ ${content32.join("\n")}
106711
107073
  { cause: error622 }
106712
107074
  );
106713
107075
  } finally {
106714
- await (0, import_promises25.rm)(staging, { force: true, recursive: true });
107076
+ await (0, import_promises24.rm)(staging, { force: true, recursive: true });
106715
107077
  }
106716
107078
  };
106717
107079
  };
@@ -107055,7 +107417,7 @@ ${content32.join("\n")}
107055
107417
  );
107056
107418
  if (managed.path === agent.path) {
107057
107419
  return Object.freeze({
107058
- GROK_HOME: await (0, import_promises27.realpath)(
107420
+ GROK_HOME: await (0, import_promises26.realpath)(
107059
107421
  (0, import_node_path28.join)(stateDirectory, "agents", this.id, GROK_BUILD_MANAGED_VERSION, "home")
107060
107422
  )
107061
107423
  });
@@ -107067,7 +107429,7 @@ ${content32.join("\n")}
107067
107429
  };
107068
107430
  resolveManagedAgent = async (stateDirectory, platform10, signal) => {
107069
107431
  signal.throwIfAborted();
107070
- const versionRoot = await (0, import_promises27.realpath)((0, import_node_path28.join)(stateDirectory, "agents", this.id, GROK_BUILD_MANAGED_VERSION));
107432
+ const versionRoot = await (0, import_promises26.realpath)((0, import_node_path28.join)(stateDirectory, "agents", this.id, GROK_BUILD_MANAGED_VERSION));
107071
107433
  await validateManagedNpmPackage((0, import_node_path28.join)(versionRoot, "package"), grokBuildManagedPackage(platform10, process.arch));
107072
107434
  const executable = await resolveExecutablePath((0, import_node_path28.join)(versionRoot, "home", "bin", "grok"), platform10);
107073
107435
  signal.throwIfAborted();
@@ -108008,9 +108370,9 @@ ${content32.join("\n")}
108008
108370
  throw new LocalAuthorizationError("The local directory path is invalid");
108009
108371
  }
108010
108372
  try {
108011
- const target = await (0, import_promises29.realpath)(requested);
108373
+ const target = await (0, import_promises28.realpath)(requested);
108012
108374
  signal.throwIfAborted();
108013
- const metadata = await (0, import_promises29.stat)(target);
108375
+ const metadata = await (0, import_promises28.stat)(target);
108014
108376
  signal.throwIfAborted();
108015
108377
  if (!(0, import_node_path37.isAbsolute)(target) || (0, import_node_path37.normalize)(target) !== target || !metadata.isDirectory()) {
108016
108378
  throw new LocalAuthorizationError("The selected location is not a directory");
@@ -108047,7 +108409,7 @@ ${content32.join("\n")}
108047
108409
  list = async (bindingId, id, signal) => {
108048
108410
  const target = await this.resolve(bindingId, id, signal);
108049
108411
  try {
108050
- const children = await (0, import_promises29.readdir)(target, { withFileTypes: true });
108412
+ const children = await (0, import_promises28.readdir)(target, { withFileTypes: true });
108051
108413
  signal.throwIfAborted();
108052
108414
  const entries = [];
108053
108415
  for (const child of children) {
@@ -110005,7 +110367,7 @@ function getApiKeyOrUndefined() {
110005
110367
 
110006
110368
  // src/utils/http.ts
110007
110369
  function getUserAgent() {
110008
- return `moxt-cli/${"0.12.6"} (${(0, import_os.platform)()}/${(0, import_os.arch)()}) node/${process.versions.node}`;
110370
+ return `moxt-cli/${"0.12.7"} (${(0, import_os.platform)()}/${(0, import_os.arch)()}) node/${process.versions.node}`;
110009
110371
  }
110010
110372
  async function sendRequest(method, path6, init) {
110011
110373
  return await fetch(`${getApiBaseUrl()}${path6}`, {
@@ -110192,8 +110554,8 @@ function readCommentContentFile(path6) {
110192
110554
  if (!fs.existsSync(path6)) {
110193
110555
  throw new FileCommentOptionsError(`Error: comment content file not found: ${path6}`);
110194
110556
  }
110195
- const stat10 = fs.statSync(path6);
110196
- if (!stat10.isFile()) {
110557
+ const stat9 = fs.statSync(path6);
110558
+ if (!stat9.isFile()) {
110197
110559
  throw new FileCommentOptionsError(`Error: comment content path is not a file: ${path6}`);
110198
110560
  }
110199
110561
  const buffer2 = fs.readFileSync(path6);
@@ -110864,8 +111226,8 @@ var FileTokenizer = class _FileTokenizer extends AbstractTokenizer {
110864
111226
  */
110865
111227
  static async fromFile(sourceFilePath) {
110866
111228
  const fileHandle = await (0, import_promises.open)(sourceFilePath, "r");
110867
- const stat10 = await fileHandle.stat();
110868
- return new _FileTokenizer(fileHandle, { fileInfo: { path: sourceFilePath, size: stat10.size } });
111229
+ const stat9 = await fileHandle.stat();
111230
+ return new _FileTokenizer(fileHandle, { fileInfo: { path: sourceFilePath, size: stat9.size } });
110869
111231
  }
110870
111232
  constructor(fileHandle, options) {
110871
111233
  super(options);
@@ -118365,7 +118727,7 @@ var titleBefore = {
118365
118727
  };
118366
118728
  function tokenizeDefinition(effects, ok3, nok) {
118367
118729
  const self = this;
118368
- let identifier3;
118730
+ let identifier2;
118369
118731
  return start;
118370
118732
  function start(code) {
118371
118733
  effects.enter("definition");
@@ -118384,7 +118746,7 @@ function tokenizeDefinition(effects, ok3, nok) {
118384
118746
  )(code);
118385
118747
  }
118386
118748
  function labelAfter(code) {
118387
- identifier3 = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1));
118749
+ identifier2 = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1));
118388
118750
  if (code === 58) {
118389
118751
  effects.enter("definitionMarker");
118390
118752
  effects.consume(code);
@@ -118418,7 +118780,7 @@ function tokenizeDefinition(effects, ok3, nok) {
118418
118780
  function afterWhitespace(code) {
118419
118781
  if (code === null || markdownLineEnding(code)) {
118420
118782
  effects.exit("definition");
118421
- self.parser.defined.push(identifier3);
118783
+ self.parser.defined.push(identifier2);
118422
118784
  return ok3(code);
118423
118785
  }
118424
118786
  return nok(code);
@@ -123591,8 +123953,8 @@ function readDescFile(path6) {
123591
123953
  if (!fs5.existsSync(path6)) {
123592
123954
  throw new WorkflowOptionsError(`Error: desc file not found: ${path6}`);
123593
123955
  }
123594
- const stat10 = fs5.statSync(path6);
123595
- if (!stat10.isFile()) {
123956
+ const stat9 = fs5.statSync(path6);
123957
+ if (!stat9.isFile()) {
123596
123958
  throw new WorkflowOptionsError(`Error: desc file is not a file: ${path6}`);
123597
123959
  }
123598
123960
  const buffer2 = fs5.readFileSync(path6);
@@ -123609,11 +123971,11 @@ function readCommentContentFile2(path6) {
123609
123971
  if (!fs5.existsSync(path6)) {
123610
123972
  throw new WorkflowOptionsError(`Error: comment content file not found: ${path6}`);
123611
123973
  }
123612
- const stat10 = fs5.statSync(path6);
123613
- if (!stat10.isFile()) {
123974
+ const stat9 = fs5.statSync(path6);
123975
+ if (!stat9.isFile()) {
123614
123976
  throw new WorkflowOptionsError(`Error: comment content path is not a file: ${path6}`);
123615
123977
  }
123616
- if (stat10.size > MAX_COMMENT_CONTENT_BYTES) {
123978
+ if (stat9.size > MAX_COMMENT_CONTENT_BYTES) {
123617
123979
  throw new WorkflowOptionsError(
123618
123980
  `Error: comment content file must be at most ${MAX_COMMENT_CONTENT_LENGTH} characters.`
123619
123981
  );
@@ -124652,7 +125014,7 @@ var FLUSH_TIMEOUT_MS = 3e3;
124652
125014
  var MAX_BATCH_SIZE = 100;
124653
125015
  function commonLabels() {
124654
125016
  return {
124655
- cli_version: "0.12.6",
125017
+ cli_version: "0.12.7",
124656
125018
  node_version: process.versions.node,
124657
125019
  os: (0, import_node_os14.platform)(),
124658
125020
  arch: (0, import_node_os14.arch)(),
@@ -124698,7 +125060,7 @@ async function flush() {
124698
125060
  }
124699
125061
  const batch = buffer.splice(0, MAX_BATCH_SIZE);
124700
125062
  const payload = {
124701
- release_id: "0.12.6",
125063
+ release_id: "0.12.7",
124702
125064
  client_type: "cli",
124703
125065
  metric_data_list: batch.map((m) => ({
124704
125066
  profile: "cli",
@@ -124899,7 +125261,7 @@ function registryWorker() {
124899
125261
 
124900
125262
  // src/update/prompt.ts
124901
125263
  init_cjs_shims();
124902
- var import_promises31 = require("node:readline/promises");
125264
+ var import_promises30 = require("node:readline/promises");
124903
125265
  async function promptForUpdate(input3, output3, currentVersion, latestVersion, timeoutMs) {
124904
125266
  output3.write(`
124905
125267
  A new version of Moxt CLI is available: ${currentVersion} \u2192 ${latestVersion}
@@ -124912,7 +125274,7 @@ A new version of Moxt CLI is available: ${currentVersion} \u2192 ${latestVersion
124912
125274
  const controller = new AbortController();
124913
125275
  const timeout = setTimeout(() => controller.abort(), timeoutMs);
124914
125276
  timeout.unref();
124915
- const readline = (0, import_promises31.createInterface)({ input: input3, output: output3, terminal: true });
125277
+ const readline = (0, import_promises30.createInterface)({ input: input3, output: output3, terminal: true });
124916
125278
  try {
124917
125279
  const answer = await readline.question("", { signal: controller.signal });
124918
125280
  if (answer.trim() === "1") return "update";
@@ -125081,9 +125443,9 @@ function commandPath3(command) {
125081
125443
  }
125082
125444
 
125083
125445
  // src/index.ts
125084
- var program2 = createProgram("0.12.6");
125085
- installDaemonReconcileHook(program2, "0.12.6");
125086
- installUpdateHook(program2, "0.12.6");
125446
+ var program2 = createProgram("0.12.7");
125447
+ installDaemonReconcileHook(program2, "0.12.7");
125448
+ installUpdateHook(program2, "0.12.7");
125087
125449
  instrumentProgram(program2);
125088
125450
  installExitHandler();
125089
125451
  program2.parseAsync(process.argv).then(async () => {