@acnlabs/acn-cli 0.7.0 → 0.9.0

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.
Files changed (2) hide show
  1. package/dist/index.js +87 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1210,6 +1210,11 @@ function formatSubnet(s, index) {
1210
1210
  if (s.owner) lines.push(` Owner : ${s.owner}`);
1211
1211
  if (s.description) lines.push(` Desc : ${s.description}`);
1212
1212
  if (s.created_at) lines.push(` Since : ${s.created_at}`);
1213
+ if (s.harness_registered) {
1214
+ lines.push(` Harness: ${s.harness_url ?? "(registered)"}`);
1215
+ } else {
1216
+ lines.push(` Harness: none`);
1217
+ }
1213
1218
  return lines.join("\n");
1214
1219
  }
1215
1220
  function subnetCommand() {
@@ -1330,6 +1335,45 @@ ${JSON.stringify(res.agents, null, 2)}`);
1330
1335
  handleError(err);
1331
1336
  }
1332
1337
  });
1338
+ const harness = new import_commander10.Command("harness").description("Manage Org Harness webhook for a subnet");
1339
+ harness.command("set <subnet_id>").description("Register an Org Harness webhook on a subnet you own").requiredOption("--url <url>", "Harness webhook URL (HTTPS)").option("--secret <secret>", "HMAC-SHA256 signing secret (recommended)").action(async (subnetId, opts) => {
1340
+ const config = loadConfig();
1341
+ if (!config.api_key) {
1342
+ console.error("No API key found. Run `acn join` first.");
1343
+ process.exit(1);
1344
+ }
1345
+ try {
1346
+ const res = await acnPatch(`/subnets/${subnetId}/harness`, {
1347
+ harness_url: opts.url,
1348
+ harness_secret: opts.secret ?? null
1349
+ });
1350
+ const lines = [
1351
+ `Harness registered on subnet ${res.subnet_id}`,
1352
+ ` URL : ${res.harness_url}`,
1353
+ ` Signed : ${opts.secret ? "yes (HMAC-SHA256)" : "no (unsigned)"}`
1354
+ ];
1355
+ output(res, lines.join("\n"));
1356
+ } catch (err) {
1357
+ handleError(err);
1358
+ }
1359
+ });
1360
+ harness.command("clear <subnet_id>").description("Unregister the Org Harness from a subnet you own").action(async (subnetId) => {
1361
+ const config = loadConfig();
1362
+ if (!config.api_key) {
1363
+ console.error("No API key found. Run `acn join` first.");
1364
+ process.exit(1);
1365
+ }
1366
+ try {
1367
+ const res = await acnPatch(`/subnets/${subnetId}/harness`, {
1368
+ harness_url: null,
1369
+ harness_secret: null
1370
+ });
1371
+ output(res, `Harness unregistered from subnet ${res.subnet_id}`);
1372
+ } catch (err) {
1373
+ handleError(err);
1374
+ }
1375
+ });
1376
+ cmd.addCommand(harness);
1333
1377
  return cmd;
1334
1378
  }
1335
1379
 
@@ -1684,8 +1728,9 @@ function requireAgentId7() {
1684
1728
  return config.agent_id;
1685
1729
  }
1686
1730
  function payCommand() {
1687
- const cmd = new import_commander13.Command("pay").description("Create a payment task to another agent");
1688
- cmd.requiredOption("--to <agent>", "Recipient agent ID").requiredOption("--amount <n>", "Payment amount (positive number)").requiredOption("--currency <c>", "Currency code, e.g. USD, USDC").requiredOption("--method <m>", "Payment method, e.g. usdc, eth, platform_credits").requiredOption("--network <n>", "Network, e.g. ethereum, base, solana").option("--description <text>", "Free-text description for the payment task").option("--metadata <json>", "Additional metadata as JSON object").action(
1731
+ const cmd = new import_commander13.Command("pay").description("Manage payment tasks between agents");
1732
+ const createCmd = new import_commander13.Command("create").description("Create a payment task to another agent");
1733
+ createCmd.requiredOption("--to <agent>", "Recipient agent ID").requiredOption("--amount <n>", "Payment amount (positive number)").requiredOption("--currency <c>", "Currency code, e.g. USD, USDC").requiredOption("--method <m>", "Payment method, e.g. usdc, eth, platform_credits").requiredOption("--network <n>", "Network, e.g. ethereum, base, solana").option("--description <text>", "Free-text description for the payment task").option("--metadata <json>", "Additional metadata as JSON object").action(
1689
1734
  async (opts) => {
1690
1735
  const fromAgent = requireAgentId7();
1691
1736
  const amount = Number(opts.amount);
@@ -1730,6 +1775,46 @@ function payCommand() {
1730
1775
  }
1731
1776
  }
1732
1777
  );
1778
+ const confirmCmd = new import_commander13.Command("confirm").description(
1779
+ "Confirm an external payment has been made (buyer only)"
1780
+ );
1781
+ confirmCmd.requiredOption("--task-id <id>", "Payment task ID to confirm").requiredOption(
1782
+ "--tx-hash <hash>",
1783
+ "On-chain transaction hash or external payment reference (e.g. Stripe charge ID)"
1784
+ ).action(async (opts) => {
1785
+ try {
1786
+ const res = await acnPost(
1787
+ `/payments/tasks/${opts.taskId}/confirm`,
1788
+ { tx_hash: opts.txHash }
1789
+ );
1790
+ output(
1791
+ res,
1792
+ `Payment confirmed: ${res.task_id}
1793
+ status : ${res.status}
1794
+ tx_hash: ${res.tx_hash}`
1795
+ );
1796
+ } catch (err) {
1797
+ handleError(err);
1798
+ }
1799
+ });
1800
+ const statusCmd = new import_commander13.Command("status").description(
1801
+ "Show payment tasks for the authenticated agent"
1802
+ );
1803
+ statusCmd.option("--status <s>", "Filter by status (e.g. created, payment_confirmed)").option("--limit <n>", "Max results (default 50)", "50").action(async (opts) => {
1804
+ const agentId = requireAgentId7();
1805
+ try {
1806
+ const res = await acnGet(
1807
+ `/payments/tasks/agent/${agentId}`,
1808
+ { status: opts.status, limit: Number(opts.limit) }
1809
+ );
1810
+ output(res, `${res.tasks.length} payment task(s) for ${res.agent_id}`);
1811
+ } catch (err) {
1812
+ handleError(err);
1813
+ }
1814
+ });
1815
+ cmd.addCommand(createCmd);
1816
+ cmd.addCommand(confirmCmd);
1817
+ cmd.addCommand(statusCmd);
1733
1818
  return cmd;
1734
1819
  }
1735
1820
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acnlabs/acn-cli",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Official CLI for ACN (Agent Collaboration Network) — zero-integration agent access",
5
5
  "main": "dist/index.js",
6
6
  "bin": {