@integrity-labs/agt-cli 0.28.496 → 0.28.498

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/bin/agt.js CHANGED
@@ -40,7 +40,7 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-DZSS6TA3.js";
43
+ } from "../chunk-F6SYBDTF.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -71,7 +71,7 @@ import {
71
71
  requiredMcpWildcard,
72
72
  resolveChannels,
73
73
  serializeManifestForSlackCli
74
- } from "../chunk-JWR5FP7S.js";
74
+ } from "../chunk-WRII2Q5W.js";
75
75
  import "../chunk-XWVM4KPK.js";
76
76
 
77
77
  // src/bin/agt.ts
@@ -4830,7 +4830,7 @@ import { execFileSync, execSync } from "child_process";
4830
4830
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4831
4831
  import chalk18 from "chalk";
4832
4832
  import ora16 from "ora";
4833
- var cliVersion = true ? "0.28.496" : "dev";
4833
+ var cliVersion = true ? "0.28.498" : "dev";
4834
4834
  async function fetchLatestVersion() {
4835
4835
  const host2 = getHost();
4836
4836
  if (!host2) return null;
@@ -6002,7 +6002,7 @@ function handleError(err) {
6002
6002
  }
6003
6003
 
6004
6004
  // src/bin/agt.ts
6005
- var cliVersion2 = true ? "0.28.496" : "dev";
6005
+ var cliVersion2 = true ? "0.28.498" : "dev";
6006
6006
  var program = new Command();
6007
6007
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
6008
6008
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -19,6 +19,7 @@ import {
19
19
  getFlagDefinition,
20
20
  getFramework,
21
21
  handshakeToolsListOutcome,
22
+ isDefaultRemoteMcpConnection,
22
23
  isolationMode,
23
24
  listFlagDefinitions,
24
25
  mcpWildcardsForServers,
@@ -30,11 +31,14 @@ import {
30
31
  probeMcpHttp,
31
32
  readRemoteMcpAuthConfig,
32
33
  registerFramework,
34
+ remoteMcpConnectionScopedEnvVar,
35
+ remoteMcpEnvPrefix,
36
+ remoteMcpServerKey,
33
37
  resolveAvatarEnvUrl,
34
38
  resolveConnectivityProbe,
35
39
  worseConnectivityOutcome,
36
40
  wrapScheduledTaskPrompt
37
- } from "./chunk-JWR5FP7S.js";
41
+ } from "./chunk-WRII2Q5W.js";
38
42
  import {
39
43
  parsePsRows
40
44
  } from "./chunk-XWVM4KPK.js";
@@ -3205,19 +3209,21 @@ function buildMcpJson(input) {
3205
3209
  tokenFile: join2(getProjectDir(input.agent.code_name), ".env.integrations")
3206
3210
  };
3207
3211
  for (const integration of input.integrations ?? []) {
3208
- const liveEntry = buildLiveHeaderRemoteMcpProxyEntry(integration.definition_id, integration.remoteMcp, remoteOAuthProxyPaths);
3212
+ const connectionKey = integration.connection_key;
3213
+ const serverKey = remoteMcpServerKey(integration.definition_id, connectionKey);
3214
+ const liveEntry = buildLiveHeaderRemoteMcpProxyEntry(integration.definition_id, integration.remoteMcp, remoteOAuthProxyPaths, connectionKey);
3209
3215
  if (liveEntry) {
3210
- mcpServers[integration.definition_id] = liveEntry;
3216
+ mcpServers[serverKey] = liveEntry;
3211
3217
  continue;
3212
3218
  }
3213
- const proxyEntry = buildOAuthRemoteMcpProxyEntry(integration.definition_id, remoteOAuthProxyPaths);
3219
+ const proxyEntry = buildOAuthRemoteMcpProxyEntry(integration.definition_id, remoteOAuthProxyPaths, connectionKey);
3214
3220
  if (proxyEntry) {
3215
- mcpServers[integration.definition_id] = proxyEntry;
3221
+ mcpServers[serverKey] = proxyEntry;
3216
3222
  continue;
3217
3223
  }
3218
- const entry = buildRemoteMcpEntry(integration.definition_id, integration.remoteMcp);
3224
+ const entry = buildRemoteMcpEntry(integration.definition_id, integration.remoteMcp, connectionKey);
3219
3225
  if (entry) {
3220
- mcpServers[integration.definition_id] = entry;
3226
+ mcpServers[serverKey] = entry;
3221
3227
  }
3222
3228
  }
3223
3229
  const hasCloudBroker = input.integrations?.some((i) => i.definition_id === "cloud-broker");
@@ -4295,7 +4301,8 @@ ${sections}`
4295
4301
  }));
4296
4302
  const envUpdates = {};
4297
4303
  for (const integration of decryptedIntegrations) {
4298
- const prefix = integration.definition_id.toUpperCase().replace(/[^A-Z0-9]/g, "_");
4304
+ const prefix = remoteMcpEnvPrefix(integration.definition_id, integration.connection_key);
4305
+ const unscopedPrefix = remoteMcpEnvPrefix(integration.definition_id, null);
4299
4306
  const creds = integration.credentials;
4300
4307
  const def = INTEGRATION_REGISTRY.find((d) => d.id === integration.definition_id);
4301
4308
  let token;
@@ -4328,8 +4335,8 @@ ${sections}`
4328
4335
  for (const [key, value] of Object.entries(config)) {
4329
4336
  if (typeof value === "string" && value) {
4330
4337
  const upperKey = key.toUpperCase();
4331
- const envKey = upperKey.startsWith(`${prefix}_`) ? upperKey : `${prefix}_${upperKey}`;
4332
- envUpdates[envKey] = value;
4338
+ const stripped = upperKey.startsWith(`${unscopedPrefix}_`) ? upperKey.slice(unscopedPrefix.length + 1) : upperKey;
4339
+ envUpdates[`${prefix}_${stripped}`] = value;
4333
4340
  }
4334
4341
  }
4335
4342
  }
