@primusclaw/personal-agent 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (444) hide show
  1. package/dist/LICENSE +37 -0
  2. package/dist/index.js +31875 -0
  3. package/dist/types/approvals/approval-view.d.ts +70 -0
  4. package/dist/types/approvals/click.d.ts +8 -0
  5. package/dist/types/approvals/decide.d.ts +64 -0
  6. package/dist/types/approvals/handler.d.ts +22 -0
  7. package/dist/types/approvals/index.d.ts +9 -0
  8. package/dist/types/approvals/questions.d.ts +36 -0
  9. package/dist/types/approvals/records.d.ts +43 -0
  10. package/dist/types/approvals/sensitive.d.ts +13 -0
  11. package/dist/types/approvals/turn-cards.d.ts +7 -0
  12. package/dist/types/approvals/views.d.ts +67 -0
  13. package/dist/types/assistant/action-handler.d.ts +13 -0
  14. package/dist/types/assistant/actions.d.ts +63 -0
  15. package/dist/types/assistant/auto-reply.d.ts +14 -0
  16. package/dist/types/assistant/board.d.ts +68 -0
  17. package/dist/types/assistant/chat.d.ts +166 -0
  18. package/dist/types/assistant/citation-sources.d.ts +20 -0
  19. package/dist/types/assistant/citations.d.ts +38 -0
  20. package/dist/types/assistant/confirm-outcome.d.ts +11 -0
  21. package/dist/types/assistant/devenv-hide-outcome.d.ts +4 -0
  22. package/dist/types/assistant/events.d.ts +53 -0
  23. package/dist/types/assistant/failures.d.ts +16 -0
  24. package/dist/types/assistant/files.d.ts +37 -0
  25. package/dist/types/assistant/finish.d.ts +8 -0
  26. package/dist/types/assistant/follow.d.ts +75 -0
  27. package/dist/types/assistant/index.d.ts +12 -0
  28. package/dist/types/assistant/informative.d.ts +9 -0
  29. package/dist/types/assistant/item-of.d.ts +2 -0
  30. package/dist/types/assistant/receipt.d.ts +113 -0
  31. package/dist/types/assistant/receipts.d.ts +71 -0
  32. package/dist/types/assistant/say.d.ts +63 -0
  33. package/dist/types/assistant/tracked-stream.d.ts +30 -0
  34. package/dist/types/assistant/turn-in-front.d.ts +25 -0
  35. package/dist/types/assistant/views.d.ts +80 -0
  36. package/dist/types/assistant/watch-clicks.d.ts +34 -0
  37. package/dist/types/assistant/work-clicks.d.ts +53 -0
  38. package/dist/types/assistant/work-handler.d.ts +23 -0
  39. package/dist/types/assistant/work-items.d.ts +66 -0
  40. package/dist/types/branding.d.ts +5 -0
  41. package/dist/types/brief/brief.d.ts +40 -0
  42. package/dist/types/brief/index.d.ts +3 -0
  43. package/dist/types/brief/template.d.ts +8 -0
  44. package/dist/types/capabilities/capability.d.ts +49 -0
  45. package/dist/types/capabilities/command-text.d.ts +11 -0
  46. package/dist/types/capabilities/entries-chat.d.ts +3 -0
  47. package/dist/types/capabilities/entries-notify.d.ts +3 -0
  48. package/dist/types/capabilities/entries-settings.d.ts +3 -0
  49. package/dist/types/capabilities/help.d.ts +24 -0
  50. package/dist/types/capabilities/natural.d.ts +19 -0
  51. package/dist/types/capabilities/phrases.d.ts +42 -0
  52. package/dist/types/capabilities/registry.d.ts +12 -0
  53. package/dist/types/capabilities/sessions-words.d.ts +9 -0
  54. package/dist/types/capabilities/spoken.d.ts +19 -0
  55. package/dist/types/capabilities/visibility.d.ts +32 -0
  56. package/dist/types/claw/credential.d.ts +8 -0
  57. package/dist/types/claw/errors.d.ts +61 -0
  58. package/dist/types/claw/lenient.d.ts +23 -0
  59. package/dist/types/claw/message-text.d.ts +28 -0
  60. package/dist/types/claw/model.d.ts +118 -0
  61. package/dist/types/claw/py-value.d.ts +7 -0
  62. package/dist/types/claw/remote.d.ts +138 -0
  63. package/dist/types/claw/requester-view.d.ts +15 -0
  64. package/dist/types/claw/service-refusal.d.ts +4 -0
  65. package/dist/types/claw/sse.d.ts +12 -0
  66. package/dist/types/claw/started-review.d.ts +7 -0
  67. package/dist/types/claw/work-item.d.ts +25 -0
  68. package/dist/types/commands/agent-args.d.ts +9 -0
  69. package/dist/types/commands/names.d.ts +19 -0
  70. package/dist/types/commands/parse.d.ts +33 -0
  71. package/dist/types/commands/repo.d.ts +17 -0
  72. package/dist/types/config/settings.d.ts +124 -0
  73. package/dist/types/direct-chat/direct-chat.d.ts +73 -0
  74. package/dist/types/direct-chat/index.d.ts +2 -0
  75. package/dist/types/errors.d.ts +15 -0
  76. package/dist/types/feedback/deadline.d.ts +10 -0
  77. package/dist/types/feedback/delivery.d.ts +34 -0
  78. package/dist/types/feedback/exchange.d.ts +19 -0
  79. package/dist/types/feedback/flow.d.ts +36 -0
  80. package/dist/types/feedback/handlers.d.ts +16 -0
  81. package/dist/types/feedback/history.d.ts +20 -0
  82. package/dist/types/feedback/identifiers.d.ts +16 -0
  83. package/dist/types/feedback/index.d.ts +16 -0
  84. package/dist/types/feedback/iso-time.d.ts +2 -0
  85. package/dist/types/feedback/issue-text.d.ts +50 -0
  86. package/dist/types/feedback/log-text.d.ts +13 -0
  87. package/dist/types/feedback/markdown.d.ts +4 -0
  88. package/dist/types/feedback/reporting.d.ts +25 -0
  89. package/dist/types/feedback/scene.d.ts +65 -0
  90. package/dist/types/feedback/service.d.ts +74 -0
  91. package/dist/types/feedback/thumbs.d.ts +59 -0
  92. package/dist/types/feedback/views.d.ts +35 -0
  93. package/dist/types/guardrails/correlation.d.ts +8 -0
  94. package/dist/types/guardrails/guardrails.d.ts +49 -0
  95. package/dist/types/guardrails/index.d.ts +4 -0
  96. package/dist/types/guardrails/operations.d.ts +22 -0
  97. package/dist/types/guardrails/sha256.d.ts +1 -0
  98. package/dist/types/inbound-text/index.d.ts +9 -0
  99. package/dist/types/inbound-text/marked-text.d.ts +20 -0
  100. package/dist/types/inbound-text/quote-block.d.ts +26 -0
  101. package/dist/types/inbound-text/redact.d.ts +8 -0
  102. package/dist/types/inbound-text/when.d.ts +2 -0
  103. package/dist/types/inbound-text/with-links.d.ts +20 -0
  104. package/dist/types/index.d.ts +73 -0
  105. package/dist/types/json.d.ts +5 -0
  106. package/dist/types/language/detect.d.ts +21 -0
  107. package/dist/types/limits/inbound-stats.d.ts +42 -0
  108. package/dist/types/limits/index.d.ts +5 -0
  109. package/dist/types/limits/rate-limiter.d.ts +32 -0
  110. package/dist/types/limits/user-limits.d.ts +18 -0
  111. package/dist/types/limits/wait-words.d.ts +3 -0
  112. package/dist/types/locales/account.d.ts +49 -0
  113. package/dist/types/locales/approval-decisions.d.ts +28 -0
  114. package/dist/types/locales/approval.d.ts +31 -0
  115. package/dist/types/locales/assistant-actions.d.ts +65 -0
  116. package/dist/types/locales/assistant-board.d.ts +14 -0
  117. package/dist/types/locales/assistant-cards.d.ts +81 -0
  118. package/dist/types/locales/assistant-chat.d.ts +13 -0
  119. package/dist/types/locales/assistant-devenv-hide.d.ts +23 -0
  120. package/dist/types/locales/assistant-work-clicks.d.ts +98 -0
  121. package/dist/types/locales/assistant.d.ts +5 -0
  122. package/dist/types/locales/brief.d.ts +29 -0
  123. package/dist/types/locales/catalog.d.ts +24 -0
  124. package/dist/types/locales/claw.d.ts +5 -0
  125. package/dist/types/locales/commands.d.ts +12 -0
  126. package/dist/types/locales/connector-reasons.d.ts +95 -0
  127. package/dist/types/locales/connector-setup.d.ts +20 -0
  128. package/dist/types/locales/feedback.d.ts +75 -0
  129. package/dist/types/locales/group.d.ts +33 -0
  130. package/dist/types/locales/guardrails.d.ts +22 -0
  131. package/dist/types/locales/help-lead.d.ts +15 -0
  132. package/dist/types/locales/index.d.ts +16 -0
  133. package/dist/types/locales/lang.d.ts +9 -0
  134. package/dist/types/locales/limits.d.ts +19 -0
  135. package/dist/types/locales/link.d.ts +40 -0
  136. package/dist/types/locales/observe.d.ts +113 -0
  137. package/dist/types/locales/proactive-lines.d.ts +12 -0
  138. package/dist/types/locales/proactive.d.ts +62 -0
  139. package/dist/types/locales/remote-agents.d.ts +216 -0
  140. package/dist/types/locales/remote-leads.d.ts +13 -0
  141. package/dist/types/locales/remote-window-card.d.ts +46 -0
  142. package/dist/types/locales/remote-window.d.ts +21 -0
  143. package/dist/types/locales/remote.d.ts +365 -0
  144. package/dist/types/locales/review-account.d.ts +43 -0
  145. package/dist/types/locales/review-github.d.ts +19 -0
  146. package/dist/types/locales/review-receipt.d.ts +45 -0
  147. package/dist/types/locales/review-request.d.ts +21 -0
  148. package/dist/types/locales/review-start.d.ts +46 -0
  149. package/dist/types/locales/routing.d.ts +21 -0
  150. package/dist/types/locales/sessions.d.ts +38 -0
  151. package/dist/types/locales/settings.d.ts +46 -0
  152. package/dist/types/locales/steps.d.ts +42 -0
  153. package/dist/types/locales/transparency.d.ts +18 -0
  154. package/dist/types/locales/turn.d.ts +70 -0
  155. package/dist/types/locales/typed-answer.d.ts +32 -0
  156. package/dist/types/note/note.d.ts +22 -0
  157. package/dist/types/observability/ip-address.d.ts +13 -0
  158. package/dist/types/observability/metrics-catalog.d.ts +17 -0
  159. package/dist/types/observability/security-events.d.ts +26 -0
  160. package/dist/types/observability/security-fields.d.ts +8 -0
  161. package/dist/types/observability/security-log.d.ts +21 -0
  162. package/dist/types/observe/board.d.ts +18 -0
  163. package/dist/types/observe/command.d.ts +6 -0
  164. package/dist/types/observe/index.d.ts +6 -0
  165. package/dist/types/observe/observer.d.ts +45 -0
  166. package/dist/types/observe/suggestions.d.ts +16 -0
  167. package/dist/types/observe/views.d.ts +19 -0
  168. package/dist/types/own.d.ts +9 -0
  169. package/dist/types/plugins/feedback-sink.d.ts +31 -0
  170. package/dist/types/plugins/identity-lookup.d.ts +21 -0
  171. package/dist/types/plugins/index.d.ts +31 -0
  172. package/dist/types/plugins/integrations.d.ts +34 -0
  173. package/dist/types/plugins/key-revoker.d.ts +10 -0
  174. package/dist/types/plugins/model-refusal-policy.d.ts +25 -0
  175. package/dist/types/plugins/route-extension.d.ts +27 -0
  176. package/dist/types/plugins/token-exchange.d.ts +36 -0
  177. package/dist/types/ports/claw/assistant.d.ts +55 -0
  178. package/dist/types/ports/claw/index.d.ts +28 -0
  179. package/dist/types/ports/claw/remote-agents.d.ts +53 -0
  180. package/dist/types/ports/claw/sessions.d.ts +105 -0
  181. package/dist/types/ports/claw/settings.d.ts +62 -0
  182. package/dist/types/ports/claw/work-items.d.ts +32 -0
  183. package/dist/types/ports/clock.d.ts +17 -0
  184. package/dist/types/ports/crypto.d.ts +15 -0
  185. package/dist/types/ports/github.d.ts +97 -0
  186. package/dist/types/ports/index.d.ts +18 -0
  187. package/dist/types/ports/logger.d.ts +19 -0
  188. package/dist/types/ports/metrics.d.ts +21 -0
  189. package/dist/types/ports/random.d.ts +15 -0
  190. package/dist/types/ports/request-scope.d.ts +31 -0
  191. package/dist/types/ports/routing.d.ts +107 -0
  192. package/dist/types/ports/secret-source.d.ts +21 -0
  193. package/dist/types/ports/store/approvals.d.ts +47 -0
  194. package/dist/types/ports/store/assistant.d.ts +104 -0
  195. package/dist/types/ports/store/feedback.d.ts +80 -0
  196. package/dist/types/ports/store/github.d.ts +81 -0
  197. package/dist/types/ports/store/idempotency.d.ts +21 -0
  198. package/dist/types/ports/store/index.d.ts +65 -0
  199. package/dist/types/ports/store/json.d.ts +4 -0
  200. package/dist/types/ports/store/link.d.ts +39 -0
  201. package/dist/types/ports/store/notify.d.ts +28 -0
  202. package/dist/types/ports/store/observe.d.ts +53 -0
  203. package/dist/types/ports/store/onboarding.d.ts +49 -0
  204. package/dist/types/ports/store/people.d.ts +77 -0
  205. package/dist/types/ports/store/policy.d.ts +60 -0
  206. package/dist/types/ports/store/remote.d.ts +114 -0
  207. package/dist/types/ports/store/sessions.d.ts +59 -0
  208. package/dist/types/ports/store/turns.d.ts +30 -0
  209. package/dist/types/ports/surface.d.ts +394 -0
  210. package/dist/types/ports/turn-cards.d.ts +52 -0
  211. package/dist/types/proactive/deliver.d.ts +52 -0
  212. package/dist/types/proactive/deps.d.ts +77 -0
  213. package/dist/types/proactive/events.d.ts +10 -0
  214. package/dist/types/proactive/index.d.ts +6 -0
  215. package/dist/types/proactive/proactive.d.ts +62 -0
  216. package/dist/types/proactive/quiet.d.ts +27 -0
  217. package/dist/types/proactive/release.d.ts +24 -0
  218. package/dist/types/proactive/said-memory.d.ts +21 -0
  219. package/dist/types/proactive/views.d.ts +67 -0
  220. package/dist/types/protocol/claw-api/assistant-events.d.ts +223 -0
  221. package/dist/types/protocol/claw-api/index.d.ts +5 -0
  222. package/dist/types/protocol/claw-api/notifications.d.ts +85 -0
  223. package/dist/types/protocol/claw-api/reviews.d.ts +63 -0
  224. package/dist/types/protocol/claw-api/session-events.d.ts +34 -0
  225. package/dist/types/protocol/claw-api/work-items.d.ts +75 -0
  226. package/dist/types/protocol/remote-agents.d.ts +230 -0
  227. package/dist/types/protocol.d.ts +10 -0
  228. package/dist/types/public-error/classify.d.ts +21 -0
  229. package/dist/types/public-error/index.d.ts +4 -0
  230. package/dist/types/public-error/patterns.d.ts +20 -0
  231. package/dist/types/public-error/public-error-log.d.ts +15 -0
  232. package/dist/types/public-error/public-errors.d.ts +20 -0
  233. package/dist/types/remote/actions.d.ts +36 -0
  234. package/dist/types/remote/agents.d.ts +37 -0
  235. package/dist/types/remote/answer.d.ts +9 -0
  236. package/dist/types/remote/board.d.ts +108 -0
  237. package/dist/types/remote/cards.d.ts +4 -0
  238. package/dist/types/remote/chat-key.d.ts +13 -0
  239. package/dist/types/remote/chats.d.ts +76 -0
  240. package/dist/types/remote/clicks-machine.d.ts +24 -0
  241. package/dist/types/remote/clicks-start.d.ts +36 -0
  242. package/dist/types/remote/clicks.d.ts +61 -0
  243. package/dist/types/remote/commands.d.ts +60 -0
  244. package/dist/types/remote/connector/reasons.d.ts +31 -0
  245. package/dist/types/remote/connector/setup.d.ts +62 -0
  246. package/dist/types/remote/context.d.ts +101 -0
  247. package/dist/types/remote/conversations.d.ts +37 -0
  248. package/dist/types/remote/ended.d.ts +25 -0
  249. package/dist/types/remote/events.d.ts +65 -0
  250. package/dist/types/remote/fields.d.ts +7 -0
  251. package/dist/types/remote/follow/control.d.ts +39 -0
  252. package/dist/types/remote/follow/follower.d.ts +85 -0
  253. package/dist/types/remote/follow/inbox.d.ts +16 -0
  254. package/dist/types/remote/follow/speaker.d.ts +122 -0
  255. package/dist/types/remote/follow/steps.d.ts +9 -0
  256. package/dist/types/remote/follow/timings.d.ts +29 -0
  257. package/dist/types/remote/health.d.ts +20 -0
  258. package/dist/types/remote/index.d.ts +21 -0
  259. package/dist/types/remote/inert.d.ts +18 -0
  260. package/dist/types/remote/limits.d.ts +48 -0
  261. package/dist/types/remote/lines.d.ts +66 -0
  262. package/dist/types/remote/links/answer.d.ts +7 -0
  263. package/dist/types/remote/links/domains.d.ts +19 -0
  264. package/dist/types/remote/links/hosts.d.ts +2 -0
  265. package/dist/types/remote/links/scans.d.ts +27 -0
  266. package/dist/types/remote/listing.d.ts +38 -0
  267. package/dist/types/remote/lists.d.ts +56 -0
  268. package/dist/types/remote/machines.d.ts +54 -0
  269. package/dist/types/remote/marks.d.ts +5 -0
  270. package/dist/types/remote/model.d.ts +51 -0
  271. package/dist/types/remote/options.d.ts +20 -0
  272. package/dist/types/remote/permissions.d.ts +41 -0
  273. package/dist/types/remote/ports.d.ts +143 -0
  274. package/dist/types/remote/prompt.d.ts +60 -0
  275. package/dist/types/remote/refusals.d.ts +40 -0
  276. package/dist/types/remote/remote-agents.d.ts +84 -0
  277. package/dist/types/remote/reported.d.ts +8 -0
  278. package/dist/types/remote/session-ops.d.ts +57 -0
  279. package/dist/types/remote/sessions.d.ts +80 -0
  280. package/dist/types/remote/setup.d.ts +26 -0
  281. package/dist/types/remote/state.d.ts +55 -0
  282. package/dist/types/remote/tail.d.ts +63 -0
  283. package/dist/types/remote/targets.d.ts +66 -0
  284. package/dist/types/remote/tasks.d.ts +20 -0
  285. package/dist/types/remote/time.d.ts +15 -0
  286. package/dist/types/remote/turn-state.d.ts +29 -0
  287. package/dist/types/remote/turns/chat-turn.d.ts +50 -0
  288. package/dist/types/remote/turns/display.d.ts +18 -0
  289. package/dist/types/remote/turns/outcome.d.ts +41 -0
  290. package/dist/types/remote/turns/runner.d.ts +55 -0
  291. package/dist/types/remote/turns/signer.d.ts +14 -0
  292. package/dist/types/remote/turns/window-turn.d.ts +29 -0
  293. package/dist/types/remote/views.d.ts +13 -0
  294. package/dist/types/remote/watches.d.ts +64 -0
  295. package/dist/types/remote/window/closer.d.ts +14 -0
  296. package/dist/types/remote/window/index.d.ts +2 -0
  297. package/dist/types/remote/window/output.d.ts +28 -0
  298. package/dist/types/remote/window/view.d.ts +73 -0
  299. package/dist/types/remote-view/agents-view.d.ts +88 -0
  300. package/dist/types/remote-view/conversations-view.d.ts +51 -0
  301. package/dist/types/remote-view/hidden-view.d.ts +20 -0
  302. package/dist/types/remote-view/index.d.ts +40 -0
  303. package/dist/types/remote-view/live-view.d.ts +44 -0
  304. package/dist/types/remote-view/machine-views.d.ts +73 -0
  305. package/dist/types/remote-view/messages.d.ts +3 -0
  306. package/dist/types/remote-view/permission-view.d.ts +55 -0
  307. package/dist/types/remote-view/sessions-view.d.ts +70 -0
  308. package/dist/types/remote-view/status-view.d.ts +52 -0
  309. package/dist/types/remote-view/window-view.d.ts +68 -0
  310. package/dist/types/result.d.ts +31 -0
  311. package/dist/types/review/connect/connections.d.ts +24 -0
  312. package/dist/types/review/connect/github-connect.d.ts +50 -0
  313. package/dist/types/review/connect/questions.d.ts +6 -0
  314. package/dist/types/review/connect/review-ask.d.ts +1 -0
  315. package/dist/types/review/consent.d.ts +13 -0
  316. package/dist/types/review/handoff.d.ts +22 -0
  317. package/dist/types/review/held.d.ts +15 -0
  318. package/dist/types/review/index.d.ts +14 -0
  319. package/dist/types/review/intent-check.d.ts +36 -0
  320. package/dist/types/review/outcome.d.ts +36 -0
  321. package/dist/types/review/progress.d.ts +50 -0
  322. package/dist/types/review/prompts.d.ts +2 -0
  323. package/dist/types/review/receipt.d.ts +45 -0
  324. package/dist/types/review/refusals.d.ts +44 -0
  325. package/dist/types/review/request-parse.d.ts +40 -0
  326. package/dist/types/review/review-turn.d.ts +83 -0
  327. package/dist/types/review/service/account.d.ts +52 -0
  328. package/dist/types/review/service/chat.d.ts +18 -0
  329. package/dist/types/review/service/confirm.d.ts +49 -0
  330. package/dist/types/review/service/deps.d.ts +100 -0
  331. package/dist/types/review/service/follow.d.ts +53 -0
  332. package/dist/types/review/service/github-review.d.ts +72 -0
  333. package/dist/types/review/service/handoff-action.d.ts +32 -0
  334. package/dist/types/review/service/identity.d.ts +27 -0
  335. package/dist/types/review/service/item-cards.d.ts +39 -0
  336. package/dist/types/review/service/items.d.ts +57 -0
  337. package/dist/types/review/service/launch.d.ts +37 -0
  338. package/dist/types/review/service/notices.d.ts +42 -0
  339. package/dist/types/review/service/request.d.ts +58 -0
  340. package/dist/types/review/service/reviewer.d.ts +48 -0
  341. package/dist/types/review/service/routed-turn.d.ts +20 -0
  342. package/dist/types/review/service/start.d.ts +65 -0
  343. package/dist/types/review/service/turns.d.ts +38 -0
  344. package/dist/types/review/summary.d.ts +11 -0
  345. package/dist/types/review/views.d.ts +91 -0
  346. package/dist/types/review-text/asks.d.ts +13 -0
  347. package/dist/types/review-text/bare-numbers.d.ts +29 -0
  348. package/dist/types/review-text/index.d.ts +10 -0
  349. package/dist/types/review-text/markers.d.ts +6 -0
  350. package/dist/types/review-text/names.d.ts +60 -0
  351. package/dist/types/review-text/pull-ref.d.ts +25 -0
  352. package/dist/types/review-text/text/scan.d.ts +19 -0
  353. package/dist/types/review-text/text/unicode.d.ts +22 -0
  354. package/dist/types/routing/admission.d.ts +83 -0
  355. package/dist/types/routing/chat.d.ts +52 -0
  356. package/dist/types/routing/command-table.d.ts +32 -0
  357. package/dist/types/routing/commands-account.d.ts +26 -0
  358. package/dist/types/routing/commands-session.d.ts +40 -0
  359. package/dist/types/routing/commands-settings.d.ts +17 -0
  360. package/dist/types/routing/context.d.ts +38 -0
  361. package/dist/types/routing/credentials.d.ts +53 -0
  362. package/dist/types/routing/deps.d.ts +116 -0
  363. package/dist/types/routing/features.d.ts +256 -0
  364. package/dist/types/routing/group-remote.d.ts +26 -0
  365. package/dist/types/routing/group-router.d.ts +42 -0
  366. package/dist/types/routing/identity.d.ts +18 -0
  367. package/dist/types/routing/index.d.ts +26 -0
  368. package/dist/types/routing/link-commands.d.ts +26 -0
  369. package/dist/types/routing/lock.d.ts +5 -0
  370. package/dist/types/routing/onboarding.d.ts +51 -0
  371. package/dist/types/routing/personal-router.d.ts +34 -0
  372. package/dist/types/routing/personal-text.d.ts +62 -0
  373. package/dist/types/routing/router.d.ts +57 -0
  374. package/dist/types/routing/show-here.d.ts +18 -0
  375. package/dist/types/routing/stop-press.d.ts +19 -0
  376. package/dist/types/routing/time.d.ts +31 -0
  377. package/dist/types/routing/turn-registry.d.ts +71 -0
  378. package/dist/types/routing/turn-runner.d.ts +82 -0
  379. package/dist/types/routing/turn-start.d.ts +81 -0
  380. package/dist/types/routing/views.d.ts +104 -0
  381. package/dist/types/security/redact-scan.d.ts +19 -0
  382. package/dist/types/security/redact-text.d.ts +14 -0
  383. package/dist/types/security/redact.d.ts +2 -0
  384. package/dist/types/subscriptions/event-types.d.ts +29 -0
  385. package/dist/types/subscriptions/index.d.ts +3 -0
  386. package/dist/types/subscriptions/ports.d.ts +9 -0
  387. package/dist/types/subscriptions/subscriptions.d.ts +69 -0
  388. package/dist/types/text/neutral.d.ts +1 -0
  389. package/dist/types/text/plain.d.ts +6 -0
  390. package/dist/types/text/py-chars.d.ts +12 -0
  391. package/dist/types/text/py-json.d.ts +23 -0
  392. package/dist/types/text/py-number.d.ts +18 -0
  393. package/dist/types/text/py-regex-escapes.d.ts +32 -0
  394. package/dist/types/text/py-regex.d.ts +36 -0
  395. package/dist/types/text/py-text.d.ts +64 -0
  396. package/dist/types/turn/answer-parts.d.ts +23 -0
  397. package/dist/types/turn/changes.d.ts +42 -0
  398. package/dist/types/turn/clip.d.ts +6 -0
  399. package/dist/types/turn/deliveries.d.ts +31 -0
  400. package/dist/types/turn/engine/claw-errors.d.ts +7 -0
  401. package/dist/types/turn/engine/consume.d.ts +35 -0
  402. package/dist/types/turn/engine/context.d.ts +157 -0
  403. package/dist/types/turn/engine/extras.d.ts +16 -0
  404. package/dist/types/turn/engine/fallback.d.ts +17 -0
  405. package/dist/types/turn/engine/outcome.d.ts +33 -0
  406. package/dist/types/turn/engine/run-turn.d.ts +22 -0
  407. package/dist/types/turn/engine/submit.d.ts +23 -0
  408. package/dist/types/turn/files.d.ts +10 -0
  409. package/dist/types/turn/github-outcome.d.ts +16 -0
  410. package/dist/types/turn/index.d.ts +26 -0
  411. package/dist/types/turn/json.d.ts +10 -0
  412. package/dist/types/turn/last-answer.d.ts +44 -0
  413. package/dist/types/turn/live-view.d.ts +67 -0
  414. package/dist/types/turn/plan.d.ts +31 -0
  415. package/dist/types/turn/ports.d.ts +15 -0
  416. package/dist/types/turn/progress/answer-messages.d.ts +20 -0
  417. package/dist/types/turn/progress/status-message.d.ts +144 -0
  418. package/dist/types/turn/progress/status-policy.d.ts +66 -0
  419. package/dist/types/turn/progress/status-text.d.ts +10 -0
  420. package/dist/types/turn/progress/stream-handle.d.ts +39 -0
  421. package/dist/types/turn/records.d.ts +10 -0
  422. package/dist/types/turn/runner.d.ts +106 -0
  423. package/dist/types/turn/step-labels.d.ts +28 -0
  424. package/dist/types/turn/step.d.ts +26 -0
  425. package/dist/types/turn/stop-buttons.d.ts +62 -0
  426. package/dist/types/turn/task.d.ts +33 -0
  427. package/dist/types/turn/turn-state.d.ts +70 -0
  428. package/dist/types/turn/views.d.ts +23 -0
  429. package/dist/types/typed-answer/index.d.ts +8 -0
  430. package/dist/types/typed-answer/mode.d.ts +38 -0
  431. package/dist/types/typed-answer/patterns.d.ts +25 -0
  432. package/dist/types/typed-answer/prompt.d.ts +5 -0
  433. package/dist/types/typed-answer/read.d.ts +16 -0
  434. package/dist/types/understanding/commands.d.ts +14 -0
  435. package/dist/types/understanding/context.d.ts +49 -0
  436. package/dist/types/understanding/index.d.ts +11 -0
  437. package/dist/types/understanding/limits.d.ts +6 -0
  438. package/dist/types/understanding/people.d.ts +31 -0
  439. package/dist/types/understanding/record.d.ts +10 -0
  440. package/dist/types/understanding/review-stop.d.ts +7 -0
  441. package/dist/types/understanding/sequence-matcher.d.ts +7 -0
  442. package/dist/types/validate.d.ts +15 -0
  443. package/package.json +35 -4
  444. package/README.md +0 -3
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Where a session's events end now, so a chat that attaches (or sends a message) does not replay them: the id of the last event,
3
+ * what the agent said about its modes, whether it is at work (text or tool events after the last turn end: a turn of this chat's,
4
+ * or the agent going on by itself, which the events do not tell apart), the steps that have begun and not ended since then, and the
5
+ * permission requests nobody has answered yet.
6
+ */
7
+ import type { SseEvent } from "../claw/model.js";
8
+ import { type RemoteStep } from "./events.js";
9
+ /** Events read per page of the replay; a shorter page is the last. */
10
+ export declare const TAIL_PAGE = 1000;
11
+ export interface SessionTail {
12
+ /** The id of the last event ('' none). */
13
+ readonly cursor: string;
14
+ readonly mode: string | null;
15
+ readonly modes: readonly string[];
16
+ readonly unattended: boolean | null;
17
+ readonly modeFlags: Readonly<Record<string, boolean>> | null;
18
+ /** The session only watches a conversation open in a terminal. */
19
+ readonly readOnly: boolean;
20
+ /** What is sent is typed into a terminal on the machine. */
21
+ readonly terminal: boolean;
22
+ /** Output after the last turn end. */
23
+ readonly active: boolean;
24
+ /** The steps begun and not ended since the last turn end. */
25
+ readonly steps: readonly string[];
26
+ /** The permission requests nobody has answered, while a turn is open. */
27
+ readonly pending: readonly Readonly<Record<string, unknown>>[];
28
+ /** ... their action ids. */
29
+ readonly asked: readonly string[];
30
+ }
31
+ /** One stored event as the replay lists it. */
32
+ export interface EventRow {
33
+ readonly id: string;
34
+ readonly type: string;
35
+ readonly data: unknown;
36
+ }
37
+ /** The event a replayed row is, as the stream would have sent it (a `data` that is no object says nothing). */
38
+ export declare function rowEvent(row: EventRow): SseEvent;
39
+ /** The rows of a session's events folded into its tail, step by step. */
40
+ export declare class TailFold {
41
+ private cursor;
42
+ private mode;
43
+ private modes;
44
+ private unattended;
45
+ private modeFlags;
46
+ private readOnly;
47
+ private terminal;
48
+ private open;
49
+ private readonly asked;
50
+ private readonly steps;
51
+ /** One row and what it decoded to. A replayed event is not the session's own: it moves nothing, not even the cursor. */
52
+ add(rowId: string, step: RemoteStep): void;
53
+ private noteModes;
54
+ result(): SessionTail;
55
+ }
56
+ /** An object with at least one field (an empty payload says nothing). */
57
+ export declare function filled(payload: Readonly<Record<string, unknown>> | null): payload is Readonly<Record<string, unknown>>;
58
+ /** The `actionId` a permission request (or its resolution) names, as text ('' none). */
59
+ export declare function actionIdOf(payload: Readonly<Record<string, unknown>>): string;
60
+ /** Reads a page of a session's stored events after a cursor (null: from the start). */
61
+ export type ReadEvents = (after: string | null, limit: number) => Promise<readonly EventRow[]>;
62
+ /** The session's tail, read page by page from its start. */
63
+ export declare function readTail(read: ReadEvents, decode: (event: SseEvent) => RemoteStep): Promise<SessionTail>;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * What a typed or tapped name of a session or conversation means: a session by its number in the last listing or a prefix of its
3
+ * id; an agent as people name it, which means its newest active session, else a conversation it offers to take over, else a new
4
+ * session in its first folder; a conversation by its ref. And what a tap on a card names (a folder, a conversation to take over),
5
+ * read against what the agent reports NOW, never against the card.
6
+ */
7
+ import type { Lang } from "../locales/lang.js";
8
+ import { type Conversation } from "./conversations.js";
9
+ import type { ChatRegistry } from "./chats.js";
10
+ import type { Agent, Connector, Session } from "./model.js";
11
+ /** Characters of a session id that name it (fewer is a number from the last listing). */
12
+ export declare const MIN_ID_PREFIX = 6;
13
+ /** A session to start: on which agent, taking over (or watching) which conversation, in which folder. */
14
+ export interface ToStart {
15
+ readonly kind: "start";
16
+ readonly connector: Connector;
17
+ readonly agent: Agent;
18
+ readonly entry: Conversation | null;
19
+ readonly path: string;
20
+ }
21
+ export type Target = {
22
+ readonly kind: "session";
23
+ readonly session: Session;
24
+ } | ToStart | {
25
+ readonly kind: "refusal";
26
+ readonly text: string;
27
+ };
28
+ /** The sessions `ref` names as a session: its number in the last listing, or a prefix of its id of at least 6 characters. */
29
+ export declare function sessionsByRef(listing: readonly string[], sessions: readonly Session[], ref: string): Session[];
30
+ /** What a tap names, read against what this process and the agent's report say now. */
31
+ export declare class Targets {
32
+ private readonly chats;
33
+ constructor(chats: ChatRegistry);
34
+ /**
35
+ * What `/agent attach REF` goes to: a session, or (for an agent) its newest active session, else the newest conversation it
36
+ * offers to take over that no terminal has open, else a new session in its first folder, else the one a terminal has open,
37
+ * watched. `now`: wall-clock seconds.
38
+ */
39
+ target(chatKey: string, listing: readonly string[], connectors: readonly Connector[], sessions: readonly Session[], ref: string, now: number, lang: Lang): Target;
40
+ private forAgent;
41
+ /**
42
+ * A conversation an agent on the person's machines offers to take over, named by its ref (or its first characters): what the
43
+ * assistant puts to the person as that conversation's attach command. Null when no conversation of theirs has that ref.
44
+ */
45
+ private conversationByRef;
46
+ /**
47
+ * The conversation a "Take over" (or "Watch") tap names, or why not: it must be on the agent's list NOW. One open in a terminal
48
+ * is watched, read-only, unless the tap is the Take over of the confirmation card this process showed this chat for it (its
49
+ * ticket, once, in time): then the connector ends the terminal first.
50
+ */
51
+ takeoverOf(chatKey: string, connector: Connector, agent: Agent, data: Readonly<Record<string, unknown>>, now: number, lang: Lang): {
52
+ entry: Conversation | null;
53
+ problem: string;
54
+ };
55
+ /**
56
+ * The folder a "New session" tap asks for, or why there is none: a choice among the roots the agent reports NOW and a subfolder
57
+ * below it, or the whole folder when it reports none; or, from the card that asks which of a machine's agents, the folder this
58
+ * process kept when it was typed (the card carries only a token).
59
+ */
60
+ folderOf(chatKey: string, agent: Agent, data: Readonly<Record<string, unknown>>, now: number, lang: Lang): {
61
+ path: string;
62
+ problem: string;
63
+ };
64
+ }
65
+ /** The block of the card a tap came from (-1: the tap names none that the card has). */
66
+ export declare function slotOf(data: Readonly<Record<string, unknown>>): number;
@@ -0,0 +1,20 @@
1
+ import type { Logger } from "../ports/logger.js";
2
+ /**
3
+ * Work that runs on its own (a turn being read, a short watch, a throttled edit of a card) and can be cancelled: its signal
4
+ * aborts, and every await it makes on a cancellable call ends. Cancelling is cooperative: the work checks its signal after what it
5
+ * awaited, the way an asyncio task meets its cancellation at its next await.
6
+ */
7
+ export declare class Task {
8
+ private readonly controller;
9
+ private finished;
10
+ readonly done: Promise<void>;
11
+ constructor(work: (signal: AbortSignal) => Promise<void>, logger: Logger, what: string);
12
+ get running(): boolean;
13
+ get cancelled(): boolean;
14
+ cancel(): void;
15
+ }
16
+ /** One chat at a time: what runs for a chat waits for the one before it (the Python worker's per-chat `asyncio.Lock`). */
17
+ export declare class ChatLocks {
18
+ private readonly tails;
19
+ with<T>(chatKey: string, work: () => Promise<T>): Promise<T>;
20
+ }
@@ -0,0 +1,15 @@
1
+ /** How long ago, and clock times, as the remote-agent cards say them. */
2
+ import type { Lang } from "../locales/lang.js";
3
+ /** Seconds since the epoch of an ISO 8601 time as Claw writes it (`2026-10-29T05:00:00Z`, an offset, or fractional seconds), or
4
+ * null when it is none. A time without an offset is read as UTC. */
5
+ export declare function parseIsoSeconds(value: unknown): number | null;
6
+ /** "just now", "3 h ago": how long before `now` (seconds since the epoch) the ISO time `when` was; "" when it is no time. */
7
+ export declare function ago(now: number, when: unknown, lang?: Lang): string;
8
+ /** `ago` for a time in seconds since the epoch; "" for none. */
9
+ export declare function agoEpoch(now: number, when: number | null, lang?: Lang): string;
10
+ /** `HH:MM` of `seconds` in the time zone `zone` (an IANA name). */
11
+ export declare function clock(seconds: number, zone: string): string;
12
+ /** `HH:MM:SSZ` of `seconds` in UTC. */
13
+ export declare function utcClock(seconds: number): string;
14
+ /** `MM-DD HH:MMZ` of `seconds` in UTC. */
15
+ export declare function utcStamp(seconds: number): string;
@@ -0,0 +1,29 @@
1
+ import type { SseEvent } from "../claw/model.js";
2
+ import type { PublicErrors } from "../public-error/public-errors.js";
3
+ import { type RemoteStep } from "./events.js";
4
+ /**
5
+ * One turn of a remote agent, folded event by event. The stream is read from the cursor after the previous turn's end, so every
6
+ * message chunk until the turn's end is this turn's. Like Claw's own turns, the answer is the agent's last piece of text: the text
7
+ * before a tool call is narration, shown while it runs. What it holds is bounded, however long a turn runs.
8
+ */
9
+ export declare class RemoteTurnState {
10
+ private readonly errors;
11
+ /** Event ids already seen, oldest first (at most SEEN_KEPT). */
12
+ readonly seen: Set<string>;
13
+ /** Message text, one entry per stretch between tool calls (at most SEGMENTS_KEPT). */
14
+ readonly segments: string[];
15
+ stopReason: string;
16
+ ended: boolean;
17
+ closed: string | null;
18
+ note: string | null;
19
+ private toolSinceText;
20
+ constructor(errors: PublicErrors);
21
+ feed(event: SseEvent): RemoteStep;
22
+ /** The agent's last piece of text, stripped. */
23
+ get answer(): string;
24
+ /** The answer so far, and the text is forgotten (the event ids already seen are not): what a reader that goes on after a
25
+ * piece of the agent's output was delivered folds the next piece from. */
26
+ takeAnswer(): string;
27
+ private remember;
28
+ private addText;
29
+ }
@@ -0,0 +1,50 @@
1
+ import type { Logger } from "../../ports/logger.js";
2
+ import type { Clock } from "../../ports/clock.js";
3
+ import { type RemoteStep } from "../events.js";
4
+ import type { RemoteLive } from "../ports.js";
5
+ import { type LiveViewLike, type StatusPolicy, type StreamFinish, type StreamFinishInput } from "../../turn/progress/status-policy.js";
6
+ import type { TurnSurface } from "../../turn/ports.js";
7
+ import type { FinishWith, TurnDisplay } from "./display.js";
8
+ import type { Signer } from "./signer.js";
9
+ /** What the bubble shows of a remote turn, and how its stream ends. */
10
+ export declare class RemoteStatusPolicy implements StatusPolicy<RemoteStep> {
11
+ private readonly live;
12
+ private readonly cutError;
13
+ private readonly signer;
14
+ /** A line of ours after the answer (how the turn ended): not the agent's words. */
15
+ tail: string;
16
+ private readonly segments;
17
+ private newSegment;
18
+ /** The live view as the status shows it (a remote turn has no setup phase: it never says "Preparing"). */
19
+ readonly view: LiveViewLike;
20
+ constructor(live: RemoteLive, cutError: (text: string) => string, signer: Signer | null);
21
+ applyStep(step: RemoteStep): boolean;
22
+ /** Everything the agent has written this turn, as it is shown (under its head, with a signer). */
23
+ private saidText;
24
+ streamable(streamed: string): string;
25
+ /**
26
+ * The bubble holds the agent's words. The final message keeps them (the chat refuses a stream whose text shrinks), and what the
27
+ * agent wrote after them follows as messages of its own: nothing is said twice. The line of ours about how the turn ended goes
28
+ * last. Only when the words shown are not the start of what the agent wrote (a mask that moved) does it end as every turn's does.
29
+ */
30
+ finishStream(input: StreamFinishInput): StreamFinish | undefined;
31
+ }
32
+ /** The turn shown in the chat (a stream, else a progress message), as a `TurnDisplay`. */
33
+ export declare class ChatTurn implements TurnDisplay {
34
+ private readonly surface;
35
+ private readonly policy;
36
+ private readonly options;
37
+ private readonly status;
38
+ constructor(surface: TurnSurface, policy: RemoteStatusPolicy, options: {
39
+ readonly clock: Clock;
40
+ readonly log: Logger;
41
+ readonly lang: string;
42
+ readonly replyTo: string | undefined;
43
+ });
44
+ get tail(): string;
45
+ set tail(line: string);
46
+ begin(): void;
47
+ progress(step: RemoteStep): void;
48
+ close(hard?: boolean): void;
49
+ finish(parts: readonly string[], options: FinishWith): Promise<void>;
50
+ }
@@ -0,0 +1,18 @@
1
+ import type { SuggestedReply } from "../../ports/surface.js";
2
+ import { type RemoteStep } from "../events.js";
3
+ /** How a remote turn is shown while it runs and when it ends: in the chat (a stream, or a progress message), or in the session card. */
4
+ export interface TurnDisplay {
5
+ /** A line of ours after the answer (how the turn ended): not the agent's words. */
6
+ tail: string;
7
+ begin(): void;
8
+ progress(step: RemoteStep): void;
9
+ /** Nothing more is shown (`hard`: the turn was cancelled). */
10
+ close(hard?: boolean): void;
11
+ /** The answer: `parts` in order, the suggested `replies` under the last. */
12
+ finish(parts: readonly string[], options: FinishWith): Promise<void>;
13
+ }
14
+ export interface FinishWith {
15
+ /** What the agent wrote (the AI label). */
16
+ readonly ai: boolean;
17
+ readonly replies?: readonly SuggestedReply[];
18
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * How a remote turn ended, as the person is told it: the agent's answer (its last piece of text), and lines of ours after it (a
3
+ * failure with a reference, the session's end, a stop at a limit, a turn the connector could not complete). A turn that ended with
4
+ * no words of the agent's is never said as "Done" when a line of ours says otherwise.
5
+ */
6
+ import type { Lang } from "../../locales/lang.js";
7
+ /** What the turn's fold says of its end. */
8
+ export interface TurnEnd {
9
+ readonly answer: string;
10
+ readonly stopReason: string;
11
+ readonly note: string | null;
12
+ readonly closed: string | null;
13
+ /** The person asked to stop it. */
14
+ readonly stopRequested: boolean;
15
+ }
16
+ /** What says a turn's end in words: the session's end, a connector's code, a raw error withheld. */
17
+ export interface EndSayers {
18
+ readonly label: string;
19
+ readonly host: string;
20
+ readonly lang: Lang;
21
+ splitErrorTail(text: string): {
22
+ readonly kept: string;
23
+ readonly tail: string;
24
+ };
25
+ /** Log the raw error of a failed call and return its reference. */
26
+ withhold(error: string): string;
27
+ sessionEnded(reason: string): Promise<string>;
28
+ turnIncomplete(code: string): Promise<string>;
29
+ /** The answer's parts under the agent's head, in a chat that is its window (`signer.ts`). */
30
+ sign?: (parts: string[]) => string[];
31
+ }
32
+ export interface TurnOutcome {
33
+ /** The messages of the answer, the lines of ours on the last. */
34
+ readonly parts: string[];
35
+ /** The lines of ours ('' none). */
36
+ readonly tail: string;
37
+ /** The agent wrote something. */
38
+ readonly ai: boolean;
39
+ }
40
+ /** The answer and the lines of ours, as the person is told the end of the turn. */
41
+ export declare function turnOutcome(end: TurnEnd, say: EndSayers): Promise<TurnOutcome>;
@@ -0,0 +1,55 @@
1
+ import type { RemoteState } from "../../ports/store/remote.js";
2
+ import { type Conversation } from "../../ports/surface.js";
3
+ import type { StatusBoard } from "../board.js";
4
+ import type { RemoteContext } from "../context.js";
5
+ import { type EndedWords, type Provider } from "../ended.js";
6
+ import type { FollowControl } from "../follow/control.js";
7
+ import { type ChatState } from "../state.js";
8
+ import type { TurnDisplay } from "./display.js";
9
+ import type { Signer } from "./signer.js";
10
+ /** A coding agent may work for hours; after this the chat stops watching (it keeps going). */
11
+ export declare const REMOTE_TURN_DEADLINE_SECONDS: number;
12
+ export declare const RECONNECT_BACKOFF_SECONDS = 1;
13
+ /** Events between two writes of the read position. */
14
+ export declare const CURSOR_EVERY = 25;
15
+ /** A stream that keeps dropping is given up after this many tries in a row. */
16
+ export declare const STREAM_ATTEMPTS = 4;
17
+ /** How the turn is shown: in the chat, or in the session card (`window-turn.ts`). */
18
+ export type DisplayFor = (request: TurnRequest, signer: Signer | null) => TurnDisplay;
19
+ /** What a turn needs besides the chat: the person's credential, how to show it, and who carries what it asks. */
20
+ export interface TurnRequest {
21
+ readonly chatKey: string;
22
+ readonly key: string;
23
+ readonly provider: Provider;
24
+ readonly to: Conversation;
25
+ readonly state: RemoteState;
26
+ /** The person's message the turn answers (a stream answers it); undefined: shown by a progress message. */
27
+ readonly replyTo: string | undefined;
28
+ }
29
+ export declare class TurnRunner {
30
+ private readonly ctx;
31
+ private readonly state;
32
+ private readonly board;
33
+ private readonly follow;
34
+ private readonly ended;
35
+ private readonly show;
36
+ private readonly displayFor;
37
+ constructor(ctx: RemoteContext, state: ChatState, board: StatusBoard, follow: FollowControl, ended: EndedWords, show: (chatKey: string, sid: string, request: Readonly<Record<string, unknown>>, to: Conversation) => Promise<void>, displayFor: DisplayFor);
38
+ /** Watch the turn that is open on the chat's session. */
39
+ start(request: TurnRequest): void;
40
+ cancel(chatKey: string): void;
41
+ private guarded;
42
+ private display;
43
+ private run;
44
+ /** The turn could not be read to its end: the session is gone, Claw refused, or the connection was lost. */
45
+ private failed;
46
+ /**
47
+ * Read the session's events from the cursor until the turn ends or the session closes; a stream that drops is picked up again
48
+ * from the last event handled (the server replays what is stored after it).
49
+ */
50
+ private read;
51
+ /** One stream, read until it ends or the turn does. */
52
+ private readStream;
53
+ private apply;
54
+ private sayRecovered;
55
+ }
@@ -0,0 +1,14 @@
1
+ import type { Lang } from "../../locales/lang.js";
2
+ import type { SuggestedReply } from "../../ports/surface.js";
3
+ export declare class Signer {
4
+ readonly label: string;
5
+ readonly host: string;
6
+ readonly lang: Lang;
7
+ readonly replies: readonly SuggestedReply[];
8
+ readonly suffix: string;
9
+ constructor(label: string, host: string, lang: Lang, replies?: readonly SuggestedReply[], suffix?: string);
10
+ /** The agent's words (already masked) under its head. */
11
+ first(text: string): string;
12
+ /** `parts` as messages `first`, `first`+1, ... of one answer (1: the first one has the full head). */
13
+ later(parts: readonly string[], first?: number): string[];
14
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A remote agent's turn shown in the chat's session card (the window), in place of the chat's stream: what the agent writes fills
3
+ * the card's output (an edit at most every EDIT_SECONDS), the step it runs and a message waiting for the terminal are its state,
4
+ * and the end of the turn refreshes it (posted again at the bottom: a phone may not redraw an edit). Nothing else is posted.
5
+ */
6
+ import type { Conversation } from "../../ports/surface.js";
7
+ import { type RemoteStep } from "../events.js";
8
+ import type { StatusBoard } from "../board.js";
9
+ import type { ChatState } from "../state.js";
10
+ import type { TurnDisplay } from "./display.js";
11
+ export declare class WindowTurn implements TurnDisplay {
12
+ private readonly chatKey;
13
+ private readonly to;
14
+ private readonly state;
15
+ private readonly board;
16
+ private readonly cutError;
17
+ tail: string;
18
+ private readonly segments;
19
+ private newSegment;
20
+ private closed;
21
+ constructor(chatKey: string, to: Conversation, state: ChatState, board: StatusBoard, cutError: (text: string) => string);
22
+ private get view();
23
+ private said;
24
+ begin(): void;
25
+ progress(step: RemoteStep): void;
26
+ close(): void;
27
+ /** (the window has no labels or replies: the options are the chat's) */
28
+ finish(parts: readonly string[]): Promise<void>;
29
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The cards the domain builds beside `cards.ts`: the note that replaces a tapped card (and the notes that bring a card's buttons
3
+ * back), and the session card as the window. Built from the note view and the remote views; nothing here talks to a channel.
4
+ */
5
+ import type { Lang } from "../locales/lang.js";
6
+ import type { OutMessage, ViewButton } from "../ports/surface.js";
7
+ import { type DecisionButton } from "./actions.js";
8
+ /** A short note that replaces a tapped card (under `title` when there is one). */
9
+ export declare function noteCard(text: string, title?: string, buttons?: readonly ViewButton[]): OutMessage;
10
+ /** The permission card's buttons again under `text`, titled with the request: the decision did not go through. */
11
+ export declare function reopenedCard(buttons: readonly DecisionButton[], title: string, text: string): OutMessage;
12
+ /** The disconnect buttons again under `text`: pressing again can help. */
13
+ export declare function disconnectAgainCard(text: string, connectorId: string, title: string, lang: Lang): OutMessage;
@@ -0,0 +1,64 @@
1
+ import { type Conversation } from "../ports/surface.js";
2
+ import { type RemoteStep } from "./events.js";
3
+ import type { StatusBoard } from "./board.js";
4
+ import type { RemoteContext } from "./context.js";
5
+ import { type EndedWords, type Provider } from "./ended.js";
6
+ import type { FollowControl } from "./follow/control.js";
7
+ import { type ChatState } from "./state.js";
8
+ /** How long `/agent new` waits to say the agent is ready. */
9
+ export declare const WATCH_SECONDS = 30;
10
+ export declare const MODE_WATCH_SECONDS = 10;
11
+ export declare const MODE_ID_MAX = 64;
12
+ /** What a mode switch waits for: the mode the agent now reports, or the connector's refusal of the switch. */
13
+ export declare function modeAnswer(step: RemoteStep): boolean;
14
+ /** What the watch of a new session needs: who, where, and what the card asked for. */
15
+ export interface StartWatch {
16
+ readonly chatKey: string;
17
+ readonly sessionId: string;
18
+ readonly key: string;
19
+ readonly provider: Provider;
20
+ readonly to: Conversation;
21
+ /** The kind of session the card asked for when it is not how the agent starts ("ask" | "unattended"). */
22
+ readonly want: string | null;
23
+ /** The count a start in a mode that does not ask took, given back when it turns out not to be one. */
24
+ readonly ticket: object | null;
25
+ }
26
+ export declare class Watches {
27
+ private readonly ctx;
28
+ private readonly state;
29
+ private readonly board;
30
+ private readonly follow;
31
+ private readonly ended;
32
+ constructor(ctx: RemoteContext, state: ChatState, board: StatusBoard, follow: FollowControl, ended: EndedWords);
33
+ /** How long a watch of a new session (`start`) or of a mode switch (`mode`) reads. */
34
+ private seconds;
35
+ /** Run a watch for the chat; once it is over (not cancelled) the follower reads on. */
36
+ spawn(chatKey: string, work: (signal: AbortSignal) => Promise<void>): void;
37
+ cancel(chatKey: string): void;
38
+ /**
39
+ * Read the session's events until one is `wanted` (or the session ends), for at most `seconds`; the read position moves past
40
+ * what was read. That step, a closing step, or null when time ran out.
41
+ */
42
+ watch(chatKey: string, sessionId: string, credential: () => Promise<string>, wanted: (step: RemoteStep) => boolean, seconds: number, signal: AbortSignal): Promise<RemoteStep | null>;
43
+ /** The watch of a new session: say it is ready (in place, on its status card), or why it could not start. */
44
+ start(w: StartWatch, signal: AbortSignal): Promise<void>;
45
+ private couldNotStart;
46
+ /** Open in a terminal: watched, read-only; its output is told as it comes. */
47
+ private watching;
48
+ private ready;
49
+ private notReported;
50
+ /**
51
+ * The card asked for a kind of session the agent does not start as: the agent has just said which modes it offers and which of
52
+ * them ask, so switch it to one that does what was asked, and say so. What a connector refuses or does not say is told, never
53
+ * guessed: a mode id is never made up. (The same per-person limit as `/agent mode` to a mode that does not ask.)
54
+ */
55
+ private approvalNote;
56
+ /** Ask the session to switch to `target` and watch for its answer: why it did not (a line), or null when it may have. */
57
+ private switchTo;
58
+ /** The watch of a mode switch: say what it came to. */
59
+ mode(chatKey: string, sessionId: string, mode: string, w: {
60
+ key: string;
61
+ provider: Provider;
62
+ to: Conversation;
63
+ }, signal: AbortSignal): Promise<void>;
64
+ }
@@ -0,0 +1,14 @@
1
+ import { type Conversation } from "../../ports/surface.js";
2
+ import type { StatusBoard } from "../board.js";
3
+ import type { RemoteContext } from "../context.js";
4
+ import type { Settle } from "../permissions.js";
5
+ import type { ChatState } from "../state.js";
6
+ /** The tap a settle answers: the card it was on, and the data it carried. */
7
+ export interface Tap {
8
+ readonly chatKey: string;
9
+ readonly to: Conversation;
10
+ /** The message that holds the tapped card ("" not said). */
11
+ readonly tapped: string;
12
+ readonly data: Readonly<Record<string, unknown>>;
13
+ }
14
+ export declare function windowCloser(ctx: RemoteContext, state: ChatState, board: StatusBoard, tap: Tap, settle: Settle): Settle;
@@ -0,0 +1,2 @@
1
+ export * from "./output.js";
2
+ export * from "./view.js";
@@ -0,0 +1,28 @@
1
+ /** The agent's output as the window shows it: masked by credential shape before it is cut, so a cut cannot leave half of one. */
2
+ import type { Lang } from "../../locales/lang.js";
3
+ import type { SentFrom, WindowMode } from "./view.js";
4
+ /** One message of "完整输出". */
5
+ export declare const FULL_PART_CHARS = 3000;
6
+ export declare const FULL_PARTS_MAX = 12;
7
+ export declare function masked(text: string): string;
8
+ /**
9
+ * The last `lines` lines of `text` that fit in `chars` characters (masked first), and whether anything before them was left out.
10
+ */
11
+ export declare function tailLines(text: string, chars: number, lines: number): {
12
+ lines: string[];
13
+ cut: boolean;
14
+ };
15
+ /**
16
+ * "完整输出": the whole output kept, masked, in messages of FULL_PART_CHARS at most, cut at line ends where it can; the last
17
+ * FULL_PARTS_MAX of them (what came before is on the machine).
18
+ */
19
+ export declare function fullParts(text: string): string[];
20
+ /** The line over what was last sent to the session, by where it was typed. */
21
+ export declare function sentLabel(source: SentFrom, lang: Lang): string;
22
+ /**
23
+ * Where what is typed goes, said on the card (and by /help): the chat box to the assistant, the card's box to the session; or, in
24
+ * `chat` mode, everything to the session but what starts with @ the assistant. `bot`: the assistant's display name.
25
+ */
26
+ export declare function chatBoxLine(window: string, lang: Lang, bot: string): string;
27
+ /** What `/agent mode card|chat` answers. */
28
+ export declare function modeSetLine(window: WindowMode, lang: Lang, attached: boolean, bot: string): string;
@@ -0,0 +1,73 @@
1
+ export declare const WINDOW_MODES: readonly ["card", "chat"];
2
+ export type WindowMode = (typeof WINDOW_MODES)[number];
3
+ export declare function isWindowMode(value: string): value is WindowMode;
4
+ /** The output of the current (or last) turn kept for "完整输出". */
5
+ export declare const FULL_KEEP_CHARS = 60000;
6
+ /** The card's text box. */
7
+ export declare const INPUT_MAX = 4000;
8
+ /** The id of that box in what a tap carries. */
9
+ export declare const INPUT_ID = "window_text";
10
+ /** An edit more than this many times since the card was posted: it is posted again at the bottom. */
11
+ export declare const REPOST_EDITS = 6;
12
+ /** ... while a turn streams into it (an edit every EDIT_SECONDS: about a minute). */
13
+ export declare const REPOST_EDITS_STREAMING = 20;
14
+ /** Characters of output new since the card was posted that make it worth posting again. */
15
+ export declare const REPOST_GROWTH = 400;
16
+ /** At most one edit of the card per this long while a turn streams into it. */
17
+ export declare const EDIT_SECONDS = 3;
18
+ /** Where what was last sent to the session was typed: the card's box, a reply quoting the card, the chat box. */
19
+ export type SentFrom = "card" | "quote" | "chat" | "";
20
+ /**
21
+ * What one attached chat's window shows of its session's output, in this process (it starts empty after a restart: the next turn
22
+ * fills it). `text` is the output of the current turn, or of the last one; `postedLen` how much of it the card showed when it was
23
+ * last posted (not edited); `edits` the edits since then.
24
+ */
25
+ export declare class WindowView {
26
+ sessionId: string;
27
+ text: string;
28
+ /** The step the agent is running now ('' none). */
29
+ step: string;
30
+ /** Why a message waits for the terminal ('' it does not). */
31
+ queued: string;
32
+ /** The last message that went to the session from this chat. */
33
+ sent: string;
34
+ sentFrom: SentFrom;
35
+ /** What the card's box held when the person last tapped a button on it other than Send (shown in it again). */
36
+ draft: string;
37
+ /** The card the chat shows now has the text box. */
38
+ boxed: boolean;
39
+ /** Older cards with a box, left for the person's next act. */
40
+ kept: string[];
41
+ /** One line of ours under the output (how a turn ended, a refusal). */
42
+ note: string;
43
+ postedLen: number;
44
+ edits: number;
45
+ approvalsSeen: Set<string>;
46
+ /** A turn ended and the card has not been refreshed since (the next refresh reads it once). */
47
+ ended: boolean;
48
+ /** A view of another session starts empty. */
49
+ reset(sessionId: string): void;
50
+ /**
51
+ * The output now. A text that is not the continuation of the one shown (a new turn, a new burst) is measured from nothing: what
52
+ * the card showed when it was posted was another output, and only how much of this one there is counts (`shouldRepost`).
53
+ */
54
+ setText(text: string): void;
55
+ }
56
+ /**
57
+ * Whether the next refresh of the window posts it again at the bottom (and removes the old one) rather than editing it in place.
58
+ * `streaming`: an edit while a turn streams into the card, posted again only for an approval or after many edits. A turn's end
59
+ * always posts it again: the card said "running" until then, and a phone that does not redraw the edit would keep saying so.
60
+ */
61
+ export declare function shouldRepost(view: WindowView, approvals: readonly string[], ended?: boolean, streaming?: boolean): boolean;
62
+ export declare function markPosted(view: WindowView, approvals: readonly string[]): void;
63
+ export declare function markEdited(view: WindowView): void;
64
+ /**
65
+ * Whether the card in this phase has the text box: only while the session is idle. A running turn's card is edited every
66
+ * EDIT_SECONDS and posted again at the turn's end, and Teams keeps nothing typed into a card across an edit or a delete.
67
+ */
68
+ export declare function takesInput(phase: string): boolean;
69
+ /**
70
+ * The message is a reply that quotes one of this chat's session cards (the channel names the quoted message's id): in `card` mode
71
+ * it goes to the session, like the card's own box.
72
+ */
73
+ export declare function quotesWindow(quotedIds: readonly string[], cardIds: readonly string[]): boolean;