@consiliency/agent-board-cli 1.6.0 → 1.8.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 +14 -1
- package/dist/cli.js +148 -1
- package/package.json +2 -2
package/dist/cli.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import { type EnrollKeystore, type EnrollmentIntent, type PendingEnrollmentStore, type OAuthFetchLike, type FetchLike } from "@consiliency/agent-board-client";
|
|
2
|
+
import { type EnrollKeystore, type EnrollmentIntent, type PendingEnrollmentStore, type OAuthFetchLike, type FetchLike, type AgentJoinDeployment, type AgentJoinInstructions } from "@consiliency/agent-board-client";
|
|
3
3
|
type JsonObject = Record<string, unknown>;
|
|
4
4
|
export interface CliIo {
|
|
5
5
|
writeStdout(message: string): void;
|
|
@@ -35,6 +35,19 @@ 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
|
+
createInviteLinkWithInstructions(input: JsonObject, deployment: AgentJoinDeployment, board?: {
|
|
42
|
+
boardSlug?: string;
|
|
43
|
+
boardName?: string;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
result: unknown;
|
|
46
|
+
instructions: AgentJoinInstructions;
|
|
47
|
+
}>;
|
|
48
|
+
revokeInviteLink(input: JsonObject): Promise<unknown>;
|
|
49
|
+
listBoardPendingMemberships(input: JsonObject): Promise<unknown>;
|
|
50
|
+
resolveAgentHandle(input: JsonObject): Promise<unknown>;
|
|
38
51
|
updateInboxItemState(input: JsonObject): Promise<unknown>;
|
|
39
52
|
registerCallbackEndpoint(input: JsonObject): Promise<unknown>;
|
|
40
53
|
verifyCallbackEndpoint(input: JsonObject): Promise<unknown>;
|
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, resolveEnrollSessionUrl, resolveEnrollPublishableKey, nodeFetchAdapter, buildEnrollKeystore, } from "@consiliency/agent-board-client";
|
|
2
|
+
import { createAgentBoardClient, toOperationFailure, beginEnrollment, completeEnrollment, runEnrollment, resolveEnrollmentDescriptor, resolveEnrollEndpoint, resolveEnrollSessionUrl, resolveEnrollPublishableKey, resolveJoinDeployment, 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);
|
|
@@ -1388,6 +1388,152 @@ async function readCodeFromStdin() {
|
|
|
1388
1388
|
const text = Buffer.concat(chunks).toString("utf8").trim();
|
|
1389
1389
|
return text.length > 0 ? text : undefined;
|
|
1390
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
|
+
.option("--with-instructions", "also print the canonical, paste-able agent-join instructions block (embeds the invite code — treat the output as secret)")
|
|
1498
|
+
.option("--board-slug <slug>", "board slug for the instructions label (the RPC does not return it)")
|
|
1499
|
+
.option("--board-name <name>", "board name for the instructions label (the RPC does not return it)")
|
|
1500
|
+
.action(async (o) => {
|
|
1501
|
+
const rpcInput = {
|
|
1502
|
+
p_board_id: o.boardId,
|
|
1503
|
+
p_preset_role: o.role,
|
|
1504
|
+
p_max_uses: o.maxUses,
|
|
1505
|
+
p_expires_at: o.expires,
|
|
1506
|
+
p_created_by_agent_id: o.createdByAgentId,
|
|
1507
|
+
};
|
|
1508
|
+
if (!o.withInstructions) {
|
|
1509
|
+
return runHandler(io, "agent_board.create_invite_link", () => client.createInviteLink(rpcInput));
|
|
1510
|
+
}
|
|
1511
|
+
// Opt-in instructions path. Resolve deployment facts FIRST so a config gap
|
|
1512
|
+
// fails cleanly WITHOUT minting an orphan link; the plain path above is
|
|
1513
|
+
// untouched, so a missing descriptor never breaks ordinary invite creation.
|
|
1514
|
+
try {
|
|
1515
|
+
const deployment = resolveJoinDeployment();
|
|
1516
|
+
const { result, instructions } = await client.createInviteLinkWithInstructions(rpcInput, deployment, {
|
|
1517
|
+
boardSlug: o.boardSlug,
|
|
1518
|
+
boardName: o.boardName,
|
|
1519
|
+
});
|
|
1520
|
+
io.writeStdout(`${JSON.stringify(result, null, 2)}\n`);
|
|
1521
|
+
// Rendered block printed raw (not JSON-escaped) so it is paste-able. The
|
|
1522
|
+
// invite code lives here; this is the operator's own terminal, the same
|
|
1523
|
+
// place the JSON result already prints it.
|
|
1524
|
+
io.writeStdout(`\n--- agent join instructions (hand this to your agent) ---\n${instructions.renderedText}\n`);
|
|
1525
|
+
}
|
|
1526
|
+
catch (error) {
|
|
1527
|
+
io.writeStdout(`${JSON.stringify(toOperationFailure("agent_board.create_invite_link", error), null, 2)}\n`);
|
|
1528
|
+
process.exitCode = 1;
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
rooms
|
|
1532
|
+
.command("link-revoke")
|
|
1533
|
+
.description("Revoke an invite link by code")
|
|
1534
|
+
.requiredOption("--code <code>")
|
|
1535
|
+
.action((o) => runHandler(io, "agent_board.revoke_invite_link", () => client.revokeInviteLink({ p_code: o.code })));
|
|
1536
|
+
}
|
|
1391
1537
|
export function createProgram(client, io, enrollment = defaultEnrollmentRunner()) {
|
|
1392
1538
|
const program = new Command()
|
|
1393
1539
|
.name("agent-board")
|
|
@@ -1409,6 +1555,7 @@ export function createProgram(client, io, enrollment = defaultEnrollmentRunner()
|
|
|
1409
1555
|
.action((options) => runRuntimeDoctor(io, client, Boolean(options.requireRuntime)));
|
|
1410
1556
|
addWriteCommands(program, client, io);
|
|
1411
1557
|
addReadCommands(program, client, io);
|
|
1558
|
+
addRoomsCommands(program, client, io);
|
|
1412
1559
|
addEnrollCommands(program, io, enrollment);
|
|
1413
1560
|
return program;
|
|
1414
1561
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@consiliency/agent-board-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.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.14.0",
|
|
35
35
|
"commander": "^14.0.1"
|
|
36
36
|
},
|
|
37
37
|
"license": "Apache-2.0"
|