toolroll 0.9.125 → 0.9.127

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.
Files changed (69) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +1 -1
  3. package/dist/agent-detect.js +23 -3
  4. package/dist/assignment.js +14 -4
  5. package/dist/bounded-spawn.js +5 -36
  6. package/dist/browser/workspace.css +1 -1
  7. package/dist/browser/workspace.js +29 -29
  8. package/dist/browser-open.js +49 -0
  9. package/dist/chat-acceptance.js +1 -1
  10. package/dist/check-only.js +1 -1
  11. package/dist/cli.js +2 -2
  12. package/dist/connect-cli.js +2 -8
  13. package/dist/contracts/engine-api.js +8 -0
  14. package/dist/direct-chat.js +26 -18
  15. package/dist/doctor.js +30 -3
  16. package/dist/easy-start.js +44 -17
  17. package/dist/engine-reads.js +34 -1
  18. package/dist/evals.js +17 -19
  19. package/dist/first-run.js +5 -1
  20. package/dist/flexible-conversation.js +79 -1
  21. package/dist/flexible-import.js +162 -4
  22. package/dist/flexible-save.js +51 -4
  23. package/dist/flexible-session.js +34 -8
  24. package/dist/flexible-start.js +2 -1
  25. package/dist/flow-code.js +2 -2
  26. package/dist/invoke.js +4 -4
  27. package/dist/landed-rows.js +138 -0
  28. package/dist/laptop-background.js +2 -11
  29. package/dist/linux-packages.js +46 -0
  30. package/dist/local-landing.js +46 -7
  31. package/dist/merge-checklist.js +62 -8
  32. package/dist/operate.js +90 -33
  33. package/dist/preflight.js +14 -0
  34. package/dist/process-identity.js +155 -0
  35. package/dist/quick-start.js +6 -1
  36. package/dist/release.js +8 -0
  37. package/dist/result-follow-ups.js +8 -1
  38. package/dist/revision-catch-up.js +98 -0
  39. package/dist/runner-process.js +9 -25
  40. package/dist/sandbox-launch.js +3 -2
  41. package/dist/sandbox-runtime.js +115 -15
  42. package/dist/sandbox-tools.js +91 -6
  43. package/dist/server/direct-chat.js +4 -3
  44. package/dist/server/engine-api.js +13 -8
  45. package/dist/server/merge-ready-view.js +4 -2
  46. package/dist/server/pages.js +5 -2
  47. package/dist/server/render-pages.js +1 -0
  48. package/dist/server/render-results.js +9 -7
  49. package/dist/server/render-tasks.js +2 -2
  50. package/dist/server/task-views.js +16 -9
  51. package/dist/server/tasks.js +2 -2
  52. package/dist/shown-text.js +14 -0
  53. package/dist/skill-library.js +2 -12
  54. package/dist/status-probe.js +32 -0
  55. package/dist/task-base.js +13 -2
  56. package/dist/task-status.js +18 -8
  57. package/dist/teardown-git.js +6 -0
  58. package/dist/telegram-status.js +1 -1
  59. package/dist/toolroll-update-cli.js +2 -1
  60. package/dist/toolroll-update.js +4 -0
  61. package/dist/trust-repair.js +187 -0
  62. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  63. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  64. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  65. package/dist/tui/linux-x64/toolroll-tui +0 -0
  66. package/dist/unreachable.js +15 -0
  67. package/dist/work-index.js +51 -3
  68. package/dist/workspace-ui.js +4 -2
  69. package/package.json +1 -1
@@ -0,0 +1,46 @@
1
+ import { existsSync } from "node:fs";
2
+ const PROGRAMS = [
3
+ ["apt", ["/usr/bin/apt-get"]],
4
+ ["dnf", ["/usr/bin/dnf", "/usr/bin/dnf5"]],
5
+ ["zypper", ["/usr/bin/zypper"]],
6
+ ["pacman", ["/usr/bin/pacman"]],
7
+ ["apk", ["/sbin/apk", "/usr/sbin/apk", "/usr/bin/apk"]],
8
+ ];
9
+ const NAMES = { apt: "Debian, Ubuntu", dnf: "Fedora", zypper: "openSUSE", pacman: "Arch", apk: "Alpine" };
10
+ const RENAMED = { which: { apt: "debianutils" } };
11
+ export function packageSystem(exists = existsSync, euid = process.geteuid?.() ?? -1) {
12
+ const manager = PROGRAMS.find(([, paths]) => paths.some(path => exists(path)))?.[0] ?? null;
13
+ return { manager, root: euid === 0 };
14
+ }
15
+ export function managerLine(manager, packages, root) {
16
+ const sudo = root ? "" : "sudo ";
17
+ const named = [...new Set(packages.map(one => RENAMED[one]?.[manager] ?? one))].join(" ");
18
+ switch (manager) {
19
+ case "apt": return `${sudo}apt update && ${sudo}apt install ${named}`;
20
+ case "dnf": return `${sudo}dnf install ${named}`;
21
+ case "zypper": return `${sudo}zypper install ${named}`;
22
+ case "pacman": return `${sudo}pacman -S --needed ${named}`;
23
+ case "apk": return `${sudo}apk add ${named}`;
24
+ }
25
+ }
26
+ export function installLine(packages, system = packageSystem()) {
27
+ if (system.manager !== null)
28
+ return managerLine(system.manager, packages, system.root);
29
+ return PROGRAMS.map(([manager]) => `${managerLine(manager, packages, system.root)} (${NAMES[manager]})`).join("; ");
30
+ }
31
+ export function managerReinstall(manager, packages, root) {
32
+ const sudo = root ? "" : "sudo ";
33
+ const named = [...new Set(packages.map(one => RENAMED[one]?.[manager] ?? one))].join(" ");
34
+ switch (manager) {
35
+ case "apt": return `${sudo}apt update && ${sudo}apt install --reinstall ${named}`;
36
+ case "dnf": return `${sudo}dnf reinstall ${named}`;
37
+ case "zypper": return `${sudo}zypper install -f ${named}`;
38
+ case "pacman": return `${sudo}pacman -S ${named}`;
39
+ case "apk": return `${sudo}apk fix ${named}`;
40
+ }
41
+ }
42
+ export function reinstallLine(packages, system = packageSystem()) {
43
+ if (system.manager !== null)
44
+ return managerReinstall(system.manager, packages, system.root);
45
+ return PROGRAMS.map(([manager]) => `${managerReinstall(manager, packages, system.root)} (${NAMES[manager]})`).join("; ");
46
+ }
@@ -10,7 +10,8 @@ import { recordActionWhole } from "./action-ledger.js";
10
10
  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
