octiqflow 0.2.5 → 0.2.8

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/lib/cli.cjs +21 -3
  2. package/package.json +5 -5
package/lib/cli.cjs CHANGED
@@ -12,7 +12,7 @@ const {
12
12
  const HELP = `OctiqFlow — agent workflow orchestration in your browser
13
13
 
14
14
  Usage:
15
- octiqflow Run in the foreground
15
+ octiqflow Run in the foreground and open the client
16
16
  octiqflow install [options] Install and start the macOS background service
17
17
  octiqflow uninstall Remove the macOS background service
18
18
  octiqflow status [options] Check the service and HTTP endpoint
@@ -22,7 +22,7 @@ Usage:
22
22
  Options:
23
23
  --port <number> HTTP port (default: 1421)
24
24
  --bind <address> Bind address (default: 127.0.0.1)
25
- --no-open Do not open a browser after installation
25
+ --no-open Do not open a browser
26
26
  -h, --help Show this help
27
27
  -v, --version Show the package version
28
28
 
@@ -114,12 +114,30 @@ async function main(args, dependencies = {}) {
114
114
 
115
115
  if (command === 'run') {
116
116
  const runtime = (dependencies.resolveRuntime || resolveRuntime)();
117
- return (dependencies.runForeground || runForeground)(runtime, [], {
117
+ // Open the page as soon as the server answers. The URL carries a token
118
+ // that only exists once the server has written its config, so it has to be
119
+ // read AFTER startup rather than guessed before it — and printing it for
120
+ // the user to copy by hand is the thing this saves them.
121
+ //
122
+ // Nothing here may affect the server: a non-loopback bind, a machine with
123
+ // no browser, or a server that never comes up are all reasons to skip the
124
+ // page, never reasons to fail the run.
125
+ const opened = options.open
126
+ ? (async () => {
127
+ const url = await (dependencies.waitForUrl || waitForUrl)(options.port);
128
+ (dependencies.openBrowser || openBrowser)(url);
129
+ })().catch(() => {})
130
+ : Promise.resolve();
131
+ const code = await (dependencies.runForeground || runForeground)(runtime, [], {
118
132
  env: {
119
133
  OCTIQ_WEB_BIND: options.bind,
120
134
  OCTIQ_WEB_PORT: String(options.port),
121
135
  },
122
136
  });
137
+ // Settle the opener so a caller (and a test) never races it. Ctrl+C does
138
+ // not come through here: `runForeground` re-raises the signal on itself.
139
+ await opened;
140
+ return code;
123
141
  }
124
142
  if (command === 'install') {
125
143
  const runtime = (dependencies.resolveRuntime || resolveRuntime)();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "octiqflow",
3
- "version": "0.2.5",
3
+ "version": "0.2.8",
4
4
  "description": "Agent workflow orchestrator with real browser terminals",
5
5
  "bin": {
6
6
  "octiqflow": "bin/octiqflow.cjs"
@@ -14,10 +14,10 @@
14
14
  "node": ">=18"
15
15
  },
16
16
  "optionalDependencies": {
17
- "octiqflow-darwin-arm64": "0.2.5",
18
- "octiqflow-darwin-x64": "0.2.5",
19
- "octiqflow-linux-x64": "0.2.5",
20
- "@kyson8101/octiqflow-win32-x64": "0.2.5"
17
+ "octiqflow-darwin-arm64": "0.2.8",
18
+ "octiqflow-darwin-x64": "0.2.8",
19
+ "octiqflow-linux-x64": "0.2.8",
20
+ "@kyson8101/octiqflow-win32-x64": "0.2.8"
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",