@volter/world-core 2.0.37 → 3.0.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 +4 -5
- package/app-route.cjs +12 -6
- package/app-route.d.cts +1 -1
- package/dist/app-route.cjs +12 -6
- package/dist/app-route.d.cts +1 -1
- package/dist/generated/pack-facts.json +1410 -3069
- package/dist/inject.cjs +64 -9
- package/dist/pack-facts.cjs +44 -0
- package/dist/src/actions.d.ts +3 -3
- package/dist/src/actions.js +22 -16
- package/dist/src/ancestry.d.ts +14 -2
- package/dist/src/ancestry.js +92 -2
- package/dist/src/anthropic-wire.d.ts +39 -0
- package/dist/src/anthropic-wire.js +136 -0
- package/dist/src/bytes.d.ts +7 -0
- package/dist/src/bytes.js +35 -0
- package/dist/src/changeset.d.ts +1 -1
- package/dist/src/changeset.js +0 -0
- package/dist/src/clickhouse/index.d.ts +3 -0
- package/dist/src/clickhouse/index.js +6 -0
- package/dist/src/clickhouse/sql.d.ts +233 -0
- package/dist/src/clickhouse/sql.js +4329 -0
- package/dist/src/clickhouse/types.d.ts +18 -0
- package/dist/src/clickhouse/types.js +47 -0
- package/dist/src/clickhouse/values.d.ts +146 -0
- package/dist/src/clickhouse/values.js +858 -0
- package/dist/src/client-bundle.js +2 -3
- package/dist/src/cors.d.ts +15 -0
- package/dist/src/cors.js +31 -0
- package/dist/src/derived-core.d.ts +487 -24
- package/dist/src/derived-core.js +788 -144
- package/dist/src/derived-real.d.ts +13 -0
- package/dist/src/derived-real.js +518 -0
- package/dist/src/derived.d.ts +35 -1
- package/dist/src/derived.js +61 -9
- package/dist/src/emit.js +1 -2
- package/dist/src/events.d.ts +206 -0
- package/dist/src/events.js +341 -0
- package/dist/src/executor.d.ts +3 -0
- package/dist/src/executor.js +19 -2
- package/dist/src/file-response.d.ts +6 -0
- package/dist/src/file-response.js +30 -0
- package/dist/src/fork.js +3 -2
- package/dist/src/git/history.d.ts +7 -0
- package/dist/src/git/history.js +24 -0
- package/dist/src/git/index.d.ts +1 -0
- package/dist/src/git/index.js +1 -0
- package/dist/src/git/lfs.d.ts +28 -0
- package/dist/src/git/lfs.js +66 -0
- package/dist/src/git/objects.js +3 -8
- package/dist/src/git/smart-http.d.ts +3 -1
- package/dist/src/git/smart-http.js +67 -6
- package/dist/src/graphql-wire.d.ts +29 -0
- package/dist/src/graphql-wire.js +101 -0
- package/dist/src/grpc-wire.d.ts +67 -0
- package/dist/src/grpc-wire.js +170 -0
- package/dist/src/h2.d.ts +40 -0
- package/dist/src/h2.js +656 -0
- package/dist/src/head.d.ts +32 -3
- package/dist/src/head.js +161 -40
- package/dist/src/history.d.ts +1 -1
- package/dist/src/history.js +6 -6
- package/dist/src/hpack.json +1 -0
- package/dist/src/index.d.ts +64 -75
- package/dist/src/index.js +58 -101
- package/dist/src/log.js +28 -19
- package/dist/src/machines.d.ts +50 -0
- package/dist/src/machines.js +151 -0
- package/dist/src/managed-database.d.ts +86 -0
- package/dist/src/managed-database.js +283 -0
- package/dist/src/multipart.d.ts +11 -0
- package/dist/src/multipart.js +51 -0
- package/dist/src/observe.d.ts +15 -5
- package/dist/src/observe.js +23 -9
- package/dist/src/openai-wire.d.ts +108 -0
- package/dist/src/openai-wire.js +337 -0
- package/dist/src/pack-assets.d.ts +3 -4
- package/dist/src/pack-assets.js +15 -10
- package/dist/src/pack-fetch.d.ts +77 -0
- package/dist/src/pack-fetch.js +449 -0
- package/dist/src/pack-paths.d.ts +12 -0
- package/dist/src/pack-paths.js +86 -0
- package/dist/src/packRegistry.d.ts +69 -162
- package/dist/src/packRegistry.js +55 -20
- package/dist/src/people.d.ts +13 -0
- package/dist/src/people.js +18 -0
- package/dist/src/placeholder-image.d.ts +5 -0
- package/dist/src/placeholder-image.js +114 -0
- package/dist/src/protobuf.d.ts +28 -0
- package/dist/src/protobuf.js +332 -0
- package/dist/src/redis/engine.js +1 -1
- package/dist/src/request-scope.d.ts +1 -1
- package/dist/src/request-scope.js +6 -4
- package/dist/src/resource-blob.d.ts +5 -0
- package/dist/src/resource-blob.js +11 -0
- package/dist/src/runtime.d.ts +85 -0
- package/dist/src/runtime.js +104 -0
- package/dist/src/s3/wire.d.ts +60 -0
- package/dist/src/s3/wire.js +157 -0
- package/dist/src/scenario.d.ts +3 -0
- package/dist/src/scenario.js +2 -0
- package/dist/src/schema-sample.d.ts +1 -0
- package/dist/src/schema-sample.js +21 -0
- package/dist/src/sealed-box.d.ts +14 -0
- package/dist/src/sealed-box.js +225 -0
- package/dist/src/serve-http.d.ts +14 -0
- package/dist/src/serve-http.js +27 -3
- package/dist/src/serve.d.ts +6 -0
- package/dist/src/serve.js +69 -14
- package/dist/src/signing.d.ts +135 -0
- package/dist/src/signing.js +222 -0
- package/dist/src/sigv4.d.ts +48 -0
- package/dist/src/sigv4.js +167 -0
- package/dist/src/smtp.d.ts +16 -0
- package/dist/src/smtp.js +72 -0
- package/dist/src/sockets.d.ts +51 -0
- package/dist/src/sockets.js +90 -0
- package/dist/src/state-system.d.ts +1 -0
- package/dist/src/state-system.js +1 -1
- package/dist/src/storage.d.ts +1 -1
- package/dist/src/storage.js +3 -3
- package/dist/src/trace-context.js +1 -1
- package/dist/src/twin-fetch.d.ts +0 -7
- package/dist/src/twin-fetch.js +0 -14
- package/dist/src/vendor-call.d.ts +6 -0
- package/dist/src/vendor-call.js +41 -0
- package/dist/src/world-store.js +1 -1
- package/dist/vendor-hosts.cjs +36 -125
- package/dist/vendor-hosts.d.cts +8 -0
- package/generated/pack-facts.json +1410 -3069
- package/inject.cjs +64 -9
- package/pack-facts.cjs +44 -0
- package/package.json +17 -3
- package/src/actions.ts +23 -16
- package/src/ancestry.ts +74 -2
- package/src/anthropic-wire.ts +137 -0
- package/src/bytes.ts +42 -0
- package/src/changeset.ts +5 -5
- package/src/clickhouse/index.ts +6 -0
- package/src/clickhouse/sql.ts +3059 -0
- package/src/clickhouse/types.ts +44 -0
- package/src/clickhouse/values.ts +697 -0
- package/src/client-bundle.ts +2 -3
- package/src/cors.ts +34 -0
- package/src/derived-core.ts +1013 -146
- package/src/derived-real.ts +434 -0
- package/src/derived.ts +73 -3
- package/src/emit.ts +1 -2
- package/src/events.ts +449 -0
- package/src/executor.ts +24 -2
- package/src/file-response.ts +27 -0
- package/src/fork.ts +3 -2
- package/src/git/history.ts +19 -0
- package/src/git/index.ts +1 -0
- package/src/git/lfs.ts +67 -0
- package/src/git/objects.ts +3 -5
- package/src/git/smart-http.ts +56 -6
- package/src/graphql-wire.ts +106 -0
- package/src/grpc-wire.ts +159 -0
- package/src/h2.ts +627 -0
- package/src/head.ts +132 -41
- package/src/history.ts +6 -6
- package/src/hpack.json +1 -0
- package/src/index.ts +82 -329
- package/src/log.ts +27 -18
- package/src/machines.ts +151 -0
- package/src/managed-database.ts +299 -0
- package/src/multipart.ts +51 -0
- package/src/observe.ts +31 -15
- package/src/openai-wire.ts +371 -0
- package/src/pack-assets.ts +15 -11
- package/src/pack-fetch.ts +458 -0
- package/src/pack-paths.ts +72 -0
- package/src/packRegistry.ts +79 -167
- package/src/people.ts +31 -0
- package/src/placeholder-image.ts +88 -0
- package/src/protobuf.ts +251 -0
- package/src/redis/engine.ts +1 -1
- package/src/request-scope.ts +8 -4
- package/src/resource-blob.ts +13 -0
- package/src/runtime.ts +344 -0
- package/src/s3/wire.ts +172 -0
- package/src/scenario.ts +4 -0
- package/src/schema-sample.ts +24 -0
- package/src/sealed-box.ts +182 -0
- package/src/serve-http.ts +31 -3
- package/src/serve.ts +58 -14
- package/src/signing.ts +231 -0
- package/src/sigv4.ts +158 -0
- package/src/smtp.ts +76 -0
- package/src/sockets.ts +140 -0
- package/src/state-system.ts +2 -2
- package/src/storage.ts +3 -3
- package/src/trace-context.ts +1 -1
- package/src/twin-fetch.ts +0 -20
- package/src/vendor-call.ts +41 -0
- package/src/world-store.ts +1 -1
- package/vendor-hosts.cjs +36 -125
- package/vendor-hosts.d.cts +8 -0
- package/dist/src/mirror-shell.d.ts +0 -2
- package/dist/src/mirror-shell.js +0 -13
- package/dist/src/v1-removed.d.ts +0 -159
- package/dist/src/v1-removed.js +0 -124
- package/src/mirror-shell.ts +0 -15
- package/src/v1-removed.ts +0 -172
package/README.md
CHANGED
|
@@ -18,12 +18,11 @@ execution. Payloads use the [blob storage contract](../../docs/contributing/arch
|
|
|
18
18
|
|
|
19
19
|
## Building a twin
|
|
20
20
|
|
|
21
|
-
A
|
|
21
|
+
A twin implements its vendor's request/response semantics while the shared kernel
|
|
22
22
|
owns log ordering, checkpoints, branching and the head's state system. Use the tree readers and
|
|
23
23
|
write path exported by [`src/index.ts`](./src/index.ts); do not reconstruct a serve-time view by
|
|
24
24
|
folding the log or use removed v1 confirmation/suppression APIs.
|
|
25
25
|
|
|
26
|
-
[Architecture](../../docs/contributing/architecture.md) owns the boundaries and
|
|
27
|
-
[
|
|
28
|
-
|
|
29
|
-
Conformance tooling is a development dependency in `@volter/world-tooling`.
|
|
26
|
+
[Architecture](../../docs/contributing/architecture.md) owns the boundaries and the procedure a twin is built by
|
|
27
|
+
([Creating a pack](../../docs/contributing/architecture.md#creating-a-pack)); [gates](../../docs/contributing/gates.md)
|
|
28
|
+
owns verification. Development tooling is in `@volter/world-tooling`.
|
package/app-route.cjs
CHANGED
|
@@ -32,7 +32,7 @@ function readRoutes(instanceFile) {
|
|
|
32
32
|
const now = Date.now();
|
|
33
33
|
let held = APP_ROUTES.get(instanceFile);
|
|
34
34
|
if (held && now - held.checkedAt < 1000) return held;
|
|
35
|
-
if (!held) { held = { checkedAt: 0, mtimeMs: -1, routes: [], services: {}, twins: {} }; APP_ROUTES.set(instanceFile, held); }
|
|
35
|
+
if (!held) { held = { checkedAt: 0, mtimeMs: -1, routes: [], app: null, services: {}, twins: {} }; APP_ROUTES.set(instanceFile, held); }
|
|
36
36
|
held.checkedAt = now;
|
|
37
37
|
const fs = require('fs');
|
|
38
38
|
const path = require('path');
|
|
@@ -50,28 +50,34 @@ function readRoutes(instanceFile) {
|
|
|
50
50
|
const record = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
51
51
|
const others = record.apps && typeof record.apps === 'object' ? Object.entries(record.apps) : [];
|
|
52
52
|
held.routes = [entryRoute('app', record), ...others.map(([name, entry]) => entryRoute(name, entry))].filter(Boolean);
|
|
53
|
+
// the application itself, hosts recorded or not: where a name a hosting twin serves as it (claimedAppHosts) goes
|
|
54
|
+
held.app = { name: 'app', url: typeof record.url === 'string' ? record.url : null, hosts: new Set() };
|
|
53
55
|
}
|
|
54
56
|
// a route with hosts and no URL names the World's service of the application's name, wherever this boot put it
|
|
55
57
|
const services = held.services;
|
|
56
|
-
for (const route of held.routes) {
|
|
58
|
+
for (const route of [...held.routes, ...(held.app ? [held.app] : [])]) {
|
|
57
59
|
const at = route.url ?? services[route.name]?.url;
|
|
58
60
|
route.origin = typeof at === 'string' ? at.replace(/\/$/, '') : null;
|
|
59
61
|
}
|
|
60
62
|
} catch (error) {
|
|
61
63
|
// gone: no route; caught mid-write: the last one read stands until the next look
|
|
62
64
|
held.mtimeMs = -1;
|
|
63
|
-
if (error && error.code === 'ENOENT') held.routes = [];
|
|
65
|
+
if (error && error.code === 'ENOENT') { held.routes = []; held.app = null; }
|
|
64
66
|
}
|
|
65
67
|
return held;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
/** The application that answers `host` in the instance `instanceFile`, or null: never a name a vendor's host rule gives
|
|
69
71
|
* a twin the World runs, which the twin answers instead. The twins are those the instance's env points at, with the
|
|
70
|
-
* caller's own (`twins`: vendor keys as `twinOrigins` reads them, the injector's map).
|
|
71
|
-
|
|
72
|
+
* caller's own (`twins`: vendor keys as `twinOrigins` reads them, the injector's map). A host no record names that a
|
|
73
|
+
* hosting twin serves as the customer's application (`claimedAppHosts`, the `appHosts` its hostsClaimed door lists: a
|
|
74
|
+
* domain the app added to its own Vercel project) answers as the application itself, as the host's DNS sends it to
|
|
75
|
+
* the deployment in production. */
|
|
76
|
+
function appRouteFor(instanceFile, host, twins = {}, claimedAppHosts = null) {
|
|
72
77
|
const bare = String(host || '').toLowerCase().replace(/\.$/, '');
|
|
73
78
|
const held = readRoutes(instanceFile);
|
|
74
|
-
|
|
79
|
+
let route = held.routes.find((r) => r.origin && appHostMatch(r.hosts, bare));
|
|
80
|
+
if (!route && claimedAppHosts && held.app && held.app.origin && appHostMatch(claimedAppHosts, bare)) route = held.app;
|
|
75
81
|
if (!route) return null;
|
|
76
82
|
const runs = (vendor) => Object.hasOwn(held.twins, vendor) || Object.hasOwn(twins, vendor);
|
|
77
83
|
return require('./vendor-hosts.cjs').vendorsOfHost(bare).some(runs) ? null : route;
|
package/app-route.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface AppRoute { readonly name: string; readonly origin: string; readonly url: string | null; readonly hosts: ReadonlySet<string> }
|
|
2
2
|
export interface AppAnswer { readonly status: number; readonly headers: Record<string, string>; readonly body: string }
|
|
3
|
-
export function appRouteFor(instanceFile: string | undefined, host: string, twins?: Readonly<Record<string, string
|
|
3
|
+
export function appRouteFor(instanceFile: string | undefined, host: string, twins?: Readonly<Record<string, string>>, claimedAppHosts?: ReadonlySet<string> | null): AppRoute | null;
|
|
4
4
|
export function appHostMatch(hosts: ReadonlySet<string>, host: string): boolean;
|
|
5
5
|
export function appForwardHeaders(url: URL): Record<string, string>;
|
|
6
6
|
export function appDestination(value: string | URL, env?: Readonly<Record<string, string | undefined>>): AppRoute | null;
|
package/dist/app-route.cjs
CHANGED
|
@@ -32,7 +32,7 @@ function readRoutes(instanceFile) {
|
|
|
32
32
|
const now = Date.now();
|
|
33
33
|
let held = APP_ROUTES.get(instanceFile);
|
|
34
34
|
if (held && now - held.checkedAt < 1000) return held;
|
|
35
|
-
if (!held) { held = { checkedAt: 0, mtimeMs: -1, routes: [], services: {}, twins: {} }; APP_ROUTES.set(instanceFile, held); }
|
|
35
|
+
if (!held) { held = { checkedAt: 0, mtimeMs: -1, routes: [], app: null, services: {}, twins: {} }; APP_ROUTES.set(instanceFile, held); }
|
|
36
36
|
held.checkedAt = now;
|
|
37
37
|
const fs = require('fs');
|
|
38
38
|
const path = require('path');
|
|
@@ -50,28 +50,34 @@ function readRoutes(instanceFile) {
|
|
|
50
50
|
const record = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
51
51
|
const others = record.apps && typeof record.apps === 'object' ? Object.entries(record.apps) : [];
|
|
52
52
|
held.routes = [entryRoute('app', record), ...others.map(([name, entry]) => entryRoute(name, entry))].filter(Boolean);
|
|
53
|
+
// the application itself, hosts recorded or not: where a name a hosting twin serves as it (claimedAppHosts) goes
|
|
54
|
+
held.app = { name: 'app', url: typeof record.url === 'string' ? record.url : null, hosts: new Set() };
|
|
53
55
|
}
|
|
54
56
|
// a route with hosts and no URL names the World's service of the application's name, wherever this boot put it
|
|
55
57
|
const services = held.services;
|
|
56
|
-
for (const route of held.routes) {
|
|
58
|
+
for (const route of [...held.routes, ...(held.app ? [held.app] : [])]) {
|
|
57
59
|
const at = route.url ?? services[route.name]?.url;
|
|
58
60
|
route.origin = typeof at === 'string' ? at.replace(/\/$/, '') : null;
|
|
59
61
|
}
|
|
60
62
|
} catch (error) {
|
|
61
63
|
// gone: no route; caught mid-write: the last one read stands until the next look
|
|
62
64
|
held.mtimeMs = -1;
|
|
63
|
-
if (error && error.code === 'ENOENT') held.routes = [];
|
|
65
|
+
if (error && error.code === 'ENOENT') { held.routes = []; held.app = null; }
|
|
64
66
|
}
|
|
65
67
|
return held;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
/** The application that answers `host` in the instance `instanceFile`, or null: never a name a vendor's host rule gives
|
|
69
71
|
* a twin the World runs, which the twin answers instead. The twins are those the instance's env points at, with the
|
|
70
|
-
* caller's own (`twins`: vendor keys as `twinOrigins` reads them, the injector's map).
|
|
71
|
-
|
|
72
|
+
* caller's own (`twins`: vendor keys as `twinOrigins` reads them, the injector's map). A host no record names that a
|
|
73
|
+
* hosting twin serves as the customer's application (`claimedAppHosts`, the `appHosts` its hostsClaimed door lists: a
|
|
74
|
+
* domain the app added to its own Vercel project) answers as the application itself, as the host's DNS sends it to
|
|
75
|
+
* the deployment in production. */
|
|
76
|
+
function appRouteFor(instanceFile, host, twins = {}, claimedAppHosts = null) {
|
|
72
77
|
const bare = String(host || '').toLowerCase().replace(/\.$/, '');
|
|
73
78
|
const held = readRoutes(instanceFile);
|
|
74
|
-
|
|
79
|
+
let route = held.routes.find((r) => r.origin && appHostMatch(r.hosts, bare));
|
|
80
|
+
if (!route && claimedAppHosts && held.app && held.app.origin && appHostMatch(claimedAppHosts, bare)) route = held.app;
|
|
75
81
|
if (!route) return null;
|
|
76
82
|
const runs = (vendor) => Object.hasOwn(held.twins, vendor) || Object.hasOwn(twins, vendor);
|
|
77
83
|
return require('./vendor-hosts.cjs').vendorsOfHost(bare).some(runs) ? null : route;
|
package/dist/app-route.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface AppRoute { readonly name: string; readonly origin: string; readonly url: string | null; readonly hosts: ReadonlySet<string> }
|
|
2
2
|
export interface AppAnswer { readonly status: number; readonly headers: Record<string, string>; readonly body: string }
|
|
3
|
-
export function appRouteFor(instanceFile: string | undefined, host: string, twins?: Readonly<Record<string, string
|
|
3
|
+
export function appRouteFor(instanceFile: string | undefined, host: string, twins?: Readonly<Record<string, string>>, claimedAppHosts?: ReadonlySet<string> | null): AppRoute | null;
|
|
4
4
|
export function appHostMatch(hosts: ReadonlySet<string>, host: string): boolean;
|
|
5
5
|
export function appForwardHeaders(url: URL): Record<string, string>;
|
|
6
6
|
export function appDestination(value: string | URL, env?: Readonly<Record<string, string | undefined>>): AppRoute | null;
|