@ikarmic/forge-core 4.5.0 → 5.1.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 (643) hide show
  1. package/LICENSE +44 -21
  2. package/README.md +1 -1
  3. package/dist/agent/agent.d.ts +8 -1
  4. package/dist/agent/agent.js +143 -23
  5. package/dist/agent/architect.d.ts +0 -1
  6. package/dist/agent/architect.js +0 -1
  7. package/dist/agent/background.d.ts +58 -0
  8. package/dist/agent/background.js +139 -0
  9. package/dist/agent/cache-hints.d.ts +0 -1
  10. package/dist/agent/cache-hints.js +0 -1
  11. package/dist/agent/cost-router.d.ts +0 -1
  12. package/dist/agent/cost-router.js +0 -1
  13. package/dist/agent/enhance-prompt.d.ts +9 -0
  14. package/dist/agent/enhance-prompt.js +34 -0
  15. package/dist/agent/goal.d.ts +54 -0
  16. package/dist/agent/goal.js +65 -0
  17. package/dist/agent/index.d.ts +0 -1
  18. package/dist/agent/index.js +0 -1
  19. package/dist/agent/loop-guard.d.ts +21 -0
  20. package/dist/agent/loop-guard.js +41 -0
  21. package/dist/agent/prompts.d.ts +0 -1
  22. package/dist/agent/prompts.js +0 -1
  23. package/dist/agent/think-tags.d.ts +0 -1
  24. package/dist/agent/think-tags.js +0 -1
  25. package/dist/agent/verify.d.ts +0 -1
  26. package/dist/agent/verify.js +0 -1
  27. package/dist/agents/agent-files.d.ts +43 -0
  28. package/dist/agents/agent-files.js +109 -0
  29. package/dist/ai-comments/index.d.ts +0 -1
  30. package/dist/ai-comments/index.js +0 -1
  31. package/dist/attachments.d.ts +0 -1
  32. package/dist/attachments.js +0 -1
  33. package/dist/browser/cdp.d.ts +0 -1
  34. package/dist/browser/cdp.js +0 -1
  35. package/dist/browser/chrome.d.ts +0 -1
  36. package/dist/browser/chrome.js +0 -1
  37. package/dist/browser/session.d.ts +0 -1
  38. package/dist/browser/session.js +0 -1
  39. package/dist/checkpoints/index.d.ts +0 -1
  40. package/dist/checkpoints/index.js +0 -1
  41. package/dist/checkpoints/store.d.ts +0 -1
  42. package/dist/checkpoints/store.js +5 -2
  43. package/dist/checkpoints/types.d.ts +0 -1
  44. package/dist/checkpoints/types.js +0 -1
  45. package/dist/code-index/builder.d.ts +0 -1
  46. package/dist/code-index/builder.js +0 -1
  47. package/dist/code-index/index-store.d.ts +0 -1
  48. package/dist/code-index/index-store.js +0 -1
  49. package/dist/code-index/parser.d.ts +0 -1
  50. package/dist/code-index/parser.js +0 -1
  51. package/dist/code-index/types.d.ts +0 -1
  52. package/dist/code-index/types.js +0 -1
  53. package/dist/commands/custom-commands.d.ts +9 -5
  54. package/dist/commands/custom-commands.js +13 -3
  55. package/dist/config-file.d.ts +47 -1
  56. package/dist/config-file.js +249 -6
  57. package/dist/config-merge.d.ts +13 -0
  58. package/dist/config-merge.js +67 -0
  59. package/dist/config-schema.d.ts +340 -0
  60. package/dist/config-schema.js +126 -0
  61. package/dist/config.d.ts +0 -1
  62. package/dist/config.js +2 -2
  63. package/dist/context/compaction.d.ts +0 -1
  64. package/dist/context/compaction.js +10 -2
  65. package/dist/context/mask.d.ts +0 -1
  66. package/dist/context/mask.js +1 -2
  67. package/dist/credentials/index.d.ts +0 -1
  68. package/dist/credentials/index.js +0 -1
  69. package/dist/credentials/types.d.ts +0 -1
  70. package/dist/credentials/types.js +0 -1
  71. package/dist/custom-providers.d.ts +95 -0
  72. package/dist/custom-providers.js +120 -0
  73. package/dist/diff/index.d.ts +0 -1
  74. package/dist/diff/index.js +0 -1
  75. package/dist/diff/unified-diff.d.ts +0 -1
  76. package/dist/diff/unified-diff.js +0 -1
  77. package/dist/git/auto-commit.d.ts +3 -4
  78. package/dist/git/auto-commit.js +8 -7
  79. package/dist/git/index.d.ts +0 -1
  80. package/dist/git/index.js +0 -1
  81. package/dist/github/github-tools.d.ts +2 -3
  82. package/dist/github/github-tools.js +0 -1
  83. package/dist/hooks/agent-runner.d.ts +0 -1
  84. package/dist/hooks/agent-runner.js +0 -1
  85. package/dist/hooks/bus.d.ts +0 -1
  86. package/dist/hooks/bus.js +0 -1
  87. package/dist/hooks/config.d.ts +0 -1
  88. package/dist/hooks/config.js +0 -1
  89. package/dist/hooks/events.d.ts +0 -1
  90. package/dist/hooks/events.js +0 -1
  91. package/dist/hooks/index.d.ts +0 -1
  92. package/dist/hooks/index.js +0 -1
  93. package/dist/hooks/loader.d.ts +0 -1
  94. package/dist/hooks/loader.js +0 -1
  95. package/dist/hooks/runner.d.ts +0 -1
  96. package/dist/hooks/runner.js +3 -3
  97. package/dist/hooks/watch-coalescer.d.ts +0 -1
  98. package/dist/hooks/watch-coalescer.js +0 -1
  99. package/dist/hooks/watch-ignore.d.ts +0 -1
  100. package/dist/hooks/watch-ignore.js +0 -1
  101. package/dist/hooks/watcher.d.ts +0 -1
  102. package/dist/hooks/watcher.js +0 -1
  103. package/dist/import/claude-code.d.ts +39 -0
  104. package/dist/import/claude-code.js +254 -0
  105. package/dist/index.d.ts +37 -7
  106. package/dist/index.js +28 -5
  107. package/dist/lazy-model.d.ts +0 -1
  108. package/dist/lazy-model.js +0 -1
  109. package/dist/lint/auto-lint.d.ts +0 -1
  110. package/dist/lint/auto-lint.js +0 -1
  111. package/dist/lint/index.d.ts +0 -1
  112. package/dist/lint/index.js +0 -1
  113. package/dist/lsp/client.d.ts +5 -1
  114. package/dist/lsp/client.js +39 -4
  115. package/dist/lsp/diagnostics.d.ts +0 -1
  116. package/dist/lsp/diagnostics.js +0 -1
  117. package/dist/lsp/index.d.ts +0 -1
  118. package/dist/lsp/index.js +0 -1
  119. package/dist/mcp/catalog.d.ts +0 -1
  120. package/dist/mcp/catalog.js +0 -1
  121. package/dist/mcp/index.d.ts +5 -2
  122. package/dist/mcp/index.js +3 -2
  123. package/dist/mcp/json-schema-to-zod.d.ts +0 -1
  124. package/dist/mcp/json-schema-to-zod.js +0 -1
  125. package/dist/mcp/manager.d.ts +17 -4
  126. package/dist/mcp/manager.js +27 -3
  127. package/dist/mcp/marketplace-types.d.ts +0 -1
  128. package/dist/mcp/marketplace-types.js +0 -1
  129. package/dist/mcp/marketplace.d.ts +2 -1
  130. package/dist/mcp/marketplace.js +10 -5
  131. package/dist/mcp/mcp-client.d.ts +12 -3
  132. package/dist/mcp/mcp-client.js +74 -18
  133. package/dist/mcp/mcp-config.d.ts +2 -1
  134. package/dist/mcp/mcp-config.js +1 -1
  135. package/dist/mcp/oauth.d.ts +55 -0
  136. package/dist/mcp/oauth.js +197 -0
  137. package/dist/mcp/registry.d.ts +0 -1
  138. package/dist/mcp/registry.js +0 -1
  139. package/dist/mcp/resource-tools.d.ts +8 -0
  140. package/dist/mcp/resource-tools.js +56 -0
  141. package/dist/memory/memory-store.d.ts +0 -1
  142. package/dist/memory/memory-store.js +0 -1
  143. package/dist/memory/rank.d.ts +0 -1
  144. package/dist/memory/rank.js +0 -1
  145. package/dist/memory/session-digest.d.ts +12 -0
  146. package/dist/memory/session-digest.js +47 -0
  147. package/dist/memory/stale.d.ts +0 -1
  148. package/dist/memory/stale.js +2 -2
  149. package/dist/model-alias.d.ts +18 -3
  150. package/dist/model-alias.js +27 -4
  151. package/dist/model-catalog.d.ts +0 -1
  152. package/dist/model-catalog.js +0 -2
  153. package/dist/model-list.d.ts +0 -1
  154. package/dist/model-list.js +2 -2
  155. package/dist/model-overrides.d.ts +30 -0
  156. package/dist/model-overrides.js +48 -0
  157. package/dist/orchestrator/board-tools.d.ts +0 -1
  158. package/dist/orchestrator/board-tools.js +0 -1
  159. package/dist/orchestrator/board.d.ts +0 -1
  160. package/dist/orchestrator/board.js +0 -1
  161. package/dist/orchestrator/index.d.ts +0 -1
  162. package/dist/orchestrator/index.js +0 -1
  163. package/dist/orchestrator/orchestrator.d.ts +0 -1
  164. package/dist/orchestrator/orchestrator.js +0 -1
  165. package/dist/orchestrator/router.d.ts +0 -1
  166. package/dist/orchestrator/router.js +0 -1
  167. package/dist/orchestrator/specialists-registry.d.ts +0 -1
  168. package/dist/orchestrator/specialists-registry.js +2 -4
  169. package/dist/orchestrator/specialists.d.ts +0 -1
  170. package/dist/orchestrator/specialists.js +4 -5
  171. package/dist/orchestrator/types.d.ts +0 -1
  172. package/dist/orchestrator/types.js +0 -1
  173. package/dist/plugins/index.d.ts +0 -1
  174. package/dist/plugins/index.js +0 -1
  175. package/dist/plugins/install.d.ts +0 -1
  176. package/dist/plugins/install.js +0 -1
  177. package/dist/plugins/loader.d.ts +0 -1
  178. package/dist/plugins/loader.js +0 -1
  179. package/dist/policy/audit.d.ts +0 -1
  180. package/dist/policy/audit.js +0 -1
  181. package/dist/policy/ca-certs.d.ts +8 -0
  182. package/dist/policy/ca-certs.js +30 -0
  183. package/dist/policy/policy.d.ts +0 -1
  184. package/dist/policy/policy.js +0 -1
  185. package/dist/policy/proxy.d.ts +10 -4
  186. package/dist/policy/proxy.js +33 -7
  187. package/dist/pricing.d.ts +0 -1
  188. package/dist/pricing.js +4 -1
  189. package/dist/providers.d.ts +7 -1
  190. package/dist/providers.js +39 -6
  191. package/dist/repomap/index.d.ts +0 -1
  192. package/dist/repomap/index.js +0 -1
  193. package/dist/repomap/repo-map.d.ts +0 -1
  194. package/dist/repomap/repo-map.js +0 -1
  195. package/dist/semantic/chunker.d.ts +0 -1
  196. package/dist/semantic/chunker.js +0 -1
  197. package/dist/semantic/embedder.d.ts +15 -1
  198. package/dist/semantic/embedder.js +25 -1
  199. package/dist/semantic/semantic-index.d.ts +10 -3
  200. package/dist/semantic/semantic-index.js +16 -8
  201. package/dist/semantic/vector-store.d.ts +0 -1
  202. package/dist/semantic/vector-store.js +0 -1
  203. package/dist/sessions/index.d.ts +1 -1
  204. package/dist/sessions/index.js +1 -1
  205. package/dist/sessions/prune.d.ts +23 -0
  206. package/dist/sessions/prune.js +35 -0
  207. package/dist/sessions/search.d.ts +0 -1
  208. package/dist/sessions/search.js +0 -1
  209. package/dist/sessions/session-export.d.ts +0 -1
  210. package/dist/sessions/session-export.js +0 -1
  211. package/dist/sessions/session-store.d.ts +0 -1
  212. package/dist/sessions/session-store.js +2 -2
  213. package/dist/sessions/watch.d.ts +0 -1
  214. package/dist/sessions/watch.js +0 -1
  215. package/dist/settings-export.d.ts +0 -1
  216. package/dist/settings-export.js +0 -1
  217. package/dist/skills/activator.d.ts +0 -1
  218. package/dist/skills/activator.js +0 -1
  219. package/dist/skills/builtin.d.ts +2 -0
  220. package/dist/skills/builtin.js +68 -0
  221. package/dist/skills/index.d.ts +2 -1
  222. package/dist/skills/index.js +2 -1
  223. package/dist/skills/loader.d.ts +10 -4
  224. package/dist/skills/loader.js +20 -8
  225. package/dist/skills/marketplace-types.d.ts +0 -1
  226. package/dist/skills/marketplace-types.js +0 -1
  227. package/dist/skills/marketplace.d.ts +0 -1
  228. package/dist/skills/marketplace.js +2 -2
  229. package/dist/skills/parser.d.ts +0 -1
  230. package/dist/skills/parser.js +0 -1
  231. package/dist/skills/remote.d.ts +14 -0
  232. package/dist/skills/remote.js +131 -0
  233. package/dist/skills/types.d.ts +10 -1
  234. package/dist/skills/types.js +0 -1
  235. package/dist/specs/generate.d.ts +0 -1
  236. package/dist/specs/generate.js +0 -1
  237. package/dist/specs/index.d.ts +0 -1
  238. package/dist/specs/index.js +0 -1
  239. package/dist/specs/store.d.ts +0 -1
  240. package/dist/specs/store.js +0 -1
  241. package/dist/specs/sync.d.ts +0 -1
  242. package/dist/specs/sync.js +0 -1
  243. package/dist/specs/tasks-parser.d.ts +0 -1
  244. package/dist/specs/tasks-parser.js +0 -1
  245. package/dist/specs/types.d.ts +0 -1
  246. package/dist/specs/types.js +0 -1
  247. package/dist/steering/extra-instructions.d.ts +8 -0
  248. package/dist/steering/extra-instructions.js +104 -0
  249. package/dist/steering/folder-instructions.d.ts +8 -0
  250. package/dist/steering/folder-instructions.js +28 -0
  251. package/dist/steering/glob.d.ts +0 -1
  252. package/dist/steering/glob.js +0 -1
  253. package/dist/steering/index.d.ts +0 -1
  254. package/dist/steering/index.js +0 -1
  255. package/dist/steering/loader.d.ts +0 -1
  256. package/dist/steering/loader.js +0 -1
  257. package/dist/steering/project-instructions.d.ts +0 -1
  258. package/dist/steering/project-instructions.js +0 -1
  259. package/dist/steering/select.d.ts +0 -1
  260. package/dist/steering/select.js +2 -2
  261. package/dist/steering/types.d.ts +0 -1
  262. package/dist/steering/types.js +0 -1
  263. package/dist/structured/index.d.ts +0 -1
  264. package/dist/structured/index.js +0 -1
  265. package/dist/structured/retry.d.ts +0 -1
  266. package/dist/structured/retry.js +0 -1
  267. package/dist/structured/schema.d.ts +0 -1
  268. package/dist/structured/schema.js +0 -1
  269. package/dist/timed-fetch.d.ts +12 -0
  270. package/dist/timed-fetch.js +83 -0
  271. package/dist/tools/apply-patch.d.ts +52 -0
  272. package/dist/tools/apply-patch.js +197 -0
  273. package/dist/tools/ask-user.d.ts +27 -0
  274. package/dist/tools/ask-user.js +32 -0
  275. package/dist/tools/browser-tools.d.ts +6 -7
  276. package/dist/tools/browser-tools.js +3 -14
  277. package/dist/tools/codebase-search.d.ts +4 -3
  278. package/dist/tools/codebase-search.js +2 -3
  279. package/dist/tools/command-allow.d.ts +0 -1
  280. package/dist/tools/command-allow.js +0 -1
  281. package/dist/tools/edit-file.d.ts +0 -1
  282. package/dist/tools/edit-file.js +5 -4
  283. package/dist/tools/fetch-url.d.ts +7 -1
  284. package/dist/tools/fetch-url.js +52 -20
  285. package/dist/tools/find-references.d.ts +0 -1
  286. package/dist/tools/find-references.js +0 -1
  287. package/dist/tools/find-symbol.d.ts +2 -3
  288. package/dist/tools/find-symbol.js +0 -1
  289. package/dist/tools/ignore-rules.d.ts +0 -1
  290. package/dist/tools/ignore-rules.js +2 -2
  291. package/dist/tools/index.d.ts +5 -2
  292. package/dist/tools/index.js +10 -2
  293. package/dist/tools/list-files.d.ts +0 -1
  294. package/dist/tools/list-files.js +0 -1
  295. package/dist/tools/list-symbols.d.ts +0 -1
  296. package/dist/tools/list-symbols.js +0 -1
  297. package/dist/tools/memory.d.ts +6 -7
  298. package/dist/tools/memory.js +0 -1
  299. package/dist/tools/notebook.d.ts +2 -3
  300. package/dist/tools/notebook.js +0 -1
  301. package/dist/tools/permission-rules.d.ts +32 -0
  302. package/dist/tools/permission-rules.js +182 -0
  303. package/dist/tools/policy.d.ts +0 -1
  304. package/dist/tools/policy.js +0 -1
  305. package/dist/tools/read-file.d.ts +5 -1
  306. package/dist/tools/read-file.js +7 -3
  307. package/dist/tools/read-image.d.ts +0 -1
  308. package/dist/tools/read-image.js +0 -1
  309. package/dist/tools/read-only.d.ts +1 -2
  310. package/dist/tools/read-only.js +2 -1
  311. package/dist/tools/redact.d.ts +0 -1
  312. package/dist/tools/redact.js +0 -1
  313. package/dist/tools/result-cache.d.ts +0 -1
  314. package/dist/tools/result-cache.js +0 -1
  315. package/dist/tools/run-command.d.ts +4 -3
  316. package/dist/tools/run-command.js +12 -9
  317. package/dist/tools/sandbox-loader.d.ts +0 -1
  318. package/dist/tools/sandbox-loader.js +3 -14
  319. package/dist/tools/search-files.d.ts +8 -3
  320. package/dist/tools/search-files.js +43 -1
  321. package/dist/tools/shared.d.ts +5 -1
  322. package/dist/tools/shared.js +30 -3
  323. package/dist/tools/shell-env.d.ts +7 -0
  324. package/dist/tools/shell-env.js +9 -0
  325. package/dist/tools/sub-agent-wait.d.ts +29 -0
  326. package/dist/tools/sub-agent-wait.js +60 -0
  327. package/dist/tools/sub-agent.d.ts +50 -5
  328. package/dist/tools/sub-agent.js +210 -126
  329. package/dist/tools/text-encoding.d.ts +10 -0
  330. package/dist/tools/text-encoding.js +40 -0
  331. package/dist/tools/todo.d.ts +36 -0
  332. package/dist/tools/todo.js +42 -0
  333. package/dist/tools/web-search.d.ts +0 -1
  334. package/dist/tools/web-search.js +0 -1
  335. package/dist/tools/write-file.d.ts +0 -1
  336. package/dist/tools/write-file.js +15 -10
  337. package/dist/tools/write-tools.d.ts +12 -0
  338. package/dist/tools/write-tools.js +18 -0
  339. package/dist/types.d.ts +85 -2
  340. package/dist/types.js +0 -1
  341. package/dist/verify/detect.d.ts +0 -1
  342. package/dist/verify/detect.js +0 -1
  343. package/dist/verify/index.d.ts +0 -1
  344. package/dist/verify/index.js +0 -1
  345. package/dist/worktree/branch-ops.d.ts +0 -1
  346. package/dist/worktree/branch-ops.js +0 -1
  347. package/dist/worktree/index.d.ts +0 -1
  348. package/dist/worktree/index.js +0 -1
  349. package/dist/worktree/worktree.d.ts +3 -1
  350. package/dist/worktree/worktree.js +22 -1
  351. package/package.json +3 -2
  352. package/dist/agent/agent.d.ts.map +0 -1
  353. package/dist/agent/agent.js.map +0 -1
  354. package/dist/agent/architect.d.ts.map +0 -1
  355. package/dist/agent/architect.js.map +0 -1
  356. package/dist/agent/cache-hints.d.ts.map +0 -1
  357. package/dist/agent/cache-hints.js.map +0 -1
  358. package/dist/agent/cost-router.d.ts.map +0 -1
  359. package/dist/agent/cost-router.js.map +0 -1
  360. package/dist/agent/index.d.ts.map +0 -1
  361. package/dist/agent/index.js.map +0 -1
  362. package/dist/agent/prompts.d.ts.map +0 -1
  363. package/dist/agent/prompts.js.map +0 -1
  364. package/dist/agent/think-tags.d.ts.map +0 -1
  365. package/dist/agent/think-tags.js.map +0 -1
  366. package/dist/agent/verify.d.ts.map +0 -1
  367. package/dist/agent/verify.js.map +0 -1
  368. package/dist/ai-comments/index.d.ts.map +0 -1
  369. package/dist/ai-comments/index.js.map +0 -1
  370. package/dist/attachments.d.ts.map +0 -1
  371. package/dist/attachments.js.map +0 -1
  372. package/dist/browser/cdp.d.ts.map +0 -1
  373. package/dist/browser/cdp.js.map +0 -1
  374. package/dist/browser/chrome.d.ts.map +0 -1
  375. package/dist/browser/chrome.js.map +0 -1
  376. package/dist/browser/session.d.ts.map +0 -1
  377. package/dist/browser/session.js.map +0 -1
  378. package/dist/checkpoints/index.d.ts.map +0 -1
  379. package/dist/checkpoints/index.js.map +0 -1
  380. package/dist/checkpoints/store.d.ts.map +0 -1
  381. package/dist/checkpoints/store.js.map +0 -1
  382. package/dist/checkpoints/types.d.ts.map +0 -1
  383. package/dist/checkpoints/types.js.map +0 -1
  384. package/dist/code-index/builder.d.ts.map +0 -1
  385. package/dist/code-index/builder.js.map +0 -1
  386. package/dist/code-index/index-store.d.ts.map +0 -1
  387. package/dist/code-index/index-store.js.map +0 -1
  388. package/dist/code-index/parser.d.ts.map +0 -1
  389. package/dist/code-index/parser.js.map +0 -1
  390. package/dist/code-index/types.d.ts.map +0 -1
  391. package/dist/code-index/types.js.map +0 -1
  392. package/dist/commands/custom-commands.d.ts.map +0 -1
  393. package/dist/commands/custom-commands.js.map +0 -1
  394. package/dist/config-file.d.ts.map +0 -1
  395. package/dist/config-file.js.map +0 -1
  396. package/dist/config.d.ts.map +0 -1
  397. package/dist/config.js.map +0 -1
  398. package/dist/context/compaction.d.ts.map +0 -1
  399. package/dist/context/compaction.js.map +0 -1
  400. package/dist/context/mask.d.ts.map +0 -1
  401. package/dist/context/mask.js.map +0 -1
  402. package/dist/credentials/index.d.ts.map +0 -1
  403. package/dist/credentials/index.js.map +0 -1
  404. package/dist/credentials/types.d.ts.map +0 -1
  405. package/dist/credentials/types.js.map +0 -1
  406. package/dist/diff/index.d.ts.map +0 -1
  407. package/dist/diff/index.js.map +0 -1
  408. package/dist/diff/unified-diff.d.ts.map +0 -1
  409. package/dist/diff/unified-diff.js.map +0 -1
  410. package/dist/git/auto-commit.d.ts.map +0 -1
  411. package/dist/git/auto-commit.js.map +0 -1
  412. package/dist/git/index.d.ts.map +0 -1
  413. package/dist/git/index.js.map +0 -1
  414. package/dist/github/github-tools.d.ts.map +0 -1
  415. package/dist/github/github-tools.js.map +0 -1
  416. package/dist/hooks/agent-runner.d.ts.map +0 -1
  417. package/dist/hooks/agent-runner.js.map +0 -1
  418. package/dist/hooks/bus.d.ts.map +0 -1
  419. package/dist/hooks/bus.js.map +0 -1
  420. package/dist/hooks/config.d.ts.map +0 -1
  421. package/dist/hooks/config.js.map +0 -1
  422. package/dist/hooks/events.d.ts.map +0 -1
  423. package/dist/hooks/events.js.map +0 -1
  424. package/dist/hooks/index.d.ts.map +0 -1
  425. package/dist/hooks/index.js.map +0 -1
  426. package/dist/hooks/loader.d.ts.map +0 -1
  427. package/dist/hooks/loader.js.map +0 -1
  428. package/dist/hooks/runner.d.ts.map +0 -1
  429. package/dist/hooks/runner.js.map +0 -1
  430. package/dist/hooks/watch-coalescer.d.ts.map +0 -1
  431. package/dist/hooks/watch-coalescer.js.map +0 -1
  432. package/dist/hooks/watch-ignore.d.ts.map +0 -1
  433. package/dist/hooks/watch-ignore.js.map +0 -1
  434. package/dist/hooks/watcher.d.ts.map +0 -1
  435. package/dist/hooks/watcher.js.map +0 -1
  436. package/dist/index.d.ts.map +0 -1
  437. package/dist/index.js.map +0 -1
  438. package/dist/lazy-model.d.ts.map +0 -1
  439. package/dist/lazy-model.js.map +0 -1
  440. package/dist/lint/auto-lint.d.ts.map +0 -1
  441. package/dist/lint/auto-lint.js.map +0 -1
  442. package/dist/lint/index.d.ts.map +0 -1
  443. package/dist/lint/index.js.map +0 -1
  444. package/dist/lsp/client.d.ts.map +0 -1
  445. package/dist/lsp/client.js.map +0 -1
  446. package/dist/lsp/diagnostics.d.ts.map +0 -1
  447. package/dist/lsp/diagnostics.js.map +0 -1
  448. package/dist/lsp/index.d.ts.map +0 -1
  449. package/dist/lsp/index.js.map +0 -1
  450. package/dist/mcp/catalog.d.ts.map +0 -1
  451. package/dist/mcp/catalog.js.map +0 -1
  452. package/dist/mcp/index.d.ts.map +0 -1
  453. package/dist/mcp/index.js.map +0 -1
  454. package/dist/mcp/json-schema-to-zod.d.ts.map +0 -1
  455. package/dist/mcp/json-schema-to-zod.js.map +0 -1
  456. package/dist/mcp/manager.d.ts.map +0 -1
  457. package/dist/mcp/manager.js.map +0 -1
  458. package/dist/mcp/marketplace-types.d.ts.map +0 -1
  459. package/dist/mcp/marketplace-types.js.map +0 -1
  460. package/dist/mcp/marketplace.d.ts.map +0 -1
  461. package/dist/mcp/marketplace.js.map +0 -1
  462. package/dist/mcp/mcp-client.d.ts.map +0 -1
  463. package/dist/mcp/mcp-client.js.map +0 -1
  464. package/dist/mcp/mcp-config.d.ts.map +0 -1
  465. package/dist/mcp/mcp-config.js.map +0 -1
  466. package/dist/mcp/registry.d.ts.map +0 -1
  467. package/dist/mcp/registry.js.map +0 -1
  468. package/dist/memory/memory-store.d.ts.map +0 -1
  469. package/dist/memory/memory-store.js.map +0 -1
  470. package/dist/memory/rank.d.ts.map +0 -1
  471. package/dist/memory/rank.js.map +0 -1
  472. package/dist/memory/stale.d.ts.map +0 -1
  473. package/dist/memory/stale.js.map +0 -1
  474. package/dist/model-alias.d.ts.map +0 -1
  475. package/dist/model-alias.js.map +0 -1
  476. package/dist/model-catalog.d.ts.map +0 -1
  477. package/dist/model-catalog.js.map +0 -1
  478. package/dist/model-list.d.ts.map +0 -1
  479. package/dist/model-list.js.map +0 -1
  480. package/dist/orchestrator/board-tools.d.ts.map +0 -1
  481. package/dist/orchestrator/board-tools.js.map +0 -1
  482. package/dist/orchestrator/board.d.ts.map +0 -1
  483. package/dist/orchestrator/board.js.map +0 -1
  484. package/dist/orchestrator/index.d.ts.map +0 -1
  485. package/dist/orchestrator/index.js.map +0 -1
  486. package/dist/orchestrator/orchestrator.d.ts.map +0 -1
  487. package/dist/orchestrator/orchestrator.js.map +0 -1
  488. package/dist/orchestrator/router.d.ts.map +0 -1
  489. package/dist/orchestrator/router.js.map +0 -1
  490. package/dist/orchestrator/specialists-registry.d.ts.map +0 -1
  491. package/dist/orchestrator/specialists-registry.js.map +0 -1
  492. package/dist/orchestrator/specialists.d.ts.map +0 -1
  493. package/dist/orchestrator/specialists.js.map +0 -1
  494. package/dist/orchestrator/types.d.ts.map +0 -1
  495. package/dist/orchestrator/types.js.map +0 -1
  496. package/dist/plugins/index.d.ts.map +0 -1
  497. package/dist/plugins/index.js.map +0 -1
  498. package/dist/plugins/install.d.ts.map +0 -1
  499. package/dist/plugins/install.js.map +0 -1
  500. package/dist/plugins/loader.d.ts.map +0 -1
  501. package/dist/plugins/loader.js.map +0 -1
  502. package/dist/policy/audit.d.ts.map +0 -1
  503. package/dist/policy/audit.js.map +0 -1
  504. package/dist/policy/policy.d.ts.map +0 -1
  505. package/dist/policy/policy.js.map +0 -1
  506. package/dist/policy/proxy.d.ts.map +0 -1
  507. package/dist/policy/proxy.js.map +0 -1
  508. package/dist/pricing.d.ts.map +0 -1
  509. package/dist/pricing.js.map +0 -1
  510. package/dist/providers.d.ts.map +0 -1
  511. package/dist/providers.js.map +0 -1
  512. package/dist/repomap/index.d.ts.map +0 -1
  513. package/dist/repomap/index.js.map +0 -1
  514. package/dist/repomap/repo-map.d.ts.map +0 -1
  515. package/dist/repomap/repo-map.js.map +0 -1
  516. package/dist/semantic/chunker.d.ts.map +0 -1
  517. package/dist/semantic/chunker.js.map +0 -1
  518. package/dist/semantic/embedder.d.ts.map +0 -1
  519. package/dist/semantic/embedder.js.map +0 -1
  520. package/dist/semantic/semantic-index.d.ts.map +0 -1
  521. package/dist/semantic/semantic-index.js.map +0 -1
  522. package/dist/semantic/vector-store.d.ts.map +0 -1
  523. package/dist/semantic/vector-store.js.map +0 -1
  524. package/dist/sessions/index.d.ts.map +0 -1
  525. package/dist/sessions/index.js.map +0 -1
  526. package/dist/sessions/search.d.ts.map +0 -1
  527. package/dist/sessions/search.js.map +0 -1
  528. package/dist/sessions/session-export.d.ts.map +0 -1
  529. package/dist/sessions/session-export.js.map +0 -1
  530. package/dist/sessions/session-store.d.ts.map +0 -1
  531. package/dist/sessions/session-store.js.map +0 -1
  532. package/dist/sessions/watch.d.ts.map +0 -1
  533. package/dist/sessions/watch.js.map +0 -1
  534. package/dist/settings-export.d.ts.map +0 -1
  535. package/dist/settings-export.js.map +0 -1
  536. package/dist/skills/activator.d.ts.map +0 -1
  537. package/dist/skills/activator.js.map +0 -1
  538. package/dist/skills/index.d.ts.map +0 -1
  539. package/dist/skills/index.js.map +0 -1
  540. package/dist/skills/loader.d.ts.map +0 -1
  541. package/dist/skills/loader.js.map +0 -1
  542. package/dist/skills/marketplace-types.d.ts.map +0 -1
  543. package/dist/skills/marketplace-types.js.map +0 -1
  544. package/dist/skills/marketplace.d.ts.map +0 -1
  545. package/dist/skills/marketplace.js.map +0 -1
  546. package/dist/skills/parser.d.ts.map +0 -1
  547. package/dist/skills/parser.js.map +0 -1
  548. package/dist/skills/types.d.ts.map +0 -1
  549. package/dist/skills/types.js.map +0 -1
  550. package/dist/specs/generate.d.ts.map +0 -1
  551. package/dist/specs/generate.js.map +0 -1
  552. package/dist/specs/index.d.ts.map +0 -1
  553. package/dist/specs/index.js.map +0 -1
  554. package/dist/specs/store.d.ts.map +0 -1
  555. package/dist/specs/store.js.map +0 -1
  556. package/dist/specs/sync.d.ts.map +0 -1
  557. package/dist/specs/sync.js.map +0 -1
  558. package/dist/specs/tasks-parser.d.ts.map +0 -1
  559. package/dist/specs/tasks-parser.js.map +0 -1
  560. package/dist/specs/types.d.ts.map +0 -1
  561. package/dist/specs/types.js.map +0 -1
  562. package/dist/steering/glob.d.ts.map +0 -1
  563. package/dist/steering/glob.js.map +0 -1
  564. package/dist/steering/index.d.ts.map +0 -1
  565. package/dist/steering/index.js.map +0 -1
  566. package/dist/steering/loader.d.ts.map +0 -1
  567. package/dist/steering/loader.js.map +0 -1
  568. package/dist/steering/project-instructions.d.ts.map +0 -1
  569. package/dist/steering/project-instructions.js.map +0 -1
  570. package/dist/steering/select.d.ts.map +0 -1
  571. package/dist/steering/select.js.map +0 -1
  572. package/dist/steering/types.d.ts.map +0 -1
  573. package/dist/steering/types.js.map +0 -1
  574. package/dist/structured/index.d.ts.map +0 -1
  575. package/dist/structured/index.js.map +0 -1
  576. package/dist/structured/retry.d.ts.map +0 -1
  577. package/dist/structured/retry.js.map +0 -1
  578. package/dist/structured/schema.d.ts.map +0 -1
  579. package/dist/structured/schema.js.map +0 -1
  580. package/dist/tools/browser-tools.d.ts.map +0 -1
  581. package/dist/tools/browser-tools.js.map +0 -1
  582. package/dist/tools/codebase-search.d.ts.map +0 -1
  583. package/dist/tools/codebase-search.js.map +0 -1
  584. package/dist/tools/command-allow.d.ts.map +0 -1
  585. package/dist/tools/command-allow.js.map +0 -1
  586. package/dist/tools/edit-file.d.ts.map +0 -1
  587. package/dist/tools/edit-file.js.map +0 -1
  588. package/dist/tools/fetch-url.d.ts.map +0 -1
  589. package/dist/tools/fetch-url.js.map +0 -1
  590. package/dist/tools/find-references.d.ts.map +0 -1
  591. package/dist/tools/find-references.js.map +0 -1
  592. package/dist/tools/find-symbol.d.ts.map +0 -1
  593. package/dist/tools/find-symbol.js.map +0 -1
  594. package/dist/tools/ignore-rules.d.ts.map +0 -1
  595. package/dist/tools/ignore-rules.js.map +0 -1
  596. package/dist/tools/index.d.ts.map +0 -1
  597. package/dist/tools/index.js.map +0 -1
  598. package/dist/tools/list-files.d.ts.map +0 -1
  599. package/dist/tools/list-files.js.map +0 -1
  600. package/dist/tools/list-symbols.d.ts.map +0 -1
  601. package/dist/tools/list-symbols.js.map +0 -1
  602. package/dist/tools/memory.d.ts.map +0 -1
  603. package/dist/tools/memory.js.map +0 -1
  604. package/dist/tools/notebook.d.ts.map +0 -1
  605. package/dist/tools/notebook.js.map +0 -1
  606. package/dist/tools/policy.d.ts.map +0 -1
  607. package/dist/tools/policy.js.map +0 -1
  608. package/dist/tools/read-file.d.ts.map +0 -1
  609. package/dist/tools/read-file.js.map +0 -1
  610. package/dist/tools/read-image.d.ts.map +0 -1
  611. package/dist/tools/read-image.js.map +0 -1
  612. package/dist/tools/read-only.d.ts.map +0 -1
  613. package/dist/tools/read-only.js.map +0 -1
  614. package/dist/tools/redact.d.ts.map +0 -1
  615. package/dist/tools/redact.js.map +0 -1
  616. package/dist/tools/result-cache.d.ts.map +0 -1
  617. package/dist/tools/result-cache.js.map +0 -1
  618. package/dist/tools/run-command.d.ts.map +0 -1
  619. package/dist/tools/run-command.js.map +0 -1
  620. package/dist/tools/sandbox-loader.d.ts.map +0 -1
  621. package/dist/tools/sandbox-loader.js.map +0 -1
  622. package/dist/tools/search-files.d.ts.map +0 -1
  623. package/dist/tools/search-files.js.map +0 -1
  624. package/dist/tools/shared.d.ts.map +0 -1
  625. package/dist/tools/shared.js.map +0 -1
  626. package/dist/tools/sub-agent.d.ts.map +0 -1
  627. package/dist/tools/sub-agent.js.map +0 -1
  628. package/dist/tools/web-search.d.ts.map +0 -1
  629. package/dist/tools/web-search.js.map +0 -1
  630. package/dist/tools/write-file.d.ts.map +0 -1
  631. package/dist/tools/write-file.js.map +0 -1
  632. package/dist/types.d.ts.map +0 -1
  633. package/dist/types.js.map +0 -1
  634. package/dist/verify/detect.d.ts.map +0 -1
  635. package/dist/verify/detect.js.map +0 -1
  636. package/dist/verify/index.d.ts.map +0 -1
  637. package/dist/verify/index.js.map +0 -1
  638. package/dist/worktree/branch-ops.d.ts.map +0 -1
  639. package/dist/worktree/branch-ops.js.map +0 -1
  640. package/dist/worktree/index.d.ts.map +0 -1
  641. package/dist/worktree/index.js.map +0 -1
  642. package/dist/worktree/worktree.d.ts.map +0 -1
  643. package/dist/worktree/worktree.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { type SemanticHit } from '../semantic/semantic-index.js';
