@ikarmic/forge-core 4.4.0 → 5.0.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 +2 -2
- package/dist/agent/agent.d.ts +0 -1
- package/dist/agent/agent.js +84 -32
- package/dist/agent/architect.d.ts +3 -1
- package/dist/agent/architect.js +1 -1
- 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 +2 -1
- package/dist/agent/enhance-prompt.d.ts +7 -0
- package/dist/agent/enhance-prompt.js +30 -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/ai-comments/index.d.ts +0 -1
- package/dist/ai-comments/index.js +0 -1
- package/dist/attachments.d.ts +46 -0
- package/dist/attachments.js +178 -0
- 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 +0 -1
- 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 +4 -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 +24 -0
- package/dist/commands/custom-commands.js +98 -0
- package/dist/config-file.d.ts +4 -1
- package/dist/config-file.js +0 -1
- package/dist/config.d.ts +0 -1
- package/dist/config.js +0 -1
- package/dist/context/compaction.d.ts +0 -1
- package/dist/context/compaction.js +17 -3
- 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/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 +42 -16
- package/dist/git/auto-commit.d.ts +1 -2
- package/dist/git/auto-commit.js +17 -5
- package/dist/git/index.d.ts +0 -1
- package/dist/git/index.js +0 -1
- package/dist/github/github-tools.d.ts +83 -0
- package/dist/github/github-tools.js +175 -0
- 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 +0 -1
- 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/index.d.ts +21 -9
- package/dist/index.js +16 -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 +0 -1
- package/dist/lsp/client.js +0 -1
- 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 +0 -1
- package/dist/mcp/index.js +0 -1
- 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 +0 -1
- package/dist/mcp/manager.js +0 -1
- package/dist/mcp/marketplace-types.d.ts +0 -1
- package/dist/mcp/marketplace-types.js +0 -1
- package/dist/mcp/marketplace.d.ts +0 -1
- package/dist/mcp/marketplace.js +0 -1
- package/dist/mcp/mcp-client.d.ts +0 -1
- package/dist/mcp/mcp-client.js +0 -1
- package/dist/mcp/mcp-config.d.ts +0 -1
- package/dist/mcp/mcp-config.js +0 -1
- package/dist/mcp/registry.d.ts +0 -1
- package/dist/mcp/registry.js +0 -1
- package/dist/memory/memory-store.d.ts +57 -11
- package/dist/memory/memory-store.js +236 -70
- package/dist/memory/rank.d.ts +20 -0
- package/dist/memory/rank.js +64 -0
- package/dist/memory/stale.d.ts +18 -0
- package/dist/memory/stale.js +45 -0
- package/dist/model-alias.d.ts +0 -1
- package/dist/model-alias.js +0 -1
- package/dist/model-catalog.d.ts +0 -1
- package/dist/model-catalog.js +0 -1
- package/dist/model-list.d.ts +0 -1
- package/dist/model-list.js +0 -1
- 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 +0 -1
- package/dist/orchestrator/specialists.d.ts +0 -1
- package/dist/orchestrator/specialists.js +5 -6
- 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/policy.d.ts +0 -1
- package/dist/policy/policy.js +0 -1
- package/dist/policy/proxy.d.ts +0 -1
- package/dist/policy/proxy.js +0 -1
- package/dist/pricing.d.ts +0 -1
- package/dist/pricing.js +0 -1
- package/dist/providers.d.ts +0 -1
- package/dist/providers.js +0 -1
- 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 +0 -1
- package/dist/semantic/embedder.js +0 -1
- package/dist/semantic/semantic-index.d.ts +0 -1
- package/dist/semantic/semantic-index.js +4 -1
- package/dist/semantic/vector-store.d.ts +0 -1
- package/dist/semantic/vector-store.js +0 -1
- package/dist/sessions/index.d.ts +2 -1
- package/dist/sessions/index.js +2 -1
- package/dist/sessions/prune.d.ts +23 -0
- package/dist/sessions/prune.js +35 -0
- package/dist/sessions/search.d.ts +22 -0
- package/dist/sessions/search.js +66 -0
- 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 +0 -1
- 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/index.d.ts +0 -1
- package/dist/skills/index.js +0 -1
- package/dist/skills/loader.d.ts +0 -1
- package/dist/skills/loader.js +0 -1
- 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 +0 -1
- package/dist/skills/parser.d.ts +0 -1
- package/dist/skills/parser.js +0 -1
- package/dist/skills/types.d.ts +0 -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 +2 -1
- package/dist/specs/index.js +1 -1
- package/dist/specs/store.d.ts +7 -1
- package/dist/specs/store.js +33 -1
- package/dist/specs/sync.d.ts +29 -0
- package/dist/specs/sync.js +155 -0
- package/dist/specs/tasks-parser.d.ts +0 -1
- package/dist/specs/tasks-parser.js +0 -1
- package/dist/specs/types.d.ts +2 -1
- package/dist/specs/types.js +0 -1
- 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 +0 -1
- 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/tools/browser-tools.d.ts +0 -1
- package/dist/tools/browser-tools.js +0 -1
- package/dist/tools/codebase-search.d.ts +0 -1
- package/dist/tools/codebase-search.js +0 -1
- 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 +0 -1
- package/dist/tools/fetch-url.d.ts +0 -1
- package/dist/tools/fetch-url.js +0 -1
- package/dist/tools/find-references.d.ts +0 -1
- package/dist/tools/find-references.js +0 -1
- package/dist/tools/find-symbol.d.ts +0 -1
- package/dist/tools/find-symbol.js +0 -1
- package/dist/tools/ignore-rules.d.ts +15 -0
- package/dist/tools/ignore-rules.js +84 -0
- package/dist/tools/index.d.ts +3 -3
- package/dist/tools/index.js +5 -3
- package/dist/tools/list-files.d.ts +3 -1
- package/dist/tools/list-files.js +8 -1
- package/dist/tools/list-symbols.d.ts +0 -1
- package/dist/tools/list-symbols.js +0 -1
- package/dist/tools/memory.d.ts +34 -2
- package/dist/tools/memory.js +118 -26
- package/dist/tools/notebook.d.ts +69 -0
- package/dist/tools/notebook.js +163 -0
- package/dist/tools/policy.d.ts +0 -1
- package/dist/tools/policy.js +0 -1
- package/dist/tools/read-file.d.ts +8 -2
- package/dist/tools/read-file.js +19 -2
- package/dist/tools/read-image.d.ts +0 -1
- package/dist/tools/read-image.js +0 -1
- package/dist/tools/read-only.d.ts +0 -1
- package/dist/tools/read-only.js +0 -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 +0 -1
- package/dist/tools/run-command.js +0 -1
- package/dist/tools/sandbox-loader.d.ts +0 -1
- package/dist/tools/sandbox-loader.js +0 -1
- package/dist/tools/search-files.d.ts +5 -3
- package/dist/tools/search-files.js +8 -1
- package/dist/tools/shared.d.ts +0 -1
- package/dist/tools/shared.js +0 -1
- package/dist/tools/sub-agent.d.ts +0 -1
- package/dist/tools/sub-agent.js +0 -1
- package/dist/tools/web-search.d.ts +55 -0
- package/dist/tools/web-search.js +131 -0
- package/dist/tools/write-file.d.ts +0 -1
- package/dist/tools/write-file.js +0 -1
- package/dist/types.d.ts +43 -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 +0 -1
- package/dist/worktree/worktree.js +0 -1
- package/package.json +4 -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/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/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/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/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/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/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/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/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/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
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { FilePart, TextPart } from 'ai';
|
|
2
|
+
export interface Attachment {
|
|
3
|
+
/** Display name, usually the file's base name. */
|
|
4
|
+
name: string;
|
|
5
|
+
/** IANA media type, e.g. `image/png`, `application/pdf`, `text/plain`. */
|
|
6
|
+
mediaType: string;
|
|
7
|
+
/** Base64 of the file's bytes (no `data:` prefix). */
|
|
8
|
+
data: string;
|
|
9
|
+
}
|
|
10
|
+
/** Same cap as read_image: what vision APIs accept without resampling. */
|
|
11
|
+
export declare const MAX_IMAGE_ATTACHMENT_BYTES: number;
|
|
12
|
+
/** PDF APIs accept around 32 MB; stay well inside it. */
|
|
13
|
+
export declare const MAX_ATTACHMENT_BYTES: number;
|
|
14
|
+
/** Text attachments past this are cut, with a note, so one log file can't fill the window. */
|
|
15
|
+
export declare const MAX_TEXT_ATTACHMENT_CHARS = 200000;
|
|
16
|
+
export type AttachmentKind = 'image' | 'pdf' | 'text' | 'binary';
|
|
17
|
+
export declare function attachmentKind(mediaType: string): AttachmentKind;
|
|
18
|
+
export declare function isPdf(buf: Uint8Array): boolean;
|
|
19
|
+
/** True when the first 8 KB have no NUL byte and decode as UTF-8. */
|
|
20
|
+
export declare function looksLikeText(buf: Uint8Array): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Media type from the bytes: images and PDFs by their magic numbers, then text. The
|
|
23
|
+
* declared type (a browser's or an extension's guess) only names text and other
|
|
24
|
+
* binaries, so a mislabelled file is never sent to a provider as an image or PDF.
|
|
25
|
+
*/
|
|
26
|
+
export declare function detectMediaType(buf: Uint8Array, declared?: string): string;
|
|
27
|
+
/** Why these bytes can't be attached, or null when they can. */
|
|
28
|
+
export declare function attachmentProblem(bytes: number, mediaType: string): string | null;
|
|
29
|
+
/** Build an attachment from raw bytes; throws with a readable reason when it can't be attached. */
|
|
30
|
+
export declare function makeAttachment(name: string, bytes: Uint8Array, declaredType?: string): Attachment;
|
|
31
|
+
/** Read a file from disk as an attachment. */
|
|
32
|
+
export declare function loadAttachment(filePath: string): Promise<Attachment>;
|
|
33
|
+
/** Decoded size of an attachment's data. */
|
|
34
|
+
export declare function attachmentBytes(a: Attachment): number;
|
|
35
|
+
export declare function formatBytes(n: number): string;
|
|
36
|
+
/** One-line description, e.g. `screenshot.png (image/png, 120.4 KB)`. */
|
|
37
|
+
export declare function describeAttachment(a: Attachment): string;
|
|
38
|
+
/** The content parts that carry the attachments in a user message. */
|
|
39
|
+
export declare function attachmentParts(attachments: readonly Attachment[]): Array<TextPart | FilePart>;
|
|
40
|
+
/**
|
|
41
|
+
* Rough token cost of a non-text content part (an image is about 1,600 tokens on
|
|
42
|
+
* the major providers; a PDF page about the same, and PDFs run ~50 KB a page).
|
|
43
|
+
*/
|
|
44
|
+
export declare function mediaPartTokens(part: unknown): number;
|
|
45
|
+
/** A short stand-in for a media part in transcripts (summaries, logs), never the bytes. */
|
|
46
|
+
export declare function mediaPartLabel(part: unknown): string | null;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Files the user attaches to a chat turn (pasted screenshots, dropped PDFs, any other file).
|
|
3
|
+
*
|
|
4
|
+
* They travel in the turn's user message as native content parts, so vision and
|
|
5
|
+
* document-capable models see the real bytes instead of a read_image round trip:
|
|
6
|
+
* - images (PNG / JPEG / GIF / WebP) and PDFs become `file` parts;
|
|
7
|
+
* - text files are inlined as a fenced block;
|
|
8
|
+
* - any other binary is described in one line (name, type, size) so the model knows it exists.
|
|
9
|
+
*/
|
|
10
|
+
import { readFile, stat } from 'node:fs/promises';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import { sniffMime } from './tools/read-image.js';
|
|
13
|
+
/** Same cap as read_image: what vision APIs accept without resampling. */
|
|
14
|
+
export const MAX_IMAGE_ATTACHMENT_BYTES = 5 * 1024 * 1024;
|
|
15
|
+
/** PDF APIs accept around 32 MB; stay well inside it. */
|
|
16
|
+
export const MAX_ATTACHMENT_BYTES = 20 * 1024 * 1024;
|
|
17
|
+
/** Text attachments past this are cut, with a note, so one log file can't fill the window. */
|
|
18
|
+
export const MAX_TEXT_ATTACHMENT_CHARS = 200_000;
|
|
19
|
+
const IMAGE_TYPES = new Set(['image/png', 'image/jpeg', 'image/gif', 'image/webp']);
|
|
20
|
+
export function attachmentKind(mediaType) {
|
|
21
|
+
if (IMAGE_TYPES.has(mediaType))
|
|
22
|
+
return 'image';
|
|
23
|
+
if (mediaType === 'application/pdf')
|
|
24
|
+
return 'pdf';
|
|
25
|
+
if (mediaType.startsWith('text/') || TEXTUAL_TYPES.has(mediaType))
|
|
26
|
+
return 'text';
|
|
27
|
+
return 'binary';
|
|
28
|
+
}
|
|
29
|
+
const TEXTUAL_TYPES = new Set([
|
|
30
|
+
'application/json',
|
|
31
|
+
'application/xml',
|
|
32
|
+
'application/javascript',
|
|
33
|
+
'application/x-yaml',
|
|
34
|
+
'application/yaml',
|
|
35
|
+
'application/toml',
|
|
36
|
+
'application/sql',
|
|
37
|
+
'image/svg+xml',
|
|
38
|
+
]);
|
|
39
|
+
export function isPdf(buf) {
|
|
40
|
+
return buf.length >= 5 && buf[0] === 0x25 && buf[1] === 0x50 && buf[2] === 0x44 && buf[3] === 0x46 && buf[4] === 0x2d;
|
|
41
|
+
}
|
|
42
|
+
/** True when the first 8 KB have no NUL byte and decode as UTF-8. */
|
|
43
|
+
export function looksLikeText(buf) {
|
|
44
|
+
const sample = buf.subarray(0, Math.min(buf.length, 8192));
|
|
45
|
+
if (sample.includes(0))
|
|
46
|
+
return false;
|
|
47
|
+
try {
|
|
48
|
+
new TextDecoder('utf-8', { fatal: true }).decode(sample);
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// A multi-byte character cut at the 8 KB boundary is still text.
|
|
53
|
+
return sample.length === 8192 && looksLikeText(sample.subarray(0, 8188));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Media type from the bytes: images and PDFs by their magic numbers, then text. The
|
|
58
|
+
* declared type (a browser's or an extension's guess) only names text and other
|
|
59
|
+
* binaries, so a mislabelled file is never sent to a provider as an image or PDF.
|
|
60
|
+
*/
|
|
61
|
+
export function detectMediaType(buf, declared) {
|
|
62
|
+
// An empty name turns off sniffMime's extension fallback.
|
|
63
|
+
const image = sniffMime(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength), '');
|
|
64
|
+
if (image)
|
|
65
|
+
return image;
|
|
66
|
+
if (isPdf(buf))
|
|
67
|
+
return 'application/pdf';
|
|
68
|
+
const declaredKind = declared ? attachmentKind(declared) : 'binary';
|
|
69
|
+
if (looksLikeText(buf))
|
|
70
|
+
return declared && declaredKind === 'text' ? declared : 'text/plain';
|
|
71
|
+
return declared && declaredKind === 'binary' ? declared : 'application/octet-stream';
|
|
72
|
+
}
|
|
73
|
+
/** Why these bytes can't be attached, or null when they can. */
|
|
74
|
+
export function attachmentProblem(bytes, mediaType) {
|
|
75
|
+
if (bytes === 0)
|
|
76
|
+
return 'the file is empty';
|
|
77
|
+
if (attachmentKind(mediaType) === 'image' && bytes > MAX_IMAGE_ATTACHMENT_BYTES) {
|
|
78
|
+
return `images are limited to ${MAX_IMAGE_ATTACHMENT_BYTES / 1024 / 1024} MB`;
|
|
79
|
+
}
|
|
80
|
+
if (bytes > MAX_ATTACHMENT_BYTES)
|
|
81
|
+
return `attachments are limited to ${MAX_ATTACHMENT_BYTES / 1024 / 1024} MB`;
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
/** Build an attachment from raw bytes; throws with a readable reason when it can't be attached. */
|
|
85
|
+
export function makeAttachment(name, bytes, declaredType) {
|
|
86
|
+
const mediaType = detectMediaType(bytes, declaredType);
|
|
87
|
+
const problem = attachmentProblem(bytes.length, mediaType);
|
|
88
|
+
if (problem)
|
|
89
|
+
throw new Error(`Cannot attach ${name}: ${problem}`);
|
|
90
|
+
return { name, mediaType, data: Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString('base64') };
|
|
91
|
+
}
|
|
92
|
+
/** Read a file from disk as an attachment. */
|
|
93
|
+
export async function loadAttachment(filePath) {
|
|
94
|
+
const name = path.basename(filePath);
|
|
95
|
+
const info = await stat(filePath);
|
|
96
|
+
if (info.isDirectory())
|
|
97
|
+
throw new Error(`Cannot attach ${name}: it is a directory`);
|
|
98
|
+
// Check the size before reading so a 2 GB file isn't pulled into memory.
|
|
99
|
+
if (info.size > MAX_ATTACHMENT_BYTES)
|
|
100
|
+
throw new Error(`Cannot attach ${name}: attachments are limited to ${MAX_ATTACHMENT_BYTES / 1024 / 1024} MB`);
|
|
101
|
+
return makeAttachment(name, await readFile(filePath));
|
|
102
|
+
}
|
|
103
|
+
/** Decoded size of an attachment's data. */
|
|
104
|
+
export function attachmentBytes(a) {
|
|
105
|
+
const pad = a.data.endsWith('==') ? 2 : a.data.endsWith('=') ? 1 : 0;
|
|
106
|
+
return Math.floor((a.data.length * 3) / 4) - pad;
|
|
107
|
+
}
|
|
108
|
+
export function formatBytes(n) {
|
|
109
|
+
if (n < 1024)
|
|
110
|
+
return `${n} B`;
|
|
111
|
+
if (n < 1024 * 1024)
|
|
112
|
+
return `${(n / 1024).toFixed(1)} KB`;
|
|
113
|
+
return `${(n / 1024 / 1024).toFixed(2)} MB`;
|
|
114
|
+
}
|
|
115
|
+
/** One-line description, e.g. `screenshot.png (image/png, 120.4 KB)`. */
|
|
116
|
+
export function describeAttachment(a) {
|
|
117
|
+
return `${a.name} (${a.mediaType}, ${formatBytes(attachmentBytes(a))})`;
|
|
118
|
+
}
|
|
119
|
+
/** The content parts that carry the attachments in a user message. */
|
|
120
|
+
export function attachmentParts(attachments) {
|
|
121
|
+
const parts = [];
|
|
122
|
+
for (const a of attachments) {
|
|
123
|
+
const kind = attachmentKind(a.mediaType);
|
|
124
|
+
if (kind === 'image' || kind === 'pdf') {
|
|
125
|
+
parts.push({ type: 'text', text: `Attached file: ${describeAttachment(a)}` });
|
|
126
|
+
parts.push({ type: 'file', mediaType: a.mediaType, filename: a.name, data: { type: 'data', data: a.data } });
|
|
127
|
+
}
|
|
128
|
+
else if (kind === 'text') {
|
|
129
|
+
let text = Buffer.from(a.data, 'base64').toString('utf8');
|
|
130
|
+
let note = '';
|
|
131
|
+
if (text.length > MAX_TEXT_ATTACHMENT_CHARS) {
|
|
132
|
+
note = `\n[cut at ${MAX_TEXT_ATTACHMENT_CHARS} of ${text.length} characters]`;
|
|
133
|
+
text = text.slice(0, MAX_TEXT_ATTACHMENT_CHARS);
|
|
134
|
+
}
|
|
135
|
+
const fence = text.includes('```') ? '~~~~' : '```';
|
|
136
|
+
parts.push({ type: 'text', text: `Attached file: ${a.name}\n${fence}\n${text}\n${fence}${note}` });
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
parts.push({
|
|
140
|
+
type: 'text',
|
|
141
|
+
text: `Attached file: ${describeAttachment(a)}. It is binary and can't be shown; ask the user what they need from it.`,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return parts;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Rough token cost of a non-text content part (an image is about 1,600 tokens on
|
|
149
|
+
* the major providers; a PDF page about the same, and PDFs run ~50 KB a page).
|
|
150
|
+
*/
|
|
151
|
+
export function mediaPartTokens(part) {
|
|
152
|
+
if (!part || typeof part !== 'object')
|
|
153
|
+
return 0;
|
|
154
|
+
const p = part;
|
|
155
|
+
if (p.type === 'image' || p.type === 'image-data')
|
|
156
|
+
return 1600;
|
|
157
|
+
if (p.type !== 'file' && p.type !== 'file-data')
|
|
158
|
+
return 0;
|
|
159
|
+
const mediaType = typeof p.mediaType === 'string' ? p.mediaType : '';
|
|
160
|
+
if (mediaType.startsWith('image'))
|
|
161
|
+
return 1600;
|
|
162
|
+
const raw = p.data && typeof p.data === 'object' && 'data' in p.data ? p.data.data : p.data;
|
|
163
|
+
const len = typeof raw === 'string' ? raw.length : raw instanceof Uint8Array ? (raw.length * 4) / 3 : 0;
|
|
164
|
+
return Math.max(1600, Math.ceil(((len * 3) / 4 / 50_000) * 1600));
|
|
165
|
+
}
|
|
166
|
+
/** A short stand-in for a media part in transcripts (summaries, logs), never the bytes. */
|
|
167
|
+
export function mediaPartLabel(part) {
|
|
168
|
+
if (!part || typeof part !== 'object')
|
|
169
|
+
return null;
|
|
170
|
+
const p = part;
|
|
171
|
+
if (p.type === 'image' || p.type === 'image-data')
|
|
172
|
+
return '[image]';
|
|
173
|
+
if (p.type === 'file' || p.type === 'file-data') {
|
|
174
|
+
const name = typeof p.filename === 'string' ? `${p.filename}, ` : '';
|
|
175
|
+
return `[attached file: ${name}${typeof p.mediaType === 'string' ? p.mediaType : 'unknown type'}]`;
|
|
176
|
+
}
|
|
177
|
+
return null;
|
|
178
|
+
}
|
package/dist/browser/cdp.d.ts
CHANGED
package/dist/browser/cdp.js
CHANGED
package/dist/browser/chrome.d.ts
CHANGED
package/dist/browser/chrome.js
CHANGED
package/dist/browser/session.js
CHANGED
|
@@ -9,4 +9,3 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export { CheckpointStore, type CheckpointStoreLimits } from './store.js';
|
|
11
11
|
export type { CaptureOptions, Checkpoint, CheckpointFile, CheckpointFileStatus, CheckpointSummary, CheckpointTrigger, PruneResult, RestoreResult, } from './types.js';
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFile, readdir, stat } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
import { IgnoreRules } from '../tools/ignore-rules.js';
|
|
3
4
|
import { DEFAULT_IGNORED_DIRS } from '../tools/shared.js';
|
|
4
5
|
import { deleteEntry, getEntry, loadManifest, saveManifest, setEntry } from './index-store.js';
|
|
5
6
|
import { parseSource } from './parser.js';
|
|
@@ -14,6 +15,7 @@ export async function ensureFresh(cwd) {
|
|
|
14
15
|
const manifest = await loadManifest(cwd);
|
|
15
16
|
const seen = new Set();
|
|
16
17
|
let changed = false;
|
|
18
|
+
const rules = IgnoreRules.forRoot(cwd);
|
|
17
19
|
async function walk(dir) {
|
|
18
20
|
let entries;
|
|
19
21
|
try {
|
|
@@ -28,6 +30,8 @@ export async function ensureFresh(cwd) {
|
|
|
28
30
|
if (DEFAULT_IGNORED_DIRS.has(entry.name))
|
|
29
31
|
continue;
|
|
30
32
|
const abs = path.join(dir, entry.name);
|
|
33
|
+
if (rules.isIgnored(abs, entry.isDirectory()))
|
|
34
|
+
continue;
|
|
31
35
|
if (entry.isDirectory()) {
|
|
32
36
|
await walk(abs);
|
|
33
37
|
continue;
|
|
@@ -60,4 +64,3 @@ export async function ensureFresh(cwd) {
|
|
|
60
64
|
await saveManifest(cwd, manifest);
|
|
61
65
|
return manifest;
|
|
62
66
|
}
|
|
63
|
-
//# sourceMappingURL=builder.js.map
|
|
@@ -9,4 +9,3 @@ export declare function saveManifest(cwd: string, manifest: IndexManifest): Prom
|
|
|
9
9
|
export declare function getEntry(manifest: IndexManifest, relPath: string): IndexFileEntry | undefined;
|
|
10
10
|
export declare function setEntry(manifest: IndexManifest, relPath: string, entry: IndexFileEntry): void;
|
|
11
11
|
export declare function deleteEntry(manifest: IndexManifest, relPath: string): void;
|
|
12
|
-
//# sourceMappingURL=index-store.d.ts.map
|
package/dist/code-index/types.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface CustomCommand {
|
|
2
|
+
/** Lowercase name used after the slash. */
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
template: string;
|
|
6
|
+
source: 'user' | 'project';
|
|
7
|
+
/** Absolute path of the template file. */
|
|
8
|
+
file: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function commandDirs(cwd: string, home?: string): Array<{
|
|
11
|
+
dir: string;
|
|
12
|
+
source: 'user' | 'project';
|
|
13
|
+
}>;
|
|
14
|
+
/** Split optional `---` front matter from the body and read its `description`. */
|
|
15
|
+
export declare function parseCommandFile(text: string): {
|
|
16
|
+
description?: string;
|
|
17
|
+
template: string;
|
|
18
|
+
};
|
|
19
|
+
/** Every custom command, keyed by name; project commands replace personal ones. */
|
|
20
|
+
export declare function loadCustomCommands(cwd: string, home?: string): Promise<Map<string, CustomCommand>>;
|
|
21
|
+
/** The message a command sends for these arguments. */
|
|
22
|
+
export declare function expandCustomCommand(command: Pick<CustomCommand, 'template'>, args: string): string;
|
|
23
|
+
/** `/name — description` lines for help output. */
|
|
24
|
+
export declare function formatCustomCommands(commands: Map<string, CustomCommand>): string;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom slash commands: Markdown prompt templates the user keeps in
|
|
3
|
+
* `~/.forge/commands/<name>.md` (personal) or `<project>/.forge/commands/<name>.md`
|
|
4
|
+
* (shared with the repo; a project command overrides a personal one of the same name).
|
|
5
|
+
*
|
|
6
|
+
* `/<name> some args` sends the file's body as the message, with `$ARGUMENTS` replaced by
|
|
7
|
+
* everything after the name and `$1`..`$9` by its words (quotes group words). A template
|
|
8
|
+
* without `$ARGUMENTS` gets the arguments appended. An optional front matter block
|
|
9
|
+
* gives a `description` for /help:
|
|
10
|
+
*
|
|
11
|
+
* ---
|
|
12
|
+
* description: Review the staged diff for bugs
|
|
13
|
+
* ---
|
|
14
|
+
* Review `git diff --staged` ... $ARGUMENTS
|
|
15
|
+
*
|
|
16
|
+
* Templates are only text the user could have typed: nothing in them runs by itself.
|
|
17
|
+
*/
|
|
18
|
+
import { readdir, readFile } from 'node:fs/promises';
|
|
19
|
+
import os from 'node:os';
|
|
20
|
+
import path from 'node:path';
|
|
21
|
+
/** Names are what parseSlashCommand accepts: a letter, then letters, digits, `-` or `_`. */
|
|
22
|
+
const NAME = /^[a-z][\w-]*$/;
|
|
23
|
+
/** A template larger than this is skipped: it's a prompt, not a document. */
|
|
24
|
+
const MAX_TEMPLATE_BYTES = 64 * 1024;
|
|
25
|
+
export function commandDirs(cwd, home = os.homedir()) {
|
|
26
|
+
return [
|
|
27
|
+
{ dir: path.join(home, '.forge', 'commands'), source: 'user' },
|
|
28
|
+
{ dir: path.join(cwd, '.forge', 'commands'), source: 'project' },
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
/** Split optional `---` front matter from the body and read its `description`. */
|
|
32
|
+
export function parseCommandFile(text) {
|
|
33
|
+
const normalized = text.replace(/^/, '').replace(/\r\n/g, '\n');
|
|
34
|
+
const m = /^---\n([\s\S]*?)\n---\n?/.exec(normalized);
|
|
35
|
+
if (!m)
|
|
36
|
+
return { template: normalized.trim() };
|
|
37
|
+
const desc = /^description:\s*(.+)$/m.exec(m[1])?.[1]?.trim().replace(/^(['"])(.*)\1$/, '$2');
|
|
38
|
+
return { ...(desc ? { description: desc } : {}), template: normalized.slice(m[0].length).trim() };
|
|
39
|
+
}
|
|
40
|
+
/** Every custom command, keyed by name; project commands replace personal ones. */
|
|
41
|
+
export async function loadCustomCommands(cwd, home) {
|
|
42
|
+
const out = new Map();
|
|
43
|
+
for (const { dir, source } of commandDirs(cwd, home)) {
|
|
44
|
+
let files;
|
|
45
|
+
try {
|
|
46
|
+
files = await readdir(dir);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
for (const f of files.sort()) {
|
|
52
|
+
if (!f.toLowerCase().endsWith('.md'))
|
|
53
|
+
continue;
|
|
54
|
+
const name = f.slice(0, -3).toLowerCase();
|
|
55
|
+
if (!NAME.test(name))
|
|
56
|
+
continue;
|
|
57
|
+
const file = path.join(dir, f);
|
|
58
|
+
let text;
|
|
59
|
+
try {
|
|
60
|
+
const buf = await readFile(file);
|
|
61
|
+
if (buf.length > MAX_TEMPLATE_BYTES)
|
|
62
|
+
continue;
|
|
63
|
+
text = buf.toString('utf8');
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const parsed = parseCommandFile(text);
|
|
69
|
+
if (!parsed.template)
|
|
70
|
+
continue;
|
|
71
|
+
out.set(name, { name, ...parsed, source, file });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return out;
|
|
75
|
+
}
|
|
76
|
+
function words(args) {
|
|
77
|
+
const out = [];
|
|
78
|
+
for (const m of args.matchAll(/"([^"]*)"|'([^']*)'|(\S+)/g))
|
|
79
|
+
out.push(m[1] ?? m[2] ?? m[3]);
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
/** The message a command sends for these arguments. */
|
|
83
|
+
export function expandCustomCommand(command, args) {
|
|
84
|
+
const trimmed = args.trim();
|
|
85
|
+
const positional = words(trimmed);
|
|
86
|
+
const usesArguments = command.template.includes('$ARGUMENTS');
|
|
87
|
+
const usesPositional = /\$[1-9]/.test(command.template);
|
|
88
|
+
// One pass, so an argument that itself contains `$1` or `$ARGUMENTS` is left alone.
|
|
89
|
+
const body = command.template.replace(/\$ARGUMENTS|\$([1-9])/g, (_m, n) => n ? (positional[Number(n) - 1] ?? '') : trimmed);
|
|
90
|
+
return !usesArguments && !usesPositional && trimmed ? `${body}\n\n${trimmed}` : body;
|
|
91
|
+
}
|
|
92
|
+
/** `/name — description` lines for help output. */
|
|
93
|
+
export function formatCustomCommands(commands) {
|
|
94
|
+
return [...commands.values()]
|
|
95
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
96
|
+
.map((c) => `/${c.name}${c.description ? ` — ${c.description}` : ''}${c.source === 'project' ? ' (project)' : ''}`)
|
|
97
|
+
.join('\n');
|
|
98
|
+
}
|
package/dist/config-file.d.ts
CHANGED
|
@@ -22,6 +22,10 @@ export interface ForgeConfigFile {
|
|
|
22
22
|
}>>;
|
|
23
23
|
/** Short names for models: `"fast": "anthropic:claude-haiku-4-5"`. See model-alias.ts. */
|
|
24
24
|
aliases?: ModelAliases;
|
|
25
|
+
/** Model for a chat mode that has none of its own: mode id → `provider:model`, bare model id or alias. */
|
|
26
|
+
modeModels?: Record<string, string>;
|
|
27
|
+
/** Delete saved sessions not updated for this many days, when the VS Code extension starts. Unset keeps everything. */
|
|
28
|
+
sessionRetentionDays?: number;
|
|
25
29
|
display?: {
|
|
26
30
|
blockDefault?: 'collapsed' | 'expanded';
|
|
27
31
|
detail?: 'compact' | 'full';
|
|
@@ -41,4 +45,3 @@ export declare function loadForgeConfigFile(configPath?: string): Promise<LoadFo
|
|
|
41
45
|
* Fields not present in `partial` are left untouched.
|
|
42
46
|
*/
|
|
43
47
|
export declare function saveForgeConfigFile(partial: ForgeConfigFile, configPath?: string): Promise<void>;
|
|
44
|
-
//# sourceMappingURL=config-file.d.ts.map
|
package/dist/config-file.js
CHANGED
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* dedicated cheaper model or even a deterministic extractive summarizer.
|
|
13
13
|
*/
|
|
14
14
|
import { generateText } from 'ai';
|
|
15
|
+
import { mediaPartLabel, mediaPartTokens } from '../attachments.js';
|
|
16
|
+
import { stripThinkTags } from '../agent/think-tags.js';
|
|
15
17
|
import { createLanguageModel } from '../providers.js';
|
|
16
18
|
/**
|
|
17
19
|
* Approximate model context window (input) in tokens. Used to decide when
|
|
@@ -95,6 +97,12 @@ export function getModelWindowTokens(model) {
|
|
|
95
97
|
}
|
|
96
98
|
return DEFAULT_WINDOW_TOKENS;
|
|
97
99
|
}
|
|
100
|
+
/** JSON.stringify replacer that keeps image and file bytes out of a summary prompt. */
|
|
101
|
+
function withoutMedia(_key, value) {
|
|
102
|
+
if (typeof value === 'string' && value.startsWith('data:') && value.length > 200)
|
|
103
|
+
return '[media bytes]';
|
|
104
|
+
return mediaPartLabel(value) ?? value;
|
|
105
|
+
}
|
|
98
106
|
/** Approximate token count from a string. Rough: ~4 chars/token. */
|
|
99
107
|
export function estimateTokens(text) {
|
|
100
108
|
return Math.ceil(text.length / 4);
|
|
@@ -113,6 +121,9 @@ export function estimateMessageTokens(messages) {
|
|
|
113
121
|
if (part && typeof part === 'object' && 'text' in part) {
|
|
114
122
|
total += estimateTokens(String(part.text ?? ''));
|
|
115
123
|
}
|
|
124
|
+
else {
|
|
125
|
+
total += mediaPartTokens(part);
|
|
126
|
+
}
|
|
116
127
|
}
|
|
117
128
|
}
|
|
118
129
|
}
|
|
@@ -141,7 +152,7 @@ export function buildLlmSummarizer(model, modelFactory) {
|
|
|
141
152
|
return p;
|
|
142
153
|
if (p && typeof p === 'object' && 'text' in p)
|
|
143
154
|
return String(p.text);
|
|
144
|
-
return JSON.stringify(p);
|
|
155
|
+
return mediaPartLabel(p) ?? JSON.stringify(p, withoutMedia);
|
|
145
156
|
})
|
|
146
157
|
.join('\n');
|
|
147
158
|
}
|
|
@@ -191,7 +202,8 @@ ${truncateToBudget(transcript, 60_000)}`;
|
|
|
191
202
|
prompt,
|
|
192
203
|
maxOutputTokens: 2000,
|
|
193
204
|
});
|
|
194
|
-
|
|
205
|
+
// Reasoning models put an inline <think> block in the reply; it must not be stored as the summary.
|
|
206
|
+
return stripThinkTags(result.text).trim();
|
|
195
207
|
};
|
|
196
208
|
}
|
|
197
209
|
/** Truncate the transcript at a character budget so we don't blow the summarizer's own context. */
|
|
@@ -249,6 +261,9 @@ export async function compactMessages(allMessages, summarizer, options = {}) {
|
|
|
249
261
|
const pinned = toSummarize[0]?.role === 'user' ? toSummarize[0] : undefined;
|
|
250
262
|
const beforeTokens = estimateMessageTokens(toSummarize) - (pinned ? estimateMessageTokens([pinned]) : 0);
|
|
251
263
|
const summary = await summarizer(toSummarize);
|
|
264
|
+
// An empty summary (a failed or reasoning-only reply) must not replace the dropped turns with nothing.
|
|
265
|
+
if (!summary.trim())
|
|
266
|
+
return { messages: allMessages, droppedCount: 0, savedTokens: 0, summary: '' };
|
|
252
267
|
const summaryTokens = estimateTokens(summary);
|
|
253
268
|
const separator = {
|
|
254
269
|
role: 'system',
|
|
@@ -270,4 +285,3 @@ export async function compactMessages(allMessages, summarizer, options = {}) {
|
|
|
270
285
|
summary,
|
|
271
286
|
};
|
|
272
287
|
}
|
|
273
|
-
//# sourceMappingURL=compaction.js.map
|
package/dist/context/mask.d.ts
CHANGED
package/dist/context/mask.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Results that say what a change did are kept: they are small and the model must not forget them. */
|
|
2
|
-
export const NEVER_MASK_TOOLS = new Set(['write_file', 'edit_file', 'run_command', 'sub_agent']);
|
|
2
|
+
export const NEVER_MASK_TOOLS = new Set(['write_file', 'edit_file', 'edit_notebook', 'run_command', 'sub_agent']);
|
|
3
3
|
const STUB_MARK = 'result not shown to save context';
|
|
4
4
|
/** Index of the first message of the last `keepRecentTurns` assistant turns (0 when there are not that many). */
|
|
5
5
|
export function maskBoundary(messages, keepRecentTurns) {
|
|
@@ -76,4 +76,3 @@ export function createStepMasker(opts) {
|
|
|
76
76
|
},
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
//# sourceMappingURL=mask.js.map
|
|
@@ -4,4 +4,3 @@ export type { CredentialStore } from './types.js';
|
|
|
4
4
|
export declare const CREDENTIAL_SERVICE_NAME = "ikarmic-forge";
|
|
5
5
|
/** Account key for a provider's stored API key: same on every surface. */
|
|
6
6
|
export declare function credentialAccountKey(provider: ProviderName): string;
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/diff/index.d.ts
CHANGED