@zenbujs/core 0.0.9 → 0.0.13

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.
Files changed (81) hide show
  1. package/dist/advice-config-BiYhyeTz.d.mts +41 -0
  2. package/dist/advice.d.mts +2 -36
  3. package/dist/advice.mjs +2 -2
  4. package/dist/{base-window-BxBZ2md_.mjs → base-window-4P-fVvC_.mjs} +37 -26
  5. package/dist/{build-config-Dzg2frpk.d.mts → build-config-GF0XzR_Y.d.mts} +42 -18
  6. package/dist/{build-config-pWdmLnrk.mjs → build-config-HMMqpXI1.mjs} +0 -8
  7. package/dist/{build-electron-Dsbb1EMl.mjs → build-electron-Di_FE62r.mjs} +10 -6
  8. package/dist/{build-source-d1J3shV8.mjs → build-source-BIaWpaxE.mjs} +2 -2
  9. package/dist/cli/bin.mjs +7 -7
  10. package/dist/cli/build.d.mts +1 -1
  11. package/dist/cli/build.mjs +1 -1
  12. package/dist/cli/resolve-config.mjs +6 -1
  13. package/dist/{cli-kL6mPgBE.mjs → cli-5jFDJWM4.mjs} +4 -4
  14. package/dist/config.d.mts +3 -3
  15. package/dist/config.mjs +2 -2
  16. package/dist/{db-Bc292RYo.mjs → db-MkOccvBS.mjs} +2 -2
  17. package/dist/db.d.mts +3 -2
  18. package/dist/db.mjs +2 -10
  19. package/dist/{dev-B2emj0HZ.mjs → dev-BSDyzO4j.mjs} +3 -9
  20. package/dist/env-bootstrap.d.mts +1 -1
  21. package/dist/events.d.mts +0 -9
  22. package/dist/{host-version-BIrF8tX7.mjs → host-version-Cog_odmD.mjs} +4 -3
  23. package/dist/{index-CVF768Xs.d.mts → index-C0mXKol5.d.mts} +188 -143
  24. package/dist/{index-DeDxePAa.d.mts → index-FaexRVl_.d.mts} +13 -1
  25. package/dist/index.d.mts +4 -4
  26. package/dist/index.mjs +2 -2
  27. package/dist/launcher.mjs +64 -6
  28. package/dist/link-Bt3LB_NW.mjs +586 -0
  29. package/dist/{load-config-C4Oe2qZO.mjs → load-config-C2XloBaQ.mjs} +68 -5
  30. package/dist/node-loader.mjs +1 -1
  31. package/dist/{publish-source-Dq2c0iOw.mjs → publish-source-v93eB9kA.mjs} +6 -2
  32. package/dist/react.d.mts +6 -6
  33. package/dist/react.mjs +4 -4
  34. package/dist/registry-generated.d.mts +19 -14
  35. package/dist/registry-saQDMUhT.d.mts +13 -0
  36. package/dist/registry.d.mts +1 -1
  37. package/dist/{reloader-B22UiNA2.mjs → reloader-CFzxYa67.mjs} +3 -3
  38. package/dist/{renderer-host-DD16MXhI.mjs → renderer-host-Cw38dSDe.mjs} +35 -24
  39. package/dist/{rpc-C4_NQmpT.mjs → rpc-Dg9zwZ33.mjs} +4 -4
  40. package/dist/rpc.d.mts +1 -1
  41. package/dist/rpc.mjs +1 -1
  42. package/dist/runtime-DYUONc3S.mjs +861 -0
  43. package/dist/{runtime-BQWntcOb.d.mts → runtime-fnPDZFYM.d.mts} +100 -3
  44. package/dist/runtime.d.mts +2 -2
  45. package/dist/runtime.mjs +2 -578
  46. package/dist/{schema-CjrMVk36.d.mts → schema-brYpUjYO.d.mts} +13 -25
  47. package/dist/schema.d.mts +2 -2
  48. package/dist/schema.mjs +9 -2
  49. package/dist/{server-CZLMF8Dj.mjs → server-BJ2ZC2z2.mjs} +2 -2
  50. package/dist/services/default.d.mts +1 -5
  51. package/dist/services/default.mjs +12 -16
  52. package/dist/services/index.d.mts +1 -1
  53. package/dist/services/index.mjs +7 -7
  54. package/dist/setup-gate.d.mts +1 -1
  55. package/dist/setup-gate.mjs +20 -12
  56. package/dist/{transport-F2hv_OEm.mjs → transport-Bqlv9pmJ.mjs} +1 -1
  57. package/dist/updater-Bs1Jtem6.mjs +480 -0
  58. package/dist/{vite-plugins-tt6KAtyE.mjs → vite-plugins-Df-cfldF.mjs} +2 -49
  59. package/dist/vite.d.mts +0 -5
  60. package/dist/vite.mjs +1 -1
  61. package/dist/{window-YFKvAM0l.mjs → window-DgB70qeZ.mjs} +113 -22
  62. package/dist/{write-DgIRjo23.mjs → write-7IfKa_nq.mjs} +1 -1
  63. package/dist/zenbu-bg-parse-CIyPkJOY.mjs +46 -0
  64. package/package.json +6 -5
  65. package/dist/advice-config-DXSIo0sg.mjs +0 -154
  66. package/dist/link-glX89NV5.mjs +0 -673
  67. package/dist/registry-CMp8FYgS.d.mts +0 -47
  68. package/dist/updater-BtB_Ki1r.mjs +0 -1011
  69. /package/dist/{config-BK78JDRI.mjs → config-DfciRzDu.mjs} +0 -0
  70. /package/dist/{env-bootstrap-rTs8KR3-.d.mts → env-bootstrap-UBug-4Kw.d.mts} +0 -0
  71. /package/dist/{index-C-ALz_SH.d.mts → index-CSMHYi3u.d.mts} +0 -0
  72. /package/dist/{index-ClXLQ1fw.d.mts → index-DJOHDG5e.d.mts} +0 -0
  73. /package/dist/{log-6rzaCV0I.mjs → log-BkRqDwwB.mjs} +0 -0
  74. /package/dist/{mirror-sync-pYU6f3-c.mjs → mirror-sync-snqh9kEp.mjs} +0 -0
  75. /package/dist/{monorepo-Dct-kkbQ.mjs → monorepo-CBzK3l2i.mjs} +0 -0
  76. /package/dist/{node-BhfLKYCi.mjs → node-BuHlEsE4.mjs} +0 -0
  77. /package/dist/{schema-Ca7SxXgS.mjs → schema-C6k0SroY.mjs} +0 -0
  78. /package/dist/{setup-gate-BQq0QgZH.d.mts → setup-gate-DkysEZQO.d.mts} +0 -0
  79. /package/dist/{src-Cven45mq.mjs → src-BpZAt9zL.mjs} +0 -0
  80. /package/dist/{trace-BaVg0rnY.mjs → trace-BVcQSD59.mjs} +0 -0
  81. /package/dist/{transform-BzrwkEdf.mjs → transform-czrcGnVV.mjs} +0 -0
