@integrity-labs/agt-cli 0.28.580 → 0.28.582

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
@@ -40,7 +40,7 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-YU2B3L6G.js";
43
+ } from "../chunk-XYWEC7PX.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -71,7 +71,7 @@ import {
71
71
  requiredMcpWildcard,
72
72
  resolveChannels,
73
73
  serializeManifestForSlackCli
74
- } from "../chunk-RC5YRTZU.js";
74
+ } from "../chunk-RDBPQZVG.js";
75
75
  import "../chunk-XWVM4KPK.js";
76
76
 
77
77
  // src/bin/agt.ts
@@ -951,6 +951,19 @@ Channel Resolution: ${agentCodeName}
951
951
  import chalk6 from "chalk";
952
952
  import ora6 from "ora";
953
953
  import { checkbox as checkbox2, confirm as confirm2, input as input2 } from "@inquirer/prompts";
954
+
955
+ // src/lib/channel-config.ts
956
+ function unwrapChannelConfig(body) {
957
+ const row = body?.config ?? null;
958
+ if (!row) return { payload: null, status: null, exists: false };
959
+ return {
960
+ payload: row.config ?? null,
961
+ status: row.status ?? null,
962
+ exists: true
963
+ };
964
+ }
965
+
966
+ // src/commands/channel-slack.ts
954
967
  import { writeFile } from "fs/promises";
955
968
  import { join as join5 } from "path";
956
969
  import { tmpdir } from "os";
@@ -1128,6 +1141,14 @@ async function channelSlackSetupCommand(agentCodeName, options) {
1128
1141
  process.exitCode = 1;
1129
1142
  }
1130
1143
  }
