@query-farm/vgi 0.40.0 → 0.42.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/README.md +44 -0
- package/dist/attach-ticket.d.ts +179 -0
- package/dist/catalog/attach-option.d.ts +30 -0
- package/dist/client-entry.js +1 -1
- package/dist/client-entry.js.map +3 -3
- package/dist/crypto.d.ts +5 -1
- package/dist/http/fetch.d.ts +6 -0
- package/dist/index.core.d.ts +2 -1
- package/dist/index.js +1969 -1446
- package/dist/index.js.map +17 -15
- package/dist/protocol/dispatch.d.ts +13 -0
- package/dist/protocol/handlers/unimplemented.d.ts +17 -0
- package/dist/rpc-server.d.ts +14 -0
- package/dist/serve-entry.js +560 -10
- package/dist/serve-entry.js.map +12 -9
- package/dist/worker-cf-entry.js +606 -62
- package/dist/worker-cf-entry.js.map +13 -11
- package/dist/worker.d.ts +1 -0
- package/package.json +3 -3
- package/src/attach-ticket.ts +611 -0
- package/src/catalog/attach-option.ts +75 -0
- package/src/catalog/composite.ts +5 -1
- package/src/crypto.ts +13 -1
- package/src/http/fetch.ts +23 -1
- package/src/index.core.ts +27 -1
- package/src/protocol/dispatch.ts +16 -0
- package/src/protocol/handlers/catalog/admin.ts +21 -1
- package/src/protocol/handlers/unimplemented.ts +74 -0
- package/src/rpc-server.ts +50 -5
- package/src/serve-entry.ts +4 -0
- package/src/worker.ts +13 -0
|
@@ -39,4 +39,17 @@ export interface ProtocolConfig {
|
|
|
39
39
|
* protocol is registered under rather than a second copy of the literal.
|
|
40
40
|
*/
|
|
41
41
|
export declare const VGI_PROTOCOL_NAME = "vgi.v2";
|
|
42
|
+
/**
|
|
43
|
+
* The `vgi.v2` protocol hash `vgi_rpc.Reflection.v1` must report for this
|
|
44
|
+
* worker: the reference's (vgi-python 0.43.0, 72 methods). Every SDK hosts
|
|
45
|
+
* every `vgi.v2` method with the reference's schemas, so the hash is one value
|
|
46
|
+
* across the ports; a method this SDK does not implement is still registered
|
|
47
|
+
* (handlers/unimplemented.ts). The hash covers method names, types and the
|
|
48
|
+
* params/result/header schemas only (WIRE_PROTOCOL.md §14).
|
|
49
|
+
*
|
|
50
|
+
* It changes only with vgi.v2's protocol version (currently 2.1.0). Asserted
|
|
51
|
+
* by src/protocol/__tests__/vgi-v2-hash.test.ts; if that test fails, the
|
|
52
|
+
* surface drifted from the reference -- fix the schemas, do not bump this.
|
|
53
|
+
*/
|
|
54
|
+
export declare const VGI_V2_PROTOCOL_HASH = "774cb80090d71ea76d09aa311b9cda4ca4c33c3bf72c43242eb6dc87b6f79ce5";
|
|
42
55
|
export declare function buildVgiProtocol(config: ProtocolConfig): Protocol;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Protocol } from "@query-farm/vgi-rpc";
|
|
2
|
+
import type { VgiSchema } from "../../arrow/index.js";
|
|
3
|
+
/** One unimplemented method: its wire name and the reference's schemas. */
|
|
4
|
+
interface UnimplementedMethod {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly params: VgiSchema;
|
|
7
|
+
readonly result: VgiSchema;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The vgi.v2 methods (of the reference's 72) this SDK does not implement.
|
|
11
|
+
* Exported so a test can assert each one refuses with UNIMPLEMENTED.
|
|
12
|
+
*/
|
|
13
|
+
export declare const UNIMPLEMENTED_METHODS: readonly UnimplementedMethod[];
|
|
14
|
+
/** The message every unimplemented method answers with. */
|
|
15
|
+
export declare function unimplementedMessage(method: string): string;
|
|
16
|
+
export declare function registerUnimplementedMethods(protocol: Protocol): void;
|
|
17
|
+
export {};
|
package/dist/rpc-server.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GrantKeys, type GrantMinter, type Protocol, type TokenResolver, VgiRpcServer } from "@query-farm/vgi-rpc";
|
|
2
|
+
import type { CatalogInterface } from "./catalog/interface.js";
|
|
2
3
|
/** The transport a server is being built for. Only `"http"` changes what is
|
|
3
4
|
* hosted (identity); the rest are recorded so the decision lives here rather
|
|
4
5
|
* than at each call site. `"iroh"` is the raw TCP upstream of a
|
|
@@ -94,6 +95,19 @@ export interface BuildRpcServerOptions {
|
|
|
94
95
|
/** Environment to read `VGI_INTROSPECT_PRINCIPALS` from. Default
|
|
95
96
|
* `process.env` where it exists (not on Cloudflare Workers). */
|
|
96
97
|
env?: Record<string, string | undefined>;
|
|
98
|
+
/**
|
|
99
|
+
* HTTP only: what `vgi.attach_tickets.v1` needs. Hosted when
|
|
100
|
+
* `signingKeyConfigured` is true -- the key came from explicit
|
|
101
|
+
* configuration, not generated for this process, which would make every
|
|
102
|
+
* ticket die on restart -- and the worker can issue grants (grant keys
|
|
103
|
+
* configured, or its own `mintGrant`). Otherwise the protocol is absent,
|
|
104
|
+
* not hosted-and-refusing.
|
|
105
|
+
*/
|
|
106
|
+
attachTickets?: {
|
|
107
|
+
signingKey: Uint8Array | undefined;
|
|
108
|
+
signingKeyConfigured: boolean;
|
|
109
|
+
catalogInterface: CatalogInterface | undefined;
|
|
110
|
+
};
|
|
97
111
|
}
|
|
98
112
|
/**
|
|
99
113
|
* Build the vgi-rpc server for a worker's `vgi.v2` protocol on `transport`.
|