opencode-agent-tmux 1.1.8 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/opencode-tmux.js +11 -14
- package/package.json +1 -1
|
@@ -97,34 +97,31 @@ function extractLogUpdateFlag(args) {
|
|
|
97
97
|
return { args: cleaned, logUpdate };
|
|
98
98
|
}
|
|
99
99
|
async function main() {
|
|
100
|
-
spawnPluginUpdater();
|
|
101
100
|
const opencodeBin = findOpencodeBin();
|
|
102
101
|
if (!opencodeBin) {
|
|
103
|
-
console.error(
|
|
104
|
-
console.error(" Please ensure OpenCode is installed and in your PATH.");
|
|
102
|
+
console.error('Error: Could not find "opencode" binary in PATH or common locations.');
|
|
105
103
|
exit(1);
|
|
106
104
|
}
|
|
105
|
+
spawnPluginUpdater();
|
|
107
106
|
const port = await findAvailablePort();
|
|
108
107
|
if (!port) {
|
|
109
|
-
console.error("
|
|
108
|
+
console.error("Error: No available ports found in range 4096-4106.");
|
|
110
109
|
exit(1);
|
|
111
110
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
env.OPENCODE_PORT = port.toString();
|
|
111
|
+
const env2 = { ...process.env };
|
|
112
|
+
env2.OPENCODE_PORT = port.toString();
|
|
116
113
|
const rawArgs = argv.slice(2);
|
|
117
114
|
const { args, logUpdate } = extractLogUpdateFlag(rawArgs);
|
|
118
115
|
if (logUpdate) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
env2.OPENCODE_AUTO_UPDATE_LOG_UPDATE = "true";
|
|
117
|
+
env2.OPENCODE_AUTO_UPDATE_BYPASS_THROTTLE = "true";
|
|
118
|
+
env2.OPENCODE_AUTO_UPDATE_DEBUG = "true";
|
|
122
119
|
}
|
|
123
120
|
const childArgs = ["--port", port.toString(), ...args];
|
|
124
|
-
const inTmux = !!
|
|
121
|
+
const inTmux = !!env2.TMUX;
|
|
125
122
|
const tmuxAvailable = hasTmux();
|
|
126
123
|
if (inTmux || !tmuxAvailable) {
|
|
127
|
-
const child = spawn(opencodeBin, childArgs, { stdio: "inherit" });
|
|
124
|
+
const child = spawn(opencodeBin, childArgs, { stdio: "inherit", env: env2 });
|
|
128
125
|
child.on("close", (code) => exit(code ?? 0));
|
|
129
126
|
process.on("SIGINT", () => child.kill("SIGINT"));
|
|
130
127
|
process.on("SIGTERM", () => child.kill("SIGTERM"));
|
|
@@ -140,7 +137,7 @@ async function main() {
|
|
|
140
137
|
"new-session",
|
|
141
138
|
shellCommand
|
|
142
139
|
];
|
|
143
|
-
const child = spawn("tmux", tmuxArgs, { stdio: "inherit" });
|
|
140
|
+
const child = spawn("tmux", tmuxArgs, { stdio: "inherit", env: env2 });
|
|
144
141
|
child.on("close", (code) => exit(code ?? 0));
|
|
145
142
|
}
|
|
146
143
|
}
|