@krate/app 0.0.0-stage → 0.5.0-rc.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/LICENSE +201 -0
- package/README.md +88 -2
- package/dist/automation.d.ts +11 -0
- package/dist/automation.d.ts.map +1 -0
- package/dist/automation.js +27 -0
- package/dist/badge.d.ts +13 -0
- package/dist/badge.d.ts.map +1 -0
- package/dist/badge.js +34 -0
- package/dist/chrome.d.ts +90 -0
- package/dist/chrome.d.ts.map +1 -0
- package/dist/chrome.js +133 -0
- package/dist/client.d.ts +26 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +545 -0
- package/dist/clipboard.d.ts +19 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +51 -0
- package/dist/cookies.d.ts +44 -0
- package/dist/cookies.d.ts.map +1 -0
- package/dist/cookies.js +45 -0
- package/dist/crash.d.ts +35 -0
- package/dist/crash.d.ts.map +1 -0
- package/dist/crash.js +28 -0
- package/dist/db.d.ts +14 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +23 -0
- package/dist/dialog.d.ts +36 -0
- package/dist/dialog.d.ts.map +1 -0
- package/dist/dialog.js +23 -0
- package/dist/downloads.d.ts +35 -0
- package/dist/downloads.d.ts.map +1 -0
- package/dist/downloads.js +30 -0
- package/dist/driver.d.ts +190 -0
- package/dist/driver.d.ts.map +1 -0
- package/dist/driver.js +637 -0
- package/dist/errors.d.ts +7 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +11 -0
- package/dist/events.d.ts +6 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +47 -0
- package/dist/extension.d.ts +10 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +25 -0
- package/dist/fakehost.d.ts +18 -0
- package/dist/fakehost.d.ts.map +1 -0
- package/dist/fakehost.js +199 -0
- package/dist/fs.d.ts +26 -0
- package/dist/fs.d.ts.map +1 -0
- package/dist/fs.js +38 -0
- package/dist/host.d.ts +4 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +25 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/kv.d.ts +6 -0
- package/dist/kv.d.ts.map +1 -0
- package/dist/kv.js +19 -0
- package/dist/lifecycle.d.ts +22 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +85 -0
- package/dist/login.d.ts +10 -0
- package/dist/login.d.ts.map +1 -0
- package/dist/login.js +8 -0
- package/dist/media.d.ts +50 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +70 -0
- package/dist/menu.d.ts +71 -0
- package/dist/menu.d.ts.map +1 -0
- package/dist/menu.js +114 -0
- package/dist/mock.d.ts +14 -0
- package/dist/mock.d.ts.map +1 -0
- package/dist/mock.js +47 -0
- package/dist/notify.d.ts +25 -0
- package/dist/notify.d.ts.map +1 -0
- package/dist/notify.js +32 -0
- package/dist/offscreen.d.ts +24 -0
- package/dist/offscreen.d.ts.map +1 -0
- package/dist/offscreen.js +27 -0
- package/dist/os.d.ts +20 -0
- package/dist/os.d.ts.map +1 -0
- package/dist/os.js +43 -0
- package/dist/page.d.ts +69 -0
- package/dist/page.d.ts.map +1 -0
- package/dist/page.js +61 -0
- package/dist/permission.d.ts +5 -0
- package/dist/permission.d.ts.map +1 -0
- package/dist/permission.js +18 -0
- package/dist/port.d.ts +35 -0
- package/dist/port.d.ts.map +1 -0
- package/dist/port.js +159 -0
- package/dist/power.d.ts +19 -0
- package/dist/power.d.ts.map +1 -0
- package/dist/power.js +35 -0
- package/dist/remote.d.ts +156 -0
- package/dist/remote.d.ts.map +1 -0
- package/dist/remote.js +115 -0
- package/dist/screen.d.ts +25 -0
- package/dist/screen.d.ts.map +1 -0
- package/dist/screen.js +23 -0
- package/dist/shortcut.d.ts +2 -0
- package/dist/shortcut.d.ts.map +1 -0
- package/dist/shortcut.js +44 -0
- package/dist/testing.d.ts +6 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +9 -0
- package/dist/theme.d.ts +12 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +13 -0
- package/dist/tray.d.ts +18 -0
- package/dist/tray.d.ts.map +1 -0
- package/dist/tray.js +23 -0
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/updater.d.ts +36 -0
- package/dist/updater.d.ts.map +1 -0
- package/dist/updater.js +58 -0
- package/dist/window.d.ts +154 -0
- package/dist/window.d.ts.map +1 -0
- package/dist/window.js +205 -0
- package/dist/wire.d.ts +26 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +328 -0
- package/dist/worker-host.d.ts +6 -0
- package/dist/worker-host.d.ts.map +1 -0
- package/dist/worker-host.js +36 -0
- package/dist/worker.d.ts +62 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +86 -0
- package/package.json +188 -3
package/dist/window.js
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// Open and control windows. Needs the "window" permission. The first window
|
|
2
|
+
// has the id "main". Always-on-top and absolute positions are ignored by
|
|
3
|
+
// Wayland compositors.
|
|
4
|
+
import { call } from "./index.js";
|
|
5
|
+
import { clean, subscribe } from "./events.js";
|
|
6
|
+
export class Window {
|
|
7
|
+
constructor(id) {
|
|
8
|
+
this.id = id;
|
|
9
|
+
}
|
|
10
|
+
cmd(name, ...args) {
|
|
11
|
+
return call(`krate/window.${name}`, [this.id, ...args]);
|
|
12
|
+
}
|
|
13
|
+
close() {
|
|
14
|
+
return this.cmd("close");
|
|
15
|
+
}
|
|
16
|
+
setTitle(title) {
|
|
17
|
+
return this.cmd("setTitle", title);
|
|
18
|
+
}
|
|
19
|
+
setSize(width, height) {
|
|
20
|
+
return this.cmd("setSize", width, height);
|
|
21
|
+
}
|
|
22
|
+
setPosition(x, y) {
|
|
23
|
+
return this.cmd("setPosition", x, y);
|
|
24
|
+
}
|
|
25
|
+
setAlwaysOnTop(on) {
|
|
26
|
+
return this.cmd("setAlwaysOnTop", on);
|
|
27
|
+
}
|
|
28
|
+
setFullscreen(on) {
|
|
29
|
+
return this.cmd("setFullscreen", on);
|
|
30
|
+
}
|
|
31
|
+
setFrameless(on) {
|
|
32
|
+
return this.cmd("setFrameless", on);
|
|
33
|
+
}
|
|
34
|
+
minimize() {
|
|
35
|
+
return this.cmd("minimize");
|
|
36
|
+
}
|
|
37
|
+
maximize() {
|
|
38
|
+
return this.cmd("maximize");
|
|
39
|
+
}
|
|
40
|
+
restore() {
|
|
41
|
+
return this.cmd("restore");
|
|
42
|
+
}
|
|
43
|
+
focus() {
|
|
44
|
+
return this.cmd("focus");
|
|
45
|
+
}
|
|
46
|
+
// Shows a hidden window. A window hidden with { release: true } gets its
|
|
47
|
+
// webview back on the route and scroll position it had; the page reloads
|
|
48
|
+
// and re-subscribes to host signals, which resend their current values.
|
|
49
|
+
show() {
|
|
50
|
+
return this.cmd("show");
|
|
51
|
+
}
|
|
52
|
+
// Hides the window. With { release: true } the webview is destroyed too:
|
|
53
|
+
// when every window is released the web process exits, which suits a tray
|
|
54
|
+
// app running in the background. Without it the page stays and gets a
|
|
55
|
+
// "krate:memory-pressure" event (see onMemoryPressure).
|
|
56
|
+
hide(opts = {}) {
|
|
57
|
+
return opts.release ? this.cmd("hide", true) : this.cmd("hide");
|
|
58
|
+
}
|
|
59
|
+
setPreventClose(on) {
|
|
60
|
+
return this.cmd("setPreventClose", on);
|
|
61
|
+
}
|
|
62
|
+
navigate(path) {
|
|
63
|
+
return this.cmd("navigate", path);
|
|
64
|
+
}
|
|
65
|
+
state() {
|
|
66
|
+
return call("krate/window.state", [this.id]);
|
|
67
|
+
}
|
|
68
|
+
// Adds a view (a second webview) to the window, split off another view of it.
|
|
69
|
+
addView(o = {}) {
|
|
70
|
+
const { beside, ...rest } = o;
|
|
71
|
+
return call("krate/window.addView", [
|
|
72
|
+
this.id,
|
|
73
|
+
clean({ ...rest, beside: beside === undefined ? undefined : typeof beside === "string" ? beside : beside.id }),
|
|
74
|
+
]).then((id) => new View(id));
|
|
75
|
+
}
|
|
76
|
+
// The window's views, the primary one first.
|
|
77
|
+
views() {
|
|
78
|
+
return call("krate/window.views", [this.id]);
|
|
79
|
+
}
|
|
80
|
+
// Replaces the layout. It must name every view of the window exactly once.
|
|
81
|
+
setLayout(layout) {
|
|
82
|
+
return call("krate/window.setLayout", [this.id, layoutToWire(layout)]);
|
|
83
|
+
}
|
|
84
|
+
// The layout as it is now, with the ratios the user dragged the dividers to.
|
|
85
|
+
layout() {
|
|
86
|
+
return call("krate/window.layout", [this.id]);
|
|
87
|
+
}
|
|
88
|
+
onCloseRequested(fn, opts) {
|
|
89
|
+
return onEvent((e) => {
|
|
90
|
+
if (e.window === this.id && e.kind === "close-requested")
|
|
91
|
+
fn();
|
|
92
|
+
}, opts);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function layoutToWire(l) {
|
|
96
|
+
if ("direction" in l) {
|
|
97
|
+
return clean({ direction: l.direction, ratio: l.ratio, first: layoutToWire(l.first), second: layoutToWire(l.second) });
|
|
98
|
+
}
|
|
99
|
+
return clean({ view: typeof l.view === "string" ? l.view : l.view.id, minWidth: l.minWidth, minHeight: l.minHeight });
|
|
100
|
+
}
|
|
101
|
+
// A pane of a layout showing a view.
|
|
102
|
+
export function pane(view, min = {}) {
|
|
103
|
+
return { view, ...min };
|
|
104
|
+
}
|
|
105
|
+
// A split of two layouts.
|
|
106
|
+
export function split(direction, first, second, ratio) {
|
|
107
|
+
return { direction, first, second, ...(ratio === undefined ? {} : { ratio }) };
|
|
108
|
+
}
|
|
109
|
+
// A handle to one view of a window. The first view of a window has the window's id.
|
|
110
|
+
export class View {
|
|
111
|
+
constructor(id) {
|
|
112
|
+
this.id = id;
|
|
113
|
+
}
|
|
114
|
+
// Removes the view; its neighbour takes the space. A window's first view
|
|
115
|
+
// cannot be removed (close the window).
|
|
116
|
+
remove() {
|
|
117
|
+
return call("krate/window.removeView", [this.id]);
|
|
118
|
+
}
|
|
119
|
+
focus() {
|
|
120
|
+
return call("krate/window.focusView", [this.id]);
|
|
121
|
+
}
|
|
122
|
+
navigate(path) {
|
|
123
|
+
return call("krate/window.navigateView", [this.id, path]);
|
|
124
|
+
}
|
|
125
|
+
// Sends JSON-compatible data to the view; its page receives a "krate:view-message"
|
|
126
|
+
// event (see onViewMessage). The sender's id arrives as "from".
|
|
127
|
+
post(data) {
|
|
128
|
+
const json = JSON.stringify(data);
|
|
129
|
+
if (json === undefined)
|
|
130
|
+
return Promise.reject(new TypeError("view.post: data is not JSON-compatible"));
|
|
131
|
+
return call("krate/window.postMessage", [this.id, JSON.parse(json)]);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export function getView(id) {
|
|
135
|
+
return new View(id);
|
|
136
|
+
}
|
|
137
|
+
// Every view of every window.
|
|
138
|
+
export function views() {
|
|
139
|
+
return call("krate/window.views", [""]);
|
|
140
|
+
}
|
|
141
|
+
export function onViewEvent(fn, opts) {
|
|
142
|
+
return subscribe("krate/window.viewEvents", fn, opts);
|
|
143
|
+
}
|
|
144
|
+
// Calls fn for a message another view posted to this page (View.post). Returns
|
|
145
|
+
// a function that stops listening. Outside a page it does nothing.
|
|
146
|
+
export function onViewMessage(fn) {
|
|
147
|
+
const target = globalThis;
|
|
148
|
+
if (typeof target.addEventListener !== "function")
|
|
149
|
+
return () => { };
|
|
150
|
+
const h = (e) => fn(e.detail);
|
|
151
|
+
target.addEventListener("krate:view-message", h);
|
|
152
|
+
return () => target.removeEventListener?.("krate:view-message", h);
|
|
153
|
+
}
|
|
154
|
+
export function main() {
|
|
155
|
+
return new Window("main");
|
|
156
|
+
}
|
|
157
|
+
export function get(id) {
|
|
158
|
+
return new Window(id);
|
|
159
|
+
}
|
|
160
|
+
export async function open(o = {}) {
|
|
161
|
+
const { position, ...rest } = o;
|
|
162
|
+
const id = await call("krate/window.open", [
|
|
163
|
+
{ ...rest, ...(position ? { x: position.x, y: position.y, hasPosition: true } : {}) },
|
|
164
|
+
]);
|
|
165
|
+
return new Window(id);
|
|
166
|
+
}
|
|
167
|
+
export function list() {
|
|
168
|
+
return call("krate/window.list");
|
|
169
|
+
}
|
|
170
|
+
export function onEvent(fn, opts) {
|
|
171
|
+
return subscribe("krate/window.events", fn, opts);
|
|
172
|
+
}
|
|
173
|
+
// Calls fn when the shell hides or minimizes this window, so the page can drop
|
|
174
|
+
// caches and large buffers. It listens for the "krate:memory-pressure" DOM
|
|
175
|
+
// event, which the shell dispatches before it returns memory to the system.
|
|
176
|
+
// Returns a function that stops listening. Outside a page it does nothing.
|
|
177
|
+
export function onMemoryPressure(fn) {
|
|
178
|
+
const target = globalThis;
|
|
179
|
+
if (typeof target.addEventListener !== "function")
|
|
180
|
+
return () => { };
|
|
181
|
+
target.addEventListener("krate:memory-pressure", fn);
|
|
182
|
+
return () => target.removeEventListener?.("krate:memory-pressure", fn);
|
|
183
|
+
}
|
|
184
|
+
// Calls fn when the user drops files from the operating system onto this page
|
|
185
|
+
// (its view). Returns a function that stops listening.
|
|
186
|
+
export function onFileDrop(fn, opts = {}) {
|
|
187
|
+
if (opts.all)
|
|
188
|
+
return subscribe("krate/window.fileDrops", fn, opts);
|
|
189
|
+
let stopped = false;
|
|
190
|
+
let stop = () => { };
|
|
191
|
+
call("krate/window.thisView")
|
|
192
|
+
.then((self) => {
|
|
193
|
+
if (stopped)
|
|
194
|
+
return;
|
|
195
|
+
stop = subscribe("krate/window.fileDrops", (e) => {
|
|
196
|
+
if (e.view === self)
|
|
197
|
+
fn(e);
|
|
198
|
+
}, opts);
|
|
199
|
+
})
|
|
200
|
+
.catch((e) => opts.onError?.(e));
|
|
201
|
+
return () => {
|
|
202
|
+
stopped = true;
|
|
203
|
+
stop();
|
|
204
|
+
};
|
|
205
|
+
}
|
package/dist/wire.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface EncodeCtx {
|
|
2
|
+
blobs: Uint8Array[];
|
|
3
|
+
}
|
|
4
|
+
export declare function encodeValue(v: unknown, ctx: EncodeCtx, root?: string): unknown;
|
|
5
|
+
export declare function buildFrame(tree: unknown, blobs: Uint8Array[]): Uint8Array;
|
|
6
|
+
export declare function encodeFrame(value: unknown, root?: string): Uint8Array;
|
|
7
|
+
export declare function decodeParts(json: Uint8Array, blobs: Uint8Array[]): unknown;
|
|
8
|
+
export declare function decodeFrame(buf: Uint8Array): {
|
|
9
|
+
value: unknown;
|
|
10
|
+
size: number;
|
|
11
|
+
};
|
|
12
|
+
export declare function decodeFrames(buf: Uint8Array): unknown[];
|
|
13
|
+
export declare class FrameReader {
|
|
14
|
+
private reader;
|
|
15
|
+
private chunks;
|
|
16
|
+
private len;
|
|
17
|
+
private eof;
|
|
18
|
+
constructor(stream: ReadableStream<Uint8Array>);
|
|
19
|
+
private take;
|
|
20
|
+
next(): Promise<{
|
|
21
|
+
value: unknown;
|
|
22
|
+
} | undefined>;
|
|
23
|
+
cancel(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare function readFrames(stream: ReadableStream<Uint8Array>): AsyncGenerator<unknown, void, undefined>;
|
|
26
|
+
//# sourceMappingURL=wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAuBD,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,SAAU,GAAG,OAAO,CAE/E;AA6ED,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,UAAU,CAkBzE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,SAAU,GAAG,UAAU,CAItE;AAgDD,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAE1E;AAID,wBAAgB,WAAW,CAAC,GAAG,EAAE,UAAU,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAoB7E;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,EAAE,CASvD;AAGD,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAA0C;IACxD,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,GAAG,CAAS;gBAER,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC;YAMhC,IAAI;IAoCZ,IAAI,IAAI,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC;IAgB/C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAO9B;AAED,wBAAuB,UAAU,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,CAW9G"}
|
package/dist/wire.js
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
// Frame codec for the host call protocol (see packages/native/PROTOCOL.md).
|
|
2
|
+
//
|
|
3
|
+
// Frame: u32 BE json length | json | u16 BE blob count | blobs (u32 BE len + bytes).
|
|
4
|
+
//
|
|
5
|
+
// Escape rule (PROTOCOL.md "Escapes" is the normative text): the reserved tag
|
|
6
|
+
// keys are $b, $d, $m, $s. A user object with exactly one own key that is a tag
|
|
7
|
+
// is written as {"<tag>$": <object>}. A user object whose only key is already
|
|
8
|
+
// an escaped form (<tag>$) is wrapped under that same key:
|
|
9
|
+
// {"$b$": {"$b$": x}}. On decode, an object whose only key is `$b$`, `$d$`,
|
|
10
|
+
// `$m$` or `$s$` is a wrapper: its value is a plain object whose own keys are
|
|
11
|
+
// taken literally (values still decode normally). An object with several keys
|
|
12
|
+
// is always plain, whatever its keys are.
|
|
13
|
+
const TAGS = ["$b", "$d", "$m", "$s"];
|
|
14
|
+
const ESCAPED = TAGS.map((t) => t + "$");
|
|
15
|
+
const te = new TextEncoder();
|
|
16
|
+
const td = new TextDecoder("utf-8", { fatal: true });
|
|
17
|
+
function fail(root, path, msg) {
|
|
18
|
+
throw new TypeError(`${root}${path ? " at " + path : ""}: ${msg}`);
|
|
19
|
+
}
|
|
20
|
+
// setOwn assigns an own data property, also for "__proto__" (a plain
|
|
21
|
+
// assignment would change the prototype instead and drop the key).
|
|
22
|
+
function setOwn(o, k, v) {
|
|
23
|
+
if (k === "__proto__")
|
|
24
|
+
Object.defineProperty(o, k, { value: v, enumerable: true, writable: true, configurable: true });
|
|
25
|
+
else
|
|
26
|
+
o[k] = v;
|
|
27
|
+
}
|
|
28
|
+
function addBlob(ctx, bytes) {
|
|
29
|
+
ctx.blobs.push(bytes);
|
|
30
|
+
return { $b: ctx.blobs.length - 1 };
|
|
31
|
+
}
|
|
32
|
+
// encodeValue converts a JS value to its JSON-ready tree, appending blobs to ctx.
|
|
33
|
+
// root names the value in error messages (for example "argument 2").
|
|
34
|
+
export function encodeValue(v, ctx, root = "value") {
|
|
35
|
+
return enc(v, ctx, root, "", []);
|
|
36
|
+
}
|
|
37
|
+
function enc(v, ctx, root, path, stack) {
|
|
38
|
+
switch (typeof v) {
|
|
39
|
+
case "string":
|
|
40
|
+
case "boolean":
|
|
41
|
+
return v;
|
|
42
|
+
case "number":
|
|
43
|
+
if (!Number.isFinite(v))
|
|
44
|
+
fail(root, path, `cannot encode ${String(v)} (numbers must be finite)`);
|
|
45
|
+
return v;
|
|
46
|
+
case "undefined":
|
|
47
|
+
return null;
|
|
48
|
+
case "bigint":
|
|
49
|
+
return fail(root, path, "cannot encode bigint");
|
|
50
|
+
case "function":
|
|
51
|
+
return fail(root, path, "cannot encode a function");
|
|
52
|
+
case "symbol":
|
|
53
|
+
return fail(root, path, "cannot encode a symbol");
|
|
54
|
+
}
|
|
55
|
+
if (v === null)
|
|
56
|
+
return null;
|
|
57
|
+
const o = v;
|
|
58
|
+
if (o instanceof Uint8Array)
|
|
59
|
+
return addBlob(ctx, o);
|
|
60
|
+
if (o instanceof ArrayBuffer)
|
|
61
|
+
return addBlob(ctx, new Uint8Array(o.slice(0)));
|
|
62
|
+
if (ArrayBuffer.isView(o)) {
|
|
63
|
+
const view = o;
|
|
64
|
+
return addBlob(ctx, new Uint8Array(view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength)));
|
|
65
|
+
}
|
|
66
|
+
if (o instanceof Date) {
|
|
67
|
+
if (Number.isNaN(o.getTime()))
|
|
68
|
+
fail(root, path, "cannot encode an invalid Date");
|
|
69
|
+
const year = o.getUTCFullYear();
|
|
70
|
+
if (year < 0 || year > 9999)
|
|
71
|
+
fail(root, path, `cannot encode a Date in year ${year} (0000 to 9999 only)`);
|
|
72
|
+
return { $d: o.toISOString() };
|
|
73
|
+
}
|
|
74
|
+
if (stack.includes(o))
|
|
75
|
+
fail(root, path, "cannot encode a circular structure");
|
|
76
|
+
stack.push(o);
|
|
77
|
+
try {
|
|
78
|
+
if (Array.isArray(o)) {
|
|
79
|
+
return o.map((x, i) => enc(x, ctx, root, `${path}[${i}]`, stack));
|
|
80
|
+
}
|
|
81
|
+
if (o instanceof Map) {
|
|
82
|
+
const pairs = [];
|
|
83
|
+
let i = 0;
|
|
84
|
+
for (const [k, val] of o) {
|
|
85
|
+
pairs.push([enc(k, ctx, root, `${path}.<key ${i}>`, stack), enc(val, ctx, root, `${path}.<value ${i}>`, stack)]);
|
|
86
|
+
i++;
|
|
87
|
+
}
|
|
88
|
+
return { $m: pairs };
|
|
89
|
+
}
|
|
90
|
+
if (o instanceof Set) {
|
|
91
|
+
const items = [];
|
|
92
|
+
let i = 0;
|
|
93
|
+
for (const x of o)
|
|
94
|
+
items.push(enc(x, ctx, root, `${path}.<item ${i++}>`, stack));
|
|
95
|
+
return { $s: items };
|
|
96
|
+
}
|
|
97
|
+
const proto = Object.getPrototypeOf(o);
|
|
98
|
+
if (proto !== Object.prototype && proto !== null) {
|
|
99
|
+
const name = (proto.constructor && proto.constructor.name) || "unknown";
|
|
100
|
+
fail(root, path, `cannot encode an instance of ${name} (only plain objects, arrays, Date, Map, Set and Uint8Array)`);
|
|
101
|
+
}
|
|
102
|
+
const keys = Object.keys(o);
|
|
103
|
+
const out = {};
|
|
104
|
+
for (const k of keys) {
|
|
105
|
+
const val = o[k];
|
|
106
|
+
if (val === undefined)
|
|
107
|
+
continue;
|
|
108
|
+
setOwn(out, k, enc(val, ctx, root, `${path}.${k}`, stack));
|
|
109
|
+
}
|
|
110
|
+
if (keys.length === 1 && out[keys[0]] !== undefined) {
|
|
111
|
+
const k = keys[0];
|
|
112
|
+
if (TAGS.includes(k))
|
|
113
|
+
return { [k + "$"]: out };
|
|
114
|
+
if (ESCAPED.includes(k))
|
|
115
|
+
return { [k]: out };
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
stack.pop();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export function buildFrame(tree, blobs) {
|
|
124
|
+
if (blobs.length > 0xffff)
|
|
125
|
+
throw new TypeError(`too many binary values in one frame (${blobs.length} > 65535)`);
|
|
126
|
+
const json = te.encode(JSON.stringify(tree));
|
|
127
|
+
let size = 4 + json.length + 2;
|
|
128
|
+
for (const b of blobs)
|
|
129
|
+
size += 4 + b.length;
|
|
130
|
+
const out = new Uint8Array(size);
|
|
131
|
+
const dv = new DataView(out.buffer);
|
|
132
|
+
dv.setUint32(0, json.length);
|
|
133
|
+
out.set(json, 4);
|
|
134
|
+
let p = 4 + json.length;
|
|
135
|
+
dv.setUint16(p, blobs.length);
|
|
136
|
+
p += 2;
|
|
137
|
+
for (const b of blobs) {
|
|
138
|
+
dv.setUint32(p, b.length);
|
|
139
|
+
out.set(b, p + 4);
|
|
140
|
+
p += 4 + b.length;
|
|
141
|
+
}
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
export function encodeFrame(value, root = "value") {
|
|
145
|
+
const ctx = { blobs: [] };
|
|
146
|
+
const tree = encodeValue(value, ctx, root);
|
|
147
|
+
return buildFrame(tree, ctx.blobs);
|
|
148
|
+
}
|
|
149
|
+
// RFC 3339 date-time: any fraction length, Z or a numeric offset.
|
|
150
|
+
const RFC3339 = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(Z|[+-]\d\d:\d\d)$/;
|
|
151
|
+
function dec(t, blobs) {
|
|
152
|
+
if (t === null || typeof t !== "object")
|
|
153
|
+
return t;
|
|
154
|
+
if (Array.isArray(t))
|
|
155
|
+
return t.map((x) => dec(x, blobs));
|
|
156
|
+
const o = t;
|
|
157
|
+
const keys = Object.keys(o);
|
|
158
|
+
if (keys.length === 1) {
|
|
159
|
+
const k = keys[0];
|
|
160
|
+
const v = o[k];
|
|
161
|
+
if (k === "$b") {
|
|
162
|
+
if (typeof v !== "number" || !Number.isInteger(v) || v < 0 || v >= blobs.length) {
|
|
163
|
+
throw new Error(`bad blob index ${JSON.stringify(v)}`);
|
|
164
|
+
}
|
|
165
|
+
return blobs[v];
|
|
166
|
+
}
|
|
167
|
+
if (k === "$d") {
|
|
168
|
+
if (typeof v !== "string")
|
|
169
|
+
throw new Error("bad $d value");
|
|
170
|
+
const d = RFC3339.test(v) ? new Date(v) : new Date(NaN);
|
|
171
|
+
if (Number.isNaN(d.getTime()))
|
|
172
|
+
throw new Error(`bad date ${JSON.stringify(v)}`);
|
|
173
|
+
return d;
|
|
174
|
+
}
|
|
175
|
+
if (k === "$m") {
|
|
176
|
+
if (!Array.isArray(v))
|
|
177
|
+
throw new Error("bad $m value");
|
|
178
|
+
return new Map(v.map((p) => {
|
|
179
|
+
if (!Array.isArray(p) || p.length !== 2)
|
|
180
|
+
throw new Error("bad $m entry");
|
|
181
|
+
return [dec(p[0], blobs), dec(p[1], blobs)];
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
if (k === "$s") {
|
|
185
|
+
if (!Array.isArray(v))
|
|
186
|
+
throw new Error("bad $s value");
|
|
187
|
+
return new Set(v.map((x) => dec(x, blobs)));
|
|
188
|
+
}
|
|
189
|
+
if (ESCAPED.includes(k)) {
|
|
190
|
+
if (v === null || typeof v !== "object" || Array.isArray(v))
|
|
191
|
+
throw new Error(`bad ${k} wrapper`);
|
|
192
|
+
const inner = {};
|
|
193
|
+
for (const ik of Object.keys(v))
|
|
194
|
+
setOwn(inner, ik, dec(v[ik], blobs));
|
|
195
|
+
return inner;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const out = {};
|
|
199
|
+
for (const k of keys)
|
|
200
|
+
setOwn(out, k, dec(o[k], blobs));
|
|
201
|
+
return out;
|
|
202
|
+
}
|
|
203
|
+
export function decodeParts(json, blobs) {
|
|
204
|
+
return dec(JSON.parse(td.decode(json)), blobs);
|
|
205
|
+
}
|
|
206
|
+
// decodeFrame decodes one frame at the start of buf. It returns the value and
|
|
207
|
+
// the number of bytes consumed.
|
|
208
|
+
export function decodeFrame(buf) {
|
|
209
|
+
const dv = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
210
|
+
const trunc = () => new Error("truncated frame");
|
|
211
|
+
if (buf.length < 4)
|
|
212
|
+
throw trunc();
|
|
213
|
+
const n = dv.getUint32(0);
|
|
214
|
+
if (buf.length < 4 + n + 2)
|
|
215
|
+
throw trunc();
|
|
216
|
+
const json = buf.subarray(4, 4 + n);
|
|
217
|
+
let p = 4 + n;
|
|
218
|
+
const k = dv.getUint16(p);
|
|
219
|
+
p += 2;
|
|
220
|
+
const blobs = [];
|
|
221
|
+
for (let i = 0; i < k; i++) {
|
|
222
|
+
if (buf.length < p + 4)
|
|
223
|
+
throw trunc();
|
|
224
|
+
const m = dv.getUint32(p);
|
|
225
|
+
p += 4;
|
|
226
|
+
if (buf.length < p + m)
|
|
227
|
+
throw trunc();
|
|
228
|
+
blobs.push(buf.subarray(p, p + m));
|
|
229
|
+
p += m;
|
|
230
|
+
}
|
|
231
|
+
return { value: decodeParts(json, blobs), size: p };
|
|
232
|
+
}
|
|
233
|
+
export function decodeFrames(buf) {
|
|
234
|
+
const out = [];
|
|
235
|
+
let p = 0;
|
|
236
|
+
while (p < buf.length) {
|
|
237
|
+
const { value, size } = decodeFrame(buf.subarray(p));
|
|
238
|
+
out.push(value);
|
|
239
|
+
p += size;
|
|
240
|
+
}
|
|
241
|
+
return out;
|
|
242
|
+
}
|
|
243
|
+
// FrameReader pulls frames off a byte stream, tolerating arbitrary chunking.
|
|
244
|
+
export class FrameReader {
|
|
245
|
+
constructor(stream) {
|
|
246
|
+
this.chunks = [];
|
|
247
|
+
this.len = 0;
|
|
248
|
+
this.eof = false;
|
|
249
|
+
this.reader = stream.getReader();
|
|
250
|
+
}
|
|
251
|
+
// take returns exactly n bytes, or null on a clean EOF at a frame boundary
|
|
252
|
+
// (only when allowEof is set and nothing is buffered).
|
|
253
|
+
async take(n, allowEof = false) {
|
|
254
|
+
while (this.len < n) {
|
|
255
|
+
if (this.eof) {
|
|
256
|
+
if (allowEof && this.len === 0)
|
|
257
|
+
return null;
|
|
258
|
+
throw new Error("truncated frame");
|
|
259
|
+
}
|
|
260
|
+
const r = await this.reader.read();
|
|
261
|
+
if (r.done) {
|
|
262
|
+
this.eof = true;
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
if (r.value.length) {
|
|
266
|
+
this.chunks.push(r.value);
|
|
267
|
+
this.len += r.value.length;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
const out = new Uint8Array(n);
|
|
271
|
+
let o = 0;
|
|
272
|
+
while (o < n) {
|
|
273
|
+
const c = this.chunks[0];
|
|
274
|
+
const need = n - o;
|
|
275
|
+
if (c.length <= need) {
|
|
276
|
+
out.set(c, o);
|
|
277
|
+
o += c.length;
|
|
278
|
+
this.chunks.shift();
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
out.set(c.subarray(0, need), o);
|
|
282
|
+
this.chunks[0] = c.subarray(need);
|
|
283
|
+
o += need;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
this.len -= n;
|
|
287
|
+
return out;
|
|
288
|
+
}
|
|
289
|
+
// next resolves to the next decoded frame, or undefined at end of stream.
|
|
290
|
+
async next() {
|
|
291
|
+
const head = await this.take(4, true);
|
|
292
|
+
if (head === null)
|
|
293
|
+
return undefined;
|
|
294
|
+
const n = new DataView(head.buffer).getUint32(0);
|
|
295
|
+
const body = (await this.take(n + 2));
|
|
296
|
+
const json = body.subarray(0, n);
|
|
297
|
+
const k = new DataView(body.buffer, body.byteOffset + n, 2).getUint16(0);
|
|
298
|
+
const blobs = [];
|
|
299
|
+
for (let i = 0; i < k; i++) {
|
|
300
|
+
const lb = (await this.take(4));
|
|
301
|
+
const m = new DataView(lb.buffer).getUint32(0);
|
|
302
|
+
blobs.push((await this.take(m)));
|
|
303
|
+
}
|
|
304
|
+
return { value: decodeParts(json, blobs) };
|
|
305
|
+
}
|
|
306
|
+
async cancel() {
|
|
307
|
+
try {
|
|
308
|
+
await this.reader.cancel();
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
// already closed or errored
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
export async function* readFrames(stream) {
|
|
316
|
+
const r = new FrameReader(stream);
|
|
317
|
+
try {
|
|
318
|
+
for (;;) {
|
|
319
|
+
const f = await r.next();
|
|
320
|
+
if (!f)
|
|
321
|
+
return;
|
|
322
|
+
yield f.value;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
finally {
|
|
326
|
+
await r.cancel();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type Handler = (data: unknown) => void | Promise<void>;
|
|
2
|
+
export declare function onMessage(fn: Handler): void;
|
|
3
|
+
export declare function postMessage(data: unknown): Promise<void>;
|
|
4
|
+
export declare const workerId: string;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=worker-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-host.d.ts","sourceRoot":"","sources":["../src/worker-host.ts"],"names":[],"mappings":"AAYA,KAAK,OAAO,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAYvD,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAU3C;AAID,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAExD;AAGD,eAAO,MAAM,QAAQ,EAAE,MAAyH,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// The side of a worker that runs inside the worker process: receive the
|
|
2
|
+
// messages the app posts and send messages back. Import it from the module
|
|
3
|
+
// listed in native.workers; it needs no permission.
|
|
4
|
+
//
|
|
5
|
+
// import { onMessage, postMessage } from "@krate/app/worker-host";
|
|
6
|
+
// onMessage(async (job) => postMessage({ done: job.id }));
|
|
7
|
+
//
|
|
8
|
+
// Messages are JSON values or binary (Uint8Array), Date, Map and Set. A
|
|
9
|
+
// channel end handed to the worker (Port.transferPort(port, "worker:<id>"))
|
|
10
|
+
// is used with portFromId from "@krate/app/port".
|
|
11
|
+
import { call } from "./index.js";
|
|
12
|
+
let registered = false;
|
|
13
|
+
let handler;
|
|
14
|
+
// onMessage sets the function that receives each message the app posts to
|
|
15
|
+
// this worker, one at a time and in order. Calling it again replaces the
|
|
16
|
+
// handler.
|
|
17
|
+
export function onMessage(fn) {
|
|
18
|
+
handler = fn;
|
|
19
|
+
if (registered)
|
|
20
|
+
return;
|
|
21
|
+
const host = globalThis.__krateHost;
|
|
22
|
+
if (!host)
|
|
23
|
+
throw new Error("worker-host: onMessage must run inside a Krate worker process");
|
|
24
|
+
registered = true;
|
|
25
|
+
host.register("__worker.message", async (data) => {
|
|
26
|
+
await handler?.(data);
|
|
27
|
+
return null;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
// postMessage sends a value to the app (it arrives as a "message" event of the
|
|
31
|
+
// worker's handle).
|
|
32
|
+
export function postMessage(data) {
|
|
33
|
+
return call("krate/worker.emit", [data]);
|
|
34
|
+
}
|
|
35
|
+
// The id of this worker instance, for ports: transferPort(port, `worker:${workerId}`).
|
|
36
|
+
export const workerId = (globalThis.process?.env?.KRATE_WORKER_ID) ?? "";
|
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export interface WorkerStartOptions {
|
|
2
|
+
args?: string[];
|
|
3
|
+
env?: Record<string, string>;
|
|
4
|
+
}
|
|
5
|
+
export interface WorkerRestart {
|
|
6
|
+
policy?: "never" | "onFailure" | "always";
|
|
7
|
+
max?: number;
|
|
8
|
+
backoffMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface WorkerSpec {
|
|
11
|
+
name: string;
|
|
12
|
+
runtime: "node" | "bun" | "deno" | "go" | "exec";
|
|
13
|
+
entry: string;
|
|
14
|
+
permissions?: string[];
|
|
15
|
+
restart?: WorkerRestart;
|
|
16
|
+
autostart?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export type WorkerState = "starting" | "running" | "restarting" | "stopped" | "failed";
|
|
19
|
+
export interface WorkerInfo {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
state: WorkerState;
|
|
23
|
+
pid: number;
|
|
24
|
+
restarts: number;
|
|
25
|
+
exitCode?: number;
|
|
26
|
+
error?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface WorkerEvent {
|
|
29
|
+
kind: "started" | "exit" | "crash" | "restarting" | "stopped" | "failed" | "message";
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
pid?: number;
|
|
33
|
+
exitCode?: number;
|
|
34
|
+
error?: string;
|
|
35
|
+
attempt?: number;
|
|
36
|
+
delayMs?: number;
|
|
37
|
+
data?: unknown;
|
|
38
|
+
}
|
|
39
|
+
export declare function workerSpecs(): Promise<WorkerSpec[]>;
|
|
40
|
+
export declare function listWorkers(): Promise<WorkerInfo[]>;
|
|
41
|
+
export declare function onWorkerEvent(fn: (e: WorkerEvent) => void, id?: string): () => void;
|
|
42
|
+
export declare class WorkerHandle {
|
|
43
|
+
#private;
|
|
44
|
+
readonly id: string;
|
|
45
|
+
readonly name: string;
|
|
46
|
+
onmessage: ((data: unknown) => void) | null;
|
|
47
|
+
onexit: ((e: {
|
|
48
|
+
code: number;
|
|
49
|
+
crashed: boolean;
|
|
50
|
+
error?: string;
|
|
51
|
+
}) => void) | null;
|
|
52
|
+
onrestart: ((e: {
|
|
53
|
+
attempt: number;
|
|
54
|
+
delayMs: number;
|
|
55
|
+
}) => void) | null;
|
|
56
|
+
constructor(id: string, name: string);
|
|
57
|
+
get portOwner(): string;
|
|
58
|
+
postMessage(data: unknown): Promise<void>;
|
|
59
|
+
terminate(): Promise<void>;
|
|
60
|
+
}
|
|
61
|
+
export declare function startWorker(name: string, options?: WorkerStartOptions): Promise<WorkerHandle>;
|
|
62
|
+
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"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"}
|