@integrity-labs/agt-cli 0.19.19 → 0.19.21
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 +78 -3
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-WQJL6EGC.js → chunk-5WDQ5G5M.js} +367 -16
- package/dist/chunk-5WDQ5G5M.js.map +1 -0
- package/dist/lib/manager-worker.js +98 -17
- package/dist/lib/manager-worker.js.map +1 -1
- package/mcp/slack-channel.js +282 -0
- package/mcp/telegram-channel.js +270 -8
- package/package.json +1 -1
- package/dist/chunk-WQJL6EGC.js.map +0 -1
package/dist/bin/agt.js
CHANGED
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
success,
|
|
51
51
|
table,
|
|
52
52
|
warn
|
|
53
|
-
} from "../chunk-
|
|
53
|
+
} from "../chunk-5WDQ5G5M.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.
|
|
3737
|
+
var cliVersion = true ? "0.19.21" : "dev";
|
|
3738
3738
|
async function fetchLatestVersion() {
|
|
3739
3739
|
const host2 = getHost();
|
|
3740
3740
|
if (!host2) return null;
|
|
@@ -4182,6 +4182,80 @@ async function integrationDenyCommand(requestId, options) {
|
|
|
4182
4182
|
handleError(err);
|
|
4183
4183
|
}
|
|
4184
4184
|
}
|
|
4185
|
+
async function integrationEnrolCommand(options) {
|
|
4186
|
+
const json = isJsonMode();
|
|
4187
|
+
const apiScope = options.scope === "org" ? "organization" : options.scope;
|
|
4188
|
+
if (!["organization", "team", "agent"].includes(apiScope)) {
|
|
4189
|
+
error(`Invalid scope "${options.scope}". Use org, team, or agent.`);
|
|
4190
|
+
process.exitCode = 1;
|
|
4191
|
+
return;
|
|
4192
|
+
}
|
|
4193
|
+
const secrets = [];
|
|
4194
|
+
if (options.apiKey) secrets.push(["api_key", options.apiKey]);
|
|
4195
|
+
if (options.accessToken) secrets.push(["access_token", options.accessToken]);
|
|
4196
|
+
if (options.webhookSecret) secrets.push(["webhook_secret", options.webhookSecret]);
|
|
4197
|
+
if (secrets.length === 0) {
|
|
4198
|
+
error("One of --api-key, --access-token, or --webhook-secret is required.");
|
|
4199
|
+
process.exitCode = 1;
|
|
4200
|
+
return;
|
|
4201
|
+
}
|
|
4202
|
+
if (secrets.length > 1) {
|
|
4203
|
+
error("Only one of --api-key, --access-token, --webhook-secret may be set.");
|
|
4204
|
+
process.exitCode = 1;
|
|
4205
|
+
return;
|
|
4206
|
+
}
|
|
4207
|
+
const [secretKey, secretValue] = secrets[0];
|
|
4208
|
+
const credentials = { [secretKey]: secretValue };
|
|
4209
|
+
const authType = options.authType ?? (options.webhookSecret ? "webhook" : options.apiKey ? "api_key" : "oauth2");
|
|
4210
|
+
const spinner = ora16({ text: `Enrolling ${options.def} at ${apiScope} scope\u2026`, isSilent: json }).start();
|
|
4211
|
+
try {
|
|
4212
|
+
let agentId;
|
|
4213
|
+
if (apiScope === "agent") {
|
|
4214
|
+
if (!options.agent) {
|
|
4215
|
+
spinner.stop();
|
|
4216
|
+
error("--agent <code-name> is required for agent scope.");
|
|
4217
|
+
process.exitCode = 1;
|
|
4218
|
+
return;
|
|
4219
|
+
}
|
|
4220
|
+
const agents = await api.get("/agents");
|
|
4221
|
+
const found = agents.find((a) => a.code_name === options.agent);
|
|
4222
|
+
if (!found) {
|
|
4223
|
+
spinner.stop();
|
|
4224
|
+
error(`Agent "${options.agent}" not found.`);
|
|
4225
|
+
process.exitCode = 1;
|
|
4226
|
+
return;
|
|
4227
|
+
}
|
|
4228
|
+
agentId = found.agent_id;
|
|
4229
|
+
}
|
|
4230
|
+
let displayName = options.displayName;
|
|
4231
|
+
if (!displayName) {
|
|
4232
|
+
const defs = await api.get("/integrations/bindings");
|
|
4233
|
+
const def = defs.find((d) => d.slug === options.def);
|
|
4234
|
+
displayName = def?.name ?? options.def;
|
|
4235
|
+
}
|
|
4236
|
+
const result = await api.post("/integrations", {
|
|
4237
|
+
scope: apiScope,
|
|
4238
|
+
definition_id: options.def,
|
|
4239
|
+
display_name: displayName,
|
|
4240
|
+
auth_type: authType,
|
|
4241
|
+
credentials,
|
|
4242
|
+
config: {},
|
|
4243
|
+
...agentId ? { agent_id: agentId } : {}
|
|
4244
|
+
});
|
|
4245
|
+
spinner.stop();
|
|
4246
|
+
const row = result.integration;
|
|
4247
|
+
if (json) {
|
|
4248
|
+
jsonOutput({ integration: row });
|
|
4249
|
+
return;
|
|
4250
|
+
}
|
|
4251
|
+
success(`Enrolled "${displayName}" (${options.def}) at ${apiScope} scope`);
|
|
4252
|
+
info(`Integration ID: ${row.id}`);
|
|
4253
|
+
info(`Status: ${row.status}`);
|
|
4254
|
+
} catch (err) {
|
|
4255
|
+
spinner.stop();
|
|
4256
|
+
handleError(err);
|
|
4257
|
+
}
|
|
4258
|
+
}
|
|
4185
4259
|
function handleError(err) {
|
|
4186
4260
|
if (err instanceof ApiError) {
|
|
4187
4261
|
error(`API error (${err.status}): ${err.message}`);
|
|
@@ -4192,7 +4266,7 @@ function handleError(err) {
|
|
|
4192
4266
|
}
|
|
4193
4267
|
|
|
4194
4268
|
// src/bin/agt.ts
|
|
4195
|
-
var cliVersion2 = true ? "0.19.
|
|
4269
|
+
var cliVersion2 = true ? "0.19.21" : "dev";
|
|
4196
4270
|
var program = new Command();
|
|
4197
4271
|
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
4272
|
program.hook("preAction", (thisCommand) => {
|
|
@@ -4274,6 +4348,7 @@ integration.command("uninstall <slug>").description("Remove an integration from
|
|
|
4274
4348
|
integration.command("requests").description("List pending scope approval requests for the team").action(integrationRequestsCommand);
|
|
4275
4349
|
integration.command("approve <request-id>").description("Approve a scope request").option("--notes <text>", "Review notes").action(integrationApproveCommand);
|
|
4276
4350
|
integration.command("deny <request-id>").description("Deny a scope request").option("--reason <text>", "Denial reason").action(integrationDenyCommand);
|
|
4351
|
+
integration.command("enrol").description("Enrol an integration with an API key or webhook secret (no OAuth flow)").requiredOption("--def <code-name>", "Integration definition code_name (e.g. resend, xero)").requiredOption("--scope <org|team|agent>", "Install scope").option("--api-key <value>", "API key (sets auth_type=api_key)").option("--access-token <value>", "Bearer access token (sets auth_type=oauth2)").option("--webhook-secret <value>", "Webhook signing secret (sets auth_type=webhook)").option("--display-name <name>", "Override display name (defaults to the definition\u2019s display_name)").option("--agent <code-name>", "Agent code name (required for agent scope)").action(integrationEnrolCommand);
|
|
4277
4352
|
program.command("update").description("Check for and install CLI updates").option("--force", "Update even if manager or agent sessions are running").action(updateCommand);
|
|
4278
4353
|
var skipUpdateCheck = process.argv.includes("--skip-update-check") || process.argv.includes("--json") || process.argv[2] === "update";
|
|
4279
4354
|
if (!skipUpdateCheck) {
|