toolroll 0.9.107 → 0.9.109
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 +54 -0
- package/README.md +4 -3
- package/dist/advanced-view.js +0 -1
- package/dist/agent-fence.js +35 -4
- package/dist/agent-state.js +5 -2
- package/dist/assignment-ui.js +5 -5
- package/dist/assignment.js +5 -2
- package/dist/browser/terminal.js +1 -1
- package/dist/browser/workspace.css +1 -1
- package/dist/browser/workspace.js +38 -33
- package/dist/browser-crew.js +4 -4
- package/dist/browser-shell.js +1 -1
- package/dist/browser-workspace.js +4 -11
- package/dist/builder.js +9 -1
- package/dist/chat-controls.js +6 -5
- package/dist/chat-decide.js +1 -1
- package/dist/chat-quiet.js +3 -3
- package/dist/chat-voice.js +2 -2
- package/dist/cli-help.js +17 -13
- package/dist/cli.js +4 -3
- package/dist/console-chrome.js +10 -3
- package/dist/contracts/cli.js +2 -0
- package/dist/contracts/console-api.js +5 -4
- package/dist/contracts/handoff.js +4 -0
- 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/dispatch.js +3 -8
- package/dist/flexible-available.js +1 -0
- package/dist/flexible-schema.js +32 -0
- package/dist/flexible-thread-schema.js +30 -0
- package/dist/flexible-thread.js +526 -0
- package/dist/flexible-ui.js +44 -0
- package/dist/flexible.js +359 -0
- package/dist/folder-look.js +65 -4
- package/dist/git-views.js +38 -38
- package/dist/guides.js +14 -11
- package/dist/keymap.js +1 -1
- package/dist/lead-cli.js +2 -1
- package/dist/lead-context.js +1 -1
- package/dist/limits-ui.js +1 -1
- package/dist/live-bus.js +82 -12
- package/dist/login-secrets.js +43 -0
- package/dist/needs-you.js +3 -3
- package/dist/nightly-github.js +2 -2
- package/dist/operate.js +278 -21
- package/dist/project-admission.js +60 -29
- package/dist/project-delete-ui.js +2 -1
- package/dist/project-delete.js +1 -0
- package/dist/project.js +73 -0
- package/dist/provider-auth.js +1 -1
- package/dist/release.js +1 -0
- package/dist/repos.js +37 -0
- 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-hooks.js +1 -0
- package/dist/sample-project.js +167 -9
- package/dist/scope.js +17 -2
- package/dist/serve.js +47 -32
- package/dist/server/chat.js +9 -9
- package/dist/server/chrome.js +16 -16
- package/dist/server/guards.js +10 -4
- package/dist/server/home.js +37 -5
- package/dist/server/http.js +4 -2
- package/dist/server/in-place.js +5 -4
- package/dist/server/kit.js +2 -2
- package/dist/server/live.js +103 -10
- package/dist/server/login-help.js +67 -0
- package/dist/server/pages.js +258 -78
- package/dist/server/people-tokens.js +36 -24
- package/dist/server/render-chat.js +1 -1
- package/dist/server/render-history.js +18 -4
- package/dist/server/render-new-task.js +2 -2
- package/dist/server/render-pages.js +21 -39
- package/dist/server/render-people.js +16 -4
- package/dist/server/render-projects.js +63 -15
- package/dist/server/render-results.js +26 -10
- package/dist/server/render-tasks.js +26 -17
- package/dist/server/retired-routes.js +37 -4
- package/dist/server/route-policy.js +8 -0
- package/dist/server/route-table.js +15 -5
- package/dist/server/settings-computers.js +140 -0
- package/dist/server/settings-scripts.js +15 -0
- package/dist/server/settings-section-table.js +56 -0
- package/dist/server/settings-sections.js +258 -0
- package/dist/server/settings.js +167 -19
- package/dist/server/task-views.js +47 -13
- package/dist/server/tasks.js +143 -90
- package/dist/server/welcome.js +35 -23
- package/dist/settings-groups-ui.js +34 -106
- package/dist/settings-proofs.js +5 -2
- package/dist/sqlite-telemetry.js +70 -21
- package/dist/store.js +141 -9
- package/dist/surface.js +4 -1
- package/dist/task-link.js +64 -0
- package/dist/task-outcome-cli.js +99 -4
- package/dist/tui-source.js +11 -3
- package/dist/tui.js +39 -39
- package/dist/typed-words-schema.js +18 -0
- package/dist/welcome-facts.js +15 -7
- package/dist/work-index.js +126 -29
- package/dist/work-reads.js +279 -0
- package/package.json +4 -2
|
@@ -26,6 +26,7 @@ import { enrollOwnerPassword, liveInviteTerms, localOwnerBinding } from "../stor
|
|
|
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
|
+
import { loginHelpOf } from "./login-help.js";
|
|
29
30
|
import { FULL_SESSION, SESSION_COOKIE, SIGN_IN_LINK_PATH } from "./session.js";
|
|
30
31
|
import { setupCodeMatches, signupCookie, signupFromHere } from "./signup-gate.js";
|
|
31
32
|
const AUTH_TIME_SKEW_MS = 60_000;
|
|
@@ -235,7 +236,7 @@ export function createPeopleHandlers(runtime) {
|
|
|
235
236
|
response.setHeader("Referrer-Policy", "same-origin");
|
|
236
237
|
return page(response, 200, signupPage(null, runtime.setupAttemptsLeft));
|
|
237
238
|
}
|
|
238
|
-
return page(response, 200,
|
|
239
|
+
return page(response, 200, loginWith(store, fromThisComputer(ctx.request), null, loginReturn(url.searchParams.get("return")), ssoOffer()));
|
|
239
240
|
}
|
|
240
241
|
async function signInLink(ctx) {
|
|
241
242
|
const { url, request, response } = ctx;
|
|
@@ -246,16 +247,16 @@ export function createPeopleHandlers(runtime) {
|
|
|
246
247
|
response.setHeader("Referrer-Policy", "no-referrer");
|
|
247
248
|
if (!fromThisComputer(request)) {
|
|
248
249
|
recordSignIn(held?.account ?? "unknown account", "sign-in refused", "one-time link", "opened from another device");
|
|
249
|
-
return page(response, 403,
|
|
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()));
|
|
250
251
|
}
|
|
251
252
|
if (held === undefined || held.expires < Date.now()) {
|
|
252
|
-
return page(response, 410,
|
|
253
|
+
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
254
|
}
|
|
254
255
|
const account = store.accountOf(held.account);
|
|
255
256
|
if (account === null || account.role !== "approver" || account.revokedAt !== null)
|
|
256
|
-
return page(response, 403,
|
|
257
|
+
return page(response, 403, loginWith(store, fromThisComputer(ctx.request), "That account can't sign in here any more.", "/chat", ssoOffer()));
|
|
257
258
|
if (!passwordAllowed(held.account))
|
|
258
|
-
return page(response, 403,
|
|
259
|
+
return page(response, 403, loginWith(store, fromThisComputer(ctx.request), `Sign in with ${ssoSettings()?.label ?? "your identity provider"}.`, "/chat", ssoOffer()));
|
|
259
260
|
const id = randomBytes(32).toString("hex");
|
|
260
261
|
const keyed = keyFor(request);
|
|
261
262
|
const base = { ...arrival(request), name: held.account, csrf: randomBytes(32).toString("hex"), role: account.role, generation: account.generation, createdAt: Date.now(), sawBoardAt: null, lastSeen: Date.now(),
|
|
@@ -269,11 +270,19 @@ export function createPeopleHandlers(runtime) {
|
|
|
269
270
|
return true;
|
|
270
271
|
});
|
|
271
272
|
if (!made)
|
|
272
|
-
return page(response, 410,
|
|
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()));
|
|
273
274
|
recordSignIn(held.account, "signed in", "local link");
|
|
274
275
|
}
|
|
275
276
|
else {
|
|
276
|
-
|
|
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()));
|
|
277
286
|
recordSignIn(held.account, "signed in", "one-time link");
|
|
278
287
|
}
|
|
279
288
|
return signedInTo(response, keyed.key, "/chat", [`${SESSION_COOKIE}=${id}; HttpOnly; SameSite=Strict; Path=/${cookieSecure}`]);
|
|
@@ -284,15 +293,15 @@ export function createPeopleHandlers(runtime) {
|
|
|
284
293
|
const intent = url.searchParams.get("link") === "1" ? "link" : url.searchParams.get("reauth") === "1" ? "reauth" : "sign-in";
|
|
285
294
|
const returnTo = loginReturn(url.searchParams.get("return"));
|
|
286
295
|
if (settings === null)
|
|
287
|
-
return page(response, 404,
|
|
296
|
+
return page(response, 404, loginWith(store, fromThisComputer(ctx.request), "Sign-in with an identity provider isn't on.", returnTo));
|
|
288
297
|
if (intent !== "sign-in" && who?.via !== "cookie")
|
|
289
298
|
return redirect(response, loginHref(returnTo));
|
|
290
299
|
const origin = consoleOrigin(request.headers.host);
|
|
291
300
|
if (origin === null)
|
|
292
|
-
return page(response, 400,
|
|
301
|
+
return page(response, 400, loginWith(store, fromThisComputer(ctx.request), "Sign in from this computer (localhost) or from your https address.", returnTo, ssoOffer()));
|
|
293
302
|
const known = providerKnown(settings.issuer);
|
|
294
303
|
if (known === null)
|
|
295
|
-
return page(response, 503,
|
|
304
|
+
return page(response, 503, loginWith(store, fromThisComputer(ctx.request), `${settings.label} isn't answering yet. Try again in a moment.`, returnTo, ssoOffer()));
|
|
296
305
|
const found = { provider: known };
|
|
297
306
|
const visit = newOidcVisit(), redirectUri = `${origin}${SSO_CALLBACK}`;
|
|
298
307
|
for (const [key, one] of ssoVisits)
|
|
@@ -315,20 +324,20 @@ export function createPeopleHandlers(runtime) {
|
|
|
315
324
|
const { url, who, request, response } = ctx;
|
|
316
325
|
const key = url.searchParams.get("h") ?? "";
|
|
317
326
|
if (!startedHere(request, key))
|
|
318
|
-
return page(response, 400,
|
|
327
|
+
return page(response, 400, loginWith(store, fromThisComputer(ctx.request), "That sign-in was started in another browser. Sign in again from this one.", "/", ssoOffer()));
|
|
319
328
|
const handoff = ssoHandoffs.get(key);
|
|
320
329
|
ssoHandoffs.delete(key);
|
|
321
330
|
response.setHeader("Set-Cookie", signInSpent("/login/sso/finish"));
|
|
322
331
|
const settings = ssoSettings();
|
|
323
332
|
if (handoff === undefined || handoff.expires < Date.now() || settings === null)
|
|
324
|
-
return page(response, 400,
|
|
333
|
+
return page(response, 400, loginWith(store, fromThisComputer(ctx.request), "That sign-in expired. Try again.", "/", ssoOffer()));
|
|
325
334
|
const { claims } = handoff;
|
|
326
335
|
const identity = { issuer: handoff.issuer, subject: claims.sub, email: claims.email, label: settings.label };
|
|
327
336
|
if (handoff.intent === "link" || handoff.intent === "reauth") {
|
|
328
337
|
if (who?.via !== "cookie")
|
|
329
338
|
return redirect(response, loginHref(handoff.returnTo));
|
|
330
339
|
if (handoff.session === null || sessions.hashOf(who.session) !== handoff.session.hash || who.session.generation !== handoff.session.generation) {
|
|
331
|
-
return page(response, 403,
|
|
340
|
+
return page(response, 403, loginWith(store, fromThisComputer(ctx.request), `That ${settings.label} check was started by another sign-in. Start it again from this page.`, handoff.returnTo, ssoOffer()));
|
|
332
341
|
}
|
|
333
342
|
if (handoff.intent === "link") {
|
|
334
343
|
const linked = store.linkSsoIdentity(who.name, identity, clock());
|
|
@@ -339,7 +348,7 @@ export function createPeopleHandlers(runtime) {
|
|
|
339
348
|
return redirect(response, `/settings/sign-in?said=${encodeURIComponent(`This account signs in with ${settings.label} now.`)}`);
|
|
340
349
|
}
|
|
341
350
|
if (store.ssoAccount(identity.issuer, identity.subject) !== who.name)
|
|
342
|
-
return page(response, 403,
|
|
351
|
+
return page(response, 403, loginWith(store, fromThisComputer(ctx.request), `That ${settings.label} account isn't the one signed in here.`, handoff.returnTo, ssoOffer()));
|
|
343
352
|
who.session.sso = { at: handoff.checkedAt ?? 0 };
|
|
344
353
|
if (handoff.checkedAt !== null) {
|
|
345
354
|
who.session.ssoReauthAt = handoff.checkedAt;
|
|
@@ -353,7 +362,7 @@ export function createPeopleHandlers(runtime) {
|
|
|
353
362
|
const signedIn = store.signInWithSso(identity, rule === null ? null : { role: rule.role === "operator" ? "approver" : "viewer", projects: rule.projects === "all" ? null : rule.projects }, () => accountNameFor(claims, name => store.accountOf(name) !== null), clock());
|
|
354
363
|
if (!signedIn.ok) {
|
|
355
364
|
recordSignIn(store.ssoAccount(identity.issuer, identity.subject) ?? "unknown account", "sign-in refused", signedIn.reason === "no-group" ? "no matching group" : signedIn.reason);
|
|
356
|
-
return page(response, 403,
|
|
365
|
+
return page(response, 403, loginWith(store, fromThisComputer(ctx.request), signedIn.reason === "no-group" ? `Your ${settings.label} account isn't in a group that may use Toolroll. Ask whoever runs it.`
|
|
357
366
|
: signedIn.reason === "revoked" ? "This account was removed. Ask whoever runs Toolroll." : "That change would leave no one who can run this installation.", "/", ssoOffer()));
|
|
358
367
|
}
|
|
359
368
|
const account = store.accountOf(signedIn.account);
|
|
@@ -368,7 +377,7 @@ export function createPeopleHandlers(runtime) {
|
|
|
368
377
|
const { request, response } = ctx;
|
|
369
378
|
response.setHeader("Referrer-Policy", "same-origin");
|
|
370
379
|
if (options.setupCode === undefined || store.listApprovers().length > 0) {
|
|
371
|
-
return page(response, 409,
|
|
380
|
+
return page(response, 409, loginWith(store, fromThisComputer(ctx.request), "An account already exists. Sign in."));
|
|
372
381
|
}
|
|
373
382
|
if (runtime.setupAttemptsLeft <= 0) {
|
|
374
383
|
return page(response, 403, signupPage(null, 0));
|
|
@@ -399,10 +408,10 @@ export function createPeopleHandlers(runtime) {
|
|
|
399
408
|
}
|
|
400
409
|
const made = store.bootstrapApproverIfNone(name, hashPassword(password), clock());
|
|
401
410
|
if (!made.ok)
|
|
402
|
-
return page(response, 409,
|
|
411
|
+
return page(response, 409, loginWith(store, fromThisComputer(ctx.request), "An account already exists. Sign in."));
|
|
403
412
|
const authenticated = authenticateAccount(store, name, password);
|
|
404
413
|
if (authenticated === null || !authenticated.ok)
|
|
405
|
-
return page(response, 500,
|
|
414
|
+
return page(response, 500, loginWith(store, fromThisComputer(ctx.request), "The account was created, but signing in failed. Sign in with it now."));
|
|
406
415
|
const id = randomBytes(32).toString("hex");
|
|
407
416
|
const keyed = keyFor(request);
|
|
408
417
|
sessions.set(id, {
|
|
@@ -433,7 +442,7 @@ export function createPeopleHandlers(runtime) {
|
|
|
433
442
|
if (wait > 0) {
|
|
434
443
|
recordSignIn(signInActor(name), "sign-in refused", "too many tries", "from one address");
|
|
435
444
|
response.setHeader("Retry-After", String(Math.ceil(wait / 1000)));
|
|
436
|
-
return page(response, 429,
|
|
445
|
+
return page(response, 429, loginWith(store, fromThisComputer(ctx.request), `Too many sign-in attempts. Try again in ${minutesWords(wait)}.`, returnTo));
|
|
437
446
|
}
|
|
438
447
|
const authenticated = name !== null && token !== null ? authenticateAccount(store, name, token) : null;
|
|
439
448
|
if (authenticated === null || !authenticated.ok) {
|
|
@@ -441,15 +450,15 @@ export function createPeopleHandlers(runtime) {
|
|
|
441
450
|
const locked = authenticated.retryAfterMs;
|
|
442
451
|
recordSignIn(signInActor(name), "sign-in refused", "locked");
|
|
443
452
|
response.setHeader("Retry-After", String(Math.ceil(locked / 1000)));
|
|
444
|
-
return page(response, 429,
|
|
453
|
+
return page(response, 429, loginWith(store, fromThisComputer(ctx.request), `Too many wrong passwords. Try again in ${minutesWords(locked)}.`, returnTo));
|
|
445
454
|
}
|
|
446
455
|
signInBudget.failed(source, at);
|
|
447
456
|
recordSignIn(signInActor(name), "sign-in refused", "wrong password");
|
|
448
|
-
return page(response, 403,
|
|
457
|
+
return page(response, 403, loginWith(store, fromThisComputer(ctx.request), "wrong username or password", returnTo, ssoOffer()));
|
|
449
458
|
}
|
|
450
459
|
if (!passwordAllowed(name)) {
|
|
451
460
|
recordSignIn(name, "sign-in refused", "provider only");
|
|
452
|
-
return page(response, 403,
|
|
461
|
+
return page(response, 403, loginWith(store, fromThisComputer(ctx.request), `Sign in with ${ssoSettings()?.label ?? "your identity provider"}.`, returnTo, ssoOffer()));
|
|
453
462
|
}
|
|
454
463
|
recordSignIn(name, "signed in", "browser");
|
|
455
464
|
const id = randomBytes(32).toString("hex");
|
|
@@ -573,7 +582,7 @@ export function createPeopleHandlers(runtime) {
|
|
|
573
582
|
return true;
|
|
574
583
|
}
|
|
575
584
|
async function ssoCallback(request, response, url) {
|
|
576
|
-
const back = (words) => page(response, 400,
|
|
585
|
+
const back = (words) => page(response, 400, loginWith(store, fromThisComputer(request), words, "/", ssoOffer()));
|
|
577
586
|
const state = url.searchParams.get("state") ?? "";
|
|
578
587
|
if (!startedHere(request, state))
|
|
579
588
|
return back("That sign-in was started in another browser. Sign in again from this one.");
|
|
@@ -592,7 +601,7 @@ export function createPeopleHandlers(runtime) {
|
|
|
592
601
|
if (!token.ok)
|
|
593
602
|
return back(token.said);
|
|
594
603
|
if (!adapterPolicy({ caller: "service", capability: "none" }).ok)
|
|
595
|
-
return page(response, 403,
|
|
604
|
+
return page(response, 403, loginWith(store, fromThisComputer(request), "This sign-in is not allowed."));
|
|
596
605
|
const verified = await verifyIdToken(token.idToken, held.provider, settings, held.visit.nonce, clock(), fetcher);
|
|
597
606
|
if (!verified.ok) {
|
|
598
607
|
logEvent("warn", "sso.refused", { reason: verified.said });
|
|
@@ -818,3 +827,6 @@ export function createPeopleHandlers(runtime) {
|
|
|
818
827
|
});
|
|
819
828
|
return { registrations, takeJoinAttempt, ssoCallback, readAccessForm };
|
|
820
829
|
}
|
|
830
|
+
function loginWith(store, here, problem, returnTo = "/", sso = null) {
|
|
831
|
+
return loginPage(problem, returnTo, sso, loginHelpOf(store, { here }));
|
|
832
|
+
}
|
|
@@ -181,7 +181,7 @@ export function chatFleetOverview(snapshot, projects, interactive) {
|
|
|
181
181
|
const briefing = "Brief me on what needs my attention, what is building, and the highest-leverage next action across every project.";
|
|
182
182
|
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
183
|
? postForm("/chat", html `<button type="submit" name="message" value="${briefing}" class="quiet">Brief me</button>`, { attrs: { class: "inline" } })
|
|
184
|
-
: html `<a href="
|
|
184
|
+
: 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
185
|
}
|
|
186
186
|
export function chatProjectRail(projects, inert) {
|
|
187
187
|
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
|
}
|
|
@@ -20,8 +20,8 @@ function projectItems(projects, open) {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
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: ["/
|
|
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 });
|
|
25
25
|
const items = projectItems(projects, project);
|
|
26
26
|
const values = prefill?.values;
|
|
27
27
|
const typed = items.length === 0;
|
|
@@ -25,6 +25,7 @@ import { createHash } from "node:crypto";
|
|
|
25
25
|
import { join } from "node:path";
|
|
26
26
|
import { buildsViews, CHEVRON_ICON, consoleSpend, GRIP_HANDLE, isOverdue, projectChip, relativeAge, safePrUrl, screen, sentenceCase, TO_FRONT_ICON, when, whenTime } from "./chrome.js";
|
|
27
27
|
import { reviewHref, taskHref } from "./http.js";
|
|
28
|
+
import { taskLinkOf } from "../task-link.js";
|
|
28
29
|
import { criterionMatrixSummary, incidentWords, PHASE_WORDS, phaseWords } from "./render-results.js";
|
|
29
30
|
import { decisionAnswerCard, decisionAnswerScript, dispatchHeadline, statusLineHtml, workDiagnosticsHtml } from "./render-tasks.js";
|
|
30
31
|
export const TASK_STATES = ["queued", "running", "done", "failed", "cancelled"];
|
|
@@ -107,7 +108,7 @@ export function boardBody(data, ciRed) {
|
|
|
107
108
|
}
|
|
108
109
|
const shown = cards.slice(0, CAP);
|
|
109
110
|
const more = cards.length - shown.length;
|
|
110
|
-
return html `<details class="lane lane-${key}"${shown.length === 0 ? null : html ` open`}><summary><h2>${laneChip(key === "attention" && cards.length === 0 ? "queued" : key, title)} <span class="lane-count">${cards.length}${data.saturated ? "+" : ""}</span></h2></summary><p class="hint">${hint}</p>${shown.length === 0 ? html `<p class="meta lane-empty">nothing here</p>` : shown.map((card, index) => renderOne(card, index))}${more > 0 ? html `<a class="lane-more" href="/
|
|
111
|
+
return html `<details class="lane lane-${key}"${shown.length === 0 ? null : html ` open`}><summary><h2>${laneChip(key === "attention" && cards.length === 0 ? "queued" : key, title)} <span class="lane-count">${cards.length}${data.saturated ? "+" : ""}</span></h2></summary><p class="hint">${hint}</p>${shown.length === 0 ? html `<p class="meta lane-empty">nothing here</p>` : shown.map((card, index) => renderOne(card, index))}${more > 0 ? html `<a class="lane-more" href="/">+${more} more in Work</a>` : null}</details>`;
|
|
111
112
|
};
|
|
112
113
|
const facts = (rows) => rows.length === 0
|
|
113
114
|
? null
|
|
@@ -182,8 +183,8 @@ export function boardBody(data, ciRed) {
|
|
|
182
183
|
: html `<p class="meta board-scope">${data.all
|
|
183
184
|
? html `${data.project === null
|
|
184
185
|
? html `<strong>All projects</strong>`
|
|
185
|
-
: html `<a href="
|
|
186
|
-
: html `<strong>${projectName(data.project)}</strong> · <a href="
|
|
186
|
+
: html `<a href="/?view=board">${projectName(data.project)}</a> · <strong>all projects</strong>`} — every project this server serves, each card wearing its project`
|
|
187
|
+
: html `<strong>${projectName(data.project)}</strong> · <a href="/?view=board">all projects</a>`}</p>`;
|
|
187
188
|
const ago = (minutes) => minutes < 60 ? `${minutes}m` : minutes < 48 * 60 ? `${Math.round(minutes / 60)}h` : `${Math.round(minutes / (24 * 60))}d`;
|
|
188
189
|
const deltaLine = data.delta === null
|
|
189
190
|
? null
|
|
@@ -196,7 +197,7 @@ export function boardBody(data, ciRed) {
|
|
|
196
197
|
].filter((one) => one !== null), html ` · `)}</p>`;
|
|
197
198
|
return joinHtml([
|
|
198
199
|
html `<h1>Board</h1>`,
|
|
199
|
-
data.all ? null : html `<p class="meta board-view"><strong>State</strong> · <a href="
|
|
200
|
+
data.all ? null : html `<p class="meta board-view"><strong>State</strong> · <a href="/?view=order">order →</a> <span class="meta">drag to reorder, or to keep a task for one builder</span></p>`,
|
|
200
201
|
deltaLine,
|
|
201
202
|
toggle,
|
|
202
203
|
workerStrip(data.workers, data.cards, data.now),
|
|
@@ -205,7 +206,7 @@ export function boardBody(data, ciRed) {
|
|
|
205
206
|
lane("queued", "Queued", "Starts when a builder is free.", queuedCard),
|
|
206
207
|
lane("waiting", "Waiting", "Paused until a time, another task, or a requirement is ready.", plain),
|
|
207
208
|
lane("building", "Building", "One agent per card, in its own workspace.", building),
|
|
208
|
-
html `<details class="lane lane-done"${data.done.length === 0 ? null : html ` open`}><summary><h2>${laneChip("done", html `<a href="
|
|
209
|
+
html `<details class="lane lane-done"${data.done.length === 0 ? null : html ` open`}><summary><h2>${laneChip("done", html `<a href="/?view=done">Done recently</a>`)}</h2></summary><p class="hint">The most recent. The full list is under Done.</p>${doneCards}</details>`,
|
|
209
210
|
html `</div>`,
|
|
210
211
|
], "\n");
|
|
211
212
|
}
|
|
@@ -301,7 +302,7 @@ export function workRowChip(row) {
|
|
|
301
302
|
function workActionHref(row) {
|
|
302
303
|
const target = row.primaryAction?.target;
|
|
303
304
|
if (row.primaryAction?.code === 'open-result' && target?.runId != null)
|
|
304
|
-
return
|
|
305
|
+
return taskLinkOf({ task: target.taskId, run: target.runId });
|
|
305
306
|
return browserWorkActionHref(row);
|
|
306
307
|
}
|
|
307
308
|
export function workPage(chrome, data) {
|
|
@@ -358,7 +359,7 @@ export function workPage(chrome, data) {
|
|
|
358
359
|
['finished', 'Finished', data.board.finished, 'completed', 'Nothing has finished yet.'],
|
|
359
360
|
].map(([key, label, page, view, empty]) => ({ key, label, count: page.totals[view], href: query({ view, layout: 'list' }), empty, rows: page.items.map(rowOf) }));
|
|
360
361
|
const putAwayLink = data.canPutAway === true && data.view !== 'archived' ? { label: 'Archive old tasks', href: '/tasks/archive' } : null;
|
|
361
|
-
const toolLinks = [['
|
|
362
|
+
const toolLinks = [['/?view=order', 'Order the queue'], ['/recipes', 'Recipes'], ...(chrome.projectScoped ? [] : [['/', 'Every project']]), ['/ledger', 'Audit log']];
|
|
362
363
|
const newTaskHref = lens === null ? '/tasks/new' : `/tasks/new?project=${encodeURIComponent(lens)}`;
|
|
363
364
|
const emptyNow = data.work.items.length > 0 ? null : filtered && !data.previous ? { text: `No tasks are ${data.state} in this view.`, action: { label: 'Show every state', href: href(data.view, undefined, null) } } : {
|
|
364
365
|
text: data.previous ? 'There are no more tasks on this page.' : current.empty,
|
|
@@ -388,33 +389,14 @@ export function workPage(chrome, data) {
|
|
|
388
389
|
...TASK_STATES.map(one => ({ label: one.charAt(0).toUpperCase() + one.slice(1), href: href(data.view, undefined, one), active: data.state === one }))],
|
|
389
390
|
};
|
|
390
391
|
const legacyTabs = html `<nav class="work-views" aria-label="Task views">${WORK_VIEWS.map(one => html `<a href="${href(one.key)}"${one.key === data.view ? html ` class="active" aria-current="page"` : null}>${one.label}<span class="count">${data.work.totals[one.key]}</span></a>`)}</nav>`;
|
|
391
|
-
const rowHtml = (row) =>
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
? `/review?result=${encodeURIComponent(target.taskId)}&run=${target.runId}`
|
|
400
|
-
: browserWorkActionHref(row);
|
|
401
|
-
const action = actionHref === null || row.primaryAction === null ? null : html `<a class="work-action" data-primary-action href="${actionHref}">${row.primaryAction.label} →</a>`;
|
|
402
|
-
const project = data.multiProject || row.repo === null ? html `<span class="project-label">${row.repo === null ? 'Unplaced' : projectName(row.repo)}</span>` : null;
|
|
403
|
-
const act = tidyAct(row);
|
|
404
|
-
const putAway = act === null ? null : postForm(act.action, html `<button type="submit" class="quiet">${act.label}</button>`, { hidden: { return: returnTo }, attrs: { class: 'inline', 'data-tidy-act': 'put-away' } });
|
|
405
|
-
return html `<article class="work-row" data-task="${row.rootId}" data-work-status="${row.status.token}" data-work-views="${row.status.views.join(' ')}"><div class="work-row-main"><a class="work-title" href="${taskHref(row.rootId)}">${row.title}</a><p class="work-meta">${project}<span>${relativeAge(row.updatedAt, data.now)}</span><span class="mono">${row.rootId}</span></p></div><div class="work-row-status">${statusLineHtml(row.status)}${action}${putAway}${row.familyProblem === null ? null : html `<p class="problem">${row.familyProblem}</p>`}${row.status.views.includes('needs-you') && !['write-scope', 'approve-scope'].includes(row.primaryAction?.code ?? '') && row.status.detail !== row.status.label && row.status.detail !== row.familyProblem ? html `<p class="work-detail">${row.status.detail}</p>` : null}${workDiagnosticsHtml(row.status.diagnostics)}</div></article>`;
|
|
406
|
-
};
|
|
407
|
-
const stateLinks = html `<nav class="work-states" aria-label="Task state"><span class="meta">State:</span> ${joinHtml([html `<a href="${href(data.view, undefined, null)}"${filtered ? null : html ` aria-current="page"`}>Any</a>`,
|
|
408
|
-
...TASK_STATES.map(one => html `<a href="${href(data.view, undefined, one)}"${data.state === one ? html ` aria-current="page"` : null}>${one}</a>`)], html ` · `)}</nav>`;
|
|
409
|
-
const list = data.work.items.length === 0 && filtered && !data.previous
|
|
410
|
-
? html `<div class="work-empty" data-work-empty="${data.view}"><p>No tasks are ${data.state} in this view.</p><a href="${href(data.view, undefined, null)}">Show every state →</a></div>`
|
|
411
|
-
: data.work.items.length === 0
|
|
412
|
-
? html `<div class="work-empty" data-work-empty="${data.view}"><p>${data.previous ? 'There are no more tasks on this page.' : current.empty}</p>${data.view === 'all' && !data.previous ? html `<p><a class="button-link" href="${chrome.chat === true ? '/chat' : '/tasks/new'}">${chrome.chat === true ? 'Start in chat' : 'Add a task'}</a></p>` : html `<a href="${href('all')}">See all tasks →</a>`}</div>`
|
|
413
|
-
: html `<div class="work-list">${data.work.items.map(rowHtml)}</div>`;
|
|
414
|
-
const pages = !data.previous && data.work.nextCursor === null ? null : html `<nav class="row work-pagination" aria-label="Task pages">${data.previous ? html `<a class="button-link" href="${href(data.view)}">First page</a>` : null}${data.work.nextCursor === null ? null : html `<a class="button-link" rel="next" href="${href(data.view, data.work.nextCursor)}">Next page</a>`}</nav>`;
|
|
415
|
-
const tools = html `<details class="work-tools"><summary>Work tools${CHEVRON_ICON}</summary><nav class="work-tools-menu">${[['/', 'Home'], ['/tasks?view=board', 'Board'], ['/tasks?view=order', 'Order'], ['/recipes', 'Recipes'], ...(chrome.projectScoped ? [] : [['/tasks?scope=all', 'Every project']]), ['/ledger', 'Audit log']]
|
|
416
|
-
.map(([path, label]) => html `<a href="${path}">${label}</a>`)}</nav></details>`;
|
|
417
|
-
return screen('work', html `<div class="work-head"><h1>Tasks</h1>${putAwayLink === null ? null : html `<a class="button-link" href="${putAwayLink.href}" data-put-away-old>${putAwayLink.label}</a>`}${tools}</div>${limitsHtml(data.limits ?? null)}${legacyTabs}${stateLinks}${list}${pages}`, { chrome, workspace: { view } });
|
|
392
|
+
const rowHtml = (row) => row.archived !== undefined
|
|
393
|
+
? html `<article class="work-row" data-task="${row.rootId}" data-work-status="archived" data-work-views="archived"><a class="work-title" href="${taskHref(row.rootId)}">${row.title}</a> <span class="status-label">Archived</span></article>`
|
|
394
|
+
: html `<article class="work-row" data-task="${row.rootId}" data-work-status="${row.status.token}" data-work-views="${row.status.views.join(' ')}"><a class="work-title" href="${taskHref(row.rootId)}">${row.title}</a> <span class="status-label">${row.status.label}</span></article>`;
|
|
395
|
+
const list = data.work.items.length === 0
|
|
396
|
+
? html `<p class="work-empty" data-work-empty="${data.view}">${filtered && !data.previous ? `No tasks are ${data.state} in this view.` : data.previous ? 'There are no more tasks on this page.' : current.empty}</p>`
|
|
397
|
+
: html `<div class="work-list">${data.work.items.map(rowHtml)}</div>`;
|
|
398
|
+
const pages = !data.previous && data.work.nextCursor === null ? null : html `<nav class="work-pagination" aria-label="Task pages">${data.previous ? html `<a href="${href(data.view)}">First page</a>` : null} ${data.work.nextCursor === null ? null : html `<a rel="next" href="${href(data.view, data.work.nextCursor)}">Next page</a>`}</nav>`;
|
|
399
|
+
return screen('work', html `${limitsHtml(data.limits ?? null)}${legacyTabs}${list}${pages}`, { chrome, workspace: { view } });
|
|
418
400
|
}
|
|
419
401
|
export function githubIdentityOf(remoteUrl) {
|
|
420
402
|
const trimmed = remoteUrl.trim();
|
|
@@ -472,7 +454,7 @@ export function queueScript() {
|
|
|
472
454
|
`function tell(){if(!stamp)return;if(paused()){stamp.textContent="paused while you edit";return;}` +
|
|
473
455
|
`stamp.textContent="updated "+Math.round((Date.now()-last)/1000)+"s ago";}setInterval(tell,1000);` +
|
|
474
456
|
`function cycle(){if(document.hidden||busy||paused()){setTimeout(cycle,wait);return;}busy=true;` +
|
|
475
|
-
`fetch("
|
|
457
|
+
`fetch("/?view=order&fragment=1",{redirect:"manual",cache:"no-store"})` +
|
|
476
458
|
`.then(function(r){if(r.type==="opaqueredirect"||r.status===401||r.status===403){location.href="/login";return null;}` +
|
|
477
459
|
`return r.ok?r.text():null;})` +
|
|
478
460
|
`.then(function(t){if(t&&!paused()){region.innerHTML=t;last=Date.now();}})` +
|
|
@@ -501,13 +483,13 @@ export function queueScript() {
|
|
|
501
483
|
`var old=card.querySelector(".queue-problem");if(old)old.remove();` +
|
|
502
484
|
`var row=document.createElement("p");row.className="problem queue-problem";row.setAttribute("role","alert");row.textContent=text;card.appendChild(row);return true;}` +
|
|
503
485
|
`fetch("/queue/move",{method:"POST",headers:(window.soKeyHeaders||function(h){return h})({"Content-Type":"application/x-www-form-urlencoded"}),body:post.toString(),redirect:"manual"})` +
|
|
504
|
-
`.then(function(r){if(r.ok)return fetch("
|
|
486
|
+
`.then(function(r){if(r.ok)return fetch("/?view=order&fragment=1",{redirect:"manual",cache:"no-store"}).then(function(f){` +
|
|
505
487
|
`if(f.type==="opaqueredirect"||f.status===401||f.status===403){location.href="/login";return false;}return f.ok?f.text():null;});` +
|
|
506
488
|
`if(r.type==="opaqueredirect"||r.status===401||r.status===403){location.href="/login";return false;}` +
|
|
507
489
|
`var kind=(r.headers&&r.headers.get?r.headers.get("content-type"):"")||"";` +
|
|
508
490
|
`if(r.status===409&&kind.indexOf("text/plain")===0){return r.text().then(function(text){return problem(drag.task,text)?false:null;});}` +
|
|
509
491
|
`return null;})` +
|
|
510
|
-
`.then(function(t){if(t===false)return;if(t&&!paused()){region.innerHTML=t;last=Date.now();}else if(t===null){location.href="
|
|
492
|
+
`.then(function(t){if(t===false)return;if(t&&!paused()){region.innerHTML=t;last=Date.now();}else if(t===null){location.href="/?view=order";}})` +
|
|
511
493
|
`.catch(function(){})` +
|
|
512
494
|
`.then(function(){tell();});});` +
|
|
513
495
|
`})();`);
|
|
@@ -515,11 +497,11 @@ export function queueScript() {
|
|
|
515
497
|
export function putAwayPage(chrome, data) {
|
|
516
498
|
const groups = tidyGroups(data.items, data.days);
|
|
517
499
|
const count = data.items.length;
|
|
518
|
-
const crumbs = html `<nav class="kit-crumbs" aria-label="Breadcrumb"><ol><li><a href="/
|
|
500
|
+
const crumbs = html `<nav class="kit-crumbs" aria-label="Breadcrumb"><ol><li><a href="/">Work</a></li><li><span aria-current="page">Archive old tasks</span></li></ol></nav>`;
|
|
519
501
|
const daysForm = html `<form method="get" action="/tasks/archive" class="put-away-days"><label>Also finished tasks untouched for <input type="number" name="days" min="1" max="365" value="${String(data.days)}" inputmode="numeric"> days</label><button type="submit" class="secondary">Update list</button></form>`;
|
|
520
502
|
const list = joinHtml(groups.map(group => html `<fieldset class="put-away-group" data-tidy-group="${group.rule}"><legend>${group.label}<span class="count">${String(group.items.length)}</span></legend><ul>${group.items.map(item => html `<li><label class="put-away-item" data-tidy-task="${item.taskId}"><input type="checkbox" name="task" value="${item.taskId}" checked><span class="put-away-title">${item.title}</span><span class="put-away-why">${item.reason}</span><span class="put-away-id">${item.taskId}${item.repo === null ? "" : ` · ${projectName(item.repo)}`}${item.members.length > 1 ? ` · ${item.members.length} versions` : ""}</span></label></li>`)}</ul></fieldset>`));
|
|
521
503
|
const body = count === 0
|
|
522
|
-
? html `<p class="kit-state">Nothing to archive right now.</p><p><a href="
|
|
504
|
+
? html `<p class="kit-state">Nothing to archive right now.</p><p><a href="/?view=archived">See archived tasks →</a></p>`
|
|
523
505
|
: stepUpForm({ proof: "tasks-put-away", action: "/work/put-away", id: "put-away", hidden: { digest: data.digest, days: data.days },
|
|
524
506
|
body: html `${list}`, save: { label: "Archive selected", idle: `${count} ${count === 1 ? "task" : "tasks"} selected` }, confirm: `Archive the selected tasks. You can restore any of them from Archived.` });
|
|
525
507
|
return screen("Archive old tasks", html `<div class="put-away">${crumbs}<h1>Archive old tasks</h1>\
|
|
@@ -55,7 +55,19 @@ function expiryWords(iso) {
|
|
|
55
55
|
return iso.slice(0, 16).replace("T", " ");
|
|
56
56
|
return at.toLocaleString("en-GB", { weekday: "short", day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" });
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
function loginFoot(sso, help) {
|
|
59
|
+
const invite = html `No account? Ask whoever runs this Toolroll for an invite link.`;
|
|
60
|
+
if (sso !== null || help.kind === "none")
|
|
61
|
+
return invite;
|
|
62
|
+
const reset = html `<code class="k-nowrap">toolroll password reset</code>`;
|
|
63
|
+
const forgot = help.kind === "local"
|
|
64
|
+
? html `Signing in without a password works only on the computer running Toolroll. There, run <code class="k-nowrap">toolroll open --web</code>.${help.passwordSet !== false ? html ` Forgot your password? Run ${reset} there.` : ""}`
|
|
65
|
+
: help.savedAt === null
|
|
66
|
+
? html `Forgot your password? Run ${reset} on the computer running Toolroll.`
|
|
67
|
+
: html `Forgot your password? On the computer running Toolroll, your first password is saved in <code data-saved-login>${joinHtml(help.savedAt.split("/").map((part, index) => index === 0 ? html `${part}` : html `/<wbr>${part}`))}</code> (until you change it). Changed it and forgot? Run ${reset} there.`;
|
|
68
|
+
return html `<span data-login-help="${help.kind}">${forgot}</span><br>${invite}`;
|
|
69
|
+
}
|
|
70
|
+
export function loginPage(problem, returnTo = "/", sso = null, help = { kind: "password", savedAt: null }) {
|
|
59
71
|
const form = postForm("/login", joinHtml([
|
|
60
72
|
outField({ id: "login-name", label: "Username", name: "name", attrs: { autocomplete: "username", autocapitalize: "none", spellcheck: "false", required: true, ...(sso === null ? { autofocus: true } : {}) } }),
|
|
61
73
|
outField({ id: "login-password", label: "Password", name: "token", type: "password", attrs: { autocomplete: "current-password" } }),
|
|
@@ -70,7 +82,7 @@ export function loginPage(problem, returnTo = "/", sso = null) {
|
|
|
70
82
|
]);
|
|
71
83
|
return shell("Sign in · Toolroll", outPage({
|
|
72
84
|
brand: BRAND_HTML, brandHref: "/login", title: "Sign in", body,
|
|
73
|
-
foot:
|
|
85
|
+
foot: loginFoot(sso, help),
|
|
74
86
|
}), { nav: false });
|
|
75
87
|
}
|
|
76
88
|
export function reconnectPage(problem, returnTo, how) {
|
|
@@ -170,7 +182,7 @@ export function serverErrorPage(options) {
|
|
|
170
182
|
return shell("Toolroll is updating", outPage({
|
|
171
183
|
brand: BRAND_HTML, title: "Toolroll is updating",
|
|
172
184
|
sub: "Work that is running can finish. New work starts again after the update, usually within two minutes.",
|
|
173
|
-
body: html `<div class="k-acts">${options.retry === null ? "" : btn("Try again", { variant: "primary", href: options.retry })}${btn("Go to
|
|
185
|
+
body: html `<div class="k-acts">${options.retry === null ? "" : btn("Try again", { variant: "primary", href: options.retry })}${btn("Go to Work", { href: "/" })}</div>`,
|
|
174
186
|
}), { nav: false });
|
|
175
187
|
}
|
|
176
188
|
return shell("Something went wrong", outPage({
|
|
@@ -179,7 +191,7 @@ export function serverErrorPage(options) {
|
|
|
179
191
|
: "Toolroll couldn't finish that. Open the page again to see what changed before you try again.",
|
|
180
192
|
body: joinHtml([
|
|
181
193
|
facts([["Reference", html `<span class="k-mono">${options.reference}</span>`], ["When", options.at.toISOString().slice(0, 16).replace("T", " ")]]),
|
|
182
|
-
html `<div class="k-acts">${options.retry === null ? "" : btn("Try again", { variant: "primary", href: options.retry })}${btn("Go to
|
|
194
|
+
html `<div class="k-acts">${options.retry === null ? "" : btn("Try again", { variant: "primary", href: options.retry })}${btn("Go to Work", { href: "/" })}</div>`,
|
|
183
195
|
]),
|
|
184
196
|
foot: "If it keeps happening, the reference helps whoever runs this Toolroll find it in the log.",
|
|
185
197
|
}), { nav: false });
|