toolroll 0.9.53 → 0.9.55

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 (254) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +5 -4
  3. package/dist/agent-onboard.js +4 -1
  4. package/dist/approval-rules-ui.d.ts +3 -2
  5. package/dist/approval-rules-ui.js +15 -20
  6. package/dist/assignment-ui.d.ts +3 -2
  7. package/dist/assignment-ui.js +4 -11
  8. package/dist/backup-ui.d.ts +2 -1
  9. package/dist/backup-ui.js +16 -27
  10. package/dist/brand-mark.d.ts +3 -2
  11. package/dist/brand-mark.js +4 -4
  12. package/dist/browser/workspace.css +1 -1
  13. package/dist/browser/workspace.js +25 -25
  14. package/dist/browser-shell.d.ts +2 -1
  15. package/dist/browser-shell.js +9 -9
  16. package/dist/browser-workspace.d.ts +2 -3
  17. package/dist/browser-workspace.js +0 -3
  18. package/dist/chat-ask.js +8 -8
  19. package/dist/chat-core.d.ts +171 -0
  20. package/dist/chat-core.js +288 -0
  21. package/dist/chat-decide.d.ts +10 -8
  22. package/dist/chat-decide.js +26 -21
  23. package/dist/chat-delivery-state.d.ts +51 -75
  24. package/dist/chat-delivery-state.js +140 -170
  25. package/dist/chat-delivery.d.ts +21 -2
  26. package/dist/chat-delivery.js +313 -194
  27. package/dist/chat-flow.d.ts +29 -1
  28. package/dist/chat-flow.js +24 -50
  29. package/dist/chat-messages.d.ts +319 -0
  30. package/dist/chat-messages.js +841 -0
  31. package/dist/chat-migration.d.ts +30 -0
  32. package/dist/chat-migration.js +802 -0
  33. package/dist/chat-polish.d.ts +5 -4
  34. package/dist/chat-polish.js +9 -10
  35. package/dist/chat-quiet.d.ts +3 -0
  36. package/dist/chat-quiet.js +5 -0
  37. package/dist/check-levels-ui.d.ts +2 -1
  38. package/dist/check-levels-ui.js +26 -53
  39. package/dist/cli.d.ts +3 -1
  40. package/dist/cli.js +9 -3
  41. package/dist/coding-shipping-ui.d.ts +2 -1
  42. package/dist/coding-shipping-ui.js +6 -6
  43. package/dist/coding-ui.d.ts +3 -1
  44. package/dist/coding-ui.js +30 -29
  45. package/dist/contracts/chat-content.d.ts +71 -2
  46. package/dist/contracts/chat-content.js +22 -3
  47. package/dist/contracts/chat-tables.d.ts +11 -4
  48. package/dist/contracts/chat-tables.js +165 -87
  49. package/dist/contracts/cli.d.ts +1 -3
  50. package/dist/contracts/console-api.d.ts +1 -1
  51. package/dist/contracts/console-api.js +6 -5
  52. package/dist/contracts/discord-callback.js +2 -1
  53. package/dist/contracts/health.d.ts +1 -3
  54. package/dist/contracts/slack-callback.js +3 -2
  55. package/dist/contracts/store-json.d.ts +1 -5
  56. package/dist/contracts/store-json.js +1 -4
  57. package/dist/contracts/teams-callback.js +2 -1
  58. package/dist/control-ui.d.ts +5 -4
  59. package/dist/control-ui.js +9 -34
  60. package/dist/credentials-ui.d.ts +5 -4
  61. package/dist/credentials-ui.js +23 -24
  62. package/dist/demo-chat.d.ts +3 -3
  63. package/dist/demo-chat.js +29 -76
  64. package/dist/discord-chat.js +19 -38
  65. package/dist/discord-settings.d.ts +3 -2
  66. package/dist/discord-settings.js +21 -55
  67. package/dist/discord.js +4 -14
  68. package/dist/envelope.js +10 -0
  69. package/dist/evidence-pack.d.ts +2 -1
  70. package/dist/evidence-pack.js +45 -49
  71. package/dist/export-ui.d.ts +7 -2
  72. package/dist/export-ui.js +4 -10
  73. package/dist/export.js +4 -4
  74. package/dist/flow-gallery-ui.d.ts +4 -3
  75. package/dist/flow-gallery-ui.js +28 -43
  76. package/dist/flow-starters-ui.d.ts +2 -1
  77. package/dist/flow-starters-ui.js +12 -15
  78. package/dist/flow-triggers.d.ts +1 -0
  79. package/dist/flow-triggers.js +16 -14
  80. package/dist/flows-ui.d.ts +4 -3
  81. package/dist/flows-ui.js +19 -30
  82. package/dist/flows.js +2 -1
  83. package/dist/guides.js +108 -3
  84. package/dist/html.d.ts +76 -0
  85. package/dist/html.js +173 -0
  86. package/dist/integrations-ui.d.ts +2 -1
  87. package/dist/integrations-ui.js +19 -23
  88. package/dist/kits-ui.d.ts +5 -4
  89. package/dist/kits-ui.js +18 -20
  90. package/dist/knowledge-ui.d.ts +6 -5
  91. package/dist/knowledge-ui.js +26 -25
  92. package/dist/lead-context.d.ts +11 -1
  93. package/dist/lead-context.js +6 -8
  94. package/dist/ledger-view.d.ts +2 -1
  95. package/dist/ledger-view.js +27 -29
  96. package/dist/limits-ui.d.ts +2 -1
  97. package/dist/limits-ui.js +7 -7
  98. package/dist/live-bus.d.ts +50 -8
  99. package/dist/live-bus.js +133 -50
  100. package/dist/mate-tools.js +3 -2
  101. package/dist/mcp-oauth.js +35 -36
  102. package/dist/models-ui.d.ts +2 -1
  103. package/dist/models-ui.js +25 -35
  104. package/dist/modes.d.ts +13 -1
  105. package/dist/modes.js +17 -1
  106. package/dist/monitoring-ui.d.ts +4 -3
  107. package/dist/monitoring-ui.js +13 -26
  108. package/dist/notification-rows.d.ts +30 -0
  109. package/dist/notification-rows.js +102 -0
  110. package/dist/openrouter-models.d.ts +2 -1
  111. package/dist/openrouter-models.js +5 -9
  112. package/dist/operate.js +16 -9
  113. package/dist/people-audit-ui.d.ts +2 -1
  114. package/dist/people-audit-ui.js +13 -13
  115. package/dist/plane-review.js +5 -11
  116. package/dist/policy-ui.d.ts +3 -2
  117. package/dist/policy-ui.js +17 -23
  118. package/dist/project-delete-ui.d.ts +4 -3
  119. package/dist/project-delete-ui.js +15 -27
  120. package/dist/project-delete.js +21 -26
  121. package/dist/pull-request-ui.d.ts +2 -1
  122. package/dist/pull-request-ui.js +17 -32
  123. package/dist/recipe-ui.d.ts +8 -7
  124. package/dist/recipe-ui.js +39 -32
  125. package/dist/release-adapters.d.ts +60 -0
  126. package/dist/release-adapters.js +435 -0
  127. package/dist/release-cli.d.ts +24 -0
  128. package/dist/release-cli.js +181 -0
  129. package/dist/release-gate.d.ts +80 -0
  130. package/dist/release-gate.js +150 -0
  131. package/dist/release-links.d.ts +29 -0
  132. package/dist/release-links.js +102 -0
  133. package/dist/release.d.ts +331 -0
  134. package/dist/release.js +550 -0
  135. package/dist/reply-shape.d.ts +2 -1
  136. package/dist/reply-shape.js +5 -5
  137. package/dist/repository-context-ui.d.ts +2 -1
  138. package/dist/repository-context-ui.js +2 -7
  139. package/dist/request-budget-ui.d.ts +2 -1
  140. package/dist/request-budget-ui.js +16 -16
  141. package/dist/result-review.d.ts +2 -3
  142. package/dist/result-review.js +3 -9
  143. package/dist/result-shots.js +2 -2
  144. package/dist/retention-ui.d.ts +7 -1
  145. package/dist/retention-ui.js +7 -11
  146. package/dist/retention.js +1 -1
  147. package/dist/serve.d.ts +11 -2
  148. package/dist/serve.js +69 -58
  149. package/dist/server/chat.d.ts +3 -6
  150. package/dist/server/chat.js +969 -1006
  151. package/dist/server/chrome.d.ts +291 -0
  152. package/dist/server/chrome.js +747 -0
  153. package/dist/server/console.css +2819 -0
  154. package/dist/server/flows.d.ts +2 -6
  155. package/dist/server/flows.js +840 -766
  156. package/dist/server/guards.d.ts +1 -1
  157. package/dist/server/guards.js +5 -2
  158. package/dist/server/handler-context.d.ts +1 -1
  159. package/dist/server/handler-context.js +1 -1
  160. package/dist/server/handler-registry.d.ts +8 -6
  161. package/dist/server/handler-registry.js +14 -2
  162. package/dist/server/http.d.ts +274 -0
  163. package/dist/server/http.js +239 -0
  164. package/dist/server/live.d.ts +34 -0
  165. package/dist/server/live.js +309 -0
  166. package/dist/server/pages.d.ts +2 -6
  167. package/dist/server/pages.js +808 -789
  168. package/dist/server/people-tokens.d.ts +1 -6
  169. package/dist/server/people-tokens.js +580 -572
  170. package/dist/server/remote.d.ts +4 -7
  171. package/dist/server/remote.js +37 -70
  172. package/dist/server/render-chat.d.ts +402 -0
  173. package/dist/server/render-chat.js +927 -0
  174. package/dist/server/render-pages.d.ts +535 -0
  175. package/dist/server/render-pages.js +1277 -0
  176. package/dist/server/render-people.d.ts +32 -0
  177. package/dist/server/render-people.js +121 -0
  178. package/dist/server/render-results.d.ts +744 -0
  179. package/dist/server/render-results.js +2237 -0
  180. package/dist/server/render-settings.d.ts +147 -0
  181. package/dist/server/render-settings.js +577 -0
  182. package/dist/server/render-tasks.d.ts +632 -0
  183. package/dist/server/render-tasks.js +2345 -0
  184. package/dist/server/request-context.d.ts +46 -0
  185. package/dist/server/request-context.js +17 -0
  186. package/dist/server/route-table.d.ts +25 -3
  187. package/dist/server/route-table.js +163 -75
  188. package/dist/server/runtime.d.ts +15 -7
  189. package/dist/server/runtime.js +7 -1
  190. package/dist/server/session.d.ts +138 -0
  191. package/dist/server/session.js +94 -0
  192. package/dist/server/settings.d.ts +1 -5
  193. package/dist/server/settings.js +2182 -2117
  194. package/dist/server/task-views.d.ts +11 -4
  195. package/dist/server/task-views.js +26 -22
  196. package/dist/server/tasks.d.ts +9 -9
  197. package/dist/server/tasks.js +1486 -1418
  198. package/dist/server-telemetry.d.ts +4 -3
  199. package/dist/server-telemetry.js +4 -8
  200. package/dist/skills-ui.d.ts +4 -3
  201. package/dist/skills-ui.js +14 -17
  202. package/dist/skills.d.ts +1 -1
  203. package/dist/skills.js +2 -1
  204. package/dist/slack-api.d.ts +5 -1
  205. package/dist/slack-api.js +2 -2
  206. package/dist/slack-chat.d.ts +9 -4
  207. package/dist/slack-chat.js +29 -52
  208. package/dist/slack-settings.d.ts +3 -2
  209. package/dist/slack-settings.js +23 -57
  210. package/dist/slack.js +6 -16
  211. package/dist/spend-ui.d.ts +2 -1
  212. package/dist/spend-ui.js +9 -32
  213. package/dist/sso-ui.d.ts +3 -2
  214. package/dist/sso-ui.js +26 -27
  215. package/dist/storage-ui.d.ts +2 -1
  216. package/dist/storage-ui.js +14 -33
  217. package/dist/store.d.ts +97 -364
  218. package/dist/store.js +207 -1531
  219. package/dist/surface.js +14 -3
  220. package/dist/task-composer.d.ts +2 -1
  221. package/dist/task-composer.js +7 -7
  222. package/dist/task-status.d.ts +4 -3
  223. package/dist/task-status.js +15 -16
  224. package/dist/team-http.d.ts +5 -9
  225. package/dist/team-http.js +5 -63
  226. package/dist/team-ui.d.ts +2 -1
  227. package/dist/team-ui.js +2 -5
  228. package/dist/teammate-question.js +12 -12
  229. package/dist/teammates-ui.d.ts +5 -4
  230. package/dist/teammates-ui.js +61 -90
  231. package/dist/teams-chat.js +12 -9
  232. package/dist/teams-settings.d.ts +3 -2
  233. package/dist/teams-settings.js +22 -33
  234. package/dist/teams.js +4 -5
  235. package/dist/telegram-flow.js +5 -5
  236. package/dist/telegram-settings.d.ts +3 -2
  237. package/dist/telegram-settings.js +14 -25
  238. package/dist/telegram.js +4 -4
  239. package/dist/toolroll-update-ui.d.ts +3 -2
  240. package/dist/toolroll-update-ui.js +35 -39
  241. package/dist/toolroll-update.d.ts +10 -0
  242. package/dist/toolroll-update.js +50 -3
  243. package/dist/tools-ui.d.ts +5 -2
  244. package/dist/tools-ui.js +31 -31
  245. package/dist/when-html.d.ts +11 -3
  246. package/dist/when-html.js +5 -6
  247. package/dist/workspace-revision.js +3 -1
  248. package/dist/workspace-ui.d.ts +4 -2
  249. package/dist/workspace-ui.js +10 -10
  250. package/package.json +1 -1
  251. package/dist/server/shared.d.ts +0 -3151
  252. package/dist/server/shared.js +0 -12001
  253. package/dist/slack-state.d.ts +0 -13
  254. package/dist/slack-state.js +0 -10
