@privateclaw/privateclaw 0.1.13 → 0.1.15

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.
@@ -6,7 +6,11 @@ import os from "node:os";
6
6
  import path from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { unzipSync } from "fflate";
9
- import type { BridgeResponse, PrivateClawAgentBridge } from "../types.js";
9
+ import type {
10
+ BridgeResponse,
11
+ PrivateClawAgentBridge,
12
+ PrivateClawAudioTranscriptionRequest,
13
+ } from "../types.js";
10
14
 
11
15
  type OpenClawThinkingLevel = "off" | "minimal" | "low" | "medium" | "high";
12
16
 
@@ -277,36 +281,85 @@ export class OpenClawAgentBridge implements PrivateClawAgentBridge {
277
281
  this.log(
278
282
  `handle_user_message session=${params.sessionId} textChars=${params.message.length} attachments=${params.attachments?.length ?? 0} promptChars=${promptMessage.length}`,
279
283
  );
280
- const args = this.buildArgs(params.sessionId, promptMessage);
281
- const sessionLogCursor = await this.captureSessionLogCursor(params.sessionId);
284
+ return this.executePrompt(params.sessionId, promptMessage, {
285
+ includeArtifacts: true,
286
+ noDisplayFallbackMessage: params.message,
287
+ });
288
+ }
289
+
290
+ async transcribeAudioAttachments(
291
+ params: PrivateClawAudioTranscriptionRequest,
292
+ ): Promise<string> {
293
+ const transcriptionSessionId = buildVoiceTranscriptionSessionId(
294
+ params.sessionId,
295
+ params.requestId,
296
+ );
297
+ this.log(
298
+ `voice_transcription_start session=${params.sessionId} request=${params.requestId} attachments=${params.attachments.length} sttSession=${transcriptionSessionId}`,
299
+ );
300
+ const stagedAttachments = await this.stageAttachments(
301
+ transcriptionSessionId,
302
+ params.attachments,
303
+ );
304
+ if (stagedAttachments.length === 0) {
305
+ throw new Error(
306
+ "OpenClaw voice transcription requires at least one inline audio attachment.",
307
+ );
308
+ }
309
+ const promptMessage = appendStructuredResponseContract(
310
+ buildAudioTranscriptionPrompt(stagedAttachments),
311
+ );
312
+ const response = await this.executePrompt(transcriptionSessionId, promptMessage, {
313
+ includeArtifacts: false,
314
+ });
315
+ const transcript = extractTextFromBridgeResponse(response).trim();
316
+ if (transcript === "") {
317
+ throw new Error("OpenClaw voice transcription returned an empty transcript.");
318
+ }
319
+ this.log(
320
+ `voice_transcription_complete session=${params.sessionId} request=${params.requestId} transcriptChars=${transcript.length} attachments=${stagedAttachments.length}`,
321
+ );
322
+ return transcript;
323
+ }
324
+
325
+ private async executePrompt(
326
+ sessionId: string,
327
+ promptMessage: string,
328
+ options?: {
329
+ includeArtifacts?: boolean;
330
+ noDisplayFallbackMessage?: string;
331
+ },
332
+ ): Promise<BridgeResponse> {
333
+ const args = this.buildArgs(sessionId, promptMessage);
334
+ const sessionLogCursor = await this.captureSessionLogCursor(sessionId);
282
335
  const stdout = await this.execOpenClaw(args);
283
336
  let parsed: OpenClawAgentJsonResult | undefined;
284
337
  let parseError: unknown;
285
338
  try {
286
339
  parsed = parseOpenClawAgentJson(stdout);
287
340
  this.log(
288
- `openclaw_agent_complete session=${params.sessionId} status=${parsed.status ?? "unknown"} summary=${JSON.stringify(parsed.summary ?? "")}`,
341
+ `openclaw_agent_complete session=${sessionId} status=${parsed.status ?? "unknown"} summary=${JSON.stringify(parsed.summary ?? "")}`,
289
342
  );
290
343
  if (!parsed.status) {
291
344
  this.log(
292
- `openclaw_agent_missing_status session=${params.sessionId} topLevelKeys=${Object.keys(parsed).join(",") || "none"}`,
345
+ `openclaw_agent_missing_status session=${sessionId} topLevelKeys=${Object.keys(parsed).join(",") || "none"}`,
293
346
  );
294
347
  }
295
348
  } catch (error) {
296
349
  parseError = error;
297
350
  this.log(
298
- `openclaw_agent_parse_failed session=${params.sessionId} stdoutChars=${stdout.length} stdoutPreview=${JSON.stringify(stdout.slice(0, 400))}`,
351
+ `openclaw_agent_parse_failed session=${sessionId} stdoutChars=${stdout.length} stdoutPreview=${JSON.stringify(stdout.slice(0, 400))}`,
299
352
  );
300
353
  }
301
- const collectedMessages = await this.collectSessionMessages(params.sessionId, sessionLogCursor);
354
+ const collectedMessages = await this.collectSessionMessages(sessionId, sessionLogCursor);
302
355
  const recoveredMessages = [
303
356
  ...collectedMessages.assistantMessages,
304
- ...collectedMessages.artifactMessages,
357
+ ...(options?.includeArtifacts === false ? [] : collectedMessages.artifactMessages),
305
358
  ];
306
359
  if (!parsed) {
307
360
  if (recoveredMessages.length > 0) {
308
361
  this.log(
309
- `session_log_fallback session=${params.sessionId} reason=parse_failed recoveredMessages=${recoveredMessages.length}`,
362
+ `session_log_fallback session=${sessionId} reason=parse_failed recoveredMessages=${recoveredMessages.length}`,
310
363
  );
311
364
  return toBridgeResponse(recoveredMessages, collectedMessages.assistantData);
312
365
  }
@@ -314,16 +367,21 @@ export class OpenClawAgentBridge implements PrivateClawAgentBridge {
314
367
  }
315
368
  try {
316
369
  const response = parseOpenClawAgentResult(parsed);
317
- return mergeBridgeResponses(response, collectedMessages.artifactMessages);
370
+ return options?.includeArtifacts === false
371
+ ? response
372
+ : mergeBridgeResponses(response, collectedMessages.artifactMessages);
318
373
  } catch (error) {
319
374
  if (recoveredMessages.length > 0) {
320
375
  this.log(
321
- `session_log_fallback session=${params.sessionId} reason=${JSON.stringify(error instanceof Error ? error.message : String(error))} recoveredMessages=${recoveredMessages.length}`,
376
+ `session_log_fallback session=${sessionId} reason=${JSON.stringify(error instanceof Error ? error.message : String(error))} recoveredMessages=${recoveredMessages.length}`,
322
377
  );
323
378
  return toBridgeResponse(recoveredMessages, collectedMessages.assistantData);
324
379
  }
325
380
  if (error instanceof OpenClawAgentNoDisplayPayloadError) {
326
- return buildNoDisplayPayloadNotice(params.message, error.parsed);
381
+ if (options?.noDisplayFallbackMessage) {
382
+ return buildNoDisplayPayloadNotice(options.noDisplayFallbackMessage, error.parsed);
383
+ }
384
+ throw new Error("OpenClaw returned no displayable voice transcription.");
327
385
  }
328
386
  throw error;
329
387
  }
@@ -767,6 +825,13 @@ function normalizeBridgeResponse(response: BridgeResponse): NormalizedBridgeMess
767
825
  );
768
826
  }
