@volter/world-core 2.0.37 → 3.0.1
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/src/bytes.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Bytes a vendor's wire carries compressed, as a handler reads them. Web-standard compression streams where the runtime
|
|
2
|
+
// has them (workerd, the browser, Node), so the kernel's root keeps no static import of Node's zlib — a browser client
|
|
3
|
+
// imports this module too. Bun has neither `CompressionStream` nor `DecompressionStream` (Bun 1.2.20:
|
|
4
|
+
// `bun -e "typeof CompressionStream"` prints `undefined`), and a local World is served by Bun, so there the builtin is
|
|
5
|
+
// reached the way the kernel reaches every builtin: `process.getBuiltinModule`, at call time, never at import (the seam
|
|
6
|
+
// serve-http.ts's `nodeBuiltin` uses).
|
|
7
|
+
|
|
8
|
+
type Zlib = {
|
|
9
|
+
gzipSync(b: Uint8Array): Uint8Array;
|
|
10
|
+
gunzipSync(b: Uint8Array): Uint8Array;
|
|
11
|
+
deflateSync(b: Uint8Array): Uint8Array;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function zlib(what: string): Zlib {
|
|
15
|
+
const get = (globalThis as { process?: { getBuiltinModule?: (id: string) => unknown } }).process?.getBuiltinModule;
|
|
16
|
+
if (typeof get !== 'function') throw new Error(`${what}: this runtime has neither the compression streams nor node:zlib (process.getBuiltinModule)`);
|
|
17
|
+
return get('node:zlib') as Zlib;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function streamed(bytes: Uint8Array, stream: CompressionStream | DecompressionStream): Promise<Uint8Array> {
|
|
21
|
+
const piped = new Response(bytes as unknown as BodyInit).body!.pipeThrough(stream as unknown as TransformStream<Uint8Array, Uint8Array>);
|
|
22
|
+
return new Uint8Array(await new Response(piped).arrayBuffer());
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The bytes of a gzip member (a SARIF upload, a tarball's contents, a gzipped request body). */
|
|
26
|
+
export async function gunzip(bytes: Uint8Array): Promise<Uint8Array> {
|
|
27
|
+
if (typeof DecompressionStream === 'function') return streamed(bytes, new DecompressionStream('gzip'));
|
|
28
|
+
return new Uint8Array(zlib('gunzip').gunzipSync(bytes));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Bytes as a gzip member. */
|
|
32
|
+
export async function gzip(bytes: Uint8Array): Promise<Uint8Array> {
|
|
33
|
+
if (typeof CompressionStream === 'function') return streamed(bytes, new CompressionStream('gzip'));
|
|
34
|
+
return new Uint8Array(zlib('gzip').gzipSync(bytes));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Bytes as a zlib (deflate) member: git's object and pack framing. Reading one back is git/inflate.ts, which also
|
|
38
|
+
* reports how many bytes it consumed, since a packfile's objects sit one after another with no length. */
|
|
39
|
+
export async function deflate(bytes: Uint8Array): Promise<Uint8Array> {
|
|
40
|
+
if (typeof CompressionStream === 'function') return streamed(bytes, new CompressionStream('deflate'));
|
|
41
|
+
return new Uint8Array(zlib('deflate').deflateSync(bytes));
|
|
42
|
+
}
|
package/src/changeset.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveReferences } from './references.ts';
|
|
2
|
-
import {
|
|
2
|
+
import { withHistoryLocks } from './ancestry.ts';
|
|
3
3
|
import { captureParentHistory, historyChanges, historyEntries, historyPrefix, readHistoryView, type HistoryReference } from './history.ts';
|
|
4
4
|
import { worldPaths } from './storage.ts';
|
|
5
5
|
// The changeset primitive — "commit" for operational reality (docs/concepts/the-model.md, v0).
|
|
@@ -221,7 +221,7 @@ export type Changeset = {
|
|
|
221
221
|
pushedBy?: string;
|
|
222
222
|
/** v3 — set by `rebaseChangeset`: the hash this object was rebased from, and when. Outside the hash. */
|
|
223
223
|
rebasedFrom?: { contentHash: string; at: string };
|
|
224
|
-
/**
|
|
224
|
+
/** Where the parent log stood when this was cut, per state service (its entry count):
|
|
225
225
|
* a rebase reads the parent's entries since here to name what moved under the changeset. Outside
|
|
226
226
|
* the hash (metadata of the cut, not of the change). */
|
|
227
227
|
cut?: Record<string, HistoryReference>;
|
|
@@ -262,7 +262,7 @@ export function captureMarker(opts: { id: string; world: string; ledgers: Ledger
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
function positionKey(service: string, stateService: string): string {
|
|
265
|
-
return `${service}
|
|
265
|
+
return `${service}\u0000${stateService}`;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
/** A marker taken in world A says nothing about world B's ledgers — comparing them would
|
|
@@ -1001,12 +1001,12 @@ export type RebaseActionResult = {
|
|
|
1001
1001
|
export type RebaseReport = { changeset: string; from: string; to: string | null; at: string; outcome: 'unchanged' | 'rebased' | 'conflict'; actions: RebaseActionResult[] };
|
|
1002
1002
|
|
|
1003
1003
|
export function rebaseChangeset(changeset: Changeset, opts: { targets: RebaseTarget[]; at?: string }): { changeset: Changeset; report: RebaseReport } {
|
|
1004
|
-
return
|
|
1004
|
+
return withHistoryLocks(opts.targets.map((t) => worldPaths(t.stateService, t.controlRoot).dir), () => rebaseChangesetLocked(changeset, opts));
|
|
1005
1005
|
}
|
|
1006
1006
|
function rebaseChangesetLocked(changeset: Changeset, opts: { targets: RebaseTarget[]; at?: string }): { changeset: Changeset; report: RebaseReport } {
|
|
1007
1007
|
const at = opts.at ?? new Date().toISOString();
|
|
1008
1008
|
const targetFor = new Map(opts.targets.map((t) => [t.service, t]));
|
|
1009
|
-
//
|
|
1009
|
+
// what the parent did since the cut, per service — the entries past the cut position.
|
|
1010
1010
|
// A set action conflicts where the parent set the same field of the same subject to something
|
|
1011
1011
|
// else; a subject the parent touched otherwise is rebased; the rest is unchanged.
|
|
1012
1012
|
const sinceCut = new Map<string, Entry[]>();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// The kernel's ClickHouse® SQL engine (architecture, "The kernel owns shared mechanics"): parsed into an AST and evaluated
|
|
2
|
+
// over rows a pack supplies as a catalog of relations. Tinybird's pipes and PostHog's HogQL are ClickHouse SQL; each pack
|
|
3
|
+
// keeps its own front (Tinybird's templates, HogQL's tables and property access). Importing it does nothing.
|
|
4
|
+
export * from './values.ts';
|
|
5
|
+
export * from './types.ts';
|
|
6
|
+
export * from './sql.ts';
|