package/dist/store.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { type ChatBinding } from "./chat-core.js";
2
+ import { ChatMessages, TELEGRAM_HOLD_REASONS, TELEGRAM_SKIPPED_ELSEWHERE, TELEGRAM_SKIPPED_OTHER_CHAT, TELEGRAM_SKIPPED_QUIET } from "./chat-messages.js";
3
+ import { isLifecycleNotification, isTelegramProgressNotification, LIFECYCLE_KEY_PREFIX, LIFECYCLE_KINDS, proposalTaskOf, type LifecycleKind } from "./notification-rows.js";
1
4
  import { ServerTelemetry } from "./server-telemetry.js";
2
5
  import type { DecisionOption } from "./contracts/decision.js";
3
6
  import { type SavedToolAction, type SavedToolRule } from "./contracts/store-json.js";
@@ -67,7 +70,7 @@ export declare const MATE_ASK_SCHEMA = "\nCREATE TABLE IF NOT EXISTS mate_ask (\
67
70
  * person (shown on the card, and read again by every chat app that delivers it); telegram_flow_choice is one opaque button
68
71
  * per option for one visit of one card, placed on the message it rides. A reply to that message is the note
69
72
  * (telegram_flow_prompt, mode send-back). The chat apps keep their buttons beside their messages (chat-delivery-state.ts). */
