@query-farm/vgi 0.51.0 → 0.52.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.
Files changed (72) hide show
  1. package/README.md +45 -3
  2. package/dist/arrow/impl-flechette/ipc.d.ts +9 -1
  3. package/dist/client-entry.js +833 -775
  4. package/dist/client-entry.js.map +10 -10
  5. package/dist/functions/storage-blobs.d.ts +173 -0
  6. package/dist/functions/storage-cf-do.d.ts +12 -0
  7. package/dist/functions/storage.d.ts +22 -0
  8. package/dist/functions/table.d.ts +6 -1
  9. package/dist/generated/vgi-client.d.ts +7 -1
  10. package/dist/generated/vgi-protocol-schemas.d.ts +10 -9
  11. package/dist/generated/vgi-protocol-types.d.ts +244 -2
  12. package/dist/generated/vgi-service.d.ts +1 -1
  13. package/dist/hosted.d.ts +117 -0
  14. package/dist/http/blob-vendor.d.ts +33 -0
  15. package/dist/http/fetch.d.ts +53 -2
  16. package/dist/http/hosted-auth.d.ts +45 -0
  17. package/dist/index.core.d.ts +9 -2
  18. package/dist/index.js +5238 -3619
  19. package/dist/index.js.map +44 -28
  20. package/dist/protocol/arguments-ref.d.ts +107 -0
  21. package/dist/protocol/dispatch.d.ts +3 -2
  22. package/dist/protocol/handlers/function.d.ts +21 -0
  23. package/dist/protocol/serialize.d.ts +1 -1
  24. package/dist/protocol/serializers/bind.d.ts +27 -1
  25. package/dist/protocol/serializers/cardinality.d.ts +1 -1
  26. package/dist/protocol/serializers/splits.d.ts +7 -0
  27. package/dist/protocol/state-serializer.d.ts +8 -7
  28. package/dist/protocol/stream-init.d.ts +17 -0
  29. package/dist/protocol/types.d.ts +24 -0
  30. package/dist/secrets/lookups.d.ts +31 -0
  31. package/dist/serve-entry.d.ts +25 -4
  32. package/dist/serve-entry.js +2940 -1219
  33. package/dist/serve-entry.js.map +44 -29
  34. package/dist/worker-cf-entry.d.ts +5 -0
  35. package/dist/worker-cf-entry.js +2928 -1223
  36. package/dist/worker-cf-entry.js.map +47 -31
  37. package/package.json +5 -4
  38. package/src/arrow/impl-flechette/ipc.ts +9 -1
  39. package/src/functions/storage-blobs.ts +654 -0
  40. package/src/functions/storage-cf-do.ts +24 -0
  41. package/src/functions/storage.ts +54 -5
  42. package/src/functions/table-buffering.ts +14 -4
  43. package/src/functions/table.ts +8 -4
  44. package/src/generated/vgi-client.ts +9 -2
  45. package/src/generated/vgi-protocol-schemas.ts +115 -107
  46. package/src/generated/vgi-protocol-types.ts +640 -3
  47. package/src/generated/vgi-service.ts +2 -2
  48. package/src/hosted.ts +254 -0
  49. package/src/http/blob-vendor.ts +80 -0
  50. package/src/http/fetch.ts +170 -8
  51. package/src/http/hosted-auth.ts +326 -0
  52. package/src/index.core.ts +64 -1
  53. package/src/protocol/arguments-ref.ts +260 -0
  54. package/src/protocol/dispatch.ts +3 -2
  55. package/src/protocol/handlers/function.ts +109 -60
  56. package/src/protocol/handlers/table-buffering.ts +5 -0
  57. package/src/protocol/serialize.ts +3 -0
  58. package/src/protocol/serializers/bind.ts +96 -69
  59. package/src/protocol/serializers/cardinality.ts +4 -7
  60. package/src/protocol/serializers/init.ts +5 -11
  61. package/src/protocol/serializers/splits.ts +31 -4
  62. package/src/protocol/state-serializer.ts +27 -39
  63. package/src/protocol/stream-init.ts +87 -0
  64. package/src/protocol/types.ts +25 -0
  65. package/src/secrets/lookups.ts +53 -0
  66. package/src/serve-entry.ts +105 -8
  67. package/src/worker-cf-entry.ts +33 -0
  68. package/src/worker.ts +25 -0
  69. package/dist/protocol/carried-init-request.d.ts +0 -28
  70. package/dist/util/zstd-sync.d.ts +0 -7
  71. package/src/protocol/carried-init-request.ts +0 -139
  72. package/src/util/zstd-sync.ts +0 -50
