toolroll 0.9.109 → 0.9.111
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 +73 -0
- package/README.md +5 -1
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/dist/agent-detect.js +244 -0
- package/dist/agent-fence.js +12 -1
- package/dist/agent-said-schema.js +4 -0
- package/dist/agent-said.js +23 -0
- package/dist/agentconfig.js +2 -2
- package/dist/approval-summary.js +375 -0
- package/dist/attest.js +2 -2
- package/dist/browser/THIRD_PARTY_NOTICES.txt +30 -0
- package/dist/browser/workspace.css +2 -2
- package/dist/browser/workspace.js +27 -27
- package/dist/builder.js +42 -3
- package/dist/chat-actions.js +24 -17
- package/dist/chat-core.js +3 -1
- package/dist/chat-decide.js +101 -46
- 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-task-actions.js +6 -0
- package/dist/check-report.js +1 -1
- package/dist/claim.js +28 -13
- package/dist/cli-help.js +1 -1
- package/dist/cli.js +2 -0
- package/dist/codex-limits.js +21 -8
- package/dist/console-instance.js +11 -1
- package/dist/contracts/console-api.js +13 -7
- package/dist/contracts/engine-api.js +283 -0
- package/dist/contracts/route.js +1 -0
- package/dist/coordinator.js +2 -2
- package/dist/discord-api.js +4 -3
- package/dist/discord-chat.js +3 -1
- package/dist/dispatch.js +1 -1
- package/dist/dispose.js +15 -9
- package/dist/easy-start-args.js +7 -3
- package/dist/easy-start.js +40 -1
- package/dist/egress.js +72 -10
- package/dist/engine-handoff.js +34 -0
- package/dist/engine-reads.js +338 -0
- package/dist/eval-world.js +3 -2
- package/dist/evidence.js +2 -0
- package/dist/fast-start.js +68 -18
- 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-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-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.js +175 -25
- package/dist/flexible-turns-schema.js +69 -0
- package/dist/flexible-turns.js +490 -0
- package/dist/flexible.js +10 -1
- 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 +6 -3
- package/dist/install-mode.js +225 -0
- package/dist/integrations.js +6 -1
- package/dist/lead-doors.js +7 -1
- package/dist/limits-ui.js +7 -0
- package/dist/live-reply.js +6 -0
- package/dist/live-terminal.js +425 -29
- package/dist/local-owner.js +7 -0
- package/dist/model-choices.js +12 -6
- package/dist/needs-you.js +2 -0
- package/dist/notification-delivery.js +11 -0
- package/dist/operate.js +128 -37
- package/dist/outbound-privacy.js +204 -0
- package/dist/passwordless.js +2 -1
- package/dist/phase-routing.js +3 -1
- package/dist/plane-review.js +1 -1
- package/dist/project-delete.js +14 -0
- package/dist/proposal.js +2 -2
- package/dist/provider-connection.js +19 -5
- 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 +10 -1
- package/dist/route-store.js +3 -3
- 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 +62 -13
- package/dist/server/chrome.js +3 -1
- 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/http.js +7 -0
- package/dist/server/link-redemption.js +52 -0
- package/dist/server/mutation-key.js +21 -7
- package/dist/server/pages.js +72 -40
- package/dist/server/people-tokens.js +17 -41
- package/dist/server/render-chat.js +1 -0
- package/dist/server/render-new-task.js +3 -3
- package/dist/server/render-results.js +4 -4
- package/dist/server/render-tasks.js +133 -139
- package/dist/server/route-table.js +32 -1
- package/dist/server/settings-section-table.js +6 -0
- package/dist/server/settings-sections.js +69 -0
- package/dist/server/settings.js +120 -10
- package/dist/server/task-views.js +8 -2
- package/dist/server/tasks.js +56 -12
- package/dist/server/terminals.js +181 -28
- package/dist/server/welcome.js +35 -10
- package/dist/settings-groups-ui.js +2 -2
- package/dist/settings-proofs.js +14 -9
- package/dist/slack-api.js +4 -3
- package/dist/slack-chat.js +5 -3
- package/dist/spend.js +46 -12
- package/dist/status-probe.js +343 -0
- package/dist/store.js +181 -12
- package/dist/task-sizing-schema.js +14 -0
- package/dist/task-sizing.js +76 -10
- 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/toolroll-update.js +3 -1
- 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 +1 -1
- package/dist/webhooks.js +14 -4
- package/dist/welcome-facts.js +22 -15
- package/dist/work-index.js +2 -2
- package/dist/workspace-ui.js +5 -0
- package/package.json +1 -1
- 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";
|
|
@@ -76,6 +77,9 @@ import { rereadBrowser } from "./live.js";
|
|
|
76
77
|
import { workNeeds } from "./home.js";
|
|
77
78
|
import { flowAsks, NO_HOME_ASKS, releaseAsks, setupAsks } from "./home-asks.js";
|
|
78
79
|
import { workIndexPage } from "../work-index.js";
|
|
80
|
+
import { checkEngineResponse, ENGINE_API_VERSION } from "../contracts/engine-api.js";
|
|
81
|
+
import { readRunLive } from "./engine-api.js";
|
|
82
|
+
import { waitingForTasks } from "../engine-reads.js";
|
|
79
83
|
export function createPagesHandlers(runtime, work) {
|
|
80
84
|
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;
|
|
81
85
|
async function projectsBrowse(ctx) {
|
|
@@ -170,31 +174,10 @@ export function createPagesHandlers(runtime, work) {
|
|
|
170
174
|
return work.showOrder(ctx);
|
|
171
175
|
if (who.via === "cookie" && url.search === "" && firstRunStepsNow(now) !== null && !store.hasAnyWork())
|
|
172
176
|
return redirect(response, "/chat");
|
|
173
|
-
const
|
|
174
|
-
if (
|
|
177
|
+
const built = await workViewOf(ctx);
|
|
178
|
+
if (built === null)
|
|
175
179
|
return;
|
|
176
|
-
const listed =
|
|
177
|
-
const list = listed.workspace?.view;
|
|
178
|
-
if (list?.kind !== "tasks")
|
|
179
|
-
throw new Error("Work's list is not the Tasks list");
|
|
180
|
-
const chrome = listed.chrome ?? chromeFor(project, "work");
|
|
181
|
-
const access = workAccess(), approver = who.via === "cookie" && who.role === "approver";
|
|
182
|
-
const closedDoor = (taskId) => {
|
|
183
|
-
const scope = store.getScope(taskId);
|
|
184
|
-
const door = consentDoorOf(scope, runtime.routeViewOf(taskId, store.lookupRef(taskId), scope, now, who));
|
|
185
|
-
return door.open ? null : door;
|
|
186
|
-
};
|
|
187
|
-
const needs = workNeeds({ store, now, access, evidenceRoot, project, projects: chrome.projects ?? [], chat: false, canAnswer: approver, approver, closedDoor,
|
|
188
|
-
asks: who.via === "cookie" && !found.filtered ? homeAsksFor(who, access, now, project) : NO_HOME_ASKS }, found.work, found.filtered);
|
|
189
|
-
const asked = new Map(needs.groups.flatMap(group => group.rows).map(row => [row.id, row]));
|
|
190
|
-
const rows = list.rows.map(row => { const need = asked.get(row.id); return need === undefined ? row : { ...row, need }; });
|
|
191
|
-
const onRows = new Set(rows.flatMap(row => row.need === undefined ? [] : [row.id]));
|
|
192
|
-
const view = {
|
|
193
|
-
kind: "work", list: { ...list, rows }, needs: needs.groups.map(group => ({ ...group, rows: group.rows.filter(row => !onRows.has(row.id)) })), needsCount: needs.total, project,
|
|
194
|
-
projectName: project === null ? "All projects" : (chrome.projects ?? []).find(one => one.path === project)?.name ?? projectName(project),
|
|
195
|
-
setup: firstRunStepsNow(now) !== null ? "/welcome" : null,
|
|
196
|
-
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." },
|
|
197
|
-
};
|
|
180
|
+
const { view, needs, listed, chrome } = built;
|
|
198
181
|
const asks = needs.groups.flatMap(group => group.rows).filter(row => row.id.includes(":"));
|
|
199
182
|
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>`;
|
|
200
183
|
return sendScreen(response, 200, screen("Work", stub, { chrome, workspace: { view } }));
|
|
@@ -1042,23 +1025,12 @@ export function createPagesHandlers(runtime, work) {
|
|
|
1042
1025
|
if ((file !== "main" && file !== "sub") || [...url.searchParams.keys()].some(key => key !== "file" && key !== "cursor")) {
|
|
1043
1026
|
return respond(response, 400, "application/json", JSON.stringify({ error: "request" }));
|
|
1044
1027
|
}
|
|
1045
|
-
const
|
|
1046
|
-
|
|
1047
|
-
if (rereadBrowser(runtime, ctx.request, browser) === null)
|
|
1048
|
-
return false;
|
|
1049
|
-
const run = store.getRun(runId);
|
|
1050
|
-
const repo = run === null ? null : taskRepoOf(run.taskRef);
|
|
1051
|
-
return run !== null && repo !== null && runVisible(run) && store.accountCanAccess(who.name, repo);
|
|
1052
|
-
};
|
|
1053
|
-
if (!allowed())
|
|
1054
|
-
return respond(response, 404, "application/json", JSON.stringify({ error: "run" }));
|
|
1055
|
-
if (options.localRunner === undefined || store.getRun(runId)?.runner !== options.localRunner) {
|
|
1056
|
-
return allowed() ? respond(response, 200, "application/json", JSON.stringify({ error: "off" })) : respond(response, 404, "application/json", JSON.stringify({ error: "run" }));
|
|
1057
|
-
}
|
|
1058
|
-
const read = { key: liveCursorKey, commands: runLiveCommands(store, runId) };
|
|
1059
|
-
const window = file === "sub" ? readChildWindow(evidenceRoot, runId, cursor, read) : readMainWindow(evidenceRoot, runId, cursor, read);
|
|
1060
|
-
if (!allowed() || store.getRun(runId)?.runner !== options.localRunner)
|
|
1028
|
+
const read = readRunLive(runtime, ctx.request, who, runId, file, cursor, liveCursorKey);
|
|
1029
|
+
if (!read.ok)
|
|
1061
1030
|
return respond(response, 404, "application/json", JSON.stringify({ error: "run" }));
|
|
1031
|
+
if (read.window === null)
|
|
1032
|
+
return respond(response, 200, "application/json", JSON.stringify({ error: "off" }));
|
|
1033
|
+
const window = read.window;
|
|
1062
1034
|
return respond(response, 200, "application/json", JSON.stringify(window.ok ? window : { error: window.reason }));
|
|
1063
1035
|
}
|
|
1064
1036
|
const registrations = handlersOf("pages", {
|
|
@@ -1082,6 +1054,7 @@ export function createPagesHandlers(runtime, work) {
|
|
|
1082
1054
|
"agents": agentsPage,
|
|
1083
1055
|
"agents.live": agentsLive,
|
|
1084
1056
|
"agents.live.read": agentsLiveRead,
|
|
1057
|
+
"work.rows": workRows,
|
|
1085
1058
|
"agents.terminals": agentsTerminals,
|
|
1086
1059
|
"fleet": fleetPage,
|
|
1087
1060
|
"ledger.export": ledgerExport,
|
|
@@ -1229,6 +1202,65 @@ export function createPagesHandlers(runtime, work) {
|
|
|
1229
1202
|
return refuse(ctx.response, ctx.who, 403, "Choosing a repository is a browser session's act.", "/projects");
|
|
1230
1203
|
return pickerScreen(ctx);
|
|
1231
1204
|
}
|
|
1205
|
+
async function workViewOf(ctx) {
|
|
1206
|
+
const { who, now, project } = ctx;
|
|
1207
|
+
const found = await work.listFor(ctx);
|
|
1208
|
+
if (found === null)
|
|
1209
|
+
return null;
|
|
1210
|
+
const listed = found.screen;
|
|
1211
|
+
const list = listed.workspace?.view;
|
|
1212
|
+
if (list?.kind !== "tasks")
|
|
1213
|
+
throw new Error("Work's list is not the Tasks list");
|
|
1214
|
+
const chrome = listed.chrome ?? chromeFor(project, "work");
|
|
1215
|
+
const access = workAccess(), approver = who.via === "cookie" && who.role === "approver";
|
|
1216
|
+
const closedDoor = (taskId) => {
|
|
1217
|
+
const scope = store.getScope(taskId);
|
|
1218
|
+
const door = consentDoorOf(scope, runtime.routeViewOf(taskId, store.lookupRef(taskId), scope, now, who));
|
|
1219
|
+
return door.open ? null : door;
|
|
1220
|
+
};
|
|
1221
|
+
const needs = workNeeds({ store, now, access, evidenceRoot, project, projects: chrome.projects ?? [], chat: false, canAnswer: approver, approver, closedDoor,
|
|
1222
|
+
asks: who.via === "cookie" && !found.filtered ? homeAsksFor(who, access, now, project) : NO_HOME_ASKS }, found.work, found.filtered);
|
|
1223
|
+
const asked = new Map(needs.groups.flatMap(group => group.rows).map(row => [row.id, row]));
|
|
1224
|
+
const rows = list.rows.map(row => { const need = asked.get(row.id); return need === undefined ? row : { ...row, need }; });
|
|
1225
|
+
const onRows = new Set(rows.flatMap(row => row.need === undefined ? [] : [row.id]));
|
|
1226
|
+
const view = {
|
|
1227
|
+
kind: "work", list: { ...list, rows }, needs: needs.groups.map(group => ({ ...group, rows: group.rows.filter(row => !onRows.has(row.id)) })), needsCount: needs.total, project,
|
|
1228
|
+
projectName: project === null ? "All projects" : (chrome.projects ?? []).find(one => one.path === project)?.name ?? projectName(project),
|
|
1229
|
+
setup: firstRunStepsNow(now) !== null ? "/welcome" : null,
|
|
1230
|
+
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." },
|
|
1231
|
+
};
|
|
1232
|
+
return { view, needs, listed, chrome };
|
|
1233
|
+
}
|
|
1234
|
+
async function workRows(ctx) {
|
|
1235
|
+
const { response, who, now } = ctx;
|
|
1236
|
+
const built = await workViewOf(ctx);
|
|
1237
|
+
if (built === null)
|
|
1238
|
+
return;
|
|
1239
|
+
const { view } = built, list = view.list;
|
|
1240
|
+
const spend = (() => {
|
|
1241
|
+
if (who.via !== "cookie" || !store.isInstanceOperator(who.name))
|
|
1242
|
+
return null;
|
|
1243
|
+
const dayStart = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate())).toISOString();
|
|
1244
|
+
try {
|
|
1245
|
+
return spendLineOf(store.spendBetween(dayStart, new Date(now.getTime() + 1).toISOString()), store.providerLimits(), now);
|
|
1246
|
+
}
|
|
1247
|
+
catch {
|
|
1248
|
+
return null;
|
|
1249
|
+
}
|
|
1250
|
+
})();
|
|
1251
|
+
const needOf = (row) => ({ id: row.id, title: row.title, href: row.href, project: row.project, age: row.age, state: row.state, ask: row.ask,
|
|
1252
|
+
...(row.group === undefined ? {} : { group: row.group }), reason: row.reason, line: row.line, action: row.action, question: row.question });
|
|
1253
|
+
const waiting = waitingForTasks(store, list.rows.map(row => row.id), now);
|
|
1254
|
+
const body = {
|
|
1255
|
+
version: ENGINE_API_VERSION, project: view.project, projectName: view.projectName, needsCount: view.needsCount, groups: list.groups,
|
|
1256
|
+
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,
|
|
1257
|
+
chip: row.chip, group: row.group, rank: row.rank, detail: row.detail, problem: row.problem, need: row.need === undefined ? null : needOf(row.need),
|
|
1258
|
+
waiting: waiting.get(row.id) ?? null })),
|
|
1259
|
+
needs: view.needs.map(group => ({ key: group.key, label: group.label, count: group.count, rows: group.rows.map(needOf) })),
|
|
1260
|
+
next: list.pages.next, room: "workspace", spend,
|
|
1261
|
+
};
|
|
1262
|
+
return respond(response, 200, "application/json", JSON.stringify(checkEngineResponse("workRows", body)));
|
|
1263
|
+
}
|
|
1232
1264
|
return { registrations, projectsScreen };
|
|
1233
1265
|
}
|
|
1234
1266
|
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,
|
|
@@ -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) {
|
|
22
|
+
export function newTaskPage(chrome, project, projectRevision, problem, candidates = [], permissionDefault = "auto", qualityDefault = "default", projects = [], prefill = null, draft = null, suggestions = [], fromLink = null, solo = false) {
|
|
23
23
|
const head = html `${phoneHeader("New task", { back: "/" })}`;
|
|
24
|
-
const header = docHeader({ title: "New task", back: ["/", "Work"], meta: "Nothing is built until you approve its plan.", same: true });
|
|
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;
|
|
@@ -1025,12 +1025,12 @@ export function parseReviewDiff(text) {
|
|
|
1025
1025
|
}
|
|
1026
1026
|
if (file === null)
|
|
1027
1027
|
continue;
|
|
1028
|
-
if (raw.startsWith("--- ")) {
|
|
1028
|
+
if (hunk === null && raw.startsWith("--- ")) {
|
|
1029
1029
|
file.oldPath = pathOf(raw.slice(4));
|
|
1030
1030
|
file.meta.push(raw);
|
|
1031
1031
|
continue;
|
|
1032
1032
|
}
|
|
1033
|
-
if (raw.startsWith("+++ ")) {
|
|
1033
|
+
if (hunk === null && raw.startsWith("+++ ")) {
|
|
1034
1034
|
const nextPath = pathOf(raw.slice(4));
|
|
1035
1035
|
if (nextPath !== "/dev/null")
|
|
1036
1036
|
file.path = nextPath;
|
|
@@ -1055,11 +1055,11 @@ export function parseReviewDiff(text) {
|
|
|
1055
1055
|
continue;
|
|
1056
1056
|
}
|
|
1057
1057
|
rendered += 1;
|
|
1058
|
-
if (raw.startsWith("+")
|
|
1058
|
+
if (raw.startsWith("+")) {
|
|
1059
1059
|
hunk.lines.push({ kind: "addition", text: raw.slice(1), oldLine: null, newLine });
|
|
1060
1060
|
newLine += 1;
|
|
1061
1061
|
}
|
|
1062
|
-
else if (raw.startsWith("-")
|
|
1062
|
+
else if (raw.startsWith("-")) {
|
|
1063
1063
|
hunk.lines.push({ kind: "deletion", text: raw.slice(1), oldLine, newLine: null });
|
|
1064
1064
|
oldLine += 1;
|
|
1065
1065
|
}
|