@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,20 @@
1
+ import type { Lang } from "../locales/lang.js";
2
+ export interface PermissionOption {
3
+ readonly optionId: string;
4
+ readonly name: string;
5
+ readonly kind: string;
6
+ }
7
+ /** The options an agent offered, as strings and nothing else: an entry without a usable `optionId` is dropped, a repeated id is
8
+ * kept once, at most twelve. */
9
+ export declare function parseOptions(raw: unknown): PermissionOption[];
10
+ /** What a button says: the agent's own name for the option, clipped; an option that persists (`allow_always`) always says so,
11
+ * whatever the agent called it. With no name the kind's plain words, else the id. */
12
+ export declare function buttonTitle(option: PermissionOption, lang?: Lang): string;
13
+ /** The options a card shows, in the fixed order, at most OPTION_BUTTONS_MAX. */
14
+ export declare function shownOptions(options: readonly PermissionOption[]): PermissionOption[];
15
+ /** The one primary button is allow once; a rejection is a plain one. */
16
+ export declare function isPrimary(option: PermissionOption): boolean;
17
+ /** Whether choosing one of `options` changes what the agent may do from now on (an always option). */
18
+ export declare function offersAlways(options: readonly PermissionOption[]): boolean;
19
+ /** What an option came to, once chosen ("Allowed once"), or its button's words for a kind with no verdict of its own. */
20
+ export declare function decidedVerdict(option: PermissionOption, lang?: Lang): string;
@@ -0,0 +1,41 @@
1
+ import type { Lang } from "../locales/lang.js";
2
+ import { type Conversation, type OutMessage } from "../ports/surface.js";
3
+ import { type PermissionOption } from "./options.js";
4
+ import type { RemoteContext } from "./context.js";
5
+ import type { StatusBoard } from "./board.js";
6
+ import { type ChatState } from "./state.js";
7
+ /** How a click ends: the clicked card replaced by `card` (a note when it is text), and the outcome said (W4's `ClickRoute.settle`). */
8
+ export type Settle = (card: OutMessage | string, options?: {
9
+ readonly fallback?: string;
10
+ readonly announce?: boolean;
11
+ }) => Promise<boolean>;
12
+ /** A click on an option of a permission card. */
13
+ export interface Decision {
14
+ /** Who clicked (their 1:1 chat key). */
15
+ readonly person: string;
16
+ readonly key: string;
17
+ readonly data: Readonly<Record<string, unknown>>;
18
+ readonly settle: Settle;
19
+ }
20
+ /** The one line an answered approval comes to ("已允许一次:Bash", "Allowed once: Bash."). */
21
+ export declare function decidedLine(option: PermissionOption, tool: string, lang: Lang): string;
22
+ export declare class Permissions {
23
+ private readonly ctx;
24
+ private readonly state;
25
+ private readonly board;
26
+ constructor(ctx: RemoteContext, state: ChatState, board: StatusBoard);
27
+ /**
28
+ * One card per request. The row is written BEFORE the card is shown, so the owner and the options are known when it is clicked;
29
+ * a request the connector sends again after a reconnect finds its row and is not shown twice.
30
+ */
31
+ show(chatKey: string, sessionId: string, request: Readonly<Record<string, unknown>>, to: Conversation): Promise<void>;
32
+ /** The card again with its buttons and `text` on it: the decision did not go through. */
33
+ private reopened;
34
+ /** A click on an option of a permission card (see the module). */
35
+ decide(click: Decision): Promise<void>;
36
+ /** Past its time a request is refused, whatever the button says. */
37
+ private ranOut;
38
+ private answer;
39
+ /** The decision to Claw; false (and the click answered) when it did not go through. */
40
+ private send;
41
+ }
@@ -0,0 +1,143 @@
1
+ /**
2
+ * What the remote agents need of their view (core/src/remote-view, which implements it as `createRemoteViews`): the cards they
3
+ * post, as messages, and the live view of a turn. The domain says what is shown (the inputs here); the view says how. The
4
+ * assembly gives the domain the view's implementation (`RemoteContext.views`), so the domain never imports the view.
5
+ */
6
+ import type { Lang } from "../locales/lang.js";
7
+ import type { OutMessage } from "../ports/surface.js";
8
+ import type { ButtonFields, DecisionButton } from "./actions.js";
9
+ import type { Conversation } from "./conversations.js";
10
+ import type { RemoteStep } from "./events.js";
11
+ import type { StatusPhase } from "./lines.js";
12
+ import type { Agent, Connector, Session } from "./model.js";
13
+ import type { PermissionOption } from "./options.js";
14
+ import type { ConnectorSetupWords } from "./setup.js";
15
+ import type { WindowView } from "./window/view.js";
16
+ export interface StatusInput {
17
+ /** `icon name` of the agent. */
18
+ readonly label: string;
19
+ readonly host: string;
20
+ readonly cwd: string;
21
+ readonly mode: string | null;
22
+ readonly sessionId: string;
23
+ readonly phase: StatusPhase;
24
+ /** When the phase was last true, seconds since the epoch (shown as UTC, so a phone that did not redraw shows its age). */
25
+ readonly at: number;
26
+ readonly lang?: Lang;
27
+ /** The agent said its modes: Mode is offered. */
28
+ readonly hasModes?: boolean;
29
+ readonly unattended?: boolean;
30
+ readonly lead?: string;
31
+ /** The title of the conversation the chat joined, "" for none. */
32
+ readonly conversation?: string;
33
+ /** What Take over… carries, for a watched conversation the connector can take over; null for none. */
34
+ readonly takeover?: ButtonFields | null;
35
+ /** What is sent is typed into a terminal on the machine, so Stop says it interrupts the turn running there. */
36
+ readonly terminal?: boolean;
37
+ /** The assistant's display name. */
38
+ readonly bot: string;
39
+ }
40
+ export interface AgentsInput {
41
+ readonly connectors: readonly Connector[];
42
+ readonly sessions: readonly Session[];
43
+ /** The session the chat is attached to. */
44
+ readonly attached: string | null;
45
+ readonly now: number;
46
+ /** One line on top: what the tap that brought the card back did, or why it did not. */
47
+ readonly lead?: string;
48
+ readonly machines?: boolean;
49
+ readonly lang?: Lang;
50
+ /** Session id -> (title, the ref of the terminal conversation it joined, "" for none) of the sessions this chat started. */
51
+ readonly names?: ReadonlyMap<string, {
52
+ readonly title: string;
53
+ readonly ref: string;
54
+ }>;
55
+ /** Session id -> the machine's conversation id of this chat's own sessions. */
56
+ readonly own?: ReadonlyMap<string, string>;
57
+ readonly setup: ConnectorSetupWords;
58
+ }
59
+ export interface SessionsInput {
60
+ readonly connectors: readonly Connector[];
61
+ readonly sessions: readonly Session[];
62
+ readonly attached: string | null;
63
+ readonly now: number;
64
+ readonly lang?: Lang;
65
+ readonly lead?: string;
66
+ readonly setup: ConnectorSetupWords;
67
+ /** Session ids with an approval card open. */
68
+ readonly waiting?: ReadonlySet<string>;
69
+ }
70
+ /** One approval the session waits on: the tool, when it runs out, and the agent's own options as buttons. */
71
+ export interface WindowApproval {
72
+ readonly actionId: string;
73
+ readonly tool: string;
74
+ readonly expiresAt: number;
75
+ readonly buttons: readonly DecisionButton[];
76
+ }
77
+ export interface WindowInput {
78
+ /** `icon name` of the agent. */
79
+ readonly label: string;
80
+ readonly host: string;
81
+ readonly cwd: string;
82
+ readonly mode: string | null;
83
+ readonly sessionId: string;
84
+ readonly phase: StatusPhase;
85
+ readonly at: number;
86
+ readonly lang: Lang;
87
+ readonly view: WindowView;
88
+ readonly approvals: readonly WindowApproval[];
89
+ /** The person's time zone (an IANA name). */
90
+ readonly zone?: string;
91
+ readonly unattended?: boolean;
92
+ readonly lead?: string;
93
+ readonly conversation?: string;
94
+ readonly hasModes?: boolean;
95
+ readonly takeover?: ButtonFields | null;
96
+ /** A group chat bound to the session: its approvals go to the binder's 1:1 chat, never here. */
97
+ readonly group?: boolean;
98
+ readonly terminal?: boolean;
99
+ /** The assistant's display name. */
100
+ readonly bot: string;
101
+ }
102
+ export interface PermissionCard {
103
+ readonly request: Readonly<Record<string, unknown>>;
104
+ readonly options: readonly PermissionOption[];
105
+ readonly sessionId: string;
106
+ readonly who: string;
107
+ readonly expiresAt: number;
108
+ readonly zone: string;
109
+ readonly lang: Lang;
110
+ }
111
+ /** A card that lists sessions, and the session ids it numbers. */
112
+ export interface ListedMessage {
113
+ readonly message: OutMessage;
114
+ readonly listing: readonly string[];
115
+ }
116
+ /** The live view of a remote turn in a chat (`RemoteLiveView`): what the turn's status message shows as it goes. */
117
+ export interface RemoteLive {
118
+ readonly header: string;
119
+ /** True when the step changed what is shown. */
120
+ apply(step: RemoteStep): boolean;
121
+ render(): string;
122
+ statusLines(): string[];
123
+ }
124
+ /** The remote agents' cards, as messages to post. */
125
+ export interface RemoteViews {
126
+ status(input: StatusInput): OutMessage;
127
+ window(input: WindowInput): {
128
+ readonly message: OutMessage;
129
+ readonly takesInput: boolean;
130
+ };
131
+ agents(input: AgentsInput): ListedMessage;
132
+ sessions(input: SessionsInput): ListedMessage;
133
+ machineChoice(connector: Connector, agents: readonly Agent[], token: string, path: string, lang: Lang): OutMessage;
134
+ mode(sessionId: string, current: string | null, modes: readonly string[], unattended: ReadonlySet<string>, lang: Lang): OutMessage;
135
+ disconnect(host: string, connectorId: string, setup: ConnectorSetupWords, lang: Lang, paired: boolean): OutMessage;
136
+ permission(card: PermissionCard): OutMessage;
137
+ decided(option: PermissionOption, when: number, zone: string, lang: Lang): OutMessage;
138
+ takeover(connector: Connector, agent: Agent, entry: Conversation, lang: Lang, view: string, ticket: string): OutMessage;
139
+ hidden(connector: Connector, now: number, lang: Lang): OutMessage;
140
+ /** A permission request's buttons (the ones its card shows). */
141
+ optionButtons(options: readonly PermissionOption[], sessionId: string, actionId: string, lang: Lang): DecisionButton[];
142
+ liveView(label: string, lang: Lang): RemoteLive;
143
+ }
@@ -0,0 +1,60 @@
1
+ import { type Conversation } from "../ports/surface.js";
2
+ import type { StatusBoard } from "./board.js";
3
+ import type { RemoteTurn } from "./chats.js";
4
+ import type { RemoteContext } from "./context.js";
5
+ import type { Provider } from "./ended.js";
6
+ import type { FollowControl } from "./follow/control.js";
7
+ import type { SessionStarts } from "./sessions.js";
8
+ import { type ChatState } from "./state.js";
9
+ import type { TurnRunner } from "./turns/runner.js";
10
+ import type { Watches } from "./watches.js";
11
+ import type { SentFrom } from "./window/view.js";
12
+ /** One message for the agent. */
13
+ export interface Prompt {
14
+ readonly chatKey: string;
15
+ readonly key: string;
16
+ readonly to: Conversation;
17
+ readonly provider: Provider;
18
+ readonly text: string;
19
+ /** The channel's id of the message (one key per message: a redelivered one queues one prompt). */
20
+ readonly messageId: string;
21
+ /** Where it was typed (`card`: the session card's box); '' works it out (a reply quoting the card, or the chat box). */
22
+ readonly source: SentFrom;
23
+ /** The message replies quoting this chat's session card. */
24
+ readonly quotesWindow: boolean;
25
+ }
26
+ export declare class Prompts {
27
+ private readonly ctx;
28
+ private readonly state;
29
+ private readonly board;
30
+ private readonly follow;
31
+ private readonly starts;
32
+ private readonly runner;
33
+ private readonly watches;
34
+ constructor(ctx: RemoteContext, state: ChatState, board: StatusBoard, follow: FollowControl, starts: SessionStarts, runner: TurnRunner, watches: Watches);
35
+ private say;
36
+ /** Plain text from a chat that is attached: it is the agent's, not the assistant's. */
37
+ prompt(p: Prompt): Promise<void>;
38
+ /** The terminal is using the session: what is typed here is answered, never sent. */
39
+ private watched;
40
+ /** The prompt to Claw; false (and the person told why) when it did not go. */
41
+ private send;
42
+ private failure;
43
+ private started;
44
+ /**
45
+ * Move the read position to the end of the session's events, so a turn reads its own and nothing the agent wrote before. Null
46
+ * when it was moved; otherwise the sentence for the person (the end could not be read, or the session is gone: the chat leaves it).
47
+ */
48
+ private skipBacklog;
49
+ /**
50
+ * `/stop` for a chat that is attached: the agent is told to cancel. False when the chat is not attached. `only`: cancel only while
51
+ * that turn is the one this worker watches, checked with no wait before the cancel goes (a Stop card's turn); false, with nothing
52
+ * said or sent, when it is not.
53
+ */
54
+ stop(chatKey: string, key: string, to: Conversation, only?: RemoteTurn): Promise<boolean>;
55
+ /** The Stop card's turn is still the one running for the chat, and the chat is still attached. */
56
+ private stillOn;
57
+ private cancel;
58
+ /** A turn nobody reads any more is not open: what the agent says from here on is the follower's. */
59
+ private closeTurn;
60
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * What a refusal from Claw's remote-agents API means for a person, in the chat's language. The refusals that have a sentence of
3
+ * their own are a closed set, by (status, `error` code), then by status alone; a 400 names its code when that is a plain word
4
+ * that names no service, else a reference to the log line that keeps it.
5
+ */
6
+ import { ClawError } from "../claw/errors.js";
7
+ import type { Lang } from "../locales/lang.js";
8
+ import type { PublicErrors } from "../public-error/public-errors.js";
9
+ import { type RemoteSentence } from "../locales/remote-agents.js";
10
+ import type { Connector } from "./model.js";
11
+ /**
12
+ * How a detail that may be internal is kept from a person (`public-error`): whether text looks internal, and logging it under
13
+ * a new reference that the person is given instead.
14
+ */
15
+ export interface RefusalErrors extends Pick<PublicErrors, "withhold"> {
16
+ looksInternal(text: string): boolean;
17
+ }
18
+ /** A new session refused as offline twice while the machine was reconnecting: said as that, never as "restart it". */
19
+ export declare class Reconnecting extends ClawError {
20
+ readonly connector: Connector;
21
+ readonly name: string;
22
+ constructor(connector: Connector);
23
+ }
24
+ /** Claw's refusals that have a sentence of their own, by "status error" (`failureText`). */
25
+ export declare const REFUSALS: ReadonlyMap<string, RemoteSentence>;
26
+ /** ... and by status alone. */
27
+ export declare const STATUS_REFUSALS: ReadonlyMap<number, RemoteSentence>;
28
+ /** A fixed sentence of remote agents in `lang`. */
29
+ export declare function saidIn(lang: Lang, sentence: RemoteSentence): string;
30
+ /** What a refusal from Claw's remote-agents API means for a person, in `lang`. `now`: wall-clock seconds. */
31
+ export declare function failureText(err: ClawError, errors: RefusalErrors, now: number, lang?: Lang): string;
32
+ /** `base` as a sentence, with the reason an agent or a connector gave when there is one. */
33
+ export declare function withReason(base: string, reason: string | null | undefined): string;
34
+ /** What makes one key per inbound message: a hash of the text (hex), and fresh randomness for a message that has no id. */
35
+ export interface KeyMaker {
36
+ sha1Hex(text: string): string;
37
+ hexId(): string;
38
+ }
39
+ /** One key per inbound message, so a redelivered message queues one prompt (Claw accepts `[A-Za-z0-9._:-]{1,64}`). */
40
+ export declare function idempotencyKey(keys: KeyMaker, userId: string, activityId: string): string;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Remote agents from the chat: the coding agents on a person's own machines, driven from the chat. `/agents` lists them,
3
+ * `/agent new|attach|detach|mode|sessions|close|off|pair` manages sessions, and once a chat is attached its plain messages go to
4
+ * the remote session instead of to the assistant. Claw's remote-agents API relays everything; this is the chat's side of it.
5
+ *
6
+ * Everything runs as the person who wrote: their credential, and nobody else's, is what every call carries, and Claw answers 404
7
+ * for a session or connector that is not theirs. Cards are not trusted: a click is checked against what this process stored when
8
+ * it showed the card, never against the card. The agent's own words are untrusted text. This is the router's `RemoteChat` and the
9
+ * click handler of the remote-agent cards; the parts are assembled here and nowhere else.
10
+ */
11
+ import type { JsonObject } from "../json.js";
12
+ import type { Lang } from "../locales/lang.js";
13
+ import type { ClickHandler } from "../ports/routing.js";
14
+ import type { Conversation, InboundMessage, UserRef } from "../ports/surface.js";
15
+ import type { Attachment, RemoteAgentCommand, RemoteChat, RemotePrompt } from "../routing/features.js";
16
+ import { type RemoteTurn } from "./chats.js";
17
+ import type { RemoteContext } from "./context.js";
18
+ /** How long the assistant's context waits for a session's watch marker to be read back. */
19
+ export declare const CHAT_CONTEXT_WATCH_SECONDS = 2;
20
+ export declare class RemoteAgents implements RemoteChat {
21
+ private readonly chats;
22
+ private readonly state;
23
+ private readonly board;
24
+ private readonly follow;
25
+ private readonly commands;
26
+ private readonly clicks;
27
+ private readonly starts;
28
+ private readonly machine;
29
+ private readonly permissions;
30
+ private readonly prompts;
31
+ private readonly runner;
32
+ private readonly ctx;
33
+ constructor(context: RemoteContext);
34
+ /** What reads Claw for a chat with nobody to ask (its binder's credential for a group binding). */
35
+ private readKey;
36
+ /** How a turn is shown: in the session card when it is the window, else in the chat. */
37
+ private display;
38
+ get enabled(): boolean;
39
+ /** An attached chat hears its session between turns. */
40
+ get follows(): boolean;
41
+ attached(chatKey: string): boolean;
42
+ running(chatKey: string): boolean;
43
+ direct(chatKey: string): boolean;
44
+ /** Where the chat box of an attached chat goes: 'card' (to the assistant) or 'chat' (to the session). */
45
+ windowMode(chatKey: string): "card" | "chat";
46
+ quotesWindow(chatKey: string, message: InboundMessage): boolean;
47
+ /** What help says this chat is attached to (agent.py's help lead): each part made safe to show. */
48
+ attachment(chatKey: string, lang: Lang): Attachment | undefined;
49
+ groupChatKey(userId: string, scope: string): string;
50
+ /**
51
+ * The session this chat is attached to, as its assistant is told it beside a message. The watch marker is read back the first
52
+ * time this process is asked, but never holds the message up longer than CHAT_CONTEXT_WATCH_SECONDS.
53
+ */
54
+ chatContext(chatKey: string, credential: string): Promise<JsonObject | null>;
55
+ private call;
56
+ prompt(request: RemotePrompt): Promise<void>;
57
+ /** `only`: a Stop card's turn; the press stops nothing once that turn is not the one running (see Prompts.stop). */
58
+ stop(chat: UserRef, credential: string, conversation: Conversation, only?: RemoteTurn): Promise<boolean>;
59
+ /** The turn this worker is watching for the chat now, if any (what a phone's Stop card is sent for). */
60
+ currentTurn(chatKey: string): RemoteTurn | undefined;
61
+ /** The chat's session card is its window (`/agent mode card`, not a direct chat): a turn is shown there, with its own Stop. */
62
+ windowed(chatKey: string): boolean;
63
+ agents(sender: UserRef, credential: string, conversation: Conversation): Promise<void>;
64
+ agent(command: RemoteAgentCommand): Promise<void>;
65
+ /** Stop watching for a chat whose person unlinked: no reader may outlive the key it reads with. */
66
+ forget(chatKey: string): void;
67
+ /** `forget` for the person's 1:1 chat and every group chat they bound to a session. */
68
+ forgetPerson(userId: string): void;
69
+ /** Follow every chat that is attached: a worker that starts delivers what its agents said while it was away, once. */
70
+ resume(): void;
71
+ shutdown(): void;
72
+ /** The chats a turn or a short watch is reading now. */
73
+ busyChats(): string[];
74
+ /** Every turn and short watch is cancelled: nothing outlives the process (or the test) that started it. */
75
+ cancelAll(): void;
76
+ /** The click handler of the remote-agent cards: the agents and sessions cards, the status card, approvals, disconnect. */
77
+ get clickHandler(): ClickHandler;
78
+ private onClick;
79
+ /** A click on an option of a permission card (on the session card, the window stays the card). */
80
+ private decide;
81
+ /** A tap on a button of the agents card or of the status card. */
82
+ private tap;
83
+ private runOp;
84
+ }
@@ -0,0 +1,8 @@
1
+ /** One entry of a connector's report (a conversation, a health problem, a permission option). */
2
+ export type Reported = Readonly<Record<string, unknown>>;
3
+ /** `value` when it is a JSON object, else null. */
4
+ export declare function objOrNull(value: unknown): Reported | null;
5
+ /** The list `value` is, or []. */
6
+ export declare function list(value: unknown): readonly unknown[];
7
+ /** `value` when it is a string, else "". */
8
+ export declare function str(value: unknown): string;
@@ -0,0 +1,57 @@
1
+ import type { Lang } from "../locales/lang.js";
2
+ import type { RemoteState } from "../ports/store/remote.js";
3
+ import type { Conversation } from "../ports/surface.js";
4
+ import type { StatusPhase } from "./lines.js";
5
+ import type { Shown, StatusBoard } from "./board.js";
6
+ import type { RemoteContext } from "./context.js";
7
+ import type { Provider } from "./ended.js";
8
+ import type { AttachHooks } from "./sessions.js";
9
+ import type { FollowControl } from "./follow/control.js";
10
+ import { type Lists } from "./lists.js";
11
+ import { type Agent } from "./model.js";
12
+ import { type ChatState } from "./state.js";
13
+ import type { TurnRunner } from "./turns/runner.js";
14
+ export declare class SessionOps {
15
+ private readonly ctx;
16
+ private readonly state;
17
+ private readonly board;
18
+ private readonly lists;
19
+ private readonly follow;
20
+ private readonly runner;
21
+ private readonly show;
22
+ constructor(ctx: RemoteContext, state: ChatState, board: StatusBoard, lists: Lists, follow: FollowControl, runner: TurnRunner, show: (chatKey: string, sid: string, request: Readonly<Record<string, unknown>>, to: Conversation) => Promise<void>);
23
+ /**
24
+ * What follows an attachment once it is shown. Output after the last `turn_end` is a turn only when this chat sent a prompt that
25
+ * has not ended (the connector never ends what the agent goes on with by itself): that output is the follower's. A permission
26
+ * nobody answered gets its card.
27
+ */
28
+ attachHooks(chatKey: string, key: string, provider: Provider, to: Conversation): AttachHooks;
29
+ /**
30
+ * Back to the assistant while a turn of this chat's runs (or its message waits for the terminal): the chat stops reading it and
31
+ * nothing is sent to the machine, so a turn running in a terminal goes on there untouched (Stop is what interrupts). A message
32
+ * still waiting for the terminal is taken back where the connector can do that without stopping anything. The sentence for the
33
+ * person ('' when no turn of theirs was running).
34
+ */
35
+ letGoOfTurn(chatKey: string, key: string, state: RemoteState): Promise<string>;
36
+ /** Take back the messages that wait for the session's terminal, where its connector says it can. False when it cannot or did not. */
37
+ private withdraw;
38
+ /** The chat leaves its session for good (its machine went): nothing reads it any more. */
39
+ leave(chatKey: string): void;
40
+ /** The agent (as its machine reports it now) a chat is attached to; null when it cannot be read: what depends on it is not shown. */
41
+ agentOf(key: string, state: RemoteState): Promise<Agent | null>;
42
+ /**
43
+ * The chat's status card, with a note when the session runs without asking for approval (what the agent's machine reports about
44
+ * its mode, while the session itself has not said).
45
+ */
46
+ rowCard(chatKey: string, key: string, state: RemoteState, lead?: string, agent?: Agent, phase?: StatusPhase): Promise<Shown>;
47
+ /** Why `mode` cannot be asked for on this session, or null when it may be. */
48
+ modeRefusal(chatKey: string, state: RemoteState, mode: string, lang: Lang): string | null;
49
+ /**
50
+ * Close session `target` (one of the person's): whether it was, and the sentence (`folder` is named in it when known, and
51
+ * `number`, the number the list showed it under). The session this chat is attached to is left behind with it.
52
+ */
53
+ close(chatKey: string, key: string, target: string, folder?: string, number?: number): Promise<{
54
+ done: boolean;
55
+ text: string;
56
+ }>;
57
+ }
@@ -0,0 +1,80 @@
1
+ import type { RemoteContext } from "./context.js";
2
+ import type { FollowControl } from "./follow/control.js";
3
+ import type { Lists } from "./lists.js";
4
+ import { type Agent, type Connector, type Session } from "./model.js";
5
+ import type { ChatState } from "./state.js";
6
+ import { type SessionTail } from "./tail.js";
7
+ /** A new session refused as offline while its machine was reconnecting is asked for once more after this. */
8
+ export declare const RECONNECT_RETRY_SECONDS = 10;
9
+ /** What a new session is: where, and the conversation it takes over (or watches), when one. */
10
+ export interface NewSession {
11
+ readonly connector: Connector;
12
+ readonly agent: Agent;
13
+ readonly path: string;
14
+ readonly resumeRef?: string | undefined;
15
+ /** The person confirmed that the terminal that has the conversation open is ended first. */
16
+ readonly takeover?: boolean;
17
+ /** The conversation's title, which the status card names. */
18
+ readonly conversation?: string;
19
+ /** The count a start in a mode that does not ask took, given back when no session is made. */
20
+ readonly ticket: object | null;
21
+ }
22
+ /** What attaching came to: whether it did, the sentence (why not), what to do once it is shown, and what the card says. */
23
+ export interface Attached {
24
+ readonly ok: boolean;
25
+ readonly text: string;
26
+ followUp(): Promise<void>;
27
+ readonly phase: "idle" | "working" | "watching" | "offline";
28
+ readonly lead: string;
29
+ }
30
+ export declare class SessionStarts {
31
+ private readonly ctx;
32
+ private readonly state;
33
+ private readonly lists;
34
+ private readonly follow;
35
+ constructor(ctx: RemoteContext, state: ChatState, lists: Lists, follow: FollowControl);
36
+ /** Where the chat box goes when a chat attaches: the person's `/agent mode`, else the default; always the chat in a direct chat. */
37
+ newWindow(chatKey: string): string;
38
+ /**
39
+ * A new session of an agent configured to start in a mode that does not ask is that mode from its first message: it counts
40
+ * against the same per-person limit as a switch to one. The ticket of the count (null: none taken), or the refusal.
41
+ */
42
+ takeUnattendedStart(chatKey: string, agent: Agent): {
43
+ ticket: object | null;
44
+ refusal: string;
45
+ };
46
+ /** The label a session of `agent` is shown with: its icon and name. */
47
+ static labelOf(agent: Agent): string;
48
+ /**
49
+ * Start a session and attach the chat to it: the session id. The caller tells the person, then starts the watch for the agent's
50
+ * first word. The count `ticket` is given back when no session is made.
51
+ */
52
+ begin(chatKey: string, key: string, start: NewSession): Promise<string>;
53
+ /** The chat leaves what it was reading: a short watch, the follower; and it may be followed again. */
54
+ private leaveCurrent;
55
+ /**
56
+ * Ask Claw for the session. Refused as offline while the machine is reconnecting (heard from moments ago), it is asked for once
57
+ * more a little later; refused again, the refusal says it is reconnecting, never to restart a connector coming back by itself.
58
+ */
59
+ private create;
60
+ /** Where a session's events end now (`tail.ts`). */
61
+ tail(key: string, sessionId: string): Promise<SessionTail>;
62
+ /**
63
+ * Attach the chat to one of the person's sessions: nothing is replayed, the agent's own session is brought back. The caller
64
+ * shows `text` (why not), then runs `followUp` (a turn that is open is shown, a permission nobody answered gets its card).
65
+ */
66
+ attach(chatKey: string, key: string, session: Session, hooks: AttachHooks): Promise<Attached>;
67
+ /** The attachment in the store, and what this process knows of it. */
68
+ private remember;
69
+ /** Bring the agent's own session back (it keeps its context; nothing is replayed). */
70
+ private resume;
71
+ }
72
+ /** What the caller does once an attachment is shown: show a turn that is open, the permissions nobody answered, follow it. */
73
+ export interface AttachHooks {
74
+ followUp(found: {
75
+ readonly sessionId: string;
76
+ readonly tail: SessionTail;
77
+ readonly working: boolean;
78
+ readonly sent: boolean;
79
+ }): Promise<void>;
80
+ }
@@ -0,0 +1,26 @@
1
+ import type { Lang } from "../locales/lang.js";
2
+ import type { Connector } from "./model.js";
3
+ /** The connect steps for a card: the first line (the lead, or "You have no machine connected.", then what to run), each command
4
+ * on a line of its own, what to do after, and the per-system notes (one line each, joined by newlines). */
5
+ export interface ConnectSteps {
6
+ readonly lead: string;
7
+ readonly commands: readonly string[];
8
+ readonly after: string;
9
+ readonly notes: string;
10
+ }
11
+ /**
12
+ * What the remote-agent views say about connecting a machine and upgrading its connector: the exact commands a person copies
13
+ * (the connector-setup module of the remote-agent domain provides it, from what Claw says or the address Claw is reached at).
14
+ */
15
+ export interface ConnectorSetupWords {
16
+ /** The connect steps as markdown for a rich message: the commands in one code block a person copies whole. */
17
+ connectMarkdown(lang: Lang): string;
18
+ /** The same for a card; `lead` replaces the first sentence. */
19
+ connectSteps(lang: Lang, lead?: string): ConnectSteps;
20
+ /** One line under a machine whose connector Claw says is old, with the command that upgrades it; null otherwise. */
21
+ versionNote(connector: Connector, lang: Lang): string | null;
22
+ /** What brings an offline machine back. */
23
+ offlineHint(lang: Lang): string;
24
+ /** The exact `claw-connector login` command. */
25
+ login(): string;
26
+ }
@@ -0,0 +1,55 @@
1
+ import type { Lang } from "../locales/lang.js";
2
+ import type { RemotePermission, RemoteState } from "../ports/store/remote.js";
3
+ import type { ChatRegistry } from "./chats.js";
4
+ import type { RemoteContext } from "./context.js";
5
+ import { WindowView } from "./window/view.js";
6
+ /** What a chat's session is doing, as its status card says it. */
7
+ export type ChatPhase = "detached" | "watching" | "working" | "idle";
8
+ export declare class ChatState {
9
+ private readonly ctx;
10
+ readonly chats: ChatRegistry;
11
+ /** What each chat's session card shows of its session's output, in this process. */
12
+ private readonly views;
13
+ constructor(ctx: RemoteContext, chats: ChatRegistry);
14
+ attached(chatKey: string): RemoteState | null;
15
+ /** The language the chat is answered in ("en" when it cannot be read). */
16
+ lang(chatKey: string): Lang;
17
+ /** TEAMS_DIRECT_CHAT is on for this 1:1 chat's person (a group binding keeps its session card). */
18
+ directOn(chatKey: string): boolean;
19
+ /** The chat is the agent's window itself, with no card. */
20
+ direct(chatKey: string): boolean;
21
+ /** The chat's session only watches a conversation open in a terminal (read-only). */
22
+ watches(chatKey: string, state: RemoteState | null): boolean;
23
+ typesIntoTerminal(chatKey: string, state: RemoteState | null): boolean;
24
+ /**
25
+ * `watches`, with the marker read back from the session itself the first time this process is asked (a worker that restarted
26
+ * knows its chats' sessions, not which of them only watch): the newest `session_started`/`session_resumed` among its first events
27
+ * says. When that cannot be read the marker as it is answers.
28
+ */
29
+ knownWatch(chatKey: string, key: string, state: RemoteState): Promise<boolean>;
30
+ /** The watched session has ended (the terminal let the conversation go). False when it is on, or cannot be read now. */
31
+ watchOver(key: string, state: RemoteState): Promise<boolean>;
32
+ /** The watching status card offers Take over…: the ref is known, and the connector can take it over (or is not known not to). */
33
+ offersTakeover(chatKey: string): boolean;
34
+ phase(chatKey: string): ChatPhase;
35
+ /** The chat's window view, reset to its session's. */
36
+ view(chatKey: string, state?: RemoteState | null): WindowView;
37
+ /** The view when the chat has one, without making one. */
38
+ existingView(chatKey: string): WindowView | undefined;
39
+ forgetView(chatKey: string): void;
40
+ /** The approvals the chat's session waits for, as the window shows them (none in a group: those go to the binder's 1:1). */
41
+ approvalsOf(chatKey: string, state: RemoteState): RemotePermission[];
42
+ /** The person's time zone (IANA), the default when theirs is not one. */
43
+ zone(chatKey: string): string;
44
+ }
45
+ /** The zone the worker falls back to (the store's DEFAULT_TIMEZONE). */
46
+ export declare const DEFAULT_ZONE = "Asia/Shanghai";
47
+ /** `zone` when it is a time zone this runtime knows, else the default. */
48
+ export declare function validZone(zone: string): string;
49
+ /** Claw was not reached, or did not answer in time (the transport's own failure, never a refusal). */
50
+ export declare function isTransport(error: unknown): boolean;
51
+ /**
52
+ * What the session said of `mode` (`true`: it does not ask, `false`: it asks), or undefined when it said nothing. Its own keys only:
53
+ * a mode called `constructor` or `__proto__` is no flag (Python's `dict.get`).
54
+ */
55
+ export declare function modeFlagOf(flags: Readonly<Record<string, boolean>>, mode: string): boolean | undefined;