toolroll 0.9.108 → 0.9.110
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 +69 -0
- package/dist/advanced-view.js +0 -1
- package/dist/agent-detect.js +244 -0
- package/dist/agent-fence.js +47 -5
- package/dist/agent-state.js +5 -2
- package/dist/agentconfig.js +2 -2
- package/dist/approval-summary.js +344 -0
- package/dist/assignment-ui.js +5 -5
- package/dist/assignment.js +5 -2
- package/dist/attest.js +2 -2
- package/dist/browser/terminal.js +1 -1
- package/dist/browser/workspace.css +2 -2
- package/dist/browser/workspace.js +37 -34
- package/dist/browser-crew.js +4 -4
- package/dist/browser-workspace.js +4 -11
- package/dist/builder.js +45 -3
- package/dist/chat-actions.js +24 -17
- package/dist/chat-controls.js +6 -5
- package/dist/chat-core.js +3 -1
- package/dist/chat-decide.js +102 -47
- package/dist/chat-delivery-state.js +2 -0
- package/dist/chat-delivery.js +3 -2
- package/dist/chat-live.js +2 -1
- package/dist/chat-quiet.js +3 -3
- package/dist/chat-task-actions.js +6 -0
- package/dist/chat-voice.js +2 -2
- package/dist/check-report.js +1 -1
- package/dist/cli-help.js +12 -13
- package/dist/cli.js +6 -3
- package/dist/console-chrome.js +10 -3
- package/dist/console-instance.js +10 -1
- package/dist/contracts/console-api.js +14 -8
- package/dist/contracts/engine-api.js +271 -0
- package/dist/contracts/handoff.js +4 -0
- package/dist/coordinator.js +2 -2
- package/dist/decision.js +17 -0
- package/dist/demo-chat.js +1 -1
- package/dist/demo.js +6 -0
- package/dist/design/kit.js +4 -3
- package/dist/discord-api.js +4 -3
- package/dist/discord-chat.js +3 -1
- package/dist/dispatch.js +3 -8
- package/dist/easy-start-args.js +7 -3
- package/dist/easy-start.js +25 -0
- package/dist/egress.js +72 -10
- package/dist/engine-handoff.js +34 -0
- package/dist/engine-reads.js +261 -0
- package/dist/eval-world.js +3 -2
- package/dist/evidence.js +2 -0
- package/dist/fast-start.js +55 -14
- package/dist/fast-terms.js +2 -2
- package/dist/first-run.js +10 -2
- package/dist/flexible-agents.js +234 -0
- package/dist/flexible-answers-schema.js +61 -0
- package/dist/flexible-answers.js +889 -0
- package/dist/flexible-available.js +1 -0
- package/dist/flexible-custody.js +494 -0
- package/dist/flexible-import.js +782 -0
- package/dist/flexible-launch-schema.js +72 -0
- package/dist/flexible-launch.js +331 -0
- package/dist/flexible-launcher.js +88 -0
- package/dist/flexible-levels.js +34 -0
- package/dist/flexible-merge-guard.js +47 -0
- package/dist/flexible-refs.js +47 -0
- package/dist/flexible-relay-cancel.js +19 -0
- package/dist/flexible-relay-schema.js +55 -0
- package/dist/flexible-relay-upstreams.js +36 -0
- package/dist/flexible-relay.js +1032 -0
- package/dist/flexible-schema.js +32 -0
- package/dist/flexible-session.js +732 -0
- package/dist/flexible-ship-schema.js +81 -0
- package/dist/flexible-ship.js +694 -0
- package/dist/flexible-start.js +80 -0
- package/dist/flexible-thread-schema.js +30 -0
- package/dist/flexible-thread.js +676 -0
- package/dist/flexible-turns-schema.js +69 -0
- package/dist/flexible-turns.js +490 -0
- package/dist/flexible-ui.js +44 -0
- package/dist/flexible.js +368 -0
- package/dist/flow-actions.js +6 -4
- package/dist/flow-steps.js +1 -1
- package/dist/flows-cli.js +2 -1
- package/dist/git-views.js +44 -41
- package/dist/guides.js +11 -10
- package/dist/install-mode.js +225 -0
- package/dist/keymap.js +1 -1
- package/dist/lead-context.js +1 -1
- package/dist/lead-doors.js +7 -1
- package/dist/limits-ui.js +8 -1
- package/dist/live-bus.js +70 -13
- package/dist/live-reply.js +6 -0
- package/dist/live-terminal.js +425 -29
- package/dist/local-owner.js +6 -0
- package/dist/model-choices.js +12 -6
- package/dist/needs-you.js +3 -3
- package/dist/nightly-github.js +2 -2
- package/dist/notification-delivery.js +11 -0
- package/dist/operate.js +185 -33
- package/dist/outbound-privacy.js +204 -0
- package/dist/passwordless.js +2 -1
- package/dist/project-delete-ui.js +2 -1
- package/dist/project-delete.js +15 -0
- package/dist/provider-auth.js +1 -1
- package/dist/provider-connection.js +5 -3
- package/dist/publish.js +5 -0
- package/dist/pull-request-flow.js +26 -7
- package/dist/push.js +5 -1
- package/dist/release-card.js +11 -3
- package/dist/release.js +11 -1
- package/dist/result-actions.js +3 -0
- package/dist/result-evidence-readers.js +8 -2
- package/dist/result-review.js +20 -9
- package/dist/route-store.js +2 -2
- package/dist/sandbox-launch.js +32 -8
- package/dist/sandbox-runtime.js +16 -7
- package/dist/sandbox-tools.js +176 -0
- package/dist/scope.js +12 -36
- package/dist/scout-net.js +7 -2
- package/dist/serve.js +90 -40
- package/dist/server/chat.js +9 -9
- package/dist/server/chrome.js +19 -17
- package/dist/server/console.css +33 -6
- package/dist/server/engine-api.js +378 -0
- package/dist/server/flows.js +2 -2
- package/dist/server/guards.js +10 -4
- package/dist/server/home.js +37 -5
- package/dist/server/http.js +11 -2
- package/dist/server/in-place.js +5 -4
- package/dist/server/kit.js +2 -2
- package/dist/server/link-redemption.js +52 -0
- package/dist/server/live.js +100 -10
- package/dist/server/mutation-key.js +21 -7
- package/dist/server/pages.js +129 -74
- package/dist/server/people-tokens.js +17 -41
- package/dist/server/render-chat.js +2 -1
- package/dist/server/render-history.js +18 -4
- package/dist/server/render-new-task.js +4 -4
- package/dist/server/render-pages.js +21 -39
- package/dist/server/render-people.js +2 -2
- package/dist/server/render-projects.js +5 -5
- package/dist/server/render-results.js +30 -14
- package/dist/server/render-tasks.js +155 -155
- package/dist/server/retired-routes.js +37 -4
- package/dist/server/route-policy.js +8 -0
- package/dist/server/route-table.js +43 -5
- package/dist/server/settings-computers.js +140 -0
- package/dist/server/settings-scripts.js +15 -0
- package/dist/server/settings-section-table.js +59 -0
- package/dist/server/settings-sections.js +291 -0
- package/dist/server/settings.js +247 -28
- package/dist/server/task-views.js +55 -15
- package/dist/server/tasks.js +168 -98
- package/dist/server/terminals.js +181 -28
- package/dist/server/welcome.js +40 -14
- package/dist/settings-groups-ui.js +26 -107
- package/dist/settings-proofs.js +18 -11
- package/dist/slack-api.js +4 -3
- package/dist/slack-chat.js +5 -3
- package/dist/spend.js +46 -12
- package/dist/sqlite-telemetry.js +70 -21
- package/dist/status-probe.js +343 -0
- package/dist/store.js +206 -10
- package/dist/task-link.js +64 -0
- package/dist/teams-api.js +4 -3
- package/dist/teams-chat.js +4 -2
- package/dist/telegram-lead.js +2 -1
- package/dist/telegram-live.js +2 -1
- package/dist/telegram-team.js +2 -1
- package/dist/telegram.js +17 -5
- package/dist/trusted-path.js +162 -0
- 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/tui-launch.js +282 -0
- package/dist/tui-source.js +5 -3
- package/dist/tui.js +2 -2
- package/dist/typed-words-schema.js +18 -0
- package/dist/webhooks.js +8 -4
- package/dist/welcome-facts.js +25 -17
- package/dist/work-index.js +126 -29
- package/dist/work-reads.js +279 -0
- package/dist/workspace-ui.js +5 -0
- package/package.json +4 -2
- package/scripts/crash-canary.mjs +1 -1
- package/scripts/pilot.mjs +1 -1
- package/scripts/provider-canary.mjs +5 -3
package/dist/server/pages.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { advancedShownNow } from "../advanced-view.js";
|
|
2
|
+
import { spendLineOf } from "../limits-ui.js";
|
|
2
3
|
import { projectOutcomes } from '../project-outcomes.js';
|
|
3
4
|
import { steerControlsFor } from "../steer-controls.js";
|
|
4
5
|
import { canReveal, cdCommandOf, localCheckoutOf } from "../checkout-proof.js";
|
|
@@ -10,7 +11,7 @@ import { createHmac, randomBytes } from "node:crypto";
|
|
|
10
11
|
import {} from "node:http";
|
|
11
12
|
import { homedir, hostname } from "node:os";
|
|
12
13
|
import { basename, dirname, join, resolve } from "node:path";
|
|
13
|
-
import { builderReadyFor,
|
|
14
|
+
import { builderReadyFor, firstRunBuilderRepo } from "../dispatch.js";
|
|
14
15
|
import { withBuilderStep } from "../first-run.js";
|
|
15
16
|
import { folderFacts, listFolder, localOrigins } from "../folder-look.js";
|
|
16
17
|
import { Readable } from "node:stream";
|
|
@@ -51,10 +52,12 @@ import { slowRequestLines, SLOW_REQUEST_MS } from "../latency-timeline.js";
|
|
|
51
52
|
import { leadsStillAdmitted, leadTilesFor } from './agents-live-lead.js';
|
|
52
53
|
import { refuse, regionScript, relativeAge as relativeAgeOf, screen, settingsRows, WORKSPACE_STYLE, workToolRows } from "./chrome.js";
|
|
53
54
|
import { redirect, respond, safeReturn, SAFETY, taskHref } from "./http.js";
|
|
55
|
+
import { taskLinkOf } from "../task-link.js";
|
|
54
56
|
import { assignmentOf } from "../assignment.js";
|
|
55
57
|
import { assignmentTaskStatusOf } from "../assignment-presentation.js";
|
|
56
|
-
import { githubIdentityOf, homePage
|
|
58
|
+
import { githubIdentityOf, homePage } from "./render-pages.js";
|
|
57
59
|
import { retiredRedirect } from "./retired-routes.js";
|
|
60
|
+
import { RUNNER_REGISTER } from "./settings-computers.js";
|
|
58
61
|
import { codeMapStatus, openMap } from "../code-map-read.js";
|
|
59
62
|
import { requestRefresh } from "../code-map-store.js";
|
|
60
63
|
import { codeMapReport } from "../code-map-report.js";
|
|
@@ -71,11 +74,13 @@ import { capsPage } from "./render-settings.js";
|
|
|
71
74
|
import { consentDoorOf, decisionAnswerScript, taskBody } from "./render-tasks.js";
|
|
72
75
|
import {} from "./session.js";
|
|
73
76
|
import { rereadBrowser } from "./live.js";
|
|
74
|
-
import {
|
|
75
|
-
import { flowAsks, releaseAsks, setupAsks } from "./home-asks.js";
|
|
77
|
+
import { workNeeds } from "./home.js";
|
|
78
|
+
import { flowAsks, NO_HOME_ASKS, releaseAsks, setupAsks } from "./home-asks.js";
|
|
76
79
|
import { workIndexPage } from "../work-index.js";
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
import { checkEngineResponse, ENGINE_API_VERSION } from "../contracts/engine-api.js";
|
|
81
|
+
import { readRunLive } from "./engine-api.js";
|
|
82
|
+
export function createPagesHandlers(runtime, work) {
|
|
83
|
+
const { identities, clock, lastChecks, store, visible, consoleProjects, restricted, ceiling, options, projectFamilyPeek, sendScreen, chromeFor, unscopedMode, admissionList, taskRepoOf, taskViewData, runVisible, evidenceRoot, workAccess, identify, liveCeiling, sessions, deletedRepos, authenticateApprover, authenticateCredential, consumeApprovalNonce, projectOf, lookupSession, firstRunStepsNow, chatEnablement, leadPrincipal, leadConversationRows, outsideAdmissions } = runtime;
|
|
79
84
|
async function projectsBrowse(ctx) {
|
|
80
85
|
const { url, who, response } = ctx;
|
|
81
86
|
if (who.via !== "cookie")
|
|
@@ -163,24 +168,18 @@ export function createPagesHandlers(runtime) {
|
|
|
163
168
|
return void projectsScreen(response, who, url.searchParams.get("said"), 200, safeReturn(url.searchParams.get("return")), "said");
|
|
164
169
|
}
|
|
165
170
|
async function homeRedirect(ctx) {
|
|
166
|
-
const { who, response, now, project } = ctx;
|
|
167
|
-
if (
|
|
168
|
-
return
|
|
169
|
-
if (firstRunStepsNow(now) !== null && !store.hasAnyWork())
|
|
171
|
+
const { url, who, response, now, project } = ctx;
|
|
172
|
+
if (url.searchParams.get("view") === "order")
|
|
173
|
+
return work.showOrder(ctx);
|
|
174
|
+
if (who.via === "cookie" && url.search === "" && firstRunStepsNow(now) !== null && !store.hasAnyWork())
|
|
170
175
|
return redirect(response, "/chat");
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
};
|
|
178
|
-
const chat = chrome.chat === true;
|
|
179
|
-
const access = workAccess(), approver = who.role === "approver";
|
|
180
|
-
const view = { ...homeView({ store, now, access, evidenceRoot, project, projects, chat, canAnswer: approver, approver, closedDoor,
|
|
181
|
-
leadMessage: chat ? leadLastMessage(who, now) : null, asks: homeAsksFor(who, access, now, project) }),
|
|
182
|
-
setup: firstRunStepsNow(now) !== null ? "/welcome" : null };
|
|
183
|
-
return sendScreen(response, 200, screen("Home", html `<div data-kit-page><h1>Home</h1><p>${view.say}</p><p><a href="/tasks">Tasks</a></p></div>`, { chrome, workspace: { view } }));
|
|
176
|
+
const built = await workViewOf(ctx);
|
|
177
|
+
if (built === null)
|
|
178
|
+
return;
|
|
179
|
+
const { view, needs, listed, chrome } = built;
|
|
180
|
+
const asks = needs.groups.flatMap(group => group.rows).filter(row => row.id.includes(":"));
|
|
181
|
+
const stub = html `<div data-kit-page><h1>Work</h1>${asks.length === 0 ? null : html `<ul class="work-asks">${asks.map(row => html `<li><a href="${row.href}">${row.title}</a></li>`)}</ul>`}${listed.body}<p><a href="/tasks/new">New task</a> · <a href="/chat">Chat</a> · <a href="/settings">Settings</a></p></div>`;
|
|
182
|
+
return sendScreen(response, 200, screen("Work", stub, { chrome, workspace: { view } }));
|
|
184
183
|
}
|
|
185
184
|
async function searchPage(ctx) {
|
|
186
185
|
const { url, response, now } = ctx;
|
|
@@ -302,7 +301,7 @@ export function createPagesHandlers(runtime) {
|
|
|
302
301
|
const versionOf = (id) => family !== null && id !== family.current.id ? `version=${encodeURIComponent(id)}&` : "";
|
|
303
302
|
const run = store.getRun(runId);
|
|
304
303
|
const open = live || run === null ? null
|
|
305
|
-
: run.finishedAt !== null && (run.role === "builder" || run.role === "scout") ? { label: run.role === "scout" ? "Report" : "Result", href:
|
|
304
|
+
: run.finishedAt !== null && (run.role === "builder" || run.role === "scout") ? { label: run.role === "scout" ? "Report" : "Result", href: taskLinkOf({ task: root, revision: family !== null && taskId !== family.current.id ? taskId : null, run: runId }) }
|
|
306
305
|
: run.role === "planner" ? { label: "Plan", href: `${taskHref(root)}?${versionOf(taskId)}tab=plan` }
|
|
307
306
|
: { label: "Record", href: `/r/${runId}?record=1` };
|
|
308
307
|
let task = null;
|
|
@@ -311,7 +310,7 @@ export function createPagesHandlers(runtime) {
|
|
|
311
310
|
if (assignment !== null) {
|
|
312
311
|
const words = assignmentTaskStatusOf(assignment);
|
|
313
312
|
const wants = words.primaryAction?.href ?? "";
|
|
314
|
-
const href = /^\/review\?result=|[?&]result
|
|
313
|
+
const href = /^\/review\?result=|[?&]result=|^\/t\/[^?#]+\?(?:[^#]*&)?tab=result\b/.test(wants) ? taskLinkOf({ task: root, result: true }) : taskHref(root);
|
|
315
314
|
task = { headline: words.headline, sentence: words.sentence, tone: words.tone, action: { label: words.primaryAction?.label ?? "Open task", href } };
|
|
316
315
|
}
|
|
317
316
|
}
|
|
@@ -393,7 +392,7 @@ export function createPagesHandlers(runtime) {
|
|
|
393
392
|
const refreshSeconds = selected !== null ? undefined : store.liveClaims(null, now).length > 0 ? 10 : installation ? 60 : undefined;
|
|
394
393
|
return sendScreen(response, 200, screen("Agents", fallback, { chrome: chromeFor(project, "runs"), workspace: { view }, ...(refreshSeconds === undefined ? {} : { refreshSeconds }) }));
|
|
395
394
|
}
|
|
396
|
-
const fleetPage = aliasTo("/
|
|
395
|
+
const fleetPage = aliasTo("/settings/computers?section=builders");
|
|
397
396
|
async function ledgerExport(ctx) {
|
|
398
397
|
const { url, who, request, response, now } = ctx;
|
|
399
398
|
const from = exportDay(url.searchParams.get("from")), last = exportDay(url.searchParams.get("to"));
|
|
@@ -609,25 +608,38 @@ export function createPagesHandlers(runtime) {
|
|
|
609
608
|
const body = readForm(posted, CONSOLE_FORMS.runnerRegister);
|
|
610
609
|
if (who.via !== "cookie")
|
|
611
610
|
return refuse(response, who, 403, "runner registration is a browser surface");
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
return refuse(response, who, 403, "registering a worker takes your password, typed again", "/agents#computers");
|
|
615
|
-
}
|
|
611
|
+
if (store.isDemo())
|
|
612
|
+
return refuse(response, who, 403, "The demo doesn't register computers.", "/settings/computers");
|
|
616
613
|
const name = (body.get("name") ?? "").trim();
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
614
|
+
const capacityField = (body.get("capacity") ?? "1").trim() || "1";
|
|
615
|
+
const again = (problem, field) => {
|
|
616
|
+
const query = new URLSearchParams({ problem });
|
|
617
|
+
if (name !== "" && name.length <= 60 && !/[\r\n\t]/.test(name) && !hasForbiddenControls(name))
|
|
618
|
+
query.set("name", name);
|
|
619
|
+
if (/^[0-9]{1,2}$/.test(capacityField))
|
|
620
|
+
query.set("capacity", capacityField);
|
|
621
|
+
if (field !== undefined)
|
|
622
|
+
query.set("field", field);
|
|
623
|
+
return redirect(response, `/settings/change/register-computer?${query}`);
|
|
624
|
+
};
|
|
625
|
+
if (!consumeApprovalNonce(body.get("nonce") ?? "", who.name, RUNNER_REGISTER, ""))
|
|
626
|
+
return again("That form was already used or has expired. Nothing was registered; check the details and register again.");
|
|
627
|
+
const token = body.get("token") ?? "";
|
|
628
|
+
if (!authenticateCredential(who, token).ok)
|
|
629
|
+
return again("Registering a computer takes your password, typed now. Nothing was registered.");
|
|
630
|
+
if (name === "" || name.length > 60 || /[\r\n\t]/.test(name) || hasForbiddenControls(name))
|
|
631
|
+
return again("A computer's name is one short line, no control characters.", "name");
|
|
632
|
+
const capacity = Number(capacityField);
|
|
633
|
+
if (!Number.isInteger(capacity) || capacity < 1 || capacity > 64)
|
|
634
|
+
return again("Tasks at a time is a whole number from 1 to 64.", "capacity");
|
|
624
635
|
const { token: minted } = registerRunner(store, { name, host: hostname(), capacity, now });
|
|
625
|
-
const
|
|
636
|
+
const home = "/settings/computers?section=builders";
|
|
637
|
+
const tokenScreen = screen("fleet", html `<div data-kit-page>${kit.phoneHeader("Computer registered", { back: home })}${kit.doc(kit.docHeader({ title: `${name} is registered`, back: [home, "Computers"], same: true, meta: html `Takes up to ${capacity} ${capacity === 1 ? "task" : "tasks"} at a time` }), kit.slots({
|
|
626
638
|
status: html `<h2>Its token, shown once</h2>`,
|
|
627
639
|
text: "Only a hash is kept, so copy it now.",
|
|
628
640
|
acts: html `<code class="k-code" data-runner-token>${minted}</code>`,
|
|
629
641
|
terms: "Keep it beside the computer, in a file only you can read (0600) or a secrets manager. If it's lost, register the name again; its old claims are taken back.",
|
|
630
|
-
}), kit.acts(kit.btn("Back to
|
|
642
|
+
}), kit.acts(kit.btn("Back to Computers", { href: home })))}</div>`, { chrome: chromeFor(projectOf(who, request) ?? null, "fleet"), forceSensitive: true });
|
|
631
643
|
return sendScreen(response, 200, tokenScreen);
|
|
632
644
|
}
|
|
633
645
|
async function fleetRetire(ctx) {
|
|
@@ -635,15 +647,23 @@ export function createPagesHandlers(runtime) {
|
|
|
635
647
|
const body = readForm(posted, CONSOLE_FORMS.runnerRetire);
|
|
636
648
|
if (who.via !== "cookie")
|
|
637
649
|
return refuse(response, who, 403, "runner retirement is a browser surface");
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
return refuse(response, who, 403, "retiring a worker takes your password, typed again", "/agents#computers");
|
|
641
|
-
}
|
|
650
|
+
if (store.isDemo())
|
|
651
|
+
return refuse(response, who, 403, "The demo doesn't retire computers.", "/settings/computers");
|
|
642
652
|
const name = (body.get("name") ?? "").trim();
|
|
653
|
+
const again = (problem) => {
|
|
654
|
+
const query = new URLSearchParams();
|
|
655
|
+
if (name !== "" && name.length <= 60 && !hasForbiddenControls(name))
|
|
656
|
+
query.set("computer", name);
|
|
657
|
+
query.set("problem", problem);
|
|
658
|
+
return redirect(response, `/settings/change/retire-computer?${query}`);
|
|
659
|
+
};
|
|
660
|
+
const token = body.get("token") ?? "";
|
|
661
|
+
if (!authenticateApprover(who, token).ok)
|
|
662
|
+
return again("Retiring a computer takes your password. Nothing changed.");
|
|
643
663
|
const retired = store.retireRunner(name, now);
|
|
644
664
|
if (!retired)
|
|
645
|
-
return
|
|
646
|
-
return redirect(response, `/
|
|
665
|
+
return again("There's no computer by that name to retire. Nothing changed.");
|
|
666
|
+
return redirect(response, `/settings/computers?section=builders&said=${encodeURIComponent(`${name} is retired. It takes no more work.`)}`);
|
|
647
667
|
}
|
|
648
668
|
async function onboardPreview(ctx) {
|
|
649
669
|
const { who, response, posted } = ctx;
|
|
@@ -1004,37 +1024,14 @@ export function createPagesHandlers(runtime) {
|
|
|
1004
1024
|
if ((file !== "main" && file !== "sub") || [...url.searchParams.keys()].some(key => key !== "file" && key !== "cursor")) {
|
|
1005
1025
|
return respond(response, 400, "application/json", JSON.stringify({ error: "request" }));
|
|
1006
1026
|
}
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
if (rereadBrowser(runtime, ctx.request, browser) === null)
|
|
1010
|
-
return false;
|
|
1011
|
-
const run = store.getRun(runId);
|
|
1012
|
-
const repo = run === null ? null : taskRepoOf(run.taskRef);
|
|
1013
|
-
return run !== null && repo !== null && runVisible(run) && store.accountCanAccess(who.name, repo);
|
|
1014
|
-
};
|
|
1015
|
-
if (!allowed())
|
|
1016
|
-
return respond(response, 404, "application/json", JSON.stringify({ error: "run" }));
|
|
1017
|
-
if (options.localRunner === undefined || store.getRun(runId)?.runner !== options.localRunner) {
|
|
1018
|
-
return allowed() ? respond(response, 200, "application/json", JSON.stringify({ error: "off" })) : respond(response, 404, "application/json", JSON.stringify({ error: "run" }));
|
|
1019
|
-
}
|
|
1020
|
-
const read = { key: liveCursorKey, commands: runLiveCommands(store, runId) };
|
|
1021
|
-
const window = file === "sub" ? readChildWindow(evidenceRoot, runId, cursor, read) : readMainWindow(evidenceRoot, runId, cursor, read);
|
|
1022
|
-
if (!allowed() || store.getRun(runId)?.runner !== options.localRunner)
|
|
1027
|
+
const read = readRunLive(runtime, ctx.request, who, runId, file, cursor, liveCursorKey);
|
|
1028
|
+
if (!read.ok)
|
|
1023
1029
|
return respond(response, 404, "application/json", JSON.stringify({ error: "run" }));
|
|
1030
|
+
if (read.window === null)
|
|
1031
|
+
return respond(response, 200, "application/json", JSON.stringify({ error: "off" }));
|
|
1032
|
+
const window = read.window;
|
|
1024
1033
|
return respond(response, 200, "application/json", JSON.stringify(window.ok ? window : { error: window.reason }));
|
|
1025
1034
|
}
|
|
1026
|
-
async function startBuilderPage(ctx) {
|
|
1027
|
-
const { response, now, project, url, who } = ctx;
|
|
1028
|
-
const taskId = url.searchParams.get("task");
|
|
1029
|
-
const ref = taskId === null ? null : store.lookupRef(taskId.slice(0, 200));
|
|
1030
|
-
if (taskId !== null && (ref === null || ref.repo === null || !visible(ref.repo)))
|
|
1031
|
-
return refuse(response, who, 404, "That task is not available.", "/tasks");
|
|
1032
|
-
const shown = ref !== null ? ref.repo : project !== null && visible(project) ? project : null;
|
|
1033
|
-
const connected = shown === null ? null : buildersFor(store, shown, now, ref?.assignedRunner ?? null).alive.length > 0;
|
|
1034
|
-
return sendScreen(response, 200, screen("Start a builder", startBuilderHtml({
|
|
1035
|
-
heading: "h1", project: shown === null ? null : basename(shown), connected, managed: !restricted(),
|
|
1036
|
-
}), { chrome: chromeFor(project, "none") }));
|
|
1037
|
-
}
|
|
1038
1035
|
const registrations = handlersOf("pages", {
|
|
1039
1036
|
"projects.browse": projectsBrowse,
|
|
1040
1037
|
"projects.github": projectsGithub,
|
|
@@ -1051,11 +1048,12 @@ export function createPagesHandlers(runtime) {
|
|
|
1051
1048
|
"ledger": ledgerPage,
|
|
1052
1049
|
"activity": activityPage,
|
|
1053
1050
|
"system": systemScreen,
|
|
1054
|
-
"start-builder":
|
|
1051
|
+
"start-builder": async (ctx) => retiredRedirect("start-builder", ctx.url, ctx.response),
|
|
1055
1052
|
"peek": peekPage,
|
|
1056
1053
|
"agents": agentsPage,
|
|
1057
1054
|
"agents.live": agentsLive,
|
|
1058
1055
|
"agents.live.read": agentsLiveRead,
|
|
1056
|
+
"work.rows": workRows,
|
|
1059
1057
|
"agents.terminals": agentsTerminals,
|
|
1060
1058
|
"fleet": fleetPage,
|
|
1061
1059
|
"ledger.export": ledgerExport,
|
|
@@ -1203,6 +1201,63 @@ export function createPagesHandlers(runtime) {
|
|
|
1203
1201
|
return refuse(ctx.response, ctx.who, 403, "Choosing a repository is a browser session's act.", "/projects");
|
|
1204
1202
|
return pickerScreen(ctx);
|
|
1205
1203
|
}
|
|
1204
|
+
async function workViewOf(ctx) {
|
|
1205
|
+
const { who, now, project } = ctx;
|
|
1206
|
+
const found = await work.listFor(ctx);
|
|
1207
|
+
if (found === null)
|
|
1208
|
+
return null;
|
|
1209
|
+
const listed = found.screen;
|
|
1210
|
+
const list = listed.workspace?.view;
|
|
1211
|
+
if (list?.kind !== "tasks")
|
|
1212
|
+
throw new Error("Work's list is not the Tasks list");
|
|
1213
|
+
const chrome = listed.chrome ?? chromeFor(project, "work");
|
|
1214
|
+
const access = workAccess(), approver = who.via === "cookie" && who.role === "approver";
|
|
1215
|
+
const closedDoor = (taskId) => {
|
|
1216
|
+
const scope = store.getScope(taskId);
|
|
1217
|
+
const door = consentDoorOf(scope, runtime.routeViewOf(taskId, store.lookupRef(taskId), scope, now, who));
|
|
1218
|
+
return door.open ? null : door;
|
|
1219
|
+
};
|
|
1220
|
+
const needs = workNeeds({ store, now, access, evidenceRoot, project, projects: chrome.projects ?? [], chat: false, canAnswer: approver, approver, closedDoor,
|
|
1221
|
+
asks: who.via === "cookie" && !found.filtered ? homeAsksFor(who, access, now, project) : NO_HOME_ASKS }, found.work, found.filtered);
|
|
1222
|
+
const asked = new Map(needs.groups.flatMap(group => group.rows).map(row => [row.id, row]));
|
|
1223
|
+
const rows = list.rows.map(row => { const need = asked.get(row.id); return need === undefined ? row : { ...row, need }; });
|
|
1224
|
+
const onRows = new Set(rows.flatMap(row => row.need === undefined ? [] : [row.id]));
|
|
1225
|
+
const view = {
|
|
1226
|
+
kind: "work", list: { ...list, rows }, needs: needs.groups.map(group => ({ ...group, rows: group.rows.filter(row => !onRows.has(row.id)) })), needsCount: needs.total, project,
|
|
1227
|
+
projectName: project === null ? "All projects" : (chrome.projects ?? []).find(one => one.path === project)?.name ?? projectName(project),
|
|
1228
|
+
setup: firstRunStepsNow(now) !== null ? "/welcome" : null,
|
|
1229
|
+
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." },
|
|
1230
|
+
};
|
|
1231
|
+
return { view, needs, listed, chrome };
|
|
1232
|
+
}
|
|
1233
|
+
async function workRows(ctx) {
|
|
1234
|
+
const { response, who, now } = ctx;
|
|
1235
|
+
const built = await workViewOf(ctx);
|
|
1236
|
+
if (built === null)
|
|
1237
|
+
return;
|
|
1238
|
+
const { view } = built, list = view.list;
|
|
1239
|
+
const spend = (() => {
|
|
1240
|
+
if (who.via !== "cookie" || !store.isInstanceOperator(who.name))
|
|
1241
|
+
return null;
|
|
1242
|
+
const dayStart = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate())).toISOString();
|
|
1243
|
+
try {
|
|
1244
|
+
return spendLineOf(store.spendBetween(dayStart, new Date(now.getTime() + 1).toISOString()), store.providerLimits(), now);
|
|
1245
|
+
}
|
|
1246
|
+
catch {
|
|
1247
|
+
return null;
|
|
1248
|
+
}
|
|
1249
|
+
})();
|
|
1250
|
+
const needOf = (row) => ({ id: row.id, title: row.title, href: row.href, project: row.project, age: row.age, state: row.state, ask: row.ask,
|
|
1251
|
+
...(row.group === undefined ? {} : { group: row.group }), reason: row.reason, line: row.line, action: row.action, question: row.question });
|
|
1252
|
+
const body = {
|
|
1253
|
+
version: ENGINE_API_VERSION, project: view.project, projectName: view.projectName, needsCount: view.needsCount, groups: list.groups,
|
|
1254
|
+
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,
|
|
1255
|
+
chip: row.chip, group: row.group, rank: row.rank, detail: row.detail, problem: row.problem, need: row.need === undefined ? null : needOf(row.need) })),
|
|
1256
|
+
needs: view.needs.map(group => ({ key: group.key, label: group.label, count: group.count, rows: group.rows.map(needOf) })),
|
|
1257
|
+
next: list.pages.next, room: "workspace", spend,
|
|
1258
|
+
};
|
|
1259
|
+
return respond(response, 200, "application/json", JSON.stringify(checkEngineResponse("workRows", body)));
|
|
1260
|
+
}
|
|
1206
1261
|
return { registrations, projectsScreen };
|
|
1207
1262
|
}
|
|
1208
1263
|
export const PROJECT_ADDED_OUTSIDE = "project added from outside the projects folder";
|
|
@@ -22,12 +22,13 @@ import { cursorOf as auditCursorOf, remoteAudit } from "../remote-audit.js";
|
|
|
22
22
|
import { credentialProof, hashPassword, proveAccountNow } from "../scope.js";
|
|
23
23
|
import { form, HANDOFF_STYLE, loginHref, loginReturn, page, passwordSetNext, SIGN_IN_COOKIE, signInSpent, startedHere } from "./http.js";
|
|
24
24
|
import { joinDeadPage, joinFormPage, loginPage, passwordAlreadySetPage, passwordSetPage, reconnectPage, SIGNUP_NAME, SIGNUP_PASSWORD_MIN, signupPage } from "./render-people.js";
|
|
25
|
-
import { enrollOwnerPassword, liveInviteTerms
|
|
25
|
+
import { enrollOwnerPassword, liveInviteTerms } from "../store.js";
|
|
26
26
|
import { KEY_FILL_SCRIPT } from "./mutation-key.js";
|
|
27
27
|
import { LOCAL_OWNER_LAPSED } from "../local-owner.js";
|
|
28
28
|
import { withFormToken } from "./request-context.js";
|
|
29
29
|
import { loginHelpOf } from "./login-help.js";
|
|
30
30
|
import { FULL_SESSION, SESSION_COOKIE, SIGN_IN_LINK_PATH } from "./session.js";
|
|
31
|
+
import { admitLink, saveLinkSession, spendLink } from "./link-redemption.js";
|
|
31
32
|
import { setupCodeMatches, signupCookie, signupFromHere } from "./signup-gate.js";
|
|
32
33
|
const AUTH_TIME_SKEW_MS = 60_000;
|
|
33
34
|
export function sameVisitCheck(authTime, startedAt, now) {
|
|
@@ -240,50 +241,25 @@ export function createPeopleHandlers(runtime) {
|
|
|
240
241
|
}
|
|
241
242
|
async function signInLink(ctx) {
|
|
242
243
|
const { url, request, response } = ctx;
|
|
243
|
-
const
|
|
244
|
-
const held = /^[A-Za-z0-9_-]{43}$/.test(code) ? signInLinks.get(linkKey(code)) : undefined;
|
|
245
|
-
if (held !== undefined)
|
|
246
|
-
signInLinks.delete(linkKey(code));
|
|
244
|
+
const held = spendLink(runtime, url.pathname.slice(SIGN_IN_LINK_PATH.length));
|
|
247
245
|
response.setHeader("Referrer-Policy", "no-referrer");
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
246
|
+
const admitted = admitLink(runtime, request, held, "browser");
|
|
247
|
+
if (!admitted.ok) {
|
|
248
|
+
const why = admitted.refusal.why;
|
|
249
|
+
if (why === "elsewhere")
|
|
250
|
+
return page(response, 403, loginWith(store, fromThisComputer(ctx.request), "That sign-in link works only in a browser on the computer running Toolroll. Sign in with your password.", "/chat", ssoOffer()));
|
|
251
|
+
if (why === "used")
|
|
252
|
+
return page(response, 410, loginWith(store, fromThisComputer(ctx.request), html `That sign-in link has been used or has expired. Sign in with your password, or run <code>toolroll</code> again.`, "/chat", ssoOffer()));
|
|
253
|
+
if (why === "provider")
|
|
254
|
+
return page(response, 403, loginWith(store, fromThisComputer(ctx.request), `Sign in with ${ssoSettings()?.label ?? "your identity provider"}.`, "/chat", ssoOffer()));
|
|
257
255
|
return page(response, 403, loginWith(store, fromThisComputer(ctx.request), "That account can't sign in here any more.", "/chat", ssoOffer()));
|
|
258
|
-
|
|
259
|
-
return page(response, 403, loginWith(store, fromThisComputer(ctx.request), `Sign in with ${ssoSettings()?.label ?? "your identity provider"}.`, "/chat", ssoOffer()));
|
|
256
|
+
}
|
|
260
257
|
const id = randomBytes(32).toString("hex");
|
|
261
258
|
const keyed = keyFor(request);
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const now = localOwnerBinding(store);
|
|
267
|
-
if (now === null || now.account !== held.account || now.localGeneration !== held.localGeneration || now.accountGeneration !== held.accountGeneration)
|
|
268
|
-
return false;
|
|
269
|
-
sessions.set(id, { ...base, generation: now.accountGeneration, authority: "local-owner", localGeneration: now.localGeneration, ...keyed.fields });
|
|
270
|
-
return true;
|
|
271
|
-
});
|
|
272
|
-
if (!made)
|
|
273
|
-
return page(response, 410, loginWith(store, fromThisComputer(ctx.request), html `That sign-in link has been used or has expired. Run <code>toolroll</code> again to open Toolroll.`, "/chat", ssoOffer()));
|
|
274
|
-
recordSignIn(held.account, "signed in", "local link");
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
const made = store.transact(() => {
|
|
278
|
-
const now = store.accountOf(held.account);
|
|
279
|
-
if (now === null || now.role !== "approver" || now.revokedAt !== null || !now.passwordSet || now.generation !== held.accountGeneration)
|
|
280
|
-
return false;
|
|
281
|
-
sessions.set(id, { ...base, generation: held.accountGeneration, ...FULL_SESSION, ...keyed.fields });
|
|
282
|
-
return true;
|
|
283
|
-
});
|
|
284
|
-
if (!made)
|
|
285
|
-
return page(response, 410, loginWith(store, fromThisComputer(ctx.request), html `That sign-in link has been used or has expired. Sign in with your password, or run <code>toolroll</code> again.`, "/chat", ssoOffer()));
|
|
286
|
-
recordSignIn(held.account, "signed in", "one-time link");
|
|
259
|
+
if (!saveLinkSession(runtime, request, admitted.held, "browser", { id, csrf: randomBytes(32).toString("hex"), keys: keyed.fields })) {
|
|
260
|
+
return page(response, 410, loginWith(store, fromThisComputer(ctx.request), admitted.held.kind === "local-owner"
|
|
261
|
+
? html `That sign-in link has been used or has expired. Run <code>toolroll</code> again to open Toolroll.`
|
|
262
|
+
: html `That sign-in link has been used or has expired. Sign in with your password, or run <code>toolroll</code> again.`, "/chat", ssoOffer()));
|
|
287
263
|
}
|
|
288
264
|
return signedInTo(response, keyed.key, "/chat", [`${SESSION_COOKIE}=${id}; HttpOnly; SameSite=Strict; Path=/${cookieSecure}`]);
|
|
289
265
|
}
|
|
@@ -75,6 +75,7 @@ export function taskChatApproval(focus, csrf) {
|
|
|
75
75
|
digest: approval.digest,
|
|
76
76
|
returnTo,
|
|
77
77
|
scope,
|
|
78
|
+
summary: approval.summary ?? null,
|
|
78
79
|
planDocument: approval.planDocument,
|
|
79
80
|
planContract: approval.planDocument === null ? null : approval.planContract,
|
|
80
81
|
revision: approval.revision,
|
|
@@ -181,7 +182,7 @@ export function chatFleetOverview(snapshot, projects, interactive) {
|
|
|
181
182
|
const briefing = "Brief me on what needs my attention, what is building, and the highest-leverage next action across every project.";
|
|
182
183
|
return html `<section class="card chat-overview" aria-label="live portfolio overview" data-card-kind="fleet-overview"><div class="chat-overview-head"><h2>${projects.length} project${projects.length === 1 ? "" : "s"}</h2>${interactive
|
|
183
184
|
? postForm("/chat", html `<button type="submit" name="message" value="${briefing}" class="quiet">Brief me</button>`, { attrs: { class: "inline" } })
|
|
184
|
-
: html `<a href="
|
|
185
|
+
: html `<a href="/?view=board" class="chat-overview-link">open board</a>`}</div><div class="chat-overview-stats"><a href="/?view=needs-you" class="chat-overview-stat attention"><b>${needsYou}${snapshot.attentionCount?.saturated ? "+" : ""}</b><span>need you</span></a><a href="/board?scope=all" class="chat-overview-stat live"><b>${running}</b><span>building</span></a><a href="/board?scope=all&view=order" class="chat-overview-stat"><b>${queued}</b><span>queued</span></a><a href="/" class="chat-overview-stat"><b>${done}</b><span>finished today</span></a></div>${rows.length === 0 ? html `<p class="chat-overview-clear">${needsYou === 0 && running === 0 ? html `<span class="dot dot-ok"></span>No tasks are waiting and no builds are running.` : html `<a href="/">Open Work to inspect current work.</a>`}</p>` : html `<div class="chat-overview-items">${rows}</div>`}${completedWorkHtml(snapshot, projects.map(project => project.label), snapshot.assignmentStates)}${saturated ? html `<p class="meta chat-overview-note">Some items aren’t shown. Open Work to see more.</p>` : ""}</section>`;
|
|
185
186
|
}
|
|
186
187
|
export function chatProjectRail(projects, inert) {
|
|
187
188
|
const statusOf = (peek) => peek === null
|
|
@@ -126,7 +126,23 @@ function stateChip(state) {
|
|
|
126
126
|
return state === "done" ? status("finished") : state === "failed" ? status("failed") : state === "running" ? status("running")
|
|
127
127
|
: state === "queued" ? status("queued") : chip(sentenceCase(state));
|
|
128
128
|
}
|
|
129
|
+
export function evidenceRecordSection(pack) {
|
|
130
|
+
const href = `/t/${encodeURIComponent(pack.task.id)}/evidence`;
|
|
131
|
+
const parts = evidenceRecordParts(pack);
|
|
132
|
+
return html `<div class="h-record" data-evidence-pack="${pack.task.id}" data-evidence-section>\
|
|
133
|
+
<p class="k-acts h-record-tools">${btn("Print", { sm: true, variant: "ghost", href: `${href}?print=1`, attrs: { "data-evidence-print": true } })}${btn("Download JSON", { sm: true, variant: "ghost", href: `${href}?format=json`, attrs: { download: true } })}</p>\
|
|
134
|
+
${parts.broken}${parts.summary}${parts.versions}${parts.agents}${parts.outcome}${parts.log}${parts.foot}</div>`;
|
|
135
|
+
}
|
|
129
136
|
export function evidenceRecordPage(chrome, pack) {
|
|
137
|
+
const task = pack.task;
|
|
138
|
+
const href = `/t/${encodeURIComponent(task.id)}`;
|
|
139
|
+
const { summary, broken, versions, agents, outcome, log, foot } = evidenceRecordParts(pack);
|
|
140
|
+
const json = `${href}/evidence?format=json`;
|
|
141
|
+
const tools = html `<span class="k-acts h-tools">${btn("Download JSON", { sm: true, href: json, attrs: { download: true } })}${btn("Print", { sm: true, variant: "ghost", attrs: { "data-k-print": true } })}</span>`;
|
|
142
|
+
const body = kitPage(html ` data-evidence-pack="${task.id}"`, phoneHeader("Full record", { back: href }), doc(docHeader({ title: "Full record", back: [href, "Task"], meta: html `${task.title}${task.project === null ? "" : ` · ${task.project}`} · <span class="k-mono">${task.id}</span>`, right: tools }), html `<p class="k-note h-lead">Read-only. Everything below is sealed in the audit log; nothing here can be changed.</p>`, broken, summary, versions, agents, outcome, log, foot, html `<div class="h-phone-tools">${btn("Download JSON", { href: json, attrs: { download: true } })}</div>`));
|
|
143
|
+
return screen(`Full record · ${task.title}`, body, { chrome });
|
|
144
|
+
}
|
|
145
|
+
function evidenceRecordParts(pack) {
|
|
130
146
|
const task = pack.task;
|
|
131
147
|
const href = `/t/${encodeURIComponent(task.id)}`;
|
|
132
148
|
const chain = pack.ledger.chain;
|
|
@@ -189,8 +205,6 @@ ${runs.map(run => html `<div class="h-tr" role="row"><span role="cell"><a class=
|
|
|
189
205
|
const log = sec("Audit log", html `${entries.length === 0 ? note("No entries.") : html `<ul class="h-log">${[...entries].reverse().map(one => html `<li data-ledger-id="${one.id}">\
|
|
190
206
|
<span class="k-num k-muted">${at(one.at)}</span><span><b>${one.actor}</b> ${one.action}${one.detail ? html `<span class="k-muted"> · ${one.detail}</span>` : ""}</span>\
|
|
191
207
|
<span class="k-muted">${one.outcome}</span><span class="h-seal">${shortHash(one.seal?.hash ?? null)}</span></li>`)}</ul>`}${requests > 0 ? note(`Plus ${requests} ${requests === 1 ? "request" : "requests"} made through the console (accepted or refused), listed in the JSON.`) : ""}${pack.ledger.truncated ? note(`This record holds ${entries.length} of the task's entries and the newest ${requests} requests; the audit log export has the rest.`) : ""}`);
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
const body = kitPage(html ` data-evidence-pack="${task.id}"`, phoneHeader("Full record", { back: href }), doc(docHeader({ title: "Full record", back: [href, "Task"], meta: html `${task.title}${task.project === null ? "" : ` · ${task.project}`} · <span class="k-mono">${task.id}</span>`, right: tools }), html `<p class="k-note h-lead">Read-only. Everything below is sealed in the audit log; nothing here can be changed.</p>`, broken, summary, versions, agents, outcome, log, html `<p class="k-note h-foot">Record digest <span class="k-mono">${pack.digest}</span>. Each entry's seal can be rechecked from the JSON: <span class="k-mono">${pack.ledger.recipe}</span>.</p>`, html `<div class="h-phone-tools">${btn("Download JSON", { href: json, attrs: { download: true } })}</div>`));
|
|
195
|
-
return screen(`Full record · ${task.title}`, body, { chrome });
|
|
208
|
+
const foot = html `<p class="k-note h-foot">Record digest <span class="k-mono">${pack.digest}</span>. Each entry's seal can be rechecked from the JSON: <span class="k-mono">${pack.ledger.recipe}</span>.</p>`;
|
|
209
|
+
return { summary, broken, versions, agents, outcome, log, foot };
|
|
196
210
|
}
|
|
@@ -19,14 +19,14 @@ function projectItems(projects, open) {
|
|
|
19
19
|
return [one.path, `${one.name} (${parent})`];
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
export function newTaskPage(chrome, project, projectRevision, problem, candidates = [], permissionDefault = "auto", qualityDefault = "default", projects = [], prefill = null, draft = null, suggestions = [], fromLink = null) {
|
|
23
|
-
const head = html `${phoneHeader("New task", { back: "/
|
|
24
|
-
const header = docHeader({ title: "New task", back: ["/
|
|
22
|
+
export function newTaskPage(chrome, project, projectRevision, problem, candidates = [], permissionDefault = "auto", qualityDefault = "default", projects = [], prefill = null, draft = null, suggestions = [], fromLink = null, solo = false) {
|
|
23
|
+
const head = html `${phoneHeader("New task", { back: "/" })}`;
|
|
24
|
+
const header = docHeader({ title: "New task", back: ["/", "Work"], meta: solo ? "Small changes build when you press Build. Anything bigger waits for your yes." : "Nothing is built until you approve its plan.", same: true });
|
|
25
25
|
const items = projectItems(projects, project);
|
|
26
26
|
const values = prefill?.values;
|
|
27
27
|
const typed = items.length === 0;
|
|
28
28
|
const chosen = values?.get("repo") ?? project ?? items[0]?.[0] ?? "";
|
|
29
|
-
const planOn = values === undefined
|
|
29
|
+
const planOn = values === undefined ? !solo : values.get("plan-first") === "1";
|
|
30
30
|
const quality = values?.get("quality-mode") ?? qualityDefault;
|
|
31
31
|
const after = values?.get("after") ?? "";
|
|
32
32
|
const permission = values?.get("permission-mode") === "bypassPermissions" ? "bypassPermissions" : values?.get("permission-mode") === "auto" ? "auto" : permissionDefault;
|