- import { wholeChangeBaseOf } from "./task-base.js";
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)
@@ -210,8 +222,10 @@ export async function readLanding(store, taskId, access, now, options) {
210
222
  if (candidate === null || !OID.test(candidate) || receipt.completionKind === "research-report")
211
223
  return refuse("nothing", "This result has no commit to land.");
212
224
  const landed = landingOf(store, assignment.rootId);
213
- if (landed !== null && !landed.undone && landed.intent.candidate === candidate)
214
- return { ok: true, landed: { at: landed.at, ref: landed.intent.ref, commit: landed.intent.commit, mode: landed.intent.mode } };
225
+ if (landed !== null && !landed.undone && landed.intent.candidate === candidate) {
226
+ const reverted = landedStanding(store, assignment.rootId, readGit)?.reverted === true;
227
+ return { ok: true, landed: { at: landed.at, ref: landed.intent.ref, commit: landed.intent.commit, mode: landed.intent.mode, ...(reverted ? { reverted } : {}) } };
228
+ }
215
229
  const checks = receipt.checks.status === "passed" ? "passed" : !projectCheckSet(store, project.repo) && receipt.checks.status === "not-run" ? "none" : null;
216
230
  if (checks === null) {
217
231
  if (receipt.checks.status === "failed")
@@ -225,10 +239,26 @@ export async function readLanding(store, taskId, access, now, options) {
225
239
  return destination;
226
240
  const run = store.getRun(receipt.runId);
227
241
  const base = run === null || run.branch === null ? null : wholeChangeBaseOf(store, run.taskRef, run.branch) ?? run.baseRevision;
228
- return planFor(git, project, destination, { kind: "land", taskId: receipt.taskId, rootId: assignment.rootId, runId: receipt.runId, receipt: receipt.digest, completion: assignment.completion.digest, candidate, checks,
242
+ const read = await planFor(git, project, destination, { kind: "land", taskId: receipt.taskId, rootId: assignment.rootId, runId: receipt.runId, receipt: receipt.digest, completion: assignment.completion.digest, candidate, checks,
229
243
  bindings: checkBindingsOf(store, project.repo) }, { base, message: squashMessage(store.getTask(receipt.taskId)?.title ?? null, receipt.taskId),
230
244
  time: Math.max(0, Math.floor(Date.parse(assignment.completion.at) / 1000) || 0),
231
245
  handedOff: handoffsOf(store, project.repo, assignment.rootId).filter(one => one.candidate === candidate).map(one => one.commit) });
246
+ if (!read.ok && read.reason === "nothing") {
247
+ const seen = recognisedOnBranch(store, project.repo, assignment.rootId, candidate, readGit);
248
+ if (seen !== null && seen.reverted)
249
+ return refuse("nothing", `${seen.words}.`);
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
+ }
258
+ return read;
259
+ }
260
+ export function landedLine(landed) {
261
+ return `Landed on ${landed.ref.replace(/^refs\/heads\//, "")} (${short(landed.commit)})${landed.reverted === true ? " · a later commit reverted it" : ""}.`;
232
262
  }
233
263
  async function destinationOf(store, project, git, into) {
234
264
  const recorded = recordedDestination(store, project.repo);
@@ -288,8 +318,7 @@ async function planFor(git, project, destination, fixed, squashing = null) {
288
318
  }
289
319
  const ancestor = await git(["merge-base", "--is-ancestor", old, fixed.candidate]);
290
320
  if (ancestor.code === 1) {
291
- return refuse("moved", `${branch} moved on since this work started (it's at ${short(old)} now): bring this task up to date first. `
292
- + `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));
293
322
  }
294
323
  if (ancestor.code !== 0)
295
324
  return refuse("git", "Toolroll couldn't compare the commits.");
@@ -485,7 +514,7 @@ export async function land(store, taskId, input, authority, access, now, options
485
514
  if (!read.ok)
486
515
  return read;
487
516
  if (!("plan" in read))
488
- return refuse("nothing", ALREADY_MSG(read.landed.ref, read.landed.commit));
517
+ return refuse("nothing", read.landed.reverted === true ? landedLine(read.landed) : ALREADY_MSG(read.landed.ref, read.landed.commit));
489
518
  const plan = read.plan;
490
519
  if (plan.key !== input.key)
491
520
  return refuse("stale", "Something changed since you looked (the branch, the checks or the result). Look again, then land it.");
@@ -801,6 +830,16 @@ export function recognisedOnBranch(store, repo, rootId, candidate, read) {
801
830
  const where = `Landed on ${ref.slice("refs/heads/".length)} (${short(found.commit)})`;
802
831
  return { words: reverted ? `${where} · a later commit reverted it` : where, reverted };
803
832
  }
833
+ export function landingHistoryOf(store, repo, rootId, candidate, read) {
834
+ const record = landingOf(store, rootId);
835
+ if (record === null || record.undone) {
836
+ const onBranch = recognisedOnBranch(store, repo, rootId, candidate, read);
837
+ if (onBranch !== null)
838
+ return { ...onBranch, landed: true, recorded: false };
839
+ }
840
+ const standing = landedStanding(store, rootId, read);
841
+ return standing === null ? null : { ...standing, landed: record !== null && !record.undone && candidate !== null && record.intent.candidate === candidate, recorded: true };
842
+ }
804
843
  export function broughtInOnBranch(store, repo, rootId, read) {
805
844
  const landed = landedCommits(store, rootId);
806
845
  return handoffsOf(store, repo, rootId).some(one => !landed.has(one.commit) && read(repo, ["merge-base", "--is-ancestor", one.commit, one.ref]) !== null);
@@ -4,9 +4,20 @@ 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 { landingBranchOf, landingHistoryOf, publishesThroughPullRequests, shownName } from "./local-landing.js";
11
+ import { catchUpConflictOf } from "./revision-catch-up.js";
12
+ import { recentGitReads } from "./task-base.js";
13
+ const landingReads = recentGitReads();
14
+ export function landedNowOf(store, assignment, read = landingReads) {
15
+ const head = assignment.state === "complete" ? assignment.receipt?.head ?? null : null;
16
+ if (head === null || assignment.repo === null || publishesThroughPullRequests(store, assignment.repo))
17
+ return null;
18
+ const history = landingHistoryOf(store, assignment.repo, assignment.rootId, head, read);
19
+ return history !== null && history.landed ? { words: history.words, reverted: history.reverted } : null;
20
+ }
10
21
  export const CHECKLIST_KEYS = ["plan", "build", "checks", "requirements", "pull-request", "pr-ci", "up-to-date", "conflicts", "comments", "release"];
11
22
  export const CHECKLIST_LABELS = {
12
23
  plan: "Plan approved",
@@ -29,10 +40,12 @@ export function mergeChecklistOf(store, taskId, now, access, root) {
29
40
  const assignment = assignmentOf(store, taskId, now, access, root);
30
41
  if (assignment === null)
31
42
  return null;
32
- return checklistFromAssignment(store, taskId, assignment);
43
+ return checklistFromAssignment(store, taskId, assignment, landedNowOf(store, assignment)?.words ?? null);
33
44
  }
34
- export function checklistFromAssignment(store, taskId, assignment) {
45
+ export function checklistFromAssignment(store, taskId, assignment, landed = null, base, read = landingReads) {
35
46
  const active = assignment.activeTaskId;
47
+ if (landed !== null)
48
+ return { taskId, activeTaskId: active, run: assignment.receipt?.runId ?? null, head: assignment.receipt?.head ?? null, answer: "landed", sentence: landed, rows: [] };
36
49
  const scope = store.getScope(active);
37
50
  const task = store.getTask(active);
38
51
  const receipt = assignment.receipt;
@@ -40,6 +53,8 @@ export function checklistFromAssignment(store, taskId, assignment) {
40
53
  const head = receipt?.head ?? null;
41
54
  const rows = [];
42
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;
43
58
  if (scope === null)
44
59
  row("plan", "no", "There's no plan yet.");
45
60
  else if (approvalOf(scope).approved)
@@ -66,13 +81,17 @@ export function checklistFromAssignment(store, taskId, assignment) {
66
81
  else if (check === "off")
67
82
  row("checks", "waiting", "Checks are off for this project; they run at release.");
68
83
  else if (check === "not-run" && assignment.repo !== null && !projectCheckSet(store, assignment.repo)) {
69
- row("checks", "no", noCheckSetWords(assignment.repo));
84
+ row("checks", "note", noCheckSetWords(assignment.repo));
70
85
  }
71
86
  else
72
- row("checks", "no", check === "unreadable" ? "The check result couldn't be read." : "No check ran on this commit.", { kind: "run-checks", run: receipt.runId });
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 });
73
88
  const criteria = assignment.readiness?.blockers.filter(one => one.key === "criteria" || one.key === "high") ?? [];
74
89
  if (receipt === null)
75
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
+ }
76
95
  else if (criteria.length > 0)
77
96
  row("requirements", "no", criteria[0].message, { kind: "fix", run: receipt.runId, note: criteria.map(one => one.message).join("\n") });
78
97
  else if (assignment.readiness?.verdict === "refuted")
@@ -132,7 +151,20 @@ export function checklistFromAssignment(store, taskId, assignment) {
132
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.");
133
152
  }
134
153
  const notRecorded = publishing.on ? NOT_RECORDED : NOT_RECORDED_LOCAL;
135
- row("up-to-date", merged ? "yes" : "unknown", merged ? "Merged." : notRecorded);
154
+ const standing = merged || publishing.on || receipt === null || assignment.repo === null ? null : behindMainOf(store, assignment, base === undefined ? undefined : base?.main ?? null, read);
155
+ if (merged)
156
+ row("up-to-date", "yes", "Merged.");
157
+ else if (standing == null || standing.main === null || standing.behind === null)
158
+ row("up-to-date", "unknown", notRecorded);
159
+ else if (standing.behind === 0)
160
+ row("up-to-date", "yes", `Up to date with ${standing.main}.`);
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
+ }
136
168
  if (merged)
137
169
  row("conflicts", "yes", "Merged.");
138
170
  else if (receipt?.checks.batch?.state === "conflict")
@@ -145,7 +177,7 @@ export function checklistFromAssignment(store, taskId, assignment) {
145
177
  else if (notes.length === 0)
146
178
  row("comments", "yes", "None open.");
147
179
  else
148
- 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: "" });
149
181
  if (scope !== null && deployGateScope(scope)) {
150
182
  if (releaseCiHoldOf(store, active) !== null || releaseCiRunningOf(store, active) !== null)
151
183
  row("release", "waiting", "GitHub's checks are still running.");
@@ -167,8 +199,30 @@ export function checklistFromAssignment(store, taskId, assignment) {
167
199
  : `Yes, as far as Toolroll records.${unknown.length === 0 ? "" : ` Check ${unknown.join(" and ")} ${publishing.on ? "on GitHub" : "in your repository"}.`}`;
168
200
  return { taskId, activeTaskId: active, run, head, answer, sentence, rows };
169
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
+ }
215
+ function resultBehindMain(repo, head, main, read) {
216
+ const branch = main === undefined ? read(repo, ["symbolic-ref", "--short", "-q", "HEAD"]) || null : main;
217
+ if (branch === null || head === null || !/^[0-9a-f]{40}$/.test(head))
218
+ return { main: branch, behind: null };
219
+ const counted = read(repo, ["rev-list", "--count", `${head}..refs/heads/${branch}`]);
220
+ return { main: branch, behind: counted !== null && /^\d+$/.test(counted) ? Number(counted) : null };
221
+ }
170
222
  export function checklistLines(list) {
171
- const MARK = { yes: "✓", no: "✗", waiting: "…", unknown: "?", skip: "–" };
223
+ if (list.answer === "landed")
224
+ return [list.sentence];
225
+ const MARK = { yes: "✓", no: "✗", waiting: "…", unknown: "?", note: "–", skip: "–" };
172
226
  return [`Can I merge ${list.activeTaskId}? ${list.sentence}`,
173
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.`}`)];
174
228
  }
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";
@@ -101,7 +101,8 @@ import { applyProjectProfile, runProjectCommand } from "./project-cli.js";
101
101
  import { passwordFreeOwner, passwordFreeShell, passwordFreeShellWords, proveTaskBuildsStopped, pullRequestLines, runLocalCompletion, runLocalRevision, runTaskMergeCommand, runTaskOutcomeCommand } from "./task-outcome-cli.js";
102
102
  import { applyPendingAgentChanges, planAgainAsLocalOwner, requestPlanAsLocalOwner, retryAsLocalOwner } from "./local-owner-acts.js";
103
103
  import { withTaskAlias } from "./task-aliases.js";
104
- import { checklistLines, mergeChecklistOf } from "./merge-checklist.js";
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, 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";
@@ -135,7 +137,6 @@ import { ledgerSpent, NO_SAFE_OPENER, openSignInLink, platformOpener } from "./s
135
137
  import { admissionRecorded, admitProject, commandLineActor } from "./project-admission.js";
136
138
  import { leadClaim, leadSay, noteLeadWork } from "./lead-voice.js";
137
139
  import { createConnection as createNetConnection, createServer as createNetServer } from "node:net";
138
- import { spawn as spawnChild } from "node:child_process";
139
140
  import { fileURLToPath } from "node:url";
140
141
  import { superviseController } from "./controller-supervisor.js";
141
142
  import { buildIdentity, memoryChannel, RoleGenerations, roleMessage } from "./up-processes.js";
@@ -204,6 +205,8 @@ import { disposeBuildOutcome, holdStaleApproval, regateTask } from "./dispose.js
204
205
  import { proposeGrant, describeGrant, describeWithheld, permits, MUTATION_CLASSES, DEFAULT_MUTATIONS, } from "./grant.js";
205
206
  import { builtIn, guarded } from "./backend.js";
206
207
  import { register, authenticate, heartbeat as heartbeatRunner, isAlive, recoverDead, recoveredAnything, acquireWatchLeaseAuthed, heartbeatWatchLeaseAuthed, addRunnerReposAuthed, removeRunnerRepoAuthed, registerRunnerIfIdle, retireRunnerIfCurrent, drainRunnerIfCurrent, RUNNER_HEARTBEAT_MS, MAX_WATCH_LEASE_MS, normalizeRunnerName, validRunnerName, canonicalRepos, RUNNER_NAME_MAX, RUNNER_CAPACITY_MAX, parseRunnerCapacity, hashToken as hashRunnerToken, } from "./runner.js";
208
+ import { processIdentityProblem } from "./process-identity.js";
209
+ import { openAddress } from "./browser-open.js";
207
210
  import { credentialDigest, recordedHolderProvedGone, processGone, processStart, readRunnerProcessRecord, runnerProcessFile, sealRunnerProcessRecord, writeRunnerProcessRecord } from "./runner-process.js";
208
211
  import { stopProcessTree } from "./process-tree.js";
209
212
  import { mintCoordinator, revokeCoordinator, listCoordinators } from "./coordinator.js";
@@ -222,6 +225,7 @@ import { readExecutorOf } from "./read-executor.js";
222
225
  import { parseWorkView } from "./workspace-ui.js";
223
226
  import { taskWorkSummaryOf } from "./work-summary.js";
224
227
  import { assignmentOf, assignmentBrief, syncAssignmentHandoffs } from "./assignment.js";
228
+ import { completedByOf } from "./task-status.js";
225
229
  import { createScheduledFlow, describeSchedule, parseSchedule } from "./flow-schedule.js";
226
230
  import { fileTaskProposal, validateTaskText } from "./proposal.js";
227
231
  import { TEMPLATES, templateByName } from "./templates.js";
@@ -2770,17 +2774,32 @@ async function tickCommand(flags, context) {
2770
2774
  const branch = await existingOrFirst(taskBranches(id), async (one) => (await git("git", ["rev-parse", "--verify", "--quiet", `refs/heads/${one}`], { cwd: repo })).code === 0);
2771
2775
  const exists = await git("git", ["rev-parse", "--verify", "--quiet", `refs/heads/${branch}`], { cwd: repo });
2772
2776
  let buildBase = base;
2777
+ let caughtUp = null;
2773
2778
  if (ref.revisionOf !== null) {
2774
2779
  const source = revisionSourceHead(store, context.evidenceRoot, ref.id, ref.revisionOf);
2775
2780
  let problem = source.ok ? null : source.problem;
2776
2781
  if (source.ok) {
2777
- if (exists.code !== 0 && text(flags, "base") === undefined)
2782
+ if (exists.code !== 0 && text(flags, "base") === undefined) {
2778
2783
  buildBase = source.head;
2784
+ if (!publishesThroughPullRequests(store, repo)) {
2785
+ const onto = landingBranchOf(store, repo, base);
2786
+ const result = await catchUpRevision(hardenedGit(git, "build", { repo }), repo, source.head, onto, id, clock());
2787
+ caughtUp = { head: source.head, onto, result };
2788
+ if (result.kind === "merged")
2789
+ buildBase = result.commit;
2790
+ }
2791
+ }
2779
2792
  else {
2780
2793
  const descendant = exists.code === 0 ? branch : base;
2781
2794
  const ancestry = await lazyFetchSafeGit(git)("git", [...noLazyFetch(), "-c", "protocol.allow=never", "--no-replace-objects", "merge-base", "--is-ancestor", source.head, descendant], { cwd: repo });
2782
2795
  if (ancestry.code !== 0)
2783
2796
  problem = ancestry.stderr.includes(PARTIAL_CLONE_REFUSAL) ? PARTIAL_CLONE_REFUSAL : "the requested revision base does not contain its source head";
2797
+ else if (exists.code === 0 && store.latestBranchBaseMove(ref.id, branch) === null && store.firstBuilderBase(ref.id, branch) === null && !publishesThroughPullRequests(store, repo)) {
2798
+ const tip = exists.stdout.trim();
2799
+ const main = await catchUpMergeOf(hardenedGit(git, "build", { repo }), repo, tip, source.head, landingBranchOf(store, repo, base));
2800
+ if (main !== null)
2801
+ store.recordBranchBaseMove(ref.id, branch, tip, main, clock());
2802
+ }
2784
2803
  }
2785
2804
  }
2786
2805
  if (problem !== null) {
@@ -2799,6 +2818,21 @@ async function tickCommand(flags, context) {
2799
2818
  reclaim: { evidenceRoot: context.evidenceRoot },
2800
2819
  ...(exists.code === 0 ? freshBaseFor(store, id, branch, base) : {}),
2801
2820
  });
2821
+ if (caughtUp !== null && caughtUp.result.kind === "merged") {
2822
+ const merged = caughtUp.result;
2823
+ const at = leased.ok && leased.created ? await hardenedGit(git, "build", { repo })("git", ["rev-parse", "--verify", "-q", `refs/heads/${branch}^{commit}`], { cwd: repo }) : null;
2824
+ if (at !== null && at.code === 0 && at.stdout.trim() === merged.commit)
2825
+ store.recordBranchBaseMove(ref.id, branch, merged.commit, merged.main, clock());
2826
+ else if (leased.ok && leased.created) {
2827
+ await worktrees.release(leased.worktree.path, clock());
2828
+ release(store, lease, clock());
2829
+ dispatched.push({ id, outcome: "failed", reason: "git", detail: "Toolroll couldn't confirm the new branch stands at its merge of main; it tries again." });
2830
+ broke++;
2831
+ continue;
2832
+ }
2833
+ else
2834
+ caughtUp = { ...caughtUp, result: { kind: "unavailable" } };
2835
+ }
2802
2836
  if (!leased.ok) {
2803
2837
  release(store, lease, clock());
2804
2838
  dispatched.push({ id, outcome: "failed", reason: leased.reason });
@@ -2848,6 +2882,8 @@ async function tickCommand(flags, context) {
2848
2882
  continue;
2849
2883
  }
2850
2884
  noteBaseStanding(store, runId, leased.base, base, clock());
2885
+ if (caughtUp !== null && leased.created)
2886
+ recordCatchUp(store, { repo, taskId: id, runId, branch, head: caughtUp.head, onto: caughtUp.onto }, caughtUp.result, clock());
2851
2887
  if (leased.resumedFromRun !== undefined) {
2852
2888
  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());
2853
2889
  }
@@ -4703,6 +4739,8 @@ async function verifyCommand(positional, flags, context) {
4703
4739
  const wanted = positional[1];
4704
4740
  if (!isCheckLevel(wanted))
4705
4741
  return fail(write, json, "verify level", "usage", "`toolroll verify level quick|full|off --repo <path> --as <you> --token <t>`", EXIT.usage);
4742
+ if (passwordFreeInstall(store, flags, context.principal !== undefined))
4743
+ return fail(write, json, "verify level", "local-owner", "Changing a check needs a password. Run `toolroll password set` first.", EXIT.refused);
4706
4744
  const acting = await askCredentials(flags, context);
4707
4745
  if (acting === null)
4708
4746
  return fail(write, json, "verify level", "usage", "changing a project's checks takes `--as <you> --token <t>`", EXIT.usage);
@@ -4724,6 +4762,8 @@ async function verifyCommand(positional, flags, context) {
4724
4762
  const grantKey = repo === undefined ? undefined : quickValue !== undefined || quickClear ? quickVerifyKey(repo) : repo;
4725
4763
  if (repo === undefined)
4726
4764
  return fail(write, json, `verify ${action}`, "usage", "which repo? --repo <path>", EXIT.usage);
4765
+ if (passwordFreeInstall(store, flags, context.principal !== undefined))
4766
+ return fail(write, json, `verify ${action}`, "local-owner", `${action === "set" ? "Setting" : "Clearing"} a check needs a password. Run \`toolroll password set\` first.`, EXIT.refused);
4727
4767
  const acting = await askCredentials(flags, context);
4728
4768
  const verified = acting === null ? null : authenticateApprover(store, acting.name, acting.token);
4729
4769
  if (acting === null || !verified?.ok)
@@ -6143,17 +6183,7 @@ async function resolveUpApprover(context, flags, canPrompt) {
6143
6183
  return { approver: selected, approvers: names, verified, passwordFile, mintedPassword: null, notes, startAuthority: verified ? "full" : "none" };
6144
6184
  }
6145
6185
  export function openBrowser(url) {
6146
- const chosen = envValue(process.env, "BROWSER_COMMAND");
6147
- const command = chosen !== undefined && chosen !== "" ? [chosen, url]
6148
- : process.platform === "darwin" ? ["open", url]
6149
- : process.platform === "win32" ? ["cmd", "/c", "start", "", url]
6150
- : ["xdg-open", url];
6151
- try {
6152
- const child = spawnChild(command[0], command.slice(1), { detached: true, stdio: "ignore" });
6153
- child.unref();
6154
- }
6155
- catch {
6156
- }
6186
+ return openAddress(url);
6157
6187
  }
6158
6188
  function recordUpConsoleUrl(dir, url, now) {
6159
6189
  try {
@@ -6461,7 +6491,8 @@ async function upCommand(flags, context) {
6461
6491
  progress(`recovered ${answer.recoveredRuns} interrupted attempt(s) left by the previous ${name}`);
6462
6492
  if (!recordRunnerProcess(context.databaseFile, { runner: answer.runner, credentialHash: hashRunnerToken(answer.token) }, "up", process.pid)) {
6463
6493
  retireRunnerIfCurrent(store, runnerName, runnerToken, clock());
6464
- return fail(write, json, "up", "runner-alive", "The worker process record could not be saved; nothing started", EXIT.refused);
6494
+ const identity = processIdentityProblem();
6495
+ return fail(write, json, "up", "runner-alive", `The worker process record could not be saved${identity === null ? "" : ` (${identity})`}; nothing started`, EXIT.refused);
6465
6496
  }
6466
6497
  recordBuilderWish(store, "running", "up", packageVersion(), clock());
6467
6498
  doorAnswer = answer;
@@ -8080,7 +8111,8 @@ function listTasks(flags, context) {
8080
8111
  return fail(write, json, 'task list', 'usage', 'Invalid page cursor. Start again without --cursor.', EXIT.usage);
8081
8112
  };
8082
8113
  const show = (page) => {
8083
- const tasks = page.items.map(item => ({ ...item, id: item.rootId }));
8114
+ const landed = landedRowsOf(store, page.items);
8115
+ const tasks = page.items.map(item => ({ ...item, id: item.rootId, ...(landed.has(item.rootId) ? { landed: landed.get(item.rootId) } : {}) }));
8084
8116
  if (json) {
8085
8117
  write(envelopeJson({ ok: true, command: 'task list', count: tasks.length, tasks,
8086
8118
  totals: page.totals, nextCursor: page.nextCursor, limit: page.limit, view: page.view, evidence: 'recorded' }));
@@ -8089,8 +8121,13 @@ function listTasks(flags, context) {
8089
8121
  if (tasks.length === 0)
8090
8122
  write(wanted === undefined ? 'The task list is empty.' : `Nothing is ${wanted}.`);
8091
8123
  const width = Math.max(0, ...tasks.map(task => task.id.length));
8124
+ const AFTER = { failed: 'checks failed after acceptance', stale: 'checks out of date', unreadable: "checks couldn't be read" };
8125
+ const marks = (task) => {
8126
+ const said = [...('landed' in task ? [`${task.landed.charAt(0).toLowerCase()}${task.landed.slice(1)}`] : []), ...(task.check === undefined ? [] : [AFTER[task.check]])];
8127
+ return said.length === 0 ? '' : ` · ${said.join(' · ')}`;
8128
+ };
8092
8129
  for (const task of tasks)
8093
- write(task.archived === undefined ? ` ${task.id.padEnd(width)} ${task.status.label.padEnd(16)} ${task.title}`
8130
+ write(task.archived === undefined ? ` ${task.id.padEnd(width)} ${task.status.label.padEnd(16)} ${task.title}${marks(task)}`
8094
8131
  : ` ${task.id.padEnd(width)} ${'Archived'.padEnd(16)} ${task.title} — by ${task.archived.byKind === 'tidy' ? 'tidy' : task.archived.by}: ${task.archived.reason}`);
8095
8132
  if (page.nextCursor !== null)
8096
8133
  write(`Next page: --cursor ${page.nextCursor}`);
@@ -8138,6 +8175,7 @@ function showTask(positional, context) {
8138
8175
  const primaryAction = listed === null ? work?.primaryAction ?? null : listed.primaryAction;
8139
8176
  const steeringLive = store.steeringLiveBuild(ref.id, now) !== null;
8140
8177
  const base = taskBaseOf(store, id);
8178
+ const landedNow = current === null ? null : landedNowOf(store, current)?.words ?? null;
8141
8179
  const detail = {
8142
8180
  task,
8143
8181
  work: work === null || listed === null ? work : { ...work, status: { ...work.status, label: listed.status.label, detail: listed.status.detail, tone: listed.status.tone }, primaryAction },
@@ -8154,6 +8192,7 @@ function showTask(positional, context) {
8154
8192
  personApproval: personApprovalOf(store, id),
8155
8193
  route: taskRouteView(routed, readiness),
8156
8194
  base,
8195
+ landing: landedNow,
8157
8196
  runs: runs.map(one => ({ ...one, route: store.runRoute(one.id) })),
8158
8197
  deliverable: ref.deliverable,
8159
8198
  report: readVerifiedReport(store, context.evidenceRoot, ref.id),
@@ -8178,6 +8217,7 @@ function showTask(positional, context) {
8178
8217
  return succeed(write, json, "task show", detail, () => [
8179
8218
  `${task.id} ${shared?.headline ?? detail.work?.status.label ?? task.state}${ref.deliverable === "report" ? " (scout — delivers a report)" : ""}`,
8180
8219
  ` ${task.title}`,
8220
+ ...(landedNow === null ? [] : [` landing: ${landedNow}`]),
8181
8221
  ...(detail.work === null ? [] : [
8182
8222
  ` status: ${shared?.headline ?? detail.work.status.label}${shared === null ? "" : `${shared.headline === "On hold" ? " · " : " — "}${shared.sentence}`}`,
8183
8223
  ...(primaryAction === null || (checkedByPerson && (primaryAction.code === "open-result" || primaryAction.code === "inspect-run")) ? []
@@ -8185,12 +8225,17 @@ function showTask(positional, context) {
8185
8225
  ]),
8186
8226
  ...(task.state !== "done" || detail.proofVerdict === null
8187
8227
  ? []
8188
- : [
8189
- ` checked: ${proofVerdictWords(current?.receipt?.runId === latestFinished?.id ? current?.readiness?.verdict ?? detail.proofVerdict : detail.proofVerdict, detail.proofReasons).word}${detail.proofAccepted ? " (accepted)" : ""}`,
8190
- ...(shownReasons.length > 0 ? [` ${shownReasons.map(plainReasonWords).join(" ")}`] : []),
8228
+ : shared?.headline === "Complete" && current?.completion?.person !== undefined ? [
8229
+ ` checked: ${acceptedWords(current?.completion ?? null)}`,
8191
8230
  ...matrixWords(shownMatrix),
8192
8231
  ...(detail.semanticCoverage === null ? [] : coverageWords(detail.semanticCoverage).map(line => ` ${line}`)),
8193
- ]),
8232
+ ]
8233
+ : [
8234
+ ` checked: ${proofVerdictWords(current?.receipt?.runId === latestFinished?.id ? current?.readiness?.verdict ?? detail.proofVerdict : detail.proofVerdict, detail.proofReasons).word}${detail.proofAccepted ? " (accepted)" : ""}`,
8235
+ ...(shownReasons.length > 0 ? [` ${shownReasons.map(plainReasonWords).join(" ")}`] : []),
8236
+ ...matrixWords(shownMatrix),
8237
+ ...(detail.semanticCoverage === null ? [] : coverageWords(detail.semanticCoverage).map(line => ` ${line}`)),
8238
+ ]),
8194
8239
  ...(detail.report === null
8195
8240
  ? []
8196
8241
  : detail.report.ok
@@ -8201,7 +8246,7 @@ function showTask(positional, context) {
8201
8246
  ]
8202
8247
  : [` report: ${detail.report.problem} (build #${detail.report.run})`]),
8203
8248
  ...pullRequestLines(detail.pullRequest),
8204
- ...(base === null ? [] : [` base: ${baseStandingWords(base)}`]),
8249
+ ...(base === null ? [] : [` base: ${baseStandingWords(base, landedNow !== null)}`]),
8205
8250
  ...(detail.blockedBy.length > 0 ? [` waits for ${detail.blockedBy.join(", ")}`] : []),
8206
8251
  ...(detail.position === null
8207
8252
  ? []
@@ -12076,8 +12121,10 @@ async function newTaskCommand(positional, flags, context) {
12076
12121
  return importTaskCommand(fromLink, flags, context, name);
12077
12122
  const words = positional.join(" ").trim();
12078
12123
  const repo = text(flags, "repo");
12079
- if (words === "" || repo === undefined)
12080
- return fail(write, json, command, "usage", "`toolroll task new \"<what should change>\" --repo <project>`", EXIT.usage);
12124
+ if (words === "")
12125
+ return fail(write, json, command, "usage", `Say what should change: \`toolroll task new "<what should change>" --repo ${repo ?? "<project>"}\``, EXIT.usage);
12126
+ if (repo === undefined)
12127
+ return fail(write, json, command, "usage", "Name the project it's for with --repo (its folder, or `--repo .` for the one you're in): `toolroll task new \"<what should change>\" --repo <project>`", EXIT.usage);
12081
12128
  const placed = canonicalProject(repo) ?? resolve(repo);
12082
12129
  if (local === null && (flags.has("token") || (!facts.passwordless && !passwordFreeOwner(store)))) {
12083
12130
  let given = flags.has("token") ? token : undefined;
@@ -13086,10 +13133,7 @@ async function flexibleSignInConfig(action, extra, repoGiven, flags, context) {
13086
13133
  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.`]);
13087
13134
  }
13088
13135
  function passwordFreeRefusal(store, flags, key, remote) {
13089
- if (remote || ["as", "token", "token-file", "token-env"].some(name => flags.has(name)) || localOwnerRequested() || envValue(process.env, "LEAD_TOKEN") !== undefined)
13090
- return null;
13091
- const binding = localOwnerBinding(store);
13092
- if (binding === null || store.accountOf(binding.account)?.passwordSet === true)
13136
+ if (!passwordFreeInstall(store, flags, remote))
13093
13137
  return null;
13094
13138
  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.`;
13095
13139
  }
@@ -13223,13 +13267,16 @@ async function threadCommand(positional, flags, context) {
13223
13267
  if (done.stopPending)
13224
13268
  await stopFlexibleThreadsEverywhere(store, { reason: "its owner ended the thread", thread, clock });
13225
13269
  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)}\`)`;
13226
- return succeed(write, json, command, { thread, already: done.already }, () => [done.already ? "This thread had already ended." : `Ended. You can still ${keeps} for a week; then its copy is tidied.`]);
13270
+ const left = done.already ? 0 : (await flexibleUncommittedFiles(store, { thread })).length;
13271
+ 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.`;
13272
+ 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.`]);
13227
13273
  }
13228
13274
  if (verb === "save") {
13229
13275
  const saved = await saveFlexibleBranch(store, { thread, by: { name: who.name, generation: account.generation }, now: clock(), prove: proveNow });
13230
13276
  if (!saved.ok)
13231
13277
  return fail(write, json, command, saved.reason, saved.message, EXIT.refused);
13232
- return succeed(write, json, command, { thread, branch: saved.branch, commit: saved.candidate, already: saved.already, files: saved.changedPaths, next: saved.next }, () => [saved.already ? `Already saved as ${saved.branch} (commit ${saved.candidate.slice(0, 12)}).` : `Saved as ${saved.branch} (commit ${saved.candidate.slice(0, 12)}, ${saved.changedPaths.length} file${saved.changedPaths.length === 1 ? "" : "s"}).`, saved.next]);
13278
+ return succeed(write, json, command, { thread, branch: saved.branch, commit: saved.candidate, already: saved.already, files: saved.changedPaths, next: saved.next,
13279
+ leftover: saved.leftover, uncommitted: saved.uncommitted }, () => [flexibleSavedWords(saved), saved.next]);
13233
13280
  }
13234
13281
  const removed = await removeFlexibleThreadCopy(store, { thread, by: who.name, now: clock(), prove: proveNow });
13235
13282
  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);
@@ -13443,7 +13490,7 @@ async function landTaskCommand(positional, flags, context) {
13443
13490
  if (!read.ok)
13444
13491
  return fail(write, json, command, read.reason, read.message, EXIT.refused);
13445
13492
  if (!("plan" in read))
13446
- return succeed(write, json, command, { landed: read.landed }, () => [`${id} · Landed on ${read.landed.ref.replace(/^refs\/heads\//, "")} (${read.landed.commit.slice(0, 7)}).`]);
13493
+ return succeed(write, json, command, { landed: read.landed }, () => [`${id} · ${landedLine(read.landed)}`]);
13447
13494
  const plan = read.plan;
13448
13495
  if (local === null && passwordFreeOwner(store))
13449
13496
  return succeed(write, json, command, { plan }, () => [...landingWords(plan), LAND_NEEDS_PASSWORD]);
@@ -13507,3 +13554,13 @@ function verifyRepoOf(store, raw) {
13507
13554
  return absolute;
13508
13555
  }
13509
13556
  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`).";
13557
+ function passwordFreeInstall(store, flags, remote) {
13558
+ if (remote || ["as", "token", "token-file", "token-env"].some(name => flags.has(name)) || localOwnerRequested() || envValue(process.env, "LEAD_TOKEN") !== undefined)
13559
+ return false;
13560
+ const binding = localOwnerBinding(store);
13561
+ return binding !== null && store.accountOf(binding.account)?.passwordSet !== true;
13562
+ }
13563
+ function acceptedWords(completion) {
13564
+ const by = completedByOf(completion);
13565
+ return by === null ? "accepted" : `accepted by ${by}`;
13566
+ }
@@ -0,0 +1,14 @@
1
+ import { noBrowserReason } from "./browser-open.js";
2
+ import { installedGitFloorProblem } from "./git-floor.js";
3
+ import { processIdentityProblem } from "./process-identity.js";
4
+ export function startPrerequisites(deps = {}) {
5
+ const blockers = [];
6
+ const git = (deps.gitFloorProblem ?? installedGitFloorProblem)();
7
+ if (git !== null)
8
+ blockers.push([git]);
9
+ const identity = (deps.processIdentityProblem ?? processIdentityProblem)();
10
+ if (identity !== null)
11
+ blockers.push([`${identity}.`]);
12
+ const browser = (deps.noBrowser ?? (() => noBrowserReason()))();
13
+ return { blockers, advisories: browser === null ? [] : [`No browser opens here (${browser}): the terminal workbench doesn't need one, and Toolroll prints its address.`] };
14
+ }