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
@@ -7,7 +7,8 @@ import { acceptAndCompleteAsOperator, assignmentOf, owedAcceptance } from "./ass
7
7
  import { chatControlHref, chatResultHref } from "./chat-controls.js";
8
8
  import { applyChatTaskAction, chatTaskStamp } from "./chat-task-actions.js";
9
9
  import { chatTitle } from "./chat-voice.js";
10
- import { readVerifiedArtifact, scanForSecrets } from "./evidence.js";
10
+ import { readVerifiedArtifact } from "./evidence.js";
11
+ import { outboundPrivate, privateWords } from "./outbound-privacy.js";
11
12
  import { chatApproveMode } from "./chat-approval.js";
12
13
  import { parseExecutionPlanDocument } from "./plan.js";
13
14
  import { verifyApproverStanding } from "./principal.js";
@@ -20,11 +21,12 @@ import { releaseCardOf } from "./release-card.js";
20
21
  import { releaseCiHoldOf, releaseCiHoldWords } from "./release-ci-hold.js";
21
22
  import { phoneText, projectLabel } from "./telegram-status.js";
22
23
  import { cardTermsDigest, chatLimitProblem, permissionPlainWords, scopeTermsText, shownAsWritten, shownTermsDigest } from "./chat-terms.js";
23
- import { chainTermsLines } from "./scope.js";
24
+ import { approvalSummaryOf, EVIDENCE_WORDS, summaryContextOf, summaryText } from "./approval-summary.js";
24
25
  import { YOUIYOUX_CARD_KIND, YOUIYOUX_FILED_VIA, YOUIYOUX_HOME_PATH } from "./contracts/youiyoux-request.js";
25
26
  import { FILED_PER_PASS, requestKindWord, requestPassOf } from "./youiyoux-intake.js";
26
27
  import { discordPlain } from "./reply-shape.js";
27
28
  import { PLATFORM_LIMITS } from "./text-limits.js";
29
+ import { soloChatSeatRefusal } from "./install-mode.js";
28
30
  export { permissionPlainWords };
