openwrk 0.1.3 → 0.1.4

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/README.md CHANGED
@@ -11,6 +11,9 @@ openwrk start --workspace /path/to/workspace --approval auto
11
11
 
12
12
  `openwrk` ships as a compiled binary, so Bun is not required at runtime.
13
13
 
14
+ Owpenbot is optional; if installed, `openwrk` will pass `OPENCODE_URL` via env and only use the
15
+ `--opencode-url` flag when supported by the installed owpenbot version.
16
+
14
17
  `openwrk` installs the OpenWork server dependency automatically. No extra install needed.
15
18
 
16
19
  Or from source:
package/dist/cli.js CHANGED
@@ -283,6 +283,43 @@ function resolveBinCommand(bin) {
283
283
  }
284
284
  return { command: bin, prefixArgs: [] };
285
285
  }
286
+ async function readOwpenbotHelp(bin) {
287
+ const resolved = resolveBinCommand(bin);
288
+ return new Promise((resolve) => {
289
+ const child = spawn(resolved.command, [...resolved.prefixArgs, "--help"], {
290
+ stdio: ["ignore", "pipe", "pipe"],
291
+ });
292
+ let output = "";
293
+ const finish = () => resolve(output);
294
+ const timeout = setTimeout(() => {
295
+ try {
296
+ child.kill("SIGKILL");
297
+ }
298
+ catch {
299
+ // ignore
300
+ }
301
+ finish();
302
+ }, 1500);
303
+ child.stdout?.on("data", (chunk) => {
304
+ output += String(chunk);
305
+ });
306
+ child.stderr?.on("data", (chunk) => {
307
+ output += String(chunk);
308
+ });
309
+ child.on("exit", () => {
310
+ clearTimeout(timeout);
311
+ finish();
312
+ });
313
+ child.on("error", () => {
314
+ clearTimeout(timeout);
315
+ finish();
316
+ });
317
+ });
318
+ }
319
+ async function owpenbotSupportsOpencodeUrl(bin) {
320
+ const help = await readOwpenbotHelp(bin);
321
+ return help.includes("--opencode-url");
322
+ }
286
323
  function resolveBinPath(bin) {
287
324
  if (bin.includes("/") || bin.startsWith(".")) {
288
325
  return resolve(process.cwd(), bin);
@@ -309,6 +346,18 @@ async function resolveOpenworkServerBin(explicit) {
309
346
  catch {
310
347
  // ignore
311
348
  }
349
+ try {
350
+ const selfPath = process.execPath || process.argv[0];
351
+ if (selfPath) {
352
+ const bundledServer = join(dirname(selfPath), "openwork-server");
353
+ if (await isExecutable(bundledServer)) {
354
+ return bundledServer;
355
+ }
356
+ }
357
+ }
358
+ catch {
359
+ // ignore
360
+ }
312
361
  return "openwork-server";
313
362
  }
314
363
  async function waitForHealthy(url, timeoutMs = 10_000, pollMs = 250) {
@@ -482,7 +531,10 @@ async function startOpenworkServer(options) {
482
531
  }
483
532
  async function startOwpenbot(options) {
484
533
  const args = ["start", options.workspace];
485
- if (options.opencodeUrl) {
534
+ const supportsOpencodeUrl = options.opencodeUrl
535
+ ? await owpenbotSupportsOpencodeUrl(options.bin)
536
+ : false;
537
+ if (options.opencodeUrl && supportsOpencodeUrl) {
486
538
  args.push("--opencode-url", options.opencodeUrl);
487
539
  }
488
540
  const resolved = resolveBinCommand(options.bin);
@@ -491,6 +543,8 @@ async function startOwpenbot(options) {
491
543
  stdio: ["ignore", "pipe", "pipe"],
492
544
  env: {
493
545
  ...process.env,
546
+ ...(options.opencodeUrl ? { OPENCODE_URL: options.opencodeUrl } : {}),
547
+ OPENCODE_DIRECTORY: options.workspace,
494
548
  ...(options.opencodeUsername ? { OPENCODE_SERVER_USERNAME: options.opencodeUsername } : {}),
495
549
  ...(options.opencodePassword ? { OPENCODE_SERVER_PASSWORD: options.opencodePassword } : {}),
496
550
  },
package/dist/openwrk CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openwrk",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Headless OpenWork host orchestrator for OpenCode + OpenWork server + Owpenbot",
5
5
  "type": "module",
6
6
  "bin": {