769
827
 
828
+ function extractTextFromBridgeResponse(response: BridgeResponse): string {
829
+ return normalizeBridgeResponse(response)
830
+ .map((message) => message.text.trim())
831
+ .filter((text) => text !== "")
832
+ .join("\n\n");
833
+ }
834
+
770
835
  function toBridgeResponse(
771
836
  messages: NormalizedBridgeMessage[],
772
837
  data?: unknown,
@@ -848,6 +913,28 @@ function appendStructuredResponseContract(prompt: string): string {
848
913
  return `${prompt}\n\n${buildStructuredResponseContractPrompt()}`;
849
914
  }
850
915
 
916
+ function buildAudioTranscriptionPrompt(
917
+ stagedAttachments: ReadonlyArray<StagedAttachment>,
918
+ ): string {
919
+ const lines = [
920
+ "PrivateClaw voice transcription request.",
921
+ "Use OpenClaw's speech-to-text or audio understanding capabilities on the exact staged files below.",
922
+ "Return only the recognized spoken content from the user's audio message.",
923
+ "- Do not answer the user's request.",
924
+ "- Do not summarize, explain, or translate unless the speech itself says to do so.",
925
+ "- Preserve the original language and natural punctuation.",
926
+ "- If multiple audio attachments are present, transcribe them in order and separate each transcript with a blank line.",
927
+ "",
928
+ "Staged audio attachments:",
929
+ ];
930
+ for (const attachment of stagedAttachments) {
931
+ lines.push(`- ${attachment.name}`);
932
+ lines.push(` mimeType: ${attachment.effectiveMimeType}`);
933
+ lines.push(` workspacePath: ${attachment.workspacePath}`);
934
+ }
935
+ return lines.join("\n");
936
+ }
937
+
851
938
  function buildStructuredResponseContractPrompt(): string {
852
939
  return [
853
940
  "PrivateClaw response contract:",
@@ -962,6 +1049,23 @@ function normalizeMediaPath(mediaPath: string): string {
962
1049
  return path.isAbsolute(trimmed) ? trimmed : path.resolve(trimmed);
963
1050
  }
964
1051
 
1052
+ function buildVoiceTranscriptionSessionId(sessionId: string, requestId: string): string {
1053
+ return [
1054
+ "privateclaw-voice-stt",
1055
+ sanitizeSessionIdSegment(sessionId),
1056
+ sanitizeSessionIdSegment(requestId),
1057
+ ].join("-");
1058
+ }
1059
+
1060
+ function sanitizeSessionIdSegment(value: string): string {
1061
+ const sanitized = value
1062
+ .trim()
1063
+ .replace(/[^A-Za-z0-9_-]+/gu, "-")
1064
+ .replace(/-+/gu, "-")
1065
+ .replace(/^-|-$/gu, "");
1066
+ return sanitized === "" ? randomUUID().slice(0, 8) : sanitized;
1067
+ }
1068
+
965
1069
  function isNodeError(error: unknown): error is NodeJS.ErrnoException {
966
1070
  return error instanceof Error && "code" in error;
967
1071
  }
package/src/cli.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { pathToFileURL } from "node:url";
3
4
  import { parseArgs } from "node:util";
4
5
  import { mkdir, readFile, writeFile } from "node:fs/promises";
5
6
  import path from "node:path";
@@ -9,27 +10,40 @@ import { OpenAICompatibleBridge } from "./bridges/openai-compatible-bridge.js";
9
10
  import { WebhookBridge } from "./bridges/webhook-bridge.js";
10
11
  import { loadAvailableOpenClawCommands } from "./openclaw-command-discovery.js";
11
12
  import {
13
+ openInBrowserPreview,
12
14
  parsePositiveIntegerFlag,
13
15
  printPairInviteBundle,
16
+ renderInviteBundleOutput,
14
17
  runPairSession,
15
18
  } from "./pair-session.js";
16
19
  import {
17
20
  handoffForegroundPairToBackground,
18
21
  spawnBackgroundPairDaemon,
19
22
  } from "./pair-daemon.js";
23
+ import { resolvePrivateClawMediaDir } from "./invite-qr-files.js";
20
24
  import { DEFAULT_SESSION_TTL_MS, PrivateClawProvider } from "./provider.js";
21
25
  import { DEFAULT_RELAY_BASE_URL } from "./relay-defaults.js";
22
26
  import { resolveRelayEndpoints } from "./relay-endpoints.js";
23
27
  import {
28
+ buildManagedSessionQrLegacyLines,
24
29
  buildManagedSessionsReportLines,
30
+ closeManagedSessionsFromStateDir,
31
+ closeManagedSessionFromStateDir,
32
+ getManagedSessionQrBundleFromStateDir,
33
+ isManagedSessionQrLegacyResult,
25
34
  kickManagedParticipantFromStateDir,
26
35
  listManagedSessionsFromStateDir,
27
36
  PrivateClawSessionControlServer,
28
37
  resolvePrivateClawStateDir,
29
38
  } from "./session-control.js";
30
39
  import {
40
+ buildPrivateClawBackgroundDaemonReminder,
31
41
  formatBilingualInline,
42
+ PRIVATECLAW_CLI_NOTIFY_OPTION_DESCRIPTION,
32
43
  PRIVATECLAW_CLI_RELAY_OPTION_DESCRIPTION,
44
+ PRIVATECLAW_CLI_SESSIONS_KILL_DESCRIPTION,
45
+ PRIVATECLAW_CLI_SESSIONS_KILLALL_DESCRIPTION,
46
+ PRIVATECLAW_CLI_SESSIONS_QR_DESCRIPTION,
33
47
  } from "./text.js";
34
48
  import type { PrivateClawProviderHandoffState } from "./types.js";
35
49
 
@@ -240,12 +254,21 @@ async function readHandoffState(
240
254
  }
241
255
 
242
256
  function printHelp(): void {
243
- console.log(`privateclaw-provider <pair|sessions|kick>
257
+ console.log(`privateclaw-provider <pair|sessions|kick|killall>
244
258
 
245
259
  pair [--ttl-ms <ms>] [--label <label>] [--relay <url>] [--group] [--print-only] [--open] [--foreground]
246
260
  sessions
261
+ sessions qr <sessionId> [--open] [--notify]
262
+ sessions kill <sessionId>
263
+ sessions killall
264
+ killall
247
265
  kick <sessionId> <appId>`);
248
266
  console.log(`\n--relay <url>: ${PRIVATECLAW_CLI_RELAY_OPTION_DESCRIPTION}`);
267
+ console.log(`--notify: ${PRIVATECLAW_CLI_NOTIFY_OPTION_DESCRIPTION}`);
268
+ console.log(`sessions qr: ${PRIVATECLAW_CLI_SESSIONS_QR_DESCRIPTION}`);
269
+ console.log(`sessions kill: ${PRIVATECLAW_CLI_SESSIONS_KILL_DESCRIPTION}`);
270
+ console.log(`sessions killall: ${PRIVATECLAW_CLI_SESSIONS_KILLALL_DESCRIPTION}`);
271
+ console.log(`killall: ${PRIVATECLAW_CLI_SESSIONS_KILLALL_DESCRIPTION}`);
249
272
  }
250
273
 
251
274
  async function runPairCommand(args: string[]): Promise<void> {
@@ -391,8 +414,8 @@ async function runPairCommand(args: string[]): Promise<void> {
391
414
  handoffState: provider.exportHandoffState(),
392
415
  });
393
416
  return formatBilingualInline(
394
- "当前 PrivateClaw 会话已转入后台。可使用 `privateclaw-provider sessions` 查看。",
395
- "The current PrivateClaw session is now running in the background. Use `privateclaw-provider sessions` to inspect it.",
417
+ "当前 PrivateClaw 会话已转入后台。可使用 `privateclaw-provider sessions` 查看,必要时用 `privateclaw-provider sessions kill <sessionId>` 终止。",
418
+ "The current PrivateClaw session is now running in the background. Use `privateclaw-provider sessions` to inspect it, and `privateclaw-provider sessions kill <sessionId>` if you need to terminate it.",
396
419
  );
397
420
  } catch (error) {
398
421
  provider.resumeReconnectsAfterHandoffFailure();
@@ -424,9 +447,27 @@ async function runPairCommand(args: string[]): Promise<void> {
424
447
  printPairInviteBundle(bundle, (line) => {
425
448
  console.log(line);
426
449
  });
450
+ console.log(
451
+ buildPrivateClawBackgroundDaemonReminder(
452
+ "privateclaw-provider",
453
+ bundle.invite.sessionId,
454
+ ),
455
+ );
427
456
  }
428
457
 
429
458
  async function runSessionsCommand(args: string[]): Promise<void> {
459
+ if (args[0] === "qr") {
460
+ await runSessionsQrCommand(args.slice(1));
461
+ return;
462
+ }
463
+ if (args[0] === "killall") {
464
+ await runSessionsKillallCommand(args.slice(1));
465
+ return;
466
+ }
467
+ if (args[0] === "kill") {
468
+ await runSessionsKillCommand(args.slice(1));
469
+ return;
470
+ }
430
471
  const parsed = parseArgs({
431
472
  args,
432
473
  allowPositionals: true,
@@ -445,6 +486,185 @@ async function runSessionsCommand(args: string[]): Promise<void> {
445
486
  }
446
487
  }
447
488
 
489
+ async function runSessionsKillCommand(args: string[]): Promise<void> {
490
+ const parsed = parseArgs({
491
+ args,
492
+ allowPositionals: true,
493
+ options: {
494
+ help: { type: "boolean", short: "h" },
495
+ },
496
+ });
497
+ if (parsed.values.help) {
498
+ printHelp();
499
+ return;
500
+ }
501
+ const sessionId = parsed.positionals[0];
502
+ if (!sessionId) {
503
+ throw new Error(
504
+ formatBilingualInline(
505
+ "`sessions kill` 需要提供 sessionId。",
506
+ "`sessions kill` requires a sessionId.",
507
+ ),
508
+ );
509
+ }
510
+
511
+ const result = await closeManagedSessionFromStateDir({
512
+ stateDir: resolvePrivateClawStateDir(),
513
+ sessionId,
514
+ reason: "operator_terminated",
515
+ });
516
+ console.log(
517
+ result.terminatedHost
518
+ ? formatBilingualInline(
519
+ `会话 ${result.session.sessionId} 已通过终止 legacy host ${result.host.kind}#${result.host.pid} 停止。`,
520
+ `Session ${result.session.sessionId} was stopped by terminating the legacy host ${result.host.kind}#${result.host.pid}.`,
521
+ )
522
+ : formatBilingualInline(
523
+ `会话 ${result.session.sessionId} 已终止。`,
524
+ `Session ${result.session.sessionId} has been terminated.`,
525
+ ),
526
+ );
527
+ }
528
+
529
+ async function runSessionsKillallCommand(args: string[]): Promise<void> {
530
+ const parsed = parseArgs({
531
+ args,
532
+ allowPositionals: true,
533
+ options: {
534
+ help: { type: "boolean", short: "h" },
535
+ },
536
+ });
537
+ if (parsed.values.help) {
538
+ printHelp();
539
+ return;
540
+ }
541
+ if (parsed.positionals.length > 0) {
542
+ throw new Error(
543
+ formatBilingualInline(
544
+ "`sessions killall` 不接受额外参数。",
545
+ "`sessions killall` does not accept extra arguments.",
546
+ ),
547
+ );
548
+ }
549
+
550
+ const result = await closeManagedSessionsFromStateDir({
551
+ stateDir: resolvePrivateClawStateDir(),
552
+ hostKinds: ["pair-daemon"],
553
+ reason: "operator_terminated_all",
554
+ });
555
+
556
+ if (result.closed.length === 0 && result.failed.length === 0) {
557
+ console.log(
558
+ formatBilingualInline(
559
+ "当前没有需要终止的后台 daemon 会话。",
560
+ "There are no background daemon sessions to terminate.",
561
+ ),
562
+ );
563
+ return;
564
+ }
565
+
566
+ if (result.closed.length > 0) {
567
+ console.log(
568
+ formatBilingualInline(
569
+ `已终止 ${result.closed.length} 个后台 daemon 会话。`,
570
+ `Terminated ${result.closed.length} background daemon session(s).`,
571
+ ),
572
+ );
573
+ for (const item of result.closed) {
574
+ console.log(
575
+ item.terminatedHost
576
+ ? formatBilingualInline(
577
+ `- ${item.session.sessionId}:已通过终止 legacy host ${item.host.kind}#${item.host.pid} 停止。`,
578
+ `- ${item.session.sessionId}: stopped by terminating the legacy host ${item.host.kind}#${item.host.pid}.`,
579
+ )
580
+ : formatBilingualInline(
581
+ `- ${item.session.sessionId}:已终止。`,
582
+ `- ${item.session.sessionId}: terminated.`,
583
+ ),
584
+ );
585
+ }
586
+ }
587
+
588
+ if (result.failed.length > 0) {
589
+ console.error(
590
+ formatBilingualInline(
591
+ `${result.failed.length} 个后台 daemon 会话终止失败。`,
592
+ `${result.failed.length} background daemon session(s) failed to terminate.`,
593
+ ),
594
+ );
595
+ for (const item of result.failed) {
596
+ console.error(
597
+ formatBilingualInline(
598
+ `- ${item.session.sessionId}(${item.host.kind}#${item.host.pid}):${item.error}`,
599
+ `- ${item.session.sessionId} (${item.host.kind}#${item.host.pid}): ${item.error}`,
600
+ ),
601
+ );
602
+ }
603
+ process.exitCode = 1;
604
+ }
605
+ }
606
+
607
+ async function runSessionsQrCommand(args: string[]): Promise<void> {
608
+ const parsed = parseArgs({
609
+ args,
610
+ allowPositionals: true,
611
+ options: {
612
+ open: { type: "boolean", default: parseBooleanFlag(process.env.PRIVATECLAW_OPEN_QR) },
613
+ notify: { type: "boolean", default: false },
614
+ help: { type: "boolean", short: "h" },
615
+ },
616
+ });
617
+ if (parsed.values.help) {
618
+ printHelp();
619
+ return;
620
+ }
621
+ const sessionId = parsed.positionals[0];
622
+ if (!sessionId) {
623
+ throw new Error(
624
+ formatBilingualInline(
625
+ "`sessions qr` 需要提供 sessionId。",
626
+ "`sessions qr` requires a sessionId.",
627
+ ),
628
+ );
629
+ }
630
+
631
+ const result = await getManagedSessionQrBundleFromStateDir({
632
+ stateDir: resolvePrivateClawStateDir(),
633
+ sessionId,
634
+ ...(parsed.values.notify ? { notifyParticipants: true } : {}),
635
+ });
636
+ if (isManagedSessionQrLegacyResult(result)) {
637
+ for (const line of buildManagedSessionQrLegacyLines({
638
+ result,
639
+ ...(parsed.values.notify ? { notifyParticipants: true } : {}),
640
+ })) {
641
+ console.log(line);
642
+ }
643
+ if (parsed.values.open) {
644
+ await openInBrowserPreview(pathToFileURL(result.legacyPngPath).href);
645
+ }
646
+ if (parsed.values.notify) {
647
+ process.exitCode = 1;
648
+ }
649
+ return;
650
+ }
651
+ await renderInviteBundleOutput(result.bundle, {
652
+ qrMediaDir: resolvePrivateClawMediaDir(),
653
+ ...(parsed.values.open ? { openInBrowser: true } : {}),
654
+ writeLine: (line: string) => {
655
+ console.log(line);
656
+ },
657
+ });
658
+ if (parsed.values.notify) {
659
+ console.log(
660
+ formatBilingualInline(
661
+ `已向会话 ${result.session.sessionId} 中的 ${result.session.participantCount} 位参与者推送二维码。`,
662
+ `Sent the QR code to ${result.session.participantCount} participant(s) in session ${result.session.sessionId}.`,
663
+ ),
664
+ );
665
+ }
666
+ }
667
+
448
668
  async function runKickCommand(args: string[]): Promise<void> {
449
669
  const parsed = parseArgs({
450
670
  args,
@@ -497,14 +717,21 @@ const [command, ...rest] =
497
717
  ? ["pair", ...argv]
498
718
  : argv;
499
719
 
500
- if (command === "pair") {
501
- await runPairCommand(rest);
502
- } else if (command === "sessions") {
503
- await runSessionsCommand(rest);
504
- } else if (command === "kick") {
505
- await runKickCommand(rest);
506
- } else if (command === "help" || command === "--help" || command === "-h") {
507
- printHelp();
508
- } else {
509
- throw new Error(`Unsupported privateclaw-provider command: ${command}`);
720
+ try {
721
+ if (command === "pair") {
722
+ await runPairCommand(rest);
723
+ } else if (command === "sessions") {
724
+ await runSessionsCommand(rest);
725
+ } else if (command === "killall") {
726
+ await runSessionsKillallCommand(rest);
727
+ } else if (command === "kick") {
728
+ await runKickCommand(rest);
729
+ } else if (command === "help" || command === "--help" || command === "-h") {
730
+ printHelp();
731
+ } else {
732
+ throw new Error(`Unsupported privateclaw-provider command: ${command}`);
733
+ }
734
+ } catch (error) {
735
+ console.error(error instanceof Error ? error.message : String(error));
736
+ process.exitCode = 1;
510
737
  }
@@ -341,6 +341,14 @@ test("privateclaw command can override the relay per invocation", async (t) => {
341
341
  sessions?.actionHandler,
342
342
  "plugin should register the privateclaw sessions subcommand",
343
343
  );
344
+ assert.ok(
345
+ sessions?.children.get("qr")?.actionHandler,
346
+ "plugin should register the privateclaw sessions qr subcommand",
347
+ );
348
+ assert.ok(
349
+ sessions?.children.get("kill")?.actionHandler,
350
+ "plugin should register the privateclaw sessions kill subcommand",
351
+ );
344
352
 
345
353
  const printed: string[] = [];
346
354
  const originalLog = console.log;