neurastream 0.2.8 → 0.2.9

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/package.json +1 -1
  2. package/src/cli/ui.ts +22 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neurastream",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Guardrails for running many AI coding agents at once: plan queue, blockers, call budgets, provider caps, scoring, merge-verified close.",
5
5
  "keywords": [
6
6
  "ai-agents",
package/src/cli/ui.ts CHANGED
@@ -3,18 +3,27 @@
3
3
  // two refusals. Runs until killed (systemd user unit templates/systemd/neurastream-ui.service).
4
4
 
5
5
  import { defaultRunSource } from "../adapters/omp/sessions.ts";
6
- import { ConfigError, loadConfig } from "../core/config.ts";
7
- import { startOwnerUi } from "../core/owner-ui.ts";
6
+ import { ConfigError, loadConfig, type Config } from "../core/config.ts";
7
+ import { startOwnerUi, type OwnerUiOptions, type OwnerUiServer } from "../core/owner-ui.ts";
8
8
  import { applyQueueEnv } from "../core/queue/env.ts";
9
9
  import { realTailscale } from "../core/tailscale.ts";
10
10
 
11
- export function runUi(): number {
12
- let cfg;
13
- try {
14
- cfg = loadConfig();
15
- } catch (err) {
16
- console.error(err instanceof ConfigError ? err.message : String(err));
17
- return 1;
11
+ export interface UiDeps {
12
+ /** The merged config. Default: loadConfig(). */
13
+ cfg?: Config;
14
+ /** Starts the page. Default: startOwnerUi. */
15
+ start?: (opts: OwnerUiOptions) => OwnerUiServer;
16
+ }
17
+
18
+ export async function runUi(deps: UiDeps = {}): Promise<number> {
19
+ let cfg = deps.cfg;
20
+ if (!cfg) {
21
+ try {
22
+ cfg = loadConfig();
23
+ } catch (err) {
24
+ console.error(err instanceof ConfigError ? err.message : String(err));
25
+ return 1;
26
+ }
18
27
  }
19
28
  applyQueueEnv(cfg);
20
29
  if (!cfg.ui.enabled) {
@@ -25,6 +34,8 @@ export function runUi(): number {
25
34
  console.error("neurastream ui: ui.owner_login is empty — set the tailscale login that may open the page");
26
35
  return 1;
27
36
  }
28
- startOwnerUi({ cfg, tailscale: realTailscale, source: defaultRunSource(cfg) });
29
- return 0; // serving never returns; the process runs until killed
37
+ (deps.start ?? startOwnerUi)({ cfg, tailscale: realTailscale, source: defaultRunSource(cfg) });
38
+ // src/cli/main.ts exits with the code this returns, which would kill the server: serving
39
+ // never resolves, and the process runs until systemd or a signal stops it.
40
+ return new Promise<number>(() => {});
30
41
  }