@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.
- package/LICENSE +44 -21
- package/README.md +1 -1
- package/dist/agent/agent.d.ts +8 -1
- package/dist/agent/agent.js +143 -23
- package/dist/agent/architect.d.ts +0 -1
- package/dist/agent/architect.js +0 -1
- package/dist/agent/background.d.ts +58 -0
- package/dist/agent/background.js +139 -0
- package/dist/agent/cache-hints.d.ts +0 -1
- package/dist/agent/cache-hints.js +0 -1
- package/dist/agent/cost-router.d.ts +0 -1
- package/dist/agent/cost-router.js +0 -1
- package/dist/agent/enhance-prompt.d.ts +9 -0
- package/dist/agent/enhance-prompt.js +34 -0
- package/dist/agent/goal.d.ts +54 -0
- package/dist/agent/goal.js +65 -0
- package/dist/agent/index.d.ts +0 -1
- package/dist/agent/index.js +0 -1
- package/dist/agent/loop-guard.d.ts +21 -0
- package/dist/agent/loop-guard.js +41 -0
- package/dist/agent/prompts.d.ts +0 -1
- package/dist/agent/prompts.js +0 -1
- package/dist/agent/think-tags.d.ts +0 -1
- package/dist/agent/think-tags.js +0 -1
- package/dist/agent/verify.d.ts +0 -1
- package/dist/agent/verify.js +0 -1
- package/dist/agents/agent-files.d.ts +43 -0
- package/dist/agents/agent-files.js +109 -0
- package/dist/ai-comments/index.d.ts +0 -1
- package/dist/ai-comments/index.js +0 -1
- package/dist/attachments.d.ts +0 -1
- package/dist/attachments.js +0 -1
- package/dist/browser/cdp.d.ts +0 -1
- package/dist/browser/cdp.js +0 -1
- package/dist/browser/chrome.d.ts +0 -1
- package/dist/browser/chrome.js +0 -1
- package/dist/browser/session.d.ts +0 -1
- package/dist/browser/session.js +0 -1
- package/dist/checkpoints/index.d.ts +0 -1
- package/dist/checkpoints/index.js +0 -1
- package/dist/checkpoints/store.d.ts +0 -1
- package/dist/checkpoints/store.js +5 -2
- package/dist/checkpoints/types.d.ts +0 -1
- package/dist/checkpoints/types.js +0 -1
- package/dist/code-index/builder.d.ts +0 -1
- package/dist/code-index/builder.js +0 -1
- package/dist/code-index/index-store.d.ts +0 -1
- package/dist/code-index/index-store.js +0 -1
- package/dist/code-index/parser.d.ts +0 -1
- package/dist/code-index/parser.js +0 -1
- package/dist/code-index/types.d.ts +0 -1
- package/dist/code-index/types.js +0 -1
- package/dist/commands/custom-commands.d.ts +9 -5
- package/dist/commands/custom-commands.js +13 -3
- package/dist/config-file.d.ts +47 -1
- package/dist/config-file.js +249 -6
- package/dist/config-merge.d.ts +13 -0
- package/dist/config-merge.js +67 -0
- package/dist/config-schema.d.ts +340 -0
- package/dist/config-schema.js +126 -0
- package/dist/config.d.ts +0 -1
- package/dist/config.js +2 -2
- package/dist/context/compaction.d.ts +0 -1
- package/dist/context/compaction.js +10 -2
- package/dist/context/mask.d.ts +0 -1
- package/dist/context/mask.js +1 -2
- package/dist/credentials/index.d.ts +0 -1
- package/dist/credentials/index.js +0 -1
- package/dist/credentials/types.d.ts +0 -1
- package/dist/credentials/types.js +0 -1
- package/dist/custom-providers.d.ts +95 -0
- package/dist/custom-providers.js +120 -0
- package/dist/diff/index.d.ts +0 -1
- package/dist/diff/index.js +0 -1
- package/dist/diff/unified-diff.d.ts +0 -1
- package/dist/diff/unified-diff.js +0 -1
- package/dist/git/auto-commit.d.ts +3 -4
- package/dist/git/auto-commit.js +8 -7
- package/dist/git/index.d.ts +0 -1
- package/dist/git/index.js +0 -1
- package/dist/github/github-tools.d.ts +2 -3
- package/dist/github/github-tools.js +0 -1
- package/dist/hooks/agent-runner.d.ts +0 -1
- package/dist/hooks/agent-runner.js +0 -1
- package/dist/hooks/bus.d.ts +0 -1
- package/dist/hooks/bus.js +0 -1
- package/dist/hooks/config.d.ts +0 -1
- package/dist/hooks/config.js +0 -1
- package/dist/hooks/events.d.ts +0 -1
- package/dist/hooks/events.js +0 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/loader.d.ts +0 -1
- package/dist/hooks/loader.js +0 -1
- package/dist/hooks/runner.d.ts +0 -1
- package/dist/hooks/runner.js +3 -3
- package/dist/hooks/watch-coalescer.d.ts +0 -1
- package/dist/hooks/watch-coalescer.js +0 -1
- package/dist/hooks/watch-ignore.d.ts +0 -1
- package/dist/hooks/watch-ignore.js +0 -1
- package/dist/hooks/watcher.d.ts +0 -1
- package/dist/hooks/watcher.js +0 -1
- package/dist/import/claude-code.d.ts +39 -0
- package/dist/import/claude-code.js +254 -0
- package/dist/index.d.ts +37 -7
- package/dist/index.js +28 -5
- package/dist/lazy-model.d.ts +0 -1
- package/dist/lazy-model.js +0 -1
- package/dist/lint/auto-lint.d.ts +0 -1
- package/dist/lint/auto-lint.js +0 -1
- package/dist/lint/index.d.ts +0 -1
- package/dist/lint/index.js +0 -1
- package/dist/lsp/client.d.ts +5 -1
- package/dist/lsp/client.js +39 -4
- package/dist/lsp/diagnostics.d.ts +0 -1
- package/dist/lsp/diagnostics.js +0 -1
- package/dist/lsp/index.d.ts +0 -1
- package/dist/lsp/index.js +0 -1
- package/dist/mcp/catalog.d.ts +0 -1
- package/dist/mcp/catalog.js +0 -1
- package/dist/mcp/index.d.ts +5 -2
- package/dist/mcp/index.js +3 -2
- package/dist/mcp/json-schema-to-zod.d.ts +0 -1
- package/dist/mcp/json-schema-to-zod.js +0 -1
- package/dist/mcp/manager.d.ts +17 -4
- package/dist/mcp/manager.js +27 -3
- package/dist/mcp/marketplace-types.d.ts +0 -1
- package/dist/mcp/marketplace-types.js +0 -1
- package/dist/mcp/marketplace.d.ts +2 -1
- package/dist/mcp/marketplace.js +10 -5
- package/dist/mcp/mcp-client.d.ts +12 -3
- package/dist/mcp/mcp-client.js +74 -18
- package/dist/mcp/mcp-config.d.ts +2 -1
- package/dist/mcp/mcp-config.js +1 -1
- package/dist/mcp/oauth.d.ts +55 -0
- package/dist/mcp/oauth.js +197 -0
- package/dist/mcp/registry.d.ts +0 -1
- package/dist/mcp/registry.js +0 -1
- package/dist/mcp/resource-tools.d.ts +8 -0
- package/dist/mcp/resource-tools.js +56 -0
- package/dist/memory/memory-store.d.ts +0 -1
- package/dist/memory/memory-store.js +0 -1
- package/dist/memory/rank.d.ts +0 -1
- package/dist/memory/rank.js +0 -1
- package/dist/memory/session-digest.d.ts +12 -0
- package/dist/memory/session-digest.js +47 -0
- package/dist/memory/stale.d.ts +0 -1
- package/dist/memory/stale.js +2 -2
- package/dist/model-alias.d.ts +18 -3
- package/dist/model-alias.js +27 -4
- package/dist/model-catalog.d.ts +0 -1
- package/dist/model-catalog.js +0 -2
- package/dist/model-list.d.ts +0 -1
- package/dist/model-list.js +2 -2
- package/dist/model-overrides.d.ts +30 -0
- package/dist/model-overrides.js +48 -0
- package/dist/orchestrator/board-tools.d.ts +0 -1
- package/dist/orchestrator/board-tools.js +0 -1
- package/dist/orchestrator/board.d.ts +0 -1
- package/dist/orchestrator/board.js +0 -1
- package/dist/orchestrator/index.d.ts +0 -1
- package/dist/orchestrator/index.js +0 -1
- package/dist/orchestrator/orchestrator.d.ts +0 -1
- package/dist/orchestrator/orchestrator.js +0 -1
- package/dist/orchestrator/router.d.ts +0 -1
- package/dist/orchestrator/router.js +0 -1
- package/dist/orchestrator/specialists-registry.d.ts +0 -1
- package/dist/orchestrator/specialists-registry.js +2 -4
- package/dist/orchestrator/specialists.d.ts +0 -1
- package/dist/orchestrator/specialists.js +4 -5
- package/dist/orchestrator/types.d.ts +0 -1
- package/dist/orchestrator/types.js +0 -1
- package/dist/plugins/index.d.ts +0 -1
- package/dist/plugins/index.js +0 -1
- package/dist/plugins/install.d.ts +0 -1
- package/dist/plugins/install.js +0 -1
- package/dist/plugins/loader.d.ts +0 -1
- package/dist/plugins/loader.js +0 -1
- package/dist/policy/audit.d.ts +0 -1
- package/dist/policy/audit.js +0 -1
- package/dist/policy/ca-certs.d.ts +8 -0
- package/dist/policy/ca-certs.js +30 -0
- package/dist/policy/policy.d.ts +0 -1
- package/dist/policy/policy.js +0 -1
- package/dist/policy/proxy.d.ts +10 -4
- package/dist/policy/proxy.js +33 -7
- package/dist/pricing.d.ts +0 -1
- package/dist/pricing.js +4 -1
- package/dist/providers.d.ts +7 -1
- package/dist/providers.js +39 -6
- package/dist/repomap/index.d.ts +0 -1
- package/dist/repomap/index.js +0 -1
- package/dist/repomap/repo-map.d.ts +0 -1
- package/dist/repomap/repo-map.js +0 -1
- package/dist/semantic/chunker.d.ts +0 -1
- package/dist/semantic/chunker.js +0 -1
- package/dist/semantic/embedder.d.ts +15 -1
- package/dist/semantic/embedder.js +25 -1
- package/dist/semantic/semantic-index.d.ts +10 -3
- package/dist/semantic/semantic-index.js +16 -8
- package/dist/semantic/vector-store.d.ts +0 -1
- package/dist/semantic/vector-store.js +0 -1
- package/dist/sessions/index.d.ts +1 -1
- package/dist/sessions/index.js +1 -1
- package/dist/sessions/prune.d.ts +23 -0
- package/dist/sessions/prune.js +35 -0
- package/dist/sessions/search.d.ts +0 -1
- package/dist/sessions/search.js +0 -1
- package/dist/sessions/session-export.d.ts +0 -1
- package/dist/sessions/session-export.js +0 -1
- package/dist/sessions/session-store.d.ts +0 -1
- package/dist/sessions/session-store.js +2 -2
- package/dist/sessions/watch.d.ts +0 -1
- package/dist/sessions/watch.js +0 -1
- package/dist/settings-export.d.ts +0 -1
- package/dist/settings-export.js +0 -1
- package/dist/skills/activator.d.ts +0 -1
- package/dist/skills/activator.js +0 -1
- package/dist/skills/builtin.d.ts +2 -0
- package/dist/skills/builtin.js +68 -0
- package/dist/skills/index.d.ts +2 -1
- package/dist/skills/index.js +2 -1
- package/dist/skills/loader.d.ts +10 -4
- package/dist/skills/loader.js +20 -8
- package/dist/skills/marketplace-types.d.ts +0 -1
- package/dist/skills/marketplace-types.js +0 -1
- package/dist/skills/marketplace.d.ts +0 -1
- package/dist/skills/marketplace.js +2 -2
- package/dist/skills/parser.d.ts +0 -1
- package/dist/skills/parser.js +0 -1
- package/dist/skills/remote.d.ts +14 -0
- package/dist/skills/remote.js +131 -0
- package/dist/skills/types.d.ts +10 -1
- package/dist/skills/types.js +0 -1
- package/dist/specs/generate.d.ts +0 -1
- package/dist/specs/generate.js +0 -1
- package/dist/specs/index.d.ts +0 -1
- package/dist/specs/index.js +0 -1
- package/dist/specs/store.d.ts +0 -1
- package/dist/specs/store.js +0 -1
- package/dist/specs/sync.d.ts +0 -1
- package/dist/specs/sync.js +0 -1
- package/dist/specs/tasks-parser.d.ts +0 -1
- package/dist/specs/tasks-parser.js +0 -1
- package/dist/specs/types.d.ts +0 -1
- package/dist/specs/types.js +0 -1
- package/dist/steering/extra-instructions.d.ts +8 -0
- package/dist/steering/extra-instructions.js +104 -0
- package/dist/steering/folder-instructions.d.ts +8 -0
- package/dist/steering/folder-instructions.js +28 -0
- package/dist/steering/glob.d.ts +0 -1
- package/dist/steering/glob.js +0 -1
- package/dist/steering/index.d.ts +0 -1
- package/dist/steering/index.js +0 -1
- package/dist/steering/loader.d.ts +0 -1
- package/dist/steering/loader.js +0 -1
- package/dist/steering/project-instructions.d.ts +0 -1
- package/dist/steering/project-instructions.js +0 -1
- package/dist/steering/select.d.ts +0 -1
- package/dist/steering/select.js +2 -2
- package/dist/steering/types.d.ts +0 -1
- package/dist/steering/types.js +0 -1
- package/dist/structured/index.d.ts +0 -1
- package/dist/structured/index.js +0 -1
- package/dist/structured/retry.d.ts +0 -1
- package/dist/structured/retry.js +0 -1
- package/dist/structured/schema.d.ts +0 -1
- package/dist/structured/schema.js +0 -1
- package/dist/timed-fetch.d.ts +12 -0
- package/dist/timed-fetch.js +83 -0
- package/dist/tools/apply-patch.d.ts +52 -0
- package/dist/tools/apply-patch.js +197 -0
- package/dist/tools/ask-user.d.ts +27 -0
- package/dist/tools/ask-user.js +32 -0
- package/dist/tools/browser-tools.d.ts +6 -7
- package/dist/tools/browser-tools.js +3 -14
- package/dist/tools/codebase-search.d.ts +4 -3
- package/dist/tools/codebase-search.js +2 -3
- package/dist/tools/command-allow.d.ts +0 -1
- package/dist/tools/command-allow.js +0 -1
- package/dist/tools/edit-file.d.ts +0 -1
- package/dist/tools/edit-file.js +5 -4
- package/dist/tools/fetch-url.d.ts +7 -1
- package/dist/tools/fetch-url.js +52 -20
- package/dist/tools/find-references.d.ts +0 -1
- package/dist/tools/find-references.js +0 -1
- package/dist/tools/find-symbol.d.ts +2 -3
- package/dist/tools/find-symbol.js +0 -1
- package/dist/tools/ignore-rules.d.ts +0 -1
- package/dist/tools/ignore-rules.js +2 -2
- package/dist/tools/index.d.ts +5 -2
- package/dist/tools/index.js +10 -2
- package/dist/tools/list-files.d.ts +0 -1
- package/dist/tools/list-files.js +0 -1
- package/dist/tools/list-symbols.d.ts +0 -1
- package/dist/tools/list-symbols.js +0 -1
- package/dist/tools/memory.d.ts +6 -7
- package/dist/tools/memory.js +0 -1
- package/dist/tools/notebook.d.ts +2 -3
- package/dist/tools/notebook.js +0 -1
- package/dist/tools/permission-rules.d.ts +32 -0
- package/dist/tools/permission-rules.js +182 -0
- package/dist/tools/policy.d.ts +0 -1
- package/dist/tools/policy.js +0 -1
- package/dist/tools/read-file.d.ts +5 -1
- package/dist/tools/read-file.js +7 -3
- package/dist/tools/read-image.d.ts +0 -1
- package/dist/tools/read-image.js +0 -1
- package/dist/tools/read-only.d.ts +1 -2
- package/dist/tools/read-only.js +2 -1
- package/dist/tools/redact.d.ts +0 -1
- package/dist/tools/redact.js +0 -1
- package/dist/tools/result-cache.d.ts +0 -1
- package/dist/tools/result-cache.js +0 -1
- package/dist/tools/run-command.d.ts +4 -3
- package/dist/tools/run-command.js +12 -9
- package/dist/tools/sandbox-loader.d.ts +0 -1
- package/dist/tools/sandbox-loader.js +3 -14
- package/dist/tools/search-files.d.ts +8 -3
- package/dist/tools/search-files.js +43 -1
- package/dist/tools/shared.d.ts +5 -1
- package/dist/tools/shared.js +30 -3
- package/dist/tools/shell-env.d.ts +7 -0
- package/dist/tools/shell-env.js +9 -0
- package/dist/tools/sub-agent-wait.d.ts +29 -0
- package/dist/tools/sub-agent-wait.js +60 -0
- package/dist/tools/sub-agent.d.ts +50 -5
- package/dist/tools/sub-agent.js +210 -126
- package/dist/tools/text-encoding.d.ts +10 -0
- package/dist/tools/text-encoding.js +40 -0
- package/dist/tools/todo.d.ts +36 -0
- package/dist/tools/todo.js +42 -0
- package/dist/tools/web-search.d.ts +0 -1
- package/dist/tools/web-search.js +0 -1
- package/dist/tools/write-file.d.ts +0 -1
- package/dist/tools/write-file.js +15 -10
- package/dist/tools/write-tools.d.ts +12 -0
- package/dist/tools/write-tools.js +18 -0
- package/dist/types.d.ts +85 -2
- package/dist/types.js +0 -1
- package/dist/verify/detect.d.ts +0 -1
- package/dist/verify/detect.js +0 -1
- package/dist/verify/index.d.ts +0 -1
- package/dist/verify/index.js +0 -1
- package/dist/worktree/branch-ops.d.ts +0 -1
- package/dist/worktree/branch-ops.js +0 -1
- package/dist/worktree/index.d.ts +0 -1
- package/dist/worktree/index.js +0 -1
- package/dist/worktree/worktree.d.ts +3 -1
- package/dist/worktree/worktree.js +22 -1
- package/package.json +3 -2
- package/dist/agent/agent.d.ts.map +0 -1
- package/dist/agent/agent.js.map +0 -1
- package/dist/agent/architect.d.ts.map +0 -1
- package/dist/agent/architect.js.map +0 -1
- package/dist/agent/cache-hints.d.ts.map +0 -1
- package/dist/agent/cache-hints.js.map +0 -1
- package/dist/agent/cost-router.d.ts.map +0 -1
- package/dist/agent/cost-router.js.map +0 -1
- package/dist/agent/index.d.ts.map +0 -1
- package/dist/agent/index.js.map +0 -1
- package/dist/agent/prompts.d.ts.map +0 -1
- package/dist/agent/prompts.js.map +0 -1
- package/dist/agent/think-tags.d.ts.map +0 -1
- package/dist/agent/think-tags.js.map +0 -1
- package/dist/agent/verify.d.ts.map +0 -1
- package/dist/agent/verify.js.map +0 -1
- package/dist/ai-comments/index.d.ts.map +0 -1
- package/dist/ai-comments/index.js.map +0 -1
- package/dist/attachments.d.ts.map +0 -1
- package/dist/attachments.js.map +0 -1
- package/dist/browser/cdp.d.ts.map +0 -1
- package/dist/browser/cdp.js.map +0 -1
- package/dist/browser/chrome.d.ts.map +0 -1
- package/dist/browser/chrome.js.map +0 -1
- package/dist/browser/session.d.ts.map +0 -1
- package/dist/browser/session.js.map +0 -1
- package/dist/checkpoints/index.d.ts.map +0 -1
- package/dist/checkpoints/index.js.map +0 -1
- package/dist/checkpoints/store.d.ts.map +0 -1
- package/dist/checkpoints/store.js.map +0 -1
- package/dist/checkpoints/types.d.ts.map +0 -1
- package/dist/checkpoints/types.js.map +0 -1
- package/dist/code-index/builder.d.ts.map +0 -1
- package/dist/code-index/builder.js.map +0 -1
- package/dist/code-index/index-store.d.ts.map +0 -1
- package/dist/code-index/index-store.js.map +0 -1
- package/dist/code-index/parser.d.ts.map +0 -1
- package/dist/code-index/parser.js.map +0 -1
- package/dist/code-index/types.d.ts.map +0 -1
- package/dist/code-index/types.js.map +0 -1
- package/dist/commands/custom-commands.d.ts.map +0 -1
- package/dist/commands/custom-commands.js.map +0 -1
- package/dist/config-file.d.ts.map +0 -1
- package/dist/config-file.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/context/compaction.d.ts.map +0 -1
- package/dist/context/compaction.js.map +0 -1
- package/dist/context/mask.d.ts.map +0 -1
- package/dist/context/mask.js.map +0 -1
- package/dist/credentials/index.d.ts.map +0 -1
- package/dist/credentials/index.js.map +0 -1
- package/dist/credentials/types.d.ts.map +0 -1
- package/dist/credentials/types.js.map +0 -1
- package/dist/diff/index.d.ts.map +0 -1
- package/dist/diff/index.js.map +0 -1
- package/dist/diff/unified-diff.d.ts.map +0 -1
- package/dist/diff/unified-diff.js.map +0 -1
- package/dist/git/auto-commit.d.ts.map +0 -1
- package/dist/git/auto-commit.js.map +0 -1
- package/dist/git/index.d.ts.map +0 -1
- package/dist/git/index.js.map +0 -1
- package/dist/github/github-tools.d.ts.map +0 -1
- package/dist/github/github-tools.js.map +0 -1
- package/dist/hooks/agent-runner.d.ts.map +0 -1
- package/dist/hooks/agent-runner.js.map +0 -1
- package/dist/hooks/bus.d.ts.map +0 -1
- package/dist/hooks/bus.js.map +0 -1
- package/dist/hooks/config.d.ts.map +0 -1
- package/dist/hooks/config.js.map +0 -1
- package/dist/hooks/events.d.ts.map +0 -1
- package/dist/hooks/events.js.map +0 -1
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/loader.d.ts.map +0 -1
- package/dist/hooks/loader.js.map +0 -1
- package/dist/hooks/runner.d.ts.map +0 -1
- package/dist/hooks/runner.js.map +0 -1
- package/dist/hooks/watch-coalescer.d.ts.map +0 -1
- package/dist/hooks/watch-coalescer.js.map +0 -1
- package/dist/hooks/watch-ignore.d.ts.map +0 -1
- package/dist/hooks/watch-ignore.js.map +0 -1
- package/dist/hooks/watcher.d.ts.map +0 -1
- package/dist/hooks/watcher.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lazy-model.d.ts.map +0 -1
- package/dist/lazy-model.js.map +0 -1
- package/dist/lint/auto-lint.d.ts.map +0 -1
- package/dist/lint/auto-lint.js.map +0 -1
- package/dist/lint/index.d.ts.map +0 -1
- package/dist/lint/index.js.map +0 -1
- package/dist/lsp/client.d.ts.map +0 -1
- package/dist/lsp/client.js.map +0 -1
- package/dist/lsp/diagnostics.d.ts.map +0 -1
- package/dist/lsp/diagnostics.js.map +0 -1
- package/dist/lsp/index.d.ts.map +0 -1
- package/dist/lsp/index.js.map +0 -1
- package/dist/mcp/catalog.d.ts.map +0 -1
- package/dist/mcp/catalog.js.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/json-schema-to-zod.d.ts.map +0 -1
- package/dist/mcp/json-schema-to-zod.js.map +0 -1
- package/dist/mcp/manager.d.ts.map +0 -1
- package/dist/mcp/manager.js.map +0 -1
- package/dist/mcp/marketplace-types.d.ts.map +0 -1
- package/dist/mcp/marketplace-types.js.map +0 -1
- package/dist/mcp/marketplace.d.ts.map +0 -1
- package/dist/mcp/marketplace.js.map +0 -1
- package/dist/mcp/mcp-client.d.ts.map +0 -1
- package/dist/mcp/mcp-client.js.map +0 -1
- package/dist/mcp/mcp-config.d.ts.map +0 -1
- package/dist/mcp/mcp-config.js.map +0 -1
- package/dist/mcp/registry.d.ts.map +0 -1
- package/dist/mcp/registry.js.map +0 -1
- package/dist/memory/memory-store.d.ts.map +0 -1
- package/dist/memory/memory-store.js.map +0 -1
- package/dist/memory/rank.d.ts.map +0 -1
- package/dist/memory/rank.js.map +0 -1
- package/dist/memory/stale.d.ts.map +0 -1
- package/dist/memory/stale.js.map +0 -1
- package/dist/model-alias.d.ts.map +0 -1
- package/dist/model-alias.js.map +0 -1
- package/dist/model-catalog.d.ts.map +0 -1
- package/dist/model-catalog.js.map +0 -1
- package/dist/model-list.d.ts.map +0 -1
- package/dist/model-list.js.map +0 -1
- package/dist/orchestrator/board-tools.d.ts.map +0 -1
- package/dist/orchestrator/board-tools.js.map +0 -1
- package/dist/orchestrator/board.d.ts.map +0 -1
- package/dist/orchestrator/board.js.map +0 -1
- package/dist/orchestrator/index.d.ts.map +0 -1
- package/dist/orchestrator/index.js.map +0 -1
- package/dist/orchestrator/orchestrator.d.ts.map +0 -1
- package/dist/orchestrator/orchestrator.js.map +0 -1
- package/dist/orchestrator/router.d.ts.map +0 -1
- package/dist/orchestrator/router.js.map +0 -1
- package/dist/orchestrator/specialists-registry.d.ts.map +0 -1
- package/dist/orchestrator/specialists-registry.js.map +0 -1
- package/dist/orchestrator/specialists.d.ts.map +0 -1
- package/dist/orchestrator/specialists.js.map +0 -1
- package/dist/orchestrator/types.d.ts.map +0 -1
- package/dist/orchestrator/types.js.map +0 -1
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/index.js.map +0 -1
- package/dist/plugins/install.d.ts.map +0 -1
- package/dist/plugins/install.js.map +0 -1
- package/dist/plugins/loader.d.ts.map +0 -1
- package/dist/plugins/loader.js.map +0 -1
- package/dist/policy/audit.d.ts.map +0 -1
- package/dist/policy/audit.js.map +0 -1
- package/dist/policy/policy.d.ts.map +0 -1
- package/dist/policy/policy.js.map +0 -1
- package/dist/policy/proxy.d.ts.map +0 -1
- package/dist/policy/proxy.js.map +0 -1
- package/dist/pricing.d.ts.map +0 -1
- package/dist/pricing.js.map +0 -1
- package/dist/providers.d.ts.map +0 -1
- package/dist/providers.js.map +0 -1
- package/dist/repomap/index.d.ts.map +0 -1
- package/dist/repomap/index.js.map +0 -1
- package/dist/repomap/repo-map.d.ts.map +0 -1
- package/dist/repomap/repo-map.js.map +0 -1
- package/dist/semantic/chunker.d.ts.map +0 -1
- package/dist/semantic/chunker.js.map +0 -1
- package/dist/semantic/embedder.d.ts.map +0 -1
- package/dist/semantic/embedder.js.map +0 -1
- package/dist/semantic/semantic-index.d.ts.map +0 -1
- package/dist/semantic/semantic-index.js.map +0 -1
- package/dist/semantic/vector-store.d.ts.map +0 -1
- package/dist/semantic/vector-store.js.map +0 -1
- package/dist/sessions/index.d.ts.map +0 -1
- package/dist/sessions/index.js.map +0 -1
- package/dist/sessions/search.d.ts.map +0 -1
- package/dist/sessions/search.js.map +0 -1
- package/dist/sessions/session-export.d.ts.map +0 -1
- package/dist/sessions/session-export.js.map +0 -1
- package/dist/sessions/session-store.d.ts.map +0 -1
- package/dist/sessions/session-store.js.map +0 -1
- package/dist/sessions/watch.d.ts.map +0 -1
- package/dist/sessions/watch.js.map +0 -1
- package/dist/settings-export.d.ts.map +0 -1
- package/dist/settings-export.js.map +0 -1
- package/dist/skills/activator.d.ts.map +0 -1
- package/dist/skills/activator.js.map +0 -1
- package/dist/skills/index.d.ts.map +0 -1
- package/dist/skills/index.js.map +0 -1
- package/dist/skills/loader.d.ts.map +0 -1
- package/dist/skills/loader.js.map +0 -1
- package/dist/skills/marketplace-types.d.ts.map +0 -1
- package/dist/skills/marketplace-types.js.map +0 -1
- package/dist/skills/marketplace.d.ts.map +0 -1
- package/dist/skills/marketplace.js.map +0 -1
- package/dist/skills/parser.d.ts.map +0 -1
- package/dist/skills/parser.js.map +0 -1
- package/dist/skills/types.d.ts.map +0 -1
- package/dist/skills/types.js.map +0 -1
- package/dist/specs/generate.d.ts.map +0 -1
- package/dist/specs/generate.js.map +0 -1
- package/dist/specs/index.d.ts.map +0 -1
- package/dist/specs/index.js.map +0 -1
- package/dist/specs/store.d.ts.map +0 -1
- package/dist/specs/store.js.map +0 -1
- package/dist/specs/sync.d.ts.map +0 -1
- package/dist/specs/sync.js.map +0 -1
- package/dist/specs/tasks-parser.d.ts.map +0 -1
- package/dist/specs/tasks-parser.js.map +0 -1
- package/dist/specs/types.d.ts.map +0 -1
- package/dist/specs/types.js.map +0 -1
- package/dist/steering/glob.d.ts.map +0 -1
- package/dist/steering/glob.js.map +0 -1
- package/dist/steering/index.d.ts.map +0 -1
- package/dist/steering/index.js.map +0 -1
- package/dist/steering/loader.d.ts.map +0 -1
- package/dist/steering/loader.js.map +0 -1
- package/dist/steering/project-instructions.d.ts.map +0 -1
- package/dist/steering/project-instructions.js.map +0 -1
- package/dist/steering/select.d.ts.map +0 -1
- package/dist/steering/select.js.map +0 -1
- package/dist/steering/types.d.ts.map +0 -1
- package/dist/steering/types.js.map +0 -1
- package/dist/structured/index.d.ts.map +0 -1
- package/dist/structured/index.js.map +0 -1
- package/dist/structured/retry.d.ts.map +0 -1
- package/dist/structured/retry.js.map +0 -1
- package/dist/structured/schema.d.ts.map +0 -1
- package/dist/structured/schema.js.map +0 -1
- package/dist/tools/browser-tools.d.ts.map +0 -1
- package/dist/tools/browser-tools.js.map +0 -1
- package/dist/tools/codebase-search.d.ts.map +0 -1
- package/dist/tools/codebase-search.js.map +0 -1
- package/dist/tools/command-allow.d.ts.map +0 -1
- package/dist/tools/command-allow.js.map +0 -1
- package/dist/tools/edit-file.d.ts.map +0 -1
- package/dist/tools/edit-file.js.map +0 -1
- package/dist/tools/fetch-url.d.ts.map +0 -1
- package/dist/tools/fetch-url.js.map +0 -1
- package/dist/tools/find-references.d.ts.map +0 -1
- package/dist/tools/find-references.js.map +0 -1
- package/dist/tools/find-symbol.d.ts.map +0 -1
- package/dist/tools/find-symbol.js.map +0 -1
- package/dist/tools/ignore-rules.d.ts.map +0 -1
- package/dist/tools/ignore-rules.js.map +0 -1
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/list-files.d.ts.map +0 -1
- package/dist/tools/list-files.js.map +0 -1
- package/dist/tools/list-symbols.d.ts.map +0 -1
- package/dist/tools/list-symbols.js.map +0 -1
- package/dist/tools/memory.d.ts.map +0 -1
- package/dist/tools/memory.js.map +0 -1
- package/dist/tools/notebook.d.ts.map +0 -1
- package/dist/tools/notebook.js.map +0 -1
- package/dist/tools/policy.d.ts.map +0 -1
- package/dist/tools/policy.js.map +0 -1
- package/dist/tools/read-file.d.ts.map +0 -1
- package/dist/tools/read-file.js.map +0 -1
- package/dist/tools/read-image.d.ts.map +0 -1
- package/dist/tools/read-image.js.map +0 -1
- package/dist/tools/read-only.d.ts.map +0 -1
- package/dist/tools/read-only.js.map +0 -1
- package/dist/tools/redact.d.ts.map +0 -1
- package/dist/tools/redact.js.map +0 -1
- package/dist/tools/result-cache.d.ts.map +0 -1
- package/dist/tools/result-cache.js.map +0 -1
- package/dist/tools/run-command.d.ts.map +0 -1
- package/dist/tools/run-command.js.map +0 -1
- package/dist/tools/sandbox-loader.d.ts.map +0 -1
- package/dist/tools/sandbox-loader.js.map +0 -1
- package/dist/tools/search-files.d.ts.map +0 -1
- package/dist/tools/search-files.js.map +0 -1
- package/dist/tools/shared.d.ts.map +0 -1
- package/dist/tools/shared.js.map +0 -1
- package/dist/tools/sub-agent.d.ts.map +0 -1
- package/dist/tools/sub-agent.js.map +0 -1
- package/dist/tools/web-search.d.ts.map +0 -1
- package/dist/tools/web-search.js.map +0 -1
- package/dist/tools/write-file.d.ts.map +0 -1
- package/dist/tools/write-file.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/verify/detect.d.ts.map +0 -1
- package/dist/verify/detect.js.map +0 -1
- package/dist/verify/index.d.ts.map +0 -1
- package/dist/verify/index.js.map +0 -1
- package/dist/worktree/branch-ops.d.ts.map +0 -1
- package/dist/worktree/branch-ops.js.map +0 -1
- package/dist/worktree/index.d.ts.map +0 -1
- package/dist/worktree/index.js.map +0 -1
- package/dist/worktree/worktree.d.ts.map +0 -1
- package/dist/worktree/worktree.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 IKarmic
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
IKarmic Forge Core: Proprietary License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 IKarmic. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This license covers "@ikarmic/forge-core" version 5.0.0 and later
|
|
6
|
+
(the "Software"). Earlier versions (4.5.0 and before) were released under
|
|
7
|
+
the MIT License and stay under it.
|
|
8
|
+
|
|
9
|
+
1. Grant. IKarmic grants you a non-exclusive, non-transferable, royalty-free
|
|
10
|
+
licence to install and run the Software, in the form distributed by
|
|
11
|
+
IKarmic, as a dependency of the IKarmic Forge VS Code extension and the
|
|
12
|
+
IKarmic Forge command line tool (the "Forge Clients"), for any purpose,
|
|
13
|
+
including commercial use.
|
|
14
|
+
|
|
15
|
+
2. Restrictions. You may not, and may not let others:
|
|
16
|
+
a. copy, modify, translate or create derivative works of the Software;
|
|
17
|
+
b. redistribute, sublicense, sell, lease or host the Software, alone or
|
|
18
|
+
bundled in another product, except as part of an unmodified Forge
|
|
19
|
+
Client distributed by IKarmic;
|
|
20
|
+
c. reverse engineer, decompile or disassemble the Software, except to the
|
|
21
|
+
extent applicable law forbids this restriction;
|
|
22
|
+
d. use the Software to build a product or service that competes with the
|
|
23
|
+
Forge Clients or with IKarmic's paid editions;
|
|
24
|
+
e. remove or alter any copyright, licence or attribution notice.
|
|
25
|
+
|
|
26
|
+
3. Enterprise features. Features marked as enterprise features need a valid
|
|
27
|
+
licence key from IKarmic. Using them without one is not permitted.
|
|
28
|
+
|
|
29
|
+
4. Ownership. IKarmic and its licensors keep all rights not granted here.
|
|
30
|
+
No right is granted by implication or estoppel.
|
|
31
|
+
|
|
32
|
+
5. Open-source Forge Clients. The Forge Clients' own source code is licensed
|
|
33
|
+
separately under AGPL-3.0-only (see the LICENSE and NOTICE files of the
|
|
34
|
+
Forge Clients). That licence does not extend to this Software, and
|
|
35
|
+
nothing in it lets you redistribute this Software.
|
|
36
|
+
|
|
37
|
+
6. No warranty. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
38
|
+
KIND. IKARMIC IS NOT LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
|
|
39
|
+
ARISING FROM THE SOFTWARE OR ITS USE, TO THE EXTENT THE LAW ALLOWS.
|
|
40
|
+
|
|
41
|
+
7. Termination. This licence ends automatically if you break it. On
|
|
42
|
+
termination you must stop using and delete all copies of the Software.
|
|
43
|
+
|
|
44
|
+
Contact: ikarmicaiss@gmail.com
|
package/README.md
CHANGED
package/dist/agent/agent.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export declare class Agent {
|
|
|
15
15
|
private readonly checkpoints;
|
|
16
16
|
private readonly browser;
|
|
17
17
|
private readonly audit;
|
|
18
|
+
private readonly permissionRules;
|
|
19
|
+
private todoList;
|
|
18
20
|
constructor(config: AgentConfig);
|
|
19
21
|
/** Files whose modification should trigger a pre-tool checkpoint. */
|
|
20
22
|
private get captureBeforeTools();
|
|
@@ -42,6 +44,12 @@ export declare class Agent {
|
|
|
42
44
|
* we never want to "skip".
|
|
43
45
|
*/
|
|
44
46
|
private wrapToolsWithCache;
|
|
47
|
+
/**
|
|
48
|
+
* What the permission rules say about one tool call: `allow` (every target allowed), `deny` (any target denied,
|
|
49
|
+
* with the reason the model sees), `ask` (a target asks, a `.env` file is read, or a command leaves the workspace),
|
|
50
|
+
* or undefined when no rule applies and the normal approval flow decides.
|
|
51
|
+
*/
|
|
52
|
+
private decidePermission;
|
|
45
53
|
private requestApproval;
|
|
46
54
|
/**
|
|
47
55
|
* Build the default LLM-based summarizer for compaction. Picks the
|
|
@@ -58,4 +66,3 @@ export declare class Agent {
|
|
|
58
66
|
* we don't want to fail just because the user typed a stale name.
|
|
59
67
|
*/
|
|
60
68
|
export declare function applySandbox(tools: ToolDefinition[], sandbox: ToolSandbox | undefined): ToolDefinition[];
|
|
61
|
-
//# sourceMappingURL=agent.d.ts.map
|
package/dist/agent/agent.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { streamText } from 'ai';
|
|
2
2
|
import { lintFile, lintMessage } from '../lint/auto-lint.js';
|
|
3
3
|
import { buildMemoryBlock } from '../memory/memory-store.js';
|
|
4
|
+
import { filesTouchedBy } from '../tools/write-tools.js';
|
|
5
|
+
import { buildExtraInstructionsBlock } from '../steering/extra-instructions.js';
|
|
4
6
|
import { buildProjectInstructionsBlock } from '../steering/project-instructions.js';
|
|
5
7
|
import { buildRepoMap, repoMapBlock } from '../repomap/repo-map.js';
|
|
6
8
|
import { buildLlmSummarizer, compactMessages, effectiveLimitTokens, getModelWindowTokens, shouldCompactForBudget } from '../context/compaction.js';
|
|
@@ -15,7 +17,9 @@ import { createGitHubTools, githubFromEnv } from '../github/github-tools.js';
|
|
|
15
17
|
import { createWebSearchTool, webSearchFromEnv } from '../tools/web-search.js';
|
|
16
18
|
import { embedderFromEnv } from '../semantic/embedder.js';
|
|
17
19
|
import { DEFAULT_VERIFY_RETRIES, failureMessage, runVerification } from './verify.js';
|
|
20
|
+
import { LoopGuard, resultKeyOf } from './loop-guard.js';
|
|
18
21
|
import { isListedCommand } from '../tools/command-allow.js';
|
|
22
|
+
import { compilePermissionRules, evaluatePermission, isSensitiveFile, permissionFor, touchesOutsideCwd, } from '../tools/permission-rules.js';
|
|
19
23
|
import { createLanguageModel } from '../providers.js';
|
|
20
24
|
import { BUILTIN_TOOLS } from '../tools/index.js';
|
|
21
25
|
import { ToolResultCache, cachedExecute } from '../tools/result-cache.js';
|
|
@@ -31,9 +35,9 @@ const DEFAULT_MAX_CONTINUATIONS = 3;
|
|
|
31
35
|
export const DEFAULT_MAX_DURATION_MS = 10 * 60 * 1000;
|
|
32
36
|
const REDACTABLE_TOOLS = new Set(['read_file', 'search_files', 'list_files']);
|
|
33
37
|
/** Tools whose successful `path` argument can trigger mid-run fileMatch steering. */
|
|
34
|
-
const STEERING_FILE_TOOLS = new Set(['read_file', 'write_file', 'edit_file', 'edit_notebook']);
|
|
38
|
+
const STEERING_FILE_TOOLS = new Set(['read_file', 'write_file', 'edit_file', 'edit_notebook', 'apply_patch']);
|
|
35
39
|
/** Tools that change a file, so auto-lint checks their `path` afterwards. */
|
|
36
|
-
const FILE_WRITE_TOOLS = new Set(['write_file', 'edit_file', 'edit_notebook']);
|
|
40
|
+
const FILE_WRITE_TOOLS = new Set(['write_file', 'edit_file', 'edit_notebook', 'apply_patch']);
|
|
37
41
|
/** Pure reads whose results may be reused within a run. Every other tool invalidates the cache. */
|
|
38
42
|
const CACHEABLE_TOOLS = new Set(['read_file', 'read_image', 'list_files', 'search_files', 'find_symbol', 'list_symbols', 'find_references', 'codebase_search', 'memory_read', 'fetch_url', 'web_search']);
|
|
39
43
|
/**
|
|
@@ -51,12 +55,16 @@ export class Agent {
|
|
|
51
55
|
checkpoints;
|
|
52
56
|
browser;
|
|
53
57
|
audit;
|
|
58
|
+
permissionRules;
|
|
59
|
+
todoList = [];
|
|
54
60
|
constructor(config) {
|
|
55
61
|
// Organization policy first: everything below sees the already-tightened config.
|
|
56
62
|
const policy = config.policy === undefined ? getOrgPolicy()?.policy : (config.policy ?? undefined);
|
|
57
63
|
config = applyPolicy(config, policy);
|
|
58
64
|
this.audit = config.audit ?? (policy?.audit?.enabled ? createFileAuditSink(policy.audit.file) : undefined);
|
|
59
65
|
this.config = config;
|
|
66
|
+
this.permissionRules = compilePermissionRules(config.permissionRules);
|
|
67
|
+
this.todoList = config.initialTodos ? [...config.initialTodos] : [];
|
|
60
68
|
const allTools = (config.disableBuiltins
|
|
61
69
|
? [...(config.extraTools ?? [])]
|
|
62
70
|
: [...BUILTIN_TOOLS, ...(config.extraTools ?? [])]);
|
|
@@ -71,12 +79,19 @@ export class Agent {
|
|
|
71
79
|
if (webSearch)
|
|
72
80
|
allTools.push(createWebSearchTool(webSearch));
|
|
73
81
|
if (config.semanticSearch) {
|
|
74
|
-
allTools.push(createCodebaseSearchTool(config.semanticSearch.embedder ?? embedderFromEnv()
|
|
82
|
+
allTools.push(createCodebaseSearchTool(config.semanticSearch.embedder ?? embedderFromEnv(), {
|
|
83
|
+
...(config.semanticSearch.extensions ? { extensions: config.semanticSearch.extensions } : {}),
|
|
84
|
+
...(config.semanticSearch.minScore !== undefined ? { minScore: config.semanticSearch.minScore } : {}),
|
|
85
|
+
...(config.semanticSearch.defaultLimit ? { defaultLimit: config.semanticSearch.defaultLimit } : {}),
|
|
86
|
+
}));
|
|
75
87
|
}
|
|
76
88
|
const memoryFiltered = config.disableMemory
|
|
77
89
|
? allTools.filter((t) => t.name !== 'memory_read' && t.name !== 'memory_write' && t.name !== 'memory_forget')
|
|
78
90
|
: allTools;
|
|
79
|
-
|
|
91
|
+
// `ask_user` is offered only when a surface can answer and the run is not autonomous.
|
|
92
|
+
const canAsk = Boolean(config.askUser) && !config.auto && !config.disableAskUser;
|
|
93
|
+
const askFiltered = canAsk ? memoryFiltered : memoryFiltered.filter((t) => t.name !== 'ask_user');
|
|
94
|
+
const sandboxedTools = applySandbox(askFiltered, config.toolSandbox);
|
|
80
95
|
this.tools = this.wrapToolsWithCache(sandboxedTools, config.cacheSize, config.cacheTtlMs, config.disableCache);
|
|
81
96
|
this.cache = new ToolResultCache({
|
|
82
97
|
maxSize: config.disableCache ? 0 : (config.cacheSize ?? 256),
|
|
@@ -95,7 +110,7 @@ export class Agent {
|
|
|
95
110
|
const cfg = this.checkpoints?.captureBeforeTools;
|
|
96
111
|
if (!cfg) {
|
|
97
112
|
// Default: file-mutating tools + run_command (which can mutate via shell).
|
|
98
|
-
return new Set(['write_file', 'edit_file', 'edit_notebook', 'run_command']);
|
|
113
|
+
return new Set(['write_file', 'edit_file', 'edit_notebook', 'apply_patch', 'run_command']);
|
|
99
114
|
}
|
|
100
115
|
return new Set(cfg);
|
|
101
116
|
}
|
|
@@ -216,6 +231,14 @@ export class Agent {
|
|
|
216
231
|
let model = modelFactory(currentModelConfig);
|
|
217
232
|
let stepPricing = this.pricing;
|
|
218
233
|
let lastToolNames = [];
|
|
234
|
+
// Stops a run that repeats one identical tool call (off unless `loopGuardThreshold` is set).
|
|
235
|
+
const loopGuard = new LoopGuard(this.config.loopGuardThreshold ?? 0);
|
|
236
|
+
let loopTripped;
|
|
237
|
+
// Every call outcome feeds the guard (results, errors, invalid or denied calls), so a different call in between resets the streak.
|
|
238
|
+
const trackLoop = (tool, args, outcome) => {
|
|
239
|
+
if (loopGuard.record(tool, args, resultKeyOf(outcome)) && !loopTripped)
|
|
240
|
+
loopTripped = { tool, count: loopGuard.streak };
|
|
241
|
+
};
|
|
219
242
|
// Verify loop state: only run checks when the run actually edited files.
|
|
220
243
|
let editedSinceVerify = false;
|
|
221
244
|
const editedFiles = new Set();
|
|
@@ -226,12 +249,29 @@ export class Agent {
|
|
|
226
249
|
let verification;
|
|
227
250
|
// Infinite output: text of a reply that hit the output limit and is being continued.
|
|
228
251
|
let continuedText = '';
|
|
252
|
+
// The answer text of the step now streaming, kept so a Stop does not throw away what was already said.
|
|
253
|
+
let partialStepText = '';
|
|
229
254
|
let continuations = 0;
|
|
230
255
|
const maxContinuations = this.config.maxContinuations ?? DEFAULT_MAX_CONTINUATIONS;
|
|
231
256
|
const ctx = {
|
|
232
257
|
cwd: this.config.cwd ?? process.cwd(),
|
|
233
258
|
auto: this.config.auto ?? false,
|
|
234
259
|
parentModel: this.config.model,
|
|
260
|
+
...(this.config.subAgentModel ? { subAgentModel: this.config.subAgentModel } : {}),
|
|
261
|
+
...(this.config.backgroundAgents ? { background: this.config.backgroundAgents } : {}),
|
|
262
|
+
...(this.config.autoApproveTools ? { autoApproveTools: this.config.autoApproveTools } : {}),
|
|
263
|
+
...(this.config.permissionRules ? { permissionRules: this.config.permissionRules } : {}),
|
|
264
|
+
...(this.config.toolSandbox ? { toolSandbox: this.config.toolSandbox } : {}),
|
|
265
|
+
shownFolderInstructions: new Set(),
|
|
266
|
+
...(this.config.maxToolOutputChars ? { maxOutputChars: this.config.maxToolOutputChars } : {}),
|
|
267
|
+
...(this.config.askUser ? { askUser: this.config.askUser } : {}),
|
|
268
|
+
todos: {
|
|
269
|
+
get: () => this.todoList,
|
|
270
|
+
set: (todos) => {
|
|
271
|
+
this.todoList = todos;
|
|
272
|
+
emit({ type: 'todo_updated', todos });
|
|
273
|
+
},
|
|
274
|
+
},
|
|
235
275
|
...(this.config.commandRunner ? { commandRunner: this.config.commandRunner } : {}),
|
|
236
276
|
...(abortSignal ? { abortSignal } : {}),
|
|
237
277
|
...(this.config.memoryMaxBodyChars !== undefined ? { memoryMaxBodyChars: this.config.memoryMaxBodyChars } : {}),
|
|
@@ -280,13 +320,16 @@ export class Agent {
|
|
|
280
320
|
// Track per-turn token deltas so we can compute per-turn cost.
|
|
281
321
|
const turnStart = { input: inputTokens, output: outputTokens, cacheRead: cacheReadTokens, cacheWrite: cacheWriteTokens };
|
|
282
322
|
let reasoningText = '';
|
|
323
|
+
partialStepText = '';
|
|
283
324
|
// Inline <think> blocks (MiniMax over OpenAI-compatible, some open models) become reasoning events.
|
|
284
325
|
const thinkSplitter = new ThinkSplitter();
|
|
285
326
|
let wasInThink = false;
|
|
286
327
|
const emitSegments = (segments) => {
|
|
287
328
|
for (const seg of segments) {
|
|
288
|
-
if (seg.kind === 'text')
|
|
329
|
+
if (seg.kind === 'text') {
|
|
330
|
+
partialStepText += seg.text;
|
|
289
331
|
emit({ type: 'text_delta', text: seg.text });
|
|
332
|
+
}
|
|
290
333
|
else {
|
|
291
334
|
reasoningText += seg.text;
|
|
292
335
|
emit({ type: 'reasoning_delta', text: seg.text });
|
|
@@ -320,6 +363,7 @@ export class Agent {
|
|
|
320
363
|
tools: toAiSdkTools(this.tools),
|
|
321
364
|
abortSignal,
|
|
322
365
|
...(this.config.model.reasoningEffort ? { reasoning: this.config.model.reasoningEffort } : {}),
|
|
366
|
+
...(this.config.model.temperature !== undefined ? { temperature: this.config.model.temperature } : {}),
|
|
323
367
|
onChunk: ({ chunk }) => {
|
|
324
368
|
if (chunk.type === 'text-delta') {
|
|
325
369
|
emitSegments(thinkSplitter.push(chunk.text));
|
|
@@ -342,6 +386,7 @@ export class Agent {
|
|
|
342
386
|
},
|
|
343
387
|
onFinish: ({ text: rawText, usage }) => {
|
|
344
388
|
emitSegments(thinkSplitter.flush());
|
|
389
|
+
partialStepText = '';
|
|
345
390
|
if (reasoningText) {
|
|
346
391
|
emit({ type: 'reasoning_done', text: reasoningText });
|
|
347
392
|
reasoningText = '';
|
|
@@ -483,11 +528,13 @@ export class Agent {
|
|
|
483
528
|
if (!def) {
|
|
484
529
|
currentToolResults.push(toolResultError(call.toolCallId, call.toolName, `Unknown tool: ${call.toolName}`));
|
|
485
530
|
emit({ type: 'tool_result', name: call.toolName, id: call.toolCallId, result: `Unknown tool`, isError: true });
|
|
531
|
+
trackLoop(call.toolName, call.input, 'unknown tool');
|
|
486
532
|
continue;
|
|
487
533
|
}
|
|
488
534
|
const argsParsed = def.parameters.safeParse(call.input);
|
|
489
535
|
if (!argsParsed.success) {
|
|
490
536
|
const message = `Invalid arguments for ${call.toolName}: ${argsParsed.error.message}`;
|
|
537
|
+
trackLoop(call.toolName, call.input, message);
|
|
491
538
|
currentToolResults.push(toolResultError(call.toolCallId, call.toolName, message));
|
|
492
539
|
emit({ type: 'tool_result', name: call.toolName, id: call.toolCallId, result: message, isError: true });
|
|
493
540
|
continue;
|
|
@@ -496,6 +543,7 @@ export class Agent {
|
|
|
496
543
|
this.audit?.record({ event: 'tool_call', tool: call.toolName, args: approval.args ?? argsParsed.data, approved: approval.approved, auto: this.config.auto === true }, auditCtx);
|
|
497
544
|
if (!approval.approved) {
|
|
498
545
|
const denial = approval.note ? `Denied by user. ${approval.note}` : `Denied by user.`;
|
|
546
|
+
trackLoop(call.toolName, argsParsed.data, denial);
|
|
499
547
|
currentToolResults.push(toolResult(call.toolCallId, call.toolName, denial));
|
|
500
548
|
emit({ type: 'tool_result', name: call.toolName, id: call.toolCallId, result: denial, isError: false });
|
|
501
549
|
continue;
|
|
@@ -507,6 +555,7 @@ export class Agent {
|
|
|
507
555
|
const edited = def.parameters.safeParse(approval.args);
|
|
508
556
|
if (!edited.success) {
|
|
509
557
|
const message = `Invalid edited arguments for ${call.toolName}: ${edited.error.message}`;
|
|
558
|
+
trackLoop(call.toolName, approval.args, message);
|
|
510
559
|
currentToolResults.push(toolResultError(call.toolCallId, call.toolName, message));
|
|
511
560
|
emit({ type: 'tool_result', name: call.toolName, id: call.toolCallId, result: message, isError: true });
|
|
512
561
|
continue;
|
|
@@ -564,12 +613,16 @@ export class Agent {
|
|
|
564
613
|
this.audit?.record({ event: 'tool_result', tool: call.toolName, isError: false, durationMs: Date.now() - toolStartedAt }, auditCtx);
|
|
565
614
|
if (FILE_WRITE_TOOLS.has(call.toolName))
|
|
566
615
|
editedSinceVerify = true;
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
616
|
+
// Every file the call worked on: a patch can change several (RB-13).
|
|
617
|
+
const touchedFiles = filesTouchedBy(call.toolName, toolArgs);
|
|
618
|
+
if (FILE_WRITE_TOOLS.has(call.toolName))
|
|
619
|
+
for (const p of touchedFiles)
|
|
620
|
+
editedFiles.add(p);
|
|
621
|
+
if (this.config.autoLint && FILE_WRITE_TOOLS.has(call.toolName)) {
|
|
622
|
+
for (const editedPath of touchedFiles) {
|
|
623
|
+
const report = await lintFile(editedPath, this.config.autoLint, { ...ctx, policy: undefined }).catch(() => null);
|
|
624
|
+
if (!report)
|
|
625
|
+
continue;
|
|
573
626
|
emit({ type: 'lint', path: report.path, passed: report.passed, problems: report.problems.length });
|
|
574
627
|
if (!report.passed) {
|
|
575
628
|
const note = lintMessage(report);
|
|
@@ -586,11 +639,9 @@ export class Agent {
|
|
|
586
639
|
: { result: finalResult, userNote: approval.note };
|
|
587
640
|
}
|
|
588
641
|
currentToolResults.push(toolResult(call.toolCallId, call.toolName, finalResult));
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
touchedPaths.push(touched);
|
|
593
|
-
}
|
|
642
|
+
trackLoop(call.toolName, toolArgs, finalResult);
|
|
643
|
+
if (STEERING_FILE_TOOLS.has(call.toolName))
|
|
644
|
+
touchedPaths.push(...filesTouchedBy(call.toolName, toolArgs));
|
|
594
645
|
emit({
|
|
595
646
|
type: 'tool_result',
|
|
596
647
|
name: call.toolName,
|
|
@@ -617,6 +668,7 @@ export class Agent {
|
|
|
617
668
|
const message = errorMessageOf(err);
|
|
618
669
|
currentToolResults.push(toolResultError(call.toolCallId, call.toolName, message));
|
|
619
670
|
emit({ type: 'tool_result', name: call.toolName, id: call.toolCallId, result: message, isError: true });
|
|
671
|
+
trackLoop(call.toolName, toolArgs, `error:${message}`);
|
|
620
672
|
if (this.hooks) {
|
|
621
673
|
await this.hooks.dispatch({
|
|
622
674
|
type: 'PostToolUse',
|
|
@@ -636,6 +688,11 @@ export class Agent {
|
|
|
636
688
|
}
|
|
637
689
|
for (const m of toolResultMessages)
|
|
638
690
|
messages.push(m);
|
|
691
|
+
if (loopTripped) {
|
|
692
|
+
emit({ type: 'loop_detected', tool: loopTripped.tool, count: loopTripped.count });
|
|
693
|
+
reason = 'loop_detected';
|
|
694
|
+
break;
|
|
695
|
+
}
|
|
639
696
|
// Mid-run fileMatch steering: one extra user message per round, each doc once per run.
|
|
640
697
|
if (steeringDocs.length > 0 && touchedPaths.length > 0) {
|
|
641
698
|
const injected = [];
|
|
@@ -760,6 +817,14 @@ export class Agent {
|
|
|
760
817
|
const lastMessage = messages[messages.length - 1];
|
|
761
818
|
if (continuedText !== '' && lastMessage?.role === 'user' && lastMessage.content === CONTINUE_PROMPT)
|
|
762
819
|
messages.pop();
|
|
820
|
+
// Stopped mid-answer: keep the part the user already saw, marked as cut short, so "continue" can pick it up
|
|
821
|
+
// instead of starting over. Only when the model is the next speaker (after the user or a tool result).
|
|
822
|
+
if (reason === 'aborted' && partialStepText.trim()) {
|
|
823
|
+
const last = messages[messages.length - 1];
|
|
824
|
+
if (last && (last.role === 'user' || last.role === 'tool')) {
|
|
825
|
+
messages.push({ role: 'assistant', content: `${partialStepText.trim()}\n\n[Stopped by the user before finishing.]` });
|
|
826
|
+
}
|
|
827
|
+
}
|
|
763
828
|
// The browser is per-run: never leave a Chrome process behind.
|
|
764
829
|
await this.browser?.close().catch(() => undefined);
|
|
765
830
|
emit({ type: 'done', reason });
|
|
@@ -863,21 +928,68 @@ export class Agent {
|
|
|
863
928
|
return { ...t, execute: invalidating };
|
|
864
929
|
});
|
|
865
930
|
}
|
|
931
|
+
/**
|
|
932
|
+
* What the permission rules say about one tool call: `allow` (every target allowed), `deny` (any target denied,
|
|
933
|
+
* with the reason the model sees), `ask` (a target asks, a `.env` file is read, or a command leaves the workspace),
|
|
934
|
+
* or undefined when no rule applies and the normal approval flow decides.
|
|
935
|
+
*/
|
|
936
|
+
decidePermission(toolName, args, cwd) {
|
|
937
|
+
const p = permissionFor(toolName, args, cwd);
|
|
938
|
+
if (!p || p.targets.length === 0)
|
|
939
|
+
return undefined;
|
|
940
|
+
const rules = this.permissionRules;
|
|
941
|
+
const explicit = rules.filter((r) => r.pattern !== '*' && r.pattern !== '**');
|
|
942
|
+
const actions = p.targets.map((t) => {
|
|
943
|
+
// A broad rule never covers a secrets file: only a rule that names it can allow it.
|
|
944
|
+
// Headless runs (no approve callback) have nobody to ask, so they keep reading as before.
|
|
945
|
+
if (p.permission === 'read' && isSensitiveFile(t))
|
|
946
|
+
return evaluatePermission(explicit, 'read', t) ?? (this.config.approve ? 'ask' : evaluatePermission(rules, 'read', t));
|
|
947
|
+
return evaluatePermission(rules, p.permission, t);
|
|
948
|
+
});
|
|
949
|
+
if (p.permission === 'bash') {
|
|
950
|
+
const command = args.command;
|
|
951
|
+
if (typeof command === 'string' && touchesOutsideCwd(command, cwd)) {
|
|
952
|
+
const external = evaluatePermission(rules, 'external_directory', command);
|
|
953
|
+
if (external === 'deny')
|
|
954
|
+
return { action: 'deny', reason: `Blocked by permission rule (external_directory ${command}).` };
|
|
955
|
+
if (external !== 'allow' && this.config.approve)
|
|
956
|
+
actions.push('ask');
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
const denied = actions.indexOf('deny');
|
|
960
|
+
if (denied >= 0)
|
|
961
|
+
return { action: 'deny', reason: `Blocked by permission rule (${p.permission} ${p.targets[denied]}).` };
|
|
962
|
+
if (actions.includes('ask'))
|
|
963
|
+
return { action: 'ask', reason: '' };
|
|
964
|
+
if (actions.every((a) => a === 'allow'))
|
|
965
|
+
return { action: 'allow', reason: '' };
|
|
966
|
+
return undefined;
|
|
967
|
+
}
|
|
866
968
|
async requestApproval(def, id, args, abortSignal, ctx) {
|
|
969
|
+
// Bookkeeping tools (the todo list) never ask.
|
|
970
|
+
if (def.noApproval)
|
|
971
|
+
return { approved: true };
|
|
972
|
+
// Permission rules come first: deny blocks, allow runs, ask skips every shortcut below.
|
|
973
|
+
const rule = this.decidePermission(def.name, args, ctx?.cwd ?? this.config.cwd ?? process.cwd());
|
|
974
|
+
if (rule?.action === 'deny')
|
|
975
|
+
return { approved: false, note: rule.reason };
|
|
976
|
+
if (rule?.action === 'allow')
|
|
977
|
+
return { approved: true };
|
|
978
|
+
const forceAsk = rule?.action === 'ask';
|
|
867
979
|
// Read-only tools the user chose not to be asked about (never a destructive one).
|
|
868
|
-
if (!def.destructive && this.config.autoApproveTools?.includes(def.name)) {
|
|
980
|
+
if (!forceAsk && !def.destructive && this.config.autoApproveTools?.includes(def.name)) {
|
|
869
981
|
return { approved: true };
|
|
870
982
|
}
|
|
871
983
|
// Memory writes the user chose not to be asked about. memory_forget is deleted data: always asked.
|
|
872
|
-
if (def.name === 'memory_write' && this.config.memoryAutoApproveWrites) {
|
|
984
|
+
if (!forceAsk && def.name === 'memory_write' && this.config.memoryAutoApproveWrites) {
|
|
873
985
|
return { approved: true };
|
|
874
986
|
}
|
|
875
987
|
// A plain command the user already said "always allow" for: exact match only (see command-allow.ts).
|
|
876
|
-
if (def.name === 'run_command' && this.config.autoApproveCommands?.length && isListedCommand(args, this.config.autoApproveCommands)) {
|
|
988
|
+
if (!forceAsk && def.name === 'run_command' && this.config.autoApproveCommands?.length && isListedCommand(args, this.config.autoApproveCommands)) {
|
|
877
989
|
return { approved: true };
|
|
878
990
|
}
|
|
879
991
|
const auto = this.config.auto ?? false;
|
|
880
|
-
if (auto && !(def.destructive && !this.config.allowDestructive)) {
|
|
992
|
+
if (!forceAsk && auto && !(def.destructive && !this.config.allowDestructive)) {
|
|
881
993
|
return { approved: true };
|
|
882
994
|
}
|
|
883
995
|
let preview;
|
|
@@ -1073,6 +1185,15 @@ async function buildInitialMessages(config, task, skills, steeringSystem = [], u
|
|
|
1073
1185
|
// Unreadable instruction files are skipped, never fatal.
|
|
1074
1186
|
}
|
|
1075
1187
|
}
|
|
1188
|
+
let extraInstructionsBlock = '';
|
|
1189
|
+
if (config.extraInstructions?.length) {
|
|
1190
|
+
try {
|
|
1191
|
+
extraInstructionsBlock = await buildExtraInstructionsBlock(cwd, config.extraInstructions);
|
|
1192
|
+
}
|
|
1193
|
+
catch {
|
|
1194
|
+
// Skipped, never fatal.
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1076
1197
|
let mapBlock = '';
|
|
1077
1198
|
if (config.repoMap) {
|
|
1078
1199
|
try {
|
|
@@ -1085,7 +1206,7 @@ async function buildInitialMessages(config, task, skills, steeringSystem = [], u
|
|
|
1085
1206
|
// Compose the final system prompt: base + (memory, skills) blocks in a
|
|
1086
1207
|
// stable order so cache hits survive across runs that share state.
|
|
1087
1208
|
const steeringBlock = steeringSystem.map(wrapSteering).join('\n\n');
|
|
1088
|
-
const blocks = [steeringBlock, instructionsBlock, config.projectCommands ?? '', memoryBlock, skillsBlock, mapBlock].filter((b) => b.length > 0);
|
|
1209
|
+
const blocks = [steeringBlock, instructionsBlock, extraInstructionsBlock, config.mcpInstructions ?? '', config.projectCommands ?? '', memoryBlock, skillsBlock, mapBlock].filter((b) => b.length > 0);
|
|
1089
1210
|
const systemContent = blocks.length > 0 ? `${basePrompt}\n\n${blocks.join('\n\n')}` : basePrompt;
|
|
1090
1211
|
return [
|
|
1091
1212
|
{ role: 'system', content: systemContent },
|
|
@@ -1119,4 +1240,3 @@ function estimateNextPromptTokens(messages) {
|
|
|
1119
1240
|
}
|
|
1120
1241
|
return total;
|
|
1121
1242
|
}
|
|
1122
|
-
//# sourceMappingURL=agent.js.map
|
|
@@ -45,4 +45,3 @@ export declare function editorLimits(base: AgentConfig, architect: {
|
|
|
45
45
|
};
|
|
46
46
|
export declare function editorTask(task: string, plan: string): string;
|
|
47
47
|
export declare function runArchitect(opts: ArchitectOptions): Promise<AgentRunResult>;
|
|
48
|
-
//# sourceMappingURL=architect.d.ts.map
|
package/dist/agent/architect.js
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sub-agents that keep working after `sub_agent` has returned. The chat owns one registry per conversation: the
|
|
3
|
+
* model starts a run with `sub_agent { background: true }` and gets an id back at once; it collects the answer with
|
|
4
|
+
* `sub_agent_wait`, or the chat hands it every finished answer it has not seen with the next message. The person sees
|
|
5
|
+
* the runs in a strip above the message box and can stop one, stop all, or dismiss a finished one.
|
|
6
|
+
*/
|
|
7
|
+
import type { SubAgentResult } from '../tools/sub-agent.js';
|
|
8
|
+
export type BackgroundState = 'running' | 'done' | 'failed' | 'stopped';
|
|
9
|
+
export interface BackgroundAgent {
|
|
10
|
+
id: string;
|
|
11
|
+
task: string;
|
|
12
|
+
/** The agent file it runs as, when it was started with one. */
|
|
13
|
+
agent?: string;
|
|
14
|
+
state: BackgroundState;
|
|
15
|
+
startedAt: number;
|
|
16
|
+
endedAt?: number;
|
|
17
|
+
result?: SubAgentResult;
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
20
|
+
/** More than this at once costs more than anyone meant to spend. */
|
|
21
|
+
export declare const MAX_RUNNING_BACKGROUND = 4;
|
|
22
|
+
export interface StartOptions {
|
|
23
|
+
task: string;
|
|
24
|
+
agent?: string | undefined;
|
|
25
|
+
/** Runs the work; must finish soon after `signal` aborts. */
|
|
26
|
+
run: (signal: AbortSignal) => Promise<SubAgentResult>;
|
|
27
|
+
}
|
|
28
|
+
export declare class BackgroundAgents {
|
|
29
|
+
private readonly entries;
|
|
30
|
+
private readonly listeners;
|
|
31
|
+
private counter;
|
|
32
|
+
start(options: StartOptions): BackgroundAgent;
|
|
33
|
+
list(): BackgroundAgent[];
|
|
34
|
+
get(id: string): BackgroundAgent | undefined;
|
|
35
|
+
stop(id: string): void;
|
|
36
|
+
stopAll(): void;
|
|
37
|
+
/** Stop everything and forget it all (a new chat starts with none). */
|
|
38
|
+
clear(): void;
|
|
39
|
+
/** Remove a finished entry from the list. A running one must be stopped first. */
|
|
40
|
+
dismiss(id: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Wait until the named runs (default: all that are running) have finished, or the timeout passes. Never throws:
|
|
43
|
+
* the answer is the current state of each run.
|
|
44
|
+
*/
|
|
45
|
+
wait(ids?: readonly string[], options?: {
|
|
46
|
+
timeoutMs?: number;
|
|
47
|
+
signal?: AbortSignal;
|
|
48
|
+
}): Promise<BackgroundAgent[]>;
|
|
49
|
+
/** Finished runs the model has not been told about yet; each is returned once. */
|
|
50
|
+
takeUndelivered(): BackgroundAgent[];
|
|
51
|
+
/** Mark runs as already known to the model (a `sub_agent_wait` answered for them). */
|
|
52
|
+
markDelivered(ids: readonly string[]): void;
|
|
53
|
+
onChange(listener: () => void): () => void;
|
|
54
|
+
private changed;
|
|
55
|
+
private view;
|
|
56
|
+
}
|
|
57
|
+
/** The model-facing text for finished runs: what each was asked and what it answered. */
|
|
58
|
+
export declare function backgroundResultsBlock(finished: readonly BackgroundAgent[]): string;
|