toolroll 0.9.108 → 0.9.110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/advanced-view.js +0 -1
  3. package/dist/agent-detect.js +244 -0
  4. package/dist/agent-fence.js +47 -5
  5. package/dist/agent-state.js +5 -2
  6. package/dist/agentconfig.js +2 -2
  7. package/dist/approval-summary.js +344 -0
  8. package/dist/assignment-ui.js +5 -5
  9. package/dist/assignment.js +5 -2
  10. package/dist/attest.js +2 -2
  11. package/dist/browser/terminal.js +1 -1
  12. package/dist/browser/workspace.css +2 -2
  13. package/dist/browser/workspace.js +37 -34
  14. package/dist/browser-crew.js +4 -4
  15. package/dist/browser-workspace.js +4 -11
  16. package/dist/builder.js +45 -3
  17. package/dist/chat-actions.js +24 -17
  18. package/dist/chat-controls.js +6 -5
  19. package/dist/chat-core.js +3 -1
  20. package/dist/chat-decide.js +102 -47
  21. package/dist/chat-delivery-state.js +2 -0
  22. package/dist/chat-delivery.js +3 -2
  23. package/dist/chat-live.js +2 -1
  24. package/dist/chat-quiet.js +3 -3
  25. package/dist/chat-task-actions.js +6 -0
  26. package/dist/chat-voice.js +2 -2
  27. package/dist/check-report.js +1 -1
  28. package/dist/cli-help.js +12 -13
  29. package/dist/cli.js +6 -3
  30. package/dist/console-chrome.js +10 -3
  31. package/dist/console-instance.js +10 -1
  32. package/dist/contracts/console-api.js +14 -8
  33. package/dist/contracts/engine-api.js +271 -0
  34. package/dist/contracts/handoff.js +4 -0
  35. package/dist/coordinator.js +2 -2
  36. package/dist/decision.js +17 -0
  37. package/dist/demo-chat.js +1 -1
  38. package/dist/demo.js +6 -0
  39. package/dist/design/kit.js +4 -3
  40. package/dist/discord-api.js +4 -3
  41. package/dist/discord-chat.js +3 -1
  42. package/dist/dispatch.js +3 -8
  43. package/dist/easy-start-args.js +7 -3
  44. package/dist/easy-start.js +25 -0
  45. package/dist/egress.js +72 -10
  46. package/dist/engine-handoff.js +34 -0
  47. package/dist/engine-reads.js +261 -0
  48. package/dist/eval-world.js +3 -2
  49. package/dist/evidence.js +2 -0
  50. package/dist/fast-start.js +55 -14
  51. package/dist/fast-terms.js +2 -2
  52. package/dist/first-run.js +10 -2
  53. package/dist/flexible-agents.js +234 -0
  54. package/dist/flexible-answers-schema.js +61 -0
  55. package/dist/flexible-answers.js +889 -0
  56. package/dist/flexible-available.js +1 -0
  57. package/dist/flexible-custody.js +494 -0
  58. package/dist/flexible-import.js +782 -0
  59. package/dist/flexible-launch-schema.js +72 -0
  60. package/dist/flexible-launch.js +331 -0
  61. package/dist/flexible-launcher.js +88 -0
  62. package/dist/flexible-levels.js +34 -0
  63. package/dist/flexible-merge-guard.js +47 -0
  64. package/dist/flexible-refs.js +47 -0
  65. package/dist/flexible-relay-cancel.js +19 -0
  66. package/dist/flexible-relay-schema.js +55 -0
  67. package/dist/flexible-relay-upstreams.js +36 -0
  68. package/dist/flexible-relay.js +1032 -0
  69. package/dist/flexible-schema.js +32 -0
  70. package/dist/flexible-session.js +732 -0
  71. package/dist/flexible-ship-schema.js +81 -0
  72. package/dist/flexible-ship.js +694 -0
  73. package/dist/flexible-start.js +80 -0
  74. package/dist/flexible-thread-schema.js +30 -0
  75. package/dist/flexible-thread.js +676 -0
  76. package/dist/flexible-turns-schema.js +69 -0
  77. package/dist/flexible-turns.js +490 -0
  78. package/dist/flexible-ui.js +44 -0
  79. package/dist/flexible.js +368 -0
  80. package/dist/flow-actions.js +6 -4
  81. package/dist/flow-steps.js +1 -1
  82. package/dist/flows-cli.js +2 -1
  83. package/dist/git-views.js +44 -41
  84. package/dist/guides.js +11 -10
  85. package/dist/install-mode.js +225 -0
  86. package/dist/keymap.js +1 -1
  87. package/dist/lead-context.js +1 -1
  88. package/dist/lead-doors.js +7 -1
  89. package/dist/limits-ui.js +8 -1
  90. package/dist/live-bus.js +70 -13
  91. package/dist/live-reply.js +6 -0
  92. package/dist/live-terminal.js +425 -29
  93. package/dist/local-owner.js +6 -0
  94. package/dist/model-choices.js +12 -6
  95. package/dist/needs-you.js +3 -3
  96. package/dist/nightly-github.js +2 -2
  97. package/dist/notification-delivery.js +11 -0
  98. package/dist/operate.js +185 -33
  99. package/dist/outbound-privacy.js +204 -0
  100. package/dist/passwordless.js +2 -1
  101. package/dist/project-delete-ui.js +2 -1
  102. package/dist/project-delete.js +15 -0
  103. package/dist/provider-auth.js +1 -1
  104. package/dist/provider-connection.js +5 -3
  105. package/dist/publish.js +5 -0
  106. package/dist/pull-request-flow.js +26 -7
  107. package/dist/push.js +5 -1
  108. package/dist/release-card.js +11 -3
  109. package/dist/release.js +11 -1
  110. package/dist/result-actions.js +3 -0
  111. package/dist/result-evidence-readers.js +8 -2
  112. package/dist/result-review.js +20 -9
  113. package/dist/route-store.js +2 -2
  114. package/dist/sandbox-launch.js +32 -8
  115. package/dist/sandbox-runtime.js +16 -7
  116. package/dist/sandbox-tools.js +176 -0
  117. package/dist/scope.js +12 -36
  118. package/dist/scout-net.js +7 -2
  119. package/dist/serve.js +90 -40
  120. package/dist/server/chat.js +9 -9
  121. package/dist/server/chrome.js +19 -17
  122. package/dist/server/console.css +33 -6
  123. package/dist/server/engine-api.js +378 -0
  124. package/dist/server/flows.js +2 -2
  125. package/dist/server/guards.js +10 -4
  126. package/dist/server/home.js +37 -5
  127. package/dist/server/http.js +11 -2
  128. package/dist/server/in-place.js +5 -4
  129. package/dist/server/kit.js +2 -2
  130. package/dist/server/link-redemption.js +52 -0
  131. package/dist/server/live.js +100 -10
  132. package/dist/server/mutation-key.js +21 -7
  133. package/dist/server/pages.js +129 -74
  134. package/dist/server/people-tokens.js +17 -41
  135. package/dist/server/render-chat.js +2 -1
  136. package/dist/server/render-history.js +18 -4
  137. package/dist/server/render-new-task.js +4 -4
  138. package/dist/server/render-pages.js +21 -39
  139. package/dist/server/render-people.js +2 -2
  140. package/dist/server/render-projects.js +5 -5
  141. package/dist/server/render-results.js +30 -14
  142. package/dist/server/render-tasks.js +155 -155
  143. package/dist/server/retired-routes.js +37 -4
  144. package/dist/server/route-policy.js +8 -0
  145. package/dist/server/route-table.js +43 -5
  146. package/dist/server/settings-computers.js +140 -0
  147. package/dist/server/settings-scripts.js +15 -0
  148. package/dist/server/settings-section-table.js +59 -0
  149. package/dist/server/settings-sections.js +291 -0
  150. package/dist/server/settings.js +247 -28
  151. package/dist/server/task-views.js +55 -15
  152. package/dist/server/tasks.js +168 -98
  153. package/dist/server/terminals.js +181 -28
  154. package/dist/server/welcome.js +40 -14
  155. package/dist/settings-groups-ui.js +26 -107
  156. package/dist/settings-proofs.js +18 -11
  157. package/dist/slack-api.js +4 -3
  158. package/dist/slack-chat.js +5 -3
  159. package/dist/spend.js +46 -12
  160. package/dist/sqlite-telemetry.js +70 -21
  161. package/dist/status-probe.js +343 -0
  162. package/dist/store.js +206 -10
  163. package/dist/task-link.js +64 -0
  164. package/dist/teams-api.js +4 -3
  165. package/dist/teams-chat.js +4 -2
  166. package/dist/telegram-lead.js +2 -1
  167. package/dist/telegram-live.js +2 -1
  168. package/dist/telegram-team.js +2 -1
  169. package/dist/telegram.js +17 -5
  170. package/dist/trusted-path.js +162 -0
  171. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  172. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  173. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  174. package/dist/tui/linux-x64/toolroll-tui +0 -0
  175. package/dist/tui-launch.js +282 -0
  176. package/dist/tui-source.js +5 -3
  177. package/dist/tui.js +2 -2
  178. package/dist/typed-words-schema.js +18 -0
  179. package/dist/webhooks.js +8 -4
  180. package/dist/welcome-facts.js +25 -17
  181. package/dist/work-index.js +126 -29
  182. package/dist/work-reads.js +279 -0
  183. package/dist/workspace-ui.js +5 -0
  184. package/package.json +4 -2
  185. package/scripts/crash-canary.mjs +1 -1
  186. package/scripts/pilot.mjs +1 -1
  187. package/scripts/provider-canary.mjs +5 -3
