atabey 0.0.13 → 0.0.14
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 +1 -1
- package/README.md +252 -52
- package/dist/framework-mcp/src/index.js +914 -62
- package/dist/framework-mcp/src/index.js.map +1 -1
- package/dist/framework-mcp/src/tools/compliance/mask_pii.d.ts +17 -0
- package/dist/framework-mcp/src/tools/compliance/mask_pii.js +56 -0
- package/dist/framework-mcp/src/tools/compliance/mask_pii.js.map +1 -0
- package/dist/framework-mcp/src/tools/definitions.js +10 -9
- package/dist/framework-mcp/src/tools/definitions.js.map +1 -1
- package/dist/framework-mcp/src/tools/framework/run_tests.js +25 -0
- package/dist/framework-mcp/src/tools/framework/run_tests.js.map +1 -1
- package/dist/framework-mcp/src/tools/index.js +7 -8
- package/dist/framework-mcp/src/tools/index.js.map +1 -1
- package/dist/framework-mcp/src/tools/messaging/approve_operation.d.ts +22 -0
- package/dist/framework-mcp/src/tools/messaging/approve_operation.js +81 -0
- package/dist/framework-mcp/src/tools/messaging/approve_operation.js.map +1 -0
- package/dist/framework-mcp/src/tools/messaging/ask_human.d.ts +15 -0
- package/dist/framework-mcp/src/tools/messaging/ask_human.js +89 -20
- package/dist/framework-mcp/src/tools/messaging/ask_human.js.map +1 -1
- package/dist/framework-mcp/src/tools/observability/check_ports.js +3 -1
- package/dist/framework-mcp/src/tools/observability/check_ports.js.map +1 -1
- package/dist/framework-mcp/src/tools/quality/analyze_code_quality.js +13 -64
- package/dist/framework-mcp/src/tools/quality/analyze_code_quality.js.map +1 -1
- package/dist/framework-mcp/src/tools/schemas.d.ts +48 -53
- package/dist/framework-mcp/src/tools/schemas.js +18 -22
- package/dist/framework-mcp/src/tools/schemas.js.map +1 -1
- package/dist/framework-mcp/src/tools/shell/run_command.js +10 -0
- package/dist/framework-mcp/src/tools/shell/run_command.js.map +1 -1
- package/dist/framework-mcp/src/tools/types.d.ts +11 -105
- package/dist/framework-mcp/src/tools/types.js +1 -0
- package/dist/framework-mcp/src/tools/types.js.map +1 -1
- package/dist/framework-mcp/src/utils/auth.d.ts +36 -0
- package/dist/framework-mcp/src/utils/auth.js +79 -0
- package/dist/framework-mcp/src/utils/auth.js.map +1 -0
- package/dist/framework-mcp/src/utils/auto-rollback.d.ts +71 -0
- package/dist/framework-mcp/src/utils/auto-rollback.js +266 -0
- package/dist/framework-mcp/src/utils/auto-rollback.js.map +1 -0
- package/dist/framework-mcp/src/utils/compliance.js +12 -4
- package/dist/framework-mcp/src/utils/compliance.js.map +1 -1
- package/dist/framework-mcp/src/utils/context-optimizer.d.ts +69 -0
- package/dist/framework-mcp/src/utils/context-optimizer.js +157 -0
- package/dist/framework-mcp/src/utils/context-optimizer.js.map +1 -0
- package/dist/framework-mcp/src/utils/discipline.d.ts +68 -0
- package/dist/framework-mcp/src/utils/discipline.js +218 -0
- package/dist/framework-mcp/src/utils/discipline.js.map +1 -0
- package/dist/framework-mcp/src/utils/finops.d.ts +143 -0
- package/dist/framework-mcp/src/utils/finops.js +326 -0
- package/dist/framework-mcp/src/utils/finops.js.map +1 -0
- package/dist/framework-mcp/src/utils/human-in-loop.d.ts +95 -0
- package/dist/framework-mcp/src/utils/human-in-loop.js +216 -0
- package/dist/framework-mcp/src/utils/human-in-loop.js.map +1 -0
- package/dist/framework-mcp/src/utils/license-scanner.d.ts +71 -0
- package/dist/framework-mcp/src/utils/license-scanner.js +284 -0
- package/dist/framework-mcp/src/utils/license-scanner.js.map +1 -0
- package/dist/framework-mcp/src/utils/loop-detector.d.ts +105 -0
- package/dist/framework-mcp/src/utils/loop-detector.js +362 -0
- package/dist/framework-mcp/src/utils/loop-detector.js.map +1 -0
- package/dist/framework-mcp/src/utils/quality.d.ts +19 -0
- package/dist/framework-mcp/src/utils/quality.js +124 -0
- package/dist/framework-mcp/src/utils/quality.js.map +1 -0
- package/dist/framework-mcp/src/utils/rules-engine.d.ts +78 -0
- package/dist/framework-mcp/src/utils/rules-engine.js +232 -0
- package/dist/framework-mcp/src/utils/rules-engine.js.map +1 -0
- package/dist/framework-mcp/src/utils/silent-router.d.ts +47 -0
- package/dist/framework-mcp/src/utils/silent-router.js +129 -0
- package/dist/framework-mcp/src/utils/silent-router.js.map +1 -0
- package/dist/framework-mcp/src/utils/storage.d.ts +1 -0
- package/dist/framework-mcp/src/utils/storage.js +2 -2
- package/dist/framework-mcp/src/utils/storage.js.map +1 -1
- package/dist/framework-mcp/src/utils/telemetry-streamer.d.ts +133 -0
- package/dist/framework-mcp/src/utils/telemetry-streamer.js +397 -0
- package/dist/framework-mcp/src/utils/telemetry-streamer.js.map +1 -0
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js +2 -2
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js.map +1 -1
- package/dist/framework-mcp/tests/tools/framework/run_tests.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/framework/run_tests.test.js +49 -0
- package/dist/framework-mcp/tests/tools/framework/run_tests.test.js.map +1 -0
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js +14 -5
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js.map +1 -1
- package/dist/framework-mcp/tests/tools/observability/check_ports.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/observability/check_ports.test.js +30 -0
- package/dist/framework-mcp/tests/tools/observability/check_ports.test.js.map +1 -0
- package/dist/framework-mcp/tests/tools/shell/run_command.test.js +7 -0
- package/dist/framework-mcp/tests/tools/shell/run_command.test.js.map +1 -1
- package/dist/framework-mcp/tests/utils/auto-rollback.test.d.ts +7 -0
- package/dist/framework-mcp/tests/utils/auto-rollback.test.js +178 -0
- package/dist/framework-mcp/tests/utils/auto-rollback.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/context-optimizer.test.d.ts +1 -0
- package/dist/framework-mcp/tests/utils/context-optimizer.test.js +62 -0
- package/dist/framework-mcp/tests/utils/context-optimizer.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/finops.test.d.ts +7 -0
- package/dist/framework-mcp/tests/utils/finops.test.js +157 -0
- package/dist/framework-mcp/tests/utils/finops.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/human-in-loop.test.d.ts +1 -0
- package/dist/framework-mcp/tests/utils/human-in-loop.test.js +59 -0
- package/dist/framework-mcp/tests/utils/human-in-loop.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/license-scanner.test.d.ts +7 -0
- package/dist/framework-mcp/tests/utils/license-scanner.test.js +131 -0
- package/dist/framework-mcp/tests/utils/license-scanner.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/loop-detector.test.d.ts +7 -0
- package/dist/framework-mcp/tests/utils/loop-detector.test.js +204 -0
- package/dist/framework-mcp/tests/utils/loop-detector.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/rules-engine.test.d.ts +1 -0
- package/dist/framework-mcp/tests/utils/rules-engine.test.js +106 -0
- package/dist/framework-mcp/tests/utils/rules-engine.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/telemetry-streamer.test.d.ts +7 -0
- package/dist/framework-mcp/tests/utils/telemetry-streamer.test.js +201 -0
- package/dist/framework-mcp/tests/utils/telemetry-streamer.test.js.map +1 -0
- package/dist/src/cli/commands/check.js +16 -1
- package/dist/src/cli/commands/check.js.map +1 -1
- package/dist/src/cli/commands/dashboard.js +188 -164
- package/dist/src/cli/commands/dashboard.js.map +1 -1
- package/dist/src/cli/commands/gateway.js +2 -2
- package/dist/src/cli/commands/gateway.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-core.d.ts +2 -0
- package/dist/src/cli/commands/init/scaffold-core.js +16 -1
- package/dist/src/cli/commands/init/scaffold-core.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-ops.js +2 -2
- package/dist/src/cli/commands/init/scaffold-ops.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-standards.js +13 -1
- package/dist/src/cli/commands/init/scaffold-standards.js.map +1 -1
- package/dist/src/cli/commands/init.d.ts +4 -0
- package/dist/src/cli/commands/init.js +80 -24
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/quickstart.d.ts +1 -1
- package/dist/src/cli/commands/quickstart.js +12 -24
- package/dist/src/cli/commands/quickstart.js.map +1 -1
- package/dist/src/cli/index.js +24 -23
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/shims.js +7 -7
- package/dist/src/cli/utils/pkg.js +2 -3
- package/dist/src/cli/utils/pkg.js.map +1 -1
- package/dist/src/cli/utils/quality.d.ts +10 -0
- package/dist/src/cli/utils/quality.js +10 -0
- package/dist/src/cli/utils/quality.js.map +1 -0
- package/dist/src/modules/agents/definitions.js +45 -40
- package/dist/src/modules/agents/definitions.js.map +1 -1
- package/dist/src/modules/agents/registry/manager.js +6 -1
- package/dist/src/modules/agents/registry/manager.js.map +1 -1
- package/dist/src/modules/engines/agent-executor.d.ts +6 -10
- package/dist/src/modules/engines/agent-executor.js +53 -21
- package/dist/src/modules/engines/agent-executor.js.map +1 -1
- package/dist/src/modules/engines/agent-loop.d.ts +34 -0
- package/dist/src/modules/engines/agent-loop.js +102 -0
- package/dist/src/modules/engines/agent-loop.js.map +1 -0
- package/dist/src/modules/engines/evaluation-engine.js +2 -2
- package/dist/src/modules/engines/evaluation-engine.js.map +1 -1
- package/dist/src/modules/engines/quality-gate.d.ts +13 -5
- package/dist/src/modules/engines/quality-gate.js +39 -31
- package/dist/src/modules/engines/quality-gate.js.map +1 -1
- package/dist/src/modules/engines/routing-engine.d.ts +5 -3
- package/dist/src/modules/engines/routing-engine.js +16 -9
- package/dist/src/modules/engines/routing-engine.js.map +1 -1
- package/dist/src/modules/gateway/cost-tracker.d.ts +5 -0
- package/dist/src/modules/gateway/cost-tracker.js +71 -0
- package/dist/src/modules/gateway/cost-tracker.js.map +1 -1
- package/dist/src/modules/gateway/gateway.d.ts +4 -0
- package/dist/src/modules/gateway/gateway.js +8 -0
- package/dist/src/modules/gateway/gateway.js.map +1 -1
- package/dist/src/shared/audit.js +3 -2
- package/dist/src/shared/audit.js.map +1 -1
- package/dist/src/shared/pii.d.ts +41 -9
- package/dist/src/shared/pii.js +122 -31
- package/dist/src/shared/pii.js.map +1 -1
- package/dist/src/shared/storage.d.ts +19 -0
- package/dist/src/shared/storage.js +46 -6
- package/dist/src/shared/storage.js.map +1 -1
- package/dist/tests/embedding.test.d.ts +1 -0
- package/dist/tests/embedding.test.js +82 -0
- package/dist/tests/embedding.test.js.map +1 -0
- package/dist/tests/engines/evaluation-engine.test.d.ts +1 -0
- package/dist/tests/engines/evaluation-engine.test.js +71 -0
- package/dist/tests/engines/evaluation-engine.test.js.map +1 -0
- package/dist/tests/engines/planning-engine.test.d.ts +1 -0
- package/dist/tests/engines/planning-engine.test.js +100 -0
- package/dist/tests/engines/planning-engine.test.js.map +1 -0
- package/dist/tests/engines/quality-gate.test.d.ts +1 -0
- package/dist/tests/engines/quality-gate.test.js +59 -0
- package/dist/tests/engines/quality-gate.test.js.map +1 -0
- package/dist/tests/engines/risk-engine.test.d.ts +1 -0
- package/dist/tests/engines/risk-engine.test.js +80 -0
- package/dist/tests/engines/risk-engine.test.js.map +1 -0
- package/dist/tests/engines/routing-engine.test.d.ts +1 -0
- package/dist/tests/engines/routing-engine.test.js +78 -0
- package/dist/tests/engines/routing-engine.test.js.map +1 -0
- package/dist/tests/integration/hermes_locking.test.js +1 -0
- package/dist/tests/integration/hermes_locking.test.js.map +1 -1
- package/dist/tests/modules/gateway/cost-tracker.test.js +20 -1
- package/dist/tests/modules/gateway/cost-tracker.test.js.map +1 -1
- package/dist/tests/shared/lock.test.d.ts +1 -0
- package/dist/tests/shared/lock.test.js +95 -0
- package/dist/tests/shared/lock.test.js.map +1 -0
- package/dist/tests/shared/pii.test.d.ts +1 -0
- package/dist/tests/shared/pii.test.js +183 -0
- package/dist/tests/shared/pii.test.js.map +1 -0
- package/framework-mcp/README.md +307 -35
- package/framework-mcp/dist/dashboard/assets/index-B2mYld0c.js +1221 -0
- package/framework-mcp/dist/dashboard/index.html +1 -1
- package/framework-mcp/dist/framework-mcp/src/index.js +914 -62
- package/framework-mcp/dist/framework-mcp/src/tools/compliance/mask_pii.js +55 -0
- package/framework-mcp/dist/framework-mcp/src/tools/definitions.js +10 -9
- package/framework-mcp/dist/framework-mcp/src/tools/framework/run_tests.js +25 -0
- package/framework-mcp/dist/framework-mcp/src/tools/index.js +7 -8
- package/framework-mcp/dist/framework-mcp/src/tools/messaging/approve_operation.js +80 -0
- package/framework-mcp/dist/framework-mcp/src/tools/messaging/ask_human.js +89 -20
- package/framework-mcp/dist/framework-mcp/src/tools/observability/check_ports.js +3 -1
- package/framework-mcp/dist/framework-mcp/src/tools/quality/analyze_code_quality.js +13 -64
- package/framework-mcp/dist/framework-mcp/src/tools/schemas.js +18 -22
- package/framework-mcp/dist/framework-mcp/src/tools/shell/run_command.js +10 -0
- package/framework-mcp/dist/framework-mcp/src/tools/types.js +1 -0
- package/framework-mcp/dist/framework-mcp/src/utils/auth.js +78 -0
- package/framework-mcp/dist/framework-mcp/src/utils/auto-rollback.js +265 -0
- package/framework-mcp/dist/framework-mcp/src/utils/compliance.js +12 -4
- package/framework-mcp/dist/framework-mcp/src/utils/context-optimizer.js +156 -0
- package/framework-mcp/dist/framework-mcp/src/utils/discipline.js +217 -0
- package/framework-mcp/dist/framework-mcp/src/utils/finops.js +325 -0
- package/framework-mcp/dist/framework-mcp/src/utils/human-in-loop.js +215 -0
- package/framework-mcp/dist/framework-mcp/src/utils/license-scanner.js +283 -0
- package/framework-mcp/dist/framework-mcp/src/utils/loop-detector.js +361 -0
- package/framework-mcp/dist/framework-mcp/src/utils/quality.js +123 -0
- package/framework-mcp/dist/framework-mcp/src/utils/rules-engine.js +231 -0
- package/framework-mcp/dist/framework-mcp/src/utils/silent-router.js +128 -0
- package/framework-mcp/dist/framework-mcp/src/utils/storage.js +2 -2
- package/framework-mcp/dist/framework-mcp/src/utils/telemetry-streamer.js +396 -0
- package/framework-mcp/dist/src/cli/platforms/core.js +72 -0
- package/framework-mcp/dist/src/cli/platforms/index.js +5 -0
- package/framework-mcp/dist/src/cli/platforms/paths.js +101 -0
- package/framework-mcp/dist/src/cli/platforms/scaffold.js +72 -0
- package/framework-mcp/dist/src/cli/platforms/utils.js +75 -0
- package/framework-mcp/dist/src/cli/utils/claude.js +57 -0
- package/framework-mcp/dist/src/cli/utils/compliance.js +12 -0
- package/framework-mcp/dist/src/cli/utils/fs.js +138 -0
- package/framework-mcp/dist/src/cli/utils/pkg.js +282 -0
- package/framework-mcp/dist/src/cli/utils/quality.js +9 -0
- package/framework-mcp/dist/src/modules/agents/definitions.js +563 -0
- package/framework-mcp/dist/src/modules/agents/registry/analyst.js +39 -0
- package/framework-mcp/dist/src/modules/agents/registry/architect.js +42 -0
- package/framework-mcp/dist/src/modules/agents/registry/backend.js +50 -0
- package/framework-mcp/dist/src/modules/agents/registry/database.js +45 -0
- package/framework-mcp/dist/src/modules/agents/registry/devops.js +45 -0
- package/framework-mcp/dist/src/modules/agents/registry/explorer.js +37 -0
- package/framework-mcp/dist/src/modules/agents/registry/frontend.js +52 -0
- package/framework-mcp/dist/src/modules/agents/registry/git.js +36 -0
- package/framework-mcp/dist/src/modules/agents/registry/manager.js +64 -0
- package/framework-mcp/dist/src/modules/agents/registry/mobile.js +41 -0
- package/framework-mcp/dist/src/modules/agents/registry/native.js +41 -0
- package/framework-mcp/dist/src/modules/agents/registry/quality.js +43 -0
- package/framework-mcp/dist/src/modules/agents/registry/security.js +42 -0
- package/framework-mcp/dist/src/modules/agents/types.js +1 -0
- package/framework-mcp/dist/src/modules/engines/quality-gate.js +92 -0
- package/framework-mcp/dist/src/modules/engines/risk-engine.js +105 -0
- package/framework-mcp/dist/src/modules/engines/routing-engine.js +408 -0
- package/framework-mcp/dist/src/modules/engines/types.js +1 -0
- package/framework-mcp/dist/src/modules/providers/definitions.js +140 -0
- package/framework-mcp/dist/src/modules/providers/registry.js +18 -0
- package/framework-mcp/dist/src/modules/providers/shared.js +104 -0
- package/framework-mcp/dist/src/modules/providers/types.js +1 -0
- package/framework-mcp/dist/src/modules/skills/adapter-skills.js +449 -0
- package/framework-mcp/dist/src/modules/skills/definitions.js +70 -0
- package/framework-mcp/dist/src/shared/audit.js +220 -0
- package/framework-mcp/dist/src/shared/errors.js +68 -0
- package/framework-mcp/dist/src/shared/lock.js +159 -0
- package/framework-mcp/dist/src/shared/pii.js +122 -31
- package/framework-mcp/dist/src/shared/retention.js +170 -0
- package/framework-mcp/dist/src/shared/storage.js +46 -6
- package/framework-mcp/dist/src/shared/string.js +29 -0
- package/framework-mcp/package.json +8 -2
- package/mcp.json +11 -6
- package/package.json +13 -6
- package/templates/full/ATABEY_FULL.md +1 -1
- package/framework-mcp/dist/dashboard/assets/index-BAPGLiWE.js +0 -267
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [KVKK/GDPR] Data Retention & Privacy Service
|
|
3
|
+
*
|
|
4
|
+
* KVKK Art. 4, 5, 7, 11 and GDPR Art. 5, 17 compliant data retention management.
|
|
5
|
+
*
|
|
6
|
+
* Features:
|
|
7
|
+
* - Automatic expired record cleanup
|
|
8
|
+
* - Data categorization (operational, user_data, api_call, security, compliance)
|
|
9
|
+
* - "Right to Erasure" support
|
|
10
|
+
* - Configurable retention policies
|
|
11
|
+
* - Periodic cleanup cron job
|
|
12
|
+
*/
|
|
13
|
+
import { Audit } from "./audit.js";
|
|
14
|
+
import { logger } from "./logger.js";
|
|
15
|
+
import { Storage } from "./storage.js";
|
|
16
|
+
/**
|
|
17
|
+
* Data retention categories and default durations (days)
|
|
18
|
+
*/
|
|
19
|
+
export const RETENTION_POLICIES = {
|
|
20
|
+
OPERATIONAL: 30, // Operational logs: 30 days
|
|
21
|
+
USER_DATA: 90, // User data: 90 days (KVKK Art. 5)
|
|
22
|
+
API_CALL: 180, // API call records: 180 days
|
|
23
|
+
SECURITY: 365, // Security logs: 1 year
|
|
24
|
+
COMPLIANCE: 730, // Compliance records: 2 years
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* [KVKK/GDPR] Data Retention Manager
|
|
28
|
+
*/
|
|
29
|
+
export class DataRetention {
|
|
30
|
+
static cleanupInterval = null;
|
|
31
|
+
/**
|
|
32
|
+
* Initialize data retention with automatic cleanup.
|
|
33
|
+
* Starts a periodic cleanup job.
|
|
34
|
+
*
|
|
35
|
+
* @param intervalMs Cleanup interval in milliseconds (default: 1 hour)
|
|
36
|
+
*/
|
|
37
|
+
static initialize(intervalMs = 3600000) {
|
|
38
|
+
// Run initial cleanup
|
|
39
|
+
this.runCleanup();
|
|
40
|
+
// Schedule periodic cleanup
|
|
41
|
+
if (this.cleanupInterval) {
|
|
42
|
+
clearInterval(this.cleanupInterval);
|
|
43
|
+
}
|
|
44
|
+
this.cleanupInterval = setInterval(() => this.runCleanup(), intervalMs);
|
|
45
|
+
logger.info("[RETENTION] Data retention initialized. " +
|
|
46
|
+
`Cleanup interval: ${intervalMs / 60000}min. ` +
|
|
47
|
+
`Policies: ${Object.entries(RETENTION_POLICIES).map(([k, v]) => `${k}=${v}d`).join(", ")}`);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Run cleanup for all data stores.
|
|
51
|
+
* Cleans audit logs, messages, and logs based on retention policies.
|
|
52
|
+
*/
|
|
53
|
+
static runCleanup() {
|
|
54
|
+
const result = { audit: 0, messages: 0, logs: 0 };
|
|
55
|
+
try {
|
|
56
|
+
// 1. Clean audit logs
|
|
57
|
+
result.audit = Audit.cleanExpired();
|
|
58
|
+
// 2. Clean old messages (Hermes message queue)
|
|
59
|
+
result.messages = this.cleanOldMessages();
|
|
60
|
+
// 3. Clean old logs
|
|
61
|
+
result.logs = this.cleanOldLogs();
|
|
62
|
+
if (result.audit > 0 || result.messages > 0 || result.logs > 0) {
|
|
63
|
+
logger.info("[RETENTION] Cleanup complete: " +
|
|
64
|
+
`${result.audit} audit, ${result.messages} messages, ${result.logs} logs`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
logger.error(`[RETENTION] Cleanup failed: ${error.message}`);
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* [KVKK Art. 7] "Right to Erasure" — Deletes all data for a given trace ID.
|
|
74
|
+
* Cleans audit records, messages, logs, and tasks.
|
|
75
|
+
*
|
|
76
|
+
* @param traceId Trace ID to erase
|
|
77
|
+
* @returns Total number of deleted records
|
|
78
|
+
*/
|
|
79
|
+
static eraseTraceData(traceId) {
|
|
80
|
+
let total = 0;
|
|
81
|
+
// Audit logs
|
|
82
|
+
total += Audit.deleteByFilter({ traceId });
|
|
83
|
+
// Messages
|
|
84
|
+
const db = Storage.getDB();
|
|
85
|
+
const msgResult = db.prepare("DELETE FROM messages WHERE trace_id = ?").run(traceId);
|
|
86
|
+
total += msgResult.changes;
|
|
87
|
+
// Tasks
|
|
88
|
+
const taskResult = db.prepare("DELETE FROM tasks WHERE trace_id = ?").run(traceId);
|
|
89
|
+
total += taskResult.changes;
|
|
90
|
+
// Logs
|
|
91
|
+
const logResult = db.prepare("DELETE FROM logs WHERE trace_id = ?").run(traceId);
|
|
92
|
+
total += logResult.changes;
|
|
93
|
+
logger.info(`[RETENTION] Trace ${traceId} erased: ${total} records deleted (KVKK Article 7)`);
|
|
94
|
+
return total;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* [KVKK Art. 11] Erases all data.
|
|
98
|
+
* Only works with the confirmation code.
|
|
99
|
+
*/
|
|
100
|
+
static eraseAllData(confirmationCode) {
|
|
101
|
+
if (confirmationCode !== "KVKK-RIGHT-TO-ERASURE") {
|
|
102
|
+
throw new Error("[RETENTION] Invalid confirmation code. Use 'KVKK-RIGHT-TO-ERASURE'");
|
|
103
|
+
}
|
|
104
|
+
let total = 0;
|
|
105
|
+
const db = Storage.getDB();
|
|
106
|
+
total += Audit.clearAll(confirmationCode);
|
|
107
|
+
total += db.prepare("DELETE FROM messages").run().changes;
|
|
108
|
+
total += db.prepare("DELETE FROM tasks").run().changes;
|
|
109
|
+
total += db.prepare("DELETE FROM logs").run().changes;
|
|
110
|
+
total += db.prepare("DELETE FROM agents").run().changes;
|
|
111
|
+
total += db.prepare("DELETE FROM metadata").run().changes;
|
|
112
|
+
logger.warn(`[RETENTION] ALL DATA ERASED: ${total} records (KVKK Article 7 - Right to Erasure)`);
|
|
113
|
+
return total;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get retention statistics.
|
|
117
|
+
*/
|
|
118
|
+
static getStats() {
|
|
119
|
+
const db = Storage.getDB();
|
|
120
|
+
const auditExpired = db.prepare(`
|
|
121
|
+
SELECT COUNT(*) as count FROM audit_log
|
|
122
|
+
WHERE retentionDays IS NOT NULL
|
|
123
|
+
AND timestamp < datetime('now', '-' || retentionDays || ' days')
|
|
124
|
+
`).get().count;
|
|
125
|
+
const messageCount = db.prepare("SELECT COUNT(*) as count FROM messages").get().count;
|
|
126
|
+
const logCount = db.prepare("SELECT COUNT(*) as count FROM logs").get().count;
|
|
127
|
+
const taskCount = db.prepare("SELECT COUNT(*) as count FROM tasks").get().count;
|
|
128
|
+
return {
|
|
129
|
+
auditExpired,
|
|
130
|
+
messageCount,
|
|
131
|
+
logCount,
|
|
132
|
+
taskCount,
|
|
133
|
+
policies: { ...RETENTION_POLICIES },
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Stop the periodic cleanup job.
|
|
138
|
+
*/
|
|
139
|
+
static shutdown() {
|
|
140
|
+
if (this.cleanupInterval) {
|
|
141
|
+
clearInterval(this.cleanupInterval);
|
|
142
|
+
this.cleanupInterval = null;
|
|
143
|
+
logger.info("[RETENTION] Cleanup job stopped");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Clean old messages from the Hermes queue.
|
|
148
|
+
* Messages older than 30 days are removed.
|
|
149
|
+
*/
|
|
150
|
+
static cleanOldMessages() {
|
|
151
|
+
const db = Storage.getDB();
|
|
152
|
+
const result = db.prepare(`
|
|
153
|
+
DELETE FROM messages
|
|
154
|
+
WHERE timestamp < datetime('now', '-30 days')
|
|
155
|
+
`).run();
|
|
156
|
+
return result.changes;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Clean old logs.
|
|
160
|
+
* Logs older than 30 days are removed.
|
|
161
|
+
*/
|
|
162
|
+
static cleanOldLogs() {
|
|
163
|
+
const db = Storage.getDB();
|
|
164
|
+
const result = db.prepare(`
|
|
165
|
+
DELETE FROM logs
|
|
166
|
+
WHERE timestamp < datetime('now', '-30 days')
|
|
167
|
+
`).run();
|
|
168
|
+
return result.changes;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -3,6 +3,7 @@ import fs from "fs";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { getFrameworkDir } from "../cli/utils/memory.js";
|
|
5
5
|
import { logger } from "./logger.js";
|
|
6
|
+
import { maskText } from "./pii.js";
|
|
6
7
|
import { asAgentID, asLogID, asMessageID, asTaskID } from "./types.js";
|
|
7
8
|
/**
|
|
8
9
|
* [DB] Atabey Storage Engine
|
|
@@ -18,6 +19,7 @@ export class AtabeyStorage {
|
|
|
18
19
|
}
|
|
19
20
|
const dbPath = path.join(frameworkDir, "atabey.db");
|
|
20
21
|
this.db = new Database(dbPath);
|
|
22
|
+
this.db.pragma("journal_mode = WAL");
|
|
21
23
|
this.initializeSchema();
|
|
22
24
|
}
|
|
23
25
|
return this.db;
|
|
@@ -82,12 +84,47 @@ export class AtabeyStorage {
|
|
|
82
84
|
value TEXT
|
|
83
85
|
)
|
|
84
86
|
`);
|
|
87
|
+
// Costs Table
|
|
88
|
+
db.exec(`
|
|
89
|
+
CREATE TABLE IF NOT EXISTS costs (
|
|
90
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
91
|
+
provider TEXT,
|
|
92
|
+
model TEXT,
|
|
93
|
+
input_tokens INTEGER,
|
|
94
|
+
output_tokens INTEGER,
|
|
95
|
+
cost REAL,
|
|
96
|
+
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
97
|
+
trace_id TEXT
|
|
98
|
+
)
|
|
99
|
+
`);
|
|
100
|
+
}
|
|
101
|
+
// --- Cost Operations ---
|
|
102
|
+
static saveCost(cost) {
|
|
103
|
+
const db = this.getDB();
|
|
104
|
+
db.prepare(`
|
|
105
|
+
INSERT INTO costs (provider, model, input_tokens, output_tokens, cost, timestamp, trace_id)
|
|
106
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
107
|
+
`).run(cost.provider, cost.model, cost.inputTokens, cost.outputTokens, cost.cost, cost.timestamp, cost.traceId || null);
|
|
108
|
+
}
|
|
109
|
+
static getAllCosts() {
|
|
110
|
+
const rows = this.getDB().prepare("SELECT * FROM costs ORDER BY timestamp ASC").all();
|
|
111
|
+
return rows.map(r => ({
|
|
112
|
+
provider: r.provider,
|
|
113
|
+
model: r.model,
|
|
114
|
+
inputTokens: r.input_tokens,
|
|
115
|
+
outputTokens: r.output_tokens,
|
|
116
|
+
cost: r.cost,
|
|
117
|
+
timestamp: r.timestamp,
|
|
118
|
+
traceId: r.trace_id || undefined
|
|
119
|
+
}));
|
|
85
120
|
}
|
|
86
121
|
// --- Agent Operations ---
|
|
87
122
|
static updateAgentStatus(name, state, task, lastUpdated) {
|
|
88
123
|
const db = this.getDB();
|
|
89
124
|
const cleanName = name.replace("@", "");
|
|
90
125
|
const timestamp = lastUpdated || new Date().toISOString();
|
|
126
|
+
// [KVKK/GDPR] Mask PII in task description before storing
|
|
127
|
+
const maskedTask = maskText(task);
|
|
91
128
|
db.prepare(`
|
|
92
129
|
INSERT INTO agents (name, state, task, last_updated)
|
|
93
130
|
VALUES (?, ?, ?, ?)
|
|
@@ -95,7 +132,7 @@ export class AtabeyStorage {
|
|
|
95
132
|
state = excluded.state,
|
|
96
133
|
task = excluded.task,
|
|
97
134
|
last_updated = excluded.last_updated
|
|
98
|
-
`).run(cleanName, state,
|
|
135
|
+
`).run(cleanName, state, maskedTask, timestamp);
|
|
99
136
|
}
|
|
100
137
|
static getAllAgents() {
|
|
101
138
|
return this.getDB().prepare("SELECT * FROM agents").all();
|
|
@@ -103,10 +140,12 @@ export class AtabeyStorage {
|
|
|
103
140
|
// --- Message Operations ---
|
|
104
141
|
static saveMessage(msg) {
|
|
105
142
|
const db = this.getDB();
|
|
143
|
+
// [KVKK/GDPR] Mask PII in message content before storing
|
|
144
|
+
const maskedContent = maskText(msg.content);
|
|
106
145
|
db.prepare(`
|
|
107
146
|
INSERT INTO messages (sender, receiver, category, content, trace_id, parent_id, status, priority, requires_approval)
|
|
108
147
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
109
|
-
`).run(msg.from, msg.to, msg.category,
|
|
148
|
+
`).run(msg.from, msg.to, msg.category, maskedContent, msg.traceId, msg.parentId || null, msg.status || "PENDING", msg.priority || "NORMAL", msg.requiresApproval ? 1 : 0);
|
|
110
149
|
}
|
|
111
150
|
static getPendingMessages() {
|
|
112
151
|
const rows = this.getDB().prepare("SELECT * FROM messages WHERE status IN ('PENDING', 'APPROVED') ORDER BY priority DESC, timestamp ASC").all();
|
|
@@ -151,7 +190,6 @@ export class AtabeyStorage {
|
|
|
151
190
|
let deps = [];
|
|
152
191
|
try {
|
|
153
192
|
const parsed = JSON.parse(r.dependencies || "[]");
|
|
154
|
-
// Handle cases where dependencies might be double-stringified or are raw JSON strings
|
|
155
193
|
deps = Array.isArray(parsed) ? parsed : JSON.parse(parsed);
|
|
156
194
|
}
|
|
157
195
|
catch (err) {
|
|
@@ -164,7 +202,8 @@ export class AtabeyStorage {
|
|
|
164
202
|
agent: asAgentID(r.agent),
|
|
165
203
|
status: r.status,
|
|
166
204
|
priority: r.priority,
|
|
167
|
-
dependencies: deps
|
|
205
|
+
dependencies: deps,
|
|
206
|
+
createdAt: r.created_at
|
|
168
207
|
};
|
|
169
208
|
});
|
|
170
209
|
}
|
|
@@ -185,8 +224,9 @@ export class AtabeyStorage {
|
|
|
185
224
|
action: r.action,
|
|
186
225
|
trace_id: r.trace_id || undefined,
|
|
187
226
|
status: r.status,
|
|
188
|
-
|
|
189
|
-
|
|
227
|
+
// [KVKK/GDPR] Mask PII in log summaries before returning
|
|
228
|
+
summary: maskText(r.summary),
|
|
229
|
+
findings: r.findings ? maskText(r.findings) : undefined
|
|
190
230
|
}));
|
|
191
231
|
}
|
|
192
232
|
// --- Metadata Operations ---
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function stripMarkdownCodeBlocks(text) {
|
|
2
|
+
// Regex to find markdown code blocks (```lang ... ```) and extract their content.
|
|
3
|
+
// Handles cases where LLMs might wrap JSON in such blocks.
|
|
4
|
+
const markdownCodeBlockRegex = /```(?:\w+)?\s*([\s\S]*?)\s*```/g;
|
|
5
|
+
// Attempt to extract content from a single markdown code block.
|
|
6
|
+
const cleanedText = text.replace(markdownCodeBlockRegex, "$1").trim();
|
|
7
|
+
// If after stripping, it looks like JSON, return it.
|
|
8
|
+
if ((cleanedText.startsWith("{") && cleanedText.endsWith("}")) || (cleanedText.startsWith("[") && cleanedText.endsWith("]"))) {
|
|
9
|
+
return cleanedText;
|
|
10
|
+
}
|
|
11
|
+
// Fallback: If the original text itself was valid JSON (without being in a code block)
|
|
12
|
+
// or if the stripping made it valid, this check helps.
|
|
13
|
+
try {
|
|
14
|
+
JSON.parse(text.trim());
|
|
15
|
+
return text.trim(); // Original text was valid JSON
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
// Continue if original text wasn't valid JSON
|
|
19
|
+
}
|
|
20
|
+
// Try a more specific JSON code block extraction if the generic one didn't yield valid JSON
|
|
21
|
+
const specificJsonCodeBlockRegex = /```json\s*(\{[\s\S]*?\}|\[[\s\S]*?\])\s*```/g;
|
|
22
|
+
const specificMatch = text.match(specificJsonCodeBlockRegex);
|
|
23
|
+
if (specificMatch && specificMatch[1]) {
|
|
24
|
+
return specificMatch[1].trim();
|
|
25
|
+
}
|
|
26
|
+
// If all else fails, return the most aggressively stripped version.
|
|
27
|
+
// JSON.parse will fail if it's not valid, which is the expected behavior.
|
|
28
|
+
return cleanedText;
|
|
29
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atabey-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Agent Atabey Model Context Protocol (MCP) Server",
|
|
5
5
|
"author": "Yusuf BEKAR",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,7 +22,12 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "npx tsc",
|
|
24
24
|
"start": "node dist/index.js",
|
|
25
|
-
"dev": "tsx src/index.ts"
|
|
25
|
+
"dev": "tsx src/index.ts",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:watch": "vitest"
|
|
28
|
+
},
|
|
29
|
+
"vitest": {
|
|
30
|
+
"include": ["tests/**/*.test.ts"]
|
|
26
31
|
},
|
|
27
32
|
"dependencies": {
|
|
28
33
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
@@ -32,6 +37,7 @@
|
|
|
32
37
|
"devDependencies": {
|
|
33
38
|
"@types/better-sqlite3": "^7.6.13",
|
|
34
39
|
"@types/node": "^25.9.1",
|
|
40
|
+
"tsx": "^4.22.3",
|
|
35
41
|
"typescript": "^5.9.3"
|
|
36
42
|
}
|
|
37
43
|
}
|
package/mcp.json
CHANGED
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
"mcpServers": {
|
|
3
3
|
"atabey": {
|
|
4
4
|
"command": "atabey",
|
|
5
|
-
"args": [
|
|
6
|
-
"mcp",
|
|
7
|
-
"start"
|
|
8
|
-
],
|
|
5
|
+
"args": ["mcp", "start"],
|
|
9
6
|
"env": {
|
|
10
7
|
"ATABEY_PROJECT_ROOT": "/Users/ybekar/Desktop/Projeler/atabey"
|
|
11
|
-
}
|
|
8
|
+
},
|
|
9
|
+
"description": "Stdio mode: her kullanici kendi IDE'sinden baglanir."
|
|
10
|
+
},
|
|
11
|
+
"atabey-sse": {
|
|
12
|
+
"url": "http://localhost:5858/mcp/sse",
|
|
13
|
+
"env": {
|
|
14
|
+
"ATABEY_PROJECT_ROOT": "/Users/ybekar/Desktop/Projeler/atabey"
|
|
15
|
+
},
|
|
16
|
+
"description": "Unified mode: Tek port 5858'de MCP + Dashboard birlikte. Dashboard: http://localhost:5858"
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
|
-
}
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atabey",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "MCP-Powered AI Governance & Autonomous Orchestration Framework. Plugs into Claude Code, Gemini CLI, and Cursor as an MCP server.",
|
|
5
5
|
"author": "Yusuf BEKAR",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,7 +58,14 @@
|
|
|
58
58
|
"test:watch": "vitest",
|
|
59
59
|
"test:coverage": "vitest run --coverage",
|
|
60
60
|
"prepublishOnly": "npm run build",
|
|
61
|
-
"clean": "rm -rf dist node_modules framework-mcp/node_modules framework-mcp/dist"
|
|
61
|
+
"clean": "rm -rf dist node_modules framework-mcp/node_modules framework-mcp/dist",
|
|
62
|
+
"atabey:status": "atabey status",
|
|
63
|
+
"atabey:trace": "atabey trace:new",
|
|
64
|
+
"atabey:verify": "atabey verify-contract",
|
|
65
|
+
"atabey:check": "atabey check",
|
|
66
|
+
"atabey:test": "vitest run",
|
|
67
|
+
"atabey:test:watch": "vitest",
|
|
68
|
+
"atabey:build": "npm run build --prefix framework-mcp"
|
|
62
69
|
},
|
|
63
70
|
"publishConfig": {
|
|
64
71
|
"access": "public"
|
|
@@ -74,7 +81,6 @@
|
|
|
74
81
|
},
|
|
75
82
|
"devDependencies": {
|
|
76
83
|
"@eslint/js": "^10.0.1",
|
|
77
|
-
"@pandacss/dev": "^1.11.1",
|
|
78
84
|
"@types/better-sqlite3": "^7.6.13",
|
|
79
85
|
"@types/node": "^25.9.1",
|
|
80
86
|
"@types/ws": "^8.18.1",
|
|
@@ -83,10 +89,11 @@
|
|
|
83
89
|
"globals": "^17.6.0",
|
|
84
90
|
"tsx": "^4.22.3",
|
|
85
91
|
"typescript-eslint": "^8.0.0",
|
|
86
|
-
"vitest": "^3.0.0"
|
|
92
|
+
"vitest": "^3.0.0",
|
|
93
|
+
"atabey": "^0.0.14"
|
|
87
94
|
},
|
|
88
95
|
"atabey": {
|
|
89
|
-
"version": "0.0.
|
|
90
|
-
"initializedAt": "2026-06-
|
|
96
|
+
"version": "0.0.14",
|
|
97
|
+
"initializedAt": "2026-06-20T15:11:43.308Z"
|
|
91
98
|
}
|
|
92
99
|
}
|