oh-my-opencode 3.7.2 → 3.7.3

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +48 -18
  2. package/package.json +8 -8
package/dist/cli/index.js CHANGED
@@ -9053,7 +9053,7 @@ var {
9053
9053
  // package.json
9054
9054
  var package_default = {
9055
9055
  name: "oh-my-opencode",
9056
- version: "3.7.2",
9056
+ version: "3.7.3",
9057
9057
  description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
9058
9058
  main: "dist/index.js",
9059
9059
  types: "dist/index.d.ts",
@@ -9127,13 +9127,13 @@ var package_default = {
9127
9127
  typescript: "^5.7.3"
9128
9128
  },
9129
9129
  optionalDependencies: {
9130
- "oh-my-opencode-darwin-arm64": "3.7.2",
9131
- "oh-my-opencode-darwin-x64": "3.7.2",
9132
- "oh-my-opencode-linux-arm64": "3.7.2",
9133
- "oh-my-opencode-linux-arm64-musl": "3.7.2",
9134
- "oh-my-opencode-linux-x64": "3.7.2",
9135
- "oh-my-opencode-linux-x64-musl": "3.7.2",
9136
- "oh-my-opencode-windows-x64": "3.7.2"
9130
+ "oh-my-opencode-darwin-arm64": "3.7.3",
9131
+ "oh-my-opencode-darwin-x64": "3.7.3",
9132
+ "oh-my-opencode-linux-arm64": "3.7.3",
9133
+ "oh-my-opencode-linux-arm64-musl": "3.7.3",
9134
+ "oh-my-opencode-linux-x64": "3.7.3",
9135
+ "oh-my-opencode-linux-x64-musl": "3.7.3",
9136
+ "oh-my-opencode-windows-x64": "3.7.3"
9137
9137
  },
9138
9138
  trustedDependencies: [
9139
9139
  "@ast-grep/cli",
@@ -25213,13 +25213,25 @@ function prependResolvedOpencodeBinToPath(env = process.env, resolve2 = resolveF
25213
25213
  }
25214
25214
 
25215
25215
  // src/cli/run/server-connection.ts
25216
+ function isPortStartFailure(error45, port) {
25217
+ if (!(error45 instanceof Error)) {
25218
+ return false;
25219
+ }
25220
+ return error45.message.includes(`Failed to start server on port ${port}`);
25221
+ }
25222
+ async function startServer(options) {
25223
+ const { signal, port } = options;
25224
+ const { client: client3, server: server2 } = await withWorkingOpencodePath(() => createOpencode({ signal, port, hostname: "127.0.0.1" }));
25225
+ console.log(import_picocolors9.default.dim("Server listening at"), import_picocolors9.default.cyan(server2.url));
25226
+ return { client: client3, cleanup: () => server2.close() };
25227
+ }
25216
25228
  async function createServerConnection(options) {
25217
25229
  prependResolvedOpencodeBinToPath();
25218
25230
  const { port, attach, signal } = options;
25219
25231
  if (attach !== undefined) {
25220
25232
  console.log(import_picocolors9.default.dim("Attaching to existing server at"), import_picocolors9.default.cyan(attach));
25221
- const client4 = createOpencodeClient({ baseUrl: attach });
25222
- return { client: client4, cleanup: () => {} };
25233
+ const client3 = createOpencodeClient({ baseUrl: attach });
25234
+ return { client: client3, cleanup: () => {} };
25223
25235
  }
25224
25236
  if (port !== undefined) {
25225
25237
  if (port < 1 || port > 65535) {
@@ -25228,13 +25240,24 @@ async function createServerConnection(options) {
25228
25240
  const available = await isPortAvailable(port, "127.0.0.1");
25229
25241
  if (available) {
25230
25242
  console.log(import_picocolors9.default.dim("Starting server on port"), import_picocolors9.default.cyan(port.toString()));
25231
- const { client: client5, server: server3 } = await withWorkingOpencodePath(() => createOpencode({ signal, port, hostname: "127.0.0.1" }));
25232
- console.log(import_picocolors9.default.dim("Server listening at"), import_picocolors9.default.cyan(server3.url));
25233
- return { client: client5, cleanup: () => server3.close() };
25243
+ try {
25244
+ return await startServer({ signal, port });
25245
+ } catch (error45) {
25246
+ if (!isPortStartFailure(error45, port)) {
25247
+ throw error45;
25248
+ }
25249
+ const stillAvailable = await isPortAvailable(port, "127.0.0.1");
25250
+ if (stillAvailable) {
25251
+ throw error45;
25252
+ }
25253
+ console.log(import_picocolors9.default.dim("Port"), import_picocolors9.default.cyan(port.toString()), import_picocolors9.default.dim("became occupied, attaching to existing server"));
25254
+ const client4 = createOpencodeClient({ baseUrl: `http://127.0.0.1:${port}` });
25255
+ return { client: client4, cleanup: () => {} };
25256
+ }
25234
25257
  }
25235
25258
  console.log(import_picocolors9.default.dim("Port"), import_picocolors9.default.cyan(port.toString()), import_picocolors9.default.dim("is occupied, attaching to existing server"));
25236
- const client4 = createOpencodeClient({ baseUrl: `http://127.0.0.1:${port}` });
25237
- return { client: client4, cleanup: () => {} };
25259
+ const client3 = createOpencodeClient({ baseUrl: `http://127.0.0.1:${port}` });
25260
+ return { client: client3, cleanup: () => {} };
25238
25261
  }
25239
25262
  const { port: selectedPort, wasAutoSelected } = await getAvailableServerPort(DEFAULT_SERVER_PORT, "127.0.0.1");
25240
25263
  if (wasAutoSelected) {
@@ -25242,9 +25265,16 @@ async function createServerConnection(options) {
25242
25265
  } else {
25243
25266
  console.log(import_picocolors9.default.dim("Starting server on port"), import_picocolors9.default.cyan(selectedPort.toString()));
25244
25267
  }
25245
- const { client: client3, server: server2 } = await withWorkingOpencodePath(() => createOpencode({ signal, port: selectedPort, hostname: "127.0.0.1" }));
25246
- console.log(import_picocolors9.default.dim("Server listening at"), import_picocolors9.default.cyan(server2.url));
25247
- return { client: client3, cleanup: () => server2.close() };
25268
+ try {
25269
+ return await startServer({ signal, port: selectedPort });
25270
+ } catch (error45) {
25271
+ if (!isPortStartFailure(error45, selectedPort)) {
25272
+ throw error45;
25273
+ }
25274
+ const { port: retryPort } = await getAvailableServerPort(selectedPort + 1, "127.0.0.1");
25275
+ console.log(import_picocolors9.default.dim("Retrying server start on port"), import_picocolors9.default.cyan(retryPort.toString()));
25276
+ return await startServer({ signal, port: retryPort });
25277
+ }
25248
25278
  }
25249
25279
 
25250
25280
  // src/cli/run/session-resolver.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-opencode",
3
- "version": "3.7.2",
3
+ "version": "3.7.3",
4
4
  "description": "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -74,13 +74,13 @@
74
74
  "typescript": "^5.7.3"
75
75
  },
76
76
  "optionalDependencies": {
77
- "oh-my-opencode-darwin-arm64": "3.7.2",
78
- "oh-my-opencode-darwin-x64": "3.7.2",
79
- "oh-my-opencode-linux-arm64": "3.7.2",
80
- "oh-my-opencode-linux-arm64-musl": "3.7.2",
81
- "oh-my-opencode-linux-x64": "3.7.2",
82
- "oh-my-opencode-linux-x64-musl": "3.7.2",
83
- "oh-my-opencode-windows-x64": "3.7.2"
77
+ "oh-my-opencode-darwin-arm64": "3.7.3",
78
+ "oh-my-opencode-darwin-x64": "3.7.3",
79
+ "oh-my-opencode-linux-arm64": "3.7.3",
80
+ "oh-my-opencode-linux-arm64-musl": "3.7.3",
81
+ "oh-my-opencode-linux-x64": "3.7.3",
82
+ "oh-my-opencode-linux-x64-musl": "3.7.3",
83
+ "oh-my-opencode-windows-x64": "3.7.3"
84
84
  },
85
85
  "trustedDependencies": [
86
86
  "@ast-grep/cli",