neurastream 0.2.55 → 0.2.57
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 +2 -2
- package/package.json +3 -1
- package/src/adapters/omp/index.ts +33 -1
- package/src/cli/pages.ts +10 -6
- package/src/core/brief-lint.ts +2 -2
- package/src/core/config.ts +8 -5
- package/src/core/guards.ts +25 -32
- package/src/core/knowledge.ts +4 -2
- package/src/core/owner-ui.ts +48 -22
- package/src/core/page-notes.ts +14 -7
- package/src/core/pages-expiry.ts +36 -3
- package/src/core/pages-setup.ts +20 -3
- package/src/core/pages.ts +9 -5
- package/src/core/plan-approval.ts +104 -29
- package/src/core/queue/lib.ts +31 -41
- package/src/core/queue-check.ts +2 -2
- package/src/core/queue-close.ts +1 -1
- package/src/core/subagents.ts +1 -1
- package/src/core/wip-snapshot.ts +1 -1
- package/src/core/write-check.ts +20 -2
- package/templates/AGENTS.md +1 -0
- package/templates/config.yml +8 -4
package/src/core/write-check.ts
CHANGED
|
@@ -4,13 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
6
|
import { randomBytes } from "node:crypto";
|
|
7
|
-
import { rmSync, writeFileSync } from "node:fs";
|
|
8
|
-
import { basename, dirname, extname, join } from "node:path";
|
|
7
|
+
import { existsSync, rmSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { basename, dirname, extname, join, resolve } from "node:path";
|
|
9
|
+
|
|
10
|
+
import { gitTop } from "./queue/lib.ts";
|
|
9
11
|
|
|
10
12
|
export interface WriteCheckLinter {
|
|
11
13
|
ext: string[];
|
|
12
14
|
argv: string[];
|
|
13
15
|
pattern: string;
|
|
16
|
+
only_with_config?: string[];
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
export interface WriteCheckConfig {
|
|
@@ -50,10 +53,22 @@ function add(f: Findings, k: string, rule: string, sample: string): void {
|
|
|
50
53
|
if (!f.rules.has(k)) f.rules.set(k, rule);
|
|
51
54
|
}
|
|
52
55
|
|
|
56
|
+
// Walks up from dirname(file) to the git top (inclusive: a repo-root config counts), looking for one
|
|
57
|
+
// of `names`; never above it. Outside a git repo only the file's own directory is checked.
|
|
58
|
+
function hasConfig(file: string, names: string[]): boolean {
|
|
59
|
+
const start = resolve(dirname(file));
|
|
60
|
+
const top = gitTop(start)?.top;
|
|
61
|
+
for (let dir = start; ; dir = dirname(dir)) {
|
|
62
|
+
if (names.some((name) => existsSync(join(dir, name)))) return true;
|
|
63
|
+
if (top === undefined || dir === top || dir === dirname(dir)) return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
53
67
|
// Runs each linter on `path` and counts its findings. Throws when a linter did not finish
|
|
54
68
|
// (missing binary, timeout, signal); the caller turns that into an allowed edit with a note.
|
|
55
69
|
function lint(path: string, linters: WriteCheckLinter[], wc: WriteCheckConfig, f: Findings): void {
|
|
56
70
|
for (const l of linters) {
|
|
71
|
+
if (l.only_with_config && !hasConfig(path, l.only_with_config)) continue;
|
|
57
72
|
const argv = l.argv.map((a) => (a === "{file}" ? path : a));
|
|
58
73
|
const [cmd = "", ...args] = argv;
|
|
59
74
|
const r = spawnSync(cmd, args, {
|
|
@@ -100,6 +115,9 @@ function refusal(file: string, now: Findings, old: Findings, newKeys: string[]):
|
|
|
100
115
|
|
|
101
116
|
export function checkWrite(file: string, before: string | null, after: string | null, wc: WriteCheckConfig): WriteCheckResult {
|
|
102
117
|
if (after === null || before === after) return { allow: true };
|
|
118
|
+
if (typeof before === "string" && /^(<<<<<<<|>>>>>>>)/m.test(before)) {
|
|
119
|
+
return { allow: true, note: `write-check: ${file} had conflict markers in the before text; the edit was allowed` };
|
|
120
|
+
}
|
|
103
121
|
const linters = wc.linters.filter((l) => l.ext.includes(extname(file)));
|
|
104
122
|
if (linters.length === 0) return { allow: true };
|
|
105
123
|
const old: Findings = { counts: new Map(), samples: new Map(), rules: new Map() };
|
package/templates/AGENTS.md
CHANGED
|
@@ -12,6 +12,7 @@ You are Main, the orchestrator. Main plans, delegates, reviews and lands; implem
|
|
|
12
12
|
- Main writes every plan in `<repo>/docs/plans/`, shaped like `{{AGENT_DIR}}/queue/TEMPLATE.md`. Do the research yourself; never base a plan on another agent's findings.
|
|
13
13
|
- Phase 0 of every plan: blocker scripts that stop the implementer from going against the plan. They must exist before any spawn.
|
|
14
14
|
- Every plan has `## Reuse`; no spawn without a current reviewer PASS (`templates/plan-review-brief.md`, recorded only from the reviewer's own Progress edit); a brief names every open MR of its plan with an `MR !N:` line.
|
|
15
|
+
- Plan order: plan → page (`neurastream pages publish <page.html> --plan <plan.md>`) → owner approves (Approve on the page, or types `approve <YYYYMMDD_HHMM>`) → reviewer PASS → implementer. Once `approval.since` is set, a plan stamped at or after it gets no spawn without a page and an approval record for its current text; a body edit voids the approval, a Progress-only edit keeps it.
|
|
15
16
|
- An open plan gets an implementer subagent. When it claims done, verify (another subagent or yourself). Not done → spawn another implementer for the rest. Done → set `Status: complete`; `queue-close` then archives it and cleans the indexes.
|
|
16
17
|
- Owner asks about a past plan → grep FINISHED.md first; open the archived plan only for details.
|
|
17
18
|
- An implementer's new `## Progress` entry ends with a `Findings:` line — `Findings: none`, or one item per finding with `file:line` evidence; plan-guard restores an entry without it, and each item becomes an incident.
|
package/templates/config.yml
CHANGED
|
@@ -149,14 +149,16 @@ autonomy:
|
|
|
149
149
|
go_phrase: "go push" # the whole chat message that approves one push/merge in tier strict (I-20261025-201); a bare `go` is an ordinary message
|
|
150
150
|
|
|
151
151
|
review: # plan review gate (plan 20261028_1600): reuse lines now, reviewer PASS from P2 (docs/config.md)
|
|
152
|
-
|
|
153
|
-
agents: ["reviewer"] # agents allowed to run a review spawn: one must be in "## Allowed" of notes/subagents.md (doctor and queue-check fail otherwise, e.g. ["glm"]); the PASS exemption needs one plus the brief's `Plan review:` line
|
|
152
|
+
agents: ["reviewer"] # agents allowed to run a review spawn: one must be in "## Allowed" of notes/subagents.md (doctor and queue-check fail otherwise, e.g. ["glm"]); the PASS exemption needs one plus the brief's `Plan review:` line; an empty list turns both review gates off
|
|
154
153
|
mr_cache_minutes: 10 # minutes the spawn gate caches a repo's open-MR list in <queue_state>/mr-cache.json; 0 = no cache
|
|
154
|
+
approval: # plan approval hard gate (plan 20261029_1455 P3): docs/config.md
|
|
155
|
+
since: "" # a plan stamped at or after this (YYYYMMDD_HHMM) needs a page and an approval record; "" = off
|
|
155
156
|
|
|
156
157
|
ui:
|
|
157
158
|
enabled: false # the owner's phone page (neurastream ui); binds the tailnet address only
|
|
158
159
|
port: 7787
|
|
159
160
|
owner_login: "" # the tailscale login that may open the page; empty = the page refuses to start
|
|
161
|
+
allow_this_machine: false # admit this machine (loopback and its own tailnet IP) as the owner; any local process can then press the buttons
|
|
160
162
|
|
|
161
163
|
|
|
162
164
|
pages:
|
|
@@ -230,11 +232,13 @@ write_check: # write-time lint checks (src/core/write-check.ts):
|
|
|
230
232
|
defer_rules: ["no-unused-vars", "F401", "F841"] # a new finding of one of these rules is allowed with a logged note and only reported at turn end if still present (I-20261028-166); [] turns the deferral off
|
|
231
233
|
linters:
|
|
232
234
|
- ext: [".py"]
|
|
233
|
-
argv: ["ruff", "check", "--no-cache", "--output-format=concise", "
|
|
235
|
+
argv: ["ruff", "check", "--no-cache", "--output-format=concise", "{file}"]
|
|
234
236
|
pattern: '^.+?:\d+:\d+: (?<rule>\S+) (?<message>.+)$'
|
|
237
|
+
only_with_config: ["pyproject.toml", "ruff.toml", ".ruff.toml"]
|
|
235
238
|
- ext: [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"]
|
|
236
|
-
argv: ["oxlint", "-f", "unix", "
|
|
239
|
+
argv: ["oxlint", "-f", "unix", "{file}"]
|
|
237
240
|
pattern: '^.+?:\d+:\d+: (?<message>.+) \[(?:Error|Warning)/(?<rule>[^\]]+)\]'
|
|
241
|
+
only_with_config: [".oxlintrc.json", ".oxlintrc.jsonc", ".oxlintrc.js", ".oxlintrc.mjs", ".oxlintrc.cjs", "eslint.config.js", "eslint.config.mjs", "eslint.config.cjs", "eslint.config.mts", "eslint.config.cts"]
|
|
238
242
|
|
|
239
243
|
priority:
|
|
240
244
|
sleep_sec: 120
|