@camerontaylor/paseo-protocol 0.9.1-fork.1 → 0.10.1-fork.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.
@@ -1,4 +1,5 @@
1
1
  export declare const CLIENT_CAPS: {
2
+ readonly helloRejection: "hello_rejection";
2
3
  readonly ownedSubscriptions: "owned_subscriptions";
3
4
  readonly explicitEventSubscriptions: "explicit_event_subscriptions";
4
5
  readonly allProviders: "all_providers";
@@ -1,4 +1,5 @@
1
1
  export const CLIENT_CAPS = {
2
+ helloRejection: "hello_rejection",
2
3
  // COMPAT(ownedSubscriptions): added in v0.8.0, remove legacy ownership after 2027-03-09.
3
4
  ownedSubscriptions: "owned_subscriptions",
4
5
  // Clients outside the Paseo app version series can explicitly accept provider IDs.
@@ -1,3 +1,4 @@
1
+ import type { ConnectionOfferV2 } from "./connection-offer.js";
1
2
  export interface HostPortParts {
2
3
  host: string;
3
4
  port: number;
@@ -9,6 +10,12 @@ export interface ConnectionUriParts extends HostPortParts {
9
10
  export interface ParsedConnectionUri extends ConnectionUriParts {
10
11
  password?: string;
11
12
  }
13
+ export interface ParsedRelayConnectionUri {
14
+ offer: ConnectionOfferV2;
15
+ password?: string;
16
+ }
17
+ export declare function parseRelayConnectionUri(input: string): ParsedRelayConnectionUri;
18
+ export declare function serializeRelayConnectionUri(parts: ParsedRelayConnectionUri): string;
12
19
  export type RelayRole = "server" | "client";
13
20
  export type RelayProtocolVersion = "1" | "2";
14
21
  export declare const CURRENT_RELAY_PROTOCOL_VERSION: RelayProtocolVersion;
@@ -1,3 +1,45 @@
1
+ export function parseRelayConnectionUri(input) {
2
+ const trimmed = input.trim();
3
+ const connectIndex = trimmed.indexOf("#connect=");
4
+ const uri = connectIndex >= 0
5
+ ? decodeURIComponent(trimmed.slice(connectIndex + "#connect=".length))
6
+ : trimmed;
7
+ let url;
8
+ try {
9
+ url = new URL(uri);
10
+ }
11
+ catch {
12
+ throw new Error("Invalid relay connection URI");
13
+ }
14
+ if (url.protocol !== "relay:" || !url.hostname || !url.port || url.username || url.password) {
15
+ throw new Error("Invalid relay connection URI");
16
+ }
17
+ const serverId = decodeURIComponent(url.pathname.slice(1));
18
+ const key = url.searchParams.get("key");
19
+ if (!serverId || !key || serverId.includes("/")) {
20
+ throw new Error("Relay connection URI requires a server id and key");
21
+ }
22
+ const endpoint = normalizeHostPort(url.host);
23
+ const password = url.searchParams.get("password") || undefined;
24
+ return {
25
+ offer: {
26
+ v: 2,
27
+ serverId,
28
+ daemonPublicKeyB64: key,
29
+ relay: { endpoint, useTls: url.searchParams.get("ssl") === "true" },
30
+ },
31
+ ...(password ? { password } : {}),
32
+ };
33
+ }
34
+ export function serializeRelayConnectionUri(parts) {
35
+ const url = new URL(`relay://${parts.offer.relay.endpoint}/${encodeURIComponent(parts.offer.serverId)}`);
36
+ url.searchParams.set("key", parts.offer.daemonPublicKeyB64);
37
+ if (parts.offer.relay.useTls)
38
+ url.searchParams.set("ssl", "true");
39
+ if (parts.password)
40
+ url.searchParams.set("password", parts.password);
41
+ return url.toString();
42
+ }
1
43
  export const CURRENT_RELAY_PROTOCOL_VERSION = "2";
2
44
  export const DEFAULT_RELAY_ENDPOINT = "relay.paseo.sh:443";
3
45
  export function normalizeRelayProtocolVersion(value, fallback = CURRENT_RELAY_PROTOCOL_VERSION) {
@@ -99978,7 +99978,32 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
99978
99978
  }
99979
99979
  _d = __du_223;
99980
99980
  break;
99981
- default: _e.push({ code: "invalid_union", errors: [], note: "No matching discriminator", discriminator: "type", options: ["pong", "session"], input: _d, path: [].concat("type") });
99981
+ case "hello.rejected":
99982
+ if (typeof __du_223 !== "object" || __du_223 === null || Array.isArray(__du_223)) {
99983
+ _e.push({ code: "invalid_type", expected: "object", input: __du_223, path: [] });
99984
+ }
99985
+ else {
99986
+ var __o_6977 = __du_223;
99987
+ if (__o_6977["type"] !== "hello.rejected") {
99988
+ _e.push({ code: "invalid_value", values: ["hello.rejected"], input: __o_6977["type"], path: ["type"] });
99989
+ }
99990
+ if (__o_6977["reason"] !== "password_required" && __o_6977["reason"] !== "incorrect_password" && __o_6977["reason"] !== "incompatible_protocol") {
99991
+ _e.push({ code: "invalid_value", values: ["password_required", "incorrect_password", "incompatible_protocol"], input: __o_6977["reason"], path: ["reason"] });
99992
+ }
99993
+ if (!Array.isArray(__o_6977["accepts"])) {
99994
+ _e.push({ code: "invalid_type", expected: "array", input: __o_6977["accepts"], path: ["accepts"] });
99995
+ }
99996
+ else {
99997
+ for (var __i_6978 = 0; __i_6978 < __o_6977["accepts"].length; __i_6978++) {
99998
+ if (__o_6977["accepts"][__i_6978] !== "password") {
99999
+ _e.push({ code: "invalid_value", values: ["password"], input: __o_6977["accepts"][__i_6978], path: ["accepts"].concat(__i_6978) });
100000
+ }
100001
+ }
100002
+ }
100003
+ }
100004
+ _d = __du_223;
100005
+ break;
100006
+ default: _e.push({ code: "invalid_union", errors: [], note: "No matching discriminator", discriminator: "type", options: ["pong", "session", "hello.rejected"], input: _d, path: [].concat("type") });
99982
100007
  }
99983
100008
  }
99984
100009
  return __fin(_e, _d);
@@ -7508,6 +7508,7 @@ export declare const ServerCapabilitiesSchema: z.ZodObject<{
7508
7508
  }, z.core.$loose>;
7509
7509
  export declare const ServerInfoStatusPayloadSchema: z.ZodPipe<z.ZodObject<{
7510
7510
  status: z.ZodLiteral<"server_info">;
7511
+ protocolVersion: z.ZodOptional<z.ZodNumber>;
7511
7512
  serverId: z.ZodString;
7512
7513
  hostname: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<string | null, unknown>>>;
7513
7514
  version: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<string | null, unknown>>>;
@@ -7624,6 +7625,7 @@ export declare const ServerInfoStatusPayloadSchema: z.ZodPipe<z.ZodObject<{
7624
7625
  version: string | null;
7625
7626
  status: "server_info";
7626
7627
  serverId: string;
7628
+ protocolVersion?: number | undefined;
7627
7629
  permissions?: ("daemon.read" | "daemon.manage" | "tunnel.manage" | "access.manage" | "workspace.read" | "workspace.write" | "workspace.manage" | "automation.manage" | "hub.execute")[] | undefined;
7628
7630
  desktopManaged?: boolean | undefined;
7629
7631
  capabilities?: {
@@ -7726,6 +7728,7 @@ export declare const ServerInfoStatusPayloadSchema: z.ZodPipe<z.ZodObject<{
7726
7728
  [x: string]: unknown;
7727
7729
  status: "server_info";
7728
7730
  serverId: string;
7731
+ protocolVersion?: number | undefined;
7729
7732
  hostname?: string | null | undefined;
7730
7733
  version?: string | null | undefined;
7731
7734
  permissions?: ("daemon.read" | "daemon.manage" | "tunnel.manage" | "access.manage" | "workspace.read" | "workspace.write" | "workspace.manage" | "automation.manage" | "hub.execute")[] | undefined;
@@ -33640,9 +33643,17 @@ export declare const WSHelloMessageSchema: z.ZodObject<{
33640
33643
  hub: "hub";
33641
33644
  }>;
33642
33645
  protocolVersion: z.ZodNumber;
33646
+ auth: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
33647
+ kind: z.ZodLiteral<"password">;
33648
+ password: z.ZodString;
33649
+ }, z.core.$strip>, z.ZodObject<{
33650
+ kind: z.ZodLiteral<"localCredential">;
33651
+ token: z.ZodString;
33652
+ }, z.core.$strip>], "kind">>;
33643
33653
  appVersion: z.ZodOptional<z.ZodString>;
33644
33654
  capabilities: z.ZodOptional<z.ZodObject<{
33645
33655
  voice: z.ZodOptional<z.ZodBoolean>;
33656
+ hello_rejection: z.ZodOptional<z.ZodBoolean>;
33646
33657
  pushNotifications: z.ZodOptional<z.ZodBoolean>;
33647
33658
  explicit_event_subscriptions: z.ZodOptional<z.ZodBoolean>;
33648
33659
  all_providers: z.ZodOptional<z.ZodBoolean>;
@@ -48312,6 +48323,15 @@ export declare const WSSessionOutboundSchema: z.ZodObject<{
48312
48323
  }, z.core.$strip>;
48313
48324
  }, z.core.$strip>], "type">;
48314
48325
  }, z.core.$strip>;
48326
+ export declare const WSHelloRejectedMessageSchema: z.ZodObject<{
48327
+ type: z.ZodLiteral<"hello.rejected">;
48328
+ reason: z.ZodEnum<{
48329
+ password_required: "password_required";
48330
+ incorrect_password: "incorrect_password";
48331
+ incompatible_protocol: "incompatible_protocol";
48332
+ }>;
48333
+ accepts: z.ZodArray<z.ZodLiteral<"password">>;
48334
+ }, z.core.$strip>;
48315
48335
  export declare const WSInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
48316
48336
  type: z.ZodLiteral<"ping">;
48317
48337
  }, z.core.$strip>, z.ZodObject<{
@@ -48325,9 +48345,17 @@ export declare const WSInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
48325
48345
  hub: "hub";
48326
48346
  }>;
48327
48347
  protocolVersion: z.ZodNumber;
48348
+ auth: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
48349
+ kind: z.ZodLiteral<"password">;
48350
+ password: z.ZodString;
48351
+ }, z.core.$strip>, z.ZodObject<{
48352
+ kind: z.ZodLiteral<"localCredential">;
48353
+ token: z.ZodString;
48354
+ }, z.core.$strip>], "kind">>;
48328
48355
  appVersion: z.ZodOptional<z.ZodString>;
