mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-20 18:57:17 +03:00
fix(core): pin @opencode/pty 0.6.0 and use protocol 9 (#64251)
This commit is contained in:
committed by
GitHub
Unverified
parent
c6882a15db
commit
a9e910d2d4
@@ -118,7 +118,7 @@
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@opencode/client": "workspace:*",
|
||||
"@opencode/plugin": "workspace:*",
|
||||
"@opencode/pty": "0.5.2",
|
||||
"@opencode/pty": "0.6.0",
|
||||
"@opencode/schema": "workspace:*",
|
||||
"@opencode/server": "workspace:*",
|
||||
"@opencode/tui": "workspace:*",
|
||||
@@ -227,7 +227,7 @@
|
||||
"@opencode/codemode": "workspace:*",
|
||||
"@opencode/plugin": "workspace:*",
|
||||
"@opencode/plugin-browser": "workspace:*",
|
||||
"@opencode/pty": "0.5.2",
|
||||
"@opencode/pty": "0.6.0",
|
||||
"@opencode/schema": "workspace:*",
|
||||
"@opencode/util": "workspace:*",
|
||||
"@parcel/watcher": "2.5.1",
|
||||
@@ -667,7 +667,7 @@
|
||||
"devDependencies": {
|
||||
"@opencode/client": "workspace:*",
|
||||
"@opencode/plugin": "workspace:*",
|
||||
"@opencode/pty": "0.5.2",
|
||||
"@opencode/pty": "0.6.0",
|
||||
"@tsconfig/bun": "catalog:",
|
||||
"@types/bun": "catalog:",
|
||||
"@typescript/native": "catalog:",
|
||||
@@ -1833,23 +1833,23 @@
|
||||
|
||||
"@opencode/protocol": ["@opencode/protocol@workspace:packages/protocol"],
|
||||
|
||||
"@opencode/pty": ["@opencode/pty@0.5.2", "", { "optionalDependencies": { "@opencode/pty-darwin-arm64": "0.5.2", "@opencode/pty-darwin-x64": "0.5.2", "@opencode/pty-linux-arm64-gnu": "0.5.2", "@opencode/pty-linux-arm64-musl": "0.5.2", "@opencode/pty-linux-x64-gnu": "0.5.2", "@opencode/pty-linux-x64-musl": "0.5.2", "@opencode/pty-win32-arm64": "0.5.2", "@opencode/pty-win32-x64": "0.5.2" }, "bin": { "opencode-pty": "bin/opencode-pty.js" } }, "sha512-SZrzOFZDQHvPndC+ZfDYB52qY/RFxeW0OmKeosSlm4I7tmdDxtvUYN/vy8yynh8678bL+1efbQGxhKa1nz0DCA=="],
|
||||
"@opencode/pty": ["@opencode/pty@0.6.0", "", { "optionalDependencies": { "@opencode/pty-darwin-arm64": "0.6.0", "@opencode/pty-darwin-x64": "0.6.0", "@opencode/pty-linux-arm64-gnu": "0.6.0", "@opencode/pty-linux-arm64-musl": "0.6.0", "@opencode/pty-linux-x64-gnu": "0.6.0", "@opencode/pty-linux-x64-musl": "0.6.0", "@opencode/pty-win32-arm64": "0.6.0", "@opencode/pty-win32-x64": "0.6.0" }, "bin": { "opencode-pty": "bin/opencode-pty.js" } }, "sha512-H4sID90Vuj0AxRN+WFILS65xUZCrltFfRQF7kL8VG6DGyg7bUsNE9LZHgvoWecTWxSZ4HT5ZFd/wUx2eCLTL6w=="],
|
||||
|
||||
"@opencode/pty-darwin-arm64": ["@opencode/pty-darwin-arm64@0.5.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-CxlLA/+ruVwt+QGOQEnBxiIImgpYU9EdW7bjvA0m+qSDOrFc0hAHOD13Suq3B2JJQxSsj7IM3XicQqmJfqe32Q=="],
|
||||
"@opencode/pty-darwin-arm64": ["@opencode/pty-darwin-arm64@0.6.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-KDDVvVVcJJlb5vqtzqs/os1DxNwviKV1iwfjODww9y6qAl/Dx/IFZnqlDjp7sTwrAmX2HnJgqIqhwSii+QFRIw=="],
|
||||
|
||||
"@opencode/pty-darwin-x64": ["@opencode/pty-darwin-x64@0.5.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-xn4W7y8D+93WM+5+VAwTsPJjw/U9TTEZJQdtIQqFwcCgPCQUylMGu4/xhFbyMllzSycZyysJuhV6CHq/J798zw=="],
|
||||
"@opencode/pty-darwin-x64": ["@opencode/pty-darwin-x64@0.6.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-A97X8lI7EvEcLhIEPHi79hKZDlBpjO2hopL0ehphjzzQpoS8iCivY+6lo2+9Lf+B/sAHVQYWE4jqpymdM4l6nw=="],
|
||||
|
||||
"@opencode/pty-linux-arm64-gnu": ["@opencode/pty-linux-arm64-gnu@0.5.2", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-0Kg1477t9VYHLkaOStiDuoC8S3qHH92ZY/QEgNSOavgkCAAbSEU0NrkIBhEi3Gnw5+ElvfgVcLzEwcM5cfiYAA=="],
|
||||
"@opencode/pty-linux-arm64-gnu": ["@opencode/pty-linux-arm64-gnu@0.6.0", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-XMLczimkpuY1fYxn1UmybhbRt7bvDL33qY3NcJq0xE3mNhFTT75SEneduG+3i56+WmIa2QXLrbvubvOWk/u9CQ=="],
|
||||
|
||||
"@opencode/pty-linux-arm64-musl": ["@opencode/pty-linux-arm64-musl@0.5.2", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-ZNk4nBooiVCvkB8cCfwn2nDV5OQHdFk/MfRQzBfwk28LakM1YC4lSwZPzY0McvFVjUILie9UEKntHRzgPaDBcA=="],
|
||||
"@opencode/pty-linux-arm64-musl": ["@opencode/pty-linux-arm64-musl@0.6.0", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-JjC0D3xhdr0ArDydPg1j0ubo0qypeGPM7fLYbjpvAn3HVgFwdHvhX8DmUqjZHsCtiBVZLGsu5o51vluLLN47/g=="],
|
||||
|
||||
"@opencode/pty-linux-x64-gnu": ["@opencode/pty-linux-x64-gnu@0.5.2", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-iLEq9nWOKfm9iWqDGlhqcx+SSLFqBz3toX83n/W+MSlxWg5048HzlGd/3RxY04sxmI6dlg/Ygz3KqP3bCgfusg=="],
|
||||
"@opencode/pty-linux-x64-gnu": ["@opencode/pty-linux-x64-gnu@0.6.0", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-OdeuIfAzBM78DNTBoqcwoDanmlokHg+/wPIIB38QbvTms1mNlbUZhILBOw7ra9EwUfSOy6jfcUlrBFLMKj1aOA=="],
|
||||
|
||||
"@opencode/pty-linux-x64-musl": ["@opencode/pty-linux-x64-musl@0.5.2", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-jBIw7oimeoTXoHH4yvtVFoPZGU1Rx+kdTVU8HVFGwCDNmeP4hI+R7QhF/pEsKZxzykTskR5x9u5ciiVJ5WEnMg=="],
|
||||
"@opencode/pty-linux-x64-musl": ["@opencode/pty-linux-x64-musl@0.6.0", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-8Vm4xBxMQZK212ccHdhVtkAgumueVODYJuazsXzw0yOp5jZhuGCNdxSHeTCItM/SuvoVgVV7c0yySrwszTXwTg=="],
|
||||
|
||||
"@opencode/pty-win32-arm64": ["@opencode/pty-win32-arm64@0.5.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-giPMQUcSyoe2z6wQN6MKhRgu4rVv/xqscX8qOVt2lu7yfRNfviPFVY0qFPGOcu1L3e+DT5VrIo2QZeRBeV1Bdw=="],
|
||||
"@opencode/pty-win32-arm64": ["@opencode/pty-win32-arm64@0.6.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-lYPHn9pqM/0dpuDw+aqAx4k88oHEGM4lNvleQf0Pw+LF+aWTQjHtnx3LoUJEKAlYFOuCbNvLUr4SfAKwhPLsGQ=="],
|
||||
|
||||
"@opencode/pty-win32-x64": ["@opencode/pty-win32-x64@0.5.2", "", { "os": "win32", "cpu": "x64" }, "sha512-hXdQWx+gHhQMRovDS3Fm0n4LuvSgLxRqEdicpVQzjjCTPYBMSBysWYRheQ2ydZlP0GCQ2Ymoi0dixgAHTYHO8A=="],
|
||||
"@opencode/pty-win32-x64": ["@opencode/pty-win32-x64@0.6.0", "", { "os": "win32", "cpu": "x64" }, "sha512-Qb0dqKJyRqe8Q2olfiEc47UybtIUEH12SWag0PkVqDqXabWA3urvcO4+hhD4g/WDkm9F6lPzafiSddtjb2HMtA=="],
|
||||
|
||||
"@opencode/schema": ["@opencode/schema@workspace:packages/schema"],
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@opencode/client": "workspace:*",
|
||||
"@opencode/plugin": "workspace:*",
|
||||
"@opencode/pty": "0.5.2",
|
||||
"@opencode/pty": "0.6.0",
|
||||
"@opencode/schema": "workspace:*",
|
||||
"@opencode/server": "workspace:*",
|
||||
"@opencode/tui": "workspace:*",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"@modelcontextprotocol/client": "2.4.0",
|
||||
"@modelcontextprotocol/core": "2.4.0",
|
||||
"@modelcontextprotocol/server": "2.4.0",
|
||||
"@opencode/pty": "0.5.2",
|
||||
"@opencode/pty": "0.6.0",
|
||||
"@opencode/ai": "workspace:*",
|
||||
"@opencode/codemode": "workspace:*",
|
||||
"@opencode/plugin": "workspace:*",
|
||||
|
||||
@@ -5,7 +5,7 @@ import path from "node:path"
|
||||
import { Cause, Data, Duration, Effect, Schema, Semaphore } from "effect"
|
||||
import type { Handoff } from "@opencode/schema/persistent-pty"
|
||||
|
||||
const ProtocolVersion = 8
|
||||
const ProtocolVersion = 9
|
||||
const MaxFrameBytes = 8 * 1024 * 1024
|
||||
|
||||
const Lifecycle = Schema.Union([
|
||||
|
||||
@@ -327,8 +327,7 @@ const daemonLayer = Layer.effect(
|
||||
if (run.stopping) yield* Fiber.interrupt(run.stopping)
|
||||
// Stop waiting first, so forgetting the process is not mistaken for losing it.
|
||||
if (run.wait) yield* Fiber.interrupt(run.wait)
|
||||
// Forget the process before deleting its file. This also kills what is left of its group, even after a
|
||||
// successful exit, which a spawned command would leave running: the daemon cannot forget a process otherwise.
|
||||
// Terminate a running command or just forget a finished one before deleting its file.
|
||||
yield* pty.terminatePipe(run.process).pipe(Effect.ignore)
|
||||
yield* Effect.promise(() => unlink(run.info.file).catch(() => {}))
|
||||
yield* Deferred.fail(run.done, new NotFoundError({ id }))
|
||||
@@ -431,13 +430,6 @@ const daemonLayer = Layer.effect(
|
||||
),
|
||||
),
|
||||
),
|
||||
// Like spawned commands: what a failed command left running in its group is stopped with it, while a
|
||||
// successful one may leave background processes (`cmd &`) behind.
|
||||
Effect.tap((outcome) =>
|
||||
outcome.status === "exited" && outcome.exit !== undefined && outcome.exit !== 0
|
||||
? pty.signalPipe(run.process, "SIGTERM").pipe(Effect.ignore)
|
||||
: Effect.void,
|
||||
),
|
||||
Effect.flatMap((outcome) => finish(run, outcome)),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import os from "node:os"
|
||||
import path from "node:path"
|
||||
import { Effect } from "effect"
|
||||
|
||||
export const pong = { type: "pong", instance_id: "test", pid: process.pid, protocol: 8, features: [] }
|
||||
export const pong = { type: "pong", instance_id: "test", pid: process.pid, protocol: 9, features: [] }
|
||||
|
||||
export function temporaryDirectory() {
|
||||
return Effect.acquireRelease(
|
||||
@@ -105,7 +105,7 @@ export function frame(value: object) {
|
||||
export function writeRegistration(directory: string, socket: string, instance = "test", token = "test") {
|
||||
return writeFile(
|
||||
path.join(directory, "service.json"),
|
||||
JSON.stringify({ instance_id: instance, pid: process.pid, protocol: 8, socket, token, features: [] }),
|
||||
JSON.stringify({ instance_id: instance, pid: process.pid, protocol: 9, socket, token, features: [] }),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ it.live("rejects incompatible daemons without replacing or killing them", () =>
|
||||
const optional = yield* Effect.flip(daemon.requestIfRunning({ op: "list" }))
|
||||
expect(optional).toMatchObject({
|
||||
kind: "protocol",
|
||||
message: "opencode-pty protocol mismatch: daemon=7, client=8",
|
||||
message: "opencode-pty protocol mismatch: daemon=7, client=9",
|
||||
pid: existing.pid,
|
||||
})
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ describe("Shell on the process daemon", () => {
|
||||
}),
|
||||
)
|
||||
|
||||
it.live("stops what a failed command left in its group, and leaves a successful one's", () =>
|
||||
it.live("records successful and failed exits without signalling a finished command", () =>
|
||||
Effect.gen(function* () {
|
||||
const env = yield* daemonShells()
|
||||
yield* env.withShell(env.directory, (shell) =>
|
||||
@@ -262,7 +262,7 @@ describe("Shell on the process daemon", () => {
|
||||
env.daemon.exit(2, 3)
|
||||
expect(yield* shell.wait(failed.id)).toMatchObject({ status: "exited", exit: 3 })
|
||||
expect(yield* shell.wait(succeeded.id)).toMatchObject({ status: "exited", exit: 0 })
|
||||
expect(env.signals(2)).toEqual(["SIGTERM"])
|
||||
expect(env.signals(2)).toEqual([])
|
||||
expect(env.signals(1)).toEqual([])
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -232,18 +232,6 @@ const call = (input: typeof ShellTool.Input.Type, id = "call-shell") => ({
|
||||
|
||||
const isWindows = process.platform === "win32"
|
||||
|
||||
// The process daemon keeps a finished command's zombie until the command is forgotten.
|
||||
const running = (pid: number) => {
|
||||
try {
|
||||
process.kill(pid, 0)
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
return !Bun.spawnSync(["ps", "-o", "stat=", "-p", String(pid)])
|
||||
.stdout.toString()
|
||||
.trim()
|
||||
.startsWith("Z")
|
||||
}
|
||||
const cwdCommand = isWindows ? "(Get-Location).Path; Start-Sleep -Milliseconds 100" : "pwd"
|
||||
const helloCommand = isWindows ? "[Console]::Out.Write('hello'); Start-Sleep -Milliseconds 100" : "printf hello"
|
||||
const stderrCommand = isWindows
|
||||
@@ -2044,7 +2032,7 @@ describe("ShellTool", () => {
|
||||
})
|
||||
const pid = info.pid
|
||||
if (pid === undefined) throw new Error("Expected shell PID")
|
||||
expect(running(pid)).toBe(false)
|
||||
expect(() => process.kill(pid, 0)).toThrow(expect.objectContaining({ code: "ESRCH" }))
|
||||
}),
|
||||
(info) =>
|
||||
Effect.try(() => {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
"effect": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@opencode/pty": "0.5.2",
|
||||
"@opencode/pty": "0.6.0",
|
||||
"@opencode/client": "workspace:*",
|
||||
"@opencode/plugin": "workspace:*",
|
||||
"@tsconfig/bun": "catalog:",
|
||||
|
||||
Reference in New Issue
Block a user