@powerhousedao/clint 6.3.0-dev.9 → 6.4.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-DZIv63eB.mjs +77 -0
- package/dist/build-DZIv63eB.mjs.map +1 -0
- package/dist/{build-skills-BnqGyuCH.mjs → build-skills-BNEOn-cl.mjs} +15 -6
- package/dist/build-skills-BNEOn-cl.mjs.map +1 -0
- package/dist/dist--xzirmg-.mjs +655 -0
- package/dist/dist--xzirmg-.mjs.map +1 -0
- package/dist/glob-CGjvhxgW.mjs +48 -0
- package/dist/glob-CGjvhxgW.mjs.map +1 -0
- package/dist/index-C3-HSfKb.d.mts +389 -0
- package/dist/index-C3-HSfKb.d.mts.map +1 -0
- package/dist/index.d.mts +55 -303
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7 -8
- package/dist/integrations/mastra/index.d.mts +248 -0
- package/dist/integrations/mastra/index.d.mts.map +1 -0
- package/dist/integrations/mastra/index.mjs +509 -0
- package/dist/integrations/mastra/index.mjs.map +1 -0
- package/dist/integrations/powerhouse/index.d.mts +4 -0
- package/dist/integrations/powerhouse/index.mjs +3 -0
- package/dist/markdown-BUeGwhbR.mjs +1588 -0
- package/dist/markdown-BUeGwhbR.mjs.map +1 -0
- package/dist/powerhouse-BDnj7kqd.mjs +1922 -0
- package/dist/powerhouse-BDnj7kqd.mjs.map +1 -0
- package/dist/{proxy-BFR8GScT.mjs → proxy-ji3EHzLn.mjs} +128 -28
- package/dist/proxy-ji3EHzLn.mjs.map +1 -0
- package/dist/remote-reactor-BQzq4yfO.mjs +69 -0
- package/dist/remote-reactor-BQzq4yfO.mjs.map +1 -0
- package/dist/{start-b7Mn2cxB.mjs → repl-Czb7u0x_.mjs} +6 -29
- package/dist/repl-Czb7u0x_.mjs.map +1 -0
- package/dist/runners/cli-runner.d.mts +339 -0
- package/dist/runners/cli-runner.d.mts.map +1 -0
- package/dist/runners/cli-runner.mjs +324 -0
- package/dist/runners/cli-runner.mjs.map +1 -0
- package/dist/runners/mastra-runner.d.mts +5 -3
- package/dist/runners/mastra-runner.d.mts.map +1 -1
- package/dist/runners/mastra-runner.mjs +10 -60
- package/dist/runners/mastra-runner.mjs.map +1 -1
- package/dist/runners/proxy-runner.d.mts +281 -0
- package/dist/runners/proxy-runner.d.mts.map +1 -0
- package/dist/runners/proxy-runner.mjs +91 -0
- package/dist/runners/proxy-runner.mjs.map +1 -0
- package/dist/schema-BEKAZGyT.mjs +47 -0
- package/dist/schema-BEKAZGyT.mjs.map +1 -0
- package/dist/{src-BebNN3xc.mjs → src-BehwgLP6.mjs} +395 -1481
- package/dist/src-BehwgLP6.mjs.map +1 -0
- package/dist/start-BHn9LIyX.mjs +37 -0
- package/dist/start-BHn9LIyX.mjs.map +1 -0
- package/dist/store-CxqB-OrX.mjs +101 -0
- package/dist/store-CxqB-OrX.mjs.map +1 -0
- package/dist/{stream-DVuufwIj.mjs → stream-BguHx7vC.mjs} +4 -2
- package/dist/{stream-DVuufwIj.mjs.map → stream-BguHx7vC.mjs.map} +1 -1
- package/dist/testing/index.d.mts +81 -0
- package/dist/testing/index.d.mts.map +1 -0
- package/dist/testing/index.mjs +131 -0
- package/dist/testing/index.mjs.map +1 -0
- package/dist/{types-CRkoD-Mm.d.mts → types-CF6GuPJd.d.mts} +241 -261
- package/dist/types-CF6GuPJd.d.mts.map +1 -0
- package/dist/types-CbHJ-ZnH.d.mts +60 -0
- package/dist/types-CbHJ-ZnH.d.mts.map +1 -0
- package/package.json +44 -25
- package/dist/build-skills-BnqGyuCH.mjs.map +0 -1
- package/dist/dist-CUltriBW.mjs +0 -1628
- package/dist/dist-CUltriBW.mjs.map +0 -1
- package/dist/drive-Bu9zoFrO.mjs +0 -85
- package/dist/drive-Bu9zoFrO.mjs.map +0 -1
- package/dist/esm-C1DOsF1a.mjs +0 -13140
- package/dist/esm-C1DOsF1a.mjs.map +0 -1
- package/dist/events-BnwGFTjv.mjs +0 -237
- package/dist/events-BnwGFTjv.mjs.map +0 -1
- package/dist/folders-BYO1Wqqb.mjs +0 -256
- package/dist/folders-BYO1Wqqb.mjs.map +0 -1
- package/dist/local-signer-EFzJV3bn.mjs +0 -128
- package/dist/local-signer-EFzJV3bn.mjs.map +0 -1
- package/dist/markdown-D-sP2zw_.mjs +0 -275
- package/dist/markdown-D-sP2zw_.mjs.map +0 -1
- package/dist/proxy-BFR8GScT.mjs.map +0 -1
- package/dist/proxy-routes-DP3ztsnS.mjs +0 -215
- package/dist/proxy-routes-DP3ztsnS.mjs.map +0 -1
- package/dist/reactor-C9VIUX1H.mjs +0 -51
- package/dist/reactor-C9VIUX1H.mjs.map +0 -1
- package/dist/runners/clint-runner.d.mts +0 -398
- package/dist/runners/clint-runner.d.mts.map +0 -1
- package/dist/runners/clint-runner.mjs +0 -519
- package/dist/runners/clint-runner.mjs.map +0 -1
- package/dist/services-9E-r0nWl.mjs +0 -999
- package/dist/services-9E-r0nWl.mjs.map +0 -1
- package/dist/src-BebNN3xc.mjs.map +0 -1
- package/dist/start-b7Mn2cxB.mjs.map +0 -1
- package/dist/subscriptions-CfiflAsI.mjs +0 -38
- package/dist/subscriptions-CfiflAsI.mjs.map +0 -1
- package/dist/switchboard-CyvOavqL.mjs +0 -57
- package/dist/switchboard-CyvOavqL.mjs.map +0 -1
- package/dist/types-CRkoD-Mm.d.mts.map +0 -1
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
//#region src/core/proxy-routes.ts
|
|
2
|
-
/**
|
|
3
|
-
* Match a route prefix against a request pathname on path-segment boundaries:
|
|
4
|
-
* the prefix matches only when the pathname equals it or continues with a `/`.
|
|
5
|
-
* A bare `startsWith` would let `/foobar` match a `/foo` route. The root prefix
|
|
6
|
-
* `/` matches everything. A prefix already carrying a trailing `/`
|
|
7
|
-
* (e.g. `/switchboard/attachments/`) matches `<prefix>` and `<prefix><rest>`
|
|
8
|
-
* without doubling the separator.
|
|
9
|
-
*/
|
|
10
|
-
function prefixMatches(prefix, pathname) {
|
|
11
|
-
if (prefix === "/") return true;
|
|
12
|
-
if (prefix.endsWith("/")) return pathname === prefix.slice(0, -1) || pathname.startsWith(prefix);
|
|
13
|
-
return pathname === prefix || pathname.startsWith(prefix + "/");
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Derive the mount base path from publicUrl's pathname. Returns '' for an
|
|
17
|
-
* absent/invalid/root pathname, otherwise a leading-slash, no-trailing-slash
|
|
18
|
-
* form ('/myagent'). Mirrors the trailing-slash stripping the proxy's
|
|
19
|
-
* advertised `url` applies, so the base path and `url` stay aligned.
|
|
20
|
-
*/
|
|
21
|
-
function deriveBasePath(publicUrl) {
|
|
22
|
-
const trimmed = publicUrl?.trim();
|
|
23
|
-
if (!trimmed) return "";
|
|
24
|
-
try {
|
|
25
|
-
const url = new URL(trimmed);
|
|
26
|
-
if (!/^https?:$/.test(url.protocol)) return "";
|
|
27
|
-
return url.pathname.replace(/\/+$/, "");
|
|
28
|
-
} catch {
|
|
29
|
-
return "";
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Resolve the proxy info handed to service command/env builders from the
|
|
34
|
-
* configured publicUrl. Single owner of the publicUrl normalization:
|
|
35
|
-
* `publicUrl` must parse as an http(s) URL and is stripped of trailing
|
|
36
|
-
* slashes, undefined when unset/invalid; `basePath` is the URL's pathname
|
|
37
|
-
* normalized like `deriveBasePath`.
|
|
38
|
-
*/
|
|
39
|
-
function resolveServiceProxyContext(publicUrl) {
|
|
40
|
-
const trimmed = publicUrl?.trim();
|
|
41
|
-
if (trimmed) try {
|
|
42
|
-
const url = new URL(trimmed);
|
|
43
|
-
if (/^https?:$/.test(url.protocol)) return {
|
|
44
|
-
publicUrl: trimmed.replace(/\/+$/, ""),
|
|
45
|
-
basePath: url.pathname.replace(/\/+$/, "")
|
|
46
|
-
};
|
|
47
|
-
} catch {}
|
|
48
|
-
return {
|
|
49
|
-
publicUrl: void 0,
|
|
50
|
-
basePath: ""
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Rewrite a loopback `localhost` host to `127.0.0.1` so a pinned-family agent
|
|
55
|
-
* (autoSelectFamily:false) connects deterministically over IPv4 instead of
|
|
56
|
-
* racing `::1`/`127.0.0.1` (Happy-Eyeballs). Preserves any `:port`. Non-loopback
|
|
57
|
-
* hosts are returned unchanged.
|
|
58
|
-
*/
|
|
59
|
-
function normalizeLoopbackHost(host) {
|
|
60
|
-
const [hostname, ...rest] = host.split(":");
|
|
61
|
-
if (hostname.toLowerCase() === "localhost") return ["127.0.0.1", ...rest].join(":");
|
|
62
|
-
return host;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Endpoint types that imply WebSocket transport. Websites need upgrades
|
|
66
|
-
* forwarded for dev-server HMR sockets (Vite connects on the page's own
|
|
67
|
-
* origin/path).
|
|
68
|
-
*/
|
|
69
|
-
function isWsEndpointType(type) {
|
|
70
|
-
return type === "api-mcp" || type === "website";
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Relative-prefix route specs for a Powerhouse Switchboard, usable as
|
|
74
|
-
* `ServiceDefinition.proxyRoutes` specs (mounted under `/{serviceId}/`).
|
|
75
|
-
* The MCP route is included only when `mcpUrl` is provided.
|
|
76
|
-
*/
|
|
77
|
-
function buildSwitchboardRouteSpecs(switchboardUrl, mcpUrl, basePrefix = "switchboard") {
|
|
78
|
-
const sbBase = new URL(switchboardUrl);
|
|
79
|
-
const specs = [
|
|
80
|
-
{
|
|
81
|
-
prefix: `${basePrefix}/graphql`,
|
|
82
|
-
upstream: new URL("/graphql", sbBase),
|
|
83
|
-
ws: false
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
prefix: `${basePrefix}/d/`,
|
|
87
|
-
upstream: new URL("/d/", sbBase),
|
|
88
|
-
ws: false
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
prefix: `${basePrefix}/attachments/`,
|
|
92
|
-
upstream: new URL("/attachments/", sbBase),
|
|
93
|
-
ws: false
|
|
94
|
-
}
|
|
95
|
-
];
|
|
96
|
-
if (mcpUrl) specs.push({
|
|
97
|
-
prefix: `${basePrefix}/mcp`,
|
|
98
|
-
upstream: new URL("/mcp", new URL(mcpUrl)),
|
|
99
|
-
ws: true
|
|
100
|
-
});
|
|
101
|
-
return specs;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Absolute proxy routes for the embedded Switchboard, mounted under
|
|
105
|
-
* `/switchboard` with source `'switchboard'`. The MCP route is included
|
|
106
|
-
* only when `mcpUrl` is provided.
|
|
107
|
-
*/
|
|
108
|
-
function buildSwitchboardRoutes(switchboardUrl, mcpUrl) {
|
|
109
|
-
return buildSwitchboardRouteSpecs(switchboardUrl, mcpUrl).map((spec) => ({
|
|
110
|
-
prefix: `/${spec.prefix}`,
|
|
111
|
-
upstream: spec.upstream,
|
|
112
|
-
ws: spec.ws ?? false,
|
|
113
|
-
source: "switchboard"
|
|
114
|
-
}));
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Browser-facing switchboard URLs through the proxy. Kept next to
|
|
118
|
-
* `buildSwitchboardRoutes` so the `/switchboard` prefix scheme has a single
|
|
119
|
-
* owner — a prefix change here updates both the routes and the URLs handed
|
|
120
|
-
* out to consumers.
|
|
121
|
-
*/
|
|
122
|
-
function buildSwitchboardProxyUrls(proxyUrl, switchboard) {
|
|
123
|
-
return {
|
|
124
|
-
switchboardUrl: `${proxyUrl}/switchboard/graphql`,
|
|
125
|
-
driveUrl: `${proxyUrl}/switchboard${new URL(switchboard.driveUrl).pathname}`,
|
|
126
|
-
mcpUrl: `${proxyUrl}/switchboard/mcp`
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Resolve which website capture implicitly owns the proxy root when none
|
|
131
|
-
* sets `proxyRoot` explicitly. Exactly one website capture across all
|
|
132
|
-
* definitions → that capture (preserves single-SPA behavior for CLIs that
|
|
133
|
-
* predate the flag). Zero, several, or any explicit root → undefined.
|
|
134
|
-
*/
|
|
135
|
-
function resolveImplicitProxyRoot(defs) {
|
|
136
|
-
let single;
|
|
137
|
-
let count = 0;
|
|
138
|
-
for (const def of defs) for (const [captureName, captureDef] of getCapturesForDef(def)) {
|
|
139
|
-
if (typeof captureDef === "number") continue;
|
|
140
|
-
if (captureDef.type !== "website") continue;
|
|
141
|
-
if (captureDef.proxyRoot) return void 0;
|
|
142
|
-
count++;
|
|
143
|
-
single ??= {
|
|
144
|
-
serviceId: def.id,
|
|
145
|
-
captureName
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
return count === 1 ? single : void 0;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Proxy mount prefix for a service route: `/{serviceId}/{name}`. Single
|
|
152
|
-
* owner of the convention used for capture routes and for mounting
|
|
153
|
-
* `ServiceDefinition.proxyRoutes` specs.
|
|
154
|
-
*/
|
|
155
|
-
function captureRoutePrefix(serviceId, captureName) {
|
|
156
|
-
return `/${serviceId}/${captureName}`;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Build proxy routes from a service definition's readiness captures and its
|
|
160
|
-
* `proxyRoutes` hook. Only captures with announceable endpoint types produce
|
|
161
|
-
* routes; hook specs are mounted under `/{serviceId}/`.
|
|
162
|
-
*/
|
|
163
|
-
function buildServiceRoutes(def, instance, implicitRoot, log) {
|
|
164
|
-
const routes = [];
|
|
165
|
-
const captures = getCapturesForDef(def);
|
|
166
|
-
for (const [captureName, captureDef] of captures) {
|
|
167
|
-
const captureType = typeof captureDef === "number" ? void 0 : captureDef.type;
|
|
168
|
-
if (!captureType) continue;
|
|
169
|
-
const url = instance.endpoints?.[captureName];
|
|
170
|
-
if (!url) continue;
|
|
171
|
-
try {
|
|
172
|
-
const upstream = new URL(url);
|
|
173
|
-
const prefix = captureType === "website" && (typeof captureDef !== "number" && captureDef.proxyRoot === true || implicitRoot?.serviceId === def.id && implicitRoot.captureName === captureName) ? "/" : captureRoutePrefix(def.id, captureName);
|
|
174
|
-
routes.push({
|
|
175
|
-
prefix,
|
|
176
|
-
upstream,
|
|
177
|
-
ws: isWsEndpointType(captureType),
|
|
178
|
-
source: `service:${def.id}`
|
|
179
|
-
});
|
|
180
|
-
} catch {}
|
|
181
|
-
}
|
|
182
|
-
if (def.proxyRoutes) {
|
|
183
|
-
let specs = [];
|
|
184
|
-
try {
|
|
185
|
-
specs = def.proxyRoutes(instance) ?? [];
|
|
186
|
-
} catch (err) {
|
|
187
|
-
log?.warn(`proxyRoutes hook failed for service '${def.id}': ${err instanceof Error ? err.message : String(err)}`);
|
|
188
|
-
}
|
|
189
|
-
for (const spec of specs) try {
|
|
190
|
-
const upstream = spec.upstream instanceof URL ? spec.upstream : new URL(spec.upstream);
|
|
191
|
-
routes.push({
|
|
192
|
-
prefix: captureRoutePrefix(def.id, spec.prefix.replace(/^\/+/, "")),
|
|
193
|
-
upstream,
|
|
194
|
-
ws: spec.ws ?? false,
|
|
195
|
-
source: `service:${def.id}`
|
|
196
|
-
});
|
|
197
|
-
} catch (err) {
|
|
198
|
-
log?.warn(`Invalid proxyRoutes spec '${spec.prefix}' for service '${def.id}': ${err instanceof Error ? err.message : String(err)}`);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return routes;
|
|
202
|
-
}
|
|
203
|
-
function getCapturesForDef(def) {
|
|
204
|
-
const result = [];
|
|
205
|
-
if (!def.readiness) return result;
|
|
206
|
-
if (def.readiness.captures) for (const [name, capDef] of Object.entries(def.readiness.captures)) result.push([name, capDef]);
|
|
207
|
-
if (def.readiness.patterns) {
|
|
208
|
-
for (const pattern of def.readiness.patterns) if (pattern.captures) for (const [name, capDef] of Object.entries(pattern.captures)) result.push([name, capDef]);
|
|
209
|
-
}
|
|
210
|
-
return result;
|
|
211
|
-
}
|
|
212
|
-
//#endregion
|
|
213
|
-
export { captureRoutePrefix as a, normalizeLoopbackHost as c, resolveServiceProxyContext as d, buildSwitchboardRoutes as i, prefixMatches as l, buildSwitchboardProxyUrls as n, deriveBasePath as o, buildSwitchboardRouteSpecs as r, isWsEndpointType as s, buildServiceRoutes as t, resolveImplicitProxyRoot as u };
|
|
214
|
-
|
|
215
|
-
//# sourceMappingURL=proxy-routes-DP3ztsnS.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-routes-DP3ztsnS.mjs","names":[],"sources":["../src/core/proxy-routes.ts"],"sourcesContent":["/**\n * Pure functions for building proxy routes from service definitions\n * and Switchboard configuration. No side effects — easily unit-testable.\n */\nimport type {\n ServiceDefinition,\n ServiceInstanceStatus,\n ServiceProxyRouteSpec,\n CaptureDefinition,\n EndpointType,\n} from \"./types.js\";\n\nexport interface ProxyRoute {\n /** URL path prefix matched against incoming requests (e.g. '/switchboard/graphql'). */\n prefix: string;\n /**\n * Upstream target URL (e.g. new URL('http://localhost:4001/graphql')).\n * Optional only for pure redirect routes (`redirectTo` set).\n */\n upstream?: URL;\n /** Whether WebSocket upgrade should be forwarded on this route. */\n ws: boolean;\n /** Origin label for route management (e.g. 'switchboard', 'service:my-svc'). */\n source: string;\n /**\n * When set, matching requests get a 302 to this location instead of being\n * proxied. No upstream connection is made.\n */\n redirectTo?: string;\n /**\n * Match the prefix exactly rather than as a `startsWith` prefix. Exact\n * routes are matched before prefix routes so a `'/'` redirect can coexist\n * with a `'/'` catch-all without shadowing longer prefixes.\n */\n exact?: boolean;\n}\n\n/**\n * Match a route prefix against a request pathname on path-segment boundaries:\n * the prefix matches only when the pathname equals it or continues with a `/`.\n * A bare `startsWith` would let `/foobar` match a `/foo` route. The root prefix\n * `/` matches everything. A prefix already carrying a trailing `/`\n * (e.g. `/switchboard/attachments/`) matches `<prefix>` and `<prefix><rest>`\n * without doubling the separator.\n */\nexport function prefixMatches(prefix: string, pathname: string): boolean {\n if (prefix === \"/\") return true;\n if (prefix.endsWith(\"/\")) {\n return pathname === prefix.slice(0, -1) || pathname.startsWith(prefix);\n }\n return pathname === prefix || pathname.startsWith(prefix + \"/\");\n}\n\n/**\n * Derive the mount base path from publicUrl's pathname. Returns '' for an\n * absent/invalid/root pathname, otherwise a leading-slash, no-trailing-slash\n * form ('/myagent'). Mirrors the trailing-slash stripping the proxy's\n * advertised `url` applies, so the base path and `url` stay aligned.\n */\nexport function deriveBasePath(publicUrl: string | undefined): string {\n const trimmed = publicUrl?.trim();\n if (!trimmed) return \"\";\n try {\n const url = new URL(trimmed);\n // `new URL('localhost:8090')` parses with protocol 'localhost:' —\n // anything but http(s) is treated as invalid.\n if (!/^https?:$/.test(url.protocol)) return \"\";\n return url.pathname.replace(/\\/+$/, \"\");\n } catch {\n return \"\";\n }\n}\n\n/**\n * Resolve the proxy info handed to service command/env builders from the\n * configured publicUrl. Single owner of the publicUrl normalization:\n * `publicUrl` must parse as an http(s) URL and is stripped of trailing\n * slashes, undefined when unset/invalid; `basePath` is the URL's pathname\n * normalized like `deriveBasePath`.\n */\nexport function resolveServiceProxyContext(publicUrl: string | undefined): {\n publicUrl?: string;\n basePath: string;\n} {\n const trimmed = publicUrl?.trim();\n if (trimmed) {\n try {\n const url = new URL(trimmed);\n if (/^https?:$/.test(url.protocol)) {\n return {\n publicUrl: trimmed.replace(/\\/+$/, \"\"),\n basePath: url.pathname.replace(/\\/+$/, \"\"),\n };\n }\n } catch {\n // invalid publicUrl — treat as unset\n }\n }\n return { publicUrl: undefined, basePath: \"\" };\n}\n\n/**\n * Rewrite a loopback `localhost` host to `127.0.0.1` so a pinned-family agent\n * (autoSelectFamily:false) connects deterministically over IPv4 instead of\n * racing `::1`/`127.0.0.1` (Happy-Eyeballs). Preserves any `:port`. Non-loopback\n * hosts are returned unchanged.\n */\nexport function normalizeLoopbackHost(host: string): string {\n const [hostname, ...rest] = host.split(\":\");\n if (hostname.toLowerCase() === \"localhost\") {\n return [\"127.0.0.1\", ...rest].join(\":\");\n }\n return host;\n}\n\n/**\n * Endpoint types that imply WebSocket transport. Websites need upgrades\n * forwarded for dev-server HMR sockets (Vite connects on the page's own\n * origin/path).\n */\nexport function isWsEndpointType(type: EndpointType): boolean {\n return type === \"api-mcp\" || type === \"website\";\n}\n\n/**\n * Relative-prefix route specs for a Powerhouse Switchboard, usable as\n * `ServiceDefinition.proxyRoutes` specs (mounted under `/{serviceId}/`).\n * The MCP route is included only when `mcpUrl` is provided.\n */\nexport function buildSwitchboardRouteSpecs(\n switchboardUrl: string,\n mcpUrl?: string,\n basePrefix = \"switchboard\",\n): Array<ServiceProxyRouteSpec & { upstream: URL }> {\n const sbBase = new URL(switchboardUrl);\n\n const specs: Array<ServiceProxyRouteSpec & { upstream: URL }> = [\n {\n prefix: `${basePrefix}/graphql`,\n upstream: new URL(\"/graphql\", sbBase),\n ws: false,\n },\n {\n prefix: `${basePrefix}/d/`,\n upstream: new URL(\"/d/\", sbBase),\n ws: false,\n },\n {\n prefix: `${basePrefix}/attachments/`,\n upstream: new URL(\"/attachments/\", sbBase),\n ws: false,\n },\n ];\n if (mcpUrl) {\n specs.push({\n prefix: `${basePrefix}/mcp`,\n upstream: new URL(\"/mcp\", new URL(mcpUrl)),\n ws: true,\n });\n }\n return specs;\n}\n\n/**\n * Absolute proxy routes for the embedded Switchboard, mounted under\n * `/switchboard` with source `'switchboard'`. The MCP route is included\n * only when `mcpUrl` is provided.\n */\nexport function buildSwitchboardRoutes(\n switchboardUrl: string,\n mcpUrl?: string,\n): Array<ProxyRoute & { upstream: URL }> {\n return buildSwitchboardRouteSpecs(switchboardUrl, mcpUrl).map((spec) => ({\n prefix: `/${spec.prefix}`,\n upstream: spec.upstream,\n ws: spec.ws ?? false,\n source: \"switchboard\",\n }));\n}\n\n/**\n * Browser-facing switchboard URLs through the proxy. Kept next to\n * `buildSwitchboardRoutes` so the `/switchboard` prefix scheme has a single\n * owner — a prefix change here updates both the routes and the URLs handed\n * out to consumers.\n */\nexport function buildSwitchboardProxyUrls(\n proxyUrl: string,\n switchboard: { driveUrl: string },\n): { switchboardUrl: string; driveUrl: string; mcpUrl: string } {\n return {\n switchboardUrl: `${proxyUrl}/switchboard/graphql`,\n driveUrl: `${proxyUrl}/switchboard${new URL(switchboard.driveUrl).pathname}`,\n mcpUrl: `${proxyUrl}/switchboard/mcp`,\n };\n}\n\n/** A (serviceId, captureName) pair identifying the proxy-root website. */\nexport interface ProxyRootCapture {\n serviceId: string;\n captureName: string;\n}\n\n/**\n * Resolve which website capture implicitly owns the proxy root when none\n * sets `proxyRoot` explicitly. Exactly one website capture across all\n * definitions → that capture (preserves single-SPA behavior for CLIs that\n * predate the flag). Zero, several, or any explicit root → undefined.\n */\nexport function resolveImplicitProxyRoot(\n defs: ServiceDefinition[],\n): ProxyRootCapture | undefined {\n let single: ProxyRootCapture | undefined;\n let count = 0;\n for (const def of defs) {\n for (const [captureName, captureDef] of getCapturesForDef(def)) {\n if (typeof captureDef === \"number\") continue;\n if (captureDef.type !== \"website\") continue;\n if (captureDef.proxyRoot) return undefined;\n count++;\n single ??= { serviceId: def.id, captureName };\n }\n }\n return count === 1 ? single : undefined;\n}\n\n/**\n * Proxy mount prefix for a service route: `/{serviceId}/{name}`. Single\n * owner of the convention used for capture routes and for mounting\n * `ServiceDefinition.proxyRoutes` specs.\n */\nexport function captureRoutePrefix(\n serviceId: string,\n captureName: string,\n): string {\n return `/${serviceId}/${captureName}`;\n}\n\n/**\n * Build proxy routes from a service definition's readiness captures and its\n * `proxyRoutes` hook. Only captures with announceable endpoint types produce\n * routes; hook specs are mounted under `/{serviceId}/`.\n */\nexport function buildServiceRoutes(\n def: ServiceDefinition,\n instance: ServiceInstanceStatus,\n implicitRoot?: ProxyRootCapture,\n log?: { warn(msg: string): void },\n): ProxyRoute[] {\n const routes: ProxyRoute[] = [];\n const captures = getCapturesForDef(def);\n\n for (const [captureName, captureDef] of captures) {\n const captureType =\n typeof captureDef === \"number\" ? undefined : captureDef.type;\n if (!captureType) continue;\n\n const url = instance.endpoints?.[captureName];\n if (!url) continue;\n\n try {\n const upstream = new URL(url);\n // Only the proxy-root capture claims the '/' catch-all — the primary\n // SPA whose root-relative asset requests (/assets/*, /icon.ico) must\n // resolve at the proxy root. Either flagged `proxyRoot` explicitly, or\n // the implicit fallback when it is the only website across all\n // services. Every other endpoint, websites included, is routed under\n // its own prefix; prefixed websites must serve themselves under that\n // base path.\n const proxyRoot =\n captureType === \"website\" &&\n ((typeof captureDef !== \"number\" && captureDef.proxyRoot === true) ||\n (implicitRoot?.serviceId === def.id &&\n implicitRoot.captureName === captureName));\n const prefix = proxyRoot ? \"/\" : captureRoutePrefix(def.id, captureName);\n routes.push({\n prefix,\n upstream,\n ws: isWsEndpointType(captureType),\n source: `service:${def.id}`,\n });\n } catch {\n // Skip invalid URLs\n }\n }\n\n if (def.proxyRoutes) {\n let specs: ServiceProxyRouteSpec[] = [];\n try {\n specs = def.proxyRoutes(instance) ?? [];\n } catch (err) {\n // Skip a throwing hook — capture routes still apply\n log?.warn(\n `proxyRoutes hook failed for service '${def.id}': ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n for (const spec of specs) {\n try {\n const upstream =\n spec.upstream instanceof URL ? spec.upstream : new URL(spec.upstream);\n routes.push({\n prefix: captureRoutePrefix(def.id, spec.prefix.replace(/^\\/+/, \"\")),\n upstream,\n ws: spec.ws ?? false,\n source: `service:${def.id}`,\n });\n } catch (err) {\n // Skip invalid upstream URLs — other specs still apply\n log?.warn(\n `Invalid proxyRoutes spec '${spec.prefix}' for service '${def.id}': ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n }\n\n return routes;\n}\n\nfunction getCapturesForDef(\n def: ServiceDefinition,\n): Array<[string, number | CaptureDefinition]> {\n const result: Array<[string, number | CaptureDefinition]> = [];\n if (!def.readiness) return result;\n\n if (def.readiness.captures) {\n for (const [name, capDef] of Object.entries(def.readiness.captures)) {\n result.push([name, capDef]);\n }\n }\n\n if (def.readiness.patterns) {\n for (const pattern of def.readiness.patterns) {\n if (pattern.captures) {\n for (const [name, capDef] of Object.entries(pattern.captures)) {\n result.push([name, capDef]);\n }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,MAAM,SAAsD,CAAC;CAC7D,IAAI,CAAC,IAAI,WAAW,OAAO;CAE3B,IAAI,IAAI,UAAU,UAChB,KAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,IAAI,UAAU,QAAQ,GAChE,OAAO,KAAK,CAAC,MAAM,MAAM,CAAC;CAI9B,IAAI,IAAI,UAAU,UACX;OAAA,MAAM,WAAW,IAAI,UAAU,UAClC,IAAI,QAAQ,UACV,KAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,QAAQ,QAAQ,GAC1D,OAAO,KAAK,CAAC,MAAM,MAAM,CAAC;CAAA;CAMlC,OAAO;AACT"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
-
//#region src/integrations/powerhouse/reactor.ts
|
|
3
|
-
var reactor_exports = /* @__PURE__ */ __exportAll({ buildReactor: () => buildReactor });
|
|
4
|
-
/**
|
|
5
|
-
* Build a ReactorClientModule with persistent PGlite storage.
|
|
6
|
-
*
|
|
7
|
-
* All imports are lazy — @powerhousedao/reactor and @electric-sql/pglite
|
|
8
|
-
* are optional peer dependencies.
|
|
9
|
-
*
|
|
10
|
-
* PGlite opens an existing database if the directory exists, or creates
|
|
11
|
-
* a new one if it doesn't. This makes the Reactor persistent across
|
|
12
|
-
* CLI restarts — same path, same data.
|
|
13
|
-
*/
|
|
14
|
-
async function buildReactor(options) {
|
|
15
|
-
const { mkdir } = await import("node:fs/promises");
|
|
16
|
-
await mkdir(options.storagePath, { recursive: true });
|
|
17
|
-
const reactor = await import("@powerhousedao/reactor");
|
|
18
|
-
const pgliteMod = await import("@electric-sql/pglite");
|
|
19
|
-
const kyselyMod = await import("./esm-C1DOsF1a.mjs").then((n) => n.t);
|
|
20
|
-
const dialectMod = await import("./dist-CUltriBW.mjs");
|
|
21
|
-
const ReactorBuilder = reactor.ReactorBuilder;
|
|
22
|
-
const ReactorClientBuilder = reactor.ReactorClientBuilder;
|
|
23
|
-
const PGlite = pgliteMod.PGlite;
|
|
24
|
-
const Kysely = kyselyMod.Kysely;
|
|
25
|
-
const PGliteDialect = dialectMod.PGliteDialect;
|
|
26
|
-
const kysely = new Kysely({ dialect: new PGliteDialect(new PGlite(options.storagePath)) });
|
|
27
|
-
const { createLocalSigner } = await import("./local-signer-EFzJV3bn.mjs");
|
|
28
|
-
const signer = await createLocalSigner();
|
|
29
|
-
const reactorBuilder = new ReactorBuilder().withKysely(kysely);
|
|
30
|
-
const clientBuilder = new ReactorClientBuilder().withReactorBuilder(reactorBuilder).withSigner(signer);
|
|
31
|
-
if (options.enableSync) (await import("@powerhousedao/switchboard/server")).applySwitchboardReactorDefaults(reactorBuilder, clientBuilder, {
|
|
32
|
-
documentModels: options.documentModels,
|
|
33
|
-
signalHandlers: false
|
|
34
|
-
});
|
|
35
|
-
else {
|
|
36
|
-
const sharedMod = await import("@powerhousedao/shared/document-drive");
|
|
37
|
-
const docModelMod = await import("document-model");
|
|
38
|
-
const driveDocumentModelModule = sharedMod.driveDocumentModelModule;
|
|
39
|
-
const documentModelDocumentModelModule = docModelMod.documentModelDocumentModelModule;
|
|
40
|
-
reactorBuilder.withDocumentModelSources([
|
|
41
|
-
documentModelDocumentModelModule,
|
|
42
|
-
driveDocumentModelModule,
|
|
43
|
-
...options.documentModels
|
|
44
|
-
]);
|
|
45
|
-
}
|
|
46
|
-
return clientBuilder.buildModule();
|
|
47
|
-
}
|
|
48
|
-
//#endregion
|
|
49
|
-
export { reactor_exports as t };
|
|
50
|
-
|
|
51
|
-
//# sourceMappingURL=reactor-C9VIUX1H.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reactor-C9VIUX1H.mjs","names":[],"sources":["../src/integrations/powerhouse/reactor.ts"],"sourcesContent":["/**\n * Reactor builder — lazy-loads @powerhousedao/reactor and creates\n * a ReactorClientModule with persistent PGlite storage.\n */\n\nimport type { DocumentModelModule } from \"document-model\";\nimport type { ReactorClientModule } from \"./types.js\";\n\n/** Structural type for the @powerhousedao/reactor ReactorBuilder (fluent API). */\ninterface ReactorBuilderLike {\n withDocumentModelSources(m: DocumentModelModule[]): ReactorBuilderLike;\n withKysely(k: unknown): ReactorBuilderLike;\n}\n\ninterface ReactorClientBuilderLike {\n withReactorBuilder(r: unknown): ReactorClientBuilderLike;\n /** NOTE(port): the signer lives on the CLIENT builder — v2-required stacks\n * refuse unsigned writes, and the reactor builder's signer does not sign\n * client submissions. */\n withSigner(s: unknown): ReactorClientBuilderLike;\n buildModule(): Promise<ReactorClientModule>;\n}\n\n/**\n * Structural shape of the switchboard helpers we call into. Loaded via\n * dynamic import so `@powerhousedao/switchboard` stays an optional peer.\n */\ninterface SwitchboardServerEntry {\n applySwitchboardReactorDefaults(\n reactorBuilder: unknown,\n clientBuilder: unknown,\n options?: {\n documentModels?: DocumentModelModule[];\n includeBaseModels?: boolean;\n includeVetraModels?: boolean;\n signalHandlers?: boolean;\n },\n ): void;\n}\n\nexport interface BuildReactorOptions {\n /** Document model modules to register. */\n documentModels: DocumentModelModule[];\n /** Absolute path to the persistent PGlite directory. */\n storagePath: string;\n /**\n * Apply switchboard's reactor wiring so the module can be wrapped with\n * `startSwitchboard` later. Pulls in channel scheme, base document models,\n * the reactor-drive read model, etc. via `@powerhousedao/switchboard`'s\n * `applySwitchboardReactorDefaults`. Leave false for standalone reactors.\n */\n enableSync?: boolean;\n}\n\n/**\n * Build a ReactorClientModule with persistent PGlite storage.\n *\n * All imports are lazy — @powerhousedao/reactor and @electric-sql/pglite\n * are optional peer dependencies.\n *\n * PGlite opens an existing database if the directory exists, or creates\n * a new one if it doesn't. This makes the Reactor persistent across\n * CLI restarts — same path, same data.\n */\nexport async function buildReactor(\n options: BuildReactorOptions,\n): Promise<ReactorClientModule> {\n // Ensure the storage directory exists\n const { mkdir } = await import(\"node:fs/promises\");\n await mkdir(options.storagePath, { recursive: true });\n\n const reactor = (await import(\"@powerhousedao/reactor\")) as unknown as Record<\n string,\n unknown\n >;\n const pgliteMod = (await import(\"@electric-sql/pglite\")) as unknown as Record<\n string,\n unknown\n >;\n const kyselyMod = (await import(\"kysely\")) as unknown as Record<\n string,\n unknown\n >;\n const dialectMod =\n (await import(\"kysely-pglite-dialect\")) as unknown as Record<\n string,\n unknown\n >;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- dynamic peer dep\n const ReactorBuilder = reactor.ReactorBuilder as new () => ReactorBuilderLike;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- dynamic peer dep\n const ReactorClientBuilder =\n reactor.ReactorClientBuilder as new () => ReactorClientBuilderLike;\n const PGlite = pgliteMod.PGlite as new (path: string) => unknown;\n const Kysely = kyselyMod.Kysely as new (opts: {\n dialect: unknown;\n }) => unknown;\n const PGliteDialect = dialectMod.PGliteDialect as new (\n pglite: unknown,\n ) => unknown;\n\n const pglite = new PGlite(options.storagePath);\n const kysely = new Kysely({ dialect: new PGliteDialect(pglite) });\n\n // NOTE(port): the modern stack creates documents v2-required by default and\n // refuses unsigned writes (UNSIGNED_REQUIRED); the embedded reactor signs\n // with a fresh local key, same posture as reactor-monitor's provision.\n const { createLocalSigner } = await import(\"./local-signer.js\");\n const signer = await createLocalSigner();\n\n const reactorBuilder = new ReactorBuilder().withKysely(kysely);\n const clientBuilder = new ReactorClientBuilder()\n .withReactorBuilder(reactorBuilder)\n .withSigner(signer);\n\n if (options.enableSync) {\n // Switchboard owns the standard reactor wiring (channel scheme, base\n // + vetra document models, executor config, etc.). We opt out of signal\n // handlers because ph-clint manages SIGINT itself. The reactor-drive\n // read model + projection are skipped for now — ph-clint doesn't expose\n // its kysely to switchboard yet, so that subgraph stays disabled. See\n // `createReactorDriveProjection` in `@powerhousedao/switchboard/server`\n // for adding it later.\n const sw =\n (await import(\"@powerhousedao/switchboard/server\")) as unknown as SwitchboardServerEntry;\n sw.applySwitchboardReactorDefaults(reactorBuilder, clientBuilder, {\n documentModels: options.documentModels,\n signalHandlers: false,\n });\n } else {\n // Standalone reactor: register only the document models ph-clint needs.\n const sharedMod =\n (await import(\"@powerhousedao/shared/document-drive\")) as unknown as Record<\n string,\n unknown\n >;\n const docModelMod = (await import(\"document-model\")) as unknown as Record<\n string,\n unknown\n >;\n const driveDocumentModelModule =\n sharedMod.driveDocumentModelModule as DocumentModelModule;\n const documentModelDocumentModelModule =\n docModelMod.documentModelDocumentModelModule as DocumentModelModule;\n reactorBuilder.withDocumentModelSources([\n documentModelDocumentModelModule,\n driveDocumentModelModule,\n ...options.documentModels,\n ]);\n }\n\n return clientBuilder.buildModule();\n}\n"],"mappings":";;;;;;;;;;;;;AAgEA,eAAsB,aACpB,SAC8B;CAE9B,MAAM,EAAE,UAAU,MAAM,OAAO;CAC/B,MAAM,MAAM,QAAQ,aAAa,EAAE,WAAW,KAAK,CAAC;CAEpD,MAAM,UAAW,MAAM,OAAO;CAI9B,MAAM,YAAa,MAAM,OAAO;CAIhC,MAAM,YAAa,MAAM,OAAO,qBAAS,CAAA,MAAA,MAAA,EAAA,CAAA;CAIzC,MAAM,aACH,MAAM,OAAO;CAMhB,MAAM,iBAAiB,QAAQ;CAE/B,MAAM,uBACJ,QAAQ;CACV,MAAM,SAAS,UAAU;CACzB,MAAM,SAAS,UAAU;CAGzB,MAAM,gBAAgB,WAAW;CAKjC,MAAM,SAAS,IAAI,OAAO,EAAE,SAAS,IAAI,cAAc,IADpC,OAAO,QAAQ,WAC0B,CAAC,EAAE,CAAC;CAKhE,MAAM,EAAE,sBAAsB,MAAM,OAAO;CAC3C,MAAM,SAAS,MAAM,kBAAkB;CAEvC,MAAM,iBAAiB,IAAI,eAAe,CAAC,CAAC,WAAW,MAAM;CAC7D,MAAM,gBAAgB,IAAI,qBAAqB,CAAC,CAC7C,mBAAmB,cAAc,CAAC,CAClC,WAAW,MAAM;CAEpB,IAAI,QAAQ,YAUV,CAAA,MADS,OAAO,qCAAA,CACb,gCAAgC,gBAAgB,eAAe;EAChE,gBAAgB,QAAQ;EACxB,gBAAgB;CAClB,CAAC;MACI;EAEL,MAAM,YACH,MAAM,OAAO;EAIhB,MAAM,cAAe,MAAM,OAAO;EAIlC,MAAM,2BACJ,UAAU;EACZ,MAAM,mCACJ,YAAY;EACd,eAAe,yBAAyB;GACtC;GACA;GACA,GAAG,QAAQ;EACb,CAAC;CACH;CAEA,OAAO,cAAc,YAAY;AACnC"}
|