@substrat-run/vertical-host 0.186.0 → 0.188.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/model.d.ts CHANGED
@@ -67,8 +67,8 @@ export interface ModelRequest extends ModelIntent {
67
67
  readonly maxOutputTokens?: number;
68
68
  readonly temperature?: number;
69
69
  /**
70
- * Aborts the call. A host with a deadline passes one so a late answer is never received, and so
71
- * never billed with no line for it: an aborted call records nothing.
70
+ * Aborts the call. A host with a deadline passes one so a late answer is never received. An
71
+ * aborted call records nothing; what the provider consumed before the abort may still be billed.
72
72
  */
73
73
  readonly abortSignal?: AbortSignal;
74
74
  /** Retries the AI SDK makes on its own after a retryable failure. Default 2; 0 makes one request one HTTP call. */
@@ -0,0 +1,83 @@
1
+ /**
2
+ * The door a deployed vertical's worker mounts: who is calling, and the routes that decide it.
3
+ *
4
+ * A vertical runs no credential store. Sign-in is the issuer's, the subject maps to a principal in
5
+ * the tenant's identity directory, and the first person in takes the owner seat. Every deployed
6
+ * worker carried that wiring by hand, and a project should not hold it: the template shipped none,
7
+ * so a generated app answered 401 to everybody once hosted. So it lives here once, and a worker
8
+ * supplies only what is its own: its bindings, how a request routes, and its declared settings.
9
+ *
10
+ * `scope` is the one way in. It hands `getScope` the address the issuer verified (K-61), so an
11
+ * operation reads `ctx.verifiedEmail` and a worker cannot forget to pass it.
12
+ *
13
+ * It is also where a person arrives. The first time someone signed in reaches a scope, the door
14
+ * runs the vertical's join, if it names one, and then gives them every shape its `permissions`
15
+ * declare `bootstrap` with `holder: 'self'`, on their own record (`grantSelfShapesLocal`). A dev
16
+ * server's seed does both; a deployed worker had nothing that did, so a hosted owner could sign in
17
+ * and then not create anything. Both run again in a new isolate, and both are made safe to: a
18
+ * join returns the row it already wrote, and a shape is given once, so a revoke stays revoked.
19
+ *
20
+ * On its own subpath because `IdentityDO` is a Durable Object: `cloudflare:workers` does not load
21
+ * in the node server a vertical's dev loop runs, which imports this package's root.
22
+ *
23
+ * Not here: member invites. Who may invite is the vertical's own question, so a worker that wants
24
+ * them mounts `mountInviteRoutes` beside this, with its own admin gate.
25
+ */
26
+ import type { Context, Hono } from 'hono';
27
+ import { type EntityRef, type EnvVarSpec, type PrincipalId, type ScopeId, type TenantId } from '@substrat-run/contracts';
28
+ import type { ScopeHost, ScopeStub, ScopeStubOptions } from '@substrat-run/kernel';
29
+ import { IdentityDO, type IdentityStub, type InstanceAuth, type OwnerClaimMintHost } from '@substrat-run/vertical-auth';
30
+ import { type OwnerClaimRouteDeps } from '@substrat-run/vertical-auth/owner-claim-routes';
31
+ import type { PlatformSurfaceDeps } from './index.js';
32
+ export { IdentityDO };
33
+ /** The (tenant, scope) a request routed to. */
34
+ export interface DoorNode {
35
+ tenantId: TenantId;
36
+ scopeId: ScopeId;
37
+ }
38
+ /** What a worker supplies: only what is its own. */
39
+ export interface WorkerDoorDeps<E extends object> {
40
+ /** The tenant's identity directory: `env.AUTH.get(env.AUTH.idFromName(node.tenantId))`. */
41
+ directory: (env: E, node: DoorNode) => IdentityStub;
42
+ /** The routed (tenant, scope), from the router's assertion. */
43
+ nodeFor: (req: Request, env: E) => DoorNode;
44
+ hostFor: (env: E) => Pick<ScopeHost, 'getScope'> & OwnerClaimMintHost & ReturnType<OwnerClaimRouteDeps<E, DoorNode>['host']> & SelfShapeHost;
45
+ /** The vertical's declared settings, resolved per scope with the delivered values. */
46
+ envSpec: EnvVarSpec[];
47
+ /**
48
+ * The vertical's join, if it has one: `(scope, who) => scope.invoke('todo/join', { displayName:
49
+ * who.display })`. Run when a person first reaches a scope, and only when the issuer verified
50
+ * their address, since a join records it from `ctx.verifiedEmail`. Their own-record shapes are
51
+ * given after it succeeds. A refusal is logged and tried again on their next request.
52
+ *
53
+ * It can run more than once for one person (a new isolate, two first requests at once), so the
54
+ * join has to return the row it already wrote rather than fail, as `todo/join` does.
55
+ */
56
+ join?: (scope: ScopeStub, who: {
57
+ display: string;
58
+ }) => Promise<unknown>;
59
+ }
60
+ /** The host call that gives a person the shapes declared for their own record. */
61
+ export interface SelfShapeHost {
62
+ grantSelfShapesLocal(scopeId: ScopeId, principal: PrincipalId): Promise<EntityRef[]>;
63
+ }
64
+ type DoorHooks<E> = Required<Pick<PlatformSurfaceDeps<E>, 'onProvision' | 'onConfigure' | 'onReadPreviewConfig' | 'onDeleteScope' | 'resolveOwner' | 'ownerSeat' | 'mintOwnerClaim' | 'transferOwner' | 'completeOwnerTransfer' | 'abandonOwnerTransfer'>>;
65
+ export interface WorkerDoor<E extends object> {
66
+ /** `/api/auth/*` (the login round-trip), `/api/me` and `/api/claim-owner`. */
67
+ mount(app: Hono<{
68
+ Bindings: E;
69
+ }>): void;
70
+ /** The caller's scope stub, with their verified address. 401 for nobody. */
71
+ scope(c: Context<{
72
+ Bindings: E;
73
+ }>, options?: ScopeStubOptions): Promise<ScopeStub>;
74
+ /**
75
+ * The declared settings for one scope: delivered value, then binding, then default. Read them
76
+ * here and never off `env`: a default rides as a binding every install of a script shares.
77
+ */
78
+ settings(env: E, node: DoorNode): Promise<InstanceAuth['settings']>;
79
+ /** Spread into `mountPlatformSurface`, so what the platform delivers lands in the directory. */
80
+ platform: DoorHooks<E>;
81
+ }
82
+ export declare function workerDoor<E extends object>(deps: WorkerDoorDeps<E>): WorkerDoor<E>;
83
+ //# sourceMappingURL=worker-door.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-door.d.ts","sourceRoot":"","sources":["../src/worker-door.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAe,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACtI,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,MA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AAS,CAAC,CAAC,IAAI,QAAQ,CAC1B,IAAI,CACF,mBAAmB,CAAC,CAAC,CAAC,EACpB,aAAa,GACb,aAAa,GACb,qBAAqB,GACrB,eAAe,GACf,cAAc,GACd,WAAW,GACX,gBAAgB,GAChB,eAAe,GACf,uBAAuB,GACvB,sBAAsB,CACzB,CACF,CAAC;AAEF,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM;IAC1C,8EAA8E;IAC9E,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC;QAAE,QAAQ,EAAE,CAAC,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;IACxC,4EAA4E;IAC5E,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC;QAAE,QAAQ,EAAE,CAAC,CAAA;KAAE,CAAC,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACnF;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;IACpE,gGAAgG;IAChG,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;CACxB;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAkHnF"}
@@ -0,0 +1,113 @@
1
+ import { HTTPException } from 'hono/http-exception';
2
+ import { principalId } from '@substrat-run/contracts';
3
+ import { AuthConfigError, IdentityDO, instanceAuthFor, mintOwnerClaimLink, placesReporter, reportScopeMembers, verifiedEmailOf, } from '@substrat-run/vertical-auth';
4
+ import { mountOwnerClaim } from '@substrat-run/vertical-auth/owner-claim-routes';
5
+ import { mountSession, sessionAnswer } from '@substrat-run/vertical-auth/session-route';
6
+ export { IdentityDO };
7
+ export function workerDoor(deps) {
8
+ const wiring = (env, node) => instanceAuthFor({
9
+ directory: deps.directory(env, node),
10
+ scopeId: node.scopeId,
11
+ envSpec: deps.envSpec,
12
+ env: env,
13
+ });
14
+ /** The provider a configuration selects; a refusal is its HTTP status, not a 500. */
15
+ const providerOf = (instance) => {
16
+ try {
17
+ return instance.provider();
18
+ }
19
+ catch (err) {
20
+ if (err instanceof AuthConfigError)
21
+ throw new HTTPException(err.status, { message: err.message });
22
+ throw err;
23
+ }
24
+ };
25
+ const authProvider = async (env, req) => providerOf(await wiring(env, deps.nodeFor(req, env)));
26
+ /**
27
+ * The people who have arrived, per isolate. Arriving is safe to repeat, so this only saves the
28
+ * calls; it is cleared rather than left to grow.
29
+ */
30
+ const arrived = new Set();
31
+ const arrive = async (env, node, principal, subject, scope) => {
32
+ const key = `${node.tenantId}/${node.scopeId}/${principal}`;
33
+ if (arrived.has(key))
34
+ return;
35
+ if (deps.join) {
36
+ // Not yet a person here: they are signed in, and they join once the issuer vouches.
37
+ if (verifiedEmailOf(subject) === null)
38
+ return;
39
+ try {
40
+ await deps.join(scope, { display: sessionAnswer(principal, subject).display });
41
+ }
42
+ catch (err) {
43
+ console.error(JSON.stringify({ host: 'door-join-failed', ...node, principal, message: err instanceof Error ? err.message : String(err) }));
44
+ return;
45
+ }
46
+ }
47
+ await deps.hostFor(env).grantSelfShapesLocal(node.scopeId, principal);
48
+ if (arrived.size >= 10_000)
49
+ arrived.clear();
50
+ arrived.add(key);
51
+ };
52
+ /** The caller's stub, carrying the address the issuer verified (K-61). */
53
+ const scopeFor = (env, node, principal, subject, options) => deps.hostFor(env).getScope(principal, node.tenantId, node.scopeId, { ...options, verifiedEmail: verifiedEmailOf(subject) });
54
+ const callerOf = async (env, req) => {
55
+ const node = deps.nodeFor(req, env);
56
+ const instance = await wiring(env, node);
57
+ const subject = await providerOf(instance).resolve(req.headers);
58
+ const principal = subject ? await deps.directory(env, node).resolvePrincipal(node.scopeId, subject.sub) : null;
59
+ return { node, subject, principal, identity: instance.identity };
60
+ };
61
+ return {
62
+ mount(app) {
63
+ app.on(['GET', 'POST'], '/api/auth/*', async (c) => (await authProvider(c.env, c.req.raw)).handle(c.req.raw));
64
+ mountSession(app, {
65
+ caller: (c) => callerOf(c.env, c.req.raw),
66
+ directory: deps.directory,
67
+ // Every screen asks this first, so it is where a person signed in from a browser arrives.
68
+ extra: async (c, { node, principal, subject }) => {
69
+ const who = principalId.parse(principal);
70
+ await arrive(c.env, node, who, subject, await scopeFor(c.env, node, who, subject));
71
+ return {};
72
+ },
73
+ });
74
+ mountOwnerClaim(app, { nodeFor: deps.nodeFor, authProvider, directory: deps.directory, host: deps.hostFor });
75
+ },
76
+ async scope(c, options) {
77
+ const { node, subject, principal } = await callerOf(c.env, c.req.raw);
78
+ if (!principal || !subject)
79
+ throw new HTTPException(401, { message: 'unauthorized' });
80
+ const who = principalId.parse(principal);
81
+ const scope = await scopeFor(c.env, node, who, subject, options);
82
+ // Before the operation, so a client that never asks `/api/me` (MCP, a script) has arrived too.
83
+ await arrive(c.env, node, who, subject, scope);
84
+ return scope;
85
+ },
86
+ settings: async (env, node) => (await wiring(env, node)).settings,
87
+ platform: {
88
+ onProvision: async (env, b) => {
89
+ const directory = deps.directory(env, b);
90
+ await directory.setPendingOwner(b.scopeId, b.owner, b.parentScopeId);
91
+ // The places repair (#1670): a no-op before an issuer is delivered, and it never throws.
92
+ const { identity } = await wiring(env, b);
93
+ await reportScopeMembers(directory, placesReporter({ identity }), b.scopeId);
94
+ },
95
+ onConfigure: (env, b) => deps.directory(env, b).setScopeConfig(b.scopeId, b.entries),
96
+ onReadPreviewConfig: (env, b) => deps.directory(env, b).getScopeConfig(b.scopeId),
97
+ onDeleteScope: async (env, scopeId, tenantId) => {
98
+ if (tenantId)
99
+ await deps.directory(env, { tenantId, scopeId }).deleteScopeConfig(scopeId);
100
+ },
101
+ resolveOwner: async (env, ref) => {
102
+ const owner = await deps.directory(env, ref).getOwnerOfRecord(ref.scopeId);
103
+ return owner ? principalId.parse(owner) : null;
104
+ },
105
+ ownerSeat: (env, ref) => deps.directory(env, ref).ownerSeat(ref.scopeId),
106
+ mintOwnerClaim: (env, ref, input) => mintOwnerClaimLink({ directory: deps.directory(env, ref), host: deps.hostFor(env) }, ref, input.origin, input.actor),
107
+ transferOwner: (env, ref, input) => deps.directory(env, ref).transferOwner(ref.scopeId, input.from, input.to, input.toHoldsRole),
108
+ completeOwnerTransfer: (env, ref, input) => deps.directory(env, ref).completeOwnerTransfer(ref.scopeId, input.from, input.to),
109
+ abandonOwnerTransfer: (env, ref, input) => deps.directory(env, ref).abandonOwnerTransfer(ref.scopeId, input.from, input.to, input.toHoldsRole),
110
+ },
111
+ };
112
+ }
113
+ //# sourceMappingURL=worker-door.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-door.js","sourceRoot":"","sources":["../src/worker-door.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAkF,MAAM,yBAAyB,CAAC;AAEtI,OAAO,EACL,eAAe,EACf,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,GAMhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAA4B,MAAM,gDAAgD,CAAC;AAC3G,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAGxF,OAAO,EAAE,UAAU,EAAE,CAAC;AAgEtB,MAAM,UAAU,UAAU,CAAmB,IAAuB;IAClE,MAAM,MAAM,GAAG,CAAC,GAAM,EAAE,IAAc,EAAyB,EAAE,CAC/D,eAAe,CAAC;QACd,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC;QACpC,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,GAAG,EAAE,GAAyC;KAC/C,CAAC,CAAC;IAEL,qFAAqF;IACrF,MAAM,UAAU,GAAG,CAAC,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,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC;YACtH,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CACjC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,WAAW,CAAC;YAC9F,qBAAqB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CACzC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;YACnF,oBAAoB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CACxC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,WAAW,CAAC;SACtG;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@substrat-run/vertical-host",
3
- "version": "0.186.0",
3
+ "version": "0.188.0",
4
4
  "description": "The platform's /internal/* surface + error envelope, authored once — mount it in a vertical worker instead of re-copying the control-plane contract",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -24,6 +24,10 @@
24
24
  "./connectors": {
25
25
  "types": "./dist/connectors.d.ts",
26
26
  "default": "./dist/connectors.js"
27
+ },
28
+ "./worker-door": {
29
+ "types": "./dist/worker-door.d.ts",
30
+ "default": "./dist/worker-door.js"
27
31
  }
28
32
  },
