typeclaw 0.49.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (442) hide show
  1. package/dist/types/agent/attention-escalation.d.ts +18 -0
  2. package/dist/types/agent/auth.d.ts +7 -0
  3. package/dist/types/agent/compaction.d.ts +8 -0
  4. package/dist/types/agent/git-nudge.d.ts +6 -0
  5. package/dist/types/agent/guard-types.d.ts +25 -0
  6. package/dist/types/agent/guards.d.ts +7 -0
  7. package/dist/types/agent/idle-compaction.d.ts +7 -0
  8. package/dist/types/agent/index.d.ts +163 -0
  9. package/dist/types/agent/live-subagents.d.ts +113 -0
  10. package/dist/types/agent/llm-replay-sanitizer.d.ts +11 -0
  11. package/dist/types/agent/loop-guard.d.ts +67 -0
  12. package/dist/types/agent/model-fallback.d.ts +29 -0
  13. package/dist/types/agent/model-overrides.d.ts +8 -0
  14. package/dist/types/agent/multimodal/index.d.ts +2 -0
  15. package/dist/types/agent/multimodal/look-at.d.ts +60 -0
  16. package/dist/types/agent/multimodal/looker.d.ts +61 -0
  17. package/dist/types/agent/multimodal/read-redirect.d.ts +6 -0
  18. package/dist/types/agent/network/response-body.d.ts +1 -0
  19. package/dist/types/agent/network/safe-http.d.ts +46 -0
  20. package/dist/types/agent/plugin-tools.d.ts +129 -0
  21. package/dist/types/agent/proactive-next-step-nudge.d.ts +2 -0
  22. package/dist/types/agent/prompt-cache-key.d.ts +3 -0
  23. package/dist/types/agent/provider-error.d.ts +23 -0
  24. package/dist/types/agent/reload-tool.d.ts +10 -0
  25. package/dist/types/agent/restart/index.d.ts +31 -0
  26. package/dist/types/agent/restart-handoff/index.d.ts +32 -0
  27. package/dist/types/agent/restart-handoff/paths.d.ts +1 -0
  28. package/dist/types/agent/retry-same-ref.d.ts +41 -0
  29. package/dist/types/agent/reviewer-activity.d.ts +3 -0
  30. package/dist/types/agent/reviewer-bash-policy.d.ts +8 -0
  31. package/dist/types/agent/self.d.ts +1 -0
  32. package/dist/types/agent/session-meta.d.ts +28 -0
  33. package/dist/types/agent/session-origin.d.ts +65 -0
  34. package/dist/types/agent/subagent-cache-keepalive.d.ts +38 -0
  35. package/dist/types/agent/subagent-completion-reminder.d.ts +29 -0
  36. package/dist/types/agent/subagent-drain.d.ts +25 -0
  37. package/dist/types/agent/subagent-session.d.ts +3 -0
  38. package/dist/types/agent/subagents.d.ts +153 -0
  39. package/dist/types/agent/system-prompt.d.ts +7 -0
  40. package/dist/types/agent/throttle-circuit.d.ts +25 -0
  41. package/dist/types/agent/todo/continuation-policy.d.ts +54 -0
  42. package/dist/types/agent/todo/continuation-state.d.ts +11 -0
  43. package/dist/types/agent/todo/continuation-wiring.d.ts +32 -0
  44. package/dist/types/agent/todo/continuation.d.ts +21 -0
  45. package/dist/types/agent/todo/scope.d.ts +6 -0
  46. package/dist/types/agent/todo/store.d.ts +16 -0
  47. package/dist/types/agent/tool-error-remediation.d.ts +1 -0
  48. package/dist/types/agent/tool-file-safety.d.ts +78 -0
  49. package/dist/types/agent/tool-not-found-nudge.d.ts +9 -0
  50. package/dist/types/agent/tool-result-budget.d.ts +15 -0
  51. package/dist/types/agent/tools/channel-disengage.d.ts +18 -0
  52. package/dist/types/agent/tools/channel-edit.d.ts +19 -0
  53. package/dist/types/agent/tools/channel-fetch-attachment.d.ts +36 -0
  54. package/dist/types/agent/tools/channel-handoff.d.ts +13 -0
  55. package/dist/types/agent/tools/channel-history-render.d.ts +3 -0
  56. package/dist/types/agent/tools/channel-history.d.ts +25 -0
  57. package/dist/types/agent/tools/channel-log.d.ts +5 -0
  58. package/dist/types/agent/tools/channel-react.d.ts +23 -0
  59. package/dist/types/agent/tools/channel-read.d.ts +27 -0
  60. package/dist/types/agent/tools/channel-reply.d.ts +47 -0
  61. package/dist/types/agent/tools/channel-send.d.ts +42 -0
  62. package/dist/types/agent/tools/channel-session-search.d.ts +10 -0
  63. package/dist/types/agent/tools/curl-impersonate.d.ts +37 -0
  64. package/dist/types/agent/tools/ddg.d.ts +18 -0
  65. package/dist/types/agent/tools/grant-role.d.ts +25 -0
  66. package/dist/types/agent/tools/keyed-semaphore.d.ts +10 -0
  67. package/dist/types/agent/tools/post-github-review.d.ts +38 -0
  68. package/dist/types/agent/tools/restart.d.ts +25 -0
  69. package/dist/types/agent/tools/runtime-notice.d.ts +3 -0
  70. package/dist/types/agent/tools/search-retry.d.ts +16 -0
  71. package/dist/types/agent/tools/skip-response.d.ts +17 -0
  72. package/dist/types/agent/tools/spawn-subagent.d.ts +77 -0
  73. package/dist/types/agent/tools/stream-snapshot.d.ts +23 -0
  74. package/dist/types/agent/tools/subagent-access.d.ts +20 -0
  75. package/dist/types/agent/tools/subagent-cancel.d.ts +23 -0
  76. package/dist/types/agent/tools/subagent-output.d.ts +50 -0
  77. package/dist/types/agent/tools/todo/index.d.ts +14 -0
  78. package/dist/types/agent/tools/webfetch/adaptive-html.d.ts +29 -0
  79. package/dist/types/agent/tools/webfetch/fetch.d.ts +26 -0
  80. package/dist/types/agent/tools/webfetch/html-lexical.d.ts +27 -0
  81. package/dist/types/agent/tools/webfetch/index.d.ts +1 -0
  82. package/dist/types/agent/tools/webfetch/inline-style-visibility.d.ts +3 -0
  83. package/dist/types/agent/tools/webfetch/strategies/grep.d.ts +11 -0
  84. package/dist/types/agent/tools/webfetch/strategies/jq.d.ts +4 -0
  85. package/dist/types/agent/tools/webfetch/strategies/raw.d.ts +1 -0
  86. package/dist/types/agent/tools/webfetch/strategies/readability.d.ts +16 -0
  87. package/dist/types/agent/tools/webfetch/strategies/selector.d.ts +4 -0
  88. package/dist/types/agent/tools/webfetch/strategies/snapshot.d.ts +1 -0
  89. package/dist/types/agent/tools/webfetch/tool.d.ts +15 -0
  90. package/dist/types/agent/tools/webfetch/types.d.ts +32 -0
  91. package/dist/types/agent/tools/websearch.d.ts +17 -0
  92. package/dist/types/agent/tools/wikipedia.d.ts +7 -0
  93. package/dist/types/agent/tools-without-local-file-operands.d.ts +1 -0
  94. package/dist/types/agent/turn-runner.d.ts +36 -0
  95. package/dist/types/agent-messenger/config-dir.d.ts +19 -0
  96. package/dist/types/browser/dockerfile.d.ts +2 -0
  97. package/dist/types/browser/registry.d.ts +49 -0
  98. package/dist/types/bundled-plugins/bun-hygiene/policy.d.ts +18 -0
  99. package/dist/types/bundled-plugins/github-cli-auth/git-askpass.d.ts +5 -0
  100. package/dist/types/bundled-plugins/guard/keys.d.ts +6 -0
  101. package/dist/types/bundled-plugins/guard/policies/managed-config.d.ts +7 -0
  102. package/dist/types/bundled-plugins/guard/policies/memory-topics-delete.d.ts +11 -0
  103. package/dist/types/bundled-plugins/guard/policies/memory-topics-write.d.ts +7 -0
  104. package/dist/types/bundled-plugins/guard/policies/non-workspace-write.d.ts +9 -0
  105. package/dist/types/bundled-plugins/guard/policies/skill-authoring.d.ts +20 -0
  106. package/dist/types/bundled-plugins/guard/policies/uncommitted-changes.d.ts +12 -0
  107. package/dist/types/bundled-plugins/guard/policy.d.ts +11 -0
  108. package/dist/types/bundled-plugins/memory/secret-detector.d.ts +11 -0
  109. package/dist/types/bundled-plugins/memory/slug.d.ts +4 -0
  110. package/dist/types/bundled-plugins/security/permissions.d.ts +20 -0
  111. package/dist/types/bundled-plugins/security/policies/private-surface-read.d.ts +34 -0
  112. package/dist/types/bundled-plugins/security/policies/ssrf.d.ts +18 -0
  113. package/dist/types/bundled-plugins/security/policy.d.ts +4 -0
  114. package/dist/types/channels/adapter-namespace.d.ts +2 -0
  115. package/dist/types/channels/adapters/mention-hints.d.ts +12 -0
  116. package/dist/types/channels/adapters/webex-id-ref.d.ts +5 -0
  117. package/dist/types/channels/background-handoff.d.ts +56 -0
  118. package/dist/types/channels/background-obligations.d.ts +135 -0
  119. package/dist/types/channels/catch-up.d.ts +26 -0
  120. package/dist/types/channels/commands.d.ts +2 -0
  121. package/dist/types/channels/completion-claim.d.ts +20 -0
  122. package/dist/types/channels/continuation-willingness.d.ts +1 -0
  123. package/dist/types/channels/continuity-types.d.ts +75 -0
  124. package/dist/types/channels/describe-error.d.ts +1 -0
  125. package/dist/types/channels/engagement.d.ts +34 -0
  126. package/dist/types/channels/github-false-receipt.d.ts +20 -0
  127. package/dist/types/channels/github-repo.d.ts +2 -0
  128. package/dist/types/channels/github-rereview-guard.d.ts +24 -0
  129. package/dist/types/channels/github-review-check.d.ts +135 -0
  130. package/dist/types/channels/github-review-claim.d.ts +3 -0
  131. package/dist/types/channels/github-review-turn-ledger.d.ts +71 -0
  132. package/dist/types/channels/github-review-verdict-coordinator.d.ts +117 -0
  133. package/dist/types/channels/github-token-bridge.d.ts +20 -0
  134. package/dist/types/channels/github-verdict-activity.d.ts +12 -0
  135. package/dist/types/channels/inbound-journal.d.ts +272 -0
  136. package/dist/types/channels/last-alive.d.ts +3 -0
  137. package/dist/types/channels/membership-cache.d.ts +27 -0
  138. package/dist/types/channels/membership.d.ts +21 -0
  139. package/dist/types/channels/outbound-flood-filter.d.ts +7 -0
  140. package/dist/types/channels/participants.d.ts +4 -0
  141. package/dist/types/channels/persistence.d.ts +32 -0
  142. package/dist/types/channels/recovery-notice.d.ts +26 -0
  143. package/dist/types/channels/recovery-outbox.d.ts +58 -0
  144. package/dist/types/channels/router.d.ts +798 -0
  145. package/dist/types/channels/schema.d.ts +501 -0
  146. package/dist/types/channels/session-handoff.d.ts +58 -0
  147. package/dist/types/channels/session-search.d.ts +29 -0
  148. package/dist/types/channels/types.d.ts +414 -0
  149. package/dist/types/channels/waiting-reactions.d.ts +25 -0
  150. package/dist/types/cli/builtins.d.ts +2 -0
  151. package/dist/types/cli/command-meta.d.ts +9 -0
  152. package/dist/types/coding-agent/broker-body.d.ts +7 -0
  153. package/dist/types/coding-agent/broker.d.ts +22 -0
  154. package/dist/types/coding-agent/claude.d.ts +22 -0
  155. package/dist/types/coding-agent/codex.d.ts +19 -0
  156. package/dist/types/coding-agent/index.d.ts +71 -0
  157. package/dist/types/coding-agent/omo-state.d.ts +2 -0
  158. package/dist/types/coding-agent/omo-stream.d.ts +22 -0
  159. package/dist/types/coding-agent/omo.d.ts +133 -0
  160. package/dist/types/coding-agent/runner.d.ts +35 -0
  161. package/dist/types/coding-agent/tool.d.ts +27 -0
  162. package/dist/types/coding-agent/worktree.d.ts +22 -0
  163. package/dist/types/commands/index.d.ts +45 -0
  164. package/dist/types/config/config.d.ts +814 -0
  165. package/dist/types/config/index.d.ts +3 -0
  166. package/dist/types/config/model-overrides.d.ts +3 -0
  167. package/dist/types/config/providers.d.ts +1456 -0
  168. package/dist/types/config/reloadable.d.ts +9 -0
  169. package/dist/types/container/agent-operation-lock.d.ts +31 -0
  170. package/dist/types/container/build-cache.d.ts +39 -0
  171. package/dist/types/container/compose-project.d.ts +1 -0
  172. package/dist/types/container/controller.d.ts +25 -0
  173. package/dist/types/container/docker-app.d.ts +23 -0
  174. package/dist/types/container/exit-reason.d.ts +10 -0
  175. package/dist/types/container/index.d.ts +14 -0
  176. package/dist/types/container/log-archive.d.ts +68 -0
  177. package/dist/types/container/log-colors.d.ts +3 -0
  178. package/dist/types/container/log-timestamps.d.ts +9 -0
  179. package/dist/types/container/logs.d.ts +37 -0
  180. package/dist/types/container/memory-limit.d.ts +13 -0
  181. package/dist/types/container/memory-oversubscription.d.ts +20 -0
  182. package/dist/types/container/oom-events.d.ts +18 -0
  183. package/dist/types/container/port.d.ts +18 -0
  184. package/dist/types/container/require-running.d.ts +16 -0
  185. package/dist/types/container/restart.d.ts +32 -0
  186. package/dist/types/container/shared.d.ts +93 -0
  187. package/dist/types/container/shell.d.ts +35 -0
  188. package/dist/types/container/start.d.ts +144 -0
  189. package/dist/types/container/stats.d.ts +31 -0
  190. package/dist/types/container/status.d.ts +25 -0
  191. package/dist/types/container/stop.d.ts +24 -0
  192. package/dist/types/container/tool-oom-priority.d.ts +4 -0
  193. package/dist/types/container/verify-running.d.ts +49 -0
  194. package/dist/types/cron/consumer.d.ts +42 -0
  195. package/dist/types/cron/count-state.d.ts +24 -0
  196. package/dist/types/cron/index.d.ts +21 -0
  197. package/dist/types/cron/list.d.ts +33 -0
  198. package/dist/types/cron/reloadable.d.ts +11 -0
  199. package/dist/types/cron/scheduler.d.ts +51 -0
  200. package/dist/types/cron/schema.d.ts +108 -0
  201. package/dist/types/dependencies/bin-resolver.d.ts +28 -0
  202. package/dist/types/dependencies/bins.d.ts +22 -0
  203. package/dist/types/dependencies/index.d.ts +2 -0
  204. package/dist/types/git/bound-gc-config.d.ts +4 -0
  205. package/dist/types/git/hookless.d.ts +1 -0
  206. package/dist/types/git/reconcile-ignored.d.ts +13 -0
  207. package/dist/types/git/resolve-agent-git.d.ts +8 -0
  208. package/dist/types/git/resolve-identity.d.ts +10 -0
  209. package/dist/types/git/run.d.ts +24 -0
  210. package/dist/types/git/system-commit.d.ts +2 -0
  211. package/dist/types/hostd/client.d.ts +13 -0
  212. package/dist/types/hostd/models.d.ts +1 -0
  213. package/dist/types/hostd/paths.d.ts +17 -0
  214. package/dist/types/hostd/protocol.d.ts +93 -0
  215. package/dist/types/hostd/spawn.d.ts +17 -0
  216. package/dist/types/hostd/version.d.ts +18 -0
  217. package/dist/types/init/auto-upgrade.d.ts +41 -0
  218. package/dist/types/init/cli-version.d.ts +7 -0
  219. package/dist/types/init/dockerfile.d.ts +34 -0
  220. package/dist/types/init/ensure-deps.d.ts +17 -0
  221. package/dist/types/init/env-file.d.ts +3 -0
  222. package/dist/types/init/gitignore.d.ts +5 -0
  223. package/dist/types/init/local-source-stamp.d.ts +3 -0
  224. package/dist/types/init/packagejson.d.ts +7 -0
  225. package/dist/types/init/paths.d.ts +3 -0
  226. package/dist/types/init/reconcile-plugin-deps.d.ts +13 -0
  227. package/dist/types/init/run-bun-install.d.ts +16 -0
  228. package/dist/types/init/windows-dev-link.d.ts +8 -0
  229. package/dist/types/mcp/catalog.d.ts +7 -0
  230. package/dist/types/mcp/client.d.ts +58 -0
  231. package/dist/types/mcp/manager.d.ts +56 -0
  232. package/dist/types/mcp/tools.d.ts +23 -0
  233. package/dist/types/models/embedding-model.d.ts +20 -0
  234. package/dist/types/models/transformers-version.d.ts +1 -0
  235. package/dist/types/network/internal-destinations.d.ts +29 -0
  236. package/dist/types/operations/classify-tool-outcome.d.ts +35 -0
  237. package/dist/types/operations/incidents.d.ts +47 -0
  238. package/dist/types/operations/index.d.ts +3 -0
  239. package/dist/types/operations/remediations.d.ts +25 -0
  240. package/dist/types/path-safety/real-intended-path.d.ts +9 -0
  241. package/dist/types/permissions/builtins.d.ts +25 -0
  242. package/dist/types/permissions/grant.d.ts +19 -0
  243. package/dist/types/permissions/index.d.ts +6 -0
  244. package/dist/types/permissions/match-rule.d.ts +28 -0
  245. package/dist/types/permissions/permissions.d.ts +42 -0
  246. package/dist/types/permissions/resolve.d.ts +25 -0
  247. package/dist/types/permissions/schema.d.ts +14 -0
  248. package/dist/types/plugin/context.d.ts +20 -0
  249. package/dist/types/plugin/core-tool-names.d.ts +4 -0
  250. package/dist/types/plugin/define.d.ts +46 -0
  251. package/dist/types/plugin/hooks.d.ts +52 -0
  252. package/dist/types/plugin/index.d.ts +11 -0
  253. package/dist/types/plugin/load-skill.d.ts +14 -0
  254. package/dist/types/plugin/loader.d.ts +25 -0
  255. package/dist/types/plugin/manager.d.ts +42 -0
  256. package/dist/types/plugin/registry.d.ts +73 -0
  257. package/dist/types/plugin/skills.d.ts +11 -0
  258. package/dist/types/plugin/types.d.ts +336 -0
  259. package/dist/types/plugin/zod-introspect.d.ts +11 -0
  260. package/dist/types/reload/client.d.ts +11 -0
  261. package/dist/types/reload/docker-exec-client.d.ts +11 -0
  262. package/dist/types/reload/format.d.ts +2 -0
  263. package/dist/types/reload/index.d.ts +6 -0
  264. package/dist/types/reload/recover.d.ts +22 -0
  265. package/dist/types/reload/registry.d.ts +10 -0
  266. package/dist/types/reload/types.d.ts +25 -0
  267. package/dist/types/role-claim/client.d.ts +20 -0
  268. package/dist/types/role-claim/code.d.ts +4 -0
  269. package/dist/types/role-claim/controller.d.ts +59 -0
  270. package/dist/types/role-claim/index.d.ts +6 -0
  271. package/dist/types/role-claim/match-rule.d.ts +9 -0
  272. package/dist/types/role-claim/pending.d.ts +35 -0
  273. package/dist/types/role-claim/reload-after-claim.d.ts +16 -0
  274. package/dist/types/run/llm-fetch-observer.d.ts +50 -0
  275. package/dist/types/sandbox/availability.d.ts +21 -0
  276. package/dist/types/sandbox/build.d.ts +7 -0
  277. package/dist/types/sandbox/canonical-secrets.d.ts +8 -0
  278. package/dist/types/sandbox/coding-agent.d.ts +20 -0
  279. package/dist/types/sandbox/dependency-bins.d.ts +19 -0
  280. package/dist/types/sandbox/dev-source.d.ts +4 -0
  281. package/dist/types/sandbox/env-exposure.d.ts +1 -0
  282. package/dist/types/sandbox/errors.d.ts +20 -0
  283. package/dist/types/sandbox/hidden-paths.d.ts +11 -0
  284. package/dist/types/sandbox/index.d.ts +14 -0
  285. package/dist/types/sandbox/package-install.d.ts +1 -0
  286. package/dist/types/sandbox/policy.d.ts +71 -0
  287. package/dist/types/sandbox/privileged-runtime.d.ts +13 -0
  288. package/dist/types/sandbox/quote.d.ts +2 -0
  289. package/dist/types/sandbox/runtime-private.d.ts +1 -0
  290. package/dist/types/sandbox/session-tmp.d.ts +6 -0
  291. package/dist/types/sandbox/symlinks.d.ts +6 -0
  292. package/dist/types/sandbox/writable-zones.d.ts +15 -0
  293. package/dist/types/secrets/coding-agent-auth.d.ts +25 -0
  294. package/dist/types/secrets/defaults.d.ts +21 -0
  295. package/dist/types/secrets/export-github-cli-store.d.ts +22 -0
  296. package/dist/types/secrets/hydrate.d.ts +7 -0
  297. package/dist/types/secrets/index.d.ts +7 -0
  298. package/dist/types/secrets/provision-github-cli-store.d.ts +45 -0
  299. package/dist/types/secrets/refresh-provider-oauth.d.ts +22 -0
  300. package/dist/types/secrets/resolve.d.ts +14 -0
  301. package/dist/types/secrets/schema.d.ts +840 -0
  302. package/dist/types/secrets/storage.d.ts +56 -0
  303. package/dist/types/shared/host-locale.d.ts +1 -0
  304. package/dist/types/shared/index.d.ts +5 -0
  305. package/dist/types/shared/local-time.d.ts +4 -0
  306. package/dist/types/shared/platform.d.ts +2 -0
  307. package/dist/types/shared/protocol.d.ts +424 -0
  308. package/dist/types/shared/style-text.d.ts +3 -0
  309. package/dist/types/shared/wsl.d.ts +17 -0
  310. package/dist/types/stream/broker.d.ts +2 -0
  311. package/dist/types/stream/index.d.ts +2 -0
  312. package/dist/types/stream/types.d.ts +71 -0
  313. package/package.json +9 -2
  314. package/scripts/build-plugin-types.ts +105 -0
  315. package/scripts/check-plugin-sdk.ts +111 -0
  316. package/scripts/require-parallel.ts +5 -32
  317. package/src/agent/guard-types.ts +3 -0
  318. package/src/agent/guards.ts +4 -0
  319. package/src/agent/idle-compaction.ts +174 -0
  320. package/src/agent/index.ts +74 -16
  321. package/src/agent/live-subagents.ts +19 -0
  322. package/src/agent/multimodal/look-at.ts +22 -9
  323. package/src/agent/plugin-tools.ts +13 -1
  324. package/src/agent/reviewer-bash-policy.ts +41 -1
  325. package/src/agent/session-origin.ts +26 -10
  326. package/src/agent/subagent-cache-keepalive.ts +198 -0
  327. package/src/agent/subagent-session.ts +6 -0
  328. package/src/agent/subagents.ts +46 -8
  329. package/src/agent/system-prompt.ts +1 -1
  330. package/src/agent/tool-file-safety.ts +6 -1
  331. package/src/agent/tools/channel-edit.ts +20 -10
  332. package/src/agent/tools/channel-fetch-attachment.ts +12 -5
  333. package/src/agent/tools/channel-handoff.ts +72 -0
  334. package/src/agent/tools/channel-read.ts +57 -10
  335. package/src/agent/tools/channel-reply.ts +33 -26
  336. package/src/agent/tools/channel-send.ts +21 -13
  337. package/src/agent/tools/channel-session-search.ts +35 -0
  338. package/src/agent/tools/curl-impersonate.ts +11 -4
  339. package/src/agent/tools/ddg.ts +13 -5
  340. package/src/agent/tools/spawn-subagent.ts +27 -11
  341. package/src/agent/tools/stream-snapshot.ts +15 -2
  342. package/src/agent/tools/subagent-access.ts +11 -4
  343. package/src/browser/bsk-shim.mjs +74 -0
  344. package/src/browser/dockerfile.ts +84 -0
  345. package/src/browser/egress.ts +104 -0
  346. package/src/browser/managed-browser.ts +205 -0
  347. package/src/browser/registry.ts +110 -0
  348. package/src/browser/relay.ts +231 -0
  349. package/src/browser/sandbox-entry.ts +167 -0
  350. package/src/bundled-plugins/agent-browser/index.ts +2 -0
  351. package/src/bundled-plugins/browser-agent/browser-agent.ts +89 -0
  352. package/src/bundled-plugins/browser-agent/index.ts +12 -0
  353. package/src/bundled-plugins/doc-render/index.ts +0 -10
  354. package/src/bundled-plugins/doc-render/render.ts +83 -111
  355. package/src/bundled-plugins/doc-render/skills/typeclaw-render-pdf/SKILL.md +152 -257
  356. package/src/bundled-plugins/github-cli-auth/gh-command.ts +4 -0
  357. package/src/bundled-plugins/github-cli-auth/git-auth-diagnostic.ts +95 -0
  358. package/src/bundled-plugins/github-cli-auth/index.ts +75 -59
  359. package/src/bundled-plugins/managed-browser/index.ts +74 -0
  360. package/src/bundled-plugins/managed-browser/skills/browser-use/browser-use/SKILL.md +27 -0
  361. package/src/bundled-plugins/managed-browser/skills/browserskill/browserskill/SKILL.md +28 -0
  362. package/src/bundled-plugins/managed-browser/skills/omowright/omowright/SKILL.md +40 -0
  363. package/src/bundled-plugins/operator/operator.ts +1 -1
  364. package/src/bundled-plugins/qa/index.ts +11 -0
  365. package/src/bundled-plugins/qa/qa.ts +160 -0
  366. package/src/bundled-plugins/qa/skills/qa-cli.ts +50 -0
  367. package/src/bundled-plugins/qa/skills/qa-general.ts +30 -0
  368. package/src/bundled-plugins/qa/skills/qa-http.ts +39 -0
  369. package/src/bundled-plugins/qa/skills/qa-pr.ts +51 -0
  370. package/src/bundled-plugins/qa/skills/qa-web.ts +49 -0
  371. package/src/bundled-plugins/security/index.ts +53 -34
  372. package/src/bundled-plugins/security/policies/outbound-secret-scan.ts +1 -0
  373. package/src/channels/adapter-namespace.ts +13 -0
  374. package/src/channels/adapters/discord-bot.ts +97 -5
  375. package/src/channels/adapters/github/index.ts +16 -0
  376. package/src/channels/adapters/github/last-alive.ts +4 -16
  377. package/src/channels/adapters/slack-attachment-download.ts +14 -3
  378. package/src/channels/adapters/slack-bot-author-resolver.ts +4 -3
  379. package/src/channels/adapters/slack-bot-channel-resolver.ts +9 -6
  380. package/src/channels/adapters/slack-bot-classify.ts +1 -0
  381. package/src/channels/adapters/slack-bot-slash-commands.ts +3 -1
  382. package/src/channels/adapters/slack-bot.ts +299 -67
  383. package/src/channels/adapters/slack-classify.ts +1 -0
  384. package/src/channels/catch-up.ts +137 -0
  385. package/src/channels/continuation-willingness.ts +2 -2
  386. package/src/channels/continuity-types.ts +1 -0
  387. package/src/channels/engagement.ts +17 -1
  388. package/src/channels/github-false-receipt.ts +3 -3
  389. package/src/channels/github-rereview-guard.ts +9 -5
  390. package/src/channels/github-token-bridge.ts +24 -0
  391. package/src/channels/last-alive.ts +34 -0
  392. package/src/channels/manager.ts +8 -1
  393. package/src/channels/router.ts +427 -136
  394. package/src/channels/session-handoff.fixture.ts +144 -0
  395. package/src/channels/session-handoff.ts +175 -0
  396. package/src/channels/session-search.ts +71 -0
  397. package/src/channels/types.ts +12 -2
  398. package/src/cli/channel.ts +2 -3
  399. package/src/cli/init.ts +2 -3
  400. package/src/cli/model.ts +132 -3
  401. package/src/coding-agent/index.ts +7 -1
  402. package/src/coding-agent/omo-stream.ts +40 -0
  403. package/src/coding-agent/runner.ts +30 -8
  404. package/src/config/config.ts +111 -22
  405. package/src/config/model-overrides.ts +59 -0
  406. package/src/config/models-mutation.ts +185 -2
  407. package/src/config/providers-mutation.ts +12 -4
  408. package/src/config/providers.ts +59 -0
  409. package/src/container/start.ts +95 -4
  410. package/src/doctor/checks.ts +8 -6
  411. package/src/hostd/daemon.ts +13 -1
  412. package/src/init/auto-upgrade.ts +7 -1
  413. package/src/init/dockerfile.ts +57 -12
  414. package/src/init/index.ts +4 -3
  415. package/src/init/local-source-stamp.ts +68 -0
  416. package/src/init/models-dev.ts +4 -0
  417. package/src/init/validate-api-key.ts +3 -0
  418. package/src/permissions/builtins.ts +7 -0
  419. package/src/permissions/permissions.ts +18 -9
  420. package/src/permissions/resolve.ts +7 -1
  421. package/src/plugin/context.ts +2 -0
  422. package/src/plugin/hooks.ts +137 -0
  423. package/src/plugin/index.ts +6 -0
  424. package/src/plugin/manager.ts +4 -0
  425. package/src/plugin/types.ts +60 -0
  426. package/src/run/bundled-plugins.ts +6 -0
  427. package/src/run/index.ts +24 -14
  428. package/src/run/llm-fetch-observer.ts +12 -15
  429. package/src/sandbox/canonical-secrets.ts +4 -0
  430. package/src/sandbox/dev-source.ts +26 -0
  431. package/src/sandbox/hidden-paths.ts +16 -2
  432. package/src/secrets/storage.ts +13 -0
  433. package/src/skills/typeclaw-channel-github/SKILL.md +8 -8
  434. package/src/skills/typeclaw-config/SKILL.md +39 -5
  435. package/src/skills/typeclaw-config/references/dockerfile.md +2 -2
  436. package/src/skills/typeclaw-github-contributing/SKILL.md +1 -1
  437. package/src/skills/typeclaw-monorepo/SKILL.md +1 -1
  438. package/src/skills/typeclaw-permissions/SKILL.md +7 -7
  439. package/src/skills/typeclaw-troubleshooting/SKILL.md +12 -1
  440. package/typeclaw.schema.json +436 -5
  441. package/src/bundled-plugins/doc-render/templates/lib.typ +0 -339
  442. package/src/bundled-plugins/github-cli-auth/gh-store.ts +0 -733
