@privateclaw/privateclaw 0.1.4 → 0.1.6

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/src/provider.ts CHANGED
@@ -1023,6 +1023,11 @@ export class PrivateClawProvider {
1023
1023
  this.options.onLog?.(
1024
1024
  `[provider] user_message session=${sessionId} textChars=${payload.text.length} attachments=${payload.attachments?.length ?? 0}`,
1025
1025
  );
1026
+ for (const attachment of payload.attachments ?? []) {
1027
+ this.options.onLog?.(
1028
+ `[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())}`,
1029
+ );
1030
+ }
1026
1031
 
1027
1032
  const participant =
1028
1033
  (payload.appId ? session.participants.get(payload.appId) : undefined) ??
@@ -1205,6 +1210,14 @@ export class PrivateClawProvider {
1205
1210
  });
1206
1211
 
1207
1212
  for (const message of normalizeBridgeMessages(bridgeResponse)) {
1213
+ this.options.onLog?.(
1214
+ `[provider] bridge_message_out session=${sessionId} textChars=${message.text.length} attachments=${message.attachments?.length ?? 0}`,
1215
+ );
1216
+ for (const attachment of message.attachments ?? []) {
1217
+ this.options.onLog?.(
1218
+ `[provider] attachment_out session=${sessionId} name=${JSON.stringify(attachment.name)} mimeType=${attachment.mimeType} sizeBytes=${attachment.sizeBytes} hasData=${Boolean(attachment.dataBase64?.trim())}`,
1219
+ );
1220
+ }
1208
1221
  await this.sendAssistantMessage(sessionId, {
1209
1222
  text: message.text,
1210
1223
  replyTo: payload.clientMessageId,
@@ -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-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