@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,70 @@
1
+ import type { Lang } from "../locales/lang.js";
2
+ export declare const TITLE_ID = "approval-title";
3
+ export declare const DETAILS_ID = "approval-details";
4
+ export declare const SUMMARY_MAX = 300;
5
+ export declare const DESCRIPTION_MAX = 200;
6
+ export declare const INTENT_MAX = 200;
7
+ export declare const VALUE_MAX = 120;
8
+ export declare const COMMAND_MAX = 300;
9
+ export declare const COMMAND_EDGE = 140;
10
+ export declare const NAME_MAX = 40;
11
+ export declare const MAX_OTHER_ARGS = 5;
12
+ export declare const RAW_MAX = 1500;
13
+ /** One `name: value` line of the card. */
14
+ export type ArgumentLine = readonly [name: string, value: string];
15
+ export interface ArgumentLines {
16
+ /** The fields the call is about first (in the order the tool's name gives them), then up to MAX_OTHER_ARGS more. */
17
+ readonly lines: readonly ArgumentLine[];
18
+ /** The stated reason, shown apart. */
19
+ readonly reason: ArgumentLine | undefined;
20
+ /** How many other fields did not fit. */
21
+ readonly more: number;
22
+ }
23
+ /** `mcp__<server>__<tool>` -> `tool words (server)`; any other name with its separators turned into spaces. */
24
+ export declare function humanizeTool(tool: string): string;
25
+ /**
26
+ * (server, tool) of `mcp__<server>__<tool>` (Python's `re.fullmatch(r"mcp__(.+?)__(.+)", name)`: the shortest server, neither part
27
+ * empty, no line break), read in one pass; undefined for any other name.
28
+ */
29
+ export declare function mcpParts(name: string): readonly [server: string, tool: string] | undefined;
30
+ /**
31
+ * A shell command for the card: whole up to COMMAND_MAX, else its start and its end with the middle elided (a chained
32
+ * `git push` sits at the end, so a plain cut at the front would hide the part that is being approved).
33
+ */
34
+ export declare function clipCommand(text: string): string;
35
+ /** The call's key arguments, its reason and how many fields did not fit. A credential-named field shows as [hidden]. */
36
+ export declare function argumentLines(tool: string, toolInput: unknown): ArgumentLines;
37
+ /** The call as JSON for the collapsed section: credential-named fields and secret shapes already masked. */
38
+ export declare function rawDetails(tool: string, toolInput: unknown): string;
39
+ /** The semantic content of an approval card; the buttons are the caller's. */
40
+ export interface ApprovalView {
41
+ readonly lang: Lang;
42
+ readonly group: boolean;
43
+ /** The model's one-sentence summary ('' when none): shown bold, with a note that the model wrote it. */
44
+ readonly summary: string;
45
+ /** What the agent said it was about to do, shown when there is no summary (1:1 only; '' when none). */
46
+ readonly intent: string;
47
+ /** The action's readable name ('' when the call names no tool: the view says "an action" in its language). */
48
+ readonly action: string;
49
+ /** The tool's own description, in a 1:1 chat only ('' when none). */
50
+ readonly description: string;
51
+ readonly args: readonly ArgumentLine[];
52
+ readonly reason: string | undefined;
53
+ /** The deployment's wording of the rule that held the call ('' when none). */
54
+ readonly ruleLabel: string;
55
+ readonly moreFields: number;
56
+ /** The raw call for the Details fold ('' when there is no input, and always in a group). */
57
+ readonly details: string;
58
+ /** Who alone can answer, in a group ('' for "the person who asked"). */
59
+ readonly owner: string;
60
+ }
61
+ export interface ApprovalRequest {
62
+ readonly tool: string;
63
+ readonly toolInput: unknown;
64
+ /** The permission event's optional fields: summary, tool_description, intent, approval_label. */
65
+ readonly event?: Readonly<Record<string, unknown>> | null | undefined;
66
+ readonly lang?: string | null | undefined;
67
+ readonly group: boolean;
68
+ readonly owner?: string | undefined;
69
+ }
70
+ export declare function approvalView(request: ApprovalRequest): ApprovalView;
@@ -0,0 +1,8 @@
1
+ /** What a card press handler of this feature reads of the router's click (W4's `ClickRoute`). */
2
+ import type { ClickRoute } from "../ports/routing.js";
3
+ import type { OutMessage, View } from "../ports/surface.js";
4
+ export type CardClick = Pick<ClickRoute, "sender" | "conversation" | "scope" | "lang" | "settle"> & {
5
+ readonly action: Pick<ClickRoute["action"], "data">;
6
+ };
7
+ /** A view as a message, with the line a client that cannot show it shows. */
8
+ export declare function viewMessage(view: View, fallbackText?: string): OutMessage;
@@ -0,0 +1,64 @@
1
+ import type { ClawSessionsPort } from "../ports/claw/index.js";
2
+ import type { Logger } from "../ports/logger.js";
3
+ import type { StorePort } from "../ports/store/index.js";
4
+ import type { TokenExchange } from "../plugins/token-exchange.js";
5
+ import { type CardClick } from "./click.js";
6
+ export type DecisionStore = Pick<StorePort, "approvals" | "sessions" | "prefs" | "reviewDelegation" | "now">;
7
+ /** One approval's use of the person's allowance (guardrails): a refusal's text, or undefined when it may go on. */
8
+ export interface ApprovalAllowance {
9
+ take(userId: string, ticket: object, details: ApprovalAuditIds): string | undefined;
10
+ giveBack(userId: string, ticket: object): void;
11
+ }
12
+ /** What the audit records name an approval by: only what the store has from Claw, never a card's text. */
13
+ export interface ApprovalAuditIds {
14
+ readonly sessionId: string;
15
+ readonly toolUseId: string;
16
+ readonly approvalId: string | null;
17
+ readonly tool: string | null;
18
+ }
19
+ export interface ApprovalAudit extends ApprovalAuditIds {
20
+ readonly userId: string;
21
+ readonly decision: "approve" | "deny";
22
+ readonly outcome: "success" | "failure" | "expired";
23
+ readonly status: number | null;
24
+ }
25
+ export interface DecisionDeps {
26
+ readonly store: DecisionStore;
27
+ readonly claw: Pick<ClawSessionsPort, "decide" | "answer">;
28
+ readonly exchange: TokenExchange;
29
+ readonly allowance: ApprovalAllowance;
30
+ readonly audit: (record: ApprovalAudit) => void;
31
+ readonly logger: Logger;
32
+ /** Offers the person the card that connects their identity (1:1 only). */
33
+ readonly connectIdentity?: (click: CardClick) => Promise<void>;
34
+ /** An approval of the running turn was denied: its answer comes with the Report a problem button. */
35
+ readonly onDenied?: (userId: string, scope: string) => void;
36
+ }
37
+ export declare class ApprovalDecisions {
38
+ private readonly deps;
39
+ constructor(deps: DecisionDeps);
40
+ /**
41
+ * A press on an approval or question card in a group chat: answered ONLY by the person it was raised for (read from the stored
42
+ * request, never the card); anyone else, linked or not, is refused before any key is read, and the card is put back for the
43
+ * asker. `credential` reads the presser's linked key (null: none).
44
+ */
45
+ inGroup(click: CardClick, credential: () => Promise<string | null>): Promise<void>;
46
+ /** A press with the person's linked key (`key`; null when they have none). */
47
+ decide(click: CardClick, key: string | null): Promise<void>;
48
+ private read;
49
+ /** The press may be answered: the person's own, still pending and in time. Otherwise the card is settled and false. */
50
+ private valid;
51
+ private auditIds;
52
+ /**
53
+ * The exchanged token of the clicker for a session that acts as a person; undefined when it cannot be had (the card was put
54
+ * back and the allowance given back).
55
+ */
56
+ private actingToken;
57
+ private send;
58
+ private failed;
59
+ private record;
60
+ private settled;
61
+ /** It did not go through: the card comes back as it was, to be pressed again. */
62
+ private again;
63
+ private showExpired;
64
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The buttons of approval and question cards, for the router (teams_agent/agent.py `_dispatch` and `_route_group` for these cards).
3
+ * A card of a session that acts as a person is answered before any key is read: it is never answered with one.
4
+ */
5
+ import type { ClickHandler, ClickRoute } from "../ports/routing.js";
6
+ import type { ApprovalDecisions } from "./decide.js";
7
+ export declare class ApprovalClicks implements ClickHandler {
8
+ private readonly decisions;
9
+ /** Whether the session acts as a person (a review for a colleague): the store says so, never the card. */
10
+ private readonly actsAsPerson;
11
+ /** The presser's linked key, read only when needed (null: none). */
12
+ private readonly linkedKey;
13
+ readonly verbs: readonly ["decision", "answer"];
14
+ constructor(decisions: ApprovalDecisions,
15
+ /** Whether the session acts as a person (a review for a colleague): the store says so, never the card. */
16
+ actsAsPerson: (sessionId: string) => boolean,
17
+ /** The presser's linked key, read only when needed (null: none). */
18
+ linkedKey: (userId: string) => Promise<string | null>);
19
+ beforeCredential(click: ClickRoute): Promise<boolean>;
20
+ withCredential(click: ClickRoute, credential: string): Promise<void>;
21
+ inGroup(click: ClickRoute): Promise<boolean>;
22
+ }
@@ -0,0 +1,9 @@
1
+ export * from "./approval-view.js";
2
+ export * from "./click.js";
3
+ export * from "./decide.js";
4
+ export * from "./handler.js";
5
+ export * from "./questions.js";
6
+ export * from "./records.js";
7
+ export * from "./sensitive.js";
8
+ export * from "./turn-cards.js";
9
+ export type * from "./views.js";
@@ -0,0 +1,36 @@
1
+ /** The tool whose call waits for the answer to a question card. */
2
+ export declare const QUESTION_TOOL = "ask_user_question";
3
+ export declare const QUESTIONS_MAX = 5;
4
+ export declare const OPTIONS_MAX = 10;
5
+ export declare const QUESTION_MAX = 500;
6
+ export declare const OPTION_MAX = 120;
7
+ /** What one free-text answer takes. */
8
+ export declare const ANSWER_MAX = 1000;
9
+ export interface QuestionOption {
10
+ readonly id: string;
11
+ readonly label: string;
12
+ }
13
+ export interface CardQuestion {
14
+ readonly id: string;
15
+ readonly question: string;
16
+ readonly options: readonly QuestionOption[];
17
+ readonly allowMultiple: boolean;
18
+ }
19
+ /**
20
+ * The questions of a userQuestion event (or of a question card's own data), cut to what a card shows. A question without an id or
21
+ * text is left out; so is anything that is not an object.
22
+ */
23
+ export declare function cardQuestions(raw: unknown): CardQuestion[];
24
+ /** A question as a card's button carries it on the wire (the Python worker's dict, so a card it drew can be answered here). */
25
+ export declare function questionWire(question: CardQuestion): Record<string, unknown>;
26
+ export interface Answers {
27
+ /** {question id: answer}, in the order of the questions. */
28
+ readonly answers: ReadonlyMap<string, string>;
29
+ /** The ids of the questions left blank. */
30
+ readonly skipped: readonly string[];
31
+ }
32
+ /**
33
+ * What the person answered on a question card, as Claw takes it: an answer is the labels of the chosen options, then what was
34
+ * typed; a choice the card never offered is ignored.
35
+ */
36
+ export declare function answersOf(data: Readonly<Record<string, unknown>>): Answers;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * One approval, one card (teams_agent/agent.py `on_approval`, `on_approval_sent`, `on_approval_unsent`; proactive.py `_send` for
3
+ * a pushed one): a card is recorded BEFORE it is shown, so its owner is known when it is pressed and the other way the same
4
+ * approval arrives (the running turn's stream, or Claw's `approval.requested` notification) finds it and shows nothing; and it is
5
+ * recorded WITH the card, so that a worker that dies before the send leaves it to the next (`resendUnsent`).
6
+ */
7
+ import type { Conversation, Envelope, OutMessage } from "../ports/surface.js";
8
+ import type { ApprovalRepository, StorePort } from "../ports/store/index.js";
9
+ export type ApprovalRecordStore = Pick<StorePort, "now"> & {
10
+ readonly approvals: Pick<ApprovalRepository, "saveApproval" | "approvalSent" | "forgetApproval">;
11
+ };
12
+ export interface ApprovalCardRequest {
13
+ readonly userId: string;
14
+ readonly sessionId: string;
15
+ readonly toolUseId: string;
16
+ readonly tool: string;
17
+ /** When it runs out, epoch seconds. */
18
+ readonly expiresAt: number;
19
+ }
20
+ export declare class ApprovalCards {
21
+ private readonly store;
22
+ constructor(store: ApprovalRecordStore);
23
+ /**
24
+ * Show `card` for an approval in `conversation`, once: false when a card for it is in a chat already (nothing is sent). A card
25
+ * that could not be sent leaves no record (whatever else shows the approval then may show it), and the error goes on.
26
+ */
27
+ show(conversation: Conversation, request: ApprovalCardRequest, card: OutMessage): Promise<boolean>;
28
+ /** When an approval a turn shows runs out: as long as Brain waits for it (`expiresIn` seconds), else `fallbackSeconds` on. */
29
+ expiry(expiresIn: number | undefined, fallbackSeconds: number): number;
30
+ }
31
+ /** A turn's deadline: an approval a turn shows is answerable this long when Brain did not say how long it waits (turn.py). */
32
+ export declare const TURN_DEADLINE_SECONDS: number;
33
+ /**
34
+ * The turn engine's view of the records (W4's `TurnApprovals`, satisfied structurally): `record` is told whose approval it is,
35
+ * the person the turn is for (Python `store.save_approval(sender.aad_id, ...)`).
36
+ */
37
+ export interface TurnApprovalRecords {
38
+ record(userId: string, sessionId: string, toolUseId: string, tool: string, expiresIn: number | undefined, envelope: Envelope): boolean;
39
+ sent(sessionId: string, toolUseId: string): void;
40
+ unsent(sessionId: string, toolUseId: string): void;
41
+ }
42
+ /** The records of the approvals a turn shows (the Python `on_approval`, `on_approval_sent`, `on_approval_unsent`). */
43
+ export declare function turnApprovals(store: ApprovalRecordStore): TurnApprovalRecords;
@@ -0,0 +1,13 @@
1
+ /** The words of an argument name, as the credential rule reads them (camelCase and ALLCaps split, lower case). */
2
+ export declare function nameWords(name: string): string[];
3
+ /** Whether a value stored under this argument name must not be shown. */
4
+ export declare function isSensitiveName(name: unknown): boolean;
5
+ /** Every string (or number) under a credential-named argument, at any depth: the values no text about the call may repeat. */
6
+ export declare function credentialValues(value: unknown, underSecret?: boolean, depth?: number): string[];
7
+ /** `text` with every occurrence of each secret replaced; longest first, so one inside another goes whole. */
8
+ export declare function scrub(text: string, secrets: readonly string[]): string;
9
+ /**
10
+ * A copy of a JSON value with credential-named fields replaced whole and strings masked by shape; `secrets` (the values typed
11
+ * under credential-named arguments) are replaced wherever else they repeat.
12
+ */
13
+ export declare function maskValue(value: unknown, secrets?: readonly string[], depth?: number): unknown;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The approvals feature's half of the turn's `TurnCards`: the card of a held tool call (Python render.py `permission_card`) and
3
+ * of an agent's question (turn.py `question_card(card_questions(questions), ...)`, the questions read here). The feedback
4
+ * feature brings `thumbs`; whoever assembles the worker joins the two.
5
+ */
6
+ import type { TurnCards } from "../ports/turn-cards.js";
7
+ export declare const approvalTurnCards: Pick<TurnCards, "approval" | "question">;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The approval and question views any feature may show (a turn's permission request, a remote agent's, a work item's). The
3
+ * channel adapter renders them; `approvalView` (approval-view.ts) is what an approval card says.
4
+ */
5
+ import type { JsonObject } from "../json.js";
6
+ import type { CardQuestion } from "./questions.js";
7
+ /** An approval card: the arguments of the Python worker's `render.permission_card`, one for one. */
8
+ export interface ApprovalCardModel {
9
+ readonly tool: string;
10
+ readonly input: unknown;
11
+ readonly sessionId: string;
12
+ readonly toolUseId: string;
13
+ readonly group: boolean;
14
+ /** Who alone can answer it in a group ("" for "the person who asked"). */
15
+ readonly ownerName: string;
16
+ /** Brain's permissionRequest (summary, tool_description, intent, approval_label); null when there is none. */
17
+ readonly event: JsonObject | null;
18
+ /** "zh" or "en"; null to follow the summary's language. */
19
+ readonly lang: string | null;
20
+ }
21
+ /** A question card: the arguments of `render.question_card`. */
22
+ export interface QuestionCardModel {
23
+ readonly questions: readonly CardQuestion[];
24
+ readonly sessionId: string;
25
+ readonly toolUseId: string;
26
+ readonly group: boolean;
27
+ readonly ownerName: string;
28
+ /** A line under the header: which task asks, or what happened when the card comes back after a click ("" when none). */
29
+ readonly note: string;
30
+ }
31
+ /** What replaces an approval card once it was answered (render.decided_card). */
32
+ export interface ApprovalDecidedModel {
33
+ readonly tool: string;
34
+ /** "allow" or "deny". */
35
+ readonly action: string;
36
+ /** When it was answered, epoch seconds, shown as HH:MM in `zone`. */
37
+ readonly when: number;
38
+ readonly zone: string;
39
+ }
40
+ /** An approval or a question that ran out (render.expired_card). */
41
+ export interface ApprovalExpiredModel {
42
+ readonly tool: string;
43
+ }
44
+ /** What replaces a question card once it was answered (render.answered_card). */
45
+ export interface QuestionAnsweredModel {
46
+ /** (question id, answer), in the order of the questions. */
47
+ readonly answers: readonly (readonly [string, string])[];
48
+ readonly when: number;
49
+ readonly zone: string;
50
+ }
51
+ /** An approval card put back after a press that did not go through: the note, then Approve and Deny again. */
52
+ export interface ApprovalAgainModel {
53
+ readonly text: string;
54
+ readonly tool: string;
55
+ readonly sessionId: string;
56
+ readonly toolUseId: string;
57
+ }
58
+ declare module "../ports/surface.js" {
59
+ interface ViewMap {
60
+ approval: ApprovalCardModel;
61
+ approvalAgain: ApprovalAgainModel;
62
+ approvalDecided: ApprovalDecidedModel;
63
+ approvalExpired: ApprovalExpiredModel;
64
+ question: QuestionCardModel;
65
+ questionAnswered: QuestionAnsweredModel;
66
+ }
67
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The buttons of the cards the assistant puts to the person, for the router (teams_agent/agent.py `_dispatch`: `_action_click` and
3
+ * `_confirm_click`, after the person's key is read; a group chat answers neither). Run or Cancel under a command
4
+ * (`assistant_action`), Allow or Deny on a write Claw holds (`assistant_confirm`).
5
+ */
6
+ import type { ClickHandler, ClickRoute } from "../ports/routing.js";
7
+ import type { AssistantActions } from "./actions.js";
8
+ export declare class AssistantActionClicks implements ClickHandler {
9
+ private readonly actions;
10
+ readonly verbs: readonly ["assistant_action", "assistant_confirm"];
11
+ constructor(actions: Pick<AssistantActions, "actionClick" | "confirmClick">);
12
+ withCredential(click: ClickRoute, credential: string): Promise<void>;
13
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * What the assistant asks this chat to do, and the buttons it puts to the person for that (teams_agent/agent.py `run_action`,
3
+ * `_action_click`, `_confirm_click`). A command is carried out only for a message this worker sent for the person (by its id),
4
+ * only for an action that message declared, once, and exactly as if the person had typed it. Cards are not trusted: a button
5
+ * carries the id of the card this worker recorded, what it means is read from the record, and of two presses exactly one goes on.
6
+ * A held write is answered as the person, with the token the identity service exchanges for them, never their linked key.
7
+ */
8
+ import { type CardClick } from "../approvals/click.js";
9
+ import type { ClawAssistantPort } from "../ports/claw/assistant.js";
10
+ import type { Logger } from "../ports/logger.js";
11
+ import type { StorePort } from "../ports/store/index.js";
12
+ import type { TokenExchange } from "../plugins/token-exchange.js";
13
+ /** The handoff a message declares for a review asked of someone else: started by the review line (W7), not here. */
14
+ export declare const REVIEW_HANDOFF = "review_for_other";
15
+ export type AssistantActionStore = Pick<StorePort, "assistantButtons" | "assistantMessages" | "idempotency">;
16
+ export interface AssistantActionDeps {
17
+ readonly store: AssistantActionStore;
18
+ readonly claw: Pick<ClawAssistantPort, "decideConfirmation">;
19
+ readonly exchange: TokenExchange;
20
+ /** Carries out `text` exactly as if the presser had typed it, with their linked `key`; false when it was not done. */
21
+ readonly runCommand: (text: string, click: CardClick, key: string) => Promise<boolean>;
22
+ /** The router's test of a command typed whole. */
23
+ readonly exactCommand: (text: string) => boolean;
24
+ /** The arguments of an `agent` action are one the assistant may ask for. */
25
+ readonly agentActionAllowed: (args: string) => boolean;
26
+ /** The assistant understands the person's messages. */
27
+ readonly understands: (userId: string) => boolean;
28
+ /** The person's assistant can answer them. */
29
+ readonly reachable: (userId: string) => boolean;
30
+ readonly logger: Logger;
31
+ /** Takes a review handed back to this chat (the review service's `ReviewHandoffAction.take`); dropped without it. */
32
+ readonly reviewHandoff?: (userId: string, event: Readonly<Record<string, unknown>>) => "delivered" | "dropped";
33
+ }
34
+ type Event = Readonly<Record<string, unknown>>;
35
+ export declare class AssistantActions {
36
+ private readonly deps;
37
+ constructor(deps: AssistantActionDeps);
38
+ /** A message this worker sent for `userId` declared `name`, and `/{name} {args}` is a command it may carry out. */
39
+ private declared;
40
+ /**
41
+ * An `assistant.action` event for `userId`: carried out by `run` (the command exactly as typed, as the person) only for a message
42
+ * this worker sent for them that declared it, and once per event id. A review handoff goes to the review service.
43
+ */
44
+ runAction(userId: string, event: Event, run: (text: string) => Promise<boolean>): Promise<"delivered" | "dropped">;
45
+ /**
46
+ * Run or Cancel (`op`) under a command the assistant put to the person. The card must be the presser's and not yet used; the
47
+ * command is the recorded one, for a message this worker sent for them that declared it. Run carries it out as typed.
48
+ */
49
+ actionClick(click: CardClick, key: string): Promise<void>;
50
+ private run;
51
+ /**
52
+ * Allow or Deny (`op`) on a write Claw holds until the person answers. The card must be the presser's and not yet used; what it
53
+ * answers is the recorded confirmation, as the person with their exchanged token. Of two presses exactly one is sent.
54
+ */
55
+ confirmClick(click: CardClick): Promise<void>;
56
+ /** The presser's exchanged token; undefined when it cannot be had (the card was answered with why, as it was). */
57
+ private token;
58
+ /** Claw did not answer, or refused: a 403 or 404 ends the card (pressing again cannot help); anything else gives it back. */
59
+ private notAnswered;
60
+ /** Nothing was answered: the card comes back with `note`, and pressing it again can help. */
61
+ private again;
62
+ }
63
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { ClawWorkItemsPort } from "../ports/claw/index.js";
2
+ import type { Logger } from "../ports/logger.js";
3
+ import type { AssistantCardRepository } from "../ports/store/index.js";
4
+ /** A watch Claw lists that still answers new comments unasked. */
5
+ export declare function answersUnasked(watch: Readonly<Record<string, unknown>>): boolean;
6
+ export declare function refreshAutoReply(deps: {
7
+ readonly cards: Pick<AssistantCardRepository, "autoReply" | "clearAutoReply">;
8
+ readonly claw: Pick<ClawWorkItemsPort, "watches"> | undefined;
9
+ readonly logger: Logger;
10
+ }, call: {
11
+ readonly userId: string;
12
+ readonly itemId: string;
13
+ readonly key: string | null;
14
+ }): Promise<void>;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * `/board` (teams_agent/assistant.py `board`, `_board_card`, `_remote_ask_card`): the person's work items in three sections, the
3
+ * reviews they asked of others beside them, and a card for each item that waits for them (at most BOARD_CARDS). The board's own
4
+ * buttons (Accept all, Retry) carry only card ids recorded first, so a press means what the board showed.
5
+ */
6
+ import type { ReviewAskedOfOther, WorkItem } from "../claw/model.js";
7
+ import type { ClawWorkItemsPort } from "../ports/claw/index.js";
8
+ import type { Logger } from "../ports/logger.js";
9
+ import type { StorePort } from "../ports/store/index.js";
10
+ import type { Conversation, OutMessage } from "../ports/surface.js";
11
+ /** Results one Accept all takes (the board button counts the same ones it carries). */
12
+ export declare const ACCEPT_ALL_MAX = 50;
13
+ /** After a Claw without retry said so, the board offers no Retry for this long. */
14
+ export declare const NO_RETRY_SECONDS: number;
15
+ export type BoardStore = Pick<StorePort, "now" | "prefs" | "assistantCards" | "remotePermissions">;
16
+ /** The approval card of a request an agent on the person's machine waits on, as the board shows it (W6b's card). */
17
+ export type BoardRemoteAsk = (request: {
18
+ readonly ask: Readonly<Record<string, unknown>>;
19
+ readonly options: readonly unknown[];
20
+ readonly sessionId: string;
21
+ readonly machine: string;
22
+ readonly agent: string;
23
+ readonly about: string;
24
+ readonly expiresAt: number;
25
+ readonly zone: string;
26
+ readonly lang: string;
27
+ }) => OutMessage;
28
+ export interface BoardDeps {
29
+ readonly store: BoardStore;
30
+ readonly claw: Pick<ClawWorkItemsPort, "list" | "askedOfOthers" | "watches">;
31
+ readonly logger: Logger;
32
+ /** The chat talks to the assistant (`AssistantChat.on`). */
33
+ readonly on: (userId: string) => boolean;
34
+ readonly remoteAsk: BoardRemoteAsk;
35
+ /** The locale of the client the message being handled came from ("" none): the language before the person said one. */
36
+ readonly clientLocale?: () => string;
37
+ }
38
+ export declare class Board {
39
+ private readonly deps;
40
+ /** Claw answered Retry with a route it does not have (a Claw before retry): no Retry on the board until then. */
41
+ noRetryUntil: number;
42
+ constructor(deps: BoardDeps);
43
+ private locale;
44
+ /** `/board`: the person's work items, and a card for each one that waits for them. */
45
+ show(userId: string, key: string, conversation: Conversation): Promise<void>;
46
+ /** The reviews the person asked of others; best effort: the board is shown whatever this answers. */
47
+ private askedOfOthers;
48
+ private waitingCards;
49
+ /**
50
+ * For a development environment item that waits on the person: the approval card of the first of its requests this chat was
51
+ * shown and that is still open, so the board's "needs you" is answered where it is listed. Undefined: the item's own card.
52
+ */
53
+ private remoteAskCard;
54
+ /** The board with its own buttons, each button's card recorded first; in the person's language. */
55
+ model(userId: string, items: readonly WorkItem[], asked: readonly ReviewAskedOfOther[]): {
56
+ items: readonly WorkItem[];
57
+ asked: readonly ReviewAskedOfOther[];
58
+ now: number;
59
+ accept: string[];
60
+ retry: {
61
+ cardId: string;
62
+ item: WorkItem;
63
+ }[];
64
+ lang: "en" | "zh";
65
+ };
66
+ /** The board as it is now, to replace the board a press was made on; undefined when it cannot be read. */
67
+ now(userId: string, key: string): Promise<OutMessage | undefined>;
68
+ }