toolroll 0.9.126 → 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.
- package/CHANGELOG.md +28 -0
- package/dist/assignment.js +14 -4
- package/dist/browser/workspace.js +1 -1
- package/dist/contracts/engine-api.js +3 -0
- 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/operate.js +76 -16
- 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/task-views.js +4 -1
- package/dist/skill-library.js +2 -12
- 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,98 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { recordActionWhole } from "./action-ledger.js";
|
|
6
|
+
export const CATCH_UP_ACTION = "revision brought up to date";
|
|
7
|
+
const OID = /^[0-9a-f]{40}$/;
|
|
8
|
+
const IDENTITY = "Toolroll <update@toolroll.invalid>";
|
|
9
|
+
const PLAIN_BRANCH = /^[A-Za-z0-9._/-]{1,100}$/;
|
|
10
|
+
function mergeBody(tree, head, main, time, message) {
|
|
11
|
+
const who = `${IDENTITY} ${time} +0000`;
|
|
12
|
+
return `tree ${tree}\nparent ${head}\nparent ${main}\nauthor ${who}\ncommitter ${who}\n\n${message}\n`;
|
|
13
|
+
}
|
|
14
|
+
const commitIdOf = (body) => createHash("sha1").update(`commit ${Buffer.byteLength(body, "utf8")}\0`).update(body, "utf8").digest("hex");
|
|
15
|
+
export async function catchUpRevision(git, repo, head, branch, taskId, now, scratch) {
|
|
16
|
+
const run = (args) => git("git", ["--no-replace-objects", ...args], { cwd: repo, timeoutMs: 120_000 });
|
|
17
|
+
if (!OID.test(head) || !PLAIN_BRANCH.test(branch))
|
|
18
|
+
return { kind: "unavailable" };
|
|
19
|
+
const read = await run(["rev-parse", "--verify", "-q", `refs/heads/${branch}^{commit}`]);
|
|
20
|
+
const main = read.stdout.trim();
|
|
21
|
+
if (read.code !== 0 || !OID.test(main))
|
|
22
|
+
return { kind: "unavailable" };
|
|
23
|
+
const contained = await run(["merge-base", "--is-ancestor", main, head]);
|
|
24
|
+
if (contained.code === 0)
|
|
25
|
+
return { kind: "current", main };
|
|
26
|
+
if (contained.code !== 1)
|
|
27
|
+
return { kind: "unavailable" };
|
|
28
|
+
const merged = await run(["merge-tree", "--write-tree", "--name-only", "--no-messages", "-z", head, main]);
|
|
29
|
+
const [tree = "", ...names] = merged.stdout.split("\0");
|
|
30
|
+
if (merged.code === 1)
|
|
31
|
+
return { kind: "conflict", main, files: [...new Set(names.filter(one => one !== ""))].slice(0, 20) };
|
|
32
|
+
if (merged.code !== 0 || !OID.test(tree))
|
|
33
|
+
return { kind: "unavailable" };
|
|
34
|
+
const message = `Bring ${taskId} up to date with ${branch} (${main.slice(0, 8)})`;
|
|
35
|
+
const body = mergeBody(tree, head, main, Math.floor(now.getTime() / 1000), message);
|
|
36
|
+
const folder = mkdtempSync(join(scratch ?? tmpdir(), "toolroll-catch-up-"));
|
|
37
|
+
let written;
|
|
38
|
+
try {
|
|
39
|
+
const file = join(folder, "commit");
|
|
40
|
+
writeFileSync(file, body, { encoding: "utf8", mode: 0o600, flag: "wx" });
|
|
41
|
+
written = await run(["hash-object", "-t", "commit", "-w", "--", file]);
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
rmSync(folder, { recursive: true, force: true });
|
|
45
|
+
}
|
|
46
|
+
const commit = written.stdout.trim();
|
|
47
|
+
if (written.code !== 0 || commit !== commitIdOf(body))
|
|
48
|
+
return { kind: "unavailable" };
|
|
49
|
+
const shown = await run(["cat-file", "commit", commit]);
|
|
50
|
+
const header = shown.stdout.split("\n\n")[0] ?? "";
|
|
51
|
+
const parents = header.split("\n").filter(line => line.startsWith("parent ")).map(line => line.slice("parent ".length));
|
|
52
|
+
if (shown.code !== 0 || !header.startsWith(`tree ${tree}\n`) || parents.length !== 2 || parents[0] !== head || parents[1] !== main)
|
|
53
|
+
return { kind: "unavailable" };
|
|
54
|
+
return { kind: "merged", commit, main };
|
|
55
|
+
}
|
|
56
|
+
export async function catchUpMergeOf(git, repo, commit, head, branch) {
|
|
57
|
+
const run = (args) => git("git", ["--no-replace-objects", ...args], { cwd: repo, timeoutMs: 120_000 });
|
|
58
|
+
if (!OID.test(commit) || !OID.test(head) || !PLAIN_BRANCH.test(branch))
|
|
59
|
+
return null;
|
|
60
|
+
const shown = await run(["cat-file", "commit", commit]);
|
|
61
|
+
if (shown.code !== 0)
|
|
62
|
+
return null;
|
|
63
|
+
const header = (shown.stdout.split("\n\n")[0] ?? "").split("\n");
|
|
64
|
+
const parents = header.filter(line => line.startsWith("parent ")).map(line => line.slice("parent ".length));
|
|
65
|
+
const who = (field) => header.filter(line => line.startsWith(`${field} `)).map(line => line.slice(field.length + 1).replace(/ \d+ [+-]\d{4}$/, ""));
|
|
66
|
+
if (parents.length !== 2 || parents[0] !== head || !OID.test(parents[1]))
|
|
67
|
+
return null;
|
|
68
|
+
if (who("author").join() !== IDENTITY || who("committer").join() !== IDENTITY)
|
|
69
|
+
return null;
|
|
70
|
+
const onBranch = await run(["merge-base", "--is-ancestor", parents[1], `refs/heads/${branch}`]);
|
|
71
|
+
return onBranch.code === 0 ? parents[1] : null;
|
|
72
|
+
}
|
|
73
|
+
export function recordCatchUp(store, at, caught, now) {
|
|
74
|
+
if (caught.kind !== "merged" && caught.kind !== "conflict")
|
|
75
|
+
return;
|
|
76
|
+
recordActionWhole(store.handle, { at: now.toISOString(), actor: "toolroll", repo: at.repo, taskId: at.taskId, runId: at.runId, action: CATCH_UP_ACTION, outcome: caught.kind, source: "work" }, { v: 1, branch: at.branch, head: at.head, onto: at.onto, main: caught.main, ...(caught.kind === "merged" ? { commit: caught.commit } : { files: caught.files }) });
|
|
77
|
+
store.addRunNote(at.runId, "Toolroll", caught.kind === "merged"
|
|
78
|
+
? `Started from the earlier attempt's work with the current ${at.onto} (${caught.main.slice(0, 8)}) merged in, so its checks run on both together.`
|
|
79
|
+
: `The current ${at.onto} (${caught.main.slice(0, 8)}) conflicts with the earlier attempt's work${caught.files.length === 0 ? "" : ` in ${caught.files.length === 1 ? "1 file" : `${caught.files.length} files`}`}, so this attempt starts from that work as it was.`, now);
|
|
80
|
+
}
|
|
81
|
+
export function catchUpConflictOf(store, taskId, main) {
|
|
82
|
+
const chain = store.revisionAncestryStatus(taskId).chain;
|
|
83
|
+
if (chain.length === 0 || !OID.test(main))
|
|
84
|
+
return null;
|
|
85
|
+
const row = store.handle.prepare(`SELECT outcome, detail FROM action_ledger WHERE action = ? AND task_id IN (${chain.map(() => "?").join(",")}) ORDER BY id DESC LIMIT 1`)
|
|
86
|
+
.get(CATCH_UP_ACTION, ...chain);
|
|
87
|
+
if (row === undefined || row["outcome"] !== "conflict")
|
|
88
|
+
return null;
|
|
89
|
+
try {
|
|
90
|
+
const detail = JSON.parse(String(row["detail"] ?? "null"));
|
|
91
|
+
if (detail === null || detail.main !== main)
|
|
92
|
+
return null;
|
|
93
|
+
return Array.isArray(detail.files) ? detail.files.filter((one) => typeof one === "string") : [];
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -10,7 +10,7 @@ import { flexibleAvailable } from "../flexible-available.js";
|
|
|
10
10
|
import { laptopShipProblem } from "../flexible-laptop.js";
|
|
11
11
|
import { threadsStatusNote, tidyFlexibleSignIns } from "../flexible-sign-in.js";
|
|
12
12
|
import { FLEXIBLE_UNAVAILABLE } from "../flexible.js";
|
|
13
|
-
import { saveFlexibleBranch } from "../flexible-save.js";
|
|
13
|
+
import { flexibleSavedWords, flexibleUncommittedFiles, saveFlexibleBranch } from "../flexible-save.js";
|
|
14
14
|
import { admitFlexibleThreadOwner, answerFlexibleRequest, cancelFlexibleThreadShip, closeFlexibleSessions, closeFlexibleThread, continueFlexibleThread, flexibleShipNeedsFor, flexibleThreadShipTerms, latestFlexibleShip, sendBackFlexibleThread, shipFlexibleThread, tidyEndedFlexibleThreads, flexibleThreadChangeOf, flexibleThreadEdited, flexibleThreadLiveOf, flexibleThreadsOf, FLEXIBLE_WAIT_MS, flexibleThreadsExist, flexibleWorkOpen, openFlexibleSessions, recoverFlexibleHolders, startFlexibleThread, settleFlexibleStops, tickFlexibleSessions, waitFlexibleThreadChange, flexibleThreadChanges, flexibleThreadTipOf } from "../flexible-session.js";
|
|
15
15
|
import { createFlexibleLauncher } from "../flexible-launcher.js";
|
|
16
16
|
import { FLEXIBLE_NEXT_WORDS, flexibleReadiness, flexibleStartCard } from "../flexible-start.js";
|
|
@@ -22,7 +22,7 @@ import { defaultChainOf, installModeNow } from "../install-mode.js";
|
|
|
22
22
|
import { packageVersion } from "../monitoring.js";
|
|
23
23
|
import { readChildWindow } from "../live-children-read.js";
|
|
24
24
|
import { readMainWindow } from "../live-main-read.js";
|
|
25
|
-
import { runLiveCommands } from "../store.js";
|
|
25
|
+
import { runLiveCommands, typedNotesFor } from "../store.js";
|
|
26
26
|
import { agentsReadOf, resultDiffContextOf, resultDiffFileOf, resultDiffOf, resultRunsOf, stepCardsOf, taskResultOf, threadDiffFileOf, threadDiffOf } from "../engine-reads.js";
|
|
27
27
|
import { leadChatOf } from "../engine-chat.js";
|
|
28
28
|
import { remoteAllows } from "../operate-remote.js";
|
|
@@ -370,6 +370,8 @@ export function createEngineHandlers(runtime) {
|
|
|
370
370
|
const taskId = family.current.id;
|
|
371
371
|
const none = (problem) => sendChecked(response, 200, "approvalCard", { version: ENGINE_API_VERSION, task: taskId, key: null, digest: null, nonce: null, terms: [], problem });
|
|
372
372
|
const waits = (view) => view.nonce !== "" && view.approvalDigest != null && view.approvalSummary != null;
|
|
373
|
+
const sentBackTyped = (view) => view.revision == null || "problem" in view.revision ? []
|
|
374
|
+
: typedNotesFor(runtime.store, taskId, 100).filter(one => one.kind === "sent-back");
|
|
373
375
|
const view = runtime.taskViewData(taskId, who, null, { mintNonce: false });
|
|
374
376
|
if (view === null)
|
|
375
377
|
return refusal(response, 404, "task");
|
|
@@ -391,12 +393,12 @@ export function createEngineHandlers(runtime) {
|
|
|
391
393
|
key: view.approvalSummary.key,
|
|
392
394
|
digest: view.approvalDigest,
|
|
393
395
|
nonce: runtime.heldApprovalNonce(who.name, taskId, view.approvalDigest),
|
|
394
|
-
terms: approvalTermsOf(view.approvalSummary, view.planContract ?? null, view.revision ?? null),
|
|
396
|
+
terms: approvalTermsOf(view.approvalSummary, view.planContract ?? null, view.revision ?? null, sentBackTyped(view)),
|
|
395
397
|
problem,
|
|
396
398
|
});
|
|
397
399
|
}
|
|
398
400
|
return sendChecked(response, 200, "approvalCard", { version: ENGINE_API_VERSION, task: taskId, key: view.approvalSummary.key, digest: view.approvalDigest,
|
|
399
|
-
nonce: runtime.heldApprovalNonce(who.name, taskId, view.approvalDigest), terms: approvalTermsOf(view.approvalSummary, view.planContract ?? null, view.revision ?? null), problem: null });
|
|
401
|
+
nonce: runtime.heldApprovalNonce(who.name, taskId, view.approvalDigest), terms: approvalTermsOf(view.approvalSummary, view.planContract ?? null, view.revision ?? null, sentBackTyped(view)), problem: null });
|
|
400
402
|
}
|
|
401
403
|
async function taskDiff(ctx) {
|
|
402
404
|
const { url, request, response, who } = ctx;
|
|
@@ -576,9 +578,11 @@ export function createEngineHandlers(runtime) {
|
|
|
576
578
|
const done = await closeFlexibleThread(store, flexible, { thread: id, by: { name: who.name, generation: who.session.generation }, act });
|
|
577
579
|
if (!done.ok)
|
|
578
580
|
return acted(response, 409, "refused", done.message);
|
|
581
|
+
const left = act === "end" && !done.already && !done.stopPending ? (await flexibleUncommittedFiles(store, { thread: id })).length : 0;
|
|
579
582
|
const words = act === "end"
|
|
580
583
|
? done.already ? "This thread had already ended." : done.stopPending ? "Ended. Stopping its agent…"
|
|
581
|
-
:
|
|
584
|
+
: left > 0 ? `Ended. Its agent left uncommitted edits in ${left} file${left === 1 ? "" : "s"}: save its work as a branch (S on the thread) to keep them.`
|
|
585
|
+
: flexibleShipNeedsFor(store, id) === null ? "Ended. You can still ship its work, or save it as a branch." : "Ended. You can still save its work as a branch (S on the thread)."
|
|
582
586
|
: done.stopPending ? "Stopping its agent…" : "Stopped. Reply to go on.";
|
|
583
587
|
return acted(response, 200, "done", words);
|
|
584
588
|
};
|
|
@@ -678,7 +682,7 @@ export function createEngineHandlers(runtime) {
|
|
|
678
682
|
const saved = await saveFlexibleBranch(store, { thread: id, by: { name: who.name, generation: who.session.generation }, now: new Date(), prove: held });
|
|
679
683
|
if (!saved.ok)
|
|
680
684
|
return acted(response, 409, "refused", saved.message);
|
|
681
|
-
return acted(response, 200, "done", `${
|
|
685
|
+
return acted(response, 200, "done", `${flexibleSavedWords(saved)} ${saved.next}`, undefined, saved.command);
|
|
682
686
|
}
|
|
683
687
|
async function leadChat(ctx) {
|
|
684
688
|
const { url, who, request, response, now } = ctx;
|
|
@@ -844,7 +848,7 @@ function bodyOf(request, cap) {
|
|
|
844
848
|
}
|
|
845
849
|
export const NOTHING_TO_APPROVE = "Nothing on this task is waiting for your approval.";
|
|
846
850
|
export const APPROVE_IN_BROWSER = "Press w to open it in your browser.";
|
|
847
|
-
export function approvalTermsOf(summary, contract, revision) {
|
|
851
|
+
export function approvalTermsOf(summary, contract, revision, typed = []) {
|
|
848
852
|
const terms = termsOfLines(summaryLines(summary));
|
|
849
853
|
if (contract !== null && "problem" in contract)
|
|
850
854
|
terms.push({ label: "Plan record", words: contract.problem });
|
|
@@ -856,7 +860,8 @@ export function approvalTermsOf(summary, contract, revision) {
|
|
|
856
860
|
if (revision !== null && "problem" in revision)
|
|
857
861
|
terms.push({ label: "Sent back", words: revision.problem });
|
|
858
862
|
else if (revision !== null && revision.comments.length > 0) {
|
|
859
|
-
|
|
863
|
+
const said = (one) => typed.find(words => one.id != null && words.id === one.id && words.author === one.author && words.note !== "" && one.note.includes(words.note))?.note ?? one.note;
|
|
864
|
+
terms.push({ label: "Sent back", words: revision.comments.map(one => `${one.path === null ? "" : `${one.path}${one.line === null ? "" : `:${one.line}`} — `}${said(one)} (${one.author})`).join("\n") });
|
|
860
865
|
}
|
|
861
866
|
return terms;
|
|
862
867
|
}
|
package/dist/server/pages.js
CHANGED
|
@@ -81,6 +81,7 @@ import { workIndexPage } from "../work-index.js";
|
|
|
81
81
|
import { checkEngineResponse, ENGINE_API_VERSION } from "../contracts/engine-api.js";
|
|
82
82
|
import { readRunLive } from "./engine-api.js";
|
|
83
83
|
import { waitingForTasks } from "../engine-reads.js";
|
|
84
|
+
import { landedRowsOf } from "../landed-rows.js";
|
|
84
85
|
import { FOUND_PLACES_MAX, FOUND_REPOS_MAX, foundReposCache } from "./found-repos.js";
|
|
85
86
|
const PICKER_PLACES = ["Developer", "Documents", "code", "Projects"];
|
|
86
87
|
export function createPagesHandlers(runtime, work) {
|
|
@@ -1267,7 +1268,7 @@ export function createPagesHandlers(runtime, work) {
|
|
|
1267
1268
|
setup: firstRunStepsNow(now) !== null ? "/welcome" : null,
|
|
1268
1269
|
empty: needs.any || needs.total > 0 ? null : { title: "No tasks yet", text: "Describe a change in a sentence; an agent writes a plan for you to approve." },
|
|
1269
1270
|
};
|
|
1270
|
-
return { view, needs, listed, chrome };
|
|
1271
|
+
return { view, needs, listed, chrome, work: found.work };
|
|
1271
1272
|
}
|
|
1272
1273
|
async function workRows(ctx) {
|
|
1273
1274
|
const { request, response, who, now } = ctx;
|
|
@@ -1305,10 +1306,12 @@ export function createPagesHandlers(runtime, work) {
|
|
|
1305
1306
|
const needOf = (row) => ({ id: row.id, title: row.title, href: row.href, project: row.project, age: row.age, state: row.state, ask: row.ask,
|
|
1306
1307
|
...(row.group === undefined ? {} : { group: row.group }), reason: row.reason, line: row.line, action: row.action, question: row.question });
|
|
1307
1308
|
const waiting = waitingForTasks(store, list.rows.map(row => row.id), now);
|
|
1309
|
+
const landed = landedRowsOf(store, built.work.items);
|
|
1308
1310
|
const body = {
|
|
1309
1311
|
version: ENGINE_API_VERSION, project: view.project, projectName: view.projectName, needsCount: view.needsCount, groups: list.groups,
|
|
1310
1312
|
rows: list.rows.map(row => ({ id: row.id, title: row.title, href: row.href, project: row.project, age: row.age, status: row.status, word: row.word, ask: row.ask,
|
|
1311
|
-
chip: row.chip, group: row.group, rank: row.rank, ...(row.check === undefined ? {} : { check: row.check }),
|
|
1313
|
+
chip: row.chip, group: row.group, rank: row.rank, ...(row.check === undefined ? {} : { check: row.check }),
|
|
1314
|
+
...(landed.has(row.id) ? { landed: landed.get(row.id) } : {}), detail: row.detail, problem: row.problem, need: row.need === undefined ? null : needOf(row.need),
|
|
1312
1315
|
waiting: waiting.get(row.id) ?? null })),
|
|
1313
1316
|
needs: view.needs.map(group => ({ key: group.key, label: group.label, count: group.count, rows: group.rows.map(needOf) })),
|
|
1314
1317
|
next: list.pages.next, room: "workspace", spend, limits,
|
|
@@ -583,7 +583,9 @@ export function reviewCockpitDetailParts(view, csrf, noted, canRetryReview, tab,
|
|
|
583
583
|
const shared = accepted || assignment?.receipt == null ? null : owedAcceptance(assignment.receipt, assignment.readiness?.blockers ?? []);
|
|
584
584
|
const owed = accepted ? null : youCheck?.accept != null || shared === "person-check" ? { note: null }
|
|
585
585
|
: shared === "exception" || blocked === ACCEPT_NEEDS_REASON ? { note: "Why is this safe to accept?" } : null;
|
|
586
|
-
const
|
|
586
|
+
const confirm = assignment?.state === "complete" && assignment.completion !== null && assignment.completion.person === undefined && assignment.completion.historical !== true
|
|
587
|
+
&& assignment.completion.landed === undefined && assignment.receipt !== null && assignment.completion.digest === assignment.receipt.digest && youCheck != null;
|
|
588
|
+
const complete = hardStop === null && (assignment?.state === "ready-to-check" || confirm) && assignment?.receipt != null && canRetryReview && csrf !== ""
|
|
587
589
|
? { action: `${taskHref(view.taskId)}/complete`, receipt: assignment.receipt.digest, run: run.id, accept: owed, ...(host.kind === "task" ? { returnTo: at() } : {}) } : null;
|
|
588
590
|
if (complete !== null)
|
|
589
591
|
parts.push(completionForm(view.taskId, run.id, complete.receipt, view.detail?.pullRequestTo ?? null, owed));
|
|
@@ -1378,7 +1380,7 @@ export function resultPanelParts(detail, o) {
|
|
|
1378
1380
|
}
|
|
1379
1381
|
if (detail.ciFailing && publication !== null && taskStatus === null)
|
|
1380
1382
|
attention.push(`CI is failing on PR #${publication.prNumber} at the last check.`);
|
|
1381
|
-
const personChecks = proof === null || proof.accepted !== null || detail.landed === true ? [] : [
|
|
1383
|
+
const personChecks = proof === null || proof.accepted !== null || detail.landed === true || (detail.assignment?.state === "complete" && detail.assignment.completion?.person !== undefined) ? [] : [
|
|
1382
1384
|
...proof.matrix.filter(row => row.state === "manual-review").map(row => personCheckWords(row.statement)),
|
|
1383
1385
|
...(proof.matrix.length > 0 ? [] : proof.reasons.filter(reason => manualReviewCriterionOf(reason) !== null).map(() => personCheckWords(null))),
|
|
1384
1386
|
];
|
|
@@ -223,6 +223,7 @@ export function createTaskViews(runtime) {
|
|
|
223
223
|
kind: parsed.kind === "ci-repair" ? "ci-repair" : parsed.kind === "criterion-repair" ? "criterion-repair" : "annotations",
|
|
224
224
|
lineage: runtime.store.revisionLineageOf(ref.externalId, runtime.clock()),
|
|
225
225
|
comments: (parsed.comments ?? []).slice(0, 100).map(one => ({
|
|
226
|
+
id: typeof one.id === "number" && Number.isSafeInteger(one.id) ? one.id : null,
|
|
226
227
|
path: one.path === null || one.path === undefined ? null : String(one.path),
|
|
227
228
|
line: one.line === null || one.line === undefined ? null : Number(one.line),
|
|
228
229
|
note: String(one.note ?? ""),
|
|
@@ -714,10 +715,12 @@ export function createTaskViews(runtime) {
|
|
|
714
715
|
const status = view.status === null ? null : { ...view.status, action: view.status.action === null ? null : link(view.status.action),
|
|
715
716
|
status: { ...view.status.status, details: view.status.status.details.map(one => ({ ...one, href: one.href === null ? null : toTab(one.href), action: one.action === null ? null : link(one.action) })) } };
|
|
716
717
|
const selected = extras.result?.selected ?? null;
|
|
718
|
+
const builds = runs.filter(run => run.role === "builder" || run.role === "scout" || run.role === "repair").map(run => run.id).sort((a, b) => a - b);
|
|
717
719
|
const attempts = [...results.entries()].sort((a, b) => b[0] - a[0]).map(([id, taskId]) => {
|
|
718
720
|
const run = runs.find(one => one.id === id);
|
|
719
721
|
const outcome = run.outcome === "built" ? "result" : run.outcome === "no-change" ? "no change" : run.outcome === null ? "never finished" : run.outcome;
|
|
720
|
-
|
|
722
|
+
const at = builds.indexOf(id);
|
|
723
|
+
return { label: `${at < 0 ? `Build #${id}` : `Attempt ${at + 1}`} · ${outcome}`, href: tabHref(taskId, id, null, ""), current: selected?.build === id };
|
|
721
724
|
});
|
|
722
725
|
return {
|
|
723
726
|
...view,
|
package/dist/skill-library.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
+
import { unreachableWhy } from "./unreachable.js";
|
|
2
3
|
import { scanForSecrets } from "./evidence.js";
|
|
3
4
|
import { learningSha } from "./project-learning.js";
|
|
4
5
|
import { PROJECT_SKILLS_GUIDANCE, PROJECT_SKILLS_READ, validateSkill, } from "./project-skills.js";
|
|
@@ -310,17 +311,6 @@ export function parseGithubBundleUrl(rawUrl) {
|
|
|
310
311
|
: `https://github.com/${owner}/${repoName}`;
|
|
311
312
|
return { id, repoUrl, owner: owner, repoName: repoName, ref: ref ?? null, subpath };
|
|
312
313
|
}
|
|
313
|
-
function unreachableWhy(error) {
|
|
314
|
-
const cause = error?.cause;
|
|
315
|
-
const code = typeof cause?.code === "string" ? cause.code : "";
|
|
316
|
-
if (error?.name === "TimeoutError")
|
|
317
|
-
return "it didn't answer within 20 seconds";
|
|
318
|
-
if (code === "ENOTFOUND" || code === "EAI_AGAIN")
|
|
319
|
-
return "its address couldn't be looked up (this computer may be offline)";
|
|
320
|
-
if (code === "ECONNREFUSED" || code === "ECONNRESET" || code === "EPERM" || code === "EACCES")
|
|
321
|
-
return "the connection was refused or blocked";
|
|
322
|
-
return "the connection failed (this computer may be offline, or a firewall blocks it)";
|
|
323
|
-
}
|
|
324
314
|
async function githubJson(owner, repoName, path, fetcher, budget) {
|
|
325
315
|
let response;
|
|
326
316
|
try {
|
|
@@ -331,7 +321,7 @@ async function githubJson(owner, repoName, path, fetcher, budget) {
|
|
|
331
321
|
});
|
|
332
322
|
}
|
|
333
323
|
catch (error) {
|
|
334
|
-
throw Error(`Couldn't reach GitHub: ${unreachableWhy(error)}.`);
|
|
324
|
+
throw Error(`Couldn't reach GitHub: ${unreachableWhy(error, 20)}.`);
|
|
335
325
|
}
|
|
336
326
|
if (!response.ok) {
|
|
337
327
|
throw Error(`GitHub returned ${response.status} for ${owner}/${repoName}${path.split("?")[0]}.`);
|
package/dist/task-base.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { taskBranches } from "./names.js";
|
|
1
2
|
import { viewedGitSync } from "./teardown-git.js";
|
|
2
3
|
export const readGit = (cwd, args) => {
|
|
3
4
|
try {
|
|
@@ -25,6 +26,16 @@ export function familyStartOf(store, taskRef) {
|
|
|
25
26
|
const root = ancestry.problem !== null || rootId === undefined || rootId === id ? null : store.lookupRef(rootId);
|
|
26
27
|
if (root === null || root.repo !== ref.repo)
|
|
27
28
|
return null;
|
|
29
|
+
for (const member of ancestry.chain.slice(0, -1)) {
|
|
30
|
+
const memberRef = store.lookupRef(member);
|
|
31
|
+
if (memberRef === null)
|
|
32
|
+
continue;
|
|
33
|
+
for (const branch of taskBranches(member)) {
|
|
34
|
+
const moved = store.latestBranchBaseMove(memberRef.id, branch);
|
|
35
|
+
if (moved !== null && store.firstBuilderBase(memberRef.id, branch) === moved.from)
|
|
36
|
+
return moved.to;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
28
39
|
const first = store.runsFor(root.id).filter(one => one.role === "builder" && one.branch !== null && one.baseRevision !== null).sort((a, b) => a.id - b.id)[0];
|
|
29
40
|
if (first === undefined || first.branch === null)
|
|
30
41
|
return null;
|
package/dist/task-status.js
CHANGED
|
@@ -240,9 +240,10 @@ function detailsOf(headline, facts) {
|
|
|
240
240
|
row("requirements", "Requirements", "Unverified", "none");
|
|
241
241
|
else if (req != null && req.total > 0) {
|
|
242
242
|
const atRelease = req.atRelease ?? 0;
|
|
243
|
-
const
|
|
244
|
-
const
|
|
245
|
-
|
|
243
|
+
const yours = headline === "Complete" && facts.personCompleted === true ? 0 : req.yours, met = req.met + req.yours - yours;
|
|
244
|
+
const unmet = req.total - met - yours - atRelease;
|
|
245
|
+
const text = `${met} of ${req.total} met${atRelease > 0 ? ` · ${atRelease} at release` : ""}${yours > 0 ? ` · You check ${yours}` : ""}`;
|
|
246
|
+
row("requirements", "Requirements", text, unmet > 0 ? problem(headline) : met === req.total ? "ok" : "none", unmet > 0 && headline !== "Failed" ? { action: { label: "See which", href: facts.links?.checks ?? facts.links?.result ?? null } } : {});
|
|
246
247
|
}
|
|
247
248
|
const evidence = facts.evidence;
|
|
248
249
|
if (evidence != null) {
|
|
@@ -456,6 +457,11 @@ export function checksFactOf(checks, head) {
|
|
|
456
457
|
export function receiptChecksOf(receipt) {
|
|
457
458
|
return approvedCheckOf(receipt.proof?.verdict ?? null, receipt.proof?.reasons ?? [], checksFactOf(receipt.checks, receipt.head));
|
|
458
459
|
}
|
|
460
|
+
export function completedByOf(completion) {
|
|
461
|
+
if (completion !== null && completion.person !== undefined)
|
|
462
|
+
return completion.person;
|
|
463
|
+
return completion === null || completion.landed !== undefined ? null : completion.lead === true ? "the lead" : completion.actor.replace(/^(?:operator|coordinator|lead):/, "");
|
|
464
|
+
}
|
|
459
465
|
export function assignmentStatusFacts(assignment, options = {}) {
|
|
460
466
|
const { stage, need, wait } = assignmentStageOf(assignment, options.work ?? null, options.planning ?? false);
|
|
461
467
|
const build = assignment.need?.build ?? null;
|
|
@@ -479,7 +485,8 @@ export function assignmentStatusFacts(assignment, options = {}) {
|
|
|
479
485
|
...(withResult && receipt?.proofAcceptance != null ? { accepted: true } : {}),
|
|
480
486
|
...(withResult && (assignment.readiness?.blockers.length ?? 0) > 0 ? { blockers: assignment.readiness.blockers } : {}),
|
|
481
487
|
evidence: withResult ? options.evidence ?? evidenceOf(receipt, [...(receipt?.caveats ?? []), ...assignment.attention]) : null,
|
|
482
|
-
completedBy: assignment.completion
|
|
488
|
+
completedBy: completedByOf(assignment.completion),
|
|
489
|
+
...(assignment.completion?.person !== undefined ? { personCompleted: true } : {}),
|
|
483
490
|
...(assignment.completion?.landed === undefined ? {} : { landed: assignment.completion.landed }),
|
|
484
491
|
action: options.action ?? null,
|
|
485
492
|
...(options.links === undefined ? {} : { links: options.links }),
|
package/dist/teardown-git.js
CHANGED
|
@@ -1075,6 +1075,12 @@ function plainBranch(name) {
|
|
|
1075
1075
|
export function syncWriteArgv(args) {
|
|
1076
1076
|
if (args.length === 3 && args[0] === "branch" && args[1] === "-D" && plainBranch(args[2]))
|
|
1077
1077
|
return ["branch", "-D", args[2]];
|
|
1078
|
+
if (args.length === 5 && args[0] === "update-ref" && args[1] === "--no-deref" && args[2].startsWith("refs/heads/") && plainBranch(args[2].slice("refs/heads/".length))) {
|
|
1079
|
+
const [ref, next, old] = [args[2], args[3], args[4]];
|
|
1080
|
+
if (!/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(next) || next.length !== old.length || !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(old) || next === old || /^0+$/.test(old) || /^0+$/.test(next))
|
|
1081
|
+
return null;
|
|
1082
|
+
return ["update-ref", "--no-deref", "-m", "toolroll: branch moved by compare-and-swap", ref, next, old];
|
|
1083
|
+
}
|
|
1078
1084
|
if (args.length !== 5 || args[0] !== "fetch" || args[1] !== "--no-tags" || args[2] !== "--no-write-fetch-head")
|
|
1079
1085
|
return null;
|
|
1080
1086
|
const path = args[3], refspec = args[4];
|
|
@@ -4,6 +4,7 @@ import { createRequire } from "node:module";
|
|
|
4
4
|
import { installMethod } from "./install-method.js";
|
|
5
5
|
import { isNewer, latestVersionNow } from "./releases.js";
|
|
6
6
|
import { databasePath } from "./store.js";
|
|
7
|
+
import { neverAnswered, unreachableWhy } from "./unreachable.js";
|
|
7
8
|
import { PACKAGE_VERSION } from "./version.js";
|
|
8
9
|
import { currentRuntime, lastCompletedUpdate, machineSystem, readRuntimeUpdate, requestRuntimeUpdateCancel, resumeRuntimeUpdate, retireUpdateJob, startRuntimeRollback, startRuntimeUpdate, } from "./toolroll-update.js";
|
|
9
10
|
function sqlite() {
|
|
@@ -121,7 +122,7 @@ export async function runUpdateCommand(args, write, deps = {}) {
|
|
|
121
122
|
version = (await (deps.latest ?? latestVersionNow)()).version;
|
|
122
123
|
}
|
|
123
124
|
catch (error) {
|
|
124
|
-
write(`Could not read the latest release: ${error.message}
|
|
125
|
+
write(neverAnswered(error) ? `Couldn't reach the release server: ${unreachableWhy(error, 10)}. Nothing was changed.` : `Could not read the latest release: ${error.message}. Nothing was changed.`);
|
|
125
126
|
return 1;
|
|
126
127
|
}
|
|
127
128
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function unreachableWhy(error, timeoutSeconds) {
|
|
2
|
+
const cause = error?.cause;
|
|
3
|
+
const code = typeof cause?.code === "string" ? cause.code : "";
|
|
4
|
+
if (error?.name === "TimeoutError")
|
|
5
|
+
return `it didn't answer within ${timeoutSeconds} seconds`;
|
|
6
|
+
if (code === "ENOTFOUND" || code === "EAI_AGAIN")
|
|
7
|
+
return "its address couldn't be looked up (this computer may be offline)";
|
|
8
|
+
if (code === "ECONNREFUSED" || code === "ECONNRESET" || code === "EPERM" || code === "EACCES")
|
|
9
|
+
return "the connection was refused or blocked";
|
|
10
|
+
return "the connection failed (this computer may be offline, or a firewall blocks it)";
|
|
11
|
+
}
|
|
12
|
+
export function neverAnswered(error) {
|
|
13
|
+
const name = error?.name;
|
|
14
|
+
return name === "TimeoutError" || (error instanceof TypeError && error.message === "fetch failed");
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolroll",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.127",
|
|
4
4
|
"description": "Your agents build. You decide. A control plane for coding agents — Claude Code, Codex, Gemini: approve the exact scope once, get results back Ready with the diff, the passing check and screenshots. Runs on your machine.",
|
|
5
5
|
"directories": {
|
|
6
6
|
"doc": "docs"
|