toolroll 0.9.85 → 0.9.87

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.
Files changed (220) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/dist/agent-fence.d.ts +6 -2
  3. package/dist/agent-fence.js +3 -2
  4. package/dist/agents-board.d.ts +12 -0
  5. package/dist/agents-board.js +26 -0
  6. package/dist/approval-rules-ui.d.ts +4 -1
  7. package/dist/approval-rules-ui.js +31 -15
  8. package/dist/assignment-ui.js +1 -1
  9. package/dist/assignment.js +4 -3
  10. package/dist/backup-ui.d.ts +5 -4
  11. package/dist/backup-ui.js +65 -32
  12. package/dist/browser/terminal.css +1 -1
  13. package/dist/browser/terminal.js +57 -54
  14. package/dist/browser/workspace.css +2 -2
  15. package/dist/browser/workspace.js +35 -68
  16. package/dist/browser-crew.js +1 -1
  17. package/dist/browser-workspace.d.ts +363 -177
  18. package/dist/browser-workspace.js +10 -9
  19. package/dist/chat-actions.d.ts +11 -1
  20. package/dist/chat-actions.js +53 -1
  21. package/dist/chat-channel.js +1 -0
  22. package/dist/chat-controls.d.ts +1 -1
  23. package/dist/chat-controls.js +1 -1
  24. package/dist/chat-quiet.js +3 -2
  25. package/dist/chat-settings-page.d.ts +29 -9
  26. package/dist/chat-settings-page.js +59 -28
  27. package/dist/check-levels-ui.d.ts +2 -1
  28. package/dist/check-levels-ui.js +67 -58
  29. package/dist/claim.d.ts +3 -0
  30. package/dist/claim.js +4 -1
  31. package/dist/contracts/chat-actions.d.ts +9 -0
  32. package/dist/contracts/chat-actions.js +3 -0
  33. package/dist/contracts/cli.d.ts +43 -0
  34. package/dist/contracts/cli.js +4 -0
  35. package/dist/contracts/console-api.d.ts +4 -1
  36. package/dist/contracts/console-api.js +4 -1
  37. package/dist/contracts/flow-propose.d.ts +4 -1
  38. package/dist/contracts/flow-propose.js +1 -1
  39. package/dist/contracts/flow.d.ts +41 -0
  40. package/dist/contracts/flow.js +4 -2
  41. package/dist/contracts/lead-tools.d.ts +21 -0
  42. package/dist/contracts/lead-tools.js +2 -0
  43. package/dist/contracts/store-json.d.ts +2 -0
  44. package/dist/contracts/trigger-payloads.d.ts +20 -0
  45. package/dist/contracts/trigger-payloads.js +4 -0
  46. package/dist/coordinator.js +1 -0
  47. package/dist/credentials-ui.d.ts +5 -3
  48. package/dist/credentials-ui.js +58 -31
  49. package/dist/deploy-gate.js +4 -0
  50. package/dist/design/kit.css +685 -0
  51. package/dist/design/kit.d.ts +208 -0
  52. package/dist/design/kit.js +177 -0
  53. package/dist/design/tokens.css +19 -1
  54. package/dist/discord-settings.js +8 -4
  55. package/dist/dispatch.d.ts +3 -0
  56. package/dist/dispatch.js +4 -1
  57. package/dist/export-ui.d.ts +6 -4
  58. package/dist/export-ui.js +18 -8
  59. package/dist/flow-browser.d.ts +103 -0
  60. package/dist/flow-browser.js +204 -0
  61. package/dist/flow-changed.d.ts +14 -0
  62. package/dist/flow-changed.js +53 -0
  63. package/dist/flow-code.d.ts +5 -1
  64. package/dist/flow-code.js +4 -1
  65. package/dist/flow-engine.js +16 -0
  66. package/dist/flow-gallery-ui.d.ts +41 -4
  67. package/dist/flow-gallery-ui.js +95 -63
  68. package/dist/flow-live.js +9 -1
  69. package/dist/flow-pull-request.js +15 -7
  70. package/dist/flow-share.js +3 -1
  71. package/dist/flow-starters-ui.d.ts +3 -9
  72. package/dist/flow-starters-ui.js +12 -23
  73. package/dist/flow-steps.d.ts +9 -1
  74. package/dist/flow-steps.js +55 -5
  75. package/dist/flow-triggers.js +55 -0
  76. package/dist/flow-unattended-words.d.ts +20 -0
  77. package/dist/flow-unattended-words.js +24 -0
  78. package/dist/flow-unattended.d.ts +9 -5
  79. package/dist/flow-unattended.js +45 -23
  80. package/dist/flows-cli.d.ts +19 -0
  81. package/dist/flows-cli.js +54 -5
  82. package/dist/flows-ui.d.ts +12 -6
  83. package/dist/flows-ui.js +152 -32
  84. package/dist/flows.js +5 -2
  85. package/dist/integrations-ui.d.ts +6 -4
  86. package/dist/integrations-ui.js +34 -40
  87. package/dist/integrations.d.ts +2 -2
  88. package/dist/integrations.js +4 -4
  89. package/dist/kits-ui.d.ts +8 -10
  90. package/dist/kits-ui.js +29 -33
  91. package/dist/kits.js +1 -1
  92. package/dist/knowledge-ui.js +76 -19
  93. package/dist/lead-tools.js +35 -6
  94. package/dist/lead-voice.js +16 -5
  95. package/dist/ledger-view.d.ts +2 -0
  96. package/dist/ledger-view.js +41 -38
  97. package/dist/models-ui.d.ts +8 -3
  98. package/dist/models-ui.js +82 -59
  99. package/dist/monitoring-ui.d.ts +4 -2
  100. package/dist/monitoring-ui.js +44 -13
  101. package/dist/needs-you.d.ts +1 -1
  102. package/dist/needs-you.js +8 -0
  103. package/dist/operate-remote-arguments.js +1 -0
  104. package/dist/operate-remote.js +1 -1
  105. package/dist/operate.d.ts +1 -1
  106. package/dist/operate.js +249 -6
  107. package/dist/passwordless.d.ts +1 -1
  108. package/dist/passwordless.js +1 -1
  109. package/dist/people-audit-ui.d.ts +2 -1
  110. package/dist/people-audit-ui.js +25 -23
  111. package/dist/policy-ui.d.ts +3 -2
  112. package/dist/policy-ui.js +27 -21
  113. package/dist/policy.d.ts +3 -0
  114. package/dist/policy.js +14 -1
  115. package/dist/project-delete-ui.d.ts +4 -2
  116. package/dist/project-delete-ui.js +135 -126
  117. package/dist/project-delete.js +7 -3
  118. package/dist/project-knowledge.d.ts +10 -10
  119. package/dist/publish.d.ts +11 -0
  120. package/dist/publish.js +16 -3
  121. package/dist/pull-request-flow.js +35 -4
  122. package/dist/pull-request-ui.d.ts +2 -1
  123. package/dist/pull-request-ui.js +39 -28
  124. package/dist/recipe-ui.d.ts +4 -2
  125. package/dist/recipe-ui.js +14 -4
  126. package/dist/release-adapters.d.ts +3 -0
  127. package/dist/release-adapters.js +22 -2
  128. package/dist/release-cli.js +81 -9
  129. package/dist/release.d.ts +21 -0
  130. package/dist/release.js +40 -4
  131. package/dist/releases.js +1 -1
  132. package/dist/request-budget-ui.d.ts +4 -2
  133. package/dist/request-budget-ui.js +30 -19
  134. package/dist/result-follow-ups.js +4 -0
  135. package/dist/retention-ui.d.ts +4 -3
  136. package/dist/retention-ui.js +15 -12
  137. package/dist/scope.d.ts +8 -0
  138. package/dist/scope.js +13 -0
  139. package/dist/serve.d.ts +0 -1
  140. package/dist/serve.js +51 -7
  141. package/dist/server/agents-computers.d.ts +9 -0
  142. package/dist/server/agents-computers.js +67 -0
  143. package/dist/server/chat.js +20 -18
  144. package/dist/server/chrome.d.ts +1 -1
  145. package/dist/server/chrome.js +19 -9
  146. package/dist/server/console.css +31 -2
  147. package/dist/server/flows.js +79 -36
  148. package/dist/server/home.d.ts +35 -0
  149. package/dist/server/home.js +104 -0
  150. package/dist/server/http.d.ts +3 -0
  151. package/dist/server/http.js +5 -0
  152. package/dist/server/kit-standalone.d.ts +22 -0
  153. package/dist/server/kit-standalone.js +69 -0
  154. package/dist/server/kit.d.ts +405 -0
  155. package/dist/server/kit.js +361 -0
  156. package/dist/server/pages.d.ts +2 -1
  157. package/dist/server/pages.js +213 -174
  158. package/dist/server/people-tokens.js +26 -85
  159. package/dist/server/render-history.d.ts +51 -0
  160. package/dist/server/render-history.js +228 -0
  161. package/dist/server/render-new-task.d.ts +29 -0
  162. package/dist/server/render-new-task.js +96 -0
  163. package/dist/server/render-next.d.ts +63 -0
  164. package/dist/server/render-next.js +109 -0
  165. package/dist/server/render-pages.d.ts +35 -190
  166. package/dist/server/render-pages.js +154 -563
  167. package/dist/server/render-people.d.ts +24 -3
  168. package/dist/server/render-people.js +93 -72
  169. package/dist/server/render-projects.d.ts +103 -0
  170. package/dist/server/render-projects.js +247 -0
  171. package/dist/server/render-results.d.ts +5 -24
  172. package/dist/server/render-results.js +48 -185
  173. package/dist/server/render-settings.d.ts +5 -74
  174. package/dist/server/render-settings.js +102 -493
  175. package/dist/server/render-tasks.d.ts +43 -5
  176. package/dist/server/render-tasks.js +131 -91
  177. package/dist/server/route-table.js +31 -5
  178. package/dist/server/settings.js +276 -255
  179. package/dist/server/task-views.d.ts +8 -0
  180. package/dist/server/task-views.js +90 -2
  181. package/dist/server/tasks.d.ts +18 -0
  182. package/dist/server/tasks.js +148 -41
  183. package/dist/server/terminals.js +1 -1
  184. package/dist/server/welcome.d.ts +22 -0
  185. package/dist/server/welcome.js +69 -0
  186. package/dist/settings-groups-ui.d.ts +279 -0
  187. package/dist/settings-groups-ui.js +615 -0
  188. package/dist/settings-kit.d.ts +42 -6
  189. package/dist/settings-kit.js +69 -7
  190. package/dist/settings-proofs.js +1 -0
  191. package/dist/setup-guide.d.ts +2 -2
  192. package/dist/skills-ui.js +59 -7
  193. package/dist/slack-settings.js +12 -5
  194. package/dist/spend-ui.d.ts +45 -26
  195. package/dist/spend-ui.js +124 -56
  196. package/dist/sso-ui.d.ts +5 -2
  197. package/dist/sso-ui.js +63 -31
  198. package/dist/storage-ui.d.ts +3 -2
  199. package/dist/storage-ui.js +56 -50
  200. package/dist/store.d.ts +182 -5
  201. package/dist/store.js +512 -38
  202. package/dist/surface.js +23 -3
  203. package/dist/task-archive.d.ts +10 -0
  204. package/dist/task-archive.js +16 -0
  205. package/dist/task-control.d.ts +1 -1
  206. package/dist/teams-settings.d.ts +2 -1
  207. package/dist/teams-settings.js +24 -41
  208. package/dist/telegram-settings.d.ts +0 -4
  209. package/dist/telegram-settings.js +52 -25
  210. package/dist/tidy.d.ts +130 -0
  211. package/dist/tidy.js +503 -0
  212. package/dist/toolroll-update-ui.d.ts +8 -4
  213. package/dist/toolroll-update-ui.js +55 -45
  214. package/dist/tools-ui.d.ts +5 -3
  215. package/dist/tools-ui.js +107 -42
  216. package/dist/work-index.d.ts +24 -0
  217. package/dist/work-index.js +56 -30
  218. package/dist/workspace-ui.d.ts +1 -1
  219. package/dist/workspace-ui.js +8 -4
  220. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,88 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.87 — 2026-11-03
