relaymessenger 0.1.10-staging.0 → 0.1.10

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.
@@ -1,21 +1,8 @@
1
- /**
2
- * Compact is the only terminal QR form: two module rows per text line keep
3
- * the phone step small even in a tall terminal. References in the Relay hub:
4
- * _sources/hermes-agent/scripts/whatsapp-bridge/bridge.js:425-433 uses small:true;
5
- * _sources/native-connect/openclaw/src/media/qr-terminal.ts:9-61 uses half-blocks
6
- * with a one-module margin.
7
- *
8
- * Every cell uses an upper half block with the top module's foreground and
9
- * bottom module's background, so line gaps take the bottom module's colour.
10
- * Both colours are fixed points of the 256-colour cube (231 and 16), not the
11
- * theme-dependent ANSI 47 and 40.
12
- */
13
- export declare const QR_LIGHT = "\u001B[48;5;231m";
1
+ /** Fixed black/white rather than the terminal theme's ANSI palette. */
14
2
  export declare const QR_DARK = "\u001B[48;5;16m";
15
- /** The same two cube colours as foregrounds, for the top module of a compact cell. */
16
3
  export declare const QR_LIGHT_FG = "\u001B[38;5;231m";
17
- export declare const QR_DARK_FG = "\u001B[38;5;16m";
18
- /** Dark modules as rows, with a one-module light quiet zone on every edge. */
4
+ export declare const QR_QUIET_ZONE = 4;
5
+ /** Dark modules, surrounded by the four-module quiet zone required by QR. */
19
6
  export declare function terminalQRGrid(value: string): boolean[][];
20
7
  /** The whole code in compact form, with a trailing newline for stdout. */
