toolroll 0.9.122 → 0.9.125
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 +48 -0
- package/dist/advanced-view.js +0 -1
- package/dist/chat-actions.js +1 -1
- package/dist/codex-limits.js +2 -2
- package/dist/direct-chat-git.js +20 -0
- package/dist/direct-chat-ship.js +5 -5
- package/dist/direct-chat.js +3 -2
- package/dist/first-run.js +1 -1
- package/dist/flexible-save.js +8 -8
- package/dist/flexible-thread.js +14 -2
- package/dist/git-identity.js +65 -0
- package/dist/local-landing.js +57 -8
- package/dist/operate.js +43 -11
- package/dist/passwordless.js +10 -2
- package/dist/plan-limits-demand.js +32 -10
- package/dist/project-skills.js +2 -2
- package/dist/server/direct-chat.js +29 -3
- package/dist/server/engine-api.js +6 -5
- package/dist/server/render-tasks.js +5 -0
- package/dist/server/route-table.js +3 -0
- package/dist/server/settings-sections.js +1 -1
- package/dist/server/settings.js +55 -33
- package/dist/server/task-views.js +6 -3
- package/dist/server/tasks.js +22 -10
- package/dist/settings-groups-ui.js +6 -6
- package/dist/skill-library.js +22 -5
- package/dist/skills-ui.js +24 -11
- package/dist/surface.js +1 -1
- package/dist/task-status.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/work-index.js +5 -2
- package/dist/work-summary.js +77 -1
- package/dist/workspace-ui.js +12 -6
- package/package.json +1 -1
package/dist/server/tasks.js
CHANGED
|
@@ -2662,6 +2662,7 @@ export function createTasksHandlers(runtime) {
|
|
|
2662
2662
|
"task.act.complete": taskAct("complete"),
|
|
2663
2663
|
"task.act.merge": taskMerge,
|
|
2664
2664
|
"task.act.land": taskLand,
|
|
2665
|
+
"task.land-again": taskLandAgain,
|
|
2665
2666
|
"task.act.recheck-stopped": taskRecheckStopped,
|
|
2666
2667
|
"task.act.stop": taskAct("stop"),
|
|
2667
2668
|
"task.act.stop-carrying": taskAct("stop-carrying"),
|
|
@@ -2812,12 +2813,13 @@ export function createTasksHandlers(runtime) {
|
|
|
2812
2813
|
const ref = store.lookupRef(act.taskId);
|
|
2813
2814
|
if (ref === null || !visible(ref.repo) || who.via !== "cookie")
|
|
2814
2815
|
return refuse(response, who, 404, "no such task", "/");
|
|
2816
|
+
const shown = store.taskFamilyOf(act.taskId, null, true)?.current.id ?? act.taskId;
|
|
2815
2817
|
if (ref.repo !== null && publishesThroughPullRequests(store, ref.repo))
|
|
2816
|
-
return taskScreen(response, who,
|
|
2818
|
+
return taskScreen(response, who, shown, PULL_REQUESTS_INSTEAD, 409);
|
|
2817
2819
|
const local = who.authority === "local-owner";
|
|
2818
2820
|
const principal = local ? null : leadPrincipal(who);
|
|
2819
2821
|
if (!local && principal === null)
|
|
2820
|
-
return taskScreen(response, who,
|
|
2822
|
+
return taskScreen(response, who, shown, "Your access changed. Sign in again.", 403);
|
|
2821
2823
|
const access = { repos: principal !== null ? principal.repos : store.knownRepos().filter(repo => store.accountCanAccess(who.name, repo)) };
|
|
2822
2824
|
const undo = body.get("undo") === "1";
|
|
2823
2825
|
const into = (body.get("into") ?? "").trim();
|
|
@@ -2826,28 +2828,38 @@ export function createTasksHandlers(runtime) {
|
|
|
2826
2828
|
if (key === "") {
|
|
2827
2829
|
const read = await readLanding(store, act.taskId, access, now, options);
|
|
2828
2830
|
if (!read.ok)
|
|
2829
|
-
return taskScreen(response, who,
|
|
2831
|
+
return taskScreen(response, who, shown, read.message, 409);
|
|
2830
2832
|
if (!("plan" in read)) {
|
|
2831
2833
|
if (answersInPlace(ctx.request))
|
|
2832
2834
|
return answerActInPlace(response, "done", `Already on ${read.landed.ref.replace(/^refs\/heads\//, "")} (${read.landed.commit.slice(0, 7)}).`, 200);
|
|
2833
|
-
return redirect(response, taskHref(
|
|
2835
|
+
return redirect(response, taskHref(shown));
|
|
2834
2836
|
}
|
|
2835
2837
|
const plan = read.plan;
|
|
2836
2838
|
if (answersInPlace(ctx.request))
|
|
2837
2839
|
return respond(response, 200, "application/json; charset=utf-8", JSON.stringify({ outcome: "land-terms", key: plan.key, lines: landingWords(plan) }));
|
|
2838
2840
|
const title = undo ? "Undo landing" : `Land on ${plan.branch}`;
|
|
2839
|
-
return sendScreen(response, 200, screen(title, html `<h1>${title}</h1>${landingWords(plan).map(line => html `<p>${line}</p>`)}${postForm(`${taskHref(act.taskId)}/land`, html `${btn(undo ? "Undo it" : "Land it", { variant: "primary", type: "submit" })} ${btn("Cancel", { variant: "ghost", href: taskHref(
|
|
2841
|
+
return sendScreen(response, 200, screen(title, html `<h1>${title}</h1>${landingWords(plan).map(line => html `<p>${line}</p>`)}${postForm(`${taskHref(act.taskId)}/land`, html `${btn(undo ? "Undo it" : "Land it", { variant: "primary", type: "submit" })} ${btn("Cancel", { variant: "ghost", href: taskHref(shown) })}`, { hidden: { key: plan.key, ...(into === "" ? {} : { into }), ...(undo ? { undo: "1" } : {}) } })}`, { chrome: chromeFor(ref.repo, "tasks") }));
|
|
2840
2842
|
}
|
|
2841
2843
|
const done = await land(store, act.taskId, { key, ...(into === "" ? {} : { into }), ...(undo ? { undo: true } : {}) }, principal !== null ? { kind: "person", who: principal } : { kind: "local" }, access, now, { root: evidenceRoot });
|
|
2842
2844
|
if (!done.ok)
|
|
2843
|
-
return taskScreen(response, who,
|
|
2845
|
+
return taskScreen(response, who, shown, done.message, done.reason === "authority" ? 403 : 409);
|
|
2844
2846
|
if (done.handoff !== null) {
|
|
2845
2847
|
const words = `Landing commit ${done.commit.slice(0, 7)} is ready. Your project folder has ${done.branch} checked out, so Toolroll didn't touch it. ${handoffWords(done.handoff, done.commit)}`;
|
|
2846
|
-
return answersInPlace(ctx.request) ? answerActInPlace(response, "done", words, 200) :
|
|
2848
|
+
return answersInPlace(ctx.request) ? answerActInPlace(response, "done", words, 200, done.handoff.command) : redirect(response, `${taskHref(shown)}#land`);
|
|
2847
2849
|
}
|
|
2848
2850
|
if (answersInPlace(ctx.request))
|
|
2849
2851
|
return answerActInPlace(response, "done", `${done.kind === "undo" ? "Undone" : "Landed"} on ${done.branch} (${done.commit.slice(0, 7)}).`, 200);
|
|
2850
|
-
return redirect(response, taskHref(
|
|
2852
|
+
return redirect(response, taskHref(shown));
|
|
2853
|
+
}
|
|
2854
|
+
async function taskLandAgain(ctx) {
|
|
2855
|
+
const { url, who, response } = ctx;
|
|
2856
|
+
const act = matchTaskPath(url.pathname, "/land$");
|
|
2857
|
+
if (act === null)
|
|
2858
|
+
return noPage(who, response);
|
|
2859
|
+
const ref = store.lookupRef(act.taskId);
|
|
2860
|
+
if (ref === null || !visible(ref.repo))
|
|
2861
|
+
return refuse(response, who, 404, "no such task", "/");
|
|
2862
|
+
return redirect(response, `${taskHref(store.taskFamilyOf(act.taskId, null, true)?.current.id ?? act.taskId)}#land`);
|
|
2851
2863
|
}
|
|
2852
2864
|
return { registrations, workListFor, showOrder, runListPane, peekFragment, taskMutation, queueRegionFor, ciFailingFor, completedRowFor, attemptRowFor, resultRowOf, reviewCockpitViewOf, decisionEvidence, runEvidence, sendArtifact, peekGuards, liveRunIds };
|
|
2853
2865
|
}
|
|
@@ -3027,8 +3039,8 @@ export function localOwnerRetry(store, taskId, run, digest, now) {
|
|
|
3027
3039
|
const done = retryAsLocalOwner(store, taskId, { run: Number(run), digest }, now);
|
|
3028
3040
|
return done.ok ? { ok: true, replayed: done.replayed } : { ok: false, status: done.reason === "local-owner" || done.reason === "refused" || done.reason === "limit" ? 403 : 409, message: done.message };
|
|
3029
3041
|
}
|
|
3030
|
-
export function answerActInPlace(response, outcome, words, status) {
|
|
3031
|
-
respond(response, status, "application/json; charset=utf-8", JSON.stringify({ outcome, words }));
|
|
3042
|
+
export function answerActInPlace(response, outcome, words, status, command = null) {
|
|
3043
|
+
respond(response, status, "application/json; charset=utf-8", JSON.stringify(command === null ? { outcome, words } : { outcome, words, command }));
|
|
3032
3044
|
}
|
|
3033
3045
|
function typedSteer(store, who, file, now, words, question = null) {
|
|
3034
3046
|
return store.transact(() => {
|
|
@@ -136,7 +136,7 @@ export function agentsGroup(facts, flags) {
|
|
|
136
136
|
settingsLink({ href: "/settings/lead", title: "Chat", status: "The assistant you chat with" }),
|
|
137
137
|
...(advancedOn(facts) ? [settingsLink({ href: "/settings/lead/subagents", title: "Subagents", status: "Helpers the lead looks after" })] : []),
|
|
138
138
|
settingsLink({ href: "/settings/tools", title: "Tools", status: "What builds can use, per project" }),
|
|
139
|
-
|
|
139
|
+
settingsLink({ href: "/settings/skills", title: "Skills", status: "Reusable instructions for agents" }),
|
|
140
140
|
settingsLink({ href: "/settings/knowledge", title: "Knowledge", status: "What agents know about each project" }),
|
|
141
141
|
...(advancedOn(facts) ? [settingsLink({ href: "/settings/learning", title: "Learning", status: "Lessons kept from finished work" })] : []),
|
|
142
142
|
]);
|
|
@@ -365,7 +365,7 @@ export function accessGroup(facts, flags) {
|
|
|
365
365
|
settingsLink({ href: "/settings/sign-in", title: "Sign-in with a provider", status: facts.sso === null ? "Not set up: everyone uses a password" : `People sign in with ${facts.sso}` })
|
|
366
366
|
] : []),
|
|
367
367
|
...(facts.operator && (advancedOn(facts) || facts.passwordless === true) ? [
|
|
368
|
-
settingsLink({ href: "/settings/passwordless", title: "Passwordless", status: facts.passwordless ? "On: approvals need no password" : "Off: approvals ask for your password" })
|
|
368
|
+
settingsLink({ href: "/settings/passwordless", title: "Passwordless", status: facts.passwordless ? "On: most approvals need no password" : "Off: approvals ask for your password" })
|
|
369
369
|
] : []),
|
|
370
370
|
...(facts.local?.canTurnOff === true ? [html `<div id="local-mode">${settingsLink({ href: "/settings/general?section=local-mode", title: "Local mode", status: "On · in General" })}</div>`] : []),
|
|
371
371
|
];
|
|
@@ -541,12 +541,12 @@ export function passwordlessHtml(view) {
|
|
|
541
541
|
return settingsSubPage("access", "Passwordless", joinHtml([
|
|
542
542
|
answer,
|
|
543
543
|
settingsSection({ id: "passwordless", title: `Passwordless is ${view.on ? "on" : "off"}`, state: view.since === null ? "" : ` · ${view.since}`,
|
|
544
|
-
lead: "When it’s on, approvals, settings, budgets, signing a mode and starting a terminal no longer ask for your password again, in the browser, on the phone, and in this computer’s toolroll command (through its remembered login).
|
|
545
|
-
body: joinHtml([note(view.trade), control]) }),
|
|
544
|
+
lead: "When it’s on, approvals, settings, budgets, signing a mode and starting a terminal no longer ask for your password again, in the browser, on the phone, and in this computer’s toolroll command (through its remembered login).",
|
|
545
|
+
body: joinHtml([html `<p><strong>Still asks for your password</strong></p><ul data-passwordless-still-asks>${view.stillAsks.map(one => html `<li>${one}</li>`)}</ul>`, note(view.trade), note(view.others), control]) }),
|
|
546
546
|
]), { lead: "Sign in once; most approvals then need no password." });
|
|
547
547
|
}
|
|
548
|
-
export function projectPicker(action, projects, chosen) {
|
|
549
|
-
if (projects.length < 2)
|
|
548
|
+
export function projectPicker(action, projects, chosen, options = {}) {
|
|
549
|
+
if (projects.length < (options.evenOne === true ? 1 : 2))
|
|
550
550
|
return html ``;
|
|
551
551
|
return html `<form method="get" action="${action}" class="k-acts k-picker">${select({ name: "repo", label: "Project", current: chosen, items: projects.map(one => [one.repo, one.name]) })}${btn("Show", { sm: true, type: "submit" })}</form>`;
|
|
552
552
|
}
|
package/dist/skill-library.js
CHANGED
|
@@ -310,12 +310,29 @@ export function parseGithubBundleUrl(rawUrl) {
|
|
|
310
310
|
: `https://github.com/${owner}/${repoName}`;
|
|
311
311
|
return { id, repoUrl, owner: owner, repoName: repoName, ref: ref ?? null, subpath };
|
|
312
312
|
}
|
|
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
|
+
}
|
|
313
324
|
async function githubJson(owner, repoName, path, fetcher, budget) {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
325
|
+
let response;
|
|
326
|
+
try {
|
|
327
|
+
response = await fetcher(`https://api.github.com/repos/${owner}/${repoName}${path}`, {
|
|
328
|
+
redirect: "error",
|
|
329
|
+
signal: AbortSignal.timeout(20_000),
|
|
330
|
+
headers: { Accept: "application/vnd.github+json", "X-GitHub-Api-Version": "2022-11-28" },
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
catch (error) {
|
|
334
|
+
throw Error(`Couldn't reach GitHub: ${unreachableWhy(error)}.`);
|
|
335
|
+
}
|
|
319
336
|
if (!response.ok) {
|
|
320
337
|
throw Error(`GitHub returned ${response.status} for ${owner}/${repoName}${path.split("?")[0]}.`);
|
|
321
338
|
}
|
package/dist/skills-ui.js
CHANGED
|
@@ -23,7 +23,8 @@ export function skillsHtml(view, csrf, canManage, options = {}) {
|
|
|
23
23
|
revision: view.revision,
|
|
24
24
|
};
|
|
25
25
|
const form = (action, contents, extra = {}) => postForm("/settings/skills/change", contents, { hidden: fields({ ...base, action, ...extra }) });
|
|
26
|
-
const active = Object.values(view.selection).filter((c) => c.enabled).length;
|
|
26
|
+
const active = options.effective?.length ?? Object.values(view.selection).filter((c) => c.enabled).length;
|
|
27
|
+
const reaches = new Set((options.effective ?? []).map((one) => one.sha));
|
|
27
28
|
const renderSkill = (skill) => {
|
|
28
29
|
const enabled = view.selection[skill.name]?.sha === skill.sha &&
|
|
29
30
|
view.selection[skill.name]?.enabled === true;
|
|
@@ -34,13 +35,15 @@ export function skillsHtml(view, csrf, canManage, options = {}) {
|
|
|
34
35
|
acts(btn(enabled ? "Disable skill" : "Enable skill", { sm: true, type: "submit" })),
|
|
35
36
|
]), { sha: skill.sha }) : "";
|
|
36
37
|
const testing = manage ? disclose("Test skill", form("test", joinHtml([
|
|
37
|
-
note(`${options.agent ?? "Uses this project’s configured report agent"}. Runs a
|
|
38
|
+
note(`${options.agent ?? "Uses this project’s configured report agent"}. Runs the sample as a report task through the normal approval: it reads the project, and a report that changes a file fails with nothing kept.`),
|
|
38
39
|
formRow("Sample request", "The report shows what worked and what needs tools or permission. Enabled status alone does not prove use.", textarea({ id: `skill-sample-${skill.sha.slice(0, 12)}`, name: "sample", rows: 3, value: options.draft?.["sha"] === skill.sha ? (options.draft?.["sample"] ?? "") : "",
|
|
39
40
|
attrs: { required: true, maxlength: 800, placeholder: "Review this project’s home page and suggest three clearer button labels.", "aria-label": "Sample request" } }), "top"),
|
|
40
41
|
acts(btn("Create test", { sm: true, type: "submit" })),
|
|
41
42
|
]), { sha: skill.sha, nonce: randomUUID() }), options.draft?.["sha"] === skill.sha) : "";
|
|
42
43
|
return settingsRecord({
|
|
43
|
-
title: html `<span>${skill.name}</span>${
|
|
44
|
+
title: html `<span>${skill.name}</span>${enabled ? chip("Enabled here", "done")
|
|
45
|
+
: view.selection[skill.name]?.enabled === false ? chip("Off in this project", "")
|
|
46
|
+
: reaches.has(skill.sha) ? chip("Active from the global library", "done") : chip("In library", "")}`,
|
|
44
47
|
sub: skill.description,
|
|
45
48
|
attrs: { id: `skill-${skill.sha}` },
|
|
46
49
|
more: joinHtml([
|
|
@@ -89,7 +92,7 @@ export function skillsHtml(view, csrf, canManage, options = {}) {
|
|
|
89
92
|
: "";
|
|
90
93
|
const library = settingsSection({
|
|
91
94
|
id: "library", title: "Library",
|
|
92
|
-
lead: `${active ? `${active} skill${active === 1 ? "" : "s"}
|
|
95
|
+
lead: `${active ? `${active} skill${active === 1 ? "" : "s"} reach${active === 1 ? "es" : ""} new tasks in this project.` : "No skills reach new tasks in this project."} Active tasks keep their saved versions.`,
|
|
93
96
|
body: joinHtml([add, search, cards.length ? joinHtml(cards) : note("Your library is empty. Add a skill to review and enable it here."), history]),
|
|
94
97
|
});
|
|
95
98
|
return joinHtml([options.error ? notice(options.error) : "", library]);
|
|
@@ -108,16 +111,17 @@ export function skillTestFeedbackHtml(test, csrf, canManage, error = "", draft =
|
|
|
108
111
|
export function skillLibrarySectionHtml(library, localTools, csrf, canManage, options = {}) {
|
|
109
112
|
const manage = canManage && !!csrf;
|
|
110
113
|
const repo = options.repo ?? "";
|
|
114
|
+
const bundleUrl = options.bundleUrl ?? "";
|
|
111
115
|
const libForm = (action, contents, extra = {}) => postForm("/settings/skills/library", contents, { hidden: fields({ action, repo, revision: library.revision, ...extra }) });
|
|
112
116
|
const enabledCount = Object.values(library.selection).filter((c) => c.enabled).length;
|
|
113
117
|
const projectOptedOutAll = library.projectOptOut?.all === true;
|
|
114
118
|
const projectOptOutNames = new Set(library.projectOptOut?.names ?? []);
|
|
115
119
|
const importBundleForm = manage
|
|
116
120
|
? disclose("Import a GitHub skill bundle", libForm("import-bundle", joinHtml([
|
|
117
|
-
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", attrs: { required: true, placeholder: "https://github.com/owner/repo", "aria-label": "GitHub repository URL" } }), "wide"),
|
|
121
|
+
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"),
|
|
118
122
|
html `<label class="k-note"><input type="checkbox" name="autoUpdate" value="1" checked> Check daily and apply clean updates automatically (suspicious changes are held for review)</label>`,
|
|
119
123
|
acts(btn("Import bundle", { variant: "primary", type: "submit" })),
|
|
120
|
-
])), library.bundles.length === 0 && library.skills.length === 0)
|
|
124
|
+
])), bundleUrl !== "" || (library.bundles.length === 0 && library.skills.length === 0))
|
|
121
125
|
: "";
|
|
122
126
|
const addGlobalSkillForm = manage
|
|
123
127
|
? disclose("Add a single skill to all projects", libForm("import-skill", joinHtml([
|
|
@@ -156,11 +160,19 @@ export function skillLibrarySectionHtml(library, localTools, csrf, canManage, op
|
|
|
156
160
|
const enabled = library.selection[skill.name]?.sha === skill.sha && library.selection[skill.name]?.enabled === true;
|
|
157
161
|
const optedOutThis = projectOptOutNames.has(skill.name);
|
|
158
162
|
const optOut = optedOutThis || projectOptedOutAll;
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
const own = repo ? options.projectSelection?.[skill.name] : undefined;
|
|
164
|
+
const statusChip = own?.enabled === false
|
|
165
|
+
? chip("Off in this project", "")
|
|
166
|
+
: own !== undefined && own.sha !== skill.sha
|
|
167
|
+
? chip("This project uses another version", "")
|
|
168
|
+
: own !== undefined
|
|
169
|
+
? chip("Active: this project enables it", "done")
|
|
170
|
+
: !enabled
|
|
171
|
+
? chip("Disabled", "")
|
|
172
|
+
: optOut
|
|
173
|
+
? chip("Opted out here", "")
|
|
174
|
+
: chip("Active", "done");
|
|
175
|
+
const globalWords = own === undefined ? "" : note(`Global library: ${enabled ? "enabled" : "disabled"}${optOut ? ", and this project opted out of it" : ""}. This project’s own choice decides here.`);
|
|
164
176
|
const controls = manage
|
|
165
177
|
? html `<div class="skill-controls">
|
|
166
178
|
${libForm(enabled ? "disable-skill" : "enable-skill", btn(enabled ? "Disable globally" : "Enable globally", { sm: true, type: "submit" }), { sha: skill.sha })}
|
|
@@ -171,6 +183,7 @@ export function skillLibrarySectionHtml(library, localTools, csrf, canManage, op
|
|
|
171
183
|
title: html `<span>${skill.name}</span>${statusChip}`,
|
|
172
184
|
sub: skill.description,
|
|
173
185
|
more: joinHtml([
|
|
186
|
+
globalWords,
|
|
174
187
|
disclose("Review skill", joinHtml([sourceKit(skill), controls])),
|
|
175
188
|
]),
|
|
176
189
|
})}</div>`;
|
package/dist/surface.js
CHANGED
|
@@ -309,7 +309,7 @@ const GUIDE_ROWS = [
|
|
|
309
309
|
{ name: "digest", takesValue: true, meaning: "the exact receipt from assignment show; accepts and finishes exactly that result" },
|
|
310
310
|
{ name: "despite", takesValue: true, meaning: "accept with this reason, without finishing; never combines with --finish or --digest (--note is its alias)" }],
|
|
311
311
|
notableReasons: ["usage", "unknown-task", "no-run", "not-ready"] },
|
|
312
|
-
{ ...operator("task land", "put accepted work on the project's own branch when it has no pull requests: bare shows exactly what lands where; --yes --key <key> lands it as one new commit on top; --undo reverts that commit with a new one"),
|
|
312
|
+
{ ...operator("task land", "put accepted work on the project's own branch when it has no pull requests: bare shows exactly what lands where; --yes --key <preview-key> lands it as one new commit on top; --undo reverts that commit with a new one"),
|
|
313
313
|
positionals: [{ name: "id", required: true, meaning: "the task" }],
|
|
314
314
|
flags: [jsonFlag, dbFlag, { name: "into", takesValue: true, meaning: "land on this branch instead of the recorded one (the yes records it)" },
|
|
315
315
|
{ name: "undo", takesValue: false, meaning: "revert the landing with a new commit on the branch" },
|
package/dist/task-status.js
CHANGED
|
@@ -154,7 +154,8 @@ function sentenceOf(headline, facts) {
|
|
|
154
154
|
return `Accepted automatically: ${facts.landed}.`;
|
|
155
155
|
const by = facts.completedBy ? `Accepted by ${facts.completedBy}.` : "Accepted.";
|
|
156
156
|
const pr = facts.pullRequest;
|
|
157
|
-
|
|
157
|
+
const again = facts.checks?.status === "failed" ? " Its checks failed when they ran again." : "";
|
|
158
|
+
return pr?.state === "merged" ? `${by} ${pr.number === null ? "Its pull request" : `Pull request #${pr.number}`} merged.${again}` : `${by}${again}`;
|
|
158
159
|
}
|
|
159
160
|
case "Failed":
|
|
160
161
|
if (facts.checks?.status === "failed")
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/work-index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { buildReviewOf } from './review-switch.js';
|
|
|
14
14
|
import { shownVerdictOf } from './proof.js';
|
|
15
15
|
import { isCheckLevel, repoClause, requiredCheckCommandFor, RUN_LEVEL_ACTION, TASK_LEVEL_ACTION } from './check-levels.js';
|
|
16
16
|
import { MARKER } from './worktree.js';
|
|
17
|
-
import { CHECKS_FINISHED, CHECKS_REQUESTED, CHECKS_STARTED, withFollowUps } from './result-follow-ups.js';
|
|
17
|
+
import { CHECKS_FINISHED, CHECKS_REQUESTED, CHECKS_STARTED, FOLLOW_UP_LOG, FOLLOW_UP_RECEIPT, withFollowUps } from './result-follow-ups.js';
|
|
18
18
|
import { LANDED_ACTOR, landedReasonOf } from './result-completion.js';
|
|
19
19
|
import { ASKS, CODE_READING, STORAGE_HOLD_PREFIX, NEED_ASK, NEEDS, askChipOf, failedAttemptSentence, isWaitCode, processNeedOf, resultHoldUpSentence } from './needs-you.js';
|
|
20
20
|
import { agentlessCommand, NO_AGENT_TITLE, noAgentWords, retryWhenWords, signInAgainWords } from './dispatch.js';
|
|
@@ -212,7 +212,10 @@ const PROJECTION = `WITH RECURSIVE admitted AS MATERIALIZED (
|
|
|
212
212
|
AND a.action IN ('task state changed','scope approved','task placed','run started','run finished')) END completion_changed,
|
|
213
213
|
CASE WHEN f.ready AND EXISTS(SELECT 1 FROM action_ledger a
|
|
214
214
|
WHERE a.task_id=f.root_id AND a.run_id=f.result_id AND a.action='assignment handoff checked' AND a.source='work')
|
|
215
|
-
THEN (SELECT MAX(ar.created_at) FROM json_each(f.fam_refs) m JOIN run r ON r.task_ref=m.value JOIN artifact ar ON ar.run=r.id
|
|
215
|
+
THEN (SELECT MAX(ar.created_at) FROM json_each(f.fam_refs) m JOIN run r ON r.task_ref=m.value JOIN artifact ar ON ar.run=r.id
|
|
216
|
+
-- A follow-up check's own log and receipt (Run checks after accepting) are a separate check fact, never changed
|
|
217
|
+
-- work: assignment.ts reads the completion with the checks as they read then, so the list does too.
|
|
218
|
+
WHERE NOT (ar.kind='structured-output' AND ar.capture IN ('${FOLLOW_UP_LOG}','${FOLLOW_UP_RECEIPT}'))) END completion_artifact_at
|
|
216
219
|
FROM ready f) f
|
|
217
220
|
), classified AS MATERIALIZED (
|
|
218
221
|
SELECT f.*,CASE
|
package/dist/work-summary.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { heldFindingCount } from "./findings.js";
|
|
2
2
|
import { machineChecked } from "./machine-check.js";
|
|
3
|
-
import { resultCheckLevel } from "./result-follow-ups.js";
|
|
3
|
+
import { FOLLOW_UP_LOG, FOLLOW_UP_RECEIPT, resultCheckLevel } from "./result-follow-ups.js";
|
|
4
|
+
import { COMPLETER_ACTOR, COMPLETION_ACTION } from "./result-completion.js";
|
|
5
|
+
import { approvalOf } from "./scope.js";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { MARKER } from "./worktree.js";
|
|
4
9
|
import { projectCheckSet } from "./check-levels.js";
|
|
5
10
|
import { diagnoseTaskDispatch } from "./dispatch.js";
|
|
6
11
|
import { isAlive } from "./runner.js";
|
|
12
|
+
import { refArchived, stopFactOf } from "./store.js";
|
|
7
13
|
import { taskControlOf } from "./task-control.js";
|
|
8
14
|
import { buildReviewOf } from "./review-switch.js";
|
|
9
15
|
import { reviewFactsOf, workStatusOf } from "./workspace-ui.js";
|
|
@@ -82,6 +88,7 @@ export function taskWorkSummaryOf(store, taskId, now, access) {
|
|
|
82
88
|
const publication = result === null ? null : store.publicationForRun(result.id);
|
|
83
89
|
const facts = {
|
|
84
90
|
id: task.id, title: task.title, repo: ref.repo, state: task.state, updatedAt: task.updatedAt,
|
|
91
|
+
...(task.state === "done" && result !== null && completionStands(store, task.id, now, result.id) ? { completed: true } : {}),
|
|
85
92
|
...(machineChecked(store, task.id) ? { machine: true } : {}),
|
|
86
93
|
dispatch: diagnoseTaskDispatch(store, taskId, now, access.dependencyRepos ?? null), liveRunId: live?.id ?? null,
|
|
87
94
|
unfinishedRunId: runs.find(one => one.outcome === null && one.role !== "reviewer")?.id ?? null,
|
|
@@ -107,3 +114,72 @@ export function taskWorkSummaryOf(store, taskId, now, access) {
|
|
|
107
114
|
};
|
|
108
115
|
return workSummaryOf(facts, access.principal);
|
|
109
116
|
}
|
|
117
|
+
export function completionStands(store, taskId, now, resultRunId) {
|
|
118
|
+
try {
|
|
119
|
+
if (resultRunId !== undefined && store.handle.prepare("SELECT 1 AS hit FROM action_ledger WHERE run_id = ? AND action = ? AND source = 'work' LIMIT 1")
|
|
120
|
+
.get(resultRunId, COMPLETION_ACTION) === undefined)
|
|
121
|
+
return false;
|
|
122
|
+
const family = store.taskFamilyOf(taskId, null, true);
|
|
123
|
+
if (family === null || family.problem !== null || family.current.id !== taskId || family.current.state !== "done")
|
|
124
|
+
return false;
|
|
125
|
+
const current = family.current;
|
|
126
|
+
const runs = store.runsFor(current.refId);
|
|
127
|
+
const result = runs.find(run => run.finishedAt !== null && (run.role === "builder" || run.role === "scout"));
|
|
128
|
+
if (result === undefined || result.finishedAt === null)
|
|
129
|
+
return false;
|
|
130
|
+
const valid = result.role === "scout" ? result.outcome === "built"
|
|
131
|
+
: (result.outcome === "built" || result.outcome === "no-change") && /^[0-9a-f]{40}$/.test(result.headRevision ?? "");
|
|
132
|
+
if (!valid)
|
|
133
|
+
return false;
|
|
134
|
+
const scope = store.getScope(current.id);
|
|
135
|
+
if (scope === null || scope.termsProblem != null || !approvalOf(scope).approved || scope.digest !== result.scopeDigest)
|
|
136
|
+
return false;
|
|
137
|
+
const busy = (refId) => store.currentLiveLease(refId, now) !== null || store.runsFor(refId).some(run => run.outcome === null && run.role !== "reviewer");
|
|
138
|
+
if (family.versions.some(version => version.id !== current.id && ((version.state === "queued" && !refArchived(store, version.refId)) || version.state === "running" || busy(version.refId))))
|
|
139
|
+
return false;
|
|
140
|
+
if (busy(current.refId) || store.activeHolds(current.refId, now).length > 0 || store.applicableStopFor(result.id) !== null)
|
|
141
|
+
return false;
|
|
142
|
+
const counted = family.versions.filter(version => version.id === current.id || !refArchived(store, version.refId));
|
|
143
|
+
if (counted.some(version => openQuestionOn(store, version.refId) || custodyUnresolved(store, version.refId, version.state)))
|
|
144
|
+
return false;
|
|
145
|
+
const ids = JSON.stringify(family.versions.map(version => version.id));
|
|
146
|
+
const one = (sql, ...values) => store.handle.prepare(sql).get(...values);
|
|
147
|
+
const updated = String(one("SELECT MAX(updated_at) AS v FROM task WHERE id IN (SELECT value FROM json_each(?))", ids)?.["v"] ?? "");
|
|
148
|
+
const changed = Number(one(`SELECT MAX(id) AS v FROM action_ledger WHERE task_id IN (SELECT value FROM json_each(?))
|
|
149
|
+
AND action IN ('task state changed','scope approved','task placed','run started','run finished')`, ids)?.["v"] ?? 0);
|
|
150
|
+
const saved = String(one(`SELECT MAX(ar.created_at) AS v FROM artifact ar JOIN run r ON r.id = ar.run JOIN task_ref tr ON tr.id = r.task_ref
|
|
151
|
+
WHERE tr.backend = 'built-in' AND tr.external_id IN (SELECT value FROM json_each(?))
|
|
152
|
+
AND NOT (ar.kind = 'structured-output' AND ar.capture IN (?, ?))`, ids, FOLLOW_UP_LOG, FOLLOW_UP_RECEIPT)?.["v"] ?? "");
|
|
153
|
+
const after = [updated, result.finishedAt, scope.approvedAt ?? "", scope.proposedAt ?? ""];
|
|
154
|
+
const rows = store.handle.prepare(`SELECT id, at, actor FROM action_ledger WHERE task_id = ? AND run_id = ? AND action = ? AND source = 'work'
|
|
155
|
+
AND repo IS ? AND length(outcome) = 64 AND outcome NOT GLOB '*[^a-f0-9]*' ORDER BY id DESC`).all(family.root.id, result.id, COMPLETION_ACTION, current.repo);
|
|
156
|
+
return rows.some(row => {
|
|
157
|
+
const at = String(row["at"]);
|
|
158
|
+
if (!COMPLETER_ACTOR.test(String(row["actor"])) || Number(row["id"]) < changed || at < saved || after.some(one => at < one))
|
|
159
|
+
return false;
|
|
160
|
+
return one("SELECT 1 AS hit FROM proof_verdict WHERE run = ? AND decided_at > ?", result.id, at) === undefined
|
|
161
|
+
&& one("SELECT 1 AS hit FROM proof_acceptance WHERE run = ? AND accepted_at > ?", result.id, at) === undefined;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function openQuestionOn(store, refId) {
|
|
169
|
+
return store.handle.prepare(`SELECT 1 AS hit FROM decision d JOIN run r ON r.id = d.run
|
|
170
|
+
WHERE r.task_ref = ? AND d.state <> 'answered' AND d.answered_at IS NULL LIMIT 1`).get(refId) !== undefined;
|
|
171
|
+
}
|
|
172
|
+
function custodyUnresolved(store, refId, state) {
|
|
173
|
+
const recorded = store.handle.prepare(`SELECT 1 AS hit FROM run r WHERE r.task_ref = ? AND r.provider_started_at IS NOT NULL
|
|
174
|
+
AND NOT EXISTS(SELECT 1 FROM run_process p WHERE p.run = r.id) AND NOT EXISTS(SELECT 1 FROM run_process_summary s WHERE s.run = r.id)
|
|
175
|
+
UNION SELECT 1 FROM run_process p JOIN run r ON r.id = p.run WHERE r.task_ref = ? AND p.exited_at IS NULL AND p.container_empty_at IS NULL
|
|
176
|
+
LIMIT 1`).get(refId, refId) !== undefined;
|
|
177
|
+
const noted = state === "done" && (() => {
|
|
178
|
+
const last = store.handle.prepare(`SELECT worktree FROM run WHERE task_ref = ? AND role IN ('builder','scout') AND finished_at IS NOT NULL
|
|
179
|
+
ORDER BY id DESC LIMIT 1`).get(refId)?.["worktree"];
|
|
180
|
+
return typeof last === "string" && existsSync(join(last, MARKER));
|
|
181
|
+
})();
|
|
182
|
+
if (!recorded && !noted)
|
|
183
|
+
return false;
|
|
184
|
+
return store.runsFor(refId).some(run => { const fact = stopFactOf(store, run.id); return fact !== null && fact.kind !== "open"; });
|
|
185
|
+
}
|
package/dist/workspace-ui.js
CHANGED
|
@@ -361,16 +361,22 @@ export function resultHeadlineOf(status) {
|
|
|
361
361
|
: VERIFIED_RESULT.has(status.token) ? { status: "passed", exitCode: null, head: null } : null });
|
|
362
362
|
return { ...status, label: shared.headline, tone: workToneOf(shared.headline) };
|
|
363
363
|
}
|
|
364
|
+
const COMPLETION_YIELDS = new Set(["waiting-decision", "finding-held", "stopping", "stopped"]);
|
|
364
365
|
export function workStatusOf(facts, resultDisplay) {
|
|
365
366
|
const status = workStatusWordsOf(facts, resultDisplay);
|
|
366
367
|
const done = facts.state === "done" && status.token !== "waiting-decision";
|
|
367
|
-
const read = done ? RESULT_NEEDS_YOU.has(status.token) ? { stage: "needs-you", need: "other" }
|
|
368
|
+
const read = done ? RESULT_NEEDS_YOU.has(status.token) ? { stage: "needs-you", need: "other" }
|
|
369
|
+
: status.token === "finding-held" ? { stage: "needs-you", need: "finding" } : stageOfCode(status.token, { needsPerson: false })
|
|
368
370
|
: stageOfCode(status.token, { needsPerson: status.views.includes("needs-you"), planning: facts.dispatch?.code === "running" && facts.dispatch.role === "planner", operatorHold: facts.dispatch?.action === "unhold" });
|
|
369
|
-
const
|
|
371
|
+
const complete = done && facts.completed === true && !COMPLETION_YIELDS.has(status.token) && (facts.control?.kind ?? "none") === "none"
|
|
372
|
+
&& (facts.openDecision ?? null) === null && (facts.heldFindings ?? 0) === 0;
|
|
373
|
+
const stage = complete ? "complete" : done && read.stage !== "needs-you" && read.stage !== "failed" ? "finished" : read.stage;
|
|
370
374
|
const level = facts.result?.checkLevel ?? null;
|
|
371
375
|
const shared = taskStatusOf({ stage, ...(read.need === undefined ? {} : { need: read.need }), ...(read.wait === undefined ? {} : { wait: read.wait }), reason: plainReasonOf(stage, status.token, status.detail),
|
|
372
|
-
report: facts.result?.role === "scout", ...(facts.machine === true ? { machine: true } : {}), checks: stage !== "finished" ? null : VERIFIED_RESULT.has(status.token) ? { status: "passed", exitCode: null, head: null, level }
|
|
376
|
+
report: facts.result?.role === "scout", ...(facts.machine === true ? { machine: true } : {}), checks: stage !== "finished" && stage !== "complete" ? null : VERIFIED_RESULT.has(status.token) ? { status: "passed", exitCode: null, head: null, level }
|
|
373
377
|
: level === "off" ? { status: "not-run", exitCode: null, head: null, level } : null });
|
|
378
|
+
if (complete)
|
|
379
|
+
return { ...status, label: shared.headline, tone: workToneOf(shared.headline), detail: shared.sentence, action: null, views: status.views.filter(view => view !== "needs-you"), rank: 3 };
|
|
374
380
|
return { ...status, label: shared.headline, tone: workToneOf(shared.headline), detail: stage === "finished" && level !== "off" ? status.detail : shared.sentence };
|
|
375
381
|
}
|
|
376
382
|
function workStatusWordsOf(facts, resultDisplay) {
|
|
@@ -409,12 +415,12 @@ function workStatusWordsOf(facts, resultDisplay) {
|
|
|
409
415
|
return { token: "stopped", label: "Paused", detail: "The stopped attempt's work is preserved. Resuming requires confirmation and checks the current approval again.", tone: "attention", action: { label: "Review pause", kind: "open-task" }, views, rank: 0 };
|
|
410
416
|
}
|
|
411
417
|
if (facts.state === "done" && result !== null) {
|
|
412
|
-
if (question !== null && result.tone !== "problem") {
|
|
418
|
+
if (question !== null && (result.tone !== "problem" || facts.completed === true)) {
|
|
413
419
|
return { token: "waiting-decision", label: "Waiting on your answer", detail: question.question,
|
|
414
420
|
tone: "attention", action: { label: "Answer question", kind: "open-task" }, views, rank: 0,
|
|
415
421
|
diagnostics: [{ token: result.token, label: result.label, detail: result.detail, tone: result.tone }] };
|
|
416
422
|
}
|
|
417
|
-
if (held && result.tone !== "problem")
|
|
423
|
+
if (held && (result.tone !== "problem" || facts.completed === true))
|
|
418
424
|
return findingWords({ token: result.token, label: result.label, detail: result.detail, tone: result.tone });
|
|
419
425
|
return { ...result, views, rank: needs ? 0 : 3 };
|
|
420
426
|
}
|
|
@@ -568,7 +574,7 @@ export function stepRowsOf(view) {
|
|
|
568
574
|
if (step.state === "skipped")
|
|
569
575
|
return { sentence: said === "Checks not run" ? "The checks didn't run" : said === "Checks at release" ? "Checks deferred to release" : "No checks were recorded", at: null };
|
|
570
576
|
if (step.state === "stuck")
|
|
571
|
-
return { sentence: step.needsYou && said === null ? "" : said === "Checks unreadable" ? "The checks couldn't be read" : said === "Checks failed" ? "The checks failed" : stoppedWord, at: null };
|
|
577
|
+
return { sentence: step.needsYou && said === null ? "" : said === "Checks unreadable" ? "The checks couldn't be read" : said === "Checks failed" ? headline === "Complete" ? "The checks failed when they ran again" : "The checks failed" : stoppedWord, at: null };
|
|
572
578
|
if (step.state === "current")
|
|
573
579
|
return { sentence: said === "Checks running" ? "The checks are running" : step.needsYou ? "" : "Waiting for the checks", at: null };
|
|
574
580
|
return { sentence: "The project's checks run on the result", at: null };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolroll",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.125",
|
|
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"
|