@yinaoxiong/paseo-protocol 0.13.0-personal.2 → 0.15.0-personal.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.
- package/build-info.json +8 -8
- package/dist/agent-types.d.ts +1 -1
- package/dist/binary-frames/demux.js +3 -0
- package/dist/binary-frames/host-route.d.ts +1 -0
- package/dist/binary-frames/host-route.js +3 -0
- package/dist/binary-frames/terminal.d.ts +8 -0
- package/dist/binary-frames/terminal.js +11 -0
- package/dist/chunked-transport.d.ts +37 -0
- package/dist/chunked-transport.js +199 -0
- package/dist/client-capabilities.d.ts +2 -0
- package/dist/client-capabilities.js +2 -0
- package/dist/generated/validation/ws-outbound-schema-metadata.d.ts +208 -16
- package/dist/generated/validation/ws-outbound-schema-metadata.js +3 -0
- package/dist/generated/validation/ws-outbound.aot.d.ts +6 -0
- package/dist/generated/validation/ws-outbound.aot.js +3223 -1579
- package/dist/messages.d.ts +1418 -4
- package/dist/messages.js +73 -2
- package/dist/paseo-tool-presentation/catalog.d.ts +50 -0
- package/dist/paseo-tool-presentation/catalog.js +96 -34
- package/dist/paseo-tool-presentation/index.d.ts +2 -0
- package/dist/paseo-tool-presentation/index.js +16 -1
- package/dist/speech/rpc-schemas.d.ts +237 -0
- package/dist/speech/rpc-schemas.js +186 -0
- package/dist/timeline-turn.d.ts +8 -0
- package/dist/timeline-turn.js +14 -0
- package/dist/validation/ws-outbound-envelope.d.ts +186 -3
- package/package.json +1 -1
- package/dist/terminal-snapshot.d.ts +0 -3
- package/dist/terminal-snapshot.js +0 -184
package/build-info.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"upstreamVersion": "0.
|
|
3
|
+
"upstreamVersion": "0.15.0",
|
|
4
4
|
"revision": 2,
|
|
5
|
-
"version": "0.
|
|
6
|
-
"appVersion": "0.
|
|
7
|
-
"androidVersionCode":
|
|
8
|
-
"iosBuildNumber": "
|
|
9
|
-
"sourceSha": "
|
|
10
|
-
"lockSha256": "
|
|
5
|
+
"version": "0.15.0-personal.2",
|
|
6
|
+
"appVersion": "0.15.0",
|
|
7
|
+
"androidVersionCode": 15000002,
|
|
8
|
+
"iosBuildNumber": "15000999",
|
|
9
|
+
"sourceSha": "b9dd9b77815dace5f3d6918a67698c75a077e734",
|
|
10
|
+
"lockSha256": "74e66d2038e8b2f93ceddae21db1ff21e87938d8ebcf13f569902ff4ee903a8e",
|
|
11
11
|
"nodeVersion": "v24.21.0",
|
|
12
12
|
"npmVersion": "11.19.0",
|
|
13
13
|
"platform": "linux",
|
|
14
14
|
"arch": "x64",
|
|
15
15
|
"signature": "unsigned",
|
|
16
16
|
"packageName": "@yinaoxiong/paseo-protocol",
|
|
17
|
-
"desktopVersion": "0.
|
|
17
|
+
"desktopVersion": "0.15.0+personal.2"
|
|
18
18
|
}
|
package/dist/agent-types.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ export function decodeBinaryFrame(bytes) {
|
|
|
11
11
|
case TerminalStreamOpcode.Input:
|
|
12
12
|
case TerminalStreamOpcode.Resize:
|
|
13
13
|
case TerminalStreamOpcode.Snapshot:
|
|
14
|
+
case TerminalStreamOpcode.ReplayBegin:
|
|
15
|
+
case TerminalStreamOpcode.ReplayData:
|
|
16
|
+
case TerminalStreamOpcode.ReplayEnd:
|
|
14
17
|
case TerminalStreamOpcode.Restore: {
|
|
15
18
|
const frame = decodeTerminalStreamFrame(bytes);
|
|
16
19
|
return frame ? { kind: "terminal", frame } : null;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export declare const HOST_ROUTE_OPCODE = 48;
|
|
3
3
|
export declare const MAX_HOST_ROUTE_ID_BYTES = 256;
|
|
4
4
|
export declare const MAX_HOST_ROUTE_HEADER_BYTES: number;
|
|
5
|
+
export declare const MAX_HOST_CHANNEL_FRAME_BYTES: number;
|
|
5
6
|
export declare const MAX_ROUTED_PAYLOAD_BYTES: number;
|
|
6
7
|
export interface HostRouteFrame {
|
|
7
8
|
routeId: string;
|
|
@@ -3,6 +3,9 @@ import { MAX_WEBSOCKET_MESSAGE_BYTES } from "../websocket-message-limit.js";
|
|
|
3
3
|
export const HOST_ROUTE_OPCODE = 0x30;
|
|
4
4
|
export const MAX_HOST_ROUTE_ID_BYTES = 256;
|
|
5
5
|
export const MAX_HOST_ROUTE_HEADER_BYTES = 3 + MAX_HOST_ROUTE_ID_BYTES;
|
|
6
|
+
// A logical host channel crosses the 32 MiB route admission boundary. Text can
|
|
7
|
+
// expand sixfold when enclosed in JSON; binary adds the bounded route header.
|
|
8
|
+
export const MAX_HOST_CHANNEL_FRAME_BYTES = Math.floor((32 * 1024 * 1024 - MAX_HOST_ROUTE_HEADER_BYTES) / 6);
|
|
6
9
|
export const MAX_ROUTED_PAYLOAD_BYTES = MAX_WEBSOCKET_MESSAGE_BYTES - MAX_HOST_ROUTE_HEADER_BYTES;
|
|
7
10
|
export function encodeHostRouteFrame(routeId, payload) {
|
|
8
11
|
const id = new TextEncoder().encode(routeId);
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { TerminalStateSchema } from "../messages.js";
|
|
3
|
+
export declare const TerminalReplayMetadataSchema: z.ZodObject<{
|
|
4
|
+
rows: z.ZodNumber;
|
|
5
|
+
cols: z.ZodNumber;
|
|
6
|
+
retainedHistoryLines: z.ZodNumber;
|
|
7
|
+
}, z.core.$strip>;
|
|
3
8
|
export declare const TerminalStreamResizeSchema: z.ZodObject<{
|
|
4
9
|
rows: z.ZodNumber;
|
|
5
10
|
cols: z.ZodNumber;
|
|
@@ -14,6 +19,9 @@ export declare const TerminalStreamOpcode: {
|
|
|
14
19
|
readonly Resize: 3;
|
|
15
20
|
readonly Snapshot: 4;
|
|
16
21
|
readonly Restore: 5;
|
|
22
|
+
readonly ReplayBegin: 6;
|
|
23
|
+
readonly ReplayData: 7;
|
|
24
|
+
readonly ReplayEnd: 8;
|
|
17
25
|
};
|
|
18
26
|
export type TerminalStreamOpcode = (typeof TerminalStreamOpcode)[keyof typeof TerminalStreamOpcode];
|
|
19
27
|
export interface TerminalStreamFrame {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { TerminalStateSchema } from "../messages.js";
|
|
3
|
+
export const TerminalReplayMetadataSchema = z.object({
|
|
4
|
+
rows: z.number().int().positive(),
|
|
5
|
+
cols: z.number().int().positive(),
|
|
6
|
+
retainedHistoryLines: z.number().int().nonnegative(),
|
|
7
|
+
});
|
|
3
8
|
export const TerminalStreamResizeSchema = z.object({
|
|
4
9
|
rows: z.number().int().positive(),
|
|
5
10
|
cols: z.number().int().positive(),
|
|
@@ -11,6 +16,9 @@ export const TerminalStreamOpcode = {
|
|
|
11
16
|
Resize: 0x03,
|
|
12
17
|
Snapshot: 0x04,
|
|
13
18
|
Restore: 0x05,
|
|
19
|
+
ReplayBegin: 0x06,
|
|
20
|
+
ReplayData: 0x07,
|
|
21
|
+
ReplayEnd: 0x08,
|
|
14
22
|
};
|
|
15
23
|
export function asUint8Array(data) {
|
|
16
24
|
if (typeof data === "string") {
|
|
@@ -45,6 +53,9 @@ function isTerminalStreamOpcode(value) {
|
|
|
45
53
|
value === TerminalStreamOpcode.Input ||
|
|
46
54
|
value === TerminalStreamOpcode.Resize ||
|
|
47
55
|
value === TerminalStreamOpcode.Snapshot ||
|
|
56
|
+
value === TerminalStreamOpcode.ReplayBegin ||
|
|
57
|
+
value === TerminalStreamOpcode.ReplayData ||
|
|
58
|
+
value === TerminalStreamOpcode.ReplayEnd ||
|
|
48
59
|
value === TerminalStreamOpcode.Restore);
|
|
49
60
|
}
|
|
50
61
|
export function encodeTerminalStreamFrame(input) {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
type Frame = string | Uint8Array;
|
|
2
|
+
/** A malformed wire frame, distinct from a consumer delivery failure. */
|
|
3
|
+
export declare class ChunkedTransportProtocolError extends Error {
|
|
4
|
+
}
|
|
5
|
+
/** Connection-scoped ordered framing, below serialization and routing, above encryption. */
|
|
6
|
+
export declare class ChunkedTransport {
|
|
7
|
+
private readonly io;
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
private assembly;
|
|
10
|
+
private size;
|
|
11
|
+
private kind;
|
|
12
|
+
private closed;
|
|
13
|
+
private pending;
|
|
14
|
+
private queuedBytes;
|
|
15
|
+
private activeBytes;
|
|
16
|
+
constructor(io: {
|
|
17
|
+
frameBytes: number;
|
|
18
|
+
supportsDrain?: boolean;
|
|
19
|
+
send: (frame: Frame, waitForDrain: boolean) => void | Promise<void>;
|
|
20
|
+
deliver: (frame: Frame) => void;
|
|
21
|
+
onFailure?: (error: unknown) => void;
|
|
22
|
+
});
|
|
23
|
+
/** Bytes waiting behind the active write; physical buffering owns the active frame. */
|
|
24
|
+
get queuedByteLength(): number;
|
|
25
|
+
get isWriting(): boolean;
|
|
26
|
+
send(frame: Frame, options?: {
|
|
27
|
+
waitForDrain?: boolean;
|
|
28
|
+
byteLength?: number;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
private sendChunks;
|
|
31
|
+
receive(frame: Frame): void;
|
|
32
|
+
private assemble;
|
|
33
|
+
private fail;
|
|
34
|
+
close(): void;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=chunked-transport.d.ts.map
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { MAX_WEBSOCKET_MESSAGE_BYTES } from "./websocket-message-limit.js";
|
|
2
|
+
/** A malformed wire frame, distinct from a consumer delivery failure. */
|
|
3
|
+
export class ChunkedTransportProtocolError extends Error {
|
|
4
|
+
}
|
|
5
|
+
// Reserved outside the application binary opcode space. Version, kind, flags follow.
|
|
6
|
+
const OPCODE = 0x31;
|
|
7
|
+
const HEADER = 4;
|
|
8
|
+
/** Connection-scoped ordered framing, below serialization and routing, above encryption. */
|
|
9
|
+
export class ChunkedTransport {
|
|
10
|
+
constructor(io) {
|
|
11
|
+
this.io = io;
|
|
12
|
+
this.enabled = false;
|
|
13
|
+
this.size = 0;
|
|
14
|
+
this.kind = 0;
|
|
15
|
+
this.closed = false;
|
|
16
|
+
this.queuedBytes = 0;
|
|
17
|
+
this.activeBytes = 0;
|
|
18
|
+
if (io.frameBytes <= HEADER)
|
|
19
|
+
throw new Error("Invalid transport frame budget");
|
|
20
|
+
}
|
|
21
|
+
/** Bytes waiting behind the active write; physical buffering owns the active frame. */
|
|
22
|
+
get queuedByteLength() {
|
|
23
|
+
return this.queuedBytes - this.activeBytes;
|
|
24
|
+
}
|
|
25
|
+
get isWriting() {
|
|
26
|
+
return this.pending !== undefined;
|
|
27
|
+
}
|
|
28
|
+
send(frame, options = {}) {
|
|
29
|
+
const byteLength = options.byteLength ?? frameByteLength(frame);
|
|
30
|
+
if (byteLength > MAX_WEBSOCKET_MESSAGE_BYTES)
|
|
31
|
+
throw new Error("Logical message too large");
|
|
32
|
+
const chunk = this.enabled && this.io.supportsDrain !== false && byteLength > this.io.frameBytes;
|
|
33
|
+
if (this.closed)
|
|
34
|
+
throw new Error("Transport closed");
|
|
35
|
+
const write = () => {
|
|
36
|
+
if (this.closed)
|
|
37
|
+
throw new Error("Transport closed");
|
|
38
|
+
this.activeBytes = byteLength;
|
|
39
|
+
// A synchronous rejection did not admit a frame. Only accepted writes can
|
|
40
|
+
// fail the connection; queued admission failures still belong to their sender.
|
|
41
|
+
const result = chunk
|
|
42
|
+
? this.sendChunks(typeof frame === "string" ? new TextEncoder().encode(frame) : frame, typeof frame === "string")
|
|
43
|
+
: this.io.send(frame, options.waitForDrain === true);
|
|
44
|
+
if (!result)
|
|
45
|
+
return;
|
|
46
|
+
return result.catch((error) => {
|
|
47
|
+
this.fail(error);
|
|
48
|
+
throw error;
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
if (this.queuedBytes + byteLength > MAX_WEBSOCKET_MESSAGE_BYTES) {
|
|
52
|
+
const error = new Error("Logical output queue exceeded its byte limit");
|
|
53
|
+
this.fail(error);
|
|
54
|
+
const rejected = Promise.reject(error);
|
|
55
|
+
void rejected.catch(() => { });
|
|
56
|
+
return rejected;
|
|
57
|
+
}
|
|
58
|
+
this.queuedBytes += byteLength;
|
|
59
|
+
let result;
|
|
60
|
+
try {
|
|
61
|
+
result = this.pending ? this.pending.then(write) : write();
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
this.queuedBytes -= byteLength;
|
|
65
|
+
this.activeBytes = 0;
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
if (!result) {
|
|
69
|
+
this.queuedBytes -= byteLength;
|
|
70
|
+
this.activeBytes = 0;
|
|
71
|
+
return Promise.resolve();
|
|
72
|
+
}
|
|
73
|
+
const completion = Promise.resolve(result).finally(() => {
|
|
74
|
+
this.queuedBytes -= byteLength;
|
|
75
|
+
this.activeBytes = 0;
|
|
76
|
+
});
|
|
77
|
+
const tail = completion.then(() => undefined, () => undefined);
|
|
78
|
+
this.pending = tail;
|
|
79
|
+
void tail.then(() => {
|
|
80
|
+
if (this.pending === tail)
|
|
81
|
+
this.pending = undefined;
|
|
82
|
+
return undefined;
|
|
83
|
+
});
|
|
84
|
+
return completion;
|
|
85
|
+
}
|
|
86
|
+
sendChunks(bytes, text) {
|
|
87
|
+
const capacity = this.io.frameBytes - HEADER;
|
|
88
|
+
const writeChunk = (offset) => {
|
|
89
|
+
if (this.closed)
|
|
90
|
+
throw new Error("Transport closed");
|
|
91
|
+
const end = Math.min(bytes.byteLength, offset + capacity);
|
|
92
|
+
const wire = new Uint8Array(HEADER + end - offset);
|
|
93
|
+
wire.set([
|
|
94
|
+
OPCODE,
|
|
95
|
+
1,
|
|
96
|
+
text ? 0 : 1,
|
|
97
|
+
(offset === 0 ? 1 : 0) | (end === bytes.byteLength ? 2 : 0),
|
|
98
|
+
]);
|
|
99
|
+
wire.set(bytes.subarray(offset, end), HEADER);
|
|
100
|
+
return this.io.send(wire, true);
|
|
101
|
+
};
|
|
102
|
+
const first = writeChunk(0);
|
|
103
|
+
return (async () => {
|
|
104
|
+
await first;
|
|
105
|
+
for (let offset = capacity; offset < bytes.byteLength; offset += capacity)
|
|
106
|
+
await writeChunk(offset);
|
|
107
|
+
})();
|
|
108
|
+
}
|
|
109
|
+
receive(frame) {
|
|
110
|
+
if (this.closed)
|
|
111
|
+
return;
|
|
112
|
+
let message;
|
|
113
|
+
try {
|
|
114
|
+
message = this.assemble(frame);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
this.close();
|
|
118
|
+
throw new ChunkedTransportProtocolError(error instanceof Error ? error.message : String(error), { cause: error });
|
|
119
|
+
}
|
|
120
|
+
if (message !== undefined)
|
|
121
|
+
this.io.deliver(message);
|
|
122
|
+
}
|
|
123
|
+
assemble(frame) {
|
|
124
|
+
if (typeof frame === "string" || frame[0] !== OPCODE) {
|
|
125
|
+
if (this.assembly)
|
|
126
|
+
throw new Error("Interrupted chunked message");
|
|
127
|
+
return frame;
|
|
128
|
+
}
|
|
129
|
+
if (!this.enabled ||
|
|
130
|
+
frame.length <= HEADER ||
|
|
131
|
+
frame[1] !== 1 ||
|
|
132
|
+
frame[2] > 1 ||
|
|
133
|
+
(frame[3] & ~3) !== 0)
|
|
134
|
+
throw new Error("Invalid chunk header");
|
|
135
|
+
const start = (frame[3] & 1) !== 0;
|
|
136
|
+
const end = (frame[3] & 2) !== 0;
|
|
137
|
+
if (start === !!this.assembly)
|
|
138
|
+
throw new Error("Invalid chunk sequence");
|
|
139
|
+
if (start) {
|
|
140
|
+
this.assembly = new Uint8Array(0);
|
|
141
|
+
this.kind = frame[2];
|
|
142
|
+
this.size = 0;
|
|
143
|
+
}
|
|
144
|
+
if (frame[2] !== this.kind)
|
|
145
|
+
throw new Error("Chunk kind changed");
|
|
146
|
+
this.size += frame.length - HEADER;
|
|
147
|
+
if (this.size > MAX_WEBSOCKET_MESSAGE_BYTES)
|
|
148
|
+
throw new Error("Logical message too large");
|
|
149
|
+
const payload = frame.subarray(HEADER);
|
|
150
|
+
if (this.assembly.byteLength < this.size) {
|
|
151
|
+
const capacity = Math.min(MAX_WEBSOCKET_MESSAGE_BYTES, Math.max(this.size, this.assembly.byteLength * 2, 16384));
|
|
152
|
+
const grown = new Uint8Array(capacity);
|
|
153
|
+
grown.set(this.assembly.subarray(0, this.size - payload.byteLength));
|
|
154
|
+
this.assembly = grown;
|
|
155
|
+
}
|
|
156
|
+
this.assembly.set(payload, this.size - payload.byteLength);
|
|
157
|
+
if (!end)
|
|
158
|
+
return;
|
|
159
|
+
const data = this.assembly.subarray(0, this.size);
|
|
160
|
+
this.assembly = undefined;
|
|
161
|
+
this.size = 0;
|
|
162
|
+
return this.kind === 0 ? new TextDecoder("utf-8", { fatal: true }).decode(data) : data.slice();
|
|
163
|
+
}
|
|
164
|
+
fail(error) {
|
|
165
|
+
if (this.closed)
|
|
166
|
+
return;
|
|
167
|
+
this.close();
|
|
168
|
+
this.io.onFailure?.(error);
|
|
169
|
+
}
|
|
170
|
+
close() {
|
|
171
|
+
this.closed = true;
|
|
172
|
+
this.enabled = false;
|
|
173
|
+
this.assembly = undefined;
|
|
174
|
+
this.size = 0;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function frameByteLength(frame) {
|
|
178
|
+
if (typeof frame !== "string")
|
|
179
|
+
return frame.byteLength;
|
|
180
|
+
let bytes = 0;
|
|
181
|
+
for (let index = 0; index < frame.length; index++) {
|
|
182
|
+
const code = frame.charCodeAt(index);
|
|
183
|
+
if (code <= 0x7f)
|
|
184
|
+
bytes++;
|
|
185
|
+
else if (code <= 0x7ff)
|
|
186
|
+
bytes += 2;
|
|
187
|
+
else if (code >= 0xd800 &&
|
|
188
|
+
code <= 0xdbff &&
|
|
189
|
+
frame.charCodeAt(index + 1) >= 0xdc00 &&
|
|
190
|
+
frame.charCodeAt(index + 1) <= 0xdfff) {
|
|
191
|
+
bytes += 4;
|
|
192
|
+
index++;
|
|
193
|
+
}
|
|
194
|
+
else
|
|
195
|
+
bytes += 3;
|
|
196
|
+
}
|
|
197
|
+
return bytes;
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=chunked-transport.js.map
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const CLIENT_CAPS: {
|
|
2
|
+
readonly terminalChunkedReplay: "terminal_chunked_replay";
|
|
3
|
+
readonly binaryChunkingV1: "binary_chunking_v1";
|
|
2
4
|
readonly helloRejection: "hello_rejection";
|
|
3
5
|
readonly ownedSubscriptions: "owned_subscriptions";
|
|
4
6
|
readonly explicitEventSubscriptions: "explicit_event_subscriptions";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export const CLIENT_CAPS = {
|
|
2
|
+
terminalChunkedReplay: "terminal_chunked_replay",
|
|
3
|
+
binaryChunkingV1: "binary_chunking_v1",
|
|
2
4
|
helloRejection: "hello_rejection",
|
|
3
5
|
// COMPAT(ownedSubscriptions): added in v0.8.0, remove legacy ownership after 2027-03-09.
|
|
4
6
|
ownedSubscriptions: "owned_subscriptions",
|