@query-farm/vgi 0.50.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/functions/aggregate.d.ts +25 -21
- package/dist/functions/execution-cache.d.ts +11 -0
- package/dist/functions/storage-cf-do.d.ts +38 -0
- package/dist/functions/storage-seal.d.ts +27 -0
- package/dist/functions/storage.d.ts +49 -1
- package/dist/functions/table-buffering.d.ts +30 -0
- package/dist/http/fetch.d.ts +7 -0
- package/dist/index.core.d.ts +3 -2
- package/dist/index.js +749 -384
- package/dist/index.js.map +20 -18
- package/dist/protocol/dispatch.d.ts +9 -0
- package/dist/protocol/handlers/aggregate.d.ts +1 -1
- package/dist/protocol/handlers/catalog/shared.d.ts +10 -0
- package/dist/protocol/handlers/function.d.ts +2 -0
- package/dist/protocol/handlers/table-buffering.d.ts +1 -1
- package/dist/protocol/types.d.ts +8 -0
- package/dist/serve-entry.d.ts +16 -2
- package/dist/serve-entry.js +1034 -526
- package/dist/serve-entry.js.map +20 -18
- package/dist/worker-cf-entry.js +2713 -2217
- package/dist/worker-cf-entry.js.map +26 -24
- package/package.json +1 -1
- package/src/functions/aggregate.ts +101 -152
- package/src/functions/copy-from.ts +2 -2
- package/src/functions/execution-cache.ts +59 -0
- package/src/functions/storage-cf-do.ts +152 -22
- package/src/functions/storage-seal.ts +208 -0
- package/src/functions/storage.ts +120 -3
- package/src/functions/table-buffering.ts +91 -15
- package/src/functions/table-in-out.ts +3 -1
- package/src/functions/table.ts +4 -4
- package/src/http/fetch.ts +9 -0
- package/src/index.core.ts +3 -1
- package/src/protocol/dispatch.ts +12 -2
- package/src/protocol/handlers/aggregate.ts +123 -82
- package/src/protocol/handlers/catalog/shared.ts +20 -0
- package/src/protocol/handlers/function.ts +38 -11
- package/src/protocol/handlers/table-buffering.ts +44 -32
- package/src/protocol/types.ts +8 -0
- package/src/serve-entry.ts +33 -3
|
@@ -24,6 +24,15 @@ export interface ProtocolConfig {
|
|
|
24
24
|
* receive a given attach must use the same key.
|
|
25
25
|
*/
|
|
26
26
|
attachSecretKey?: Uint8Array | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Input key material for sealed framework storage payloads
|
|
29
|
+
* (src/functions/storage-seal.ts). The cross-SDK v1 rule is the UTF-8 bytes
|
|
30
|
+
* of `VGI_SIGNING_KEY` exactly as configured (not its hex-decoded form), so a
|
|
31
|
+
* deployment's one key derives the same payload key in every SDK. Defaults
|
|
32
|
+
* to `signingKey` (bytes passed as bytes are used unchanged); with neither,
|
|
33
|
+
* the host-local key file. The attach / state-token keys are unaffected.
|
|
34
|
+
*/
|
|
35
|
+
storageSealKey?: Uint8Array | undefined;
|
|
27
36
|
}
|
|
28
37
|
/**
|
|
29
38
|
* Wire name of the VGI protocol: the `vgi_rpc.protocol` routing key and the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { VgiService } from "../../generated/vgi-service.js";
|
|
2
2
|
import type { FunctionRegistry } from "../../functions/registry.js";
|
|
3
3
|
/** The aggregate lifecycle's `vgi.v3` handlers. */
|
|
4
|
-
export declare function aggregateHandlers(registry: FunctionRegistry): Partial<VgiService>;
|
|
4
|
+
export declare function aggregateHandlers(registry: FunctionRegistry, signingKey?: Uint8Array, attachSecretKey?: Uint8Array, storageSealKey?: Uint8Array | undefined): Partial<VgiService>;
|
|
@@ -45,6 +45,16 @@ export declare function openAttachFull(envelope: Uint8Array, auth: AuthContext |
|
|
|
45
45
|
* storage routing uses openAttachFull / deriveShardKey to reach the UUID.
|
|
46
46
|
*/
|
|
47
47
|
export declare function openAttach(envelope: Uint8Array, auth: AuthContext | undefined, signingKey: Uint8Array | undefined, attachSecretKey?: Uint8Array): Promise<Uint8Array>;
|
|
48
|
+
/**
|
|
49
|
+
* Open an attach envelope once, returning both what the function body sees
|
|
50
|
+
* (the catalog's own bytes, UUID and options trailer stripped) and the
|
|
51
|
+
* FunctionStorage shard key of its framework UUID. An empty / absent attach
|
|
52
|
+
* yields `{ attach: <as given>, shardKey: "" }`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function openAttachWithShard(envelope: Uint8Array | null | undefined, auth: AuthContext | undefined, signingKey: Uint8Array | undefined, attachSecretKey?: Uint8Array): Promise<{
|
|
55
|
+
attach: Uint8Array | null;
|
|
56
|
+
shardKey: string;
|
|
57
|
+
}>;
|
|
48
58
|
/**
|
|
49
59
|
* deriveShardKey returns the Cloudflare-DO routing key for an attach:
|
|
50
60
|
* "att-" + hex(the 16-byte framework UUID at the head of the unwrapped attach).
|
|
@@ -5,6 +5,8 @@ export interface FunctionHandlerConfig {
|
|
|
5
5
|
signingKey?: Uint8Array | undefined;
|
|
6
6
|
/** Explicit root key for secret ATTACH options (see attach-secret-options.ts). */
|
|
7
7
|
attachSecretKey?: Uint8Array | undefined;
|
|
8
|
+
/** Seal ikm for framework storage payloads (see ProtocolConfig.storageSealKey). */
|
|
9
|
+
storageSealKey?: Uint8Array | undefined;
|
|
8
10
|
/**
|
|
9
11
|
* Used to map a bind's `attach_opaque_data` to its catalog, so resolution can
|
|
10
12
|
* be scoped when two catalogs declare the same schema and function name.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { VgiService } from "../../generated/vgi-service.js";
|
|
2
2
|
import type { FunctionRegistry } from "../../functions/registry.js";
|
|
3
3
|
/** The table_buffering lifecycle's `vgi.v3` handlers. */
|
|
4
|
-
export declare function tableBufferingHandlers(registry: FunctionRegistry, signingKey?: Uint8Array, attachSecretKey?: Uint8Array): Partial<VgiService>;
|
|
4
|
+
export declare function tableBufferingHandlers(registry: FunctionRegistry, signingKey?: Uint8Array, attachSecretKey?: Uint8Array, storageSealKey?: Uint8Array | undefined): Partial<VgiService>;
|
package/dist/protocol/types.d.ts
CHANGED
|
@@ -51,6 +51,14 @@ export interface BindRequest {
|
|
|
51
51
|
attach_opaque_data: Uint8Array | null;
|
|
52
52
|
transaction_opaque_data: Uint8Array | null;
|
|
53
53
|
resolved_secrets_provided: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Framework-derived, never on the wire: the FunctionStorage shard key
|
|
56
|
+
* (`att-<uuid hex>`) of this call's attach, stamped when the framework opens
|
|
57
|
+
* the attach and strips its UUID (which the function body never sees).
|
|
58
|
+
* Absent / "" when the call is not bound to an ATTACH. Read it with
|
|
59
|
+
* `shardKeyOf(bindCall)`; `BoundStorage` routes and seals by it.
|
|
60
|
+
*/
|
|
61
|
+
storage_shard_key?: string | null;
|
|
54
62
|
/**
|
|
55
63
|
* COPY ... FROM context — `null`/absent unless this bind/init opens a
|
|
56
64
|
* COPY-FROM scan. Additive + name-keyed, so ordinary scans (which omit it on
|
package/dist/serve-entry.d.ts
CHANGED
|
@@ -52,8 +52,12 @@ export interface ServeVgiWorkerOptions extends HostingOptions {
|
|
|
52
52
|
port?: number | undefined;
|
|
53
53
|
/** Bind address. Iroh bridge mode defaults to loopback; otherwise Bun's default. */
|
|
54
54
|
hostname?: string | undefined;
|
|
55
|
-
/**
|
|
56
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Overrides `$VGI_SIGNING_KEY`: 32 bytes, or the same 64-hex-character string
|
|
57
|
+
* the env var takes. A string's UTF-8 bytes are also the storage-seal ikm
|
|
58
|
+
* (see {@link resolveStorageSealKey}); bytes are used unchanged.
|
|
59
|
+
*/
|
|
60
|
+
signingKey?: Uint8Array | string | undefined;
|
|
57
61
|
/**
|
|
58
62
|
* Optional root key for secret ATTACH options (encrypted inside
|
|
59
63
|
* `attach_opaque_data` for `attachOptions()`). Defaults to the signing key.
|
|
@@ -109,6 +113,16 @@ export declare function parseSigningKeyHex(hex: string): Uint8Array;
|
|
|
109
113
|
* the key.
|
|
110
114
|
*/
|
|
111
115
|
export declare function resolveSigningKey(explicit: Uint8Array | undefined, env: ServeEnv, warn?: (msg: string) => void): Uint8Array;
|
|
116
|
+
/**
|
|
117
|
+
* The ikm for sealed framework storage payloads (cross-SDK v1): the UTF-8 bytes
|
|
118
|
+
* of the signing key *as configured* -- an explicit string option, else the raw
|
|
119
|
+
* `$VGI_SIGNING_KEY` value, unmodified, exactly as vgi-python and vgi-java read
|
|
120
|
+
* it -- so one deployment key derives one payload key in every SDK. Explicit
|
|
121
|
+
* bytes are used unchanged; a generated key's bytes are used as-is (it is
|
|
122
|
+
* process-local anyway). Only the storage seal uses this; state tokens and
|
|
123
|
+
* opaque-data envelopes keep the hex-decoded key.
|
|
124
|
+
*/
|
|
125
|
+
export declare function resolveStorageSealKey(explicit: Uint8Array | string | undefined, env: ServeEnv, resolvedSigningKey: Uint8Array): Uint8Array;
|
|
112
126
|
/**
|
|
113
127
|
* Build the fetch handler a VGI worker serves over HTTP, with the standardized
|
|
114
128
|
* landing surface mounted at `prefix`.
|