@getpaseo/protocol 0.1.84
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 +12 -0
- package/dist/agent-attention-notification.d.ts +41 -0
- package/dist/agent-attention-notification.js +140 -0
- package/dist/agent-labels.d.ts +2 -0
- package/dist/agent-labels.js +2 -0
- package/dist/agent-lifecycle.d.ts +3 -0
- package/dist/agent-lifecycle.js +8 -0
- package/dist/agent-state-bucket.d.ts +13 -0
- package/dist/agent-state-bucket.js +41 -0
- package/dist/agent-title-limits.d.ts +3 -0
- package/dist/agent-title-limits.js +3 -0
- package/dist/agent-types.d.ts +421 -0
- package/dist/agent-types.js +22 -0
- package/dist/binary-frames/file-transfer.d.ts +56 -0
- package/dist/binary-frames/file-transfer.js +108 -0
- package/dist/binary-frames/index.d.ts +3 -0
- package/dist/binary-frames/index.js +3 -0
- package/dist/binary-frames/terminal.d.ts +37 -0
- package/dist/binary-frames/terminal.js +101 -0
- package/dist/chat/rpc-schemas.d.ts +728 -0
- package/dist/chat/rpc-schemas.js +103 -0
- package/dist/chat/types.d.ts +75 -0
- package/dist/chat/types.js +22 -0
- package/dist/client-capabilities.d.ts +6 -0
- package/dist/client-capabilities.js +9 -0
- package/dist/connection-offer.d.ts +80 -0
- package/dist/connection-offer.js +53 -0
- package/dist/daemon-endpoints.d.ts +47 -0
- package/dist/daemon-endpoints.js +201 -0
- package/dist/error-utils.d.ts +11 -0
- package/dist/error-utils.js +27 -0
- package/dist/git-remote.d.ts +16 -0
- package/dist/git-remote.js +72 -0
- package/dist/host-connection-schema.d.ts +23 -0
- package/dist/host-connection-schema.js +9 -0
- package/dist/importable-providers.d.ts +7 -0
- package/dist/importable-providers.js +7 -0
- package/dist/literal-union.d.ts +2 -0
- package/dist/literal-union.js +2 -0
- package/dist/loop/rpc-schemas.d.ts +3005 -0
- package/dist/loop/rpc-schemas.js +163 -0
- package/dist/messages.d.ts +144995 -0
- package/dist/messages.js +3338 -0
- package/dist/paseo-config-schema.d.ts +915 -0
- package/dist/paseo-config-schema.js +77 -0
- package/dist/path-utils.d.ts +2 -0
- package/dist/path-utils.js +16 -0
- package/dist/provider-config.d.ts +602 -0
- package/dist/provider-config.js +123 -0
- package/dist/provider-manifest.d.ts +33 -0
- package/dist/provider-manifest.js +219 -0
- package/dist/schedule/rpc-schemas.d.ts +3993 -0
- package/dist/schedule/rpc-schemas.js +151 -0
- package/dist/schedule/types.d.ts +745 -0
- package/dist/schedule/types.js +74 -0
- package/dist/terminal-input-mode.d.ts +26 -0
- package/dist/terminal-input-mode.js +151 -0
- package/dist/terminal-key-input.d.ts +13 -0
- package/dist/terminal-key-input.js +201 -0
- package/dist/terminal-snapshot.d.ts +3 -0
- package/dist/terminal-snapshot.js +165 -0
- package/dist/terminal-stream-protocol.d.ts +2 -0
- package/dist/terminal-stream-protocol.js +2 -0
- package/dist/tool-call-display.d.ts +11 -0
- package/dist/tool-call-display.js +135 -0
- package/dist/tool-name-normalization.d.ts +9 -0
- package/dist/tool-name-normalization.js +82 -0
- package/package.json +34 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function normalizeAgentModelDefinition(model) {
|
|
2
|
+
const defaultThinkingOptionId = model.defaultThinkingOptionId ?? model.thinkingOptions?.find((option) => option.isDefault)?.id;
|
|
3
|
+
if (!defaultThinkingOptionId || defaultThinkingOptionId === model.defaultThinkingOptionId) {
|
|
4
|
+
return model;
|
|
5
|
+
}
|
|
6
|
+
return { ...model, defaultThinkingOptionId };
|
|
7
|
+
}
|
|
8
|
+
export const TOOL_CALL_ICON_NAMES = [
|
|
9
|
+
"wrench",
|
|
10
|
+
"square_terminal",
|
|
11
|
+
"eye",
|
|
12
|
+
"pencil",
|
|
13
|
+
"search",
|
|
14
|
+
"bot",
|
|
15
|
+
"sparkles",
|
|
16
|
+
"brain",
|
|
17
|
+
"mic_vocal",
|
|
18
|
+
];
|
|
19
|
+
export function getAgentStreamEventTurnId(event) {
|
|
20
|
+
return "turnId" in event ? event.turnId : undefined;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=agent-types.js.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const FileTransferOpcode: {
|
|
3
|
+
readonly FileBegin: 16;
|
|
4
|
+
readonly FileChunk: 17;
|
|
5
|
+
readonly FileEnd: 18;
|
|
6
|
+
};
|
|
7
|
+
export type FileTransferOpcode = (typeof FileTransferOpcode)[keyof typeof FileTransferOpcode];
|
|
8
|
+
export declare const FileBeginMetadataSchema: z.ZodObject<{
|
|
9
|
+
mime: z.ZodString;
|
|
10
|
+
size: z.ZodNumber;
|
|
11
|
+
encoding: z.ZodEnum<["utf-8", "binary"]>;
|
|
12
|
+
modifiedAt: z.ZodString;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
size: number;
|
|
15
|
+
modifiedAt: string;
|
|
16
|
+
encoding: "binary" | "utf-8";
|
|
17
|
+
mime: string;
|
|
18
|
+
}, {
|
|
19
|
+
size: number;
|
|
20
|
+
modifiedAt: string;
|
|
21
|
+
encoding: "binary" | "utf-8";
|
|
22
|
+
mime: string;
|
|
23
|
+
}>;
|
|
24
|
+
export interface FileBegin {
|
|
25
|
+
opcode: typeof FileTransferOpcode.FileBegin;
|
|
26
|
+
requestId: string;
|
|
27
|
+
metadata: z.infer<typeof FileBeginMetadataSchema>;
|
|
28
|
+
payload: Uint8Array;
|
|
29
|
+
}
|
|
30
|
+
export interface FileChunk {
|
|
31
|
+
opcode: typeof FileTransferOpcode.FileChunk;
|
|
32
|
+
requestId: string;
|
|
33
|
+
payload: Uint8Array;
|
|
34
|
+
}
|
|
35
|
+
export interface FileEnd {
|
|
36
|
+
opcode: typeof FileTransferOpcode.FileEnd;
|
|
37
|
+
requestId: string;
|
|
38
|
+
payload: Uint8Array;
|
|
39
|
+
}
|
|
40
|
+
export type FileTransferFrame = FileBegin | FileChunk | FileEnd;
|
|
41
|
+
type FileTransferFrameInput = {
|
|
42
|
+
opcode: typeof FileTransferOpcode.FileBegin;
|
|
43
|
+
requestId: string;
|
|
44
|
+
metadata: z.infer<typeof FileBeginMetadataSchema>;
|
|
45
|
+
} | {
|
|
46
|
+
opcode: typeof FileTransferOpcode.FileChunk;
|
|
47
|
+
requestId: string;
|
|
48
|
+
payload?: Uint8Array | ArrayBuffer | string;
|
|
49
|
+
} | {
|
|
50
|
+
opcode: typeof FileTransferOpcode.FileEnd;
|
|
51
|
+
requestId: string;
|
|
52
|
+
};
|
|
53
|
+
export declare function encodeFileTransferFrame(input: FileTransferFrameInput): Uint8Array;
|
|
54
|
+
export declare function decodeFileTransferFrame(bytes: Uint8Array): FileTransferFrame | null;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=file-transfer.d.ts.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { asUint8Array } from "./terminal.js";
|
|
3
|
+
export const FileTransferOpcode = {
|
|
4
|
+
FileBegin: 0x10,
|
|
5
|
+
FileChunk: 0x11,
|
|
6
|
+
FileEnd: 0x12,
|
|
7
|
+
};
|
|
8
|
+
export const FileBeginMetadataSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
mime: z.string().min(1),
|
|
11
|
+
size: z.number().int().nonnegative(),
|
|
12
|
+
encoding: z.enum(["utf-8", "binary"]),
|
|
13
|
+
modifiedAt: z.string(),
|
|
14
|
+
})
|
|
15
|
+
.strict();
|
|
16
|
+
export function encodeFileTransferFrame(input) {
|
|
17
|
+
const requestId = encodeRequestId(input.requestId);
|
|
18
|
+
if (input.opcode === FileTransferOpcode.FileBegin) {
|
|
19
|
+
const metadata = encodeJsonPayload(input.metadata);
|
|
20
|
+
if (metadata.byteLength > 0xffff) {
|
|
21
|
+
throw new RangeError("FileBegin metadata is too long");
|
|
22
|
+
}
|
|
23
|
+
const bytes = new Uint8Array(4 + requestId.byteLength + metadata.byteLength);
|
|
24
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
25
|
+
bytes[0] = input.opcode;
|
|
26
|
+
bytes[1] = requestId.byteLength;
|
|
27
|
+
bytes.set(requestId, 2);
|
|
28
|
+
view.setUint16(2 + requestId.byteLength, metadata.byteLength);
|
|
29
|
+
bytes.set(metadata, 4 + requestId.byteLength);
|
|
30
|
+
return bytes;
|
|
31
|
+
}
|
|
32
|
+
const payload = input.opcode === FileTransferOpcode.FileChunk
|
|
33
|
+
? (asUint8Array(input.payload ?? new Uint8Array()) ?? new Uint8Array())
|
|
34
|
+
: new Uint8Array();
|
|
35
|
+
const bytes = new Uint8Array(2 + requestId.byteLength + payload.byteLength);
|
|
36
|
+
bytes[0] = input.opcode;
|
|
37
|
+
bytes[1] = requestId.byteLength;
|
|
38
|
+
bytes.set(requestId, 2);
|
|
39
|
+
bytes.set(payload, 2 + requestId.byteLength);
|
|
40
|
+
return bytes;
|
|
41
|
+
}
|
|
42
|
+
export function decodeFileTransferFrame(bytes) {
|
|
43
|
+
if (bytes.byteLength < 2) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const opcode = bytes[0];
|
|
47
|
+
if (!isFileTransferOpcode(opcode)) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const requestIdLength = bytes[1];
|
|
51
|
+
if (requestIdLength === 0 || requestIdLength > bytes.byteLength - 2) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const requestId = decodeRequestId(bytes.subarray(2, 2 + requestIdLength));
|
|
55
|
+
const body = bytes.subarray(2 + requestIdLength);
|
|
56
|
+
if (opcode === FileTransferOpcode.FileBegin) {
|
|
57
|
+
if (body.byteLength < 2) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const view = new DataView(body.buffer, body.byteOffset, body.byteLength);
|
|
61
|
+
const metadataLength = view.getUint16(0);
|
|
62
|
+
if (metadataLength !== body.byteLength - 2) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const metadataBytes = body.subarray(2);
|
|
66
|
+
const result = FileBeginMetadataSchema.safeParse(decodeJsonPayload(metadataBytes));
|
|
67
|
+
return result.success
|
|
68
|
+
? { opcode, requestId, metadata: result.data, payload: new Uint8Array() }
|
|
69
|
+
: null;
|
|
70
|
+
}
|
|
71
|
+
if (opcode === FileTransferOpcode.FileChunk) {
|
|
72
|
+
return { opcode, requestId, payload: body };
|
|
73
|
+
}
|
|
74
|
+
if (body.byteLength !== 0) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return { opcode, requestId, payload: new Uint8Array() };
|
|
78
|
+
}
|
|
79
|
+
function isFileTransferOpcode(value) {
|
|
80
|
+
return (value === FileTransferOpcode.FileBegin ||
|
|
81
|
+
value === FileTransferOpcode.FileChunk ||
|
|
82
|
+
value === FileTransferOpcode.FileEnd);
|
|
83
|
+
}
|
|
84
|
+
function encodeJsonPayload(value) {
|
|
85
|
+
return new TextEncoder().encode(JSON.stringify(value));
|
|
86
|
+
}
|
|
87
|
+
function encodeRequestId(requestId) {
|
|
88
|
+
const bytes = new TextEncoder().encode(requestId);
|
|
89
|
+
if (bytes.byteLength === 0) {
|
|
90
|
+
throw new RangeError("File transfer requestId is required");
|
|
91
|
+
}
|
|
92
|
+
if (bytes.byteLength > 0xff) {
|
|
93
|
+
throw new RangeError("File transfer requestId is too long");
|
|
94
|
+
}
|
|
95
|
+
return bytes;
|
|
96
|
+
}
|
|
97
|
+
function decodeRequestId(bytes) {
|
|
98
|
+
return new TextDecoder().decode(bytes);
|
|
99
|
+
}
|
|
100
|
+
function decodeJsonPayload(bytes) {
|
|
101
|
+
try {
|
|
102
|
+
return JSON.parse(new TextDecoder().decode(bytes));
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=file-transfer.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TerminalStateSchema } from "../messages.js";
|
|
3
|
+
export declare const TerminalStreamResizeSchema: z.ZodObject<{
|
|
4
|
+
rows: z.ZodNumber;
|
|
5
|
+
cols: z.ZodNumber;
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
7
|
+
rows: number;
|
|
8
|
+
cols: number;
|
|
9
|
+
}, {
|
|
10
|
+
rows: number;
|
|
11
|
+
cols: number;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const TerminalStreamOpcode: {
|
|
14
|
+
readonly Output: 1;
|
|
15
|
+
readonly Input: 2;
|
|
16
|
+
readonly Resize: 3;
|
|
17
|
+
readonly Snapshot: 4;
|
|
18
|
+
readonly Restore: 5;
|
|
19
|
+
};
|
|
20
|
+
export type TerminalStreamOpcode = (typeof TerminalStreamOpcode)[keyof typeof TerminalStreamOpcode];
|
|
21
|
+
export interface TerminalStreamFrame {
|
|
22
|
+
opcode: TerminalStreamOpcode;
|
|
23
|
+
slot: number;
|
|
24
|
+
payload: Uint8Array;
|
|
25
|
+
}
|
|
26
|
+
export declare function asUint8Array(data: unknown): Uint8Array | null;
|
|
27
|
+
export declare function encodeTerminalStreamFrame(input: {
|
|
28
|
+
opcode: TerminalStreamOpcode;
|
|
29
|
+
slot: number;
|
|
30
|
+
payload?: Uint8Array | ArrayBuffer | string;
|
|
31
|
+
}): Uint8Array;
|
|
32
|
+
export declare function decodeTerminalStreamFrame(bytes: Uint8Array): TerminalStreamFrame | null;
|
|
33
|
+
export declare function encodeTerminalSnapshotPayload(state: z.infer<typeof TerminalStateSchema>): Uint8Array;
|
|
34
|
+
export declare function decodeTerminalSnapshotPayload(bytes: Uint8Array): z.infer<typeof TerminalStateSchema> | null;
|
|
35
|
+
export declare function encodeTerminalResizePayload(input: z.infer<typeof TerminalStreamResizeSchema>): Uint8Array;
|
|
36
|
+
export declare function decodeTerminalResizePayload(bytes: Uint8Array): z.infer<typeof TerminalStreamResizeSchema> | null;
|
|
37
|
+
//# sourceMappingURL=terminal.d.ts.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TerminalStateSchema } from "../messages.js";
|
|
3
|
+
export const TerminalStreamResizeSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
rows: z.number().int().positive(),
|
|
6
|
+
cols: z.number().int().positive(),
|
|
7
|
+
})
|
|
8
|
+
.strict();
|
|
9
|
+
export const TerminalStreamOpcode = {
|
|
10
|
+
Output: 0x01,
|
|
11
|
+
Input: 0x02,
|
|
12
|
+
Resize: 0x03,
|
|
13
|
+
Snapshot: 0x04,
|
|
14
|
+
Restore: 0x05,
|
|
15
|
+
};
|
|
16
|
+
export function asUint8Array(data) {
|
|
17
|
+
if (typeof data === "string") {
|
|
18
|
+
if (typeof TextEncoder !== "undefined") {
|
|
19
|
+
return new TextEncoder().encode(data);
|
|
20
|
+
}
|
|
21
|
+
if (typeof Buffer !== "undefined") {
|
|
22
|
+
return new Uint8Array(Buffer.from(data, "utf8"));
|
|
23
|
+
}
|
|
24
|
+
const out = new Uint8Array(data.length);
|
|
25
|
+
for (let index = 0; index < data.length; index += 1) {
|
|
26
|
+
out[index] = data.charCodeAt(index) & 0xff;
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
if (data instanceof Uint8Array) {
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
if (typeof ArrayBuffer !== "undefined" && data instanceof ArrayBuffer) {
|
|
34
|
+
return new Uint8Array(data);
|
|
35
|
+
}
|
|
36
|
+
if (ArrayBuffer.isView(data)) {
|
|
37
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
38
|
+
}
|
|
39
|
+
if (typeof Buffer !== "undefined" && Buffer.isBuffer(data)) {
|
|
40
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
function isTerminalStreamOpcode(value) {
|
|
45
|
+
return (value === TerminalStreamOpcode.Output ||
|
|
46
|
+
value === TerminalStreamOpcode.Input ||
|
|
47
|
+
value === TerminalStreamOpcode.Resize ||
|
|
48
|
+
value === TerminalStreamOpcode.Snapshot ||
|
|
49
|
+
value === TerminalStreamOpcode.Restore);
|
|
50
|
+
}
|
|
51
|
+
export function encodeTerminalStreamFrame(input) {
|
|
52
|
+
const payload = asUint8Array(input.payload ?? new Uint8Array(0)) ?? new Uint8Array(0);
|
|
53
|
+
const bytes = new Uint8Array(2 + payload.byteLength);
|
|
54
|
+
bytes[0] = input.opcode;
|
|
55
|
+
bytes[1] = input.slot & 0xff;
|
|
56
|
+
bytes.set(payload, 2);
|
|
57
|
+
return bytes;
|
|
58
|
+
}
|
|
59
|
+
export function decodeTerminalStreamFrame(bytes) {
|
|
60
|
+
if (bytes.byteLength < 2) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const opcode = bytes[0];
|
|
64
|
+
if (!isTerminalStreamOpcode(opcode)) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
opcode,
|
|
69
|
+
slot: bytes[1],
|
|
70
|
+
payload: bytes.subarray(2),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export function encodeTerminalSnapshotPayload(state) {
|
|
74
|
+
return encodeJsonPayload(state);
|
|
75
|
+
}
|
|
76
|
+
export function decodeTerminalSnapshotPayload(bytes) {
|
|
77
|
+
const parsed = decodeJsonPayload(bytes);
|
|
78
|
+
const result = TerminalStateSchema.safeParse(parsed);
|
|
79
|
+
return result.success ? result.data : null;
|
|
80
|
+
}
|
|
81
|
+
export function encodeTerminalResizePayload(input) {
|
|
82
|
+
return encodeJsonPayload(input);
|
|
83
|
+
}
|
|
84
|
+
export function decodeTerminalResizePayload(bytes) {
|
|
85
|
+
const parsed = decodeJsonPayload(bytes);
|
|
86
|
+
const result = TerminalStreamResizeSchema.safeParse(parsed);
|
|
87
|
+
return result.success ? result.data : null;
|
|
88
|
+
}
|
|
89
|
+
function encodeJsonPayload(value) {
|
|
90
|
+
return new TextEncoder().encode(JSON.stringify(value));
|
|
91
|
+
}
|
|
92
|
+
function decodeJsonPayload(bytes) {
|
|
93
|
+
try {
|
|
94
|
+
const text = new TextDecoder().decode(bytes);
|
|
95
|
+
return JSON.parse(text);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=terminal.js.map
|