@primusclaw/personal-agent 0.0.0-stage → 0.1.1

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 (444) hide show
  1. package/dist/LICENSE +37 -0
  2. package/dist/index.js +31875 -0
  3. package/dist/types/approvals/approval-view.d.ts +70 -0
  4. package/dist/types/approvals/click.d.ts +8 -0
  5. package/dist/types/approvals/decide.d.ts +64 -0
  6. package/dist/types/approvals/handler.d.ts +22 -0
  7. package/dist/types/approvals/index.d.ts +9 -0
  8. package/dist/types/approvals/questions.d.ts +36 -0
  9. package/dist/types/approvals/records.d.ts +43 -0
  10. package/dist/types/approvals/sensitive.d.ts +13 -0
  11. package/dist/types/approvals/turn-cards.d.ts +7 -0
  12. package/dist/types/approvals/views.d.ts +67 -0
  13. package/dist/types/assistant/action-handler.d.ts +13 -0
  14. package/dist/types/assistant/actions.d.ts +63 -0
  15. package/dist/types/assistant/auto-reply.d.ts +14 -0
  16. package/dist/types/assistant/board.d.ts +68 -0
  17. package/dist/types/assistant/chat.d.ts +166 -0
  18. package/dist/types/assistant/citation-sources.d.ts +20 -0
  19. package/dist/types/assistant/citations.d.ts +38 -0
  20. package/dist/types/assistant/confirm-outcome.d.ts +11 -0
  21. package/dist/types/assistant/devenv-hide-outcome.d.ts +4 -0
  22. package/dist/types/assistant/events.d.ts +53 -0
  23. package/dist/types/assistant/failures.d.ts +16 -0
  24. package/dist/types/assistant/files.d.ts +37 -0
  25. package/dist/types/assistant/finish.d.ts +8 -0
  26. package/dist/types/assistant/follow.d.ts +75 -0
  27. package/dist/types/assistant/index.d.ts +12 -0
  28. package/dist/types/assistant/informative.d.ts +9 -0
  29. package/dist/types/assistant/item-of.d.ts +2 -0
  30. package/dist/types/assistant/receipt.d.ts +113 -0
  31. package/dist/types/assistant/receipts.d.ts +71 -0
  32. package/dist/types/assistant/say.d.ts +63 -0
  33. package/dist/types/assistant/tracked-stream.d.ts +30 -0
  34. package/dist/types/assistant/turn-in-front.d.ts +25 -0
  35. package/dist/types/assistant/views.d.ts +80 -0
  36. package/dist/types/assistant/watch-clicks.d.ts +34 -0
  37. package/dist/types/assistant/work-clicks.d.ts +53 -0
  38. package/dist/types/assistant/work-handler.d.ts +23 -0
  39. package/dist/types/assistant/work-items.d.ts +66 -0
  40. package/dist/types/branding.d.ts +5 -0
  41. package/dist/types/brief/brief.d.ts +40 -0
  42. package/dist/types/brief/index.d.ts +3 -0
  43. package/dist/types/brief/template.d.ts +8 -0
  44. package/dist/types/capabilities/capability.d.ts +49 -0
  45. package/dist/types/capabilities/command-text.d.ts +11 -0
  46. package/dist/types/capabilities/entries-chat.d.ts +3 -0
  47. package/dist/types/capabilities/entries-notify.d.ts +3 -0
  48. package/dist/types/capabilities/entries-settings.d.ts +3 -0
  49. package/dist/types/capabilities/help.d.ts +24 -0
  50. package/dist/types/capabilities/natural.d.ts +19 -0
  51. package/dist/types/capabilities/phrases.d.ts +42 -0
  52. package/dist/types/capabilities/registry.d.ts +12 -0
  53. package/dist/types/capabilities/sessions-words.d.ts +9 -0
  54. package/dist/types/capabilities/spoken.d.ts +19 -0
  55. package/dist/types/capabilities/visibility.d.ts +32 -0
  56. package/dist/types/claw/credential.d.ts +8 -0
  57. package/dist/types/claw/errors.d.ts +61 -0
  58. package/dist/types/claw/lenient.d.ts +23 -0
  59. package/dist/types/claw/message-text.d.ts +28 -0
  60. package/dist/types/claw/model.d.ts +118 -0
  61. package/dist/types/claw/py-value.d.ts +7 -0
  62. package/dist/types/claw/remote.d.ts +138 -0
  63. package/dist/types/claw/requester-view.d.ts +15 -0
  64. package/dist/types/claw/service-refusal.d.ts +4 -0
  65. package/dist/types/claw/sse.d.ts +12 -0
  66. package/dist/types/claw/started-review.d.ts +7 -0
  67. package/dist/types/claw/work-item.d.ts +25 -0
  68. package/dist/types/commands/agent-args.d.ts +9 -0
  69. package/dist/types/commands/names.d.ts +19 -0
  70. package/dist/types/commands/parse.d.ts +33 -0
  71. package/dist/types/commands/repo.d.ts +17 -0
  72. package/dist/types/config/settings.d.ts +124 -0
  73. package/dist/types/direct-chat/direct-chat.d.ts +73 -0
  74. package/dist/types/direct-chat/index.d.ts +2 -0
  75. package/dist/types/errors.d.ts +15 -0
  76. package/dist/types/feedback/deadline.d.ts +10 -0
  77. package/dist/types/feedback/delivery.d.ts +34 -0
  78. package/dist/types/feedback/exchange.d.ts +19 -0
  79. package/dist/types/feedback/flow.d.ts +36 -0
  80. package/dist/types/feedback/handlers.d.ts +16 -0
  81. package/dist/types/feedback/history.d.ts +20 -0
  82. package/dist/types/feedback/identifiers.d.ts +16 -0
  83. package/dist/types/feedback/index.d.ts +16 -0
  84. package/dist/types/feedback/iso-time.d.ts +2 -0
  85. package/dist/types/feedback/issue-text.d.ts +50 -0
  86. package/dist/types/feedback/log-text.d.ts +13 -0
  87. package/dist/types/feedback/markdown.d.ts +4 -0
  88. package/dist/types/feedback/reporting.d.ts +25 -0
  89. package/dist/types/feedback/scene.d.ts +65 -0
  90. package/dist/types/feedback/service.d.ts +74 -0
  91. package/dist/types/feedback/thumbs.d.ts +59 -0
  92. package/dist/types/feedback/views.d.ts +35 -0
  93. package/dist/types/guardrails/correlation.d.ts +8 -0
  94. package/dist/types/guardrails/guardrails.d.ts +49 -0
  95. package/dist/types/guardrails/index.d.ts +4 -0
  96. package/dist/types/guardrails/operations.d.ts +22 -0
  97. package/dist/types/guardrails/sha256.d.ts +1 -0
  98. package/dist/types/inbound-text/index.d.ts +9 -0
  99. package/dist/types/inbound-text/marked-text.d.ts +20 -0
  100. package/dist/types/inbound-text/quote-block.d.ts +26 -0
  101. package/dist/types/inbound-text/redact.d.ts +8 -0
  102. package/dist/types/inbound-text/when.d.ts +2 -0
  103. package/dist/types/inbound-text/with-links.d.ts +20 -0
  104. package/dist/types/index.d.ts +73 -0
  105. package/dist/types/json.d.ts +5 -0
  106. package/dist/types/language/detect.d.ts +21 -0
  107. package/dist/types/limits/inbound-stats.d.ts +42 -0
  108. package/dist/types/limits/index.d.ts +5 -0
  109. package/dist/types/limits/rate-limiter.d.ts +32 -0
  110. package/dist/types/limits/user-limits.d.ts +18 -0
  111. package/dist/types/limits/wait-words.d.ts +3 -0
  112. package/dist/types/locales/account.d.ts +49 -0
  113. package/dist/types/locales/approval-decisions.d.ts +28 -0
  114. package/dist/types/locales/approval.d.ts +31 -0
  115. package/dist/types/locales/assistant-actions.d.ts +65 -0
  116. package/dist/types/locales/assistant-board.d.ts +14 -0
  117. package/dist/types/locales/assistant-cards.d.ts +81 -0
  118. package/dist/types/locales/assistant-chat.d.ts +13 -0
  119. package/dist/types/locales/assistant-devenv-hide.d.ts +23 -0
  120. package/dist/types/locales/assistant-work-clicks.d.ts +98 -0
  121. package/dist/types/locales/assistant.d.ts +5 -0
  122. package/dist/types/locales/brief.d.ts +29 -0
  123. package/dist/types/locales/catalog.d.ts +24 -0
  124. package/dist/types/locales/claw.d.ts +5 -0
  125. package/dist/types/locales/commands.d.ts +12 -0
  126. package/dist/types/locales/connector-reasons.d.ts +95 -0
  127. package/dist/types/locales/connector-setup.d.ts +20 -0
  128. package/dist/types/locales/feedback.d.ts +75 -0
  129. package/dist/types/locales/group.d.ts +33 -0
  130. package/dist/types/locales/guardrails.d.ts +22 -0
  131. package/dist/types/locales/help-lead.d.ts +15 -0
  132. package/dist/types/locales/index.d.ts +16 -0
  133. package/dist/types/locales/lang.d.ts +9 -0
  134. package/dist/types/locales/limits.d.ts +19 -0
  135. package/dist/types/locales/link.d.ts +40 -0
  136. package/dist/types/locales/observe.d.ts +113 -0
  137. package/dist/types/locales/proactive-lines.d.ts +12 -0
  138. package/dist/types/locales/proactive.d.ts +62 -0
  139. package/dist/types/locales/remote-agents.d.ts +216 -0
  140. package/dist/types/locales/remote-leads.d.ts +13 -0
  141. package/dist/types/locales/remote-window-card.d.ts +46 -0
  142. package/dist/types/locales/remote-window.d.ts +21 -0
  143. package/dist/types/locales/remote.d.ts +365 -0
  144. package/dist/types/locales/review-account.d.ts +43 -0
  145. package/dist/types/locales/review-github.d.ts +19 -0
  146. package/dist/types/locales/review-receipt.d.ts +45 -0
  147. package/dist/types/locales/review-request.d.ts +21 -0
  148. package/dist/types/locales/review-start.d.ts +46 -0
  149. package/dist/types/locales/routing.d.ts +21 -0
  150. package/dist/types/locales/sessions.d.ts +38 -0
  151. package/dist/types/locales/settings.d.ts +46 -0
  152. package/dist/types/locales/steps.d.ts +42 -0
  153. package/dist/types/locales/transparency.d.ts +18 -0
  154. package/dist/types/locales/turn.d.ts +70 -0
  155. package/dist/types/locales/typed-answer.d.ts +32 -0
  156. package/dist/types/note/note.d.ts +22 -0
  157. package/dist/types/observability/ip-address.d.ts +13 -0
  158. package/dist/types/observability/metrics-catalog.d.ts +17 -0
  159. package/dist/types/observability/security-events.d.ts +26 -0
  160. package/dist/types/observability/security-fields.d.ts +8 -0
  161. package/dist/types/observability/security-log.d.ts +21 -0
  162. package/dist/types/observe/board.d.ts +18 -0
  163. package/dist/types/observe/command.d.ts +6 -0
  164. package/dist/types/observe/index.d.ts +6 -0
  165. package/dist/types/observe/observer.d.ts +45 -0
  166. package/dist/types/observe/suggestions.d.ts +16 -0
  167. package/dist/types/observe/views.d.ts +19 -0
  168. package/dist/types/own.d.ts +9 -0
  169. package/dist/types/plugins/feedback-sink.d.ts +31 -0
  170. package/dist/types/plugins/identity-lookup.d.ts +21 -0
  171. package/dist/types/plugins/index.d.ts +31 -0
  172. package/dist/types/plugins/integrations.d.ts +34 -0
  173. package/dist/types/plugins/key-revoker.d.ts +10 -0
  174. package/dist/types/plugins/model-refusal-policy.d.ts +25 -0
  175. package/dist/types/plugins/route-extension.d.ts +27 -0
  176. package/dist/types/plugins/token-exchange.d.ts +36 -0
  177. package/dist/types/ports/claw/assistant.d.ts +55 -0
  178. package/dist/types/ports/claw/index.d.ts +28 -0
  179. package/dist/types/ports/claw/remote-agents.d.ts +53 -0
  180. package/dist/types/ports/claw/sessions.d.ts +105 -0
  181. package/dist/types/ports/claw/settings.d.ts +62 -0
  182. package/dist/types/ports/claw/work-items.d.ts +32 -0
  183. package/dist/types/ports/clock.d.ts +17 -0
  184. package/dist/types/ports/crypto.d.ts +15 -0
  185. package/dist/types/ports/github.d.ts +97 -0
  186. package/dist/types/ports/index.d.ts +18 -0
  187. package/dist/types/ports/logger.d.ts +19 -0
  188. package/dist/types/ports/metrics.d.ts +21 -0
  189. package/dist/types/ports/random.d.ts +15 -0
  190. package/dist/types/ports/request-scope.d.ts +31 -0
  191. package/dist/types/ports/routing.d.ts +107 -0
  192. package/dist/types/ports/secret-source.d.ts +21 -0
  193. package/dist/types/ports/store/approvals.d.ts +47 -0
  194. package/dist/types/ports/store/assistant.d.ts +104 -0
  195. package/dist/types/ports/store/feedback.d.ts +80 -0
  196. package/dist/types/ports/store/github.d.ts +81 -0
  197. package/dist/types/ports/store/idempotency.d.ts +21 -0
  198. package/dist/types/ports/store/index.d.ts +65 -0
  199. package/dist/types/ports/store/json.d.ts +4 -0
  200. package/dist/types/ports/store/link.d.ts +39 -0
  201. package/dist/types/ports/store/notify.d.ts +28 -0
  202. package/dist/types/ports/store/observe.d.ts +53 -0
  203. package/dist/types/ports/store/onboarding.d.ts +49 -0
  204. package/dist/types/ports/store/people.d.ts +77 -0
  205. package/dist/types/ports/store/policy.d.ts +60 -0
  206. package/dist/types/ports/store/remote.d.ts +114 -0
  207. package/dist/types/ports/store/sessions.d.ts +59 -0
  208. package/dist/types/ports/store/turns.d.ts +30 -0
  209. package/dist/types/ports/surface.d.ts +394 -0
  210. package/dist/types/ports/turn-cards.d.ts +52 -0
  211. package/dist/types/proactive/deliver.d.ts +52 -0
  212. package/dist/types/proactive/deps.d.ts +77 -0
  213. package/dist/types/proactive/events.d.ts +10 -0
  214. package/dist/types/proactive/index.d.ts +6 -0
  215. package/dist/types/proactive/proactive.d.ts +62 -0
  216. package/dist/types/proactive/quiet.d.ts +27 -0
  217. package/dist/types/proactive/release.d.ts +24 -0
  218. package/dist/types/proactive/said-memory.d.ts +21 -0
  219. package/dist/types/proactive/views.d.ts +67 -0
  220. package/dist/types/protocol/claw-api/assistant-events.d.ts +223 -0
  221. package/dist/types/protocol/claw-api/index.d.ts +5 -0
  222. package/dist/types/protocol/claw-api/notifications.d.ts +85 -0
  223. package/dist/types/protocol/claw-api/reviews.d.ts +63 -0
  224. package/dist/types/protocol/claw-api/session-events.d.ts +34 -0
  225. package/dist/types/protocol/claw-api/work-items.d.ts +75 -0
  226. package/dist/types/protocol/remote-agents.d.ts +230 -0
  227. package/dist/types/protocol.d.ts +10 -0
  228. package/dist/types/public-error/classify.d.ts +21 -0
  229. package/dist/types/public-error/index.d.ts +4 -0
  230. package/dist/types/public-error/patterns.d.ts +20 -0
  231. package/dist/types/public-error/public-error-log.d.ts +15 -0
  232. package/dist/types/public-error/public-errors.d.ts +20 -0
  233. package/dist/types/remote/actions.d.ts +36 -0
  234. package/dist/types/remote/agents.d.ts +37 -0
  235. package/dist/types/remote/answer.d.ts +9 -0
  236. package/dist/types/remote/board.d.ts +108 -0
  237. package/dist/types/remote/cards.d.ts +4 -0
  238. package/dist/types/remote/chat-key.d.ts +13 -0
  239. package/dist/types/remote/chats.d.ts +76 -0
  240. package/dist/types/remote/clicks-machine.d.ts +24 -0
  241. package/dist/types/remote/clicks-start.d.ts +36 -0
  242. package/dist/types/remote/clicks.d.ts +61 -0
  243. package/dist/types/remote/commands.d.ts +60 -0
  244. package/dist/types/remote/connector/reasons.d.ts +31 -0
  245. package/dist/types/remote/connector/setup.d.ts +62 -0
  246. package/dist/types/remote/context.d.ts +101 -0
  247. package/dist/types/remote/conversations.d.ts +37 -0
  248. package/dist/types/remote/ended.d.ts +25 -0
  249. package/dist/types/remote/events.d.ts +65 -0
  250. package/dist/types/remote/fields.d.ts +7 -0
  251. package/dist/types/remote/follow/control.d.ts +39 -0
  252. package/dist/types/remote/follow/follower.d.ts +85 -0
  253. package/dist/types/remote/follow/inbox.d.ts +16 -0
  254. package/dist/types/remote/follow/speaker.d.ts +122 -0
  255. package/dist/types/remote/follow/steps.d.ts +9 -0
  256. package/dist/types/remote/follow/timings.d.ts +29 -0
  257. package/dist/types/remote/health.d.ts +20 -0
  258. package/dist/types/remote/index.d.ts +21 -0
  259. package/dist/types/remote/inert.d.ts +18 -0
  260. package/dist/types/remote/limits.d.ts +48 -0
  261. package/dist/types/remote/lines.d.ts +66 -0
  262. package/dist/types/remote/links/answer.d.ts +7 -0
  263. package/dist/types/remote/links/domains.d.ts +19 -0
  264. package/dist/types/remote/links/hosts.d.ts +2 -0
  265. package/dist/types/remote/links/scans.d.ts +27 -0
  266. package/dist/types/remote/listing.d.ts +38 -0
  267. package/dist/types/remote/lists.d.ts +56 -0
  268. package/dist/types/remote/machines.d.ts +54 -0
  269. package/dist/types/remote/marks.d.ts +5 -0
  270. package/dist/types/remote/model.d.ts +51 -0
  271. package/dist/types/remote/options.d.ts +20 -0
  272. package/dist/types/remote/permissions.d.ts +41 -0
  273. package/dist/types/remote/ports.d.ts +143 -0
  274. package/dist/types/remote/prompt.d.ts +60 -0
  275. package/dist/types/remote/refusals.d.ts +40 -0
  276. package/dist/types/remote/remote-agents.d.ts +84 -0
  277. package/dist/types/remote/reported.d.ts +8 -0
  278. package/dist/types/remote/session-ops.d.ts +57 -0
  279. package/dist/types/remote/sessions.d.ts +80 -0
  280. package/dist/types/remote/setup.d.ts +26 -0
  281. package/dist/types/remote/state.d.ts +55 -0
  282. package/dist/types/remote/tail.d.ts +63 -0
  283. package/dist/types/remote/targets.d.ts +66 -0
  284. package/dist/types/remote/tasks.d.ts +20 -0
  285. package/dist/types/remote/time.d.ts +15 -0
  286. package/dist/types/remote/turn-state.d.ts +29 -0
  287. package/dist/types/remote/turns/chat-turn.d.ts +50 -0
  288. package/dist/types/remote/turns/display.d.ts +18 -0
  289. package/dist/types/remote/turns/outcome.d.ts +41 -0
  290. package/dist/types/remote/turns/runner.d.ts +55 -0
  291. package/dist/types/remote/turns/signer.d.ts +14 -0
  292. package/dist/types/remote/turns/window-turn.d.ts +29 -0
  293. package/dist/types/remote/views.d.ts +13 -0
  294. package/dist/types/remote/watches.d.ts +64 -0
  295. package/dist/types/remote/window/closer.d.ts +14 -0
  296. package/dist/types/remote/window/index.d.ts +2 -0
  297. package/dist/types/remote/window/output.d.ts +28 -0
  298. package/dist/types/remote/window/view.d.ts +73 -0
  299. package/dist/types/remote-view/agents-view.d.ts +88 -0
  300. package/dist/types/remote-view/conversations-view.d.ts +51 -0
  301. package/dist/types/remote-view/hidden-view.d.ts +20 -0
  302. package/dist/types/remote-view/index.d.ts +40 -0
  303. package/dist/types/remote-view/live-view.d.ts +44 -0
  304. package/dist/types/remote-view/machine-views.d.ts +73 -0
  305. package/dist/types/remote-view/messages.d.ts +3 -0
  306. package/dist/types/remote-view/permission-view.d.ts +55 -0
  307. package/dist/types/remote-view/sessions-view.d.ts +70 -0
  308. package/dist/types/remote-view/status-view.d.ts +52 -0
  309. package/dist/types/remote-view/window-view.d.ts +68 -0
  310. package/dist/types/result.d.ts +31 -0
  311. package/dist/types/review/connect/connections.d.ts +24 -0
  312. package/dist/types/review/connect/github-connect.d.ts +50 -0
  313. package/dist/types/review/connect/questions.d.ts +6 -0
  314. package/dist/types/review/connect/review-ask.d.ts +1 -0
  315. package/dist/types/review/consent.d.ts +13 -0
  316. package/dist/types/review/handoff.d.ts +22 -0
  317. package/dist/types/review/held.d.ts +15 -0
  318. package/dist/types/review/index.d.ts +14 -0
  319. package/dist/types/review/intent-check.d.ts +36 -0
  320. package/dist/types/review/outcome.d.ts +36 -0
  321. package/dist/types/review/progress.d.ts +50 -0
  322. package/dist/types/review/prompts.d.ts +2 -0
  323. package/dist/types/review/receipt.d.ts +45 -0
  324. package/dist/types/review/refusals.d.ts +44 -0
  325. package/dist/types/review/request-parse.d.ts +40 -0
  326. package/dist/types/review/review-turn.d.ts +83 -0
  327. package/dist/types/review/service/account.d.ts +52 -0
  328. package/dist/types/review/service/chat.d.ts +18 -0
  329. package/dist/types/review/service/confirm.d.ts +49 -0
  330. package/dist/types/review/service/deps.d.ts +100 -0
  331. package/dist/types/review/service/follow.d.ts +53 -0
  332. package/dist/types/review/service/github-review.d.ts +72 -0
  333. package/dist/types/review/service/handoff-action.d.ts +32 -0
  334. package/dist/types/review/service/identity.d.ts +27 -0
  335. package/dist/types/review/service/item-cards.d.ts +39 -0
  336. package/dist/types/review/service/items.d.ts +57 -0
  337. package/dist/types/review/service/launch.d.ts +37 -0
  338. package/dist/types/review/service/notices.d.ts +42 -0
  339. package/dist/types/review/service/request.d.ts +58 -0
  340. package/dist/types/review/service/reviewer.d.ts +48 -0
  341. package/dist/types/review/service/routed-turn.d.ts +20 -0
  342. package/dist/types/review/service/start.d.ts +65 -0
  343. package/dist/types/review/service/turns.d.ts +38 -0
  344. package/dist/types/review/summary.d.ts +11 -0
  345. package/dist/types/review/views.d.ts +91 -0
  346. package/dist/types/review-text/asks.d.ts +13 -0
  347. package/dist/types/review-text/bare-numbers.d.ts +29 -0
  348. package/dist/types/review-text/index.d.ts +10 -0
  349. package/dist/types/review-text/markers.d.ts +6 -0
  350. package/dist/types/review-text/names.d.ts +60 -0
  351. package/dist/types/review-text/pull-ref.d.ts +25 -0
  352. package/dist/types/review-text/text/scan.d.ts +19 -0
  353. package/dist/types/review-text/text/unicode.d.ts +22 -0
  354. package/dist/types/routing/admission.d.ts +83 -0
  355. package/dist/types/routing/chat.d.ts +52 -0
  356. package/dist/types/routing/command-table.d.ts +32 -0
  357. package/dist/types/routing/commands-account.d.ts +26 -0
  358. package/dist/types/routing/commands-session.d.ts +40 -0
  359. package/dist/types/routing/commands-settings.d.ts +17 -0
  360. package/dist/types/routing/context.d.ts +38 -0
  361. package/dist/types/routing/credentials.d.ts +53 -0
  362. package/dist/types/routing/deps.d.ts +116 -0
  363. package/dist/types/routing/features.d.ts +256 -0
  364. package/dist/types/routing/group-remote.d.ts +26 -0
  365. package/dist/types/routing/group-router.d.ts +42 -0
  366. package/dist/types/routing/identity.d.ts +18 -0
  367. package/dist/types/routing/index.d.ts +26 -0
  368. package/dist/types/routing/link-commands.d.ts +26 -0
  369. package/dist/types/routing/lock.d.ts +5 -0
  370. package/dist/types/routing/onboarding.d.ts +51 -0
  371. package/dist/types/routing/personal-router.d.ts +34 -0
  372. package/dist/types/routing/personal-text.d.ts +62 -0
  373. package/dist/types/routing/router.d.ts +57 -0
  374. package/dist/types/routing/show-here.d.ts +18 -0
  375. package/dist/types/routing/stop-press.d.ts +19 -0
  376. package/dist/types/routing/time.d.ts +31 -0
  377. package/dist/types/routing/turn-registry.d.ts +71 -0
  378. package/dist/types/routing/turn-runner.d.ts +82 -0
  379. package/dist/types/routing/turn-start.d.ts +81 -0
  380. package/dist/types/routing/views.d.ts +104 -0
  381. package/dist/types/security/redact-scan.d.ts +19 -0
  382. package/dist/types/security/redact-text.d.ts +14 -0
  383. package/dist/types/security/redact.d.ts +2 -0
  384. package/dist/types/subscriptions/event-types.d.ts +29 -0
  385. package/dist/types/subscriptions/index.d.ts +3 -0
  386. package/dist/types/subscriptions/ports.d.ts +9 -0
  387. package/dist/types/subscriptions/subscriptions.d.ts +69 -0
  388. package/dist/types/text/neutral.d.ts +1 -0
  389. package/dist/types/text/plain.d.ts +6 -0
  390. package/dist/types/text/py-chars.d.ts +12 -0
  391. package/dist/types/text/py-json.d.ts +23 -0
  392. package/dist/types/text/py-number.d.ts +18 -0
  393. package/dist/types/text/py-regex-escapes.d.ts +32 -0
  394. package/dist/types/text/py-regex.d.ts +36 -0
  395. package/dist/types/text/py-text.d.ts +64 -0
  396. package/dist/types/turn/answer-parts.d.ts +23 -0
  397. package/dist/types/turn/changes.d.ts +42 -0
  398. package/dist/types/turn/clip.d.ts +6 -0
  399. package/dist/types/turn/deliveries.d.ts +31 -0
  400. package/dist/types/turn/engine/claw-errors.d.ts +7 -0
  401. package/dist/types/turn/engine/consume.d.ts +35 -0
  402. package/dist/types/turn/engine/context.d.ts +157 -0
  403. package/dist/types/turn/engine/extras.d.ts +16 -0
  404. package/dist/types/turn/engine/fallback.d.ts +17 -0
  405. package/dist/types/turn/engine/outcome.d.ts +33 -0
  406. package/dist/types/turn/engine/run-turn.d.ts +22 -0
  407. package/dist/types/turn/engine/submit.d.ts +23 -0
  408. package/dist/types/turn/files.d.ts +10 -0
  409. package/dist/types/turn/github-outcome.d.ts +16 -0
  410. package/dist/types/turn/index.d.ts +26 -0
  411. package/dist/types/turn/json.d.ts +10 -0
  412. package/dist/types/turn/last-answer.d.ts +44 -0
  413. package/dist/types/turn/live-view.d.ts +67 -0
  414. package/dist/types/turn/plan.d.ts +31 -0
  415. package/dist/types/turn/ports.d.ts +15 -0
  416. package/dist/types/turn/progress/answer-messages.d.ts +20 -0
  417. package/dist/types/turn/progress/status-message.d.ts +144 -0
  418. package/dist/types/turn/progress/status-policy.d.ts +66 -0
  419. package/dist/types/turn/progress/status-text.d.ts +10 -0
  420. package/dist/types/turn/progress/stream-handle.d.ts +39 -0
  421. package/dist/types/turn/records.d.ts +10 -0
  422. package/dist/types/turn/runner.d.ts +106 -0
  423. package/dist/types/turn/step-labels.d.ts +28 -0
  424. package/dist/types/turn/step.d.ts +26 -0
  425. package/dist/types/turn/stop-buttons.d.ts +62 -0
  426. package/dist/types/turn/task.d.ts +33 -0
  427. package/dist/types/turn/turn-state.d.ts +70 -0
  428. package/dist/types/turn/views.d.ts +23 -0
  429. package/dist/types/typed-answer/index.d.ts +8 -0
  430. package/dist/types/typed-answer/mode.d.ts +38 -0
  431. package/dist/types/typed-answer/patterns.d.ts +25 -0
  432. package/dist/types/typed-answer/prompt.d.ts +5 -0
  433. package/dist/types/typed-answer/read.d.ts +16 -0
  434. package/dist/types/understanding/commands.d.ts +14 -0
  435. package/dist/types/understanding/context.d.ts +49 -0
  436. package/dist/types/understanding/index.d.ts +11 -0
  437. package/dist/types/understanding/limits.d.ts +6 -0
  438. package/dist/types/understanding/people.d.ts +31 -0
  439. package/dist/types/understanding/record.d.ts +10 -0
  440. package/dist/types/understanding/review-stop.d.ts +7 -0
  441. package/dist/types/understanding/sequence-matcher.d.ts +7 -0
  442. package/dist/types/validate.d.ts +15 -0
  443. package/package.json +35 -4
  444. package/README.md +0 -3
