|
|
@@ -7,32 +7,12 @@ import { Log } from "../util/log"
|
|
|
import type { WSContext } from "hono/ws"
|
|
|
import { Instance } from "../project/instance"
|
|
|
import { lazy } from "@opencode-ai/util/lazy"
|
|
|
-import {} from "process"
|
|
|
-import { Installation } from "@/installation"
|
|
|
import { Shell } from "@/shell/shell"
|
|
|
|
|
|
export namespace Pty {
|
|
|
const log = Log.create({ service: "pty" })
|
|
|
|
|
|
const pty = lazy(async () => {
|
|
|
- if (!Installation.isLocal()) {
|
|
|
- const path = require(
|
|
|
- `bun-pty/rust-pty/target/release/${
|
|
|
- process.platform === "win32"
|
|
|
- ? "rust_pty.dll"
|
|
|
- : process.platform === "linux" && process.arch === "x64"
|
|
|
- ? "librust_pty.so"
|
|
|
- : process.platform === "darwin" && process.arch === "x64"
|
|
|
- ? "librust_pty.dylib"
|
|
|
- : process.platform === "darwin" && process.arch === "arm64"
|
|
|
- ? "librust_pty_arm64.dylib"
|
|
|
- : process.platform === "linux" && process.arch === "arm64"
|
|
|
- ? "librust_pty_arm64.so"
|
|
|
- : ""
|
|
|
- }`,
|
|
|
- )
|
|
|
- process.env.BUN_PTY_LIB = path
|
|
|
- }
|
|
|
const { spawn } = await import("bun-pty")
|
|
|
return spawn
|
|
|
})
|
|
|
@@ -128,6 +108,7 @@ export namespace Pty {
|
|
|
cwd,
|
|
|
env,
|
|
|
})
|
|
|
+
|
|
|
const info = {
|
|
|
id,
|
|
|
title: input.title || `Terminal ${id.slice(-4)}`,
|