@nyte-ai/protocol 0.0.27 → 0.0.28-nightly.20261107.65
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/src/codec.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import type { Json } from "@nyte-ai/schema";
|
|
2
2
|
import type { ByteName, CallName, OperationInput, OperationName, OperationOutput } from "./declarations.ts";
|
|
3
|
-
/** Whether `name` names a row of the operations table. */
|
|
4
3
|
export declare function namesOperation(name: string): name is OperationName;
|
|
5
|
-
/** Whether a row is answered once with JSON: a query, command or receipt. */
|
|
6
4
|
export declare function answersOnce(name: OperationName): name is CallName;
|
|
7
|
-
/** Whether a row is a stream of bytes, answered as a raw octet stream. */
|
|
8
5
|
export declare function answersBytes(name: OperationName): name is ByteName;
|
|
9
6
|
/** Decodes an operation's input strictly: a value failing the row's input schema, or carrying a field the schema does not name, throws `SdkError("invalid")` with its issues. */
|
|
10
7
|
export declare function decodeInput<N extends OperationName>(name: N, value: unknown): OperationInput<N>;
|
|
11
|
-
/** Encodes an operation's input as the JSON the wire carries. */
|
|
12
8
|
export declare function encodeInput<N extends OperationName>(_name: N, input: OperationInput<N>): Json;
|
|
13
9
|
/** Encodes an operation's output, or one frame of it, as the JSON the wire carries: `Set`s become arrays, `Map`s objects and bytes base64; fields its schema does not name are stripped; an undefined field is omitted, or null where the schema requires it and accepts null (`part.act`'s output, §40f). */
|
|
14
10
|
export declare function encodeOutput<N extends OperationName>(name: N, value: OperationOutput<N>): Json;
|
|
@@ -2,23 +2,16 @@ import type { Infer, Json, OPERATIONS } from "@nyte-ai/schema";
|
|
|
2
2
|
type Frozen<T> = [Json] extends [T] ? T : T extends string | number | boolean | null | undefined | Uint8Array ? T : T extends readonly (infer E)[] ? readonly Frozen<E>[] : {
|
|
3
3
|
readonly [K in keyof T]: Frozen<T[K]>;
|
|
4
4
|
};
|
|
5
|
-
/** Returns the operations table's type: each row's literal kind, authority and scope, and its schemas. */
|
|
6
5
|
export type Declarations = typeof OPERATIONS;
|
|
7
|
-
/** Names one served operation: a key of the table. */
|
|
8
6
|
export type OperationName = keyof Declarations;
|
|
9
|
-
/** Returns one operation's decoded input, as its schema types it, read-only. */
|
|
10
7
|
export type OperationInput<N extends OperationName> = Frozen<Infer<Declarations[N]["input"]>>;
|
|
11
|
-
/** Returns one operation's decoded output, as its schema types it, read-only: its value, or one frame of a `watch` or `stream` row. */
|
|
12
8
|
export type OperationOutput<N extends OperationName> = Frozen<Infer<Declarations[N]["output"]>>;
|
|
13
|
-
/** Names the rows answered once with JSON: queries, commands and receipts. */
|
|
14
9
|
export type CallName = {
|
|
15
10
|
[N in OperationName]: Declarations[N]["kind"] extends "query" | "command" | "receipt" ? N : never;
|
|
16
11
|
}[OperationName];
|
|
17
|
-
/** Names the stream rows whose frames are bytes, answered as a raw octet stream. */
|
|
18
12
|
export type ByteName = {
|
|
19
13
|
[N in OperationName]: Declarations[N]["kind"] extends "stream" ? OperationOutput<N> extends Uint8Array ? N : never : never;
|
|
20
14
|
}[OperationName];
|
|
21
|
-
/** Names the rows answered with JSON frames over server-sent events: every watch and the JSON streams. */
|
|
22
15
|
export type FrameName = Exclude<{
|
|
23
16
|
[N in OperationName]: Declarations[N]["kind"] extends "watch" | "stream" ? N : never;
|
|
24
17
|
}[OperationName], ByteName | "job.output">;
|
package/dist/src/raw-parts.d.ts
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
import type { Json } from "@nyte-ai/schema";
|
|
2
|
-
/**
|
|
3
|
-
* Returns a message or part view a newer host sent that this client cannot
|
|
4
|
-
* read as a raw part of the same id, or null when the item is neither. Its
|
|
5
|
-
* kind is the part's kind, or the message's own when it is not a part; its
|
|
6
|
-
* state is the part's state, or the whole item. It reads as settled, since
|
|
7
|
-
* this client cannot tell a newer status apart. Clients draw a part with no
|
|
8
|
-
* renderer as its kind and raw state.
|
|
9
|
-
*/
|
|
10
2
|
export declare function rawPart(item: unknown): Json | null;
|
|
@@ -3,7 +3,6 @@ export declare const CHANNEL_PATH = ".nyte/streams";
|
|
|
3
3
|
export declare const CANCEL_PATH = ".nyte/streams/cancel";
|
|
4
4
|
export declare const CHANNEL_HEADER = "X-Nyte-Channel";
|
|
5
5
|
export declare const STREAM_HEADER = "X-Nyte-Stream";
|
|
6
|
-
/** The channel-open body of a client that inflates `deflated` frames. */
|
|
7
6
|
export declare const DEFLATE_REQUEST: {
|
|
8
7
|
readonly deflate: true;
|
|
9
8
|
};
|
package/dist/src/wire.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SdkError } from "@nyte-ai/schema";
|
|
2
2
|
import type { ByteReader, Json, OutputFrame, SdkErrorCode, SdkErrorWire } from "@nyte-ai/schema";
|
|
3
|
-
/** Maps each error code to the HTTP status the handler answers it with. */
|
|
4
3
|
export declare const errorStatus: {
|
|
5
4
|
readonly invalid: 400;
|
|
6
5
|
readonly unauthenticated: 401;
|
|
@@ -12,12 +11,10 @@ export declare const errorStatus: {
|
|
|
12
11
|
readonly not_supported: 501;
|
|
13
12
|
readonly timeout: 504;
|
|
14
13
|
};
|
|
15
|
-
/** Names the request header that carries an operation's JSON input when the body carries its bytes. */
|
|
16
14
|
export declare const INPUT_HEADER = "X-Nyte-Input";
|
|
17
15
|
/** Names the response header carrying the id of the host that answered, `X-Nyte-Host: <hostId>`, on every response a listener sends, so a client compares it with `expect.hostId` on its first answer (§43a, §43j). */
|
|
18
16
|
export declare const HOST_HEADER = "X-Nyte-Host";
|
|
19
17
|
export declare const OPERATIONS_HEADER = "X-Nyte-Operations";
|
|
20
|
-
/** Serialises an `SdkError` as the wire error: code, message, host, issues and correlation. */
|
|
21
18
|
export declare function encodeError(error: SdkError): SdkErrorWire;
|
|
22
19
|
/** Rebuilds the `SdkError` a wire error carries; a body that is not a wire error is the code `statusCode` gives the response's status, `internal` without one. */
|
|
23
20
|
export declare function decodeError(value: Json, status?: number): SdkError;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyte-ai/protocol",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28-nightly.20261107.65",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"provenance": true
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@nyte-ai/core": "0.0.
|
|
29
|
-
"@nyte-ai/schema": "0.0.
|
|
28
|
+
"@nyte-ai/core": "0.0.28-nightly.20261107.65",
|
|
29
|
+
"@nyte-ai/schema": "0.0.28-nightly.20261107.65",
|
|
30
30
|
"fflate": "^0.8.3",
|
|
31
31
|
"typebox": "^1.4.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@nyte-ai/ai": "0.0.
|
|
34
|
+
"@nyte-ai/ai": "0.0.28-nightly.20261107.65",
|
|
35
35
|
"@types/node": "^26.6.5",
|
|
36
36
|
"vitest": "^5.0.5"
|
|
37
37
|
},
|