48329
48356
  capabilities: z.ZodOptional<z.ZodObject<{
48330
48357
  voice: z.ZodOptional<z.ZodBoolean>;
48358
+ hello_rejection: z.ZodOptional<z.ZodBoolean>;
48331
48359
  pushNotifications: z.ZodOptional<z.ZodBoolean>;
48332
48360
  explicit_event_subscriptions: z.ZodOptional<z.ZodBoolean>;
48333
48361
  all_providers: z.ZodOptional<z.ZodBoolean>;
@@ -62996,6 +63024,14 @@ export declare const WSOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
62996
63024
  newVersion: z.ZodNullable<z.ZodString>;
62997
63025
  }, z.core.$strip>;
62998
63026
  }, z.core.$strip>], "type">;
63027
+ }, z.core.$strip>, z.ZodObject<{
63028
+ type: z.ZodLiteral<"hello.rejected">;
63029
+ reason: z.ZodEnum<{
63030
+ password_required: "password_required";
63031
+ incorrect_password: "incorrect_password";
63032
+ incompatible_protocol: "incompatible_protocol";
63033
+ }>;
63034
+ accepts: z.ZodArray<z.ZodLiteral<"password">>;
62999
63035
  }, z.core.$strip>], "type">;
63000
63036
  export type WSInboundMessage = z.infer<typeof WSInboundMessageSchema>;
