@consiliency/agent-board-cli 1.2.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.js ADDED
@@ -0,0 +1,1239 @@
1
+ import { Command, Option } from "commander";
2
+ import { createAgentBoardClient, toOperationFailure, } from "@consiliency/agent-board-client";
3
+ function isRuntimeStatus(value) {
4
+ return Boolean(value && typeof value === "object" && "runtime" in value);
5
+ }
6
+ function parseJson(value) {
7
+ if (!value) {
8
+ return undefined;
9
+ }
10
+ return JSON.parse(value);
11
+ }
12
+ function numberOption(flags, description) {
13
+ return new Option(flags, description).argParser((value) => Number(value));
14
+ }
15
+ async function runHandler(io, operation, action) {
16
+ try {
17
+ const result = await action();
18
+ io.writeStdout(`${JSON.stringify(result, null, 2)}\n`);
19
+ }
20
+ catch (error) {
21
+ io.writeStdout(`${JSON.stringify(toOperationFailure(operation, error), null, 2)}\n`);
22
+ process.exitCode = 1;
23
+ }
24
+ }
25
+ async function runJsonlHandler(io, operation, action) {
26
+ try {
27
+ io.writeStdout(`${JSON.stringify(await action())}\n`);
28
+ }
29
+ catch (error) {
30
+ io.writeStdout(`${JSON.stringify(toOperationFailure(operation, error))}\n`);
31
+ process.exitCode = 1;
32
+ }
33
+ }
34
+ function jsonOption(flags, description) {
35
+ return new Option(flags, description).argParser((value) => parseJson(value));
36
+ }
37
+ export function signingStatusFromEnv(env = process.env) {
38
+ const keyIdName = env.MESSAGE_BOARD_SIGNING_KEY_ID
39
+ ? "MESSAGE_BOARD_SIGNING_KEY_ID"
40
+ : env.AGENT_BOARD_SIGNING_KEY_ID
41
+ ? "AGENT_BOARD_SIGNING_KEY_ID"
42
+ : null;
43
+ const keyVersionName = env.MESSAGE_BOARD_SIGNING_KEY_VERSION
44
+ ? "MESSAGE_BOARD_SIGNING_KEY_VERSION"
45
+ : env.AGENT_BOARD_SIGNING_KEY_VERSION
46
+ ? "AGENT_BOARD_SIGNING_KEY_VERSION"
47
+ : null;
48
+ const fingerprintName = env.MESSAGE_BOARD_SIGNING_PUBLIC_KEY_FINGERPRINT
49
+ ? "MESSAGE_BOARD_SIGNING_PUBLIC_KEY_FINGERPRINT"
50
+ : env.AGENT_BOARD_SIGNING_PUBLIC_KEY_FINGERPRINT
51
+ ? "AGENT_BOARD_SIGNING_PUBLIC_KEY_FINGERPRINT"
52
+ : null;
53
+ const privateKeyName = env.MESSAGE_BOARD_SIGNING_PRIVATE_KEY
54
+ ? "MESSAGE_BOARD_SIGNING_PRIVATE_KEY"
55
+ : env.AGENT_BOARD_SIGNING_PRIVATE_KEY
56
+ ? "AGENT_BOARD_SIGNING_PRIVATE_KEY"
57
+ : null;
58
+ return {
59
+ ok: true,
60
+ operation: "agent_board.signing_status",
61
+ signing: {
62
+ mode: keyIdName && keyVersionName && privateKeyName ? "signed" : "unsigned_compatibility",
63
+ keyId: keyIdName ? env[keyIdName] : null,
64
+ keyVersion: keyVersionName ? Number(env[keyVersionName]) : null,
65
+ algorithm: "Ed25519",
66
+ publicKeyFingerprint: fingerprintName ? env[fingerprintName] : null,
67
+ privateKeySource: privateKeyName,
68
+ privateKeyAvailable: Boolean(privateKeyName),
69
+ canonicalizationVersion: "agent-provenance-jcs.v1",
70
+ redacted: true,
71
+ },
72
+ };
73
+ }
74
+ async function runRuntimeDoctor(io, client, requireRuntime) {
75
+ await runHandler(io, "agent_board.runtime_doctor", async () => {
76
+ const status = await client.runtimeStatus();
77
+ if (requireRuntime &&
78
+ isRuntimeStatus(status) &&
79
+ (!status.runtime?.ready || status.runtime.directFallback)) {
80
+ throw new Error(status.runtime?.fallbackReason ?? "missing_runtime");
81
+ }
82
+ return {
83
+ ...status,
84
+ operation: "agent_board.runtime_doctor",
85
+ };
86
+ });
87
+ }
88
+ function recipientOption(flags, description) {
89
+ return new Option(flags, description).argParser((value) => {
90
+ const parsed = parseJson(value);
91
+ if (!parsed) {
92
+ return undefined;
93
+ }
94
+ return parsed;
95
+ });
96
+ }
97
+ function addWriteCommands(program, client, io) {
98
+ program
99
+ .command("resolve-recipients")
100
+ .option("--actor-agent-id <agentId>")
101
+ .addOption(recipientOption("--recipients <json>", "recipient descriptors JSON array").makeOptionMandatory())
102
+ .action((options) => runHandler(io, "agent_board.resolve_recipients", () => client.resolveRecipients({
103
+ actorAgentId: options.actorAgentId,
104
+ recipients: options.recipients,
105
+ })));
106
+ program
107
+ .command("expand-recipients-dry-run")
108
+ .option("--actor-agent-id <agentId>")
109
+ .option("--thread-idempotency-key <key>")
110
+ .addOption(recipientOption("--recipients <json>", "recipient descriptors JSON array").makeOptionMandatory())
111
+ .action((options) => runHandler(io, "agent_board.expand_recipients_dry_run", () => client.expandRecipientsDryRun({
112
+ actorAgentId: options.actorAgentId,
113
+ recipients: options.recipients,
114
+ threadIdempotencyKey: options.threadIdempotencyKey,
115
+ })));
116
+ program
117
+ .command("create-or-find-thread")
118
+ .option("--created-by-agent-id <agentId>")
119
+ .requiredOption("--subject <subject>")
120
+ .requiredOption("--idempotency-key <key>")
121
+ .option("--thread-type <threadType>")
122
+ .addOption(jsonOption("--metadata <json>", "thread metadata"))
123
+ .action((options) => runHandler(io, "agent_board.create_or_find_thread", () => client.createOrFindThread({
124
+ createdByAgentId: options.createdByAgentId,
125
+ subject: options.subject,
126
+ idempotencyKey: options.idempotencyKey,
127
+ threadType: options.threadType,
128
+ metadata: options.metadata,
129
+ })));
130
+ const send = program.command("send").description("ergonomic send commands");
131
+ send
132
+ .command("direct")
133
+ .option("--thread-id <threadId>")
134
+ .option("--thread <json>")
135
+ .option("--author-agent-id <agentId>")
136
+ .addOption(recipientOption("--recipient <json>", "recipient descriptor").makeOptionMandatory())
137
+ .requiredOption("--subject <subject>")
138
+ .requiredOption("--body <body>")
139
+ .option("--message-type <messageType>")
140
+ .option("--priority <priority>")
141
+ .option("--idempotency-key <idempotencyKey>")
142
+ .option("--dry-run")
143
+ .addOption(jsonOption("--metadata <json>", "direct message metadata"))
144
+ .action((options) => runHandler(io, "agent_board.send_direct", () => client.sendDirect({
145
+ threadId: options.threadId,
146
+ thread: parseJson(options.thread),
147
+ authorAgentId: options.authorAgentId,
148
+ recipient: options.recipient,
149
+ subject: options.subject,
150
+ body: options.body,
151
+ messageType: options.messageType,
152
+ priority: options.priority,
153
+ idempotencyKey: options.idempotencyKey,
154
+ dryRun: Boolean(options.dryRun),
155
+ metadata: options.metadata,
156
+ })));
157
+ send
158
+ .command("multicast")
159
+ .option("--thread-id <threadId>")
160
+ .option("--thread <json>")
161
+ .option("--author-agent-id <agentId>")
162
+ .addOption(recipientOption("--recipients <json>", "recipient descriptors JSON array").makeOptionMandatory())
163
+ .requiredOption("--subject <subject>")
164
+ .requiredOption("--body <body>")
165
+ .option("--message-type <messageType>")
166
+ .option("--priority <priority>")
167
+ .option("--idempotency-key <idempotencyKey>")
168
+ .option("--dry-run")
169
+ .addOption(jsonOption("--metadata <json>", "multicast message metadata"))
170
+ .action((options) => runHandler(io, "agent_board.send_multicast", () => client.sendMulticast({
171
+ threadId: options.threadId,
172
+ thread: parseJson(options.thread),
173
+ authorAgentId: options.authorAgentId,
174
+ recipients: options.recipients,
175
+ subject: options.subject,
176
+ body: options.body,
177
+ messageType: options.messageType,
178
+ priority: options.priority,
179
+ idempotencyKey: options.idempotencyKey,
180
+ dryRun: Boolean(options.dryRun),
181
+ metadata: options.metadata,
182
+ })));
183
+ const post = program.command("post").description("ergonomic post commands");
184
+ post
185
+ .command("board")
186
+ .option("--thread-id <threadId>")
187
+ .option("--thread <json>")
188
+ .option("--author-agent-id <agentId>")
189
+ .option("--board-id <boardId>")
190
+ .option("--board-slug <boardSlug>")
191
+ .requiredOption("--subject <subject>")
192
+ .requiredOption("--body <body>")
193
+ .option("--message-type <messageType>")
194
+ .option("--priority <priority>")
195
+ .option("--idempotency-key <idempotencyKey>")
196
+ .addOption(jsonOption("--metadata <json>", "board post metadata"))
197
+ .action((options) => runHandler(io, "agent_board.post_board", () => client.postBoard({
198
+ threadId: options.threadId,
199
+ thread: parseJson(options.thread),
200
+ authorAgentId: options.authorAgentId,
201
+ boardId: options.boardId,
202
+ boardSlug: options.boardSlug,
203
+ subject: options.subject,
204
+ body: options.body,
205
+ messageType: options.messageType,
206
+ priority: options.priority,
207
+ idempotencyKey: options.idempotencyKey,
208
+ metadata: options.metadata,
209
+ })));
210
+ const create = program.command("create").description("ergonomic create commands");
211
+ create
212
+ .command("tasking")
213
+ .option("--thread-id <threadId>")
214
+ .option("--thread <json>")
215
+ .option("--author-agent-id <agentId>")
216
+ .addOption(recipientOption("--recipients <json>", "recipient descriptors JSON array"))
217
+ .option("--board-id <boardId>")
218
+ .option("--board-slug <boardSlug>")
219
+ .requiredOption("--title <title>")
220
+ .option("--details <details>")
221
+ .option("--priority <priority>")
222
+ .option("--orchestration-mode <orchestrationMode>")
223
+ .option("--idempotency-key <idempotencyKey>")
224
+ .option("--dry-run")
225
+ .addOption(jsonOption("--metadata <json>", "tasking metadata"))
226
+ .action((options) => runHandler(io, "agent_board.create_tasking", () => client.createTasking({
227
+ threadId: options.threadId,
228
+ thread: parseJson(options.thread),
229
+ authorAgentId: options.authorAgentId,
230
+ recipients: options.recipients,
231
+ boardId: options.boardId,
232
+ boardSlug: options.boardSlug,
233
+ subject: options.title,
234
+ title: options.title,
235
+ details: options.details,
236
+ priority: options.priority,
237
+ orchestrationMode: options.orchestrationMode,
238
+ idempotencyKey: options.idempotencyKey,
239
+ dryRun: Boolean(options.dryRun),
240
+ metadata: options.metadata,
241
+ })));
242
+ program
243
+ .command("register-agent")
244
+ .requiredOption("--agent-type <agentType>")
245
+ .requiredOption("--handle <handle>")
246
+ .requiredOption("--display-name <displayName>")
247
+ .option("--status <status>")
248
+ .addOption(jsonOption("--metadata <json>", "agent metadata"))
249
+ .action((options) => runHandler(io, "agent_board.register_agent", () => client.registerAgent({
250
+ p_agent_type: options.agentType,
251
+ p_handle: options.handle,
252
+ p_display_name: options.displayName,
253
+ p_status: options.status,
254
+ p_metadata: options.metadata,
255
+ })));
256
+ program
257
+ .command("heartbeat")
258
+ .option("--agent-id <agentId>")
259
+ .option("--thread-id <threadId>")
260
+ .option("--availability <availability>")
261
+ .option("--activity-summary <activitySummary>")
262
+ .option("--expires-in <expiresIn>")
263
+ .addOption(jsonOption("--metadata <json>", "heartbeat metadata"))
264
+ .action((options) => runHandler(io, "agent_board.heartbeat", () => client.heartbeat({
265
+ p_agent_id: options.agentId,
266
+ p_thread_id: options.threadId,
267
+ p_availability: options.availability,
268
+ p_activity_summary: options.activitySummary,
269
+ p_expires_in: options.expiresIn,
270
+ p_metadata: options.metadata,
271
+ })));
272
+ program
273
+ .command("create-thread")
274
+ .option("--created-by-agent-id <agentId>")
275
+ .requiredOption("--subject <subject>")
276
+ .option("--thread-type <threadType>")
277
+ .addOption(jsonOption("--metadata <json>", "thread metadata"))
278
+ .action((options) => runHandler(io, "agent_board.create_thread", () => client.createThread({
279
+ p_created_by_agent_id: options.createdByAgentId,
280
+ p_subject: options.subject,
281
+ p_thread_type: options.threadType,
282
+ p_metadata: options.metadata,
283
+ })));
284
+ program
285
+ .command("post-message")
286
+ .requiredOption("--thread-id <threadId>")
287
+ .option("--author-agent-id <agentId>")
288
+ .requiredOption("--body <body>")
289
+ .option("--message-type <messageType>")
290
+ .option("--task-id <taskId>")
291
+ .addOption(jsonOption("--metadata <json>", "message metadata"))
292
+ .action((options) => runHandler(io, "agent_board.post_message", () => client.postMessage({
293
+ p_thread_id: options.threadId,
294
+ p_author_agent_id: options.authorAgentId,
295
+ p_body: options.body,
296
+ p_message_type: options.messageType,
297
+ p_task_id: options.taskId,
298
+ p_metadata: options.metadata,
299
+ })));
300
+ program
301
+ .command("create-task")
302
+ .requiredOption("--thread-id <threadId>")
303
+ .option("--created-by-agent-id <agentId>")
304
+ .requiredOption("--title <title>")
305
+ .option("--details <details>")
306
+ .option("--assigned-agent-id <agentId>")
307
+ .option("--parent-task-id <taskId>")
308
+ .option("--priority <priority>")
309
+ .option("--orchestration-mode <orchestrationMode>")
310
+ .addOption(jsonOption("--metadata <json>", "task metadata"))
311
+ .action((options) => runHandler(io, "agent_board.create_task", () => client.createTask({
312
+ p_thread_id: options.threadId,
313
+ p_created_by_agent_id: options.createdByAgentId,
314
+ p_title: options.title,
315
+ p_details: options.details,
316
+ p_assigned_agent_id: options.assignedAgentId,
317
+ p_parent_task_id: options.parentTaskId,
318
+ p_priority: options.priority,
319
+ p_orchestration_mode: options.orchestrationMode,
320
+ p_metadata: options.metadata,
321
+ })));
322
+ program
323
+ .command("append-task-event")
324
+ .requiredOption("--task-id <taskId>")
325
+ .option("--actor-agent-id <agentId>")
326
+ .requiredOption("--event-type <eventType>")
327
+ .option("--status <status>")
328
+ .option("--assigned-agent-id <agentId>")
329
+ .option("--completed-at <completedAt>")
330
+ .addOption(jsonOption("--payload <json>", "event payload"))
331
+ .action((options) => runHandler(io, "agent_board.append_task_event", () => client.appendTaskEvent({
332
+ p_task_id: options.taskId,
333
+ p_actor_agent_id: options.actorAgentId,
334
+ p_event_type: options.eventType,
335
+ p_payload: options.payload,
336
+ p_status: options.status,
337
+ p_assigned_agent_id: options.assignedAgentId,
338
+ p_completed_at: options.completedAt,
339
+ })));
340
+ program
341
+ .command("acquire-claim")
342
+ .option("--agent-id <agentId>")
343
+ .requiredOption("--resource-kind <resourceKind>")
344
+ .requiredOption("--resource-key <resourceKey>")
345
+ .requiredOption("--lease-expires-at <leaseExpiresAt>")
346
+ .option("--task-id <taskId>")
347
+ .option("--thread-id <threadId>")
348
+ .addOption(jsonOption("--metadata <json>", "claim metadata"))
349
+ .action((options) => runHandler(io, "agent_board.acquire_claim", () => client.acquireClaim({
350
+ p_agent_id: options.agentId,
351
+ p_resource_kind: options.resourceKind,
352
+ p_resource_key: options.resourceKey,
353
+ p_lease_expires_at: options.leaseExpiresAt,
354
+ p_task_id: options.taskId,
355
+ p_thread_id: options.threadId,
356
+ p_metadata: options.metadata,
357
+ })));
358
+ program
359
+ .command("renew-claim")
360
+ .requiredOption("--lease-token <leaseToken>")
361
+ .requiredOption("--lease-expires-at <leaseExpiresAt>")
362
+ .action((options) => runHandler(io, "agent_board.renew_claim", () => client.renewClaim({
363
+ p_lease_token: options.leaseToken,
364
+ p_lease_expires_at: options.leaseExpiresAt,
365
+ })));
366
+ program
367
+ .command("release-claim")
368
+ .requiredOption("--lease-token <leaseToken>")
369
+ .action((options) => runHandler(io, "agent_board.release_claim", () => client.releaseClaim({
370
+ p_lease_token: options.leaseToken,
371
+ })));
372
+ program
373
+ .command("delegate-task")
374
+ .requiredOption("--parent-task-id <taskId>")
375
+ .option("--actor-agent-id <agentId>")
376
+ .requiredOption("--title <title>")
377
+ .option("--details <details>")
378
+ .option("--delegated-to-agent-id <agentId>")
379
+ .option("--priority <priority>")
380
+ .option("--note <note>")
381
+ .addOption(jsonOption("--metadata <json>", "delegation metadata"))
382
+ .action((options) => runHandler(io, "agent_board.delegate_task", () => client.delegateTask({
383
+ p_parent_task_id: options.parentTaskId,
384
+ p_actor_agent_id: options.actorAgentId,
385
+ p_title: options.title,
386
+ p_details: options.details,
387
+ p_delegated_to_agent_id: options.delegatedToAgentId,
388
+ p_priority: options.priority,
389
+ p_note: options.note,
390
+ p_metadata: options.metadata,
391
+ })));
392
+ program
393
+ .command("add-artifact")
394
+ .option("--created-by-agent-id <agentId>")
395
+ .requiredOption("--uri <uri>")
396
+ .option("--artifact-type <artifactType>")
397
+ .option("--storage-kind <storageKind>")
398
+ .option("--thread-id <threadId>")
399
+ .option("--task-id <taskId>")
400
+ .option("--message-id <messageId>")
401
+ .option("--task-event-id <taskEventId>")
402
+ .addOption(jsonOption("--metadata <json>", "artifact metadata"))
403
+ .action((options) => runHandler(io, "agent_board.add_artifact", () => client.addArtifact({
404
+ p_created_by_agent_id: options.createdByAgentId,
405
+ p_uri: options.uri,
406
+ p_artifact_type: options.artifactType,
407
+ p_storage_kind: options.storageKind,
408
+ p_thread_id: options.threadId,
409
+ p_task_id: options.taskId,
410
+ p_message_id: options.messageId,
411
+ p_task_event_id: options.taskEventId,
412
+ p_metadata: options.metadata,
413
+ })));
414
+ program
415
+ .command("raise-conflict")
416
+ .requiredOption("--thread-id <threadId>")
417
+ .option("--raised-by-agent-id <agentId>")
418
+ .requiredOption("--summary <summary>")
419
+ .option("--conflict-type <conflictType>")
420
+ .option("--severity <severity>")
421
+ .option("--task-id <taskId>")
422
+ .addOption(jsonOption("--details <json>", "conflict details"))
423
+ .action((options) => runHandler(io, "agent_board.raise_conflict", () => client.raiseConflict({
424
+ p_thread_id: options.threadId,
425
+ p_raised_by_agent_id: options.raisedByAgentId,
426
+ p_summary: options.summary,
427
+ p_conflict_type: options.conflictType,
428
+ p_severity: options.severity,
429
+ p_task_id: options.taskId,
430
+ p_details: options.details,
431
+ })));
432
+ program
433
+ .command("resolve-conflict")
434
+ .requiredOption("--conflict-id <conflictId>")
435
+ .option("--resolved-by-agent-id <agentId>")
436
+ .option("--task-id <taskId>")
437
+ .addOption(jsonOption("--details <json>", "resolution details"))
438
+ .action((options) => runHandler(io, "agent_board.resolve_conflict", () => client.resolveConflict({
439
+ p_conflict_id: options.conflictId,
440
+ p_resolved_by_agent_id: options.resolvedByAgentId,
441
+ p_task_id: options.taskId,
442
+ p_details: options.details,
443
+ })));
444
+ program
445
+ .command("raise-escalation")
446
+ .requiredOption("--thread-id <threadId>")
447
+ .option("--raised-by-agent-id <agentId>")
448
+ .requiredOption("--summary <summary>")
449
+ .option("--escalation-type <escalationType>")
450
+ .option("--severity <severity>")
451
+ .option("--task-id <taskId>")
452
+ .option("--assigned-agent-id <agentId>")
453
+ .addOption(jsonOption("--details <json>", "escalation details"))
454
+ .action((options) => runHandler(io, "agent_board.raise_escalation", () => client.raiseEscalation({
455
+ p_thread_id: options.threadId,
456
+ p_raised_by_agent_id: options.raisedByAgentId,
457
+ p_summary: options.summary,
458
+ p_escalation_type: options.escalationType,
459
+ p_severity: options.severity,
460
+ p_task_id: options.taskId,
461
+ p_assigned_agent_id: options.assignedAgentId,
462
+ p_details: options.details,
463
+ })));
464
+ program
465
+ .command("resolve-escalation")
466
+ .requiredOption("--escalation-id <escalationId>")
467
+ .option("--resolved-by-agent-id <agentId>")
468
+ .option("--task-id <taskId>")
469
+ .addOption(jsonOption("--details <json>", "resolution details"))
470
+ .action((options) => runHandler(io, "agent_board.resolve_escalation", () => client.resolveEscalation({
471
+ p_escalation_id: options.escalationId,
472
+ p_resolved_by_agent_id: options.resolvedByAgentId,
473
+ p_task_id: options.taskId,
474
+ p_details: options.details,
475
+ })));
476
+ program
477
+ .command("mark-read")
478
+ .requiredOption("--thread-id <threadId>")
479
+ .option("--agent-id <agentId>")
480
+ .addOption(numberOption("--last-read-message-sequence <sequence>", "canonical thread cursor"))
481
+ .action((options) => runHandler(io, "agent_board.mark_read", () => client.markRead({
482
+ p_thread_id: options.threadId,
483
+ p_agent_id: options.agentId,
484
+ p_last_read_message_sequence: options.lastReadMessageSequence,
485
+ })));
486
+ program
487
+ .command("send-direct")
488
+ .requiredOption("--thread-id <threadId>")
489
+ .option("--author-agent-id <agentId>")
490
+ .requiredOption("--recipient-agent-id <agentId>")
491
+ .requiredOption("--subject <subject>")
492
+ .requiredOption("--body <body>")
493
+ .option("--message-type <messageType>")
494
+ .option("--priority <priority>")
495
+ .option("--idempotency-key <idempotencyKey>")
496
+ .addOption(jsonOption("--metadata <json>", "direct message metadata"))
497
+ .action((options) => runHandler(io, "agent_board.send_direct_message", () => client.sendDirectMessage({
498
+ p_thread_id: options.threadId,
499
+ p_author_agent_id: options.authorAgentId,
500
+ p_recipient_agent_id: options.recipientAgentId,
501
+ p_subject: options.subject,
502
+ p_body: options.body,
503
+ p_message_type: options.messageType,
504
+ p_priority: options.priority,
505
+ p_idempotency_key: options.idempotencyKey,
506
+ p_metadata: options.metadata,
507
+ })));
508
+ program
509
+ .command("send-multicast")
510
+ .requiredOption("--thread-id <threadId>")
511
+ .option("--author-agent-id <agentId>")
512
+ .requiredOption("--recipient-agent-ids <recipientAgentIds>")
513
+ .requiredOption("--subject <subject>")
514
+ .requiredOption("--body <body>")
515
+ .option("--message-type <messageType>")
516
+ .option("--priority <priority>")
517
+ .option("--idempotency-key <idempotencyKey>")
518
+ .addOption(jsonOption("--metadata <json>", "multicast message metadata"))
519
+ .action((options) => runHandler(io, "agent_board.send_multicast_message", () => client.sendMulticastMessage({
520
+ p_thread_id: options.threadId,
521
+ p_author_agent_id: options.authorAgentId,
522
+ p_recipient_agent_ids: String(options.recipientAgentIds)
523
+ .split(",")
524
+ .map((value) => value.trim())
525
+ .filter(Boolean),
526
+ p_subject: options.subject,
527
+ p_body: options.body,
528
+ p_message_type: options.messageType,
529
+ p_priority: options.priority,
530
+ p_idempotency_key: options.idempotencyKey,
531
+ p_metadata: options.metadata,
532
+ })));
533
+ program
534
+ .command("post-board-message")
535
+ .requiredOption("--thread-id <threadId>")
536
+ .option("--author-agent-id <agentId>")
537
+ .requiredOption("--board-id <boardId>")
538
+ .requiredOption("--subject <subject>")
539
+ .requiredOption("--body <body>")
540
+ .option("--message-type <messageType>")
541
+ .option("--priority <priority>")
542
+ .option("--idempotency-key <idempotencyKey>")
543
+ .addOption(jsonOption("--metadata <json>", "board post metadata"))
544
+ .action((options) => runHandler(io, "agent_board.post_board_message", () => client.postBoardMessage({
545
+ p_thread_id: options.threadId,
546
+ p_author_agent_id: options.authorAgentId,
547
+ p_board_id: options.boardId,
548
+ p_subject: options.subject,
549
+ p_body: options.body,
550
+ p_message_type: options.messageType,
551
+ p_priority: options.priority,
552
+ p_idempotency_key: options.idempotencyKey,
553
+ p_metadata: options.metadata,
554
+ })));
555
+ program
556
+ .command("create-tasking-delivery")
557
+ .requiredOption("--thread-id <threadId>")
558
+ .option("--created-by-agent-id <agentId>")
559
+ .requiredOption("--title <title>")
560
+ .option("--details <details>")
561
+ .option("--recipient-agent-ids <recipientAgentIds>")
562
+ .option("--board-id <boardId>")
563
+ .option("--priority <priority>")
564
+ .option("--orchestration-mode <orchestrationMode>")
565
+ .option("--idempotency-key <idempotencyKey>")
566
+ .addOption(jsonOption("--metadata <json>", "tasking metadata"))
567
+ .action((options) => runHandler(io, "agent_board.create_tasking_delivery", () => client.createTaskingDelivery({
568
+ p_thread_id: options.threadId,
569
+ p_created_by_agent_id: options.createdByAgentId,
570
+ p_title: options.title,
571
+ p_details: options.details,
572
+ p_recipient_agent_ids: options.recipientAgentIds
573
+ ? String(options.recipientAgentIds)
574
+ .split(",")
575
+ .map((value) => value.trim())
576
+ .filter(Boolean)
577
+ : undefined,
578
+ p_board_id: options.boardId,
579
+ p_priority: options.priority,
580
+ p_orchestration_mode: options.orchestrationMode,
581
+ p_idempotency_key: options.idempotencyKey,
582
+ p_metadata: options.metadata,
583
+ })));
584
+ program
585
+ .command("create-board")
586
+ .option("--created-by-agent-id <agentId>")
587
+ .requiredOption("--slug <slug>")
588
+ .requiredOption("--name <name>")
589
+ .option("--description <description>")
590
+ .option("--visibility <visibility>")
591
+ .addOption(jsonOption("--metadata <json>", "board metadata"))
592
+ .action((options) => runHandler(io, "agent_board.create_board", () => client.createBoard({
593
+ p_created_by_agent_id: options.createdByAgentId,
594
+ p_slug: options.slug,
595
+ p_name: options.name,
596
+ p_description: options.description,
597
+ p_visibility: options.visibility,
598
+ p_metadata: options.metadata,
599
+ })));
600
+ program
601
+ .command("join-board")
602
+ .requiredOption("--board-id <boardId>")
603
+ .option("--agent-id <agentId>")
604
+ .option("--membership-state <membershipState>")
605
+ .option("--created-by-agent-id <createdByAgentId>")
606
+ .addOption(jsonOption("--metadata <json>", "membership metadata"))
607
+ .action((options) => runHandler(io, "agent_board.join_board", () => client.joinBoard({
608
+ p_board_id: options.boardId,
609
+ p_agent_id: options.agentId,
610
+ p_membership_state: options.membershipState,
611
+ p_created_by_agent_id: options.createdByAgentId,
612
+ p_metadata: options.metadata,
613
+ })));
614
+ program
615
+ .command("leave-board")
616
+ .requiredOption("--board-id <boardId>")
617
+ .option("--agent-id <agentId>")
618
+ .addOption(jsonOption("--metadata <json>", "membership metadata"))
619
+ .action((options) => runHandler(io, "agent_board.leave_board", () => client.leaveBoard({
620
+ p_board_id: options.boardId,
621
+ p_agent_id: options.agentId,
622
+ p_metadata: options.metadata,
623
+ })));
624
+ program
625
+ .command("update-board-membership")
626
+ .requiredOption("--board-id <boardId>")
627
+ .option("--agent-id <agentId>")
628
+ .requiredOption("--membership-state <membershipState>")
629
+ .addOption(jsonOption("--metadata <json>", "membership metadata"))
630
+ .action((options) => runHandler(io, "agent_board.update_board_membership", () => client.updateBoardMembership({
631
+ p_board_id: options.boardId,
632
+ p_agent_id: options.agentId,
633
+ p_membership_state: options.membershipState,
634
+ p_metadata: options.metadata,
635
+ })));
636
+ program
637
+ .command("request-join-board")
638
+ .requiredOption("--board-id <boardId>")
639
+ .option("--agent-id <agentId>")
640
+ .addOption(jsonOption("--metadata <json>", "membership request metadata"))
641
+ .action((options) => runHandler(io, "agent_board.request_join_board", () => client.requestJoinBoard({
642
+ p_board_id: options.boardId,
643
+ p_agent_id: options.agentId,
644
+ p_metadata: options.metadata,
645
+ })));
646
+ program
647
+ .command("invite-board-member")
648
+ .requiredOption("--board-id <boardId>")
649
+ .requiredOption("--agent-id <agentId>")
650
+ .option("--created-by-agent-id <agentId>")
651
+ .addOption(jsonOption("--metadata <json>", "membership invite metadata"))
652
+ .action((options) => runHandler(io, "agent_board.invite_board_member", () => client.inviteBoardMember({
653
+ p_board_id: options.boardId,
654
+ p_agent_id: options.agentId,
655
+ p_created_by_agent_id: options.createdByAgentId,
656
+ p_metadata: options.metadata,
657
+ })));
658
+ program
659
+ .command("resolve-board-request")
660
+ .requiredOption("--board-id <boardId>")
661
+ .requiredOption("--agent-id <agentId>")
662
+ .requiredOption("--membership-state <membershipState>")
663
+ .option("--created-by-agent-id <agentId>")
664
+ .addOption(jsonOption("--metadata <json>", "membership resolution metadata"))
665
+ .action((options) => runHandler(io, "agent_board.resolve_board_request", () => client.resolveBoardRequest({
666
+ p_board_id: options.boardId,
667
+ p_agent_id: options.agentId,
668
+ p_membership_state: options.membershipState,
669
+ p_created_by_agent_id: options.createdByAgentId,
670
+ p_metadata: options.metadata,
671
+ })));
672
+ program
673
+ .command("update-inbox-item-state")
674
+ .requiredOption("--inbox-item-id <inboxItemId>")
675
+ .option("--recipient-agent-id <agentId>")
676
+ .requiredOption("--action-state <actionState>")
677
+ .addOption(jsonOption("--metadata <json>", "inbox transition metadata"))
678
+ .action((options) => runHandler(io, "agent_board.update_inbox_item_state", () => client.updateInboxItemState({
679
+ p_inbox_item_id: options.inboxItemId,
680
+ p_recipient_agent_id: options.recipientAgentId,
681
+ p_action_state: options.actionState,
682
+ p_metadata: options.metadata,
683
+ })));
684
+ program
685
+ .command("register-callback-endpoint")
686
+ .option("--owner-agent-id <agentId>")
687
+ .requiredOption("--endpoint-url <endpointUrl>")
688
+ .addOption(jsonOption("--metadata <json>", "endpoint metadata"))
689
+ .action((options) => runHandler(io, "agent_board.register_callback_endpoint", () => client.registerCallbackEndpoint({
690
+ p_owner_agent_id: options.ownerAgentId,
691
+ p_endpoint_url: options.endpointUrl,
692
+ p_metadata: options.metadata,
693
+ })));
694
+ program
695
+ .command("verify-callback-endpoint")
696
+ .requiredOption("--endpoint-id <endpointId>")
697
+ .option("--owner-agent-id <agentId>")
698
+ .addOption(jsonOption("--metadata <json>", "verification metadata"))
699
+ .action((options) => runHandler(io, "agent_board.verify_callback_endpoint", () => client.verifyCallbackEndpoint({
700
+ p_endpoint_id: options.endpointId,
701
+ p_owner_agent_id: options.ownerAgentId,
702
+ p_metadata: options.metadata,
703
+ })));
704
+ program
705
+ .command("disable-callback-endpoint")
706
+ .requiredOption("--endpoint-id <endpointId>")
707
+ .option("--owner-agent-id <agentId>")
708
+ .option("--disabled-reason <disabledReason>")
709
+ .addOption(jsonOption("--metadata <json>", "disablement metadata"))
710
+ .action((options) => runHandler(io, "agent_board.disable_callback_endpoint", () => client.disableCallbackEndpoint({
711
+ p_endpoint_id: options.endpointId,
712
+ p_owner_agent_id: options.ownerAgentId,
713
+ p_disabled_reason: options.disabledReason,
714
+ p_metadata: options.metadata,
715
+ })));
716
+ program
717
+ .command("rotate-callback-signing-key")
718
+ .requiredOption("--endpoint-id <endpointId>")
719
+ .option("--owner-agent-id <agentId>")
720
+ .addOption(jsonOption("--metadata <json>", "rotation metadata"))
721
+ .action((options) => runHandler(io, "agent_board.rotate_callback_signing_key", () => client.rotateCallbackSigningKey({
722
+ p_endpoint_id: options.endpointId,
723
+ p_owner_agent_id: options.ownerAgentId,
724
+ p_metadata: options.metadata,
725
+ })));
726
+ program
727
+ .command("delete-callback-endpoint")
728
+ .requiredOption("--endpoint-id <endpointId>")
729
+ .option("--owner-agent-id <agentId>")
730
+ .action((options) => runHandler(io, "agent_board.delete_callback_endpoint", () => client.deleteCallbackEndpoint({
731
+ p_endpoint_id: options.endpointId,
732
+ p_owner_agent_id: options.ownerAgentId,
733
+ })));
734
+ program
735
+ .command("subscribe-callback-endpoint")
736
+ .requiredOption("--endpoint-id <endpointId>")
737
+ .option("--agent-id <agentId>")
738
+ .requiredOption("--subscription-scope <subscriptionScope>")
739
+ .requiredOption("--event-category <eventCategory>")
740
+ .option("--board-id <boardId>")
741
+ .addOption(jsonOption("--metadata <json>", "subscription metadata"))
742
+ .action((options) => runHandler(io, "agent_board.subscribe_callback_endpoint", () => client.subscribeCallbackEndpoint({
743
+ p_endpoint_id: options.endpointId,
744
+ p_agent_id: options.agentId,
745
+ p_subscription_scope: options.subscriptionScope,
746
+ p_event_category: options.eventCategory,
747
+ p_board_id: options.boardId,
748
+ p_metadata: options.metadata,
749
+ })));
750
+ program
751
+ .command("unsubscribe-callback-endpoint")
752
+ .requiredOption("--endpoint-id <endpointId>")
753
+ .option("--agent-id <agentId>")
754
+ .requiredOption("--subscription-scope <subscriptionScope>")
755
+ .requiredOption("--event-category <eventCategory>")
756
+ .option("--board-id <boardId>")
757
+ .addOption(jsonOption("--metadata <json>", "subscription metadata"))
758
+ .action((options) => runHandler(io, "agent_board.unsubscribe_callback_endpoint", () => client.unsubscribeCallbackEndpoint({
759
+ p_endpoint_id: options.endpointId,
760
+ p_agent_id: options.agentId,
761
+ p_subscription_scope: options.subscriptionScope,
762
+ p_event_category: options.eventCategory,
763
+ p_board_id: options.boardId,
764
+ p_metadata: options.metadata,
765
+ })));
766
+ }
767
+ function addReadCommands(program, client, io) {
768
+ program
769
+ .command("whoami")
770
+ .option("--agent-id <agentId>")
771
+ .option("--handle <handle>")
772
+ .action((options) => runHandler(io, "agent_board.whoami", () => client.whoami({
773
+ agentId: options.agentId,
774
+ handle: options.handle,
775
+ })));
776
+ program
777
+ .command("notification-status")
778
+ .option("--endpoint-id <endpointId>")
779
+ .option("--agent-id <agentId>")
780
+ .option("--board-id <boardId>")
781
+ .option("--subscription-scope <subscriptionScope>")
782
+ .option("--event-category <eventCategory>")
783
+ .addOption(numberOption("--limit <limit>", "row limit"))
784
+ .action((options) => runHandler(io, "agent_board.v_callback_delivery_health", () => client.notificationStatus({
785
+ endpointId: options.endpointId,
786
+ agentId: options.agentId,
787
+ boardId: options.boardId,
788
+ subscriptionScope: options.subscriptionScope,
789
+ eventCategory: options.eventCategory,
790
+ limit: options.limit,
791
+ })));
792
+ program
793
+ .command("notification-ack")
794
+ .requiredOption("--inbox-item-id <inboxItemId>")
795
+ .option("--recipient-agent-id <agentId>")
796
+ .addOption(jsonOption("--metadata <json>", "ack metadata"))
797
+ .action((options) => runHandler(io, "agent_board.notification_ack", () => client.notificationAck({
798
+ inboxItemId: options.inboxItemId,
799
+ recipientAgentId: options.recipientAgentId,
800
+ metadata: options.metadata,
801
+ })));
802
+ const endpoint = program.command("endpoint").description("notification endpoint commands");
803
+ endpoint
804
+ .command("register")
805
+ .option("--owner-agent-id <agentId>")
806
+ .requiredOption("--endpoint-url <endpointUrl>")
807
+ .addOption(jsonOption("--metadata <json>", "endpoint metadata"))
808
+ .action((options) => runHandler(io, "agent_board.register_callback_endpoint", () => client.registerNotificationEndpoint({
809
+ p_owner_agent_id: options.ownerAgentId,
810
+ p_endpoint_url: options.endpointUrl,
811
+ p_metadata: options.metadata,
812
+ })));
813
+ endpoint
814
+ .command("verify")
815
+ .requiredOption("--endpoint-id <endpointId>")
816
+ .option("--owner-agent-id <agentId>")
817
+ .addOption(jsonOption("--metadata <json>", "verification metadata"))
818
+ .action((options) => runHandler(io, "agent_board.verify_callback_endpoint", () => client.verifyNotificationEndpoint({
819
+ p_endpoint_id: options.endpointId,
820
+ p_owner_agent_id: options.ownerAgentId,
821
+ p_metadata: options.metadata,
822
+ })));
823
+ endpoint
824
+ .command("status")
825
+ .option("--endpoint-id <endpointId>")
826
+ .option("--owner-agent-id <agentId>")
827
+ .addOption(numberOption("--limit <limit>", "row limit"))
828
+ .action((options) => runHandler(io, "agent_board.v_callback_endpoint_status", () => client.callbackEndpointStatus({
829
+ endpointId: options.endpointId,
830
+ ownerAgentId: options.ownerAgentId,
831
+ limit: options.limit,
832
+ })));
833
+ const subscription = program.command("subscription").description("notification subscription commands");
834
+ subscription
835
+ .command("add")
836
+ .requiredOption("--endpoint-id <endpointId>")
837
+ .option("--agent-id <agentId>")
838
+ .requiredOption("--subscription-scope <subscriptionScope>")
839
+ .requiredOption("--event-category <eventCategory>")
840
+ .option("--board-id <boardId>")
841
+ .addOption(jsonOption("--metadata <json>", "subscription metadata"))
842
+ .action((options) => runHandler(io, "agent_board.subscribe_callback_endpoint", () => client.subscribeNotificationEndpoint({
843
+ p_endpoint_id: options.endpointId,
844
+ p_agent_id: options.agentId,
845
+ p_subscription_scope: options.subscriptionScope,
846
+ p_event_category: options.eventCategory,
847
+ p_board_id: options.boardId,
848
+ p_metadata: options.metadata,
849
+ })));
850
+ subscription
851
+ .command("remove")
852
+ .requiredOption("--endpoint-id <endpointId>")
853
+ .option("--agent-id <agentId>")
854
+ .requiredOption("--subscription-scope <subscriptionScope>")
855
+ .requiredOption("--event-category <eventCategory>")
856
+ .option("--board-id <boardId>")
857
+ .addOption(jsonOption("--metadata <json>", "subscription metadata"))
858
+ .action((options) => runHandler(io, "agent_board.unsubscribe_callback_endpoint", () => client.unsubscribeNotificationEndpoint({
859
+ p_endpoint_id: options.endpointId,
860
+ p_agent_id: options.agentId,
861
+ p_subscription_scope: options.subscriptionScope,
862
+ p_event_category: options.eventCategory,
863
+ p_board_id: options.boardId,
864
+ p_metadata: options.metadata,
865
+ })));
866
+ subscription
867
+ .command("list")
868
+ .option("--endpoint-id <endpointId>")
869
+ .option("--agent-id <agentId>")
870
+ .option("--board-id <boardId>")
871
+ .option("--subscription-scope <subscriptionScope>")
872
+ .option("--event-category <eventCategory>")
873
+ .option("--subscription-status <subscriptionStatus>")
874
+ .addOption(numberOption("--limit <limit>", "row limit"))
875
+ .action((options) => runHandler(io, "agent_board.v_callback_subscriptions", () => client.callbackSubscriptions({
876
+ endpointId: options.endpointId,
877
+ agentId: options.agentId,
878
+ boardId: options.boardId,
879
+ subscriptionScope: options.subscriptionScope,
880
+ eventCategory: options.eventCategory,
881
+ subscriptionStatus: options.subscriptionStatus,
882
+ limit: options.limit,
883
+ })));
884
+ const watch = program.command("watch").description("bounded JSONL watch descriptors");
885
+ watch
886
+ .command("inbox")
887
+ .option("--recipient-agent-id <agentId>")
888
+ .option("--board-id <boardId>")
889
+ .option("--action-state <actionState>")
890
+ .option("--after-cursor <afterCursor>")
891
+ .addOption(numberOption("--limit <limit>", "row limit"))
892
+ .option("--jsonl")
893
+ .action((options) => runJsonlHandler(io, "agent_board.watch_inbox", () => client.watchInbox({
894
+ recipientAgentId: options.recipientAgentId,
895
+ boardId: options.boardId,
896
+ actionState: options.actionState,
897
+ afterCursor: options.afterCursor,
898
+ limit: options.limit,
899
+ jsonl: Boolean(options.jsonl),
900
+ })));
901
+ watch
902
+ .command("supervision")
903
+ .option("--assigned-agent-id <agentId>")
904
+ .option("--after-cursor <afterCursor>")
905
+ .addOption(numberOption("--limit <limit>", "row limit"))
906
+ .option("--jsonl")
907
+ .action((options) => runJsonlHandler(io, "agent_board.watch_supervision", () => client.watchSupervision({
908
+ assignedAgentId: options.assignedAgentId,
909
+ afterCursor: options.afterCursor,
910
+ limit: options.limit,
911
+ jsonl: Boolean(options.jsonl),
912
+ })));
913
+ const worker = program.command("worker").description("notification worker commands");
914
+ worker
915
+ .command("notifications")
916
+ .option("--endpoint-id <endpointId>")
917
+ .option("--agent-id <agentId>")
918
+ .addOption(numberOption("--limit <limit>", "row limit"))
919
+ .action((options) => runHandler(io, "agent_board.worker_notifications", () => client.workerNotifications({
920
+ endpointId: options.endpointId,
921
+ agentId: options.agentId,
922
+ limit: options.limit,
923
+ })));
924
+ worker
925
+ .command("claim-notifications")
926
+ .addOption(numberOption("--limit <limit>", "claim limit"))
927
+ .option("--lease-expires-at <leaseExpiresAt>")
928
+ .action((options) => runHandler(io, "agent_board.claim_callback_outbox_events", () => client.claimNotificationOutboxEvents({
929
+ p_limit: options.limit,
930
+ p_lease_expires_at: options.leaseExpiresAt,
931
+ })));
932
+ const supervision = program.command("supervision").description("human supervision commands");
933
+ supervision
934
+ .command("feed")
935
+ .option("--assigned-agent-id <agentId>")
936
+ .option("--thread-id <threadId>")
937
+ .option("--task-id <taskId>")
938
+ .addOption(numberOption("--limit <limit>", "row limit"))
939
+ .action((options) => runHandler(io, "agent_board.v_open_escalations", () => client.supervisionFeed({
940
+ assignedAgentId: options.assignedAgentId,
941
+ threadId: options.threadId,
942
+ taskId: options.taskId,
943
+ limit: options.limit,
944
+ })));
945
+ supervision
946
+ .command("scopes")
947
+ .option("--resource-kind <resourceKind>")
948
+ .option("--resource-key <resourceKey>")
949
+ .option("--agent-id <agentId>")
950
+ .option("--task-id <taskId>")
951
+ .option("--thread-id <threadId>")
952
+ .addOption(numberOption("--limit <limit>", "row limit"))
953
+ .action((options) => runHandler(io, "agent_board.v_active_claims", () => client.supervisionScopes({
954
+ resourceKind: options.resourceKind,
955
+ resourceKey: options.resourceKey,
956
+ agentId: options.agentId,
957
+ taskId: options.taskId,
958
+ threadId: options.threadId,
959
+ limit: options.limit,
960
+ })));
961
+ supervision
962
+ .command("approve")
963
+ .requiredOption("--task-id <taskId>")
964
+ .option("--actor-agent-id <agentId>")
965
+ .option("--summary <summary>")
966
+ .addOption(jsonOption("--details <json>", "approval details"))
967
+ .action((options) => runHandler(io, "agent_board.supervision_approval", () => client.approveIntervention({
968
+ taskId: options.taskId,
969
+ actorAgentId: options.actorAgentId,
970
+ summary: options.summary,
971
+ details: options.details,
972
+ })));
973
+ supervision
974
+ .command("reject")
975
+ .requiredOption("--task-id <taskId>")
976
+ .option("--actor-agent-id <agentId>")
977
+ .option("--summary <summary>")
978
+ .addOption(jsonOption("--details <json>", "rejection details"))
979
+ .action((options) => runHandler(io, "agent_board.supervision_approval", () => client.rejectIntervention({
980
+ taskId: options.taskId,
981
+ actorAgentId: options.actorAgentId,
982
+ summary: options.summary,
983
+ details: options.details,
984
+ })));
985
+ program
986
+ .command("pipeline-task-inbox")
987
+ .option("--assigned-agent-id <agentId>")
988
+ .option("--delivery-mode <deliveryMode>")
989
+ .option("--action-state <actionState>")
990
+ .addOption(numberOption("--limit <limit>", "row limit"))
991
+ .action((options) => runHandler(io, "agent_board.pipeline_task_inbox", () => client.pipelineTaskInbox({
992
+ assignedAgentId: options.assignedAgentId,
993
+ deliveryMode: options.deliveryMode,
994
+ actionState: options.actionState,
995
+ limit: options.limit,
996
+ })));
997
+ program
998
+ .command("pipeline-task-update")
999
+ .requiredOption("--task-id <taskId>")
1000
+ .requiredOption("--update-kind <updateKind>")
1001
+ .option("--thread-id <threadId>")
1002
+ .option("--actor-agent-id <agentId>")
1003
+ .option("--assigned-agent-id <agentId>")
1004
+ .option("--status <status>")
1005
+ .option("--summary <summary>")
1006
+ .option("--escalation-id <escalationId>")
1007
+ .option("--completed-at <completedAt>")
1008
+ .addOption(jsonOption("--details <json>", "pipeline update details"))
1009
+ .action((options) => runHandler(io, "agent_board.pipeline_task_update", () => client.updatePipelineTask({
1010
+ taskId: options.taskId,
1011
+ updateKind: options.updateKind,
1012
+ threadId: options.threadId,
1013
+ actorAgentId: options.actorAgentId,
1014
+ assignedAgentId: options.assignedAgentId,
1015
+ status: options.status,
1016
+ summary: options.summary,
1017
+ escalationId: options.escalationId,
1018
+ completedAt: options.completedAt,
1019
+ details: options.details,
1020
+ })));
1021
+ program
1022
+ .command("pipeline-subscribe-callback")
1023
+ .option("--endpoint-id <endpointId>")
1024
+ .option("--endpoint-url <endpointUrl>")
1025
+ .option("--agent-id <agentId>")
1026
+ .requiredOption("--subscription-scope <subscriptionScope>")
1027
+ .requiredOption("--event-category <eventCategory>")
1028
+ .option("--board-id <boardId>")
1029
+ .option("--verify-endpoint <verifyEndpoint>")
1030
+ .addOption(jsonOption("--metadata <json>", "callback metadata"))
1031
+ .action((options) => runHandler(io, "agent_board.pipeline_subscribe_callback", () => client.subscribePipelineCallback({
1032
+ endpointId: options.endpointId,
1033
+ endpointUrl: options.endpointUrl,
1034
+ agentId: options.agentId,
1035
+ subscriptionScope: options.subscriptionScope,
1036
+ eventCategory: options.eventCategory,
1037
+ boardId: options.boardId,
1038
+ verifyEndpoint: options.verifyEndpoint === undefined ? undefined : options.verifyEndpoint !== "false",
1039
+ metadata: options.metadata,
1040
+ })));
1041
+ program
1042
+ .command("pipeline-refresh-context")
1043
+ .requiredOption("--target <json>")
1044
+ .action((options) => runHandler(io, "agent_board.pipeline_refresh_context", () => client.refreshPipelineContext(parseJson(options.target) ?? {})));
1045
+ program
1046
+ .command("thread-feed")
1047
+ .requiredOption("--thread-id <threadId>")
1048
+ .addOption(numberOption("--after-sequence <sequence>", "resume after this message sequence"))
1049
+ .addOption(numberOption("--limit <limit>", "row limit"))
1050
+ .action((options) => runHandler(io, "agent_board.v_thread_feed", () => client.threadFeed({
1051
+ threadId: options.threadId,
1052
+ afterSequence: options.afterSequence,
1053
+ limit: options.limit,
1054
+ })));
1055
+ program
1056
+ .command("task-tree")
1057
+ .option("--root-task-id <taskId>")
1058
+ .option("--thread-id <threadId>")
1059
+ .option("--task-id <taskId>")
1060
+ .addOption(numberOption("--limit <limit>", "row limit"))
1061
+ .action((options) => runHandler(io, "agent_board.v_task_tree", () => client.taskTree({
1062
+ rootTaskId: options.rootTaskId,
1063
+ threadId: options.threadId,
1064
+ taskId: options.taskId,
1065
+ limit: options.limit,
1066
+ })));
1067
+ program
1068
+ .command("active-claims")
1069
+ .option("--resource-kind <resourceKind>")
1070
+ .option("--resource-key <resourceKey>")
1071
+ .option("--agent-id <agentId>")
1072
+ .option("--task-id <taskId>")
1073
+ .option("--thread-id <threadId>")
1074
+ .addOption(numberOption("--limit <limit>", "row limit"))
1075
+ .action((options) => runHandler(io, "agent_board.v_active_claims", () => client.activeClaims({
1076
+ resourceKind: options.resourceKind,
1077
+ resourceKey: options.resourceKey,
1078
+ agentId: options.agentId,
1079
+ taskId: options.taskId,
1080
+ threadId: options.threadId,
1081
+ limit: options.limit,
1082
+ })));
1083
+ program
1084
+ .command("open-escalations")
1085
+ .option("--assigned-agent-id <agentId>")
1086
+ .option("--thread-id <threadId>")
1087
+ .option("--task-id <taskId>")
1088
+ .addOption(numberOption("--limit <limit>", "row limit"))
1089
+ .action((options) => runHandler(io, "agent_board.v_open_escalations", () => client.openEscalations({
1090
+ assignedAgentId: options.assignedAgentId,
1091
+ threadId: options.threadId,
1092
+ taskId: options.taskId,
1093
+ limit: options.limit,
1094
+ })));
1095
+ program
1096
+ .command("agent-dashboard")
1097
+ .option("--agent-id <agentId>")
1098
+ .option("--handle <handle>")
1099
+ .addOption(numberOption("--limit <limit>", "row limit"))
1100
+ .action((options) => runHandler(io, "agent_board.v_agent_dashboard", () => client.agentDashboard({
1101
+ agentId: options.agentId,
1102
+ handle: options.handle,
1103
+ limit: options.limit,
1104
+ })));
1105
+ program
1106
+ .command("agent-inbox")
1107
+ .alias("inbox")
1108
+ .option("--recipient-agent-id <agentId>")
1109
+ .option("--board-id <boardId>")
1110
+ .option("--delivery-mode <deliveryMode>")
1111
+ .option("--action-state <actionState>")
1112
+ .addOption(numberOption("--limit <limit>", "row limit"))
1113
+ .action((options) => runHandler(io, "agent_board.v_agent_inbox", () => client.agentInbox({
1114
+ recipientAgentId: options.recipientAgentId,
1115
+ boardId: options.boardId,
1116
+ deliveryMode: options.deliveryMode,
1117
+ actionState: options.actionState,
1118
+ limit: options.limit,
1119
+ })));
1120
+ program
1121
+ .command("agent-inbox-counts")
1122
+ .alias("inbox-counts")
1123
+ .option("--recipient-agent-id <agentId>")
1124
+ .addOption(numberOption("--limit <limit>", "row limit"))
1125
+ .action((options) => runHandler(io, "agent_board.v_agent_inbox_counts", () => client.agentInboxCounts({
1126
+ recipientAgentId: options.recipientAgentId,
1127
+ limit: options.limit,
1128
+ })));
1129
+ program
1130
+ .command("board-directory")
1131
+ .option("--board-id <boardId>")
1132
+ .option("--board-slug <boardSlug>")
1133
+ .option("--visibility <visibility>")
1134
+ .addOption(numberOption("--limit <limit>", "row limit"))
1135
+ .action((options) => runHandler(io, "agent_board.v_board_directory", () => client.boardDirectory({
1136
+ boardId: options.boardId,
1137
+ boardSlug: options.boardSlug,
1138
+ visibility: options.visibility,
1139
+ limit: options.limit,
1140
+ })));
1141
+ program
1142
+ .command("board-memberships")
1143
+ .option("--board-id <boardId>")
1144
+ .option("--agent-id <agentId>")
1145
+ .option("--membership-state <membershipState>")
1146
+ .addOption(numberOption("--limit <limit>", "row limit"))
1147
+ .action((options) => runHandler(io, "agent_board.v_board_memberships", () => client.boardMemberships({
1148
+ boardId: options.boardId,
1149
+ agentId: options.agentId,
1150
+ membershipState: options.membershipState,
1151
+ limit: options.limit,
1152
+ })));
1153
+ program
1154
+ .command("board-feed")
1155
+ .option("--board-id <boardId>")
1156
+ .option("--board-slug <boardSlug>")
1157
+ .option("--after-created-at <afterCreatedAt>")
1158
+ .addOption(numberOption("--limit <limit>", "row limit"))
1159
+ .action((options) => runHandler(io, "agent_board.v_board_feed", () => client.boardFeed({
1160
+ boardId: options.boardId,
1161
+ boardSlug: options.boardSlug,
1162
+ afterCreatedAt: options.afterCreatedAt,
1163
+ limit: options.limit,
1164
+ })));
1165
+ program
1166
+ .command("callback-endpoint-status")
1167
+ .option("--endpoint-id <endpointId>")
1168
+ .option("--owner-agent-id <agentId>")
1169
+ .addOption(numberOption("--limit <limit>", "row limit"))
1170
+ .action((options) => runHandler(io, "agent_board.v_callback_endpoint_status", () => client.callbackEndpointStatus({
1171
+ endpointId: options.endpointId,
1172
+ ownerAgentId: options.ownerAgentId,
1173
+ limit: options.limit,
1174
+ })));
1175
+ program
1176
+ .command("callback-subscriptions")
1177
+ .option("--endpoint-id <endpointId>")
1178
+ .option("--agent-id <agentId>")
1179
+ .option("--board-id <boardId>")
1180
+ .option("--subscription-scope <subscriptionScope>")
1181
+ .option("--event-category <eventCategory>")
1182
+ .option("--subscription-status <subscriptionStatus>")
1183
+ .addOption(numberOption("--limit <limit>", "row limit"))
1184
+ .action((options) => runHandler(io, "agent_board.v_callback_subscriptions", () => client.callbackSubscriptions({
1185
+ endpointId: options.endpointId,
1186
+ agentId: options.agentId,
1187
+ boardId: options.boardId,
1188
+ subscriptionScope: options.subscriptionScope,
1189
+ eventCategory: options.eventCategory,
1190
+ subscriptionStatus: options.subscriptionStatus,
1191
+ limit: options.limit,
1192
+ })));
1193
+ program
1194
+ .command("callback-delivery-health")
1195
+ .option("--endpoint-id <endpointId>")
1196
+ .option("--agent-id <agentId>")
1197
+ .option("--board-id <boardId>")
1198
+ .option("--subscription-scope <subscriptionScope>")
1199
+ .option("--event-category <eventCategory>")
1200
+ .addOption(numberOption("--limit <limit>", "row limit"))
1201
+ .action((options) => runHandler(io, "agent_board.v_callback_delivery_health", () => client.callbackDeliveryHealth({
1202
+ endpointId: options.endpointId,
1203
+ agentId: options.agentId,
1204
+ boardId: options.boardId,
1205
+ subscriptionScope: options.subscriptionScope,
1206
+ eventCategory: options.eventCategory,
1207
+ limit: options.limit,
1208
+ })));
1209
+ }
1210
+ export function createProgram(client, io) {
1211
+ const program = new Command()
1212
+ .name("agent-board")
1213
+ .description("Thin CLI surface for the agent_board RPC and canonical read contracts")
1214
+ .addHelpText("after", "\nAuth: user-scoped agent sessions are the default. Service-role execution is reserved for callback workers and vetted operational scripts through explicit client configuration, not the normal agent CLI path. Signing configuration is inherited from metadata-safe descriptors; raw private-key arguments are not accepted.\n");
1215
+ program
1216
+ .command("signing-status")
1217
+ .description("Print metadata-safe signing descriptor status; raw private-key arguments are not accepted")
1218
+ .action(() => runHandler(io, "agent_board.signing_status", async () => signingStatusFromEnv()));
1219
+ const runtime = program.command("runtime").description("metadata-safe runtime diagnostics");
1220
+ runtime
1221
+ .command("status")
1222
+ .description("Print runtime discovery status without credential values")
1223
+ .action(() => runHandler(io, "agent_board.runtime_status", () => client.runtimeStatus()));
1224
+ runtime
1225
+ .command("doctor")
1226
+ .description("Validate runtime discovery and direct fallback posture without credential values")
1227
+ .option("--require-runtime")
1228
+ .action((options) => runRuntimeDoctor(io, client, Boolean(options.requireRuntime)));
1229
+ addWriteCommands(program, client, io);
1230
+ addReadCommands(program, client, io);
1231
+ return program;
1232
+ }
1233
+ export async function runCli(argv, io = {
1234
+ writeStdout: (message) => process.stdout.write(message),
1235
+ writeStderr: (message) => process.stderr.write(message),
1236
+ }, client = createAgentBoardClient()) {
1237
+ const program = createProgram(client, io);
1238
+ await program.parseAsync(argv, { from: "user" });
1239
+ }