2
+ import { type SemanticHit, type SemanticOptions } from '../semantic/semantic-index.js';
3
3
  import type { Embedder } from '../semantic/embedder.js';
4
4
  import type { ToolDefinition } from '../types.js';
5
5
  declare const params: z.ZodObject<{
@@ -18,6 +18,7 @@ export interface CodebaseSearchResult {
18
18
  results: SemanticHit[];
19
19
  note: string;
20
20
  }
21
- export declare function createCodebaseSearchTool(embedder: Embedder): ToolDefinition<z.infer<typeof params>, CodebaseSearchResult>;
21
+ export declare function createCodebaseSearchTool(embedder: Embedder, options?: SemanticOptions & {
22
+ defaultLimit?: number;
23
+ }): ToolDefinition<z.infer<typeof params>, CodebaseSearchResult>;
22
24
  export {};
23
- //# sourceMappingURL=codebase-search.d.ts.map
@@ -4,7 +4,7 @@ const params = z.object({
4
4
  query: z.string().describe('What you are looking for, in natural language or identifiers (e.g. "where passwords are hashed").'),
5
5
  limit: z.number().int().min(1).max(20).optional().describe('Max results. Default 8.'),
6
6
  });
7
- export function createCodebaseSearchTool(embedder) {
7
+ export function createCodebaseSearchTool(embedder, options = {}) {
8
8
  return {
9
9
  name: 'codebase_search',
10
10
  description: 'Semantic search over the codebase: returns the most relevant code chunks (path, line range, snippet) for a description. Use it to find where something is implemented when you do not know the exact name; use find_symbol/search_files when you do.',
@@ -12,11 +12,10 @@ export function createCodebaseSearchTool(embedder) {
12
12
  execute: async (args, ctx) => ({
13
13
  query: args.query,
14
14
  embedder: embedder.id,
15
- results: await searchSemantic(ctx.cwd, embedder, args.query, args.limit ?? 8),
15
+ results: await searchSemantic(ctx.cwd, embedder, args.query, args.limit ?? options.defaultLimit ?? 8, options),
16
16
  note: embedder.id.startsWith('hashing')
17
17
  ? 'Ranking is by shared vocabulary (offline embedder). Set FORGE_EMBED_PROVIDER=openai|ollama for meaning-based ranking.'
18
18
  : 'Ranked by embedding similarity.',
19
19
  }),
20
20
  };
21
21
  }
22
- //# sourceMappingURL=codebase-search.js.map
@@ -9,4 +9,3 @@ export declare function isAlwaysAllowable(command: string, hasCwd?: boolean): bo
9
9
  export declare function needsScriptFingerprint(command: string): boolean;
10
10
  /** Whether a `run_command` call's arguments name one of `allowed` exactly, without a working-directory override. */
11
11
  export declare function isListedCommand(args: unknown, allowed: readonly string[]): boolean;
12
- //# sourceMappingURL=command-allow.d.ts.map
@@ -47,4 +47,3 @@ export function isListedCommand(args, allowed) {
47
47
  return false;
48
48
  return allowed.includes(normalizeCommand(a.command));
49
49
  }
50
- //# sourceMappingURL=command-allow.js.map
@@ -27,4 +27,3 @@ export interface EditFileResult {
27
27
  }
28
28
  export declare const editFileTool: ToolDefinition<z.infer<typeof params>, EditFileResult>;
29
29
  export {};
30
- //# sourceMappingURL=edit-file.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import { readFile, writeFile } from 'node:fs/promises';
2
2
  import { z } from 'zod';
3
3
  import { resolveAndCheckPath } from './shared.js';
4
+ import { decodeText, encodeText } from './text-encoding.js';
4
5
  const params = z.object({
5
6
  path: z.string().describe('Path of the file to edit, relative to the working directory or absolute.'),
6
7
  old_text: z.string().describe('Exact text to find in the file. Must match exactly (whitespace-sensitive).'),
@@ -18,7 +19,7 @@ export const editFileTool = {
18
19
  destructive: false,
19
20
  execute: async (args, ctx) => {
20
21
  const resolved = resolveAndCheckPath(args.path, ctx);
21
- const original = await readFile(resolved, 'utf8').catch((err) => {
22
+ const { text: original, encoding } = await readFile(resolved).then(decodeText).catch((err) => {
22
23
  if (err.code === 'ENOENT')
23
24
  throw new Error(`File not found: ${args.path}`);
24
25
  throw err;
@@ -37,11 +38,12 @@ export const editFileTool = {
37
38
  // string 2nd arg to String.prototype.replace still honors special
38
39
  // patterns like $&, $1, $$ even though old_text isn't a regex.
39
40
  : original.replace(args.old_text, () => args.new_text);
40
- await writeFile(resolved, updated, 'utf8');
41
+ const bytes = encodeText(updated, encoding);
42
+ await writeFile(resolved, bytes);
41
43
  return {
42
44
  path: resolved,
43
45
  replacements: replaceAll ? occurrences : 1,
44
- bytes: Buffer.byteLength(updated, 'utf8'),
46
+ bytes: bytes.length,
45
47
  };
46
48
  },
47
49
  };
@@ -56,4 +58,3 @@ function countOccurrences(haystack, needle) {
56
58
  }
57
59
  return count;
58
60
  }
59
- //# sourceMappingURL=edit-file.js.map
@@ -37,6 +37,12 @@ export interface FetchUrlResult {
37
37
  /** True when the response was truncated to fit `max_bytes` or `excerpt` size. */
38
38
  truncated: boolean;
39
39
  }
40
+ /**
41
+ * SSRF protection: true for an IP literal that is loopback, link-local,
42
+ * or RFC1918 private. `fetch_url` refuses these hosts by default (see
43
+ * {@link assertUrlNotBlocked}) so an agent-supplied URL can't reach
44
+ * loopback services or cloud metadata endpoints (e.g. 169.254.169.254).
45
+ */
46
+ export declare function isBlockedAddress(ip: string): boolean;
40
47
  export declare const fetchUrlTool: ToolDefinition<z.infer<typeof params>, FetchUrlResult>;
41
48
  export {};
42
- //# sourceMappingURL=fetch-url.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import { lookup } from 'node:dns/promises';
2
2
  import net from 'node:net';
3
3
  import { z } from 'zod';
4
+ import { installedFetch } from '../policy/proxy.js';
4
5
  import { checkPolicyViolation } from './policy.js';
5
6
  const params = z.object({
6
7
  url: z
@@ -37,19 +38,24 @@ const DEFAULT_MAX_BYTES = 200_000;
37
38
  const DEFAULT_TIMEOUT_MS = 10_000;
38
39
  const EXCERPT_MAX_CHARS = 8_000;
39
40
  const USER_AGENT = 'ikarmic-forge/0.1 (fetch_url)';
41
+ const MAX_REDIRECTS = 5;
40
42
  /**
41
43
  * SSRF protection: true for an IP literal that is loopback, link-local,
42
44
  * or RFC1918 private. `fetch_url` refuses these hosts by default (see
43
45
  * {@link assertUrlNotBlocked}) so an agent-supplied URL can't reach
44
46
  * loopback services or cloud metadata endpoints (e.g. 169.254.169.254).
45
47
  */
46
- function isBlockedAddress(ip) {
48
+ export function isBlockedAddress(ip) {
47
49
  if (net.isIPv4(ip)) {
48
50
  const parts = ip.split('.').map(Number);
49
51
  const a = parts[0];
50
52
  const b = parts[1];
53
+ if (a === 0)
54
+ return true; // 0.0.0.0/8: "this host" (0.0.0.0 reaches local services)
51
55
  if (a === 127)
52
56
  return true; // 127.0.0.0/8: loopback
57
+ if (a === 100 && b >= 64 && b <= 127)
58
+ return true; // 100.64.0.0/10: carrier-grade NAT / cloud-internal
53
59
  if (a === 10)
54
60
  return true; // 10.0.0.0/8: private
55
61
  if (a === 172 && b >= 16 && b <= 31)
@@ -62,16 +68,25 @@ function isBlockedAddress(ip) {
62
68
  }
63
69
  if (net.isIPv6(ip)) {
64
70
  const lower = ip.toLowerCase();
65
- if (lower === '::1')
66
- return true; // loopback
71
+ if (lower === '::1' || lower === '::')
72
+ return true; // loopback, unspecified
67
73
  // IPv4-mapped IPv6 (::ffff:a.b.c.d): check the embedded v4 address too,
68
74
  // otherwise it's a trivial bypass of the v4 checks above.
69
75
  const mapped = lower.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/);
70
76
  if (mapped)
71
77
  return isBlockedAddress(mapped[1]);
78
+ // The same mapped address written in hex (::ffff:7f00:1 is 127.0.0.1).
79
+ const mappedHex = lower.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/);
80
+ if (mappedHex) {
81
+ const hi = parseInt(mappedHex[1], 16);
82
+ const lo = parseInt(mappedHex[2], 16);
83
+ return isBlockedAddress(`${hi >> 8}.${hi & 255}.${lo >> 8}.${lo & 255}`);
84
+ }
72
85
  const firstGroup = parseInt(lower.split(':')[0] ?? '', 16);
73
86
  if (!Number.isNaN(firstGroup) && firstGroup >= 0xfe80 && firstGroup <= 0xfebf)
74
87
  return true; // fe80::/10: link-local
88
+ if (!Number.isNaN(firstGroup) && firstGroup >= 0xfc00 && firstGroup <= 0xfdff)
89
+ return true; // fc00::/7: unique local (private)
75
90
  return false;
76
91
  }
77
92
  return false;
@@ -140,21 +155,39 @@ export const fetchUrlTool = {
140
155
  ? setTimeout(() => controller.abort(), timeoutMs)
141
156
  : null;
142
157
  let response;
158
+ let finalUrl = args.url;
143
159
  try {
144
- // NOTE: the description above promises "follows up to 5 redirects",
145
- // but `redirect: 'follow'` delegates to the runtime's fetch with no
146
- // redirect-count cap of our own. Left as a doc/implementation
147
- // mismatch (low priority) rather than hand-rolling redirect
148
- // following here.
149
- response = await fetch(args.url, {
150
- method: 'GET',
151
- redirect: follow ? 'follow' : 'manual',
152
- signal: controller.signal,
153
- headers: {
154
- 'user-agent': USER_AGENT,
155
- accept: 'text/html, application/json, text/plain;q=0.9, */*;q=0.5',
156
- },
157
- });
160
+ // Redirects are followed here, one hop at a time, so every hop passes the same policy and SSRF checks as the
161
+ // first URL: a public page must not be able to bounce the agent to 169.254.169.254 or localhost.
162
+ // The installed fetch honours the proxy and the extra CA roots even where the host replaced the global one.
163
+ const doFetch = installedFetch() ?? fetch;
164
+ let current = args.url;
165
+ for (let hop = 0;; hop++) {
166
+ response = await doFetch(current, {
167
+ method: 'GET',
168
+ redirect: 'manual',
169
+ signal: controller.signal,
170
+ headers: {
171
+ 'user-agent': USER_AGENT,
172
+ accept: 'text/html, application/json, text/plain;q=0.9, */*;q=0.5',
173
+ },
174
+ });
175
+ const location = response.headers.get('location');
176
+ if (!follow || response.status < 300 || response.status >= 400 || !location)
177
+ break;
178
+ if (hop >= MAX_REDIRECTS)
179
+ throw new Error(`stopped after ${MAX_REDIRECTS} redirects`);
180
+ const next = new URL(location, current).href;
181
+ if (!/^https?:$/i.test(new URL(next).protocol))
182
+ throw new Error(`refusing a redirect to ${next}`);
183
+ const hopViolation = checkPolicyViolation(ctx.policy, { cwd: ctx.cwd, url: next });
184
+ if (hopViolation)
185
+ throw new Error(`[sandbox] ${hopViolation}`);
186
+ await assertUrlNotBlocked(next, ctx.policy);
187
+ await response.body?.cancel().catch(() => undefined);
188
+ current = next;
189
+ }
190
+ finalUrl = current;
158
191
  }
159
192
  catch (err) {
160
193
  if (timeoutHandle)
@@ -167,7 +200,7 @@ export const fetchUrlTool = {
167
200
  if (timeoutHandle)
168
201
  clearTimeout(timeoutHandle);
169
202
  if (response.status >= 400) {
170
- throw new Error(`fetch_url: HTTP ${response.status} ${response.statusText || ''} (${response.url})`);
203
+ throw new Error(`fetch_url: HTTP ${response.status} ${response.statusText || ''} (${finalUrl})`);
171
204
  }
172
205
  const contentType = response.headers.get('content-type')?.toLowerCase() ?? 'text/plain';
173
206
  const buffer = await readWithCap(response, maxBytes);
@@ -195,7 +228,7 @@ export const fetchUrlTool = {
195
228
  }
196
229
  const excerpt = body.length > EXCERPT_MAX_CHARS ? body.slice(0, EXCERPT_MAX_CHARS) + '\n\n…(truncated for display; raw response was ' + body.length + ' chars)' : body;
197
230
  return {
198
- url: response.url,
231
+ url: finalUrl,
199
232
  status: response.status,
200
233
  statusText: response.statusText,
201
234
  contentType,
@@ -296,4 +329,3 @@ function prettyJson(text) {
296
329
  return text;
297
330
  }
298
331
  }
299
- //# sourceMappingURL=fetch-url.js.map
@@ -18,4 +18,3 @@ export interface FindReferencesResult {
18
18
  }
19
19
  export declare const findReferencesTool: ToolDefinition<z.infer<typeof params>, FindReferencesResult>;
20
20
  export {};
21
- //# sourceMappingURL=find-references.d.ts.map
@@ -37,4 +37,3 @@ export const findReferencesTool = {
37
37
  function escapeRegExp(s) {
38
38
  return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
39
39
  }
40
- //# sourceMappingURL=find-references.js.map
@@ -6,10 +6,10 @@ declare const params: z.ZodObject<{
6
6
  kind: z.ZodOptional<z.ZodEnum<["function", "class", "interface", "type", "enum", "const", "method"]>>;
7
7
  }, "strip", z.ZodTypeAny, {
8
8
  name: string;
9
- kind?: "function" | "method" | "type" | "class" | "interface" | "enum" | "const" | undefined;
9
+ kind?: "function" | "class" | "interface" | "type" | "enum" | "const" | "method" | undefined;
10
10
  }, {
11
11
  name: string;
12
- kind?: "function" | "method" | "type" | "class" | "interface" | "enum" | "const" | undefined;
12
+ kind?: "function" | "class" | "interface" | "type" | "enum" | "const" | "method" | undefined;
13
13
  }>;
14
14
  export interface FindSymbolMatch {
15
15
  name: string;
@@ -24,4 +24,3 @@ export interface FindSymbolResult {
24
24
  }
25
25
  export declare const findSymbolTool: ToolDefinition<z.infer<typeof params>, FindSymbolResult>;
26
26
  export {};
27
- //# sourceMappingURL=find-symbol.d.ts.map
@@ -33,4 +33,3 @@ export const findSymbolTool = {
33
33
  return { query: args.name, matchType: 'none', matches: [] };
34
34
  },
35
35
  };
36
- //# sourceMappingURL=find-symbol.js.map
@@ -13,4 +13,3 @@ export declare class IgnoreRules {
13
13
  /** Whether `absPath` is ignored. Paths outside the rule root are never ignored here. */
14
14
  isIgnored(absPath: string, isDir: boolean): boolean;
15
15
  }
16
- //# sourceMappingURL=ignore-rules.d.ts.map
@@ -7,6 +7,7 @@
7
7
  import { existsSync, readFileSync, statSync } from 'node:fs';
8
8
  import path from 'node:path';
9
9
  import ignore from 'ignore';
10
+ import { isOutsideRel } from './shared.js';
10
11
  /** Files read in every directory, in this order. `.forgeignore` is for paths only the agent should skip. */
11
12
  export const IGNORE_FILE_NAMES = ['.gitignore', '.forgeignore'];
12
13
  function readIfFile(file) {
@@ -62,7 +63,7 @@ export class IgnoreRules {
62
63
  /** Whether `absPath` is ignored. Paths outside the rule root are never ignored here. */
63
64
  isIgnored(absPath, isDir) {
64
65
  const rel = path.relative(this.top, path.resolve(absPath));
65
- if (!rel || rel.startsWith('..') || path.isAbsolute(rel))
66
+ if (!rel || isOutsideRel(rel))
66
67
  return false;
67
68
  const parts = rel.split(path.sep);
68
69
  let ignored = false;
@@ -82,4 +83,3 @@ export class IgnoreRules {
82
83
  return ignored;
83
84
  }
84
85
  }
85
- //# sourceMappingURL=ignore-rules.js.map
@@ -1,3 +1,4 @@
1
+ import { applyPatchTool } from './apply-patch.js';
1
2
  import { editFileTool } from './edit-file.js';
2
3
  import { fetchUrlTool } from './fetch-url.js';
3
4
  import { findReferencesTool } from './find-references.js';
@@ -10,7 +11,10 @@ import { readFileTool } from './read-file.js';
10
11
  import { readImageTool } from './read-image.js';
11
12
  import { runCommandTool } from './run-command.js';
12
13
  import { searchFilesTool } from './search-files.js';
14
+ import { askUserTool } from './ask-user.js';
13
15
  import { subAgentTool } from './sub-agent.js';
16
+ import { subAgentWaitTool } from './sub-agent-wait.js';
17
+ import { todoReadTool, todoWriteTool } from './todo.js';
14
18
  import { writeFileTool } from './write-file.js';
15
19
  import type { ToolDefinition } from '../types.js';
16
20
  /**
@@ -26,11 +30,10 @@ type AnyToolDefinition = ToolDefinition<any, any>;
26
30
  * intentional: the model sees this order in its tool list.
27
31
  */
28
32
  export declare const BUILTIN_TOOLS: readonly AnyToolDefinition[];
29
- export { editFileTool, editNotebookTool, fetchUrlTool, findReferencesTool, findSymbolTool, listFilesTool, listSymbolsTool, memoryForgetTool, memoryReadTool, memoryWriteTool, readFileTool, readImageTool, runCommandTool, searchFilesTool, subAgentTool, writeFileTool, };
33
+ export { applyPatchTool, askUserTool, editFileTool, editNotebookTool, fetchUrlTool, findReferencesTool, findSymbolTool, listFilesTool, listSymbolsTool, memoryForgetTool, memoryReadTool, memoryWriteTool, readFileTool, readImageTool, runCommandTool, searchFilesTool, subAgentTool, subAgentWaitTool, todoReadTool, todoWriteTool, writeFileTool, };
30
34
  export type { ToolContext, ToolDefinition, ToolPolicy, ToolSandbox } from '../types.js';
31
35
  export { checkPolicyViolation, globToRegex, mergeToolSandbox, normalizePathPattern, pathMatchesAny } from './policy.js';
32
36
  export { redact, countRedactions, buildRules } from './redact.js';
33
37
  export type { RedactionRule, RedactionResult } from './redact.js';
34
38
  export { ToolResultCache, buildCacheKey, cachedExecute } from './result-cache.js';
35
39
  export type { CacheKeyParts, CacheStats } from './result-cache.js';
36
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { applyPatchTool } from './apply-patch.js';
1
2
  import { editFileTool } from './edit-file.js';
2
3
  import { fetchUrlTool } from './fetch-url.js';
3
4
  import { findReferencesTool } from './find-references.js';
@@ -10,7 +11,10 @@ import { readFileTool } from './read-file.js';
10
11
  import { readImageTool } from './read-image.js';
11
12
  import { runCommandTool } from './run-command.js';
12
13
  import { searchFilesTool } from './search-files.js';
14
+ import { askUserTool } from './ask-user.js';
13
15
  import { subAgentTool } from './sub-agent.js';
16
+ import { subAgentWaitTool } from './sub-agent-wait.js';
17
+ import { todoReadTool, todoWriteTool } from './todo.js';
14
18
  import { writeFileTool } from './write-file.js';
15
19
  /**
16
20
  * The built-in tool set that ships with Forge. These cover the file system,
@@ -28,6 +32,7 @@ export const BUILTIN_TOOLS = [
28
32
  findReferencesTool,
29
33
  writeFileTool,
30
34
  editFileTool,
35
+ applyPatchTool,
31
36
  editNotebookTool,
32
37
  runCommandTool,
33
38
  fetchUrlTool,
@@ -35,9 +40,12 @@ export const BUILTIN_TOOLS = [
35
40
  memoryWriteTool,
36
41
  memoryForgetTool,
37
42
  subAgentTool,
43
+ subAgentWaitTool,
44
+ todoWriteTool,
45
+ todoReadTool,
46
+ askUserTool,
38
47
  ];
39
- export { editFileTool, editNotebookTool, fetchUrlTool, findReferencesTool, findSymbolTool, listFilesTool, listSymbolsTool, memoryForgetTool, memoryReadTool, memoryWriteTool, readFileTool, readImageTool, runCommandTool, searchFilesTool, subAgentTool, writeFileTool, };
48
+ export { applyPatchTool, askUserTool, editFileTool, editNotebookTool, fetchUrlTool, findReferencesTool, findSymbolTool, listFilesTool, listSymbolsTool, memoryForgetTool, memoryReadTool, memoryWriteTool, readFileTool, readImageTool, runCommandTool, searchFilesTool, subAgentTool, subAgentWaitTool, todoReadTool, todoWriteTool, writeFileTool, };
40
49
  export { checkPolicyViolation, globToRegex, mergeToolSandbox, normalizePathPattern, pathMatchesAny } from './policy.js';
41
50
  export { redact, countRedactions, buildRules } from './redact.js';
42
51
  export { ToolResultCache, buildCacheKey, cachedExecute } from './result-cache.js';
43
- //# sourceMappingURL=index.js.map
@@ -38,4 +38,3 @@ export interface ListFilesResult {
38
38
  }
39
39
  export declare const listFilesTool: ToolDefinition<z.infer<typeof params>, ListFilesResult>;
40
40
  export {};
41
- //# sourceMappingURL=list-files.d.ts.map
@@ -85,4 +85,3 @@ export const listFilesTool = {
85
85
  return { path: root, entries: out, truncated };
86
86
  },
87
87
  };
88
- //# sourceMappingURL=list-files.js.map
@@ -19,4 +19,3 @@ export interface ListSymbolsResult {
19
19
  }
20
20
  export declare const listSymbolsTool: ToolDefinition<z.infer<typeof params>, ListSymbolsResult>;
21
21
  export {};
22
- //# sourceMappingURL=list-symbols.d.ts.map
@@ -23,4 +23,3 @@ export const listSymbolsTool = {
23
23
  return { path: rel, symbols: topLevel };
24
24
  },
25
25
  };
26
- //# sourceMappingURL=list-symbols.js.map
@@ -11,11 +11,11 @@ declare const readParams: z.ZodObject<{
11
11
  /** Optional heading to filter by. Returns just that section's body. */
12
12
  section: z.ZodOptional<z.ZodString>;
13
13
  }, "strip", z.ZodTypeAny, {
14
- scope?: "project" | "global" | "both" | undefined;
15
14
  section?: string | undefined;
16
- }, {
17
15
  scope?: "project" | "global" | "both" | undefined;
16
+ }, {
18
17
  section?: string | undefined;
18
+ scope?: "project" | "global" | "both" | undefined;
19
19
  }>;
20
20
  export interface MemoryReadResult {
21
21
  scope: 'project' | 'global' | 'both';
@@ -43,17 +43,17 @@ declare const writeParams: z.ZodObject<{
43
43
  }, "strip", z.ZodTypeAny, {
44
44
  body: string;
45
45
  heading: string;
46
- type?: "reference" | "convention" | "decision" | "correction" | undefined;
47
- scope?: "project" | "global" | undefined;
46
+ type?: "convention" | "decision" | "correction" | "reference" | undefined;
48
47
  refs?: string[] | undefined;
49
48
  pin?: boolean | undefined;
49
+ scope?: "project" | "global" | undefined;
50
50
  }, {
51
51
  body: string;
52
52
  heading: string;
53
- type?: "reference" | "convention" | "decision" | "correction" | undefined;
54
- scope?: "project" | "global" | undefined;
53
+ type?: "convention" | "decision" | "correction" | "reference" | undefined;
55
54
  refs?: string[] | undefined;
56
55
  pin?: boolean | undefined;
56
+ scope?: "project" | "global" | undefined;
57
57
  }>;
58
58
  export interface MemoryWriteResult {
59
59
  scope: 'project' | 'global';
@@ -85,4 +85,3 @@ export interface MemoryForgetResult {
85
85
  }
86
86
  export declare const memoryForgetTool: ToolDefinition<z.infer<typeof forgetParams>, MemoryForgetResult>;
87
87
  export {};
88
- //# sourceMappingURL=memory.d.ts.map
@@ -212,4 +212,3 @@ export const memoryForgetTool = {
212
212
  return { scope: plan.scope, heading: args.heading.trim(), removed: plan.removed };
213
213
  },
214
214
  };
215
- //# sourceMappingURL=memory.js.map
@@ -46,16 +46,16 @@ declare const params: z.ZodObject<{
46
46
  cell_type: z.ZodOptional<z.ZodEnum<["code", "markdown", "raw"]>>;
47
47
  }, "strip", z.ZodTypeAny, {
48
48
  path: string;
49
+ mode?: "replace" | "delete" | "insert" | undefined;
49
50
  source?: string | undefined;
50
51
  cell_type?: "code" | "raw" | "markdown" | undefined;
51
- mode?: "replace" | "insert" | "delete" | undefined;
52
52
  cell_index?: number | undefined;
53
53
  cell_id?: string | undefined;
54
54
  }, {
55
55
  path: string;
56
+ mode?: "replace" | "delete" | "insert" | undefined;
56
57
  source?: string | undefined;
57
58
  cell_type?: "code" | "raw" | "markdown" | undefined;
58
- mode?: "replace" | "insert" | "delete" | undefined;
59
59
  cell_index?: number | undefined;
60
60
  cell_id?: string | undefined;
61
61
  }>;
@@ -67,4 +67,3 @@ export interface EditNotebookResult {
67
67
  }
68
68
  export declare const editNotebookTool: ToolDefinition<z.infer<typeof params>, EditNotebookResult>;
69
69
  export {};
70
- //# sourceMappingURL=notebook.d.ts.map
@@ -161,4 +161,3 @@ export const editNotebookTool = {
161
161
  return { path: resolved, mode, cellIndex: at, cells: nb.cells.length };
162
162
  },
163
163
  };
164
- //# sourceMappingURL=notebook.js.map
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Ordered permission rules, as in Kilo's `permission` config: each permission (read, edit, bash, ...) maps to
3
+ * an action or to a pattern map, rules run in config order and the LAST match wins. Pure; the agent consults it
4
+ * in `requestApproval`.
5
+ */
6
+ export type PermissionAction = 'allow' | 'ask' | 'deny';
7
+ export type PermissionConfig = Record<string, PermissionAction | Record<string, PermissionAction>>;
8
+ export interface PermissionRule {
9
+ permission: string;
10
+ pattern: string;
11
+ action: PermissionAction;
12
+ }
13
+ /** Flatten a config object into ordered rules; entries with an unknown action are dropped. */
14
+ export declare function compilePermissionRules(config: PermissionConfig | undefined): PermissionRule[];
15
+ /** The action of the last rule matching `permission` and `target`, or undefined when none does. */
16
+ export declare function evaluatePermission(rules: readonly PermissionRule[], permission: string, target: string): PermissionAction | undefined;
17
+ /**
18
+ * Split a shell command into the commands a permission rule must each allow: `&&`, `||`, `;`, `|` and newlines
19
+ * outside quotes separate commands; the inside of `$(...)` and backticks is added as extra commands, and an
20
+ * unquoted `>` redirect adds a `redirect:` entry, so an allow rule for `git status *` cannot cover
21
+ * `git status $(rm -rf x)` or `git status > file`.
22
+ */
23
+ export declare function splitShellCommands(command: string): string[];
24
+ /** `.env` and `.env.*` hold secrets; `.env.example` and `.env.sample` are documentation. */
25
+ export declare function isSensitiveFile(relPath: string): boolean;
26
+ /** True when a token of the command points outside `cwd`: `~`, a `..` escape, or an absolute path elsewhere. */
27
+ export declare function touchesOutsideCwd(command: string, cwd: string): boolean;
28
+ /** Which permission a tool call falls under and the strings the rules are matched against; undefined = no rule applies. */
29
+ export declare function permissionFor(toolName: string, args: unknown, cwd: string): {
30
+ permission: string;
31
+ targets: string[];
32
+ } | undefined;