@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.
Files changed (179) hide show
  1. package/app-route.cjs +26 -25
  2. package/app-route.d.cts +1 -0
  3. package/dist/app-route.cjs +26 -25
  4. package/dist/app-route.d.cts +1 -0
  5. package/dist/generated/pack-facts.json +409 -352
  6. package/dist/inject.cjs +474 -95
  7. package/dist/network-policy.cjs +110 -13
  8. package/dist/network-policy.d.cts +8 -3
  9. package/dist/src/actions.js +2 -1
  10. package/dist/src/anthropic-wire.d.ts +2 -0
  11. package/dist/src/anthropic-wire.js +5 -0
  12. package/dist/src/attestation.d.ts +6 -0
  13. package/dist/src/attestation.js +27 -0
  14. package/dist/src/bytes.d.ts +3 -0
  15. package/dist/src/bytes.js +17 -0
  16. package/dist/src/changeset.js +2 -1
  17. package/dist/src/clickhouse/sql.js +73 -14
  18. package/dist/src/derived-core.d.ts +210 -32
  19. package/dist/src/derived-core.js +510 -244
  20. package/dist/src/derived-real.d.ts +1 -1
  21. package/dist/src/derived-real.js +704 -93
  22. package/dist/src/derived.d.ts +18 -2
  23. package/dist/src/derived.js +21 -2
  24. package/dist/src/events.d.ts +28 -45
  25. package/dist/src/events.js +40 -58
  26. package/dist/src/exact-json.d.ts +10 -0
  27. package/dist/src/exact-json.js +98 -0
  28. package/dist/src/executor.d.ts +17 -0
  29. package/dist/src/executor.js +91 -30
  30. package/dist/src/file-response.js +1 -1
  31. package/dist/src/form.d.ts +8 -0
  32. package/dist/src/form.js +76 -0
  33. package/dist/src/git/format.d.ts +16 -0
  34. package/dist/src/git/format.js +110 -0
  35. package/dist/src/git/index.d.ts +1 -0
  36. package/dist/src/git/index.js +1 -0
  37. package/dist/src/git/lfs.d.ts +1 -1
  38. package/dist/src/git/lfs.js +4 -3
  39. package/dist/src/graphql-wire.d.ts +6 -0
  40. package/dist/src/graphql-wire.js +6 -3
  41. package/dist/src/grpc-wire.js +2 -1
  42. package/dist/src/head.d.ts +1 -0
  43. package/dist/src/head.js +15 -4
  44. package/dist/src/held-reads.d.ts +6 -0
  45. package/dist/src/held-reads.js +60 -0
  46. package/dist/src/history.js +5 -4
  47. package/dist/src/host-port.d.ts +5 -0
  48. package/dist/src/host-port.js +14 -0
  49. package/dist/src/index.d.ts +11 -3
  50. package/dist/src/index.js +9 -4
  51. package/dist/src/log.js +12 -7
  52. package/dist/src/machines.d.ts +81 -5
  53. package/dist/src/machines.js +125 -9
  54. package/dist/src/managed-database.d.ts +15 -11
  55. package/dist/src/managed-database.js +38 -37
  56. package/dist/src/multipart.d.ts +21 -3
  57. package/dist/src/multipart.js +112 -38
  58. package/dist/src/observe.d.ts +3 -0
  59. package/dist/src/observe.js +6 -2
  60. package/dist/src/openai-wire.d.ts +16 -0
  61. package/dist/src/openai-wire.js +43 -12
  62. package/dist/src/pack-fetch.d.ts +4 -6
  63. package/dist/src/pack-fetch.js +189 -57
  64. package/dist/src/packRegistry.d.ts +7 -1
  65. package/dist/src/packRegistry.js +20 -3
  66. package/dist/src/private-transport.d.ts +1 -0
  67. package/dist/src/private-transport.js +11 -0
  68. package/dist/src/protobuf.js +10 -4
  69. package/dist/src/rateBudget.d.ts +8 -1
  70. package/dist/src/rateBudget.js +1 -0
  71. package/dist/src/redis/engine.d.ts +14 -5
  72. package/dist/src/redis/engine.js +271 -72
  73. package/dist/src/redis/frames.d.ts +17 -0
  74. package/dist/src/redis/frames.js +123 -0
  75. package/dist/src/redis/index.d.ts +6 -0
  76. package/dist/src/redis/index.js +6 -0
  77. package/dist/src/redis/json.d.ts +2 -0
  78. package/dist/src/redis/json.js +14 -0
  79. package/dist/src/redis/lua-libs.d.ts +4 -0
  80. package/dist/src/redis/lua-libs.js +173 -0
  81. package/dist/src/redis/lua.d.ts +1 -0
  82. package/dist/src/redis/lua.js +36 -0
  83. package/dist/src/redis/member-storage.d.ts +5 -0
  84. package/dist/src/redis/member-storage.js +75 -0
  85. package/dist/src/redis/resp2.d.ts +4 -0
  86. package/dist/src/redis/resp2.js +29 -0
  87. package/dist/src/redis/stream.d.ts +14 -0
  88. package/dist/src/redis/stream.js +335 -0
  89. package/dist/src/remote-execute.d.ts +2 -2
  90. package/dist/src/request-body.d.ts +11 -0
  91. package/dist/src/request-body.js +11 -0
  92. package/dist/src/runtime.d.ts +6 -5
  93. package/dist/src/runtime.js +5 -5
  94. package/dist/src/s3/wire.d.ts +4 -4
  95. package/dist/src/s3/wire.js +5 -3
  96. package/dist/src/scenario.d.ts +22 -0
  97. package/dist/src/scenario.js +35 -31
  98. package/dist/src/serve-http.d.ts +2 -1
  99. package/dist/src/serve-http.js +10 -1
  100. package/dist/src/serve.js +7 -4
  101. package/dist/src/signing.d.ts +23 -5
  102. package/dist/src/signing.js +74 -11
  103. package/dist/src/sigv4.d.ts +3 -1
  104. package/dist/src/sigv4.js +4 -2
  105. package/dist/src/smtp.js +2 -1
  106. package/dist/src/sockets.js +8 -3
  107. package/dist/src/state-system.d.ts +3 -0
  108. package/dist/src/storage.js +5 -2
  109. package/dist/src/twin-fetch.d.ts +3 -1
  110. package/dist/src/twin-fetch.js +3 -2
  111. package/dist/src/vendor-call.d.ts +10 -3
  112. package/dist/src/vendor-call.js +58 -14
  113. package/dist/test-fixtures/attestation.SOURCE.md +1 -0
  114. package/dist/test-fixtures/attestation.json +50 -0
  115. package/generated/pack-facts.json +409 -352
  116. package/inject.cjs +474 -95
  117. package/network-policy.cjs +110 -13
  118. package/network-policy.d.cts +8 -3
  119. package/package.json +11 -4
  120. package/src/actions.ts +2 -1
  121. package/src/anthropic-wire.ts +6 -0
  122. package/src/attestation.ts +23 -0
  123. package/src/bytes.ts +21 -0
  124. package/src/changeset.ts +2 -1
  125. package/src/clickhouse/sql.ts +50 -16
  126. package/src/derived-core.ts +573 -249
  127. package/src/derived-real.ts +552 -42
  128. package/src/derived.ts +23 -4
  129. package/src/events.ts +54 -85
  130. package/src/exact-json.ts +71 -0
  131. package/src/executor.ts +86 -27
  132. package/src/file-response.ts +1 -1
  133. package/src/form.ts +66 -0
  134. package/src/git/format.ts +89 -0
  135. package/src/git/index.ts +1 -0
  136. package/src/git/lfs.ts +5 -4
  137. package/src/graphql-wire.ts +8 -3
  138. package/src/grpc-wire.ts +2 -1
  139. package/src/head.ts +15 -5
  140. package/src/held-reads.ts +54 -0
  141. package/src/history.ts +5 -4
  142. package/src/host-port.ts +9 -0
  143. package/src/index.ts +10 -4
  144. package/src/log.ts +11 -7
  145. package/src/machines.ts +135 -13
  146. package/src/managed-database.ts +48 -40
  147. package/src/multipart.ts +110 -35
  148. package/src/observe.ts +6 -3
  149. package/src/openai-wire.ts +45 -14
  150. package/src/pack-fetch.ts +173 -50
  151. package/src/packRegistry.ts +27 -4
  152. package/src/private-transport.ts +8 -0
  153. package/src/protobuf.ts +8 -4
  154. package/src/rateBudget.ts +6 -1
  155. package/src/redis/engine.ts +168 -63
  156. package/src/redis/frames.ts +53 -0
  157. package/src/redis/index.ts +6 -0
  158. package/src/redis/json.ts +13 -0
  159. package/src/redis/lua-libs.ts +62 -0
  160. package/src/redis/lua.ts +20 -0
  161. package/src/redis/member-storage.ts +58 -0
  162. package/src/redis/resp2.ts +25 -0
  163. package/src/redis/stream.ts +102 -0
  164. package/src/remote-execute.ts +2 -2
  165. package/src/request-body.ts +12 -0
  166. package/src/runtime.ts +6 -5
  167. package/src/s3/wire.ts +8 -5
  168. package/src/scenario.ts +34 -13
  169. package/src/serve-http.ts +11 -2
  170. package/src/serve.ts +4 -3
  171. package/src/signing.ts +71 -17
  172. package/src/sigv4.ts +5 -3
  173. package/src/smtp.ts +3 -2
  174. package/src/sockets.ts +8 -3
  175. package/src/state-system.ts +3 -0
  176. package/src/storage.ts +5 -2
  177. package/src/twin-fetch.ts +4 -3
  178. package/src/vendor-call.ts +59 -12
  179. package/test-fixtures/attestation.json +50 -0
@@ -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
- if (manifest.vendorBacked?.none) return { ...pack, vendorBacked: { none: manifest.vendorBacked.none } };
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
- const lanes = 'operations' in surface ? undefined : (surface as Record<string, { manifest: DerivedManifest; surface: DerivedSurface }>);
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(Number(v), 4); break;
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 key = Number(r.varint());
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 ek = Number(entry.varint());
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,