@integrity-labs/agt-cli 0.14.10 → 0.14.14
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 +51 -29
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-RMTMETCK.js → chunk-VWCF6BOZ.js} +103 -13
- package/dist/chunk-VWCF6BOZ.js.map +1 -0
- package/dist/lib/manager-worker.js +246 -34
- package/dist/lib/manager-worker.js.map +1 -1
- package/mcp/slack-channel.js +573 -43
- package/mcp/telegram-channel.js +439 -27
- package/package.json +1 -1
- package/dist/chunk-RMTMETCK.js.map +0 -1
|
@@ -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" },
|
|
@@ -767,7 +838,8 @@ function mapIntegrationsToOpenClaw(integrations) {
|
|
|
767
838
|
let memory;
|
|
768
839
|
for (const integration of integrations) {
|
|
769
840
|
const profileKey = `integration:${integration.definition_id}:default`;
|
|
770
|
-
const
|
|
841
|
+
const creds = decryptIntegrationCredentials(integration.credentials);
|
|
842
|
+
const apiKey = creds.api_key ?? creds.access_token;
|
|
771
843
|
if (typeof apiKey === "string" && apiKey) {
|
|
772
844
|
authProfiles[profileKey] = {
|
|
773
845
|
type: integration.auth_type,
|
|
@@ -780,7 +852,7 @@ function mapIntegrationsToOpenClaw(integrations) {
|
|
|
780
852
|
}
|
|
781
853
|
const mcpUrl = integration.config.mcp_url;
|
|
782
854
|
if (mcpUrl) {
|
|
783
|
-
const token =
|
|
855
|
+
const token = creds.api_key ?? creds.access_token;
|
|
784
856
|
mcpServers[integration.definition_id] = { url: mcpUrl, ...token ? { token } : {} };
|
|
785
857
|
}
|
|
786
858
|
const definition = getIntegration(integration.definition_id);
|
|
@@ -1063,13 +1135,14 @@ function writeIntegrationTokenFile(codeName, integrations) {
|
|
|
1063
1135
|
for (const integration of integrations) {
|
|
1064
1136
|
if (integration.auth_type !== "oauth2")
|
|
1065
1137
|
continue;
|
|
1066
|
-
const
|
|
1138
|
+
const creds = decryptIntegrationCredentials(integration.credentials);
|
|
1139
|
+
const accessToken = creds.access_token;
|
|
1067
1140
|
if (!accessToken)
|
|
1068
1141
|
continue;
|
|
1069
1142
|
tokens[integration.definition_id] = {
|
|
1070
1143
|
access_token: accessToken,
|
|
1071
1144
|
...Object.keys(integration.config).length > 0 ? { config: integration.config } : {},
|
|
1072
|
-
...
|
|
1145
|
+
...creds.token_expires_at ? { expires_at: creds.token_expires_at } : {}
|
|
1073
1146
|
};
|
|
1074
1147
|
}
|
|
1075
1148
|
if (Object.keys(tokens).length === 0)
|
|
@@ -2291,7 +2364,8 @@ var nemoClawAdapter = {
|
|
|
2291
2364
|
const envFile = join3(configDir, "integration-env.json");
|
|
2292
2365
|
const env2 = {};
|
|
2293
2366
|
for (const integration of integrations) {
|
|
2294
|
-
const
|
|
2367
|
+
const creds = decryptIntegrationCredentials(integration.credentials);
|
|
2368
|
+
const apiKey = creds.api_key ?? creds.access_token;
|
|
2295
2369
|
if (apiKey) {
|
|
2296
2370
|
const envKey = `INTEGRATION_${integration.definition_id.toUpperCase().replace(/-/g, "_")}_KEY`;
|
|
2297
2371
|
env2[envKey] = apiKey;
|
|
@@ -3479,16 +3553,21 @@ ${sections}`
|
|
|
3479
3553
|
writeIntegrations(codeName, integrations) {
|
|
3480
3554
|
const agentDir = getAgentDir(codeName);
|
|
3481
3555
|
mkdirSync4(agentDir, { recursive: true });
|
|
3556
|
+
const decryptedIntegrations = integrations.map((integration) => ({
|
|
3557
|
+
...integration,
|
|
3558
|
+
credentials: decryptIntegrationCredentials(integration.credentials)
|
|
3559
|
+
}));
|
|
3482
3560
|
const envLines = ["# Augmented integrations \u2014 auto-generated, do not edit"];
|
|
3483
|
-
for (const integration of
|
|
3561
|
+
for (const integration of decryptedIntegrations) {
|
|
3484
3562
|
const prefix = integration.definition_id.toUpperCase().replace(/[^A-Z0-9]/g, "_");
|
|
3563
|
+
const creds = integration.credentials;
|
|
3485
3564
|
if (integration.auth_type === "oauth2") {
|
|
3486
|
-
const accessToken =
|
|
3565
|
+
const accessToken = creds.access_token;
|
|
3487
3566
|
if (accessToken) {
|
|
3488
3567
|
envLines.push(`${prefix}_ACCESS_TOKEN=${accessToken}`);
|
|
3489
3568
|
}
|
|
3490
3569
|
} else if (integration.auth_type === "api_key") {
|
|
3491
|
-
const apiKey =
|
|
3570
|
+
const apiKey = creds.api_key;
|
|
3492
3571
|
if (apiKey) {
|
|
3493
3572
|
envLines.push(`${prefix}_API_KEY=${apiKey}`);
|
|
3494
3573
|
}
|
|
@@ -3509,7 +3588,7 @@ ${sections}`
|
|
|
3509
3588
|
writeFileSync4(envPath, envLines.join("\n") + "\n");
|
|
3510
3589
|
chmodSync4(envPath, SECRET_FILE_MODE);
|
|
3511
3590
|
}
|
|
3512
|
-
writeXurlStoreForIntegrations(
|
|
3591
|
+
writeXurlStoreForIntegrations(decryptedIntegrations);
|
|
3513
3592
|
const hasQmd = integrations.some((i) => i.definition_id === "qmd");
|
|
3514
3593
|
if (hasQmd) {
|
|
3515
3594
|
this.writeMcpServer(codeName, "qmd", { command: "qmd", args: ["mcp"] });
|
|
@@ -3809,13 +3888,14 @@ ${sections}`
|
|
|
3809
3888
|
for (const integration of integrations) {
|
|
3810
3889
|
if (integration.auth_type !== "oauth2")
|
|
3811
3890
|
continue;
|
|
3812
|
-
const
|
|
3891
|
+
const creds = decryptIntegrationCredentials(integration.credentials);
|
|
3892
|
+
const accessToken = creds.access_token;
|
|
3813
3893
|
if (!accessToken)
|
|
3814
3894
|
continue;
|
|
3815
3895
|
tokens[integration.definition_id] = {
|
|
3816
3896
|
access_token: accessToken,
|
|
3817
3897
|
...Object.keys(integration.config).length > 0 ? { config: integration.config } : {},
|
|
3818
|
-
...
|
|
3898
|
+
...creds.token_expires_at ? { expires_at: creds.token_expires_at } : {}
|
|
3819
3899
|
};
|
|
3820
3900
|
}
|
|
3821
3901
|
if (Object.keys(tokens).length === 0)
|
|
@@ -4836,11 +4916,20 @@ function classifyOutput(output) {
|
|
|
4836
4916
|
const cleaned = output.replace(SENTINEL_REGEX, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
4837
4917
|
return { action: "strip", deliverable: cleaned, suppressedNotes: "" };
|
|
4838
4918
|
}
|
|
4919
|
+
var NON_DELIVERABLE_REMAINDER_PATTERNS = [
|
|
4920
|
+
/^\[notes\]/i,
|
|
4921
|
+
// Operator-facing notes block.
|
|
4922
|
+
/^[—–-]\s*scheduled by\b/i,
|
|
4923
|
+
// Default delivery-pipeline footer.
|
|
4924
|
+
/^sent (?:from|via)\b/i,
|
|
4925
|
+
// Mobile-style signatures.
|
|
4926
|
+
/^—?\s*automated (?:brief|report|message)\b/i
|
|
4927
|
+
];
|
|
4839
4928
|
function looksLikeNotesOnly(remainder) {
|
|
4840
4929
|
const lines = remainder.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
|
|
4841
4930
|
if (lines.length === 0)
|
|
4842
4931
|
return false;
|
|
4843
|
-
return lines
|
|
4932
|
+
return lines.every((line) => NON_DELIVERABLE_REMAINDER_PATTERNS.some((pattern) => pattern.test(line)));
|
|
4844
4933
|
}
|
|
4845
4934
|
|
|
4846
4935
|
// ../../packages/core/dist/schemas/validators.js
|
|
@@ -6793,6 +6882,7 @@ export {
|
|
|
6793
6882
|
appendDmFooter,
|
|
6794
6883
|
resolveDmTarget,
|
|
6795
6884
|
isResolveError,
|
|
6885
|
+
deriveConsoleUrl,
|
|
6796
6886
|
getFramework,
|
|
6797
6887
|
CHANNEL_REGISTRY,
|
|
6798
6888
|
getChannel,
|
|
@@ -6844,4 +6934,4 @@ export {
|
|
|
6844
6934
|
managerStopCommand,
|
|
6845
6935
|
managerStatusCommand
|
|
6846
6936
|
};
|
|
6847
|
-
//# sourceMappingURL=chunk-
|
|
6937
|
+
//# sourceMappingURL=chunk-VWCF6BOZ.js.map
|