atabey 0.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/ATABEY.md +258 -0
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/bin/cli.js +26 -0
- package/bin/validate-agent-army.js +145 -0
- package/dist/framework-mcp/src/constants.d.ts +47 -0
- package/dist/framework-mcp/src/constants.js +65 -0
- package/dist/framework-mcp/src/constants.js.map +1 -0
- package/dist/framework-mcp/src/index.d.ts +1 -0
- package/dist/framework-mcp/src/index.js +120 -0
- package/dist/framework-mcp/src/index.js.map +1 -0
- package/dist/framework-mcp/src/tools/control_plane/locking.d.ts +9 -0
- package/dist/framework-mcp/src/tools/control_plane/locking.js +83 -0
- package/dist/framework-mcp/src/tools/control_plane/locking.js.map +1 -0
- package/dist/framework-mcp/src/tools/control_plane/registry.d.ts +6 -0
- package/dist/framework-mcp/src/tools/control_plane/registry.js +35 -0
- package/dist/framework-mcp/src/tools/control_plane/registry.js.map +1 -0
- package/dist/framework-mcp/src/tools/definitions.d.ts +2 -0
- package/dist/framework-mcp/src/tools/definitions.js +291 -0
- package/dist/framework-mcp/src/tools/definitions.js.map +1 -0
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.d.ts +5 -0
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js +60 -0
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js.map +1 -0
- package/dist/framework-mcp/src/tools/file_system/patch_file.d.ts +2 -0
- package/dist/framework-mcp/src/tools/file_system/patch_file.js +26 -0
- package/dist/framework-mcp/src/tools/file_system/patch_file.js.map +1 -0
- package/dist/framework-mcp/src/tools/file_system/read_file.d.ts +2 -0
- package/dist/framework-mcp/src/tools/file_system/read_file.js +52 -0
- package/dist/framework-mcp/src/tools/file_system/read_file.js.map +1 -0
- package/dist/framework-mcp/src/tools/file_system/replace_text.d.ts +2 -0
- package/dist/framework-mcp/src/tools/file_system/replace_text.js +46 -0
- package/dist/framework-mcp/src/tools/file_system/replace_text.js.map +1 -0
- package/dist/framework-mcp/src/tools/file_system/write_file.d.ts +2 -0
- package/dist/framework-mcp/src/tools/file_system/write_file.js +39 -0
- package/dist/framework-mcp/src/tools/file_system/write_file.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/audit_deps.d.ts +6 -0
- package/dist/framework-mcp/src/tools/framework/audit_deps.js +42 -0
- package/dist/framework-mcp/src/tools/framework/audit_deps.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/get_status.d.ts +2 -0
- package/dist/framework-mcp/src/tools/framework/get_status.js +6 -0
- package/dist/framework-mcp/src/tools/framework/get_status.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/orchestrate.d.ts +2 -0
- package/dist/framework-mcp/src/tools/framework/orchestrate.js +6 -0
- package/dist/framework-mcp/src/tools/framework/orchestrate.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/run_tests.d.ts +5 -0
- package/dist/framework-mcp/src/tools/framework/run_tests.js +26 -0
- package/dist/framework-mcp/src/tools/framework/run_tests.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/update_contract_hash.d.ts +2 -0
- package/dist/framework-mcp/src/tools/framework/update_contract_hash.js +6 -0
- package/dist/framework-mcp/src/tools/framework/update_contract_hash.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/update_memory.d.ts +2 -0
- package/dist/framework-mcp/src/tools/framework/update_memory.js +9 -0
- package/dist/framework-mcp/src/tools/framework/update_memory.js.map +1 -0
- package/dist/framework-mcp/src/tools/index.d.ts +4 -0
- package/dist/framework-mcp/src/tools/index.js +61 -0
- package/dist/framework-mcp/src/tools/index.js.map +1 -0
- package/dist/framework-mcp/src/tools/memory/get_insights.d.ts +6 -0
- package/dist/framework-mcp/src/tools/memory/get_insights.js +35 -0
- package/dist/framework-mcp/src/tools/memory/get_insights.js.map +1 -0
- package/dist/framework-mcp/src/tools/memory/read_memory.d.ts +6 -0
- package/dist/framework-mcp/src/tools/memory/read_memory.js +29 -0
- package/dist/framework-mcp/src/tools/memory/read_memory.js.map +1 -0
- package/dist/framework-mcp/src/tools/messaging/log_action.d.ts +2 -0
- package/dist/framework-mcp/src/tools/messaging/log_action.js +23 -0
- package/dist/framework-mcp/src/tools/messaging/log_action.js.map +1 -0
- package/dist/framework-mcp/src/tools/messaging/send_message.d.ts +2 -0
- package/dist/framework-mcp/src/tools/messaging/send_message.js +95 -0
- package/dist/framework-mcp/src/tools/messaging/send_message.js.map +1 -0
- package/dist/framework-mcp/src/tools/observability/check_ports.d.ts +5 -0
- package/dist/framework-mcp/src/tools/observability/check_ports.js +27 -0
- package/dist/framework-mcp/src/tools/observability/check_ports.js.map +1 -0
- package/dist/framework-mcp/src/tools/observability/get_health.d.ts +5 -0
- package/dist/framework-mcp/src/tools/observability/get_health.js +20 -0
- package/dist/framework-mcp/src/tools/observability/get_health.js.map +1 -0
- package/dist/framework-mcp/src/tools/quality/check_lint.d.ts +5 -0
- package/dist/framework-mcp/src/tools/quality/check_lint.js +29 -0
- package/dist/framework-mcp/src/tools/quality/check_lint.js.map +1 -0
- package/dist/framework-mcp/src/tools/search/get_gaps.d.ts +6 -0
- package/dist/framework-mcp/src/tools/search/get_gaps.js +49 -0
- package/dist/framework-mcp/src/tools/search/get_gaps.js.map +1 -0
- package/dist/framework-mcp/src/tools/search/get_map.d.ts +6 -0
- package/dist/framework-mcp/src/tools/search/get_map.js +44 -0
- package/dist/framework-mcp/src/tools/search/get_map.js.map +1 -0
- package/dist/framework-mcp/src/tools/search/grep_search.d.ts +5 -0
- package/dist/framework-mcp/src/tools/search/grep_search.js +76 -0
- package/dist/framework-mcp/src/tools/search/grep_search.js.map +1 -0
- package/dist/framework-mcp/src/tools/search/list_dir.d.ts +5 -0
- package/dist/framework-mcp/src/tools/search/list_dir.js +29 -0
- package/dist/framework-mcp/src/tools/search/list_dir.js.map +1 -0
- package/dist/framework-mcp/src/tools/shell/run_command.d.ts +2 -0
- package/dist/framework-mcp/src/tools/shell/run_command.js +47 -0
- package/dist/framework-mcp/src/tools/shell/run_command.js.map +1 -0
- package/dist/framework-mcp/src/tools/types.d.ts +120 -0
- package/dist/framework-mcp/src/tools/types.js +2 -0
- package/dist/framework-mcp/src/tools/types.js.map +1 -0
- package/dist/framework-mcp/src/utils/cli.d.ts +5 -0
- package/dist/framework-mcp/src/utils/cli.js +21 -0
- package/dist/framework-mcp/src/utils/cli.js.map +1 -0
- package/dist/framework-mcp/src/utils/compliance.d.ts +5 -0
- package/dist/framework-mcp/src/utils/compliance.js +79 -0
- package/dist/framework-mcp/src/utils/compliance.js.map +1 -0
- package/dist/framework-mcp/src/utils/fs.d.ts +16 -0
- package/dist/framework-mcp/src/utils/fs.js +45 -0
- package/dist/framework-mcp/src/utils/fs.js.map +1 -0
- package/dist/framework-mcp/src/utils/metrics.d.ts +30 -0
- package/dist/framework-mcp/src/utils/metrics.js +57 -0
- package/dist/framework-mcp/src/utils/metrics.js.map +1 -0
- package/dist/framework-mcp/src/utils/security.d.ts +10 -0
- package/dist/framework-mcp/src/utils/security.js +61 -0
- package/dist/framework-mcp/src/utils/security.js.map +1 -0
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js +192 -0
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js.map +1 -0
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js +115 -0
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js.map +1 -0
- package/dist/framework-mcp/tests/tools/quality/check_lint.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/quality/check_lint.test.js +36 -0
- package/dist/framework-mcp/tests/tools/quality/check_lint.test.js.map +1 -0
- package/dist/framework-mcp/tests/tools/shell/run_command.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/shell/run_command.test.js +43 -0
- package/dist/framework-mcp/tests/tools/shell/run_command.test.js.map +1 -0
- package/dist/src/cli/adapters/core.d.ts +12 -0
- package/dist/src/cli/adapters/core.js +55 -0
- package/dist/src/cli/adapters/core.js.map +1 -0
- package/dist/src/cli/adapters/index.d.ts +5 -0
- package/dist/src/cli/adapters/index.js +6 -0
- package/dist/src/cli/adapters/index.js.map +1 -0
- package/dist/src/cli/adapters/paths.d.ts +15 -0
- package/dist/src/cli/adapters/paths.js +102 -0
- package/dist/src/cli/adapters/paths.js.map +1 -0
- package/dist/src/cli/adapters/scaffold.d.ts +2 -0
- package/dist/src/cli/adapters/scaffold.js +72 -0
- package/dist/src/cli/adapters/scaffold.js.map +1 -0
- package/dist/src/cli/adapters/utils.d.ts +4 -0
- package/dist/src/cli/adapters/utils.js +76 -0
- package/dist/src/cli/adapters/utils.js.map +1 -0
- package/dist/src/cli/commands/approve.d.ts +1 -0
- package/dist/src/cli/commands/approve.js +64 -0
- package/dist/src/cli/commands/approve.js.map +1 -0
- package/dist/src/cli/commands/check.d.ts +1 -0
- package/dist/src/cli/commands/check.js +180 -0
- package/dist/src/cli/commands/check.js.map +1 -0
- package/dist/src/cli/commands/compliance.d.ts +1 -0
- package/dist/src/cli/commands/compliance.js +51 -0
- package/dist/src/cli/commands/compliance.js.map +1 -0
- package/dist/src/cli/commands/contract.d.ts +10 -0
- package/dist/src/cli/commands/contract.js +51 -0
- package/dist/src/cli/commands/contract.js.map +1 -0
- package/dist/src/cli/commands/explorer.d.ts +2 -0
- package/dist/src/cli/commands/explorer.js +43 -0
- package/dist/src/cli/commands/explorer.js.map +1 -0
- package/dist/src/cli/commands/git.d.ts +2 -0
- package/dist/src/cli/commands/git.js +41 -0
- package/dist/src/cli/commands/git.js.map +1 -0
- package/dist/src/cli/commands/init/scaffold-core.d.ts +7 -0
- package/dist/src/cli/commands/init/scaffold-core.js +102 -0
- package/dist/src/cli/commands/init/scaffold-core.js.map +1 -0
- package/dist/src/cli/commands/init/scaffold-ops.d.ts +1 -0
- package/dist/src/cli/commands/init/scaffold-ops.js +81 -0
- package/dist/src/cli/commands/init/scaffold-ops.js.map +1 -0
- package/dist/src/cli/commands/init/scaffold-standards.d.ts +2 -0
- package/dist/src/cli/commands/init/scaffold-standards.js +66 -0
- package/dist/src/cli/commands/init/scaffold-standards.js.map +1 -0
- package/dist/src/cli/commands/init.d.ts +5 -0
- package/dist/src/cli/commands/init.js +128 -0
- package/dist/src/cli/commands/init.js.map +1 -0
- package/dist/src/cli/commands/knowledge.d.ts +2 -0
- package/dist/src/cli/commands/knowledge.js +43 -0
- package/dist/src/cli/commands/knowledge.js.map +1 -0
- package/dist/src/cli/commands/lint.d.ts +4 -0
- package/dist/src/cli/commands/lint.js +23 -0
- package/dist/src/cli/commands/lint.js.map +1 -0
- package/dist/src/cli/commands/log.d.ts +10 -0
- package/dist/src/cli/commands/log.js +33 -0
- package/dist/src/cli/commands/log.js.map +1 -0
- package/dist/src/cli/commands/memory.d.ts +1 -0
- package/dist/src/cli/commands/memory.js +5 -0
- package/dist/src/cli/commands/memory.js.map +1 -0
- package/dist/src/cli/commands/orchestrate.d.ts +67 -0
- package/dist/src/cli/commands/orchestrate.js +414 -0
- package/dist/src/cli/commands/orchestrate.js.map +1 -0
- package/dist/src/cli/commands/plan.d.ts +6 -0
- package/dist/src/cli/commands/plan.js +97 -0
- package/dist/src/cli/commands/plan.js.map +1 -0
- package/dist/src/cli/commands/script.d.ts +1 -0
- package/dist/src/cli/commands/script.js +20 -0
- package/dist/src/cli/commands/script.js.map +1 -0
- package/dist/src/cli/commands/security.d.ts +1 -0
- package/dist/src/cli/commands/security.js +37 -0
- package/dist/src/cli/commands/security.js.map +1 -0
- package/dist/src/cli/commands/status.d.ts +4 -0
- package/dist/src/cli/commands/status.js +41 -0
- package/dist/src/cli/commands/status.js.map +1 -0
- package/dist/src/cli/commands/trace.d.ts +4 -0
- package/dist/src/cli/commands/trace.js +29 -0
- package/dist/src/cli/commands/trace.js.map +1 -0
- package/dist/src/cli/index.d.ts +2 -0
- package/dist/src/cli/index.js +289 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/cli/shims.d.ts +1 -0
- package/dist/src/cli/shims.js +67 -0
- package/dist/src/cli/shims.js.map +1 -0
- package/dist/src/cli/utils/claude.d.ts +8 -0
- package/dist/src/cli/utils/claude.js +57 -0
- package/dist/src/cli/utils/claude.js.map +1 -0
- package/dist/src/cli/utils/compliance.d.ts +11 -0
- package/dist/src/cli/utils/compliance.js +168 -0
- package/dist/src/cli/utils/compliance.js.map +1 -0
- package/dist/src/cli/utils/config-schema.d.ts +139 -0
- package/dist/src/cli/utils/config-schema.js +43 -0
- package/dist/src/cli/utils/config-schema.js.map +1 -0
- package/dist/src/cli/utils/fs.d.ts +10 -0
- package/dist/src/cli/utils/fs.js +138 -0
- package/dist/src/cli/utils/fs.js.map +1 -0
- package/dist/src/cli/utils/memory.d.ts +30 -0
- package/dist/src/cli/utils/memory.js +269 -0
- package/dist/src/cli/utils/memory.js.map +1 -0
- package/dist/src/cli/utils/pkg.d.ts +43 -0
- package/dist/src/cli/utils/pkg.js +283 -0
- package/dist/src/cli/utils/pkg.js.map +1 -0
- package/dist/src/cli/utils/schemas.d.ts +49 -0
- package/dist/src/cli/utils/schemas.js +20 -0
- package/dist/src/cli/utils/schemas.js.map +1 -0
- package/dist/src/cli/utils/string.d.ts +7 -0
- package/dist/src/cli/utils/string.js +50 -0
- package/dist/src/cli/utils/string.js.map +1 -0
- package/dist/src/cli/utils/time.d.ts +2 -0
- package/dist/src/cli/utils/time.js +28 -0
- package/dist/src/cli/utils/time.js.map +1 -0
- package/dist/src/cli/utils/ui.d.ts +30 -0
- package/dist/src/cli/utils/ui.js +59 -0
- package/dist/src/cli/utils/ui.js.map +1 -0
- package/dist/src/contracts/index.d.ts +1 -0
- package/dist/src/contracts/index.js +2 -0
- package/dist/src/contracts/index.js.map +1 -0
- package/dist/src/contracts/tasks.d.ts +44 -0
- package/dist/src/contracts/tasks.js +21 -0
- package/dist/src/contracts/tasks.js.map +1 -0
- package/dist/src/modules/adapters/definitions.d.ts +9 -0
- package/dist/src/modules/adapters/definitions.js +141 -0
- package/dist/src/modules/adapters/definitions.js.map +1 -0
- package/dist/src/modules/adapters/registry.d.ts +12 -0
- package/dist/src/modules/adapters/registry.js +19 -0
- package/dist/src/modules/adapters/registry.js.map +1 -0
- package/dist/src/modules/adapters/shared.d.ts +1 -0
- package/dist/src/modules/adapters/shared.js +105 -0
- package/dist/src/modules/adapters/shared.js.map +1 -0
- package/dist/src/modules/adapters/types.d.ts +14 -0
- package/dist/src/modules/adapters/types.js +2 -0
- package/dist/src/modules/adapters/types.js.map +1 -0
- package/dist/src/modules/agents/definitions.d.ts +15 -0
- package/dist/src/modules/agents/definitions.js +401 -0
- package/dist/src/modules/agents/definitions.js.map +1 -0
- package/dist/src/modules/agents/registry/analyst.d.ts +2 -0
- package/dist/src/modules/agents/registry/analyst.js +40 -0
- package/dist/src/modules/agents/registry/analyst.js.map +1 -0
- package/dist/src/modules/agents/registry/architect.d.ts +2 -0
- package/dist/src/modules/agents/registry/architect.js +43 -0
- package/dist/src/modules/agents/registry/architect.js.map +1 -0
- package/dist/src/modules/agents/registry/backend.d.ts +2 -0
- package/dist/src/modules/agents/registry/backend.js +43 -0
- package/dist/src/modules/agents/registry/backend.js.map +1 -0
- package/dist/src/modules/agents/registry/database.d.ts +2 -0
- package/dist/src/modules/agents/registry/database.js +39 -0
- package/dist/src/modules/agents/registry/database.js.map +1 -0
- package/dist/src/modules/agents/registry/devops.d.ts +2 -0
- package/dist/src/modules/agents/registry/devops.js +40 -0
- package/dist/src/modules/agents/registry/devops.js.map +1 -0
- package/dist/src/modules/agents/registry/explorer.d.ts +2 -0
- package/dist/src/modules/agents/registry/explorer.js +37 -0
- package/dist/src/modules/agents/registry/explorer.js.map +1 -0
- package/dist/src/modules/agents/registry/frontend.d.ts +2 -0
- package/dist/src/modules/agents/registry/frontend.js +44 -0
- package/dist/src/modules/agents/registry/frontend.js.map +1 -0
- package/dist/src/modules/agents/registry/git.d.ts +2 -0
- package/dist/src/modules/agents/registry/git.js +37 -0
- package/dist/src/modules/agents/registry/git.js.map +1 -0
- package/dist/src/modules/agents/registry/manager.d.ts +2 -0
- package/dist/src/modules/agents/registry/manager.js +54 -0
- package/dist/src/modules/agents/registry/manager.js.map +1 -0
- package/dist/src/modules/agents/registry/mobile.d.ts +2 -0
- package/dist/src/modules/agents/registry/mobile.js +40 -0
- package/dist/src/modules/agents/registry/mobile.js.map +1 -0
- package/dist/src/modules/agents/registry/native.d.ts +2 -0
- package/dist/src/modules/agents/registry/native.js +40 -0
- package/dist/src/modules/agents/registry/native.js.map +1 -0
- package/dist/src/modules/agents/registry/quality.d.ts +2 -0
- package/dist/src/modules/agents/registry/quality.js +42 -0
- package/dist/src/modules/agents/registry/quality.js.map +1 -0
- package/dist/src/modules/agents/registry/security.d.ts +2 -0
- package/dist/src/modules/agents/registry/security.js +38 -0
- package/dist/src/modules/agents/registry/security.js.map +1 -0
- package/dist/src/modules/agents/types.d.ts +31 -0
- package/dist/src/modules/agents/types.js +2 -0
- package/dist/src/modules/agents/types.js.map +1 -0
- package/dist/src/modules/skills/definitions.d.ts +48 -0
- package/dist/src/modules/skills/definitions.js +71 -0
- package/dist/src/modules/skills/definitions.js.map +1 -0
- package/dist/src/shared/constants.d.ts +116 -0
- package/dist/src/shared/constants.js +184 -0
- package/dist/src/shared/constants.js.map +1 -0
- package/dist/src/shared/errors.d.ts +46 -0
- package/dist/src/shared/errors.js +69 -0
- package/dist/src/shared/errors.js.map +1 -0
- package/dist/src/shared/fs.d.ts +8 -0
- package/dist/src/shared/fs.js +48 -0
- package/dist/src/shared/fs.js.map +1 -0
- package/dist/src/shared/logger.d.ts +28 -0
- package/dist/src/shared/logger.js +117 -0
- package/dist/src/shared/logger.js.map +1 -0
- package/dist/src/shared/types.d.ts +19 -0
- package/dist/src/shared/types.js +13 -0
- package/dist/src/shared/types.js.map +1 -0
- package/dist/tests/adapter.test.d.ts +1 -0
- package/dist/tests/adapter.test.js +128 -0
- package/dist/tests/adapter.test.js.map +1 -0
- package/dist/tests/adapters/paths.test.d.ts +1 -0
- package/dist/tests/adapters/paths.test.js +63 -0
- package/dist/tests/adapters/paths.test.js.map +1 -0
- package/dist/tests/agents-definitions.test.d.ts +1 -0
- package/dist/tests/agents-definitions.test.js +61 -0
- package/dist/tests/agents-definitions.test.js.map +1 -0
- package/dist/tests/approve.test.d.ts +1 -0
- package/dist/tests/approve.test.js +52 -0
- package/dist/tests/approve.test.js.map +1 -0
- package/dist/tests/cli/init/adapter_init.test.d.ts +1 -0
- package/dist/tests/cli/init/adapter_init.test.js +50 -0
- package/dist/tests/cli/init/adapter_init.test.js.map +1 -0
- package/dist/tests/cli/init/unified_init.test.d.ts +1 -0
- package/dist/tests/cli/init/unified_init.test.js +58 -0
- package/dist/tests/cli/init/unified_init.test.js.map +1 -0
- package/dist/tests/errors.test.d.ts +1 -0
- package/dist/tests/errors.test.js +64 -0
- package/dist/tests/errors.test.js.map +1 -0
- package/dist/tests/fs-utils.test.d.ts +1 -0
- package/dist/tests/fs-utils.test.js +101 -0
- package/dist/tests/fs-utils.test.js.map +1 -0
- package/dist/tests/integration/agent_flow.test.d.ts +1 -0
- package/dist/tests/integration/agent_flow.test.js +55 -0
- package/dist/tests/integration/agent_flow.test.js.map +1 -0
- package/dist/tests/integration/hermes_locking.test.d.ts +1 -0
- package/dist/tests/integration/hermes_locking.test.js +64 -0
- package/dist/tests/integration/hermes_locking.test.js.map +1 -0
- package/dist/tests/logger.test.d.ts +1 -0
- package/dist/tests/logger.test.js +81 -0
- package/dist/tests/logger.test.js.map +1 -0
- package/dist/tests/memory-utils.test.d.ts +1 -0
- package/dist/tests/memory-utils.test.js +59 -0
- package/dist/tests/memory-utils.test.js.map +1 -0
- package/dist/tests/modules/adapters/adapters.test.d.ts +1 -0
- package/dist/tests/modules/adapters/adapters.test.js +30 -0
- package/dist/tests/modules/adapters/adapters.test.js.map +1 -0
- package/dist/tests/orchestrate.test.d.ts +1 -0
- package/dist/tests/orchestrate.test.js +67 -0
- package/dist/tests/orchestrate.test.js.map +1 -0
- package/dist/tests/shared/constants.test.d.ts +1 -0
- package/dist/tests/shared/constants.test.js +17 -0
- package/dist/tests/shared/constants.test.js.map +1 -0
- package/dist/tests/skills-definitions.test.d.ts +1 -0
- package/dist/tests/skills-definitions.test.js +34 -0
- package/dist/tests/skills-definitions.test.js.map +1 -0
- package/dist/tests/status.test.d.ts +1 -0
- package/dist/tests/status.test.js +49 -0
- package/dist/tests/status.test.js.map +1 -0
- package/dist/tests/string.test.d.ts +1 -0
- package/dist/tests/string.test.js +89 -0
- package/dist/tests/string.test.js.map +1 -0
- package/dist/tests/time.test.d.ts +1 -0
- package/dist/tests/time.test.js +48 -0
- package/dist/tests/time.test.js.map +1 -0
- package/dist/tests/trace.test.d.ts +1 -0
- package/dist/tests/trace.test.js +28 -0
- package/dist/tests/trace.test.js.map +1 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +20 -0
- package/dist/vitest.config.js.map +1 -0
- package/framework-mcp/dist/constants.js +64 -0
- package/framework-mcp/dist/index.js +119 -0
- package/framework-mcp/dist/tools/control_plane/locking.js +82 -0
- package/framework-mcp/dist/tools/control_plane/registry.js +34 -0
- package/framework-mcp/dist/tools/definitions.js +290 -0
- package/framework-mcp/dist/tools/file_system/batch_surgical_edit.js +59 -0
- package/framework-mcp/dist/tools/file_system/patch_file.js +25 -0
- package/framework-mcp/dist/tools/file_system/read_file.js +51 -0
- package/framework-mcp/dist/tools/file_system/replace_text.js +45 -0
- package/framework-mcp/dist/tools/file_system/write_file.js +38 -0
- package/framework-mcp/dist/tools/framework/audit_deps.js +41 -0
- package/framework-mcp/dist/tools/framework/get_status.js +5 -0
- package/framework-mcp/dist/tools/framework/orchestrate.js +5 -0
- package/framework-mcp/dist/tools/framework/run_tests.js +25 -0
- package/framework-mcp/dist/tools/framework/update_contract_hash.js +5 -0
- package/framework-mcp/dist/tools/framework/update_memory.js +8 -0
- package/framework-mcp/dist/tools/index.js +60 -0
- package/framework-mcp/dist/tools/memory/get_insights.js +34 -0
- package/framework-mcp/dist/tools/memory/read_memory.js +28 -0
- package/framework-mcp/dist/tools/messaging/log_action.js +22 -0
- package/framework-mcp/dist/tools/messaging/send_message.js +94 -0
- package/framework-mcp/dist/tools/observability/check_ports.js +26 -0
- package/framework-mcp/dist/tools/observability/get_health.js +19 -0
- package/framework-mcp/dist/tools/quality/check_lint.js +28 -0
- package/framework-mcp/dist/tools/search/get_gaps.js +48 -0
- package/framework-mcp/dist/tools/search/get_map.js +43 -0
- package/framework-mcp/dist/tools/search/grep_search.js +75 -0
- package/framework-mcp/dist/tools/search/list_dir.js +28 -0
- package/framework-mcp/dist/tools/shell/run_command.js +46 -0
- package/framework-mcp/dist/tools/types.js +1 -0
- package/framework-mcp/dist/utils/cli.js +20 -0
- package/framework-mcp/dist/utils/compliance.js +78 -0
- package/framework-mcp/dist/utils/fs.js +44 -0
- package/framework-mcp/dist/utils/metrics.js +56 -0
- package/framework-mcp/dist/utils/security.js +60 -0
- package/framework-mcp/package-lock.json +1191 -0
- package/framework-mcp/package.json +26 -0
- package/framework-mcp/src/constants.ts +78 -0
- package/framework-mcp/src/declarations.d.ts +17 -0
- package/framework-mcp/src/index.ts +144 -0
- package/framework-mcp/src/tools/control_plane/locking.ts +89 -0
- package/framework-mcp/src/tools/control_plane/registry.ts +38 -0
- package/framework-mcp/src/tools/definitions.ts +292 -0
- package/framework-mcp/src/tools/file_system/batch_surgical_edit.ts +79 -0
- package/framework-mcp/src/tools/file_system/patch_file.ts +33 -0
- package/framework-mcp/src/tools/file_system/read_file.ts +58 -0
- package/framework-mcp/src/tools/file_system/replace_text.ts +54 -0
- package/framework-mcp/src/tools/file_system/write_file.ts +45 -0
- package/framework-mcp/src/tools/framework/audit_deps.ts +49 -0
- package/framework-mcp/src/tools/framework/get_status.ts +7 -0
- package/framework-mcp/src/tools/framework/orchestrate.ts +7 -0
- package/framework-mcp/src/tools/framework/run_tests.ts +28 -0
- package/framework-mcp/src/tools/framework/update_contract_hash.ts +7 -0
- package/framework-mcp/src/tools/framework/update_memory.ts +10 -0
- package/framework-mcp/src/tools/index.ts +64 -0
- package/framework-mcp/src/tools/memory/get_insights.ts +41 -0
- package/framework-mcp/src/tools/memory/read_memory.ts +31 -0
- package/framework-mcp/src/tools/messaging/log_action.ts +28 -0
- package/framework-mcp/src/tools/messaging/send_message.ts +97 -0
- package/framework-mcp/src/tools/observability/check_ports.ts +30 -0
- package/framework-mcp/src/tools/observability/get_health.ts +24 -0
- package/framework-mcp/src/tools/quality/check_lint.ts +33 -0
- package/framework-mcp/src/tools/search/get_gaps.ts +54 -0
- package/framework-mcp/src/tools/search/get_map.ts +48 -0
- package/framework-mcp/src/tools/search/grep_search.ts +75 -0
- package/framework-mcp/src/tools/search/list_dir.ts +34 -0
- package/framework-mcp/src/tools/shell/run_command.ts +56 -0
- package/framework-mcp/src/tools/types.ts +89 -0
- package/framework-mcp/src/utils/cli.ts +20 -0
- package/framework-mcp/src/utils/compliance.ts +95 -0
- package/framework-mcp/src/utils/fs.ts +45 -0
- package/framework-mcp/src/utils/metrics.ts +73 -0
- package/framework-mcp/src/utils/security.ts +66 -0
- package/framework-mcp/tests/tools/file_system/file_system_tools.test.ts +212 -0
- package/framework-mcp/tests/tools/messaging/send_message.test.ts +136 -0
- package/framework-mcp/tests/tools/quality/check_lint.test.ts +46 -0
- package/framework-mcp/tests/tools/shell/run_command.test.ts +55 -0
- package/framework-mcp/tsconfig.json +14 -0
- package/mcp.json +13 -0
- package/package.json +89 -0
- package/src/cli/adapters/core.ts +67 -0
- package/src/cli/adapters/index.ts +5 -0
- package/src/cli/adapters/paths.ts +135 -0
- package/src/cli/adapters/scaffold.ts +93 -0
- package/src/cli/adapters/utils.ts +87 -0
- package/src/cli/commands/approve.ts +73 -0
- package/src/cli/commands/check.ts +188 -0
- package/src/cli/commands/compliance.ts +55 -0
- package/src/cli/commands/contract.ts +68 -0
- package/src/cli/commands/explorer.ts +45 -0
- package/src/cli/commands/git.ts +39 -0
- package/src/cli/commands/init/scaffold-core.ts +128 -0
- package/src/cli/commands/init/scaffold-ops.ts +83 -0
- package/src/cli/commands/init/scaffold-standards.ts +67 -0
- package/src/cli/commands/init.ts +163 -0
- package/src/cli/commands/knowledge.ts +44 -0
- package/src/cli/commands/lint.ts +23 -0
- package/src/cli/commands/log.ts +37 -0
- package/src/cli/commands/memory.ts +6 -0
- package/src/cli/commands/orchestrate.ts +456 -0
- package/src/cli/commands/plan.ts +113 -0
- package/src/cli/commands/script.ts +20 -0
- package/src/cli/commands/security.ts +38 -0
- package/src/cli/commands/status.ts +44 -0
- package/src/cli/commands/trace.ts +31 -0
- package/src/cli/index.ts +322 -0
- package/src/cli/shims.ts +66 -0
- package/src/cli/utils/claude.ts +63 -0
- package/src/cli/utils/compliance.ts +191 -0
- package/src/cli/utils/config-schema.ts +48 -0
- package/src/cli/utils/fs.ts +170 -0
- package/src/cli/utils/memory.ts +303 -0
- package/src/cli/utils/pkg.ts +317 -0
- package/src/cli/utils/schemas.ts +22 -0
- package/src/cli/utils/string.ts +55 -0
- package/src/cli/utils/time.ts +27 -0
- package/src/cli/utils/ui.ts +66 -0
- package/src/contracts/index.ts +1 -0
- package/src/contracts/tasks.ts +26 -0
- package/src/modules/adapters/definitions.ts +171 -0
- package/src/modules/adapters/registry.ts +27 -0
- package/src/modules/adapters/shared.ts +120 -0
- package/src/modules/adapters/types.ts +16 -0
- package/src/modules/agents/definitions.ts +454 -0
- package/src/modules/agents/registry/analyst.ts +44 -0
- package/src/modules/agents/registry/architect.ts +47 -0
- package/src/modules/agents/registry/backend.ts +47 -0
- package/src/modules/agents/registry/database.ts +43 -0
- package/src/modules/agents/registry/devops.ts +44 -0
- package/src/modules/agents/registry/explorer.ts +41 -0
- package/src/modules/agents/registry/frontend.ts +48 -0
- package/src/modules/agents/registry/git.ts +41 -0
- package/src/modules/agents/registry/manager.ts +58 -0
- package/src/modules/agents/registry/mobile.ts +44 -0
- package/src/modules/agents/registry/native.ts +44 -0
- package/src/modules/agents/registry/quality.ts +46 -0
- package/src/modules/agents/registry/security.ts +42 -0
- package/src/modules/agents/types.ts +37 -0
- package/src/modules/skills/definitions.ts +71 -0
- package/src/schema/agent-lifecycle-schema.json +59 -0
- package/src/shared/constants.ts +218 -0
- package/src/shared/errors.ts +75 -0
- package/src/shared/fs.ts +50 -0
- package/src/shared/logger.ts +139 -0
- package/src/shared/types.ts +20 -0
- package/templates/prompts/bug-fix-recipe.md +20 -0
- package/templates/prompts/contract-design-recipe.md +21 -0
- package/templates/prompts/db-management-recipe.md +25 -0
- package/templates/prompts/deployment-recipe.md +23 -0
- package/templates/prompts/new-feature-recipe.md +19 -0
- package/templates/prompts/performance-optimization-recipe.md +23 -0
- package/templates/prompts/pull-request-template.md +21 -0
- package/templates/prompts/refactoring-recipe.md +21 -0
- package/templates/prompts/security-audit-recipe.md +20 -0
- package/templates/standards/architecture-standards.md +23 -0
- package/templates/standards/auth-standards.md +125 -0
- package/templates/standards/crud-governance.md +21 -0
- package/templates/standards/deployment-standards.md +21 -0
- package/templates/standards/frontend-standards.md +42 -0
- package/templates/standards/github-actions-standards.md +43 -0
- package/templates/standards/governance-standards.md +147 -0
- package/templates/standards/i18n-standards.md +29 -0
- package/templates/standards/kysely-standards.md +47 -0
- package/templates/standards/llm-governance.md +29 -0
- package/templates/standards/logging-and-secrets.md +34 -0
- package/templates/standards/mobile-standards.md +23 -0
- package/templates/standards/observability-standards.md +29 -0
- package/templates/standards/performance-standards.md +29 -0
- package/templates/standards/pino-standards.md +46 -0
- package/templates/standards/playwright-standards.md +54 -0
- package/templates/standards/quality-standards.md +32 -0
- package/templates/standards/react-query-standards.md +72 -0
- package/templates/standards/react-router-standards.md +62 -0
- package/templates/standards/security-audit-standards.md +33 -0
- package/templates/standards/security-standards.md +21 -0
- package/templates/standards/swagger-standards.md +50 -0
- package/templates/standards/tailwind-standards.md +29 -0
- package/templates/standards/testing-standards.md +31 -0
- package/templates/standards/token-economy.md +27 -0
- package/templates/standards/typeorm-standards.md +49 -0
- package/templates/standards/vitest-standards.md +110 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { safeExec } from "../../utils/cli.js";
|
|
2
|
+
import { UpdateProjectMemoryArgs, ToolResult } from "../types.js";
|
|
3
|
+
|
|
4
|
+
export function handleUpdateProjectMemory(projectRoot: string, args: UpdateProjectMemoryArgs): ToolResult {
|
|
5
|
+
const section = args.section;
|
|
6
|
+
const content = args.content;
|
|
7
|
+
// Using execFileSync with array args prevents command injection
|
|
8
|
+
safeExec("npx", ["atabey", "update_project_memory", section, content], projectRoot);
|
|
9
|
+
return { content: [{ type: "text", text: `✅ Section ${section} updated.` }] };
|
|
10
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { TOOLS } from "./definitions.js";
|
|
2
|
+
import { handleReadFile } from "./file_system/read_file.js";
|
|
3
|
+
import { handleWriteFile } from "./file_system/write_file.js";
|
|
4
|
+
import { handleReplaceText } from "./file_system/replace_text.js";
|
|
5
|
+
import { handleBatchSurgicalEdit } from "./file_system/batch_surgical_edit.js";
|
|
6
|
+
import { handlePatchFile } from "./file_system/patch_file.js";
|
|
7
|
+
import { handleGrepSearch } from "./search/grep_search.js";
|
|
8
|
+
import { handleListDir } from "./search/list_dir.js";
|
|
9
|
+
import { handleGetProjectGaps } from "./search/get_gaps.js";
|
|
10
|
+
import { handleGetProjectMap } from "./search/get_map.js";
|
|
11
|
+
import { handleGetFrameworkStatus } from "./framework/get_status.js";
|
|
12
|
+
import { handleUpdateProjectMemory } from "./framework/update_memory.js";
|
|
13
|
+
import { handleAuditDependencies } from "./framework/audit_deps.js";
|
|
14
|
+
import { handleRunTests } from "./framework/run_tests.js";
|
|
15
|
+
import { handleGetSystemHealth } from "./observability/get_health.js";
|
|
16
|
+
import { handleCheckPorts } from "./observability/check_ports.js";
|
|
17
|
+
import { handleOrchestrateLoop } from "./framework/orchestrate.js";
|
|
18
|
+
import { handleUpdateContractHash } from "./framework/update_contract_hash.js";
|
|
19
|
+
import { handleReadProjectMemory } from "./memory/read_memory.js";
|
|
20
|
+
import { handleGetMemoryInsights } from "./memory/get_insights.js";
|
|
21
|
+
import { handleSendAgentMessage } from "./messaging/send_message.js";
|
|
22
|
+
import { handleLogAgentAction } from "./messaging/log_action.js";
|
|
23
|
+
import { handleAcquireLock, handleReleaseLock } from "./control_plane/locking.js";
|
|
24
|
+
import { handleRegisterAgent } from "./control_plane/registry.js";
|
|
25
|
+
import { handleRunCommand } from "./shell/run_command.js";
|
|
26
|
+
import { handleCheckLint } from "./quality/check_lint.js";
|
|
27
|
+
import { ToolHandler, ToolResult } from "./types.js";
|
|
28
|
+
|
|
29
|
+
// Map of tool names to their handler functions
|
|
30
|
+
const bind = <T>(fn: (root: string, args: T) => ToolResult | Promise<ToolResult>): ToolHandler => {
|
|
31
|
+
return (root: string, args: unknown) => fn(root, args as T);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const toolHandlers: Record<string, ToolHandler> = {
|
|
35
|
+
read_file: bind(handleReadFile),
|
|
36
|
+
view_file: bind(handleReadFile), // Alias
|
|
37
|
+
list_dir: bind(handleListDir),
|
|
38
|
+
grep_search: bind(handleGrepSearch),
|
|
39
|
+
get_project_map: bind(handleGetProjectMap),
|
|
40
|
+
get_project_gaps: bind(handleGetProjectGaps),
|
|
41
|
+
write_file: bind(handleWriteFile),
|
|
42
|
+
replace_text: bind(handleReplaceText),
|
|
43
|
+
batch_surgical_edit: bind(handleBatchSurgicalEdit),
|
|
44
|
+
patch_file: bind(handlePatchFile),
|
|
45
|
+
get_framework_status: bind(handleGetFrameworkStatus),
|
|
46
|
+
read_project_memory: bind(handleReadProjectMemory),
|
|
47
|
+
get_memory_insights: bind(handleGetMemoryInsights),
|
|
48
|
+
update_project_memory: bind(handleUpdateProjectMemory),
|
|
49
|
+
audit_dependencies: bind(handleAuditDependencies),
|
|
50
|
+
run_tests: bind(handleRunTests),
|
|
51
|
+
get_system_health: bind(handleGetSystemHealth),
|
|
52
|
+
check_active_ports: bind(handleCheckPorts),
|
|
53
|
+
orchestrate_loop: bind(handleOrchestrateLoop),
|
|
54
|
+
send_agent_message: bind(handleSendAgentMessage),
|
|
55
|
+
log_agent_action: bind(handleLogAgentAction),
|
|
56
|
+
update_contract_hash: bind(handleUpdateContractHash),
|
|
57
|
+
acquire_lock: bind(handleAcquireLock),
|
|
58
|
+
release_lock: bind(handleReleaseLock),
|
|
59
|
+
register_agent: bind(handleRegisterAgent),
|
|
60
|
+
run_shell_command: bind(handleRunCommand),
|
|
61
|
+
check_lint: bind(handleCheckLint),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export { TOOLS };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { resolveFrameworkDir } from "../../utils/security.js";
|
|
4
|
+
import { ToolArgs, ToolResult } from "../types.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Extracts key insights from the project memory to minimize token usage.
|
|
8
|
+
* Returns only the active phase, trace, and the last 5 decisions/tasks.
|
|
9
|
+
*/
|
|
10
|
+
export function handleGetMemoryInsights(projectRoot: string, _args: ToolArgs): ToolResult {
|
|
11
|
+
try {
|
|
12
|
+
const frameworkDir = resolveFrameworkDir(projectRoot);
|
|
13
|
+
const memoryPath = path.join(projectRoot, frameworkDir, "memory/PROJECT_MEMORY.md");
|
|
14
|
+
|
|
15
|
+
if (!fs.existsSync(memoryPath)) {
|
|
16
|
+
return { content: [{ type: "text", text: "New project: No history available." }] };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const content = fs.readFileSync(memoryPath, "utf8");
|
|
20
|
+
const lines = content.split("\n");
|
|
21
|
+
|
|
22
|
+
const activePhase = lines.find(l => l.includes("**Phase:**"))?.split("**Phase:**")[1]?.trim() || "Unknown";
|
|
23
|
+
const activeTrace = lines.find(l => l.includes("**Trace ID:**"))?.split("**Trace ID:**")[1]?.trim() || "None";
|
|
24
|
+
|
|
25
|
+
// Find the last 5 history items (heuristic)
|
|
26
|
+
const historyStartIndex = lines.findIndex(l => l.toUpperCase().includes("HISTORY"));
|
|
27
|
+
let recentHistory = "No history found.";
|
|
28
|
+
if (historyStartIndex !== -1) {
|
|
29
|
+
recentHistory = lines.slice(historyStartIndex + 1)
|
|
30
|
+
.filter(l => l.trim().startsWith("-"))
|
|
31
|
+
.slice(-5)
|
|
32
|
+
.join("\n");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const insights = `🧠 **Memory Insights**\n- **Phase:** ${activePhase}\n- **Trace:** ${activeTrace}\n\n**Recent Actions:**\n${recentHistory}`;
|
|
36
|
+
|
|
37
|
+
return { content: [{ type: "text", text: insights }] };
|
|
38
|
+
} catch (e) {
|
|
39
|
+
return { isError: true, content: [{ type: "text", text: `Failed to extract insights: ${String(e)}` }] };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { resolveFrameworkDir } from "../../utils/security.js";
|
|
4
|
+
import { ToolArgs, ToolResult } from "../types.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Reads the project's central memory (PROJECT_MEMORY.md).
|
|
8
|
+
* This is the "brain" of the project.
|
|
9
|
+
*/
|
|
10
|
+
export function handleReadProjectMemory(projectRoot: string, _args: ToolArgs): ToolResult {
|
|
11
|
+
try {
|
|
12
|
+
const frameworkDir = resolveFrameworkDir(projectRoot);
|
|
13
|
+
const memoryPath = path.join(projectRoot, frameworkDir, "memory/PROJECT_MEMORY.md");
|
|
14
|
+
|
|
15
|
+
if (!fs.existsSync(memoryPath)) {
|
|
16
|
+
return {
|
|
17
|
+
content: [{ type: "text", text: "ℹ️ Project memory file not found. It might be a new project." }]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const content = fs.readFileSync(memoryPath, "utf8");
|
|
22
|
+
return {
|
|
23
|
+
content: [{ type: "text", text: content }]
|
|
24
|
+
};
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return {
|
|
27
|
+
isError: true,
|
|
28
|
+
content: [{ type: "text", text: `Failed to read project memory: ${String(e)}` }]
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { resolveFrameworkDir } from "../../utils/security.js";
|
|
4
|
+
import { LogAgentActionArgs, ToolResult } from "../types.js";
|
|
5
|
+
|
|
6
|
+
export function handleLogAgentAction(projectRoot: string, args: LogAgentActionArgs): ToolResult {
|
|
7
|
+
const { agent, action, traceId, status, summary } = args;
|
|
8
|
+
const findings = args.findings ? args.findings.split(",").map(f => f.trim()) : [];
|
|
9
|
+
|
|
10
|
+
const frameworkDir = resolveFrameworkDir(projectRoot);
|
|
11
|
+
const agentName = agent.replace("@", "");
|
|
12
|
+
const logPath = path.join(projectRoot, frameworkDir, "logs", `${agentName}.json`);
|
|
13
|
+
|
|
14
|
+
const logEntry = {
|
|
15
|
+
timestamp: new Date().toISOString(),
|
|
16
|
+
agent,
|
|
17
|
+
action,
|
|
18
|
+
requestId: traceId,
|
|
19
|
+
status,
|
|
20
|
+
summary,
|
|
21
|
+
findings
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
fs.mkdirSync(path.dirname(logPath), { recursive: true });
|
|
25
|
+
fs.appendFileSync(logPath, JSON.stringify(logEntry) + "\n");
|
|
26
|
+
|
|
27
|
+
return { content: [{ type: "text", text: `✅ Action logged for ${agent} to ${path.join(frameworkDir, "logs", `${agentName}.json`)}` }] };
|
|
28
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { resolveFrameworkDir } from "../../utils/security.js";
|
|
4
|
+
import { SendAgentMessageArgs, ToolResult } from "../types.js";
|
|
5
|
+
import { Metrics } from "../../utils/metrics.js";
|
|
6
|
+
|
|
7
|
+
export async function handleSendAgentMessage(projectRoot: string, args: SendAgentMessageArgs): Promise<ToolResult> {
|
|
8
|
+
const { to, category, content, traceId, parentId, requiresApproval } = args;
|
|
9
|
+
const from = args.from || "@mcp";
|
|
10
|
+
|
|
11
|
+
if (!to || !category || !content || !traceId) {
|
|
12
|
+
const err = "Missing required messaging arguments (to, category, content, or traceId).";
|
|
13
|
+
Metrics.logError(projectRoot, from, "send_agent_message", err);
|
|
14
|
+
return { isError: true, content: [{ type: "text", text: `❌ ${err}` }] };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const frameworkDir = resolveFrameworkDir(projectRoot);
|
|
18
|
+
const messagesDir = path.join(projectRoot, frameworkDir, "messages");
|
|
19
|
+
const agentName = to.replace("@", "");
|
|
20
|
+
const messagePath = path.join(messagesDir, `${agentName}.json`);
|
|
21
|
+
const lockPath = path.join(messagesDir, `${agentName}.lock`);
|
|
22
|
+
|
|
23
|
+
// Hermes Lock Protocol: Retry 20 times with 500ms delay
|
|
24
|
+
let retries = 20;
|
|
25
|
+
let acquired = false;
|
|
26
|
+
while (retries > 0) {
|
|
27
|
+
try {
|
|
28
|
+
if (fs.existsSync(lockPath)) {
|
|
29
|
+
try {
|
|
30
|
+
const stats = fs.statSync(lockPath);
|
|
31
|
+
if (Date.now() - stats.mtimeMs > 10000) {
|
|
32
|
+
const tempLockPath = `${lockPath}.${Math.random().toString(36).substring(2)}.old`;
|
|
33
|
+
fs.renameSync(lockPath, tempLockPath);
|
|
34
|
+
fs.unlinkSync(tempLockPath);
|
|
35
|
+
}
|
|
36
|
+
} catch {
|
|
37
|
+
// ignore if concurrently unlinked or renamed
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
fs.mkdirSync(messagesDir, { recursive: true });
|
|
41
|
+
fs.writeFileSync(lockPath, `Locked by ${from} at ${new Date().toISOString()}`, { flag: "wx" });
|
|
42
|
+
acquired = true;
|
|
43
|
+
break;
|
|
44
|
+
} catch (err: unknown) {
|
|
45
|
+
const error = err as { code?: string; message?: string };
|
|
46
|
+
if (error.code === "EEXIST") {
|
|
47
|
+
retries--;
|
|
48
|
+
if (retries > 0) {
|
|
49
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
return { content: [{ type: "text", text: `❌ Unexpected lock acquisition error: ${error.message || String(err)}` }], isError: true };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!acquired) {
|
|
58
|
+
const err = `Could not send message to ${to}: Hermes lock is busy.`;
|
|
59
|
+
Metrics.logError(projectRoot, from, "send_agent_message", err);
|
|
60
|
+
return { content: [{ type: "text", text: `❌ ${err}` }], isError: true };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
const defaultPriority = (category === "ALERT" || category === "ACTION") ? "HIGH" : "NORMAL";
|
|
65
|
+
const finalRequiresApproval = requiresApproval !== undefined
|
|
66
|
+
? requiresApproval
|
|
67
|
+
: category === "ALERT";
|
|
68
|
+
|
|
69
|
+
const message = {
|
|
70
|
+
timestamp: new Date().toISOString(),
|
|
71
|
+
from,
|
|
72
|
+
to,
|
|
73
|
+
category,
|
|
74
|
+
traceId,
|
|
75
|
+
parentId,
|
|
76
|
+
content,
|
|
77
|
+
priority: args.priority || defaultPriority,
|
|
78
|
+
status: "PENDING",
|
|
79
|
+
requiresApproval: finalRequiresApproval
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
fs.appendFileSync(messagePath, JSON.stringify(message) + "\n");
|
|
83
|
+
return { content: [{ type: "text", text: `✅ Message sent to ${to} (from: ${from})` }] };
|
|
84
|
+
} catch (e) {
|
|
85
|
+
const err = `Failed to write message: ${String(e)}`;
|
|
86
|
+
Metrics.logError(projectRoot, from, "send_agent_message", err);
|
|
87
|
+
return { isError: true, content: [{ type: "text", text: `❌ ${err}` }] };
|
|
88
|
+
} finally {
|
|
89
|
+
if (acquired && fs.existsSync(lockPath)) {
|
|
90
|
+
try {
|
|
91
|
+
fs.unlinkSync(lockPath);
|
|
92
|
+
} catch {
|
|
93
|
+
// ignore
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { execSync } from "child_process";
|
|
2
|
+
import { CheckActivePortsArgs, ToolResult } from "../types.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Checks for active network ports and their status.
|
|
6
|
+
*/
|
|
7
|
+
export function handleCheckPorts(projectRoot: string, args: CheckActivePortsArgs): ToolResult {
|
|
8
|
+
const filter = args.filter || ""; // Optional filter (e.g., ":3000")
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
// Using 'lsof -i -P -n' to list open files and network connections
|
|
12
|
+
// Note: may require permissions or behave differently on non-Unix systems
|
|
13
|
+
const command = process.platform === "win32"
|
|
14
|
+
? `netstat -ano | findstr LISTENING ${filter ? `| findstr ${filter}` : ""}`
|
|
15
|
+
: `lsof -i -P -n | grep LISTEN ${filter ? `| grep ${filter}` : ""}`;
|
|
16
|
+
|
|
17
|
+
const output = execSync(command, { encoding: "utf8" });
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
content: [{
|
|
21
|
+
type: "text",
|
|
22
|
+
text: `📡 **Active Listening Ports:**\n\n${output || "No active listening ports found matching filter."}`
|
|
23
|
+
}]
|
|
24
|
+
};
|
|
25
|
+
} catch (_e) {
|
|
26
|
+
return {
|
|
27
|
+
content: [{ type: "text", text: "ℹ️ No active ports found or command failed (this is normal if nothing is listening)." }]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import os from "os";
|
|
2
|
+
import { ToolArgs, ToolResult } from "../types.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Retrieves system health metrics including CPU load and memory usage.
|
|
6
|
+
*/
|
|
7
|
+
export function handleGetSystemHealth(_projectRoot: string, _args: ToolArgs): ToolResult {
|
|
8
|
+
const totalMem = os.totalmem();
|
|
9
|
+
const freeMem = os.freemem();
|
|
10
|
+
const usedMem = totalMem - freeMem;
|
|
11
|
+
const memUsagePercent = ((usedMem / totalMem) * 100).toFixed(2);
|
|
12
|
+
|
|
13
|
+
const loadAvg = os.loadavg(); // [1, 5, 15] minute averages
|
|
14
|
+
|
|
15
|
+
const healthReport = `🖥️ **System Health Report**
|
|
16
|
+
- **Memory:** ${memUsagePercent}% used (${(usedMem / 1024 / 1024 / 1024).toFixed(2)} GB / ${(totalMem / 1024 / 1024 / 1024).toFixed(2)} GB)
|
|
17
|
+
- **CPU Load (1m, 5m, 15m):** ${loadAvg.map(l => l.toFixed(2)).join(", ")}
|
|
18
|
+
- **Platform:** ${os.platform()} (${os.release()})
|
|
19
|
+
- **Uptime:** ${(os.uptime() / 3600).toFixed(2)} hours`;
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
content: [{ type: "text", text: healthReport }]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { exec } from "child_process";
|
|
2
|
+
import { ToolArgs, ToolResult } from "../types.js";
|
|
3
|
+
import { Metrics } from "../../utils/metrics.js";
|
|
4
|
+
|
|
5
|
+
const LINT_COMMAND = "npm run lint";
|
|
6
|
+
const TIMEOUT = 60000; // 60 seconds
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Handles running the project's linter.
|
|
10
|
+
*/
|
|
11
|
+
export function handleCheckLint(projectRoot: string, _args: ToolArgs): Promise<ToolResult> {
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
exec(LINT_COMMAND, { cwd: projectRoot, timeout: TIMEOUT }, (error, stdout, stderr) => {
|
|
14
|
+
const output = stdout + stderr;
|
|
15
|
+
const tokens = Metrics.estimateTokens(output);
|
|
16
|
+
|
|
17
|
+
if (error) {
|
|
18
|
+
const err = `Linting failed: ${error.message}`;
|
|
19
|
+
Metrics.logError(projectRoot, "@mcp", "check_lint", err);
|
|
20
|
+
resolve({
|
|
21
|
+
isError: true,
|
|
22
|
+
content: [{ type: "text", text: `❌ Lint Errors Found:\n\n${output}` }]
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
Metrics.logUsage(projectRoot, "@mcp", "check_lint", tokens);
|
|
28
|
+
resolve({
|
|
29
|
+
content: [{ type: "text", text: `✅ Lint check passed successfully:\n\n${output}` }]
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { safePath } from "../../utils/security.js";
|
|
4
|
+
import { GetProjectGapsArgs, ToolResult } from "../types.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Scans the codebase for TODOs, FIXMEs, and empty function bodies.
|
|
8
|
+
* Helps identify what's left and where the agent might have skipped logic.
|
|
9
|
+
*/
|
|
10
|
+
export function handleGetProjectGaps(projectRoot: string, args: GetProjectGapsArgs): ToolResult {
|
|
11
|
+
const srcDir = safePath(projectRoot, args.path || "src");
|
|
12
|
+
const results: string[] = [];
|
|
13
|
+
|
|
14
|
+
const walk = (dir: string) => {
|
|
15
|
+
if (!fs.existsSync(dir)) return;
|
|
16
|
+
const files = fs.readdirSync(dir);
|
|
17
|
+
for (const file of files) {
|
|
18
|
+
const fullPath = path.join(dir, file);
|
|
19
|
+
const relativePath = path.relative(projectRoot, fullPath);
|
|
20
|
+
|
|
21
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
22
|
+
if (file !== "node_modules" && file !== "dist" && !file.startsWith(".")) {
|
|
23
|
+
walk(fullPath);
|
|
24
|
+
}
|
|
25
|
+
} else if (file.endsWith(".ts") || file.endsWith(".tsx")) {
|
|
26
|
+
const content = fs.readFileSync(fullPath, "utf8");
|
|
27
|
+
const lines = content.split("\n");
|
|
28
|
+
|
|
29
|
+
lines.forEach((line, index) => {
|
|
30
|
+
// 1. Scan for markers
|
|
31
|
+
if (line.includes("TODO") || line.includes("FIXME") || line.includes("!!!")) {
|
|
32
|
+
results.push(`[${relativePath}:${index + 1}] Marker found: ${line.trim()}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 2. Scan for empty function placeholders (heuristic)
|
|
36
|
+
if (line.includes("throw new Error(\"Not implemented") || line.includes("// ... rest of code")) {
|
|
37
|
+
results.push(`[${relativePath}:${index + 1}] Gap found: ${line.trim()}`);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
walk(srcDir);
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
content: [{
|
|
48
|
+
type: "text",
|
|
49
|
+
text: results.length > 0
|
|
50
|
+
? `Found ${results.length} gaps/todos:\n\n${results.join("\n")}`
|
|
51
|
+
: "✅ No major gaps or TODOs found in the scanned directory."
|
|
52
|
+
}]
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { GetProjectMapArgs, ToolResult } from "../types.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Generates a tree-view map of the project structure.
|
|
7
|
+
* Helps agents visualize the entire project layout quickly.
|
|
8
|
+
*/
|
|
9
|
+
export function handleGetProjectMap(projectRoot: string, args: GetProjectMapArgs): ToolResult {
|
|
10
|
+
const maxDepth = args.maxDepth || 3;
|
|
11
|
+
const includeFiles = args.includeFiles !== false;
|
|
12
|
+
|
|
13
|
+
const buildTree = (dir: string, depth: number): string[] => {
|
|
14
|
+
if (depth > maxDepth) return [];
|
|
15
|
+
|
|
16
|
+
const results: string[] = [];
|
|
17
|
+
const files = fs.readdirSync(dir);
|
|
18
|
+
|
|
19
|
+
files.forEach(file => {
|
|
20
|
+
if (file === "node_modules" || file === ".git" || file === "dist" || file.startsWith(".")) return;
|
|
21
|
+
|
|
22
|
+
const fullPath = path.join(dir, file);
|
|
23
|
+
const stat = fs.statSync(fullPath);
|
|
24
|
+
const indent = " ".repeat(depth);
|
|
25
|
+
|
|
26
|
+
if (stat.isDirectory()) {
|
|
27
|
+
results.push(`${indent}📁 ${file}/`);
|
|
28
|
+
results.push(...buildTree(fullPath, depth + 1));
|
|
29
|
+
} else if (includeFiles) {
|
|
30
|
+
results.push(`${indent}📄 ${file}`);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return results;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const tree = buildTree(projectRoot, 0);
|
|
39
|
+
return {
|
|
40
|
+
content: [{
|
|
41
|
+
type: "text",
|
|
42
|
+
text: `🗺️ **Project Map (Depth: ${maxDepth})**\n\n${tree.join("\n")}`
|
|
43
|
+
}]
|
|
44
|
+
};
|
|
45
|
+
} catch (e) {
|
|
46
|
+
return { isError: true, content: [{ type: "text", text: `Failed to map project: ${String(e)}` }] };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { GrepSearchArgs, ToolResult } from "../types.js";
|
|
4
|
+
import { Metrics } from "../../utils/metrics.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Searches for a regex pattern within files in the project.
|
|
8
|
+
*/
|
|
9
|
+
export function handleGrepSearch(projectRoot: string, args: GrepSearchArgs): ToolResult {
|
|
10
|
+
const pattern = args.pattern as string;
|
|
11
|
+
const includePattern = args.includePattern as string || ""; // e.g., ".ts"
|
|
12
|
+
const excludePattern = args.excludePattern as string || "node_modules";
|
|
13
|
+
|
|
14
|
+
if (!pattern) {
|
|
15
|
+
const err = "Search pattern is required.";
|
|
16
|
+
Metrics.logError(projectRoot, "@mcp", "grep_search", err);
|
|
17
|
+
return { isError: true, content: [{ type: "text", text: `❌ ${err}` }] };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const results: string[] = [];
|
|
21
|
+
try {
|
|
22
|
+
new RegExp(pattern);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
const err = `Invalid regex pattern: ${String(e)}`;
|
|
25
|
+
Metrics.logError(projectRoot, "@mcp", "grep_search", err);
|
|
26
|
+
return { isError: true, content: [{ type: "text", text: `❌ ${err}` }] };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const walk = (dir: string) => {
|
|
30
|
+
if (results.length > 100) return;
|
|
31
|
+
try {
|
|
32
|
+
const files = fs.readdirSync(dir);
|
|
33
|
+
for (const file of files) {
|
|
34
|
+
if (results.length > 100) return;
|
|
35
|
+
const filePath = path.join(dir, file);
|
|
36
|
+
if (excludePattern && filePath.includes(excludePattern)) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const stat = fs.statSync(filePath);
|
|
40
|
+
if (stat.isDirectory()) {
|
|
41
|
+
walk(filePath);
|
|
42
|
+
} else if (stat.isFile()) {
|
|
43
|
+
if (includePattern && !filePath.endsWith(includePattern)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const content = fs.readFileSync(filePath, "utf8");
|
|
47
|
+
// Create a new regex object for each line to avoid state issues with /g
|
|
48
|
+
if (new RegExp(pattern).test(content)) {
|
|
49
|
+
if (results.length < 100) {
|
|
50
|
+
results.push(filePath);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
} catch {
|
|
56
|
+
// Ignore directories that cannot be read
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
try {
|
|
60
|
+
walk(projectRoot);
|
|
61
|
+
} catch (e) {
|
|
62
|
+
const err = `Search failed: ${String(e)}`;
|
|
63
|
+
Metrics.logError(projectRoot, "@mcp", "grep_search", err);
|
|
64
|
+
return { isError: true, content: [{ type: "text", text: `❌ ${err}` }] };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
content: [{
|
|
69
|
+
type: "text",
|
|
70
|
+
text: results.length > 0
|
|
71
|
+
? `Found ${results.length} matches:\n\n${results.join("\n")}`
|
|
72
|
+
: "No matches found."
|
|
73
|
+
}]
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { safePath } from "../../utils/security.js";
|
|
4
|
+
import { ListDirArgs, ToolResult } from "../types.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Lists the contents of a directory.
|
|
8
|
+
*/
|
|
9
|
+
export function handleListDir(projectRoot: string, args: ListDirArgs): ToolResult {
|
|
10
|
+
const dirPath = safePath(projectRoot, args.path || ".");
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(dirPath)) {
|
|
13
|
+
throw new Error(`Directory not found: ${args.path}`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const stats = fs.statSync(dirPath);
|
|
17
|
+
if (!stats.isDirectory()) {
|
|
18
|
+
throw new Error(`Path is not a directory: ${args.path}`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const files = fs.readdirSync(dirPath);
|
|
22
|
+
const results = files.map(file => {
|
|
23
|
+
const fullPath = path.join(dirPath, file);
|
|
24
|
+
const isDir = fs.statSync(fullPath).isDirectory();
|
|
25
|
+
return `${isDir ? "[DIR] " : " "}${file}`;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
content: [{
|
|
30
|
+
type: "text",
|
|
31
|
+
text: `Directory listing for ${args.path || "."}:\n\n${results.join("\n")}`
|
|
32
|
+
}]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { exec } from "child_process";
|
|
2
|
+
import { RunCommandArgs, ToolResult } from "../types.js";
|
|
3
|
+
import { Metrics } from "../../utils/metrics.js";
|
|
4
|
+
|
|
5
|
+
const COMMAND_ALLOW_LIST = [
|
|
6
|
+
"npm test",
|
|
7
|
+
"npm run lint",
|
|
8
|
+
"git status",
|
|
9
|
+
"git diff",
|
|
10
|
+
"npx vitest run", // From the audit, this is the test command
|
|
11
|
+
"npm run build", // From the audit
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const TIMEOUT = 30000; // 30 seconds
|
|
15
|
+
|
|
16
|
+
export function handleRunCommand(projectRoot: string, args: RunCommandArgs): Promise<ToolResult> {
|
|
17
|
+
const command = args.command;
|
|
18
|
+
|
|
19
|
+
const isAllowed = COMMAND_ALLOW_LIST.some(allowedCmd => command.startsWith(allowedCmd));
|
|
20
|
+
|
|
21
|
+
if (!isAllowed) {
|
|
22
|
+
const errorMsg = `Command not allowed: "${command}". Only commands starting with the following are allowed: ${COMMAND_ALLOW_LIST.join(", ")}`;
|
|
23
|
+
Metrics.logError(projectRoot, "@mcp", `run_shell_command: ${command} (denied)`, errorMsg);
|
|
24
|
+
return Promise.resolve({
|
|
25
|
+
content: [{ type: "text", text: `ERROR: ${errorMsg}` }],
|
|
26
|
+
isError: true,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return new Promise((resolve) => {
|
|
31
|
+
exec(command, { cwd: projectRoot, timeout: TIMEOUT }, (error, stdout, stderr) => {
|
|
32
|
+
const output = stdout + stderr;
|
|
33
|
+
const tokens = Metrics.estimateTokens(output);
|
|
34
|
+
Metrics.logUsage(projectRoot, "@mcp", `run_shell_command: ${command}`, tokens);
|
|
35
|
+
|
|
36
|
+
if (error) {
|
|
37
|
+
const errorMsg = `Command failed with exit code ${error.code}: ${error.message}.`;
|
|
38
|
+
Metrics.logError(projectRoot, "@mcp", `run_shell_command: ${command}`, errorMsg);
|
|
39
|
+
resolve({
|
|
40
|
+
content: [{ type: "text", text: `ERROR: ${errorMsg}. Output: ${output}` }],
|
|
41
|
+
isError: true,
|
|
42
|
+
});
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Truncate long outputs
|
|
47
|
+
const MAX_OUTPUT_LENGTH = 5000;
|
|
48
|
+
let truncatedOutput = output;
|
|
49
|
+
if (output.length > MAX_OUTPUT_LENGTH) {
|
|
50
|
+
truncatedOutput = output.substring(0, MAX_OUTPUT_LENGTH) + "... [TRUNCATED] ..."; // Simplified
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
resolve({ content: [{ type: "text", text: truncatedOutput }] });
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|