@@ -4339,9 +4346,10 @@ ${sections}`
4339
4346
  if (!defaults)
4340
4347
  continue;
4341
4348
  for (const [key, value] of Object.entries(defaults)) {
4342
- if (key in envUpdates)
4349
+ const scoped = remoteMcpConnectionScopedEnvVar(integration.definition_id, key, integration.connection_key);
4350
+ if (scoped in envUpdates)
4343
4351
  continue;
4344
- envUpdates[key] = value;
4352
+ envUpdates[scoped] = value;
4345
4353
  }
4346
4354
  }
4347
4355
  writeEnvIntegrationsForAgent(codeName, {
@@ -4402,19 +4410,21 @@ ${sections}`
4402
4410
  tokenFile: join2(getProjectDir(codeName), ".env.integrations")
4403
4411
  };
4404
4412
  for (const integration of integrations) {
4405
- const liveEntry = buildLiveHeaderRemoteMcpProxyEntry(integration.definition_id, integration.remoteMcp, remoteOAuthProxyPaths);
4413
+ const connectionKey = integration.connection_key;
4414
+ const serverKey = remoteMcpServerKey(integration.definition_id, connectionKey);
4415
+ const liveEntry = buildLiveHeaderRemoteMcpProxyEntry(integration.definition_id, integration.remoteMcp, remoteOAuthProxyPaths, connectionKey);
4406
4416
  if (liveEntry) {
4407
- this.writeMcpServer(codeName, integration.definition_id, liveEntry);
4417
+ this.writeMcpServer(codeName, serverKey, liveEntry);
4408
4418
  continue;
4409
4419
  }
4410
- const proxyEntry = buildOAuthRemoteMcpProxyEntry(integration.definition_id, remoteOAuthProxyPaths);
4420
+ const proxyEntry = buildOAuthRemoteMcpProxyEntry(integration.definition_id, remoteOAuthProxyPaths, connectionKey);
4411
4421
  if (proxyEntry) {
4412
- this.writeMcpServer(codeName, integration.definition_id, proxyEntry);
4422
+ this.writeMcpServer(codeName, serverKey, proxyEntry);
4413
4423
  continue;
4414
4424
  }
4415
- const entry = buildRemoteMcpEntry(integration.definition_id, integration.remoteMcp);
4425
+ const entry = buildRemoteMcpEntry(integration.definition_id, integration.remoteMcp, connectionKey);
4416
4426
  if (entry) {
4417
- this.writeMcpServer(codeName, integration.definition_id, entry);
4427
+ this.writeMcpServer(codeName, serverKey, entry);
4418
4428
  }
4419
4429
  }