4
+
5
+ - **The whole app is redesigned.** Every page, from sign-in to Settings,
6
+ now has one calm look: the same buttons, forms, status words and phone
7
+ layout everywhere, and amber only for what needs you.
8
+ - **A new Home.** One summary of where things stand and one Needs-you count,
9
+ the same count you see in the side rail, the phone dock and the tab title.
10
+ - **A new task page.** One column with a five-step progress line (Plan ·
11
+ Approval · Build · Checks · Ready), then Plan or Result, Activity and
12
+ Attempts. Approving asks for a password only when one is needed: with
13
+ Passwordless or a remembered password it is one click, and an automatic
14
+ rule shows nothing to press. The box keeps the exact terms it showed you;
15
+ if they change, it offers Reload, never a yes.
16
+ - **Tasks, as a list or a board.** Filter by project and by Needs you,
17
+ Running, Queued or Finished, each with its count; each waiting task says
18
+ what it asks for and offers one action.
19
+ - **Ship shows how long each check took**, every pull request check on one
20
+ timeline.
21
+ - **Release progress.** A release task shows every step in order, where it
22
+ stands ("Deploy to this Mac · Step 6 of 13") and why it stopped.
23
+ - **A new lead chat**, plus **⌘K search** from anywhere and a `/search` page.
24
+ - **Flows on the phone.** The flow canvas pans and pinch-zooms on a phone,
25
+ and the Flows list, templates, kits and starter flows are on the new look.
26
+ - **Settings in eight groups**, with what needs you at the top. Each section
27
+ saves on its own. Spend and Models live in Settings too.
28
+ - **A first-run guide at `/welcome`**: set a password, add a project, pick an
29
+ agent and models, turn on phone alerts, file a first task. The next step is
30
+ always the one highlighted.
31
+ - **New task is one box**: pick the project, type, send. Everything else is
32
+ under More options.
33
+ - **Some Settings saves work again.** Turning sign-in with a provider on or
34
+ off, turning Passwordless on, request limits and adding a tool no longer
35
+ fail with "Toolroll refused this (404)", and a save that stays on the same
36
+ page now shows what was saved.
37
+ - **From the terminal:** `toolroll task ship <task>` shows a task's pull
38
+ request checks, `toolroll release status [<task>]` shows release progress,
39
+ `toolroll task list --view queued` lists queued work, and `toolroll release
40
+ --branch <name>` releases a branch named like one of the command's words.
41
+
42
+ ### Safety
43
+
44
+ - **Approving a flow's script is bound to the exact version you read.** If
45
+ the script changes after you looked, the approval doesn't count.
46
+ - **Changing a flow ends its "run on its own" approvals**; it waits for you
47
+ again.
48
+ - **Password pages open no live connection** to the rest of the app.
49
+ - **Project credential forms always show the password field**, even with
50
+ Passwordless on (Where builds write, Home folder, Check access, Network).
51
+ Before, they hid it and every save was refused.
52
+ - **Choosing providers no longer widens by accident.** "Any provider" now
53
+ means every provider ticked; ticking some saves exactly those.
54
+ - **Releases ignore the advisory youiyoux check**, so a design warning never
55
+ holds up a release.
56
+
57
+ ### For developers
58
+
59
+ - **youiyoux enforces the kit in CI.** A pull request that adds design drift
60
+ against the shared kit (`src/design/KIT.md`) fails the youiyoux job.
61
+
62
+ ## 0.9.86 — 2026-11-02
63
+
64
+ - **Old tasks tidy themselves.** A routine's newer run puts away its older
65
+ ones, a release task goes once its version ships or a newer attempt
66
+ replaces it, and a "Checks failed on main" notice goes once main passes
67
+ again. Running work, tasks you filed, and tasks handed to a person are
68
+ never touched. Each one says why it was put away.
69
+ - **Put away old tasks, in one step.** Needs you → **Put away old tasks**
70
+ shows exactly what would go and why, grouped, with a box to untick each
71
+ one; your password puts away exactly that list. **Put away** works on a
72
+ single task too. Nothing is deleted: the **Archived** view keeps every
73
+ task's history and has **Restore**. The same from the terminal:
74
+ `toolroll task tidy --preview`, then the `--apply --digest` command it
75
+ prints; `task archive`, `task restore`, `task list --view archived`.
76
+ - **Flows can drive a browser, once you allow it.** A flow step that starts a
77
+ browser (like the nightly journeys) now runs in its sandbox when a person
78
+ has allowed it: **Allow browser** on the flow page shows the exact script
79
+ and asks for your password, or `toolroll flows browser <flow> on`. Changing
80
+ the script ends the approval. Without it, the step waits with one line
81
+ saying what to allow, instead of crashing.
82
+ - **Deploys no longer stop halfway.** A deploy now proves the release
83
+ read-only and writes its "deploying" marker separately, so it finishes
84
+ instead of stopping with "attempt to write a readonly database".
85
+
3
86
  ## 0.9.85 — 2026-11-01
