typeclaw 0.46.0 → 0.46.2

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 (75) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -2
  3. package/src/agent/multimodal/looker.ts +11 -1
  4. package/src/agent/network/safe-http.ts +17 -8
  5. package/src/agent/plugin-tools.ts +1 -3
  6. package/src/agent/tool-file-safety.ts +414 -145
  7. package/src/agent/tools/webfetch/fetch.ts +22 -2
  8. package/src/agent/tools/webfetch/strategies/jq.ts +1 -2
  9. package/src/agent/tools/webfetch/strategies/readability.ts +39 -16
  10. package/src/agent/tools/webfetch/strategies/selector.ts +4 -2
  11. package/src/agent/tools/webfetch/strategies/snapshot.ts +3 -2
  12. package/src/agent/tools/webfetch/tool.ts +3 -3
  13. package/src/agent/tools-without-local-file-operands.ts +9 -6
  14. package/src/bundled-plugins/backup/README.md +23 -10
  15. package/src/bundled-plugins/backup/git-auth.ts +6 -4
  16. package/src/bundled-plugins/backup/index.ts +104 -47
  17. package/src/bundled-plugins/backup/runner.ts +102 -5
  18. package/src/bundled-plugins/github-cli-auth/git-askpass.ts +74 -26
  19. package/src/bundled-plugins/github-cli-auth/git-command.ts +224 -36
  20. package/src/bundled-plugins/github-cli-auth/graphql-auth-nudge.ts +9 -9
  21. package/src/bundled-plugins/github-cli-auth/index.ts +110 -31
  22. package/src/bundled-plugins/github-cli-auth/token-class.ts +4 -6
  23. package/src/bundled-plugins/memory/README.md +9 -0
  24. package/src/bundled-plugins/memory/vector/embed-threads.ts +36 -0
  25. package/src/bundled-plugins/memory/vector/embedder.ts +19 -1
  26. package/src/bundled-plugins/memory/vector/hybrid.ts +10 -2
  27. package/src/bundled-plugins/memory/vector/store.ts +21 -9
  28. package/src/bundled-plugins/researcher/write-report.ts +3 -3
  29. package/src/bundled-plugins/security/policies/outbound-secret-scan.ts +8 -3
  30. package/src/bundled-plugins/security/policies/private-surface-read.ts +616 -50
  31. package/src/bundled-plugins/security/policies/ssrf.ts +119 -34
  32. package/src/channels/adapters/github/inbound.ts +11 -0
  33. package/src/channels/adapters/github/index.ts +48 -54
  34. package/src/channels/adapters/github/reconcile-cooldown-store.ts +178 -0
  35. package/src/channels/adapters/github/reconcile-open-prs.ts +31 -0
  36. package/src/channels/adapters/slack-bot-edit.ts +85 -20
  37. package/src/channels/adapters/slack-bot.ts +7 -2
  38. package/src/channels/adapters/slack-format.ts +245 -0
  39. package/src/channels/github-token-bridge.ts +2 -3
  40. package/src/cli/inspect.ts +16 -0
  41. package/src/container/docker-app.ts +42 -13
  42. package/src/container/shared.ts +19 -6
  43. package/src/container/start.ts +13 -0
  44. package/src/cron/bridge.ts +9 -2
  45. package/src/doctor/checks.ts +5 -2
  46. package/src/git/bound-gc-config.ts +82 -0
  47. package/src/hostd/spawn.ts +133 -47
  48. package/src/init/checkpoint.ts +4 -4
  49. package/src/init/dockerfile.ts +100 -88
  50. package/src/init/gitignore.ts +5 -6
  51. package/src/init/run-bun-install.ts +16 -2
  52. package/src/init/validate-api-key.ts +1 -0
  53. package/src/inspect/item-list.ts +12 -6
  54. package/src/inspect/replay.ts +21 -9
  55. package/src/inspect/session-list.ts +71 -33
  56. package/src/mcp/tools.ts +1 -0
  57. package/src/network/internal-destinations.ts +267 -0
  58. package/src/permissions/permissions.ts +93 -2
  59. package/src/plugin/types.ts +3 -2
  60. package/src/role-claim/code.ts +9 -5
  61. package/src/run/index.ts +45 -36
  62. package/src/sandbox/canonical-secrets.ts +6 -0
  63. package/src/sandbox/env-exposure.ts +18 -15
  64. package/src/sandbox/index.ts +1 -0
  65. package/src/sandbox/policy.ts +5 -3
  66. package/src/sandbox/privileged-runtime.ts +1 -0
  67. package/src/sandbox/symlinks.ts +1 -1
  68. package/src/secrets/export-claude-credentials-file.ts +13 -22
  69. package/src/secrets/export-codex-auth-file.ts +12 -28
  70. package/src/skills/typeclaw-config/SKILL.md +22 -6
  71. package/src/skills/typeclaw-permissions/SKILL.md +22 -9
  72. package/src/skills/typeclaw-plugins/SKILL.md +37 -0
  73. package/src/usage/scan.ts +11 -2
  74. package/typeclaw.schema.json +5 -0
  75. package/src/git/secret-history.ts +0 -371
