@nimbus-sh/worker 0.4.0 → 0.5.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/README.md +46 -43
- package/dist/_shared/preview-host.d.ts +14 -1
- package/dist/_shared/preview-host.d.ts.map +1 -1
- package/dist/_shared/preview-host.js +28 -3
- package/dist/_shared/session-router.d.ts +43 -0
- package/dist/_shared/session-router.d.ts.map +1 -1
- package/dist/_shared/session-router.js +59 -12
- package/dist/facets/durable-images.d.ts +50 -0
- package/dist/facets/durable-images.d.ts.map +1 -0
- package/dist/facets/durable-images.js +75 -0
- package/dist/facets/durable-slots.d.ts +45 -0
- package/dist/facets/durable-slots.d.ts.map +1 -0
- package/dist/facets/durable-slots.js +94 -0
- package/dist/facets/esbuild-transform.d.ts +10 -0
- package/dist/facets/esbuild-transform.d.ts.map +1 -0
- package/dist/facets/esbuild-transform.js +36 -0
- package/dist/facets/manager.d.ts +160 -5
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +554 -97
- package/dist/git/commands.d.ts +22 -0
- package/dist/git/commands.d.ts.map +1 -1
- package/dist/git/commands.js +431 -424
- package/dist/git-bundle.generated.d.ts +2 -2
- package/dist/git-bundle.generated.d.ts.map +1 -1
- package/dist/git-bundle.generated.js +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/node-shims-artifact.generated.js +3 -3
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +59 -2
- package/dist/router/public-directory-do.d.ts +17 -0
- package/dist/router/public-directory-do.d.ts.map +1 -0
- package/dist/router/public-directory-do.js +16 -0
- package/dist/router/public-directory.d.ts +75 -0
- package/dist/router/public-directory.d.ts.map +1 -0
- package/dist/router/public-directory.js +115 -0
- package/dist/router/remote-api.d.ts +9 -1
- package/dist/router/remote-api.d.ts.map +1 -1
- package/dist/router/remote-api.js +19 -2
- package/dist/runtime/node-shims.d.ts +4 -1
- package/dist/runtime/node-shims.d.ts.map +1 -1
- package/dist/runtime/node-shims.js +324 -6
- package/dist/session/agent.d.ts +11 -0
- package/dist/session/agent.d.ts.map +1 -1
- package/dist/session/helpers.js +1 -1
- package/dist/session/init-phases.d.ts +17 -23
- package/dist/session/init-phases.d.ts.map +1 -1
- package/dist/session/init-phases.js +17 -41
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +19 -15
- package/dist/session/keys.d.ts +8 -0
- package/dist/session/keys.d.ts.map +1 -1
- package/dist/session/keys.js +8 -0
- package/dist/session/nimbus-session.d.ts +29 -4
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +62 -9
- package/dist/session/port-capability.d.ts +95 -8
- package/dist/session/port-capability.d.ts.map +1 -1
- package/dist/session/port-capability.js +165 -8
- package/dist/session/programmatic.d.ts +50 -2
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +104 -6
- package/dist/session/routes.d.ts +17 -0
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +92 -25
- package/dist/session/rpc.d.ts.map +1 -1
- package/dist/session/rpc.js +14 -4
- package/dist/session/shell-socket.d.ts +76 -0
- package/dist/session/shell-socket.d.ts.map +1 -0
- package/dist/session/shell-socket.js +172 -0
- package/dist/session/start-real-vite.js +1 -1
- package/dist/session/supervisor-op.d.ts +5 -0
- package/dist/session/supervisor-op.d.ts.map +1 -0
- package/dist/session/supervisor-op.js +74 -0
- package/dist/session/supervisor-rpc.d.ts +6 -10
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +91 -70
- package/dist/session/ws.d.ts.map +1 -1
- package/dist/session/ws.js +19 -4
- package/package.json +4 -4
- package/public/_assets/runtime/{node-shims-fea906843f6d594e.js → node-shims-9e1380d9ee430fcc.js} +320 -5
- package/public/s/index.html +101 -5
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* runtime and generated assets in one place.
|
|
23
23
|
*/
|
|
24
24
|
import { NimbusSession, NimbusAssetsRPC, NimbusLoaderRPC, NimbusLoadedWorker, NimbusLoadedEntrypoint, NimbusDurableObjectNamespace, NimbusDOStub } from './session/nimbus-session.js';
|
|
25
|
+
import { NimbusPublicDirectory } from './router/public-directory-do.js';
|
|
25
26
|
import { SupervisorRPC } from './session/supervisor-rpc.js';
|
|
26
27
|
import { CirrusHmrRPC } from './facets/real-vite-hmr.js';
|
|
27
28
|
export { createNimbusHandler } from './router/index.js';
|
|
@@ -36,7 +37,7 @@ export { base64Utf8, base64Url, base64UrlDecode, decodeJsonBase64Url, encodeJson
|
|
|
36
37
|
export { clearNimbusAgentOAuthCookie, createNimbusAgentOAuthCookie, fetchNimbusCloudflareAccounts, fetchNimbusCloudflareUserInfo, isNimbusCloudflareAccountId, isNimbusTenantSegment, loadNimbusAgentOAuthFromRequest, nimbusAgentAuthCookiePath, nimbusAgentRouteContext, NIMBUS_AGENT_AUTH_COOKIE, NIMBUS_AGENT_AUTH_COOKIE_PURPOSE, NIMBUS_AGENT_AUTH_COOKIE_TTL_SECONDS, NIMBUS_CF_OAUTH_AUTH_URL, NIMBUS_CF_OAUTH_TOKEN_URL, NIMBUS_CF_OAUTH_USERINFO_URL, NIMBUS_CLOUDFLARE_API, readNimbusAgentCookieSecret, readNimbusCookie, requestNimbusCloudflareOAuthToken, serializeNimbusCookie, } from './session/agent-oauth.js';
|
|
37
38
|
export type { NimbusAgentOAuthCookie, NimbusCloudflareAccount, } from './session/agent-oauth.js';
|
|
38
39
|
export type { NimbusAuthEnv, NimbusTokenClaims, VerifiedNimbusToken, } from './auth/index.js';
|
|
39
|
-
export { NimbusSession, SupervisorRPC, NimbusAssetsRPC, NimbusLoaderRPC, NimbusLoadedWorker, NimbusLoadedEntrypoint, NimbusDurableObjectNamespace, NimbusDOStub, CirrusHmrRPC, };
|
|
40
|
+
export { NimbusSession, NimbusPublicDirectory, SupervisorRPC, NimbusAssetsRPC, NimbusLoaderRPC, NimbusLoadedWorker, NimbusLoadedEntrypoint, NimbusDurableObjectNamespace, NimbusDOStub, CirrusHmrRPC, };
|
|
40
41
|
/**
|
|
41
42
|
* Module-level reference to ctx.exports from the fetch handler.
|
|
42
43
|
* Used by NimbusSession to create loopback bindings for facets.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,4BAA4B,EAC5B,YAAY,EACb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAWzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,YAAY,EACV,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,0BAA0B,EAC1B,QAAQ,EACR,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAC;AAChF,YAAY,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAC5F,YAAY,EACV,WAAW,EACX,eAAe,EACf,MAAM,EACN,QAAQ,EACR,eAAe,GAChB,MAAM,yCAAyC,CAAC;AACjD,OAA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B,EACjB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AA4BzB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,4BAA4B,EAC5B,YAAY,EACZ,YAAY,GACb,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,GAAG,CAEnC;;AAOD,wBAAqC"}
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* runtime and generated assets in one place.
|
|
23
23
|
*/
|
|
24
24
|
import { NimbusSession, NimbusAssetsRPC, NimbusLoaderRPC, NimbusLoadedWorker, NimbusLoadedEntrypoint, NimbusDurableObjectNamespace, NimbusDOStub, } from './session/nimbus-session.js';
|
|
25
|
+
import { NimbusPublicDirectory } from './router/public-directory-do.js';
|
|
25
26
|
import { SupervisorRPC } from './session/supervisor-rpc.js';
|
|
26
27
|
import { CirrusHmrRPC } from './facets/real-vite-hmr.js';
|
|
27
28
|
import { createNimbusHandler } from './router/index.js';
|
|
@@ -71,7 +72,7 @@ setRegistryEventSink((e) => {
|
|
|
71
72
|
// Re-export inner-Worker binding shims so wrangler bundles them AND
|
|
72
73
|
// ctx.exports auto-populates Service Bindings for them (via
|
|
73
74
|
// enable_ctx_exports; default at compat date 2026-04-01+).
|
|
74
|
-
export { NimbusSession, SupervisorRPC, NimbusAssetsRPC, NimbusLoaderRPC, NimbusLoadedWorker, NimbusLoadedEntrypoint, NimbusDurableObjectNamespace, NimbusDOStub, CirrusHmrRPC, };
|
|
75
|
+
export { NimbusSession, NimbusPublicDirectory, SupervisorRPC, NimbusAssetsRPC, NimbusLoaderRPC, NimbusLoadedWorker, NimbusLoadedEntrypoint, NimbusDurableObjectNamespace, NimbusDOStub, CirrusHmrRPC, };
|
|
75
76
|
/**
|
|
76
77
|
* Module-level reference to ctx.exports from the fetch handler.
|
|
77
78
|
* Used by NimbusSession to create loopback bindings for facets.
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* prefix so cache layers never serve stale bytes after a rebuild;
|
|
8
8
|
* NODE_SHIMS_SHA256 is the full digest verified at fetch time.
|
|
9
9
|
*/
|
|
10
|
-
export const NODE_SHIMS_ENTRY = "/_assets/runtime/node-shims-
|
|
11
|
-
export const NODE_SHIMS_BUILD_ID = "
|
|
12
|
-
export const NODE_SHIMS_SHA256 = "
|
|
10
|
+
export const NODE_SHIMS_ENTRY = "/_assets/runtime/node-shims-9e1380d9ee430fcc.js";
|
|
11
|
+
export const NODE_SHIMS_BUILD_ID = "9e1380d9ee430fcc";
|
|
12
|
+
export const NODE_SHIMS_SHA256 = "9e1380d9ee430fcca4e8700a97da811eee0fe7e9cab4c6357e94c3fc21efa2d9";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAuCH,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,iBAAiB,CAAC;AA+BzB,YAAY,EACV,YAAY,IAAI,eAAe,EAC/B,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oDAAoD;IACpD,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB;IACpB,GAAG,EAAE,GAAG,CAAC;CACV;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;OAMG;IACH,cAAc,CAAC,CAAC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{ generateSessionId, isValidSessionId, } from '../_shared/session-id.js';
|
|
35
35
|
import { buildPreviewHost, isPreviewHostSafeSid, parsePreviewHost, readPreviewHostSuffix, } from '../_shared/preview-host.js';
|
|
36
|
-
import { parseSessionRoute, forwardToSession, renderInvalidSessionHtml, SESSION_ROUTE_PREFIX, LEGACY_PUBLIC_DO_SEGMENT, } from '../_shared/session-router.js';
|
|
36
|
+
import { parseSessionRoute, forwardToSession, renderInvalidSessionHtml, SESSION_ROUTE_PREFIX, LEGACY_PUBLIC_DO_SEGMENT, PREVIEW_CAPABILITY_HEADER, PUBLIC_BEARER_HEADER, } from '../_shared/session-router.js';
|
|
37
37
|
import { issueNimbusToken, verifyNimbusToken, verifyRequestToken, requireScopes, requireSessionPin, authErrorResponse, setNimbusTokenCookie, NIMBUS_TOKEN_QUERY, NimbusAuthError, NimbusBootstrapConsumedError, NimbusTokenClaimsError, DEFAULT_TOKEN_TTL_MS, ATTACH_BOOTSTRAP_TTL_MS, } from '../auth/index.js';
|
|
38
38
|
import { adoptCtxExports } from '@nimbus-sh/fabric/composition.js';
|
|
39
39
|
import { handleNimbusRemoteApi, } from './remote-api.js';
|
|
40
40
|
import { parseAgentOAuthStateParam } from '../session/agent.js';
|
|
41
|
+
import { publicDirectoryStub } from './public-directory.js';
|
|
42
|
+
/**
|
|
43
|
+
* Positive directory resolutions, per isolate. A capability that resolved
|
|
44
|
+
* once keeps resolving — the row is deleted only when the port goes
|
|
45
|
+
* private, and a stale cache entry 404s honestly at the session's own
|
|
46
|
+
* visibility check anyway. Misses are never cached.
|
|
47
|
+
*/
|
|
48
|
+
const publicTenantCache = new Map();
|
|
49
|
+
/**
|
|
50
|
+
* The tenant segment a public capability URL forwards under. The directory
|
|
51
|
+
* is consulted first; a deployment without the binding falls back to the
|
|
52
|
+
* legacy-public DO name, which is where legacy-mode sessions already live.
|
|
53
|
+
*/
|
|
54
|
+
async function resolvePublicTenantSegment(capability, env) {
|
|
55
|
+
const cached = publicTenantCache.get(capability);
|
|
56
|
+
if (cached !== undefined)
|
|
57
|
+
return cached;
|
|
58
|
+
const stub = publicDirectoryStub(env);
|
|
59
|
+
if (stub === null)
|
|
60
|
+
return LEGACY_PUBLIC_DO_SEGMENT;
|
|
61
|
+
const entry = await stub.resolve(capability).catch(() => null);
|
|
62
|
+
if (entry === null) {
|
|
63
|
+
// An unresolvable capability 404s: no session DO is named for it.
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
publicTenantCache.set(capability, entry.tenantSegment);
|
|
67
|
+
return entry.tenantSegment;
|
|
68
|
+
}
|
|
41
69
|
/**
|
|
42
70
|
* Build a Nimbus default-export handler. The returned object is exactly
|
|
43
71
|
* what `export default` expects in a Workers entry module.
|
|
@@ -102,6 +130,30 @@ export function createNimbusHandler(options = {}) {
|
|
|
102
130
|
},
|
|
103
131
|
});
|
|
104
132
|
}
|
|
133
|
+
if (preview.capability !== undefined) {
|
|
134
|
+
// The public capability form carries no attach token and never
|
|
135
|
+
// asks for one: the capability IS the bearer, so there is no
|
|
136
|
+
// session:attach exchange and no embedder credential to verify.
|
|
137
|
+
// The capability names the owning session through the public
|
|
138
|
+
// directory — a positive hit is cached for the life of this
|
|
139
|
+
// isolate, a miss 404s, and a deployment without the binding
|
|
140
|
+
// falls back to the legacy-public DO name.
|
|
141
|
+
const tenantSegment = await resolvePublicTenantSegment(preview.capability, env);
|
|
142
|
+
if (tenantSegment === null) {
|
|
143
|
+
return new Response('Not found', { status: 404 });
|
|
144
|
+
}
|
|
145
|
+
return forwardToSession(request, {
|
|
146
|
+
sessionId: preview.sid,
|
|
147
|
+
innerPath: `/port/${preview.port}${url.pathname === '/' ? '/' : url.pathname}`,
|
|
148
|
+
basePath: '',
|
|
149
|
+
}, env, {
|
|
150
|
+
tenantSegment,
|
|
151
|
+
extraHeaders: {
|
|
152
|
+
[PREVIEW_CAPABILITY_HEADER]: preview.capability,
|
|
153
|
+
[PUBLIC_BEARER_HEADER]: '1',
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
}
|
|
105
157
|
if (request.method === 'GET'
|
|
106
158
|
&& request.headers.get('Upgrade') !== 'websocket'
|
|
107
159
|
&& url.searchParams.get(NIMBUS_TOKEN_QUERY)
|
|
@@ -281,7 +333,12 @@ export function createNimbusHandler(options = {}) {
|
|
|
281
333
|
console.warn('[nimbus] onSessionStart hook threw synchronously:', e);
|
|
282
334
|
}
|
|
283
335
|
}
|
|
284
|
-
return forwardToSession(request, route, env, {
|
|
336
|
+
return forwardToSession(request, route, env, {
|
|
337
|
+
tenantSegment,
|
|
338
|
+
...(auth.verified?.claims.scopes !== undefined
|
|
339
|
+
? { callerScopes: auth.verified.claims.scopes }
|
|
340
|
+
: {}),
|
|
341
|
+
});
|
|
285
342
|
}
|
|
286
343
|
// ── Back-compat legacy root paths → landing page ────────────────
|
|
287
344
|
if (isLegacyRootPath(url.pathname)) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* public-directory-do.ts — the NimbusPublicDirectory Durable Object class.
|
|
3
|
+
*
|
|
4
|
+
* Lives apart from `public-directory.ts` so the session-side helpers and
|
|
5
|
+
* the router-side stub stay importable outside workerd — this file alone
|
|
6
|
+
* needs `cloudflare:workers` for `DurableObject`. The wrangler binding
|
|
7
|
+
* name and migration entry are `NimbusPublicDirectory`.
|
|
8
|
+
*/
|
|
9
|
+
import { DurableObject } from 'cloudflare:workers';
|
|
10
|
+
import { type PublicDirectoryEntry } from './public-directory.js';
|
|
11
|
+
export declare class NimbusPublicDirectory extends DurableObject {
|
|
12
|
+
private store;
|
|
13
|
+
bind(capability: string, entry: PublicDirectoryEntry): Promise<void>;
|
|
14
|
+
unbind(capability: string): Promise<void>;
|
|
15
|
+
resolve(capability: string): Promise<PublicDirectoryEntry | null>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=public-directory-do.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-directory-do.d.ts","sourceRoot":"","sources":["../../src/router/public-directory-do.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,OAAO,CAAC,KAAK,CAAsC;IAEnD,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB;IACpD,MAAM,CAAC,UAAU,EAAE,MAAM;IACzB,OAAO,CAAC,UAAU,EAAE,MAAM;CAC3B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* public-directory-do.ts — the NimbusPublicDirectory Durable Object class.
|
|
3
|
+
*
|
|
4
|
+
* Lives apart from `public-directory.ts` so the session-side helpers and
|
|
5
|
+
* the router-side stub stay importable outside workerd — this file alone
|
|
6
|
+
* needs `cloudflare:workers` for `DurableObject`. The wrangler binding
|
|
7
|
+
* name and migration entry are `NimbusPublicDirectory`.
|
|
8
|
+
*/
|
|
9
|
+
import { DurableObject } from 'cloudflare:workers';
|
|
10
|
+
import { PublicDirectoryStore, } from './public-directory.js';
|
|
11
|
+
export class NimbusPublicDirectory extends DurableObject {
|
|
12
|
+
store = new PublicDirectoryStore(this.ctx);
|
|
13
|
+
bind(capability, entry) { return this.store.bind(capability, entry); }
|
|
14
|
+
unbind(capability) { return this.store.unbind(capability); }
|
|
15
|
+
resolve(capability) { return this.store.resolve(capability); }
|
|
16
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* public-directory.ts — capability → session routing for public preview hosts.
|
|
3
|
+
*
|
|
4
|
+
* The public capability host form `<cap>--<port>--<sid>.<suffix>` carries
|
|
5
|
+
* no session:attach credential, so the router has no verified tenant to
|
|
6
|
+
* name the session DO with. This singleton Durable Object is the one
|
|
7
|
+
* lookup that answers it: keyed by the unguessable 24-hex capability,
|
|
8
|
+
* it says which tenant segment + sid + port the capability belongs to.
|
|
9
|
+
* Rows are written by the session the moment a port goes public and are
|
|
10
|
+
* deleted on unexpose/clear/remove — there is no listing API, so the
|
|
11
|
+
* directory is never an enumeration surface.
|
|
12
|
+
*/
|
|
13
|
+
export interface PublicDirectoryEntry {
|
|
14
|
+
readonly tenantSegment: string;
|
|
15
|
+
readonly sid: string;
|
|
16
|
+
readonly port: number;
|
|
17
|
+
}
|
|
18
|
+
/** The DO body, usable with any `{ storage }` the tests hand it. */
|
|
19
|
+
export declare class PublicDirectoryStore {
|
|
20
|
+
private ctx;
|
|
21
|
+
constructor(ctx: {
|
|
22
|
+
storage: {
|
|
23
|
+
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
24
|
+
put(key: string, value: unknown): Promise<void>;
|
|
25
|
+
delete(key: string): Promise<unknown>;
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
bind(capability: string, entry: {
|
|
29
|
+
tenantSegment: string;
|
|
30
|
+
sid: string;
|
|
31
|
+
port: number;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
unbind(capability: string): Promise<void>;
|
|
34
|
+
resolve(capability: string): Promise<PublicDirectoryEntry | null>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The stub the router and the session share: one name, one binding, one
|
|
38
|
+
* instance. A missing binding on an enforce-mode deployment is loud at the
|
|
39
|
+
* caller — this helper returns null and the caller decides.
|
|
40
|
+
*/
|
|
41
|
+
export declare function publicDirectoryStub(env: unknown): {
|
|
42
|
+
bind(capability: string, entry: PublicDirectoryEntry): Promise<void>;
|
|
43
|
+
unbind(capability: string): Promise<void>;
|
|
44
|
+
resolve(capability: string): Promise<PublicDirectoryEntry | null>;
|
|
45
|
+
} | null;
|
|
46
|
+
/**
|
|
47
|
+
* Publish a public port's capability to the routing directory. A legacy-
|
|
48
|
+
* public deployment needs no directory — its DO name is already the one
|
|
49
|
+
* the public form resolves to — and is allowed to run without the binding.
|
|
50
|
+
* Anything else MUST bind, and a missing `NIMBUS_PUBLIC_DIRECTORY` binding
|
|
51
|
+
* on a non-legacy deployment is a loud error: the exposure would be half-
|
|
52
|
+
* public — stored as public, unroutable in practice.
|
|
53
|
+
*/
|
|
54
|
+
export declare function bindPublicPortCapability(host: {
|
|
55
|
+
env?: unknown;
|
|
56
|
+
ctx?: {
|
|
57
|
+
id?: {
|
|
58
|
+
name?: unknown;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
tenantSegment?: string;
|
|
62
|
+
sessionId?: string;
|
|
63
|
+
}, capability: string, port: number): Promise<void>;
|
|
64
|
+
/** Retire a public port's capability from the routing directory. */
|
|
65
|
+
export declare function unbindPublicPortCapability(host: {
|
|
66
|
+
env?: unknown;
|
|
67
|
+
ctx?: {
|
|
68
|
+
id?: {
|
|
69
|
+
name?: unknown;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
tenantSegment?: string;
|
|
73
|
+
sessionId?: string;
|
|
74
|
+
}, capability: string): Promise<void>;
|
|
75
|
+
//# sourceMappingURL=public-directory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-directory.d.ts","sourceRoot":"","sources":["../../src/router/public-directory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAMD,oEAAoE;AACpE,qBAAa,oBAAoB;IACnB,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE;QAAE,OAAO,EAAE;YAClC,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;YACtD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,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E;IAAE,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,EACtG,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* public-directory.ts — capability → session routing for public preview hosts.
|
|
3
|
+
*
|
|
4
|
+
* The public capability host form `<cap>--<port>--<sid>.<suffix>` carries
|
|
5
|
+
* no session:attach credential, so the router has no verified tenant to
|
|
6
|
+
* name the session DO with. This singleton Durable Object is the one
|
|
7
|
+
* lookup that answers it: keyed by the unguessable 24-hex capability,
|
|
8
|
+
* it says which tenant segment + sid + port the capability belongs to.
|
|
9
|
+
* Rows are written by the session the moment a port goes public and are
|
|
10
|
+
* deleted on unexpose/clear/remove — there is no listing API, so the
|
|
11
|
+
* directory is never an enumeration surface.
|
|
12
|
+
*/
|
|
13
|
+
const BINDING_NAME = 'NIMBUS_PUBLIC_DIRECTORY';
|
|
14
|
+
const DIRECTORY_NAME = 'public-directory';
|
|
15
|
+
const ROW_PREFIX = 'public-capability:';
|
|
16
|
+
function rowKey(capability) {
|
|
17
|
+
return `${ROW_PREFIX}${capability}`;
|
|
18
|
+
}
|
|
19
|
+
/** The DO body, usable with any `{ storage }` the tests hand it. */
|
|
20
|
+
export class PublicDirectoryStore {
|
|
21
|
+
ctx;
|
|
22
|
+
constructor(ctx) {
|
|
23
|
+
this.ctx = ctx;
|
|
24
|
+
}
|
|
25
|
+
async bind(capability, entry) {
|
|
26
|
+
if (!/^[a-f0-9]{24}$/.test(capability)) {
|
|
27
|
+
throw new Error('NimbusPublicDirectory.bind: capability must be 24 lowercase hex');
|
|
28
|
+
}
|
|
29
|
+
if (typeof entry.tenantSegment !== 'string' || entry.tenantSegment.length === 0
|
|
30
|
+
|| typeof entry.sid !== 'string' || entry.sid.length === 0
|
|
31
|
+
|| !Number.isInteger(entry.port) || entry.port < 1 || entry.port > 65535) {
|
|
32
|
+
throw new Error('NimbusPublicDirectory.bind: entry needs tenantSegment, sid, and a real port');
|
|
33
|
+
}
|
|
34
|
+
await this.ctx.storage.put(rowKey(capability), {
|
|
35
|
+
tenantSegment: entry.tenantSegment,
|
|
36
|
+
sid: entry.sid,
|
|
37
|
+
port: entry.port,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async unbind(capability) {
|
|
41
|
+
await this.ctx.storage.delete(rowKey(capability));
|
|
42
|
+
}
|
|
43
|
+
async resolve(capability) {
|
|
44
|
+
const stored = await this.ctx.storage.get(rowKey(capability));
|
|
45
|
+
if (!stored)
|
|
46
|
+
return null;
|
|
47
|
+
return stored;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The stub the router and the session share: one name, one binding, one
|
|
52
|
+
* instance. A missing binding on an enforce-mode deployment is loud at the
|
|
53
|
+
* caller — this helper returns null and the caller decides.
|
|
54
|
+
*/
|
|
55
|
+
export function publicDirectoryStub(env) {
|
|
56
|
+
const namespace = env?.[BINDING_NAME];
|
|
57
|
+
if (!namespace || typeof namespace.idFromName !== 'function')
|
|
58
|
+
return null;
|
|
59
|
+
return namespace.get(namespace.idFromName(DIRECTORY_NAME));
|
|
60
|
+
}
|
|
61
|
+
// ── Session side ─────────────────────────────────────────────────────────────
|
|
62
|
+
import { LEGACY_PUBLIC_DO_SEGMENT } from '../_shared/session-router.js';
|
|
63
|
+
/**
|
|
64
|
+
* `{ tenantSegment, sid }` for the session DO this host is, read off its own
|
|
65
|
+
* DO name — `tn:sub:sid` (or `legacy:public:_:sid`), no request header
|
|
66
|
+
* needed. A host without a DO id (a unit-test stub) may carry the fields on
|
|
67
|
+
* itself.
|
|
68
|
+
*/
|
|
69
|
+
function sessionIdentity(host) {
|
|
70
|
+
const name = host.ctx?.id?.name;
|
|
71
|
+
if (typeof name === 'string' && name.length > 0) {
|
|
72
|
+
const cut = name.lastIndexOf(':');
|
|
73
|
+
if (cut > 0)
|
|
74
|
+
return { tenantSegment: name.slice(0, cut), sid: name.slice(cut + 1) };
|
|
75
|
+
}
|
|
76
|
+
if (typeof host.tenantSegment === 'string' && typeof host.sessionId === 'string'
|
|
77
|
+
&& host.tenantSegment.length > 0 && host.sessionId.length > 0) {
|
|
78
|
+
return { tenantSegment: host.tenantSegment, sid: host.sessionId };
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Publish a public port's capability to the routing directory. A legacy-
|
|
84
|
+
* public deployment needs no directory — its DO name is already the one
|
|
85
|
+
* the public form resolves to — and is allowed to run without the binding.
|
|
86
|
+
* Anything else MUST bind, and a missing `NIMBUS_PUBLIC_DIRECTORY` binding
|
|
87
|
+
* on a non-legacy deployment is a loud error: the exposure would be half-
|
|
88
|
+
* public — stored as public, unroutable in practice.
|
|
89
|
+
*/
|
|
90
|
+
export async function bindPublicPortCapability(host, capability, port) {
|
|
91
|
+
const identity = sessionIdentity(host);
|
|
92
|
+
if (identity === null)
|
|
93
|
+
return;
|
|
94
|
+
if (identity.tenantSegment === LEGACY_PUBLIC_DO_SEGMENT)
|
|
95
|
+
return;
|
|
96
|
+
const stub = publicDirectoryStub(host.env);
|
|
97
|
+
if (stub === null) {
|
|
98
|
+
throw new Error('Nimbus: a public port exposure needs the NIMBUS_PUBLIC_DIRECTORY binding '
|
|
99
|
+
+ '— without it the capability URL cannot resolve to this session. '
|
|
100
|
+
+ 'Add the binding and the NimbusPublicDirectory migration to wrangler.jsonc.');
|
|
101
|
+
}
|
|
102
|
+
await stub.bind(capability, { tenantSegment: identity.tenantSegment, sid: identity.sid, port });
|
|
103
|
+
}
|
|
104
|
+
/** Retire a public port's capability from the routing directory. */
|
|
105
|
+
export async function unbindPublicPortCapability(host, capability) {
|
|
106
|
+
const identity = sessionIdentity(host);
|
|
107
|
+
if (identity === null)
|
|
108
|
+
return;
|
|
109
|
+
if (identity.tenantSegment === LEGACY_PUBLIC_DO_SEGMENT)
|
|
110
|
+
return;
|
|
111
|
+
const stub = publicDirectoryStub(host.env);
|
|
112
|
+
if (stub === null)
|
|
113
|
+
return; // unbind of a bind that never happened is not an error
|
|
114
|
+
await stub.unbind(capability);
|
|
115
|
+
}
|
|
@@ -81,7 +81,15 @@ interface NimbusSessionRpcStub {
|
|
|
81
81
|
bytes?: number;
|
|
82
82
|
}): Promise<unknown>;
|
|
83
83
|
_rpcListPorts(): Promise<unknown>;
|
|
84
|
-
_rpcExposePort(port: number
|
|
84
|
+
_rpcExposePort(port: number, options?: {
|
|
85
|
+
visibility?: 'scoped' | 'public';
|
|
86
|
+
}): Promise<unknown>;
|
|
87
|
+
_rpcEnsureDurableApp(input: {
|
|
88
|
+
owner?: string;
|
|
89
|
+
preferredPort?: number;
|
|
90
|
+
visibility?: 'scoped' | 'public';
|
|
91
|
+
}): Promise<unknown>;
|
|
92
|
+
_rpcRemoveDurableApp(owner: string): Promise<unknown>;
|
|
85
93
|
_rpcUnexposePort(port: number): Promise<unknown>;
|
|
86
94
|
_rpcDestroy(options?: Record<string, unknown>): Promise<unknown>;
|
|
87
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-api.d.ts","sourceRoot":"","sources":["../../src/router/remote-api.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,KAAK,aAAa,EAEnB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,KAAK,GACL,KAAK,GACL,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,OAAO,GACP,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC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Ae,CAAC;IAC1C,GAAG,CAAC,EAAE,EAAE,eAAe,GAAG,oBAAoB,CAAC;CAChD;AAED,UAAU,eAAgB,SAAQ,OAAO,CAAC,aAAa,CAAC;IACtD,cAAc,CAAC,EAAE,sBAAsB,CAAC;CACzC;AAmCD,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,qBAAqB,GAAG,SAAS,GACrC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA2E1B"}
|
|
@@ -221,8 +221,25 @@ async function dispatchRemoteRpc(ctx) {
|
|
|
221
221
|
return ctx.stub._rpcProcessLogs(numberArg(args[0], 'pid'), processLogOptions(args[1]));
|
|
222
222
|
case 'listPorts':
|
|
223
223
|
return ctx.stub._rpcListPorts();
|
|
224
|
-
case 'exposePort':
|
|
225
|
-
|
|
224
|
+
case 'exposePort': {
|
|
225
|
+
const options = args[1] === undefined ? undefined : objectArg(args[1]);
|
|
226
|
+
return ctx.stub._rpcExposePort(numberArg(args[0], 'port'), options === undefined ? undefined : {
|
|
227
|
+
visibility: options.visibility === undefined ? undefined
|
|
228
|
+
: options.visibility === 'public' ? 'public' : 'scoped',
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
case 'ensureDurableApp': {
|
|
232
|
+
const input = objectArg(args[0]);
|
|
233
|
+
return ctx.stub._rpcEnsureDurableApp({
|
|
234
|
+
owner: stringArg(input.owner, 'owner'),
|
|
235
|
+
...(input.preferredPort === undefined ? {} : { preferredPort: numberArg(input.preferredPort, 'preferredPort') }),
|
|
236
|
+
...(input.visibility === undefined ? {} : { visibility: input.visibility === 'public' ? 'public' : 'scoped' }),
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
case 'removeDurableApp': {
|
|
240
|
+
const input = objectArg(args[0]);
|
|
241
|
+
return ctx.stub._rpcRemoveDurableApp(stringArg(input.owner, 'owner'));
|
|
242
|
+
}
|
|
226
243
|
case 'unexposePort':
|
|
227
244
|
return ctx.stub._rpcUnexposePort(numberArg(args[0], 'port'));
|
|
228
245
|
case 'destroy':
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
* - events: full EventEmitter
|
|
10
10
|
* - stream: real Readable/Writable/Transform/Duplex with backpressure
|
|
11
11
|
* - crypto: createHash (FNV-1a sync, SubtleCrypto async), randomBytes/UUID
|
|
12
|
-
* - zlib:
|
|
12
|
+
* - zlib: forward to workerd's native node:zlib when the facet real-import
|
|
13
|
+
* block materialised (full sync/brotli/stream surface; results are the
|
|
14
|
+
* host realm's own Buffers, recognized by the widened isBuffer);
|
|
15
|
+
* CompressionStream fallback with honest sync refusal
|
|
13
16
|
* - dns: real DNS resolution via Cloudflare DNS-over-HTTPS
|
|
14
17
|
* - http: virtual server with port registry for supervisor routing
|
|
15
18
|
* - https: fetch()-backed request/get
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-shims.d.ts","sourceRoot":"","sources":["../../src/runtime/node-shims.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"node-shims.d.ts","sourceRoot":"","sources":["../../src/runtime/node-shims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAgDH,wBAAgB,iBAAiB,IAAI,MAAM,CA+vO1C"}
|