4
87
 
5
88
  - **Point at the exact screenshot.** Choose **Comment** beside a result's
@@ -98,8 +98,9 @@ export type FenceGrants = {
98
98
  * SEATBELT_NO_KEYCHAIN). Only fenceFor gives it, to a build's agent. Never a check's (one with sign-ins gets those in
99
99
  * its environment, invoke.ts keychainSignIns), never a tool server's (serverGrantsOf). */
100
100
  keychain?: true;
101
- /** macOS: a project check's launch, whose Chromium may start (sandbox-runtime.ts SEATBELT_CHROMIUM). Only fenceFor
102
- * sets it, only for kind "check". */
101
+ /** macOS: a project check's launch, or a flow script zone's with approved browser use, whose Chromium may start
102
+ * (sandbox-runtime.ts SEATBELT_CHROMIUM). Only fenceFor sets it: always for kind "check", for kind "flow" only when
103
+ * its caller proved the approval (flow-browser.ts). */
103
104
  browser?: true;
104
105
  /** A `sign-ins` check's exact sign-in files, read again inside the home denies (check-access.ts, signInGrants). */
105
106
  signIns?: SignInGrants;
@@ -391,6 +392,9 @@ export type FenceContext = {
391
392
  provider?: string;
392
393
  /** Scratch folders (a flow's) that stay denied whole inside the pool, whatever the policy. */
393
394
  scratchRoots?: readonly string[];
395
+ /** A flow's script zone whose browser use a person approved, proved at launch (flow-browser.ts browserStanding):
396
+ * Chromium's one service, as a check gets it. Read for kind "flow" only; every other kind ignores it. */
397
+ browser?: true;
394
398
  };
395
399
  /** A launch's sealed sandbox terms (builder.ts launchSandboxOf): its policy version, read denies and mach services. A
396
400
  * launch with none sealed is v1 with none of them. */
