cognitive-kit 1.0.0-alpha.1 → 1.0.0-alpha.3

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 CHANGED
@@ -1,16 +1,67 @@
1
1
  # cognitive-kit
2
2
 
3
- Pluggable cognitive layer — embeddable MCP server with 27+ tools for reasoning, research, planning, creativity, reflection, security, knowledge, analysis, agency orchestration, and adaptive pipelines.
3
+ **Pluggable cognitive layer** — embeddable MCP server with 31+ tools for reasoning, research, planning, creativity, reflection, security, knowledge, analysis, agency orchestration, and adaptive pipelines. Zero external infrastructure required.
4
4
 
5
- ## Quick Start
5
+ ```
6
+ npm i cognitive-kit
7
+ npx cognitive-kit
8
+ ```
9
+
10
+ ---
11
+
12
+ ## Architecture
13
+
14
+ ```
15
+ CognitiveKit
16
+ / | | | \
17
+ MCP Server Guardian Agency Forge Federation
18
+ | Gate Orch. Registry Manager
19
+ ToolRegistry | | | |
20
+ (31 tools) Sovereignty Adaptive Pattern SSE + Client
21
+ +Firewall Pipeline Detector Multi-Kit
22
+ +State +8 Agents +Forger
23
+ Guardian
24
+ ```
25
+
26
+ ### Core Components
27
+
28
+ | Component | Description |
29
+ |-----------|-------------|
30
+ | **MCP Server** | Model Context Protocol server (v2024-11-05). Supports stdio, SSE, and Direct transports |
31
+ | **Guardian Gate** | Middleware that wraps every tool call: sovereignty validation → firewall → state check |
32
+ | **Agency Orchestrator** | Adaptive pipeline that selects agents and phases dynamically based on objective analysis |
33
+ | **Skill Forger** | Detects usage patterns and auto-generates new skills |
34
+ | **Federation Manager** | Connects multiple Cognitive Kit instances via SSE protocol |
35
+
36
+ ### 31 MCP Tools
37
+
38
+ | Category | Tools |
39
+ |----------|-------|
40
+ | **Cognitive** (5) | `cognitive_reason`, `cognitive_research`, `cognitive_plan`, `cognitive_create`, `cognitive_reflect` |
41
+ | **Security** (9) | `security_gate`, `ethics_audit`, `integrity_ledger`, `threat_mapper`, `red_team`, `blast_radius`, `guardian_status`, `guardian_freeze`, `guardian_unfreeze` |
42
+ | **Knowledge** (3) | `memory_vam`, `knowledge_evolve`, `context_synth` |
43
+ | **Analysis** (4) | `code_archaeologist`, `sentiment_adapter`, `consensus_engine`, `execution_flow` |
44
+ | **Agency** (4) | `swarm_orchestrator`, `meta_orchestrator`, `subagent_protocol`, `agency_execute` |
45
+ | **Federation** (4) | `federation_status`, `federation_connect`, `federation_execute`, `federation_disconnect` |
46
+ | **Host** (2+) | `fs_read`, `fs_write`, `fs_list`, `fs_stat`, `pg_query`, `pg_schema`, `vscode_read_file`, `vscode_get_selection` |
47
+
48
+ ---
49
+
50
+ ## Installation
51
+
52
+ ```bash
53
+ npm install cognitive-kit
54
+ ```
55
+
56
+ ### Quick Start (MCP Server)
6
57
 
7
58
  ```bash
8
59
  npx cognitive-kit
9
60
  ```
10
61
 
11
- Connect any MCP client (VS Code, Cursor, Claude Desktop, custom) via stdio.
62
+ Connects to any MCP client (VS Code, Cursor, Claude Desktop, custom) via stdio.
12
63
 
13
- ## Usage as Library
64
+ ### Quick Start (Library)
14
65
 