@@ -39,6 +39,10 @@ export const CORE_PERMISSIONS = {
39
39
  // permissions.ts), not the guest role, which is now grantable.
40
40
  fsSeePrivate: 'fs.see.private',
41
41
  fsSeeSecrets: 'fs.see.secrets',
42
+ // Drives the TypeClaw-managed shared browser (its logins span sessions and
43
+ // channels). Granted with fsSeePrivate because the browser's file exchange
44
+ // lives under workspace/, which that same tier already sees.
45
+ browserShared: 'browser.shared',
42
46
  } as const
43
47
 
44
48
  // Sentinel that `expandOwnerWildcard` swaps for the concrete union of
@@ -87,6 +91,7 @@ export const BUILTIN_ROLES: Readonly<Record<BuiltinRoleName, BuiltinRoleSpec>> =
87
91
  CORE_PERMISSIONS.subagentOutput,
88
92
  CORE_PERMISSIONS.subagentSpawnOperator,
89
93
  CORE_PERMISSIONS.fsSeePrivate,
94
+ CORE_PERMISSIONS.browserShared,
90
95
  CORE_PERMISSIONS.fsSeeSecrets,
91
96
  'security.bypass.low',
92
97
  'security.bypass.medium',
@@ -106,6 +111,7 @@ export const BUILTIN_ROLES: Readonly<Record<BuiltinRoleName, BuiltinRoleSpec>> =
106
111
  CORE_PERMISSIONS.subagentOutput,
