@zenbujs/core 0.0.1

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 (94) hide show
  1. package/LICENSE +11 -0
  2. package/dist/advice-config-CjgkEf2E.mjs +135 -0
  3. package/dist/advice-config-Cy133IQP.mjs +2 -0
  4. package/dist/advice-runtime.d.mts +35 -0
  5. package/dist/advice-runtime.mjs +131 -0
  6. package/dist/advice.d.mts +36 -0
  7. package/dist/advice.mjs +2 -0
  8. package/dist/base-window-BUt8pwbw.mjs +94 -0
  9. package/dist/base-window-DEIAk618.mjs +2 -0
  10. package/dist/build-config-pbv0w4oN.mjs +17 -0
  11. package/dist/build-electron-B4Gd0Gi4.mjs +516 -0
  12. package/dist/build-source-_q1n1zTV.mjs +162 -0
  13. package/dist/chunk-Dm34NbLt.mjs +6 -0
  14. package/dist/cli/bin.d.mts +1 -0
  15. package/dist/cli/bin.mjs +88 -0
  16. package/dist/cli/build.d.mts +53 -0
  17. package/dist/cli/build.mjs +48 -0
  18. package/dist/cli-BLbQQIVB.mjs +8054 -0
  19. package/dist/config-CdVrW85P.mjs +59 -0
  20. package/dist/config-LK73dJmO.mjs +2 -0
  21. package/dist/db-ByKPbnP6.mjs +2 -0
  22. package/dist/db-DhuAJrye.mjs +531 -0
  23. package/dist/db.d.mts +16 -0
  24. package/dist/db.mjs +16 -0
  25. package/dist/dev-BuqklM0k.mjs +85 -0
  26. package/dist/env-bootstrap-BtVME-CU.d.mts +16 -0
  27. package/dist/env-bootstrap-rj7I-59x.mjs +53 -0
  28. package/dist/env-bootstrap.d.mts +2 -0
  29. package/dist/env-bootstrap.mjs +2 -0
  30. package/dist/http-IBcLzbYu.mjs +2 -0
  31. package/dist/index-Bhlbyrn7.d.mts +63 -0
  32. package/dist/index-CPZ5d6Hl.d.mts +442 -0
  33. package/dist/index-FtE8MXJ_.d.mts +1 -0
  34. package/dist/index.d.mts +6 -0
  35. package/dist/index.mjs +5 -0
  36. package/dist/launcher.mjs +173 -0
  37. package/dist/link-6roQ7Cn6.mjs +580 -0
  38. package/dist/loaders/zenbu.d.mts +22 -0
  39. package/dist/loaders/zenbu.mjs +267 -0
  40. package/dist/log-CyKv8hQg.mjs +20 -0
  41. package/dist/mirror-sync-CodOnwkD.mjs +332 -0
  42. package/dist/monorepo-CmGPHsVm.mjs +119 -0
  43. package/dist/node-D4M19_mV.mjs +5 -0
  44. package/dist/node-loader.d.mts +17 -0
  45. package/dist/node-loader.mjs +33 -0
  46. package/dist/pause-DvAUNmKn.mjs +52 -0
  47. package/dist/publish-source-BVgB62Zj.mjs +131 -0
  48. package/dist/react.d.mts +76 -0
  49. package/dist/react.mjs +291 -0
  50. package/dist/registry-Dh_e7HU1.d.mts +61 -0
  51. package/dist/registry.d.mts +2 -0
  52. package/dist/registry.mjs +1 -0
  53. package/dist/reloader-BCkLjDhS.mjs +2 -0
  54. package/dist/reloader-lLAJ3lqg.mjs +164 -0
  55. package/dist/renderer-host-Bg8QdeeH.mjs +1508 -0
  56. package/dist/renderer-host-DpvBPTHJ.mjs +2 -0
  57. package/dist/rpc-BwwQK6hD.mjs +71 -0
  58. package/dist/rpc-CqitnyR4.mjs +2 -0
  59. package/dist/rpc.d.mts +2 -0
  60. package/dist/rpc.mjs +2 -0
  61. package/dist/runtime-CjqDr8Yf.d.mts +109 -0
  62. package/dist/runtime-DUFKDIe4.mjs +409 -0
  63. package/dist/runtime.d.mts +2 -0
  64. package/dist/runtime.mjs +2 -0
  65. package/dist/schema-CIg4GzHQ.mjs +100 -0
  66. package/dist/schema-DMoSkwUx.d.mts +62 -0
  67. package/dist/schema-dGK6qkfR.mjs +28 -0
  68. package/dist/schema.d.mts +2 -0
  69. package/dist/schema.mjs +2 -0
  70. package/dist/server-BXwZEQ-n.mjs +66 -0
  71. package/dist/server-DjrZUbbu.mjs +2 -0
  72. package/dist/services/default.d.mts +11 -0
  73. package/dist/services/default.mjs +22 -0
  74. package/dist/services/index.d.mts +276 -0
  75. package/dist/services/index.mjs +7 -0
  76. package/dist/setup-gate-BeD6WS6d.mjs +110 -0
  77. package/dist/setup-gate-BqOzm7zp.d.mts +4 -0
  78. package/dist/setup-gate.d.mts +2 -0
  79. package/dist/setup-gate.mjs +2 -0
  80. package/dist/src-pELM4_iH.mjs +376 -0
  81. package/dist/trace-DCB7qFzT.mjs +10 -0
  82. package/dist/transform-DJH3vN4b.mjs +84041 -0
  83. package/dist/transport-BMSzG2-F.mjs +1045 -0
  84. package/dist/view-registry-BualWgAf.mjs +2 -0
  85. package/dist/vite-plugins-Bh3SCOw-.mjs +331 -0
  86. package/dist/vite.d.mts +68 -0
  87. package/dist/vite.mjs +2 -0
  88. package/dist/window-CM2a9Kyc.mjs +2 -0
  89. package/dist/window-CmmpCVX6.mjs +156 -0
  90. package/dist/write-9dRFczGJ.mjs +1248 -0
  91. package/migrations/0000_migration.ts +34 -0
  92. package/migrations/meta/0000_snapshot.json +18 -0
  93. package/migrations/meta/_journal.json +10 -0
  94. package/package.json +124 -0
