@hmharness/kernel 0.18.14 → 0.18.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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/qrcode.d.ts +22 -0
- package/dist/qrcode.js +29 -0
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/qrcode.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hmharness/kernel - qrcode
|
|
3
|
+
* QR Code generation facade. The kernel itself stays zero-dependency; the
|
|
4
|
+
* web/cli packages pull in the `qrcode` npm lib and call through these
|
|
5
|
+
* typed wrappers. When the lib is absent (pure-kernel consumers), the
|
|
6
|
+
* functions throw with a clear message instead of crashing.
|
|
7
|
+
*
|
|
8
|
+
* The previous hand-rolled encoder had format-info and data-placement bugs
|
|
9
|
+
* that made codes unscannable by every phone QR reader (2026-09-29 lesson:
|
|
10
|
+
* QR spec is 100+ pages of exact bit placement - use a proven library).
|
|
11
|
+
*/
|
|
12
|
+
export interface QrOutput {
|
|
13
|
+
/** ASCII art for terminal display (half-block Unicode). */
|
|
14
|
+
terminal: string;
|
|
15
|
+
/** SVG string for web display. */
|
|
16
|
+
svg: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Generate QR code output for a text (typically a URL).
|
|
20
|
+
* Requires the `qrcode` npm package to be installed in the consuming package.
|
|
21
|
+
*/
|
|
22
|
+
export declare function generateQr(text: string): Promise<QrOutput>;
|
package/dist/qrcode.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hmharness/kernel - qrcode
|
|
3
|
+
* QR Code generation facade. The kernel itself stays zero-dependency; the
|
|
4
|
+
* web/cli packages pull in the `qrcode` npm lib and call through these
|
|
5
|
+
* typed wrappers. When the lib is absent (pure-kernel consumers), the
|
|
6
|
+
* functions throw with a clear message instead of crashing.
|
|
7
|
+
*
|
|
8
|
+
* The previous hand-rolled encoder had format-info and data-placement bugs
|
|
9
|
+
* that made codes unscannable by every phone QR reader (2026-09-29 lesson:
|
|
10
|
+
* QR spec is 100+ pages of exact bit placement - use a proven library).
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Generate QR code output for a text (typically a URL).
|
|
14
|
+
* Requires the `qrcode` npm package to be installed in the consuming package.
|
|
15
|
+
*/
|
|
16
|
+
export async function generateQr(text) {
|
|
17
|
+
let QR;
|
|
18
|
+
try {
|
|
19
|
+
QR = (await import('qrcode'));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
throw new Error('qrcode package not installed - run: npm install qrcode');
|
|
23
|
+
}
|
|
24
|
+
const [terminal, svg] = await Promise.all([
|
|
25
|
+
QR.toString(text, { type: 'terminal', small: true, margin: 1 }),
|
|
26
|
+
QR.toString(text, { type: 'svg', margin: 2, width: 240 }),
|
|
27
|
+
]);
|
|
28
|
+
return { terminal, svg };
|
|
29
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -137,6 +137,10 @@ export interface HmhConfig {
|
|
|
137
137
|
* then via the X-Hmh-Key header (SSE cannot set custom headers, so the
|
|
138
138
|
* page keeps the key in sessionStorage and appends it to /api/events). */
|
|
139
139
|
token?: string;
|
|
140
|
+
/** Internet tunnel intent (cloudflared Quick Tunnel / pinggy). Set from
|
|
141
|
+
* the pairing modal; on restart the server brings the tunnel back so
|
|
142
|
+
* previously printed QR URLs do not rot into Cloudflare 1033 pages. */
|
|
143
|
+
tunnel?: boolean;
|
|
140
144
|
};
|
|
141
145
|
/** Per-purpose provider names resolved against `providers`. */
|
|
142
146
|
routing?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hmharness/kernel",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.15",
|
|
4
4
|
"description": "hmharness kernel: tool registry, provider adapters, the agent loop, session log, config. Zero runtime dependencies (Node >=22 native fetch).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|