pi-straw-boss 0.76.0 → 0.77.2
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 +1 -1
- package/README.zh-TW.md +1 -4
- package/dist/gui/assets/{allyasks-Czxu9N0_.js → allyasks-B157BVSK.js} +1 -1
- package/dist/gui/assets/{allyunits-Cu820tRD.js → allyunits-D49tC5yS.js} +1 -1
- package/dist/gui/assets/{answer-D3Fc6DBr.js → answer-B_eEaZuu.js} +1 -1
- package/dist/gui/assets/{ask-DK8Sf6Pa.js → ask-Cf4u8awy.js} +1 -1
- package/dist/gui/assets/{asks-DqkFBBS7.js → asks-BP9fh8zE.js} +1 -1
- package/dist/gui/assets/{askview-gHx_Hk2d.js → askview-BzFy3A9l.js} +1 -1
- package/dist/gui/assets/{autoback-CZkFJtdj.js → autoback-mQmgZrYL.js} +1 -1
- package/dist/gui/assets/{blockschunk-DUknCMor.js → blockschunk-Bcf8T3l_.js} +1 -1
- package/dist/gui/assets/{box-BUf9E97Z.js → box-CdTJxlY3.js} +1 -1
- package/dist/gui/assets/{chat-CraWb-vz.js → chat-pwXYtfIJ.js} +1 -1
- package/dist/gui/assets/{drawer-DyN2PbF3.js → drawer-C4b67hAK.js} +1 -1
- package/dist/gui/assets/index-Dvw58cHb.js +4 -0
- package/dist/gui/assets/{lanwait-y3ZgXxvk.js → lanwait-D8XQhI49.js} +1 -1
- package/dist/gui/assets/{layer-BMeWKQ6w.js → layer-CcPpb9oC.js} +1 -1
- package/dist/gui/assets/{lightbox-BtmIeJYB.js → lightbox-cGNtXXLf.js} +1 -1
- package/dist/gui/assets/{link-_ku8_F1J.js → link-CfF8WoKX.js} +1 -1
- package/dist/gui/assets/{linkdialogs-BHiWLB73.js → linkdialogs-BtrIR5oZ.js} +1 -1
- package/dist/gui/assets/{mdbody-DmC2OoJ3.js → mdbody-CM0vyeve.js} +1 -1
- package/dist/gui/assets/{pair-6RKgnkV8.js → pair-BdBNEx-I.js} +1 -1
- package/dist/gui/assets/{picker-C9mN-2Ml.js → picker-CBlvQLT5.js} +1 -1
- package/dist/gui/assets/{server-D8Peiga1.js → server-CSZVUOSr.js} +1 -1
- package/dist/gui/assets/{sessionfacts-C-3Lh2Gu.js → sessionfacts-R0PNxQ07.js} +1 -1
- package/dist/gui/assets/{settings-C5nXwYtK.js → settings-Bqjz9KP-.js} +1 -1
- package/dist/gui/assets/{spawn-DmP1vT7z.js → spawn-DlKByPlr.js} +1 -1
- package/dist/gui/assets/{termcard-BWctoI4H.js → termcard-acLQMoog.js} +1 -1
- package/dist/gui/assets/{towerturns-Cd9alhqa.js → towerturns-Cldgw4hX.js} +1 -1
- package/dist/gui/assets/{trains-GY_I0p6W.js → trains-CY_wPPrG.js} +1 -1
- package/dist/gui/assets/{trust-D-_wrdAz.js → trust-DYlVFo7K.js} +1 -1
- package/dist/gui/assets/{views-SvadD2NQ.js → views-BxBhtxB1.js} +1 -1
- package/dist/gui/assets/{waitcard-Xgi9yQRE.js → waitcard-BF4toG4g.js} +1 -1
- package/dist/gui/assets/{yard-C6xyMp5L.js → yard-Bqrbq1yf.js} +1 -1
- package/dist/gui/index.html +2 -2
- package/dist/gui/themes/raven/{raven-DGx4eH2o.js → raven-Dr7te0ib.js} +2 -2
- package/dist/gui/themes/zen/{zen-BQrgqRoA.js → zen-C2J8hYV2.js} +1 -1
- package/dist/gui/themes.json +2 -2
- package/dist/server/{chunk-7HXSLT4U.mjs → chunk-ENYILM47.mjs} +4 -0
- package/dist/server/cli.mjs +1 -1
- package/dist/server/main.mjs +208 -42
- package/package.json +1 -1
- package/prompts/apps-config.md +1 -1
- package/prompts/integrator.md +1 -1
- package/prompts/main.md +1 -1
- package/prompts/planning.md +1 -1
- package/prompts/tower-run.md +1 -1
- package/prompts/train.md +1 -1
- package/src/carwait.ts +105 -0
- package/src/index.ts +1 -1
- package/src/server/carbook.ts +186 -33
- package/src/server/carnotices.ts +14 -8
- package/src/server/carops.ts +3 -1
- package/src/train/cars.ts +12 -2
- package/src/train/contract-legacy.ts +19 -0
- package/src/train/contract.ts +51 -0
- package/src/traincar.ts +32 -6
- package/src/trainguard.ts +11 -12
- package/dist/gui/assets/index-LCc1BzpW.js +0 -4
- package/src/train/anchorloop.ts +0 -78
package/src/train/anchorloop.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { readdirSync, readFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
|
|
4
|
-
// The version gate of the merge train (docs/specs/2026-11-07-train-workers.md §14.1, TB-F008). The train's and the integrator's prompts follow pi-anchorloop's `integrating` and `deploying` skills as of 2.11.0 (the Step runner seam, the
|
|
5
|
-
// `## Acceptance` row), and a model cannot tell 2.10.1 from 2.11.0 by reading the skill. The guard asks this module instead: it reads the `version` of the installed `pi-anchorloop` package.json, and a version it cannot find, read or
|
|
6
|
-
// parse, or one older than 2.11.0, refuses the train's and the integrator's `todo` and `MonitorCreate` calls with the reason. Where it looks: the agent folder's npm packages (`<agent>/npm/node_modules`), its git packages
|
|
7
|
-
// (`<agent>/git/<host>/<owner>/pi-anchorloop`), and the project's own (`<cwd>/.pi/npm/node_modules`); the newest it finds counts.
|
|
8
|
-
|
|
9
|
-
export const MIN_ANCHORLOOP = "2.11.0";
|
|
10
|
-
export type Anchorloop = { ok: true; version: string } | { ok: false; refusal: string };
|
|
11
|
-
|
|
12
|
-
/** `x.y.z` of a version, or undefined. A pre-release of a version ranks below it (`2.11.0-rc.1` is older than `2.11.0`). */
|
|
13
|
-
function parse(version: unknown): { nums: [number, number, number]; pre: boolean } | undefined {
|
|
14
|
-
const found = typeof version === "string" ? /^v?(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.exec(version.trim()) : null;
|
|
15
|
-
return found ? { nums: [Number(found[1]), Number(found[2]), Number(found[3])], pre: found[4] !== undefined } : undefined;
|
|
16
|
-
}
|
|
17
|
-
/** Negative when `a` is older than `b`; undefined when either is no version. */
|
|
18
|
-
export function compareVersions(a: string, b: string): number | undefined {
|
|
19
|
-
const [x, y] = [parse(a), parse(b)];
|
|
20
|
-
if (!x || !y) return undefined;
|
|
21
|
-
for (let i = 0; i < 3; i++) if (x.nums[i] !== y.nums[i]) return x.nums[i]! - y.nums[i]!;
|
|
22
|
-
return x.pre === y.pre ? 0 : x.pre ? -1 : 1;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const dirs = (path: string): string[] => { try { return readdirSync(path); } catch { return []; } };
|
|
26
|
-
|
|
27
|
-
/** The `package.json` of each pi-anchorloop that `<agent>/settings.json` `packages` names (`npm:pi-anchorloop[@v]`, a `git:`/URL source, or a local path): the copies pi loads. Empty when the file is not there or names none; a refusal when the file cannot be parsed or names pi-anchorloop in a form this cannot place (TB3-F001: never fall back to a scan that could find an unused newer copy). */
|
|
28
|
-
function configured(agentDir: string): string[] | { refusal: string } {
|
|
29
|
-
const file = join(agentDir, "settings.json");
|
|
30
|
-
let packages: unknown, text: string;
|
|
31
|
-
try { text = readFileSync(file, "utf8"); } catch (error) { return (error as NodeJS.ErrnoException).code === "ENOENT" ? [] : { refusal: `${file} cannot be read (${(error as Error).message})` }; }
|
|
32
|
-
try { packages = (JSON.parse(text) as { packages?: unknown }).packages; } catch { return { refusal: `${file} cannot be parsed` }; }
|
|
33
|
-
const out: string[] = [];
|
|
34
|
-
for (const entry of Array.isArray(packages) ? packages : []) {
|
|
35
|
-
const source = typeof entry === "string" ? entry : typeof entry === "object" && entry !== null ? (entry as { source?: unknown }).source : undefined;
|
|
36
|
-
if (typeof source !== "string") continue;
|
|
37
|
-
const npm = /^npm:(@?[^@\s]+(?:\/[^@\s]+)?)(?:@.*)?$/.exec(source.trim());
|
|
38
|
-
if (npm) { if (npm[1] === "pi-anchorloop") out.push(join(agentDir, "npm", "node_modules", "pi-anchorloop", "package.json")); continue; }
|
|
39
|
-
const git = /^(?:git:)?(?:https?:\/\/|ssh:\/\/|git@)?(?:git@)?([^/:\s]+)[/:]([^/\s]+)\/(pi-anchorloop)(?:\.git)?(?:@.*)?\/?$/.exec(source.trim());
|
|
40
|
-
if (git && /^(git:|https?:|ssh:|git@)/.test(source.trim())) { out.push(join(agentDir, "git", git[1]!, git[2]!, "pi-anchorloop", "package.json")); continue; }
|
|
41
|
-
if (/^(\/|\.|~)/.test(source.trim()) && /pi-anchorloop\/?$/.test(source.trim())) { out.push(join(source.trim().replace(/^~/, process.env.HOME ?? "~"), "package.json")); continue; }
|
|
42
|
-
if (/(^|[/:])pi-anchorloop(\.git)?(@|\/?$)/.test(source.trim())) return { refusal: `${file} names pi-anchorloop as ${JSON.stringify(source.trim())}, and sb cannot tell which copy pi loads from it` };
|
|
43
|
-
}
|
|
44
|
-
return out;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Every `package.json` of `pi-anchorloop` that counts: the copies settings.json names when it names any, else those the agent folder and the project hold. */
|
|
48
|
-
function candidates(agentDir: string, cwd?: string): string[] | { refusal: string } {
|
|
49
|
-
const named = configured(agentDir);
|
|
50
|
-
if (!Array.isArray(named) || named.length) return named;
|
|
51
|
-
const out = [join(agentDir, "npm", "node_modules", "pi-anchorloop", "package.json")];
|
|
52
|
-
if (cwd) out.push(join(cwd, ".pi", "npm", "node_modules", "pi-anchorloop", "package.json"));
|
|
53
|
-
for (const host of dirs(join(agentDir, "git"))) for (const owner of dirs(join(agentDir, "git", host))) out.push(join(agentDir, "git", host, owner, "pi-anchorloop", "package.json"));
|
|
54
|
-
return out;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function checkAnchorloop(o: { agentDir: string; cwd?: string; min?: string }): Anchorloop {
|
|
58
|
-
const min = o.min ?? MIN_ANCHORLOOP, found: { file: string; version: string }[] = [], problems: string[] = [];
|
|
59
|
-
const files = candidates(o.agentDir, o.cwd);
|
|
60
|
-
if (!Array.isArray(files)) return { ok: false, refusal: `sb: the merge train needs pi-anchorloop ${min} or newer, and ${files.refusal}; fix it, then try again` };
|
|
61
|
-
for (const file of files) {
|
|
62
|
-
let text: string;
|
|
63
|
-
try { text = readFileSync(file, "utf8"); } catch (error) {
|
|
64
|
-
if ((error as NodeJS.ErrnoException).code !== "ENOENT") problems.push(`${file} cannot be read (${(error as Error).message})`);
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
const version = (JSON.parse(text) as { version?: unknown }).version;
|
|
69
|
-
if (parse(version)) found.push({ file, version: String(version) });
|
|
70
|
-
else problems.push(`${file} has no version`);
|
|
71
|
-
} catch { problems.push(`${file} cannot be parsed`); }
|
|
72
|
-
}
|
|
73
|
-
if (!found.length) return { ok: false, refusal: `sb: the merge train needs pi-anchorloop ${min} or newer, and its version cannot be read (${problems.length ? problems.join("; ") : `no pi-anchorloop package under ${join(o.agentDir, "npm", "node_modules")} or the project's .pi/npm`}); install it, then try again` };
|
|
74
|
-
const newest = found.reduce((top, f) => (compareVersions(f.version, top.version)! > 0 ? f : top));
|
|
75
|
-
return compareVersions(newest.version, min)! < 0
|
|
76
|
-
? { ok: false, refusal: `sb: the merge train needs pi-anchorloop ${min} or newer, and ${newest.file} is ${newest.version}; update it and /reload, then try again` }
|
|
77
|
-
: { ok: true, version: newest.version };
|
|
78
|
-
}
|