@integrity-labs/agt-cli 0.14.12 → 0.14.15

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.
@@ -245,6 +245,32 @@ function isResolveError(v) {
245
245
  return "ok" in v && v.ok === false;
246
246
  }
247
247
 
248
+ // ../../packages/core/dist/delivery/console-url.js
249
+ function deriveConsoleUrl(apiUrl) {
250
+ const trimmed = apiUrl?.trim();
251
+ if (!trimmed)
252
+ return null;
253
+ let parsed;
254
+ try {
255
+ parsed = new URL(trimmed);
256
+ } catch {
257
+ return null;
258
+ }
259
+ const host = parsed.hostname;
260
+ if (host === "api.agt.localhost") {
261
+ parsed.hostname = "console.agt.localhost";
262
+ return stripTrailingSlash(parsed.toString());
263
+ }
264
+ if (host.startsWith("api.")) {
265
+ parsed.hostname = `app.${host.slice(4)}`;
266
+ return stripTrailingSlash(parsed.toString());
267
+ }
268
+ return null;
269
+ }
270
+ function stripTrailingSlash(value) {
271
+ return value.replace(/\/+$/, "");
272
+ }
273
+
248
274
  // ../../packages/core/dist/provisioning/framework-registry.js
249
275
  var adapters = /* @__PURE__ */ new Map();