29
31
  export const DECIDE_LABELS = {
30
32
  accept: "Accept",
@@ -49,7 +51,6 @@ const sha = (text) => createHash("sha256").update(text).digest("hex");
49
51
  const isAct = (one) => "act" in one;
50
52
  const title = (store, taskId) => phoneText(chatTitle(store, taskId), 60);
51
53
  export { chatApproveMode };
52
- const money = (micro) => `$${(micro / 1_000_000).toFixed(2)}`;
53
54
  export function planInChat(store, taskId, approver, now, channel, root, from) {
54
55
  if (from !== "requests" && store.filedViaOf(taskId) === YOUIYOUX_FILED_VIA)
55
56
  return { ok: false, why: OUTSIDE_TERMS };
@@ -104,7 +105,8 @@ export function planInChat(store, taskId, approver, now, channel, root, from) {
104
105
  if (!verified)
105
106
  return { ok: false, why: "The saved plan can't be verified here, so you approve it in Toolroll." };
106
107
  }
107
- return { ok: true, modeDigest: mode.digest, source: mode.source, scope, whole, digest: sha(`${scope.digest}:${plan?.sha256 ?? ""}${whole ? `:${cardTermsDigest(scopeTermsText(scope))}` : ""}`) };
108
+ const summaryKey = approvalSummaryOf(scope, summaryContextOf(store, taskId, scope, now)).key;
109
+ return { ok: true, modeDigest: mode.digest, source: mode.source, scope, whole, digest: sha(`${scope.digest}:${plan?.sha256 ?? ""}:${summaryKey}${whole ? `:${cardTermsDigest(scopeTermsText(scope))}` : ""}`) };
108
110
  }
109
111
  export function mergeInChat(store, taskId, run, approver, now, channel) {
110
112
  const ref = store.lookupRef(taskId);
@@ -130,6 +132,11 @@ const OPEN_IN_TOOLROLL = "Open in Toolroll";
130
132
  const OUTSIDE_TERMS = "A youiyoux request is approved from its own youiyoux card, which shows every word, or in Toolroll.";
131
133
  const TOO_LONG = "its full terms don't fit in one chat message";
132
134
  const ROOM = 400;
135
+ export function wholeTermsText(store, taskId, scope, now) {
136
+ const summary = approvalSummaryOf(scope, summaryContextOf(store, taskId, scope, now));
137
+ return `${scopeTermsText(scope)}\n\n${summaryText(summary, one => one.fields.some(field => field === "goal" || field === "outOfScope" || field === "acceptance"))}`;
138
+ }
139
+ const wholeCardDigest = (store, taskId, scope, now) => sha(`${shownTermsDigest(scope)}:${approvalSummaryOf(scope, summaryContextOf(store, taskId, scope, now)).key}`);
133
140
  const listedDigest = (list) => `${REQUESTS_DIGEST}${list.map(one => `${one.taskId}=${one.digest}`).join(",")}`;
134
141
  const LISTABLE_ID = /^[A-Za-z0-9._-]{1,64}$/;
135
142
  function listedOf(digest) {
@@ -154,9 +161,6 @@ export function shownWhole(text, channel) {
154
161
  case "teams": return false;
155
162
  }
156
163
  }
157
- function privateWords(text) {
158
- return scanForSecrets(text).length > 0 || /\b\d{5,}:[A-Za-z0-9_-]{20,}\b/.test(text) || /(?:^|[\s"'`(<[=:,])(?:\/Users\/|\/home\/|\/root\/|~\/)|(?:[A-Za-z]:[\\/]|\\\\)/.test(text);
159
- }
160
164
  function waitsForApproval(store, taskId) {
161
165
  const state = store.getTask(taskId)?.state;
162
166
  const scope = store.getScope(taskId);
@@ -174,7 +178,7 @@ function requestsOffer(store, taskId, who, now, channel, root, said) {
174
178
  const head = `${waiting.length === 1 ? `A youiyoux ${what} waits` : `${waiting.length} youiyoux ${what}s wait`} for you · ${projectLabel(repo)}`;
175
179
  const mode = chatApproveMode(store, repo, who.name, now, channel);
176
180
  const items = waiting.map((id, index) => ({ n: index + 1, taskId: id, name: title(store, id), listed: null, why: null }));
177
- const block = (item) => `${item.n}. ${item.name}\n${scopeTermsText(store.getScope(item.taskId))}`;
181
+ const block = (item) => `${item.n}. ${item.name}\n${wholeTermsText(store, item.taskId, store.getScope(item.taskId), now)}`;
178
182
  const compose = () => {
179
183
  const shown = items.filter(one => one.listed !== null);
180
184
  const open = items.filter(one => one.listed === null);
@@ -201,11 +205,11 @@ function requestsOffer(store, taskId, who, now, channel, root, said) {
201
205
  item.why = "it needs your password in Toolroll";
202
206
  continue;
203
207
  }
204
- if (privateWords(scopeTermsText(plan.scope))) {
208
+ if (privateWords(block(item))) {
205
209
  item.why = "its terms name a key or a folder on this computer";
206
210
  continue;
207
211
  }
208
- item.listed = { taskId: item.taskId, digest: shownTermsDigest(plan.scope) };
212
+ item.listed = { taskId: item.taskId, digest: wholeCardDigest(store, item.taskId, plan.scope, now) };
209
213
  if (!shownWhole(compose(), channel)) {
210
214
  item.listed = null;
211
215
  item.why = TOO_LONG;
@@ -248,11 +252,11 @@ function requestsNow(store, tokenTask, digest, who, now, channel, root) {
248
252
  skipped.push({ name, why: "it needs your password in Toolroll" });
249
253
  continue;
250
254
  }
251
- if (shownTermsDigest(plan.scope) !== one.digest) {
255
+ if (wholeCardDigest(store, one.taskId, plan.scope, now) !== one.digest) {
252
256
  skipped.push({ name, why: "its terms changed since this card was sent" });
253
257
  continue;
254
258
  }
255
- ready.push({ taskId: one.taskId, name, digest: one.digest, plan });
259
+ ready.push({ taskId: one.taskId, name, digest: shownTermsDigest(plan.scope), plan });
256
260
  }
257
261
  return { ok: true, ready, skipped };
258
262
  }
@@ -286,7 +290,7 @@ function approveRequests(store, seat, who, tokenTask, digest, target, body, mess
286
290
  return { ack, edit: { text: `${body}\n\n${said}`, rows: skipped.length === 0 ? [] : linksFor(target), tokens: [] } };
287
291
  return { ack, edit: { text: again.text ?? said, ...mintDecideButtons(store, seat, target, again, now, message) } };
288
292
  }
289
- export function planCardText(store, taskId, scope, root, channel) {
293
+ export function planCardText(store, taskId, scope, root, _channel) {
290
294
  const ref = store.lookupRef(taskId);
291
295
  const artifact = ref === null ? null : store.latestPlanArtifact(ref.id);
292
296
  let milestones = [];
@@ -302,44 +306,34 @@ export function planCardText(store, taskId, scope, root, channel) {
302
306
  }
303
307
  }
304
308
  const bullets = (items, cap) => [...items.slice(0, cap).map(one => `• ${phoneText(one, 120)}`), ...(items.length > cap ? [`• and ${items.length - cap} more`] : [])];
305
- const goal = scope.goal.split("\n").filter(one => one.trim() !== "").slice(0, 2).map(one => phoneText(one, 160));
306
- const allowing = [permissionPlainWords(scope.profile), scope.budgetMicrousd === null ? "no attempt limit" : `up to ${money(scope.budgetMicrousd)} per attempt`]
307
- .filter((one) => one !== null);
309
+ const goal = scope.goal.split("\n").filter(one => one.trim() !== "");
308
310
  const changed = routeChangeOf(store, taskId);
309
- const chain = chainTermsLines(scope);
310
- if (channel === "telegram") {
311
- return [
312
- `Plan ready: ${title(store, taskId)}`,
313
- ...(changed === null ? [] : [changed]),
314
- ...chain,
315
- `Starting allows: ${allowing.join(" · ")}`,
316
- "",
317
- ...goal,
318
- ...(scope.touches.length > 0 ? [`Only in: ${scope.touches.slice(0, 6).map(one => phoneText(one, 80)).join(", ")}${scope.touches.length > 6 ? ", …" : ""}`] : ["Any file in the project."]),
319
- "",
320
- "Done when:",
321
- ...(scope.acceptance.length > 0 ? bullets(scope.acceptance.map(one => one.statement), 5) : ["You decide when you review the result."]),
322
- ...(milestones.length > 0 ? ["", "Steps:", ...bullets(milestones, 3)] : []),
323
- ].join("\n");
324
- }
311
+ const summary = approvalSummaryOf(scope, summaryContextOf(store, taskId, scope, new Date()));
312
+ const shown = (one) => !one.fields.some(field => field === "goal" || field === "acceptance");
325
313
  return [
326
314
  `Plan ready: ${title(store, taskId)}`,
327
315
  ...(changed === null ? [] : [changed]),
328
- ...chain,
316
+ ...(summary.revision === null ? [] : [summary.revision, ...summary.revisionChanges.map(one => `${one.label}: ${one.words}`)]),
317
+ ...summary.warnings.map(one => one.words),
329
318
  "",
330
319
  ...goal,
331
- "",
332
- "Changes:",
333
- ...(milestones.length > 0 ? bullets(milestones, 5) : []),
334
- ...(scope.touches.length > 0 ? [`Only in: ${scope.touches.slice(0, 6).map(one => phoneText(one, 80)).join(", ")}${scope.touches.length > 6 ? ", …" : ""}`] : milestones.length > 0 ? [] : ["Any file in the project."]),
320
+ ...(milestones.length > 0 ? ["", "Steps:", ...bullets(milestones, 3)] : []),
335
321
  "",
336
322
  "Done when:",
337
- ...(scope.acceptance.length > 0 ? bullets(scope.acceptance.map(one => one.statement), 5) : ["You decide when you review the result."]),
323
+ ...(scope.acceptance.length > 0 ? scope.acceptance.map(one => `• ${one.statement} (${one.evidence.map(kind => EVIDENCE_WORDS[kind] ?? kind).join(", ")})`) : ["You decide when you review the result."]),
338
324
  "",
339
- `You're allowing: ${allowing.join(" · ")}`,
325
+ ...[...summary.decisions.filter(shown), ...summary.differs].flatMap(one => [`${one.label}: ${one.words}`, ...(one.lines ?? [])]),
326
+ ...(summary.usual.length === 0 ? [] : [`${summary.usualLabel}: ${summary.usual.map(one => `${one.label.toLowerCase()} ${one.words}`).join(" · ")}`]),
340
327
  ].join("\n");
341
328
  }
342
329
  export function decideOffer(store, target, who, now, channel, root) {
330
+ const offer = decideOfferUnchecked(store, target, who, now, channel, root);
331
+ if (offer === null || !outboundPrivate(offerFields(offer)))
332
+ return offer;
333
+ const link = decideFallbackLink(target);
334
+ return { text: `${title(store, target.taskId)}\n\n${PRIVATE_CARD}`, rows: link === null ? [] : [[link]] };
335
+ }
336
+ function decideOfferUnchecked(store, target, who, now, channel, root) {
343
337
  const ref = store.lookupRef(target.taskId);
344
338
  if (ref === null || ref.repo === null || !who.repos.includes(ref.repo))
345
339
  return null;
@@ -369,7 +363,7 @@ export function decideOffer(store, target, who, now, channel, root) {
369
363
  if (passwordOnlySeal(plan.scope)) {
370
364
  let head;
371
365
  try {
372
- head = release ? releaseCardOf(store, plan.scope, plan.digest, { profile: permissionPlainWords }).short.split("\n").slice(0, 3)
366
+ head = release ? releaseCardOf(store, plan.scope, plan.digest, { profile: permissionPlainWords, chat: true }).short.split("\n").slice(0, 3)
373
367
  : planCardText(store, target.taskId, plan.scope, root, channel).split("\n").slice(0, 1);
374
368
  }
375
369
  catch {
@@ -499,7 +493,7 @@ export function releaseInChat(store, taskId, approver, now, channel, seat, root)
499
493
  return { ok: false, why: "A release is approved only in your private chat with Toolroll." };
500
494
  let card;
501
495
  try {
502
- card = releaseCardOf(store, plan.scope, plan.digest, { profile: permissionPlainWords });
496
+ card = releaseCardOf(store, plan.scope, plan.digest, { profile: permissionPlainWords, chat: true });
503
497
  }
504
498
  catch {
505
499
  return { ok: false, why: "This release's terms can't be shown here, so you approve it in Toolroll." };
@@ -620,6 +614,61 @@ function cardBody(shown) {
620
614
  return at >= 0 && (QUESTION_STARTS.some(start => shown.startsWith(start, at + 2)) || /^Approve \d+ tasks\?/.test(shown.slice(at + 2))) ? shown.slice(0, at) : shown;
621
615
  }
622
616
  export function applyDecideTap(store, seat, input) {
617
+ if (input.token.startsWith("d:")) {
618
+ const solo = soloChatSeatRefusal(store, { provider: seat.channel, binding: seat.binding, approver: seat.approver });
619
+ if (solo !== null)
620
+ return { ack: solo, ignored: true };
621
+ }
622
+ const outcome = decideTapUnchecked(store, seat, input);
623
+ if (outcome === null)
624
+ return null;
625
+ const fitted = (card) => {
626
+ if (card.tokens.length === 0 || fitsOneMessage(card.text, seat.channel))
627
+ return card;
628
+ dropDecideTokens(store, card.tokens, input.now);
629
+ const target = decideTargetOfToken(store, input.token);
630
+ const why = `This doesn't fit in one ${CHANNEL_NAMES[seat.channel]} message, so you approve it in Toolroll. Nothing was done.`;
631
+ return { text: `${cardBody(input.shown).slice(0, 1_000)}\n\n${why}`, rows: target === null ? [] : linksFor(target), tokens: [] };
632
+ };
633
+ if (outboundPrivate(tapFields(outcome))) {
634
+ for (const card of [outcome.edit, outcome.unsent])
635
+ if (card !== undefined)
636
+ dropDecideTokens(store, card.tokens, input.now);
637
+ if (outcome.prompt !== undefined && outcome.prompt.id > 0)
638
+ store.handle.prepare("UPDATE chat_decide_prompt SET consumed_at = ? WHERE id = ? AND consumed_at IS NULL").run(input.now.toISOString(), outcome.prompt.id);
639
+ const target = decideTargetOfToken(store, input.token);
640
+ return { ack: "Review it in Toolroll.", ...(outcome.merge === undefined ? {} : { merge: outcome.merge }),
641
+ edit: { text: `${target === null ? "" : `${title(store, target.taskId)}\n\n`}${PRIVATE_CARD} Open it there to see where it stands.`,
642
+ rows: target === null ? [] : linksFor(target), tokens: [] } };
643
+ }
644
+ return { ...outcome, ...(outcome.edit === undefined ? {} : { edit: fitted(outcome.edit) }), ...(outcome.unsent === undefined ? {} : { unsent: fitted(outcome.unsent) }) };
645
+ }
646
+ function tapFields(outcome) {
647
+ const cards = [outcome.edit, outcome.unsent].filter((one) => one !== undefined);
648
+ return [outcome.ack, ...cards.flatMap(card => [card.text, ...card.rows.flat().map(button => "link" in button ? `${button.label} ${button.link.label}` : button.label)]),
649
+ ...(outcome.file === undefined ? [] : [outcome.file.name, outcome.file.text]), ...(outcome.prompt === undefined ? [] : [outcome.prompt.text])];
650
+ }
651
+ function offerFields(offer) {
652
+ return [...(offer.text === null ? [] : [offer.text]), ...(offer.file === undefined ? [] : [offer.file.name, offer.file.text]),
653
+ ...offer.rows.flat().map(one => one.label ?? "")];
654
+ }
655
+ const PRIVATE_CARD = "Its words name a key or a folder on this computer, so you review it in Toolroll.";
656
+ export function fitsOneMessage(text, channel) {
657
+ switch (channel) {
658
+ case "telegram": return text.length <= 4_000;
659
+ case "slack": return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").length <= PLATFORM_LIMITS.slack;
660
+ case "discord": return discordPlain(text).length <= PLATFORM_LIMITS.discord;
661
+ case "teams": return text.length <= PLATFORM_LIMITS.teams;
662
+ }
663
+ }
664
+ function decideTargetOfToken(store, token) {
665
+ const raw = store.handle.prepare("SELECT * FROM chat_decide_action WHERE token = ?").get(token);
666
+ if (raw === undefined)
667
+ return null;
668
+ const read = readAction(raw);
669
+ return read.ok ? targetOf(read.value) : null;
670
+ }
671
+ function decideTapUnchecked(store, seat, input) {
623
672
  const raw = input.token.startsWith("d:") ? store.handle.prepare("SELECT * FROM chat_decide_action WHERE token = ?").get(input.token) : undefined;
624
673
  if (raw === undefined)
625
674
  return null;
@@ -678,12 +727,15 @@ export function applyDecideTap(store, seat, input) {
678
727
  }
679
728
  if (row.phase === "offer") {
680
729
  if (row.act === "changes") {
730
+ const asked = `${WHAT_SHOULD_CHANGE} Your next message is the feedback for "${name}".`;
731
+ if (privateWords(asked))
732
+ return { ack: WHAT_SHOULD_CHANGE, prompt: { id: 0, text: asked } };
681
733
  const id = openDecidePrompt(store, seat, row.taskId, row.run ?? 0, row.digest, now);
682
- return { ack: WHAT_SHOULD_CHANGE, prompt: { id, text: `${WHAT_SHOULD_CHANGE} Your next message is the feedback for "${name}".` } };
734
+ return { ack: WHAT_SHOULD_CHANGE, prompt: { id, text: asked } };
683
735
  }
684
736
  if (row.act === "not-now") {
685
737
  spend();
686
- return { ack: "Okay, it waits.", edit: { text: `${body}\n\nNot now. It waits for you in Tasks.`,
738
+ return { ack: "Okay, it waits.", edit: { text: `${body}\n\nNot now. It waits for you in Work.`,
687
739
  rows: [[{ label: DECIDE_LABELS.edit, link: { label: DECIDE_LABELS.edit, path: chatControlHref("approval", row.taskId) } }]], tokens: [] } };
688
740
  }
689
741
  if (row.act === "approve" && row.digest.startsWith(RELEASE_DIGEST)) {
@@ -714,9 +766,12 @@ export function applyDecideTap(store, seat, input) {
714
766
  const spec = { act: "approve", run: null, digest: row.digest };
715
767
  const yes = mint(store, seat, input.message, spec, row.taskId, "yes", now);
716
768
  const later = mint(store, seat, input.message, { act: "not-now", run: null, digest: row.digest }, row.taskId, "offer", now);
717
- if (plan.whole && scopeTermsText(plan.scope).length > PLATFORM_LIMITS[seat.channel] - ROOM)
769
+ const text = `${plan.whole ? `${name}\n\n${wholeTermsText(store, row.taskId, plan.scope, now)}` : planCardText(store, row.taskId, plan.scope, input.root, seat.channel)}\n\n${QUESTIONS.approve(name)} This approves exactly this plan.`;
770
+ if (!fitsOneMessage(text, seat.channel) || (plan.whole && !shownAsWritten(text, seat.channel)))
718
771
  return stale(`This plan's ${TOO_LONG}, so you approve it in Toolroll.`);
719
- return { ack: "Read the plan, then approve.", edit: { text: `${plan.whole ? `${name}\n\n${scopeTermsText(plan.scope)}` : planCardText(store, row.taskId, plan.scope, input.root, seat.channel)}\n\n${QUESTIONS.approve(name)} This approves exactly this plan.`,
772
+ if (privateWords(text))
773
+ return stale("Its terms name a key or a folder on this computer, so you review it in Toolroll.");
774
+ return { ack: "Read the plan, then approve.", edit: { text,
720
775
  rows: [[{ label: DECIDE_LABELS.approve, token: yes }], [{ label: DECIDE_LABELS.edit, link: { label: DECIDE_LABELS.edit, path: chatControlHref("approval", row.taskId) } }, { label: DECIDE_LABELS["not-now"], token: later }]], tokens: [yes, later] } };
721
776
  }
722
777
  spend();
@@ -774,8 +829,8 @@ export function applyDecideTap(store, seat, input) {
774
829
  return notDone("This is a release: approve it from its release card.");
775
830
  if (passwordOnlySeal(plan.scope))
776
831
  return notDone(needsFullCard(plan.scope));
777
- const words = scopeTermsText(plan.scope);
778
- if (plan.whole && (plan.digest !== row.digest || words.length > PLATFORM_LIMITS[seat.channel] - ROOM))
832
+ const words = wholeTermsText(store, row.taskId, plan.scope, now);
833
+ if (plan.whole && (plan.digest !== row.digest || !fitsOneMessage(words, seat.channel) || privateWords(words)))
779
834
  return notDone("this plan changed. Open it in Toolroll.");
780
835
  const approved = approve(store, row.taskId, who.name, now, plan.scope.digest, "", {}, undefined, { modeDigest: plan.modeDigest, shown: plan.whole ? { expect: cardTermsDigest(words), terms: words } : null });
781
836
  if (!approved.ok && approved.reason === "second-approver")
@@ -4,6 +4,7 @@ import { ChatCore, chatHash } from "./chat-core.js";
4
4
  import { ChatMessages } from "./chat-messages.js";
5
5
  import { unsentPart } from "./chat-message-states.js";
6
6
  import { readChatPart, savedChatEventBody, savedChatPart } from "./contracts/chat-content.js";
7
+ import { WITHHELD } from "./outbound-privacy.js";
7
8
  export { savedChatPart, chatHash };
8
9
  const DAY_MS = 86_400_000;
9
10
  export class ChatState extends ChatMessages {
@@ -178,3 +179,4 @@ export class ChatDeliveryError extends Error {
178
179
  this.permanent = permanent;
179
180
  }
180
181
  }
182
+ export const withheldPart = () => new ChatDeliveryError(WITHHELD, 0, false, true);
@@ -3,6 +3,7 @@ import { applyChatAskTap, chatAskText } from "./chat-ask.js";
3
3
  import { channelRepos, resolveChannelLead, proposalPreview, proposalOutcomeText, confirmedLink, confirmedCardText, replyContextFor, mirrorToTaskChat, focusContextFor, taskInCeiling, tooLongText, } from "./chat-channel.js";
4
4
  import { LEAD_MESSAGE_MAX_CHARS, leadFailureText, runLeadTurn } from "./lead.js";
5
5
  import { shapeReplyParts } from "./reply-shape.js";
6
+ import { checkedChunks, taskSubject } from "./outbound-privacy.js";
6
7
  import { warmTurn } from "./chat-warmth.js";
7
8
  import { openChatLive, planWithLive, settleLive } from "./chat-live.js";
8
9
  import { confirmLeadProposal, dismissLeadProposal, } from "./lead-doors.js";
@@ -459,7 +460,7 @@ export async function processChatEvent(options) {
459
460
  const reply = store
460
461
  .listLeadMessages(turn.thread, 200)
461
462
  .find((message) => message.turn === turn.id && message.role === "assistant")?.text ?? "The reply is no longer in the saved thread.";
462
- const shapedParts = shapeReplyParts(reply, options.partSize ?? CHAT_PART_SIZE, { asked: text, appOrigin: options.origin() });
463
+ const shapedParts = checkedChunks(reply, shapeReplyParts(reply, options.partSize ?? CHAT_PART_SIZE, { asked: text, appOrigin: options.origin() }), taskSubject(store, about?.task));
463
464
  const parts = (shapedParts.length > 0 ? shapedParts : splitChatText("")).map((text) => (about === null ? { text, voice: true } : { text, voice: true, task: about.task, ...(about.run === null ? {} : { run: about.run }) }));
464
465
  const ask = store.leadAsk(turn.id);
465
466
  if (ask !== null)
@@ -704,7 +705,7 @@ export async function planRoomMessages(options) {
704
705
  const parts = [];
705
706
  if (text !== null) {
706
707
  if (message.role === "assistant")
707
- for (const part of shapeReplyParts(text, options.partSize ?? CHAT_PART_SIZE, { appOrigin: options.origin() }))
708
+ for (const part of checkedChunks(text, shapeReplyParts(text, options.partSize ?? CHAT_PART_SIZE, { appOrigin: options.origin() })))
708
709
  parts.push({ text: part, voice: true, channel: room.chat });
709
710
  else
710
711
  parts.push({ text, channel: room.chat });
package/dist/chat-live.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { createLiveReply, createLiveSender, LIVE_STATUS } from "./live-reply.js";
2
2
  import { renderReply, shapeReplyParts } from "./reply-shape.js";
3
+ import { checkedChunks } from "./outbound-privacy.js";
3
4
  import { unsent } from "./chat-message-states.js";
4
5
  export const LIVE_WORDS = {
5
6
  working: "Working on it…",
@@ -42,7 +43,7 @@ export function liveText(view, platform, limit, shape = {}) {
42
43
  case "writing": {
43
44
  const marker = italic(platform, view.status === LIVE_STATUS.writing ? LIVE_WORDS.notFinal : `${view.status} ${LIVE_WORDS.notFinal}`);
44
45
  const room = Math.max(200, limit - marker.length - LIVE_WORDS.continues.length - 8);
45
- const windows = shapeReplyParts(view.text, room, shape, shaped => renderReply(shaped, platform).length);
46
+ const windows = checkedChunks(view.text, shapeReplyParts(view.text, room, shape, shaped => renderReply(shaped, platform).length));
46
47
  const first = renderReply(windows[0] ?? "", platform).slice(0, room);
47
48
  const more = windows.length > 1 ? `\n\n${italic(platform, LIVE_WORDS.continues)}` : "";
48
49
  return `${first}${more}\n\n${marker}`;
@@ -84,7 +84,7 @@ export function quietCardView(store, taskRefs, now, root, viewer) {
84
84
  const heading = `${lines.length} tasks`;
85
85
  const projects = [...new Set(lines.map(one => projectLabel(one.project)))];
86
86
  const text = [heading, ...lines.map(one => `${one.icon} ${phoneText(one.title, 60)} · ${one.status}`), "", projects.join(", ")].join("\n");
87
- return { text, entities: [{ type: "bold", offset: 0, length: heading.length }], link: { label: "Open tasks", path: "/tasks" } };
87
+ return { text, entities: [{ type: "bold", offset: 0, length: heading.length }], link: { label: "Open Work", path: "/" } };
88
88
  }
89
89
  const OWN_MESSAGE_KINDS = new Set(["security-release", "secret-detected", "flow-decision", "flow-card", "acceptance-ready", "acceptance-evidence", YOUIYOUX_CARD_KIND]);
90
90
  export function joinsBatch(row) {
@@ -147,7 +147,7 @@ export function finishedView(store, batch, now, root, viewer) {
147
147
  return null;
148
148
  const text = batchLine(lines.map(one => one.fact));
149
149
  if (lines.length > 1)
150
- return { text, entities: [], link: { label: "Open", path: "/tasks" } };
150
+ return { text, entities: [], link: { label: "Open", path: "/" } };
151
151
  const target = lines[0].target ?? null;
152
152
  return { text, entities: [], link: lines[0].link, ...(lines[0].also.length === 0 ? {} : { also: lines[0].also }), ...(target === null ? {} : { target }) };
153
153
  }
@@ -207,7 +207,7 @@ export function enqueueEveningDigests(store, now, root) {
207
207
  if (body === null)
208
208
  return;
209
209
  if (store.enqueueNotification({ dedupeKey: `digest:evening:${person.account}:${day}`, kind: "evening-digest", subject: "Evening digest", body,
210
- link: "/tasks", source: { installation: true }, recipient: person.account }, now))
210
+ link: "/", source: { installation: true }, recipient: person.account }, now))
211
211
  queued++;
212
212
  });
213
213
  }
@@ -3,6 +3,7 @@ import { chatApproveMode, effectiveChatApproval } from "./chat-approval.js";
3
3
  import { requestTaskStop, resumeTaskStop, taskControlOf } from "./task-control.js";
4
4
  import { authorizePlanUnderMode } from "./plan-auto.js";
5
5
  import { fileAddTestsTask, requestFollowUpChecks } from "./result-follow-ups.js";
6
+ import { soloChatSeatRefusal } from "./install-mode.js";
6
7
  export const CHAT_TASK_ACTIONS = {
7
8
  stop: { label: "Stop task", detail: "Pauses this task once the run acknowledges the stop. Saved work remains; other tasks continue." },
8
9
  resume: { label: "Resume task", detail: "Lifts this stop’s hold and continues from saved work. Other holds and approval requirements still apply." },
@@ -35,6 +36,11 @@ export function chatTaskRun(store, task, operation, now) {
35
36
  return (operation === "stop" && control.kind === "stop") || (operation === "resume" && control.kind === "paused") ? control.run : null;
36
37
  }
37
38
  export function applyChatTaskAction(store, who, payload, now, web, controls = {}) {
39
+ if (controls.via !== undefined && controls.via !== "web" && controls.via !== "cli") {
40
+ const solo = soloChatSeatRefusal(store, { provider: controls.via, binding: controls.binding, approver: who.name });
41
+ if (solo !== null)
42
+ return { ok: false, message: solo };
43
+ }
38
44
  const task = payload["task"], operation = payload["operation"];
39
45
  if (typeof task !== "string" || !isChatTaskAction(operation))
40
46
  return { ok: false, message: "This task action is incomplete." };
@@ -136,11 +136,11 @@ export function chatText(text, tasks = []) {
136
136
  return out;
137
137
  }
138
138
  export function factLinkLabel(path) {
139
- if (/^\/review\?result=[^&]+&run=\d+&tab=checks$/.test(path))
139
+ if (/^\/review\?result=[^&]+&run=\d+&tab=checks$/.test(path) || /^\/t\/[^?#]+\?tab=result&run=\d+&section=checks#result-decision$/.test(path))
140
140
  return "Inspect result";
141
141
  if (/^\/t\/[^?#]+#merge$/.test(path))
142
142
  return "Merge";
143
- if (/^\/chat\?task=[^&]+&result=/.test(path))
143
+ if (/^\/chat\?task=[^&]+&result=/.test(path) || /^\/t\/[^?#]+\?tab=result\b/.test(path))
144
144
  return "Open result";
145
145
  if (/^\/(?:chat\?task=|t\/)/.test(path))
146
146
  return "Open task";
@@ -14,7 +14,7 @@ export const CHECK_CONTEXT_CAPTURE = "release check context v1";
14
14
  export const CHECK_ARTIFACT_CAP = CHECK_REPORT_MAX_BYTES;
15
15
  export const HARNESS_FILES = Object.freeze([
16
16
  "scripts/release-check.mjs", "scripts/release-check-ci.mjs", "scripts/upgrade-rule.mjs", "scripts/suite-lifecycle.mjs", "scripts/provider-gate.mjs",
17
- "scripts/e2e-parallel.mjs", "scripts/e2e-kit.mjs", "scripts/upgrade-path.mjs", "scripts/check-results.mjs",
17
+ "scripts/e2e-parallel.mjs", "scripts/e2e-kit.mjs", "scripts/isolated-env.mjs", "scripts/upgrade-path.mjs", "scripts/check-results.mjs",
18
18
  "vitest.config.ts", "test/attacks/vitest.config.ts",
19
19
  "test/setup-state.ts", "test/fresh-store.ts", "test/temp-root.ts", "test/ensure-build.ts", "test/release-reporter.ts",
20
20
  ]);
package/dist/cli-help.js CHANGED
@@ -1,17 +1,16 @@
1
1
  import { DEFAULT_MAX_DEPTH } from "./scan.js";
2
- export const HELP = `toolroll — hand coding work to agents, approve each plan, accept what comes back Ready
3
-
4
- toolroll start Toolroll here and open it in this terminal (--web: in the browser)
5
- In it: n new task · a approve its plan · c accept a Ready result
6
- b send it back · Enter open a task · ? every key
7
- toolroll repos add <folder> add a project (in a repository, \`toolroll\` adds that one)
8
- toolroll demo try it first: sample tasks, no model calls, no cost
9
- toolroll update update to the latest release (shows what changes first)
10
-
11
- toolroll task add "<what should change>" add a task from a shell; approve its plan in Toolroll
12
- toolroll task show <id> where a task is, and its result once it's Ready
13
-
14
- More: toolroll task --help (every task command) · toolroll internals (everything else)`;
2
+ export const HELP = `Toolroll — your agents build. You decide.
3
+
4
+ toolroll start here, in this terminal (--web: in the browser)
5
+ keys: n new task · a approve · c accept · b send back · ? all
6
+ toolroll demo try it first: sample tasks, no model calls, no cost
7
+ toolroll repos add <folder> add another project
8
+ toolroll task add "<change>" --repo .
9
+ add a task to this project from a shell
10
+ toolroll task show <id> where a task is, and its result once it's Ready
11
+ toolroll update update to the latest release
12
+
13
+ More: toolroll task --help · toolroll internals (everything else)`;
15
14
  export const SCAN_HELP = `toolroll scan [path...] — report what is in flight below a folder
16
15
 
17
16
  toolroll scan [path...] report what is in flight (also bare \`toolroll\` outside a repository)
package/dist/cli.js CHANGED
@@ -346,6 +346,8 @@ async function dispatch(argv, write, mainOptions) {
346
346
  databaseFile, write, build: (await import("./monitoring.js")).packageVersion(),
347
347
  ...(mainOptions.operate === undefined ? {} : { operate: mainOptions.operate }),
348
348
  admit: repo => runReposCommand(["add", repo], write, mainOptions.onboard),
349
+ ...(easyStartArgs(argv).screenReader === true ? { screenReader: true } : {}),
350
+ ...(easyStartArgs(argv).tuiBinary === undefined ? {} : { tuiBinary: easyStartArgs(argv).tuiBinary }),
349
351
  });
350
352
  return easy.runEasyStart("start", easyStartArgs(argv), { ...seams, ...mainOptions.easyStart?.seams });
351
353
  }
@@ -612,7 +614,8 @@ async function addToRepos(admission, targets, write, said, remoteUrl) {
612
614
  }
613
615
  projects.push({ repo: admitted.repo, name: admitted.name, added: admitted.added, remoteUrl: admitted.remote.url });
614
616
  write(addedWords(admitted.name, admitted.added, running));
615
- write(`Recorded remote: ${admitted.remote.url ?? "None. Use repos add <project> --remote <url> to record one."}`);
617
+ if (admitted.remote.url !== null)
618
+ write(`Remote: ${admitted.remote.url}`);
616
619
  }
617
620
  said.projects = projects;
618
621
  return 0;
@@ -1189,7 +1192,7 @@ async function runDemoCommand(argv, write, seams = {}) {
1189
1192
  write(envelopeJson({ ok: true, command: "demo", url, sandbox, login: { name: seed.login.name, passwordFile }, keep }));
1190
1193
  }
1191
1194
  else {
1192
- write("Demo sandbox is up. A scripted lead answers Chat: no model, no key, no spend, nothing leaves this machine.");
1195
+ write("Demo sandbox is up. Chat answers from a script: no model, no key, no cost, nothing leaves this machine.");
1193
1196
  write("");
1194
1197
  write(` open ${url}`);
1195
1198
  write(` login ${seed.login.name} / ${seed.login.password}`);
@@ -1232,7 +1235,7 @@ async function runDemoCommand(argv, write, seams = {}) {
1232
1235
  }
1233
1236
  else if (!json) {
1234
1237
  write(`Sandbox kept at ${sandbox} — reopen it any time: toolroll serve --db ${join(sandbox, "orders.db")}`);
1235
- write("Ready for your own repository? `toolroll up --repo <path>` starts the real thing.");
1238
+ write("For your own project, run `toolroll` in its folder.");
1236
1239
  }
1237
1240
  return 0;
1238
1241
  }
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
2
2
  import { NO_COUNTS, projectStates, STATE_WORDS } from "./agent-state.js";
3
3
  import { boundProjectSummary } from "./browser-workspace.js";
4
4
  import { WORK_INDEX_MAX_LIMIT, workIndexPage } from "./work-index.js";
5
+ import { workReadsOf } from "./work-reads.js";
5
6
  const RAIL_TASKS = 6;
6
7
  const ASKS_PER_PROJECT = 100;
7
8
  export function projectSummaryOf(store, now, access, actor, projects, evidenceRoot) {
@@ -21,10 +22,16 @@ export function projectSummaryOf(store, now, access, actor, projects, evidenceRo
21
22
  ...(state?.families ?? []).flatMap(one => one.ask === undefined ? [] : [{ at: one.ask.at, ask: { key: keyOf("task", one.rootId, one.ask.version), task: one.rootId, run: one.ask.run, at: one.ask.at } }]),
22
23
  ...(state?.flowAsks ?? []).map(one => ({ at: one.at, ask: { key: keyOf("flow", one.card, one.stage, one.entry), task: null, run: null, at: one.at } })),
23
24
  ].sort((a, b) => b.at.localeCompare(a.at)).slice(0, ASKS_PER_PROJECT).map(one => one.ask);
25
+ const reads = workReadsOf(store), reader = reads?.store ?? store;
26
+ if (reads !== null) {
27
+ const ids = [...new Set([...states.values()].flatMap(one => one.families.slice(0, RAIL_TASKS).map(family => family.rootId)))];
28
+ const found = new Map(store.handle.prepare("SELECT * FROM task WHERE id IN (SELECT value FROM json_each(?))").all(JSON.stringify(ids)).map(row => [String(row["id"]), row]));
29
+ reads.seed("SELECT * FROM task WHERE id = ?", "get", ids.map(id => [[id], found.get(id)]));
30
+ }
24
31
  const railOf = (state) => {
25
32
  const families = state?.families ?? [];
26
33
  const tasks = families.slice(0, RAIL_TASKS).flatMap((one) => {
27
- const task = store.getTask(one.rootId);
34
+ const task = reader.getTask(one.rootId);
28
35
  const line = one.state === "needs-you" || one.state === "failed" ? needWords.get(one.rootId) ?? null : one.line;
29
36
  return task === null ? [] : [{ id: one.rootId, title: task.title, href: `/t/${encodeURIComponent(one.rootId)}`, state: one.state, line: line ?? STATE_WORDS[one.state] }];
30
37
  });
@@ -32,11 +39,11 @@ export function projectSummaryOf(store, now, access, actor, projects, evidenceRo
32
39
  };
33
40
  const rows = projects.map(one => {
34
41
  const state = states.get(one.path);
35
- return { path: one.path, name: one.name, href: `/tasks?project=${encodeURIComponent(one.path)}`, state: state?.state ?? "idle", counts: state?.counts ?? { ...NO_COUNTS }, ...railOf(state) };
42
+ return { path: one.path, name: one.name, href: `/?project=${encodeURIComponent(one.path)}`, state: state?.state ?? "idle", counts: state?.counts ?? { ...NO_COUNTS }, ...railOf(state) };
36
43
  });
37
44
  const unplaced = states.get(null);
38
45
  if (unplaced !== undefined && unplaced.state !== "idle")
39
- rows.push({ path: null, name: "No project", href: "/tasks", state: unplaced.state, counts: unplaced.counts, ...railOf(unplaced) });
46
+ rows.push({ path: null, name: "No project", href: "/", state: unplaced.state, counts: unplaced.counts, ...railOf(unplaced) });
40
47
  return boundProjectSummary(rows);
41
48
  }
42
49
  export function accessKey(access) {
@@ -102,6 +102,12 @@ export function runDirProblem(dir, uid = process.getuid?.() ?? -1, mustExist = t
102
102
  return `${dir} is open to other users — Toolroll uses it only when it is yours alone (chmod 700)`;
103
103
  return null;
104
104
  }
105
+ export function instanceSocketTooLong(databaseFile) {
106
+ const needs = Buffer.byteLength(join(instanceRunDir(databaseFile), "0123456789abcdef.sock"));
107
+ if (needs <= SOCKET_PATH_MAX)
108
+ return null;
109
+ return `the database's folder is too deep for Toolroll's socket (${needs} of at most ${SOCKET_PATH_MAX} bytes), so nothing can find a console started on it — move it to a shorter folder (for example ~/.toolroll) or start with --db at a shorter path`;
110
+ }
105
111
  export function socketPathProblem(path) {
106
112
  if (!SOCKET_NAME.test(basename(path)))
107
113
  return `${path} isn't a console socket`;
@@ -151,6 +157,9 @@ export function askSocket(socketPath, request, timeoutMs = 2_000, connect = path
151
157
  });
152
158
  }
153
159
  export async function openInstanceSocket(databaseFile, facts, secret, link) {
160
+ const tooLong = instanceSocketTooLong(databaseFile);
161
+ if (tooLong !== null)
162
+ return { ok: false, problem: tooLong };
154
163
  const dir = instanceRunDir(databaseFile);
155
164
  const problem = prepareRunDir(dir);
156
165
  if (problem !== null)
@@ -306,7 +315,7 @@ export async function proveLiveConsole(databaseFile, store, build, seams = {}) {
306
315
  const restart = "stop it and run `toolroll up` again";
307
316
  const read = readInstanceState(store);
308
317
  if (read.state === "none")
309
- return { ok: false, state: "none", message: "no console is running" };
318
+ return { ok: false, state: "none", message: instanceSocketTooLong(databaseFile) ?? "no console is running" };
310
319
  if (read.state === "invalid")
311
320
  return { ok: false, state: "refused", message: `the console's record can't be read — ${restart}` };
312
321
  const record = read.record;