toolroll 0.9.126 → 0.9.128
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 +47 -0
- package/README.md +2 -1
- package/dist/assignment.js +14 -4
- package/dist/browser/terminal.css +1 -1
- package/dist/browser/workspace.css +1 -1
- package/dist/browser/workspace.js +10 -10
- package/dist/contracts/engine-api.js +3 -0
- package/dist/demo.js +1 -1
- package/dist/design/kit.css +6 -3
- package/dist/easy-start.js +1 -0
- package/dist/engine-reads.js +21 -2
- package/dist/flexible-conversation.js +79 -1
- package/dist/flexible-import.js +159 -2
- package/dist/flexible-save.js +49 -4
- package/dist/flexible-session.js +33 -7
- package/dist/flexible-start.js +2 -1
- package/dist/landed-rows.js +138 -0
- package/dist/local-landing.js +20 -2
- package/dist/merge-checklist.js +33 -8
- package/dist/models-ui.js +5 -2
- package/dist/operate.js +95 -19
- package/dist/result-follow-ups.js +8 -1
- package/dist/revision-catch-up.js +98 -0
- package/dist/server/engine-api.js +13 -8
- package/dist/server/pages.js +5 -2
- package/dist/server/render-results.js +4 -2
- package/dist/server/settings.js +8 -2
- package/dist/server/task-views.js +4 -1
- package/dist/skill-library.js +2 -12
- package/dist/skills-ui.js +11 -6
- package/dist/spend-ui.js +3 -2
- package/dist/spend.js +8 -1
- package/dist/task-base.js +11 -0
- package/dist/task-status.js +11 -4
- package/dist/teardown-git.js +6 -0
- package/dist/toolroll-update-cli.js +2 -1
- package/dist/tui/darwin-arm64/toolroll-tui +0 -0
- package/dist/tui/darwin-x64/toolroll-tui +0 -0
- package/dist/tui/linux-arm64/toolroll-tui +0 -0
- package/dist/tui/linux-x64/toolroll-tui +0 -0
- package/dist/unreachable.js +15 -0
- package/package.json +1 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { LAND_DESTINATION, LAND_HANDOFF, LAND_HANDOFF_SETTLED, LAND_INTENT, LAND_SETTLED, landableBranch, revertedOnBranch } from "./local-landing.js";
|
|
2
|
+
import { recentGitReads } from "./task-base.js";
|
|
3
|
+
const listReads = recentGitReads();
|
|
4
|
+
export const LANDED_GIT_READS = 24;
|
|
5
|
+
class GitBudgetSpent extends Error {
|
|
6
|
+
}
|
|
7
|
+
const OID = /^[0-9a-f]{40}$/;
|
|
8
|
+
const short = (oid) => oid.slice(0, 7);
|
|
9
|
+
function intentOf(id, d) {
|
|
10
|
+
if (d["v"] !== 1 || typeof d["ref"] !== "string" || typeof d["old"] !== "string" || typeof d["commit"] !== "string" || !OID.test(d["old"]) || !OID.test(d["commit"])
|
|
11
|
+
|| (d["mode"] !== "files" && d["mode"] !== "ref") || typeof d["key"] !== "string" || (d["kind"] !== "land" && d["kind"] !== "undo"))
|
|
12
|
+
return null;
|
|
13
|
+
return { id, kind: d["kind"], ref: d["ref"], old: d["old"], commit: d["commit"], candidate: typeof d["candidate"] === "string" && OID.test(d["candidate"]) ? d["candidate"] : d["commit"],
|
|
14
|
+
reverts: typeof d["reverts"] === "number" || typeof d["reverts"] === "string" ? d["reverts"] : null, fromHandoff: typeof d["fromHandoff"] === "number" ? d["fromHandoff"] : null };
|
|
15
|
+
}
|
|
16
|
+
function handoffOf(id, d) {
|
|
17
|
+
const ok = d["v"] === 1 && typeof d["key"] === "string" && typeof d["ref"] === "string" && typeof d["old"] === "string" && OID.test(d["old"]) && typeof d["commit"] === "string" && OID.test(d["commit"])
|
|
18
|
+
&& typeof d["keep"] === "string" && typeof d["folder"] === "string" && typeof d["candidate"] === "string" && OID.test(d["candidate"]);
|
|
19
|
+
return ok ? { id, ref: d["ref"], old: d["old"], commit: d["commit"], candidate: d["candidate"] } : null;
|
|
20
|
+
}
|
|
21
|
+
const parsed = (text) => {
|
|
22
|
+
try {
|
|
23
|
+
const value = JSON.parse(String(text ?? "null"));
|
|
24
|
+
return value !== null && typeof value === "object" ? value : null;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export function landedRowsOf(store, rows, read = listReads) {
|
|
31
|
+
const out = new Map();
|
|
32
|
+
const done = rows.filter(one => one.assignmentState === "complete" && one.repo !== null && one.resultRunId !== null);
|
|
33
|
+
if (done.length === 0)
|
|
34
|
+
return out;
|
|
35
|
+
const ids = [...new Set(done.map(one => one.rootId))], repos = [...new Set(done.map(one => one.repo))], runs = [...new Set(done.map(one => one.resultRunId))];
|
|
36
|
+
const marks = (n) => Array.from({ length: n }, () => "?").join(",");
|
|
37
|
+
const found = store.handle.prepare(`
|
|
38
|
+
WITH heads AS (SELECT id, head_revision FROM run WHERE id IN (${marks(runs.length)})),
|
|
39
|
+
handed AS (SELECT id, task_id, repo, action, outcome, detail FROM action_ledger WHERE task_id IN (${marks(ids.length)}) AND action = ?
|
|
40
|
+
AND (CASE WHEN json_valid(detail) THEN json_extract(detail, '$.candidate') END) IN (SELECT head_revision FROM heads))
|
|
41
|
+
SELECT 'ledger' AS kind, id, task_id, repo, action, outcome, detail FROM action_ledger WHERE task_id IN (${marks(ids.length)}) AND action IN (?, ?)
|
|
42
|
+
UNION ALL SELECT 'ledger', id, task_id, repo, action, outcome, detail FROM handed
|
|
43
|
+
UNION ALL SELECT 'ledger', id, task_id, repo, action, outcome, NULL FROM action_ledger WHERE task_id IN (${marks(ids.length)}) AND action = ? AND outcome IN (SELECT id || ':kept' FROM handed)
|
|
44
|
+
UNION ALL SELECT 'destination', id, NULL, repo, action, NULL, detail FROM action_ledger
|
|
45
|
+
WHERE id IN (SELECT max(id) FROM action_ledger WHERE repo IN (${marks(repos.length)}) AND action = ? AND source = 'request' GROUP BY repo)
|
|
46
|
+
UNION ALL SELECT 'grant', NULL, NULL, repo, NULL, NULL, NULL FROM publication_grant WHERE repo IN (${marks(repos.length)}) AND revoked_at IS NULL
|
|
47
|
+
UNION ALL SELECT 'run', id, NULL, NULL, NULL, head_revision, NULL FROM heads`)
|
|
48
|
+
.all(...runs, ...ids, LAND_HANDOFF, ...ids, LAND_INTENT, LAND_SETTLED, ...ids, LAND_HANDOFF_SETTLED, ...repos, LAND_DESTINATION, ...repos);
|
|
49
|
+
const heads = new Map(), granted = new Set(), destinations = new Map();
|
|
50
|
+
const intents = new Map(), handoffs = new Map();
|
|
51
|
+
const settled = new Map(), kept = new Set();
|
|
52
|
+
for (const row of found) {
|
|
53
|
+
const kind = String(row["kind"]), id = Number(row["id"]);
|
|
54
|
+
if (kind === "run") {
|
|
55
|
+
heads.set(id, row["outcome"] == null ? null : String(row["outcome"]));
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (kind === "grant") {
|
|
59
|
+
granted.add(String(row["repo"]));
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (kind === "destination") {
|
|
63
|
+
const ref = parsed(row["detail"])?.["ref"], repo = String(row["repo"]);
|
|
64
|
+
if ((destinations.get(repo)?.id ?? -1) < id)
|
|
65
|
+
destinations.set(repo, { id, ref: typeof ref === "string" && typeof parsed(row["detail"])?.["common"] === "string" ? ref : "" });
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const action = String(row["action"]), outcome = String(row["outcome"] ?? ""), task = String(row["task_id"]);
|
|
69
|
+
if (action === LAND_SETTLED) {
|
|
70
|
+
const intent = Number(outcome.slice(0, outcome.indexOf(":")));
|
|
71
|
+
if (outcome.includes(":") && (settled.get(intent)?.id ?? -1) < id)
|
|
72
|
+
settled.set(intent, { id, outcome: outcome.slice(outcome.indexOf(":") + 1) });
|
|
73
|
+
}
|
|
74
|
+
else if (action === LAND_HANDOFF_SETTLED) {
|
|
75
|
+
if (/^\d+:kept$/.test(outcome))
|
|
76
|
+
kept.add(Number(outcome.slice(0, outcome.indexOf(":"))));
|
|
77
|
+
}
|
|
78
|
+
else if (action === LAND_INTENT) {
|
|
79
|
+
const one = intentOf(id, parsed(row["detail"]) ?? {});
|
|
80
|
+
if (one !== null)
|
|
81
|
+
intents.set(task, [...(intents.get(task) ?? []), one]);
|
|
82
|
+
}
|
|
83
|
+
else if (action === LAND_HANDOFF) {
|
|
84
|
+
const one = handoffOf(id, parsed(row["detail"]) ?? {});
|
|
85
|
+
if (one !== null)
|
|
86
|
+
handoffs.set(task, [...(handoffs.get(task) ?? []), { repo: String(row["repo"]), one }]);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const landedOutcome = (intent) => settled.get(intent)?.outcome.startsWith("landed") === true;
|
|
90
|
+
let left = LANDED_GIT_READS;
|
|
91
|
+
const budgeted = (cwd, args) => {
|
|
92
|
+
if (left <= 0)
|
|
93
|
+
throw new GitBudgetSpent();
|
|
94
|
+
left -= 1;
|
|
95
|
+
return read(cwd, args);
|
|
96
|
+
};
|
|
97
|
+
for (const row of done) {
|
|
98
|
+
try {
|
|
99
|
+
const words = landedWordsOf(row);
|
|
100
|
+
if (words !== null)
|
|
101
|
+
out.set(row.rootId, words);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
if (error instanceof GitBudgetSpent)
|
|
105
|
+
break;
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return out;
|
|
110
|
+
function landedWordsOf(row) {
|
|
111
|
+
const repo = row.repo, head = heads.get(row.resultRunId) ?? null;
|
|
112
|
+
if (granted.has(repo) || (!intents.has(row.rootId) && !handoffs.has(row.rootId)))
|
|
113
|
+
return null;
|
|
114
|
+
const all = [...(intents.get(row.rootId) ?? [])].sort((a, b) => b.id - a.id);
|
|
115
|
+
const record = all.find(one => one.kind === "land" && landedOutcome(one.id)) ?? null;
|
|
116
|
+
const name = record === null ? null : record.fromHandoff !== null ? `handoff:${record.fromHandoff}` : `intent:${record.id}`;
|
|
117
|
+
const undone = record !== null && all.some(one => one.kind === "undo" && (one.reverts === name || one.reverts === record.id) && landedOutcome(one.id));
|
|
118
|
+
if (record === null || undone) {
|
|
119
|
+
if (head === null || !OID.test(head))
|
|
120
|
+
return null;
|
|
121
|
+
const destination = destinations.get(repo)?.ref ?? null;
|
|
122
|
+
const ref = destination !== null && destination !== "" ? destination : (() => { const named = budgeted(repo, ["symbolic-ref", "-q", "HEAD"]); return named !== null && named.startsWith("refs/heads/") ? named : null; })();
|
|
123
|
+
if (ref === null || !landableBranch(ref.slice("refs/heads/".length)))
|
|
124
|
+
return null;
|
|
125
|
+
const handed = (handoffs.get(row.rootId) ?? []).filter(one => one.repo === repo && kept.has(one.one.id) && one.one.candidate === head && one.one.ref === ref)
|
|
126
|
+
.sort((a, b) => b.one.id - a.one.id).map(one => ({ commit: one.one.commit, old: one.one.old }));
|
|
127
|
+
const on = [{ commit: head, old: null }, ...handed].find(one => budgeted(repo, ["merge-base", "--is-ancestor", one.commit, ref]) !== null);
|
|
128
|
+
if (on === undefined)
|
|
129
|
+
return null;
|
|
130
|
+
const reverted = on.old !== null && revertedOnBranch(repo, ref, { old: on.old, commit: on.commit }, budgeted);
|
|
131
|
+
return `Landed on ${ref.slice("refs/heads/".length)} (${short(on.commit)})${reverted ? " · a later commit reverted it" : ""}`;
|
|
132
|
+
}
|
|
133
|
+
if (head === null || record.candidate !== head)
|
|
134
|
+
return null;
|
|
135
|
+
const reverted = revertedOnBranch(repo, record.ref, record, budgeted);
|
|
136
|
+
return `Landed on ${record.ref.replace(/^refs\/heads\//, "")} (${short(record.commit)})${reverted ? " · a later commit reverted it" : ""}`;
|
|
137
|
+
}
|
|
138
|
+
}
|
package/dist/local-landing.js
CHANGED
|
@@ -11,6 +11,7 @@ import { reproveApprover, verifyApproverStanding } from "./principal.js";
|
|
|
11
11
|
import { localActNow, LOCAL_OWNER_LAPSED } from "./local-owner.js";
|
|
12
12
|
import { publishingOf } from "./pull-request-flow.js";
|
|
13
13
|
import { readGit, wholeChangeBaseOf } from "./task-base.js";
|
|
14
|
+
import { catchUpConflictOf } from "./revision-catch-up.js";
|
|
14
15
|
export const LAND_DESTINATION = "land destination";
|
|
15
16
|
export const LAND_INTENT = "land intent";
|
|
16
17
|
export const LAND_SETTLED = "land settled";
|
|
@@ -188,6 +189,17 @@ export function publishesThroughPullRequests(store, repo) {
|
|
|
188
189
|
}
|
|
189
190
|
export const PULL_REQUESTS_INSTEAD = "This project publishes through pull requests; open one from the task instead.";
|
|
190
191
|
const ALREADY_MSG = (ref, commit) => `Already on ${ref.replace(/^refs\/heads\//, "")} (${short(commit)}).`;
|
|
192
|
+
const MOVED_MSG = (branch, old) => `${branch} moved on since this work started (it's at ${short(old)} now). `
|
|
193
|
+
+ `Send it back: Toolroll builds it again on the current ${branch} with this work merged in, and its checks run on both together.`;
|
|
194
|
+
const CONFLICT_MSG = (branch, old, files, candidate) => {
|
|
195
|
+
const named = files.slice(0, 3).map(one => shownName(one)).join(", ");
|
|
196
|
+
return `${branch} moved on since this work started (it's at ${short(old)} now), and its newer changes conflict with this work${named === "" ? "" : ` in ${named}${files.length > 3 ? ", …" : ""}`}. `
|
|
197
|
+
+ `Toolroll can't merge them by itself. To land it, merge ${short(candidate)} into ${branch} yourself and resolve the conflicts, or file a new task on the current ${branch}.`;
|
|
198
|
+
};
|
|
199
|
+
export function landingBranchOf(store, repo, fallback) {
|
|
200
|
+
const recorded = recordedDestination(store, repo);
|
|
201
|
+
return recorded !== null && recorded.common === commonDirOf(repo) ? recorded.ref.slice("refs/heads/".length) : fallback;
|
|
202
|
+
}
|
|
191
203
|
export async function readLanding(store, taskId, access, now, options) {
|
|
192
204
|
const assignment = assignmentOf(store, taskId, now, { principal: "operator", repos: access.repos, includeUnplaced: false }, options.root);
|
|
193
205
|
if (assignment === null)
|
|
@@ -236,6 +248,13 @@ export async function readLanding(store, taskId, access, now, options) {
|
|
|
236
248
|
if (seen !== null && seen.reverted)
|
|
237
249
|
return refuse("nothing", `${seen.words}.`);
|
|
238
250
|
}
|
|
251
|
+
if (!read.ok && read.reason === "moved") {
|
|
252
|
+
const now = await git(["rev-parse", "--verify", "-q", `${destination.ref}^{commit}`]);
|
|
253
|
+
const old = now.stdout.trim();
|
|
254
|
+
const files = now.code === 0 && OID.test(old) ? catchUpConflictOf(store, receipt.taskId, old) : null;
|
|
255
|
+
if (files !== null)
|
|
256
|
+
return refuse("moved", CONFLICT_MSG(destination.ref.slice("refs/heads/".length), old, files, candidate));
|
|
257
|
+
}
|
|
239
258
|
return read;
|
|
240
259
|
}
|
|
241
260
|
export function landedLine(landed) {
|
|
@@ -299,8 +318,7 @@ async function planFor(git, project, destination, fixed, squashing = null) {
|
|
|
299
318
|
}
|
|
300
319
|
const ancestor = await git(["merge-base", "--is-ancestor", old, fixed.candidate]);
|
|
301
320
|
if (ancestor.code === 1) {
|
|
302
|
-
return refuse("moved",
|
|
303
|
-
+ `Send it back to build on the current ${branch}; landing it as it is would drop or mix in changes nobody checked together.`);
|
|
321
|
+
return refuse("moved", MOVED_MSG(branch, old));
|
|
304
322
|
}
|
|
305
323
|
if (ancestor.code !== 0)
|
|
306
324
|
return refuse("git", "Toolroll couldn't compare the commits.");
|
package/dist/merge-checklist.js
CHANGED
|
@@ -4,10 +4,11 @@ import { releaseCiHoldOf, releaseCiRunningOf } from "./release-ci-hold.js";
|
|
|
4
4
|
import { isRevisionFeedback } from "./result-review.js";
|
|
5
5
|
import { approvalOf, deployGateScope } from "./scope.js";
|
|
6
6
|
import { shipChecksForTask } from "./store.js";
|
|
7
|
-
import { approvedCheckStateOf, requirementWordOf } from "./task-status.js";
|
|
7
|
+
import { approvedCheckStateOf, completedByOf, requirementWordOf } from "./task-status.js";
|
|
8
8
|
import { projectCheckSet } from "./check-levels.js";
|
|
9
9
|
import { projectName } from "./project.js";
|
|
10
|
-
import { landingHistoryOf, publishesThroughPullRequests } from "./local-landing.js";
|
|
10
|
+
import { landingBranchOf, landingHistoryOf, publishesThroughPullRequests, shownName } from "./local-landing.js";
|
|
11
|
+
import { catchUpConflictOf } from "./revision-catch-up.js";
|
|
11
12
|
import { recentGitReads } from "./task-base.js";
|
|
12
13
|
const landingReads = recentGitReads();
|
|
13
14
|
export function landedNowOf(store, assignment, read = landingReads) {
|
|
@@ -52,6 +53,8 @@ export function checklistFromAssignment(store, taskId, assignment, landed = null
|
|
|
52
53
|
const head = receipt?.head ?? null;
|
|
53
54
|
const rows = [];
|
|
54
55
|
const row = (key, mark, say, act = null) => rows.push({ key, label: CHECKLIST_LABELS[key], mark, say, act });
|
|
56
|
+
const accepted = assignment.state === "complete" && assignment.completion !== null;
|
|
57
|
+
const acceptedByPerson = accepted && assignment.completion.person !== undefined;
|
|
55
58
|
if (scope === null)
|
|
56
59
|
row("plan", "no", "There's no plan yet.");
|
|
57
60
|
else if (approvalOf(scope).approved)
|
|
@@ -78,13 +81,17 @@ export function checklistFromAssignment(store, taskId, assignment, landed = null
|
|
|
78
81
|
else if (check === "off")
|
|
79
82
|
row("checks", "waiting", "Checks are off for this project; they run at release.");
|
|
80
83
|
else if (check === "not-run" && assignment.repo !== null && !projectCheckSet(store, assignment.repo)) {
|
|
81
|
-
row("checks", "
|
|
84
|
+
row("checks", "note", noCheckSetWords(assignment.repo));
|
|
82
85
|
}
|
|
83
86
|
else
|
|
84
87
|
row("checks", "no", check === "unreadable" ? "The check result couldn't be read." : check === "stale" ? "The check command changed since they ran on this commit." : "No check ran on this commit.", { kind: "run-checks", run: receipt.runId });
|
|
85
88
|
const criteria = assignment.readiness?.blockers.filter(one => one.key === "criteria" || one.key === "high") ?? [];
|
|
86
89
|
if (receipt === null)
|
|
87
90
|
row("requirements", "waiting", "Waits for a build.");
|
|
91
|
+
else if (acceptedByPerson) {
|
|
92
|
+
const by = completedByOf(assignment.completion);
|
|
93
|
+
row("requirements", "yes", by === null ? "Accepted." : `Accepted by ${by}.`);
|
|
94
|
+
}
|
|
88
95
|
else if (criteria.length > 0)
|
|
89
96
|
row("requirements", "no", criteria[0].message, { kind: "fix", run: receipt.runId, note: criteria.map(one => one.message).join("\n") });
|
|
90
97
|
else if (assignment.readiness?.verdict === "refuted")
|
|
@@ -144,15 +151,20 @@ export function checklistFromAssignment(store, taskId, assignment, landed = null
|
|
|
144
151
|
row("pr-ci", view.state === "failed" || view.state === "closed" ? "skip" : "waiting", view.state === "failed" || view.state === "closed" ? "No open pull request." : "No CI has reported yet.");
|
|
145
152
|
}
|
|
146
153
|
const notRecorded = publishing.on ? NOT_RECORDED : NOT_RECORDED_LOCAL;
|
|
147
|
-
const standing = merged || publishing.on || receipt === null || assignment.repo === null ? null :
|
|
154
|
+
const standing = merged || publishing.on || receipt === null || assignment.repo === null ? null : behindMainOf(store, assignment, base === undefined ? undefined : base?.main ?? null, read);
|
|
148
155
|
if (merged)
|
|
149
156
|
row("up-to-date", "yes", "Merged.");
|
|
150
157
|
else if (standing == null || standing.main === null || standing.behind === null)
|
|
151
158
|
row("up-to-date", "unknown", notRecorded);
|
|
152
159
|
else if (standing.behind === 0)
|
|
153
160
|
row("up-to-date", "yes", `Up to date with ${standing.main}.`);
|
|
154
|
-
else
|
|
155
|
-
|
|
161
|
+
else {
|
|
162
|
+
const missing = `${standing.main} has ${standing.behind === 1 ? "1 commit" : `${standing.behind} commits`} this work doesn't`;
|
|
163
|
+
if (standing.conflict !== null)
|
|
164
|
+
row("up-to-date", "no", `${missing}, and they conflict with it${conflictNames(standing.conflict)}. Merge it into ${standing.main} yourself and resolve the conflicts, or file a new task on the current ${standing.main}.`);
|
|
165
|
+
else
|
|
166
|
+
row("up-to-date", "no", `${missing}. Send it back: Toolroll builds it again on the current ${standing.main} with this work merged in.`, { kind: "fix", run: receipt.runId, note: upToDateNote(standing.main) });
|
|
167
|
+
}
|
|
156
168
|
if (merged)
|
|
157
169
|
row("conflicts", "yes", "Merged.");
|
|
158
170
|
else if (receipt?.checks.batch?.state === "conflict")
|
|
@@ -165,7 +177,7 @@ export function checklistFromAssignment(store, taskId, assignment, landed = null
|
|
|
165
177
|
else if (notes.length === 0)
|
|
166
178
|
row("comments", "yes", "None open.");
|
|
167
179
|
else
|
|
168
|
-
row("comments", "no", `${notes.length} note${notes.length === 1 ? "" : "s"} not sent back yet.`, { kind: "fix", run, note: "" });
|
|
180
|
+
row("comments", accepted ? "note" : "no", `${notes.length} note${notes.length === 1 ? "" : "s"} not sent back yet.`, { kind: "fix", run, note: "" });
|
|
169
181
|
if (scope !== null && deployGateScope(scope)) {
|
|
170
182
|
if (releaseCiHoldOf(store, active) !== null || releaseCiRunningOf(store, active) !== null)
|
|
171
183
|
row("release", "waiting", "GitHub's checks are still running.");
|
|
@@ -187,6 +199,19 @@ export function checklistFromAssignment(store, taskId, assignment, landed = null
|
|
|
187
199
|
: `Yes, as far as Toolroll records.${unknown.length === 0 ? "" : ` Check ${unknown.join(" and ")} ${publishing.on ? "on GitHub" : "in your repository"}.`}`;
|
|
188
200
|
return { taskId, activeTaskId: active, run, head, answer, sentence, rows };
|
|
189
201
|
}
|
|
202
|
+
export const upToDateNote = (main) => `${main} moved on since this work started. Make sure the work still fits with ${main}'s newer changes.`;
|
|
203
|
+
const conflictNames = (files) => files.length === 0 ? "" : ` in ${files.slice(0, 3).map(one => shownName(one)).join(", ")}${files.length > 3 ? ", …" : ""}`;
|
|
204
|
+
export function behindMainOf(store, assignment, main, read = landingReads) {
|
|
205
|
+
const receipt = assignment.receipt;
|
|
206
|
+
if (receipt === null || assignment.repo === null)
|
|
207
|
+
return null;
|
|
208
|
+
const checkedOut = main === undefined ? read(assignment.repo, ["symbolic-ref", "--short", "-q", "HEAD"]) || null : main;
|
|
209
|
+
const standing = resultBehindMain(assignment.repo, receipt.head, landingBranchOf(store, assignment.repo, checkedOut), read);
|
|
210
|
+
if (standing.main === null || standing.behind === null || standing.behind === 0)
|
|
211
|
+
return { ...standing, conflict: null };
|
|
212
|
+
const tip = read(assignment.repo, ["rev-parse", "--verify", "-q", `refs/heads/${standing.main}^{commit}`]);
|
|
213
|
+
return { ...standing, conflict: tip === null ? null : catchUpConflictOf(store, receipt.taskId, tip) };
|
|
214
|
+
}
|
|
190
215
|
function resultBehindMain(repo, head, main, read) {
|
|
191
216
|
const branch = main === undefined ? read(repo, ["symbolic-ref", "--short", "-q", "HEAD"]) || null : main;
|
|
192
217
|
if (branch === null || head === null || !/^[0-9a-f]{40}$/.test(head))
|
|
@@ -197,7 +222,7 @@ function resultBehindMain(repo, head, main, read) {
|
|
|
197
222
|
export function checklistLines(list) {
|
|
198
223
|
if (list.answer === "landed")
|
|
199
224
|
return [list.sentence];
|
|
200
|
-
const MARK = { yes: "✓", no: "✗", waiting: "…", unknown: "?", skip: "–" };
|
|
225
|
+
const MARK = { yes: "✓", no: "✗", waiting: "…", unknown: "?", note: "–", skip: "–" };
|
|
201
226
|
return [`Can I merge ${list.activeTaskId}? ${list.sentence}`,
|
|
202
227
|
...list.rows.filter(one => one.mark !== "skip").map(one => ` ${MARK[one.mark]} ${one.label}: ${one.say}${one.act === null ? "" : ` Next: ${CHECKLIST_ACT_LABELS[one.act.kind]}, on the task's page.`}`)];
|
|
203
228
|
}
|
package/dist/models-ui.js
CHANGED
|
@@ -75,7 +75,7 @@ function choiceSection(view, manage, previewing) {
|
|
|
75
75
|
const presetItems = view.presets.map(one => ({ value: one.name, label: one.label, text: `${one.words}${one.recommended ? " Recommended." : ""}${one.inUse ? " In use." : ""}` }));
|
|
76
76
|
const presets = manage
|
|
77
77
|
? html `<form method="get" action="/settings/models" class="models-presets" id="models-preset">${view.scope.value === "installation" ? "" : html `<input type="hidden" name="scope" value="${view.scope.value}">`}\
|
|
78
|
-
${radios({ name: "preset", legend: "Preset", current, items: presetItems })}${acts(btn("Review changes", { variant: previewing ? "outline" : "primary", type: "submit", docked: !previewing }))}</form>`
|
|
78
|
+
${radios({ name: "preset", legend: "Preset", current, items: presetItems })}${acts(btn("Review changes", { variant: previewing || current === "" ? "outline" : "primary", type: "submit", docked: !previewing && current !== "" }))}</form>`
|
|
79
79
|
: factList(view.presets.map(one => [one.label, `${one.words}${one.inUse ? " In use." : ""}`]));
|
|
80
80
|
const newer = view.newer.length === 0 ? "" : html `${group("Newer models")}${view.newer.map(one => formRow(one.name, `Newer than ${one.from}, used by ${one.roles}.`, manage ? btn("Switch to it", { sm: true, href: `/settings/models?switch=${encodeURIComponent(one.from)}&to=${encodeURIComponent(one.to)}${scopeQuery(view)}` }) : html ``, "inline"))}`;
|
|
81
81
|
const main = view.roles.filter(role => !role.tier), tiers = view.roles.filter(role => role.tier);
|
|
@@ -109,7 +109,10 @@ function sizingSection(view) {
|
|
|
109
109
|
function recentSection(view) {
|
|
110
110
|
if (view.recent.length === 0)
|
|
111
111
|
return "";
|
|
112
|
-
return sec("recent", "Recent work", "", view.recent.map(one =>
|
|
112
|
+
return sec("recent", "Recent work", "", view.recent.map(one => {
|
|
113
|
+
const detail = one.ranOn === "not reported" ? `Set to ${one.chosen} · actual model not reported` : `Set to ${one.chosen} → ran on ${one.ranOn}`;
|
|
114
|
+
return formRow(one.role, detail, html `<a class="k-link k-mono" href="/t/${encodeURIComponent(one.taskId)}">${one.taskId}</a>`, "inline");
|
|
115
|
+
}));
|
|
113
116
|
}
|
|
114
117
|
function suggestedSection(view) {
|
|
115
118
|
const s = view.suggested;
|
package/dist/operate.js
CHANGED
|
@@ -4,7 +4,7 @@ import { readStoredGeminiStatus, refreshSubscriptions } from "./subscription-usa
|
|
|
4
4
|
import { liveCommandsShown } from "./live-detail.js";
|
|
5
5
|
import { flexibleArmedPass } from "./flexible-ship.js";
|
|
6
6
|
import { directChatArmedPass } from "./direct-chat-ship.js";
|
|
7
|
-
import { saveFlexibleBranch } from "./flexible-save.js";
|
|
7
|
+
import { flexibleSavedWords, flexibleUncommittedFiles, saveFlexibleBranch } from "./flexible-save.js";
|
|
8
8
|
import { closeFlexibleThread, flexibleShipNeedsFor, flexibleThreadRecords, flexibleThreadShipTerms, flexibleThreadTitleOf, latestFlexibleShip, removeFlexibleThreadCopy, shipFlexibleThread, stopFlexibleThreadsEverywhere } from "./flexible-session.js";
|
|
9
9
|
import { runCardCommand } from "./card-cli.js";
|
|
10
10
|
import { mintSecret } from "./secret-mint.js";
|
|
@@ -102,6 +102,7 @@ import { passwordFreeOwner, passwordFreeShell, passwordFreeShellWords, proveTask
|
|
|
102
102
|
import { applyPendingAgentChanges, planAgainAsLocalOwner, requestPlanAsLocalOwner, retryAsLocalOwner } from "./local-owner-acts.js";
|
|
103
103
|
import { withTaskAlias } from "./task-aliases.js";
|
|
104
104
|
import { checklistLines, landedNowOf, mergeChecklistOf } from "./merge-checklist.js";
|
|
105
|
+
import { landedRowsOf } from "./landed-rows.js";
|
|
105
106
|
import { taskReviewBrief, renderReviewBrief } from "./task-review-brief.js";
|
|
106
107
|
import { homedir, hostname } from "node:os";
|
|
107
108
|
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
@@ -127,7 +128,8 @@ import { isWritesMode, writesWords } from "./writes-mode.js";
|
|
|
127
128
|
import { linuxFenceAvailable, macosFenceAvailable } from "./agent-fence.js";
|
|
128
129
|
import { parseMachLookup, parseReadDeny, readDenyWords } from "./project-sandbox.js";
|
|
129
130
|
import { LOCAL_POLICY } from "./surface.js";
|
|
130
|
-
import { handoffWords, land, landedLine, landingWords, publishesThroughPullRequests, PULL_REQUESTS_INSTEAD, readLanding } from "./local-landing.js";
|
|
131
|
+
import { handoffWords, land, landedLine, landingBranchOf, landingWords, publishesThroughPullRequests, PULL_REQUESTS_INSTEAD, readLanding } from "./local-landing.js";
|
|
132
|
+
import { catchUpMergeOf, catchUpRevision, recordCatchUp } from "./revision-catch-up.js";
|
|
131
133
|
import { asLocalOwner, currentLocalOwner, localActNow, LOCAL_MODE_CONFINES, localModeOn, localOwnerRefusal, localOwnerRequested } from "./local-owner.js";
|
|
132
134
|
import { CHECK_ACCESS_WARNINGS, checkAccessRunsAs, checkAccessWords, isCheckAccess, signInHostsMissing, signInsUnavailableWords, widerThan } from "./check-access.js";
|
|
133
135
|
import { CLI_PASSWORD_SOURCE, withPasswordSource } from "./sign-in-guard.js";
|
|
@@ -223,6 +225,7 @@ import { readExecutorOf } from "./read-executor.js";
|
|
|
223
225
|
import { parseWorkView } from "./workspace-ui.js";
|
|
224
226
|
import { taskWorkSummaryOf } from "./work-summary.js";
|
|
225
227
|
import { assignmentOf, assignmentBrief, syncAssignmentHandoffs } from "./assignment.js";
|
|
228
|
+
import { completedByOf } from "./task-status.js";
|
|
226
229
|
import { createScheduledFlow, describeSchedule, parseSchedule } from "./flow-schedule.js";
|
|
227
230
|
import { fileTaskProposal, validateTaskText } from "./proposal.js";
|
|
228
231
|
import { TEMPLATES, templateByName } from "./templates.js";
|
|
@@ -286,6 +289,21 @@ import { loginFileOf, migrateLegacyLogin, removeStaleSavedLogin, savedLoginFile,
|
|
|
286
289
|
import { runWords } from "./needs-you.js";
|
|
287
290
|
export const EXIT = { ok: 0, failed: 1, usage: 2, refused: 3 };
|
|
288
291
|
const STATES = ["queued", "running", "done", "failed", "cancelled"];
|
|
292
|
+
export const TASK_HELP = `toolroll task — create, inspect, and ship tasks
|
|
293
|
+
|
|
294
|
+
toolroll task add "<change>" --repo . queue a task (--plan to review plan first; --checks quick|full|off)
|
|
295
|
+
toolroll task list [--view <v>] list tasks (needs-you, ready, running, queued, completed, archived)
|
|
296
|
+
toolroll task show <id> current state, diff summary, checks, and next action
|
|
297
|
+
toolroll task wait <id> [--timeout <s>] wait until this attempt finishes or needs you
|
|
298
|
+
toolroll task accept <id> accept a Ready result
|
|
299
|
+
toolroll task revise <id> --note "<text>" send a result back with feedback (catches up with main automatically)
|
|
300
|
+
toolroll task land <id> fast-forward or merge an accepted result onto your local branch
|
|
301
|
+
toolroll task stop <id> stop a running build
|
|
302
|
+
toolroll task retry <id> retry a failed or stopped task
|
|
303
|
+
toolroll task archive <id...> put tasks away (history kept; restore with \`task restore\`)
|
|
304
|
+
toolroll task evidence <id> [--html] export a task's evidence pack
|
|
305
|
+
|
|
306
|
+
Every command supports --json. Everything else: \`toolroll internals\`.`;
|
|
289
307
|
export const OPERATE_HELP = `toolroll — operating the queue
|
|
290
308
|
|
|
291
309
|
toolroll status running, queued, ready results, release check and plan windows
|
|
@@ -852,11 +870,12 @@ async function runOperateLocal(command, argv, write, options = {}) {
|
|
|
852
870
|
const { positional, flags } = parsed;
|
|
853
871
|
const json = flags.has("json");
|
|
854
872
|
if (flags.has("help")) {
|
|
873
|
+
const helpText = command === "task" && positional.length === 0 ? TASK_HELP : OPERATE_HELP;
|
|
855
874
|
if (json) {
|
|
856
|
-
write(envelopeJson({ ok: true, command: "help", help:
|
|
875
|
+
write(envelopeJson({ ok: true, command: "help", help: helpText }));
|
|
857
876
|
}
|
|
858
877
|
else {
|
|
859
|
-
write(
|
|
878
|
+
write(helpText);
|
|
860
879
|
}
|
|
861
880
|
return EXIT.ok;
|
|
862
881
|
}
|
|
@@ -2771,17 +2790,32 @@ async function tickCommand(flags, context) {
|
|
|
2771
2790
|
const branch = await existingOrFirst(taskBranches(id), async (one) => (await git("git", ["rev-parse", "--verify", "--quiet", `refs/heads/${one}`], { cwd: repo })).code === 0);
|
|
2772
2791
|
const exists = await git("git", ["rev-parse", "--verify", "--quiet", `refs/heads/${branch}`], { cwd: repo });
|
|
2773
2792
|
let buildBase = base;
|
|
2793
|
+
let caughtUp = null;
|
|
2774
2794
|
if (ref.revisionOf !== null) {
|
|
2775
2795
|
const source = revisionSourceHead(store, context.evidenceRoot, ref.id, ref.revisionOf);
|
|
2776
2796
|
let problem = source.ok ? null : source.problem;
|
|
2777
2797
|
if (source.ok) {
|
|
2778
|
-
if (exists.code !== 0 && text(flags, "base") === undefined)
|
|
2798
|
+
if (exists.code !== 0 && text(flags, "base") === undefined) {
|
|
2779
2799
|
buildBase = source.head;
|
|
2800
|
+
if (!publishesThroughPullRequests(store, repo)) {
|
|
2801
|
+
const onto = landingBranchOf(store, repo, base);
|
|
2802
|
+
const result = await catchUpRevision(hardenedGit(git, "build", { repo }), repo, source.head, onto, id, clock());
|
|
2803
|
+
caughtUp = { head: source.head, onto, result };
|
|
2804
|
+
if (result.kind === "merged")
|
|
2805
|
+
buildBase = result.commit;
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2780
2808
|
else {
|
|
2781
2809
|
const descendant = exists.code === 0 ? branch : base;
|
|
2782
2810
|
const ancestry = await lazyFetchSafeGit(git)("git", [...noLazyFetch(), "-c", "protocol.allow=never", "--no-replace-objects", "merge-base", "--is-ancestor", source.head, descendant], { cwd: repo });
|
|
2783
2811
|
if (ancestry.code !== 0)
|
|
2784
2812
|
problem = ancestry.stderr.includes(PARTIAL_CLONE_REFUSAL) ? PARTIAL_CLONE_REFUSAL : "the requested revision base does not contain its source head";
|
|
2813
|
+
else if (exists.code === 0 && store.latestBranchBaseMove(ref.id, branch) === null && store.firstBuilderBase(ref.id, branch) === null && !publishesThroughPullRequests(store, repo)) {
|
|
2814
|
+
const tip = exists.stdout.trim();
|
|
2815
|
+
const main = await catchUpMergeOf(hardenedGit(git, "build", { repo }), repo, tip, source.head, landingBranchOf(store, repo, base));
|
|
2816
|
+
if (main !== null)
|
|
2817
|
+
store.recordBranchBaseMove(ref.id, branch, tip, main, clock());
|
|
2818
|
+
}
|
|
2785
2819
|
}
|
|
2786
2820
|
}
|
|
2787
2821
|
if (problem !== null) {
|
|
@@ -2800,6 +2834,21 @@ async function tickCommand(flags, context) {
|
|
|
2800
2834
|
reclaim: { evidenceRoot: context.evidenceRoot },
|
|
2801
2835
|
...(exists.code === 0 ? freshBaseFor(store, id, branch, base) : {}),
|
|
2802
2836
|
});
|
|
2837
|
+
if (caughtUp !== null && caughtUp.result.kind === "merged") {
|
|
2838
|
+
const merged = caughtUp.result;
|
|
2839
|
+
const at = leased.ok && leased.created ? await hardenedGit(git, "build", { repo })("git", ["rev-parse", "--verify", "-q", `refs/heads/${branch}^{commit}`], { cwd: repo }) : null;
|
|
2840
|
+
if (at !== null && at.code === 0 && at.stdout.trim() === merged.commit)
|
|
2841
|
+
store.recordBranchBaseMove(ref.id, branch, merged.commit, merged.main, clock());
|
|
2842
|
+
else if (leased.ok && leased.created) {
|
|
2843
|
+
await worktrees.release(leased.worktree.path, clock());
|
|
2844
|
+
release(store, lease, clock());
|
|
2845
|
+
dispatched.push({ id, outcome: "failed", reason: "git", detail: "Toolroll couldn't confirm the new branch stands at its merge of main; it tries again." });
|
|
2846
|
+
broke++;
|
|
2847
|
+
continue;
|
|
2848
|
+
}
|
|
2849
|
+
else
|
|
2850
|
+
caughtUp = { ...caughtUp, result: { kind: "unavailable" } };
|
|
2851
|
+
}
|
|
2803
2852
|
if (!leased.ok) {
|
|
2804
2853
|
release(store, lease, clock());
|
|
2805
2854
|
dispatched.push({ id, outcome: "failed", reason: leased.reason });
|
|
@@ -2849,6 +2898,8 @@ async function tickCommand(flags, context) {
|
|
|
2849
2898
|
continue;
|
|
2850
2899
|
}
|
|
2851
2900
|
noteBaseStanding(store, runId, leased.base, base, clock());
|
|
2901
|
+
if (caughtUp !== null && leased.created)
|
|
2902
|
+
recordCatchUp(store, { repo, taskId: id, runId, branch, head: caughtUp.head, onto: caughtUp.onto }, caughtUp.result, clock());
|
|
2852
2903
|
if (leased.resumedFromRun !== undefined) {
|
|
2853
2904
|
store.addRunNote(runId, "Toolroll", `Recovered the ${leased.recoveryKind === "completed" ? "completed source draft" : "work-in-progress draft"} from interrupted attempt #${leased.resumedFromRun}. This fresh attempt is reviewing and verifying it; the safety patch is retained.`, clock());
|
|
2854
2905
|
}
|
|
@@ -4704,6 +4755,8 @@ async function verifyCommand(positional, flags, context) {
|
|
|
4704
4755
|
const wanted = positional[1];
|
|
4705
4756
|
if (!isCheckLevel(wanted))
|
|
4706
4757
|
return fail(write, json, "verify level", "usage", "`toolroll verify level quick|full|off --repo <path> --as <you> --token <t>`", EXIT.usage);
|
|
4758
|
+
if (passwordFreeInstall(store, flags, context.principal !== undefined))
|
|
4759
|
+
return fail(write, json, "verify level", "local-owner", "Changing a check needs a password. Run `toolroll password set` first.", EXIT.refused);
|
|
4707
4760
|
const acting = await askCredentials(flags, context);
|
|
4708
4761
|
if (acting === null)
|
|
4709
4762
|
return fail(write, json, "verify level", "usage", "changing a project's checks takes `--as <you> --token <t>`", EXIT.usage);
|
|
@@ -4725,6 +4778,8 @@ async function verifyCommand(positional, flags, context) {
|
|
|
4725
4778
|
const grantKey = repo === undefined ? undefined : quickValue !== undefined || quickClear ? quickVerifyKey(repo) : repo;
|
|
4726
4779
|
if (repo === undefined)
|
|
4727
4780
|
return fail(write, json, `verify ${action}`, "usage", "which repo? --repo <path>", EXIT.usage);
|
|
4781
|
+
if (passwordFreeInstall(store, flags, context.principal !== undefined))
|
|
4782
|
+
return fail(write, json, `verify ${action}`, "local-owner", `${action === "set" ? "Setting" : "Clearing"} a check needs a password. Run \`toolroll password set\` first.`, EXIT.refused);
|
|
4728
4783
|
const acting = await askCredentials(flags, context);
|
|
4729
4784
|
const verified = acting === null ? null : authenticateApprover(store, acting.name, acting.token);
|
|
4730
4785
|
if (acting === null || !verified?.ok)
|
|
@@ -7599,7 +7654,7 @@ async function waitTask(positional, flags, context) {
|
|
|
7599
7654
|
function taskCommand(positional, flags, context) {
|
|
7600
7655
|
const [action, ...rest] = positional;
|
|
7601
7656
|
if (action === undefined) {
|
|
7602
|
-
context.write(
|
|
7657
|
+
context.write(TASK_HELP);
|
|
7603
7658
|
return EXIT.ok;
|
|
7604
7659
|
}
|
|
7605
7660
|
const actor = currentActor();
|
|
@@ -8072,7 +8127,8 @@ function listTasks(flags, context) {
|
|
|
8072
8127
|
return fail(write, json, 'task list', 'usage', 'Invalid page cursor. Start again without --cursor.', EXIT.usage);
|
|
8073
8128
|
};
|
|
8074
8129
|
const show = (page) => {
|
|
8075
|
-
const
|
|
8130
|
+
const landed = landedRowsOf(store, page.items);
|
|
8131
|
+
const tasks = page.items.map(item => ({ ...item, id: item.rootId, ...(landed.has(item.rootId) ? { landed: landed.get(item.rootId) } : {}) }));
|
|
8076
8132
|
if (json) {
|
|
8077
8133
|
write(envelopeJson({ ok: true, command: 'task list', count: tasks.length, tasks,
|
|
8078
8134
|
totals: page.totals, nextCursor: page.nextCursor, limit: page.limit, view: page.view, evidence: 'recorded' }));
|
|
@@ -8081,8 +8137,13 @@ function listTasks(flags, context) {
|
|
|
8081
8137
|
if (tasks.length === 0)
|
|
8082
8138
|
write(wanted === undefined ? 'The task list is empty.' : `Nothing is ${wanted}.`);
|
|
8083
8139
|
const width = Math.max(0, ...tasks.map(task => task.id.length));
|
|
8140
|
+
const AFTER = { failed: 'checks failed after acceptance', stale: 'checks out of date', unreadable: "checks couldn't be read" };
|
|
8141
|
+
const marks = (task) => {
|
|
8142
|
+
const said = [...('landed' in task ? [`${task.landed.charAt(0).toLowerCase()}${task.landed.slice(1)}`] : []), ...(task.check === undefined ? [] : [AFTER[task.check]])];
|
|
8143
|
+
return said.length === 0 ? '' : ` · ${said.join(' · ')}`;
|
|
8144
|
+
};
|
|
8084
8145
|
for (const task of tasks)
|
|
8085
|
-
write(task.archived === undefined ? ` ${task.id.padEnd(width)} ${task.status.label.padEnd(16)} ${task.title}`
|
|
8146
|
+
write(task.archived === undefined ? ` ${task.id.padEnd(width)} ${task.status.label.padEnd(16)} ${task.title}${marks(task)}`
|
|
8086
8147
|
: ` ${task.id.padEnd(width)} ${'Archived'.padEnd(16)} ${task.title} — by ${task.archived.byKind === 'tidy' ? 'tidy' : task.archived.by}: ${task.archived.reason}`);
|
|
8087
8148
|
if (page.nextCursor !== null)
|
|
8088
8149
|
write(`Next page: --cursor ${page.nextCursor}`);
|
|
@@ -8172,6 +8233,7 @@ function showTask(positional, context) {
|
|
|
8172
8233
|
return succeed(write, json, "task show", detail, () => [
|
|
8173
8234
|
`${task.id} ${shared?.headline ?? detail.work?.status.label ?? task.state}${ref.deliverable === "report" ? " (scout — delivers a report)" : ""}`,
|
|
8174
8235
|
` ${task.title}`,
|
|
8236
|
+
...(landedNow === null ? [] : [` landing: ${landedNow}`]),
|
|
8175
8237
|
...(detail.work === null ? [] : [
|
|
8176
8238
|
` status: ${shared?.headline ?? detail.work.status.label}${shared === null ? "" : `${shared.headline === "On hold" ? " · " : " — "}${shared.sentence}`}`,
|
|
8177
8239
|
...(primaryAction === null || (checkedByPerson && (primaryAction.code === "open-result" || primaryAction.code === "inspect-run")) ? []
|
|
@@ -8179,12 +8241,17 @@ function showTask(positional, context) {
|
|
|
8179
8241
|
]),
|
|
8180
8242
|
...(task.state !== "done" || detail.proofVerdict === null
|
|
8181
8243
|
? []
|
|
8182
|
-
: [
|
|
8183
|
-
` checked: ${
|
|
8184
|
-
...(shownReasons.length > 0 ? [` ${shownReasons.map(plainReasonWords).join(" ")}`] : []),
|
|
8244
|
+
: shared?.headline === "Complete" && current?.completion?.person !== undefined ? [
|
|
8245
|
+
` checked: ${acceptedWords(current?.completion ?? null)}`,
|
|
8185
8246
|
...matrixWords(shownMatrix),
|
|
8186
8247
|
...(detail.semanticCoverage === null ? [] : coverageWords(detail.semanticCoverage).map(line => ` ${line}`)),
|
|
8187
|
-
]
|
|
8248
|
+
]
|
|
8249
|
+
: [
|
|
8250
|
+
` checked: ${proofVerdictWords(current?.receipt?.runId === latestFinished?.id ? current?.readiness?.verdict ?? detail.proofVerdict : detail.proofVerdict, detail.proofReasons).word}${detail.proofAccepted ? " (accepted)" : ""}`,
|
|
8251
|
+
...(shownReasons.length > 0 ? [` ${shownReasons.map(plainReasonWords).join(" ")}`] : []),
|
|
8252
|
+
...matrixWords(shownMatrix),
|
|
8253
|
+
...(detail.semanticCoverage === null ? [] : coverageWords(detail.semanticCoverage).map(line => ` ${line}`)),
|
|
8254
|
+
]),
|
|
8188
8255
|
...(detail.report === null
|
|
8189
8256
|
? []
|
|
8190
8257
|
: detail.report.ok
|
|
@@ -8195,7 +8262,6 @@ function showTask(positional, context) {
|
|
|
8195
8262
|
]
|
|
8196
8263
|
: [` report: ${detail.report.problem} (build #${detail.report.run})`]),
|
|
8197
8264
|
...pullRequestLines(detail.pullRequest),
|
|
8198
|
-
...(landedNow === null ? [] : [` landing: ${landedNow}`]),
|
|
8199
8265
|
...(base === null ? [] : [` base: ${baseStandingWords(base, landedNow !== null)}`]),
|
|
8200
8266
|
...(detail.blockedBy.length > 0 ? [` waits for ${detail.blockedBy.join(", ")}`] : []),
|
|
8201
8267
|
...(detail.position === null
|
|
@@ -13083,10 +13149,7 @@ async function flexibleSignInConfig(action, extra, repoGiven, flags, context) {
|
|
|
13083
13149
|
return succeed(write, json, command, { saved: true, replaced: saved.replaced, check: checked.outcome, signIn: statusData(flexibleSignInStatus(store, acting.name)) }, () => [`${saved.replaced ? "Replaced" : "Saved"}. ${signInCheckWords(checked)} It powers only threads you start; a password reset ends it.`]);
|
|
13084
13150
|
}
|
|
13085
13151
|
function passwordFreeRefusal(store, flags, key, remote) {
|
|
13086
|
-
if (
|
|
13087
|
-
return null;
|
|
13088
|
-
const binding = localOwnerBinding(store);
|
|
13089
|
-
if (binding === null || store.accountOf(binding.account)?.passwordSet === true)
|
|
13152
|
+
if (!passwordFreeInstall(store, flags, remote))
|
|
13090
13153
|
return null;
|
|
13091
13154
|
return `This Toolroll has no password yet, so this runs from Toolroll itself: run \`toolroll\`, select the task and press ${key}, or open it in the browser.`;
|
|
13092
13155
|
}
|
|
@@ -13220,13 +13283,16 @@ async function threadCommand(positional, flags, context) {
|
|
|
13220
13283
|
if (done.stopPending)
|
|
13221
13284
|
await stopFlexibleThreadsEverywhere(store, { reason: "its owner ended the thread", thread, clock });
|
|
13222
13285
|
const keeps = flexibleShipNeedsFor(store, thread) === null ? "ship its work, or save it as a branch," : `save its work as a branch (\`toolroll thread save ${thread.slice(0, 8)}\`)`;
|
|
13223
|
-
|
|
13286
|
+
const left = done.already ? 0 : (await flexibleUncommittedFiles(store, { thread })).length;
|
|
13287
|
+
const leftWords = `Ended. Its agent left uncommitted edits in ${left} file${left === 1 ? "" : "s"}: \`toolroll thread save ${thread.slice(0, 8)}\` saves them with its work as a branch. Its copy is kept for a week.`;
|
|
13288
|
+
return succeed(write, json, command, { thread, already: done.already }, () => [done.already ? "This thread had already ended." : left > 0 ? leftWords : `Ended. You can still ${keeps} for a week; then its copy is tidied.`]);
|
|
13224
13289
|
}
|
|
13225
13290
|
if (verb === "save") {
|
|
13226
13291
|
const saved = await saveFlexibleBranch(store, { thread, by: { name: who.name, generation: account.generation }, now: clock(), prove: proveNow });
|
|
13227
13292
|
if (!saved.ok)
|
|
13228
13293
|
return fail(write, json, command, saved.reason, saved.message, EXIT.refused);
|
|
13229
|
-
return succeed(write, json, command, { thread, branch: saved.branch, commit: saved.candidate, already: saved.already, files: saved.changedPaths, next: saved.next
|
|
13294
|
+
return succeed(write, json, command, { thread, branch: saved.branch, commit: saved.candidate, already: saved.already, files: saved.changedPaths, next: saved.next,
|
|
13295
|
+
leftover: saved.leftover, uncommitted: saved.uncommitted }, () => [flexibleSavedWords(saved), saved.next]);
|
|
13230
13296
|
}
|
|
13231
13297
|
const removed = await removeFlexibleThreadCopy(store, { thread, by: who.name, now: clock(), prove: proveNow });
|
|
13232
13298
|
return removed.ok ? succeed(write, json, command, { thread }, () => ["Removed its working copy. Its record stays."]) : fail(write, json, command, removed.reason, removed.message, EXIT.refused);
|
|
@@ -13504,3 +13570,13 @@ function verifyRepoOf(store, raw) {
|
|
|
13504
13570
|
return absolute;
|
|
13505
13571
|
}
|
|
13506
13572
|
const LAND_NEEDS_PASSWORD = "Land it from the workbench (B) or the task page in the browser; from a shell it needs a Toolroll password (`toolroll password set`).";
|
|
13573
|
+
function passwordFreeInstall(store, flags, remote) {
|
|
13574
|
+
if (remote || ["as", "token", "token-file", "token-env"].some(name => flags.has(name)) || localOwnerRequested() || envValue(process.env, "LEAD_TOKEN") !== undefined)
|
|
13575
|
+
return false;
|
|
13576
|
+
const binding = localOwnerBinding(store);
|
|
13577
|
+
return binding !== null && store.accountOf(binding.account)?.passwordSet !== true;
|
|
13578
|
+
}
|
|
13579
|
+
function acceptedWords(completion) {
|
|
13580
|
+
const by = completedByOf(completion);
|
|
13581
|
+
return by === null ? "accepted" : `accepted by ${by}`;
|
|
13582
|
+
}
|
|
@@ -87,7 +87,14 @@ export function followUpChecksOf(store, runId, now = new Date(), root, asOf) {
|
|
|
87
87
|
return { ...base, state: "not-run", note: "The saved check result could not be verified." };
|
|
88
88
|
}
|
|
89
89
|
const exit = /exit (\d+)/.exec(finished.detail ?? "");
|
|
90
|
-
|
|
90
|
+
const outdated = status === "failed" && root !== undefined && asOf === undefined && repo !== null && !stillApproved(base.level, digest)
|
|
91
|
+
&& (() => { try {
|
|
92
|
+
return checkCommandFor(store, repo, base.level).command !== null;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return false;
|
|
96
|
+
} })();
|
|
97
|
+
return { ...base, ...(outdated ? { outdated: true } : {}), state: status === "passed" ? "passed" : status === "failed" ? "failed" : "not-run",
|
|
91
98
|
exitCode: exit === null ? sealed?.exitCode ?? null : Number(exit[1]), logArtifactId: sealed?.log ?? null, note: status === "not-run" ? finished.detail : null,
|
|
92
99
|
...(sealed === null ? {} : { tested: sealed.ran ? sealed.tested : null, batch: sealed.batch }) };
|
|
93
100
|
}
|