@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,230 @@
1
+ /** Version carried in every command frame, as `v`. */
2
+ export declare const REMOTE_AGENT_PROTOCOL_VERSION = 1;
3
+ export declare const REMOTE_AGENT_LIMITS: {
4
+ /** Connectors one user may keep (revoked ones do not count). */
5
+ readonly maxConnectorsPerUser: 5;
6
+ /** Sessions one user may have open at once. */
7
+ readonly maxActiveSessionsPerUser: 10;
8
+ /** Bytes of one event's `data`, as JSON. */
9
+ readonly maxEventBytes: number;
10
+ readonly maxEventsPerBatch: 200;
11
+ readonly maxAgentsPerConnector: 20;
12
+ /** Bytes of the capabilities object one agent reports. */
13
+ readonly maxCapabilitiesBytes: number;
14
+ /** Bytes of one prompt. */
15
+ readonly maxPromptBytes: number;
16
+ /** Commands one user may issue per minute, across all connectors. */
17
+ readonly commandsPerMinute: 60;
18
+ };
19
+ export declare const REMOTE_AGENT_TIMING: {
20
+ /** The server sends an `event: ping` frame this often on every stream. */
21
+ readonly pingMs: 25000;
22
+ /** A connector posts a heartbeat this often. */
23
+ readonly heartbeatMs: 30000;
24
+ /**
25
+ * A connector is online while its command stream is open and its last
26
+ * heartbeat is at most this old. Three missed heartbeats.
27
+ */
28
+ readonly onlineWindowMs: 90000;
29
+ /**
30
+ * How long a `prompt`, `set_mode` or `resume` (the commands with `needsOnline`) stays
31
+ * deliverable once queued. They are accepted only while the connector is online, so one
32
+ * still uncollected after this was sent into a connection that had died unnoticed, and
33
+ * nobody is waiting on it: it is dropped, not replayed when the machine wakes hours later.
34
+ * Longer than the connector's watchdog plus a reconnect, so an ordinary blip loses nothing.
35
+ */
36
+ readonly liveCommandTtlMs: number;
37
+ /** A connector that sees no byte for this long drops the stream and reconnects. */
38
+ readonly watchdogMs: 75000;
39
+ };
40
+ /** The npm package the connector is published as; its command is `claw-connector`. */
41
+ export declare const CONNECTOR_PACKAGE = "@primusclaw/connector";
42
+ /**
43
+ * Which connector versions a server takes. Below `minimum` a connector still registers and is listed (so its owner
44
+ * sees why), but no new session is started on it (`409 connector_outdated`); below `recommended` it works and its
45
+ * owner is told to upgrade. A server may move both with `CLAW_REMOTE_AGENTS_MIN_CONNECTOR_VERSION` and
46
+ * `CLAW_REMOTE_AGENTS_RECOMMENDED_CONNECTOR_VERSION`. 0.1.3 is the first release with `service install`; 0.1.4 names
47
+ * the prompt every `turn_end` ends, without which an assistant item stays in progress after its last instruction.
48
+ */
49
+ export declare const CONNECTOR_VERSIONS: {
50
+ readonly minimum: "0.1.3";
51
+ readonly recommended: "0.1.4";
52
+ };
53
+ /** `current`: at least the recommended version; `outdated`: works, upgrade; `unsupported`: below the minimum; `unknown`: no readable version. */
54
+ export type ConnectorVersionStatus = "current" | "outdated" | "unsupported" | "unknown";
55
+ /**
56
+ * Compares two `x.y.z` versions as semver orders them (a prerelease sorts before its release; build metadata is ignored). Null when
57
+ * either is not a version.
58
+ */
59
+ export declare function compareConnectorVersions(a: string, b: string): number | null;
60
+ /** Where `version` stands against `policy`. A connector that reports no version, or one that is no `x.y.z`, is `unknown`: it is not refused. */
61
+ export declare function connectorVersionStatus(version: string | null | undefined, policy?: {
62
+ minimum: string;
63
+ recommended: string;
64
+ }): ConnectorVersionStatus;
65
+ /** Event types the server itself acts on; every other type is stored and relayed as is. */
66
+ export declare const REMOTE_EVENT_PERMISSION_REQUEST = "permissionRequest";
67
+ export declare const REMOTE_EVENT_PERMISSION_RESOLVED = "permission_resolved";
68
+ export declare const REMOTE_EVENT_SESSION_CLOSED = "session_closed";
69
+ /**
70
+ * What the person sent a session (a `prompt` command), written by Claw itself when it queues the prompt: `{text, cmd_id, cmd_seq,
71
+ * client, by: "claw"}` with a negative `seq`. An agent's events carry only its own side, so without it a window opened on the
72
+ * session elsewhere (another device, the web page beside a Teams chat) shows answers to questions it cannot see. A connector may
73
+ * not post it: a frame of this type is always Claw's account of what was sent.
74
+ */
75
+ export declare const REMOTE_EVENT_USER_PROMPT = "user_prompt";
76
+ export type Parsed<T> = {
77
+ ok: true;
78
+ value: T;
79
+ } | {
80
+ ok: false;
81
+ error: string;
82
+ };
83
+ /** A UUID in canonical lower case, or null. */
84
+ export declare function parseRemoteId(v: unknown): string | null;
85
+ export interface RemoteAgentDescriptor {
86
+ agent_id: string;
87
+ /** Opaque to the server; a client picks an icon from it. */
88
+ kind: string;
89
+ name: string;
90
+ /**
91
+ * Whatever the connector reports, stored and relayed unchanged (at most `maxCapabilitiesBytes`). The connector in
92
+ * this repository reports `unattended` and `unattended_allowed` (docs/remote-agents.md, "Whether a session asks
93
+ * before it acts"); the server does not read them.
94
+ */
95
+ capabilities: Record<string, unknown>;
96
+ }
97
+ export interface RemoteHeartbeat {
98
+ version: string | null;
99
+ agents: RemoteAgentDescriptor[];
100
+ /** Highest `cmd_seq` the connector has fully handled; the server may forget up to it. */
101
+ cmdCursor: number | null;
102
+ }
103
+ export declare function parseConnectorRegistration(body: unknown): Parsed<{
104
+ name: string;
105
+ version: string | null;
106
+ }>;
107
+ export declare function parseHeartbeat(body: unknown): Parsed<RemoteHeartbeat>;
108
+ export interface RemoteEventIn {
109
+ session_id: string;
110
+ seq: number;
111
+ type: string;
112
+ /** Milliseconds since the epoch, as the connector's clock saw it. */
113
+ ts: number;
114
+ data: Record<string, unknown>;
115
+ }
116
+ /** An accepted event, with its position in the posted array so a later refusal can name it. */
117
+ export interface ParsedRemoteEvent extends RemoteEventIn {
118
+ index: number;
119
+ }
120
+ export interface RemoteEventRejection {
121
+ /** Position in the posted array. */
122
+ index: number;
123
+ session_id: string | null;
124
+ seq: number | null;
125
+ reason: string;
126
+ }
127
+ export interface RemoteEventBatch {
128
+ batchId: string;
129
+ /** Events that passed the field rules, in posted order. */
130
+ events: ParsedRemoteEvent[];
131
+ /** Events that did not. They are never stored, and retrying them cannot help. */
132
+ rejected: RemoteEventRejection[];
133
+ }
134
+ /**
135
+ * A malformed envelope refuses the whole batch; a malformed event refuses only
136
+ * itself. A client that kept resending one bad event would otherwise block every
137
+ * good one behind it, forever.
138
+ */
139
+ export declare function parseEventBatch(body: unknown): Parsed<RemoteEventBatch>;
140
+ export interface RemoteSessionNew {
141
+ connector_id: string;
142
+ agent_id: string;
143
+ cwd: string;
144
+ mode: string | null;
145
+ /**
146
+ * Names a session of that agent that already exists on the machine, to continue it instead of starting a new
147
+ * one. Claw does not interpret it: the connector reported the value (in an agent's `capabilities`) and is the
148
+ * only one that knows what it means.
149
+ */
150
+ resume_ref: string | null;
151
+ /**
152
+ * With `resume_ref`: the person confirmed that whatever holds that session open on the machine (a terminal) is to be
153
+ * ended so that this session can continue it. Without it a session held open elsewhere is only watched, read-only.
154
+ */
155
+ takeover: boolean;
156
+ }
157
+ export declare function parseSessionNew(body: unknown): Parsed<RemoteSessionNew>;
158
+ /**
159
+ * Hiding conversations of a machine from its owner's lists (`POST /v1/remote-agents/connectors/:cid/hidden`), and the
160
+ * listing that leaves them out (`GET /v1/remote-agents/connectors`, `?hidden=include` to list them too). Nothing on the
161
+ * machine changes: only which of the conversations it reports (`capabilities.resumable`) the owner's lists show.
162
+ */
163
+ export declare const REMOTE_HIDE_LIMITS: {
164
+ /** Conversation refs one request names, at least one. */
165
+ readonly maxRefs: 50;
166
+ /** A ref as the machine reported it: printable ASCII, no space. */
167
+ readonly maxRefChars: 128;
168
+ };
169
+ /** The value of `?hidden=` that lists the hidden conversations too, each marked `hidden: true`. */
170
+ export declare const REMOTE_HIDDEN_INCLUDE = "include";
171
+ /** The body of a hide (or, `hidden: false`, show again). */
172
+ export interface RemoteHiddenRequest {
173
+ refs: string[];
174
+ hidden: boolean;
175
+ }
176
+ /** Why a conversation was not hidden: a process has it open (or a session holds it), or the machine does not report it now. */
177
+ export type RemoteHideRefusalReason = "live" | "unknown_conversation";
178
+ export interface RemoteHideRefusal {
179
+ ref: string;
180
+ reason: RemoteHideRefusalReason;
181
+ }
182
+ /** The answer of a hide or show (`data`): the refs that changed, and the ones refused with why. */
183
+ export interface RemoteHidden {
184
+ changed: string[];
185
+ refused: RemoteHideRefusal[];
186
+ }
187
+ /** One conversation of `capabilities.resumable` as the owner's listing returns it: as the machine reported it, marked when hidden. */
188
+ export type RemoteResumableListed = Record<string, unknown> & {
189
+ hidden?: true;
190
+ };
191
+ /**
192
+ * What the listing makes of an agent's `capabilities` once its owner hid any of its conversations: the conversations left
193
+ * (`?hidden=include`: all of them, the hidden ones marked) and how many are hidden. Absent while nothing of it is hidden.
194
+ */
195
+ export interface RemoteHiddenCapabilities {
196
+ resumable: RemoteResumableListed[];
197
+ hidden_count: number;
198
+ }
199
+ /** A hide request as the route takes it: `hidden` a boolean, then 1 to 50 refs of printable ASCII. */
200
+ export declare function parseHiddenRequest(body: unknown): Parsed<RemoteHiddenRequest>;
201
+ /**
202
+ * The commands a user can issue into an existing session.
203
+ *
204
+ * `session.new` is not here: it creates the session and goes through
205
+ * {@link parseSessionNew}. The set is closed on purpose. A connector is not a
206
+ * remote shell, so a type that is not listed is refused at the server and
207
+ * dropped (and audited) at the connector.
208
+ */
209
+ export declare const REMOTE_COMMAND_TYPES: readonly ["prompt", "cancel", "set_mode", "resume", "close", "decision", "withdraw"];
210
+ export type RemoteCommandType = (typeof REMOTE_COMMAND_TYPES)[number];
211
+ export interface RemoteCommandSpec {
212
+ /**
213
+ * Whether the command is refused while the connector is offline instead of
214
+ * being queued. An instruction nobody could see being waited on must not run
215
+ * half an hour later; an answer, a cancel or a close is safe to deliver late.
216
+ */
217
+ needsOnline: boolean;
218
+ /** Whether it ends the session once it is accepted. */
219
+ closesSession: boolean;
220
+ /** Validated fields as the connector will receive them (without the frame fields). */
221
+ parse(body: Record<string, unknown>): Parsed<Record<string, unknown>>;
222
+ /** What the audit trail keeps. Never the text a user typed. */
223
+ audit(payload: Record<string, unknown>): Record<string, unknown>;
224
+ }
225
+ export declare const REMOTE_COMMANDS: Record<RemoteCommandType, RemoteCommandSpec>;
226
+ export declare function isRemoteCommandType(v: unknown): v is RemoteCommandType;
227
+ /** One server-sent-events frame. `id` is omitted for frames a client must not resume from. */
228
+ export declare function sseFrame(event: string | null, data: unknown, id?: string | number): string;
229
+ /** The SSE resume position: `Last-Event-ID` or `after`, a non-negative integer, or a refusal. */
230
+ export declare function parseCursor(...candidates: unknown[]): Parsed<number>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The one place the personal agent reaches the Claw wire contract. The definitions live in `claw/packages/protocol`
3
+ * and are compiled in, never copied: Claw, the connector and the personal agent share the field names, the event
4
+ * types and the limits by construction, and a field Claw renames or drops fails this workspace's typecheck.
5
+ * `test/protocol-source.test.ts` fails if any other file under `packages/` imports that path or restates a constant.
6
+ *
7
+ * Other modules import from `./protocol.js` (inside core) or from `@primusclaw/personal-agent` (runtime, teams).
8
+ */
9
+ export * from "./protocol/claw-api/index.js";
10
+ export * from "./protocol/remote-agents.js";
@@ -0,0 +1,21 @@
1
+ /** How much of a text is looked at (the patterns stay cheap on a hostile text); a longer text is withheld. */
2
+ export declare const SCAN_MAX = 4000;
3
+ /** True when `text` has the shape of internal detail: an address, a host or service name, a path, a stack trace, an exception class, raw JSON. */
4
+ export declare function looksInternal(text: unknown): boolean;
5
+ /** True when `text` is the error a model call or a service failed with, as Brain writes it (an HTTP status first), or a stack trace. */
6
+ export declare function looksLikeServiceError(text: unknown): boolean;
7
+ /**
8
+ * True when `text` is a service error, or names an address or a stack trace and says something failed: an error, not the
9
+ * model's own words about one.
10
+ */
11
+ export declare function looksLikeFailure(text: unknown): boolean;
12
+ /** A failed turn's last text, split into the model's own words and the error that ended it (for the log only). */
13
+ export interface ErrorTail {
14
+ readonly kept: string;
15
+ readonly tail: string;
16
+ }
17
+ /**
18
+ * From the first paragraph that is Brain's error on, or else the last paragraph when it names an address and says
19
+ * something failed, the text is the error. A paragraph with a code fence is the model's and is never cut.
20
+ */
21
+ export declare function splitErrorTail(text: unknown): ErrorTail;
@@ -0,0 +1,4 @@
1
+ export { SCAN_MAX, looksInternal, looksLikeFailure, looksLikeServiceError, splitErrorTail } from "./classify.js";
2
+ export type { ErrorTail } from "./classify.js";
3
+ export { DETAIL_LOG_MAX, PublicErrorLog, newRef } from "./public-error-log.js";
4
+ export type { PublicErrors, WithheldIds } from "./public-errors.js";
@@ -0,0 +1,20 @@
1
+ /** A test that holds when any of its patterns is found in the text (Python's one pattern with scoped `(?i:...)` parts). */
2
+ export interface AnyOf {
3
+ test(text: string): boolean;
4
+ }
5
+ /** Shapes of internal detail. Any one of them is enough to keep the text back from the chat. */
6
+ export declare const INTERNAL: AnyOf;
7
+ /** The subset of INTERNAL that is an address or a crash, not just words a person writes. */
8
+ export declare const ADDRESS: AnyOf;
9
+ /** Words of a failure: live narration that has internal detail and one of these is held back. */
10
+ export declare const FAILURE_WORDS: RegExp;
11
+ /** The start of the error Brain writes for a model call that failed: optional error classes, then the HTTP status. */
12
+ export declare const SERVICE_ERROR: RegExp;
13
+ /** The part of SERVICE_ERROR that is never the model's own words (a bare "ValueError: ..." may be). */
14
+ export declare const BRAIN_ERROR: RegExp;
15
+ /** Credentials a URL can carry in its user-info part (scheme://user:password@host). */
16
+ export declare const USERINFO: RegExp;
17
+ /** Links to well-known public sites the model cites while it works: no internal endpoint, so no sign of an error. */
18
+ export declare const PUBLIC_LINK: RegExp;
19
+ /** A line that opens or closes a code fence. */
20
+ export declare const FENCE: RegExp;
@@ -0,0 +1,15 @@
1
+ import type { Logger } from "../ports/logger.js";
2
+ import type { Random } from "../ports/random.js";
3
+ import type { PublicErrors, WithheldIds } from "./public-errors.js";
4
+ /** How much of the withheld text the log line keeps (after credential shapes are masked). */
5
+ export declare const DETAIL_LOG_MAX = 500;
6
+ /** A short id that ties what the person was told to the log line with the detail: 8 random hex characters. */
7
+ export declare function newRef(random: Random): string;
8
+ /** The PublicErrors of a worker: withheld text goes to `logger` under a reference from `random`. */
9
+ export declare class PublicErrorLog implements PublicErrors {
10
+ private readonly logger;
11
+ private readonly random;
12
+ constructor(logger: Logger, random: Random);
13
+ withhold(where: string, detail?: unknown, ids?: WithheldIds): string;
14
+ publicReason(reason: unknown, where: string, ids?: WithheldIds): string;
15
+ }
@@ -0,0 +1,20 @@
1
+ /** Identifiers a withheld detail is logged with (a session id, an item id); never text a person or an agent wrote. */
2
+ export type WithheldIds = Readonly<Record<string, string | number | boolean | null | undefined>>;
3
+ /**
4
+ * What a person is told when something failed, and what is kept back for the log. Text the worker did not write (a
5
+ * model gateway's error, a remote agent's reason, Claw's reason for a merge it did not do) can name internal hosts,
6
+ * paths and stack traces; the person gets a short sentence with a reference id instead, and the text goes to the log
7
+ * under that id.
8
+ */
9
+ export interface PublicErrors {
10
+ /**
11
+ * Logs `detail` (credential shapes masked, clipped, one line) under a new reference id and returns that id, for the
12
+ * person's sentence. `where` names the path (a fixed word of the caller's).
13
+ */
14
+ withhold(where: string, detail?: unknown, ids?: WithheldIds): string;
15
+ /**
16
+ * `reason` as it may be shown; when it has the shape of internal detail, "an internal error (ref <id>)" with the
17
+ * reason withheld to the log. "" (or blank) stays "".
18
+ */
19
+ publicReason(reason: unknown, where: string, ids?: WithheldIds): string;
20
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The buttons of the remote-agent cards, as what they do: an operation (`op`) and the fields it carries. The data a button
3
+ * carries is wire format (it comes back with the click): `{primusclaw: "remote", op, ...fields}`, which the worker checks against
4
+ * Claw's own lists, never trusting the card. The channel decides how a button looks.
5
+ */
6
+ /** What the agents card, the sessions card, the status card and their follow-ups do. */
7
+ export type RemoteOp = "new" | "list" | "attach" | "detach" | "close" | "switch" | "row" | "stop" | "mode" | "set_mode" | "pair" | "takeover" | "full" | "send" | "hide" | "hidden" | "unhide";
8
+ /** A button's look: the primary act (`positive`), a primary act that stops or removes (`destructive`), or plain. */
9
+ export type ButtonStyle = "positive" | "destructive" | "default";
10
+ export type ButtonFields = Readonly<Record<string, string | number | boolean>>;
11
+ export interface RemoteButton {
12
+ readonly title: string;
13
+ readonly op: RemoteOp;
14
+ /** null: no style of its own. */
15
+ readonly style: ButtonStyle | null;
16
+ /** In the order they go into the data. */
17
+ readonly fields: ButtonFields;
18
+ }
19
+ export declare function remoteButton(title: string, op: RemoteOp, style?: ButtonStyle | null, fields?: ButtonFields): RemoteButton;
20
+ /** What a button of the agents card, the action row and their follow-ups carries; `op` says which handler. */
21
+ export declare function remoteData(op: RemoteOp, fields?: ButtonFields): Record<string, string | number | boolean>;
22
+ /** A button on a permission card: the option the agent offered, by its own id. */
23
+ export interface DecisionButton {
24
+ readonly title: string;
25
+ readonly sessionId: string;
26
+ readonly actionId: string;
27
+ readonly optionId: string;
28
+ /** The one primary button (allow once). */
29
+ readonly primary: boolean;
30
+ /** On the session card as the window: the answer refreshes the window, not a permission card of its own. */
31
+ readonly inWindow?: boolean;
32
+ }
33
+ /** What a decision button carries (wire format: the worker reads it back). */
34
+ export declare function decisionData(button: DecisionButton): Record<string, string | boolean>;
35
+ /** What a button of the disconnect card carries (wire format). */
36
+ export declare function disconnectData(connectorId: string, confirm: boolean): Record<string, string | boolean>;
@@ -0,0 +1,37 @@
1
+ import type { Agent, Connector } from "./model.js";
2
+ /** The icons of the agent kinds, and of an agent of no known kind. */
3
+ export declare const KIND_ICONS: readonly string[];
4
+ export interface KindLabel {
5
+ readonly icon: string;
6
+ readonly label: string;
7
+ }
8
+ /** The icon and label of a connector's agent `kind`. */
9
+ export declare function kindLabel(kind: unknown): KindLabel;
10
+ /** What a user types to name an agent: `machine/id`, shown inside a code span, each part inert and no backtick in it. */
11
+ export declare function agentRef(connector: Pick<Connector, "name">, agent: Pick<Agent, "agentId">): string;
12
+ /** The folders an agent says it may work in (`capabilities.roots`): strings only, one line each, each once, at most ROOTS_MAX. */
13
+ export declare function agentRoots(agent: Agent): string[];
14
+ /** The connector can take back a message that waits for its terminal without stopping anything (`withdraw`). */
15
+ export declare function withdraws(agent: Agent | null | undefined): boolean;
16
+ /** The connector can open a conversation that is open in a terminal read-only (`watch_live`). */
17
+ export declare function watchesLive(agent: Agent): boolean;
18
+ /** The connector types messages into the terminal that has this conversation open (a tmux pane of its user's). */
19
+ export declare function typesInto(agent: Agent, entry: {
20
+ readonly input?: string;
21
+ }): boolean;
22
+ /** The connector can type into a terminal at all (`terminal_input`), whether or not this conversation's is one it can reach. */
23
+ export declare function canTypeIntoTerminals(agent: Agent): boolean;
24
+ /** A new session of this agent starts in a mode that does not ask before a write or a command (`capabilities.unattended`). */
25
+ export declare function startsUnattended(agent: Agent): boolean;
26
+ /** A client may switch this agent to a mode that does not ask (`capabilities.unattended_allowed`). */
27
+ export declare function unattendedAllowed(agent: Agent): boolean;
28
+ export type Approval = "ask" | "unattended";
29
+ /** What a new session of `agent` may be asked to run as, when its connector lets a client switch to a mode that does not ask;
30
+ * the default is how its owner configured it to start. null when there is nothing to choose. */
31
+ export declare function approvalChoice(agent: Agent): {
32
+ readonly default: Approval;
33
+ } | null;
34
+ /** The connector can take over a conversation a terminal has open, once the person confirms (`capabilities.takeover`). */
35
+ export declare function canTakeOver(agent: Agent): boolean;
36
+ /** The name of the agent: its own (made inert), or its kind's label. */
37
+ export declare function agentName(agent: Agent, limit: number): string;
@@ -0,0 +1,9 @@
1
+ import type { Lang } from "../locales/lang.js";
2
+ /** `text` cut into pieces of at most `limit` characters, at a paragraph break (else a line break) past half the limit. */
3
+ export declare function splitAtParagraphs(text: string, limit: number): string[];
4
+ /** The messages that carry a remote agent's final text: split at paragraph boundaries, at most ANSWER_MESSAGES_MAX, and what is
5
+ * beyond that cut with a line saying so (the rest is in the session on the machine). Credentials are masked. */
6
+ export declare function answerParts(text: string, lang?: Lang): string[];
7
+ /** The messages for what a remote agent said on its own, between turns: the answer's parts, the first headed with who said it,
8
+ * so it is not read as the reply to the user's last message. `typed`: it answers what was typed at the terminal the chat shares. */
9
+ export declare function unsolicitedParts(label: string, text: string, lang?: Lang, typed?: boolean): string[];
@@ -0,0 +1,108 @@
1
+ import type { RemoteState } from "../ports/store/remote.js";
2
+ import { type Conversation, type MessageId, type OutMessage } from "../ports/surface.js";
3
+ import type { StatusPhase } from "./lines.js";
4
+ import type { RemoteContext } from "./context.js";
5
+ import type { ChatState } from "./state.js";
6
+ import { Signer } from "./turns/signer.js";
7
+ /** A status card, and whether it carries the window's text box. */
8
+ export interface Shown {
9
+ readonly message: OutMessage;
10
+ readonly takesInput: boolean;
11
+ }
12
+ /** How a refresh of the window goes. */
13
+ export interface Refresh {
14
+ /** A turn's end is shown. */
15
+ readonly ended?: boolean;
16
+ /** An edit while a turn streams into the card. */
17
+ readonly streaming?: boolean;
18
+ readonly lead?: string;
19
+ /** It answers the person's own act (only then is a card with the text box edited or removed). */
20
+ readonly byPerson?: boolean;
21
+ /** Post it again at the bottom whatever changed. */
22
+ readonly repost?: boolean;
23
+ /** A scheduled edit's: aborted, it does nothing, even when it was already waiting for its turn (Python's task cancel). */
24
+ readonly signal?: AbortSignal;
25
+ }
26
+ export declare class StatusBoard {
27
+ private readonly ctx;
28
+ private readonly state;
29
+ private readonly locks;
30
+ private readonly edits;
31
+ private readonly background;
32
+ constructor(ctx: RemoteContext, state: ChatState);
33
+ /** The chat's status card in `phase` (the session card when it is the window). */
34
+ statusOf(chatKey: string, state: RemoteState, phase: StatusPhase, lead?: string, unattended?: boolean): Shown;
35
+ /**
36
+ * Show the window as it is now: edited in place, or posted again at the bottom (the old one deleted, or closed down to a line
37
+ * where it cannot be) when the change is worth a new message. One at a time per chat. True when a new card was posted.
38
+ */
39
+ refreshWindow(chatKey: string, to: Conversation, how?: Refresh): Promise<boolean>;
40
+ /** The window edited in place when that is enough, else posted again; true when a new card was posted. */
41
+ private editOrRepost;
42
+ /**
43
+ * Post the window as a new card at the bottom; the one it replaces is deleted, or, with `keep`, left as it is (it has the text
44
+ * box: `dropKept` removes it at the person's next act). False when no new card came.
45
+ */
46
+ private repostWindow;
47
+ /** Delete a card of this chat's, or (the channel cannot) close it down to the line that says where the new one is. */
48
+ removeOrRetire(chatKey: string, to: Conversation, cardId: MessageId): Promise<void>;
49
+ /** The person has acted: the older cards with a text box that were kept for them go now. */
50
+ dropKept(chatKey: string, to: Conversation): Promise<void>;
51
+ /** An edit of the window EDIT_SECONDS from now, unless one is waiting already (it shows what is newest when it runs). */
52
+ scheduleWindow(chatKey: string, to: Conversation): void;
53
+ cancelWindowEdit(chatKey: string): void;
54
+ private track;
55
+ /** Wait for what runs in the background (tests, shutdown). */
56
+ settled(): Promise<void>;
57
+ /**
58
+ * What the agent says between turns, into the window: `final`, a burst that is over (shown by `windowSettled`, once the reader
59
+ * has let go of it); else the text so far, shown by a throttled edit. False when the chat shows no window.
60
+ */
61
+ windowSaid(chatKey: string, text: string, final: boolean): boolean;
62
+ /** What the agent said between turns has been taken in by the reader: the window shows it, and the state as it is now. */
63
+ windowSettled(chatKey: string): Promise<void>;
64
+ /**
65
+ * Send the status card as a new message and remember it; the card it replaces is closed down to a line saying where the new one
66
+ * is (it is history now, and its buttons would act on a card that is not the chat's any more).
67
+ */
68
+ postStatus(chatKey: string, to: Conversation, card: Shown): Promise<void>;
69
+ /** A status card was just posted or put in place: when it is the session card, what it shows counts as posted. */
70
+ noteWindowShown(chatKey: string, card: Shown): void;
71
+ retireStatus(to: Conversation, cardId: MessageId, chatKey: string): Promise<void>;
72
+ /**
73
+ * Edit the chat's status card in place: true when there is one and the edit was handed over. Never for a chat that is the
74
+ * agent's window itself: it has no status card, and one it had before is left as it is.
75
+ */
76
+ editStatus(chatKey: string, to: Conversation, card: Shown): Promise<boolean>;
77
+ /**
78
+ * The session has started (ready, or found open in a terminal): the status card says so, in place. A session card that is the
79
+ * window is posted again at the bottom instead (the card that said "starting" had no text box). True when the card shows it.
80
+ */
81
+ settleStatus(chatKey: string, to: Conversation, state: RemoteState, phase: StatusPhase, lead?: string): Promise<boolean>;
82
+ /**
83
+ * The status card says what the session is doing now (a turn began or ended): edited in the background, never a new message
84
+ * (the window may be posted again when that is due). `state`: the session the card is about when the chat has just left it.
85
+ */
86
+ touchStatus(chatKey: string, to: Conversation, phase?: StatusPhase, state?: RemoteState, byPerson?: boolean): void;
87
+ /**
88
+ * What a chat that has just attached (or switched) by a typed command is shown: entering from the assistant, ONE new status
89
+ * card; switching from another session, the status card edited in place and one short line saying which session it is in now.
90
+ */
91
+ showEntered(chatKey: string, to: Conversation, was: RemoteState | null, phase: StatusPhase, lead?: string, unattended?: boolean): Promise<void>;
92
+ /**
93
+ * A chat that is the agent's window itself has just attached or switched: one line says where its messages go now (with a
94
+ * warning when the session does not ask before it acts), and the way back is the suggested reply under it. The status card it
95
+ * may still have from before is forgotten, so nothing edits it any more.
96
+ */
97
+ sayEntered(chatKey: string, to: Conversation, state: RemoteState, unattended?: boolean, lead?: string): Promise<void>;
98
+ /**
99
+ * The suggested replies under what the assistant says to a chat that is the agent's window itself: back to the assistant while
100
+ * attached, else back to the agent it last talked to.
101
+ */
102
+ backReplies(chatKey: string): {
103
+ title: string;
104
+ value: string;
105
+ }[];
106
+ /** How a chat that is the agent's window signs what it wrote: its head, and the way on and back under the last message. */
107
+ signerOf(chatKey: string, state: RemoteState): Signer;
108
+ }
@@ -0,0 +1,4 @@
1
+ /** A view as a message to post. */
2
+ import type { OutMessage, View } from "../ports/surface.js";
3
+ /** A view as a message; `fallback` is what a client that cannot show it shows. */
4
+ export declare function viewMessage(view: View, fallback: string): OutMessage;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A group chat's binding to a session is its own chat state, kept apart from the person's 1:1 chat: every per-chat record of
3
+ * remote agents (the attached session, its status card, the reader that follows it) is keyed by a "chat key", the binder's user
4
+ * id and the group conversation. Only the binder's own messages in that group read it, so another member's words never reach
5
+ * the session. A 1:1 chat's key is the person's id itself. The stored keys keep this exact shape (`remote_state.aad_id`).
6
+ */
7
+ /** Joins the binder and the group conversation (a user id is a GUID: it never holds one). */
8
+ export declare const GROUP_KEY_SEP = "#";
9
+ /** The chat key of `userId`'s binding in the group conversation `conversationId`. */
10
+ export declare function groupChatKey(userId: string, conversationId: string): string;
11
+ /** The person a chat key belongs to: the key itself for a 1:1 chat, the binder for a group's. */
12
+ export declare function personOf(chatKey: string): string;
13
+ export declare function isGroupKey(chatKey: string): boolean;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * What this process knows of each chat attached to a remote session, beside what the store keeps: what reads the session now (a
3
+ * turn, a short watch, the follower), what its connector reported when the chat attached, whether the session only watches a
4
+ * conversation open in a terminal, and the one-time tokens of the cards it showed. Keyed by the chat key (`chat-key.ts`). All of it
5
+ * is lost when the process restarts, as it was in the Python worker; what must survive is in the store.
6
+ */
7
+ import type { Follower } from "./follow/follower.js";
8
+ import type { Task } from "./tasks.js";
9
+ /** Folders typed in a `/agent new MACHINE PATH` kept for the buttons of the card that asks which agent, per chat. */
10
+ export declare const TYPED_PATHS_KEPT = 20;
11
+ export declare const TYPED_PATH_SECONDS = 3600;
12
+ /** How long a takeover's confirmation card can be answered. */
13
+ export declare const TAKEOVER_CONFIRM_SECONDS = 600;
14
+ /** A turn this process is reading: its task, and whether the person asked to stop it. */
15
+ export interface RemoteTurn {
16
+ task: Task | null;
17
+ stopRequested: boolean;
18
+ /** Its message waits for the machine's terminal and has not been typed there yet. */
19
+ waitsForTerminal: boolean;
20
+ /** Nothing runs it any more (or nothing ever did): a Stop card's press for it stops nothing. */
21
+ readonly ended: boolean;
22
+ }
23
+ /** A turn about to be watched (its task is set right after). */
24
+ export declare function newTurn(): RemoteTurn;
25
+ /** The confirmation card for taking over a conversation a terminal has open: only its own Take over carries the ticket. */
26
+ export interface TakeoverTicket {
27
+ readonly connectorId: string;
28
+ readonly agentId: string;
29
+ readonly ref: string;
30
+ readonly ticket: string;
31
+ /** Wall-clock seconds. */
32
+ readonly until: number;
33
+ }
34
+ export declare class ChatRegistry {
35
+ /** The reader of the attached session while no turn reads it. */
36
+ readonly followers: Map<string, Follower>;
37
+ /** Chats `forget` was called for: nothing follows them until they attach again. */
38
+ readonly unlinked: Set<string>;
39
+ readonly turns: Map<string, RemoteTurn>;
40
+ /** A short watch (`/agent new` waiting for the agent, `/agent mode` for its answer). */
41
+ readonly watchers: Map<string, Task>;
42
+ /** Whether the agent of the attached session starts in a mode that does not ask (its connector's report). */
43
+ readonly agentUnattended: Map<string, boolean>;
44
+ /** Whether the agent of the attached session can take over a conversation a terminal has open. */
45
+ readonly agentTakeover: Map<string, boolean>;
46
+ private readonly typed;
47
+ private readonly readOnly;
48
+ private readonly readOnlyKnown;
49
+ private readonly terminalInput;
50
+ private readonly tickets;
51
+ watching(chatKey: string): boolean;
52
+ /** The chat's session only watches a conversation open in a terminal (read-only). */
53
+ watches(chatKey: string, sessionId: string | null): boolean;
54
+ /** Whether this process has learned (from an event, or by reading back) whether the session only watches. */
55
+ knowsWatch(chatKey: string, sessionId: string): boolean;
56
+ learnedWatch(chatKey: string, sessionId: string): void;
57
+ markReadOnly(chatKey: string, sessionId: string, readOnly: boolean): void;
58
+ /** A new session says itself whether it only watches. */
59
+ clearReadOnly(chatKey: string): void;
60
+ markTerminal(chatKey: string, sessionId: string, terminal: boolean): void;
61
+ /** What is sent to the chat's session is typed into a terminal on the machine. */
62
+ typesIntoTerminal(chatKey: string, sessionId: string | null): boolean;
63
+ /**
64
+ * Keep a folder typed for the buttons of the card that asks which agent (a token names it: the card can say where a session goes,
65
+ * a tap cannot choose it). A few per chat, for an hour. `now`: wall-clock seconds.
66
+ */
67
+ rememberPath(chatKey: string, path: string, token: string, now: number): string;
68
+ typedPath(chatKey: string, token: string, now: number): string | null;
69
+ /** Remember the takeover card shown last to this chat (the previous one is replaced: only the last can start a takeover). */
70
+ issueTicket(chatKey: string, ticket: TakeoverTicket): void;
71
+ ticketOf(chatKey: string): TakeoverTicket | undefined;
72
+ /** The ticket is used: a takeover starts from that card once. */
73
+ spendTicket(chatKey: string): void;
74
+ /** Everything known of a chat whose person unlinked (its session's reader is stopped by the caller). */
75
+ forget(chatKey: string): void;
76
+ }
@@ -0,0 +1,24 @@
1
+ import type { Click, SessionClicks } from "./clicks.js";
2
+ import type { CommandParts } from "./commands.js";
3
+ export declare class MachineClicks {
4
+ private readonly p;
5
+ private readonly c;
6
+ constructor(p: CommandParts, c: SessionClicks);
7
+ /** The person's connector the tapped button names, as Claw lists it now; null (said) when it is not theirs any more. */
8
+ private ownConnector;
9
+ /** Hide one conversation (`ref`), or every one no process runs of one agent (`all: idle`), from the list. */
10
+ hide(click: Click): Promise<void>;
11
+ /** The conversations hidden on that machine, each with Unhide. */
12
+ hidden(click: Click): Promise<void>;
13
+ /** Show one hidden conversation (`ref`) again, or all of that machine's (`all`). */
14
+ unhide(click: Click): Promise<void>;
15
+ /**
16
+ * A tap on the disconnect card. The card names a connector id; whose it is is Claw's to say (404 for anyone else's), and the
17
+ * machine's name is read again from the person's own list.
18
+ */
19
+ off(click: Click): Promise<void>;
20
+ /** The tap ends with `text` in place of the card. */
21
+ private settled;
22
+ /** It did not go through: said; where pressing again can help, the card comes back with its buttons. */
23
+ private offRefused;
24
+ }