63001
63037
  export type WSOutboundMessage = z.infer<typeof WSOutboundMessageSchema>;
package/dist/messages.js CHANGED
@@ -3036,6 +3036,7 @@ const ServerCapabilitiesFromUnknownSchema = z
3036
3036
  export const ServerInfoStatusPayloadSchema = z
3037
3037
  .object({
3038
3038
  status: z.literal("server_info"),
3039
+ protocolVersion: z.number().int().optional(),
3039
3040
  serverId: z.string().trim().min(1),
3040
3041
  hostname: ServerInfoHostnameSchema.optional(),
3041
3042
  version: ServerInfoVersionSchema.optional(),
@@ -6232,10 +6233,17 @@ export const WSHelloMessageSchema = z.object({
6232
6233
  clientId: z.string().min(1),
6233
6234
  clientType: z.enum(["mobile", "browser", "cli", "mcp", "hub"]),
6234
6235
  protocolVersion: z.number().int(),
6236
+ auth: z
6237
+ .discriminatedUnion("kind", [
6238
+ z.object({ kind: z.literal("password"), password: z.string() }),
6239
+ z.object({ kind: z.literal("localCredential"), token: z.string() }),
6240
+ ])
6241
+ .optional(),
6235
6242
  appVersion: z.string().optional(),
6236
6243
  capabilities: z
6237
6244
  .object({
6238
6245
  voice: z.boolean().optional(),
6246
+ [CLIENT_CAPS.helloRejection]: z.boolean().optional(),
6239
6247
  pushNotifications: z.boolean().optional(),
6240
6248
  [CLIENT_CAPS.explicitEventSubscriptions]: z.boolean().optional(),
6241
6249
  [CLIENT_CAPS.allProviders]: z.boolean().optional(),
@@ -6268,6 +6276,11 @@ export const WSSessionOutboundSchema = z.object({
6268
6276
  type: z.literal("session"),
6269
6277
  message: SessionOutboundMessageSchema,
6270
6278
  });
6279
+ export const WSHelloRejectedMessageSchema = z.object({
6280
+ type: z.literal("hello.rejected"),
6281
+ reason: z.enum(["password_required", "incorrect_password", "incompatible_protocol"]),
6282
+ accepts: z.array(z.literal("password")),
6283
+ });
6271
6284
  // Complete WebSocket message schemas
6272
6285
  export const WSInboundMessageSchema = z.discriminatedUnion("type", [
6273
6286
  WSPingMessageSchema,
@@ -6278,6 +6291,7 @@ export const WSInboundMessageSchema = z.discriminatedUnion("type", [
6278
6291
  export const WSOutboundMessageSchema = z.discriminatedUnion("type", [
6279
6292
  WSPongMessageSchema,
6280
6293
  WSSessionOutboundSchema,
6294
+ WSHelloRejectedMessageSchema,
6281
6295
  ]);
6282
6296
  // ============================================================================
6283
6297
  // Helper functions for message conversion
@@ -73,7 +73,13 @@ export function formatResolvedCommand(resolved) {
73
73
  export function resolveTerminalProfileLaunch(profile, prompt) {
74
74
  return { name: profile.name, ...substitutePrompt(profile, prompt) };
75
75
  }
76
- const WELL_KNOWN_COMMAND_ICONS = new Map(KNOWN_PROVIDER_ICON_NAMES.map((name) => [name, name]));
76
+ // CLIs whose binary is not named after their icon. Matching stays exact, so a
77
+ // command only gets an icon when its whole base name is listed.
78
+ const COMMAND_ICON_ALIASES = [["cursor-agent", "cursor"]];
79
+ const WELL_KNOWN_COMMAND_ICONS = new Map([
80
+ ...KNOWN_PROVIDER_ICON_NAMES.map((name) => [name, name]),
81
+ ...COMMAND_ICON_ALIASES,
82
+ ]);
77
83
  function getCommandBaseName(command) {
78
84
  const lastSlash = command.lastIndexOf("/");
79
85
  const lastBackslash = command.lastIndexOf("\\");
@@ -11818,6 +11818,14 @@ export declare const WSOutboundMessageSchema: {
11818
11818
  newVersion: import("zod").ZodNullable<import("zod").ZodString>;
11819
11819
  }, import("zod/v4/core").$strip>;
11820
11820
  }, import("zod/v4/core").$strip>], "type">;
11821
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
11822
+ type: import("zod").ZodLiteral<"hello.rejected">;
11823
+ reason: import("zod").ZodEnum<{
11824
+ password_required: "password_required";
11825
+ incorrect_password: "incorrect_password";
11826
+ incompatible_protocol: "incompatible_protocol";
11827
+ }>;
11828
+ accepts: import("zod").ZodArray<import("zod").ZodLiteral<"password">>;
11821
11829
  }, import("zod/v4/core").$strip>], "type">;
11822
11830
  };
11823
11831
  //# sourceMappingURL=ws-outbound-schema-metadata.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camerontaylor/paseo-protocol",
3
- "version": "0.9.1-fork.1",
3
+ "version": "0.10.1-fork.1",
4
4
  "description": "Paseo shared protocol schemas and wire types",
5
5
  "files": [
6
6
  "dist",