toolroll 0.9.63 → 0.9.65

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 (292) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +15 -5
  3. package/dist/acp-agents.d.ts +43 -0
  4. package/dist/acp-agents.js +62 -0
  5. package/dist/acp-attest.d.ts +44 -0
  6. package/dist/acp-attest.js +269 -0
  7. package/dist/acp-check.d.ts +28 -0
  8. package/dist/acp-check.js +410 -0
  9. package/dist/acp-client.d.ts +163 -0
  10. package/dist/acp-client.js +738 -0
  11. package/dist/acp-inspect.d.ts +23 -0
  12. package/dist/acp-inspect.js +109 -0
  13. package/dist/agent-board.d.ts +19 -6
  14. package/dist/agent-board.js +30 -9
  15. package/dist/agent-fence.d.ts +50 -2
  16. package/dist/agent-fence.js +157 -10
  17. package/dist/agent-pulse.js +9 -2
  18. package/dist/agent-state-words.d.ts +19 -0
  19. package/dist/agent-state-words.js +20 -0
  20. package/dist/agent-state.d.ts +65 -0
  21. package/dist/agent-state.js +229 -0
  22. package/dist/agentconfig.js +36 -13
  23. package/dist/agents-board.d.ts +34 -2
  24. package/dist/agents-board.js +110 -1
  25. package/dist/approval-rules-ui.js +2 -2
  26. package/dist/assignment-delivery.d.ts +14 -0
  27. package/dist/assignment-delivery.js +13 -0
  28. package/dist/assignment.js +13 -0
  29. package/dist/attest.js +7 -0
  30. package/dist/backup-ui.js +2 -2
  31. package/dist/browser/THIRD_PARTY_NOTICES.txt +48 -0
  32. package/dist/browser/terminal.css +37 -0
  33. package/dist/browser/terminal.js +117 -0
  34. package/dist/browser/workspace.css +2 -2
  35. package/dist/browser/workspace.js +42 -38
  36. package/dist/browser-shell.js +6 -3
  37. package/dist/browser-workspace.d.ts +235 -1
  38. package/dist/browser-workspace.js +60 -0
  39. package/dist/builder.d.ts +6 -1
  40. package/dist/builder.js +34 -13
  41. package/dist/chat-actions.d.ts +13 -1
  42. package/dist/chat-actions.js +197 -15
  43. package/dist/chat-ask.d.ts +4 -0
  44. package/dist/chat-ask.js +14 -0
  45. package/dist/chat-channel.js +20 -0
  46. package/dist/chat-continuity.js +5 -4
  47. package/dist/chat-decide.d.ts +0 -14
  48. package/dist/chat-decide.js +4 -1
  49. package/dist/chat-delivery.d.ts +9 -0
  50. package/dist/chat-delivery.js +45 -6
  51. package/dist/chat-messages.d.ts +8 -0
  52. package/dist/chat-messages.js +36 -4
  53. package/dist/check-levels-ui.js +2 -2
  54. package/dist/checkout-proof.d.ts +28 -0
  55. package/dist/checkout-proof.js +62 -0
  56. package/dist/claim.d.ts +12 -0
  57. package/dist/claim.js +19 -0
  58. package/dist/cli-help.d.ts +1 -1
  59. package/dist/cli-help.js +4 -1
  60. package/dist/cli.d.ts +3 -0
  61. package/dist/cli.js +21 -2
  62. package/dist/coding-ui.js +6 -4
  63. package/dist/console-instance.d.ts +124 -0
  64. package/dist/console-instance.js +337 -0
  65. package/dist/contracts/chat-actions.d.ts +16 -0
  66. package/dist/contracts/chat-actions.js +4 -0
  67. package/dist/contracts/chat-content.d.ts +19 -0
  68. package/dist/contracts/chat-content.js +6 -0
  69. package/dist/contracts/console-api.d.ts +12 -4
  70. package/dist/contracts/console-api.js +12 -4
  71. package/dist/contracts/flow-card.d.ts +4 -0
  72. package/dist/contracts/flow-card.js +3 -0
  73. package/dist/contracts/flow.d.ts +46 -0
  74. package/dist/contracts/flow.js +11 -2
  75. package/dist/contracts/lead-tools.d.ts +92 -0
  76. package/dist/contracts/lead-tools.js +13 -0
  77. package/dist/contracts/provider.d.ts +11 -1
  78. package/dist/contracts/provider.js +1 -1
  79. package/dist/contracts/route.d.ts +76 -1
  80. package/dist/contracts/route.js +1 -1
  81. package/dist/contracts/store-json.d.ts +2 -0
  82. package/dist/control-setup.d.ts +1 -1
  83. package/dist/control-ui.js +2 -2
  84. package/dist/converse.d.ts +16 -0
  85. package/dist/converse.js +32 -4
  86. package/dist/demo-chat.js +4 -4
  87. package/dist/demo.js +2 -2
  88. package/dist/desktop-update-gate.js +6 -0
  89. package/dist/desktop-update.d.ts +1 -1
  90. package/dist/discord-chat.js +4 -1
  91. package/dist/doctor.js +1 -1
  92. package/dist/egress-bridge.d.ts +17 -0
  93. package/dist/egress-bridge.js +111 -0
  94. package/dist/egress.d.ts +119 -0
  95. package/dist/egress.js +423 -0
  96. package/dist/exec.d.ts +78 -0
  97. package/dist/exec.js +367 -9
  98. package/dist/export-ui.js +2 -2
  99. package/dist/flow-engine.js +24 -5
  100. package/dist/flow-gallery-ui.js +2 -2
  101. package/dist/flow-gallery.js +27 -8
  102. package/dist/flow-share.js +16 -5
  103. package/dist/flow-triggers.d.ts +77 -8
  104. package/dist/flow-triggers.js +517 -70
  105. package/dist/flows-cli.js +8 -2
  106. package/dist/flows-ui.d.ts +0 -2
  107. package/dist/flows-ui.js +52 -4
  108. package/dist/flows.d.ts +4 -0
  109. package/dist/flows.js +9 -1
  110. package/dist/html.d.ts +9 -0
  111. package/dist/html.js +11 -0
  112. package/dist/invoke.d.ts +17 -0
  113. package/dist/invoke.js +217 -21
  114. package/dist/keys.d.ts +18 -14
  115. package/dist/keys.js +5 -0
  116. package/dist/lead-capabilities.js +3 -2
  117. package/dist/lead-contract.js +2 -0
  118. package/dist/lead-doors.d.ts +2 -0
  119. package/dist/lead-doors.js +7 -0
  120. package/dist/lead-follow.d.ts +2 -0
  121. package/dist/lead-follow.js +58 -2
  122. package/dist/lead-progress.js +1 -0
  123. package/dist/lead-queue-runtime.d.ts +46 -0
  124. package/dist/lead-queue-runtime.js +191 -0
  125. package/dist/lead-queue.d.ts +104 -0
  126. package/dist/lead-queue.js +187 -0
  127. package/dist/lead-sweep.d.ts +67 -0
  128. package/dist/lead-sweep.js +99 -0
  129. package/dist/lead-tools.d.ts +22 -0
  130. package/dist/lead-tools.js +152 -1
  131. package/dist/lead.d.ts +13 -5
  132. package/dist/lead.js +89 -29
  133. package/dist/limits-ui.d.ts +8 -1
  134. package/dist/limits-ui.js +26 -0
  135. package/dist/live-bus.d.ts +8 -0
  136. package/dist/live-bus.js +40 -4
  137. package/dist/live-detail.d.ts +27 -0
  138. package/dist/live-detail.js +57 -0
  139. package/dist/live-notes.d.ts +20 -0
  140. package/dist/live-notes.js +47 -0
  141. package/dist/live-records.d.ts +140 -0
  142. package/dist/live-records.js +935 -0
  143. package/dist/live-terminal.d.ts +258 -0
  144. package/dist/live-terminal.js +649 -0
  145. package/dist/live.d.ts +38 -27
  146. package/dist/live.js +142 -124
  147. package/dist/mcp-oauth.d.ts +6 -3
  148. package/dist/mcp-oauth.js +8 -4
  149. package/dist/memory-pass.js +2 -2
  150. package/dist/mobile-viewport.d.ts +5 -1
  151. package/dist/mobile-viewport.js +18 -2
  152. package/dist/model-catalog.js +4 -0
  153. package/dist/monitoring-ui.js +2 -2
  154. package/dist/needs-you.d.ts +1 -1
  155. package/dist/needs-you.js +11 -4
  156. package/dist/operate.d.ts +2 -0
  157. package/dist/operate.js +275 -17
  158. package/dist/passwordless.d.ts +23 -0
  159. package/dist/passwordless.js +26 -0
  160. package/dist/peek-cli.d.ts +12 -4
  161. package/dist/peek-cli.js +19 -11
  162. package/dist/phase-routing.js +10 -3
  163. package/dist/planner-source.d.ts +3 -0
  164. package/dist/planner-source.js +14 -0
  165. package/dist/planner.d.ts +2 -1
  166. package/dist/planner.js +7 -1
  167. package/dist/policy-ui.js +2 -2
  168. package/dist/policy.d.ts +1 -20
  169. package/dist/policy.js +29 -2
  170. package/dist/project-delete-ui.d.ts +12 -0
  171. package/dist/project-delete-ui.js +41 -9
  172. package/dist/project-delete.js +2 -2
  173. package/dist/project-memory.d.ts +3 -1
  174. package/dist/project-memory.js +57 -25
  175. package/dist/project-tools.d.ts +5 -3
  176. package/dist/project-tools.js +12 -9
  177. package/dist/provider-auth.d.ts +4 -3
  178. package/dist/provider-auth.js +5 -4
  179. package/dist/provider-connection.d.ts +2 -1
  180. package/dist/provider-connection.js +5 -0
  181. package/dist/provider.d.ts +25 -2
  182. package/dist/provider.js +63 -9
  183. package/dist/pull-request-ui.js +2 -2
  184. package/dist/push.js +1 -1
  185. package/dist/quick-start.d.ts +24 -0
  186. package/dist/quick-start.js +127 -0
  187. package/dist/release.d.ts +3 -0
  188. package/dist/release.js +14 -8
  189. package/dist/request-budget-ui.js +2 -2
  190. package/dist/result-review.d.ts +1 -1
  191. package/dist/result-review.js +9 -3
  192. package/dist/retention-ui.js +2 -2
  193. package/dist/retention.js +10 -1
  194. package/dist/run-efficiency.d.ts +73 -0
  195. package/dist/run-efficiency.js +228 -0
  196. package/dist/runner.d.ts +5 -1
  197. package/dist/runner.js +22 -1
  198. package/dist/scope.d.ts +170 -5
  199. package/dist/scope.js +251 -31
  200. package/dist/scout-net.d.ts +4 -1
  201. package/dist/scout-net.js +37 -12
  202. package/dist/scout.d.ts +20 -6
  203. package/dist/scout.js +27 -3
  204. package/dist/serve.js +247 -40
  205. package/dist/server/chat.d.ts +1 -1
  206. package/dist/server/chat.js +122 -31
  207. package/dist/server/chrome.d.ts +6 -1
  208. package/dist/server/chrome.js +18 -7
  209. package/dist/server/console.css +52 -38
  210. package/dist/server/flows.js +38 -8
  211. package/dist/server/guards.d.ts +1 -0
  212. package/dist/server/guards.js +23 -9
  213. package/dist/server/http.d.ts +7 -0
  214. package/dist/server/http.js +3 -2
  215. package/dist/server/live.d.ts +34 -1
  216. package/dist/server/live.js +39 -17
  217. package/dist/server/pages-assets.js +5 -0
  218. package/dist/server/pages.js +90 -13
  219. package/dist/server/people-tokens.d.ts +3 -0
  220. package/dist/server/people-tokens.js +55 -17
  221. package/dist/server/remote-hooks.js +12 -6
  222. package/dist/server/remote.d.ts +2 -1
  223. package/dist/server/remote.js +14 -5
  224. package/dist/server/render-chat.d.ts +12 -3
  225. package/dist/server/render-chat.js +47 -16
  226. package/dist/server/render-pages.d.ts +4 -1
  227. package/dist/server/render-pages.js +5 -4
  228. package/dist/server/render-people.d.ts +3 -2
  229. package/dist/server/render-people.js +3 -2
  230. package/dist/server/render-results.d.ts +18 -2
  231. package/dist/server/render-results.js +37 -28
  232. package/dist/server/render-settings.js +6 -5
  233. package/dist/server/render-tasks.d.ts +35 -10
  234. package/dist/server/render-tasks.js +110 -27
  235. package/dist/server/request-context.d.ts +2 -0
  236. package/dist/server/request-context.js +2 -1
  237. package/dist/server/route-table.d.ts +3 -0
  238. package/dist/server/route-table.js +46 -5
  239. package/dist/server/runtime.d.ts +33 -2
  240. package/dist/server/session.d.ts +25 -1
  241. package/dist/server/session.js +18 -4
  242. package/dist/server/settings.js +121 -10
  243. package/dist/server/sweeps.d.ts +4 -0
  244. package/dist/server/sweeps.js +58 -0
  245. package/dist/server/task-views.d.ts +2 -1
  246. package/dist/server/task-views.js +96 -6
  247. package/dist/server/tasks.js +320 -74
  248. package/dist/server/terminals.d.ts +31 -0
  249. package/dist/server/terminals.js +365 -0
  250. package/dist/setup-guide.js +3 -2
  251. package/dist/slack-chat.js +4 -1
  252. package/dist/spend-ui.js +3 -3
  253. package/dist/spend.js +2 -1
  254. package/dist/steer-capabilities.d.ts +32 -0
  255. package/dist/steer-capabilities.js +60 -0
  256. package/dist/steer-controls.d.ts +14 -0
  257. package/dist/steer-controls.js +36 -0
  258. package/dist/steer-status.js +2 -2
  259. package/dist/storage-ui.js +4 -4
  260. package/dist/store-baseline.d.ts +1 -1
  261. package/dist/store-baseline.js +1 -1
  262. package/dist/store.d.ts +430 -15
  263. package/dist/store.js +1041 -52
  264. package/dist/subagent-desk.js +1 -1
  265. package/dist/summary.js +3 -0
  266. package/dist/task-source.d.ts +58 -0
  267. package/dist/task-source.js +93 -0
  268. package/dist/team-leads.js +1 -1
  269. package/dist/teams-chat.js +4 -1
  270. package/dist/telegram-lead.d.ts +3 -0
  271. package/dist/telegram-lead.js +44 -7
  272. package/dist/telegram.d.ts +11 -2
  273. package/dist/telegram.js +51 -17
  274. package/dist/terminal-catalog.d.ts +11 -0
  275. package/dist/terminal-catalog.js +129 -0
  276. package/dist/text-limits.d.ts +2 -0
  277. package/dist/text-limits.js +2 -0
  278. package/dist/tool-broker.d.ts +2 -0
  279. package/dist/tool-broker.js +1 -0
  280. package/dist/toolroll-update-ui.js +2 -2
  281. package/dist/toolroll-update.js +13 -3
  282. package/dist/tools-ui.js +2 -2
  283. package/dist/webhook-limits.d.ts +23 -0
  284. package/dist/webhook-limits.js +30 -0
  285. package/dist/webhook-readers.d.ts +56 -0
  286. package/dist/webhook-readers.js +138 -0
  287. package/dist/webhook-signing.d.ts +27 -0
  288. package/dist/webhook-signing.js +119 -0
  289. package/dist/work-index.d.ts +29 -0
  290. package/dist/work-index.js +16 -2
  291. package/dist/workspace-revision.js +3 -1
  292. package/package.json +11 -2