@@ -0,0 +1,173 @@
1
+ import { VendorBlobClient, type BlobRef } from "@query-farm/vgi-rpc";
2
+ import type { FunctionStorage, WorkerStateKey } from "./storage.js";
3
+ /** Values of at least this many bytes go to the blob vendor (default). */
4
+ export declare const DEFAULT_EXTERNALIZE_BYTES: number;
5
+ /** Largest blob a read will fetch (the vendor's per-object cap). */
6
+ export declare const MAX_BLOB_BYTES: number;
7
+ export declare const ENV_VENDOR_URL = "VGI_BLOB_VENDOR_URL";
8
+ export declare const ENV_VENDOR_TOKEN = "VGI_BLOB_VENDOR_TOKEN";
9
+ export declare const ENV_EXTERNALIZE = "VGI_STORAGE_EXTERNALIZE";
10
+ export declare const ENV_EXTERNALIZE_BYTES = "VGI_STORAGE_EXTERNALIZE_BYTES";
11
+ export declare const ENV_EXTERNALIZE_BYTES_ALIAS = "VGI_CF_DO_EXTERNALIZE_BYTES";
12
+ export declare const TAG_INLINE = 0;
13
+ export declare const TAG_POINTER = 1;
14
+ /** Tag + u64 size + 32-byte SHA-256: the pointer's fixed part. */
15
+ export declare const POINTER_FIXED_BYTES: number;
16
+ type Env = Readonly<Record<string, string | undefined>>;
17
+ /** A value read from storage is not a valid envelope (empty, unknown tag,
18
+ * malformed pointer), or is a pointer read with no blob vendor configured. */
19
+ export declare class StorageEnvelopeError extends Error {
20
+ constructor(message: string);
21
+ }
22
+ /** An externalized storage value's blob could not be read. The message starts
23
+ * `storage blob <object id>`. */
24
+ export declare class StorageBlobError extends Error {
25
+ constructor(message: string);
26
+ }
27
+ /** The downloaded blob does not match the pointer's size or SHA-256. */
28
+ export declare class StorageBlobIntegrityError extends StorageBlobError {
29
+ constructor(message: string);
30
+ }
31
+ /** The blob is gone from the vendor or its storage (expired, deleted, never uploaded). */
32
+ export declare class StorageBlobMissingError extends StorageBlobError {
33
+ constructor(message: string);
34
+ }
35
+ /** A value is too large for the backend and no blob vendor is configured. */
36
+ export declare class StorageValueTooLargeError extends Error {
37
+ constructor(message: string);
38
+ }
39
+ /** The inline envelope of `value`: `0x00 || value`. */
40
+ export declare function encodeInline(value: Uint8Array): Uint8Array;
41
+ /**
42
+ * The pointer envelope for a vendored blob:
43
+ * `0x01 || u64be(size) || sha256 || object_id`.
44
+ * @throws Error if the object id is outside `[A-Za-z0-9._:-]{1,128}`.
45
+ */
46
+ export declare function encodePointer(ref: BlobRef): Uint8Array;
47
+ /** Parse a pointer envelope (tag 0x01).
48
+ * @throws StorageEnvelopeError if it is truncated or its object id is malformed. */
49
+ export declare function decodePointer(envelope: Uint8Array): BlobRef;
50
+ /** The envelope's tag.
51
+ * @throws StorageEnvelopeError for an empty value or an unknown tag. */
52
+ export declare function envelopeTag(envelope: Uint8Array): number;
53
+ /** Vendor `scope.execution_id` for one queue (`q`) or state scope (`s`):
54
+ * `<kind>.<hex ident>`, or `<kind>.h<hex sha256(ident)>` past 128 characters. */
55
+ export declare function blobExecutionId(kind: "q" | "s", ident: Uint8Array): Promise<string>;
56
+ /** Vendor `scope.shard` for a storage shard key: empty becomes `loc-anon`; a key
57
+ * outside `[A-Za-z0-9._-]{1,128}` becomes `h-<hex sha256(utf8 key)>`. */
58
+ export declare function blobShard(shardKey: string): Promise<string>;
59
+ /** Read `VGI_STORAGE_EXTERNALIZE_BYTES` (alias `VGI_CF_DO_EXTERNALIZE_BYTES`);
60
+ * {@link DEFAULT_EXTERNALIZE_BYTES} when unset.
61
+ * @throws Error if the value is not a positive integer. */
62
+ export declare function externalizeBytesFromEnv(env?: Env): number;
63
+ /** The vendor client from `VGI_BLOB_VENDOR_URL` and its token (falling back to
64
+ * `VGI_CF_DO_TOKEN`), or `null` when the URL is unset.
65
+ * @throws Error if the URL is set but no token is. */
66
+ export declare function blobClientFromEnv(env?: Env): VendorBlobClient | null;
67
+ /** Options for {@link wrapStorageFromEnv}. */
68
+ export interface WrapStorageOptions {
69
+ /** The backend's per-value cap, or undefined for none. A backend with a cap
70
+ * (the Cloudflare DO) is always wrapped. */
71
+ maxValueBytes?: number | undefined;
72
+ /** Environment source (default `process.env`; on Cloudflare Workers pass the
73
+ * Worker's `env`). */
74
+ env?: Env | undefined;
75
+ }
76
+ /**
77
+ * Wrap `base` in {@link ExternalizingStorage} when the environment asks for it.
78
+ *
79
+ * A backend with a per-value cap (`maxValueBytes`, i.e. the Cloudflare DO) is
80
+ * always wrapped, vendor or not, so its stored format is the same in every
81
+ * process. Any other backend is wrapped only with `VGI_STORAGE_EXTERNALIZE=1`,
82
+ * which then requires `VGI_BLOB_VENDOR_URL`. An already-wrapped backend is
83
+ * returned unchanged.
84
+ *
85
+ * @throws Error for `VGI_STORAGE_EXTERNALIZE=1` without a vendor, or a malformed variable.
86
+ */
87
+ export declare function wrapStorageFromEnv(base: FunctionStorage, options?: WrapStorageOptions): FunctionStorage;
88
+ /** Options for {@link ExternalizingStorage}. */
89
+ export interface ExternalizingStorageOptions {
90
+ /** The vendor client, or null to keep every value inline. */
91
+ blobClient: VendorBlobClient | null;
92
+ /** With a vendor, values of at least this many bytes are stored as blobs
93
+ * (default {@link DEFAULT_EXTERNALIZE_BYTES}). */
94
+ threshold?: number | undefined;
95
+ /** The backend's per-value cap. The envelope of an inline value must fit, so
96
+ * `threshold` may not exceed it; with no vendor, an over-cap value raises
97
+ * {@link StorageValueTooLargeError}. */
98
+ maxValueBytes?: number | undefined;
99
+ }
100
+ /** State one wrapper shares with its per-shard views. */
101
+ interface SharedState {
102
+ readonly blobs: VendorBlobClient | null;
103
+ readonly threshold: number;
104
+ readonly maxValueBytes: number | undefined;
105
+ readonly pending: Set<Promise<void>>;
106
+ }
107
+ /**
108
+ * A FunctionStorage that envelopes values and externalizes large ones to the
109
+ * blob vendor. Delegates every operation to the wrapped backend; see the module
110
+ * header for the envelope, scoping and clean-up.
111
+ */
112
+ export declare class ExternalizingStorage implements FunctionStorage {
113
+ private readonly _base;
114
+ private readonly _shared;
115
+ private readonly _shardKey;
116
+ /** @throws Error if `threshold` is not positive or exceeds `maxValueBytes`. */
117
+ constructor(base: FunctionStorage, options: ExternalizingStorageOptions);
118
+ /** @internal A per-shard view sharing the vendor client and clean-up. */
119
+ constructor(base: FunctionStorage, options: ExternalizingStorageOptions, shared: SharedState, shardKey: string);
120
+ /** The wrapped backend. */
121
+ get base(): FunctionStorage;
122
+ /** The vendor client, if any. */
123
+ get blobClient(): VendorBlobClient | null;
124
+ /** Values of at least this many bytes are externalized (with a vendor). */
125
+ get threshold(): number;
126
+ /** The shard this view routes to ("" = not bound to an ATTACH). */
127
+ get shardKey(): string;
128
+ /** A view routed to one attach shard (the wrapped backend's own view when it
129
+ * shards remotely), sharing the vendor client and clean-up. */
130
+ forShard(shardKey: string): ExternalizingStorage;
131
+ /** Wait for pending background blob clean-up, then close the backend. */
132
+ close(): Promise<void>;
133
+ /**
134
+ * Envelope each value, uploading large ones first. Each upload carries the
135
+ * idempotency key `<call id>.<index>`, so a vendor-level retry of the same
136
+ * logical write reuses the object.
137
+ */
138
+ encodeValues(values: readonly Uint8Array[], blobExecId: string): Promise<Uint8Array[]>;
139
+ /**
140
+ * Decode envelopes, fetching pointers in parallel (null passes through).
141
+ * @param refsOut When given, receives the blob references that were read.
142
+ * @throws StorageEnvelopeError for an invalid envelope or a pointer read with
143
+ * no vendor configured; StorageBlobError (or a subclass) when a pointer's
144
+ * blob is missing, fails its size or SHA-256 check, or cannot be fetched.
145
+ */
146
+ decodeValues(envelopes: ReadonlyArray<Uint8Array | null>, refsOut?: BlobRef[]): Promise<Array<Uint8Array | null>>;
147
+ private decodeAll;
148
+ private submitCleanup;
149
+ /** Wait for pending background blob clean-up (for tests and shutdown). */
150
+ flushBlobCleanup(): Promise<void>;
151
+ private deleteBlobs;
152
+ private deleteBlobScope;
153
+ workerPut(executionId: Uint8Array, worker: WorkerStateKey, state: Uint8Array): Promise<void>;
154
+ /** Drain and decode; the drained blobs are deleted in the background. */
155
+ workerCollect(executionId: Uint8Array): Promise<Uint8Array[]>;
156
+ workerScan(executionId: Uint8Array): Promise<Array<[number, Uint8Array]>>;
157
+ queuePush(executionId: Uint8Array, items: Uint8Array[]): Promise<number>;
158
+ /** Pop one item; its blob, if any, is deleted once fetched. */
159
+ queuePop(executionId: Uint8Array): Promise<Uint8Array | null>;
160
+ /** Clear the queue and delete its blob scope. */
161
+ queueClear(executionId: Uint8Array): Promise<number>;
162
+ stateGet(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array): Promise<Uint8Array | null>;
163
+ statePut(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, value: Uint8Array): Promise<void>;
164
+ stateGetMany(scopeId: Uint8Array, ns: Uint8Array, keys: Uint8Array[]): Promise<Array<Uint8Array | null>>;
165
+ statePutMany(scopeId: Uint8Array, ns: Uint8Array, items: Array<[Uint8Array, Uint8Array]>): Promise<void>;
166
+ /** Delete rows (their blobs stay until the scope is cleared). */
167
+ stateDelete(scopeId: Uint8Array, ns: Uint8Array, keys: Uint8Array[]): Promise<number>;
168
+ stateAppend(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, item: Uint8Array): Promise<number>;
169
+ stateLogScan(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, afterId?: number, limit?: number | null): Promise<Array<[number, Uint8Array]>>;
170
+ /** Clear the scope and delete its blob scope. */
171
+ executionClear(scopeId: Uint8Array): Promise<number>;
172
+ }
173
+ export {};
@@ -7,6 +7,13 @@ export type FetchLike = (input: string, init?: {
7
7
  body?: string;
8
8
  signal?: AbortSignal;
9
9
  }) => Promise<Response>;
