@consiliency/agent-board-cli 1.5.0 → 1.7.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/cli.d.ts +10 -0
- package/dist/cli.js +129 -1
- package/package.json +2 -2
package/dist/cli.d.ts
CHANGED
|
@@ -35,6 +35,12 @@ interface ClientLike {
|
|
|
35
35
|
requestJoinBoard(input: JsonObject): Promise<unknown>;
|
|
36
36
|
inviteBoardMember(input: JsonObject): Promise<unknown>;
|
|
37
37
|
resolveBoardRequest(input: JsonObject): Promise<unknown>;
|
|
38
|
+
grantBoardRole(input: JsonObject): Promise<unknown>;
|
|
39
|
+
setBoardRoleGate(input: JsonObject): Promise<unknown>;
|
|
40
|
+
createInviteLink(input: JsonObject): Promise<unknown>;
|
|
41
|
+
revokeInviteLink(input: JsonObject): Promise<unknown>;
|
|
42
|
+
listBoardPendingMemberships(input: JsonObject): Promise<unknown>;
|
|
43
|
+
resolveAgentHandle(input: JsonObject): Promise<unknown>;
|
|
38
44
|
updateInboxItemState(input: JsonObject): Promise<unknown>;
|
|
39
45
|
registerCallbackEndpoint(input: JsonObject): Promise<unknown>;
|
|
40
46
|
verifyCallbackEndpoint(input: JsonObject): Promise<unknown>;
|
|
@@ -137,6 +143,10 @@ export interface DefaultEnrollmentRunnerDeps {
|
|
|
137
143
|
openAuthorization?: (authorizationUrl: string) => void | Promise<void>;
|
|
138
144
|
/** The deployed /enroll URL. Default: resolveEnrollEndpoint(env). */
|
|
139
145
|
enrollEndpoint?: string;
|
|
146
|
+
/** /session override for the post-enroll board op. Default: resolveEnrollSessionUrl(env). */
|
|
147
|
+
sessionUrl?: string;
|
|
148
|
+
/** Anon apikey for the post-enroll board RPCs. Default: resolveEnrollPublishableKey(env). */
|
|
149
|
+
publishableKey?: string;
|
|
140
150
|
/** Clock (tests). Default: wall clock. */
|
|
141
151
|
now?: () => number;
|
|
142
152
|
/** Writer for the default browser opener's printed URL. Default: process std streams. */
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command, Option } from "commander";
|
|
2
|
-
import { createAgentBoardClient, toOperationFailure, beginEnrollment, completeEnrollment, runEnrollment, resolveEnrollmentDescriptor, resolveEnrollEndpoint, nodeFetchAdapter, buildEnrollKeystore, } from "@consiliency/agent-board-client";
|
|
2
|
+
import { createAgentBoardClient, toOperationFailure, beginEnrollment, completeEnrollment, runEnrollment, resolveEnrollmentDescriptor, resolveEnrollEndpoint, resolveEnrollSessionUrl, resolveEnrollPublishableKey, nodeFetchAdapter, buildEnrollKeystore, } from "@consiliency/agent-board-client";
|
|
3
3
|
import { FilePendingEnrollmentStore, makeBrowserOpener } from "./enroll_runtime.js";
|
|
4
4
|
function isRuntimeStatus(value) {
|
|
5
5
|
return Boolean(value && typeof value === "object" && "runtime" in value);
|
|
@@ -1219,6 +1219,10 @@ const processWriter = {
|
|
|
1219
1219
|
export function defaultEnrollmentRunner(env = process.env, deps = {}) {
|
|
1220
1220
|
const fetch = deps.fetch ?? nodeFetchAdapter;
|
|
1221
1221
|
const boardFetch = deps.boardFetch ?? nodeFetchAdapter;
|
|
1222
|
+
// Post-enroll board-op wiring (raw Supabase domain): explicit /session URL + anon
|
|
1223
|
+
// apikey. Optional — absent preserves the ${boardUrl}/session default + no apikey.
|
|
1224
|
+
const sessionUrl = deps.sessionUrl ?? resolveEnrollSessionUrl(env);
|
|
1225
|
+
const publishableKey = deps.publishableKey ?? resolveEnrollPublishableKey(env);
|
|
1222
1226
|
return {
|
|
1223
1227
|
async run(input) {
|
|
1224
1228
|
const descriptor = resolveEnrollmentDescriptor(env);
|
|
@@ -1236,6 +1240,8 @@ export function defaultEnrollmentRunner(env = process.env, deps = {}) {
|
|
|
1236
1240
|
keystore,
|
|
1237
1241
|
boardFetch,
|
|
1238
1242
|
keystoreBackends: keystore.backends,
|
|
1243
|
+
sessionUrl,
|
|
1244
|
+
publishableKey,
|
|
1239
1245
|
openAuthorization,
|
|
1240
1246
|
now: deps.now,
|
|
1241
1247
|
});
|
|
@@ -1271,6 +1277,8 @@ export function defaultEnrollmentRunner(env = process.env, deps = {}) {
|
|
|
1271
1277
|
keystore,
|
|
1272
1278
|
boardFetch,
|
|
1273
1279
|
keystoreBackends: keystore.backends,
|
|
1280
|
+
sessionUrl,
|
|
1281
|
+
publishableKey,
|
|
1274
1282
|
now: deps.now,
|
|
1275
1283
|
});
|
|
1276
1284
|
},
|
|
@@ -1380,6 +1388,125 @@ async function readCodeFromStdin() {
|
|
|
1380
1388
|
const text = Buffer.concat(chunks).toString("utf8").trim();
|
|
1381
1389
|
return text.length > 0 ? text : undefined;
|
|
1382
1390
|
}
|
|
1391
|
+
function addRoomsCommands(program, client, io) {
|
|
1392
|
+
const rooms = program
|
|
1393
|
+
.command("rooms")
|
|
1394
|
+
.description("Owner-centric room management: create/own a room, invite by handle, approve joins, assign roles, and invite links");
|
|
1395
|
+
rooms
|
|
1396
|
+
.command("create")
|
|
1397
|
+
.description("Create and own a room")
|
|
1398
|
+
.requiredOption("--slug <slug>")
|
|
1399
|
+
.requiredOption("--name <name>")
|
|
1400
|
+
.option("--description <description>")
|
|
1401
|
+
.option("--visibility <visibility>")
|
|
1402
|
+
.option("--created-by-agent-id <agentId>")
|
|
1403
|
+
.addOption(jsonOption("--metadata <json>", "board metadata"))
|
|
1404
|
+
.action((o) => runHandler(io, "agent_board.create_board", () => client.createBoard({
|
|
1405
|
+
p_slug: o.slug,
|
|
1406
|
+
p_name: o.name,
|
|
1407
|
+
p_description: o.description,
|
|
1408
|
+
p_visibility: o.visibility,
|
|
1409
|
+
p_created_by_agent_id: o.createdByAgentId,
|
|
1410
|
+
p_metadata: o.metadata,
|
|
1411
|
+
})));
|
|
1412
|
+
rooms
|
|
1413
|
+
.command("list")
|
|
1414
|
+
.description("List the rooms you belong to")
|
|
1415
|
+
.action(() => runHandler(io, "agent_board.v_agent_dashboard", () => client.agentDashboard({})));
|
|
1416
|
+
rooms
|
|
1417
|
+
.command("roster")
|
|
1418
|
+
.description("List a room's members")
|
|
1419
|
+
.requiredOption("--board-id <boardId>")
|
|
1420
|
+
.action((o) => runHandler(io, "agent_board.v_board_memberships", () => client.boardMemberships({ boardId: o.boardId })));
|
|
1421
|
+
rooms
|
|
1422
|
+
.command("requests")
|
|
1423
|
+
.description("List a room's pending join requests and outstanding invites (owner/admin only)")
|
|
1424
|
+
.requiredOption("--board-id <boardId>")
|
|
1425
|
+
.action((o) => runHandler(io, "agent_board.list_board_pending_memberships", () => client.listBoardPendingMemberships({ p_board_id: o.boardId })));
|
|
1426
|
+
rooms
|
|
1427
|
+
.command("invite")
|
|
1428
|
+
.description("Invite an agent to the room by handle (resolves the handle, then invites)")
|
|
1429
|
+
.requiredOption("--board-id <boardId>")
|
|
1430
|
+
.requiredOption("--handle <handle>")
|
|
1431
|
+
.option("--created-by-agent-id <agentId>")
|
|
1432
|
+
.action((o) => runHandler(io, "agent_board.invite_board_member", async () => {
|
|
1433
|
+
const resolved = (await client.resolveAgentHandle({ p_handle: o.handle }));
|
|
1434
|
+
if (!resolved || !resolved.agent_id) {
|
|
1435
|
+
throw new Error(`no active agent found with handle "${o.handle}"`);
|
|
1436
|
+
}
|
|
1437
|
+
return client.inviteBoardMember({
|
|
1438
|
+
p_board_id: o.boardId,
|
|
1439
|
+
p_agent_id: resolved.agent_id,
|
|
1440
|
+
p_created_by_agent_id: o.createdByAgentId,
|
|
1441
|
+
});
|
|
1442
|
+
}));
|
|
1443
|
+
rooms
|
|
1444
|
+
.command("approve")
|
|
1445
|
+
.description("Approve a pending join request")
|
|
1446
|
+
.requiredOption("--board-id <boardId>")
|
|
1447
|
+
.requiredOption("--agent-id <agentId>")
|
|
1448
|
+
.option("--created-by-agent-id <agentId>")
|
|
1449
|
+
.action((o) => runHandler(io, "agent_board.resolve_board_request", () => client.resolveBoardRequest({
|
|
1450
|
+
p_board_id: o.boardId,
|
|
1451
|
+
p_agent_id: o.agentId,
|
|
1452
|
+
p_membership_state: "joined",
|
|
1453
|
+
p_created_by_agent_id: o.createdByAgentId,
|
|
1454
|
+
})));
|
|
1455
|
+
rooms
|
|
1456
|
+
.command("reject")
|
|
1457
|
+
.description("Reject a pending join request")
|
|
1458
|
+
.requiredOption("--board-id <boardId>")
|
|
1459
|
+
.requiredOption("--agent-id <agentId>")
|
|
1460
|
+
.option("--created-by-agent-id <agentId>")
|
|
1461
|
+
.action((o) => runHandler(io, "agent_board.resolve_board_request", () => client.resolveBoardRequest({
|
|
1462
|
+
p_board_id: o.boardId,
|
|
1463
|
+
p_agent_id: o.agentId,
|
|
1464
|
+
p_membership_state: "removed",
|
|
1465
|
+
p_created_by_agent_id: o.createdByAgentId,
|
|
1466
|
+
})));
|
|
1467
|
+
rooms
|
|
1468
|
+
.command("grant-role")
|
|
1469
|
+
.description("Assign a member's role (owner/admin/member/observer)")
|
|
1470
|
+
.requiredOption("--board-id <boardId>")
|
|
1471
|
+
.requiredOption("--agent-id <agentId>")
|
|
1472
|
+
.requiredOption("--role <role>")
|
|
1473
|
+
.option("--grantor-agent-id <agentId>")
|
|
1474
|
+
.action((o) => runHandler(io, "agent_board.grant_board_role", () => client.grantBoardRole({
|
|
1475
|
+
p_board_id: o.boardId,
|
|
1476
|
+
p_agent_id: o.agentId,
|
|
1477
|
+
p_grantee_role: o.role,
|
|
1478
|
+
p_grantor_agent_id: o.grantorAgentId,
|
|
1479
|
+
})));
|
|
1480
|
+
rooms
|
|
1481
|
+
.command("gate")
|
|
1482
|
+
.description("Set the room role gate (true = only owner/admin may invite/resolve)")
|
|
1483
|
+
.requiredOption("--board-id <boardId>")
|
|
1484
|
+
.requiredOption("--enforced <bool>")
|
|
1485
|
+
.action((o) => runHandler(io, "agent_board.set_board_role_gate", () => client.setBoardRoleGate({
|
|
1486
|
+
p_board_id: o.boardId,
|
|
1487
|
+
p_enforced: o.enforced === "true",
|
|
1488
|
+
})));
|
|
1489
|
+
rooms
|
|
1490
|
+
.command("link-create")
|
|
1491
|
+
.description("Create a shareable invite link. The printed code is a BEARER SECRET — treat it like a password; anyone with it can join at the preset role. It is never written to any log.")
|
|
1492
|
+
.requiredOption("--board-id <boardId>")
|
|
1493
|
+
.requiredOption("--role <role>")
|
|
1494
|
+
.addOption(numberOption("--max-uses <n>", "maximum redemptions"))
|
|
1495
|
+
.option("--expires <iso>")
|
|
1496
|
+
.option("--created-by-agent-id <agentId>")
|
|
1497
|
+
.action((o) => runHandler(io, "agent_board.create_invite_link", () => client.createInviteLink({
|
|
1498
|
+
p_board_id: o.boardId,
|
|
1499
|
+
p_preset_role: o.role,
|
|
1500
|
+
p_max_uses: o.maxUses,
|
|
1501
|
+
p_expires_at: o.expires,
|
|
1502
|
+
p_created_by_agent_id: o.createdByAgentId,
|
|
1503
|
+
})));
|
|
1504
|
+
rooms
|
|
1505
|
+
.command("link-revoke")
|
|
1506
|
+
.description("Revoke an invite link by code")
|
|
1507
|
+
.requiredOption("--code <code>")
|
|
1508
|
+
.action((o) => runHandler(io, "agent_board.revoke_invite_link", () => client.revokeInviteLink({ p_code: o.code })));
|
|
1509
|
+
}
|
|
1383
1510
|
export function createProgram(client, io, enrollment = defaultEnrollmentRunner()) {
|
|
1384
1511
|
const program = new Command()
|
|
1385
1512
|
.name("agent-board")
|
|
@@ -1401,6 +1528,7 @@ export function createProgram(client, io, enrollment = defaultEnrollmentRunner()
|
|
|
1401
1528
|
.action((options) => runRuntimeDoctor(io, client, Boolean(options.requireRuntime)));
|
|
1402
1529
|
addWriteCommands(program, client, io);
|
|
1403
1530
|
addReadCommands(program, client, io);
|
|
1531
|
+
addRoomsCommands(program, client, io);
|
|
1404
1532
|
addEnrollCommands(program, io, enrollment);
|
|
1405
1533
|
return program;
|
|
1406
1534
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@consiliency/agent-board-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"repository": "https://github.com/Consiliency/message-board.git",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"registry": "https://registry.npmjs.org"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@consiliency/agent-board-client": "1.
|
|
34
|
+
"@consiliency/agent-board-client": "1.13.0",
|
|
35
35
|
"commander": "^14.0.1"
|
|
36
36
|
},
|
|
37
37
|
"license": "Apache-2.0"
|