250
276
  function registerFramework(adapter) {
@@ -681,6 +707,51 @@ function writeXurlStoreForIntegrations(integrations, filePath = getXurlStorePath
681
707
  return filePath;
682
708
  }
683
709
 
710
+ // ../../packages/core/dist/crypto/secret.js
711
+ import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
712
+ var ALGORITHM = "aes-256-gcm";
713
+ var AUTH_TAG_LENGTH = 16;
714
+ var PREFIX = "enc:";
715
+ function getKey() {
716
+ const hex = process.env["AUTH_ENCRYPTION_KEY"];
717
+ if (!hex || hex.length !== 64) {
718
+ throw new Error("AUTH_ENCRYPTION_KEY must be a 64-char hex string (32 bytes)");
719
+ }
720
+ return Buffer.from(hex, "hex");
721
+ }
722
+ function decryptSecret(encoded) {
723
+ if (!encoded.startsWith(PREFIX)) {
724
+ return encoded;
725
+ }
726
+ const key = getKey();
727
+ const parts = encoded.slice(PREFIX.length).split(":");
728
+ if (parts.length !== 2)
729
+ throw new Error("Invalid encrypted secret format");
730
+ const iv = Buffer.from(parts[0], "base64");
731
+ const data = Buffer.from(parts[1], "base64");
732
+ const ciphertext = data.subarray(0, data.length - AUTH_TAG_LENGTH);
733
+ const tag = data.subarray(data.length - AUTH_TAG_LENGTH);
734
+ const decipher = createDecipheriv(ALGORITHM, key, iv, { authTagLength: AUTH_TAG_LENGTH });
735
+ decipher.setAuthTag(tag);
736
+ return decipher.update(ciphertext) + decipher.final("utf8");
737
+ }
738
+ function isEncrypted(value) {
739
+ return value.startsWith(PREFIX);
740
+ }
741
+
742
+ // ../../packages/core/dist/crypto/integration-credentials.js
743
+ var SENSITIVE_INTEGRATION_FIELDS = ["access_token", "refresh_token", "api_key"];
744
+ function decryptIntegrationCredentials(credentials) {
745
+ const out = { ...credentials };
746
+ for (const field of SENSITIVE_INTEGRATION_FIELDS) {
747
+ const value = out[field];
748
+ if (typeof value === "string" && value && isEncrypted(value)) {
749
+ out[field] = decryptSecret(value);
750
+ }
751
+ }
752
+ return out;
753
+ }
754
+
684
755
  // ../../packages/core/dist/channels/registry.js
685
756
  var CHANNEL_REGISTRY = [
686
757
  { id: "slack", name: "Slack", securityTier: "standard", e2eEncrypted: false, auditTrail: true, publicExposureRisk: "Low" },
@@ -702,7 +773,8 @@ var CHANNEL_REGISTRY = [
702
773
  { id: "tlon", name: "Tlon", securityTier: "standard", e2eEncrypted: true, auditTrail: true, publicExposureRisk: "Low" },
703
774
  { id: "bluebubbles", name: "BlueBubbles", securityTier: "limited", e2eEncrypted: false, auditTrail: false, publicExposureRisk: "Low" },
704
775
  { id: "beam", name: "Beam Protocol", securityTier: "elevated", e2eEncrypted: true, auditTrail: true, publicExposureRisk: "Low" },
705
- { id: "direct-chat", name: "Direct Chat", securityTier: "standard", e2eEncrypted: false, auditTrail: true, publicExposureRisk: "Low" }
776
+ { id: "direct-chat", name: "Direct Chat", securityTier: "standard", e2eEncrypted: false, auditTrail: true, publicExposureRisk: "Low" },
777
+ { id: "grok-voice", name: "Grok Voice", securityTier: "standard", e2eEncrypted: false, auditTrail: true, publicExposureRisk: "Medium" }
706
778
  ];
707
779
  var channelMap = new Map(CHANNEL_REGISTRY.map((c) => [c.id, c]));
708
780
  function getChannel(id) {
@@ -767,7 +839,8 @@ function mapIntegrationsToOpenClaw(integrations) {
767
839
  let memory;
768
840
  for (const integration of integrations) {
769
841
  const profileKey = `integration:${integration.definition_id}:default`;
770
- const apiKey = integration.credentials.api_key ?? integration.credentials.access_token;
842
+ const creds = decryptIntegrationCredentials(integration.credentials);
843
+ const apiKey = creds.api_key ?? creds.access_token;
771
844
  if (typeof apiKey === "string" && apiKey) {
772
845
  authProfiles[profileKey] = {
773
846
  type: integration.auth_type,
@@ -780,7 +853,7 @@ function mapIntegrationsToOpenClaw(integrations) {
780
853
  }
781
854
  const mcpUrl = integration.config.mcp_url;
782
855
  if (mcpUrl) {
783
- const token = integration.credentials.api_key ?? integration.credentials.access_token;
856
+ const token = creds.api_key ?? creds.access_token;
784
857
  mcpServers[integration.definition_id] = { url: mcpUrl, ...token ? { token } : {} };
785
858
  }
786
859
  const definition = getIntegration(integration.definition_id);
@@ -1063,13 +1136,14 @@ function writeIntegrationTokenFile(codeName, integrations) {
1063
1136
  for (const integration of integrations) {
1064
1137
  if (integration.auth_type !== "oauth2")
1065
1138
  continue;
1066
- const accessToken = integration.credentials.access_token;
1139
+ const creds = decryptIntegrationCredentials(integration.credentials);
1140
+ const accessToken = creds.access_token;
1067
1141
  if (!accessToken)
1068
1142
  continue;
1069
1143
  tokens[integration.definition_id] = {
1070
1144
  access_token: accessToken,
1071
1145
  ...Object.keys(integration.config).length > 0 ? { config: integration.config } : {},
1072
- ...integration.credentials.token_expires_at ? { expires_at: integration.credentials.token_expires_at } : {}
1146
+ ...creds.token_expires_at ? { expires_at: creds.token_expires_at } : {}
1073
1147
  };
1074
1148
  }
1075
1149
  if (Object.keys(tokens).length === 0)
@@ -2291,7 +2365,8 @@ var nemoClawAdapter = {
2291
2365
  const envFile = join3(configDir, "integration-env.json");
2292
2366
  const env2 = {};
2293
2367
  for (const integration of integrations) {
2294
- const apiKey = integration.credentials.api_key ?? integration.credentials.access_token;
2368
+ const creds = decryptIntegrationCredentials(integration.credentials);
2369
+ const apiKey = creds.api_key ?? creds.access_token;
2295
2370
  if (apiKey) {
2296
2371
  const envKey = `INTEGRATION_${integration.definition_id.toUpperCase().replace(/-/g, "_")}_KEY`;
2297
2372
  env2[envKey] = apiKey;
@@ -3479,16 +3554,21 @@ ${sections}`
3479
3554
  writeIntegrations(codeName, integrations) {
3480
3555
  const agentDir = getAgentDir(codeName);
3481
3556
  mkdirSync4(agentDir, { recursive: true });
3557
+ const decryptedIntegrations = integrations.map((integration) => ({
3558
+ ...integration,
3559
+ credentials: decryptIntegrationCredentials(integration.credentials)
3560
+ }));
3482
3561
  const envLines = ["# Augmented integrations \u2014 auto-generated, do not edit"];
3483
- for (const integration of integrations) {
3562
+ for (const integration of decryptedIntegrations) {
3484
3563
  const prefix = integration.definition_id.toUpperCase().replace(/[^A-Z0-9]/g, "_");
3564
+ const creds = integration.credentials;
3485
3565
  if (integration.auth_type === "oauth2") {
3486
- const accessToken = integration.credentials.access_token;
3566
+ const accessToken = creds.access_token;
3487
3567
  if (accessToken) {
3488
3568
  envLines.push(`${prefix}_ACCESS_TOKEN=${accessToken}`);
3489
3569
  }
3490
3570
  } else if (integration.auth_type === "api_key") {
3491
- const apiKey = integration.credentials.api_key;
3571
+ const apiKey = creds.api_key;
3492
3572
  if (apiKey) {
3493
3573
  envLines.push(`${prefix}_API_KEY=${apiKey}`);
3494
3574
  }
@@ -3509,7 +3589,7 @@ ${sections}`
3509
3589
  writeFileSync4(envPath, envLines.join("\n") + "\n");
3510
3590
  chmodSync4(envPath, SECRET_FILE_MODE);
3511
3591
  }
3512
- writeXurlStoreForIntegrations(integrations);
3592
+ writeXurlStoreForIntegrations(decryptedIntegrations);
3513
3593
  const hasQmd = integrations.some((i) => i.definition_id === "qmd");
3514
3594
  if (hasQmd) {
3515
3595
  this.writeMcpServer(codeName, "qmd", { command: "qmd", args: ["mcp"] });
@@ -3809,13 +3889,14 @@ ${sections}`
3809
3889
  for (const integration of integrations) {
3810
3890
  if (integration.auth_type !== "oauth2")
3811
3891
  continue;
3812
- const accessToken = integration.credentials.access_token;
3892
+ const creds = decryptIntegrationCredentials(integration.credentials);
3893
+ const accessToken = creds.access_token;
3813
3894
  if (!accessToken)
3814
3895
  continue;
3815
3896
  tokens[integration.definition_id] = {
3816
3897
  access_token: accessToken,
3817
3898
  ...Object.keys(integration.config).length > 0 ? { config: integration.config } : {},
3818
- ...integration.credentials.token_expires_at ? { expires_at: integration.credentials.token_expires_at } : {}
3899
+ ...creds.token_expires_at ? { expires_at: creds.token_expires_at } : {}
3819
3900
  };
3820
3901
  }
3821
3902
  if (Object.keys(tokens).length === 0)
@@ -5090,7 +5171,9 @@ var charter_frontmatter_v1_default = {
5090
5171
  "zalo",
5091
5172
  "tlon",
5092
5173
  "bluebubbles",
5093
- "beam"
5174
+ "beam",
5175
+ "direct-chat",
5176
+ "grok-voice"
5094
5177
  ]
5095
5178
  },
5096
5179
  uniqueItems: true
@@ -5118,7 +5201,9 @@ var charter_frontmatter_v1_default = {
5118
5201
  "zalo",
5119
5202
  "tlon",
5120
5203
  "bluebubbles",
5121
- "beam"
5204
+ "beam",
5205
+ "direct-chat",
5206
+ "grok-voice"
5122
5207
  ]
5123
5208
  },
5124
5209
  uniqueItems: true
@@ -6802,6 +6887,7 @@ export {
6802
6887
  appendDmFooter,
6803
6888
  resolveDmTarget,
6804
6889
  isResolveError,
6890
+ deriveConsoleUrl,
6805
6891
  getFramework,
6806
6892
  CHANNEL_REGISTRY,
6807
6893
  getChannel,
@@ -6853,4 +6939,4 @@ export {
6853
6939
  managerStopCommand,
6854
6940
  managerStatusCommand
6855
6941
  };
6856
- //# sourceMappingURL=chunk-NSHSUWZQ.js.map
6942
+ //# sourceMappingURL=chunk-LGEQOVFU.js.map