opencode-agent-tmux 1.1.9 → 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.
@@ -84,29 +84,44 @@ function hasTmux() {
84
84
  return false;
85
85
  }
86
86
  }
87
+ function extractLogUpdateFlag(args) {
88
+ let logUpdate = false;
89
+ const cleaned = [];
90
+ for (const arg of args) {
91
+ if (arg === "--log-update" || arg.startsWith("--log-update=")) {
92
+ logUpdate = true;
93
+ continue;
94
+ }
95
+ cleaned.push(arg);
96
+ }
97
+ return { args: cleaned, logUpdate };
98
+ }
87
99
  async function main() {
88
- spawnPluginUpdater();
89
100
  const opencodeBin = findOpencodeBin();
90
101
  if (!opencodeBin) {
91
- console.error("\u274C Error: Could not find 'opencode' binary.");
92
- 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.');
93
103
  exit(1);
94
104
  }
105
+ spawnPluginUpdater();
95
106
  const port = await findAvailablePort();
96
107
  if (!port) {
97
- console.error("\u274C No ports available in range " + OPENCODE_PORT_START + "-" + OPENCODE_PORT_MAX);
108
+ console.error("Error: No available ports found in range 4096-4106.");
98
109
  exit(1);
99
110
  }
100
- if (port !== OPENCODE_PORT_START) {
101
- console.warn(`\u26A0\uFE0F Port ${OPENCODE_PORT_START} is in use, using port ${port} instead`);
111
+ const env2 = { ...process.env };
112
+ env2.OPENCODE_PORT = port.toString();
113
+ const rawArgs = argv.slice(2);
114
+ const { args, logUpdate } = extractLogUpdateFlag(rawArgs);
115
+ if (logUpdate) {
116
+ env2.OPENCODE_AUTO_UPDATE_LOG_UPDATE = "true";
117
+ env2.OPENCODE_AUTO_UPDATE_BYPASS_THROTTLE = "true";
118
+ env2.OPENCODE_AUTO_UPDATE_DEBUG = "true";
102
119
  }
103
- env.OPENCODE_PORT = port.toString();
104
- const args = argv.slice(2);
105
120
  const childArgs = ["--port", port.toString(), ...args];
106
- const inTmux = !!env.TMUX;
121
+ const inTmux = !!env2.TMUX;
107
122
  const tmuxAvailable = hasTmux();
108
123
  if (inTmux || !tmuxAvailable) {
109
- const child = spawn(opencodeBin, childArgs, { stdio: "inherit" });
124
+ const child = spawn(opencodeBin, childArgs, { stdio: "inherit", env: env2 });
110
125
  child.on("close", (code) => exit(code ?? 0));
111
126
  process.on("SIGINT", () => child.kill("SIGINT"));
112
127
  process.on("SIGTERM", () => child.kill("SIGTERM"));
@@ -122,7 +137,7 @@ async function main() {
122
137
  "new-session",
123
138
  shellCommand
124
139
  ];
125
- const child = spawn("tmux", tmuxArgs, { stdio: "inherit" });
140
+ const child = spawn("tmux", tmuxArgs, { stdio: "inherit", env: env2 });
126
141
  child.on("close", (code) => exit(code ?? 0));
127
142
  }
128
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-agent-tmux",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "description": "OpenCode plugin that provides tmux integration for viewing agent execution in real-time",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",