@integrity-labs/agt-cli 0.19.11 → 0.19.13

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
@@ -50,7 +50,7 @@ import {
50
50
  success,
51
51
  table,
52
52
  warn
53
- } from "../chunk-HBZL6V36.js";
53
+ } from "../chunk-SUUTWC6M.js";
54
54
 
55
55
  // src/bin/agt.ts
56
56
  import { join as join10 } from "path";
@@ -3734,7 +3734,7 @@ import { execFileSync, execSync } from "child_process";
3734
3734
  import { existsSync as existsSync5, realpathSync } from "fs";
3735
3735
  import chalk17 from "chalk";
3736
3736
  import ora15 from "ora";
3737
- var cliVersion = true ? "0.19.11" : "dev";
3737
+ var cliVersion = true ? "0.19.13" : "dev";
3738
3738
  async function fetchLatestVersion() {
3739
3739
  const host2 = getHost();
3740
3740
  if (!host2) return null;
@@ -4192,7 +4192,7 @@ function handleError(err) {
4192
4192
  }
4193
4193
 
4194
4194
  // src/bin/agt.ts
4195
- var cliVersion2 = true ? "0.19.11" : "dev";
4195
+ var cliVersion2 = true ? "0.19.13" : "dev";
4196
4196
  var program = new Command();
4197
4197
  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");
4198
4198
  program.hook("preAction", (thisCommand) => {
@@ -3274,6 +3274,9 @@ function buildRemoteMcpEntry(definitionId) {
3274
3274
  // ../../packages/core/dist/provisioning/frameworks/claudecode/index.js
3275
3275
  var VALID_CODE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
3276
3276
  var SECRET_FILE_MODE = 384;
3277
+ function shellQuote(value) {
3278
+ return `'${value.replace(/'/g, `'\\''`)}'`;
3279
+ }
3277
3280
  function assertValidCodeName(codeName) {
3278
3281
  if (!VALID_CODE_NAME.test(codeName)) {
3279
3282
  throw new Error(`Invalid agent code_name: "${codeName}". Must be kebab-case.`);
@@ -3365,6 +3368,24 @@ function syncMcpToProject(codeName) {
3365
3368
  } catch {
3366
3369
  }
3367
3370
  }
3371
+ function readExistingMcpEnvVar(codeName, serverId, envKey) {
3372
+ const mcpJsonPath = join4(getAgentDir(codeName), "provision", ".mcp.json");
3373
+ try {
3374
+ const raw = readFileSync4(mcpJsonPath, "utf-8");
3375
+ const config = JSON.parse(raw);
3376
+ const server = config.mcpServers?.[serverId];
3377
+ if (!server || typeof server !== "object")
3378
+ return void 0;
3379
+ const env2 = server.env;
3380
+ const value = env2?.[envKey];
3381
+ if (typeof value !== "string" || value === "" || value === `\${${envKey}}`) {
3382
+ return void 0;
3383
+ }
3384
+ return value;
3385
+ } catch {
3386
+ return void 0;
3387
+ }
3388
+ }
3368
3389
  function deployArtifactsToProject(codeName, provisionDir) {
3369
3390
  const projectDir = getProjectDir(codeName);
3370
3391
  mkdirSync4(projectDir, { recursive: true });
@@ -3988,6 +4009,11 @@ function buildMcpJson(input) {
3988
4009
  // every call; the API derives team server-side. AGT_TEAM_SLUG
3989
4010
  // dropped — single-team-per-host invariant gone.
3990
4011
  AGT_AGENT_ID: input.agent.agent_id,
4012
+ // ENG-4788: cloud-broker@0.6+ exits at startup if AGT_RUN_ID
4013
+ // is missing (packages/cloud-broker/src/index.ts:63). Manager
4014
+ // exports AGT_RUN_ID per Claude spawn; Claude substitutes the
4015
+ // placeholder at MCP-launch time. Same pattern as augmented.
4016
+ AGT_RUN_ID: "${AGT_RUN_ID}",
3991
4017
  AGT_API_KEY: "${AGT_API_KEY}",
3992
4018
  PATH: process.env["PATH"] ?? "",
3993
4019
  HOME: process.env["HOME"] ?? ""
@@ -4189,11 +4215,11 @@ ${sections}`
4189
4215
  if (!p.api_key)
4190
4216
  continue;
4191
4217
  const providerEnvPrefix = p.provider.toUpperCase().replace(/[^A-Z0-9]/g, "_");
4192
- envLines.push(`${providerEnvPrefix}_API_KEY=${p.api_key}`);
4218
+ envLines.push(`${providerEnvPrefix}_API_KEY=${shellQuote(p.api_key)}`);
4193
4219
  const rawBaseUrl = p.metadata["base_url"];
4194
4220
  const baseUrl = typeof rawBaseUrl === "string" ? rawBaseUrl.trim() : "";
4195
4221
  if (baseUrl.length > 0) {
4196
- envLines.push(`${providerEnvPrefix}_BASE_URL=${baseUrl}`);
4222
+ envLines.push(`${providerEnvPrefix}_BASE_URL=${shellQuote(baseUrl)}`);
4197
4223
  }
4198
4224
  }
4199
4225
  if (envLines.length > 1) {
@@ -4455,12 +4481,12 @@ ${sections}`
4455
4481
  if (integration.auth_type === "oauth2") {
4456
4482
  const accessToken = creds.access_token;
4457
4483
  if (accessToken) {
4458
- envLines.push(`${prefix}_ACCESS_TOKEN=${accessToken}`);
4484
+ envLines.push(`${prefix}_ACCESS_TOKEN=${shellQuote(accessToken)}`);
4459
4485
  }
4460
4486
  } else if (integration.auth_type === "api_key") {
4461
4487
  const apiKey = creds.api_key;
4462
4488
  if (apiKey) {
4463
- envLines.push(`${prefix}_API_KEY=${apiKey}`);
4489
+ envLines.push(`${prefix}_API_KEY=${shellQuote(apiKey)}`);
4464
4490
  }
4465
4491
  }
4466
4492
  if (integration.config) {
@@ -4469,7 +4495,7 @@ ${sections}`
4469
4495
  if (typeof value === "string" && value) {
4470
4496
  const upperKey = key.toUpperCase();
4471
4497
  const envKey = upperKey.startsWith(`${prefix}_`) ? upperKey : `${prefix}_${upperKey}`;
4472
- envLines.push(`${envKey}=${value}`);
4498
+ envLines.push(`${envKey}=${shellQuote(value)}`);
4473
4499
  }
4474
4500
  }
4475
4501
  }
@@ -4508,12 +4534,18 @@ ${sections}`
4508
4534
  }
4509
4535
  const hasCloudBroker = integrations.some((i) => i.definition_id === "cloud-broker");
4510
4536
  if (hasCloudBroker) {
4537
+ const existingAgentId = readExistingMcpEnvVar(codeName, "cloud-broker", "AGT_AGENT_ID");
4511
4538
  this.writeMcpServer(codeName, "cloud-broker", {
4512
4539
  command: "npx",
4513
4540
  args: ["-y", "@integrity-labs/cloud-broker@latest"],
4514
4541
  env: {
4515
4542
  AGT_HOST: "${AGT_HOST}",
4516
4543
  AGT_API_KEY: "${AGT_API_KEY}",
4544
+ AGT_AGENT_ID: existingAgentId ?? "${AGT_AGENT_ID}",
4545
+ // ENG-4788: cloud-broker@0.6+ exits at startup if AGT_RUN_ID
4546
+ // is missing. Mirror buildMcpJson's entry on incremental sync
4547
+ // so an agent that connects AWS post-provision boots cleanly.
4548
+ AGT_RUN_ID: "${AGT_RUN_ID}",
4517
4549
  PATH: process.env["PATH"] ?? "",
4518
4550
  HOME: process.env["HOME"] ?? ""
4519
4551
  }
@@ -8204,4 +8236,4 @@ export {
8204
8236
  managerInstallSystemUnitCommand,
8205
8237
  managerUninstallSystemUnitCommand
8206
8238
  };
8207
- //# sourceMappingURL=chunk-HBZL6V36.js.map
8239
+ //# sourceMappingURL=chunk-SUUTWC6M.js.map