toolroll 0.9.118 → 0.9.119
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 +32 -0
- package/README.md +14 -14
- package/dist/assignment.js +40 -29
- package/dist/browser/workspace.css +1 -1
- package/dist/browser/workspace.js +32 -31
- package/dist/builder.js +286 -236
- package/dist/central-recovery-stage.js +3 -3
- package/dist/check-failure.js +2 -2
- package/dist/check-levels.js +3 -0
- package/dist/check-report.js +58 -7
- package/dist/contracts/console-api.js +4 -1
- package/dist/contracts/engine-api.js +1 -0
- package/dist/contracts/release-check.js +7 -4
- package/dist/contracts/release-terms.js +11 -2
- package/dist/contracts/verification-receipt.js +1 -1
- package/dist/deploy-gate.js +7 -1
- package/dist/direct-chat.js +3 -3
- package/dist/easy-start.js +8 -6
- package/dist/engine-reads.js +72 -0
- package/dist/flexible-conversation-schema.js +24 -0
- package/dist/flexible-conversation.js +162 -0
- package/dist/flexible-custody.js +3 -0
- package/dist/flexible-import.js +51 -0
- package/dist/flexible-session.js +84 -11
- package/dist/install-mode.js +1 -1
- package/dist/local-landing.js +500 -0
- package/dist/local-owner.js +1 -0
- package/dist/operate.js +143 -22
- package/dist/passwordless.js +1 -1
- package/dist/project-delete.js +1 -0
- package/dist/rehearsal.js +27 -0
- package/dist/release-adapters.js +170 -2
- package/dist/release-approval.js +11 -8
- package/dist/release-card.js +7 -2
- package/dist/release-carry.js +1 -1
- package/dist/release-cli.js +115 -14
- package/dist/release-main-proof.js +49 -0
- package/dist/release-main.js +110 -0
- package/dist/release-recheck.js +10 -3
- package/dist/release.js +221 -33
- package/dist/reply-shape.js +6 -1
- package/dist/result-actions.js +7 -1
- package/dist/result-follow-ups.js +8 -4
- package/dist/serve.js +31 -14
- package/dist/server/direct-chat.js +88 -3
- package/dist/server/engine-api.js +43 -5
- package/dist/server/render-results.js +3 -1
- package/dist/server/render-tasks.js +10 -1
- package/dist/server/route-table.js +9 -0
- package/dist/server/settings.js +31 -7
- package/dist/server/task-views.js +15 -0
- package/dist/server/tasks.js +63 -3
- package/dist/settings-groups-ui.js +2 -2
- package/dist/store.js +29 -4
- package/dist/surface.js +9 -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/verification-evidence.js +17 -6
- package/dist/workspace-ui.js +1 -1
- package/package.json +2 -1
- package/scripts/release-proof.mjs +240 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { dirname, join } from "node:path";
|
|
2
|
+
import { inRehearsal } from "../rehearsal.js";
|
|
2
3
|
import { tmpdir } from "node:os";
|
|
3
4
|
import { checkEngineResponse, ENGINE_API_VERSION, } from "../contracts/engine-api.js";
|
|
4
5
|
import { DirectChatHost, directChatPostureOf, importLegacyDirectChatJson, isDirectChatProvider, } from "../direct-chat.js";
|
|
@@ -10,7 +11,10 @@ import { backgroundInstalled } from "../laptop-background.js";
|
|
|
10
11
|
import { localOwnerStandsNow } from "../local-owner.js";
|
|
11
12
|
import { projectName, rowVisible } from "../project.js";
|
|
12
13
|
import { handlersOf } from "./handler-registry.js";
|
|
13
|
-
import { respond } from "./http.js";
|
|
14
|
+
import { redirect, respond } from "./http.js";
|
|
15
|
+
import { html, postForm } from "../html.js";
|
|
16
|
+
import { screen } from "./chrome.js";
|
|
17
|
+
import { btn } from "./kit.js";
|
|
14
18
|
import { rereadBrowser } from "./live.js";
|
|
15
19
|
const THREAD_PATH = /^\/engine\/direct-chats\/([a-f0-9]{32})(?:\/(messages|stop|model|delete|attachments|apply-main-edits|repair|ship-preview|ship|ship-cancel))?$/;
|
|
16
20
|
const ARTIFACT_PATH = /^\/engine\/direct-chats\/([a-f0-9]{32})\/artifacts\/([a-f0-9]{32})$/;
|
|
@@ -27,7 +31,8 @@ export function createDirectChatHandlers(runtime, deps) {
|
|
|
27
31
|
deps.bus.publish({ revision: `dc:${note.threadId}:${Date.now()}` });
|
|
28
32
|
},
|
|
29
33
|
});
|
|
30
|
-
|
|
34
|
+
const rehearsing = inRehearsal();
|
|
35
|
+
if (!rehearsing && !deps.disableLegacyImport && !store.isDemo() && dbFile && dbFile !== ":memory:" && soloNow(store)) {
|
|
31
36
|
try {
|
|
32
37
|
const owners = store.handle
|
|
33
38
|
.prepare("SELECT name, generation FROM approver WHERE revoked_at IS NULL")
|
|
@@ -39,7 +44,8 @@ export function createDirectChatHandlers(runtime, deps) {
|
|
|
39
44
|
catch {
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
|
-
|
|
47
|
+
if (!rehearsing)
|
|
48
|
+
host.startPolling();
|
|
43
49
|
const json = (ctx, status, value) => respond(ctx.response, status, "application/json", JSON.stringify(value));
|
|
44
50
|
const checked = (ctx, status, name, value) => json(ctx, status, checkEngineResponse(name, value));
|
|
45
51
|
function admit(ctx, act) {
|
|
@@ -558,9 +564,88 @@ export function createDirectChatHandlers(runtime, deps) {
|
|
|
558
564
|
deps.bus.publish({ revision: `dc:${threadId}:ship-cancel:${Date.now()}` });
|
|
559
565
|
return checked(ctx, 200, "directChatMutated", { ok: true, said: "Auto-merge cancelled." });
|
|
560
566
|
}
|
|
567
|
+
const PAGE_PATH = /^\/direct-chats\/([a-f0-9]{32})(?:\/(ship-review|ship))?$/;
|
|
568
|
+
const STATUS_WORDS = { completed: "Finished", failed: "Failed", interrupted: "Stopped", running: "Working", queued: "Waiting" };
|
|
569
|
+
const DIFF_SHOWN = 200_000;
|
|
570
|
+
function pageRefusal(ctx, status, words) {
|
|
571
|
+
runtime.sendScreen(ctx.response, status, screen("Direct Chats", html `<h1>Direct Chats</h1><p class="problem" role="alert">${words}</p><p><a class="k-link" href="/direct-chats">All Direct Chats</a></p>`, { chrome: runtime.chromeFor(null, "tasks") }));
|
|
572
|
+
}
|
|
573
|
+
async function pageList(ctx) {
|
|
574
|
+
const gate = admit(ctx, null);
|
|
575
|
+
if (!gate.ok)
|
|
576
|
+
return pageRefusal(ctx, gate.status, gate.error);
|
|
577
|
+
const threads = host.listThreads(gate.who.name, null).filter(t => canReachThread(gate.who.name, t));
|
|
578
|
+
const rows = threads.map(t => html `<li class="k-row" data-direct-chat="${t.id}"><a class="k-link" href="/direct-chats/${t.id}"><b>${t.title || "Direct Chat"}</b></a> <span class="k-note">${t.project} · ${t.provider}${t.running ? " · Working" : t.lastStatus === null ? "" : ` · ${STATUS_WORDS[t.lastStatus] ?? t.lastStatus}`}${t.changedFilesCount > 0 ? ` · ${t.changedFilesCount} ${t.changedFilesCount === 1 ? "file" : "files"} changed` : ""}</span></li>`);
|
|
579
|
+
const body = threads.length === 0
|
|
580
|
+
? html `<h1>Direct Chats</h1><p>No Direct Chats yet. Ask the lead in Chat to start one in a project.</p>`
|
|
581
|
+
: html `<h1>Direct Chats</h1><ul class="k-list" data-direct-chats>${rows}</ul>`;
|
|
582
|
+
return runtime.sendScreen(ctx.response, 200, screen("Direct Chats", body, { chrome: runtime.chromeFor(null, "tasks") }));
|
|
583
|
+
}
|
|
584
|
+
async function pageDetail(ctx) {
|
|
585
|
+
const gate = admit(ctx, null);
|
|
586
|
+
if (!gate.ok)
|
|
587
|
+
return pageRefusal(ctx, gate.status, gate.error);
|
|
588
|
+
const threadId = PAGE_PATH.exec(ctx.url.pathname)?.[1] ?? "";
|
|
589
|
+
const found = host.getThread(gate.who.name, threadId);
|
|
590
|
+
if (found === null || !canReachThread(gate.who.name, found.thread))
|
|
591
|
+
return pageRefusal(ctx, 404, "That Direct Chat isn't here.");
|
|
592
|
+
const { thread, turns, diff, running } = found;
|
|
593
|
+
const turnHtml = turns.map(turn => html `<section class="card" data-turn="${turn.id}"><p><b>You</b> · <span class="k-note">${STATUS_WORDS[turn.status] ?? turn.status}</span></p><p class="pre-wrap">${turn.userPrompt}</p>${turn.assistantText.trim() === "" ? "" : html `<p><b>${thread.provider === "claude" ? "Claude" : thread.provider === "codex" ? "Codex" : "Gemini"}</b></p><p class="pre-wrap">${turn.assistantText}</p>`}${turn.errorText === null ? "" : html `<p class="problem">${turn.errorText}</p>`}</section>`);
|
|
594
|
+
const shownDiff = diff.diffText.length > DIFF_SHOWN ? `${diff.diffText.slice(0, DIFF_SHOWN)}\n… (shortened)` : diff.diffText;
|
|
595
|
+
const changes = diff.changedFiles.length === 0 ? html `<p class="k-note">No changes in its copy of the project.</p>`
|
|
596
|
+
: html `<p class="k-note">${diff.changedFiles.length} ${diff.changedFiles.length === 1 ? "file" : "files"} changed in its own copy of the project, as of its last turn${running ? " (it's still working)" : ""}.</p><ul>${diff.changedFiles.map(file => html `<li class="k-mono">${file}</li>`)}</ul>${shownDiff === "" ? "" : html `<details><summary>The changes</summary><pre class="k-mono" data-direct-chat-diff>${shownDiff}</pre></details>`}`;
|
|
597
|
+
const ships = listDirectChatShips(store, thread.id);
|
|
598
|
+
const shipped = ships.length === 0 ? "" : html `<ul>${ships.map(one => html `<li>${one.mode === "keep-branch" ? "Saved as branch" : "Shipped"} <span class="k-mono">${one.branch}</span> · ${one.state}${one.taskId === null ? "" : html ` · <a class="k-link" href="/t/${encodeURIComponent(one.taskId)}">Open task</a>`}</li>`)}</ul>`;
|
|
599
|
+
const shipAct = running || diff.changedFiles.length === 0 ? "" : postForm(`/direct-chats/${thread.id}/ship-review`, btn("Review Ship", { variant: "primary", type: "submit" }));
|
|
600
|
+
const body = html `<h1>${thread.title || "Direct Chat"}</h1><p class="k-note">${thread.project} · ${thread.provider}${thread.modelId ? ` · ${thread.modelId}` : ""}${running ? " · Working" : ""}</p>${turnHtml}<h2>Changes</h2>${changes}<h2>Ship</h2>${shipped}${shipAct === "" && ships.length === 0 ? html `<p class="k-note">${running ? "Ship opens when it finishes." : "Nothing to ship yet."}</p>` : shipAct}<p><a class="k-link" href="/direct-chats">All Direct Chats</a></p>`;
|
|
601
|
+
return runtime.sendScreen(ctx.response, 200, screen(thread.title || "Direct Chat", body, { chrome: runtime.chromeFor(thread.repo, "tasks") }));
|
|
602
|
+
}
|
|
603
|
+
async function pageShipReview(ctx) {
|
|
604
|
+
const gate = admit(ctx, "read");
|
|
605
|
+
if (!gate.ok)
|
|
606
|
+
return pageRefusal(ctx, gate.status, gate.error);
|
|
607
|
+
const threadId = PAGE_PATH.exec(ctx.url.pathname)?.[1] ?? "";
|
|
608
|
+
const thread = host.getThreadRecord(gate.who.name, threadId);
|
|
609
|
+
if (thread === null || !canReachThread(gate.who.name, thread))
|
|
610
|
+
return pageRefusal(ctx, 404, "That Direct Chat isn't here.");
|
|
611
|
+
const res = previewDirectChatShip(store, { stateRoot: host.stateRoot, owner: gate.who.name, threadId, mode: undefined, title: undefined, goal: undefined });
|
|
612
|
+
if (!res.ok)
|
|
613
|
+
return pageRefusal(ctx, res.status, res.error);
|
|
614
|
+
const preview = res.preview;
|
|
615
|
+
const local = gate.who.authority === "local-owner";
|
|
616
|
+
const facts = html `<ul><li>${preview.mode === "keep-branch" ? "Saved as branch" : "Shipped from branch"} <span class="k-mono">${preview.branch}</span></li><li>${preview.changedFiles.length} ${preview.changedFiles.length === 1 ? "file" : "files"}: ${preview.changedFiles.slice(0, 20).join(", ")}${preview.changedFiles.length > 20 ? "…" : ""}</li><li>${preview.checkCommand === null ? "No check command" : html `Check: <span class="k-mono">${preview.checkCommand}</span>`}</li><li>${preview.mergeSummary}</li>${preview.autoMergeReason === null ? "" : html `<li>${preview.autoMergeReason}</li>`}</ul>`;
|
|
617
|
+
const form = postForm(`/direct-chats/${threadId}/ship`, html `${local ? "" : html `<label>Password<input type="password" name="password" autocomplete="current-password" required></label>`}${btn(preview.mode === "keep-branch" ? "Save the branch" : "Ship it", { variant: "primary", type: "submit" })} ${btn("Cancel", { variant: "ghost", href: `/direct-chats/${threadId}` })}`, { hidden: { mode: preview.mode, termsDigest: preview.termsDigest, title: preview.title, goal: preview.goal } });
|
|
618
|
+
return runtime.sendScreen(ctx.response, 200, screen("Ship", html `<h1>Ship ${preview.title}</h1>${facts}${form}`, { chrome: runtime.chromeFor(thread.repo, "tasks") }));
|
|
619
|
+
}
|
|
620
|
+
async function pageShip(ctx) {
|
|
621
|
+
const gate = admit(ctx, "direct-chat-ship");
|
|
622
|
+
if (!gate.ok)
|
|
623
|
+
return pageRefusal(ctx, gate.status, gate.error);
|
|
624
|
+
const threadId = PAGE_PATH.exec(ctx.url.pathname)?.[1] ?? "";
|
|
625
|
+
const thread = host.getThreadRecord(gate.who.name, threadId);
|
|
626
|
+
if (thread === null || !canReachThread(gate.who.name, thread))
|
|
627
|
+
return pageRefusal(ctx, 404, "That Direct Chat isn't here.");
|
|
628
|
+
const mode = ctx.posted.get("mode") ?? "";
|
|
629
|
+
const termsDigest = ctx.posted.get("termsDigest") ?? "";
|
|
630
|
+
if ((mode !== "ship" && mode !== "keep-branch") || !HEX32.test(termsDigest))
|
|
631
|
+
return pageRefusal(ctx, 400, "That Ship isn't the one on screen. Review it again.");
|
|
632
|
+
const password = ctx.posted.get("password") ?? undefined;
|
|
633
|
+
const localOwner = gate.who.authority === "local-owner" && gate.who.session.localGeneration !== null ? { localGeneration: gate.who.session.localGeneration } : null;
|
|
634
|
+
const res = executeDirectChatShip(store, { stateRoot: host.stateRoot, owner: gate.who.name, threadId, mode, termsDigest,
|
|
635
|
+
title: ctx.posted.get("title") ?? undefined, goal: ctx.posted.get("goal") ?? undefined, password, localOwner });
|
|
636
|
+
if (!res.ok)
|
|
637
|
+
return pageRefusal(ctx, res.status, res.error);
|
|
638
|
+
host.refreshDiffCache(thread);
|
|
639
|
+
deps.bus.publish({ revision: `dc:${threadId}:ship:${Date.now()}` });
|
|
640
|
+
return redirect(ctx.response, `/direct-chats/${threadId}`);
|
|
641
|
+
}
|
|
561
642
|
return {
|
|
562
643
|
host,
|
|
563
644
|
registrations: handlersOf("tasks", {
|
|
645
|
+
"direct-chat.page-list": pageList,
|
|
646
|
+
"direct-chat.page": pageDetail,
|
|
647
|
+
"direct-chat.page-ship-review": pageShipReview,
|
|
648
|
+
"direct-chat.page-ship": pageShip,
|
|
564
649
|
"direct-chat.list": list,
|
|
565
650
|
"direct-chat.detail": detail,
|
|
566
651
|
"direct-chat.start": start,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { inRehearsal } from "../rehearsal.js";
|
|
1
2
|
import { homedir } from "node:os";
|
|
2
3
|
import { randomBytes } from "node:crypto";
|
|
3
4
|
import { boardRunOf } from "../agent-board.js";
|
|
@@ -9,7 +10,7 @@ import { flexibleAvailable } from "../flexible-available.js";
|
|
|
9
10
|
import { laptopShipProblem } from "../flexible-laptop.js";
|
|
10
11
|
import { threadsStatusNote, tidyFlexibleSignIns } from "../flexible-sign-in.js";
|
|
11
12
|
import { FLEXIBLE_UNAVAILABLE } from "../flexible.js";
|
|
12
|
-
import { admitFlexibleThreadOwner, answerFlexibleRequest, cancelFlexibleThreadShip, closeFlexibleSessions, closeFlexibleThread, continueFlexibleThread, flexibleThreadShipTerms, latestFlexibleShip, sendBackFlexibleThread, shipFlexibleThread, tidyEndedFlexibleThreads, flexibleThreadChangeOf, flexibleThreadLiveOf, flexibleThreadsOf, FLEXIBLE_WAIT_MS, flexibleThreadsExist, flexibleWorkOpen, openFlexibleSessions, recoverFlexibleHolders, startFlexibleThread, settleFlexibleStops, tickFlexibleSessions, waitFlexibleThreadChange } from "../flexible-session.js";
|
|
13
|
+
import { admitFlexibleThreadOwner, answerFlexibleRequest, cancelFlexibleThreadShip, closeFlexibleSessions, closeFlexibleThread, continueFlexibleThread, flexibleThreadShipTerms, latestFlexibleShip, sendBackFlexibleThread, shipFlexibleThread, tidyEndedFlexibleThreads, flexibleThreadChangeOf, flexibleThreadLiveOf, flexibleThreadsOf, FLEXIBLE_WAIT_MS, flexibleThreadsExist, flexibleWorkOpen, openFlexibleSessions, recoverFlexibleHolders, startFlexibleThread, settleFlexibleStops, tickFlexibleSessions, waitFlexibleThreadChange, flexibleThreadChanges, flexibleThreadTipOf } from "../flexible-session.js";
|
|
13
14
|
import { createFlexibleLauncher } from "../flexible-launcher.js";
|
|
14
15
|
import { FLEXIBLE_NEXT_WORDS, flexibleReadiness, flexibleStartCard } from "../flexible-start.js";
|
|
15
16
|
import { summaryLines } from "../approval-summary.js";
|
|
@@ -21,7 +22,7 @@ import { packageVersion } from "../monitoring.js";
|
|
|
21
22
|
import { readChildWindow } from "../live-children-read.js";
|
|
22
23
|
import { readMainWindow } from "../live-main-read.js";
|
|
23
24
|
import { runLiveCommands } from "../store.js";
|
|
24
|
-
import { agentsReadOf, resultDiffContextOf, resultDiffFileOf, resultDiffOf, resultRunsOf, stepCardsOf, taskResultOf } from "../engine-reads.js";
|
|
25
|
+
import { agentsReadOf, resultDiffContextOf, resultDiffFileOf, resultDiffOf, resultRunsOf, stepCardsOf, taskResultOf, threadDiffFileOf, threadDiffOf } from "../engine-reads.js";
|
|
25
26
|
import { leadChatOf } from "../engine-chat.js";
|
|
26
27
|
import { remoteAllows } from "../operate-remote.js";
|
|
27
28
|
import { verifyApproverStanding } from "../principal.js";
|
|
@@ -143,6 +144,8 @@ export function createEngineHandlers(runtime) {
|
|
|
143
144
|
let flexible = null;
|
|
144
145
|
let launcher = null;
|
|
145
146
|
const openHost = () => {
|
|
147
|
+
if (inRehearsal())
|
|
148
|
+
return null;
|
|
146
149
|
if (flexible !== null)
|
|
147
150
|
return flexible;
|
|
148
151
|
const opened = openFlexibleSessions(store);
|
|
@@ -206,6 +209,41 @@ export function createEngineHandlers(runtime) {
|
|
|
206
209
|
...(known === read.facts.version ? {} : { thread: read.facts }) };
|
|
207
210
|
return sendChecked(response, 200, "liveSessionWindow", body);
|
|
208
211
|
}
|
|
212
|
+
const changesRead = new Map();
|
|
213
|
+
async function threadChanges(id) {
|
|
214
|
+
const tip = flexibleThreadTipOf(store, id);
|
|
215
|
+
const held = changesRead.get(id);
|
|
216
|
+
if (held !== undefined && tip !== null && held.tip === tip)
|
|
217
|
+
return held.changes;
|
|
218
|
+
const read = await flexibleThreadChanges(store, { thread: id });
|
|
219
|
+
if (changesRead.size >= 32)
|
|
220
|
+
changesRead.delete(changesRead.keys().next().value);
|
|
221
|
+
if (read.tip !== null && read.tip === tip)
|
|
222
|
+
changesRead.set(id, { tip: read.tip, changes: read.changes });
|
|
223
|
+
return read.changes;
|
|
224
|
+
}
|
|
225
|
+
async function liveThreadDiff(ctx) {
|
|
226
|
+
const { url, who, request, response } = ctx;
|
|
227
|
+
if (who.via !== "cookie")
|
|
228
|
+
return refusal(response, 403, "session");
|
|
229
|
+
const params = url.searchParams, fileParam = params.get("file");
|
|
230
|
+
if ([...params.keys()].some(key => key !== "file") || params.getAll("file").length > 1 || (fileParam !== null && !/^(0|[1-9][0-9]{0,5})$/.test(fileParam)))
|
|
231
|
+
return refusal(response, 400, "request");
|
|
232
|
+
const flexible = threadsRead();
|
|
233
|
+
if (flexible === null)
|
|
234
|
+
return refusal(response, 404, "thread");
|
|
235
|
+
const id = url.pathname.slice("/agents/live/thread/".length, -"/diff".length);
|
|
236
|
+
if (ownedThread(request, who, flexible, id) === null)
|
|
237
|
+
return refusal(response, 404, "thread");
|
|
238
|
+
const changes = await threadChanges(id);
|
|
239
|
+
const turn = Number(store.handle.prepare("SELECT max(seq) AS seq FROM thread_turn WHERE thread = ? AND status <> 'withdrawn'").get(id)?.["seq"] ?? 0);
|
|
240
|
+
if (ownedThread(request, who, flexible, id) === null)
|
|
241
|
+
return refusal(response, 404, "thread");
|
|
242
|
+
if (fileParam === null)
|
|
243
|
+
return sendChecked(response, 200, "resultDiff", threadDiffOf(id, turn, changes));
|
|
244
|
+
const one = threadDiffFileOf(id, turn, changes, Number(fileParam));
|
|
245
|
+
return one === null ? refusal(response, 404, "file") : sendChecked(response, 200, "resultDiffFile", one);
|
|
246
|
+
}
|
|
209
247
|
async function liveThreads(ctx) {
|
|
210
248
|
const { url, who, request, response } = ctx;
|
|
211
249
|
if (who.via !== "cookie")
|
|
@@ -516,7 +554,7 @@ export function createEngineHandlers(runtime) {
|
|
|
516
554
|
if (!sent.ok)
|
|
517
555
|
return acted(response, 409, "refused", sent.message);
|
|
518
556
|
const again = sent.resent === undefined ? "" : `Your earlier send (turn ${sent.resent.seq}) never reached the agent${sent.resent.detail === null ? "" : ` (${sent.resent.detail.slice(0, 200)})`}, so it was sent again. `;
|
|
519
|
-
return json(response, 200, { outcome: "done", words: again + (sent.replayed ? "That reply was already sent." :
|
|
557
|
+
return json(response, 200, { outcome: "done", words: again + (sent.replayed ? "That reply was already sent." : `Sent. Turn ${sent.seq} started; the agent has the conversation so far.`),
|
|
520
558
|
turn: sent.turn });
|
|
521
559
|
}
|
|
522
560
|
const threadClose = (act) => async (ctx) => {
|
|
@@ -618,7 +656,7 @@ export function createEngineHandlers(runtime) {
|
|
|
618
656
|
held, launcher, now: new Date() });
|
|
619
657
|
if (!sent.ok)
|
|
620
658
|
return acted(response, 409, "refused", sent.message);
|
|
621
|
-
return acted(response, 200, "done", `Sent back. Turn ${sent.seq} started
|
|
659
|
+
return acted(response, 200, "done", `Sent back. Turn ${sent.seq} started; the agent has the conversation so far.`);
|
|
622
660
|
}
|
|
623
661
|
async function leadChat(ctx) {
|
|
624
662
|
const { url, who, request, response, now } = ctx;
|
|
@@ -755,7 +793,7 @@ export function createEngineHandlers(runtime) {
|
|
|
755
793
|
}
|
|
756
794
|
},
|
|
757
795
|
registrations: [
|
|
758
|
-
...handlersOf("pages", { "engine.hello": hello, "engine.agents": agents, "engine.agents-check": agentsCheck, "engine.chat": leadChat, "agents.live.run": liveRun, "agents.live.thread": liveThread, "agents.live.threads": liveThreads,
|
|
796
|
+
...handlersOf("pages", { "engine.hello": hello, "engine.agents": agents, "engine.agents-check": agentsCheck, "engine.chat": leadChat, "agents.live.run": liveRun, "agents.live.thread": liveThread, "agents.live.thread.diff": liveThreadDiff, "agents.live.threads": liveThreads,
|
|
759
797
|
"agents.live.thread.answer": threadAnswer, "agents.live.thread.start": threadStart, "agents.live.thread.turn": threadTurn, "agents.live.thread.stop": threadClose("stop"), "agents.live.thread.end": threadClose("end"), "agents.live.thread.ship": threadShip, "agents.live.thread.ship-cancel": threadShipCancel, "agents.live.thread.ship-send-back": threadShipSendBack }),
|
|
760
798
|
...handlersOf("tasks", { "task.steps": taskSteps, "task.approval": taskApproval, "task.diff": taskDiff, "task.result": taskResult }),
|
|
761
799
|
...handlersOf("people", {}, { "edge.login-link-json": redeemLink }),
|
|
@@ -580,8 +580,9 @@ export function reviewCockpitDetailParts(view, csrf, noted, canRetryReview, tab,
|
|
|
580
580
|
const hardStop = hardBlockerOf(assignment) ?? view.detail.completeRefusal ?? null;
|
|
581
581
|
const blocked = hardStop ?? cantAcceptYetOf(proof?.verdict ?? null, proof?.reasons ?? [], accepted);
|
|
582
582
|
const youCheck = panel.panel.youCheck;
|
|
583
|
+
const shared = accepted || assignment?.receipt == null ? null : owedAcceptance(assignment.receipt, assignment.readiness?.blockers ?? []);
|
|
583
584
|
const owed = accepted ? null : youCheck?.accept != null ? { note: null } : panel.panel.need?.accept != null ? { note: panel.panel.need.accept.note }
|
|
584
|
-
: blocked === ACCEPT_NEEDS_REASON ? { note: "Why is this safe to accept?" } : null;
|
|
585
|
+
: shared === "person-check" ? { note: null } : shared === "exception" || blocked === ACCEPT_NEEDS_REASON ? { note: "Why is this safe to accept?" } : null;
|
|
585
586
|
const complete = hardStop === null && assignment?.state === "ready-to-check" && assignment.receipt !== null && canRetryReview && csrf !== ""
|
|
586
587
|
? { action: `${taskHref(view.taskId)}/complete`, receipt: assignment.receipt.digest, run: run.id, accept: owed, ...(host.kind === "task" ? { returnTo: at() } : {}) } : null;
|
|
587
588
|
if (complete !== null)
|
|
@@ -1606,6 +1607,7 @@ export function resultPanelParts(detail, o) {
|
|
|
1606
1607
|
html `<details class="result-pin"><summary>Attach to a file or line</summary>`,
|
|
1607
1608
|
html `<div class="diff-comment-target"><label>File<input type="text" name="path" placeholder="src/…" aria-label="file" class="mono"></label>`,
|
|
1608
1609
|
html `<label>Line<input type="text" name="line" placeholder="—" aria-label="line" inputmode="numeric"></label></div></details>`,
|
|
1610
|
+
detail.buildNowOnSendBack === true ? html `<label class="meta result-build-now"><input type="checkbox" name="approve" value="1" data-build-now> Build again right away, on the same terms with these notes</label>` : "",
|
|
1609
1611
|
html `<div class="result-feedback-actions"><button type="submit" name="intent" value="revise" data-request-changes>Send back</button><button type="submit" name="intent" value="note" class="quiet" data-save-feedback>Save for later</button></div>`,
|
|
1610
1612
|
]), { attrs: { class: "diff-comment-form", id: "comment-form" }, returnTo: o.returnTo, hidden: { tab: o.tab, request: o.requestToken } })}</details>`);
|
|
1611
1613
|
}
|
|
@@ -1285,7 +1285,7 @@ export function taskBodyParts(data) {
|
|
|
1285
1285
|
const humanReview = manualReviewOnly({ verdict: proof.proofVerdict ?? "", reasons: proof.proofReasons, matrix: proof.proofMatrix });
|
|
1286
1286
|
const acceptForm = accepted || data.csrf === ""
|
|
1287
1287
|
? ""
|
|
1288
|
-
: html `<details class="proof-exception"><summary>${humanReview ? "Accept result" : "Accept with exception"}</summary>${postForm(`${taskHref(task.id)}/accept-proof`, html `<input type="text" name="note" maxlength="500" placeholder="${humanReview ? "What did you verify?" : "Why is this safe to accept?"}" aria-label="${humanReview ? "review note" : "exception reason"}" required><button type="submit">${humanReview ? "Accept result" : "Accept with exception"}</button>`, {
|
|
1288
|
+
: html `<details class="proof-exception"><summary>${humanReview ? "Accept result" : "Accept with exception"}</summary>${postForm(`${taskHref(task.id)}/accept-proof`, html `<input type="text" name="note" maxlength="500" placeholder="${humanReview ? "What did you verify?" : "Why is this safe to accept?"}" aria-label="${humanReview ? "review note" : "exception reason"}"${humanReview ? "" : html ` required`}><button type="submit">${humanReview ? "Accept result" : "Accept with exception"}</button>`, {
|
|
1289
1289
|
attrs: { class: "proof-exception-form" },
|
|
1290
1290
|
hidden: { run: proof.runId },
|
|
1291
1291
|
})}</details>`;
|
|
@@ -2150,6 +2150,7 @@ export function taskBodyParts(data) {
|
|
|
2150
2150
|
{ key: "route-change", html: data.routeChange == null ? "" : htmlString(html `<div class="card"><p>${data.routeChange}</p></div>`) },
|
|
2151
2151
|
{ key: "fast-grown", html: data.fastGrown == null || data.csrf === "" ? "" : htmlString(html `<div class="card"><p>${data.fastGrown}</p>${postForm(`${taskHref(task.id)}/keep-grown`, btn("Approve it", { variant: "primary", type: "submit" }))}</div>`) },
|
|
2152
2152
|
{ key: "pull-request", html: fragmentString(pullRequestCard) },
|
|
2153
|
+
{ key: "landing", html: data.landing == null ? "" : htmlString(landingCardHtml(data.landing, data.csrf)) },
|
|
2153
2154
|
{ key: "needs-scope", html: fragmentString(needsScopeCard) },
|
|
2154
2155
|
{ key: "mirror", html: fragmentString(mirrorCard) }, { key: "attempt", html: fragmentString(attemptPanel), ...(liveRunId === null ? {} : { instance: String(liveRunId) }) },
|
|
2155
2156
|
].filter(one => one.html !== ""),
|
|
@@ -2340,3 +2341,11 @@ function agentlessRoute(dispatch, route) {
|
|
|
2340
2341
|
export function cancelPinsOf(state, runs) {
|
|
2341
2342
|
return { state, run: runs.length === 0 ? "none" : String(Math.max(...runs.map(one => one.id))) };
|
|
2342
2343
|
}
|
|
2344
|
+
export function landingCardHtml(landing, csrf) {
|
|
2345
|
+
const act = csrf === "" ? "" : landing.canLand
|
|
2346
|
+
? postForm(`${taskHref(landing.taskId)}/land`, btn("Land it", { type: "submit" }))
|
|
2347
|
+
: landing.canUndo ? postForm(`${taskHref(landing.taskId)}/land`, btn("Undo landing", { variant: "ghost", type: "submit" }), { hidden: { undo: "1" } }) : "";
|
|
2348
|
+
const title = landing.landed !== null && !landing.canLand ? landing.landed : "Not on your branch yet";
|
|
2349
|
+
const meta = landing.canLand ? "You see where it lands before anything moves." : "";
|
|
2350
|
+
return html `<section class="card" id="land" data-landing="${landing.landed === null ? "no" : "yes"}"><strong>${title}</strong>${meta === "" ? "" : html `<p class="meta">${meta}</p>`}${act}</section>`;
|
|
2351
|
+
}
|
|
@@ -64,6 +64,7 @@ const LOCAL_POSTS = Object.freeze({
|
|
|
64
64
|
"task.act.resume-arm": "resume-run",
|
|
65
65
|
"task.act.resume": "resume-run",
|
|
66
66
|
"task.act.complete": "complete-task",
|
|
67
|
+
"task.act.land": "land-task",
|
|
67
68
|
"task.act.plan": "request-plan",
|
|
68
69
|
"task.act.requeue": "retry-build",
|
|
69
70
|
"task.act.route": "change-task-agents",
|
|
@@ -87,6 +88,8 @@ const LOCAL_POSTS = Object.freeze({
|
|
|
87
88
|
"direct-chat.repair": "direct-chat-manage",
|
|
88
89
|
"direct-chat.ship-preview": "read",
|
|
89
90
|
"direct-chat.ship": "direct-chat-ship",
|
|
91
|
+
"direct-chat.page-ship-review": "read",
|
|
92
|
+
"direct-chat.page-ship": "direct-chat-ship",
|
|
90
93
|
"direct-chat.ship-cancel": "direct-chat-manage",
|
|
91
94
|
"term.agent-sign-in": "agent-sign-in",
|
|
92
95
|
"term.agent-install": "agent-install",
|
|
@@ -273,6 +276,8 @@ get("tasks", "term.socket", `^\\/term\\/${TERMINAL}\\/socket$`, { ...TERM, sampl
|
|
|
273
276
|
const DIRECT_CHAT = { ...free, callers: ["cookie"], project: "none", limited: "deny", ...operator("Direct chat is for local solo operators.", "/") };
|
|
274
277
|
get("tasks", "direct-chat.list", "/engine/direct-chats", DIRECT_CHAT);
|
|
275
278
|
get("tasks", "direct-chat.detail", `^\\/engine\\/direct-chats\\/${TERMINAL}$`, { ...DIRECT_CHAT, sample: `/engine/direct-chats/${"a".repeat(32)}` });
|
|
279
|
+
get("tasks", "direct-chat.page-list", "/direct-chats", DIRECT_CHAT);
|
|
280
|
+
get("tasks", "direct-chat.page", `^\\/direct-chats\\/${TERMINAL}$`, { ...DIRECT_CHAT, sample: `/direct-chats/${"a".repeat(32)}` });
|
|
276
281
|
get("tasks", "direct-chat.artifact", `^\\/engine\\/direct-chats\\/${TERMINAL}\\/artifacts\\/${TERMINAL}$`, { ...DIRECT_CHAT, sample: `/engine/direct-chats/${"a".repeat(32)}/artifacts/${"b".repeat(32)}` });
|
|
277
282
|
get("pages", "projects.browse", "/projects/browse", free);
|
|
278
283
|
get("pages", "projects.pick", "/projects/pick", { ...free, callers: ["cookie"], project: "none", ...approver("Sign in as an approver to add projects.", "/projects") });
|
|
@@ -321,6 +326,7 @@ get("pages", "agents.live", "/agents/live", { limited: "unscoped", callers: ["co
|
|
|
321
326
|
get("pages", "agents.live.read", `^\\/agents\\/live\\/${ID}$`, { limited: "unscoped", callers: ["cookie"], ...free, sample: "/agents/live/1" });
|
|
322
327
|
get("pages", "agents.live.run", `^\\/agents\\/live\\/run\\/${ID}$`, { limited: "unscoped", callers: ["cookie", "bearer"], ...free, sample: "/agents/live/run/1" });
|
|
323
328
|
get("pages", "agents.live.thread", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}$", { limited: "unscoped", callers: ["cookie"], ...free, sample: `/agents/live/thread/${"a".repeat(32)}` });
|
|
329
|
+
get("pages", "agents.live.thread.diff", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/diff$", { limited: "unscoped", callers: ["cookie"], ...free, sample: `/agents/live/thread/${"a".repeat(32)}/diff` });
|
|
324
330
|
get("pages", "agents.live.threads", "/agents/live/threads", { limited: "unscoped", callers: ["cookie"], ...free });
|
|
325
331
|
post("pages", "agents.live.thread.answer", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/answer$", { limited: "unscoped", callers: ["cookie"], project: "none", sample: `/agents/live/thread/${"a".repeat(32)}/answer` });
|
|
326
332
|
post("pages", "agents.live.thread.start", "/agents/live/thread", { limited: "unscoped", callers: ["cookie"], project: "none", ...approver("An approver starts threads.") });
|
|
@@ -440,6 +446,8 @@ post("tasks", "direct-chat.apply-main", `^\\/engine\\/direct-chats\\/${TERMINAL}
|
|
|
440
446
|
post("tasks", "direct-chat.repair", `^\\/engine\\/direct-chats\\/${TERMINAL}\\/repair$`, { ...DIRECT_CHAT, sample: `/engine/direct-chats/${"a".repeat(32)}/repair` });
|
|
441
447
|
post("tasks", "direct-chat.ship-preview", `^\\/engine\\/direct-chats\\/${TERMINAL}\\/ship-preview$`, { ...DIRECT_CHAT, sample: `/engine/direct-chats/${"a".repeat(32)}/ship-preview` });
|
|
442
448
|
post("tasks", "direct-chat.ship", `^\\/engine\\/direct-chats\\/${TERMINAL}\\/ship$`, { ...DIRECT_CHAT, scope: "step-up", sample: `/engine/direct-chats/${"a".repeat(32)}/ship` });
|
|
449
|
+
post("tasks", "direct-chat.page-ship-review", `^\\/direct-chats\\/${TERMINAL}\\/ship-review$`, { ...DIRECT_CHAT, sample: `/direct-chats/${"a".repeat(32)}/ship-review` });
|
|
450
|
+
post("tasks", "direct-chat.page-ship", `^\\/direct-chats\\/${TERMINAL}\\/ship$`, { ...DIRECT_CHAT, scope: "step-up", sample: `/direct-chats/${"a".repeat(32)}/ship` });
|
|
443
451
|
post("tasks", "direct-chat.ship-cancel", `^\\/engine\\/direct-chats\\/${TERMINAL}\\/ship-cancel$`, { ...DIRECT_CHAT, sample: `/engine/direct-chats/${"a".repeat(32)}/ship-cancel` });
|
|
444
452
|
for (const one of ["send", "stop", "resume", "recover", "continue", "ship", "answer"])
|
|
445
453
|
post("tasks", `code.${one}-send`, `^\\/code\\/${SESSION}\\/${one}$`, { ...CODING_ACT, sample: `/code/${"a".repeat(32)}/${one}` });
|
|
@@ -616,6 +624,7 @@ post("tasks", "task.act.route", `^\\/t\\/${TASK}\\/route$`, { project: "task", l
|
|
|
616
624
|
post("tasks", "task.act.retry-review", `^\\/t\\/${TASK}\\/retry-review$`, { project: "task", limited: "resource", sample: "/t/one/retry-review" });
|
|
617
625
|
post("tasks", "task.act.complete", `^\\/t\\/${TASK}\\/complete$`, { project: "task", limited: "resource", sample: "/t/one/complete", ...approver("Only an approver can mark a result complete.") });
|
|
618
626
|
post("tasks", "task.act.merge", `^\\/t\\/${TASK}\\/merge$`, { project: "task", limited: "resource", sample: "/t/one/merge", ...approver("Only an approver can merge.") });
|
|
627
|
+
post("tasks", "task.act.land", `^\\/t\\/${TASK}\\/land$`, { project: "task", limited: "resource", sample: "/t/one/land", ...approver("Only an approver can land work.") });
|
|
619
628
|
post("tasks", "task.act.recheck-stopped", `^\\/t\\/${TASK}\\/recheck-stopped$`, { project: "task", limited: "resource", sample: "/t/one/recheck-stopped", ...approver("Only an approver can have Toolroll check a build again.") });
|
|
620
629
|
post("tasks", "task.act.stop-carrying", `^\\/t\\/${TASK}\\/stop-carrying$`, { project: "task", limited: "resource", sample: "/t/one/stop-carrying", ...approver("Only an approver can stop carrying a release.") });
|
|
621
630
|
post("tasks", "task.act.stop", `^\\/t\\/${TASK}\\/stop$`, { project: "task", limited: "resource", sample: "/t/one/stop" });
|
package/dist/server/settings.js
CHANGED
|
@@ -495,10 +495,10 @@ ${connectionHtml(asked, connection, task)}${command === null ? "" : html `<p>On
|
|
|
495
495
|
}
|
|
496
496
|
async function pullRequestsPage(ctx) {
|
|
497
497
|
const { url, who, response, project } = ctx;
|
|
498
|
-
const repo = url.searchParams.get("repo") ?? "";
|
|
499
498
|
const known = [...new Set([...managedRepos(), ...store.knownRepos(), ...store.listProjects().map(one => one.path)])];
|
|
500
|
-
|
|
501
|
-
|
|
499
|
+
const repo = projectForPage(ctx, "/settings/pull-requests", "Pull requests", known);
|
|
500
|
+
if (repo === null || who.via !== "cookie")
|
|
501
|
+
return;
|
|
502
502
|
const publishing = publishingOf(store, repo);
|
|
503
503
|
const canChange = who.role === "approver" && !store.isDemo();
|
|
504
504
|
const check = publishing.on || !canChange ? null : lastChecks.known(`publishing:${repo}`)?.value ?? "unchecked";
|
|
@@ -508,10 +508,10 @@ ${connectionHtml(asked, connection, task)}${command === null ? "" : html `<p>On
|
|
|
508
508
|
}
|
|
509
509
|
async function checksPage(ctx) {
|
|
510
510
|
const { url, who, response, project } = ctx;
|
|
511
|
-
const repo = url.searchParams.get("repo") ?? "";
|
|
512
511
|
const known = [...new Set([...managedRepos(), ...store.knownRepos(), ...store.listProjects().map(one => one.path)])];
|
|
513
|
-
|
|
514
|
-
|
|
512
|
+
const repo = projectForPage(ctx, "/settings/checks", "Checks", known);
|
|
513
|
+
if (repo === null || who.via !== "cookie")
|
|
514
|
+
return;
|
|
515
515
|
const quick = liveQuickCommand(store, repo);
|
|
516
516
|
const body = (checkSettingsHtml({ repo, name: projectName(repo), csrf: who.session.csrf, canChange: who.role === "approver" && !store.isDemo(),
|
|
517
517
|
level: projectCheckLevel(store, repo).level, full: store.liveVerifyCommand(repo), quick, suggestion: quick === null ? suggestQuickCommand(repo) : null,
|
|
@@ -571,7 +571,7 @@ ${connectionHtml(asked, connection, task)}${command === null ? "" : html `<p>On
|
|
|
571
571
|
if (!authenticateCredential(who, body.get("password") ?? "").ok)
|
|
572
572
|
return back("problem", "Enter your Toolroll password to turn Passwordless on.");
|
|
573
573
|
setPasswordless(store, true, who.name, now);
|
|
574
|
-
return back("said", "Passwordless is on.
|
|
574
|
+
return back("said", "Passwordless is on. Approvals need no password now; changes that add a way in still ask.");
|
|
575
575
|
}
|
|
576
576
|
async function knowledgePage(ctx) {
|
|
577
577
|
const { url, who, response, project } = ctx;
|
|
@@ -3432,6 +3432,30 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
3432
3432
|
: self ? `Removed.${stopWords} Your threads can't reach Claude until you add one again. The token still works at Claude until you revoke it in your Claude account.`
|
|
3433
3433
|
: `Removed ${person}'s Claude sign-in for threads.${stopWords} Their threads can't reach Claude until they add one again.`);
|
|
3434
3434
|
}
|
|
3435
|
+
function projectForPage(ctx, path, title, known) {
|
|
3436
|
+
const { url, who, response, project } = ctx;
|
|
3437
|
+
const named = url.searchParams.get("repo");
|
|
3438
|
+
if (who.via !== "cookie") {
|
|
3439
|
+
refuse(response, who, 404, "No such project.", "/projects");
|
|
3440
|
+
return null;
|
|
3441
|
+
}
|
|
3442
|
+
if (named !== null) {
|
|
3443
|
+
if (!known.includes(named) || !visible(named)) {
|
|
3444
|
+
refuse(response, who, 404, "No such project.", "/projects");
|
|
3445
|
+
return null;
|
|
3446
|
+
}
|
|
3447
|
+
return named;
|
|
3448
|
+
}
|
|
3449
|
+
const mine = known.filter(repo => visible(repo));
|
|
3450
|
+
if (project != null && mine.includes(project))
|
|
3451
|
+
return project;
|
|
3452
|
+
if (mine.length === 1)
|
|
3453
|
+
return mine[0];
|
|
3454
|
+
const body = mine.length === 0 ? html `<p>No projects yet. <a class="k-link" href="/projects">Add one on Projects</a>.</p>`
|
|
3455
|
+
: html `<p>Pick a project.</p>${projectPicker(path, mine.map(repo => ({ repo, name: projectName(repo) })), "")}`;
|
|
3456
|
+
sendScreen(response, 200, screen(title, settingsSubPage("projects", title, body), { chrome: chromeFor(project, "projects") }));
|
|
3457
|
+
return null;
|
|
3458
|
+
}
|
|
3435
3459
|
return { registrations, modelsView };
|
|
3436
3460
|
}
|
|
3437
3461
|
function savedLoginOf(store) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { localOwnerRefusal } from "../local-owner.js";
|
|
2
|
+
import { landedWords, landingOf, publishesThroughPullRequests } from "../local-landing.js";
|
|
2
3
|
import { requestContext } from "./request-context.js";
|
|
3
4
|
import { heldFindingCount } from "../findings.js";
|
|
4
5
|
import { familyInWebReach } from "../findings.js";
|
|
@@ -605,6 +606,18 @@ export function createTaskViews(runtime) {
|
|
|
605
606
|
return null;
|
|
606
607
|
return { taskId: rootId, view: null, offer: { taskId: receipt.taskId, runId: receipt.runId, digest: receipt.digest }, target };
|
|
607
608
|
}
|
|
609
|
+
function taskLandingOf(taskId, who) {
|
|
610
|
+
const repo = runtime.store.lookupRef(taskId)?.repo ?? null;
|
|
611
|
+
if (repo === null || publishesThroughPullRequests(runtime.store, repo))
|
|
612
|
+
return null;
|
|
613
|
+
const rootId = runtime.familyOf(taskId)?.root.id ?? taskId;
|
|
614
|
+
const record = landingOf(runtime.store, rootId);
|
|
615
|
+
const complete = assignmentOf(runtime.store, taskId, runtime.clock(), runtime.workAccess(), runtime.evidenceRoot)?.state === "complete";
|
|
616
|
+
if (!complete && record === null)
|
|
617
|
+
return null;
|
|
618
|
+
const person = who.via === "cookie" && who.role === "approver";
|
|
619
|
+
return { taskId: rootId, landed: landedWords(runtime.store, rootId), canLand: person && complete && (record === null || record.undone), canUndo: person && record !== null && !record.undone };
|
|
620
|
+
}
|
|
608
621
|
function failureOf(runs, assignment, readLog = true) {
|
|
609
622
|
const last = latestFinishedAttempt(runs);
|
|
610
623
|
if (last === null)
|
|
@@ -736,6 +749,7 @@ export function createTaskViews(runtime) {
|
|
|
736
749
|
if (resultSection !== null && extras.result.current)
|
|
737
750
|
presentedData.resultSection = resultSection;
|
|
738
751
|
presentedData.pullRequest = taskPullRequestOf(taskId, who);
|
|
752
|
+
presentedData.landing = taskLandingOf(taskId, who);
|
|
739
753
|
if (family !== null && family.problem === null) {
|
|
740
754
|
presentedData.family = { root: { id: family.root.id, title: family.root.title, createdAt: family.root.createdAt, goal: runtime.store.getScope(family.root.id)?.goal ?? null },
|
|
741
755
|
versions: family.versions.map(one => ({ id: one.id, title: one.title, state: one.state })),
|
|
@@ -1038,6 +1052,7 @@ export function createTaskViews(runtime) {
|
|
|
1038
1052
|
terminal,
|
|
1039
1053
|
publication,
|
|
1040
1054
|
pullRequestTo: pullRequestTargetOf(run.id),
|
|
1055
|
+
buildNowOnSendBack: who.via === "cookie" && who.authority === "local-owner" && who.role === "approver",
|
|
1041
1056
|
publishing: pullRequestTargetOf(run.id) !== null ? "pull-request" : publishingOf(runtime.store, runtime.store.refById(run.taskRef)?.repo ?? null).on ? "other" : "off",
|
|
1042
1057
|
ciFailing: publication !== null && publication.prNumber !== null && runtime.store.hasOpenCiEpisode(publication.githubRepo, publication.prNumber),
|
|
1043
1058
|
files,
|
package/dist/server/tasks.js
CHANGED
|
@@ -21,7 +21,8 @@ import { existsSync, lstatSync, realpathSync } from "node:fs";
|
|
|
21
21
|
import {} from "node:http";
|
|
22
22
|
import { withActor } from "../actor.js";
|
|
23
23
|
import { gateWords } from "../approval-policy.js";
|
|
24
|
-
import { acceptAndCompleteAsOperator, assignmentOf, checkAssignmentAsOperator } from '../assignment.js';
|
|
24
|
+
import { acceptAndCompleteAsOperator, assignmentOf, checkAssignmentAsOperator, owedAcceptance } from '../assignment.js';
|
|
25
|
+
import { ACCEPT_NEEDS_REASON } from '../result-acts.js';
|
|
25
26
|
import { attentionCardForUnverifiedDone, classify } from "../board.js";
|
|
26
27
|
import { nightlyNeedsYou } from "../nightly-github.js";
|
|
27
28
|
import { codingHandoffPreview, createCodingHandoff } from '../coding-handoff.js';
|
|
@@ -92,8 +93,9 @@ import { approvalFormDigest, approveRefusalWords, checkProgressHtml, consentDoor
|
|
|
92
93
|
import {} from "./session.js";
|
|
93
94
|
import { approveReleaseCard, releaseApprovalCard, releaseSheetHref, releaseTaskOf } from "../release-approval.js";
|
|
94
95
|
import { releaseSheetPage } from "./render-release.js";
|
|
95
|
-
import { approvalFactsNow } from "./kit.js";
|
|
96
|
-
import {
|
|
96
|
+
import { approvalFactsNow, btn } from "./kit.js";
|
|
97
|
+
import { land, landingWords, publishesThroughPullRequests, PULL_REQUESTS_INSTEAD, readLanding } from "../local-landing.js";
|
|
98
|
+
import { localOwnerRefusal, withLocalAct } from "../local-owner.js";
|
|
97
99
|
import { firstTaskRouted } from "../welcome-facts.js";
|
|
98
100
|
import { plural } from "../design/kit.js";
|
|
99
101
|
export const FIRST_TASK_DETECT_WAIT_MS = 8_000;
|
|
@@ -1086,7 +1088,20 @@ export function createTasksHandlers(runtime) {
|
|
|
1086
1088
|
const typedNote = (body.get("note") ?? "").trim();
|
|
1087
1089
|
const sentNote = withContext(body.get("context"), typedNote);
|
|
1088
1090
|
if (body.get("intent") === "revise") {
|
|
1091
|
+
const buildNow = body.get("approve") === "1" && who.via === "cookie" && who.authority === "local-owner" && who.role === "approver";
|
|
1089
1092
|
const result = requestResultChanges(store, evidenceRoot, {
|
|
1093
|
+
...(buildNow ? {
|
|
1094
|
+
currentResult: () => {
|
|
1095
|
+
const task = store.externalIdFor(found.taskRef);
|
|
1096
|
+
const current = task === null ? null : assignmentOf(store, task, now, { principal: "operator", repos: admissionList() }, evidenceRoot);
|
|
1097
|
+
return current !== null && current.activeTaskId === task && current.receipt?.runId === id ? null
|
|
1098
|
+
: "A newer build of this task came in since this page was drawn. Open the current result, then send it back.";
|
|
1099
|
+
},
|
|
1100
|
+
approveNow: (child) => withLocalAct("approve-plan", () => {
|
|
1101
|
+
const filed = store.getScope(child);
|
|
1102
|
+
return filed !== null && !approvalOf(filed).approved && approveScope(store, child, who.name, now, filed.digest, "").ok;
|
|
1103
|
+
}),
|
|
1104
|
+
} : {}),
|
|
1090
1105
|
run: id, batch: body.get("batch"), source: body.get("source"), actor: who.name,
|
|
1091
1106
|
repos: admissionList(), includeUnplaced: visible(null), allowMode: who.via === "cookie",
|
|
1092
1107
|
origin: who.via === "cookie" ? "person" : "machine", typedWords: who.via === "cookie" ? typedNote : null,
|
|
@@ -2102,6 +2117,11 @@ export function createTasksHandlers(runtime) {
|
|
|
2102
2117
|
return redirect(response, withRefusal(back, "reason"));
|
|
2103
2118
|
return taskScreen(response, who, taskId, ACCEPT_ANYWAY_NEEDS_REASON, 400);
|
|
2104
2119
|
}
|
|
2120
|
+
if (note === null) {
|
|
2121
|
+
const current = assignmentOf(store, taskId, now, { principal: "operator", repos: admissionList() }, evidenceRoot);
|
|
2122
|
+
if (current?.receipt?.runId === latest.id && owedAcceptance(current.receipt, current.readiness?.blockers ?? []) === "exception")
|
|
2123
|
+
return taskScreen(response, who, taskId, `${ACCEPT_NEEDS_REASON}.`, 400);
|
|
2124
|
+
}
|
|
2105
2125
|
store.acceptProof(latest.id, verifiedAuthor(who.name), note, now);
|
|
2106
2126
|
return redirect(response, body.get("return") === null ? taskHref(taskId) : safeReturn(body.get("return")));
|
|
2107
2127
|
}
|
|
@@ -2627,6 +2647,7 @@ export function createTasksHandlers(runtime) {
|
|
|
2627
2647
|
"task.act.retry-review": taskAct("retry-review"),
|
|
2628
2648
|
"task.act.complete": taskAct("complete"),
|
|
2629
2649
|
"task.act.merge": taskMerge,
|
|
2650
|
+
"task.act.land": taskLand,
|
|
2630
2651
|
"task.act.recheck-stopped": taskRecheckStopped,
|
|
2631
2652
|
"task.act.stop": taskAct("stop"),
|
|
2632
2653
|
"task.act.stop-carrying": taskAct("stop-carrying"),
|
|
@@ -2766,6 +2787,45 @@ export function createTasksHandlers(runtime) {
|
|
|
2766
2787
|
default: return refused("Reload the page and try again.");
|
|
2767
2788
|
}
|
|
2768
2789
|
}
|
|
2790
|
+
async function taskLand(ctx) {
|
|
2791
|
+
const { url, who, response, posted, now } = ctx;
|
|
2792
|
+
const act = matchTaskPath(url.pathname, "/land$");
|
|
2793
|
+
if (act === null)
|
|
2794
|
+
return noPage(who, response);
|
|
2795
|
+
const body = readForm(posted, CONSOLE_FORMS.taskLand);
|
|
2796
|
+
if (store.isDemo())
|
|
2797
|
+
return taskScreen(response, who, act.taskId, "The demo lands nothing.", 403);
|
|
2798
|
+
const ref = store.lookupRef(act.taskId);
|
|
2799
|
+
if (ref === null || !visible(ref.repo) || who.via !== "cookie")
|
|
2800
|
+
return refuse(response, who, 404, "no such task", "/");
|
|
2801
|
+
if (ref.repo !== null && publishesThroughPullRequests(store, ref.repo))
|
|
2802
|
+
return taskScreen(response, who, act.taskId, PULL_REQUESTS_INSTEAD, 409);
|
|
2803
|
+
const local = who.authority === "local-owner";
|
|
2804
|
+
const principal = local ? null : leadPrincipal(who);
|
|
2805
|
+
if (!local && principal === null)
|
|
2806
|
+
return taskScreen(response, who, act.taskId, "Your access changed. Sign in again.", 403);
|
|
2807
|
+
const access = { repos: principal !== null ? principal.repos : store.knownRepos().filter(repo => store.accountCanAccess(who.name, repo)) };
|
|
2808
|
+
const undo = body.get("undo") === "1";
|
|
2809
|
+
const into = (body.get("into") ?? "").trim();
|
|
2810
|
+
const options = { root: evidenceRoot, ...(into === "" ? {} : { into }), ...(undo ? { undo: true } : {}) };
|
|
2811
|
+
const key = body.get("key") ?? "";
|
|
2812
|
+
if (key === "") {
|
|
2813
|
+
const read = await readLanding(store, act.taskId, access, now, options);
|
|
2814
|
+
if (!read.ok)
|
|
2815
|
+
return taskScreen(response, who, act.taskId, read.message, 409);
|
|
2816
|
+
if (!("plan" in read))
|
|
2817
|
+
return redirect(response, taskHref(act.taskId));
|
|
2818
|
+
const plan = read.plan;
|
|
2819
|
+
const title = undo ? "Undo landing" : `Land on ${plan.branch}`;
|
|
2820
|
+
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(act.taskId) })}`, { hidden: { key: plan.key, ...(into === "" ? {} : { into }), ...(undo ? { undo: "1" } : {}) } })}`, { chrome: chromeFor(ref.repo, "tasks") }));
|
|
2821
|
+
}
|
|
2822
|
+
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 });
|
|
2823
|
+
if (!done.ok)
|
|
2824
|
+
return taskScreen(response, who, act.taskId, done.message, done.reason === "authority" ? 403 : 409);
|
|
2825
|
+
if (answersInPlace(ctx.request))
|
|
2826
|
+
return answerActInPlace(response, "done", `${done.kind === "undo" ? "Undone" : "Landed"} on ${done.branch} (${done.commit.slice(0, 7)}).`, 200);
|
|
2827
|
+
return redirect(response, taskHref(act.taskId));
|
|
2828
|
+
}
|
|
2769
2829
|
return { registrations, workListFor, showOrder, runListPane, peekFragment, taskMutation, queueRegionFor, ciFailingFor, completedRowFor, attemptRowFor, resultRowOf, reviewCockpitViewOf, decisionEvidence, runEvidence, sendArtifact, peekGuards, liveRunIds };
|
|
2770
2830
|
}
|
|
2771
2831
|
export function createTidyHandlers(runtime) {
|
|
@@ -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:
|
|
368
|
+
settingsLink({ href: "/settings/passwordless", title: "Passwordless", status: facts.passwordless ? "On: 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,7 +541,7 @@ 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,
|
|
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). Changes that add a way in still ask: sign-in, tokens, connections, agent threads and check commands.",
|
|
545
545
|
body: joinHtml([note(view.trade), control]) }),
|
|
546
546
|
]), { lead: "Sign in once; most approvals then need no password." });
|
|
547
547
|
}
|