@acnlabs/acn-cli 0.8.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.
- package/dist/index.js +44 -0
- 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
|
|