@@ -24,7 +24,7 @@ import { addFlowTriggerTo, describeTrigger, HOOK_PATH, readHooksBase, triggerCon
24
24
  import { durationMinutes, durationWords, FlowContractError, flowTerms, inStepWords, LANGUAGE_WORDS, validateFlowDefinition } from "./flows.js";
25
25
  import { stageReferenceProblems } from "./contracts/stage-output.js";
26
26
  import { readVersioned } from "./contracts/contract.js";
27
- import { FLOW_ALIASES, FLOW_FILE_FORMAT, legacyFlowNeed, legacySubagentStep, FLOW_FILE_VERSION, flowFileSchema, PARAMETER_ID } from "./contracts/flow.js";
27
+ import { FLOW_ALIASES, WEBHOOK_SENDERS, FLOW_FILE_FORMAT, legacyFlowNeed, legacySubagentStep, FLOW_FILE_VERSION, flowFileSchema, PARAMETER_ID } from "./contracts/flow.js";
28
28
  import { parseSchedule } from "./flow-schedule.js";
29
29
  export { FLOW_FILE_FORMAT, FLOW_FILE_VERSION };
30
30
  /** The largest flow file Toolroll reads or fetches. */
@@ -111,7 +111,13 @@ function triggerOf(config, ask) {
111
111
  ...(config.state === null ? {} : { state: config.state }),
112
112
  ...(config.label === null ? {} : { label: ask({ id: "linear-label", about: "The Linear label issues need", default: config.label }) }),
113
113
  delivery: config.delivery, ...zone };
114
- case "webhook": return { kind: "webhook", title: config.title, ...(config.titleField === null ? {} : { titleField: config.titleField }), ...(config.bodyField === null ? {} : { bodyField: config.bodyField }), ...zone };
114
+ // v126: who signs it travels (never its secret or address: an imported signed webhook isn't set up until its
115
+ // secret is made or pasted there); the project and team it is scoped to are asked again, as another install's own.
116
+ case "webhook": return { kind: "webhook", title: config.title, ...(config.titleField == null ? {} : { titleField: config.titleField }), ...(config.bodyField == null ? {} : { bodyField: config.bodyField }),
117
+ ...((config.sender ?? "none") === "none" ? {} : { sender: config.sender }),
118
+ ...(config.project == null ? {} : { project: ask({ id: "webhook-project", about: "The project the signed webhook's deliveries must come from", default: config.project }) }),
119
+ ...(config.team == null ? {} : { team: ask({ id: "webhook-team", about: "The Vercel team the deliveries must come from", default: config.team }) }),
120
+ ...(config.idField == null ? {} : { idField: config.idField }), ...(config.urlField == null ? {} : { urlField: config.urlField }), ...zone };
115
121
  case "email": return { kind: "email", folder: config.folder,
116
122
  ...(config.sender === null ? {} : { sender: ask({ id: "email-sender", about: "Whose mail starts cards: addresses or domains, comma-separated (left empty: anyone's)", optional: true }) }),
117
123
  ...(config.subject === null ? {} : { subject: config.subject }), ...zone };
@@ -192,8 +198,13 @@ function scrubDeep(value, scrub, key, inScripts) {
192
198
  return key !== null && (STRUCTURAL.has(key) || (inScripts && key === "name")) ? value : scrub(value);
193
199
  if (Array.isArray(value))
194
200
  return value.map(one => scrubDeep(one, scrub, key, inScripts));
195
- if (value !== null && typeof value === "object")
196
- return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, scrubDeep(v, scrub, k, inScripts || k === "scripts")]));
201
+ if (value !== null && typeof value === "object") {
202
+ // v126: a webhook's sender is one of a fixed few words (who signs it), never prose: kept as it is, even when an
203
+ // account happens to share its name. An email trigger's sender is people's addresses, and is still scrubbed.
204
+ const record = value;
205
+ const webhookSender = record["kind"] === "webhook" && typeof record["sender"] === "string" && WEBHOOK_SENDERS.includes(record["sender"]);
206
+ return Object.fromEntries(Object.entries(record).map(([k, v]) => [k, webhookSender && k === "sender" ? v : scrubDeep(v, scrub, k, inScripts || k === "scripts")]));
207
+ }
197
208
  return value;
