atabey-shared 0.1.0 → 0.1.2
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 +25 -26
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# [GOV] Atabey Shared — Core Utility Library for AI Governance Platform
|
|
1
|
+
# [GOV] Atabey Shared — Core Utility Library for the AI Governance Platform
|
|
2
2
|
|
|
3
|
-
[](https://github.com/ysf-bkr/atabey)
|
|
4
4
|
[](https://www.npmjs.com/package/atabey-shared)
|
|
5
5
|
[](https://www.gnu.org/licenses/agpl-3.0)
|
|
6
6
|
|
|
7
|
-
**Atabey Shared** is the foundational utility package of the Atabey framework
|
|
7
|
+
**Atabey Shared** is the foundational utility package of the Atabey framework: shared constants and branded types, security filters (PII, secrets, TLS, policy gate), the SQLite holder and migrations, structured logging, audit chain, concurrency primitives (locks, job queue, worker pool) and the sandbox runtime — used by both `atabey` (core CLI/orchestrator) and `atabey-mcp` (MCP server).
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
## 🚀 Installation
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Designed as an **internal shared module** for the Atabey monorepo workspace, but installable independently:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
30
|
npm install atabey-shared
|
|
@@ -35,9 +35,9 @@ npm install atabey-shared
|
|
|
35
35
|
## 🧩 Module Structure
|
|
36
36
|
|
|
37
37
|
The package is organized into focused **module groups**. `src/index.ts` is a barrel
|
|
38
|
-
that re-exports everything flat **plus** a `Modules.<Group>` namespace per group;
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
that re-exports everything flat **plus** a `Modules.<Group>` namespace per group; the
|
|
39
|
+
flat `atabey-shared/*.js` entry points are kept as thin re-export shims for backward
|
|
40
|
+
compatibility.
|
|
41
41
|
|
|
42
42
|
```
|
|
43
43
|
packages/shared/
|
|
@@ -73,21 +73,16 @@ import { maskText } from "atabey-shared/security/pii.js";
|
|
|
73
73
|
## ⚙️ Core Modules Detail
|
|
74
74
|
|
|
75
75
|
### 1. PII Protection (KVKK/GDPR Compliance)
|
|
76
|
-
The `pii.ts` module scans and redacts sensitive data before it is logged to disk or sent to external LLM providers
|
|
76
|
+
The `pii.ts` module scans and redacts sensitive data before it is logged to disk or sent to external LLM providers.
|
|
77
77
|
```typescript
|
|
78
78
|
import { maskText } from "atabey-shared";
|
|
79
79
|
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
console.log(sanitizedText);
|
|
83
|
-
// Output: "My phone is ***-***-**** and email is ***@***"
|
|
80
|
+
const sanitized = maskText("My phone is +90 555 123 45 67 and email is admin@company.com");
|
|
81
|
+
// "My phone is ***-***-**** and email is ***@***"
|
|
84
82
|
```
|
|
85
83
|
|
|
86
84
|
### 2. Distributed Resource Locking
|
|
87
|
-
|
|
88
|
-
with stale-lock reclaim) that prevents race conditions between parallel agents writing
|
|
89
|
-
to shared resources (e.g. `PROJECT_MEMORY.md`). For a lightweight file-based lock, use
|
|
90
|
-
`AtomicFileLock` from `file-lock.ts`.
|
|
85
|
+
`lock.ts` provides a SQLite-backed `DistributedLock` (server-authoritative, with stale-lock reclaim) that prevents race conditions between parallel agents writing to shared resources. For a lightweight file-based lock, use `AtomicFileLock` from `file-lock.ts`.
|
|
91
86
|
```typescript
|
|
92
87
|
import { DistributedLock } from "atabey-shared";
|
|
93
88
|
|
|
@@ -104,21 +99,16 @@ if (DistributedLock.acquire("PROJECT_MEMORY.md", owner, { ttlMs: 10000, reason:
|
|
|
104
99
|
```
|
|
105
100
|
|
|
106
101
|
### 3. Structured Logger
|
|
107
|
-
Structured logger wrapping `process.stdout
|
|
102
|
+
Structured logger wrapping `process.stdout`/`process.stderr`, with file logging and JSON output.
|
|
108
103
|
```typescript
|
|
109
104
|
import { logger, LogLevel } from "atabey-shared";
|
|
110
105
|
|
|
111
|
-
logger.configure({
|
|
112
|
-
minLevel: LogLevel.DEBUG,
|
|
113
|
-
jsonFormat: true,
|
|
114
|
-
logFile: "./.atabey/logs/system.log"
|
|
115
|
-
});
|
|
116
|
-
|
|
106
|
+
logger.configure({ minLevel: LogLevel.DEBUG, jsonFormat: true, logFile: "./.atabey/logs/system.log" });
|
|
117
107
|
logger.info("Database migration completed", { durationMs: 142 });
|
|
118
108
|
```
|
|
119
109
|
|
|
120
110
|
### 4. Branded Types
|
|
121
|
-
|
|
111
|
+
Compile-time validation for workspace ID primitives to prevent mixing agent names, message IDs and task IDs.
|
|
122
112
|
```typescript
|
|
123
113
|
import { AgentID, TaskID, asAgentID, asTaskID } from "atabey-shared";
|
|
124
114
|
|
|
@@ -130,10 +120,19 @@ const task: TaskID = asTaskID("TASK-102");
|
|
|
130
120
|
|
|
131
121
|
## 📦 Dependencies
|
|
132
122
|
|
|
133
|
-
- **js-tiktoken**: `cl100k_base` BPE tokenizer for token
|
|
123
|
+
- **js-tiktoken**: `cl100k_base` BPE tokenizer for token accounting
|
|
134
124
|
- **better-sqlite3**, **chalk**, **zod** _(peer)_: storage, terminal styling and runtime validation
|
|
135
125
|
|
|
136
|
-
|
|
126
|
+
## 🔗 Related Packages
|
|
127
|
+
|
|
128
|
+
| Package | Role | Links |
|
|
129
|
+
|---------|------|-------|
|
|
130
|
+
| **atabey** | Core engine — CLI, agents, engines, orchestrator | [npm](https://www.npmjs.com/package/atabey) · [source](https://github.com/ysf-bkr/atabey/tree/main/packages/atabey) |
|
|
131
|
+
| **atabey-mcp** | MCP server — 40 tools & governance pipeline | [npm](https://www.npmjs.com/package/atabey-mcp) · [source](https://github.com/ysf-bkr/atabey/tree/main/packages/atabey-mcp) |
|
|
132
|
+
| **atabey-shared** | Shared utilities — constants, storage, PII, audit, locks | [npm](https://www.npmjs.com/package/atabey-shared) · [source](https://github.com/ysf-bkr/atabey/tree/main/packages/shared) |
|
|
133
|
+
|
|
134
|
+
> Full bilingual documentation (TR + EN): **[github.com/ysf-bkr/atabey](https://github.com/ysf-bkr/atabey#readme)**
|
|
135
|
+
|
|
137
136
|
|
|
138
137
|
## License
|
|
139
138
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atabey-shared",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Shared utility modules for Atabey — Local AI Control Plane & Discipline Layer",
|
|
5
5
|
"author": "Yusuf BEKAR",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -81,7 +81,8 @@
|
|
|
81
81
|
"build": "tsc",
|
|
82
82
|
"test": "vitest run",
|
|
83
83
|
"test:watch": "vitest",
|
|
84
|
-
"test:coverage": "vitest run --coverage"
|
|
84
|
+
"test:coverage": "vitest run --coverage",
|
|
85
|
+
"prepublishOnly": "node ../../scripts/build-readmes.mjs && npm run build"
|
|
85
86
|
},
|
|
86
87
|
"peerDependencies": {
|
|
87
88
|
"better-sqlite3": "^13.0.2",
|