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
@@ -10,6 +10,7 @@ import {
10
10
  } from '@earendil-works/pi-coding-agent'
11
11
  import type { AgentSession, ToolDefinition } from '@earendil-works/pi-coding-agent'
12
12
 
13
+ import { adapterNamespace } from '@/channels/adapter-namespace'
13
14
  import type { ChannelRouter } from '@/channels/router'
14
15
  import type { ReactionRef } from '@/channels/types'
15
16
  import { createCodingAgentTool } from '@/coding-agent/tool'
@@ -21,6 +22,7 @@ import {
21
22
  type ResolvedProfile,
22
23
  type ThinkingLevel,
23
24
  } from '@/config'
25
+ import { effectiveModels } from '@/config/model-overrides'
24
26
  import { defaultThinkingLevelForRef, isOpenAiFamilyRef, providerForModelRef, type ModelRef } from '@/config/providers'
25
27
  import { renderMcpCatalog } from '@/mcp/catalog'
26
28
  import type { McpManager } from '@/mcp/manager'
@@ -28,6 +30,7 @@ import { createMcpDispatcherTools, MCP_DISPATCHER_TOOL_NAMES, resolveMcpCallPref
28
30
  import { noopPermissionService, type PermissionService, type RolesConfig } from '@/permissions'
29
31
  import type {
30
32
  BuiltinToolRef,
33
+ ChannelOutboundOrigin,
31
34
  HookBus,
32
35
  MaterializedSkills,
33
36
  PluginRegistry,
@@ -45,6 +48,7 @@ import { createCompactionSettingsManager } from './compaction'
45
48
  import { renderGitNudge } from './git-nudge'
46
49
  import type { InternalGuard } from './guard-types'
47
50
  import { buildInternalGuards } from './guards'
51
+ import { attachIdleCompaction } from './idle-compaction'
48
52
  import type { LiveSubagentRegistry } from './live-subagents'
49
53
  import { sanitizeMessagesForLlmReplay } from './llm-replay-sanitizer'
50
54
  import { applyModelRuntimeOverrides } from './model-overrides'
@@ -71,6 +75,7 @@ import {
71
75
  type SessionOrigin,
72
76
  type SessionRoleContext,
73
77
  } from './session-origin'
78
+ import { SubagentCacheKeepalive } from './subagent-cache-keepalive'
74
79
  import type { CreateSessionForSubagent, SubagentCoalescer, SubagentRegistry } from './subagents'
75
80
  import {
76
81
  buildSystemPolicy,
@@ -84,11 +89,13 @@ import { createBudgetState, type ToolResultBudget, wrapToolDefinitionWithBudget
84
89
  import { createChannelDisengageTool } from './tools/channel-disengage'
85
90
  import { createChannelEditTool } from './tools/channel-edit'
86
91
  import { createChannelFetchAttachmentTool, resolveInboxBaseDir } from './tools/channel-fetch-attachment'
92
+ import { createChannelHandoffTool } from './tools/channel-handoff'
87
93
  import { createChannelHistoryTool } from './tools/channel-history'
88
94
  import { createChannelReactTool } from './tools/channel-react'
89
95
  import { createChannelReadTool } from './tools/channel-read'
90
96
  import { createChannelReplyTool } from './tools/channel-reply'
91
97
  import { createChannelSendTool } from './tools/channel-send'
98
+ import { createChannelSessionSearchTool } from './tools/channel-session-search'
92
99
  import { createGrantRoleTool } from './tools/grant-role'
93
100
  import { createPostGithubReviewTool } from './tools/post-github-review'
94
101
  import { createRestartTool } from './tools/restart'
@@ -212,6 +219,9 @@ export type CreateSessionOptions = {
212
219
  // overrides) so different sessions on the same agent can run different
213
220
  // models without per-session config edits.
214
221
  profile?: string
222
+ // Thinking level overriding the resolved profile's own. Ignored when `profile`
223
+ // fell back to `default`, so the fallback session keeps `default`'s level.
224
+ thinkingLevel?: ThinkingLevel
215
225
  // Override the resolved ref directly, bypassing `profile` resolution. Used
216
226
  // by the model-fallback helper (`promptWithFallback`) to recreate a session
217
227
  // pinned to the next ref in the chain after the previous one failed. When
@@ -262,11 +272,16 @@ export type CreateSessionResult = {
262
272
  // in config.ts), so they arrive here as `resolved.thinkingLevel` — the first term.
263
273
  // That is why `deep`'s `high` still beats a lowered global default, and why there
264
274
  // is no profile special-casing in this function.
275
+ //
276
+ // `override` (a subagent's declared `thinkingLevel`) wins only when the requested
277
+ // profile actually resolved; a fallback to `default` ignores it.
265
278
  export function resolveSessionThinkingLevel(
266
279
  models: Models,
267
- resolved: Pick<ResolvedProfile, 'thinkingLevel' | 'profile'>,
280
+ resolved: Pick<ResolvedProfile, 'thinkingLevel' | 'profile'> & { fellBackToDefault?: boolean },
268
281
  activeRef: ModelRef,
282
+ override?: ThinkingLevel,
269
283
  ): ThinkingLevel | undefined {
284
+ if (override !== undefined && resolved.fellBackToDefault !== true) return override
270
285
  return resolved.thinkingLevel ?? models.default.thinkingLevel ?? defaultThinkingLevelForRef(activeRef)
271
286
  }
272
287
 
@@ -285,7 +300,10 @@ export function attachLoopGuardTurnTracking(
285
300
  }
286
301
 
287
302
  export async function createSessionWithDispose(options: CreateSessionOptions = {}): Promise<CreateSessionResult> {
288
- const resolved = resolveProfile(getConfig().models, options.profile)
303
+ // Profiles resolve against the session's effective models: the global block
304
+ // with any `modelOverrides` matching this session's channel layered on top.
305
+ const models = effectiveModels(getConfig(), options.origin)
306
+ const resolved = resolveProfile(models, options.profile)
289
307
  // Unknown profiles silently fall back to `default`. The fallback is by design
290
308
  // (see `resolveProfile`) and surfacing a warning here just creates noise on
291
309
  // every memory-logger / dreaming subagent spawn for advanced users who know
@@ -552,7 +570,7 @@ export async function createSessionWithDispose(options: CreateSessionOptions = {
552
570
  const model = applyModelRuntimeOverrides(resolveModel(activeRef), activeRef)
553
571
  // Read live so a reloaded `models` lands on the next session without a
554
572
  // container restart.
555
- const thinkingLevel = resolveSessionThinkingLevel(getConfig().models, resolved, activeRef)
573
+ const thinkingLevel = resolveSessionThinkingLevel(models, resolved, activeRef, options.thinkingLevel)
556
574
  const { session } = await createAgentSession({
557
575
  model,
558
576
  modelRuntime,
@@ -564,6 +582,26 @@ export async function createSessionWithDispose(options: CreateSessionOptions = {
564
582
  customTools,
565
583
  ...(thinkingLevel ? { thinkingLevel } : {}),
566
584
  })
585
+ // Pi's general warmer also runs without background children. TypeClaw owns
586
+ // the narrower idle-parent policy and never persists synthetic ping results.
587
+ session.setCacheWarmingMode('off')
588
+ const cacheKeepalive = options.liveSubagentRegistry
589
+ ? new SubagentCacheKeepalive(
590
+ options.plugins?.sessionId ?? sessionManager.getSessionId(),
591
+ options.liveSubagentRegistry,
592
+ (requestModel, context, streamOptions) => modelRuntime.streamSimple(requestModel, context, streamOptions),
593
+ )
594
+ : undefined
595
+ const unsubCacheKeepalive = session.subscribe((event) => {
596
+ if (event.type === 'agent_start') cacheKeepalive?.startTurn()
597
+ if (event.type === 'agent_settled') cacheKeepalive?.settle()
598
+ })
599
+ const innerDispose = session.dispose.bind(session)
600
+ session.dispose = () => {
601
+ cacheKeepalive?.close()
602
+ unsubCacheKeepalive()
603
+ innerDispose()
604
+ }
567
605
 
568
606
  // Wrapping also means `agent.streamFunction !== streamSimple`, which puts pi's
569
607
  // summarization auth on its lenient branch (agent-session.js:214-232): a
@@ -576,17 +614,18 @@ export async function createSessionWithDispose(options: CreateSessionOptions = {
576
614
  streamOptions?.maxTokens ??
577
615
  (requestModel.maxTokens > 0 ? Math.min(requestModel.maxTokens, DEFAULT_MAX_OUTPUT_TOKENS) : undefined)
578
616
  const promptCacheKey = promptCacheKeyForOrigin(getOrigin())
579
- const onPayload =
580
- promptCacheKey === undefined
581
- ? streamOptions?.onPayload
582
- : async (payload: unknown, payloadModel: typeof requestModel) => {
583
- const next = (await streamOptions?.onPayload?.(payload, payloadModel)) ?? payload
584
- return withPromptCacheKey(next, promptCacheKey)
585
- }
617
+ const onPayload = async (payload: unknown, payloadModel: typeof requestModel) => {
618
+ const next = (await streamOptions?.onPayload?.(payload, payloadModel)) ?? payload
619
+ const final = promptCacheKey === undefined ? next : withPromptCacheKey(next, promptCacheKey)
620
+ if (streamOptions?.sessionId === session.sessionId) {
621
+ cacheKeepalive?.capture(payloadModel, context, { ...streamOptions, maxTokens }, final)
622
+ }
623
+ return final
624
+ }
586
625
  return await innerStreamFunction(requestModel, context, {
587
626
  ...streamOptions,
588
627
  maxTokens,
589
- ...(onPayload ? { onPayload } : {}),
628
+ onPayload,
590
629
  })
591
630
  }
592
631
 
@@ -642,6 +681,9 @@ export async function createSessionWithDispose(options: CreateSessionOptions = {
642
681
  const unsubRestart = subscribeRestartNotice(options.stream, sessionManager)
643
682
 
644
683
  const unsubToolNudge = attachToolNotFoundNudge(session, intendedActiveToolNames)
684
+ // An applied idle summary replaces the prefix the keepalive captured;
685
+ // replaying the old one would only refresh a cache no turn will read.
686
+ const stopIdleCompaction = attachIdleCompaction(session, { onApplied: () => cacheKeepalive?.invalidate() })
645
687
 
646
688
  // Registered only once creation can no longer fail, so a rejected creation
647
689
  // leaves no scope entry behind; tools resolve the scope lazily at call time.
@@ -653,6 +695,9 @@ export async function createSessionWithDispose(options: CreateSessionOptions = {
653
695
  )
654
696
  : undefined
655
697
  const dispose = async () => {
698
+ stopIdleCompaction()
699
+ cacheKeepalive?.close()
700
+ unsubCacheKeepalive()
656
701
  releaseSubagentTmp?.()
657
702
  unsubLoopGuardTurn()
658
703
  unsubRestart?.()
@@ -695,7 +740,12 @@ export function buildRestartHandoffWiring(
695
740
  // session. Returns undefined for non-channel/no-author origins.
696
741
  export function currentChannelAuthor(getOrigin: () => SessionOrigin | undefined): string | undefined {
697
742
  const origin = getOrigin()
698
- return origin?.kind === 'channel' ? origin.lastInboundAuthorId : undefined
743
+ if (origin?.kind !== 'channel') return undefined
744
+ // The legacy restart record carries only a target-local author ID. Foreign
745
+ // requesters must remain authorless there, matching their target role rules.
746
+ if (adapterNamespace(origin.lastInboundAuthorAdapter ?? origin.adapter) !== adapterNamespace(origin.adapter))
747
+ return undefined
748
+ return origin.lastInboundAuthorId
699
749
  }
700
750
 
701
751
  function restartHandoffOriginFor(origin: SessionOrigin): RestartHandoffOrigin | null {
@@ -821,6 +871,10 @@ export function buildChannelTools(
821
871
  ): ToolDefinition[] {
822
872
  if (!channelRouter) return []
823
873
  const tools: ToolDefinition[] = []
874
+ const getOutboundOrigin = (): ChannelOutboundOrigin | undefined => {
875
+ const current = getOrigin ? getOrigin() : origin
876
+ return current ? { kind: current.kind, ...(current.kind === 'cron' ? { jobId: current.jobId } : {}) } : undefined
877
+ }
824
878
  if (origin?.kind === 'channel') {
825
879
  // adapter/workspace/chat/thread are session-key fields and never vary across
826
880
  // a session's turns, so they stay snapshotted. The review round does: it is
@@ -841,21 +895,23 @@ export function buildChannelTools(
841
895
  createChannelReplyTool({
842
896
  router: channelRouter,
843
897
  origin: channelOrigin,
898
+ getOutboundOrigin,
844
899
  ...(sessionId !== undefined ? { sessionId } : {}),
845
900
  }),
846
901
  )
847
902
  if (origin.adapter === 'github' && sessionId !== undefined)
848
903
  tools.push(createPostGithubReviewTool({ router: channelRouter, origin: channelOrigin, sessionId }))
849
904
  tools.push(createChannelHistoryTool({ router: channelRouter, origin: channelOrigin }))
850
- tools.push(createChannelReadTool({ router: channelRouter }))
905
+ tools.push(createChannelReadTool({ router: channelRouter, ...(sessionId !== undefined ? { sessionId } : {}) }))
851
906
  tools.push(
852
907
  createChannelSendTool({
853
908
  router: channelRouter,
854
909
  origin: channelOrigin,
910
+ getOutboundOrigin,
855
911
  ...(sessionId !== undefined ? { sessionId } : {}),
856
912
  }),
857
913
  )
858
- tools.push(createChannelEditTool({ router: channelRouter }))
914
+ tools.push(createChannelEditTool({ router: channelRouter, getOutboundOrigin }))
859
915
  // Read the live turn origin, falling back to the static snapshot when no
860
916
  // getter is wired (composition tests). `reactionRef` is per-turn, so the
861
917
  // getter is what makes reactions work outside tests.
@@ -884,11 +940,13 @@ export function buildChannelTools(
884
940
  tools.push(createChannelDisengageTool({ router: channelRouter, origin: channelOrigin }))
885
941
  if (sessionId !== undefined) {
886
942
  tools.push(createSkipResponseTool({ router: channelRouter, sessionId }))
943
+ tools.push(createChannelHandoffTool({ router: channelRouter, sessionId }))
944
+ tools.push(createChannelSessionSearchTool({ router: channelRouter, sessionId }))
887
945
  }
888
946
  } else {
889
- tools.push(createChannelSendTool({ router: channelRouter }))
947
+ tools.push(createChannelSendTool({ router: channelRouter, getOutboundOrigin }))
890
948
  tools.push(createChannelReadTool({ router: channelRouter }))
891
- tools.push(createChannelEditTool({ router: channelRouter }))
949
+ tools.push(createChannelEditTool({ router: channelRouter, getOutboundOrigin }))
892
950
  }
893
951
  return tools
894
952
  }
@@ -115,17 +115,30 @@ export type StatusSnapshot = {
115
115
  }
116
116
 
117
117
  export class LiveSubagentRegistry {
118
+ private readonly listeners = new Set<(parentSessionId: string | undefined) => void>()
118
119
  private readonly entries = new Map<string, LiveSubagent>()
119
120
  private readonly events = new Map<string, SubagentProgressEvent[]>()
120
121
  private readonly capturedFinalMessages = new Map<string, string>()
121
122
  private readonly pendingWorkKeyRegistrations = new Map<string, Set<PendingWorkKeyRegistration>>()
122
123
 
124
+ subscribe(listener: (parentSessionId: string | undefined) => void): () => void {
125
+ this.listeners.add(listener)
126
+ return () => {
127
+ this.listeners.delete(listener)
128
+ }
129
+ }
130
+
131
+ private notify(parentSessionId: string | undefined): void {
132
+ for (const listener of this.listeners) listener(parentSessionId)
133
+ }
134
+
123
135
  register(live: LiveSubagent): void {
124
136
  if (this.entries.has(live.taskId)) {
125
137
  throw new Error(`task ${live.taskId} already registered`)
126
138
  }
127
139
  this.entries.set(live.taskId, live)
128
140
  this.events.set(live.taskId, [{ kind: 'started', ts: live.startedAt }])
141
+ this.notify(live.parentSessionId)
129
142
  }
130
143
 
131
144
  beginWorkKeyRegistration(workKey: string): PendingWorkKeyRegistration {
@@ -151,9 +164,11 @@ export class LiveSubagentRegistry {
151
164
  }
152
165
 
153
166
  unregister(taskId: string): void {
167
+ const entry = this.entries.get(taskId)
154
168
  this.entries.delete(taskId)
155
169
  this.events.delete(taskId)
156
170
  this.capturedFinalMessages.delete(taskId)
171
+ if (entry) this.notify(entry.parentSessionId)
157
172
  }
158
173
 
159
174
  get(taskId: string): LiveSubagent | undefined {
@@ -198,6 +213,7 @@ export class LiveSubagentRegistry {
198
213
  if (entry === undefined) return
199
214
  entry.completion = completion
200
215
  entry.status = completion.ok ? 'completed' : 'failed'
216
+ this.notify(entry.parentSessionId)
201
217
  }
202
218
 
203
219
  // First-writer-wins settlement, returning whether THIS caller won. A subagent
@@ -215,6 +231,7 @@ export class LiveSubagentRegistry {
215
231
  if (entry === undefined || entry.status !== 'running') return false
216
232
  entry.completion = completion
217
233
  entry.status = completion.ok ? 'completed' : 'failed'
234
+ this.notify(entry.parentSessionId)
218
235
  return true
219
236
  }
220
237
 
@@ -288,10 +305,12 @@ export class LiveSubagentRegistry {
288
305
 
289
306
  clear(): void {
290
307
  // Shutdown must not erase evidence of children that have not terminated.
308
+ const parents = new Set(Array.from(this.entries.values(), (entry) => entry.parentSessionId))
291
309
  this.entries.clear()
292
310
  this.events.clear()
293
311
  this.capturedFinalMessages.clear()
294
312
  this.pendingWorkKeyRegistrations.clear()
313
+ for (const parent of parents) this.notify(parent)
295
314
  }
296
315
 
297
316
  private removePendingWorkKeyRegistration(registration: PendingWorkKeyRegistration): void {
@@ -116,19 +116,28 @@ export function createChannelLookAtTool(
116
116
  description:
117
117
  'View an image attached to a channel message. Inbound messages show ' +
118
118
  '`[<Platform> attachment #N: <kind> <metadata>]`; pass `N` as `attachment_id`. Do not invent ids. ' +
119
- 'Images on the CURRENT inbound resolve directly; for one from an EARLIER message, call channel_history ' +
120
- 'first to make it resolvable by the same id.',
119
+ 'Images on the CURRENT inbound resolve directly; for an EARLIER message call channel_history first. ' +
120
+ 'On Slack pass file_id when the request names an exact file or several messages reuse #1.',
121
121
  parameters: Type.Object({
122
122
  attachment_id: Type.Integer({
123
123
  description: 'The number N from the inbound `[<Platform> attachment #N: ...]` placeholder.',
124
124
  minimum: 1,
125
125
  }),
126
+ file_id: Type.Optional(
127
+ Type.String({ pattern: '^F[A-Z0-9]+$', description: 'Exact Slack file ID from the request or history.' }),
128
+ ),
126
129
  prompt: Type.Optional(
127
130
  Type.String({ description: 'Optional question to ask about the image; omitted means describe it.' }),
128
131
  ),
129
132
  }),
130
133
  async execute(_toolCallId, params) {
131
- const found = router.lookupInboundAttachment({ ...origin, id: params.attachment_id })
134
+ if (params.file_id !== undefined && origin.adapter !== 'slack' && origin.adapter !== 'slack-bot')
135
+ return errorResult('file_id is only supported for Slack attachments', { count: 0, prompt: params.prompt })
136
+ const found = router.lookupInboundAttachment({
137
+ ...origin,
138
+ id: params.attachment_id,
139
+ ...(params.file_id !== undefined ? { ref: params.file_id } : {}),
140
+ })
132
141
  if (found === null) {
133
142
  const validIds = router.listInboundAttachmentIds(origin)
134
143
  const validMsg =
@@ -151,12 +160,16 @@ export function createChannelLookAtTool(
151
160
  maxBytes: LOOK_AT_MAX_BYTES,
152
161
  ...(found.filename !== undefined ? { filename: found.filename } : {}),
153
162
  })
154
- if (!result.ok) return errorResult(result.error, { count: 0, prompt: params.prompt })
155
- return await runLookAtImages(
156
- [toImageContent(result.buffer.toString('base64'), result.mimetype ?? 'image/jpeg')],
157
- params.prompt,
158
- permissions,
159
- )
163
+ const viewed = result.ok
164
+ ? await runLookAtImages(
165
+ [toImageContent(result.buffer.toString('base64'), result.mimetype ?? 'image/jpeg')],
166
+ params.prompt,
167
+ permissions,
168
+ )
169
+ : errorResult(result.error, { count: 0, prompt: params.prompt })
170
+ if (origin.adapter === 'slack' || origin.adapter === 'slack-bot')
171
+ viewed.content.unshift({ type: 'text', text: `Selected Slack file_id=${found.ref}` })
172
+ return viewed
160
173
  },
161
174
  })
162
175
  }
@@ -78,6 +78,7 @@ import {
78
78
  verifyHiddenMaskTargets,
79
79
  verifyPrivilegedSandboxRuntime,
80
80
  } from '@/sandbox'
81
+ import { resolveDevSourceMount } from '@/sandbox/dev-source'
81
82
  import { resolveExposableEnvNames } from '@/sandbox/env-exposure'
82
83
 
83
84
  import type { InternalGuard } from './guard-types'
@@ -820,7 +821,16 @@ export function wrapBuiltinToolDefinition<TParams extends TSchema, TDetails = un
820
821
  renderSandboxPolicyNote(preparedSandboxRuntime.withheld, opts.agentDir),
821
822
  )
822
823
  }
823
- await runToolAfterSafely(opts, tool.name, toolCallId, toErrorResult(finalError))
824
+ const errorResult = toErrorResult(finalError)
825
+ await runToolAfterSafely(opts, tool.name, toolCallId, errorResult)
826
+ const annotatedMessage = errorResult.content
827
+ .filter((part) => part.type === 'text')
828
+ .map((part) => part.text)
829
+ .join('\n')
830
+ if (annotatedMessage !== (finalError instanceof Error ? finalError.message : String(finalError))) {
831
+ if (finalError instanceof Error) finalError.message = annotatedMessage
832
+ else finalError = new Error(annotatedMessage)
833
+ }
824
834
  throw finalError
825
835
  }
826
836
  if (pinnedFiles === undefined) throw new Error('tool file boundary was not initialized')
@@ -996,6 +1006,7 @@ async function applyBashSandbox(
996
1006
  env: sandboxEnvOverlay,
997
1007
  })
998
1008
  await verifyHiddenMaskTargets(maskTargets)
1009
+ const devSourceMount = await resolveDevSourceMount(agentDir)
999
1010
  const { commandString, spawnEnv } = boundary.buildCommand(command, {
1000
1011
  mounts: [
1001
1012
  { type: 'ro-bind', source: agentDir, dest: agentDir },
@@ -1004,6 +1015,7 @@ async function applyBashSandbox(
1004
1015
  // the lifetime of this command. Last-op-wins makes this narrow re-bind
1005
1016
  // read-only without adding any broader filesystem exposure.
1006
1017
  { type: 'ro-bind', source: dependencyBins.wrapperDir, dest: DEPENDENCY_BIN_SANDBOX_DIR },
1018
+ ...(devSourceMount === undefined ? [] : [devSourceMount]),
1007
1019
  ...(privilegedRuntime?.mounts ?? []),
1008
1020
  ...(preparation === undefined ? [] : [preparation.mount]),
1009
1021
  ],
@@ -599,8 +599,12 @@ function classifySegment(segment: Segment): void {
599
599
 
600
600
  export function enforceReviewerReadonlyBashPolicy(command: string): void {
601
601
  if (typeof command !== 'string' || command.trim().length === 0) return
602
+ // Single-quoted text is literal to bash, so backticks or `$(` inside a quoted
603
+ // jq filter or markdown review body are not substitutions. Double quotes stay
604
+ // in the scan because bash still substitutes inside them.
605
+ const scanned = stripSingleQuotedText(command)
602
606
  for (const { pattern, reason } of FAIL_CLOSED_CONSTRUCTS) {
603
- if (pattern.test(command)) {
607
+ if (pattern.test(scanned)) {
604
608
  throw new SubagentBashPolicyError(`command uses ${reason}, which the reviewer policy cannot analyze safely.`)
605
609
  }
606
610
  }
@@ -608,6 +612,42 @@ export function enforceReviewerReadonlyBashPolicy(command: string): void {
608
612
  for (const segment of segments) classifySegment(segment)
609
613
  }
610
614
 
615
+ // A `'` inside double quotes or after a backslash does not open a quote, so a
616
+ // plain regex would let `"it's `id`" 'x'` hide a live substitution.
617
+ function stripSingleQuotedText(command: string): string {
618
+ let out = ''
619
+ let inDouble = false
620
+ for (let i = 0; i < command.length; i++) {
621
+ const ch = command[i] as string
622
+ if (ch === '\\') {
623
+ out += command.slice(i, i + 2)
624
+ i++
625
+ continue
626
+ }
627
+ if (ch === '"') inDouble = !inDouble
628
+ // Bash ignores an unquoted `#` comment through the newline, so quotes inside
629
+ // it would mis-pair here and in splitIntoSegments and hide the next line.
630
+ if (ch === '#' && !inDouble && (i === 0 || /[\s;&|()]/.test(command[i - 1] as string))) {
631
+ const newline = command.indexOf('\n', i)
632
+ const comment = command.slice(i, newline === -1 ? undefined : newline)
633
+ if (/['"]/.test(comment)) {
634
+ throw new SubagentBashPolicyError(
635
+ 'a shell comment containing quotes cannot be analyzed safely; drop the comment.',
636
+ )
637
+ }
638
+ }
639
+ if (ch === "'" && !inDouble) {
640
+ const end = command.indexOf("'", i + 1)
641
+ if (end === -1) return command
642
+ out += "''"
643
+ i = end
644
+ continue
645
+ }
646
+ out += ch
647
+ }
648
+ return out
649
+ }
650
+
611
651
  export function enforceSubagentBashPolicy(policy: SubagentBashPolicy, command: string): void {
612
652
  if (policy.kind === 'readonly-reviewer') enforceReviewerReadonlyBashPolicy(command)
613
653
  }
@@ -43,6 +43,9 @@ export type SessionOrigin =
43
43
  parentChat?: string
44
44
  parentChatName?: string
45
45
  lastInboundAuthorId?: string
46
+ // Runtime-authenticated source of a delegated author, never model input.
47
+ // Foreign namespaces may match authorless rules, not local author IDs.
48
+ lastInboundAuthorAdapter?: AdapterId
46
49
  reactionRef?: ReactionRef
47
50
  participants?: readonly ChannelParticipant[]
48
51
  membership?: MembershipCount
@@ -294,7 +297,8 @@ export function renderInteractiveSessionContext(subagentRoster: string): string
294
297
  '',
295
298
  '- Spawns run in the background by default: a `<system-reminder>` arrives when the subagent completes — do not poll `subagent_output`. Pass `run_in_foreground: true` for a quick result you need this turn; deep-profile subagents always run in the background from here. In channel sessions a completion reminder is not a user message: surface the result via `channel_reply`/`channel_send`.',
296
299
  '- Broad search: spawn 2-5 `explorer`/`scout` workers in parallel, end your response, then collect each completion once. Use `scout` for narrow lookups and `researcher` for decomposed, multi-source, cross-validated synthesis. When the user *explicitly* asks to research or investigate, you MUST spawn `researcher`: answering from training memory or one inline `web_search` does not satisfy the request, and `scout`/`explorer` fan-out does not replace `researcher`.',
297
- '- Delegate-and-converse: for side-effectful or noisy work over ~30s, spawn one background subagent and stay responsive — `operator` for side effects, `scout` for a quick lookup, `researcher` for deep investigation, `planner` for risk-aware sequencing. Pass `profile: "deep"` only when the work needs stronger reasoning than the default tier.',
300
+ '- Delegate-and-converse: for side-effectful or noisy work over ~30s, spawn one background subagent and stay responsive — `operator` for side effects, `scout` for a quick lookup, `researcher` for deep investigation, `planner` for risk-aware sequencing, `qa` to prove a PR, repo, or deployed product actually works by running it. Pass `profile: "deep"` only when the work needs stronger reasoning than the default tier.',
301
+ '- Web browsing: never drive a browser yourself. Any task that needs a real browser — navigating, clicking, forms, logins, screenshots, JS-rendered pages — goes to `browser`. Plain lookups stay with `scout`/`web_fetch`.',
298
302
  '- Troubleshooting: after ~3 non-converging attempts at the same failure, stop and hand the loop to `operator` (background; `profile: "deep"` when genuinely hard) with the symptom, attempts, and success condition. Read `typeclaw-troubleshooting` before spawning.',
299
303
  "- Status: when asked about a running subagent, call `subagent_output({ task_id })` and report its `status_summary` — don't guess.",
300
304
  "- Don't fire more than 5 subagents per turn, spawn for known answers or single-file lookups, poll output in a loop, or ask research subagents to decide: they report; you decide. Most subagents are leaves; only `operator` and `reviewer` may delegate one level deeper.",
@@ -476,6 +480,14 @@ function renderChannelOrigin(
476
480
  'One verdict, one surface. After submitting the review, use',
477
481
  '`skip_response({ reason: "verdict posted as review" })`.',
478
482
  '',
483
+ '**A direct (re-)review request always gets an answer.** If someone asks',
484
+ 'you to review again but your standing verdict already covers the',
485
+ 'current head, do not `skip_response`; silence reads as broken. Reply in',
486
+ 'one line that your earlier verdict on `<short sha>` stands and what would',
487
+ 'change it. Phrase it as past ("I approved ... earlier"), e.g. "I approved',
488
+ '`abc1234` earlier and it is still the head, so that verdict stands. Push',
489
+ 'new commits or point me at something specific to re-check."',
490
+ '',
479
491
  '**Never post your own coordination state.** Write only what a PR',
480
492
  'participant needs. Do not narrate carriers, review rounds, sessions,',
481
493
  'a verdict not yet being registered, or sticky review state.',
@@ -623,16 +635,16 @@ function renderChannelOrigin(
623
635
  ...(origin.adapter === 'github'
624
636
  ? [
625
637
  'tool call, keep working and post the answer with a single final',
626
- '`channel_reply({ text, more_work_this_turn: false })`.',
638
+ '`channel_reply({ text, continue_after_reply: false })`.',
627
639
  'Do not post an "On it" ack comment first — the runtime',
628
640
  'already added an :eyes: reaction; use `channel_react` for explicit ack.',
629
641
  ]
630
642
  : [
631
643
  'tool call, send a one-line ack first via `channel_reply({ text: "On it.",',
632
- 'more_work_this_turn: true })`, keep working, then send the answer with a',
633
- 'final `channel_reply({ text, more_work_this_turn: false })`.',
644
+ 'continue_after_reply: true })`, keep working, then send the answer with a',
645
+ 'final `channel_reply({ text, continue_after_reply: false })`.',
634
646
  'The ack is not your reply; the answer is. Once the answer lands, end your turn.',
635
- '`more_work_this_turn: true` is mandatory on the ack or the turn ends there',
647
+ '`continue_after_reply: true` is mandatory on the ack or the turn ends there',
636
648
  'and drops the fetch/subagent/actual answer.',
637
649
  ]),
638
650
  '',
@@ -647,7 +659,7 @@ function renderChannelOrigin(
647
659
  '',
648
660
  'Do not send a second reply just to rephrase, restate, or "confirm" what you already said.',
649
661
  '',
650
- 'To reply here, call `channel_reply({ text, more_work_this_turn })`. Addressing (including the',
662
+ 'To reply here, call `channel_reply({ text, continue_after_reply })`. Addressing (including the',
651
663
  `thread${origin.thread !== null ? '' : ' — none here, this is a channel-root session'}) is filled in; you don't need`,
652
664
  'to copy these fields:',
653
665
  '',
@@ -660,8 +672,12 @@ function renderChannelOrigin(
660
672
  '}',
661
673
  '```',
662
674
  '',
663
- 'To post somewhere else (different chat, leaving the thread, DM, etc.), use',
664
- '`channel_send` with explicit addressing. `allow` rules still apply (`{ ok: false }`).',
675
+ 'When work belongs to ANOTHER conversation, first use `channel_session_search` to find its owning session,',
676
+ 'then pass that target to `channel_handoff`. Search by conversation name, topic, or participant, across adapters.',
677
+ "The owning session reads its current context and answers through its own account; don't read or post there",
678
+ 'directly from this session. This applies to channels, threads, groups, and DMs regardless of where you started.',
679
+ '`channel_send` is for an explicit direct post, not a substitute for handing ongoing work to its owner.',
680
+ 'If `channel_read` reports an access error with a handoff target, use it rather than asking the user to fix permissions.',
665
681
  '',
666
682
  ...renderResearchReportDeliveryGuidance(platformInfo),
667
683
  ...renderMentionGuidance(platformInfo, origin.participants ?? [], now, origin.self),
@@ -713,13 +729,13 @@ function renderResearchReportDeliveryGuidance(platformInfo: PlatformInfo): strin
713
729
  `**Ship explicit deliverables as PDFs.** ${platformInfo.displayName} accepts file`,
714
730
  'attachments. When the user clearly asks for a PDF/file/export/attachment, a standalone',
715
731
  'document/brief, or when a `researcher` subagent returns `research-<slug>.md` in',
716
- '`<report>`, render the markdown with `typeclaw-render-pdf` and deliver via',
732
+ '`<report>`, design it as a PDF with `typeclaw-render-pdf` and deliver via',
717
733
  '`channel_send({ ..., attachments: [{ path, filename }] })` plus a 1–2 line',
718
734
  'summary. Do not treat the bare word "report" as enough: routine daily stats,',
719
735
  'user trends, status reports, and other operational updates should stay inline',
720
736
  'unless the user asks for a downloadable/exported artifact. A `researcher`',
721
737
  '`<summary>` is a teaser, NOT the deliverable. Never use an ad-hoc library',
722
- '(jsPDF, pdfkit, raw-text dump); it breaks markdown/CJK.',
738
+ '(jsPDF, pdfkit, raw-text dump); it produces unstyled text and breaks CJK.',
723
739
  "For Korean/Japanese/Chinese, follow the skill's CJK guidance and never ship",
724
740
  'tofu boxes. Do not paste the full markdown into chat; do not attach the raw `.md`',
725
741
  'unless explicitly asked; inline text is right for routine updates.',