@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,110 @@
1
+ import { t as bootstrapEnv } from "./env-bootstrap-rj7I-59x.mjs";
2
+ import { createRequire, register } from "node:module";
3
+ import fs from "node:fs";
4
+ import os from "node:os";
5
+ import path from "node:path";
6
+ import { pathToFileURL } from "node:url";
7
+ import { register as register$1 } from "tsx/esm/api";
8
+ //#region src/setup-gate.ts
9
+ const verbose = process.env.ZENBU_VERBOSE === "1";
10
+ function projectArg() {
11
+ const arg = process.argv.find((item) => item.startsWith("--project="));
12
+ return arg ? path.resolve(arg.slice(10)) : null;
13
+ }
14
+ function appDirName(name) {
15
+ return name.replace(/^@/, "").replace(/[\\/]/g, "__");
16
+ }
17
+ function readPackageJson(packageDir) {
18
+ const pkgPath = path.join(packageDir, "package.json");
19
+ return JSON.parse(fs.readFileSync(pkgPath, "utf8"));
20
+ }
21
+ function findProjectRoot(projectDir) {
22
+ let dir = path.resolve(projectDir);
23
+ while (dir !== path.dirname(dir)) {
24
+ if (fs.existsSync(path.join(dir, "package.json"))) return dir;
25
+ dir = path.dirname(dir);
26
+ }
27
+ return path.resolve(projectDir);
28
+ }
29
+ function resolveConfigPath(projectRoot) {
30
+ const configPath = path.join(projectRoot, "config.json");
31
+ if (!fs.existsSync(configPath)) throw new Error(`config.json not found at ${configPath}`);
32
+ return configPath;
33
+ }
34
+ function findTsconfig(projectRoot) {
35
+ const candidate = path.join(projectRoot, "tsconfig.json");
36
+ return fs.existsSync(candidate) ? candidate : false;
37
+ }
38
+ function loadElectronApp() {
39
+ const electron = createRequire(import.meta.url)("electron");
40
+ if (!electron.app) throw new Error("Electron app API is unavailable; setup-gate must run inside Electron");
41
+ return electron.app;
42
+ }
43
+ async function closeRegisteredWatchers() {
44
+ await (await import("./pause-DvAUNmKn.mjs")).closeAllWatchers?.();
45
+ }
46
+ async function registerLoaders(tsconfig, projectRoot) {
47
+ register(import.meta.resolve("@zenbujs/core/loaders/zenbu"));
48
+ register$1({ tsconfig });
49
+ process.env.ZENBU_ADVICE_ROOT = projectRoot;
50
+ await import("./node-D4M19_mV.mjs");
51
+ const dynohot = await import(pathToFileURL(createRequire(import.meta.url).resolve("dynohot/register")).href);
52
+ if (typeof dynohot.register === "function") dynohot.register({ ignore: /[/\\](?:node_modules|dist)[/\\]/ });
53
+ }
54
+ async function setupGate() {
55
+ const app = loadElectronApp();
56
+ await app.whenReady();
57
+ bootstrapEnv();
58
+ const bundledAppPath = app.getAppPath();
59
+ const appName = readPackageJson(bundledAppPath).name ?? path.basename(bundledAppPath);
60
+ const resolvedProjectDir = projectArg() ?? path.join(process.env.ZENBU_APPS_DIR ?? path.join(os.homedir(), ".zenbu", "apps"), appDirName(appName));
61
+ if (!fs.existsSync(resolvedProjectDir)) throw new Error(`setup-gate: project directory ${resolvedProjectDir} does not exist. In a shipped .app, the launcher provisions this dir before invoking setup-gate. In dev, point at an existing project with --project=.`);
62
+ const projectRoot = findProjectRoot(resolvedProjectDir);
63
+ const configPath = resolveConfigPath(projectRoot);
64
+ const tsconfig = findTsconfig(projectRoot);
65
+ process.chdir(projectRoot);
66
+ process.env.ZENBU_CONFIG_PATH = configPath;
67
+ if (!process.argv.some((arg) => arg.startsWith("--project="))) process.argv.push(`--project=${resolvedProjectDir}`);
68
+ if (verbose) {
69
+ console.log("[setup-gate] project:", resolvedProjectDir);
70
+ console.log("[setup-gate] config:", configPath);
71
+ }
72
+ await registerLoaders(tsconfig, projectRoot);
73
+ const { defaultServices } = await import("./services/default.mjs");
74
+ await defaultServices();
75
+ let shuttingDown = false;
76
+ const shutdown = async (exitCode = 0) => {
77
+ if (shuttingDown) return;
78
+ shuttingDown = true;
79
+ try {
80
+ await globalThis.__zenbu_service_runtime__?.shutdown();
81
+ } catch (err) {
82
+ console.error("[setup-gate] shutdown failed:", err);
83
+ }
84
+ try {
85
+ await closeRegisteredWatchers();
86
+ } catch (err) {
87
+ console.error("[setup-gate] closeAllWatchers failed:", err);
88
+ }
89
+ app.exit(exitCode);
90
+ };
91
+ app.on("before-quit", (event) => {
92
+ if (shuttingDown) return;
93
+ event.preventDefault();
94
+ shutdown(0);
95
+ });
96
+ process.on("SIGINT", () => void shutdown(0));
97
+ process.on("SIGTERM", () => void shutdown(0));
98
+ const mod = await import(`zenbu:plugins?config=${encodeURIComponent(configPath)}`, { with: { hot: "import" } });
99
+ if (typeof mod.default === "function") {
100
+ const controller = mod.default();
101
+ if (controller && typeof controller.main === "function") await controller.main();
102
+ }
103
+ await globalThis.__zenbu_service_runtime__?.whenIdle();
104
+ }
105
+ setupGate().catch((error) => {
106
+ console.error(error);
107
+ process.exit(1);
108
+ });
109
+ //#endregion
110
+ export { setupGate as t };
@@ -0,0 +1,4 @@
1
+ //#region src/setup-gate.d.ts
2
+ declare function setupGate(): Promise<void>;
3
+ //#endregion
4
+ export { setupGate as t };
@@ -0,0 +1,2 @@
1
+ import { t as setupGate } from "./setup-gate-BqOzm7zp.mjs";
2
+ export { setupGate };
@@ -0,0 +1,2 @@
1
+ import { t as setupGate } from "./setup-gate-BeD6WS6d.mjs";
2
+ export { setupGate };
@@ -0,0 +1,376 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Option from "effect/Option";
3
+ import { nanoid } from "nanoid";
4
+ import * as Exit from "effect/Exit";
5
+ import * as Cause from "effect/Cause";
6
+ //#region ../zenrpc/src/protocol.ts
7
+ const serialize = (msg) => JSON.stringify(msg);
8
+ const deserialize = (data) => JSON.parse(data);
9
+ //#endregion
10
+ //#region ../zenrpc/src/execute.ts
11
+ const resolveMethod = (router, path) => {
12
+ let current = router;
13
+ for (const segment of path) {
14
+ current = current[segment];
15
+ if (current === void 0) throw new Error(`Method not found: ${path.join(".")}`);
16
+ }
17
+ if (typeof current !== "function") throw new Error(`Not a function: ${path.join(".")}`);
18
+ return current;
19
+ };
20
+ const serializeTaggedError = (error) => {
21
+ const result = { _tag: error._tag };
22
+ for (const key of Object.keys(error)) {
23
+ if (key === "stack" || key === "name" || key === "cause" || key === "_tag") continue;
24
+ const value = error[key];
25
+ if (typeof value === "function" || typeof value === "symbol") continue;
26
+ result[key] = value;
27
+ }
28
+ return result;
29
+ };
30
+ const isTaggedError = (value) => value !== null && typeof value === "object" && "_tag" in value && typeof value._tag === "string";
31
+ /**
32
+ * Executes a router method and sends the response.
33
+ * Handles plain sync/async returns and Effect returns:
34
+ * - Effect success → { type: "response", result: { _tag: "success", data } }
35
+ * - Effect tagged error → { type: "response", result: { _tag: errorTag, ...fields } }
36
+ * - Effect defect → { type: "error-response" }
37
+ * - Plain return → { type: "response", result }
38
+ * - Thrown error → { type: "error-response" }
39
+ */
40
+ const executeMethod = async (args) => {
41
+ try {
42
+ const returnValue = args.method(...args.methodArgs);
43
+ if (Effect.isEffect(returnValue)) {
44
+ const exit = await (args.runtime ? (e) => args.runtime.runPromiseExit(e) : Effect.runPromiseExit)(returnValue);
45
+ if (Exit.isSuccess(exit)) {
46
+ args.send(serialize({
47
+ type: "response",
48
+ id: args.id,
49
+ result: {
50
+ _tag: "success",
51
+ data: exit.value
52
+ }
53
+ }));
54
+ return;
55
+ }
56
+ const failure = Cause.failureOption(exit.cause);
57
+ if (Option.isSome(failure) && isTaggedError(failure.value)) {
58
+ args.send(serialize({
59
+ type: "response",
60
+ id: args.id,
61
+ result: serializeTaggedError(failure.value)
62
+ }));
63
+ return;
64
+ }
65
+ let message;
66
+ if (Option.isSome(failure)) message = failure.value instanceof Error ? failure.value.message : String(failure.value);
67
+ else {
68
+ const defect = Cause.dieOption(exit.cause);
69
+ if (Option.isSome(defect)) message = defect.value instanceof Error ? defect.value.message : String(defect.value);
70
+ else message = "Unknown error";
71
+ }
72
+ args.send(serialize({
73
+ type: "error-response",
74
+ id: args.id,
75
+ error: { message }
76
+ }));
77
+ } else {
78
+ const result = await returnValue;
79
+ args.send(serialize({
80
+ type: "response",
81
+ id: args.id,
82
+ result
83
+ }));
84
+ }
85
+ } catch (err) {
86
+ console.error(`[zenrpc] method execution failed:`, err);
87
+ args.send(serialize({
88
+ type: "error-response",
89
+ id: args.id,
90
+ error: { message: err instanceof Error ? err.message : String(err) }
91
+ }));
92
+ }
93
+ };
94
+ //#endregion
95
+ //#region ../zenrpc/src/server.ts
96
+ const createEmitProxy = (send, currentPath = []) => new Proxy(() => {}, {
97
+ get(_target, prop) {
98
+ if (typeof prop === "symbol") return void 0;
99
+ return createEmitProxy(send, [...currentPath, prop]);
100
+ },
101
+ apply(_target, _thisArg, args) {
102
+ send(currentPath, args[0]);
103
+ }
104
+ });
105
+ const createServer = (options) => {
106
+ const clients = /* @__PURE__ */ new Map();
107
+ const sendTo = (clientId) => (data) => options.send(data, clientId);
108
+ const postMessage = (data, clientId) => {
109
+ const msg = deserialize(data);
110
+ switch (msg.type) {
111
+ case "handshake":
112
+ if (msg.version !== options.version) {
113
+ options.send(serialize({
114
+ type: "handshake-ack",
115
+ ok: false,
116
+ error: `Version mismatch: expected ${options.version}, got ${msg.version}`
117
+ }), clientId);
118
+ return;
119
+ }
120
+ clients.set(clientId, { clientId });
121
+ options.send(serialize({
122
+ type: "handshake-ack",
123
+ ok: true
124
+ }), clientId);
125
+ break;
126
+ case "request":
127
+ if (!clients.get(clientId)) {
128
+ options.send(serialize({
129
+ type: "error-response",
130
+ id: msg.id,
131
+ error: { message: "Not connected" }
132
+ }), clientId);
133
+ return;
134
+ }
135
+ try {
136
+ const ctx = { clientId };
137
+ executeMethod({
138
+ method: resolveMethod(options.router(() => ctx), msg.path),
139
+ methodArgs: msg.args,
140
+ id: msg.id,
141
+ send: sendTo(clientId),
142
+ runtime: options.runtime
143
+ });
144
+ } catch (err) {
145
+ console.error(`[zenrpc] request handler failed for ${msg.path?.join(".")}:`, err);
146
+ options.send(serialize({
147
+ type: "error-response",
148
+ id: msg.id,
149
+ error: { message: err instanceof Error ? err.message : String(err) }
150
+ }), clientId);
151
+ }
152
+ break;
153
+ }
154
+ };
155
+ const removeClient = (clientId) => {
156
+ clients.delete(clientId);
157
+ };
158
+ const emit = createEmitProxy((path, data) => {
159
+ const msg = serialize({
160
+ type: "event",
161
+ path,
162
+ data
163
+ });
164
+ for (const [clientId] of clients) options.send(msg, clientId);
165
+ });
166
+ const emitTo = (clientId) => createEmitProxy((path, data) => {
167
+ if (!clients.has(clientId)) return;
168
+ options.send(serialize({
169
+ type: "event",
170
+ path,
171
+ data
172
+ }), clientId);
173
+ });
174
+ return {
175
+ postMessage,
176
+ removeClient,
177
+ emit,
178
+ emitTo
179
+ };
180
+ };
181
+ //#endregion
182
+ //#region ../zenrpc/src/pending.ts
183
+ const createPendingRequests = () => {
184
+ const pending = /* @__PURE__ */ new Map();
185
+ return {
186
+ add: (id) => new Promise((resolve, reject) => {
187
+ pending.set(id, {
188
+ resolve,
189
+ reject
190
+ });
191
+ }),
192
+ resolve: (id, value) => {
193
+ const entry = pending.get(id);
194
+ if (entry) {
195
+ pending.delete(id);
196
+ entry.resolve(value);
197
+ }
198
+ },
199
+ reject: (id, error) => {
200
+ const entry = pending.get(id);
201
+ if (entry) {
202
+ pending.delete(id);
203
+ entry.reject(error);
204
+ }
205
+ },
206
+ rejectAll: (error) => {
207
+ for (const [id, entry] of pending) entry.reject(error);
208
+ pending.clear();
209
+ },
210
+ has: (id) => pending.has(id),
211
+ size: () => pending.size
212
+ };
213
+ };
214
+ //#endregion
215
+ //#region ../zenrpc/src/proxy.ts
216
+ const createProxy = (deps) => {
217
+ const makeProxy = (currentPath) => {
218
+ return new Proxy(function() {}, {
219
+ get(_target, prop, _receiver) {
220
+ if (typeof prop === "symbol") return void 0;
221
+ return makeProxy([...currentPath, prop]);
222
+ },
223
+ apply(_target, _thisArg, args) {
224
+ const id = nanoid();
225
+ const promise = deps.pending.add(id);
226
+ deps.send(serialize({
227
+ type: "request",
228
+ id,
229
+ path: currentPath,
230
+ args
231
+ }));
232
+ return promise;
233
+ }
234
+ });
235
+ };
236
+ return makeProxy([]);
237
+ };
238
+ //#endregion
239
+ //#region ../zenrpc/src/client.ts
240
+ const createEventListeners = () => {
241
+ const listeners = /* @__PURE__ */ new Map();
242
+ return {
243
+ add(path, cb) {
244
+ let set = listeners.get(path);
245
+ if (!set) {
246
+ set = /* @__PURE__ */ new Set();
247
+ listeners.set(path, set);
248
+ }
249
+ set.add(cb);
250
+ return () => {
251
+ set.delete(cb);
252
+ if (set.size === 0) listeners.delete(path);
253
+ };
254
+ },
255
+ dispatch(path, data) {
256
+ listeners.get(path)?.forEach((cb) => cb(data));
257
+ }
258
+ };
259
+ };
260
+ const createClient = (options) => {
261
+ const pending = createPendingRequests();
262
+ const eventListeners = createEventListeners();
263
+ let connected = false;
264
+ let handshakeResolve = null;
265
+ let handshakeReject = null;
266
+ const handshakePromise = new Promise((resolve, reject) => {
267
+ handshakeResolve = resolve;
268
+ handshakeReject = reject;
269
+ });
270
+ options.send(serialize({
271
+ type: "handshake",
272
+ clientId: options.clientId,
273
+ version: options.version
274
+ }));
275
+ const postMessage = (data) => {
276
+ let msg;
277
+ try {
278
+ msg = deserialize(data);
279
+ } catch (e) {
280
+ console.error("[zenrpc] failed to deserialize:", data, e);
281
+ return;
282
+ }
283
+ switch (msg.type) {
284
+ case "handshake-ack":
285
+ if (msg.ok) {
286
+ connected = true;
287
+ handshakeResolve?.();
288
+ } else handshakeReject?.(new Error(msg.error ?? "Handshake rejected"));
289
+ break;
290
+ case "response":
291
+ pending.resolve(msg.id, msg.result);
292
+ break;
293
+ case "error-response": {
294
+ const errMsg = msg.error?.message ?? JSON.stringify(msg);
295
+ pending.reject(msg.id, new Error(errMsg));
296
+ break;
297
+ }
298
+ case "event":
299
+ eventListeners.dispatch(msg.path.join("."), msg.data);
300
+ break;
301
+ }
302
+ };
303
+ return {
304
+ postMessage,
305
+ server: createProxy({
306
+ send: options.send,
307
+ pending
308
+ }),
309
+ eventListeners,
310
+ ready: handshakePromise,
311
+ get connected() {
312
+ return connected;
313
+ }
314
+ };
315
+ };
316
+ //#endregion
317
+ //#region ../zenrpc/src/events.ts
318
+ const createEventProxy = (listeners, currentPath = []) => new Proxy({}, { get(_target, prop) {
319
+ if (typeof prop === "symbol") return void 0;
320
+ if (prop === "subscribe") {
321
+ const key = currentPath.join(".");
322
+ return (cb) => listeners.add(key, cb);
323
+ }
324
+ return createEventProxy(listeners, [...currentPath, prop]);
325
+ } });
326
+ //#endregion
327
+ //#region ../zenrpc/src/transport.ts
328
+ function createRpcRouter() {
329
+ const routes = /* @__PURE__ */ new Map();
330
+ return {
331
+ send(data, clientId) {
332
+ routes.get(clientId)?.(data);
333
+ },
334
+ connection(opts) {
335
+ const clientId = nanoid();
336
+ routes.set(clientId, opts.send);
337
+ return {
338
+ clientId,
339
+ receive(data) {
340
+ opts.postMessage(data, clientId);
341
+ },
342
+ close() {
343
+ routes.delete(clientId);
344
+ opts.removeClient(clientId);
345
+ }
346
+ };
347
+ }
348
+ };
349
+ }
350
+ async function connectRpc(opts) {
351
+ const clientId = opts.clientId ?? nanoid();
352
+ let postMessage = null;
353
+ const buffer = [];
354
+ const unsub = opts.subscribe((data) => {
355
+ if (postMessage) postMessage(data);
356
+ else buffer.push(data);
357
+ });
358
+ const rpc = createClient({
359
+ version: opts.version,
360
+ clientId,
361
+ send: opts.send
362
+ });
363
+ postMessage = rpc.postMessage;
364
+ for (const data of buffer) rpc.postMessage(data);
365
+ await rpc.ready;
366
+ const events = createEventProxy(rpc.eventListeners);
367
+ return {
368
+ server: rpc.server,
369
+ events,
370
+ disconnect: () => {
371
+ unsub();
372
+ }
373
+ };
374
+ }
375
+ //#endregion
376
+ export { createRpcRouter as n, createServer as r, connectRpc as t };
@@ -0,0 +1,10 @@
1
+ //#region ../kyju/src/v2/trace.ts
2
+ /**
3
+ * No-op trace helpers preserved for ergonomic call-site shape inside kyju
4
+ * internals. Historically wrapped operations in a boot-trace span; now just
5
+ * runs `fn`/the passed Effect verbatim with zero observability overhead.
6
+ */
7
+ const traceKyju = (_name, eff, _meta) => eff;
8
+ const traceKyjuSync = (_name, fn, _meta) => fn();
9
+ //#endregion
10
+ export { traceKyjuSync as n, traceKyju as t };