overmux 0.0.2 → 0.0.4
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/CHANGELOG.md +21 -0
- package/dist/auth/.vite/manifest.json +2 -2
- package/dist/auth/assets/{index-Bx8JhwVi.css → index-BM9gETvx.css} +1 -1
- package/dist/auth/assets/{index-CHIE7qYj.js → index-DabAfcs1.js} +1 -1
- package/dist/auth/index.html +2 -2
- package/dist/bin.js +430 -18
- package/dist/bin.js.map +1 -1
- package/dist/docs/200-getting-started/100-install-and-run-overmux.md +1 -2
- package/dist/docs/300-fundamentals/100-project-structure.md +20 -0
- package/dist/docs/300-fundamentals/300-theming.md +51 -0
- package/dist/docs/400-reference/100-configuration.md +20 -0
- package/dist/docs/400-reference/200-server-api.md +18 -0
- package/dist/docs/400-reference/300-client-api.md +36 -0
- package/dist/docs/400-reference/400-cli/050-init.md +17 -0
- package/dist/docs/400-reference/400-cli/350-instance.md +24 -0
- package/dist/exports/client.d.ts +33 -3
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +123 -14
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/{index-D3_Dpy_T.d.ts → index-DS70rKzo.d.ts} +14 -2
- package/dist/exports/index-DS70rKzo.d.ts.map +1 -0
- package/dist/exports/index.d.ts +2 -2
- package/dist/exports/index.js +1 -1
- package/dist/exports/index.js.map +1 -1
- package/dist/exports/{notifications-kDp16bU_.js → notifications-av0FK0yZ.js} +7 -2
- package/dist/exports/{notifications-kDp16bU_.js.map → notifications-av0FK0yZ.js.map} +1 -1
- package/dist/exports/server.d.ts.map +1 -1
- package/dist/exports/server.js +52 -10
- package/dist/exports/server.js.map +1 -1
- package/dist/internal/server/coordinator/server-child.js +110 -46
- package/dist/internal/server/coordinator/server-child.js.map +1 -1
- package/docs/200-getting-started/100-install-and-run-overmux.md +1 -2
- package/docs/300-fundamentals/100-project-structure.md +20 -0
- package/docs/300-fundamentals/300-theming.md +51 -0
- package/docs/400-reference/100-configuration.md +20 -0
- package/docs/400-reference/200-server-api.md +18 -0
- package/docs/400-reference/300-client-api.md +36 -0
- package/docs/400-reference/400-cli/050-init.md +17 -0
- package/docs/400-reference/400-cli/350-instance.md +24 -0
- package/package.json +2 -2
- package/src/internal/cli/app.ts +7 -1
- package/src/internal/cli/commands/init-template.ts +146 -0
- package/src/internal/cli/commands/init.ts +267 -0
- package/src/internal/cli/commands/instance.ts +58 -0
- package/src/internal/cli/commands/integration.ts +15 -0
- package/src/internal/cli/commands/zellij-install.ts +96 -0
- package/src/internal/cli/parse-port.ts +2 -1
- package/src/internal/client/auth/auth-shell.css +17 -1
- package/src/internal/client/auth/auth-shell.tsx +2 -11
- package/src/internal/client/auth/login-code-input.tsx +140 -0
- package/src/internal/client/browser-api.ts +17 -3
- package/src/internal/client/clipboard.ts +22 -0
- package/src/internal/client/host/desktop-host.ts +15 -0
- package/src/internal/client/host/environment.ts +67 -0
- package/src/internal/client/host/instance-forwarding.ts +21 -0
- package/src/internal/client/host/notification-forwarding.ts +1 -10
- package/src/internal/client/host/overmux-host.tsx +8 -0
- package/src/internal/client/overmux-react.ts +24 -2
- package/src/internal/client/websocket.ts +48 -20
- package/src/internal/server/auth/instance-control.ts +24 -3
- package/src/internal/server/runtime/create-runtime.ts +12 -1
- package/src/internal/server/runtime/runtime-instance.ts +46 -0
- package/src/internal/server/runtime/runtime-resources.ts +3 -0
- package/src/internal/server/server-startup-options.ts +9 -4
- package/src/internal/server/start-application-server.ts +20 -12
- package/src/internal/server/websocket-server.ts +7 -0
- package/src/internal/shared/index.ts +2 -0
- package/src/internal/shared/protocol.ts +10 -1
- package/src/public/client.ts +5 -0
- package/src/public/config.ts +7 -0
- package/src/public/index.ts +2 -0
- package/dist/exports/index-D3_Dpy_T.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":[],"sources":["../../../shared/dist/node/index.js","../../src/internal/shared/background-notifications.ts","../../../shared/dist/index.js","../../src/internal/shared/protocol.ts","../../src/internal/server/runtime/runtime-lifecycle.ts","../../src/internal/server/runtime/runtime-operations.ts","../../src/public/ai-context.ts","../../src/public/contracts.ts","../../src/internal/server/runtime/resource-dependency-graph.ts","../../src/internal/server/runtime/runtime-resources.ts","../../src/internal/server/runtime/runtime-streams.ts","../../src/internal/server/runtime/create-runtime.ts","../../src/internal/server/check-overmux.ts","../../src/internal/server/server-logger.ts","../../src/internal/server/coordinator/ipc-protocol.ts","../../src/internal/server/coordinator/update-watcher.ts","../../src/internal/server/coordinator/server-coordinator.ts","../../src/internal/server/start-overmux-server.ts"],"sourcesContent":["import { realpath } from \"node:fs/promises\";\nimport { isIP } from \"node:net\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { createJiti } from \"jiti\";\nimport { z } from \"zod\";\nimport { homedir } from \"node:os\";\n//#region ../lib/dist/index.js\nconst durationPattern = /^([1-9]\\d*)(ms|s|m|h|d)$/;\nconst millisecondsByUnit = {\n\td: 1440 * 60 * 1e3,\n\th: 3600 * 1e3,\n\tm: 60 * 1e3,\n\tms: 1,\n\ts: 1e3\n};\nconst durationToMilliseconds = (duration) => {\n\tconst match = durationPattern.exec(duration);\n\tif (!match) return;\n\tconst unit = match[2];\n\tconst milliseconds = Number(match[1]) * millisecondsByUnit[unit];\n\treturn Number.isSafeInteger(milliseconds) ? milliseconds : void 0;\n};\nconst aiContextSnippets = [\"package-source\", \"tech-stack-recommendations\"];\n//#endregion\n//#region src/node/config.ts\nconst zodTypeSchema = z.custom((value) => value instanceof z.ZodType, \"Expected a Zod schema\");\nconst functionSchema = z.custom((value) => typeof value === \"function\", \"Expected a function\");\nconst contractRuntimeSchema = z.object({\n\tinput: zodTypeSchema,\n\toutput: zodTypeSchema\n});\nconst operationRuntimeSchema = z.object({\n\thandle: functionSchema,\n\tinput: zodTypeSchema,\n\toutput: zodTypeSchema\n});\nconst streamHandlerRuntimeSchema = z.object({\n\tcontract: z.object({\n\t\tclientMessage: zodTypeSchema,\n\t\tinput: zodTypeSchema,\n\t\tserverMessage: zodTypeSchema\n\t}),\n\topen: functionSchema\n});\nconst resourceDefinitionRuntimeSchema = z.discriminatedUnion(\"kind\", [\n\tz.object({\n\t\tcontract: contractRuntimeSchema,\n\t\tkind: z.literal(\"query\"),\n\t\tread: functionSchema\n\t}),\n\tz.object({\n\t\tcontract: contractRuntimeSchema,\n\t\tkind: z.literal(\"subscription\"),\n\t\tread: functionSchema,\n\t\tsubscribe: functionSchema\n\t}),\n\tz.object({\n\t\tcombine: functionSchema,\n\t\tcontract: contractRuntimeSchema,\n\t\tdependencies: z.record(z.string(), z.string()),\n\t\tkind: z.literal(\"derived\")\n\t})\n]);\nconst authDurationSchema = z.string().regex(/^[1-9]\\d*[mhd]$/, \"Expected a positive duration such as 30d\").refine((value) => durationToMilliseconds(value) !== void 0, \"Duration is too large\");\nconst isLoopbackHostname = (hostname) => hostname === \"localhost\" || hostname === \"[::1]\" || /^127(?:\\.\\d{1,3}){3}$/.test(hostname);\nconst exactOriginSchema = z.url().refine((value) => new URL(value).origin === value, \"Expected an origin\").refine((value) => {\n\tconst url = new URL(value);\n\treturn url.protocol === \"https:\" || url.protocol === \"http:\" && isLoopbackHostname(url.hostname);\n}, \"Non-loopback Overmux origins must use HTTPS\");\nconst loopbackPeerSchema = z.string().refine((value) => isIP(value) !== 0 && (value === \"::1\" || value.startsWith(\"127.\")), \"Expected a loopback IP address\");\nconst authConfigRuntimeSchema = z.object({\n\tmode: z.literal(\"cli-login\"),\n\torigins: z.array(exactOriginSchema).min(1).refine((origins) => new Set(origins).size === origins.length, \"Expected unique origins\").optional(),\n\tsessionLifetime: z.union([z.literal(\"never\"), authDurationSchema]).default(\"never\"),\n\ttrustedProxyPeer: loopbackPeerSchema.optional()\n}).strict();\nconst serverConfigRuntimeSchema = z.object({\n\thost: z.string().min(1).optional(),\n\tlogFile: z.string().min(1).optional(),\n\tport: z.number().int().min(1).max(65535).optional(),\n\tproductionWebAssetsDir: z.string().min(1).optional(),\n\twatch: z.boolean().optional()\n});\nconst serverDefinitionRuntimeSchema = z.object({\n\toperations: z.record(z.string(), operationRuntimeSchema).optional(),\n\tresources: z.record(z.string(), resourceDefinitionRuntimeSchema),\n\tstreams: z.record(z.string(), streamHandlerRuntimeSchema).optional()\n});\nconst configDefinitionRuntimeSchema = serverConfigRuntimeSchema.extend({\n\taiContextSnippets: z.array(z.enum(aiContextSnippets)).optional(),\n\tauth: authConfigRuntimeSchema,\n\tdebug: z.boolean().optional(),\n\tserver: serverDefinitionRuntimeSchema,\n\tvite: z.string().min(1).optional()\n});\nconst resolveLogicalPath = async (path) => {\n\tconst logicalPath = resolve(path);\n\treturn {\n\t\tlogicalPath,\n\t\trealPath: await realpath(logicalPath)\n\t};\n};\nconst resolveOvermuxConfigPaths = async (configPath) => {\n\tconst { logicalPath, realPath } = await resolveLogicalPath(configPath);\n\treturn {\n\t\tlogicalApplicationRoot: dirname(logicalPath),\n\t\tlogicalConfigPath: logicalPath,\n\t\trealApplicationRoot: dirname(realPath),\n\t\trealConfigPath: realPath\n\t};\n};\nconst unwrapDefaultExport = (module) => {\n\tif (typeof module === \"object\" && module !== null && \"default\" in module) return module.default;\n\treturn module;\n};\nconst loadOvermuxConfig = async ({ aliases = {}, configPath }) => {\n\tconst paths = await resolveOvermuxConfigPaths(configPath);\n\tconst module = await createJiti(paths.logicalConfigPath, {\n\t\talias: aliases,\n\t\tfsCache: true,\n\t\tjsx: {\n\t\t\timportSource: \"react\",\n\t\t\truntime: \"automatic\"\n\t\t},\n\t\tmoduleCache: false,\n\t\tsourceMaps: true,\n\t\ttsconfigPaths: true\n\t}).import(paths.logicalConfigPath);\n\treturn {\n\t\tconfig: configDefinitionRuntimeSchema.parse(unwrapDefaultExport(module)),\n\t\tpaths\n\t};\n};\n//#endregion\n//#region src/node/paths.ts\nconst xdgDirectory = (configured, fallback) => configured && isAbsolute(configured) ? configured : fallback;\nconst overmuxDirectory = (root) => join(root, \"overmux\");\nconst getOvermuxPaths = ({ environment = process.env, homeDir = homedir(), xdgCacheHome = environment.XDG_CACHE_HOME, xdgConfigHome = environment.XDG_CONFIG_HOME, xdgDataHome = environment.XDG_DATA_HOME, xdgRuntimeDir = environment.XDG_RUNTIME_DIR, xdgStateHome = environment.XDG_STATE_HOME } = {}) => {\n\tif (!isAbsolute(homeDir)) throw new TypeError(\"The home directory must be absolute.\");\n\tconst runtimeDir = xdgRuntimeDir && isAbsolute(xdgRuntimeDir) ? overmuxDirectory(xdgRuntimeDir) : void 0;\n\treturn {\n\t\tcacheDir: overmuxDirectory(xdgDirectory(xdgCacheHome, join(homeDir, \".cache\"))),\n\t\tconfigDir: overmuxDirectory(xdgDirectory(xdgConfigHome, join(homeDir, \".config\"))),\n\t\tdataDir: overmuxDirectory(xdgDirectory(xdgDataHome, join(homeDir, \".local\", \"share\"))),\n\t\t...runtimeDir ? { runtimeDir } : {},\n\t\tstateDir: overmuxDirectory(xdgDirectory(xdgStateHome, join(homeDir, \".local\", \"state\")))\n\t};\n};\n//#endregion\nexport { authConfigRuntimeSchema, authDurationSchema, configDefinitionRuntimeSchema, getOvermuxPaths, loadOvermuxConfig, resolveLogicalPath, resolveOvermuxConfigPaths, serverConfigRuntimeSchema, serverDefinitionRuntimeSchema };\n\n//# sourceMappingURL=index.js.map","// Validates browser subscription data exchanged by background-notification delivery.\n// Browser-standard key and endpoint details stay behind this internal boundary.\nimport { z } from \"zod\";\n\nconst deliveryKeySchema = z\n .string()\n .min(1)\n .max(1_024)\n .regex(/^[\\w-]+$/u);\n\nexport const backgroundNotificationSubscriptionSchema = z\n .object({\n endpoint: z\n .url()\n .max(4_096)\n .refine((endpoint) => {\n const url = new URL(endpoint);\n return url.protocol === \"https:\" && !url.username && !url.password;\n }),\n expirationTime: z.number().int().nonnegative().nullable(),\n keys: z\n .object({ auth: deliveryKeySchema, p256dh: deliveryKeySchema })\n .strict(),\n })\n .strict();\n\nexport const backgroundNotificationPublicKeyResponseSchema = z\n .object({ publicKey: deliveryKeySchema })\n .strict();\n\nexport const backgroundNotificationDisableRequestSchema = z\n .object({ endpoint: backgroundNotificationSubscriptionSchema.shape.endpoint })\n .strict();\n\nexport type BackgroundNotificationSubscription = z.infer<\n typeof backgroundNotificationSubscriptionSchema\n>;\n","import { z } from \"zod\";\n//#region src/ai-context.ts\nconst packageSourceSnippet = \"package-source\";\nconst techStackRecommendationsSnippet = \"tech-stack-recommendations\";\nconst aiContextSnippets = [packageSourceSnippet, techStackRecommendationsSnippet];\n//#endregion\n//#region src/hosted-routes.ts\nconst overmuxSettingsPath = \"/_overmux/settings\";\nconst overmuxLogoutPath = \"/_overmux/logout\";\nconst reservedPathPrefixes = [\n\t\"/_overmux\",\n\t\"/api\",\n\t\"/login\"\n];\nconst returnToBase = \"https://overmux.invalid\";\nconst isReservedPath = (pathname) => reservedPathPrefixes.some((prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`));\nconst resolveOvermuxReturnTo = (candidate) => {\n\tif (!candidate?.startsWith(\"/\") || candidate.startsWith(\"//\")) return \"/\";\n\ttry {\n\t\tconst url = new URL(candidate, returnToBase);\n\t\tconst decodedPathname = decodeURIComponent(url.pathname);\n\t\tif (url.origin !== returnToBase || isReservedPath(decodedPathname)) return \"/\";\n\t\treturn `${url.pathname}${url.search}${url.hash}`;\n\t} catch {\n\t\treturn \"/\";\n\t}\n};\nconst createOvermuxSettingsPath = (returnTo) => {\n\tconst safeReturnTo = resolveOvermuxReturnTo(returnTo);\n\tif (safeReturnTo === \"/\") return overmuxSettingsPath;\n\tconst search = new URLSearchParams({ returnTo: safeReturnTo });\n\treturn `${overmuxSettingsPath}?${search.toString()}`;\n};\n//#endregion\n//#region src/notifications.ts\nconst safeRelativeNotificationLink = (link) => {\n\tlet decoded;\n\ttry {\n\t\tdecoded = decodeURIComponent(link);\n\t} catch {\n\t\treturn false;\n\t}\n\treturn !decoded.startsWith(\"//\") && !decoded.includes(\"\\\\\") && ![...decoded].some((character) => {\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\t\treturn codePoint < 32 || codePoint === 127;\n\t});\n};\nconst notificationLinkSchema = z.union([z.string().max(4096).startsWith(\"/\").refine(safeRelativeNotificationLink), z.string().max(4096).url().refine((link) => {\n\tif (!URL.canParse(link)) return false;\n\tconst url = new URL(link);\n\treturn [\"http:\", \"https:\"].includes(url.protocol) && !url.username && !url.password;\n})]);\nconst notificationSchema = z.object({\n\tbody: z.string().max(4096).optional(),\n\topen: z.object({ link: notificationLinkSchema }).strict().optional(),\n\ttitle: z.string().min(1).max(4096)\n}).strict();\n//#endregion\nexport { aiContextSnippets, createOvermuxSettingsPath, notificationLinkSchema, notificationSchema, overmuxLogoutPath, overmuxSettingsPath, packageSourceSnippet, resolveOvermuxReturnTo, techStackRecommendationsSnippet };\n\n//# sourceMappingURL=index.js.map","import { z } from \"zod\";\n\nimport { notificationSchema } from \"../../public/notifications\";\n\n// Compatibility gate, not negotiation: open tabs may still run older client assets.\n// The exact version rejects incompatible runtime manifest and wire formats before later traffic.\nexport const protocolVersion = 9 as const;\n\n// Application-defined WebSocket close codes shared by server and browser transports.\nexport const webSocketCloseCode = {\n authenticationRevoked: 4001,\n authenticationUnavailable: 4002,\n} as const;\n\nexport const runtimeManifestSchema = z.object({\n debug: z.boolean(),\n operations: z.array(z.string().min(1)),\n protocolVersion: z.literal(protocolVersion),\n resources: z.array(z.string().min(1)),\n streams: z.array(z.string().min(1)),\n});\n\nexport const updateAvailableEventSchema = z.object({\n type: z.literal(\"update-available\"),\n});\n\nexport const restartingEventSchema = z.object({\n type: z.literal(\"restarting\"),\n});\n\nexport const serverLifecycleEventSchema = z.discriminatedUnion(\"type\", [\n updateAvailableEventSchema,\n restartingEventSchema,\n]);\n\nexport const notificationEventSchema = z\n .object({\n notification: notificationSchema,\n type: z.literal(\"notification\"),\n })\n .strict();\n\nconst operationIdSchema = z.string().min(1).max(256);\nconst registrationNameSchema = z.string().min(1).max(256);\n\nexport const resourceReadMessageSchema = z.object({\n input: z.unknown().optional(),\n operationId: operationIdSchema,\n resourceName: registrationNameSchema,\n type: z.literal(\"resource-read\"),\n});\n\nexport const resourceSubscribeMessageSchema = z.object({\n input: z.unknown().optional(),\n operationId: operationIdSchema,\n resourceName: registrationNameSchema,\n subscriptionId: operationIdSchema,\n type: z.literal(\"resource-subscribe\"),\n});\n\nexport const resourceUnsubscribeMessageSchema = z.object({\n subscriptionId: operationIdSchema,\n type: z.literal(\"resource-unsubscribe\"),\n});\n\nexport const streamOpenMessageSchema = z.object({\n input: z.unknown().optional(),\n operationId: operationIdSchema,\n streamId: operationIdSchema,\n streamName: registrationNameSchema,\n type: z.literal(\"stream-open\"),\n});\n\nexport const streamMessageSchema = z.object({\n message: z.unknown(),\n streamId: operationIdSchema,\n type: z.literal(\"stream-message\"),\n});\n\nexport const streamCloseMessageSchema = z.object({\n streamId: operationIdSchema,\n type: z.literal(\"stream-close\"),\n});\n\nexport const clientDiagnosticEventSchema = z.object({\n arguments: z.string().max(16_100),\n level: z.enum([\"log\", \"info\", \"warn\", \"error\", \"debug\"]),\n message: z.string().max(4_100),\n stack: z.string().max(8_100).optional(),\n timestamp: z.iso.datetime(),\n type: z.literal(\"client-diagnostic\"),\n url: z.string().max(2_100).optional(),\n});\n\nexport const clientProtocolMessageSchema = z.discriminatedUnion(\"type\", [\n resourceReadMessageSchema,\n resourceSubscribeMessageSchema,\n resourceUnsubscribeMessageSchema,\n streamOpenMessageSchema,\n streamMessageSchema,\n streamCloseMessageSchema,\n clientDiagnosticEventSchema,\n]);\n\nexport const resourceResultMessageSchema = z.object({\n operationId: operationIdSchema,\n output: z.unknown(),\n type: z.literal(\"resource-result\"),\n});\n\nexport const resourceInvalidatedMessageSchema = z.object({\n subscriptionId: operationIdSchema,\n type: z.literal(\"resource-invalidated\"),\n});\n\nexport const streamOpenedMessageSchema = z.object({\n operationId: operationIdSchema,\n streamId: operationIdSchema,\n type: z.literal(\"stream-opened\"),\n});\n\nexport const streamOutputMessageSchema = z.object({\n message: z.unknown(),\n streamId: operationIdSchema,\n type: z.literal(\"stream-output\"),\n});\n\nexport const streamClosedMessageSchema = z.object({\n streamId: operationIdSchema,\n type: z.literal(\"stream-closed\"),\n});\n\nexport const protocolErrorMessageSchema = z.object({\n code: z.enum([\"bad-request\", \"conflict\", \"internal\", \"not-found\"]),\n message: z.string(),\n operationId: operationIdSchema.optional(),\n streamId: operationIdSchema.optional(),\n subscriptionId: operationIdSchema.optional(),\n type: z.literal(\"error\"),\n});\n\nexport const serverProtocolMessageSchema = z.discriminatedUnion(\"type\", [\n resourceResultMessageSchema,\n resourceInvalidatedMessageSchema,\n streamOpenedMessageSchema,\n streamOutputMessageSchema,\n streamClosedMessageSchema,\n protocolErrorMessageSchema,\n updateAvailableEventSchema,\n restartingEventSchema,\n notificationEventSchema,\n]);\n\nconst byteMarker = \"$overmuxBytes\";\n\ntype EncodedBytes = { [byteMarker]: number[] };\n\nconst encodeValue = (value: unknown): unknown => {\n if (value instanceof Uint8Array) {\n return { [byteMarker]: Array.from(value) } satisfies EncodedBytes;\n }\n if (Array.isArray(value)) {\n return value.map(encodeValue);\n }\n if (typeof value === \"object\" && value !== null) {\n return Object.fromEntries(\n Object.entries(value).map(([key, item]) => [key, encodeValue(item)]),\n );\n }\n return value;\n};\n\nconst decodeValue = (value: unknown): unknown => {\n if (Array.isArray(value)) {\n return value.map(decodeValue);\n }\n if (typeof value !== \"object\" || value === null) {\n return value;\n }\n const record = value as Record<string, unknown>;\n if (\n Object.keys(record).length === 1 &&\n Array.isArray(record[byteMarker]) &&\n record[byteMarker].every(\n (item) => Number.isInteger(item) && item >= 0 && item <= 255,\n )\n ) {\n return Uint8Array.from(record[byteMarker] as number[]);\n }\n return Object.fromEntries(\n Object.entries(record).map(([key, item]) => [key, decodeValue(item)]),\n );\n};\n\nconst binaryMarker = \"$overmuxBinary\";\nconst binaryMagic = 0x4f4d5801;\n\ntype EncodedBinary = { [binaryMarker]: [number, number] };\n\nconst encodeBinaryValue = (\n value: unknown,\n payloads: Uint8Array[],\n offset: { value: number },\n): unknown => {\n if (value instanceof Uint8Array) {\n const marker = {\n [binaryMarker]: [offset.value, value.byteLength],\n } satisfies EncodedBinary;\n payloads.push(value);\n offset.value += value.byteLength;\n return marker;\n }\n if (Array.isArray(value)) {\n return value.map((item) => encodeBinaryValue(item, payloads, offset));\n }\n if (typeof value === \"object\" && value !== null) {\n return Object.fromEntries(\n Object.entries(value).map(([key, item]) => [\n key,\n encodeBinaryValue(item, payloads, offset),\n ]),\n );\n }\n return value;\n};\n\nconst decodeBinaryValue = (value: unknown, payload: Uint8Array): unknown => {\n if (Array.isArray(value)) {\n return value.map((item) => decodeBinaryValue(item, payload));\n }\n if (typeof value !== \"object\" || value === null) {\n return value;\n }\n const record = value as Record<string, unknown>;\n const marker = record[binaryMarker];\n if (\n Object.keys(record).length === 1 &&\n Array.isArray(marker) &&\n marker.length === 2 &&\n marker.every((item) => Number.isInteger(item) && item >= 0)\n ) {\n const [offset, length] = marker as [number, number];\n if (offset + length > payload.byteLength) {\n throw new Error(\"Invalid Overmux binary payload range\");\n }\n return payload.slice(offset, offset + length);\n }\n return Object.fromEntries(\n Object.entries(record).map(([key, item]) => [\n key,\n decodeBinaryValue(item, payload),\n ]),\n );\n};\n\nexport const encodeProtocolMessage = (message: unknown): string =>\n JSON.stringify(encodeValue(message));\n\nexport const decodeProtocolMessage = (message: string): unknown =>\n decodeValue(JSON.parse(message));\n\nexport const encodeProtocolFrame = (message: unknown): string | Uint8Array => {\n const payloads: Uint8Array[] = [];\n const encoded = encodeBinaryValue(message, payloads, { value: 0 });\n if (!payloads.length) {\n return JSON.stringify(encoded);\n }\n const header = new TextEncoder().encode(JSON.stringify(encoded));\n const payloadLength = payloads.reduce(\n (total, payload) => total + payload.byteLength,\n 0,\n );\n const frame = new Uint8Array(8 + header.byteLength + payloadLength);\n const view = new DataView(frame.buffer);\n view.setUint32(0, binaryMagic);\n view.setUint32(4, header.byteLength);\n frame.set(header, 8);\n let offset = 8 + header.byteLength;\n payloads.forEach((payload) => {\n frame.set(payload, offset);\n offset += payload.byteLength;\n });\n return frame;\n};\n\nexport const decodeProtocolFrame = (\n frame: string | ArrayBuffer | Uint8Array,\n): unknown => {\n if (typeof frame === \"string\") {\n return decodeProtocolMessage(frame);\n }\n const bytes =\n frame instanceof Uint8Array\n ? frame\n : new Uint8Array(frame, 0, frame.byteLength);\n if (bytes.byteLength < 8) {\n throw new Error(\"Invalid Overmux binary frame\");\n }\n const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n if (view.getUint32(0) !== binaryMagic) {\n throw new Error(\"Invalid Overmux binary frame magic\");\n }\n const headerLength = view.getUint32(4);\n if (8 + headerLength > bytes.byteLength) {\n throw new Error(\"Invalid Overmux binary frame header\");\n }\n const header = JSON.parse(\n new TextDecoder().decode(bytes.subarray(8, 8 + headerLength)),\n ) as unknown;\n return decodeBinaryValue(header, bytes.subarray(8 + headerLength));\n};\n\nexport type RuntimeManifest = z.infer<typeof runtimeManifestSchema>;\nexport type ClientDiagnosticEvent = z.infer<typeof clientDiagnosticEventSchema>;\nexport type ClientProtocolMessage = z.infer<typeof clientProtocolMessageSchema>;\nexport type ServerLifecycleEvent = z.infer<typeof serverLifecycleEventSchema>;\nexport type ServerProtocolMessage = z.infer<typeof serverProtocolMessageSchema>;\n","// Composes runtime and request cancellation while owning asynchronous cleanup.\n// Tracked disposers run exactly once, and aggregate shutdown reports every failure.\n\nimport type { RuntimeDisposer } from \"../../../public/index\";\n\nexport type RuntimeLifecycle = {\n completePreparation: () => void;\n dispose: (reason?: unknown) => Promise<void>;\n disposeAll: (disposers: Iterable<RuntimeDisposer>) => Promise<void>;\n requestSignal: (signal?: AbortSignal) => AbortSignal;\n signal: AbortSignal;\n track: (dispose: RuntimeDisposer, signal?: AbortSignal) => RuntimeDisposer;\n};\n\nconst asError = (cause: unknown) =>\n cause instanceof Error ? cause : new Error(String(cause));\n\nconst disposeAll = async (disposers: Iterable<RuntimeDisposer>) => {\n const results = await Promise.allSettled(\n [...disposers].map(async (dispose) => dispose()),\n );\n const errors = results.flatMap((result) =>\n result.status === \"rejected\" ? [asError(result.reason)] : [],\n );\n if (errors.length) {\n throw new AggregateError(errors, \"Runtime disposal failed\");\n }\n};\n\nexport const createRuntimeLifecycle = (\n preparationSignal?: AbortSignal,\n): RuntimeLifecycle => {\n const controller = new AbortController();\n const activeDisposers = new Set<RuntimeDisposer>();\n let disposal: Promise<void> | undefined;\n const abortPreparation = () => controller.abort(preparationSignal?.reason);\n preparationSignal?.addEventListener(\"abort\", abortPreparation, {\n once: true,\n });\n if (preparationSignal?.aborted) {\n abortPreparation();\n }\n\n const completePreparation = () => {\n preparationSignal?.removeEventListener(\"abort\", abortPreparation);\n };\n const requestSignal = (signal?: AbortSignal) =>\n signal ? AbortSignal.any([controller.signal, signal]) : controller.signal;\n const track = (\n dispose: RuntimeDisposer,\n signal?: AbortSignal,\n ): RuntimeDisposer => {\n let pending: Promise<void> | undefined;\n const disposeOnce = () => {\n if (pending) {\n return pending;\n }\n controller.signal.removeEventListener(\"abort\", onAbort);\n signal?.removeEventListener(\"abort\", onAbort);\n activeDisposers.delete(disposeOnce);\n pending = Promise.resolve().then(dispose);\n return pending;\n };\n const onAbort = () => {\n void disposeOnce().catch(() => undefined);\n };\n activeDisposers.add(disposeOnce);\n controller.signal.addEventListener(\"abort\", onAbort, { once: true });\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n if (controller.signal.aborted || signal?.aborted) {\n onAbort();\n }\n return disposeOnce;\n };\n const dispose = (reason: unknown = new Error(\"Runtime disposed\")) => {\n if (disposal) {\n return disposal;\n }\n completePreparation();\n const pending = [...activeDisposers];\n activeDisposers.clear();\n controller.abort(reason);\n disposal = disposeAll(pending);\n return disposal;\n };\n\n return {\n completePreparation,\n dispose,\n disposeAll,\n requestSignal,\n signal: controller.signal,\n track,\n };\n};\n","// Registers named operations with validated input, output, and notification context.\n// Lookup metadata stays aligned with the names published in the runtime manifest.\n\nimport type {\n HandlerContext,\n OperationDefinition,\n} from \"../../../public/index\";\nimport type { Notifications } from \"../../../public/index\";\nimport { z } from \"zod\";\n\nexport class OperationValidationError extends Error {\n constructor(\n readonly phase: \"input\" | \"output\",\n cause: z.ZodError,\n ) {\n super(cause.message, { cause });\n }\n}\n\nexport type RuntimeOperation = {\n execute: (input: unknown, signal?: AbortSignal) => Promise<unknown>;\n returnsVoid: boolean;\n};\n\nexport type RuntimeOperations = {\n get: (name: string) => RuntimeOperation | undefined;\n names: readonly string[];\n};\n\ntype AnyOperation = OperationDefinition<z.ZodTypeAny, z.ZodTypeAny>;\n\nexport type RuntimeOperationDefinitions = Readonly<\n Record<string, AnyOperation>\n>;\n\ntype CreateRuntimeOperationsOptions = {\n context: (signal?: AbortSignal) => HandlerContext;\n definitions: RuntimeOperationDefinitions;\n notifications: Notifications;\n};\n\nexport const createRuntimeOperations = ({\n context,\n definitions,\n notifications,\n}: CreateRuntimeOperationsOptions): RuntimeOperations => {\n const operations = new Map<string, RuntimeOperation>();\n Object.entries(definitions).forEach(([name, definition]) => {\n if (!name) {\n throw new Error(\"Operation names must not be empty\");\n }\n operations.set(name, {\n execute: async (rawInput, signal) => {\n const operationContext = context(signal);\n operationContext.signal.throwIfAborted();\n const input = definition.input.safeParse(rawInput);\n if (!input.success) {\n throw new OperationValidationError(\"input\", input.error);\n }\n const rawOutput = await definition.handle(input.data, {\n ...operationContext,\n notifications,\n });\n operationContext.signal.throwIfAborted();\n const output = definition.output.safeParse(rawOutput);\n if (!output.success) {\n throw new OperationValidationError(\"output\", output.error);\n }\n return output.data;\n },\n returnsVoid: definition.output instanceof z.ZodVoid,\n });\n });\n return {\n get: (name) => operations.get(name),\n names: [...operations.keys()],\n };\n};\n","import {\n packageSourceSnippet,\n techStackRecommendationsSnippet,\n type AiContextSnippet,\n} from \"@overmux/shared\";\n\nexport {\n packageSourceSnippet,\n techStackRecommendationsSnippet,\n type AiContextSnippet,\n};\nexport type AiContextSnippetDefinition = readonly AiContextSnippet[];\n\nexport const coreAiContextSnippets = [\n packageSourceSnippet,\n] as const satisfies AiContextSnippetDefinition;\nexport const defaultAiContextSnippets = [\n ...coreAiContextSnippets,\n techStackRecommendationsSnippet,\n] as const satisfies AiContextSnippetDefinition;\n\nconst packageSourceSnippetContent = `Overmux ships with documentation and TypeScript source.\n\nRun \\`overmux docs\\` to find the installed documentation and source for the overmux cli.\n\nE.g. \\`node_modules/overmux\\` and \\`node_modules/@overmux/xterm\\`.\n\nInspect these files so guidance matches the versions used by the application.`;\n\nconst techStackRecommendationsSnippetContent = `Prefer pnpm as the package manager, TanStack Router for routing, shadcn/ui for UI components, and Zod for schemas and runtime validation. Follow the application's established stack when it already differs.`;\n\nconst aiContextContentBySnippet: Record<AiContextSnippet, string> = {\n [packageSourceSnippet]: packageSourceSnippetContent,\n [techStackRecommendationsSnippet]: techStackRecommendationsSnippetContent,\n};\n\nexport const composeAiContext = (snippets: AiContextSnippetDefinition) =>\n snippets.length === 0\n ? \"\"\n : `${snippets\n .map(\n (snippet) => `## ${snippet}\\n\\n${aiContextContentBySnippet[snippet]}`,\n )\n .join(\"\\n\\n\")}\\n`;\n","import { z } from \"zod\";\n\nexport const noInputSchema = z.void();\n\nexport const jsonValueSchema: z.ZodType<unknown> = z.lazy(() =>\n z.union([\n z.string(),\n z.number().finite(),\n z.boolean(),\n z.null(),\n z.array(jsonValueSchema),\n z.record(z.string(), jsonValueSchema),\n ]),\n);\n\nexport const parseJsonValue = <T>(value: T): T =>\n jsonValueSchema.parse(value) as T;\n\nexport type ContractInputArguments<TInput extends z.ZodType> =\n undefined extends z.input<TInput>\n ? [input?: Exclude<z.input<TInput>, undefined>]\n : [input: z.input<TInput>];\n\nexport type ResourceContract<\n TInput extends z.ZodType = z.ZodType,\n TOutput extends z.ZodType = z.ZodType,\n> = {\n input: TInput;\n output: TOutput;\n};\n\nexport const defineResourceContract = <\n TInput extends z.ZodType,\n TOutput extends z.ZodType,\n>(\n contract: ResourceContract<TInput, TOutput>,\n): ResourceContract<TInput, TOutput> => contract;\n\nexport type StreamContract<\n TInput extends z.ZodType = z.ZodType,\n TClientMessage extends z.ZodType = z.ZodType,\n TServerMessage extends z.ZodType = z.ZodType,\n> = {\n clientMessage: TClientMessage;\n input: TInput;\n serverMessage: TServerMessage;\n};\n\nexport const defineStreamContract = <\n TInput extends z.ZodType,\n TClientMessage extends z.ZodType,\n TServerMessage extends z.ZodType,\n>(\n contract: StreamContract<TInput, TClientMessage, TServerMessage>,\n): StreamContract<TInput, TClientMessage, TServerMessage> => contract;\n","// Resource invalidation follows relationships among configured resources.\n// This model owns those relationships and their invariants before runtime work begins.\n\nimport type { ResourceDefinition } from \"../../../public/index\";\n\n// A dependency supplies a derived resource's value; a dependant consumes that value.\n// Keeping both directions makes reads follow dependencies while invalidation follows dependants.\nexport type ResourceDependencyGraph = Readonly<{\n dependencies: ReadonlyMap<string, ReadonlySet<string>>;\n dependants: ReadonlyMap<string, ReadonlySet<string>>;\n}>;\n\ntype MutableResourceGraph = Map<string, Set<string>>;\n\nconst emptyGraphFor = (resourceIds: readonly string[]): MutableResourceGraph =>\n new Map(resourceIds.map((resourceId) => [resourceId, new Set<string>()]));\n\nconst visitDependencies = ({\n dependencies,\n path,\n resourceId,\n visited,\n visiting,\n}: {\n dependencies: ReadonlyMap<string, ReadonlySet<string>>;\n path: readonly string[];\n resourceId: string;\n visited: Set<string>;\n visiting: Set<string>;\n}) => {\n if (visiting.has(resourceId)) {\n throw new Error(\n `Resource dependency cycle: ${[...path, resourceId].join(\" -> \")}`,\n );\n }\n if (visited.has(resourceId)) {\n return;\n }\n visiting.add(resourceId);\n dependencies.get(resourceId)?.forEach((dependencyId) => {\n visitDependencies({\n dependencies,\n path: [...path, resourceId],\n resourceId: dependencyId,\n visited,\n visiting,\n });\n });\n visiting.delete(resourceId);\n visited.add(resourceId);\n};\n\nconst assertAcyclic = (\n dependencies: ReadonlyMap<string, ReadonlySet<string>>,\n) => {\n // Derived reads recurse through dependencies, so a cycle could never produce a value or finish activation.\n const visited = new Set<string>();\n const visiting = new Set<string>();\n dependencies.forEach((_, resourceId) => {\n visitDependencies({\n dependencies,\n path: [],\n resourceId,\n visited,\n visiting,\n });\n });\n};\n\nexport const createResourceDependencyGraph = (\n resources: Readonly<Record<string, ResourceDefinition>>,\n): ResourceDependencyGraph => {\n const resourceIds = Object.keys(resources);\n if (resourceIds.some((resourceId) => !resourceId)) {\n throw new Error(\"Resource IDs must not be empty\");\n }\n const dependencies = emptyGraphFor(resourceIds);\n const dependants = emptyGraphFor(resourceIds);\n\n Object.entries(resources).forEach(([resourceId, resource]) => {\n if (resource.kind !== \"derived\") {\n return;\n }\n Object.entries(\n resource.dependencies as Readonly<Record<string, string>>,\n ).forEach(([dependencyName, dependencyId]) => {\n if (!dependencyName) {\n throw new Error(`Resource ${resourceId} has an empty dependency name`);\n }\n if (!dependencyId) {\n throw new Error(`Resource ${resourceId} has an empty dependency ID`);\n }\n if (!dependencies.has(dependencyId)) {\n throw new Error(`Unknown resource dependency: ${dependencyId}`);\n }\n dependencies.get(resourceId)?.add(dependencyId);\n dependants.get(dependencyId)?.add(resourceId);\n });\n });\n\n assertAcyclic(dependencies);\n return Object.freeze({ dependencies, dependants });\n};\n\nconst collectInvalidatedResourceIds = (\n graph: ResourceDependencyGraph,\n resourceId: string,\n invalidated: Set<string>,\n) => {\n if (invalidated.has(resourceId)) {\n return;\n }\n invalidated.add(resourceId);\n graph.dependants.get(resourceId)?.forEach((dependantId) => {\n collectInvalidatedResourceIds(graph, dependantId, invalidated);\n });\n};\n\nexport const getInvalidatedResourceIds = (\n graph: ResourceDependencyGraph,\n resourceId: string,\n): ReadonlySet<string> => {\n // A changed value invalidates itself and the full reverse-edge closure, not just immediate consumers.\n // Set membership is essential for diamonds: a shared dependant must notify once despite multiple paths.\n const invalidated = new Set<string>();\n collectInvalidatedResourceIds(graph, resourceId, invalidated);\n return invalidated;\n};\n","// Owns named runtime resource lookup, validated reads, dependency watchers, and invalidation.\n\nimport {\n type HandlerContext,\n type ResourceDefinition,\n type RuntimeDisposer,\n} from \"../../../public/index\";\nimport type { ResourceContract } from \"../../../public/index\";\nimport { isDeepStrictEqual } from \"node:util\";\n\nimport {\n createResourceDependencyGraph,\n getInvalidatedResourceIds,\n} from \"./resource-dependency-graph\";\nimport type { RuntimeLifecycle } from \"./runtime-lifecycle\";\n\nexport type RuntimeResource = {\n read: (input: unknown, signal?: AbortSignal) => Promise<unknown>;\n subscribe: (\n input: unknown,\n listener: () => void,\n signal?: AbortSignal,\n ) => RuntimeDisposer;\n};\n\nexport type RuntimeResourceDefinitions = Readonly<\n Record<string, ResourceDefinition>\n>;\n\nexport type RuntimeResources = {\n context: (signal?: AbortSignal) => HandlerContext;\n get: (name: string) => RuntimeResource | undefined;\n invalidate: (contract: ResourceContract, input?: unknown) => void;\n names: readonly string[];\n};\n\ntype InvalidationListener = {\n input: unknown;\n listener: () => void;\n resourceId: string;\n};\n\ntype CreateRuntimeResourcesOptions = {\n definitions: RuntimeResourceDefinitions;\n lifecycle: RuntimeLifecycle;\n};\n\nexport const createRuntimeResources = ({\n definitions,\n lifecycle,\n}: CreateRuntimeResourcesOptions): RuntimeResources => {\n const graph = createResourceDependencyGraph(definitions);\n const invalidationListeners = new Set<InvalidationListener>();\n const contracts = new Map<ResourceContract, string[]>();\n const resources = new Map<string, RuntimeResource>();\n\n Object.entries(definitions).forEach(([id, definition]) => {\n contracts.set(definition.contract, [\n ...(contracts.get(definition.contract) ?? []),\n id,\n ]);\n });\n\n const invalidateResource = (\n id: string,\n input: unknown,\n allInputs = false,\n ) => {\n if (lifecycle.signal.aborted) {\n return;\n }\n const ids = getInvalidatedResourceIds(graph, id);\n invalidationListeners.forEach((entry) => {\n if (\n ids.has(entry.resourceId) &&\n (allInputs || isDeepStrictEqual(entry.input, input))\n ) {\n entry.listener();\n }\n });\n };\n\n const invalidate = (contract: ResourceContract, input?: unknown) => {\n const ids =\n contracts.get(contract) ??\n Object.entries(definitions)\n .filter(\n ([, definition]) =>\n definition.contract.input === contract.input &&\n definition.contract.output === contract.output,\n )\n .map(([id]) => id);\n if (!ids.length) {\n throw new Error(\"Cannot invalidate a resource outside this runtime\");\n }\n ids.forEach((id) => {\n const definition = definitions[id]!;\n const parsedInput =\n input === undefined\n ? undefined\n : definition.contract.input.parse(input);\n invalidateResource(id, parsedInput, input === undefined);\n });\n };\n\n const context = (signal?: AbortSignal): HandlerContext => ({\n invalidate,\n signal: lifecycle.requestSignal(signal),\n });\n\n const read = async (\n id: string,\n rawInput: unknown,\n signal?: AbortSignal,\n ): Promise<unknown> => {\n const definition = definitions[id]!;\n const operationSignal = lifecycle.requestSignal(signal);\n operationSignal.throwIfAborted();\n const input = definition.contract.input.parse(rawInput);\n const rawOutput =\n definition.kind === \"derived\"\n ? definition.combine(\n Object.fromEntries(\n await Promise.all(\n Object.entries(\n definition.dependencies as Readonly<Record<string, string>>,\n ).map(async ([name, dependencyId]) => [\n name,\n await read(dependencyId, rawInput, signal),\n ]),\n ),\n ),\n )\n : await definition.read(input, context(signal));\n operationSignal.throwIfAborted();\n return definition.contract.output.parse(rawOutput);\n };\n\n const activateWatchers = (\n id: string,\n rawInput: unknown,\n signal: AbortSignal | undefined,\n activated: Set<string>,\n disposers: RuntimeDisposer[],\n ) => {\n if (activated.has(id)) {\n return;\n }\n activated.add(id);\n const definition = definitions[id]!;\n const input = definition.contract.input.parse(rawInput);\n if (definition.kind === \"subscription\") {\n const dispose = definition.subscribe(\n input,\n () => invalidateResource(id, input),\n context(signal),\n );\n if (typeof dispose !== \"function\") {\n throw new Error(`Resource ${id} subscribe must return a disposer`);\n }\n disposers.push(dispose);\n return;\n }\n if (definition.kind === \"derived\") {\n graph.dependencies.get(id)?.forEach((dependencyId) => {\n activateWatchers(dependencyId, rawInput, signal, activated, disposers);\n });\n }\n };\n\n Object.keys(definitions).forEach((name) => {\n resources.set(name, {\n read: (input, signal) => read(name, input, signal),\n subscribe: (rawInput, listener, signal) => {\n lifecycle.requestSignal(signal).throwIfAborted();\n const input = definitions[name]!.contract.input.parse(rawInput);\n const entry = { input, listener, resourceId: name };\n const watcherDisposers: RuntimeDisposer[] = [];\n invalidationListeners.add(entry);\n try {\n activateWatchers(name, rawInput, signal, new Set(), watcherDisposers);\n } catch (cause) {\n invalidationListeners.delete(entry);\n void lifecycle.disposeAll(watcherDisposers).catch(() => undefined);\n throw cause;\n }\n return lifecycle.track(async () => {\n invalidationListeners.delete(entry);\n await lifecycle.disposeAll(watcherDisposers);\n }, signal);\n },\n });\n });\n\n return {\n context,\n get: (name) => resources.get(name),\n invalidate,\n names: [...resources.keys()],\n };\n};\n","// Owns named stream registration and ordered, validated session messaging.\n// Session abort, failure, and disposal remain exactly-once across every close path.\n\nimport type {\n HandlerContext,\n StreamHandlerDefinition,\n} from \"../../../public/index\";\nimport { z } from \"zod\";\n\nimport type { RuntimeLifecycle } from \"./runtime-lifecycle\";\n\nexport type RuntimeStreamSession = {\n dispose: () => Promise<void>;\n send: (message: unknown) => Promise<void>;\n};\n\nexport type RuntimeStream = {\n open: (\n input: unknown,\n emit: (message: unknown) => void,\n signal?: AbortSignal,\n onError?: (cause: unknown) => void,\n ) => Promise<RuntimeStreamSession>;\n};\n\nexport type RuntimeStreams = {\n get: (name: string) => RuntimeStream | undefined;\n names: readonly string[];\n};\n\ntype AnyStream = StreamHandlerDefinition<\n z.ZodTypeAny,\n z.ZodTypeAny,\n z.ZodTypeAny\n>;\n\nexport type RuntimeStreamDefinitions = Readonly<Record<string, AnyStream>>;\n\ntype CreateRuntimeStreamsOptions = {\n context: (signal?: AbortSignal) => HandlerContext;\n definitions: RuntimeStreamDefinitions;\n lifecycle: RuntimeLifecycle;\n};\n\nexport const createRuntimeStreams = ({\n context,\n definitions,\n lifecycle,\n}: CreateRuntimeStreamsOptions): RuntimeStreams => {\n const streams = new Map<string, RuntimeStream>();\n Object.entries(definitions).forEach(([name, definition]) => {\n if (!name) {\n throw new Error(\"Stream names must not be empty\");\n }\n streams.set(name, {\n open: async (rawInput, emit, requestSignal, onError) => {\n const sessionController = new AbortController();\n const sessionSignal = requestSignal\n ? AbortSignal.any([requestSignal, sessionController.signal])\n : sessionController.signal;\n const operationSignal = lifecycle.requestSignal(sessionSignal);\n operationSignal.throwIfAborted();\n const input = definition.contract.input.parse(rawInput);\n let acceptingMessages = true;\n let failed = false;\n let failure: unknown;\n let opened = false;\n const fail = (cause: unknown) => {\n if (failed || operationSignal.aborted) {\n return;\n }\n failed = true;\n failure = cause;\n acceptingMessages = false;\n sessionController.abort(cause);\n if (opened) {\n onError?.(cause);\n }\n };\n const session = await definition.open(input, {\n ...context(sessionSignal),\n emit: (message) => {\n if (operationSignal.aborted) {\n return;\n }\n try {\n emit(definition.contract.serverMessage.parse(message));\n } catch (cause) {\n fail(cause);\n }\n },\n fail,\n signal: operationSignal,\n });\n opened = true;\n if (failed || operationSignal.aborted) {\n await session.dispose?.();\n operationSignal.throwIfAborted();\n throw failure;\n }\n let messages = Promise.resolve();\n const dispose = lifecycle.track(async () => {\n acceptingMessages = false;\n sessionController.abort(new Error(\"Stream session disposed\"));\n await messages.catch(() => undefined);\n await session.dispose?.();\n }, requestSignal);\n return {\n dispose: async () => dispose(),\n send: async (rawMessage) => {\n if (!acceptingMessages) {\n throw new Error(\"Stream session is closed\");\n }\n const message = definition.contract.clientMessage.parse(rawMessage);\n messages = messages.then(async () => {\n operationSignal.throwIfAborted();\n await session.onMessage?.(message);\n operationSignal.throwIfAborted();\n });\n return messages;\n },\n };\n },\n });\n });\n return {\n get: (name) => streams.get(name),\n names: [...streams.keys()],\n };\n};\n","// Composes one process-lifetime runtime from cohesive lifecycle and protocol components.\n\nimport type { RuntimeConfigDefinition } from \"@overmux/shared/node\";\n\nimport type { Notifications } from \"../../../public/index\";\nimport { protocolVersion, type RuntimeManifest } from \"../../shared/index\";\n\nimport { createRuntimeLifecycle } from \"./runtime-lifecycle\";\nimport {\n createRuntimeOperations,\n type RuntimeOperation,\n type RuntimeOperationDefinitions,\n} from \"./runtime-operations\";\nimport {\n createRuntimeResources,\n type RuntimeResource,\n type RuntimeResourceDefinitions,\n} from \"./runtime-resources\";\nimport {\n createRuntimeStreams,\n type RuntimeStream,\n type RuntimeStreamDefinitions,\n} from \"./runtime-streams\";\n\nexport type Runtime = {\n manifest: RuntimeManifest;\n dispose: () => Promise<void>;\n getOperation: (name: string) => RuntimeOperation | undefined;\n getResource: (name: string) => RuntimeResource | undefined;\n getStream: (name: string) => RuntimeStream | undefined;\n};\n\ntype CreateRuntimeOptions = {\n config: RuntimeConfigDefinition;\n debug?: boolean;\n notifications?: Notifications;\n signal?: AbortSignal;\n};\n\nexport const createRuntime = async ({\n config,\n debug = false,\n notifications = { send: async () => undefined },\n signal,\n}: CreateRuntimeOptions): Promise<Runtime> => {\n const lifecycle = createRuntimeLifecycle(signal);\n try {\n const resources = createRuntimeResources({\n definitions: (config.server.resources ??\n {}) as RuntimeResourceDefinitions,\n lifecycle,\n });\n const context = resources.context;\n const operations = createRuntimeOperations({\n context,\n definitions: (config.server.operations ??\n {}) as RuntimeOperationDefinitions,\n notifications,\n });\n const streams = createRuntimeStreams({\n context,\n definitions: (config.server.streams ?? {}) as RuntimeStreamDefinitions,\n lifecycle,\n });\n\n lifecycle.signal.throwIfAborted();\n lifecycle.completePreparation();\n\n const manifest: RuntimeManifest = {\n debug,\n operations: [...operations.names],\n protocolVersion,\n resources: [...resources.names],\n streams: [...streams.names],\n };\n return {\n manifest,\n dispose: lifecycle.dispose,\n getOperation: operations.get,\n getResource: resources.get,\n getStream: streams.get,\n };\n } catch (cause) {\n await lifecycle.dispose(cause).catch(() => undefined);\n throw cause;\n }\n};\n","import { loadOvermuxConfig } from \"@overmux/shared/node\";\nimport { dirname, isAbsolute, resolve } from \"node:path\";\nimport ts from \"typescript\";\nimport { ZodError } from \"zod\";\n\nimport { createRuntime } from \"./runtime/create-runtime\";\n\nexport type CheckDiagnostic = {\n code?: number | string;\n column?: number;\n file?: string;\n line?: number;\n message: string;\n path?: string;\n phase: \"config\" | \"imports\" | \"runtime\" | \"types\" | \"ui\";\n};\n\nexport type CheckResult = {\n operations?: number;\n config: string;\n diagnostics: CheckDiagnostic[];\n files: number;\n ok: boolean;\n};\n\nexport type CheckOvermuxOptions = {\n aliases?: Record<string, string>;\n configPath: string;\n typeAliases?: Record<string, string>;\n typesOnly?: boolean;\n};\n\nconst loadCompilerOptions = (configPath: string) => {\n const tsconfig = ts.findConfigFile(dirname(configPath), ts.sys.fileExists);\n if (!tsconfig) {\n return {\n allowImportingTsExtensions: true,\n allowJs: false,\n esModuleInterop: true,\n jsx: ts.JsxEmit.ReactJSX,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n noEmit: true,\n skipLibCheck: true,\n strict: true,\n target: ts.ScriptTarget.ES2022,\n } satisfies ts.CompilerOptions;\n }\n const loaded = ts.readConfigFile(tsconfig, ts.sys.readFile);\n if (loaded.error) {\n throw new Error(\n ts.flattenDiagnosticMessageText(loaded.error.messageText, \"\\n\"),\n );\n }\n const parsed = ts.parseJsonConfigFileContent(\n loaded.config,\n ts.sys,\n dirname(tsconfig),\n );\n return {\n ...parsed.options,\n allowImportingTsExtensions: true,\n noEmit: true,\n };\n};\n\nconst diagnosticOf = (diagnostic: ts.Diagnostic): CheckDiagnostic => {\n const position =\n diagnostic.file && diagnostic.start !== undefined\n ? diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start)\n : undefined;\n return {\n code: diagnostic.code,\n column: position ? position.character + 1 : undefined,\n file: diagnostic.file?.fileName,\n line: position ? position.line + 1 : undefined,\n message: ts.flattenDiagnosticMessageText(diagnostic.messageText, \"\\n\"),\n phase: \"types\",\n };\n};\n\nconst kindOf = (fileName: string, configPath: string) => {\n if (\n resolve(fileName) === resolve(configPath) ||\n fileName.match(/\\.server\\.[cm]?[jt]sx?$/)\n ) {\n return \"server\";\n }\n if (fileName.match(/\\.ui\\.[cm]?[jt]sx?$/)) {\n return \"client\";\n }\n if (fileName.match(/\\.shared\\.[cm]?[jt]sx?$/)) {\n return \"shared\";\n }\n return undefined;\n};\n\ntype ModuleKind = \"client\" | \"server\" | \"shared\";\n\ntype ResolvedImport = {\n kind?: ModuleKind;\n node: ts.ImportDeclaration | ts.ExportDeclaration;\n source?: ts.SourceFile;\n};\n\nconst kindOfSpecifier = (specifier: string): ModuleKind | undefined => {\n if (specifier === \"overmux/client\" || specifier.endsWith(\"/react\")) {\n return \"client\";\n }\n if (\n specifier === \"overmux/server\" ||\n specifier.endsWith(\"/server\") ||\n specifier.startsWith(\"node:\")\n ) {\n return \"server\";\n }\n if (specifier === \"overmux\" || specifier.endsWith(\"/shared\")) {\n return \"shared\";\n }\n return undefined;\n};\n\nconst isTypeOnlyReference = (\n node: ts.ImportDeclaration | ts.ExportDeclaration,\n) => {\n if (ts.isExportDeclaration(node)) {\n return Boolean(\n node.isTypeOnly ||\n (node.exportClause &&\n ts.isNamedExports(node.exportClause) &&\n node.exportClause.elements.every((element) => element.isTypeOnly)),\n );\n }\n const clause = node.importClause;\n if (!clause || clause.name) {\n return Boolean(clause?.isTypeOnly);\n }\n return Boolean(\n clause.isTypeOnly ||\n (clause.namedBindings &&\n ts.isNamedImports(clause.namedBindings) &&\n clause.namedBindings.elements.every((element) => element.isTypeOnly)),\n );\n};\n\nconst resolvedImports = (program: ts.Program, source: ts.SourceFile) => {\n const imports: ResolvedImport[] = [];\n source.forEachChild((node) => {\n if (\n (!ts.isImportDeclaration(node) && !ts.isExportDeclaration(node)) ||\n !node.moduleSpecifier ||\n !ts.isStringLiteral(node.moduleSpecifier) ||\n isTypeOnlyReference(node)\n ) {\n return;\n }\n const specifier = node.moduleSpecifier.text;\n const resolved = ts.resolveModuleName(\n specifier,\n source.fileName,\n program.getCompilerOptions(),\n ts.sys,\n ).resolvedModule?.resolvedFileName;\n const target = resolved ? program.getSourceFile(resolved) : undefined;\n const kind = kindOfSpecifier(specifier);\n if (kind || (target && !target.isDeclarationFile)) {\n imports.push({\n kind,\n node,\n source: target?.isDeclarationFile ? undefined : target,\n });\n }\n });\n return imports;\n};\n\nconst invalidImport = (source: ModuleKind, target: ModuleKind | undefined) =>\n (source === \"server\" && target === \"client\") ||\n (source === \"client\" && target === \"server\") ||\n (source === \"shared\" && target !== undefined && target !== \"shared\");\n\nconst visitImportGraph = ({\n configPath,\n diagnostics,\n kind,\n program,\n seen,\n source,\n}: {\n configPath: string;\n diagnostics: CheckDiagnostic[];\n kind: ModuleKind;\n program: ts.Program;\n seen: Set<string>;\n source: ts.SourceFile;\n}) => {\n const visitKey = `${kind}:${source.fileName}`;\n if (seen.has(visitKey)) {\n return;\n }\n seen.add(visitKey);\n resolvedImports(program, source).forEach(\n ({ kind: importKind, node, source: target }) => {\n const declaredKind =\n importKind ??\n (target ? kindOf(target.fileName, configPath) : undefined);\n if (invalidImport(kind, declaredKind)) {\n const position = source.getLineAndCharacterOfPosition(node.getStart());\n diagnostics.push({\n code: \"OVERMUX_IMPORT_BOUNDARY\",\n column: position.character + 1,\n file: source.fileName,\n line: position.line + 1,\n message: `${kind} modules may not import ${declaredKind} modules`,\n phase: \"imports\",\n });\n return;\n }\n if (target) {\n visitImportGraph({\n configPath,\n diagnostics,\n kind: declaredKind === \"shared\" ? \"shared\" : kind,\n program,\n seen,\n source: target,\n });\n }\n },\n );\n};\n\nconst importBoundaryDiagnostics = (\n program: ts.Program,\n configPath: string,\n): CheckDiagnostic[] => {\n const diagnostics: CheckDiagnostic[] = [];\n const seen = new Set<string>();\n program.getSourceFiles().forEach((source) => {\n const kind = kindOf(source.fileName, configPath);\n if (kind && !source.isDeclarationFile) {\n visitImportGraph({\n configPath,\n diagnostics,\n kind,\n program,\n seen,\n source,\n });\n }\n });\n return diagnostics;\n};\n\nconst runtimeDiagnostics = (cause: unknown): CheckDiagnostic[] => {\n if (cause instanceof ZodError) {\n return cause.issues.map((issue) => ({\n message: issue.message,\n path: issue.path.length ? issue.path.join(\".\") : undefined,\n phase: \"runtime\" as const,\n }));\n }\n return [\n {\n message: cause instanceof Error ? cause.message : String(cause),\n phase: \"runtime\",\n },\n ];\n};\n\nconst typecheck = async ({\n aliases = {},\n configPath,\n typeAliases,\n}: CheckOvermuxOptions) => {\n const options = loadCompilerOptions(configPath);\n const aliasesForTypes =\n typeAliases ??\n Object.fromEntries(\n Object.entries(aliases).filter(\n ([key]) => key === \"overmux\" || key.startsWith(\"overmux/\"),\n ),\n );\n const absoluteAliases = Object.fromEntries(\n Object.entries(aliasesForTypes).map(([key, value]) => [\n key,\n [isAbsolute(value) ? value : resolve(value)],\n ]),\n );\n const program = ts.createProgram({\n options: {\n ...options,\n baseUrl: options.baseUrl ?? \"/\",\n paths: { ...options.paths, ...absoluteAliases },\n },\n rootNames: [configPath],\n });\n const diagnostics = [\n ...ts.getPreEmitDiagnostics(program).map(diagnosticOf),\n ...importBoundaryDiagnostics(program, configPath),\n ];\n const files = program\n .getSourceFiles()\n .filter(\n (file) =>\n !file.isDeclarationFile && !file.fileName.includes(\"node_modules\"),\n ).length;\n return { diagnostics, files };\n};\n\nexport const checkOvermux = async (\n options: CheckOvermuxOptions,\n): Promise<CheckResult> => {\n const configPath = resolve(options.configPath);\n let checked;\n try {\n checked = await typecheck({ ...options, configPath });\n } catch (cause) {\n return {\n config: configPath,\n diagnostics: [\n {\n message: cause instanceof Error ? cause.message : String(cause),\n phase: \"config\",\n },\n ],\n files: 0,\n ok: false,\n };\n }\n if (checked.diagnostics.length || options.typesOnly) {\n return {\n config: configPath,\n diagnostics: checked.diagnostics,\n files: checked.files,\n ok: checked.diagnostics.length === 0,\n };\n }\n\n let runtime: Awaited<ReturnType<typeof createRuntime>> | undefined;\n try {\n const { config } = await loadOvermuxConfig({\n aliases: options.aliases,\n configPath,\n });\n runtime = await createRuntime({ config });\n return {\n operations: runtime.manifest.operations.length,\n config: configPath,\n diagnostics: [],\n files: checked.files,\n ok: true,\n };\n } catch (cause) {\n return {\n config: configPath,\n diagnostics: runtimeDiagnostics(cause),\n files: checked.files,\n ok: false,\n };\n } finally {\n await runtime?.dispose();\n }\n};\n","import { appendFileSync, mkdirSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { randomUUID } from \"node:crypto\";\n\nimport { getOvermuxPaths } from \"./paths\";\n\nexport type ServerLogLevel = \"debug\" | \"error\" | \"info\" | \"warn\";\n\nexport type ServerLogEntry = {\n // Groups related request, connection, and operation logs for diagnostics.\n correlationId?: string;\n details?: Record<string, unknown>;\n durationMs?: number;\n event: string;\n level?: ServerLogLevel;\n message?: string;\n source?: \"browser\" | \"server\";\n timestamp?: string;\n};\n\nexport type ServerLogger = {\n enabled: boolean;\n id: () => string;\n log: (entry: ServerLogEntry) => void;\n};\n\ntype ConfigurableServerLogger = ServerLogger & {\n setEnabled: (enabled: boolean) => void;\n setLogFile: (logFile: string) => void;\n};\n\nconst lifecycleEvents = new Set([\n \"server-start\",\n \"server-stop\",\n \"websocket-close\",\n \"websocket-close-event\",\n \"websocket-connect\",\n \"websocket-open\",\n]);\n\nexport const getDefaultServerLogFile = ({\n homeDir,\n xdgStateHome,\n}: {\n homeDir?: string;\n xdgStateHome?: string;\n} = {}) =>\n join(getOvermuxPaths({ homeDir, xdgStateHome }).stateDir, \"overmux.log\");\n\nconst safeJson = (value: unknown) => {\n try {\n return JSON.stringify(value);\n } catch {\n return JSON.stringify({\n event: \"log-serialization-error\",\n level: \"error\",\n source: \"server\",\n timestamp: new Date().toISOString(),\n });\n }\n};\n\nexport const createServerLogger = ({\n enabled,\n logFile = getDefaultServerLogFile(),\n}: {\n enabled: boolean;\n logFile?: string;\n}): ConfigurableServerLogger => {\n let activeLogFile = logFile;\n let debugEnabled = enabled;\n return {\n get enabled() {\n return debugEnabled;\n },\n id: randomUUID,\n log: (entry) => {\n if (\n !debugEnabled &&\n entry.level !== \"error\" &&\n !lifecycleEvents.has(entry.event)\n ) {\n return;\n }\n const record = safeJson({\n timestamp: entry.timestamp ?? new Date().toISOString(),\n level: entry.level ?? \"info\",\n source: entry.source ?? \"server\",\n ...entry,\n });\n mkdirSync(dirname(activeLogFile), { recursive: true });\n appendFileSync(activeLogFile, `${record}\\n`, \"utf8\");\n process.stderr.write(`[overmux:debug] ${record}\\n`);\n },\n setEnabled: (nextEnabled) => {\n debugEnabled = nextEnabled;\n },\n setLogFile: (nextLogFile) => {\n activeLogFile = nextLogFile;\n },\n };\n};\n\nexport const errorMessage = (cause: unknown) =>\n cause instanceof Error ? cause.message : String(cause);\n\nexport const errorDetails = (cause: unknown) => ({\n message: errorMessage(cause),\n ...(cause instanceof Error && cause.stack ? { stack: cause.stack } : {}),\n});\n","// Defines the complete validated IPC boundary between coordinator and child.\n// Application traffic never crosses this process boundary.\n\nimport { z } from \"zod\";\n\nconst childOptionsSchema = z.object({\n configAliases: z.record(z.string(), z.string()).optional(),\n configPath: z.string(),\n debug: z.boolean().optional(),\n developmentWebTarget: z.url().optional(),\n host: z.string().optional(),\n logFile: z.string().optional(),\n port: z.number().int().min(0).max(65_535).optional(),\n productionWebAssetsDir: z.string().optional(),\n watch: z.boolean().optional(),\n});\n\nconst parentMessageSchema = z.discriminatedUnion(\"type\", [\n z.object({ options: childOptionsSchema, type: z.literal(\"start\") }),\n z.object({ type: z.literal(\"update-available\") }),\n z.object({ type: z.literal(\"stop\") }),\n]);\n\nconst childMessageSchema = z.discriminatedUnion(\"type\", [\n z.object({\n host: z.string(),\n port: z.number().int().min(1).max(65_535),\n type: z.literal(\"ready\"),\n url: z.string(),\n watch: z.boolean(),\n }),\n z.object({ type: z.literal(\"restart-requested\") }),\n z.object({ message: z.string(), type: z.literal(\"startup-failed\") }),\n]);\n\nexport type ChildServerOptions = z.infer<typeof childOptionsSchema>;\nexport type ParentToChildMessage = z.infer<typeof parentMessageSchema>;\nexport type ChildToParentMessage = z.infer<typeof childMessageSchema>;\n\nexport const parseParentMessage = (value: unknown): ParentToChildMessage =>\n parentMessageSchema.parse(value);\n\nexport const parseChildMessage = (value: unknown): ChildToParentMessage =>\n childMessageSchema.parse(value);\n","// Owns the coordinator's broad recursive watch of the config directory.\n// Filtering and debounce keep update signaling independent of import analysis.\n\nimport { watch } from \"node:fs\";\nimport { dirname } from \"node:path\";\n\nexport type UpdateWatcher = {\n close: () => void;\n};\n\nexport const isRelevantUpdatePath = (path: string): boolean => {\n const segments = path.split(/[\\\\/]/);\n if (segments.some((segment) => segment.toLowerCase() === \"node_modules\")) {\n return false;\n }\n return /\\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts|json|css)$/i.test(path);\n};\n\nexport const startUpdateWatcher = ({\n configPath,\n onUpdate,\n}: {\n configPath: string;\n onUpdate: () => void;\n}): UpdateWatcher => {\n let closed = false;\n let timeout: NodeJS.Timeout | undefined;\n const watcher = watch(\n dirname(configPath),\n { recursive: true },\n (_event, fileName) => {\n if (closed || !fileName || !isRelevantUpdatePath(fileName.toString())) {\n return;\n }\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(onUpdate, 100);\n },\n );\n\n return {\n close: () => {\n if (closed) {\n return;\n }\n closed = true;\n if (timeout) {\n clearTimeout(timeout);\n }\n watcher.close();\n },\n };\n};\n","// Supervises one disposable application child and the parent-owned update watcher.\n// The coordinator retains only lifecycle state and the stable startup address.\n\nimport { fork, type ChildProcess } from \"node:child_process\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { errorMessage } from \"../server-logger\";\nimport type {\n OvermuxServer,\n OvermuxServerOptions,\n} from \"../start-overmux-server\";\nimport {\n parseChildMessage,\n type ChildServerOptions,\n type ParentToChildMessage,\n} from \"./ipc-protocol\";\nimport { startUpdateWatcher, type UpdateWatcher } from \"./update-watcher\";\n\ntype ChildInstance = {\n process: ChildProcess;\n host: string;\n port: number;\n url: string;\n watch: boolean;\n};\n\nconst send = (\n child: ChildProcess,\n message: ParentToChildMessage,\n onError?: (cause: Error) => void,\n) => {\n if (!child.connected) {\n onError?.(new Error(\"Server child IPC channel is closed\"));\n return;\n }\n try {\n child.send(message, (cause) => {\n if (cause) {\n onError?.(cause);\n }\n });\n } catch (cause) {\n onError?.(cause instanceof Error ? cause : new Error(String(cause)));\n }\n};\n\nconst stopChild = (child: ChildProcess): Promise<void> =>\n new Promise((resolve) => {\n let timeout: NodeJS.Timeout | undefined;\n const finish = () => {\n child.off(\"exit\", finish);\n clearTimeout(timeout);\n resolve();\n };\n child.once(\"exit\", finish);\n if (child.exitCode !== null || child.signalCode !== null) {\n finish();\n return;\n }\n timeout = setTimeout(() => {\n if (!child.kill(\"SIGKILL\")) {\n finish();\n }\n }, 5_000);\n send(child, { type: \"stop\" });\n });\n\nconst serverChildPath = () =>\n fileURLToPath(import.meta.resolve(\"#server-child\"));\n\nconst startChild = (\n options: ChildServerOptions,\n onRestartRequested: () => void,\n): Promise<ChildInstance> =>\n new Promise((resolve, reject) => {\n const child = fork(serverChildPath(), [], {\n serialization: \"json\",\n stdio: [\"inherit\", \"inherit\", \"inherit\", \"ipc\"],\n });\n let settled = false;\n const fail = (cause: unknown) => {\n if (settled) {\n return;\n }\n settled = true;\n if (child.exitCode === null && child.signalCode === null) {\n child.kill();\n }\n reject(cause instanceof Error ? cause : new Error(String(cause)));\n };\n child.on(\"error\", fail);\n child.on(\"exit\", (code, signal) => {\n fail(\n new Error(\n `Server child exited before readiness (${signal ?? code ?? \"unknown\"})`,\n ),\n );\n });\n child.on(\"message\", (raw) => {\n let message;\n try {\n message = parseChildMessage(raw);\n } catch (cause) {\n fail(cause);\n return;\n }\n if (message.type === \"restart-requested\") {\n if (settled) {\n onRestartRequested();\n }\n return;\n }\n if (message.type === \"startup-failed\") {\n fail(new Error(message.message));\n return;\n }\n if (!settled) {\n settled = true;\n resolve({\n host: message.host,\n port: message.port,\n process: child,\n url: message.url,\n watch: message.watch,\n });\n }\n });\n send(child, { options, type: \"start\" }, fail);\n });\n\nexport const startServerCoordinator = async (\n initialOptions: OvermuxServerOptions,\n): Promise<OvermuxServer> => {\n let child: ChildInstance | undefined;\n let closed = false;\n let closePromise: Promise<void> | undefined;\n let restartPromise: Promise<void> | undefined;\n let updateDuringRestart = false;\n let startupAddress: { host: string; port: number } | undefined;\n let watcher: UpdateWatcher | undefined;\n\n const adoptChild = (next: ChildInstance) => {\n child = next;\n next.process.once(\"exit\", () => {\n if (child?.process === next.process) {\n child = undefined;\n }\n });\n };\n\n const restart = () => {\n if (closed || restartPromise) {\n return restartPromise ?? Promise.resolve();\n }\n restartPromise = (async () => {\n const previous = child;\n child = undefined;\n if (previous) {\n await stopChild(previous.process);\n }\n if (closed || !startupAddress) {\n return;\n }\n try {\n const replacement = await startChild(\n {\n ...initialOptions,\n host: startupAddress.host,\n port: startupAddress.port,\n },\n () => void restart(),\n );\n if (closed) {\n await stopChild(replacement.process);\n return;\n }\n adoptChild(replacement);\n if (updateDuringRestart) {\n updateDuringRestart = false;\n send(replacement.process, { type: \"update-available\" });\n }\n } catch (cause) {\n process.stderr.write(\n `[overmux] replacement child failed: ${errorMessage(cause)}\\n`,\n );\n }\n })().finally(() => {\n const shouldRetry = updateDuringRestart && !child && !closed;\n updateDuringRestart = false;\n restartPromise = undefined;\n if (shouldRetry) {\n void restart();\n }\n });\n return restartPromise;\n };\n\n const onUpdate = () => {\n if (closed) {\n return;\n }\n if (restartPromise) {\n updateDuringRestart = true;\n return;\n }\n if (child) {\n send(child.process, { type: \"update-available\" });\n return;\n }\n void restart();\n };\n\n const initial = await startChild(initialOptions, () => void restart());\n startupAddress = { host: initial.host, port: initial.port };\n adoptChild(initial);\n try {\n if (initial.watch) {\n watcher = startUpdateWatcher({\n configPath: initialOptions.configPath,\n onUpdate,\n });\n }\n } catch (cause) {\n await stopChild(initial.process);\n throw cause;\n }\n\n const close = () => {\n if (closePromise) {\n return closePromise;\n }\n closed = true;\n closePromise = (async () => {\n process.off(\"SIGINT\", onSignal);\n process.off(\"SIGTERM\", onSignal);\n watcher?.close();\n const active = child;\n child = undefined;\n if (active) {\n await stopChild(active.process);\n }\n await restartPromise;\n })();\n return closePromise;\n };\n const onSignal = () => {\n void close().catch((cause: unknown) => {\n process.stderr.write(\n `[overmux] coordinator shutdown failed: ${errorMessage(cause)}\\n`,\n );\n });\n };\n process.once(\"SIGINT\", onSignal);\n process.once(\"SIGTERM\", onSignal);\n\n return {\n announceUpdateAvailable: onUpdate,\n close,\n port: initial.port,\n url: initial.url,\n };\n};\n","import type { ServerConfigDefinition } from \"../../public/index\";\nimport { resolve } from \"node:path\";\n\nimport { startServerCoordinator } from \"./coordinator/server-coordinator\";\n\nexport type OvermuxServerOptions = ServerConfigDefinition & {\n configAliases?: Record<string, string>;\n debug?: boolean;\n developmentWebTarget?: string;\n configPath: string;\n};\n\nexport type OvermuxServer = {\n announceUpdateAvailable: () => void;\n close: () => Promise<void>;\n port: number;\n url: string;\n};\n\nexport const startOvermuxServer = async (\n options: OvermuxServerOptions,\n): Promise<OvermuxServer> =>\n startServerCoordinator({\n ...options,\n configPath: resolve(options.configPath),\n });\n"],"mappings":";;;;;;;;;;;;AAOA,MAAM,kBAAkB;AACxB,MAAM,qBAAqB;CAC1B,GAAG,OAAO,KAAK;CACf,GAAG,OAAO;CACV,GAAG,KAAK;CACR,IAAI;CACJ,GAAG;AACJ;AACA,MAAM,0BAA0B,aAAa;CAC5C,MAAM,QAAQ,gBAAgB,KAAK,QAAQ;CAC3C,IAAI,CAAC,OAAO;CACZ,MAAM,OAAO,MAAM;CACnB,MAAM,eAAe,OAAO,MAAM,EAAE,IAAI,mBAAmB;CAC3D,OAAO,OAAO,cAAc,YAAY,IAAI,eAAe,KAAK;AACjE;AACA,MAAM,oBAAoB,CAAC,kBAAkB,4BAA4B;AAGzE,MAAM,gBAAgB,EAAE,QAAQ,UAAU,iBAAiB,EAAE,SAAS,uBAAuB;AAC7F,MAAM,iBAAiB,EAAE,QAAQ,UAAU,OAAO,UAAU,YAAY,qBAAqB;AAC7F,MAAM,wBAAwB,EAAE,OAAO;CACtC,OAAO;CACP,QAAQ;AACT,CAAC;AACD,MAAM,yBAAyB,EAAE,OAAO;CACvC,QAAQ;CACR,OAAO;CACP,QAAQ;AACT,CAAC;AACD,MAAM,6BAA6B,EAAE,OAAO;CAC3C,UAAU,EAAE,OAA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ACT;CAEA,MAAM,iBAAiB;EACrB,IAAI,QACF;EAEF,IAAI,gBAAgB;GAClB,sBAAsB;GACtB;EACF;EACA,IAAI,OAAO;GACT,KAAK,MAAM,SAAS,EAAE,MAAM,mBAAmB,CAAC;GAChD;EACF;EACA,QAAa;CACf;CAEA,MAAM,UAAU,MAAM,WAAW,sBAAsB,KAAK,QAAQ,CAAC;CACrE,iBAAiB;EAAE,MAAM,QAAQ;EAAM,MAAM,QAAQ;CAAK;CAC1D,WAAW,OAAO;CAClB,IAAI;EACF,IAAI,QAAQ,OACV,UAAU,mBAAmB;GAC3B,YAAY,eAAe;GAC3B;EACF,CAAC;CAEL,SAAS,OAAO;EACd,MAAM,UAAU,QAAQ,OAAO;EAC/B,MAAM;CACR;CAEA,MAAM,cAAc;EAClB,IAAI,cACF,OAAO;EAET,SAAS;EACT,gBAAgB,YAAY;GAC1B,QAAQ,IAAI,UAAU,QAAQ;GAC9B,QAAQ,IAAI,WAAW,QAAQ;GAC/B,SAAS,MAAM;GACf,MAAM,SAAS;GACf,QAAQ,KAAA;GACR,IAAI,QACF,MAAM,UAAU,OAAO,OAAO;GAEhC,MAAM;EACR,EAAA,CAAG;EACH,OAAO;CACT;CACA,MAAM,iBAAiB;EACrB,MAAW,CAAC,CAAC,OAAO,UAAmB;GACrC,QAAQ,OAAO,MACb,0CAA0C,aAAa,KAAK,EAAE,GAChE;EACF,CAAC;CACH;CACA,QAAQ,KAAK,UAAU,QAAQ;CAC/B,QAAQ,KAAK,WAAW,QAAQ;CAEhC,OAAO;EACL,yBAAyB;EACzB;EACA,MAAM,QAAQ;EACd,KAAK,QAAQ;CACf;AACF;;;AClPA,MAAa,qBAAqB,OAChC,YAEA,uBAAuB;CACrB,GAAG;CACH,YAAY,QAAQ,QAAQ,UAAU;AACxC,CAAC"}
|
|
1
|
+
{"version":3,"file":"server.js","names":["instanceIdSchema"],"sources":["../../../shared/dist/node/index.js","../../src/internal/shared/background-notifications.ts","../../../shared/dist/index.js","../../src/internal/shared/protocol.ts","../../src/internal/server/runtime/runtime-instance.ts","../../src/internal/server/runtime/runtime-lifecycle.ts","../../src/internal/server/runtime/runtime-operations.ts","../../src/public/ai-context.ts","../../src/public/contracts.ts","../../src/internal/server/runtime/resource-dependency-graph.ts","../../src/internal/server/runtime/runtime-resources.ts","../../src/internal/server/runtime/runtime-streams.ts","../../src/internal/server/runtime/create-runtime.ts","../../src/internal/server/check-overmux.ts","../../src/internal/server/server-logger.ts","../../src/internal/server/coordinator/ipc-protocol.ts","../../src/internal/server/coordinator/update-watcher.ts","../../src/internal/server/coordinator/server-coordinator.ts","../../src/internal/server/start-overmux-server.ts"],"sourcesContent":["import { realpath } from \"node:fs/promises\";\nimport { isIP } from \"node:net\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { createJiti } from \"jiti\";\nimport { z } from \"zod\";\nimport { homedir } from \"node:os\";\n//#region ../lib/dist/index.js\nconst durationPattern = /^([1-9]\\d*)(ms|s|m|h|d)$/;\nconst millisecondsByUnit = {\n\td: 1440 * 60 * 1e3,\n\th: 3600 * 1e3,\n\tm: 60 * 1e3,\n\tms: 1,\n\ts: 1e3\n};\nconst durationToMilliseconds = (duration) => {\n\tconst match = durationPattern.exec(duration);\n\tif (!match) return;\n\tconst unit = match[2];\n\tconst milliseconds = Number(match[1]) * millisecondsByUnit[unit];\n\treturn Number.isSafeInteger(milliseconds) ? milliseconds : void 0;\n};\nconst aiContextSnippets = [\"package-source\", \"tech-stack-recommendations\"];\n//#endregion\n//#region src/instance.ts\nconst instanceIdSchema = z.string().max(253).regex(/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?![\\s\\S])/, \"Expected a lowercase instance ID with only ASCII letters, digits, internal dots and hyphens\");\n//#endregion\n//#region src/node/config.ts\nconst zodTypeSchema = z.custom((value) => value instanceof z.ZodType, \"Expected a Zod schema\");\nconst functionSchema = z.custom((value) => typeof value === \"function\", \"Expected a function\");\nconst contractRuntimeSchema = z.object({\n\tinput: zodTypeSchema,\n\toutput: zodTypeSchema\n});\nconst operationRuntimeSchema = z.object({\n\thandle: functionSchema,\n\tinput: zodTypeSchema,\n\toutput: zodTypeSchema\n});\nconst streamHandlerRuntimeSchema = z.object({\n\tcontract: z.object({\n\t\tclientMessage: zodTypeSchema,\n\t\tinput: zodTypeSchema,\n\t\tserverMessage: zodTypeSchema\n\t}),\n\topen: functionSchema\n});\nconst resourceDefinitionRuntimeSchema = z.discriminatedUnion(\"kind\", [\n\tz.object({\n\t\tcontract: contractRuntimeSchema,\n\t\tkind: z.literal(\"query\"),\n\t\tread: functionSchema\n\t}),\n\tz.object({\n\t\tcontract: contractRuntimeSchema,\n\t\tkind: z.literal(\"subscription\"),\n\t\tread: functionSchema,\n\t\tsubscribe: functionSchema\n\t}),\n\tz.object({\n\t\tcombine: functionSchema,\n\t\tcontract: contractRuntimeSchema,\n\t\tdependencies: z.record(z.string(), z.string()),\n\t\tkind: z.literal(\"derived\")\n\t})\n]);\nconst authDurationSchema = z.string().regex(/^[1-9]\\d*[mhd]$/, \"Expected a positive duration such as 30d\").refine((value) => durationToMilliseconds(value) !== void 0, \"Duration is too large\");\nconst isLoopbackHostname = (hostname) => hostname === \"localhost\" || hostname === \"[::1]\" || /^127(?:\\.\\d{1,3}){3}$/.test(hostname);\nconst exactOriginSchema = z.url().refine((value) => new URL(value).origin === value, \"Expected an origin\").refine((value) => {\n\tconst url = new URL(value);\n\treturn url.protocol === \"https:\" || url.protocol === \"http:\" && isLoopbackHostname(url.hostname);\n}, \"Non-loopback Overmux origins must use HTTPS\");\nconst loopbackPeerSchema = z.string().refine((value) => isIP(value) !== 0 && (value === \"::1\" || value.startsWith(\"127.\")), \"Expected a loopback IP address\");\nconst authConfigRuntimeSchema = z.object({\n\tmode: z.literal(\"cli-login\"),\n\torigins: z.array(exactOriginSchema).min(1).refine((origins) => new Set(origins).size === origins.length, \"Expected unique origins\").optional(),\n\tsessionLifetime: z.union([z.literal(\"never\"), authDurationSchema]).default(\"never\"),\n\ttrustedProxyPeer: loopbackPeerSchema.optional()\n}).strict();\nconst serverConfigRuntimeSchema = z.object({\n\thost: z.string().min(1).optional(),\n\tlogFile: z.string().min(1).optional(),\n\tport: z.number().int().min(1).max(65535).optional(),\n\tproductionWebAssetsDir: z.string().min(1).optional(),\n\twatch: z.boolean().optional()\n});\nconst serverDefinitionRuntimeSchema = z.object({\n\toperations: z.record(z.string(), operationRuntimeSchema).optional(),\n\tresources: z.record(z.string(), resourceDefinitionRuntimeSchema),\n\tstreams: z.record(z.string(), streamHandlerRuntimeSchema).optional()\n});\nconst configDefinitionRuntimeSchema = serverConfigRuntimeSchema.extend({\n\taiContextSnippets: z.array(z.enum(aiContextSnippets)).optional(),\n\tauth: authConfigRuntimeSchema,\n\tdebug: z.boolean().optional(),\n\tinstanceId: z.union([instanceIdSchema, z.custom((value) => typeof value === \"function\", \"Expected an instance ID or a function of the bound port\")]).optional(),\n\tserver: serverDefinitionRuntimeSchema,\n\tvite: z.string().min(1).optional()\n});\nconst resolveLogicalPath = async (path) => {\n\tconst logicalPath = resolve(path);\n\treturn {\n\t\tlogicalPath,\n\t\trealPath: await realpath(logicalPath)\n\t};\n};\nconst resolveOvermuxConfigPaths = async (configPath) => {\n\tconst { logicalPath, realPath } = await resolveLogicalPath(configPath);\n\treturn {\n\t\tlogicalApplicationRoot: dirname(logicalPath),\n\t\tlogicalConfigPath: logicalPath,\n\t\trealApplicationRoot: dirname(realPath),\n\t\trealConfigPath: realPath\n\t};\n};\nconst unwrapDefaultExport = (module) => {\n\tif (typeof module === \"object\" && module !== null && \"default\" in module) return module.default;\n\treturn module;\n};\nconst loadOvermuxConfig = async ({ aliases = {}, configPath }) => {\n\tconst paths = await resolveOvermuxConfigPaths(configPath);\n\tconst module = await createJiti(paths.logicalConfigPath, {\n\t\talias: aliases,\n\t\tfsCache: true,\n\t\tjsx: {\n\t\t\timportSource: \"react\",\n\t\t\truntime: \"automatic\"\n\t\t},\n\t\tmoduleCache: false,\n\t\tsourceMaps: true,\n\t\ttsconfigPaths: true\n\t}).import(paths.logicalConfigPath);\n\treturn {\n\t\tconfig: configDefinitionRuntimeSchema.parse(unwrapDefaultExport(module)),\n\t\tpaths\n\t};\n};\n//#endregion\n//#region src/node/paths.ts\nconst xdgDirectory = (configured, fallback) => configured && isAbsolute(configured) ? configured : fallback;\nconst overmuxDirectory = (root) => join(root, \"overmux\");\nconst getOvermuxPaths = ({ environment = process.env, homeDir = homedir(), xdgCacheHome = environment.XDG_CACHE_HOME, xdgConfigHome = environment.XDG_CONFIG_HOME, xdgDataHome = environment.XDG_DATA_HOME, xdgRuntimeDir = environment.XDG_RUNTIME_DIR, xdgStateHome = environment.XDG_STATE_HOME } = {}) => {\n\tif (!isAbsolute(homeDir)) throw new TypeError(\"The home directory must be absolute.\");\n\tconst runtimeDir = xdgRuntimeDir && isAbsolute(xdgRuntimeDir) ? overmuxDirectory(xdgRuntimeDir) : void 0;\n\treturn {\n\t\tcacheDir: overmuxDirectory(xdgDirectory(xdgCacheHome, join(homeDir, \".cache\"))),\n\t\tconfigDir: overmuxDirectory(xdgDirectory(xdgConfigHome, join(homeDir, \".config\"))),\n\t\tdataDir: overmuxDirectory(xdgDirectory(xdgDataHome, join(homeDir, \".local\", \"share\"))),\n\t\t...runtimeDir ? { runtimeDir } : {},\n\t\tstateDir: overmuxDirectory(xdgDirectory(xdgStateHome, join(homeDir, \".local\", \"state\")))\n\t};\n};\n//#endregion\nexport { authConfigRuntimeSchema, authDurationSchema, configDefinitionRuntimeSchema, getOvermuxPaths, loadOvermuxConfig, resolveLogicalPath, resolveOvermuxConfigPaths, serverConfigRuntimeSchema, serverDefinitionRuntimeSchema };\n\n//# sourceMappingURL=index.js.map","// Validates browser subscription data exchanged by background-notification delivery.\n// Browser-standard key and endpoint details stay behind this internal boundary.\nimport { z } from \"zod\";\n\nconst deliveryKeySchema = z\n .string()\n .min(1)\n .max(1_024)\n .regex(/^[\\w-]+$/u);\n\nexport const backgroundNotificationSubscriptionSchema = z\n .object({\n endpoint: z\n .url()\n .max(4_096)\n .refine((endpoint) => {\n const url = new URL(endpoint);\n return url.protocol === \"https:\" && !url.username && !url.password;\n }),\n expirationTime: z.number().int().nonnegative().nullable(),\n keys: z\n .object({ auth: deliveryKeySchema, p256dh: deliveryKeySchema })\n .strict(),\n })\n .strict();\n\nexport const backgroundNotificationPublicKeyResponseSchema = z\n .object({ publicKey: deliveryKeySchema })\n .strict();\n\nexport const backgroundNotificationDisableRequestSchema = z\n .object({ endpoint: backgroundNotificationSubscriptionSchema.shape.endpoint })\n .strict();\n\nexport type BackgroundNotificationSubscription = z.infer<\n typeof backgroundNotificationSubscriptionSchema\n>;\n","import { z } from \"zod\";\n//#region src/ai-context.ts\nconst packageSourceSnippet = \"package-source\";\nconst techStackRecommendationsSnippet = \"tech-stack-recommendations\";\nconst aiContextSnippets = [packageSourceSnippet, techStackRecommendationsSnippet];\n//#endregion\n//#region src/hosted-routes.ts\nconst overmuxSettingsPath = \"/_overmux/settings\";\nconst overmuxLogoutPath = \"/_overmux/logout\";\nconst reservedPathPrefixes = [\n\t\"/_overmux\",\n\t\"/api\",\n\t\"/login\"\n];\nconst returnToBase = \"https://overmux.invalid\";\nconst isReservedPath = (pathname) => reservedPathPrefixes.some((prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`));\nconst resolveOvermuxReturnTo = (candidate) => {\n\tif (!candidate?.startsWith(\"/\") || candidate.startsWith(\"//\")) return \"/\";\n\ttry {\n\t\tconst url = new URL(candidate, returnToBase);\n\t\tconst decodedPathname = decodeURIComponent(url.pathname);\n\t\tif (url.origin !== returnToBase || isReservedPath(decodedPathname)) return \"/\";\n\t\treturn `${url.pathname}${url.search}${url.hash}`;\n\t} catch {\n\t\treturn \"/\";\n\t}\n};\nconst createOvermuxSettingsPath = (returnTo) => {\n\tconst safeReturnTo = resolveOvermuxReturnTo(returnTo);\n\tif (safeReturnTo === \"/\") return overmuxSettingsPath;\n\tconst search = new URLSearchParams({ returnTo: safeReturnTo });\n\treturn `${overmuxSettingsPath}?${search.toString()}`;\n};\n//#endregion\n//#region src/notifications.ts\nconst safeRelativeNotificationLink = (link) => {\n\tlet decoded;\n\ttry {\n\t\tdecoded = decodeURIComponent(link);\n\t} catch {\n\t\treturn false;\n\t}\n\treturn !decoded.startsWith(\"//\") && !decoded.includes(\"\\\\\") && ![...decoded].some((character) => {\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\t\treturn codePoint < 32 || codePoint === 127;\n\t});\n};\nconst notificationLinkSchema = z.union([z.string().max(4096).startsWith(\"/\").refine(safeRelativeNotificationLink), z.string().max(4096).url().refine((link) => {\n\tif (!URL.canParse(link)) return false;\n\tconst url = new URL(link);\n\treturn [\"http:\", \"https:\"].includes(url.protocol) && !url.username && !url.password;\n})]);\nconst notificationSchema = z.object({\n\tbody: z.string().max(4096).optional(),\n\topen: z.object({ link: notificationLinkSchema }).strict().optional(),\n\ttitle: z.string().min(1).max(4096)\n}).strict();\n//#endregion\n//#region src/instance.ts\nconst instanceIdSchema = z.string().max(253).regex(/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?![\\s\\S])/, \"Expected a lowercase instance ID with only ASCII letters, digits, internal dots and hyphens\");\nconst createInstanceIdentity = (instanceId) => ({\n\tinstanceId: instanceIdSchema.parse(instanceId),\n\tdeepLinkPrefix: `overmux://${instanceId}`\n});\n//#endregion\nexport { aiContextSnippets, createInstanceIdentity, createOvermuxSettingsPath, instanceIdSchema, notificationLinkSchema, notificationSchema, overmuxLogoutPath, overmuxSettingsPath, packageSourceSnippet, resolveOvermuxReturnTo, techStackRecommendationsSnippet };\n\n//# sourceMappingURL=index.js.map","import { z } from \"zod\";\nimport { instanceIdSchema } from \"@overmux/shared\";\n\nimport { notificationSchema } from \"../../public/notifications\";\n\n// Compatibility gate, not negotiation: open tabs may still run older client assets.\n// The exact version rejects incompatible runtime manifest and wire formats before later traffic.\nexport const protocolVersion = 10 as const;\n\n// Application-defined WebSocket close codes shared by server and browser transports.\nexport const webSocketCloseCode = {\n authenticationRevoked: 4001,\n authenticationUnavailable: 4002,\n} as const;\n\nexport const runtimeManifestSchema = z.object({\n debug: z.boolean(),\n operations: z.array(z.string().min(1)),\n protocolVersion: z.literal(protocolVersion),\n resources: z.array(z.string().min(1)),\n streams: z.array(z.string().min(1)),\n});\n\nexport const updateAvailableEventSchema = z.object({\n type: z.literal(\"update-available\"),\n});\n\nexport const restartingEventSchema = z.object({\n type: z.literal(\"restarting\"),\n});\n\nexport const serverLifecycleEventSchema = z.discriminatedUnion(\"type\", [\n updateAvailableEventSchema,\n restartingEventSchema,\n]);\n\nexport const notificationEventSchema = z\n .object({\n notification: notificationSchema,\n type: z.literal(\"notification\"),\n })\n .strict();\n\nconst operationIdSchema = z.string().min(1).max(256);\nconst registrationNameSchema = z.string().min(1).max(256);\n\nexport const resourceReadMessageSchema = z.object({\n input: z.unknown().optional(),\n operationId: operationIdSchema,\n resourceName: registrationNameSchema,\n type: z.literal(\"resource-read\"),\n});\n\nexport const resourceSubscribeMessageSchema = z.object({\n input: z.unknown().optional(),\n operationId: operationIdSchema,\n resourceName: registrationNameSchema,\n subscriptionId: operationIdSchema,\n type: z.literal(\"resource-subscribe\"),\n});\n\nexport const resourceUnsubscribeMessageSchema = z.object({\n subscriptionId: operationIdSchema,\n type: z.literal(\"resource-unsubscribe\"),\n});\n\nexport const streamOpenMessageSchema = z.object({\n input: z.unknown().optional(),\n operationId: operationIdSchema,\n streamId: operationIdSchema,\n streamName: registrationNameSchema,\n type: z.literal(\"stream-open\"),\n});\n\nexport const streamMessageSchema = z.object({\n message: z.unknown(),\n streamId: operationIdSchema,\n type: z.literal(\"stream-message\"),\n});\n\nexport const streamCloseMessageSchema = z.object({\n streamId: operationIdSchema,\n type: z.literal(\"stream-close\"),\n});\n\nexport const clientDiagnosticEventSchema = z.object({\n arguments: z.string().max(16_100),\n level: z.enum([\"log\", \"info\", \"warn\", \"error\", \"debug\"]),\n message: z.string().max(4_100),\n stack: z.string().max(8_100).optional(),\n timestamp: z.iso.datetime(),\n type: z.literal(\"client-diagnostic\"),\n url: z.string().max(2_100).optional(),\n});\n\nexport const clientProtocolMessageSchema = z.discriminatedUnion(\"type\", [\n resourceReadMessageSchema,\n resourceSubscribeMessageSchema,\n resourceUnsubscribeMessageSchema,\n streamOpenMessageSchema,\n streamMessageSchema,\n streamCloseMessageSchema,\n clientDiagnosticEventSchema,\n]);\n\nexport const resourceResultMessageSchema = z.object({\n operationId: operationIdSchema,\n output: z.unknown(),\n type: z.literal(\"resource-result\"),\n});\n\nexport const resourceInvalidatedMessageSchema = z.object({\n subscriptionId: operationIdSchema,\n type: z.literal(\"resource-invalidated\"),\n});\n\nexport const streamOpenedMessageSchema = z.object({\n operationId: operationIdSchema,\n streamId: operationIdSchema,\n type: z.literal(\"stream-opened\"),\n});\n\nexport const streamOutputMessageSchema = z.object({\n message: z.unknown(),\n streamId: operationIdSchema,\n type: z.literal(\"stream-output\"),\n});\n\nexport const streamClosedMessageSchema = z.object({\n streamId: operationIdSchema,\n type: z.literal(\"stream-closed\"),\n});\n\nexport const protocolErrorMessageSchema = z.object({\n code: z.enum([\"bad-request\", \"conflict\", \"internal\", \"not-found\"]),\n message: z.string(),\n operationId: operationIdSchema.optional(),\n streamId: operationIdSchema.optional(),\n subscriptionId: operationIdSchema.optional(),\n type: z.literal(\"error\"),\n});\n\nexport const serverInfoMessageSchema = z\n .object({\n type: z.literal(\"server-info\"),\n instanceId: instanceIdSchema,\n })\n .strict();\n\nexport const serverProtocolMessageSchema = z.discriminatedUnion(\"type\", [\n serverInfoMessageSchema,\n resourceResultMessageSchema,\n resourceInvalidatedMessageSchema,\n streamOpenedMessageSchema,\n streamOutputMessageSchema,\n streamClosedMessageSchema,\n protocolErrorMessageSchema,\n updateAvailableEventSchema,\n restartingEventSchema,\n notificationEventSchema,\n]);\n\nconst byteMarker = \"$overmuxBytes\";\n\ntype EncodedBytes = { [byteMarker]: number[] };\n\nconst encodeValue = (value: unknown): unknown => {\n if (value instanceof Uint8Array) {\n return { [byteMarker]: Array.from(value) } satisfies EncodedBytes;\n }\n if (Array.isArray(value)) {\n return value.map(encodeValue);\n }\n if (typeof value === \"object\" && value !== null) {\n return Object.fromEntries(\n Object.entries(value).map(([key, item]) => [key, encodeValue(item)]),\n );\n }\n return value;\n};\n\nconst decodeValue = (value: unknown): unknown => {\n if (Array.isArray(value)) {\n return value.map(decodeValue);\n }\n if (typeof value !== \"object\" || value === null) {\n return value;\n }\n const record = value as Record<string, unknown>;\n if (\n Object.keys(record).length === 1 &&\n Array.isArray(record[byteMarker]) &&\n record[byteMarker].every(\n (item) => Number.isInteger(item) && item >= 0 && item <= 255,\n )\n ) {\n return Uint8Array.from(record[byteMarker] as number[]);\n }\n return Object.fromEntries(\n Object.entries(record).map(([key, item]) => [key, decodeValue(item)]),\n );\n};\n\nconst binaryMarker = \"$overmuxBinary\";\nconst binaryMagic = 0x4f4d5801;\n\ntype EncodedBinary = { [binaryMarker]: [number, number] };\n\nconst encodeBinaryValue = (\n value: unknown,\n payloads: Uint8Array[],\n offset: { value: number },\n): unknown => {\n if (value instanceof Uint8Array) {\n const marker = {\n [binaryMarker]: [offset.value, value.byteLength],\n } satisfies EncodedBinary;\n payloads.push(value);\n offset.value += value.byteLength;\n return marker;\n }\n if (Array.isArray(value)) {\n return value.map((item) => encodeBinaryValue(item, payloads, offset));\n }\n if (typeof value === \"object\" && value !== null) {\n return Object.fromEntries(\n Object.entries(value).map(([key, item]) => [\n key,\n encodeBinaryValue(item, payloads, offset),\n ]),\n );\n }\n return value;\n};\n\nconst decodeBinaryValue = (value: unknown, payload: Uint8Array): unknown => {\n if (Array.isArray(value)) {\n return value.map((item) => decodeBinaryValue(item, payload));\n }\n if (typeof value !== \"object\" || value === null) {\n return value;\n }\n const record = value as Record<string, unknown>;\n const marker = record[binaryMarker];\n if (\n Object.keys(record).length === 1 &&\n Array.isArray(marker) &&\n marker.length === 2 &&\n marker.every((item) => Number.isInteger(item) && item >= 0)\n ) {\n const [offset, length] = marker as [number, number];\n if (offset + length > payload.byteLength) {\n throw new Error(\"Invalid Overmux binary payload range\");\n }\n return payload.slice(offset, offset + length);\n }\n return Object.fromEntries(\n Object.entries(record).map(([key, item]) => [\n key,\n decodeBinaryValue(item, payload),\n ]),\n );\n};\n\nexport const encodeProtocolMessage = (message: unknown): string =>\n JSON.stringify(encodeValue(message));\n\nexport const decodeProtocolMessage = (message: string): unknown =>\n decodeValue(JSON.parse(message));\n\nexport const encodeProtocolFrame = (message: unknown): string | Uint8Array => {\n const payloads: Uint8Array[] = [];\n const encoded = encodeBinaryValue(message, payloads, { value: 0 });\n if (!payloads.length) {\n return JSON.stringify(encoded);\n }\n const header = new TextEncoder().encode(JSON.stringify(encoded));\n const payloadLength = payloads.reduce(\n (total, payload) => total + payload.byteLength,\n 0,\n );\n const frame = new Uint8Array(8 + header.byteLength + payloadLength);\n const view = new DataView(frame.buffer);\n view.setUint32(0, binaryMagic);\n view.setUint32(4, header.byteLength);\n frame.set(header, 8);\n let offset = 8 + header.byteLength;\n payloads.forEach((payload) => {\n frame.set(payload, offset);\n offset += payload.byteLength;\n });\n return frame;\n};\n\nexport const decodeProtocolFrame = (\n frame: string | ArrayBuffer | Uint8Array,\n): unknown => {\n if (typeof frame === \"string\") {\n return decodeProtocolMessage(frame);\n }\n const bytes =\n frame instanceof Uint8Array\n ? frame\n : new Uint8Array(frame, 0, frame.byteLength);\n if (bytes.byteLength < 8) {\n throw new Error(\"Invalid Overmux binary frame\");\n }\n const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n if (view.getUint32(0) !== binaryMagic) {\n throw new Error(\"Invalid Overmux binary frame magic\");\n }\n const headerLength = view.getUint32(4);\n if (8 + headerLength > bytes.byteLength) {\n throw new Error(\"Invalid Overmux binary frame header\");\n }\n const header = JSON.parse(\n new TextDecoder().decode(bytes.subarray(8, 8 + headerLength)),\n ) as unknown;\n return decodeBinaryValue(header, bytes.subarray(8 + headerLength));\n};\n\nexport type RuntimeManifest = z.infer<typeof runtimeManifestSchema>;\nexport type ClientDiagnosticEvent = z.infer<typeof clientDiagnosticEventSchema>;\nexport type ClientProtocolMessage = z.infer<typeof clientProtocolMessageSchema>;\nexport type ServerLifecycleEvent = z.infer<typeof serverLifecycleEventSchema>;\nexport type ServerProtocolMessage = z.infer<typeof serverProtocolMessageSchema>;\n","import { hostname } from \"node:os\";\nimport type { RuntimeConfigDefinition } from \"@overmux/shared/node\";\nimport {\n createInstanceIdentity,\n type InstanceIdentity,\n} from \"../../shared/index\";\nimport type { InstanceContext } from \"../../../public/config\";\n\n// The scope exists during preparation, but identity is immutable once the listener\n// binds. No handler or connection may observe it before establishment.\nexport const createRuntimeInstance = (\n configured: RuntimeConfigDefinition[\"instanceId\"],\n) => {\n let identity: InstanceIdentity | undefined;\n const get = () => {\n if (!identity) {\n throw new Error(\"Overmux instance identity is not ready\");\n }\n return identity;\n };\n const context: InstanceContext = {\n getInstanceId: () => get().instanceId,\n getDeepLinkPrefix: () => get().deepLinkPrefix,\n };\n return {\n context,\n establish: (port: number) => {\n if (identity) {\n throw new Error(\"Overmux instance identity is already established\");\n }\n try {\n identity = createInstanceIdentity(\n typeof configured === \"function\"\n ? configured({ port })\n : (configured ?? `${hostname()}-${port}`),\n );\n } catch (cause) {\n throw new Error(\n \"Invalid Overmux instance ID; configure instanceId with a canonical lowercase ID\",\n { cause },\n );\n }\n return identity;\n },\n };\n};\n","// Composes runtime and request cancellation while owning asynchronous cleanup.\n// Tracked disposers run exactly once, and aggregate shutdown reports every failure.\n\nimport type { RuntimeDisposer } from \"../../../public/index\";\n\nexport type RuntimeLifecycle = {\n completePreparation: () => void;\n dispose: (reason?: unknown) => Promise<void>;\n disposeAll: (disposers: Iterable<RuntimeDisposer>) => Promise<void>;\n requestSignal: (signal?: AbortSignal) => AbortSignal;\n signal: AbortSignal;\n track: (dispose: RuntimeDisposer, signal?: AbortSignal) => RuntimeDisposer;\n};\n\nconst asError = (cause: unknown) =>\n cause instanceof Error ? cause : new Error(String(cause));\n\nconst disposeAll = async (disposers: Iterable<RuntimeDisposer>) => {\n const results = await Promise.allSettled(\n [...disposers].map(async (dispose) => dispose()),\n );\n const errors = results.flatMap((result) =>\n result.status === \"rejected\" ? [asError(result.reason)] : [],\n );\n if (errors.length) {\n throw new AggregateError(errors, \"Runtime disposal failed\");\n }\n};\n\nexport const createRuntimeLifecycle = (\n preparationSignal?: AbortSignal,\n): RuntimeLifecycle => {\n const controller = new AbortController();\n const activeDisposers = new Set<RuntimeDisposer>();\n let disposal: Promise<void> | undefined;\n const abortPreparation = () => controller.abort(preparationSignal?.reason);\n preparationSignal?.addEventListener(\"abort\", abortPreparation, {\n once: true,\n });\n if (preparationSignal?.aborted) {\n abortPreparation();\n }\n\n const completePreparation = () => {\n preparationSignal?.removeEventListener(\"abort\", abortPreparation);\n };\n const requestSignal = (signal?: AbortSignal) =>\n signal ? AbortSignal.any([controller.signal, signal]) : controller.signal;\n const track = (\n dispose: RuntimeDisposer,\n signal?: AbortSignal,\n ): RuntimeDisposer => {\n let pending: Promise<void> | undefined;\n const disposeOnce = () => {\n if (pending) {\n return pending;\n }\n controller.signal.removeEventListener(\"abort\", onAbort);\n signal?.removeEventListener(\"abort\", onAbort);\n activeDisposers.delete(disposeOnce);\n pending = Promise.resolve().then(dispose);\n return pending;\n };\n const onAbort = () => {\n void disposeOnce().catch(() => undefined);\n };\n activeDisposers.add(disposeOnce);\n controller.signal.addEventListener(\"abort\", onAbort, { once: true });\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n if (controller.signal.aborted || signal?.aborted) {\n onAbort();\n }\n return disposeOnce;\n };\n const dispose = (reason: unknown = new Error(\"Runtime disposed\")) => {\n if (disposal) {\n return disposal;\n }\n completePreparation();\n const pending = [...activeDisposers];\n activeDisposers.clear();\n controller.abort(reason);\n disposal = disposeAll(pending);\n return disposal;\n };\n\n return {\n completePreparation,\n dispose,\n disposeAll,\n requestSignal,\n signal: controller.signal,\n track,\n };\n};\n","// Registers named operations with validated input, output, and notification context.\n// Lookup metadata stays aligned with the names published in the runtime manifest.\n\nimport type {\n HandlerContext,\n OperationDefinition,\n} from \"../../../public/index\";\nimport type { Notifications } from \"../../../public/index\";\nimport { z } from \"zod\";\n\nexport class OperationValidationError extends Error {\n constructor(\n readonly phase: \"input\" | \"output\",\n cause: z.ZodError,\n ) {\n super(cause.message, { cause });\n }\n}\n\nexport type RuntimeOperation = {\n execute: (input: unknown, signal?: AbortSignal) => Promise<unknown>;\n returnsVoid: boolean;\n};\n\nexport type RuntimeOperations = {\n get: (name: string) => RuntimeOperation | undefined;\n names: readonly string[];\n};\n\ntype AnyOperation = OperationDefinition<z.ZodTypeAny, z.ZodTypeAny>;\n\nexport type RuntimeOperationDefinitions = Readonly<\n Record<string, AnyOperation>\n>;\n\ntype CreateRuntimeOperationsOptions = {\n context: (signal?: AbortSignal) => HandlerContext;\n definitions: RuntimeOperationDefinitions;\n notifications: Notifications;\n};\n\nexport const createRuntimeOperations = ({\n context,\n definitions,\n notifications,\n}: CreateRuntimeOperationsOptions): RuntimeOperations => {\n const operations = new Map<string, RuntimeOperation>();\n Object.entries(definitions).forEach(([name, definition]) => {\n if (!name) {\n throw new Error(\"Operation names must not be empty\");\n }\n operations.set(name, {\n execute: async (rawInput, signal) => {\n const operationContext = context(signal);\n operationContext.signal.throwIfAborted();\n const input = definition.input.safeParse(rawInput);\n if (!input.success) {\n throw new OperationValidationError(\"input\", input.error);\n }\n const rawOutput = await definition.handle(input.data, {\n ...operationContext,\n notifications,\n });\n operationContext.signal.throwIfAborted();\n const output = definition.output.safeParse(rawOutput);\n if (!output.success) {\n throw new OperationValidationError(\"output\", output.error);\n }\n return output.data;\n },\n returnsVoid: definition.output instanceof z.ZodVoid,\n });\n });\n return {\n get: (name) => operations.get(name),\n names: [...operations.keys()],\n };\n};\n","import {\n packageSourceSnippet,\n techStackRecommendationsSnippet,\n type AiContextSnippet,\n} from \"@overmux/shared\";\n\nexport {\n packageSourceSnippet,\n techStackRecommendationsSnippet,\n type AiContextSnippet,\n};\nexport type AiContextSnippetDefinition = readonly AiContextSnippet[];\n\nexport const coreAiContextSnippets = [\n packageSourceSnippet,\n] as const satisfies AiContextSnippetDefinition;\nexport const defaultAiContextSnippets = [\n ...coreAiContextSnippets,\n techStackRecommendationsSnippet,\n] as const satisfies AiContextSnippetDefinition;\n\nconst packageSourceSnippetContent = `Overmux ships with documentation and TypeScript source.\n\nRun \\`overmux docs\\` to find the installed documentation and source for the overmux cli.\n\nE.g. \\`node_modules/overmux\\` and \\`node_modules/@overmux/xterm\\`.\n\nInspect these files so guidance matches the versions used by the application.`;\n\nconst techStackRecommendationsSnippetContent = `Prefer pnpm as the package manager, TanStack Router for routing, shadcn/ui for UI components, and Zod for schemas and runtime validation. Follow the application's established stack when it already differs.`;\n\nconst aiContextContentBySnippet: Record<AiContextSnippet, string> = {\n [packageSourceSnippet]: packageSourceSnippetContent,\n [techStackRecommendationsSnippet]: techStackRecommendationsSnippetContent,\n};\n\nexport const composeAiContext = (snippets: AiContextSnippetDefinition) =>\n snippets.length === 0\n ? \"\"\n : `${snippets\n .map(\n (snippet) => `## ${snippet}\\n\\n${aiContextContentBySnippet[snippet]}`,\n )\n .join(\"\\n\\n\")}\\n`;\n","import { z } from \"zod\";\n\nexport const noInputSchema = z.void();\n\nexport const jsonValueSchema: z.ZodType<unknown> = z.lazy(() =>\n z.union([\n z.string(),\n z.number().finite(),\n z.boolean(),\n z.null(),\n z.array(jsonValueSchema),\n z.record(z.string(), jsonValueSchema),\n ]),\n);\n\nexport const parseJsonValue = <T>(value: T): T =>\n jsonValueSchema.parse(value) as T;\n\nexport type ContractInputArguments<TInput extends z.ZodType> =\n undefined extends z.input<TInput>\n ? [input?: Exclude<z.input<TInput>, undefined>]\n : [input: z.input<TInput>];\n\nexport type ResourceContract<\n TInput extends z.ZodType = z.ZodType,\n TOutput extends z.ZodType = z.ZodType,\n> = {\n input: TInput;\n output: TOutput;\n};\n\nexport const defineResourceContract = <\n TInput extends z.ZodType,\n TOutput extends z.ZodType,\n>(\n contract: ResourceContract<TInput, TOutput>,\n): ResourceContract<TInput, TOutput> => contract;\n\nexport type StreamContract<\n TInput extends z.ZodType = z.ZodType,\n TClientMessage extends z.ZodType = z.ZodType,\n TServerMessage extends z.ZodType = z.ZodType,\n> = {\n clientMessage: TClientMessage;\n input: TInput;\n serverMessage: TServerMessage;\n};\n\nexport const defineStreamContract = <\n TInput extends z.ZodType,\n TClientMessage extends z.ZodType,\n TServerMessage extends z.ZodType,\n>(\n contract: StreamContract<TInput, TClientMessage, TServerMessage>,\n): StreamContract<TInput, TClientMessage, TServerMessage> => contract;\n","// Resource invalidation follows relationships among configured resources.\n// This model owns those relationships and their invariants before runtime work begins.\n\nimport type { ResourceDefinition } from \"../../../public/index\";\n\n// A dependency supplies a derived resource's value; a dependant consumes that value.\n// Keeping both directions makes reads follow dependencies while invalidation follows dependants.\nexport type ResourceDependencyGraph = Readonly<{\n dependencies: ReadonlyMap<string, ReadonlySet<string>>;\n dependants: ReadonlyMap<string, ReadonlySet<string>>;\n}>;\n\ntype MutableResourceGraph = Map<string, Set<string>>;\n\nconst emptyGraphFor = (resourceIds: readonly string[]): MutableResourceGraph =>\n new Map(resourceIds.map((resourceId) => [resourceId, new Set<string>()]));\n\nconst visitDependencies = ({\n dependencies,\n path,\n resourceId,\n visited,\n visiting,\n}: {\n dependencies: ReadonlyMap<string, ReadonlySet<string>>;\n path: readonly string[];\n resourceId: string;\n visited: Set<string>;\n visiting: Set<string>;\n}) => {\n if (visiting.has(resourceId)) {\n throw new Error(\n `Resource dependency cycle: ${[...path, resourceId].join(\" -> \")}`,\n );\n }\n if (visited.has(resourceId)) {\n return;\n }\n visiting.add(resourceId);\n dependencies.get(resourceId)?.forEach((dependencyId) => {\n visitDependencies({\n dependencies,\n path: [...path, resourceId],\n resourceId: dependencyId,\n visited,\n visiting,\n });\n });\n visiting.delete(resourceId);\n visited.add(resourceId);\n};\n\nconst assertAcyclic = (\n dependencies: ReadonlyMap<string, ReadonlySet<string>>,\n) => {\n // Derived reads recurse through dependencies, so a cycle could never produce a value or finish activation.\n const visited = new Set<string>();\n const visiting = new Set<string>();\n dependencies.forEach((_, resourceId) => {\n visitDependencies({\n dependencies,\n path: [],\n resourceId,\n visited,\n visiting,\n });\n });\n};\n\nexport const createResourceDependencyGraph = (\n resources: Readonly<Record<string, ResourceDefinition>>,\n): ResourceDependencyGraph => {\n const resourceIds = Object.keys(resources);\n if (resourceIds.some((resourceId) => !resourceId)) {\n throw new Error(\"Resource IDs must not be empty\");\n }\n const dependencies = emptyGraphFor(resourceIds);\n const dependants = emptyGraphFor(resourceIds);\n\n Object.entries(resources).forEach(([resourceId, resource]) => {\n if (resource.kind !== \"derived\") {\n return;\n }\n Object.entries(\n resource.dependencies as Readonly<Record<string, string>>,\n ).forEach(([dependencyName, dependencyId]) => {\n if (!dependencyName) {\n throw new Error(`Resource ${resourceId} has an empty dependency name`);\n }\n if (!dependencyId) {\n throw new Error(`Resource ${resourceId} has an empty dependency ID`);\n }\n if (!dependencies.has(dependencyId)) {\n throw new Error(`Unknown resource dependency: ${dependencyId}`);\n }\n dependencies.get(resourceId)?.add(dependencyId);\n dependants.get(dependencyId)?.add(resourceId);\n });\n });\n\n assertAcyclic(dependencies);\n return Object.freeze({ dependencies, dependants });\n};\n\nconst collectInvalidatedResourceIds = (\n graph: ResourceDependencyGraph,\n resourceId: string,\n invalidated: Set<string>,\n) => {\n if (invalidated.has(resourceId)) {\n return;\n }\n invalidated.add(resourceId);\n graph.dependants.get(resourceId)?.forEach((dependantId) => {\n collectInvalidatedResourceIds(graph, dependantId, invalidated);\n });\n};\n\nexport const getInvalidatedResourceIds = (\n graph: ResourceDependencyGraph,\n resourceId: string,\n): ReadonlySet<string> => {\n // A changed value invalidates itself and the full reverse-edge closure, not just immediate consumers.\n // Set membership is essential for diamonds: a shared dependant must notify once despite multiple paths.\n const invalidated = new Set<string>();\n collectInvalidatedResourceIds(graph, resourceId, invalidated);\n return invalidated;\n};\n","// Owns named runtime resource lookup, validated reads, dependency watchers, and invalidation.\n\nimport {\n type HandlerContext,\n type ResourceDefinition,\n type RuntimeDisposer,\n} from \"../../../public/index\";\nimport type { ResourceContract } from \"../../../public/index\";\nimport { isDeepStrictEqual } from \"node:util\";\n\nimport {\n createResourceDependencyGraph,\n getInvalidatedResourceIds,\n} from \"./resource-dependency-graph\";\nimport type { RuntimeLifecycle } from \"./runtime-lifecycle\";\n\nexport type RuntimeResource = {\n read: (input: unknown, signal?: AbortSignal) => Promise<unknown>;\n subscribe: (\n input: unknown,\n listener: () => void,\n signal?: AbortSignal,\n ) => RuntimeDisposer;\n};\n\nexport type RuntimeResourceDefinitions = Readonly<\n Record<string, ResourceDefinition>\n>;\n\nexport type RuntimeResources = {\n context: (signal?: AbortSignal) => HandlerContext;\n get: (name: string) => RuntimeResource | undefined;\n invalidate: (contract: ResourceContract, input?: unknown) => void;\n names: readonly string[];\n};\n\ntype InvalidationListener = {\n input: unknown;\n listener: () => void;\n resourceId: string;\n};\n\ntype CreateRuntimeResourcesOptions = {\n definitions: RuntimeResourceDefinitions;\n instance: HandlerContext[\"instance\"];\n lifecycle: RuntimeLifecycle;\n};\n\nexport const createRuntimeResources = ({\n definitions,\n instance,\n lifecycle,\n}: CreateRuntimeResourcesOptions): RuntimeResources => {\n const graph = createResourceDependencyGraph(definitions);\n const invalidationListeners = new Set<InvalidationListener>();\n const contracts = new Map<ResourceContract, string[]>();\n const resources = new Map<string, RuntimeResource>();\n\n Object.entries(definitions).forEach(([id, definition]) => {\n contracts.set(definition.contract, [\n ...(contracts.get(definition.contract) ?? []),\n id,\n ]);\n });\n\n const invalidateResource = (\n id: string,\n input: unknown,\n allInputs = false,\n ) => {\n if (lifecycle.signal.aborted) {\n return;\n }\n const ids = getInvalidatedResourceIds(graph, id);\n invalidationListeners.forEach((entry) => {\n if (\n ids.has(entry.resourceId) &&\n (allInputs || isDeepStrictEqual(entry.input, input))\n ) {\n entry.listener();\n }\n });\n };\n\n const invalidate = (contract: ResourceContract, input?: unknown) => {\n const ids =\n contracts.get(contract) ??\n Object.entries(definitions)\n .filter(\n ([, definition]) =>\n definition.contract.input === contract.input &&\n definition.contract.output === contract.output,\n )\n .map(([id]) => id);\n if (!ids.length) {\n throw new Error(\"Cannot invalidate a resource outside this runtime\");\n }\n ids.forEach((id) => {\n const definition = definitions[id]!;\n const parsedInput =\n input === undefined\n ? undefined\n : definition.contract.input.parse(input);\n invalidateResource(id, parsedInput, input === undefined);\n });\n };\n\n const context = (signal?: AbortSignal): HandlerContext => ({\n instance,\n invalidate,\n signal: lifecycle.requestSignal(signal),\n });\n\n const read = async (\n id: string,\n rawInput: unknown,\n signal?: AbortSignal,\n ): Promise<unknown> => {\n const definition = definitions[id]!;\n const operationSignal = lifecycle.requestSignal(signal);\n operationSignal.throwIfAborted();\n const input = definition.contract.input.parse(rawInput);\n const rawOutput =\n definition.kind === \"derived\"\n ? definition.combine(\n Object.fromEntries(\n await Promise.all(\n Object.entries(\n definition.dependencies as Readonly<Record<string, string>>,\n ).map(async ([name, dependencyId]) => [\n name,\n await read(dependencyId, rawInput, signal),\n ]),\n ),\n ),\n )\n : await definition.read(input, context(signal));\n operationSignal.throwIfAborted();\n return definition.contract.output.parse(rawOutput);\n };\n\n const activateWatchers = (\n id: string,\n rawInput: unknown,\n signal: AbortSignal | undefined,\n activated: Set<string>,\n disposers: RuntimeDisposer[],\n ) => {\n if (activated.has(id)) {\n return;\n }\n activated.add(id);\n const definition = definitions[id]!;\n const input = definition.contract.input.parse(rawInput);\n if (definition.kind === \"subscription\") {\n const dispose = definition.subscribe(\n input,\n () => invalidateResource(id, input),\n context(signal),\n );\n if (typeof dispose !== \"function\") {\n throw new Error(`Resource ${id} subscribe must return a disposer`);\n }\n disposers.push(dispose);\n return;\n }\n if (definition.kind === \"derived\") {\n graph.dependencies.get(id)?.forEach((dependencyId) => {\n activateWatchers(dependencyId, rawInput, signal, activated, disposers);\n });\n }\n };\n\n Object.keys(definitions).forEach((name) => {\n resources.set(name, {\n read: (input, signal) => read(name, input, signal),\n subscribe: (rawInput, listener, signal) => {\n lifecycle.requestSignal(signal).throwIfAborted();\n const input = definitions[name]!.contract.input.parse(rawInput);\n const entry = { input, listener, resourceId: name };\n const watcherDisposers: RuntimeDisposer[] = [];\n invalidationListeners.add(entry);\n try {\n activateWatchers(name, rawInput, signal, new Set(), watcherDisposers);\n } catch (cause) {\n invalidationListeners.delete(entry);\n void lifecycle.disposeAll(watcherDisposers).catch(() => undefined);\n throw cause;\n }\n return lifecycle.track(async () => {\n invalidationListeners.delete(entry);\n await lifecycle.disposeAll(watcherDisposers);\n }, signal);\n },\n });\n });\n\n return {\n context,\n get: (name) => resources.get(name),\n invalidate,\n names: [...resources.keys()],\n };\n};\n","// Owns named stream registration and ordered, validated session messaging.\n// Session abort, failure, and disposal remain exactly-once across every close path.\n\nimport type {\n HandlerContext,\n StreamHandlerDefinition,\n} from \"../../../public/index\";\nimport { z } from \"zod\";\n\nimport type { RuntimeLifecycle } from \"./runtime-lifecycle\";\n\nexport type RuntimeStreamSession = {\n dispose: () => Promise<void>;\n send: (message: unknown) => Promise<void>;\n};\n\nexport type RuntimeStream = {\n open: (\n input: unknown,\n emit: (message: unknown) => void,\n signal?: AbortSignal,\n onError?: (cause: unknown) => void,\n ) => Promise<RuntimeStreamSession>;\n};\n\nexport type RuntimeStreams = {\n get: (name: string) => RuntimeStream | undefined;\n names: readonly string[];\n};\n\ntype AnyStream = StreamHandlerDefinition<\n z.ZodTypeAny,\n z.ZodTypeAny,\n z.ZodTypeAny\n>;\n\nexport type RuntimeStreamDefinitions = Readonly<Record<string, AnyStream>>;\n\ntype CreateRuntimeStreamsOptions = {\n context: (signal?: AbortSignal) => HandlerContext;\n definitions: RuntimeStreamDefinitions;\n lifecycle: RuntimeLifecycle;\n};\n\nexport const createRuntimeStreams = ({\n context,\n definitions,\n lifecycle,\n}: CreateRuntimeStreamsOptions): RuntimeStreams => {\n const streams = new Map<string, RuntimeStream>();\n Object.entries(definitions).forEach(([name, definition]) => {\n if (!name) {\n throw new Error(\"Stream names must not be empty\");\n }\n streams.set(name, {\n open: async (rawInput, emit, requestSignal, onError) => {\n const sessionController = new AbortController();\n const sessionSignal = requestSignal\n ? AbortSignal.any([requestSignal, sessionController.signal])\n : sessionController.signal;\n const operationSignal = lifecycle.requestSignal(sessionSignal);\n operationSignal.throwIfAborted();\n const input = definition.contract.input.parse(rawInput);\n let acceptingMessages = true;\n let failed = false;\n let failure: unknown;\n let opened = false;\n const fail = (cause: unknown) => {\n if (failed || operationSignal.aborted) {\n return;\n }\n failed = true;\n failure = cause;\n acceptingMessages = false;\n sessionController.abort(cause);\n if (opened) {\n onError?.(cause);\n }\n };\n const session = await definition.open(input, {\n ...context(sessionSignal),\n emit: (message) => {\n if (operationSignal.aborted) {\n return;\n }\n try {\n emit(definition.contract.serverMessage.parse(message));\n } catch (cause) {\n fail(cause);\n }\n },\n fail,\n signal: operationSignal,\n });\n opened = true;\n if (failed || operationSignal.aborted) {\n await session.dispose?.();\n operationSignal.throwIfAborted();\n throw failure;\n }\n let messages = Promise.resolve();\n const dispose = lifecycle.track(async () => {\n acceptingMessages = false;\n sessionController.abort(new Error(\"Stream session disposed\"));\n await messages.catch(() => undefined);\n await session.dispose?.();\n }, requestSignal);\n return {\n dispose: async () => dispose(),\n send: async (rawMessage) => {\n if (!acceptingMessages) {\n throw new Error(\"Stream session is closed\");\n }\n const message = definition.contract.clientMessage.parse(rawMessage);\n messages = messages.then(async () => {\n operationSignal.throwIfAborted();\n await session.onMessage?.(message);\n operationSignal.throwIfAborted();\n });\n return messages;\n },\n };\n },\n });\n });\n return {\n get: (name) => streams.get(name),\n names: [...streams.keys()],\n };\n};\n","// Composes one process-lifetime runtime from cohesive lifecycle and protocol components.\n\nimport type { RuntimeConfigDefinition } from \"@overmux/shared/node\";\n\nimport type {\n InstanceContext,\n InstanceIdentity,\n Notifications,\n} from \"../../../public/index\";\nimport { createRuntimeInstance } from \"./runtime-instance\";\nimport { protocolVersion, type RuntimeManifest } from \"../../shared/index\";\n\nimport { createRuntimeLifecycle } from \"./runtime-lifecycle\";\nimport {\n createRuntimeOperations,\n type RuntimeOperation,\n type RuntimeOperationDefinitions,\n} from \"./runtime-operations\";\nimport {\n createRuntimeResources,\n type RuntimeResource,\n type RuntimeResourceDefinitions,\n} from \"./runtime-resources\";\nimport {\n createRuntimeStreams,\n type RuntimeStream,\n type RuntimeStreamDefinitions,\n} from \"./runtime-streams\";\n\nexport type Runtime = {\n instance: InstanceContext;\n establishInstance: (port: number) => InstanceIdentity;\n manifest: RuntimeManifest;\n dispose: () => Promise<void>;\n getOperation: (name: string) => RuntimeOperation | undefined;\n getResource: (name: string) => RuntimeResource | undefined;\n getStream: (name: string) => RuntimeStream | undefined;\n};\n\ntype CreateRuntimeOptions = {\n config: RuntimeConfigDefinition;\n debug?: boolean;\n notifications?: Notifications;\n signal?: AbortSignal;\n};\n\nexport const createRuntime = async ({\n config,\n debug = false,\n notifications = { send: async () => undefined },\n signal,\n}: CreateRuntimeOptions): Promise<Runtime> => {\n const lifecycle = createRuntimeLifecycle(signal);\n const instance = createRuntimeInstance(config.instanceId);\n try {\n const resources = createRuntimeResources({\n definitions: (config.server.resources ??\n {}) as RuntimeResourceDefinitions,\n instance: instance.context,\n lifecycle,\n });\n const context = resources.context;\n const operations = createRuntimeOperations({\n context,\n definitions: (config.server.operations ??\n {}) as RuntimeOperationDefinitions,\n notifications,\n });\n const streams = createRuntimeStreams({\n context,\n definitions: (config.server.streams ?? {}) as RuntimeStreamDefinitions,\n lifecycle,\n });\n\n lifecycle.signal.throwIfAborted();\n lifecycle.completePreparation();\n\n const manifest: RuntimeManifest = {\n debug,\n operations: [...operations.names],\n protocolVersion,\n resources: [...resources.names],\n streams: [...streams.names],\n };\n return {\n instance: instance.context,\n establishInstance: instance.establish,\n manifest,\n dispose: lifecycle.dispose,\n getOperation: operations.get,\n getResource: resources.get,\n getStream: streams.get,\n };\n } catch (cause) {\n await lifecycle.dispose(cause).catch(() => undefined);\n throw cause;\n }\n};\n","import { loadOvermuxConfig } from \"@overmux/shared/node\";\nimport { dirname, isAbsolute, resolve } from \"node:path\";\nimport ts from \"typescript\";\nimport { ZodError } from \"zod\";\n\nimport { createRuntime } from \"./runtime/create-runtime\";\n\nexport type CheckDiagnostic = {\n code?: number | string;\n column?: number;\n file?: string;\n line?: number;\n message: string;\n path?: string;\n phase: \"config\" | \"imports\" | \"runtime\" | \"types\" | \"ui\";\n};\n\nexport type CheckResult = {\n operations?: number;\n config: string;\n diagnostics: CheckDiagnostic[];\n files: number;\n ok: boolean;\n};\n\nexport type CheckOvermuxOptions = {\n aliases?: Record<string, string>;\n configPath: string;\n typeAliases?: Record<string, string>;\n typesOnly?: boolean;\n};\n\nconst loadCompilerOptions = (configPath: string) => {\n const tsconfig = ts.findConfigFile(dirname(configPath), ts.sys.fileExists);\n if (!tsconfig) {\n return {\n allowImportingTsExtensions: true,\n allowJs: false,\n esModuleInterop: true,\n jsx: ts.JsxEmit.ReactJSX,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n noEmit: true,\n skipLibCheck: true,\n strict: true,\n target: ts.ScriptTarget.ES2022,\n } satisfies ts.CompilerOptions;\n }\n const loaded = ts.readConfigFile(tsconfig, ts.sys.readFile);\n if (loaded.error) {\n throw new Error(\n ts.flattenDiagnosticMessageText(loaded.error.messageText, \"\\n\"),\n );\n }\n const parsed = ts.parseJsonConfigFileContent(\n loaded.config,\n ts.sys,\n dirname(tsconfig),\n );\n return {\n ...parsed.options,\n allowImportingTsExtensions: true,\n noEmit: true,\n };\n};\n\nconst diagnosticOf = (diagnostic: ts.Diagnostic): CheckDiagnostic => {\n const position =\n diagnostic.file && diagnostic.start !== undefined\n ? diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start)\n : undefined;\n return {\n code: diagnostic.code,\n column: position ? position.character + 1 : undefined,\n file: diagnostic.file?.fileName,\n line: position ? position.line + 1 : undefined,\n message: ts.flattenDiagnosticMessageText(diagnostic.messageText, \"\\n\"),\n phase: \"types\",\n };\n};\n\nconst kindOf = (fileName: string, configPath: string) => {\n if (\n resolve(fileName) === resolve(configPath) ||\n fileName.match(/\\.server\\.[cm]?[jt]sx?$/)\n ) {\n return \"server\";\n }\n if (fileName.match(/\\.ui\\.[cm]?[jt]sx?$/)) {\n return \"client\";\n }\n if (fileName.match(/\\.shared\\.[cm]?[jt]sx?$/)) {\n return \"shared\";\n }\n return undefined;\n};\n\ntype ModuleKind = \"client\" | \"server\" | \"shared\";\n\ntype ResolvedImport = {\n kind?: ModuleKind;\n node: ts.ImportDeclaration | ts.ExportDeclaration;\n source?: ts.SourceFile;\n};\n\nconst kindOfSpecifier = (specifier: string): ModuleKind | undefined => {\n if (specifier === \"overmux/client\" || specifier.endsWith(\"/react\")) {\n return \"client\";\n }\n if (\n specifier === \"overmux/server\" ||\n specifier.endsWith(\"/server\") ||\n specifier.startsWith(\"node:\")\n ) {\n return \"server\";\n }\n if (specifier === \"overmux\" || specifier.endsWith(\"/shared\")) {\n return \"shared\";\n }\n return undefined;\n};\n\nconst isTypeOnlyReference = (\n node: ts.ImportDeclaration | ts.ExportDeclaration,\n) => {\n if (ts.isExportDeclaration(node)) {\n return Boolean(\n node.isTypeOnly ||\n (node.exportClause &&\n ts.isNamedExports(node.exportClause) &&\n node.exportClause.elements.every((element) => element.isTypeOnly)),\n );\n }\n const clause = node.importClause;\n if (!clause || clause.name) {\n return Boolean(clause?.isTypeOnly);\n }\n return Boolean(\n clause.isTypeOnly ||\n (clause.namedBindings &&\n ts.isNamedImports(clause.namedBindings) &&\n clause.namedBindings.elements.every((element) => element.isTypeOnly)),\n );\n};\n\nconst resolvedImports = (program: ts.Program, source: ts.SourceFile) => {\n const imports: ResolvedImport[] = [];\n source.forEachChild((node) => {\n if (\n (!ts.isImportDeclaration(node) && !ts.isExportDeclaration(node)) ||\n !node.moduleSpecifier ||\n !ts.isStringLiteral(node.moduleSpecifier) ||\n isTypeOnlyReference(node)\n ) {\n return;\n }\n const specifier = node.moduleSpecifier.text;\n const resolved = ts.resolveModuleName(\n specifier,\n source.fileName,\n program.getCompilerOptions(),\n ts.sys,\n ).resolvedModule?.resolvedFileName;\n const target = resolved ? program.getSourceFile(resolved) : undefined;\n const kind = kindOfSpecifier(specifier);\n if (kind || (target && !target.isDeclarationFile)) {\n imports.push({\n kind,\n node,\n source: target?.isDeclarationFile ? undefined : target,\n });\n }\n });\n return imports;\n};\n\nconst invalidImport = (source: ModuleKind, target: ModuleKind | undefined) =>\n (source === \"server\" && target === \"client\") ||\n (source === \"client\" && target === \"server\") ||\n (source === \"shared\" && target !== undefined && target !== \"shared\");\n\nconst visitImportGraph = ({\n configPath,\n diagnostics,\n kind,\n program,\n seen,\n source,\n}: {\n configPath: string;\n diagnostics: CheckDiagnostic[];\n kind: ModuleKind;\n program: ts.Program;\n seen: Set<string>;\n source: ts.SourceFile;\n}) => {\n const visitKey = `${kind}:${source.fileName}`;\n if (seen.has(visitKey)) {\n return;\n }\n seen.add(visitKey);\n resolvedImports(program, source).forEach(\n ({ kind: importKind, node, source: target }) => {\n const declaredKind =\n importKind ??\n (target ? kindOf(target.fileName, configPath) : undefined);\n if (invalidImport(kind, declaredKind)) {\n const position = source.getLineAndCharacterOfPosition(node.getStart());\n diagnostics.push({\n code: \"OVERMUX_IMPORT_BOUNDARY\",\n column: position.character + 1,\n file: source.fileName,\n line: position.line + 1,\n message: `${kind} modules may not import ${declaredKind} modules`,\n phase: \"imports\",\n });\n return;\n }\n if (target) {\n visitImportGraph({\n configPath,\n diagnostics,\n kind: declaredKind === \"shared\" ? \"shared\" : kind,\n program,\n seen,\n source: target,\n });\n }\n },\n );\n};\n\nconst importBoundaryDiagnostics = (\n program: ts.Program,\n configPath: string,\n): CheckDiagnostic[] => {\n const diagnostics: CheckDiagnostic[] = [];\n const seen = new Set<string>();\n program.getSourceFiles().forEach((source) => {\n const kind = kindOf(source.fileName, configPath);\n if (kind && !source.isDeclarationFile) {\n visitImportGraph({\n configPath,\n diagnostics,\n kind,\n program,\n seen,\n source,\n });\n }\n });\n return diagnostics;\n};\n\nconst runtimeDiagnostics = (cause: unknown): CheckDiagnostic[] => {\n if (cause instanceof ZodError) {\n return cause.issues.map((issue) => ({\n message: issue.message,\n path: issue.path.length ? issue.path.join(\".\") : undefined,\n phase: \"runtime\" as const,\n }));\n }\n return [\n {\n message: cause instanceof Error ? cause.message : String(cause),\n phase: \"runtime\",\n },\n ];\n};\n\nconst typecheck = async ({\n aliases = {},\n configPath,\n typeAliases,\n}: CheckOvermuxOptions) => {\n const options = loadCompilerOptions(configPath);\n const aliasesForTypes =\n typeAliases ??\n Object.fromEntries(\n Object.entries(aliases).filter(\n ([key]) => key === \"overmux\" || key.startsWith(\"overmux/\"),\n ),\n );\n const absoluteAliases = Object.fromEntries(\n Object.entries(aliasesForTypes).map(([key, value]) => [\n key,\n [isAbsolute(value) ? value : resolve(value)],\n ]),\n );\n const program = ts.createProgram({\n options: {\n ...options,\n baseUrl: options.baseUrl ?? \"/\",\n paths: { ...options.paths, ...absoluteAliases },\n },\n rootNames: [configPath],\n });\n const diagnostics = [\n ...ts.getPreEmitDiagnostics(program).map(diagnosticOf),\n ...importBoundaryDiagnostics(program, configPath),\n ];\n const files = program\n .getSourceFiles()\n .filter(\n (file) =>\n !file.isDeclarationFile && !file.fileName.includes(\"node_modules\"),\n ).length;\n return { diagnostics, files };\n};\n\nexport const checkOvermux = async (\n options: CheckOvermuxOptions,\n): Promise<CheckResult> => {\n const configPath = resolve(options.configPath);\n let checked;\n try {\n checked = await typecheck({ ...options, configPath });\n } catch (cause) {\n return {\n config: configPath,\n diagnostics: [\n {\n message: cause instanceof Error ? cause.message : String(cause),\n phase: \"config\",\n },\n ],\n files: 0,\n ok: false,\n };\n }\n if (checked.diagnostics.length || options.typesOnly) {\n return {\n config: configPath,\n diagnostics: checked.diagnostics,\n files: checked.files,\n ok: checked.diagnostics.length === 0,\n };\n }\n\n let runtime: Awaited<ReturnType<typeof createRuntime>> | undefined;\n try {\n const { config } = await loadOvermuxConfig({\n aliases: options.aliases,\n configPath,\n });\n runtime = await createRuntime({ config });\n return {\n operations: runtime.manifest.operations.length,\n config: configPath,\n diagnostics: [],\n files: checked.files,\n ok: true,\n };\n } catch (cause) {\n return {\n config: configPath,\n diagnostics: runtimeDiagnostics(cause),\n files: checked.files,\n ok: false,\n };\n } finally {\n await runtime?.dispose();\n }\n};\n","import { appendFileSync, mkdirSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { randomUUID } from \"node:crypto\";\n\nimport { getOvermuxPaths } from \"./paths\";\n\nexport type ServerLogLevel = \"debug\" | \"error\" | \"info\" | \"warn\";\n\nexport type ServerLogEntry = {\n // Groups related request, connection, and operation logs for diagnostics.\n correlationId?: string;\n details?: Record<string, unknown>;\n durationMs?: number;\n event: string;\n level?: ServerLogLevel;\n message?: string;\n source?: \"browser\" | \"server\";\n timestamp?: string;\n};\n\nexport type ServerLogger = {\n enabled: boolean;\n id: () => string;\n log: (entry: ServerLogEntry) => void;\n};\n\ntype ConfigurableServerLogger = ServerLogger & {\n setEnabled: (enabled: boolean) => void;\n setLogFile: (logFile: string) => void;\n};\n\nconst lifecycleEvents = new Set([\n \"server-start\",\n \"server-stop\",\n \"websocket-close\",\n \"websocket-close-event\",\n \"websocket-connect\",\n \"websocket-open\",\n]);\n\nexport const getDefaultServerLogFile = ({\n homeDir,\n xdgStateHome,\n}: {\n homeDir?: string;\n xdgStateHome?: string;\n} = {}) =>\n join(getOvermuxPaths({ homeDir, xdgStateHome }).stateDir, \"overmux.log\");\n\nconst safeJson = (value: unknown) => {\n try {\n return JSON.stringify(value);\n } catch {\n return JSON.stringify({\n event: \"log-serialization-error\",\n level: \"error\",\n source: \"server\",\n timestamp: new Date().toISOString(),\n });\n }\n};\n\nexport const createServerLogger = ({\n enabled,\n logFile = getDefaultServerLogFile(),\n}: {\n enabled: boolean;\n logFile?: string;\n}): ConfigurableServerLogger => {\n let activeLogFile = logFile;\n let debugEnabled = enabled;\n return {\n get enabled() {\n return debugEnabled;\n },\n id: randomUUID,\n log: (entry) => {\n if (\n !debugEnabled &&\n entry.level !== \"error\" &&\n !lifecycleEvents.has(entry.event)\n ) {\n return;\n }\n const record = safeJson({\n timestamp: entry.timestamp ?? new Date().toISOString(),\n level: entry.level ?? \"info\",\n source: entry.source ?? \"server\",\n ...entry,\n });\n mkdirSync(dirname(activeLogFile), { recursive: true });\n appendFileSync(activeLogFile, `${record}\\n`, \"utf8\");\n process.stderr.write(`[overmux:debug] ${record}\\n`);\n },\n setEnabled: (nextEnabled) => {\n debugEnabled = nextEnabled;\n },\n setLogFile: (nextLogFile) => {\n activeLogFile = nextLogFile;\n },\n };\n};\n\nexport const errorMessage = (cause: unknown) =>\n cause instanceof Error ? cause.message : String(cause);\n\nexport const errorDetails = (cause: unknown) => ({\n message: errorMessage(cause),\n ...(cause instanceof Error && cause.stack ? { stack: cause.stack } : {}),\n});\n","// Defines the complete validated IPC boundary between coordinator and child.\n// Application traffic never crosses this process boundary.\n\nimport { z } from \"zod\";\n\nconst childOptionsSchema = z.object({\n configAliases: z.record(z.string(), z.string()).optional(),\n configPath: z.string(),\n debug: z.boolean().optional(),\n developmentWebTarget: z.url().optional(),\n host: z.string().optional(),\n logFile: z.string().optional(),\n port: z.number().int().min(0).max(65_535).optional(),\n productionWebAssetsDir: z.string().optional(),\n watch: z.boolean().optional(),\n});\n\nconst parentMessageSchema = z.discriminatedUnion(\"type\", [\n z.object({ options: childOptionsSchema, type: z.literal(\"start\") }),\n z.object({ type: z.literal(\"update-available\") }),\n z.object({ type: z.literal(\"stop\") }),\n]);\n\nconst childMessageSchema = z.discriminatedUnion(\"type\", [\n z.object({\n host: z.string(),\n port: z.number().int().min(1).max(65_535),\n type: z.literal(\"ready\"),\n url: z.string(),\n watch: z.boolean(),\n }),\n z.object({ type: z.literal(\"restart-requested\") }),\n z.object({ message: z.string(), type: z.literal(\"startup-failed\") }),\n]);\n\nexport type ChildServerOptions = z.infer<typeof childOptionsSchema>;\nexport type ParentToChildMessage = z.infer<typeof parentMessageSchema>;\nexport type ChildToParentMessage = z.infer<typeof childMessageSchema>;\n\nexport const parseParentMessage = (value: unknown): ParentToChildMessage =>\n parentMessageSchema.parse(value);\n\nexport const parseChildMessage = (value: unknown): ChildToParentMessage =>\n childMessageSchema.parse(value);\n","// Owns the coordinator's broad recursive watch of the config directory.\n// Filtering and debounce keep update signaling independent of import analysis.\n\nimport { watch } from \"node:fs\";\nimport { dirname } from \"node:path\";\n\nexport type UpdateWatcher = {\n close: () => void;\n};\n\nexport const isRelevantUpdatePath = (path: string): boolean => {\n const segments = path.split(/[\\\\/]/);\n if (segments.some((segment) => segment.toLowerCase() === \"node_modules\")) {\n return false;\n }\n return /\\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts|json|css)$/i.test(path);\n};\n\nexport const startUpdateWatcher = ({\n configPath,\n onUpdate,\n}: {\n configPath: string;\n onUpdate: () => void;\n}): UpdateWatcher => {\n let closed = false;\n let timeout: NodeJS.Timeout | undefined;\n const watcher = watch(\n dirname(configPath),\n { recursive: true },\n (_event, fileName) => {\n if (closed || !fileName || !isRelevantUpdatePath(fileName.toString())) {\n return;\n }\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(onUpdate, 100);\n },\n );\n\n return {\n close: () => {\n if (closed) {\n return;\n }\n closed = true;\n if (timeout) {\n clearTimeout(timeout);\n }\n watcher.close();\n },\n };\n};\n","// Supervises one disposable application child and the parent-owned update watcher.\n// The coordinator retains only lifecycle state and the stable startup address.\n\nimport { fork, type ChildProcess } from \"node:child_process\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { errorMessage } from \"../server-logger\";\nimport type {\n OvermuxServer,\n OvermuxServerOptions,\n} from \"../start-overmux-server\";\nimport {\n parseChildMessage,\n type ChildServerOptions,\n type ParentToChildMessage,\n} from \"./ipc-protocol\";\nimport { startUpdateWatcher, type UpdateWatcher } from \"./update-watcher\";\n\ntype ChildInstance = {\n process: ChildProcess;\n host: string;\n port: number;\n url: string;\n watch: boolean;\n};\n\nconst send = (\n child: ChildProcess,\n message: ParentToChildMessage,\n onError?: (cause: Error) => void,\n) => {\n if (!child.connected) {\n onError?.(new Error(\"Server child IPC channel is closed\"));\n return;\n }\n try {\n child.send(message, (cause) => {\n if (cause) {\n onError?.(cause);\n }\n });\n } catch (cause) {\n onError?.(cause instanceof Error ? cause : new Error(String(cause)));\n }\n};\n\nconst stopChild = (child: ChildProcess): Promise<void> =>\n new Promise((resolve) => {\n let timeout: NodeJS.Timeout | undefined;\n const finish = () => {\n child.off(\"exit\", finish);\n clearTimeout(timeout);\n resolve();\n };\n child.once(\"exit\", finish);\n if (child.exitCode !== null || child.signalCode !== null) {\n finish();\n return;\n }\n timeout = setTimeout(() => {\n if (!child.kill(\"SIGKILL\")) {\n finish();\n }\n }, 5_000);\n send(child, { type: \"stop\" });\n });\n\nconst serverChildPath = () =>\n fileURLToPath(import.meta.resolve(\"#server-child\"));\n\nconst startChild = (\n options: ChildServerOptions,\n onRestartRequested: () => void,\n): Promise<ChildInstance> =>\n new Promise((resolve, reject) => {\n const child = fork(serverChildPath(), [], {\n serialization: \"json\",\n stdio: [\"inherit\", \"inherit\", \"inherit\", \"ipc\"],\n });\n let settled = false;\n const fail = (cause: unknown) => {\n if (settled) {\n return;\n }\n settled = true;\n if (child.exitCode === null && child.signalCode === null) {\n child.kill();\n }\n reject(cause instanceof Error ? cause : new Error(String(cause)));\n };\n child.on(\"error\", fail);\n child.on(\"exit\", (code, signal) => {\n fail(\n new Error(\n `Server child exited before readiness (${signal ?? code ?? \"unknown\"})`,\n ),\n );\n });\n child.on(\"message\", (raw) => {\n let message;\n try {\n message = parseChildMessage(raw);\n } catch (cause) {\n fail(cause);\n return;\n }\n if (message.type === \"restart-requested\") {\n if (settled) {\n onRestartRequested();\n }\n return;\n }\n if (message.type === \"startup-failed\") {\n fail(new Error(message.message));\n return;\n }\n if (!settled) {\n settled = true;\n resolve({\n host: message.host,\n port: message.port,\n process: child,\n url: message.url,\n watch: message.watch,\n });\n }\n });\n send(child, { options, type: \"start\" }, fail);\n });\n\nexport const startServerCoordinator = async (\n initialOptions: OvermuxServerOptions,\n): Promise<OvermuxServer> => {\n let child: ChildInstance | undefined;\n let closed = false;\n let closePromise: Promise<void> | undefined;\n let restartPromise: Promise<void> | undefined;\n let updateDuringRestart = false;\n let startupAddress: { host: string; port: number } | undefined;\n let watcher: UpdateWatcher | undefined;\n\n const adoptChild = (next: ChildInstance) => {\n child = next;\n next.process.once(\"exit\", () => {\n if (child?.process === next.process) {\n child = undefined;\n }\n });\n };\n\n const restart = () => {\n if (closed || restartPromise) {\n return restartPromise ?? Promise.resolve();\n }\n restartPromise = (async () => {\n const previous = child;\n child = undefined;\n if (previous) {\n await stopChild(previous.process);\n }\n if (closed || !startupAddress) {\n return;\n }\n try {\n const replacement = await startChild(\n {\n ...initialOptions,\n host: startupAddress.host,\n port: startupAddress.port,\n },\n () => void restart(),\n );\n if (closed) {\n await stopChild(replacement.process);\n return;\n }\n adoptChild(replacement);\n if (updateDuringRestart) {\n updateDuringRestart = false;\n send(replacement.process, { type: \"update-available\" });\n }\n } catch (cause) {\n process.stderr.write(\n `[overmux] replacement child failed: ${errorMessage(cause)}\\n`,\n );\n }\n })().finally(() => {\n const shouldRetry = updateDuringRestart && !child && !closed;\n updateDuringRestart = false;\n restartPromise = undefined;\n if (shouldRetry) {\n void restart();\n }\n });\n return restartPromise;\n };\n\n const onUpdate = () => {\n if (closed) {\n return;\n }\n if (restartPromise) {\n updateDuringRestart = true;\n return;\n }\n if (child) {\n send(child.process, { type: \"update-available\" });\n return;\n }\n void restart();\n };\n\n const initial = await startChild(initialOptions, () => void restart());\n startupAddress = { host: initial.host, port: initial.port };\n adoptChild(initial);\n try {\n if (initial.watch) {\n watcher = startUpdateWatcher({\n configPath: initialOptions.configPath,\n onUpdate,\n });\n }\n } catch (cause) {\n await stopChild(initial.process);\n throw cause;\n }\n\n const close = () => {\n if (closePromise) {\n return closePromise;\n }\n closed = true;\n closePromise = (async () => {\n process.off(\"SIGINT\", onSignal);\n process.off(\"SIGTERM\", onSignal);\n watcher?.close();\n const active = child;\n child = undefined;\n if (active) {\n await stopChild(active.process);\n }\n await restartPromise;\n })();\n return closePromise;\n };\n const onSignal = () => {\n void close().catch((cause: unknown) => {\n process.stderr.write(\n `[overmux] coordinator shutdown failed: ${errorMessage(cause)}\\n`,\n );\n });\n };\n process.once(\"SIGINT\", onSignal);\n process.once(\"SIGTERM\", onSignal);\n\n return {\n announceUpdateAvailable: onUpdate,\n close,\n port: initial.port,\n url: initial.url,\n };\n};\n","import type { ServerConfigDefinition } from \"../../public/index\";\nimport { resolve } from \"node:path\";\n\nimport { startServerCoordinator } from \"./coordinator/server-coordinator\";\n\nexport type OvermuxServerOptions = ServerConfigDefinition & {\n configAliases?: Record<string, string>;\n debug?: boolean;\n developmentWebTarget?: string;\n configPath: string;\n};\n\nexport type OvermuxServer = {\n announceUpdateAvailable: () => void;\n close: () => Promise<void>;\n port: number;\n url: string;\n};\n\nexport const startOvermuxServer = async (\n options: OvermuxServerOptions,\n): Promise<OvermuxServer> =>\n startServerCoordinator({\n ...options,\n configPath: resolve(options.configPath),\n });\n"],"mappings":";;;;;;;;;;;;AAOA,MAAM,kBAAkB;AACxB,MAAM,qBAAqB;CAC1B,GAAG,OAAO,KAAK;CACf,GAAG,OAAO;CACV,GAAG,KAAK;CACR,IAAI;CACJ,GAAG;AACJ;AACA,MAAM,0BAA0B,aAAa;CAC5C,MAAM,QAAQ,gBAAgB,KAAK,QAAQ;CAC3C,IAAI,CAAC,OAAO;CACZ,MAAM,OAAO,MAAM;CACnB,MAAM,eAAe,OAAO,MAAM,EAAE,IAAI,mBAAmB;CAC3D,OAAO,OAAO,cAAc,YAAY,IAAI,eAAe,KAAK;AACjE;AACA,MAAM,oBAAoB,CAAC,kBAAkB,4BAA4B;AAGzE,MAAMA,qBAAmB,EAAE,OAAO,CAAC,CAAC,IAAI,GAAG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