@moxt-ai/mobius 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/acp/create-client.d.ts.map +1 -1
  2. package/dist/acp/create-client.js +16 -1
  3. package/dist/acp/create-client.js.map +1 -1
  4. package/dist/agent-catalog/agent-discovery.d.ts +1 -1
  5. package/dist/agent-catalog/agent-discovery.d.ts.map +1 -1
  6. package/dist/agent-catalog/agent-discovery.js +2 -2
  7. package/dist/agent-catalog/agent-discovery.js.map +1 -1
  8. package/dist/agent-catalog/agent-specification.d.ts +1 -0
  9. package/dist/agent-catalog/agent-specification.d.ts.map +1 -1
  10. package/dist/agent-catalog/agent-specification.js +1 -0
  11. package/dist/agent-catalog/agent-specification.js.map +1 -1
  12. package/dist/agent-catalog/agents/cursor-cli-agent.d.ts +13 -0
  13. package/dist/agent-catalog/agents/cursor-cli-agent.d.ts.map +1 -0
  14. package/dist/agent-catalog/agents/cursor-cli-agent.js +25 -0
  15. package/dist/agent-catalog/agents/cursor-cli-agent.js.map +1 -0
  16. package/dist/agent-catalog/agents/grok-build-agent.d.ts +18 -0
  17. package/dist/agent-catalog/agents/grok-build-agent.d.ts.map +1 -0
  18. package/dist/agent-catalog/agents/grok-build-agent.js +75 -0
  19. package/dist/agent-catalog/agents/grok-build-agent.js.map +1 -0
  20. package/dist/agent-catalog/agents/supported-agent-specifications.d.ts.map +1 -1
  21. package/dist/agent-catalog/agents/supported-agent-specifications.js +6 -0
  22. package/dist/agent-catalog/agents/supported-agent-specifications.js.map +1 -1
  23. package/dist/agent-catalog/agents/verify-session-creation.d.ts +3 -0
  24. package/dist/agent-catalog/agents/verify-session-creation.d.ts.map +1 -0
  25. package/dist/agent-catalog/agents/verify-session-creation.js +16 -0
  26. package/dist/agent-catalog/agents/verify-session-creation.js.map +1 -0
  27. package/dist/agent-catalog/agents/workbuddy-agent.d.ts +17 -0
  28. package/dist/agent-catalog/agents/workbuddy-agent.d.ts.map +1 -0
  29. package/dist/agent-catalog/agents/workbuddy-agent.js +73 -0
  30. package/dist/agent-catalog/agents/workbuddy-agent.js.map +1 -0
  31. package/dist/agent-catalog/discover-local-agents.d.ts +3 -0
  32. package/dist/agent-catalog/discover-local-agents.d.ts.map +1 -1
  33. package/dist/agent-catalog/discover-local-agents.js +4 -10
  34. package/dist/agent-catalog/discover-local-agents.js.map +1 -1
  35. package/dist/agent-catalog/executable-discovery.d.ts.map +1 -1
  36. package/dist/agent-catalog/executable-discovery.js +18 -8
  37. package/dist/agent-catalog/executable-discovery.js.map +1 -1
  38. package/dist/agent-catalog/local-agent.d.ts +1 -2
  39. package/dist/agent-catalog/local-agent.d.ts.map +1 -1
  40. package/dist/agent-catalog/local-agent.js +1 -3
  41. package/dist/agent-catalog/local-agent.js.map +1 -1
  42. package/dist/agent-catalog/publish-agent-catalog.d.ts.map +1 -1
  43. package/dist/agent-catalog/publish-agent-catalog.js +0 -1
  44. package/dist/agent-catalog/publish-agent-catalog.js.map +1 -1
  45. package/dist/agent-installation/agent-installation-manager.d.ts +1 -8
  46. package/dist/agent-installation/agent-installation-manager.d.ts.map +1 -1
  47. package/dist/agent-installation/agent-installation-manager.js +7 -24
  48. package/dist/agent-installation/agent-installation-manager.js.map +1 -1
  49. package/dist/agent-installation/fixed-agent-install-recipe.d.ts +20 -0
  50. package/dist/agent-installation/fixed-agent-install-recipe.d.ts.map +1 -0
  51. package/dist/agent-installation/fixed-agent-install-recipe.js +18 -0
  52. package/dist/agent-installation/fixed-agent-install-recipe.js.map +1 -0
  53. package/dist/agent-installation/fixed-agent-install-recipes.d.ts +5 -18
  54. package/dist/agent-installation/fixed-agent-install-recipes.d.ts.map +1 -1
  55. package/dist/agent-installation/fixed-agent-install-recipes.js +9 -16
  56. package/dist/agent-installation/fixed-agent-install-recipes.js.map +1 -1
  57. package/dist/agent-installation/grok-build-install-recipe.d.ts +12 -0
  58. package/dist/agent-installation/grok-build-install-recipe.d.ts.map +1 -0
  59. package/dist/agent-installation/grok-build-install-recipe.js +102 -0
  60. package/dist/agent-installation/grok-build-install-recipe.js.map +1 -0
  61. package/dist/agent-installation/grok-managed-package.d.ts +4 -0
  62. package/dist/agent-installation/grok-managed-package.d.ts.map +1 -0
  63. package/dist/agent-installation/grok-managed-package.js +34 -0
  64. package/dist/agent-installation/grok-managed-package.js.map +1 -0
  65. package/dist/agent-installation/managed-npm-package.d.ts +8 -0
  66. package/dist/agent-installation/managed-npm-package.d.ts.map +1 -1
  67. package/dist/agent-installation/managed-npm-package.js +32 -3
  68. package/dist/agent-installation/managed-npm-package.js.map +1 -1
  69. package/dist/agent-installation/workbuddy-install-recipe.d.ts +12 -0
  70. package/dist/agent-installation/workbuddy-install-recipe.d.ts.map +1 -0
  71. package/dist/agent-installation/workbuddy-install-recipe.js +51 -0
  72. package/dist/agent-installation/workbuddy-install-recipe.js.map +1 -0
  73. package/dist/agent-installation/workbuddy-managed-package.d.ts +10 -0
  74. package/dist/agent-installation/workbuddy-managed-package.d.ts.map +1 -0
  75. package/dist/agent-installation/workbuddy-managed-package.js +11 -0
  76. package/dist/agent-installation/workbuddy-managed-package.js.map +1 -0
  77. package/dist/cli.js +836 -361
  78. package/dist/cli.js.map +4 -4
  79. package/dist/index.js +781 -306
  80. package/dist/index.js.map +4 -4
  81. package/dist/pairing/pair-local-machine.d.ts.map +1 -1
  82. package/dist/pairing/pair-local-machine.js +0 -1
  83. package/dist/pairing/pair-local-machine.js.map +1 -1
  84. package/dist/run-daemon.d.ts.map +1 -1
  85. package/dist/run-daemon.js +3 -12
  86. package/dist/run-daemon.js.map +1 -1
  87. package/package.json +2 -2
  88. package/dist/agent-installation/installation-grants.d.ts +0 -2
  89. package/dist/agent-installation/installation-grants.d.ts.map +0 -1
  90. package/dist/agent-installation/installation-grants.js +0 -51
  91. package/dist/agent-installation/installation-grants.js.map +0 -1
  92. package/dist/agent-installation/local-installation-authorizer.d.ts +0 -7
  93. package/dist/agent-installation/local-installation-authorizer.d.ts.map +0 -1
  94. package/dist/agent-installation/local-installation-authorizer.js +0 -32
  95. package/dist/agent-installation/local-installation-authorizer.js.map +0 -1
package/dist/index.js CHANGED
@@ -9,6 +9,9 @@ import {
9
9
  client,
10
10
  methods
11
11
  } from "@agentclientprotocol/sdk";
12
+ function discardExtensionParams(_params) {
13
+ return Object.freeze({});
14
+ }
12
15
  var createAcpClient = (handler) => client({ name: "mobius" }).onRequest(
13
16
  methods.client.session.requestPermission,
14
17
  async (context) => await handler.onPermission(context.params, context.signal)
@@ -19,7 +22,26 @@ var createAcpClient = (handler) => client({ name: "mobius" }).onRequest(
19
22
  await handler.onUpdate(context.params);
20
23
  }).onNotification(methods.client.elicitation.complete, async (context) => {
21
24
  await handler.onElicitationComplete(context.params);
22
- });
25
+ }).onRequest("cursor/ask_question", discardExtensionParams, async () => ({
26
+ outcome: {
27
+ outcome: "skipped",
28
+ reason: "Mobius does not expose Cursor question extensions"
29
+ }
30
+ })).onRequest("cursor/create_plan", discardExtensionParams, async () => ({
31
+ outcome: { outcome: "cancelled" }
32
+ })).onNotification(
33
+ "cursor/update_todos",
34
+ discardExtensionParams,
35
+ async () => Promise.resolve()
36
+ ).onNotification(
37
+ "cursor/task",
38
+ discardExtensionParams,
39
+ async () => Promise.resolve()
40
+ ).onNotification(
41
+ "cursor/generate_image",
42
+ discardExtensionParams,
43
+ async () => Promise.resolve()
44
+ );
23
45
 
24
46
  // src/config.ts
25
47
  import { join as join3 } from "node:path";
@@ -1985,8 +2007,8 @@ function emoji() {
1985
2007
  }
1986
2008
  var ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
1987
2009
  var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
