@getpaseo/client 0.5.0-beta.3 → 0.5.0-beta.5

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.
@@ -931,7 +931,7 @@ export declare class DaemonClient {
931
931
  }, requestId?: string): Promise<DirectorySuggestionsPayload>;
932
932
  private requestFileExplorer;
933
933
  listDirectory(cwd: string, path: string, requestId?: string): Promise<FileExplorerDirectoryPayload>;
934
- readFile(cwd: string, path: string, requestId?: string): Promise<FileReadResult>;
934
+ readFile(cwd: string, path: string, requestId?: string, maxBytes?: number): Promise<FileReadResult>;
935
935
  subscribeFile(input: {
936
936
  cwd: string;
937
937
  path: string;
@@ -2864,7 +2864,7 @@ export class DaemonClient {
2864
2864
  // ============================================================================
2865
2865
  // File Explorer
2866
2866
  // ============================================================================
2867
- async requestFileExplorer(cwd, path, mode, requestId, acceptBinary = false) {
2867
+ async requestFileExplorer(cwd, path, mode, requestId, acceptBinary = false, maxBytes) {
2868
2868
  return this.sendCorrelatedSessionRequest({
2869
2869
  requestId,
2870
2870
  message: {
@@ -2873,6 +2873,7 @@ export class DaemonClient {
2873
2873
  path,
2874
2874
  mode,
2875
2875
  ...(acceptBinary ? { acceptBinary: true } : {}),
2876
+ ...(maxBytes ? { maxBytes } : {}),
2876
2877
  },
2877
2878
  responseType: "file_explorer_response",
2878
2879
  });
@@ -2887,11 +2888,11 @@ export class DaemonClient {
2887
2888
  }
2888
2889
  return payload.directory;
2889
2890
  }
2890
- async readFile(cwd, path, requestId) {
2891
+ async readFile(cwd, path, requestId, maxBytes) {
2891
2892
  const resolvedRequestId = this.createRequestId(requestId);
2892
- this.pendingBinaryFileReads.set(resolvedRequestId, { cwd, path });
2893
+ this.pendingBinaryFileReads.set(resolvedRequestId, { cwd, path, maxBytes });
2893
2894
  try {
2894
- const payload = await this.requestFileExplorer(cwd, path, "file", resolvedRequestId, true);
2895
+ const payload = await this.requestFileExplorer(cwd, path, "file", resolvedRequestId, true, maxBytes);
2895
2896
  if (payload.error) {
2896
2897
  throw new Error(payload.error);
2897
2898
  }
@@ -4055,9 +4056,31 @@ export class DaemonClient {
4055
4056
  return;
4056
4057
  }
4057
4058
  if (frame.opcode === FileTransferOpcode.FileChunk) {
4059
+ // COMPAT(fileReadByteBudget): added in v0.5.0, remove after 2027-02-21 once daemon floor >= v0.5.0.
4060
+ // Old daemons stream despite maxBytes; discard before client-side accumulation.
4061
+ if (transfer.maxBytes && transfer.size > transfer.maxBytes) {
4062
+ return;
4063
+ }
4058
4064
  transfer.chunks.push(frame.payload);
4059
4065
  return;
4060
4066
  }
4067
+ // COMPAT(fileReadByteBudget): added in v0.5.0, remove after 2027-02-21 once daemon floor >= v0.5.0.
4068
+ if (transfer.maxBytes && transfer.size > transfer.maxBytes) {
4069
+ this.activeBinaryFileTransfers.delete(frame.requestId);
4070
+ this.handleSessionMessage({
4071
+ type: "file_explorer_response",
4072
+ payload: {
4073
+ cwd: transfer.cwd,
4074
+ path: transfer.path,
4075
+ mode: "file",
4076
+ directory: null,
4077
+ file: null,
4078
+ error: "File is too large to display",
4079
+ requestId: frame.requestId,
4080
+ },
4081
+ });
4082
+ return;
4083
+ }
4061
4084
  const bytes = concatByteChunks(transfer.chunks, transfer.size);
4062
4085
  this.activeBinaryFileTransfers.delete(frame.requestId);
4063
4086
  this.completedBinaryFileReads.set(frame.requestId, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/client",
3
- "version": "0.5.0-beta.3",
3
+ "version": "0.5.0-beta.5",
4
4
  "description": "Paseo client SDK package",
5
5
  "files": [
6
6
  "dist",
@@ -39,8 +39,8 @@
39
39
  "test": "vitest run"
40
40
  },
41
41
  "dependencies": {
42
- "@getpaseo/protocol": "0.5.0-beta.3",
43
- "@getpaseo/relay": "0.5.0-beta.3",
42
+ "@getpaseo/protocol": "0.5.0-beta.5",
43
+ "@getpaseo/relay": "0.5.0-beta.5",
44
44
  "zod": "^4.4.3"
45
45
  },
46
46
  "devDependencies": {