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
@@ -19,7 +19,7 @@ import { liveAttemptOf, steerControlsFor } from "../steer-controls.js";
19
19
  import { originOf } from "../task-source.js";
20
20
  import { recentGitReads, taskBaseOf } from "../task-base.js";
21
21
  import { assignmentPresentationOf, historicalAssessmentReason } from '../assignment-presentation.js';
22
- import { html, joinHtml } from "../html.js";
22
+ import { html, htmlString, joinHtml } from "../html.js";
23
23
  import { assignmentStatusOf, assignmentWithEvidence } from '../assignment-ui.js';
24
24
  import { assignmentOf, personCompletionRefusal } from '../assignment.js';
25
25
  import { knowledgeContextHtml } from "../knowledge-ui.js";
@@ -58,10 +58,11 @@ import { buildReviewOf } from "../review-switch.js";
58
58
  import { isAlive as runnerAlive } from "../runner.js";
59
59
  import { approvalOf } from "../scope.js";
60
60
  import { oneLineOf, refuse, screen, withScript } from "./chrome.js";
61
- import { chatResultHref, reviewHref, taskChatHref, taskHref } from "./http.js";
61
+ import { chatResultHref, refusedInPlace, reviewHref, taskChatHref, taskHref } from "./http.js";
62
62
  import { decisionsFor } from "./render-chat.js";
63
63
  import {} from "./render-pages.js";
64
64
  import { completionReceiptView, diffFileAnchor, evidenceLinksFor, followUpsFor, orderChangedFiles, parseReviewDiff, proofBundleView, receiptStatusOf, withinSignedTouches } from "./render-results.js";
65
+ import { approvalSummaryOf, summaryContextOf } from "../approval-summary.js";
65
66
  import { approvalFormDigest, consentDoorOf, nonceHashOf, publicationFactsOf, resumeCeremonyPage, resumeDigestOf, taskBody, taskPage } from "./render-tasks.js";
66
67
  import {} from "./session.js";
67
68
  import { mergeReadyViewOf } from "./merge-ready-view.js";
@@ -71,6 +72,7 @@ import { reviewEvidenceScript } from "./render-results.js";
71
72
  import { budgetHoldWords, budgetLabel, monthOf } from "../spend.js";
72
73
  import {} from "../store.js";
73
74
  import { taskControlOf } from "../task-control.js";
75
+ import { taskLinkFromLegacy, taskLinkOf } from "../task-link.js";
74
76
  import { lastErrorLineOf, missedRequirementOf, workStatusOf } from "../workspace-ui.js";