70
- export declare const FLOW_SEND_SCHEMA = "\nCREATE TABLE IF NOT EXISTS flow_send (\n card INTEGER NOT NULL REFERENCES flow_card(id),\n entry INTEGER NOT NULL,\n stage TEXT NOT NULL,\n person TEXT NOT NULL,\n content_json TEXT NOT NULL,\n created_at TEXT NOT NULL,\n PRIMARY KEY (card, entry)\n);\nCREATE TABLE IF NOT EXISTS telegram_flow_choice (\n token TEXT PRIMARY KEY,\n binding INTEGER NOT NULL REFERENCES telegram_binding(id) ON DELETE RESTRICT,\n card INTEGER NOT NULL REFERENCES flow_card(id),\n entry INTEGER NOT NULL,\n choice INTEGER NOT NULL,\n label TEXT NOT NULL,\n chat_id TEXT NOT NULL,\n message_id TEXT,\n created_at TEXT NOT NULL,\n expires_at TEXT NOT NULL,\n consumed_at TEXT\n);\nCREATE INDEX IF NOT EXISTS telegram_flow_choice_visit ON telegram_flow_choice (card, entry);\n";
73
+ export declare const FLOW_SEND_SCHEMA = "\nCREATE TABLE IF NOT EXISTS flow_send (\n card INTEGER NOT NULL REFERENCES flow_card(id),\n entry INTEGER NOT NULL,\n stage TEXT NOT NULL,\n person TEXT NOT NULL,\n content_json TEXT NOT NULL,\n created_at TEXT NOT NULL,\n PRIMARY KEY (card, entry)\n);\n";
71
74
  /** An owner's lasting choice to approve plans and merges from their paired chat (chat-approval.ts), for all their
72
75
  * projects (scope '*') or one (its path), with the limits they agreed to. Off unless a row says on; a project's own row
73
76
  * outranks the all-projects one. `generation` is the account's at the change: a reset password ends it. */
@@ -76,9 +79,6 @@ export declare const FLOW_SEND_SCHEMA = "\nCREATE TABLE IF NOT EXISTS flow_send
76
79
  * a finished run's row goes with the live log's own retention (sweepRunActivity). */
77
80
  export declare const RUN_ACTIVITY_SCHEMA = "\nCREATE TABLE IF NOT EXISTS run_activity (\n run INTEGER PRIMARY KEY REFERENCES run(id) ON DELETE CASCADE,\n kind TEXT NOT NULL CHECK (kind IN ('session','message','edit','command','read','search','lookup','plan','delegate','tool')),\n at TEXT NOT NULL\n);\n";
78
81
  export declare const CHAT_APPROVAL_SCHEMA = "\nCREATE TABLE IF NOT EXISTS chat_approval_setting (\n approver TEXT NOT NULL,\n scope TEXT NOT NULL,\n enabled INTEGER NOT NULL CHECK (enabled IN (0,1)),\n full_access INTEGER NOT NULL DEFAULT 0 CHECK (full_access IN (0,1)),\n attempt_cap_microusd INTEGER CHECK (attempt_cap_microusd IS NULL OR attempt_cap_microusd >= 0),\n generation INTEGER NOT NULL,\n digest TEXT NOT NULL,\n updated_by TEXT NOT NULL,\n updated_at TEXT NOT NULL,\n PRIMARY KEY (approver, scope)\n);\n";
79
- /** The second tap on a flow decision in Telegram (telegram-flow.ts): Approve arms Yes and Cancel, bound to the binding,
80
- * chat, message and exact visit of the card; Yes decides it once. */
81
- export declare const TELEGRAM_FLOW_CONFIRM_SCHEMA = "\nCREATE TABLE IF NOT EXISTS telegram_flow_confirm (\n token TEXT PRIMARY KEY,\n binding INTEGER NOT NULL,\n chat_id TEXT NOT NULL,\n message_id TEXT NOT NULL,\n card INTEGER NOT NULL,\n entry INTEGER NOT NULL,\n phase TEXT NOT NULL CHECK (phase IN ('yes','cancel')),\n created_at TEXT NOT NULL,\n expires_at TEXT NOT NULL,\n consumed_at TEXT\n);\nCREATE INDEX IF NOT EXISTS telegram_flow_confirm_visit ON telegram_flow_confirm (card, entry);\n";
82
82
  export declare const CHAT_DECIDE_SCHEMA = "\nCREATE TABLE IF NOT EXISTS chat_decide_action (\n token TEXT PRIMARY KEY,\n channel TEXT NOT NULL,\n binding INTEGER NOT NULL,\n chat TEXT NOT NULL,\n message TEXT,\n act TEXT NOT NULL CHECK (act IN ('accept','changes','retry','approve','not-now','merge')),\n phase TEXT NOT NULL CHECK (phase IN ('offer','yes','cancel')),\n task_id TEXT NOT NULL,\n run INTEGER,\n digest TEXT NOT NULL,\n created_at TEXT NOT NULL,\n expires_at TEXT NOT NULL,\n consumed_at TEXT\n);\nCREATE INDEX IF NOT EXISTS chat_decide_action_message ON chat_decide_action (channel, chat, message);\nCREATE TABLE IF NOT EXISTS chat_decide_prompt (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n channel TEXT NOT NULL,\n binding INTEGER NOT NULL,\n chat TEXT NOT NULL,\n task_id TEXT NOT NULL,\n run INTEGER NOT NULL,\n digest TEXT NOT NULL,\n message TEXT,\n created_at TEXT NOT NULL,\n expires_at TEXT NOT NULL,\n consumed_at TEXT\n);\nCREATE INDEX IF NOT EXISTS chat_decide_prompt_open ON chat_decide_prompt (channel, binding, consumed_at);\n";
83
83
  export type MateAsk = {
84
84
  turn: number;
@@ -152,7 +152,7 @@ export type SealedLedgerEntry = LedgerEntry & {
152
152
  hash: string;
153
153
  } | null;
154
154
  };
155
- export declare const SCHEMA_VERSION = 115;
155
+ export declare const SCHEMA_VERSION = 116;
156
156
  /** v115: the tables migrateToV115 drops. */
157
157
  export declare const V115_DROPPED_TABLES: readonly string[];
158
158
  /**
@@ -180,7 +180,10 @@ export declare const V115_DROPPED_TABLES: readonly string[];
180
180
  * the routine was approved and running). Its other changes add a column or
181
181
  * settle rows in place; a database whose removed features still held a hold
182
182
  * to lift or place changes that table's rows and is refused, so it takes the
183
- * separate procedure.
183
+ * separate procedure. v116 is the next declared exception: every row of the 70 old
184
+ * per-app chat tables moves into the shared chat tables keyed by provider, in one
185
+ * transaction that checks each count before the old tables are dropped; the
186
+ * rehearsal checks each moved table's rows arrived (HISTORY_RULES).
184
187
  */
185
188
  export declare const UPDATE_SAFE_MIGRATIONS: readonly number[];
186
189
  /** Whether a database settled at `version` reaches this build's schema through update-safe migrations alone. */
@@ -778,14 +781,6 @@ export type FlowTriggerRow = {
778
781
  updatedAt: string;
779
782
  };
780
783
  export type FlowEventOutcome = "created" | "ok" | "fail" | "moved" | "approved" | "sent-back" | "cancelled";
