@yeaft/webchat-agent 1.0.654 → 1.0.656

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.
@@ -2,7 +2,8 @@ import { MAX_PREVIEW_FILE_BYTES } from './preview-files.js';
2
2
 
3
3
  const MAX_CHUNK_BYTES = 1024 * 1024;
4
4
  const MAX_ASSEMBLIES = 64;
5
- const MAX_ASSEMBLY_BYTES = 64 * 1024 * 1024;
5
+ // Keep aggregate buffering bounded while allowing one maximum-size transfer.
6
+ const MAX_ASSEMBLY_BYTES = 128 * 1024 * 1024;
6
7
  const ASSEMBLY_TTL_MS = 2 * 60 * 1000;
7
8
  const assemblies = new Map();
8
9
  let assemblyBytes = 0;
@@ -47,7 +48,7 @@ export function appendFileContentChunk(agentId, msg) {
47
48
  const totalBytes = Number(msg?.totalBytes);
48
49
  if (!agentId || !requestId
49
50
  || !Number.isSafeInteger(chunkIndex) || chunkIndex < 0
50
- || !Number.isSafeInteger(chunkCount) || chunkCount < 2 || chunkCount > 20
51
+ || !Number.isSafeInteger(chunkCount) || chunkCount < 2 || chunkCount > Math.ceil(MAX_PREVIEW_FILE_BYTES / MAX_CHUNK_BYTES)
51
52
  || !Number.isSafeInteger(totalBytes) || totalBytes <= MAX_CHUNK_BYTES
52
53
  || totalBytes > MAX_PREVIEW_FILE_BYTES
53
54
  || chunkIndex >= chunkCount) return { status: 'invalid' };
@@ -104,7 +104,7 @@ function cacheBinaryPreview(msg, suppliedBuffer = null, pending = null) {
104
104
  ...msg,
105
105
  binary: false,
106
106
  content: '',
107
- error: 'File exceeds the 20 MB transfer limit.',
107
+ error: 'File exceeds the 100 MB transfer limit.',
108
108
  errorCode: 'FILE_PREVIEW_TOO_LARGE',
109
109
  errorDetails: { sizeBytes: buffer.length, limitBytes: MAX_PREVIEW_FILE_BYTES },
110
110
  };
@@ -1,6 +1,6 @@
1
1
  import { previewFiles } from './context.js';
2
2
 
3
- export const MAX_PREVIEW_FILE_BYTES = 20 * 1024 * 1024;
3
+ export const MAX_PREVIEW_FILE_BYTES = 100 * 1024 * 1024;
4
4
  export const PREVIEW_FILE_TTL_MS = 10 * 60 * 1000;
5
5
  export const MAX_PREVIEW_CACHE_BYTES = 128 * 1024 * 1024;
6
6
  export const MAX_PREVIEW_CACHE_FILES = 256;
@@ -99,13 +99,13 @@ async function refill(source, token, { client, resolved }) {
99
99
  if (msg.error) return reject(failure(msg.errorCode === 'ENOENT' ? 404 : 502, msg.error));
100
100
  if (!msg.binary || msg.filePath !== source.filePath) return reject(failure(502, 'Invalid preview response'));
101
101
  const buffer = msg.buffer || Buffer.from(msg.content || '', 'base64');
102
- if (buffer.length > MAX_PREVIEW_FILE_BYTES) return reject(failure(413, 'File exceeds the 20 MB transfer limit'));
102
+ if (buffer.length > MAX_PREVIEW_FILE_BYTES) return reject(failure(413, 'File exceeds the 100 MB transfer limit'));
103
103
  resolve({ buffer, mimeType: msg.mimeType, filename: source.filePath.split(/[\\/]/).pop(), token });
104
104
  },
105
105
  });
106
106
  if (!requestId) return reject(failure(503, 'Preview read unavailable'));
107
107
  Promise.resolve(forwardToAgent(source.agentId, {
108
- type: 'read_file', filePath: source.filePath, workDir: resolved.workDir,
108
+ type: 'read_file', filePath: source.filePath, workDir: resolved.workDir, download: true,
109
109
  ...(source.responseImagePreview === true ? { responseImagePreview: true } : {}),
110
110
  // Missing purpose identifies an old workspace-bound capability, not a
111
111
  // new explicit file selection. PDF/Office refills must remain supported.
@@ -1 +1 @@
1
- {"version":"1.0.654"}
1
+ {"version":"1.0.656"}