@substrat-run/vertical-host 0.134.0 → 0.136.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/connect-url.js +1 -1
- package/dist/connect-url.js.map +1 -1
- package/dist/field-coverage.d.ts +1 -1
- package/dist/field-coverage.d.ts.map +1 -1
- package/dist/index.d.ts +75 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +193 -3
- package/dist/index.js.map +1 -1
- package/dist/invocation-log.d.ts +11 -0
- package/dist/invocation-log.d.ts.map +1 -0
- package/dist/invocation-log.js +10 -0
- package/dist/invocation-log.js.map +1 -0
- package/dist/live.d.ts +7 -1
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +8 -1
- package/dist/live.js.map +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +10 -4
- package/dist/mcp.js.map +1 -1
- package/dist/operations-routes.d.ts +1 -1
- package/dist/operations-routes.d.ts.map +1 -1
- package/dist/operations-routes.js +3 -2
- package/dist/operations-routes.js.map +1 -1
- package/dist/platform-call.d.ts +10 -0
- package/dist/platform-call.d.ts.map +1 -0
- package/dist/platform-call.js +10 -0
- package/dist/platform-call.js.map +1 -0
- package/dist/routed-node.d.ts +11 -0
- package/dist/routed-node.d.ts.map +1 -0
- package/dist/routed-node.js +10 -0
- package/dist/routed-node.js.map +1 -0
- package/dist/scope-sweep-host.d.ts +46 -0
- package/dist/scope-sweep-host.d.ts.map +1 -0
- package/dist/scope-sweep-host.js +55 -0
- package/dist/scope-sweep-host.js.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the node the router asserted (K-26, #1978).
|
|
3
|
+
*
|
|
4
|
+
* Moving here from the kernel: every vertical reads it, and nothing in it needs a kernel
|
|
5
|
+
* guarantee. For one release the definition still lives in `@substrat-run/kernel` and this
|
|
6
|
+
* module re-exports that same binding, so an import from either package is the one
|
|
7
|
+
* function. Import it from here.
|
|
8
|
+
*/
|
|
9
|
+
export { readRoutedNode, RouterAssertionError } from '@substrat-run/kernel';
|
|
10
|
+
//# sourceMappingURL=routed-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routed-node.js","sourceRoot":"","sources":["../src/routed-node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The handoff between a vertical's bundle and the scope sweeper the platform supplies (#1902).
|
|
3
|
+
*
|
|
4
|
+
* A vertical that declares `manifest.schedules` and exports no `defineScopeSweeperDO` class
|
|
5
|
+
* of its own is given one at upload: the uploader adds the class, its `SWEEPER` binding and
|
|
6
|
+
* its migration. That class is the platform's code, prebuilt, and it cannot know the one
|
|
7
|
+
* thing a pass needs — the vertical's own scope host, with the vertical's modules and its
|
|
8
|
+
* host options (service principals, declared connectors, attachment extractors). A host
|
|
9
|
+
* rebuilt from the modules alone would drain a declared connector's events as if no
|
|
10
|
+
* connector were declared, so it has to be the vertical's.
|
|
11
|
+
*
|
|
12
|
+
* Every deployed vertical already hands that host to `mountPlatformSurface` as `hostFor`,
|
|
13
|
+
* so that is where it is registered — on `globalThis` under a GLOBAL symbol, because the
|
|
14
|
+
* platform's copy of the reader and the vertical-host the vertical bundled are different
|
|
15
|
+
* module instances that meet only there (the same reason #1893's stamp registry is global).
|
|
16
|
+
*
|
|
17
|
+
* The roster is the other half. The platform's sweeper is told which scopes exist by
|
|
18
|
+
* `mountPlatformSurface` itself, on provision, reconcile and delete-scope — but only when the
|
|
19
|
+
* upload says it supplied one: the uploader sets `SUBSTRAT_SCOPE_SWEEPER` to the binding's
|
|
20
|
+
* name. A vertical that brings its own sweeper keeps its own hooks and never sees the var.
|
|
21
|
+
*
|
|
22
|
+
* Zero imports on purpose: `tools/platform-entry-emit.mts` bundles this file into the
|
|
23
|
+
* platform's sweeper module, which is added to every such upload.
|
|
24
|
+
*/
|
|
25
|
+
/** The env var the uploader sets to the binding of the sweeper it supplied (#1902). Contracts'
|
|
26
|
+
* `PLATFORM_SWEEPER_VAR`, spelled out because this file imports nothing; control-plane-api's
|
|
27
|
+
* `platform-entry.test.ts` holds the two equal. */
|
|
28
|
+
export declare const PLATFORM_SWEEPER_VAR = "SUBSTRAT_SCOPE_SWEEPER";
|
|
29
|
+
/** Builds this deployment's scope host from the worker env — `mountPlatformSurface`'s `hostFor`. */
|
|
30
|
+
export type ScopeSweepHostFactory = (env: never) => unknown;
|
|
31
|
+
/** Record the vertical's host builder for the platform's sweeper. The last call wins. */
|
|
32
|
+
export declare function registerScopeSweepHost(hostFor: ScopeSweepHostFactory): void;
|
|
33
|
+
/** The host builder the vertical registered, or `undefined` when its bundle registers none. */
|
|
34
|
+
export declare function registeredScopeSweepHost(): ScopeSweepHostFactory | undefined;
|
|
35
|
+
/** The slice of a sweeper stub the surface calls. */
|
|
36
|
+
interface RosterStub {
|
|
37
|
+
noteScope(tenantId: string, scopeId: string): Promise<unknown>;
|
|
38
|
+
forgetScope(scopeId: string): Promise<unknown>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The platform-supplied sweeper's stub, or `undefined` when this upload was given none —
|
|
42
|
+
* which is every local run, and every vertical that wires its own.
|
|
43
|
+
*/
|
|
44
|
+
export declare function platformSweeperOf(env: object): RosterStub | undefined;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=scope-sweep-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-sweep-host.d.ts","sourceRoot":"","sources":["../src/scope-sweep-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH;;oDAEoD;AACpD,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D,oGAAoG;AACpG,MAAM,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,CAAC;AAE5D,yFAAyF;AACzF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAE3E;AAED,+FAA+F;AAC/F,wBAAgB,wBAAwB,IAAI,qBAAqB,GAAG,SAAS,CAE5E;AAED,qDAAqD;AACrD,UAAU,UAAU;IAClB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/D,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAChD;AAUD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAWrE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The handoff between a vertical's bundle and the scope sweeper the platform supplies (#1902).
|
|
3
|
+
*
|
|
4
|
+
* A vertical that declares `manifest.schedules` and exports no `defineScopeSweeperDO` class
|
|
5
|
+
* of its own is given one at upload: the uploader adds the class, its `SWEEPER` binding and
|
|
6
|
+
* its migration. That class is the platform's code, prebuilt, and it cannot know the one
|
|
7
|
+
* thing a pass needs — the vertical's own scope host, with the vertical's modules and its
|
|
8
|
+
* host options (service principals, declared connectors, attachment extractors). A host
|
|
9
|
+
* rebuilt from the modules alone would drain a declared connector's events as if no
|
|
10
|
+
* connector were declared, so it has to be the vertical's.
|
|
11
|
+
*
|
|
12
|
+
* Every deployed vertical already hands that host to `mountPlatformSurface` as `hostFor`,
|
|
13
|
+
* so that is where it is registered — on `globalThis` under a GLOBAL symbol, because the
|
|
14
|
+
* platform's copy of the reader and the vertical-host the vertical bundled are different
|
|
15
|
+
* module instances that meet only there (the same reason #1893's stamp registry is global).
|
|
16
|
+
*
|
|
17
|
+
* The roster is the other half. The platform's sweeper is told which scopes exist by
|
|
18
|
+
* `mountPlatformSurface` itself, on provision, reconcile and delete-scope — but only when the
|
|
19
|
+
* upload says it supplied one: the uploader sets `SUBSTRAT_SCOPE_SWEEPER` to the binding's
|
|
20
|
+
* name. A vertical that brings its own sweeper keeps its own hooks and never sees the var.
|
|
21
|
+
*
|
|
22
|
+
* Zero imports on purpose: `tools/platform-entry-emit.mts` bundles this file into the
|
|
23
|
+
* platform's sweeper module, which is added to every such upload.
|
|
24
|
+
*/
|
|
25
|
+
const HOSTS = Symbol.for('substrat.scope-sweep-host');
|
|
26
|
+
/** The env var the uploader sets to the binding of the sweeper it supplied (#1902). Contracts'
|
|
27
|
+
* `PLATFORM_SWEEPER_VAR`, spelled out because this file imports nothing; control-plane-api's
|
|
28
|
+
* `platform-entry.test.ts` holds the two equal. */
|
|
29
|
+
export const PLATFORM_SWEEPER_VAR = 'SUBSTRAT_SCOPE_SWEEPER';
|
|
30
|
+
/** Record the vertical's host builder for the platform's sweeper. The last call wins. */
|
|
31
|
+
export function registerScopeSweepHost(hostFor) {
|
|
32
|
+
globalThis[HOSTS] = hostFor;
|
|
33
|
+
}
|
|
34
|
+
/** The host builder the vertical registered, or `undefined` when its bundle registers none. */
|
|
35
|
+
export function registeredScopeSweepHost() {
|
|
36
|
+
return globalThis[HOSTS];
|
|
37
|
+
}
|
|
38
|
+
/** `SCOPE_SWEEPER_NAME` in adapter-cloudflare — the singleton every caller addresses. */
|
|
39
|
+
const SCOPE_SWEEPER_NAME = 'scope-sweeper';
|
|
40
|
+
/**
|
|
41
|
+
* The platform-supplied sweeper's stub, or `undefined` when this upload was given none —
|
|
42
|
+
* which is every local run, and every vertical that wires its own.
|
|
43
|
+
*/
|
|
44
|
+
export function platformSweeperOf(env) {
|
|
45
|
+
const vars = env;
|
|
46
|
+
const binding = vars[PLATFORM_SWEEPER_VAR];
|
|
47
|
+
if (typeof binding !== 'string' || !binding)
|
|
48
|
+
return undefined;
|
|
49
|
+
const ns = vars[binding];
|
|
50
|
+
if (!ns || typeof ns.idFromName !== 'function') {
|
|
51
|
+
throw new Error(`${PLATFORM_SWEEPER_VAR} names the binding '${binding}', but this script has no Durable Object namespace by that name`);
|
|
52
|
+
}
|
|
53
|
+
return ns.get(ns.idFromName(SCOPE_SWEEPER_NAME));
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=scope-sweep-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-sweep-host.js","sourceRoot":"","sources":["../src/scope-sweep-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAEtD;;oDAEoD;AACpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAK7D,yFAAyF;AACzF,MAAM,UAAU,sBAAsB,CAAC,OAA8B;IAClE,UAA2E,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;AAChG,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,wBAAwB;IACtC,OAAQ,UAA2E,CAAC,KAAK,CAAC,CAAC;AAC7F,CAAC;AAaD,yFAAyF;AACzF,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAE3C;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,MAAM,IAAI,GAAG,GAA8B,CAAC;IAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC3C,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC9D,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAA0B,CAAC;IAClD,IAAI,CAAC,EAAE,IAAI,OAAO,EAAE,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CACb,GAAG,oBAAoB,uBAAuB,OAAO,iEAAiE,CACvH,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAe,CAAC;AACjE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substrat-run/vertical-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.136.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": {
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"ai": "7.0.114",
|
|
30
30
|
"hono": "^4.13.9",
|
|
31
31
|
"workers-ai-provider": "^4.0.0",
|
|
32
|
-
"@substrat-run/kernel": "^0.
|
|
33
|
-
"@substrat-run/
|
|
34
|
-
"@substrat-run/
|
|
32
|
+
"@substrat-run/kernel": "^0.136.0",
|
|
33
|
+
"@substrat-run/contracts": "^0.136.0",
|
|
34
|
+
"@substrat-run/model-providers": "^0.5.26"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"typescript": "^7.0.0",
|
|
38
38
|
"vitest": "^3.2.7",
|
|
39
|
-
"@substrat-run/contract-tests": "^0.
|
|
40
|
-
"@substrat-run/adapter-sqlite": "^0.
|
|
39
|
+
"@substrat-run/contract-tests": "^0.136.0",
|
|
40
|
+
"@substrat-run/adapter-sqlite": "^0.136.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|