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
@@ -14,6 +14,46 @@ const sessionSchema = z.object({
14
14
  cwd: z.string(),
15
15
  })
16
16
 
17
+ // OmO print mode emits one `message_update` record per streamed token, each
18
+ // repeating a full usage object (~100x amplification over the model output).
19
+ // The parser ignores them, so they are dropped before the output cap and the
20
+ // JSONL artifact; a single long tool call otherwise trips the cap mid-task.
21
+ export class OmoDeltaFilter {
22
+ private pending = ''
23
+
24
+ push(text: string): string {
25
+ this.pending += text
26
+ const end = this.pending.lastIndexOf('\n')
27
+ if (end === -1) {
28
+ if (this.pending.length > 4 * 1024 * 1024) throw new Error('OmO event exceeds the 4 MiB event limit.')
29
+ return ''
30
+ }
31
+ const lines = this.pending.slice(0, end + 1)
32
+ this.pending = this.pending.slice(end + 1)
33
+ return lines
34
+ .split('\n')
35
+ .slice(0, -1)
36
+ .filter((line) => !isMessageUpdate(line))
37
+ .map((line) => `${line}\n`)
38
+ .join('')
39
+ }
40
+
41
+ flush(): string {
42
+ const rest = this.pending
43
+ this.pending = ''
44
+ return rest
45
+ }
46
+ }
47
+
48
+ function isMessageUpdate(line: string): boolean {
49
+ if (!line.startsWith('{"type":"message_update"')) return false
50
+ try {
51
+ return (JSON.parse(line) as { type?: unknown }).type === 'message_update'
52
+ } catch {
53
+ return false
54
+ }
55
+ }
56
+
17
57
  export class OmoStreamParser {
18
58
  sessionId: string | undefined
19
59
  finalMessage = ''
@@ -12,9 +12,11 @@ import { ClaudeStreamParser, claudeArguments, claudeEnvironment, type CodingMode
12
12
  import { CodexStreamParser, codexArguments, codexConfig, codexEnvironment } from './codex'
13
13
  import { omoArguments, omoConfiguration, omoEnvironment, type OmoModel } from './omo'
14
14
  import { hasOmoSession, prepareOmoDirectories } from './omo-state'
15
- import { OmoStreamParser } from './omo-stream'
15
+ import { OmoDeltaFilter, OmoStreamParser } from './omo-stream'
16
16
  import type { CodingWorkspace } from './worktree'
17
17
 
18
+ const OUTPUT_LIMIT_BYTES = 16 * 1024 * 1024
19
+
18
20
  export type CodingRunResult = {
19
21
  readonly state: 'completed' | 'incomplete' | 'failed' | 'cancelled'
20
22
  readonly finalMessage: string
@@ -70,6 +72,8 @@ export async function runCodingAgent(
70
72
  let exitCode: number | null = null
71
73
  let failure = false
72
74
  let missingSession = false
75
+ let outputCapExceeded = false
76
+ let deadlineExpired = false
73
77
  const oom = readOomEvents()
74
78
  try {
75
79
  signal.throwIfAborted()
@@ -160,16 +164,20 @@ export async function runCodingAgent(
160
164
  const consume = async (stream: NodeJS.ReadableStream, output: boolean): Promise<void> => {
161
165
  const decoder = new TextDecoder()
162
166
  const scrubber = new SecretScrubber([broker?.capability ?? ''])
167
+ const deltas = output && engine === 'omo' ? new OmoDeltaFilter() : undefined
163
168
  let total = 0
164
169
  for await (const chunk of stream) {
170
+ if (outputCapExceeded) continue
165
171
  const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk))
166
- total += bytes.length
167
- if (total > 16 * 1024 * 1024) {
172
+ const scrubbed = scrubber.push(decoder.decode(bytes, { stream: true }))
173
+ const text = deltas ? deltas.push(scrubbed) : scrubbed
174
+ total += Buffer.byteLength(text)
175
+ if (total > OUTPUT_LIMIT_BYTES) {
176
+ outputCapExceeded = true
168
177
  failure = true
169
178
  kill()
170
179
  continue
171
180
  }
172
- const text = scrubber.push(decoder.decode(bytes, { stream: true }))
173
181
  if (output) {
174
182
  stdout += text
175
183
  try {
@@ -180,7 +188,15 @@ export async function runCodingAgent(
180
188
  }
181
189
  } else stderr += text
182
190
  }
183
- const final = scrubber.push(decoder.decode(), true)
191
+ const flushed = scrubber.push(decoder.decode(), true)
192
+ const final = deltas ? deltas.push(flushed) + deltas.flush() : flushed
193
+ if (outputCapExceeded) return
194
+ total += Buffer.byteLength(final)
195
+ if (total > OUTPUT_LIMIT_BYTES) {
196
+ outputCapExceeded = true
197
+ failure = true
198
+ return
199
+ }
184
200
  if (output) {
185
201
  stdout += final
186
202
  stdoutTail = final
@@ -222,6 +238,9 @@ export async function runCodingAgent(
222
238
  } catch {
223
239
  failure = true
224
240
  } finally {
241
+ // The broker can reject an expired capability before the event loop
242
+ // delivers our timeout callback. The deadline, not callback order, wins.
243
+ deadlineExpired = Date.now() >= deadline
225
244
  clearTimeout(timer)
226
245
  await broker?.close()
227
246
  await cleanupPrepared?.()
@@ -231,6 +250,7 @@ export async function runCodingAgent(
231
250
  await options.writeArtifact(join(options.workspace.taskRoot, 'output', `${invocation}.stderr`), stderr)
232
251
  const timedOut =
233
252
  timeout.signal.aborted ||
253
+ deadlineExpired ||
234
254
  (options.signal?.reason instanceof DOMException && options.signal.reason.name === 'TimeoutError')
235
255
  const state = timedOut
236
256
  ? 'incomplete'
@@ -256,8 +276,10 @@ export async function runCodingAgent(
256
276
  ? 'The recorded OmO session is missing or unsafe. Restore its task-local session file before resuming; partial work is preserved.'
257
277
  : timedOut
258
278
  ? 'Invocation timed out; partial work is preserved.'
259
- : parser.permissionDenied
260
- ? 'The coding CLI reported a permission denial; review the task and continue explicitly.'
261
- : 'Invocation did not complete. Inspect the saved output and partial diff; verify the installed CLI and sandbox.'),
279
+ : outputCapExceeded
280
+ ? 'The coding CLI exceeded the 16 MiB output limit and was stopped; partial work is preserved. Resume with a narrower prompt.'
281
+ : parser.permissionDenied
282
+ ? 'The coding CLI reported a permission denial; review the task and continue explicitly.'
283
+ : 'Invocation did not complete. Inspect the saved output and partial diff; verify the installed CLI and sandbox.'),
262
284
  }
263
285
  }
@@ -6,8 +6,10 @@ import type { KnownApi, Model } from '@earendil-works/pi-ai'
6
6
  import { getBuiltinModel } from '@earendil-works/pi-ai/providers/all'
7
7
  import { z } from 'zod'
8
8
 
9
+ import { BROWSER_ENGINE_IDS, BROWSER_EXTENSION_IDS } from '@/browser/registry'
9
10
  import { channelsSchema, SEEDED_GITHUB_EVENT_ALLOWLISTS } from '@/channels/schema'
10
11
  import { commitSystemFileSync } from '@/git/system-commit'
12
+ import { parseMatchRule } from '@/permissions/match-rule'
11
13
  import { rolesConfigSchema } from '@/permissions/schema'
12
14
  import { secretFieldSchema } from '@/secrets/resolve'
13
15
 
@@ -197,7 +199,7 @@ const dockerfileObjectSchema = z.object({
197
199
  tmux: dockerfileFeatureSchema.default(true),
198
200
  // `fonts-noto-cjk` is an ~89MB metapackage that makes Chromium render
199
201
  // Korean/Japanese/Chinese glyphs correctly in screenshots, `page.pdf()`,
200
- // and any other raster output the agent-browser plugin produces. Without
202
+ // and any other raster output a browser engine produces. Without
201
203
  // it CJK text renders as silent tofu boxes (□□□) — a confusing failure an
202
204
  // agent cannot self-diagnose from a screenshot it took itself.
203
205
  //
@@ -220,7 +222,7 @@ const dockerfileObjectSchema = z.object({
220
222
  cloudflared: z.boolean().default(false),
221
223
  // Install xvfb so the entrypoint shim can spawn an Xvfb virtual X
222
224
  // server and export DISPLAY, giving headed Chrome (agent-browser
223
- // --headed, Playwright headful) a real X11 display to connect to.
225
+ // --headed, the managed shared browser, Playwright headful) a real X11 display to connect to.
224
226
  // Default `true` because modern bot detection (Akamai/Cloudflare Bot
225
227
  // Manager) fingerprints `--headless` and `--headless=new` regardless
226
228
  // of UA spoof, and headed-via-Xvfb is the cheapest path to a passing
@@ -252,6 +254,22 @@ const dockerfileObjectSchema = z.object({
252
254
 
253
255
  export const dockerfileSchema = dockerfileObjectSchema.default(() => dockerfileObjectSchema.parse({}))
254
256
 
257
+ // Which browser drivers the agent gets and which extensions load into the
258
+ // TypeClaw-managed Chrome. Restart-required: engines and extensions install
259
+ // image layers and the managed browser is spawned at boot.
260
+ const browserObjectSchema = z.object({
261
+ engines: z
262
+ .array(z.enum(BROWSER_ENGINE_IDS))
263
+ .default(['agent-browser'])
264
+ .refine((ids) => new Set(ids).size === ids.length, { message: 'browser.engines must not repeat an engine' }),
265
+ extensions: z
266
+ .array(z.enum(BROWSER_EXTENSION_IDS))
267
+ .default([])
268
+ .refine((ids) => new Set(ids).size === ids.length, { message: 'browser.extensions must not repeat an extension' }),
269
+ })
270
+
271
+ export const browserSchema = browserObjectSchema.default(() => browserObjectSchema.parse({}))
272
+
255
273
  export type DockerfileConfig = z.infer<typeof dockerfileSchema>
256
274
  export type DockerfileFeatureToggle = z.infer<typeof dockerfileFeatureSchema>
257
275
 
@@ -291,6 +309,17 @@ export const gitSchema = z
291
309
 
292
310
  export type GitConfig = z.infer<typeof gitSchema>
293
311
 
312
+ // Off by default: the host operator's `gh` login is the operator's identity, not
313
+ // the agent's. Copying it unconditionally handed every agent on a shared host the
314
+ // operator's personal GitHub token, so an agent only receives it on explicit opt-in.
315
+ const githubCliObjectSchema = z.object({
316
+ importHostAuth: z.boolean().default(false),
317
+ })
318
+
319
+ export const githubCliSchema = githubCliObjectSchema.default(() => githubCliObjectSchema.parse({}))
320
+
321
+ export type GithubCliConfig = z.infer<typeof githubCliSchema>
322
+
294
323
  export const DEFAULT_LOG_RETENTION_DAYS = 14
295
324
  export const MAX_LOG_RETENTION_DAYS = 3650
296
325
 
@@ -718,17 +747,19 @@ const richProfileSchema = z
718
747
  }
719
748
  })
720
749
 
721
- const profileEntrySchema = z
722
- .union([singleModelRef, modelChainInputSchema, richProfileSchema])
723
- .transform((value): ProfileEntry => {
724
- if (typeof value === 'string' || Array.isArray(value)) {
725
- const refs = (Array.isArray(value) ? value : [value]).map((ref) => asModelRef(ref))
726
- return { refs }
727
- }
728
- const refsInput = value.models ?? value.model!
729
- const refs = (Array.isArray(refsInput) ? refsInput : [refsInput]).map((ref) => asModelRef(ref))
730
- return value.thinkingLevel === undefined ? { refs } : { refs, thinkingLevel: value.thinkingLevel }
731
- })
750
+ const profileEntryInputSchema = z.union([singleModelRef, modelChainInputSchema, richProfileSchema])
751
+ const profileEntrySchema: z.ZodType<
752
+ ProfileEntry,
753
+ z.input<typeof profileEntryInputSchema>
754
+ > = profileEntryInputSchema.transform((value): ProfileEntry => {
755
+ if (typeof value === 'string' || Array.isArray(value)) {
756
+ const refs = (Array.isArray(value) ? value : [value]).map((ref) => asModelRef(ref))
757
+ return { refs }
758
+ }
759
+ const refsInput = value.models ?? value.model!
760
+ const refs = (Array.isArray(refsInput) ? refsInput : [refsInput]).map((ref) => asModelRef(ref))
761
+ return value.thinkingLevel === undefined ? { refs } : { refs, thinkingLevel: value.thinkingLevel }
762
+ })
732
763
 
733
764
  // Built-in per-profile `thinkingLevel` defaults, materialized at parse time so
734
765
  // resolved config / `typeclaw model list` / prompt dumps show the effective level
@@ -747,17 +778,60 @@ export const modelsSchema = z
747
778
  .record(z.string().min(1), profileEntrySchema)
748
779
  .refine((m) => 'default' in m, { message: 'models.default is required' })
749
780
  // Fill only when unset, so an explicit level (including `off`) always wins.
750
- .transform((models): Models => {
751
- let next: Record<string, ProfileEntry> | undefined
752
- for (const [profile, thinkingLevel] of Object.entries(PROFILE_THINKING_LEVEL_DEFAULTS)) {
753
- const entry = models[profile]
754
- if (entry !== undefined && entry.thinkingLevel === undefined) {
755
- next ??= { ...models }
756
- next[profile] = { ...entry, thinkingLevel }
757
- }
781
+ .transform((models): Models => withProfileThinkingDefaults(models) as Models)
782
+
783
+ function withProfileThinkingDefaults(models: Record<string, ProfileEntry>): Record<string, ProfileEntry> {
784
+ let next: Record<string, ProfileEntry> | undefined
785
+ for (const [profile, thinkingLevel] of Object.entries(PROFILE_THINKING_LEVEL_DEFAULTS)) {
786
+ const entry = models[profile]
787
+ if (entry !== undefined && entry.thinkingLevel === undefined) {
788
+ next ??= { ...models }
789
+ next[profile] = { ...entry, thinkingLevel }
758
790
  }
759
- return (next ?? models) as Models
791
+ }
792
+ return next ?? models
793
+ }
794
+
795
+ // Why `rule` can't scope a `modelOverrides` entry, or undefined when it can.
796
+ // Rules use the roles match-rule DSL, limited to channel scopes: `author:` is
797
+ // rejected because a session keeps one model for every author of a shared chat.
798
+ export function modelOverrideRuleError(rule: string): string | undefined {
799
+ const parsed = parseMatchRule(rule)
800
+ if (!parsed.ok) return parsed.error
801
+ if (parsed.value.kind === 'wildcard') return undefined
802
+ if (parsed.value.kind !== 'channel') {
803
+ return 'only channel rules (e.g. `slack:*`, `slack:T0123/C0123`, `*`) are allowed'
804
+ }
805
+ if (parsed.value.author !== undefined) return '`author:` is not supported; a session keeps one model for every author'
806
+ return undefined
807
+ }
808
+
809
+ // `modelOverrides` layers partial `models` blocks over the global one for the
810
+ // chats each entry's `match` covers, mirroring `roles.<name> = { match, ... }`.
811
+ // Per profile, the most specific matching rule wins (see `effectiveModels`);
812
+ // profiles an entry doesn't define fall through to `models`.
813
+ const modelOverrideSchema = z
814
+ .object({
815
+ match: z
816
+ .array(z.string())
817
+ .min(1, { message: 'match must list at least one rule (use "*" for every channel)' })
818
+ .superRefine((rules, ctx) => {
819
+ rules.forEach((rule, index) => {
820
+ const error = modelOverrideRuleError(rule)
821
+ if (error !== undefined)
822
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: [index], message: `"${rule}": ${error}` })
823
+ })
824
+ }),
825
+ models: z
826
+ .record(z.string().min(1), profileEntrySchema)
827
+ .refine((m) => Object.keys(m).length > 0, { message: 'models must define at least one profile' })
828
+ .transform(withProfileThinkingDefaults),
760
829
  })
830
+ .strict()
831
+
832
+ export type ModelOverride = z.infer<typeof modelOverrideSchema>
833
+
834
+ export const modelOverridesSchema = z.record(z.string().min(1), modelOverrideSchema).default({})
761
835
 
762
836
  // A model profile after normalisation: its fallback chain (always non-empty)
763
837
  // plus an optional reasoning effort. `thinkingLevel` resolution is layered at
@@ -786,10 +860,15 @@ export const configSchema = z
786
860
  default: { refs: [asModelRef(DEFAULT_MODEL_REF)] },
787
861
  })) as unknown as z.ZodType<Models>,
788
862
  customModels: customModelsSchema,
863
+ modelOverrides: modelOverridesSchema,
789
864
  // Defaults to `[]` so the field can be omitted from `typeclaw.json` (no
790
865
  // host paths exposed) without failing the whole config load. `typeclaw
791
866
  // init` omits this field so users don't see noise for the empty case.
792
867
  mounts: z.array(mountSchema).default([]),
868
+ // Read-only bind mounts of the host's user-installed font folders under
869
+ // the container's `/usr/share/fonts`, so fontconfig (and Chromium-rendered
870
+ // PDFs) picks them up with no setup. Off by default.
871
+ hostFonts: z.boolean().default(false),
793
872
  mcpServers: mcpServersArraySchema,
794
873
  plugins: z.array(z.string().min(1)).default([]),
795
874
  // Additional names the agent answers to in channel engagement, on top
@@ -806,7 +885,9 @@ export const configSchema = z
806
885
  network: networkSchema,
807
886
  sandbox: sandboxSchema,
808
887
  docker: dockerSchema,
888
+ browser: browserSchema,
809
889
  git: gitSchema,
890
+ githubCli: githubCliSchema,
810
891
  logs: logsSchema,
811
892
  roles: rolesConfigSchema.optional(),
812
893
  tunnels: tunnelsArraySchema,
@@ -1069,9 +1150,11 @@ export type FieldEffect = 'applied' | 'restart-required' | 'ignored'
1069
1150
  export const FIELD_EFFECTS: Record<string, FieldEffect> = {
1070
1151
  $schema: 'ignored',
1071
1152
  models: 'applied',
1153
+ modelOverrides: 'applied',
1072
1154
  customModels: 'applied',
1073
1155
  port: 'restart-required',
1074
1156
  mounts: 'restart-required',
1157
+ hostFonts: 'restart-required',
1075
1158
  mcpServers: 'restart-required',
1076
1159
  plugins: 'restart-required',
1077
1160
  alias: 'applied',
@@ -1083,7 +1166,9 @@ export const FIELD_EFFECTS: Record<string, FieldEffect> = {
1083
1166
  sandbox: 'restart-required',
1084
1167
  tunnels: 'restart-required',
1085
1168
  'docker.file': 'restart-required', // Includes omoCli; installation changes rebuild the image.
1169
+ browser: 'restart-required',
1086
1170
  'git.ignore': 'restart-required',
1171
+ githubCli: 'restart-required',
1087
1172
  logs: 'ignored',
1088
1173
  // Split: `match` lists are reload-safe (typeclaw role claim, hand-edits
1089
1174
  // adding/removing match rules apply without a container restart);
@@ -1166,10 +1251,13 @@ export function extractPluginConfigs(raw: unknown): Record<string, unknown> {
1166
1251
  if (typeof raw !== 'object' || raw === null) return {}
1167
1252
  const known = new Set([
1168
1253
  '$schema',
1254
+ 'browser',
1169
1255
  'port',
1170
1256
  'models',
1257
+ 'modelOverrides',
1171
1258
  'customModels',
1172
1259
  'mounts',
1260
+ 'hostFonts',
1173
1261
  'plugins',
1174
1262
  'alias',
1175
1263
  'compose',
@@ -1179,6 +1267,7 @@ export function extractPluginConfigs(raw: unknown): Record<string, unknown> {
1179
1267
  'network',
1180
1268
  'docker',
1181
1269
  'git',
1270
+ 'githubCli',
1182
1271
  'logs',
1183
1272
  'roles',
1184
1273
  'permissions',
@@ -0,0 +1,59 @@
1
+ import type { SessionOrigin } from '@/agent/session-origin'
2
+ import { parseMatchRule, type MatchRule } from '@/permissions/match-rule'
3
+ import { matchesOrigin } from '@/permissions/resolve'
4
+
5
+ import type { Config, Models, ProfileEntry } from './config'
6
+
7
+ type ChannelOrigin = Extract<SessionOrigin, { kind: 'channel' }>
8
+
9
+ // The `models` map a session resolves profiles against: the global block with
10
+ // every matching `modelOverrides` entry layered on top. Per profile, the most
11
+ // specific matching rule wins (chat > workspace/bucket > platform > `*`), the
12
+ // later-declared entry on a tie; profiles no matching entry defines keep their
13
+ // global value. Subagents use the channel that (transitively) spawned them, so a
14
+ // chat's `fast`/`deep` also apply to its workers. TUI and cron stay global.
15
+ export function effectiveModels(
16
+ cfg: Pick<Config, 'models' | 'modelOverrides'>,
17
+ origin: SessionOrigin | undefined,
18
+ ): Models {
19
+ const channel = channelOf(origin)
20
+ if (channel === undefined) return cfg.models
21
+ const winners = new Map<string, { entry: ProfileEntry; specificity: number }>()
22
+ for (const override of Object.values(cfg.modelOverrides)) {
23
+ const specificity = matchSpecificity(override.match, channel)
24
+ if (specificity === undefined) continue
25
+ for (const [profile, entry] of Object.entries(override.models)) {
26
+ const current = winners.get(profile)
27
+ if (current === undefined || specificity >= current.specificity) winners.set(profile, { entry, specificity })
28
+ }
29
+ }
30
+ if (winners.size === 0) return cfg.models
31
+ const merged: Record<string, ProfileEntry> = { ...cfg.models }
32
+ for (const [profile, { entry }] of winners) merged[profile] = entry
33
+ return merged as Models
34
+ }
35
+
36
+ function channelOf(origin: SessionOrigin | undefined): ChannelOrigin | undefined {
37
+ let current = origin
38
+ while (current?.kind === 'subagent') current = current.spawnedByOrigin
39
+ return current?.kind === 'channel' ? current : undefined
40
+ }
41
+
42
+ // Highest specificity among the rules that match, or undefined when none do.
43
+ function matchSpecificity(rules: readonly string[], channel: ChannelOrigin): number | undefined {
44
+ let best: number | undefined
45
+ for (const raw of rules) {
46
+ const parsed = parseMatchRule(raw)
47
+ if (!parsed.ok || !matchesOrigin(parsed.value, channel)) continue
48
+ const specificity = ruleSpecificity(parsed.value)
49
+ if (best === undefined || specificity > best) best = specificity
50
+ }
51
+ return best
52
+ }
53
+
54
+ function ruleSpecificity(rule: MatchRule): number {
55
+ if (rule.kind !== 'channel') return 0
56
+ if (rule.chat !== undefined) return 3
57
+ if (rule.workspace !== undefined || rule.bucket !== undefined) return 2
58
+ return 1
59
+ }
@@ -6,6 +6,7 @@ import { commitSystemFileSync } from '@/git/system-commit'
6
6
  import {
7
7
  configSchema,
8
8
  loadConfigSyncOrDefaults,
9
+ modelOverrideRuleError,
9
10
  validateConfig,
10
11
  type CustomModelMeta,
11
12
  type ThinkingLevel,
@@ -280,6 +281,22 @@ function writeModels(
280
281
  models: RawModels,
281
282
  commitMessage: string,
282
283
  customModel?: { ref: ModelRef; meta: CustomModelMeta },
284
+ ): ModelMutationResult {
285
+ return writeConfig(
286
+ cwd,
287
+ (parsed) => {
288
+ parsed.models = models
289
+ },
290
+ commitMessage,
291
+ customModel,
292
+ )
293
+ }
294
+
295
+ function writeConfig(
296
+ cwd: string,
297
+ mutate: (parsed: Record<string, unknown>) => void,
298
+ commitMessage: string,
299
+ customModel?: { ref: ModelRef; meta: CustomModelMeta },
283
300
  ): ModelMutationResult {
284
301
  const path = join(cwd, CONFIG_FILE)
285
302
  let parsed: Record<string, unknown>
@@ -292,7 +309,7 @@ function writeModels(
292
309
  }
293
310
  return { ok: false, reason: `Failed to read ${CONFIG_FILE}: ${(error as Error).message}` }
294
311
  }
295
- parsed.models = models
312
+ mutate(parsed)
296
313
  if (customModel !== undefined) {
297
314
  const existingCustomModels = isObjectRecord(parsed.customModels) ? parsed.customModels : {}
298
315
  parsed.customModels = { ...existingCustomModels, [customModel.ref]: customModel.meta }
@@ -301,7 +318,7 @@ function writeModels(
301
318
  if (!check.success) {
302
319
  return {
303
320
  ok: false,
304
- reason: `models block would be invalid: ${check.error.issues.map((i) => i.message).join('; ')}`,
321
+ reason: `config would be invalid: ${check.error.issues.map((i) => i.message).join('; ')}`,
305
322
  }
306
323
  }
307
324
  try {
@@ -338,6 +355,172 @@ function writeModels(
338
355
  return { ok: true }
339
356
  }
340
357
 
358
+ export type ModelOverrideListing = {
359
+ name: string
360
+ match: string[]
361
+ profiles: { profile: string; refs: ModelRef[]; thinkingLevel?: ThinkingLevel }[]
362
+ }
363
+
364
+ export function listModelOverrides(cwd: string): ModelOverrideListing[] {
365
+ const overrides = loadConfigSyncOrDefaults(cwd).modelOverrides
366
+ return Object.entries(overrides).map(([name, override]) => ({
367
+ name,
368
+ match: override.match,
369
+ profiles: Object.entries(override.models).map(([profile, entry]) => ({
370
+ profile,
371
+ refs: entry.refs,
372
+ ...(entry.thinkingLevel !== undefined ? { thinkingLevel: entry.thinkingLevel } : {}),
373
+ })),
374
+ }))
375
+ }
376
+
377
+ export type SetOverrideProfileOptions = SetProfileOptions & {
378
+ // Rule added to the override's `match` (creating the override when it doesn't
379
+ // exist yet). Required to create one; optional when it already exists.
380
+ match?: string
381
+ }
382
+
383
+ export function setOverrideProfile(
384
+ cwd: string,
385
+ name: string,
386
+ profile: string,
387
+ ref: string,
388
+ options: SetOverrideProfileOptions = {},
389
+ ): ModelMutationResult {
390
+ const trimmed = profile.trim()
391
+ if (trimmed.length === 0) return { ok: false, reason: 'Profile name cannot be empty.' }
392
+ if (!isModelRef(ref)) {
393
+ return {
394
+ ok: false,
395
+ reason: `Unknown model "${ref}". Run \`typeclaw model list --available\` to see valid options.`,
396
+ }
397
+ }
398
+ if (options.match !== undefined) {
399
+ const ruleError = modelOverrideRuleError(options.match)
400
+ if (ruleError !== undefined) return { ok: false, reason: `Invalid match rule "${options.match}": ${ruleError}` }
401
+ }
402
+ const existing = readOverridesRaw(cwd)[name]
403
+ if (existing === undefined && options.match === undefined) {
404
+ return {
405
+ ok: false,
406
+ reason: `Override "${name}" does not exist. Pass --match <rule> to create it, e.g. --match 'slack:*'.`,
407
+ }
408
+ }
409
+ const providerId = providerForModelRef(ref)
410
+ if (options.force !== true && !hasUsableCredential(cwd, providerId, options.env ?? process.env)) {
411
+ return {
412
+ ok: false,
413
+ reason: `Provider "${providerId}" has no credentials. Run \`typeclaw provider add ${providerId}\` first, or pass --force to write anyway.`,
414
+ }
415
+ }
416
+ const match = existing?.match ?? []
417
+ const models = existing?.models ?? {}
418
+ const level = Object.hasOwn(options, 'thinkingLevel')
419
+ ? options.thinkingLevel
420
+ : rawProfileThinkingLevel(models[trimmed])
421
+ const next: RawOverride = {
422
+ match: options.match !== undefined && !match.includes(options.match) ? [...match, options.match] : match,
423
+ models: { ...models, [trimmed]: withRawProfileThinkingLevel(ref, level) },
424
+ }
425
+ const customModel = !isKnownModelRef(ref) && options.meta !== undefined ? { ref, meta: options.meta } : undefined
426
+ return writeOverride(cwd, name, next, `model: set ${trimmed} → ${ref} in override ${name}`, customModel)
427
+ }
428
+
429
+ // Removing an override's last profile removes the override itself, since an
430
+ // entry with no profiles would be schema-invalid and has nothing to apply.
431
+ export function removeOverrideProfile(cwd: string, name: string, profile: string): ModelMutationResult {
432
+ const existing = readOverridesRaw(cwd)[name]
433
+ if (existing === undefined) return { ok: false, reason: `Override "${name}" not found in ${CONFIG_FILE}.` }
434
+ if (!(profile in existing.models)) {
435
+ return { ok: false, reason: `Profile "${profile}" not found in override "${name}".` }
436
+ }
437
+ const models = { ...existing.models }
438
+ delete models[profile]
439
+ if (Object.keys(models).length === 0) return removeOverride(cwd, name)
440
+ return writeOverride(cwd, name, { ...existing, models }, `model: remove ${profile} from override ${name}`)
441
+ }
442
+
443
+ export function addOverrideMatch(cwd: string, name: string, rule: string): ModelMutationResult {
444
+ const ruleError = modelOverrideRuleError(rule)
445
+ if (ruleError !== undefined) return { ok: false, reason: `Invalid match rule "${rule}": ${ruleError}` }
446
+ const existing = readOverridesRaw(cwd)[name]
447
+ if (existing === undefined) {
448
+ return {
449
+ ok: false,
450
+ reason: `Override "${name}" not found. Create it with \`typeclaw model set <profile> <ref> --override ${name} --match '${rule}'\`.`,
451
+ }
452
+ }
453
+ if (existing.match.includes(rule)) return { ok: true }
454
+ return writeOverride(
455
+ cwd,
456
+ name,
457
+ { ...existing, match: [...existing.match, rule] },
458
+ `model: match ${rule} in override ${name}`,
459
+ )
460
+ }
461
+
462
+ export function removeOverrideMatch(cwd: string, name: string, rule: string): ModelMutationResult {
463
+ const existing = readOverridesRaw(cwd)[name]
464
+ if (existing === undefined) return { ok: false, reason: `Override "${name}" not found in ${CONFIG_FILE}.` }
465
+ if (!existing.match.includes(rule)) return { ok: false, reason: `Rule "${rule}" not found in override "${name}".` }
466
+ if (existing.match.length === 1) {
467
+ return {
468
+ ok: false,
469
+ reason: `"${rule}" is the last rule of override "${name}". Run \`typeclaw model override remove ${name}\` to delete the override.`,
470
+ }
471
+ }
472
+ const match = existing.match.filter((r) => r !== rule)
473
+ return writeOverride(cwd, name, { ...existing, match }, `model: unmatch ${rule} in override ${name}`)
474
+ }
475
+
476
+ export function removeOverride(cwd: string, name: string): ModelMutationResult {
477
+ if (readOverridesRaw(cwd)[name] === undefined) {
478
+ return { ok: false, reason: `Override "${name}" not found in ${CONFIG_FILE}.` }
479
+ }
480
+ return writeConfig(
481
+ cwd,
482
+ (parsed) => {
483
+ const overrides = { ...(isObjectRecord(parsed.modelOverrides) ? parsed.modelOverrides : {}) }
484
+ delete overrides[name]
485
+ parsed.modelOverrides = overrides
486
+ },
487
+ `model: remove override ${name}`,
488
+ )
489
+ }
490
+
491
+ type RawOverride = { match: string[]; models: RawModels }
492
+
493
+ function writeOverride(
494
+ cwd: string,
495
+ name: string,
496
+ override: RawOverride,
497
+ commitMessage: string,
498
+ customModel?: { ref: ModelRef; meta: CustomModelMeta },
499
+ ): ModelMutationResult {
500
+ return writeConfig(
501
+ cwd,
502
+ (parsed) => {
503
+ const overrides = isObjectRecord(parsed.modelOverrides) ? parsed.modelOverrides : {}
504
+ parsed.modelOverrides = { ...overrides, [name]: override }
505
+ },
506
+ commitMessage,
507
+ customModel,
508
+ )
509
+ }
510
+
511
+ // On-disk `modelOverrides` so writers preserve hand-authored profile shapes.
512
+ function readOverridesRaw(cwd: string): Record<string, RawOverride> {
513
+ try {
514
+ const parsed = JSON.parse(readFileSync(join(cwd, CONFIG_FILE), 'utf8')) as {
515
+ modelOverrides?: Record<string, RawOverride>
516
+ }
517
+ return parsed.modelOverrides ?? {}
518
+ } catch (error) {
519
+ if ((error as NodeJS.ErrnoException).code === 'ENOENT') return {}
520
+ throw error
521
+ }
522
+ }
523
+
341
524
  function isObjectRecord(value: unknown): value is Record<string, unknown> {
342
525
  return typeof value === 'object' && value !== null && !Array.isArray(value)
343
526
  }