1988
- var mac = (delimiter2) => {
1989
- const escapedDelim = escapeRegex(delimiter2 ?? ":");
2010
+ var mac = (delimiter3) => {
2011
+ const escapedDelim = escapeRegex(delimiter3 ?? ":");
1990
2012
  return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
1991
2013
  };
1992
2014
  var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
@@ -18961,7 +18983,6 @@ var SESSION_OPERATION_FAILED_KIND = "session.operation.failed";
18961
18983
  var AGENT_CONTENT_KIND = "agent.content";
18962
18984
  var AGENT_INSTALL_REQUEST_KIND = "agent.install.request";
18963
18985
  var AGENT_INSTALL_CANCEL_KIND = "agent.install.cancel";
18964
- var AGENT_INSTALL_AWAITING_APPROVAL_KIND = "agent.install.awaiting_approval";
18965
18986
  var AGENT_INSTALL_STARTED_KIND = "agent.install.started";
18966
18987
  var AGENT_INSTALL_PROGRESS_KIND = "agent.install.progress";
18967
18988
  var AGENT_INSTALL_COMPLETED_KIND = "agent.install.completed";
@@ -19267,10 +19288,6 @@ var agentInstallCancelCommandSchema = external_exports.strictObject({
19267
19288
  kind: external_exports.literal(AGENT_INSTALL_CANCEL_KIND),
19268
19289
  requestId: IDENTIFIER
19269
19290
  }).readonly();
19270
- var agentInstallAwaitingApprovalEventSchema = external_exports.strictObject({
19271
- ...agentInstallIdentityFields,
19272
- kind: external_exports.literal(AGENT_INSTALL_AWAITING_APPROVAL_KIND)
19273
- }).readonly();
19274
19291
  var agentInstallStartedEventSchema = external_exports.strictObject({
19275
19292
  ...agentInstallIdentityFields,
19276
19293
  kind: external_exports.literal(AGENT_INSTALL_STARTED_KIND)
@@ -19353,7 +19370,6 @@ var encodeSessionOperationFailedEvent = (message) => encode3(message, sessionOpe
19353
19370
  var encodeAgentContentEvent = (message) => encode3(message, agentContentEventSchema);
19354
19371
  var decodeAgentInstallRequestCommand = (encoded) => decode3(encoded, agentInstallRequestCommandSchema);
19355
19372
  var decodeAgentInstallCancelCommand = (encoded) => decode3(encoded, agentInstallCancelCommandSchema);
19356
- var encodeAgentInstallAwaitingApprovalEvent = (message) => encode3(message, agentInstallAwaitingApprovalEventSchema);
19357
19373
  var encodeAgentInstallStartedEvent = (message) => encode3(message, agentInstallStartedEventSchema);
19358
19374
  var encodeAgentInstallProgressEvent = (message) => encode3(message, agentInstallProgressEventSchema);
19359
19375
  var encodeAgentInstallCompletedEvent = (message) => encode3(message, agentInstallCompletedEventSchema);
@@ -21004,11 +21020,9 @@ var LocalAgentDefinition = class {
21004
21020
  var InstallableAgentDefinition = class {
21005
21021
  id;
21006
21022
  label;
21007
- requiresLocalApproval;
21008
- constructor(id, label, requiresLocalApproval = true) {
21023
+ constructor(id, label) {
21009
21024
  this.id = id;
21010
21025
  this.label = label;
21011
- this.requiresLocalApproval = requiresLocalApproval;
21012
21026
  }
21013
21027
  };
21014
21028
  var LocalAgentCatalogSnapshot = class {
@@ -24170,58 +24184,16 @@ var LocalAuthorizationError = class extends Error {
24170
24184
  import { randomUUID } from "node:crypto";
24171
24185
  import {
24172
24186
  mkdir as mkdir3,
24173
- open as open6,
24174
- realpath as realpath5,
24187
+ open as open5,
24188
+ realpath as realpath6,
24175
24189
  rename as rename3,
24176
24190
  stat as stat5,
24177
24191
  writeFile as writeFile2
24178
24192
  } from "node:fs/promises";
24179
24193
  import { hostname as hostname3 } from "node:os";
24180
- import { basename, join as join13, resolve as resolve3 } from "node:path";
24194
+ import { basename, join as join14, resolve as resolve3 } from "node:path";
24181
24195
  import { fetch as fetch2 } from "undici";
24182
24196
 
24183
- // src/agent-installation/installation-grants.ts
24184
- import { open as open2 } from "node:fs/promises";
24185
- import { join as join4 } from "node:path";
24186
- var MAX_GRANT_FILE_LENGTH = 16 * 1024;
24187
- var AGENT_ID_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
24188
- function isRecord4(value) {
24189
- return typeof value === "object" && value !== null && !Array.isArray(value);
24190
- }
24191
- async function readGrantedAgents(stateDirectory) {
24192
- const path2 = join4(stateDirectory, "installation-grants.json");
24193
- let handle;
24194
- try {
24195
- handle = await open2(path2, "r");
24196
- } catch (error61) {
24197
- if (error61 instanceof Error && "code" in error61 && error61.code === "ENOENT") {
24198
- return /* @__PURE__ */ new Set();
24199
- }
24200
- throw error61;
24201
- }
24202
- try {
24203
- const metadata = await handle.stat();
24204
- if (!metadata.isFile() || metadata.size > MAX_GRANT_FILE_LENGTH || typeof process.getuid === "function" && metadata.uid !== process.getuid() || process.platform !== "win32" && (metadata.mode & 63) !== 0) {
24205
- throw new Error("The local installation grant file is not private");
24206
- }
24207
- const encoded = await handle.readFile({ encoding: "utf8" });
24208
- const value = JSON.parse(encoded);
24209
- if (!isRecord4(value) || Object.keys(value).length !== 1 || !Array.isArray(value["agents"])) {
24210
- throw new Error("The local installation grant file is invalid");
24211
- }
24212
- const agents = /* @__PURE__ */ new Set();
24213
- for (const candidate of value["agents"]) {
24214
- if (typeof candidate !== "string" || !AGENT_ID_PATTERN.test(candidate) || agents.has(candidate)) {
24215
- throw new Error("The local installation grant file is invalid");
24216
- }
24217
- agents.add(candidate);
24218
- }
24219
- return agents;
24220
- } finally {
24221
- await handle.close();
24222
- }
24223
- }
24224
-
24225
24197
  // src/agent-catalog/agent-discovery.ts
24226
24198
  var AgentDiscovery = class {
24227
24199
  specification;
@@ -24286,7 +24258,7 @@ var LocalAgentInventory = class {
24286
24258
  discoveries;
24287
24259
  installable;
24288
24260
  unavailable;
24289
- constructor(discoveries, grantedAgents = /* @__PURE__ */ new Set(), platform = process.platform, architecture = process.arch) {
24261
+ constructor(discoveries, platform = process.platform, architecture = process.arch) {
24290
24262
  const available = [];
24291
24263
  const unavailable = [];
24292
24264
  for (const discovery of discoveries) {
@@ -24309,8 +24281,7 @@ var LocalAgentInventory = class {
24309
24281
  ).map(
24310
24282
  (discovery) => new InstallableAgentDefinition(
24311
24283
  discovery.specification.id,
24312
- discovery.specification.label,
24313
- !grantedAgents.has(discovery.specification.id)
24284
+ discovery.specification.label
24314
24285
  )
24315
24286
  )
24316
24287
  );
@@ -24323,13 +24294,13 @@ var LocalAgentInventory = class {
24323
24294
  import {
24324
24295
  mkdir,
24325
24296
  mkdtemp,
24326
- open as open3,
24297
+ open as open2,
24327
24298
  realpath as realpath2,
24328
24299
  rename,
24329
24300
  rm,
24330
24301
  stat as stat2
24331
24302
  } from "node:fs/promises";
24332
- import { delimiter, dirname as dirname3, isAbsolute, join as join5, relative, sep } from "node:path";
24303
+ import { delimiter, dirname as dirname3, isAbsolute, join as join4, relative, sep } from "node:path";
24333
24304
  var INSTALL_TIMEOUT_MILLISECONDS = 5 * 60 * 1e3;
24334
24305
  var PACKAGE_METADATA_LIMIT_BYTES = 64 * 1024;
24335
24306
  var PACKAGE_LOCK_LIMIT_BYTES = 8 * 1024 * 1024;
@@ -24348,6 +24319,7 @@ var ManagedNpmPackageDefinition = class {
24348
24319
  };
24349
24320
  var SriManagedNpmPackageDefinition = class extends ManagedNpmPackageDefinition {
24350
24321
  integrity;
24322
+ requiredDependencies = Object.freeze([]);
24351
24323
  tarballUrl;
24352
24324
  constructor(packageName, version2, executableName, integrity, tarballUrl) {
24353
24325
  super(packageName, version2, executableName);
@@ -24355,6 +24327,18 @@ var SriManagedNpmPackageDefinition = class extends ManagedNpmPackageDefinition {
24355
24327
  this.tarballUrl = tarballUrl;
24356
24328
  }
24357
24329
  };
24330
+ var SriManagedNpmDependencyDefinition = class {
24331
+ integrity;
24332
+ packageName;
24333
+ tarballUrl;
24334
+ version;
24335
+ constructor(packageName, version2, integrity, tarballUrl) {
24336
+ this.integrity = integrity;
24337
+ this.packageName = packageName;
24338
+ this.tarballUrl = tarballUrl;
24339
+ this.version = version2;
24340
+ }
24341
+ };
24358
24342
  var ManagedNpmPackageError = class extends Error {
24359
24343
  code;
24360
24344
  constructor(code, message, options = {}) {
@@ -24363,11 +24347,11 @@ var ManagedNpmPackageError = class extends Error {
24363
24347
  this.name = "ManagedNpmPackageError";
24364
24348
  }
24365
24349
  };
24366
- function isRecord5(value) {
24350
+ function isRecord4(value) {
24367
24351
  return typeof value === "object" && value !== null && !Array.isArray(value);
24368
24352
  }
24369
24353
  function packagePath(root, packageName) {
24370
- return join5(root, "node_modules", ...packageName.split("/"));
24354
+ return join4(root, "node_modules", ...packageName.split("/"));
24371
24355
  }
24372
24356
  function isContainedPath(root, candidate) {
24373
24357
  const difference = relative(root, candidate);
@@ -24375,7 +24359,7 @@ function isContainedPath(root, candidate) {
24375
24359
  }
24376
24360
  async function readJsonRecord(path2, maximumBytes) {
24377
24361
  try {
24378
- const handle = await open3(path2, "r");
24362
+ const handle = await open2(path2, "r");
24379
24363
  try {
24380
24364
  const metadata = await handle.stat();
24381
24365
  if (!metadata.isFile() || metadata.size > maximumBytes) {
@@ -24387,7 +24371,7 @@ async function readJsonRecord(path2, maximumBytes) {
24387
24371
  const value = JSON.parse(
24388
24372
  await handle.readFile({ encoding: "utf8" })
24389
24373
  );
24390
- if (!isRecord5(value)) {
24374
+ if (!isRecord4(value)) {
24391
24375
  throw new ManagedNpmPackageError(
24392
24376
  "managed_package_verification_failed",
24393
24377
  "The managed npm package metadata is invalid"
@@ -24413,7 +24397,7 @@ function readBinPath(packageMetadata, executableName) {
24413
24397
  if (typeof bin === "string") {
24414
24398
  return bin;
24415
24399
  }
24416
- if (isRecord5(bin) && typeof bin[executableName] === "string") {
24400
+ if (isRecord4(bin) && typeof bin[executableName] === "string") {
24417
24401
  return bin[executableName];
24418
24402
  }
24419
24403
  throw new ManagedNpmPackageError(
@@ -24421,7 +24405,7 @@ function readBinPath(packageMetadata, executableName) {
24421
24405
  "The managed npm package executable declaration is invalid"
24422
24406
  );
24423
24407
  }
24424
- function verifyPackageLock(lock, definition) {
24408
+ function verifyPackageLockEntry(lock, definition, verifyDependencyClosure) {
24425
24409
  if (lock["lockfileVersion"] !== 3) {
24426
24410
  throw new ManagedNpmPackageError(
24427
24411
  "managed_package_verification_failed",
@@ -24429,7 +24413,7 @@ function verifyPackageLock(lock, definition) {
24429
24413
  );
24430
24414
  }
24431
24415
  const packages = lock["packages"];
24432
- if (!isRecord5(packages)) {
24416
+ if (!isRecord4(packages)) {
24433
24417
  throw new ManagedNpmPackageError(
24434
24418
  "managed_package_verification_failed",
24435
24419
  "The managed npm package lockfile is invalid"
@@ -24440,10 +24424,10 @@ function verifyPackageLock(lock, definition) {
24440
24424
  let matches = 0;
24441
24425
  for (const [key, candidate] of Object.entries(packages)) {
24442
24426
  const normalizedKey = key.replaceAll("\\", "/");
24443
- if (definition.verifyDependencyClosure && normalizedKey.length > 0) {
24427
+ if (verifyDependencyClosure && normalizedKey.length > 0) {
24444
24428
  let resolved;
24445
24429
  try {
24446
- if (!normalizedKey.split("/").includes("node_modules") || !isRecord5(candidate) || typeof candidate["version"] !== "string" || candidate["version"].length === 0 || typeof candidate["integrity"] !== "string" || !/^sha512-[A-Za-z0-9+/]{86}==$/.test(candidate["integrity"]) || typeof candidate["resolved"] !== "string") {
24430
+ if (!normalizedKey.split("/").includes("node_modules") || !isRecord4(candidate) || typeof candidate["version"] !== "string" || candidate["version"].length === 0 || typeof candidate["integrity"] !== "string" || !/^sha512-[A-Za-z0-9+/]{86}==$/.test(candidate["integrity"]) || typeof candidate["resolved"] !== "string") {
24447
24431
  throw new Error("Invalid locked dependency");
24448
24432
  }
24449
24433
  resolved = new URL(candidate["resolved"]);
@@ -24466,13 +24450,35 @@ function verifyPackageLock(lock, definition) {
24466
24450
  matches += 1;
24467
24451
  }
24468
24452
  }
24469
- if (matches !== 1 || !isRecord5(entry) || entry["integrity"] !== definition.integrity || entry["resolved"] !== definition.tarballUrl || entry["version"] !== definition.version) {
24453
+ if (matches !== 1 || !isRecord4(entry) || entry["integrity"] !== definition.integrity || entry["resolved"] !== definition.tarballUrl || entry["version"] !== definition.version) {
24470
24454
  throw new ManagedNpmPackageError(
24471
24455
  "managed_package_verification_failed",
24472
24456
  "The managed npm package lockfile does not match the pinned artifact"
24473
24457
  );
24474
24458
  }
24475
24459
  }
24460
+ async function verifyRequiredDependency(rootPath, lock, definition) {
24461
+ const dependencyRoot = await realpath2(
24462
+ packagePath(rootPath, definition.packageName)
24463
+ );
24464
+ if (!isContainedPath(rootPath, dependencyRoot)) {
24465
+ throw new ManagedNpmPackageError(
24466
+ "managed_package_verification_failed",
24467
+ "The required managed npm dependency escaped its private cache"
24468
+ );
24469
+ }
24470
+ const metadata = await readJsonRecord(
24471
+ join4(dependencyRoot, "package.json"),
24472
+ PACKAGE_METADATA_LIMIT_BYTES
24473
+ );
24474
+ if (metadata["name"] !== definition.packageName || metadata["version"] !== definition.version) {
24475
+ throw new ManagedNpmPackageError(
24476
+ "managed_package_verification_failed",
24477
+ "The required managed npm dependency identity is invalid"
24478
+ );
24479
+ }
24480
+ verifyPackageLockEntry(lock, definition, false);
24481
+ }
24476
24482
  async function validateManagedNpmPackage(root, definition) {
24477
24483
  try {
24478
24484
  return await validateManagedNpmPackageContents(root, definition);
@@ -24499,7 +24505,7 @@ async function validateManagedNpmPackageContents(root, definition) {
24499
24505
  );
24500
24506
  }
24501
24507
  const metadata = await readJsonRecord(
24502
- join5(packageRoot, "package.json"),
24508
+ join4(packageRoot, "package.json"),
24503
24509
  PACKAGE_METADATA_LIMIT_BYTES
24504
24510
  );
24505
24511
  if (metadata["name"] !== definition.packageName || metadata["version"] !== definition.version) {
@@ -24509,17 +24515,22 @@ async function validateManagedNpmPackageContents(root, definition) {
24509
24515
  );
24510
24516
  }
24511
24517
  if (definition instanceof SriManagedNpmPackageDefinition) {
24512
- verifyPackageLock(
24513
- await readJsonRecord(
24514
- join5(rootPath, "package-lock.json"),
24515
- PACKAGE_LOCK_LIMIT_BYTES
24516
- ),
24517
- definition
24518
+ const lock = await readJsonRecord(
24519
+ join4(rootPath, "package-lock.json"),
24520
+ PACKAGE_LOCK_LIMIT_BYTES
24518
24521
  );
24522
+ verifyPackageLockEntry(
24523
+ lock,
24524
+ definition,
24525
+ definition.verifyDependencyClosure
24526
+ );
24527
+ for (const dependency of definition.requiredDependencies) {
24528
+ await verifyRequiredDependency(rootPath, lock, dependency);
24529
+ }
24519
24530
  }
24520
24531
  const declaredBin = readBinPath(metadata, definition.executableName);
24521
24532
  const executable = await resolveExecutablePath(
24522
- join5(packageRoot, declaredBin)
24533
+ join4(packageRoot, declaredBin)
24523
24534
  );
24524
24535
  if (executable === null || !isContainedPath(rootPath, executable.path)) {
24525
24536
  throw new ManagedNpmPackageError(
@@ -24545,7 +24556,7 @@ var ManagedNpmPackageInstaller = class {
24545
24556
  const parent = dirname3(root);
24546
24557
  await mkdir(parent, { mode: 448, recursive: true });
24547
24558
  const staging = await mkdtemp(
24548
- join5(parent, `.${definition.version}.staging-`)
24559
+ join4(parent, `.${definition.version}.staging-`)
24549
24560
  );
24550
24561
  try {
24551
24562
  const npm = await findExecutableOnPath(
@@ -24575,9 +24586,9 @@ var ManagedNpmPackageInstaller = class {
24575
24586
  `${definition.packageName}@${definition.version}`
24576
24587
  );
24577
24588
  const installEnvironment = {
24578
- HOME: join5(staging, "home"),
24589
+ HOME: join4(staging, "home"),
24579
24590
  NPM_CONFIG_AUDIT: "false",
24580
- NPM_CONFIG_CACHE: join5(staging, ".npm-cache"),
24591
+ NPM_CONFIG_CACHE: join4(staging, ".npm-cache"),
24581
24592
  NPM_CONFIG_FUND: "false",
24582
24593
  NPM_CONFIG_IGNORE_SCRIPTS: "true",
24583
24594
  NPM_CONFIG_PACKAGE_LOCK: "true",
@@ -24599,8 +24610,8 @@ var ManagedNpmPackageInstaller = class {
24599
24610
  timeoutMilliseconds: INSTALL_TIMEOUT_MILLISECONDS
24600
24611
  });
24601
24612
  await Promise.all([
24602
- rm(join5(staging, ".npm-cache"), { force: true, recursive: true }),
24603
- rm(join5(staging, "home"), { force: true, recursive: true })
24613
+ rm(join4(staging, ".npm-cache"), { force: true, recursive: true }),
24614
+ rm(join4(staging, "home"), { force: true, recursive: true })
24604
24615
  ]);
24605
24616
  await validateManagedNpmPackage(staging, definition);
24606
24617
  try {
@@ -24636,7 +24647,7 @@ var ManagedNpmPackageInstaller = class {
24636
24647
  };
24637
24648
 
24638
24649
  // src/agent-catalog/agent-specification.ts
24639
- import { join as join6 } from "node:path";
24650
+ import { join as join5 } from "node:path";
24640
24651
  var VERSION_PROBE_TIMEOUT_MILLISECONDS = 3e3;
24641
24652
  var ACP_PROBE_TIMEOUT_MILLISECONDS = 5e3;
24642
24653
  var DEFAULT_PROMPT_TIMEOUT_MILLISECONDS = 30 * 60 * 1e3;
@@ -24650,7 +24661,7 @@ var LocalAgentSpecification = class {
24650
24661
  resolveManagedAgent = async (stateDirectory, platform, signal) => {
24651
24662
  signal.throwIfAborted();
24652
24663
  const executable = await resolveExecutablePath(
24653
- join6(stateDirectory, ...this.managedAgentExecutablePath),
24664
+ join5(stateDirectory, ...this.managedAgentExecutablePath),
24654
24665
  platform
24655
24666
  );
24656
24667
  signal.throwIfAborted();
@@ -24661,6 +24672,7 @@ var LocalAgentSpecification = class {
24661
24672
  };
24662
24673
  createLaunchEnvironment = async (_agent, _context) => Object.freeze({});
24663
24674
  recoveryCommand = () => "";
24675
+ resolveInstalledAgentExecutables = (_context) => Promise.resolve([]);
24664
24676
  supportsInstallation = (platform, architecture) => (platform === "darwin" || platform === "linux") && (architecture === "arm64" || architecture === "x64");
24665
24677
  verifyAcp = (_connection, _initialized, _defaultWorkspace, _signal) => Promise.resolve();
24666
24678
  };
@@ -24755,9 +24767,84 @@ var CodexAgentSpecification = class extends BridgedAcpAgentDefinition {
24755
24767
  managedAgentExecutablePath = ["agents", "codex", "bin", "codex"];
24756
24768
  };
24757
24769
 
24770
+ // src/agent-catalog/agent-probe-error.ts
24771
+ var AgentProbeError = class extends Error {
24772
+ code;
24773
+ constructor(code, message, options = {}) {
24774
+ super(message, options);
24775
+ this.code = code;
24776
+ this.name = "AgentProbeError";
24777
+ }
24778
+ };
24779
+
24780
+ // src/agent-catalog/agents/verify-session-creation.ts
24781
+ import {
24782
+ methods as methods3
24783
+ } from "@agentclientprotocol/sdk";
24784
+ async function verifySessionCreation(connection, capabilities, defaultWorkspace, signal, label) {
24785
+ const session = await connection.agent.request(
24786
+ methods3.agent.session.new,
24787
+ {
24788
+ additionalDirectories: [],
24789
+ cwd: defaultWorkspace,
24790
+ mcpServers: []
24791
+ },
24792
+ { cancellationSignal: signal }
24793
+ );
24794
+ if (session.sessionId.length === 0) {
24795
+ throw new AgentProbeError(
24796
+ "acp_incompatible",
24797
+ `${label} returned an invalid ACP session`
24798
+ );
24799
+ }
24800
+ if (capabilities.sessionCapabilities?.close != null) {
24801
+ await connection.agent.request(
24802
+ methods3.agent.session.close,
24803
+ { sessionId: session.sessionId },
24804
+ { cancellationSignal: signal }
24805
+ );
24806
+ }
24807
+ }
24808
+
24809
+ // src/agent-catalog/agents/cursor-cli-agent.ts
24810
+ var CURSOR_CLI_TESTED_VERSION = "2026.09.02-c22c1a3";
24811
+ var CursorCliAgentSpecification = class extends DirectAcpAgentDefinition {
24812
+ adapterVersion = CURSOR_CLI_TESTED_VERSION;
24813
+ authenticationCommand = () => "cursor-agent login";
24814
+ agentExecutable = "cursor-agent";
24815
+ id = "cursor";
24816
+ label = "Cursor CLI";
24817
+ constructor() {
24818
+ super(
24819
+ "MOBIUS_CURSOR_PATH",
24820
+ ["--disable-auto-update", "acp"],
24821
+ ["agents", "cursor", CURSOR_CLI_TESTED_VERSION, "bin", "cursor-agent"]
24822
+ );
24823
+ }
24824
+ supportsInstallation = (_platform, _architecture) => false;
24825
+ verifyAcp = async (connection, initialized, defaultWorkspace, signal) => {
24826
+ const capabilities = initialized.agentCapabilities ?? {};
24827
+ if (capabilities.loadSession !== true || capabilities.sessionCapabilities?.list == null || !(initialized.authMethods ?? []).some(
24828
+ (method) => method.id === "cursor_login"
24829
+ )) {
24830
+ throw new AgentProbeError(
24831
+ "acp_incompatible",
24832
+ "Cursor CLI reported an unsupported ACP capability set"
24833
+ );
24834
+ }
24835
+ await verifySessionCreation(
24836
+ connection,
24837
+ capabilities,
24838
+ defaultWorkspace,
24839
+ signal,
24840
+ this.label
24841
+ );
24842
+ };
24843
+ };
24844
+
24758
24845
  // src/agent-catalog/agents/deepseek-harness-agent.ts
24759
24846
  import { realpath as realpath3, stat as stat3 } from "node:fs/promises";
24760
- import { isAbsolute as isAbsolute2, join as join7, normalize } from "node:path";
24847
+ import { isAbsolute as isAbsolute2, join as join6, normalize } from "node:path";
24761
24848
 
24762
24849
  // src/agent-installation/deepseek-managed-package.ts
24763
24850
  var DeepSeekHarnessManagedPackage = class extends SriManagedNpmPackageDefinition {
@@ -24775,16 +24862,6 @@ var DEEPSEEK_HARNESS_PACKAGE = new DeepSeekHarnessManagedPackage(
24775
24862
  "https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.1.2-rc.1.tgz"
24776
24863
  );
24777
24864
 
24778
- // src/agent-catalog/agent-probe-error.ts
24779
- var AgentProbeError = class extends Error {
24780
- code;
24781
- constructor(code, message, options = {}) {
24782
- super(message, options);
24783
- this.code = code;
24784
- this.name = "AgentProbeError";
24785
- }
24786
- };
24787
-
24788
24865
  // src/agent-catalog/agents/deepseek-harness-agent.ts
24789
24866
  async function validateAgentHome(path2) {
24790
24867
  if (!isAbsolute2(path2) || normalize(path2) !== path2) {
@@ -24842,7 +24919,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
24842
24919
  context.signal
24843
24920
  );
24844
24921
  if (managed.path === agent.path) {
24845
- selectedHome = join7(
24922
+ selectedHome = join6(
24846
24923
  readStateDirectory(context.environment),
24847
24924
  "agents",
24848
24925
  this.id,
@@ -24863,7 +24940,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
24863
24940
  resolveManagedAgent = async (stateDirectory, _platform, signal) => {
24864
24941
  signal.throwIfAborted();
24865
24942
  const executable = await validateManagedNpmPackage(
24866
- join7(stateDirectory, "agents", this.id, DEEPSEEK_HARNESS_PACKAGE.version),
24943
+ join6(stateDirectory, "agents", this.id, DEEPSEEK_HARNESS_PACKAGE.version),
24867
24944
  DEEPSEEK_HARNESS_PACKAGE
24868
24945
  );
24869
24946
  signal.throwIfAborted();
@@ -24883,6 +24960,166 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
24883
24960
  };
24884
24961
  };
24885
24962
 
24963
+ // src/agent-catalog/agents/grok-build-agent.ts
24964
+ import { realpath as realpath4 } from "node:fs/promises";
24965
+ import { isAbsolute as isAbsolute3, join as join7, relative as relative2, sep as sep2 } from "node:path";
24966
+
24967
+ // src/agent-installation/grok-managed-package.ts
24968
+ var GROK_BUILD_MANAGED_VERSION = "1.0.21";
24969
+ var GrokBuildManagedPackage = class extends SriManagedNpmPackageDefinition {
24970
+ dependencyResolutionArguments = Object.freeze([
24971
+ "--before=2026-09-04T19:51:47.325Z"
24972
+ ]);
24973
+ includeOptionalDependencies = true;
24974
+ requiredDependencies;
24975
+ verifyDependencyClosure = true;
24976
+ constructor(requiredDependency) {
24977
+ super(
24978
+ "@xai-official/grok",
24979
+ GROK_BUILD_MANAGED_VERSION,
24980
+ "grok",
24981
+ "sha512-6yQqC+h1o+ObaqCxImK23dhkrOX1DEBMOKaH6fCK+B4gX0/8XIKZp0n7iKyBdK8KZa5vhMn7pS45kjX49Tps5g==",
24982
+ "https://registry.npmjs.org/@xai-official/grok/-/grok-1.0.21.tgz"
24983
+ );
24984
+ this.requiredDependencies = Object.freeze([requiredDependency]);
24985
+ }
24986
+ };
24987
+ var GROK_DARWIN_ARM64_PACKAGE = new SriManagedNpmDependencyDefinition(
24988
+ "@xai-official/grok-darwin-arm64",
24989
+ GROK_BUILD_MANAGED_VERSION,
24990
+ "sha512-I4pKZGnR6Mv4MJOJsB9B/i2o0ODF4eZtp4jHN5feoTqKIeAUVg38OzBtE8aN/wZa7Xg+qhnf6Jd1tcAFvMoFtQ==",
24991
+ "https://registry.npmjs.org/@xai-official/grok-darwin-arm64/-/grok-darwin-arm64-1.0.21.tgz"
24992
+ );
24993
+ var GROK_DARWIN_X64_PACKAGE = new SriManagedNpmDependencyDefinition(
24994
+ "@xai-official/grok-darwin-x64",
24995
+ GROK_BUILD_MANAGED_VERSION,
24996
+ "sha512-h0nFj3NZ9Kz8w6fQ6UDxxeSIhC1WjwwoRE92iNbG//tZy6YGkppR3s7oRVtt4Xl0CJANKUt0EusyIYnnAvKLzw==",
24997
+ "https://registry.npmjs.org/@xai-official/grok-darwin-x64/-/grok-darwin-x64-1.0.21.tgz"
24998
+ );
24999
+ var GROK_LINUX_ARM64_PACKAGE = new SriManagedNpmDependencyDefinition(
25000
+ "@xai-official/grok-linux-arm64",
25001
+ GROK_BUILD_MANAGED_VERSION,
25002
+ "sha512-Jlwz9XtZPNKz/V/ydifC8OVu3hIZz7pmoStt8c4KCqkSWjWiZ/PBIC0iJiq8rvByhx5Z0EdSyq8ZXVwtocceGA==",
25003
+ "https://registry.npmjs.org/@xai-official/grok-linux-arm64/-/grok-linux-arm64-1.0.21.tgz"
25004
+ );
25005
+ var GROK_LINUX_X64_PACKAGE = new SriManagedNpmDependencyDefinition(
25006
+ "@xai-official/grok-linux-x64",
25007
+ GROK_BUILD_MANAGED_VERSION,
25008
+ "sha512-AjDV5ifEz5LFG2Jt5IlhAeEkJati/wOvCchVbR4eIj2ogjvmXoXlzBrYRXuAJpXBy5q0se/Yuez5FxDU9Ju81w==",
25009
+ "https://registry.npmjs.org/@xai-official/grok-linux-x64/-/grok-linux-x64-1.0.21.tgz"
25010
+ );
25011
+ function grokBuildManagedPackage(platform, architecture) {
25012
+ if (platform === "darwin" && architecture === "arm64") {
25013
+ return new GrokBuildManagedPackage(GROK_DARWIN_ARM64_PACKAGE);
25014
+ }
25015
+ if (platform === "darwin" && architecture === "x64") {
25016
+ return new GrokBuildManagedPackage(GROK_DARWIN_X64_PACKAGE);
25017
+ }
25018
+ if (platform === "linux" && architecture === "arm64") {
25019
+ return new GrokBuildManagedPackage(GROK_LINUX_ARM64_PACKAGE);
25020
+ }
25021
+ if (platform === "linux" && architecture === "x64") {
25022
+ return new GrokBuildManagedPackage(GROK_LINUX_X64_PACKAGE);
25023
+ }
25024
+ throw new Error("Grok Build does not publish a package for this platform");
25025
+ }
25026
+
25027
+ // src/agent-catalog/agents/grok-build-agent.ts
25028
+ function isContainedPath2(root, candidate) {
25029
+ const difference = relative2(root, candidate);
25030
+ return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${sep2}`) && !isAbsolute3(difference);
25031
+ }
25032
+ var GrokBuildAgentSpecification = class extends DirectAcpAgentDefinition {
25033
+ adapterVersion = GROK_BUILD_MANAGED_VERSION;
25034
+ authenticationCommand = () => "grok login";
25035
+ agentExecutable = "grok";
25036
+ agentVersionArguments = ["version"];
25037
+ adapterVersionArguments = ["version"];
25038
+ id = "grok-build";
25039
+ label = "Grok Build";
25040
+ constructor() {
25041
+ super(
25042
+ "MOBIUS_GROK_BUILD_PATH",
25043
+ ["--no-auto-update", "agent", "stdio"],
25044
+ [
25045
+ "agents",
25046
+ "grok-build",
25047
+ GROK_BUILD_MANAGED_VERSION,
25048
+ "home",
25049
+ "bin",
25050
+ "grok"
25051
+ ]
25052
+ );
25053
+ }
25054
+ createLaunchEnvironment = async (agent, context) => {
25055
+ const stateDirectory = readStateDirectory(context.environment);
25056
+ try {
25057
+ const managed = await this.resolveManagedAgent(
25058
+ stateDirectory,
25059
+ context.platform ?? process.platform,
25060
+ context.signal
25061
+ );
25062
+ if (managed.path === agent.path) {
25063
+ return Object.freeze({
25064
+ GROK_HOME: await realpath4(
25065
+ join7(
25066
+ stateDirectory,
25067
+ "agents",
25068
+ this.id,
25069
+ GROK_BUILD_MANAGED_VERSION,
25070
+ "home"
25071
+ )
25072
+ )
25073
+ });
25074
+ }
25075
+ } catch {
25076
+ context.signal.throwIfAborted();
25077
+ }
25078
+ return Object.freeze({});
25079
+ };
25080
+ resolveManagedAgent = async (stateDirectory, platform, signal) => {
25081
+ signal.throwIfAborted();
25082
+ const versionRoot = await realpath4(
25083
+ join7(stateDirectory, "agents", this.id, GROK_BUILD_MANAGED_VERSION)
25084
+ );
25085
+ await validateManagedNpmPackage(
25086
+ join7(versionRoot, "package"),
25087
+ grokBuildManagedPackage(platform, process.arch)
25088
+ );
25089
+ const executable = await resolveExecutablePath(
25090
+ join7(versionRoot, "home", "bin", "grok"),
25091
+ platform
25092
+ );
25093
+ signal.throwIfAborted();
25094
+ if (executable === null || !isContainedPath2(versionRoot, executable.path)) {
25095
+ throw new AgentProbeError(
25096
+ "managed_agent_invalid",
25097
+ "The managed Grok Build executable is invalid"
25098
+ );
25099
+ }
25100
+ return executable;
25101
+ };
25102
+ verifyAcp = async (connection, initialized, defaultWorkspace, signal) => {
25103
+ const capabilities = initialized.agentCapabilities ?? {};
25104
+ const session = capabilities.sessionCapabilities;
25105
+ if (capabilities.loadSession !== true || session?.close == null || session.list == null || session.resume == null || !(initialized.authMethods ?? []).some(
25106
+ (method) => method.id === "xai.api_key" || method.id === "grok.com"
25107
+ )) {
25108
+ throw new AgentProbeError(
25109
+ "acp_incompatible",
25110
+ "Grok Build reported an unsupported ACP capability set"
25111
+ );
25112
+ }
25113
+ await verifySessionCreation(
25114
+ connection,
25115
+ capabilities,
25116
+ defaultWorkspace,
25117
+ signal,
25118
+ this.label
25119
+ );
25120
+ };
25121
+ };
25122
+
24886
25123
  // src/agent-catalog/agents/opencode-agent.ts
24887
25124
  import { join as join9 } from "node:path";
24888
25125
 
@@ -24894,18 +25131,18 @@ import {
24894
25131
  copyFile,
24895
25132
  mkdir as mkdir2,
24896
25133
  mkdtemp as mkdtemp2,
24897
- open as open5,
24898
- realpath as realpath4,
25134
+ open as open4,
25135
+ realpath as realpath5,
24899
25136
  rename as rename2,
24900
25137
  rm as rm2,
24901
25138
  stat as stat4,
24902
25139
  writeFile
24903
25140
  } from "node:fs/promises";
24904
- import { dirname as dirname4, isAbsolute as isAbsolute3, join as join8, relative as relative2, sep as sep2 } from "node:path";
25141
+ import { dirname as dirname4, isAbsolute as isAbsolute4, join as join8, relative as relative3, sep as sep3 } from "node:path";
24905
25142
 
24906
25143
  // src/agent-installation/verified-download.ts
24907
25144
  import { createHash } from "node:crypto";
24908
- import { open as open4, unlink } from "node:fs/promises";
25145
+ import { open as open3, unlink } from "node:fs/promises";
24909
25146
  import { fetch } from "undici";
24910
25147
 
24911
25148
  // src/network/environment-proxy.ts
@@ -25037,7 +25274,7 @@ async function downloadVerifiedFile(options, transport = new UndiciInstallerDown
25037
25274
  );
25038
25275
  }
25039
25276
  }
25040
- handle = await open4(options.destination, "wx", 384);
25277
+ handle = await open3(options.destination, "wx", 384);
25041
25278
  const digest = createHash("sha256");
25042
25279
  const reader = fetched.response.body.getReader();
25043
25280
  let bytes = 0;
@@ -25147,12 +25384,12 @@ var ManagedAgentArchiveError = class extends Error {
25147
25384
  var ManagedAgentArchiveDownloader = class {
25148
25385
  download = async (options) => await downloadVerifiedFile(options);
25149
25386
  };
25150
- function isRecord6(value) {
25387
+ function isRecord5(value) {
25151
25388
  return typeof value === "object" && value !== null && !Array.isArray(value);
25152
25389
  }
25153
- function isContainedPath2(root, candidate) {
25154
- const difference = relative2(root, candidate);
25155
- return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${sep2}`) && !isAbsolute3(difference);
25390
+ function isContainedPath3(root, candidate) {
25391
+ const difference = relative3(root, candidate);
25392
+ return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${sep3}`) && !isAbsolute4(difference);
25156
25393
  }
25157
25394
  async function hashFile(path2, signal) {
25158
25395
  signal.throwIfAborted();
@@ -25187,7 +25424,7 @@ async function hashFile(path2, signal) {
25187
25424
  async function readManifest(path2) {
25188
25425
  let handle;
25189
25426
  try {
25190
- handle = await open5(path2, "r");
25427
+ handle = await open4(path2, "r");
25191
25428
  } catch (error61) {
25192
25429
  throw new ManagedAgentArchiveError(
25193
25430
  "managed_archive_verification_failed",
@@ -25206,7 +25443,7 @@ async function readManifest(path2) {
25206
25443
  const parsed = JSON.parse(
25207
25444
  await handle.readFile({ encoding: "utf8" })
25208
25445
  );
25209
- if (!isRecord6(parsed)) {
25446
+ if (!isRecord5(parsed)) {
25210
25447
  throw new ManagedAgentArchiveError(
25211
25448
  "managed_archive_verification_failed",
25212
25449
  "The managed Agent archive manifest is invalid"
@@ -25228,7 +25465,7 @@ async function readManifest(path2) {
25228
25465
  }
25229
25466
  async function validateManagedAgentArchive(root, definition, signal) {
25230
25467
  try {
25231
- const rootPath = await realpath4(root);
25468
+ const rootPath = await realpath5(root);
25232
25469
  const rootMetadata = await stat4(rootPath);
25233
25470
  if (!rootMetadata.isDirectory() || typeof process.getuid === "function" && rootMetadata.uid !== process.getuid()) {
25234
25471
  throw new Error("Managed Agent root is not user-owned");
@@ -25240,7 +25477,7 @@ async function validateManagedAgentArchive(root, definition, signal) {
25240
25477
  const executable = await resolveExecutablePath(
25241
25478
  join8(rootPath, "bin", definition.executableName)
25242
25479
  );
25243
- if (executable === null || !isContainedPath2(rootPath, executable.path) || await hashFile(executable.path, signal) !== manifest["executableSha256"]) {
25480
+ if (executable === null || !isContainedPath3(rootPath, executable.path) || await hashFile(executable.path, signal) !== manifest["executableSha256"]) {
25244
25481
  throw new Error("Managed Agent executable is invalid");
25245
25482
  }
25246
25483
  return executable;
@@ -25296,7 +25533,7 @@ var ManagedAgentArchiveInstaller = class {
25296
25533
  const archivePath = join8(working, definition.archiveName);
25297
25534
  const extractionRoot = join8(working, "extracted");
25298
25535
  await mkdir2(extractionRoot, { mode: 448 });
25299
- const canonicalExtractionRoot = await realpath4(extractionRoot);
25536
+ const canonicalExtractionRoot = await realpath5(extractionRoot);
25300
25537
  const download = await this.#downloader.download({
25301
25538
  allowedHosts: /* @__PURE__ */ new Set([
25302
25539
  "github.com",
@@ -25334,11 +25571,11 @@ var ManagedAgentArchiveInstaller = class {
25334
25571
  signal,
25335
25572
  timeoutMilliseconds: ARCHIVE_EXTRACTION_TIMEOUT_MILLISECONDS
25336
25573
  });
25337
- const extracted = await realpath4(
25574
+ const extracted = await realpath5(
25338
25575
  join8(canonicalExtractionRoot, definition.executableName)
25339
25576
  );
25340
25577
  const extractedMetadata = await stat4(extracted);
25341
- if (!isContainedPath2(canonicalExtractionRoot, extracted) || !extractedMetadata.isFile()) {
25578
+ if (!isContainedPath3(canonicalExtractionRoot, extracted) || !extractedMetadata.isFile()) {
25342
25579
  throw new ManagedAgentArchiveError(
25343
25580
  "managed_archive_verification_failed",
25344
25581
  "The managed Agent archive executable is invalid"
@@ -25493,7 +25730,7 @@ var OpenCodeAgentSpecification = class extends DirectAcpAgentDefinition {
25493
25730
  // src/agent-catalog/agents/pi-agent.ts
25494
25731
  import { join as join10 } from "node:path";
25495
25732
  import {
25496
- methods as methods3
25733
+ methods as methods4
25497
25734
  } from "@agentclientprotocol/sdk";
25498
25735
 
25499
25736
  // src/agent-installation/pi-managed-packages.ts
@@ -25565,7 +25802,7 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
25565
25802
  );
25566
25803
  }
25567
25804
  const session = await connection.agent.request(
25568
- methods3.agent.session.new,
25805
+ methods4.agent.session.new,
25569
25806
  {
25570
25807
  additionalDirectories: [],
25571
25808
  cwd: defaultWorkspace,
@@ -25580,7 +25817,7 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
25580
25817
  );
25581
25818
  }
25582
25819
  const prompt = await connection.agent.request(
25583
- methods3.agent.session.prompt,
25820
+ methods4.agent.session.prompt,
25584
25821
  {
25585
25822
  prompt: [{ text: "/session", type: "text" }],
25586
25823
  sessionId: session.sessionId
@@ -25596,6 +25833,110 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
25596
25833
  };
25597
25834
  };
25598
25835
 
25836
+ // src/agent-catalog/agents/workbuddy-agent.ts
25837
+ import { isAbsolute as isAbsolute5, join as join11 } from "node:path";
25838
+
25839
+ // src/agent-installation/workbuddy-managed-package.ts
25840
+ var WORKBUDDY_MANAGED_VERSION = "2.146.0";
25841
+ var WorkBuddyManagedPackage = class extends SriManagedNpmPackageDefinition {
25842
+ dependencyResolutionArguments = Object.freeze([
25843
+ "--before=2026-09-05T12:39:25.295Z"
25844
+ ]);
25845
+ includeOptionalDependencies = true;
25846
+ verifyDependencyClosure = true;
25847
+ };
25848
+ var WORKBUDDY_MANAGED_PACKAGE = new WorkBuddyManagedPackage(
25849
+ "@tencent-ai/codebuddy-code",
25850
+ WORKBUDDY_MANAGED_VERSION,
25851
+ "codebuddy",
25852
+ "sha512-81V+8rzYJY8PezHZMs4VZN2nvoijrsRWIuCERTr6hELotcxaZaAcqbQQSbHJcN8eTlFE5TRPlzMI4oEkLCat4A==",
25853
+ "https://registry.npmjs.org/@tencent-ai/codebuddy-code/-/codebuddy-code-2.146.0.tgz"
25854
+ );
25855
+
25856
+ // src/agent-catalog/agents/workbuddy-agent.ts
25857
+ var WORKBUDDY_MACOS_EXECUTABLE_PATH = Object.freeze([
25858
+ "WorkBuddy.app",
25859
+ "Contents",
25860
+ "Resources",
25861
+ "app.asar.unpacked",
25862
+ "cli",
25863
+ "bin",
25864
+ "codebuddy"
25865
+ ]);
25866
+ var WorkBuddyAgentSpecification = class extends DirectAcpAgentDefinition {
25867
+ adapterVersion = WORKBUDDY_MANAGED_VERSION;
25868
+ authenticationCommand = () => "codebuddy";
25869
+ agentExecutable = "codebuddy";
25870
+ id = "workbuddy";
25871
+ label = "WorkBuddy";
25872
+ constructor() {
25873
+ super(
25874
+ "MOBIUS_WORKBUDDY_PATH",
25875
+ ["--acp"],
25876
+ [
25877
+ "agents",
25878
+ "workbuddy",
25879
+ WORKBUDDY_MANAGED_VERSION,
25880
+ "node_modules",
25881
+ "@tencent-ai",
25882
+ "codebuddy-code",
25883
+ "bin",
25884
+ "codebuddy"
25885
+ ]
25886
+ );
25887
+ }
25888
+ createLaunchEnvironment = () => Promise.resolve(Object.freeze({ DISABLE_AUTOUPDATER: "1" }));
25889
+ resolveManagedAgent = async (stateDirectory, _platform, signal) => {
25890
+ signal.throwIfAborted();
25891
+ const executable = await validateManagedNpmPackage(
25892
+ join11(stateDirectory, "agents", this.id, WORKBUDDY_MANAGED_VERSION),
25893
+ WORKBUDDY_MANAGED_PACKAGE
25894
+ );
25895
+ signal.throwIfAborted();
25896
+ return executable;
25897
+ };
25898
+ resolveInstalledAgentExecutables = async (context) => {
25899
+ context.signal.throwIfAborted();
25900
+ if ((context.platform ?? process.platform) !== "darwin") {
25901
+ return [];
25902
+ }
25903
+ const requestedPaths = [
25904
+ join11("/Applications", ...WORKBUDDY_MACOS_EXECUTABLE_PATH)
25905
+ ];
25906
+ const homeDirectory = context.environment["HOME"];
25907
+ if (homeDirectory !== void 0 && isAbsolute5(homeDirectory)) {
25908
+ requestedPaths.unshift(
25909
+ join11(homeDirectory, "Applications", ...WORKBUDDY_MACOS_EXECUTABLE_PATH)
25910
+ );
25911
+ }
25912
+ const executables = [];
25913
+ for (const requestedPath of requestedPaths) {
25914
+ const executable = await resolveExecutablePath(requestedPath, "darwin");
25915
+ context.signal.throwIfAborted();
25916
+ if (executable !== null) {
25917
+ executables.push(executable);
25918
+ }
25919
+ }
25920
+ return executables;
25921
+ };
25922
+ verifyAcp = async (connection, initialized, defaultWorkspace, signal) => {
25923
+ const capabilities = initialized.agentCapabilities ?? {};
25924
+ if (capabilities.loadSession !== true || (initialized.authMethods ?? []).length === 0) {
25925
+ throw new AgentProbeError(
25926
+ "acp_incompatible",
25927
+ "WorkBuddy reported an unsupported ACP capability set"
25928
+ );
25929
+ }
25930
+ await verifySessionCreation(
25931
+ connection,
25932
+ capabilities,
25933
+ defaultWorkspace,
25934
+ signal,
25935
+ this.label
25936
+ );
25937
+ };
25938
+ };
25939
+
25599
25940
  // src/agent-catalog/agents/supported-agent-specifications.ts
25600
25941
  function supportedLocalAgentSpecifications() {
25601
25942
  return Object.freeze([
@@ -25603,24 +25944,27 @@ function supportedLocalAgentSpecifications() {
25603
25944
  new ClaudeCodeAgentSpecification(),
25604
25945
  new PiAgentSpecification(),
25605
25946
  new DeepSeekHarnessAgentSpecification(),
25606
- new OpenCodeAgentSpecification()
25947
+ new OpenCodeAgentSpecification(),
25948
+ new CursorCliAgentSpecification(),
25949
+ new GrokBuildAgentSpecification(),
25950
+ new WorkBuddyAgentSpecification()
25607
25951
  ]);
25608
25952
  }
25609
25953
 
25610
25954
  // src/agent-catalog/acp-readiness-probe.ts
25611
25955
  import { spawn as spawn3 } from "node:child_process";
25612
25956
  import {
25613
- methods as methods4,
25957
+ methods as methods5,
25614
25958
  ndJsonStream as ndJsonStream2,
25615
25959
  PROTOCOL_VERSION as PROTOCOL_VERSION2,
25616
25960
  RequestError as RequestError2
25617
25961
  } from "@agentclientprotocol/sdk";
25618
25962
 
25619
25963
  // src/agent-catalog/executable-discovery.ts
25620
- import { isAbsolute as isAbsolute4, join as join12 } from "node:path";
25964
+ import { isAbsolute as isAbsolute6, join as join13 } from "node:path";
25621
25965
 
25622
25966
  // src/agent-installation/managed-adapter-installer.ts
25623
- import { join as join11 } from "node:path";
25967
+ import { join as join12 } from "node:path";
25624
25968
  var ManagedAdapterInstallError = class extends Error {
25625
25969
  code;
25626
25970
  constructor(code, message, options = {}) {
@@ -25682,7 +26026,7 @@ var ManagedAdapterInstaller = class {
25682
26026
  this.#stateDirectory = options.stateDirectory;
25683
26027
  }
25684
26028
  install = async (specification, signal) => {
25685
- const root = join11(
26029
+ const root = join12(
25686
26030
  this.#stateDirectory,
25687
26031
  "adapters",
25688
26032
  specification.id,
@@ -25721,7 +26065,7 @@ async function resolveManagedAdapterExecutable(specification, context) {
25721
26065
  let managed;
25722
26066
  try {
25723
26067
  managed = await validateManagedAdapter(
25724
- join12(
26068
+ join13(
25725
26069
  readStateDirectory(context.environment),
25726
26070
  "adapters",
25727
26071
  specification.id,
@@ -25734,10 +26078,10 @@ async function resolveManagedAdapterExecutable(specification, context) {
25734
26078
  }
25735
26079
  return managed;
25736
26080
  }
25737
- async function resolveSpecificationExecutables(executableName, overrideVariable, resolveManaged, context) {
26081
+ async function resolveSpecificationExecutables(executableName, overrideVariable, resolveInstalled, resolveManaged, context) {
25738
26082
  const override = context.environment[overrideVariable];
25739
26083
  if (override !== void 0) {
25740
- if (override.length === 0 || !isAbsolute4(override)) {
26084
+ if (override.length === 0 || !isAbsolute6(override)) {
25741
26085
  return [];
25742
26086
  }
25743
26087
  const executable = await resolveExecutablePath(override, context.platform);
@@ -25748,19 +26092,30 @@ async function resolveSpecificationExecutables(executableName, overrideVariable,
25748
26092
  context.environment,
25749
26093
  context.platform
25750
26094
  );
26095
+ const installed = await resolveInstalled();
25751
26096
  const managed = await resolveManaged();
25752
- if (external === null) {
25753
- return managed === null ? [] : [managed];
26097
+ const executables = [];
26098
+ const paths = /* @__PURE__ */ new Set();
26099
+ if (external !== null) {
26100
+ executables.push(external);
26101
+ paths.add(external.path);
25754
26102
  }
25755
- if (managed === null || managed.path === external.path) {
25756
- return [external];
26103
+ for (const executable of installed) {
26104
+ if (!paths.has(executable.path)) {
26105
+ executables.push(executable);
26106
+ paths.add(executable.path);
26107
+ }
26108
+ }
26109
+ if (managed !== null && !paths.has(managed.path)) {
26110
+ executables.push(managed);
25757
26111
  }
25758
- return [external, managed];
26112
+ return executables;
25759
26113
  }
25760
26114
  async function resolveAgentExecutables(specification, context) {
25761
26115
  return await resolveSpecificationExecutables(
25762
26116
  specification.agentExecutable,
25763
26117
  specification.agentOverrideVariable,
26118
+ async () => await specification.resolveInstalledAgentExecutables(context),
25764
26119
  async () => await resolveManagedExecutable(specification, context),
25765
26120
  context
25766
26121
  );
@@ -25775,6 +26130,7 @@ async function resolveAdapterExecutables(specification, context) {
25775
26130
  return await resolveSpecificationExecutables(
25776
26131
  specification.adapterExecutable,
25777
26132
  specification.adapterOverrideVariable,
26133
+ () => Promise.resolve([]),
25778
26134
  async () => await resolveManagedAdapterExecutable(specification, context),
25779
26135
  context
25780
26136
  );
@@ -25848,41 +26204,41 @@ var DiscoveryAcpHandler = class {
25848
26204
  };
25849
26205
  function readableAcpStream(input2) {
25850
26206
  let byteLength = 0;
25851
- let open7 = true;
26207
+ let open6 = true;
25852
26208
  return new ReadableStream({
25853
26209
  start(controller) {
25854
26210
  input2.on("data", (chunk) => {
25855
- if (!open7) {
26211
+ if (!open6) {
25856
26212
  return;
25857
26213
  }
25858
26214
  if (!(chunk instanceof Uint8Array)) {
25859
- open7 = false;
26215
+ open6 = false;
25860
26216
  controller.error(new Error("ACP adapter produced invalid output"));
25861
26217
  return;
25862
26218
  }
25863
26219
  byteLength += chunk.byteLength;
25864
26220
  if (byteLength > ACP_OUTPUT_LIMIT_BYTES) {
25865
- open7 = false;
26221
+ open6 = false;
25866
26222
  controller.error(new Error("ACP adapter output limit exceeded"));
25867
26223
  return;
25868
26224
  }
25869
26225
  controller.enqueue(new Uint8Array(chunk));
25870
26226
  });
25871
26227
  input2.once("end", () => {
25872
- if (open7) {
25873
- open7 = false;
26228
+ if (open6) {
26229
+ open6 = false;
25874
26230
  controller.close();
25875
26231
  }
25876
26232
  });
25877
26233
  input2.once("error", (error61) => {
25878
- if (open7) {
25879
- open7 = false;
26234
+ if (open6) {
26235
+ open6 = false;
25880
26236
  controller.error(error61);
25881
26237
  }
25882
26238
  });
25883
26239
  },
25884
26240
  cancel() {
25885
- open7 = false;
26241
+ open6 = false;
25886
26242
  }
25887
26243
  });
25888
26244
  }
@@ -25951,7 +26307,7 @@ async function probeAcpReadiness(specification, agent, environment, defaultWorks
25951
26307
  try {
25952
26308
  const initialized = await Promise.race([
25953
26309
  connection.agent.request(
25954
- methods4.agent.initialize,
26310
+ methods5.agent.initialize,
25955
26311
  {
25956
26312
  clientCapabilities: {},
25957
26313
  clientInfo: { name: "mobius", version: "0.0.3" },
@@ -26162,16 +26518,8 @@ async function discoverLocalAgentInventory(options) {
26162
26518
  async (specification) => await discoverAgent(specification, options)
26163
26519
  )
26164
26520
  );
26165
- let grantedAgents = /* @__PURE__ */ new Set();
26166
- try {
26167
- grantedAgents = await readGrantedAgents(
26168
- readStateDirectory(options.environment)
26169
- );
26170
- } catch {
26171
- }
26172
26521
  return new LocalAgentInventory(
26173
26522
  discoveries,
26174
- grantedAgents,
26175
26523
  options.platform,
26176
26524
  options.architecture
26177
26525
  );
@@ -26202,7 +26550,7 @@ var PairingClientError = class extends Error {
26202
26550
  this.name = "PairingClientError";
26203
26551
  }
26204
26552
  };
26205
- function isRecord7(value) {
26553
+ function isRecord6(value) {
26206
26554
  return typeof value === "object" && value !== null && !Array.isArray(value);
26207
26555
  }
26208
26556
  function hasExactKeys(value, expectedKeys) {
@@ -26316,7 +26664,7 @@ async function resolveDefaultWorkspace(path2) {
26316
26664
  const requestedWorkspace = resolve3(path2);
26317
26665
  try {
26318
26666
  await mkdir3(requestedWorkspace, { recursive: true, mode: 448 });
26319
- const defaultWorkspace = await realpath5(requestedWorkspace);
26667
+ const defaultWorkspace = await realpath6(requestedWorkspace);
26320
26668
  const metadata = await stat5(defaultWorkspace);
26321
26669
  if (!metadata.isDirectory()) {
26322
26670
  throw new PairingClientError(
@@ -26355,9 +26703,9 @@ async function readJsonResponse(response) {
26355
26703
  }
26356
26704
  }
26357
26705
  function readRelayError(value) {
26358
- if (isRecord7(value)) {
26706
+ if (isRecord6(value)) {
26359
26707
  const error61 = value["error"];
26360
- if (isRecord7(error61)) {
26708
+ if (isRecord6(error61)) {
26361
26709
  const code = error61["code"];
26362
26710
  const message = error61["message"];
26363
26711
  if (typeof code === "string" && typeof message === "string") {
@@ -26371,7 +26719,7 @@ function readRelayError(value) {
26371
26719
  );
26372
26720
  }
26373
26721
  function decodeClaimResponse(value) {
26374
- if (!isRecord7(value) || !hasExactKeys(value, CLAIM_RESPONSE_KEYS)) {
26722
+ if (!isRecord6(value) || !hasExactKeys(value, CLAIM_RESPONSE_KEYS)) {
26375
26723
  throw new PairingClientError(
26376
26724
  "invalid_relay_response",
26377
26725
  "The relay returned an invalid pairing response"
@@ -26401,8 +26749,7 @@ async function claimPairing(options, defaultWorkspace, localAgents, installableA
26401
26749
  agents,
26402
26750
  installableAgents: installableAgents.map((agent) => ({
26403
26751
  id: agent.id,
26404
- label: agent.label,
26405
- requiresLocalApproval: agent.requiresLocalApproval
26752
+ label: agent.label
26406
26753
  })),
26407
26754
  machineName: hostname3(),
26408
26755
  pairingCode: options.code,
@@ -26430,10 +26777,10 @@ async function claimPairing(options, defaultWorkspace, localAgents, installableA
26430
26777
  return decodeClaimResponse(value);
26431
26778
  }
26432
26779
  async function persistConnection(channelId, relayOrigin, daemonToken, defaultWorkspace) {
26433
- const connectionsDirectory = join13(readStateDirectory(), "connections");
26780
+ const connectionsDirectory = join14(readStateDirectory(), "connections");
26434
26781
  await mkdir3(connectionsDirectory, { mode: 448, recursive: true });
26435
- const connectionPath = join13(connectionsDirectory, `${channelId}.json`);
26436
- const temporaryPath = join13(
26782
+ const connectionPath = join14(connectionsDirectory, `${channelId}.json`);
26783
+ const temporaryPath = join14(
26437
26784
  connectionsDirectory,
26438
26785
  `.${channelId}.${randomUUID()}.tmp`
26439
26786
  );
@@ -26456,7 +26803,7 @@ async function persistConnection(channelId, relayOrigin, daemonToken, defaultWor
26456
26803
  return connectionPath;
26457
26804
  }
26458
26805
  function decodeSavedConnection(value, expectedChannelId) {
26459
- if (!isRecord7(value) || !hasExactKeys(value, SAVED_CONNECTION_KEYS)) {
26806
+ if (!isRecord6(value) || !hasExactKeys(value, SAVED_CONNECTION_KEYS)) {
26460
26807
  throw new PairingClientError(
26461
26808
  "invalid_connection",
26462
26809
  "The saved connection is invalid"
@@ -26480,13 +26827,13 @@ function decodeSavedConnection(value, expectedChannelId) {
26480
26827
  };
26481
26828
  }
26482
26829
  async function readSavedConnection(channelId) {
26483
- const connectionPath = join13(
26830
+ const connectionPath = join14(
26484
26831
  readStateDirectory(),
26485
26832
  "connections",
26486
26833
  `${channelId}.json`
26487
26834
  );
26488
26835
  let encoded = "";
26489
- const handle = await open6(connectionPath, "r");
26836
+ const handle = await open5(connectionPath, "r");
26490
26837
  try {
26491
26838
  const metadata = await handle.stat();
26492
26839
  if (!metadata.isFile() || metadata.size > MAX_CONNECTION_FILE_LENGTH) {
@@ -26535,7 +26882,7 @@ function buildPairedDaemon(connection, connectionPath, inventory) {
26535
26882
  );
26536
26883
  relayUrl.protocol = relayUrl.protocol === "https:" ? "wss:" : "ws:";
26537
26884
  relayUrl.searchParams.set("token", connection.daemonToken);
26538
- const auditDatabasePath = join13(
26885
+ const auditDatabasePath = join14(
26539
26886
  readStateDirectory(),
26540
26887
  "audit",
26541
26888
  `${connection.channelId}.sqlite`
@@ -26594,7 +26941,7 @@ async function pairLocalMachine(arguments_, signal = new AbortController().signa
26594
26941
  }
26595
26942
  async function resumeLocalMachine(arguments_, signal = new AbortController().signal) {
26596
26943
  const channelId = parseChannelArgument(arguments_);
26597
- const connectionPath = join13(
26944
+ const connectionPath = join14(
26598
26945
  readStateDirectory(),
26599
26946
  "connections",
26600
26947
  `${channelId}.json`
@@ -26649,8 +26996,7 @@ async function publishAgentCatalog(config2, signal) {
26649
26996
  })),
26650
26997
  installableAgents: catalog.installableAgents.map((agent) => ({
26651
26998
  id: agent.id,
26652
- label: agent.label,
26653
- requiresLocalApproval: agent.requiresLocalApproval
26999
+ label: agent.label
26654
27000
  }))
26655
27001
  }),
26656
27002
  dispatcher: environmentProxyDispatcher,
@@ -26691,12 +27037,6 @@ var RequestedInstallation = class extends AgentInstallation {
26691
27037
  super(requestId, agentId);
26692
27038
  }
26693
27039
  };
26694
- var AwaitingLocalApproval = class extends AgentInstallation {
26695
- status = "awaiting_local_approval";
26696
- constructor(requestId, agentId) {
26697
- super(requestId, agentId);
26698
- }
26699
- };
26700
27040
  var RunningInstallation = class extends AgentInstallation {
26701
27041
  stage;
26702
27042
  status = "running";
@@ -26751,9 +27091,9 @@ var InstallationJob = class {
26751
27091
  this.state = new RequestedInstallation(requestId, agentId);
26752
27092
  }
26753
27093
  };
26754
- function specificationFor(specifications, agentId) {
27094
+ function authorizedSpecificationFor(specifications, agentId) {
26755
27095
  for (const specification of specifications) {
26756
- if (specification.id === agentId) {
27096
+ if (specification.id === agentId && specification.supportsInstallation(process.platform, process.arch)) {
26757
27097
  return specification;
26758
27098
  }
26759
27099
  }
@@ -26772,14 +27112,12 @@ function executionFailure(error61) {
26772
27112
  var AgentInstallationManager = class {
26773
27113
  #activeAgents = /* @__PURE__ */ new Map();
26774
27114
  #audit;
26775
- #authorizer;
26776
27115
  #executor;
26777
27116
  #jobs = /* @__PURE__ */ new Map();
26778
27117
  #observer;
26779
27118
  #specifications;
26780
- constructor(specifications, authorizer, executor, observer, audit = new NullInstallationAudit()) {
27119
+ constructor(specifications, executor, observer, audit = new NullInstallationAudit()) {
26781
27120
  this.#audit = audit;
26782
- this.#authorizer = authorizer;
26783
27121
  this.#executor = executor;
26784
27122
  this.#observer = observer;
26785
27123
  this.#specifications = Object.freeze([...specifications]);
@@ -26810,7 +27148,7 @@ var AgentInstallationManager = class {
26810
27148
  command.requestId,
26811
27149
  command.agentId
26812
27150
  );
26813
- const specification = specificationFor(
27151
+ const specification = authorizedSpecificationFor(
26814
27152
  this.#specifications,
26815
27153
  command.agentId
26816
27154
  );
@@ -26913,45 +27251,14 @@ var AgentInstallationManager = class {
26913
27251
  }, INSTALLATION_DEADLINE_MILLISECONDS);
26914
27252
  const signal = job.controller.signal;
26915
27253
  try {
26916
- await this.#transition(
26917
- job,
26918
- new AwaitingLocalApproval(job.requestId, job.agentId)
26919
- );
26920
- this.#audit.record(
26921
- "agent_installation_awaiting_approval",
26922
- job.requestId,
26923
- job.agentId
26924
- );
26925
- const approved = await this.#authorizer.authorize(
26926
- specification.id,
26927
- specification.label,
26928
- job.requestId,
26929
- signal
26930
- );
26931
27254
  signal.throwIfAborted();
26932
- if (!approved) {
26933
- const denied = new FailedInstallation(
26934
- job.requestId,
26935
- job.agentId,
26936
- "installation_not_authorized",
26937
- "Installation was not approved on the local machine"
26938
- );
26939
- await this.#transition(job, denied);
26940
- this.#audit.record(
26941
- "agent_installation_denied",
26942
- job.requestId,
26943
- job.agentId
26944
- );
26945
- job.completion.resolve(denied);
26946
- return;
26947
- }
26948
27255
  this.#audit.record(
26949
27256
  "agent_installation_authorized",
26950
27257
  job.requestId,
26951
- job.agentId
27258
+ specification.id
26952
27259
  );
26953
27260
  await this.#executor.execute(
26954
- job.agentId,
27261
+ specification.id,
26955
27262
  job.requestId,
26956
27263
  async (stage) => {
26957
27264
  signal.throwIfAborted();
@@ -27221,12 +27528,10 @@ import { realpathSync as realpathSync2, statSync as statSync2 } from "node:fs";
27221
27528
  import { resolve as resolve4 } from "node:path";
27222
27529
 
27223
27530
  // src/agent-installation/fixed-agent-install-recipes.ts
27224
- import { mkdir as mkdir4, mkdtemp as mkdtemp3, rm as rm3 } from "node:fs/promises";
27225
- import { join as join14 } from "node:path";
27226
- var INSTALLER_DOWNLOAD_LIMIT_BYTES = 1024 * 1024;
27227
- var INSTALLER_DOWNLOAD_TIMEOUT_MILLISECONDS = 6e4;
27228
- var AGENT_INSTALL_TIMEOUT_MILLISECONDS = 5 * 60 * 1e3;
27229
- var MINIMAL_PATH2 = "/usr/bin:/bin";
27531
+ import { mkdir as mkdir5, mkdtemp as mkdtemp3, rm as rm3 } from "node:fs/promises";
27532
+ import { join as join17 } from "node:path";
27533
+
27534
+ // src/agent-installation/fixed-agent-install-recipe.ts
27230
27535
  var FixedAgentInstallRecipe = class {
27231
27536
  assertSupportedPlatform = () => {
27232
27537
  if (process.platform !== "darwin" && process.platform !== "linux" || process.arch !== "arm64" && process.arch !== "x64") {
@@ -27247,28 +27552,243 @@ var FixedAgentInstallRecipe = class {
27247
27552
  return executable;
27248
27553
  };
27249
27554
  };
27555
+
27556
+ // src/agent-installation/grok-build-install-recipe.ts
27557
+ import { mkdir as mkdir4, realpath as realpath7, stat as stat6 } from "node:fs/promises";
27558
+ import { delimiter as delimiter2, dirname as dirname5, isAbsolute as isAbsolute7, join as join15, relative as relative4, sep as sep4 } from "node:path";
27559
+ var INSTALL_TIMEOUT_MILLISECONDS2 = 5 * 60 * 1e3;
27560
+ function isContainedPath4(root, candidate) {
27561
+ const difference = relative4(root, candidate);
27562
+ return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${sep4}`) && !isAbsolute7(difference);
27563
+ }
27564
+ async function resolveLifecycleScript(packageRoot) {
27565
+ try {
27566
+ const canonicalPackageRoot = await realpath7(packageRoot);
27567
+ const script = await realpath7(
27568
+ join15(canonicalPackageRoot, "bin", "postinstall.js")
27569
+ );
27570
+ const metadata = await stat6(script);
27571
+ if (!metadata.isFile() || !isContainedPath4(canonicalPackageRoot, script)) {
27572
+ throw new Error("Invalid Grok Build lifecycle script");
27573
+ }
27574
+ return script;
27575
+ } catch (error61) {
27576
+ throw new InstallationManagerError(
27577
+ "agent_verification_failed",
27578
+ "The managed Grok Build lifecycle script is invalid",
27579
+ { cause: error61 }
27580
+ );
27581
+ }
27582
+ }
27583
+ var GrokBuildInstallRecipe = class extends FixedAgentInstallRecipe {
27584
+ #npmInstaller;
27585
+ id = "grok-build";
27586
+ label = "Grok Build";
27587
+ releaseChannel = GROK_BUILD_MANAGED_VERSION;
27588
+ constructor(npmInstaller = new ManagedNpmPackageInstaller()) {
27589
+ super();
27590
+ this.#npmInstaller = npmInstaller;
27591
+ }
27592
+ install = async (options) => {
27593
+ this.assertSupportedPlatform();
27594
+ const definition = grokBuildManagedPackage(process.platform, process.arch);
27595
+ const versionRoot = join15(
27596
+ options.stateDirectory,
27597
+ "agents",
27598
+ this.id,
27599
+ GROK_BUILD_MANAGED_VERSION
27600
+ );
27601
+ const packageRoot = join15(versionRoot, "package");
27602
+ const managedHome = join15(versionRoot, "home");
27603
+ try {
27604
+ await mkdir4(managedHome, { mode: 448, recursive: true });
27605
+ const canonicalHome = await realpath7(managedHome);
27606
+ await options.report("downloading");
27607
+ await options.report("verifying");
27608
+ await options.report("installing_agent");
27609
+ await this.#npmInstaller.install(
27610
+ packageRoot,
27611
+ definition,
27612
+ options.environment,
27613
+ options.signal
27614
+ );
27615
+ options.audit.record(
27616
+ "agent_npm_package_verified",
27617
+ options.requestId,
27618
+ this.id,
27619
+ {
27620
+ integrity: definition.integrity,
27621
+ package: definition.packageName,
27622
+ version: definition.version
27623
+ }
27624
+ );
27625
+ const script = await resolveLifecycleScript(
27626
+ join15(packageRoot, "node_modules", "@xai-official", "grok")
27627
+ );
27628
+ await runBoundedProcess({
27629
+ arguments: [script],
27630
+ command: process.execPath,
27631
+ cwd: dirname5(script),
27632
+ environment: {
27633
+ GROK_HOME: canonicalHome,
27634
+ GROK_INSTALL_COMPLETIONS: "0",
27635
+ GROK_NPM_REGISTRY: "https://registry.npmjs.org/",
27636
+ HOME: canonicalHome,
27637
+ PATH: `${dirname5(process.execPath)}${delimiter2}/usr/bin${delimiter2}/bin`
27638
+ },
27639
+ outputLimitBytes: 64 * 1024,
27640
+ signal: options.signal,
27641
+ timeoutMilliseconds: INSTALL_TIMEOUT_MILLISECONDS2
27642
+ });
27643
+ options.audit.record(
27644
+ "agent_lifecycle_step_completed",
27645
+ options.requestId,
27646
+ this.id,
27647
+ {
27648
+ lifecycle: "postinstall",
27649
+ package: definition.packageName,
27650
+ version: definition.version
27651
+ }
27652
+ );
27653
+ return await this.requireInstalledExecutable(
27654
+ join15(canonicalHome, "bin", "grok")
27655
+ );
27656
+ } catch (error61) {
27657
+ if (options.signal.aborted) {
27658
+ options.signal.throwIfAborted();
27659
+ }
27660
+ if (error61 instanceof ManagedNpmPackageError) {
27661
+ if (error61.code === "managed_package_verification_failed") {
27662
+ throw new InstallationManagerError(
27663
+ "agent_verification_failed",
27664
+ "The managed Grok Build packages did not match their pinned artifacts",
27665
+ { cause: error61 }
27666
+ );
27667
+ }
27668
+ if (error61.code === "managed_package_publish_failed") {
27669
+ throw new InstallationManagerError(
27670
+ "agent_publish_failed",
27671
+ "The managed Grok Build package could not be published",
27672
+ { cause: error61 }
27673
+ );
27674
+ }
27675
+ throw new InstallationManagerError(error61.code, error61.message, {
27676
+ cause: error61
27677
+ });
27678
+ }
27679
+ if (error61 instanceof InstallationManagerError) {
27680
+ throw error61;
27681
+ }
27682
+ throw new InstallationManagerError(
27683
+ "agent_install_failed",
27684
+ "The fixed Grok Build installation recipe failed",
27685
+ { cause: error61 }
27686
+ );
27687
+ }
27688
+ };
27689
+ };
27690
+
27691
+ // src/agent-installation/workbuddy-install-recipe.ts
27692
+ import { join as join16 } from "node:path";
27693
+ var WorkBuddyInstallRecipe = class extends FixedAgentInstallRecipe {
27694
+ #npmInstaller;
27695
+ id = "workbuddy";
27696
+ label = "WorkBuddy";
27697
+ releaseChannel = WORKBUDDY_MANAGED_VERSION;
27698
+ constructor(npmInstaller = new ManagedNpmPackageInstaller()) {
27699
+ super();
27700
+ this.#npmInstaller = npmInstaller;
27701
+ }
27702
+ install = async (options) => {
27703
+ this.assertSupportedPlatform();
27704
+ try {
27705
+ await options.report("downloading");
27706
+ await options.report("verifying");
27707
+ await options.report("installing_agent");
27708
+ const executable = await this.#npmInstaller.install(
27709
+ join16(
27710
+ options.stateDirectory,
27711
+ "agents",
27712
+ this.id,
27713
+ WORKBUDDY_MANAGED_VERSION
27714
+ ),
27715
+ WORKBUDDY_MANAGED_PACKAGE,
27716
+ options.environment,
27717
+ options.signal
27718
+ );
27719
+ options.audit.record(
27720
+ "agent_npm_package_verified",
27721
+ options.requestId,
27722
+ this.id,
27723
+ {
27724
+ integrity: WORKBUDDY_MANAGED_PACKAGE.integrity,
27725
+ package: WORKBUDDY_MANAGED_PACKAGE.packageName,
27726
+ version: WORKBUDDY_MANAGED_PACKAGE.version
27727
+ }
27728
+ );
27729
+ return executable;
27730
+ } catch (error61) {
27731
+ if (options.signal.aborted) {
27732
+ options.signal.throwIfAborted();
27733
+ }
27734
+ if (error61 instanceof ManagedNpmPackageError) {
27735
+ if (error61.code === "managed_package_verification_failed") {
27736
+ throw new InstallationManagerError(
27737
+ "agent_verification_failed",
27738
+ "The managed WorkBuddy package did not match its pinned artifact",
27739
+ { cause: error61 }
27740
+ );
27741
+ }
27742
+ if (error61.code === "managed_package_publish_failed") {
27743
+ throw new InstallationManagerError(
27744
+ "agent_publish_failed",
27745
+ "The managed WorkBuddy package could not be published",
27746
+ { cause: error61 }
27747
+ );
27748
+ }
27749
+ throw new InstallationManagerError(error61.code, error61.message, {
27750
+ cause: error61
27751
+ });
27752
+ }
27753
+ if (error61 instanceof InstallationManagerError) {
27754
+ throw error61;
27755
+ }
27756
+ throw new InstallationManagerError(
27757
+ "agent_install_failed",
27758
+ "The fixed WorkBuddy installation recipe failed",
27759
+ { cause: error61 }
27760
+ );
27761
+ }
27762
+ };
27763
+ };
27764
+
27765
+ // src/agent-installation/fixed-agent-install-recipes.ts
27766
+ var INSTALLER_DOWNLOAD_LIMIT_BYTES = 1024 * 1024;
27767
+ var INSTALLER_DOWNLOAD_TIMEOUT_MILLISECONDS = 6e4;
27768
+ var AGENT_INSTALL_TIMEOUT_MILLISECONDS = 5 * 60 * 1e3;
27769
+ var MINIMAL_PATH2 = "/usr/bin:/bin";
27250
27770
  var CodexInstallRecipe = class extends FixedAgentInstallRecipe {
27251
27771
  id = "codex";
27252
27772
  label = "Codex";
27253
27773
  releaseChannel = "latest";
27254
27774
  install = async (options) => {
27255
27775
  this.assertSupportedPlatform();
27256
- const root = join14(options.stateDirectory, "agents", this.id);
27257
- const temporaryRoot = join14(options.stateDirectory, "temporary");
27776
+ const root = join17(options.stateDirectory, "agents", this.id);
27777
+ const temporaryRoot = join17(options.stateDirectory, "temporary");
27258
27778
  await Promise.all([
27259
- mkdir4(root, { mode: 448, recursive: true }),
27260
- mkdir4(temporaryRoot, { mode: 448, recursive: true })
27779
+ mkdir5(root, { mode: 448, recursive: true }),
27780
+ mkdir5(temporaryRoot, { mode: 448, recursive: true })
27261
27781
  ]);
27262
27782
  const temporaryDirectory = await mkdtemp3(
27263
- join14(temporaryRoot, ".codex-install-")
27783
+ join17(temporaryRoot, ".codex-install-")
27264
27784
  );
27265
- const installerPath = join14(temporaryDirectory, "install.sh");
27266
- const installDirectory = join14(root, "bin");
27267
- const codexHome = join14(root, "home");
27785
+ const installerPath = join17(temporaryDirectory, "install.sh");
27786
+ const installDirectory = join17(root, "bin");
27787
+ const codexHome = join17(root, "home");
27268
27788
  try {
27269
27789
  await Promise.all([
27270
- mkdir4(installDirectory, { mode: 448, recursive: true }),
27271
- mkdir4(codexHome, { mode: 448, recursive: true })
27790
+ mkdir5(installDirectory, { mode: 448, recursive: true }),
27791
+ mkdir5(codexHome, { mode: 448, recursive: true })
27272
27792
  ]);
27273
27793
  await options.report("downloading");
27274
27794
  const download = await downloadVerifiedFile({
@@ -27308,7 +27828,7 @@ var CodexInstallRecipe = class extends FixedAgentInstallRecipe {
27308
27828
  timeoutMilliseconds: AGENT_INSTALL_TIMEOUT_MILLISECONDS
27309
27829
  });
27310
27830
  return await this.requireInstalledExecutable(
27311
- join14(installDirectory, "codex")
27831
+ join17(installDirectory, "codex")
27312
27832
  );
27313
27833
  } catch (error61) {
27314
27834
  if (options.signal.aborted) {
@@ -27332,17 +27852,17 @@ var ClaudeCodeInstallRecipe = class extends FixedAgentInstallRecipe {
27332
27852
  releaseChannel = "stable";
27333
27853
  install = async (options) => {
27334
27854
  this.assertSupportedPlatform();
27335
- const root = join14(options.stateDirectory, "agents", this.id);
27336
- const managedHome = join14(root, "home");
27337
- const temporaryRoot = join14(options.stateDirectory, "temporary");
27855
+ const root = join17(options.stateDirectory, "agents", this.id);
27856
+ const managedHome = join17(root, "home");
27857
+ const temporaryRoot = join17(options.stateDirectory, "temporary");
27338
27858
  await Promise.all([
27339
- mkdir4(managedHome, { mode: 448, recursive: true }),
27340
- mkdir4(temporaryRoot, { mode: 448, recursive: true })
27859
+ mkdir5(managedHome, { mode: 448, recursive: true }),
27860
+ mkdir5(temporaryRoot, { mode: 448, recursive: true })
27341
27861
  ]);
27342
27862
  const temporaryDirectory = await mkdtemp3(
27343
- join14(temporaryRoot, ".claude-install-")
27863
+ join17(temporaryRoot, ".claude-install-")
27344
27864
  );
27345
- const installerPath = join14(temporaryDirectory, "install.sh");
27865
+ const installerPath = join17(temporaryDirectory, "install.sh");
27346
27866
  try {
27347
27867
  await options.report("downloading");
27348
27868
  const download = await downloadVerifiedFile({
@@ -27379,7 +27899,7 @@ var ClaudeCodeInstallRecipe = class extends FixedAgentInstallRecipe {
27379
27899
  timeoutMilliseconds: AGENT_INSTALL_TIMEOUT_MILLISECONDS
27380
27900
  });
27381
27901
  return await this.requireInstalledExecutable(
27382
- join14(managedHome, ".local", "bin", "claude")
27902
+ join17(managedHome, ".local", "bin", "claude")
27383
27903
  );
27384
27904
  } catch (error61) {
27385
27905
  if (options.signal.aborted) {
@@ -27413,7 +27933,7 @@ var PiInstallRecipe = class extends FixedAgentInstallRecipe {
27413
27933
  await options.report("verifying");
27414
27934
  await options.report("installing_agent");
27415
27935
  const executable = await this.#npmInstaller.install(
27416
- join14(
27936
+ join17(
27417
27937
  options.stateDirectory,
27418
27938
  "agents",
27419
27939
  this.id,
@@ -27480,18 +28000,18 @@ var DeepSeekHarnessInstallRecipe = class extends FixedAgentInstallRecipe {
27480
28000
  install = async (options) => {
27481
28001
  this.assertSupportedPlatform();
27482
28002
  try {
27483
- const managedHome = join14(
28003
+ const managedHome = join17(
27484
28004
  options.stateDirectory,
27485
28005
  "agents",
27486
28006
  this.id,
27487
28007
  "home"
27488
28008
  );
27489
- await mkdir4(managedHome, { mode: 448, recursive: true });
28009
+ await mkdir5(managedHome, { mode: 448, recursive: true });
27490
28010
  await options.report("downloading");
27491
28011
  await options.report("verifying");
27492
28012
  await options.report("installing_agent");
27493
28013
  const executable = await this.#npmInstaller.install(
27494
- join14(
28014
+ join17(
27495
28015
  options.stateDirectory,
27496
28016
  "agents",
27497
28017
  this.id,
@@ -27563,7 +28083,7 @@ var OpenCodeInstallRecipe = class extends FixedAgentInstallRecipe {
27563
28083
  await options.report("verifying");
27564
28084
  await options.report("installing_agent");
27565
28085
  const executable = await this.#archiveInstaller.install(
27566
- join14(
28086
+ join17(
27567
28087
  options.stateDirectory,
27568
28088
  "agents",
27569
28089
  this.id,
@@ -27622,7 +28142,9 @@ function fixedAgentInstallRecipes() {
27622
28142
  new ClaudeCodeInstallRecipe(),
27623
28143
  new PiInstallRecipe(),
27624
28144
  new DeepSeekHarnessInstallRecipe(),
27625
- new OpenCodeInstallRecipe()
28145
+ new OpenCodeInstallRecipe(),
28146
+ new GrokBuildInstallRecipe(),
28147
+ new WorkBuddyInstallRecipe()
27626
28148
  ]);
27627
28149
  }
27628
28150
 
@@ -27863,51 +28385,16 @@ var FixedInstallationExecutor = class {
27863
28385
  };
27864
28386
  };
27865
28387
 
27866
- // src/agent-installation/local-installation-authorizer.ts
27867
- import { createInterface } from "node:readline/promises";
27868
- var ConsoleInstallationAuthorizer = class {
27869
- #stateDirectory;
27870
- constructor(stateDirectory) {
27871
- this.#stateDirectory = stateDirectory;
27872
- }
27873
- authorize = async (agentId, label, requestId, signal) => {
27874
- signal.throwIfAborted();
27875
- const grants = await readGrantedAgents(this.#stateDirectory);
27876
- signal.throwIfAborted();
27877
- if (grants.has(agentId)) {
27878
- return true;
27879
- }
27880
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
27881
- return false;
27882
- }
27883
- const prompt = createInterface({
27884
- input: process.stdin,
27885
- output: process.stdout
27886
- });
27887
- try {
27888
- const answer = await prompt.question(
27889
- `
27890
- Mobius Web requested installation of ${label} (${requestId}). Allow this fixed user-level recipe? [y/N] `,
27891
- { signal }
27892
- );
27893
- const normalized = answer.trim().toLowerCase();
27894
- return normalized === "y" || normalized === "yes";
27895
- } finally {
27896
- prompt.close();
27897
- }
27898
- };
27899
- };
27900
-
27901
28388
  // src/authorization/workspace-directory.ts
27902
- import { readdir, realpath as realpath6, stat as stat6 } from "node:fs/promises";
28389
+ import { readdir, realpath as realpath8, stat as stat7 } from "node:fs/promises";
27903
28390
  import { homedir as homedir2 } from "node:os";
27904
28391
  import {
27905
28392
  basename as basename2,
27906
- dirname as dirname5,
27907
- isAbsolute as isAbsolute5,
27908
- join as join15,
28393
+ dirname as dirname6,
28394
+ isAbsolute as isAbsolute8,
28395
+ join as join18,
27909
28396
  normalize as normalize2,
27910
- relative as relative3
28397
+ relative as relative5
27911
28398
  } from "node:path";
27912
28399
  var WorkspaceDirectoryListing = class {
27913
28400
  directoryId;
@@ -27957,20 +28444,20 @@ var WorkspaceDirectoryService = class {
27957
28444
  if (id === "home") return homedir2();
27958
28445
  if (id.startsWith("path-")) {
27959
28446
  const path2 = decodePath(id, "path-");
27960
- if (isAbsolute5(path2)) return path2;
28447
+ if (isAbsolute8(path2)) return path2;
27961
28448
  }
27962
28449
  throw new LocalAuthorizationError("The directory identifier is invalid");
27963
28450
  };
27964
28451
  resolvePath = async (requested, signal) => {
27965
28452
  signal.throwIfAborted();
27966
- if (!isAbsolute5(requested) || requested.includes("\0") || normalize2(requested) !== requested)
28453
+ if (!isAbsolute8(requested) || requested.includes("\0") || normalize2(requested) !== requested)
27967
28454
  throw new LocalAuthorizationError("The local directory path is invalid");
27968
28455
  try {
27969
- const target = await realpath6(requested);
28456
+ const target = await realpath8(requested);
27970
28457
  signal.throwIfAborted();
27971
- const metadata = await stat6(target);
28458
+ const metadata = await stat7(target);
27972
28459
  signal.throwIfAborted();
27973
- if (!isAbsolute5(target) || normalize2(target) !== target || !metadata.isDirectory())
28460
+ if (!isAbsolute8(target) || normalize2(target) !== target || !metadata.isDirectory())
27974
28461
  throw new LocalAuthorizationError(
27975
28462
  "The selected location is not a directory"
27976
28463
  );
@@ -27985,8 +28472,8 @@ var WorkspaceDirectoryService = class {
27985
28472
  }
27986
28473
  };
27987
28474
  label = (path2) => {
27988
- const suffix = relative3(homedir2(), path2);
27989
- return suffix === "" ? "~" : !isAbsolute5(suffix) && suffix !== ".." && !suffix.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) ? `~/${suffix.replaceAll("\\", "/")}` : path2;
28475
+ const suffix = relative5(homedir2(), path2);
28476
+ return suffix === "" ? "~" : !isAbsolute8(suffix) && suffix !== ".." && !suffix.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) ? `~/${suffix.replaceAll("\\", "/")}` : path2;
27990
28477
  };
27991
28478
  identify = async (bindingId, requestedPath, signal) => {
27992
28479
  this.authorizeMachine(bindingId);
@@ -28014,7 +28501,7 @@ var WorkspaceDirectoryService = class {
28014
28501
  continue;
28015
28502
  }
28016
28503
  try {
28017
- const path2 = await this.resolvePath(join15(target, child.name), signal);
28504
+ const path2 = await this.resolvePath(join18(target, child.name), signal);
28018
28505
  entries.push({ directoryId: encodePath(path2), name: child.name });
28019
28506
  } catch (cause) {
28020
28507
  signal.throwIfAborted();
@@ -28022,7 +28509,7 @@ var WorkspaceDirectoryService = class {
28022
28509
  }
28023
28510
  }
28024
28511
  entries.sort((a, b) => a.name.localeCompare(b.name));
28025
- const parent = dirname5(target);
28512
+ const parent = dirname6(target);
28026
28513
  return new WorkspaceDirectoryListing(
28027
28514
  id,
28028
28515
  this.label(target),
@@ -28815,7 +29302,7 @@ var RelayConnectionLiveness = class {
28815
29302
 
28816
29303
  // src/relay-connection/session-event-outbox.ts
28817
29304
  import { mkdirSync as mkdirSync3 } from "node:fs";
28818
- import { dirname as dirname6 } from "node:path";
29305
+ import { dirname as dirname7 } from "node:path";
28819
29306
  import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
28820
29307
  function readPendingEnvelope(row) {
28821
29308
  if (typeof row !== "object" || row === null || Array.isArray(row)) {
@@ -28830,7 +29317,7 @@ function readPendingEnvelope(row) {
28830
29317
  var SessionEventOutbox = class {
28831
29318
  #database;
28832
29319
  constructor(path2) {
28833
- mkdirSync3(dirname6(path2), { recursive: true });
29320
+ mkdirSync3(dirname7(path2), { recursive: true });
28834
29321
  this.#database = new DatabaseSync3(path2);
28835
29322
  this.#database.exec(`
28836
29323
  CREATE TABLE IF NOT EXISTS relay_session_event_outbox (
@@ -29122,17 +29609,6 @@ var DaemonInstallationObserver = class {
29122
29609
  if (state instanceof RequestedInstallation) {
29123
29610
  return Promise.resolve();
29124
29611
  }
29125
- if (state instanceof AwaitingLocalApproval) {
29126
- this.#send(
29127
- socket,
29128
- encodeAgentInstallAwaitingApprovalEvent({
29129
- agentId: state.agentId,
29130
- kind: AGENT_INSTALL_AWAITING_APPROVAL_KIND,
29131
- requestId: state.requestId
29132
- })
29133
- );
29134
- return Promise.resolve();
29135
- }
29136
29612
  if (state instanceof RunningInstallation) {
29137
29613
  if (!this.#started.has(state.requestId)) {
29138
29614
  this.#started.add(state.requestId);
@@ -30029,7 +30505,6 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
30029
30505
  );
30030
30506
  const installations = new AgentInstallationManager(
30031
30507
  specifications,
30032
- new ConsoleInstallationAuthorizer(stateDirectory),
30033
30508
  installationExecutor,
30034
30509
  installationObserver,
30035
30510
  installationAudit