@agntk/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +227 -0
- package/dist/advanced/index.d.ts +35 -0
- package/dist/advanced/index.d.ts.map +1 -0
- package/dist/advanced/index.js +52 -0
- package/dist/advanced/index.js.map +1 -0
- package/dist/agent.d.ts +46 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +381 -0
- package/dist/agent.js.map +1 -0
- package/dist/config/defaults.d.ts +10 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +34 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +11 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +54 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +222 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +912 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +119 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/constants.d.ts +17 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +23 -0
- package/dist/constants.js.map +1 -0
- package/dist/evals/assertions.d.ts +54 -0
- package/dist/evals/assertions.d.ts.map +1 -0
- package/dist/evals/assertions.js +200 -0
- package/dist/evals/assertions.js.map +1 -0
- package/dist/evals/index.d.ts +9 -0
- package/dist/evals/index.d.ts.map +1 -0
- package/dist/evals/index.js +8 -0
- package/dist/evals/index.js.map +1 -0
- package/dist/evals/runner.d.ts +34 -0
- package/dist/evals/runner.d.ts.map +1 -0
- package/dist/evals/runner.js +186 -0
- package/dist/evals/runner.js.map +1 -0
- package/dist/evals/types.d.ts +68 -0
- package/dist/evals/types.d.ts.map +1 -0
- package/dist/evals/types.js +5 -0
- package/dist/evals/types.js.map +1 -0
- package/dist/guardrails/built-ins.d.ts +48 -0
- package/dist/guardrails/built-ins.d.ts.map +1 -0
- package/dist/guardrails/built-ins.js +149 -0
- package/dist/guardrails/built-ins.js.map +1 -0
- package/dist/guardrails/index.d.ts +8 -0
- package/dist/guardrails/index.d.ts.map +1 -0
- package/dist/guardrails/index.js +7 -0
- package/dist/guardrails/index.js.map +1 -0
- package/dist/guardrails/runner.d.ts +49 -0
- package/dist/guardrails/runner.d.ts.map +1 -0
- package/dist/guardrails/runner.js +148 -0
- package/dist/guardrails/runner.js.map +1 -0
- package/dist/guardrails/types.d.ts +63 -0
- package/dist/guardrails/types.d.ts.map +1 -0
- package/dist/guardrails/types.js +22 -0
- package/dist/guardrails/types.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/memory/engine.d.ts +130 -0
- package/dist/memory/engine.d.ts.map +1 -0
- package/dist/memory/engine.js +227 -0
- package/dist/memory/engine.js.map +1 -0
- package/dist/memory/extraction.d.ts +24 -0
- package/dist/memory/extraction.d.ts.map +1 -0
- package/dist/memory/extraction.js +130 -0
- package/dist/memory/extraction.js.map +1 -0
- package/dist/memory/loader.d.ts +20 -0
- package/dist/memory/loader.d.ts.map +1 -0
- package/dist/memory/loader.js +73 -0
- package/dist/memory/loader.js.map +1 -0
- package/dist/memory/store.d.ts +42 -0
- package/dist/memory/store.d.ts.map +1 -0
- package/dist/memory/store.js +120 -0
- package/dist/memory/store.js.map +1 -0
- package/dist/memory/tools.d.ts +39 -0
- package/dist/memory/tools.d.ts.map +1 -0
- package/dist/memory/tools.js +225 -0
- package/dist/memory/tools.js.map +1 -0
- package/dist/memory/types.d.ts +46 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js +8 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/memory/vectra-store.d.ts +31 -0
- package/dist/memory/vectra-store.d.ts.map +1 -0
- package/dist/memory/vectra-store.js +122 -0
- package/dist/memory/vectra-store.js.map +1 -0
- package/dist/models.d.ts +37 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +131 -0
- package/dist/models.js.map +1 -0
- package/dist/observability/index.d.ts +6 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +5 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/langfuse.d.ts +47 -0
- package/dist/observability/langfuse.d.ts.map +1 -0
- package/dist/observability/langfuse.js +112 -0
- package/dist/observability/langfuse.js.map +1 -0
- package/dist/observability/types.d.ts +37 -0
- package/dist/observability/types.d.ts.map +1 -0
- package/dist/observability/types.js +5 -0
- package/dist/observability/types.js.map +1 -0
- package/dist/pool/index.d.ts +7 -0
- package/dist/pool/index.d.ts.map +1 -0
- package/dist/pool/index.js +6 -0
- package/dist/pool/index.js.map +1 -0
- package/dist/pool/specialist-pool.d.ts +59 -0
- package/dist/pool/specialist-pool.d.ts.map +1 -0
- package/dist/pool/specialist-pool.js +224 -0
- package/dist/pool/specialist-pool.js.map +1 -0
- package/dist/pool/tools.d.ts +63 -0
- package/dist/pool/tools.d.ts.map +1 -0
- package/dist/pool/tools.js +83 -0
- package/dist/pool/tools.js.map +1 -0
- package/dist/pool/types.d.ts +79 -0
- package/dist/pool/types.d.ts.map +1 -0
- package/dist/pool/types.js +5 -0
- package/dist/pool/types.js.map +1 -0
- package/dist/presets/index.d.ts +5 -0
- package/dist/presets/index.d.ts.map +1 -0
- package/dist/presets/index.js +5 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/presets/role-registry.d.ts +41 -0
- package/dist/presets/role-registry.d.ts.map +1 -0
- package/dist/presets/role-registry.js +213 -0
- package/dist/presets/role-registry.js.map +1 -0
- package/dist/presets/roles.d.ts +105 -0
- package/dist/presets/roles.d.ts.map +1 -0
- package/dist/presets/roles.js +207 -0
- package/dist/presets/roles.js.map +1 -0
- package/dist/presets/sub-agent-configs.d.ts +19 -0
- package/dist/presets/sub-agent-configs.d.ts.map +1 -0
- package/dist/presets/sub-agent-configs.js +71 -0
- package/dist/presets/sub-agent-configs.js.map +1 -0
- package/dist/presets/tool-preset-registry.d.ts +34 -0
- package/dist/presets/tool-preset-registry.d.ts.map +1 -0
- package/dist/presets/tool-preset-registry.js +107 -0
- package/dist/presets/tool-preset-registry.js.map +1 -0
- package/dist/presets/tools.d.ts +278 -0
- package/dist/presets/tools.d.ts.map +1 -0
- package/dist/presets/tools.js +108 -0
- package/dist/presets/tools.js.map +1 -0
- package/dist/prompts/context.d.ts +47 -0
- package/dist/prompts/context.d.ts.map +1 -0
- package/dist/prompts/context.js +187 -0
- package/dist/prompts/context.js.map +1 -0
- package/dist/prompts/template.d.ts +17 -0
- package/dist/prompts/template.d.ts.map +1 -0
- package/dist/prompts/template.js +32 -0
- package/dist/prompts/template.js.map +1 -0
- package/dist/prompts/templates.d.ts +11 -0
- package/dist/prompts/templates.d.ts.map +1 -0
- package/dist/prompts/templates.js +115 -0
- package/dist/prompts/templates.js.map +1 -0
- package/dist/reflection.d.ts +48 -0
- package/dist/reflection.d.ts.map +1 -0
- package/dist/reflection.js +91 -0
- package/dist/reflection.js.map +1 -0
- package/dist/skills/index.d.ts +6 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +5 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/loader.d.ts +84 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +400 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/skills/types.d.ts +66 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +6 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/streaming/data-parts.d.ts +163 -0
- package/dist/streaming/data-parts.d.ts.map +1 -0
- package/dist/streaming/data-parts.js +14 -0
- package/dist/streaming/data-parts.js.map +1 -0
- package/dist/streaming/index.d.ts +8 -0
- package/dist/streaming/index.d.ts.map +1 -0
- package/dist/streaming/index.js +10 -0
- package/dist/streaming/index.js.map +1 -0
- package/dist/streaming/transient.d.ts +136 -0
- package/dist/streaming/transient.d.ts.map +1 -0
- package/dist/streaming/transient.js +201 -0
- package/dist/streaming/transient.js.map +1 -0
- package/dist/tools/approval.d.ts +67 -0
- package/dist/tools/approval.d.ts.map +1 -0
- package/dist/tools/approval.js +113 -0
- package/dist/tools/approval.js.map +1 -0
- package/dist/tools/ast-grep/cli.d.ts +16 -0
- package/dist/tools/ast-grep/cli.d.ts.map +1 -0
- package/dist/tools/ast-grep/cli.js +198 -0
- package/dist/tools/ast-grep/cli.js.map +1 -0
- package/dist/tools/ast-grep/constants.d.ts +24 -0
- package/dist/tools/ast-grep/constants.d.ts.map +1 -0
- package/dist/tools/ast-grep/constants.js +247 -0
- package/dist/tools/ast-grep/constants.js.map +1 -0
- package/dist/tools/ast-grep/downloader.d.ts +6 -0
- package/dist/tools/ast-grep/downloader.d.ts.map +1 -0
- package/dist/tools/ast-grep/downloader.js +137 -0
- package/dist/tools/ast-grep/downloader.js.map +1 -0
- package/dist/tools/ast-grep/index.d.ts +7 -0
- package/dist/tools/ast-grep/index.d.ts.map +1 -0
- package/dist/tools/ast-grep/index.js +6 -0
- package/dist/tools/ast-grep/index.js.map +1 -0
- package/dist/tools/ast-grep/tools.d.ts +33 -0
- package/dist/tools/ast-grep/tools.d.ts.map +1 -0
- package/dist/tools/ast-grep/tools.js +140 -0
- package/dist/tools/ast-grep/tools.js.map +1 -0
- package/dist/tools/ast-grep/types.d.ts +68 -0
- package/dist/tools/ast-grep/types.d.ts.map +1 -0
- package/dist/tools/ast-grep/types.js +2 -0
- package/dist/tools/ast-grep/types.js.map +1 -0
- package/dist/tools/ast-grep/utils.d.ts +4 -0
- package/dist/tools/ast-grep/utils.d.ts.map +1 -0
- package/dist/tools/ast-grep/utils.js +55 -0
- package/dist/tools/ast-grep/utils.js.map +1 -0
- package/dist/tools/browser/index.d.ts +6 -0
- package/dist/tools/browser/index.d.ts.map +1 -0
- package/dist/tools/browser/index.js +5 -0
- package/dist/tools/browser/index.js.map +1 -0
- package/dist/tools/browser/stream.d.ts +112 -0
- package/dist/tools/browser/stream.d.ts.map +1 -0
- package/dist/tools/browser/stream.js +228 -0
- package/dist/tools/browser/stream.js.map +1 -0
- package/dist/tools/browser/tool.d.ts +144 -0
- package/dist/tools/browser/tool.d.ts.map +1 -0
- package/dist/tools/browser/tool.js +214 -0
- package/dist/tools/browser/tool.js.map +1 -0
- package/dist/tools/browser/types.d.ts +216 -0
- package/dist/tools/browser/types.d.ts.map +1 -0
- package/dist/tools/browser/types.js +146 -0
- package/dist/tools/browser/types.js.map +1 -0
- package/dist/tools/deep-reasoning/constants.d.ts +11 -0
- package/dist/tools/deep-reasoning/constants.d.ts.map +1 -0
- package/dist/tools/deep-reasoning/constants.js +35 -0
- package/dist/tools/deep-reasoning/constants.js.map +1 -0
- package/dist/tools/deep-reasoning/engine.d.ts +20 -0
- package/dist/tools/deep-reasoning/engine.d.ts.map +1 -0
- package/dist/tools/deep-reasoning/engine.js +77 -0
- package/dist/tools/deep-reasoning/engine.js.map +1 -0
- package/dist/tools/deep-reasoning/index.d.ts +5 -0
- package/dist/tools/deep-reasoning/index.d.ts.map +1 -0
- package/dist/tools/deep-reasoning/index.js +7 -0
- package/dist/tools/deep-reasoning/index.js.map +1 -0
- package/dist/tools/deep-reasoning/tools.d.ts +12 -0
- package/dist/tools/deep-reasoning/tools.d.ts.map +1 -0
- package/dist/tools/deep-reasoning/tools.js +23 -0
- package/dist/tools/deep-reasoning/tools.js.map +1 -0
- package/dist/tools/deep-reasoning/types.d.ts +66 -0
- package/dist/tools/deep-reasoning/types.d.ts.map +1 -0
- package/dist/tools/deep-reasoning/types.js +13 -0
- package/dist/tools/deep-reasoning/types.js.map +1 -0
- package/dist/tools/factory.d.ts +109 -0
- package/dist/tools/factory.d.ts.map +1 -0
- package/dist/tools/factory.js +166 -0
- package/dist/tools/factory.js.map +1 -0
- package/dist/tools/file/index.d.ts +8 -0
- package/dist/tools/file/index.d.ts.map +1 -0
- package/dist/tools/file/index.js +8 -0
- package/dist/tools/file/index.js.map +1 -0
- package/dist/tools/file/tools.d.ts +45 -0
- package/dist/tools/file/tools.d.ts.map +1 -0
- package/dist/tools/file/tools.js +206 -0
- package/dist/tools/file/tools.js.map +1 -0
- package/dist/tools/glob/cli.d.ts +8 -0
- package/dist/tools/glob/cli.d.ts.map +1 -0
- package/dist/tools/glob/cli.js +168 -0
- package/dist/tools/glob/cli.js.map +1 -0
- package/dist/tools/glob/constants.d.ts +7 -0
- package/dist/tools/glob/constants.d.ts.map +1 -0
- package/dist/tools/glob/constants.js +17 -0
- package/dist/tools/glob/constants.js.map +1 -0
- package/dist/tools/glob/index.d.ts +6 -0
- package/dist/tools/glob/index.d.ts.map +1 -0
- package/dist/tools/glob/index.js +5 -0
- package/dist/tools/glob/index.js.map +1 -0
- package/dist/tools/glob/tools.d.ts +15 -0
- package/dist/tools/glob/tools.d.ts.map +1 -0
- package/dist/tools/glob/tools.js +74 -0
- package/dist/tools/glob/tools.js.map +1 -0
- package/dist/tools/glob/types.d.ts +20 -0
- package/dist/tools/glob/types.d.ts.map +1 -0
- package/dist/tools/glob/types.js +2 -0
- package/dist/tools/glob/types.js.map +1 -0
- package/dist/tools/glob/utils.d.ts +3 -0
- package/dist/tools/glob/utils.d.ts.map +1 -0
- package/dist/tools/glob/utils.js +20 -0
- package/dist/tools/glob/utils.js.map +1 -0
- package/dist/tools/grep/cli.d.ts +4 -0
- package/dist/tools/grep/cli.d.ts.map +1 -0
- package/dist/tools/grep/cli.js +224 -0
- package/dist/tools/grep/cli.js.map +1 -0
- package/dist/tools/grep/constants.d.ts +19 -0
- package/dist/tools/grep/constants.d.ts.map +1 -0
- package/dist/tools/grep/constants.js +115 -0
- package/dist/tools/grep/constants.js.map +1 -0
- package/dist/tools/grep/downloader.d.ts +3 -0
- package/dist/tools/grep/downloader.d.ts.map +1 -0
- package/dist/tools/grep/downloader.js +164 -0
- package/dist/tools/grep/downloader.js.map +1 -0
- package/dist/tools/grep/index.d.ts +7 -0
- package/dist/tools/grep/index.d.ts.map +1 -0
- package/dist/tools/grep/index.js +6 -0
- package/dist/tools/grep/index.js.map +1 -0
- package/dist/tools/grep/tools.d.ts +19 -0
- package/dist/tools/grep/tools.d.ts.map +1 -0
- package/dist/tools/grep/tools.js +82 -0
- package/dist/tools/grep/tools.js.map +1 -0
- package/dist/tools/grep/types.d.ts +37 -0
- package/dist/tools/grep/types.d.ts.map +1 -0
- package/dist/tools/grep/types.js +2 -0
- package/dist/tools/grep/types.js.map +1 -0
- package/dist/tools/grep/utils.d.ts +4 -0
- package/dist/tools/grep/utils.d.ts.map +1 -0
- package/dist/tools/grep/utils.js +41 -0
- package/dist/tools/grep/utils.js.map +1 -0
- package/dist/tools/index.d.ts +21 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +33 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/model-retry.d.ts +54 -0
- package/dist/tools/model-retry.d.ts.map +1 -0
- package/dist/tools/model-retry.js +110 -0
- package/dist/tools/model-retry.js.map +1 -0
- package/dist/tools/plan/constants.d.ts +18 -0
- package/dist/tools/plan/constants.d.ts.map +1 -0
- package/dist/tools/plan/constants.js +13 -0
- package/dist/tools/plan/constants.js.map +1 -0
- package/dist/tools/plan/index.d.ts +5 -0
- package/dist/tools/plan/index.d.ts.map +1 -0
- package/dist/tools/plan/index.js +7 -0
- package/dist/tools/plan/index.js.map +1 -0
- package/dist/tools/plan/tools.d.ts +16 -0
- package/dist/tools/plan/tools.d.ts.map +1 -0
- package/dist/tools/plan/tools.js +217 -0
- package/dist/tools/plan/tools.js.map +1 -0
- package/dist/tools/plan/types.d.ts +75 -0
- package/dist/tools/plan/types.d.ts.map +1 -0
- package/dist/tools/plan/types.js +16 -0
- package/dist/tools/plan/types.js.map +1 -0
- package/dist/tools/plan/utils.d.ts +9 -0
- package/dist/tools/plan/utils.d.ts.map +1 -0
- package/dist/tools/plan/utils.js +27 -0
- package/dist/tools/plan/utils.js.map +1 -0
- package/dist/tools/progress/index.d.ts +53 -0
- package/dist/tools/progress/index.d.ts.map +1 -0
- package/dist/tools/progress/index.js +144 -0
- package/dist/tools/progress/index.js.map +1 -0
- package/dist/tools/provider.d.ts +97 -0
- package/dist/tools/provider.d.ts.map +1 -0
- package/dist/tools/provider.js +178 -0
- package/dist/tools/provider.js.map +1 -0
- package/dist/tools/search-skills.d.ts +44 -0
- package/dist/tools/search-skills.d.ts.map +1 -0
- package/dist/tools/search-skills.js +134 -0
- package/dist/tools/search-skills.js.map +1 -0
- package/dist/tools/shell/background.d.ts +38 -0
- package/dist/tools/shell/background.d.ts.map +1 -0
- package/dist/tools/shell/background.js +229 -0
- package/dist/tools/shell/background.js.map +1 -0
- package/dist/tools/shell/constants.d.ts +10 -0
- package/dist/tools/shell/constants.d.ts.map +1 -0
- package/dist/tools/shell/constants.js +55 -0
- package/dist/tools/shell/constants.js.map +1 -0
- package/dist/tools/shell/index.d.ts +7 -0
- package/dist/tools/shell/index.d.ts.map +1 -0
- package/dist/tools/shell/index.js +5 -0
- package/dist/tools/shell/index.js.map +1 -0
- package/dist/tools/shell/tools.d.ts +22 -0
- package/dist/tools/shell/tools.d.ts.map +1 -0
- package/dist/tools/shell/tools.js +70 -0
- package/dist/tools/shell/tools.js.map +1 -0
- package/dist/tools/shell/types.d.ts +30 -0
- package/dist/tools/shell/types.d.ts.map +1 -0
- package/dist/tools/shell/types.js +10 -0
- package/dist/tools/shell/types.js.map +1 -0
- package/dist/tools/shell/utils.d.ts +7 -0
- package/dist/tools/shell/utils.d.ts.map +1 -0
- package/dist/tools/shell/utils.js +26 -0
- package/dist/tools/shell/utils.js.map +1 -0
- package/dist/tools/spawn-agent/index.d.ts +96 -0
- package/dist/tools/spawn-agent/index.d.ts.map +1 -0
- package/dist/tools/spawn-agent/index.js +168 -0
- package/dist/tools/spawn-agent/index.js.map +1 -0
- package/dist/tools/utils/errors.d.ts +21 -0
- package/dist/tools/utils/errors.d.ts.map +1 -0
- package/dist/tools/utils/errors.js +29 -0
- package/dist/tools/utils/errors.js.map +1 -0
- package/dist/tools/utils/shell.d.ts +23 -0
- package/dist/tools/utils/shell.d.ts.map +1 -0
- package/dist/tools/utils/shell.js +99 -0
- package/dist/tools/utils/shell.js.map +1 -0
- package/dist/tools/utils/tool-result.d.ts +6 -0
- package/dist/tools/utils/tool-result.d.ts.map +1 -0
- package/dist/tools/utils/tool-result.js +22 -0
- package/dist/tools/utils/tool-result.js.map +1 -0
- package/dist/types/agent.d.ts +218 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +6 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/lifecycle.d.ts +218 -0
- package/dist/types/lifecycle.d.ts.map +1 -0
- package/dist/types/lifecycle.js +99 -0
- package/dist/types/lifecycle.js.map +1 -0
- package/dist/types/streaming.d.ts +120 -0
- package/dist/types/streaming.d.ts.map +1 -0
- package/dist/types/streaming.js +6 -0
- package/dist/types/streaming.js.map +1 -0
- package/dist/usage-limits.d.ts +63 -0
- package/dist/usage-limits.d.ts.map +1 -0
- package/dist/usage-limits.js +88 -0
- package/dist/usage-limits.js.map +1 -0
- package/dist/utils/logger.d.ts +35 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +149 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/workflow/builders/adapt.d.ts +20 -0
- package/dist/workflow/builders/adapt.d.ts.map +1 -0
- package/dist/workflow/builders/adapt.js +33 -0
- package/dist/workflow/builders/adapt.js.map +1 -0
- package/dist/workflow/builders/index.d.ts +8 -0
- package/dist/workflow/builders/index.d.ts.map +1 -0
- package/dist/workflow/builders/index.js +7 -0
- package/dist/workflow/builders/index.js.map +1 -0
- package/dist/workflow/builders/parallel.d.ts +25 -0
- package/dist/workflow/builders/parallel.d.ts.map +1 -0
- package/dist/workflow/builders/parallel.js +60 -0
- package/dist/workflow/builders/parallel.js.map +1 -0
- package/dist/workflow/builders/pipeline.d.ts +22 -0
- package/dist/workflow/builders/pipeline.d.ts.map +1 -0
- package/dist/workflow/builders/pipeline.js +48 -0
- package/dist/workflow/builders/pipeline.js.map +1 -0
- package/dist/workflow/builders/types.d.ts +54 -0
- package/dist/workflow/builders/types.d.ts.map +1 -0
- package/dist/workflow/builders/types.js +5 -0
- package/dist/workflow/builders/types.js.map +1 -0
- package/dist/workflow/durable-agent.d.ts +128 -0
- package/dist/workflow/durable-agent.d.ts.map +1 -0
- package/dist/workflow/durable-agent.js +323 -0
- package/dist/workflow/durable-agent.js.map +1 -0
- package/dist/workflow/durable-tool.d.ts +103 -0
- package/dist/workflow/durable-tool.d.ts.map +1 -0
- package/dist/workflow/durable-tool.js +173 -0
- package/dist/workflow/durable-tool.js.map +1 -0
- package/dist/workflow/hooks.d.ts +318 -0
- package/dist/workflow/hooks.d.ts.map +1 -0
- package/dist/workflow/hooks.js +629 -0
- package/dist/workflow/hooks.js.map +1 -0
- package/dist/workflow/index.d.ts +17 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +24 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/schedulers.d.ts +231 -0
- package/dist/workflow/schedulers.d.ts.map +1 -0
- package/dist/workflow/schedulers.js +250 -0
- package/dist/workflow/schedulers.js.map +1 -0
- package/dist/workflow/team/create-team.d.ts +34 -0
- package/dist/workflow/team/create-team.d.ts.map +1 -0
- package/dist/workflow/team/create-team.js +242 -0
- package/dist/workflow/team/create-team.js.map +1 -0
- package/dist/workflow/team/index.d.ts +9 -0
- package/dist/workflow/team/index.d.ts.map +1 -0
- package/dist/workflow/team/index.js +8 -0
- package/dist/workflow/team/index.js.map +1 -0
- package/dist/workflow/team/machines.d.ts +152 -0
- package/dist/workflow/team/machines.d.ts.map +1 -0
- package/dist/workflow/team/machines.js +197 -0
- package/dist/workflow/team/machines.js.map +1 -0
- package/dist/workflow/team/task-board.d.ts +47 -0
- package/dist/workflow/team/task-board.d.ts.map +1 -0
- package/dist/workflow/team/task-board.js +111 -0
- package/dist/workflow/team/task-board.js.map +1 -0
- package/dist/workflow/team/tools.d.ts +66 -0
- package/dist/workflow/team/tools.d.ts.map +1 -0
- package/dist/workflow/team/tools.js +100 -0
- package/dist/workflow/team/tools.js.map +1 -0
- package/dist/workflow/team/types.d.ts +109 -0
- package/dist/workflow/team/types.d.ts.map +1 -0
- package/dist/workflow/team/types.js +5 -0
- package/dist/workflow/team/types.js.map +1 -0
- package/dist/workflow/templates.d.ts +71 -0
- package/dist/workflow/templates.d.ts.map +1 -0
- package/dist/workflow/templates.js +132 -0
- package/dist/workflow/templates.js.map +1 -0
- package/dist/workflow/utils.d.ts +29 -0
- package/dist/workflow/utils.d.ts.map +1 -0
- package/dist/workflow/utils.js +84 -0
- package/dist/workflow/utils.js.map +1 -0
- package/dist/wrappers/best-of-n.d.ts +69 -0
- package/dist/wrappers/best-of-n.d.ts.map +1 -0
- package/dist/wrappers/best-of-n.js +242 -0
- package/dist/wrappers/best-of-n.js.map +1 -0
- package/package.json +101 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { tool } from 'ai';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { createLogger } from '@agntk/logger';
|
|
4
|
+
import { getToolConfig } from '../../config/index.js';
|
|
5
|
+
import { runRg } from './cli.js';
|
|
6
|
+
import { formatGrepResult } from './utils.js';
|
|
7
|
+
import { success, error } from '../utils/tool-result.js';
|
|
8
|
+
const log = createLogger('@agntk/core:grep');
|
|
9
|
+
// Get config values with fallbacks
|
|
10
|
+
function getGrepConfig() {
|
|
11
|
+
const config = getToolConfig('grep');
|
|
12
|
+
return {
|
|
13
|
+
timeout: config.timeout ?? 60_000,
|
|
14
|
+
maxContext: config.maxContext ?? 10,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const grepInputSchema = z.object({
|
|
18
|
+
pattern: z.string().describe('Regex pattern to search for in file contents'),
|
|
19
|
+
include: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('File pattern to include (e.g., "*.ts", "*.{js,jsx}")'),
|
|
23
|
+
path: z
|
|
24
|
+
.string()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Directory to search in. Defaults to current working directory.'),
|
|
27
|
+
context: z
|
|
28
|
+
.number()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('Number of context lines to show around matches'),
|
|
31
|
+
caseSensitive: z
|
|
32
|
+
.boolean()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('Enable case-sensitive matching (default: smart case)'),
|
|
35
|
+
wholeWord: z
|
|
36
|
+
.boolean()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe('Match whole words only'),
|
|
39
|
+
});
|
|
40
|
+
export const grepTool = tool({
|
|
41
|
+
description: 'Fast content search. ' +
|
|
42
|
+
'Uses ripgrep when available, falls back to grep. ' +
|
|
43
|
+
'Supports regex patterns and file filtering. ' +
|
|
44
|
+
'Returns file paths with line numbers and matching content.',
|
|
45
|
+
inputSchema: grepInputSchema,
|
|
46
|
+
execute: async (args) => {
|
|
47
|
+
const config = getGrepConfig();
|
|
48
|
+
log.debug('grep execute', { pattern: args.pattern, path: args.path, include: args.include });
|
|
49
|
+
try {
|
|
50
|
+
const result = await runRg({
|
|
51
|
+
pattern: args.pattern,
|
|
52
|
+
paths: args.path ? [args.path] : undefined,
|
|
53
|
+
globs: args.include ? [args.include] : undefined,
|
|
54
|
+
context: Math.min(args.context ?? 2, config.maxContext),
|
|
55
|
+
caseSensitive: args.caseSensitive,
|
|
56
|
+
wholeWord: args.wholeWord,
|
|
57
|
+
timeout: config.timeout,
|
|
58
|
+
});
|
|
59
|
+
if (result.error) {
|
|
60
|
+
log.warn('grep error', { pattern: args.pattern, error: result.error });
|
|
61
|
+
return error(result.error);
|
|
62
|
+
}
|
|
63
|
+
const output = formatGrepResult(result);
|
|
64
|
+
log.info('grep complete', { pattern: args.pattern, matches: result.totalMatches, files: result.filesSearched });
|
|
65
|
+
return success({
|
|
66
|
+
output,
|
|
67
|
+
matches: result.matches,
|
|
68
|
+
totalMatches: result.totalMatches,
|
|
69
|
+
filesSearched: result.filesSearched,
|
|
70
|
+
truncated: result.truncated,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
log.error('grep failed', { pattern: args.pattern, error: err });
|
|
75
|
+
return error(err instanceof Error ? err.message : String(err));
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
export function createGrepTool() {
|
|
80
|
+
return { grep: grepTool };
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/tools/grep/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,GAAG,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAE7C,mCAAmC;AACnC,SAAS,aAAa;IACpB,MAAM,MAAM,GAAG,aAAa,CAGzB,MAAM,CAAC,CAAC;IACX,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,MAAM;QACjC,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,EAAE;KACpC,CAAC;AACJ,CAAC;AAED,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,OAAO,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AC;QACjE,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,UAAU,cAAc;IAC5B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface GrepMatch {
|
|
2
|
+
file: string;
|
|
3
|
+
line: number;
|
|
4
|
+
column?: number;
|
|
5
|
+
text: string;
|
|
6
|
+
}
|
|
7
|
+
export interface GrepResult {
|
|
8
|
+
matches: GrepMatch[];
|
|
9
|
+
totalMatches: number;
|
|
10
|
+
filesSearched: number;
|
|
11
|
+
truncated: boolean;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GrepOptions {
|
|
15
|
+
pattern: string;
|
|
16
|
+
paths?: string[];
|
|
17
|
+
globs?: string[];
|
|
18
|
+
excludeGlobs?: string[];
|
|
19
|
+
context?: number;
|
|
20
|
+
maxDepth?: number;
|
|
21
|
+
maxFilesize?: string;
|
|
22
|
+
maxCount?: number;
|
|
23
|
+
maxColumns?: number;
|
|
24
|
+
caseSensitive?: boolean;
|
|
25
|
+
wholeWord?: boolean;
|
|
26
|
+
fixedStrings?: boolean;
|
|
27
|
+
multiline?: boolean;
|
|
28
|
+
hidden?: boolean;
|
|
29
|
+
noIgnore?: boolean;
|
|
30
|
+
fileType?: string[];
|
|
31
|
+
timeout?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface CountResult {
|
|
34
|
+
file: string;
|
|
35
|
+
count: number;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/grep/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/tools/grep/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tools/grep/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,WAAW,EAAE,MAAM,SAAS,CAAC;AAElE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAiC3D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAehE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export function formatGrepResult(result) {
|
|
2
|
+
if (result.error) {
|
|
3
|
+
return `Error: ${result.error}`;
|
|
4
|
+
}
|
|
5
|
+
if (result.matches.length === 0) {
|
|
6
|
+
return 'No matches found';
|
|
7
|
+
}
|
|
8
|
+
const lines = [];
|
|
9
|
+
lines.push(`Found ${result.totalMatches} match(es) in ${result.filesSearched} file(s)`);
|
|
10
|
+
if (result.truncated) {
|
|
11
|
+
lines.push('[Output truncated due to size limit]');
|
|
12
|
+
}
|
|
13
|
+
lines.push('');
|
|
14
|
+
const byFile = new Map();
|
|
15
|
+
for (const match of result.matches) {
|
|
16
|
+
const existing = byFile.get(match.file) || [];
|
|
17
|
+
existing.push(match);
|
|
18
|
+
byFile.set(match.file, existing);
|
|
19
|
+
}
|
|
20
|
+
for (const [file, matches] of byFile) {
|
|
21
|
+
lines.push(file);
|
|
22
|
+
for (const match of matches) {
|
|
23
|
+
lines.push(` ${match.line}: ${match.text.trim()}`);
|
|
24
|
+
}
|
|
25
|
+
lines.push('');
|
|
26
|
+
}
|
|
27
|
+
return lines.join('\n');
|
|
28
|
+
}
|
|
29
|
+
export function formatCountResult(results) {
|
|
30
|
+
if (results.length === 0) {
|
|
31
|
+
return 'No matches found';
|
|
32
|
+
}
|
|
33
|
+
const total = results.reduce((sum, r) => sum + r.count, 0);
|
|
34
|
+
const lines = [`Found ${total} match(es) in ${results.length} file(s):`, ''];
|
|
35
|
+
const sorted = [...results].sort((a, b) => b.count - a.count);
|
|
36
|
+
for (const { file, count } of sorted) {
|
|
37
|
+
lines.push(` ${count.toString().padStart(6)}: ${file}`);
|
|
38
|
+
}
|
|
39
|
+
return lines.join('\n');
|
|
40
|
+
}
|
|
41
|
+
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CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAsB;IACtD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAa,CAAC,SAAS,KAAK,iBAAiB,OAAO,CAAC,MAAM,WAAW,EAAE,EAAE,CAAC,CAAC;IAEvF,MAAM,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAE9D,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,MAAM,EAAE,CAAC;QACrC,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agntk/core - Tools Module
|
|
3
|
+
*
|
|
4
|
+
* Central export for tool factory, provider, and utilities.
|
|
5
|
+
*/
|
|
6
|
+
export { ToolFactory, defaultToolFactory, mergeToolSets, filterTools, excludeTools, getToolNames, type ToolDependencies, type ToolSet, type ToolCreator, } from './factory.js';
|
|
7
|
+
export { globTool, createGlobTool, runRgFiles, formatGlobResult, type GlobOptions, type GlobResult, type FileMatch, } from './glob/index.js';
|
|
8
|
+
export { grepTool, createGrepTool, runRg, runRgCount, formatGrepResult, formatCountResult, downloadAndInstallRipgrep, type GrepOptions, type GrepMatch, type GrepResult, type CountResult, } from './grep/index.js';
|
|
9
|
+
export { astGrepSearchTool, astGrepReplaceTool, createAstGrepTools, runSg, ensureAstGrepBinary, formatSearchResult, formatReplaceResult, type CliLanguage, type CliMatch, type SgResult, type SearchMatch, } from './ast-grep/index.js';
|
|
10
|
+
export { createShellTool, shellTool, executeShellCommand, addToAllowlist, clearAllowlist, getAllowlist, SHELL_DESCRIPTION, DEFAULT_TIMEOUT, MAX_TIMEOUT, INTERACTIVE_COMMANDS, type ShellInput, type ShellResult, } from './shell/index.js';
|
|
11
|
+
export { createPlanTool, createValidationTool, runTypeCheck, runTestCommand, MAX_PLAN_STEPS, DELEGATION_THRESHOLD, PLAN_DESCRIPTION, VALIDATION_DESCRIPTION, AVAILABLE_AGENTS, type Plan, type PlanStep, type PlanToolConfig, type ScopeAssessment, type PendingDecision, type PlanInput, type ValidationInput, type ValidationResult, } from './plan/index.js';
|
|
12
|
+
export { createDeepReasoningTool, DeepReasoningEngine, configureDeepReasoning, isDeepReasoningEnabled, getDeepReasoningEngine, resetDeepReasoningEngine, DEEP_REASONING_DESCRIPTION, UNRESTRICTED_MODE_DESCRIPTION, DEFAULT_MAX_HISTORY, DEFAULT_MAX_BRANCH_SIZE, type ThoughtData, type ReasoningResult, type DeepReasoningConfig, type DeepReasoningInput, } from './deep-reasoning/index.js';
|
|
13
|
+
export { createFileReadTool, createFileWriteTool, createFileEditTool, createFileCreateTool, createFileTools, } from './file/index.js';
|
|
14
|
+
export { createSpawnAgentTool } from './spawn-agent/index.js';
|
|
15
|
+
export { ModelRetry, wrapToolWithRetry, wrapAllToolsWithRetry, } from './model-retry.js';
|
|
16
|
+
export { createSearchSkillsTool, clearSkillsCache, type SearchSkillsToolConfig } from './search-skills.js';
|
|
17
|
+
export { createMemoryTools, type MemoryToolsOptions } from '../memory/tools.js';
|
|
18
|
+
export type { MemoryStore, MemoryConfig } from '../memory/types.js';
|
|
19
|
+
export { MarkdownMemoryStore } from '../memory/store.js';
|
|
20
|
+
export { createBrowserTool, browserTool, executeBrowserCommand, buildCommand, isBrowserCliAvailable, resetCliAvailability, browserInputSchema, BROWSER_ACTIONS, BROWSER_TOOL_DESCRIPTION, type BrowserInput, type BrowserAction, type BrowserResult, type BrowserConfig, } from './browser/index.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,WAAW,GACjB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,QAAQ,EACR,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,GACf,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACL,QAAQ,EACR,cAAc,EACd,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,EACL,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,eAAe,E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iB,CAAC;AAGtD,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,qBAAqB,EACrB,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,wBAAwB,EACxB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agntk/core - Tools Module
|
|
3
|
+
*
|
|
4
|
+
* Central export for tool factory, provider, and utilities.
|
|
5
|
+
*/
|
|
6
|
+
// Factory
|
|
7
|
+
export { ToolFactory, defaultToolFactory, mergeToolSets, filterTools, excludeTools, getToolNames, } from './factory.js';
|
|
8
|
+
// Glob Tool
|
|
9
|
+
export { globTool, createGlobTool, runRgFiles, formatGlobResult, } from './glob/index.js';
|
|
10
|
+
// Grep Tool
|
|
11
|
+
export { grepTool, createGrepTool, runRg, runRgCount, formatGrepResult, formatCountResult, downloadAndInstallRipgrep, } from './grep/index.js';
|
|
12
|
+
// AST-Grep Tool
|
|
13
|
+
export { astGrepSearchTool, astGrepReplaceTool, createAstGrepTools, runSg, ensureAstGrepBinary, formatSearchResult, formatReplaceResult, } from './ast-grep/index.js';
|
|
14
|
+
// Shell Tool
|
|
15
|
+
export { createShellTool, shellTool, executeShellCommand, addToAllowlist, clearAllowlist, getAllowlist, SHELL_DESCRIPTION, DEFAULT_TIMEOUT, MAX_TIMEOUT, INTERACTIVE_COMMANDS, } from './shell/index.js';
|
|
16
|
+
// Plan Tool
|
|
17
|
+
export { createPlanTool, createValidationTool, runTypeCheck, runTestCommand, MAX_PLAN_STEPS, DELEGATION_THRESHOLD, PLAN_DESCRIPTION, VALIDATION_DESCRIPTION, AVAILABLE_AGENTS, } from './plan/index.js';
|
|
18
|
+
// Deep Reasoning Tool
|
|
19
|
+
export { createDeepReasoningTool, DeepReasoningEngine, configureDeepReasoning, isDeepReasoningEnabled, getDeepReasoningEngine, resetDeepReasoningEngine, DEEP_REASONING_DESCRIPTION, UNRESTRICTED_MODE_DESCRIPTION, DEFAULT_MAX_HISTORY, DEFAULT_MAX_BRANCH_SIZE, } from './deep-reasoning/index.js';
|
|
20
|
+
// File Tools
|
|
21
|
+
export { createFileReadTool, createFileWriteTool, createFileEditTool, createFileCreateTool, createFileTools, } from './file/index.js';
|
|
22
|
+
// Spawn Agent Tool
|
|
23
|
+
export { createSpawnAgentTool } from './spawn-agent/index.js';
|
|
24
|
+
// Model Retry
|
|
25
|
+
export { ModelRetry, wrapToolWithRetry, wrapAllToolsWithRetry, } from './model-retry.js';
|
|
26
|
+
// Search Skills Tool
|
|
27
|
+
export { createSearchSkillsTool, clearSkillsCache } from './search-skills.js';
|
|
28
|
+
// Memory Tools
|
|
29
|
+
export { createMemoryTools } from '../memory/tools.js';
|
|
30
|
+
export { MarkdownMemoryStore } from '../memory/store.js';
|
|
31
|
+
// Browser Tool
|
|
32
|
+
export { createBrowserTool, browserTool, executeBrowserCommand, buildCommand, isBrowserCliAvailable, resetCliAvailability, browserInputSchema, BROWSER_ACTIONS, BROWSER_TOOL_DESCRIPTION, } from './browser/index.js';
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,UAAU;AACV,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,GAIb,MAAM,WAAW,CAAC;AAEnB,YAAY;AACZ,OAAO,EACL,QAAQ,EACR,cAAc,EACd,UAAU,EACV,gBAAgB,GAIjB,MAAM,QAAQ,CAAC;AAEhB,YAAY;AACZ,OAAO,EACL,QAAQ,EACR,cAAc,EACd,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,GAK1B,MAAM,QAAQ,CAAC;A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ACZ,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,wBAAwB,GAKzB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agntk/core - Model Retry
|
|
3
|
+
*
|
|
4
|
+
* Error class and tool wrapper for LLM-retryable tool errors.
|
|
5
|
+
* When a tool throws ModelRetry, the error message is fed back to
|
|
6
|
+
* the model as corrective instructions, allowing it to retry with
|
|
7
|
+
* better parameters.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Throw this error from a tool execute function to instruct the LLM
|
|
11
|
+
* to retry with corrective guidance.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* execute: async ({ query }) => {
|
|
16
|
+
* if (query.length < 3) {
|
|
17
|
+
* throw new ModelRetry('Query too short. Provide at least 3 characters.');
|
|
18
|
+
* }
|
|
19
|
+
* // ...
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class ModelRetry extends Error {
|
|
24
|
+
readonly name = "ModelRetry";
|
|
25
|
+
constructor(message: string);
|
|
26
|
+
}
|
|
27
|
+
interface ToolLike {
|
|
28
|
+
description?: string;
|
|
29
|
+
inputSchema?: unknown;
|
|
30
|
+
execute?: Function;
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Wraps a tool's execute function to catch ModelRetry errors and
|
|
35
|
+
* return corrective instructions to the model instead of failing.
|
|
36
|
+
*
|
|
37
|
+
* After maxRetries consecutive ModelRetry errors, the last error
|
|
38
|
+
* message is returned as a final failure.
|
|
39
|
+
*
|
|
40
|
+
* @param tool - An AI SDK tool definition
|
|
41
|
+
* @param maxRetries - Maximum retries per invocation (default: 3)
|
|
42
|
+
* @returns A new tool with retry-aware execution
|
|
43
|
+
*/
|
|
44
|
+
export declare function wrapToolWithRetry<T extends ToolLike>(toolDef: T, maxRetries?: number): T;
|
|
45
|
+
/**
|
|
46
|
+
* Wrap all tools in a tool set with retry handling.
|
|
47
|
+
*
|
|
48
|
+
* @param tools - Record of tool name to tool definition
|
|
49
|
+
* @param maxRetries - Maximum retries per tool per invocation
|
|
50
|
+
* @returns New tools record with retry-aware execution
|
|
51
|
+
*/
|
|
52
|
+
export declare function wrapAllToolsWithRetry<T extends Record<string, ToolLike>>(tools: T, maxRetries?: number): T;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=model-retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-retry.d.ts","sourceRoot":"","sources":["../../src/tools/model-retry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH;;;;;;;;;;;;;GAaG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,SAAkB,IAAI,gBAAgB;gBAE1B,OAAO,EAAE,MAAM;CAG5B;AAQD,UAAU,QAAQ;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,QAAQ,EAClD,OAAO,EAAE,CAAC,EACV,UAAU,GAAE,MAA4B,GACvC,CAAC,CAkDH;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACtE,KAAK,EAAE,CAAC,EACR,UAAU,GAAE,MAA4B,GACvC,CAAC,CAQH"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agntk/core - Model Retry
|
|
3
|
+
*
|
|
4
|
+
* Error class and tool wrapper for LLM-retryable tool errors.
|
|
5
|
+
* When a tool throws ModelRetry, the error message is fed back to
|
|
6
|
+
* the model as corrective instructions, allowing it to retry with
|
|
7
|
+
* better parameters.
|
|
8
|
+
*/
|
|
9
|
+
import { createLogger } from '@agntk/logger';
|
|
10
|
+
const log = createLogger('@agntk/core:model-retry');
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// ModelRetry Error
|
|
13
|
+
// ============================================================================
|
|
14
|
+
/**
|
|
15
|
+
* Throw this error from a tool execute function to instruct the LLM
|
|
16
|
+
* to retry with corrective guidance.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* execute: async ({ query }) => {
|
|
21
|
+
* if (query.length < 3) {
|
|
22
|
+
* throw new ModelRetry('Query too short. Provide at least 3 characters.');
|
|
23
|
+
* }
|
|
24
|
+
* // ...
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export class ModelRetry extends Error {
|
|
29
|
+
name = 'ModelRetry';
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(message);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// ============================================================================
|
|
35
|
+
// wrapToolWithRetry
|
|
36
|
+
// ============================================================================
|
|
37
|
+
const DEFAULT_MAX_RETRIES = 3;
|
|
38
|
+
/**
|
|
39
|
+
* Wraps a tool's execute function to catch ModelRetry errors and
|
|
40
|
+
* return corrective instructions to the model instead of failing.
|
|
41
|
+
*
|
|
42
|
+
* After maxRetries consecutive ModelRetry errors, the last error
|
|
43
|
+
* message is returned as a final failure.
|
|
44
|
+
*
|
|
45
|
+
* @param tool - An AI SDK tool definition
|
|
46
|
+
* @param maxRetries - Maximum retries per invocation (default: 3)
|
|
47
|
+
* @returns A new tool with retry-aware execution
|
|
48
|
+
*/
|
|
49
|
+
export function wrapToolWithRetry(toolDef, maxRetries = DEFAULT_MAX_RETRIES) {
|
|
50
|
+
const originalExecute = toolDef.execute;
|
|
51
|
+
if (!originalExecute)
|
|
52
|
+
return toolDef;
|
|
53
|
+
let retryCount = 0;
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
|
+
const wrappedExecute = async (...args) => {
|
|
56
|
+
try {
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
58
|
+
const result = await originalExecute(...args);
|
|
59
|
+
retryCount = 0; // Reset on success
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
if (err instanceof ModelRetry) {
|
|
64
|
+
retryCount++;
|
|
65
|
+
log.info('ModelRetry caught', {
|
|
66
|
+
message: err.message,
|
|
67
|
+
retryCount,
|
|
68
|
+
maxRetries,
|
|
69
|
+
});
|
|
70
|
+
if (retryCount > maxRetries) {
|
|
71
|
+
retryCount = 0;
|
|
72
|
+
return JSON.stringify({
|
|
73
|
+
success: false,
|
|
74
|
+
error: `Tool failed after ${String(maxRetries)} retries: ${err.message}`,
|
|
75
|
+
retryExhausted: true,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
// Return corrective instructions to the model
|
|
79
|
+
return JSON.stringify({
|
|
80
|
+
success: false,
|
|
81
|
+
error: err.message,
|
|
82
|
+
retryable: true,
|
|
83
|
+
retriesRemaining: maxRetries - retryCount,
|
|
84
|
+
instruction: `Please retry with corrected parameters. ${err.message}`,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
// Non-retryable errors pass through
|
|
88
|
+
throw err;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
return {
|
|
92
|
+
...toolDef,
|
|
93
|
+
execute: wrappedExecute,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Wrap all tools in a tool set with retry handling.
|
|
98
|
+
*
|
|
99
|
+
* @param tools - Record of tool name to tool definition
|
|
100
|
+
* @param maxRetries - Maximum retries per tool per invocation
|
|
101
|
+
* @returns New tools record with retry-aware execution
|
|
102
|
+
*/
|
|
103
|
+
export function wrapAllToolsWithRetry(tools, maxRetries = DEFAULT_MAX_RETRIES) {
|
|
104
|
+
const wrapped = {};
|
|
105
|
+
for (const [name, toolDef] of Object.entries(tools)) {
|
|
106
|
+
wrapped[name] = wrapToolWithRetry(toolDef, maxRetries);
|
|
107
|
+
}
|
|
108
|
+
return wrapped;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=model-retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-retry.js","sourceRoot":"","sources":["../../src/tools/model-retry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,GAAG,GAAG,YAAY,CAAC,yBAAyB,CAAC,CAAC;AAEpD,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACjB,IAAI,GAAG,YAAY,CAAC;IAEtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AAED,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAU9B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAU,EACV,aAAqB,mBAAmB;IAExC,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IACxC,IAAI,CAAC,eAAe;QAAE,OAAO,OAAO,CAAC;IAErC,IAAI,UAAU,GAAG,CAAC,CAAC;IAEnB,8DAA8D;IAC9D,MAAM,cAAc,GAAG,KAAK,EAAE,GAAG,IAAW,EAAoB,EAAE;QAChE,IAAI,CAAC;YACH,6DAA6D;YAC7D,MAAM,MAAM,GAAG,MAAO,eAAyD,CAAC,GAAG,IAAI,CAAC,CAAC;YACzF,UAAU,GAAG,CAAC,CAAC,CAAC,mBAAmB;YACnC,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,G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|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan tool constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const MAX_PLAN_STEPS = 100;
|
|
5
|
+
export declare const DELEGATION_THRESHOLD = 5;
|
|
6
|
+
export declare const PLAN_DESCRIPTION = "Create and track a task checklist. Actions: create (title + steps), decide (for large plans: delegate or proceed), update_status, add_step, add_note, view. For plans with 5+ steps, you MUST call decide before continuing. LIMIT: Max 100 steps.";
|
|
7
|
+
export declare const VALIDATION_DESCRIPTION = "Validate code after making changes. Checks TypeScript types, runs tests, and verifies quality.";
|
|
8
|
+
export declare const AVAILABLE_AGENTS: readonly [{
|
|
9
|
+
readonly role: "coder";
|
|
10
|
+
readonly specialization: "Production-quality code, reading codebases, testing, debugging, git operations";
|
|
11
|
+
}, {
|
|
12
|
+
readonly role: "researcher";
|
|
13
|
+
readonly specialization: "Web search, documentation retrieval, fact verification, synthesizing information";
|
|
14
|
+
}, {
|
|
15
|
+
readonly role: "analyst";
|
|
16
|
+
readonly specialization: "Data analysis, pattern recognition, statistical reasoning, presenting findings";
|
|
17
|
+
}];
|
|
18
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/tools/plan/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,eAAO,MAAM,gBAAgB,uPAA2R,CAAC;AAEzT,eAAO,MAAM,sBAAsB,mGAAmG,CAAC;AAEvI,eAAO,MAAM,gBAAgB;;;;;;;;;EAInB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan tool constants
|
|
3
|
+
*/
|
|
4
|
+
export const MAX_PLAN_STEPS = 100;
|
|
5
|
+
export const DELEGATION_THRESHOLD = 5;
|
|
6
|
+
export const PLAN_DESCRIPTION = `Create and track a task checklist. Actions: create (title + steps), decide (for large plans: delegate or proceed), update_status, add_step, add_note, view. For plans with ${DELEGATION_THRESHOLD}+ steps, you MUST call decide before continuing. LIMIT: Max ${MAX_PLAN_STEPS} steps.`;
|
|
7
|
+
export const VALIDATION_DESCRIPTION = 'Validate code after making changes. Checks TypeScript types, runs tests, and verifies quality.';
|
|
8
|
+
export const AVAILABLE_AGENTS = [
|
|
9
|
+
{ role: 'coder', specialization: 'Production-quality code, reading codebases, testing, debugging, git operations' },
|
|
10
|
+
{ role: 'researcher', specialization: 'Web search, documentation retrieval, fact verification, synthesizing information' },
|
|
11
|
+
{ role: 'analyst', specialization: 'Data analysis, pattern recognition, statistical reasoning, presenting findings' },
|
|
12
|
+
];
|
|
13
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/tools/plan/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAClC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,8KAA8K,oBAAoB,+DAA+D,cAAc,SAAS,CAAC;AAEzT,MAAM,CAAC,MAAM,sBAAsB,GAAG,gGAAgG,CAAC;AAEvI,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,gFAAgF,EAAE;IACnH,EAAE,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,kFAAkF,EAAE;IAC1H,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,gFAAgF,EAAE;CAC7G,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createPlanTool, createValidationTool, } from './tools.js';
|
|
2
|
+
export { runTypeCheck, runTestCommand } from './utils.js';
|
|
3
|
+
export type { Plan, PlanStep, PlanToolConfig, ScopeAssessment, PendingDecision, PlanInput, ValidationInput, ValidationResult, } from './types.js';
|
|
4
|
+
export { MAX_PLAN_STEPS, DELEGATION_THRESHOLD, PLAN_DESCRIPTION, VALIDATION_DESCRIPTION, AVAILABLE_AGENTS, } from './constants.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/plan/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGvD,YAAY,EACV,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,eAAe,EACf,eAAe,EACf,SAAS,EACT,eAAe,EACf,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Tool exports
|
|
2
|
+
export { createPlanTool, createValidationTool, } from './tools.js';
|
|
3
|
+
// Utility exports
|
|
4
|
+
export { runTypeCheck, runTestCommand } from './utils.js';
|
|
5
|
+
// Constant exports
|
|
6
|
+
export { MAX_PLAN_STEPS, DELEGATION_THRESHOLD, PLAN_DESCRIPTION, VALIDATION_DESCRIPTION, AVAILABLE_AGENTS, } from './constants.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/plan/index.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EACL,cAAc,EACd,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAEjB,kBAAkB;AAClB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAcvD,mBAAmB;AACnB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type PlanToolConfig } from './types.js';
|
|
2
|
+
export declare function createPlanTool(config?: PlanToolConfig): import("ai").Tool<{
|
|
3
|
+
action: "create" | "decide" | "update_status" | "add_note" | "add_step" | "view";
|
|
4
|
+
steps?: string[] | undefined;
|
|
5
|
+
title?: string | undefined;
|
|
6
|
+
status?: "pending" | "blocked" | "completed" | "in_progress" | undefined;
|
|
7
|
+
decision?: "delegate" | "proceed" | undefined;
|
|
8
|
+
stepName?: string | undefined;
|
|
9
|
+
note?: string | undefined;
|
|
10
|
+
}, string>;
|
|
11
|
+
export declare function createValidationTool(): import("ai").Tool<{
|
|
12
|
+
checkTypes?: boolean | undefined;
|
|
13
|
+
runTests?: boolean | undefined;
|
|
14
|
+
filesChanged?: string[] | undefined;
|
|
15
|
+
}, string>;
|
|
16
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/plan/tools.ts"],"names":[],"mappings":"AAWA,OAAO,EAIL,KAAK,cAAc,EAIpB,MAAM,SAAS,CAAC;AAiBjB,wBAAgB,cAAc,CAAC,MAAM,GAAE,cAAmB;;;;;;;;WAyLzD;AAED,wBAAgB,oBAAoB;;;;WA8BnC"}
|