@getpaseo/client 0.1.104-beta.2 → 0.1.104-beta.4

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.
@@ -0,0 +1,11 @@
1
+ import type { GetProvidersSnapshotResponseMessage, ListProviderModelsResponseMessage, SessionOutboundMessage } from "@getpaseo/protocol/messages";
2
+ type ListProviderModelsPayload = ListProviderModelsResponseMessage["payload"];
3
+ type GetProvidersSnapshotPayload = GetProvidersSnapshotResponseMessage["payload"];
4
+ type ProvidersSnapshotUpdatePayload = Extract<SessionOutboundMessage, {
5
+ type: "providers_snapshot_update";
6
+ }>["payload"];
7
+ export declare function normalizeListProviderModelsPayload(payload: ListProviderModelsPayload): ListProviderModelsPayload;
8
+ export declare function normalizeProvidersSnapshotPayload<T extends GetProvidersSnapshotPayload | ProvidersSnapshotUpdatePayload>(payload: T): T;
9
+ export declare function normalizeProviderSnapshotUpdateMessage(msg: SessionOutboundMessage): SessionOutboundMessage;
10
+ export {};
11
+ //# sourceMappingURL=normalize-provider-models.d.ts.map
@@ -0,0 +1,42 @@
1
+ import { normalizeAgentModelDefinition } from "@getpaseo/protocol/agent-types";
2
+ // COMPAT(model-normalize): daemon normalizes at source (provider-registry) — shim covers older daemons; drop when floor >= v0.1.104
3
+ function normalizeAgentModels(models) {
4
+ if (!models) {
5
+ return models;
6
+ }
7
+ let changed = false;
8
+ const normalized = models.map((model) => {
9
+ const next = normalizeAgentModelDefinition(model);
10
+ changed || (changed = next !== model);
11
+ return next;
12
+ });
13
+ return changed ? normalized : models;
14
+ }
15
+ function normalizeProviderSnapshotEntry(entry) {
16
+ const models = normalizeAgentModels(entry.models);
17
+ return models === entry.models ? entry : { ...entry, models };
18
+ }
19
+ function normalizeProviderSnapshotEntries(entries) {
20
+ let changed = false;
21
+ const normalized = entries.map((entry) => {
22
+ const next = normalizeProviderSnapshotEntry(entry);
23
+ changed || (changed = next !== entry);
24
+ return next;
25
+ });
26
+ return changed ? normalized : entries;
27
+ }
28
+ export function normalizeListProviderModelsPayload(payload) {
29
+ const models = normalizeAgentModels(payload.models);
30
+ return models === payload.models ? payload : { ...payload, models };
31
+ }
32
+ export function normalizeProvidersSnapshotPayload(payload) {
33
+ const entries = normalizeProviderSnapshotEntries(payload.entries);
34
+ return entries === payload.entries ? payload : { ...payload, entries };
35
+ }
36
+ export function normalizeProviderSnapshotUpdateMessage(msg) {
37
+ if (msg.type !== "providers_snapshot_update") {
38
+ return msg;
39
+ }
40
+ return { ...msg, payload: normalizeProvidersSnapshotPayload(msg.payload) };
41
+ }
42
+ //# sourceMappingURL=normalize-provider-models.js.map
@@ -117,7 +117,7 @@ export interface DaemonClientConfig {
117
117
  };
118
118
  runtimeMetricsIntervalMs?: number;
119
119
  runtimeMetricsWindowMs?: number;
120
- capabilities?: Partial<Record<ClientCapability, boolean>>;
120
+ capabilities?: Partial<Record<ClientCapability, unknown>>;
121
121
  }