@@ -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="/tasks">+${more} more in Tasks</a>` : null}</details>`;
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="/tasks?view=board">${projectName(data.project)}</a> · <strong>all projects</strong>`} — every project this server serves, each card wearing its project`
186
- : html `<strong>${projectName(data.project)}</strong> · <a href="/tasks?view=board&scope=all">all projects</a>`}</p>`;
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="/tasks?view=order">order →</a> <span class="meta">drag to reorder, or to keep a task for one builder</span></p>`,
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="/tasks?view=done">Done recently</a>`)}</h2></summary><p class="hint">The most recent. The full list is under Done.</p>${doneCards}</details>`,
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 `${taskHref(target.taskId)}?tab=result&run=${target.runId}`;
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 = [['/tasks?view=order', 'Order the queue'], ['/recipes', 'Recipes'], ...(chrome.projectScoped ? [] : [['/tasks?scope=all', 'Every project']]), ['/ledger', 'Audit log']];
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
- if (row.archived !== undefined) {
393
- const act = tidyAct(row);
394
- const project = data.multiProject || row.repo === null ? html `<span class="project-label">${row.repo === null ? 'Unplaced' : projectName(row.repo)}</span>` : null;
395
- return html `<article class="work-row" data-task="${row.rootId}" data-work-status="archived" data-work-views="archived"><div class="work-row-main"><a class="work-title" href="${taskHref(row.rootId)}">${row.title}</a><p class="work-meta">${project}<span>${relativeAge(row.archived.at, data.now)}</span><span class="mono">${row.rootId}</span></p><p class="work-detail" data-archived-by>${archivedWords(row.archived)}</p></div><div class="work-row-status">${act === null ? null : postForm(act.action, html `<button type="submit" class="secondary">${act.label}</button>`, { hidden: { return: returnTo }, attrs: { class: 'inline', 'data-tidy-act': 'restore' } })}</div></article>`;
396
- }
397
- const target = row.primaryAction?.target;
398
- const actionHref = row.primaryAction?.code === 'open-result' && target?.runId != null
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("/tasks?view=order&fragment=1",{redirect:"manual",cache:"no-store"})` +
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("/tasks?view=order&fragment=1",{redirect:"manual",cache:"no-store"}).then(function(f){` +
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="/tasks?view=order";}})` +
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="/tasks">Tasks</a></li><li><span aria-current="page">Archive old tasks</span></li></ol></nav>`;
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="/tasks?view=archived">See archived tasks →</a></p>`
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>\
@@ -182,7 +182,7 @@ export function serverErrorPage(options) {
182
182
  return shell("Toolroll is updating", outPage({
183
183
  brand: BRAND_HTML, title: "Toolroll is updating",
184
184
  sub: "Work that is running can finish. New work starts again after the update, usually within two minutes.",
185
- body: html `<div class="k-acts">${options.retry === null ? "" : btn("Try again", { variant: "primary", href: options.retry })}${btn("Go to Home", { href: "/" })}</div>`,
185
+ body: html `<div class="k-acts">${options.retry === null ? "" : btn("Try again", { variant: "primary", href: options.retry })}${btn("Go to Work", { href: "/" })}</div>`,
186
186
  }), { nav: false });
187
187
  }
188
188
  return shell("Something went wrong", outPage({
@@ -191,7 +191,7 @@ export function serverErrorPage(options) {
191
191
  : "Toolroll couldn't finish that. Open the page again to see what changed before you try again.",
192
192
  body: joinHtml([
193
193
  facts([["Reference", html `<span class="k-mono">${options.reference}</span>`], ["When", options.at.toISOString().slice(0, 16).replace("T", " ")]]),
194
- html `<div class="k-acts">${options.retry === null ? "" : btn("Try again", { variant: "primary", href: options.retry })}${btn("Go to Home", { href: "/" })}</div>`,
194
+ html `<div class="k-acts">${options.retry === null ? "" : btn("Try again", { variant: "primary", href: options.retry })}${btn("Go to Work", { href: "/" })}</div>`,
195
195
  ]),
196
196
  foot: "If it keeps happening, the reference helps whoever runs this Toolroll find it in the log.",
197
197
  }), { nav: false });
@@ -151,17 +151,17 @@ export function projectPage(chrome, data) {
151
151
  const counts = peek === null
152
152
  ? note("Not scanned yet.")
153
153
  : html `<p>${joinHtml([
154
- countWords(peek.waiting, peek.waiting === 1 ? "needs you" : "need you", "/tasks"),
155
- countWords(peek.running, "running", "/tasks"),
156
- countWords(peek.queued, "queued", "/tasks?view=order"),
157
- countWords(peek.doneRecently, "built today", "/tasks?view=done"),
154
+ countWords(peek.waiting, peek.waiting === 1 ? "needs you" : "need you", "/"),
155
+ countWords(peek.running, "running", "/"),
156
+ countWords(peek.queued, "queued", "/?view=order"),
157
+ countWords(peek.doneRecently, "built today", "/?view=done"),
158
158
  ], " · ")}</p>`;
159
159
  const tasks = data.tasks.length === 0
160
160
  ? note(`Nothing needs you or is running in ${data.name}.`)
161
161
  : html `${data.tasks.map(task => row({
162
162
  href: task.href, chip: task.needs ? status("needs") : status("running"), title: task.title, desc: task.reason, wait: task.needs,
163
163
  meta: task.since === null ? "" : html `<span class="k-num">${relativeAge(task.since, data.now)}</span>`,
164
- }))}${data.moreTasks > 0 ? note(data.open ? html `<a class="k-link" href="/tasks">${data.moreTasks} more in Tasks</a>` : `${data.moreTasks} more`) : ""}`;
164
+ }))}${data.moreTasks > 0 ? note(data.open ? html `<a class="k-link" href="/">${data.moreTasks} more in Work</a>` : `${data.moreTasks} more`) : ""}`;
165
165
  const setup = facts([
166
166
  ["Folder", mono(data.path)],
167
167
  ...(data.checks === null ? [] : [["Checks", html `<a class="k-link" href="${data.checks.href}">${data.checks.level}</a>`]]),
@@ -27,6 +27,7 @@ import { ACCEPT_NEEDS_REASON, acceptWordsOf, cantAcceptYetOf, evidenceProblemOf,
27
27
  import { createHash, randomBytes } from "node:crypto";
28
28
  import { buildsViews, oneLineOf, projectChip, safePrUrl, screen, sentenceCase, strokeIcon, when, whenTime } from "./chrome.js";
29
29
  import { chatResultHref, reviewHref, taskChatHref, taskHref } from "./http.js";
30
+ import { taskLinkOf } from "../task-link.js";
30
31
  import { attributes, html, htmlString, joinHtml, postForm, reauth } from "../html.js";
31
32
  import { chip, facts } from "./kit.js";
32
33
  import { publicationFactsOf, statusActionHref, statusLineHtml } from "./render-tasks.js";
@@ -519,6 +520,9 @@ export function reviewCockpitDetailParts(view, csrf, noted, canRetryReview, tab,
519
520
  problem: view.detail === null ? view.historyProblem : null,
520
521
  next: reviewNextActionOf(view, csrf, host.kind === "task" && run !== null ? `${host.base}&run=${run.id}` : undefined), complete: null, decision: null, checks: null, intent: intentView, noRun: null, panel: null,
521
522
  notes: view.notes.map(one => ({ author: one.author, at: one.createdAt, note: one.note })),
523
+ agentReport: run === null || view.detail === null ? null : view.detail.handoff?.report ?? EMPTY_AGENT_REPORT,
524
+ youSaid: (view.youSaid ?? []).map(one => ({ kind: one.kind, author: one.author, you: one.author === user, at: one.at, note: quotedNoteOf(one.note),
525
+ question: one.question === null ? null : quotedNoteOf(one.question) })),
522
526
  efficiency: view.efficiency ?? null,
523
527
  network: view.network ?? null,
524
528
  timing: view.timing ?? null,
@@ -537,10 +541,9 @@ export function reviewCockpitDetailParts(view, csrf, noted, canRetryReview, tab,
537
541
  return { html: html `<section class="cockpit-detail">${joinHtml(parts, "\n")}</section>`, selected: { ...selected, noRun: "This task has no finished build record, so there are no captured changes or checks to review." } };
538
542
  }
539
543
  const extraChecks = reviewRetryPanel(view.taskId, run.id, view.reviewRetry, { csrf, canAct: false, returnTo: null });
540
- const here = reviewHref(view.taskId);
541
544
  const at = (section = "summary") => host.kind === "task"
542
545
  ? `${host.base}&run=${run.id}${section === "summary" ? "" : `&section=${section}`}`
543
- : `${here}&run=${run.id}${section === "summary" ? "" : `&tab=${section}`}`;
546
+ : taskLinkOf({ task: view.taskId, run: run.id, section });
544
547
  const assignment = view.assignment === null ? null : assignmentWithEvidence(view.assignment, receiptStatusOf(view.detail.receipt), run.id);
545
548
  const saved = assignment?.receipt?.checks;
546
549
  const checks = saved === undefined || assignment?.receipt == null ? undefined
@@ -549,7 +552,14 @@ export function reviewCockpitDetailParts(view, csrf, noted, canRetryReview, tab,
549
552
  parts.push(html `<p class="${checks.status === "failed" || checks.status === "unavailable" ? "problem" : "meta"}" data-actual-checks="${checks.status}">${checks.status === "unavailable" && saved.cause === "command-changed" ? CHECK_COMMAND_CHANGED : html `${checks.status === "unavailable" && saved.status !== "unavailable" ? `${CHECK_UNREADABLE} ` : ""}${checks.detail}`}${checks.logArtifactId === null ? "" : html ` <a href="/r/${run.id}/evidence/${checks.logArtifactId}">Open check output</a>`}</p>`);
550
553
  if (assignment?.completion != null)
551
554
  parts.push(html `<p class="meta" data-result-completed>Accepted by ${assignment.completion.actor.replace(/^operator:/, "")}.</p>`);
555
+ const own = taskLinkOf({ task: view.taskId, run: run.id });
556
+ const ownOr = (href) => href === own || /^[&#]/.test(href.slice(own.length)) && href.startsWith(own) ? href.slice(own.length) : null;
557
+ const failure = view.failure == null ? null : { line: view.failure.line, evidence: view.failure.evidence, suggestion: view.failure.suggestion, retry: view.failure.retry,
558
+ link: view.failure.link === null || (ownOr(view.failure.link.href) !== null && !view.failure.link.href.includes("#")) ? null
559
+ : host.kind === "task" && ownOr(view.failure.link.href)?.startsWith("&section=") === true ? { ...view.failure.link, href: `${host.base}&run=${run.id}${ownOr(view.failure.link.href)}` } : view.failure.link,
560
+ ...(view.failure.acceptAnyway == null ? {} : { acceptAnyway: { ...view.failure.acceptAnyway, returnTo: at() } }) };
552
561
  const panel = resultPanelParts(view.detail, {
562
+ ...(host.kind === "task" && host.alone === true && failure !== null ? { failed: { line: failure.line, evidence: failure.evidence, link: failure.link } } : {}),
553
563
  place: "review",
554
564
  tab,
555
565
  csrf,
@@ -595,10 +605,6 @@ export function reviewCockpitDetailParts(view, csrf, noted, canRetryReview, tab,
595
605
  ? { action: `/r/${run.id}/checks`, level: followUps.full ? "full" : "quick", returnTo: at("checks") } : null;
596
606
  const need = panel.panel.need;
597
607
  const nextKind = selected.next?.kind;
598
- const failure = view.failure == null ? null : { line: view.failure.line, evidence: view.failure.evidence, suggestion: view.failure.suggestion, retry: view.failure.retry,
599
- link: view.failure.link === null || (view.failure.link.href.startsWith(`${here}&run=${run.id}`) && !view.failure.link.href.includes("#")) ? null
600
- : host.kind === "task" && view.failure.link.href.startsWith(`${here}&run=${run.id}&tab=`) ? { ...view.failure.link, href: view.failure.link.href.replace(`${here}&run=${run.id}&tab=`, `${host.base}&run=${run.id}&section=`) } : view.failure.link,
601
- ...(view.failure.acceptAnyway == null ? {} : { acceptAnyway: { ...view.failure.acceptAnyway, returnTo: at() } }) };
602
608
  const actFacts = failure !== null
603
609
  ? { accept: null, runChecks: runChecks !== null, checksRunning, blocked: null, canRequest: false, need: null, next: null, failed: { retry: failure.retry !== null, acceptAnyway: failure.acceptAnyway !== undefined } }
604
610
  : {
@@ -1019,12 +1025,12 @@ export function parseReviewDiff(text) {
1019
1025
  }
1020
1026
  if (file === null)
1021
1027
  continue;
1022
- if (raw.startsWith("--- ")) {
1028
+ if (hunk === null && raw.startsWith("--- ")) {
1023
1029
  file.oldPath = pathOf(raw.slice(4));
1024
1030
  file.meta.push(raw);
1025
1031
  continue;
1026
1032
  }
1027
- if (raw.startsWith("+++ ")) {
1033
+ if (hunk === null && raw.startsWith("+++ ")) {
1028
1034
  const nextPath = pathOf(raw.slice(4));
1029
1035
  if (nextPath !== "/dev/null")
1030
1036
  file.path = nextPath;
@@ -1049,11 +1055,11 @@ export function parseReviewDiff(text) {
1049
1055
  continue;
1050
1056
  }
1051
1057
  rendered += 1;
1052
- if (raw.startsWith("+") && !raw.startsWith("+++")) {
1058
+ if (raw.startsWith("+")) {
1053
1059
  hunk.lines.push({ kind: "addition", text: raw.slice(1), oldLine: null, newLine });
1054
1060
  newLine += 1;
1055
1061
  }
1056
- else if (raw.startsWith("-") && !raw.startsWith("---")) {
1062
+ else if (raw.startsWith("-")) {
1057
1063
  hunk.lines.push({ kind: "deletion", text: raw.slice(1), oldLine, newLine: null });
1058
1064
  oldLine += 1;
1059
1065
  }
@@ -1590,6 +1596,7 @@ export function resultPanelParts(detail, o) {
1590
1596
  revisionSealFields(detail.comments, detail.sourceDigest),
1591
1597
  html `<input type="hidden" data-recorded-requests value="${[...detail.comments, ...(detail.pastComments ?? [])].filter(one => one.sourceKey?.startsWith(`review:${o.user}:`)).map(one => one.sourceKey.slice(`review:${o.user}:`.length)).join(",")}">`,
1592
1598
  html `<input type="hidden" name="image" value=""><figure class="feedback-image" data-feedback-image hidden><img alt="Selected screenshot" hidden><figcaption></figcaption><button type="button" class="quiet" data-remove-image>Remove image</button></figure>`,
1599
+ html `<input type="hidden" name="context" value=""><div class="meta" data-request-context-line hidden></div>`,
1593
1600
  html `<textarea name="note" rows="2" maxlength="${LIMITS.note}" placeholder="Describe the change…" aria-label="review comment" aria-describedby="comment-note-limit"${o.noted ? " autofocus" : ""}></textarea>`,
1594
1601
  html `<span class="meta diff-comment-limit" id="comment-note-limit">up to ${LIMITS.note} characters</span>`,
1595
1602
  html `<details class="result-pin"><summary>Attach to a file or line</summary>`,
@@ -1610,10 +1617,12 @@ export function resultPanelParts(detail, o) {
1610
1617
  html `<section class="card result-panel" id="result" data-result-panel data-result-place="${o.place}" data-result-lead="${lead}" data-result-task="${detail.rootId ?? detail.taskId}" data-result-user="${o.user}"${attributes(resultFactsAttributeMap(facts))}>`,
1611
1618
  o.back === null ? "" : html `<p class="result-back"><a href="${o.back.href}" data-result-back>← ${o.back.label}</a></p>`,
1612
1619
  (detail.history ?? ""),
1613
- taskStatus !== null && o.headStatus !== false
1614
- ? html `<header class="result-head"><div data-headline-tone="${taskStatus.tone}"><h2 class="status-headline" data-work-status="${status.token}"><i aria-hidden="true"></i>${taskStatus.headline}</h2><p class="status-sentence">${taskStatus.sentence}</p></div></header>`
1615
- : html `<header class="result-head"><div><h2>${heading}</h2></div>${o.headStatus === false ? "" : statusLineHtml(status)}</header>`,
1616
- html `<p class="result-summary">${outcome}</p>`,
1620
+ o.failed != null
1621
+ ? html `<header class="result-head" data-result-failed><div data-headline-tone="danger"><h2 class="status-headline" data-work-status="failed"><i aria-hidden="true"></i>Failed</h2><p class="status-sentence" data-failure-reason>${o.failed.line}</p>${o.failed.evidence === null && o.failed.link === null ? "" : html `<p class="meta" data-failure-evidence>${o.failed.evidence ?? ""}${o.failed.evidence !== null && o.failed.link !== null ? " " : ""}${o.failed.link === null ? "" : html `<a href="${o.failed.link.href}" data-failure-log>${o.failed.link.label}</a>`}</p>`}</div></header>`
1622
+ : taskStatus !== null && o.headStatus !== false
1623
+ ? html `<header class="result-head"><div data-headline-tone="${taskStatus.tone}"><h2 class="status-headline" data-work-status="${status.token}"><i aria-hidden="true"></i>${taskStatus.headline}</h2><p class="status-sentence">${taskStatus.sentence}</p></div></header>`
1624
+ : html `<header class="result-head"><div><h2>${heading}</h2></div>${o.headStatus === false ? "" : statusLineHtml(status)}</header>`,
1625
+ o.failed != null ? "" : html `<p class="result-summary">${outcome}</p>`,
1617
1626
  current == null || o.place === "review" && (current.state === "ready-to-check" || current.state === "complete") ? "" :
1618
1627
  html `<div class="verdict" data-current-outcome data-headline="${taskStatus.headline}">${statusDetailsHtml(taskStatus)}${statusWhyHtml(taskStatus)}</div>`,
1619
1628
  attentionHtml,
@@ -1643,6 +1652,8 @@ export function resultPanelParts(detail, o) {
1643
1652
  learning: detail.learning === undefined ? "" : htmlString(detail.learning),
1644
1653
  request: detail.skillTest ? null : htmlString(joinHtml(requestParts, "\n")),
1645
1654
  canRequest: detail.canAnnotate && o.csrf !== "",
1655
+ sendBack: detail.skillTest || !detail.canAnnotate || o.csrf === "" ? null
1656
+ : { action: `/r/${runId}/comment`, batch: revisionBatchOf(detail.comments), source: revisionSourceOf(detail.sourceDigest), request: o.requestToken },
1646
1657
  need,
1647
1658
  requestQuiet: detail.canAnnotate && o.csrf !== "" && detail.comments.length === 0 && (detail.pastComments?.length ?? 0) === 0 && detail.revisions.length === 0,
1648
1659
  };
@@ -1820,3 +1831,8 @@ export function runFactsFragment(run, taskId, live, route = null) {
1820
1831
  }
1821
1832
  return runFactsRows(run, taskId, live, route);
1822
1833
  }
1834
+ export const EMPTY_AGENT_REPORT = Object.freeze({ decisions: [], assumptions: [], notDone: [], risks: [] });
1835
+ export function quotedNoteOf(note) {
1836
+ const flat = note.replace(/\s+/g, " ").trim();
1837
+ return flat.length <= 280 ? flat : `${flat.slice(0, 279).trimEnd()}…`;
1838
+ }