10
+ /**
11
+ * The storage service's per-value cap (`MAX_VALUE_BYTES` in its src/index.ts).
12
+ * `resolveStorageFromEnv` / `setStorage` wrap this backend in
13
+ * `ExternalizingStorage` with this cap, which envelopes every value and moves
14
+ * large ones to the blob vendor.
15
+ */
16
+ export declare const MAX_VALUE_BYTES: number;
10
17
  /** The DO server's shard_key rule (vgi-cloudflare-durable-object-storage). */
11
18
  export declare const SHARD_KEY_RE: RegExp;
12
19
  /**
@@ -27,6 +34,10 @@ export interface CfDoRetryOptions {
27
34
  maxDelayMs?: number;
28
35
  }
29
36
  export declare class FunctionStorageCfDo implements FunctionStorage {
37
+ /** Marks this backend for `setStorage`, which always envelopes it. */
38
+ readonly storageKind = "cloudflare-do";
39
+ /** The service's per-value cap ({@link MAX_VALUE_BYTES}). */
40
+ readonly maxValueBytes: number;
30
41
  private readonly _baseUrl;
31
42
  private readonly _token;
32
43
  /** Per-attach routing key (att-<hex uuid>); "" until pinned via forShard. */
@@ -66,6 +77,7 @@ export declare class FunctionStorageCfDo implements FunctionStorage {
66
77
  statePut(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, value: Uint8Array): Promise<void>;
67
78
  stateGetMany(scopeId: Uint8Array, ns: Uint8Array, keys: Uint8Array[]): Promise<Array<Uint8Array | null>>;
68
79
  statePutMany(scopeId: Uint8Array, ns: Uint8Array, items: Array<[Uint8Array, Uint8Array]>): Promise<void>;
80
+ stateDelete(scopeId: Uint8Array, ns: Uint8Array, keys: Uint8Array[]): Promise<number>;
69
81
  stateAppend(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, item: Uint8Array): Promise<number>;
70
82
  stateLogScan(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, afterId?: number, limit?: number | null): Promise<Array<[number, Uint8Array]>>;
71
83
  executionClear(scopeId: Uint8Array): Promise<number>;
@@ -28,6 +28,10 @@ export interface FunctionStorage {
28
28
  /** Batched atomic upsert of `(key, value)` pairs. One round trip on a remote
29
29
  * backend; a no-op for an empty list. */
30
30
  statePutMany(scopeId: Uint8Array, ns: Uint8Array, items: Array<[Uint8Array, Uint8Array]>): Promise<void>;
31
+ /** Optional: delete the given keys of one namespace, returning how many rows
32
+ * went. Missing keys are ignored. Every built-in backend implements it;
33
+ * {@link BoundStorage.stateDelete} refuses on a backend that does not. */
34
+ stateDelete?(scopeId: Uint8Array, ns: Uint8Array, keys: Uint8Array[]): Promise<number>;
31
35
  stateAppend(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, item: Uint8Array): Promise<number>;
32
36
  stateLogScan(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, afterId?: number, limit?: number | null): Promise<Array<[number, Uint8Array]>>;
33
37
  /** Wipe all state + log rows for a scope across every namespace. */
@@ -73,6 +77,7 @@ export declare class FunctionStorageSqlite implements FunctionStorage {
73
77
  statePut(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, value: Uint8Array): Promise<void>;
74
78
  stateGetMany(scopeId: Uint8Array, ns: Uint8Array, keys: Uint8Array[]): Promise<Array<Uint8Array | null>>;
75
79
  statePutMany(scopeId: Uint8Array, ns: Uint8Array, items: Array<[Uint8Array, Uint8Array]>): Promise<void>;
80
+ stateDelete(scopeId: Uint8Array, ns: Uint8Array, keys: Uint8Array[]): Promise<number>;
76
81
  stateAppend(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, item: Uint8Array): Promise<number>;
77
82
  stateLogScan(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, afterId?: number, limit?: number | null): Promise<Array<[number, Uint8Array]>>;
78
83
  executionClear(scopeId: Uint8Array): Promise<number>;
@@ -130,6 +135,10 @@ export declare class BoundStorage {
130
135
  stateGetMany(ns: Uint8Array, keys: Uint8Array[]): Promise<Array<Uint8Array | null>>;
131
136
  /** Batched atomic upsert. One round trip remotely. */
132
137
  statePutMany(ns: Uint8Array, items: Array<[Uint8Array, Uint8Array]>): Promise<void>;
138
+ /** Delete keys of one namespace; their values' blobs (when externalized)
139
+ * stay until the execution is cleared.
140
+ * @throws Error if the backend does not implement `stateDelete`. */
141
+ stateDelete(ns: Uint8Array, keys: Uint8Array[]): Promise<number>;
133
142
  stateAppend(ns: Uint8Array, key: Uint8Array, item: Uint8Array): Promise<number>;
134
143
  stateLogScan(ns: Uint8Array, key: Uint8Array, afterId?: number, limit?: number | null): Promise<Array<[number, Uint8Array]>>;
135
144
  executionClear(): Promise<number>;
@@ -162,6 +171,11 @@ export declare function shardKeyOf(bindCall: {
162
171
  * (including `:memory:`).
163
172
  * - `cloudflare-do` — `FunctionStorageCfDo`. Requires `VGI_CF_DO_URL`;
164
173
  * optional `VGI_CF_DO_TOKEN` for bearer auth.
174
+ *
175
+ * The backend is wrapped in {@link ExternalizingStorage} (value envelope plus
176
+ * blob-vendor externalization, `./storage-blobs.ts`) always for
177
+ * `cloudflare-do`, and for any other backend with `VGI_STORAGE_EXTERNALIZE=1`;
178
+ * see `wrapStorageFromEnv`.
165
179
  */
166
180
  export declare function resolveStorageFromEnv(): FunctionStorage;
167
181
  /**
@@ -171,6 +185,14 @@ export declare function resolveStorageFromEnv(): FunctionStorage;
171
185
  * service-binding Fetcher (the binding lives on `env`, not `process.env`, and a
172
186
  * same-zone public-URL fetch is rejected with CF error 1042). Takes precedence
173
187
  * over `VGI_WORKER_SHARED_STORAGE`.
188
+ *
189
+ * A bare `FunctionStorageCfDo` is wrapped in {@link ExternalizingStorage}, as
190
+ * the env-selected one is, so every process writes the same enveloped format;
191
+ * the blob vendor comes from `VGI_BLOB_VENDOR_URL` in `process.env` when there
192
+ * is one. On Cloudflare Workers, where the vendor's URL and token are `env`
193
+ * bindings, wrap it yourself first --
194
+ * `setStorage(wrapStorageFromEnv(cfDo, { maxValueBytes: MAX_VALUE_BYTES, env }))`
195
+ * -- and it is used as given. Any other backend is used as given.
174
196
  */
175
197
  export declare function setStorage(impl: FunctionStorage): void;
176
198
  /** Default FunctionStorage instance. Backend is selected via env on first access. */
@@ -78,7 +78,12 @@ export interface TableFunctionConfig<TArgs = Record<string, any>, TState = null>
78
78
  argConstraints?: Record<string, ArgumentConstraints>;
79
79
  /** Names of args that accept variable number of arguments */
80
80
  varargs?: string[];
81
- /** Bind: return output schema. May be async — handlers `await` the result. */
81
+ /**
82
+ * Bind: return output schema. May be async — handlers `await` the result.
83
+ * To ask DuckDB for secrets, return `lookupSecretTypes` with optional
84
+ * `lookupScopes` / `lookupNames` at the same indexes (see `SecretLookupFields`);
85
+ * a scope or name with no type at its index is a bind error.
86
+ */
82
87
  onBind: (params: TableBindParams<TArgs>) => {
83
88
  outputSchema: VgiSchema;
84
89
  opaqueData?: Uint8Array;
@@ -355,9 +355,14 @@ export interface CopyToContext {
355
355
  format: string;
356
356
  file_path: string;
357
357
  }
358
+ export interface ArgumentsLocation {
359
+ ref: Uint8Array;
360
+ size: number;
361
+ sha256: string;
362
+ }
358
363
  export interface BindRequest {
359
364
  function_name: string;
360
- arguments: Uint8Array;
365
+ arguments?: /** @vgi-arguments */ Uint8Array | null;
361
366
  function_type: InvocationFunctionType;
362
367
  input_schema?: /** @arrow-schema */ Uint8Array | null;
363
368
  settings?: /** @record-batch */ Uint8Array | null;
@@ -371,6 +376,7 @@ export interface BindRequest {
371
376
  copy_to?: CopyToContext | null;
372
377
  schema_path?: string[] | null;
373
378
  argument_names?: (string | null)[] | null;
379
+ arguments_location?: ArgumentsLocation | null;
374
380
  }
375
381
  export interface BindResponse {
376
382
  output_schema: Uint8Array;
@@ -43,6 +43,16 @@ export declare const TableLayoutChangeSchema: import("../index.core.js").VgiSche
43
43
  export declare const OptionChangesSchema: import("../index.core.js").VgiSchema;
44
44
  export declare const OptionStateSchema: import("../index.core.js").VgiSchema;
45
45
  export declare const RequiredFilterPathsSchema: import("../index.core.js").VgiSchema;
46
+ export declare const CopyFromContextSchema: import("../index.core.js").VgiSchema;
47
+ export declare const CopyToContextSchema: import("../index.core.js").VgiSchema;
48
+ export declare const ArgumentsLocationSchema: import("../index.core.js").VgiSchema;
49
+ export declare const BindRequestSchema: import("../index.core.js").VgiSchema;
50
+ export declare const InitRequestSchema: import("../index.core.js").VgiSchema;
51
+ export declare const TableFunctionCardinalityRequestSchema: import("../index.core.js").VgiSchema;
52
+ export declare const TableFunctionStatisticsRequestSchema: import("../index.core.js").VgiSchema;
53
+ export declare const TableFunctionDynamicToStringRequestSchema: import("../index.core.js").VgiSchema;
54
+ export declare const TableFunctionPlanRequestSchema: import("../index.core.js").VgiSchema;
55
+ export declare const TableFunctionProjectionRequestSchema: import("../index.core.js").VgiSchema;
46
56
  export declare const ScanFunctionResultSchema: import("../index.core.js").VgiSchema;
47
57
  export declare const ScanBranchesResultSchema: import("../index.core.js").VgiSchema;
48
58
  export declare const ScanBranchSchema: import("../index.core.js").VgiSchema;
@@ -62,25 +72,16 @@ export declare const AggregateWindowBatchRequestSchema: import("../index.core.js
62
72
  export declare const AggregateWindowDestructorRequestSchema: import("../index.core.js").VgiSchema;
63
73
  export declare const AggregateWindowInitRequestSchema: import("../index.core.js").VgiSchema;
64
74
  export declare const AggregateWindowRequestSchema: import("../index.core.js").VgiSchema;
65
- export declare const BindRequestSchema: import("../index.core.js").VgiSchema;
66
75
  export declare const CatalogAttachRequestSchema: import("../index.core.js").VgiSchema;
67
76
  export declare const CatalogCreateRequestSchema: import("../index.core.js").VgiSchema;
68
77
  export declare const ClientCapabilitiesSchema: import("../index.core.js").VgiSchema;
69
- export declare const CopyFromContextSchema: import("../index.core.js").VgiSchema;
70
- export declare const CopyToContextSchema: import("../index.core.js").VgiSchema;
71
78
  export declare const GlobalInitResponseSchema: import("../index.core.js").VgiSchema;
72
79
  export declare const IndexCreateRequestSchema: import("../index.core.js").VgiSchema;
73
- export declare const InitRequestSchema: import("../index.core.js").VgiSchema;
74
80
  export declare const MacroCreateRequestSchema: import("../index.core.js").VgiSchema;
75
81
  export declare const TableCreateRequestSchema: import("../index.core.js").VgiSchema;
76
82
  export declare const TableBufferingCombineRequestSchema: import("../index.core.js").VgiSchema;
77
83
  export declare const TableBufferingDestructorRequestSchema: import("../index.core.js").VgiSchema;
78
84
  export declare const TableBufferingProcessRequestSchema: import("../index.core.js").VgiSchema;
79
- export declare const TableFunctionCardinalityRequestSchema: import("../index.core.js").VgiSchema;
80
- export declare const TableFunctionDynamicToStringRequestSchema: import("../index.core.js").VgiSchema;
81
- export declare const TableFunctionPlanRequestSchema: import("../index.core.js").VgiSchema;
82
- export declare const TableFunctionProjectionRequestSchema: import("../index.core.js").VgiSchema;
83
- export declare const TableFunctionStatisticsRequestSchema: import("../index.core.js").VgiSchema;
84
85
  export declare const AggregateBindResultSchema: import("../index.core.js").VgiSchema;
85
86
  export declare const AggregateCombineResultSchema: import("../index.core.js").VgiSchema;
86
87
  export declare const AggregateDestructorResultSchema: import("../index.core.js").VgiSchema;
@@ -1,5 +1,44 @@
1
- import type { CatalogAttachResult, CatalogCapabilities, CatalogContentsResponse, CatalogObjectRef, CatalogQueryPrepareRequest, CatalogQueryPrepareResult, ClientQueryCapabilities, ConstraintSnapshot, ConstraintsApplyRequest, DependencySnapshot, IndexDefinition, MacroOverload, MacroParameter, OptionDefinitions, OptionState, QueryCapabilities, QueryEvaluationContext, QueryObjectReference, SqlExpression, TableLayout } from "./vgi-client.js";
2
- export type { CatalogAttachResult, CatalogCapabilities, CatalogContentsResponse, CatalogObjectRef, CatalogQueryPrepareRequest, CatalogQueryPrepareResult, ClientQueryCapabilities, ConstraintSnapshot, ConstraintsApplyRequest, DependencySnapshot, IndexDefinition, MacroOverload, MacroParameter, OptionDefinitions, OptionState, QueryCapabilities, QueryEvaluationContext, QueryObjectReference, SqlExpression, TableLayout };
1
+ import type { ArgumentsLocation, BindRequest, CatalogAttachResult, CatalogCapabilities, CatalogContentsResponse, CatalogObjectRef, CatalogQueryPrepareRequest, CatalogQueryPrepareResult, ClientQueryCapabilities, ConstraintSnapshot, ConstraintsApplyRequest, CopyFromContext, CopyToContext, DependencySnapshot, IndexDefinition, MacroOverload, MacroParameter, OptionDefinitions, OptionState, QueryCapabilities, QueryEvaluationContext, QueryObjectReference, SqlExpression, TableLayout } from "./vgi-client.js";
2
+ export type { ArgumentsLocation, BindRequest, CatalogAttachResult, CatalogCapabilities, CatalogContentsResponse, CatalogObjectRef, CatalogQueryPrepareRequest, CatalogQueryPrepareResult, ClientQueryCapabilities, ConstraintSnapshot, ConstraintsApplyRequest, CopyFromContext, CopyToContext, DependencySnapshot, IndexDefinition, MacroOverload, MacroParameter, OptionDefinitions, OptionState, QueryCapabilities, QueryEvaluationContext, QueryObjectReference, SqlExpression, TableLayout };
3
+ /**
4
+ * The raw-preserving lazy wrapper for a nested record carried as binary
5
+ * (vgi docs/large-values-3.4.md §3.3). It holds the bytes exactly as received
6
+ * (a private copy), decodes them only when `get()` / `value` is first read,
7
+ * and the embedding record's encoder writes the held bytes verbatim, so a
8
+ * decoded-then-re-encoded request is byte-identical to what the peer sent.
9
+ *
10
+ * The decoded value is frozen, and is decoded from a private copy of the bytes,
11
+ * so nothing done to it can change the held bytes. To change a field, build a
12
+ * new record and wrap it with `Nested.of` (or the generated `nested<Record>`).
13
+ * Printing (`toJSON`, `toString`, Node's inspect) never decodes or re-encodes.
14
+ */
15
+ export declare class Nested<T> {
16
+ #private;
17
+ private constructor();
18
+ /** Wrap bytes received elsewhere (rule 7). The bytes are copied, not decoded. */
19
+ static fromBytes<T>(bytes: Uint8Array, decode: (bytes: Uint8Array) => T, path?: string): Nested<T>;
20
+ /** Serialize a typed record once and hold those bytes (rule 6). */
21
+ static of<T>(record: T, encode: (value: T) => Uint8Array, decode: (bytes: Uint8Array) => T, path?: string): Nested<T>;
22
+ /** The held bytes, exactly as received. Read-only by contract: do not mutate. */
23
+ get bytes(): Uint8Array;
24
+ get byteLength(): number;
25
+ /** The field path decode errors name, e.g. `InitRequest.bind_call`. */
26
+ get path(): string;
27
+ /**
28
+ * The decoded record, decoded on first access and cached (rule 2). A
29
+ * malformed or empty value throws here, naming the field path (rules 3, 9).
30
+ */
31
+ get(): Readonly<T>;
32
+ /** Same as `get()`. */
33
+ get value(): Readonly<T>;
34
+ /** Equality is over the held bytes (rule 8). */
35
+ equals(other: Nested<T> | null | undefined): boolean;
36
+ toJSON(): {
37
+ nested: string;
38
+ byteLength: number;
39
+ };
40
+ toString(): string;
41
+ }
3
42
  /** One raw, component-preserving field reference used by a transform. */
4
43
  export interface FieldPath {
5
44
  components: string[];
@@ -371,6 +410,209 @@ export type RequiredFilterPathsInit = Omit<RequiredFilterPaths, RequiredFilterPa
371
410
  export declare function buildRequiredFilterPaths(init: RequiredFilterPathsInit): RequiredFilterPaths;
372
411
  export declare const encodeRequiredFilterPaths: (v: RequiredFilterPaths) => Uint8Array;
373
412
  export declare const decodeRequiredFilterPaths: (b: Uint8Array) => RequiredFilterPaths;
413
+ /** `CopyFromContext` has no defaulted fields, so its init is the record itself. */
414
+ export type CopyFromContextInit = CopyFromContext;
415
+ /** Build a complete `CopyFromContext`, filling the protocol defaults, in wire order. */
416
+ export declare function buildCopyFromContext(init: CopyFromContextInit): CopyFromContext;
417
+ export declare const encodeCopyFromContext: (v: CopyFromContext) => Uint8Array;
418
+ export declare const decodeCopyFromContext: (b: Uint8Array) => CopyFromContext;
419
+ /** `CopyToContext` has no defaulted fields, so its init is the record itself. */
420
+ export type CopyToContextInit = CopyToContext;
421
+ /** Build a complete `CopyToContext`, filling the protocol defaults, in wire order. */
422
+ export declare function buildCopyToContext(init: CopyToContextInit): CopyToContext;
423
+ export declare const encodeCopyToContext: (v: CopyToContext) => Uint8Array;
424
+ export declare const decodeCopyToContext: (b: Uint8Array) => CopyToContext;
425
+ /** `ArgumentsLocation` has no defaulted fields, so its init is the record itself. */
426
+ export type ArgumentsLocationInit = ArgumentsLocation;
427
+ /** Build a complete `ArgumentsLocation`, filling the protocol defaults, in wire order. */
428
+ export declare function buildArgumentsLocation(init: ArgumentsLocationInit): ArgumentsLocation;
429
+ export declare const encodeArgumentsLocation: (v: ArgumentsLocation) => Uint8Array;
430
+ export declare const decodeArgumentsLocation: (b: Uint8Array) => ArgumentsLocation;
431
+ /** Fields of `BindRequest` that have a protocol default. */
432
+ export type BindRequestDefaultedField = "input_schema" | "settings" | "secrets" | "attach_opaque_data" | "transaction_opaque_data" | "resolved_secrets_provided" | "at_unit" | "at_value" | "copy_from" | "copy_to" | "schema_path" | "argument_names" | "arguments_location";
433
+ /** `BindRequest` with every field that has a protocol default optional. */
434
+ export type BindRequestInit = Omit<BindRequest, BindRequestDefaultedField> & Partial<Pick<BindRequest, BindRequestDefaultedField>>;
435
+ /** Build a complete `BindRequest`, filling the protocol defaults, in wire order. */
436
+ export declare function buildBindRequest(init: BindRequestInit): BindRequest;
437
+ export declare const encodeBindRequest: (v: BindRequest) => Uint8Array;
438
+ export declare const decodeBindRequest: (b: Uint8Array) => BindRequest;
439
+ /**
440
+ * Wrap a `BindRequest` for a field that carries it as a nested record: a typed
441
+ * record is serialized once (spec §3.3 rule 6); bytes are held as given (rule 7).
442
+ */
443
+ export declare function nestedBindRequest(source: BindRequest | Uint8Array, path?: string): Nested<BindRequest>;
444
+ /** Consolidated init request for all function types. For secondary init requests, `execution_id` and `init_opaque_data` are set; use :attr:`is_secondary` to distinguish. */
445
+ export interface InitRequest {
446
+ /** The originating `BindRequest` (function name, arguments, schemas). */
447
+ bind_call: Nested<BindRequest>;
448
+ /** Serialized Arrow schema of the rows the function produces. */
449
+ output_schema: Uint8Array;
450
+ /** Opaque per-bind state the worker returned from bind(), threaded back into later calls. Wire-facing bytes the framework produced from the typed `BindResult.opaque_data`; consumers reconstruct via `MyConcreteDataclass.deserialize_from_bytes(raw)`. See `BindResponse.opaque_data` in vgi/invocation.py for the full contract rationale. */
451
+ bind_opaque_data?: Uint8Array | null;
452
+ /** Column indices DuckDB wants projected from the function's output; `None` for scalar functions or when no projection pushdown. */
453
+ projection_ids?: number[] | null;
454
+ /** Serialized filter predicates DuckDB pushed down to the scan; `None` when no filters apply. */
455
+ pushdown_filters?: Uint8Array | null;
456
+ /** Serialized join-key batches pushed down for join filtering; `None` when not applicable. */
457
+ join_keys?: Uint8Array[] | null;
458
+ /** Split tokens to redeem in this init, or None for an ordinary whole-scan init. Usually one; a client that bin-packs sends a whole group and expects them concatenated in the order given. */
459
+ split_tokens?: Uint8Array[] | null;
460
+ /** Plain fetch limit, or None. NOT `order_by_limit`, which is a field of the Top-N hint. DuckDB cannot supply this; DataFusion can. */
461
+ row_limit?: number | null;
462
+ /** For table-in-out functions, which init phase (INPUT / FINALIZE / buffering) this request opens; `None` for other function types. */
463
+ phase?: string | null;
464
+ /** For a buffered-table finalize stream, which state_id this stream serves. Required when `phase=TABLE_BUFFERING_FINALIZE`, `None` otherwise. Opaque bytes — the worker chose the encoding when its combine() returned the finalize_state_ids list. */
465
+ finalize_state_id?: Uint8Array | null;
466
+ /** Identifier for one query execution, stable across the coordinator and any secondary workers; keys worker-owned state. `None` for global init, set for secondary init. */
467
+ execution_id?: Uint8Array | null;
468
+ /** Opaque per-init state threaded back into the stream; same producer/wire/consumer contract as `bind_opaque_data`. */
469
+ init_opaque_data?: Uint8Array | null;
470
+ /** Stable, client-owned identity of the streaming table-in-out substream this request opens (per DuckDB PipelineExecutor). Rides every InitRequest a substream's worker builds — INPUT and FINALIZE — so a worker can locate that substream's accumulated state even when an HTTP load balancer routes its init / process / finalize to different backends. `None` for non-substream function types. */
471
+ substream_id?: Uint8Array | null;
472
+ /** Column name of the order-pushdown hint from DuckDB's RowGroupPruner optimizer; `None` when no hint. */
473
+ order_by_column_name?: string | null;
474
+ /** Sort direction of the order-pushdown hint; `None` when no hint. */
475
+ order_by_direction?: string | null;
476
+ /** Null-ordering of the order-pushdown hint; `None` when no hint. */
477
+ order_by_null_order?: string | null;
478
+ /** Row limit of the order-pushdown hint; `None` when no hint. */
479
+ order_by_limit?: number | null;
480
+ /** Sample percentage of the TABLESAMPLE pushdown hint from DuckDB's SamplingPushdown optimizer; `None` when no hint. */
481
+ tablesample_percentage?: number | null;
482
+ /** Sample seed of the TABLESAMPLE pushdown hint; `None` when no hint. */
483
+ tablesample_seed?: number | null;
484
+ }
485
+ /** Fields of `InitRequest` that have a protocol default. */
486
+ export type InitRequestDefaultedField = "bind_opaque_data" | "projection_ids" | "pushdown_filters" | "join_keys" | "split_tokens" | "row_limit" | "phase" | "finalize_state_id" | "execution_id" | "init_opaque_data" | "substream_id" | "order_by_column_name" | "order_by_direction" | "order_by_null_order" | "order_by_limit" | "tablesample_percentage" | "tablesample_seed";
487
+ /** `InitRequest` with every field that has a protocol default optional. */
488
+ export type InitRequestInit = Omit<InitRequest, InitRequestDefaultedField> & Partial<Pick<InitRequest, InitRequestDefaultedField>>;
489
+ /** Build a complete `InitRequest`, filling the protocol defaults, in wire order. */
490
+ export declare function buildInitRequest(init: InitRequestInit): InitRequest;
491
+ /** Encode a `InitRequest`; each nested record is written as its wrapper's held bytes, never re-serialized. */
492
+ export declare function encodeInitRequest(v: InitRequest): Uint8Array;
493
+ /** Decode a `InitRequest`; each nested record is held as received and decoded only when accessed. */
494
+ export declare function decodeInitRequest(b: Uint8Array): InitRequest;
495
+ /** Consolidated request for table function cardinality. */
496
+ export interface TableFunctionCardinalityRequest {
497
+ /** The originating `BindRequest` (function name, arguments, schemas). */
498
+ bind_call: Nested<BindRequest>;
499
+ /** Opaque per-bind state the worker returned from bind(), threaded back into later calls (same contract as `InitRequest.bind_opaque_data`). */
500
+ bind_opaque_data?: Uint8Array | null;
501
+ }
502
+ /** Fields of `TableFunctionCardinalityRequest` that have a protocol default. */
503
+ export type TableFunctionCardinalityRequestDefaultedField = "bind_opaque_data";
504
+ /** `TableFunctionCardinalityRequest` with every field that has a protocol default optional. */
505
+ export type TableFunctionCardinalityRequestInit = Omit<TableFunctionCardinalityRequest, TableFunctionCardinalityRequestDefaultedField> & Partial<Pick<TableFunctionCardinalityRequest, TableFunctionCardinalityRequestDefaultedField>>;
506
+ /** Build a complete `TableFunctionCardinalityRequest`, filling the protocol defaults, in wire order. */
507
+ export declare function buildTableFunctionCardinalityRequest(init: TableFunctionCardinalityRequestInit): TableFunctionCardinalityRequest;
508
+ /** Encode a `TableFunctionCardinalityRequest`; each nested record is written as its wrapper's held bytes, never re-serialized. */
509
+ export declare function encodeTableFunctionCardinalityRequest(v: TableFunctionCardinalityRequest): Uint8Array;
510
+ /** Decode a `TableFunctionCardinalityRequest`; each nested record is held as received and decoded only when accessed. */
511
+ export declare function decodeTableFunctionCardinalityRequest(b: Uint8Array): TableFunctionCardinalityRequest;
512
+ /** Consolidated request for table function per-column statistics. Mirrors `TableFunctionCardinalityRequest`: the worker receives a full copy of the original `BindRequest` (including parsed `Arguments`), so it can derive per-column stats from the user-supplied args. */
513
+ export interface TableFunctionStatisticsRequest {
514
+ /** The originating `BindRequest` (function name, arguments, schemas). */
515
+ bind_call: Nested<BindRequest>;
516
+ /** Opaque per-bind state the worker returned from bind(), threaded back into later calls (same contract as `InitRequest.bind_opaque_data`). */
517
+ bind_opaque_data?: Uint8Array | null;
518
+ }
519
+ /** Fields of `TableFunctionStatisticsRequest` that have a protocol default. */
520
+ export type TableFunctionStatisticsRequestDefaultedField = "bind_opaque_data";
521
+ /** `TableFunctionStatisticsRequest` with every field that has a protocol default optional. */
522
+ export type TableFunctionStatisticsRequestInit = Omit<TableFunctionStatisticsRequest, TableFunctionStatisticsRequestDefaultedField> & Partial<Pick<TableFunctionStatisticsRequest, TableFunctionStatisticsRequestDefaultedField>>;
523
+ /** Build a complete `TableFunctionStatisticsRequest`, filling the protocol defaults, in wire order. */
524
+ export declare function buildTableFunctionStatisticsRequest(init: TableFunctionStatisticsRequestInit): TableFunctionStatisticsRequest;
525
+ /** Encode a `TableFunctionStatisticsRequest`; each nested record is written as its wrapper's held bytes, never re-serialized. */
526
+ export declare function encodeTableFunctionStatisticsRequest(v: TableFunctionStatisticsRequest): Uint8Array;
527
+ /** Decode a `TableFunctionStatisticsRequest`; each nested record is held as received and decoded only when accessed. */
528
+ export declare function decodeTableFunctionStatisticsRequest(b: Uint8Array): TableFunctionStatisticsRequest;
529
+ /** Post-execution profile-info request, fired once per scan thread. Carries `global_execution_id` so the function class can retrieve whatever diagnostics it persisted during `process()` (shared storage, external service, in-memory class state for single-worker setups, etc.). VGI does not serialize per-thread `_user_state` across the boundary — the user owns persistence. */
530
+ export interface TableFunctionDynamicToStringRequest {
531
+ /** The originating `BindRequest` (function name, arguments, schemas). */
532
+ bind_call: Nested<BindRequest>;
533
+ /** Opaque per-bind state the worker returned from bind(), threaded back into later calls (same contract as `InitRequest.bind_opaque_data`). */
534
+ bind_opaque_data?: Uint8Array | null;
535
+ /** Query-wide execution id under which the function persisted the diagnostics this RPC retrieves. */
536
+ global_execution_id: Uint8Array;
537
+ }
538
+ /** Fields of `TableFunctionDynamicToStringRequest` that have a protocol default. */
539
+ export type TableFunctionDynamicToStringRequestDefaultedField = "bind_opaque_data";
540
+ /** `TableFunctionDynamicToStringRequest` with every field that has a protocol default optional. */
541
+ export type TableFunctionDynamicToStringRequestInit = Omit<TableFunctionDynamicToStringRequest, TableFunctionDynamicToStringRequestDefaultedField> & Partial<Pick<TableFunctionDynamicToStringRequest, TableFunctionDynamicToStringRequestDefaultedField>>;
542
+ /** Build a complete `TableFunctionDynamicToStringRequest`, filling the protocol defaults, in wire order. */
543
+ export declare function buildTableFunctionDynamicToStringRequest(init: TableFunctionDynamicToStringRequestInit): TableFunctionDynamicToStringRequest;
544
+ /** Encode a `TableFunctionDynamicToStringRequest`; each nested record is written as its wrapper's held bytes, never re-serialized. */
545
+ export declare function encodeTableFunctionDynamicToStringRequest(v: TableFunctionDynamicToStringRequest): Uint8Array;
546
+ /** Decode a `TableFunctionDynamicToStringRequest`; each nested record is held as received and decoded only when accessed. */
547
+ export declare function decodeTableFunctionDynamicToStringRequest(b: Uint8Array): TableFunctionDynamicToStringRequest;
548
+ /** Request for the scan-planning phase that precedes per-split `init()`. `plan()` runs once with the pushdown filters and returns named splits; each split is then redeemed by `init()` from any process or host. This is what makes the scan sound in a distributed engine, where a retried task must be able to re-request exactly the work it was given. */
549
+ export interface TableFunctionPlanRequest {
550
+ /** The originating `BindRequest`. */
551
+ bind_call: Nested<BindRequest>;
552
+ /** Opaque per-bind state the worker returned from bind(). */
553
+ bind_opaque_data?: Uint8Array | null;
554
+ /** Column indices the client wants projected. */
555
+ projection_ids?: number[] | null;
556
+ /** Serialized filter predicates. */
557
+ pushdown_filters?: Uint8Array | null;
558
+ /** Serialized join-key batches pushed down for join filtering. */
559
+ join_keys?: Uint8Array[] | null;
560
+ /** Plain fetch limit. NOT `order_by_limit` (which is a field of the Top-N hint). DuckDB cannot supply this — `TableFunctionInitInput` has no limit field — so it is always `None` from DuckDB; DataFusion supplies it from `TableProvider::scan(limit)`. */
561
+ row_limit?: number | null;
562
+ /** Requested split size. The primary sizing lever: a worker should emit splits of comparable cost, because the client cannot see per-split cost and will claim them as interchangeable units. */
563
+ target_split_bytes?: number | null;
564
+ /** Parallelism floor — a small but expensive table still needs enough splits to occupy the client's readers. */
565
+ min_splits?: number | null;
566
+ /** Pagination cap (Trino `getNextBatch(maxSize)`), NOT a sizing hint. */
567
+ max_splits_per_response?: number | null;
568
+ /** Resume point in the *enumeration of splits*. Distinct from `start_position`, which names a place in the *data*. */
569
+ cursor?: Uint8Array | null;
570
+ /** Conjunctive narrowing on a continuation. Narrows future splits only; splits already emitted under a looser filter stay valid. */
571
+ refined_filters?: Uint8Array | null;
572
+ /** False means more refinement may arrive, so the worker may hold back splits; True says stop waiting. */
573
+ filters_complete: boolean;
574
+ /** Exclusive lower bound in the data; `None` = from the start. */
575
+ start_position?: Uint8Array | null;
576
+ /** Inclusive upper bound; `None` = "as of now", and the worker reports the frontier it resolved in `PlanResponse.end_position`. */
577
+ end_position?: Uint8Array | null;
578
+ /** Column of the order-pushdown hint. */
579
+ order_by_column_name?: string | null;
580
+ /** Direction of the order-pushdown hint. */
581
+ order_by_direction?: string | null;
582
+ /** Null ordering of the order-pushdown hint. */
583
+ order_by_null_order?: string | null;
584
+ /** Row limit of the Top-N order-pushdown hint. */
585
+ order_by_limit?: number | null;
586
+ /** TABLESAMPLE percentage hint. */
587
+ tablesample_percentage?: number | null;
588
+ /** TABLESAMPLE seed hint. */
589
+ tablesample_seed?: number | null;
590
+ }
591
+ /** Fields of `TableFunctionPlanRequest` that have a protocol default. */
592
+ export type TableFunctionPlanRequestDefaultedField = "bind_opaque_data" | "projection_ids" | "pushdown_filters" | "join_keys" | "row_limit" | "target_split_bytes" | "min_splits" | "max_splits_per_response" | "cursor" | "refined_filters" | "filters_complete" | "start_position" | "end_position" | "order_by_column_name" | "order_by_direction" | "order_by_null_order" | "order_by_limit" | "tablesample_percentage" | "tablesample_seed";
593
+ /** `TableFunctionPlanRequest` with every field that has a protocol default optional. */
594
+ export type TableFunctionPlanRequestInit = Omit<TableFunctionPlanRequest, TableFunctionPlanRequestDefaultedField> & Partial<Pick<TableFunctionPlanRequest, TableFunctionPlanRequestDefaultedField>>;
595
+ /** Build a complete `TableFunctionPlanRequest`, filling the protocol defaults, in wire order. */
596
+ export declare function buildTableFunctionPlanRequest(init: TableFunctionPlanRequestInit): TableFunctionPlanRequest;
597
+ /** Encode a `TableFunctionPlanRequest`; each nested record is written as its wrapper's held bytes, never re-serialized. */
598
+ export declare function encodeTableFunctionPlanRequest(v: TableFunctionPlanRequest): Uint8Array;
599
+ /** Decode a `TableFunctionPlanRequest`; each nested record is held as received and decoded only when accessed. */
600
+ export declare function decodeTableFunctionPlanRequest(b: Uint8Array): TableFunctionPlanRequest;
601
+ /** Propose pure scalar outputs after bind, before modifying an execution plan. Expressions address the complete original worker output schema. Their result fields are parallel by index; accepted fields append to that schema. Planning allocates no execution resources and cannot consume rows or produce effects. */
602
+ export interface TableFunctionProjectionRequest {
603
+ bind_call: Nested<BindRequest>;
604
+ bind_result: Uint8Array;
605
+ expressions: Uint8Array[];
606
+ result_schema: Uint8Array;
607
+ }
608
+ /** `TableFunctionProjectionRequest` has no defaulted fields, so its init is the record itself. */
609
+ export type TableFunctionProjectionRequestInit = TableFunctionProjectionRequest;
610
+ /** Build a complete `TableFunctionProjectionRequest`, filling the protocol defaults, in wire order. */
611
+ export declare function buildTableFunctionProjectionRequest(init: TableFunctionProjectionRequestInit): TableFunctionProjectionRequest;
612
+ /** Encode a `TableFunctionProjectionRequest`; each nested record is written as its wrapper's held bytes, never re-serialized. */
613
+ export declare function encodeTableFunctionProjectionRequest(v: TableFunctionProjectionRequest): Uint8Array;
614
+ /** Decode a `TableFunctionProjectionRequest`; each nested record is held as received and decoded only when accessed. */
615
+ export declare function decodeTableFunctionProjectionRequest(b: Uint8Array): TableFunctionProjectionRequest;
374
616
  /** Fields of `CatalogAttachResult` that have a protocol default. */
375
617
  export type CatalogAttachResultDefaultedField = "attach_opaque_data_required" | "default_schema" | "settings" | "secret_types" | "attach_catalogs" | "comment" | "tags" | "supports_column_statistics" | "global_functions" | "global_function_prefix" | "supports_catalog_contents" | "catalog_capabilities" | "selected_capabilities" | "query_pushdown";
376
618
  /** `CatalogAttachResult` with every field that has a protocol default optional. */
@@ -3,7 +3,7 @@ import { type VgiSchema } from "../arrow/index.js";
3
3
  /** The protocol's wire name: the `vgi_rpc.protocol` routing key and the HTTP path segment. */
4
4
  export declare const VGI_PROTOCOL_NAME = "vgi.v3";
5
5
  /** The protocol's semver, stamped on every request by a client of this protocol. */
6
- export declare const VGI_PROTOCOL_VERSION = "3.3.0";
6
+ export declare const VGI_PROTOCOL_VERSION = "3.4.0";
7
7
  /** What a unary handler returns: the result row, now or later. */
8
8
  export type VgiReply<T> = T | ExternalRef | Promise<T | ExternalRef>;
9
9
  /** The result of a unary method with no `result` column. */