diff --git a/bun.lock b/bun.lock index 325eeb15f51..234c7a4c910 100644 --- a/bun.lock +++ b/bun.lock @@ -571,6 +571,7 @@ "patchedDependencies": { "@openrouter/ai-sdk-provider@1.5.4": "patches/@openrouter%2Fai-sdk-provider@1.5.4.patch", "@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch", + "@opentui/core@0.1.86": "patches/@opentui%2Fcore@0.1.86.patch", }, "overrides": { "@types/bun": "catalog:", diff --git a/package.json b/package.json index 36cf31d3468..ec8e40a12d8 100644 --- a/package.json +++ b/package.json @@ -109,6 +109,7 @@ }, "patchedDependencies": { "@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch", - "@openrouter/ai-sdk-provider@1.5.4": "patches/@openrouter%2Fai-sdk-provider@1.5.4.patch" + "@openrouter/ai-sdk-provider@1.5.4": "patches/@openrouter%2Fai-sdk-provider@1.5.4.patch", + "@opentui/core@0.1.86": "patches/@opentui%2Fcore@0.1.86.patch" } } diff --git a/packages/opencode/script/build.ts b/packages/opencode/script/build.ts index 34e80d71a08..1889d1f68c2 100755 --- a/packages/opencode/script/build.ts +++ b/packages/opencode/script/build.ts @@ -9,6 +9,7 @@ import solidPlugin from "../node_modules/@opentui/solid/scripts/solid-plugin" const __filename = fileURLToPath(import.meta.url) const __dirname = path.dirname(__filename) const dir = path.resolve(__dirname, "..") +const repoRoot = path.resolve(dir, "../..") process.chdir(dir) @@ -144,8 +145,7 @@ await $`rm -rf dist` const binaries: Record = {} if (!skipInstall) { - await $`bun install --os="*" --cpu="*" @opentui/core@${pkg.dependencies["@opentui/core"]}` - await $`bun install --os="*" --cpu="*" @parcel/watcher@${pkg.dependencies["@parcel/watcher"]}` + await $`bun install --os="*" --cpu="*"`.cwd(repoRoot) } for (const item of targets) { const name = [ diff --git a/patches/@opentui%2Fcore@0.1.86.patch b/patches/@opentui%2Fcore@0.1.86.patch new file mode 100644 index 00000000000..204580b7317 --- /dev/null +++ b/patches/@opentui%2Fcore@0.1.86.patch @@ -0,0 +1,48 @@ +diff --git a/index-4sjb8n0n.js b/index-4sjb8n0n.js +index 052afc9d6..e19908fb2 100644 +--- a/index-4sjb8n0n.js ++++ b/index-4sjb8n0n.js +@@ -16210,6 +16210,7 @@ class CliRenderer extends EventEmitter9 { + lastTime = 0; + frameCount = 0; + lastFpsTime = 0; ++ now = typeof performance !== "undefined" && typeof performance.now === "function" ? () => performance.now() : () => Date.now(); + currentFps = 0; + targetFrameTime = 1000 / this.targetFps; + minTargetFrameTime = 1000 / this.maxFps; +@@ -16521,8 +16522,8 @@ Captured output: + } + if (!this.updateScheduled && !this.renderTimeout) { + this.updateScheduled = true; +- const now = Date.now(); +- const elapsed = now - this.lastTime; ++ const now = this.now(); ++ const elapsed = Math.max(now - this.lastTime, 0); + const delay = Math.max(this.minTargetFrameTime - elapsed, 0); + if (delay === 0) { + process.nextTick(() => this.activateFrame()); +@@ -17398,7 +17399,7 @@ Captured output: + startRenderLoop() { + if (!this._isRunning) + return; +- this.lastTime = Date.now(); ++ this.lastTime = this.now(); + this.frameCount = 0; + this.lastFpsTime = this.lastTime; + this.currentFps = 0; +@@ -17414,12 +17415,12 @@ Captured output: + this.renderTimeout = null; + } + try { +- const now = Date.now(); +- const elapsed = now - this.lastTime; ++ const now = this.now(); ++ const elapsed = Math.max(now - this.lastTime, 0); + const deltaTime = elapsed; + this.lastTime = now; + this.frameCount++; +- if (now - this.lastFpsTime >= 1000) { ++ if (Math.max(now - this.lastFpsTime, 0) >= 1000) { + this.currentFps = this.frameCount; + this.frameCount = 0; + this.lastFpsTime = now;