15
66
  ```typescript
16
67
  import { CognitiveKit } from 'cognitive-kit';
@@ -19,84 +70,100 @@ const kit = new CognitiveKit({
19
70
  host: { type: 'cli', name: 'My App', capabilities: ['filesystem'] },
20
71
  storage: { type: 'memory' },
21
72
  transport: { type: 'stdio' },
22
- sovereignty: { hostId: 'my-host', hostName: 'My App' },
73
+ sovereignty: { hostId: 'my-app', hostName: 'My App' },
23
74
  });
24
75
 
25
76
  await kit.start();
77
+ // 31 MCP tools ready
26
78
  ```
27
79
 
28
- ## Tools (27)
29
-
30
- ### Cognitive
31
- - `cognitive_reason` — Deductive, inductive, abductive, counterfactual logic
32
- - `cognitive_research` — Multi-perspective analysis (architect, guardian, executor, strategic)
33
- - `cognitive_plan` — 8-phase ARM planning pipeline
34
- - `cognitive_create` — Divergent, convergent, analogical, random ideation
35
- - `cognitive_reflect` — Meta-reflection, intent drift detection, reconciliation
36
-
37
- ### Security & Ethics
38
- - `security_gate` — Zero-trust payload evaluation (SQLi, XSS, path traversal, secrets)
39
- - `ethics_audit` — Utilitarian, deontological, virtue ethics scoring
40
- - `integrity_ledger` — Immutable audit trail with cryptographic seals
41
- - `threat_mapper` — STRIDE-based threat modeling
42
- - `red_team` — Adversarial simulation across attack vectors
43
- - `blast_radius` — Failure propagation and impact analysis
44
-
45
- ### Knowledge & Memory
46
- - `memory_vam` — Associative memory with store/recall/search/associate
47
- - `knowledge_evolve` — Knowledge graph gap analysis and evolution paths
48
- - `context_synth` — Multi-source context fusion and conflict resolution
49
-
50
- ### Analysis
51
- - `code_archaeologist` — Structural patterns, complexity, anti-patterns, dependencies
52
- - `sentiment_adapter` — Multi-dimensional sentiment, tone, emotion analysis
53
- - `consensus_engine` — 5 models: unanimous, majority, supermajority, weighted, lazy
54
- - `execution_flow` — Process decomposition, critical path, bottleneck detection
55
-
56
- ### Agency
57
- - `swarm_orchestrator` — Multi-agent swarm with role assignment
58
- - `meta_orchestrator` — Recursive orchestration at configurable depth
59
- - `subagent_protocol` — Hierarchical delegation with sovereignty propagation
60
- - `agency_execute` — Adaptive pipeline (auto-selects phases + agents from objectives)
61
-
62
- ### Guardian
63
- - `guardian_status` — System metrics, firewall stats, sovereignty operations
64
- - `guardian_freeze` — Emergency stop (requires sovereignty ≥0.9)
65
- - `guardian_unfreeze` — Resume operations
66
-
67
- ### Forge
68
- - `skill_forge` — Auto-generate skills from detected usage patterns
69
- - `skill_list_forged` — List all forged skills
80
+ ---
70
81
 
71
- ## Architecture
82
+ ## MCP Integration Guides
72
83
 
84
+ ### VS Code
85
+
86
+ Add to your `.vscode/mcp.json`:
87
+
88
+ ```json
89
+ {
90
+ "servers": {
91
+ "cognitive-kit": {
92
+ "type": "stdio",
93
+ "command": "npx",
94
+ "args": ["cognitive-kit"],
95
+ "env": {
96
+ "KIT_HOST_ID": "vscode-${workspaceFolderBasename}",
97
+ "KIT_HOST_NAME": "${workspaceFolderBasename}",
98
+ "KIT_SOVEREIGN_KEY": ""
99
+ }
100
+ }
101
+ }
102
+ }
73
103
  ```
74
- CognitiveKit
75
- / | | \
76
- MCP Server Guardian Agency Forge
77
- | Gate Orch. Registry
78
- ToolRegistry | | |
79
- (27 tools) Sovereignty Adaptive Pattern
80
- +Firewall Pipeline Detector
81
- +State +8 Agents +Forger
82
- Guardian
104
+
105
+ ### Cursor
106
+
107
+ Settings → MCP → Add Server:
108
+
109
+ ```
110
+ Name: cognitive-kit
111
+ Type: command
112
+ Command: npx cognitive-kit
113
+ Environment variables:
114
+ KIT_HOST_ID=cursor
115
+ KIT_HOST_NAME=my-project
83
116
  ```
