neurastream 0.3.23 → 0.3.25
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/package.json +1 -1
- package/src/core/guards/stop.ts +5 -3
- package/src/core/mr-sweep.ts +19 -3
package/package.json
CHANGED
package/src/core/guards/stop.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import type { Decision, InjectEvent, StopEvent } from "../adapter.ts";
|
|
5
|
-
import { currentTier } from "../autonomy.ts";
|
|
5
|
+
import { currentPlanner, currentTier } from "../autonomy.ts";
|
|
6
6
|
import type { Config } from "../config.ts";
|
|
7
7
|
import { withFileLock, writeAtomicSync } from "../file-lock.ts";
|
|
8
8
|
import * as q from "../queue/lib.ts";
|
|
@@ -44,9 +44,11 @@ export function flagCancel(text: string, cfg: Config): string {
|
|
|
44
44
|
return `\nmain-guard: ${CANCEL_TODO} Flagged: "${words}"`;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
/** The owner prompt's Tools-and-limits card: the call cap and the open plans' deny-command blockers, three lines at most. */
|
|
47
|
+
/** The owner prompt's Tools-and-limits card: the call cap, planner mode, approval gate and the open plans' deny-command blockers, three lines at most. */
|
|
48
48
|
function toolsCard(cfg: Config, tier: string, plans: q.Plan[]): string[] {
|
|
49
|
-
const
|
|
49
|
+
const cap = mainCallsCapOn(cfg, tier) ? `Calls: ${cfg.guards.main_max_calls} per turn (warn at ${cfg.guards.main_warn_calls})` : "Calls: off";
|
|
50
|
+
const approval = cfg.approval.since ? `plans stamped >= ${cfg.approval.since} need page + approve` : "off";
|
|
51
|
+
const calls = `${cap} | planner: ${currentPlanner(cfg)} | approval: ${approval}`;
|
|
50
52
|
const denies = plans.flatMap(p => p.blockers.filter(b => path.basename(b.script) === "deny-command").map(b => `${path.basename(p.file)}: ${b.args.join(" ")}`));
|
|
51
53
|
if (!denies.length) return ["Tools and limits", calls];
|
|
52
54
|
const more = denies.length > 3 ? ` | +${denies.length - 3} more` : "";
|
package/src/core/mr-sweep.ts
CHANGED
|
@@ -279,17 +279,33 @@ export function mrSweep(opts: SweepOpts = {}): SweepResult {
|
|
|
279
279
|
const mrs: SweepMr[] = [];
|
|
280
280
|
let missingCli = false;
|
|
281
281
|
let fail = false;
|
|
282
|
+
// Checkouts of one forge project share an origin: list its MRs once, and let a plan in any
|
|
283
|
+
// of those checkouts track them.
|
|
284
|
+
const urlOf = new Map<string, string>();
|
|
285
|
+
for (const repo of repos) {
|
|
286
|
+
if (!gitTop(repo)) continue;
|
|
287
|
+
const remote = cmd(["git", "-C", repo, "remote", "get-url", "origin"], { env: opts.env });
|
|
288
|
+
const url = remote.code === 0 ? remote.stdout.trim() : "";
|
|
289
|
+
if (url) urlOf.set(repo, url);
|
|
290
|
+
}
|
|
291
|
+
const keyOf = (repo: string): string | undefined => {
|
|
292
|
+
const url = urlOf.get(repo);
|
|
293
|
+
return url ? (remotePath(url) ?? url) : undefined;
|
|
294
|
+
};
|
|
295
|
+
const listedUrls = new Set<string>();
|
|
282
296
|
for (const repo of repos) {
|
|
283
297
|
if (!gitTop(repo)) {
|
|
284
298
|
lines.push(skip(repo, "not a git repo"));
|
|
285
299
|
continue;
|
|
286
300
|
}
|
|
287
|
-
const
|
|
288
|
-
const url = remote.code === 0 ? remote.stdout.trim() : "";
|
|
301
|
+
const url = urlOf.get(repo) ?? "";
|
|
289
302
|
if (!url) {
|
|
290
303
|
lines.push(skip(repo, "no origin remote"));
|
|
291
304
|
continue;
|
|
292
305
|
}
|
|
306
|
+
const key = keyOf(repo) ?? url;
|
|
307
|
+
if (listedUrls.has(key)) continue;
|
|
308
|
+
listedUrls.add(key);
|
|
293
309
|
const host = remoteHost(url);
|
|
294
310
|
const forge = host ? forgeOf(host) : null;
|
|
295
311
|
if (!forge) {
|
|
@@ -305,7 +321,7 @@ export function mrSweep(opts: SweepOpts = {}): SweepResult {
|
|
|
305
321
|
lines.push(skip(repo, "forge unreachable"));
|
|
306
322
|
continue;
|
|
307
323
|
}
|
|
308
|
-
const texts = plans.filter(p => p.repo ===
|
|
324
|
+
const texts = plans.filter(p => keyOf(p.repo) === key && p.status === "open").map(p => p.text);
|
|
309
325
|
const found = listed.items
|
|
310
326
|
.map(item => {
|
|
311
327
|
const token = forge === "gitlab" ? `!${item.number}` : `#${item.number}`;
|