typeclaw 0.51.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 (202) hide show
  1. package/dist/types/agent/bash-sandbox-env.d.ts +2 -0
  2. package/dist/types/agent/bash-sandbox.d.ts +4 -0
  3. package/dist/types/agent/index.d.ts +5 -0
  4. package/dist/types/agent/multimodal/look-at.d.ts +1 -1
  5. package/dist/types/agent/plugin-tools.d.ts +4 -0
  6. package/dist/types/agent/prompt-cache-key.d.ts +1 -0
  7. package/dist/types/agent/session-tail.d.ts +12 -0
  8. package/dist/types/agent/subagents.d.ts +5 -0
  9. package/dist/types/agent/system-prompt-composition.d.ts +1 -0
  10. package/dist/types/agent/system-prompt.d.ts +2 -0
  11. package/dist/types/agent/tools/channel-disengage.d.ts +1 -1
  12. package/dist/types/agent/tools/channel-edit.d.ts +1 -1
  13. package/dist/types/agent/tools/channel-fetch-attachment.d.ts +1 -1
  14. package/dist/types/agent/tools/channel-handoff.d.ts +1 -1
  15. package/dist/types/agent/tools/channel-history.d.ts +1 -1
  16. package/dist/types/agent/tools/channel-react.d.ts +1 -1
  17. package/dist/types/agent/tools/channel-read.d.ts +10 -2
  18. package/dist/types/agent/tools/channel-reply.d.ts +1 -1
  19. package/dist/types/agent/tools/channel-send.d.ts +1 -1
  20. package/dist/types/agent/tools/channel-session-search.d.ts +1 -1
  21. package/dist/types/agent/tools/grant-role.d.ts +1 -1
  22. package/dist/types/agent/tools/post-github-review.d.ts +1 -1
  23. package/dist/types/agent/tools/restart.d.ts +1 -1
  24. package/dist/types/agent/tools/skip-response.d.ts +1 -1
  25. package/dist/types/agent/tools/spawn-subagent.d.ts +2 -1
  26. package/dist/types/agent/tools/stream-snapshot.d.ts +1 -1
  27. package/dist/types/agent/tools/subagent-cancel.d.ts +1 -1
  28. package/dist/types/agent/tools/subagent-output.d.ts +1 -1
  29. package/dist/types/agent/tools/todo/index.d.ts +1 -1
  30. package/dist/types/agent/tools/webfetch/adaptive-html.d.ts +3 -3
  31. package/dist/types/agent/tools/webfetch/strategies/readability-process.d.ts +48 -0
  32. package/dist/types/agent/tools/webfetch/tool.d.ts +2 -2
  33. package/dist/types/agent/tools/websearch.d.ts +1 -1
  34. package/dist/types/channels/adapters/github/auth-app.d.ts +25 -0
  35. package/dist/types/channels/adapters/github/auth-pat.d.ts +17 -0
  36. package/dist/types/channels/adapters/github/auth.d.ts +24 -0
  37. package/dist/types/channels/github-token-bridge.d.ts +4 -0
  38. package/dist/types/channels/lost-background-context.d.ts +2 -0
  39. package/dist/types/channels/persistence.d.ts +1 -0
  40. package/dist/types/channels/router.d.ts +5 -1
  41. package/dist/types/channels/types.d.ts +1 -0
  42. package/dist/types/coding-agent/tool.d.ts +1 -1
  43. package/dist/types/config/config.d.ts +20 -11
  44. package/dist/types/config/providers.d.ts +47 -0
  45. package/dist/types/eval/sandbox.d.ts +2 -0
  46. package/dist/types/git/resolve-identity.d.ts +2 -0
  47. package/dist/types/init/dockerfile.d.ts +1 -0
  48. package/dist/types/init/gitignore.d.ts +1 -1
  49. package/dist/types/permissions/builtins.d.ts +1 -0
  50. package/dist/types/plugin/types.d.ts +3 -0
  51. package/dist/types/sandbox/canonical-secrets.d.ts +2 -2
  52. package/dist/types/sandbox/coding-agent.d.ts +1 -1
  53. package/dist/types/sandbox/dependency-bins.d.ts +1 -0
  54. package/dist/types/sandbox/dev-source.d.ts +2 -2
  55. package/dist/types/sandbox/hidden-paths.d.ts +1 -0
  56. package/dist/types/sandbox/index.d.ts +1 -1
  57. package/dist/types/sandbox/policy.d.ts +3 -0
  58. package/dist/types/typevault/cli-path.d.ts +2 -0
  59. package/dist/types/typevault/envelope-store.d.ts +11 -0
  60. package/dist/types/typevault/lifecycle.d.ts +13 -0
  61. package/dist/types/typevault/vault.d.ts +27 -0
  62. package/package.json +8 -7
  63. package/scripts/test.ts +252 -0
  64. package/src/agent/bash-sandbox-env.ts +33 -1
  65. package/src/agent/bash-sandbox.ts +20 -6
  66. package/src/agent/index.ts +120 -31
  67. package/src/agent/multimodal/look-at.ts +1 -1
  68. package/src/agent/plugin-tools.ts +35 -1
  69. package/src/agent/prompt-cache-key.ts +26 -3
  70. package/src/agent/session-origin.ts +39 -18
  71. package/src/agent/session-tail.ts +28 -0
  72. package/src/agent/subagents.ts +21 -2
  73. package/src/agent/system-prompt-composition.ts +18 -0
  74. package/src/agent/system-prompt.ts +39 -1
  75. package/src/agent/tool-error-remediation.ts +18 -3
  76. package/src/agent/tools/channel-disengage.ts +1 -1
  77. package/src/agent/tools/channel-edit.ts +1 -1
  78. package/src/agent/tools/channel-fetch-attachment.ts +1 -1
  79. package/src/agent/tools/channel-handoff.ts +3 -2
  80. package/src/agent/tools/channel-history.ts +2 -1
  81. package/src/agent/tools/channel-react.ts +1 -1
  82. package/src/agent/tools/channel-read.ts +36 -3
  83. package/src/agent/tools/channel-reply.ts +1 -1
  84. package/src/agent/tools/channel-send.ts +4 -3
  85. package/src/agent/tools/channel-session-search.ts +13 -4
  86. package/src/agent/tools/grant-role.ts +1 -1
  87. package/src/agent/tools/post-github-review.ts +1 -1
  88. package/src/agent/tools/restart.ts +1 -1
  89. package/src/agent/tools/skip-response.ts +1 -1
  90. package/src/agent/tools/spawn-subagent.ts +15 -1
  91. package/src/agent/tools/stream-snapshot.ts +1 -1
  92. package/src/agent/tools/subagent-cancel.ts +1 -1
  93. package/src/agent/tools/subagent-output.ts +1 -1
  94. package/src/agent/tools/todo/index.ts +1 -1
  95. package/src/agent/tools/webfetch/adaptive-html.ts +6 -4
  96. package/src/agent/tools/webfetch/strategies/readability-child.ts +25 -0
  97. package/src/agent/tools/webfetch/strategies/readability-process.ts +185 -0
  98. package/src/agent/tools/webfetch/tool.ts +6 -5
  99. package/src/agent/tools/websearch.ts +1 -1
  100. package/src/browser/dockerfile.ts +1 -1
  101. package/src/browser/fill-secret.ts +92 -35
  102. package/src/browser/registry.ts +6 -6
  103. package/src/bundled-plugins/agent-messenger-cli-auth/command.ts +211 -0
  104. package/src/bundled-plugins/agent-messenger-cli-auth/index.ts +186 -0
  105. package/src/bundled-plugins/backup/index.ts +17 -2
  106. package/src/bundled-plugins/backup/runner.ts +37 -2
  107. package/src/bundled-plugins/browser-agent/browser-agent.ts +51 -14
  108. package/src/bundled-plugins/browser-agent/index.ts +12 -5
  109. package/src/bundled-plugins/managed-browser/index.ts +25 -2
  110. package/src/bundled-plugins/managed-browser/skills/browserskill/browserskill/SKILL.md +13 -5
  111. package/src/bundled-plugins/managed-browser/skills/omowright/omowright/SKILL.md +56 -5
  112. package/src/bundled-plugins/memory/README.md +23 -2
  113. package/src/bundled-plugins/memory/append-fragment.ts +133 -0
  114. package/src/bundled-plugins/memory/append-tool.ts +80 -149
  115. package/src/bundled-plugins/memory/dreaming.ts +2 -0
  116. package/src/bundled-plugins/memory/index.ts +33 -6
  117. package/src/bundled-plugins/memory/memory-logger.ts +133 -11
  118. package/src/bundled-plugins/memory/references/store-reference-tool.ts +56 -32
  119. package/src/bundled-plugins/memory/remember-tool.ts +81 -0
  120. package/src/bundled-plugins/memory/search-tool-hybrid.ts +91 -0
  121. package/src/bundled-plugins/memory/search-tool.ts +58 -12
  122. package/src/bundled-plugins/memory/stream-events.ts +2 -0
  123. package/src/bundled-plugins/memory/transcript-cursor.ts +30 -0
  124. package/src/bundled-plugins/memory/transcript-preload.ts +131 -26
  125. package/src/bundled-plugins/memory/transcript-view.ts +36 -0
  126. package/src/bundled-plugins/memory/watermark.ts +19 -10
  127. package/src/bundled-plugins/reviewer/reviewer.ts +20 -0
  128. package/src/bundled-plugins/security/policies/outbound-secret-scan.ts +3 -6
  129. package/src/bundled-plugins/security/policies/outbound-text.ts +20 -0
  130. package/src/bundled-plugins/security/policies/system-prompt-leak.ts +2 -7
  131. package/src/bundled-plugins/typevault/grants.ts +119 -0
  132. package/src/bundled-plugins/typevault/index.ts +152 -0
  133. package/src/bundled-plugins/typevault/request.ts +87 -0
  134. package/src/bundled-plugins/typevault/runtime.ts +45 -0
  135. package/src/bundled-plugins/typevault/skills/typevault/SKILL.md +65 -0
  136. package/src/channels/adapter-halt.ts +17 -0
  137. package/src/channels/adapters/github/history.ts +23 -2
  138. package/src/channels/adapters/github/inbound.ts +60 -1
  139. package/src/channels/adapters/github/index.ts +27 -5
  140. package/src/channels/adapters/github/reconcile-open-prs.ts +7 -1
  141. package/src/channels/adapters/kakaotalk-author-resolver.ts +7 -5
  142. package/src/channels/adapters/kakaotalk-channel-resolver.ts +45 -15
  143. package/src/channels/adapters/kakaotalk-classify.ts +7 -9
  144. package/src/channels/adapters/kakaotalk-list.ts +62 -0
  145. package/src/channels/adapters/kakaotalk-member-cache.ts +67 -0
  146. package/src/channels/adapters/kakaotalk-membership.ts +27 -10
  147. package/src/channels/adapters/kakaotalk-mention.ts +61 -0
  148. package/src/channels/adapters/kakaotalk.ts +159 -125
  149. package/src/channels/adapters/teams-classify.ts +18 -8
  150. package/src/channels/github-token-bridge.ts +13 -0
  151. package/src/channels/lost-background-context.ts +46 -0
  152. package/src/channels/manager.ts +52 -3
  153. package/src/channels/persistence.ts +5 -0
  154. package/src/channels/router.ts +120 -21
  155. package/src/channels/schema.ts +1 -1
  156. package/src/channels/types.ts +3 -0
  157. package/src/coding-agent/tool.ts +1 -1
  158. package/src/config/config.ts +20 -1
  159. package/src/config/providers.ts +65 -0
  160. package/src/container/start.ts +15 -2
  161. package/src/doctor/channel-checks.ts +33 -0
  162. package/src/doctor/checks.ts +12 -2
  163. package/src/eval/sandbox.ts +3 -0
  164. package/src/eval/tool.ts +1 -0
  165. package/src/git/resolve-identity.ts +67 -2
  166. package/src/git/system-commit.ts +7 -0
  167. package/src/init/dockerfile.ts +5 -1
  168. package/src/init/gitignore.ts +3 -3
  169. package/src/init/index.ts +1 -0
  170. package/src/init/models-dev.ts +2 -0
  171. package/src/init/validate-api-key.ts +5 -0
  172. package/src/migrations/secrets-v1-to-v2.ts +2 -0
  173. package/src/permissions/builtins.ts +8 -0
  174. package/src/plugin/types.ts +6 -0
  175. package/src/run/bundled-plugins.ts +12 -0
  176. package/src/run/channel-session-factory.ts +3 -0
  177. package/src/run/index.ts +13 -2
  178. package/src/sandbox/build.ts +1 -0
  179. package/src/sandbox/canonical-secrets.ts +6 -0
  180. package/src/sandbox/dependency-bins.ts +13 -1
  181. package/src/sandbox/dev-source.ts +21 -12
  182. package/src/sandbox/hidden-paths.ts +1 -1
  183. package/src/sandbox/index.ts +1 -0
  184. package/src/sandbox/policy.ts +5 -0
  185. package/src/secrets/hydrate.ts +4 -1
  186. package/src/secrets/storage.ts +10 -1
  187. package/src/server/command-runner.ts +4 -0
  188. package/src/server/index.ts +8 -1
  189. package/src/skills/typeclaw-config/SKILL.md +16 -0
  190. package/src/skills/typeclaw-memory/SKILL.md +3 -1
  191. package/src/skills/typeclaw-permissions/SKILL.md +8 -8
  192. package/src/skills/typeclaw-troubleshooting/SKILL.md +18 -1
  193. package/src/tunnels/active.ts +14 -0
  194. package/src/typevault/bash-cli.ts +18 -0
  195. package/src/typevault/cli-path.ts +11 -0
  196. package/src/typevault/envelope-helper.ts +17 -0
  197. package/src/typevault/envelope-store.ts +98 -0
  198. package/src/typevault/lifecycle.ts +132 -0
  199. package/src/typevault/prompt-tunnel.ts +33 -0
  200. package/src/typevault/redaction.ts +37 -0
  201. package/src/typevault/vault.ts +283 -0
  202. package/typeclaw.schema.json +40 -10
