Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions auto-update.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as fs from "fs";
import * as path from "path";
import * as os from "os";
import { spawn } from "child_process";
import type { PluginInput } from "@opencode-ai/plugin";

const PACKAGE_NAME = "opencode-session-handoff";
Expand Down Expand Up @@ -204,16 +205,19 @@ function invalidatePackage(): boolean {

async function runBunInstall(): Promise<boolean> {
try {
const proc = Bun.spawn(["bun", "install"], {
const proc = spawn("bun", ["install"], {
cwd: getConfigDir(),
stdout: "pipe",
stderr: "pipe",
stdio: "pipe",
});

const exitPromise = new Promise<number | null>((resolve) => {
proc.on("close", (code) => resolve(code));
proc.on("error", () => resolve(null));
});

const timeoutPromise = new Promise<"timeout">((resolve) =>
setTimeout(() => resolve("timeout"), BUN_INSTALL_TIMEOUT_MS),
);
const exitPromise = proc.exited.then(() => "completed" as const);

const result = await Promise.race([exitPromise, timeoutPromise]);

Expand All @@ -226,7 +230,7 @@ async function runBunInstall(): Promise<boolean> {
return false;
}

return proc.exitCode === 0;
return result === 0;
} catch {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opencode-session-handoff",
"version": "1.1.0",
"version": "1.1.6",
"description": "OpenCode plugin for seamless session continuation when context windows fill up",
"keywords": [
"context-window",
Expand Down