75
77
  export function createTaskViews(runtime) {
76
78
  const baseGit = recentGitReads();
@@ -240,8 +242,9 @@ export function createTaskViews(runtime) {
240
242
  const revision = revisionViewOf(ref);
241
243
  const revisionBroken = revision !== null && "problem" in revision;
242
244
  const planView = ref === null ? null : planViewOf(ref.id);
243
- const approvalDigest = scope === null ? null : approvalFormDigest(scope.digest, planView?.sha256 ?? null);
244
245
  const routeView = routeViewOf(taskId, ref, scope, now, who);
246
+ const approvalSummary = scope === null ? null : approvalSummaryOf(scope, summaryContextOf(runtime.store, taskId, scope, now, routeView?.evidence ?? null));
247
+ const approvalDigest = scope === null ? null : approvalFormDigest(scope.digest, planView?.sha256 ?? null, approvalSummary?.key ?? null);
245
248
  const nonce = who.via === "cookie" && scope !== null && approvalDigest !== null && !approvalOf(scope).approved && !revisionBroken && ref?.plan !== "requested" && consentDoorOf(scope, routeView).open
246
249
  ? render.mintNonce === false ? "unminted" : runtime.mintApprovalNonce(who.name, taskId, approvalDigest)
247
250
  : "";
@@ -405,6 +408,7 @@ export function createTaskViews(runtime) {
405
408
  mirror: runtime.store.mirrorByTask(taskId),
406
409
  scope,
407
410
  approvalDigest,
411
+ approvalSummary,
408
412
  route: routeView,
409
413
  canEditRoute: who.role === "approver",
410
414
  resultRecord: resultRecordWordsOf(runtime.store, taskId, runtime.evidenceRoot, now),
@@ -546,6 +550,7 @@ export function createTaskViews(runtime) {
546
550
  scope,
547
551
  nonce: view.nonce,
548
552
  digest: view.approvalDigest ?? scope.digest,
553
+ summary: view.approvalSummary ?? null,
549
554
  planDocument: view.planDocument,
550
555
  planContract: view.planContract ?? null,
551
556
  deliverable: view.deliverable ?? "branch",
@@ -604,7 +609,7 @@ export function createTaskViews(runtime) {
604
609
  }
605
610
  function explainAttempt(run, receipt, readLog = true) {
606
611
  const taskId = runtime.store.externalIdFor(run.taskRef) ?? "";
607
- const page = `${reviewHref(taskId)}&run=${run.id}`;
612
+ const page = taskLinkOf({ task: taskId, run: run.id });
608
613
  const see = taskId === "" ? null : { label: `See build #${run.id}`, href: page };
609
614
  const artifacts = runtime.store.artifactsFor(run.id);
610
615
  const logArtifact = !readLog ? null : receipt?.checks.status === "failed" && receipt.checks.logArtifactId !== null
@@ -625,7 +630,7 @@ export function createTaskViews(runtime) {
625
630
  if (found !== null) {
626
631
  const line = oneLineOf(found.text, 140);
627
632
  return { kind: "check", line: `The check failed: ${line}`, evidence: null, suggestion: failingCheckSuggestion(line),
628
- link: taskId === "" ? null : { label: `Check output, line ${found.line}`, href: `${page}&tab=checks#check-log-L${found.line}` } };
633
+ link: taskId === "" ? null : { label: `Check output, line ${found.line}`, href: taskLinkOf({ task: taskId, run: run.id, section: "checks", anchor: `check-log-L${found.line}` }) } };
629
634
  }
630
635
  }
631
636
  const verdict = runtime.store.proofVerdictFor(run.id);
@@ -654,11 +659,14 @@ export function createTaskViews(runtime) {
654
659
  const results = new Map(runs.filter(run => runIsTaskResult(run) && (extras.admissible === undefined || extras.admissible.has(run.id))).map(run => [run.id, run.taskId]));
655
660
  const tabHref = (taskId, run, section, hash) => `${taskHref(root)}?${taskId !== current ? `version=${encodeURIComponent(taskId)}&` : ""}tab=result${run === null ? "" : `&run=${run}`}${section === null || section === "summary" ? "" : `&section=${section}`}${hash}`;
656
661
  const toTab = (href) => {
657
- const review = /^\/review\?result=([A-Za-z0-9._~%-]{1,200})(?:&run=([0-9]{1,15}))?(?:&tab=(summary|changes|checks))?(#[A-Za-z0-9_-]{1,120})?$/.exec(href);
658
- if (review !== null) {
659
- const taskId = decodeURIComponent(review[1]);
662
+ const canonical = taskLinkFromLegacy(href) ?? href;
663
+ const result = /^\/t\/([A-Za-z0-9._~%-]{1,200})\?tab=result(?:&run=([0-9]{1,15}))?(?:&section=(summary|changes|checks))?(#[A-Za-z0-9_.:-]{1,160})?$/.exec(canonical);
664
+ if (result !== null) {
665
+ const named = decodeURIComponent(result[1]);
666
+ const run = result[2] === undefined ? null : Number(result[2]);
667
+ const taskId = run !== null && named === root && results.has(run) ? results.get(run) : named;
660
668
  if (versions.has(taskId))
661
- return tabHref(taskId, review[2] === undefined ? null : Number(review[2]), review[3] ?? null, review[4] ?? "");
669
+ return tabHref(taskId, run, result[3] ?? null, result[4] ?? "");
662
670
  }
663
671
  const record = /^\/r\/([0-9]{1,15})$/.exec(href);
664
672
  if (record !== null && results.has(Number(record[1])))
@@ -687,12 +695,14 @@ export function createTaskViews(runtime) {
687
695
  };
688
696
  }
689
697
  function taskScreen(response, who, taskId, problem, status, scopeDraft, cancelDraft, editPlan = false, extras = {}) {
698
+ if (problem !== null && refusedInPlace(response, status, problem))
699
+ return;
690
700
  const admittedFamily = runtime.familyOf(taskId);
691
701
  if (admittedFamily?.problem != null)
692
- return runtime.sendScreen(response, status, screen(admittedFamily.root.title, html `<h1>${admittedFamily.root.title}</h1><p>${admittedFamily.current.state}</p><p class="problem" data-history-problem>${admittedFamily.problem}</p>`, { chrome: runtime.chromeFor(admittedFamily.root.repo, "tasks") }));
702
+ return runtime.sendScreen(response, status, screen(admittedFamily.root.title, html `<h1>${admittedFamily.root.title}</h1><p>${admittedFamily.current.state}</p><p class="problem" data-history-problem>${admittedFamily.problem}</p>${extras.result == null ? "" : html `<section class="task-result-tab" id="task-result" aria-label="Result" data-result-task="${extras.result.selected.taskId}">${extras.result.html}</section>`}`, { chrome: runtime.chromeFor(admittedFamily.root.repo, "tasks"), ...(extras.result == null ? {} : { functional: { script: `${reviewEvidenceScript()}${RESULT_REVIEW_SCRIPT}` } }) }));
693
703
  const data = taskViewData(taskId, who, problem, { mintNonce: requestContext.getStore()?.readPurpose !== "prefetch" });
694
704
  if (data === null)
695
- return refuse(response, who, 404, "no such task", "/tasks");
705
+ return refuse(response, who, 404, "no such task", "/");
696
706
  const family = runtime.familyOf(taskId);
697
707
  const presentedData = { ...data, rootId: family?.root.id ?? taskId, rootTitle: family?.root.title ?? data.task.title,
698
708
  ...(family === null || data.assignment != null ? {} : { history: familyHistory(family) }),
@@ -706,6 +716,10 @@ export function createTaskViews(runtime) {
706
716
  presentedData.cancelDraft = cancelDraft;
707
717
  if (editPlan)
708
718
  presentedData.editPlan = true;
719
+ const resultSection = extras.result == null ? null
720
+ : html `<section class="task-result-tab" id="task-result" aria-label="Result" data-result-task="${extras.result.selected.taskId}">${extras.result.html}</section>`;
721
+ if (resultSection !== null && extras.result.current)
722
+ presentedData.resultSection = resultSection;
709
723
  presentedData.pullRequest = taskPullRequestOf(taskId, who);
710
724
  if (family !== null && family.problem === null) {
711
725
  presentedData.family = { root: { id: family.root.id, title: family.root.title, createdAt: family.root.createdAt, goal: runtime.store.getScope(family.root.id)?.goal ?? null },
@@ -749,14 +763,40 @@ export function createTaskViews(runtime) {
749
763
  }
750
764
  if (oneTaskView?.kind === "task")
751
765
  oneTaskView.steps = stepRowsOf(oneTaskView);
752
- if (extras.result != null) {
753
- page.body = html `${page.body}<section class="task-result-tab" id="task-result" aria-label="Result">${extras.result.html}</section>`;
766
+ if (oneTaskView?.kind === "task" && extras.result != null && resultSection !== null && !extras.result.current) {
767
+ const rootId = family?.root.id ?? taskId;
768
+ const build = extras.result.selected.build;
769
+ const historical = { label: build === null ? "The task has moved on since." : `Build #${build}. The task has moved on since.`, href: taskHref(rootId) };
770
+ const view = { kind: "task", id: oneTaskView.id, title: oneTaskView.title, project: oneTaskView.project, scout: oneTaskView.scout, tabs: [],
771
+ version: oneTaskView.version, status: null, statusHtml: "", approval: "", lead: [], questions: "", facts: [], sections: [], manage: [], cancel: null, thread: [],
772
+ tab: "result", result: oneTaskView.result ?? null, historical, more: [{ group: "share", label: "Copy link", kind: "copy" }] };
773
+ const top = html `<h1 class="task-main-title">${view.title}</h1><div class="task-historical" data-task-historical><h2>Earlier result</h2><p>${historical.label}</p><p><a class="button-link" href="${historical.href}" data-open-current>Open current work</a></p></div>`;
774
+ page.body = html `${top}${resultSection}`;
775
+ page.functional = { script: `${reviewEvidenceScript()}${RESULT_REVIEW_SCRIPT}`, app: [{ kind: "result" }] };
776
+ page.workspace = { view, pageHtml: top };
777
+ page.refreshSeconds = runtime.liveRefreshSeconds();
778
+ return runtime.sendScreen(response, status, page);
779
+ }
780
+ if (extras.record != null) {
781
+ if (oneTaskView?.kind === "task")
782
+ oneTaskView.sections = [...oneTaskView.sections.filter(one => one.id !== "record"), { id: "record", title: "Record", html: htmlString(extras.record), open: true, count: null }];
783
+ const recordSection = html `<section class="task-record" id="record" aria-label="Record"><h2>Record</h2>${extras.record}</section>`;
784
+ page.body = html `${page.body}${recordSection}`;
785
+ if (page.workspace?.pageHtml != null)
786
+ page.workspace = { ...page.workspace, pageHtml: html `${page.workspace.pageHtml}${recordSection}` };
787
+ }
788
+ const composed = resultSection !== null && page.workspace?.pageHtml != null;
789
+ const taskBody = composed ? page.workspace.pageHtml : page.body;
790
+ if (extras.result != null && resultSection !== null) {
791
+ if (!composed)
792
+ page.body = html `${page.body}${resultSection}`;
754
793
  page.functional = withScript(page.functional, { script: `${reviewEvidenceScript()}${RESULT_REVIEW_SCRIPT}`, app: [{ kind: "result" }] });
755
794
  }
795
+ const pageHtml = oneTaskView?.kind === "task" && oneTaskView.result != null ? taskBody : page.body;
756
796
  if (docked !== null)
757
- page.workspace = { ...page.workspace, ...(oneTaskView === undefined ? {} : { view: oneTaskView }), conversation: docked, pageHtml: page.body };
797
+ page.workspace = { ...page.workspace, ...(oneTaskView === undefined ? {} : { view: oneTaskView }), conversation: docked, pageHtml };
758
798
  else if (oneTaskView !== undefined && page.workspace !== undefined)
759
- page.workspace = { ...page.workspace, view: oneTaskView };
799
+ page.workspace = { ...page.workspace, view: oneTaskView, ...(pageHtml === page.body ? {} : { pageHtml }) };
760
800
  page.refreshSeconds = runtime.liveRefreshSeconds();
761
801
  return runtime.sendScreen(response, status, page);
762
802
  }