1144
+ function reportSlackNotConfigured(agentCodeName, json) {
1145
+ if (json) {
1146
+ jsonOutput({ ok: true, agent: agentCodeName, channel: "slack", configured: false });
1147
+ } else {
1148
+ warn(`No Slack configuration found for "${agentCodeName}".`);
1149
+ info("Run `agt channels slack setup " + agentCodeName + "` to configure.");
1150
+ }
1151
+ }
1131
1152
  async function channelSlackStatusCommand(agentCodeName) {
1132
1153
  const teamSlug = requireTeam();
1133
1154
  if (!teamSlug) return;
@@ -1135,9 +1156,15 @@ async function channelSlackStatusCommand(agentCodeName) {
1135
1156
  const spinner = ora6({ text: `Fetching Slack config for "${agentCodeName}"\u2026`, isSilent: json });
1136
1157
  spinner.start();
1137
1158
  try {
1138
- const data = await api.get(`/agents/${encodeURIComponent(agentCodeName)}/channel-configs/slack`);
1159
+ const data = await api.get(
1160
+ `/agents/${encodeURIComponent(agentCodeName)}/channel-configs/slack`
1161
+ );
1139
1162
  spinner.stop();
1140
- const config = data.config;
1163
+ const { payload: config } = unwrapChannelConfig(data);
1164
+ if (config === null) {
1165
+ reportSlackNotConfigured(agentCodeName, json);
1166
+ return;
1167
+ }
1141
1168
  if (json) {
1142
1169
  jsonOutput({
1143
1170
  ok: true,
@@ -1163,12 +1190,7 @@ Slack Configuration: ${agentCodeName}
1163
1190
  } catch (err) {
1164
1191
  spinner.stop();
1165
1192
  if (err.status === 404) {
1166
- if (json) {
1167
- jsonOutput({ ok: true, agent: agentCodeName, channel: "slack", configured: false });
1168
- } else {
1169
- warn(`No Slack configuration found for "${agentCodeName}".`);
1170
- info("Run `agt channels slack setup " + agentCodeName + "` to configure.");
1171
- }
1193
+ reportSlackNotConfigured(agentCodeName, json);
1172
1194
  return;
1173
1195
  }
1174
1196
  spinner.fail("Failed to fetch Slack status.");
@@ -1189,8 +1211,10 @@ async function channelSlackRemoveCommand(agentCodeName) {
1189
1211
  try {
1190
1212
  let config = null;
1191
1213
  try {
1192
- const data = await api.get(`/agents/${encodeURIComponent(agentCodeName)}/channel-configs/slack`);
1193
- config = data.config;
1214
+ const data = await api.get(
1215
+ `/agents/${encodeURIComponent(agentCodeName)}/channel-configs/slack`
1216
+ );
1217
+ config = unwrapChannelConfig(data).payload;
1194
1218
  } catch (err) {
1195
1219
  if (err.status === 404) {
1196
1220
  spinner.info(`No Slack configuration found for "${agentCodeName}".`);
@@ -1256,19 +1280,48 @@ async function channelBeamSetupCommand(agentCodeName, options) {
1256
1280
  return;
1257
1281
  }
1258
1282
  spinner.succeed(`Found agent "${agentCodeName}"`);
1259
- const existingConfig = await api.get(`/agents/${encodeURIComponent(agentCodeName)}/channel-configs/beam`).catch(() => ({ config: null }));
1260
- if (existingConfig.config?.beam_id) {
1261
- info(`Agent already has Beam identity: ${chalk7.cyan(String(existingConfig.config.beam_id))}`);
1262
- const proceed = await confirm3({
1263
- message: "Regenerate identity? This will create a new keypair and re-register.",
1264
- default: false
1265
- });
1266
- if (!proceed) return;
1283
+ let existing = null;
1284
+ try {
1285
+ existing = await api.get(
1286
+ `/agents/${encodeURIComponent(agentCodeName)}/channel-configs/beam`
1287
+ );
1288
+ } catch (err) {
1289
+ const message = err instanceof Error ? err.message : String(err);
1290
+ if (!/\b404\b|not found/i.test(message)) {
1291
+ spinner.fail("Could not check for an existing Beam identity");
1292
+ error(`${message}
1293
+
1294
+ Refusing to continue: overwriting an identity you cannot see is not safe.`);
1295
+ process.exitCode = 1;
1296
+ return;
1297
+ }
1298
+ }
1299
+ const existingBeam = unwrapChannelConfig(existing).payload;
1300
+ let regenerating = false;
1301
+ if (existingBeam?.beam_id) {
1302
+ regenerating = true;
1303
+ info(`Agent already has Beam identity: ${chalk7.cyan(String(existingBeam.beam_id))}`);
1304
+ if (json) {
1305
+ if (!options.force) {
1306
+ spinner.stop();
1307
+ error("Agent already has a Beam identity. Re-run with --force to regenerate it.");
1308
+ process.exitCode = 1;
1309
+ return;
1310
+ }
1311
+ } else {
1312
+ const proceed = await confirm3({
1313
+ message: "Regenerate identity? This creates a NEW keypair; the current one stops working.",
1314
+ default: false
1315
+ });
1316
+ if (!proceed) return;
1317
+ }
1267
1318
  }
1268
1319
  spinner.start("Generating Ed25519 identity and registering with Beam directory\u2026");
1269
- const result = await api.post(`/agents/${encodeURIComponent(agentCodeName)}/channel-configs/beam/setup`, {
1320
+ const result = await api.post("/channels/beam/create", {
1321
+ agent_id: agent2.agent_id,
1270
1322
  auto_publish_capabilities: options.autoPublish ?? true,
1271
- directory_url: options.directoryUrl
1323
+ directory_url: options.directoryUrl,
1324
+ force: regenerating
1272
1325
  });
1273
1326
  if (!result.ok) {
1274
1327
  spinner.fail("Registration failed");
@@ -1314,13 +1367,15 @@ async function channelBeamStatusCommand(agentCodeName) {
1314
1367
  const spinner = ora7({ text: `Fetching Beam config for "${agentCodeName}"\u2026`, isSilent: json });
1315
1368
  spinner.start();
1316
1369
  try {
1317
- const data = await api.get(`/agents/${encodeURIComponent(agentCodeName)}/channel-configs/beam`);
1318
- if (!data.config?.beam_id) {
1370
+ const data = await api.get(
1371
+ `/agents/${encodeURIComponent(agentCodeName)}/channel-configs/beam`
1372
+ );
1373
+ const { payload: cfg, status: rowStatus } = unwrapChannelConfig(data);
1374
+ if (!cfg?.beam_id) {
1319
1375
  spinner.info("No Beam identity configured for this agent.");
1320
1376
  return;
1321
1377
  }
1322
1378
  spinner.succeed("Beam configuration found");
1323
- const cfg = data.config;
1324
1379
  if (json) {
1325
1380
  jsonOutput(cfg);
1326
1381
  return;
@@ -1336,7 +1391,7 @@ async function channelBeamStatusCommand(agentCodeName) {
1336
1391
  ["Verification", String(cfg.verification_tier ?? "basic")],
1337
1392
  ["Auto-publish", cfg.auto_publish_capabilities ? chalk7.green("yes") : chalk7.dim("no")],
1338
1393
  ["Capabilities", Array.isArray(cfg.published_capabilities) && cfg.published_capabilities.length > 0 ? cfg.published_capabilities.join(", ") : chalk7.dim("none")],
1339
- ["Status", data.status ?? "\u2014"]
1394
+ ["Status", rowStatus ?? "\u2014"]
1340
1395
  ]
1341
1396
  );
1342
1397
  console.log();
@@ -4853,7 +4908,7 @@ import { execFileSync, execSync } from "child_process";
4853
4908
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4854
4909
  import chalk18 from "chalk";
4855
4910
  import ora16 from "ora";
4856
- var cliVersion = true ? "0.28.580" : "dev";
4911
+ var cliVersion = true ? "0.28.582" : "dev";
4857
4912
  async function fetchLatestVersion() {
4858
4913
  const host2 = getHost();
4859
4914
  if (!host2) return null;
@@ -6031,7 +6086,7 @@ function handleError(err) {
6031
6086
  }
6032
6087
 
6033
6088
  // src/bin/agt.ts
6034
- var cliVersion2 = true ? "0.28.580" : "dev";
6089
+ var cliVersion2 = true ? "0.28.582" : "dev";
6035
6090
  var program = new Command();
6036
6091
  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");
6037
6092
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -6108,7 +6163,7 @@ slack.command("setup <agent-code-name>").description("Configure Slack bot scopes
6108
6163
  slack.command("status <agent-code-name>").description("Show current Slack configuration for an agent").action(channelSlackStatusCommand);
6109
6164
  slack.command("remove <agent-code-name>").description("Remove Slack bot configuration for an agent").action(channelSlackRemoveCommand);
6110
6165
  var beam = channels.command("beam").description("Manage Beam Protocol channel configuration");
6111
- beam.command("setup <agent-code-name>").description("Generate Beam identity, register in directory, and configure channel").option("--directory-url <url>", "Beam directory URL (default: hosted)").option("--skip-register", "Skip directory registration").option("--auto-publish", "Auto-publish capabilities from TOOLS.md", true).action(channelBeamSetupCommand);
6166
+ beam.command("setup <agent-code-name>").description("Generate Beam identity, register in directory, and configure channel").option("--directory-url <url>", "Beam directory URL (default: hosted)").option("--skip-register", "Skip directory registration").option("--auto-publish", "Auto-publish capabilities from TOOLS.md", true).option("--force", "Replace an existing Beam identity (generates a NEW keypair)").action(channelBeamSetupCommand);
6112
6167
  beam.command("status <agent-code-name>").description("Show Beam configuration and directory status").action(channelBeamStatusCommand);
6113
6168
  beam.command("remove <agent-code-name>").description("Remove Beam identity for an agent").action(channelBeamRemoveCommand);
6114
6169
  program.command("provision <code-name>").description("Provision an agent: build config, generate files, store snapshot").option("--target <target>", "Deployment target", "local_docker").option("--output <dir>", "Output directory for generated files").option("--dry-run", "Print what would be generated without writing files").action(provisionCommand);