781
- /** The one task a card is about: a task its confirmation created (a new
782
- * task, a revision), else the task it names (and, for feedback on a result,
783
- * that result). Null for a card about no single task. A pointer for
784
- * replies, never an authority. */
785
- export declare function proposalTaskOf(proposal: MateProposal | null): {
786
- task: string;
787
- run: number | null;
788
- } | null;
789
784
  export type MateTurn = {
790
785
  id: number;
791
786
  approver: string;
@@ -862,23 +857,6 @@ type NotificationInput = {
862
857
  /** v83: one person's notification — only their own phone, chats and browsers get it; no channel-wide webhook does. */
863
858
  recipient?: string;
864
859
  };
865
- /**
866
- * Task lifecycle updates (Telegram task updates, 2026-09-16): the CLOSED
867
- * vocabulary of routine progress facts the shared mutations record beside
868
- * the change that made them true. None carries a push class — they are
869
- * digest-eligible progress, never a page — and every one is project-bound
870
- * through the task it names. A decision, incident, gap, stall, publication
871
- * or merge page keeps its own producer; nothing here repeats one.
872
- */
873
- export declare const LIFECYCLE_KINDS: readonly ["task-filed", "scope-approved", "approval-withdrawn", "task-held", "task-released", "task-queued", "task-requeued", "task-cancelled", "run-started", "run-phase", "check-progress", "run-finished", "run-stopping", "run-stopped", "run-resumed", "review-requested", "review-finished", "acceptance-evidence", "acceptance-ready"];
874
- export type LifecycleKind = (typeof LIFECYCLE_KINDS)[number];
875
- /** Every lifecycle dedupe key starts here: `life:<kind>:<identity>:<ordinal>`. */
876
- export declare const LIFECYCLE_KEY_PREFIX = "life:";
877
- /** A progress fact, told apart by its durable key — never by display text. */
878
- export declare function isLifecycleNotification(row: Pick<Notification, "dedupeKey">): boolean;
879
- /** Only known progress producers can repaint a card. Decisions and urgent
880
- * incidents keep their own alerts; a routine retry updates its saved attempt. */
881
- export declare function isTelegramProgressNotification(row: Pick<Notification, "dedupeKey" | "kind" | "pushClass" | "run">): boolean;
882
860
  /** A fact that wants a person, durably. */
883
861
  export type Notification = {
884
862
  id: number;
@@ -3985,6 +3963,8 @@ export declare class Store {
3985
3963
  resolveEpisodes(prefix: string, now: Date): number;
3986
3964
  notificationById(id: number): Notification | null;
3987
3965
  notificationsAfter(id: number, limit?: number): Notification[];
3966
+ /** What landed before a pairing (and at or before `through`) and still wants that person (WANTED_BEFORE_PAIRING). */
3967
+ notificationsWantedBefore(created: string, through: number, limit?: number): Notification[];
3988
3968
  listNotifications(only?: "pending" | "all"): Notification[];
3989
3969
  /**
3990
3970
  * Close a gap's notification episode. Called when its capability verifies:
@@ -4791,7 +4771,9 @@ export declare class Store {
4791
4771
  resolveIncident(id: number, by: string, now: Date): boolean;
4792
4772
  /** The body, for callers already holding the transaction (requeueTask). */
4793
4773
  private resolveIncidentLocked;
4794
- /** Mint a pairing code's record. The code itself was shown once; this is its hash. */
4774
+ /** The shared chat core, bound to Telegram: the same pairing, rooms and worker rules every chat app keeps. */
4775
+ telegramChat(): ChatMessages;
4776
+ /** Mint a pairing code's record. The code itself was shown once; this is its hash. A Telegram code works on its bot. */
4795
4777
  createTelegramPairing(pairing: {
4796
4778
  codeHash: string;
4797
4779
  approver: string;
@@ -4799,14 +4781,15 @@ export declare class Store {
4799
4781
  ttlMs: number;
4800
4782
  }, now: Date): void;
4801
4783
  /**
4802
- * Consume a pairing code and create the binding, as one transaction.
4784
+ * Consume a pairing code and create the binding, as one transaction, by the rules every chat app shares
4785
+ * (ChatCore.consumePairing): a replay of the very update that paired finds its finished binding.
4803
4786
  *
4804
- * The conditional UPDATE is the consumption: exactly one caller ever sees
4805
- * `changes = 1`, however many pollers race. A replay of the very update
4806
- * that paired (Telegram redelivers) recognizes the finished binding
4807
- * instead of failing. Success invalidates every other outstanding code —
4808
- * a code that was minted and superseded must not still open a door — and
4809
- * the partial unique index enforces one live binding per bot.
4787
+ * A person's FIRST pairing starts from now (Telegram task updates): every ROUTINE fact already in the outbox is
4788
+ * history for this destination — settled here, in the pairing's own transaction, with a receipt that says it was
4789
+ * skipped, never sent as a backlog to a phone that just arrived. The skip is explicit: no delivered_at, no attempt,
4790
+ * only the `skipped:` receipt — a message no phone received is never reported as delivered (see TELEGRAM_UNSETTLED).
4791
+ * An open decision or an attention-class fact still wants a person and stays pending. A re-pairing after a
4792
+ * revocation keeps the older promise instead: what no phone ever received still waits for whenever pairing happens.
4810
4793
  */
4811
4794
  consumeTelegramPairing(attempt: {
4812
4795
  codeHash: string;
@@ -4825,13 +4808,7 @@ export declare class Store {
4825
4808
  /** The live team-conversation row for one chat, group or private. */
4826
4809
  telegramTeamChat(botId: string, chatId: string): TelegramTeamChat | null;
4827
4810
  listTelegramTeamChats(botId: string): TelegramTeamChat[];
4828
- /**
4829
- * Point a chat at a team conversation: an earlier choice for the same chat
4830
- * is revoked in the same transaction, and delivery starts from now — the
4831
- * conversation's history is read in the console, never replayed into a
4832
- * chat that just arrived. A group already following another conversation
4833
- * elsewhere, or a conversation already followed by another group, refuses.
4834
- */
4811
+ /** Point a chat at a team conversation (ChatCore.bindRoom: the same rule in every chat app). */
4835
4812
  bindTelegramTeamChat(args: {
4836
4813
  botId: string;
4837
4814
  chatId: string;
@@ -4850,11 +4827,9 @@ export declare class Store {
4850
4827
  /** Forward only: a cursor never moves back, and a revoked row keeps its last position. */
4851
4828
  advanceTelegramTeamCursor(id: number, messageId: number): boolean;
4852
4829
  /**
4853
- * Every live binding for a bot, oldest first — and only while each
4854
- * approver's credential generation still matches. A rotation that
4855
- * somehow missed the sweep reads as no binding at all, which is the
4856
- * failure direction that fails closed. Several teammates may each hold
4857
- * one (v72); nothing here ranks them.
4830
+ * Every live binding for a bot, oldest first — and only while each approver's credential generation still matches.
4831
+ * A rotation that somehow missed the sweep reads as no binding at all, which is the failure direction that fails
4832
+ * closed. Several teammates may each hold one (v72); nothing here ranks them.
4858
4833
  */
4859
4834
  liveTelegramBindings(botId: string): TelegramBinding[];
4860
4835
  /** The live binding one Telegram user holds with a bot, if any. */
@@ -4868,130 +4843,41 @@ export declare class Store {
4868
4843
  /** Revoke every live binding one person holds with a bot, and everything
4869
4844
  * those chats could still do. Teammates' bindings are untouched. */
4870
4845
  unpairTelegram(botId: string, by: string, now: Date): boolean;
4871
- createTelegramAction(action: {
4872
- token: string;
4873
- binding: number;
4874
- decision: number;
4875
- optionId: string;
4876
- phase: "choose" | "confirm" | "cancel";
4877
- chatId: string;
4878
- messageId?: string;
4879
- ttlMs?: number;
4880
- /** Binds an irreversible confirmation to the EXACT note it showed. */
4881
- noteDigest?: string;
4882
- }, now: Date): void;
4883
- /** Which decision an outbound Telegram message carried. Recorded after the
4884
- * send returns its id; a send whose record was lost routes nothing. */
4885
- recordTelegramDecisionMessage(binding: number, chatId: string, messageId: string, decision: number, now: Date): void;
4886
- /** The decision behind an exact replied-to message, or nothing. Never "the latest". */
4887
- decisionForTelegramMessage(binding: number, chatId: string, messageId: string): number | null;
4888
- /** The one live, unexpired draft for a decision, if any. */
4889
- liveNoteDraft(binding: number, decision: number, now: Date): {
4890
- id: number;
4891
- note: string;
4892
- updateId: number;
4893
- state: string;
4894
- } | null;
4895
- /**
4896
- * Persist a validated note as the live draft. A newer update SUPERSEDES
4897
- * the old draft — drafts are immutable, and only a GREATER update_id may
4898
- * replace one, so out-of-order delivery cannot resurrect an older note
4899
- * (Codex free-text review, state machine). Returns false when an older
4900
- * or equal update tried.
4901
- */
4902
- saveNoteDraft(draft: {
4903
- binding: number;
4904
- decision: number;
4905
- updateId: number;
4906
- messageId: string;
4907
- replyTo: string;
4908
- note: string;
4909
- }, now: Date, ttlMs?: number): boolean;
4910
- /** Move a draft between states; the caller owns the transaction story. */
4911
- setNoteDraftState(id: number, state: "pending" | "armed" | "superseded" | "consumed" | "discarded"): void;
4912
- createTelegramFlowActions(at: {
4913
- binding: number;
4914
- chatId: string;
4915
- card: number;
4916
- entry: number;
4917
- }, actions: readonly {
4918
- token: string;
4919
- action: TelegramFlowAction["action"];
4920
- }[], now: Date, days?: number): void;
4921
- getTelegramFlowAction(token: string): TelegramFlowAction | null;
4922
- placeTelegramFlowActions(tokens: readonly string[], messageId: string): void;
4923
- /** Retire every button (and prompt) for one visit of a card: it was decided, or its draft replaced. */
4924
- retireTelegramFlowVisit(card: number, entry: number, now: Date): void;
4925
- recordTelegramFlowPrompt(prompt: TelegramFlowPrompt, now: Date, hours?: number): void;
4926
- /** The live prompt a message replies to, if any. */
4927
- telegramFlowPrompt(chatId: string, messageId: string, now: Date): TelegramFlowPrompt | null;
4846
+ createTelegramAction(...args: Parameters<ChatMessages["createDecisionAction"]>): ReturnType<ChatMessages["createDecisionAction"]>;
4847
+ recordTelegramDecisionMessage(...args: Parameters<ChatMessages["recordDecisionMessage"]>): ReturnType<ChatMessages["recordDecisionMessage"]>;
4848
+ decisionForTelegramMessage(...args: Parameters<ChatMessages["decisionForMessage"]>): ReturnType<ChatMessages["decisionForMessage"]>;
4849
+ liveNoteDraft(...args: Parameters<ChatMessages["liveNoteDraft"]>): ReturnType<ChatMessages["liveNoteDraft"]>;
4850
+ saveNoteDraft(...args: Parameters<ChatMessages["saveNoteDraft"]>): ReturnType<ChatMessages["saveNoteDraft"]>;
4851
+ setNoteDraftState(...args: Parameters<ChatMessages["setNoteDraftState"]>): ReturnType<ChatMessages["setNoteDraftState"]>;
4852
+ createTelegramFlowActions(...args: Parameters<ChatMessages["createFlowActions"]>): ReturnType<ChatMessages["createFlowActions"]>;
4853
+ getTelegramFlowAction(...args: Parameters<ChatMessages["flowAction"]>): ReturnType<ChatMessages["flowAction"]>;
4854
+ placeTelegramFlowActions(...args: Parameters<ChatMessages["placeFlowActions"]>): ReturnType<ChatMessages["placeFlowActions"]>;
4855
+ retireTelegramFlowVisit(...args: Parameters<ChatMessages["retireFlowVisit"]>): ReturnType<ChatMessages["retireFlowVisit"]>;
4856
+ recordTelegramFlowPrompt(...args: Parameters<ChatMessages["recordFlowPrompt"]>): ReturnType<ChatMessages["recordFlowPrompt"]>;
4857
+ telegramFlowPrompt(...args: Parameters<ChatMessages["flowPrompt"]>): ReturnType<ChatMessages["flowPrompt"]>;
4928
4858
  /** What one visit sent: recorded once, the first time (a later pass finds it kept). */
4929
4859
  recordFlowSend(row: Omit<FlowSendRow, "createdAt">, now: Date): boolean;
4930
4860
  flowSend(card: number, entry: number): FlowSendRow | null;
4931
4861
  /** Every visit's send for a card, newest first: what the card shows it sent. */
4932
4862
  flowSends(card: number): FlowSendRow[];
4933
- createTelegramFlowChoices(at: {
4934
- binding: number;
4935
- chatId: string;
4936
- card: number;
4937
- entry: number;
4938
- }, choices: readonly {
4939
- token: string;
4940
- choice: number;
4941
- label: string;
4942
- }[], now: Date, days?: number): void;
4943
- getTelegramFlowChoice(token: string): TelegramFlowChoice | null;
4944
- placeTelegramFlowChoices(tokens: readonly string[], messageId: string): void;
4945
- /** Retire every choice button for one visit of a card (and its reply prompt): it was chosen, or the card moved on. */
4863
+ createTelegramFlowChoices(...args: Parameters<ChatMessages["createFlowChoices"]>): ReturnType<ChatMessages["createFlowChoices"]>;
4864
+ getTelegramFlowChoice(...args: Parameters<ChatMessages["flowChoice"]>): ReturnType<ChatMessages["flowChoice"]>;
4865
+ placeTelegramFlowChoices(...args: Parameters<ChatMessages["placeFlowChoices"]>): ReturnType<ChatMessages["placeFlowChoices"]>;
4946
4866
  /** A choice was made (or the card moved on): every option button, reply prompt and "Use this as your note?" for that
4947
- * visit is spent, in Telegram and in every other chat app, whichever place it was made in. */
4867
+ * visit is spent, in every chat app, whichever place it was made in. */
4948
4868
  retireFlowChoices(card: number, entry: number, now: Date): void;
4949
- createTelegramQuestionActions(at: {
4950
- binding: number;
4951
- chatId: string;
4952
- question: number;
4953
- }, choices: readonly {
4954
- token: string;
4955
- choice: string | null;
4956
- }[], now: Date, days?: number): void;
4957
- getTelegramQuestionAction(token: string): {
4958
- token: string;
4959
- binding: number;
4960
- question: number;
4961
- choice: string | null;
4962
- chatId: string;
4963
- messageId: string | null;
4964
- expiresAt: string;
4965
- consumedAt: string | null;
4966
- } | null;
4967
- placeTelegramQuestionActions(tokens: readonly string[], messageId: string): void;
4968
- /** Retire every button and prompt for a question: it was answered (anywhere). */
4969
- retireTelegramQuestion(question: number, now: Date): void;
4970
- recordTelegramQuestionPrompt(prompt: {
4971
- chatId: string;
4972
- messageId: string;
4973
- binding: number;
4974
- question: number;
4975
- }, now: Date, hours?: number): void;
4976
- telegramQuestionPrompt(chatId: string, messageId: string, now: Date): {
4977
- chatId: string;
4978
- messageId: string;
4979
- binding: number;
4980
- question: number;
4981
- } | null;
4982
- getTelegramAction(token: string): TelegramAction | null;
4983
- /**
4984
- * Kill every live confirm/cancel challenge on a decision. Cancel means
4985
- * cancelled: a confirm that survived its own cancellation would be an
4986
- * irreversible choice still armed after the person said stop.
4987
- */
4988
- consumeTelegramChallenges(decision: number, now: Date): void;
4989
- /** Consume once. False means somebody already did, or it expired — either way, no. */
4990
- consumeTelegramAction(token: string, now: Date): boolean;
4991
- /** Stamp the message a choose-action's keyboard actually landed on. */
4992
- placeTelegramActions(tokens: readonly string[], messageId: string): void;
4993
- /**
4994
- * Take or renew the bridge's poll lease. One live poller per bot: cron
4869
+ createTelegramQuestionActions(...args: Parameters<ChatMessages["createQuestionActions"]>): ReturnType<ChatMessages["createQuestionActions"]>;
4870
+ getTelegramQuestionAction(...args: Parameters<ChatMessages["questionAction"]>): ReturnType<ChatMessages["questionAction"]>;
4871
+ placeTelegramQuestionActions(...args: Parameters<ChatMessages["placeQuestionActions"]>): ReturnType<ChatMessages["placeQuestionActions"]>;
4872
+ retireTelegramQuestion(...args: Parameters<ChatMessages["retireQuestion"]>): ReturnType<ChatMessages["retireQuestion"]>;
4873
+ recordTelegramQuestionPrompt(...args: Parameters<ChatMessages["recordQuestionPrompt"]>): ReturnType<ChatMessages["recordQuestionPrompt"]>;
4874
+ telegramQuestionPrompt(...args: Parameters<ChatMessages["questionPrompt"]>): ReturnType<ChatMessages["questionPrompt"]>;
4875
+ getTelegramAction(...args: Parameters<ChatMessages["decisionAction"]>): ReturnType<ChatMessages["decisionAction"]>;
4876
+ consumeTelegramChallenges(...args: Parameters<ChatMessages["consumeChallenges"]>): ReturnType<ChatMessages["consumeChallenges"]>;
4877
+ consumeTelegramAction(...args: Parameters<ChatMessages["consumeDecisionAction"]>): ReturnType<ChatMessages["consumeDecisionAction"]>;
4878
+ placeTelegramActions(...args: Parameters<ChatMessages["placeDecisionActions"]>): ReturnType<ChatMessages["placeDecisionActions"]>;
4879
+ /**
4880
+ * Take or renew the bridge's poll lease (ChatCore.acquire). One live poller per bot: cron
4995
4881
  * overlapping a follower gets `bridge-busy`, an expired holder is taken
4996
4882
  * over at the next generation, and the cursor rides the lease so a stale
4997
4883
  * generation can neither poll nor move it.
@@ -5731,10 +5617,7 @@ export declare class Store {
5731
5617
  reason: string;
5732
5618
  }[];
5733
5619
  } | null;
5734
- /** A Telegram message this bot sent that showed one task (v79): a reply to
5735
- * it is about that task (and that result, when it showed one). A message
5736
- * edited to show something else forgets it. */
5737
- recordTelegramTaskMessage(binding: TelegramBinding, messageId: string, taskId: string | null, run: number | null, now: Date): void;
5620
+ recordTelegramTaskMessage(...args: Parameters<ChatMessages["recordTaskMessage"]>): ReturnType<ChatMessages["recordTaskMessage"]>;
5738
5621
  /** The approver's live personal threads that have messages, most recent
5739
5622
  * first — the chat list. Team conversations list themselves. */
5740
5623
  listMateThreads(approver: string, limit?: number): MateThreadSummary[];
@@ -6379,15 +6262,9 @@ export declare class Store {
6379
6262
  recordProjectConcurrency(by: string, repo: string, before: number, after: number, now: Date): void;
6380
6263
  /** Review 827: a project's demo URL changed (`off` when it has none). */
6381
6264
  recordProjectDemo(by: string, repo: string, before: string | null, after: string | null, now: Date): void;
6382
- /** Forward only, and only under the live generation. A stale poller moves nothing. */
6383
- /** v98: an update Telegram pushed, kept until the bridge applies it; false when it's already kept or applied. */
6384
- queueTelegramUpdate(botId: string, updateId: number, payload: string, now: Date): boolean;
6385
- /** v98: pushed updates waiting for the bridge, oldest first. */
6386
- telegramInbox(botId: string, limit: number): {
6387
- updateId: number;
6388
- payload: string;
6389
- }[];
6390
- dropTelegramInbox(updateId: number): void;
6265
+ queueTelegramUpdate(...args: Parameters<ChatMessages["queueUpdate"]>): ReturnType<ChatMessages["queueUpdate"]>;
6266
+ telegramInbox(...args: Parameters<ChatMessages["inbox"]>): ReturnType<ChatMessages["inbox"]>;
6267
+ dropTelegramInbox(...args: Parameters<ChatMessages["dropInbox"]>): ReturnType<ChatMessages["dropInbox"]>;
6391
6268
  /** v98: where Telegram pushes this bot's updates (null: the bridge asks for them), and what's wrong, if anything. */
6392
6269
  setTelegramPush(botId: string, state: {
6393
6270
  url: string | null;
@@ -6398,164 +6275,43 @@ export declare class Store {
6398
6275
  problem: string | null;
6399
6276
  at: string | null;
6400
6277
  } | null;
6278
+ /** Forward only, and only under the live generation. A stale poller moves nothing. */
6401
6279
  advanceBridgeCursor(botId: string, owner: string, generation: number, cursor: number, now: Date): boolean;
6402
- /** True if this update has not been applied before. The PRIMARY KEY is the idempotency. */
6403
- markTelegramUpdateApplied(updateId: number, result: string, now: Date): boolean;
6404
- /** Persist one ordinary message before its update is acknowledged. The caller's transaction also marks the update applied. */
6405
- enqueueTelegramConversation(row: {
6406
- binding: TelegramBinding;
6407
- updateId: number;
6408
- messageId: string;
6409
- replyTo: string | null;
6410
- request: string;
6411
- text: string;
6412
- context: string | null;
6413
- taskId: string | null;
6414
- sourceRun: number | null;
6415
- }, now: Date): number;
6416
- /** Whether a message from this chat is already waiting on, or being answered from, this bot message (a tapped question). */
6417
- telegramConversationWaitingOn(binding: number, messageId: string): boolean;
6418
- getTelegramConversation(id: number): TelegramConversation | null;
6419
- listTelegramConversations(botId: string): TelegramConversation[];
6420
- /**
6421
- * Claim the oldest message that still needs a turn: queued, or running
6422
- * under a claim that lapsed (a crash mid-turn), and not deferred past now.
6423
- * One at a time per bot — the mate runs one turn per approver anyway.
6424
- */
6425
- claimTelegramConversation(botId: string, owner: string, ttlMs: number, now: Date, only?: "turns" | "replies"): TelegramConversation | null;
6426
- /** Extend a held claim; false means it lapsed and somebody else may hold the row. */
6427
- renewTelegramConversation(id: number, owner: string, ttlMs: number, now: Date): boolean;
6428
- /**
6429
- * Bind the session a turn is about to be dispatched under, BEFORE the
6430
- * dispatch: the engine receipts the request inside that session, so a
6431
- * later attempt — after a crash, even after the session was ended and
6432
- * replaced from the console — reads the receipt where it was written
6433
- * instead of resolving today's session and finding nothing there.
6434
- */
6435
- bindTelegramConversationSession(id: number, owner: string, session: number): boolean;
6436
- /** Bind the admitted turn to its row as soon as the engine's receipt names it. */
6437
- bindTelegramConversationTurn(id: number, owner: string, session: number, turn: number): boolean;
6438
- /**
6439
- * Settle a claimed row: done or failed with its outcome word, or back to
6440
- * queued for a later attempt (a busy engine). Only the claim holder may;
6441
- * a lapsed claim settles nothing, so a reclaimer's outcome stands.
6442
- */
6443
- finishTelegramConversation(id: number, owner: string, result: {
6444
- state: "done" | "failed";
6445
- outcome: string;
6446
- replyMessageId?: string | null;
6447
- } | {
6448
- state: "queued";
6449
- outcome: string;
6450
- nextAttemptAt: string;
6451
- }, now: Date): boolean;
6452
- /**
6453
- * Replies the assistant wrote that still have not reached the person
6454
- * `since` ago or longer (status and the console show them with a Retry):
6455
- * the message's row, whose it is, when the oldest unsent part was
6456
- * written, and the last send error.
6457
- */
6458
- unsentTelegramReplies(botId: string | null, approver: string | null, since: Date): {
6459
- conversation: number;
6460
- approver: string;
6461
- since: string;
6462
- error: string | null;
6463
- }[];
6464
- /** Send unsent replies on the next bridge pass instead of waiting out their backoff; returns how many. */
6465
- retryTelegramReplies(approver: string | null, now: Date): number;
6466
- /**
6467
- * Persist the whole outbound half of a turn — every reply part and every
6468
- * card, with the cards' tokens already minted — in one transaction, BEFORE
6469
- * any send. Only the claim holder may, and only once: a row that already
6470
- * has parts keeps them (a retry resumes, never re-plans). The turn's
6471
- * identity rides the row too, so the parts answer to exactly that turn.
6472
- */
6473
- planTelegramConversationParts(id: number, owner: string, turn: {
6474
- session: number;
6475
- turn: number;
6476
- }, parts: readonly TelegramConversationPartPlan[], now: Date): boolean;
6477
- listTelegramConversationParts(conversation: number): TelegramConversationPart[];
6478
- /**
6479
- * Settle one send attempt under the row's claim. A confirmed message id
6480
- * is the only success: the part is sent, and a reply part's id becomes
6481
- * the row's reply id. Anything else leaves the part pending with its
6482
- * attempt counted, its error named, its next attempt scheduled, and —
6483
- * when the answer was lost rather than refused — its uncertainty counted.
6484
- * A lapsed claim settles nothing, so a reclaimer's outcome stands.
6485
- */
6486
- settleTelegramConversationPart(conversation: number, ordinal: number, owner: string, outcome: {
6487
- ok: true;
6488
- messageId: string;
6489
- } | {
6490
- ok: false;
6491
- error: string;
6492
- uncertain: boolean;
6493
- retryAt: string;
6494
- }, now: Date): boolean;
6495
- /** A card whose proposal no longer waits (confirmed or dismissed from another surface, or gone) is moot: dropped with the reason, never sent. */
6496
- dropTelegramConversationPart(conversation: number, ordinal: number, owner: string, reason: string, now: Date): boolean;
6497
- /** The exact task/run bindings of one outbound message this bot sent: a
6498
- * plain fact names one, a digest part may name several, (v64) a confirmed
6499
- * result image names its exact task and run, the lead's reply names the
6500
- * task its turn was about, a card names its task, and (v79) a status
6501
- * message names the task it showed. */
6502
- telegramMessageBindings(binding: TelegramBinding, messageId: string): {
6503
- taskId: string | null;
6504
- taskRef: number | null;
6505
- run: number | null;
6506
- project: string | null;
6507
- }[];
6508
- createTelegramProposalAction(action: {
6509
- token: string;
6510
- binding: number;
6511
- proposal: number;
6512
- phase: TelegramProposalAction["phase"];
6513
- chatId: string;
6514
- messageId?: string;
6515
- ttlMs?: number;
6516
- }, now: Date): void;
6517
- getTelegramProposalAction(token: string): TelegramProposalAction | null;
6518
- /** Consume once. False means somebody already did, or it expired. */
6519
- consumeTelegramProposalAction(token: string, now: Date): boolean;
6520
- /** Kill every live token on a proposal — after it resolves, or when a challenge is cancelled. */
6521
- consumeTelegramProposalActions(proposal: number, now: Date, phases?: readonly TelegramProposalAction["phase"][]): void;
6522
- /** Stamp the message a card's keyboard actually landed on. */
6523
- placeTelegramProposalActions(tokens: readonly string[], messageId: string): void;
6524
- telegramDestination(binding: TelegramBinding): string;
6525
- /** A progress card belongs to one builder result, including its root review.
6526
- * Do not combine planners, correction children, or separate build attempts. */
6527
- telegramProgressRun(row: Pick<Notification, "taskRef" | "run">): Run | null;
6528
- /** Reuse a confirmed message in this exact destination. A mixed digest,
6529
- * decision, image, or message naming another attempt is never editable. The
6530
- * outbound history survives a restart even if the final receipt was lost. */
6531
- telegramProgressMessage(binding: TelegramBinding, result: Run): string | null;
6532
- /** The existing outbox, with a separate receipt for this exact pairing. */
6533
- claimTelegramDeliveries(binding: TelegramBinding, owner: string, ttlMs: number, now: Date, only?: "all" | "urgent"): TelegramDelivery[];
6280
+ markTelegramUpdateApplied(...args: Parameters<ChatMessages["markUpdateApplied"]>): ReturnType<ChatMessages["markUpdateApplied"]>;
6281
+ enqueueTelegramConversation(...args: Parameters<ChatMessages["enqueueMessage"]>): ReturnType<ChatMessages["enqueueMessage"]>;
6282
+ telegramConversationWaitingOn(...args: Parameters<ChatMessages["messageWaitingOn"]>): ReturnType<ChatMessages["messageWaitingOn"]>;
6283
+ getTelegramConversation(...args: Parameters<ChatMessages["getMessage"]>): ReturnType<ChatMessages["getMessage"]>;
6284
+ listTelegramConversations(...args: Parameters<ChatMessages["listMessages"]>): ReturnType<ChatMessages["listMessages"]>;
6285
+ claimTelegramConversation(...args: Parameters<ChatMessages["claimMessage"]>): ReturnType<ChatMessages["claimMessage"]>;
6286
+ renewTelegramConversation(...args: Parameters<ChatMessages["renewMessage"]>): ReturnType<ChatMessages["renewMessage"]>;
6287
+ bindTelegramConversationSession(...args: Parameters<ChatMessages["bindMessageSession"]>): ReturnType<ChatMessages["bindMessageSession"]>;
6288
+ bindTelegramConversationTurn(...args: Parameters<ChatMessages["bindMessageTurn"]>): ReturnType<ChatMessages["bindMessageTurn"]>;
6289
+ finishTelegramConversation(...args: Parameters<ChatMessages["finishMessage"]>): ReturnType<ChatMessages["finishMessage"]>;
6290
+ unsentTelegramReplies(...args: Parameters<ChatMessages["unsentReplies"]>): ReturnType<ChatMessages["unsentReplies"]>;
6291
+ retryTelegramReplies(...args: Parameters<ChatMessages["retryReplies"]>): ReturnType<ChatMessages["retryReplies"]>;
6292
+ planTelegramConversationParts(...args: Parameters<ChatMessages["planReplyParts"]>): ReturnType<ChatMessages["planReplyParts"]>;
6293
+ listTelegramConversationParts(...args: Parameters<ChatMessages["replyParts"]>): ReturnType<ChatMessages["replyParts"]>;
6294
+ settleTelegramConversationPart(...args: Parameters<ChatMessages["settleReplyPart"]>): ReturnType<ChatMessages["settleReplyPart"]>;
6295
+ dropTelegramConversationPart(...args: Parameters<ChatMessages["dropReplyPart"]>): ReturnType<ChatMessages["dropReplyPart"]>;
6296
+ telegramMessageBindings(...args: Parameters<ChatMessages["messageBindings"]>): ReturnType<ChatMessages["messageBindings"]>;
6297
+ createTelegramProposalAction(...args: Parameters<ChatMessages["createProposalAction"]>): ReturnType<ChatMessages["createProposalAction"]>;
6298
+ getTelegramProposalAction(...args: Parameters<ChatMessages["proposalAction"]>): ReturnType<ChatMessages["proposalAction"]>;
6299
+ consumeTelegramProposalAction(...args: Parameters<ChatMessages["consumeProposalAction"]>): ReturnType<ChatMessages["consumeProposalAction"]>;
6300
+ consumeTelegramProposalActions(...args: Parameters<ChatMessages["consumeProposalActions"]>): ReturnType<ChatMessages["consumeProposalActions"]>;
6301
+ placeTelegramProposalActions(...args: Parameters<ChatMessages["placeProposalActions"]>): ReturnType<ChatMessages["placeProposalActions"]>;
6302
+ telegramDestination(...args: Parameters<ChatMessages["destination"]>): ReturnType<ChatMessages["destination"]>;
6303
+ telegramProgressRun(...args: Parameters<ChatMessages["progressRun"]>): ReturnType<ChatMessages["progressRun"]>;
6304
+ telegramProgressMessage(...args: Parameters<ChatMessages["progressMessage"]>): ReturnType<ChatMessages["progressMessage"]>;
6305
+ claimTelegramDeliveries(...args: Parameters<ChatMessages["claimDeliveries"]>): ReturnType<ChatMessages["claimDeliveries"]>;
6534
6306
  telegramRetryAt(botId: string): string;
6535
6307
  deferTelegram(botId: string, until: string): void;
6536
- /** Synchronous final fence, called AFTER each asynchronous enrollment read. */
6537
- telegramDeliveryProblem(row: TelegramDelivery, binding: TelegramBinding, owner: string, projects: readonly string[], now: Date, batch?: readonly number[]): string | null;
6538
- private telegramClaimHeld;
6539
- /** A confirmed network message remains history even if authority changed
6540
- * while it was in flight. It only binds the OLD destination, never new work. */
6541
- recordTelegramMessage(row: TelegramDelivery, binding: TelegramBinding, messageId: string, now: Date): void;
6542
- /** The newest confirmed message this notification became at one destination, if any. */
6543
- telegramMessageOf(notification: number, destination: string): string | null;
6544
- finalizeTelegramDelivery(row: TelegramDelivery, binding: TelegramBinding, owner: string, outcome: {
6545
- ok: true;
6546
- receipt: string | null;
6547
- } | {
6548
- ok: false;
6549
- error: string;
6550
- retryAt?: string;
6551
- }, now: Date): boolean;
6552
- /** The notifications this pairing holds, each with its delivery state there. */
6553
- telegramDeliveries(binding: TelegramBinding): NotificationReceipt[];
6554
- /** The digest cadence: null everyMs = off. */
6555
- telegramDigest(): TelegramDigest;
6556
- /** Set (or clear, with null) the cadence. Turning it on starts the
6557
- * window NOW — nothing held before the choice is dumped at once. */
6558
- setTelegramDigest(everyMs: number | null, by: string, now: Date): void;
6308
+ telegramDeliveryProblem(...args: Parameters<ChatMessages["deliveryProblem"]>): ReturnType<ChatMessages["deliveryProblem"]>;
6309
+ recordTelegramMessage(...args: Parameters<ChatMessages["recordMessage"]>): ReturnType<ChatMessages["recordMessage"]>;
6310
+ telegramMessageOf(...args: Parameters<ChatMessages["messageOf"]>): ReturnType<ChatMessages["messageOf"]>;
6311
+ finalizeTelegramDelivery(...args: Parameters<ChatMessages["finalizeDelivery"]>): ReturnType<ChatMessages["finalizeDelivery"]>;
6312
+ telegramDeliveries(...args: Parameters<ChatMessages["deliveries"]>): ReturnType<ChatMessages["deliveries"]>;
6313
+ telegramDigest(...args: Parameters<ChatMessages["digest"]>): ReturnType<ChatMessages["digest"]>;
6314
+ setTelegramDigest(...args: Parameters<ChatMessages["setDigest"]>): ReturnType<ChatMessages["setDigest"]>;
6559
6315
  /** How chats reach this person: only when they are needed unless they chose every step. */
6560
6316
  notificationPreference(account: string): NotificationPreference;
6561
6317
  /** Change one person's choice; a digest time is a local HH:MM, or null for no evening digest. */
@@ -6672,7 +6428,7 @@ export declare class Store {
6672
6428
  chatBatchMessageFor(destination: string, taskRef: number, run: number): string | null;
6673
6429
  /** The message now showing this card, and what it shows. */
6674
6430
  setChatCardMessage(id: number, message: string, digest: string): void;
6675
- markTelegramDigestSent(now: Date): void;
6431
+ markTelegramDigestSent(...args: Parameters<ChatMessages["markDigestSent"]>): ReturnType<ChatMessages["markDigestSent"]>;
6676
6432
  /** Routine rows waiting for the next digest: pending, and not urgent.
6677
6433
  * A row the live pairing delivered, or skipped as pre-pairing history,
6678
6434
  * is settled and not waiting. */
@@ -6797,33 +6553,10 @@ export declare class Store {
6797
6553
  * explicit skip, with no delivered timestamp and no attempt, so suppressed
6798
6554
  * history is never reported as a send that happened. */
6799
6555
  export declare const TELEGRAM_SKIPPED_RECEIPT = "skipped:before-pairing";
6800
- /** v83: a notification for another person, settled for this destination without sending. */
6801
- export declare const TELEGRAM_SKIPPED_ELSEWHERE = "skipped:for-another-person";
6802
- /** A met promise the lead made on another chat: reported there, settled here without sending. */
6803
- export declare const TELEGRAM_SKIPPED_OTHER_CHAT = "skipped:for-another-chat";
6804
- /** A fact this person is not messaged about: the lead's work, their own act, or a project they muted. */
6805
- export declare const TELEGRAM_SKIPPED_QUIET = "skipped:quiet";
6806
- /**
6807
- * Why the store itself holds a Telegram delivery back: authority,
6808
- * provenance, ordering, a switched-off channel, or a wait it imposed. A
6809
- * row held for one of these is waiting on policy, not failing on the wire.
6810
- * Every other error recorded on a receipt came from an actual send, and
6811
- * THAT is delivery trouble (`pendingForAttention`). One table, so the
6812
- * fences and the tally can never disagree about the words.
6813
- */
6814
- export declare const TELEGRAM_HOLD_REASONS: Readonly<{
6815
- authority: "Telegram pairing or actor authorization changed";
6816
- destination: "Telegram destination changed";
6817
- claim: "Telegram delivery claim expired or changed";
6818
- rateLimit: "Telegram rate limit is still active";
6819
- resolved: "Notification no longer needs delivery";
6820
- provenance: "Notification has no trusted project provenance";
6821
- installation: "Installation notification requires instance access";
6822
- project: "Notification project is not currently authorized and enrolled";
6823
- task: "Notification task provenance changed";
6824
- order: "Earlier task notification is still undelivered";
6825
- disabled: "Telegram delivery is disabled";
6826
- }>;
6556
+ export { TELEGRAM_HOLD_REASONS, TELEGRAM_SKIPPED_ELSEWHERE, TELEGRAM_SKIPPED_OTHER_CHAT, TELEGRAM_SKIPPED_QUIET };
6557
+ export { isLifecycleNotification, isTelegramProgressNotification, LIFECYCLE_KEY_PREFIX, LIFECYCLE_KINDS, proposalTaskOf, type LifecycleKind };
6558
+ /** A Telegram pairing, in the Telegram adapter's names: the bot is the installation, the user the member, the private chat the channel. */
6559
+ export declare function telegramBindingOf(binding: ChatBinding): TelegramBinding;
6827
6560
  export type WorktreeRow = {
6828
6561
  path: string;
6829
6562
  repo: string;