198
209
  }
199
210
  /** A flow as a file: its zones and paths, its triggers' settings and the scripts it runs, nothing of this installation's. */
@@ -530,7 +541,7 @@ export function importFlow(store, plan, actor, now, dir) {
530
541
  }
531
542
  const id = store.createFlow({ repo: plan.repo, name: plan.name, definitionJson: JSON.stringify(plan.definition), by: actor }, now);
532
543
  for (const trigger of plan.triggers) {
533
- const made = addFlowTriggerTo(store, store.getFlow(id), trigger, actor, now, dir);
544
+ const made = addFlowTriggerTo(store, store.getFlow(id), trigger, actor, now, dir, { shown: false });
534
545
  if (!made.ok)
535
546
  throw new FlowFileError(`A ${String(trigger["kind"])} trigger: ${made.message}`);
536
547
  store.updateFlowTrigger(made.id, { state: "paused" }, now);
@@ -1,6 +1,7 @@
1
1
  import type { Runner } from "./backend.js";
2
2
  import { type FlowAct } from "./flow-engine.js";
3
3
  import { type FlowDefinition } from "./flows.js";
4
+ import { type DistinctHeaders, type WebhookSender } from "./webhook-signing.js";
4
5
  import { type ContractResult } from "./contracts/contract.js";
5
6
  import { FLOW_TRIGGER_KINDS, type ChatApp, type FlowTriggerKind, type TriggerConfig, type TriggerInput } from "./contracts/flow.js";
6
7
  import { type MailReader } from "./mailbox.js";
@@ -49,11 +50,18 @@ export declare function triggerHeadline(config: TriggerConfig, store: Store): {
49
50
  export declare function triggerConfigOf(trigger: FlowTriggerRow): TriggerConfig | null;
50
51
  /** A saved trigger's config (`configJson`, which carries no version) read by its one schema, what it leaves out filled. */
51
52
  export declare function readTriggerConfig(raw: unknown): ContractResult<TriggerConfig>;
53
+ /** v126: who signs a webhook trigger's deliveries; one saved before senders were chosen is unsigned. */
54
+ export declare const senderOf: (config: Extract<TriggerConfig, {
55
+ kind: "webhook";
56
+ }>) => WebhookSender;
52
57
  /** Whether this trigger takes deliveries at a secret address rather than being checked. */
58
+ /** Whether a raw trigger the caller is about to add would take deliveries (an address): read leniently, before validation. */
59
+ export declare function rawTakesDeliveries(raw: unknown): boolean;
53
60
  export declare function takesDeliveries(config: TriggerConfig): boolean;
54
- /** A webhook's signing secret (GitHub: made here; Linear: pasted from Linear). In the keychain (or an owner-only file where there's none), never a column. */
55
- export declare function saveHookSecret(dir: string, trigger: number, secret: string): void;
56
- export declare function readHookSecret(dir: string, trigger: number): string | null;
61
+ /** A webhook's signing secret (made here, or pasted from its sender). In the keychain (or an owner-only file where there's none), never a column. */
62
+ export declare function saveHookSecret(dir: string, trigger: number, secret: string, credential?: string): void;
63
+ /** Exactly this credential's secret, or null: never another's. */
64
+ export declare function readHookSecret(dir: string, trigger: number, credential?: string): string | null;
57
65
  export declare const LINEAR_ENV = "TOOLROLL_LINEAR_KEY";
58
66
  /** The Linear API key the worker checks Linear with: the environment, or kept by Toolroll (the keychain, or an owner-only file beside the database). */
59
67
  export declare function readLinearKey(dir: string | null): string | null;
@@ -89,7 +97,15 @@ export type TriggerMade = {
89
97
  message: string;
90
98
  };
91
99
  /** Add a trigger to a flow. A webhook trigger's address (and GitHub's signing secret) is returned once and never stored readable. */
92
- export declare function addFlowTriggerTo(store: Store, flow: FlowRow, raw: unknown, actor: string, now: Date, dir: string | null): TriggerMade;
100
+ /**
101
+ * `ingress: "proved"`: the caller proved a password typed now (a credential act, docs/plans/passwordless.md) — only then
102
+ * may a trigger that takes deliveries be made with an address. Without it a webhook is made with none (its panel's
103
+ * set-up, which asks for the password, makes one), and GitHub/Linear webhook delivery is refused.
104
+ */
105
+ export declare function addFlowTriggerTo(store: Store, flow: FlowRow, raw: unknown, actor: string, now: Date, dir: string | null, options?: {
106
+ shown?: boolean;
107
+ ingress?: "proved";
108
+ }): TriggerMade;
93
109
  /** A new secret address for a webhook trigger (the old one stops working at once). */
94
110
  export declare function renewFlowHook(store: Store, trigger: FlowTriggerRow, now: Date, dir: string): TriggerMade;
95
111
  /**
@@ -189,24 +205,77 @@ export declare const LINEAR_QUERY = "query FlowTrigger($filter: IssueFilter) { i
189
205
  export declare function linearItem(config: Extract<TriggerConfig, {
190
206
  kind: "linear";
191
207
  }>, raw: unknown): Found | null;
208
+ /** v126: headers as Node's `headersDistinct` gives them, one value per line they arrived on, so a security header sent
209
+ * twice is seen twice (Node's `headers` joins repeated custom headers with commas). */
192
210
  export type HookDelivery = {
193
- headers: Record<string, string | string[] | undefined>;
211
+ headers: DistinctHeaders;
194
212
  body: Buffer;
195
213
  };
214
+ /** `retryAfter` (seconds): a 429's Retry-After. */
196
215
  export type HookAnswer = {
197
216
  status: number;
198
217
  said: string;
218
+ retryAfter?: number;
199
219
  };
200
220
  /** A webhook delivery at a trigger's secret address: prove it, read it, make at most the cards it names. Nothing runs here. */
201
221
  export declare function receiveFlowHook(store: Store, token: string, delivery: HookDelivery, dir: string, now: Date): HookAnswer;
202
- /** Save Linear's signing secret for a Linear webhook trigger (pasted on the secure panel, never in chat). */
203
- export declare function saveLinearSigningSecret(trigger: FlowTriggerRow, secret: string, dir: string): {
222
+ /**
223
+ * v126: make a trigger's held deliveries into their cards while the last hour has room, oldest first. Each card in its
224
+ * own write transaction, which reads everything it acts on under the write lock: the trigger (still active, still
225
+ * taking deliveries), the hour's room, the oldest held receipt, the flow; then the same guards intake has (a failing
226
+ * run already owned by another card in the project is left out). The card and the receipt's move to accepted land
227
+ * together, or neither does.
228
+ */
229
+ export declare function drainHeldDeliveries(store: Store, trigger: FlowTriggerRow, now: Date): number;
230
+ /**
231
+ * v126: a delivery refused before it could be read (too large, a body that wouldn't read): it proves nothing, so it
232
+ * counts toward its address's minute like any unproven delivery. The answer to give instead when that count is over.
233
+ */
234
+ export declare function hookRefusedUnread(store: Store, token: string, now: Date): HookAnswer | null;
235
+ /** A signing secret pasted on the secure panel behind the password, never in chat: Linear's, or a signed webhook's
236
+ * sender's (Sentry's or Vercel's own, or a Standard or GitHub-style one made elsewhere). */
237
+ export declare function saveSigningSecret(store: Store, trigger: FlowTriggerRow, secret: string, now: Date, dir: string): {
204
238
  ok: true;
239
+ said: string;
240
+ } | {
241
+ ok: false;
242
+ message: string;
243
+ };
244
+ /**
245
+ * v126: a new secret for a webhook whose sender Toolroll makes secrets for (Standard Webhooks, GitHub-style), shown once.
246
+ * Its address stays as it is (New address is its own action). Sentry's and Vercel's secrets are theirs, pasted instead.
247
+ * The only place such a secret is made: creating a trigger (from the panel, the gallery or an import) never does.
248
+ */
249
+ export declare function setUpFlowHook(store: Store, trigger: FlowTriggerRow, now: Date, dir: string): TriggerMade;
250
+ /**
251
+ * v126: change who signs a webhook's deliveries, in place: the trigger keeps its id, address and what it has received
252
+ * (keys carry the sender, so nothing received unsigned stands for anything signed). Its credentials move to the next
253
+ * generation with no secret: it isn't ready until it is set up again. Settings the new sender doesn't read are left out.
254
+ */
255
+ export declare function changeFlowHookSender(store: Store, trigger: FlowTriggerRow, sender: unknown, actor: string, now: Date, dir: string): {
256
+ ok: true;
257
+ said: string;
258
+ } | {
259
+ ok: false;
260
+ message: string;
261
+ };
262
+ /**
263
+ * v126: which project (and, for Vercel, team) a Sentry or Vercel webhook takes deliveries from, set in place: the
264
+ * trigger keeps its id, address, secret and history; blank takes any project the secret covers. Only from the settings
265
+ * read here, so a change racing it doesn't land on top of it.
266
+ */
267
+ export declare function setFlowHookScope(store: Store, trigger: FlowTriggerRow, scope: {
268
+ project: unknown;
269
+ team: unknown;
270
+ }, actor: string, now: Date): {
271
+ ok: true;
272
+ said: string;
205
273
  } | {
206
274
  ok: false;
207
275
  message: string;
208
276
  };
209
- /** Whether a webhook trigger can prove its deliveries: GitHub always (its secret is made here), Linear once its secret is pasted. */
277
+ /** Whether a webhook trigger can prove its deliveries: an unsigned webhook always (its address is all it has), the others
278
+ * once the current generation's secret is saved. */
210
279
  export declare function hookReady(trigger: FlowTriggerRow, dir: string | null): boolean;
211
280
  export declare const FORM_PATH = "/hooks/form/";
212
281
  /** Share a button as a secret link anyone can fill in, without signing in. The link is shown once; only its hash is kept. */