@volter/world-core 3.0.38 → 3.0.40
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/app-route.cjs +26 -25
- package/app-route.d.cts +1 -0
- package/dist/app-route.cjs +26 -25
- package/dist/app-route.d.cts +1 -0
- package/dist/generated/pack-facts.json +409 -352
- package/dist/inject.cjs +474 -95
- package/dist/network-policy.cjs +110 -13
- package/dist/network-policy.d.cts +8 -3
- package/dist/src/actions.js +2 -1
- package/dist/src/anthropic-wire.d.ts +2 -0
- package/dist/src/anthropic-wire.js +5 -0
- package/dist/src/attestation.d.ts +6 -0
- package/dist/src/attestation.js +27 -0
- package/dist/src/bytes.d.ts +3 -0
- package/dist/src/bytes.js +17 -0
- package/dist/src/changeset.js +2 -1
- package/dist/src/clickhouse/sql.js +73 -14
- package/dist/src/derived-core.d.ts +210 -32
- package/dist/src/derived-core.js +510 -244
- package/dist/src/derived-real.d.ts +1 -1
- package/dist/src/derived-real.js +704 -93
- package/dist/src/derived.d.ts +18 -2
- package/dist/src/derived.js +21 -2
- package/dist/src/events.d.ts +28 -45
- package/dist/src/events.js +40 -58
- package/dist/src/exact-json.d.ts +10 -0
- package/dist/src/exact-json.js +98 -0
- package/dist/src/executor.d.ts +17 -0
- package/dist/src/executor.js +91 -30
- package/dist/src/file-response.js +1 -1
- package/dist/src/form.d.ts +8 -0
- package/dist/src/form.js +76 -0
- package/dist/src/git/format.d.ts +16 -0
- package/dist/src/git/format.js +110 -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 +1 -1
- package/dist/src/git/lfs.js +4 -3
- package/dist/src/graphql-wire.d.ts +6 -0
- package/dist/src/graphql-wire.js +6 -3
- package/dist/src/grpc-wire.js +2 -1
- package/dist/src/head.d.ts +1 -0
- package/dist/src/head.js +15 -4
- package/dist/src/held-reads.d.ts +6 -0
- package/dist/src/held-reads.js +60 -0
- package/dist/src/history.js +5 -4
- package/dist/src/host-port.d.ts +5 -0
- package/dist/src/host-port.js +14 -0
- package/dist/src/index.d.ts +11 -3
- package/dist/src/index.js +9 -4
- package/dist/src/log.js +12 -7
- package/dist/src/machines.d.ts +81 -5
- package/dist/src/machines.js +125 -9
- package/dist/src/managed-database.d.ts +15 -11
- package/dist/src/managed-database.js +38 -37
- package/dist/src/multipart.d.ts +21 -3
- package/dist/src/multipart.js +112 -38
- package/dist/src/observe.d.ts +3 -0
- package/dist/src/observe.js +6 -2
- package/dist/src/openai-wire.d.ts +16 -0
- package/dist/src/openai-wire.js +43 -12
- package/dist/src/pack-fetch.d.ts +4 -6
- package/dist/src/pack-fetch.js +189 -57
- package/dist/src/packRegistry.d.ts +7 -1
- package/dist/src/packRegistry.js +20 -3
- package/dist/src/private-transport.d.ts +1 -0
- package/dist/src/private-transport.js +11 -0
- package/dist/src/protobuf.js +10 -4
- package/dist/src/rateBudget.d.ts +8 -1
- package/dist/src/rateBudget.js +1 -0
- package/dist/src/redis/engine.d.ts +14 -5
- package/dist/src/redis/engine.js +271 -72
- package/dist/src/redis/frames.d.ts +17 -0
- package/dist/src/redis/frames.js +123 -0
- package/dist/src/redis/index.d.ts +6 -0
- package/dist/src/redis/index.js +6 -0
- package/dist/src/redis/json.d.ts +2 -0
- package/dist/src/redis/json.js +14 -0
- package/dist/src/redis/lua-libs.d.ts +4 -0
- package/dist/src/redis/lua-libs.js +173 -0
- package/dist/src/redis/lua.d.ts +1 -0
- package/dist/src/redis/lua.js +36 -0
- package/dist/src/redis/member-storage.d.ts +5 -0
- package/dist/src/redis/member-storage.js +75 -0
- package/dist/src/redis/resp2.d.ts +4 -0
- package/dist/src/redis/resp2.js +29 -0
- package/dist/src/redis/stream.d.ts +14 -0
- package/dist/src/redis/stream.js +335 -0
- package/dist/src/remote-execute.d.ts +2 -2
- package/dist/src/request-body.d.ts +11 -0
- package/dist/src/request-body.js +11 -0
- package/dist/src/runtime.d.ts +6 -5
- package/dist/src/runtime.js +5 -5
- package/dist/src/s3/wire.d.ts +4 -4
- package/dist/src/s3/wire.js +5 -3
- package/dist/src/scenario.d.ts +22 -0
- package/dist/src/scenario.js +35 -31
- package/dist/src/serve-http.d.ts +2 -1
- package/dist/src/serve-http.js +10 -1
- package/dist/src/serve.js +7 -4
- package/dist/src/signing.d.ts +23 -5
- package/dist/src/signing.js +74 -11
- package/dist/src/sigv4.d.ts +3 -1
- package/dist/src/sigv4.js +4 -2
- package/dist/src/smtp.js +2 -1
- package/dist/src/sockets.js +8 -3
- package/dist/src/state-system.d.ts +3 -0
- package/dist/src/storage.js +5 -2
- package/dist/src/twin-fetch.d.ts +3 -1
- package/dist/src/twin-fetch.js +3 -2
- package/dist/src/vendor-call.d.ts +10 -3
- package/dist/src/vendor-call.js +58 -14
- package/dist/test-fixtures/attestation.SOURCE.md +1 -0
- package/dist/test-fixtures/attestation.json +50 -0
- package/generated/pack-facts.json +409 -352
- package/inject.cjs +474 -95
- package/network-policy.cjs +110 -13
- package/network-policy.d.cts +8 -3
- package/package.json +11 -4
- package/src/actions.ts +2 -1
- package/src/anthropic-wire.ts +6 -0
- package/src/attestation.ts +23 -0
- package/src/bytes.ts +21 -0
- package/src/changeset.ts +2 -1
- package/src/clickhouse/sql.ts +50 -16
- package/src/derived-core.ts +573 -249
- package/src/derived-real.ts +552 -42
- package/src/derived.ts +23 -4
- package/src/events.ts +54 -85
- package/src/exact-json.ts +71 -0
- package/src/executor.ts +86 -27
- package/src/file-response.ts +1 -1
- package/src/form.ts +66 -0
- package/src/git/format.ts +89 -0
- package/src/git/index.ts +1 -0
- package/src/git/lfs.ts +5 -4
- package/src/graphql-wire.ts +8 -3
- package/src/grpc-wire.ts +2 -1
- package/src/head.ts +15 -5
- package/src/held-reads.ts +54 -0
- package/src/history.ts +5 -4
- package/src/host-port.ts +9 -0
- package/src/index.ts +10 -4
- package/src/log.ts +11 -7
- package/src/machines.ts +135 -13
- package/src/managed-database.ts +48 -40
- package/src/multipart.ts +110 -35
- package/src/observe.ts +6 -3
- package/src/openai-wire.ts +45 -14
- package/src/pack-fetch.ts +173 -50
- package/src/packRegistry.ts +27 -4
- package/src/private-transport.ts +8 -0
- package/src/protobuf.ts +8 -4
- package/src/rateBudget.ts +6 -1
- package/src/redis/engine.ts +168 -63
- package/src/redis/frames.ts +53 -0
- package/src/redis/index.ts +6 -0
- package/src/redis/json.ts +13 -0
- package/src/redis/lua-libs.ts +62 -0
- package/src/redis/lua.ts +20 -0
- package/src/redis/member-storage.ts +58 -0
- package/src/redis/resp2.ts +25 -0
- package/src/redis/stream.ts +102 -0
- package/src/remote-execute.ts +2 -2
- package/src/request-body.ts +12 -0
- package/src/runtime.ts +6 -5
- package/src/s3/wire.ts +8 -5
- package/src/scenario.ts +34 -13
- package/src/serve-http.ts +11 -2
- package/src/serve.ts +4 -3
- package/src/signing.ts +71 -17
- package/src/sigv4.ts +5 -3
- package/src/smtp.ts +3 -2
- package/src/sockets.ts +8 -3
- package/src/state-system.ts +3 -0
- package/src/storage.ts +5 -2
- package/src/twin-fetch.ts +4 -3
- package/src/vendor-call.ts +59 -12
- package/test-fixtures/attestation.json +50 -0
package/src/packRegistry.ts
CHANGED
|
@@ -182,6 +182,7 @@ export async function pullOnSchedule<T>(vendor: PullVendor, pull: () => Promise<
|
|
|
182
182
|
*/
|
|
183
183
|
export type HostRule = ({ host: string } | { suffix: string } | { hostPattern: string }) & {
|
|
184
184
|
pathPattern?: string;
|
|
185
|
+
demandPathPattern?: string | false;
|
|
185
186
|
key?: string;
|
|
186
187
|
exclude?: true;
|
|
187
188
|
};
|
|
@@ -208,6 +209,8 @@ export type TwinPack = {
|
|
|
208
209
|
rateBudget?: RateBudgetDeclaration;
|
|
209
210
|
emitter?: TwinEmitter;
|
|
210
211
|
serveExport?: string;
|
|
212
|
+
/** Declared HTTP transport cap, in bytes; the serve seam and World fronts honor it. */
|
|
213
|
+
maxRequestBodySize?: number;
|
|
211
214
|
adoption?: {
|
|
212
215
|
sdks?: string[];
|
|
213
216
|
pypi?: string[];
|
|
@@ -217,6 +220,9 @@ export type TwinPack = {
|
|
|
217
220
|
worldIds?: string[];
|
|
218
221
|
tools?: Array<{ package: string; usage: 'build' | 'deployment' }>;
|
|
219
222
|
};
|
|
223
|
+
/** Why no client case is owed though `adoption.sdks` names npm clients: the vendor maintains no official SDK, or the
|
|
224
|
+
* demand's applications use none (architecture, "The descriptor"; `conform`'s client check reads it). */
|
|
225
|
+
clientCasesNone?: string;
|
|
220
226
|
hosts?: HostRule[];
|
|
221
227
|
hostsNone?: string;
|
|
222
228
|
hostsClaimed?: { door: string; note: string };
|
|
@@ -225,7 +231,7 @@ export type TwinPack = {
|
|
|
225
231
|
/** The door that issues the application the credentials the twin will accept (a key made on the vendor's dashboard,
|
|
226
232
|
* and whatever names it: a database's URL, a project's id), and the env names it fills, each from a field of the
|
|
227
233
|
* answer: `init` writes `$issue:<service>` for each, and `up`, once this twin is running, POSTs the body to the door
|
|
228
|
-
* and sets each name to its field. A twin that holds its keys (refusing any it
|
|
234
|
+
* and sets each name to its field (`file:<field>` materializes one file; `directory:<field>` a relative-file map). A twin that holds its keys (refusing any it
|
|
229
235
|
* did not issue) declares one, so a World's applications hold keys it issued rather than fixtures it refuses. */
|
|
230
236
|
credentialDoor?: { path: string; body: Record<string, unknown>; fill: Record<string, string> };
|
|
231
237
|
/** Another pack of this vendor issues the API's credentials; architecture, descriptor World wiring. */
|
|
@@ -276,10 +282,27 @@ export function packOf(
|
|
|
276
282
|
const hand = (['stateSystem', 'references', 'rateBudget'] as const).filter((k) => (manifest.descriptor as Record<string, unknown>)[k] !== undefined);
|
|
277
283
|
if (hand.length) throw new Error(`${manifest.vendor}: the descriptor declares ${hand.join(', ')} by hand; the kernel derives them from the manifest (architecture, "The real-system adapters")`);
|
|
278
284
|
const pack: TwinPack = { vendor: manifest.vendor, ...manifest.descriptor, ...(manifest.rateBudget ? { rateBudget: manifest.rateBudget } : {}) };
|
|
279
|
-
// a pack with no vendor-backed half says why, and derives no adapters
|
|
280
|
-
|
|
285
|
+
// a pack with no vendor-backed half says why, and derives no adapters; one whose own surface has none beside lanes
|
|
286
|
+
// that do derives its lanes' adapters, its own writes settled as the World's (`unsent`)
|
|
287
|
+
const live = Object.fromEntries(Object.entries(beside).filter(([, l]) => !l.manifest.vendorBacked?.none));
|
|
288
|
+
if (manifest.vendorBacked?.none && !Object.keys(live).length) return { ...pack, vendorBacked: { none: manifest.vendorBacked.none } };
|
|
281
289
|
if (!surface) return pack;
|
|
282
|
-
|
|
290
|
+
// the unit's own surface: its operations, or a command table (a vendor that carries Redis over HTTP: architecture,
|
|
291
|
+
// "Other wires"), which names no operation a derived adapter performs; anything else is a map of lanes
|
|
292
|
+
const ownSurface = 'operations' in surface || 'commands' in surface;
|
|
293
|
+
if (manifest.vendorBacked?.none && ownSurface) {
|
|
294
|
+
const own = new Set(((surface as DerivedSurface).operations ?? []).map((o) => o.id));
|
|
295
|
+
// a command table's every write is the unit's own (no operation of it is performed)
|
|
296
|
+
const commandTable = !('operations' in surface);
|
|
297
|
+
const why = manifest.vendorBacked.none;
|
|
298
|
+
const references = [manifest as unknown as DerivedManifest, ...Object.values(beside).map((l) => l.manifest)].flatMap(derivedReferences);
|
|
299
|
+
return {
|
|
300
|
+
...pack,
|
|
301
|
+
stateSystem: { ...deriveVendorStateSystem(manifest as unknown as VendorManifest, live), unsent: (input) => (input && typeof input.lane !== 'string' && (commandTable || own.has(String(input.operationId))) ? why : undefined) },
|
|
302
|
+
...(references.length ? { references } : {}),
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
const lanes = ownSurface ? undefined : (surface as Record<string, { manifest: DerivedManifest; surface: DerivedSurface }>);
|
|
283
306
|
const units = lanes ? Object.values(lanes).map((l) => l.manifest) : [manifest as unknown as DerivedManifest, ...Object.values(beside).map((l) => l.manifest)];
|
|
284
307
|
const references = units.flatMap(derivedReferences);
|
|
285
308
|
return {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Process-local ingress capabilities for byte-stream fronts using an internal request seam.
|
|
2
|
+
// Lazy: importing the pack contract creates no key and opens no process handle.
|
|
3
|
+
const keys = new Map<string, string>();
|
|
4
|
+
export function privateTransportKey(namespace: string): string {
|
|
5
|
+
let key = keys.get(namespace);
|
|
6
|
+
if (!key) { key = crypto.randomUUID(); keys.set(namespace, key); }
|
|
7
|
+
return key;
|
|
8
|
+
}
|
package/src/protobuf.ts
CHANGED
|
@@ -69,7 +69,7 @@ function writeScalar(w: Writer, type: string, v: unknown): void {
|
|
|
69
69
|
case 'bool': w.varint(v ? 1n : 0n); break;
|
|
70
70
|
case 'fixed64': case 'sfixed64': w.fixed(BigInt(v as string), 8); break;
|
|
71
71
|
case 'double': w.fixed(Number(v), 8, true); break;
|
|
72
|
-
case 'fixed32': case 'sfixed32': w.fixed(
|
|
72
|
+
case 'fixed32': case 'sfixed32': w.fixed(BigInt(v as string | number), 4); break;
|
|
73
73
|
case 'float': w.fixed(Number(v), 4, true); break;
|
|
74
74
|
default: throw new Error(`protobuf: ${type} is not a packable scalar`);
|
|
75
75
|
}
|
|
@@ -164,7 +164,7 @@ function readScalar(r: Reader, type: string): unknown {
|
|
|
164
164
|
case 'uint32': return Number(BigInt.asUintN(32, r.varint()));
|
|
165
165
|
case 'int64': return String(BigInt.asIntN(64, r.varint()));
|
|
166
166
|
case 'uint64': return String(BigInt.asUintN(64, r.varint()));
|
|
167
|
-
case 'sint32': return Number(unzigzag(r.varint()));
|
|
167
|
+
case 'sint32': return Number(BigInt.asIntN(32, unzigzag(r.varint())));
|
|
168
168
|
case 'sint64': return String(unzigzag(r.varint()));
|
|
169
169
|
case 'bool': return r.varint() !== 0n;
|
|
170
170
|
case 'fixed64': return String(new DataView(r.take(8).slice().buffer).getBigUint64(0, true));
|
|
@@ -223,7 +223,9 @@ export function decodeMessage(schema: ProtoSchema, type: string, bytes: Uint8Arr
|
|
|
223
223
|
const out: Row = {};
|
|
224
224
|
const r = new Reader(bytes);
|
|
225
225
|
while (!r.done) {
|
|
226
|
-
const
|
|
226
|
+
const rawKey = r.varint();
|
|
227
|
+
if (rawKey > 0xffffffffn) throw new Error('protobuf: field tag exceeds 32 bits');
|
|
228
|
+
const key = Number(rawKey);
|
|
227
229
|
const number = key >>> 3;
|
|
228
230
|
const wire = key & 7;
|
|
229
231
|
const f = byNumber.get(number);
|
|
@@ -232,7 +234,9 @@ export function decodeMessage(schema: ProtoSchema, type: string, bytes: Uint8Arr
|
|
|
232
234
|
const entry = new Reader(r.bytes());
|
|
233
235
|
let k: unknown; let v: unknown;
|
|
234
236
|
while (!entry.done) {
|
|
235
|
-
const
|
|
237
|
+
const rawKey = entry.varint();
|
|
238
|
+
if (rawKey > 0xffffffffn) throw new Error('protobuf: map field tag exceeds 32 bits');
|
|
239
|
+
const ek = Number(rawKey);
|
|
236
240
|
if ((ek >>> 3) === 1) k = readValue(schema, entry, { type: f.map.key, kind: 'scalar' }, ek & 7);
|
|
237
241
|
else if ((ek >>> 3) === 2) v = readValue(schema, entry, { type: f.map.value, kind: f.map.valueKind }, ek & 7);
|
|
238
242
|
else entry.skip(ek & 7);
|
package/src/rateBudget.ts
CHANGED
|
@@ -194,6 +194,10 @@ export type RateBudgetDeclaration = {
|
|
|
194
194
|
* review, and the ceiling is the one number that can cost days if it is wrong.
|
|
195
195
|
*/
|
|
196
196
|
reason: string;
|
|
197
|
+
/** The vendor's documented allowance, in calls a minute, and the page that documents it, which the pack cites on a
|
|
198
|
+
* `// source:` line (checked like every other vendor fact): required of a budget that admits more than the fallback
|
|
199
|
+
* (`scripts/rate-budget-check.ts`). */
|
|
200
|
+
allowance?: { perMinute: number; source: string };
|
|
197
201
|
};
|
|
198
202
|
|
|
199
203
|
/**
|
|
@@ -203,7 +207,7 @@ export type RateBudgetDeclaration = {
|
|
|
203
207
|
* pattern. (Declarations are repo source, not user input — this is a performance fix, not a
|
|
204
208
|
* sanitizer.)
|
|
205
209
|
*/
|
|
206
|
-
export type RateBudgetPolicy = Required<Omit<RateBudgetDeclaration, 'rules'>> & {
|
|
210
|
+
export type RateBudgetPolicy = Required<Omit<RateBudgetDeclaration, 'rules' | 'allowance'>> & Pick<RateBudgetDeclaration, 'allowance'> & {
|
|
207
211
|
vendor: string;
|
|
208
212
|
rules: RateBudgetWeightRule[];
|
|
209
213
|
/** `compiled[i]` is `rules[i].match`, compiled. Same length, same order. */
|
|
@@ -329,6 +333,7 @@ function normalize(vendor: string, decl: RateBudgetDeclaration): RateBudgetPolic
|
|
|
329
333
|
return {
|
|
330
334
|
vendor,
|
|
331
335
|
reason: decl.reason,
|
|
336
|
+
...(decl.allowance ? { allowance: { ...decl.allowance } } : {}),
|
|
332
337
|
windowMs,
|
|
333
338
|
ceiling,
|
|
334
339
|
burstCeiling,
|