@@ -1465,6 +1465,66 @@ export const KNOWN_PROVIDERS = {
1465
1465
  },
1466
1466
  },
1467
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
+ },
1468
1528
  } as const satisfies Record<string, KnownProvider>
1469
1529
 
1470
1530
  export type KnownProviderId = keyof typeof KNOWN_PROVIDERS
@@ -1557,6 +1617,11 @@ export const KNOWN_PROVIDER_VENDORS = {
1557
1617
  name: 'Inception (Mercury)',
1558
1618
  providers: ['inception'],
1559
1619
  },
1620
+ exaone: {
1621
+ id: 'exaone',
1622
+ name: 'LG EXAONE',
1623
+ providers: ['exaone'],
1624
+ },
1560
1625
  // Listed last because it is a reseller, not a lab: a user who knows they want
1561
1626
  // Anthropic should land on the Anthropic row, not the gateway that proxies it.
1562
1627
  opengateway: {
@@ -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'
@@ -370,6 +371,9 @@ async function runStart({
370
371
  // Dockerfile/.gitignore/package.json refreshes it is safe before the running
371
372
  // return — no surprise for `compose start` against a partially-up tree.
372
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)
373
377
 
374
378
  if (state.kind === 'malformed') {
375
379
  return {
@@ -413,6 +417,14 @@ async function runStart({
413
417
  }
414
418
 
415
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
+ }
416
428
  if (!githubCliConfig.githubCli.importHostAuth) {
417
429
  const removalFailure = removeGithubCliStore(cwd)
418
430
  if (removalFailure !== null) return { ok: false, reason: removalFailure }
@@ -1174,7 +1186,7 @@ export async function planStart({
1174
1186
  runArgs.push('--env-file', join(cwd, ENV_FILE))
1175
1187
  }
1176
1188
  const resolvedGitIdentity = gitIdentity === undefined ? await resolveGitIdentity(cwd) : gitIdentity
1177
- if (resolvedGitIdentity !== null) {
1189
+ if (resolvedGitIdentity !== null && !(await isFallbackGitIdentity(cwd, resolvedGitIdentity))) {
1178
1190
  runArgs.push(
1179
1191
  '-e',
1180
1192
  `GIT_AUTHOR_NAME=${resolvedGitIdentity.name}`,
@@ -1346,6 +1358,7 @@ export async function refreshDockerfile(
1346
1358
  baseImageVersion: devMode ? null : resolveBaseImageVersion(cwd),
1347
1359
  cjkFontsAuto: hostLocaleIsCjk(),
1348
1360
  buildKit: opts.buildKit,
1361
+ typevault: cfg.typevault.enabled,
1349
1362
  })
1350
1363
  // Reuse the renderer's classifier so reported warnings match exactly what was
1351
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',
@@ -544,7 +544,11 @@ function buildExpectedDockerfile(cwd: string): string | null {
544
544
  try {
545
545
  const cfg = loadConfigStrictForTemplate(cwd)
546
546
  if (cfg === null) return null
547
- 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
+ })
548
552
  } catch {
549
553
  return null
550
554
  }
@@ -563,12 +567,18 @@ function buildExpectedGitignore(cwd: string): string | null {
563
567
  function loadConfigStrictForTemplate(cwd: string): {
564
568
  dockerfile: Parameters<typeof buildDockerfile>[0]
565
569
  browser: Config['browser']
570
+ typevault: boolean
566
571
  gitignore: Parameters<typeof buildGitignore>[0]
567
572
  } | null {
568
573
  const result = validateConfig(cwd)
569
574
  if (!result.ok) return null
570
575
  const cfg = loadConfigSync(cwd)
571
- 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
+ }
572
582
  }
573
583
 
574
584
  // Normalizes CRLF to LF: the managed templates are emitted with `\n`, but a
@@ -5,6 +5,7 @@ import { fileURLToPath } from 'node:url'
5
5
 
6
6
  import { prepareBashSandbox } from '@/agent/bash-sandbox'
7
7
  import type { SessionOrigin } from '@/agent/session-origin'
8
+ import type { GetGithubSelf } from '@/channels/github-token-bridge'
8
9
  import type { PermissionService } from '@/permissions/permissions'
9
10
  import { shellQuote } from '@/sandbox/quote'
10
11
 
@@ -39,6 +40,7 @@ export function authorityOrigin(origin: SessionOrigin | undefined): unknown {
39
40
  }
40
41
 
41
42
  export function createSandboxedEvalKernel(options: {
43
+ readonly getGithubSelf?: GetGithubSelf
42
44
  readonly agentDir: string
43
45
  readonly sessionId: string
44
46
  readonly permissions: PermissionService
@@ -48,6 +50,7 @@ export function createSandboxedEvalKernel(options: {
48
50
  const origin = options.getOrigin()
49
51
  const entry = fileURLToPath(new URL('./entry.ts', import.meta.url))
50
52
  const prepared = await prepareBashSandbox({
53
+ getGithubSelf: options.getGithubSelf,
51
54
  command: `exec ${shellQuote(process.execPath)} --no-install ${shellQuote(entry)}`,
52
55
  agentDir: options.agentDir,
53
56
  sessionId: options.sessionId,
package/src/eval/tool.ts CHANGED
@@ -42,6 +42,7 @@ export function registerEvalTool(options: {
42
42
  })
43
43
  if (!eligible()) return undefined
44
44
  const kernel = createSandboxedEvalKernel({
45
+ getGithubSelf: options.wrappers.getGithubSelf,
45
46
  agentDir: options.wrappers.agentDir,
46
47
  sessionId: options.wrappers.sessionId,
47
48
  permissions: options.wrappers.permissions ?? noopPermissionService,
@@ -1,3 +1,5 @@
1
+ import { basename } from 'node:path'
2
+
1
3
  import { resolveAgentGit } from './resolve-agent-git'
2
4
  import { runGit } from './run'
3
5
 
@@ -9,6 +11,11 @@ const GIT_CONFIG_ENV = {
9
11
  GIT_TERMINAL_PROMPT: '0',
10
12
  } as const
11
13
 
14
+ // Records the identity ensureGitIdentity synthesized, so only that exact
15
+ // identity is treated as a fallback; a configured one that happens to match the
16
+ // folder name is not.
17
+ const FALLBACK_MARKER_KEY = 'typeclaw.fallbackidentity'
18
+
12
19
  const GIT_REPOSITORY_ENV_NAMES = new Set([
13
20
  'GIT_COMMON_DIR',
14
21
  'GIT_DIR',
@@ -27,11 +34,69 @@ export async function resolveGitIdentity(cwd: string): Promise<GitIdentity | nul
27
34
  return name !== null && email !== null ? { name, email } : null
28
35
  }
29
36
 
30
- async function readRepositoryIdentity(cwd: string, gitArgs: readonly string[]): Promise<Map<string, string[]>> {
37
+ // Commits by the runtime (backup, dreaming, system files) need an identity, and
38
+ // repository-local config is lost on clone or by hand edits. Fill only the
39
+ // missing keys from the agent folder name; an identity the user set is kept.
40
+ export async function ensureGitIdentity(cwd: string): Promise<GitIdentity | null> {
41
+ const repo = resolveAgentGit(cwd)
42
+ if (repo === null) return null
43
+
44
+ const values = await readRepositoryIdentity(cwd, repo.gitArgs)
45
+ const fallback = fallbackGitIdentity(cwd)
46
+ const name = values.get('user.name')?.at(-1)?.trim() || null
47
+ const email = values.get('user.email')?.at(-1)?.trim() || null
48
+ if (name !== null && email !== null) return { name, email }
49
+
50
+ const identity = { name: name ?? fallback.name, email: email ?? fallback.email }
51
+ if (name === null && !(await writeLocalConfig(cwd, repo.gitArgs, 'user.name', identity.name))) return null
52
+ if (email === null && !(await writeLocalConfig(cwd, repo.gitArgs, 'user.email', identity.email))) return null
53
+ await writeLocalConfig(cwd, repo.gitArgs, FALLBACK_MARKER_KEY, formatIdentity(identity))
54
+ return identity
55
+ }
56
+
57
+ // GIT_* env overrides repo config, so forwarding the fallback would freeze it
58
+ // over an identity hatching or the user sets while the container runs.
59
+ export async function isFallbackGitIdentity(cwd: string, identity: GitIdentity): Promise<boolean> {
60
+ const repo = resolveAgentGit(cwd)
61
+ if (repo === null) return false
62
+ const marker = (await readRepositoryIdentity(cwd, repo.gitArgs)).get(FALLBACK_MARKER_KEY)?.at(-1)
63
+ return marker === formatIdentity(identity)
64
+ }
65
+
66
+ function formatIdentity(identity: GitIdentity): string {
67
+ return `${identity.name} <${identity.email}>`
68
+ }
69
+
70
+ function fallbackGitIdentity(cwd: string): GitIdentity {
71
+ const folder = basename(cwd).trim()
72
+ const slug = folder
73
+ .toLowerCase()
74
+ .replace(/[^a-z0-9._-]+/g, '-')
75
+ .replace(/^[-.]+|[-.]+$/g, '')
76
+ return { name: folder || 'agent', email: `${slug || 'agent'}@typeclaw.local` }
77
+ }
78
+
79
+ async function writeLocalConfig(cwd: string, gitArgs: readonly string[], key: string, value: string): Promise<boolean> {
31
80
  try {
32
- const result = await runGit(Bun, cwd, [...gitArgs, 'config', '--null', '--get-regexp', '^user\\.(name|email)$'], {
81
+ const result = await runGit(Bun, cwd, [...gitArgs, 'config', '--local', key, value], {
33
82
  env: { ...withoutGitOverrides(process.env), ...GIT_CONFIG_ENV },
34
83
  })
84
+ return result.exitCode === 0
85
+ } catch {
86
+ return false
87
+ }
88
+ }
89
+
90
+ async function readRepositoryIdentity(cwd: string, gitArgs: readonly string[]): Promise<Map<string, string[]>> {
91
+ try {
92
+ const result = await runGit(
93
+ Bun,
94
+ cwd,
95
+ [...gitArgs, 'config', '--null', '--get-regexp', '^(user\\.(name|email)|typeclaw\\.fallbackidentity)$'],
96
+ {
97
+ env: { ...withoutGitOverrides(process.env), ...GIT_CONFIG_ENV },
98
+ },
99
+ )
35
100
  if (result.exitCode !== 0) return new Map()
36
101
  return parseNullConfigEntries(result.stdout)
37
102
  } catch {
@@ -54,6 +54,10 @@ export async function commitSystemFile(cwd: string, file: string | readonly stri
54
54
  await commit.exited
55
55
  }
56
56
 
57
+ // A git child that never exits would otherwise block the caller's thread for
58
+ // good, since a synchronous spawn cannot be interrupted from JavaScript.
59
+ const SPAWN_SYNC_TIMEOUT_MS = 30_000
60
+
57
61
  // Synchronous variant for callers that already hold a synchronous codepath
58
62
  // — specifically `persistMigratedConfig` in src/config/config.ts. The
59
63
  // migration write is itself synchronous (writeFileSync) and the call sites
@@ -83,6 +87,7 @@ export function commitSystemFileSync(cwd: string, file: string | readonly string
83
87
  cwd,
84
88
  stdout: 'pipe',
85
89
  stderr: 'pipe',
90
+ timeout: SPAWN_SYNC_TIMEOUT_MS,
86
91
  })
87
92
  if (status.exitCode !== 0) return
88
93
  if (new TextDecoder().decode(status.stdout).trim().length === 0) return
@@ -92,6 +97,7 @@ export function commitSystemFileSync(cwd: string, file: string | readonly string
92
97
  cwd,
93
98
  stdout: 'pipe',
94
99
  stderr: 'pipe',
100
+ timeout: SPAWN_SYNC_TIMEOUT_MS,
95
101
  })
96
102
  if (add.exitCode !== 0) return
97
103
 
@@ -100,6 +106,7 @@ export function commitSystemFileSync(cwd: string, file: string | readonly string
100
106
  cwd,
101
107
  stdout: 'pipe',
102
108
  stderr: 'pipe',
109
+ timeout: SPAWN_SYNC_TIMEOUT_MS,
103
110
  })
104
111
  }
105
112
 
@@ -28,6 +28,10 @@ export type BuildDockerfileOptions = {
28
28
  // hosts without buildx. `start` sets this to false when buildx is absent so
29
29
  // the legacy `docker build` can still build the agent image.
30
30
  buildKit?: boolean
31
+ // `typeclaw.json#typevault.enabled`: an enabled vault serves its one-time
32
+ // secret pages through a cloudflare-quick tunnel, so it needs cloudflared
33
+ // even when `docker.file.cloudflared` is off.
34
+ typevault?: boolean
31
35
  }
32
36
 
33
37
  // Apt packages that EVERY image must have — git for the agent runtime,
@@ -781,7 +785,7 @@ export function buildDockerfile(
781
785
  const cjkFonts = resolveCjkFonts(config.cjkFonts, options.cjkFontsAuto ?? false)
782
786
  const toggleAptArgs = collectToggleAptArgs(config, cjkFonts)
783
787
  const ghKeyringLayer = renderGhKeyringLayer(config.gh, buildKit)
784
- const cloudflaredLayer = renderCloudflaredLayer(config.cloudflared)
788
+ const cloudflaredLayer = renderCloudflaredLayer(config.cloudflared || options.typevault === true)
785
789
  const customLines = renderCustomDockerfileLines(config.append)
786
790
  const baseImageVersion = options.baseImageVersion ?? null
787
791
 
@@ -24,7 +24,7 @@ export const TRULY_IGNORED_PATTERNS = [
24
24
  // The reconciler MUST fail-closed and never untrack these, even if a custom
25
25
  // git.ignore.append pattern (e.g. `**`) matches them — doing so would drop
26
26
  // runtime-owned state out of git.
27
- export const SYSTEM_MANAGED_ROOTS = ['sessions/', 'memory/', 'channels/', 'todo/', 'cron/'] as const
27
+ export const SYSTEM_MANAGED_ROOTS = ['sessions/', 'memory/', 'channels/', 'todo/', 'cron/', '.typevault/'] as const
28
28
 
29
29
  export function buildGitignore(config: GitignoreConfig = { append: [] }): string {
30
30
  const customEntries = renderCustomGitignoreEntries(config.append)
@@ -51,8 +51,8 @@ ${TRULY_IGNORED_PATTERNS.join('\n')}
51
51
 
52
52
  # System-managed: gitignored by default so the agent never stages them by hand,
53
53
  # but TypeClaw force-commits them on its own schedule (sessions/ + todo/ via
54
- # auto-backup, memory/ via the dreaming subagent). Treat them as runtime-owned,
55
- # not agent-owned.
54
+ # auto-backup, memory/ via the dreaming subagent, .typevault/ ciphertext via
55
+ # auto-backup). Treat them as runtime-owned, not agent-owned.
56
56
  ${SYSTEM_MANAGED_ROOTS.join('\n')}
57
57
  `
58
58
  }
package/src/init/index.ts CHANGED
@@ -819,6 +819,7 @@ export async function writeDockerAssets(root: string): Promise<DockerAssetsResul
819
819
  // `null` selects the inline `oven/bun:1-slim` path in buildDockerfile.
820
820
  baseImageVersion: devMode ? null : resolveBaseImageVersion(root),
821
821
  cjkFontsAuto: hostLocaleIsCjk(),
822
+ typevault: typeclawConfig.typevault.enabled,
822
823
  }),
823
824
  { flag: 'wx' },
824
825
  ).catch(ignoreExists)
@@ -56,6 +56,8 @@ const PROVIDER_TO_MODELS_DEV: Record<KnownProviderId, string | null> = {
56
56
  // are retired for new users or don't serve chat. Surface the curated
57
57
  // Mercury 3 record alone.
58
58
  inception: null,
59
+ // models.dev has no EXAONE catalog. Surface the curated K-EXAONE 2.5 record.
60
+ exaone: null,
59
61
  }
60
62
 
61
63
  function upstreamProviderFor(
@@ -34,6 +34,8 @@ const PROVIDER_PROBE: Partial<Record<KnownProviderId, Probe>> = {
34
34
  opengateway: { url: 'https://apis.opengateway.ai/v1/me', authHeader: 'bearer', successShape: 'json-object' },
35
35
  // inception has no probe: its /v1/models is public and returns 200 for any
36
36
  // key, so probing it would vouch for garbage.
37
+ // exaone has no probe: the platform documents only /v1/chat/completions, and an
38
+ // undocumented /v1/models could reject a valid key.
37
39
  }
38
40
 
39
41
  // When a base-URL override (ANTHROPIC_BASE_URL / OPENAI_BASE_URL) points at a
@@ -197,6 +199,9 @@ export const API_KEY_DASHBOARD_URL: Partial<Record<KnownProviderId, string>> = {
197
199
  'moonshot-coding': 'https://www.kimi.com/code/console',
198
200
  opengateway: 'https://opengateway.ai/docs/reference/guides/authentication',
199
201
  inception: 'https://platform.inceptionlabs.ai',
202
+ // The overview page hosts the "Get an API Key" entry point; there is no
203
+ // separate console host.
204
+ exaone: 'https://docs.exaone.ai/en/docs/overview',
200
205
  }
201
206
 
202
207
  // MiniMax sells the same `minimax` provider under two billing surfaces that
@@ -4,6 +4,7 @@ import { join } from 'node:path'
4
4
  import lockfile from 'proper-lockfile'
5
5
 
6
6
  import { parseSecretsFile, SECRETS_FILE_VERSION } from '@/secrets/schema'
7
+ import { isTypevaultMarker } from '@/typevault/envelope-store'
7
8
 
8
9
  // PR #638 removed the in-memory v1->v2 upgrade that `parseSecretsFile` used to
9
10
  // perform, so a `secrets.json` still in v1 now fails to parse:
@@ -115,6 +116,7 @@ function upgradeFileInPlace(path: string): SecretsMigrationResult {
115
116
  return { changed: false, summary: 'secrets file unreadable; skipped' }
116
117
  }
117
118
  if (raw.trim() === '') return { changed: false, summary: 'secrets file empty; skipped' }
119
+ if (isTypevaultMarker(raw)) return { changed: false, summary: 'secrets kept in TypeVault; skipped' }
118
120
 
119
121
  let parsed: unknown
120
122
  try {
@@ -43,6 +43,11 @@ export const CORE_PERMISSIONS = {
43
43
  // channels). Granted with fsSeePrivate because the browser's file exchange
44
44
  // lives under workspace/, which that same tier already sees.
45
45
  browserShared: 'browser.shared',
46
+ // With typevault enabled, the session's bash receives a live TypeVault grant
47
+ // for its role's tier (and every tier that tier includes). A grant can still
48
+ // read a value with `typevault get --reveal`, so the tier, not this
49
+ // permission, is what keeps one role's secrets from a lower role.
50
+ vaultUse: 'vault.use',
46
51
  } as const
47
52
 
48
53
  // Sentinel that `expandOwnerWildcard` swaps for the concrete union of
@@ -93,6 +98,7 @@ export const BUILTIN_ROLES: Readonly<Record<BuiltinRoleName, BuiltinRoleSpec>> =
93
98
  CORE_PERMISSIONS.fsSeePrivate,
94
99
  CORE_PERMISSIONS.browserShared,
95
100
  CORE_PERMISSIONS.fsSeeSecrets,
101
+ CORE_PERMISSIONS.vaultUse,
96
102
  'security.bypass.low',
97
103
  'security.bypass.medium',
98
104
  'security.bypass.high',
@@ -113,6 +119,7 @@ export const BUILTIN_ROLES: Readonly<Record<BuiltinRoleName, BuiltinRoleSpec>> =
113
119
  CORE_PERMISSIONS.fsSeePrivate,
114
120
  CORE_PERMISSIONS.browserShared,
115
121
  CORE_PERMISSIONS.fsSeeSecrets,
122
+ CORE_PERMISSIONS.vaultUse,
116
123
  'security.bypass.low',
117
124
  'security.bypass.medium',
118
125
  ],
@@ -127,6 +134,7 @@ export const BUILTIN_ROLES: Readonly<Record<BuiltinRoleName, BuiltinRoleSpec>> =
127
134
  CORE_PERMISSIONS.subagentOutput,
128
135
  CORE_PERMISSIONS.fsSeePrivate,
129
136
  CORE_PERMISSIONS.browserShared,
137
+ CORE_PERMISSIONS.vaultUse,
130
138
  'security.bypass.low',
131
139
  ],
132
140
  },
@@ -21,6 +21,9 @@ export type ToolLogger = {
21
21
  export type ToolContext = {
22
22
  signal: AbortSignal | undefined
23
23
  sessionId: string
24
+ readonly origin?: SessionOrigin
25
+ // Current transcript leaf at invocation; absent for tools called outside a session.
26
+ readonly entryId?: string
24
27
  agentDir: string
25
28
  logger: ToolLogger
26
29
  }
@@ -56,6 +59,9 @@ export type SubagentContext<P = unknown> = {
56
59
 
57
60
  export type RunSession = (override?: {
58
61
  userPrompt?: string
62
+ // Trusted plugin handler override for this fresh session's system prompt.
63
+ // Payload fields are never forwarded here by the runtime.
64
+ systemPrompt?: string
59
65
  // Called after a completed run with the terminal assistant text, or null
60
66
  // after an empty terminal response or provider failure. No block projection.
61
67
  onFinalMessage?: (message: string | null) => void
@@ -1,4 +1,5 @@
1
1
  import agentBrowserPlugin from '@/bundled-plugins/agent-browser'
2
+ import agentMessengerCliAuthPlugin from '@/bundled-plugins/agent-messenger-cli-auth'
2
3
  import backupPlugin from '@/bundled-plugins/backup'
3
4
  import browserAgentPlugin from '@/bundled-plugins/browser-agent'
4
5
  import bunHygienePlugin from '@/bundled-plugins/bun-hygiene'
@@ -16,6 +17,7 @@ import reviewerPlugin from '@/bundled-plugins/reviewer'
16
17
  import scoutPlugin from '@/bundled-plugins/scout'
17
18
  import securityPlugin from '@/bundled-plugins/security'
18
19
  import toolResultCapPlugin from '@/bundled-plugins/tool-result-cap'
20
+ import typevaultPlugin from '@/bundled-plugins/typevault'
19
21
  import type { ResolvedPlugin } from '@/plugin'
20
22
 
21
23
  // Consumed by both `startAgent` (auto-loaded before user plugins) AND
@@ -48,6 +50,14 @@ import type { ResolvedPlugin } from '@/plugin'
48
50
  // ordering security first still matters so a blocked command never reaches the
49
51
  // mint path at all.
50
52
  //
53
+ // `agent-messenger-cli-auth` follows the same rule: security inspects the
54
+ // command before a channel bot token is minted into a CLI profile for it.
55
+ //
56
+ // `typevault` is registered right after `security` so its `tool.after`
57
+ // redaction sees the full tool output: if `tool-result-cap` truncated first, a
58
+ // secret cut at the cap boundary would no longer match and part of it could
59
+ // survive into the transcript.
60
+ //
51
61
  // `memory` is registered before `backup` so memory's dreaming commits always
52
62
  // land in the same git index window before backup's commit-and-push cycle.
53
63
  // They commit disjoint paths today (memory/ vs sessions/ + agent changes),
@@ -55,10 +65,12 @@ import type { ResolvedPlugin } from '@/plugin'
55
65
  // contention easier to reason about.
56
66
  export const BUNDLED_PLUGINS: ResolvedPlugin[] = [
57
67
  { name: 'security', version: undefined, source: '<bundled>', defined: securityPlugin },
68
+ { name: 'typevault', version: undefined, source: '<bundled>', defined: typevaultPlugin },
58
69
  { name: 'tool-result-cap', version: undefined, source: '<bundled>', defined: toolResultCapPlugin },
59
70
  { name: 'guard', version: undefined, source: '<bundled>', defined: guardPlugin },
60
71
  { name: 'bun-hygiene', version: undefined, source: '<bundled>', defined: bunHygienePlugin },
61
72
  { name: 'github-cli-auth', version: undefined, source: '<bundled>', defined: githubCliAuthPlugin },
73
+ { name: 'agent-messenger-cli-auth', version: undefined, source: '<bundled>', defined: agentMessengerCliAuthPlugin },
62
74
  { name: 'memory', version: undefined, source: '<bundled>', defined: memoryPlugin },
63
75
  { name: 'backup', version: undefined, source: '<bundled>', defined: backupPlugin },
64
76
  { name: 'agent-browser', version: undefined, source: '<bundled>', defined: agentBrowserPlugin },
@@ -10,6 +10,7 @@ import type { CreateSessionForSubagent, SubagentCoalescer, SubagentRegistry } fr
10
10
  import { capJsonlFileInPlace } from '@/bundled-plugins/tool-result-cap/cap-jsonl'
11
11
  import type { CapOptions } from '@/bundled-plugins/tool-result-cap/cap-result'
12
12
  import type { CreateSessionForChannel, ChannelRouter } from '@/channels'
13
+ import type { GetGithubSelf } from '@/channels/github-token-bridge'
13
14
  import type { McpManager } from '@/mcp'
14
15
  import type { PermissionService, RolesConfig } from '@/permissions'
15
16
  import type { ReloadRegistry } from '@/reload'
@@ -29,6 +30,7 @@ const consoleLogger: FactoryLogger = {
29
30
  }
30
31
 
31
32
  export type BuildChannelSessionFactoryDeps = {
33
+ readonly getGithubSelf?: GetGithubSelf
32
34
  cwd: string
33
35
  sessionFactory: SessionFactory
34
36
  stream: Stream
@@ -130,6 +132,7 @@ export function buildChannelSessionFactory(deps: BuildChannelSessionFactoryDeps)
130
132
 
131
133
  const snap = deps.pluginRuntime.get()
132
134
  const session = await createSession({
135
+ getGithubSelf: deps.getGithubSelf,
133
136
  reloadRegistry: deps.reloadRegistry,
134
137
  sessionManager,
135
138
  stream: deps.stream,