@query-farm/vgi-rpc 0.7.0 → 0.7.2

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 (66) hide show
  1. package/dist/access-log.d.ts +5 -0
  2. package/dist/access-log.d.ts.map +1 -1
  3. package/dist/auth.d.ts +5 -0
  4. package/dist/auth.d.ts.map +1 -1
  5. package/dist/client/connect.d.ts +10 -0
  6. package/dist/client/connect.d.ts.map +1 -1
  7. package/dist/client/introspect.d.ts +14 -0
  8. package/dist/client/introspect.d.ts.map +1 -1
  9. package/dist/client/oauth.d.ts +9 -0
  10. package/dist/client/oauth.d.ts.map +1 -1
  11. package/dist/client/pipe.d.ts +24 -0
  12. package/dist/client/pipe.d.ts.map +1 -1
  13. package/dist/client/stream.d.ts +8 -0
  14. package/dist/client/stream.d.ts.map +1 -1
  15. package/dist/client/types.d.ts +23 -0
  16. package/dist/client/types.d.ts.map +1 -1
  17. package/dist/constants.d.ts +15 -1
  18. package/dist/constants.d.ts.map +1 -1
  19. package/dist/errors.d.ts +20 -3
  20. package/dist/errors.d.ts.map +1 -1
  21. package/dist/external.d.ts +2 -0
  22. package/dist/external.d.ts.map +1 -1
  23. package/dist/http/auth.d.ts +13 -0
  24. package/dist/http/auth.d.ts.map +1 -1
  25. package/dist/http/common.d.ts +1 -0
  26. package/dist/http/common.d.ts.map +1 -1
  27. package/dist/http/jwt.d.ts +1 -0
  28. package/dist/http/jwt.d.ts.map +1 -1
  29. package/dist/http/mtls.d.ts +7 -0
  30. package/dist/http/mtls.d.ts.map +1 -1
  31. package/dist/http/token.d.ts +5 -0
  32. package/dist/http/token.d.ts.map +1 -1
  33. package/dist/http/types.d.ts +2 -0
  34. package/dist/http/types.d.ts.map +1 -1
  35. package/dist/index.js +6993 -38
  36. package/dist/index.js.map +50 -12
  37. package/dist/launcher/serve-unix.d.ts +1 -0
  38. package/dist/launcher/serve-unix.d.ts.map +1 -1
  39. package/dist/launcher/state.d.ts +12 -0
  40. package/dist/launcher/state.d.ts.map +1 -1
  41. package/dist/protocol.d.ts +3 -0
  42. package/dist/protocol.d.ts.map +1 -1
  43. package/dist/types.d.ts +54 -0
  44. package/dist/types.d.ts.map +1 -1
  45. package/package.json +12 -12
  46. package/src/access-log.ts +5 -0
  47. package/src/auth.ts +5 -0
  48. package/src/client/connect.ts +10 -0
  49. package/src/client/introspect.ts +14 -0
  50. package/src/client/oauth.ts +9 -0
  51. package/src/client/pipe.ts +24 -0
  52. package/src/client/stream.ts +8 -0
  53. package/src/client/types.ts +23 -0
  54. package/src/constants.ts +16 -1
  55. package/src/errors.ts +13 -2
  56. package/src/external.ts +6 -1
  57. package/src/http/auth.ts +13 -0
  58. package/src/http/common.ts +1 -0
  59. package/src/http/jwt.ts +1 -0
  60. package/src/http/mtls.ts +7 -0
  61. package/src/http/token.ts +5 -0
  62. package/src/http/types.ts +2 -0
  63. package/src/launcher/serve-unix.ts +1 -0
  64. package/src/launcher/state.ts +12 -0
  65. package/src/protocol.ts +3 -0
  66. package/src/types.ts +54 -0
@@ -37,6 +37,7 @@ export interface ServeUnixOptions {
37
37
  }
38
38
  /** Handle returned by {@link serveUnix} for callers that want to stop the server. */
