micro-models-agent 0.6.4 → 0.7.1
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/README.md +286 -436
- package/dist/main.js +11706 -0
- package/dist/skills/builtin/git.md +36 -0
- package/dist/skills/builtin/typescript.md +35 -0
- package/package.json +41 -47
- package/dist/agent/context.d.ts +0 -73
- package/dist/agent/context.d.ts.map +0 -1
- package/dist/agent/context.js +0 -262
- package/dist/agent/context.js.map +0 -1
- package/dist/agent/error-escalation.d.ts +0 -19
- package/dist/agent/error-escalation.d.ts.map +0 -1
- package/dist/agent/error-escalation.js +0 -168
- package/dist/agent/error-escalation.js.map +0 -1
- package/dist/agent/loop.d.ts +0 -46
- package/dist/agent/loop.d.ts.map +0 -1
- package/dist/agent/loop.js +0 -1043
- package/dist/agent/loop.js.map +0 -1
- package/dist/agent/memory.d.ts +0 -40
- package/dist/agent/memory.d.ts.map +0 -1
- package/dist/agent/memory.js +0 -231
- package/dist/agent/memory.js.map +0 -1
- package/dist/agent/modes/applier.d.ts +0 -43
- package/dist/agent/modes/applier.d.ts.map +0 -1
- package/dist/agent/modes/applier.js +0 -30
- package/dist/agent/modes/applier.js.map +0 -1
- package/dist/agent/modes/registry.d.ts +0 -35
- package/dist/agent/modes/registry.d.ts.map +0 -1
- package/dist/agent/modes/registry.js +0 -169
- package/dist/agent/modes/registry.js.map +0 -1
- package/dist/agent/modes/types.d.ts +0 -61
- package/dist/agent/modes/types.d.ts.map +0 -1
- package/dist/agent/modes/types.js +0 -13
- package/dist/agent/modes/types.js.map +0 -1
- package/dist/agent/react-loop.d.ts +0 -65
- package/dist/agent/react-loop.d.ts.map +0 -1
- package/dist/agent/react-loop.js +0 -101
- package/dist/agent/react-loop.js.map +0 -1
- package/dist/agent/system-prompt.d.ts +0 -26
- package/dist/agent/system-prompt.d.ts.map +0 -1
- package/dist/agent/system-prompt.js +0 -478
- package/dist/agent/system-prompt.js.map +0 -1
- package/dist/agent/tool-executor.d.ts +0 -36
- package/dist/agent/tool-executor.d.ts.map +0 -1
- package/dist/agent/tool-executor.js +0 -346
- package/dist/agent/tool-executor.js.map +0 -1
- package/dist/agent/user-profile.d.ts +0 -26
- package/dist/agent/user-profile.d.ts.map +0 -1
- package/dist/agent/user-profile.js +0 -169
- package/dist/agent/user-profile.js.map +0 -1
- package/dist/agent/write-enforcer.d.ts +0 -7
- package/dist/agent/write-enforcer.d.ts.map +0 -1
- package/dist/agent/write-enforcer.js +0 -8
- package/dist/agent/write-enforcer.js.map +0 -1
- package/dist/cli/config.d.ts +0 -13
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -82
- package/dist/cli/config.js.map +0 -1
- package/dist/cli/model.d.ts +0 -13
- package/dist/cli/model.d.ts.map +0 -1
- package/dist/cli/model.js +0 -170
- package/dist/cli/model.js.map +0 -1
- package/dist/cli/provider.d.ts +0 -12
- package/dist/cli/provider.d.ts.map +0 -1
- package/dist/cli/provider.js +0 -90
- package/dist/cli/provider.js.map +0 -1
- package/dist/cli/update.d.ts +0 -12
- package/dist/cli/update.d.ts.map +0 -1
- package/dist/cli/update.js +0 -69
- package/dist/cli/update.js.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -310
- package/dist/cli.js.map +0 -1
- package/dist/config/config.d.ts +0 -59
- package/dist/config/config.d.ts.map +0 -1
- package/dist/config/config.js +0 -232
- package/dist/config/config.js.map +0 -1
- package/dist/config/types.d.ts +0 -122
- package/dist/config/types.d.ts.map +0 -1
- package/dist/config/types.js +0 -13
- package/dist/config/types.js.map +0 -1
- package/dist/file-loader.d.ts +0 -20
- package/dist/file-loader.d.ts.map +0 -1
- package/dist/file-loader.js +0 -121
- package/dist/file-loader.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -11
- package/dist/index.js.map +0 -1
- package/dist/indexer/cache.d.ts +0 -34
- package/dist/indexer/cache.d.ts.map +0 -1
- package/dist/indexer/cache.js +0 -221
- package/dist/indexer/cache.js.map +0 -1
- package/dist/indexer/code-index.d.ts +0 -27
- package/dist/indexer/code-index.d.ts.map +0 -1
- package/dist/indexer/code-index.js +0 -219
- package/dist/indexer/code-index.js.map +0 -1
- package/dist/indexer/project-map.d.ts +0 -23
- package/dist/indexer/project-map.d.ts.map +0 -1
- package/dist/indexer/project-map.js +0 -264
- package/dist/indexer/project-map.js.map +0 -1
- package/dist/llm/lmstudio-native.d.ts +0 -10
- package/dist/llm/lmstudio-native.d.ts.map +0 -1
- package/dist/llm/lmstudio-native.js +0 -179
- package/dist/llm/lmstudio-native.js.map +0 -1
- package/dist/llm/openai-compat.d.ts +0 -11
- package/dist/llm/openai-compat.d.ts.map +0 -1
- package/dist/llm/openai-compat.js +0 -161
- package/dist/llm/openai-compat.js.map +0 -1
- package/dist/llm/provider.d.ts +0 -46
- package/dist/llm/provider.d.ts.map +0 -1
- package/dist/llm/provider.js +0 -13
- package/dist/llm/provider.js.map +0 -1
- package/dist/llm/token-counter.d.ts +0 -15
- package/dist/llm/token-counter.d.ts.map +0 -1
- package/dist/llm/token-counter.js +0 -51
- package/dist/llm/token-counter.js.map +0 -1
- package/dist/logger.d.ts +0 -24
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -156
- package/dist/logger.js.map +0 -1
- package/dist/plugins/adapters/hooks-adapter.d.ts +0 -12
- package/dist/plugins/adapters/hooks-adapter.d.ts.map +0 -1
- package/dist/plugins/adapters/hooks-adapter.js +0 -23
- package/dist/plugins/adapters/hooks-adapter.js.map +0 -1
- package/dist/plugins/builtin/lint-on-write/index.d.ts +0 -12
- package/dist/plugins/builtin/lint-on-write/index.d.ts.map +0 -1
- package/dist/plugins/builtin/lint-on-write/index.js +0 -98
- package/dist/plugins/builtin/lint-on-write/index.js.map +0 -1
- package/dist/plugins/builtin/lint-on-write/index.ts +0 -97
- package/dist/plugins/builtin/lint-on-write/manifest.json +0 -13
- package/dist/plugins/builtin/notify/index.d.ts +0 -11
- package/dist/plugins/builtin/notify/index.d.ts.map +0 -1
- package/dist/plugins/builtin/notify/index.js +0 -102
- package/dist/plugins/builtin/notify/index.js.map +0 -1
- package/dist/plugins/builtin/notify/index.ts +0 -105
- package/dist/plugins/builtin/notify/manifest.json +0 -16
- package/dist/plugins/loader.d.ts +0 -18
- package/dist/plugins/loader.d.ts.map +0 -1
- package/dist/plugins/loader.js +0 -182
- package/dist/plugins/loader.js.map +0 -1
- package/dist/plugins/manager.d.ts +0 -55
- package/dist/plugins/manager.d.ts.map +0 -1
- package/dist/plugins/manager.js +0 -190
- package/dist/plugins/manager.js.map +0 -1
- package/dist/plugins/types.d.ts +0 -76
- package/dist/plugins/types.d.ts.map +0 -1
- package/dist/plugins/types.js +0 -8
- package/dist/plugins/types.js.map +0 -1
- package/dist/repl/commands.d.ts +0 -63
- package/dist/repl/commands.d.ts.map +0 -1
- package/dist/repl/commands.js +0 -1070
- package/dist/repl/commands.js.map +0 -1
- package/dist/repl/history.d.ts +0 -32
- package/dist/repl/history.d.ts.map +0 -1
- package/dist/repl/history.js +0 -40
- package/dist/repl/history.js.map +0 -1
- package/dist/repl/index.d.ts +0 -14
- package/dist/repl/index.d.ts.map +0 -1
- package/dist/repl/index.js +0 -235
- package/dist/repl/index.js.map +0 -1
- package/dist/session/store.d.ts +0 -46
- package/dist/session/store.d.ts.map +0 -1
- package/dist/session/store.js +0 -154
- package/dist/session/store.js.map +0 -1
- package/dist/setup-wizard.d.ts +0 -3
- package/dist/setup-wizard.d.ts.map +0 -1
- package/dist/setup-wizard.js +0 -410
- package/dist/setup-wizard.js.map +0 -1
- package/dist/skills/builtin/agent-test/SKILL.md +0 -68
- package/dist/skills/builtin/cli-expert/SKILL.md +0 -848
- package/dist/skills/builtin/code-review/SKILL.md +0 -424
- package/dist/skills/builtin/git-expert/SKILL.md +0 -522
- package/dist/skills/builtin/grill-me/SKILL.md +0 -46
- package/dist/skills/builtin/jest-testing-expert/SKILL.md +0 -957
- package/dist/skills/builtin/nodejs-expert/SKILL.md +0 -192
- package/dist/skills/builtin/systematic-debugging/SKILL.md +0 -296
- package/dist/skills/builtin/test-driven-development/SKILL.md +0 -371
- package/dist/skills/builtin/typescript-expert/SKILL.md +0 -429
- package/dist/skills/builtin/web-scraping/SKILL.md +0 -422
- package/dist/skills/loader.d.ts +0 -49
- package/dist/skills/loader.d.ts.map +0 -1
- package/dist/skills/loader.js +0 -401
- package/dist/skills/loader.js.map +0 -1
- package/dist/styling/engine.d.ts +0 -39
- package/dist/styling/engine.d.ts.map +0 -1
- package/dist/styling/engine.js +0 -122
- package/dist/styling/engine.js.map +0 -1
- package/dist/styling/index.d.ts +0 -15
- package/dist/styling/index.d.ts.map +0 -1
- package/dist/styling/index.js +0 -40
- package/dist/styling/index.js.map +0 -1
- package/dist/styling/loader.d.ts +0 -9
- package/dist/styling/loader.d.ts.map +0 -1
- package/dist/styling/loader.js +0 -169
- package/dist/styling/loader.js.map +0 -1
- package/dist/styling/types.d.ts +0 -64
- package/dist/styling/types.d.ts.map +0 -1
- package/dist/styling/types.js +0 -12
- package/dist/styling/types.js.map +0 -1
- package/dist/subagent/chat.d.ts +0 -19
- package/dist/subagent/chat.d.ts.map +0 -1
- package/dist/subagent/chat.js +0 -279
- package/dist/subagent/chat.js.map +0 -1
- package/dist/subagent/context.d.ts +0 -9
- package/dist/subagent/context.d.ts.map +0 -1
- package/dist/subagent/context.js +0 -75
- package/dist/subagent/context.js.map +0 -1
- package/dist/subagent/definition.d.ts +0 -7
- package/dist/subagent/definition.d.ts.map +0 -1
- package/dist/subagent/definition.js +0 -26
- package/dist/subagent/definition.js.map +0 -1
- package/dist/subagent/errors.d.ts +0 -24
- package/dist/subagent/errors.d.ts.map +0 -1
- package/dist/subagent/errors.js +0 -85
- package/dist/subagent/errors.js.map +0 -1
- package/dist/subagent/validation.d.ts +0 -17
- package/dist/subagent/validation.d.ts.map +0 -1
- package/dist/subagent/validation.js +0 -83
- package/dist/subagent/validation.js.map +0 -1
- package/dist/tools/adapters/bash-to-fs.d.ts +0 -20
- package/dist/tools/adapters/bash-to-fs.d.ts.map +0 -1
- package/dist/tools/adapters/bash-to-fs.js +0 -74
- package/dist/tools/adapters/bash-to-fs.js.map +0 -1
- package/dist/tools/adapters/content-sanitizer.d.ts +0 -13
- package/dist/tools/adapters/content-sanitizer.d.ts.map +0 -1
- package/dist/tools/adapters/content-sanitizer.js +0 -73
- package/dist/tools/adapters/content-sanitizer.js.map +0 -1
- package/dist/tools/adapters/grounding-fixer.d.ts +0 -15
- package/dist/tools/adapters/grounding-fixer.d.ts.map +0 -1
- package/dist/tools/adapters/grounding-fixer.js +0 -57
- package/dist/tools/adapters/grounding-fixer.js.map +0 -1
- package/dist/tools/adapters/index.d.ts +0 -6
- package/dist/tools/adapters/index.d.ts.map +0 -1
- package/dist/tools/adapters/index.js +0 -5
- package/dist/tools/adapters/index.js.map +0 -1
- package/dist/tools/adapters/pipeline.d.ts +0 -34
- package/dist/tools/adapters/pipeline.d.ts.map +0 -1
- package/dist/tools/adapters/pipeline.js +0 -58
- package/dist/tools/adapters/pipeline.js.map +0 -1
- package/dist/tools/adapters/types.d.ts +0 -46
- package/dist/tools/adapters/types.d.ts.map +0 -1
- package/dist/tools/adapters/types.js +0 -2
- package/dist/tools/adapters/types.js.map +0 -1
- package/dist/tools/approve.d.ts +0 -27
- package/dist/tools/approve.d.ts.map +0 -1
- package/dist/tools/approve.js +0 -45
- package/dist/tools/approve.js.map +0 -1
- package/dist/tools/bash.d.ts +0 -25
- package/dist/tools/bash.d.ts.map +0 -1
- package/dist/tools/bash.js +0 -292
- package/dist/tools/bash.js.map +0 -1
- package/dist/tools/fs/copy-file.d.ts +0 -13
- package/dist/tools/fs/copy-file.d.ts.map +0 -1
- package/dist/tools/fs/copy-file.js +0 -54
- package/dist/tools/fs/copy-file.js.map +0 -1
- package/dist/tools/fs/create-dir.d.ts +0 -13
- package/dist/tools/fs/create-dir.d.ts.map +0 -1
- package/dist/tools/fs/create-dir.js +0 -44
- package/dist/tools/fs/create-dir.js.map +0 -1
- package/dist/tools/fs/delete-file.d.ts +0 -13
- package/dist/tools/fs/delete-file.d.ts.map +0 -1
- package/dist/tools/fs/delete-file.js +0 -52
- package/dist/tools/fs/delete-file.js.map +0 -1
- package/dist/tools/fs/edit-file.d.ts +0 -15
- package/dist/tools/fs/edit-file.d.ts.map +0 -1
- package/dist/tools/fs/edit-file.js +0 -95
- package/dist/tools/fs/edit-file.js.map +0 -1
- package/dist/tools/fs/file-info.d.ts +0 -13
- package/dist/tools/fs/file-info.d.ts.map +0 -1
- package/dist/tools/fs/file-info.js +0 -50
- package/dist/tools/fs/file-info.js.map +0 -1
- package/dist/tools/fs/glob-search.d.ts +0 -13
- package/dist/tools/fs/glob-search.d.ts.map +0 -1
- package/dist/tools/fs/glob-search.js +0 -112
- package/dist/tools/fs/glob-search.js.map +0 -1
- package/dist/tools/fs/grep-search.d.ts +0 -14
- package/dist/tools/fs/grep-search.d.ts.map +0 -1
- package/dist/tools/fs/grep-search.js +0 -135
- package/dist/tools/fs/grep-search.js.map +0 -1
- package/dist/tools/fs/list-dir.d.ts +0 -13
- package/dist/tools/fs/list-dir.d.ts.map +0 -1
- package/dist/tools/fs/list-dir.js +0 -74
- package/dist/tools/fs/list-dir.js.map +0 -1
- package/dist/tools/fs/move-file.d.ts +0 -13
- package/dist/tools/fs/move-file.d.ts.map +0 -1
- package/dist/tools/fs/move-file.js +0 -54
- package/dist/tools/fs/move-file.js.map +0 -1
- package/dist/tools/fs/path-utils.d.ts +0 -51
- package/dist/tools/fs/path-utils.d.ts.map +0 -1
- package/dist/tools/fs/path-utils.js +0 -103
- package/dist/tools/fs/path-utils.js.map +0 -1
- package/dist/tools/fs/read-file.d.ts +0 -13
- package/dist/tools/fs/read-file.d.ts.map +0 -1
- package/dist/tools/fs/read-file.js +0 -64
- package/dist/tools/fs/read-file.js.map +0 -1
- package/dist/tools/fs/tree.d.ts +0 -13
- package/dist/tools/fs/tree.d.ts.map +0 -1
- package/dist/tools/fs/tree.js +0 -89
- package/dist/tools/fs/tree.js.map +0 -1
- package/dist/tools/fs/types.d.ts +0 -14
- package/dist/tools/fs/types.d.ts.map +0 -1
- package/dist/tools/fs/types.js +0 -11
- package/dist/tools/fs/types.js.map +0 -1
- package/dist/tools/fs/write-file.d.ts +0 -14
- package/dist/tools/fs/write-file.d.ts.map +0 -1
- package/dist/tools/fs/write-file.js +0 -83
- package/dist/tools/fs/write-file.js.map +0 -1
- package/dist/tools/hooks.d.ts +0 -44
- package/dist/tools/hooks.d.ts.map +0 -1
- package/dist/tools/hooks.js +0 -217
- package/dist/tools/hooks.js.map +0 -1
- package/dist/tools/id-gen.d.ts +0 -4
- package/dist/tools/id-gen.d.ts.map +0 -1
- package/dist/tools/id-gen.js +0 -12
- package/dist/tools/id-gen.js.map +0 -1
- package/dist/tools/mcp.d.ts +0 -36
- package/dist/tools/mcp.d.ts.map +0 -1
- package/dist/tools/mcp.js +0 -93
- package/dist/tools/mcp.js.map +0 -1
- package/dist/tools/native/approve.d.ts +0 -11
- package/dist/tools/native/approve.d.ts.map +0 -1
- package/dist/tools/native/approve.js +0 -39
- package/dist/tools/native/approve.js.map +0 -1
- package/dist/tools/native/plan.d.ts +0 -10
- package/dist/tools/native/plan.d.ts.map +0 -1
- package/dist/tools/native/plan.js +0 -115
- package/dist/tools/native/plan.js.map +0 -1
- package/dist/tools/native/project-map.d.ts +0 -15
- package/dist/tools/native/project-map.d.ts.map +0 -1
- package/dist/tools/native/project-map.js +0 -203
- package/dist/tools/native/project-map.js.map +0 -1
- package/dist/tools/native/question.d.ts +0 -11
- package/dist/tools/native/question.d.ts.map +0 -1
- package/dist/tools/native/question.js +0 -41
- package/dist/tools/native/question.js.map +0 -1
- package/dist/tools/native/scaffold.d.ts +0 -5
- package/dist/tools/native/scaffold.d.ts.map +0 -1
- package/dist/tools/native/scaffold.js +0 -246
- package/dist/tools/native/scaffold.js.map +0 -1
- package/dist/tools/native/theme.d.ts +0 -10
- package/dist/tools/native/theme.d.ts.map +0 -1
- package/dist/tools/native/theme.js +0 -101
- package/dist/tools/native/theme.js.map +0 -1
- package/dist/tools/native/todo.d.ts +0 -10
- package/dist/tools/native/todo.d.ts.map +0 -1
- package/dist/tools/native/todo.js +0 -58
- package/dist/tools/native/todo.js.map +0 -1
- package/dist/tools/native/user-profile.d.ts +0 -10
- package/dist/tools/native/user-profile.d.ts.map +0 -1
- package/dist/tools/native/user-profile.js +0 -58
- package/dist/tools/native/user-profile.js.map +0 -1
- package/dist/tools/parse-tool-call.d.ts +0 -11
- package/dist/tools/parse-tool-call.d.ts.map +0 -1
- package/dist/tools/parse-tool-call.js +0 -87
- package/dist/tools/parse-tool-call.js.map +0 -1
- package/dist/tools/plan.d.ts +0 -40
- package/dist/tools/plan.d.ts.map +0 -1
- package/dist/tools/plan.js +0 -143
- package/dist/tools/plan.js.map +0 -1
- package/dist/tools/question.d.ts +0 -33
- package/dist/tools/question.d.ts.map +0 -1
- package/dist/tools/question.js +0 -62
- package/dist/tools/question.js.map +0 -1
- package/dist/tools/registry.d.ts +0 -37
- package/dist/tools/registry.d.ts.map +0 -1
- package/dist/tools/registry.js +0 -97
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/sanitizer.d.ts +0 -30
- package/dist/tools/sanitizer.d.ts.map +0 -1
- package/dist/tools/sanitizer.js +0 -77
- package/dist/tools/sanitizer.js.map +0 -1
- package/dist/tools/subagent.d.ts +0 -39
- package/dist/tools/subagent.d.ts.map +0 -1
- package/dist/tools/subagent.js +0 -225
- package/dist/tools/subagent.js.map +0 -1
- package/dist/tools/syntax-check.d.ts +0 -32
- package/dist/tools/syntax-check.d.ts.map +0 -1
- package/dist/tools/syntax-check.js +0 -272
- package/dist/tools/syntax-check.js.map +0 -1
- package/dist/tools/todo.d.ts +0 -28
- package/dist/tools/todo.d.ts.map +0 -1
- package/dist/tools/todo.js +0 -125
- package/dist/tools/todo.js.map +0 -1
- package/dist/tools/types.d.ts +0 -51
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/types.js +0 -2
- package/dist/tools/types.js.map +0 -1
- package/dist/tools/web-browse.d.ts +0 -5
- package/dist/tools/web-browse.d.ts.map +0 -1
- package/dist/tools/web-browse.js +0 -757
- package/dist/tools/web-browse.js.map +0 -1
- package/dist/tools/web-fetch.d.ts +0 -19
- package/dist/tools/web-fetch.d.ts.map +0 -1
- package/dist/tools/web-fetch.js +0 -90
- package/dist/tools/web-fetch.js.map +0 -1
- package/dist/tools/web-search.d.ts +0 -19
- package/dist/tools/web-search.d.ts.map +0 -1
- package/dist/tools/web-search.js +0 -97
- package/dist/tools/web-search.js.map +0 -1
- package/dist/ui/components/status-bar.d.ts +0 -11
- package/dist/ui/components/status-bar.d.ts.map +0 -1
- package/dist/ui/components/status-bar.js +0 -20
- package/dist/ui/components/status-bar.js.map +0 -1
- package/dist/ui/index.d.ts +0 -8
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js +0 -9
- package/dist/ui/index.js.map +0 -1
- package/dist/ui/ink/components/App.d.ts +0 -98
- package/dist/ui/ink/components/App.d.ts.map +0 -1
- package/dist/ui/ink/components/App.js +0 -212
- package/dist/ui/ink/components/App.js.map +0 -1
- package/dist/ui/ink/components/Conversation.d.ts +0 -20
- package/dist/ui/ink/components/Conversation.d.ts.map +0 -1
- package/dist/ui/ink/components/Conversation.js +0 -15
- package/dist/ui/ink/components/Conversation.js.map +0 -1
- package/dist/ui/ink/components/MessageBlock.d.ts +0 -27
- package/dist/ui/ink/components/MessageBlock.d.ts.map +0 -1
- package/dist/ui/ink/components/MessageBlock.js +0 -41
- package/dist/ui/ink/components/MessageBlock.js.map +0 -1
- package/dist/ui/ink/components/PromptInput.d.ts +0 -25
- package/dist/ui/ink/components/PromptInput.d.ts.map +0 -1
- package/dist/ui/ink/components/PromptInput.js +0 -167
- package/dist/ui/ink/components/PromptInput.js.map +0 -1
- package/dist/ui/ink/components/SelectInput.d.ts +0 -9
- package/dist/ui/ink/components/SelectInput.d.ts.map +0 -1
- package/dist/ui/ink/components/SelectInput.js +0 -30
- package/dist/ui/ink/components/SelectInput.js.map +0 -1
- package/dist/ui/ink/components/StatusBar.d.ts +0 -14
- package/dist/ui/ink/components/StatusBar.d.ts.map +0 -1
- package/dist/ui/ink/components/StatusBar.js +0 -20
- package/dist/ui/ink/components/StatusBar.js.map +0 -1
- package/dist/ui/ink/components/StreamBlock.d.ts +0 -8
- package/dist/ui/ink/components/StreamBlock.d.ts.map +0 -1
- package/dist/ui/ink/components/StreamBlock.js +0 -15
- package/dist/ui/ink/components/StreamBlock.js.map +0 -1
- package/dist/ui/ink/components/Tags.d.ts +0 -26
- package/dist/ui/ink/components/Tags.d.ts.map +0 -1
- package/dist/ui/ink/components/Tags.js +0 -37
- package/dist/ui/ink/components/Tags.js.map +0 -1
- package/dist/ui/ink/components/ToolCallBlock.d.ts +0 -31
- package/dist/ui/ink/components/ToolCallBlock.d.ts.map +0 -1
- package/dist/ui/ink/components/ToolCallBlock.js +0 -17
- package/dist/ui/ink/components/ToolCallBlock.js.map +0 -1
- package/dist/ui/ink/renderer.d.ts +0 -69
- package/dist/ui/ink/renderer.d.ts.map +0 -1
- package/dist/ui/ink/renderer.js +0 -142
- package/dist/ui/ink/renderer.js.map +0 -1
- package/dist/ui/ink/theme.d.ts +0 -28
- package/dist/ui/ink/theme.d.ts.map +0 -1
- package/dist/ui/ink/theme.js +0 -45
- package/dist/ui/ink/theme.js.map +0 -1
- package/dist/ui/md-formatter.d.ts +0 -16
- package/dist/ui/md-formatter.d.ts.map +0 -1
- package/dist/ui/md-formatter.js +0 -448
- package/dist/ui/md-formatter.js.map +0 -1
- package/dist/ui/readline-renderer.d.ts +0 -45
- package/dist/ui/readline-renderer.d.ts.map +0 -1
- package/dist/ui/readline-renderer.js +0 -181
- package/dist/ui/readline-renderer.js.map +0 -1
- package/dist/ui/renderer.d.ts +0 -66
- package/dist/ui/renderer.d.ts.map +0 -1
- package/dist/ui/renderer.js +0 -16
- package/dist/ui/renderer.js.map +0 -1
- package/dist/ui/subagent-renderer.d.ts +0 -58
- package/dist/ui/subagent-renderer.d.ts.map +0 -1
- package/dist/ui/subagent-renderer.js +0 -100
- package/dist/ui/subagent-renderer.js.map +0 -1
- package/dist/updater.d.ts +0 -15
- package/dist/updater.d.ts.map +0 -1
- package/dist/updater.js +0 -166
- package/dist/updater.js.map +0 -1
package/dist/subagent/context.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { readdirSync, existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
/**
|
|
4
|
-
* Собирает контекст для субагента: список файлов, зависимости, tsconfig.
|
|
5
|
-
* Сканирует все директории проекта (не только src/).
|
|
6
|
-
*
|
|
7
|
-
* @param cwd - корневая директория проекта
|
|
8
|
-
* @returns Текстовый контекст для system prompt субагента
|
|
9
|
-
*/
|
|
10
|
-
export function buildSubagentContext(cwd) {
|
|
11
|
-
const lines = [];
|
|
12
|
-
// Сканируем все директории в поисках исходных файлов
|
|
13
|
-
try {
|
|
14
|
-
const entries = readdirSync(cwd, { withFileTypes: true });
|
|
15
|
-
for (const entry of entries) {
|
|
16
|
-
if (!entry.isDirectory() ||
|
|
17
|
-
entry.name.startsWith(".") ||
|
|
18
|
-
entry.name === "node_modules")
|
|
19
|
-
continue;
|
|
20
|
-
const dirPath = join(cwd, entry.name);
|
|
21
|
-
try {
|
|
22
|
-
const files = readdirSync(dirPath, { recursive: true })
|
|
23
|
-
.filter((f) => /\.(ts|tsx|js|jsx)$/.test(f))
|
|
24
|
-
.slice(0, 20);
|
|
25
|
-
if (files.length > 0) {
|
|
26
|
-
lines.push(`Files in ${entry.name}/: ${files.join(", ")}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
/* skip unreadable dirs */
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
/* no entries */
|
|
36
|
-
}
|
|
37
|
-
// Корневые .ts/.js файлы
|
|
38
|
-
try {
|
|
39
|
-
const rootFiles = readdirSync(cwd).filter((f) => /\.(ts|js)$/.test(f) && !f.startsWith("."));
|
|
40
|
-
if (rootFiles.length > 0) {
|
|
41
|
-
lines.push("Root files: " + rootFiles.join(", "));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
/* skip */
|
|
46
|
-
}
|
|
47
|
-
// package.json — зависимости и тип модулей
|
|
48
|
-
try {
|
|
49
|
-
const pkgPath = join(cwd, "package.json");
|
|
50
|
-
if (existsSync(pkgPath)) {
|
|
51
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
52
|
-
const deps = Object.keys(pkg.dependencies || {});
|
|
53
|
-
const devDeps = Object.keys(pkg.devDependencies || {});
|
|
54
|
-
if (deps.length > 0)
|
|
55
|
-
lines.push("Dependencies: " + deps.join(", "));
|
|
56
|
-
if (devDeps.length > 0)
|
|
57
|
-
lines.push("DevDependencies: " + devDeps.join(", "));
|
|
58
|
-
lines.push("Module type: " + (pkg.type || "commonjs"));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
/* no package.json */
|
|
63
|
-
}
|
|
64
|
-
// Наличие tsconfig.json
|
|
65
|
-
try {
|
|
66
|
-
if (existsSync(join(cwd, "tsconfig.json"))) {
|
|
67
|
-
lines.push("Has tsconfig.json");
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
/* no tsconfig */
|
|
72
|
-
}
|
|
73
|
-
return lines.join("\n");
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/subagent/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,C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,eAAe,CAAC,CAAC,EAAE,CAAC;YAC3C,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,iBAAiB;IACnB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ToolDefinition } from "../tools/registry.js";
|
|
2
|
-
/**
|
|
3
|
-
* Определение инструмента subagent для реестра тулов.
|
|
4
|
-
* Позволяет LLM делегировать подзадачи изолированному агенту.
|
|
5
|
-
*/
|
|
6
|
-
export declare const subagentDefinition: ToolDefinition;
|
|
7
|
-
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/subagent/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAuBhC,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Определение инструмента subagent для реестра тулов.
|
|
3
|
-
* Позволяет LLM делегировать подзадачи изолированному агенту.
|
|
4
|
-
*/
|
|
5
|
-
export const subagentDefinition = {
|
|
6
|
-
type: "function",
|
|
7
|
-
function: {
|
|
8
|
-
name: "subagent",
|
|
9
|
-
description: "Delegate a task to an isolated agent with a FRESH context (no history of prior errors). Use for: (1) each file when creating 3+ new files, (2) any task where you are stuck or making repeated errors, (3) simple single-step operations (bash, file read/write). The subagent has all tools and starts clean — ideal when accumulated context is causing confusion.",
|
|
10
|
-
parameters: {
|
|
11
|
-
type: "object",
|
|
12
|
-
properties: {
|
|
13
|
-
task: {
|
|
14
|
-
type: "string",
|
|
15
|
-
description: "What the subagent should do — be specific and include file paths",
|
|
16
|
-
},
|
|
17
|
-
existingFiles: {
|
|
18
|
-
type: "string",
|
|
19
|
-
description: "Comma-separated files the subagent can read for context (optional)",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
required: ["task"],
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=definition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/subagent/definition.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAmB;IAChD,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,sWAAsW;QACxW,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,kEAAkE;iBACrE;gBACD,aAAa,EAAE;oBACb,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,oEAAoE;iBACvE;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF;CACF,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** Паттерны ошибок которые НЕ триггерят specialist (trivial) */
|
|
2
|
-
export declare const TRIVIAL_ERROR_PATTERNS: RegExp[];
|
|
3
|
-
/** Паттерны ошибок которые ВСЕГДА требуют specialist (не trivial) */
|
|
4
|
-
export declare const NON_TRIVIAL_ERROR_PATTERNS: RegExp[];
|
|
5
|
-
/**
|
|
6
|
-
* Проверяет является ли ошибка тривиальной (не требует specialist).
|
|
7
|
-
*
|
|
8
|
-
* @param toolName - имя инструмента
|
|
9
|
-
* @param errorOutput - текст ошибки
|
|
10
|
-
* @returns true если ошибка тривиальная
|
|
11
|
-
*/
|
|
12
|
-
export declare function isTrivialError(toolName: string, errorOutput: string): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Контекст для specialist'а — фокусированное описание ошибки.
|
|
15
|
-
*
|
|
16
|
-
* @param toolName - имя упавшего инструмента
|
|
17
|
-
* @param toolArgs - аргументы которые были переданы
|
|
18
|
-
* @param errorOutput - текст ошибки
|
|
19
|
-
* @param userTask - исходный запрос пользователя (краткое описание)
|
|
20
|
-
* @param attemptCount - сколько раз ошибка повторилась
|
|
21
|
-
* @returns Текст задачи для specialist'а
|
|
22
|
-
*/
|
|
23
|
-
export declare function buildSpecialistTask(toolName: string, toolArgs: Record<string, unknown>, errorOutput: string, userTask: string, attemptCount: number): string;
|
|
24
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/subagent/errors.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,eAAO,MAAM,sBAAsB,UAMlC,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,0BAA0B,UAQtC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAmB7E;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,MAAM,CAiCR"}
|
package/dist/subagent/errors.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/** Паттерны ошибок которые НЕ триггерят specialist (trivial) */
|
|
2
|
-
export const TRIVIAL_ERROR_PATTERNS = [
|
|
3
|
-
/no results? found/i,
|
|
4
|
-
/pattern .* matched 0 results/i,
|
|
5
|
-
/0 files? matched/i,
|
|
6
|
-
/command not found.*grep/i,
|
|
7
|
-
/not a directory/i,
|
|
8
|
-
];
|
|
9
|
-
/** Паттерны ошибок которые ВСЕГДА требуют specialist (не trivial) */
|
|
10
|
-
export const NON_TRIVIAL_ERROR_PATTERNS = [
|
|
11
|
-
/unexpected token/i,
|
|
12
|
-
/syntaxerror/i,
|
|
13
|
-
/cannot find module/i,
|
|
14
|
-
/module not found/i,
|
|
15
|
-
/permission denied/i,
|
|
16
|
-
/enoent/i,
|
|
17
|
-
/eacces/i,
|
|
18
|
-
];
|
|
19
|
-
/**
|
|
20
|
-
* Проверяет является ли ошибка тривиальной (не требует specialist).
|
|
21
|
-
*
|
|
22
|
-
* @param toolName - имя инструмента
|
|
23
|
-
* @param errorOutput - текст ошибки
|
|
24
|
-
* @returns true если ошибка тривиальная
|
|
25
|
-
*/
|
|
26
|
-
export function isTrivialError(toolName, errorOutput) {
|
|
27
|
-
// Синтаксические и критические ошибки — ВСЕГДА не trivial
|
|
28
|
-
if (NON_TRIVIAL_ERROR_PATTERNS.some((p) => p.test(errorOutput))) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
// grep_search/glob_search с 0 результатами — нормальное поведение
|
|
32
|
-
if (toolName === "grep_search" || toolName === "glob_search") {
|
|
33
|
-
if (/0 results|0 files|no match/i.test(errorOutput) &&
|
|
34
|
-
errorOutput.length < 200) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
// Любая ошибка < 10 символов — скорее всего trivia
|
|
39
|
-
if (errorOutput.length < 10)
|
|
40
|
-
return true;
|
|
41
|
-
return TRIVIAL_ERROR_PATTERNS.some((p) => p.test(errorOutput));
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Контекст для specialist'а — фокусированное описание ошибки.
|
|
45
|
-
*
|
|
46
|
-
* @param toolName - имя упавшего инструмента
|
|
47
|
-
* @param toolArgs - аргументы которые были переданы
|
|
48
|
-
* @param errorOutput - текст ошибки
|
|
49
|
-
* @param userTask - исходный запрос пользователя (краткое описание)
|
|
50
|
-
* @param attemptCount - сколько раз ошибка повторилась
|
|
51
|
-
* @returns Текст задачи для specialist'а
|
|
52
|
-
*/
|
|
53
|
-
export function buildSpecialistTask(toolName, toolArgs, errorOutput, userTask, attemptCount) {
|
|
54
|
-
const argsStr = JSON.stringify(toolArgs, null, 2);
|
|
55
|
-
// Специфичные подсказки для web_browse evaluate
|
|
56
|
-
let webHints = "";
|
|
57
|
-
if (toolName === "web_browse" && String(toolArgs?.action) === "evaluate") {
|
|
58
|
-
const code = String(toolArgs?.value ?? toolArgs?.code ?? "");
|
|
59
|
-
webHints = [
|
|
60
|
-
"",
|
|
61
|
-
'web_browse evaluate: "value" is JS code executed in browser context.',
|
|
62
|
-
"- return statements work: return document.title",
|
|
63
|
-
`- Current code that failed: ${code.slice(0, 300)}`,
|
|
64
|
-
].join("\n");
|
|
65
|
-
}
|
|
66
|
-
return [
|
|
67
|
-
`The tool "${toolName}" has failed ${attemptCount} times with the same error while working on: "${userTask.slice(0, 200)}"`,
|
|
68
|
-
"",
|
|
69
|
-
`Failed tool call:`,
|
|
70
|
-
` Tool: ${toolName}`,
|
|
71
|
-
` Arguments: ${argsStr}`,
|
|
72
|
-
"",
|
|
73
|
-
`Error output:`,
|
|
74
|
-
` ${errorOutput.slice(0, 500)}`,
|
|
75
|
-
webHints,
|
|
76
|
-
"",
|
|
77
|
-
`Your task: Diagnose WHY this tool call fails and FIX the underlying problem.`,
|
|
78
|
-
` - Read the relevant files to understand the actual state`,
|
|
79
|
-
` - Fix the root cause (wrong path, missing file, syntax error, etc.)`,
|
|
80
|
-
` - If the tool call arguments are wrong, correct them`,
|
|
81
|
-
` - If the file doesn't exist, create it`,
|
|
82
|
-
` - Return a clear summary of what you found and what you fixed`,
|
|
83
|
-
].join("\n");
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/subagent/errors.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,CAAC,MAAM,sBAAsB,G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,EAAE,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC;QACzE,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,EAAE,KAAK,IAAI,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;QAC7D,QAAQ,GAAG;YACT,EAAE;YACF,sEAAsE;YACtE,iDAAiD;YACjD,+BAA+B,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;SACpD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAED,OAAO;QACL,aAAa,QAAQ,gBAAgB,YAAY,iDAAiD,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG;QAC3H,EAAE;QACF,mBAAmB;QACnB,WAAW,QAAQ,EAAE;QACrB,gBAAgB,OAAO,EAAE;QACzB,EAAE;QACF,eAAe;QACf,KAAK,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;QAChC,QAAQ;QACR,EAAE;QACF,8EAA8E;QAC9E,4DAA4D;QAC5D,uEAAuE;QACvE,wDAAwD;QACxD,0CAA0C;QAC1C,iEAAiE;KAClE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** Набор валидных инструментов (единый источник истины) */
|
|
2
|
-
export declare const VALID_TOOLS: Set<string>;
|
|
3
|
-
/** Обязательные аргументы для каждого инструмента */
|
|
4
|
-
export declare const REQUIRED_ARGS: Record<string, string[]>;
|
|
5
|
-
/**
|
|
6
|
-
* Валидация tool call: проверка имени инструмента и обязательных аргументов.
|
|
7
|
-
*
|
|
8
|
-
* @param parsed - распарсенный JSON из tool call
|
|
9
|
-
* @returns Результат валидации с именем инструмента и командой (для bash)
|
|
10
|
-
*/
|
|
11
|
-
export declare function validateToolCall(parsed: any): {
|
|
12
|
-
valid: boolean;
|
|
13
|
-
name?: string;
|
|
14
|
-
cmd?: string;
|
|
15
|
-
error?: string;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/subagent/validation.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,eAAO,MAAM,WAAW,aA0BtB,CAAC;AAEH,qDAAqD;AACrD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAiBlD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,GAAG,GAAG;IAC7C,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAgCA"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/** Набор валидных инструментов (единый источник истины) */
|
|
2
|
-
export const VALID_TOOLS = new Set([
|
|
3
|
-
"bash",
|
|
4
|
-
"plan",
|
|
5
|
-
"todo",
|
|
6
|
-
"question",
|
|
7
|
-
"approve",
|
|
8
|
-
"theme",
|
|
9
|
-
"user_profile",
|
|
10
|
-
"subagent",
|
|
11
|
-
"read_file",
|
|
12
|
-
"write_file",
|
|
13
|
-
"edit_file",
|
|
14
|
-
"list_dir",
|
|
15
|
-
"create_dir",
|
|
16
|
-
"delete_file",
|
|
17
|
-
"copy_file",
|
|
18
|
-
"move_file",
|
|
19
|
-
"file_info",
|
|
20
|
-
"glob_search",
|
|
21
|
-
"grep_search",
|
|
22
|
-
"tree",
|
|
23
|
-
"web_search",
|
|
24
|
-
"web_fetch",
|
|
25
|
-
"web_browse",
|
|
26
|
-
"scaffold",
|
|
27
|
-
"project_map",
|
|
28
|
-
]);
|
|
29
|
-
/** Обязательные аргументы для каждого инструмента */
|
|
30
|
-
export const REQUIRED_ARGS = {
|
|
31
|
-
read_file: ["path"],
|
|
32
|
-
write_file: ["path", "content"],
|
|
33
|
-
edit_file: ["path", "old_string", "new_string"],
|
|
34
|
-
list_dir: [],
|
|
35
|
-
create_dir: ["path"],
|
|
36
|
-
delete_file: ["path"],
|
|
37
|
-
copy_file: ["source", "destination"],
|
|
38
|
-
move_file: ["source", "destination"],
|
|
39
|
-
file_info: ["path"],
|
|
40
|
-
glob_search: ["pattern"],
|
|
41
|
-
grep_search: ["pattern"],
|
|
42
|
-
tree: [],
|
|
43
|
-
web_search: ["query"],
|
|
44
|
-
web_fetch: ["url"],
|
|
45
|
-
user_profile: [],
|
|
46
|
-
question: ["question"],
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Валидация tool call: проверка имени инструмента и обязательных аргументов.
|
|
50
|
-
*
|
|
51
|
-
* @param parsed - распарсенный JSON из tool call
|
|
52
|
-
* @returns Результат валидации с именем инструмента и командой (для bash)
|
|
53
|
-
*/
|
|
54
|
-
export function validateToolCall(parsed) {
|
|
55
|
-
if (!parsed || typeof parsed !== "object") {
|
|
56
|
-
return { valid: false, error: "Not an object" };
|
|
57
|
-
}
|
|
58
|
-
if (!parsed.name || !VALID_TOOLS.has(parsed.name)) {
|
|
59
|
-
return { valid: false, error: `Unknown tool: ${parsed.name}` };
|
|
60
|
-
}
|
|
61
|
-
if (!parsed.arguments || typeof parsed.arguments !== "object") {
|
|
62
|
-
return { valid: false, error: "Missing arguments" };
|
|
63
|
-
}
|
|
64
|
-
if (parsed.name === "bash") {
|
|
65
|
-
const cmd = String(parsed.arguments.cmd ?? "").trim();
|
|
66
|
-
if (!cmd)
|
|
67
|
-
return { valid: false, error: "Empty command" };
|
|
68
|
-
return { valid: true, name: parsed.name, cmd };
|
|
69
|
-
}
|
|
70
|
-
const required = REQUIRED_ARGS[parsed.name] ?? [];
|
|
71
|
-
const missing = required.filter((k) => {
|
|
72
|
-
const v = parsed.arguments[k];
|
|
73
|
-
return v === undefined || v === null || v === "";
|
|
74
|
-
});
|
|
75
|
-
if (missing.length > 0) {
|
|
76
|
-
return {
|
|
77
|
-
valid: false,
|
|
78
|
-
error: `Missing required argument(s): ${missing.join(", ")}. Tool "${parsed.name}" requires: ${required.join(", ")}`,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return { valid: true, name: parsed.name };
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/subagent/validation.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IACjC,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU;IACV,SAAS;IACT,OAAO;IACP,cAAc;IACd,UAAU;IACV,WAAW;IACX,YAAY;IACZ,WAAW;IACX,UAAU;IACV,YAAY;IACZ,aAAa;IACb,WAAW;IACX,WAAW;IACX,WAAW;IACX,aAAa;IACb,aAAa;IACb,MAAM;IACN,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,UAAU;IACV,aAAa;CACd,CAAC,CAAC;AAEH,qDAAqD;AACrD,MAAM,CAAC,MAAM,aAAa,GAA6B;IACrD,SAAS,EAAE,CAAC,MAAM,CAAC;IACnB,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;IAC/B,SAAS,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAC;IAC/C,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,MAAM,CAAC;IACrB,SAAS,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC;IACpC,SAAS,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC;IACpC,SAAS,EAAE,CAAC,MAAM,CAAC;IACnB,WAAW,EAAE,CAAC,SAAS,CAAC;IACxB,WAAW,EAAE,CAAC,SAAS,CAAC;IACxB,IAAI,EAAE,EAAE;IACR,UAAU,E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CAAC,CAAC,EAAE,EAAE;QACpC,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC9B,OAAO,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,iCAAiC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,IAAI,eAAe,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;SACrH,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ToolAdapter } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Адаптер bash → fs-tools.
|
|
4
|
-
*
|
|
5
|
-
* Перехватывает bash-команды, которые на самом деле являются файловыми
|
|
6
|
-
* операциями (echo, Set-Content, Out-File и т.д.), и конвертирует их
|
|
7
|
-
* в write_file/edit_file. Это компенсирует склонность маленьких моделей
|
|
8
|
-
* использовать bash для файловых операций.
|
|
9
|
-
*
|
|
10
|
-
* Поддерживаемые паттерны (Windows PowerShell):
|
|
11
|
-
* echo 'content' > path
|
|
12
|
-
* echo "content" > path
|
|
13
|
-
* 'content' | Set-Content -Path path
|
|
14
|
-
* Set-Content -Path path -Value 'content'
|
|
15
|
-
* Add-Content -Path path -Value 'content'
|
|
16
|
-
* 'content' | Out-File -FilePath path
|
|
17
|
-
* Out-File -FilePath path -InputObject 'content'
|
|
18
|
-
*/
|
|
19
|
-
export declare const bashToFsAdapter: ToolAdapter;
|
|
20
|
-
//# sourceMappingURL=bash-to-fs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bash-to-fs.d.ts","sourceRoot":"","sources":["../../../src/tools/adapters/bash-to-fs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAiC,MAAM,YAAY,CAAC;AAE7E;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe,EAAE,WA8D7B,CAAC"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Адаптер bash → fs-tools.
|
|
3
|
-
*
|
|
4
|
-
* Перехватывает bash-команды, которые на самом деле являются файловыми
|
|
5
|
-
* операциями (echo, Set-Content, Out-File и т.д.), и конвертирует их
|
|
6
|
-
* в write_file/edit_file. Это компенсирует склонность маленьких моделей
|
|
7
|
-
* использовать bash для файловых операций.
|
|
8
|
-
*
|
|
9
|
-
* Поддерживаемые паттерны (Windows PowerShell):
|
|
10
|
-
* echo 'content' > path
|
|
11
|
-
* echo "content" > path
|
|
12
|
-
* 'content' | Set-Content -Path path
|
|
13
|
-
* Set-Content -Path path -Value 'content'
|
|
14
|
-
* Add-Content -Path path -Value 'content'
|
|
15
|
-
* 'content' | Out-File -FilePath path
|
|
16
|
-
* Out-File -FilePath path -InputObject 'content'
|
|
17
|
-
*/
|
|
18
|
-
export const bashToFsAdapter = {
|
|
19
|
-
name: "bash-to-fs",
|
|
20
|
-
priority: 10,
|
|
21
|
-
async adapt(call, _ctx) {
|
|
22
|
-
if (call.parsed?.name !== "bash")
|
|
23
|
-
return { action: "pass" };
|
|
24
|
-
const cmd = call.cmd ?? "";
|
|
25
|
-
if (!cmd.trim())
|
|
26
|
-
return { action: "pass" };
|
|
27
|
-
// Set-Content / Add-Content
|
|
28
|
-
const psWriteMatch = cmd.match(/^(?:['"]([^'"]*)['"]\s*\|)?\s*(?:Set-Content|Add-Content|Out-File)\s+(?:-(?:Path|FilePath)\s+)?['"]?([^'"]+)['"]?\s*(?:-(?:Value|InputObject)\s+)?(?:['"]([^'"]*)['"])?/i);
|
|
29
|
-
if (psWriteMatch) {
|
|
30
|
-
const [, pipeContent, rawPath, valueContent] = psWriteMatch;
|
|
31
|
-
const content = valueContent ?? pipeContent ?? "";
|
|
32
|
-
const path = rawPath?.trim().replace(/\\/g, "/");
|
|
33
|
-
if (!path || !content)
|
|
34
|
-
return { action: "pass" };
|
|
35
|
-
return {
|
|
36
|
-
action: "replace",
|
|
37
|
-
call: {
|
|
38
|
-
parsed: {
|
|
39
|
-
name: "write_file",
|
|
40
|
-
arguments: { path, content },
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
log: `[adapter:bash-to-fs] converted bash '${cmd.slice(0, 60)}' to write_file path="${path}"`,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
// echo 'content' > path / echo "content" > path
|
|
47
|
-
const echoSingleMatch = cmd.match(/^echo\s+'((?:[^'\\]|\\.)*)'\s*(>{1,2})\s*(.+)$/i);
|
|
48
|
-
const echoDoubleMatch = cmd.match(/^echo\s+"((?:[^"\\]|\\.)*)"\s*(>{1,2})\s*(.+)$/i);
|
|
49
|
-
const echoRedirectMatch = echoSingleMatch ?? echoDoubleMatch;
|
|
50
|
-
if (echoRedirectMatch) {
|
|
51
|
-
const content = echoRedirectMatch[1];
|
|
52
|
-
const redirect = echoRedirectMatch[2];
|
|
53
|
-
const rawPath = echoRedirectMatch[3];
|
|
54
|
-
const path = rawPath.trim().replace(/\\/g, "/");
|
|
55
|
-
if (!path || !content)
|
|
56
|
-
return { action: "pass" };
|
|
57
|
-
const name = redirect === ">" ? "write_file" : "edit_file";
|
|
58
|
-
return {
|
|
59
|
-
action: "replace",
|
|
60
|
-
call: {
|
|
61
|
-
parsed: {
|
|
62
|
-
name,
|
|
63
|
-
arguments: name === "write_file"
|
|
64
|
-
? { path, content }
|
|
65
|
-
: { path, old_string: "", new_string: content },
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
log: `[adapter:bash-to-fs] converted bash '${cmd.slice(0, 60)}' to ${name} path="${path}"`,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
return { action: "pass" };
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
//# sourceMappingURL=bash-to-fs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bash-to-fs.js","sourceRoot":"","sources":["../../../src/tools/adapters/bash-to-fs.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,IAAI,EAAE,YAAY;IAClB,QAAQ,EAAE,EAAE;IAEZ,KAAK,CAAC,KAAK,CAAC,IAAgB,EAAE,IAAoB;QAChD,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,KAAK,MAAM;YAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAC5D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;YAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAE3C,4BAA4B;QAC5B,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK,CAC5B,0KAA0K,CAC3K,CAAC;QACF,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,CAAC,GAAG,YAAY,CAAC;YAC5D,MAAM,OAAO,GAAG,YAAY,IAAI,WAAW,IAAI,EAAE,CAAC;YAClD,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YACjD,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO;gBAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;YACjD,OAAO;gBACL,MAAM,EAAE,SAAS;gBACjB,IAAI,EAAE;oBACJ,MAAM,EAAE;wBACN,IAAI,EAAE,YAAY;wBAClB,SAAS,EAAE,E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aAC3F,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC5B,CAAC;CACF,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ToolAdapter } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Адаптер content-sanitizer.
|
|
4
|
-
*
|
|
5
|
-
* Маленькие модели иногда передают в write_file content как:
|
|
6
|
-
* - null/undefined (вместо пустой строки)
|
|
7
|
-
* - число (вместо строки)
|
|
8
|
-
* - объект (результат неверного JSON.stringify)
|
|
9
|
-
*
|
|
10
|
-
* Адаптер приводит content к корректному строковому виду.
|
|
11
|
-
*/
|
|
12
|
-
export declare const contentSanitizerAdapter: ToolAdapter;
|
|
13
|
-
//# sourceMappingURL=content-sanitizer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-sanitizer.d.ts","sourceRoot":"","sources":["../../../src/tools/adapters/content-sanitizer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAiC,MAAM,YAAY,CAAC;AAE7E;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAgErC,CAAC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Адаптер content-sanitizer.
|
|
3
|
-
*
|
|
4
|
-
* Маленькие модели иногда передают в write_file content как:
|
|
5
|
-
* - null/undefined (вместо пустой строки)
|
|
6
|
-
* - число (вместо строки)
|
|
7
|
-
* - объект (результат неверного JSON.stringify)
|
|
8
|
-
*
|
|
9
|
-
* Адаптер приводит content к корректному строковому виду.
|
|
10
|
-
*/
|
|
11
|
-
export const contentSanitizerAdapter = {
|
|
12
|
-
name: "content-sanitizer",
|
|
13
|
-
priority: 30,
|
|
14
|
-
async adapt(call, _ctx) {
|
|
15
|
-
if (call.parsed?.name !== "write_file")
|
|
16
|
-
return { action: "pass" };
|
|
17
|
-
const content = call.parsed?.arguments?.content;
|
|
18
|
-
if (typeof content === "string")
|
|
19
|
-
return { action: "pass" };
|
|
20
|
-
if (content === null || content === undefined) {
|
|
21
|
-
const path = call.parsed?.arguments?.path ?? "?";
|
|
22
|
-
return {
|
|
23
|
-
action: "replace",
|
|
24
|
-
call: {
|
|
25
|
-
parsed: {
|
|
26
|
-
name: "write_file",
|
|
27
|
-
arguments: { ...call.parsed.arguments, content: "" },
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
log: `[adapter:content-sanitizer] fixed null content for "${path}"`,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
if (typeof content === "number" || typeof content === "boolean") {
|
|
34
|
-
const path = call.parsed?.arguments?.path ?? "?";
|
|
35
|
-
return {
|
|
36
|
-
action: "replace",
|
|
37
|
-
call: {
|
|
38
|
-
parsed: {
|
|
39
|
-
name: "write_file",
|
|
40
|
-
arguments: { ...call.parsed.arguments, content: String(content) },
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
log: `[adapter:content-sanitizer] converted ${typeof content} to string for "${path}"`,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
if (typeof content === "object") {
|
|
47
|
-
const path = call.parsed?.arguments?.path ?? "?";
|
|
48
|
-
try {
|
|
49
|
-
return {
|
|
50
|
-
action: "replace",
|
|
51
|
-
call: {
|
|
52
|
-
parsed: {
|
|
53
|
-
name: "write_file",
|
|
54
|
-
arguments: {
|
|
55
|
-
...call.parsed.arguments,
|
|
56
|
-
content: JSON.stringify(content, null, 2),
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
log: `[adapter:content-sanitizer] serialized object content for "${path}"`,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
return {
|
|
65
|
-
action: "block",
|
|
66
|
-
message: `[adapter:content-sanitizer] cannot serialize content for "${path}": invalid object`,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return { action: "pass" };
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=content-sanitizer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-sanitizer.js","sourceRoot":"","sources":["../../../src/tools/adapters/content-sanitizer.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAgB;IAClD,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,EAAE;IAEZ,KAAK,CAAC,KAAK,CAAC,IAAgB,EAAE,IAAoB;QAChD,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,KAAK,YAAY;YAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAClE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC;QAEhD,IAAI,OAAO,OAAO,KAAK,QAAQ;YAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAE3D,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,IAAI,GAAG,CAAC;YACjD,OAAO;gBACL,MAAM,EAAE,SAAS;gBACjB,IAAI,EAAE;oBACJ,MAAM,EAAE;wBACN,IAAI,EAAE,YAAY;wBAClB,SAAS,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;qBACrD;iBACF;gBACD,GAAG,EAAE,uDAAuD,IAAI,GAAG;aACpE,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,SAAS,EAAE,CAAC;YAChE,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,IAAI,GAAG,CAAC;YACjD,OAAO;gBACL,MAAM,EAAE,SAAS;gBACjB,IAAI,EAAE;oBACJ,MAAM,EAAE;wBACN,IAAI,EAAE,YAAY;wBAClB,SAAS,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE;qBAClE;iBACF;gBACD,GAAG,EAAE,yCAAyC,OAAO,OAAO,mBAAmB,IAAI,GAAG;aACvF,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,IAAI,GAAG,CAAC;YACjD,IAAI,CAAC;gBACH,OAAO;oBACL,MAAM,EAAE,SAAS;oBACjB,IAAI,EAAE;wBACJ,MAAM,EAAE;4BACN,IAAI,EAAE,YAAY;4BAClB,SAAS,EAAE;gCACT,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS;gCACxB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;6BAC1C;yBACF;qBACF;oBACD,GAAG,EAAE,8DAA8D,IAAI,GAAG;iBAC3E,CAAC;YACJ,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO;oBACL,MAAM,EAAE,OAAO;oBACf,OAAO,EAAE,6DAA6D,IAAI,mBAAmB;iBAC9F,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC5B,CAAC;CACF,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ToolAdapter } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Адаптер grounding-fixer.
|
|
4
|
-
*
|
|
5
|
-
* Маленькие модели часто забывают добавить @grounding[файл: path] маркер
|
|
6
|
-
* перед вызовом fs-инструментов. Вместо того чтобы блокировать вызов и
|
|
7
|
-
* гонять модель по retry-циклу, этот адаптер проверяет, есть ли в ответе
|
|
8
|
-
* LLM соответствующий маркер, и если нет — НЕ блокирует вызов, а просто
|
|
9
|
-
* пропускает его. Grounding check в loop.ts после этого адаптера
|
|
10
|
-
* не блокирует, а только предупреждает.
|
|
11
|
-
*
|
|
12
|
-
* Адаптер можно отключить через config.agent.grounding.enabled = false.
|
|
13
|
-
*/
|
|
14
|
-
export declare const groundingFixerAdapter: ToolAdapter;
|
|
15
|
-
//# sourceMappingURL=grounding-fixer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grounding-fixer.d.ts","sourceRoot":"","sources":["../../../src/tools/adapters/grounding-fixer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAiC,MAAM,YAAY,CAAC;AAE7E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,EAAE,WA8CnC,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Адаптер grounding-fixer.
|
|
3
|
-
*
|
|
4
|
-
* Маленькие модели часто забывают добавить @grounding[файл: path] маркер
|
|
5
|
-
* перед вызовом fs-инструментов. Вместо того чтобы блокировать вызов и
|
|
6
|
-
* гонять модель по retry-циклу, этот адаптер проверяет, есть ли в ответе
|
|
7
|
-
* LLM соответствующий маркер, и если нет — НЕ блокирует вызов, а просто
|
|
8
|
-
* пропускает его. Grounding check в loop.ts после этого адаптера
|
|
9
|
-
* не блокирует, а только предупреждает.
|
|
10
|
-
*
|
|
11
|
-
* Адаптер можно отключить через config.agent.grounding.enabled = false.
|
|
12
|
-
*/
|
|
13
|
-
export const groundingFixerAdapter = {
|
|
14
|
-
name: "grounding-fixer",
|
|
15
|
-
priority: 20,
|
|
16
|
-
async adapt(call, ctx) {
|
|
17
|
-
const groundingCfg = ctx.config.agent?.grounding;
|
|
18
|
-
if (groundingCfg?.enabled === false)
|
|
19
|
-
return { action: "pass" };
|
|
20
|
-
// Проверяем только fs-инструменты с path-аргументом
|
|
21
|
-
const path = call.parsed?.arguments?.path;
|
|
22
|
-
if (!path || typeof path !== "string")
|
|
23
|
-
return { action: "pass" };
|
|
24
|
-
const fsTools = new Set([
|
|
25
|
-
"read_file",
|
|
26
|
-
"write_file",
|
|
27
|
-
"edit_file",
|
|
28
|
-
"delete_file",
|
|
29
|
-
"file_info",
|
|
30
|
-
"create_dir",
|
|
31
|
-
"list_dir",
|
|
32
|
-
]);
|
|
33
|
-
if (!fsTools.has(call.parsed?.name ?? ""))
|
|
34
|
-
return { action: "pass" };
|
|
35
|
-
// Ищем @grounding[файл: path] в сыром ответе LLM
|
|
36
|
-
const markerPattern = /@grounding\[файл:\s*([^\]]+)\]/gi;
|
|
37
|
-
let found = false;
|
|
38
|
-
let match;
|
|
39
|
-
while ((match = markerPattern.exec(ctx.responseText)) !== null) {
|
|
40
|
-
const markerPath = match[1].trim().replace(/\\/g, "/");
|
|
41
|
-
const callPath = String(path).replace(/\\/g, "/");
|
|
42
|
-
if (callPath.endsWith(markerPath) || markerPath.endsWith(callPath)) {
|
|
43
|
-
found = true;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (!found) {
|
|
48
|
-
return {
|
|
49
|
-
action: "replace",
|
|
50
|
-
call,
|
|
51
|
-
log: `[adapter:grounding-fixer] added implicit grounding for "${path}"`,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
return { action: "pass" };
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=grounding-fixer.js.map
|