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,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
|
];
|
package/dist/server/settings.js
CHANGED
|
@@ -195,7 +195,13 @@ export function createSettingsHandlers(runtime) {
|
|
|
195
195
|
const items = spendItems(store.handle, current.from, current.to);
|
|
196
196
|
const saved = store.budgets();
|
|
197
197
|
const budgets = budgetStates(saved, items);
|
|
198
|
-
const
|
|
198
|
+
const canonicalRepoKey = (value) => { try {
|
|
199
|
+
return realpathSync(value);
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
return value;
|
|
203
|
+
} };
|
|
204
|
+
const has = (scope, key) => saved.some(one => one.scope === scope && (scope === "project" ? canonicalRepoKey(one.key) === canonicalRepoKey(key) : one.key === key));
|
|
199
205
|
const spentFor = (scope, key) => budgetStates([{ id: 0, scope, key, limitMicrousd: 1, hardStop: false, updatedBy: "", updatedAt: "" }], items)[0].spentMicrousd;
|
|
200
206
|
const unlimited = [
|
|
201
207
|
...(has("installation", "*") ? [] : [{ target: "installation:*", label: "Everything", budget: null, spentMicrousd: spentFor("installation", "*") }]),
|
|
@@ -2540,7 +2546,7 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
2540
2546
|
classifier: readProviderKey("openrouter", providerHome) !== null ? "A quick AI check (Jev, through your OpenRouter key) reads its title and description." : `A quick AI check (${SIZING_CLAUDE_MODEL}, on this computer's Claude sign-in) reads its title and description.` },
|
|
2541
2547
|
routing: `When a task is filed and Claude has used over ${HEADROOM_FIVE_HOUR_LIMIT}% of its 5-hour window or ${HEADROOM_WEEKLY_LIMIT}% of its week, ${alsoSet ? "the other provider you set for that size is preferred if it has more room" : "an alternate provider with more room would be preferred, but none is set"}; with no room anywhere, the first choice is kept. This is a preference at filing time, not a limit.`,
|
|
2542
2548
|
recent: recentRuns(store).map(one => ({ taskId: one.taskId, runId: one.runId, role: one.role,
|
|
2543
|
-
chosen: one.chosen === null ? "its default" : /^(opus|sonnet|haiku|fable)$/.test(one.chosen) ?
|
|
2549
|
+
chosen: one.chosen === null ? "its default" : /^(opus|sonnet|haiku|fable)$/.test(one.chosen) ? `${one.chosen} (latest)` : one.chosen,
|
|
2544
2550
|
ranOn: one.ranOn ?? "not reported" })),
|
|
2545
2551
|
waiting: canManage ? store.scopesAwaitingApproval(null, 10, admissionList()).map(one => ({ taskId: one.taskId, title: one.title })) : [],
|
|
2546
2552
|
suggested: suggestedView(repo, projects, query.get("suggestion"), now),
|
|
@@ -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/skills-ui.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { homedir } from "node:os";
|
|
2
3
|
import { whenUtc } from "./when-html.js";
|
|
3
4
|
import { html, joinHtml, postForm } from "./html.js";
|
|
4
5
|
import { acts, btn, chip, disclose, facts, formRow, input, note, notice, select, settingsRecord, settingsSection, textarea } from "./server/kit.js";
|
|
5
6
|
import { plural } from "./design/kit.js";
|
|
7
|
+
function prettyHomePath(target) {
|
|
8
|
+
const home = homedir();
|
|
9
|
+
return home && (target === home || target.startsWith(`${home}/`)) ? `~${target.slice(home.length)}` : target;
|
|
10
|
+
}
|
|
6
11
|
const fields = (data) => Object.fromEntries(Object.entries(data).map(([k, v]) => [k, String(v ?? "")]));
|
|
7
12
|
export const SKILLS_CSS = `.skills{max-width:780px;min-width:0;overflow-wrap:anywhere}.skills h2{font-size:1.1rem}.skills .card{padding:18px;margin:14px 0;min-width:0}.skills form,.skills label{display:grid;gap:10px}.skills input,.skills textarea,.skills select{box-sizing:border-box;width:100%;max-width:100%;min-width:0}.skills textarea{resize:vertical;min-height:130px}.skills button{justify-self:start;white-space:nowrap;min-height:44px}.skills summary{cursor:pointer;min-height:44px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}.skills pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:360px;overflow:auto;font-size:.9rem}.skills .skill-heading{display:flex;align-items:baseline;justify-content:space-between;gap:12px}.skills .skill-heading h2{margin:0}.skills .skill-state{font-size:.85rem;flex-shrink:0}.skills .skill-source{font-size:.85rem}.skills .skill-controls{display:flex;gap:12px;flex-wrap:wrap}.skills .skill-controls form{margin:0}.skills details details{margin-top:10px}.skills [hidden]{display:none!important}.skills .skill-files{max-height:200px;overflow:auto}.skills .problem{padding:12px}@media(max-width:600px){.skills input,.skills textarea,.skills select{font-size:16px}.skills .card{padding:14px}.skills .skill-heading{align-items:flex-start}}`;
|
|
8
13
|
function source(skill) {
|
|
@@ -117,11 +122,11 @@ export function skillLibrarySectionHtml(library, localTools, csrf, canManage, op
|
|
|
117
122
|
const projectOptedOutAll = library.projectOptOut?.all === true;
|
|
118
123
|
const projectOptOutNames = new Set(library.projectOptOut?.names ?? []);
|
|
119
124
|
const importBundleForm = manage
|
|
120
|
-
? disclose("Import a GitHub skill bundle", libForm("import-bundle", joinHtml([
|
|
125
|
+
? disclose("Import a GitHub skill bundle", libForm("import-bundle", html `<div class="k-sec">${joinHtml([
|
|
121
126
|
formRow("GitHub repository URL", "Imports every SKILL.md found in the repository, pinned to its exact commit SHA.", input({ id: "bundle-url", name: "url", type: "url", value: bundleUrl, attrs: { required: true, placeholder: "https://github.com/owner/repo", "aria-label": "GitHub repository URL" } }), "wide"),
|
|
122
|
-
html `<
|
|
127
|
+
html `<div class="k-checks"><label><input type="checkbox" name="autoUpdate" value="1" checked> Check daily and apply clean updates automatically (suspicious changes are held for review)</label></div>`,
|
|
123
128
|
acts(btn("Import bundle", { variant: "primary", type: "submit" })),
|
|
124
|
-
])), bundleUrl !== "" || (library.bundles.length === 0 && library.skills.length === 0))
|
|
129
|
+
])}</div>`), bundleUrl !== "" || (library.bundles.length === 0 && library.skills.length === 0))
|
|
125
130
|
: "";
|
|
126
131
|
const addGlobalSkillForm = manage
|
|
127
132
|
? disclose("Add a single skill to all projects", libForm("import-skill", joinHtml([
|
|
@@ -195,14 +200,14 @@ export function skillLibrarySectionHtml(library, localTools, csrf, canManage, op
|
|
|
195
200
|
id: "global-library",
|
|
196
201
|
title: "Global Skill Library",
|
|
197
202
|
lead: `${enabledCount ? `${plural(enabledCount, "skill", "skills")} active across all projects by default.` : "No global skills installed yet."} Every agent (tasks, Direct Chat, threads, terminals, and the lead) receives this pinned set unless a project opts out.`,
|
|
198
|
-
body: joinHtml([
|
|
203
|
+
body: html `<div class="k-sec">${joinHtml([
|
|
199
204
|
importBundleForm,
|
|
200
205
|
addGlobalSkillForm,
|
|
201
206
|
bundleCards.length ? html `<h3>Tracked GitHub bundles</h3>${joinHtml(bundleCards)}` : "",
|
|
202
207
|
projectOptOutToggle,
|
|
203
208
|
globalSearch,
|
|
204
209
|
globalSkillCards.length ? joinHtml(globalSkillCards) : note("Import a GitHub skill repository or add a skill above to share it across every project."),
|
|
205
|
-
])
|
|
210
|
+
])}</div>`,
|
|
206
211
|
});
|
|
207
212
|
const localToolCards = localTools.map((tool) => {
|
|
208
213
|
const statusChip = !tool.detected
|
|
@@ -211,7 +216,7 @@ export function skillLibrarySectionHtml(library, localTools, csrf, canManage, op
|
|
|
211
216
|
? chip(`Synced (${tool.installedCount})`, "done")
|
|
212
217
|
: chip("Detected · off", "");
|
|
213
218
|
const sub = tool.detected
|
|
214
|
-
? html `Writes only Toolroll-managed skills to <span class="k-mono">${tool.skillsDir ?? tool.toolHome}</span>. Your own hand-written skills are never overwritten.`
|
|
219
|
+
? html `Writes only Toolroll-managed skills to <span class="k-mono">${prettyHomePath(tool.skillsDir ?? tool.toolHome)}</span>. Your own hand-written skills are never overwritten.`
|
|
215
220
|
: "Folder not found on this computer — Toolroll only writes where a tool is already installed.";
|
|
216
221
|
const actions = manage && tool.detected
|
|
217
222
|
? html `<div class="skill-controls">
|
package/dist/spend-ui.js
CHANGED
|
@@ -52,11 +52,12 @@ const unknownWords = (line) => {
|
|
|
52
52
|
const apiWords = (line) => line.apiMicrousd > 0 ? money(line.apiMicrousd) : "—";
|
|
53
53
|
const sec = (id, title, state, body, attrs = "") => html `<section class="k-sec spend-sec" aria-labelledby="spend-${id}"${attrs}><div class="k-secthead"><h3 id="spend-${id}">${title}${state ? html ` <small>· ${state}</small>` : ""}</h3></div>${body}</section>`;
|
|
54
54
|
function bars(head, lines, name, max, top = 12, detail = () => "") {
|
|
55
|
+
const scale = Math.max(max, 1_000_000);
|
|
55
56
|
const rows = lines.slice(0, top).map(line => {
|
|
56
57
|
const sub = [detail(line), line.usageCount > 0 ? `plan usage ${usageWords(line)}` : "", line.unknown > 0 || line.estimatedMicrousd > 0 ? `unknown ${unknownWords(line)}` : ""].filter(Boolean).join(" · ");
|
|
57
|
-
const width =
|
|
58
|
+
const width = line.apiMicrousd > 0 ? Math.max(0, Math.min(100, (line.apiMicrousd / scale) * 100)) : 0;
|
|
58
59
|
return html `<div class="spend-bar" role="row"><span class="spend-bar-n" role="cell">${name(line.key)}${sub === "" ? "" : html `<small data-amount-kind="${line.usageCount > 0 ? "subscription" : "unknown"}">${sub}</small>`}</span>\
|
|
59
|
-
<span class="spend-lane" role="cell" aria-hidden="true">${line.apiMicrousd > 0 ? html `<i style="width:${width.toFixed(1)}%"></i>` : ""}</span><span class="spend-bar-v" role="cell" data-amount-kind="api">${apiWords(line)}</span></div>`;
|
|
60
|
+
<span class="spend-lane" role="cell" aria-hidden="true">${line.apiMicrousd > 0 ? html `<i style="width:${width.toFixed(1)}%" title="${apiWords(line)}"></i>` : ""}</span><span class="spend-bar-v" role="cell" data-amount-kind="api">${apiWords(line)}</span></div>`;
|
|
60
61
|
});
|
|
61
62
|
const total = lines.reduce((sum, line) => sum + line.apiMicrousd, 0);
|
|
62
63
|
return html `<div class="spend-bars" role="table" aria-label="${head}"><div class="spend-bar h" role="row"><span role="columnheader">${head}</span><span role="columnheader"></span><span class="spend-bar-v" role="columnheader">API dollars</span></div>${rows}\
|
package/dist/spend.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
1
2
|
import { SUBSCRIPTION_CAPABLE, readAuthMode } from "./keys.js";
|
|
2
3
|
export function billingOf(provider, db) {
|
|
3
4
|
const base = provider.replace(/-(subscription|api)$/, "");
|
|
@@ -270,11 +271,17 @@ export function spendItems(db, from, to, readMode = provider => billingOf(provid
|
|
|
270
271
|
}
|
|
271
272
|
return items;
|
|
272
273
|
}
|
|
274
|
+
const canonicalRepoPath = (value) => { try {
|
|
275
|
+
return realpathSync(value);
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
return value;
|
|
279
|
+
} };
|
|
273
280
|
export function countsToward(item, budget) {
|
|
274
281
|
if (budget.scope === "installation")
|
|
275
282
|
return true;
|
|
276
283
|
if (budget.scope === "project")
|
|
277
|
-
return item.project === budget.key;
|
|
284
|
+
return item.project !== null && (item.project === budget.key || canonicalRepoPath(item.project) === canonicalRepoPath(budget.key));
|
|
278
285
|
if (budget.scope === "person")
|
|
279
286
|
return item.person === budget.key;
|
|
280
287
|
return item.subagent !== null && String(item.subagent) === budget.key;
|
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.128",
|
|
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"
|