@@ -1,11 +1,14 @@
1
- import { i as Service, t as CleanupReason } from "./runtime-BQWntcOb.mjs";
2
- import { c as EffectFieldNode, d as KyjuError, l as FieldNode, r as createRouter, t as Db } from "./index-DeDxePAa.mjs";
3
- import { n as ResolvedEvents, t as ResolvedDbRoot } from "./registry-CMp8FYgS.mjs";
1
+ import { n as ContentScriptSpec, t as AdviceSpec } from "./advice-config-BiYhyeTz.mjs";
2
+ import { a as Service, n as CleanupReason } from "./runtime-fnPDZFYM.mjs";
3
+ import { c as EffectFieldNode, d as KyjuError, l as FieldNode, r as createRouter, t as Db } from "./index-FaexRVl_.mjs";
4
+ import { n as ResolvedEvents, t as ResolvedDbRoot } from "./registry-saQDMUhT.mjs";
4
5
  import http from "node:http";
5
6
  import { WebSocket, WebSocketServer } from "ws";
6
7
  import { ViteDevServer } from "vite";
7
8
  import * as Effect from "effect/Effect";
8
- import { BaseWindow, WebPreferences } from "electron";
9
+ import { BaseWindow, BaseWindowConstructorOptions, WebContentsViewConstructorOptions } from "electron";
10
+ import electronContextMenu from "electron-context-menu";
11
+ import { FetchResult, ReadCommitResult, StatusRow } from "isomorphic-git";
9
12
  import * as _$stream from "stream";
10
13
 
11
14
  //#region src/services/server.d.ts
