neurastream 0.3.18 → 0.3.21
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 +88 -490
- package/package.json +1 -1
- package/src/adapters/index.ts +3 -2
- package/src/adapters/omp/adapter.ts +2 -1
- package/src/adapters/omp/auto-close.ts +64 -0
- package/src/adapters/omp/chat-commands.ts +161 -0
- package/src/adapters/omp/inbox.ts +221 -0
- package/src/adapters/omp/index.ts +138 -1050
- package/src/adapters/omp/launch.ts +35 -9
- package/src/adapters/omp/rate-limit-controller.ts +196 -0
- package/src/adapters/omp/rollover-controller.ts +334 -0
- package/src/adapters/omp/types.ts +143 -0
- package/src/cli/claim.ts +1 -3
- package/src/cli/commands.ts +33 -2
- package/src/cli/dispatch.ts +55 -30
- package/src/cli/guard.ts +0 -3
- package/src/cli/incident.ts +2 -2
- package/src/cli/metrics.ts +1 -1
- package/src/cli/recall.ts +6 -8
- package/src/cli/results-build.ts +2 -4
- package/src/cli/workspace.ts +13 -5
- package/src/core/adapter.ts +16 -0
- package/src/core/autonomy.ts +24 -21
- package/src/core/blockers.ts +326 -30
- package/src/core/file-lock.ts +71 -12
- package/src/core/guards/plan-edit.ts +338 -0
- package/src/core/guards/planner.ts +70 -0
- package/src/core/guards/review.ts +391 -0
- package/src/core/guards/spawn.ts +699 -0
- package/src/core/guards/state.ts +581 -0
- package/src/core/guards/stop.ts +235 -0
- package/src/core/guards/tool.ts +541 -0
- package/src/core/guards.ts +12 -2661
- package/src/core/incidents.ts +134 -99
- package/src/core/machine-guard.ts +23 -5
- package/src/core/main-start.ts +11 -9
- package/src/core/mr-sweep.ts +4 -2
- package/src/core/notify.ts +15 -15
- package/src/core/owner-log.ts +19 -17
- package/src/core/owner-topics.ts +38 -48
- package/src/core/owner-ui/auth.ts +164 -0
- package/src/core/owner-ui/data.ts +437 -0
- package/src/core/owner-ui/handlers.ts +250 -0
- package/src/core/owner-ui/messages.ts +209 -0
- package/src/core/owner-ui/render.ts +714 -0
- package/src/core/owner-ui/results.ts +266 -0
- package/src/core/owner-ui/server.ts +142 -0
- package/src/core/owner-ui.ts +11 -2118
- package/src/core/page-notes.ts +25 -0
- package/src/core/pages.ts +452 -78
- package/src/core/plan-approval.ts +24 -26
- package/src/core/queue/lib.ts +170 -137
- package/src/core/queue-cancel.ts +29 -15
- package/src/core/queue-check.ts +5 -7
- package/src/core/queue-close.ts +54 -29
- package/src/core/queue-finished.ts +9 -10
- package/src/core/queue-migrate.ts +1 -3
- package/src/core/queue-trim.ts +2 -4
- package/src/core/results.ts +0 -2
- package/src/core/rollover.ts +2 -3
- package/src/core/secret-redact.ts +65 -14
- package/src/core/tailscale.ts +79 -3
- package/src/core/team-client.ts +18 -6
- package/src/core/uninstall.ts +2 -0
- package/src/core/watch.ts +3 -2
- package/src/core/queue/env.ts +0 -14
package/src/core/team-client.ts
CHANGED
|
@@ -106,14 +106,15 @@ function markDown(name: string, clock: () => number): void {
|
|
|
106
106
|
downUntil.set(name, clock() + OUTAGE_MEMO_SEC);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
/** One request through the send seam, with the memo: down answers at once; transport failures and 5xx mark the team down. Returns "down" when the server did not answer. */
|
|
109
|
+
/** One request through the send seam, with the memo: down answers at once; transport failures and 5xx mark the team+server down. Returns "down" when the server did not answer. */
|
|
110
110
|
function askRaw(team: TeamEntry, req: WireRequest, opts: RawOpts = {}): WireResponse | "down" {
|
|
111
111
|
const clock = opts.clock ?? nowSec;
|
|
112
112
|
const send = opts.send ?? defaultSend;
|
|
113
|
-
|
|
113
|
+
const memoKey = `${team.name}\0${team.server}`;
|
|
114
|
+
if (memoDown(memoKey, clock)) return "down";
|
|
114
115
|
const res = send(req);
|
|
115
116
|
if (res === null || res.error !== undefined || typeof res.status !== "number" || res.status >= 500) {
|
|
116
|
-
markDown(
|
|
117
|
+
markDown(memoKey, clock);
|
|
117
118
|
return "down";
|
|
118
119
|
}
|
|
119
120
|
return res;
|
|
@@ -161,9 +162,20 @@ if (import.meta.main) {
|
|
|
161
162
|
);
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
/**
|
|
165
|
+
/**
|
|
166
|
+
* The default transport: one synchronous child, JSON request on stdin, JSON answer on stdout.
|
|
167
|
+
*
|
|
168
|
+
* Args:
|
|
169
|
+
* req (WireRequest): HTTP request parameters to execute in the child process
|
|
170
|
+
*
|
|
171
|
+
* Returns:
|
|
172
|
+
* WireResponse | null: Parsed response object or an error envelope
|
|
173
|
+
*/
|
|
165
174
|
function defaultSend(req: WireRequest): WireResponse | null {
|
|
166
|
-
|
|
175
|
+
// Always invoke `bun` by name, never `process.execPath`: when core is loaded inside a
|
|
176
|
+
// compiled host harness, `process.execPath` points at the harness binary itself, so spawning
|
|
177
|
+
// it would recursively launch full host sessions instead of running this request script.
|
|
178
|
+
const r = spawnSync("bun", [fileURLToPath(import.meta.url)], {
|
|
167
179
|
input: JSON.stringify(req),
|
|
168
180
|
timeout: REQUEST_TIMEOUT_MS,
|
|
169
181
|
encoding: "utf8",
|
|
@@ -528,7 +540,7 @@ export function syncTeam(team: TeamEntry, cfg: Config, run: CommandRunner = defa
|
|
|
528
540
|
if (typeof row?.id === "string" && typeof row.sha === "string" && rec[row.id]?.sha !== row.sha) pullPlan(team, cfg, row.id);
|
|
529
541
|
}
|
|
530
542
|
}
|
|
531
|
-
for (const plan of activePlans(cfg.paths
|
|
543
|
+
for (const plan of activePlans(cfg.paths)) {
|
|
532
544
|
if (planShare(plan, cfg, run) !== team.name) continue;
|
|
533
545
|
const id = pathId(team, cfg, plan.file, run);
|
|
534
546
|
if (id === null) continue;
|
package/src/core/uninstall.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { fileURLToPath } from "node:url";
|
|
|
11
11
|
import { stripBlock } from "./agents-md.ts";
|
|
12
12
|
import { configFile, loadConfig, type Config } from "./config.ts";
|
|
13
13
|
import { printText } from "./help.ts";
|
|
14
|
+
import { indexLockPath } from "./queue/lib.ts";
|
|
14
15
|
|
|
15
16
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
16
17
|
const PACKAGE_ROOT = resolve(HERE, "../..");
|
|
@@ -162,6 +163,7 @@ function purgeState(cfg: Config, out: UninstallTarget[]): void {
|
|
|
162
163
|
const entries: [string, string, boolean][] = [
|
|
163
164
|
[configFile(cfg.paths.home), "--purge: config file", false],
|
|
164
165
|
[cfg.paths.queue_index, "--purge: index", false],
|
|
166
|
+
[indexLockPath(cfg.paths.queue_index), "--purge: index lock", false],
|
|
165
167
|
[join(cfg.paths.agent_dir, "queue"), "--purge: queue dir", true],
|
|
166
168
|
[cfg.paths.notes, "--purge: notes dir", true],
|
|
167
169
|
[cfg.paths.blockers, "--purge: blockers dir", true],
|
package/src/core/watch.ts
CHANGED
|
@@ -28,6 +28,7 @@ import { addIncident, dismissIncident, openIncidents, readIncidents, type Incide
|
|
|
28
28
|
import { m7, rowsOf, silentFailures, snap } from "./report.ts";
|
|
29
29
|
import { loadKnownSecrets, redactSecrets } from "./secret-redact.ts";
|
|
30
30
|
import { ciScan } from "./ci.ts";
|
|
31
|
+
import type { QueuePaths } from "./queue/lib.ts";
|
|
31
32
|
import type { CommandRunner } from "./mr-sweep.ts";
|
|
32
33
|
import type { ReleaseTag } from "./results.ts";
|
|
33
34
|
import { levelFor, readLevels, writeLevels, type Level, type RuleLevels } from "./rule-levels.ts";
|
|
@@ -618,9 +619,9 @@ function judgeRelease(cfg: Config, tag: string, before: Window, after: Window, d
|
|
|
618
619
|
}
|
|
619
620
|
|
|
620
621
|
/** The plan files a timer run treats as staffed: a plan whose newest spawn (staffing.json) names tasks and is newer than `ciRedHours` before `now`. An older spawn's agent is gone, so its red MR is not held back (I-20261031-265). A timer run has no live job list, so the spawn record is the only signal it has. */
|
|
621
|
-
export function timerStaffedPlans(now: number, ciRedHours: number): string[] {
|
|
622
|
+
export function timerStaffedPlans(now: number, ciRedHours: number, paths: Pick<QueuePaths, "queue_state">): string[] {
|
|
622
623
|
const since = now - ciRedHours * 3600;
|
|
623
|
-
return Object.entries(readStaffingEntries()).filter(([, e]) => e.names.length > 0 && e.at > since).map(([file]) => file);
|
|
624
|
+
return Object.entries(readStaffingEntries(paths)).filter(([, e]) => e.names.length > 0 && e.at > since).map(([file]) => file);
|
|
624
625
|
}
|
|
625
626
|
|
|
626
627
|
/** The watcher's unit files under one home: the systemd user service and timer on Linux, the
|
package/src/core/queue/env.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Config } from "../config.ts";
|
|
2
|
-
import { refreshQueuePaths } from "./lib.ts";
|
|
3
|
-
|
|
4
|
-
/** Map merged config into the env vars the queue library reads (same as live setup). */
|
|
5
|
-
export function applyQueueEnv(cfg: Config, env: NodeJS.ProcessEnv = process.env): void {
|
|
6
|
-
env.QUEUE_AGENT = cfg.paths.agent_dir;
|
|
7
|
-
env.QUEUE_INDEX = cfg.paths.queue_index;
|
|
8
|
-
env.QUEUE_BLOCKERS = cfg.paths.blockers;
|
|
9
|
-
env.QUEUE_STATE = cfg.paths.queue_state;
|
|
10
|
-
env.QUEUE_SUBAGENTS = cfg.paths.subagents;
|
|
11
|
-
env.QUEUE_CANCELLED = cfg.paths.cancelled;
|
|
12
|
-
env.QUEUE_UNLOCK = cfg.paths.unlock;
|
|
13
|
-
refreshQueuePaths();
|
|
14
|
-
}
|