@@ -0,0 +1,100 @@
1
+ import zod from "zod";
2
+ //#region ../kyju/src/v2/db/schema.ts
3
+ const NO_DEFAULT = Symbol.for("kyju.NO_DEFAULT");
4
+ function wrapField(zodSchema) {
5
+ return Object.assign({
6
+ schema: zodSchema,
7
+ _defaultValue: NO_DEFAULT,
8
+ _hasDefault: false
9
+ }, {
10
+ default: (value) => ({
11
+ schema: zodSchema,
12
+ _defaultValue: value,
13
+ _hasDefault: true
14
+ }),
15
+ nullable: () => wrapField(zodSchema.nullable())
16
+ });
17
+ }
18
+ const COLLECTION_REF_MARKER = "__kyjuCollectionRef";
19
+ const f = new Proxy({
20
+ collection: (_itemSchema, opts) => {
21
+ const schema = zod.custom((val) => val != null && typeof val === "object" && "collectionId" in val && "debugName" in val);
22
+ schema[COLLECTION_REF_MARKER] = true;
23
+ schema._debugName = opts?.debugName;
24
+ schema._itemSchema = _itemSchema;
25
+ return schema;
26
+ },
27
+ blob: (opts) => ({
28
+ schema: {
29
+ type: "blob",
30
+ debugName: opts?.debugName
31
+ },
32
+ _defaultValue: NO_DEFAULT,
33
+ _hasDefault: false
34
+ })
35
+ }, { get(target, prop, receiver) {
36
+ if (prop in target) return Reflect.get(target, prop, receiver);
37
+ if (typeof prop === "symbol") return void 0;
38
+ const original = zod[prop];
39
+ if (typeof original === "function") return (...args) => wrapField(original(...args));
40
+ return wrapField(original);
41
+ } });
42
+ function createSchema(shape) {
43
+ return { shape };
44
+ }
45
+ /**
46
+ * Standalone collection field — drop into a `createSchema({...})` shape next
47
+ * to raw zod schemas:
48
+ *
49
+ * createSchema({
50
+ * logs: collection(z.object({ id: z.string(), text: z.string() })),
51
+ * })
52
+ *
53
+ * The returned value is a marked zod schema; the runtime + serializer detect
54
+ * the marker (`__kyjuCollectionRef`) and treat the field as a paginated kyju
55
+ * collection rather than plain JSON data.
56
+ */
57
+ function collection(itemSchema, opts) {
58
+ const schema = zod.custom((val) => val != null && typeof val === "object" && "collectionId" in val && "debugName" in val);
59
+ schema[COLLECTION_REF_MARKER] = true;
60
+ schema._debugName = opts?.debugName;
61
+ schema._itemSchema = itemSchema;
62
+ return schema;
63
+ }
64
+ /**
65
+ * Standalone blob field. The returned value is a `BlobRef` marker; the
66
+ * runtime detects `type: "blob"` and stores the field as a binary blob.
67
+ */
68
+ function blob(opts) {
69
+ return {
70
+ type: "blob",
71
+ debugName: opts?.debugName
72
+ };
73
+ }
74
+ /**
75
+ * Detect a default-value wrapper on a zod schema (`z.string().default("x")`).
76
+ * Returns `{ hasDefault: true, value }` when the schema is a `ZodDefault` (or
77
+ * legacy zod 3 `_def.typeName === "ZodDefault"`), `{ hasDefault: false }`
78
+ * otherwise. Used by the runtime + migration generator to read defaults from
79
+ * raw zod schemas without going through the `Field` wrapper.
80
+ */
81
+ function getZodDefault(schema) {
82
+ if (!schema || typeof schema !== "object") return {
83
+ hasDefault: false,
84
+ value: void 0
85
+ };
86
+ const def = schema.def ?? schema._def;
87
+ if (def?.type === "default" || def?.typeName === "ZodDefault") {
88
+ const dv = def.defaultValue;
89
+ return {
90
+ hasDefault: true,
91
+ value: typeof dv === "function" ? dv() : dv
92
+ };
93
+ }
94
+ return {
95
+ hasDefault: false,
96
+ value: void 0
97
+ };
98
+ }
99
+ //#endregion
100
+ export { f as a, createSchema as i, blob as n, getZodDefault as o, collection as r, NO_DEFAULT as t };
@@ -0,0 +1,62 @@
1
+ import { m as Field, v as Schema } from "./index-CPZ5d6Hl.mjs";
2
+ import zod from "zod";
3
+
4
+ //#region src/schema.d.ts
5
+ declare const viewRegistryEntrySchema: zod.ZodObject<{
6
+ scope: zod.ZodString;
7
+ url: zod.ZodString;
8
+ port: zod.ZodNumber;
9
+ icon: zod.ZodOptional<zod.ZodString>;
10
+ meta: zod.ZodOptional<zod.ZodObject<{
11
+ kind: zod.ZodOptional<zod.ZodString>;
12
+ sidebar: zod.ZodOptional<zod.ZodBoolean>;
13
+ bottomPanel: zod.ZodOptional<zod.ZodBoolean>;
14
+ label: zod.ZodOptional<zod.ZodString>;
15
+ }, zod.core.$strip>>;
16
+ }, zod.core.$strip>;
17
+ declare const windowBoundsSchema: zod.ZodObject<{
18
+ x: zod.ZodNumber;
19
+ y: zod.ZodNumber;
20
+ width: zod.ZodNumber;
21
+ height: zod.ZodNumber;
22
+ }, zod.core.$strip>;
23
+ declare const windowPrefsSchema: zod.ZodObject<{
24
+ lastKnownBounds: zod.ZodOptional<zod.ZodObject<{
25
+ x: zod.ZodNumber;
26
+ y: zod.ZodNumber;
27
+ width: zod.ZodNumber;
28
+ height: zod.ZodNumber;
29
+ }, zod.core.$strip>>;
30
+ }, zod.core.$strip>;
31
+ declare const schema: Schema<{
32
+ lastKnownViewRegistry: Field<zod.ZodArray<zod.ZodObject<{
33
+ scope: zod.ZodString;
34
+ url: zod.ZodString;
35
+ port: zod.ZodNumber;
36
+ icon: zod.ZodOptional<zod.ZodString>;
37
+ meta: zod.ZodOptional<zod.ZodObject<{
38
+ kind: zod.ZodOptional<zod.ZodString>;
39
+ sidebar: zod.ZodOptional<zod.ZodBoolean>;
40
+ bottomPanel: zod.ZodOptional<zod.ZodBoolean>;
41
+ label: zod.ZodOptional<zod.ZodString>;
42
+ }, zod.core.$strip>>;
43
+ }, zod.core.$strip>>, true>;
44
+ windowPrefs: Field<zod.ZodRecord<zod.ZodString, zod.ZodObject<{
45
+ lastKnownBounds: zod.ZodOptional<zod.ZodObject<{
46
+ x: zod.ZodNumber;
47
+ y: zod.ZodNumber;
48
+ width: zod.ZodNumber;
49
+ height: zod.ZodNumber;
50
+ }, zod.core.$strip>>;
51
+ }, zod.core.$strip>>, true>;
52
+ }>;
53
+ type ViewRegistryEntry = zod.infer<typeof viewRegistryEntrySchema>;
54
+ type WindowBounds = zod.infer<typeof windowBoundsSchema>;
55
+ type WindowPrefs = zod.infer<typeof windowPrefsSchema>;
56
+ type SchemaRoot = {
57
+ lastKnownViewRegistry: ViewRegistryEntry[];
58
+ windowPrefs: Record<string, WindowPrefs>;
59
+ };
60
+ type CoreSchema = typeof schema.shape;
61
+ //#endregion
62
+ export { WindowPrefs as a, WindowBounds as i, SchemaRoot as n, schema as o, ViewRegistryEntry as r, CoreSchema as t };
@@ -0,0 +1,28 @@
1
+ import { a as f, i as createSchema } from "./schema-CIg4GzHQ.mjs";
2
+ import zod from "zod";
3
+ //#region src/schema.ts
4
+ const viewRegistryEntrySchema = zod.object({
5
+ scope: zod.string(),
6
+ url: zod.string(),
7
+ port: zod.number(),
8
+ icon: zod.string().optional(),
9
+ meta: zod.object({
10
+ kind: zod.string().optional(),
11
+ sidebar: zod.boolean().optional(),
12
+ bottomPanel: zod.boolean().optional(),
13
+ label: zod.string().optional()
14
+ }).optional()
15
+ });
16
+ const windowBoundsSchema = zod.object({
17
+ x: zod.number(),
18
+ y: zod.number(),
19
+ width: zod.number(),
20
+ height: zod.number()
21
+ });
22
+ const windowPrefsSchema = zod.object({ lastKnownBounds: windowBoundsSchema.optional() });
23
+ const schema = createSchema({
24
+ lastKnownViewRegistry: f.array(viewRegistryEntrySchema).default([]),
25
+ windowPrefs: f.record(zod.string(), windowPrefsSchema).default({})
26
+ });
27
+ //#endregion
28
+ export { schema as t };
@@ -0,0 +1,2 @@
1
+ import { a as WindowPrefs, i as WindowBounds, n as SchemaRoot, o as schema, r as ViewRegistryEntry, t as CoreSchema } from "./schema-DMoSkwUx.mjs";
2
+ export { CoreSchema, SchemaRoot, ViewRegistryEntry, WindowBounds, WindowPrefs, schema };
@@ -0,0 +1,2 @@
1
+ import { t as schema } from "./schema-dGK6qkfR.mjs";
2
+ export { schema };
@@ -0,0 +1,66 @@
1
+ import { i as runtime, t as Service } from "./runtime-DUFKDIe4.mjs";
2
+ import { t as createLogger } from "./log-CyKv8hQg.mjs";
3
+ import http from "node:http";
4
+ import { randomBytes, timingSafeEqual } from "node:crypto";
5
+ import { WebSocketServer } from "ws";
6
+ //#region src/services/server.ts
7
+ const log = createLogger("server");
8
+ var ServerService = class extends Service {
9
+ static key = "server";
10
+ static deps = {};
11
+ server = null;
12
+ wss = null;
13
+ port = 0;
14
+ authToken = randomBytes(32).toString("base64url");
15
+ upgradeHandlers = [];
16
+ addUpgradeHandler(handler) {
17
+ this.upgradeHandlers.push(handler);
18
+ return () => {
19
+ this.upgradeHandlers = this.upgradeHandlers.filter((h) => h !== handler);
20
+ };
21
+ }
22
+ async evaluate() {
23
+ if (!this.server) {
24
+ this.server = http.createServer();
25
+ this.wss = new WebSocketServer({ noServer: true });
26
+ this.server.on("upgrade", (req, socket, head) => {
27
+ for (const handler of this.upgradeHandlers) if (handler(req, socket, head)) return;
28
+ if (!this.isAuthorizedUpgrade(req)) {
29
+ socket.write("HTTP/1.1 401 Unauthorized\r\nConnection: close\r\n\r\n");
30
+ socket.destroy();
31
+ return;
32
+ }
33
+ this.wss.handleUpgrade(req, socket, head, (ws) => {
34
+ this.wss.emit("connection", ws, req);
35
+ });
36
+ });
37
+ this.port = await new Promise((resolve) => {
38
+ this.server.listen(0, () => {
39
+ const addr = this.server.address();
40
+ resolve(typeof addr === "object" && addr ? addr.port : 0);
41
+ });
42
+ });
43
+ log.verbose(`listening on port ${this.port}`);
44
+ }
45
+ this.setup("server-cleanup", () => {
46
+ return () => {
47
+ this.wss?.close();
48
+ this.server?.close();
49
+ this.server?.closeAllConnections();
50
+ this.server = null;
51
+ this.wss = null;
52
+ };
53
+ });
54
+ }
55
+ isAuthorizedUpgrade(req) {
56
+ const rawUrl = req.url ?? "/";
57
+ const token = new URL(rawUrl, "http://127.0.0.1").searchParams.get("token");
58
+ if (!token) return false;
59
+ const expected = Buffer.from(this.authToken);
60
+ const actual = Buffer.from(token);
61
+ return actual.length === expected.length && timingSafeEqual(actual, expected);
62
+ }
63
+ };
64
+ runtime.register(ServerService, import.meta);
65
+ //#endregion
66
+ export { ServerService as t };
@@ -0,0 +1,2 @@
1
+ import "./server-BXwZEQ-n.mjs";
2
+ export {};
@@ -0,0 +1,11 @@
1
+ //#region src/services/default.d.ts
2
+ /**
3
+ * Loads and registers all built-in services. Kept separate from
4
+ * `./index.ts` (which statically re-exports the service classes for
5
+ * `serviceWithDeps(...)` consumers) so that `setup-gate` can import it without
6
+ * eagerly loading every service module before `setupGate()` has had a
7
+ * chance to bootstrap env vars and `process.chdir(projectRoot)`.
8
+ */
9
+ declare function defaultServices(): Promise<void>;
10
+ //#endregion
11
+ export { defaultServices };
@@ -0,0 +1,22 @@
1
+ //#region src/services/default.ts
2
+ /**
3
+ * Loads and registers all built-in services. Kept separate from
4
+ * `./index.ts` (which statically re-exports the service classes for
5
+ * `serviceWithDeps(...)` consumers) so that `setup-gate` can import it without
6
+ * eagerly loading every service module before `setupGate()` has had a
7
+ * chance to bootstrap env vars and `process.chdir(projectRoot)`.
8
+ */
9
+ async function defaultServices() {
10
+ await import("../server-DjrZUbbu.mjs");
11
+ await import("../reloader-BCkLjDhS.mjs");
12
+ await import("../renderer-host-DpvBPTHJ.mjs");
13
+ await import("../http-IBcLzbYu.mjs");
14
+ await import("../db-ByKPbnP6.mjs");
15
+ await import("../base-window-DEIAk618.mjs");
16
+ await import("../rpc-CqitnyR4.mjs");
17
+ await import("../view-registry-BualWgAf.mjs");
18
+ await import("../window-CM2a9Kyc.mjs");
19
+ await import("../advice-config-Cy133IQP.mjs");
20
+ }
21
+ //#endregion
22
+ export { defaultServices };
@@ -0,0 +1,276 @@
1
+ import { c as EffectFieldNode, d as KyjuError, l as FieldNode, r as createRouter, t as Db } from "../index-CPZ5d6Hl.mjs";
2
+ import { n as Service, t as CleanupReason } from "../runtime-CjqDr8Yf.mjs";
3
+ import { o as ResolvedDbRoot, s as ResolvedEvents } from "../registry-Dh_e7HU1.mjs";
4
+ import http from "node:http";
5
+ import { WebSocket, WebSocketServer } from "ws";
6
+ import { ViteDevServer } from "vite";
7
+ import * as Effect from "effect/Effect";
8
+ import { BaseWindow } from "electron";
9
+ import * as _$stream from "stream";
10
+
11
+ //#region src/services/server.d.ts
12
+ type UpgradeHandler = (req: http.IncomingMessage, socket: _$stream.Duplex, head: Buffer) => boolean;
13
+ declare class ServerService extends Service {
14
+ static key: string;
15
+ static deps: {};
16
+ server: http.Server | null;
17
+ wss: WebSocketServer | null;
18
+ port: number;
19
+ authToken: string;
20
+ private upgradeHandlers;
21
+ addUpgradeHandler(handler: UpgradeHandler): () => void;
22
+ evaluate(): Promise<void>;
23
+ private isAuthorizedUpgrade;
24
+ }
25
+ //#endregion
26
+ //#region src/services/reloader.d.ts
27
+ interface ReloaderEntry {
28
+ id: string;
29
+ root: string;
30
+ url: string;
31
+ port: number;
32
+ viteServer: ViteDevServer;
33
+ }
34
+ declare class ReloaderService extends Service {
35
+ static key: string;
36
+ static deps: {};
37
+ private servers;
38
+ create(id: string, root: string, configFile?: string | false): Promise<ReloaderEntry>;
39
+ get(id: string): ReloaderEntry | undefined;
40
+ remove(id: string): Promise<void>;
41
+ evaluate(): void;
42
+ }
43
+ //#endregion
44
+ //#region src/services/http.d.ts
45
+ type ConnectedCallback = (id: string, ws: WebSocket) => void;
46
+ type DisconnectedCallback = (id: string) => void;
47
+ type RequestHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void;
48
+ declare class HttpService extends Service {
49
+ static key: string;
50
+ static deps: {
51
+ server: typeof ServerService;
52
+ reloader: typeof ReloaderService;
53
+ };
54
+ ctx: {
55
+ server: ServerService;
56
+ reloader: ReloaderService;
57
+ };
58
+ connectedCallbacks: ConnectedCallback[];
59
+ disconnectedCallbacks: DisconnectedCallback[];
60
+ activeConnections: Map<string, WebSocket>;
61
+ private requestHandlers;
62
+ get port(): number;
63
+ get authToken(): string;
64
+ addRequestHandler(prefix: string, handler: RequestHandler): () => void;
65
+ onConnected(cb: ConnectedCallback): () => void;
66
+ onDisconnected(cb: DisconnectedCallback): () => void;
67
+ evaluate(): void;
68
+ }
69
+ //#endregion
70
+ //#region src/services/db.d.ts
71
+ type EffectSectionProxy<S> = { [K in keyof S]: EffectFieldNode<S[K]> };
72
+ type SectionProxy<S> = { [K in keyof S]: FieldNode<S[K]> };
73
+ type Root = ResolvedDbRoot;
74
+ type Plugin$1 = Root extends {
75
+ plugin: infer P;
76
+ } ? P : never;
77
+ type SectionedEffectClient = {
78
+ readRoot(): Root;
79
+ update(fn: (root: Root) => void | Root): Effect.Effect<void, KyjuError>;
80
+ createBlob(data: Uint8Array, hot?: boolean): Effect.Effect<string, KyjuError>;
81
+ deleteBlob(blobId: string): Effect.Effect<void, KyjuError>;
82
+ getBlobData(blobId: string): Effect.Effect<Uint8Array | null, KyjuError>;
83
+ plugin: { [K in keyof Plugin$1]: EffectSectionProxy<Plugin$1[K]> };
84
+ };
85
+ type SectionedClient = {
86
+ readRoot(): Root;
87
+ update(fn: (root: Root) => void | Root): Promise<void>;
88
+ createBlob(data: Uint8Array, hot?: boolean): Promise<string>;
89
+ deleteBlob(blobId: string): Promise<void>;
90
+ getBlobData(blobId: string): Promise<Uint8Array | null>;
91
+ plugin: { [K in keyof Plugin$1]: SectionProxy<Plugin$1[K]> };
92
+ };
93
+ declare class DbService extends Service {
94
+ static key: string;
95
+ static deps: {
96
+ http: typeof HttpService;
97
+ };
98
+ ctx: {
99
+ http: HttpService;
100
+ };
101
+ db: Db | null;
102
+ dbRouter: ReturnType<typeof createRouter> | null;
103
+ private sectionsHash;
104
+ private _dbPath;
105
+ /**
106
+ * Resolved DB path. Throws if accessed before `evaluate()` has run — the
107
+ * service contract guarantees deps are evaluated before dependents, so any
108
+ * access from a dependent service or RPC handler is safe.
109
+ */
110
+ get dbPath(): string;
111
+ get client(): SectionedClient;
112
+ get effectClient(): SectionedEffectClient;
113
+ /**
114
+ * Drain kyju's lagged-persistence queue. Safe to call anytime; idempotent
115
+ * when nothing is pending. Used by service teardown (effect cleanup) so
116
+ * shutdown / hot-reload don't lose in-memory writes.
117
+ */
118
+ flush(): Promise<void>;
119
+ /**
120
+ * Flush + release the kyju cross-process lock at `<dbPath>/.lock`.
121
+ * Called on service teardown so a subsequent process can open the DB
122
+ * without seeing a stale lock. Idempotent.
123
+ */
124
+ close(): Promise<void>;
125
+ evaluate(): Promise<void>;
126
+ }
127
+ //#endregion
128
+ //#region src/services/view-registry.d.ts
129
+ interface ViewEntry {
130
+ scope: string;
131
+ url: string;
132
+ port: number;
133
+ ownsServer: boolean;
134
+ meta?: {
135
+ kind?: string;
136
+ sidebar?: boolean;
137
+ bottomPanel?: boolean;
138
+ label?: string;
139
+ };
140
+ }
141
+ declare class ViewRegistryService extends Service {
142
+ static key: string;
143
+ static deps: {
144
+ reloader: typeof ReloaderService;
145
+ db: typeof DbService;
146
+ };
147
+ ctx: {
148
+ reloader: ReloaderService;
149
+ db: DbService;
150
+ };
151
+ private views;
152
+ private manifestIcons;
153
+ register(scope: string, root: string, configFile?: string | false, meta?: {
154
+ kind?: string;
155
+ sidebar?: boolean;
156
+ bottomPanel?: boolean;
157
+ label?: string;
158
+ }): Promise<ViewEntry>;
159
+ registerAlias(scope: string, reloaderId: string, pathPrefix: string, meta?: {
160
+ kind?: string;
161
+ sidebar?: boolean;
162
+ bottomPanel?: boolean;
163
+ label?: string;
164
+ }): ViewEntry;
165
+ unregister(scope: string): Promise<void>;
166
+ get(scope: string): ViewEntry | undefined;
167
+ evaluate(): void;
168
+ private loadManifestIcons;
169
+ private syncToDb;
170
+ }
171
+ //#endregion
172
+ //#region src/services/renderer-host.d.ts
173
+ declare class RendererHostService extends Service {
174
+ static key: string;
175
+ static deps: {
176
+ reloader: typeof ReloaderService;
177
+ viewRegistry: typeof ViewRegistryService;
178
+ };
179
+ ctx: {
180
+ reloader: ReloaderService;
181
+ viewRegistry: ViewRegistryService;
182
+ };
183
+ url: string;
184
+ port: number;
185
+ evaluate(): Promise<void>;
186
+ }
187
+ //#endregion
188
+ //#region src/services/base-window.d.ts
189
+ declare const MAIN_WINDOW_ID = "main";
190
+ type WindowBounds = {
191
+ x: number;
192
+ y: number;
193
+ width: number;
194
+ height: number;
195
+ };
196
+ declare class BaseWindowService extends Service {
197
+ static key: string;
198
+ static deps: {
199
+ db: typeof DbService;
200
+ };
201
+ ctx: {
202
+ db: DbService;
203
+ };
204
+ windows: Map<string, BaseWindow>;
205
+ private get bootWindows();
206
+ private set bootWindows(value);
207
+ private getZenWidth;
208
+ getWindowId(win: BaseWindow): string | undefined;
209
+ createWindow(opts?: Partial<WindowBounds> & {
210
+ windowId?: string;
211
+ show?: boolean;
212
+ }): {
213
+ win: BaseWindow;
214
+ windowId: string;
215
+ };
216
+ evaluate(): void;
217
+ }
218
+ //#endregion
219
+ //#region src/services/rpc.d.ts
220
+ type EmitProxy<T> = { [K in keyof T]: T[K] extends Record<string, any> ? EmitProxy<T[K]> & ((data: T[K]) => void) : (data: T[K]) => void };
221
+ declare class RpcService extends Service {
222
+ static key: string;
223
+ static deps: {
224
+ http: typeof HttpService;
225
+ };
226
+ ctx: {
227
+ http: HttpService;
228
+ };
229
+ private _emit;
230
+ get emit(): EmitProxy<ResolvedEvents>;
231
+ evaluate(): void;
232
+ }
233
+ //#endregion
234
+ //#region src/services/window.d.ts
235
+ declare const WindowService_base: (abstract new () => {
236
+ ctx: {
237
+ baseWindow: BaseWindowService;
238
+ viewRegistry: ViewRegistryService;
239
+ http: HttpService;
240
+ rendererHost: RendererHostService;
241
+ };
242
+ __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
243
+ evaluate(): void | Promise<void>;
244
+ setup(key: string, fn: () => void | ((reason: CleanupReason) => void | Promise<void>)): void;
245
+ trace<T>(_name: string, fn: () => T | Promise<T>, _meta?: Record<string, unknown>): Promise<T>;
246
+ traceSync<T>(_name: string, fn: () => T, _meta?: Record<string, unknown>): T;
247
+ __cleanupAllSetups(reason?: CleanupReason): Promise<void>;
248
+ }) & {
249
+ deps: Record<string, (string | (abstract new (...args: any[]) => Service)) | {
250
+ __optional: true;
251
+ ref: string | (abstract new (...args: any[]) => Service);
252
+ }>;
253
+ key: string;
254
+ };
255
+ declare class WindowService extends WindowService_base {
256
+ static key: string;
257
+ private mounted;
258
+ evaluate(): void;
259
+ openView(args: {
260
+ scope: string;
261
+ windowId?: string;
262
+ query?: Record<string, string | number | boolean | null | undefined>;
263
+ }): Promise<{
264
+ windowId: string;
265
+ }>;
266
+ focusWindow(windowId: string): Promise<{
267
+ ok: true;
268
+ }>;
269
+ pickFiles(): Promise<string[] | null>;
270
+ pickDirectory(): Promise<string | null>;
271
+ openExternal(url: string): Promise<void>;
272
+ openPath(filePath: string): Promise<void>;
273
+ copyToClipboard(text: string): void;
274
+ }
275
+ //#endregion
276
+ export { BaseWindowService, DbService, HttpService, MAIN_WINDOW_ID, ReloaderService, RendererHostService, RpcService, ServerService, ViewRegistryService, WindowService };
@@ -0,0 +1,7 @@
1
+ import { t as ServerService } from "../server-BXwZEQ-n.mjs";
2
+ import { t as ReloaderService } from "../reloader-lLAJ3lqg.mjs";
3
+ import { n as ViewRegistryService, o as HttpService, r as DbService, t as RendererHostService } from "../renderer-host-Bg8QdeeH.mjs";
4
+ import { n as MAIN_WINDOW_ID, t as BaseWindowService } from "../base-window-BUt8pwbw.mjs";
5
+ import { t as RpcService } from "../rpc-BwwQK6hD.mjs";
6
+ import { t as WindowService } from "../window-CmmpCVX6.mjs";
7
+ export { BaseWindowService, DbService, HttpService, MAIN_WINDOW_ID, ReloaderService, RendererHostService, RpcService, ServerService, ViewRegistryService, WindowService };