toolroll 0.9.128 → 0.9.130
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/CHANGELOG.md +41 -0
- package/dist/accent-colors.js +3 -1
- package/dist/agent-fence.js +0 -2
- package/dist/agents-board.js +0 -3
- package/dist/approval-authority.js +2 -1
- package/dist/assignment.js +56 -2
- package/dist/backup-ui.js +6 -3
- package/dist/backup.js +6 -0
- package/dist/bounded-spawn.js +0 -1
- package/dist/browser/manifest.json +57 -0
- package/dist/browser/terminal.2a682d0b91a35288271c73b7ee253e524cca0917d17fbaf6733e80b7a767a37c.js.br +0 -0
- package/dist/browser/terminal.2a682d0b91a35288271c73b7ee253e524cca0917d17fbaf6733e80b7a767a37c.js.gz +0 -0
- package/dist/browser/{terminal.css → terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css} +1 -1
- package/dist/browser/terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css.br +0 -0
- package/dist/browser/terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css.gz +0 -0
- package/dist/browser/{workspace.js → workspace.9bd1db81d3c897045a5d82d4804e374e41e78b1b2cfd05d37b982a4ea0d02626.js} +25 -25
- package/dist/browser/workspace.9bd1db81d3c897045a5d82d4804e374e41e78b1b2cfd05d37b982a4ea0d02626.js.br +0 -0
- package/dist/browser/workspace.9bd1db81d3c897045a5d82d4804e374e41e78b1b2cfd05d37b982a4ea0d02626.js.gz +0 -0
- package/dist/browser/{workspace.css → workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css} +1 -1
- package/dist/browser/workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css.br +0 -0
- package/dist/browser/workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css.gz +0 -0
- package/dist/browser-shell.js +271 -25
- package/dist/canvas-freshness.js +122 -0
- package/dist/canvas-fs.js +273 -0
- package/dist/canvas-reads.js +747 -0
- package/dist/canvas-state-key.js +45 -0
- package/dist/canvas-state-worker.js +12 -0
- package/dist/central-recovery-stage.js +3 -3
- package/dist/chat-actions.js +26 -0
- package/dist/chat-channel.js +4 -3
- package/dist/chat-task-actions.js +1 -1
- package/dist/chat-warmth.js +0 -1
- package/dist/check-report.js +0 -6
- package/dist/commit-extract.js +79 -40
- package/dist/companion/access.js +162 -0
- package/dist/companion/actions.js +622 -0
- package/dist/companion/bonjour.js +45 -0
- package/dist/companion/canvas.js +141 -0
- package/dist/companion/chat-origin.js +92 -0
- package/dist/companion/chat.js +571 -0
- package/dist/companion/daemon.js +1387 -0
- package/dist/companion/direct-server.js +177 -0
- package/dist/companion/finish.js +51 -0
- package/dist/companion/framing.js +498 -0
- package/dist/companion/noise.js +461 -0
- package/dist/companion/passkey-gate.js +287 -0
- package/dist/companion/paths.js +90 -0
- package/dist/companion/reads.js +283 -0
- package/dist/companion/relay-auth.js +265 -0
- package/dist/companion/relay-server.js +870 -0
- package/dist/companion/schema.js +289 -0
- package/dist/companion/service.js +581 -0
- package/dist/companion/store.js +325 -0
- package/dist/companion/webauthn.js +407 -0
- package/dist/console-instance.js +0 -4
- package/dist/contracts/console-api.js +18 -0
- package/dist/converse.js +0 -1
- package/dist/coordinator.js +1 -1
- package/dist/design/kit.css +30 -0
- package/dist/desktop-config.js +156 -0
- package/dist/desktop-host.js +6 -152
- package/dist/desktop-update.js +1 -1
- package/dist/finished-task-sql.js +14 -0
- package/dist/flexible-answers.js +0 -1
- package/dist/github-read.js +41 -0
- package/dist/guides.js +4 -3
- package/dist/lead-doors.js +50 -3
- package/dist/lead-queue-runtime.js +11 -2
- package/dist/lead-queue.js +25 -0
- package/dist/live-backup-change.js +93 -0
- package/dist/live-backup.js +75 -31
- package/dist/live-bus.js +3 -2
- package/dist/live-records.js +0 -1
- package/dist/local-landing.js +47 -0
- package/dist/local-owner.js +0 -1
- package/dist/model-choices.js +0 -11
- package/dist/nightly-check.js +0 -3
- package/dist/nightly-github.js +1 -2
- package/dist/notification-retention.js +119 -0
- package/dist/observations.js +0 -1
- package/dist/operate.js +17 -4
- package/dist/person-proof.js +5 -1
- package/dist/pull-request-flow.js +116 -2
- package/dist/qr.js +360 -0
- package/dist/release-adapters.js +14 -43
- package/dist/release-auto.js +17 -13
- package/dist/release-card.js +0 -4
- package/dist/release-cli.js +37 -2
- package/dist/release.js +13 -2
- package/dist/restore-retirement.js +6 -1
- package/dist/result-review.js +0 -3
- package/dist/retention-ui.js +1 -1
- package/dist/retention.js +14 -21
- package/dist/review-context.js +0 -5
- package/dist/route-rules.js +1 -5
- package/dist/sandbox-runtime.js +0 -1
- package/dist/scope.js +68 -17
- package/dist/scout.js +0 -6
- package/dist/serve.js +60 -9
- package/dist/server/kit.js +1 -0
- package/dist/server/live.js +9 -2
- package/dist/server/pages.js +12 -4
- package/dist/server/phone-engine-api.js +79 -0
- package/dist/server/render-pages.js +1 -11
- package/dist/server/render-results.js +0 -1
- package/dist/server/render-tasks.js +0 -68
- package/dist/server/route-table.js +12 -1
- package/dist/server/settings-phone.js +515 -0
- package/dist/server/settings-scripts.js +2 -0
- package/dist/server/settings-section-table.js +0 -3
- package/dist/server/settings-sections.js +10 -4
- package/dist/server/settings.js +20 -5
- package/dist/server/terminals.js +2 -1
- package/dist/settings-groups-ui.js +2 -1
- package/dist/settings-proofs.js +6 -0
- package/dist/store.js +52 -4
- package/dist/structured-output.js +0 -1
- package/dist/style-asset.js +20 -7
- package/dist/tailnet.js +39 -0
- package/dist/task-control.js +5 -0
- package/dist/task-sizing.js +0 -1
- package/dist/toolroll-update-cli.js +19 -3
- package/dist/toolroll-update-ui.js +2 -2
- package/dist/toolroll-update.js +98 -16
- package/dist/youiyoux-intake.js +8 -0
- package/package.json +7 -2
- package/dist/contracts/contract-test.js +0 -55
- package/dist/unfenced-test-support.js +0 -6
- /package/dist/browser/{terminal.js → terminal.2a682d0b91a35288271c73b7ee253e524cca0917d17fbaf6733e80b7a767a37c.js} +0 -0
package/dist/release-auto.js
CHANGED
|
@@ -3,7 +3,7 @@ import { assignmentOf } from "./assignment.js";
|
|
|
3
3
|
import { fullCheckProblem, projectGitDir } from "./check-report.js";
|
|
4
4
|
import { sealedRun } from "./release-recheck.js";
|
|
5
5
|
import { runCheckLevel } from "./check-levels.js";
|
|
6
|
-
import { readVerifiedCommit,
|
|
6
|
+
import { readVerifiedCommit, verifiedView } from "./commit-extract.js";
|
|
7
7
|
import { EVAL_HOOK_FILES, evalHookProblem, LEARNING_HOOK_FILES, learningHookProblem, storeRewriteProblem } from "./eval-hooks.js";
|
|
8
8
|
import { isTestPath, mightName, testImportProblem, testInfrastructure } from "./test-infra.js";
|
|
9
9
|
import { chatControlHref } from "./chat-controls.js";
|
|
@@ -209,13 +209,13 @@ function withoutVersion(path, bytes) {
|
|
|
209
209
|
: value !== null && typeof value === "object" ? Object.fromEntries(Object.keys(value).sort().map(key => [key, canonical(value[key])])) : value;
|
|
210
210
|
return JSON.stringify(canonical(copy));
|
|
211
211
|
}
|
|
212
|
-
function infrastructureAt(
|
|
213
|
-
const entries =
|
|
212
|
+
function infrastructureAt(git, tree) {
|
|
213
|
+
const entries = git.treeEntries(tree);
|
|
214
214
|
if (!entries.ok)
|
|
215
215
|
return null;
|
|
216
216
|
const files = entries.value.filter(one => one.mode === "100644" || one.mode === "100755");
|
|
217
217
|
const paths = files.filter(one => (/\.(?:[cm]?[jt]sx?)$/.test(one.path) && !one.path.startsWith("node_modules/")) || one.path === "tsconfig.json" || one.path === "package.json").map(one => one.path);
|
|
218
|
-
const blobs =
|
|
218
|
+
const blobs = git.blobs(tree, paths);
|
|
219
219
|
if (!blobs.ok)
|
|
220
220
|
return null;
|
|
221
221
|
try {
|
|
@@ -231,34 +231,38 @@ function changeProblem(repo, base, candidate) {
|
|
|
231
231
|
return "the project's Git directory can't be read";
|
|
232
232
|
if (base === null || !/^[0-9a-f]{40}$/.test(base))
|
|
233
233
|
return "no base was recorded to compare with";
|
|
234
|
-
const
|
|
234
|
+
const view = verifiedView(gitDir);
|
|
235
|
+
if (!view.ok)
|
|
236
|
+
return "the candidate's commits can't be read";
|
|
237
|
+
const git = view.value;
|
|
238
|
+
const before = git.commit(base), after = git.commit(candidate);
|
|
235
239
|
if (!before.ok || !after.ok)
|
|
236
240
|
return "the candidate's commits can't be read";
|
|
237
|
-
const diff =
|
|
241
|
+
const diff = git.treeDiff(before.value.tree, after.value.tree);
|
|
238
242
|
if (!diff.ok)
|
|
239
243
|
return `the candidate's change can't be read: ${diff.message}`;
|
|
240
244
|
const scans = [];
|
|
241
245
|
for (const tree of [before.value.tree, after.value.tree]) {
|
|
242
|
-
const found = infrastructureAt(
|
|
246
|
+
const found = infrastructureAt(git, tree);
|
|
243
247
|
if (found === null)
|
|
244
248
|
return "the tests' imports can't be read";
|
|
245
249
|
scans.push(found);
|
|
246
250
|
}
|
|
247
251
|
const infra = new Set(scans.flatMap(one => [...one.infra]));
|
|
248
|
-
const blobAt = (tree) => { const blobs =
|
|
252
|
+
const blobAt = (tree) => { const blobs = git.blobs(tree, EVAL_HOOK_FILES); return (file) => blobs.ok ? blobs.value.get(file)?.bytes ?? null : null; };
|
|
249
253
|
const hooks = evalHookProblem(blobAt(after.value.tree), blobAt(before.value.tree));
|
|
250
254
|
if (hooks !== null)
|
|
251
255
|
return `${hooks}: a person decides`;
|
|
252
256
|
const changed = diff.value.filter(change => change.after !== null).map(change => change.path);
|
|
253
|
-
const changedAt = (tree) => { const blobs =
|
|
257
|
+
const changedAt = (tree) => { const blobs = git.blobs(tree, changed); return blobs.ok ? (file) => blobs.value.get(file)?.bytes ?? null : null; };
|
|
254
258
|
const rewrites = storeRewriteProblem(changed, changedAt(after.value.tree), changedAt(before.value.tree));
|
|
255
259
|
if (rewrites !== null)
|
|
256
260
|
return `${rewrites}: a person decides`;
|
|
257
|
-
const routingAt = (tree) => { const blobs =
|
|
261
|
+
const routingAt = (tree) => { const blobs = git.blobs(tree, ROUTING_HOOK_FILES); return (file) => blobs.ok ? blobs.value.get(file)?.bytes ?? null : null; };
|
|
258
262
|
const routing = routingHookProblem({ candidate: routingAt(after.value.tree), base: routingAt(before.value.tree) }, { paths: changed, candidate: changedAt(after.value.tree), base: changedAt(before.value.tree) });
|
|
259
263
|
if (routing !== null)
|
|
260
264
|
return `${routing}: a person decides`;
|
|
261
|
-
const learningAt = (tree) => { const blobs =
|
|
265
|
+
const learningAt = (tree) => { const blobs = git.blobs(tree, LEARNING_HOOK_FILES); return (file) => blobs.ok ? blobs.value.get(file)?.bytes ?? null : null; };
|
|
262
266
|
const learning = learningHookProblem({ candidate: learningAt(after.value.tree), base: learningAt(before.value.tree) }, { paths: changed, candidate: changedAt(after.value.tree), base: changedAt(before.value.tree) });
|
|
263
267
|
if (learning !== null)
|
|
264
268
|
return `${learning}: a person decides`;
|
|
@@ -271,7 +275,7 @@ function changeProblem(repo, base, candidate) {
|
|
|
271
275
|
if (change.before !== null && TEST_FILE.test(rulePath(change.path)))
|
|
272
276
|
return `${change.path} changes existing test code (new tests go in a new file; rewriting tests needs a person)`;
|
|
273
277
|
if (change.kind === "added" && isTestPath(rulePath(change.path))) {
|
|
274
|
-
const read =
|
|
278
|
+
const read = git.blobs(after.value.tree, [change.path]);
|
|
275
279
|
const bytes = read.ok ? read.value.get(change.path)?.bytes : undefined;
|
|
276
280
|
const why = bytes === undefined ? `${change.path}'s test code couldn't be read` : testImportProblem(change.path, bytes.toString("utf8"));
|
|
277
281
|
if (why !== null)
|
|
@@ -289,7 +293,7 @@ function changeProblem(repo, base, candidate) {
|
|
|
289
293
|
}
|
|
290
294
|
const normal = rulePath(change.path);
|
|
291
295
|
if (normal === "package.json" || normal === "package-lock.json") {
|
|
292
|
-
const read = (tree) => { const blobs =
|
|
296
|
+
const read = (tree) => { const blobs = git.blobs(tree, [change.path]); return blobs.ok ? withoutVersion(normal, blobs.value.get(change.path)?.bytes) : undefined; };
|
|
293
297
|
const was = read(before.value.tree), now = read(after.value.tree);
|
|
294
298
|
if (was === undefined || now === undefined || was !== now)
|
|
295
299
|
return `${change.path} changed beyond its version (dependencies or scripts need a person)`;
|
package/dist/release-card.js
CHANGED
|
@@ -197,10 +197,6 @@ export function readCommitsBetween(repo, from, to) {
|
|
|
197
197
|
}
|
|
198
198
|
return { ok: true, commits: range.value.map(one => ({ sha: one.id, subject: subjectText(one.message) })) };
|
|
199
199
|
}
|
|
200
|
-
export function commitsBetween(repo, from, to) {
|
|
201
|
-
const read = readCommitsBetween(repo, from, to);
|
|
202
|
-
return read.ok ? read.commits : null;
|
|
203
|
-
}
|
|
204
200
|
export const PULL_REQUEST_COMMITS_MAX = 250;
|
|
205
201
|
export const subjectText = (subject) => cleanTerminalLine(subject.split("\n")[0] ?? "").trim().slice(0, 200);
|
|
206
202
|
const ghRead = args => {
|
package/dist/release-cli.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
1
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
3
|
import { homedir } from "node:os";
|
|
3
4
|
import { dirname, join, resolve } from "node:path";
|
|
4
5
|
import { createRequire } from "node:module";
|
|
5
6
|
const sqlite = () => createRequire(import.meta.url)("node:sqlite");
|
|
6
7
|
import { checkedEnvelopeJson } from "./contracts/cli.js";
|
|
7
|
-
import { RELEASE_LIMITS, runRelease } from "./release.js";
|
|
8
|
+
import { RELEASE_LIMITS, RELEASE_STEPS, runRelease } from "./release.js";
|
|
8
9
|
import { exec, prepareRelease, processes, readMainVersion, recordedReleaseRepo, releaseAdapters, releaseTools } from "./release-adapters.js";
|
|
9
10
|
import { mainRunKey, releaseBranchFor } from "./release-main.js";
|
|
10
11
|
import { journals, releaseGate } from "./release-gate.js";
|
|
@@ -290,6 +291,7 @@ export async function runReleaseCommand(args, write, deps = {}) {
|
|
|
290
291
|
const taken = await takeReleaseRun(stateDir, lockKey, say, deps.runLock);
|
|
291
292
|
if (!taken.ok)
|
|
292
293
|
return refuse("running", `Another release of ${version ?? branch} is still running on ${taken.holder.host} (process ${taken.holder.pid}). Nothing was changed.`, 3);
|
|
294
|
+
let next = null;
|
|
293
295
|
try {
|
|
294
296
|
const world = deps.settle ?? (deps.adapters === undefined ? { rescue: installedRescueWorld(checkout), gate: installedGateWorld() } : null);
|
|
295
297
|
if (world !== null) {
|
|
@@ -299,11 +301,18 @@ export async function runReleaseCommand(args, write, deps = {}) {
|
|
|
299
301
|
}
|
|
300
302
|
const outcome = await runRelease({ branch: version === undefined ? branch : releaseBranchFor(version), checkout, stateDir, limits, fresh: bare.has("--new"), noCarry: bare.has("--no-carry"),
|
|
301
303
|
...(version === undefined ? {} : { version, full: bare.has("--full") }) }, adapters);
|
|
302
|
-
|
|
304
|
+
if (deps.adapters === undefined)
|
|
305
|
+
next = deployedBuildToContinue(outcome, deps.database ?? databasePath(process.env, homedir()));
|
|
306
|
+
if (next === null)
|
|
307
|
+
return report(outcome, write, json, lines);
|
|
303
308
|
}
|
|
304
309
|
finally {
|
|
305
310
|
taken.release();
|
|
306
311
|
}
|
|
312
|
+
const bin = next;
|
|
313
|
+
if (!json)
|
|
314
|
+
write(` This build (database schema ${SCHEMA_VERSION}) can't open the database the deploy upgraded; the deployed build goes on: ${bin}`);
|
|
315
|
+
return continueWith(bin, args.filter(arg => arg !== "--new"), deps.cwd ?? process.cwd());
|
|
307
316
|
}
|
|
308
317
|
function report(outcome, write, json, lines) {
|
|
309
318
|
const release = outcome.journal === null ? null : {
|
|
@@ -662,3 +671,29 @@ async function runPrepareCommand(version, flags, write, json, deps) {
|
|
|
662
671
|
return answer(false, { reason: "refused", message: `The release pull request for ${version} wasn't opened: ${made.why}.` }, `The release pull request for ${version} wasn't opened: ${made.why}.`, 1);
|
|
663
672
|
return answer(true, { version, pullRequest: made.pr, branch: made.branch, commit: made.commit }, `Opened pull request #${made.pr} (${made.branch}): the version and changelog for ${version}. Merge it like any pull request once its checks pass, then run \`toolroll release ${version}\`.`, 0);
|
|
664
673
|
}
|
|
674
|
+
export function deployedBuildToContinue(outcome, database) {
|
|
675
|
+
const runtime = outcome.journal?.deploy?.runtime;
|
|
676
|
+
if (outcome.ok || runtime === undefined || outcome.step === "preflight" || RELEASE_STEPS.indexOf(outcome.step) <= RELEASE_STEPS.indexOf("link"))
|
|
677
|
+
return null;
|
|
678
|
+
const bin = join(runtime, "bin.js");
|
|
679
|
+
if (!existsSync(bin) || !existsSync(database))
|
|
680
|
+
return null;
|
|
681
|
+
try {
|
|
682
|
+
const db = new (sqlite().DatabaseSync)(database, { readOnly: true });
|
|
683
|
+
try {
|
|
684
|
+
const rows = db.prepare("SELECT typeof(version) AS kind, version FROM schema_version").all();
|
|
685
|
+
return rows.length === 1 && rows[0].kind === "integer" && Math.abs(Number(rows[0].version)) > SCHEMA_VERSION ? bin : null;
|
|
686
|
+
}
|
|
687
|
+
finally {
|
|
688
|
+
db.close();
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
catch {
|
|
692
|
+
return null;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
const continueWith = (bin, args, cwd) => new Promise(done => {
|
|
696
|
+
const child = spawn(process.execPath, [bin, "release", ...args], { cwd, stdio: "inherit", env: process.env });
|
|
697
|
+
child.on("error", () => done(3));
|
|
698
|
+
child.on("exit", code => done(code ?? 3));
|
|
699
|
+
});
|
package/dist/release.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isNewer } from "./releases.js";
|
|
1
2
|
import { closeSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
2
3
|
import { randomUUID } from "node:crypto";
|
|
3
4
|
import { dirname, join } from "node:path";
|
|
@@ -1258,7 +1259,7 @@ async function begin(options, adapters, now) {
|
|
|
1258
1259
|
const installed = await adapters.toolroll.installed();
|
|
1259
1260
|
const runtimes = new Set([...installed.services, ...installed.clis.map(one => one.runtime ?? "(not linked)")]);
|
|
1260
1261
|
if (installed.services.length === 0 || runtimes.size !== 1) {
|
|
1261
|
-
throw new Stop("mixed-runtime",
|
|
1262
|
+
throw new Stop("mixed-runtime", mixedRuntimeWords(installed));
|
|
1262
1263
|
}
|
|
1263
1264
|
const github = await adapters.repo.github();
|
|
1264
1265
|
await adapters.repo.sync(branch);
|
|
@@ -1313,7 +1314,7 @@ async function beginMain(options, adapters, now) {
|
|
|
1313
1314
|
const installed = await adapters.toolroll.installed();
|
|
1314
1315
|
const runtimes = new Set([...installed.services, ...installed.clis.map(one => one.runtime ?? "(not linked)")]);
|
|
1315
1316
|
if (installed.services.length === 0 || runtimes.size !== 1) {
|
|
1316
|
-
throw new Stop("mixed-runtime",
|
|
1317
|
+
throw new Stop("mixed-runtime", mixedRuntimeWords(installed));
|
|
1317
1318
|
}
|
|
1318
1319
|
const github = await adapters.repo.github();
|
|
1319
1320
|
const nothing = "Nothing was checked, deployed, tagged or published";
|
|
@@ -1596,3 +1597,13 @@ export function workflowIs(path, file) {
|
|
|
1596
1597
|
}
|
|
1597
1598
|
const RELEASE_WORDS = new Set(["status", "nightly", "carry", "revoke", "ask-every-commit", "unsandboxed-carry", "auto-approve", "publish-ok", "approve"]);
|
|
1598
1599
|
export function releaseBranchArg(branch) { return RELEASE_WORDS.has(branch) ? `--branch ${branch}` : branch; }
|
|
1600
|
+
export function mixedRuntimeWords(installed) {
|
|
1601
|
+
const version = (dist) => dist === null ? null : installed.versions?.[dist] ?? null;
|
|
1602
|
+
const named = (label, dist) => `${label} ${dist ?? "not linked"}${version(dist) === null ? "" : ` (${version(dist)})`}`;
|
|
1603
|
+
const list = [...installed.services.map(one => named("service", one)), ...installed.clis.map(one => named(one.name, one.runtime))].join("; ");
|
|
1604
|
+
const service = installed.services.map(version).find(one => one !== null) ?? null;
|
|
1605
|
+
const cli = installed.clis.map(one => version(one.runtime)).find(one => one !== null) ?? null;
|
|
1606
|
+
const newer = service !== null && cli !== null && isNewer(cli, service) ? ` \`toolroll\` is ${cli}, newer than the ${service} your service runs.` : "";
|
|
1607
|
+
const fix = installed.services.length === 0 ? " Update them to one verified build first." : " Run `toolroll update --yes` to bring them to one verified build, then release again.";
|
|
1608
|
+
return `The console, worker and CLI names don't run one build (${list}).${newer}${fix}`;
|
|
1609
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
2
|
import { ChatCore } from "./chat-core.js";
|
|
3
|
+
import { retireCompanionOnRestore } from "./companion/store.js";
|
|
4
|
+
import { cancelPhoneWork, PHONE_RESTORED } from "./companion/chat-origin.js";
|
|
3
5
|
import { CHAT_PROVIDERS } from "./contracts/chat-tables.js";
|
|
4
6
|
import { revokeCoordinator } from "./coordinator.js";
|
|
5
7
|
import { autoPublishHeld, holdAutoPublish, PUBLISH_ALLOWED_ACTION, PUBLISH_HELD_ACTION } from "./release-auto.js";
|
|
@@ -107,6 +109,8 @@ export function retireRestoredAuthority(store, options) {
|
|
|
107
109
|
for (const table of CHAT_DECIDE_TABLES)
|
|
108
110
|
store.handle.prepare(`UPDATE ${table} SET consumed_at = ? WHERE consumed_at IS NULL`).run(stamp);
|
|
109
111
|
store.handle.prepare("UPDATE chat_note_draft SET state = 'discarded' WHERE state IN ('pending', 'armed')").run();
|
|
112
|
+
cancelPhoneWork(store, { all: true }, PHONE_RESTORED, now);
|
|
113
|
+
retireCompanionOnRestore(store.handle);
|
|
110
114
|
const afterIdentity = store.workspaceIdentity();
|
|
111
115
|
if (afterIdentity.id !== identity.id || afterIdentity.recoveryGeneration !== nextGeneration || excluded.has(afterIdentity.recoveryGeneration)) {
|
|
112
116
|
throw new Error("Restored workspace identity postcondition failed");
|
|
@@ -130,7 +134,8 @@ export function retireRestoredAuthority(store, options) {
|
|
|
130
134
|
|| count(store, "SELECT count(*) AS n FROM chat_binding WHERE revoked IS NULL") !== 0
|
|
131
135
|
|| count(store, "SELECT count(*) AS n FROM chat_room WHERE revoked IS NULL") !== 0
|
|
132
136
|
|| count(store, "SELECT count(*) AS n FROM chat_pair WHERE consumed IS NULL") !== 0
|
|
133
|
-
|| openChatActions(store) !== 0
|
|
137
|
+
|| openChatActions(store) !== 0
|
|
138
|
+
|| count(store, "SELECT count(*) AS n FROM lead_queue WHERE origin = 'phone' AND status IN ('queued', 'running')") !== 0) {
|
|
134
139
|
throw new Error("Restored credential retirement postcondition failed");
|
|
135
140
|
}
|
|
136
141
|
return {
|
package/dist/result-review.js
CHANGED
|
@@ -97,9 +97,6 @@ export function evidenceProblemDetailsOf(input) {
|
|
|
97
97
|
missing("The no-change conclusion has no handoff record.");
|
|
98
98
|
return problems;
|
|
99
99
|
}
|
|
100
|
-
export function evidenceProblemsOf(input) {
|
|
101
|
-
return evidenceProblemDetailsOf(input).map(one => one.words);
|
|
102
|
-
}
|
|
103
100
|
export function evidenceHealthOf(problems) {
|
|
104
101
|
const health = { damaged: 0, shortened: 0, missing: 0 };
|
|
105
102
|
for (const one of problems)
|
package/dist/retention-ui.js
CHANGED
|
@@ -7,7 +7,7 @@ export const RETENTION_CSS = "";
|
|
|
7
7
|
const listWords = (parts) => parts.length < 2 ? parts.join("") : `${parts.slice(0, -1).join(", ")} and ${parts.at(-1)}`;
|
|
8
8
|
function nextWords(view) {
|
|
9
9
|
if (RETENTION_KINDS.every(({ kind }) => view.periods[kind] === null))
|
|
10
|
-
return "
|
|
10
|
+
return "Only settled progress updates and undeliverable old delivery records go (after 30 days); everything else is kept forever.";
|
|
11
11
|
const due = view.next.filter(one => one.count > 0);
|
|
12
12
|
if (due.length === 0)
|
|
13
13
|
return "Nothing is old enough to remove yet.";
|
package/dist/retention.js
CHANGED
|
@@ -2,7 +2,8 @@ import { reclaimDatabase } from "./database-reclaim.js";
|
|
|
2
2
|
import { existsSync, lstatSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { RETENTION_NOTE } from "./evidence.js";
|
|
5
|
-
import {
|
|
5
|
+
import { finishedTask } from "./finished-task-sql.js";
|
|
6
|
+
import { lifecycleWords, NOTIFICATION_RETENTION_WORDS, sweepNotificationLifecycle, UNDER_LIFECYCLE_KEY } from "./notification-retention.js";
|
|
6
7
|
import { bytesWords, treeBytes } from "./storage.js";
|
|
7
8
|
import { RETENTION_DAYS, retentionDaysSchema, retentionKindSchema } from "./contracts/retention.js";
|
|
8
9
|
const KEPT_QUEUE_ROW = (message) => `lead_queue lq WHERE lq.message = ${message}
|
|
@@ -38,7 +39,7 @@ export const RETENTION_KINDS = [
|
|
|
38
39
|
{ kind: "evidence", label: "Run evidence and logs", detail: "Diffs, check logs, screenshots and reports saved for each run" },
|
|
39
40
|
{ kind: "checkouts", label: "Finished checkout records", detail: "Records of build checkouts that were let go and are no longer on disk" },
|
|
40
41
|
{ kind: "chat", label: "Chat messages", detail: "Messages in lead and team chats" },
|
|
41
|
-
{ kind: "notifications", label: "Notifications", detail:
|
|
42
|
+
{ kind: "notifications", label: "Notifications", detail: `Resolved notifications. ${NOTIFICATION_RETENTION_WORDS}` },
|
|
42
43
|
];
|
|
43
44
|
const LONG_CHOICES = [30, 90, 180, 365, 730, null];
|
|
44
45
|
export const PERIOD_CHOICES = {
|
|
@@ -82,19 +83,6 @@ export function periodLabel(kind, days, chosen) {
|
|
|
82
83
|
return `${label} (default)`;
|
|
83
84
|
return PERIOD_CHOICES[kind].includes(days) ? label : `${label} (custom)`;
|
|
84
85
|
}
|
|
85
|
-
function finishedTask(r) {
|
|
86
|
-
return `EXISTS (SELECT 1 FROM task t WHERE t.id = ${r}.external_id AND ${r}.backend = 'built-in' AND (t.state = 'cancelled' OR (t.state = 'done' AND EXISTS (
|
|
87
|
-
SELECT 1 FROM action_ledger a WHERE a.action = '${COMPLETION_ACTION}' AND (a.task_id = ${r}.external_id OR a.run_id IN (SELECT id FROM run WHERE task_ref = ${r}.id))))))
|
|
88
|
-
AND NOT EXISTS (SELECT 1 FROM hold h WHERE h.task_ref = ${r}.id)
|
|
89
|
-
AND NOT EXISTS (SELECT 1 FROM run live WHERE live.task_ref = ${r}.id AND live.finished_at IS NULL)
|
|
90
|
-
AND NOT EXISTS (SELECT 1 FROM task_scope s WHERE s.task_id = ${r}.external_id AND s.candidate IS NOT NULL)
|
|
91
|
-
AND NOT EXISTS (WITH RECURSIVE family(ext) AS (
|
|
92
|
-
SELECT rv.external_id FROM task_ref rv WHERE rv.revision_of = ${r}.external_id
|
|
93
|
-
UNION SELECT rv.external_id FROM task_ref rv JOIN family ON rv.revision_of = family.ext)
|
|
94
|
-
SELECT 1 FROM family JOIN task tv ON tv.id = family.ext
|
|
95
|
-
WHERE NOT (tv.state = 'cancelled' OR (tv.state = 'done' AND EXISTS (SELECT 1 FROM action_ledger a WHERE a.action = '${COMPLETION_ACTION}'
|
|
96
|
-
AND (a.task_id = family.ext OR a.run_id IN (SELECT run.id FROM run JOIN task_ref x ON x.id = run.task_ref WHERE x.external_id = family.ext))))))`;
|
|
97
|
-
}
|
|
98
86
|
function cutoff(now, days) {
|
|
99
87
|
return new Date(now.getTime() - days * DAY_MS).toISOString();
|
|
100
88
|
}
|
|
@@ -153,7 +141,7 @@ export function retentionPlan(store, evidenceRoot, now, periods = store.retentio
|
|
|
153
141
|
}
|
|
154
142
|
if (periods.notifications !== null) {
|
|
155
143
|
const rows = db.prepare(`SELECT n.id AS id, length(n.subject) + length(n.body) + 64 AS bytes FROM notification n
|
|
156
|
-
WHERE n.created_at < ? AND n.resolved_at IS NOT NULL
|
|
144
|
+
WHERE n.created_at < ? AND n.resolved_at IS NOT NULL AND NOT ${UNDER_LIFECYCLE_KEY("n")}
|
|
157
145
|
AND NOT EXISTS (SELECT 1 FROM notification_delivery d WHERE d.notification = n.id AND d.claim_owner IS NOT NULL AND d.claim_expires_at > ?)
|
|
158
146
|
AND NOT (n.resolved_at IS NULL AND n.task_ref IS NOT NULL AND NOT EXISTS (SELECT 1 FROM task_ref r WHERE r.id = n.task_ref AND ${finishedTask("r")}))
|
|
159
147
|
ORDER BY n.id LIMIT ?`).all(cutoff(now, periods.notifications), now.toISOString(), SWEEP_BATCH + 1);
|
|
@@ -176,8 +164,10 @@ function folderBytes(dir) {
|
|
|
176
164
|
export function sweepRetention(store, evidenceRoot, now, actor = "worker") {
|
|
177
165
|
const periods = store.retentionPeriods();
|
|
178
166
|
store.setServiceCursor(SWEEP_CURSOR, now.getTime(), now);
|
|
179
|
-
|
|
180
|
-
|
|
167
|
+
const lifecycle = sweepNotificationLifecycle(store, now);
|
|
168
|
+
const lifecycleDid = lifecycle.settled + lifecycle.pings + lifecycle.legacyCleared + lifecycle.deferred.families > 0;
|
|
169
|
+
if (!lifecycleDid && RETENTION_KINDS.every(({ kind }) => periods[kind] === null))
|
|
170
|
+
return { at: now.toISOString(), counts: [], freed: 0, ledgerId: null, lifecycle };
|
|
181
171
|
const plan = retentionPlan(store, evidenceRoot, now, periods);
|
|
182
172
|
const db = store.handle;
|
|
183
173
|
const done = { evidence: { count: 0, bytes: 0 }, checkouts: { count: 0, bytes: 0 }, chat: { count: 0, bytes: 0 }, notifications: { count: 0, bytes: 0 } };
|
|
@@ -262,10 +252,13 @@ export function sweepRetention(store, evidenceRoot, now, actor = "worker") {
|
|
|
262
252
|
}
|
|
263
253
|
});
|
|
264
254
|
const counts = plan.counts.map(one => ({ ...one, count: done[one.kind].count, bytes: done[one.kind].bytes }));
|
|
265
|
-
const freed = counts.reduce((sum, one) => sum + one.bytes, 0);
|
|
266
|
-
const
|
|
255
|
+
const freed = counts.reduce((sum, one) => sum + one.bytes, 0) + lifecycle.bytes;
|
|
256
|
+
const removed = freed > 0 || counts.some(one => one.count > 0) || lifecycle.pings + lifecycle.legacyCleared > 0;
|
|
257
|
+
const what = [counts.filter(one => one.count > 0).map(countWords).join(", "), lifecycleWords(lifecycle)].filter(Boolean).join("; ");
|
|
258
|
+
const detail = what === "" ? "nothing was due" : freed > 0 ? `${what}; about ${bytesWords(freed)} freed` : what;
|
|
259
|
+
const ledgerId = store.recordAction({ at: now.toISOString(), actor, repo: null, taskId: null, runId: null, action: "retention sweep", outcome: removed ? "removed" : lifecycle.settled > 0 ? "changed" : "nothing due", source: "policy", detail });
|
|
267
260
|
reclaimDatabase(store.handle, "retention");
|
|
268
|
-
return { at: now.toISOString(), counts, freed, ledgerId };
|
|
261
|
+
return { at: now.toISOString(), counts, freed, ledgerId, lifecycle };
|
|
269
262
|
}
|
|
270
263
|
export function retentionDue(store, now) {
|
|
271
264
|
return now.getTime() - store.serviceCursor(SWEEP_CURSOR) >= SWEEP_EVERY_MS;
|
package/dist/review-context.js
CHANGED
|
@@ -20,11 +20,6 @@ export const REVIEW_CONTEXT_LIMITS = {
|
|
|
20
20
|
aggregateBytes: 32 * 1024 * 1024,
|
|
21
21
|
items: 200,
|
|
22
22
|
};
|
|
23
|
-
export function reviewContextFileName(id) {
|
|
24
|
-
if (!ITEM_ID.test(id))
|
|
25
|
-
throw new Error("invalid context item id");
|
|
26
|
-
return `REVIEW-CONTEXT-${id}.txt`;
|
|
27
|
-
}
|
|
28
23
|
const CONTEXT_INPUT_KINDS = new Set(["terminal-diff", "diff-stat", "proof", "check-log", "screenshot", "review-context"]);
|
|
29
24
|
function usableReviewInput(root, artifact) {
|
|
30
25
|
return artifact.captureStatus !== "failed" && (!artifact.truncated || artifact.kind === "check-log") && readVerifiedArtifact(root, artifact).ok;
|
package/dist/route-rules.js
CHANGED
|
@@ -5,7 +5,7 @@ import { REASON_WORDS } from "./contracts/route-results.js";
|
|
|
5
5
|
import { checkScope, effectiveRoutes } from "./model-choices.js";
|
|
6
6
|
import { seenModel, seenModels } from "./model-catalog.js";
|
|
7
7
|
import { exactModelId, legOf, routeFromJson } from "./phase-routing.js";
|
|
8
|
-
import { endRuleByDoor, endRuleByPlane, endTrialByDoor, insertEarnedRule, insertTrial, keepPausedRule, liveEarnedRules,
|
|
8
|
+
import { endRuleByDoor, endRuleByPlane, endTrialByDoor, insertEarnedRule, insertTrial, keepPausedRule, liveEarnedRules, modelsGenerationOf, proveRuleDoor, recordNotNow, ruleHoldOf, trialOrdinalOf, trialPlaceLive, trialPlacesOf, writeSuggestModels, } from "./route-store.js";
|
|
9
9
|
import { BUILT_IN } from "./store.js";
|
|
10
10
|
export const ROUTING_POLICY_VERSION = 1;
|
|
11
11
|
const DAY = 24 * 60 * 60_000;
|
|
@@ -670,7 +670,3 @@ function trialEvidenceWords(store, selection) {
|
|
|
670
670
|
const state = trial.state === "trialling" || trial.state === "finished" ? "" : ` The trial is ${trial.state === "paused" ? "paused" : "over"} now; approving keeps ${name}.`;
|
|
671
671
|
return `Trying a cheaper model: ${name}, ${which}. A person approves each trial task; you can pick another model before approving.${state}`;
|
|
672
672
|
}
|
|
673
|
-
export function liveTrialOf(store, repo, size) {
|
|
674
|
-
const live = liveTrialFor(store, repo, size);
|
|
675
|
-
return live === null ? null : ruleById(store, live.id);
|
|
676
|
-
}
|
package/dist/sandbox-runtime.js
CHANGED
|
@@ -172,7 +172,6 @@ export function missingLinuxSandboxTools(path = process.env["PATH"] ?? "") {
|
|
|
172
172
|
export function linuxSandboxInstallLine(packages = LINUX_SANDBOX_TOOLS.map(tool => tool.package), system = packageSystem()) {
|
|
173
173
|
return installLine(packages, system);
|
|
174
174
|
}
|
|
175
|
-
export const linuxSandboxToolsWords = () => toolWords(LINUX_SANDBOX_TOOLS.map(tool => tool.package));
|
|
176
175
|
export function missingSandboxToolsWords(missing) {
|
|
177
176
|
return [
|
|
178
177
|
`Toolroll needs ${toolWords(missing)} to run agents in a sandbox on this computer.`,
|
package/dist/scope.js
CHANGED
|
@@ -21,6 +21,8 @@ import { parseLeadToken } from "./api-tokens.js";
|
|
|
21
21
|
import { isAcpProfile, isAcpProvider } from "./acp-agents.js";
|
|
22
22
|
import { levelOfProfile } from "./policy.js";
|
|
23
23
|
import { canonicalJson } from "./canonical-json.js";
|
|
24
|
+
import { checkPasskeyAction, consumePasskeyAction, passkeyApprovalWindowMinutes, passkeyRequiredForApprovals, usesPasskeyLease, verifyPasskeyLease } from "./companion/passkey-gate.js";
|
|
25
|
+
import { passkeyProofDetail } from "./companion/webauthn.js";
|
|
24
26
|
export { isAcpProfile };
|
|
25
27
|
import { createHash, randomBytes, scryptSync, timingSafeEqual } from "node:crypto";
|
|
26
28
|
import { networkFromValue } from "./egress.js";
|
|
@@ -34,7 +36,7 @@ import { readAcceptance, readScopeTerms, storedRubricSchema } from "./contracts/
|
|
|
34
36
|
import { taskArchived, taskCancelled } from "./task-archive.js";
|
|
35
37
|
import { releaseCiHoldOf, releaseCiHoldWords } from "./release-ci-hold.js";
|
|
36
38
|
import { releaseApprovalRefusal } from "./release-refusal.js";
|
|
37
|
-
import {
|
|
39
|
+
import { exactModelId, legOf, routeDigestOf, routeFromJson, routeJsonProblem, } from "./phase-routing.js";
|
|
38
40
|
function mintToken() {
|
|
39
41
|
return mintSecret(32);
|
|
40
42
|
}
|
|
@@ -749,15 +751,44 @@ export function fileAndSealUnderMode(store, input) {
|
|
|
749
751
|
return { ok: true, scope: store.getScope(input.taskId), basis: "mode" };
|
|
750
752
|
});
|
|
751
753
|
}
|
|
752
|
-
export function approve(store, taskId, by, now, sawDigest, token, mutation = {}, fastStart, chat) {
|
|
754
|
+
export function approve(store, taskId, by, now, sawDigest, token, mutation = {}, fastStart, chat, passkey) {
|
|
753
755
|
return store.transact(() => {
|
|
754
756
|
const repoNow = store.lookupRef(taskId)?.repo ?? null;
|
|
757
|
+
if (chat !== undefined && passkey !== undefined)
|
|
758
|
+
return { ok: false, reason: "policy", message: "Approval cannot combine chat and passkey proofs." };
|
|
759
|
+
if (chat !== undefined && passkeyRequiredForApprovals(store, repoNow)) {
|
|
760
|
+
return { ok: false, reason: "policy", message: "Passkey required for approvals on this project; chat approvals are disabled." };
|
|
761
|
+
}
|
|
755
762
|
const account = chat === undefined ? null : store.accountOf(by);
|
|
756
|
-
if (chat !== undefined && machineActing())
|
|
763
|
+
if ((chat !== undefined || passkey !== undefined) && machineActing())
|
|
757
764
|
return { ok: false, reason: "machine-proof" };
|
|
758
765
|
if (chat !== undefined && (account === null || account.revokedAt !== null || account.role !== "approver" || repoNow === null || !store.accountCanAccess(by, repoNow)))
|
|
759
766
|
return { ok: false, reason: "not-an-approver" };
|
|
760
|
-
|
|
767
|
+
let passkeyVerified = null;
|
|
768
|
+
let passkeyChecked = null;
|
|
769
|
+
let authenticated;
|
|
770
|
+
if (passkey !== undefined) {
|
|
771
|
+
const checked = usesPasskeyLease(passkey)
|
|
772
|
+
? verifyPasskeyLease(store, { accountName: by, repo: repoNow, proof: passkey, now })
|
|
773
|
+
: checkPasskeyAction(store, { accountName: by, repo: repoNow, verb: "approve", expectedBinding: { verb: "approve", taskId, sawDigest }, proof: passkey, now });
|
|
774
|
+
if (!checked.ok) {
|
|
775
|
+
if (checked.code === "step_up_required")
|
|
776
|
+
return { ok: false, reason: "password-now" };
|
|
777
|
+
return checked.code === "not_an_approver"
|
|
778
|
+
? { ok: false, reason: "not-an-approver" }
|
|
779
|
+
: { ok: false, reason: "policy", message: checked.message };
|
|
780
|
+
}
|
|
781
|
+
passkeyVerified = checked;
|
|
782
|
+
if (!usesPasskeyLease(passkey))
|
|
783
|
+
passkeyChecked = checked;
|
|
784
|
+
authenticated = { ok: true, method: usesPasskeyLease(passkey) ? "passkey-fresh" : "passkey", at: checked.provedAtMs };
|
|
785
|
+
}
|
|
786
|
+
else if (chat !== undefined) {
|
|
787
|
+
authenticated = { ok: true, method: "chat", at: now.getTime() };
|
|
788
|
+
}
|
|
789
|
+
else {
|
|
790
|
+
authenticated = authenticateApprover(store, by, token, repoNow);
|
|
791
|
+
}
|
|
761
792
|
if (!authenticated.ok)
|
|
762
793
|
return authenticated;
|
|
763
794
|
if (!personProof(authenticated.method))
|
|
@@ -816,11 +847,29 @@ export function approve(store, taskId, by, now, sawDigest, token, mutation = {},
|
|
|
816
847
|
if ((authenticated.method === "fresh-password" || authenticated.method === "fresh-sso") && !freshlyApprovable(store, taskId, scope, gate.verdict === "seal" && !gate.protectedWork)) {
|
|
817
848
|
return { ok: false, reason: "password-now" };
|
|
818
849
|
}
|
|
850
|
+
const routine = approvalWindowCovers(store, taskId, by);
|
|
851
|
+
if (authenticated.method === "passkey-fresh" && !routine)
|
|
852
|
+
return { ok: false, reason: "password-now" };
|
|
819
853
|
const proved = () => store.recordAction({ at: now.toISOString(), actor: by, repo: store.lookupRef(taskId)?.repo ?? null, taskId, runId: null, action: APPROVAL_PROOF,
|
|
820
|
-
outcome: authenticated.method, source: "work", detail:
|
|
854
|
+
outcome: authenticated.method, source: "work", detail: passkeyVerified !== null
|
|
855
|
+
? passkeyProofDetail({ at: now, ...(authenticated.method === "passkey-fresh" ? { provedAtMs: passkeyVerified.provedAtMs } : {}), generation: passkeyVerified.accountGeneration, digest: scope.digest, verb: "approve",
|
|
856
|
+
credentialId: passkeyVerified.credentialId, pairedDeviceId: passkeyVerified.deviceId, be: passkeyVerified.be, bs: passkeyVerified.bs })
|
|
857
|
+
: (fastStart === undefined ? approvalProofDetail : fastProofDetail(fastStart))(authenticated.at, store.accountOf(by)?.generation ?? 0, scope.digest, local === null ? undefined : { generation: local.localGeneration, transport: local.transport }) });
|
|
858
|
+
const consumePasskeyOrFail = (opensWindow) => {
|
|
859
|
+
if (passkeyChecked === null)
|
|
860
|
+
return null;
|
|
861
|
+
const consumed = consumePasskeyAction(store, passkeyChecked, { repo: repoNow, now, ...(opensWindow ? { startsLease: { minutes: passkeyApprovalWindowMinutes(store) } } : {}) });
|
|
862
|
+
if (!consumed.ok)
|
|
863
|
+
return { ok: false, reason: "policy", message: consumed.message };
|
|
864
|
+
passkeyVerified = consumed;
|
|
865
|
+
return null;
|
|
866
|
+
};
|
|
821
867
|
if (gate.verdict === "vote") {
|
|
822
868
|
if (gate.already)
|
|
823
869
|
return { ok: false, reason: "second-approver", have: gate.have, need: gate.need, already: true };
|
|
870
|
+
const passkeyErr = consumePasskeyOrFail(false);
|
|
871
|
+
if (passkeyErr !== null)
|
|
872
|
+
return passkeyErr;
|
|
824
873
|
store.recordApprovalVote(taskId, scope.digest, by, now, authenticated.method);
|
|
825
874
|
proved();
|
|
826
875
|
return { ok: false, reason: "second-approver", have: gate.have, need: gate.need, already: gate.already };
|
|
@@ -828,6 +877,11 @@ export function approve(store, taskId, by, now, sawDigest, token, mutation = {},
|
|
|
828
877
|
const refused = {};
|
|
829
878
|
try {
|
|
830
879
|
return store.savepoint(() => {
|
|
880
|
+
const passkeyErr = consumePasskeyOrFail(routine);
|
|
881
|
+
if (passkeyErr !== null) {
|
|
882
|
+
refused.result = passkeyErr;
|
|
883
|
+
throw refused;
|
|
884
|
+
}
|
|
831
885
|
if (gate.protectedWork)
|
|
832
886
|
store.recordApprovalVote(taskId, scope.digest, by, now, authenticated.method);
|
|
833
887
|
const sealed = chat === undefined ? store.sealScopeApproval(taskId, by, now, mutation)
|
|
@@ -861,6 +915,15 @@ export function approvalProofOf(store, taskId, by, digest) {
|
|
|
861
915
|
}
|
|
862
916
|
return null;
|
|
863
917
|
}
|
|
918
|
+
export function approvalWindowCovers(store, taskId, by) {
|
|
919
|
+
const scope = store.getScope(taskId);
|
|
920
|
+
const repo = store.lookupRef(taskId)?.repo ?? null;
|
|
921
|
+
if (scope === null || repo === null || scope.releaseTerms != null)
|
|
922
|
+
return false;
|
|
923
|
+
if (isProtectedWork(store.approvalRules(repo), [...scope.touches]))
|
|
924
|
+
return false;
|
|
925
|
+
return store.approvalGate(taskId, by, "person").verdict === "seal" && freshlyApprovable(store, taskId, scope, true);
|
|
926
|
+
}
|
|
864
927
|
export function freshlyApprovable(store, taskId, scope, singleApprover) {
|
|
865
928
|
if (!singleApprover)
|
|
866
929
|
return false;
|
|
@@ -944,18 +1007,6 @@ export function scopeAuthorityOf(scope, env = {}) {
|
|
|
944
1007
|
}
|
|
945
1008
|
return { ok: true, profile, route, digest, authMode, ...(chain === null ? {} : { chain }) };
|
|
946
1009
|
}
|
|
947
|
-
export function acceptanceWords(criteria) {
|
|
948
|
-
if (criteria.length === 0)
|
|
949
|
-
return [];
|
|
950
|
-
return [
|
|
951
|
-
` done when ${criteria[0].id}: ${criteria[0].statement} [shown by: ${criteria[0].evidence.join(", ")}]`,
|
|
952
|
-
...criteria.slice(1).map(c => ` ${c.id}: ${c.statement} [shown by: ${c.evidence.join(", ")}]`),
|
|
953
|
-
];
|
|
954
|
-
}
|
|
955
|
-
export function scopeRouteWords(scope, readiness = NO_READINESS) {
|
|
956
|
-
const route = routeFromJson(scope.proposedRouteJson ?? null);
|
|
957
|
-
return route === null ? [] : routeWords(projectRoute(route, readiness));
|
|
958
|
-
}
|
|
959
1010
|
export function releaseTermsSentence(terms) {
|
|
960
1011
|
if (!terms.policy.carry)
|
|
961
1012
|
return `Release ${terms.packageVersion} from pull request #${terms.pr} at ${terms.approvedSha.slice(0, 7)}. Every later commit asks for your approval again.`;
|
package/dist/scout.js
CHANGED
|
@@ -717,12 +717,6 @@ function scrubbedImageNames(images) {
|
|
|
717
717
|
return [one.file, name];
|
|
718
718
|
}));
|
|
719
719
|
}
|
|
720
|
-
function withoutEnv(env, names) {
|
|
721
|
-
const kept = { ...env };
|
|
722
|
-
for (const name of names)
|
|
723
|
-
delete kept[name];
|
|
724
|
-
return kept;
|
|
725
|
-
}
|
|
726
720
|
function cleanup(worktree, names) {
|
|
727
721
|
for (const name of names) {
|
|
728
722
|
try {
|