@flyingrobots/bijou-node 1.8.0 → 3.0.0
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/README.md +9 -5
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/recorder.d.ts +41 -0
- package/dist/recorder.d.ts.map +1 -0
- package/dist/recorder.js +213 -0
- package/dist/recorder.js.map +1 -0
- package/dist/runtime.d.ts +9 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +22 -0
- package/dist/runtime.js.map +1 -1
- package/dist/style.js +4 -1
- package/dist/style.js.map +1 -1
- package/dist/worker/fixtures/echo-worker.d.ts +2 -0
- package/dist/worker/fixtures/echo-worker.d.ts.map +1 -0
- package/dist/worker/fixtures/echo-worker.js +13 -0
- package/dist/worker/fixtures/echo-worker.js.map +1 -0
- package/dist/worker/worker.d.ts +87 -0
- package/dist/worker/worker.d.ts.map +1 -0
- package/dist/worker/worker.js +259 -0
- package/dist/worker/worker.js.map +1 -0
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
# @flyingrobots/bijou-node
|
|
2
2
|
|
|
3
|
-
Node.js
|
|
3
|
+
Node.js adapters and runtime utilities for Bijou.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This package bridges the pure `@flyingrobots/bijou` core and the `@flyingrobots/bijou-tui` runtime to the Node.js environment. It owns runtime detection, terminal I/O, Chalk-backed styling, worker-thread helpers, and the native V3 demo recorder.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## What's New in v3.0.0
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
9
|
+
- **Worker runtime support** — `runInWorker()` and `startWorkerApp()` let TEA apps move heavy update work off the main thread while keeping input and rendering responsive.
|
|
10
|
+
- **Native demo recorder** — V3 flagship demos can now be recorded directly from captured `Surface[]` frames with `recordDemoGif()`.
|
|
11
|
+
- **Node boundary stays explicit** — runtime facts, I/O, and styling remain behind the port interfaces instead of leaking `process`, `readline`, or Chalk into the pure packages.
|
|
11
12
|
|
|
12
13
|
## Install
|
|
13
14
|
|
|
@@ -35,6 +36,8 @@ console.log(headerBox('My CLI', { detail: 'v1.0.0' }));
|
|
|
35
36
|
- **Interactive terminal I/O**: stdin/stdout integration with readline and resize-event support.
|
|
36
37
|
- **Styling backend**: Chalk-powered color/style methods wired into bijou styling APIs.
|
|
37
38
|
- **One-line bootstrap**: `initDefaultContext()` creates a production-ready context and registers it as default on first call.
|
|
39
|
+
- **Worker helpers**: `runInWorker()` and `startWorkerApp()` for moving app logic into a worker thread.
|
|
40
|
+
- **Native recorder**: `recordDemoGif()` and related helpers for scripted V3 demo capture.
|
|
38
41
|
|
|
39
42
|
## What It Provides
|
|
40
43
|
|
|
@@ -65,6 +68,7 @@ initDefaultContext();
|
|
|
65
68
|
If you need to replace the default context later in-process, call `setDefaultContext(createNodeContext())` from `@flyingrobots/bijou`.
|
|
66
69
|
|
|
67
70
|
See [ARCHITECTURE.md](./ARCHITECTURE.md) for how the adapter maps to Node.js APIs, and [GUIDE.md](./GUIDE.md) for usage patterns.
|
|
71
|
+
For upgrading existing apps, see [`../../docs/MIGRATING_TO_V3.md`](../../docs/MIGRATING_TO_V3.md).
|
|
68
72
|
|
|
69
73
|
## Related Packages
|
|
70
74
|
|
package/dist/index.d.ts
CHANGED
|
@@ -10,11 +10,14 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { BijouContext } from '@flyingrobots/bijou';
|
|
12
12
|
/** Re-export the Node.js {@link RuntimePort} factory. */
|
|
13
|
-
export { nodeRuntime } from './runtime.js';
|
|
13
|
+
export { nodeRuntime, detectRefreshRate } from './runtime.js';
|
|
14
14
|
/** Re-export the Node.js {@link IOPort} factory. */
|
|
15
15
|
export { nodeIO } from './io.js';
|
|
16
16
|
/** Re-export the Chalk-based {@link StylePort} factory and its options type. */
|
|
17
17
|
export { chalkStyle, type ChalkStyleOptions } from './style.js';
|
|
18
|
+
/** Re-export Worker utilities for multi-threaded applications. */
|
|
19
|
+
export { isBijouWorker, runInWorker, sendToMain, startWorkerApp, type RunWorkerOptions } from './worker/worker.js';
|
|
20
|
+
export { recordDemoGif, rasterizeSurface, writeSurfaceGif, type NativeDemoSpec, type RecorderResult, type SurfaceGifOptions, } from './recorder.js';
|
|
18
21
|
/**
|
|
19
22
|
* Create a {@link BijouContext} wired to Node.js adapters.
|
|
20
23
|
*
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAMxD,yDAAyD;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAMxD,yDAAyD;AACzD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC9D,oDAAoD;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,gFAAgF;AAChF,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEhE,kEAAkE;AAClE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACnH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,YAAY,CAUhD;AAQD;;;;;GAKG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAElD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,CAQjD"}
|
package/dist/index.js
CHANGED
|
@@ -13,11 +13,14 @@ import { nodeRuntime } from './runtime.js';
|
|
|
13
13
|
import { nodeIO } from './io.js';
|
|
14
14
|
import { chalkStyle } from './style.js';
|
|
15
15
|
/** Re-export the Node.js {@link RuntimePort} factory. */
|
|
16
|
-
export { nodeRuntime } from './runtime.js';
|
|
16
|
+
export { nodeRuntime, detectRefreshRate } from './runtime.js';
|
|
17
17
|
/** Re-export the Node.js {@link IOPort} factory. */
|
|
18
18
|
export { nodeIO } from './io.js';
|
|
19
19
|
/** Re-export the Chalk-based {@link StylePort} factory and its options type. */
|
|
20
20
|
export { chalkStyle } from './style.js';
|
|
21
|
+
/** Re-export Worker utilities for multi-threaded applications. */
|
|
22
|
+
export { isBijouWorker, runInWorker, sendToMain, startWorkerApp } from './worker/worker.js';
|
|
23
|
+
export { recordDemoGif, rasterizeSurface, writeSurfaceGif, } from './recorder.js';
|
|
21
24
|
/**
|
|
22
25
|
* Create a {@link BijouContext} wired to Node.js adapters.
|
|
23
26
|
*
|
|
@@ -31,10 +34,12 @@ export { chalkStyle } from './style.js';
|
|
|
31
34
|
export function createNodeContext() {
|
|
32
35
|
const runtime = nodeRuntime();
|
|
33
36
|
const noColor = runtime.env('NO_COLOR') !== undefined;
|
|
37
|
+
// Force level 3 (truecolor) if NO_COLOR is not set,
|
|
38
|
+
// as the user is explicitly requesting a rich dashboard experience.
|
|
34
39
|
return createBijou({
|
|
35
40
|
runtime,
|
|
36
41
|
io: nodeIO(),
|
|
37
|
-
style: chalkStyle(noColor),
|
|
42
|
+
style: chalkStyle({ noColor, level: noColor ? 0 : 3 }),
|
|
38
43
|
});
|
|
39
44
|
}
|
|
40
45
|
/**
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,yDAAyD;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,yDAAyD;AACzD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC9D,oDAAoD;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,gFAAgF;AAChF,OAAO,EAAE,UAAU,EAA0B,MAAM,YAAY,CAAC;AAEhE,kEAAkE;AAClE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAyB,MAAM,oBAAoB,CAAC;AACnH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,eAAe,GAIhB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC;IACtD,qDAAqD;IACrD,oEAAoE;IACpE,OAAO,WAAW,CAAC;QACjB,OAAO;QACP,EAAE,EAAE,MAAM,EAAE;QACZ,KAAK,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACvD,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B;IACzC,WAAW,GAAG,KAAK,CAAC;AACtB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,GAAG,GAAG,iBAAiB,EAAE,CAAC;QAChC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACvB,WAAW,GAAG,IAAI,CAAC;QACnB,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type BijouContext, type Surface } from '@flyingrobots/bijou';
|
|
2
|
+
import { type App, type ScriptStep } from '@flyingrobots/bijou-tui';
|
|
3
|
+
export interface NativeDemoSpec<Model, M = never> {
|
|
4
|
+
name: string;
|
|
5
|
+
app: App<Model, M>;
|
|
6
|
+
steps: ScriptStep<M>[];
|
|
7
|
+
outputPath: string;
|
|
8
|
+
ctx?: BijouContext;
|
|
9
|
+
css?: string;
|
|
10
|
+
frameDelayMs?: number;
|
|
11
|
+
cellWidth?: number;
|
|
12
|
+
cellHeight?: number;
|
|
13
|
+
foreground?: string;
|
|
14
|
+
background?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface RecorderResult {
|
|
17
|
+
outputPath: string;
|
|
18
|
+
frames: number;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}
|
|
22
|
+
export interface SurfaceGifOptions {
|
|
23
|
+
outputPath: string;
|
|
24
|
+
frames: Surface[];
|
|
25
|
+
frameDelayMs?: number;
|
|
26
|
+
cellWidth?: number;
|
|
27
|
+
cellHeight?: number;
|
|
28
|
+
foreground?: string;
|
|
29
|
+
background?: string;
|
|
30
|
+
}
|
|
31
|
+
interface RasterizeOptions {
|
|
32
|
+
cellWidth: number;
|
|
33
|
+
cellHeight: number;
|
|
34
|
+
foreground: string;
|
|
35
|
+
background: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function recordDemoGif<Model, M = never>(spec: NativeDemoSpec<Model, M>): Promise<RecorderResult>;
|
|
38
|
+
export declare function writeSurfaceGif(options: SurfaceGifOptions): RecorderResult;
|
|
39
|
+
export declare function rasterizeSurface(surface: Surface, options?: Partial<RasterizeOptions>): Uint8Array;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=recorder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../src/recorder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,YAAY,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAa,KAAK,GAAG,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAe/E,MAAM,WAAW,cAAc,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,gBAAgB;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,EAClD,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,GAC7B,OAAO,CAAC,cAAc,CAAC,CAezB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,CAuC1E;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,UAAU,CAgBlG"}
|
package/dist/recorder.js
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname } from 'node:path';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import { createSurface } from '@flyingrobots/bijou';
|
|
5
|
+
import { runScript } from '@flyingrobots/bijou-tui';
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
const { GIFEncoder, applyPalette, quantize } = require('gifenc');
|
|
8
|
+
const FONT = require('oled-font-5x7');
|
|
9
|
+
const GLYPH_MAP = new Map(FONT.lookup.map((char, index) => [char, index]));
|
|
10
|
+
const DEFAULT_FOREGROUND = '#f5f7ff';
|
|
11
|
+
const DEFAULT_BACKGROUND = '#0b1020';
|
|
12
|
+
export async function recordDemoGif(spec) {
|
|
13
|
+
const result = await runScript(spec.app, spec.steps, {
|
|
14
|
+
ctx: spec.ctx,
|
|
15
|
+
css: spec.css,
|
|
16
|
+
});
|
|
17
|
+
return writeSurfaceGif({
|
|
18
|
+
outputPath: spec.outputPath,
|
|
19
|
+
frames: result.frames,
|
|
20
|
+
frameDelayMs: spec.frameDelayMs,
|
|
21
|
+
cellWidth: spec.cellWidth,
|
|
22
|
+
cellHeight: spec.cellHeight,
|
|
23
|
+
foreground: spec.foreground,
|
|
24
|
+
background: spec.background,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export function writeSurfaceGif(options) {
|
|
28
|
+
if (options.frames.length === 0) {
|
|
29
|
+
throw new Error('writeSurfaceGif() requires at least one frame');
|
|
30
|
+
}
|
|
31
|
+
const rasterOptions = {
|
|
32
|
+
cellWidth: options.cellWidth ?? 8,
|
|
33
|
+
cellHeight: options.cellHeight ?? 10,
|
|
34
|
+
foreground: options.foreground ?? DEFAULT_FOREGROUND,
|
|
35
|
+
background: options.background ?? DEFAULT_BACKGROUND,
|
|
36
|
+
};
|
|
37
|
+
const width = Math.max(...options.frames.map((frame) => frame.width));
|
|
38
|
+
const height = Math.max(...options.frames.map((frame) => frame.height));
|
|
39
|
+
const frames = options.frames
|
|
40
|
+
.map((frame) => normalizeSurfaceFrame(frame, width, height))
|
|
41
|
+
.map((frame) => rasterizeSurface(frame, rasterOptions));
|
|
42
|
+
const palette = quantize(joinFrames(frames), 256, { format: 'rgb565' });
|
|
43
|
+
const gif = GIFEncoder();
|
|
44
|
+
const delay = Math.max(2, Math.round((options.frameDelayMs ?? 90) / 10));
|
|
45
|
+
for (const frame of frames) {
|
|
46
|
+
const indexed = applyPalette(frame, palette);
|
|
47
|
+
gif.writeFrame(indexed, width * rasterOptions.cellWidth, height * rasterOptions.cellHeight, {
|
|
48
|
+
palette,
|
|
49
|
+
delay,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
gif.finish();
|
|
53
|
+
mkdirSync(dirname(options.outputPath), { recursive: true });
|
|
54
|
+
writeFileSync(options.outputPath, Buffer.from(gif.bytes()));
|
|
55
|
+
return {
|
|
56
|
+
outputPath: options.outputPath,
|
|
57
|
+
frames: frames.length,
|
|
58
|
+
width: width * rasterOptions.cellWidth,
|
|
59
|
+
height: height * rasterOptions.cellHeight,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export function rasterizeSurface(surface, options) {
|
|
63
|
+
const cellWidth = options?.cellWidth ?? 8;
|
|
64
|
+
const cellHeight = options?.cellHeight ?? 10;
|
|
65
|
+
const foreground = options?.foreground ?? DEFAULT_FOREGROUND;
|
|
66
|
+
const background = options?.background ?? DEFAULT_BACKGROUND;
|
|
67
|
+
const width = surface.width * cellWidth;
|
|
68
|
+
const height = surface.height * cellHeight;
|
|
69
|
+
const rgba = new Uint8Array(width * height * 4);
|
|
70
|
+
for (let y = 0; y < surface.height; y++) {
|
|
71
|
+
for (let x = 0; x < surface.width; x++) {
|
|
72
|
+
drawCell(rgba, width, height, x, y, cellWidth, cellHeight, surface.get(x, y), foreground, background);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return rgba;
|
|
76
|
+
}
|
|
77
|
+
function drawCell(rgba, width, height, cellX, cellY, cellWidth, cellHeight, cell, fallbackForeground, fallbackBackground) {
|
|
78
|
+
const modifiers = new Set(cell.modifiers ?? []);
|
|
79
|
+
let fg = parseHex(cell.fg ?? fallbackForeground);
|
|
80
|
+
let bg = parseHex(cell.bg ?? fallbackBackground);
|
|
81
|
+
if (modifiers.has('inverse')) {
|
|
82
|
+
[fg, bg] = [bg, fg];
|
|
83
|
+
}
|
|
84
|
+
if (modifiers.has('dim')) {
|
|
85
|
+
fg = mixRgb(fg, bg, 0.45);
|
|
86
|
+
}
|
|
87
|
+
const pixelX = cellX * cellWidth;
|
|
88
|
+
const pixelY = cellY * cellHeight;
|
|
89
|
+
fillRect(rgba, width, height, pixelX, pixelY, cellWidth, cellHeight, bg);
|
|
90
|
+
if (cell.empty || cell.char === ' ') {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const drawn = drawSpecialGlyph(rgba, width, height, pixelX, pixelY, cellWidth, cellHeight, cell.char, fg);
|
|
94
|
+
if (!drawn) {
|
|
95
|
+
drawBitmapGlyph(rgba, width, height, pixelX + 1, pixelY + 1, cell.char, fg);
|
|
96
|
+
}
|
|
97
|
+
if (modifiers.has('bold')) {
|
|
98
|
+
const boldDrawn = drawSpecialGlyph(rgba, width, height, pixelX + 1, pixelY, cellWidth, cellHeight, cell.char, fg);
|
|
99
|
+
if (!boldDrawn) {
|
|
100
|
+
drawBitmapGlyph(rgba, width, height, pixelX + 2, pixelY + 1, cell.char, fg);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (modifiers.has('underline')) {
|
|
104
|
+
fillRect(rgba, width, height, pixelX + 1, pixelY + cellHeight - 2, cellWidth - 2, 1, fg);
|
|
105
|
+
}
|
|
106
|
+
if (modifiers.has('strike')) {
|
|
107
|
+
fillRect(rgba, width, height, pixelX + 1, pixelY + Math.floor(cellHeight / 2), cellWidth - 2, 1, fg);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function drawBitmapGlyph(rgba, width, height, x, y, char, color) {
|
|
111
|
+
const glyphIndex = GLYPH_MAP.get(char);
|
|
112
|
+
if (glyphIndex == null) {
|
|
113
|
+
fillRect(rgba, width, height, x + 1, y + 2, 3, 3, color);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const offset = glyphIndex * FONT.width;
|
|
117
|
+
for (let col = 0; col < FONT.width; col++) {
|
|
118
|
+
const bits = FONT.fontData[offset + col] ?? 0;
|
|
119
|
+
for (let row = 0; row < FONT.height; row++) {
|
|
120
|
+
if (((bits >> row) & 1) === 1) {
|
|
121
|
+
setPixel(rgba, width, height, x + col, y + row, color);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function drawSpecialGlyph(rgba, width, height, x, y, cellWidth, cellHeight, char, color) {
|
|
127
|
+
const midX = x + Math.floor(cellWidth / 2);
|
|
128
|
+
const midY = y + Math.floor(cellHeight / 2);
|
|
129
|
+
const right = x + cellWidth - 2;
|
|
130
|
+
const bottom = y + cellHeight - 2;
|
|
131
|
+
switch (char) {
|
|
132
|
+
case '─':
|
|
133
|
+
fillRect(rgba, width, height, x + 1, midY, cellWidth - 2, 1, color);
|
|
134
|
+
return true;
|
|
135
|
+
case '│':
|
|
136
|
+
fillRect(rgba, width, height, midX, y + 1, 1, cellHeight - 2, color);
|
|
137
|
+
return true;
|
|
138
|
+
case '┌':
|
|
139
|
+
fillRect(rgba, width, height, midX, midY, right - midX + 1, 1, color);
|
|
140
|
+
fillRect(rgba, width, height, midX, midY, 1, bottom - midY + 1, color);
|
|
141
|
+
return true;
|
|
142
|
+
case '┐':
|
|
143
|
+
fillRect(rgba, width, height, x + 1, midY, midX - x, 1, color);
|
|
144
|
+
fillRect(rgba, width, height, midX, midY, 1, bottom - midY + 1, color);
|
|
145
|
+
return true;
|
|
146
|
+
case '└':
|
|
147
|
+
fillRect(rgba, width, height, midX, y + 1, 1, midY - y, color);
|
|
148
|
+
fillRect(rgba, width, height, midX, midY, right - midX + 1, 1, color);
|
|
149
|
+
return true;
|
|
150
|
+
case '┘':
|
|
151
|
+
fillRect(rgba, width, height, x + 1, midY, midX - x, 1, color);
|
|
152
|
+
fillRect(rgba, width, height, midX, y + 1, 1, midY - y, color);
|
|
153
|
+
return true;
|
|
154
|
+
case '▎':
|
|
155
|
+
fillRect(rgba, width, height, x + 1, y + 1, 1, cellHeight - 2, color);
|
|
156
|
+
return true;
|
|
157
|
+
default:
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function fillRect(rgba, width, height, x, y, w, h, color) {
|
|
162
|
+
for (let row = 0; row < h; row++) {
|
|
163
|
+
for (let col = 0; col < w; col++) {
|
|
164
|
+
setPixel(rgba, width, height, x + col, y + row, color);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function setPixel(rgba, width, height, x, y, color) {
|
|
169
|
+
if (x < 0 || y < 0 || x >= width || y >= height)
|
|
170
|
+
return;
|
|
171
|
+
const idx = (y * width + x) * 4;
|
|
172
|
+
rgba[idx] = color.r;
|
|
173
|
+
rgba[idx + 1] = color.g;
|
|
174
|
+
rgba[idx + 2] = color.b;
|
|
175
|
+
rgba[idx + 3] = 255;
|
|
176
|
+
}
|
|
177
|
+
function joinFrames(frames) {
|
|
178
|
+
const total = frames.reduce((sum, frame) => sum + frame.length, 0);
|
|
179
|
+
const joined = new Uint8Array(total);
|
|
180
|
+
let offset = 0;
|
|
181
|
+
for (const frame of frames) {
|
|
182
|
+
joined.set(frame, offset);
|
|
183
|
+
offset += frame.length;
|
|
184
|
+
}
|
|
185
|
+
return joined;
|
|
186
|
+
}
|
|
187
|
+
function normalizeSurfaceFrame(surface, width, height) {
|
|
188
|
+
if (surface.width === width && surface.height === height) {
|
|
189
|
+
return surface;
|
|
190
|
+
}
|
|
191
|
+
const normalized = createSurface(width, height);
|
|
192
|
+
normalized.blit(surface, 0, 0);
|
|
193
|
+
return normalized;
|
|
194
|
+
}
|
|
195
|
+
function parseHex(hex) {
|
|
196
|
+
const normalized = hex.replace('#', '');
|
|
197
|
+
if (normalized.length !== 6)
|
|
198
|
+
return { r: 255, g: 255, b: 255 };
|
|
199
|
+
return {
|
|
200
|
+
r: parseInt(normalized.slice(0, 2), 16),
|
|
201
|
+
g: parseInt(normalized.slice(2, 4), 16),
|
|
202
|
+
b: parseInt(normalized.slice(4, 6), 16),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function mixRgb(a, b, ratio) {
|
|
206
|
+
const t = Math.max(0, Math.min(1, ratio));
|
|
207
|
+
return {
|
|
208
|
+
r: Math.round(a.r * (1 - t) + b.r * t),
|
|
209
|
+
g: Math.round(a.g * (1 - t) + b.g * t),
|
|
210
|
+
b: Math.round(a.b * (1 - t) + b.b * t),
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=recorder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recorder.js","sourceRoot":"","sources":["../src/recorder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAmC,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,SAAS,EAA6B,MAAM,yBAAyB,CAAC;AAE/E,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,QAAQ,CAA4B,CAAC;AAC5F,MAAM,IAAI,GAAG,OAAO,CAAC,eAAe,CAKnC,CAAC;AAEF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAiB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAC3F,MAAM,kBAAkB,GAAG,SAAS,CAAC;AACrC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAwCrC,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAA8B;IA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ingrobots/bijou';
|
|
2
|
+
/**
|
|
3
|
+
* Attempt to detect the system's refresh rate in Hz.
|
|
4
|
+
*
|
|
5
|
+
* Currently defaults to 60, but provides an anchor for future
|
|
6
|
+
* platform-specific detection (e.g. via native calls or shell commands).
|
|
7
|
+
*
|
|
8
|
+
* @returns Detected refresh rate or 60.
|
|
9
|
+
*/
|
|
10
|
+
export declare function detectRefreshRate(): number;
|
|
2
11
|
/**
|
|
3
12
|
* Create a {@link RuntimePort} backed by Node.js `process` globals.
|
|
4
13
|
*
|
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,IAAI,WAAW,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAU1C;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,IAAI,WAAW,CA8BzC"}
|
package/dist/runtime.js
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attempt to detect the system's refresh rate in Hz.
|
|
3
|
+
*
|
|
4
|
+
* Currently defaults to 60, but provides an anchor for future
|
|
5
|
+
* platform-specific detection (e.g. via native calls or shell commands).
|
|
6
|
+
*
|
|
7
|
+
* @returns Detected refresh rate or 60.
|
|
8
|
+
*/
|
|
9
|
+
export function detectRefreshRate() {
|
|
10
|
+
const envFps = process.env['BIJOU_FPS'];
|
|
11
|
+
if (envFps) {
|
|
12
|
+
const parsed = parseInt(envFps, 10);
|
|
13
|
+
if (!isNaN(parsed) && parsed > 0)
|
|
14
|
+
return parsed;
|
|
15
|
+
}
|
|
16
|
+
// Future: add platform-specific detection logic here
|
|
17
|
+
return 60;
|
|
18
|
+
}
|
|
1
19
|
/**
|
|
2
20
|
* Create a {@link RuntimePort} backed by Node.js `process` globals.
|
|
3
21
|
*
|
|
@@ -33,6 +51,10 @@ export function nodeRuntime() {
|
|
|
33
51
|
get rows() {
|
|
34
52
|
return process.stdout.rows ?? 24;
|
|
35
53
|
},
|
|
54
|
+
/** Refresh rate in FPS. Defaults to 60, or BIJOU_FPS if set. */
|
|
55
|
+
get refreshRate() {
|
|
56
|
+
return detectRefreshRate();
|
|
57
|
+
},
|
|
36
58
|
};
|
|
37
59
|
}
|
|
38
60
|
//# sourceMappingURL=runtime.js.map
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO;QACL;;;WAGG;QACH,GAAG,CAAC,GAAW;YACb,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;QACD,4EAA4E;QAC5E,IAAI,WAAW;YACb,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC;QACvC,CAAC;QACD,2EAA2E;QAC3E,IAAI,UAAU;YACZ,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC;QACtC,CAAC;QACD,2EAA2E;QAC3E,IAAI,OAAO;YACT,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QACtC,CAAC;QACD,yEAAyE;QACzE,IAAI,IAAI;YACN,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACnC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACxC,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC;YAAE,OAAO,MAAM,CAAC;IAClD,CAAC;IAED,qDAAqD;IAErD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO;QACL;;;WAGG;QACH,GAAG,CAAC,GAAW;YACb,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;QACD,4EAA4E;QAC5E,IAAI,WAAW;YACb,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC;QACvC,CAAC;QACD,2EAA2E;QAC3E,IAAI,UAAU;YACZ,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC;QACtC,CAAC;QACD,2EAA2E;QAC3E,IAAI,OAAO;YACT,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QACtC,CAAC;QACD,yEAAyE;QACzE,IAAI,IAAI;YACN,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACnC,CAAC;QACD,gEAAgE;QAChE,IAAI,WAAW;YACb,OAAO,iBAAiB,EAAE,CAAC;QAC7B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/style.js
CHANGED
|
@@ -83,7 +83,10 @@ export function chalkStyle(arg) {
|
|
|
83
83
|
styled(token, text) {
|
|
84
84
|
if (!ansiEnabled)
|
|
85
85
|
return text;
|
|
86
|
-
|
|
86
|
+
let base = instance;
|
|
87
|
+
if (token.hex) {
|
|
88
|
+
base = instance.hex(token.hex);
|
|
89
|
+
}
|
|
87
90
|
let result = applyModifiers(base, token.modifiers)(text);
|
|
88
91
|
result = applyUnderlineVariants(result, token.modifiers);
|
|
89
92
|
// Note: bg is applied unconditionally when noColor is false.
|
package/dist/style.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,EAAsB,MAAM,OAAO,CAAC;AA2BzD,iBAAiB;AACjB,MAAM,UAAU,UAAU,CAAC,GAAiC;IAC1D,MAAM,IAAI,GAAG,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IACvE,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC;IACxC,MAAM,QAAQ,GAAkB,IAAI,CAAC,KAAK,KAAK,SAAS;QACtD,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QAClC,CAAC,CAAC,KAAK,CAAC;IACV,mFAAmF;IACnF,MAAM,WAAW,GAAG,CAAC,SAAS,IAAI,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC;IAErD,0EAA0E;IAC1E,MAAM,qBAAqB,GAA2B;QACpD,iBAAiB,EAAE,WAAW;QAC9B,kBAAkB,EAAE,WAAW;QAC/B,kBAAkB,EAAE,WAAW;KAChC,CAAC;IACF,+BAA+B;IAC/B,MAAM,eAAe,GAAG,UAAU,CAAC;IAEnC;;;;;;OAMG;IACH,SAAS,cAAc,CAAC,CAAgB,EAAE,SAAmC;QAC3E,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO,CAAC,CAAC;QACtC,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,KAAK,MAAM,GAAG,IA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;QACH,IAAI,CAAC,IAAY;YACf,IAAI,SAAS;gBAAE,OAAO,IAAI,CAAC;YAC3B,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"echo-worker.d.ts","sourceRoot":"","sources":["../../../src/worker/fixtures/echo-worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isMainThread, parentPort } from 'node:worker_threads';
|
|
2
|
+
if (!isMainThread && parentPort) {
|
|
3
|
+
parentPort.postMessage({ type: 'render:frame', output: 'worker:booting' });
|
|
4
|
+
parentPort.on('message', (msg) => {
|
|
5
|
+
if (msg.type === 'data') {
|
|
6
|
+
const text = msg.payload?.text ?? 'unknown';
|
|
7
|
+
parentPort.postMessage({ type: 'data', payload: { type: 'ack', text } });
|
|
8
|
+
parentPort.postMessage({ type: 'render:frame', output: `worker:${text}` });
|
|
9
|
+
parentPort.postMessage({ type: 'quit' });
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=echo-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"echo-worker.js","sourceRoot":"","sources":["../../../src/worker/fixtures/echo-worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE/D,IAAI,CAAC,YAAY,IAAI,UAAU,EAAE,CAAC;IAChC,UAAU,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAE3E,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,GAAkD,EAAE,EAAE;QAC9E,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACxB,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,IAAI,IAAI,SAAS,CAAC;YAC5C,UAAW,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;YAC1E,UAAW,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,IAAI,EAAE,EAAE,CAAC,CAAC;YAC5E,UAAW,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { BijouContext } from '@flyingrobots/bijou';
|
|
2
|
+
import type { App } from '@flyingrobots/bijou-tui';
|
|
3
|
+
export type WorkerMessage = {
|
|
4
|
+
type: 'io:data';
|
|
5
|
+
data: string;
|
|
6
|
+
} | {
|
|
7
|
+
type: 'io:resize';
|
|
8
|
+
columns: number;
|
|
9
|
+
rows: number;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'data';
|
|
12
|
+
payload: unknown;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'quit';
|
|
15
|
+
};
|
|
16
|
+
export type MainMessage = {
|
|
17
|
+
type: 'render:frame';
|
|
18
|
+
output: string;
|
|
19
|
+
} | {
|
|
20
|
+
type: 'error';
|
|
21
|
+
message: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'data';
|
|
24
|
+
payload: unknown;
|
|
25
|
+
} | {
|
|
26
|
+
type: 'quit';
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Checks if the current environment is running inside a Bijou Worker.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isBijouWorker(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Sends a custom data message from the worker to the main thread.
|
|
34
|
+
* This will be received via the `onMessage` callback in `runInWorker`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function sendToMain(payload: unknown): void;
|
|
37
|
+
/**
|
|
38
|
+
* Options for starting an app in a background worker.
|
|
39
|
+
*/
|
|
40
|
+
export interface RunWorkerOptions {
|
|
41
|
+
/** The absolute path to the file containing the worker entry point. */
|
|
42
|
+
entry: string;
|
|
43
|
+
/** Optional Bijou context for the host thread. */
|
|
44
|
+
ctx?: BijouContext;
|
|
45
|
+
/** Enter the alternate screen buffer on startup. */
|
|
46
|
+
altScreen?: boolean;
|
|
47
|
+
/** Hide the cursor on startup. */
|
|
48
|
+
hideCursor?: boolean;
|
|
49
|
+
/** Enable mouse input (SGR mode). */
|
|
50
|
+
mouse?: boolean;
|
|
51
|
+
/** Optional BCSS stylesheet string. */
|
|
52
|
+
css?: string;
|
|
53
|
+
/** Optional callback for custom data messages sent from the worker via `sendToMain`. */
|
|
54
|
+
onMessage?: (payload: unknown) => void;
|
|
55
|
+
/** Optional arguments passed to the Node.js worker process (e.g. ['--import', 'tsx']). */
|
|
56
|
+
execArgv?: string[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Handle for a running background worker.
|
|
60
|
+
*/
|
|
61
|
+
export interface WorkerHandle {
|
|
62
|
+
/** Sends a custom data message to the worker thread. */
|
|
63
|
+
send(payload: unknown): void;
|
|
64
|
+
/** Forcefully terminates the worker thread. */
|
|
65
|
+
terminate(): Promise<void>;
|
|
66
|
+
/** A promise that resolves when the worker exits cleanly. */
|
|
67
|
+
onExit: Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Spawns a background worker thread to run the TEA application.
|
|
71
|
+
* The main thread delegates all logic to the worker, only handling raw I/O
|
|
72
|
+
* and frame rendering (to keep the TTY responsive).
|
|
73
|
+
*
|
|
74
|
+
* @param options - Configuration including the path to the worker entry file.
|
|
75
|
+
* @returns A handle to the running worker.
|
|
76
|
+
*/
|
|
77
|
+
export declare function runInWorker(options: RunWorkerOptions): WorkerHandle;
|
|
78
|
+
/**
|
|
79
|
+
* The entry point for the worker thread. Must be called in the file
|
|
80
|
+
* specified by `options.entry` in `runInWorker()`.
|
|
81
|
+
*
|
|
82
|
+
* Intercepts the normal `run()` execution, redirecting I/O to the parent port.
|
|
83
|
+
*
|
|
84
|
+
* @param app - The TEA app to run.
|
|
85
|
+
*/
|
|
86
|
+
export declare function startWorkerApp<Model, M>(app: App<Model, M>): Promise<void>;
|
|
87
|
+
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/worker/worker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,GAAG,EAAc,MAAM,yBAAyB,CAAC;AAQ/D,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErB,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAMrB;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAIjD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,oDAAoD;IACpD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kCAAkC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qCAAqC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,uCAAuC;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wFAAwF;IACxF,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAsBD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B,+CAA+C;IAC/C,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,6DAA6D;IAC7D,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,YAAY,CAgHnE;AAMD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAyEhF"}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { Worker, isMainThread, parentPort, workerData } from 'node:worker_threads';
|
|
2
|
+
import { resolve as resolvePath } from 'node:path';
|
|
3
|
+
import { run } from '@flyingrobots/bijou-tui';
|
|
4
|
+
import { createNodeContext } from '../index.js';
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// Worker Environment API
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
/**
|
|
9
|
+
* Checks if the current environment is running inside a Bijou Worker.
|
|
10
|
+
*/
|
|
11
|
+
export function isBijouWorker() {
|
|
12
|
+
return !isMainThread && workerData?.isBijouWorker === true;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Sends a custom data message from the worker to the main thread.
|
|
16
|
+
* This will be received via the `onMessage` callback in `runInWorker`.
|
|
17
|
+
*/
|
|
18
|
+
export function sendToMain(payload) {
|
|
19
|
+
if (parentPort) {
|
|
20
|
+
parentPort.postMessage({ type: 'data', payload });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Spawns a background worker thread to run the TEA application.
|
|
25
|
+
* The main thread delegates all logic to the worker, only handling raw I/O
|
|
26
|
+
* and frame rendering (to keep the TTY responsive).
|
|
27
|
+
*
|
|
28
|
+
* @param options - Configuration including the path to the worker entry file.
|
|
29
|
+
* @returns A handle to the running worker.
|
|
30
|
+
*/
|
|
31
|
+
export function runInWorker(options) {
|
|
32
|
+
if (!isMainThread) {
|
|
33
|
+
throw new Error('runInWorker must be called from the main thread.');
|
|
34
|
+
}
|
|
35
|
+
const ctx = options.ctx ?? createNodeContext();
|
|
36
|
+
installRuntimeOverlay(ctx);
|
|
37
|
+
const useAltScreen = options.altScreen ?? true;
|
|
38
|
+
const useHideCursor = options.hideCursor ?? true;
|
|
39
|
+
const useMouse = options.mouse ?? false;
|
|
40
|
+
// Setup main thread screen
|
|
41
|
+
if (useAltScreen || useHideCursor) {
|
|
42
|
+
ctx.io.write('\x1b[?1049h'); // ENTER_ALT_SCREEN
|
|
43
|
+
if (useHideCursor)
|
|
44
|
+
ctx.io.write('\x1b[?25l'); // HIDE_CURSOR
|
|
45
|
+
}
|
|
46
|
+
if (useMouse) {
|
|
47
|
+
ctx.io.write('\x1b[?1000h\x1b[?1002h\x1b[?1006h'); // ENABLE_MOUSE
|
|
48
|
+
}
|
|
49
|
+
// Spawn the worker with structured-clone-safe options only.
|
|
50
|
+
const serializableOptions = {
|
|
51
|
+
altScreen: options.altScreen,
|
|
52
|
+
hideCursor: options.hideCursor,
|
|
53
|
+
mouse: options.mouse,
|
|
54
|
+
css: options.css,
|
|
55
|
+
};
|
|
56
|
+
const worker = new Worker(resolvePath(options.entry), {
|
|
57
|
+
workerData: {
|
|
58
|
+
isBijouWorker: true,
|
|
59
|
+
options: serializableOptions,
|
|
60
|
+
runtime: {
|
|
61
|
+
columns: sanitizeDimension(ctx.runtime.columns),
|
|
62
|
+
rows: sanitizeDimension(ctx.runtime.rows),
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
execArgv: options.execArgv,
|
|
66
|
+
// Pipe stdout/stderr so we can capture logs if needed, but primarily use IPC
|
|
67
|
+
});
|
|
68
|
+
// 1. Pipe Main Stdin -> Worker IPC
|
|
69
|
+
const inputHandle = ctx.io.rawInput((data) => {
|
|
70
|
+
worker.postMessage({ type: 'io:data', data });
|
|
71
|
+
});
|
|
72
|
+
const resizeHandle = ctx.io.onResize((columns, rows) => {
|
|
73
|
+
const nextColumns = sanitizeDimension(columns);
|
|
74
|
+
const nextRows = sanitizeDimension(rows);
|
|
75
|
+
ctx.runtime.columns = nextColumns;
|
|
76
|
+
ctx.runtime.rows = nextRows;
|
|
77
|
+
worker.postMessage({ type: 'io:resize', columns: nextColumns, rows: nextRows });
|
|
78
|
+
});
|
|
79
|
+
const onExit = new Promise((resolve, reject) => {
|
|
80
|
+
let requestedQuit = false;
|
|
81
|
+
let forcedTerminate = false;
|
|
82
|
+
// 2. Pipe Worker IPC -> Main Stdout
|
|
83
|
+
worker.on('message', (msg) => {
|
|
84
|
+
if (msg.type === 'render:frame') {
|
|
85
|
+
ctx.io.write(msg.output);
|
|
86
|
+
}
|
|
87
|
+
else if (msg.type === 'error') {
|
|
88
|
+
if (ctx.io.writeError)
|
|
89
|
+
ctx.io.writeError(msg.message);
|
|
90
|
+
else
|
|
91
|
+
ctx.io.write(msg.message);
|
|
92
|
+
}
|
|
93
|
+
else if (msg.type === 'data') {
|
|
94
|
+
if (options.onMessage)
|
|
95
|
+
options.onMessage(msg.payload);
|
|
96
|
+
}
|
|
97
|
+
else if (msg.type === 'quit') {
|
|
98
|
+
requestedQuit = true;
|
|
99
|
+
setTimeout(() => {
|
|
100
|
+
if (requestedQuit) {
|
|
101
|
+
forcedTerminate = true;
|
|
102
|
+
void worker.terminate();
|
|
103
|
+
}
|
|
104
|
+
}, 50);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
worker.on('error', (err) => {
|
|
108
|
+
cleanup();
|
|
109
|
+
reject(err);
|
|
110
|
+
});
|
|
111
|
+
worker.on('exit', (code) => {
|
|
112
|
+
cleanup();
|
|
113
|
+
if (requestedQuit && (code === 0 || forcedTerminate)) {
|
|
114
|
+
resolve();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (code !== 0)
|
|
118
|
+
reject(new Error(`Worker stopped with exit code ${code}`));
|
|
119
|
+
else
|
|
120
|
+
resolve();
|
|
121
|
+
});
|
|
122
|
+
function cleanup() {
|
|
123
|
+
inputHandle.dispose();
|
|
124
|
+
resizeHandle.dispose();
|
|
125
|
+
if (useMouse) {
|
|
126
|
+
ctx.io.write('\x1b[?1000l\x1b[?1002l\x1b[?1006l'); // DISABLE_MOUSE
|
|
127
|
+
}
|
|
128
|
+
if (useAltScreen || useHideCursor) {
|
|
129
|
+
ctx.io.write('\x1b[?1049l'); // EXIT_ALT_SCREEN
|
|
130
|
+
if (useHideCursor)
|
|
131
|
+
ctx.io.write('\x1b[?25h'); // SHOW_CURSOR
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
send: (payload) => worker.postMessage({ type: 'data', payload }),
|
|
137
|
+
terminate: async () => { await worker.terminate(); },
|
|
138
|
+
onExit
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
// Worker Thread Logic
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
/**
|
|
145
|
+
* The entry point for the worker thread. Must be called in the file
|
|
146
|
+
* specified by `options.entry` in `runInWorker()`.
|
|
147
|
+
*
|
|
148
|
+
* Intercepts the normal `run()` execution, redirecting I/O to the parent port.
|
|
149
|
+
*
|
|
150
|
+
* @param app - The TEA app to run.
|
|
151
|
+
*/
|
|
152
|
+
export async function startWorkerApp(app) {
|
|
153
|
+
if (isMainThread || !parentPort) {
|
|
154
|
+
throw new Error('startWorkerApp must be called from within a worker thread.');
|
|
155
|
+
}
|
|
156
|
+
const initData = workerData;
|
|
157
|
+
// Create a proxy Context that speaks IPC instead of true I/O
|
|
158
|
+
const proxyCtx = createNodeContext();
|
|
159
|
+
installRuntimeOverlay(proxyCtx);
|
|
160
|
+
const { setDefaultContext } = await import('@flyingrobots/bijou');
|
|
161
|
+
setDefaultContext(proxyCtx);
|
|
162
|
+
proxyCtx.runtime.columns = sanitizeDimension(initData.runtime?.columns ?? proxyCtx.runtime.columns);
|
|
163
|
+
proxyCtx.runtime.rows = sanitizeDimension(initData.runtime?.rows ?? proxyCtx.runtime.rows);
|
|
164
|
+
// Hijack the WritePort to send frames back to main thread
|
|
165
|
+
proxyCtx.io.write = (data) => {
|
|
166
|
+
parentPort.postMessage({ type: 'render:frame', output: data });
|
|
167
|
+
};
|
|
168
|
+
proxyCtx.io.writeError = (data) => {
|
|
169
|
+
parentPort.postMessage({ type: 'error', message: data });
|
|
170
|
+
};
|
|
171
|
+
// We need to bypass the standard run() setup since the main thread
|
|
172
|
+
// already handled alt screen and mouse modes. We tell run() to do nothing.
|
|
173
|
+
const proxyOptions = {
|
|
174
|
+
...initData.options,
|
|
175
|
+
ctx: proxyCtx,
|
|
176
|
+
altScreen: false,
|
|
177
|
+
hideCursor: false,
|
|
178
|
+
mouse: false,
|
|
179
|
+
};
|
|
180
|
+
// Override the io.rawInput to listen to IPC messages instead of process.stdin
|
|
181
|
+
proxyCtx.io.rawInput = (handler) => {
|
|
182
|
+
const listener = (msg) => {
|
|
183
|
+
if (msg.type === 'io:data')
|
|
184
|
+
handler(msg.data);
|
|
185
|
+
};
|
|
186
|
+
parentPort.on('message', listener);
|
|
187
|
+
return {
|
|
188
|
+
dispose: () => parentPort.off('message', listener)
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
proxyCtx.io.onResize = (handler) => {
|
|
192
|
+
const listener = (msg) => {
|
|
193
|
+
if (msg.type === 'io:resize') {
|
|
194
|
+
proxyCtx.runtime.columns = sanitizeDimension(msg.columns);
|
|
195
|
+
proxyCtx.runtime.rows = sanitizeDimension(msg.rows);
|
|
196
|
+
handler(proxyCtx.runtime.columns, proxyCtx.runtime.rows);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
parentPort.on('message', listener);
|
|
200
|
+
return {
|
|
201
|
+
dispose: () => parentPort.off('message', listener)
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
proxyCtx.io.onData = (handler) => {
|
|
205
|
+
const listener = (msg) => {
|
|
206
|
+
if (msg.type === 'data')
|
|
207
|
+
handler(msg.payload);
|
|
208
|
+
};
|
|
209
|
+
parentPort.on('message', listener);
|
|
210
|
+
return {
|
|
211
|
+
dispose: () => parentPort.off('message', listener)
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
// Run the app using the proxy context
|
|
215
|
+
await run(app, proxyOptions);
|
|
216
|
+
// Signal main thread to shut down
|
|
217
|
+
parentPort.postMessage({ type: 'quit' });
|
|
218
|
+
}
|
|
219
|
+
function sanitizeDimension(value) {
|
|
220
|
+
if (!Number.isFinite(value))
|
|
221
|
+
return 0;
|
|
222
|
+
return Math.max(0, Math.floor(value));
|
|
223
|
+
}
|
|
224
|
+
function installRuntimeOverlay(ctx) {
|
|
225
|
+
const baseRuntime = ctx.runtime;
|
|
226
|
+
const state = {
|
|
227
|
+
columns: sanitizeDimension(baseRuntime.columns),
|
|
228
|
+
rows: sanitizeDimension(baseRuntime.rows),
|
|
229
|
+
};
|
|
230
|
+
const runtime = {
|
|
231
|
+
env(key) {
|
|
232
|
+
return baseRuntime.env(key);
|
|
233
|
+
},
|
|
234
|
+
get stdoutIsTTY() {
|
|
235
|
+
return baseRuntime.stdoutIsTTY;
|
|
236
|
+
},
|
|
237
|
+
get stdinIsTTY() {
|
|
238
|
+
return baseRuntime.stdinIsTTY;
|
|
239
|
+
},
|
|
240
|
+
get columns() {
|
|
241
|
+
return state.columns;
|
|
242
|
+
},
|
|
243
|
+
set columns(value) {
|
|
244
|
+
state.columns = sanitizeDimension(value);
|
|
245
|
+
},
|
|
246
|
+
get rows() {
|
|
247
|
+
return state.rows;
|
|
248
|
+
},
|
|
249
|
+
set rows(value) {
|
|
250
|
+
state.rows = sanitizeDimension(value);
|
|
251
|
+
},
|
|
252
|
+
get refreshRate() {
|
|
253
|
+
return baseRuntime.refreshRate;
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
ctx.runtime = runtime;
|
|
257
|
+
return runtime;
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/worker/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAGnD,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAkBhD,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE9E;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,CAAC,YAAY,IAAI,UAAU,EAAE,aAAa,KAAK,IAAI,CAAC;AAC7D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,IAAI,UAAU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O,WAAW,CAAC,WAAW,CAAC;QACjC,CAAC;KACF,CAAC;IAED,GAAgC,CAAC,OAAO,GAAG,OAAO,CAAC;IACpD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flyingrobots/bijou-node",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Node.js adapter for bijou — chalk styling, readline I/O, process runtime.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -24,10 +24,13 @@
|
|
|
24
24
|
"lint": "tsc --noEmit"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"
|
|
27
|
+
"@flyingrobots/bijou-tui": "3.0.0",
|
|
28
|
+
"chalk": "^5.6.2",
|
|
29
|
+
"gifenc": "^1.0.3",
|
|
30
|
+
"oled-font-5x7": "^1.0.3"
|
|
28
31
|
},
|
|
29
32
|
"peerDependencies": {
|
|
30
|
-
"@flyingrobots/bijou": "
|
|
33
|
+
"@flyingrobots/bijou": "3.0.0"
|
|
31
34
|
},
|
|
32
35
|
"devDependencies": {
|
|
33
36
|
"@types/node": "^22.0.0",
|