4420
4430
  const hasCloudBroker = integrations.some((i) => i.definition_id === "cloud-broker");
@@ -4539,6 +4549,21 @@ ${sections}`
4539
4549
  ...registryRemoteMcpKeys,
4540
4550
  ...Object.entries(OAUTH_PROVIDERS).filter(([, provider]) => Boolean(provider.mcpUrl)).map(([id]) => id)
4541
4551
  ]);
4552
+ const remoteCapableBases = new Set([
4553
+ ...registryRemoteMcpKeys,
4554
+ ...Object.entries(OAUTH_PROVIDERS).filter(([, provider]) => Boolean(provider.mcpUrl)).map(([id]) => id)
4555
+ ].map((id) => id.replace(/[^a-z0-9]/gi, "_").toLowerCase()));
4556
+ try {
4557
+ for (const declared of Object.keys(this.readMcpServers?.(codeName) ?? {})) {
4558
+ const hyphen = declared.indexOf("-");
4559
+ if (hyphen <= 0)
4560
+ continue;
4561
+ if (remoteCapableBases.has(declared.slice(0, hyphen))) {
4562
+ integrationDerivedKeys.add(declared);
4563
+ }
4564
+ }
4565
+ } catch {
4566
+ }
4542
4567
  const expectedKeys = /* @__PURE__ */ new Set();
4543
4568
  if (xeroIntegration)
4544
4569
  expectedKeys.add("xero");
@@ -4559,8 +4584,14 @@ ${sections}`
4559
4584
  if (def?.nativeMcp) {
4560
4585
  expectedKeys.add(def.nativeMcp.key ?? integration.definition_id);
4561
4586
  }
4562
- if (buildRemoteMcpEntry(integration.definition_id, integration.remoteMcp)) {
4563
- expectedKeys.add(integration.definition_id);
4587
+ let remoteEntry = null;
4588
+ try {
4589
+ remoteEntry = buildRemoteMcpEntry(integration.definition_id, integration.remoteMcp, integration.connection_key);
4590
+ } catch {
4591
+ remoteEntry = null;
4592
+ }
4593
+ if (remoteEntry) {
4594
+ expectedKeys.add(remoteMcpServerKey(integration.definition_id, integration.connection_key));
4564
4595
  }
4565
4596
  }
4566
4597
  for (const key of integrationDerivedKeys) {
@@ -5026,7 +5057,7 @@ function exchangeFailureKind(err) {
5026
5057
  }
5027
5058
 
5028
5059
  // src/lib/api-client.ts
5029
- var agtCliVersion = true ? "0.28.496" : "dev";
5060
+ var agtCliVersion = true ? "0.28.498" : "dev";
5030
5061
  var lastConfigHash = null;
5031
5062
  function setConfigHash(hash) {
5032
5063
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -6793,8 +6824,8 @@ function deriveMcpServerKey(input) {
6793
6824
  }).kind;
6794
6825
  if (kind !== "mcp_tools_list" && kind !== "managed_composite") return void 0;
6795
6826
  const base = input.definitionId.replace(/[^a-z0-9]/gi, "_").toLowerCase();
6796
- const key = input.connectionKey;
6797
- return !key || key === "default" ? base : `${base}-${key}`;
6827
+ if (isDefaultRemoteMcpConnection(input.connectionKey)) return base;
6828
+ return remoteMcpServerKey(input.definitionId, input.connectionKey);
6798
6829
  }
6799
6830
  function buildProbeEnv(projectDir) {
6800
6831
  const probeEnv = { ...process.env };
@@ -7840,4 +7871,4 @@ export {
7840
7871
  managerInstallSystemUnitCommand,
7841
7872
  managerUninstallSystemUnitCommand
7842
7873
  };
7843
- //# sourceMappingURL=chunk-DZSS6TA3.js.map
7874
+ //# sourceMappingURL=chunk-F6SYBDTF.js.map