build(deps): migrated to Bun runtime and simplified stream handling
- Migrated from Node.js to Bun runtime by replacing @types/node with @types/bun and bun-types dependencies. - Downgraded @types/diff from ^8.0.0 to ^7.0.2 in coding-agent package. - Updated tsconfig.base.json to include DOM.AsyncIterable in lib configuration for async iterable DOM API support. - Simplified stream handling in update-cli.ts by removing Readable.fromWeb() conversions and using response.body directly with pipeline(). - Simplified TextDecoderStream instantiation in stream.ts to use default parameters instead of explicit UTF-8 encoding configuration. - Added defensive null/undefined handling in agent-loop.ts result assignment using nullish coalescing operator.
This commit is contained in:
@@ -503,7 +503,7 @@ async function executeToolCalls(
|
||||
for (const record of records) {
|
||||
const toolCall = record.toolCall;
|
||||
const shouldSkip = record.skipped || record.result === undefined;
|
||||
const result = shouldSkip ? createSkippedToolResult() : record.result;
|
||||
const result = shouldSkip ? createSkippedToolResult() : (record.result ?? createSkippedToolResult());
|
||||
const isError = shouldSkip ? true : record.isError;
|
||||
if (!record.started) {
|
||||
stream.push({
|
||||
|
||||
@@ -104,10 +104,11 @@
|
||||
"zod": "^4.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/diff": "^8.0.0",
|
||||
"@types/diff": "^7.0.2",
|
||||
"@types/jsdom": "27.0.0",
|
||||
"bun-types": "^1.3.8",
|
||||
"@types/ms": "^2.1.0",
|
||||
"@types/node": "^25.2.0",
|
||||
"@types/bun": "^1.3.8",
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"keywords": [
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
import { execSync, spawnSync } from "node:child_process";
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import { Readable } from "node:stream";
|
||||
import { pipeline } from "node:stream/promises";
|
||||
import { isEnoent } from "@oh-my-pi/pi-utils";
|
||||
import chalk from "chalk";
|
||||
@@ -200,8 +199,7 @@ async function updateViaBinary(release: ReleaseInfo): Promise<void> {
|
||||
}
|
||||
|
||||
const fileStream = fs.createWriteStream(tempPath, { mode: 0o755 });
|
||||
const nodeStream = Readable.fromWeb(response.body as import("stream/web").ReadableStream);
|
||||
await pipeline(nodeStream, fileStream);
|
||||
await pipeline(response.body, fileStream);
|
||||
|
||||
// Download native addon
|
||||
console.log(chalk.dim(`Downloading ${nativeAddonName}...`));
|
||||
@@ -212,8 +210,7 @@ async function updateViaBinary(release: ReleaseInfo): Promise<void> {
|
||||
}
|
||||
|
||||
const nativeFileStream = fs.createWriteStream(nativeTempPath, { mode: 0o755 });
|
||||
const nativeNodeStream = Readable.fromWeb(nativeResponse.body as import("stream/web").ReadableStream);
|
||||
await pipeline(nativeNodeStream, nativeFileStream);
|
||||
await pipeline(nativeResponse.body, nativeFileStream);
|
||||
|
||||
// Replace current binary
|
||||
console.log(chalk.dim("Installing update..."));
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { TextDecoderStream } from "node:stream/web";
|
||||
|
||||
/**
|
||||
* Sanitize binary output for display/storage.
|
||||
* Removes characters that crash string-width or cause display issues:
|
||||
@@ -81,7 +79,7 @@ export function createSanitizerStream(): TransformStream<string, string> {
|
||||
* Create a transform stream that decodes text.
|
||||
*/
|
||||
export function createTextDecoderStream(): TransformStream<Uint8Array, string> {
|
||||
return new TextDecoderStream("utf-8", { ignoreBOM: true }) as TransformStream<Uint8Array, string>;
|
||||
return new TextDecoderStream() as TransformStream<Uint8Array, string>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"compilerOptions": {
|
||||
"target": "ES2024",
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2024"],
|
||||
"lib": ["ES2024", "DOM.AsyncIterable"],
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
|
||||
Reference in New Issue
Block a user