84
117
 
85
- ## Host Adapters
118
+ ### Claude Desktop
119
+
120
+ Edit `claude_desktop_config.json`:
121
+
122
+ ```json
123
+ {
124
+ "mcpServers": {
125
+ "cognitive-kit": {
126
+ "command": "npx",
127
+ "args": ["cognitive-kit"],
128
+ "env": {
129
+ "KIT_HOST_ID": "claude-desktop",
130
+ "KIT_HOST_NAME": "Claude Desktop"
131
+ }
132
+ }
133
+ }
134
+ }
135
+ ```
86
136
 
87
- - **CLI** (default): stdio MCP server
88
- - **VS Code**: read files, get editor selection, execute commands
89
- - **Generic**: bring your own `HostAdapter`
137
+ ### Node.js (Direct Embedding)
90
138
 
91
139
  ```typescript
140
+ import { CognitiveKit, FileSystemAdapter } from 'cognitive-kit';
141
+
92
142
  const kit = new CognitiveKit({
93
- host: new MyCustomAdapter(),
94
- transport: { type: 'sse', port: 3100 },
143
+ host: new FileSystemAdapter('./workspace', { allowWrite: true }),
144
+ storage: { type: 'sqlite', path: './.kit.db' },
145
+ transport: { type: 'direct' },
146
+ });
147
+
148
+ await kit.initialize();
149
+
150
+ // Call tools directly
151
+ const result = await kit['toolRegistry'].execute('cognitive_reason', {
152
+ problem: 'Analyze this code for potential issues',
153
+ mode: 'logical',
154
+ }, {
155
+ identity: { actorId: 'user', actorType: 'user', sovereignty: 0.9, permissions: ['execute'] },
156
+ host: { type: 'cli', name: 'test', capabilities: [] },
157
+ memory: kit['memory'],
95
158
  });
96
159
  ```
97
160
 
161
+ ---
162
+
98
163
  ## Configuration
99
164
 
165
+ ### KitConfig
166
+
100
167
  ```typescript
101
168
  interface KitConfig {
102
169
  host: HostAdapter | HostProfile;
@@ -107,4 +174,170 @@ interface KitConfig {
107
174
  }
108
175
  ```
109
176
 
