patchwork-os 1.2.0-beta.2.canary.742 → 1.2.0-beta.2.canary.743
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/dist/index.js +49 -2
- package/dist/index.js.map +1 -1
- package/dist/workers/workersCli.d.ts +81 -0
- package/dist/workers/workersCli.js +241 -0
- package/dist/workers/workersCli.js.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4131,10 +4131,21 @@ if (process.argv[2] === "shadow-scan") {
|
|
|
4131
4131
|
if (process.argv[2] === "workers") {
|
|
4132
4132
|
const args = process.argv.slice(3);
|
|
4133
4133
|
const sub = args[0];
|
|
4134
|
-
if ((sub !== "shadow" &&
|
|
4134
|
+
if ((sub !== "shadow" &&
|
|
4135
|
+
sub !== "backtest" &&
|
|
4136
|
+
sub !== "list" &&
|
|
4137
|
+
sub !== "validate") ||
|
|
4135
4138
|
args.includes("--help") ||
|
|
4136
4139
|
args.includes("-h")) {
|
|
4137
|
-
process.stdout.write("Usage: patchwork workers <shadow|backtest> [--workers-dir <path>]\n\n" +
|
|
4140
|
+
process.stdout.write("Usage: patchwork workers <list|validate|shadow|backtest> [--workers-dir <path>]\n\n" +
|
|
4141
|
+
" list What is installed, and — the point — what the bridge IGNORES.\n" +
|
|
4142
|
+
" A manifest that does not parse is skipped by the loader, so no\n" +
|
|
4143
|
+
" worker owns its recipe and the autonomy gate never runs for it.\n" +
|
|
4144
|
+
" validate Every way a manifest can be present and govern nothing:\n" +
|
|
4145
|
+
" unparseable file, `recipe:` that is not installed, two workers\n" +
|
|
4146
|
+
" claiming one recipe (BOTH are ignored, not one winner), an\n" +
|
|
4147
|
+
" unparseable forbids entry (fails OPEN), and drift against\n" +
|
|
4148
|
+
" templates/workers. Exits 1 when unhealthy.\n" +
|
|
4138
4149
|
" shadow Read-only worker trust dial: replays ~/.patchwork/runs.jsonl\n" +
|
|
4139
4150
|
" + the gate decision log through the (worker × action-class)\n" +
|
|
4140
4151
|
" ramp. Computes what the ramp WOULD decide vs what the gate DID.\n" +
|
|
@@ -4149,6 +4160,42 @@ if (process.argv[2] === "workers") {
|
|
|
4149
4160
|
try {
|
|
4150
4161
|
const dirIdx = args.indexOf("--workers-dir");
|
|
4151
4162
|
const workersDir = dirIdx !== -1 ? args[dirIdx + 1] : undefined;
|
|
4163
|
+
if (sub === "list" || sub === "validate") {
|
|
4164
|
+
const { scanWorkers, validateWorkers, formatWorkersList, formatWorkersValidate, defaultWorkersDir, defaultRecipesDir, } = await import("./workers/workersCli.js");
|
|
4165
|
+
const dir = workersDir ?? defaultWorkersDir();
|
|
4166
|
+
const json = args.includes("--json");
|
|
4167
|
+
if (sub === "list") {
|
|
4168
|
+
const scan = scanWorkers(dir);
|
|
4169
|
+
process.stdout.write(json
|
|
4170
|
+
? `${JSON.stringify({
|
|
4171
|
+
dir: scan.dir,
|
|
4172
|
+
loaded: scan.loaded.map((l) => ({
|
|
4173
|
+
file: l.file,
|
|
4174
|
+
id: l.worker.id,
|
|
4175
|
+
name: l.worker.name,
|
|
4176
|
+
recipe: l.worker.recipe ?? null,
|
|
4177
|
+
autonomyCeiling: l.worker.autonomyCeiling,
|
|
4178
|
+
owns: l.worker.owns,
|
|
4179
|
+
})),
|
|
4180
|
+
broken: scan.broken,
|
|
4181
|
+
}, null, 2)}\n`
|
|
4182
|
+
: formatWorkersList(scan));
|
|
4183
|
+
// A manifest the bridge ignores is a governance gap, not a note.
|
|
4184
|
+
process.exit(scan.broken.length > 0 ? 1 : 0);
|
|
4185
|
+
}
|
|
4186
|
+
const tIdx = args.indexOf("--templates-dir");
|
|
4187
|
+
const templatesDir = tIdx !== -1 ? args[tIdx + 1] : undefined;
|
|
4188
|
+
const rIdx = args.indexOf("--recipes-dir");
|
|
4189
|
+
const result = validateWorkers({
|
|
4190
|
+
workersDir: dir,
|
|
4191
|
+
recipesDir: rIdx !== -1 ? args[rIdx + 1] : defaultRecipesDir(),
|
|
4192
|
+
...(templatesDir ? { templatesDir } : {}),
|
|
4193
|
+
});
|
|
4194
|
+
process.stdout.write(json
|
|
4195
|
+
? `${JSON.stringify(result, null, 2)}\n`
|
|
4196
|
+
: formatWorkersValidate(result));
|
|
4197
|
+
process.exit(result.healthy ? 0 : 1);
|
|
4198
|
+
}
|
|
4152
4199
|
const { runWorkerShadowReport, runWorkerBacktest } = await import("./workers/runWorkerShadow.js");
|
|
4153
4200
|
const opts = workersDir ? { workersDir } : {};
|
|
4154
4201
|
process.stdout.write(sub === "backtest"
|