snapback2 0.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 +127 -0
- package/bin/snapback2.mjs +36 -0
- package/dist/api.d.ts +20 -0
- package/dist/assets.d.ts +34 -0
- package/dist/client-assets.d.ts +26 -0
- package/dist/client-offline.d.ts +94 -0
- package/dist/client-outbox.d.ts +58 -0
- package/dist/client-upload.d.ts +41 -0
- package/dist/client-wire.d.ts +41 -0
- package/dist/client.d.ts +12 -0
- package/dist/client.mjs +5 -0
- package/dist/client.mjs.map +7 -0
- package/dist/compiler-core.mjs +60 -0
- package/dist/compiler-core.mjs.map +7 -0
- package/dist/compiler-lib.d.ts +71 -0
- package/dist/compiler.mjs +5 -0
- package/dist/compiler.mjs.map +7 -0
- package/dist/drain.d.ts +33 -0
- package/dist/expo/files.d.ts +3 -0
- package/dist/expo/index.d.ts +16 -0
- package/dist/expo/token-store.d.ts +7 -0
- package/dist/expo/witness.d.ts +28 -0
- package/dist/expo/witness.mjs +2 -0
- package/dist/expo/witness.mjs.map +7 -0
- package/dist/expo.d.ts +4 -0
- package/dist/expo.mjs +9 -0
- package/dist/expo.mjs.map +7 -0
- package/dist/guide/auth.md +89 -0
- package/dist/guide/effects.md +52 -0
- package/dist/guide/families.json +446 -0
- package/dist/guide/grammar.md +52 -0
- package/dist/guide/live-query.md +27 -0
- package/dist/guide/offline.md +75 -0
- package/dist/guide/personas.md +15 -0
- package/dist/guide/quarry.md +297 -0
- package/dist/guide/testing.md +57 -0
- package/dist/index.d.ts +362 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +7 -0
- package/dist/offline-protocol.d.ts +180 -0
- package/dist/offline-schema.d.ts +1 -0
- package/dist/offline.d.ts +177 -0
- package/dist/react-core.d.ts +91 -0
- package/dist/react-core.mjs +2 -0
- package/dist/react-core.mjs.map +7 -0
- package/dist/react-native/components.d.ts +23 -0
- package/dist/react-native/files.d.ts +43 -0
- package/dist/react-native/source.d.ts +16 -0
- package/dist/react-native.d.ts +4 -0
- package/dist/react-native.mjs +2 -0
- package/dist/react-native.mjs.map +7 -0
- package/dist/react.d.ts +19 -0
- package/dist/react.mjs +2 -0
- package/dist/react.mjs.map +7 -0
- package/dist/sqlite-test.mjs +1720 -0
- package/dist/sqlite-test.mjs.map +7 -0
- package/dist/sse.d.ts +44 -0
- package/dist/store/byte-cache.d.ts +162 -0
- package/dist/store/canonical.d.ts +2 -0
- package/dist/store/indexeddb.d.ts +23 -0
- package/dist/store/locks.d.ts +11 -0
- package/dist/store/outbox.d.ts +113 -0
- package/dist/store/overlay-retirement.d.ts +17 -0
- package/dist/store/projection.d.ts +11 -0
- package/dist/store/range-store.d.ts +388 -0
- package/dist/store/sqlite-driver.conformance.d.ts +7 -0
- package/dist/store/sqlite-driver.d.ts +16 -0
- package/dist/store/sqlite-expo.d.ts +3 -0
- package/dist/store/sqlite.d.ts +31 -0
- package/dist/templates/chat/expo/App.tsx +29 -0
- package/dist/templates/chat/expo/app.json +11 -0
- package/dist/templates/chat/expo/index.js +3 -0
- package/dist/templates/chat/expo/shared/log.js +92 -0
- package/dist/templates/chat/expo/shared/log.ts +130 -0
- package/dist/templates/chat/expo/shared/offline.js +8 -0
- package/dist/templates/chat/expo/shared/offline.ts +9 -0
- package/dist/templates/chat/expo/src/Chat.tsx +23 -0
- package/dist/templates/chat/expo/src/Composer.tsx +23 -0
- package/dist/templates/chat/expo/src/MediaView.tsx +29 -0
- package/dist/templates/chat/expo/src/Witness.tsx +131 -0
- package/dist/templates/chat/expo/src/screens/Inbox.tsx +9 -0
- package/dist/templates/chat/expo/src/screens/Search.tsx +10 -0
- package/dist/templates/chat/expo/src/screens/Thread.tsx +22 -0
- package/dist/templates/chat/expo/src/witness-state.ts +68 -0
- package/dist/templates/chat/expo/tsconfig.json +5 -0
- package/dist/templates/chat/react/index.html +5 -0
- package/dist/templates/chat/react/shared/log.js +92 -0
- package/dist/templates/chat/react/shared/log.ts +130 -0
- package/dist/templates/chat/react/shared/offline.js +8 -0
- package/dist/templates/chat/react/shared/offline.ts +9 -0
- package/dist/templates/chat/react/src/App.tsx +36 -0
- package/dist/templates/chat/react/src/Composer.tsx +45 -0
- package/dist/templates/chat/react/src/Inbox.tsx +24 -0
- package/dist/templates/chat/react/src/Search.tsx +26 -0
- package/dist/templates/chat/react/src/Thread.tsx +126 -0
- package/dist/templates/chat/react/src/env.d.ts +1 -0
- package/dist/templates/chat/react/src/main.tsx +20 -0
- package/dist/templates/chat/shared/log.js +92 -0
- package/dist/templates/chat/shared/log.ts +130 -0
- package/dist/templates/chat/shared/offline.js +8 -0
- package/dist/templates/chat/shared/offline.ts +9 -0
- package/dist/templates/chat/snapback/deliveries.q +33 -0
- package/dist/templates/chat/snapback/delivery.ts +30 -0
- package/dist/templates/chat/snapback/feeds.q +14 -0
- package/dist/templates/chat/snapback/follows.q +11 -0
- package/dist/templates/chat/snapback/groups.q +40 -0
- package/dist/templates/chat/snapback/messages.q +32 -0
- package/dist/templates/chat/snapback/notifications.q +7 -0
- package/dist/templates/chat/snapback/posts.q +4 -0
- package/dist/templates/chat/snapback/profiles.q +17 -0
- package/dist/templates/chat/snapback/schema.q +136 -0
- package/dist/templates/chat/snapback/seed.ts +45 -0
- package/dist/templates/chat/snapback/tests/chat.test.ts +759 -0
- package/dist/templates/react/index.html +5 -0
- package/dist/templates/react/src/App.tsx +5 -0
- package/dist/templates/react/src/main.tsx +18 -0
- package/dist/templates/todos/snapback/schema.q +11 -0
- package/dist/templates/todos/snapback/seed.ts +10 -0
- package/dist/templates/todos/snapback/tests/todos.test.ts +13 -0
- package/dist/templates/todos/snapback/todos.q +6 -0
- package/dist/test-runner.mjs +8541 -0
- package/dist/test-runner.mjs.map +7 -0
- package/dist/test.d.ts +28 -0
- package/dist/test.mjs +8541 -0
- package/dist/test.mjs.map +7 -0
- package/dist/token-store.d.ts +3 -0
- package/dist/twin-hydrate.d.ts +43 -0
- package/dist/twin.d.ts +70 -0
- package/dist/types.d.ts +410 -0
- package/dist/witness-test.mjs +2 -0
- package/dist/witness-test.mjs.map +7 -0
- package/package.json +117 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../evaluator/src/errors.ts", "../../evaluator/src/certificate-identity.ts", "../../evaluator/src/hash.ts", "../src/offline-schema.ts", "../src/offline-protocol.ts", "../src/twin-hydrate.ts", "../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Trace } from \"./types\";\n\nexport class EvalError extends Error {\n /** The run's trace up to the failure, attached by the store so a caller can tell an uncovered read from a genuine refusal. */\n trace?: Trace;\n /** The sites the failed run read outside coverage; empty when every read before the failure was covered. */\n partialSites?: string[];\n\n constructor(readonly code: string, message: string, readonly authoredCode: string | null = null) {\n super(`${code}: ${message}`);\n }\n}\n\nexport function requireRowIdentity(\n table: string,\n operation: string,\n keyId: string,\n rowId: string,\n): void {\n if (keyId !== rowId) {\n throw new EvalError(\"E_INPUT\", `${table} ${operation} key ${keyId} does not match row id ${rowId}`);\n }\n}\n", "// @ref LLP 1001#10-what-binds-and-how-it-is-checked \u2014 certificate identity uses\n// Rust serde's BTreeMap order even when a direct TypeScript caller constructed\n// the equivalent object with a different property insertion order.\n\nimport { EvalError } from \"./errors\";\n\nexport function canonicalProgramJson(program: any): string {\n return JSON.stringify({\n ...program,\n args: sortedMap(program.args ?? {}, normalizeArgType),\n body: (program.body ?? []).map(normalizeStatement),\n });\n}\n\n// @ref LLP 1012#8-the-delivery-envelope-the-validator-and-resume \u2014 schema and\n// rule identity mirror serde's struct-field order and skip rules exactly, so\n// the hash is the same whether the schema arrived in struct order (the\n// corpus) or through a sorted `serde_json::Value` (`GET /api/program`).\n//\n// An unseen shape never hashes equal to a known one: a payload with a field\n// serde's struct does not carry is refused (`E_SCHEMA`) rather than dropped,\n// since dropping would let two different schemas hash the same; an unknown\n// variant is kept whole with its payload deep-sorted, so it hashes\n// deterministically and unlike anything this normalizer knows. The twin\n// treats a refusal as `hydrating` and never predicts under it.\nexport function canonicalSchemaJson(schema: any): string {\n known(schema, [\"tables\", \"maintains\", \"channels\", \"auth\", \"effects\"], \"schema\");\n const canonical: Record<string, any> = {\n tables: sortedMap(schema.tables ?? {}, normalizeTable),\n maintains: (schema.maintains ?? []).map(normalizeMaintain),\n };\n if (schema.channels !== undefined && Object.keys(schema.channels).length > 0) {\n canonical.channels = sortedMap(schema.channels, normalizeChannel);\n }\n if (schema.auth !== undefined && schema.auth !== null) known(schema.auth, [\"password\", \"guests\"], \"auth\");\n if (schema.auth !== undefined && (schema.auth.password || schema.auth.guests)) {\n canonical.auth = { password: schema.auth.password, guests: schema.auth.guests };\n }\n if (schema.effects !== undefined && schema.effects.length > 0) canonical.effects = schema.effects;\n return JSON.stringify(canonical);\n}\n\n/** Refuses a payload carrying a field the serde struct does not: a shape this hasher has never seen. */\nfunction known(record: any, fields: readonly string[], what: string): void {\n if (typeof record !== \"object\" || record === null || Array.isArray(record)) {\n throw new EvalError(\"E_SCHEMA\", `${what} must be an object`);\n }\n const unknown = Object.keys(record).filter((key) => !fields.includes(key));\n if (unknown.length > 0) {\n throw new EvalError(\"E_SCHEMA\", `unknown ${what} field ${unknown.join(\", \")}: a schema shape newer than this evaluator`);\n }\n}\n\n/** The struct's fields in serde order, and nothing else: `known` plus the reconstruction in one step. */\nfunction pick(record: any, fields: readonly string[], what: string): Record<string, any> {\n known(record, fields, what);\n const out: Record<string, any> = {};\n for (const field of fields) if (record[field] !== undefined) out[field] = record[field];\n return out;\n}\n\n/** An unknown variant's payload with every object's keys sorted: deterministic, and never a known shape's bytes. */\nfunction deepSorted(value: any): any {\n if (Array.isArray(value)) return value.map(deepSorted);\n if (typeof value !== \"object\" || value === null) return value;\n return sortedMap(value, deepSorted);\n}\n\n/** A rule in serde's field order: what `Schema::rule_hash` serializes beside the schema hash. */\nexport function canonicalRuleJson(rule: any): string {\n return JSON.stringify(normalizeRule(rule));\n}\n\nfunction normalizeMaintain(maintain: any): any {\n known(maintain, [\"kind\", \"source\", \"by\", \"target\", \"readable\"], \"maintain\");\n return {\n kind: normalizeMaintainKind(maintain.kind),\n source: maintain.source,\n by: maintain.by,\n target: maintain.target,\n readable: maintain.readable === null || maintain.readable === undefined ? null : normalizeRule(maintain.readable),\n };\n}\n\nfunction normalizeMaintainKind(kind: any): any {\n if (typeof kind !== \"object\" || kind === null) return kind;\n const [tag, data] = tagged(kind);\n return { [tag]: tag === \"Sum\" ? pick(data, [\"of\"], \"maintain.kind.Sum\") : deepSorted(data) };\n}\n\nfunction normalizeTable(table: any): any {\n known(table, [\"columns\", \"indexes\", \"rules\", \"constraints\", \"retain\"], \"table\");\n return {\n columns: sortedMap(table.columns ?? {}, normalizeColumnType),\n indexes: sortedMap(table.indexes ?? {}, normalizeIndex),\n rules: normalizeRules(table.rules),\n constraints: (table.constraints ?? []).map(normalizeConstraint),\n retain: table.retain ?? \"until-revoked\",\n };\n}\n\nfunction normalizeIndex(index: any): any {\n return pick(index, [\"columns\", \"unique\"], \"index\");\n}\n\nfunction normalizeChannel(channel: any): any {\n known(channel, [\"args\", \"publish\", \"subscribe\", \"ttl_ms\"], \"channel\");\n return {\n args: sortedMap(channel.args ?? {}, normalizeArgType),\n publish: normalizeRule(channel.publish),\n subscribe: normalizeRule(channel.subscribe),\n ttl_ms: channel.ttl_ms,\n };\n}\n\nfunction normalizeRules(rules: any): any {\n if (rules === undefined || rules === null) return rules;\n known(rules, [\"read\", \"insert\", \"update\", \"delete\"], \"rules\");\n return {\n read: normalizeRule(rules.read),\n insert: normalizeRule(rules.insert),\n update: normalizeRule(rules.update),\n delete: normalizeRule(rules.delete),\n };\n}\n\nexport function normalizeRule(rule: any): any {\n if (typeof rule !== \"object\" || rule === null) return rule;\n const [kind, data] = tagged(rule);\n switch (kind) {\n case \"Eq\":\n case \"Ne\":\n return { [kind]: data.map(normalizeRuleTerm) };\n case \"And\":\n case \"Or\":\n return { [kind]: data.map(normalizeRule) };\n case \"Not\":\n return { [kind]: normalizeRule(data) };\n case \"Exists\":\n case \"Created\":\n return { [kind]: { ...pick(data, [\"table\", \"index\", \"key\", \"provenance\"], `rule.${kind}`), key: data.key.map(normalizeRuleTerm) } };\n case \"Public\":\n return { Public: pick(data, [\"reason\"], \"rule.Public\") };\n default:\n return { [kind]: deepSorted(data) };\n }\n}\n\nfunction normalizeRuleTerm(term: any): any {\n if (typeof term !== \"object\" || term === null) return term;\n const [kind, data] = tagged(term);\n if (kind === \"Literal\") return { Literal: normalizeValue(data) };\n if (kind === \"Field\" || kind === \"OldField\" || kind === \"NextField\") return term;\n return { [kind]: deepSorted(data) };\n}\n\nfunction normalizeConstraint(constraint: any): any {\n if (typeof constraint !== \"object\" || constraint === null) return constraint;\n const [kind, data] = tagged(constraint);\n const what = `constraint.${kind}`;\n switch (kind) {\n case \"Unique\": return { Unique: pick(data, [\"index\"], what) };\n case \"Cap\": return { Cap: pick(data, [\"by\", \"max\"], what) };\n case \"Immutable\": return { Immutable: pick(data, [\"fields\"], what) };\n case \"Text\":\n known(data, [\"field\", \"min\", \"format\"], what);\n return { Text: {\n field: data.field,\n min: data.min ?? 0,\n ...(data.format === undefined || data.format === null ? {} : { format: data.format }),\n } };\n case \"FinalExistsOnInsert\":\n return { FinalExistsOnInsert: { ...pick(data, [\"table\", \"index\", \"key\"], what), key: data.key.map(normalizeRuleTerm) } };\n default: return { [kind]: deepSorted(data) };\n }\n}\n\nfunction normalizeColumnType(column: any): any {\n if (typeof column !== \"object\" || column === null) return column;\n const [kind, data] = tagged(column);\n if (kind === \"Optional\") return { Optional: normalizeColumnType(data) };\n const what = `column.${kind}`;\n if (kind === \"List\") return { List: { ...pick(data, [\"of\", \"max\"], what), of: normalizeColumnType(data.of) } };\n const fields = COLUMN_FIELDS[kind];\n return { [kind]: fields === undefined ? deepSorted(data) : pick(data, fields, what) };\n}\n\n/** The payload fields of each struct-variant column kind, in serde order. */\nconst COLUMN_FIELDS: Record<string, readonly string[]> = {\n Text: [\"max\"], Bytes: [\"max\"], Image: [\"max\"], Video: [\"max\"], Enum: [\"variants\"], Decimal: [\"scale\"],\n Money: [\"currency\", \"scale\"], Ref: [\"table\"], Json: [\"max_bytes\"],\n};\n\nfunction normalizeArgType(arg: any): any {\n if (typeof arg !== \"object\" || arg === null) return arg;\n const [kind, data] = tagged(arg);\n if (kind === \"Optional\") return { Optional: normalizeArgType(data) };\n if (kind === \"List\") {\n // `ArgType::List { of: Option<Box<ArgType>>, max }`: `of` is skipped when\n // absent, and a payload carrying any other field is refused like every\n // struct variant, never rebuilt without it.\n known(data, [\"of\", \"max\"], \"arg.List\");\n return { List: {\n ...(data.of === null || data.of === undefined ? {} : { of: normalizeArgType(data.of) }),\n max: data.max,\n } };\n }\n return normalizeColumnType(arg);\n}\n\nfunction normalizeStatement(statement: any): any {\n if (typeof statement === \"string\") return statement;\n const [kind, data] = tagged(statement);\n switch (kind) {\n case \"Const\":\n case \"Let\":\n case \"Assign\":\n case \"Push\":\n return { [kind]: { ...data, value: normalizeExpression(data.value) } };\n case \"If\":\n return { If: {\n ...data,\n condition: normalizeExpression(data.condition),\n then_body: data.then_body.map(normalizeStatement),\n else_body: data.else_body.map(normalizeStatement),\n } };\n case \"For\":\n return { For: {\n ...data,\n domain: normalizeDomain(data.domain),\n body: data.body.map(normalizeStatement),\n } };\n case \"Require\":\n return { Require: { ...data, condition: normalizeExpression(data.condition) } };\n case \"Insert\":\n return { Insert: { ...data, row: normalizeExpression(data.row) } };\n case \"Update\":\n return { Update: {\n ...data,\n key: normalizeExpression(data.key),\n patch: normalizeExpression(data.patch),\n } };\n case \"Upsert\":\n return { Upsert: {\n ...data,\n key: normalizeExpression(data.key),\n row: normalizeExpression(data.row),\n } };\n case \"Delete\":\n return { Delete: { ...data, key: normalizeExpression(data.key) } };\n case \"Emit\":\n return { Emit: { ...data, payload: normalizeExpression(data.payload) } };\n case \"Return\":\n return { Return: normalizeExpression(data) };\n default:\n return statement;\n }\n}\n\nfunction normalizeDomain(domain: any): any {\n const [kind, data] = tagged(domain);\n switch (kind) {\n case \"Page\":\n return { Page: normalizeScan(data) };\n case \"DerivedArray\":\n return { DerivedArray: { ...data, value: normalizeExpression(data.value) } };\n case \"Recurse\":\n return { Recurse: { ...data, seed: normalizeExpression(data.seed) } };\n default:\n return domain;\n }\n}\n\nfunction normalizeExpression(expression: any): any {\n const [kind, data] = tagged(expression);\n switch (kind) {\n case \"Literal\":\n return { Literal: normalizeValue(data) };\n case \"Field\":\n return { Field: { ...data, base: normalizeExpression(data.base) } };\n case \"Array\":\n return { Array: data.map(normalizeExpression) };\n case \"Object\":\n return { Object: sortedMap(data, normalizeExpression) };\n case \"Binary\":\n return { Binary: {\n ...data,\n left: normalizeExpression(data.left),\n right: normalizeExpression(data.right),\n } };\n case \"Unary\":\n return { Unary: { ...data, value: normalizeExpression(data.value) } };\n case \"Builtin\":\n return { Builtin: { ...data, args: data.args.map(normalizeExpression) } };\n case \"Get\":\n case \"Exists\":\n return { [kind]: normalizeRead(data) };\n case \"Scan\":\n return { Scan: normalizeScan(data) };\n default:\n return expression;\n }\n}\n\nfunction normalizeRead(read: any): any {\n return { ...read, key: read.key.map(normalizeExpression) };\n}\n\nfunction normalizeScan(scan: any): any {\n return {\n ...scan,\n prefix: scan.prefix.map(normalizeExpression),\n after: nullableExpression(scan.after),\n before: nullableExpression(scan.before),\n range: scan.range === null ? null : {\n ...scan.range,\n gt: nullableExpression(scan.range.gt),\n gte: nullableExpression(scan.range.gte),\n lt: nullableExpression(scan.range.lt),\n lte: nullableExpression(scan.range.lte),\n },\n };\n}\n\nfunction nullableExpression(expression: any): any {\n return expression === null ? null : normalizeExpression(expression);\n}\n\nfunction normalizeValue(value: any): any {\n if (typeof value === \"string\") return value;\n const [kind, data] = tagged(value);\n if (kind === \"Array\") return { Array: data.map(normalizeValue) };\n if (kind === \"Row\" || kind === \"Map\") return { [kind]: sortedMap(data, normalizeValue) };\n return value;\n}\n\nfunction sortedMap(value: Record<string, any>, normalize: (item: any) => any): Record<string, any> {\n const result: Record<string, any> = Object.create(null);\n for (const key of Object.keys(value).sort(compareCodepoints)) result[key] = normalize(value[key]);\n return result;\n}\n\nfunction tagged(value: any): [string, any] {\n const keys = Object.keys(value);\n if (keys.length !== 1) throw new Error(\"E_TRACE_SUBSET: malformed externally tagged IR\");\n return [keys[0]!, value[keys[0]!]];\n}\n\nfunction compareCodepoints(left: string, right: string): number {\n const leftPoints = Array.from(left, (value) => value.codePointAt(0)!);\n const rightPoints = Array.from(right, (value) => value.codePointAt(0)!);\n for (let index = 0; index < Math.min(leftPoints.length, rightPoints.length); index += 1) {\n if (leftPoints[index] !== rightPoints[index]) return leftPoints[index]! - rightPoints[index]!;\n }\n return leftPoints.length - rightPoints.length;\n}\n", "export function sha256(text: string): string {\n const bytes = utf8(text);\n const bitLength = bytes.length * 8;\n bytes.push(0x80);\n while (bytes.length % 64 !== 56) bytes.push(0);\n const high = Math.floor(bitLength / 0x1_0000_0000);\n const low = bitLength >>> 0;\n for (let shift = 24; shift >= 0; shift -= 8) bytes.push((high >>> shift) & 0xff);\n for (let shift = 24; shift >= 0; shift -= 8) bytes.push((low >>> shift) & 0xff);\n\n const state = [\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c,\n 0x1f83d9ab, 0x5be0cd19,\n ];\n const words = new Array<number>(64);\n for (let offset = 0; offset < bytes.length; offset += 64) {\n for (let index = 0; index < 16; index += 1) {\n const start = offset + index * 4;\n words[index] =\n ((bytes[start] << 24) |\n (bytes[start + 1] << 16) |\n (bytes[start + 2] << 8) |\n bytes[start + 3]) >>>\n 0;\n }\n for (let index = 16; index < 64; index += 1) {\n const a = words[index - 15];\n const b = words[index - 2];\n const s0 = rotate(a, 7) ^ rotate(a, 18) ^ (a >>> 3);\n const s1 = rotate(b, 17) ^ rotate(b, 19) ^ (b >>> 10);\n words[index] = (words[index - 16] + s0 + words[index - 7] + s1) >>> 0;\n }\n let [a, b, c, d, e, f, g, h] = state;\n for (let index = 0; index < 64; index += 1) {\n const s1 = rotate(e, 6) ^ rotate(e, 11) ^ rotate(e, 25);\n const choice = (e & f) ^ (~e & g);\n const temp1 = (h + s1 + choice + SHA256_K[index] + words[index]) >>> 0;\n const s0 = rotate(a, 2) ^ rotate(a, 13) ^ rotate(a, 22);\n const majority = (a & b) ^ (a & c) ^ (b & c);\n const temp2 = (s0 + majority) >>> 0;\n h = g;\n g = f;\n f = e;\n e = (d + temp1) >>> 0;\n d = c;\n c = b;\n b = a;\n a = (temp1 + temp2) >>> 0;\n }\n state[0] = (state[0] + a) >>> 0;\n state[1] = (state[1] + b) >>> 0;\n state[2] = (state[2] + c) >>> 0;\n state[3] = (state[3] + d) >>> 0;\n state[4] = (state[4] + e) >>> 0;\n state[5] = (state[5] + f) >>> 0;\n state[6] = (state[6] + g) >>> 0;\n state[7] = (state[7] + h) >>> 0;\n }\n return state.map((value) => value.toString(16).padStart(8, \"0\")).join(\"\");\n}\n\nexport function utf8Length(text: string): number {\n return utf8(text).length;\n}\n\nfunction rotate(value: number, bits: number): number {\n return (value >>> bits) | (value << (32 - bits));\n}\n\nfunction utf8(text: string): number[] {\n const bytes: number[] = [];\n for (const character of text) {\n const point = character.codePointAt(0)!;\n if (point <= 0x7f) bytes.push(point);\n else if (point <= 0x7ff) bytes.push(0xc0 | (point >> 6), 0x80 | (point & 0x3f));\n else if (point <= 0xffff)\n bytes.push(0xe0 | (point >> 12), 0x80 | ((point >> 6) & 0x3f), 0x80 | (point & 0x3f));\n else\n bytes.push(\n 0xf0 | (point >> 18),\n 0x80 | ((point >> 12) & 0x3f),\n 0x80 | ((point >> 6) & 0x3f),\n 0x80 | (point & 0x3f),\n );\n }\n return bytes;\n}\n\nconst SHA256_K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,\n 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,\n 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,\n 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,\n 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n];\n", "// One hasher of the schema: the evaluator's struct-order canonical form, the\n// same code the twin runs, proven against Rust's `Schema::hash()` on every golden.\n// @ref LLP 1012#8-the-delivery-envelope-the-validator-and-resume \u2014 closure reconstruction is admitted only under the envelope's exact generation schema.\nimport { canonicalSchemaJson } from \"../../evaluator/src/certificate-identity.js\";\nimport { sha256 } from \"../../evaluator/src/hash.js\";\n\nexport function schemaDigest(schema: any): string {\n return sha256(canonicalSchemaJson(schema));\n}\n", "// @ref LLP 1012#8-the-delivery-envelope-the-validator-and-resume \u2014 this is the strict public mirror of the frozen server envelope.\n\nimport { schemaDigest } from \"./offline-schema.js\";\n\n/** Exact pooled-row reference spelling. Application objects with `$row` are escaped on the wire. */\nexport type WireRowReference = { $row: { table: string; id: string } };\nexport type WireEscapedObject = { $row: { $value: Record<string, WireValue> } };\nexport type WireValue =\n | null\n | boolean\n | number\n | string\n | WireValue[]\n | { [key: string]: WireValue }\n | WireRowReference\n | WireEscapedObject;\n\nexport interface DeliveryRow {\n table: string;\n id: string;\n row: Record<string, WireValue>;\n}\n\nexport interface DeliveryRange {\n site: string;\n table: string;\n index: string;\n prefix: WireValue[];\n order: \"Asc\" | \"Desc\";\n take: number;\n after: WireValue | null;\n before: WireValue | null;\n gt: WireValue | null;\n gte: WireValue | null;\n lt: WireValue | null;\n lte: WireValue | null;\n ruleHash: string;\n rowIds: string[];\n stop: \"Limit\" | \"Exhausted\";\n absence: boolean;\n haloId?: string;\n}\n\nexport interface DeliveryVerdict {\n ruleHash: string;\n /**\n * The verdict's pinned inputs, digested as a wire fact:\n * `sha256(canonical([table, index, key]))` \u2014 the JSON array of the rule\n * input's table name, index name, and key values in wire encoding (ids and\n * text as strings, integers as numbers, null as null, bytes as\n * `{ \"Bytes\": hex }`), serialized with sorted object keys and no whitespace.\n * A twin evaluating a rule computes it from the schema and the wire values it\n * holds and looks the verdict up by `ruleHash` plus this digest; a replay\n * trace's `inputsDigest` is the same value. A transaction-local created-row\n * probe prefixes the array with `\"created\"`. Defined once in\n * `snapback2-core/src/offline.rs` (`rule_inputs_digest`).\n */\n pinnedInputsDigest: string;\n principal: string;\n authEpoch: number;\n result: boolean;\n}\n\nexport interface DeliveryReceipt {\n ranges: DeliveryRange[];\n absences: Array<[table: string, index: string, key: WireValue[]]>;\n verdicts: DeliveryVerdict[];\n}\n\nexport interface DeliveryAuthority {\n principal: string;\n authEpoch: number;\n}\n\nexport interface DeliveryEnvelopeV1 {\n protocol: 1;\n generation: string;\n schemaHash: string;\n planHash: string;\n authority: DeliveryAuthority;\n state: \"complete\" | \"capped\" | \"partial\" | \"denied\";\n reason?: string;\n rule?: string;\n data: WireValue;\n next: string | null;\n seq: number;\n rows: DeliveryRow[];\n receipt: DeliveryReceipt;\n validator: string;\n}\n\nexport interface DeliveryUnchanged {\n state: \"unchanged\";\n seq: number;\n validator: string;\n}\n\nexport type DeliveryMessage = DeliveryEnvelopeV1 | DeliveryUnchanged;\n\nexport type TaggedValue =\n | \"Null\"\n | { Bool: boolean }\n | { Int: number }\n | { String: string }\n | { Id: string }\n | { Bytes: string }\n | { Row: Record<string, TaggedValue> }\n | { Array: TaggedValue[] }\n | { Map: Record<string, TaggedValue> };\n\nexport interface EvaluatorClosureReceipt {\n schema_hash: string;\n rows: Array<{ table: string; id: string; row: TaggedValue }>;\n ranges: Array<{\n site: string;\n table: string;\n index: string;\n prefix: TaggedValue[];\n order: \"Asc\" | \"Desc\";\n take: number;\n after: TaggedValue | null;\n before: TaggedValue | null;\n gt: TaggedValue | null;\n gte: TaggedValue | null;\n lt: TaggedValue | null;\n lte: TaggedValue | null;\n rule_hash: string;\n row_ids: string[];\n stop: \"Limit\" | \"Exhausted\";\n absence: boolean;\n halo: { table: string; id: string; row: TaggedValue } | null;\n n2_key: null;\n /** Members a later swap evicted from this page; absent when none (the goldens' bytes carry none). */\n evicted_ids?: string[];\n }>;\n absences: Array<[string, string, TaggedValue[]]>;\n verdicts: Array<{\n rule_hash: string;\n pinned_inputs_digest: string;\n principal: string;\n auth_epoch: number;\n result: boolean;\n }>;\n}\n\nexport class DeliveryEnvelopeDecodeError extends TypeError {\n constructor(readonly path: string, detail: string) {\n super(`${path}: ${detail}`);\n this.name = \"DeliveryEnvelopeDecodeError\";\n }\n}\n\nexport function decodeDeliveryEnvelope(json: unknown): DeliveryEnvelopeV1 {\n object(json, \"$\", [\n \"protocol\", \"generation\", \"schemaHash\", \"planHash\", \"authority\", \"state\",\n \"data\", \"next\", \"seq\", \"rows\", \"receipt\", \"validator\",\n ], [\"reason\", \"rule\"]);\n if (json.protocol !== 1) fail(\"$.protocol\", \"unsupported delivery protocol\");\n digest(json.generation, \"$.generation\");\n digest(json.schemaHash, \"$.schemaHash\");\n digest(json.planHash, \"$.planHash\");\n object(json.authority, \"$.authority\", [\"principal\", \"authEpoch\"]);\n string(json.authority.principal, \"$.authority.principal\");\n uint(json.authority.authEpoch, \"$.authority.authEpoch\");\n if (![\"complete\", \"capped\", \"partial\", \"denied\"].includes(String(json.state)))\n fail(\"$.state\", \"expected complete, capped, partial, or denied\");\n if (json.state === \"partial\") string(json.reason, \"$.reason\");\n else if (json.reason !== undefined) fail(\"$.reason\", \"is only valid for partial state\");\n if (json.state === \"denied\") string(json.rule, \"$.rule\");\n else if (json.rule !== undefined) fail(\"$.rule\", \"is only valid for denied state\");\n wire(json.data, \"$.data\");\n if (json.next !== null) string(json.next, \"$.next\");\n uint(json.seq, \"$.seq\");\n array(json.rows, \"$.rows\");\n const pool = new Set<string>();\n json.rows.forEach((row: unknown, index: number) => {\n object(row, `$.rows[${index}]`, [\"table\", \"id\", \"row\"]);\n string(row.table, `$.rows[${index}].table`);\n string(row.id, `$.rows[${index}].id`);\n object(row.row, `$.rows[${index}].row`, [], [], true);\n wire(row.row, `$.rows[${index}].row`);\n const key = poolKey(row.table, row.id);\n if (pool.has(key)) fail(`$.rows[${index}]`, \"duplicates a pooled row\");\n pool.add(key);\n });\n receipt(json.receipt, pool, json.authority as DeliveryAuthority);\n validateReferences(json.data, pool, \"$.data\");\n digest(json.validator, \"$.validator\");\n return json as DeliveryEnvelopeV1;\n}\n\n/** Decode either a full authority envelope or a conditional `unchanged` marker. */\nexport function decodeDeliveryMessage(json: unknown): DeliveryMessage {\n if (plain(json) && json.state === \"unchanged\") {\n object(json, \"$\", [\"state\", \"seq\", \"validator\"]);\n uint(json.seq, \"$.seq\");\n digest(json.validator, \"$.validator\");\n return json as unknown as DeliveryUnchanged;\n }\n return decodeDeliveryEnvelope(json);\n}\n\nexport function encodeDeliveryEnvelope(envelope: DeliveryEnvelopeV1): string {\n const decoded = decodeDeliveryEnvelope(envelope);\n const ordered: Record<string, unknown> = {\n protocol: decoded.protocol,\n generation: decoded.generation,\n schemaHash: decoded.schemaHash,\n planHash: decoded.planHash,\n authority: {\n principal: decoded.authority.principal,\n authEpoch: decoded.authority.authEpoch,\n },\n state: decoded.state,\n };\n if (decoded.reason !== undefined) ordered.reason = decoded.reason;\n if (decoded.rule !== undefined) ordered.rule = decoded.rule;\n ordered.data = canonicalWire(decoded.data);\n ordered.next = decoded.next;\n ordered.seq = decoded.seq;\n ordered.rows = [...decoded.rows]\n .sort((left, right) => compareText(left.table, right.table) || compareText(left.id, right.id))\n .map((row) => ({ table: row.table, id: row.id, row: canonicalWire(row.row) }));\n ordered.receipt = {\n ranges: decoded.receipt.ranges.map((range) => {\n const item: Record<string, unknown> = {\n site: range.site,\n table: range.table,\n index: range.index,\n prefix: range.prefix.map(canonicalWire),\n order: range.order,\n take: range.take,\n after: range.after === null ? null : canonicalWire(range.after),\n before: range.before === null ? null : canonicalWire(range.before),\n gt: range.gt === null ? null : canonicalWire(range.gt),\n gte: range.gte === null ? null : canonicalWire(range.gte),\n lt: range.lt === null ? null : canonicalWire(range.lt),\n lte: range.lte === null ? null : canonicalWire(range.lte),\n ruleHash: range.ruleHash,\n rowIds: [...range.rowIds],\n stop: range.stop,\n absence: range.absence,\n };\n if (range.haloId !== undefined) item.haloId = range.haloId;\n return item;\n }),\n absences: decoded.receipt.absences.map(([table, index, key]) => [\n table,\n index,\n key.map(canonicalWire),\n ]),\n verdicts: decoded.receipt.verdicts.map((verdict) => ({\n ruleHash: verdict.ruleHash,\n pinnedInputsDigest: verdict.pinnedInputsDigest,\n principal: verdict.principal,\n authEpoch: verdict.authEpoch,\n result: verdict.result,\n })),\n };\n ordered.validator = decoded.validator;\n return JSON.stringify(ordered);\n}\n\nexport function expandRows(envelope: DeliveryEnvelopeV1): WireValue {\n const decoded = decodeDeliveryEnvelope(envelope);\n const rows = new Map(decoded.rows.map((row) => [poolKey(row.table, row.id), row.row]));\n const expand = (value: WireValue): WireValue => {\n if (rowReference(value)) {\n const row = rows.get(poolKey(value.$row.table, value.$row.id));\n if (row === undefined) fail(\"$.data\", `references missing row ${value.$row.table}/${value.$row.id}`);\n return clone(row);\n }\n if (escapedObject(value)) {\n return Object.fromEntries(\n Object.entries(value.$row.$value).map(([key, item]) => [key, expand(item)]),\n );\n }\n if (Array.isArray(value)) return value.map(expand);\n if (plain(value)) return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, expand(item)]));\n return value;\n };\n return expand(decoded.data);\n}\n\n/** Rebuild the evaluator's externally-tagged private receipt from the public pool. */\nexport function toClosureReceipt(envelope: DeliveryEnvelopeV1, schema: any): EvaluatorClosureReceipt {\n const decoded = decodeDeliveryEnvelope(envelope);\n let actualSchemaHash: string;\n try {\n actualSchemaHash = schemaDigest(schema);\n } catch (error) {\n fail(\"schema\", error instanceof Error ? error.message : String(error));\n }\n if (actualSchemaHash !== decoded.schemaHash) {\n fail(\"schema\", `hash ${actualSchemaHash} does not match envelope schemaHash ${decoded.schemaHash}`);\n }\n const taggedRows = new Map<string, { table: string; id: string; row: TaggedValue }>();\n for (const row of decoded.rows) {\n const tagged = { table: row.table, id: row.id, row: tagRow(schema, row.table, row.row) };\n taggedRows.set(poolKey(row.table, row.id), tagged);\n }\n const ranges = decoded.receipt.ranges.map((range) => ({\n site: range.site,\n table: range.table,\n index: range.index,\n prefix: tagIndexValues(schema, range.table, range.index, range.prefix, 0),\n order: range.order,\n take: range.take,\n after: tagBoundary(schema, range, range.after),\n before: tagBoundary(schema, range, range.before),\n gt: tagBoundary(schema, range, range.gt),\n gte: tagBoundary(schema, range, range.gte),\n lt: tagBoundary(schema, range, range.lt),\n lte: tagBoundary(schema, range, range.lte),\n rule_hash: range.ruleHash,\n row_ids: [...range.rowIds],\n stop: range.stop,\n absence: range.absence,\n halo: range.haloId === undefined\n ? null\n : clone(taggedRows.get(poolKey(range.table, range.haloId))\n ?? fail(`$.receipt.ranges[${range.site}].haloId`, \"references a missing pooled row\")),\n n2_key: null,\n }));\n return {\n schema_hash: decoded.schemaHash,\n rows: Array.from(taggedRows.values()).map(clone),\n ranges,\n absences: decoded.receipt.absences.map(([table, index, key]) => [\n table,\n index,\n tagIndexValues(schema, table, index, key, 0),\n ]),\n verdicts: decoded.receipt.verdicts.map((verdict) => ({\n rule_hash: verdict.ruleHash,\n pinned_inputs_digest: verdict.pinnedInputsDigest,\n principal: verdict.principal,\n auth_epoch: verdict.authEpoch,\n result: verdict.result,\n })),\n };\n}\n\nexport type DeliveryRangeExtent =\n | { stop: \"Limit\"; firstKey: WireValue[]; lastKey: WireValue[]; presentIds: string[] }\n | {\n stop: \"Exhausted\";\n prefix: WireValue[];\n bounds: Pick<DeliveryRange, \"after\" | \"before\" | \"gt\" | \"gte\" | \"lt\" | \"lte\">;\n presentIds: string[];\n };\n\n/** Derive the rule-2 range extent solely from a delivery and its generation schema. */\nexport function deliveryRangeExtent(\n envelope: DeliveryEnvelopeV1,\n schema: any,\n range: DeliveryRange,\n): DeliveryRangeExtent {\n const decoded = decodeDeliveryEnvelope(envelope);\n const selected = decoded.receipt.ranges.find((candidate) => candidate === range)\n ?? decoded.receipt.ranges.find((candidate) => candidate.site === range.site);\n if (!selected) fail(\"$.receipt.ranges\", `does not contain site ${range.site}`);\n const presentIds = selected.haloId === undefined\n ? [...selected.rowIds]\n : [...selected.rowIds, selected.haloId];\n if (selected.stop === \"Exhausted\") {\n return {\n stop: \"Exhausted\",\n prefix: clone(selected.prefix),\n bounds: {\n after: clone(selected.after), before: clone(selected.before),\n gt: clone(selected.gt), gte: clone(selected.gte),\n lt: clone(selected.lt), lte: clone(selected.lte),\n },\n presentIds,\n };\n }\n if (selected.rowIds.length === 0) fail(`$.receipt.ranges[${selected.site}].rowIds`, \"Limit extent needs a returned row\");\n const rows = new Map(decoded.rows.map((row) => [poolKey(row.table, row.id), row]));\n const key = (id: string): WireValue[] => {\n const row = rows.get(poolKey(selected.table, id))!;\n return indexColumns(schema, selected.table, selected.index).map((column) => {\n if (!(column in row.row)) fail(`$.rows.${selected.table}/${id}.${column}`, \"is required by the range index\");\n return clone(row.row[column]!);\n });\n };\n return {\n stop: \"Limit\",\n firstKey: key(selected.rowIds[0]!),\n lastKey: key(selected.rowIds[selected.rowIds.length - 1]!),\n presentIds,\n };\n}\n\nfunction receipt(value: unknown, pool: Set<string>, authority: DeliveryAuthority): void {\n object(value, \"$.receipt\", [\"ranges\", \"absences\", \"verdicts\"]);\n array(value.ranges, \"$.receipt.ranges\");\n value.ranges.forEach((range: unknown, index: number) => {\n const path = `$.receipt.ranges[${index}]`;\n object(range, path, [\n \"site\", \"table\", \"index\", \"prefix\", \"order\", \"take\", \"after\", \"before\",\n \"gt\", \"gte\", \"lt\", \"lte\", \"ruleHash\", \"rowIds\", \"stop\", \"absence\",\n ], [\"haloId\"]);\n for (const name of [\"site\", \"table\", \"index\", \"ruleHash\"] as const) string(range[name], `${path}.${name}`);\n digest(range.ruleHash, `${path}.ruleHash`);\n array(range.prefix, `${path}.prefix`); range.prefix.forEach((item: unknown, at: number) => wire(item, `${path}.prefix[${at}]`));\n if (![\"Asc\", \"Desc\"].includes(String(range.order))) fail(`${path}.order`, \"expected Asc or Desc\");\n uint(range.take, `${path}.take`);\n for (const name of [\"after\", \"before\", \"gt\", \"gte\", \"lt\", \"lte\"] as const)\n if (range[name] !== null) wire(range[name], `${path}.${name}`);\n array(range.rowIds, `${path}.rowIds`);\n const rowIds = new Set<string>();\n range.rowIds.forEach((id: unknown, at: number) => {\n string(id, `${path}.rowIds[${at}]`);\n if (rowIds.has(id)) fail(`${path}.rowIds[${at}]`, \"duplicates a row id\");\n rowIds.add(id);\n if (!pool.has(poolKey(range.table, id))) fail(`${path}.rowIds[${at}]`, \"references a missing same-table pooled row\");\n });\n if (![\"Limit\", \"Exhausted\"].includes(String(range.stop))) fail(`${path}.stop`, \"expected Limit or Exhausted\");\n boolean(range.absence, `${path}.absence`);\n if (range.haloId !== undefined) {\n string(range.haloId, `${path}.haloId`);\n if (!pool.has(poolKey(range.table, range.haloId))) fail(`${path}.haloId`, \"references a missing pooled row\");\n }\n });\n array(value.absences, \"$.receipt.absences\");\n value.absences.forEach((absence: unknown, index: number) => {\n const path = `$.receipt.absences[${index}]`;\n array(absence, path);\n if (absence.length !== 3) fail(path, \"expected [table, index, key]\");\n string(absence[0], `${path}[0]`);\n if (absence[1] !== \"byId\") fail(`${path}[1]`, \"only primary byId absences may be delivered\");\n array(absence[2], `${path}[2]`); absence[2].forEach((item: unknown, at: number) => wire(item, `${path}[2][${at}]`));\n });\n array(value.verdicts, \"$.receipt.verdicts\");\n value.verdicts.forEach((verdict: unknown, index: number) => {\n const path = `$.receipt.verdicts[${index}]`;\n object(verdict, path, [\"ruleHash\", \"pinnedInputsDigest\", \"principal\", \"authEpoch\", \"result\"]);\n digest(verdict.ruleHash, `${path}.ruleHash`);\n digest(verdict.pinnedInputsDigest, `${path}.pinnedInputsDigest`);\n string(verdict.principal, `${path}.principal`);\n uint(verdict.authEpoch, `${path}.authEpoch`);\n boolean(verdict.result, `${path}.result`);\n if (verdict.principal !== authority.principal) fail(`${path}.principal`, \"does not match envelope authority\");\n if (verdict.authEpoch !== authority.authEpoch) fail(`${path}.authEpoch`, \"does not match envelope authority\");\n });\n}\n\n/** Tag one pooled wire row by its table's declared column types (the evaluator's private form). */\nexport function tagWireRow(schema: any, table: string, row: Record<string, WireValue>): TaggedValue {\n return tagRow(schema, table, row);\n}\n\n/** Tag index key values (a prefix, a key, or a cursor position) by the index's column types from `offset`. */\nexport function tagWireIndexValues(schema: any, table: string, index: string, values: WireValue[], offset = 0): TaggedValue[] {\n return tagIndexValues(schema, table, index, values, offset);\n}\n\n/** Tag a range boundary (`after`, `before`, `gt`, \u2026): an array is a position after the prefix, a scalar its first column. */\nexport function tagWireBoundary(schema: any, range: Pick<DeliveryRange, \"table\" | \"index\" | \"prefix\">, value: WireValue | null): TaggedValue | null {\n return tagBoundary(schema, range as DeliveryRange, value);\n}\n\n/** Tag one wire value by a declared column or argument descriptor. */\nexport function tagWireValue(descriptor: unknown, value: WireValue, path: string): TaggedValue {\n return tagTyped(descriptor, value, path);\n}\n\nfunction tagRow(schema: any, table: string, row: Record<string, WireValue>): TaggedValue {\n const columns = schema?.tables?.[table]?.columns;\n if (!plain(columns)) fail(`schema.tables.${table}.columns`, \"is missing\");\n const tagged: Record<string, TaggedValue> = Object.create(null);\n for (const [name, value] of Object.entries(row)) {\n if (!(name in columns)) fail(`rows.${table}.${name}`, \"is not a declared column\");\n tagged[name] = tagTyped(columns[name], value, `rows.${table}.${name}`);\n }\n return { Row: tagged };\n}\n\nfunction tagIndexValues(schema: any, table: string, index: string, values: WireValue[], offset: number): TaggedValue[] {\n const columns = indexColumns(schema, table, index);\n return values.map((value, at) => {\n const name = columns[offset + at];\n if (name === undefined) fail(`schema.tables.${table}.indexes.${index}`, \"has too few columns\");\n return tagTyped(schema.tables[table].columns[name], value, `${table}.${index}[${offset + at}]`);\n });\n}\n\nfunction tagBoundary(schema: any, range: DeliveryRange, value: WireValue | null): TaggedValue | null {\n if (value === null) return null;\n if (Array.isArray(value)) return { Array: tagIndexValues(schema, range.table, range.index, value, range.prefix.length) };\n return tagIndexValues(schema, range.table, range.index, [value], range.prefix.length)[0]!;\n}\n\nfunction tagTyped(descriptor: any, value: WireValue, path: string): TaggedValue {\n if (plain(descriptor) && \"Optional\" in descriptor) return value === null ? \"Null\" : tagTyped(descriptor.Optional, value, path);\n if (value === null) return \"Null\";\n if (descriptor === \"Id\" || descriptor === \"Principal\" || plain(descriptor) && \"Ref\" in descriptor) {\n if (typeof value !== \"string\") fail(path, \"expected id string\");\n return { Id: value };\n }\n if (plain(descriptor) && (\"Text\" in descriptor || \"Enum\" in descriptor)) {\n if (typeof value !== \"string\") fail(path, \"expected text string\");\n return { String: value };\n }\n if ([\"Int\", \"Time\"].includes(String(descriptor)) || plain(descriptor) && (\"Decimal\" in descriptor || \"Money\" in descriptor)) {\n uintOrSigned(value, path); return { Int: value as number };\n }\n if (descriptor === \"Bool\") { boolean(value, path); return { Bool: value as boolean }; }\n if (plain(descriptor) && \"Bytes\" in descriptor) {\n const bytes = plain(value) && \"Bytes\" in value ? value.Bytes : undefined;\n if (!plain(value) || Object.keys(value).length !== 1 || typeof bytes !== \"string\" || !/^(?:[0-9a-f]{2})*$/.test(bytes))\n fail(path, \"expected canonical Bytes\");\n return { Bytes: bytes };\n }\n if (plain(descriptor) && \"List\" in descriptor) {\n array(value, path);\n return { Array: value.map((item: WireValue, index: number) => tagTyped(descriptor.List.of, item, `${path}[${index}]`)) };\n }\n if (plain(descriptor) && (\"Image\" in descriptor || \"Video\" in descriptor)) {\n object(value, path, [], [], true);\n const kind = \"Image\" in descriptor ? \"Image\" : \"Video\";\n const fields = ASSET_RECORD_FIELDS[kind];\n const names = Object.keys(value);\n if (names.length !== Object.keys(fields).length || names.some((name) => !(name in fields)))\n fail(path, `must contain exactly ${Object.keys(fields).sort().join(\", \")}`);\n return { Map: Object.fromEntries(Object.entries(value).map(([key, item]) => [\n key,\n tagAssetField(fields[key as keyof typeof fields], item, `${path}.${key}`),\n ])) };\n }\n // @ref LLP 1012#8-the-delivery-envelope-the-validator-and-resume \u2014 tag by\n // the declared column type only: a `json` value shaped `{ \"Bytes\": \"\u2026\" }` is\n // application data, never the byte variant (O1a review).\n if (plain(descriptor) && \"Json\" in descriptor) return tagJson(value);\n fail(path, \"has an unsupported schema descriptor\");\n}\n\nfunction tagJson(value: WireValue): TaggedValue {\n if (value === null) return \"Null\";\n if (typeof value === \"boolean\") return { Bool: value };\n if (typeof value === \"number\") return { Int: value };\n if (typeof value === \"string\") return { String: value };\n if (Array.isArray(value)) return { Array: value.map(tagJson) };\n return { Map: Object.fromEntries(Object.entries(value).map(([key, item]) => [key, tagJson(item)])) };\n}\n\nconst ASSET_RECORD_FIELDS = {\n Image: { id: \"String\", width: \"Int\", height: \"Int\" },\n Video: { id: \"String\", width: \"Int\", height: \"Int\", duration: \"Int\" },\n} as const;\n\nfunction tagAssetField(descriptor: \"String\" | \"Int\", value: WireValue, path: string): TaggedValue {\n if (descriptor === \"String\") {\n if (typeof value !== \"string\") fail(path, \"expected string\");\n return { String: value };\n }\n uintOrSigned(value, path);\n return { Int: value as number };\n}\n\nfunction indexColumns(schema: any, table: string, index: string): string[] {\n const columns = schema?.tables?.[table]?.indexes?.[index]?.columns;\n if (!Array.isArray(columns) || !columns.every((item) => typeof item === \"string\"))\n fail(`schema.tables.${table}.indexes.${index}`, \"is missing columns\");\n return columns;\n}\n\nfunction validateReferences(value: unknown, pool: Set<string>, path: string): void {\n if (rowReference(value)) {\n if (!pool.has(poolKey(value.$row.table, value.$row.id))) fail(path, \"references a missing pooled row\");\n return;\n }\n if (escapedObject(value)) {\n for (const [key, item] of Object.entries(value.$row.$value)) {\n validateReferences(item, pool, `${path}.$row.$value.${key}`);\n }\n return;\n }\n if (Array.isArray(value)) value.forEach((item, index) => validateReferences(item, pool, `${path}[${index}]`));\n else if (plain(value)) {\n if (\"$row\" in value) fail(path, \"has a malformed reserved $row value\");\n for (const [key, item] of Object.entries(value)) validateReferences(item, pool, `${path}.${key}`);\n }\n}\n\nfunction canonicalWire(value: WireValue): WireValue {\n if (Array.isArray(value)) return value.map(canonicalWire);\n if (plain(value)) {\n const record = value as Record<string, WireValue>;\n return Object.fromEntries(\n Object.keys(record).sort().map((key) => [key, canonicalWire(record[key]!)]),\n );\n }\n return value;\n}\n\nfunction wire(value: unknown, path: string): void {\n if (value === null || typeof value === \"boolean\" || typeof value === \"string\") return;\n if (typeof value === \"number\") { uintOrSigned(value, path); return; }\n if (Array.isArray(value)) { value.forEach((item, index) => wire(item, `${path}[${index}]`)); return; }\n object(value, path, [], [], true);\n for (const [key, item] of Object.entries(value)) wire(item, `${path}.${key}`);\n}\n\nfunction rowReference(value: unknown): value is WireRowReference {\n return plain(value) && Object.keys(value).length === 1 && plain(value.$row)\n && Object.keys(value.$row).sort().join(\",\") === \"id,table\"\n && typeof value.$row.table === \"string\" && typeof value.$row.id === \"string\";\n}\n\nfunction escapedObject(value: unknown): value is WireEscapedObject {\n return plain(value) && Object.keys(value).length === 1 && plain(value.$row)\n && Object.keys(value.$row).length === 1 && plain(value.$row.$value);\n}\n\nfunction object(value: any, path: string, required: string[], optional: string[] = [], open = false): asserts value is Record<string, any> {\n if (!plain(value)) fail(path, \"expected object\");\n for (const name of required) if (!(name in value)) fail(`${path}.${name}`, \"is required\");\n if (!open) for (const name of Object.keys(value)) if (!required.includes(name) && !optional.includes(name)) fail(`${path}.${name}`, \"is unknown\");\n}\nfunction array(value: any, path: string): asserts value is any[] { if (!Array.isArray(value)) fail(path, \"expected array\"); }\nfunction string(value: unknown, path: string): asserts value is string { if (typeof value !== \"string\" || value.length === 0) fail(path, \"expected non-empty string\"); }\nfunction boolean(value: unknown, path: string): asserts value is boolean { if (typeof value !== \"boolean\") fail(path, \"expected boolean\"); }\nfunction uint(value: unknown, path: string): asserts value is number { if (!Number.isSafeInteger(value) || Number(value) < 0) fail(path, \"expected non-negative safe integer\"); }\nfunction uintOrSigned(value: unknown, path: string): asserts value is number { if (!Number.isSafeInteger(value)) fail(path, \"expected safe integer\"); }\nfunction digest(value: unknown, path: string): asserts value is string { if (typeof value !== \"string\" || !/^[0-9a-f]{64}$/.test(value)) fail(path, \"expected lowercase SHA-256 digest\"); }\nfunction plain(value: any): value is Record<string, any> { return value !== null && typeof value === \"object\" && !Array.isArray(value) && (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null); }\nfunction poolKey(table: string, id: string): string { return `${table.length}:${table}${id}`; }\nfunction compareText(left: string, right: string): number { return left < right ? -1 : left > right ? 1 : 0; }\nfunction clone<T>(value: T): T { return structuredClone(value); }\nfunction fail(path: string, detail: string): never { throw new DeliveryEnvelopeDecodeError(path, detail); }\n", "// @ref LLP 1012#6-reads-offline \u2014 the twin hydrates from `coverage()`: rows,\n// ranges, absences, and verdicts re-tagged through the held schema into the\n// evaluator's private receipt, exactly as the Rust `ClientStore` sees them.\nimport {\n DeliveryEnvelopeDecodeError,\n tagWireBoundary,\n tagWireIndexValues,\n tagWireRow,\n tagWireValue,\n type EvaluatorClosureReceipt,\n type TaggedValue,\n type WireValue,\n} from \"./offline-protocol.js\";\nimport { schemaDigest } from \"./offline-schema.js\";\nimport type { Coverage, ReceiptRange, RowRef } from \"./store/range-store.js\";\n\ntype TaggedRow = EvaluatorClosureReceipt[\"rows\"][number];\n\nfunction rowKey(ref: RowRef): string {\n return `${ref.table} ${ref.id}`;\n}\n\nconst digests = new WeakMap<object, string>();\n\n/** The one schema hasher, computed here and never taken from the caller (memoized per schema object). */\nfunction digestOf(schema: any): string {\n const held = typeof schema === \"object\" && schema !== null ? digests.get(schema) : undefined;\n if (held !== undefined) return held;\n const digest = schemaDigest(schema);\n if (typeof schema === \"object\" && schema !== null) digests.set(schema, digest);\n return digest;\n}\n\n/**\n * The evaluator's `ClosureReceipt` for a partition's coverage. Rows keep the\n * pool's order; a range's halo is the pooled row its `haloId` names; `n2Key`\n * never leaves the server, so it is `null` here as it is on the wire. The\n * schema hash is recomputed from the schema, never taken from the caller, so\n * every rebuild proves the hasher against the server's; an expected hash that\n * disagrees refuses the rebuild \u2014 coverage delivered under another schema, or\n * a hasher drifted from Rust, is `hydrating`, never evaluated (LLP 1012 \u00A78).\n */\nexport function closureFromCoverage(coverage: Coverage, schema: any, expectedSchemaHash?: string): EvaluatorClosureReceipt {\n const schemaHash = digestOf(schema);\n if (expectedSchemaHash !== undefined && expectedSchemaHash !== schemaHash) {\n throw new DeliveryEnvelopeDecodeError(\"schema\", `hash ${schemaHash} does not match the held program's ${expectedSchemaHash}`);\n }\n const rows = new Map<string, TaggedRow>();\n for (const row of coverage.rows) {\n rows.set(rowKey(row), { table: row.table, id: row.id, row: tagWireRow(schema, row.table, row.row as Record<string, WireValue>) });\n }\n return {\n schema_hash: schemaHash,\n rows: [...rows.values()],\n ranges: coverage.ranges.map((range) => tagRange(schema, range, rows)),\n absences: coverage.absences.map(([table, index, key]) => [\n table,\n index,\n tagWireIndexValues(schema, table, index, key as WireValue[], 0),\n ]),\n verdicts: coverage.verdicts.map((verdict) => {\n const record = verdict as Record<string, unknown>;\n return {\n rule_hash: String(record.ruleHash),\n pinned_inputs_digest: String(record.pinnedInputsDigest),\n principal: String(record.principal),\n auth_epoch: Number(record.authEpoch),\n result: record.result === true,\n };\n }),\n };\n}\n\nfunction tagRange(schema: any, range: ReceiptRange, rows: Map<string, TaggedRow>): EvaluatorClosureReceipt[\"ranges\"][number] {\n const boundary = (value: unknown): TaggedValue | null =>\n value === null || value === undefined ? null : tagWireBoundary(schema, range as never, value as WireValue);\n const halo = range.haloId === undefined ? undefined : rows.get(rowKey({ table: range.table, id: range.haloId }));\n return {\n site: range.site,\n table: range.table,\n index: range.index,\n prefix: tagWireIndexValues(schema, range.table, range.index, range.prefix as WireValue[], 0),\n order: range.order,\n take: range.take,\n after: boundary(range.after),\n before: boundary(range.before),\n gt: boundary(range.gt),\n gte: boundary(range.gte),\n lt: boundary(range.lt),\n lte: boundary(range.lte),\n rule_hash: range.ruleHash,\n row_ids: [...range.rowIds],\n stop: range.stop,\n absence: range.absence,\n halo: halo === undefined ? null : structuredClone(halo),\n n2_key: null,\n ...(range.evictedIds === undefined || range.evictedIds.length === 0 ? {} : { evicted_ids: [...range.evictedIds] }),\n };\n}\n\n/** Tag one operation argument by the IR's descriptor (`Cursor`, `Optional`, or a column type). */\nexport function tagArgument(descriptor: unknown, value: unknown, path: string): TaggedValue {\n if (descriptor !== null && typeof descriptor === \"object\" && !Array.isArray(descriptor) && \"Optional\" in descriptor) {\n return value === null || value === undefined ? \"Null\" : tagArgument((descriptor as { Optional: unknown }).Optional, value, path);\n }\n if (descriptor === \"Cursor\") {\n if (value === null || value === undefined) return \"Null\";\n if (typeof value !== \"string\") throw new TypeError(`${path} must be an opaque cursor string`);\n return { String: value };\n }\n if (value === undefined) throw new TypeError(`${path} is required`);\n return tagWireValue(descriptor, value as WireValue, path);\n}\n\nexport function tagArguments(descriptors: unknown, args: unknown): Record<string, TaggedValue> {\n const tagged: Record<string, TaggedValue> = Object.create(null);\n if (descriptors === null || typeof descriptors !== \"object\") return tagged;\n const record = args !== null && typeof args === \"object\" && !Array.isArray(args) ? args as Record<string, unknown> : {};\n for (const [name, descriptor] of Object.entries(descriptors as Record<string, unknown>)) {\n tagged[name] = tagArgument(descriptor, record[name], `args.${name}`);\n }\n return tagged;\n}\n\nexport type PartialReason = \"never-held\" | \"evicted\" | \"computed-key\";\n\nexport interface PartialSite {\n site: string;\n reason: PartialReason;\n}\n\ninterface TraceLike {\n ranges: Array<{ site: string; table: string; provenance?: string }>;\n absences: Array<{ site: string; table: string; index: string; key: unknown[]; provenance?: string }>;\n}\n\n/**\n * Why a site fell outside coverage: a row a swap evicted (`evicted`: a\n * primary-key read of an evicted row, or a range over a table one of whose\n * held pages lost a member), a key the program computed from another row so\n * no page could have named it (`computed-key`), or a read the store simply\n * never held (`never-held`).\n */\nexport function partialReasons(sites: string[], trace: TraceLike, coverage: Coverage): PartialSite[] {\n const evicted = new Set((coverage.evicted ?? []).map(rowKey));\n const holed = new Set(coverage.ranges.filter((range) => (range.evictedIds?.length ?? 0) > 0).map((range) => range.table));\n return sites.map((site) => {\n const absence = trace.absences.find((item) => item.site === site);\n const range = trace.ranges.find((item) => item.site === site);\n const provenance = absence?.provenance ?? range?.provenance;\n if (absence && absence.index === \"byId\") {\n const id = absence.key[0];\n const text = id !== null && typeof id === \"object\" && \"Id\" in id ? String((id as { Id: unknown }).Id) : undefined;\n if (text !== undefined && evicted.has(rowKey({ table: absence.table, id: text }))) return { site, reason: \"evicted\" };\n }\n if (range && holed.has(range.table)) return { site, reason: \"evicted\" };\n if (provenance === \"Shape\") return { site, reason: \"computed-key\" };\n return { site, reason: \"never-held\" };\n });\n}\n", "type Descriptor = Readonly<Record<string, unknown>>;\nexport {\n DeliveryEnvelopeDecodeError,\n decodeDeliveryEnvelope,\n decodeDeliveryMessage,\n deliveryRangeExtent,\n encodeDeliveryEnvelope,\n expandRows,\n toClosureReceipt,\n} from \"./offline-protocol.js\";\nexport { closureFromCoverage } from \"./twin-hydrate.js\";\nexport { schemaDigest } from \"./offline-schema.js\";\nexport type {\n DeliveryAuthority,\n DeliveryEnvelopeV1,\n DeliveryMessage,\n DeliveryRange,\n DeliveryRangeExtent,\n DeliveryReceipt,\n DeliveryRow,\n DeliveryVerdict,\n DeliveryUnchanged,\n WireEscapedObject,\n EvaluatorClosureReceipt,\n WireRowReference,\n WireValue,\n} from \"./offline-protocol.js\";\n/** Server-minted authority subject; deliberately distinct from application row IDs. */\nexport type Principal = string & { readonly __snapbackPrincipal: \"Principal\" };\nexport type Cursor = string & { readonly __snapbackCursor: \"Cursor\" };\nexport type Bytes = { readonly Bytes: string };\n// @ref LLP 1006#1-the-move \u2014 the phantom kind keeps the two closed asset records nominal without adding JSON bytes.\nexport type ImageAsset = { readonly __asset: \"image\"; readonly id: string; readonly width: number; readonly height: number };\nexport type VideoAsset = { readonly __asset: \"video\"; readonly id: string; readonly width: number; readonly height: number; readonly duration: number };\nexport type Decimal<S extends number> = number & {\n readonly __decimalScale: S;\n readonly __decimalBrand: unique symbol;\n};\nexport type Money<C extends string, S extends number = 2> = Decimal<S> & {\n readonly __moneyCurrency: C;\n readonly __moneyBrand: unique symbol;\n};\n\n// @ref LLP 1002#2-the-authored-surface-the-snapback2-module \u2014 authoring calls return inert descriptors; handlers are never invoked here.\n\nfunction inert(kind: string, value?: unknown): Descriptor {\n return Object.freeze(value === undefined ? { kind } : { kind, value });\n}\n\nexport function schema(value: Record<string, unknown>): Descriptor {\n return inert(\"schema\", value);\n}\n\nexport function table(value: Record<string, unknown>): Descriptor {\n return inert(\"table\", value);\n}\n\nexport const t = Object.freeze({\n cursor: () => inert(\"cursor\"),\n id: () => inert(\"id\"),\n principal: () => inert(\"principal\"),\n text: (max: number) => inert(\"text\", { max }),\n bytes: (max: number) => inert(\"bytes\", { max }),\n // @ref LLP 1006#3-authoring-surface \u2014 image/video are unconditional lowering descriptors, independent of installed codecs.\n image: (max: number) => inert(\"image\", { max }),\n video: (max: number) => inert(\"video\", { max }),\n int: () => inert(\"int\"),\n bool: () => inert(\"bool\"),\n time: () => inert(\"time\"),\n enum: (variants: readonly string[]) => inert(\"enum\", { variants }),\n /** `t.decimal(scale)` declares a Decimal column; numeric literals assigned to it are whole units and are scaled by 10^scale. */\n decimal: (scale: number) => inert(\"decimal\", { scale }),\n /** `t.money(currency, scale)` declares a Money column; numeric literals assigned to it are whole units and are scaled by 10^scale. */\n money: (currency: string, scale = 2) => inert(\"money\", { currency, scale }),\n ref: (target: unknown) => inert(\"ref\", { target }),\n json: (maxBytes: number) => inert(\"json\", { maxBytes }),\n optional: (value: unknown) => inert(\"optional\", { value }),\n list: (value: unknown, options: { max: number }) => inert(\"list\", { value, ...options }),\n});\n\nconst viewer = inert(\"viewer\");\nexport const rule = Object.freeze({\n public: (reason: string) => inert(\"public\", { reason }),\n allow: () => inert(\"allow\"),\n deny: () => inert(\"deny\"),\n eq: (left: unknown, right: unknown) => inert(\"eq\", { left, right }),\n ne: (left: unknown, right: unknown) => inert(\"ne\", { left, right }),\n and: (...rules: unknown[]) => inert(\"and\", rules),\n or: (...rules: unknown[]) => inert(\"or\", rules),\n not: (value: unknown) => inert(\"not\", value),\n exists: (target: unknown, index: string, key: unknown[]) =>\n inert(\"exists\", { target, index, key }),\n created: (target: unknown, index: string, key: unknown[]) =>\n inert(\"created\", { target, index, key }),\n system: () => inert(\"system\"),\n viewerIs: (field: string) => inert(\"viewerIs\", { field }),\n field: (name: string) => inert(\"field\", { name }),\n oldField: (name: string) => inert(\"oldField\", { name }),\n nextField: (name: string) => inert(\"nextField\", { name }),\n viewer,\n literal: (value: unknown) => inert(\"literal\", value),\n});\n\nexport function channel(value: Record<string, unknown>): Descriptor {\n return inert(\"channel\", value);\n}\n\nexport function query(args: Record<string, unknown>, handler: unknown): Descriptor {\n return inert(\"query\", { args, handler });\n}\n\nexport function mutation(args: Record<string, unknown>, handler: unknown): Descriptor {\n return inert(\"mutation\", { args, handler });\n}\n\nexport function effect(value: Record<string, unknown>): Descriptor {\n return inert(\"effect\", value);\n}\n\nexport function emit(target: unknown, payload: unknown): Descriptor {\n return inert(\"emit\", { target, payload });\n}\n\nexport function seed(value: Record<string, unknown>): Descriptor {\n return inert(\"seed\", value);\n}\n\nexport function range(start: number, end: number): number[] {\n return Array.from({ length: Math.max(0, end - start) }, (_, index) => start + index);\n}\n\n/** `decimal(value, scale)` converts a value in whole units to the exact integer minor-unit wire value; for example, `decimal(2, 2)` is 200. */\n// @ref LLP 1002#2-the-authored-surface-the-snapback2-module \u2014 client decimals cross the wire as exactly string-scaled integer minor units.\nexport function decimal<const S extends number>(value: number, scale: S): Decimal<S> {\n if (!Number.isFinite(value) || !Number.isInteger(scale) || scale < 0 || scale > 12) {\n throw new RangeError(\"decimal(value, scale) requires a finite number and an integer scale from 0 through 12\");\n }\n const match = /^([+-]?)(\\d+)(?:\\.(\\d+))?(?:e([+-]?\\d+))?$/i.exec(String(value));\n if (!match) throw new RangeError(`decimal cannot encode ${String(value)}`);\n const negative = match[1] === \"-\";\n const wholeDigits = match[2]!;\n const fractionDigits = match[3] ?? \"\";\n const exponent = Number(match[4] ?? 0);\n const digits = `${wholeDigits}${fractionDigits}`;\n const point = wholeDigits.length + exponent;\n const whole = point <= 0 ? \"0\" : point >= digits.length ? `${digits}${\"0\".repeat(point - digits.length)}` : digits.slice(0, point);\n const fraction = point <= 0 ? `${\"0\".repeat(-point)}${digits}` : point >= digits.length ? \"\" : digits.slice(point);\n if (fraction.length > scale) {\n throw new RangeError(`${String(value)} has ${fraction.length} fractional digits, scale ${scale}`);\n }\n const minor = `${whole}${fraction.padEnd(scale, \"0\")}`;\n const encoded = Number(negative ? `-${minor}` : minor);\n if (!Number.isSafeInteger(encoded)) throw new RangeError(\"decimal minor units exceed the safe integer wire range\");\n return encoded as Decimal<S>;\n}\n\nexport function mentionTokens(value: string): string[] {\n return value.split(\" \").filter((part) => part.startsWith(\"@\"));\n}\n\nexport function deterministicShare(amount: number, recipients: unknown[], recipient: unknown): number {\n const index = recipients.indexOf(recipient);\n const base = Math.floor(amount / recipients.length);\n return base + (index >= 0 && index < amount % recipients.length ? 1 : 0);\n}\n\nexport function concat(...values: unknown[]): string {\n return values.join(\"\");\n}\n\nexport const max = Math.max;\nexport const min = Math.min;\n\nexport function divmod(value: number, divisor: number): { quotient: number; remainder: number } {\n return { quotient: Math.floor(value / divisor), remainder: value % divisor };\n}\n\n/** Internal Quarry lowering helper; authored descriptors are never executed. */\nexport function mergeByIndex<T>(\n _values: T[], _fields: string[], _order: \"asc\" | \"desc\", _take: number, _site: string, _table: string,\n): T[] {\n throw new Error(\"snapback2: authored program descriptors are inert\");\n}\n\nexport function recurse(): never {\n throw new Error(\"snapback2: authored program descriptors are inert\");\n}\n"],
|
|
5
|
+
"mappings": "AAEO,IAAMA,EAAN,cAAwB,KAAM,CAMnC,YAAqBC,EAAcC,EAA0BC,EAA8B,KAAM,CAC/F,MAAM,GAAGF,CAAI,KAAKC,CAAO,EAAE,EADR,UAAAD,EAAwC,kBAAAE,CAE7D,CACF,ECcO,SAASC,GAAoBC,EAAqB,CACvDC,EAAMD,EAAQ,CAAC,SAAU,YAAa,WAAY,OAAQ,SAAS,EAAG,QAAQ,EAC9E,IAAME,EAAiC,CACrC,OAAQC,EAAUH,EAAO,QAAU,CAAC,EAAGI,EAAc,EACrD,WAAYJ,EAAO,WAAa,CAAC,GAAG,IAAIK,EAAiB,CAC3D,EACA,OAAIL,EAAO,WAAa,QAAa,OAAO,KAAKA,EAAO,QAAQ,EAAE,OAAS,IACzEE,EAAU,SAAWC,EAAUH,EAAO,SAAUM,EAAgB,GAE9DN,EAAO,OAAS,QAAaA,EAAO,OAAS,MAAMC,EAAMD,EAAO,KAAM,CAAC,WAAY,QAAQ,EAAG,MAAM,EACpGA,EAAO,OAAS,SAAcA,EAAO,KAAK,UAAYA,EAAO,KAAK,UACpEE,EAAU,KAAO,CAAE,SAAUF,EAAO,KAAK,SAAU,OAAQA,EAAO,KAAK,MAAO,GAE5EA,EAAO,UAAY,QAAaA,EAAO,QAAQ,OAAS,IAAGE,EAAU,QAAUF,EAAO,SACnF,KAAK,UAAUE,CAAS,CACjC,CAGA,SAASD,EAAMM,EAAaC,EAA2BC,EAAoB,CACzE,GAAI,OAAOF,GAAW,UAAYA,IAAW,MAAQ,MAAM,QAAQA,CAAM,EACvE,MAAM,IAAIG,EAAU,WAA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AM,GAAKC,GAASD,EAAO,OAAS,GAAKA,EAAO,MAAMC,CAAK,EACjH,GAAIE,EAAS,OAASrC,EACpB,MAAM,IAAI,WAAW,GAAG,OAAON,CAAK,CAAC,QAAQ2C,EAAS,MAAM,6BAA6BrC,CAAK,EAAE,EAElG,IAAMsC,EAAQ,GAAGF,CAAK,GAAGC,EAAS,OAAOrC,EAAO,GAAG,CAAC,GAC9CuC,EAAU,OAAOT,EAAW,IAAIQ,CAAK,GAAKA,CAAK,EACrD,GAAI,CAAC,OAAO,cAAcC,CAAO,EAAG,MAAM,IAAI,WAAW,wDAAwD,EACjH,OAAOA,CACT,CAEO,SAASC,GAAc9C,EAAyB,CACrD,OAAOA,EAAM,MAAM,GAAG,EAAE,OAAQ+C,GAASA,EAAK,WAAW,GAAG,CAAC,CAC/D,CAEO,SAASC,GAAmBC,EAAgBC,EAAuBC,EAA4B,CACpG,IAAMlC,EAAQiC,EAAW,QAAQC,CAAS,EAE1C,OADa,KAAK,MAAMF,EAASC,EAAW,MAAM,GACnCjC,GAAS,GAAKA,EAAQgC,EAASC,EAAW,OAAS,EAAI,EACxE,CAEO,SAASE,MAAUC,EAA2B,CACnD,OAAOA,EAAO,KAAK,EAAE,CACvB,CAEO,IAAMjD,GAAM,KAAK,IACXkD,GAAM,KAAK,IAEjB,SAASC,GAAOvD,EAAewD,EAA0D,CAC9F,MAAO,CAAE,SAAU,KAAK,MAAMxD,EAAQwD,CAAO,EAAG,UAAWxD,EAAQwD,CAAQ,CAC7E,CAGO,SAASC,GACdC,EAAcC,EAAmBC,EAAwBC,EAAeC,EAAeC,EAClF,CACL,MAAM,IAAI,MAAM,mDAAmD,CACrE,CAEO,SAASC,IAAiB,CAC/B,MAAM,IAAI,MAAM,mDAAmD,CACrE",
|
|
6
|
+
"names": ["EvalError", "code", "message", "authoredCode", "canonicalSchemaJson", "schema", "known", "canonical", "sortedMap", "normalizeTable", "normalizeMaintain", "normalizeChannel", "record", "fields", "what", "EvalError", "unknown", "key", "pick", "out", "field", "deepSorted", "value", "normalizeMaintain", "maintain", "known", "normalizeMaintainKind", "normalizeRule", "kind", "tag", "data", "tagged", "pick", "deepSorted", "normalizeTable", "table", "sortedMap", "normalizeColumnType", "normalizeIndex", "normalizeRules", "normalizeConstraint", "index", "normalizeChannel", "channel", "normalizeArgType", "rules", "rule", "normalizeRuleTerm", "term", "normalizeValue", "constraint", "what", "column", "fields", "COLUMN_FIELDS", "arg", "normalizeValue", "value", "kind", "data", "tagged", "sortedMap", "normalize", "result", "key", "compareCodepoints", "keys", "left", "right", "leftPoints", "rightPoints", "index", "sha256", "text", "bytes", "utf8", "bitLength", "high", "low", "shift", "state", "words", "offset", "index", "start", "a", "b", "s0", "rotate", "s1", "c", "d", "e", "f", "g", "h", "choice", "temp1", "SHA256_K", "majority", "temp2", "value", "rotate", "value", "bits", "utf8", "text", "bytes", "character", "point", "SHA256_K", "schemaDigest", "schema", "sha256", "canonicalSchemaJson", "DeliveryEnvelopeDecodeError", "path", "detail", "decodeDeliveryEnvelope", "json", "object", "fail", "digest", "string", "uint", "wire", "array", "pool", "row", "index", "key", "poolKey", "receipt", "validateReferences", "decodeDeliveryMessage", "plain", "encodeDeliveryEnvelope", "envelope", "decoded", "ordered", "canonicalWire", "left", "right", "compareText", "range", "item", "table", "verdict", "expandRows", "rows", "expand", "value", "rowReference", "clone", "escapedObject", "toClosureReceipt", "schema", "actualSchemaHash", "schemaDigest", "error", "taggedRows", "tagged", "tagRow", "ranges", "tagIndexValues", "tagBoundary", "deliveryRangeExtent", "selected", "candidate", "presentIds", "id", "indexColumns", "column", "authority", "name", "at", "rowIds", "boolean", "absence", "tagWireRow", "tagWireIndexValues", "values", "offset", "tagWireBoundary", "tagRow", "schema", "table", "row", "columns", "plain", "fail", "tagged", "name", "value", "tagTyped", "tagIndexValues", "index", "values", "offset", "indexColumns", "at", "tagBoundary", "range", "descriptor", "path", "uintOrSigned", "boolean", "bytes", "array", "item", "object", "kind", "fields", "ASSET_RECORD_FIELDS", "names", "key", "tagAssetField", "tagJson", "validateReferences", "pool", "rowReference", "poolKey", "escapedObject", "canonicalWire", "record", "wire", "required", "optional", "open", "string", "uint", "digest", "id", "compareText", "left", "right", "clone", "detail", "DeliveryEnvelopeDecodeError", "rowKey", "ref", "digests", "digestOf", "schema", "held", "digest", "schemaDigest", "closureFromCoverage", "coverage", "expectedSchemaHash", "schemaHash", "DeliveryEnvelopeDecodeError", "rows", "row", "tagWireRow", "range", "tagRange", "table", "index", "key", "tagWireIndexValues", "verdict", "record", "boundary", "value", "tagWireBoundary", "halo", "inert", "kind", "value", "schema", "table", "t", "max", "variants", "scale", "currency", "target", "maxBytes", "options", "viewer", "rule", "reason", "left", "right", "rules", "index", "key", "field", "name", "channel", "query", "args", "handler", "mutation", "effect", "emit", "payload", "seed", "range", "start", "end", "_", "decimal", "match", "negative", "wholeDigits", "fractionDigits", "exponent", "digits", "point", "whole", "fraction", "minor", "encoded", "mentionTokens", "part", "deterministicShare", "amount", "recipients", "recipient", "concat", "values", "min", "divmod", "divisor", "mergeByIndex", "_values", "_fields", "_order", "_take", "_site", "_table", "recurse"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/** Exact pooled-row reference spelling. Application objects with `$row` are escaped on the wire. */
|
|
2
|
+
export type WireRowReference = {
|
|
3
|
+
$row: {
|
|
4
|
+
table: string;
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export type WireEscapedObject = {
|
|
9
|
+
$row: {
|
|
10
|
+
$value: Record<string, WireValue>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type WireValue = null | boolean | number | string | WireValue[] | {
|
|
14
|
+
[key: string]: WireValue;
|
|
15
|
+
} | WireRowReference | WireEscapedObject;
|
|
16
|
+
export interface DeliveryRow {
|
|
17
|
+
table: string;
|
|
18
|
+
id: string;
|
|
19
|
+
row: Record<string, WireValue>;
|
|
20
|
+
}
|
|
21
|
+
export interface DeliveryRange {
|
|
22
|
+
site: string;
|
|
23
|
+
table: string;
|
|
24
|
+
index: string;
|
|
25
|
+
prefix: WireValue[];
|
|
26
|
+
order: "Asc" | "Desc";
|
|
27
|
+
take: number;
|
|
28
|
+
after: WireValue | null;
|
|
29
|
+
before: WireValue | null;
|
|
30
|
+
gt: WireValue | null;
|
|
31
|
+
gte: WireValue | null;
|
|
32
|
+
lt: WireValue | null;
|
|
33
|
+
lte: WireValue | null;
|
|
34
|
+
ruleHash: string;
|
|
35
|
+
rowIds: string[];
|
|
36
|
+
stop: "Limit" | "Exhausted";
|
|
37
|
+
absence: boolean;
|
|
38
|
+
haloId?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface DeliveryVerdict {
|
|
41
|
+
ruleHash: string;
|
|
42
|
+
/**
|
|
43
|
+
* The verdict's pinned inputs, digested as a wire fact:
|
|
44
|
+
* `sha256(canonical([table, index, key]))` — the JSON array of the rule
|
|
45
|
+
* input's table name, index name, and key values in wire encoding (ids and
|
|
46
|
+
* text as strings, integers as numbers, null as null, bytes as
|
|
47
|
+
* `{ "Bytes": hex }`), serialized with sorted object keys and no whitespace.
|
|
48
|
+
* A twin evaluating a rule computes it from the schema and the wire values it
|
|
49
|
+
* holds and looks the verdict up by `ruleHash` plus this digest; a replay
|
|
50
|
+
* trace's `inputsDigest` is the same value. A transaction-local created-row
|
|
51
|
+
* probe prefixes the array with `"created"`. Defined once in
|
|
52
|
+
* `snapback2-core/src/offline.rs` (`rule_inputs_digest`).
|
|
53
|
+
*/
|
|
54
|
+
pinnedInputsDigest: string;
|
|
55
|
+
principal: string;
|
|
56
|
+
authEpoch: number;
|
|
57
|
+
result: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface DeliveryReceipt {
|
|
60
|
+
ranges: DeliveryRange[];
|
|
61
|
+
absences: Array<[table: string, index: string, key: WireValue[]]>;
|
|
62
|
+
verdicts: DeliveryVerdict[];
|
|
63
|
+
}
|
|
64
|
+
export interface DeliveryAuthority {
|
|
65
|
+
principal: string;
|
|
66
|
+
authEpoch: number;
|
|
67
|
+
}
|
|
68
|
+
export interface DeliveryEnvelopeV1 {
|
|
69
|
+
protocol: 1;
|
|
70
|
+
generation: string;
|
|
71
|
+
schemaHash: string;
|
|
72
|
+
planHash: string;
|
|
73
|
+
authority: DeliveryAuthority;
|
|
74
|
+
state: "complete" | "capped" | "partial" | "denied";
|
|
75
|
+
reason?: string;
|
|
76
|
+
rule?: string;
|
|
77
|
+
data: WireValue;
|
|
78
|
+
next: string | null;
|
|
79
|
+
seq: number;
|
|
80
|
+
rows: DeliveryRow[];
|
|
81
|
+
receipt: DeliveryReceipt;
|
|
82
|
+
validator: string;
|
|
83
|
+
}
|
|
84
|
+
export interface DeliveryUnchanged {
|
|
85
|
+
state: "unchanged";
|
|
86
|
+
seq: number;
|
|
87
|
+
validator: string;
|
|
88
|
+
}
|
|
89
|
+
export type DeliveryMessage = DeliveryEnvelopeV1 | DeliveryUnchanged;
|
|
90
|
+
export type TaggedValue = "Null" | {
|
|
91
|
+
Bool: boolean;
|
|
92
|
+
} | {
|
|
93
|
+
Int: number;
|
|
94
|
+
} | {
|
|
95
|
+
String: string;
|
|
96
|
+
} | {
|
|
97
|
+
Id: string;
|
|
98
|
+
} | {
|
|
99
|
+
Bytes: string;
|
|
100
|
+
} | {
|
|
101
|
+
Row: Record<string, TaggedValue>;
|
|
102
|
+
} | {
|
|
103
|
+
Array: TaggedValue[];
|
|
104
|
+
} | {
|
|
105
|
+
Map: Record<string, TaggedValue>;
|
|
106
|
+
};
|
|
107
|
+
export interface EvaluatorClosureReceipt {
|
|
108
|
+
schema_hash: string;
|
|
109
|
+
rows: Array<{
|
|
110
|
+
table: string;
|
|
111
|
+
id: string;
|
|
112
|
+
row: TaggedValue;
|
|
113
|
+
}>;
|
|
114
|
+
ranges: Array<{
|
|
115
|
+
site: string;
|
|
116
|
+
table: string;
|
|
117
|
+
index: string;
|
|
118
|
+
prefix: TaggedValue[];
|
|
119
|
+
order: "Asc" | "Desc";
|
|
120
|
+
take: number;
|
|
121
|
+
after: TaggedValue | null;
|
|
122
|
+
before: TaggedValue | null;
|
|
123
|
+
gt: TaggedValue | null;
|
|
124
|
+
gte: TaggedValue | null;
|
|
125
|
+
lt: TaggedValue | null;
|
|
126
|
+
lte: TaggedValue | null;
|
|
127
|
+
rule_hash: string;
|
|
128
|
+
row_ids: string[];
|
|
129
|
+
stop: "Limit" | "Exhausted";
|
|
130
|
+
absence: boolean;
|
|
131
|
+
halo: {
|
|
132
|
+
table: string;
|
|
133
|
+
id: string;
|
|
134
|
+
row: TaggedValue;
|
|
135
|
+
} | null;
|
|
136
|
+
n2_key: null;
|
|
137
|
+
/** Members a later swap evicted from this page; absent when none (the goldens' bytes carry none). */
|
|
138
|
+
evicted_ids?: string[];
|
|
139
|
+
}>;
|
|
140
|
+
absences: Array<[string, string, TaggedValue[]]>;
|
|
141
|
+
verdicts: Array<{
|
|
142
|
+
rule_hash: string;
|
|
143
|
+
pinned_inputs_digest: string;
|
|
144
|
+
principal: string;
|
|
145
|
+
auth_epoch: number;
|
|
146
|
+
result: boolean;
|
|
147
|
+
}>;
|
|
148
|
+
}
|
|
149
|
+
export declare class DeliveryEnvelopeDecodeError extends TypeError {
|
|
150
|
+
readonly path: string;
|
|
151
|
+
constructor(path: string, detail: string);
|
|
152
|
+
}
|
|
153
|
+
export declare function decodeDeliveryEnvelope(json: unknown): DeliveryEnvelopeV1;
|
|
154
|
+
/** Decode either a full authority envelope or a conditional `unchanged` marker. */
|
|
155
|
+
export declare function decodeDeliveryMessage(json: unknown): DeliveryMessage;
|
|
156
|
+
export declare function encodeDeliveryEnvelope(envelope: DeliveryEnvelopeV1): string;
|
|
157
|
+
export declare function expandRows(envelope: DeliveryEnvelopeV1): WireValue;
|
|
158
|
+
/** Rebuild the evaluator's externally-tagged private receipt from the public pool. */
|
|
159
|
+
export declare function toClosureReceipt(envelope: DeliveryEnvelopeV1, schema: any): EvaluatorClosureReceipt;
|
|
160
|
+
export type DeliveryRangeExtent = {
|
|
161
|
+
stop: "Limit";
|
|
162
|
+
firstKey: WireValue[];
|
|
163
|
+
lastKey: WireValue[];
|
|
164
|
+
presentIds: string[];
|
|
165
|
+
} | {
|
|
166
|
+
stop: "Exhausted";
|
|
167
|
+
prefix: WireValue[];
|
|
168
|
+
bounds: Pick<DeliveryRange, "after" | "before" | "gt" | "gte" | "lt" | "lte">;
|
|
169
|
+
presentIds: string[];
|
|
170
|
+
};
|
|
171
|
+
/** Derive the rule-2 range extent solely from a delivery and its generation schema. */
|
|
172
|
+
export declare function deliveryRangeExtent(envelope: DeliveryEnvelopeV1, schema: any, range: DeliveryRange): DeliveryRangeExtent;
|
|
173
|
+
/** Tag one pooled wire row by its table's declared column types (the evaluator's private form). */
|
|
174
|
+
export declare function tagWireRow(schema: any, table: string, row: Record<string, WireValue>): TaggedValue;
|
|
175
|
+
/** Tag index key values (a prefix, a key, or a cursor position) by the index's column types from `offset`. */
|
|
176
|
+
export declare function tagWireIndexValues(schema: any, table: string, index: string, values: WireValue[], offset?: number): TaggedValue[];
|
|
177
|
+
/** Tag a range boundary (`after`, `before`, `gt`, …): an array is a position after the prefix, a scalar its first column. */
|
|
178
|
+
export declare function tagWireBoundary(schema: any, range: Pick<DeliveryRange, "table" | "index" | "prefix">, value: WireValue | null): TaggedValue | null;
|
|
179
|
+
/** Tag one wire value by a declared column or argument descriptor. */
|
|
180
|
+
export declare function tagWireValue(descriptor: unknown, value: WireValue, path: string): TaggedValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function schemaDigest(schema: any): string;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { type DeliveryEnvelopeV1 } from "./offline-protocol.js";
|
|
2
|
+
import { OutboxLedger } from "./store/outbox.js";
|
|
3
|
+
import { type Coverage, type HeldAnswer, type HeldProgram, type OutboxEntry, type RangeStore, type StoreRefresh, type WatermarkRecord, tailWatermark } from "./store/range-store.js";
|
|
4
|
+
import { ByteCache } from "./store/byte-cache.js";
|
|
5
|
+
import { Twin, type LocalAnswer, type Prediction } from "./twin.js";
|
|
6
|
+
import type { Manifest, OfflineClientOptions, OutboxSettlement } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Ids a certified mutation can mint: the certificate's insert/upsert bounds, which
|
|
9
|
+
* already price every row the program creates. A program without a certificate
|
|
10
|
+
* has no bound, and an offline write against it refuses rather than guessing.
|
|
11
|
+
*/
|
|
12
|
+
export declare function certificateMaxNewIds(program: unknown): number | undefined;
|
|
13
|
+
export { tailWatermark };
|
|
14
|
+
export interface MountedQuery {
|
|
15
|
+
op: string;
|
|
16
|
+
args: unknown;
|
|
17
|
+
drain: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface ResumeRequestV1 {
|
|
20
|
+
protocol: 1;
|
|
21
|
+
generation: string;
|
|
22
|
+
schemaHash: string;
|
|
23
|
+
authEpoch: number;
|
|
24
|
+
log?: {
|
|
25
|
+
op: string;
|
|
26
|
+
args: unknown;
|
|
27
|
+
watermark: string | null;
|
|
28
|
+
validator?: string;
|
|
29
|
+
};
|
|
30
|
+
mounted: Array<{
|
|
31
|
+
op: string;
|
|
32
|
+
args: unknown;
|
|
33
|
+
validator: string;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
export interface ResumeAdjustment {
|
|
37
|
+
which?: string;
|
|
38
|
+
cap?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface AcceptedDelivery<Result> {
|
|
41
|
+
result: {
|
|
42
|
+
state: "complete" | "capped" | "partial" | "denied";
|
|
43
|
+
data?: Result;
|
|
44
|
+
next?: string | null;
|
|
45
|
+
seq: number;
|
|
46
|
+
reason?: string;
|
|
47
|
+
rule?: string;
|
|
48
|
+
};
|
|
49
|
+
envelope?: DeliveryEnvelopeV1;
|
|
50
|
+
refresh?: StoreRefresh;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* `GET /api/program` as custody: the shape the twin holds per generation.
|
|
54
|
+
* Anything malformed is refused here rather than evaluated later.
|
|
55
|
+
*/
|
|
56
|
+
export declare function decodeHeldProgram(value: unknown): HeldProgram | undefined;
|
|
57
|
+
export declare class OfflineAuthorityError extends Error {
|
|
58
|
+
readonly code = "E_OFFLINE_AUTHORITY";
|
|
59
|
+
constructor(message: string);
|
|
60
|
+
}
|
|
61
|
+
export declare class OfflineRuntime {
|
|
62
|
+
private readonly options;
|
|
63
|
+
readonly store: RangeStore;
|
|
64
|
+
readonly fenceDays: number;
|
|
65
|
+
readonly maxAssetBytes: number;
|
|
66
|
+
/** Asset bytes beside the rows, under their lease (LLP 1012 §9); lane O4. */
|
|
67
|
+
readonly bytes: ByteCache;
|
|
68
|
+
readonly outbox: OutboxLedger;
|
|
69
|
+
/** The replay currently in flight; the next drain queues behind it. Never rejects. */
|
|
70
|
+
drainTail: Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* The last drain's outcome, rejection kept: `settled()` awaits this so a
|
|
73
|
+
* non-retryable refusal that stopped the replay reaches the caller instead of
|
|
74
|
+
* resolving with intents still queued (LLP 1012 §7).
|
|
75
|
+
*/
|
|
76
|
+
drainOutcome: Promise<OutboxSettlement>;
|
|
77
|
+
/** The twin: the certified program over this partition's coverage (LLP 1012 §6, §7). */
|
|
78
|
+
readonly twin: Twin;
|
|
79
|
+
private partition?;
|
|
80
|
+
private retention;
|
|
81
|
+
private cursors;
|
|
82
|
+
private schema?;
|
|
83
|
+
private facts?;
|
|
84
|
+
/** Set by a delivery under another generation or schema: held coverage is stale-exact until the reset path (LLP 1012 §8). */
|
|
85
|
+
private superseded?;
|
|
86
|
+
private latestSeq;
|
|
87
|
+
private sessionEpoch?;
|
|
88
|
+
private pendingGrant?;
|
|
89
|
+
private pendingBounds?;
|
|
90
|
+
private pendingProgram?;
|
|
91
|
+
private held?;
|
|
92
|
+
private standIn?;
|
|
93
|
+
private resumeQueries;
|
|
94
|
+
private tail;
|
|
95
|
+
/** Fences deliveries already in flight when coverage or principal is replaced. */
|
|
96
|
+
coverageRevision: number;
|
|
97
|
+
constructor(options: OfflineClientOptions);
|
|
98
|
+
get principal(): string | undefined;
|
|
99
|
+
/** The generation of the certified program this partition holds, if any. */
|
|
100
|
+
get programGeneration(): string | undefined;
|
|
101
|
+
/** A live delivery rotated past the held coverage; only the reset resume may clear it. */
|
|
102
|
+
get resetNeeded(): boolean;
|
|
103
|
+
/** The twin's answer for a query, or `undefined` when it cannot run (no program, another generation). */
|
|
104
|
+
evaluate(op: string, args: unknown): Promise<LocalAnswer | undefined>;
|
|
105
|
+
/** The twin's run of a mutation over held rows with the intent's pinned ids. */
|
|
106
|
+
predict(op: string, args: unknown, ids: string[]): Promise<Prediction>;
|
|
107
|
+
/** The highest server seq this runtime has committed; what a queued intent was issued against. */
|
|
108
|
+
get seq(): number;
|
|
109
|
+
open(principal: string, authenticated?: boolean): Promise<void>;
|
|
110
|
+
/** Called only after the owner authenticated this exact principal. */
|
|
111
|
+
reauthenticate(principal: string): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Records the `grant` a login, guest, or resume response carries. The
|
|
114
|
+
* partition may not be open yet (login opens it next), so the grant waits
|
|
115
|
+
* until the store for this principal is writable. Returns its input.
|
|
116
|
+
*/
|
|
117
|
+
noteGrant<T>(value: T): T;
|
|
118
|
+
adoptPendingGrant(): Promise<void>;
|
|
119
|
+
/** True when a resume request's `log` is an ordinary answer standing in for a drained log. */
|
|
120
|
+
standInLog(log: {
|
|
121
|
+
op: string;
|
|
122
|
+
args: unknown;
|
|
123
|
+
}): boolean;
|
|
124
|
+
queuedIntents(): Promise<OutboxEntry[]>;
|
|
125
|
+
seal(): Promise<void>;
|
|
126
|
+
wipe(): Promise<void>;
|
|
127
|
+
close(): Promise<void>;
|
|
128
|
+
manifest(value: Manifest): void;
|
|
129
|
+
/**
|
|
130
|
+
* The op's cursor argument as the manifest names it (the server keys the resume tail
|
|
131
|
+
* by that argument's type, never its name); `c`, the recipe's spelling, until the
|
|
132
|
+
* manifest is loaded.
|
|
133
|
+
*/
|
|
134
|
+
cursorArg(op: string): string;
|
|
135
|
+
/**
|
|
136
|
+
* Records `/api/program`: the schema, the certified program held for the twin
|
|
137
|
+
* keyed by its generation, and each op's write bound — persisted together
|
|
138
|
+
* with the outbox so a cold start with the owner cut evaluates and prices its
|
|
139
|
+
* slices from the certificate, never from a guess (LLP 1012 §7, §8).
|
|
140
|
+
*/
|
|
141
|
+
program(value: unknown, signal?: AbortSignal): Promise<void>;
|
|
142
|
+
accept<Result>(op: string, args: unknown, raw: unknown): Promise<AcceptedDelivery<Result>>;
|
|
143
|
+
commit(op: string, args: unknown, accepted: AcceptedDelivery<unknown>, revision?: number, current?: () => boolean): Promise<boolean>;
|
|
144
|
+
commitMany(items: Array<{
|
|
145
|
+
op: string;
|
|
146
|
+
args: unknown;
|
|
147
|
+
accepted: AcceptedDelivery<unknown>;
|
|
148
|
+
}>, watermark?: Omit<WatermarkRecord, "generation" | "schemaHash" | "authEpoch" | "updatedAt">, outbox?: {
|
|
149
|
+
put?: OutboxEntry[];
|
|
150
|
+
remove?: string[];
|
|
151
|
+
}, revision?: number, current?: () => boolean, resumeSeq?: number): Promise<boolean>;
|
|
152
|
+
answer<Result>(op: string, args: unknown): Promise<HeldAnswer<Result> | undefined>;
|
|
153
|
+
private coverageCurrent;
|
|
154
|
+
/** The envelope's data with every viewed view-once row read as `null`, on the wire as in the store. */
|
|
155
|
+
private expandUnviewed;
|
|
156
|
+
markWatermark(op: string, args: unknown, watermark: string | null, validator?: string, revision?: number): Promise<void>;
|
|
157
|
+
resumeRequest(mounted: MountedQuery[], adjustment?: ResumeAdjustment): Promise<ResumeRequestV1 | undefined>;
|
|
158
|
+
resetCoverage(authEpoch?: number, signal?: AbortSignal): Promise<void>;
|
|
159
|
+
/** Clear only the rebuild we completed, never a successor discovered during it. */
|
|
160
|
+
completeReset(revision: number, signal?: AbortSignal): Promise<boolean>;
|
|
161
|
+
coverage(): Promise<Coverage | undefined>;
|
|
162
|
+
/** A real query earns the authority facts; metadata alone never renews trust. */
|
|
163
|
+
resumeSeed(mounted: MountedQuery[]): Promise<MountedQuery | undefined>;
|
|
164
|
+
private flushGrant;
|
|
165
|
+
private flushBounds;
|
|
166
|
+
private loadProgram;
|
|
167
|
+
private loadFacts;
|
|
168
|
+
private serial;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* The offline view of a query: the twin's local answer when it ran and is at
|
|
172
|
+
* least as exact as the held one, else the held answer, else `hydrating`. A
|
|
173
|
+
* held answer's facts (`seq`, `since`, the drain's watermark, `retained`) stay
|
|
174
|
+
* with the twin's data: the stored answer is the covered case, not a second
|
|
175
|
+
* mechanism (LLP 1012 §6).
|
|
176
|
+
*/
|
|
177
|
+
export declare function offlineView<Result>(held: HeldAnswer<Result> | undefined, local?: LocalAnswer): any;
|