typeclaw 0.50.0 → 0.52.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 (258) hide show
  1. package/dist/types/agent/bash-sandbox-env.d.ts +17 -0
  2. package/dist/types/agent/bash-sandbox-proc.d.ts +8 -0
  3. package/dist/types/agent/bash-sandbox.d.ts +98 -0
  4. package/dist/types/agent/compaction.d.ts +4 -4
  5. package/dist/types/agent/idle-compaction.d.ts +1 -0
  6. package/dist/types/agent/index.d.ts +10 -17
  7. package/dist/types/agent/multimodal/look-at.d.ts +1 -1
  8. package/dist/types/agent/output-allowance.d.ts +4 -0
  9. package/dist/types/agent/plugin-tools.d.ts +8 -75
  10. package/dist/types/agent/prompt-cache-key.d.ts +1 -0
  11. package/dist/types/agent/session-tail.d.ts +12 -0
  12. package/dist/types/agent/subagents.d.ts +5 -0
  13. package/dist/types/agent/system-prompt-composition.d.ts +18 -0
  14. package/dist/types/agent/system-prompt.d.ts +2 -0
  15. package/dist/types/agent/tools/channel-disengage.d.ts +1 -1
  16. package/dist/types/agent/tools/channel-edit.d.ts +1 -1
  17. package/dist/types/agent/tools/channel-fetch-attachment.d.ts +1 -1
  18. package/dist/types/agent/tools/channel-handoff.d.ts +1 -1
  19. package/dist/types/agent/tools/channel-history.d.ts +1 -1
  20. package/dist/types/agent/tools/channel-react.d.ts +1 -1
  21. package/dist/types/agent/tools/channel-read.d.ts +10 -2
  22. package/dist/types/agent/tools/channel-reply.d.ts +1 -1
  23. package/dist/types/agent/tools/channel-send.d.ts +1 -1
  24. package/dist/types/agent/tools/channel-session-search.d.ts +1 -1
  25. package/dist/types/agent/tools/ddg.d.ts +9 -0
  26. package/dist/types/agent/tools/grant-role.d.ts +1 -1
  27. package/dist/types/agent/tools/post-github-review.d.ts +1 -1
  28. package/dist/types/agent/tools/restart.d.ts +1 -1
  29. package/dist/types/agent/tools/skip-response.d.ts +1 -1
  30. package/dist/types/agent/tools/spawn-subagent.d.ts +2 -1
  31. package/dist/types/agent/tools/stream-snapshot.d.ts +2 -2
  32. package/dist/types/agent/tools/subagent-cancel.d.ts +1 -1
  33. package/dist/types/agent/tools/subagent-output.d.ts +1 -1
  34. package/dist/types/agent/tools/todo/index.d.ts +1 -1
  35. package/dist/types/agent/tools/webfetch/adaptive-html.d.ts +3 -3
  36. package/dist/types/agent/tools/webfetch/strategies/readability-process.d.ts +48 -0
  37. package/dist/types/agent/tools/webfetch/tool.d.ts +2 -2
  38. package/dist/types/agent/tools/websearch.d.ts +1 -1
  39. package/dist/types/channels/adapters/github/auth-app.d.ts +25 -0
  40. package/dist/types/channels/adapters/github/auth-pat.d.ts +17 -0
  41. package/dist/types/channels/adapters/github/auth.d.ts +24 -0
  42. package/dist/types/channels/github-review-check.d.ts +1 -1
  43. package/dist/types/channels/github-token-bridge.d.ts +4 -0
  44. package/dist/types/channels/lost-background-context.d.ts +2 -0
  45. package/dist/types/channels/persistence.d.ts +1 -0
  46. package/dist/types/channels/router.d.ts +16 -50
  47. package/dist/types/channels/types.d.ts +1 -0
  48. package/dist/types/coding-agent/tool.d.ts +1 -1
  49. package/dist/types/config/config.d.ts +22 -0
  50. package/dist/types/config/providers.d.ts +50 -1
  51. package/dist/types/container/start.d.ts +1 -0
  52. package/dist/types/eval/cell.d.ts +26 -0
  53. package/dist/types/eval/config.d.ts +19 -0
  54. package/dist/types/eval/dispatch.d.ts +7 -0
  55. package/dist/types/eval/kernel.d.ts +28 -0
  56. package/dist/types/eval/process.d.ts +23 -0
  57. package/dist/types/eval/protocol.d.ts +34 -0
  58. package/dist/types/eval/sandbox.d.ts +12 -0
  59. package/dist/types/eval/tool.d.ts +17 -0
  60. package/dist/types/eval/wire.d.ts +33 -0
  61. package/dist/types/git/resolve-identity.d.ts +2 -0
  62. package/dist/types/init/dockerfile.d.ts +1 -0
  63. package/dist/types/init/gitignore.d.ts +1 -1
  64. package/dist/types/permissions/builtins.d.ts +1 -0
  65. package/dist/types/plugin/types.d.ts +3 -0
  66. package/dist/types/sandbox/canonical-secrets.d.ts +2 -2
  67. package/dist/types/sandbox/coding-agent.d.ts +1 -1
  68. package/dist/types/sandbox/dependency-bins.d.ts +1 -0
  69. package/dist/types/sandbox/dev-source.d.ts +2 -2
  70. package/dist/types/sandbox/env-exposure.d.ts +2 -0
  71. package/dist/types/sandbox/hidden-paths.d.ts +1 -0
  72. package/dist/types/sandbox/index.d.ts +1 -1
  73. package/dist/types/sandbox/policy.d.ts +3 -0
  74. package/dist/types/typevault/cli-path.d.ts +2 -0
  75. package/dist/types/typevault/envelope-store.d.ts +11 -0
  76. package/dist/types/typevault/lifecycle.d.ts +13 -0
  77. package/dist/types/typevault/vault.d.ts +27 -0
  78. package/package.json +8 -7
  79. package/scripts/test.ts +252 -0
  80. package/src/agent/bash-sandbox-env.ts +136 -0
  81. package/src/agent/bash-sandbox-proc.ts +70 -0
  82. package/src/agent/bash-sandbox.ts +239 -0
  83. package/src/agent/compaction.ts +22 -10
  84. package/src/agent/idle-compaction.ts +7 -3
  85. package/src/agent/index.ts +185 -187
  86. package/src/agent/multimodal/look-at.ts +1 -1
  87. package/src/agent/output-allowance.ts +7 -0
  88. package/src/agent/plugin-tools.ts +64 -380
  89. package/src/agent/prompt-cache-key.ts +26 -3
  90. package/src/agent/session-origin.ts +41 -19
  91. package/src/agent/session-tail.ts +28 -0
  92. package/src/agent/subagent-completion-reminder.ts +2 -2
  93. package/src/agent/subagents.ts +21 -2
  94. package/src/agent/system-prompt-composition.ts +159 -0
  95. package/src/agent/system-prompt.ts +43 -5
  96. package/src/agent/todo/scope.ts +1 -1
  97. package/src/agent/tool-error-remediation.ts +18 -3
  98. package/src/agent/tools/channel-disengage.ts +1 -1
  99. package/src/agent/tools/channel-edit.ts +1 -1
  100. package/src/agent/tools/channel-fetch-attachment.ts +1 -1
  101. package/src/agent/tools/channel-handoff.ts +3 -2
  102. package/src/agent/tools/channel-history.ts +2 -1
  103. package/src/agent/tools/channel-react.ts +1 -1
  104. package/src/agent/tools/channel-read.ts +36 -3
  105. package/src/agent/tools/channel-reply.ts +1 -1
  106. package/src/agent/tools/channel-send.ts +4 -3
  107. package/src/agent/tools/channel-session-search.ts +13 -4
  108. package/src/agent/tools/ddg.ts +71 -11
  109. package/src/agent/tools/grant-role.ts +1 -1
  110. package/src/agent/tools/post-github-review.ts +1 -1
  111. package/src/agent/tools/restart.ts +1 -1
  112. package/src/agent/tools/skip-response.ts +1 -1
  113. package/src/agent/tools/spawn-subagent.ts +15 -1
  114. package/src/agent/tools/stream-snapshot.ts +1 -1
  115. package/src/agent/tools/subagent-cancel.ts +1 -1
  116. package/src/agent/tools/subagent-output.ts +1 -1
  117. package/src/agent/tools/todo/index.ts +1 -1
  118. package/src/agent/tools/webfetch/adaptive-html.ts +6 -4
  119. package/src/agent/tools/webfetch/strategies/readability-child.ts +25 -0
  120. package/src/agent/tools/webfetch/strategies/readability-process.ts +185 -0
  121. package/src/agent/tools/webfetch/tool.ts +6 -5
  122. package/src/agent/tools/websearch.ts +1 -1
  123. package/src/agent/tools-without-local-file-operands.ts +4 -0
  124. package/src/browser/dockerfile.ts +1 -1
  125. package/src/browser/fill-secret.ts +364 -0
  126. package/src/browser/registry.ts +6 -6
  127. package/src/bundled-plugins/agent-messenger-cli-auth/command.ts +211 -0
  128. package/src/bundled-plugins/agent-messenger-cli-auth/index.ts +186 -0
  129. package/src/bundled-plugins/backup/index.ts +17 -2
  130. package/src/bundled-plugins/backup/runner.ts +37 -2
  131. package/src/bundled-plugins/browser-agent/browser-agent.ts +51 -14
  132. package/src/bundled-plugins/browser-agent/index.ts +12 -5
  133. package/src/bundled-plugins/explorer/explorer.ts +1 -1
  134. package/src/bundled-plugins/github-cli-auth/gh-review-detect.ts +40 -16
  135. package/src/bundled-plugins/github-cli-auth/graphql-auth-nudge.ts +12 -7
  136. package/src/bundled-plugins/github-cli-auth/index.ts +10 -1
  137. package/src/bundled-plugins/managed-browser/index.ts +130 -2
  138. package/src/bundled-plugins/managed-browser/skills/browserskill/browserskill/SKILL.md +13 -5
  139. package/src/bundled-plugins/managed-browser/skills/omowright/omowright/SKILL.md +56 -5
  140. package/src/bundled-plugins/memory/README.md +23 -2
  141. package/src/bundled-plugins/memory/append-fragment.ts +133 -0
  142. package/src/bundled-plugins/memory/append-tool.ts +80 -149
  143. package/src/bundled-plugins/memory/dreaming.ts +6 -1
  144. package/src/bundled-plugins/memory/index.ts +33 -6
  145. package/src/bundled-plugins/memory/load-memory.ts +2 -4
  146. package/src/bundled-plugins/memory/memory-logger.ts +200 -6
  147. package/src/bundled-plugins/memory/references/store-reference-tool.ts +56 -32
  148. package/src/bundled-plugins/memory/remember-tool.ts +81 -0
  149. package/src/bundled-plugins/memory/search-tool-hybrid.ts +91 -0
  150. package/src/bundled-plugins/memory/search-tool.ts +58 -12
  151. package/src/bundled-plugins/memory/stream-events.ts +2 -0
  152. package/src/bundled-plugins/memory/transcript-cursor.ts +30 -0
  153. package/src/bundled-plugins/memory/transcript-preload.ts +208 -0
  154. package/src/bundled-plugins/memory/transcript-view.ts +36 -0
  155. package/src/bundled-plugins/memory/vector/hybrid.ts +25 -14
  156. package/src/bundled-plugins/memory/watermark.ts +19 -10
  157. package/src/bundled-plugins/reviewer/reviewer.ts +20 -0
  158. package/src/bundled-plugins/security/policies/outbound-secret-scan.ts +3 -6
  159. package/src/bundled-plugins/security/policies/outbound-text.ts +20 -0
  160. package/src/bundled-plugins/security/policies/private-surface-read.ts +166 -201
  161. package/src/bundled-plugins/security/policies/system-prompt-leak.ts +2 -7
  162. package/src/bundled-plugins/typevault/grants.ts +119 -0
  163. package/src/bundled-plugins/typevault/index.ts +152 -0
  164. package/src/bundled-plugins/typevault/request.ts +87 -0
  165. package/src/bundled-plugins/typevault/runtime.ts +45 -0
  166. package/src/bundled-plugins/typevault/skills/typevault/SKILL.md +65 -0
  167. package/src/channels/adapter-halt.ts +17 -0
  168. package/src/channels/adapters/discord-bot-reference.ts +5 -4
  169. package/src/channels/adapters/discord-bot.ts +1 -0
  170. package/src/channels/adapters/discord-classify.ts +8 -3
  171. package/src/channels/adapters/discord.ts +29 -0
  172. package/src/channels/adapters/github/history.ts +23 -2
  173. package/src/channels/adapters/github/inbound.ts +60 -1
  174. package/src/channels/adapters/github/index.ts +27 -5
  175. package/src/channels/adapters/github/reconcile-open-prs.ts +7 -1
  176. package/src/channels/adapters/kakaotalk-author-resolver.ts +7 -5
  177. package/src/channels/adapters/kakaotalk-channel-resolver.ts +45 -15
  178. package/src/channels/adapters/kakaotalk-classify.ts +7 -9
  179. package/src/channels/adapters/kakaotalk-list.ts +62 -0
  180. package/src/channels/adapters/kakaotalk-member-cache.ts +67 -0
  181. package/src/channels/adapters/kakaotalk-membership.ts +27 -10
  182. package/src/channels/adapters/kakaotalk-mention.ts +61 -0
  183. package/src/channels/adapters/kakaotalk.ts +159 -125
  184. package/src/channels/adapters/teams-classify.ts +18 -8
  185. package/src/channels/github-review-check.ts +5 -1
  186. package/src/channels/github-review-verdict-coordinator.ts +68 -2
  187. package/src/channels/github-token-bridge.ts +13 -0
  188. package/src/channels/lost-background-context.ts +46 -0
  189. package/src/channels/manager.ts +52 -3
  190. package/src/channels/persistence.ts +5 -0
  191. package/src/channels/router.ts +208 -128
  192. package/src/channels/schema.ts +1 -1
  193. package/src/channels/subagent-completion-bridge.ts +3 -2
  194. package/src/channels/types.ts +3 -0
  195. package/src/cli/hostd.ts +3 -0
  196. package/src/coding-agent/tool.ts +1 -1
  197. package/src/config/config.ts +35 -1
  198. package/src/config/providers.ts +75 -4
  199. package/src/container/start.ts +52 -3
  200. package/src/doctor/channel-checks.ts +33 -0
  201. package/src/doctor/checks.ts +37 -18
  202. package/src/doctor/index.ts +48 -12
  203. package/src/doctor/operational-incidents.ts +16 -1
  204. package/src/doctor/plugin-bridge.ts +14 -1
  205. package/src/doctor/stage.ts +14 -0
  206. package/src/doctor/types.ts +6 -0
  207. package/src/eval/cell.ts +93 -0
  208. package/src/eval/config.ts +32 -0
  209. package/src/eval/dispatch.ts +67 -0
  210. package/src/eval/entry.ts +261 -0
  211. package/src/eval/kernel.ts +154 -0
  212. package/src/eval/process.ts +113 -0
  213. package/src/eval/protocol.ts +26 -0
  214. package/src/eval/redeclare.ts +174 -0
  215. package/src/eval/sandbox.ts +117 -0
  216. package/src/eval/tool.ts +99 -0
  217. package/src/eval/wire.ts +93 -0
  218. package/src/git/resolve-identity.ts +67 -2
  219. package/src/git/system-commit.ts +7 -0
  220. package/src/init/dockerfile.ts +5 -1
  221. package/src/init/gitignore.ts +3 -3
  222. package/src/init/index.ts +1 -0
  223. package/src/init/models-dev.ts +2 -0
  224. package/src/init/validate-api-key.ts +5 -0
  225. package/src/migrations/secrets-v1-to-v2.ts +2 -0
  226. package/src/operations/classify-tool-outcome.ts +1 -1
  227. package/src/permissions/builtins.ts +8 -0
  228. package/src/plugin/core-tool-names.ts +6 -1
  229. package/src/plugin/types.ts +6 -0
  230. package/src/run/bundled-plugins.ts +12 -0
  231. package/src/run/channel-session-factory.ts +3 -0
  232. package/src/run/index.ts +13 -2
  233. package/src/sandbox/build.ts +1 -0
  234. package/src/sandbox/canonical-secrets.ts +6 -0
  235. package/src/sandbox/dependency-bins.ts +13 -1
  236. package/src/sandbox/dev-source.ts +21 -12
  237. package/src/sandbox/env-exposure.ts +20 -0
  238. package/src/sandbox/hidden-paths.ts +1 -1
  239. package/src/sandbox/index.ts +1 -0
  240. package/src/sandbox/policy.ts +5 -0
  241. package/src/secrets/hydrate.ts +4 -1
  242. package/src/secrets/storage.ts +10 -1
  243. package/src/server/command-runner.ts +4 -0
  244. package/src/server/index.ts +54 -12
  245. package/src/skills/typeclaw-config/SKILL.md +36 -2
  246. package/src/skills/typeclaw-memory/SKILL.md +3 -1
  247. package/src/skills/typeclaw-permissions/SKILL.md +8 -8
  248. package/src/skills/typeclaw-troubleshooting/SKILL.md +18 -1
  249. package/src/tunnels/active.ts +14 -0
  250. package/src/typevault/bash-cli.ts +18 -0
  251. package/src/typevault/cli-path.ts +11 -0
  252. package/src/typevault/envelope-helper.ts +17 -0
  253. package/src/typevault/envelope-store.ts +98 -0
  254. package/src/typevault/lifecycle.ts +132 -0
  255. package/src/typevault/prompt-tunnel.ts +33 -0
  256. package/src/typevault/redaction.ts +37 -0
  257. package/src/typevault/vault.ts +283 -0
  258. package/typeclaw.schema.json +92 -10
