Skip to content

Commit 7ed1560

Browse files
committed
fix(opencode): single-regex ready-line match for v1/v2 serve output
1 parent b8b526e commit 7ed1560

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

‎apps/server/src/provider/opencodeRuntime.ts‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,8 @@ export interface OpenCodeRuntimeShape {
288288

289289
function parseServerUrlFromOutput(output: string): string | null {
290290
for (const line of output.split("\n")) {
291-
// OpenCode v1 prints "opencode server listening on <url>";
292-
// v2 prints "server listening on <url>". Match either.
293-
if (!line.toLowerCase().includes("server listening")) {
294-
continue;
295-
}
296-
const match = line.match(/on\s+(https?:\/\/[^\s]+)/);
297-
return match?.[1] ?? null;
291+
const match = line.match(/server listening on\s+(https?:\/\/[^\s]+)/i);
292+
if (match?.[1]) return match[1];
298293
}
299294
return null;
300295
}

0 commit comments

Comments
 (0)