@getmateo/protocol 0.0.0-stage → 0.17.1
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/LICENSE +211 -0
- package/README.md +11 -2
- package/dist/addresses.d.ts +6 -0
- package/dist/addresses.js +2 -0
- package/dist/agent-attention-notification.d.ts +57 -0
- package/dist/agent-attention-notification.js +177 -0
- package/dist/agent-deep-link.d.ts +8 -0
- package/dist/agent-deep-link.js +49 -0
- package/dist/agent-labels.d.ts +14 -0
- package/dist/agent-labels.js +38 -0
- package/dist/agent-lifecycle.d.ts +3 -0
- package/dist/agent-lifecycle.js +8 -0
- package/dist/agent-message.d.ts +20 -0
- package/dist/agent-message.js +12 -0
- package/dist/agent-profile.d.ts +31 -0
- package/dist/agent-profile.js +32 -0
- package/dist/agent-runtime-config.d.ts +4 -0
- package/dist/agent-runtime-config.js +5 -0
- package/dist/agent-shells.d.ts +25 -0
- package/dist/agent-shells.js +17 -0
- package/dist/agent-state-bucket.d.ts +15 -0
- package/dist/agent-state-bucket.js +41 -0
- package/dist/agent-title-limits.d.ts +2 -0
- package/dist/agent-title-limits.js +2 -0
- package/dist/agent-types.d.ts +484 -0
- package/dist/agent-types.js +33 -0
- package/dist/binary-frames/demux.d.ts +15 -0
- package/dist/binary-frames/demux.js +28 -0
- package/dist/binary-frames/file-transfer.d.ts +51 -0
- package/dist/binary-frames/file-transfer.js +108 -0
- package/dist/binary-frames/host-route.d.ts +13 -0
- package/dist/binary-frames/host-route.js +39 -0
- package/dist/binary-frames/index.d.ts +5 -0
- package/dist/binary-frames/index.js +5 -0
- package/dist/binary-frames/terminal.d.ts +35 -0
- package/dist/binary-frames/terminal.js +100 -0
- package/dist/branch-slug.d.ts +14 -0
- package/dist/branch-slug.js +49 -0
- package/dist/browser-automation/capabilities.d.ts +7 -0
- package/dist/browser-automation/capabilities.js +31 -0
- package/dist/browser-automation/rpc-schemas.d.ts +1113 -0
- package/dist/browser-automation/rpc-schemas.js +463 -0
- package/dist/build-metadata.d.ts +17 -0
- package/dist/build-metadata.js +61 -0
- package/dist/chat/rpc-schemas.d.ts +158 -0
- package/dist/chat/rpc-schemas.js +104 -0
- package/dist/chat/types.d.ts +30 -0
- package/dist/chat/types.js +23 -0
- package/dist/check-traits.d.ts +11 -0
- package/dist/check-traits.js +10 -0
- package/dist/chunked-transport.d.ts +42 -0
- package/dist/chunked-transport.js +277 -0
- package/dist/client-capabilities.d.ts +24 -0
- package/dist/client-capabilities.js +52 -0
- package/dist/connection-offer.d.ts +36 -0
- package/dist/connection-offer.js +53 -0
- package/dist/daemon-auth.d.ts +548 -0
- package/dist/daemon-auth.js +152 -0
- package/dist/daemon-endpoints.d.ts +54 -0
- package/dist/daemon-endpoints.js +243 -0
- package/dist/error-utils.d.ts +11 -0
- package/dist/error-utils.js +27 -0
- package/dist/fleet.d.ts +381 -0
- package/dist/fleet.js +134 -0
- package/dist/forge-manifest.d.ts +66 -0
- package/dist/forge-manifest.js +92 -0
- package/dist/generated/validation/ws-outbound-schema-metadata.d.ts +14023 -0
- package/dist/generated/validation/ws-outbound-schema-metadata.js +258 -0
- package/dist/generated/validation/ws-outbound.aot.d.ts +512 -0
- package/dist/generated/validation/ws-outbound.aot.js +105425 -0
- package/dist/git-remote.d.ts +33 -0
- package/dist/git-remote.js +94 -0
- package/dist/gitea-status.d.ts +10 -0
- package/dist/gitea-status.js +23 -0
- package/dist/gitlab-pipeline.d.ts +10 -0
- package/dist/gitlab-pipeline.js +17 -0
- package/dist/global-terminal.d.ts +3 -0
- package/dist/global-terminal.js +8 -0
- package/dist/host-connection-schema.d.ts +11 -0
- package/dist/host-connection-schema.js +9 -0
- package/dist/host-target.d.ts +20 -0
- package/dist/host-target.js +137 -0
- package/dist/hosts.d.ts +133 -0
- package/dist/hosts.js +82 -0
- package/dist/literal-union.d.ts +2 -0
- package/dist/literal-union.js +2 -0
- package/dist/loop/rpc-schemas.d.ts +636 -0
- package/dist/loop/rpc-schemas.js +164 -0
- package/dist/mateo-config-schema.d.ts +138 -0
- package/dist/mateo-config-schema.js +98 -0
- package/dist/mateo-tool-call-detail.d.ts +2 -0
- package/dist/mateo-tool-call-detail.js +3 -0
- package/dist/mateo-tool-presentation/agent-message.d.ts +10 -0
- package/dist/mateo-tool-presentation/agent-message.js +23 -0
- package/dist/mateo-tool-presentation/catalog.d.ts +320 -0
- package/dist/mateo-tool-presentation/catalog.js +318 -0
- package/dist/mateo-tool-presentation/detail-sections.d.ts +15 -0
- package/dist/mateo-tool-presentation/detail-sections.js +161 -0
- package/dist/mateo-tool-presentation/index.d.ts +22 -0
- package/dist/mateo-tool-presentation/index.js +62 -0
- package/dist/mateo-tool-presentation/summary-text.d.ts +7 -0
- package/dist/mateo-tool-presentation/summary-text.js +22 -0
- package/dist/messages.d.ts +69382 -0
- package/dist/messages.js +6717 -0
- package/dist/path-utils.d.ts +2 -0
- package/dist/path-utils.js +16 -0
- package/dist/plugin-config.d.ts +18 -0
- package/dist/plugin-config.js +13 -0
- package/dist/plugin-overview.d.ts +12 -0
- package/dist/plugin-overview.js +50 -0
- package/dist/plugin-registry.d.ts +153 -0
- package/dist/plugin-registry.js +83 -0
- package/dist/plugin-requirements.d.ts +11 -0
- package/dist/plugin-requirements.js +26 -0
- package/dist/plugin-source-reference.d.ts +11 -0
- package/dist/plugin-source-reference.js +68 -0
- package/dist/provider-config.d.ts +141 -0
- package/dist/provider-config.js +113 -0
- package/dist/provider-icon-names.d.ts +5 -0
- package/dist/provider-icon-names.js +54 -0
- package/dist/provider-manifest.d.ts +30 -0
- package/dist/provider-manifest.js +247 -0
- package/dist/provider-snapshot-codec.d.ts +18 -0
- package/dist/provider-snapshot-codec.js +71 -0
- package/dist/schedule/cadence.d.ts +6 -0
- package/dist/schedule/cadence.js +28 -0
- package/dist/schedule/cron-expression.d.ts +14 -0
- package/dist/schedule/cron-expression.js +107 -0
- package/dist/schedule/rpc-schemas.d.ts +570 -0
- package/dist/schedule/rpc-schemas.js +158 -0
- package/dist/schedule/types.d.ts +201 -0
- package/dist/schedule/types.js +68 -0
- package/dist/search/text-match.d.ts +78 -0
- package/dist/search/text-match.js +330 -0
- package/dist/service-defaults.d.ts +3 -0
- package/dist/service-defaults.js +5 -0
- package/dist/ssh-transport.d.ts +11 -0
- package/dist/ssh-transport.js +72 -0
- package/dist/terminal-activity.d.ts +21 -0
- package/dist/terminal-activity.js +25 -0
- package/dist/terminal-input-mode.d.ts +30 -0
- package/dist/terminal-input-mode.js +180 -0
- package/dist/terminal-key-input.d.ts +13 -0
- package/dist/terminal-key-input.js +210 -0
- package/dist/terminal-profile.d.ts +10 -0
- package/dist/terminal-profile.js +11 -0
- package/dist/terminal-profiles.d.ts +41 -0
- package/dist/terminal-profiles.js +276 -0
- package/dist/terminal-snapshot.d.ts +4 -0
- package/dist/terminal-snapshot.js +220 -0
- package/dist/terminal-stream-protocol.d.ts +2 -0
- package/dist/terminal-stream-protocol.js +2 -0
- package/dist/terminal-subscription-key.d.ts +2 -0
- package/dist/terminal-subscription-key.js +9 -0
- package/dist/timeline-identity.d.ts +3 -0
- package/dist/timeline-identity.js +8 -0
- package/dist/tool-call-display.d.ts +13 -0
- package/dist/tool-call-display.js +144 -0
- package/dist/tool-name-normalization.d.ts +9 -0
- package/dist/tool-name-normalization.js +82 -0
- package/dist/user-agent.d.ts +26 -0
- package/dist/user-agent.js +101 -0
- package/dist/validation/ws-outbound-envelope.d.ts +13261 -0
- package/dist/validation/ws-outbound-envelope.js +17 -0
- package/dist/validation/ws-outbound.d.ts +12 -0
- package/dist/validation/ws-outbound.js +38 -0
- package/dist/websocket-message-limit.d.ts +5 -0
- package/dist/websocket-message-limit.js +5 -0
- package/dist/workspace-labels.d.ts +9 -0
- package/dist/workspace-labels.js +19 -0
- package/package.json +43 -4
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ChatMessageSchema, ChatRoomDetailSchema } from "./types.js";
|
|
3
|
+
// COMPAT(chatRooms): retained after the v0.3.0 feature removal; remove after 2027-02-09 when mixed-version peers no longer send legacy messages.
|
|
4
|
+
export const ChatCreateRequestSchema = z.object({
|
|
5
|
+
type: z.literal("chat/create"),
|
|
6
|
+
requestId: z.string(),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
purpose: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
export const ChatListRequestSchema = z.object({
|
|
11
|
+
type: z.literal("chat/list"),
|
|
12
|
+
requestId: z.string(),
|
|
13
|
+
});
|
|
14
|
+
export const ChatInspectRequestSchema = z.object({
|
|
15
|
+
type: z.literal("chat/inspect"),
|
|
16
|
+
requestId: z.string(),
|
|
17
|
+
room: z.string(),
|
|
18
|
+
});
|
|
19
|
+
export const ChatDeleteRequestSchema = z.object({
|
|
20
|
+
type: z.literal("chat/delete"),
|
|
21
|
+
requestId: z.string(),
|
|
22
|
+
room: z.string(),
|
|
23
|
+
});
|
|
24
|
+
export const ChatPostRequestSchema = z.object({
|
|
25
|
+
type: z.literal("chat/post"),
|
|
26
|
+
requestId: z.string(),
|
|
27
|
+
room: z.string(),
|
|
28
|
+
body: z.string(),
|
|
29
|
+
authorAgentId: z.string().optional(),
|
|
30
|
+
replyToMessageId: z.string().optional(),
|
|
31
|
+
});
|
|
32
|
+
export const ChatReadRequestSchema = z.object({
|
|
33
|
+
type: z.literal("chat/read"),
|
|
34
|
+
requestId: z.string(),
|
|
35
|
+
room: z.string(),
|
|
36
|
+
limit: z.number().int().nonnegative().optional(),
|
|
37
|
+
since: z.string().optional(),
|
|
38
|
+
authorAgentId: z.string().optional(),
|
|
39
|
+
});
|
|
40
|
+
export const ChatWaitRequestSchema = z.object({
|
|
41
|
+
type: z.literal("chat/wait"),
|
|
42
|
+
requestId: z.string(),
|
|
43
|
+
room: z.string(),
|
|
44
|
+
afterMessageId: z.string().optional(),
|
|
45
|
+
timeoutMs: z.number().int().nonnegative().optional(),
|
|
46
|
+
});
|
|
47
|
+
export const ChatCreateResponseSchema = z.object({
|
|
48
|
+
type: z.literal("chat/create/response"),
|
|
49
|
+
payload: z.object({
|
|
50
|
+
requestId: z.string(),
|
|
51
|
+
room: ChatRoomDetailSchema.nullable(),
|
|
52
|
+
error: z.string().nullable(),
|
|
53
|
+
}),
|
|
54
|
+
});
|
|
55
|
+
export const ChatListResponseSchema = z.object({
|
|
56
|
+
type: z.literal("chat/list/response"),
|
|
57
|
+
payload: z.object({
|
|
58
|
+
requestId: z.string(),
|
|
59
|
+
rooms: z.array(ChatRoomDetailSchema),
|
|
60
|
+
error: z.string().nullable(),
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
export const ChatInspectResponseSchema = z.object({
|
|
64
|
+
type: z.literal("chat/inspect/response"),
|
|
65
|
+
payload: z.object({
|
|
66
|
+
requestId: z.string(),
|
|
67
|
+
room: ChatRoomDetailSchema.nullable(),
|
|
68
|
+
error: z.string().nullable(),
|
|
69
|
+
}),
|
|
70
|
+
});
|
|
71
|
+
export const ChatDeleteResponseSchema = z.object({
|
|
72
|
+
type: z.literal("chat/delete/response"),
|
|
73
|
+
payload: z.object({
|
|
74
|
+
requestId: z.string(),
|
|
75
|
+
room: ChatRoomDetailSchema.nullable(),
|
|
76
|
+
error: z.string().nullable(),
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
79
|
+
export const ChatPostResponseSchema = z.object({
|
|
80
|
+
type: z.literal("chat/post/response"),
|
|
81
|
+
payload: z.object({
|
|
82
|
+
requestId: z.string(),
|
|
83
|
+
message: ChatMessageSchema.nullable(),
|
|
84
|
+
error: z.string().nullable(),
|
|
85
|
+
}),
|
|
86
|
+
});
|
|
87
|
+
export const ChatReadResponseSchema = z.object({
|
|
88
|
+
type: z.literal("chat/read/response"),
|
|
89
|
+
payload: z.object({
|
|
90
|
+
requestId: z.string(),
|
|
91
|
+
messages: z.array(ChatMessageSchema),
|
|
92
|
+
error: z.string().nullable(),
|
|
93
|
+
}),
|
|
94
|
+
});
|
|
95
|
+
export const ChatWaitResponseSchema = z.object({
|
|
96
|
+
type: z.literal("chat/wait/response"),
|
|
97
|
+
payload: z.object({
|
|
98
|
+
requestId: z.string(),
|
|
99
|
+
messages: z.array(ChatMessageSchema),
|
|
100
|
+
timedOut: z.boolean(),
|
|
101
|
+
error: z.string().nullable(),
|
|
102
|
+
}),
|
|
103
|
+
});
|
|
104
|
+
//# sourceMappingURL=rpc-schemas.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ChatRoomSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
purpose: z.ZodNullable<z.ZodString>;
|
|
6
|
+
createdAt: z.ZodString;
|
|
7
|
+
updatedAt: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type ChatRoom = z.infer<typeof ChatRoomSchema>;
|
|
10
|
+
export declare const ChatMessageSchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
roomId: z.ZodString;
|
|
13
|
+
authorAgentId: z.ZodString;
|
|
14
|
+
body: z.ZodString;
|
|
15
|
+
replyToMessageId: z.ZodNullable<z.ZodString>;
|
|
16
|
+
mentionAgentIds: z.ZodArray<z.ZodString>;
|
|
17
|
+
createdAt: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type ChatMessage = z.infer<typeof ChatMessageSchema>;
|
|
20
|
+
export declare const ChatRoomDetailSchema: z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
purpose: z.ZodNullable<z.ZodString>;
|
|
24
|
+
createdAt: z.ZodString;
|
|
25
|
+
updatedAt: z.ZodString;
|
|
26
|
+
messageCount: z.ZodNumber;
|
|
27
|
+
lastMessageAt: z.ZodNullable<z.ZodString>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export type ChatRoomDetail = z.infer<typeof ChatRoomDetailSchema>;
|
|
30
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// COMPAT(chatRooms): retained after the v0.3.0 feature removal; remove after 2027-02-09 when mixed-version peers no longer send legacy messages.
|
|
3
|
+
export const ChatRoomSchema = z.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
purpose: z.string().nullable(),
|
|
7
|
+
createdAt: z.string(),
|
|
8
|
+
updatedAt: z.string(),
|
|
9
|
+
});
|
|
10
|
+
export const ChatMessageSchema = z.object({
|
|
11
|
+
id: z.string(),
|
|
12
|
+
roomId: z.string(),
|
|
13
|
+
authorAgentId: z.string(),
|
|
14
|
+
body: z.string(),
|
|
15
|
+
replyToMessageId: z.string().nullable(),
|
|
16
|
+
mentionAgentIds: z.array(z.string()),
|
|
17
|
+
createdAt: z.string(),
|
|
18
|
+
});
|
|
19
|
+
export const ChatRoomDetailSchema = ChatRoomSchema.extend({
|
|
20
|
+
messageCount: z.number().int().nonnegative(),
|
|
21
|
+
lastMessageAt: z.string().nullable(),
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forge-neutral check traits carried on the wire alongside the stable check
|
|
3
|
+
* status union. Traits are open-ended by design (unknown values must be
|
|
4
|
+
* ignored by consumers); these constants cover the traits the shipped forges
|
|
5
|
+
* emit today so producers and the presentation layer cannot drift apart.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CHECK_TRAIT_MANUAL = "manual";
|
|
8
|
+
export declare const CHECK_TRAIT_ACTION_REQUIRED = "action_required";
|
|
9
|
+
export declare const CHECK_TRAIT_WARNING = "warning";
|
|
10
|
+
export type KnownCheckTrait = typeof CHECK_TRAIT_MANUAL | typeof CHECK_TRAIT_ACTION_REQUIRED | typeof CHECK_TRAIT_WARNING;
|
|
11
|
+
//# sourceMappingURL=check-traits.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forge-neutral check traits carried on the wire alongside the stable check
|
|
3
|
+
* status union. Traits are open-ended by design (unknown values must be
|
|
4
|
+
* ignored by consumers); these constants cover the traits the shipped forges
|
|
5
|
+
* emit today so producers and the presentation layer cannot drift apart.
|
|
6
|
+
*/
|
|
7
|
+
export const CHECK_TRAIT_MANUAL = "manual";
|
|
8
|
+
export const CHECK_TRAIT_ACTION_REQUIRED = "action_required";
|
|
9
|
+
export const CHECK_TRAIT_WARNING = "warning";
|
|
10
|
+
//# sourceMappingURL=check-traits.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
private readonly drainWaiters;
|
|
17
|
+
constructor(io: {
|
|
18
|
+
frameBytes: number;
|
|
19
|
+
supportsDrain?: boolean;
|
|
20
|
+
/** Writes are admitted synchronously in order; promises track only their drain. */
|
|
21
|
+
supportsConcurrentWrites?: boolean;
|
|
22
|
+
send: (frame: Frame, waitForDrain: boolean) => void | Promise<void>;
|
|
23
|
+
deliver: (frame: Frame) => void;
|
|
24
|
+
onFailure?: (error: unknown) => void;
|
|
25
|
+
onProgress?: () => void;
|
|
26
|
+
});
|
|
27
|
+
/** Bytes waiting behind the active write; physical buffering owns the active frame. */
|
|
28
|
+
get queuedByteLength(): number;
|
|
29
|
+
get isWriting(): boolean;
|
|
30
|
+
send(frame: Frame, options?: {
|
|
31
|
+
waitForDrain?: boolean;
|
|
32
|
+
byteLength?: number;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
private sendChunks;
|
|
35
|
+
receive(frame: Frame): void;
|
|
36
|
+
private assemble;
|
|
37
|
+
private waitForDrain;
|
|
38
|
+
private fail;
|
|
39
|
+
close(): void;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=chunked-transport.d.ts.map
|
|
@@ -0,0 +1,277 @@
|
|
|
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
|
+
// Keep a single physical write short enough that heartbeat controls can pass on slow links.
|
|
9
|
+
const PACED_FRAME_BYTES = 256 * 1024;
|
|
10
|
+
/** Connection-scoped ordered framing, below serialization and routing, above encryption. */
|
|
11
|
+
export class ChunkedTransport {
|
|
12
|
+
constructor(io) {
|
|
13
|
+
this.io = io;
|
|
14
|
+
this.enabled = false;
|
|
15
|
+
this.size = 0;
|
|
16
|
+
this.kind = 0;
|
|
17
|
+
this.closed = false;
|
|
18
|
+
this.queuedBytes = 0;
|
|
19
|
+
this.activeBytes = 0;
|
|
20
|
+
this.drainWaiters = new Set();
|
|
21
|
+
assertFrameBudget(io.frameBytes);
|
|
22
|
+
}
|
|
23
|
+
/** Bytes waiting behind the active write; physical buffering owns the active frame. */
|
|
24
|
+
get queuedByteLength() {
|
|
25
|
+
return this.queuedBytes - this.activeBytes;
|
|
26
|
+
}
|
|
27
|
+
get isWriting() {
|
|
28
|
+
return this.pending !== undefined;
|
|
29
|
+
}
|
|
30
|
+
send(frame, options = {}) {
|
|
31
|
+
assertFrameBudget(this.io.frameBytes);
|
|
32
|
+
const byteLength = options.byteLength ?? frameByteLength(frame);
|
|
33
|
+
if (byteLength > MAX_WEBSOCKET_MESSAGE_BYTES)
|
|
34
|
+
throw new Error("Logical message too large");
|
|
35
|
+
const control = this.enabled && isHeartbeatControl(frame);
|
|
36
|
+
const chunk = !control &&
|
|
37
|
+
this.enabled &&
|
|
38
|
+
this.io.supportsDrain !== false &&
|
|
39
|
+
byteLength > Math.min(this.io.frameBytes, PACED_FRAME_BYTES);
|
|
40
|
+
if (this.closed)
|
|
41
|
+
throw new Error("Transport closed");
|
|
42
|
+
let started = false;
|
|
43
|
+
const write = () => {
|
|
44
|
+
if (this.closed)
|
|
45
|
+
throw new Error("Transport closed");
|
|
46
|
+
started = true;
|
|
47
|
+
this.activeBytes += byteLength;
|
|
48
|
+
// A synchronous rejection did not admit a frame. Only accepted writes can
|
|
49
|
+
// fail the connection; queued admission failures still belong to their sender.
|
|
50
|
+
const result = chunk
|
|
51
|
+
? this.sendChunks(typeof frame === "string" ? new TextEncoder().encode(frame) : frame, typeof frame === "string")
|
|
52
|
+
: this.io.send(frame, options.waitForDrain === true);
|
|
53
|
+
if (!result)
|
|
54
|
+
return;
|
|
55
|
+
return this.waitForDrain(result).catch((error) => {
|
|
56
|
+
this.fail(error);
|
|
57
|
+
throw error;
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
if (this.queuedBytes + byteLength > MAX_WEBSOCKET_MESSAGE_BYTES) {
|
|
61
|
+
const error = new Error("Logical output queue exceeded its byte limit");
|
|
62
|
+
this.fail(error);
|
|
63
|
+
const rejected = Promise.reject(error);
|
|
64
|
+
void rejected.catch(() => { });
|
|
65
|
+
return rejected;
|
|
66
|
+
}
|
|
67
|
+
this.queuedBytes += byteLength;
|
|
68
|
+
if (control) {
|
|
69
|
+
// Only transport heartbeat controls bypass logical ordering, never application RPCs.
|
|
70
|
+
// The physical socket still preserves wire order and enforces its high-water bound.
|
|
71
|
+
let result;
|
|
72
|
+
try {
|
|
73
|
+
result = this.io.send(frame, options.waitForDrain === true);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
this.queuedBytes -= byteLength;
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
if (!result) {
|
|
80
|
+
this.queuedBytes -= byteLength;
|
|
81
|
+
return Promise.resolve();
|
|
82
|
+
}
|
|
83
|
+
return this.waitForDrain(result)
|
|
84
|
+
.catch((error) => {
|
|
85
|
+
this.fail(error);
|
|
86
|
+
throw error;
|
|
87
|
+
})
|
|
88
|
+
.finally(() => {
|
|
89
|
+
this.queuedBytes -= byteLength;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
let result;
|
|
93
|
+
try {
|
|
94
|
+
result = this.pending ? this.pending.then(write) : write();
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
this.queuedBytes -= byteLength;
|
|
98
|
+
if (started)
|
|
99
|
+
this.activeBytes -= byteLength;
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
if (!result) {
|
|
103
|
+
this.queuedBytes -= byteLength;
|
|
104
|
+
if (started)
|
|
105
|
+
this.activeBytes -= byteLength;
|
|
106
|
+
return Promise.resolve();
|
|
107
|
+
}
|
|
108
|
+
const completion = Promise.resolve(result).finally(() => {
|
|
109
|
+
this.queuedBytes -= byteLength;
|
|
110
|
+
if (started)
|
|
111
|
+
this.activeBytes -= byteLength;
|
|
112
|
+
});
|
|
113
|
+
// Ordinary writes already entered an ordered writer and can use its bounded
|
|
114
|
+
// window. Chunk sequences remain a barrier so their frames never interleave.
|
|
115
|
+
if (chunk || !this.io.supportsConcurrentWrites) {
|
|
116
|
+
const tail = completion.then(() => undefined, () => undefined);
|
|
117
|
+
this.pending = tail;
|
|
118
|
+
void tail.then(() => {
|
|
119
|
+
if (this.pending === tail)
|
|
120
|
+
this.pending = undefined;
|
|
121
|
+
return undefined;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return completion;
|
|
125
|
+
}
|
|
126
|
+
sendChunks(bytes, text) {
|
|
127
|
+
const capacity = Math.min(this.io.frameBytes, PACED_FRAME_BYTES) - HEADER;
|
|
128
|
+
const writeChunk = (offset) => {
|
|
129
|
+
if (this.closed)
|
|
130
|
+
throw new Error("Transport closed");
|
|
131
|
+
const end = Math.min(bytes.byteLength, offset + capacity);
|
|
132
|
+
const wire = new Uint8Array(HEADER + end - offset);
|
|
133
|
+
wire.set([
|
|
134
|
+
OPCODE,
|
|
135
|
+
1,
|
|
136
|
+
text ? 0 : 1,
|
|
137
|
+
(offset === 0 ? 1 : 0) | (end === bytes.byteLength ? 2 : 0),
|
|
138
|
+
]);
|
|
139
|
+
wire.set(bytes.subarray(offset, end), HEADER);
|
|
140
|
+
const result = this.io.send(wire, true);
|
|
141
|
+
return result ? this.waitForDrain(result) : undefined;
|
|
142
|
+
};
|
|
143
|
+
const first = writeChunk(0);
|
|
144
|
+
return (async () => {
|
|
145
|
+
await first;
|
|
146
|
+
for (let offset = capacity; offset < bytes.byteLength; offset += capacity)
|
|
147
|
+
await writeChunk(offset);
|
|
148
|
+
})();
|
|
149
|
+
}
|
|
150
|
+
receive(frame) {
|
|
151
|
+
if (this.closed)
|
|
152
|
+
return;
|
|
153
|
+
let message;
|
|
154
|
+
try {
|
|
155
|
+
message = this.assemble(frame);
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
this.close();
|
|
159
|
+
throw new ChunkedTransportProtocolError(error instanceof Error ? error.message : String(error), { cause: error });
|
|
160
|
+
}
|
|
161
|
+
if (typeof frame !== "string" && frame[0] === OPCODE)
|
|
162
|
+
this.io.onProgress?.();
|
|
163
|
+
if (message !== undefined)
|
|
164
|
+
this.io.deliver(message);
|
|
165
|
+
}
|
|
166
|
+
assemble(frame) {
|
|
167
|
+
if (typeof frame === "string" || frame[0] !== OPCODE) {
|
|
168
|
+
if (this.assembly && !isHeartbeatControl(frame))
|
|
169
|
+
throw new Error("Interrupted chunked message");
|
|
170
|
+
return frame;
|
|
171
|
+
}
|
|
172
|
+
if (!this.enabled ||
|
|
173
|
+
frame.length <= HEADER ||
|
|
174
|
+
frame[1] !== 1 ||
|
|
175
|
+
frame[2] > 1 ||
|
|
176
|
+
(frame[3] & ~3) !== 0)
|
|
177
|
+
throw new Error("Invalid chunk header");
|
|
178
|
+
const start = (frame[3] & 1) !== 0;
|
|
179
|
+
const end = (frame[3] & 2) !== 0;
|
|
180
|
+
if (start === !!this.assembly)
|
|
181
|
+
throw new Error("Invalid chunk sequence");
|
|
182
|
+
if (start) {
|
|
183
|
+
this.assembly = new Uint8Array(0);
|
|
184
|
+
this.kind = frame[2];
|
|
185
|
+
this.size = 0;
|
|
186
|
+
}
|
|
187
|
+
if (frame[2] !== this.kind)
|
|
188
|
+
throw new Error("Chunk kind changed");
|
|
189
|
+
this.size += frame.length - HEADER;
|
|
190
|
+
if (this.size > MAX_WEBSOCKET_MESSAGE_BYTES)
|
|
191
|
+
throw new Error("Logical message too large");
|
|
192
|
+
const payload = frame.subarray(HEADER);
|
|
193
|
+
if (this.assembly.byteLength < this.size) {
|
|
194
|
+
const capacity = Math.min(MAX_WEBSOCKET_MESSAGE_BYTES, Math.max(this.size, this.assembly.byteLength * 2, 16384));
|
|
195
|
+
const grown = new Uint8Array(capacity);
|
|
196
|
+
grown.set(this.assembly.subarray(0, this.size - payload.byteLength));
|
|
197
|
+
this.assembly = grown;
|
|
198
|
+
}
|
|
199
|
+
this.assembly.set(payload, this.size - payload.byteLength);
|
|
200
|
+
if (!end)
|
|
201
|
+
return;
|
|
202
|
+
const data = this.assembly.subarray(0, this.size);
|
|
203
|
+
this.assembly = undefined;
|
|
204
|
+
this.size = 0;
|
|
205
|
+
return this.kind === 0 ? new TextDecoder("utf-8", { fatal: true }).decode(data) : data.slice();
|
|
206
|
+
}
|
|
207
|
+
waitForDrain(pending) {
|
|
208
|
+
// Do not retain an abandoned physical promise's logical queue or encoded message.
|
|
209
|
+
// The physical owner can close without ever invoking its send callback.
|
|
210
|
+
const waiters = this.drainWaiters;
|
|
211
|
+
let finish;
|
|
212
|
+
const result = new Promise((resolve, reject) => {
|
|
213
|
+
finish = (error) => {
|
|
214
|
+
if (error)
|
|
215
|
+
reject(error);
|
|
216
|
+
else
|
|
217
|
+
resolve();
|
|
218
|
+
};
|
|
219
|
+
});
|
|
220
|
+
const settle = (error) => {
|
|
221
|
+
const callback = finish;
|
|
222
|
+
finish = undefined;
|
|
223
|
+
waiters.delete(settle);
|
|
224
|
+
callback?.(error);
|
|
225
|
+
};
|
|
226
|
+
waiters.add(settle);
|
|
227
|
+
void pending.then(() => settle(), (error) => settle(error instanceof Error ? error : new Error(String(error))));
|
|
228
|
+
return result;
|
|
229
|
+
}
|
|
230
|
+
fail(error) {
|
|
231
|
+
if (this.closed)
|
|
232
|
+
return;
|
|
233
|
+
this.close();
|
|
234
|
+
this.io.onFailure?.(error);
|
|
235
|
+
}
|
|
236
|
+
close() {
|
|
237
|
+
if (this.closed)
|
|
238
|
+
return;
|
|
239
|
+
this.closed = true;
|
|
240
|
+
this.enabled = false;
|
|
241
|
+
this.assembly = undefined;
|
|
242
|
+
this.size = 0;
|
|
243
|
+
const error = new Error("Transport closed");
|
|
244
|
+
for (const cancel of this.drainWaiters)
|
|
245
|
+
cancel(error);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function isHeartbeatControl(frame) {
|
|
249
|
+
return frame === '{"type":"ping"}' || frame === '{"type":"pong"}';
|
|
250
|
+
}
|
|
251
|
+
function assertFrameBudget(bytes) {
|
|
252
|
+
if (!Number.isSafeInteger(bytes) || bytes <= HEADER)
|
|
253
|
+
throw new Error("Invalid transport frame budget");
|
|
254
|
+
}
|
|
255
|
+
function frameByteLength(frame) {
|
|
256
|
+
if (typeof frame !== "string")
|
|
257
|
+
return frame.byteLength;
|
|
258
|
+
let bytes = 0;
|
|
259
|
+
for (let index = 0; index < frame.length; index++) {
|
|
260
|
+
const code = frame.charCodeAt(index);
|
|
261
|
+
if (code <= 0x7f)
|
|
262
|
+
bytes++;
|
|
263
|
+
else if (code <= 0x7ff)
|
|
264
|
+
bytes += 2;
|
|
265
|
+
else if (code >= 0xd800 &&
|
|
266
|
+
code <= 0xdbff &&
|
|
267
|
+
frame.charCodeAt(index + 1) >= 0xdc00 &&
|
|
268
|
+
frame.charCodeAt(index + 1) <= 0xdfff) {
|
|
269
|
+
bytes += 4;
|
|
270
|
+
index++;
|
|
271
|
+
}
|
|
272
|
+
else
|
|
273
|
+
bytes += 3;
|
|
274
|
+
}
|
|
275
|
+
return bytes;
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=chunked-transport.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const CLIENT_CAPS: {
|
|
2
|
+
readonly binaryChunkingV1: "binary_chunking_v1";
|
|
3
|
+
readonly helloRejection: "hello_rejection";
|
|
4
|
+
readonly ownedSubscriptions: "owned_subscriptions";
|
|
5
|
+
readonly explicitEventSubscriptions: "explicit_event_subscriptions";
|
|
6
|
+
readonly allProviders: "all_providers";
|
|
7
|
+
readonly selectiveAgentTimeline: "selective_agent_timeline";
|
|
8
|
+
readonly reasoningMergeEnum: "reasoning_merge_enum";
|
|
9
|
+
readonly customModeIcons: "custom_mode_icons";
|
|
10
|
+
readonly terminalReflowableSnapshot: "terminal_reflowable_snapshot";
|
|
11
|
+
readonly providerSubagents: "provider_subagents";
|
|
12
|
+
readonly projectedSubagentTimeline: "projected_subagent_timeline";
|
|
13
|
+
readonly projectUpdates: "project_updates";
|
|
14
|
+
readonly compactProviderSnapshots: "compact_provider_snapshots";
|
|
15
|
+
readonly providerSnapshotReferences: "provider_snapshot_references";
|
|
16
|
+
readonly timelineReplacementInvalidation: "timeline_replacement_invalidation";
|
|
17
|
+
readonly timelineNotifications: "timeline_notifications";
|
|
18
|
+
readonly pluginTimelineItems: "plugin_timeline_items";
|
|
19
|
+
readonly workspaceSetupObservation: "workspace_setup_observation";
|
|
20
|
+
readonly workspaceSetupBlocked: "workspace_setup_blocked";
|
|
21
|
+
readonly browserHost: "browser_host";
|
|
22
|
+
};
|
|
23
|
+
export type ClientCapability = (typeof CLIENT_CAPS)[keyof typeof CLIENT_CAPS];
|
|
24
|
+
//# sourceMappingURL=client-capabilities.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const CLIENT_CAPS = {
|
|
2
|
+
binaryChunkingV1: "binary_chunking_v1",
|
|
3
|
+
helloRejection: "hello_rejection",
|
|
4
|
+
// COMPAT(ownedSubscriptions): added in v0.8.0, remove legacy ownership after 2027-03-09.
|
|
5
|
+
ownedSubscriptions: "owned_subscriptions",
|
|
6
|
+
// Clients outside the Mateo app version series can explicitly accept provider IDs.
|
|
7
|
+
// COMPAT(explicitEventSubscriptions): added in v0.8.0, remove legacy broadcasts after 2027-03-08.
|
|
8
|
+
explicitEventSubscriptions: "explicit_event_subscriptions",
|
|
9
|
+
allProviders: "all_providers",
|
|
10
|
+
// COMPAT(selectiveAgentTimeline): added in v0.1.106. Capable clients receive
|
|
11
|
+
// agent streams only for their explicit viewed set. Remove after 2027-01-12
|
|
12
|
+
// once the supported client floor is >= v0.1.106.
|
|
13
|
+
selectiveAgentTimeline: "selective_agent_timeline",
|
|
14
|
+
reasoningMergeEnum: "reasoning_merge_enum",
|
|
15
|
+
// COMPAT(customModeIcons): added in v0.1.84. Old clients pin AgentModeIcon to
|
|
16
|
+
// a closed enum and crash rendering unknown values; daemon downgrades icons
|
|
17
|
+
// outside the legacy set to "ShieldCheck" when this cap is absent. Drop the
|
|
18
|
+
// gate when floor >= v0.1.84.
|
|
19
|
+
customModeIcons: "custom_mode_icons",
|
|
20
|
+
// COMPAT(terminalReflowableSnapshot): added in v0.1.88. The daemon attaches
|
|
21
|
+
// per-row soft-wrap flags (gridWrapped/scrollbackWrapped) to terminal snapshots
|
|
22
|
+
// only when the client advertises this, so restored content can reflow on resize.
|
|
23
|
+
// Old clients use a strict TerminalState schema and would reject the extra fields.
|
|
24
|
+
// Drop the gate (always send the flags) when floor >= v0.1.88.
|
|
25
|
+
terminalReflowableSnapshot: "terminal_reflowable_snapshot",
|
|
26
|
+
// COMPAT(providerSubagents): added in v0.1.107. The daemon emits provider-owned
|
|
27
|
+
// child descriptors and timelines only to clients that understand the new messages.
|
|
28
|
+
providerSubagents: "provider_subagents",
|
|
29
|
+
// COMPAT(projectedSubagentTimeline): added after v0.8.0, remove gates after 2027-03-14; retain wire capability.
|
|
30
|
+
projectedSubagentTimeline: "projected_subagent_timeline",
|
|
31
|
+
// COMPAT(projectUpdates): added in v0.1.109, remove gate after 2027-01-15.
|
|
32
|
+
projectUpdates: "project_updates",
|
|
33
|
+
// COMPAT(compactProviderSnapshots): added in v0.2.X. Capable clients receive
|
|
34
|
+
// provider catalogs with shared thinking sets and may revalidate by content hash.
|
|
35
|
+
// Remove the legacy snapshot encoding after 2027-02-04.
|
|
36
|
+
compactProviderSnapshots: "compact_provider_snapshots",
|
|
37
|
+
providerSnapshotReferences: "provider_snapshot_references",
|
|
38
|
+
// COMPAT(timelineReplacementInvalidation): added in v0.5.0, remove legacy
|
|
39
|
+
// reconstructed timeline replay after 2027-02-21 once the client floor supports invalidation.
|
|
40
|
+
timelineReplacementInvalidation: "timeline_replacement_invalidation",
|
|
41
|
+
// COMPAT(timelineNotifications): added in v0.7.2. The daemon omits notification
|
|
42
|
+
// timeline items for older clients whose strict timeline union rejects them.
|
|
43
|
+
// Remove after 2027-03-03 once the supported client floor is >= v0.7.2.
|
|
44
|
+
timelineNotifications: "timeline_notifications",
|
|
45
|
+
// COMPAT(pluginTimelineItems): added in v0.8.0, remove after 2027-03-07 once client floor >= v0.8.0.
|
|
46
|
+
pluginTimelineItems: "plugin_timeline_items",
|
|
47
|
+
workspaceSetupObservation: "workspace_setup_observation",
|
|
48
|
+
// COMPAT(workspaceSetupBlocked): added in v0.8.0, remove after 2027-03-07 once client floor >= v0.8.0.
|
|
49
|
+
workspaceSetupBlocked: "workspace_setup_blocked",
|
|
50
|
+
browserHost: "browser_host",
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=client-capabilities.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Relay-only pairing offer.
|
|
4
|
+
*
|
|
5
|
+
* `serverId` is a stable daemon identifier scoped to `MATEO_HOME`, and is also
|
|
6
|
+
* used as the relay session identifier.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ConnectionOfferV2Schema: z.ZodObject<{
|
|
9
|
+
v: z.ZodLiteral<2>;
|
|
10
|
+
serverId: z.ZodString;
|
|
11
|
+
daemonPublicKeyB64: z.ZodString;
|
|
12
|
+
relay: z.ZodObject<{
|
|
13
|
+
endpoint: z.ZodString;
|
|
14
|
+
useTls: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type ConnectionOfferV2 = z.infer<typeof ConnectionOfferV2Schema>;
|
|
18
|
+
export declare const ConnectionOfferSchema: z.ZodObject<{
|
|
19
|
+
v: z.ZodLiteral<2>;
|
|
20
|
+
serverId: z.ZodString;
|
|
21
|
+
daemonPublicKeyB64: z.ZodString;
|
|
22
|
+
relay: z.ZodObject<{
|
|
23
|
+
endpoint: z.ZodString;
|
|
24
|
+
useTls: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export type ConnectionOffer = ConnectionOfferV2;
|
|
28
|
+
export declare function decodeOfferFragmentPayload(encoded: string): unknown;
|
|
29
|
+
/**
|
|
30
|
+
* Parse a pairing-offer URL of the form `https://app.paseo.sh/#offer=<base64url>`.
|
|
31
|
+
*
|
|
32
|
+
* Returns `null` if the input has no `#offer=` fragment. Throws if the fragment
|
|
33
|
+
* exists but the payload is malformed or fails schema validation.
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseConnectionOfferFromUrl(input: string): ConnectionOffer | null;
|
|
36
|
+
//# sourceMappingURL=connection-offer.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Relay-only pairing offer.
|
|
4
|
+
*
|
|
5
|
+
* `serverId` is a stable daemon identifier scoped to `MATEO_HOME`, and is also
|
|
6
|
+
* used as the relay session identifier.
|
|
7
|
+
*/
|
|
8
|
+
export const ConnectionOfferV2Schema = z.object({
|
|
9
|
+
v: z.literal(2),
|
|
10
|
+
serverId: z.string().min(1),
|
|
11
|
+
daemonPublicKeyB64: z.string().min(1),
|
|
12
|
+
relay: z.object({
|
|
13
|
+
endpoint: z.string().min(1),
|
|
14
|
+
useTls: z.boolean().optional(),
|
|
15
|
+
}),
|
|
16
|
+
});
|
|
17
|
+
export const ConnectionOfferSchema = ConnectionOfferV2Schema;
|
|
18
|
+
function decodeBase64UrlToUtf8(input) {
|
|
19
|
+
const base64 = input.replace(/-/g, "+").replace(/_/g, "/");
|
|
20
|
+
const padded = base64.padEnd(base64.length + ((4 - (base64.length % 4)) % 4), "=");
|
|
21
|
+
const binary = globalThis.atob(padded);
|
|
22
|
+
const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
23
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
24
|
+
}
|
|
25
|
+
export function decodeOfferFragmentPayload(encoded) {
|
|
26
|
+
const json = decodeBase64UrlToUtf8(encoded);
|
|
27
|
+
return JSON.parse(json);
|
|
28
|
+
}
|
|
29
|
+
const OFFER_FRAGMENT_PREFIX = "#offer=";
|
|
30
|
+
function extractOfferFragmentEncoded(input) {
|
|
31
|
+
const trimmed = input.trim();
|
|
32
|
+
if (!trimmed)
|
|
33
|
+
return null;
|
|
34
|
+
const fragmentIndex = trimmed.indexOf(OFFER_FRAGMENT_PREFIX);
|
|
35
|
+
if (fragmentIndex === -1)
|
|
36
|
+
return null;
|
|
37
|
+
const encoded = trimmed.slice(fragmentIndex + OFFER_FRAGMENT_PREFIX.length).trim();
|
|
38
|
+
return encoded.length > 0 ? encoded : null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Parse a pairing-offer URL of the form `https://app.paseo.sh/#offer=<base64url>`.
|
|
42
|
+
*
|
|
43
|
+
* Returns `null` if the input has no `#offer=` fragment. Throws if the fragment
|
|
44
|
+
* exists but the payload is malformed or fails schema validation.
|
|
45
|
+
*/
|
|
46
|
+
export function parseConnectionOfferFromUrl(input) {
|
|
47
|
+
const encoded = extractOfferFragmentEncoded(input);
|
|
48
|
+
if (!encoded)
|
|
49
|
+
return null;
|
|
50
|
+
const payload = decodeOfferFragmentPayload(encoded);
|
|
51
|
+
return ConnectionOfferSchema.parse(payload);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=connection-offer.js.map
|