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.
- package/dist/qr-terminal.d.ts +3 -16
- package/dist/qr-terminal.d.ts.map +1 -1
- package/dist/qr-terminal.js +26 -38
- package/dist/qr-terminal.js.map +1 -1
- package/package.json +5 -5
package/dist/qr-terminal.d.ts
CHANGED
|
@@ -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
|
|
18
|
-
/** Dark modules
|
|
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
|
|
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"}
|
package/dist/qr-terminal.js
CHANGED
|
@@ -1,49 +1,37 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
19
|
-
const
|
|
20
|
-
/**
|
|
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
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
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
|
}
|
package/dist/qr-terminal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qr-terminal.js","sourceRoot":"","sources":["../src/qr-terminal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"qr-terminal.js","sourceRoot":"","sources":["../src/qr-terminal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,uEAAuE;AACvE,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC;AACvC,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAC5C,MAAM,KAAK,GAAG,SAAS,CAAC;AACxB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAE/B,6EAA6E;AAC7E,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,IAAI,GAAG,aAAa,GAAG,CAAC,CAAC;IACxC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC7C,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACtC,MAAM,GAAG,GAAG,CAAC,GAAG,aAAa,CAAC;QAAC,MAAM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AC;AACrD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "relaymessenger",
|
|
3
|
-
"version": "0.1.10
|
|
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
|
|
35
|
-
"@relaymessenger/sdk": "0.3.4
|
|
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
|
-
"
|
|
44
|
+
"jsqr": "1.4.0",
|
|
45
45
|
"typescript": "^5.9.3",
|
|
46
46
|
"vitest": "^4.0.0"
|
|
47
47
|
},
|