@primusclaw/personal-agent 0.0.0-stage → 0.1.0

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 +31873 -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,65 @@
1
+ import { type GithubState } from "../../ports/github.js";
2
+ import type { Conversation, InboundMessage, UserRef } from "../../ports/surface.js";
3
+ import type { PullRef } from "../../claw/model.js";
4
+ import type { ReviewAsk } from "../request-parse.js";
5
+ import { type ReviewTurn } from "../review-turn.js";
6
+ import type { ReviewDeps, ReviewTaskSlots } from "./deps.js";
7
+ import type { ReviewItems } from "./items.js";
8
+ import type { Notices } from "./notices.js";
9
+ import type { Actor, ReviewerReader } from "./reviewer.js";
10
+ /** Where and by whom a request was made. */
11
+ export interface RequestContext {
12
+ readonly message: InboundMessage;
13
+ readonly sender: UserRef;
14
+ readonly conversation: Conversation;
15
+ readonly scope: string;
16
+ /** What the person wrote (the asker's note to the reviewer). */
17
+ readonly text: string;
18
+ readonly group: boolean;
19
+ }
20
+ /** What `take` settled, for the start: who asks and for whom, with what. */
21
+ export interface Settled {
22
+ readonly ctx: RequestContext;
23
+ readonly ask: ReviewAsk;
24
+ readonly token: string;
25
+ readonly modelKey: string;
26
+ readonly requester: Actor;
27
+ readonly actor: Actor;
28
+ readonly state: GithubState;
29
+ readonly model: string;
30
+ readonly actingToken: string;
31
+ readonly actingKey: string;
32
+ readonly reviews: ReviewTurn[];
33
+ readonly refused: [PullRef, string][];
34
+ readonly several: boolean;
35
+ /** Gives back the per-person count of each review given to it that did not start. */
36
+ readonly giveBack: (notStarted: readonly ReviewTurn[]) => void;
37
+ readonly slots: ReviewTaskSlots | undefined;
38
+ }
39
+ export type Launch = (settled: Settled, held: PullRef[], handed: PullRef[]) => Promise<void>;
40
+ export declare class ReviewChecks {
41
+ private readonly deps;
42
+ private readonly reviewers;
43
+ private readonly items;
44
+ private readonly notices;
45
+ private readonly launch;
46
+ constructor(deps: ReviewDeps, reviewers: ReviewerReader, items: ReviewItems, notices: Notices, launch: Launch);
47
+ private say;
48
+ /** The pull requests' checks, then `take`. `named`: the reviewer, already known (a handoff); undefined: read from the message. */
49
+ request(ctx: RequestContext, ask: ReviewAsk, named?: Actor): Promise<void>;
50
+ /** The asker's identity token, or undefined when they were told what to do. */
51
+ private askerToken;
52
+ /** Who reviews: the asker (a 1:1 chat that names nobody), the reviewer a handoff named, or the one the message names. */
53
+ private whoReviews;
54
+ /** The reviewer's GitHub binding, usable and authorized, or undefined when the asker was told why not. */
55
+ private reviewerState;
56
+ /** A review asked of someone else runs on their own token and key: both, or undefined when the asker was told. */
57
+ private actingCredentials;
58
+ /** The model the request named, as the key that pays may use it; '' the default; undefined when the asker was told why not. */
59
+ private modelFor;
60
+ private take;
61
+ /** One review per pull request, each counted for the asker; a pull request its reviewer wrote is refused. */
62
+ private build;
63
+ /** The task limit, checked before Claw is asked: only the reviews that start now hold a slot. */
64
+ private admit;
65
+ }
@@ -0,0 +1,38 @@
1
+ import type { Conversation } from "../../ports/surface.js";
2
+ import type { GithubOutcome } from "../../turn/github-outcome.js";
3
+ import type { ReviewTurnOptions, ReviewTurnOutcome } from "../../turn/runner.js";
4
+ import { type ReviewTurn } from "../review-turn.js";
5
+ import type { ReviewDeps } from "./deps.js";
6
+ import type { AskerFollow } from "./follow.js";
7
+ import type { ItemCards } from "./item-cards.js";
8
+ import type { Notices } from "./notices.js";
9
+ import type { Settled } from "./start.js";
10
+ /** Offers what Claw holds for the reviewer after a turn (`confirm.ts`). */
11
+ export type OfferHeld = (review: ReviewTurn, item: Readonly<Record<string, unknown>>, asked: Conversation) => Promise<void>;
12
+ export declare class ReviewTurns {
13
+ private readonly deps;
14
+ private readonly notices;
15
+ private readonly cards;
16
+ private readonly follows;
17
+ offerHeld: OfferHeld;
18
+ /** Starts a review's items again for the reviewer (`launch.ts`), set by the assembly of the service. */
19
+ retryAsItem: (review: ReviewTurn, s: Settled) => Promise<boolean>;
20
+ constructor(deps: ReviewDeps, notices: Notices, cards: ItemCards, follows: AskerFollow);
21
+ /** What the turn engine is given for a review. */
22
+ options(review: ReviewTurn, modelKey: string): ReviewTurnOptions;
23
+ /** A result of the review's write tools: the line that says how it came out; a merge made in the review itself is audited. */
24
+ noteResult(review: ReviewTurn, outcome: GithubOutcome, model: string): string | undefined;
25
+ /** The `ReviewTurn.asItem` of a review asked of someone else whose session is made here: tried once, never in a loop. */
26
+ asItemOnce(review: ReviewTurn, s: Settled): () => Promise<boolean>;
27
+ /** A review of one's own that is an item ended with its turn: its card shows how. */
28
+ endOwnItemCard(review: ReviewTurn): void;
29
+ /** The turn has ended: what follows it, by how it ended. */
30
+ afterTurn(review: ReviewTurn, finalAnswer: string, outcome: ReviewTurnOutcome, asked: Conversation): Promise<void>;
31
+ /** Held writes go to the reviewer as cards; and the reviewer, who typed nothing, is told what was done as them. */
32
+ private followUp;
33
+ private offerPending;
34
+ /** The reviewer's notice of what was left on GitHub as them: [delivered, why not]. */
35
+ private tellActor;
36
+ private noticeZh;
37
+ private noticeEn;
38
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A review's one sentence of what the pull request does (`pr_summary`), shown right under its verdict, clipped as Claw's
3
+ * views clip it (`clipPrSummary`).
4
+ */
5
+ import { clipPrSummary } from "../claw/requester-view.js";
6
+ export { clipPrSummary };
7
+ export type { Redact } from "../inbound-text/redact.js";
8
+ /** The line that says what a pull request does, under its verdict; '' when there is none. */
9
+ export declare function prSummaryLine(summary: unknown, lang?: "zh" | "en"): string;
10
+ /** `text` (a verdict line, then the link and anything else) with the summary line right under its first line. */
11
+ export declare function withSummaryLine(text: string, summaryLine: string): string;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * The views of the review delegation, as models (no card JSON): the confirmation-setting card, the card a reviewer confirms
3
+ * a held write on, a review item's card with Stop (and its end), and the GitHub connect card beside a question. The Teams
4
+ * package renders them (`teams/src/views/review/`).
5
+ */
6
+ import type { JsonObject } from "../json.js";
7
+ import type { OutMessage, ViewButton } from "../ports/surface.js";
8
+ import type { ReviewMode } from "./review-turn.js";
9
+ export interface ReviewModeView {
10
+ /** The one in force ('' none yet). */
11
+ readonly current: ReviewMode | "";
12
+ /** The one asked for: its button comes first. */
13
+ readonly suggested: ReviewMode | "";
14
+ readonly lead: string;
15
+ /** How to answer by typing, for a person whose clicks may not arrive ('' none). */
16
+ readonly hint: string;
17
+ readonly installUrl: string;
18
+ }
19
+ export interface GithubConfirmView {
20
+ readonly confirmationId: string;
21
+ readonly repo: string;
22
+ readonly number: number;
23
+ readonly title: string;
24
+ readonly author: string;
25
+ readonly headSha: string;
26
+ readonly reasons: readonly string[];
27
+ readonly checks: string;
28
+ readonly requester: string;
29
+ readonly room: string;
30
+ /** The review Claw holds (its event, its text masked, how many inline comments), or undefined for a merge. */
31
+ readonly review: HeldReviewView | undefined;
32
+ readonly model: string;
33
+ readonly hint: boolean;
34
+ readonly installUrl: string;
35
+ /** Where the merge lands ('' not read). */
36
+ readonly base: string;
37
+ readonly login: string;
38
+ readonly lang: "zh" | "en";
39
+ readonly summary: string;
40
+ }
41
+ export interface HeldReviewView {
42
+ readonly event: string;
43
+ readonly body: string;
44
+ readonly comments: number;
45
+ }
46
+ export interface ReviewItemView {
47
+ readonly seq: number;
48
+ readonly pull: string;
49
+ readonly who: string;
50
+ readonly reviewOnly: boolean;
51
+ readonly model: string;
52
+ readonly cardId: string;
53
+ readonly lang: "zh" | "en";
54
+ readonly queued: boolean;
55
+ }
56
+ export interface EndedItemView {
57
+ /** What the card showed (`PlacedCard.render`, with the review's summary added). */
58
+ readonly render: JsonObject;
59
+ readonly ended: string;
60
+ readonly cardId: string;
61
+ }
62
+ export interface GithubConnectView {
63
+ readonly code: string;
64
+ readonly uri: string;
65
+ readonly minutes: number;
66
+ readonly question: string;
67
+ readonly lang: "zh" | "en";
68
+ readonly cardId: string;
69
+ }
70
+ declare module "../ports/surface.js" {
71
+ interface ViewMap {
72
+ reviewMode: ReviewModeView;
73
+ githubConfirm: GithubConfirmView;
74
+ reviewItem: ReviewItemView;
75
+ endedItem: EndedItemView;
76
+ githubConnect: GithubConnectView;
77
+ }
78
+ }
79
+ export declare function reviewModeMessage(model: ReviewModeView): OutMessage;
80
+ export declare function githubConfirmMessage(model: GithubConfirmView): OutMessage;
81
+ export declare function reviewItemMessage(model: ReviewItemView): OutMessage;
82
+ export declare function endedItemMessage(model: EndedItemView): OutMessage;
83
+ export declare function githubConnectMessage(model: GithubConnectView): OutMessage;
84
+ /**
85
+ * Merge / Do not merge (a held review: Post review / Do not post): what the confirmation card's buttons carry. The data is
86
+ * the same for both kinds, the id and the choice: which kind it is the store knows.
87
+ */
88
+ export declare function githubConfirmButtons(confirmationId: string, review: boolean, lang?: "zh" | "en"): ViewButton[];
89
+ export declare const TYPED_MODE_HINT = "\u6309\u94AE\u70B9\u4E0D\u4E86\u65F6\uFF0C\u76F4\u63A5\u56DE\u590D\u300C\u786E\u8BA4\u5168\u81EA\u52A8\u300D\u6216\u300C\u786E\u8BA4\u9AD8\u98CE\u9669\u518D\u95EE\u6211\u300D\u5373\u53EF\u3002 / If the buttons do not work, reply \u786E\u8BA4\u5168\u81EA\u52A8 or \u786E\u8BA4\u9AD8\u98CE\u9669\u518D\u95EE\u6211.";
90
+ /** The confirmation settings: [Chinese, English] of each, the first the default. */
91
+ export declare const REVIEW_MODES: Readonly<Record<ReviewMode, readonly [string, string]>>;
@@ -0,0 +1,13 @@
1
+ /** A model id as a request writes it. */
2
+ export declare const MODEL_ID = "[A-Za-z0-9][A-Za-z0-9._:@/+-]{0,99}";
3
+ /** "model: X" (or 模型:X) anywhere in a text, read as Python's `re.I` pattern (İ and ı fold to i); a new pattern each call. */
4
+ export declare function modelFieldPattern(): RegExp;
5
+ /** Whether the text says "review 合入" (or "review 并合入", ...). */
6
+ export declare function saysReviewAndMerge(text: string): boolean;
7
+ /** The name and the rest of a review-only ask. */
8
+ export interface ReviewOnlyAsk {
9
+ readonly who: string;
10
+ readonly rest: string;
11
+ }
12
+ /** "请 XX 帮我 review ..." that names someone and says nothing of merging: its name and the rest. */
13
+ export declare function asksReviewOnly(text: string): ReviewOnlyAsk | undefined;
@@ -0,0 +1,29 @@
1
+ /** Whether a word, lower-cased, is a word of the sentence rather than a repository ("pr", "the", "merge", ...). */
2
+ export declare function isNotARepo(word: string): boolean;
3
+ /**
4
+ * A word written as a repository's name rather than as a word of the sentence ("PrimusClaw", "fleet-tools", "Primus2", not
5
+ * "my", "this" or "API"): what a name GitHub could not confirm must look like before it is read as one.
6
+ */
7
+ export declare function looksLikeRepo(name: string): boolean;
8
+ /** Pull requests one place of a message names by number alone. */
9
+ export interface BareGroup {
10
+ /** Where each number is, in the text it was read from (UTF-16 offsets). */
11
+ readonly spans: readonly (readonly [number, number])[];
12
+ readonly numbers: readonly number[];
13
+ /** The repository word written just before the numbers ('' when none). */
14
+ readonly repo: string;
15
+ /** Written after "PR" or "#": a pull request whatever comes before it. */
16
+ readonly explicit: boolean;
17
+ }
18
+ /**
19
+ * Every place `text` names pull requests by number alone. Links, owner/repo#N, mentions, tags and HTML entities are not read
20
+ * (they are blanked first, so the places stay where they are in `text`).
21
+ */
22
+ export declare function bareGroups(text: string): BareGroup[];
23
+ /**
24
+ * The numbers `text` writes on their own that none of `groups` holds: in a request to review and merge, each may be a pull
25
+ * request the asker meant, so it is named back to them rather than dropped without a word.
26
+ */
27
+ export declare function strayNumbers(text: string, groups: readonly BareGroup[]): number[];
28
+ /** The distinct repositories ("owner/repo") the text names: in its links, its owner/repo#N, and owner/repo written alone. */
29
+ export declare function writtenRepos(text: string): string[];
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Reading a review request's text: the people it names, the pull requests it points at, the numbers written on their
3
+ * own, and the words of an ask (github_review.py; shared by the review delegation and the assistant's understanding).
4
+ */
5
+ export * from "./asks.js";
6
+ export * from "./bare-numbers.js";
7
+ export { MAX_CANDIDATES, displayName, markerIndexes, markerKeys, markerPattern, memberKeys, memberMatches, memberNames, mentionId, namedIn, namedWithin, normName, oneLine, personOf, plainText, samePerson, sortedCp, tokens, withoutMarkers, withoutParens, writtenIn, } from "./names.js";
8
+ export type { Mention, Place } from "./names.js";
9
+ export * from "./pull-ref.js";
10
+ export { NAME_PADDING, bareName, casefold, codePoints, flat, isAlnum, isWordChar, stripChars, unique, } from "./text/unicode.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The markers a mention is replaced with in a message's text (`⟦i⟧` is mentions[i]), so that a name in a mention is
3
+ * never read as written words. The channel's inbound text (marked text) writes them; the readings here skip them.
4
+ */
5
+ export declare const MARK_OPEN = "\u27E6";
6
+ export declare const MARK_CLOSE = "\u27E7";
@@ -0,0 +1,60 @@
1
+ import type { InboundMention, RosterMember } from "../ports/surface.js";
2
+ /** One person @mentioned in a message: the channel's id for them, their directory id ('' not given) and display name. */
3
+ export type Mention = Pick<InboundMention, "channelUserId" | "userId" | "name">;
4
+ export declare const MAX_CANDIDATES = 5;
5
+ export declare function markerPattern(): RegExp;
6
+ /** The mention indexes a text's markers name, in order. */
7
+ export declare function markerIndexes(text: string): number[];
8
+ /** The markers' numbers as exact decimal strings (Python's `int` of each), to compare markers of any length. */
9
+ export declare function markerKeys(text: string): string[];
10
+ export declare function withoutMarkers(text: string): string;
11
+ export declare function withoutParens(text: string): string;
12
+ export declare function hasCjk(text: string): boolean;
13
+ /** A display name as a prompt or a message carries it: one line, no markup, at most 60 characters. */
14
+ export declare function displayName(value: string): string;
15
+ /** Text that came from outside as one plain line: no markup, at most `limit` characters. */
16
+ export declare function oneLine(value: unknown, limit: number): string;
17
+ /** A value from outside as text: a string as it is, a number as written, anything else (or nothing) as ''. */
18
+ export declare function plainText(value: unknown): string;
19
+ /** A name compared as words: case and runs of space left out. */
20
+ export declare function normName(name: string): string;
21
+ /** Strings sorted by code point (Python's `sorted`). */
22
+ export declare function sortedCp(values: readonly string[]): string[];
23
+ /**
24
+ * The words of a text, case left out: split at spaces, punctuation and "_", and where Chinese meets a letter or a digit
25
+ * ("帮我请linmei" is two words, never one that hides the name).
26
+ */
27
+ export declare function tokens(text: string): string[];
28
+ /**
29
+ * The words of `name` stand next to each other in `text`, in any order, or `name` is written run together as one word of
30
+ * it. Whole words only; a Chinese name runs into the words around it, so one is found inside a word that has Chinese.
31
+ */
32
+ export declare function writtenIn(name: string, text: string): boolean;
33
+ /** A mention's id: the channel's id for the person, else their directory id, else their name. */
34
+ export declare function mentionId(mention: Mention): string;
35
+ /** Two ways a request names its reviewer (markers of mentions, or typed words) are the same person. */
36
+ export declare function samePerson(a: string, b: string, mentions: readonly Mention[]): boolean;
37
+ /** The reviewer a reading gives is the one the rules' span names: the same person, or written inside that span. */
38
+ export declare function namedWithin(who: string, span: string, mentions: readonly Mention[]): boolean;
39
+ /** Who a reviewer the model wrote is, to tell two people apart: a mention's id (by id or display name), else the name, flat. */
40
+ export declare function personOf(who: string, mentions: readonly Mention[]): string;
41
+ /**
42
+ * Every way a person's name may be written, flat: the display name with or without its bracketed part, its words in either
43
+ * order, given name and surname, and the account name of their address with or without its digits.
44
+ */
45
+ export declare function memberKeys(member: RosterMember): Set<string>;
46
+ /** Positions in a text's words, as "word:letter" keys. */
47
+ export type Place = ReadonlySet<string>;
48
+ /**
49
+ * Where in a text of these words the member's name is written (empty: nowhere): the words of their display name next to
50
+ * each other in any order, one word that is a way of writing their name run together (at least 4 letters), or a Chinese
51
+ * name inside a word with Chinese in it. Letters, not words, so a name inside a longer one is seen to be part of it.
52
+ */
53
+ export declare function namedIn(words: readonly string[], member: RosterMember): Place;
54
+ /** (the members a typed name is, the members it only resembles). */
55
+ export declare function memberMatches(typed: string, members: readonly RosterMember[]): {
56
+ readonly hits: RosterMember[];
57
+ readonly near: RosterMember[];
58
+ };
59
+ /** The names of up to MAX_CANDIDATES members, as they are offered back. */
60
+ export declare function memberNames(members: readonly RosterMember[]): string;
@@ -0,0 +1,25 @@
1
+ /** A pull request named in a review request, and how one is read out of text (links and owner/repo#N). */
2
+ import type { PullRef } from "../claw/model.js";
3
+ export { MARK_CLOSE, MARK_OPEN } from "./markers.js";
4
+ export type PullKey = string;
5
+ export declare function pullRef(owner: string, repo: string, number: number): PullRef;
6
+ export declare function slug(pull: PullRef): string;
7
+ export declare function shortName(pull: PullRef): string;
8
+ export declare function pullUrl(pull: PullRef): string;
9
+ /** What Claw binds a review session to (`config.review_target`). */
10
+ export declare function pullTarget(pull: PullRef): [string, string, number];
11
+ /** A pull request as GitHub compares it: owner and repository without case. */
12
+ export declare function pullKey(pull: PullRef): PullKey;
13
+ export declare function keyOf(owner: string, repo: string, number: number): PullKey;
14
+ export declare function keyParts(key: PullKey): [string, string, number];
15
+ export declare function samePull(a: PullRef, b: PullRef): boolean;
16
+ export declare const PR_URL_SOURCE = "https?://github\\.com/([A-Za-z0-9][A-Za-z0-9-]{0,38})/([A-Za-z0-9._-]{1,100})/pull/(\\p{Nd}{1,7})(?!\\p{Nd})";
17
+ export declare const PR_SHORT_SOURCE = "(?<![A-Za-z0-9_/.-])([A-Za-z0-9][A-Za-z0-9-]{0,38})/([A-Za-z0-9._-]{1,100})#(\\p{Nd}{1,7})(?!\\p{Nd})";
18
+ export declare function prUrlPattern(): RegExp;
19
+ export declare function prShortPattern(): RegExp;
20
+ /**
21
+ * The distinct pull requests the text points at, in the order it names them: links and owner/repo#N, mixed, separated by
22
+ * anything (a comma, 、, a space, a new line).
23
+ */
24
+ export declare function pullsIn(text: string): PullRef[];
25
+ export declare function withoutGitSuffix(name: string): string;
@@ -0,0 +1,19 @@
1
+ /** One match: where it starts and ends (UTF-16 offsets). */
2
+ export type Span = readonly [number, number];
3
+ /** The spans of an opener, the shortest run to the first closer after it: `[((][^))]*[))]` and `<[^>]*>`. */
4
+ export declare function bracketSpans(text: string, openers: string, closers: string): Span[];
5
+ /** `text` with every span replaced by what `by` gives for its text. */
6
+ export declare function replaceSpans(text: string, spans: readonly Span[], by: (matched: string) => string): string;
7
+ /** `re.sub(r"[((][^))]*[))]", "", text)`. */
8
+ export declare function withoutBracketed(text: string): string;
9
+ /** `path.ext:line` somewhere in the line (`[\w./-]+\.\w{1,8}:\d+`), how a finding is written. */
10
+ export declare function hasFileLine(line: string): boolean;
11
+ /**
12
+ * The spans of `<[^>]*>|&#?\w+;|https?://\S+|⟦\d+⟧`: leftmost first, the alternatives tried in that order at each place,
13
+ * non-overlapping.
14
+ */
15
+ export declare function hiddenSpans(text: string, markOpen: string, markClose: string): Span[];
16
+ /**
17
+ * The matches of `([A-Za-z][A-Za-z0-9._-]{0,99})#(\d{1,7})(?!\d)`: (the word, the number's digits), leftmost first.
18
+ */
19
+ export declare function wordHashNumbers(text: string): (readonly [string, string])[];
@@ -0,0 +1,22 @@
1
+ /** The code points of `text` (Python iterates a string by code point). */
2
+ export declare function codePoints(text: string): string[];
3
+ /** Case left out, as names and repositories are compared. */
4
+ export declare function casefold(text: string): string;
5
+ /** Python's `str.isalnum()` for one character. */
6
+ export declare function isAlnum(ch: string): boolean;
7
+ /** Python's `\w` for one character. */
8
+ export declare function isWordChar(ch: string): boolean;
9
+ /** Every character of `text` that is a letter or a digit, case left out (how a name is compared). */
10
+ export declare function flat(text: string): string;
11
+ /** The distinct values, in the order first seen (Python's `dict.fromkeys`). */
12
+ export declare function unique<T>(values: Iterable<T>): T[];
13
+ /** Python's `str.isupper()`: at least one cased character, and every cased one upper case. */
14
+ export declare function isUpper(text: string): boolean;
15
+ /** Python's `str.strip(chars)`: every character of `chars` taken off both ends. */
16
+ export declare function stripChars(text: string, chars: string): string;
17
+ /** What a name in a request is stripped of: spaces, commas, colons and "@". */
18
+ export declare const NAME_PADDING = " \t,\uFF0C\u3001:\uFF1A@";
19
+ /** `who` with the padding a request leaves around a name taken off ('' when nothing is left). */
20
+ export declare function bareName(who: string): string;
21
+ /** The language of the first text that has anything in it: Chinese when it has Chinese, else English. */
22
+ export declare function pickLang(...texts: readonly string[]): "zh" | "en";
@@ -0,0 +1,83 @@
1
+ import type { Chat } from "./chat.js";
2
+ import type { RouterDeps } from "./deps.js";
3
+ import { KeyedLock } from "./lock.js";
4
+ import type { TurnRegistry } from "./turn-registry.js";
5
+ type AdmissionDeps = Pick<RouterDeps, "limits" | "claw" | "clock" | "logger" | "metrics" | "securityEvent" | "assistant" | "remote">;
6
+ /**
7
+ * The task slots one review request was given: `granted` pull requests may start, `running` is what the person had when
8
+ * they asked. A slot is let go when its review turn is kept (it counts as a turn from then on) or when the request is
9
+ * over; `itemIds` are the work items Claw made for them, which the person's board shows too.
10
+ */
11
+ export declare class ReviewSlots {
12
+ private readonly onRelease;
13
+ readonly userId: string;
14
+ readonly granted: number;
15
+ readonly running: number;
16
+ readonly limit: number;
17
+ left: number;
18
+ readonly itemIds: Set<string>;
19
+ constructor(onRelease: (slots: ReviewSlots) => void, userId: string, granted: number, running: number, limit: number);
20
+ /** One admitted review was handed to its turn (kept as a turn, or not started at all): its slot is let go. */
21
+ followed(itemId?: string): void;
22
+ release(): void;
23
+ }
24
+ /**
25
+ * The per-person limit on tasks running at the same time (the Python `Agent._running_tasks`, `_count_tasks`,
26
+ * `_board_count`, `_over_task_limit`, `_admit_reviews`, `_assistant_over_limit`). A task is a chat turn this worker runs,
27
+ * the attached remote agent's turn, a review admitted or followed, and a work item of the person's assistant in progress
28
+ * (read from their board, which Claw keeps). What a check admits is registered before the person's lock is let go, so two
29
+ * messages in two chats cannot both take the last slot.
30
+ */
31
+ export declare class TaskAdmission {
32
+ private readonly deps;
33
+ private readonly turns;
34
+ private readonly pending;
35
+ private readonly boardSeen;
36
+ private readonly boardTaken;
37
+ private readonly reserved;
38
+ private readonly reviewSlots;
39
+ readonly lock: KeyedLock;
40
+ constructor(deps: AdmissionDeps, turns: TurnRegistry);
41
+ private now;
42
+ /** The person's tasks this worker knows of (the board's are added by `count`). */
43
+ running(userId: string): number;
44
+ /** The person's messages to the assistant still holding a slot; the expired ones are let go. */
45
+ handoffsPending(userId: string): number;
46
+ /** The last message to the assistant was not the assistant's after all (or never reached it): its slot is let go. */
47
+ dropLastHandoff(userId: string): void;
48
+ /** The person's tasks running now; the board is read only when that leaves room or a message holds a slot. */
49
+ count(userId: string, boardKey: string): Promise<number>;
50
+ /** The review work items the worker counts itself: the board must not count them a second time. */
51
+ private counted;
52
+ private readBoard;
53
+ /**
54
+ * The person's assistant work items in progress (they run in Claw and count too). Each new item on the board lets go
55
+ * the slot of the oldest message to the assistant that has not taken one yet.
56
+ */
57
+ private boardCount;
58
+ /**
59
+ * True (the person is told, and the refusal recorded) when a new task would be one more than they may run. `what`
60
+ * names the task in the notice; `boardKey` reads their board. Called under the person's lock.
61
+ */
62
+ overLimit(chat: Chat, activityId: string, operation: string, what?: string, boardKey?: string): Promise<boolean>;
63
+ private refused;
64
+ /**
65
+ * Admits up to `count` pull requests of one review request before Claw is asked to start them; what is admitted holds
66
+ * a slot each until its turn is kept or the request is over. Fewer than `count`: the rest is refused (and recorded).
67
+ */
68
+ admitReviews(chat: Chat, activityId: string, count: number, boardKey: string): Promise<ReviewSlots>;
69
+ private forget;
70
+ /**
71
+ * A message for the assistant may start a work item, so it is refused while the person is at the limit. One let
72
+ * through holds a slot until its item is on the board, or for `assistantPendingSeconds`.
73
+ */
74
+ assistantOverLimit(chat: Chat, activityId: string, key: string): Promise<boolean>;
75
+ /**
76
+ * A remote-agent prompt being sent holds a slot until it counts as running: checked and taken under the person's lock,
77
+ * so a task admitted next (in another chat) sees it. False: refused (the person was told). The caller lets it go.
78
+ */
79
+ admitRemote(chat: Chat, activityId: string, key: string): Promise<boolean>;
80
+ hold(userId: string): void;
81
+ letGo(userId: string): void;
82
+ }
83
+ export {};
@@ -0,0 +1,52 @@
1
+ import type { Lang } from "../locales/lang.js";
2
+ import type { Logger } from "../ports/logger.js";
3
+ import type { SettleOptions } from "../ports/routing.js";
4
+ import { type Conversation, type InboundAction, type OutMessage, type UserRef } from "../ports/surface.js";
5
+ import type { RouterStore } from "./deps.js";
6
+ import type { NoteFactory } from "./features.js";
7
+ /**
8
+ * The language a person is answered in (the Python `Agent._lang_of`): what they said (`/lang`), else the language of
9
+ * what they last wrote, else, while nothing they wrote has said it, the language of their client (`locale`).
10
+ */
11
+ export declare function langOf(store: Pick<RouterStore, "prefs">, userId: string, locale: string): Lang;
12
+ /**
13
+ * The person is answered in the language they write in: one message is enough. A typed command says nothing, nor does a
14
+ * word of the menu, a link, a name or a word or two (`writtenLang`); after `/lang` nothing they write changes it.
15
+ */
16
+ export declare function learnLang(store: Pick<RouterStore, "prefs">, userId: string, words: string): void;
17
+ /**
18
+ * The language help is said in: the person's, unless the words that asked for it are in a language of their own ("你能做什么",
19
+ * "what can you do") and the person did not choose one (`/lang`).
20
+ */
21
+ export declare function helpLang(store: Pick<RouterStore, "prefs">, userId: string, locale: string, asked: string | undefined): Lang;
22
+ /** One chat as the router answers in it: who wrote, where to answer, and in which language. */
23
+ export declare class Chat {
24
+ private readonly store;
25
+ readonly sender: UserRef;
26
+ readonly conversation: Conversation;
27
+ /** "" for the person's 1:1 chat, the conversation id of a group. */
28
+ readonly scope: string;
29
+ /** The client's locale of the event being handled ("" for work that runs on its own). */
30
+ readonly locale: string;
31
+ constructor(store: Pick<RouterStore, "prefs">, sender: UserRef, conversation: Conversation,
32
+ /** "" for the person's 1:1 chat, the conversation id of a group. */
33
+ scope: string,
34
+ /** The client's locale of the event being handled ("" for work that runs on its own). */
35
+ locale: string);
36
+ lang(): Lang;
37
+ zh(): boolean;
38
+ say(text: string): Promise<void>;
39
+ sayRich(markdown: string): Promise<void>;
40
+ send(message: OutMessage): Promise<void>;
41
+ }
42
+ /**
43
+ * THE way a click ends (the Python `Agent._close_card`): the clicked card is replaced, by `card` or by a note saying it,
44
+ * and the outcome is said in a new message too, because a phone does not redraw an edited message. A click with no line
45
+ * (paging, opening a menu: the new card is the outcome) says nothing new. When there is no card to edit, or the edit
46
+ * failed, the line is said in any case; a failed edit never loses an outcome that was carried out. True when replaced.
47
+ */
48
+ export declare function settleClick(click: {
49
+ readonly action: InboundAction;
50
+ readonly conversation: Conversation;
51
+ readonly note: NoteFactory;
52
+ }, logger: Logger, card: OutMessage | string, options?: SettleOptions): Promise<boolean>;
@@ -0,0 +1,32 @@
1
+ import type { InboundMessage } from "../ports/surface.js";
2
+ import type { AccountCommands } from "./commands-account.js";
3
+ import type { SessionCommands } from "./commands-session.js";
4
+ import type { SettingsCommands } from "./commands-settings.js";
5
+ import type { Chat } from "./chat.js";
6
+ import type { RouterContext } from "./context.js";
7
+ import type { LinkCommands } from "./link-commands.js";
8
+ export interface CommandSets {
9
+ readonly settings: SettingsCommands;
10
+ readonly sessions: SessionCommands;
11
+ readonly account: AccountCommands;
12
+ readonly link: LinkCommands;
13
+ }
14
+ /**
15
+ * The 1:1 chat's commands (the Python `Agent._command`): `text` is carried out when it is one, and true is returned;
16
+ * false (nothing done) when it is not. `message` is undefined for a command the assistant asked for: the commands that
17
+ * need the message itself are then not carried out.
18
+ */
19
+ export declare class CommandTable {
20
+ private readonly ctx;
21
+ private readonly sets;
22
+ constructor(ctx: RouterContext, sets: CommandSets);
23
+ private route;
24
+ run(text: string, chat: Chat, key: string, message?: InboundMessage): Promise<boolean>;
25
+ /** A command a feature carries out (`/brief`, and any other the assembly registered). */
26
+ private features;
27
+ private board;
28
+ private settingsWords;
29
+ /** `/agents`, `/agent ARGS` (the plural is the one word people remember: `/agents new` is `/agent new`). */
30
+ private agent;
31
+ private plain;
32
+ }
@@ -0,0 +1,26 @@
1
+ import { type Chat } from "./chat.js";
2
+ import type { RouterContext } from "./context.js";
3
+ /**
4
+ * Who the person is to the worker and what it can do for them (the Python `Agent._cmd_help`, `_help_values`,
5
+ * `_cmd_whoami`, `_github_connections`, `_memory_on`, `_cmd_memory`, `_cmd_memory_switch`, `_cmd_lang`).
6
+ */
7
+ export declare class AccountCommands {
8
+ private readonly ctx;
9
+ constructor(ctx: RouterContext);
10
+ private memoryPage;
11
+ /** What the bot can do, by category, each with a sentence to type; not a list of commands. */
12
+ help(chat: Chat, key: string | undefined, asked: string | undefined): Promise<void>;
13
+ /** On top of help: where this chat's messages go while it is attached to an agent's session, and how to come back. */
14
+ private attachedLead;
15
+ /** The person's settings as help shows them ("当前:..."); what the review service cannot read just now is left out. */
16
+ private values;
17
+ /** Whose account this chat is connected to, and what else the person is connected to. */
18
+ whoami(chat: Chat, key: string): Promise<void>;
19
+ private githubConnections;
20
+ private memoryOn;
21
+ memory(chat: Chat, key: string): Promise<void>;
22
+ /** `/memory on` / `/memory off`: the person's memory in Claw, switched as them and said as Claw answers. */
23
+ memorySwitch(chat: Chat, key: string, arg: string): Promise<void>;
24
+ /** `/lang zh|en` answers in that language from now on; `/lang auto` follows what they write; `/lang` says which. */
25
+ lang(chat: Chat, arg: string): Promise<void>;
26
+ }
@@ -0,0 +1,40 @@
1
+ import type { InboundAction } from "../ports/surface.js";
2
+ import type { Chat } from "./chat.js";
3
+ import type { RouterContext } from "./context.js";
4
+ import { type ActiveTurn } from "./turn-registry.js";
5
+ import type { TurnStarter } from "./turn-start.js";
6
+ /**
7
+ * The chat's session (the Python `Agent._cmd_new`, `_cmd_stop`, `_cmd_sessions`, `_cmd_repo`, `_repo_click`, `_bind_repo`,
8
+ * `_create_pr`): start over, stop what runs, go back to an earlier session, start the next one in a repository.
9
+ */
10
+ export declare class SessionCommands {
11
+ private readonly ctx;
12
+ private readonly starter;
13
+ constructor(ctx: RouterContext, starter: TurnStarter);
14
+ new(chat: Chat, scope?: string): Promise<void>;
15
+ stop(chat: Chat, key: string, scope?: string): Promise<void>;
16
+ /**
17
+ * `/stop` of the turn on the chat's own session (not a remote agent's, not the assistant's). `only`: stop only while that
18
+ * turn is the one running (a Stop card's turn), checked with no wait before the interrupt goes; false when it is not, and
19
+ * nothing was said or stopped.
20
+ */
21
+ stopTurn(chat: Chat, key: string, scope?: string, only?: ActiveTurn): Promise<boolean>;
22
+ private interrupt;
23
+ /**
24
+ * The five sessions this chat used last, a card each with Show here. No session is shown on the worker's word alone: each
25
+ * is read from Claw with the person's credential, which answers only for their own; one gone or not theirs is forgotten.
26
+ */
27
+ sessions(chat: Chat, key: string): Promise<void>;
28
+ private readable;
29
+ /** `/repo owner/name [branch]`, or `/repo` alone for the five picked last (each with a button). */
30
+ repo(chat: Chat, arg: string): Promise<void>;
31
+ /** A tap on a repository card. The card is not trusted: its text is read like typed text. */
32
+ repoClick(action: InboundAction, chat: Chat): Promise<void>;
33
+ /** The next message starts a new session bound to `pick`; the session in use stays on the /sessions list. */
34
+ private bindRepo;
35
+ /**
36
+ * Create PR under a changes card: the agent is asked, in this chat's session, to open a pull request. The card is not
37
+ * trusted: its session must be the chat's current one, and the ask is an ordinary message (held for approval as any).
38
+ */
39
+ createPr(action: InboundAction, chat: Chat, key: string): Promise<void>;
40
+ }