@integrity-labs/agt-cli 0.27.80 → 0.27.82

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.
@@ -2421,6 +2421,7 @@ function formatLiteralSecretRejection(f) {
2421
2421
 
2422
2422
  // ../../packages/core/dist/provisioning/mcp-config-guards.js
2423
2423
  var MCP_FILE_MODE = 384;
2424
+ var lastRejectionFingerprintByPath = /* @__PURE__ */ new Map();
2424
2425
  var REQUIRED_ENV_RULES_BY_SERVER = {
2425
2426
  "cloud-broker": [
2426
2427
  { key: "AGT_HOST", mustBeConcrete: false },
@@ -2571,9 +2572,13 @@ function safeWriteMcpJson(path, config) {
2571
2572
  }
2572
2573
  const secretFindings = scanConfigForLiteralSecrets(config);
2573
2574
  if (secretFindings.length > 0) {
2574
- for (const f of secretFindings) {
2575
- process.stderr.write(`${formatLiteralSecretRejection(f)}
2575
+ const fingerprint = secretFindings.map((f) => `${f.server}.${f.field}.${f.location}`).sort().join("|");
2576
+ if (lastRejectionFingerprintByPath.get(path) !== fingerprint) {
2577
+ lastRejectionFingerprintByPath.set(path, fingerprint);
2578
+ for (const f of secretFindings) {
2579
+ process.stderr.write(`${formatLiteralSecretRejection(f)}
2576
2580
  `);
2581
+ }
2577
2582
  }
2578
2583
  return {
2579
2584
  written: false,
@@ -2584,6 +2589,7 @@ function safeWriteMcpJson(path, config) {
2584
2589
  }))
2585
2590
  };
2586
2591
  }
2592
+ lastRejectionFingerprintByPath.delete(path);
2587
2593
  safeWriteJsonAtomic(path, JSON.stringify(config, null, 2), { mode: MCP_FILE_MODE });
2588
2594
  return { written: true, errors: [] };
2589
2595
  }
@@ -3935,6 +3941,63 @@ function writeEnvIntegrationsForAgent(codeName, args) {
3935
3941
  `);
3936
3942
  }
3937
3943
  }
3944
+ var MIGRATABLE_FIELD_TO_ENV_VAR = {
3945
+ SLACK_BOT_TOKEN: "SLACK_BOT_TOKEN",
3946
+ SLACK_APP_TOKEN: "SLACK_APP_TOKEN",
3947
+ TELEGRAM_BOT_TOKEN: "TELEGRAM_BOT_TOKEN",
3948
+ MSTEAMS_CLIENT_SECRET: "MSTEAMS_CLIENT_SECRET",
3949
+ PIPEDREAM_CLIENT_SECRET: "PIPEDREAM_CLIENT_SECRET",
3950
+ "x-api-key": "COMPOSIO_API_KEY",
3951
+ AGT_API_KEY: "AGT_API_KEY"
3952
+ };
3953
+ function migrateExistingLiteralSecrets(codeName) {
3954
+ const mcpJsonPath = join4(getAgentDir(codeName), "provision", ".mcp.json");
3955
+ let config;
3956
+ try {
3957
+ config = JSON.parse(readFileSync5(mcpJsonPath, "utf-8"));
3958
+ } catch {
3959
+ return;
3960
+ }
3961
+ let existingEnvKeys = /* @__PURE__ */ new Set();
3962
+ try {
3963
+ existingEnvKeys = new Set(parseEnvFileEntries(readFileSync5(join4(getAgentDir(codeName), ".env.integrations"), "utf-8")).keys());
3964
+ } catch {
3965
+ }
3966
+ const findings = scanConfigForLiteralSecrets(config);
3967
+ if (findings.length === 0)
3968
+ return;
3969
+ const updates = {};
3970
+ const unmapped = [];
3971
+ let hoisted = 0;
3972
+ for (const f of findings) {
3973
+ const entry = config.mcpServers?.[f.server];
3974
+ const block = f.location === "env" ? entry?.env : entry?.headers;
3975
+ const envVar = MIGRATABLE_FIELD_TO_ENV_VAR[f.field];
3976
+ const value = block?.[f.field];
3977
+ if (!block || !envVar || typeof value !== "string") {
3978
+ unmapped.push(`${f.server}.${f.field}`);
3979
+ continue;
3980
+ }
3981
+ if (envVar !== "AGT_API_KEY" && !existingEnvKeys.has(envVar)) {
3982
+ updates[envVar] = value;
3983
+ }
3984
+ block[f.field] = `\${${envVar}}`;
3985
+ hoisted++;
3986
+ }
3987
+ if (hoisted === 0) {
3988
+ process.stderr.write(`[mcp-migrate] [no-mappable-literals] agent=${codeName} unmapped=${unmapped.join(",")}
3989
+ `);
3990
+ return;
3991
+ }
3992
+ if (Object.keys(updates).length > 0) {
3993
+ writeEnvIntegrationsForAgent(codeName, { mode: "upsert", updates });
3994
+ }
3995
+ if (writeMcpJsonGuarded(codeName, mcpJsonPath, config)) {
3996
+ syncMcpToProject(codeName);
3997
+ process.stderr.write(`[mcp-migrate] [literals-hoisted] agent=${codeName} hoisted=${hoisted}${unmapped.length > 0 ? ` unmapped=${unmapped.join(",")}` : ""}
3998
+ `);
3999
+ }
4000
+ }
3938
4001
  function assertValidCodeName(codeName) {
3939
4002
  if (!VALID_CODE_NAME.test(codeName)) {
3940
4003
  throw new Error(`Invalid agent code_name: "${codeName}". Must be kebab-case.`);
@@ -5783,6 +5846,12 @@ ${sections}`
5783
5846
  });
5784
5847
  return changed;
5785
5848
  },
5849
+ // ENG-5901 PR 3: hoist pre-Track-D literal secrets out of the on-disk
5850
+ // .mcp.json so the armed lint stops rejecting every incremental write.
5851
+ // See migrateExistingLiteralSecrets for the full story.
5852
+ migrateSecretStorage(codeName) {
5853
+ migrateExistingLiteralSecrets(codeName);
5854
+ },
5786
5855
  seedProfileConfig(codeName) {
5787
5856
  const agentDir = getAgentDir(codeName);
5788
5857
  const projectDir = getProjectDir(codeName);
@@ -7488,4 +7557,4 @@ export {
7488
7557
  managerInstallSystemUnitCommand,
7489
7558
  managerUninstallSystemUnitCommand
7490
7559
  };
7491
- //# sourceMappingURL=chunk-Y4INY5FA.js.map
7560
+ //# sourceMappingURL=chunk-AN5X6CN2.js.map