@@ -0,0 +1,27 @@
1
+ /**
2
+ * When something unasked may reach a person (teams_agent/proactive.py): quiet hours in their time zone, an explicit pause, and the
3
+ * expiry of an approval or a remote agent's permission request that was held.
4
+ */
5
+ import { type Prefs } from "../ports/store/index.js";
6
+ /** When an approval event carries no usable `expires_at`: fail closed, a short life. */
7
+ export declare const APPROVAL_DEFAULT_SECONDS = 600;
8
+ /** When a pushed permission request carries no usable `expires_at`. */
9
+ export declare const PERMISSION_DEFAULT_SECONDS = 600;
10
+ /** The person's time zone when it is one this runtime knows, else DEFAULT_TIMEZONE (Python's `zone_of`). */
11
+ export declare function zoneOf(prefs: Pick<Prefs, "timezone">): string;
12
+ /** Minutes since local midnight of `epochSeconds` in `zone`. */
13
+ export declare function localMinutes(epochSeconds: number, zone: string): number;
14
+ /** Is `now` inside the daily window [start, end) in `zone`? A window may wrap midnight (22:00-08:00); start == end is none. */
15
+ export declare function inQuiet(now: number, zone: string, start: string, end: string): boolean;
16
+ export type Muted = "paused" | "quiet";
17
+ /** Why nothing may be pushed right now, or undefined when it may. */
18
+ export declare function muted(prefs: Prefs, now: number): Muted | undefined;
19
+ /**
20
+ * An ISO time with an offset, as epoch seconds; undefined for anything else (Python's `datetime.fromisoformat` on a "Z" or
21
+ * "+hh:mm" time: a time without an offset cannot be compared safely).
22
+ */
23
+ export declare function isoSeconds(raw: unknown): number | undefined;
24
+ /** When an approval event runs out: its `approval.expires_at`, else APPROVAL_DEFAULT_SECONDS from now. */
25
+ export declare function approvalExpiry(event: Readonly<Record<string, unknown>>, now: number): number;
26
+ /** When a pushed permission request runs out: its `expires_at`, at most an hour on; else PERMISSION_DEFAULT_SECONDS from now. */
27
+ export declare function remoteAskExpiry(ask: Readonly<Record<string, unknown>>, now: number): number;
@@ -0,0 +1,24 @@
1
+ import type { ProactiveDeps } from "./deps.js";
2
+ import type { Proactive } from "./proactive.js";
3
+ /** Held assistant messages sent one by one when the person can be reached; the older ones are one line. */
4
+ export declare const ASSISTANT_RELEASE_MAX = 10;
5
+ /** Held remote agent messages sent one by one; the older ones are one line. */
6
+ export declare const REMOTE_RELEASE_MAX = 5;
7
+ export declare class Release {
8
+ private readonly deps;
9
+ private readonly proactive;
10
+ constructor(deps: ProactiveDeps, proactive: Proactive);
11
+ /** Deliver what was held for every person who may be reached now. Run on a timer; one person's failure does not stop the rest. */
12
+ releaseDue(): Promise<void>;
13
+ /** Send what was held for this person; on a failure everything is held again for the next sweep, and the error goes on. */
14
+ release(userId: string): Promise<void>;
15
+ private sort;
16
+ private sendAll;
17
+ private digest;
18
+ /**
19
+ * Send again every approval card that was recorded and never reached the chat (its worker died between recording it and the
20
+ * send). Quiet hours do not apply: a card is recorded only once it was due. At least once: a second copy is answered "already
21
+ * answered". Returns how many were sent.
22
+ */
23
+ resendUnsentApprovals(): Promise<number>;
24
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The assistant's messages this process sent lately that a later one may add to (`amends`) or take the place of (`replaces`):
3
+ * event id -> (the channel's message id, the event). In memory: after a restart an addition is sent as a message of its own.
4
+ * Shared by every delivery path of one process (teams_agent/proactive.py `_SAID`).
5
+ */
6
+ import type { JsonObject } from "../json.js";
7
+ import type { MessageId } from "../ports/surface.js";
8
+ export declare const SAID_MAX = 512;
9
+ export interface SaidMessage {
10
+ readonly messageId: MessageId;
11
+ readonly event: JsonObject;
12
+ }
13
+ export declare class SaidMessages {
14
+ private readonly max;
15
+ private readonly said;
16
+ constructor(max?: number);
17
+ get(eventId: string): SaidMessage | undefined;
18
+ /** Remember an `assistant.say` sent as `messageId` (nothing for another event, one without an id, or no message id). */
19
+ remember(event: JsonObject, messageId: MessageId | undefined): void;
20
+ set(eventId: string, said: SaidMessage): void;
21
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * What reaches a person unasked, as views (the arguments of teams_agent/render.py event_card, digest_card, approval_card,
3
+ * item_approval_card and item_question_card, one for one), and the pure helpers their cards share: the one link a card may open,
4
+ * a clock time in the person's zone, and the line that names which work item asks.
5
+ */
6
+ import type { JsonObject } from "../json.js";
7
+ import type { Lang } from "../locales/lang.js";
8
+ import type { PublicErrors } from "../public-error/public-errors.js";
9
+ /** The longest summary a notice shows. */
10
+ export declare const NOTICE_SUMMARY_MAX = 280;
11
+ /** What Claw sends as an approval's target is at most this long; a bash command is shown whole. */
12
+ export declare const TARGET_MAX = 300;
13
+ /** At a phone's width 300 characters are about 6 lines; the card keeps four and the clip marks the rest. */
14
+ export declare const TARGET_LINES = 4;
15
+ /** The longest work item title a request card names. */
16
+ export declare const ITEM_TITLE_MAX = 80;
17
+ /** A Claw event (run.completed, run.failed, another notice) as a card (render.event_card). */
18
+ export interface RunEventModel {
19
+ /** The event, made public first (`publicRunEvent`). */
20
+ readonly event: JsonObject;
21
+ readonly publicBaseUrl: string;
22
+ }
23
+ /** Everything held back while the person was away, as one card (render.digest_card). */
24
+ export interface DigestModel {
25
+ readonly events: readonly JsonObject[];
26
+ /** Approvals that ran out while held, and were refused. */
27
+ readonly expiredApprovals: number;
28
+ readonly publicBaseUrl: string;
29
+ }
30
+ /** An approval.requested event of a run (render.approval_card), or of a work item (render.item_approval_card). */
31
+ export interface ProactiveApprovalModel {
32
+ readonly event: JsonObject;
33
+ readonly publicBaseUrl: string;
34
+ /** When it runs out, epoch seconds, shown as HH:MM in `zone`. */
35
+ readonly expiresAt: number;
36
+ /** An IANA time zone name. */
37
+ readonly zone: string;
38
+ }
39
+ /** A work item's question to its person (render.item_question_card). */
40
+ export interface ItemQuestionModel {
41
+ readonly event: JsonObject;
42
+ }
43
+ declare module "../ports/surface.js" {
44
+ interface ViewMap {
45
+ digest: DigestModel;
46
+ itemApproval: ProactiveApprovalModel;
47
+ itemQuestion: ItemQuestionModel;
48
+ proactiveApproval: ProactiveApprovalModel;
49
+ runEvent: RunEventModel;
50
+ }
51
+ }
52
+ /** The absolute https URL of a Claw-relative link; null for anything else (never an arbitrary URL). */
53
+ export declare function openUrl(link: unknown, publicBaseUrl: string): string | null;
54
+ /** `datetime.fromtimestamp(at, zone).strftime("%H:%M")`. */
55
+ export declare function clockText(at: number, zone: string): string;
56
+ /** The language of a work item's request card: the model's summary, else the item's title (what the person asked for). */
57
+ export declare function itemLang(event: Readonly<Record<string, unknown>>): Lang;
58
+ /** The line that names the work item a request comes from: "Task #13: title" ("task") or "... asks you" ("asks"). */
59
+ export declare function itemRequestLabel(event: Readonly<Record<string, unknown>>, key: "task" | "asks", lang: Lang): string;
60
+ /** A target Claw sent, masked for credential shapes and clipped (what a work item's approval card shows). */
61
+ export declare function maskedTarget(target: unknown): string;
62
+ /**
63
+ * A run.failed event as it may be shown: what Claw says about a failed run may be the raw error, so a title with the shape of
64
+ * internal detail is dropped and such a summary is withheld to the log under a reference the person is told. Other events are
65
+ * returned as they are. `looksInternal` is the public-error check of a service error or internal detail.
66
+ */
67
+ export declare function publicRunEvent(event: JsonObject, errors: PublicErrors, looksInternal: (text: unknown) => boolean): JsonObject;
@@ -0,0 +1,223 @@
1
+ /**
2
+ * The outbound events an assistant produces, and the payloads they carry: what a
3
+ * notification subscription that lists their types receives (`POST` to its URL), and
4
+ * what the API builds in `packages/api/src/assistant/outbound.ts`.
5
+ *
6
+ * They are not run events: there is no session, task or link to report, only
7
+ * something the assistant said, so they do not reuse `NotificationPayload`. They
8
+ * say nothing about who receives them -- a subscription asks for the type and
9
+ * the receiver decides how a person sees it.
10
+ */
11
+ export declare const ASSISTANT_EVENT_TYPES: readonly ["assistant.say", "work_item.needs_you", "assistant.action"];
12
+ export type AssistantEventType = (typeof ASSISTANT_EVENT_TYPES)[number];
13
+ /** What a receiver needs to draw the item a message is about; derived from the item's state, never written by a model. */
14
+ export interface AssistantItemSnapshot {
15
+ item_id: string;
16
+ seq: number;
17
+ title: string;
18
+ board_state: string;
19
+ result_version: number;
20
+ can_accept: boolean;
21
+ }
22
+ interface AssistantEventBase {
23
+ /** The id of the stored message: the receiver's dedup key. */
24
+ event_id: string;
25
+ occurred_at: string;
26
+ user_id: string;
27
+ text: string;
28
+ item?: AssistantItemSnapshot;
29
+ }
30
+ /**
31
+ * A channel action put to the person rather than run (`channel_action` when their message was not its command typed whole).
32
+ * A channel that can draw a button shows one for `/{name} {args}` and runs it, as if the person typed it, only when that person
33
+ * presses it, under the same checks as an `assistant.action` (a message it sent for them, an action that message declared).
34
+ * A channel that cannot shows the text, which tells the person the command to type.
35
+ */
36
+ export interface AssistantConfirmAction {
37
+ name: string;
38
+ args: string;
39
+ /** The id of the turn's message in Claw. */
40
+ message_id: string;
41
+ /** What the channel called that message when it sent it. */
42
+ channel_message_id: string;
43
+ }
44
+ /**
45
+ * A source the message cites (`assistant/citations.ts`): `n` is the number its text writes as `[n]`. Each comes from a lookup the turn
46
+ * made (a web page it found or read, an object of the user's GitHub), never from the model's own words. `title` is a plain line,
47
+ * already cut and stripped of markup, but what someone else wrote: shown as text only.
48
+ */
49
+ export interface AssistantSaySource {
50
+ n: number;
51
+ url: string;
52
+ title: string;
53
+ kind: "web" | "github_pr" | "github_issue" | "github_repo" | "github_check" | "github_file" | "board";
54
+ }
55
+ /**
56
+ * A write the router proposed and Claw holds until the person answers it (`assistant/schedules.ts`): creating or cancelling a
57
+ * scheduled task. A channel that can draw buttons shows the message's text with two: one that lets it through and one that does
58
+ * not, each calling `POST /v1/assistant/confirmations/{confirmation_id}/decision` as that person (`allow` or `deny`). A channel that
59
+ * cannot shows the text, which tells the person the command that lets it through (`批准 #{ref}`).
60
+ */
61
+ export interface AssistantConfirmWrite {
62
+ confirmation_id: string;
63
+ /** The short id the person may type back. */
64
+ ref: string;
65
+ /** `devenv_send`: an instruction for an agent on the person's own machine (`assistant/devenv-tools.ts`). */
66
+ kind: "trigger_create" | "trigger_cancel" | "github_comment" | "devenv_send" | "devenv_hide";
67
+ /** What the button that lets it through says, in the language of the text. */
68
+ allow_label: string;
69
+ expires_at: string;
70
+ }
71
+ /**
72
+ * A file a work item's worker delivered (`deliver_file`, `deliver_text`), or one the router wrote (`deliver_text`), for a channel to
73
+ * offer as a download. The download is Claw's own link, `GET /v1/sessions/{session_id}/deliveries/{id}`, which answers only the
74
+ * signed-in owner of that session (the item's worker session, or the assistant's own, both the user's). `data_base64` is a small image itself (`DELIVERY_INLINE_TYPES`, at most
75
+ * `DELIVERY_INLINE_MAX_BYTES`), for a channel that shows it without fetching the link.
76
+ */
77
+ export interface AssistantFile {
78
+ /** The work item whose worker delivered it; absent for a file the router wrote itself (`text-delivery.ts`). */
79
+ item_id?: string;
80
+ session_id: string;
81
+ id: string;
82
+ name: string;
83
+ size: number;
84
+ content_type: string;
85
+ data_base64?: string;
86
+ }
87
+ /**
88
+ * What a development environment session's own message is about (`assistant/remote-items.ts`): one of the three things a session is
89
+ * ever said for, so a channel can draw it and tell it apart. `done`: the instruction finished; `needs_you`: the agent waits on the person
90
+ * (`ask`: the permission request, for a channel to put to them with its options as buttons, answered as an attached chat's card is, a
91
+ * decision on the session); `error`: the instruction failed, was refused, or its session ended before it finished. `machine` and
92
+ * `agent` are what the connector reported, and `ask`'s words what the agent wrote: untrusted text, shown as text only.
93
+ */
94
+ export interface AssistantRemoteNotice {
95
+ kind: "done" | "needs_you" | "error";
96
+ session_id: string;
97
+ machine: string;
98
+ agent: string;
99
+ ask?: AssistantRemoteAsk;
100
+ }
101
+ /** A permission request a development environment's agent waits on (`permissionRequest`), as its connector posted it. */
102
+ export interface AssistantRemoteAsk {
103
+ action_id: string;
104
+ tool: string;
105
+ /** The options the agent offered, ids as the agent gave them: the only answers a decision may carry. */
106
+ options: Array<{
107
+ optionId: string;
108
+ name: string;
109
+ kind: string;
110
+ }>;
111
+ /** When the connector stops waiting for an answer (it refuses the request then); absent when it did not say. */
112
+ expires_at?: string;
113
+ }
114
+ /** Something the assistant chose to say to the user. */
115
+ export interface AssistantSayPayload extends AssistantEventBase {
116
+ type: "assistant.say";
117
+ confirm_action?: AssistantConfirmAction;
118
+ /** Present only when the message cites any (`CLAW_ASSISTANT_CITATIONS`); a receiver that does not read it shows the text alone. */
119
+ sources?: AssistantSaySource[];
120
+ /**
121
+ * Present only when the router suggested any (`CLAW_ASSISTANT_SUGGESTED_REPLIES`): up to three short replies the user may send
122
+ * next, each one plain line. A channel shows them as buttons that send the words as the user's message; one that cannot ignores them.
123
+ */
124
+ suggested_replies?: string[];
125
+ confirm_write?: AssistantConfirmWrite;
126
+ /** Files the user gets with the message (a worker's deliveries, `deliveries.ts`): one download each. */
127
+ files?: AssistantFile[];
128
+ /** Present on a development environment session's own message: which session, and which of its three kinds of news. */
129
+ remote?: AssistantRemoteNotice;
130
+ /**
131
+ * The `event_id` of an earlier message of this turn that this one adds to: the system's start notice of an item, after which the
132
+ * router's words belong in that same message. A channel that still has that message shows it with these words added (its current
133
+ * text, a blank line, this text); one that does not shows this as a message of its own. When the start notice took the place of the
134
+ * server's "on it" line (`replaces`), this names that line's id: the message the channel shows, whose current text is the notice.
135
+ */
136
+ amends?: string;
137
+ /**
138
+ * The `event_id` of the router's first message of this turn, which this one takes the place of: a turn speaks to the user once, and a
139
+ * later say of it (the answer after a quick "查一下", or a correction) is that whole message again. A channel that still has that message
140
+ * shows this text in its place; one that does not shows this as a message of its own.
141
+ */
142
+ replaces?: string;
143
+ /** The message id of the turn a system notice answers or a router say belongs to (what an `amends` or a `replaces` is matched by). */
144
+ turn_message_id?: string;
145
+ }
146
+ /** The system's own message, sent when an item has needed the user for a while and nobody has said so. */
147
+ export interface WorkItemNeedsYouPayload extends AssistantEventBase {
148
+ type: "work_item.needs_you";
149
+ fallback: true;
150
+ item: AssistantItemSnapshot;
151
+ /** Present when what the item waits for is a write its worker holds for the person (`AssistantHeldWrite`). */
152
+ held_write?: AssistantHeldWrite;
153
+ }
154
+ /**
155
+ * A write an item's worker holds for the person (`assistant/holds.ts`), on the message that says so: what a card needs to put it to them
156
+ * beside the text. The person answers it as any held call is answered: a `decision` (`allow` or `deny`, with `tool_use_id`) on the
157
+ * worker's session, `POST /v1/sessions/{session_id}/messages`; the channel that got the item's `approval.requested` draws the same card
158
+ * from that. Every field is what Claw recorded of the hold, never a model's words; `action` is in the person's language.
159
+ */
160
+ export interface AssistantHeldWrite {
161
+ item_id: string;
162
+ /** The worker's session, where the decision is sent. */
163
+ session_id: string;
164
+ tool_use_id: string;
165
+ /** What it would do, in plain words (`approvalAction`). */
166
+ action: string;
167
+ expires_at?: string;
168
+ }
169
+ /**
170
+ * A review the person asked of someone else, handed to the channel that carried their message (`review_start` with a reviewer, when
171
+ * that message declared `channel_context.handoffs: ["review_for_other"]`). It runs on the reviewer's own credentials, which only that
172
+ * channel holds, so the channel starts it itself (`POST /v1/assistant/reviews` with the reviewer's token and key) and answers the
173
+ * person's message about it, in one message (the router says nothing about it). Every field is the router's call as Claw checked it: the
174
+ * reviewer is someone the channel listed with this message, each pull request is one the person's message names. `requester_note` is the
175
+ * person's own message, to quote to the reviewer as untrusted. `handoff_id` names the record Claw kept of it: the channel echoes it as
176
+ * `handoff_id` in that request, which then starts once and merges only if `merge` is true (Claw reads the record, not the request); how it
177
+ * merges is the reviewer's own review setting's, as for a review asked of them in the chat, and the route's answer says so per item.
178
+ */
179
+ export interface AssistantReviewHandoff {
180
+ handoff_id: string;
181
+ reviewer: {
182
+ user_id: string;
183
+ name: string;
184
+ };
185
+ prs: Array<{
186
+ owner: string;
187
+ repo: string;
188
+ number: number;
189
+ }>;
190
+ merge: boolean;
191
+ requester_note: string;
192
+ /**
193
+ * What the router said in the same turn before handing the review over (another question of the person's answered), in order. Held
194
+ * and never delivered on its own (`say-hold.ts`), so the channel's one answer carries it: the channel adds it to that answer. Absent
195
+ * when nothing was said.
196
+ */
197
+ held_says?: string[];
198
+ }
199
+ /** The name an `assistant.action` carries when it is a handoff rather than one of the channel's own commands. */
200
+ export declare const REVIEW_HANDOFF_ACTION = "review_for_other";
201
+ /**
202
+ * A setting the channel offered beside the user's message, to be run by that channel as if the user typed it
203
+ * (`channel_action`); or, with `review` (and the action named `review_for_other`), a review asked of someone else, handed to the
204
+ * channel to start with that person's credentials. The channel runs it only for a message it sent itself (`channel_message_id`), once
205
+ * per `event_id`.
206
+ */
207
+ export interface AssistantActionPayload {
208
+ type: "assistant.action";
209
+ event_id: string;
210
+ occurred_at: string;
211
+ user_id: string;
212
+ /** The id of the turn's message in Claw. */
213
+ message_id: string;
214
+ /** What the channel called that message when it sent it. */
215
+ channel_message_id: string;
216
+ action: {
217
+ name: string;
218
+ args: string;
219
+ };
220
+ review?: AssistantReviewHandoff;
221
+ }
222
+ export type AssistantEventPayload = AssistantSayPayload | WorkItemNeedsYouPayload | AssistantActionPayload;
223
+ export {};
@@ -0,0 +1,5 @@
1
+ export * from "./work-items.js";
2
+ export * from "./reviews.js";
3
+ export * from "./assistant-events.js";
4
+ export * from "./notifications.js";
5
+ export * from "./session-events.js";
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Outbound notifications as the Claw HTTP API defines them: the subscriptions a user keeps
3
+ * (`/v1/notification-subscriptions`) and the run and approval events posted to them. The assistant's own events are in
4
+ * `assistant-events.ts`.
5
+ *
6
+ * Types and constants only. The API builds these in `packages/api/src/notifications/outbox.ts`,
7
+ * `packages/api/src/assistant/holds.ts` and `packages/api/src/routes/notification-subscriptions.ts`.
8
+ */
9
+ import { type AssistantEventPayload, type AssistantItemSnapshot } from "./assistant-events.js";
10
+ export declare const NOTIFICATION_RUN_EVENT_TYPES: readonly ["run.completed", "run.failed", "approval.requested"];
11
+ export type NotificationEventType = (typeof NOTIFICATION_RUN_EVENT_TYPES)[number];
12
+ /**
13
+ * Every type a subscription may list. A new subscription gets `run.completed` and `run.failed` unless it names its own;
14
+ * `approval.requested` and the assistant's events have to be asked for.
15
+ */
16
+ export declare const NOTIFICATION_SUBSCRIPTION_EVENT_TYPES: readonly ["run.completed", "run.failed", "approval.requested", "assistant.say", "work_item.needs_you", "assistant.action"];
17
+ /**
18
+ * What started a run, which narrows run events (`trigger`, `long_run`), and `assistant_item`: an `approval.requested`
19
+ * that an assistant's work item holds. A new subscription gets `trigger` and `long_run` unless it names its own.
20
+ */
21
+ export declare const NOTIFICATION_SOURCES: readonly ["trigger", "long_run", "assistant_item"];
22
+ export type NotificationSource = (typeof NOTIFICATION_SOURCES)[number];
23
+ /** One subscription, as listed, created (with its signing `secret`, once) and changed. */
24
+ export interface NotificationSubscription<Time = string> {
25
+ subscription_id: string;
26
+ url: string;
27
+ event_types: string[];
28
+ sources: string[];
29
+ enabled: boolean;
30
+ consecutive_failures: number;
31
+ created_at: Time;
32
+ }
33
+ /** The part of an `approval.requested` payload that says what is being asked. */
34
+ export interface ApprovalInfo {
35
+ tool_use_id: string;
36
+ tool: string;
37
+ /** Redacted and clipped to 300 characters. */
38
+ target: string;
39
+ /** ISO-8601 with an offset: when Brain stops waiting, after which the request is refused. */
40
+ expires_at: string;
41
+ }
42
+ /** A run event (`run.completed`, `run.failed`) or an `approval.requested`. */
43
+ export interface NotificationPayload {
44
+ event_id: string;
45
+ type: NotificationEventType;
46
+ occurred_at: string;
47
+ user_id: string;
48
+ session_id: string;
49
+ task_id: string;
50
+ /**
51
+ * Run events only: the message whose turn this run was (`null` for a task that has none). A client that sent the
52
+ * message can tell this run's end is that turn's by the id, not by when it ended.
53
+ */
54
+ message_id?: string | null;
55
+ trigger_id: string | null;
56
+ title: string;
57
+ summary: string;
58
+ link: string;
59
+ /** Present on `approval.requested` only. */
60
+ approval?: ApprovalInfo;
61
+ /**
62
+ * `assistant_item`: an `approval.requested` held by the worker of an assistant's work item, sent only to a subscription
63
+ * that lists that source. Absent on every other event.
64
+ */
65
+ source?: "assistant_item";
66
+ /** With `source`: the work item that waits, as an assistant event draws it. */
67
+ item?: AssistantItemSnapshot;
68
+ /**
69
+ * With `source`, when what waits is a question (`approval.tool` is `ask_user_question`): what it asks. Answered as a
70
+ * client answers any question (`messageType: "answer"`), not with a decision.
71
+ */
72
+ questions?: HeldQuestion[];
73
+ }
74
+ /** One question of an `ask_user_question`, as a channel shows it: masked and clipped. */
75
+ export interface HeldQuestion {
76
+ id: string;
77
+ question: string;
78
+ options: Array<{
79
+ id: string;
80
+ label: string;
81
+ }>;
82
+ allow_multiple: boolean;
83
+ }
84
+ /** Everything a subscription can be posted. */
85
+ export type OutboundPayload = NotificationPayload | AssistantEventPayload;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Review items as the Claw HTTP API returns them: the reviews `POST /v1/assistant/reviews` started, and what the person
3
+ * who asked for a review someone else runs may see of it (`GET /v1/work-items/:id` and the stop's answer for that person,
4
+ * `GET /v1/work-items/asked-of-others`).
5
+ *
6
+ * Types only. The API builds these in `packages/api/src/assistant/review-items.ts` and `requester-view.ts`.
7
+ */
8
+ /** One pull request. */
9
+ export interface PrRef {
10
+ owner: string;
11
+ repo: string;
12
+ number: number;
13
+ }
14
+ /** One review `POST /v1/assistant/reviews` started (`data.items[]`), as its owner is answered. */
15
+ export interface StartedReview {
16
+ item_id: string;
17
+ seq: number;
18
+ title: string;
19
+ session_id: string;
20
+ pr: PrRef;
21
+ /** The turn id of the session's first message (`claw-pending-<id>`), for a caller that follows that turn's stream. */
22
+ message_id: string | null;
23
+ /** What the request named that the review does not take (a review asked of someone else runs on their settings). */
24
+ ignored?: Array<"model" | "effort">;
25
+ /** The review never merges. */
26
+ review_only: boolean;
27
+ /** Present when every merge of this review waits for the acting user's own confirmation, whatever their review mode. */
28
+ merge_needs_confirmation?: true;
29
+ /** Present on a review asked of someone else that may merge: the requester's own account merges it once it is approved and green. */
30
+ merge_by_requester?: true;
31
+ /** With model choice on: the model the review runs on (null: the deployment's default). Absent with model choice off. */
32
+ model?: string | null;
33
+ /** The model it was to run on, which the payer's key could not use. */
34
+ fell_back_from?: string;
35
+ /** Present when the item waits for a slot (`reason`: the limit that was full); it starts by itself. Absent: it started. */
36
+ queued?: {
37
+ reason: string;
38
+ };
39
+ }
40
+ /** A review started for someone else, as the person who asked is answered: the session is the reviewer's, so its ids are left out. */
41
+ export type StartedReviewForRequester = Omit<StartedReview, "session_id" | "message_id">;
42
+ /** What the person who asked for a review someone else runs may see of it, and all they see. */
43
+ export interface RequesterView {
44
+ /** `queued`: made, and waiting for a slot; it starts by itself, and then reads `in_progress`. */
45
+ status: "queued" | "in_progress" | "waiting_for_reviewer" | "done" | "stopped";
46
+ pr_url: string | null;
47
+ verdict: "approve" | "request_changes" | "comment" | null;
48
+ merged: boolean;
49
+ /** Only while `status` is `waiting_for_reviewer`, else null. */
50
+ waiting_for: "confirm_merge" | "confirm_review" | "failed" | "reviewer" | null;
51
+ /** Open findings the review posted on the pull request; null when it posted none (no record yet). */
52
+ findings: number | null;
53
+ /** The first open finding, one line, credentials masked; null when there is none. */
54
+ note: string | null;
55
+ /** What the pull request does, in one sentence the review gave with its verdict; null when it gave none. */
56
+ pr_summary: string | null;
57
+ }
58
+ /** One review the caller asked of someone else (`GET /v1/work-items/asked-of-others`): its id, who reviews it, and the view. */
59
+ export interface AskedOfOther {
60
+ item_id: string;
61
+ reviewer: string | null;
62
+ view: RequesterView;
63
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * A session's event stream as the Claw HTTP API serves it: `GET /v1/chat/sessions/:id/messages` as SSE, and the same
3
+ * history as JSON with `?mode=replay`.
4
+ *
5
+ * Types and constants only. The API builds these in `packages/api/src/routes/events.ts`.
6
+ */
7
+ /**
8
+ * The SSE event that ends the replayed history and starts the live stream. It carries no `id:`, so it never moves a
9
+ * client's Last-Event-ID.
10
+ */
11
+ export declare const HISTORY_COMPLETE_EVENT = "historyComplete";
12
+ /** The `data:` of the `historyComplete` frame. */
13
+ export interface HistoryCompleteData {
14
+ type: typeof HISTORY_COMPLETE_EVENT;
15
+ /** The events the history sent. */
16
+ count: number;
17
+ /** Older events were not sent; `?history=all`, or `?mode=replay` with `after`/`tail`, reads them. */
18
+ has_more: boolean;
19
+ }
20
+ /** One stored event of `?mode=replay`, oldest first: the row the SSE stream sends as `id:` and `data:`. */
21
+ export interface SessionReplayRow<Time = string> {
22
+ event_id: string;
23
+ /** The stored event's name; `data.type` says what it is to a client. */
24
+ event_type: string;
25
+ /** The event, redacted as the stream sends it. */
26
+ data: unknown;
27
+ created_at: Time;
28
+ }
29
+ /** `?mode=replay` with `tail`, `limit` or `after`: one window of the history, and whether more remains past its cut. */
30
+ export interface SessionReplayWindow<Time = string> {
31
+ ok: true;
32
+ data: Array<SessionReplayRow<Time>>;
33
+ has_more: boolean;
34
+ }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Work items as the Claw HTTP API returns them: the board (`GET /v1/work-items`), one item
3
+ * (`GET /v1/work-items/:id`) and the answers of accept, stop and retry
4
+ * (`POST /v1/work-items/:id/{accept,stop,retry}`).
5
+ *
6
+ * Types and constants only. The API builds these from its rows (`packages/api/src/assistant/work-items.ts`);
7
+ * a client of the API reads them. Timestamps are `Date` where the API builds the object and ISO 8601
8
+ * strings on the wire, so every type that carries one takes it as a parameter, `string` by default.
9
+ */
10
+ export declare const BOARD_STATES: readonly ["in_progress", "needs_you", "done"];
11
+ export type BoardState = (typeof BOARD_STATES)[number];
12
+ /** What a worker's report says; the last one is the item's `last_report_kind`. */
13
+ export declare const REPORT_KINDS: readonly ["progress", "waiting", "ready", "answer", "blocked", "failed", "dropped"];
14
+ export type ReportKind = (typeof REPORT_KINDS)[number];
15
+ /** How a `done` item ended. */
16
+ export type WorkItemOutcome = "accepted" | "answered" | "dropped" | "stopped";
17
+ /**
18
+ * `task`: a worker that reports does it. `review`: a GitHub review on someone's behalf (its `params` say which pull
19
+ * request, as whom, how). `remote`: an agent on one of the user's own machines.
20
+ */
21
+ export declare const ITEM_KINDS: readonly ["task", "review", "remote"];
22
+ export type ItemKind = (typeof ITEM_KINDS)[number];
23
+ /** One work item as the board lists it, and as accept, stop and retry answer with it. */
24
+ export interface WorkItemView<Time = string> {
25
+ item_id: string;
26
+ seq: number;
27
+ title: string;
28
+ summary: string;
29
+ board_state: BoardState;
30
+ last_report_kind: ReportKind | null;
31
+ pending_question: string | null;
32
+ outcome: WorkItemOutcome | null;
33
+ result_version: number;
34
+ accepted_version: number | null;
35
+ /** A result waits for this person: `board_state` is `needs_you` and the last report was `ready`. */
36
+ can_accept: boolean;
37
+ kind: ItemKind;
38
+ /** What a review was asked with; `{}` for a task. */
39
+ params: Record<string, unknown>;
40
+ updated_at: Time;
41
+ }
42
+ /** One entry of an item's history, newest first in `WorkItemDetail.events`. */
43
+ export interface WorkItemEvent<Time = string> {
44
+ /** A bigint row id, sent as a string. */
45
+ id: string;
46
+ /**
47
+ * `created`, `run_started`, a report kind (`ReportKind`), `accepted` or `stopped`. Kept a string: a client meets kinds
48
+ * a newer server adds.
49
+ */
50
+ kind: string;
51
+ /** Who wrote it: `worker`, `turn_end`, `sweep`, `watchdog`, `user`, `router`, `policy`, `github`. */
52
+ source: string;
53
+ generation: number;
54
+ run_id: string | null;
55
+ summary: string | null;
56
+ question: string | null;
57
+ /** A `ready` report's result as the worker gave it (`{refs: [{type: "pr", url}], ...}`), the accepted version, or null. */
58
+ result: unknown;
59
+ created_at: Time;
60
+ }
61
+ /** `GET /v1/work-items/:id` for the item's owner: the item, where its worker runs, and its latest events. */
62
+ export interface WorkItemDetail<Time = string> extends WorkItemView<Time> {
63
+ worker_session_id: string;
64
+ /** The repository the item was bound to, as it was asked (`{url, branch?}`), or null. */
65
+ repo: unknown;
66
+ created_at: Time;
67
+ closed_at: Time | null;
68
+ events: Array<WorkItemEvent<Time>>;
69
+ }
70
+ /** Why a review item cannot be stopped: its merge is being made, or was made. */
71
+ export type StopRefusal = "merge_in_progress" | "already_merged";
72
+ /** The `error` of a 409 from accept or stop; its `data` is the item as it is now. */
73
+ export type WorkItemDecisionError = "version_mismatch" | "not_acceptable" | "item_closed" | StopRefusal;
74
+ /** The `error` of a 409 from retry; its `data` is the item as it is now. */
75
+ export type RetryRefusal = "not_retryable" | "too_many_active_items" | "session_not_found" | "no_credentials" | "acting_session_unattended";