package/README.md CHANGED
@@ -33,7 +33,7 @@
33
33
  ## Web & research — reads the web like a person
34
34
 
35
35
  - 🔍 **Live web search & fetch** — pull a page as a readable article, a JSON query, a selected slice, a grep, or raw
36
- - 🛡️ **Rebinding-safe page fetching** — validates every A/AAAA answer on the socket lookup and every redirect hop; private and mixed-address targets fail closed
36
+ - 🛡️ **Rebinding-safe page fetching** — validates every A/AAAA answer on the socket lookup and every redirect hop; private and mixed-address targets fail closed unless the operator supplies a boot-only, model-hidden application-layer exception, while cloud metadata and control-plane endpoints stay blocked
37
37
  - 🌐 **Interactive browser sessions** — drives a browser on live pages, with a dashboard you can step into for logins, 2FA, or CAPTCHA
38
38
 
39
39
  ## Security — defense-in-depth for risky actions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typeclaw",
3
- "version": "0.46.0",
3
+ "version": "0.46.2",
4
4
  "homepage": "https://github.com/typeclaw/typeclaw#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/typeclaw/typeclaw/issues"
@@ -50,7 +50,7 @@
50
50
  "@mariozechner/pi-tui": "^0.73.1",
51
51
  "@modelcontextprotocol/sdk": "^1.29.0",
52
52
  "@mozilla/readability": "^0.6.0",
53
- "agent-messenger": "^2.31.0",
53
+ "agent-messenger": "^2.32.3",
54
54
  "cheerio": "^1.2.0",
55
55
  "citty": "^0.2.2",
56
56
  "cron-parser": "^5.5.0",
@@ -13,6 +13,7 @@ import {
13
13
  type PublicHttpRequestOptions,
14
14
  type PublicHttpResponse,
15
15
  } from '@/agent/network/safe-http'
16
+ import type { InternalDestinationPolicy } from '@/network/internal-destinations'
16
17
 