39
39
  export interface ServeUnixHandle {
40
+ /** Absolute path of the bound AF_UNIX socket the server is listening on. */
40
41
  readonly socketPath: string;
41
42
  /** Shut down the listener and unlink the socket file. */
42
43
  stop(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"serve-unix.d.ts","sourceRoot":"","sources":["../../src/launcher/serve-unix.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAEL,KAAK,YAAY,EAGjB,KAAK,cAAc,EAEpB,MAAM,aAAa,CAAC;AAQrB,2CAA2C;AAC3C,MAAM,WAAW,gBAAgB;IAC/B,oEAAoE;IACpE,QAAQ,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interface SocketPaths {
4
+ /** Advisory lockfile path (`<hash>.lock`) guarding launch + liveness. */
4
5
  lockPath: string;
6
+ /** AF_UNIX socket path (`<hash>.sock`) the worker binds. */
5
7
  sockPath: string;
8
+ /** Launch-metadata JSON path (`<hash>.meta`) read by `--status`. */
6
9
  metaPath: string;
7
10
  }
11
+ /** Derive the lock/sock/meta path triple for a worker `hashId` under `stateDir`. */
8
12
  export declare function socketPaths(stateDir: string, hashId: string): SocketPaths;
9
13
  /**
10
14
  * Resolve the per-user state directory used for lockfiles + sockets.
@@ -21,14 +25,22 @@ export declare function socketPaths(stateDir: string, hashId: string): SocketPat
21
25
  export declare function defaultStateDir(): string;
22
26
  /** Best-effort write of human-readable launch metadata. Used by `--status`. */
23
27
  export declare function writeMeta(metaPath: string, workerArgv: readonly string[], cwd: string, sockPath: string): void;
28
+ /** One row of `--status` output describing a launched worker tuple. */
24
29
  export interface StatusRow {
30
+ /** Canonical hash identifying the worker tuple (the `<hash>` filename stem). */
25
31
  hashId: string;
32
+ /** Worker argv recorded at launch, or `[]` when the meta file is missing. */
26
33
  cmd: string[];
34
+ /** Working directory recorded at launch, or `""` when unknown. */
27
35
  cwd: string;
36
+ /** AF_UNIX socket path the worker binds. */
28
37
  socket: string;
38
+ /** Unix epoch seconds the worker was launched, or `null` when unknown. */
29
39
  startedAt: number | null;
40
+ /** Whether a probe connection to {@link StatusRow.socket} currently succeeds. */
30
41
  alive: boolean;
31
42
  }
43
+ /** Outcome of a {@link gcStateDir} sweep. */
32
44
  export interface GcResult {
33
45
  /** Hash IDs of stale entries that were removed. */
34
46
  cleaned: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/launcher/state.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qFAAqF;AACrF,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IAC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SAAS,SAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAqBtF;AAgBD,gFAAgF;AAChF,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAwBvE;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,EAC9D,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACjD,OAAO,CAAC,QAAQ,CAAC,CA8CnB;AAED;0BAC0B;AAC1B,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -5,6 +5,7 @@ import { type ExchangeFn, type ExchangeInit, type HeaderInit, type MethodDefinit
5
5
  * Register unary, producer, and exchange methods, then pass to `VgiRpcServer`.
6
6
  */
7
7
  export declare class Protocol {
8
+ /** Service / protocol name, exposed to clients via introspection. */
8
9
  readonly name: string;
9
10
  /**
10
11
  * Application protocol surface version. When non-empty, the server enforces
@@ -71,6 +72,8 @@ export declare class Protocol {
71
72
  defaults?: Record<string, any>;
72
73
  paramTypes?: Record<string, string>;
73
74
  }): this;
75
+ /** Snapshot of the registered methods, keyed by method name. Returns a copy,
76
+ * so mutating it does not affect the protocol. */
74
77
  getMethods(): Map<string, MethodDefinition>;
75
78
  }
76
79
  //# sourceMappingURL=protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmB,KAAK,UAAU,EAAY,MAAM,aAAa,CAAC;AACzE,OAAO,EACL,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,gBAAgB,EAErB,KAAK,UAAU,EACf,KAAK,UAAU,E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W,EAAE,UAAU,CAAC;QACxB,YAAY,EAAE,UAAU,CAAC;QACzB,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;QACtB,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;QACxB,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;QACzB,YAAY,CAAC,EAAE,UAAU,CAAC;QAC1B,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC/B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACrC,GACA,IAAI;IAqBP;uDACmD;IACnD,UAAU,IAAI,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC;CAG5C"}
package/dist/types.d.ts CHANGED
@@ -1,7 +1,13 @@
1
1
  import { type VgiBatch, type VgiSchema } from "./arrow/index.js";
2
2
  import { AuthContext } from "./auth.js";
3
+ /**
4
+ * Whether an RPC method is request/response or streaming. Mirrors Python's
5
+ * `MethodType` and is carried in the `__describe__` payload.
6
+ */
3
7
  export declare enum MethodType {
8
+ /** Single request batch in, single result batch out. */
4
9
  UNARY = "unary",
10
+ /** Streamed batches — either a producer or an exchange stream. */
5
11
  STREAM = "stream"
6
12
  }
7
13
  /**
@@ -19,8 +25,11 @@ export declare enum MethodType {
19
25
  * - `UNIX` — AF_UNIX socket handler (the launcher path).
20
26
  */
21
27
  export declare enum TransportKind {
28
+ /** Stdio worker — the standalone {@link VgiRpcServer} loop. */
22
29
  PIPE = "pipe",
30
+ /** Fetch-style HTTP handler (`createHttpHandler`). */
23
31
  HTTP = "http",
32
+ /** AF_UNIX socket handler (the launcher path). */
24
33
  UNIX = "unix"
25
34
  }
26
35
  /**
@@ -38,6 +47,9 @@ export declare enum TransportKind {
38
47
  export type ServeStartHook = (kind: TransportKind) => void | Promise<void>;
39
48
  /** Logging interface available to handlers. */
40
49
  export interface LogContext {
50
+ /** Emit a client-directed log message (sent as a zero-row log batch on the
51
+ * wire). `level` is a severity label such as `"info"`, `"warning"`, or
52
+ * `"error"`; `extra` carries optional structured string key/value pairs. */
41
53
  clientLog(level: string, message: string, extra?: Record<string, string>): void;
42
54
  }
43
55
  /**
@@ -78,6 +90,8 @@ export interface StickyContext {
78
90
  }
79
91
  /** Extended context with authentication info, available to handlers. */
80
92
  export interface CallContext extends LogContext {
93
+ /** Authenticated principal for this call; {@link AuthContext.anonymous} when
94
+ * the request was not authenticated. */
81
95
  readonly auth: AuthContext;
82
96
  /** Coarse identifier of the bound transport, or `undefined` until the
83
97
  * server begins serving (the value is committed by the lifecycle hook
@@ -157,23 +171,47 @@ export type HeaderInit = (params: Record<string, any>, state: any, ctx: LogConte
157
171
  * objects a chance to release resources. Errors are logged and swallowed.
158
172
  */
159
173
  export type OnCancelFn<S = any> = (state: S) => Promise<void> | void;
174
+ /**
175
+ * In-memory definition of one registered RPC method, produced by the
176
+ * {@link Protocol} builder and consumed by the dispatch layer. Which optional
177
+ * fields are populated depends on the method {@link type}: `handler` for unary
178
+ * methods, `producerInit`/`producerFn` for producer streams, and
179
+ * `exchangeInit`/`exchangeFn` for exchange streams.
180
+ */
160
181
  export interface MethodDefinition {
182
+ /** Method name as registered on the protocol. */
161
183
  name: string;
184
+ /** Whether the method is unary or streaming. */
162
185
  type: MethodType;
186
+ /** Schema of the request parameters batch. */
163
187
  paramsSchema: VgiSchema;
188
+ /** Schema of the unary result batch (unused for streams). */
164
189
  resultSchema: VgiSchema;
190
+ /** Schema of streamed output batches (producer and exchange streams). */
165
191
  outputSchema?: VgiSchema;
192
+ /** Schema of streamed input batches (exchange streams only). */
166
193
  inputSchema?: VgiSchema;
194
+ /** Implementation for unary methods. */
167
195
  handler?: UnaryHandler;
196
+ /** Builds the initial state object for a producer stream. */
168
197
  producerInit?: ProducerInit;
198
+ /** Produces output batches for a producer stream. */
169
199
  producerFn?: ProducerFn;
200
+ /** Builds the initial state object for an exchange stream. */
170
201
  exchangeInit?: ExchangeInit;
202
+ /** Handles each input batch of an exchange stream. */
171
203
  exchangeFn?: ExchangeFn;
204
+ /** Schema of the optional per-stream header batch. */
172
205
  headerSchema?: VgiSchema;
206
+ /** Builds the optional header batch emitted before the first output batch. */
173
207
  headerInit?: HeaderInit;
208
+ /** Optional hook run when the client cancels a stream. */
174
209
  onCancel?: OnCancelFn;
210
+ /** Human-readable method documentation, surfaced via introspection. */
175
211
  doc?: string;
212
+ /** Default values applied to omitted request parameters. */
176
213
  defaults?: Record<string, any>;
214
+ /** Human-readable parameter type names, surfaced via introspection. */
177
215
  paramTypes?: Record<string, string>;
178
216
  }
179
217
  /** Metadata passed to dispatch hooks before and after RPC method execution. */
@@ -219,11 +257,17 @@ export interface DispatchInfo {
219
257
  }
220
258
  /** Per-call I/O counters, matching Python's CallStatistics. */
221
259
  export interface CallStatistics {
260
+ /** Number of input batches read from the client. */
222
261
  inputBatches: number;
262
+ /** Number of output batches written to the client. */
223
263
  outputBatches: number;
264
+ /** Total rows across all input batches. */
224
265
  inputRows: number;
266
+ /** Total rows across all output batches. */
225
267
  outputRows: number;
268
+ /** Total serialized bytes of all input batches. */
226
269
  inputBytes: number;
270
+ /** Total serialized bytes of all output batches. */
227
271
  outputBytes: number;
228
272
  }
229
273
  /** Opaque token returned by onDispatchStart, passed back to onDispatchEnd. */
@@ -233,7 +277,11 @@ export type HookToken = unknown;
233
277
  * Implementations must be safe for concurrent use (HTTP transport is concurrent).
234
278
  */
235
279
  export interface DispatchHook {
280
+ /** Invoked before the method runs. The returned {@link HookToken} is opaque
281
+ * to the framework and passed back to {@link onDispatchEnd}. */
236
282
  onDispatchStart(info: DispatchInfo): HookToken;
283
+ /** Invoked after the method completes or throws. `stats` carries the per-call
284
+ * I/O counters; `error` is set only when the dispatch failed. */
237
285
  onDispatchEnd(token: HookToken, info: DispatchInfo, stats: CallStatistics, error?: Error): void;
238
286
  }
239
287
  export interface EmittedBatch {
@@ -255,6 +303,8 @@ export declare class OutputCollector implements CallContext {
255
303
  private _cookieSinkEnabled;
256
304
  private _responseCookies;
257
305
  private _stickyContext;
306
+ /** Authenticated principal for this call; {@link AuthContext.anonymous} when
307
+ * the request was not authenticated. */
258
308
  readonly auth: AuthContext;
259
309
  readonly cookies: ReadonlyMap<string, string>;
260
310
  readonly kind?: TransportKind;
@@ -294,8 +344,12 @@ export declare class OutputCollector implements CallContext {
294
344
  get sessionId(): string | null;
295
345
  openSession(state: unknown, ttl?: number): void;
296
346
  closeSession(): void;
347
+ /** Schema of the data batches this collector emits. */
297
348
  get outputSchema(): VgiSchema;
349
+ /** True once {@link finish} has been called (producer streams only). */
298
350
  get finished(): boolean;
351
+ /** Batches emitted so far this call — the single data batch plus any log
352
+ * batches, in emission order. Consumed by the dispatch layer. */
299
353
  get batches(): EmittedBatch[];
300
354
  /** Emit a pre-built batch as the data batch for this call. */
301
355
  emit(batch: VgiBatch, metadata?: Map<string, string>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,EAA6B,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,oBAAY,UAAU;IACpB,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE3E,+CAA+C;AAC/C,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,E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;oBACgB;IAChB,mBAAmB,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI;IAI7C,IAAI,OAAO,IAAI,OAAO,GAAG,IAAI,CAE5B;IAED,IAAI,SAAS,IAAI,MAAM,GAAG,IAAI,CAE7B;IAED,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAmB/C,YAAY,IAAI,IAAI;IASpB,uDAAuD;IACvD,IAAI,YAAY,IAAI,SAAS,CAE5B;IAED,wEAAwE;IACxE,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;sEACkE;IAClE,IAAI,OAAO,IAAI,YAAY,EAAE,CAE5B;IAED,8DAA8D;IAC9D,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAC3D,2GAA2G;IAC3G,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI;IAsB1C,iFAAiF;IACjF,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAQ1C,2FAA2F;IAC3F,MAAM,IAAI,IAAI;IASd,iDAAiD;IACjD,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;CAIhF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@query-farm/vgi-rpc",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://vgi-rpc-typescript.query.farm",
6
6
  "repository": {
@@ -49,10 +49,10 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@noble/ciphers": "^2.2.0",
52
- "@query-farm/apache-arrow": "*",
52
+ "@query-farm/apache-arrow": "^21.1.1",
53
53
  "@uwdata/flechette": "github:Query-farm/flechette#fix/timestamp-bigint-encode",
54
54
  "fzstd": "^0.1.1",
55
- "oauth4webapi": "^3.8.5"
55
+ "oauth4webapi": "^3.8.6"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@opentelemetry/api": ">=1.4.0",
@@ -75,15 +75,15 @@
75
75
  }
76
76
  },
77
77
  "devDependencies": {
78
- "@biomejs/biome": "^2.4.5",
79
- "@opentelemetry/api": "^1.9.0",
80
- "@opentelemetry/resources": "^2.6.0",
81
- "@opentelemetry/sdk-metrics": "^2.6.0",
82
- "@opentelemetry/sdk-trace-base": "^2.6.0",
83
- "@opentelemetry/semantic-conventions": "^1.40.0",
84
- "@aws-sdk/client-s3": "^3.750.0",
85
- "@aws-sdk/s3-request-presigner": "^3.750.0",
86
- "@google-cloud/storage": "^7.15.0",
78
+ "@biomejs/biome": "^2.4.16",
79
+ "@opentelemetry/api": "^1.9.1",
80
+ "@opentelemetry/resources": "^2.7.1",
81
+ "@opentelemetry/sdk-metrics": "^2.7.1",
82
+ "@opentelemetry/sdk-trace-base": "^2.7.1",
83
+ "@opentelemetry/semantic-conventions": "^1.41.1",
84
+ "@aws-sdk/client-s3": "^3.1059.0",
85
+ "@aws-sdk/s3-request-presigner": "^3.1059.0",
86
+ "@google-cloud/storage": "^7.19.0",
87
87
  "@types/bun": "latest"
88
88
  },
89
89
  "scripts": {
package/src/access-log.ts CHANGED
@@ -18,6 +18,7 @@ import type { CallStatistics, DispatchHook, DispatchInfo, HookToken } from "./ty
18
18
 
19
19
  /** Where the hook writes formatted JSON lines. */
20
20
  export interface AccessLogSink {
21
+ /** Write one access-log line. The trailing newline is included by the caller. */
21
22
  write(line: string): void;
22
23
  }
23
24
 
@@ -39,6 +40,7 @@ function _loadWriteSync(): (fd: number, data: Uint8Array, offset?: number, len?:
39
40
  export class FdSink implements AccessLogSink {
40
41
  private readonly _writeSync = _loadWriteSync();
41
42
  constructor(private readonly fd: number) {}
43
+ /** Write `line` to the file descriptor, looping until the buffer is fully flushed. */
42
44
  write(line: string): void {
43
45
  const buf = new TextEncoder().encode(line);
44
46
  let offset = 0;
@@ -112,11 +114,14 @@ export class AccessLogHook implements DispatchHook {
112
114
  }
113
115
  }
114
116
 
117
+ /** Capture a high-resolution start timestamp; returned token feeds {@link onDispatchEnd}. */
115
118
  onDispatchStart(_info: DispatchInfo): HookToken {
116
119
  const token: StartToken = { startNs: process.hrtime.bigint() };
117
120
  return token;
118
121
  }
119
122
 
123
+ /** Emit one access-log JSON record for the completed dispatch (best-effort;
124
+ * write errors are swallowed so logging never breaks a request). */
120
125
  onDispatchEnd(token: HookToken, info: DispatchInfo, stats: CallStatistics, error?: Error): void {
121
126
  const t = token as StartToken | undefined;
122
127
  const durationMs = t ? roundTo2(Number(process.hrtime.bigint() - t.startNs) / 1_000_000) : 0;
package/src/auth.ts CHANGED
@@ -5,9 +5,14 @@ import { RpcError } from "./errors.js";
5
5
 
6
6
  /** Authentication context available to RPC handlers. */
7
7
  export class AuthContext {
8
+ /** Authentication domain/realm that vouched for the principal; empty string
9
+ * when anonymous. */
8
10
  readonly domain: string;
11
+ /** True when the request carried valid credentials. */
9
12
  readonly authenticated: boolean;
13
+ /** Authenticated principal identifier, or `null` when anonymous. */
10
14
  readonly principal: string | null;
15
+ /** Arbitrary verified claims about the principal (e.g. decoded JWT claims). */
11
16
  readonly claims: Record<string, any>;
12
17
 
13
18
  constructor(domain: string, authenticated: boolean, principal: string | null, claims: Record<string, any> = {}) {
@@ -26,13 +26,23 @@ import { externalizeRequestBody } from "./uploadUrl.js";
26
26
  type CompressFn = (data: Uint8Array, level: number) => Promise<Uint8Array>;
27
27
  type DecompressFn = (data: Uint8Array) => Promise<Uint8Array>;
28
28
 
29
+ /** A connected RPC client, returned by {@link httpConnect}, {@link pipeConnect}, and {@link subprocessConnect}. */
29
30
  export interface RpcClient {
31
+ /** Invoke a unary method. Returns the single result row, or `null` for void methods. Parameter defaults from `__describe__` are applied automatically. */
30
32
  call(method: string, params?: Record<string, any>): Promise<Record<string, any> | null>;
33
+ /** Open a streaming method, returning a {@link StreamSession} for exchange or producer iteration. */
31
34
  stream(method: string, params?: Record<string, any>): Promise<StreamSession>;
35
+ /** Fetch the server's method/protocol description (cached after the first call). */
32
36
  describe(): Promise<ServiceDescription>;
37
+ /** Release transport resources; for subprocess clients this also terminates the child process. */
33
38
  close(): void;
34
39
  }
35
40
 
41
+ /**
42
+ * Connect to a vgi-rpc server over HTTP. The returned client lazily introspects
43
+ * the server (caching `__describe__`) on the first call and transparently handles
44
+ * zstd compression, authorization, and 413 request externalization.
45
+ */
36
46
  export function httpConnect(baseUrl: string, options?: HttpConnectOptions): RpcClient {
37
47
  const prefix = (options?.prefix ?? "").replace(/\/+$/, "");
38
48
  const onLog = options?.onLog;
@@ -9,25 +9,39 @@ import { ARROW_CONTENT_TYPE } from "../http/common.js";
9
9
  import { buildRequestIpc, dispatchLogOrError, readResponseBatches } from "./ipc.js";
10
10
  import type { LogMessage } from "./types.js";
11
11
 
12
+ /** Describes a single RPC method as reported by the server's `__describe__` response. */
12
13
  export interface MethodInfo {
14
+ /** The method name as invoked by {@link RpcClient.call} / {@link RpcClient.stream}. */
13
15
  name: string;
16
+ /** Whether the method is a single request/response (`unary`) or a streaming method (`stream`). */
14
17
  type: "unary" | "stream";
18
+ /** Arrow schema of the call parameters. */
15
19
  paramsSchema: Schema;
20
+ /** Arrow schema of a unary result; for stream methods this holds the per-batch output schema. */
16
21
  resultSchema: Schema;
22
+ /** Arrow schema of the per-batch input rows for exchange streams, when available. */
17
23
  inputSchema?: Schema;
24
+ /** Arrow schema of the per-batch output rows for stream methods, when available. */
18
25
  outputSchema?: Schema;
26
+ /** Arrow schema of the stream's one-time header row, when the method declares one. */
19
27
  headerSchema?: Schema;
28
+ /** Human-readable documentation for the method, if the server provides it. */
20
29
  doc?: string;
30
+ /** Per-parameter human-readable type names, if the server provides them. */
21
31
  paramTypes?: Record<string, string>;
32
+ /** Default values applied to omitted parameters before a call is sent. */
22
33
  defaults?: Record<string, any>;
23
34
  }
24
35
 
36
+ /** The full set of methods and protocol metadata reported by a server's `__describe__`. */
25
37
  export interface ServiceDescription {
38
+ /** The server's declared protocol/service name. */
26
39
  protocolName: string;
27
40
  /** Application protocol surface version surfaced by the server's
28
41
  * __describe__ response. Empty string when the server did not declare
29
42
  * a `protocolVersion`. */
30
43
  protocolVersion: string;
44
+ /** Every method the server exposes (excluding the built-in `__describe__`). */
31
45
  methods: MethodInfo[];
32
46
  }
33
47
 
@@ -3,14 +3,23 @@
3
3
 
4
4
  /** RFC 9728 OAuth Protected Resource Metadata (client-side response). */
5
5
  export interface OAuthResourceMetadataResponse {
6
+ /** The protected resource's canonical URL (`resource`). */
6
7
  resource: string;
8
+ /** Authorization-server issuer URLs; the first is used for OIDC discovery (`authorization_servers`). */
7
9
  authorizationServers: string[];
10
+ /** Scopes the resource advertises (`scopes_supported`). */
8
11
  scopesSupported?: string[];
12
+ /** Advertised bearer methods, e.g. `["header"]` (`bearer_methods_supported`). */
9
13
  bearerMethodsSupported?: string[];
14
+ /** JWS algorithms the resource accepts (`resource_signing_alg_values_supported`). */
10
15
  resourceSigningAlgValuesSupported?: string[];
16
+ /** Human-readable resource name (`resource_name`). */
11
17
  resourceName?: string;
18
+ /** Documentation URL for the resource (`resource_documentation`). */
12
19
  resourceDocumentation?: string;
20
+ /** Policy URL for the resource (`resource_policy_uri`). */
13
21
  resourcePolicyUri?: string;
22
+ /** Terms-of-service URL for the resource (`resource_tos_uri`). */
14
23
  resourceTosUri?: string;
15
24
  /** OAuth client_id advertised by the server. */
16
25
  clientId?: string;
@@ -75,6 +75,13 @@ class PipeIncrementalWriter {
75
75
  // PipeStreamSession — lockstep streaming over pipes
76
76
  // ---------------------------------------------------------------------------
77
77
 
78
+ /**
79
+ * {@link StreamSession} implementation for the pipe/subprocess transport.
80
+ * Drives lockstep streaming over a single bidirectional pipe: each
81
+ * {@link PipeStreamSession.exchange} or iteration step writes one input batch
82
+ * and reads one output batch. Holds the connection's single-threaded busy lock
83
+ * until closed.
84
+ */
78
85
  export class PipeStreamSession implements StreamSession {
79
86
  private _reader: IpcStreamReader;
80
87
  private _writeFn: WriteFn;
@@ -109,6 +116,7 @@ export class PipeStreamSession implements StreamSession {
109
116
  this._externalConfig = opts.externalConfig;
110
117
  }
111
118
 
119
+ /** The stream's one-time header row, or `null` if the method declares no header. */
112
120
  get header(): Record<string, any> | null {
113
121
  return this._header;
114
122
  }
@@ -335,6 +343,11 @@ export class PipeStreamSession implements StreamSession {
335
343
  }
336
344
  }
337
345
 
346
+ /**
347
+ * End the stream: close the input side (or send an empty stream if nothing
348
+ * was sent yet) and drain the server's remaining output in the background,
349
+ * releasing the connection's busy lock once the drain completes.
350
+ */
338
351
  close(): void {
339
352
  if (this._closed) return;
340
353
  this._closed = true;
@@ -377,6 +390,12 @@ export class PipeStreamSession implements StreamSession {
377
390
  // pipeConnect — create an RpcClient over raw readable/writable streams
378
391
  // ---------------------------------------------------------------------------
379
392
 
393
+ /**
394
+ * Connect to a vgi-rpc server over a raw bidirectional pipe (a readable stream
395
+ * of server output plus a writable for client input). The connection is
396
+ * single-threaded: only one call or stream may be in flight at a time. The
397
+ * `__describe__` handshake is sent before the reader is opened to avoid deadlock.
398
+ */
380
399
  export function pipeConnect(
381
400
  readable: ReadableStream<Uint8Array>,
382
401
  writable: PipeWritable,
@@ -616,6 +635,11 @@ export function pipeConnect(
616
635
  // subprocessConnect — spawn a process and wrap with pipeConnect
617
636
  // ---------------------------------------------------------------------------
618
637
 
638
+ /**
639
+ * Spawn a server process (via `Bun.spawn`) and connect to it over its
640
+ * stdin/stdout using {@link pipeConnect}. The returned client's
641
+ * {@link RpcClient.close} also kills the subprocess.
642
+ */
619
643
  export function subprocessConnect(cmd: string[], options?: SubprocessConnectOptions): RpcClient {
620
644
  const proc = Bun.spawn(cmd, {
621
645
  stdin: "pipe",
@@ -19,6 +19,12 @@ type DecompressFn = (data: Uint8Array) => Promise<Uint8Array>;
19
19
  */
20
20
  export type PostFn = (url: string, body: Uint8Array) => Promise<Response>;
21
21
 
22
+ /**
23
+ * {@link StreamSession} implementation for the HTTP transport. Stream state is
24
+ * carried statelessly across requests via an HMAC state token: each
25
+ * {@link HttpStreamSession.exchange} or producer-continuation POST sends the
26
+ * current token and receives the next one in the response metadata.
27
+ */
22
28
  export class HttpStreamSession implements StreamSession {
23
29
  private _baseUrl: string;
24
30
  private _prefix: string;
@@ -82,6 +88,7 @@ export class HttpStreamSession implements StreamSession {
82
88
  });
83
89
  }
84
90
 
91
+ /** The stream's one-time header row, or `null` if the method declares no header. */
85
92
  get header(): Record<string, any> | null {
86
93
  return this._header;
87
94
  }
@@ -305,6 +312,7 @@ export class HttpStreamSession implements StreamSession {
305
312
  return this._readResponse(resp);
306
313
  }
307
314
 
315
+ /** No-op: the HTTP transport is stateless, so there is nothing to tear down. */
308
316
  close(): void {
309
317
  // No-op for HTTP (stateless)
310
318
  }
@@ -1,9 +1,13 @@
1
1
  // © Copyright 2025-2026, Query.Farm LLC - https://query.farm
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ /** Options for {@link httpConnect}, the HTTP-transport RPC client. */
4
5
  export interface HttpConnectOptions {
6
+ /** Route prefix the server mounts its methods under (e.g. `/api`). Trailing slashes are stripped. Defaults to no prefix. */
5
7
  prefix?: string;
8
+ /** Callback invoked for each log/error message the server emits during a request. */
6
9
  onLog?: (msg: LogMessage) => void;
10
+ /** When set, request bodies are zstd-compressed at this level and `Accept-Encoding: zstd` is sent. Omit to disable compression. */
7
11
  compressionLevel?: number;
8
12
  /** Authorization header value (e.g. "Bearer <token>"). Sent with every request. */
9
13
  authorization?: string;
@@ -11,27 +15,46 @@ export interface HttpConnectOptions {
11
15
  externalLocation?: import("../external.js").ExternalLocationConfig;
12
16
  }
13
17
 
18
+ /** A log or error message delivered to an {@link HttpConnectOptions.onLog} callback. */
14
19
  export interface LogMessage {
20
+ /** Severity, mirroring the server's log level (e.g. `INFO`, `WARNING`, `EXCEPTION`). */
15
21
  level: string;
22
+ /** The human-readable log text. */
16
23
  message: string;
24
+ /** Optional structured fields attached to the log record. */
17
25
  extra?: Record<string, any>;
18
26
  }
19
27
 
28
+ /**
29
+ * A live streaming method call. Exchange methods drive the server with
30
+ * {@link StreamSession.exchange}; producer methods are consumed by async
31
+ * iteration. Always {@link StreamSession.close} when done.
32
+ */
20
33
  export interface StreamSession {
34
+ /** The method's header row (returned once at stream start), or `null` if the method declares no header. */
21
35
  readonly header: Record<string, any> | null;
36
+ /** Send one batch of input rows and receive the server's corresponding output rows (exchange streams). */
22
37
  exchange(input: Record<string, any>[]): Promise<Record<string, any>[]>;
38
+ /** Iterate the server-produced output batches one row-array at a time (producer streams). */
23
39
  [Symbol.asyncIterator](): AsyncIterableIterator<Record<string, any>[]>;
40
+ /** Tear down the stream, flushing/draining the underlying transport. */
24
41
  close(): void;
25
42
  }
26
43
 
44
+ /** Options for {@link pipeConnect}, the client over raw readable/writable streams. */
27
45
  export interface PipeConnectOptions {
46
+ /** Callback invoked for each log/error message the server emits during a request. */
28
47
  onLog?: (msg: LogMessage) => void;
29
48
  /** External storage config for resolving externalized batches. */
30
49
  externalLocation?: import("../external.js").ExternalLocationConfig;
31
50
  }
32
51
 
52
+ /** Options for {@link subprocessConnect}, which spawns a server process and pipes to it. */
33
53
  export interface SubprocessConnectOptions extends PipeConnectOptions {
54
+ /** Working directory for the spawned process. Defaults to the current directory. */
34
55
  cwd?: string;
56
+ /** Extra environment variables, merged over the current `process.env`. */
35
57
  env?: Record<string, string>;
58
+ /** How to handle the child's stderr. Defaults to `"ignore"`. */
36
59
  stderr?: "inherit" | "pipe" | "ignore";
37
60
  }