@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,55 @@
1
+ import type { JsonObject } from "../../json.js";
2
+ import type { ClawCredential } from "../../claw/credential.js";
3
+ import type { PullRef, ReviewStart } from "../../claw/model.js";
4
+ /** One pull request to review and the first message its session gets ("" Claw's own). */
5
+ export interface ReviewTarget {
6
+ readonly pull: PullRef;
7
+ readonly message: string;
8
+ }
9
+ /** A request for reviews (`POST /v1/assistant/reviews`); all of them start or none does. */
10
+ export interface StartReviews {
11
+ /** The requester's own linked key, as the model key (not sent for a review asked of someone else). */
12
+ readonly modelKey: string;
13
+ readonly prs: readonly ReviewTarget[];
14
+ readonly actingAs: string;
15
+ readonly actingAsName: string;
16
+ readonly reviewOnly: boolean;
17
+ readonly model: string;
18
+ /** A review asked of someone else: that person's exchanged token and own linked key. */
19
+ readonly actingToken?: string;
20
+ readonly actingKey?: string;
21
+ /** The asker's own words, quoted to the reviewer as untrusted. */
22
+ readonly requesterNote?: string;
23
+ /** The handoff the assistant gave back, whose record says what the review may do. */
24
+ readonly handoffId?: string;
25
+ }
26
+ /** Options of a message to the assistant. */
27
+ export interface AssistantMessageOptions {
28
+ readonly modelKey?: string;
29
+ /** The chat's `channel_context`. */
30
+ readonly context?: Readonly<JsonObject>;
31
+ /** The plugin id the web client names (`pluginId`). */
32
+ readonly plugin?: number;
33
+ }
34
+ /** The person's assistant in Claw and what it does for them (`/v1/assistant/*`). */
35
+ export interface ClawAssistantPort {
36
+ /** The key owner's assistant session, made on first use. ClawError(404): the assistant is off on this Claw. */
37
+ session(key: ClawCredential): Promise<{
38
+ sessionId: string;
39
+ created: boolean;
40
+ }>;
41
+ /** Says `text` to the assistant as typed; its message id, or null when queued. The answer comes back as an event. */
42
+ send(key: ClawCredential, sessionId: string, text: string, options?: AssistantMessageOptions): Promise<string | null>;
43
+ /** The caller's brief, put together now: `{date, lang, sections, needs_you, text}`. */
44
+ brief(key: ClawCredential, lang: string, timezone: string): Promise<JsonObject>;
45
+ /** The person's answer to a held write the assistant put to them (`allow` or `deny`); exchanged token only. */
46
+ decideConfirmation(token: ClawCredential, confirmationId: string, decision: string): Promise<JsonObject>;
47
+ /** Reviews as `actingAs`, each a work item. ReviewsRefused: none started. ClawError(404): a Claw without the route. */
48
+ startReviews(token: ClawCredential, request: StartReviews): Promise<ReviewStart[]>;
49
+ /** Makes the key owner's watcher of `scope` observe it. */
50
+ observeScope(key: ClawCredential, scope: string): Promise<JsonObject>;
51
+ /** Hands one message of an observed place to the watcher. ClawError(429 observe_backlog): it is behind. */
52
+ observe(key: ClawCredential, scope: string, content: string, messageId: string): Promise<JsonObject>;
53
+ /** What the watcher of `scope` would have done, newest first ([] for a scope never watched). */
54
+ observations(key: ClawCredential, scope: string, limit?: number): Promise<JsonObject[]>;
55
+ }
@@ -0,0 +1,28 @@
1
+ import type { ClawAssistantPort } from "./assistant.js";
2
+ import type { ClawRemoteAgentsPort } from "./remote-agents.js";
3
+ import type { ClawSessionsPort } from "./sessions.js";
4
+ import type { ClawMergeConfirmationsPort, ClawNotificationsPort, ClawSettingsPort, ClawTriggersPort } from "./settings.js";
5
+ import type { ClawWorkItemsPort } from "./work-items.js";
6
+ export type * from "./assistant.js";
7
+ export type * from "./remote-agents.js";
8
+ export type * from "./sessions.js";
9
+ export type * from "./settings.js";
10
+ export type * from "./work-items.js";
11
+ /**
12
+ * Claw's public HTTP API, always called as one person with that person's own credential (a per-call argument, never
13
+ * kept). Grouped by resource. Errors: ClawError (Claw answered with an error), ReviewsRefused, ReplayRefused,
14
+ * ClawAnswerInvalid (an answer this client does not understand), CredentialMisuse (refused before sending),
15
+ * ClawUnreachable. An id that could change which endpoint a request reaches is refused as ClawError(404).
16
+ */
17
+ export interface ClawPort {
18
+ /** The address Claw's API is reached at. */
19
+ readonly baseUrl: string;
20
+ readonly sessions: ClawSessionsPort;
21
+ readonly workItems: ClawWorkItemsPort;
22
+ readonly assistant: ClawAssistantPort;
23
+ readonly settings: ClawSettingsPort;
24
+ readonly notifications: ClawNotificationsPort;
25
+ readonly triggers: ClawTriggersPort;
26
+ readonly mergeConfirmations: ClawMergeConfirmationsPort;
27
+ readonly remoteAgents: ClawRemoteAgentsPort;
28
+ }
@@ -0,0 +1,53 @@
1
+ import type { JsonObject } from "../../json.js";
2
+ import type { RemoteHidden } from "../../protocol.js";
3
+ import type { ClawCredential } from "../../claw/credential.js";
4
+ import type { SseEvent } from "../../claw/model.js";
5
+ import type { RemoteConnector, RemoteEventRow, RemotePairing, RemoteSession, RemoteSetup } from "../../claw/remote.js";
6
+ /** What a remote session starts with. */
7
+ export interface NewRemoteSession {
8
+ readonly connectorId: string;
9
+ readonly agentId: string;
10
+ readonly cwd: string;
11
+ /** The permission mode to start in (absent: the agent's own). */
12
+ readonly mode?: string;
13
+ /** An existing conversation the agent offered to take over, passed on unread. */
14
+ readonly resumeRef?: string;
15
+ /** The person confirmed the terminal holding that conversation is ended first (only with `resumeRef`). */
16
+ readonly takeover?: boolean;
17
+ }
18
+ /**
19
+ * Agents on the user's own machines, the user side (`/v1/remote-agents/*`). Every call names this client in Claw's
20
+ * audit trail (`X-Claw-Client`).
21
+ */
22
+ export interface ClawRemoteAgentsPort {
23
+ /** How to connect a machine: the connector's package and the exact commands. */
24
+ setup(key: ClawCredential): Promise<RemoteSetup>;
25
+ /**
26
+ * The caller's connectors, each with `online` and its `agents`. The conversations the caller hid are left out of each
27
+ * agent's `capabilities.resumable` and counted in `capabilities.hidden_count`; `includeHidden` lists them too, marked
28
+ * `hidden: true` (`?hidden=include`).
29
+ */
30
+ connectors(key: ClawCredential, options?: {
31
+ includeHidden?: boolean;
32
+ }): Promise<RemoteConnector[]>;
33
+ /**
34
+ * Hides conversations (1-50 refs) of one of the caller's machines from their lists, or (`hidden` false) shows them
35
+ * again; nothing on the machine changes. ClawError(404): not the caller's machine, or revoked; 400 for refs Claw does
36
+ * not take.
37
+ */
38
+ hide(key: ClawCredential, connectorId: string, refs: readonly string[], hidden: boolean): Promise<RemoteHidden>;
39
+ /** A one-time pairing code inside the command line that uses it. */
40
+ pair(key: ClawCredential): Promise<RemotePairing>;
41
+ revoke(key: ClawCredential, connectorId: string): Promise<void>;
42
+ createSession(key: ClawCredential, session: NewRemoteSession): Promise<RemoteSession>;
43
+ sessions(key: ClawCredential): Promise<RemoteSession[]>;
44
+ session(key: ClawCredential, sessionId: string): Promise<RemoteSession>;
45
+ /** One command (`prompt`, `cancel`, `set_mode`, `resume`, `close`); a retry with the same key queues one command. */
46
+ command(key: ClawCredential, sessionId: string, body: Readonly<JsonObject>, idempotencyKey?: string): Promise<JsonObject>;
47
+ /** Answers a permission request with an option id the agent itself offered. */
48
+ decide(key: ClawCredential, sessionId: string, actionId: string, optionId: string): Promise<JsonObject>;
49
+ /** A page of stored events `{id, seq, type, ts, data}`, oldest first, after `after`. */
50
+ events(key: ClawCredential, sessionId: string, after?: string, limit?: number): Promise<RemoteEventRow[]>;
51
+ /** Stored events after `after`, a `historyComplete` marker, then live events. */
52
+ stream(key: ClawCredential, sessionId: string, after?: string, signal?: AbortSignal): AsyncIterable<SseEvent>;
53
+ }
@@ -0,0 +1,105 @@
1
+ import type { JsonObject } from "../../json.js";
2
+ import type { ClawCredential } from "../../claw/credential.js";
3
+ import type { PullRef, SseEvent } from "../../claw/model.js";
4
+ /** What a new session is made with (`POST /v1/sessions`). */
5
+ export interface NewSession {
6
+ /** The first message; also the session's name (its first 50 characters). */
7
+ readonly text: string;
8
+ readonly idempotencyKey: string;
9
+ /** The git repository the session is bound to (`config.repo`); `branch` "" takes the remote's default. */
10
+ readonly repo?: {
11
+ readonly url: string;
12
+ readonly branch: string;
13
+ };
14
+ /** The user the session's GitHub review tools act for (`config.acting_as`); needs an exchanged token, never an `ak-` key. */
15
+ readonly actingAs?: string;
16
+ /** The one pull request such a session's review tools may touch (`config.review_target`). */
17
+ readonly reviewTarget?: PullRef;
18
+ /** The requester's own linked key, sent as `x-api-key` next to an exchanged token (never next to an `ak-` key). */
19
+ readonly modelKey?: string;
20
+ /** The model its turns ask for; "" leaves the configured default (or Claw's). */
21
+ readonly model?: string;
22
+ /** `config.review_only`: Claw refuses a merge in that session. */
23
+ readonly reviewOnly?: boolean;
24
+ /** false: the session is made with no message (`text` is only its name) and `messageId` is "". Default true. */
25
+ readonly withMessage?: boolean;
26
+ /** Other people read the session (a group chat): `config.memory = "off"`. */
27
+ readonly shared?: boolean;
28
+ }
29
+ /** One file put into a session's workspace. */
30
+ export interface UploadFile {
31
+ readonly name: string;
32
+ readonly content: Uint8Array;
33
+ readonly mediaType: string;
34
+ }
35
+ /** Options of a message into a session. */
36
+ export interface SendOptions {
37
+ /** See `NewSession.modelKey`. */
38
+ readonly modelKey?: string;
39
+ /** The session acts as a user: the message goes as the text alone, without plugin or appended rules. */
40
+ readonly acting?: boolean;
41
+ }
42
+ /**
43
+ * Claw sessions: making them, writing into them and reading them back
44
+ * (`/v1/sessions/*`, `/v1/chat/sessions/:id/messages`).
45
+ */
46
+ export interface ClawSessionsPort {
47
+ /** Throws ClawError(401) when Claw does not accept the key. */
48
+ checkKey(key: ClawCredential): Promise<void>;
49
+ /** A new session; its first message's id ("" when made without one). */
50
+ create(key: ClawCredential, session: NewSession): Promise<{
51
+ sessionId: string;
52
+ messageId: string;
53
+ }>;
54
+ /**
55
+ * Puts files in the session's workspace under `.uploads/<folder>/` (kept 7 days): the paths the agent finds them at,
56
+ * and the names Claw did not take.
57
+ */
58
+ uploadFiles(key: ClawCredential, sessionId: string, folder: string, files: readonly UploadFile[]): Promise<{
59
+ paths: string[];
60
+ refused: string[];
61
+ }>;
62
+ /** Pins an existing session to `model` (`PATCH /v1/sessions/:id`). */
63
+ setModel(key: ClawCredential, sessionId: string, model: string): Promise<void>;
64
+ /** Sends `text`; its message id, or null when Claw queued it behind a turn still running. */
65
+ sendMessage(key: ClawCredential, sessionId: string, text: string, options?: SendOptions): Promise<string | null>;
66
+ /** Whether a turn holds the session, and that turn's message id when Claw says it. */
67
+ turn(key: ClawCredential, sessionId: string): Promise<{
68
+ running: boolean;
69
+ messageId: string | null;
70
+ }>;
71
+ /**
72
+ * The session's stored events as rows `{event_id, event_type, data, created_at}`, oldest first (`?mode=replay`).
73
+ * `tail`: only the last `tail`. `maxBytes`: a larger reply is refused (ReplayRefused) before it is held whole.
74
+ */
75
+ events(key: ClawCredential, sessionId: string, options?: {
76
+ tail?: number;
77
+ maxBytes?: number;
78
+ }): Promise<JsonObject[]>;
79
+ /** The id of the session's newest stored event (null: none), read bounded. */
80
+ lastEventId(key: ClawCredential, sessionId: string): Promise<string | null>;
81
+ /**
82
+ * What the session changed in its sandbox (`GET /v1/sessions/:id/changes`), as Claw answers it; the whole call is
83
+ * bounded by `timeoutMs` (ClawUnreachable "timeout") and a reply larger than the limit is refused (ReplayRefused).
84
+ */
85
+ changes(key: ClawCredential, sessionId: string, timeoutMs: number): Promise<unknown>;
86
+ /** Where the user downloads a file the agent delivered (null when Claw is not reached over https). */
87
+ deliveryLink(sessionId: string, deliveryId: string): string | null;
88
+ /** Ends the running turn. */
89
+ interrupt(key: ClawCredential, sessionId: string): Promise<void>;
90
+ /** The answer to an approval card of the session's model (`messageType: decision`). */
91
+ decide(key: ClawCredential, sessionId: string, toolUseId: string, action: string, options?: {
92
+ acting?: boolean;
93
+ }): Promise<void>;
94
+ /** The answer to a question card (`messageType: answer`): {question id: answer} and the ids left blank. */
95
+ answer(key: ClawCredential, sessionId: string, toolUseId: string, answers: Readonly<Record<string, string>>, skipped: readonly string[], options?: {
96
+ acting?: boolean;
97
+ }): Promise<void>;
98
+ /** The key owner's thumbs up or down on one answer of their session (a second vote replaces the first). */
99
+ vote(key: ClawCredential, sessionId: string, messageId: string, vote: "up" | "down", reason?: string): Promise<void>;
100
+ /**
101
+ * The session's SSE stream: history first (ended by `historyComplete`), then live events. `onOpen` is called once Claw has
102
+ * answered the request (its status), before any event: from then on, what the session says reaches this stream.
103
+ */
104
+ stream(key: ClawCredential, sessionId: string, after?: string, signal?: AbortSignal, onOpen?: () => void): AsyncIterable<SseEvent>;
105
+ }
@@ -0,0 +1,62 @@
1
+ import type { JsonObject } from "../../json.js";
2
+ import type { ClawCredential } from "../../claw/credential.js";
3
+ import type { GithubConnection, MemoryState } from "../../claw/model.js";
4
+ import type { NotificationSubscription } from "../../protocol.js";
5
+ /** The person's own settings in Claw: memory, models, the assistant's model choice, GitHub. */
6
+ export interface ClawSettingsPort {
7
+ /** Memory on or off, whether Claw has it, and up to `limit` remembered items (profile entries left out). */
8
+ memory(key: ClawCredential, limit?: number): Promise<MemoryState>;
9
+ /** Turns memory on or off; what Claw answers. */
10
+ setMemory(key: ClawCredential, enabled: boolean): Promise<{
11
+ enabled: boolean;
12
+ available: boolean;
13
+ }>;
14
+ /** The models the key's owner may use. ClawError when Claw cannot say (never an empty list for that). */
15
+ models(key: ClawCredential): Promise<string[]>;
16
+ /** The assistant's model settings, or null for a Claw without model choice (404). */
17
+ assistantSettings(token: ClawCredential): Promise<JsonObject | null>;
18
+ /** `high_risk_confirm` or `fully_auto` ("" not said). */
19
+ reviewMode(token: ClawCredential): Promise<string>;
20
+ setReviewMode(token: ClawCredential, mode: string): Promise<void>;
21
+ /** Which GitHub token Claw would use for them, or null for a Claw without the answer (404). */
22
+ githubConnection(token: ClawCredential): Promise<GithubConnection | null>;
23
+ }
24
+ /** A notification subscription as Claw lists it; the signing secret only on the answer that made it. */
25
+ export type ClawSubscription = Partial<NotificationSubscription> & {
26
+ readonly secret?: string;
27
+ } & JsonObject;
28
+ /** Notification subscriptions (`/v1/notification-subscriptions`). ClawError(404): notifications are off on Claw. */
29
+ export interface ClawNotificationsPort {
30
+ list(key: ClawCredential): Promise<ClawSubscription[]>;
31
+ /** Subscribes the key's owner at `url`; the reply carries the signing secret, once. Empty lists: Claw's defaults. */
32
+ create(key: ClawCredential, url: string, eventTypes?: readonly string[], sources?: readonly string[]): Promise<ClawSubscription>;
33
+ /** Changes which events (and, given, which sources) a subscription gets; `enable` turns it on again. */
34
+ updateTypes(key: ClawCredential, subscriptionId: string, eventTypes: readonly string[], options?: {
35
+ enable?: boolean;
36
+ sources?: readonly string[];
37
+ }): Promise<ClawSubscription>;
38
+ delete(key: ClawCredential, subscriptionId: string): Promise<void>;
39
+ }
40
+ /** What a scheduled trigger is made or changed with. `action` "brief": the assistant says the brief, no run. */
41
+ export interface TriggerInput {
42
+ readonly name: string;
43
+ readonly prompt: string;
44
+ readonly schedule: string;
45
+ readonly timezone: string;
46
+ readonly action?: string;
47
+ }
48
+ /** The caller's own scheduled triggers (`/v1/triggers`), passed on as Claw answers them. */
49
+ export interface ClawTriggersPort {
50
+ list(key: ClawCredential): Promise<JsonObject[]>;
51
+ create(key: ClawCredential, trigger: TriggerInput): Promise<JsonObject>;
52
+ /** `action` is not sent on a change. */
53
+ update(key: ClawCredential, triggerId: string, trigger: TriggerInput): Promise<JsonObject>;
54
+ delete(key: ClawCredential, triggerId: string): Promise<void>;
55
+ }
56
+ /** Held high-risk merges of GitHub reviews (`/v1/github-review/confirmations`). */
57
+ export interface ClawMergeConfirmationsPort {
58
+ /** The merges this session waits on someone to confirm. ClawError(404): the review feature is off. */
59
+ pending(key: ClawCredential, sessionId: string): Promise<JsonObject[]>;
60
+ /** The answer of the user the review acts for (`allow` | `deny`); exchanged token only. `{status, reason, merge_sha}`. */
61
+ decide(token: ClawCredential, confirmationId: string, decision: string): Promise<JsonObject>;
62
+ }
@@ -0,0 +1,32 @@
1
+ import type { JsonObject } from "../../json.js";
2
+ import type { ClawCredential } from "../../claw/credential.js";
3
+ import type { ReviewAskedOfOther, Decision, AskerView, WorkItem } from "../../claw/model.js";
4
+ import type { BoardState } from "../../protocol.js";
5
+ /** The assistant's work items, the board (`/v1/work-items/*`). */
6
+ export interface ClawWorkItemsPort {
7
+ /** The caller's board, newest first; `state` narrows it (done: the last 7 days). */
8
+ list(key: ClawCredential, state?: BoardState): Promise<WorkItem[]>;
9
+ /** The reviews the caller asked of others, newest first ([] from a Claw without the route). */
10
+ askedOfOthers(key: ClawCredential): Promise<ReviewAskedOfOther[]>;
11
+ /** One of the caller's items as it is now. ClawError(404): not theirs, or gone. */
12
+ get(key: ClawCredential, itemId: string): Promise<WorkItem>;
13
+ /** What the asker of a review someone else runs may know of it now. */
14
+ requesterView(key: ClawCredential, itemId: string): Promise<AskerView>;
15
+ /** Accepts result `version` and only that one; a 409 comes back as a Decision with the item as it is now. */
16
+ accept(key: ClawCredential, itemId: string, version: number): Promise<Decision>;
17
+ /** Runs a task that failed or was stopped again. */
18
+ retry(key: ClawCredential, itemId: string): Promise<Decision>;
19
+ /** Stops the item and its worker. */
20
+ stop(key: ClawCredential, itemId: string): Promise<Decision>;
21
+ /** The item, and the pull requests its worker reported as its result (newest first, each once). */
22
+ pulls(key: ClawCredential, itemId: string): Promise<{
23
+ item: WorkItem;
24
+ pulls: string[];
25
+ }>;
26
+ /** The item watches `pull` on GitHub; `reply` needs the person's exchanged token. */
27
+ watchPull(token: ClawCredential, itemId: string, pull: string, reply?: boolean): Promise<JsonObject>;
28
+ /** The pull requests the item watches, and watched: each `{sub_id, pr, url, reply_allowed, state, ...}`. */
29
+ watches(key: ClawCredential, itemId: string): Promise<JsonObject[]>;
30
+ /** The item stops watching one pull request. */
31
+ unwatchPull(key: ClawCredential, itemId: string, subId: string): Promise<JsonObject>;
32
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Time, injected. Nothing in core reads `Date.now()`, `performance.now()` or calls `setTimeout` itself: tests drive a
3
+ * fake clock (`test-support/clock.ts`), the runtime gives the system's (`@primusclaw/personal-agent-runtime`).
4
+ */
5
+ export interface Clock {
6
+ /** Wall-clock time, milliseconds since the Unix epoch (what is stored and shown; it can jump). */
7
+ epochMs(): number;
8
+ /** A monotonic reading in milliseconds, for durations and deadlines only (never stored; its origin is arbitrary). */
9
+ monotonicMs(): number;
10
+ /**
11
+ * Resolves after `ms` milliseconds of this clock. With `signal`, rejects with the signal's reason as soon as it is
12
+ * aborted (an abort that happened before the call rejects at once).
13
+ */
14
+ sleep(ms: number, signal?: AbortSignal): Promise<void>;
15
+ }
16
+ /** Wall-clock seconds since the epoch, as a float: the unit the stored timestamps use (`created_at REAL`). */
17
+ export declare function epochSeconds(clock: Clock): number;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Hashing and message authentication for the domain (ids derived from text, signed callbacks). Encryption at rest is
3
+ * the store's own business and is not offered here.
4
+ */
5
+ export type Bytes = string | Uint8Array;
6
+ export interface Crypto {
7
+ /** Hex SHA-256 of `data` (a string is taken as UTF-8). */
8
+ sha256Hex(data: Bytes): string;
9
+ /** Hex SHA-1, for ids that are already SHA-1 derived elsewhere; never for security. */
10
+ sha1Hex(data: Bytes): string;
11
+ /** Hex HMAC-SHA256 of `data` under `key`. */
12
+ hmacSha256Hex(key: Bytes, data: Bytes): string;
13
+ /** Constant-time equality; false for different lengths. */
14
+ timingSafeEqual(a: Bytes, b: Bytes): boolean;
15
+ }
@@ -0,0 +1,97 @@
1
+ /**
2
+ * What the review delegation needs from GitHub and from the identity service's GitHub credentials, as ports. The runtime
3
+ * implements them over HTTP (`runtime/src/github/`); tests use fakes. No port ever returns or logs a GitHub token except
4
+ * `DeviceFlow.waitForToken`, whose token goes straight to `GithubCredentials.bind`.
5
+ */
6
+ import type { NotBound } from "../plugins/token-exchange.js";
7
+ import type { Result } from "../result.js";
8
+ import type { PullRef } from "../claw/model.js";
9
+ /** The GitHub device flow ended without a token: 'unavailable' (GitHub did not answer sensibly), 'expired' (the code ran
10
+ * out unused) or 'denied' (the person said no). Nothing but the reason is kept (no body, no code, no token). */
11
+ export interface DeviceFlowFailed {
12
+ readonly kind: "device_flow_failed";
13
+ readonly reason: "unavailable" | "expired" | "denied";
14
+ }
15
+ /** The wait was given up on (the person sent `/github unbind` meanwhile). */
16
+ export interface DeviceFlowCancelled {
17
+ readonly kind: "device_flow_cancelled";
18
+ }
19
+ export interface DeviceCode {
20
+ /** What the worker polls with; never shown. */
21
+ readonly deviceCode: string;
22
+ /** What the person types. */
23
+ readonly userCode: string;
24
+ readonly verificationUri: string;
25
+ readonly expiresIn: number;
26
+ readonly interval: number;
27
+ }
28
+ /** RFC 8628 against github.com with a public client; the scope asked for is always `repo`. */
29
+ export interface DeviceFlow {
30
+ start(): Promise<Result<DeviceCode, DeviceFlowFailed>>;
31
+ /** Polls until the person approves: the token, or why not. An aborted `signal` ends the wait as `cancelled`. */
32
+ waitForToken(code: DeviceCode, signal?: AbortSignal): Promise<Result<string, DeviceFlowFailed | DeviceFlowCancelled>>;
33
+ }
34
+ /**
35
+ * The identity service refused or could not be asked. `status` is the HTTP status (0: no answer) and `code` its OAuth error
36
+ * code; nothing else of the answer is kept.
37
+ */
38
+ export interface CredentialRefused {
39
+ readonly kind: "credential_refused";
40
+ readonly status: number;
41
+ readonly code: string;
42
+ }
43
+ /** `not_bound`: the identity service has no binding for this person; only they can make one, by connecting their account. */
44
+ export type CredentialFailure = NotBound | CredentialRefused;
45
+ export declare function credentialRefused(status: number, code?: string): CredentialRefused;
46
+ /** How a refusal is logged: status and code only. */
47
+ export declare function describeRefusal(refused: CredentialRefused): string;
48
+ export interface GithubState {
49
+ readonly userId: string;
50
+ readonly bound: boolean;
51
+ readonly login: string;
52
+ readonly scopes: readonly string[];
53
+ readonly expiresAt: string;
54
+ readonly expired: boolean;
55
+ readonly delegation: boolean;
56
+ readonly lastUsedAt: string;
57
+ }
58
+ export declare function usable(state: GithubState): boolean;
59
+ export declare const SCOPE = "repo";
60
+ export declare const NARROW_SCOPE = "public_repo";
61
+ /** A binding whose permissions do not reach private and internal repositories (`public_repo` only, or none known). */
62
+ export declare function needsWiderScope(scopes: readonly string[]): boolean;
63
+ /** The identity service's `/oauth/external-credentials` calls for a person (by their directory id). */
64
+ export interface GithubCredentials {
65
+ status(userId: string): Promise<Result<GithubState, CredentialFailure>>;
66
+ bind(userId: string, token: string): Promise<Result<GithubState, CredentialFailure>>;
67
+ unbind(userId: string): Promise<Result<boolean, CredentialFailure>>;
68
+ setDelegation(userId: string, enabled: boolean): Promise<Result<GithubState, CredentialFailure>>;
69
+ }
70
+ /** Who wrote a pull request, and other public facts, read with no credential. Any failure reads as "not known". */
71
+ export interface PullReader {
72
+ /** The repository's own "owner/name" when GitHub has it public, '' when it does not (404), undefined when it could not be read. */
73
+ repo(owner: string, name: string): Promise<string | undefined>;
74
+ /** The branch the pull request goes into ('' when not read). */
75
+ base(pull: PullRef): Promise<string>;
76
+ /** Who wrote it (undefined: not read) and its title ('' not read). */
77
+ read(pull: PullRef): Promise<{
78
+ readonly author: string | undefined;
79
+ readonly title: string;
80
+ }>;
81
+ }
82
+ /** One mention as the model is shown it: its marker in the text, its id, and its display name. */
83
+ export interface ListedMention {
84
+ readonly marker: string;
85
+ readonly id: string;
86
+ readonly name: string;
87
+ }
88
+ /**
89
+ * One small model call that says what a message asks for, with the asker's own key. undefined for anything but an answer in
90
+ * time (no model, the gateway refused or was slow): the rules read it instead. `{ intent: null }` when it answered something
91
+ * that is not a JSON object.
92
+ */
93
+ export interface IntentReader {
94
+ read(key: string, text: string, mentions: readonly ListedMention[]): Promise<Record<string, unknown> | undefined>;
95
+ readMode(key: string, text: string): Promise<Record<string, unknown> | undefined>;
96
+ readAnswer(key: string, text: string, pending: readonly Readonly<Record<string, string>>[]): Promise<Record<string, unknown> | undefined>;
97
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Every port core talks to the outside through. Ownership while the port is written (the Python module it follows):
3
+ * W0: Surface (messenger.py, activity.py), Clock, Random, Logger.
4
+ * W1: StorePort and the repositories (store.py), Crypto (store.py Fernet, link-code HMAC).
5
+ * W2: ClawPort (claw.py), Metrics (metrics.py), SecretSource (secret_source.py), Config (config.py).
6
+ * Implementations live in the runtime package (Node) or a channel package; tests use `test-support/`.
7
+ */
8
+ export * from "./clock.js";
9
+ export * from "./logger.js";
10
+ export * from "./random.js";
11
+ export * from "./surface.js";
12
+ export * from "./claw/index.js";
13
+ export * from "./metrics.js";
14
+ export * from "./secret-source.js";
15
+ export * from "./request-scope.js";
16
+ export * from "./routing.js";
17
+ export * from "./turn-cards.js";
18
+ export * from "./github.js";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Structured logging, injected. A message is a fixed sentence; what varies goes in `fields`.
3
+ *
4
+ * What a log line never carries: what a person wrote, what an agent answered, a token, a key, a response body, a file
5
+ * name or its bytes. Counts, ids, statuses, durations and error kinds (`errorName`) are what is logged.
6
+ */
7
+ export type LogLevel = "debug" | "info" | "warn" | "error";
8
+ export type LogValue = string | number | boolean | null | undefined;
9
+ export type LogFields = Readonly<Record<string, LogValue>>;
10
+ export interface Logger {
11
+ debug(message: string, fields?: LogFields): void;
12
+ info(message: string, fields?: LogFields): void;
13
+ warn(message: string, fields?: LogFields): void;
14
+ error(message: string, fields?: LogFields): void;
15
+ /** A logger whose every line also carries `fields` (a module name, the conversation a task works for). */
16
+ child(fields: LogFields): Logger;
17
+ }
18
+ /** A logger that drops everything: the default where a caller passes none. */
19
+ export declare const silentLogger: Logger;
@@ -0,0 +1,21 @@
1
+ import type { SecurityEventRecord } from "../observability/security-events.js";
2
+ /**
3
+ * The counters behind the operator's alerts. Every label value comes from a closed list
4
+ * (`../observability/metrics-catalog.ts`), so no label ever names a person, a conversation or anything a person chose;
5
+ * a value outside its list is counted under the list's catch-all or not at all. The runtime serves them in the
6
+ * Prometheus text format (`GET /metrics` on its own port); tests use a recording fake.
7
+ */
8
+ export interface MetricsPort {
9
+ /** One event from Claw reached the chat: `handleSeconds` after it was received, `sinceOccurredSeconds` after Claw says it happened (null: not said). */
10
+ eventDelivered(eventType: string, handleSeconds: number, sinceOccurredSeconds: number | null): void;
11
+ /** One security event as `securityEvent` logged it. */
12
+ securityEvent(record: SecurityEventRecord): void;
13
+ /** One inbound message handled: how long it waited in the queue (null: unknown), how long handling took, whether it succeeded. */
14
+ processed(lagMs: number | null, handleMs: number, ok: boolean): void;
15
+ /** A message or task refused by a per-user limit (`user_limit` | `concurrency_limit`). */
16
+ limited(reason: string): void;
17
+ /** `count` files a person sent did not reach Claw on `path` (assistant | session | remote_agent | review | unreadable). */
18
+ filesDropped(path: string, count?: number): void;
19
+ }
20
+ /** Metrics that go nowhere: the default where a caller passes none. */
21
+ export declare const noMetrics: MetricsPort;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Randomness, injected: ids, nonces and jitter. The runtime's implementation is cryptographically strong
3
+ * (`node:crypto`), so a value from here may be used where it must not be guessed (a link code, an ack id).
4
+ * Tests use a seeded one (`test-support/random.ts`) so their output is the same on every run.
5
+ */
6
+ export interface Random {
7
+ /** `n` random bytes. */
8
+ bytes(n: number): Uint8Array;
9
+ /** A random id: 32 lowercase hex characters (the shape of Python's `uuid.uuid4().hex`). */
10
+ hexId(): string;
11
+ /** A uniformly distributed integer in [0, maxExclusive). */
12
+ int(maxExclusive: number): number;
13
+ /** A float in [0, 1), for jitter only. */
14
+ fraction(): number;
15
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * What the worker is handling right now: the inbound activity a piece of work was started by, so that what runs on its
3
+ * behalf (an answer's language, an audit record, a log line kept for /feedback) knows it without every call passing it
4
+ * on. The router enters it once per inbound event, after the duplicate check and before routing (Python agent.py
5
+ * `Agent.handle`: LOG_SCOPE, CLIENT_LOCALE and ACTIVITY_ID set around `_route`). Work started inside keeps it after the
6
+ * router has returned, as an asyncio task copies its context; work started outside any event (a timer, a pushed
7
+ * notification, start-up recovery) reads none.
8
+ */
9
+ /** The inbound event's context (Python: CLIENT_LOCALE, ACTIVITY_ID, and LOG_SCOPE's aad id and conversation id). */
10
+ export interface RequestContext {
11
+ /** The client's locale as the channel said it ("" when it did not). */
12
+ readonly clientLocale: string;
13
+ /** The inbound activity's id ("" when it has none). */
14
+ readonly activityId: string;
15
+ /** The sender's id. */
16
+ readonly userId: string;
17
+ /** The conversation's id. */
18
+ readonly conversationId: string;
19
+ }
20
+ export interface RequestScope {
21
+ /** Runs `fn` inside `context` (and what it starts, for as long as that runs); the outer context is back after it. */
22
+ run<T>(context: RequestContext, fn: () => T): T;
23
+ /** The context of the event being handled; undefined outside any. */
24
+ current(): RequestContext | undefined;
25
+ }
26
+ /** A scope that keeps nothing: `run` only runs, `current` is always undefined (what a worker without one reads). */
27
+ export declare const noRequestScope: RequestScope;
28
+ /** The client locale of the event being handled ("" outside any: Python CLIENT_LOCALE's default). */
29
+ export declare function clientLocaleOf(scope: RequestScope): string;
30
+ /** The id of the activity being handled ("" outside any: Python ACTIVITY_ID's default, None). */
31
+ export declare function activityIdOf(scope: RequestScope): string;