107
112
  CORE_PERMISSIONS.subagentSpawnOperator,
108
113
  CORE_PERMISSIONS.fsSeePrivate,
114
+ CORE_PERMISSIONS.browserShared,
109
115
  CORE_PERMISSIONS.fsSeeSecrets,
110
116
  'security.bypass.low',
111
117
  'security.bypass.medium',
@@ -120,6 +126,7 @@ export const BUILTIN_ROLES: Readonly<Record<BuiltinRoleName, BuiltinRoleSpec>> =
120
126
  CORE_PERMISSIONS.subagentCancel,
121
127
  CORE_PERMISSIONS.subagentOutput,
122
128
  CORE_PERMISSIONS.fsSeePrivate,
129
+ CORE_PERMISSIONS.browserShared,
123
130
  'security.bypass.low',
124
131
  ],
125
132
  },
@@ -8,6 +8,8 @@ import type { RoleConfig, RolesConfig } from './schema'
8
8
  export type PermissionService = {
9
9
  has(origin: SessionOrigin | undefined, permission: string): boolean
10
10
  resolveRole(origin: SessionOrigin | undefined): string
11
+ // Discovery/delegation must distinguish an actual rule from the guest fallback.
12
+ resolveRole(origin: SessionOrigin | undefined, options: { requireMatch: true }): string | undefined
11
13
  describe(origin: SessionOrigin | undefined): { role: string; permissions: readonly string[] }
12
14
  // Orders two role names on the severity tower so callers can cap an
13
15
  // action to the requester's role (a guest turn must not read the output
@@ -208,9 +210,9 @@ export function createPermissionService(opts: CreatePermissionServiceOptions = {
208
210
  // chat ids — even denied traffic that resolves to guest — would otherwise
209
211
  // grow the map without limit until the next role-table rebuild. See
210
212
  // createBoundedCache for the eviction policy.
211
- const roleCache = createBoundedCache<string>(ROLE_CACHE_MAX)
213
+ const roleCache = createBoundedCache<string | null>(ROLE_CACHE_MAX)
212
214
 
213
- function computeRole(origin: SessionOrigin): string {
215
+ function computeRole(origin: SessionOrigin): string | null {
214
216
  // Runtime-owned infrastructure (memory, backup) acts on the operator's
215
217
  // behalf over operator-owned state. It is constructed only by runtime/
216
218
  // bundled code — inbound channel/cron content cannot produce this kind —
@@ -230,25 +232,28 @@ export function createPermissionService(opts: CreatePermissionServiceOptions = {
230
232
  }
231
233
 
232
234
  const matchable = toMatchable(origin)
233
- if (matchable === null) return 'guest'
235
+ if (matchable === null) return null
234
236
 
235
237
  for (const role of resolved) {
236
238
  for (const rule of role.match) {
237
239
  if (matchesOrigin(rule, matchable)) return role.name
238
240
  }
239
241
  }
240
- return 'guest'
242
+ return null
241
243
  }
242
244
 
243
- function resolveRole(origin: SessionOrigin | undefined): string {
244
- if (origin === undefined) return 'guest'
245
+ function resolveRole(origin: SessionOrigin | undefined): string
246
+ function resolveRole(origin: SessionOrigin | undefined, options: { requireMatch: true }): string | undefined
247
+ function resolveRole(origin: SessionOrigin | undefined, options?: { requireMatch: true }): string | undefined {
248
+ const fallback = options?.requireMatch ? undefined : 'guest'
249
+ if (origin === undefined) return fallback
245
250
  const key = roleCacheKey(origin)
246
- if (key === null) return computeRole(origin)
251
+ if (key === null) return computeRole(origin) ?? fallback
247
252
  const cached = roleCache.get(key)
248
- if (cached !== undefined) return cached
253
+ if (cached !== undefined) return cached ?? fallback
249
254
  const role = computeRole(origin)
250
255
  roleCache.set(key, role)
251
- return role
256
+ return role ?? fallback
252
257
  }
253
258
 
254
259
  function invalidateRoleCache(): void {
@@ -409,6 +414,7 @@ function roleCacheKey(origin: SessionOrigin): string | null {
409
414
  origin.chat,
410
415
  origin.parentChat ?? '',
411
416
  origin.lastInboundAuthorId ?? '',
417
+ origin.lastInboundAuthorAdapter ?? origin.adapter,
412
418
  ].join('\u0000')
413
419
  default:
414
420
  return null
@@ -427,6 +433,9 @@ function toMatchable(origin: SessionOrigin): Parameters<typeof matchesOrigin>[1]
427
433
  chat: origin.chat,
428
434
  ...(origin.parentChat !== undefined ? { parentChat: origin.parentChat } : {}),
429
435
  ...(origin.lastInboundAuthorId !== undefined ? { lastInboundAuthorId: origin.lastInboundAuthorId } : {}),
436
+ ...(origin.lastInboundAuthorAdapter !== undefined
437
+ ? { lastInboundAuthorAdapter: origin.lastInboundAuthorAdapter }
438
+ : {}),
430
439
  }
431
440
  default:
432
441
  return null
@@ -1,3 +1,4 @@
1
+ import { adapterNamespace } from '@/channels/adapter-namespace'
1
2
  import { decodeWebexId } from '@/channels/adapters/webex-id-ref'
2
3
  import type { AdapterId } from '@/channels/schema'
3
4
 
@@ -29,6 +30,7 @@ export type MatchableOrigin =
29
30
  chat: string
30
31
  parentChat?: string
31
32
  lastInboundAuthorId?: string
33
+ lastInboundAuthorAdapter?: AdapterId
32
34
  }
33
35
 
34
36
  export function matchesOrigin(rule: MatchRule, origin: MatchableOrigin): boolean {
@@ -60,7 +62,11 @@ function matchesChannel(rule: Extract<MatchRule, { kind: 'channel' }>, origin: M
60
62
  if (rule.chat !== undefined && !matchesChat(rule.chat, origin)) return false
61
63
  }
62
64
 
63
- if (rule.author !== undefined && !matchesAuthor(rule.platform, rule.author, origin.lastInboundAuthorId)) return false
65
+ if (rule.author !== undefined) {
66
+ if (adapterNamespace(origin.lastInboundAuthorAdapter ?? origin.adapter) !== adapterNamespace(origin.adapter))
67
+ return false
68
+ if (!matchesAuthor(rule.platform, rule.author, origin.lastInboundAuthorId)) return false
69
+ }
64
70
  return true
65
71
  }
66
72
 
@@ -15,6 +15,7 @@ export type CreatePluginContextOptions<TConfig> = {
15
15
  resolveGithubTokenForRepo?: ResolveGithubTokenForRepo
16
16
  hasGithubAppTokenResolver?: () => boolean
17
17
  getGithubAppSelfLogin?: () => string | null
18
+ resolveGithubPatForRepo?: ResolveGithubTokenForRepo
18
19
  spawnSubagent: SpawnSubagentFn
19
20
  isBooted: () => boolean
20
21
  }
@@ -36,6 +37,7 @@ export function createPluginContext<TConfig>(opts: CreatePluginContextOptions<TC
36
37
  resolveTokenForRepo: opts.resolveGithubTokenForRepo ?? githubTokenUnavailable,
37
38
  hasAppTokenResolver: opts.hasGithubAppTokenResolver ?? (() => false),
38
39
  getAppSelfLogin: opts.getGithubAppSelfLogin ?? (() => null),
40
+ resolvePatForRepo: opts.resolveGithubPatForRepo ?? githubTokenUnavailable,
39
41
  },
40
42
  spawnSubagent: async (name: string, payload?: unknown, options?: SpawnSubagentOptions) => {
41
43
  if (!opts.isBooted()) {
@@ -1,4 +1,6 @@
1
1
  import type {
2
+ ChannelMessageObservedEvent,
3
+ ChannelOutboundBeforeEvent,
2
4
  HookContext,
3
5
  Hooks,
4
6
  PluginLogger,
@@ -45,6 +47,11 @@ export const END_HANDLER_TIMEOUT_MS = 60_000
45
47
  // inline, AND regressions that re-introduce expensive inline prompt work.
46
48
  export const PROMPT_HANDLER_TIMEOUT_MS = 20_000
47
49
 
50
+ // Observers should enqueue and return. These bounds abandon asynchronous work;
51
+ // they cannot preempt synchronous code in a full-trust, in-process plugin.
52
+ export const OBSERVED_HANDLER_TIMEOUT_MS = 10_000
53
+ export const OUTBOUND_HANDLER_TIMEOUT_MS = 30_000
54
+
48
55
  export type RegisteredHook<K extends keyof Hooks> = {
49
56
  pluginName: string
50
57
  agentDir: string
@@ -61,12 +68,15 @@ export type HookBus = {
61
68
  runSessionPrompt: (event: SessionPromptEvent) => Promise<void>
62
69
  runSessionTurnStart: (event: SessionTurnStartEvent) => Promise<void>
63
70
  runSessionTurnEnd: (event: SessionTurnEndEvent) => Promise<void>
71
+ runChannelMessageObserved: (event: ChannelMessageObservedEvent) => void
72
+ runChannelOutboundBefore: (event: ChannelOutboundBeforeEvent) => Promise<{ text: string }>
64
73
  runToolBefore: (
65
74
  event: ToolBeforeEvent,
66
75
  guards?: readonly {
67
76
  owner: string
68
77
  key: string
69
78
  tools: ReadonlySet<string>
79
+ skipOnCheckError?: true
70
80
  check: (
71
81
  event: Readonly<ToolBeforeEvent>,
72
82
  ) =>
@@ -89,6 +99,8 @@ export type CreateHookBusOptions = {
89
99
  endHandlerTimeoutMs?: number
90
100
  // Test seam: per-handler ceiling for session.prompt invocations.
91
101
  promptHandlerTimeoutMs?: number
102
+ observedHandlerTimeoutMs?: number
103
+ outboundHandlerTimeoutMs?: number
92
104
  }
93
105
 
94
106
  type Registries = {
@@ -100,12 +112,16 @@ type Registries = {
100
112
  'session.turn.end': RegisteredHook<'session.turn.end'>[]
101
113
  'tool.before': Array<RegisteredHook<'tool.before'> | { pluginName: string; guardOwner: true; logger: PluginLogger }>
102
114
  'tool.after': RegisteredHook<'tool.after'>[]
115
+ 'channel.message.observed': RegisteredHook<'channel.message.observed'>[]
116
+ 'channel.outbound.before': RegisteredHook<'channel.outbound.before'>[]
103
117
  }
104
118
 
105
119
  export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
106
120
  const idleHandlerTimeoutMs = options.idleHandlerTimeoutMs ?? IDLE_HANDLER_TIMEOUT_MS
107
121
  const endHandlerTimeoutMs = options.endHandlerTimeoutMs ?? END_HANDLER_TIMEOUT_MS
108
122
  const promptHandlerTimeoutMs = options.promptHandlerTimeoutMs ?? PROMPT_HANDLER_TIMEOUT_MS
123
+ const observedHandlerTimeoutMs = options.observedHandlerTimeoutMs ?? OBSERVED_HANDLER_TIMEOUT_MS
124
+ const outboundHandlerTimeoutMs = options.outboundHandlerTimeoutMs ?? OUTBOUND_HANDLER_TIMEOUT_MS
109
125
  const r: Registries = {
110
126
  'session.start': [],
111
127
  'session.end': [],
@@ -115,6 +131,8 @@ export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
115
131
  'session.turn.end': [],
116
132
  'tool.before': [],
117
133
  'tool.after': [],
134
+ 'channel.message.observed': [],
135
+ 'channel.outbound.before': [],
118
136
  }
119
137
 
120
138
  function ctx(reg: { pluginName: string; agentDir: string; logger: PluginLogger }): HookContext {
@@ -123,6 +141,9 @@ export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
123
141
 
124
142
  return {
125
143
  registerAll(pluginName, agentDir, logger, hooks) {
144
+ for (const name of Object.keys(hooks)) {
145
+ if (!Object.hasOwn(r, name)) logger.warn(`Ignoring unknown hook "${name}" (plugin ${pluginName}).`)
146
+ }
126
147
  const base = { pluginName, agentDir, logger }
127
148
  r['tool.before'].push({ pluginName, guardOwner: true, logger })
128
149
  if (hooks['session.start']) r['session.start'].push({ ...base, handler: hooks['session.start'] })
@@ -133,6 +154,12 @@ export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
133
154
  if (hooks['session.turn.end']) r['session.turn.end'].push({ ...base, handler: hooks['session.turn.end'] })
134
155
  if (hooks['tool.before']) r['tool.before'].push({ ...base, handler: hooks['tool.before'] })
135
156
  if (hooks['tool.after']) r['tool.after'].push({ ...base, handler: hooks['tool.after'] })
157
+ if (hooks['channel.message.observed']) {
158
+ r['channel.message.observed'].push({ ...base, handler: hooks['channel.message.observed'] })
159
+ }
160
+ if (hooks['channel.outbound.before']) {
161
+ r['channel.outbound.before'].push({ ...base, handler: hooks['channel.outbound.before'] })
162
+ }
136
163
  },
137
164
 
138
165
  unregisterAll(pluginName) {
@@ -144,6 +171,8 @@ export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
144
171
  r['session.turn.end'] = r['session.turn.end'].filter((h) => h.pluginName !== pluginName)
145
172
  r['tool.before'] = r['tool.before'].filter((h) => h.pluginName !== pluginName)
146
173
  r['tool.after'] = r['tool.after'].filter((h) => h.pluginName !== pluginName)
174
+ r['channel.message.observed'] = r['channel.message.observed'].filter((h) => h.pluginName !== pluginName)
175
+ r['channel.outbound.before'] = r['channel.outbound.before'].filter((h) => h.pluginName !== pluginName)
147
176
  },
148
177
 
149
178
  async runSessionStart(event) {
@@ -231,6 +260,7 @@ export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
231
260
  result = await guard.check(event)
232
261
  } catch (err) {
233
262
  reg.logger.error(`guard ${guard.key} threw: ${err instanceof Error ? err.message : String(err)}`)
263
+ if (guard.skipOnCheckError) continue
234
264
  return { block: true, reason: `guard ${guard.key} failed closed after its check threw` }
235
265
  }
236
266
  if (result === undefined) continue
@@ -266,6 +296,68 @@ export function createHookBus(options: CreateHookBusOptions = {}): HookBus {
266
296
  }
267
297
  },
268
298
 
299
+ runChannelMessageObserved(event) {
300
+ const regs = r['channel.message.observed']
301
+ if (regs.length === 0) return
302
+ let snapshot: ChannelMessageObservedEvent
303
+ try {
304
+ snapshot = deepFreeze(structuredClone(event))
305
+ } catch {
306
+ for (const reg of regs) reportChannelHookFailure(reg, 'channel.message.observed', 'snapshot failed')
307
+ return
308
+ }
309
+ for (const reg of regs) {
310
+ // Capture the registration set at receipt, even if a handler reloads it.
311
+ queueMicrotask(() => {
312
+ void runChannelHandler(
313
+ reg,
314
+ 'channel.message.observed',
315
+ () => reg.handler(snapshot, ctx(reg)),
316
+ observedHandlerTimeoutMs,
317
+ )
318
+ })
319
+ }
320
+ },
321
+
322
+ async runChannelOutboundBefore(event) {
323
+ const regs = r['channel.outbound.before']
324
+ if (regs.length === 0) return { text: event.text }
325
+ let text = event.text
326
+ // Capture registrations before awaiting: a reload/addition belongs to the
327
+ // next logical delivery, not the chain currently being transformed.
328
+ const registrations = regs.slice()
329
+ for (const reg of registrations) {
330
+ const snapshot = Object.freeze({
331
+ ...event,
332
+ text,
333
+ ...(event.origin ? { origin: Object.freeze({ ...event.origin }) } : {}),
334
+ })
335
+ const result = await runChannelHandler(
336
+ reg,
337
+ 'channel.outbound.before',
338
+ () => reg.handler(snapshot, ctx(reg)),
339
+ outboundHandlerTimeoutMs,
340
+ )
341
+ if (result === undefined) continue
342
+ try {
343
+ if (typeof result === 'object' && result !== null) {
344
+ const keys = Reflect.ownKeys(result)
345
+ if (keys.length === 1 && keys[0] === 'text') {
346
+ const replacement = result.text
347
+ if (typeof replacement === 'string' && replacement.trim().length > 0) {
348
+ if (event.text.trim().length > 0) text = replacement
349
+ continue
350
+ }
351
+ }
352
+ }
353
+ } catch {
354
+ // Invalid accessors cannot turn a fail-open transform into a failure.
355
+ }
356
+ reportChannelHookFailure(reg, 'channel.outbound.before', 'invalid result')
357
+ }
358
+ return { text }
359
+ },
360
+
269
361
  count(name) {
270
362
  if (name === 'tool.before') return r[name].filter((entry) => !('guardOwner' in entry)).length
271
363
  return r[name].length
@@ -278,6 +370,51 @@ function reportHookError(reg: { logger: PluginLogger }, hook: keyof Hooks, err:
278
370
  reg.logger.error(`hook ${hook} threw: ${message}`)
279
371
  }
280
372
 
373
+ function reportChannelHookFailure(
374
+ reg: { pluginName: string; logger: PluginLogger },
375
+ hook: 'channel.message.observed' | 'channel.outbound.before',
376
+ kind: string,
377
+ ): void {
378
+ try {
379
+ // Rejected/thrown values may contain message bodies or credentials.
380
+ reg.logger.error(`hook ${hook} ${kind} (plugin ${reg.pluginName})`)
381
+ } catch {
382
+ // Diagnostics must not break routing or fail-open delivery.
383
+ }
384
+ }
385
+
386
+ function runChannelHandler<T>(
387
+ reg: { pluginName: string; logger: PluginLogger },
388
+ hook: 'channel.message.observed' | 'channel.outbound.before',
389
+ invoke: () => T | Promise<T>,
390
+ timeoutMs: number,
391
+ ): Promise<T | undefined> {
392
+ return new Promise((resolve) => {
393
+ let settled = false
394
+ const finish = (value?: T, failure?: string) => {
395
+ if (settled) return
396
+ settled = true
397
+ clearTimeout(timer)
398
+ if (failure) reportChannelHookFailure(reg, hook, failure)
399
+ resolve(value)
400
+ }
401
+ const timer = setTimeout(() => finish(undefined, 'timed out'), timeoutMs)
402
+ Promise.resolve()
403
+ .then(invoke)
404
+ .then(
405
+ (value) => finish(value),
406
+ () => finish(undefined, 'failed'),
407
+ )
408
+ })
409
+ }
410
+
411
+ function deepFreeze<T>(value: T): T {
412
+ if (value === null || typeof value !== 'object' || Object.isFrozen(value)) return value
413
+ Object.freeze(value)
414
+ for (const key of Object.keys(value)) deepFreeze((value as Record<string, unknown>)[key])
415
+ return value
416
+ }
417
+
281
418
  async function raceWithTimeout<T>(work: Promise<T>, ms: number, label: string): Promise<T> {
282
419
  let timer: ReturnType<typeof setTimeout> | null = null
283
420
  const timeout = new Promise<never>((_, reject) => {
@@ -17,6 +17,10 @@ export {
17
17
 
18
18
  export type {
19
19
  BuiltinToolRef,
20
+ ChannelMessageObservedEvent,
21
+ ChannelOutboundBeforeEvent,
22
+ ChannelOutboundBeforeResult,
23
+ ChannelOutboundOrigin,
20
24
  CommandExecResult,
21
25
  CommandStreams,
22
26
  ContainerCommand,
@@ -54,6 +58,7 @@ export type {
54
58
  SessionTurnEndEvent,
55
59
  SessionTurnStartEvent,
56
60
  SpawnSubagentOptions,
61
+ SlackObservedMessage,
57
62
  Subagent,
58
63
  SubagentContext,
59
64
  Tool,
@@ -99,3 +104,4 @@ export {
99
104
  type RegisteredTool,
100
105
  } from './registry'
101
106
  export { createHookBus, type HookBus } from './hooks'
107
+ export { createSubagentSessionManager } from '@/agent/subagent-session'
@@ -37,6 +37,7 @@ export type LoadPluginsOptions = {
37
37
  resolveGithubTokenForRepo?: ResolveGithubTokenForRepo
38
38
  hasGithubAppTokenResolver?: () => boolean
39
39
  getGithubAppSelfLogin?: () => string | null
40
+ resolveGithubPatForRepo?: ResolveGithubTokenForRepo
40
41
  // Bundled plugins resolved by the runtime (not from typeclaw.json). Loaded
41
42
  // before user-declared `entries` so a config block named after a bundled
42
43
  // plugin (e.g. "memory") is consumed by the bundled plugin, and so plugin-
@@ -129,6 +130,7 @@ export async function loadPlugins(opts: LoadPluginsOptions): Promise<LoadPlugins
129
130
  resolveGithubTokenForRepo: opts.resolveGithubTokenForRepo,
130
131
  hasGithubAppTokenResolver: opts.hasGithubAppTokenResolver,
131
132
  getGithubAppSelfLogin: opts.getGithubAppSelfLogin,
133
+ resolveGithubPatForRepo: opts.resolveGithubPatForRepo,
132
134
  spawnSubagent: (name, payload, options) => spawnSubagentImpl(name, payload, options),
133
135
  isBooted: () => booted,
134
136
  },
@@ -245,6 +247,7 @@ type RegisterOnePluginArgs = {
245
247
  resolveGithubTokenForRepo?: ResolveGithubTokenForRepo
246
248
  hasGithubAppTokenResolver?: () => boolean
247
249
  getGithubAppSelfLogin?: () => string | null
250
+ resolveGithubPatForRepo?: ResolveGithubTokenForRepo
248
251
  spawnSubagent: SpawnSubagentFn
249
252
  isBooted: () => boolean
250
253
  }
@@ -277,6 +280,7 @@ async function registerOnePlugin(args: RegisterOnePluginArgs): Promise<void> {
277
280
  resolveGithubTokenForRepo: args.ctxDeps.resolveGithubTokenForRepo,
278
281
  hasGithubAppTokenResolver: args.ctxDeps.hasGithubAppTokenResolver,
279
282
  getGithubAppSelfLogin: args.ctxDeps.getGithubAppSelfLogin,
283
+ resolveGithubPatForRepo: args.ctxDeps.resolveGithubPatForRepo,
280
284
  spawnSubagent: args.ctxDeps.spawnSubagent,
281
285
  isBooted: args.ctxDeps.isBooted,
282
286
  })
@@ -73,6 +73,9 @@ export type RunSession = (override?: {
73
73
  export type Subagent<P = unknown> = SubagentShared<P> & {
74
74
  tools?: BuiltinToolRef[]
75
75
  customTools?: Tool<any>[]
76
+ // Trusted plugin declaration, never a model payload or per-call override.
77
+ // Raw source readers use in-memory sessions rather than persisted transcripts.
78
+ ephemeral?: boolean
76
79
  }
77
80
 
78
81
  // Cron job map keys are local; the runtime prefixes with `__plugin_<plugin-name>_`
@@ -253,6 +256,57 @@ export type HookContext = {
253
256
  logger: PluginLogger
254
257
  }
255
258
 
259
+ // Raw Socket Mode message deliveries, not the router's admitted/wake events.
260
+ // Edits, deletes, self/bot messages and duplicates are intentionally included.
261
+ export type SlackObservedMessage = {
262
+ readonly type: 'message'
263
+ readonly channel: string
264
+ readonly ts?: string
265
+ readonly subtype?: string
266
+ readonly text?: string
267
+ readonly user?: string
268
+ readonly thread_ts?: string
269
+ readonly event_ts?: string
270
+ readonly deleted_ts?: string
271
+ readonly message?: Readonly<Record<string, unknown>>
272
+ readonly previous_message?: Readonly<Record<string, unknown>>
273
+ readonly [key: string]: unknown
274
+ }
275
+
276
+ // Deep-frozen snapshot after transport ack, before classification/deduplication.
277
+ // Observe-only and best-effort: never awaited by routing, never starts a session.
278
+ // This is a Slack-bot capability, not a cross-adapter or durable event journal.
279
+ export type ChannelMessageObservedEvent = {
280
+ readonly adapter: 'slack-bot'
281
+ readonly workspace: string | null
282
+ readonly selfUserId: string | null
283
+ readonly receivedAt: number
284
+ readonly event: SlackObservedMessage
285
+ }
286
+
287
+ // Last-mile text transform for trusted, in-process plugins; not a delivery gate.
288
+ // Only text can be replaced. Invalid/empty results, errors and timeouts retain
289
+ // the previous text. An attachment-only send cannot acquire a caption.
290
+ export type ChannelOutboundOrigin = {
291
+ readonly kind: SessionOrigin['kind']
292
+ readonly jobId?: string
293
+ }
294
+
295
+ export type ChannelOutboundBeforeEvent = {
296
+ readonly adapter: string
297
+ readonly workspace: string
298
+ readonly chat: string
299
+ readonly thread?: string
300
+ readonly text: string
301
+ readonly op: 'send' | 'edit'
302
+ readonly messageId?: string
303
+ readonly source: 'tool' | 'system'
304
+ readonly outputKind?: 'substantive' | 'status' | 'meta'
305
+ readonly origin?: ChannelOutboundOrigin
306
+ }
307
+
308
+ export type ChannelOutboundBeforeResult = { text: string } | undefined
309
+
256
310
  export type Hooks = {
257
311
  'session.start'?: (event: SessionStartEvent, ctx: HookContext) => Promise<void> | void
258
312
  'session.end'?: (event: SessionEndEvent, ctx: HookContext) => Promise<void> | void
@@ -262,6 +316,11 @@ export type Hooks = {
262
316
  'session.turn.end'?: (event: SessionTurnEndEvent, ctx: HookContext) => Promise<void> | void
263
317
  'tool.before'?: (event: ToolBeforeEvent, ctx: HookContext) => Promise<ToolBeforeResult> | ToolBeforeResult
264
318
  'tool.after'?: (event: ToolAfterEvent, ctx: HookContext) => Promise<void> | void
319
+ 'channel.message.observed'?: (event: ChannelMessageObservedEvent, ctx: HookContext) => Promise<void> | void
320
+ 'channel.outbound.before'?: (
321
+ event: ChannelOutboundBeforeEvent,
322
+ ctx: HookContext,
323
+ ) => Promise<ChannelOutboundBeforeResult> | ChannelOutboundBeforeResult
265
324
  }
266
325
 
267
326
  export type HookName = keyof Hooks
@@ -310,6 +369,7 @@ export type PluginGithubServices = {
310
369
  resolveTokenForRepo: ResolveGithubTokenForRepo
311
370
  hasAppTokenResolver: () => boolean
312
371
  getAppSelfLogin?: () => string | null
372
+ resolvePatForRepo?: ResolveGithubTokenForRepo
313
373
  }
314
374
 
315
375
  export type PluginExports = {
@@ -1,13 +1,16 @@
1
1
  import agentBrowserPlugin from '@/bundled-plugins/agent-browser'
2
2
  import backupPlugin from '@/bundled-plugins/backup'
3
+ import browserAgentPlugin from '@/bundled-plugins/browser-agent'
3
4
  import bunHygienePlugin from '@/bundled-plugins/bun-hygiene'
4
5
  import docRenderPlugin from '@/bundled-plugins/doc-render'
5
6
  import explorerPlugin from '@/bundled-plugins/explorer'
6
7
  import githubCliAuthPlugin from '@/bundled-plugins/github-cli-auth'
7
8
  import guardPlugin from '@/bundled-plugins/guard'
9
+ import browserPlugin from '@/bundled-plugins/managed-browser'
8
10
  import memoryPlugin from '@/bundled-plugins/memory'
9
11
  import operatorPlugin from '@/bundled-plugins/operator'
10
12
  import plannerPlugin from '@/bundled-plugins/planner'
13
+ import qaPlugin from '@/bundled-plugins/qa'
11
14
  import researcherPlugin from '@/bundled-plugins/researcher'
12
15
  import reviewerPlugin from '@/bundled-plugins/reviewer'
13
16
  import scoutPlugin from '@/bundled-plugins/scout'
@@ -59,10 +62,13 @@ export const BUNDLED_PLUGINS: ResolvedPlugin[] = [
59
62
  { name: 'memory', version: undefined, source: '<bundled>', defined: memoryPlugin },
60
63
  { name: 'backup', version: undefined, source: '<bundled>', defined: backupPlugin },
61
64
  { name: 'agent-browser', version: undefined, source: '<bundled>', defined: agentBrowserPlugin },
65
+ { name: 'managed-browser', version: undefined, source: '<bundled>', defined: browserPlugin },
62
66
  { name: 'doc-render', version: undefined, source: '<bundled>', defined: docRenderPlugin },
63
67
  { name: 'explorer', version: undefined, source: '<bundled>', defined: explorerPlugin },
68
+ { name: 'browser-agent', version: undefined, source: '<bundled>', defined: browserAgentPlugin },
64
69
  { name: 'scout', version: undefined, source: '<bundled>', defined: scoutPlugin },
65
70
  { name: 'reviewer', version: undefined, source: '<bundled>', defined: reviewerPlugin },
71
+ { name: 'qa', version: undefined, source: '<bundled>', defined: qaPlugin },
66
72
  { name: 'researcher', version: undefined, source: '<bundled>', defined: researcherPlugin },
67
73
  { name: 'planner', version: undefined, source: '<bundled>', defined: plannerPlugin },
68
74
  { name: 'operator', version: undefined, source: '<bundled>', defined: operatorPlugin },
package/src/run/index.ts CHANGED
@@ -9,6 +9,7 @@ import { LiveSubagentRegistry, newestRunningBackgroundChildStartedAt } from '@/a
9
9
  import { requestContainerRestart } from '@/agent/restart'
10
10
  import { sessionMetaPayload } from '@/agent/session-meta'
11
11
  import type { SessionOrigin } from '@/agent/session-origin'
12
+ import { createSubagentSessionManager } from '@/agent/subagent-session'
12
13
  import {
13
14
  awaitWithSubagentTimeout,
14
15
  createSubagentConsumer,
@@ -317,6 +318,7 @@ async function startAgentRuntime(
317
318
  resolveGithubTokenForRepo: githubTokenBridge.resolveTokenForRepo,
318
319
  hasGithubAppTokenResolver: githubTokenBridge.hasAppTokenResolver,
319
320
  getGithubAppSelfLogin: githubTokenBridge.getAppSelfLogin,
321
+ resolveGithubPatForRepo: githubTokenBridge.resolvePatForRepo,
320
322
  ...(cwdConfig.roles !== undefined ? { roles: cwdConfig.roles } : {}),
321
323
  })
322
324
  // Emit the container's fixed resource limits BEFORE vector startup. The
@@ -430,7 +432,7 @@ async function startAgentRuntime(
430
432
  })
431
433
  if (githubCliExport.action === 'failed') {
432
434
  console.warn(
433
- '[run] trusted GitHub CLI store unavailable; store-backed GitHub pushes will not authenticate. ' +
435
+ '[run] trusted GitHub CLI store unavailable; brokered `gh` commands will not authenticate. ' +
434
436
  'On the host, run `gh auth login --hostname github.com`, then run a real `typeclaw restart`.',
435
437
  )
436
438
  }
@@ -482,6 +484,14 @@ async function startAgentRuntime(
482
484
  onRecoveryReady: () => {
483
485
  void recoveryDispatcher?.wake().catch((error) => console.warn(`[run] recovery wake failed: ${error}`))
484
486
  },
487
+ // Resolve the live bus at delivery time so plugin reloads take effect
488
+ // without rebuilding adapters, and no subscribers means no snapshot work.
489
+ slackBotMessageObserver: {
490
+ active: () => pluginRuntime.get().hooks.count('channel.message.observed') > 0,
491
+ observe: (event) => pluginRuntime.get().hooks.runChannelMessageObserved(event),
492
+ },
493
+ outboundReviewer: (event) => pluginRuntime.get().hooks.runChannelOutboundBefore(event),
494
+ outboundReviewerActive: () => pluginRuntime.get().hooks.count('channel.outbound.before') > 0,
485
495
  tunnelUrlForChannel: (name) => resolveTunnelUrlForChannel(name, tunnelManager),
486
496
  tunnelConfiguredForChannel: (name) => isTunnelConfiguredForChannel(name),
487
497
  createSessionForChannel: buildChannelSessionFactory({
@@ -557,7 +567,11 @@ async function startAgentRuntime(
557
567
  const snap = pluginRuntime.get()
558
568
  const entry = snap.pluginSubagentByShim.get(subagent)
559
569
  if (entry) {
560
- const sessionManager = SessionManager.create(cwd, sessionFactory.sessionDir())
570
+ const sessionManager = createSubagentSessionManager(
571
+ cwd,
572
+ sessionFactory.sessionDir(),
573
+ entry.pluginSubagent.ephemeral,
574
+ )
561
575
  const sessionId = sessionManager.getSessionId()
562
576
  const origin: SessionOrigin = {
563
577
  kind: 'subagent' as const,
@@ -605,6 +619,9 @@ async function startAgentRuntime(
605
619
  ...(resolveSubagentProfile(entry.pluginSubagent, subagentOptions) !== undefined
606
620
  ? { profile: resolveSubagentProfile(entry.pluginSubagent, subagentOptions) }
607
621
  : {}),
622
+ ...(entry.pluginSubagent.thinkingLevel !== undefined
623
+ ? { thinkingLevel: entry.pluginSubagent.thinkingLevel }
624
+ : {}),
608
625
  ...(entry.pluginSubagent.toolResultBudget !== undefined
609
626
  ? { toolResultBudget: entry.pluginSubagent.toolResultBudget }
610
627
  : {}),
@@ -1350,6 +1367,7 @@ type PluginOnlySubagentKeys = Exclude<keyof import('@/plugin').Subagent<any>, ke
1350
1367
  const PLUGIN_ONLY_KEYS_DROPPED_BY_SHIM = {
1351
1368
  tools: true,
1352
1369
  customTools: true,
1370
+ ephemeral: true,
1353
1371
  } satisfies Record<PluginOnlySubagentKeys, true>
1354
1372
  // Reference the table so it's not dead code. The value is a runtime no-op;
1355
1373
  // the load-bearing work is the `satisfies` clause above which forces
@@ -1357,17 +1375,9 @@ const PLUGIN_ONLY_KEYS_DROPPED_BY_SHIM = {
1357
1375
  void PLUGIN_ONLY_KEYS_DROPPED_BY_SHIM
1358
1376
 
1359
1377
  function pluginSubagentShim(subagent: import('@/plugin').Subagent<any>): InternalSubagent<any> {
1360
- // The two diverging fields (`tools` is `BuiltinToolRef[]` plugin-side vs
1361
- // `AgentSessionTools` internal-side; `customTools` similarly differs) are
1362
- // resolved later in `createSessionForSubagent` via the
1363
- // `pluginSubagentByShim` lookup, which recovers the original plugin
1364
- // reference. Every other plugin-side field lives on `SubagentShared` and is structurally
1365
- // assignable to the internal `Subagent`, so a rest-spread carries them
1366
- // verbatim — including `visibility` and `requiresSpecificPermission`,
1367
- // whose silent drop in the previous shim made every plugin-contributed
1368
- // public subagent (scout, explorer, operator) invisible to the
1369
- // `spawn_subagent` tool. The list of keys removed here is enforced
1370
- // exhaustive at compile time by `PLUGIN_ONLY_KEYS_DROPPED_BY_SHIM` above.
1371
- const { tools: _tools, customTools: _customTools, ...shared } = subagent
1378
+ // Plugin-only tools and transcript persistence are resolved by the native
1379
+ // factory through pluginSubagentByShim, which retains the original declaration.
1380
+ // The internal registry shim carries only the shared scheduling/role contract.
1381
+ const { tools: _tools, customTools: _customTools, ephemeral: _ephemeral, ...shared } = subagent
1372
1382
  return shared
1373
1383
  }