Skip to content

Commit fe79f5f

Browse files
committed
fix: satisfy BlobPart under @types/node 26 in pythinker-files providers
Same assertion dev already carries; upstream builds against @types/node 22.
1 parent 4ee49f5 commit fe79f5f

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

packages/agent-core-v2/src/kosong/provider/providers/pythinker/pythinker-files.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ export class PythinkerFiles {
7777
}
7878
const filename = input.filename ?? guessFilename(input.mimeType);
7979
const bytes = input.data instanceof Uint8Array ? input.data : new Uint8Array(input.data);
80-
const blob = new Blob([bytes], { type: input.mimeType });
80+
// `BlobPart` requires a non-shared backing buffer under @types/node 26;
81+
// the assertion is safe because these bytes never come from a
82+
// SharedArrayBuffer.
83+
const blob = new Blob([bytes as Uint8Array<ArrayBuffer>], { type: input.mimeType });
8184
file = new File([blob], filename, { type: input.mimeType });
8285
}
8386

packages/kosong/src/providers/pythinker-files.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ export class PythinkerFiles {
114114
// `Blob` and `File` are available as globals in Node 20+. The cast via
115115
// `Uint8Array` satisfies `BlobPart` in both Node and DOM lib contexts.
116116
const bytes = input.data instanceof Uint8Array ? input.data : new Uint8Array(input.data);
117-
const blob = new Blob([bytes], { type: input.mimeType });
117+
// `BlobPart` requires a non-shared backing buffer under @types/node 26;
118+
// the assertion is safe because these bytes never come from a
119+
// SharedArrayBuffer.
120+
const blob = new Blob([bytes as Uint8Array<ArrayBuffer>], { type: input.mimeType });
118121
file = new File([blob], filename, { type: input.mimeType });
119122
}
120123

0 commit comments

Comments
 (0)