@@ -33,7 +33,7 @@ export const ADAPTER_READ_CAPABILITIES: Record<AdapterId, readonly ReadCapabilit
33
33
  github: ['history'],
34
34
  instagram: ['history'],
35
35
  line: ['history'],
36
- kakaotalk: ['history'],
36
+ kakaotalk: ['history', 'list'],
37
37
  slack: ['history'],
38
38
  'slack-bot': ['history', 'message-get', 'list'],
39
39
  teams: ['history'],
@@ -56,8 +56,9 @@ const consoleLogger: SubagentCompletionBridgeLogger = {
56
56
  //
57
57
  // - The parent session was GC'd by the idle-eviction tick
58
58
  // (SESSION_IDLE_MS) while the subagent was running.
59
- // - The parent session rolled over (SESSION_FRESHNESS_TTL_MS) when a
60
- // new inbound arrived during a long-running subagent.
59
+ // - The parent session rolled over after 60 minutes idle
60
+ // (SESSION_FRESHNESS_TTL_MS) when a new inbound arrived during a
61
+ // long-running subagent.
61
62
  //
62
63
  // A reminder still reaching this branch means there is no live session
63
64
  // for the key at all (the whole conversation went idle), or the parent
@@ -515,6 +515,9 @@ export type ChannelHistoryMessage = {
515
515
  }
516
516
 
517
517
  export type FetchHistoryArgs = {
518
+ // Adapters whose chat ids repeat across workspaces (GitHub `pr:12` in every
519
+ // repo) need it to address the right conversation. Callers that know it pass it.
520
+ workspace?: string
518
521
  chat: string
519
522
  thread: string | null
520
523
  limit: number
package/src/cli/hostd.ts CHANGED
@@ -191,6 +191,9 @@ export function buildHostdRestart(
191
191
  cliEntry,
192
192
  reuseCurrentHostDaemon: true,
193
193
  operationLease,
194
+ // No terminal is attached to an agent-requested restart, so the hostd log
195
+ // is the only place its start warnings can reach the operator.
196
+ onWarning: (warning) => writeLogLine(`[hostd] restart ${containerName}: ${warning}`),
194
197
  ...(currentHostDaemon ? { currentHostDaemon } : {}),
195
198
  })
196
199
  if (!restartResult.ok) return restartResult
@@ -1,5 +1,5 @@
1
- import { Type } from '@earendil-works/pi-ai'
2
1
  import { defineTool } from '@earendil-works/pi-coding-agent'
2
+ import { Type } from 'typebox'
3
3
 
4
4
  import type { SessionOrigin } from '@/agent/session-origin'
5
5
  import type { PermissionService } from '@/permissions'
@@ -8,6 +8,7 @@ import { z } from 'zod'
8
8
 
9
9
  import { BROWSER_ENGINE_IDS, BROWSER_EXTENSION_IDS } from '@/browser/registry'
10
10
  import { channelsSchema, SEEDED_GITHUB_EVENT_ALLOWLISTS } from '@/channels/schema'
11
+ import { evalConfigSchema } from '@/eval/config'
11
12
  import { commitSystemFileSync } from '@/git/system-commit'
12
13
  import { parseMatchRule } from '@/permissions/match-rule'
13
14
  import { rolesConfigSchema } from '@/permissions/schema'
@@ -218,7 +219,8 @@ const dockerfileObjectSchema = z.object({
218
219
  // restart, so the happy path still works; only hand-edited configs need to
219
220
  // set it explicitly. When the binary is absent at tunnel start, the
220
221
  // provider fails with a clear "enable docker.file.cloudflared and restart"
221
- // message rather than a cryptic spawn error.
222
+ // message rather than a cryptic spawn error. An enabled `typevault` installs
223
+ // it regardless, for the secret-page tunnel it opens at boot.
222
224
  cloudflared: z.boolean().default(false),
223
225
  // Install xvfb so the entrypoint shim can spawn an Xvfb virtual X
224
226
  // server and export DISPLAY, giving headed Chrome (agent-browser
@@ -320,6 +322,21 @@ export const githubCliSchema = githubCliObjectSchema.default(() => githubCliObje
320
322
 
321
323
  export type GithubCliConfig = z.infer<typeof githubCliSchema>
322
324
 
325
+ // Experimental. When enabled, `typeclaw start` moves secrets.json into the
326
+ // agent's own TypeVault vault (.typevault/); disabling restores the file.
327
+ const typevaultObjectSchema = z
328
+ .object({
329
+ enabled: z.boolean().default(false),
330
+ // Container port for the one-time secret page. The daemon binds it on the
331
+ // first request, so a clash with another listener only shows up then.
332
+ promptPort: z.number().int().min(1).max(65535).default(8976),
333
+ })
334
+ .strict()
335
+
336
+ export const typevaultSchema = typevaultObjectSchema.default(() => typevaultObjectSchema.parse({}))
337
+
338
+ export type TypevaultConfig = z.infer<typeof typevaultSchema>
339
+
323
340
  export const DEFAULT_LOG_RETENTION_DAYS = 14
324
341
  export const MAX_LOG_RETENTION_DAYS = 3650
325
342
 
@@ -884,10 +901,12 @@ export const configSchema = z
884
901
  portForward: portForwardSchema,
885
902
  network: networkSchema,
886
903
  sandbox: sandboxSchema,
904
+ eval: evalConfigSchema,
887
905
  docker: dockerSchema,
888
906
  browser: browserSchema,
889
907
  git: gitSchema,
890
908
  githubCli: githubCliSchema,
909
+ typevault: typevaultSchema,
891
910
  logs: logsSchema,
892
911
  roles: rolesConfigSchema.optional(),
893
912
  tunnels: tunnelsArraySchema,
@@ -899,6 +918,17 @@ export const configSchema = z
899
918
  // block is omitted entirely. Read fresh per session via `getConfig()`, so
900
919
  // it applies on reload without a restart.
901
920
  branding: z.boolean().default(true),
921
+ // Auto-compaction budget. `maxTriggerTokens` sets the agent's own ceiling
922
+ // on the compaction trigger, so each agent can trade per-turn re-read cost
923
+ // against working room for its workload; omitted, the 200K default in
924
+ // src/agent/compaction.ts applies. The 80% window-relative trigger still
925
+ // applies. The floor is 3x the 20K recent window that compaction keeps, so
926
+ // a compaction cannot immediately retrigger. Read per session, so a reload
927
+ // applies to sessions created afterwards.
928
+ compaction: z
929
+ .object({ maxTriggerTokens: z.number().int().min(60_000).optional() })
930
+ .strict()
931
+ .default({}),
902
932
  })
903
933
  .catchall(z.unknown())
904
934
 
@@ -1164,11 +1194,13 @@ export const FIELD_EFFECTS: Record<string, FieldEffect> = {
1164
1194
  portForward: 'restart-required',
1165
1195
  network: 'restart-required',
1166
1196
  sandbox: 'restart-required',
1197
+ eval: 'restart-required',
1167
1198
  tunnels: 'restart-required',
1168
1199
  'docker.file': 'restart-required', // Includes omoCli; installation changes rebuild the image.
1169
1200
  browser: 'restart-required',
1170
1201
  'git.ignore': 'restart-required',
1171
1202
  githubCli: 'restart-required',
1203
+ typevault: 'restart-required',
1172
1204
  logs: 'ignored',
1173
1205
  // Split: `match` lists are reload-safe (typeclaw role claim, hand-edits
1174
1206
  // adding/removing match rules apply without a container restart);
@@ -1181,6 +1213,7 @@ export const FIELD_EFFECTS: Record<string, FieldEffect> = {
1181
1213
  'roles.match': 'applied',
1182
1214
  'roles.permissions': 'restart-required',
1183
1215
  branding: 'applied',
1216
+ compaction: 'applied',
1184
1217
  }
1185
1218
 
1186
1219
  // Stable JSON for value comparison. Fields are small JSON-shaped objects, so
@@ -1268,6 +1301,7 @@ export function extractPluginConfigs(raw: unknown): Record<string, unknown> {
1268
1301
  'docker',
1269
1302
  'git',
1270
1303
  'githubCli',
1304
+ 'typevault',
1271
1305
  'logs',
1272
1306
  'roles',
1273
1307
  'permissions',
@@ -121,8 +121,12 @@ export const KNOWN_PROVIDERS = {
121
121
  maxTokens: 128000,
122
122
  },
123
123
  // GPT-6 Sol and Luna use Responses because Chat Completions accepts tools
124
- // only at effort `none`. The full map and compat are pi-ai 0.87.1's
124
+ // only at effort `none`. The full map and compat are pi-ai 1.4.0's
125
125
  // catalog values, preserving every documented effort through `max`.
126
+ // With `supportsMidConvoEffort` (pi-ai 1.3.0), API-key requests keep a
127
+ // fixed reasoning.effort and carry the thinking level in
128
+ // configuration_update input items, so a mid-session level change keeps
129
+ // the prompt cache. Sign in with ChatGPT still sends reasoning.effort.
126
130
  'gpt-6-sol': {
127
131
  id: 'gpt-6-sol',
128
132
  name: 'GPT-6 Sol',
@@ -149,6 +153,7 @@ export const KNOWN_PROVIDERS = {
149
153
  supportsAdditionalTools: true,
150
154
  supportsToolSearch: true,
151
155
  supportsMidConvoSystemMessages: true,
156
+ supportsMidConvoEffort: true,
152
157
  supportsExplicitPromptCacheMode: true,
153
158
  },
154
159
  },
@@ -178,6 +183,7 @@ export const KNOWN_PROVIDERS = {
178
183
  supportsAdditionalTools: true,
179
184
  supportsToolSearch: true,
180
185
  supportsMidConvoSystemMessages: true,
186
+ supportsMidConvoEffort: true,
181
187
  supportsExplicitPromptCacheMode: true,
182
188
  },
183
189
  },
@@ -747,8 +753,8 @@ export const KNOWN_PROVIDERS = {
747
753
  apiKeyEnv: 'XAI_API_KEY',
748
754
  oauthProviderId: 'xai',
749
755
  models: {
750
- // pi-ai 0.87.1's xAI catalog caps Grok 4.3 at 30K and maps its efforts;
751
- // `minimal` is not an xAI effort, so it clamps to `low`. The current
756
+ // pi-ai 1.4.0's xAI catalog caps Grok 4.3 at 30K and maps its efforts,
757
+ // including `xhigh`; `minimal` is not an xAI effort, so it clamps to `low`. The current
752
758
  // transport sends model.maxTokens by default, so keep that vendor-safe cap.
753
759
  'grok-4.3': {
754
760
  id: 'grok-4.3',
@@ -767,7 +773,7 @@ export const KNOWN_PROVIDERS = {
767
773
  low: 'low',
768
774
  medium: 'medium',
769
775
  high: 'high',
770
- xhigh: null,
776
+ xhigh: 'xhigh',
771
777
  max: null,
772
778
  },
773
779
  compat: { supportsLongCacheRetention: false },
@@ -1459,6 +1465,66 @@ export const KNOWN_PROVIDERS = {
1459
1465
  },
1460
1466
  },
1461
1467
  },
1468
+ // LG AI Research EXAONE API Platform (docs.exaone.ai). OpenAI-compatible
1469
+ // /v1/chat/completions with Bearer auth, so it goes through pi-ai's
1470
+ // `openai-completions` adapter with a custom baseUrl. api-key only.
1471
+ //
1472
+ // Only K-EXAONE 2.5 is listed: EXAONE Tabular is a structured-data predictor,
1473
+ // not a chat model. Per docs.exaone.ai/en/docs/k-exaone-2.5 (2026-11-09) it is
1474
+ // text-only with a 524,288-token context, and input + max_tokens must stay
1475
+ // within that limit or the API returns 400. max_tokens counts reasoning too, so
1476
+ // maxTokens mirrors the context window; typeclaw's default output allowance
1477
+ // caps the actual request well below it.
1478
+ //
1479
+ // The model always reasons (enable_thinking is forced on) and reasoning_effort
1480
+ // defaults to `max` when omitted. `off` therefore maps to `low`, the cheapest
1481
+ // effort, instead of null: omitting the field would silently run every
1482
+ // non-reasoning turn at max effort. The endpoint accepts only low/high/max, so
1483
+ // medium rounds up to `high` and xhigh maps to `max`. Reasoning streams back
1484
+ // in `reasoning_content`, which pi-ai already replays on assistant history.
1485
+ //
1486
+ // The endpoint documents system/user/assistant roles and `max_tokens`, but not
1487
+ // `store`, the `developer` role, or `strict` on tool definitions, and pi-ai
1488
+ // doesn't auto-detect compat for this baseUrl, so those are turned off.
1489
+ //
1490
+ // No per-token price is published yet, so cost is 0.
1491
+ exaone: {
1492
+ id: 'exaone',
1493
+ name: 'LG EXAONE',
1494
+ baseUrl: 'https://api.exaone.ai/v1',
1495
+ auth: ['api-key'],
1496
+ apiKeyEnv: 'EXAONE_API_KEY',
1497
+ oauthProviderId: null,
1498
+ models: {
1499
+ 'k-exaone_v2.5': {
1500
+ id: 'k-exaone_v2.5',
1501
+ name: 'K-EXAONE 2.5',
1502
+ api: 'openai-completions',
1503
+ provider: 'exaone',
1504
+ baseUrl: 'https://api.exaone.ai/v1',
1505
+ reasoning: true,
1506
+ thinkingLevelMap: {
1507
+ off: 'low',
1508
+ minimal: 'low',
1509
+ low: 'low',
1510
+ medium: 'high',
1511
+ high: 'high',
1512
+ xhigh: 'max',
1513
+ },
1514
+ input: ['text'],
1515
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
1516
+ contextWindow: 524288,
1517
+ maxTokens: 524288,
1518
+ compat: {
1519
+ supportsStore: false,
1520
+ supportsDeveloperRole: false,
1521
+ supportsReasoningEffort: true,
1522
+ supportsStrictMode: false,
1523
+ maxTokensField: 'max_tokens',
1524
+ },
1525
+ },
1526
+ },
1527
+ },
1462
1528
  } as const satisfies Record<string, KnownProvider>
1463
1529
 
1464
1530
  export type KnownProviderId = keyof typeof KNOWN_PROVIDERS
@@ -1551,6 +1617,11 @@ export const KNOWN_PROVIDER_VENDORS = {
1551
1617
  name: 'Inception (Mercury)',
1552
1618
  providers: ['inception'],
1553
1619
  },
1620
+ exaone: {
1621
+ id: 'exaone',
1622
+ name: 'LG EXAONE',
1623
+ providers: ['exaone'],
1624
+ },
1554
1625
  // Listed last because it is a reseller, not a lab: a user who knows they want
1555
1626
  // Anthropic should land on the Anthropic row, not the gateway that proxies it.
1556
1627
  opengateway: {
@@ -1,5 +1,5 @@
1
1
  import { randomBytes } from 'node:crypto'
2
- import { accessSync, constants as fsConstants, existsSync, realpathSync } from 'node:fs'
2
+ import { accessSync, constants as fsConstants, existsSync, realpathSync, statSync } from 'node:fs'
3
3
  import { cp, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
4
4
  import { homedir, tmpdir } from 'node:os'
5
5
  import { isAbsolute, join, posix, relative, resolve } from 'node:path'
@@ -8,7 +8,7 @@ import { migrateAgentMessengerConfigDir, resolveAgentMessengerConfigPolicy } fro
8
8
  import { expandMountPath, loadConfigSync, withDefaultPlugins, type Config, type PortForward } from '@/config'
9
9
  import { applyBoundGcConfig } from '@/git/bound-gc-config'
10
10
  import { commitGitignoreWithUntracks, untrackTrulyIgnoredFiles } from '@/git/reconcile-ignored'
11
- import { resolveGitIdentity, type GitIdentity } from '@/git/resolve-identity'
11
+ import { ensureGitIdentity, resolveGitIdentity, isFallbackGitIdentity, type GitIdentity } from '@/git/resolve-identity'
12
12
  import { commitSystemFile as commitSystemFileShared } from '@/git/system-commit'
13
13
  import { send as sendToDaemon } from '@/hostd/client'
14
14
  import { ensureModels as ensureHostModels } from '@/hostd/models'
@@ -40,6 +40,7 @@ import {
40
40
  import { SecretsBackend } from '@/secrets/storage'
41
41
  import { isWindows } from '@/shared'
42
42
  import { hostLocaleIsCjk } from '@/shared/host-locale'
43
+ import { reconcileTypevault } from '@/typevault/lifecycle'
43
44
 
44
45
  import { type AgentOperationLease, type WithAgentOperationLock, withAgentOperationLock } from './agent-operation-lock'
45
46
  import { acquireManagedBuildCache, type ManagedBuildCacheLease } from './build-cache'
@@ -127,6 +128,7 @@ export type StartPlan = {
127
128
  hostPort: number
128
129
  tuiToken: string | null
129
130
  memoryLimitBytes: number
131
+ mountWarnings: string[]
130
132
  }
131
133
 
132
134
  export type PlanStartOptions = {
@@ -369,6 +371,9 @@ async function runStart({
369
371
  // Dockerfile/.gitignore/package.json refreshes it is safe before the running
370
372
  // return — no surprise for `compose start` against a partially-up tree.
371
373
  await applyBoundGcConfig(cwd)
374
+ // Same machine-local category: runtime commits read this config through the
375
+ // /agent bind mount, so a filled-in identity also unblocks a running agent.
376
+ await ensureGitIdentity(cwd)
372
377
 
373
378
  if (state.kind === 'malformed') {
374
379
  return {
@@ -412,6 +417,14 @@ async function runStart({
412
417
  }
413
418
 
414
419
  const githubCliConfig = await loadTypeclawConfig(cwd)
420
+ // Before anything else touches secrets.json, so the GitHub CLI refresh
421
+ // below already writes to whichever store this start settles on.
422
+ const typevaultReconcile = await reconcileTypevault(cwd, githubCliConfig.typevault.enabled)
423
+ if (typevaultReconcile.action === 'skipped') {
424
+ const warning = `TypeVault: ${typevaultReconcile.warning}`
425
+ if (streamOutput) process.stderr.write(`${warning}\n`)
426
+ else onWarning?.(warning)
427
+ }
415
428
  if (!githubCliConfig.githubCli.importHostAuth) {
416
429
  const removalFailure = removeGithubCliStore(cwd)
417
430
  if (removalFailure !== null) return { ok: false, reason: removalFailure }
@@ -660,6 +673,11 @@ async function runStart({
660
673
  totalMemoryBytes,
661
674
  })
662
675
 
676
+ for (const warning of plan.mountWarnings) {
677
+ if (onWarning !== undefined) onWarning(warning)
678
+ else if (streamOutput) process.stderr.write(`typeclaw: warning: ${warning}\n`)
679
+ }
680
+
663
681
  if (!skipMemoryOversubscriptionCheck) {
664
682
  await warnOnMemoryOversubscription({
665
683
  exec,
@@ -1168,7 +1186,7 @@ export async function planStart({
1168
1186
  runArgs.push('--env-file', join(cwd, ENV_FILE))
1169
1187
  }
1170
1188
  const resolvedGitIdentity = gitIdentity === undefined ? await resolveGitIdentity(cwd) : gitIdentity
1171
- if (resolvedGitIdentity !== null) {
1189
+ if (resolvedGitIdentity !== null && !(await isFallbackGitIdentity(cwd, resolvedGitIdentity))) {
1172
1190
  runArgs.push(
1173
1191
  '-e',
1174
1192
  `GIT_AUTHOR_NAME=${resolvedGitIdentity.name}`,
@@ -1222,8 +1240,14 @@ export async function planStart({
1222
1240
  runArgs.push(...dockerBindMount({ src: devSourcePath, dst: DEV_SOURCE_CONTAINER_PATH, readonly: true }))
1223
1241
  }
1224
1242
 
1243
+ const mountWarnings: string[] = []
1225
1244
  for (const mount of mounts) {
1226
1245
  const hostPath = expandMountPath(mount.path, cwd)
1246
+ const conflict = describeMountTargetConflict(cwd, mount.name, hostPath)
1247
+ if (conflict !== null) {
1248
+ mountWarnings.push(conflict)
1249
+ continue
1250
+ }
1227
1251
  const target = `${MOUNT_TARGET_PREFIX}/${mount.name}`
1228
1252
  runArgs.push(...dockerBindMount({ src: hostPath, dst: target, readonly: mount.readOnly }))
1229
1253
  }
@@ -1251,7 +1275,31 @@ export async function planStart({
1251
1275
  hostPort,
1252
1276
  tuiToken,
1253
1277
  memoryLimitBytes: memoryLimit.bytes,
1278
+ mountWarnings,
1279
+ }
1280
+ }
1281
+
1282
+ // Docker leaves the bind target it created under the agent folder after the
1283
+ // container is gone, so a mount whose source switched between file and directory
1284
+ // collides with that leftover and fails the whole `docker run` ("not a
1285
+ // directory"). Skip just that mount so the agent still boots; deleting the
1286
+ // target is left to the operator because it lives in their agent folder.
1287
+ function describeMountTargetConflict(cwd: string, name: string, hostPath: string): string | null {
1288
+ const target = join(cwd, 'mounts', name)
1289
+ let targetIsDirectory: boolean
1290
+ let sourceIsDirectory: boolean
1291
+ try {
1292
+ targetIsDirectory = statSync(target).isDirectory()
1293
+ sourceIsDirectory = statSync(hostPath).isDirectory()
1294
+ } catch {
1295
+ return null
1254
1296
  }
1297
+ if (targetIsDirectory === sourceIsDirectory) return null
1298
+ const kind = (isDirectory: boolean): string => (isDirectory ? 'a directory' : 'a file')
1299
+ return (
1300
+ `mount "${name}" skipped: ${hostPath} is ${kind(sourceIsDirectory)} but its target ${target} is ` +
1301
+ `${kind(targetIsDirectory)}, so Docker cannot bind it. Remove ${target} and restart to restore the mount.`
1302
+ )
1255
1303
  }
1256
1304
 
1257
1305
  // Surfaces the arithmetic when every agent's cap together exceeds what Docker
@@ -1310,6 +1358,7 @@ export async function refreshDockerfile(
1310
1358
  baseImageVersion: devMode ? null : resolveBaseImageVersion(cwd),
1311
1359
  cjkFontsAuto: hostLocaleIsCjk(),
1312
1360
  buildKit: opts.buildKit,
1361
+ typevault: cfg.typevault.enabled,
1313
1362
  })
1314
1363
  // Reuse the renderer's classifier so reported warnings match exactly what was
1315
1364
  // stripped/kept in the Dockerfile above (single source of truth).
@@ -41,6 +41,7 @@ export function buildChannelChecks(): DoctorCheck[] {
41
41
  githubCredentials(),
42
42
  githubWebhookDelivery(),
43
43
  githubEventAllowlist(),
44
+ githubWebhookPort(),
44
45
  ]
45
46
  }
46
47
 
@@ -364,6 +365,38 @@ function githubWebhookDelivery(): DoctorCheck {
364
365
  }
365
366
  }
366
367
 
368
+ function githubWebhookPort(): DoctorCheck {
369
+ return {
370
+ name: 'channel.github.webhook-port',
371
+ category: 'channels',
372
+ description: 'github webhookPort differs from typevault.promptPort',
373
+ applies: (ctx) => ctx.hasAgentFolder,
374
+ async run(ctx) {
375
+ const cfg = safeLoadConfig(ctx)
376
+ if (cfg === null) return configInvalidResult()
377
+ const github = cfg.channels.github
378
+ if (github === undefined || github.enabled === false) {
379
+ return { status: 'skipped', message: 'github not configured' }
380
+ }
381
+ if (!cfg.typevault.enabled) return { status: 'skipped', message: 'typevault not enabled' }
382
+ if (github.webhookPort !== cfg.typevault.promptPort) {
383
+ return {
384
+ status: 'ok',
385
+ message: `github webhook port ${github.webhookPort} differs from TypeVault port ${cfg.typevault.promptPort}`,
386
+ }
387
+ }
388
+ return {
389
+ status: 'warning',
390
+ message: `github webhookPort ${github.webhookPort} is the port TypeVault serves its secret page on`,
391
+ details: ['`vault_request` fails with `internal daemon error` while the webhook server holds the port.'],
392
+ fix: {
393
+ description: 'Change `typevault.promptPort` or `channels.github.webhookPort`, then run `typeclaw restart`.',
394
+ },
395
+ }
396
+ },
397
+ }
398
+ }
399
+
367
400
  function githubEventAllowlist(): DoctorCheck {
368
401
  return {
369
402
  name: 'channel.github.event-allowlist',
@@ -34,30 +34,39 @@ import type { DoctorCheck } from './types'
34
34
  export function buildStaticChecks(opts: { dockerExec?: DockerExec } & FileOwnershipDeps = {}): DoctorCheck[] {
35
35
  const dockerExec = opts.dockerExec ?? defaultDockerExec
36
36
 
37
+ // hostOnly: the container sees neither Docker nor hostd, carries its own Bun,
38
+ // runs under a different uid namespace, cannot stat host mount sources, and
39
+ // masks secrets.json from model bash, so these checks would only report
40
+ // false failures there. The managed Dockerfile/.gitignore are rewritten by
41
+ // the host on every `typeclaw start`.
37
42
  return [
38
- dockerDaemon(boundedExec(dockerExec)),
39
- bunRuntime(),
43
+ hostOnly(dockerDaemon(boundedExec(dockerExec))),
44
+ hostOnly(bunRuntime()),
40
45
  agentFolderInitialized(),
41
- agentFolderDockerfileTemplate(),
42
- agentFolderGitignoreTemplate(),
46
+ hostOnly(agentFolderDockerfileTemplate()),
47
+ hostOnly(agentFolderGitignoreTemplate()),
43
48
  agentFolderNodeModules(),
44
49
  agentFolderGitRepo(),
45
- agentFileOwnership(opts),
46
- configValid(),
47
- apparmorSandbox(),
48
- hostdHomeWritable(),
49
- wslDriveMount(),
50
- windowsSecretPerms(),
51
- hostdReachable(),
52
- hostdRegistration(),
53
- windowsBindMount(),
54
- containerState(boundedExec(dockerExec)),
55
- containerHostPort(dockerExec),
50
+ hostOnly(agentFileOwnership(opts)),
51
+ hostOnly(configValid()),
52
+ hostOnly(apparmorSandbox()),
53
+ hostOnly(hostdHomeWritable()),
54
+ hostOnly(wslDriveMount()),
55
+ hostOnly(windowsSecretPerms()),
56
+ hostOnly(hostdReachable()),
57
+ hostOnly(hostdRegistration()),
58
+ hostOnly(windowsBindMount()),
59
+ hostOnly(containerState(boundedExec(dockerExec))),
60
+ hostOnly(containerHostPort(dockerExec)),
56
61
  ...buildOperationalIncidentChecks(),
57
- ...buildChannelChecks(),
62
+ ...buildChannelChecks().map(hostOnly),
58
63
  ]
59
64
  }
60
65
 
66
+ function hostOnly(check: DoctorCheck): DoctorCheck {
67
+ return { ...check, hostOnly: true }
68
+ }
69
+
61
70
  function dockerDaemon(exec: DockerExec): DoctorCheck {
62
71
  return {
63
72
  name: 'docker.daemon-reachable',
@@ -535,7 +544,11 @@ function buildExpectedDockerfile(cwd: string): string | null {
535
544
  try {
536
545
  const cfg = loadConfigStrictForTemplate(cwd)
537
546
  if (cfg === null) return null
538
- return buildDockerfile(cfg.dockerfile, { browser: cfg.browser, baseImageVersion: resolveBaseImageVersion(cwd) })
547
+ return buildDockerfile(cfg.dockerfile, {
548
+ browser: cfg.browser,
549
+ baseImageVersion: resolveBaseImageVersion(cwd),
550
+ typevault: cfg.typevault,
551
+ })
539
552
  } catch {
540
553
  return null
541
554
  }
@@ -554,12 +567,18 @@ function buildExpectedGitignore(cwd: string): string | null {
554
567
  function loadConfigStrictForTemplate(cwd: string): {
555
568
  dockerfile: Parameters<typeof buildDockerfile>[0]
556
569
  browser: Config['browser']
570
+ typevault: boolean
557
571
  gitignore: Parameters<typeof buildGitignore>[0]
558
572
  } | null {
559
573
  const result = validateConfig(cwd)
560
574
  if (!result.ok) return null
561
575
  const cfg = loadConfigSync(cwd)
562
- return { dockerfile: cfg.docker.file, browser: cfg.browser, gitignore: cfg.git.ignore }
576
+ return {
577
+ dockerfile: cfg.docker.file,
578
+ browser: cfg.browser,
579
+ typevault: cfg.typevault.enabled,
580
+ gitignore: cfg.git.ignore,
581
+ }
563
582
  }
564
583
 
565
584
  // Normalizes CRLF to LF: the managed templates are emitted with `\n`, but a