atabey-shared 0.0.37 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -25
- package/dist/agent-identity.d.ts +1 -0
- package/dist/agent-identity.js +2 -0
- package/dist/agent-identity.js.map +1 -0
- package/dist/api-catalog.d.ts +1 -0
- package/dist/api-catalog.js +2 -0
- package/dist/api-catalog.js.map +1 -0
- package/dist/audit-chain.d.ts +1 -51
- package/dist/audit-chain.js +1 -84
- package/dist/audit-chain.js.map +1 -1
- package/dist/audit.d.ts +1 -113
- package/dist/audit.js +1 -284
- package/dist/audit.js.map +1 -1
- package/dist/constants.d.ts +1 -152
- package/dist/constants.js +1 -215
- package/dist/constants.js.map +1 -1
- package/dist/database.d.ts +1 -5
- package/dist/database.js +1 -12
- package/dist/database.js.map +1 -1
- package/dist/errors.d.ts +1 -46
- package/dist/errors.js +1 -68
- package/dist/errors.js.map +1 -1
- package/dist/file-lock.d.ts +1 -88
- package/dist/file-lock.js +1 -250
- package/dist/file-lock.js.map +1 -1
- package/dist/fs.d.ts +1 -9
- package/dist/fs.js +1 -53
- package/dist/fs.js.map +1 -1
- package/dist/index.d.ts +2 -22
- package/dist/index.js +2 -22
- package/dist/index.js.map +1 -1
- package/dist/job-queue.d.ts +1 -53
- package/dist/job-queue.js +1 -126
- package/dist/job-queue.js.map +1 -1
- package/dist/lock.d.ts +1 -82
- package/dist/lock.js +1 -158
- package/dist/lock.js.map +1 -1
- package/dist/logger.d.ts +1 -30
- package/dist/logger.js +1 -126
- package/dist/logger.js.map +1 -1
- package/dist/memory-prune.d.ts +1 -0
- package/dist/memory-prune.js +2 -0
- package/dist/memory-prune.js.map +1 -0
- package/dist/migrations.d.ts +1 -0
- package/dist/migrations.js +2 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modules/agent/agent-identity.d.ts +34 -0
- package/dist/modules/agent/agent-identity.js +77 -0
- package/dist/modules/agent/agent-identity.js.map +1 -0
- package/dist/modules/agent/api-catalog.d.ts +57 -0
- package/dist/modules/agent/api-catalog.js +254 -0
- package/dist/modules/agent/api-catalog.js.map +1 -0
- package/dist/modules/agent/index.d.ts +3 -0
- package/dist/modules/agent/index.js +4 -0
- package/dist/modules/agent/index.js.map +1 -0
- package/dist/modules/agent/tokenizer.d.ts +54 -0
- package/dist/modules/agent/tokenizer.js +272 -0
- package/dist/modules/agent/tokenizer.js.map +1 -0
- package/dist/modules/concurrency/file-lock.d.ts +93 -0
- package/dist/modules/concurrency/file-lock.js +240 -0
- package/dist/modules/concurrency/file-lock.js.map +1 -0
- package/dist/modules/concurrency/index.d.ts +6 -0
- package/dist/modules/concurrency/index.js +7 -0
- package/dist/modules/concurrency/index.js.map +1 -0
- package/dist/modules/concurrency/job-queue.d.ts +76 -0
- package/dist/modules/concurrency/job-queue.js +200 -0
- package/dist/modules/concurrency/job-queue.js.map +1 -0
- package/dist/modules/concurrency/lock.d.ts +82 -0
- package/dist/modules/concurrency/lock.js +159 -0
- package/dist/modules/concurrency/lock.js.map +1 -0
- package/dist/modules/concurrency/resilience.d.ts +84 -0
- package/dist/modules/concurrency/resilience.js +217 -0
- package/dist/modules/concurrency/resilience.js.map +1 -0
- package/dist/modules/concurrency/worker-pool.d.ts +52 -0
- package/dist/modules/concurrency/worker-pool.js +229 -0
- package/dist/modules/concurrency/worker-pool.js.map +1 -0
- package/dist/modules/concurrency/worker-thread.d.ts +21 -0
- package/dist/modules/concurrency/worker-thread.js +67 -0
- package/dist/modules/concurrency/worker-thread.js.map +1 -0
- package/dist/modules/index.d.ts +14 -0
- package/dist/modules/index.js +15 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/observability/audit-chain.d.ts +80 -0
- package/dist/modules/observability/audit-chain.js +262 -0
- package/dist/modules/observability/audit-chain.js.map +1 -0
- package/dist/modules/observability/audit.d.ts +121 -0
- package/dist/modules/observability/audit.js +322 -0
- package/dist/modules/observability/audit.js.map +1 -0
- package/dist/modules/observability/index.d.ts +4 -0
- package/dist/modules/observability/index.js +5 -0
- package/dist/modules/observability/index.js.map +1 -0
- package/dist/modules/observability/logger.d.ts +31 -0
- package/dist/modules/observability/logger.js +153 -0
- package/dist/modules/observability/logger.js.map +1 -0
- package/dist/modules/observability/otel.d.ts +39 -0
- package/dist/modules/observability/otel.js +93 -0
- package/dist/modules/observability/otel.js.map +1 -0
- package/dist/modules/primitives/constants.d.ts +150 -0
- package/dist/modules/primitives/constants.js +212 -0
- package/dist/modules/primitives/constants.js.map +1 -0
- package/dist/modules/primitives/errors.d.ts +46 -0
- package/dist/modules/primitives/errors.js +69 -0
- package/dist/modules/primitives/errors.js.map +1 -0
- package/dist/modules/primitives/fs.d.ts +9 -0
- package/dist/modules/primitives/fs.js +54 -0
- package/dist/modules/primitives/fs.js.map +1 -0
- package/dist/modules/primitives/index.d.ts +7 -0
- package/dist/modules/primitives/index.js +8 -0
- package/dist/modules/primitives/index.js.map +1 -0
- package/dist/modules/primitives/outbound-http.d.ts +32 -0
- package/dist/modules/primitives/outbound-http.js +88 -0
- package/dist/modules/primitives/outbound-http.js.map +1 -0
- package/dist/modules/primitives/string.d.ts +1 -0
- package/dist/modules/primitives/string.js +30 -0
- package/dist/modules/primitives/string.js.map +1 -0
- package/dist/modules/primitives/time.d.ts +5 -0
- package/dist/modules/primitives/time.js +35 -0
- package/dist/modules/primitives/time.js.map +1 -0
- package/dist/modules/primitives/types.d.ts +27 -0
- package/dist/modules/primitives/types.js +17 -0
- package/dist/modules/primitives/types.js.map +1 -0
- package/dist/modules/sandbox/index.d.ts +3 -0
- package/dist/modules/sandbox/index.js +4 -0
- package/dist/modules/sandbox/index.js.map +1 -0
- package/dist/modules/sandbox/sandbox-fs.d.ts +28 -0
- package/dist/modules/sandbox/sandbox-fs.js +143 -0
- package/dist/modules/sandbox/sandbox-fs.js.map +1 -0
- package/dist/modules/sandbox/sandbox-runtime.d.ts +78 -0
- package/dist/modules/sandbox/sandbox-runtime.js +282 -0
- package/dist/modules/sandbox/sandbox-runtime.js.map +1 -0
- package/dist/modules/sandbox/sandbox.d.ts +54 -0
- package/dist/modules/sandbox/sandbox.js +179 -0
- package/dist/modules/sandbox/sandbox.js.map +1 -0
- package/dist/modules/security/index.d.ts +5 -0
- package/dist/modules/security/index.js +6 -0
- package/dist/modules/security/index.js.map +1 -0
- package/dist/modules/security/pii.d.ts +70 -0
- package/dist/modules/security/pii.js +276 -0
- package/dist/modules/security/pii.js.map +1 -0
- package/dist/modules/security/policy-gate.d.ts +42 -0
- package/dist/modules/security/policy-gate.js +172 -0
- package/dist/modules/security/policy-gate.js.map +1 -0
- package/dist/modules/security/retention.d.ts +68 -0
- package/dist/modules/security/retention.js +218 -0
- package/dist/modules/security/retention.js.map +1 -0
- package/dist/modules/security/secrets.d.ts +99 -0
- package/dist/modules/security/secrets.js +371 -0
- package/dist/modules/security/secrets.js.map +1 -0
- package/dist/modules/security/tls.d.ts +87 -0
- package/dist/modules/security/tls.js +154 -0
- package/dist/modules/security/tls.js.map +1 -0
- package/dist/modules/storage/database.d.ts +6 -0
- package/dist/modules/storage/database.js +16 -0
- package/dist/modules/storage/database.js.map +1 -0
- package/dist/modules/storage/index.d.ts +4 -0
- package/dist/modules/storage/index.js +5 -0
- package/dist/modules/storage/index.js.map +1 -0
- package/dist/modules/storage/memory-prune.d.ts +18 -0
- package/dist/modules/storage/memory-prune.js +48 -0
- package/dist/modules/storage/memory-prune.js.map +1 -0
- package/dist/modules/storage/migrations.d.ts +69 -0
- package/dist/modules/storage/migrations.js +394 -0
- package/dist/modules/storage/migrations.js.map +1 -0
- package/dist/modules/storage/storage.d.ts +341 -0
- package/dist/modules/storage/storage.js +1004 -0
- package/dist/modules/storage/storage.js.map +1 -0
- package/dist/otel.d.ts +1 -0
- package/dist/otel.js +2 -0
- package/dist/otel.js.map +1 -0
- package/dist/outbound-http.d.ts +1 -0
- package/dist/outbound-http.js +2 -0
- package/dist/outbound-http.js.map +1 -0
- package/dist/pii.d.ts +1 -69
- package/dist/pii.js +1 -219
- package/dist/pii.js.map +1 -1
- package/dist/policy-gate.d.ts +1 -42
- package/dist/policy-gate.js +1 -147
- package/dist/policy-gate.js.map +1 -1
- package/dist/resilience.d.ts +1 -84
- package/dist/resilience.js +1 -216
- package/dist/resilience.js.map +1 -1
- package/dist/retention.d.ts +1 -63
- package/dist/retention.js +1 -170
- package/dist/retention.js.map +1 -1
- package/dist/sandbox-fs.d.ts +1 -28
- package/dist/sandbox-fs.js +1 -149
- package/dist/sandbox-fs.js.map +1 -1
- package/dist/sandbox-runtime.d.ts +1 -85
- package/dist/sandbox-runtime.js +1 -249
- package/dist/sandbox-runtime.js.map +1 -1
- package/dist/sandbox.d.ts +1 -54
- package/dist/sandbox.js +1 -178
- package/dist/sandbox.js.map +1 -1
- package/dist/secrets.d.ts +1 -0
- package/dist/secrets.js +2 -0
- package/dist/secrets.js.map +1 -0
- package/dist/storage.d.ts +1 -274
- package/dist/storage.js +1 -723
- package/dist/storage.js.map +1 -1
- package/dist/string.d.ts +1 -1
- package/dist/string.js +1 -29
- package/dist/string.js.map +1 -1
- package/dist/time.d.ts +1 -5
- package/dist/time.js +1 -30
- package/dist/time.js.map +1 -1
- package/dist/tls.d.ts +1 -0
- package/dist/tls.js +2 -0
- package/dist/tls.js.map +1 -0
- package/dist/tokenizer.d.ts +1 -0
- package/dist/tokenizer.js +2 -0
- package/dist/tokenizer.js.map +1 -0
- package/dist/types.d.ts +1 -27
- package/dist/types.js +1 -16
- package/dist/types.js.map +1 -1
- package/dist/worker-pool.d.ts +1 -52
- package/dist/worker-pool.js +1 -209
- package/dist/worker-pool.js.map +1 -1
- package/dist/worker-thread.d.ts +1 -21
- package/dist/worker-thread.js +1 -66
- package/dist/worker-thread.js.map +1 -1
- package/package.json +51 -29
package/dist/audit.js
CHANGED
|
@@ -1,285 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* [AUDIT] Structured Audit Log Service
|
|
3
|
-
*
|
|
4
|
-
* Records all critical operations in structured JSON format to SQLite.
|
|
5
|
-
* Queryable, filterable, and traceable.
|
|
6
|
-
*
|
|
7
|
-
* [KVKK/GDPR] GDPR and KVKK Art. 4, 5, 11, 12 compliant:
|
|
8
|
-
* - Sensitive data automatically masked (PII masking)
|
|
9
|
-
* - Data retention limited (TTL)
|
|
10
|
-
* - Data subject rights supported (erasure, query)
|
|
11
|
-
*
|
|
12
|
-
* Usage:
|
|
13
|
-
* Audit.log("user.create", "SUCCESS", { userId: "usr_123" });
|
|
14
|
-
* Audit.query({ action: "user.create", status: "FAILED" });
|
|
15
|
-
*/
|
|
16
|
-
import { AUDIT_CHAIN_GENESIS, buildStructuredAuditChainPayload, sha256Hex, verifyHashChain, } from "./audit-chain.js";
|
|
17
|
-
import { maskObject, maskText } from "./pii.js";
|
|
18
|
-
import { databaseHolder } from "./database.js";
|
|
19
|
-
import { logger } from "./logger.js";
|
|
20
|
-
export class Audit {
|
|
21
|
-
static TABLE = "audit_log";
|
|
22
|
-
/** [KVKK] Default data retention period: 30 days */
|
|
23
|
-
static DEFAULT_RETENTION_DAYS = parseInt(process.env.ATABEY_DATA_RETENTION_DAYS || "30", 10);
|
|
24
|
-
/** [KVKK] Maximum retention for sensitive categories: 90 days */
|
|
25
|
-
static MAX_RETENTION_DAYS = 90;
|
|
26
|
-
static initialize() {
|
|
27
|
-
const db = databaseHolder.getDB();
|
|
28
|
-
db.exec(`
|
|
29
|
-
CREATE TABLE IF NOT EXISTS ${this.TABLE} (
|
|
30
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
31
|
-
timestamp TEXT NOT NULL,
|
|
32
|
-
action TEXT NOT NULL,
|
|
33
|
-
status TEXT NOT NULL,
|
|
34
|
-
agent TEXT NOT NULL,
|
|
35
|
-
traceId TEXT,
|
|
36
|
-
details TEXT,
|
|
37
|
-
errorMessage TEXT,
|
|
38
|
-
durationMs INTEGER,
|
|
39
|
-
dataCategory TEXT DEFAULT 'OPERATIONAL',
|
|
40
|
-
retentionDays INTEGER DEFAULT ${this.DEFAULT_RETENTION_DAYS},
|
|
41
|
-
prev_hash TEXT,
|
|
42
|
-
hash TEXT
|
|
43
|
-
)
|
|
44
|
-
`);
|
|
45
|
-
// Migrate older DBs
|
|
46
|
-
try {
|
|
47
|
-
const cols = db.prepare(`PRAGMA table_info(${this.TABLE})`).all().map((c) => c.name);
|
|
48
|
-
if (!cols.includes("prev_hash"))
|
|
49
|
-
db.exec(`ALTER TABLE ${this.TABLE} ADD COLUMN prev_hash TEXT`);
|
|
50
|
-
if (!cols.includes("hash"))
|
|
51
|
-
db.exec(`ALTER TABLE ${this.TABLE} ADD COLUMN hash TEXT`);
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
/* ignore */
|
|
55
|
-
}
|
|
56
|
-
// Indexes for performance
|
|
57
|
-
db.exec(`
|
|
58
|
-
CREATE INDEX IF NOT EXISTS idx_audit_action ON ${this.TABLE}(action);
|
|
59
|
-
CREATE INDEX IF NOT EXISTS idx_audit_status ON ${this.TABLE}(status);
|
|
60
|
-
CREATE INDEX IF NOT EXISTS idx_audit_trace ON ${this.TABLE}(traceId);
|
|
61
|
-
CREATE INDEX IF NOT EXISTS idx_audit_timestamp ON ${this.TABLE}(timestamp);
|
|
62
|
-
CREATE INDEX IF NOT EXISTS idx_audit_category ON ${this.TABLE}(dataCategory);
|
|
63
|
-
`);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Logs a structured audit entry.
|
|
67
|
-
* [KVKK] Sensitive data is automatically masked.
|
|
68
|
-
*/
|
|
69
|
-
static log(action, status, options = {}) {
|
|
70
|
-
const db = databaseHolder.getDB();
|
|
71
|
-
const retentionDays = Math.min(options.retentionDays || this.DEFAULT_RETENTION_DAYS, this.MAX_RETENTION_DAYS);
|
|
72
|
-
// [KVKK] PII Masking — mask sensitive data in the details field
|
|
73
|
-
const maskedDetails = options.details
|
|
74
|
-
? maskObject(options.details)
|
|
75
|
-
: undefined;
|
|
76
|
-
const maskedError = options.errorMessage
|
|
77
|
-
? maskText(options.errorMessage)
|
|
78
|
-
: undefined;
|
|
79
|
-
const timestamp = new Date().toISOString();
|
|
80
|
-
const agent = options.agent || "@manager";
|
|
81
|
-
const detailsJson = maskedDetails ? JSON.stringify(maskedDetails) : "";
|
|
82
|
-
const errorMessage = maskedError || "";
|
|
83
|
-
const traceId = options.traceId || "";
|
|
84
|
-
const dataCategory = options.dataCategory || "OPERATIONAL";
|
|
85
|
-
// Append-only hash chain inside a transaction (Phase 1.4)
|
|
86
|
-
const insert = db.transaction(() => {
|
|
87
|
-
let prevHash = AUDIT_CHAIN_GENESIS;
|
|
88
|
-
try {
|
|
89
|
-
const last = db.prepare(`SELECT hash FROM ${this.TABLE} WHERE hash IS NOT NULL ORDER BY id DESC LIMIT 1`).get();
|
|
90
|
-
if (last?.hash)
|
|
91
|
-
prevHash = last.hash;
|
|
92
|
-
}
|
|
93
|
-
catch {
|
|
94
|
-
/* genesis */
|
|
95
|
-
}
|
|
96
|
-
const payload = buildStructuredAuditChainPayload({
|
|
97
|
-
prevHash,
|
|
98
|
-
agent,
|
|
99
|
-
action,
|
|
100
|
-
status,
|
|
101
|
-
traceId,
|
|
102
|
-
timestamp,
|
|
103
|
-
detailsJson,
|
|
104
|
-
errorMessage,
|
|
105
|
-
});
|
|
106
|
-
const hash = sha256Hex(payload);
|
|
107
|
-
db.prepare(`
|
|
108
|
-
INSERT INTO ${this.TABLE}
|
|
109
|
-
(timestamp, action, status, agent, traceId, details, errorMessage, durationMs, dataCategory, retentionDays, prev_hash, hash)
|
|
110
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
111
|
-
`).run(timestamp, action, status, agent, options.traceId || null, detailsJson || null, errorMessage || null, options.durationMs || null, dataCategory, retentionDays, prevHash, hash);
|
|
112
|
-
});
|
|
113
|
-
insert();
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Verify tamper-evident chain for structured audit_log table.
|
|
117
|
-
*/
|
|
118
|
-
static verifyIntegrity() {
|
|
119
|
-
const db = databaseHolder.getDB();
|
|
120
|
-
try {
|
|
121
|
-
const rows = db.prepare(`SELECT id, prev_hash, hash, agent, action, status, traceId, timestamp, details, errorMessage
|
|
122
|
-
FROM ${this.TABLE} ORDER BY id ASC`).all();
|
|
123
|
-
// Skip unhashed legacy rows at the head; start chain at first hashed row
|
|
124
|
-
const hashed = rows.filter((r) => r.hash);
|
|
125
|
-
if (hashed.length === 0) {
|
|
126
|
-
return { valid: true, checked: 0, reason: "No hashed audit rows yet" };
|
|
127
|
-
}
|
|
128
|
-
return verifyHashChain(hashed, (row, prevHash) => buildStructuredAuditChainPayload({
|
|
129
|
-
prevHash,
|
|
130
|
-
agent: row.agent,
|
|
131
|
-
action: row.action,
|
|
132
|
-
status: row.status,
|
|
133
|
-
traceId: row.traceId || "",
|
|
134
|
-
timestamp: row.timestamp,
|
|
135
|
-
detailsJson: row.details || "",
|
|
136
|
-
errorMessage: row.errorMessage || "",
|
|
137
|
-
}));
|
|
138
|
-
}
|
|
139
|
-
catch (err) {
|
|
140
|
-
return {
|
|
141
|
-
valid: false,
|
|
142
|
-
checked: 0,
|
|
143
|
-
reason: `Verification error: ${err.message}`,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Queries audit logs with filters.
|
|
149
|
-
*/
|
|
150
|
-
static query(options = {}) {
|
|
151
|
-
const db = databaseHolder.getDB();
|
|
152
|
-
const conditions = [];
|
|
153
|
-
const params = [];
|
|
154
|
-
if (options.action) {
|
|
155
|
-
conditions.push("action = ?");
|
|
156
|
-
params.push(options.action);
|
|
157
|
-
}
|
|
158
|
-
if (options.status) {
|
|
159
|
-
conditions.push("status = ?");
|
|
160
|
-
params.push(options.status);
|
|
161
|
-
}
|
|
162
|
-
if (options.agent) {
|
|
163
|
-
conditions.push("agent = ?");
|
|
164
|
-
params.push(options.agent);
|
|
165
|
-
}
|
|
166
|
-
if (options.traceId) {
|
|
167
|
-
conditions.push("traceId = ?");
|
|
168
|
-
params.push(options.traceId);
|
|
169
|
-
}
|
|
170
|
-
if (options.dataCategory) {
|
|
171
|
-
conditions.push("dataCategory = ?");
|
|
172
|
-
params.push(options.dataCategory);
|
|
173
|
-
}
|
|
174
|
-
if (options.since) {
|
|
175
|
-
conditions.push("timestamp >= ?");
|
|
176
|
-
params.push(options.since);
|
|
177
|
-
}
|
|
178
|
-
if (options.until) {
|
|
179
|
-
conditions.push("timestamp <= ?");
|
|
180
|
-
params.push(options.until);
|
|
181
|
-
}
|
|
182
|
-
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
183
|
-
const limit = options.limit || 50;
|
|
184
|
-
const offset = options.offset || 0;
|
|
185
|
-
const rows = db.prepare(`SELECT * FROM ${this.TABLE} ${where} ORDER BY timestamp DESC LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
186
|
-
return rows.map(row => ({
|
|
187
|
-
...row,
|
|
188
|
-
details: row.details ? JSON.parse(row.details) : undefined,
|
|
189
|
-
}));
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* [KVKK Art. 11] Deletes records upon data subject request.
|
|
193
|
-
* Clears all records matching a given traceId or agent.
|
|
194
|
-
*
|
|
195
|
-
* @param filter Which records to delete
|
|
196
|
-
* @returns Number of deleted records
|
|
197
|
-
*/
|
|
198
|
-
static deleteByFilter(filter) {
|
|
199
|
-
const db = databaseHolder.getDB();
|
|
200
|
-
const conditions = [];
|
|
201
|
-
const params = [];
|
|
202
|
-
if (filter.traceId) {
|
|
203
|
-
conditions.push("traceId = ?");
|
|
204
|
-
params.push(filter.traceId);
|
|
205
|
-
}
|
|
206
|
-
if (filter.agent) {
|
|
207
|
-
conditions.push("agent = ?");
|
|
208
|
-
params.push(filter.agent);
|
|
209
|
-
}
|
|
210
|
-
if (filter.action) {
|
|
211
|
-
conditions.push("action = ?");
|
|
212
|
-
params.push(filter.action);
|
|
213
|
-
}
|
|
214
|
-
if (filter.olderThanDays) {
|
|
215
|
-
conditions.push("timestamp < datetime('now', ? || ' days')");
|
|
216
|
-
params.push(`-${filter.olderThanDays}`);
|
|
217
|
-
}
|
|
218
|
-
if (conditions.length === 0)
|
|
219
|
-
return 0;
|
|
220
|
-
const result = db.prepare(`DELETE FROM ${this.TABLE} WHERE ${conditions.join(" AND ")}`).run(...params);
|
|
221
|
-
return result.changes;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* [KVKK/GDPR] Cleans expired records.
|
|
225
|
-
* Operates based on each audit record's retentionDays field.
|
|
226
|
-
* Can be auto-triggered by cron job or each Audit.log() call.
|
|
227
|
-
*
|
|
228
|
-
* @returns Number of cleaned records
|
|
229
|
-
*/
|
|
230
|
-
static cleanExpired() {
|
|
231
|
-
const db = databaseHolder.getDB();
|
|
232
|
-
const result = db.prepare(`
|
|
233
|
-
DELETE FROM ${this.TABLE}
|
|
234
|
-
WHERE retentionDays IS NOT NULL
|
|
235
|
-
AND timestamp < datetime('now', '-' || retentionDays || ' days')
|
|
236
|
-
`).run();
|
|
237
|
-
if (result.changes > 0) {
|
|
238
|
-
logger.info(`[AUDIT] Expired records cleaned: ${result.changes}`);
|
|
239
|
-
}
|
|
240
|
-
return result.changes;
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Returns audit statistics.
|
|
244
|
-
*/
|
|
245
|
-
static getStats() {
|
|
246
|
-
const db = databaseHolder.getDB();
|
|
247
|
-
this.cleanExpired();
|
|
248
|
-
const total = db.prepare(`SELECT COUNT(*) as count FROM ${this.TABLE}`).get().count;
|
|
249
|
-
const byStatusRows = db.prepare(`SELECT status, COUNT(*) as count FROM ${this.TABLE} GROUP BY status`).all();
|
|
250
|
-
const byActionRows = db.prepare(`SELECT action, COUNT(*) as count FROM ${this.TABLE} GROUP BY action ORDER BY count DESC LIMIT 10`).all();
|
|
251
|
-
const byCategoryRows = db.prepare(`SELECT dataCategory, COUNT(*) as count FROM ${this.TABLE} GROUP BY dataCategory`).all();
|
|
252
|
-
const errors = db.prepare(`SELECT * FROM ${this.TABLE} WHERE status IN ('FAILED', 'BLOCKED') ORDER BY timestamp DESC LIMIT 10`).all();
|
|
253
|
-
const expiredCount = db.prepare(`
|
|
254
|
-
SELECT COUNT(*) as count FROM ${this.TABLE}
|
|
255
|
-
WHERE retentionDays IS NOT NULL
|
|
256
|
-
AND timestamp < datetime('now', '-' || retentionDays || ' days')
|
|
257
|
-
`).get().count;
|
|
258
|
-
return {
|
|
259
|
-
total,
|
|
260
|
-
byStatus: Object.fromEntries(byStatusRows.map(r => [r.status, r.count])),
|
|
261
|
-
byAction: Object.fromEntries(byActionRows.map(r => [r.action, r.count])),
|
|
262
|
-
byCategory: Object.fromEntries(byCategoryRows.map(r => [r.dataCategory, r.count])),
|
|
263
|
-
recentErrors: errors.map(row => ({
|
|
264
|
-
...row,
|
|
265
|
-
details: row.details ? JSON.parse(row.details) : undefined,
|
|
266
|
-
})),
|
|
267
|
-
expiredCount,
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* [KVKK Art. 7] Clears all audit records.
|
|
272
|
-
* Used under the "Right to Erasure" provision.
|
|
273
|
-
* Only authorized users may call this.
|
|
274
|
-
*/
|
|
275
|
-
static clearAll(confirmationCode) {
|
|
276
|
-
if (confirmationCode !== "KVKK-RIGHT-TO-ERASURE") {
|
|
277
|
-
throw new Error("[AUDIT] Invalid confirmation code for data erasure");
|
|
278
|
-
}
|
|
279
|
-
const db = databaseHolder.getDB();
|
|
280
|
-
const result = db.prepare(`DELETE FROM ${this.TABLE}`).run();
|
|
281
|
-
logger.info(`[AUDIT] All records cleared (${result.changes} records). KVKK Article 7 compliance.`);
|
|
282
|
-
return result.changes;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
1
|
+
export * from "./modules/observability/audit.js";
|
|
285
2
|
//# sourceMappingURL=audit.js.map
|
package/dist/audit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,152 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Agent Atabey — Single Source of Truth for framework constants.
|
|
3
|
-
* Import from here instead of hardcoding paths, phases, or directory names.
|
|
4
|
-
*/
|
|
5
|
-
export declare const FRAMEWORK: {
|
|
6
|
-
NAME: string;
|
|
7
|
-
CORE_DIR: string;
|
|
8
|
-
UNIFIED_HUB_DIR: string;
|
|
9
|
-
CONSTITUTION_FILE: string;
|
|
10
|
-
DEFAULT_TRACE_ID: string;
|
|
11
|
-
DEFAULT_PHASE: string;
|
|
12
|
-
DEFAULT_MANAGER_STATE: string;
|
|
13
|
-
DASHBOARD_PORT: number;
|
|
14
|
-
};
|
|
15
|
-
export declare const PROJECT_PHASES: readonly ["PHASE_0", "PHASE_1", "PHASE_2", "PHASE_3", "PHASE_4"];
|
|
16
|
-
export declare const ADAPTER_DIRS: {
|
|
17
|
-
readonly GEMINI: ".gemini";
|
|
18
|
-
readonly CLAUDE: ".claude";
|
|
19
|
-
readonly GROK: ".grok";
|
|
20
|
-
readonly CURSOR: ".cursor";
|
|
21
|
-
readonly CODEX: ".agents";
|
|
22
|
-
readonly ANTIGRAVITY: ".agents";
|
|
23
|
-
readonly LOCAL: ".atabey";
|
|
24
|
-
readonly OPENCODE: ".opencode";
|
|
25
|
-
readonly LEGACY_AGENT: ".agent";
|
|
26
|
-
};
|
|
27
|
-
/** Priority order for framework directory resolution (CLI + MCP). */
|
|
28
|
-
export declare const FRAMEWORK_DIR_CANDIDATES: readonly [string, ".agents", ".claude", ".gemini", ".grok", ".cursor", ".agents", ".opencode", ".atabey"];
|
|
29
|
-
/** Slug under `.agents/{slug}/` for each adapter in unified mode. */
|
|
30
|
-
export declare const UNIFIED_ADAPTER_SLUG: {
|
|
31
|
-
readonly gemini: "gemini";
|
|
32
|
-
readonly claude: "claude";
|
|
33
|
-
readonly grok: "grok";
|
|
34
|
-
readonly cursor: "cursor";
|
|
35
|
-
readonly codex: "codex";
|
|
36
|
-
readonly local: "local";
|
|
37
|
-
readonly opencode: "opencode";
|
|
38
|
-
readonly "antigravity-cli": "antigravity";
|
|
39
|
-
};
|
|
40
|
-
export type UnifiedAdapterSlug = keyof typeof UNIFIED_ADAPTER_SLUG;
|
|
41
|
-
export declare const NATIVE_AGENT_PATHS: {
|
|
42
|
-
readonly gemini: string;
|
|
43
|
-
readonly claude: string;
|
|
44
|
-
readonly grok: string;
|
|
45
|
-
readonly cursor: string;
|
|
46
|
-
readonly codex: string;
|
|
47
|
-
readonly local: string;
|
|
48
|
-
readonly opencode: string;
|
|
49
|
-
readonly "antigravity-cli": string;
|
|
50
|
-
};
|
|
51
|
-
/** Legacy layout bases used by `check` and discovery (non-unified installs). */
|
|
52
|
-
export declare const LEGACY_AGENT_LAYOUT_BASES: readonly [string, string, string, string, string, string, string, string];
|
|
53
|
-
export declare const FRAMEWORK_SUBDIRS: {
|
|
54
|
-
readonly AGENTS: "agents";
|
|
55
|
-
readonly SKILLS: "skills";
|
|
56
|
-
readonly KNOWLEDGE: "knowledge";
|
|
57
|
-
readonly PROMPTS: "prompts";
|
|
58
|
-
readonly MEMORY: "memory";
|
|
59
|
-
readonly ROUTER: "router";
|
|
60
|
-
readonly REGISTRY: "registry";
|
|
61
|
-
readonly OBSERVABILITY: "observability";
|
|
62
|
-
readonly RULES: "rules";
|
|
63
|
-
readonly MESSAGES: "messages";
|
|
64
|
-
readonly LOGS: "logs";
|
|
65
|
-
readonly MEMORY_GRAPH: "memory-graph";
|
|
66
|
-
readonly DASHBOARD: "dashboard";
|
|
67
|
-
readonly UI_DIST: "ui";
|
|
68
|
-
};
|
|
69
|
-
export declare const CORE_SCAFFOLD_SUBDIRS: readonly ["knowledge", "prompts", "memory", "router", "registry", "observability", "rules"];
|
|
70
|
-
export declare const RUNTIME_SUBDIRS: readonly ["messages", "logs", "memory-graph"];
|
|
71
|
-
export declare const MEMORY_SUBDIRS: {
|
|
72
|
-
readonly TASKS: "tasks";
|
|
73
|
-
readonly HISTORY: "history";
|
|
74
|
-
};
|
|
75
|
-
export declare const MEMORY_FILES: {
|
|
76
|
-
readonly STATE: "state.json";
|
|
77
|
-
readonly STATUS: "status.json";
|
|
78
|
-
readonly PROJECT_MEMORY: "PROJECT_MEMORY.md";
|
|
79
|
-
readonly SHARED_FACTS: "shared-facts.json";
|
|
80
|
-
};
|
|
81
|
-
/** Default layout scaffolded into consumer projects after `atabey init`. */
|
|
82
|
-
export declare const DEFAULT_CONSUMER_PATHS: {
|
|
83
|
-
readonly backend: "apps/backend";
|
|
84
|
-
readonly frontend: "apps/web";
|
|
85
|
-
readonly mobile: "apps/mobile";
|
|
86
|
-
readonly docs: "docs";
|
|
87
|
-
readonly tests: "tests";
|
|
88
|
-
};
|
|
89
|
-
/** Paths inside the Atabey framework source monorepo (not consumer apps/). */
|
|
90
|
-
export declare const FRAMEWORK_MONOREPO_PATHS: {
|
|
91
|
-
readonly backend: "packages/atabey";
|
|
92
|
-
readonly frontend: "packages/atabey-mcp/dashboard";
|
|
93
|
-
readonly mobile: "apps/mobile";
|
|
94
|
-
readonly docs: "docs";
|
|
95
|
-
readonly tests: "packages";
|
|
96
|
-
};
|
|
97
|
-
/** @deprecated Use DEFAULT_CONSUMER_PATHS */
|
|
98
|
-
export declare const DEFAULT_MONOREPO_PATHS: {
|
|
99
|
-
readonly backend: "apps/backend";
|
|
100
|
-
readonly frontend: "apps/web";
|
|
101
|
-
readonly mobile: "apps/mobile";
|
|
102
|
-
readonly docs: "docs";
|
|
103
|
-
readonly tests: "tests";
|
|
104
|
-
};
|
|
105
|
-
/** Cursor rule globs per agent role (enterprise monorepo layout). */
|
|
106
|
-
export declare const CURSOR_AGENT_GLOBS: Record<string, string>;
|
|
107
|
-
export declare const MCP: {
|
|
108
|
-
readonly SERVER_NAME: "atabey";
|
|
109
|
-
readonly ROOT_CONFIG_FILE: "mcp.json";
|
|
110
|
-
readonly PROJECT_ROOT_ENV: "ATABEY_PROJECT_ROOT";
|
|
111
|
-
readonly TEST_DIR_ENV: "ATABEY_TEST_DIR";
|
|
112
|
-
readonly TRANSPORT_ENV: "MCP_TRANSPORT";
|
|
113
|
-
/** IDE clients (Claude, Cursor, Gemini) spawn MCP via stdio JSON-RPC. */
|
|
114
|
-
readonly TRANSPORT_STDIO: "stdio";
|
|
115
|
-
/** HTTP/SSE unified server for dashboard, multi-session, and remote clients. */
|
|
116
|
-
readonly TRANSPORT_UNIFIED: "unified";
|
|
117
|
-
readonly SERVER_DIST_PATH: "../atabey-mcp/dist/atabey-mcp/src/mcp/index.js";
|
|
118
|
-
};
|
|
119
|
-
/** Headless Hermes orchestrator (AgentLoop) — auto-starts with MCP server by default. */
|
|
120
|
-
export declare const ORCHESTRATOR: {
|
|
121
|
-
readonly AUTO_START_ENV: "ATABEY_AUTO_START_ORCHESTRATOR";
|
|
122
|
-
readonly INTERVAL_MS_ENV: "ATABEY_ORCHESTRATOR_INTERVAL_MS";
|
|
123
|
-
readonly DEFAULT_AUTO_START: true;
|
|
124
|
-
readonly DEFAULT_INTERVAL_MS: 1000;
|
|
125
|
-
};
|
|
126
|
-
export declare const ROOT_CONFIG_FILES: {
|
|
127
|
-
readonly MCP: "mcp.json";
|
|
128
|
-
readonly DOT_MCP: ".mcp.json";
|
|
129
|
-
readonly ENV_EXAMPLE: ".env.example";
|
|
130
|
-
readonly VSCODE_MCP: ".vscode/mcp.json";
|
|
131
|
-
};
|
|
132
|
-
export declare const TEMPLATE_PLACEHOLDERS: {
|
|
133
|
-
readonly FRAMEWORK_DIR: "{{FRAMEWORK_DIR}}";
|
|
134
|
-
readonly ADAPTER: "{{ADAPTER}}";
|
|
135
|
-
readonly BACKEND_DIR: "{{BACKEND_DIR}}";
|
|
136
|
-
readonly FRONTEND_DIR: "{{FRONTEND_DIR}}";
|
|
137
|
-
readonly DOCS_DIR: "{{DOCS_DIR}}";
|
|
138
|
-
readonly TESTS_DIR: "{{TESTS_DIR}}";
|
|
139
|
-
};
|
|
140
|
-
export declare const AGENT_FILE_EXT: {
|
|
141
|
-
readonly MARKDOWN: ".md";
|
|
142
|
-
readonly CURSOR_RULE: ".mdc";
|
|
143
|
-
};
|
|
144
|
-
export declare function pathJoin(...segments: string[]): string;
|
|
145
|
-
export declare function corePath(...segments: string[]): string;
|
|
146
|
-
export declare function unifiedHubPath(...segments: string[]): string;
|
|
147
|
-
export declare function unifiedAdapterPath(slug: string, ...segments: string[]): string;
|
|
148
|
-
export declare function knowledgePath(filename: string): string;
|
|
149
|
-
/** Backward-compatible aliases */
|
|
150
|
-
export declare const CORE_FRAMEWORK_DIR: string;
|
|
151
|
-
export declare const UNIFIED_HUB_DIR: string;
|
|
152
|
-
export declare const SKILLS_HUB_PATH: string;
|
|
1
|
+
export * from "./modules/primitives/constants.js";
|
package/dist/constants.js
CHANGED
|
@@ -1,216 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Agent Atabey — Single Source of Truth for framework constants.
|
|
3
|
-
* Import from here instead of hardcoding paths, phases, or directory names.
|
|
4
|
-
*/
|
|
5
|
-
// ─── Framework identity ───────────────────────────────────────────────────────
|
|
6
|
-
export const FRAMEWORK = {
|
|
7
|
-
NAME: "Agent Atabey",
|
|
8
|
-
CORE_DIR: ".atabey",
|
|
9
|
-
UNIFIED_HUB_DIR: ".agents",
|
|
10
|
-
CONSTITUTION_FILE: "ATABEY.md",
|
|
11
|
-
DEFAULT_TRACE_ID: "T-000",
|
|
12
|
-
DEFAULT_PHASE: "PHASE_0",
|
|
13
|
-
DEFAULT_MANAGER_STATE: "ACTIVE",
|
|
14
|
-
DASHBOARD_PORT: parseInt(process.env.PORT || process.env.DASHBOARD_PORT || "5858"),
|
|
15
|
-
};
|
|
16
|
-
export const PROJECT_PHASES = [
|
|
17
|
-
"PHASE_0",
|
|
18
|
-
"PHASE_1",
|
|
19
|
-
"PHASE_2",
|
|
20
|
-
"PHASE_3",
|
|
21
|
-
"PHASE_4",
|
|
22
|
-
];
|
|
23
|
-
// ─── Adapter platform directories (native / legacy) ───────────────────────────
|
|
24
|
-
export const ADAPTER_DIRS = {
|
|
25
|
-
GEMINI: ".gemini",
|
|
26
|
-
CLAUDE: ".claude",
|
|
27
|
-
GROK: ".grok",
|
|
28
|
-
CURSOR: ".cursor",
|
|
29
|
-
CODEX: ".agents",
|
|
30
|
-
ANTIGRAVITY: ".agents",
|
|
31
|
-
LOCAL: ".atabey",
|
|
32
|
-
OPENCODE: ".opencode",
|
|
33
|
-
LEGACY_AGENT: ".agent",
|
|
34
|
-
};
|
|
35
|
-
/** Priority order for framework directory resolution (CLI + MCP). */
|
|
36
|
-
export const FRAMEWORK_DIR_CANDIDATES = [
|
|
37
|
-
FRAMEWORK.CORE_DIR,
|
|
38
|
-
ADAPTER_DIRS.CODEX,
|
|
39
|
-
ADAPTER_DIRS.CLAUDE,
|
|
40
|
-
ADAPTER_DIRS.GEMINI,
|
|
41
|
-
ADAPTER_DIRS.GROK,
|
|
42
|
-
ADAPTER_DIRS.CURSOR,
|
|
43
|
-
ADAPTER_DIRS.ANTIGRAVITY,
|
|
44
|
-
ADAPTER_DIRS.OPENCODE,
|
|
45
|
-
ADAPTER_DIRS.LOCAL,
|
|
46
|
-
];
|
|
47
|
-
/** Slug under `.agents/{slug}/` for each adapter in unified mode. */
|
|
48
|
-
export const UNIFIED_ADAPTER_SLUG = {
|
|
49
|
-
gemini: "gemini",
|
|
50
|
-
claude: "claude",
|
|
51
|
-
grok: "grok",
|
|
52
|
-
cursor: "cursor",
|
|
53
|
-
codex: "codex",
|
|
54
|
-
local: "local",
|
|
55
|
-
opencode: "opencode",
|
|
56
|
-
"antigravity-cli": "antigravity",
|
|
57
|
-
};
|
|
58
|
-
// ─── Native agent instruction paths (legacy tool compatibility) ───────────────
|
|
59
|
-
export const NATIVE_AGENT_PATHS = {
|
|
60
|
-
gemini: pathJoin(ADAPTER_DIRS.GEMINI, "agents"),
|
|
61
|
-
claude: pathJoin(ADAPTER_DIRS.CLAUDE, "agents"),
|
|
62
|
-
grok: pathJoin(ADAPTER_DIRS.GROK, "agents"),
|
|
63
|
-
cursor: pathJoin(ADAPTER_DIRS.CURSOR, "rules"),
|
|
64
|
-
codex: pathJoin(ADAPTER_DIRS.CODEX, "instructions"),
|
|
65
|
-
local: pathJoin(ADAPTER_DIRS.LOCAL, "agents"),
|
|
66
|
-
opencode: pathJoin(ADAPTER_DIRS.OPENCODE, "agents"),
|
|
67
|
-
"antigravity-cli": pathJoin(ADAPTER_DIRS.ANTIGRAVITY, "agents"),
|
|
68
|
-
};
|
|
69
|
-
/** Legacy layout bases used by `check` and discovery (non-unified installs). */
|
|
70
|
-
export const LEGACY_AGENT_LAYOUT_BASES = [
|
|
71
|
-
NATIVE_AGENT_PATHS.gemini,
|
|
72
|
-
NATIVE_AGENT_PATHS.claude,
|
|
73
|
-
NATIVE_AGENT_PATHS.cursor,
|
|
74
|
-
NATIVE_AGENT_PATHS.grok,
|
|
75
|
-
NATIVE_AGENT_PATHS.codex,
|
|
76
|
-
NATIVE_AGENT_PATHS.local,
|
|
77
|
-
NATIVE_AGENT_PATHS.opencode,
|
|
78
|
-
NATIVE_AGENT_PATHS["antigravity-cli"],
|
|
79
|
-
];
|
|
80
|
-
// ─── Framework internal subdirectories (under `.atabey/`) ──────────────────
|
|
81
|
-
export const FRAMEWORK_SUBDIRS = {
|
|
82
|
-
AGENTS: "agents",
|
|
83
|
-
SKILLS: "skills",
|
|
84
|
-
KNOWLEDGE: "knowledge",
|
|
85
|
-
PROMPTS: "prompts",
|
|
86
|
-
MEMORY: "memory",
|
|
87
|
-
ROUTER: "router",
|
|
88
|
-
REGISTRY: "registry",
|
|
89
|
-
OBSERVABILITY: "observability",
|
|
90
|
-
RULES: "rules",
|
|
91
|
-
MESSAGES: "messages",
|
|
92
|
-
LOGS: "logs",
|
|
93
|
-
MEMORY_GRAPH: "memory-graph",
|
|
94
|
-
DASHBOARD: "dashboard",
|
|
95
|
-
UI_DIST: "ui",
|
|
96
|
-
};
|
|
97
|
-
export const CORE_SCAFFOLD_SUBDIRS = [
|
|
98
|
-
FRAMEWORK_SUBDIRS.KNOWLEDGE,
|
|
99
|
-
FRAMEWORK_SUBDIRS.PROMPTS,
|
|
100
|
-
FRAMEWORK_SUBDIRS.MEMORY,
|
|
101
|
-
FRAMEWORK_SUBDIRS.ROUTER,
|
|
102
|
-
FRAMEWORK_SUBDIRS.REGISTRY,
|
|
103
|
-
FRAMEWORK_SUBDIRS.OBSERVABILITY,
|
|
104
|
-
FRAMEWORK_SUBDIRS.RULES,
|
|
105
|
-
];
|
|
106
|
-
export const RUNTIME_SUBDIRS = [
|
|
107
|
-
FRAMEWORK_SUBDIRS.MESSAGES,
|
|
108
|
-
FRAMEWORK_SUBDIRS.LOGS,
|
|
109
|
-
FRAMEWORK_SUBDIRS.MEMORY_GRAPH,
|
|
110
|
-
];
|
|
111
|
-
export const MEMORY_SUBDIRS = {
|
|
112
|
-
TASKS: "tasks",
|
|
113
|
-
HISTORY: "history",
|
|
114
|
-
};
|
|
115
|
-
export const MEMORY_FILES = {
|
|
116
|
-
STATE: "state.json",
|
|
117
|
-
STATUS: "status.json",
|
|
118
|
-
PROJECT_MEMORY: "PROJECT_MEMORY.md",
|
|
119
|
-
SHARED_FACTS: "shared-facts.json",
|
|
120
|
-
};
|
|
121
|
-
// ─── Monorepo default paths ───────────────────────────────────────────────────
|
|
122
|
-
/** Default layout scaffolded into consumer projects after `atabey init`. */
|
|
123
|
-
export const DEFAULT_CONSUMER_PATHS = {
|
|
124
|
-
backend: "apps/backend",
|
|
125
|
-
frontend: "apps/web",
|
|
126
|
-
mobile: "apps/mobile",
|
|
127
|
-
docs: "docs",
|
|
128
|
-
tests: "tests",
|
|
129
|
-
};
|
|
130
|
-
/** Paths inside the Atabey framework source monorepo (not consumer apps/). */
|
|
131
|
-
export const FRAMEWORK_MONOREPO_PATHS = {
|
|
132
|
-
backend: "packages/atabey",
|
|
133
|
-
frontend: "packages/atabey-mcp/dashboard",
|
|
134
|
-
mobile: "apps/mobile",
|
|
135
|
-
docs: "docs",
|
|
136
|
-
tests: "packages",
|
|
137
|
-
};
|
|
138
|
-
/** @deprecated Use DEFAULT_CONSUMER_PATHS */
|
|
139
|
-
export const DEFAULT_MONOREPO_PATHS = DEFAULT_CONSUMER_PATHS;
|
|
140
|
-
/** Cursor rule globs per agent role (enterprise monorepo layout). */
|
|
141
|
-
export const CURSOR_AGENT_GLOBS = {
|
|
142
|
-
manager: "**/*",
|
|
143
|
-
security: "**/*",
|
|
144
|
-
architect: "**/*",
|
|
145
|
-
backend: `${DEFAULT_MONOREPO_PATHS.backend}/**/*`,
|
|
146
|
-
frontend: `${DEFAULT_MONOREPO_PATHS.frontend}/**/*`,
|
|
147
|
-
mobile: `${DEFAULT_MONOREPO_PATHS.mobile}/**/*`,
|
|
148
|
-
native: "apps/native/**/*",
|
|
149
|
-
database: `${DEFAULT_MONOREPO_PATHS.backend}/src/database/**/*`,
|
|
150
|
-
devops: "{.github,docker,infra,scripts,*.yml,*.yaml,Dockerfile*}",
|
|
151
|
-
quality: "**/*",
|
|
152
|
-
analyst: "{docs,specs,contracts}/**/*",
|
|
153
|
-
explorer: "**/*",
|
|
154
|
-
git: "**/*",
|
|
155
|
-
};
|
|
156
|
-
// ─── MCP & environment ──────────────────────────────────────────────────────
|
|
157
|
-
export const MCP = {
|
|
158
|
-
SERVER_NAME: "atabey",
|
|
159
|
-
ROOT_CONFIG_FILE: "mcp.json",
|
|
160
|
-
PROJECT_ROOT_ENV: "ATABEY_PROJECT_ROOT",
|
|
161
|
-
TEST_DIR_ENV: "ATABEY_TEST_DIR",
|
|
162
|
-
TRANSPORT_ENV: "MCP_TRANSPORT",
|
|
163
|
-
/** IDE clients (Claude, Cursor, Gemini) spawn MCP via stdio JSON-RPC. */
|
|
164
|
-
TRANSPORT_STDIO: "stdio",
|
|
165
|
-
/** HTTP/SSE unified server for dashboard, multi-session, and remote clients. */
|
|
166
|
-
TRANSPORT_UNIFIED: "unified",
|
|
167
|
-
SERVER_DIST_PATH: "../atabey-mcp/dist/atabey-mcp/src/mcp/index.js",
|
|
168
|
-
};
|
|
169
|
-
/** Headless Hermes orchestrator (AgentLoop) — auto-starts with MCP server by default. */
|
|
170
|
-
export const ORCHESTRATOR = {
|
|
171
|
-
AUTO_START_ENV: "ATABEY_AUTO_START_ORCHESTRATOR",
|
|
172
|
-
INTERVAL_MS_ENV: "ATABEY_ORCHESTRATOR_INTERVAL_MS",
|
|
173
|
-
DEFAULT_AUTO_START: true,
|
|
174
|
-
DEFAULT_INTERVAL_MS: 1000,
|
|
175
|
-
};
|
|
176
|
-
export const ROOT_CONFIG_FILES = {
|
|
177
|
-
MCP: MCP.ROOT_CONFIG_FILE,
|
|
178
|
-
DOT_MCP: ".mcp.json",
|
|
179
|
-
ENV_EXAMPLE: ".env.example",
|
|
180
|
-
VSCODE_MCP: ".vscode/mcp.json",
|
|
181
|
-
};
|
|
182
|
-
// ─── Shim template placeholders ───────────────────────────────────────────────
|
|
183
|
-
export const TEMPLATE_PLACEHOLDERS = {
|
|
184
|
-
FRAMEWORK_DIR: "{{FRAMEWORK_DIR}}",
|
|
185
|
-
ADAPTER: "{{ADAPTER}}",
|
|
186
|
-
BACKEND_DIR: "{{BACKEND_DIR}}",
|
|
187
|
-
FRONTEND_DIR: "{{FRONTEND_DIR}}",
|
|
188
|
-
DOCS_DIR: "{{DOCS_DIR}}",
|
|
189
|
-
TESTS_DIR: "{{TESTS_DIR}}",
|
|
190
|
-
};
|
|
191
|
-
// ─── File extensions ─────────────────────────────────────────────────────────
|
|
192
|
-
export const AGENT_FILE_EXT = {
|
|
193
|
-
MARKDOWN: ".md",
|
|
194
|
-
CURSOR_RULE: ".mdc",
|
|
195
|
-
};
|
|
196
|
-
// ─── Path helpers ─────────────────────────────────────────────────────────────
|
|
197
|
-
export function pathJoin(...segments) {
|
|
198
|
-
return segments.filter(Boolean).join("/");
|
|
199
|
-
}
|
|
200
|
-
export function corePath(...segments) {
|
|
201
|
-
return [FRAMEWORK.CORE_DIR, ...segments.filter(Boolean)].join("/");
|
|
202
|
-
}
|
|
203
|
-
export function unifiedHubPath(...segments) {
|
|
204
|
-
return [FRAMEWORK.UNIFIED_HUB_DIR, ...segments.filter(Boolean)].join("/");
|
|
205
|
-
}
|
|
206
|
-
export function unifiedAdapterPath(slug, ...segments) {
|
|
207
|
-
return unifiedHubPath(slug, ...segments);
|
|
208
|
-
}
|
|
209
|
-
export function knowledgePath(filename) {
|
|
210
|
-
return corePath(FRAMEWORK_SUBDIRS.KNOWLEDGE, filename);
|
|
211
|
-
}
|
|
212
|
-
/** Backward-compatible aliases */
|
|
213
|
-
export const CORE_FRAMEWORK_DIR = FRAMEWORK.CORE_DIR;
|
|
214
|
-
export const UNIFIED_HUB_DIR = FRAMEWORK.UNIFIED_HUB_DIR;
|
|
215
|
-
export const SKILLS_HUB_PATH = pathJoin(UNIFIED_HUB_DIR, FRAMEWORK_SUBDIRS.SKILLS);
|
|
1
|
+
export * from "./modules/primitives/constants.js";
|
|
216
2
|
//# sourceMappingURL=constants.js.map
|