@@ -1167,8 +1167,9 @@ export function fenceFor(kind, ctx) {
1167
1167
  ...(written === null ? {} : { writes: written.writes, readOnly: [...new Set([...made.readOnly, ...written.readOnly])].sort() }),
1168
1168
  ...(ctx.network === undefined ? {} : { network: ctx.network }),
1169
1169
  ...(ctx.machLookup === undefined || ctx.machLookup.length === 0 ? {} : { machLookup: [...ctx.machLookup] }),
1170
- // A project's checks may drive a browser (Playwright's Chromium); builds, flows and tool servers don't get it.
1171
- ...(kind === "check" ? { browser: true } : {}),
1170
+ // A project's checks may drive a browser (Playwright's Chromium), and so may a flow's script zone whose browser use
1171
+ // a person approved (the caller proves it at launch); builds, tool servers and every other flow launch don't get it.
1172
+ ...(kind === "check" || (kind === "flow" && ctx.browser === true) ? { browser: true } : {}),
1172
1173
  // A build's agent signs in from the keychain (Claude Code does); nothing else it launches reaches it.
1173
1174
  ...(kind === "build" ? { keychain: true } : {}),
1174
1175
  // Under a write allowlist these are out of reach already; where the launch writes anywhere, they are denied by name.
@@ -130,4 +130,16 @@ export declare function laneNewestBuildSql(): string;
130
130
  export declare function agentLanesOf(store: Store, now: Date, access: {
131
131
  repos: readonly string[] | null;
132
132
  }, account: string, window: AgentLaneWindow, path?: string): BrowserAgentLanes | null;
133
+ /**
134
+ * The Agents list's every live agent, not only builds (UI revamp wave B): the build board's groups, with each running
135
+ * planner, scout and reviewer in the admitted projects added under Working (or Needs you when it asks). Reads the
136
+ * open leases only (store.liveRuns), then each run through the same admitted read the opened view uses.
137
+ */
138
+ export declare function agentsListOf(store: Store, now: Date, access: {
139
+ repos: readonly string[] | null;
140
+ }, account: string, root?: string): {
141
+ key: AgentGroupKey;
142
+ label: string;
143
+ rows: BrowserAgentRow[];
144
+ }[];
133
145
  export {};
@@ -332,3 +332,29 @@ export function agentLanesOf(store, now, access, account, window, path = "/agent
332
332
  running: tasks.length === 0 ? 0 : Number(tasks[0]["running"]),
333
333
  };
334
334
  }
335
+ /** The word a running planner, scout or reviewer wears on the Agents list (a build keeps its own state word). */
336
+ const ROLE_WORDS = { planner: "Planning", scout: "Investigating", reviewer: "Reviewing" };
337
+ /**
338
+ * The Agents list's every live agent, not only builds (UI revamp wave B): the build board's groups, with each running
339
+ * planner, scout and reviewer in the admitted projects added under Working (or Needs you when it asks). Reads the
340
+ * open leases only (store.liveRuns), then each run through the same admitted read the opened view uses.
341
+ */
342
+ export function agentsListOf(store, now, access, account, root) {
343
+ const groups = agentsBoardOf(store, now, access, account, root);
344
+ const shown = new Set(groups.flatMap(group => group.rows.map(row => row.runId)));
345
+ const extra = [];
346
+ for (const run of store.liveRuns(now)) {
347
+ const role = run.role;
348
+ if (!(role in ROLE_WORDS) || shown.has(run.id))
349
+ continue;
350
+ const facts = agentFactsFor(store, run.id, access, account);
351
+ if (facts === null)
352
+ continue;
353
+ const row = agentRowOf(store, facts, now, root);
354
+ extra.push(row.group === "working" || row.group === "stuck" ? { ...row, group: "working", label: ROLE_WORDS[role] } : row);
355
+ }
356
+ if (extra.length === 0)
357
+ return groups;
358
+ const all = [...groups.flatMap(group => group.rows), ...extra];
359
+ return AGENT_GROUPS.map(group => ({ ...group, rows: all.filter(row => row.group === group.key) })).filter(group => group.rows.length > 0);
360
+ }
@@ -30,7 +30,10 @@ export type ReleaseApprovalView = {
30
30
  at: string | null;
31
31
  canChange: boolean;
32
32
  };
