@privateclaw/privateclaw 0.1.4 → 0.1.8

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.
@@ -11,6 +11,8 @@ import { createRelayServer } from "../../../services/relay-server/src/relay-serv
11
11
  import { EchoBridge } from "./bridges/echo-bridge.js";
12
12
  import { DEFAULT_SESSION_TTL_MS, PrivateClawProvider } from "./provider.js";
13
13
 
14
+ const PNG_SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
15
+
14
16
  function waitForOpen(socket: WebSocket): Promise<void> {
15
17
  return new Promise((resolve, reject) => {
16
18
  socket.once("open", () => resolve());
@@ -204,6 +206,10 @@ test("provider creates one-time invites and replies through the encrypted relay"
204
206
  JSON.stringify(capabilities.commands),
205
207
  /renew-session/,
206
208
  );
209
+ assert.match(
210
+ JSON.stringify(capabilities.commands),
211
+ /session-qr/,
212
+ );
207
213
 
208
214
  appSocket.send(
209
215
  JSON.stringify({
@@ -229,6 +235,130 @@ test("provider creates one-time invites and replies through the encrypted relay"
229
235
  await waitForClose(appSocket);
230
236
  });
231
237
 
238
+ test("provider returns the current session QR only to the requesting participant", async (t) => {
239
+ const relay = createRelayServer({
240
+ host: "127.0.0.1",
241
+ port: 0,
242
+ sessionTtlMs: 60_000,
243
+ frameCacheSize: 8,
244
+ });
245
+ const { port } = await relay.start();
246
+ t.after(async () => {
247
+ await relay.stop();
248
+ });
249
+
250
+ const provider = new PrivateClawProvider({
251
+ providerWsUrl: `ws://127.0.0.1:${port}/ws/provider`,
252
+ appWsUrl: `ws://127.0.0.1:${port}/ws/app`,
253
+ bridge: new GroupBridge(),
254
+ defaultTtlMs: DEFAULT_SESSION_TTL_MS,
255
+ });
256
+ await provider.connect();
257
+ t.after(async () => {
258
+ await provider.dispose();
259
+ });
260
+
261
+ const inviteBundle = await provider.createInviteBundle({ groupMode: true });
262
+ const invite = decodeInviteString(inviteBundle.inviteUri);
263
+
264
+ const appOneUrl = new URL(invite.appWsUrl);
265
+ appOneUrl.searchParams.set("appId", "app-one");
266
+ const appOne = new WebSocket(appOneUrl.toString());
267
+ const appOneAttached = nextMessage(appOne);
268
+ await waitForOpen(appOne);
269
+ assert.equal((await appOneAttached).type, "relay:attached");
270
+ const appOneInitialFrames = nextMessages(appOne, 3);
271
+ appOne.send(
272
+ JSON.stringify({
273
+ type: "app:frame",
274
+ envelope: encryptPayload({
275
+ sessionId: invite.sessionId,
276
+ sessionKey: invite.sessionKey,
277
+ payload: {
278
+ kind: "client_hello",
279
+ appId: "app-one",
280
+ displayName: "SolarFox",
281
+ appVersion: "flutter-test",
282
+ deviceLabel: "Tester One",
283
+ sentAt: new Date().toISOString(),
284
+ },
285
+ }),
286
+ }),
287
+ );
288
+ await appOneInitialFrames;
289
+
290
+ const appTwoUrl = new URL(invite.appWsUrl);
291
+ appTwoUrl.searchParams.set("appId", "app-two");
292
+ const appTwo = new WebSocket(appTwoUrl.toString());
293
+ const appTwoAttached = nextMessage(appTwo);
294
+ await waitForOpen(appTwo);
295
+ assert.equal((await appTwoAttached).type, "relay:attached");
296
+ const appTwoInitialFrames = nextMessages(appTwo, 3);
297
+ const appOneJoinFrames = nextMessages(appOne, 2);
298
+ appTwo.send(
299
+ JSON.stringify({
300
+ type: "app:frame",
301
+ envelope: encryptPayload({
302
+ sessionId: invite.sessionId,
303
+ sessionKey: invite.sessionKey,
304
+ payload: {
305
+ kind: "client_hello",
306
+ appId: "app-two",
307
+ displayName: "RiverCat",
308
+ appVersion: "flutter-test",
309
+ deviceLabel: "Tester Two",
310
+ sentAt: new Date().toISOString(),
311
+ },
312
+ }),
313
+ }),
314
+ );
315
+ await Promise.all([appTwoInitialFrames, appOneJoinFrames]);
316
+
317
+ const appOneQrFramesPromise = nextMessages(appOne, 1);
318
+ appOne.send(
319
+ JSON.stringify({
320
+ type: "app:frame",
321
+ envelope: encryptPayload({
322
+ sessionId: invite.sessionId,
323
+ sessionKey: invite.sessionKey,
324
+ payload: {
325
+ kind: "user_message",
326
+ appId: "app-one",
327
+ text: "/session-qr",
328
+ clientMessageId: "session-qr-1",
329
+ sentAt: new Date().toISOString(),
330
+ },
331
+ }),
332
+ }),
333
+ );
334
+
335
+ const [appOneQrFrames] = await Promise.all([
336
+ appOneQrFramesPromise,
337
+ waitForNoMessage(appTwo),
338
+ ]);
339
+ const qrPayload = decryptRelayPayload(appOneQrFrames[0]!, invite);
340
+ assert.equal(qrPayload.kind, "assistant_message");
341
+ assert.equal(qrPayload.replyTo, "session-qr-1");
342
+ assert.match(qrPayload.text, /二维码|QR/i);
343
+ assert.equal(qrPayload.attachments?.length, 1);
344
+ const qrAttachment = qrPayload.attachments?.[0];
345
+ assert.ok(qrAttachment);
346
+ assert.equal(qrAttachment.mimeType, "image/png");
347
+ assert.equal(qrAttachment.name, `privateclaw-${invite.sessionId}.png`);
348
+ assert.ok(qrAttachment.dataBase64);
349
+ assert.deepEqual(
350
+ Buffer.from(qrAttachment.dataBase64, "base64").subarray(
351
+ 0,
352
+ PNG_SIGNATURE.length,
353
+ ),
354
+ PNG_SIGNATURE,
355
+ );
356
+
357
+ appOne.close();
358
+ appTwo.close();
359
+ await Promise.all([waitForClose(appOne), waitForClose(appTwo)]);
360
+ });
361
+
232
362
  test("provider renews the session key and keeps the chat usable after re-handshake", async (t) => {
233
363
  const relay = createRelayServer({
234
364
  host: "127.0.0.1",
package/src/provider.ts CHANGED
@@ -13,6 +13,8 @@ import {
13
13
  import QRCode from "qrcode";
14
14
  import {
15
15
  PRIVATECLAW_QR_ERROR_CORRECTION_LEVEL,
16
+ PRIVATECLAW_QR_IMAGE_MARGIN,
17
+ PRIVATECLAW_QR_PNG_WIDTH,
16
18
  PRIVATECLAW_QR_SVG_MARGIN,
17
19
  PRIVATECLAW_QR_TERMINAL_MARGIN,
18
20
  } from "./qr-options.js";
@@ -23,6 +25,7 @@ import {
23
25
  formatBilingualText,
24
26
  PRIVATECLAW_MUTE_BOT_DESCRIPTION,
25
27
  PRIVATECLAW_RENEW_SESSION_DESCRIPTION,
28
+ PRIVATECLAW_SESSION_QR_DESCRIPTION,
26
29
  PRIVATECLAW_UNMUTE_BOT_DESCRIPTION,
27
30
  } from "./text.js";
28
31
  import type {
@@ -156,6 +159,27 @@ function buildRenewalReminderMessage(session: ProviderSessionState): string {
156
159
  );
157
160
  }
158
161
 
162
+ function buildSessionQrMessage(session: ProviderSessionState): string {
163
+ if (session.groupMode) {
164
+ return formatBilingualText(
165
+ `当前 PrivateClaw 群聊二维码已附上。请在 ${session.invite.expiresAt} 之前当面分享给需要加入此会话的设备。`,
166
+ `The current PrivateClaw group-session QR is attached. Share it in person with devices that should join before ${session.invite.expiresAt}.`,
167
+ );
168
+ }
169
+
170
+ return formatBilingualText(
171
+ `当前 PrivateClaw 会话二维码已附上。请在 ${session.invite.expiresAt} 之前当面分享给需要连接的设备。`,
172
+ `The current PrivateClaw session QR is attached. Share it in person with devices that should connect before ${session.invite.expiresAt}.`,
173
+ );
174
+ }
175
+
176
+ function buildSessionQrFailureMessage(details: string): string {
177
+ return formatBilingualInline(
178
+ `生成当前会话二维码失败:${details}`,
179
+ `Failed to render the current session QR: ${details}`,
180
+ );
181
+ }
182
+
159
183
  function normalizeBridgeText(response: BridgeResponse): string {
160
184
  if (typeof response === "string") {
161
185
  return response;
@@ -785,6 +809,12 @@ export class PrivateClawProvider {
785
809
  acceptsArgs: false,
786
810
  source: "privateclaw",
787
811
  },
812
+ {
813
+ slash: "/session-qr",
814
+ description: PRIVATECLAW_SESSION_QR_DESCRIPTION,
815
+ acceptsArgs: false,
816
+ source: "privateclaw",
817
+ },
788
818
  ];
789
819
 
790
820
  if (session.groupMode) {
@@ -1023,6 +1053,11 @@ export class PrivateClawProvider {
1023
1053
  this.options.onLog?.(
1024
1054
  `[provider] user_message session=${sessionId} textChars=${payload.text.length} attachments=${payload.attachments?.length ?? 0}`,
1025
1055
  );
1056
+ for (const attachment of payload.attachments ?? []) {
1057
+ this.options.onLog?.(
1058
+ `[provider] attachment_in session=${sessionId} name=${JSON.stringify(attachment.name)} mimeType=${attachment.mimeType} sizeBytes=${attachment.sizeBytes} hasData=${Boolean(attachment.dataBase64?.trim())} hasUri=${Boolean(attachment.uri?.trim())}`,
1059
+ );
1060
+ }
1026
1061
 
1027
1062
  const participant =
1028
1063
  (payload.appId ? session.participants.get(payload.appId) : undefined) ??
@@ -1037,6 +1072,8 @@ export class PrivateClawProvider {
1037
1072
  const hasRenewCommandArgs =
1038
1073
  normalizedCommand.startsWith("/renew-session ") ||
1039
1074
  normalizedCommand.startsWith("/session_renew ");
1075
+ const isSessionQrCommand = normalizedCommand === "/session-qr";
1076
+ const hasSessionQrArgs = normalizedCommand.startsWith("/session-qr ");
1040
1077
  const isMuteBotCommand = normalizedCommand === "/mute-bot";
1041
1078
  const hasMuteBotArgs = normalizedCommand.startsWith("/mute-bot ");
1042
1079
  const isUnmuteBotCommand = normalizedCommand === "/unmute-bot";
@@ -1075,6 +1112,74 @@ export class PrivateClawProvider {
1075
1112
  return;
1076
1113
  }
1077
1114
 
1115
+ if (isSessionQrCommand) {
1116
+ if ((payload.attachments?.length ?? 0) > 0) {
1117
+ await this.sendSystemMessage(
1118
+ sessionId,
1119
+ buildCommandDoesNotAcceptAttachmentsMessage("/session-qr"),
1120
+ "error",
1121
+ payload.clientMessageId,
1122
+ participant
1123
+ ? {
1124
+ targetAppId: participant.appId,
1125
+ storeHistory: false,
1126
+ }
1127
+ : undefined,
1128
+ );
1129
+ return;
1130
+ }
1131
+ if (session.groupMode && !participant) {
1132
+ await this.sendSystemMessage(
1133
+ sessionId,
1134
+ buildMissingParticipantIdentityMessage(),
1135
+ "error",
1136
+ payload.clientMessageId,
1137
+ );
1138
+ return;
1139
+ }
1140
+ try {
1141
+ const qrAttachment = await this.buildSessionQrAttachment(sessionId);
1142
+ await this.sendAssistantMessage(sessionId, {
1143
+ text: buildSessionQrMessage(session),
1144
+ replyTo: payload.clientMessageId,
1145
+ attachments: [qrAttachment],
1146
+ ...(participant ? { targetAppId: participant.appId } : {}),
1147
+ storeHistory: false,
1148
+ });
1149
+ } catch (error) {
1150
+ await this.sendSystemMessage(
1151
+ sessionId,
1152
+ buildSessionQrFailureMessage(
1153
+ error instanceof Error ? error.message : String(error),
1154
+ ),
1155
+ "error",
1156
+ payload.clientMessageId,
1157
+ participant
1158
+ ? {
1159
+ targetAppId: participant.appId,
1160
+ storeHistory: false,
1161
+ }
1162
+ : undefined,
1163
+ );
1164
+ }
1165
+ return;
1166
+ }
1167
+ if (hasSessionQrArgs) {
1168
+ await this.sendSystemMessage(
1169
+ sessionId,
1170
+ buildCommandDoesNotAcceptArgumentsMessage("/session-qr"),
1171
+ "error",
1172
+ payload.clientMessageId,
1173
+ participant
1174
+ ? {
1175
+ targetAppId: participant.appId,
1176
+ storeHistory: false,
1177
+ }
1178
+ : undefined,
1179
+ );
1180
+ return;
1181
+ }
1182
+
1078
1183
  if (isMuteBotCommand || isUnmuteBotCommand) {
1079
1184
  const command = isMuteBotCommand ? "/mute-bot" : "/unmute-bot";
1080
1185
  if ((payload.attachments?.length ?? 0) > 0) {
@@ -1205,6 +1310,14 @@ export class PrivateClawProvider {
1205
1310
  });
1206
1311
 
1207
1312
  for (const message of normalizeBridgeMessages(bridgeResponse)) {
1313
+ this.options.onLog?.(
1314
+ `[provider] bridge_message_out session=${sessionId} textChars=${message.text.length} attachments=${message.attachments?.length ?? 0}`,
1315
+ );
1316
+ for (const attachment of message.attachments ?? []) {
1317
+ this.options.onLog?.(
1318
+ `[provider] attachment_out session=${sessionId} name=${JSON.stringify(attachment.name)} mimeType=${attachment.mimeType} sizeBytes=${attachment.sizeBytes} hasData=${Boolean(attachment.dataBase64?.trim())}`,
1319
+ );
1320
+ }
1208
1321
  await this.sendAssistantMessage(sessionId, {
1209
1322
  text: message.text,
1210
1323
  replyTo: payload.clientMessageId,
@@ -1304,7 +1417,16 @@ export class PrivateClawProvider {
1304
1417
  state: "awaiting_hello",
1305
1418
  });
1306
1419
  this.scheduleRenewalReminder(sessionId);
1420
+ return this.buildInviteBundleForInvite(invite);
1421
+ }
1422
+
1423
+ decodeInvite(uri: string): PrivateClawInvite {
1424
+ return decodeInviteString(uri);
1425
+ }
1307
1426
 
1427
+ private async buildInviteBundleForInvite(
1428
+ invite: PrivateClawInvite,
1429
+ ): Promise<PrivateClawInviteBundle> {
1308
1430
  const inviteUri = encodeInviteToUri(invite);
1309
1431
  const qrSvg = await QRCode.toString(inviteUri, {
1310
1432
  type: "svg",
@@ -1323,14 +1445,29 @@ export class PrivateClawProvider {
1323
1445
  qrSvg,
1324
1446
  qrTerminal,
1325
1447
  announcementText: buildInviteAnnouncementText({
1326
- sessionId,
1327
- expiresAt,
1328
- groupMode,
1448
+ sessionId: invite.sessionId,
1449
+ expiresAt: invite.expiresAt,
1450
+ groupMode: invite.groupMode === true,
1329
1451
  }),
1330
1452
  };
1331
1453
  }
1332
1454
 
1333
- decodeInvite(uri: string): PrivateClawInvite {
1334
- return decodeInviteString(uri);
1455
+ private async buildSessionQrAttachment(sessionId: string): Promise<PrivateClawAttachment> {
1456
+ const session = this.requireSession(sessionId);
1457
+ const bundle = await this.buildInviteBundleForInvite(session.invite);
1458
+ const pngBuffer = await QRCode.toBuffer(bundle.inviteUri, {
1459
+ type: "png",
1460
+ errorCorrectionLevel: PRIVATECLAW_QR_ERROR_CORRECTION_LEVEL,
1461
+ margin: PRIVATECLAW_QR_IMAGE_MARGIN,
1462
+ width: PRIVATECLAW_QR_PNG_WIDTH,
1463
+ });
1464
+
1465
+ return {
1466
+ id: buildMessageId("attachment"),
1467
+ name: `privateclaw-${bundle.invite.sessionId}.png`,
1468
+ mimeType: "image/png",
1469
+ sizeBytes: pngBuffer.length,
1470
+ dataBase64: pngBuffer.toString("base64"),
1471
+ };
1335
1472
  }
1336
1473
  }
package/src/text.ts CHANGED
@@ -107,6 +107,11 @@ export const PRIVATECLAW_RENEW_SESSION_DESCRIPTION = formatBilingualInline(
107
107
  "Rotate the current PrivateClaw session key and extend this session by 8 hours.",
108
108
  );
109
109
 
110
+ export const PRIVATECLAW_SESSION_QR_DESCRIPTION = formatBilingualInline(
111
+ "重新打印当前 PrivateClaw 会话二维码,便于当面分享。",
112
+ "Show the current PrivateClaw session QR again for in-person sharing.",
113
+ );
114
+
110
115
  export const PRIVATECLAW_MUTE_BOT_DESCRIPTION = formatBilingualInline(
111
116
  "在当前群聊中暂停机器人参与回复。",
112
117
  "Pause bot replies in this group chat.",
package/src/types.ts CHANGED
@@ -24,7 +24,12 @@ export type BridgeMessage =
24
24
  attachments?: PrivateClawAttachment[];
25
25
  };
26
26
 
27
- export type BridgeResponse = string | { messages: BridgeMessage[] };
27
+ export interface BridgeResponseEnvelope {
28
+ messages: BridgeMessage[];
29
+ data?: unknown;
30
+ }
31
+
32
+ export type BridgeResponse = string | BridgeResponseEnvelope;
28
33
 
29
34
  export interface PrivateClawAgentBridge {
30
35
  handleUserMessage(params: {
@@ -1,7 +0,0 @@
1
- interface QrModules {
2
- readonly size: number;
3
- get(x: number, y: number): boolean | number;
4
- }
5
- export declare function renderTerminalQr(value: string): string;
6
- export declare function renderQrModulesAsBraille(modules: QrModules, margin?: number): string;
7
- export {};
@@ -1,44 +0,0 @@
1
- import QRCode from "qrcode";
2
- import { PRIVATECLAW_QR_ERROR_CORRECTION_LEVEL, PRIVATECLAW_QR_TERMINAL_MARGIN, } from "./qr-options.js";
3
- const ANSI_QR_PREFIX = "\u001b[47m\u001b[30m";
4
- const ANSI_QR_SUFFIX = "\u001b[0m";
5
- const BRAILLE_BASE = 0x2800;
6
- export function renderTerminalQr(value) {
7
- const qr = QRCode.create(value, {
8
- errorCorrectionLevel: PRIVATECLAW_QR_ERROR_CORRECTION_LEVEL,
9
- });
10
- return renderQrModulesAsBraille(qr.modules, PRIVATECLAW_QR_TERMINAL_MARGIN);
11
- }
12
- export function renderQrModulesAsBraille(modules, margin = 0) {
13
- const width = modules.size + margin * 2;
14
- const height = modules.size + margin * 2;
15
- const lines = [];
16
- for (let y = 0; y < height; y += 4) {
17
- let line = "";
18
- for (let x = 0; x < width; x += 2) {
19
- const bits = (readModule(modules, x, y, margin) ? 0x01 : 0) |
20
- (readModule(modules, x, y + 1, margin) ? 0x02 : 0) |
21
- (readModule(modules, x, y + 2, margin) ? 0x04 : 0) |
22
- (readModule(modules, x + 1, y, margin) ? 0x08 : 0) |
23
- (readModule(modules, x + 1, y + 1, margin) ? 0x10 : 0) |
24
- (readModule(modules, x + 1, y + 2, margin) ? 0x20 : 0) |
25
- (readModule(modules, x, y + 3, margin) ? 0x40 : 0) |
26
- (readModule(modules, x + 1, y + 3, margin) ? 0x80 : 0);
27
- line += bits === 0 ? " " : String.fromCodePoint(BRAILLE_BASE + bits);
28
- }
29
- lines.push(`${ANSI_QR_PREFIX}${line}${ANSI_QR_SUFFIX}`);
30
- }
31
- return lines.join("\n");
32
- }
33
- function readModule(modules, x, y, margin) {
34
- const moduleX = x - margin;
35
- const moduleY = y - margin;
36
- if (moduleX < 0 ||
37
- moduleY < 0 ||
38
- moduleX >= modules.size ||
39
- moduleY >= modules.size) {
40
- return false;
41
- }
42
- return Boolean(modules.get(moduleX, moduleY));
43
- }
44
- //# sourceMappingURL=qr-terminal-render.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"qr-terminal-render.js","sourceRoot":"","sources":["../src/qr-terminal-render.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EACL,qCAAqC,EACrC,8BAA8B,GAC/B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAC9C,MAAM,cAAc,GAAG,WAAW,CAAC;AACnC,MAAM,YAAY,GAAG,MAAM,CAAC;AAO5B,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QAC9B,oBAAoB,EAAE,qCAAqC;KAC5D,CAAC,CAAC;IACH,OAAO,wBA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