122
122
  export interface SendMessageOptions {
123
123
  messageId?: string;
@@ -1,10 +1,12 @@
1
1
  import { CLIENT_CAPS } from "@getpaseo/protocol/client-capabilities";
2
- import { AgentCreateFailedStatusPayloadSchema, AgentCreatedStatusPayloadSchema, AgentRefreshedStatusPayloadSchema, AgentResumedStatusPayloadSchema, parseServerInfoStatusPayload, RestartRequestedStatusPayloadSchema, ShutdownRequestedStatusPayloadSchema, DaemonUpdateResponseSchema, SessionInboundMessageSchema, WSOutboundMessageSchema, } from "@getpaseo/protocol/messages";
2
+ import { AgentCreateFailedStatusPayloadSchema, AgentCreatedStatusPayloadSchema, AgentRefreshedStatusPayloadSchema, AgentResumedStatusPayloadSchema, parseServerInfoStatusPayload, RestartRequestedStatusPayloadSchema, ShutdownRequestedStatusPayloadSchema, DaemonUpdateResponseSchema, SessionInboundMessageSchema, } from "@getpaseo/protocol/messages";
3
+ import { validateWSOutboundMessage } from "@getpaseo/protocol/validation/ws-outbound";
3
4
  import { isRelayClientWebSocketUrl } from "@getpaseo/protocol/daemon-endpoints";
4
5
  import { terminalSubscriptionKey } from "@getpaseo/protocol/terminal-subscription-key";
5
6
  import { asUint8Array, decodeFileTransferFrame, encodeFileTransferFrame, decodeTerminalStreamFrame, FileTransferOpcode, TerminalStreamOpcode, } from "@getpaseo/protocol/binary-frames/index";
6
7
  import { createRelayE2eeTransportFactory, createWebSocketTransportFactory, decodeMessageData, defaultWebSocketFactory, describeTransportClose, describeTransportError, } from "./daemon-client-transport.js";
7
8
  import { DaemonClientRuntimeMetrics } from "./daemon-client-runtime-metrics.js";
9
+ import { normalizeListProviderModelsPayload, normalizeProviderSnapshotUpdateMessage, normalizeProvidersSnapshotPayload, } from "./compat/normalize-provider-models.js";
8
10
  import { TerminalStreamRouter } from "./terminal-stream-router.js";
9
11
  const consoleLogger = {
10
12
  debug: () => { },
@@ -2449,7 +2451,7 @@ export class DaemonClient {
2449
2451
  // Provider Models / Commands
2450
2452
  // ============================================================================
2451
2453
  async listProviderModels(provider, options) {
2452
- return this.sendCorrelatedSessionRequest({
2454
+ const payload = await this.sendCorrelatedSessionRequest({
2453
2455
  requestId: options?.requestId,
2454
2456
  message: {
2455
2457
  type: "list_provider_models_request",
@@ -2460,6 +2462,7 @@ export class DaemonClient {
2460
2462
  // Provider SDK cold starts (especially model discovery) can exceed 60s.
2461
2463
  timeout: 90000,
2462
2464
  });
2465
+ return normalizeListProviderModelsPayload(payload);
2463
2466
  }
2464
2467
  async listProviderModes(provider, options) {
2465
2468
  return this.sendCorrelatedSessionRequest({
@@ -2494,7 +2497,7 @@ export class DaemonClient {
2494
2497
  });
2495
2498
  }
2496
2499
  async getProvidersSnapshot(options) {
2497
- return this.sendCorrelatedSessionRequest({
2500
+ const payload = await this.sendCorrelatedSessionRequest({
2498
2501
  requestId: options?.requestId,
2499
2502
  message: {
2500
2503
  type: "get_providers_snapshot_request",
@@ -2502,6 +2505,7 @@ export class DaemonClient {
2502
2505
  },
2503
2506
  responseType: "get_providers_snapshot_response",
2504
2507
  });
2508
+ return normalizeProvidersSnapshotPayload(payload);
2505
2509
  }
2506
2510
  async getDaemonConfig(requestId) {
2507
2511
  return this.sendCorrelatedSessionRequest({
@@ -3318,7 +3322,7 @@ export class DaemonClient {
3318
3322
  catch {
3319
3323
  return;
3320
3324
  }
3321
- const parsed = WSOutboundMessageSchema.safeParse(parsedJson);
3325
+ const parsed = validateWSOutboundMessage(parsedJson);
3322
3326
  if (!parsed.success) {
3323
3327
  const msgType = parsedJson != null &&
3324
3328
  typeof parsedJson === "object" &&
@@ -3539,8 +3543,9 @@ export class DaemonClient {
3539
3543
  });
3540
3544
  }
3541
3545
  handleSessionMessage(msg) {
3542
- if (msg.type === "status") {
3543
- const serverInfo = parseServerInfoStatusPayload(msg.payload);
3546
+ const consumerMessage = normalizeProviderSnapshotUpdateMessage(msg);
3547
+ if (consumerMessage.type === "status") {
3548
+ const serverInfo = parseServerInfoStatusPayload(consumerMessage.payload);
3544
3549
  if (serverInfo) {
3545
3550
  this.lastServerInfoMessage = serverInfo;
3546
3551
  if (this.connectionState.status === "connecting") {
@@ -3555,37 +3560,37 @@ export class DaemonClient {
3555
3560
  }
3556
3561
  }
3557
3562
  }
3558
- if (msg.type === "terminal_stream_exit") {
3559
- this.terminalStreams.removeTerminal(msg.payload.terminalId);
3563
+ if (consumerMessage.type === "terminal_stream_exit") {
3564
+ this.terminalStreams.removeTerminal(consumerMessage.payload.terminalId);
3560
3565
  }
3561
3566
  if (this.rawMessageListeners.size > 0) {
3562
3567
  for (const handler of this.rawMessageListeners) {
3563
3568
  try {
3564
- handler(msg);
3569
+ handler(consumerMessage);
3565
3570
  }
3566
3571
  catch {
3567
3572
  // no-op
3568
3573
  }
3569
3574
  }
3570
3575
  }
3571
- const handlers = this.messageHandlers.get(msg.type);
3576
+ const handlers = this.messageHandlers.get(consumerMessage.type);
3572
3577
  if (handlers) {
3573
3578
  for (const handler of handlers) {
3574
3579
  try {
3575
- handler(msg);
3580
+ handler(consumerMessage);
3576
3581
  }
3577
3582
  catch {
3578
3583
  // no-op
3579
3584
  }
3580
3585
  }
3581
3586
  }
3582
- const event = this.toEvent(msg);
3587
+ const event = this.toEvent(consumerMessage);
3583
3588
  if (event) {
3584
3589
  for (const handler of this.eventListeners) {
3585
3590
  handler(event);
3586
3591
  }
3587
3592
  }
3588
- this.resolveWaiters(msg);
3593
+ this.resolveWaiters(consumerMessage);
3589
3594
  }
3590
3595
  resolveWaiters(msg) {
3591
3596
  for (const waiter of Array.from(this.waiters)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/client",
3
- "version": "0.1.104-beta.2",
3
+ "version": "0.1.104-beta.4",
4
4
  "description": "Paseo client SDK package",
5
5
  "files": [
6
6
  "dist",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "scripts": {
29
29
  "clean": "node ../../scripts/clean-package-dist.mjs",
30
- "build": "tsc -p tsconfig.json --incremental false",
30
+ "build": "npm run build --workspace=@getpaseo/protocol && tsc -p tsconfig.json --incremental false",
31
31
  "build:clean": "npm run clean && npm run build",
32
32
  "prepack": "npm run build:clean",
33
33
  "typecheck": "tsgo --noEmit",
@@ -35,8 +35,8 @@
35
35
  "test": "vitest run"
36
36
  },
37
37
  "dependencies": {
38
- "@getpaseo/protocol": "0.1.104-beta.2",
39
- "@getpaseo/relay": "0.1.104-beta.2",
38
+ "@getpaseo/protocol": "0.1.104-beta.4",
39
+ "@getpaseo/relay": "0.1.104-beta.4",
40
40
  "zod": "^4.4.3"
41
41
  },
42
42
  "devDependencies": {