@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,50 @@
1
+ import type { Random } from "../../ports/random.js";
2
+ import type { Conversation, UserRef } from "../../ports/surface.js";
3
+ import type { ReviewDeps } from "../service/deps.js";
4
+ import type { GithubAccount } from "../service/account.js";
5
+ /** Claw said it reads this person's GitHub: no need to ask again for this long. */
6
+ export declare const CONNECTED_MS = 600000;
7
+ /** "Not now": no card for this long. */
8
+ export declare const DECLINED_MS: number;
9
+ /** A card was offered: no other for this long, whatever became of it. */
10
+ export declare const SHOWN_MS: number;
11
+ export interface ConnectRequest {
12
+ readonly sender: UserRef;
13
+ readonly credential: string;
14
+ readonly text: string;
15
+ readonly lang: "zh" | "en";
16
+ readonly conversation: Conversation;
17
+ readonly again: () => Promise<void>;
18
+ }
19
+ export declare class GithubConnect {
20
+ private readonly deps;
21
+ private readonly account;
22
+ private readonly random;
23
+ private readonly connected;
24
+ private readonly quiet;
25
+ private readonly offered;
26
+ private readonly narrowHint;
27
+ private readonly wide;
28
+ private readonly hinting;
29
+ private readonly hints;
30
+ constructor(deps: ReviewDeps, account: GithubAccount, random: Random);
31
+ private now;
32
+ /** Settles when the scope hints started so far have ended. */
33
+ idle(): Promise<void>;
34
+ /** The person changed their GitHub connection: what was remembered of it is asked again next time. */
35
+ forget(userId: string): void;
36
+ /** Offers the connect card for a question about the person's own GitHub when Claw cannot read it yet; true when sent. */
37
+ offer(request: ConnectRequest): Promise<boolean>;
38
+ private sendCard;
39
+ private until;
40
+ /** The scope line is looked for in the background: the message goes on at once; one look at a time per person. */
41
+ private startHint;
42
+ /** The device flow of a card ended: once connected, the question is asked again. */
43
+ private bound;
44
+ /** "Not now": the card closes, the question is not asked again, and no card is offered for a day. */
45
+ dismiss(sender: UserRef, data: Readonly<Record<string, unknown>>, lang: "zh" | "en", settle: (text: string) => Promise<unknown>): Promise<void>;
46
+ /** The scope line, when Claw reads this person's GitHub with their binding; never throws. */
47
+ private maybeHint;
48
+ /** The binding reads public repositories only and the message names one GitHub does not show publicly: one line says so. */
49
+ private hintWiderScope;
50
+ }
@@ -0,0 +1,6 @@
1
+ export declare const MAX_QUESTION_CHARS = 2000;
2
+ export declare const MAX_REPOS_LOOKED_AT = 3;
3
+ /** Whether a message asks about the state of the person's own GitHub (a GitHub word, the person, a word of state). */
4
+ export declare function asksAboutOwnGithub(text: string): boolean;
5
+ /** The repositories a message names, each once, in order: a github.com link, or owner/name in a message with a GitHub word. */
6
+ export declare function repositoriesNamed(text: string): [string, string][];
@@ -0,0 +1 @@
1
+ export declare function asksForReview(text: string): boolean;
@@ -0,0 +1,13 @@
1
+ /** What a person agrees to with `/github bind`, and how `/github status` says what Clawy reads their GitHub with. */
2
+ import type { GithubConnection } from "../claw/model.js";
3
+ import type { DeviceCode } from "../ports/github.js";
4
+ export declare const MAX_DEVICE_WAIT_SECONDS: number;
5
+ /** The minutes a code is good for, as the person is told it. */
6
+ export declare function codeMinutes(code: DeviceCode): number;
7
+ /**
8
+ * What `/github bind` asks the person to agree to, Chinese then English. `reads`: Claw reads GitHub with the binding too
9
+ * (or could not say whether it does: then the wider use is what they are told), so the consent says that.
10
+ */
11
+ export declare function consentText(code: DeviceCode, reads: boolean): string;
12
+ /** The line of `/github status` that says whether Clawy reads the person's GitHub with this binding, as Claw says it. */
13
+ export declare function readsLine(connection: GithubConnection | null, known: boolean): string;
@@ -0,0 +1,22 @@
1
+ import type { PullRef } from "../claw/model.js";
2
+ export declare const MAX_PULLS_PER_REQUEST = 30;
3
+ export declare const HELD_SAYS_MAX = 5;
4
+ export declare const HELD_SAY_MAX_CHARS = 4000;
5
+ /** What Claw takes of the asker's own words (`requester_note`), which it quotes to the reviewer as untrusted. */
6
+ export declare const REQUESTER_NOTE_MAX = 2000;
7
+ /** The handoff a 1:1 message declares (`channel_context.handoffs`) and Claw names its action with. */
8
+ export declare const REVIEW_HANDOFF = "review_for_other";
9
+ export interface ReviewHandoff {
10
+ readonly reviewerUserId: string;
11
+ readonly reviewerName: string;
12
+ readonly pulls: readonly PullRef[];
13
+ readonly merge: boolean;
14
+ /** The person's own message, quoted to the reviewer as untrusted. */
15
+ readonly note: string;
16
+ /** The record Claw kept of the handoff, echoed when the review is started ('' from a Claw that sends none). */
17
+ readonly handoffId: string;
18
+ /** What the assistant said in the same turn before handing this over: the answer to the handoff carries it. */
19
+ readonly said: readonly string[];
20
+ }
21
+ /** The `review` of an `assistant.action`, or undefined when it is not one in every field. */
22
+ export declare function parseReviewHandoff(raw: unknown): ReviewHandoff | undefined;
@@ -0,0 +1,15 @@
1
+ import type { PullRef } from "../claw/model.js";
2
+ export declare const CONFIRMATION_FALLBACK_SECONDS = 3600;
3
+ export declare const CONFIRMATION_MAX_SECONDS: number;
4
+ export declare const MAX_CONFIRMATIONS_PER_TURN = 3;
5
+ /** What a held review can be (Claw holds a high-risk approval; a card shows whichever it holds). */
6
+ export declare const REVIEW_EVENTS: readonly string[];
7
+ /**
8
+ * When Claw says a confirmation runs out, as epoch seconds: never later than a day from now, and a short life when it does
9
+ * not say, or says something that is not a time with an offset.
10
+ */
11
+ export declare function expiryOf(value: unknown, now: number): number;
12
+ /** Claw's confirmation names this very pull request (a record that names none is not one that does). */
13
+ export declare function namesPull(item: Readonly<Record<string, unknown>>, pull: PullRef): boolean;
14
+ /** The review a confirmation of kind `review` holds (`{event, body, comments}`), or undefined when a card cannot show it. */
15
+ export declare function heldReview(item: Readonly<Record<string, unknown>>): Readonly<Record<string, unknown>> | undefined;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The GitHub review delegation: a colleague reviews (and, when it is safe, merges) a public pull request as the person who
3
+ * was named for it, on that person's own GitHub account, which only Claw's restricted review tools use on the server.
4
+ */
5
+ export * from "./views.js";
6
+ export { REVIEW_MODE_NAMES, isReviewMode, type ReviewMode } from "./review-turn.js";
7
+ export { connectionsText, UNKNOWN, type ConnectionsInput } from "./connect/connections.js";
8
+ export { GithubReview } from "./service/github-review.js";
9
+ export { ReviewHandoffAction, type HandoffActionDeps } from "./service/handoff-action.js";
10
+ export type { ReviewDeps, ReviewHost, StartReviewTurn, Guard, Audit, FollowWire, RestoreRef } from "./service/deps.js";
11
+ export type { PostWorkCard } from "./service/notices.js";
12
+ export { reviewTurnStart, routedReviewTurns, type AfterReviewTurn, type StartRouterTurn, } from "./service/routed-turn.js";
13
+ export { parseReviewHandoff, REVIEW_HANDOFF, type ReviewHandoff } from "./handoff.js";
14
+ export type { ReviewTurn } from "./review-turn.js";
@@ -0,0 +1,36 @@
1
+ import { type Mention } from "../review-text/names.js";
2
+ import { type PullKey } from "../review-text/pull-ref.js";
3
+ import type { PullRef } from "../claw/model.js";
4
+ import { type ReviewAsk } from "./request-parse.js";
5
+ export declare const INTENTS: readonly ["review_merge", "review", "none"];
6
+ /** What the reading comes to. */
7
+ export type IntentVerdict =
8
+ /** Not a request to review: chat, as ever. */
9
+ {
10
+ readonly kind: "chat";
11
+ }
12
+ /** The one question to ask back. */
13
+ | {
14
+ readonly kind: "question";
15
+ readonly text: string;
16
+ } | {
17
+ readonly kind: "ask";
18
+ readonly ask: ReviewAsk;
19
+ }
20
+ /** The answer is no reading at all (not JSON, an unknown intent, a field of the wrong type): the rules read it. */
21
+ | {
22
+ readonly kind: "unreadable";
23
+ readonly why: string;
24
+ };
25
+ /**
26
+ * Which of the message's pull requests (`keys`) one entry of the model's "prs" is: a link or owner/repo#N, or a number as
27
+ * the asker wrote it ("245", "#245", "PR 245", "PrimusClaw#245") when exactly one of them has that number (and that
28
+ * repository, when one is written).
29
+ */
30
+ export declare function pullsWritten(item: string, keys: ReadonlySet<PullKey>): Set<PullKey>;
31
+ /**
32
+ * The model's reading of a request, held to the message. `text` is what the asker wrote (with the addresses behind its
33
+ * links), never a message it quotes: a quote may name the pull requests (`found` is read from it too), never the reviewer
34
+ * or the model. `direct`: a 1:1 chat, where naming nobody means the asker.
35
+ */
36
+ export declare function checkIntent(raw: Readonly<Record<string, unknown>>, text: string, mentions: readonly Mention[], found: readonly PullRef[], direct?: boolean): IntentVerdict;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * How Claw's answer to a held write reads to the reviewer (the card that replaces the click) and to the group, in that
3
+ * order. A status that is not the kind's own (`merged` for a merge, `submitted` for a review) is a refusal and says why when
4
+ * Claw did; a merge put in the base branch's merge queue is queued, never merged; and a try that already wrote to GitHub is
5
+ * never said not to have happened.
6
+ */
7
+ import type { PublicErrors } from "../public-error/public-errors.js";
8
+ /** What one confirmation flow says for what Claw holds: only these sentences differ between a merge and a review. */
9
+ export interface HeldWords {
10
+ /** Of the note card that replaces a click. */
11
+ readonly title: string;
12
+ /** What is acted on. */
13
+ readonly thing: string;
14
+ /** What did not happen when it was refused. */
15
+ readonly verb: string;
16
+ /** The status Claw answers when it did. */
17
+ readonly done: string;
18
+ readonly review: boolean;
19
+ }
20
+ /** The held write a confirmation row records. */
21
+ export interface HeldRow {
22
+ readonly repo: string;
23
+ readonly pr: number;
24
+ readonly kind: string;
25
+ readonly event: string;
26
+ }
27
+ export declare function heldWords(row: HeldRow): HeldWords;
28
+ export type Lines = readonly [card: string, group: string];
29
+ /** A merge Claw put in the merge queue: queued, and not merged (the queue merges it, or takes it out, later). */
30
+ export declare function queuedLines(pull: string, name: string, outcome: Readonly<Record<string, unknown>>): Lines;
31
+ /** The lines for a reason Claw's gates name when an allowed write was refused anyway; undefined keeps the generic line. */
32
+ export declare function refusalLines(reason: string, pull: string, name: string, review: boolean, outcome: Readonly<Record<string, unknown>>, errors: PublicErrors): Lines | undefined;
33
+ /** How Claw's answer to a decision reads: [the reviewer's card, the group]. */
34
+ export declare function outcomeLines(row: HeldRow, words: HeldWords, outcome: Readonly<Record<string, unknown>>, name: string, errors: PublicErrors): Lines;
35
+ /** "3 passed, 1 failed, 2 pending" of a confirmation's checks ('' when Claw gave none). */
36
+ export declare function checksText(checks: unknown): string;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * How the asker of a review someone else runs hears of it: only its asker view (state, link, conclusion, merged, what a
3
+ * waiting one waits for, what it found), as one line for one review, or one message for a request's several. And what the
4
+ * reviewer hears when the reviews asked of them end. `viewStage` is the key that changes exactly when there is news.
5
+ */
6
+ import type { AskerView, PullRef } from "../claw/model.js";
7
+ import { type ReviewTurn } from "./review-turn.js";
8
+ export declare const ITEM_STOPPED_ZH = "\u5DF2\u505C\u6B62";
9
+ /** One review someone else runs while its asker follows it. */
10
+ export interface Followed {
11
+ readonly review: ReviewTurn;
12
+ /** What the asker was told of it last (`viewStage`). */
13
+ said: string;
14
+ /** Its reviewer was told it waits for them. */
15
+ reviewerTold: boolean;
16
+ /** Followed again after a restart: this worker has no card of it to close. */
17
+ readonly resumed: boolean;
18
+ /** Claw said it waits for a slot: only then is its start news. */
19
+ seenQueued: boolean;
20
+ }
21
+ export declare function followedItemId(entry: Followed): string;
22
+ /** The words of how a view stands: its conclusion and whether it merged, or how it ended. */
23
+ export declare function viewWords(view: AskerView): string;
24
+ /** Claw's `pr_url` when it is a pull request's address, else the address of the pull request the request named. */
25
+ export declare function shownPrUrl(prUrl: string, pull: PullRef): string;
26
+ /** What the asker of a review someone else ran hears of it, once. */
27
+ export declare function requesterResultText(review: ReviewTurn, view: AskerView): string;
28
+ /** How a review item ended, as its card in the asker's chat shows it once its Stop is gone. */
29
+ export declare function itemEndText(view: AskerView): string;
30
+ /** How a review of one's own ended, as its card shows it: from what its turn left on GitHub. */
31
+ export declare function ownItemEndText(review: ReviewTurn): string;
32
+ /** What the reviewer hears when a review asked of them ends. */
33
+ export declare function reviewerResultText(review: ReviewTurn, view: AskerView): string;
34
+ /** What the asker has been told of a review, as a key that changes exactly when there is news ('' nothing yet). */
35
+ export declare function viewStage(view: AskerView): string;
36
+ /** `viewStage` for one followed review, with one more piece of news: a review that waited for a slot has 'started'. */
37
+ export declare function entryStage(entry: Followed, view: AskerView): string;
38
+ /** The conclusion a `viewStage` key holds ('' none). */
39
+ export declare function stageVerdict(stage: string): string;
40
+ /** How a review someone else runs stands, as its asker is told. `started`: it waited for a slot, and has just started. */
41
+ export declare function progressWords(review: ReviewTurn, view: AskerView, started?: boolean): string;
42
+ /**
43
+ * One message for what is news of a request's reviews asked of someone else: one line for a request of one review; for
44
+ * several, a count of how many have a conclusion and how many ended, then the news, then what the others are doing.
45
+ */
46
+ export declare function progressText(entries: readonly Followed[], told: readonly (readonly [Followed, AskerView])[]): string;
47
+ /** The asker's last line when the reviews they follow are still open at the deadline. */
48
+ export declare function unfinishedText(left: readonly Followed[]): string;
49
+ /** What the reviewer hears when reviews asked of them end. */
50
+ export declare function reviewerEndedText(ended: readonly (readonly [Followed, AskerView])[]): string;
@@ -0,0 +1,2 @@
1
+ import type { ReviewTurn } from "./review-turn.js";
2
+ export declare function reviewPrompt(review: ReviewTurn): string;
@@ -0,0 +1,45 @@
1
+ import type { GithubOutcome } from "../turn/github-outcome.js";
2
+ import { type ReviewTurn } from "./review-turn.js";
3
+ export declare const SUMMARY_CHARS = 1200;
4
+ export declare const DM_SUMMARY_CHARS = 700;
5
+ /** One call of a write tool, as the stream showed it: the tool, the status it answered, the review's event. */
6
+ export type ToolResult = GithubOutcome;
7
+ /**
8
+ * The text with each tool name or state the model wrote by its code said in plain words, in Chinese when the text has any
9
+ * Chinese. A line that has a file:line is a finding about the code under review: it is left as it is.
10
+ */
11
+ export declare function plainWords(text: string): string;
12
+ /** A model id as shown: a model id's characters only, at most 100 (it may come from the gateway). */
13
+ export declare function modelId(model: string, limit?: number): string;
14
+ /** The one line that says which model a review ran on, and that it ran under the reviewer's fully automatic setting. */
15
+ export declare function modelNote(model: string, zh: boolean, autoOfName?: string): string;
16
+ /** At most `limit` characters of `text`, said to be shortened, with a link to the whole answer when there is one. */
17
+ export declare function clipSummary(text: string, limit: number, link?: string): string;
18
+ /** The answer without its last line when that is the VERDICT line. */
19
+ export declare function withoutVerdict(answer: string): string;
20
+ /** What a group is told of an answer: without its verdict line, in plain words, at most SUMMARY_CHARS, and the model note. */
21
+ export declare function shapeGroupAnswer(answer: string, options?: {
22
+ link?: string;
23
+ model?: string;
24
+ autoOf?: string;
25
+ }): string;
26
+ /**
27
+ * The one line that says how a review came out, shown the moment the stream shows it. undefined when this call does not
28
+ * settle it: a review that may merge is settled by the merge call (or by a review held or asking for changes), a review
29
+ * only by the review call.
30
+ */
31
+ export declare function resultLine(review: ReviewTurn, outcome: ToolResult, model: string): string | undefined;
32
+ /**
33
+ * The head of a review's one message: the verdict, whether it merged, how many inline comments it left, the model and the
34
+ * link, from every result the stream showed (the last review call for the verdict, the last merge call for the merge).
35
+ */
36
+ export declare function reviewHeadline(review: ReviewTurn, results: readonly ToolResult[], comments: number, model: string, lang?: "zh" | "en" | ""): string;
37
+ export interface AnswerParts {
38
+ readonly link?: string;
39
+ readonly model?: string;
40
+ readonly results?: readonly ToolResult[];
41
+ readonly comments?: number;
42
+ readonly prSummary?: string;
43
+ }
44
+ /** A review's ONE message where it was asked: the headline, the summary line, then the answer in plain words. */
45
+ export declare function reviewAnswer(review: ReviewTurn, answer: string, parts: AnswerParts): string;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * What the asker is told when Claw starts none, or only some, of a request's reviews, and the acknowledgement's notes of
3
+ * what Claw made: each item's number, which wait for a slot and why, how the merges will be made, and the model Claw chose.
4
+ * Everything here is from Claw's answer, never from what a model said.
5
+ */
6
+ import type { ReviewsRefused } from "../claw/errors.js";
7
+ import type { PublicErrors } from "../public-error/public-errors.js";
8
+ import type { PullRef } from "../claw/model.js";
9
+ import { type ReviewTurn } from "./review-turn.js";
10
+ /** One request may name this many pull requests; each is reviewed in a session of its own. */
11
+ export declare const MAX_PULLS_PER_REQUEST = 30;
12
+ /** ... of which this many start at once; Claw queues the rest and starts each as one of the request's ends. */
13
+ export declare const REVIEWS_STARTED_AT_ONCE = 10;
14
+ export declare const MAX_MODELS_LISTED = 30;
15
+ export declare const ALREADY = "\u5DF2\u7ECF\u5728 review \u4E2D";
16
+ /** Why Claw would not start a review of one pull request (`pr_check_failed`), as the asker is told it. */
17
+ export declare const PR_CHECK_REASONS: Readonly<Record<string, string>>;
18
+ /** ... and why it would start none for this reviewer: no pull request of theirs would fare better on its own. */
19
+ export declare const REVIEWER_REASONS: Readonly<Record<string, (who: string) => string>>;
20
+ /** A refusal of one pull request of the request. */
21
+ export declare const ONE_PULL: readonly string[];
22
+ /** The reasons Claw gives for refusing a service's answer for a person, said as such. */
23
+ export declare const SERVICE_REFUSAL_REASONS: Readonly<Record<string, string>>;
24
+ /** The sentence for a refusal of Claw's: its reason (a word it does not name is the last one) and what was not done. */
25
+ export declare function serviceRefusal(code: string, undone: string): string;
26
+ /** What the asker is told when Claw started none of the reviews. */
27
+ export declare function batchRefusal(err: ReviewsRefused, who: string, count: number, errors: PublicErrors): string;
28
+ /** Why a review waits for a slot, in the words of whoever is told: the asker, or the reviewer. */
29
+ export declare function queueReason(reason: string, reviewer: string, requester?: string, toReviewer?: boolean): string;
30
+ /** The items Claw made for these reviews, by number, and which wait for a slot and why ('' when Claw made none). */
31
+ export declare function itemsNote(reviews: readonly ReviewTurn[], who: string): string;
32
+ export declare function shorts(pulls: readonly PullRef[]): string;
33
+ export declare function refusedText(refused: readonly (readonly [PullRef, string])[]): string;
34
+ /**
35
+ * What the receipt adds about the model when Claw chose it otherwise than asked: the model it was to run on and cannot (the
36
+ * key that pays cannot use it), or a model the asker named for a review someone else runs on their own settings. '' else.
37
+ */
38
+ export declare function modelChosenNote(review: ReviewTurn, who: string, asked: string): string;
39
+ /**
40
+ * What the receipt says of how the merges will be made: only what the reviews started say. Every one waits for the
41
+ * reviewer's confirmation: that, plainly. Otherwise the reviewer's fully automatic setting is said, a held one among the
42
+ * others is named, and a merge Claw makes with the asker's own account is said. '' when there is nothing to say.
43
+ */
44
+ export declare function mergeLine(reviews: readonly ReviewTurn[], who: string, merge: boolean, auto: boolean): string;
@@ -0,0 +1,40 @@
1
+ import { type Mention } from "../review-text/names.js";
2
+ import type { PullRef } from "../claw/model.js";
3
+ /** What a request says. */
4
+ export interface ReviewAsk {
5
+ /** The text between 请 and 帮我, markers kept and the model taken out; '' when nobody was named. */
6
+ readonly who: string;
7
+ readonly mentions: readonly Mention[];
8
+ /** The distinct pull requests it points at, in the order it names them. */
9
+ readonly pulls: readonly PullRef[];
10
+ /** The distinct models it names ("用 X 帮我 review", "model: X"); none: the default. */
11
+ readonly models: readonly string[];
12
+ /** Who each later "请 XX review 合入 ..." of the same message names. */
13
+ readonly again: readonly string[];
14
+ /** The channel ids of everyone the message names or mentions (set once that is checked). */
15
+ readonly named: readonly string[];
16
+ /** The repository bare numbers were read as; '' when none were. */
17
+ readonly repo: string;
18
+ /** Numbers written on their own that were not taken as pull requests: named in the acknowledgement. */
19
+ readonly unread: readonly number[];
20
+ /** False: a review only, never a merge. */
21
+ readonly merge: boolean;
22
+ /** The record Claw kept of a review the assistant handed back; '' for a typed request. */
23
+ readonly handoffId: string;
24
+ }
25
+ export declare function reviewAsk(fields: Partial<ReviewAsk> & Pick<ReviewAsk, "who" | "pulls">): ReviewAsk;
26
+ /**
27
+ * A named request is read only when its "review 合入" starts within this many code points of the text (Python
28
+ * `MAX_ASK_HEAD_CHARS`): the name before it is a few words, and a long list of pull requests may follow it.
29
+ */
30
+ export declare const NAMED_ASK_MAX = 1000;
31
+ /**
32
+ * The request a message makes, or undefined when it is not one. It is one when it says 请 ... 帮我 review 合入, or says
33
+ * "review 合入" and points at a pull request; a review only when it says 请 XX 帮我 review <PR> with no word of merging.
34
+ */
35
+ export declare function parseReviewAsk(text: string, mentions: readonly Mention[]): ReviewAsk | undefined;
36
+ /**
37
+ * The names a later line of the same message gives that are not the person the first line names (a mention is the person
38
+ * its id says, whatever its display name). A line that names nobody says nothing about it.
39
+ */
40
+ export declare function otherReviewers(ask: ReviewAsk): string[];
@@ -0,0 +1,83 @@
1
+ /**
2
+ * One review while it runs: who asked, for whom, where the asker and the reviewer are reached, and what Claw made of it.
3
+ * Mutable on purpose, as the Python worker's `ReviewTurn`: the turn fills in what it left on GitHub, the model it ran on and
4
+ * the pull request's one-line summary as it learns them.
5
+ */
6
+ import type { AskerView, ReviewStart, PullRef } from "../claw/model.js";
7
+ import type { JsonObject } from "../json.js";
8
+ import type { ConversationRef } from "../ports/surface.js";
9
+ export type ReviewMode = "high_risk_confirm" | "fully_auto";
10
+ export declare const DEFAULT_MODE: ReviewMode;
11
+ export declare const REVIEW_MODE_NAMES: readonly ReviewMode[];
12
+ export declare function isReviewMode(value: unknown): value is ReviewMode;
13
+ /** What a turn left on GitHub: the tool, the status it answered and the review's event ("" none). */
14
+ export type Wrote = readonly [tool: string, status: string, event: string];
15
+ export interface ReviewTurn {
16
+ readonly requesterId: string;
17
+ readonly requesterName: string;
18
+ readonly requesterChannelId: string;
19
+ readonly actorId: string;
20
+ /** The reviewer's Claw user id. */
21
+ actorUserId: string;
22
+ readonly actorName: string;
23
+ readonly actorChannelId: string;
24
+ readonly pull: PullRef;
25
+ /** Where the request was asked (the group's, or the asker's own chat). */
26
+ readonly asked: ConversationRef | undefined;
27
+ /** Set when Claw has made the session. */
28
+ sessionId: string;
29
+ /** The model the request named ('' the default); Claw's own once it says (`modelReported`). */
30
+ model: string;
31
+ modelReported: boolean;
32
+ /** The reviewer's confirmation setting when the review started. */
33
+ reviewMode: ReviewMode;
34
+ /** Every merge waits for the reviewer's own confirmation, whatever their setting. */
35
+ mergeHeld: boolean;
36
+ /** The pull request's title as GitHub's public read gave it ('' not read). */
37
+ readonly title: string;
38
+ /** The chat it was asked in, as the reviewer's notice names it (the group's name, "群聊" or "私聊"). */
39
+ readonly where: string;
40
+ readonly fromGroup: boolean;
41
+ readonly lang: "zh" | "en";
42
+ /** What the turn left on GitHub (set after the turn). */
43
+ wrote: Wrote[];
44
+ /** The turn's sentence of what the pull request does (set after the turn). */
45
+ prSummary: string;
46
+ /** The model the turn ran on ('' the default; set after the turn). */
47
+ ranModel: string;
48
+ readonly reviewOnly: boolean;
49
+ /** The reviewer's GitHub login, as the identity service named it when the review started. */
50
+ readonly actorLogin: string;
51
+ /** The review item Claw made for it; undefined: the session was made here. */
52
+ item: ReviewStart | undefined;
53
+ /** The item is the reviewer's own (asked of someone else): followed by its asker view, never its session. */
54
+ forReviewer: boolean;
55
+ /**
56
+ * A review asked of someone else whose session is made here because Claw answered 404: asks Claw once more for it as the
57
+ * reviewer's item when the session is then refused. True: the asker was told; false: the turn says its own failure.
58
+ */
59
+ asItem: (() => Promise<boolean>) | undefined;
60
+ /** The acknowledgement shown at the top of the review's progress message ('' nothing to acknowledge). */
61
+ ack: string;
62
+ }
63
+ export type NewReviewTurn = Pick<ReviewTurn, "requesterId" | "requesterName" | "actorId" | "actorUserId" | "actorName" | "actorChannelId" | "pull"> & Partial<ReviewTurn>;
64
+ export declare function reviewTurn(fields: NewReviewTurn): ReviewTurn;
65
+ export declare function selfReview(review: ReviewTurn): boolean;
66
+ /** The reviewer's name when the review runs under their fully automatic setting (and nothing holds its merge), else ''. */
67
+ export declare function autoOf(review: ReviewTurn): string;
68
+ /** The reviewer's name as the asker reads it ("对方" when there is none). */
69
+ export declare function reviewerName(review: ReviewTurn): string;
70
+ /** The asker's name as the reviewer reads it ("有同事" when there is none). */
71
+ export declare function askerName(review: ReviewTurn): string;
72
+ export declare function viewFinished(view: AskerView): boolean;
73
+ export declare function viewWaitsForReviewer(view: AskerView): boolean;
74
+ /**
75
+ * What is kept of a followed review (`asker_follows.review`): names, chats and the pull request, never a credential. The
76
+ * JSON keys are the Python worker's, so either worker reads what the other wrote. `wire` carries the reply-address fields
77
+ * the channel needs to open the reviewer's chat (Teams: service url, tenant, bot id), kept as the channel gave them.
78
+ */
79
+ export declare function followRecord(review: ReviewTurn, wire: JsonObject): JsonObject;
80
+ /** A followed review again, from what was kept of it; undefined when it cannot be read (it is then let go). */
81
+ export declare function reviewOfRecord(raw: unknown): ReviewTurn | undefined;
82
+ /** A display name as it is kept on one line (at most 100 characters). */
83
+ export declare function keptName(name: string): string;
@@ -0,0 +1,52 @@
1
+ import { type CredentialFailure, type DeviceCode } from "../../ports/github.js";
2
+ import type { Conversation, OutMessage, UserRef } from "../../ports/surface.js";
3
+ import { type ReviewMode } from "../review-turn.js";
4
+ import type { ReviewDeps } from "./deps.js";
5
+ /** `(connected, login)` once a device flow has ended, for a question that waited for it. */
6
+ export type OnBound = (connected: boolean, login: string) => Promise<void>;
7
+ export declare class GithubAccount {
8
+ private readonly deps;
9
+ /** Teams user -> the device flow that waits for their approval. */
10
+ private readonly binding;
11
+ /** Teams user -> the confirmation setting chosen while their binding is made. */
12
+ private readonly modeChosen;
13
+ constructor(deps: ReviewDeps);
14
+ /** Settles when every device flow started so far has ended (for tests and an orderly stop). */
15
+ idle(): Promise<void>;
16
+ /** `/github ...` in a 1:1 chat. */
17
+ command(sender: UserRef, args: string, conversation: Conversation): Promise<void>;
18
+ private run;
19
+ /** The identity service does not know this chat's user: they connect their Primus account first, then ask again. */
20
+ connectFirst(sender: UserRef, conversation: Conversation): Promise<void>;
21
+ private waiting;
22
+ private bind;
23
+ /**
24
+ * The device flow started for a question that needs the person's GitHub (the connect card shows the code): the code, or
25
+ * undefined when there is nothing to start (connected already, a code already waits, or GitHub gave none). `onDone` runs
26
+ * once when the flow ends; the default confirmation applies. A failure of the identity service is returned.
27
+ */
28
+ bindForQuestion(sender: UserRef, conversation: Conversation, onDone: OnBound): Promise<DeviceCode | CredentialFailure | undefined>;
29
+ private startBinding;
30
+ /** Waits for the approval and hands the token to the identity service, in memory only. */
31
+ private finishBind;
32
+ /** (connected, the GitHub login) once the flow has ended; every way it can end is said to the person here. */
33
+ private waitAndBind;
34
+ private bindRefusal;
35
+ /** What the person is told once GitHub is connected: the review settings, or (`short`, a question waits) one line. */
36
+ private bound;
37
+ /** A click on one of the two confirmation settings: the clicker's own binding is the only one changed. */
38
+ modeClick(sender: UserRef, data: Readonly<Record<string, unknown>>, settle: (text: string) => Promise<unknown>, conversation: Conversation): Promise<void>;
39
+ /**
40
+ * The one way a person's choice of a confirmation setting is carried out, pressed or typed: while their binding is being
41
+ * made it waits for it; otherwise it is written now, as them. (What they are told, and whether to connect first.)
42
+ */
43
+ chooseMode(sender: UserRef, mode: ReviewMode): Promise<readonly [string, boolean]>;
44
+ /** The confirmation-setting card; it says how to answer by typing until a click of the person's has arrived. */
45
+ modeCard(userId: string, current: ReviewMode | "", suggested: ReviewMode | "", lead: string): OutMessage;
46
+ private mode;
47
+ /** Shows the card for a 1:1 message that asked about the setting (`suggested`: the one asked for; undefined: show it). */
48
+ showMode(sender: UserRef, suggested: ReviewMode | "" | "show", conversation: Conversation): Promise<void>;
49
+ private unbind;
50
+ status(sender: UserRef, conversation: Conversation): Promise<CredentialFailure | undefined>;
51
+ private autoMerge;
52
+ }
@@ -0,0 +1,18 @@
1
+ import { type Conversation, type ConversationRef, type OutMessage } from "../../ports/surface.js";
2
+ import type { ReviewDeps } from "./deps.js";
3
+ export declare function say(deps: ReviewDeps, conversation: Conversation, text: string): Promise<void>;
4
+ /** `say`, logging instead of failing: for a line that must not end the flow that sends it. */
5
+ export declare function sayQuietly(deps: ReviewDeps, conversation: Conversation, text: string, what: string): Promise<boolean>;
6
+ export declare function send(conversation: Conversation, message: OutMessage): Promise<void>;
7
+ /** The conversation a stored reference points at, or undefined when it cannot be read. */
8
+ export declare function stored(deps: ReviewDeps, reference: unknown): Conversation | undefined;
9
+ /** Who a person is, to reach their own chat. */
10
+ export interface Reachable {
11
+ readonly userId: string;
12
+ readonly channelUserId: string;
13
+ }
14
+ /**
15
+ * A conversation into this person's 1:1 chat with the bot: the one the store knows, else one the channel opens through
16
+ * `via` (a conversation both are in). undefined when neither works.
17
+ */
18
+ export declare function personalChat(deps: ReviewDeps, person: Reachable, via: ConversationRef | undefined): Promise<Conversation | undefined>;
@@ -0,0 +1,49 @@
1
+ import type { GithubConfirmation } from "../../ports/store/github.js";
2
+ import type { Conversation, OutMessage, UserRef } from "../../ports/surface.js";
3
+ import type { ReviewTurn } from "../review-turn.js";
4
+ import type { ReviewDeps } from "./deps.js";
5
+ import type { GithubAccount } from "./account.js";
6
+ import type { Notices } from "./notices.js";
7
+ /** How an answer to a held write ended. */
8
+ export interface Answered {
9
+ /** What the person is told. */
10
+ readonly text: string;
11
+ /** Still pending: the buttons stay, and they may answer again. */
12
+ readonly open: boolean;
13
+ /** They must connect their Primus account first. */
14
+ readonly connect: boolean;
15
+ /** What the group that asked is told ('' none). */
16
+ readonly group: string;
17
+ }
18
+ /** How a click is settled (the router's `ClickRoute.settle`). */
19
+ export type Settle = (card: OutMessage | string, fallback?: string) => Promise<unknown>;
20
+ export declare class HeldWrites {
21
+ private readonly deps;
22
+ private readonly notices;
23
+ private readonly account;
24
+ constructor(deps: ReviewDeps, notices: Notices, account: GithubAccount);
25
+ /** One write Claw holds, offered to the reviewer; a record that is not for this review is not sent. */
26
+ offer(review: ReviewTurn, item: Readonly<Record<string, unknown>>, asked: Conversation): Promise<void>;
27
+ /**
28
+ * What Claw's record holds: the review it holds (null for a merge), or undefined when it is not for this review, or holds
29
+ * nothing a card can show (a card that names another pull request would be answered as if it were this one).
30
+ */
31
+ private heldOf;
32
+ private sendCard;
33
+ /** A click on Merge / Do not merge (Post review / Do not post). */
34
+ click(sender: UserRef, data: Readonly<Record<string, unknown>>, settle: Settle, conversation: Conversation): Promise<void>;
35
+ /** What follows an answer: the card that connects the person when needed, and the group told how it ended. */
36
+ private afterAnswer;
37
+ /** THE answer of the person a held write waits for. `row` is the store's and its owner is `sender` (the caller checked). */
38
+ answer(row: GithubConfirmation, sender: UserRef, decision: "allow" | "deny", typed: boolean): Promise<Answered>;
39
+ private decide;
40
+ private decided;
41
+ /**
42
+ * A 1:1 message that answers, in the person's own words, what waits for them: held writes (by number, or all), or the
43
+ * confirmation setting. It decides exactly as a press does. True when the message was one (handled).
44
+ */
45
+ typed(sender: UserRef, text: string, conversation: Conversation): Promise<boolean>;
46
+ private typedDecisions;
47
+ /** The model's word on whether a 1:1 message answers what waits for the person: 'answer', 'none', or undefined. */
48
+ private readAnswer;
49
+ }