21
8
  export declare function renderTerminalQR(value: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"qr-terminal.d.ts","sourceRoot":"","sources":["../src/qr-terminal.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,qBAAmB,CAAC;AACzC,eAAO,MAAM,OAAO,oBAAkB,CAAC;AACvC,sFAAsF;AACtF,eAAO,MAAM,WAAW,qBAAmB,CAAC;AAC5C,eAAO,MAAM,UAAU,oBAAkB,CAAC;AAO1C,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,EAAE,CASzD;AAqBD,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD"}
1
+ {"version":3,"file":"qr-terminal.d.ts","sourceRoot":"","sources":["../src/qr-terminal.ts"],"names":[],"mappings":"AAEA,uEAAuE;AACvE,eAAO,MAAM,OAAO,oBAAkB,CAAC;AACvC,eAAO,MAAM,WAAW,qBAAmB,CAAC;AAE5C,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,EAAE,CAWzD;AAqBD,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD"}
@@ -1,49 +1,37 @@
1
- import { create } from "qrcode";
2
- /**
3
- * Compact is the only terminal QR form: two module rows per text line keep
4
- * the phone step small even in a tall terminal. References in the Relay hub:
5
- * _sources/hermes-agent/scripts/whatsapp-bridge/bridge.js:425-433 uses small:true;
6
- * _sources/native-connect/openclaw/src/media/qr-terminal.ts:9-61 uses half-blocks
7
- * with a one-module margin.
8
- *
9
- * Every cell uses an upper half block with the top module's foreground and
10
- * bottom module's background, so line gaps take the bottom module's colour.
11
- * Both colours are fixed points of the 256-colour cube (231 and 16), not the
12
- * theme-dependent ANSI 47 and 40.
13
- */
14
- export const QR_LIGHT = "\x1b[48;5;231m";
1
+ import { toQR } from "toqr";
2
+ /** Fixed black/white rather than the terminal theme's ANSI palette. */
15
3
  export const QR_DARK = "\x1b[48;5;16m";
16
- /** The same two cube colours as foregrounds, for the top module of a compact cell. */
17
4
  export const QR_LIGHT_FG = "\x1b[38;5;231m";
18
- export const QR_DARK_FG = "\x1b[38;5;16m";
19
- const RESET = "";
20
- /** Upper half block: the glyph paints the top module, the background paints the bottom one. */
21
- const UPPER_HALF = "▀";
22
- /** Dark modules as rows, with a one-module light quiet zone on every edge. */
5
+ const RESET = "\x1b[0m";
6
+ export const QR_QUIET_ZONE = 4;
7
+ /** Dark modules, surrounded by the four-module quiet zone required by QR. */
23
8
  export function terminalQRGrid(value) {
24
- const { size, data } = create(value).modules;
25
- const quiet = () => Array.from({ length: size + 2 }, () => false);
26
- return [
27
- quiet(),
28
- ...Array.from({ length: size }, (_, y) => [false, ...Array.from({ length: size }, (_, x) => Boolean(data[y * size + x])), false]),
29
- quiet(),
30
- ];
9
+ const data = toQR(value);
10
+ const size = Math.sqrt(data.length);
11
+ const extent = size + QR_QUIET_ZONE * 2;
12
+ return Array.from({ length: extent }, (_, y) => Array.from({ length: extent }, (_, x) => {
13
+ const row = y - QR_QUIET_ZONE;
14
+ const column = x - QR_QUIET_ZONE;
15
+ return row >= 0 && column >= 0 && row < size && column < size
16
+ ? Boolean(data[row * size + column])
17
+ : false;
18
+ }));
31
19
  }
32
20
  /**
33
- * Two module rows per text line, every cell painted with both colours: the
34
- * foreground is the top module, the background is the bottom module. The row
35
- * count is padded even with a light row, because an odd count ends the code on
36
- * a lone half-block row that reads as cut off (the defect the 2026-09-09
37
- * renderer fixed).
21
+ * Expo's compact strategy: choose a full/half block or a space for each pair
22
+ * of module rows. One color pair per line, not two color changes per cell.
23
+ * Reference: expo/expo packages/@expo/cli/src/utils/qr.ts at f6f5af06b95c.
24
+ * Keep the one-column BMP glyphs on every terminal; no font-specific sextants.
38
25
  */
39
26
  function renderCompact(grid) {
40
- const rows = grid.length % 2 ? [...grid, grid[0].map(() => false)] : [...grid];
41
27
  const lines = [];
42
- for (let y = 0; y < rows.length; y += 2) {
43
- const top = rows[y] ?? [];
44
- const bottom = rows[y + 1] ?? [];
45
- const cells = top.map((dark, x) => `${dark ? QR_DARK_FG : QR_LIGHT_FG}${bottom[x] ? QR_DARK : QR_LIGHT}${UPPER_HALF}`);
46
- lines.push(cells.join("") + RESET);
28
+ const glyphs = ["█", "▀", "▄", " "];
29
+ for (let y = 0; y < grid.length; y += 2) {
30
+ const row = grid[y].map((top, x) => {
31
+ const bottom = grid[y + 1]?.[x] ?? false;
32
+ return glyphs[(Number(top) << 1) | Number(bottom)];
33
+ }).join("");
34
+ lines.push(QR_DARK + QR_LIGHT_FG + row + RESET);
47
35
  }
48
36
  return lines.join("\n");
49
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"qr-terminal.js","sourceRoot":"","sources":["../src/qr-terminal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AACzC,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC;AACvC,sFAAsF;AACtF,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAC5C,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;AAC1C,MAAM,KAAK,GAAG,MAAM,CAAC;AACrB,+FAA+F;AAC/F,MAAM,UAAU,GAAG,GAAG,CAAC;AAIvB,8EAA8E;AAC9E,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,OAAoB,CAAC;IAC1D,MAAM,KAAK,GAAG,GAAc,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IAC7E,OAAO;QACL,KAAK,EAAE;QACP,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACvC,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAA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CAAC;IAC3B,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;IAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;YAClC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;YACzC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACZ,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,WAAW,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,OAAO,GAAG,aAAa,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;AACrD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relaymessenger",
3
- "version": "0.1.10-staging.0",
3
+ "version": "0.1.10",
4
4
  "description": "Official command-line client for Relay v1 resources.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,17 +31,17 @@
31
31
  "@agentclientprotocol/sdk": "1.4.0",
32
32
  "@anthropic-ai/claude-agent-sdk": "0.3.239",
33
33
  "@clack/prompts": "1.8.0",
34
- "@relaymessenger/pi": "0.1.2-staging.0",
35
- "@relaymessenger/sdk": "0.3.4-staging.0",
34
+ "@relaymessenger/pi": "0.1.2",
35
+ "@relaymessenger/sdk": "0.3.4",
36
36
  "@vercel/detect-agent": "1.2.5",
37
37
  "commander": "^15.0.0",
38
- "qrcode": "1.5.4",
39
38
  "smol-toml": "^1.8.0",
39
+ "toqr": "0.1.1",
40
40
  "yaml": "^2.8.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^22.18.0",
44
- "@types/qrcode": "1.5.5",
44
+ "jsqr": "1.4.0",
45
45
  "typescript": "^5.9.3",
46
46
  "vitest": "^4.0.0"
47
47
  },