@pylabmit/agent-cmdb 1.5.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/LICENSE +21 -0
- package/README.md +249 -0
- package/dist/agent-preflight.d.ts +6 -0
- package/dist/agent-preflight.d.ts.map +1 -0
- package/dist/agent-preflight.js +55 -0
- package/dist/agent-preflight.js.map +1 -0
- package/dist/brain.d.ts +12 -0
- package/dist/brain.d.ts.map +1 -0
- package/dist/brain.js +372 -0
- package/dist/brain.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +495 -0
- package/dist/cli.js.map +1 -0
- package/dist/digest.d.ts +14 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +122 -0
- package/dist/digest.js.map +1 -0
- package/dist/doctor.d.ts +9 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +170 -0
- package/dist/doctor.js.map +1 -0
- package/dist/duration.d.ts +2 -0
- package/dist/duration.d.ts.map +1 -0
- package/dist/duration.js +15 -0
- package/dist/duration.js.map +1 -0
- package/dist/engine.d.ts +12 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +12 -0
- package/dist/engine.js.map +1 -0
- package/dist/freshness.d.ts +3 -0
- package/dist/freshness.d.ts.map +1 -0
- package/dist/freshness.js +19 -0
- package/dist/freshness.js.map +1 -0
- package/dist/graph-engine.d.ts +4 -0
- package/dist/graph-engine.d.ts.map +1 -0
- package/dist/graph-engine.js +36 -0
- package/dist/graph-engine.js.map +1 -0
- package/dist/interface.d.ts +34 -0
- package/dist/interface.d.ts.map +1 -0
- package/dist/interface.js +91 -0
- package/dist/interface.js.map +1 -0
- package/dist/loader.d.ts +9 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +199 -0
- package/dist/loader.js.map +1 -0
- package/dist/policy-engine.d.ts +7 -0
- package/dist/policy-engine.d.ts.map +1 -0
- package/dist/policy-engine.js +143 -0
- package/dist/policy-engine.js.map +1 -0
- package/dist/preflight-action.d.ts +3 -0
- package/dist/preflight-action.d.ts.map +1 -0
- package/dist/preflight-action.js +101 -0
- package/dist/preflight-action.js.map +1 -0
- package/dist/preflight.d.ts +4 -0
- package/dist/preflight.d.ts.map +1 -0
- package/dist/preflight.js +36 -0
- package/dist/preflight.js.map +1 -0
- package/dist/route-resolver.d.ts +6 -0
- package/dist/route-resolver.d.ts.map +1 -0
- package/dist/route-resolver.js +130 -0
- package/dist/route-resolver.js.map +1 -0
- package/dist/store.d.ts +15 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +230 -0
- package/dist/store.js.map +1 -0
- package/dist/types.d.ts +277 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/validator.d.ts +6 -0
- package/dist/validator.d.ts.map +1 -0
- package/dist/validator.js +165 -0
- package/dist/validator.js.map +1 -0
- package/examples/basic/control-plane.yaml +122 -0
- package/examples/multi-agent/control-plane.yaml +352 -0
- package/package.json +79 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PYLABMIT
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# Agent CMDB
|
|
2
|
+
|
|
3
|
+
[](https://github.com/vikas53953/agent-cmdb-policy-brain/actions/workflows/ci.yml)
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
Policy enforcement and memory for AI agents.
|
|
7
|
+
|
|
8
|
+
Agent CMDB gives your agent a preflight check before it acts: policy enforcement, source routing, inventory, graph relationships, and audit trails.
|
|
9
|
+
|
|
10
|
+
Use it when you need to answer:
|
|
11
|
+
|
|
12
|
+
- Is this agent allowed to do this action?
|
|
13
|
+
- Which source/tool should it use first?
|
|
14
|
+
- What rule blocked it, and why?
|
|
15
|
+
- What evidence and config changes were recorded?
|
|
16
|
+
- Is my agent control plane healthy enough to run?
|
|
17
|
+
|
|
18
|
+
## How It Works
|
|
19
|
+
|
|
20
|
+
Agent CMDB is a library your agent calls before acting. You wire `preflight()` into your agent's tool-call path. It evaluates policy, routes to the best source, and logs the decision. It does not automatically intercept tool calls - you integrate it into your agent framework.
|
|
21
|
+
|
|
22
|
+
## What This Is NOT
|
|
23
|
+
|
|
24
|
+
Agent CMDB is not a network proxy or middleware that sits between your agent and its tools. It is a policy evaluation library. For automatic tool-call interception, see Agent Airlock or `airlock-dev/airlock`.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install @pylabmit/agent-cmdb
|
|
30
|
+
npx agent-cmdb init
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`init` creates:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
agent-cmdb/
|
|
37
|
+
config/
|
|
38
|
+
control-plane.yaml
|
|
39
|
+
state/
|
|
40
|
+
evidence.jsonl
|
|
41
|
+
changes.jsonl
|
|
42
|
+
brain/
|
|
43
|
+
entities/
|
|
44
|
+
people/
|
|
45
|
+
companies/
|
|
46
|
+
topics/
|
|
47
|
+
tools/
|
|
48
|
+
projects/
|
|
49
|
+
decisions/
|
|
50
|
+
digest/
|
|
51
|
+
daily/
|
|
52
|
+
weekly/
|
|
53
|
+
index.json
|
|
54
|
+
agent-cmdb.config.ts
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Quick Start
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { createAgentCmdb } from '@pylabmit/agent-cmdb';
|
|
61
|
+
|
|
62
|
+
const cmdb = createAgentCmdb({
|
|
63
|
+
configPath: './agent-cmdb/config/control-plane.yaml',
|
|
64
|
+
storeDir: './agent-cmdb/state'
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const result = cmdb.preflight({
|
|
68
|
+
profile: 'research-agent',
|
|
69
|
+
action: 'web_search',
|
|
70
|
+
tool: 'serpapi',
|
|
71
|
+
intent: 'web_research'
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
if (!result.allowed) {
|
|
75
|
+
console.log(`Blocked: ${result.decision.reason}`);
|
|
76
|
+
console.log(`Can escalate: ${result.decision.canEscalate}`);
|
|
77
|
+
console.log(`Try instead: ${result.decision.suggestedAlternative}`);
|
|
78
|
+
} else {
|
|
79
|
+
for (const source of result.route?.sources ?? []) {
|
|
80
|
+
console.log(`Use ${source.id} (${source.kind})`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Agent Memory (Brain)
|
|
86
|
+
|
|
87
|
+
Agent CMDB includes an optional local knowledge base. No database, no embeddings - just markdown files that agents read before acting and update after.
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const cmdb = createAgentCmdb({
|
|
91
|
+
configPath: './agent-cmdb/config/control-plane.yaml',
|
|
92
|
+
storeDir: './agent-cmdb/state',
|
|
93
|
+
brainDir: './agent-cmdb/brain'
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const knowledge = await cmdb.readEntity('agent-security');
|
|
97
|
+
console.log(knowledge.content);
|
|
98
|
+
console.log(knowledge.stale ? 'Needs refresh' : 'Fresh');
|
|
99
|
+
|
|
100
|
+
await cmdb.writeEntity({
|
|
101
|
+
entityId: 'agent-security',
|
|
102
|
+
content: '## New findings\n\n3 CVEs discovered...',
|
|
103
|
+
actor: 'research-agent',
|
|
104
|
+
reason: 'Daily security scan',
|
|
105
|
+
appendOnly: true
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
await cmdb.generateDailyDigest('research-agent');
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Control Plane
|
|
112
|
+
|
|
113
|
+
Agent CMDB reads YAML or JSON.
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
version: "1.0"
|
|
117
|
+
updatedAt: "2026-05-25"
|
|
118
|
+
|
|
119
|
+
sources:
|
|
120
|
+
- id: serpapi
|
|
121
|
+
label: SerpAPI Web Search
|
|
122
|
+
kind: tool
|
|
123
|
+
readOnly: true
|
|
124
|
+
|
|
125
|
+
- id: local-docs
|
|
126
|
+
label: Local Documentation
|
|
127
|
+
kind: wiki
|
|
128
|
+
readOnly: true
|
|
129
|
+
freshnessTtl: 7d
|
|
130
|
+
brainEntityId: agent-security
|
|
131
|
+
|
|
132
|
+
profiles:
|
|
133
|
+
- id: research-agent
|
|
134
|
+
name: Research Agent
|
|
135
|
+
purpose: Web research and summarization
|
|
136
|
+
guardrails:
|
|
137
|
+
- Do not make purchases or financial transactions
|
|
138
|
+
- Do not post to social media
|
|
139
|
+
- Prefer local documentation before external search
|
|
140
|
+
routes:
|
|
141
|
+
- intent: web_research
|
|
142
|
+
sources: [local-docs, serpapi]
|
|
143
|
+
|
|
144
|
+
policies:
|
|
145
|
+
- id: deny-social-posting
|
|
146
|
+
effect: deny
|
|
147
|
+
actions: [social_post, social_reply, social_dm]
|
|
148
|
+
reason: Social media posting is disabled for all agents
|
|
149
|
+
|
|
150
|
+
- id: allow-research
|
|
151
|
+
effect: allow
|
|
152
|
+
profiles: [research-agent]
|
|
153
|
+
actions: [web_search, summarize, extract]
|
|
154
|
+
tools: [serpapi, local-docs]
|
|
155
|
+
reason: Research agent can search and summarize read-only sources
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Shipped examples:
|
|
159
|
+
|
|
160
|
+
- [examples/basic/control-plane.yaml](examples/basic/control-plane.yaml): one profile, a few sources, simple allow/deny rules.
|
|
161
|
+
- [examples/multi-agent/control-plane.yaml](examples/multi-agent/control-plane.yaml): three profiles with different permissions.
|
|
162
|
+
|
|
163
|
+
Framework integrations are planned for V2. They are intentionally not shown as shipped examples until they import and wrap real framework APIs.
|
|
164
|
+
|
|
165
|
+
## Roadmap
|
|
166
|
+
|
|
167
|
+
The product roadmap lives in [docs/agent-cmdb-roadmap.md](docs/agent-cmdb-roadmap.md). It maps production agent problems to release tiers from reliability hardening through central management and dashboard workflows.
|
|
168
|
+
|
|
169
|
+
| Release | Status | Scope |
|
|
170
|
+
| --- | --- | --- |
|
|
171
|
+
| V1.0 | Shipped | Policy engine, source routing, CMDB inventory, evidence store, graph, brain, digest |
|
|
172
|
+
| V1.5 | Shipped | npm packaging, dry-run, source freshness, doctor command |
|
|
173
|
+
| V2.0 | Planned | Health monitors, circuit breakers, SLOs, cost tracking, checkpoint/resume |
|
|
174
|
+
| V3.0 | Planned | Isolation, rate limiting, DLP inspection, trust scoring, schedules, webhooks |
|
|
175
|
+
| V4.0 | Planned | REST/MCP API, dashboard, policy versioning, templates, incident response |
|
|
176
|
+
|
|
177
|
+
## CLI
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npx agent-cmdb init
|
|
181
|
+
npx agent-cmdb doctor
|
|
182
|
+
npx agent-cmdb preflight --profile research-agent --action web_search --tool serpapi --intent web_research
|
|
183
|
+
npx agent-cmdb preflight --profile research-agent --action web_search --tool serpapi --intent web_research --dry-run
|
|
184
|
+
npx agent-cmdb policy --profile research-agent --action social_post --tool x
|
|
185
|
+
npx agent-cmdb route --profile research-agent --intent web_research
|
|
186
|
+
npx agent-cmdb brain list --brain-dir ./agent-cmdb/brain
|
|
187
|
+
npx agent-cmdb brain search --brain-dir ./agent-cmdb/brain --keyword security
|
|
188
|
+
npx agent-cmdb digest --profile research-agent --brain-dir ./agent-cmdb/brain
|
|
189
|
+
npx agent-cmdb report
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Use a specific config file:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
npx agent-cmdb preflight --config ./examples/multi-agent/control-plane.yaml --profile research-agent --action social_post --tool social-media-tool --intent web_research
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Mental Model
|
|
199
|
+
|
|
200
|
+
If you know infrastructure operations, you already know Agent CMDB:
|
|
201
|
+
|
|
202
|
+
| Infrastructure concept | Agent CMDB |
|
|
203
|
+
| --- | --- |
|
|
204
|
+
| Firewall policy | Policy engine |
|
|
205
|
+
| Routing table | Source routing |
|
|
206
|
+
| Log management | Evidence timeline |
|
|
207
|
+
| Config backups | Brain entity files |
|
|
208
|
+
| Automated reports | Daily/weekly digests |
|
|
209
|
+
| Operations runbooks | Decision records |
|
|
210
|
+
| Asset inventory | Entity index |
|
|
211
|
+
|
|
212
|
+
`preflight()` is the packet filter before the agent executes.
|
|
213
|
+
|
|
214
|
+
## Framework Modules
|
|
215
|
+
|
|
216
|
+
```text
|
|
217
|
+
src/types.ts
|
|
218
|
+
src/policy-engine.ts
|
|
219
|
+
src/route-resolver.ts
|
|
220
|
+
src/graph-engine.ts
|
|
221
|
+
src/validator.ts
|
|
222
|
+
src/store.ts
|
|
223
|
+
src/brain.ts
|
|
224
|
+
src/digest.ts
|
|
225
|
+
src/interface.ts
|
|
226
|
+
src/loader.ts
|
|
227
|
+
src/preflight.ts
|
|
228
|
+
src/cli.ts
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
`src/engine.ts` remains as a compatibility barrel for older imports.
|
|
232
|
+
|
|
233
|
+
## Design Boundary
|
|
234
|
+
|
|
235
|
+
Agent CMDB combines policy enforcement with local agent memory. The brain is optional - omit `brainDir` if you only need policy evaluation, source routing, and audit trails.
|
|
236
|
+
|
|
237
|
+
## Development
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
npm test
|
|
241
|
+
npm run typecheck
|
|
242
|
+
npm run build
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Current verification target:
|
|
246
|
+
|
|
247
|
+
- 153 tests passing
|
|
248
|
+
- strict TypeScript clean
|
|
249
|
+
- clean `dist/` build
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PreflightResult } from './types.js';
|
|
2
|
+
export declare function runAgentPreflight(action: string, profile: string, tool?: string, intent?: string, options?: {
|
|
3
|
+
configPath?: string;
|
|
4
|
+
dryRun?: boolean;
|
|
5
|
+
}): Promise<PreflightResult>;
|
|
6
|
+
//# sourceMappingURL=agent-preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-preflight.d.ts","sourceRoot":"","sources":["../src/agent-preflight.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACtD,OAAO,CAAC,eAAe,CAAC,CAkD1B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createAgentCmdb } from './interface.js';
|
|
2
|
+
import { multiAgentExampleControlPlanePath } from './loader.js';
|
|
3
|
+
export async function runAgentPreflight(action, profile, tool, intent, options = {}) {
|
|
4
|
+
const normalizedAction = requireNonEmptyString(action, 'Agent preflight action');
|
|
5
|
+
const normalizedProfile = requireNonEmptyString(profile, 'Agent preflight profile');
|
|
6
|
+
const normalizedTool = tool === undefined ? undefined : requireNonEmptyString(tool, 'Agent preflight tool');
|
|
7
|
+
const normalizedIntent = intent === undefined ? undefined : requireNonEmptyString(intent, 'Agent preflight intent');
|
|
8
|
+
const cmdb = createAgentCmdb({
|
|
9
|
+
configPath: options.configPath ?? multiAgentExampleControlPlanePath
|
|
10
|
+
});
|
|
11
|
+
const result = cmdb.preflight({
|
|
12
|
+
action: normalizedAction,
|
|
13
|
+
profile: normalizedProfile,
|
|
14
|
+
tool: normalizedTool,
|
|
15
|
+
intent: normalizedIntent,
|
|
16
|
+
dryRun: options.dryRun
|
|
17
|
+
});
|
|
18
|
+
const now = new Date().toISOString();
|
|
19
|
+
if (result.dryRun) {
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
if (result.decision.effect === 'deny') {
|
|
23
|
+
await cmdb.logEvidence({
|
|
24
|
+
profile: normalizedProfile,
|
|
25
|
+
source: 'agent-cmdb-preflight',
|
|
26
|
+
intent: normalizedIntent ?? normalizedAction,
|
|
27
|
+
summary: `Agent preflight ${result.decision.effect}: ${result.decision.ruleId}. ${result.decision.reason}`,
|
|
28
|
+
trust: 'high',
|
|
29
|
+
capturedAt: now,
|
|
30
|
+
tags: ['agent-preflight', result.decision.effect, result.decision.ruleId]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
await cmdb.logChange({
|
|
34
|
+
target: result.decision.ruleId,
|
|
35
|
+
targetType: 'policy',
|
|
36
|
+
action: 'verify',
|
|
37
|
+
actor: 'agent-preflight',
|
|
38
|
+
reason: `Preflight ${result.decision.effect} for ${normalizedProfile}/${normalizedAction}.`,
|
|
39
|
+
changedAt: now,
|
|
40
|
+
after: {
|
|
41
|
+
allowed: result.allowed,
|
|
42
|
+
approvalRequired: result.approvalRequired,
|
|
43
|
+
routeExecutable: result.routeExecutable,
|
|
44
|
+
decision: result.decision
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
function requireNonEmptyString(value, label) {
|
|
50
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
51
|
+
throw new Error(`${label} must be a non-empty string.`);
|
|
52
|
+
}
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=agent-preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-preflight.js","sourceRoot":"","sources":["../src/agent-preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAGhE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAc,EACd,OAAe,EACf,IAAa,EACb,MAAe,EACf,UAAqD,EAAE;IAEvD,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IACjF,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;IACpF,MAAM,cAAc,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;IAC5G,MAAM,gBAAgB,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IAEpH,MAAM,IAAI,GAAG,eAAe,CAAC;QAC3B,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,iCAAiC;KACpE,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC;QAC5B,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,iBAAiB;QAC1B,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,gBAAgB;QACxB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAErC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QACtC,MAAM,IAAI,CAAC,WAAW,CAAC;YACrB,OAAO,EAAE,iBAAiB;YAC1B,MAAM,EAAE,sBAAsB;YAC9B,MAAM,EAAE,gBAAgB,IAAI,gBAAgB;YAC5C,OAAO,EAAE,mBAAmB,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;YAC1G,KAAK,EAAE,MAAM;YACb,UAAU,EAAE,GAAG;YACf,IAAI,EAAE,CAAC,iBAAiB,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;SAC1E,CAAC,CAAC;IACL,CAAC;IAED,MAAM,IAAI,CAAC,SAAS,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM;QAC9B,UAAU,EAAE,QAAQ;QACpB,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,iBAAiB;QACxB,MAAM,EAAE,aAAa,MAAM,CAAC,QAAQ,CAAC,MAAM,QAAQ,iBAAiB,IAAI,gBAAgB,GAAG;QAC3F,SAAS,EAAE,GAAG;QACd,KAAK,EAAE;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAc,EAAE,KAAa;IAC1D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,8BAA8B,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/brain.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BrainEntity, BrainEntityKind, BrainIndex, BrainReadResult, BrainSearchQuery, BrainWriteInput } from './types.js';
|
|
2
|
+
export declare function initBrainDir(brainDir: string): Promise<void>;
|
|
3
|
+
export declare function readBrainIndex(brainDir: string): Promise<BrainIndex>;
|
|
4
|
+
export declare function writeBrainIndex(brainDir: string, index: BrainIndex): Promise<void>;
|
|
5
|
+
export declare function readEntity(brainDir: string, entityId: string): Promise<BrainReadResult>;
|
|
6
|
+
export declare function createEntity(brainDir: string, storeDir: string, entity: Omit<BrainEntity, 'lastUpdated' | 'lastUpdatedBy'>, content: string, actor: string): Promise<BrainEntity>;
|
|
7
|
+
export declare function writeEntity(brainDir: string, storeDir: string, input: BrainWriteInput): Promise<BrainEntity>;
|
|
8
|
+
export declare function deleteEntity(brainDir: string, storeDir: string, entityId: string, actor: string, reason: string): Promise<void>;
|
|
9
|
+
export declare function searchEntities(brainDir: string, query: BrainSearchQuery): Promise<BrainEntity[]>;
|
|
10
|
+
export declare function listEntities(brainDir: string, kind?: BrainEntityKind): Promise<BrainEntity[]>;
|
|
11
|
+
export declare function entityRelativePath(brainDir: string, absolutePath: string): string;
|
|
12
|
+
//# sourceMappingURL=brain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brain.d.ts","sourceRoot":"","sources":["../src/brain.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,EAEhB,MAAM,YAAY,CAAC;AAiBpB,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBlE;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAc1E;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAOxF;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAkB7F;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,eAAe,CAAC,EAC1D,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,WAAW,CAAC,CA8BtB;AAED,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,WAAW,CAAC,CAyCtB;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAkBtG;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAMnG;AA8MD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAEjF"}
|