@@ -14,6 +17,9 @@ declare const ServerService_base: (abstract new () => {
14
17
  ctx: {};
15
18
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
16
19
  evaluate(): void | Promise<void>;
20
+ advise(spec: AdviceSpec): () => void;
21
+ injectContentScript(spec: ContentScriptSpec): () => void;
22
+ __getPluginDir(method: string): string;
17
23
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
18
24
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
19
25
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -34,6 +40,9 @@ declare const ServerService_base: (abstract new () => {
34
40
  } ? InstanceType<T> : unknown : never : never };
35
41
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
36
42
  evaluate(): void | Promise<void>;
43
+ advise(spec: AdviceSpec): () => void;
44
+ injectContentScript(spec: ContentScriptSpec): () => void;
45
+ __getPluginDir(method: string): string;
37
46
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
38
47
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
39
48
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -74,6 +83,9 @@ declare const ReloaderService_base: (abstract new () => {
74
83
  ctx: {};
75
84
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
76
85
  evaluate(): void | Promise<void>;
86
+ advise(spec: AdviceSpec): () => void;
87
+ injectContentScript(spec: ContentScriptSpec): () => void;
88
+ __getPluginDir(method: string): string;
77
89
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
78
90
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
79
91
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -94,6 +106,9 @@ declare const ReloaderService_base: (abstract new () => {
94
106
  } ? InstanceType<T> : unknown : never : never };
95
107
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
96
108
  evaluate(): void | Promise<void>;
109
+ advise(spec: AdviceSpec): () => void;
110
+ injectContentScript(spec: ContentScriptSpec): () => void;
111
+ __getPluginDir(method: string): string;
97
112
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
98
113
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
99
114
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -130,6 +145,9 @@ declare const HttpService_base: (abstract new () => {
130
145
  };
131
146
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
132
147
  evaluate(): void | Promise<void>;
148
+ advise(spec: AdviceSpec): () => void;
149
+ injectContentScript(spec: ContentScriptSpec): () => void;
150
+ __getPluginDir(method: string): string;
133
151
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
134
152
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
135
153
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -150,6 +168,9 @@ declare const HttpService_base: (abstract new () => {
150
168
  } ? InstanceType<T> : unknown : never : never };
151
169
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
152
170
  evaluate(): void | Promise<void>;
171
+ advise(spec: AdviceSpec): () => void;
172
+ injectContentScript(spec: ContentScriptSpec): () => void;
173
+ __getPluginDir(method: string): string;
153
174
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
154
175
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
155
176
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -184,31 +205,29 @@ declare class HttpService extends HttpService_base {
184
205
  type EffectSectionProxy<S> = { [K in keyof S]: EffectFieldNode<S[K]> };
185
206
  type SectionProxy<S> = { [K in keyof S]: FieldNode<S[K]> };
186
207
  type Root = ResolvedDbRoot;
187
- type Plugin$1 = Root extends {
188
- plugin: infer P;
189
- } ? P : never;
190
208
  type SectionedEffectClient = {
191
209
  readRoot(): Root;
192
210
  update(fn: (root: Root) => void | Root): Effect.Effect<void, KyjuError>;
193
211
  createBlob(data: Uint8Array, hot?: boolean): Effect.Effect<string, KyjuError>;
194
212
  deleteBlob(blobId: string): Effect.Effect<void, KyjuError>;
195
213
  getBlobData(blobId: string): Effect.Effect<Uint8Array | null, KyjuError>;
196
- plugin: { [K in keyof Plugin$1]: EffectSectionProxy<Plugin$1[K]> };
197
- };
214
+ } & { [K in keyof Root]: EffectSectionProxy<Root[K]> };
198
215
  type SectionedClient = {
199
216
  readRoot(): Root;
200
217
  update(fn: (root: Root) => void | Root): Promise<void>;
201
218
  createBlob(data: Uint8Array, hot?: boolean): Promise<string>;
202
219
  deleteBlob(blobId: string): Promise<void>;
203
220
  getBlobData(blobId: string): Promise<Uint8Array | null>;
204
- plugin: { [K in keyof Plugin$1]: SectionProxy<Plugin$1[K]> };
205
- };
221
+ } & { [K in keyof Root]: SectionProxy<Root[K]> };
206
222
  declare const DbService_base: (abstract new () => {
207
223
  ctx: {
208
224
  http: HttpService;
209
225
  };
210
226
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
211
227
  evaluate(): void | Promise<void>;
228
+ advise(spec: AdviceSpec): () => void;
229
+ injectContentScript(spec: ContentScriptSpec): () => void;
230
+ __getPluginDir(method: string): string;
212
231
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
213
232
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
214
233
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -229,6 +248,9 @@ declare const DbService_base: (abstract new () => {
229
248
  } ? InstanceType<T> : unknown : never : never };
230
249
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
231
250
  evaluate(): void | Promise<void>;
251
+ advise(spec: AdviceSpec): () => void;
252
+ injectContentScript(spec: ContentScriptSpec): () => void;
253
+ __getPluginDir(method: string): string;
232
254
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
233
255
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
234
256
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -275,17 +297,50 @@ declare class DbService extends DbService_base {
275
297
  }
276
298
  //#endregion
277
299
  //#region src/services/view-registry.d.ts
300
+ /**
301
+ * View metadata surfaced to the renderer (icon picker, sidebar slot,
302
+ * bottom-panel slot, human label). Optional everywhere; views without
303
+ * metadata simply don't appear in the corresponding chrome.
304
+ */
305
+ interface ViewMeta {
306
+ kind?: string;
307
+ sidebar?: boolean;
308
+ bottomPanel?: boolean;
309
+ label?: string;
310
+ }
278
311
  interface ViewEntry {
279
312
  type: string;
280
313
  url: string;
281
314
  port: number;
282
315
  ownsServer: boolean;
283
- meta?: {
284
- kind?: string;
285
- sidebar?: boolean;
286
- bottomPanel?: boolean;
287
- label?: string;
288
- };
316
+ meta?: ViewMeta;
317
+ }
318
+ /**
319
+ * Spec for a fresh view registration. The registry spins up a Vite dev
320
+ * server rooted at `root` and exposes the resulting URL under `type`.
321
+ *
322
+ * - `type`: stable id used by `<View type="...">` in the renderer.
323
+ * - `root`: absolute path of the view's `index.html` directory.
324
+ * - `configFile`: explicit Vite config path, or `false` to skip auto-discovery.
325
+ * - `meta`: optional renderer-facing metadata.
326
+ */
327
+ interface RegisterViewSpec {
328
+ type: string;
329
+ root: string;
330
+ configFile?: string | false;
331
+ meta?: ViewMeta;
332
+ }
333
+ /**
334
+ * Spec for re-exposing an existing reloader under a different view type
335
+ * with a path prefix. Mostly used by core to alias the host renderer
336
+ * (`"app"`) and by plugins that bundle multiple sub-views inside one
337
+ * Vite server.
338
+ */
339
+ interface RegisterAliasSpec {
340
+ type: string;
341
+ reloaderId: string;
342
+ pathPrefix: string;
343
+ meta?: ViewMeta;
289
344
  }
290
345
  declare const ViewRegistryService_base: (abstract new () => {
291
346
  ctx: {
@@ -294,6 +349,9 @@ declare const ViewRegistryService_base: (abstract new () => {
294
349
  };
295
350
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
296
351
  evaluate(): void | Promise<void>;
352
+ advise(spec: AdviceSpec): () => void;
353
+ injectContentScript(spec: ContentScriptSpec): () => void;
354
+ __getPluginDir(method: string): string;
297
355
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
298
356
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
299
357
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -314,6 +372,9 @@ declare const ViewRegistryService_base: (abstract new () => {
314
372
  } ? InstanceType<T> : unknown : never : never };
315
373
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
316
374
  evaluate(): void | Promise<void>;
375
+ advise(spec: AdviceSpec): () => void;
376
+ injectContentScript(spec: ContentScriptSpec): () => void;
377
+ __getPluginDir(method: string): string;
317
378
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
318
379
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
319
380
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -334,18 +395,8 @@ declare const ViewRegistryService_base: (abstract new () => {
334
395
  declare class ViewRegistryService extends ViewRegistryService_base {
335
396
  private views;
336
397
  private manifestIcons;
337
- register(type: string, root: string, configFile?: string | false, meta?: {
338
- kind?: string;
339
- sidebar?: boolean;
340
- bottomPanel?: boolean;
341
- label?: string;
342
- }): Promise<ViewEntry>;
343
- registerAlias(type: string, reloaderId: string, pathPrefix: string, meta?: {
344
- kind?: string;
345
- sidebar?: boolean;
346
- bottomPanel?: boolean;
347
- label?: string;
348
- }): ViewEntry;
398
+ register(spec: RegisterViewSpec): Promise<ViewEntry>;
399
+ registerAlias(spec: RegisterAliasSpec): ViewEntry;
349
400
  unregister(type: string): Promise<void>;
350
401
  get(type: string): ViewEntry | undefined;
351
402
  evaluate(): void;
@@ -361,6 +412,9 @@ declare const RendererHostService_base: (abstract new () => {
361
412
  };
362
413
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
363
414
  evaluate(): void | Promise<void>;
415
+ advise(spec: AdviceSpec): () => void;
416
+ injectContentScript(spec: ContentScriptSpec): () => void;
417
+ __getPluginDir(method: string): string;
364
418
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
365
419
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
366
420
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -381,6 +435,9 @@ declare const RendererHostService_base: (abstract new () => {
381
435
  } ? InstanceType<T> : unknown : never : never };
382
436
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
383
437
  evaluate(): void | Promise<void>;
438
+ advise(spec: AdviceSpec): () => void;
439
+ injectContentScript(spec: ContentScriptSpec): () => void;
440
+ __getPluginDir(method: string): string;
384
441
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
385
442
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
386
443
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -406,18 +463,15 @@ declare class RendererHostService extends RendererHostService_base {
406
463
  //#endregion
407
464
  //#region src/services/base-window.d.ts
408
465
  declare const MAIN_WINDOW_ID = "main";
409
- type WindowBounds = {
410
- x: number;
411
- y: number;
412
- width: number;
413
- height: number;
414
- };
415
466
  declare const BaseWindowService_base: (abstract new () => {
416
467
  ctx: {
417
468
  db: DbService;
418
469
  };
419
470
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
420
471
  evaluate(): void | Promise<void>;
472
+ advise(spec: AdviceSpec): () => void;
473
+ injectContentScript(spec: ContentScriptSpec): () => void;
474
+ __getPluginDir(method: string): string;
421
475
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
422
476
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
423
477
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -438,6 +492,9 @@ declare const BaseWindowService_base: (abstract new () => {
438
492
  } ? InstanceType<T> : unknown : never : never };
439
493
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
440
494
  evaluate(): void | Promise<void>;
495
+ advise(spec: AdviceSpec): () => void;
496
+ injectContentScript(spec: ContentScriptSpec): () => void;
497
+ __getPluginDir(method: string): string;
441
498
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
442
499
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
443
500
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -461,9 +518,9 @@ declare class BaseWindowService extends BaseWindowService_base {
461
518
  private set bootWindows(value);
462
519
  private getZenWidth;
463
520
  getWindowId(win: BaseWindow): string | undefined;
464
- createWindow(opts?: Partial<WindowBounds> & {
521
+ createWindow(opts?: {
465
522
  windowId?: string;
466
- show?: boolean;
523
+ baseWindow?: BaseWindowConstructorOptions;
467
524
  }): {
468
525
  win: BaseWindow;
469
526
  windowId: string;
@@ -479,6 +536,9 @@ declare const RpcService_base: (abstract new () => {
479
536
  };
480
537
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
481
538
  evaluate(): void | Promise<void>;
539
+ advise(spec: AdviceSpec): () => void;
540
+ injectContentScript(spec: ContentScriptSpec): () => void;
541
+ __getPluginDir(method: string): string;
482
542
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
483
543
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
484
544
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -499,6 +559,9 @@ declare const RpcService_base: (abstract new () => {
499
559
  } ? InstanceType<T> : unknown : never : never };
500
560
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
501
561
  evaluate(): void | Promise<void>;
562
+ advise(spec: AdviceSpec): () => void;
563
+ injectContentScript(spec: ContentScriptSpec): () => void;
564
+ __getPluginDir(method: string): string;
502
565
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
503
566
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
504
567
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -532,6 +595,9 @@ declare const WindowService_base: (abstract new () => {
532
595
  };
533
596
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
534
597
  evaluate(): void | Promise<void>;
598
+ advise(spec: AdviceSpec): () => void;
599
+ injectContentScript(spec: ContentScriptSpec): () => void;
600
+ __getPluginDir(method: string): string;
535
601
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
536
602
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
537
603
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -552,6 +618,9 @@ declare const WindowService_base: (abstract new () => {
552
618
  } ? InstanceType<T> : unknown : never : never };
553
619
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
554
620
  evaluate(): void | Promise<void>;
621
+ advise(spec: AdviceSpec): () => void;
622
+ injectContentScript(spec: ContentScriptSpec): () => void;
623
+ __getPluginDir(method: string): string;
555
624
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
556
625
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
557
626
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -572,14 +641,22 @@ declare const WindowService_base: (abstract new () => {
572
641
  declare class WindowService extends WindowService_base {
573
642
  private mounted;
574
643
  evaluate(): void;
644
+ /**
645
+ * Walk every mounted WebContentsView and return the one currently
646
+ * focused, so application-menu actions (reload, devtools) hit the view
647
+ * the user is actually looking at instead of the wrong window.
648
+ */
649
+ private focusedMountedWebContents;
650
+ private installAppMenu;
575
651
  openView(args: {
576
652
  type: string;
577
653
  windowId?: string;
578
654
  query?: Record<string, string | number | boolean | null | undefined>;
579
- view?: {
580
- backgroundColor?: string;
581
- webPreferences?: WebPreferences;
582
- };
655
+ baseWindow?: BaseWindowConstructorOptions;
656
+ webContentsView?: WebContentsViewConstructorOptions;
657
+ backgroundColor?: string;
658
+ contextMenu?: false | Parameters<typeof electronContextMenu>[0];
659
+ devtoolsShortcut?: boolean;
583
660
  }): Promise<{
584
661
  windowId: string;
585
662
  }>;
@@ -624,73 +701,24 @@ type PackageManagerSpec = {
624
701
  };
625
702
  //#endregion
626
703
  //#region src/services/updater.d.ts
627
- type UpdaterPhase = {
628
- phase: "idle";
629
- } | {
630
- phase: "checking";
631
- } | {
632
- phase: "fetching";
633
- loaded?: number;
634
- total?: number;
635
- ratio?: number;
636
- } | {
637
- phase: "resolving";
638
- depthConsidered: number;
639
- } | {
640
- phase: "installing";
641
- pm: string;
642
- line?: string;
643
- loaded?: number;
644
- total?: number;
645
- ratio?: number;
646
- } | {
647
- phase: "applied";
648
- sha: string;
649
- reranInstall: boolean;
650
- } | {
651
- phase: "up-to-date";
652
- sha: string;
653
- } | {
654
- phase: "incompatible";
655
- remoteHead: string;
656
- reason: string;
657
- } | {
658
- phase: "dirty-tree";
704
+ interface AppContext {
659
705
  appsDir: string;
660
- } | {
661
- phase: "error";
662
- message: string;
663
- };
664
- interface UpdaterInfo {
665
- mode: "bundle" | "dev";
666
- appsDir: string | null;
667
- hostVersion: string | null;
668
- currentSha: string | null;
706
+ resourcesPath: string;
669
707
  mirror: {
670
708
  url: string;
671
709
  branch: string;
672
- } | null;
673
- packageManager: PackageManagerSpec | null;
674
- }
675
- interface UpdaterCheckResult {
676
- status: "ok" | "dev-mode" | "error" | "no-mirror" | "no-host-version";
677
- currentSha: string | null;
678
- targetSha: string | null;
679
- tipSha: string | null;
680
- hasUpdate: boolean;
681
- incompatibleHead: boolean;
682
- error?: string;
683
- }
684
- interface UpdaterUpdateResult {
685
- status: "applied" | "up-to-date" | "incompatible" | "dirty-tree" | "dev-mode" | "no-mirror" | "no-host-version" | "in-progress" | "error";
686
- appliedSha?: string;
687
- reranInstall?: boolean;
688
- error?: string;
710
+ };
711
+ packageManager: PackageManagerSpec;
712
+ hostVersion: string;
713
+ appName: string;
689
714
  }
690
715
  declare const UpdaterService_base: (abstract new () => {
691
716
  ctx: {};
692
717
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
693
718
  evaluate(): void | Promise<void>;
719
+ advise(spec: AdviceSpec): () => void;
720
+ injectContentScript(spec: ContentScriptSpec): () => void;
721
+ __getPluginDir(method: string): string;
694
722
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
695
723
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
696
724
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -711,6 +739,9 @@ declare const UpdaterService_base: (abstract new () => {
711
739
  } ? InstanceType<T> : unknown : never : never };
712
740
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
713
741
  evaluate(): void | Promise<void>;
742
+ advise(spec: AdviceSpec): () => void;
743
+ injectContentScript(spec: ContentScriptSpec): () => void;
744
+ __getPluginDir(method: string): string;
714
745
  setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
715
746
  trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
716
747
  traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
@@ -729,55 +760,69 @@ declare const UpdaterService_base: (abstract new () => {
729
760
  };
730
761
  };
731
762
  declare class UpdaterService extends UpdaterService_base {
732
- status: UpdaterPhase;
733
- private listeners;
734
- private inflight;
735
- private pollDisposers;
736
763
  evaluate(): void;
737
764
  /**
738
- * Returns the current `UpdaterPhase`. Cheap; safe to poll from the
739
- * renderer at ~250ms cadence to drive a progress UI while
740
- * `update()` runs.
765
+ * Snapshot of the running .app's mirror + toolchain. Returns `null`
766
+ * in dev (no bundle) or when `app-config.json` / `host.json` are
767
+ * missing. No side effects.
741
768
  */
742
- getStatus(): Promise<UpdaterPhase>;
743
- /**
744
- * Synchronous-ish snapshot of the updater's environment. Doesn't
745
- * touch the network. `currentSha` is read off-disk so very recent
746
- * checkouts may lag by a few ms; callers that care about exactness
747
- * should call `check()` first.
748
- */
749
- getInfo(): Promise<UpdaterInfo>;
750
- /**
751
- * Fetch + resolve target sha without touching the working tree. Use
752
- * this for "is there an update?" UI. Cheap enough to call on a timer.
753
- */
754
- check(): Promise<UpdaterCheckResult>;
755
- /**
756
- * Apply the latest compatible commit. Pauses HMR while git operations
757
- * and `<pm> install` run, so the renderer never sees a half-applied
758
- * tree. Refuses when the apps-dir has uncommitted edits.
759
- */
760
- update(opts?: {
761
- dryRun?: boolean;
762
- }): Promise<UpdaterUpdateResult>;
763
- /**
764
- * Subscribe to phase transitions. Fires synchronously with the
765
- * current status on attach so callers can render initial state
766
- * without a separate read.
767
- */
768
- onChange(cb: (s: UpdaterPhase) => void): () => void;
769
+ getAppContext(): Promise<AppContext | null>;
770
+ fetch(opts: {
771
+ dir: string;
772
+ url: string;
773
+ ref?: string;
774
+ remote?: string;
775
+ depth?: number;
776
+ singleBranch?: boolean;
777
+ tags?: boolean;
778
+ }): Promise<FetchResult>;
779
+ clone(opts: {
780
+ dir: string;
781
+ url: string;
782
+ ref?: string;
783
+ depth?: number;
784
+ singleBranch?: boolean;
785
+ }): Promise<void>;
786
+ checkout(opts: {
787
+ dir: string;
788
+ ref: string;
789
+ force?: boolean;
790
+ }): Promise<void>;
791
+ resolveRef(opts: {
792
+ dir: string;
793
+ ref: string;
794
+ }): Promise<string>;
795
+ statusMatrix(opts: {
796
+ dir: string;
797
+ filepaths?: string[];
798
+ }): Promise<StatusRow[]>;
799
+ log(opts: {
800
+ dir: string;
801
+ ref?: string;
802
+ depth?: number;
803
+ }): Promise<ReadCommitResult[]>;
769
804
  /**
770
- * Convenience polling loop. Calls `check()` every `intervalMs` and,
771
- * when `autoApply` is set, invokes `update()` whenever a new
772
- * compatible target is found. Returns a disposer.
805
+ * Run `<pm> install` in `dir` using the bundled toolchain at
806
+ * `resourcesPath`. Always runs; no signature gating. Compose with
807
+ * `getDepsSignature` / `readDepsSignature` / `writeDepsSignature`
808
+ * if you want a skip-when-clean gate.
773
809
  */
774
- startPolling(intervalMs: number, opts?: {
775
- autoApply?: boolean;
776
- }): () => void;
777
- private loadContext;
778
- private setStatus;
779
- private makeReporter;
780
- private makeInstallReporter;
810
+ install(opts: {
811
+ dir: string;
812
+ pm: PackageManagerSpec;
813
+ resourcesPath: string;
814
+ }): Promise<void>;
815
+ getDepsSignature(opts: {
816
+ dir: string;
817
+ pm: PackageManagerSpec;
818
+ }): Promise<string>;
819
+ readDepsSignature(opts: {
820
+ dir: string;
821
+ }): Promise<string | null>;
822
+ writeDepsSignature(opts: {
823
+ dir: string;
824
+ sig: string;
825
+ }): Promise<void>;
781
826
  }
782
827
  //#endregion
783
828
  export { MAIN_WINDOW_ID as a, DbService as c, ServerService as d, BaseWindowService as i, HttpService as l, WindowService as n, RendererHostService as o, RpcService as r, ViewRegistryService as s, UpdaterService as t, ReloaderService as u };
@@ -38,6 +38,18 @@ type InferRoot<T extends SchemaShape> = { [K in keyof T]: T[K] extends BlobRef ?
38
38
  debugName: string;
39
39
  } : T[K] extends Field<infer S, infer D> ? S extends BlobRef ? InferFieldType<S> : [D] extends [true] ? InferFieldType<S> : InferFieldType<S> | undefined : T[K] extends zod.ZodType<infer O> ? O : never };
40
40
  type InferSchema<S extends Schema> = S extends Schema<infer TShape> ? TShape : never;
41
+ /**
42
+ * Resolve a `createSchema(...)` value to its live root type in one step:
43
+ *
44
+ * const schema = createSchema({ count: z.number().default(0) })
45
+ * type Root = InferSchemaRoot<typeof schema> // { count: number }
46
+ *
47
+ * Equivalent to `InferRoot<InferSchema<typeof schema>>`. Provided so plugin
48
+ * schemas can be one-liners with no auxiliary type aliases — `zen link`
49
+ * uses this to derive each section's root from the schema module's
50
+ * default export.
51
+ */
52
+ type InferSchemaRoot<S> = S extends Schema<infer TShape> ? InferRoot<TShape> : never;
41
53
  type Schema<TShape extends SchemaShape = SchemaShape> = {
42
54
  shape: TShape;
43
55
  };
@@ -439,4 +451,4 @@ type Db<TShape extends SchemaShape = SchemaShape> = {
439
451
  effectClient: EffectClientProxy<TShape>;
440
452
  };
441
453
  //#endregion
442
- export { createSchema as S, InferSchema as _, dbStringify as a, blob as b, EffectFieldNode as c, KyjuError as d, CollectionRefBrand as f, InferRoot as g, InferCollectionItem as h, dbParse as i, FieldNode as l, Field as m, connectReplica as n, ClientProxy as o, CollectionRefValue as p, createRouter as r, CollectionNode as s, Db as t, CollectionState as u, Schema as v, collection as x, SchemaShape as y };
454
+ export { createSchema as C, collection as S, InferSchema as _, dbStringify as a, SchemaShape as b, EffectFieldNode as c, KyjuError as d, CollectionRefBrand as f, InferRoot as g, InferCollectionItem as h, dbParse as i, FieldNode as l, Field as m, connectReplica as n, ClientProxy as o, CollectionRefValue as p, createRouter as r, CollectionNode as s, Db as t, CollectionState as u, InferSchemaRoot as v, blob as x, Schema as y };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { h as runtime, i as Service, o as ServiceRuntime, t as CleanupReason } from "./runtime-BQWntcOb.mjs";
2
- import { t as bootstrapEnv } from "./env-bootstrap-rTs8KR3-.mjs";
3
- import { t as setupGate } from "./setup-gate-BQq0QgZH.mjs";
4
- import { n as SchemaRoot, o as schema, t as CoreSchema } from "./schema-CjrMVk36.mjs";
1
+ import { a as Service, g as runtime, n as CleanupReason, s as ServiceRuntime } from "./runtime-fnPDZFYM.mjs";
2
+ import { t as bootstrapEnv } from "./env-bootstrap-UBug-4Kw.mjs";
3
+ import { t as setupGate } from "./setup-gate-DkysEZQO.mjs";
4
+ import { n as SchemaRoot, o as schema, t as CoreSchema } from "./schema-brYpUjYO.mjs";
5
5
  export { CleanupReason, CoreSchema, SchemaRoot as CoreSchemaRoot, Service, ServiceRuntime, bootstrapEnv, schema as coreSchema, runtime, setupGate };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { bootstrapEnv } from "./env-bootstrap.mjs";
2
2
  import { setupGate } from "./setup-gate.mjs";
3
- import { Service, ServiceRuntime, runtime } from "./runtime.mjs";
4
- import { schema } from "./schema.mjs";
3
+ import { f as runtime, n as Service, r as ServiceRuntime } from "./runtime-DYUONc3S.mjs";
4
+ import schema from "./schema.mjs";
5
5
  export { Service, ServiceRuntime, bootstrapEnv, schema as coreSchema, runtime, setupGate };