110
- Environment variables: `KIT_HOST_ID`, `KIT_HOST_NAME`, `KIT_SOVEREIGN_KEY`.
177
+ ### Environment Variables
178
+
179
+ | Variable | Default | Description |
180
+ |----------|---------|-------------|
181
+ | `KIT_HOST_ID` | `cli-host` | Unique identifier for this kit instance |
182
+ | `KIT_HOST_NAME` | `Cognitive Kit CLI` | Human-readable host name |
183
+ | `KIT_SOVEREIGN_KEY` | - | Key for host-level sovereignty verification |
184
+ | `KIT_STORAGE_PATH` | `./.cognitive-kit.db` | SQLite database path |
185
+ | `KIT_TRANSPORT` | `stdio` | Transport type: `stdio` or `sse` |
186
+ | `KIT_FEDERATION_PORT` | `4200` | Port for federation SSE server |
187
+ | `KIT_FEDERATION_PEERS` | - | Comma-separated peer URLs |
188
+ | `KIT_FS_ROOT` | `cwd` | Filesystem adapter root path |
189
+ | `KIT_FS_ALLOW_WRITE` | `false` | Enable file write operations |
190
+ | `KIT_PG_CONNECTION` | - | PostgreSQL connection string |
191
+
192
+ ---
193
+
194
+ ## Host Adapters
195
+
196
+ | Adapter | Description | Tools |
197
+ |---------|-------------|-------|
198
+ | **FileSystemAdapter** | Read/write/list files in a root directory | `fs_read`, `fs_write`, `fs_list`, `fs_stat` |
199
+ | **PostgresAdapter** | Query databases, inspect schemas | `pg_query`, `pg_schema`, `pg_list_tables`, `pg_describe` |
200
+ | **VSCodeAdapter** | VS Code editor integration | `vscode_read_file`, `vscode_get_selection`, `vscode_workspace_info` |
201
+ | **Generic** | Minimal adapter for any host type | (no host-specific tools) |
202
+
203
+ ```typescript
204
+ // Filesystem
205
+ const kit = new CognitiveKit({
206
+ host: new FileSystemAdapter('./data', { allowWrite: true }),
207
+ });
208
+
209
+ // PostgreSQL
210
+ const kit = new CognitiveKit({
211
+ host: new PostgresAdapter({ connectionString: 'postgres://...' }),
212
+ });
213
+ ```
214
+
215
+ ---
216
+
217
+ ## Agency System
218
+
219
+ The adaptive pipeline automatically selects phases and agents based on the objective.
220
+
221
+ ```typescript
222
+ const mission = await kit.executeAgency(
223
+ 'Design and implement a secure authentication service',
224
+ { mode: 'adaptive' }
225
+ );
226
+
227
+ console.log(mission.status); // 'completed'
228
+ console.log(mission.phases); // ['create', 'architect', 'security']
229
+ console.log(mission.agents); // [{ name: 'Guardian', role: '...' }, ...]
230
+ console.log(mission.synergyScore); // 0.85
231
+ ```
232
+
233
+ ### Phases
234
+
235
+ delimit → collect → extract → infer → critical → synergy → architect → validate → research → reason → plan → create → reflect → security → ethics → consensus → execute
236
+
237
+ ### Agents
238
+
239
+ Architect, Guardian, Executor, Strategist, Analyst, Innovator, Validator, Coordinator
240
+
241
+ ### Modes
242
+
243
+ `sequential` | `parallel` | `hybrid` | `adaptive`
244
+
245
+ ---
246
+
247
+ ## Guardian Gate
248
+
249
+ Every tool call passes through the Guardian Gate for security validation.
250
+
251
+ ```
252
+ Caller → Sovereignty Check → Firewall (8 rules) → State Check → Tool Execution → Audit
253
+ ```
254
+
255
+ ```typescript
256
+ // Check system status
257
+ const metrics = kit.guardian.stateGuardian.getMetrics();
258
+ console.log(metrics.totalToolCalls); // 142
259
+ console.log(metrics.errorRate); // 0.02
260
+
261
+ // Freeze in emergency (requires sovereignty ≥ 0.9)
262
+ await kit.guardian.stateGuardian.freeze('Security breach detected');
263
+
264
+ // Unfreeze
265
+ kit.guardian.stateGuardian.unfreeze();
266
+ ```
267
+
268
+ ### Firewall Rules
269
+
270
+ | ID | Pattern | Severity |
271
+ |----|---------|----------|
272
+ | FW-001 | System command injection | `block` |
273
+ | FW-002 | Filesystem escape | `block` |
274
+ | FW-003 | API key/secret leak | `block` |
275
+ | FW-004 | Mass data access | `flag` |
276
+ | FW-005 | Privilege escalation | `block` |
277
+ | FW-008 | Arbitrary code execution | `block` |
278
+
279
+ ---
280
+
281
+ ## Skill Forging
282
+
283
+ The kit detects usage patterns and auto-generates new skills.
284
+
285
+ ```typescript
286
+ // Manual forge
287
+ const newSkills = kit.forge.forgeFromPatterns(true);
288
+ for (const s of newSkills) {
289
+ console.log(`${s.name}: ${s.toolsRequired.join(', ')}`);
290
+ }
291
+
292
+ // Auto-forge runs every 120 seconds when patterns reach threshold
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Federation
298
+
299
+ Connect multiple kit instances together.
300
+
301
+ ```typescript
302
+ // Kit A starts federation server
303
+ const kitA = new CognitiveKit({ transport: { type: 'sse', port: 3100 } });
304
+
305
+ // Kit B connects to Kit A
306
+ const kitB = new CognitiveKit({ transport: { type: 'stdio' } });
307
+ await kitB.federationManager.connectTo('http://localhost:3100');
308
+
309
+ // Execute tools remotely
310
+ const result = await kitB.federationManager.executeOnPeer(
311
+ 'http://localhost:3100',
312
+ 'cognitive_reason',
313
+ { problem: 'Analyze distributed system', mode: 'logical' }
314
+ );
315
+ ```
316
+
317
+ ---
318
+
319
+ ## Examples
320
+
321
+ See full examples in the repository:
322
+
323
+ - [Basic MCP Server](docs/examples/mcp-server.md)
324
+ - [Library Embedding](docs/examples/library-embed.md)
325
+ - [PostgreSQL Knowledge Explorer](docs/examples/pg-explorer.md)
326
+ - [Federation Multi-Kit](docs/examples/federation.md)
327
+ - [Custom Host Adapter](docs/examples/custom-adapter.md)
328
+
329
+ ---
330
+
331
+ ## Development
332
+
333
+ ```bash
334
+ git clone https://github.com/GaboBase/TODO-Cognitive.git
335
+ cd packages/cognitive-kit
336
+ npm install
337
+ npm run build
338
+ npm test
339
+ ```
340
+
341
+ ## License
342
+
343
+ MIT © GaboBase
package/dist/cli.d.ts CHANGED
@@ -1 +1,2 @@
1
+ #!/usr/bin/env node
1
2
  export {};
package/dist/cli.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  import { CognitiveKit } from './Kit.js';
2
3
  const kit = new CognitiveKit({
3
4
  host: {
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,GAAG,GAAG,IAAI,YAAY,CAAC;IAC3B,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,mBAAmB;QACtD,YAAY,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC;KACzC;IACD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,qBAAqB,EAAE;IACxF,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE;IAC1E,WAAW,EAAE;QACX,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,UAAU;QAC7C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,mBAAmB;QAC1D,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;KACvC;CACF,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;IAC9B,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IAC/B,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,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C,aAAa,IAAI,mBAAmB;QAC1D,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;KACvC;CACF,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;IAC9B,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IAC/B,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;IAC7B,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC;IACH,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;AACpB,CAAC;AAAC,OAAO,GAAG,EAAE,CAAC;IACb,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC5F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { HostAdapter } from '../HostAdapter.js';
2
+ import type { HostProfile, ToolDefinition, HostCapability } from '../../types.js';
3
+ export declare class FileSystemAdapter implements HostAdapter {
4
+ private rootPath;
5
+ private allowWrite;
6
+ private allowDelete;
7
+ constructor(rootPath?: string, options?: {
8
+ allowWrite?: boolean;
9
+ allowDelete?: boolean;
10
+ });
11
+ get profile(): HostProfile;
12
+ initialize(): Promise<void>;
13
+ shutdown(): Promise<void>;
14
+ getHostTools(): ToolDefinition[];
15
+ getCapabilities(): HostCapability[];
16
+ private resolvePath;
17
+ private createReadTool;
18
+ private createWriteTool;
19
+ private createListTool;
20
+ private createStatTool;
21
+ private createDeleteTool;
22
+ }
@@ -0,0 +1,203 @@
1
+ import { access, readFile, writeFile, readdir, mkdir, unlink, stat } from 'node:fs/promises';
2
+ import { resolve, extname, dirname } from 'node:path';
3
+ export class FileSystemAdapter {
4
+ rootPath;
5
+ allowWrite;
6
+ allowDelete;
7
+ constructor(rootPath, options) {
8
+ this.rootPath = rootPath ?? process.env.KIT_FS_ROOT ?? process.cwd();
9
+ this.allowWrite = options?.allowWrite ?? (process.env.KIT_FS_ALLOW_WRITE === 'true');
10
+ this.allowDelete = options?.allowDelete ?? (process.env.KIT_FS_ALLOW_DELETE === 'true');
11
+ }
12
+ get profile() {
13
+ return {
14
+ type: 'cli',
15
+ name: 'FileSystem Adapter',
16
+ version: '1.0.0',
17
+ capabilities: this.getCapabilities(),
18
+ metadata: {
19
+ rootPath: this.rootPath,
20
+ allowWrite: String(this.allowWrite),
21
+ allowDelete: String(this.allowDelete),
22
+ },
23
+ };
24
+ }
25
+ async initialize() {
26
+ try {
27
+ await access(this.rootPath);
28
+ console.error(`[fs-adapter] Root: ${this.rootPath} (write: ${this.allowWrite}, delete: ${this.allowDelete})`);
29
+ }
30
+ catch {
31
+ console.error(`[fs-adapter] Warning: root path does not exist: ${this.rootPath}`);
32
+ }
33
+ }
34
+ async shutdown() { }
35
+ getHostTools() {
36
+ return [
37
+ this.createReadTool(),
38
+ this.createListTool(),
39
+ this.createStatTool(),
40
+ ...(this.allowWrite ? [this.createWriteTool()] : []),
41
+ ...(this.allowDelete ? [this.createDeleteTool()] : []),
42
+ ];
43
+ }
44
+ getCapabilities() {
45
+ const caps = ['filesystem'];
46
+ if (this.allowWrite)
47
+ caps.push('filesystem');
48
+ return caps;
49
+ }
50
+ resolvePath(userPath) {
51
+ const sanitized = userPath.replace(/\.\.(\/|\\)/g, '');
52
+ return resolve(this.rootPath, sanitized);
53
+ }
54
+ createReadTool() {
55
+ return {
56
+ id: 'fs_read',
57
+ name: 'Read File',
58
+ description: 'Read the contents of a file. Returns text content and metadata.',
59
+ inputSchema: { path: { type: 'string', description: 'File path relative to workspace root' } },
60
+ category: 'host',
61
+ handler: async (params, _ctx) => {
62
+ const userPath = String(params.path || '');
63
+ if (!userPath)
64
+ return { success: false, data: null, error: 'path is required' };
65
+ try {
66
+ const fullPath = this.resolvePath(userPath);
67
+ const content = await readFile(fullPath, 'utf-8');
68
+ const meta = await stat(fullPath);
69
+ return {
70
+ success: true,
71
+ data: {
72
+ path: userPath,
73
+ fullPath,
74
+ content,
75
+ size: content.length,
76
+ lines: content.split('\n').length,
77
+ ext: extname(fullPath),
78
+ modifiedAt: meta.mtime.toISOString(),
79
+ },
80
+ };
81
+ }
82
+ catch (err) {
83
+ return { success: false, data: null, error: `Cannot read: ${err instanceof Error ? err.message : String(err)}` };
84
+ }
85
+ },
86
+ };
87
+ }
88
+ createWriteTool() {
89
+ return {
90
+ id: 'fs_write',
91
+ name: 'Write File',
92
+ description: 'Write content to a file. Creates directories if needed.',
93
+ inputSchema: {
94
+ path: { type: 'string', description: 'File path relative to workspace root' },
95
+ content: { type: 'string', description: 'Content to write' },
96
+ },
97
+ sovereignty: 0.6,
98
+ category: 'host',
99
+ handler: async (params, _ctx) => {
100
+ const userPath = String(params.path || '');
101
+ const content = String(params.content || '');
102
+ if (!userPath)
103
+ return { success: false, data: null, error: 'path is required' };
104
+ try {
105
+ const fullPath = this.resolvePath(userPath);
106
+ await mkdir(dirname(fullPath), { recursive: true });
107
+ await writeFile(fullPath, content, 'utf-8');
108
+ return { success: true, data: { path: userPath, bytesWritten: Buffer.byteLength(content, 'utf-8') } };
109
+ }
110
+ catch (err) {
111
+ return { success: false, data: null, error: `Cannot write: ${err instanceof Error ? err.message : String(err)}` };
112
+ }
113
+ },
114
+ };
115
+ }
116
+ createListTool() {
117
+ return {
118
+ id: 'fs_list',
119
+ name: 'List Directory',
120
+ description: 'List files and directories at a path. Shows names, types, and sizes.',
121
+ inputSchema: { path: { type: 'string', description: 'Directory path (default: root)' } },
122
+ category: 'host',
123
+ handler: async (params, _ctx) => {
124
+ const userPath = String(params.path || '');
125
+ const target = userPath ? this.resolvePath(userPath) : this.rootPath;
126
+ try {
127
+ const entries = await readdir(target, { withFileTypes: true });
128
+ const items = await Promise.all(entries.map(async (entry) => {
129
+ const fullPath = resolve(target, entry.name);
130
+ try {
131
+ const s = await stat(fullPath);
132
+ return { name: entry.name, type: entry.isDirectory() ? 'dir' : 'file', size: s.size, modifiedAt: s.mtime.toISOString() };
133
+ }
134
+ catch {
135
+ return { name: entry.name, type: entry.isDirectory() ? 'dir' : 'file', size: 0, modifiedAt: null };
136
+ }
137
+ }));
138
+ return {
139
+ success: true,
140
+ data: { path: userPath || '.', fullPath: target, items, total: items.length },
141
+ };
142
+ }
143
+ catch (err) {
144
+ return { success: false, data: null, error: `Cannot list: ${err instanceof Error ? err.message : String(err)}` };
145
+ }
146
+ },
147
+ };
148
+ }
149
+ createStatTool() {
150
+ return {
151
+ id: 'fs_stat',
152
+ name: 'File Stats',
153
+ description: 'Get detailed information about a file or directory.',
154
+ inputSchema: { path: { type: 'string', description: 'File or directory path' } },
155
+ category: 'host',
156
+ handler: async (params, _ctx) => {
157
+ const userPath = String(params.path || '');
158
+ if (!userPath)
159
+ return { success: false, data: null, error: 'path is required' };
160
+ try {
161
+ const fullPath = this.resolvePath(userPath);
162
+ const s = await stat(fullPath);
163
+ return {
164
+ success: true,
165
+ data: {
166
+ path: userPath, fullPath, size: s.size,
167
+ isDirectory: s.isDirectory(), isFile: s.isFile(),
168
+ created: s.birthtime.toISOString(), modified: s.mtime.toISOString(),
169
+ permissions: s.mode.toString(8).slice(-3),
170
+ },
171
+ };
172
+ }
173
+ catch (err) {
174
+ return { success: false, data: null, error: `Cannot stat: ${err instanceof Error ? err.message : String(err)}` };
175
+ }
176
+ },
177
+ };
178
+ }
179
+ createDeleteTool() {
180
+ return {
181
+ id: 'fs_delete',
182
+ name: 'Delete File',
183
+ description: 'Permanently delete a file. Use with caution.',
184
+ inputSchema: { path: { type: 'string', description: 'File path to delete' } },
185
+ sovereignty: 0.8,
186
+ category: 'host',
187
+ handler: async (params, _ctx) => {
188
+ const userPath = String(params.path || '');
189
+ if (!userPath)
190
+ return { success: false, data: null, error: 'path is required' };
191
+ try {
192
+ const fullPath = this.resolvePath(userPath);
193
+ await unlink(fullPath);
194
+ return { success: true, data: { path: userPath, deleted: true } };
195
+ }
196
+ catch (err) {
197
+ return { success: false, data: null, error: `Cannot delete: ${err instanceof Error ? err.message : String(err)}` };
198
+ }
199
+ },
200
+ };
201
+ }
202
+ }
203
+ //# sourceMappingURL=FileSystemAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSystemAdapter.js","sourceRoot":"","sources":["../../../src/host/adapters/FileSystemAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAsB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1E,MAAM,OAAO,iBAAiB;IACpB,QAAQ,CAAS;IACjB,UAAU,CAAU;IACpB,WAAW,CAAU;IAE7B,YAAY,QAAiB,EAAE,OAAyD;QACtF,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACrE,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,KAAK,MAAM,CAAC,CAAC;QACrF,IAAI,CA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