atabey 0.0.6 ā 0.0.8
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 +4 -4
- package/README.md +35 -33
- package/bin/cli.js +2 -2
- package/bin/validate-agent-army.js +6 -6
- package/dist/framework-mcp/src/constants.js +1 -1
- package/dist/framework-mcp/src/constants.js.map +1 -1
- package/dist/framework-mcp/src/index.js +29 -5
- package/dist/framework-mcp/src/index.js.map +1 -1
- package/dist/framework-mcp/src/resources/index.d.ts +10 -0
- package/dist/framework-mcp/src/resources/index.js +59 -0
- package/dist/framework-mcp/src/resources/index.js.map +1 -0
- package/dist/framework-mcp/src/tools/control_plane/locking.js +3 -3
- package/dist/framework-mcp/src/tools/control_plane/locking.js.map +1 -1
- package/dist/framework-mcp/src/tools/control_plane/registry.js +3 -2
- package/dist/framework-mcp/src/tools/control_plane/registry.js.map +1 -1
- package/dist/framework-mcp/src/tools/definitions.js +33 -1
- package/dist/framework-mcp/src/tools/definitions.js.map +1 -1
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.d.ts +1 -1
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js +8 -3
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js.map +1 -1
- package/dist/framework-mcp/src/tools/file_system/patch_file.d.ts +1 -1
- package/dist/framework-mcp/src/tools/file_system/patch_file.js +8 -3
- package/dist/framework-mcp/src/tools/file_system/patch_file.js.map +1 -1
- package/dist/framework-mcp/src/tools/file_system/read_file.js +3 -3
- package/dist/framework-mcp/src/tools/file_system/read_file.js.map +1 -1
- package/dist/framework-mcp/src/tools/file_system/replace_text.d.ts +1 -1
- package/dist/framework-mcp/src/tools/file_system/replace_text.js +8 -3
- package/dist/framework-mcp/src/tools/file_system/replace_text.js.map +1 -1
- package/dist/framework-mcp/src/tools/file_system/write_file.d.ts +1 -1
- package/dist/framework-mcp/src/tools/file_system/write_file.js +10 -5
- package/dist/framework-mcp/src/tools/file_system/write_file.js.map +1 -1
- package/dist/framework-mcp/src/tools/framework/audit_deps.js +2 -2
- package/dist/framework-mcp/src/tools/framework/audit_deps.js.map +1 -1
- package/dist/framework-mcp/src/tools/framework/run_tests.js +2 -2
- package/dist/framework-mcp/src/tools/framework/run_tests.js.map +1 -1
- package/dist/framework-mcp/src/tools/framework/submit_plan.d.ts +10 -0
- package/dist/framework-mcp/src/tools/framework/submit_plan.js +14 -0
- package/dist/framework-mcp/src/tools/framework/submit_plan.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/update_memory.js +1 -1
- package/dist/framework-mcp/src/tools/framework/update_memory.js.map +1 -1
- package/dist/framework-mcp/src/tools/index.js +2 -0
- package/dist/framework-mcp/src/tools/index.js.map +1 -1
- package/dist/framework-mcp/src/tools/memory/get_insights.js +1 -1
- package/dist/framework-mcp/src/tools/memory/get_insights.js.map +1 -1
- package/dist/framework-mcp/src/tools/messaging/log_action.js +1 -1
- package/dist/framework-mcp/src/tools/messaging/log_action.js.map +1 -1
- package/dist/framework-mcp/src/tools/messaging/send_message.js +5 -5
- package/dist/framework-mcp/src/tools/messaging/send_message.js.map +1 -1
- package/dist/framework-mcp/src/tools/observability/check_ports.js +1 -1
- package/dist/framework-mcp/src/tools/observability/check_ports.js.map +1 -1
- package/dist/framework-mcp/src/tools/quality/check_lint.js +2 -2
- package/dist/framework-mcp/src/tools/quality/check_lint.js.map +1 -1
- package/dist/framework-mcp/src/tools/search/get_gaps.js +1 -1
- package/dist/framework-mcp/src/tools/search/get_gaps.js.map +1 -1
- package/dist/framework-mcp/src/tools/search/grep_search.js +3 -3
- package/dist/framework-mcp/src/tools/search/grep_search.js.map +1 -1
- package/dist/framework-mcp/src/tools/types.d.ts +1 -0
- package/dist/framework-mcp/src/utils/compliance.d.ts +6 -0
- package/dist/framework-mcp/src/utils/compliance.js +158 -5
- package/dist/framework-mcp/src/utils/compliance.js.map +1 -1
- package/dist/framework-mcp/src/utils/permissions.d.ts +12 -0
- package/dist/framework-mcp/src/utils/permissions.js +72 -0
- package/dist/framework-mcp/src/utils/permissions.js.map +1 -0
- package/dist/framework-mcp/tests/tools/file_system/compliance-risk.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/file_system/compliance-risk.test.js +84 -0
- package/dist/framework-mcp/tests/tools/file_system/compliance-risk.test.js.map +1 -0
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js +31 -31
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js.map +1 -1
- package/dist/framework-mcp/tests/tools/file_system/permissions.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/file_system/permissions.test.js +92 -0
- package/dist/framework-mcp/tests/tools/file_system/permissions.test.js.map +1 -0
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js +5 -5
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js.map +1 -1
- package/dist/src/cli/adapters/core.js +13 -20
- package/dist/src/cli/adapters/core.js.map +1 -1
- package/dist/src/cli/adapters/scaffold.js +2 -2
- package/dist/src/cli/adapters/scaffold.js.map +1 -1
- package/dist/src/cli/commands/check.js +5 -3
- package/dist/src/cli/commands/check.js.map +1 -1
- package/dist/src/cli/commands/compliance.js +2 -2
- package/dist/src/cli/commands/compliance.js.map +1 -1
- package/dist/src/cli/commands/contract.js +2 -2
- package/dist/src/cli/commands/contract.js.map +1 -1
- package/dist/src/cli/commands/dashboard.d.ts +5 -0
- package/dist/src/cli/commands/dashboard.js +124 -0
- package/dist/src/cli/commands/dashboard.js.map +1 -0
- package/dist/src/cli/commands/explorer.js +3 -3
- package/dist/src/cli/commands/explorer.js.map +1 -1
- package/dist/src/cli/commands/git.js +3 -3
- package/dist/src/cli/commands/git.js.map +1 -1
- package/dist/src/cli/commands/init/create-agent.d.ts +4 -0
- package/dist/src/cli/commands/init/create-agent.js +59 -0
- package/dist/src/cli/commands/init/create-agent.js.map +1 -0
- package/dist/src/cli/commands/init/scaffold-core.d.ts +1 -0
- package/dist/src/cli/commands/init/scaffold-core.js +11 -7
- package/dist/src/cli/commands/init/scaffold-core.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-docs.d.ts +1 -0
- package/dist/src/cli/commands/init/scaffold-docs.js +4 -6
- package/dist/src/cli/commands/init/scaffold-docs.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-ops.js +4 -4
- package/dist/src/cli/commands/init/scaffold-ops.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-standards.js +10 -8
- package/dist/src/cli/commands/init/scaffold-standards.js.map +1 -1
- package/dist/src/cli/commands/init.js +26 -10
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/knowledge.js +3 -3
- package/dist/src/cli/commands/knowledge.js.map +1 -1
- package/dist/src/cli/commands/lint.js +2 -2
- package/dist/src/cli/commands/lint.js.map +1 -1
- package/dist/src/cli/commands/log.js +6 -28
- package/dist/src/cli/commands/log.js.map +1 -1
- package/dist/src/cli/commands/orchestrate.d.ts +10 -17
- package/dist/src/cli/commands/orchestrate.js +92 -341
- package/dist/src/cli/commands/orchestrate.js.map +1 -1
- package/dist/src/cli/commands/plan.d.ts +5 -0
- package/dist/src/cli/commands/plan.js +80 -59
- package/dist/src/cli/commands/plan.js.map +1 -1
- package/dist/src/cli/commands/script.js +3 -3
- package/dist/src/cli/commands/script.js.map +1 -1
- package/dist/src/cli/commands/security.js +2 -2
- package/dist/src/cli/commands/security.js.map +1 -1
- package/dist/src/cli/commands/status.js +65 -8
- package/dist/src/cli/commands/status.js.map +1 -1
- package/dist/src/cli/commands/trace.d.ts +4 -0
- package/dist/src/cli/commands/trace.js +83 -2
- package/dist/src/cli/commands/trace.js.map +1 -1
- package/dist/src/cli/index.js +68 -18
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/shims.js +14 -14
- package/dist/src/cli/utils/claude.js +1 -1
- package/dist/src/cli/utils/claude.js.map +1 -1
- package/dist/src/cli/utils/compliance.js +7 -1
- package/dist/src/cli/utils/compliance.js.map +1 -1
- package/dist/src/cli/utils/fs.js +1 -1
- package/dist/src/cli/utils/fs.js.map +1 -1
- package/dist/src/cli/utils/i18n.d.ts +1 -0
- package/dist/src/cli/utils/i18n.js +2 -0
- package/dist/src/cli/utils/i18n.js.map +1 -1
- package/dist/src/cli/utils/memory.d.ts +12 -3
- package/dist/src/cli/utils/memory.js +39 -31
- package/dist/src/cli/utils/memory.js.map +1 -1
- package/dist/src/cli/utils/pkg.js +2 -2
- package/dist/src/cli/utils/pkg.js.map +1 -1
- package/dist/src/cli/utils/schemas.d.ts +8 -8
- package/dist/src/cli/utils/ui.js +4 -4
- package/dist/src/cli/utils/ui.js.map +1 -1
- package/dist/src/contracts/tasks.d.ts +2 -2
- package/dist/src/dashboard/vite.config.d.ts +2 -0
- package/dist/src/dashboard/vite.config.js +16 -0
- package/dist/src/dashboard/vite.config.js.map +1 -0
- package/dist/src/modules/adapters/definitions.js +10 -10
- package/dist/src/modules/adapters/definitions.js.map +1 -1
- package/dist/src/modules/adapters/shared.js +4 -4
- package/dist/src/modules/adapters/shared.js.map +1 -1
- package/dist/src/modules/agents/definitions.d.ts +19 -0
- package/dist/src/modules/agents/definitions.js +74 -21
- package/dist/src/modules/agents/definitions.js.map +1 -1
- package/dist/src/modules/agents/registry/backend.js +8 -0
- package/dist/src/modules/agents/registry/backend.js.map +1 -1
- package/dist/src/modules/agents/registry/database.js +7 -0
- package/dist/src/modules/agents/registry/database.js.map +1 -1
- package/dist/src/modules/agents/registry/devops.js +6 -0
- package/dist/src/modules/agents/registry/devops.js.map +1 -1
- package/dist/src/modules/agents/registry/frontend.js +8 -0
- package/dist/src/modules/agents/registry/frontend.js.map +1 -1
- package/dist/src/modules/agents/registry/security.js +6 -0
- package/dist/src/modules/agents/registry/security.js.map +1 -1
- package/dist/src/modules/agents/types.d.ts +2 -0
- package/dist/src/modules/engines/evaluation-engine.d.ts +11 -0
- package/dist/src/modules/engines/evaluation-engine.js +103 -0
- package/dist/src/modules/engines/evaluation-engine.js.map +1 -0
- package/dist/src/modules/engines/health-engine.d.ts +16 -0
- package/dist/src/modules/engines/health-engine.js +50 -0
- package/dist/src/modules/engines/health-engine.js.map +1 -0
- package/dist/src/modules/engines/planning-engine.d.ts +25 -0
- package/dist/src/modules/engines/planning-engine.js +79 -0
- package/dist/src/modules/engines/planning-engine.js.map +1 -0
- package/dist/src/modules/engines/risk-engine.d.ts +18 -0
- package/dist/src/modules/engines/risk-engine.js +106 -0
- package/dist/src/modules/engines/risk-engine.js.map +1 -0
- package/dist/src/modules/engines/routing-engine.d.ts +11 -0
- package/dist/src/modules/engines/routing-engine.js +74 -0
- package/dist/src/modules/engines/routing-engine.js.map +1 -0
- package/dist/src/modules/engines/types.d.ts +47 -0
- package/dist/src/modules/engines/types.js +2 -0
- package/dist/src/modules/engines/types.js.map +1 -0
- package/dist/src/shared/constants.d.ts +6 -2
- package/dist/src/shared/constants.js +5 -1
- package/dist/src/shared/constants.js.map +1 -1
- package/dist/src/shared/fs.d.ts +1 -0
- package/dist/src/shared/fs.js +4 -0
- package/dist/src/shared/fs.js.map +1 -1
- package/dist/src/shared/storage.d.ts +60 -0
- package/dist/src/shared/storage.js +208 -0
- package/dist/src/shared/storage.js.map +1 -0
- package/dist/tests/adapter.test.js +3 -2
- package/dist/tests/adapter.test.js.map +1 -1
- package/dist/tests/agent-memory-v2.test.d.ts +1 -0
- package/dist/tests/agent-memory-v2.test.js +68 -0
- package/dist/tests/agent-memory-v2.test.js.map +1 -0
- package/dist/tests/agents-definitions.test.js +42 -0
- package/dist/tests/agents-definitions.test.js.map +1 -1
- package/dist/tests/integration/hermes_locking.test.js +7 -10
- package/dist/tests/integration/hermes_locking.test.js.map +1 -1
- package/dist/tests/orchestrate.test.js +5 -1
- package/dist/tests/orchestrate.test.js.map +1 -1
- package/dist/tests/orchestrator-dependencies.test.d.ts +1 -0
- package/dist/tests/orchestrator-dependencies.test.js +52 -0
- package/dist/tests/orchestrator-dependencies.test.js.map +1 -0
- package/dist/tests/plan.test.d.ts +1 -0
- package/dist/tests/plan.test.js +63 -0
- package/dist/tests/plan.test.js.map +1 -0
- package/dist/tests/planning-engine.test.d.ts +1 -0
- package/dist/tests/planning-engine.test.js +50 -0
- package/dist/tests/planning-engine.test.js.map +1 -0
- package/dist/tests/status-cost.test.d.ts +1 -0
- package/dist/tests/status-cost.test.js +54 -0
- package/dist/tests/status-cost.test.js.map +1 -0
- package/dist/tests/status.test.js +8 -7
- package/dist/tests/status.test.js.map +1 -1
- package/dist/tests/trace-replay.test.d.ts +1 -0
- package/dist/tests/trace-replay.test.js +65 -0
- package/dist/tests/trace-replay.test.js.map +1 -0
- package/dist/tests/trace.test.js +14 -7
- package/dist/tests/trace.test.js.map +1 -1
- package/dist/ui/assets/index-Bkt7APzu.css +1 -0
- package/dist/ui/assets/index-CeX-06mI.js +49 -0
- package/dist/ui/index.html +14 -0
- package/framework-mcp/dist/constants.js +1 -1
- package/framework-mcp/{src/constants.ts ā dist/framework-mcp/src/constants.js} +4 -18
- package/framework-mcp/{src/index.ts ā dist/framework-mcp/src/index.js} +52 -53
- package/framework-mcp/dist/framework-mcp/src/resources/index.js +58 -0
- package/framework-mcp/{src/tools/control_plane/locking.ts ā dist/framework-mcp/src/tools/control_plane/locking.js} +14 -21
- package/framework-mcp/{src/tools/control_plane/registry.ts ā dist/framework-mcp/src/tools/control_plane/registry.js} +8 -11
- package/framework-mcp/{src/tools/definitions.ts ā dist/framework-mcp/src/tools/definitions.js} +35 -5
- package/framework-mcp/{src/tools/file_system/batch_surgical_edit.ts ā dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js} +16 -31
- package/framework-mcp/{src/tools/file_system/patch_file.ts ā dist/framework-mcp/src/tools/file_system/patch_file.js} +9 -14
- package/framework-mcp/{src/tools/file_system/read_file.ts ā dist/framework-mcp/src/tools/file_system/read_file.js} +9 -16
- package/framework-mcp/{src/tools/file_system/replace_text.ts ā dist/framework-mcp/src/tools/file_system/replace_text.js} +13 -17
- package/framework-mcp/{src/tools/file_system/write_file.ts ā dist/framework-mcp/src/tools/file_system/write_file.js} +14 -16
- package/framework-mcp/{src/tools/framework/audit_deps.ts ā dist/framework-mcp/src/tools/framework/audit_deps.js} +9 -17
- package/framework-mcp/{src/tools/framework/get_status.ts ā dist/framework-mcp/src/tools/framework/get_status.js} +1 -3
- package/framework-mcp/{src/tools/framework/orchestrate.ts ā dist/framework-mcp/src/tools/framework/orchestrate.js} +1 -3
- package/framework-mcp/{src/tools/framework/run_tests.ts ā dist/framework-mcp/src/tools/framework/run_tests.js} +9 -12
- package/framework-mcp/dist/framework-mcp/src/tools/framework/submit_plan.js +13 -0
- package/framework-mcp/{src/tools/framework/update_contract_hash.ts ā dist/framework-mcp/src/tools/framework/update_contract_hash.js} +1 -3
- package/framework-mcp/{src/tools/framework/update_memory.ts ā dist/framework-mcp/src/tools/framework/update_memory.js} +2 -4
- package/framework-mcp/{src/tools/index.ts ā dist/framework-mcp/src/tools/index.js} +5 -7
- package/framework-mcp/{src/tools/memory/get_insights.ts ā dist/framework-mcp/src/tools/memory/get_insights.js} +4 -11
- package/framework-mcp/{src/tools/memory/read_memory.ts ā dist/framework-mcp/src/tools/memory/read_memory.js} +3 -6
- package/framework-mcp/{src/tools/messaging/log_action.ts ā dist/framework-mcp/src/tools/messaging/log_action.js} +2 -8
- package/framework-mcp/{src/tools/messaging/send_message.ts ā dist/framework-mcp/src/tools/messaging/send_message.js} +19 -22
- package/framework-mcp/{src/tools/observability/check_ports.ts ā dist/framework-mcp/src/tools/observability/check_ports.js} +6 -10
- package/framework-mcp/{src/tools/observability/get_health.ts ā dist/framework-mcp/src/tools/observability/get_health.js} +1 -6
- package/framework-mcp/{src/tools/quality/check_lint.ts ā dist/framework-mcp/src/tools/quality/check_lint.js} +3 -9
- package/framework-mcp/{src/tools/search/get_gaps.ts ā dist/framework-mcp/src/tools/search/get_gaps.js} +12 -18
- package/framework-mcp/{src/tools/search/get_map.ts ā dist/framework-mcp/src/tools/search/get_map.js} +14 -19
- package/framework-mcp/{src/tools/search/grep_search.ts ā dist/framework-mcp/src/tools/search/grep_search.js} +26 -26
- package/framework-mcp/{src/tools/search/list_dir.ts ā dist/framework-mcp/src/tools/search/list_dir.js} +4 -10
- package/framework-mcp/{src/tools/shell/run_command.ts ā dist/framework-mcp/src/tools/shell/run_command.js} +1 -11
- package/framework-mcp/dist/framework-mcp/src/tools/types.js +1 -0
- package/framework-mcp/{src/utils/cli.ts ā dist/framework-mcp/src/utils/cli.js} +25 -19
- package/framework-mcp/dist/framework-mcp/src/utils/compliance.js +231 -0
- package/framework-mcp/{src/utils/fs.ts ā dist/framework-mcp/src/utils/fs.js} +9 -10
- package/framework-mcp/{src/utils/metrics.ts ā dist/framework-mcp/src/utils/metrics.js} +11 -28
- package/framework-mcp/dist/framework-mcp/src/utils/permissions.js +71 -0
- package/framework-mcp/{src/utils/security.ts ā dist/framework-mcp/src/utils/security.js} +9 -15
- package/framework-mcp/dist/index.js +29 -5
- package/framework-mcp/dist/resources/index.js +58 -0
- package/{src/cli/adapters/core.ts ā framework-mcp/dist/src/cli/adapters/core.js} +21 -41
- package/{src/cli/adapters/index.ts ā framework-mcp/dist/src/cli/adapters/index.js} +1 -1
- package/{src/cli/adapters/paths.ts ā framework-mcp/dist/src/cli/adapters/paths.js} +19 -53
- package/{src/cli/adapters/scaffold.ts ā framework-mcp/dist/src/cli/adapters/scaffold.js} +18 -42
- package/{src/cli/adapters/utils.ts ā framework-mcp/dist/src/cli/adapters/utils.js} +19 -31
- package/{src/cli/commands/approve.ts ā framework-mcp/dist/src/cli/commands/approve.js} +15 -25
- package/{src/cli/commands/check.ts ā framework-mcp/dist/src/cli/commands/check.js} +36 -43
- package/{src/cli/commands/compliance.ts ā framework-mcp/dist/src/cli/commands/compliance.js} +10 -15
- package/{src/cli/commands/contract.ts ā framework-mcp/dist/src/cli/commands/contract.js} +13 -31
- package/framework-mcp/dist/src/cli/commands/dashboard.js +123 -0
- package/{src/cli/commands/explorer.ts ā framework-mcp/dist/src/cli/commands/explorer.js} +14 -17
- package/{src/cli/commands/git.ts ā framework-mcp/dist/src/cli/commands/git.js} +15 -14
- package/framework-mcp/dist/src/cli/commands/init/create-agent.js +58 -0
- package/{src/cli/commands/init/scaffold-core.ts ā framework-mcp/dist/src/cli/commands/init/scaffold-core.js} +35 -59
- package/framework-mcp/dist/src/cli/commands/init/scaffold-docs.js +34 -0
- package/{src/cli/commands/init/scaffold-ops.ts ā framework-mcp/dist/src/cli/commands/init/scaffold-ops.js} +19 -22
- package/{src/cli/commands/init/scaffold-standards.ts ā framework-mcp/dist/src/cli/commands/init/scaffold-standards.js} +20 -20
- package/{src/cli/commands/init.ts ā framework-mcp/dist/src/cli/commands/init.js} +51 -77
- package/{src/cli/commands/knowledge.ts ā framework-mcp/dist/src/cli/commands/knowledge.js} +9 -11
- package/{src/cli/commands/lint.ts ā framework-mcp/dist/src/cli/commands/lint.js} +5 -6
- package/framework-mcp/dist/src/cli/commands/log.js +10 -0
- package/{src/cli/commands/memory.ts ā framework-mcp/dist/src/cli/commands/memory.js} +1 -3
- package/framework-mcp/dist/src/cli/commands/orchestrate.js +159 -0
- package/framework-mcp/dist/src/cli/commands/plan.js +117 -0
- package/{src/cli/commands/script.ts ā framework-mcp/dist/src/cli/commands/script.js} +6 -7
- package/{src/cli/commands/security.ts ā framework-mcp/dist/src/cli/commands/security.js} +6 -8
- package/framework-mcp/dist/src/cli/commands/status.js +97 -0
- package/framework-mcp/dist/src/cli/commands/trace.js +109 -0
- package/{src/cli/index.ts ā framework-mcp/dist/src/cli/index.js} +80 -64
- package/{src/cli/shims.ts ā framework-mcp/dist/src/cli/shims.js} +15 -15
- package/{src/cli/utils/claude.ts ā framework-mcp/dist/src/cli/utils/claude.js} +8 -15
- package/{src/cli/utils/compliance.ts ā framework-mcp/dist/src/cli/utils/compliance.js} +18 -36
- package/{src/cli/utils/config-schema.ts ā framework-mcp/dist/src/cli/utils/config-schema.js} +0 -6
- package/{src/cli/utils/fs.ts ā framework-mcp/dist/src/cli/utils/fs.js} +34 -67
- package/{src/cli/utils/i18n.ts ā framework-mcp/dist/src/cli/utils/i18n.js} +3 -17
- package/{src/cli/utils/memory.ts ā framework-mcp/dist/src/cli/utils/memory.js} +87 -114
- package/{src/cli/utils/pkg.ts ā framework-mcp/dist/src/cli/utils/pkg.js} +120 -155
- package/{src/cli/utils/schemas.ts ā framework-mcp/dist/src/cli/utils/schemas.js} +0 -3
- package/{src/cli/utils/string.ts ā framework-mcp/dist/src/cli/utils/string.js} +18 -24
- package/{src/cli/utils/time.ts ā framework-mcp/dist/src/cli/utils/time.js} +4 -4
- package/{src/cli/utils/ui.ts ā framework-mcp/dist/src/cli/utils/ui.js} +9 -17
- package/{src/contracts/tasks.ts ā framework-mcp/dist/src/contracts/tasks.js} +0 -6
- package/framework-mcp/dist/src/dashboard/vite.config.js +15 -0
- package/framework-mcp/dist/src/modules/adapters/definitions.js +140 -0
- package/framework-mcp/dist/src/modules/adapters/registry.js +18 -0
- package/{src/modules/adapters/shared.ts ā framework-mcp/dist/src/modules/adapters/shared.js} +9 -25
- package/framework-mcp/dist/src/modules/adapters/types.js +1 -0
- package/{src/modules/agents/definitions.ts ā framework-mcp/dist/src/modules/agents/definitions.js} +158 -161
- package/{src/modules/agents/registry/analyst.ts ā framework-mcp/dist/src/modules/agents/registry/analyst.js} +9 -14
- package/{src/modules/agents/registry/architect.ts ā framework-mcp/dist/src/modules/agents/registry/architect.js} +9 -14
- package/{src/modules/agents/registry/backend.ts ā framework-mcp/dist/src/modules/agents/registry/backend.js} +16 -13
- package/{src/modules/agents/registry/database.ts ā framework-mcp/dist/src/modules/agents/registry/database.js} +16 -14
- package/{src/modules/agents/registry/devops.ts ā framework-mcp/dist/src/modules/agents/registry/devops.js} +15 -14
- package/{src/modules/agents/registry/explorer.ts ā framework-mcp/dist/src/modules/agents/registry/explorer.js} +9 -14
- package/{src/modules/agents/registry/frontend.ts ā framework-mcp/dist/src/modules/agents/registry/frontend.js} +17 -14
- package/{src/modules/agents/registry/git.ts ā framework-mcp/dist/src/modules/agents/registry/git.js} +9 -14
- package/{src/modules/agents/registry/manager.ts ā framework-mcp/dist/src/modules/agents/registry/manager.js} +10 -15
- package/{src/modules/agents/registry/mobile.ts ā framework-mcp/dist/src/modules/agents/registry/mobile.js} +9 -14
- package/{src/modules/agents/registry/native.ts ā framework-mcp/dist/src/modules/agents/registry/native.js} +9 -14
- package/{src/modules/agents/registry/quality.ts ā framework-mcp/dist/src/modules/agents/registry/quality.js} +9 -14
- package/{src/modules/agents/registry/security.ts ā framework-mcp/dist/src/modules/agents/registry/security.js} +15 -14
- package/framework-mcp/dist/src/modules/agents/types.js +1 -0
- package/framework-mcp/dist/src/modules/engines/evaluation-engine.js +102 -0
- package/framework-mcp/dist/src/modules/engines/health-engine.js +49 -0
- package/framework-mcp/dist/src/modules/engines/planning-engine.js +78 -0
- package/framework-mcp/dist/src/modules/engines/risk-engine.js +105 -0
- package/framework-mcp/dist/src/modules/engines/routing-engine.js +73 -0
- package/framework-mcp/dist/src/modules/engines/types.js +1 -0
- package/{src/modules/skills/definitions.ts ā framework-mcp/dist/src/modules/skills/definitions.js} +0 -1
- package/{src/shared/constants.ts ā framework-mcp/dist/src/shared/constants.js} +40 -71
- package/{src/shared/errors.ts ā framework-mcp/dist/src/shared/errors.js} +10 -17
- package/{src/shared/fs.ts ā framework-mcp/dist/src/shared/fs.js} +14 -13
- package/{src/shared/logger.ts ā framework-mcp/dist/src/shared/logger.js} +28 -51
- package/framework-mcp/dist/src/shared/storage.js +207 -0
- package/framework-mcp/dist/src/shared/types.js +12 -0
- package/framework-mcp/dist/tools/control_plane/locking.js +3 -3
- package/framework-mcp/dist/tools/control_plane/registry.js +3 -2
- package/framework-mcp/dist/tools/definitions.js +33 -1
- package/framework-mcp/dist/tools/file_system/batch_surgical_edit.js +8 -3
- package/framework-mcp/dist/tools/file_system/patch_file.js +8 -3
- package/framework-mcp/dist/tools/file_system/read_file.js +3 -3
- package/framework-mcp/dist/tools/file_system/replace_text.js +8 -3
- package/framework-mcp/dist/tools/file_system/write_file.js +10 -5
- package/framework-mcp/dist/tools/framework/audit_deps.js +2 -2
- package/framework-mcp/dist/tools/framework/run_tests.js +2 -2
- package/framework-mcp/dist/tools/framework/submit_plan.js +13 -0
- package/framework-mcp/dist/tools/framework/update_memory.js +1 -1
- package/framework-mcp/dist/tools/index.js +2 -0
- package/framework-mcp/dist/tools/memory/get_insights.js +1 -1
- package/framework-mcp/dist/tools/messaging/log_action.js +1 -1
- package/framework-mcp/dist/tools/messaging/send_message.js +5 -5
- package/framework-mcp/dist/tools/observability/check_ports.js +1 -1
- package/framework-mcp/dist/tools/quality/check_lint.js +2 -2
- package/framework-mcp/dist/tools/search/get_gaps.js +1 -1
- package/framework-mcp/dist/tools/search/grep_search.js +3 -3
- package/framework-mcp/dist/utils/compliance.js +158 -5
- package/framework-mcp/dist/utils/permissions.js +71 -0
- package/framework-mcp/package.json +7 -1
- package/mcp.json +1 -1
- package/package.json +10 -6
- package/templates/prompts/contract-design-recipe.md +1 -1
- package/templates/prompts/db-management-recipe.md +3 -3
- package/templates/prompts/deployment-recipe.md +3 -3
- package/templates/prompts/performance-optimization-recipe.md +3 -3
- package/templates/prompts/pull-request-template.md +2 -2
- package/templates/prompts/security-audit-recipe.md +3 -3
- package/templates/standards/crud-governance.md +1 -1
- package/templates/standards/deployment-standards.md +1 -1
- package/templates/standards/governance-standards.md +1 -1
- package/templates/standards/llm-governance.md +1 -1
- package/templates/standards/nextjs-standards.md +13 -0
- package/templates/standards/observability-standards.md +1 -1
- package/templates/standards/security-audit-standards.md +1 -1
- package/templates/standards/security-standards.md +1 -1
- package/templates/standards/testing-standards.md +1 -1
- package/templates/standards/vite-standards.md +13 -0
- package/framework-mcp/package-lock.json +0 -1191
- package/framework-mcp/src/declarations.d.ts +0 -17
- package/framework-mcp/src/tools/types.ts +0 -89
- package/framework-mcp/src/utils/compliance.ts +0 -95
- package/framework-mcp/tests/tools/file_system/file_system_tools.test.ts +0 -212
- package/framework-mcp/tests/tools/messaging/send_message.test.ts +0 -136
- package/framework-mcp/tests/tools/quality/check_lint.test.ts +0 -46
- package/framework-mcp/tests/tools/shell/run_command.test.ts +0 -55
- package/framework-mcp/tsconfig.json +0 -14
- package/src/cli/commands/init/scaffold-docs.ts +0 -44
- package/src/cli/commands/log.ts +0 -37
- package/src/cli/commands/orchestrate.ts +0 -450
- package/src/cli/commands/plan.ts +0 -113
- package/src/cli/commands/status.ts +0 -44
- package/src/cli/commands/trace.ts +0 -31
- package/src/modules/adapters/definitions.ts +0 -171
- package/src/modules/adapters/registry.ts +0 -27
- package/src/modules/adapters/types.ts +0 -16
- package/src/modules/agents/types.ts +0 -37
- package/src/schema/agent-lifecycle-schema.json +0 -59
- package/src/shared/types.ts +0 -20
- /package/{src/contracts/index.ts ā framework-mcp/dist/src/contracts/index.js} +0 -0
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { writeTextFile } from "../../utils/fs.js";
|
|
4
|
-
import { getPackageRoot } from "../../utils/pkg.js";
|
|
5
|
-
import { logger } from "../../../shared/logger.js";
|
|
6
|
-
|
|
7
|
-
export function scaffoldProjectDocs(projectRoot: string, options: { backendLanguage: string }, dryRun: boolean) {
|
|
8
|
-
if (dryRun) return;
|
|
9
|
-
|
|
10
|
-
const docsDir = path.join(projectRoot, "docs");
|
|
11
|
-
if (!fs.existsSync(docsDir)) fs.mkdirSync(docsDir, { recursive: true });
|
|
12
|
-
|
|
13
|
-
// Scaffold tech-stack.md with dynamic content
|
|
14
|
-
const techStackPath = path.join(docsDir, "tech-stack.md");
|
|
15
|
-
let techStackContent = "";
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
const templatePath = path.join(getPackageRoot(), "docs/tech-stack.md");
|
|
19
|
-
if (fs.existsSync(templatePath)) {
|
|
20
|
-
techStackContent = fs.readFileSync(templatePath, "utf8");
|
|
21
|
-
|
|
22
|
-
// Replace the backend language in the template
|
|
23
|
-
// Assuming the template has a row like: | **Backend Altyapısı** | Node.js v20+ & TypeScript v5+ | ... |
|
|
24
|
-
// We'll use a more generic replacement or just append/update the specific section.
|
|
25
|
-
const lang = options.backendLanguage;
|
|
26
|
-
|
|
27
|
-
// If it's a new project, we can just rewrite the table or use a placeholder in the template.
|
|
28
|
-
// For now, let's assume we want to update the "Backend" or "GeliÅtirme Ortamı" row.
|
|
29
|
-
techStackContent = techStackContent.replace(
|
|
30
|
-
/\| \*\*GeliÅtirme Ortamı\*\* \| .* \|/,
|
|
31
|
-
`| **GeliÅtirme Ortamı** | ${lang} |`
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
} catch (e) {
|
|
35
|
-
logger.debug("Failed to read tech-stack.md template", e);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (!techStackContent) {
|
|
39
|
-
techStackContent = `# š ļø Project Tech Stack\n\n- **Backend Language:** ${options.backendLanguage}\n`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
writeTextFile(techStackPath, techStackContent);
|
|
43
|
-
console.warn(`ā
Project documentation updated: docs/tech-stack.md (Language: ${options.backendLanguage})`);
|
|
44
|
-
}
|
package/src/cli/commands/log.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
|
|
4
|
-
import { getFrameworkDir } from "../utils/memory.js";
|
|
5
|
-
import { normalizeAgentName } from "../utils/string.js";
|
|
6
|
-
|
|
7
|
-
import { writeJsonFile } from "../utils/fs.js";
|
|
8
|
-
|
|
9
|
-
export async function logAgentActionCommand(data: { agent?: unknown; action?: string; requestId?: string; traceId?: string; status?: string; summary?: string; files?: string[]; details?: Record<string, unknown> }) {
|
|
10
|
-
const frameworkDir = getFrameworkDir();
|
|
11
|
-
const logsDir = path.join(frameworkDir, "logs");
|
|
12
|
-
if (!fs.existsSync(logsDir)) {
|
|
13
|
-
fs.mkdirSync(logsDir, { recursive: true });
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const agent = normalizeAgentName(data.agent);
|
|
17
|
-
const logPath = path.join(logsDir, `${agent}.json`);
|
|
18
|
-
let logs: Record<string, unknown>[] = [];
|
|
19
|
-
|
|
20
|
-
if (fs.existsSync(logPath)) {
|
|
21
|
-
try {
|
|
22
|
-
logs = JSON.parse(fs.readFileSync(logPath, "utf8"));
|
|
23
|
-
if (!Array.isArray(logs)) logs = [];
|
|
24
|
-
} catch {
|
|
25
|
-
logs = [];
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const newEntry = {
|
|
30
|
-
timestamp: new Date().toISOString(),
|
|
31
|
-
...data,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
logs.push(newEntry);
|
|
35
|
-
writeJsonFile(logPath, logs);
|
|
36
|
-
console.warn(`ā
Logged action to ${frameworkDir}/logs/${agent}.json`);
|
|
37
|
-
}
|
|
@@ -1,450 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { getFrameworkDir, updateDocumentStore, readStatus } from "../utils/memory.js";
|
|
4
|
-
import { UI } from "../utils/ui.js";
|
|
5
|
-
import { writeTextFile, appendFile } from "../utils/fs.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
import { logger } from "../../shared/logger.js";
|
|
8
|
-
import { TaskRequestSchema } from "../../contracts/tasks.js";
|
|
9
|
-
import { sleep } from "../utils/time.js";
|
|
10
|
-
|
|
11
|
-
export const HermesMessageSchema = z.object({
|
|
12
|
-
timestamp: z.string(),
|
|
13
|
-
from: z.string(),
|
|
14
|
-
to: z.string(),
|
|
15
|
-
category: z.enum(["ACTION", "DELEGATION", "SUBTASK", "REPLY", "ALERT"]),
|
|
16
|
-
content: z.string(), // This is the payload to be validated
|
|
17
|
-
traceId: z.string(),
|
|
18
|
-
parentId: z.string().optional(),
|
|
19
|
-
status: z.enum(["PENDING", "PROCESSED", "WAITING", "APPROVED"]),
|
|
20
|
-
priority: z.enum(["HIGH", "NORMAL", "LOW"]).optional(),
|
|
21
|
-
action: z.string().optional(),
|
|
22
|
-
requiresApproval: z.boolean().optional(),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export type HermesMessage = z.infer<typeof HermesMessageSchema>;
|
|
26
|
-
|
|
27
|
-
// Global status cache for in-memory optimization
|
|
28
|
-
let agentStatusCache: Record<string, { state: string; task: string; lastUpdated?: string }> = {};
|
|
29
|
-
let isLooping = false;
|
|
30
|
-
|
|
31
|
-
async function acquireMessageLock(lockPath: string): Promise<boolean> {
|
|
32
|
-
let retries = 5;
|
|
33
|
-
while (retries > 0) {
|
|
34
|
-
try {
|
|
35
|
-
if (fs.existsSync(lockPath)) {
|
|
36
|
-
try {
|
|
37
|
-
const stats = fs.statSync(lockPath);
|
|
38
|
-
if (Date.now() - stats.mtimeMs > 10000) {
|
|
39
|
-
const tempLockPath = `${lockPath}.${Math.random().toString(36).substring(2)}.old`;
|
|
40
|
-
fs.renameSync(lockPath, tempLockPath);
|
|
41
|
-
fs.unlinkSync(tempLockPath);
|
|
42
|
-
}
|
|
43
|
-
} catch {
|
|
44
|
-
// ignore
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
fs.writeFileSync(lockPath, `Locked by orchestrator at ${new Date().toISOString()}`, { flag: "wx" });
|
|
48
|
-
return true;
|
|
49
|
-
} catch (err: unknown) {
|
|
50
|
-
const error = err as { code?: string };
|
|
51
|
-
if (error.code === "EEXIST") {
|
|
52
|
-
retries--;
|
|
53
|
-
if (retries > 0) {
|
|
54
|
-
await sleep(100);
|
|
55
|
-
}
|
|
56
|
-
} else {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function releaseMessageLock(lockPath: string) {
|
|
65
|
-
if (fs.existsSync(lockPath)) {
|
|
66
|
-
try {
|
|
67
|
-
fs.unlinkSync(lockPath);
|
|
68
|
-
} catch {
|
|
69
|
-
// ignore
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export async function orchestrateCommand(options?: { maxIterations?: number }) {
|
|
75
|
-
UI.intent("Hermes Message Broker", "Starting the live agent orchestration loop...");
|
|
76
|
-
|
|
77
|
-
const frameworkDir = getFrameworkDir();
|
|
78
|
-
const messagesDir = path.join(frameworkDir, "messages");
|
|
79
|
-
const maxIterations = options?.maxIterations;
|
|
80
|
-
let iterationCount = 0;
|
|
81
|
-
|
|
82
|
-
// Reset in-memory cache so each invocation starts fresh (important for test isolation)
|
|
83
|
-
agentStatusCache = {};
|
|
84
|
-
|
|
85
|
-
// Graceful Shutdown Handling
|
|
86
|
-
const shutdown = async () => {
|
|
87
|
-
if (!isLooping) return;
|
|
88
|
-
isLooping = false;
|
|
89
|
-
UI.warning("\nš Shutdown signal received. Cleaning up Hermes loop...");
|
|
90
|
-
// Additional cleanup like releasing global locks could go here
|
|
91
|
-
process.exit(0);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
process.on("SIGINT", shutdown);
|
|
95
|
-
process.on("SIGTERM", shutdown);
|
|
96
|
-
|
|
97
|
-
isLooping = true;
|
|
98
|
-
|
|
99
|
-
while (isLooping) {
|
|
100
|
-
try {
|
|
101
|
-
if (Object.keys(agentStatusCache).length === 0) {
|
|
102
|
-
const diskStatus = readStatus();
|
|
103
|
-
agentStatusCache = diskStatus || {};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Check for agent timeouts (e.g. 30 minutes in EXECUTING state)
|
|
107
|
-
const agentStatuses = readStatus();
|
|
108
|
-
let updatedStatus = false;
|
|
109
|
-
for (const [agentName, info] of Object.entries(agentStatuses)) {
|
|
110
|
-
const { state, lastUpdated, task } = info as { state: string; task: string; lastUpdated?: string };
|
|
111
|
-
if (state === "EXECUTING" && lastUpdated) {
|
|
112
|
-
const lastUpdatedTime = Date.parse(lastUpdated);
|
|
113
|
-
if (!isNaN(lastUpdatedTime) && Date.now() - lastUpdatedTime > 30 * 60 * 1000) {
|
|
114
|
-
const displayAgent = agentName.startsWith("@") ? agentName : `@${agentName}`;
|
|
115
|
-
UI.error(`ā ļø Agent ${displayAgent} has TIMED OUT (in EXECUTING state for >30m). Triggering Self-Healing...`);
|
|
116
|
-
|
|
117
|
-
// SELF-HEALING: Log the failure and reset to READY
|
|
118
|
-
agentStatuses[agentName] = {
|
|
119
|
-
state: "READY",
|
|
120
|
-
task: "Idle (Recovered from Timeout)",
|
|
121
|
-
lastUpdated: new Date().toISOString()
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
UI.success(`ā
Hermes Self-Healing: ${displayAgent} reset to READY state. Task "${task}" aborted for recovery.`);
|
|
125
|
-
updatedStatus = true;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (updatedStatus) {
|
|
130
|
-
updateDocumentStore("status", agentStatuses);
|
|
131
|
-
agentStatusCache = { ...agentStatuses }; // Sync cache
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (fs.existsSync(messagesDir)) {
|
|
135
|
-
const messageFiles = fs.readdirSync(messagesDir).filter((f) => f.endsWith(".json"));
|
|
136
|
-
const pendingMessages: HermesMessage[] = [];
|
|
137
|
-
const fileMessagesMap: Record<string, HermesMessage[]> = {};
|
|
138
|
-
const acquiredLocks: string[] = [];
|
|
139
|
-
|
|
140
|
-
try {
|
|
141
|
-
for (const file of messageFiles) {
|
|
142
|
-
const agentName = file.replace(".json", "");
|
|
143
|
-
|
|
144
|
-
const lockPath = path.join(messagesDir, `${agentName}.lock`);
|
|
145
|
-
const locked = await acquireMessageLock(lockPath);
|
|
146
|
-
if (!locked) {
|
|
147
|
-
// Skip this file in this iteration if we cannot lock it to avoid race conditions
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
acquiredLocks.push(lockPath);
|
|
151
|
-
|
|
152
|
-
const filePath = path.join(messagesDir, file);
|
|
153
|
-
try {
|
|
154
|
-
const content = fs.readFileSync(filePath, "utf8").trim();
|
|
155
|
-
if (!content) continue;
|
|
156
|
-
const lines = content.split("\n");
|
|
157
|
-
const allMsgs: HermesMessage[] = [];
|
|
158
|
-
lines.forEach((line) => {
|
|
159
|
-
if (!line.trim()) return;
|
|
160
|
-
try {
|
|
161
|
-
const parsed = JSON.parse(line);
|
|
162
|
-
const msg = HermesMessageSchema.parse(parsed);
|
|
163
|
-
|
|
164
|
-
// Contract Validation for structured task messages
|
|
165
|
-
// ACTION & DELEGATION must be valid TaskRequest payloads
|
|
166
|
-
// SUBTASK must have a parentId and valid task payload
|
|
167
|
-
// ALERT must have a content string (free-form, no schema required)
|
|
168
|
-
if (msg.category === "ACTION" || msg.category === "DELEGATION") {
|
|
169
|
-
try {
|
|
170
|
-
const payload = JSON.parse(msg.content);
|
|
171
|
-
TaskRequestSchema.parse(payload);
|
|
172
|
-
} catch (e) {
|
|
173
|
-
UI.error(`Invalid task contract payload in ${msg.category} from @${msg.from}: ${(e as Error).message}`);
|
|
174
|
-
return; // Skip invalid message
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
if (msg.category === "SUBTASK") {
|
|
178
|
-
if (!msg.parentId) {
|
|
179
|
-
UI.error(`SUBTASK from @${msg.from} is missing required parentId ā skipping.`);
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
try {
|
|
183
|
-
const payload = JSON.parse(msg.content);
|
|
184
|
-
TaskRequestSchema.parse(payload);
|
|
185
|
-
} catch (e) {
|
|
186
|
-
UI.error(`Invalid SUBTASK payload from @${msg.from}: ${(e as Error).message}`);
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
if (msg.category === "ALERT" && !msg.content.trim()) {
|
|
191
|
-
UI.error(`ALERT from @${msg.from} has empty content ā skipping.`);
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// A message is actionable if it's pending, or if it's been approved.
|
|
196
|
-
if (msg.status === "PENDING" || msg.status === "APPROVED") {
|
|
197
|
-
pendingMessages.push(msg);
|
|
198
|
-
}
|
|
199
|
-
allMsgs.push(msg);
|
|
200
|
-
} catch (e) {
|
|
201
|
-
UI.error(`Skipping invalid Hermes message format: ${(e as Error).message}`);
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
fileMessagesMap[file] = allMsgs;
|
|
205
|
-
} catch (err) {
|
|
206
|
-
UI.error(`Error occurred while reading ${file}.`);
|
|
207
|
-
logger.debug(`Failed to read message file ${file}`, err);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (pendingMessages.length > 0) {
|
|
212
|
-
// Sort by priority: HIGH -> NORMAL -> LOW
|
|
213
|
-
const priorityOrder = { HIGH: 1, NORMAL: 2, LOW: 3 };
|
|
214
|
-
pendingMessages.sort((a, b) => {
|
|
215
|
-
const pA = priorityOrder[a.priority || "NORMAL"] || 2;
|
|
216
|
-
const pB = priorityOrder[b.priority || "NORMAL"] || 2;
|
|
217
|
-
if (pA !== pB) return pA - pB;
|
|
218
|
-
return Date.parse(a.timestamp) - Date.parse(b.timestamp);
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
UI.intent("Multi-Agent Orchestration", `${pendingMessages.length} pending tasks and collaboration messages found.`);
|
|
222
|
-
|
|
223
|
-
const statusChanges: Record<string, { state: string; task: string }> = {};
|
|
224
|
-
|
|
225
|
-
for (const msg of pendingMessages) {
|
|
226
|
-
const { from, to, content, traceId, category, status, requiresApproval } = msg;
|
|
227
|
-
|
|
228
|
-
// Approval Gate for high-risk actions.
|
|
229
|
-
// If it requires approval but isn't approved yet, skip it for now.
|
|
230
|
-
if ((category === "ACTION" || category === "ALERT") && requiresApproval && status !== "APPROVED") {
|
|
231
|
-
logger.debug(`Action for @${to} (Trace: ${traceId}) is pending manager approval.`);
|
|
232
|
-
continue;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Gate for regular messages.
|
|
236
|
-
// If it's a non-approval-required message, it should only be processed when PENDING.
|
|
237
|
-
// This prevents re-processing of SUBTASK/REPLY messages that might get set to APPROVED.
|
|
238
|
-
if (!(category === "ACTION" || category === "ALERT") && status !== "PENDING") {
|
|
239
|
-
continue;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
const isSubtask = category === "SUBTASK" || !!msg.parentId;
|
|
244
|
-
const agentLabel = isSubtask ? `${to} (Sub-Agent)` : to;
|
|
245
|
-
|
|
246
|
-
UI.agentBox(agentLabel, content, `Trace: ${traceId} | From: ${from} | Category: ${category}`);
|
|
247
|
-
|
|
248
|
-
let targetState = "EXECUTING";
|
|
249
|
-
if (category === "DELEGATION" || category === "SUBTASK") targetState = "BRIEFED";
|
|
250
|
-
|
|
251
|
-
let taskDescription = content;
|
|
252
|
-
if (category === "DELEGATION" || category === "ACTION") {
|
|
253
|
-
try {
|
|
254
|
-
const payload = JSON.parse(content);
|
|
255
|
-
taskDescription = payload.task || content;
|
|
256
|
-
} catch {
|
|
257
|
-
// Ignore
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
statusChanges[to] = { state: targetState, task: taskDescription };
|
|
262
|
-
|
|
263
|
-
if (targetState === "BRIEFED") {
|
|
264
|
-
UI.success(`${to} informed and took over the task.`);
|
|
265
|
-
statusChanges[to] = { state: "EXECUTING", task: taskDescription };
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
if (isSubtask) {
|
|
269
|
-
UI.success(`Sub-task connection established (Parent: ${msg.parentId || "Unknown"}).`);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
UI.success(`Collaboration initiated: ${from} -> ${to}`);
|
|
273
|
-
|
|
274
|
-
msg.status = "PROCESSED";
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
applyBatchStatusUpdates(statusChanges);
|
|
278
|
-
|
|
279
|
-
const archiveDir = path.join(messagesDir, "archive");
|
|
280
|
-
|
|
281
|
-
for (const file of Object.keys(fileMessagesMap)) {
|
|
282
|
-
const filePath = path.join(messagesDir, file);
|
|
283
|
-
const msgs = fileMessagesMap[file];
|
|
284
|
-
|
|
285
|
-
const activeMsgs = msgs.filter(m => m.status !== "PROCESSED");
|
|
286
|
-
const processedMsgs = msgs.filter(m => m.status === "PROCESSED");
|
|
287
|
-
|
|
288
|
-
try {
|
|
289
|
-
if (activeMsgs.length > 0) {
|
|
290
|
-
const updatedContent = activeMsgs.map(m => JSON.stringify(m)).join("\n") + "\n";
|
|
291
|
-
writeTextFile(filePath, updatedContent);
|
|
292
|
-
} else if (fs.existsSync(filePath)) {
|
|
293
|
-
writeTextFile(filePath, "");
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
if (processedMsgs.length > 0) {
|
|
297
|
-
if (!fs.existsSync(archiveDir)) {
|
|
298
|
-
fs.mkdirSync(archiveDir, { recursive: true });
|
|
299
|
-
}
|
|
300
|
-
const agentName = file.replace(".json", "");
|
|
301
|
-
const archivePath = path.join(archiveDir, `${agentName}_archive.json`);
|
|
302
|
-
const archiveContent = processedMsgs.map(m => JSON.stringify(m)).join("\n") + "\n";
|
|
303
|
-
appendFile(archivePath, archiveContent);
|
|
304
|
-
UI.success(`Archived ${processedMsgs.length} messages for @${agentName}`);
|
|
305
|
-
}
|
|
306
|
-
} catch (err) {
|
|
307
|
-
UI.error(`Error occurred while updating and archiving the message file ${file}.`);
|
|
308
|
-
logger.debug(`Failed to update and archive message file ${file}`, err);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
} finally {
|
|
313
|
-
for (const lockPath of acquiredLocks) {
|
|
314
|
-
releaseMessageLock(lockPath);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
} catch (globalLoopErr) {
|
|
319
|
-
UI.error(`ā ļø Critical error in Hermes orchestration loop: ${(globalLoopErr as Error).message}`);
|
|
320
|
-
logger.debug("Hermes global loop failure", globalLoopErr);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
iterationCount++;
|
|
324
|
-
// If maxIterations is set (e.g. in tests), stop after N iterations without sleeping
|
|
325
|
-
if (maxIterations !== undefined && iterationCount >= maxIterations) {
|
|
326
|
-
isLooping = false;
|
|
327
|
-
break;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// Prevent 100% CPU and provide breathing room for I/O
|
|
331
|
-
await sleep(2000);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Standard tool for agents to delegate tasks to other agents.
|
|
337
|
-
*/
|
|
338
|
-
export async function sendMessage(args: {
|
|
339
|
-
from: string;
|
|
340
|
-
to: string;
|
|
341
|
-
category: "ACTION" | "DELEGATION" | "SUBTASK" | "REPLY" | "ALERT";
|
|
342
|
-
content: string;
|
|
343
|
-
traceId: string;
|
|
344
|
-
parentId?: string;
|
|
345
|
-
priority?: "HIGH" | "NORMAL" | "LOW";
|
|
346
|
-
requiresApproval?: boolean;
|
|
347
|
-
}) {
|
|
348
|
-
const frameworkDir = getFrameworkDir();
|
|
349
|
-
const messagesDir = path.join(frameworkDir, "messages");
|
|
350
|
-
const agentName = args.to.replace("@", "");
|
|
351
|
-
const messagePath = path.join(messagesDir, `${agentName}.json`);
|
|
352
|
-
const lockPath = path.join(messagesDir, `${agentName}.lock`);
|
|
353
|
-
|
|
354
|
-
let retries = 20; // Increased retries from 3 to 20
|
|
355
|
-
let acquired = false;
|
|
356
|
-
while (retries > 0) {
|
|
357
|
-
try {
|
|
358
|
-
if (fs.existsSync(lockPath)) {
|
|
359
|
-
try {
|
|
360
|
-
const stats = fs.statSync(lockPath);
|
|
361
|
-
// Increased stale lock timeout from 5s to 10s for heavy ops
|
|
362
|
-
if (Date.now() - stats.mtimeMs > 10000) {
|
|
363
|
-
UI.warning(`ā»ļø Stale Hermes lock detected for @${agentName}. Clearing lock for @${args.from}.`);
|
|
364
|
-
const tempLockPath = `${lockPath}.${Math.random().toString(36).substring(2)}.old`;
|
|
365
|
-
fs.renameSync(lockPath, tempLockPath);
|
|
366
|
-
fs.unlinkSync(tempLockPath);
|
|
367
|
-
}
|
|
368
|
-
} catch (err) {
|
|
369
|
-
logger.debug(`Failed to unlink stale Hermes lock for ${agentName} concurrently`, err);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
if (!fs.existsSync(messagesDir)) {
|
|
373
|
-
fs.mkdirSync(messagesDir, { recursive: true });
|
|
374
|
-
}
|
|
375
|
-
fs.writeFileSync(lockPath, `Locked by ${args.from} at ${new Date().toISOString()}`, { flag: "wx" });
|
|
376
|
-
acquired = true;
|
|
377
|
-
break;
|
|
378
|
-
} catch (err: unknown) {
|
|
379
|
-
const error = err as { code?: string; message?: string };
|
|
380
|
-
if (error.code === "EEXIST") {
|
|
381
|
-
retries--;
|
|
382
|
-
if (retries > 0) {
|
|
383
|
-
// Exponential backoff or jitter could be added here,
|
|
384
|
-
// but fixed 500ms is usually fine for local file locks.
|
|
385
|
-
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
386
|
-
}
|
|
387
|
-
} else {
|
|
388
|
-
UI.error(`Unexpected error occurred while acquiring the lock: ${error.message || String(err)}`);
|
|
389
|
-
break;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
if (!acquired) {
|
|
395
|
-
UI.error(`Message could not be delivered: Hermes lock is busy. (${args.from} -> ${args.to})`);
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
try {
|
|
400
|
-
const defaultPriority = (args.category === "ALERT" || args.category === "ACTION") ? "HIGH" : "NORMAL";
|
|
401
|
-
// Only ALERT requires manager approval by default.
|
|
402
|
-
// ACTION messages flow freely unless the caller explicitly sets requiresApproval=true.
|
|
403
|
-
// This prevents workflow blockage on normal agent-to-agent task delegation.
|
|
404
|
-
const requiresApproval = args.requiresApproval !== undefined
|
|
405
|
-
? args.requiresApproval
|
|
406
|
-
: args.category === "ALERT";
|
|
407
|
-
|
|
408
|
-
const message: HermesMessage = {
|
|
409
|
-
timestamp: new Date().toISOString(),
|
|
410
|
-
priority: args.priority || defaultPriority,
|
|
411
|
-
...args,
|
|
412
|
-
status: "PENDING",
|
|
413
|
-
requiresApproval: requiresApproval,
|
|
414
|
-
};
|
|
415
|
-
|
|
416
|
-
appendFile(messagePath, JSON.stringify(message) + "\n");
|
|
417
|
-
|
|
418
|
-
return message;
|
|
419
|
-
} catch (err) {
|
|
420
|
-
UI.error(`Message could not be delivered: ${args.from} -> ${args.to}`);
|
|
421
|
-
logger.debug(`Hermes sendMessage failed (${args.from} -> ${args.to})`, err);
|
|
422
|
-
} finally {
|
|
423
|
-
if (acquired && fs.existsSync(lockPath)) {
|
|
424
|
-
try {
|
|
425
|
-
fs.unlinkSync(lockPath);
|
|
426
|
-
} catch {
|
|
427
|
-
// Ignore delete errors if concurrently unlinked
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
function applyBatchStatusUpdates(changes: Record<string, { state: string; task: string }>) {
|
|
435
|
-
let hasChanges = false;
|
|
436
|
-
const now = new Date().toISOString();
|
|
437
|
-
|
|
438
|
-
for (const [agent, data] of Object.entries(changes)) {
|
|
439
|
-
const current = agentStatusCache[agent];
|
|
440
|
-
if (!current || current.state !== data.state || current.task !== data.task) {
|
|
441
|
-
agentStatusCache[agent] = { ...data, lastUpdated: now };
|
|
442
|
-
hasChanges = true;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
if (hasChanges) {
|
|
447
|
-
updateDocumentStore("status", agentStatusCache);
|
|
448
|
-
logger.debug("In-memory status cache synced to disk.");
|
|
449
|
-
}
|
|
450
|
-
}
|
package/src/cli/commands/plan.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { generateULID } from "../utils/time.js";
|
|
4
|
-
import { UI } from "../utils/ui.js";
|
|
5
|
-
import { writeJsonFile } from "../utils/fs.js";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Reads ALL markdown files from the docs/ directory and creates
|
|
9
|
-
* planning tasks from them. Agents will use this to understand
|
|
10
|
-
* project requirements and generate code accordingly.
|
|
11
|
-
*/
|
|
12
|
-
export async function planCommand() {
|
|
13
|
-
const projectRoot = process.cwd();
|
|
14
|
-
const docsDir = path.join(projectRoot, "docs");
|
|
15
|
-
|
|
16
|
-
if (!fs.existsSync(docsDir)) {
|
|
17
|
-
UI.error("Docs directory not found at docs/");
|
|
18
|
-
console.warn("š” Create a docs/ folder with your project requirements in .md files.");
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const entries = fs.readdirSync(docsDir, { withFileTypes: true });
|
|
23
|
-
const mdFiles = entries.filter(e => e.isFile() && e.name.endsWith(".md"));
|
|
24
|
-
|
|
25
|
-
if (mdFiles.length === 0) {
|
|
26
|
-
UI.warning("No markdown files found in docs/ directory.");
|
|
27
|
-
console.warn("š” Add .md files to docs/ with your project requirements.");
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
UI.intent("Planning Engine", `Reading ${mdFiles.length} document(s) from docs/...`);
|
|
32
|
-
|
|
33
|
-
// Discover available template standards
|
|
34
|
-
const templatesDir = path.join(projectRoot, "templates");
|
|
35
|
-
const standards: string[] = [];
|
|
36
|
-
if (fs.existsSync(templatesDir)) {
|
|
37
|
-
const templateFiles = fs.readdirSync(templatesDir);
|
|
38
|
-
standards.push(...templateFiles.filter(f => f.endsWith("-standards.md")).map(f => `templates/${f}`));
|
|
39
|
-
if (standards.length > 0) {
|
|
40
|
-
UI.success(`Found ${standards.length} standard templates available for code generation.`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
let totalTasks = 0;
|
|
45
|
-
|
|
46
|
-
for (const file of mdFiles) {
|
|
47
|
-
const filePath = path.join(docsDir, file.name);
|
|
48
|
-
const content = fs.readFileSync(filePath, "utf8");
|
|
49
|
-
const lines = content.split("\n");
|
|
50
|
-
const traceId = generateULID();
|
|
51
|
-
|
|
52
|
-
UI.success(`š docs/${file.name} (${lines.length} lines) ā Trace: ${traceId}`);
|
|
53
|
-
|
|
54
|
-
console.warn(` Content preview: ${content.substring(0, 200).replace(/\n/g, " ")}...`);
|
|
55
|
-
|
|
56
|
-
// Extract headings as task descriptions
|
|
57
|
-
const headingRegex = /^#{2,4}\s+(.+)$/gm;
|
|
58
|
-
let headingCount = 0;
|
|
59
|
-
while (headingRegex.exec(content) !== null) {
|
|
60
|
-
headingCount++;
|
|
61
|
-
totalTasks++;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Extract checklist items
|
|
65
|
-
const taskRegex = /- \[ \]\s+(.+)/g;
|
|
66
|
-
let taskMatch;
|
|
67
|
-
let taskCount = 0;
|
|
68
|
-
while ((taskMatch = taskRegex.exec(content)) !== null) {
|
|
69
|
-
if (taskMatch[1].trim().length >= 3) {
|
|
70
|
-
taskCount++;
|
|
71
|
-
totalTasks++;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
console.warn(` š ${headingCount} sections, ${taskCount} actionable tasks detected`);
|
|
76
|
-
|
|
77
|
-
// Store in project memory-compatible format
|
|
78
|
-
const memoryDir = path.join(projectRoot, ".atabey", "memory", "tasks");
|
|
79
|
-
if (!fs.existsSync(memoryDir)) {
|
|
80
|
-
fs.mkdirSync(memoryDir, { recursive: true });
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const taskFile = path.join(memoryDir, `${traceId}.json`);
|
|
84
|
-
const taskData = {
|
|
85
|
-
traceId,
|
|
86
|
-
source: `docs/${file.name}`,
|
|
87
|
-
description: `Process requirements from docs/${file.name}`,
|
|
88
|
-
status: "PENDING",
|
|
89
|
-
createdAt: new Date().toISOString(),
|
|
90
|
-
standards,
|
|
91
|
-
headings: headingCount,
|
|
92
|
-
tasks: taskCount,
|
|
93
|
-
preview: content.substring(0, 500),
|
|
94
|
-
};
|
|
95
|
-
writeJsonFile(taskFile, taskData);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Log available standards
|
|
99
|
-
if (standards.length > 0) {
|
|
100
|
-
console.warn("");
|
|
101
|
-
UI.divider();
|
|
102
|
-
console.warn("š Available Enterprise Standards:");
|
|
103
|
-
standards.forEach(s => console.warn(` - ${s}`));
|
|
104
|
-
UI.divider();
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
UI.success(`\nā
Planning complete: ${totalTasks} tasks identified from ${mdFiles.length} document(s).`);
|
|
108
|
-
console.warn("\nš Next steps:");
|
|
109
|
-
console.warn(" 1. Run 'atabey status' to see project state");
|
|
110
|
-
console.warn(" 2. AI agents (Claude, Gemini, Grok, etc.) will read docs/ and templates/");
|
|
111
|
-
console.warn(" 3. Agents generate enterprise-standard code based on requirements");
|
|
112
|
-
console.warn(" 4. Use @agent delegation for specific tasks: atabey @backend \"...\"");
|
|
113
|
-
}
|