17
18
  const SUPPORTED_MIME_TYPES = {
18
19
  '.png': 'image/png',
@@ -99,6 +100,7 @@ export async function resolveImagesBounded(
99
100
  inputs: ImageInput[],
100
101
  signal?: AbortSignal,
101
102
  network: LookAtNetworkDependencies = defaultLookAtNetwork,
103
+ internalDestinationPolicy?: InternalDestinationPolicy,
102
104
  ): Promise<ResolvedImage[]> {
103
105
  if (inputs.length > LOOK_AT_MAX_IMAGES) {
104
106
  throw new Error(`look_at: image count exceeds limit (${inputs.length} > ${LOOK_AT_MAX_IMAGES})`)
@@ -123,7 +125,13 @@ export async function resolveImagesBounded(
123
125
  try {
124
126
  while (next < inputs.length) {
125
127
  const index = next++
126
- results[index] = await resolveImage(inputs[index] as ImageInput, workerSignal, budget, network)
128
+ results[index] = await resolveImage(
129
+ inputs[index] as ImageInput,
130
+ workerSignal,
131
+ budget,
132
+ network,
133
+ internalDestinationPolicy,
134
+ )
127
135
  }
128
136
  } catch (error) {
129
137
  if (!failed) firstError = error
@@ -149,6 +157,7 @@ export async function resolveImage(
149
157
  signal?: AbortSignal,
150
158
  aggregateBudget?: ImageByteBudget,
151
159
  network: LookAtNetworkDependencies = defaultLookAtNetwork,
160
+ internalDestinationPolicy?: InternalDestinationPolicy,
152
161
  ): Promise<ResolvedImage> {
153
162
  if (input.kind === 'base64') {
154
163
  if (!input.mimeType.startsWith('image/')) {
@@ -207,6 +216,7 @@ export async function resolveImage(
207
216
  headers: { Accept: 'image/*' },
208
217
  maxRedirects: LOOK_AT_MAX_REDIRECTS,
209
218
  dependencies: network,
219
+ ...(internalDestinationPolicy === undefined ? {} : { internalDestinationPolicy }),
210
220
  })
211
221
  try {
212
222
  if (res.statusCode < 200 || res.statusCode >= 300) {
@@ -3,7 +3,8 @@ import { request as httpRequest, type IncomingHttpHeaders } from 'node:http'
3
3
  import { request as httpsRequest } from 'node:https'
4
4
  import { isIP, type LookupFunction } from 'node:net'
5
5
 
6
- import { classifyIpAddress, classifyUrl } from '@/bundled-plugins/security/policies/ssrf'
6
+ import { allowsInternalDestination, classifyIpAddress, classifyUrl } from '@/bundled-plugins/security/policies/ssrf'
7
+ import { getBootInternalDestinationPolicy, type InternalDestinationPolicy } from '@/network/internal-destinations'
7
8
 
8
9
  export type PublicHttpAddress = { address: string; family: 4 | 6 }
9
10
 
@@ -45,11 +46,13 @@ export async function requestPublicHttpUrl(
45
46
  onResponse?: (response: PublicHttpResponse, url: string) => void
46
47
  maxRedirects?: number
47
48
  dependencies?: PublicHttpDependencies
49
+ internalDestinationPolicy?: InternalDestinationPolicy
48
50
  },
49
51
  ): Promise<PublicHttpResult> {
50
52
  const dependencies = options.dependencies ?? defaultPublicHttpDependencies
51
53
  const maxRedirects = options.maxRedirects ?? DEFAULT_PUBLIC_HTTP_MAX_REDIRECTS
52
- let current = requirePublicHttpUrl(rawUrl)
54
+ const internalDestinationPolicy = options.internalDestinationPolicy ?? getBootInternalDestinationPolicy()
55
+ let current = requirePublicHttpUrl(rawUrl, internalDestinationPolicy)
53
56
  const initialOrigin = new URL(current).origin
54
57
  for (let redirects = 0; redirects <= maxRedirects; redirects++) {
55
58
  const parsed = new URL(current)
@@ -67,7 +70,7 @@ export async function requestPublicHttpUrl(
67
70
  },
68
71
  ...(parsed.protocol === 'https:' ? { servername: hostname } : {}),
69
72
  signal: options.signal,
70
- lookup: createPublicSocketLookup(dependencies.resolveAddresses),
73
+ lookup: createPublicSocketLookup(dependencies.resolveAddresses, internalDestinationPolicy),
71
74
  autoSelectFamily: false,
72
75
  })
73
76
  options.onResponse?.(response, current)
@@ -76,7 +79,7 @@ export async function requestPublicHttpUrl(
76
79
  const location = headerValue(response.headers, 'location')
77
80
  if (location === null) throw new Error(`redirect from ${current} omitted the Location header`)
78
81
  if (redirects === maxRedirects) throw new Error(`redirect limit exceeded (${maxRedirects})`)
79
- current = requirePublicHttpUrl(new URL(location, current).toString())
82
+ current = requirePublicHttpUrl(new URL(location, current).toString(), internalDestinationPolicy)
80
83
  } finally {
81
84
  response.cancel()
82
85
  }
@@ -95,7 +98,10 @@ function headersForHop(
95
98
  )
96
99
  }
97
100
 
98
- export function createPublicSocketLookup(resolveAddresses: PublicHttpDependencies['resolveAddresses']): LookupFunction {
101
+ export function createPublicSocketLookup(
102
+ resolveAddresses: PublicHttpDependencies['resolveAddresses'],
103
+ internalDestinationPolicy: InternalDestinationPolicy = getBootInternalDestinationPolicy(),
104
+ ): LookupFunction {
99
105
  return (hostname, options, callback) => {
100
106
  void resolveAddresses(hostname).then(
101
107
  (addresses) => {
@@ -110,7 +116,10 @@ export function createPublicSocketLookup(resolveAddresses: PublicHttpDependencie
110
116
  return
111
117
  }
112
118
  const classification = classifyIpAddress(candidate.address)
113
- if (classification.blocked) {
119
+ if (
120
+ classification.blocked &&
121
+ !allowsInternalDestination(hostname, candidate.address, internalDestinationPolicy)
122
+ ) {
114
123
  callback(
115
124
  new Error(
116
125
  `DNS lookup rejected non-public address for ${hostname}: ${classification.reason ?? candidate.address}`,
@@ -170,7 +179,7 @@ export const defaultPublicHttpDependencies: PublicHttpDependencies = {
170
179
  },
171
180
  }
172
181
 
173
- function requirePublicHttpUrl(rawUrl: string): string {
182
+ function requirePublicHttpUrl(rawUrl: string, internalDestinationPolicy: InternalDestinationPolicy): string {
174
183
  let parsed: URL
175
184
  try {
176
185
  parsed = new URL(rawUrl)
@@ -180,7 +189,7 @@ function requirePublicHttpUrl(rawUrl: string): string {
180
189
  if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
181
190
  throw new Error(`URL must use public HTTP(S), not ${parsed.protocol}`)
182
191
  }
183
- const classification = classifyUrl(parsed.toString())
192
+ const classification = classifyUrl(parsed.toString(), internalDestinationPolicy)
184
193
  if (classification.blocked) {
185
194
  throw new Error(
186
195
  `SSRF policy rejected non-public URL (${classification.category ?? 'internal'}): ${classification.reason ?? rawUrl}`,
@@ -24,7 +24,6 @@ import {
24
24
  checkSkillAuthoringGuard,
25
25
  } from '@/bundled-plugins/guard/policy'
26
26
  import { config, getSandboxWritablePathSpecs } from '@/config/config'
27
- import { assertNoCanonicalSecretsInGit } from '@/git/secret-history'
28
27
  import { readEnvFile } from '@/init/env-file'
29
28
  import type { PermissionService } from '@/permissions/permissions'
30
29
  import type {
@@ -365,6 +364,7 @@ export function wrapPluginTool(tool: Tool<any>, opts: WrapToolOptions): ToolDefi
365
364
  agentDir: opts.agentDir,
366
365
  genericInputs: true,
367
366
  fileOperands: tool.fileOperands,
367
+ logger: opts.logger,
368
368
  signal,
369
369
  })
370
370
  try {
@@ -732,8 +732,6 @@ async function applyBashSandbox(
732
732
  const command = mutableArgs.command
733
733
  if (typeof command !== 'string') return { verify: async () => {}, cleanup: async () => {} }
734
734
 
735
- await assertNoCanonicalSecretsInGit(agentDir)
736
-
737
735
  const { dirs, files } = resolveHiddenPaths(permissions, origin, agentDir)
738
736
  const sandboxEnvOverlay = buildRoleScopedConfigEnv(agentDir, dirs, envOverlay)
739
737
  const maskTargets = await ensureHiddenMaskTargets({ dirs, files })