33
- export declare function releaseApprovalHtml(view: ReleaseApprovalView): Html;
33
+ export declare function releaseApprovalHtml(view: ReleaseApprovalView, notice?: {
34
+ said?: string | null;
35
+ problem?: string | null;
36
+ }): Html;
34
37
  export declare function approvalRulesHtml(view: ApprovalRulesView, notice: {
35
38
  said?: string | null;
36
39
  problem?: string | null;
@@ -4,7 +4,9 @@
4
4
  * the identity provider); everyone else reads them. Every change is in the
5
5
  * ledger, before → after.
6
6
  */
7
- import { html, postForm, reauth } from "./html.js";
7
+ import { joinHtml } from "./html.js";
8
+ import { formRow, note, radios, settingsSection, switchInput, textarea } from "./server/kit.js";
9
+ import { kitSectionForm } from "./settings-kit.js";
8
10
  const RULES_CSS = `.approval-rules{max-width:720px;min-width:0}.approval-rules fieldset{border:0;padding:0;margin:18px 0 0;min-width:0}` +
9
11
  `.approval-rules legend{font-weight:600;font-size:.875rem;margin-bottom:8px}.approval-rules .choice{display:grid;grid-template-columns:auto minmax(0,1fr);gap:10px;align-items:start;margin:0 0 10px;font-weight:400}` +
10
12
  `.approval-rules .choice input{margin:.2rem 0 0}.approval-rules .choice strong{display:block;font-size:.875rem;font-weight:500}.approval-rules .choice small{display:block;color:var(--muted-foreground);font-size:.8125rem;margin-top:2px}` +
@@ -24,23 +26,37 @@ export function rulesSummary(rules) {
24
26
  parts.push(`Work touching ${rules.protectedPaths.join(", ")} is protected: two people approve it, never a subagent or an operating mode.`);
25
27
  return parts.length === 0 ? "No approval rules: anyone who can approve on this project can approve its work, including their own." : parts.join(" ");
26
28
  }
27
- export function releaseApprovalHtml(view) {
28
- const since = view.setBy === null ? "" : html ` <span class="meta">Changed by ${view.setBy} on ${(view.at ?? "").slice(0, 10)}.</span>`;
29
- const current = html `<p class="current">${view.auto ? "Releases approve themselves once the pull request's CI and the release check pass on the exact commit. Anything red still asks you." : "Every release waits for your approval."}${since}</p>`;
30
- const heading = html `<h2>Release approval</h2>`;
29
+ export function releaseApprovalHtml(view, notice = {}) {
30
+ const since = view.setBy === null ? "" : ` · changed by ${view.setBy} on ${(view.at ?? "").slice(0, 10)}`;
31
+ const current = view.auto ? "Releases approve themselves once the pull request’s CI and the release check pass on the exact commit. Anything red still asks you." : "Every release waits for your approval.";
31
32
  if (!view.canChange)
32
- return html `<section class="release-approval">${heading}${current}<p class="meta">An approver of this project sets this.</p></section>`;
33
- const choice = (value, title, hint) => html `<label class="choice"><input type="radio" name="action" value="${value}"${(view.auto ? "auto" : "ask") === value ? html ` checked` : ""}><span><strong>${title}</strong><small>${hint}</small></span></label>`;
34
- return html `<section class="release-approval">${heading}${current}${postForm("/settings/release-approval", html `<fieldset aria-label="Release approval">${choice("ask", "Ask me", "A release deploys only after you approve it.")}${choice("auto", "Approve automatically when checks pass", "You're told when a release approves itself. A failed check, red CI or a CI failure after the deploy still stops and asks you.")}</fieldset><div class="step-up"><label>Your Toolroll password (to approve automatically)<input type="password" name="password" autocomplete="current-password"></label></div><button type="submit">Save</button>`, { hidden: { repo: view.repo } })}</section>`;
33
+ return settingsSection({ id: "release-approval", title: "Releases", state: since, body: joinHtml([note(current), note("An approver of this project sets this.")]) });
34
+ return settingsSection({ id: "release-approval", title: "Releases", state: since, lead: current,
35
+ body: kitSectionForm({ proof: "release-approval", action: "/settings/release-approval", id: "release-form", gate: true, hidden: { repo: view.repo }, proofWhen: ["action", "auto"],
36
+ confirm: "Approve releases automatically", said: notice.said ?? null, problem: notice.problem ?? null,
37
+ body: formRow("Releases", "Turning this on asks for your password, every time, even with Passwordless on.", radios({ name: "action", legend: "Releases", current: view.auto ? "auto" : "ask", items: [
38
+ { value: "ask", label: "Ask me", text: "A release deploys only after you approve it." },
39
+ { value: "auto", label: "Approve automatically when checks pass", text: "You’re told when a release approves itself. A failed check, red CI or a CI failure after the deploy still stops and asks you." }
40
+ ] }), "wide") }) });
35
41
  }
36
42
  export function approvalRulesHtml(view, notice) {
37
- const note = notice.problem ? html `<p class="problem" role="alert">${notice.problem}</p>` : notice.said ? html `<p role="status">${notice.said}</p>` : "";
38
- const changed = view.rules.updatedBy === null ? "" : html ` <span class="meta">Changed by ${view.rules.updatedBy} on ${(view.rules.updatedAt ?? "").slice(0, 10)}.</span>`;
39
- const current = html `<p class="current">${rulesSummary(view.rules)}${changed}</p>`;
43
+ const changed = view.rules.updatedBy === null ? "" : ` · changed by ${view.rules.updatedBy} on ${(view.rules.updatedAt ?? "").slice(0, 10)}`;
44
+ const current = rulesSummary(view.rules);
40
45
  if (!view.canChange)
41
- return html `<section class="approval-rules">${note}${current}<p class="meta">An instance operator sets these.</p></section>`;
46
+ return settingsSection({ id: "rules", title: `Approval rules · ${view.name}`, state: changed, body: joinHtml([note(current), note("An instance operator sets these.")]) });
42
47
  const protect = view.rules.protectProject ? "project" : view.rules.protectedPaths.length > 0 ? "paths" : "none";
43
- const radio = (value, title, hint) => html `<label class="choice"><input type="radio" name="protect" value="${value}"${protect === value ? html ` checked` : ""}><span><strong>${title}</strong><small>${hint}</small></span></label>`;
44
- const few = view.approvers < 2 ? html `<p class="meta">Only ${view.approvers === 1 ? "one person" : "no one"} can approve on this project, so protected work would wait for a second approver. Add one in People first.</p>` : "";
45
- return html `<section class="approval-rules">${note}${current}${postForm("/settings/approval", html `<fieldset><legend>Who approves</legend><label class="choice"><input type="checkbox" name="not_requester" value="1"${view.rules.notRequester ? html ` checked` : ""}><span><strong>Someone other than the requester</strong><small>The person who filed a task, or asked for a revision, can't approve it. Operating modes stop approving their signer's own filings here.</small></span></label></fieldset><fieldset><legend>Protected work</legend>${radio("none", "Nothing protected", html `One approval is enough.`)}${radio("project", "The whole project", html `Every task needs two different people to approve the same scope.`)}${radio("paths", "Only these paths", html `Tasks that touch them, or don't say what they touch, need two people.`)}<div class="paths"><label>Protected paths, one per line<textarea name="paths" spellcheck="false" placeholder="infra/**&#10;migrations/**">${view.rules.protectedPaths.join("\n")}</textarea></label></div>${few}</fieldset><div class="step-up">${reauth(html `<label>Your Toolroll password<input type="password" name="password" autocomplete="current-password"></label>`)}</div><button type="submit">Save rules</button>`, { hidden: { repo: view.repo } })}</section>`;
48
+ const few = view.approvers < 2 ? note(`Only ${view.approvers === 1 ? "one person" : "no one"} can approve on this project, so protected work would wait for a second approver. Add one in People first.`) : "";
49
+ return settingsSection({ id: "rules", title: `Approval rules · ${view.name}`, state: changed, lead: current,
50
+ body: kitSectionForm({ proof: "approval", action: "/settings/approval", id: "rules-form", gate: true, hidden: { repo: view.repo }, confirm: "Change approval rules",
51
+ said: notice.said ?? null, problem: notice.problem ?? null,
52
+ body: joinHtml([
53
+ formRow("Someone other than the requester", "The person who filed a task, or asked for a revision, can’t approve it. Operating modes stop approving their signer’s own filings here.", switchInput({ id: "rules-not-requester", name: "not_requester", label: "Required", on: view.rules.notRequester, attrs: { value: "1", "aria-label": "Someone other than the requester" } }), "inline"),
54
+ formRow("Protected work", "Changes here always wait for two people, never a subagent or an operating mode.", radios({ name: "protect", legend: "Protected work", current: protect, items: [
55
+ { value: "none", label: "Nothing protected", text: "One approval is enough." },
56
+ { value: "project", label: "The whole project", text: "Every task needs two different people to approve the same scope." },
57
+ { value: "paths", label: "Only these paths", text: "Tasks that touch them, or don’t say what they touch, need two people." }
58
+ ] }), "wide"),
59
+ formRow("Protected paths", "One per line. Used when “Only these paths” is chosen.", textarea({ id: "rules-paths", name: "paths", value: view.rules.protectedPaths.join("\n"), rows: 3, attrs: { spellcheck: "false", placeholder: "infra/**\nmigrations/**", "aria-label": "Protected paths" } }), "top"),
60
+ few,
61
+ ]) }) });
46
62
  }
@@ -29,7 +29,7 @@ export function assignmentActionHref(assignment) {
29
29
  if (action.code === 'inspect-decisions')
30
30
  return '/';
31
31
  if (action.code === 'sign-in')
32
- return '/settings#providers';
32
+ return '/settings/agents#providers';
33
33
  // The confirmation sits on the task page, behind the password.
34
34
  if (action.code === 'confirm-stopped')
35
35
  return `/t/${encodeURIComponent(assignment.rootId)}#confirm-stopped`;
@@ -6,7 +6,7 @@ import { currentActor, withActor } from "./actor.js";
6
6
  import { replacedWords } from "./task-status.js";
7
7
  import { COMPLETER_ACTOR, COMPLETION_ACTION, COMPLETION_BY_MACHINE, COMPLETION_BY_PERSON, familyChangedFiles, landedReasonOf, personCompletionOwed } from "./result-completion.js";
8
8
  import { homedir } from "node:os";
9
- import { readSchemaVersion, stopFactOf } from "./store.js";
9
+ import { readSchemaVersion, refArchived, stopFactOf } from "./store.js";
10
10
  import { approvalOf, liveReleaseOf, machineActing } from "./scope.js";
11
11
  import { openWorkDecisionOf, taskWorkSummaryOf, workDecisionAction } from "./work-summary.js";
12
12
  import { evidenceRoot, readVerifiedArtifact, readVerifiedReport, verifyArtifact } from "./evidence.js";
@@ -170,14 +170,15 @@ export function assignmentOf(store, taskId, now, access, root, memo) {
170
170
  const attention = family.problem === null ? [] : [family.problem];
171
171
  // Family admission above precedes question bodies. The newest result
172
172
  // does not settle an unanswered question on any earlier version.
173
- const questions = [current, ...family.versions.filter(version => version.id !== current.id)].flatMap(version => {
173
+ // A put-away earlier version (v145) is history: its question and its queue place never hold the current one up.
174
+ const questions = [current, ...family.versions.filter(version => version.id !== current.id && !refArchived(store, version.refId))].flatMap(version => {
174
175
  const decision = openWorkDecisionOf(store, version.refId, now);
175
176
  return decision === null ? [] : [{ taskId: version.id, decision }];
176
177
  });
177
178
  // A finished task label cannot hide a lease or an unfinished process record.
178
179
  const busy = (version) => version.state === "running" || store.currentLiveLease(version.refId, now) !== null ||
179
180
  store.runsFor(version.refId).some(run => run.outcome === null || store.stopQuiescenceProblem(run.id) !== null);
180
- const earlierActive = family.versions.filter(version => version.id !== current.id && (version.state === "queued" || busy(version)));
181
+ const earlierActive = family.versions.filter(version => version.id !== current.id && ((version.state === "queued" && !refArchived(store, version.refId)) || busy(version)));
181
182
  // Of those, how many have work under way (the rest only wait in the queue).
182
183
  const earlierRunning = earlierActive.filter(busy).length;
183
184
  const unfinished = store.runsFor(current.refId).find(run => run.outcome === null) ?? null;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Settings → Backups (sprint 8): how the last backup went and one button to
3
- * back up now, then the schedule. Past backups and how to restore sit in
4
- * disclosures.
3
+ * back up now, then the schedule, past backups and how to restore. Built from
4
+ * the revamp kit (src/design/KIT.md); the Settings frame adds the title.
5
5
  */
6
6
  import { type Html } from "./html.js";
7
7
  import type { BackupRun, BackupSettings, LiveBackupState } from "./store.js";
@@ -10,7 +10,8 @@ export declare const BACKUP_EVERY_HOURS: readonly [1, 6, 12, 24];
10
10
  /** The continuous copy's choices, in minutes (live-backup.ts LIVE_EVERY_MINUTES; here so the page never loads it). */
11
11
  export declare const LIVE_EVERY: readonly [1, 5, 15, 30];
12
12
  export declare const MAX_KEEP = 100;
13
- export declare const BACKUP_CSS: string;
13
+ /** The page is kit pieces now; nothing of the old look is left. Kept as an export for the shared stylesheet. */
14
+ export declare const BACKUP_CSS = "";
14
15
  export type BackupView = {
15
16
  settings: BackupSettings;
16
17
  folder: string;
@@ -25,7 +26,7 @@ export type BackupView = {
25
26
  defaultFolder: string;
26
27
  };
27
28
  };
28
- export declare function backupHtml(view: BackupView, notice: {
29
+ export declare function backupHtml(view: BackupView, said: {
29
30
  said?: string | null;
30
31
  problem?: string | null;
31
32
  }): Html;
package/dist/backup-ui.js CHANGED
@@ -1,11 +1,13 @@
1
1
  /**
2
2
  * Settings → Backups (sprint 8): how the last backup went and one button to
3
- * back up now, then the schedule. Past backups and how to restore sit in
4
- * disclosures.
3
+ * back up now, then the schedule, past backups and how to restore. Built from
4
+ * the revamp kit (src/design/KIT.md); the Settings frame adds the title.
5
5
  */
6
- import { html, postForm, reauth } from "./html.js";
6
+ import { html, joinHtml, postForm } from "./html.js";
7
7
  import { bytesWords } from "./storage.js";
8
8
  import { whenUtc } from "./when-html.js";
9
+ import { btn, chip, codeLine, formRow, infoLine, input, note, notice, select, settingsRecord, settingsSection } from "./server/kit.js";
10
+ import { kitSectionForm } from "./settings-kit.js";
9
11
  /** The schedules on offer and the most copies kept. Here rather than in backup.ts so the page never loads `node:sqlite`. */
10
12
  export const BACKUP_EVERY_HOURS = [1, 6, 12, 24];
11
13
  /** The continuous copy's choices, in minutes (live-backup.ts LIVE_EVERY_MINUTES; here so the page never loads it). */
@@ -15,53 +17,80 @@ const when = (at) => whenUtc(at);
15
17
  const whenWords = (at) => `${at.slice(0, 16).replace("T", " ")} UTC`;
16
18
  const everyWords = (hours) => hours === 1 ? "Every hour" : hours === 24 ? "Every day" : `Every ${hours} hours`;
17
19
  const fileName = (path) => path.slice(path.lastIndexOf("/") + 1);
18
- export const BACKUP_CSS = `.backups{max-width:720px;min-width:0;overflow-wrap:anywhere}.backups .backup-state{display:flex;gap:16px;align-items:flex-start;justify-content:space-between;flex-wrap:wrap}` +
19
- `.backups .backup-state>div{flex:1 1 320px;min-width:0}.backups .backup-state h2{margin:0;font-size:1.0625rem}.backups .backup-state p{margin:4px 0 0}.backups .backup-state .problem{color:var(--danger)}` +
20
- `.backups .backup-state form{margin:0}.backups .backup-state button{white-space:nowrap}` +
21
- `.backups fieldset{border:0;padding:0;margin:0;min-width:0}.backups label{display:grid;gap:4px;margin:12px 0 0;font-size:.875rem}` +
22
- `.backups input[type=text],.backups input[type=number],.backups input[type=password],.backups select{width:100%;box-sizing:border-box;max-width:100%}` +
23
- `.backups .pair{display:grid;grid-template-columns:1fr 1fr;gap:12px}.backups button[type=submit]{margin-top:14px}` +
24
- `.backups details{margin-top:16px}.backups summary{cursor:pointer}.backups ol{list-style:none;padding:0;margin:8px 0 0}` +
25
- `.backups li{display:flex;gap:8px 12px;flex-wrap:wrap;padding:8px 0;border-top:1px solid var(--line, rgba(0,0,0,.08));font-size:.875rem}` +
26
- `.backups li .failed{color:var(--danger)}.backups code{white-space:nowrap}.backups pre{overflow-x:auto;margin:8px 0}` +
27
- `@media (max-width:900px){.backups .backup-state form,.backups .backup-state button{width:100%}.backups .pair{grid-template-columns:1fr}}`;
20
+ /** The page is kit pieces now; nothing of the old look is left. Kept as an export for the shared stylesheet. */
21
+ export const BACKUP_CSS = "";
28
22
  /** The continuous copy in one line: its latest verified copy, or why there is none. */
29
23
  function liveLine(view) {
30
24
  const live = view.live;
31
25
  if (live === undefined)
32
26
  return "";
33
27
  if (!live.state.settings.enabled)
34
- return html `<p class="meta">Continuous copy is off.</p>`;
28
+ return note("Continuous copy is off.");
35
29
  if (live.state.problem !== null)
36
- return html `<p class="problem" role="alert">The continuous copy failed: ${live.state.problem}</p>`;
30
+ return notice(`The continuous copy failed: ${live.state.problem}`);
37
31
  if (live.state.latest === null)
38
- return html `<p class="meta">The first continuous copy is made within a few minutes of Toolroll starting.</p>`;
39
- return html `<p class="meta" data-live-copy>Continuous copy checked ${when(live.state.latest.madeAt)}, every ${live.state.settings.everyMinutes === 1 ? "minute" : `${live.state.settings.everyMinutes} minutes`}.</p>`;
32
+ return note("The first continuous copy is made within a few minutes of Toolroll starting.");
33
+ return html `<p class="k-note" data-live-copy>Continuous copy checked ${when(live.state.latest.madeAt)}, every ${live.state.settings.everyMinutes === 1 ? "minute" : `${live.state.settings.everyMinutes} minutes`}.</p>`;
40
34
  }
41
- /** The state in one line, and the next backup (if any), for the top of the page. */
35
+ /** The last backup as one record: what happened, the next one, and Back up now. */
42
36
  function state(view) {
43
37
  const last = view.runs[0];
44
38
  const good = view.runs.find(one => one.ok === true);
45
39
  const next = !view.settings.enabled ? "Scheduled backups are off."
46
40
  : good === undefined ? "The first scheduled backup runs within a minute or two of the console starting."
47
41
  : `Next one about ${whenWords(new Date(Date.parse(good.startedAt) + view.settings.everyHours * 3_600_000).toISOString())}.`;
42
+ const now = postForm("/settings/backups/now", btn("Back up now", { sm: true, type: "submit" }));
48
43
  if (last === undefined)
49
- return html `<h2>No backups yet</h2><p class="meta">${next}</p>${liveLine(view)}`;
44
+ return settingsRecord({ title: "No backups yet", sub: next, action: now });
50
45
  if (last.ok === null)
51
- return html `<h2>Backing up</h2><p class="meta">Started ${when(last.startedAt)}.</p>`;
46
+ return settingsRecord({ title: html `Backing up ${chip("Running", "live")}`, sub: html `Started ${when(last.startedAt)}.`, action: now });
52
47
  if (last.ok === false) {
53
- return html `<h2 data-backup-state="failed">Last backup failed</h2><p class="problem" role="alert">${when(last.startedAt)}: ${last.error ?? "no reason was recorded"}</p><p class="meta">${good === undefined ? "No backup has succeeded yet." : html `Last good backup ${when(good.startedAt)}.`} ${next}</p>`;
48
+ return settingsRecord({ title: html `Last backup failed ${chip("Failed", "failed")}`, attrs: { "data-backup-state": "failed" }, action: now,
49
+ sub: html `${good === undefined ? "No backup has succeeded yet." : html `Last good backup ${when(good.startedAt)}.`} ${next}`,
50
+ more: notice(html `${when(last.startedAt)}: ${last.error ?? "no reason was recorded"}`) });
54
51
  }
55
- return html `<h2 data-backup-state="ok">Backed up ${when(last.startedAt)}</h2><p class="meta">${last.bytes === null ? "" : `${bytesWords(last.bytes)} · `}${next}</p>${liveLine(view)}`;
52
+ return settingsRecord({ title: html `Backed up ${when(last.startedAt)}`, attrs: { "data-backup-state": "ok" }, action: now,
53
+ sub: `${last.bytes === null ? "" : `${bytesWords(last.bytes)} · `}${next}` });
56
54
  }
57
- export function backupHtml(view, notice) {
55
+ /** One past backup: when, how it went, its file, and whether it was by hand. */
56
+ function runRow(run) {
57
+ const how = run.trigger === "manual" ? "By hand" : "Scheduled";
58
+ const attrs = { "data-backup-run": run.id };
59
+ if (run.ok === true) {
60
+ return settingsRecord({ title: when(run.startedAt), attrs, when: chip("Finished", "done"),
61
+ sub: html `${how}${run.bytes === null ? "" : ` · ${bytesWords(run.bytes)}`}${run.file === null ? "" : html ` · <span class="k-mono">${fileName(run.file)}</span>`}` });
62
+ }
63
+ if (run.ok === false)
64
+ return settingsRecord({ title: when(run.startedAt), attrs, when: chip("Failed", "failed"), sub: `${how} · ${run.error ?? "no reason recorded"}` });
65
+ return settingsRecord({ title: when(run.startedAt), attrs, when: chip("Running", "live"), sub: how });
66
+ }
67
+ export function backupHtml(view, said) {
58
68
  const s = view.settings;
59
- const note = notice.problem ? html `<p class="problem" role="alert">${notice.problem}</p>` : notice.said ? html `<p role="status">${notice.said}</p>` : "";
60
- const choices = [html `<option value="off"${s.enabled ? "" : html ` selected`}>Off</option>`,
61
- ...BACKUP_EVERY_HOURS.map(hours => html `<option value="${hours}"${s.enabled && s.everyHours === hours ? html ` selected` : ""}>${everyWords(hours)}</option>`)];
62
- const runs = view.runs.map(run => html `<li data-backup-run="${run.id}"><span>${when(run.startedAt)}</span>${run.ok === true ? html `<span>Succeeded${run.bytes === null ? "" : ` · ${bytesWords(run.bytes)}`}</span>${run.file === null ? "" : html `<span class="mono meta">${fileName(run.file)}</span>`}`
63
- : run.ok === false ? html `<span class="failed">Failed: ${run.error ?? "no reason recorded"}</span>` : html `<span>Running</span>`}<span class="meta">${run.trigger === "manual" ? "by hand" : "scheduled"}</span></li>`);
64
- return html `<section class="backups">${note}<div class="card backup-state"><div>${state(view)}</div>${postForm("/settings/backups/now", html `<button type="submit">Back up now</button>`)}</div><h2>Schedule</h2>${postForm("/settings/backups", html `<fieldset><div class="pair"><label>Back up<select name="every">${choices}</select></label><label>Keep the newest<input type="number" name="keep" min="1" max="${MAX_KEEP}" step="1" value="${s.keep}" required></label></div><label>Folder<input type="text" name="folder" value="${s.folder ?? ""}" placeholder="${view.defaultFolder}" spellcheck="false"></label>${liveFields(view)}${reauth(html `<label>Your Toolroll password<input type="password" name="password" autocomplete="current-password"></label>`)}</fieldset><button type="submit">Save</button>`)}<details><summary>Recent backups${view.runs.length === 0 ? "" : ` (${view.runs.length})`}</summary>${runs.length === 0 ? html `<p class="meta">None yet.</p>` : html `<ol>${runs}</ol>`}<p class="meta">In <span class="mono">${view.folder}</span>. Only the database is copied: provider keys and sign-in files stay out.</p></details><details><summary>Restore a backup</summary><p>Stop Toolroll, then run:</p><pre><code>toolroll restore &lt;file&gt; --dry-run</code></pre><p class="meta">The dry run checks the backup (its version and ledger chain) and changes nothing. Run it again without <code>--dry-run</code> to restore; the current database is kept as a copy first.</p>${view.live === undefined ? "" : html `<p class="meta">Continuous copies are in <span class="mono">${view.live.folder}</span>; restore one the same way.</p>`}</details></section>`;
69
+ const answer = said.problem ? notice(said.problem) : said.said ? infoLine(said.said) : "";
70
+ const now = settingsSection({ id: "backup-now", title: "Last backup", body: joinHtml([answer, state(view), liveLine(view)]) });
71
+ const every = select({ id: "backup-every", name: "every", label: "Back up", current: s.enabled ? String(s.everyHours) : "off",
72
+ items: [["off", "Off"], ...BACKUP_EVERY_HOURS.map(hours => [String(hours), everyWords(hours)])] });
73
+ const schedule = settingsSection({ id: "backup-schedule", title: "Schedule", lead: "Only the database is copied: provider keys and sign-in files stay out.",
74
+ body: kitSectionForm({ proof: "backups", action: "/settings/backups", id: "backup-form", gate: true,
75
+ body: joinHtml([
76
+ formRow("Back up", null, every, "inline"),
77
+ formRow("Keep the newest", "How many backups to keep. Older ones are removed.", input({ id: "backup-keep", name: "keep", type: "number", value: String(s.keep),
78
+ attrs: { min: 1, max: MAX_KEEP, step: 1, required: true, "aria-label": "Keep the newest" } }), "inline"),
79
+ formRow("Folder", "Blank: the default folder.", input({ id: "backup-folder", name: "folder", value: s.folder ?? "",
80
+ attrs: { placeholder: view.defaultFolder, spellcheck: "false", "aria-label": "Folder" } })),
81
+ liveFields(view),
82
+ ]) }) });
83
+ const runs = view.runs.map(runRow);
84
+ const history = settingsSection({ id: "backup-history", title: "Past backups", state: view.runs.length === 0 ? "" : ` · ${view.runs.length}`,
85
+ lead: html `In <span class="k-mono">${view.folder}</span>.`,
86
+ body: runs.length === 0 ? note("None yet.") : joinHtml(runs) });
87
+ const restore = settingsSection({ id: "backup-restore", title: "Restore a backup", lead: "Stop Toolroll, then run:",
88
+ body: joinHtml([
89
+ codeLine("toolroll restore <file> --dry-run"),
90
+ note(html `The dry run checks the backup (its version and ledger chain) and changes nothing. Run it again without <code class="k-mono">--dry-run</code> to restore; the current database is kept as a copy first.`),
91
+ view.live === undefined ? "" : note(html `Continuous copies are in <span class="k-mono">${view.live.folder}</span>; restore one the same way.`),
92
+ ]) });
93
+ return joinHtml([now, schedule, history, restore]);
65
94
  }
66
95
  /** The continuous copy's two choices, beside the schedule's: how often, and where (blank: beside the database). */
67
96
  function liveFields(view) {
@@ -69,7 +98,11 @@ function liveFields(view) {
69
98
  if (live === undefined)
70
99
  return "";
71
100
  const on = live.state.settings;
72
- const choices = [html `<option value="off"${on.enabled ? "" : html ` selected`}>Off</option>`,
73
- ...LIVE_EVERY.map(minutes => html `<option value="${minutes}"${on.enabled && on.everyMinutes === minutes ? html ` selected` : ""}>${minutes === 1 ? "Every minute" : `Every ${minutes} minutes`}</option>`)];
74
- return html `<div class="pair"><label>Copy continuously<select name="live_every">${choices}</select></label><label>Copy folder<input type="text" name="live_folder" value="${on.folder ?? ""}" placeholder="${live.defaultFolder}" spellcheck="false"></label></div>`;
101
+ const every = select({ id: "backup-live-every", name: "live_every", label: "Copy continuously", current: on.enabled ? String(on.everyMinutes) : "off",
102
+ items: [["off", "Off"], ...LIVE_EVERY.map(minutes => [String(minutes), minutes === 1 ? "Every minute" : `Every ${minutes} minutes`])] });
103
+ return joinHtml([
104
+ formRow("Copy continuously", "A checked copy of the database every few minutes, between backups.", every, "inline"),
105
+ formRow("Copy folder", "Blank: beside the database.", input({ id: "backup-live-folder", name: "live_folder", value: on.folder ?? "",
106
+ attrs: { placeholder: live.defaultFolder, spellcheck: "false", "aria-label": "Copy folder" } })),
107
+ ]);
75
108
  }