@windagency/valora 2.0.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 +505 -0
- package/bin/mcp.js +10 -0
- package/bin/valora.js +10 -0
- package/data/agents/.gitkeep +0 -0
- package/data/agents/_meta/.gitkeep +0 -0
- package/data/agents/_meta/schema.json +352 -0
- package/data/agents/_template.md +72 -0
- package/data/agents/asserter.md +821 -0
- package/data/agents/expertises/.gitkeep +0 -0
- package/data/agents/expertises/_template/.gitkeep +0 -0
- package/data/agents/expertises/_template/registry.json +14 -0
- package/data/agents/lead.md +566 -0
- package/data/agents/platform-engineer.md +486 -0
- package/data/agents/product-manager.md +557 -0
- package/data/agents/qa.md +593 -0
- package/data/agents/registry.json +766 -0
- package/data/agents/secops-engineer.md +693 -0
- package/data/agents/software-engineer-typescript-backend.md +698 -0
- package/data/agents/software-engineer-typescript-frontend-react.md +512 -0
- package/data/agents/software-engineer-typescript-frontend.md +460 -0
- package/data/agents/software-engineer-typescript.md +371 -0
- package/data/agents/ui-ux-designer.md +534 -0
- package/data/commands/.gitkeep +0 -0
- package/data/commands/_meta/.gitkeep +0 -0
- package/data/commands/_meta/schema.json +317 -0
- package/data/commands/_template.md +65 -0
- package/data/commands/assert.md +895 -0
- package/data/commands/commit.md +1078 -0
- package/data/commands/create-backlog.md +402 -0
- package/data/commands/create-pr.md +401 -0
- package/data/commands/create-prd.md +242 -0
- package/data/commands/feedback.md +600 -0
- package/data/commands/fetch-task.md +665 -0
- package/data/commands/gather-knowledge.md +856 -0
- package/data/commands/generate-all-documentation.md +550 -0
- package/data/commands/generate-docs.md +738 -0
- package/data/commands/implement.md +511 -0
- package/data/commands/plan-architecture.md +269 -0
- package/data/commands/plan-implementation.md +312 -0
- package/data/commands/plan.md +582 -0
- package/data/commands/pre-check.md +553 -0
- package/data/commands/refine-specs.md +271 -0
- package/data/commands/refine-task.md +957 -0
- package/data/commands/registry.json +283 -0
- package/data/commands/review-code.md +680 -0
- package/data/commands/review-functional.md +235 -0
- package/data/commands/review-plan.md +546 -0
- package/data/commands/test.md +263 -0
- package/data/commands/validate-coverage.md +424 -0
- package/data/commands/validate-parallel.md +281 -0
- package/data/commands/validate-plan.md +367 -0
- package/data/config.default.json +40 -0
- package/data/external-mcp.default.json +326 -0
- package/data/hooks/enforce-modern-cli.sh +123 -0
- package/data/hooks/tests/enforce-modern-cli.test.sh +135 -0
- package/data/hooks.default.json +17 -0
- package/data/prompts/.gitkeep +0 -0
- package/data/prompts/00_generator/.gitkeep +0 -0
- package/data/prompts/00_generator/_template.md +25 -0
- package/data/prompts/00_generator/create_agent.md +97 -0
- package/data/prompts/00_generator/create_command.md +53 -0
- package/data/prompts/01_onboard/.gitkeep +0 -0
- package/data/prompts/01_onboard/analyze-clarity.md +413 -0
- package/data/prompts/01_onboard/analyze-documentation-requirements.md +543 -0
- package/data/prompts/01_onboard/analyze-patterns.md +288 -0
- package/data/prompts/01_onboard/analyze-requirements.md +809 -0
- package/data/prompts/01_onboard/collect-clarifications.md +374 -0
- package/data/prompts/01_onboard/fetch-task.md +409 -0
- package/data/prompts/01_onboard/map-dependencies.md +326 -0
- package/data/prompts/01_onboard/refine-requirements.md +638 -0
- package/data/prompts/01_onboard/refine-specifications.md +456 -0
- package/data/prompts/02_context/.gitkeep +0 -0
- package/data/prompts/02_context/analyze-change-scope.md +306 -0
- package/data/prompts/02_context/analyze-changes-for-review.md +292 -0
- package/data/prompts/02_context/analyze-codebase-changes.md +265 -0
- package/data/prompts/02_context/analyze-command-execution.md +231 -0
- package/data/prompts/02_context/analyze-commits-for-pr.md +258 -0
- package/data/prompts/02_context/analyze-functional-scope.md +380 -0
- package/data/prompts/02_context/analyze-git-branch.md +137 -0
- package/data/prompts/02_context/analyze-git-status.md +184 -0
- package/data/prompts/02_context/analyze-task-context.md +397 -0
- package/data/prompts/02_context/check-dependencies.md +394 -0
- package/data/prompts/02_context/extract-ticket-info.md +201 -0
- package/data/prompts/02_context/extract-ticket-references.md +157 -0
- package/data/prompts/02_context/gather-git-metrics.md +237 -0
- package/data/prompts/02_context/gather-validation-context.md +281 -0
- package/data/prompts/02_context/identify-completed-workflow.md +203 -0
- package/data/prompts/02_context/load-and-analyze-parallel.md +441 -0
- package/data/prompts/02_context/load-backlog.md +395 -0
- package/data/prompts/02_context/load-commit-template.md +186 -0
- package/data/prompts/02_context/load-documentation-context.md +382 -0
- package/data/prompts/02_context/load-implementation-context.md +360 -0
- package/data/prompts/02_context/load-plan-context.md +371 -0
- package/data/prompts/02_context/load-pr-template.md +198 -0
- package/data/prompts/02_context/load-prd.md +385 -0
- package/data/prompts/02_context/load-specifications.md +354 -0
- package/data/prompts/02_context/load-task.md +311 -0
- package/data/prompts/02_context/scan-codebase.md +270 -0
- package/data/prompts/02_context/understand-intent.md +145 -0
- package/data/prompts/02_context/use-modern-cli-tools.md +403 -0
- package/data/prompts/03_plan/.gitkeep +0 -0
- package/data/prompts/03_plan/assess-complexity.md +508 -0
- package/data/prompts/03_plan/assess-risks.md +677 -0
- package/data/prompts/03_plan/breakdown-implementation.md +895 -0
- package/data/prompts/03_plan/decompose-tasks.md +584 -0
- package/data/prompts/03_plan/define-architecture.md +347 -0
- package/data/prompts/03_plan/identify-dependencies.md +703 -0
- package/data/prompts/04_code/.gitkeep +0 -0
- package/data/prompts/04_code/calculate-version-bump.md +260 -0
- package/data/prompts/04_code/create-version-tag.md +321 -0
- package/data/prompts/04_code/determine-commit-strategy.md +300 -0
- package/data/prompts/04_code/determine-labels.md +380 -0
- package/data/prompts/04_code/determine-reviewers.md +324 -0
- package/data/prompts/04_code/generate-commit-messages.md +355 -0
- package/data/prompts/04_code/generate-pr-description.md +507 -0
- package/data/prompts/04_code/generate-pr-title.md +310 -0
- package/data/prompts/04_code/implement-changes.md +861 -0
- package/data/prompts/04_code/implement-tests.md +672 -0
- package/data/prompts/04_code/interactive-review.md +330 -0
- package/data/prompts/04_code/push-and-create-pr.md +435 -0
- package/data/prompts/04_code/stage-and-commit.md +424 -0
- package/data/prompts/04_code/validate-prerequisites.md +345 -0
- package/data/prompts/04_code/verify-implementation.md +705 -0
- package/data/prompts/05_review/.gitkeep +0 -0
- package/data/prompts/05_review/assess-code-quality.md +473 -0
- package/data/prompts/05_review/assess-constraints.md +368 -0
- package/data/prompts/05_review/calculate-performance-metrics.md +213 -0
- package/data/prompts/05_review/collect-user-feedback.md +236 -0
- package/data/prompts/05_review/evaluate-quality-outcomes.md +239 -0
- package/data/prompts/05_review/generate-commit-insights.md +344 -0
- package/data/prompts/05_review/identify-improvement-areas.md +275 -0
- package/data/prompts/05_review/synthesize-plan-assessment.md +778 -0
- package/data/prompts/05_review/synthesize-validation-report.md +369 -0
- package/data/prompts/05_review/validate-accessibility.md +303 -0
- package/data/prompts/05_review/validate-architecture.md +274 -0
- package/data/prompts/05_review/validate-backlog.md +620 -0
- package/data/prompts/05_review/validate-completeness.md +819 -0
- package/data/prompts/05_review/validate-documentation.md +453 -0
- package/data/prompts/05_review/validate-functional-requirements.md +432 -0
- package/data/prompts/05_review/validate-implementation-completeness.md +281 -0
- package/data/prompts/05_review/validate-maintainability.md +515 -0
- package/data/prompts/05_review/validate-performance.md +351 -0
- package/data/prompts/05_review/validate-pr-creation.md +260 -0
- package/data/prompts/05_review/validate-pr-readiness.md +315 -0
- package/data/prompts/05_review/validate-readiness.md +429 -0
- package/data/prompts/05_review/validate-risk-coverage.md +484 -0
- package/data/prompts/05_review/validate-security.md +260 -0
- package/data/prompts/05_review/validate-standards-compliance.md +204 -0
- package/data/prompts/05_review/validate-step-quality.md +445 -0
- package/data/prompts/05_review/validate-technical-feasibility.md +469 -0
- package/data/prompts/05_review/validate-test-strategy.md +556 -0
- package/data/prompts/05_review/validate-testability.md +532 -0
- package/data/prompts/05_review/validate-type-safety.md +200 -0
- package/data/prompts/05_review/verify-commits.md +388 -0
- package/data/prompts/06_test/.gitkeep +0 -0
- package/data/prompts/06_test/analyze-results.md +581 -0
- package/data/prompts/06_test/analyze-test-infrastructure.md +360 -0
- package/data/prompts/06_test/execute-tests.md +534 -0
- package/data/prompts/07_documentation/.gitkeep +0 -0
- package/data/prompts/07_documentation/apply-specification-refinement.md +304 -0
- package/data/prompts/07_documentation/apply-task-refinement.md +389 -0
- package/data/prompts/07_documentation/export-metrics.md +271 -0
- package/data/prompts/07_documentation/generate-all-domains-parallel.md +469 -0
- package/data/prompts/07_documentation/generate-backend-docs.md +322 -0
- package/data/prompts/07_documentation/generate-backlog-artifacts.md +720 -0
- package/data/prompts/07_documentation/generate-code-review-report.md +385 -0
- package/data/prompts/07_documentation/generate-feedback-report.md +299 -0
- package/data/prompts/07_documentation/generate-feedback-summary.md +164 -0
- package/data/prompts/07_documentation/generate-frontend-docs.md +309 -0
- package/data/prompts/07_documentation/generate-functional-review-report.md +410 -0
- package/data/prompts/07_documentation/generate-infrastructure-docs.md +630 -0
- package/data/prompts/07_documentation/generate-prd.md +197 -0
- package/data/prompts/07_documentation/persist-documentation.md +245 -0
- package/data/prompts/07_documentation/review-and-persist-parallel.md +459 -0
- package/data/prompts/07_documentation/update-changelog.md +399 -0
- package/data/prompts/07_documentation/update-inline-docs.md +574 -0
- package/data/prompts/07_documentation/update-knowledge-base.md +352 -0
- package/data/prompts/08_deployment/.gitkeep +0 -0
- package/data/prompts/09_refactor/.gitkeep +0 -0
- package/data/prompts/10_maintenance/.gitkeep +0 -0
- package/data/prompts/_meta/.gitkeep +0 -0
- package/data/prompts/_meta/schema.json +411 -0
- package/data/prompts/_template.md +56 -0
- package/data/prompts/registry.json +2227 -0
- package/data/templates/.gitkeep +0 -0
- package/data/templates/ASSERT_COMPLETENESS.md +121 -0
- package/data/templates/ASSERT_SECURITY.md +186 -0
- package/data/templates/ASSERT_TYPESCRIPT.md +195 -0
- package/data/templates/BACKEND_DOC.md +241 -0
- package/data/templates/CHANGELOG.md +38 -0
- package/data/templates/DOC_API_QUICK.md +273 -0
- package/data/templates/DOC_COMPONENT_QUICK.md +180 -0
- package/data/templates/DOC_EXTRACTION_CHECKLIST.md +284 -0
- package/data/templates/FRONTEND_DOC.md +253 -0
- package/data/templates/GUIDED_COMPLETION.md +38 -0
- package/data/templates/INFRASTRUCTURE_DOC.md +138 -0
- package/data/templates/PLAN_ARCHITECTURE.md +190 -0
- package/data/templates/PLAN_IMPLEMENTATION.md +302 -0
- package/data/templates/PLAN_PATTERN_AUTH.md +366 -0
- package/data/templates/PLAN_PATTERN_BACKGROUND_JOB.md +403 -0
- package/data/templates/PLAN_PATTERN_DATABASE.md +287 -0
- package/data/templates/PLAN_PATTERN_REACT_FEATURE.md +303 -0
- package/data/templates/PLAN_PATTERN_REST_API.md +322 -0
- package/data/templates/PLAN_QUALITY_CHECKLIST.md +167 -0
- package/data/templates/PRD.md +110 -0
- package/data/templates/PULL_REQUEST.md +30 -0
- package/data/templates/REVIEW_CODE_CHECKLIST.md +227 -0
- package/data/templates/TEST_COVERAGE_GATE.md +265 -0
- package/data/templates/TEST_GENERATION_REQUIREMENTS.md +437 -0
- package/data/templates/TROUBLESHOOTING.md +170 -0
- package/data/templates/USER_STORY.md +43 -0
- package/data/templates/plans/PATTERN_DATABASE_MIGRATION.md +551 -0
- package/data/templates/plans/PATTERN_REACT_COMPONENT.md +483 -0
- package/data/templates/plans/PATTERN_REST_API.md +428 -0
- package/data/templates/plans/README.md +174 -0
- package/data/templates/standards/TECHNICAL_DEFAULTS.md +724 -0
- package/dist/cleanup/coordinator.d.ts +26 -0
- package/dist/cleanup/coordinator.d.ts.map +1 -0
- package/dist/cleanup/coordinator.js +167 -0
- package/dist/cleanup/coordinator.js.map +1 -0
- package/dist/cleanup/index.d.ts +5 -0
- package/dist/cleanup/index.d.ts.map +1 -0
- package/dist/cleanup/index.js +5 -0
- package/dist/cleanup/index.js.map +1 -0
- package/dist/cli/autocomplete.d.ts +65 -0
- package/dist/cli/autocomplete.d.ts.map +1 -0
- package/dist/cli/autocomplete.js +422 -0
- package/dist/cli/autocomplete.js.map +1 -0
- package/dist/cli/command-adapter.interface.d.ts +98 -0
- package/dist/cli/command-adapter.interface.d.ts.map +1 -0
- package/dist/cli/command-adapter.interface.js +13 -0
- package/dist/cli/command-adapter.interface.js.map +1 -0
- package/dist/cli/command-error-handler.d.ts +69 -0
- package/dist/cli/command-error-handler.d.ts.map +1 -0
- package/dist/cli/command-error-handler.js +239 -0
- package/dist/cli/command-error-handler.js.map +1 -0
- package/dist/cli/command-executor.d.ts +146 -0
- package/dist/cli/command-executor.d.ts.map +1 -0
- package/dist/cli/command-executor.js +479 -0
- package/dist/cli/command-executor.js.map +1 -0
- package/dist/cli/command-palette.d.ts +56 -0
- package/dist/cli/command-palette.d.ts.map +1 -0
- package/dist/cli/command-palette.js +246 -0
- package/dist/cli/command-palette.js.map +1 -0
- package/dist/cli/command-resolver.d.ts +42 -0
- package/dist/cli/command-resolver.d.ts.map +1 -0
- package/dist/cli/command-resolver.js +140 -0
- package/dist/cli/command-resolver.js.map +1 -0
- package/dist/cli/command-suggestions.d.ts +49 -0
- package/dist/cli/command-suggestions.d.ts.map +1 -0
- package/dist/cli/command-suggestions.js +209 -0
- package/dist/cli/command-suggestions.js.map +1 -0
- package/dist/cli/command-templates.d.ts +83 -0
- package/dist/cli/command-templates.d.ts.map +1 -0
- package/dist/cli/command-templates.js +457 -0
- package/dist/cli/command-templates.js.map +1 -0
- package/dist/cli/command-validator.d.ts +78 -0
- package/dist/cli/command-validator.d.ts.map +1 -0
- package/dist/cli/command-validator.js +197 -0
- package/dist/cli/command-validator.js.map +1 -0
- package/dist/cli/command-wizard.d.ts +42 -0
- package/dist/cli/command-wizard.d.ts.map +1 -0
- package/dist/cli/command-wizard.js +328 -0
- package/dist/cli/command-wizard.js.map +1 -0
- package/dist/cli/commander-adapter.d.ts +91 -0
- package/dist/cli/commander-adapter.d.ts.map +1 -0
- package/dist/cli/commander-adapter.js +142 -0
- package/dist/cli/commander-adapter.js.map +1 -0
- package/dist/cli/commands/config.d.ts +9 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +62 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/dashboard.d.ts +9 -0
- package/dist/cli/commands/dashboard.d.ts.map +1 -0
- package/dist/cli/commands/dashboard.js +31 -0
- package/dist/cli/commands/dashboard.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +9 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +103 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/dynamic.d.ts +21 -0
- package/dist/cli/commands/dynamic.d.ts.map +1 -0
- package/dist/cli/commands/dynamic.js +516 -0
- package/dist/cli/commands/dynamic.js.map +1 -0
- package/dist/cli/commands/explore.d.ts +11 -0
- package/dist/cli/commands/explore.d.ts.map +1 -0
- package/dist/cli/commands/explore.js +815 -0
- package/dist/cli/commands/explore.js.map +1 -0
- package/dist/cli/commands/help.d.ts +9 -0
- package/dist/cli/commands/help.d.ts.map +1 -0
- package/dist/cli/commands/help.js +52 -0
- package/dist/cli/commands/help.js.map +1 -0
- package/dist/cli/commands/init.d.ts +9 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +71 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/monitoring.d.ts +11 -0
- package/dist/cli/commands/monitoring.d.ts.map +1 -0
- package/dist/cli/commands/monitoring.js +358 -0
- package/dist/cli/commands/monitoring.js.map +1 -0
- package/dist/cli/commands/session.d.ts +9 -0
- package/dist/cli/commands/session.d.ts.map +1 -0
- package/dist/cli/commands/session.js +521 -0
- package/dist/cli/commands/session.js.map +1 -0
- package/dist/cli/config-builder.d.ts +53 -0
- package/dist/cli/config-builder.d.ts.map +1 -0
- package/dist/cli/config-builder.js +150 -0
- package/dist/cli/config-builder.js.map +1 -0
- package/dist/cli/document-approval.d.ts +71 -0
- package/dist/cli/document-approval.d.ts.map +1 -0
- package/dist/cli/document-approval.js +328 -0
- package/dist/cli/document-approval.js.map +1 -0
- package/dist/cli/document-output-processor.d.ts +125 -0
- package/dist/cli/document-output-processor.d.ts.map +1 -0
- package/dist/cli/document-output-processor.js +496 -0
- package/dist/cli/document-output-processor.js.map +1 -0
- package/dist/cli/execution-coordinator.d.ts +97 -0
- package/dist/cli/execution-coordinator.d.ts.map +1 -0
- package/dist/cli/execution-coordinator.js +489 -0
- package/dist/cli/execution-coordinator.js.map +1 -0
- package/dist/cli/first-run-setup.d.ts +12 -0
- package/dist/cli/first-run-setup.d.ts.map +1 -0
- package/dist/cli/first-run-setup.js +63 -0
- package/dist/cli/first-run-setup.js.map +1 -0
- package/dist/cli/flags.d.ts +53 -0
- package/dist/cli/flags.d.ts.map +1 -0
- package/dist/cli/flags.js +60 -0
- package/dist/cli/flags.js.map +1 -0
- package/dist/cli/index.d.ts +11 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +182 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/presenters/assert-presenter.d.ts +29 -0
- package/dist/cli/presenters/assert-presenter.d.ts.map +1 -0
- package/dist/cli/presenters/assert-presenter.js +224 -0
- package/dist/cli/presenters/assert-presenter.js.map +1 -0
- package/dist/cli/presenters/base-presenter.d.ts +80 -0
- package/dist/cli/presenters/base-presenter.d.ts.map +1 -0
- package/dist/cli/presenters/base-presenter.js +124 -0
- package/dist/cli/presenters/base-presenter.js.map +1 -0
- package/dist/cli/presenters/feedback-presenter.d.ts +24 -0
- package/dist/cli/presenters/feedback-presenter.d.ts.map +1 -0
- package/dist/cli/presenters/feedback-presenter.js +144 -0
- package/dist/cli/presenters/feedback-presenter.js.map +1 -0
- package/dist/cli/presenters/fetch-task-presenter.d.ts +26 -0
- package/dist/cli/presenters/fetch-task-presenter.d.ts.map +1 -0
- package/dist/cli/presenters/fetch-task-presenter.js +122 -0
- package/dist/cli/presenters/fetch-task-presenter.js.map +1 -0
- package/dist/cli/presenters/implementation-presenter.d.ts +28 -0
- package/dist/cli/presenters/implementation-presenter.d.ts.map +1 -0
- package/dist/cli/presenters/implementation-presenter.js +148 -0
- package/dist/cli/presenters/implementation-presenter.js.map +1 -0
- package/dist/cli/presenters/index.d.ts +14 -0
- package/dist/cli/presenters/index.d.ts.map +1 -0
- package/dist/cli/presenters/index.js +14 -0
- package/dist/cli/presenters/index.js.map +1 -0
- package/dist/cli/presenters/presenter-registry.d.ts +51 -0
- package/dist/cli/presenters/presenter-registry.d.ts.map +1 -0
- package/dist/cli/presenters/presenter-registry.js +89 -0
- package/dist/cli/presenters/presenter-registry.js.map +1 -0
- package/dist/cli/presenters/review-code-presenter.d.ts +34 -0
- package/dist/cli/presenters/review-code-presenter.d.ts.map +1 -0
- package/dist/cli/presenters/review-code-presenter.js +197 -0
- package/dist/cli/presenters/review-code-presenter.js.map +1 -0
- package/dist/cli/presenters/review-plan-presenter.d.ts +26 -0
- package/dist/cli/presenters/review-plan-presenter.d.ts.map +1 -0
- package/dist/cli/presenters/review-plan-presenter.js +130 -0
- package/dist/cli/presenters/review-plan-presenter.js.map +1 -0
- package/dist/cli/provider-fallback-service.d.ts +52 -0
- package/dist/cli/provider-fallback-service.d.ts.map +1 -0
- package/dist/cli/provider-fallback-service.js +134 -0
- package/dist/cli/provider-fallback-service.js.map +1 -0
- package/dist/cli/provider-mismatch-handler.d.ts +35 -0
- package/dist/cli/provider-mismatch-handler.d.ts.map +1 -0
- package/dist/cli/provider-mismatch-handler.js +133 -0
- package/dist/cli/provider-mismatch-handler.js.map +1 -0
- package/dist/cli/provider-resolver.d.ts +84 -0
- package/dist/cli/provider-resolver.d.ts.map +1 -0
- package/dist/cli/provider-resolver.js +360 -0
- package/dist/cli/provider-resolver.js.map +1 -0
- package/dist/cli/result-presenter.d.ts +68 -0
- package/dist/cli/result-presenter.d.ts.map +1 -0
- package/dist/cli/result-presenter.js +186 -0
- package/dist/cli/result-presenter.js.map +1 -0
- package/dist/cli/session-browser.d.ts +46 -0
- package/dist/cli/session-browser.d.ts.map +1 -0
- package/dist/cli/session-browser.js +343 -0
- package/dist/cli/session-browser.js.map +1 -0
- package/dist/cli/session-cleanup-adapter.d.ts +25 -0
- package/dist/cli/session-cleanup-adapter.d.ts.map +1 -0
- package/dist/cli/session-cleanup-adapter.js +95 -0
- package/dist/cli/session-cleanup-adapter.js.map +1 -0
- package/dist/cli/session-formatter.d.ts +107 -0
- package/dist/cli/session-formatter.d.ts.map +1 -0
- package/dist/cli/session-formatter.js +411 -0
- package/dist/cli/session-formatter.js.map +1 -0
- package/dist/cli/session-manager.d.ts +68 -0
- package/dist/cli/session-manager.d.ts.map +1 -0
- package/dist/cli/session-manager.js +153 -0
- package/dist/cli/session-manager.js.map +1 -0
- package/dist/cli/session-resume.d.ts +70 -0
- package/dist/cli/session-resume.d.ts.map +1 -0
- package/dist/cli/session-resume.js +322 -0
- package/dist/cli/session-resume.js.map +1 -0
- package/dist/cli/types/cli-options.types.d.ts +54 -0
- package/dist/cli/types/cli-options.types.d.ts.map +1 -0
- package/dist/cli/types/cli-options.types.js +8 -0
- package/dist/cli/types/cli-options.types.js.map +1 -0
- package/dist/cli/types/wizard.types.d.ts +51 -0
- package/dist/cli/types/wizard.types.d.ts.map +1 -0
- package/dist/cli/types/wizard.types.js +8 -0
- package/dist/cli/types/wizard.types.js.map +1 -0
- package/dist/config/constants.d.ts +192 -0
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/constants.js +196 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +8 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/interactive-wizard.d.ts +67 -0
- package/dist/config/interactive-wizard.d.ts.map +1 -0
- package/dist/config/interactive-wizard.js +325 -0
- package/dist/config/interactive-wizard.js.map +1 -0
- package/dist/config/loader.d.ts +113 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +433 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/providers.config.d.ts +90 -0
- package/dist/config/providers.config.d.ts.map +1 -0
- package/dist/config/providers.config.js +249 -0
- package/dist/config/providers.config.js.map +1 -0
- package/dist/config/schema.d.ts +1848 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +167 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/validation-helpers.d.ts +44 -0
- package/dist/config/validation-helpers.d.ts.map +1 -0
- package/dist/config/validation-helpers.js +239 -0
- package/dist/config/validation-helpers.js.map +1 -0
- package/dist/config/wizard.d.ts +10 -0
- package/dist/config/wizard.d.ts.map +1 -0
- package/dist/config/wizard.js +11 -0
- package/dist/config/wizard.js.map +1 -0
- package/dist/di/container.d.ts +92 -0
- package/dist/di/container.d.ts.map +1 -0
- package/dist/di/container.js +349 -0
- package/dist/di/container.js.map +1 -0
- package/dist/executor/agent-loader.d.ts +62 -0
- package/dist/executor/agent-loader.d.ts.map +1 -0
- package/dist/executor/agent-loader.js +172 -0
- package/dist/executor/agent-loader.js.map +1 -0
- package/dist/executor/command-discovery.d.ts +72 -0
- package/dist/executor/command-discovery.d.ts.map +1 -0
- package/dist/executor/command-discovery.js +248 -0
- package/dist/executor/command-discovery.js.map +1 -0
- package/dist/executor/command-isolation.executor.d.ts +53 -0
- package/dist/executor/command-isolation.executor.d.ts.map +1 -0
- package/dist/executor/command-isolation.executor.js +183 -0
- package/dist/executor/command-isolation.executor.js.map +1 -0
- package/dist/executor/command-loader.d.ts +34 -0
- package/dist/executor/command-loader.d.ts.map +1 -0
- package/dist/executor/command-loader.js +93 -0
- package/dist/executor/command-loader.js.map +1 -0
- package/dist/executor/command-validation.d.ts +21 -0
- package/dist/executor/command-validation.d.ts.map +1 -0
- package/dist/executor/command-validation.js +79 -0
- package/dist/executor/command-validation.js.map +1 -0
- package/dist/executor/dry-run-cache.d.ts +155 -0
- package/dist/executor/dry-run-cache.d.ts.map +1 -0
- package/dist/executor/dry-run-cache.js +191 -0
- package/dist/executor/dry-run-cache.js.map +1 -0
- package/dist/executor/dry-run-preview.service.d.ts +101 -0
- package/dist/executor/dry-run-preview.service.d.ts.map +1 -0
- package/dist/executor/dry-run-preview.service.js +250 -0
- package/dist/executor/dry-run-preview.service.js.map +1 -0
- package/dist/executor/dry-run-strategy.d.ts +137 -0
- package/dist/executor/dry-run-strategy.d.ts.map +1 -0
- package/dist/executor/dry-run-strategy.js +511 -0
- package/dist/executor/dry-run-strategy.js.map +1 -0
- package/dist/executor/escalation-detection.service.d.ts +48 -0
- package/dist/executor/escalation-detection.service.d.ts.map +1 -0
- package/dist/executor/escalation-detection.service.js +219 -0
- package/dist/executor/escalation-detection.service.js.map +1 -0
- package/dist/executor/escalation-handler.service.d.ts +57 -0
- package/dist/executor/escalation-handler.service.d.ts.map +1 -0
- package/dist/executor/escalation-handler.service.js +265 -0
- package/dist/executor/escalation-handler.service.js.map +1 -0
- package/dist/executor/execution-context.d.ts +107 -0
- package/dist/executor/execution-context.d.ts.map +1 -0
- package/dist/executor/execution-context.js +158 -0
- package/dist/executor/execution-context.js.map +1 -0
- package/dist/executor/execution-strategy.d.ts +104 -0
- package/dist/executor/execution-strategy.d.ts.map +1 -0
- package/dist/executor/execution-strategy.js +259 -0
- package/dist/executor/execution-strategy.js.map +1 -0
- package/dist/executor/hook-execution.service.d.ts +95 -0
- package/dist/executor/hook-execution.service.d.ts.map +1 -0
- package/dist/executor/hook-execution.service.js +371 -0
- package/dist/executor/hook-execution.service.js.map +1 -0
- package/dist/executor/index.d.ts +16 -0
- package/dist/executor/index.d.ts.map +1 -0
- package/dist/executor/index.js +16 -0
- package/dist/executor/index.js.map +1 -0
- package/dist/executor/input-pre-resolver.d.ts +61 -0
- package/dist/executor/input-pre-resolver.d.ts.map +1 -0
- package/dist/executor/input-pre-resolver.js +172 -0
- package/dist/executor/input-pre-resolver.js.map +1 -0
- package/dist/executor/interactive-question-handler.service.d.ts +79 -0
- package/dist/executor/interactive-question-handler.service.d.ts.map +1 -0
- package/dist/executor/interactive-question-handler.service.js +250 -0
- package/dist/executor/interactive-question-handler.service.js.map +1 -0
- package/dist/executor/message-builder.service.d.ts +83 -0
- package/dist/executor/message-builder.service.d.ts.map +1 -0
- package/dist/executor/message-builder.service.js +211 -0
- package/dist/executor/message-builder.service.js.map +1 -0
- package/dist/executor/output-parsing.service.d.ts +169 -0
- package/dist/executor/output-parsing.service.d.ts.map +1 -0
- package/dist/executor/output-parsing.service.js +566 -0
- package/dist/executor/output-parsing.service.js.map +1 -0
- package/dist/executor/pipeline-events.d.ts +15 -0
- package/dist/executor/pipeline-events.d.ts.map +1 -0
- package/dist/executor/pipeline-events.js +15 -0
- package/dist/executor/pipeline-events.js.map +1 -0
- package/dist/executor/pipeline-validator.d.ts +29 -0
- package/dist/executor/pipeline-validator.d.ts.map +1 -0
- package/dist/executor/pipeline-validator.js +105 -0
- package/dist/executor/pipeline-validator.js.map +1 -0
- package/dist/executor/pipeline.d.ts +55 -0
- package/dist/executor/pipeline.d.ts.map +1 -0
- package/dist/executor/pipeline.js +360 -0
- package/dist/executor/pipeline.js.map +1 -0
- package/dist/executor/project-guidance-loader.d.ts +69 -0
- package/dist/executor/project-guidance-loader.d.ts.map +1 -0
- package/dist/executor/project-guidance-loader.js +528 -0
- package/dist/executor/project-guidance-loader.js.map +1 -0
- package/dist/executor/prompt-loader.d.ts +39 -0
- package/dist/executor/prompt-loader.d.ts.map +1 -0
- package/dist/executor/prompt-loader.js +172 -0
- package/dist/executor/prompt-loader.js.map +1 -0
- package/dist/executor/stage-executor.d.ts +192 -0
- package/dist/executor/stage-executor.d.ts.map +1 -0
- package/dist/executor/stage-executor.js +790 -0
- package/dist/executor/stage-executor.js.map +1 -0
- package/dist/executor/stage-output-cache.d.ts +152 -0
- package/dist/executor/stage-output-cache.d.ts.map +1 -0
- package/dist/executor/stage-output-cache.js +426 -0
- package/dist/executor/stage-output-cache.js.map +1 -0
- package/dist/executor/stage-scheduler.d.ts +20 -0
- package/dist/executor/stage-scheduler.d.ts.map +1 -0
- package/dist/executor/stage-scheduler.js +59 -0
- package/dist/executor/stage-scheduler.js.map +1 -0
- package/dist/executor/stage-validation.service.d.ts +122 -0
- package/dist/executor/stage-validation.service.d.ts.map +1 -0
- package/dist/executor/stage-validation.service.js +377 -0
- package/dist/executor/stage-validation.service.js.map +1 -0
- package/dist/executor/tool-execution.service.d.ts +289 -0
- package/dist/executor/tool-execution.service.d.ts.map +1 -0
- package/dist/executor/tool-execution.service.js +1124 -0
- package/dist/executor/tool-execution.service.js.map +1 -0
- package/dist/executor/tools/dry-run-simulator.service.d.ts +107 -0
- package/dist/executor/tools/dry-run-simulator.service.d.ts.map +1 -0
- package/dist/executor/tools/dry-run-simulator.service.js +284 -0
- package/dist/executor/tools/dry-run-simulator.service.js.map +1 -0
- package/dist/executor/tools/pending-write-approver.service.d.ts +84 -0
- package/dist/executor/tools/pending-write-approver.service.d.ts.map +1 -0
- package/dist/executor/tools/pending-write-approver.service.js +197 -0
- package/dist/executor/tools/pending-write-approver.service.js.map +1 -0
- package/dist/executor/tools/search-tools.service.d.ts +44 -0
- package/dist/executor/tools/search-tools.service.d.ts.map +1 -0
- package/dist/executor/tools/search-tools.service.js +109 -0
- package/dist/executor/tools/search-tools.service.js.map +1 -0
- package/dist/executor/tools/session-tools.service.d.ts +74 -0
- package/dist/executor/tools/session-tools.service.d.ts.map +1 -0
- package/dist/executor/tools/session-tools.service.js +278 -0
- package/dist/executor/tools/session-tools.service.js.map +1 -0
- package/dist/executor/variable-resolution.service.d.ts +77 -0
- package/dist/executor/variable-resolution.service.d.ts.map +1 -0
- package/dist/executor/variable-resolution.service.js +115 -0
- package/dist/executor/variable-resolution.service.js.map +1 -0
- package/dist/executor/variables.d.ts +89 -0
- package/dist/executor/variables.d.ts.map +1 -0
- package/dist/executor/variables.js +306 -0
- package/dist/executor/variables.js.map +1 -0
- package/dist/exploration/collaboration-coordinator.d.ts +130 -0
- package/dist/exploration/collaboration-coordinator.d.ts.map +1 -0
- package/dist/exploration/collaboration-coordinator.js +332 -0
- package/dist/exploration/collaboration-coordinator.js.map +1 -0
- package/dist/exploration/container-manager.d.ts +121 -0
- package/dist/exploration/container-manager.d.ts.map +1 -0
- package/dist/exploration/container-manager.js +390 -0
- package/dist/exploration/container-manager.js.map +1 -0
- package/dist/exploration/dashboard-controls.d.ts +24 -0
- package/dist/exploration/dashboard-controls.d.ts.map +1 -0
- package/dist/exploration/dashboard-controls.js +221 -0
- package/dist/exploration/dashboard-controls.js.map +1 -0
- package/dist/exploration/dashboard-metrics.d.ts +62 -0
- package/dist/exploration/dashboard-metrics.d.ts.map +1 -0
- package/dist/exploration/dashboard-metrics.js +154 -0
- package/dist/exploration/dashboard-metrics.js.map +1 -0
- package/dist/exploration/dashboard-ui.d.ts +22 -0
- package/dist/exploration/dashboard-ui.d.ts.map +1 -0
- package/dist/exploration/dashboard-ui.js +206 -0
- package/dist/exploration/dashboard-ui.js.map +1 -0
- package/dist/exploration/execution-modes.d.ts +120 -0
- package/dist/exploration/execution-modes.d.ts.map +1 -0
- package/dist/exploration/execution-modes.js +388 -0
- package/dist/exploration/execution-modes.js.map +1 -0
- package/dist/exploration/exploration-events.d.ts +139 -0
- package/dist/exploration/exploration-events.d.ts.map +1 -0
- package/dist/exploration/exploration-events.js +261 -0
- package/dist/exploration/exploration-events.js.map +1 -0
- package/dist/exploration/exploration-state.d.ts +102 -0
- package/dist/exploration/exploration-state.d.ts.map +1 -0
- package/dist/exploration/exploration-state.js +307 -0
- package/dist/exploration/exploration-state.js.map +1 -0
- package/dist/exploration/merge-orchestrator.d.ts +175 -0
- package/dist/exploration/merge-orchestrator.d.ts.map +1 -0
- package/dist/exploration/merge-orchestrator.js +615 -0
- package/dist/exploration/merge-orchestrator.js.map +1 -0
- package/dist/exploration/orchestrator.d.ts +95 -0
- package/dist/exploration/orchestrator.d.ts.map +1 -0
- package/dist/exploration/orchestrator.js +404 -0
- package/dist/exploration/orchestrator.js.map +1 -0
- package/dist/exploration/resource-allocator.d.ts +108 -0
- package/dist/exploration/resource-allocator.d.ts.map +1 -0
- package/dist/exploration/resource-allocator.js +244 -0
- package/dist/exploration/resource-allocator.js.map +1 -0
- package/dist/exploration/result-comparator.d.ts +110 -0
- package/dist/exploration/result-comparator.d.ts.map +1 -0
- package/dist/exploration/result-comparator.js +363 -0
- package/dist/exploration/result-comparator.js.map +1 -0
- package/dist/exploration/safety-validator.d.ts +59 -0
- package/dist/exploration/safety-validator.d.ts.map +1 -0
- package/dist/exploration/safety-validator.js +339 -0
- package/dist/exploration/safety-validator.js.map +1 -0
- package/dist/exploration/shared-volume-manager.d.ts +72 -0
- package/dist/exploration/shared-volume-manager.d.ts.map +1 -0
- package/dist/exploration/shared-volume-manager.js +303 -0
- package/dist/exploration/shared-volume-manager.js.map +1 -0
- package/dist/exploration/worktree-manager-secure.d.ts +110 -0
- package/dist/exploration/worktree-manager-secure.d.ts.map +1 -0
- package/dist/exploration/worktree-manager-secure.js +347 -0
- package/dist/exploration/worktree-manager-secure.js.map +1 -0
- package/dist/exploration/worktree-manager.d.ts +97 -0
- package/dist/exploration/worktree-manager.d.ts.map +1 -0
- package/dist/exploration/worktree-manager.js +298 -0
- package/dist/exploration/worktree-manager.js.map +1 -0
- package/dist/llm/index.d.ts +10 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +10 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/model-mapping-registry.d.ts +73 -0
- package/dist/llm/model-mapping-registry.d.ts.map +1 -0
- package/dist/llm/model-mapping-registry.js +197 -0
- package/dist/llm/model-mapping-registry.js.map +1 -0
- package/dist/llm/provider.interface.d.ts +60 -0
- package/dist/llm/provider.interface.d.ts.map +1 -0
- package/dist/llm/provider.interface.js +79 -0
- package/dist/llm/provider.interface.js.map +1 -0
- package/dist/llm/providers/anthropic.provider.d.ts +78 -0
- package/dist/llm/providers/anthropic.provider.d.ts.map +1 -0
- package/dist/llm/providers/anthropic.provider.js +456 -0
- package/dist/llm/providers/anthropic.provider.js.map +1 -0
- package/dist/llm/providers/cursor.provider.d.ts +61 -0
- package/dist/llm/providers/cursor.provider.d.ts.map +1 -0
- package/dist/llm/providers/cursor.provider.js +273 -0
- package/dist/llm/providers/cursor.provider.js.map +1 -0
- package/dist/llm/providers/google.provider.d.ts +43 -0
- package/dist/llm/providers/google.provider.d.ts.map +1 -0
- package/dist/llm/providers/google.provider.js +179 -0
- package/dist/llm/providers/google.provider.js.map +1 -0
- package/dist/llm/providers/index.d.ts +25 -0
- package/dist/llm/providers/index.d.ts.map +1 -0
- package/dist/llm/providers/index.js +28 -0
- package/dist/llm/providers/index.js.map +1 -0
- package/dist/llm/providers/openai.provider.d.ts +23 -0
- package/dist/llm/providers/openai.provider.d.ts.map +1 -0
- package/dist/llm/providers/openai.provider.js +193 -0
- package/dist/llm/providers/openai.provider.js.map +1 -0
- package/dist/llm/registry.d.ts +41 -0
- package/dist/llm/registry.d.ts.map +1 -0
- package/dist/llm/registry.js +88 -0
- package/dist/llm/registry.js.map +1 -0
- package/dist/mcp/command-discovery.service.d.ts +26 -0
- package/dist/mcp/command-discovery.service.d.ts.map +1 -0
- package/dist/mcp/command-discovery.service.js +65 -0
- package/dist/mcp/command-discovery.service.js.map +1 -0
- package/dist/mcp/context.d.ts +28 -0
- package/dist/mcp/context.d.ts.map +1 -0
- package/dist/mcp/context.js +34 -0
- package/dist/mcp/context.js.map +1 -0
- package/dist/mcp/external-client/tool-proxy.d.ts +103 -0
- package/dist/mcp/external-client/tool-proxy.d.ts.map +1 -0
- package/dist/mcp/external-client/tool-proxy.js +291 -0
- package/dist/mcp/external-client/tool-proxy.js.map +1 -0
- package/dist/mcp/external-mcp-integrator.d.ts +70 -0
- package/dist/mcp/external-mcp-integrator.d.ts.map +1 -0
- package/dist/mcp/external-mcp-integrator.js +161 -0
- package/dist/mcp/external-mcp-integrator.js.map +1 -0
- package/dist/mcp/mcp-approval-cache.service.d.ts +88 -0
- package/dist/mcp/mcp-approval-cache.service.d.ts.map +1 -0
- package/dist/mcp/mcp-approval-cache.service.js +257 -0
- package/dist/mcp/mcp-approval-cache.service.js.map +1 -0
- package/dist/mcp/mcp-approval-workflow.d.ts +92 -0
- package/dist/mcp/mcp-approval-workflow.d.ts.map +1 -0
- package/dist/mcp/mcp-approval-workflow.js +346 -0
- package/dist/mcp/mcp-approval-workflow.js.map +1 -0
- package/dist/mcp/mcp-audit-logger.service.d.ts +90 -0
- package/dist/mcp/mcp-audit-logger.service.d.ts.map +1 -0
- package/dist/mcp/mcp-audit-logger.service.js +264 -0
- package/dist/mcp/mcp-audit-logger.service.js.map +1 -0
- package/dist/mcp/mcp-availability.service.d.ts +84 -0
- package/dist/mcp/mcp-availability.service.d.ts.map +1 -0
- package/dist/mcp/mcp-availability.service.js +177 -0
- package/dist/mcp/mcp-availability.service.js.map +1 -0
- package/dist/mcp/mcp-client-manager.service.d.ts +103 -0
- package/dist/mcp/mcp-client-manager.service.d.ts.map +1 -0
- package/dist/mcp/mcp-client-manager.service.js +380 -0
- package/dist/mcp/mcp-client-manager.service.js.map +1 -0
- package/dist/mcp/mcp-tool-handler.d.ts +88 -0
- package/dist/mcp/mcp-tool-handler.d.ts.map +1 -0
- package/dist/mcp/mcp-tool-handler.js +207 -0
- package/dist/mcp/mcp-tool-handler.js.map +1 -0
- package/dist/mcp/request-handler.d.ts +44 -0
- package/dist/mcp/request-handler.d.ts.map +1 -0
- package/dist/mcp/request-handler.js +282 -0
- package/dist/mcp/request-handler.js.map +1 -0
- package/dist/mcp/sampling-service.d.ts +36 -0
- package/dist/mcp/sampling-service.d.ts.map +1 -0
- package/dist/mcp/sampling-service.js +147 -0
- package/dist/mcp/sampling-service.js.map +1 -0
- package/dist/mcp/server-manager.d.ts +36 -0
- package/dist/mcp/server-manager.d.ts.map +1 -0
- package/dist/mcp/server-manager.js +113 -0
- package/dist/mcp/server-manager.js.map +1 -0
- package/dist/mcp/server.d.ts +45 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +269 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/shutdown-manager.d.ts +24 -0
- package/dist/mcp/shutdown-manager.d.ts.map +1 -0
- package/dist/mcp/shutdown-manager.js +59 -0
- package/dist/mcp/shutdown-manager.js.map +1 -0
- package/dist/mcp/system-monitor.d.ts +38 -0
- package/dist/mcp/system-monitor.d.ts.map +1 -0
- package/dist/mcp/system-monitor.js +80 -0
- package/dist/mcp/system-monitor.js.map +1 -0
- package/dist/mcp/tool-mapping.service.d.ts +35 -0
- package/dist/mcp/tool-mapping.service.d.ts.map +1 -0
- package/dist/mcp/tool-mapping.service.js +91 -0
- package/dist/mcp/tool-mapping.service.js.map +1 -0
- package/dist/mcp/tool-registry.d.ts +29 -0
- package/dist/mcp/tool-registry.d.ts.map +1 -0
- package/dist/mcp/tool-registry.js +52 -0
- package/dist/mcp/tool-registry.js.map +1 -0
- package/dist/mcp/types.d.ts +33 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +7 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/output/activity-feed.d.ts +62 -0
- package/dist/output/activity-feed.d.ts.map +1 -0
- package/dist/output/activity-feed.js +170 -0
- package/dist/output/activity-feed.js.map +1 -0
- package/dist/output/box-formatter.d.ts +149 -0
- package/dist/output/box-formatter.d.ts.map +1 -0
- package/dist/output/box-formatter.js +239 -0
- package/dist/output/box-formatter.js.map +1 -0
- package/dist/output/cleanup-scheduler.d.ts +26 -0
- package/dist/output/cleanup-scheduler.d.ts.map +1 -0
- package/dist/output/cleanup-scheduler.js +115 -0
- package/dist/output/cleanup-scheduler.js.map +1 -0
- package/dist/output/color-adapter.d.ts +56 -0
- package/dist/output/color-adapter.d.ts.map +1 -0
- package/dist/output/color-adapter.interface.d.ts +139 -0
- package/dist/output/color-adapter.interface.d.ts.map +1 -0
- package/dist/output/color-adapter.interface.js +49 -0
- package/dist/output/color-adapter.interface.js.map +1 -0
- package/dist/output/color-adapter.js +163 -0
- package/dist/output/color-adapter.js.map +1 -0
- package/dist/output/console-output.d.ts +156 -0
- package/dist/output/console-output.d.ts.map +1 -0
- package/dist/output/console-output.js +264 -0
- package/dist/output/console-output.js.map +1 -0
- package/dist/output/diagnostic-formatter.d.ts +62 -0
- package/dist/output/diagnostic-formatter.d.ts.map +1 -0
- package/dist/output/diagnostic-formatter.js +186 -0
- package/dist/output/diagnostic-formatter.js.map +1 -0
- package/dist/output/header-formatter.d.ts +147 -0
- package/dist/output/header-formatter.d.ts.map +1 -0
- package/dist/output/header-formatter.js +232 -0
- package/dist/output/header-formatter.js.map +1 -0
- package/dist/output/help-formatter.d.ts +79 -0
- package/dist/output/help-formatter.d.ts.map +1 -0
- package/dist/output/help-formatter.js +358 -0
- package/dist/output/help-formatter.js.map +1 -0
- package/dist/output/index.d.ts +12 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +12 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/logger.d.ts +113 -0
- package/dist/output/logger.d.ts.map +1 -0
- package/dist/output/logger.js +461 -0
- package/dist/output/logger.js.map +1 -0
- package/dist/output/markdown.d.ts +35 -0
- package/dist/output/markdown.d.ts.map +1 -0
- package/dist/output/markdown.js +188 -0
- package/dist/output/markdown.js.map +1 -0
- package/dist/output/multi-stage-progress.d.ts +77 -0
- package/dist/output/multi-stage-progress.d.ts.map +1 -0
- package/dist/output/multi-stage-progress.js +173 -0
- package/dist/output/multi-stage-progress.js.map +1 -0
- package/dist/output/pipeline-emitter.d.ts +85 -0
- package/dist/output/pipeline-emitter.d.ts.map +1 -0
- package/dist/output/pipeline-emitter.js +202 -0
- package/dist/output/pipeline-emitter.js.map +1 -0
- package/dist/output/processing-feedback.d.ts +299 -0
- package/dist/output/processing-feedback.d.ts.map +1 -0
- package/dist/output/processing-feedback.js +1032 -0
- package/dist/output/processing-feedback.js.map +1 -0
- package/dist/output/progress-formatter.d.ts +68 -0
- package/dist/output/progress-formatter.d.ts.map +1 -0
- package/dist/output/progress-formatter.js +210 -0
- package/dist/output/progress-formatter.js.map +1 -0
- package/dist/output/progress.d.ts +92 -0
- package/dist/output/progress.d.ts.map +1 -0
- package/dist/output/progress.js +256 -0
- package/dist/output/progress.js.map +1 -0
- package/dist/output/retention-manager.d.ts +62 -0
- package/dist/output/retention-manager.d.ts.map +1 -0
- package/dist/output/retention-manager.js +401 -0
- package/dist/output/retention-manager.js.map +1 -0
- package/dist/output/terminal-utils.d.ts +50 -0
- package/dist/output/terminal-utils.d.ts.map +1 -0
- package/dist/output/terminal-utils.js +103 -0
- package/dist/output/terminal-utils.js.map +1 -0
- package/dist/output/verbose-formatter.d.ts +91 -0
- package/dist/output/verbose-formatter.d.ts.map +1 -0
- package/dist/output/verbose-formatter.js +182 -0
- package/dist/output/verbose-formatter.js.map +1 -0
- package/dist/output/welcome-banner.d.ts +16 -0
- package/dist/output/welcome-banner.d.ts.map +1 -0
- package/dist/output/welcome-banner.js +80 -0
- package/dist/output/welcome-banner.js.map +1 -0
- package/dist/package.json +166 -0
- package/dist/services/agent-capability-matcher.service.d.ts +89 -0
- package/dist/services/agent-capability-matcher.service.d.ts.map +1 -0
- package/dist/services/agent-capability-matcher.service.js +310 -0
- package/dist/services/agent-capability-matcher.service.js.map +1 -0
- package/dist/services/agent-capability-registry.service.d.ts +93 -0
- package/dist/services/agent-capability-registry.service.d.ts.map +1 -0
- package/dist/services/agent-capability-registry.service.js +242 -0
- package/dist/services/agent-capability-registry.service.js.map +1 -0
- package/dist/services/agent-selection-analytics.service.d.ts +89 -0
- package/dist/services/agent-selection-analytics.service.d.ts.map +1 -0
- package/dist/services/agent-selection-analytics.service.js +180 -0
- package/dist/services/agent-selection-analytics.service.js.map +1 -0
- package/dist/services/context-analyzer.service.d.ts +56 -0
- package/dist/services/context-analyzer.service.d.ts.map +1 -0
- package/dist/services/context-analyzer.service.js +323 -0
- package/dist/services/context-analyzer.service.js.map +1 -0
- package/dist/services/diagnostics.service.d.ts +40 -0
- package/dist/services/diagnostics.service.d.ts.map +1 -0
- package/dist/services/diagnostics.service.js +245 -0
- package/dist/services/diagnostics.service.js.map +1 -0
- package/dist/services/document-detector.service.d.ts +89 -0
- package/dist/services/document-detector.service.d.ts.map +1 -0
- package/dist/services/document-detector.service.js +500 -0
- package/dist/services/document-detector.service.js.map +1 -0
- package/dist/services/document-path-resolver.service.d.ts +68 -0
- package/dist/services/document-path-resolver.service.d.ts.map +1 -0
- package/dist/services/document-path-resolver.service.js +155 -0
- package/dist/services/document-path-resolver.service.js.map +1 -0
- package/dist/services/document-template.service.d.ts +83 -0
- package/dist/services/document-template.service.d.ts.map +1 -0
- package/dist/services/document-template.service.js +317 -0
- package/dist/services/document-template.service.js.map +1 -0
- package/dist/services/document-writer.service.d.ts +42 -0
- package/dist/services/document-writer.service.d.ts.map +1 -0
- package/dist/services/document-writer.service.js +155 -0
- package/dist/services/document-writer.service.js.map +1 -0
- package/dist/services/dynamic-agent-resolver.service.d.ts +81 -0
- package/dist/services/dynamic-agent-resolver.service.d.ts.map +1 -0
- package/dist/services/dynamic-agent-resolver.service.js +267 -0
- package/dist/services/dynamic-agent-resolver.service.js.map +1 -0
- package/dist/services/git-stash-protection.service.d.ts +76 -0
- package/dist/services/git-stash-protection.service.d.ts.map +1 -0
- package/dist/services/git-stash-protection.service.js +190 -0
- package/dist/services/git-stash-protection.service.js.map +1 -0
- package/dist/services/idempotency-store.service.d.ts +101 -0
- package/dist/services/idempotency-store.service.d.ts.map +1 -0
- package/dist/services/idempotency-store.service.js +418 -0
- package/dist/services/idempotency-store.service.js.map +1 -0
- package/dist/services/index.d.ts +17 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +17 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/task-classifier.service.d.ts +42 -0
- package/dist/services/task-classifier.service.d.ts.map +1 -0
- package/dist/services/task-classifier.service.js +211 -0
- package/dist/services/task-classifier.service.js.map +1 -0
- package/dist/session/archive-adapter.d.ts +26 -0
- package/dist/session/archive-adapter.d.ts.map +1 -0
- package/dist/session/archive-adapter.interface.d.ts +59 -0
- package/dist/session/archive-adapter.interface.d.ts.map +1 -0
- package/dist/session/archive-adapter.interface.js +11 -0
- package/dist/session/archive-adapter.interface.js.map +1 -0
- package/dist/session/archive-adapter.js +72 -0
- package/dist/session/archive-adapter.js.map +1 -0
- package/dist/session/cleanup-scheduler.d.ts +22 -0
- package/dist/session/cleanup-scheduler.d.ts.map +1 -0
- package/dist/session/cleanup-scheduler.js +96 -0
- package/dist/session/cleanup-scheduler.js.map +1 -0
- package/dist/session/context.d.ts +109 -0
- package/dist/session/context.d.ts.map +1 -0
- package/dist/session/context.js +253 -0
- package/dist/session/context.js.map +1 -0
- package/dist/session/index.d.ts +9 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +9 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/lifecycle.d.ts +87 -0
- package/dist/session/lifecycle.d.ts.map +1 -0
- package/dist/session/lifecycle.js +301 -0
- package/dist/session/lifecycle.js.map +1 -0
- package/dist/session/retention-manager.d.ts +55 -0
- package/dist/session/retention-manager.d.ts.map +1 -0
- package/dist/session/retention-manager.js +299 -0
- package/dist/session/retention-manager.js.map +1 -0
- package/dist/session/retention-policy-runner.d.ts +19 -0
- package/dist/session/retention-policy-runner.d.ts.map +1 -0
- package/dist/session/retention-policy-runner.js +103 -0
- package/dist/session/retention-policy-runner.js.map +1 -0
- package/dist/session/session-cleanup-ui.d.ts +101 -0
- package/dist/session/session-cleanup-ui.d.ts.map +1 -0
- package/dist/session/session-cleanup-ui.js +339 -0
- package/dist/session/session-cleanup-ui.js.map +1 -0
- package/dist/session/session-exporter.d.ts +61 -0
- package/dist/session/session-exporter.d.ts.map +1 -0
- package/dist/session/session-exporter.js +274 -0
- package/dist/session/session-exporter.js.map +1 -0
- package/dist/session/store.d.ts +138 -0
- package/dist/session/store.d.ts.map +1 -0
- package/dist/session/store.js +430 -0
- package/dist/session/store.js.map +1 -0
- package/dist/session/types.d.ts +22 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +7 -0
- package/dist/session/types.js.map +1 -0
- package/dist/tsconfig.json +18 -0
- package/dist/types/agent.types.d.ts +110 -0
- package/dist/types/agent.types.d.ts.map +1 -0
- package/dist/types/agent.types.js +5 -0
- package/dist/types/agent.types.js.map +1 -0
- package/dist/types/cli.types.d.ts +86 -0
- package/dist/types/cli.types.d.ts.map +1 -0
- package/dist/types/cli.types.js +5 -0
- package/dist/types/cli.types.js.map +1 -0
- package/dist/types/command.types.d.ts +176 -0
- package/dist/types/command.types.d.ts.map +1 -0
- package/dist/types/command.types.js +19 -0
- package/dist/types/command.types.js.map +1 -0
- package/dist/types/common.types.d.ts +31 -0
- package/dist/types/common.types.d.ts.map +1 -0
- package/dist/types/common.types.js +8 -0
- package/dist/types/common.types.js.map +1 -0
- package/dist/types/config.types.d.ts +104 -0
- package/dist/types/config.types.d.ts.map +1 -0
- package/dist/types/config.types.js +5 -0
- package/dist/types/config.types.js.map +1 -0
- package/dist/types/diagnostics.types.d.ts +18 -0
- package/dist/types/diagnostics.types.d.ts.map +1 -0
- package/dist/types/diagnostics.types.js +8 -0
- package/dist/types/diagnostics.types.js.map +1 -0
- package/dist/types/document.types.d.ts +127 -0
- package/dist/types/document.types.d.ts.map +1 -0
- package/dist/types/document.types.js +73 -0
- package/dist/types/document.types.js.map +1 -0
- package/dist/types/error.types.d.ts +48 -0
- package/dist/types/error.types.d.ts.map +1 -0
- package/dist/types/error.types.js +16 -0
- package/dist/types/error.types.js.map +1 -0
- package/dist/types/escalation.types.d.ts +76 -0
- package/dist/types/escalation.types.d.ts.map +1 -0
- package/dist/types/escalation.types.js +15 -0
- package/dist/types/escalation.types.js.map +1 -0
- package/dist/types/exploration.types.d.ts +298 -0
- package/dist/types/exploration.types.d.ts.map +1 -0
- package/dist/types/exploration.types.js +5 -0
- package/dist/types/exploration.types.js.map +1 -0
- package/dist/types/hook.types.d.ts +47 -0
- package/dist/types/hook.types.d.ts.map +1 -0
- package/dist/types/hook.types.js +8 -0
- package/dist/types/hook.types.js.map +1 -0
- package/dist/types/idempotency.types.d.ts +80 -0
- package/dist/types/idempotency.types.d.ts.map +1 -0
- package/dist/types/idempotency.types.js +16 -0
- package/dist/types/idempotency.types.js.map +1 -0
- package/dist/types/index.d.ts +25 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/llm.types.d.ts +73 -0
- package/dist/types/llm.types.d.ts.map +1 -0
- package/dist/types/llm.types.js +5 -0
- package/dist/types/llm.types.js.map +1 -0
- package/dist/types/logger.types.d.ts +21 -0
- package/dist/types/logger.types.d.ts.map +1 -0
- package/dist/types/logger.types.js +9 -0
- package/dist/types/logger.types.js.map +1 -0
- package/dist/types/mcp-client.types.d.ts +232 -0
- package/dist/types/mcp-client.types.d.ts.map +1 -0
- package/dist/types/mcp-client.types.js +8 -0
- package/dist/types/mcp-client.types.js.map +1 -0
- package/dist/types/mcp-registry.types.d.ts +49 -0
- package/dist/types/mcp-registry.types.d.ts.map +1 -0
- package/dist/types/mcp-registry.types.js +70 -0
- package/dist/types/mcp-registry.types.js.map +1 -0
- package/dist/types/mcp.types.d.ts +127 -0
- package/dist/types/mcp.types.d.ts.map +1 -0
- package/dist/types/mcp.types.js +5 -0
- package/dist/types/mcp.types.js.map +1 -0
- package/dist/types/pipeline.types.d.ts +139 -0
- package/dist/types/pipeline.types.d.ts.map +1 -0
- package/dist/types/pipeline.types.js +26 -0
- package/dist/types/pipeline.types.js.map +1 -0
- package/dist/types/prompt.types.d.ts +66 -0
- package/dist/types/prompt.types.d.ts.map +1 -0
- package/dist/types/prompt.types.js +5 -0
- package/dist/types/prompt.types.js.map +1 -0
- package/dist/types/provider-names.types.d.ts +56 -0
- package/dist/types/provider-names.types.d.ts.map +1 -0
- package/dist/types/provider-names.types.js +63 -0
- package/dist/types/provider-names.types.js.map +1 -0
- package/dist/types/provider.types.d.ts +22 -0
- package/dist/types/provider.types.d.ts.map +1 -0
- package/dist/types/provider.types.js +21 -0
- package/dist/types/provider.types.js.map +1 -0
- package/dist/types/session.types.d.ts +121 -0
- package/dist/types/session.types.d.ts.map +1 -0
- package/dist/types/session.types.js +5 -0
- package/dist/types/session.types.js.map +1 -0
- package/dist/types/tracing.types.d.ts +176 -0
- package/dist/types/tracing.types.d.ts.map +1 -0
- package/dist/types/tracing.types.js +77 -0
- package/dist/types/tracing.types.js.map +1 -0
- package/dist/types/ui.types.d.ts +88 -0
- package/dist/types/ui.types.d.ts.map +1 -0
- package/dist/types/ui.types.js +8 -0
- package/dist/types/ui.types.js.map +1 -0
- package/dist/types/workflow.types.d.ts +63 -0
- package/dist/types/workflow.types.d.ts.map +1 -0
- package/dist/types/workflow.types.js +5 -0
- package/dist/types/workflow.types.js.map +1 -0
- package/dist/ui/dashboard-tui.d.ts +38 -0
- package/dist/ui/dashboard-tui.d.ts.map +1 -0
- package/dist/ui/dashboard-tui.js +422 -0
- package/dist/ui/dashboard-tui.js.map +1 -0
- package/dist/ui/prompt-adapter.d.ts +37 -0
- package/dist/ui/prompt-adapter.d.ts.map +1 -0
- package/dist/ui/prompt-adapter.interface.d.ts +175 -0
- package/dist/ui/prompt-adapter.interface.d.ts.map +1 -0
- package/dist/ui/prompt-adapter.interface.js +54 -0
- package/dist/ui/prompt-adapter.interface.js.map +1 -0
- package/dist/ui/prompt-adapter.js +45 -0
- package/dist/ui/prompt-adapter.js.map +1 -0
- package/dist/ui/spinner-adapter.d.ts +29 -0
- package/dist/ui/spinner-adapter.d.ts.map +1 -0
- package/dist/ui/spinner-adapter.interface.d.ts +200 -0
- package/dist/ui/spinner-adapter.interface.d.ts.map +1 -0
- package/dist/ui/spinner-adapter.interface.js +53 -0
- package/dist/ui/spinner-adapter.interface.js.map +1 -0
- package/dist/ui/spinner-adapter.js +40 -0
- package/dist/ui/spinner-adapter.js.map +1 -0
- package/dist/ui/tui-adapter.d.ts +52 -0
- package/dist/ui/tui-adapter.d.ts.map +1 -0
- package/dist/ui/tui-adapter.interface.d.ts +197 -0
- package/dist/ui/tui-adapter.interface.d.ts.map +1 -0
- package/dist/ui/tui-adapter.interface.js +62 -0
- package/dist/ui/tui-adapter.interface.js.map +1 -0
- package/dist/ui/tui-adapter.js +58 -0
- package/dist/ui/tui-adapter.js.map +1 -0
- package/dist/utils/base-cleanup-scheduler.d.ts +60 -0
- package/dist/utils/base-cleanup-scheduler.d.ts.map +1 -0
- package/dist/utils/base-cleanup-scheduler.js +110 -0
- package/dist/utils/base-cleanup-scheduler.js.map +1 -0
- package/dist/utils/base-retention-manager.d.ts +136 -0
- package/dist/utils/base-retention-manager.d.ts.map +1 -0
- package/dist/utils/base-retention-manager.js +234 -0
- package/dist/utils/base-retention-manager.js.map +1 -0
- package/dist/utils/console-interceptor.d.ts +52 -0
- package/dist/utils/console-interceptor.d.ts.map +1 -0
- package/dist/utils/console-interceptor.js +92 -0
- package/dist/utils/console-interceptor.js.map +1 -0
- package/dist/utils/data-sanitizer.d.ts +106 -0
- package/dist/utils/data-sanitizer.d.ts.map +1 -0
- package/dist/utils/data-sanitizer.js +295 -0
- package/dist/utils/data-sanitizer.js.map +1 -0
- package/dist/utils/diff-generator.d.ts +42 -0
- package/dist/utils/diff-generator.d.ts.map +1 -0
- package/dist/utils/diff-generator.js +286 -0
- package/dist/utils/diff-generator.js.map +1 -0
- package/dist/utils/docs-linter.d.ts +178 -0
- package/dist/utils/docs-linter.d.ts.map +1 -0
- package/dist/utils/docs-linter.js +623 -0
- package/dist/utils/docs-linter.js.map +1 -0
- package/dist/utils/domain-keyword-registry.d.ts +57 -0
- package/dist/utils/domain-keyword-registry.d.ts.map +1 -0
- package/dist/utils/domain-keyword-registry.js +253 -0
- package/dist/utils/domain-keyword-registry.js.map +1 -0
- package/dist/utils/encryption.d.ts +111 -0
- package/dist/utils/encryption.d.ts.map +1 -0
- package/dist/utils/encryption.js +304 -0
- package/dist/utils/encryption.js.map +1 -0
- package/dist/utils/environment.d.ts +37 -0
- package/dist/utils/environment.d.ts.map +1 -0
- package/dist/utils/environment.js +87 -0
- package/dist/utils/environment.js.map +1 -0
- package/dist/utils/error-handler.d.ts +130 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +319 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/error-messages.d.ts +23 -0
- package/dist/utils/error-messages.d.ts.map +1 -0
- package/dist/utils/error-messages.js +160 -0
- package/dist/utils/error-messages.js.map +1 -0
- package/dist/utils/error-utils.d.ts +26 -0
- package/dist/utils/error-utils.d.ts.map +1 -0
- package/dist/utils/error-utils.js +33 -0
- package/dist/utils/error-utils.js.map +1 -0
- package/dist/utils/file-lock.d.ts +77 -0
- package/dist/utils/file-lock.d.ts.map +1 -0
- package/dist/utils/file-lock.js +355 -0
- package/dist/utils/file-lock.js.map +1 -0
- package/dist/utils/file-utils.d.ts +71 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +235 -0
- package/dist/utils/file-utils.js.map +1 -0
- package/dist/utils/heap-profiler.d.ts +20 -0
- package/dist/utils/heap-profiler.d.ts.map +1 -0
- package/dist/utils/heap-profiler.js +60 -0
- package/dist/utils/heap-profiler.js.map +1 -0
- package/dist/utils/help-content.d.ts +117 -0
- package/dist/utils/help-content.d.ts.map +1 -0
- package/dist/utils/help-content.js +1512 -0
- package/dist/utils/help-content.js.map +1 -0
- package/dist/utils/id-generator.d.ts +45 -0
- package/dist/utils/id-generator.d.ts.map +1 -0
- package/dist/utils/id-generator.js +62 -0
- package/dist/utils/id-generator.js.map +1 -0
- package/dist/utils/index.d.ts +17 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/input-validator.d.ts +152 -0
- package/dist/utils/input-validator.d.ts.map +1 -0
- package/dist/utils/input-validator.js +494 -0
- package/dist/utils/input-validator.js.map +1 -0
- package/dist/utils/markdown-parser.d.ts +32 -0
- package/dist/utils/markdown-parser.d.ts.map +1 -0
- package/dist/utils/markdown-parser.js +85 -0
- package/dist/utils/markdown-parser.js.map +1 -0
- package/dist/utils/metrics-collector.d.ts +165 -0
- package/dist/utils/metrics-collector.d.ts.map +1 -0
- package/dist/utils/metrics-collector.js +392 -0
- package/dist/utils/metrics-collector.js.map +1 -0
- package/dist/utils/number-format.d.ts +29 -0
- package/dist/utils/number-format.d.ts.map +1 -0
- package/dist/utils/number-format.js +72 -0
- package/dist/utils/number-format.js.map +1 -0
- package/dist/utils/paths.d.ts +37 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +91 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/performance-profiler.d.ts +155 -0
- package/dist/utils/performance-profiler.d.ts.map +1 -0
- package/dist/utils/performance-profiler.js +429 -0
- package/dist/utils/performance-profiler.js.map +1 -0
- package/dist/utils/prompt-handler.d.ts +18 -0
- package/dist/utils/prompt-handler.d.ts.map +1 -0
- package/dist/utils/prompt-handler.js +66 -0
- package/dist/utils/prompt-handler.js.map +1 -0
- package/dist/utils/rate-limiter.d.ts +99 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -0
- package/dist/utils/rate-limiter.js +214 -0
- package/dist/utils/rate-limiter.js.map +1 -0
- package/dist/utils/resource-monitor.d.ts +203 -0
- package/dist/utils/resource-monitor.d.ts.map +1 -0
- package/dist/utils/resource-monitor.js +521 -0
- package/dist/utils/resource-monitor.js.map +1 -0
- package/dist/utils/resource-resolver.d.ts +58 -0
- package/dist/utils/resource-resolver.d.ts.map +1 -0
- package/dist/utils/resource-resolver.js +150 -0
- package/dist/utils/resource-resolver.js.map +1 -0
- package/dist/utils/safe-exec.d.ts +90 -0
- package/dist/utils/safe-exec.d.ts.map +1 -0
- package/dist/utils/safe-exec.js +210 -0
- package/dist/utils/safe-exec.js.map +1 -0
- package/dist/utils/safe-regex.d.ts +49 -0
- package/dist/utils/safe-regex.d.ts.map +1 -0
- package/dist/utils/safe-regex.js +96 -0
- package/dist/utils/safe-regex.js.map +1 -0
- package/dist/utils/template-loader.d.ts +39 -0
- package/dist/utils/template-loader.d.ts.map +1 -0
- package/dist/utils/template-loader.js +75 -0
- package/dist/utils/template-loader.js.map +1 -0
- package/dist/utils/token-estimator.d.ts +60 -0
- package/dist/utils/token-estimator.d.ts.map +1 -0
- package/dist/utils/token-estimator.js +114 -0
- package/dist/utils/token-estimator.js.map +1 -0
- package/dist/utils/tracing.d.ts +166 -0
- package/dist/utils/tracing.d.ts.map +1 -0
- package/dist/utils/tracing.js +645 -0
- package/dist/utils/tracing.js.map +1 -0
- package/dist/utils/type-guards.d.ts +58 -0
- package/dist/utils/type-guards.d.ts.map +1 -0
- package/dist/utils/type-guards.js +103 -0
- package/dist/utils/type-guards.js.map +1 -0
- package/dist/utils/yaml-parser.d.ts +38 -0
- package/dist/utils/yaml-parser.d.ts.map +1 -0
- package/dist/utils/yaml-parser.js +71 -0
- package/dist/utils/yaml-parser.js.map +1 -0
- package/package.json +166 -0
|
@@ -0,0 +1,1124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Execution Service
|
|
3
|
+
*
|
|
4
|
+
* Defines and executes file manipulation tools for LLM-driven code generation.
|
|
5
|
+
* These tools allow the LLM to actually create, modify, and delete files.
|
|
6
|
+
*
|
|
7
|
+
* Tools supported:
|
|
8
|
+
* - write: Create or overwrite files
|
|
9
|
+
* - read_file: Read file contents
|
|
10
|
+
* - search_replace: Make targeted edits to files
|
|
11
|
+
* - delete_file: Remove files
|
|
12
|
+
* - run_terminal_cmd: Execute shell commands
|
|
13
|
+
* - list_dir: List directory contents
|
|
14
|
+
* - glob_file_search: Find files by pattern
|
|
15
|
+
* - grep: Search file contents
|
|
16
|
+
* - codebase_search: Semantic code search
|
|
17
|
+
* - query_session: Query previous session data for context reuse
|
|
18
|
+
*/
|
|
19
|
+
import { exec } from 'child_process';
|
|
20
|
+
import { DEFAULT_TIMEOUT_MS } from '../config/constants.js';
|
|
21
|
+
import { existsSync, readdirSync, rmSync, statSync } from 'fs';
|
|
22
|
+
import { getColorAdapter } from '../output/color-adapter.interface.js';
|
|
23
|
+
import { getConsoleOutput } from '../output/console-output.js';
|
|
24
|
+
import { getLogger } from '../output/logger.js';
|
|
25
|
+
import { getIdempotencyStore } from '../services/idempotency-store.service.js';
|
|
26
|
+
import { isMCPTool } from '../types/command.types.js';
|
|
27
|
+
import { isIdempotentTool } from '../types/idempotency.types.js';
|
|
28
|
+
import { getServerIdFromTool } from '../types/mcp-registry.types.js';
|
|
29
|
+
import { SemanticAttributes, SpanKind } from '../types/tracing.types.js';
|
|
30
|
+
import { getPromptAdapter } from '../ui/prompt-adapter.interface.js';
|
|
31
|
+
import { promisify } from 'util';
|
|
32
|
+
import { formatErrorMessage } from '../utils/error-utils.js';
|
|
33
|
+
import { readFile, writeFile } from '../utils/file-utils.js';
|
|
34
|
+
import { validateNotForbiddenPath } from '../utils/input-validator.js';
|
|
35
|
+
import { getTracer } from '../utils/tracing.js';
|
|
36
|
+
import { getHookExecutionService } from './hook-execution.service.js';
|
|
37
|
+
import { getDryRunSimulator } from './tools/dry-run-simulator.service.js';
|
|
38
|
+
import { PendingWriteApproverService } from './tools/pending-write-approver.service.js';
|
|
39
|
+
import { getSearchToolsService } from './tools/search-tools.service.js';
|
|
40
|
+
import { getSessionToolsService } from './tools/session-tools.service.js';
|
|
41
|
+
const execAsync = promisify(exec);
|
|
42
|
+
/**
|
|
43
|
+
* Tool definitions for the LLM (built-in tools only)
|
|
44
|
+
* These are passed to the LLM so it knows what tools are available.
|
|
45
|
+
* MCP tool definitions are generated dynamically based on connected MCP servers.
|
|
46
|
+
*/
|
|
47
|
+
const BUILT_IN_TOOL_DEFINITIONS = {
|
|
48
|
+
codebase_search: {
|
|
49
|
+
description: 'Semantic search across the codebase to find relevant code snippets',
|
|
50
|
+
name: 'codebase_search',
|
|
51
|
+
parameters: {
|
|
52
|
+
properties: {
|
|
53
|
+
query: {
|
|
54
|
+
description: 'Natural language search query',
|
|
55
|
+
type: 'string'
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
required: ['query'],
|
|
59
|
+
type: 'object'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
delete_file: {
|
|
63
|
+
description: 'Delete a file from the filesystem',
|
|
64
|
+
name: 'delete_file',
|
|
65
|
+
parameters: {
|
|
66
|
+
properties: {
|
|
67
|
+
path: {
|
|
68
|
+
description: 'Path to the file to delete',
|
|
69
|
+
type: 'string'
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
required: ['path'],
|
|
73
|
+
type: 'object'
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
glob_file_search: {
|
|
77
|
+
description: `Find files matching a glob pattern.
|
|
78
|
+
|
|
79
|
+
⚠️ RECOMMENDED: Use run_terminal_cmd with 'fd' for better performance.
|
|
80
|
+
|
|
81
|
+
This tool uses basic glob matching.
|
|
82
|
+
|
|
83
|
+
PREFERRED: Use run_terminal_cmd with modern 'fd' tool for:
|
|
84
|
+
• 5-10x faster file discovery
|
|
85
|
+
• .gitignore awareness (skips node_modules, .git, build/)
|
|
86
|
+
• Better pattern matching
|
|
87
|
+
|
|
88
|
+
Examples:
|
|
89
|
+
✅ run_terminal_cmd("fd -e ts src/") # Find all .ts files in src/
|
|
90
|
+
✅ run_terminal_cmd("fd -e tsx -e jsx .") # Multiple extensions
|
|
91
|
+
✅ run_terminal_cmd("fd --type f 'test' .") # Files containing 'test'
|
|
92
|
+
✅ run_terminal_cmd("fd --glob '**/*.config.js'") # Glob pattern
|
|
93
|
+
|
|
94
|
+
This tool (glob_file_search) is acceptable for simple patterns, but fd is faster and more powerful.`,
|
|
95
|
+
name: 'glob_file_search',
|
|
96
|
+
parameters: {
|
|
97
|
+
properties: {
|
|
98
|
+
pattern: {
|
|
99
|
+
description: 'Glob pattern (e.g., "**/*.ts", "src/**/*.tsx")',
|
|
100
|
+
type: 'string'
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
required: ['pattern'],
|
|
104
|
+
type: 'object'
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
grep: {
|
|
108
|
+
description: `⚠️ DEPRECATED: Use run_terminal_cmd with 'rg' (ripgrep) instead.
|
|
109
|
+
|
|
110
|
+
This tool uses legacy grep which:
|
|
111
|
+
❌ Searches node_modules, .git, and other ignored directories (wastes tokens)
|
|
112
|
+
❌ Produces verbose, unstructured output
|
|
113
|
+
❌ Lacks .gitignore awareness
|
|
114
|
+
❌ Slower on large codebases
|
|
115
|
+
|
|
116
|
+
PREFERRED: Use run_terminal_cmd with modern 'rg' (ripgrep) tool:
|
|
117
|
+
|
|
118
|
+
Examples:
|
|
119
|
+
✅ run_terminal_cmd("rg 'pattern' src/") # Fast, .gitignore-aware
|
|
120
|
+
✅ run_terminal_cmd("rg -A 5 'pattern' file.ts") # With 5 lines of context
|
|
121
|
+
✅ run_terminal_cmd("rg --json 'pattern' .") # Structured output for parsing
|
|
122
|
+
✅ run_terminal_cmd("rg -l 'pattern' .") # List matching files only
|
|
123
|
+
|
|
124
|
+
Benefits of rg over grep:
|
|
125
|
+
• 5-10x faster
|
|
126
|
+
• Respects .gitignore by default (skips node_modules, .git, build artifacts)
|
|
127
|
+
• Structured JSON output available (--json flag)
|
|
128
|
+
• Better regex engine
|
|
129
|
+
• Saves 60-80% tokens by excluding irrelevant files
|
|
130
|
+
|
|
131
|
+
Only use this legacy grep tool if:
|
|
132
|
+
• You need to search in .gitignore'd directories
|
|
133
|
+
• rg is not available (rare)`,
|
|
134
|
+
name: 'grep',
|
|
135
|
+
parameters: {
|
|
136
|
+
properties: {
|
|
137
|
+
path: {
|
|
138
|
+
description: 'Directory or file to search in',
|
|
139
|
+
type: 'string'
|
|
140
|
+
},
|
|
141
|
+
pattern: {
|
|
142
|
+
description: 'Regex pattern to search for',
|
|
143
|
+
type: 'string'
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
required: ['pattern'],
|
|
147
|
+
type: 'object'
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
list_dir: {
|
|
151
|
+
description: 'List contents of a directory',
|
|
152
|
+
name: 'list_dir',
|
|
153
|
+
parameters: {
|
|
154
|
+
properties: {
|
|
155
|
+
path: {
|
|
156
|
+
description: 'Path to the directory to list',
|
|
157
|
+
type: 'string'
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
required: ['path'],
|
|
161
|
+
type: 'object'
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
query_session: {
|
|
165
|
+
description: 'Query previous session data to find relevant context, decisions, or outputs. ' +
|
|
166
|
+
'Use this to avoid re-running analysis or to understand prior work. ' +
|
|
167
|
+
'Can list sessions, search across sessions, or get specific session details.',
|
|
168
|
+
name: 'query_session',
|
|
169
|
+
parameters: {
|
|
170
|
+
properties: {
|
|
171
|
+
action: {
|
|
172
|
+
description: 'Action to perform: "list" (show recent sessions), "search" (find content across sessions), "get" (get session details)',
|
|
173
|
+
type: 'string'
|
|
174
|
+
},
|
|
175
|
+
query: {
|
|
176
|
+
description: 'Search query for "search" action - finds matching content in session outputs',
|
|
177
|
+
type: 'string'
|
|
178
|
+
},
|
|
179
|
+
session_id: {
|
|
180
|
+
description: 'Session ID for "get" action - retrieves specific session details',
|
|
181
|
+
type: 'string'
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
required: ['action'],
|
|
185
|
+
type: 'object'
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
read_file: {
|
|
189
|
+
description: `Read SMALL files only (max 100 lines).
|
|
190
|
+
|
|
191
|
+
⚠️ CRITICAL RESTRICTIONS:
|
|
192
|
+
|
|
193
|
+
NEVER use this tool for files >100 lines - this wastes 80-90% of your context window.
|
|
194
|
+
NEVER use this tool for JSON/YAML/TOML/XML files - use jq/yq via run_terminal_cmd instead.
|
|
195
|
+
|
|
196
|
+
DO NOT USE for these files (use run_terminal_cmd with rg instead):
|
|
197
|
+
❌ PRD.md, BACKLOG.md, FUNCTIONAL.md (150-500 lines)
|
|
198
|
+
❌ package.json, tsconfig.json (use jq)
|
|
199
|
+
❌ docker-compose.yml, *.yaml (use yq)
|
|
200
|
+
|
|
201
|
+
CORRECT usage examples:
|
|
202
|
+
✅ read_file("README.md") - if < 100 lines
|
|
203
|
+
✅ read_file("CONTRIBUTING.md") - if < 100 lines
|
|
204
|
+
|
|
205
|
+
INCORRECT usage (use run_terminal_cmd instead):
|
|
206
|
+
❌ read_file("knowledge-base/PRD.md") → use: run_terminal_cmd("rg '^## ' knowledge-base/PRD.md")
|
|
207
|
+
❌ read_file("package.json") → use: run_terminal_cmd("jq '.dependencies' package.json")
|
|
208
|
+
❌ read_file("knowledge-base/BACKLOG.md") → use: run_terminal_cmd("rg -A 5 'TASK-ID' knowledge-base/BACKLOG.md")
|
|
209
|
+
|
|
210
|
+
Violating these restrictions wastes tokens and degrades performance.`,
|
|
211
|
+
name: 'read_file',
|
|
212
|
+
parameters: {
|
|
213
|
+
properties: {
|
|
214
|
+
path: {
|
|
215
|
+
description: 'Path to the file to read',
|
|
216
|
+
type: 'string'
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
required: ['path'],
|
|
220
|
+
type: 'object'
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
run_terminal_cmd: {
|
|
224
|
+
description: 'Execute a shell command and return the output',
|
|
225
|
+
name: 'run_terminal_cmd',
|
|
226
|
+
parameters: {
|
|
227
|
+
properties: {
|
|
228
|
+
command: {
|
|
229
|
+
description: 'The shell command to execute',
|
|
230
|
+
type: 'string'
|
|
231
|
+
},
|
|
232
|
+
timeout_ms: {
|
|
233
|
+
description: 'Timeout in milliseconds (default: 30000)',
|
|
234
|
+
type: 'number'
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
required: ['command'],
|
|
238
|
+
type: 'object'
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
search_replace: {
|
|
242
|
+
description: 'Make targeted edits to a file by replacing specific text',
|
|
243
|
+
name: 'search_replace',
|
|
244
|
+
parameters: {
|
|
245
|
+
properties: {
|
|
246
|
+
new_str: {
|
|
247
|
+
description: 'The text to replace it with',
|
|
248
|
+
type: 'string'
|
|
249
|
+
},
|
|
250
|
+
old_str: {
|
|
251
|
+
description: 'The exact text to search for and replace',
|
|
252
|
+
type: 'string'
|
|
253
|
+
},
|
|
254
|
+
path: {
|
|
255
|
+
description: 'Path to the file to edit',
|
|
256
|
+
type: 'string'
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
required: ['path', 'old_str', 'new_str'],
|
|
260
|
+
type: 'object'
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
web_search: {
|
|
264
|
+
description: 'Search the web for information',
|
|
265
|
+
name: 'web_search',
|
|
266
|
+
parameters: {
|
|
267
|
+
properties: {
|
|
268
|
+
query: {
|
|
269
|
+
description: 'Search query',
|
|
270
|
+
type: 'string'
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
required: ['query'],
|
|
274
|
+
type: 'object'
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
write: {
|
|
278
|
+
description: 'Create a new file or overwrite an existing file with the specified content',
|
|
279
|
+
name: 'write',
|
|
280
|
+
parameters: {
|
|
281
|
+
properties: {
|
|
282
|
+
content: {
|
|
283
|
+
description: 'The content to write to the file',
|
|
284
|
+
type: 'string'
|
|
285
|
+
},
|
|
286
|
+
path: {
|
|
287
|
+
description: 'Path where the file should be created',
|
|
288
|
+
type: 'string'
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
required: ['path', 'content'],
|
|
292
|
+
type: 'object'
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
export class ToolExecutionService {
|
|
297
|
+
hookExecutionService = getHookExecutionService();
|
|
298
|
+
idempotencyStore;
|
|
299
|
+
logger = getLogger();
|
|
300
|
+
mcpClientManager = null;
|
|
301
|
+
mcpToolHandler = null;
|
|
302
|
+
searchToolsService;
|
|
303
|
+
sessionToolsService;
|
|
304
|
+
tracer = getTracer();
|
|
305
|
+
workingDir;
|
|
306
|
+
/**
|
|
307
|
+
* Session ID for scoping idempotency keys
|
|
308
|
+
* When set, idempotency is scoped to the current session
|
|
309
|
+
*/
|
|
310
|
+
sessionId;
|
|
311
|
+
/**
|
|
312
|
+
* Trace context for distributed tracing
|
|
313
|
+
* When set, tool execution spans are linked to the parent trace
|
|
314
|
+
*/
|
|
315
|
+
traceContext;
|
|
316
|
+
/**
|
|
317
|
+
* Idempotency options for tool execution
|
|
318
|
+
*/
|
|
319
|
+
idempotencyOptions = {};
|
|
320
|
+
/**
|
|
321
|
+
* Tracks files that have been read in this session.
|
|
322
|
+
* Used to allow writes to protected files only if they were read first,
|
|
323
|
+
* preventing blind overwrites while still allowing intentional updates.
|
|
324
|
+
*/
|
|
325
|
+
readFiles = new Set();
|
|
326
|
+
/**
|
|
327
|
+
* Dry-run mode flag
|
|
328
|
+
* When enabled, state-changing tools are simulated instead of executed
|
|
329
|
+
*/
|
|
330
|
+
dryRunMode = false;
|
|
331
|
+
/**
|
|
332
|
+
* Dry-run simulator instance (lazy-initialized)
|
|
333
|
+
*/
|
|
334
|
+
dryRunSimulator = null;
|
|
335
|
+
constructor(workingDir = process.cwd()) {
|
|
336
|
+
this.workingDir = workingDir;
|
|
337
|
+
this.idempotencyStore = getIdempotencyStore();
|
|
338
|
+
this.searchToolsService = getSearchToolsService(workingDir);
|
|
339
|
+
this.sessionToolsService = getSessionToolsService(workingDir);
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Set the trace context for distributed tracing
|
|
343
|
+
* Tool execution spans will be children of this context
|
|
344
|
+
*/
|
|
345
|
+
setTraceContext(context) {
|
|
346
|
+
this.traceContext = context;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Get the current trace context
|
|
350
|
+
*/
|
|
351
|
+
getTraceContext() {
|
|
352
|
+
return this.traceContext;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Set the session ID for idempotency scoping
|
|
356
|
+
* This should be called at the start of a command execution
|
|
357
|
+
*/
|
|
358
|
+
setSessionId(sessionId) {
|
|
359
|
+
this.sessionId = sessionId;
|
|
360
|
+
this.idempotencyOptions.session_id = sessionId;
|
|
361
|
+
this.hookExecutionService.setSessionId(sessionId);
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Configure idempotency options
|
|
365
|
+
*/
|
|
366
|
+
setIdempotencyOptions(options) {
|
|
367
|
+
this.idempotencyOptions = { ...this.idempotencyOptions, ...options };
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Set the MCP tool handler for executing MCP tools
|
|
371
|
+
*/
|
|
372
|
+
setMCPToolHandler(handler) {
|
|
373
|
+
this.mcpToolHandler = handler;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Set the MCP client manager for generating MCP tool definitions
|
|
377
|
+
*/
|
|
378
|
+
setMCPClientManager(clientManager) {
|
|
379
|
+
this.mcpClientManager = clientManager;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Disable idempotency for the current execution
|
|
383
|
+
* Useful when you want to force re-execution of all tools
|
|
384
|
+
*/
|
|
385
|
+
disableIdempotency() {
|
|
386
|
+
this.idempotencyOptions.force_execute = true;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Enable idempotency for the current execution
|
|
390
|
+
*/
|
|
391
|
+
enableIdempotency() {
|
|
392
|
+
this.idempotencyOptions.force_execute = false;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Enable or disable dry-run mode
|
|
396
|
+
* In dry-run mode, state-changing tools are simulated instead of executed
|
|
397
|
+
*/
|
|
398
|
+
setDryRunMode(enabled) {
|
|
399
|
+
this.dryRunMode = enabled;
|
|
400
|
+
if (enabled && !this.dryRunSimulator) {
|
|
401
|
+
this.dryRunSimulator = getDryRunSimulator(this.workingDir);
|
|
402
|
+
}
|
|
403
|
+
this.logger.debug(`Dry-run mode ${enabled ? 'enabled' : 'disabled'}`);
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Check if dry-run mode is enabled
|
|
407
|
+
*/
|
|
408
|
+
isDryRunMode() {
|
|
409
|
+
return this.dryRunMode;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Get simulated operations from dry-run mode
|
|
413
|
+
*/
|
|
414
|
+
getSimulatedOperations() {
|
|
415
|
+
if (!this.dryRunSimulator) {
|
|
416
|
+
return [];
|
|
417
|
+
}
|
|
418
|
+
return this.dryRunSimulator.getSimulatedOperations();
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Clear simulated operations
|
|
422
|
+
*/
|
|
423
|
+
clearSimulatedOperations() {
|
|
424
|
+
if (this.dryRunSimulator) {
|
|
425
|
+
this.dryRunSimulator.clear();
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Get tool definitions for the specified allowed tools
|
|
430
|
+
* Built-in tools are returned from static definitions.
|
|
431
|
+
* MCP tools are generated as gateway tools that route to external MCP servers.
|
|
432
|
+
*/
|
|
433
|
+
getToolDefinitions(allowedTools) {
|
|
434
|
+
const definitions = [];
|
|
435
|
+
for (const tool of allowedTools) {
|
|
436
|
+
if (isMCPTool(tool)) {
|
|
437
|
+
// Generate MCP gateway tool definition
|
|
438
|
+
const mcpDefinition = this.generateMCPToolDefinition(tool);
|
|
439
|
+
if (mcpDefinition) {
|
|
440
|
+
definitions.push(mcpDefinition);
|
|
441
|
+
}
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
const definition = BUILT_IN_TOOL_DEFINITIONS[tool];
|
|
445
|
+
if (definition) {
|
|
446
|
+
definitions.push(definition);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return definitions;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Build the description for an MCP tool definition
|
|
453
|
+
*/
|
|
454
|
+
buildMCPToolDescription(serverId, serverDescription, availableToolNames, capabilities) {
|
|
455
|
+
let description = `Call tools on the ${serverId} MCP server. ${serverDescription}`;
|
|
456
|
+
if (availableToolNames.length > 0) {
|
|
457
|
+
description += `\n\nAvailable tools: ${availableToolNames.join(', ')}`;
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
description += '\n\nThe server will be connected on first use, and available tools will be discovered.';
|
|
461
|
+
}
|
|
462
|
+
if (capabilities) {
|
|
463
|
+
description += `\n\nCapabilities: ${capabilities.join(', ')}`;
|
|
464
|
+
}
|
|
465
|
+
return description;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Get the tool_name parameter description based on available tools
|
|
469
|
+
*/
|
|
470
|
+
getToolNameDescription(availableToolNames) {
|
|
471
|
+
return availableToolNames.length > 0
|
|
472
|
+
? `The name of the tool to call. Available: ${availableToolNames.join(', ')}`
|
|
473
|
+
: 'The name of the tool to call on this MCP server';
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Generate a gateway tool definition for an MCP tool
|
|
477
|
+
* This creates a tool that accepts tool_name and arguments parameters,
|
|
478
|
+
* allowing the LLM to call any tool on the connected MCP server.
|
|
479
|
+
*/
|
|
480
|
+
generateMCPToolDefinition(mcpTool) {
|
|
481
|
+
const serverId = getServerIdFromTool(mcpTool);
|
|
482
|
+
if (!serverId) {
|
|
483
|
+
this.logger.warn(`Invalid MCP tool name: ${mcpTool}`);
|
|
484
|
+
return null;
|
|
485
|
+
}
|
|
486
|
+
// Get server info if connected
|
|
487
|
+
const connectedServer = this.mcpClientManager?.getConnectedServer(serverId);
|
|
488
|
+
const serverDescription = connectedServer?.config.description ?? `External MCP server: ${serverId}`;
|
|
489
|
+
const availableToolNames = connectedServer?.availableTools.map((t) => t.name) ?? [];
|
|
490
|
+
const capabilities = connectedServer?.config.security.capabilities;
|
|
491
|
+
const description = this.buildMCPToolDescription(serverId, serverDescription, availableToolNames, capabilities);
|
|
492
|
+
return {
|
|
493
|
+
description,
|
|
494
|
+
name: mcpTool,
|
|
495
|
+
parameters: {
|
|
496
|
+
additionalProperties: false,
|
|
497
|
+
properties: {
|
|
498
|
+
arguments: {
|
|
499
|
+
additionalProperties: true,
|
|
500
|
+
description: 'Arguments to pass to the tool (varies by tool)',
|
|
501
|
+
type: 'object'
|
|
502
|
+
},
|
|
503
|
+
tool_name: {
|
|
504
|
+
description: this.getToolNameDescription(availableToolNames),
|
|
505
|
+
type: 'string'
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
required: ['tool_name'],
|
|
509
|
+
type: 'object'
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Reset state for a new command execution
|
|
515
|
+
* Clears pending writes and resets confirmation state
|
|
516
|
+
* Should be called at the start of each command execution
|
|
517
|
+
*/
|
|
518
|
+
resetForNewCommand() {
|
|
519
|
+
this.pendingWrites = [];
|
|
520
|
+
this.readFiles.clear();
|
|
521
|
+
// Reset idempotency options but keep session_id
|
|
522
|
+
this.idempotencyOptions = { session_id: this.sessionId };
|
|
523
|
+
// Reset dry-run state
|
|
524
|
+
this.dryRunMode = false;
|
|
525
|
+
this.clearSimulatedOperations();
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Invalidate all idempotency records for the current session
|
|
529
|
+
* Call this when session state changes significantly
|
|
530
|
+
*/
|
|
531
|
+
async invalidateSessionIdempotency() {
|
|
532
|
+
if (this.sessionId) {
|
|
533
|
+
return this.idempotencyStore.invalidateSession(this.sessionId);
|
|
534
|
+
}
|
|
535
|
+
return 0;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Invalidate idempotency records for a specific tool
|
|
539
|
+
* Useful when external changes affect tool results
|
|
540
|
+
*/
|
|
541
|
+
invalidateToolIdempotency(toolName) {
|
|
542
|
+
return this.idempotencyStore.invalidateTool(toolName);
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Get idempotency store statistics
|
|
546
|
+
*/
|
|
547
|
+
getIdempotencyStats() {
|
|
548
|
+
return this.idempotencyStore.getStats();
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Execute a tool call and return the result
|
|
552
|
+
*
|
|
553
|
+
* For idempotent tools (write, search_replace, delete_file, run_terminal_cmd),
|
|
554
|
+
* checks the idempotency store first and returns cached result if available.
|
|
555
|
+
* This prevents duplicate operations when the same tool call is retried.
|
|
556
|
+
*
|
|
557
|
+
* In dry-run mode, state-changing tools are simulated instead of executed.
|
|
558
|
+
* Read-only tools execute normally even in dry-run mode.
|
|
559
|
+
*/
|
|
560
|
+
async executeTool(toolCall) {
|
|
561
|
+
const { name } = toolCall;
|
|
562
|
+
// Handle dry-run mode for non-read-only tools
|
|
563
|
+
if (this.dryRunMode && this.dryRunSimulator && !this.dryRunSimulator.isReadOnlyTool(name)) {
|
|
564
|
+
this.logger.debug(`Simulating tool in dry-run mode: ${name}`);
|
|
565
|
+
const simulated = await this.dryRunSimulator.simulateTool(toolCall);
|
|
566
|
+
return simulated.result;
|
|
567
|
+
}
|
|
568
|
+
// === PreToolUse hooks (before span, can block/modify) ===
|
|
569
|
+
if (this.hookExecutionService.hasHooks('PreToolUse')) {
|
|
570
|
+
const hookResult = await this.hookExecutionService.executePreToolUseHooks(toolCall);
|
|
571
|
+
if (!hookResult.allowed) {
|
|
572
|
+
this.logger.info(`Tool blocked by PreToolUse hook: ${name}`, {
|
|
573
|
+
reason: hookResult.blockReason
|
|
574
|
+
});
|
|
575
|
+
return {
|
|
576
|
+
output: `Tool call blocked by hook: ${hookResult.blockReason ?? 'No reason provided'}`,
|
|
577
|
+
tool_call_id: toolCall.id
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
if (hookResult.updatedArgs) {
|
|
581
|
+
toolCall = { ...toolCall, arguments: { ...toolCall.arguments, ...hookResult.updatedArgs } };
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
// Start a span for this tool execution
|
|
585
|
+
const span = this.tracer.startSpan(`tool.${name}`, {
|
|
586
|
+
attributes: {
|
|
587
|
+
[SemanticAttributes.SESSION_ID]: this.sessionId,
|
|
588
|
+
[SemanticAttributes.TOOL_NAME]: name
|
|
589
|
+
},
|
|
590
|
+
kind: SpanKind.INTERNAL,
|
|
591
|
+
parent: this.traceContext
|
|
592
|
+
});
|
|
593
|
+
try {
|
|
594
|
+
return await this.executeToolWithSpan(toolCall, span);
|
|
595
|
+
}
|
|
596
|
+
finally {
|
|
597
|
+
span.end();
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Internal method to execute a tool with span tracking
|
|
602
|
+
*/
|
|
603
|
+
async executeToolWithSpan(toolCall, span) {
|
|
604
|
+
const { arguments: args, id, name } = toolCall;
|
|
605
|
+
const argSummary = this.getToolArgSummary(name, args);
|
|
606
|
+
const color = getColorAdapter();
|
|
607
|
+
// Check idempotency for state-changing tools
|
|
608
|
+
if (isIdempotentTool(name)) {
|
|
609
|
+
const checkResult = await this.idempotencyStore.check(toolCall, this.idempotencyOptions);
|
|
610
|
+
if (checkResult.found && checkResult.record) {
|
|
611
|
+
span.setAttribute(SemanticAttributes.TOOL_CACHE_HIT, true);
|
|
612
|
+
span.setAttribute(SemanticAttributes.TOOL_IDEMPOTENCY_KEY, checkResult.key);
|
|
613
|
+
span.addEvent('idempotency_cache_hit');
|
|
614
|
+
span.setOk();
|
|
615
|
+
this.logger.info(`Idempotency cache hit: ${name}${argSummary ? ` ${color.dim(`(${argSummary})`)}` : ''}`, {
|
|
616
|
+
idempotency_key: checkResult.key
|
|
617
|
+
});
|
|
618
|
+
return {
|
|
619
|
+
output: checkResult.record.result.output,
|
|
620
|
+
tool_call_id: id
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
span.setAttribute(SemanticAttributes.TOOL_CACHE_HIT, false);
|
|
625
|
+
span.addEvent('tool_execution_start');
|
|
626
|
+
this.logger.info(`Executing tool: ${name}${argSummary ? ` ${color.dim(`(${argSummary})`)}` : ''}`, { args });
|
|
627
|
+
try {
|
|
628
|
+
const output = await this.executeToolByName(name, args);
|
|
629
|
+
span.setAttribute(SemanticAttributes.TOOL_RESULT_SIZE, output.length);
|
|
630
|
+
span.setAttribute(SemanticAttributes.TOOL_SUCCESS, true);
|
|
631
|
+
span.addEvent('tool_execution_complete');
|
|
632
|
+
span.setOk();
|
|
633
|
+
this.logger.debug(`Tool ${name} completed successfully`, {
|
|
634
|
+
outputLength: output.length
|
|
635
|
+
});
|
|
636
|
+
// Store result for idempotent tools
|
|
637
|
+
if (isIdempotentTool(name)) {
|
|
638
|
+
await this.idempotencyStore.store(toolCall, { output, success: true }, this.idempotencyOptions);
|
|
639
|
+
}
|
|
640
|
+
// === PostToolUse hooks (after execution, non-blocking) ===
|
|
641
|
+
if (this.hookExecutionService.hasHooks('PostToolUse')) {
|
|
642
|
+
// Fire-and-forget: do not await, do not block
|
|
643
|
+
this.hookExecutionService.executePostToolUseHooks(toolCall, output).catch((err) => {
|
|
644
|
+
this.logger.warn('PostToolUse hook error', { error: formatErrorMessage(err) });
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
return {
|
|
648
|
+
output,
|
|
649
|
+
tool_call_id: id
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
catch (error) {
|
|
653
|
+
const errorMessage = formatErrorMessage(error);
|
|
654
|
+
span.setAttribute(SemanticAttributes.TOOL_SUCCESS, false);
|
|
655
|
+
span.recordException(error);
|
|
656
|
+
this.logger.error(`Tool ${name} failed`, error);
|
|
657
|
+
// Store failed result for idempotent tools (prevents retrying failed operations)
|
|
658
|
+
if (isIdempotentTool(name)) {
|
|
659
|
+
await this.idempotencyStore.store(toolCall, { error: errorMessage, output: `Error: ${errorMessage}`, success: false }, this.idempotencyOptions);
|
|
660
|
+
}
|
|
661
|
+
return {
|
|
662
|
+
output: `Error: ${errorMessage}`,
|
|
663
|
+
tool_call_id: id
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Execute multiple tool calls in parallel
|
|
669
|
+
*/
|
|
670
|
+
async executeTools(toolCalls) {
|
|
671
|
+
if (toolCalls.length === 0) {
|
|
672
|
+
return [];
|
|
673
|
+
}
|
|
674
|
+
// Create a parent span for batch execution
|
|
675
|
+
const span = this.tracer.startSpan('tool.batch_execute', {
|
|
676
|
+
attributes: {
|
|
677
|
+
[SemanticAttributes.SESSION_ID]: this.sessionId,
|
|
678
|
+
'tool.batch_size': toolCalls.length,
|
|
679
|
+
'tool.names': toolCalls.map((c) => c.name).join(',')
|
|
680
|
+
},
|
|
681
|
+
kind: SpanKind.INTERNAL,
|
|
682
|
+
parent: this.traceContext
|
|
683
|
+
});
|
|
684
|
+
try {
|
|
685
|
+
const results = await Promise.all(toolCalls.map((call) => this.executeTool(call)));
|
|
686
|
+
span.setAttribute('tool.success_count', results.filter((r) => !r.output.startsWith('Error:')).length);
|
|
687
|
+
span.setOk();
|
|
688
|
+
return results;
|
|
689
|
+
}
|
|
690
|
+
catch (error) {
|
|
691
|
+
span.recordException(error);
|
|
692
|
+
throw error;
|
|
693
|
+
}
|
|
694
|
+
finally {
|
|
695
|
+
span.end();
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Route tool execution to the appropriate handler
|
|
700
|
+
*/
|
|
701
|
+
async executeToolByName(name, args) {
|
|
702
|
+
// Check if this is an MCP tool (handled separately in Phase 2)
|
|
703
|
+
if (isMCPTool(name)) {
|
|
704
|
+
return this.executeMcpTool(name, args);
|
|
705
|
+
}
|
|
706
|
+
// Built-in tool handlers
|
|
707
|
+
const toolHandlers = {
|
|
708
|
+
['codebase_search']: (a) => this.searchToolsService.executeCodebaseSearch(a),
|
|
709
|
+
['delete_file']: (a) => this.executeDeleteFile(a),
|
|
710
|
+
['glob_file_search']: (a) => this.searchToolsService.executeGlobSearch(a),
|
|
711
|
+
['grep']: (a) => this.searchToolsService.executeGrep(a),
|
|
712
|
+
['list_dir']: (a) => this.executeListDir(a),
|
|
713
|
+
['query_session']: (a) => this.sessionToolsService.executeQuerySession(a),
|
|
714
|
+
['read_file']: (a) => this.executeReadFile(a),
|
|
715
|
+
['run_terminal_cmd']: (a) => this.executeTerminalCmd(a),
|
|
716
|
+
['search_replace']: (a) => this.executeSearchReplace(a),
|
|
717
|
+
['web_search']: (a) => this.executeWebSearch(a),
|
|
718
|
+
['write']: (a) => this.executeWrite(a)
|
|
719
|
+
};
|
|
720
|
+
const handler = toolHandlers[name];
|
|
721
|
+
if (!handler) {
|
|
722
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
723
|
+
}
|
|
724
|
+
return handler(args);
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Execute an MCP tool call
|
|
728
|
+
* Routes the call to MCPToolHandler for connection management and execution
|
|
729
|
+
*/
|
|
730
|
+
async executeMcpTool(mcpToolName, args) {
|
|
731
|
+
// Check if MCP handler is available
|
|
732
|
+
if (!this.mcpToolHandler) {
|
|
733
|
+
this.logger.warn('MCP tool handler not configured', { mcpToolName });
|
|
734
|
+
return JSON.stringify({
|
|
735
|
+
error: 'MCP tool handler not configured. MCP tools are not available.',
|
|
736
|
+
status: 'not_configured'
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
// Extract the actual tool name from args (e.g., playwright_navigate)
|
|
740
|
+
// The mcpToolName is the MCP identifier (e.g., mcp_playwright)
|
|
741
|
+
// The actual tool to call should be in args.tool_name or we use the full name
|
|
742
|
+
const actualToolName = args['tool_name'] ?? mcpToolName;
|
|
743
|
+
const toolArgs = args['arguments'] ?? args;
|
|
744
|
+
try {
|
|
745
|
+
const result = await this.mcpToolHandler.executeTool(mcpToolName, actualToolName, toolArgs);
|
|
746
|
+
if (result.success) {
|
|
747
|
+
return JSON.stringify({
|
|
748
|
+
duration_ms: result.durationMs,
|
|
749
|
+
output: result.output,
|
|
750
|
+
server: result.serverId,
|
|
751
|
+
status: 'success',
|
|
752
|
+
tool: result.toolName
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
else {
|
|
756
|
+
return JSON.stringify({
|
|
757
|
+
duration_ms: result.durationMs,
|
|
758
|
+
error: result.error,
|
|
759
|
+
server: result.serverId,
|
|
760
|
+
status: 'error',
|
|
761
|
+
tool: result.toolName
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
catch (error) {
|
|
766
|
+
const errorMessage = error.message;
|
|
767
|
+
this.logger.error(`MCP tool execution failed: ${mcpToolName}`, error);
|
|
768
|
+
return JSON.stringify({
|
|
769
|
+
error: errorMessage,
|
|
770
|
+
status: 'error',
|
|
771
|
+
tool: mcpToolName
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* Paths that require confirmation before writing
|
|
777
|
+
* These are typically documentation/knowledge-base paths where user review is important
|
|
778
|
+
*/
|
|
779
|
+
static CONFIRM_WRITE_PATHS = ['knowledge-base/', 'docs/'];
|
|
780
|
+
/**
|
|
781
|
+
* Pending writes that require confirmation
|
|
782
|
+
* These are queued during pipeline execution and processed at the end
|
|
783
|
+
*/
|
|
784
|
+
pendingWrites = [];
|
|
785
|
+
/**
|
|
786
|
+
* Write content to a file
|
|
787
|
+
*/
|
|
788
|
+
async executeWrite(args) {
|
|
789
|
+
const path = args['path'];
|
|
790
|
+
const content = args['content'];
|
|
791
|
+
if (!path || content === undefined) {
|
|
792
|
+
throw new Error('write requires path and content arguments');
|
|
793
|
+
}
|
|
794
|
+
const fullPath = this.validateAndResolvePath(path, 'write to');
|
|
795
|
+
// Check if this is a protected file that already exists
|
|
796
|
+
const fileName = path.split('/').pop() ?? path;
|
|
797
|
+
const isProtectedFile = ToolExecutionService.PROTECTED_FILES.some((protectedFile) => fileName === protectedFile || path.endsWith(`/${protectedFile}`));
|
|
798
|
+
// Allow writes to protected files only if they were read first
|
|
799
|
+
// This prevents blind overwrites while allowing intentional updates
|
|
800
|
+
if (isProtectedFile && existsSync(fullPath) && !this.readFiles.has(fullPath)) {
|
|
801
|
+
throw new Error(`Cannot overwrite existing protected file: ${path}. ` +
|
|
802
|
+
`This file already exists and is protected from accidental overwrite. ` +
|
|
803
|
+
`Use 'read_file' to see its current contents first, then you can overwrite it.`);
|
|
804
|
+
}
|
|
805
|
+
// Check if this path requires confirmation
|
|
806
|
+
const requiresConfirmation = ToolExecutionService.CONFIRM_WRITE_PATHS.some((confirmPath) => path.includes(confirmPath) || fullPath.includes(confirmPath));
|
|
807
|
+
if (requiresConfirmation) {
|
|
808
|
+
// Queue the write for confirmation at the end of pipeline
|
|
809
|
+
this.pendingWrites.push({ content, fullPath, path });
|
|
810
|
+
this.logger.info(`Queued file for confirmation: ${path}`, {
|
|
811
|
+
contentLength: content.length,
|
|
812
|
+
pendingCount: this.pendingWrites.length
|
|
813
|
+
});
|
|
814
|
+
return `File queued for writing: ${path} (will confirm at end of pipeline)`;
|
|
815
|
+
}
|
|
816
|
+
await writeFile(fullPath, content);
|
|
817
|
+
this.logger.info(`Created/updated file: ${fullPath}`, {
|
|
818
|
+
contentLength: content.length
|
|
819
|
+
});
|
|
820
|
+
return `Successfully wrote ${content.length} characters to ${path}`;
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Check if there are pending writes that need confirmation
|
|
824
|
+
*/
|
|
825
|
+
hasPendingWrites() {
|
|
826
|
+
return this.pendingWrites.length > 0;
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Get the count of pending writes
|
|
830
|
+
*/
|
|
831
|
+
getPendingWritesCount() {
|
|
832
|
+
return this.pendingWrites.length;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Process all pending writes with user confirmation
|
|
836
|
+
* Called at the end of pipeline execution
|
|
837
|
+
* Returns the number of files successfully written
|
|
838
|
+
*/
|
|
839
|
+
async flushPendingWrites() {
|
|
840
|
+
if (this.pendingWrites.length === 0) {
|
|
841
|
+
return { skipped: 0, written: 0 };
|
|
842
|
+
}
|
|
843
|
+
const approver = new PendingWriteApproverService(getConsoleOutput(), getColorAdapter(), getPromptAdapter(), this.logger);
|
|
844
|
+
const result = await approver.flush(this.pendingWrites);
|
|
845
|
+
// Clear the pending writes
|
|
846
|
+
this.pendingWrites = [];
|
|
847
|
+
return result;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Maximum file size to read (1MB) - prevents reading extremely large files
|
|
851
|
+
* that could cause context overflow
|
|
852
|
+
*/
|
|
853
|
+
static MAX_READ_FILE_SIZE = 1 * 1024 * 1024;
|
|
854
|
+
/**
|
|
855
|
+
* Paths that should not be read (contain sensitive or very large data)
|
|
856
|
+
*/
|
|
857
|
+
static BLOCKED_READ_PATHS = ['.valora/sessions', 'node_modules', '.git/objects'];
|
|
858
|
+
/**
|
|
859
|
+
* Protected files that should not be overwritten if they already exist.
|
|
860
|
+
* The write tool will reject attempts to overwrite these files and suggest
|
|
861
|
+
* using search_replace instead.
|
|
862
|
+
*/
|
|
863
|
+
static PROTECTED_FILES = [
|
|
864
|
+
'.gitignore',
|
|
865
|
+
'.gitattributes',
|
|
866
|
+
'.env',
|
|
867
|
+
'.env.local',
|
|
868
|
+
'.env.production',
|
|
869
|
+
'.env.development',
|
|
870
|
+
'.npmrc',
|
|
871
|
+
'.nvmrc',
|
|
872
|
+
'.editorconfig',
|
|
873
|
+
'package.json',
|
|
874
|
+
'package-lock.json',
|
|
875
|
+
'pnpm-lock.yaml',
|
|
876
|
+
'yarn.lock',
|
|
877
|
+
'bun.lockb',
|
|
878
|
+
'tsconfig.json'
|
|
879
|
+
];
|
|
880
|
+
/**
|
|
881
|
+
* Read file contents
|
|
882
|
+
*/
|
|
883
|
+
async executeReadFile(args) {
|
|
884
|
+
const path = args['path'];
|
|
885
|
+
if (!path) {
|
|
886
|
+
throw new Error('read_file requires path argument');
|
|
887
|
+
}
|
|
888
|
+
// Check if path is in a blocked directory using find for lookup
|
|
889
|
+
const blockedPath = ToolExecutionService.BLOCKED_READ_PATHS.find((blocked) => path.includes(blocked));
|
|
890
|
+
if (blockedPath) {
|
|
891
|
+
throw new Error(`Cannot read files in ${blockedPath} - these files may be very large or contain session data`);
|
|
892
|
+
}
|
|
893
|
+
const fullPath = this.resolvePath(path);
|
|
894
|
+
if (!existsSync(fullPath)) {
|
|
895
|
+
throw new Error(`File not found: ${path}`);
|
|
896
|
+
}
|
|
897
|
+
// Check file size before reading
|
|
898
|
+
const stat = statSync(fullPath);
|
|
899
|
+
if (stat.size > ToolExecutionService.MAX_READ_FILE_SIZE) {
|
|
900
|
+
throw new Error(`File too large to read: ${path} (${Math.round(stat.size / 1024)}KB > ${Math.round(ToolExecutionService.MAX_READ_FILE_SIZE / 1024)}KB limit)`);
|
|
901
|
+
}
|
|
902
|
+
this.validateNotStructuredFile(path);
|
|
903
|
+
const content = await readFile(fullPath);
|
|
904
|
+
this.validateFileLineCount(path, content);
|
|
905
|
+
// Track that this file was read (enables writes to protected files)
|
|
906
|
+
this.readFiles.add(fullPath);
|
|
907
|
+
return content;
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Enforce modern CLI tool usage: block structured files (JSON/YAML/TOML/XML).
|
|
911
|
+
*/
|
|
912
|
+
validateNotStructuredFile(path) {
|
|
913
|
+
const structuredFileExtensions = ['.json', '.yaml', '.yml', '.toml', '.xml'];
|
|
914
|
+
const isStructuredFile = structuredFileExtensions.some((ext) => path.toLowerCase().endsWith(ext));
|
|
915
|
+
if (!isStructuredFile) {
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
const tool = path.endsWith('.json') ? 'jq' : 'yq';
|
|
919
|
+
throw new Error(`Cannot use read_file for structured files: ${path}\n\n` +
|
|
920
|
+
`Structured files (JSON/YAML/TOML/XML) must be read with ${tool} via run_terminal_cmd.\n\n` +
|
|
921
|
+
`Use instead:\n` +
|
|
922
|
+
` run_terminal_cmd("${tool} '.' ${path}") # Read entire file\n` +
|
|
923
|
+
` run_terminal_cmd("${tool} '.key' ${path}") # Extract specific field\n\n` +
|
|
924
|
+
`This saves 85-95% of tokens compared to read_file.`);
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Enforce modern CLI tool usage: block files with >100 lines.
|
|
928
|
+
*/
|
|
929
|
+
validateFileLineCount(path, content) {
|
|
930
|
+
const lineCount = content.split('\n').length;
|
|
931
|
+
if (lineCount <= 100) {
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
const fileName = path.split('/').pop() ?? path;
|
|
935
|
+
let suggestion = `run_terminal_cmd("rg '^## ' ${path}") # Get markdown structure`;
|
|
936
|
+
if (fileName.includes('PRD') || fileName.includes('BACKLOG') || fileName.includes('FUNCTIONAL')) {
|
|
937
|
+
suggestion =
|
|
938
|
+
`run_terminal_cmd("rg '^## ' ${path}") # Get document structure\n` +
|
|
939
|
+
` run_terminal_cmd("rg -A 50 '^## Functional Requirements' ${path}") # Extract section`;
|
|
940
|
+
}
|
|
941
|
+
else if (fileName.endsWith('.ts') || fileName.endsWith('.tsx') || fileName.endsWith('.js')) {
|
|
942
|
+
suggestion = `run_terminal_cmd("rg -A 10 'class|function|export' ${path}") # Extract key definitions`;
|
|
943
|
+
}
|
|
944
|
+
throw new Error(`File too large: ${path} (${lineCount} lines > 100 line limit)\n\n` +
|
|
945
|
+
`Files with >100 lines must be read with selective extraction via run_terminal_cmd.\n\n` +
|
|
946
|
+
`Use instead:\n ${suggestion}\n\n` +
|
|
947
|
+
`This saves 80-90% of tokens compared to reading the entire file.`);
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Search and replace in a file
|
|
951
|
+
*/
|
|
952
|
+
async executeSearchReplace(args) {
|
|
953
|
+
const path = args['path'];
|
|
954
|
+
const oldStr = args['old_str'];
|
|
955
|
+
const newStr = args['new_str'];
|
|
956
|
+
if (!path || oldStr === undefined || newStr === undefined) {
|
|
957
|
+
throw new Error('search_replace requires path, old_str, and new_str arguments');
|
|
958
|
+
}
|
|
959
|
+
const fullPath = this.validateAndResolvePath(path, 'modify');
|
|
960
|
+
if (!existsSync(fullPath)) {
|
|
961
|
+
throw new Error(`File not found: ${path}`);
|
|
962
|
+
}
|
|
963
|
+
const content = await readFile(fullPath);
|
|
964
|
+
if (!content.includes(oldStr)) {
|
|
965
|
+
throw new Error(`Text not found in file: "${oldStr.substring(0, 50)}..."`);
|
|
966
|
+
}
|
|
967
|
+
const newContent = content.replace(oldStr, newStr);
|
|
968
|
+
await writeFile(fullPath, newContent);
|
|
969
|
+
this.logger.info(`Updated file: ${fullPath}`, {
|
|
970
|
+
newStrLength: newStr.length,
|
|
971
|
+
oldStrLength: oldStr.length
|
|
972
|
+
});
|
|
973
|
+
return `Successfully replaced text in ${path}`;
|
|
974
|
+
}
|
|
975
|
+
/**
|
|
976
|
+
* Delete a file
|
|
977
|
+
*/
|
|
978
|
+
executeDeleteFile(args) {
|
|
979
|
+
const path = args['path'];
|
|
980
|
+
if (!path) {
|
|
981
|
+
return Promise.reject(new Error('delete_file requires path argument'));
|
|
982
|
+
}
|
|
983
|
+
try {
|
|
984
|
+
const fullPath = this.validateAndResolvePath(path, 'delete');
|
|
985
|
+
if (!existsSync(fullPath)) {
|
|
986
|
+
return Promise.reject(new Error(`File not found: ${path}`));
|
|
987
|
+
}
|
|
988
|
+
rmSync(fullPath);
|
|
989
|
+
this.logger.info(`Deleted file: ${fullPath}`);
|
|
990
|
+
return Promise.resolve(`Successfully deleted ${path}`);
|
|
991
|
+
}
|
|
992
|
+
catch (error) {
|
|
993
|
+
return Promise.reject(error);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* Execute a terminal command
|
|
998
|
+
*/
|
|
999
|
+
async executeTerminalCmd(args) {
|
|
1000
|
+
const command = args['command'];
|
|
1001
|
+
const timeoutMs = args['timeout_ms'] ?? DEFAULT_TIMEOUT_MS;
|
|
1002
|
+
if (!command) {
|
|
1003
|
+
throw new Error('run_terminal_cmd requires command argument');
|
|
1004
|
+
}
|
|
1005
|
+
this.logger.info(`Executing command: ${command}`);
|
|
1006
|
+
try {
|
|
1007
|
+
const { stderr, stdout } = await execAsync(command, {
|
|
1008
|
+
cwd: this.workingDir,
|
|
1009
|
+
timeout: timeoutMs
|
|
1010
|
+
});
|
|
1011
|
+
const output = stdout + (stderr ? `\nStderr: ${stderr}` : '');
|
|
1012
|
+
return output || 'Command completed successfully (no output)';
|
|
1013
|
+
}
|
|
1014
|
+
catch (error) {
|
|
1015
|
+
const execError = error;
|
|
1016
|
+
const output = (execError.stdout ?? '') + (execError.stderr ?? '');
|
|
1017
|
+
throw new Error(`Command failed: ${output || error.message}`);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* List directory contents
|
|
1022
|
+
*/
|
|
1023
|
+
executeListDir(args) {
|
|
1024
|
+
const path = args['path'] ?? '.';
|
|
1025
|
+
const fullPath = this.resolvePath(path);
|
|
1026
|
+
if (!existsSync(fullPath)) {
|
|
1027
|
+
return Promise.reject(new Error(`Directory not found: ${path}`));
|
|
1028
|
+
}
|
|
1029
|
+
const stat = statSync(fullPath);
|
|
1030
|
+
if (!stat.isDirectory()) {
|
|
1031
|
+
return Promise.reject(new Error(`Not a directory: ${path}`));
|
|
1032
|
+
}
|
|
1033
|
+
const entries = readdirSync(fullPath, { withFileTypes: true });
|
|
1034
|
+
const formatted = entries.map((entry) => {
|
|
1035
|
+
const prefix = entry.isDirectory() ? '[DIR]' : '[FILE]';
|
|
1036
|
+
return `${prefix} ${entry.name}`;
|
|
1037
|
+
});
|
|
1038
|
+
return Promise.resolve(formatted.join('\n'));
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* Web search (placeholder - would integrate with actual web search)
|
|
1042
|
+
*/
|
|
1043
|
+
executeWebSearch(args) {
|
|
1044
|
+
const query = args['query'];
|
|
1045
|
+
if (!query) {
|
|
1046
|
+
throw new Error('web_search requires query argument');
|
|
1047
|
+
}
|
|
1048
|
+
return Promise.resolve(`Web search not implemented. Query: ${query}`);
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Resolve a path relative to the working directory
|
|
1052
|
+
*/
|
|
1053
|
+
resolvePath(path) {
|
|
1054
|
+
if (path.startsWith('/')) {
|
|
1055
|
+
return path;
|
|
1056
|
+
}
|
|
1057
|
+
return `${this.workingDir}/${path}`;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Validate and resolve a path for write operations.
|
|
1061
|
+
* Validates both the original path and the resolved full path against forbidden paths.
|
|
1062
|
+
*
|
|
1063
|
+
* @param path - The path to validate and resolve
|
|
1064
|
+
* @param operation - The operation being attempted (e.g., "write to", "delete", "modify")
|
|
1065
|
+
* @returns The resolved full path
|
|
1066
|
+
* @throws Error if the path is in a forbidden location
|
|
1067
|
+
*/
|
|
1068
|
+
validateAndResolvePath(path, operation) {
|
|
1069
|
+
// Validate the original path
|
|
1070
|
+
validateNotForbiddenPath(path, operation);
|
|
1071
|
+
const fullPath = this.resolvePath(path);
|
|
1072
|
+
// Also validate the resolved path (catches absolute path manipulation)
|
|
1073
|
+
validateNotForbiddenPath(fullPath, operation);
|
|
1074
|
+
return fullPath;
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Get a summary of tool arguments for logging
|
|
1078
|
+
* Returns the primary argument value that identifies what the tool is operating on
|
|
1079
|
+
*/
|
|
1080
|
+
getToolArgSummary(toolName, args) {
|
|
1081
|
+
// Map of tool names to their primary argument keys
|
|
1082
|
+
const primaryArgKeys = {
|
|
1083
|
+
codebase_search: ['query'],
|
|
1084
|
+
delete_file: ['path'],
|
|
1085
|
+
glob_file_search: ['pattern'],
|
|
1086
|
+
grep: ['pattern', 'path'],
|
|
1087
|
+
list_dir: ['path'],
|
|
1088
|
+
mcp_tool_call: ['tool_name'],
|
|
1089
|
+
query_session: ['action', 'query', 'session_id'],
|
|
1090
|
+
read_file: ['path'],
|
|
1091
|
+
run_terminal_cmd: ['command'],
|
|
1092
|
+
search_replace: ['path'],
|
|
1093
|
+
web_search: ['query'],
|
|
1094
|
+
write: ['path']
|
|
1095
|
+
};
|
|
1096
|
+
const keys = primaryArgKeys[toolName];
|
|
1097
|
+
if (!keys) {
|
|
1098
|
+
return '';
|
|
1099
|
+
}
|
|
1100
|
+
const values = keys
|
|
1101
|
+
.map((key) => {
|
|
1102
|
+
const value = args[key];
|
|
1103
|
+
if (value === undefined || value === null) {
|
|
1104
|
+
return null;
|
|
1105
|
+
}
|
|
1106
|
+
const strValue = String(value);
|
|
1107
|
+
// Truncate long values
|
|
1108
|
+
return strValue.length > 50 ? `${strValue.slice(0, 47)}...` : strValue;
|
|
1109
|
+
})
|
|
1110
|
+
.filter(Boolean);
|
|
1111
|
+
return values.join(', ');
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Singleton instance for the tool execution service
|
|
1116
|
+
*/
|
|
1117
|
+
let toolExecutionService = null;
|
|
1118
|
+
export function getToolExecutionService(workingDir) {
|
|
1119
|
+
if (!toolExecutionService || workingDir) {
|
|
1120
|
+
toolExecutionService = new ToolExecutionService(workingDir);
|
|
1121
|
+
}
|
|
1122
|
+
return toolExecutionService;
|
|
1123
|
+
}
|
|
1124
|
+
//# sourceMappingURL=tool-execution.service.js.map
|