29
33
  "files": [
@@ -33,9 +37,10 @@
33
37
  "ai": "7.0.159",
34
38
  "hono": "^4.13.13",
35
39
  "workers-ai-provider": "^4.0.0",
36
- "@substrat-run/contracts": "^0.186.0",
37
- "@substrat-run/kernel": "^0.186.0",
38
- "@substrat-run/model-providers": "^0.5.76"
40
+ "@substrat-run/contracts": "^0.188.0",
41
+ "@substrat-run/kernel": "^0.188.0",
42
+ "@substrat-run/model-providers": "^0.5.78",
43
+ "@substrat-run/vertical-auth": "^0.32.1"
39
44
  },
40
45
  "devDependencies": {
41
46
  "@scalar/api-reference": "1.76.4",
@@ -43,9 +48,8 @@
43
48
  "better-sqlite3": "^13.0.3",
44
49
  "typescript": "^7.0.0",
45
50
  "vitest": "^5.0.5",
46
- "@substrat-run/vertical-auth": "^0.31.6",
47
- "@substrat-run/adapter-sqlite": "^0.186.0",
48
- "@substrat-run/contract-tests": "^0.186.0"
51
+ "@substrat-run/contract-tests": "^0.188.0",
52
+ "@substrat-run/adapter-sqlite": "^0.188.0"
49
53
  },
50
54
  "publishConfig": {
51
55
  "access": "public"