@native-sdk/cli 0.8.3 → 0.9.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/build/app.zig +905 -61
- package/build.zig +674 -373
- package/build.zig.zon +1 -0
- package/native-sdk.d.ts +6 -0
- package/package.json +12 -11
- package/packages/core/compile-surface/core.ts +455 -3
- package/packages/core/package-lock.json +11 -11
- package/packages/core/package.json +2 -2
- package/packages/core/scripts/compiler_typecheck.mjs +116 -15
- package/packages/core/scripts/gen_service_surface.mjs +268 -0
- package/packages/core/scripts/npm_static_spike.mjs +64 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +77 -6
- package/packages/core/scripts/run_external_service_compiler.mjs +240 -0
- package/packages/core/scripts/stage_external_core.mjs +9 -1
- package/packages/core/scripts/stage_external_services.mjs +172 -0
- package/packages/core/scripts/surface_manifest_diff.mjs +253 -0
- package/packages/core/scripts/vendor_service_packages.mjs +189 -0
- package/packages/core/sdk/core.d.ts +214 -2
- package/packages/core/sdk/core.ts +715 -42
- package/packages/core/sdk/events.d.ts +50 -0
- package/packages/core/sdk/events.ts +75 -0
- package/packages/core/src/checker.ts +528 -15
- package/packages/core/src/cli.ts +143 -3
- package/packages/core/src/contract.ts +26 -5
- package/packages/core/src/devhost.ts +1849 -18
- package/packages/core/src/devhost_journal.mjs +181 -0
- package/packages/core/src/devhost_resolver.mjs +17 -1
- package/packages/core/src/devhost_service_worker.mjs +90 -0
- package/packages/core/src/diagnostics.ts +84 -18
- package/packages/core/src/frontend.ts +204 -34
- package/packages/core/src/modules.ts +129 -80
- package/packages/core/src/service_contract.ts +597 -0
- package/packages/core/src/sqlite_cli.ts +93 -0
- package/packages/core/src/sqlite_codegen.ts +806 -0
- package/packages/core/src/sqlite_runtime_policy.ts +364 -0
- package/packages/core/src/typed_ast.ts +36 -8
- package/skill-data/core/SKILL.md +4 -2
- package/skill-data/core/references/project-anatomy.md +3 -2
- package/skill-data/core/references/web-engines-packaging-debugging.md +3 -1
- package/skill-data/native-ui/SKILL.md +55 -8
- package/skill-data/ts-core/SKILL.md +92 -40
- package/skill-data/ts-services/SKILL.md +126 -0
- package/skill-data/ts-services/references/service-surface.md +603 -0
- package/skill-data/zig/SKILL.md +1 -1
- package/skills/native-sdk/SKILL.md +1 -1
- package/src/app_runner/no_migrations.zig +3 -0
- package/src/app_runner/no_services.zig +20 -0
- package/src/app_runner/root.zig +104 -4
- package/src/app_runner/ts_core_main.zig +268 -4
- package/src/automation/snapshot.zig +23 -5
- package/src/embed/app_exports.zig +11 -1
- package/src/embed/c_api.zig +48 -2
- package/src/embed/conversions.zig +4 -5
- package/src/embed/host.zig +115 -1
- package/src/embed/root.zig +7 -0
- package/src/embed/tests.zig +213 -0
- package/src/embed/types.zig +51 -0
- package/src/embed/ui_host.zig +121 -5
- package/src/platform/android/NativeSdkActivity.java +131 -0
- package/src/platform/android/android_host.c +182 -1
- package/src/platform/android/native_sdk_app.h +17 -0
- package/src/platform/ios/native_sdk_app.h +17 -0
- package/src/platform/ios/uikit_host.m +115 -0
- package/src/platform/linux/cef_host.cpp +1 -1
- package/src/platform/linux/gtk_host.c +89 -17
- package/src/platform/linux/gtk_host.h +3 -0
- package/src/platform/linux/root.zig +41 -18
- package/src/platform/macos/appkit_host.h +26 -3
- package/src/platform/macos/appkit_host.m +1051 -129
- package/src/platform/macos/capture_info_plist.c +25 -0
- package/src/platform/macos/cef_host.mm +270 -36
- package/src/platform/macos/root.zig +312 -34
- package/src/platform/null_platform.zig +281 -19
- package/src/platform/null_platform_tests.zig +74 -0
- package/src/platform/root.zig +16 -0
- package/src/platform/types.zig +279 -15
- package/src/platform/windows/root.zig +243 -21
- package/src/platform/windows/webview2_host.cpp +464 -46
- package/src/primitives/app_manifest/comptime_scene.zig +2 -0
- package/src/primitives/app_manifest/root.zig +4 -0
- package/src/primitives/app_manifest/tests.zig +3 -0
- package/src/primitives/app_manifest/types.zig +34 -0
- package/src/primitives/app_manifest/validation.zig +19 -1
- package/src/primitives/canvas/code_tests.zig +9 -9
- package/src/primitives/canvas/events.zig +12 -11
- package/src/primitives/canvas/frame.zig +44 -9
- package/src/primitives/canvas/icons/mic.svg +1 -0
- package/src/primitives/canvas/icons.zig +2 -0
- package/src/primitives/canvas/root.zig +8 -0
- package/src/primitives/canvas/text_span_tests.zig +39 -0
- package/src/primitives/canvas/ui.zig +23 -4
- package/src/primitives/canvas/ui_markup.zig +15 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +9 -0
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +1 -1
- package/src/primitives/canvas/ui_markup_tests.zig +5 -0
- package/src/primitives/canvas/ui_markup_view.zig +9 -0
- package/src/primitives/canvas/ui_markup_view_tests.zig +9 -6
- package/src/primitives/canvas/ui_schema.zig +19 -10
- package/src/primitives/canvas/ui_schema_tests.zig +5 -3
- package/src/primitives/canvas/ui_tests.zig +18 -4
- package/src/primitives/canvas/widget_invalidation.zig +9 -2
- package/src/primitives/canvas/widget_render.zig +296 -114
- package/src/primitives/canvas/widget_runtime_tests.zig +133 -0
- package/src/primitives/canvas/widget_text_input.zig +10 -10
- package/src/primitives/canvas/widget_tree.zig +1 -1
- package/src/primitives/canvas/widgets.zig +29 -5
- package/src/root.zig +56 -0
- package/src/runtime/api.zig +11 -0
- package/src/runtime/automation_snapshot.zig +4 -0
- package/src/runtime/automation_widget_dispatch.zig +1 -0
- package/src/runtime/bridge_payload.zig +2 -0
- package/src/runtime/bridge_permission_tests.zig +23 -2
- package/src/runtime/bridge_responses.zig +3 -1
- package/src/runtime/canvas_frame.zig +31 -13
- package/src/runtime/canvas_frame_animation_tests.zig +4 -0
- package/src/runtime/canvas_frame_invalidation_tests.zig +35 -10
- package/src/runtime/canvas_widget_anchored_tests.zig +83 -0
- package/src/runtime/canvas_widget_events.zig +69 -24
- package/src/runtime/canvas_widget_runtime.zig +101 -6
- package/src/runtime/canvas_widget_scroll_driver_tests.zig +47 -4
- package/src/runtime/canvas_widget_scroll_drivers.zig +3 -3
- package/src/runtime/canvas_widget_semantics_tests.zig +2 -0
- package/src/runtime/canvas_widget_split_tree_tests.zig +228 -0
- package/src/runtime/canvas_widget_state.zig +6 -1
- package/src/runtime/canvas_widget_text_tests.zig +112 -3
- package/src/runtime/clock.zig +13 -1
- package/src/runtime/core.zig +133 -1
- package/src/runtime/credentials_store.zig +115 -0
- package/src/runtime/effects.zig +2568 -75
- package/src/runtime/effects_audio_capture_tests.zig +251 -0
- package/src/runtime/effects_credentials_tests.zig +332 -0
- package/src/runtime/effects_host_tests.zig +208 -1
- package/src/runtime/effects_relational_tests.zig +314 -0
- package/src/runtime/effects_store_tests.zig +211 -0
- package/src/runtime/flow.zig +14 -1
- package/src/runtime/gpu_surface_events.zig +6 -1
- package/src/runtime/native_command_event_tests.zig +42 -0
- package/src/runtime/persist_store.zig +666 -0
- package/src/runtime/record_store.zig +788 -0
- package/src/runtime/relational_store.zig +854 -0
- package/src/runtime/root.zig +52 -0
- package/src/runtime/runtime_event_tests.zig +70 -0
- package/src/runtime/service_host.zig +711 -0
- package/src/runtime/service_pool.zig +1314 -0
- package/src/runtime/session_blobs.zig +1 -1
- package/src/runtime/session_journal.zig +102 -0
- package/src/runtime/session_record.zig +177 -0
- package/src/runtime/session_replay.zig +109 -4
- package/src/runtime/shell_layout.zig +1 -0
- package/src/runtime/shell_layout_tests.zig +120 -0
- package/src/runtime/sqlite_engine.zig +474 -0
- package/src/runtime/state.zig +6 -0
- package/src/runtime/system_services.zig +49 -10
- package/src/runtime/tests.zig +5 -0
- package/src/runtime/ts_core_host.zig +1189 -118
- package/src/runtime/ts_core_host_tests.zig +638 -11
- package/src/runtime/ts_ui_app.zig +537 -1
- package/src/runtime/ui_app.zig +160 -19
- package/src/runtime/ui_app_tests.zig +203 -5
- package/src/runtime/validation.zig +22 -0
- package/src/runtime/view.zig +11 -0
- package/src/runtime/view_widget_scroll.zig +56 -5
- package/src/runtime/view_widget_text.zig +24 -5
- package/src/runtime/view_widget_tree.zig +1 -1
- package/src/runtime/window_storage.zig +1 -0
- package/src/runtime/window_view_runtime.zig +2 -3
- package/src/runtime/window_views.zig +19 -0
- package/src/tooling/android.zig +21 -16
- package/src/tooling/db.zig +160 -0
- package/src/tooling/ios.zig +7 -1
- package/src/tooling/manifest.zig +1248 -2
- package/src/tooling/package.zig +953 -6
- package/src/tooling/raw_manifest.zig +65 -0
- package/src/tooling/root.zig +1 -0
- package/src/tooling/templates.zig +216 -4
- package/src/tooling/ts_core.zig +283 -17
- package/src/tooling/verbs.zig +7 -0
- package/third_party/sqlite/README.md +13 -0
- package/third_party/sqlite/sqlite3.c +269649 -0
- package/third_party/sqlite/sqlite3.h +14349 -0
- package/tools/corewire/core_abi.zig +14 -2
- package/tools/corewire/emit.zig +98 -29
- package/tools/corewire/emit_facade.zig +414 -23
- package/tools/corewire/emit_profile.zig +6 -2
- package/tools/corewire/emit_service.zig +924 -0
- package/tools/corewire/main.zig +122 -0
- package/tools/corewire/service_contract.zig +250 -0
- package/tools/corewire/sidecar.zig +26 -15
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
export declare function asciiBytes(s: string): Uint8Array;
|
|
2
|
+
export declare function utf8Bytes(s: string): Uint8Array;
|
|
2
3
|
export type Msgish = {
|
|
3
4
|
readonly kind: string;
|
|
4
5
|
};
|
|
6
|
+
/** Cooperative cancellation capability supplied by generated service hosts. */
|
|
7
|
+
export interface ServiceCancellation {
|
|
8
|
+
/** True after Cmd.cancel or the operation deadline requests cancellation. */
|
|
9
|
+
readonly cancelled: () => boolean;
|
|
10
|
+
/** Throw a boundary-tagged cancellation error when cancellation was requested. */
|
|
11
|
+
readonly throwIfCancelled: () => void;
|
|
12
|
+
}
|
|
5
13
|
export type TimestampKind<M extends Msgish> = M extends Msgish ? {
|
|
6
14
|
[K in Exclude<keyof M, "kind">]-?: M[K] extends number ? [Exclude<keyof M, "kind">] extends [K] ? M["kind"] : never : never;
|
|
7
15
|
}[Exclude<keyof M, "kind">] : never;
|
|
8
16
|
export type BytesKind<M extends Msgish> = M extends Msgish ? {
|
|
9
17
|
[K in Exclude<keyof M, "kind">]-?: M[K] extends Uint8Array ? [Exclude<keyof M, "kind">] extends [K] ? M["kind"] : never : never;
|
|
10
18
|
}[Exclude<keyof M, "kind">] : never;
|
|
19
|
+
export type ServiceKind<M extends Msgish, P> = M extends Msgish ? {
|
|
20
|
+
[K in Exclude<keyof M, "kind">]-?: M[K] extends P ? P extends M[K] ? [Exclude<keyof M, "kind">] extends [K] ? M["kind"] : never : never : never;
|
|
21
|
+
}[Exclude<keyof M, "kind">] : never;
|
|
22
|
+
export interface ServiceRoute<M extends Msgish, P> {
|
|
23
|
+
readonly key?: string;
|
|
24
|
+
readonly ok: ServiceKind<M, P>;
|
|
25
|
+
readonly err: BytesKind<M>;
|
|
26
|
+
}
|
|
27
|
+
export interface ServiceStreamRoute<M extends Msgish, P> extends ServiceRoute<M, P> {
|
|
28
|
+
readonly channelKey: number;
|
|
29
|
+
readonly event: ChannelEventKind<M>;
|
|
30
|
+
}
|
|
11
31
|
export type EmptyKind<M extends Msgish> = M extends Msgish ? [Exclude<keyof M, "kind">] extends [never] ? M["kind"] : never : never;
|
|
12
32
|
export type FetchedKind<M extends Msgish> = M extends Msgish ? {
|
|
13
33
|
[K in Exclude<keyof M, "kind">]-?: M[K] extends Uint8Array ? Exclude<keyof M, "kind" | K> extends infer O ? O extends keyof M ? M[O] extends number ? [Exclude<keyof M, "kind" | K | O>] extends [never] ? M["kind"] : never : never : never : never : never;
|
|
@@ -58,10 +78,35 @@ export type ChannelEventKind<M extends Msgish> = M extends Msgish ? [Exclude<key
|
|
|
58
78
|
export interface ChannelRoute<M extends Msgish> {
|
|
59
79
|
readonly event: ChannelEventKind<M>;
|
|
60
80
|
}
|
|
81
|
+
export type AudioCaptureSource = "microphone" | "system";
|
|
82
|
+
export type AudioCaptureState = "started" | "data" | "failed" | "stopped" | "rejected";
|
|
83
|
+
export type AudioCaptureSampleRate = 16000 | 24000 | 48000;
|
|
84
|
+
export type AudioCaptureChannels = 1 | 2;
|
|
85
|
+
export interface AudioCaptureSpec {
|
|
86
|
+
readonly source: AudioCaptureSource;
|
|
87
|
+
readonly sampleRate?: AudioCaptureSampleRate;
|
|
88
|
+
readonly channels?: AudioCaptureChannels;
|
|
89
|
+
}
|
|
90
|
+
export type AudioCaptureEventArm = {
|
|
91
|
+
readonly key: number;
|
|
92
|
+
readonly state: AudioCaptureState;
|
|
93
|
+
readonly source: AudioCaptureSource;
|
|
94
|
+
readonly sampleRate: number;
|
|
95
|
+
readonly channels: number;
|
|
96
|
+
readonly timestampMs: number;
|
|
97
|
+
readonly frames: number;
|
|
98
|
+
readonly pcm: Uint8Array;
|
|
99
|
+
readonly droppedPending: number;
|
|
100
|
+
readonly droppedTotal: number;
|
|
101
|
+
};
|
|
102
|
+
export type AudioCaptureEventKind<M extends Msgish> = M extends Msgish ? [Exclude<keyof M, "kind">] extends [keyof AudioCaptureEventArm] ? [keyof AudioCaptureEventArm] extends [Exclude<keyof M, "kind">] ? M extends Msgish & AudioCaptureEventArm ? [AudioCaptureState] extends [M["state"]] ? [AudioCaptureSource] extends [M["source"]] ? M["kind"] : never : never : never : never : never : never;
|
|
103
|
+
export interface AudioCaptureRoute<M extends Msgish> {
|
|
104
|
+
readonly event: AudioCaptureEventKind<M>;
|
|
105
|
+
}
|
|
61
106
|
export type PtyState = "output" | "exit";
|
|
62
107
|
export type PtyExitReason = "exited" | "signaled" | "cancelled" | "rejected" | "spawn_failed";
|
|
63
108
|
export type PtyEventArm = {
|
|
64
|
-
readonly key:
|
|
109
|
+
readonly key: Uint8Array;
|
|
65
110
|
readonly state: PtyState;
|
|
66
111
|
readonly bytes: Uint8Array;
|
|
67
112
|
readonly code: number;
|
|
@@ -91,11 +136,42 @@ export interface WriteRoute<M extends Msgish> {
|
|
|
91
136
|
readonly ok: EmptyKind<M>;
|
|
92
137
|
readonly err: BytesKind<M>;
|
|
93
138
|
}
|
|
139
|
+
export interface StoreScanOptions {
|
|
140
|
+
readonly limit?: number;
|
|
141
|
+
readonly after?: string | Uint8Array;
|
|
142
|
+
}
|
|
143
|
+
export interface DbText {
|
|
144
|
+
readonly __dbText: true;
|
|
145
|
+
readonly bytes: ReadonlyArray<number>;
|
|
146
|
+
}
|
|
147
|
+
export declare function dbText(bytes: Uint8Array): DbText;
|
|
148
|
+
export type DbValue = null | number | string | Uint8Array | boolean | DbText;
|
|
149
|
+
export type DbStatement = readonly [sql: string, params: ReadonlyArray<DbValue>];
|
|
150
|
+
export interface DbRowsRoute<M extends Msgish> {
|
|
151
|
+
readonly key?: string;
|
|
152
|
+
readonly page: BytesKind<M>;
|
|
153
|
+
readonly done: EmptyKind<M>;
|
|
154
|
+
readonly err: BytesKind<M>;
|
|
155
|
+
}
|
|
156
|
+
export interface TypedRowsRoute<Row, M extends Msgish> extends DbRowsRoute<M> {
|
|
157
|
+
readonly __row?: Row;
|
|
158
|
+
}
|
|
159
|
+
export interface TypedDbStatement {
|
|
160
|
+
readonly sql: string;
|
|
161
|
+
readonly params: ReadonlyArray<DbValue>;
|
|
162
|
+
readonly __typedDbStatement: true;
|
|
163
|
+
}
|
|
94
164
|
export interface FetchRoute<M extends Msgish> {
|
|
95
165
|
readonly key?: string;
|
|
96
166
|
readonly ok: FetchedKind<M>;
|
|
97
167
|
readonly err: BytesKind<M>;
|
|
98
168
|
}
|
|
169
|
+
export interface FetchStreamRoute<M extends Msgish> {
|
|
170
|
+
readonly key?: string;
|
|
171
|
+
readonly line: BytesKind<M>;
|
|
172
|
+
readonly ok: TimestampKind<M>;
|
|
173
|
+
readonly err: BytesKind<M>;
|
|
174
|
+
}
|
|
99
175
|
export interface SpawnRoute<M extends Msgish> {
|
|
100
176
|
readonly key?: string;
|
|
101
177
|
readonly stdin?: Uint8Array;
|
|
@@ -149,11 +225,15 @@ export interface FetchSpec {
|
|
|
149
225
|
readonly body?: Uint8Array;
|
|
150
226
|
readonly timeoutMs?: number;
|
|
151
227
|
}
|
|
228
|
+
export interface FetchStreamSpec extends FetchSpec {
|
|
229
|
+
readonly maxLineBytes?: number;
|
|
230
|
+
}
|
|
152
231
|
export interface NotificationSpec {
|
|
153
232
|
readonly title: Uint8Array;
|
|
154
233
|
readonly subtitle?: Uint8Array;
|
|
155
234
|
readonly body?: Uint8Array;
|
|
156
235
|
}
|
|
236
|
+
export type LocalTimeStyle = "date" | "time" | "datetime";
|
|
157
237
|
export type Cmd<M extends Msgish> = {
|
|
158
238
|
readonly op: "none";
|
|
159
239
|
} | {
|
|
@@ -175,6 +255,18 @@ export type Cmd<M extends Msgish> = {
|
|
|
175
255
|
readonly key: string;
|
|
176
256
|
readonly okKind: string;
|
|
177
257
|
readonly errKind: string;
|
|
258
|
+
readonly typedService: boolean;
|
|
259
|
+
readonly payload: Uint8Array;
|
|
260
|
+
} | {
|
|
261
|
+
readonly op: "service_stream_request";
|
|
262
|
+
readonly name: string;
|
|
263
|
+
readonly key: string;
|
|
264
|
+
readonly okKind: string;
|
|
265
|
+
readonly errKind: string;
|
|
266
|
+
readonly typedService: true;
|
|
267
|
+
readonly channelKey: number;
|
|
268
|
+
readonly eventKind: string;
|
|
269
|
+
readonly maxPending: number;
|
|
178
270
|
readonly payload: Uint8Array;
|
|
179
271
|
} | {
|
|
180
272
|
readonly op: "cancel";
|
|
@@ -192,6 +284,47 @@ export type Cmd<M extends Msgish> = {
|
|
|
192
284
|
readonly errKind: string;
|
|
193
285
|
readonly path: Uint8Array;
|
|
194
286
|
readonly bytes: Uint8Array;
|
|
287
|
+
} | {
|
|
288
|
+
readonly op: "store_set";
|
|
289
|
+
readonly key: string;
|
|
290
|
+
readonly okKind: string;
|
|
291
|
+
readonly errKind: string;
|
|
292
|
+
readonly storeKey: string;
|
|
293
|
+
readonly bytes: Uint8Array;
|
|
294
|
+
} | {
|
|
295
|
+
readonly op: "store_get" | "store_delete";
|
|
296
|
+
readonly key: string;
|
|
297
|
+
readonly okKind: string;
|
|
298
|
+
readonly errKind: string;
|
|
299
|
+
readonly storeKey: string;
|
|
300
|
+
} | {
|
|
301
|
+
readonly op: "store_scan";
|
|
302
|
+
readonly key: string;
|
|
303
|
+
readonly okKind: string;
|
|
304
|
+
readonly errKind: string;
|
|
305
|
+
readonly prefix: string;
|
|
306
|
+
readonly limit: number;
|
|
307
|
+
readonly after: string | Uint8Array;
|
|
308
|
+
} | {
|
|
309
|
+
readonly op: "store_set_many";
|
|
310
|
+
readonly key: string;
|
|
311
|
+
readonly okKind: string;
|
|
312
|
+
readonly errKind: string;
|
|
313
|
+
readonly entries: ReadonlyArray<readonly [string, Uint8Array]>;
|
|
314
|
+
} | {
|
|
315
|
+
readonly op: "db_query";
|
|
316
|
+
readonly key: string;
|
|
317
|
+
readonly pageKind: string;
|
|
318
|
+
readonly doneKind: string;
|
|
319
|
+
readonly errKind: string;
|
|
320
|
+
readonly sql: string;
|
|
321
|
+
readonly params: ReadonlyArray<DbValue>;
|
|
322
|
+
} | {
|
|
323
|
+
readonly op: "db_exec";
|
|
324
|
+
readonly key: string;
|
|
325
|
+
readonly okKind: string;
|
|
326
|
+
readonly errKind: string;
|
|
327
|
+
readonly statements: ReadonlyArray<DbStatement>;
|
|
195
328
|
} | {
|
|
196
329
|
readonly op: "fetch";
|
|
197
330
|
readonly key: string;
|
|
@@ -205,6 +338,21 @@ export type Cmd<M extends Msgish> = {
|
|
|
205
338
|
readonly value: string | Uint8Array;
|
|
206
339
|
}[];
|
|
207
340
|
readonly body: Uint8Array;
|
|
341
|
+
} | {
|
|
342
|
+
readonly op: "fetch_stream";
|
|
343
|
+
readonly key: string;
|
|
344
|
+
readonly lineKind: string;
|
|
345
|
+
readonly okKind: string;
|
|
346
|
+
readonly errKind: string;
|
|
347
|
+
readonly method: FetchMethod;
|
|
348
|
+
readonly timeoutMs: number;
|
|
349
|
+
readonly maxLineBytes: number;
|
|
350
|
+
readonly url: Uint8Array;
|
|
351
|
+
readonly headers: readonly {
|
|
352
|
+
readonly name: string;
|
|
353
|
+
readonly value: string | Uint8Array;
|
|
354
|
+
}[];
|
|
355
|
+
readonly body: Uint8Array;
|
|
208
356
|
} | {
|
|
209
357
|
readonly op: "clip_write";
|
|
210
358
|
readonly bytes: Uint8Array;
|
|
@@ -263,6 +411,12 @@ export type Cmd<M extends Msgish> = {
|
|
|
263
411
|
} | {
|
|
264
412
|
readonly op: "window_show";
|
|
265
413
|
readonly label: string;
|
|
414
|
+
} | {
|
|
415
|
+
readonly op: "window_hide";
|
|
416
|
+
readonly label: string;
|
|
417
|
+
} | {
|
|
418
|
+
readonly op: "dock_presence";
|
|
419
|
+
readonly visible: boolean;
|
|
266
420
|
} | {
|
|
267
421
|
readonly op: "quit_app";
|
|
268
422
|
} | {
|
|
@@ -283,9 +437,20 @@ export type Cmd<M extends Msgish> = {
|
|
|
283
437
|
readonly op: "channel_open";
|
|
284
438
|
readonly key: number;
|
|
285
439
|
readonly eventKind: string;
|
|
440
|
+
readonly maxPending: number;
|
|
286
441
|
} | {
|
|
287
442
|
readonly op: "channel_close";
|
|
288
443
|
readonly key: number;
|
|
444
|
+
} | {
|
|
445
|
+
readonly op: "audio_capture_start";
|
|
446
|
+
readonly key: number;
|
|
447
|
+
readonly source: AudioCaptureSource;
|
|
448
|
+
readonly sampleRate: number;
|
|
449
|
+
readonly channels: number;
|
|
450
|
+
readonly eventKind: string;
|
|
451
|
+
} | {
|
|
452
|
+
readonly op: "audio_capture_stop";
|
|
453
|
+
readonly key: number;
|
|
289
454
|
} | {
|
|
290
455
|
readonly op: "pty_spawn";
|
|
291
456
|
readonly key: string;
|
|
@@ -311,21 +476,53 @@ export type Cmd<M extends Msgish> = {
|
|
|
311
476
|
readonly cmds: readonly Cmd<M>[];
|
|
312
477
|
};
|
|
313
478
|
export declare function hostRecordBytes(payload: HostRecord): Uint8Array;
|
|
479
|
+
export declare function serviceConcat(parts: readonly Uint8Array[]): Uint8Array;
|
|
480
|
+
export declare function serviceBoolBytes(value: boolean): Uint8Array;
|
|
481
|
+
export declare function serviceF64Bytes(value: number): Uint8Array;
|
|
482
|
+
export declare function serviceI64Bytes(value: number): Uint8Array;
|
|
483
|
+
export declare function serviceBytes(value: Uint8Array): Uint8Array;
|
|
484
|
+
export declare function serviceEnumBytes(index: number): Uint8Array;
|
|
485
|
+
export declare function serviceUnionBytes(index: number): Uint8Array;
|
|
486
|
+
export declare function serviceOptionalBytes(value: Uint8Array | null): Uint8Array;
|
|
487
|
+
export declare function serviceSliceBytes(values: readonly Uint8Array[]): Uint8Array;
|
|
314
488
|
declare function hostCmd(name: string, payload: Uint8Array | HostRecord): Cmd<never>;
|
|
315
489
|
declare function hostCmd(name: string, ...args: readonly number[]): Cmd<never>;
|
|
490
|
+
declare function fetchCmd<M extends Msgish>(spec: FetchSpec, route: FetchRoute<M>): Cmd<M>;
|
|
491
|
+
declare function fetchCmd<M extends Msgish>(spec: FetchStreamSpec, route: FetchStreamRoute<M>): Cmd<M>;
|
|
316
492
|
export declare const Cmd: {
|
|
317
493
|
none: Cmd<never>;
|
|
318
494
|
persist(): Cmd<never>;
|
|
319
495
|
now<M extends Msgish>(msgKind: TimestampKind<M>): Cmd<M>;
|
|
320
496
|
host: typeof hostCmd;
|
|
321
497
|
request<M extends Msgish>(name: string, payload: Uint8Array | HostRecord, route: RequestRoute<M>): Cmd<M>;
|
|
498
|
+
serviceRequest<M extends Msgish, P>(name: string, payload: Uint8Array, route: ServiceRoute<M, P>): Cmd<M>;
|
|
499
|
+
serviceStreamRequest<M extends Msgish, P>(name: string, channelKey: number, payload: Uint8Array, route: ServiceStreamRoute<M, P>, maxPending: number): Cmd<M>;
|
|
322
500
|
cancel(key: string): Cmd<never>;
|
|
323
501
|
readFile<M extends Msgish>(path: Uint8Array, route: RequestRoute<M>): Cmd<M>;
|
|
324
502
|
writeFile<M extends Msgish>(path: Uint8Array, bytes: Uint8Array, route: WriteRoute<M>): Cmd<M>;
|
|
325
|
-
|
|
503
|
+
store: {
|
|
504
|
+
set<M extends Msgish>(storeKey: string, bytes: Uint8Array, route: WriteRoute<M>): Cmd<M>;
|
|
505
|
+
get<M extends Msgish>(storeKey: string, route: RequestRoute<M>): Cmd<M>;
|
|
506
|
+
delete<M extends Msgish>(storeKey: string, route: WriteRoute<M>): Cmd<M>;
|
|
507
|
+
scan<M extends Msgish>(prefix: string, options: StoreScanOptions, route: RequestRoute<M>): Cmd<M>;
|
|
508
|
+
setMany<M extends Msgish>(entries: ReadonlyArray<readonly [string, Uint8Array]>, route: WriteRoute<M>): Cmd<M>;
|
|
509
|
+
};
|
|
510
|
+
credentials: {
|
|
511
|
+
set<M extends Msgish>(credentialKey: string, secret: Uint8Array, route: WriteRoute<M>): Cmd<M>;
|
|
512
|
+
get<M extends Msgish>(credentialKey: string, route: RequestRoute<M>): Cmd<M>;
|
|
513
|
+
delete<M extends Msgish>(credentialKey: string, route: WriteRoute<M>): Cmd<M>;
|
|
514
|
+
};
|
|
515
|
+
db: {
|
|
516
|
+
query<M extends Msgish>(sql: string, params: ReadonlyArray<DbValue>, route: DbRowsRoute<M>): Cmd<M>;
|
|
517
|
+
exec<M extends Msgish>(statements: ReadonlyArray<DbStatement>, route: WriteRoute<M>): Cmd<M>;
|
|
518
|
+
};
|
|
519
|
+
fetch: typeof fetchCmd;
|
|
326
520
|
clipboardWrite(bytes: Uint8Array): Cmd<never>;
|
|
327
521
|
clipboardRead<M extends Msgish>(route: RequestRoute<M>): Cmd<M>;
|
|
328
522
|
showNotification(spec: NotificationSpec): Cmd<never>;
|
|
523
|
+
openExternalUrl(url: Uint8Array): Cmd<never>;
|
|
524
|
+
revealPath(path: Uint8Array): Cmd<never>;
|
|
525
|
+
formatLocalTime<M extends Msgish>(timestampMs: number, style: LocalTimeStyle, route: RequestRoute<M>): Cmd<M>;
|
|
329
526
|
delay<M extends Msgish>(key: string, ms: number, msgKind: TimestampKind<M>): Cmd<M>;
|
|
330
527
|
spawn<M extends Msgish>(argv: readonly Uint8Array[], route: SpawnRoute<M> | SpawnCollectRoute<M>): Cmd<M>;
|
|
331
528
|
audioPlay<M extends Msgish>(key: string, source: AudioSource, route: AudioRoute<M>): Cmd<M>;
|
|
@@ -343,12 +540,18 @@ export declare const Cmd: {
|
|
|
343
540
|
videoSetMuted(key: string, muted: boolean): Cmd<never>;
|
|
344
541
|
videoSetLoop(key: string, loop: boolean): Cmd<never>;
|
|
345
542
|
showWindow(label: string): Cmd<never>;
|
|
543
|
+
hideWindow(label: string): Cmd<never>;
|
|
544
|
+
setDockPresence(visible: boolean): Cmd<never>;
|
|
545
|
+
launchAtLoginStatus<M extends Msgish>(route: RequestRoute<M>): Cmd<M>;
|
|
546
|
+
setLaunchAtLogin<M extends Msgish>(enabled: boolean, route: RequestRoute<M>): Cmd<M>;
|
|
346
547
|
quitApp(): Cmd<never>;
|
|
347
548
|
imageLoad<M extends Msgish>(id: number, source: ImageSource, route: ImageRoute<M>): Cmd<M>;
|
|
348
549
|
imageCancel(id: number): Cmd<never>;
|
|
349
550
|
imageUnregister(id: number): Cmd<never>;
|
|
350
551
|
channelOpen<M extends Msgish>(key: number, route: ChannelRoute<M>): Cmd<M>;
|
|
351
552
|
channelClose(key: number): Cmd<never>;
|
|
553
|
+
audioCaptureStart<M extends Msgish>(key: number, spec: AudioCaptureSpec, route: AudioCaptureRoute<M>): Cmd<M>;
|
|
554
|
+
audioCaptureStop(key: number): Cmd<never>;
|
|
352
555
|
ptySpawn<M extends Msgish>(argv: readonly Uint8Array[], route: PtyRoute<M>): Cmd<M>;
|
|
353
556
|
ptyWrite(key: string, bytes: Uint8Array): Cmd<never>;
|
|
354
557
|
ptyResize(key: string, cols: number, rows: number): Cmd<never>;
|
|
@@ -362,6 +565,15 @@ export type Sub<M extends Msgish> = {
|
|
|
362
565
|
readonly key: string;
|
|
363
566
|
readonly everyMs: number;
|
|
364
567
|
readonly msgKind: string;
|
|
568
|
+
} | {
|
|
569
|
+
readonly op: "db_live";
|
|
570
|
+
readonly key: string;
|
|
571
|
+
readonly pageKind: string;
|
|
572
|
+
readonly doneKind: string;
|
|
573
|
+
readonly errKind: string;
|
|
574
|
+
readonly sql: string;
|
|
575
|
+
readonly params: ReadonlyArray<DbValue>;
|
|
576
|
+
readonly tables: readonly string[];
|
|
365
577
|
} | {
|
|
366
578
|
readonly op: "batch";
|
|
367
579
|
readonly subs: readonly Sub<M>[];
|