audrey 0.20.0 → 0.21.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +170 -115
  3. package/dist/mcp-server/config.d.ts +25 -1
  4. package/dist/mcp-server/config.d.ts.map +1 -1
  5. package/dist/mcp-server/config.js +97 -12
  6. package/dist/mcp-server/config.js.map +1 -1
  7. package/dist/mcp-server/index.d.ts +83 -2
  8. package/dist/mcp-server/index.d.ts.map +1 -1
  9. package/dist/mcp-server/index.js +453 -36
  10. package/dist/mcp-server/index.js.map +1 -1
  11. package/dist/src/audrey.d.ts +4 -0
  12. package/dist/src/audrey.d.ts.map +1 -1
  13. package/dist/src/audrey.js +12 -0
  14. package/dist/src/audrey.js.map +1 -1
  15. package/dist/src/index.d.ts +4 -0
  16. package/dist/src/index.d.ts.map +1 -1
  17. package/dist/src/index.js +2 -0
  18. package/dist/src/index.js.map +1 -1
  19. package/dist/src/preflight.d.ts +51 -0
  20. package/dist/src/preflight.d.ts.map +1 -0
  21. package/dist/src/preflight.js +201 -0
  22. package/dist/src/preflight.js.map +1 -0
  23. package/dist/src/reflexes.d.ts +35 -0
  24. package/dist/src/reflexes.d.ts.map +1 -0
  25. package/dist/src/reflexes.js +87 -0
  26. package/dist/src/reflexes.js.map +1 -0
  27. package/dist/src/routes.d.ts.map +1 -1
  28. package/dist/src/routes.js +84 -7
  29. package/dist/src/routes.js.map +1 -1
  30. package/docs/assets/audrey-feature-grid.jpg +0 -0
  31. package/docs/assets/audrey-logo.svg +45 -0
  32. package/docs/assets/audrey-wordmark.png +0 -0
  33. package/docs/audrey-for-dummies.md +670 -0
  34. package/docs/future-of-llm-memory.md +452 -0
  35. package/docs/mcp-hosts.md +206 -0
  36. package/docs/ollama-local-agents.md +128 -0
  37. package/docs/production-readiness.md +11 -7
  38. package/examples/ollama-memory-agent.js +326 -0
  39. package/package.json +21 -2
package/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## 0.21.0 - Release Diagnostics and Host Setup
4
+
5
+ - Added `npx audrey doctor` for first-contact diagnostics, JSON automation, provider checks, MCP entrypoint validation, memory-store health, and host config generation.
6
+ - Added `npx audrey install --host <host> --dry-run` so Codex, Claude Code, Claude Desktop, Cursor, Windsurf, VS Code, JetBrains, and generic MCP hosts can preview setup without accidental config writes.
7
+ - Updated docs around the recommended first run: `doctor`, `demo`, safe host install preview, then host-specific verification.
8
+ - Kept Claude Code's direct installer intact while making the default release story host-neutral.
9
+ - Refreshed lockfile transitive packages through the npm resolver; vulnerability audit remains clean.
10
+
11
+ ## 0.20.0 - Memory Reflexes
12
+
13
+ - Added Memory Preflight and Memory Reflexes so agents can check memory before acting and turn repeated failures into trigger-response guidance.
14
+ - Added Ollama/local-agent guidance and runnable local-agent example.
15
+ - Expanded host-neutral MCP docs and Audrey for Dummies onboarding.
package/README.md CHANGED
@@ -1,83 +1,141 @@
1
- # Audrey
1
+ <div align="center">
2
+ <img src="docs/assets/audrey-wordmark.png" alt="Audrey wordmark" width="760">
2
3
 
3
- [![CI](https://github.com/Evilander/Audrey/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Evilander/Audrey/actions/workflows/ci.yml)
4
- [![npm version](https://img.shields.io/npm/v/audrey.svg)](https://www.npmjs.com/package/audrey)
5
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
4
+ <p><strong>The local-first memory control plane for AI agents.</strong></p>
6
5
 
7
- Audrey is a persistent memory and continuity engine for Claude Code and AI agents.
6
+ <p>
7
+ Give Codex, Claude Code, Claude Desktop, Cursor, Windsurf, VS Code, JetBrains, Ollama-backed agents,
8
+ and custom agent services one durable memory layer they can check before they act.
9
+ </p>
8
10
 
9
- It gives an agent a local memory store, durable recall, consolidation, contradiction handling, a REST sidecar, MCP tools, and benchmark gates without adding external infrastructure.
11
+ <p>
12
+ <a href="https://github.com/Evilander/Audrey/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/Evilander/Audrey/actions/workflows/ci.yml/badge.svg?branch=master"></a>
13
+ <a href="https://www.npmjs.com/package/audrey"><img alt="npm version" src="https://img.shields.io/npm/v/audrey.svg"></a>
14
+ <a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
15
+ </p>
16
+ </div>
10
17
 
11
- Requires Node.js 20+.
18
+ ## Why Audrey Exists
19
+
20
+ Agents forget the exact mistakes they made yesterday. They repeat broken commands, lose project-specific rules, miss contradictions, and treat every new session like a cold start.
21
+
22
+ Audrey turns those hard-won lessons into a local memory runtime:
23
+
24
+ - `memory_recall` finds durable context by semantic similarity.
25
+ - `memory_preflight` checks prior failures, risks, rules, and relevant procedures before an action.
26
+ - `memory_reflexes` converts remembered evidence into trigger-response guidance agents can follow.
27
+ - `memory_dream` consolidates episodes into principles and applies decay.
28
+ - `audrey doctor` tells a human or CI system whether the runtime is actually ready.
29
+
30
+ It is not a hosted vector database, a notes app, or a Claude-only plugin. Audrey is a SQLite-backed continuity layer that can sit under any local or sidecar agent loop.
31
+
32
+ <div align="center">
33
+ <img src="docs/assets/audrey-feature-grid.jpg" alt="Audrey feature marks: memory continuity, archive signal, recall loop, layered evidence, local node, and remembering before acting" width="760">
34
+ </div>
12
35
 
13
36
  ## Quick Start
14
37
 
15
- ### Claude Code
38
+ Requires Node.js 20+.
16
39
 
17
40
  ```bash
18
- npx audrey init
19
41
  npx audrey doctor
42
+ npx audrey demo
43
+ ```
44
+
45
+ `doctor` verifies Node, the MCP entrypoint, provider selection, memory-store health, and host config generation. `demo` runs a no-key, no-host, no-network proof: it creates temporary memories, records a redacted failed tool trace, generates a Memory Capsule, proves recall, prints Memory Reflexes, and deletes the demo store.
46
+
47
+ Expected first-run shape:
48
+
49
+ ```text
50
+ Audrey Doctor v0.21.0
51
+ Store health: not initialized
52
+ Verdict: ready
20
53
  ```
21
54
 
22
- This uses the default `local-offline` preset:
55
+ After the first real memory write, `doctor` should report the store as healthy.
23
56
 
24
- - registers Audrey with Claude Code
25
- - installs hooks for automatic recall and reflection
26
- - uses local embeddings by default
27
- - stores memory in one local SQLite-backed data directory
57
+ ## Install Into Agent Hosts
28
58
 
29
- ### REST or Docker Sidecar
59
+ Preview host setup without editing config files:
30
60
 
31
61
  ```bash
32
- npx audrey init sidecar-prod
33
- docker compose up -d --build
62
+ npx audrey install --host codex --dry-run
63
+ npx audrey install --host claude-code --dry-run
64
+ npx audrey install --host generic --dry-run
34
65
  ```
35
66
 
36
- Then verify:
67
+ Generate raw config blocks:
37
68
 
38
69
  ```bash
39
- npx audrey doctor
40
- curl http://localhost:3487/health
70
+ npx audrey mcp-config codex
71
+ npx audrey mcp-config generic
72
+ npx audrey mcp-config vscode
41
73
  ```
42
74
 
43
- ## Why Audrey
44
-
45
- - Local-first: memory lives in SQLite with `sqlite-vec`, not a hosted vector database.
46
- - Practical: MCP, CLI, REST, JavaScript, Python, and Docker are all first-class.
47
- - Durable: snapshot, restore, health checks, benchmark gates, and graceful shutdown are built in.
48
- - Structured: Audrey does more than save notes. It consolidates, decays, tracks contradictions, and supports procedural memory.
75
+ Claude Code can be registered directly:
49
76
 
50
- ## What Ships
77
+ ```bash
78
+ npx audrey install
79
+ claude mcp list
80
+ ```
51
81
 
52
- - Claude Code MCP server with 13 memory tools
53
- - Automatic hook-based recall and reflection for Claude Code sessions
54
- - JavaScript SDK
55
- - Python SDK packaged as `audrey-memory`
56
- - REST API for sidecar deployment
57
- - Docker and Compose deployment path
58
- - Snapshot and restore for portable memory state
59
- - Machine-readable health and benchmark gates
60
- - Local benchmark harness with retrieval and lifecycle-operation tracks
82
+ All local MCP paths default to local embeddings and one shared SQLite-backed memory directory. Use `AUDREY_DATA_DIR` to isolate projects, tenants, or host identities.
61
83
 
62
- ## Setup Presets
84
+ ## Use With Ollama And Local Agents
63
85
 
64
- `npx audrey init` supports four named presets:
86
+ Ollama runs models; Audrey supplies memory. Start Audrey as a local REST sidecar and expose its routes as tools in your agent loop:
65
87
 
66
- | Preset | Best For | Behavior |
67
- |---|---|---|
68
- | `local-offline` | Claude Code on one machine | Local embeddings, MCP install, hooks install |
69
- | `hosted-fast` | Claude Code with provider keys already present | Auto-picks hosted providers from env, MCP install, hooks install |
70
- | `ci-mock` | CI and smoke tests | Mock embedding + LLM providers, no Claude-specific setup |
71
- | `sidecar-prod` | REST API and Docker deployment | Sidecar-oriented defaults, no Claude-specific setup |
88
+ ```bash
89
+ AUDREY_AGENT=ollama-local-agent npx audrey serve
90
+ curl http://localhost:7437/health
91
+ curl http://localhost:7437/v1/status
92
+ ```
72
93
 
73
- Useful checks:
94
+ Runnable example:
74
95
 
75
96
  ```bash
76
- npx audrey doctor
77
- npx audrey status
78
- npx audrey status --json --fail-on-unhealthy
97
+ AUDREY_AGENT=ollama-local-agent npx audrey serve
98
+ OLLAMA_MODEL=qwen3 node examples/ollama-memory-agent.js "What should you remember about Audrey?"
79
99
  ```
80
100
 
101
+ Core sidecar tools:
102
+
103
+ | Agent Need | REST Route |
104
+ |---|---|
105
+ | Check memory before acting | `POST /v1/preflight` |
106
+ | Get reflex rules for an action | `POST /v1/reflexes` |
107
+ | Store a useful observation | `POST /v1/encode` |
108
+ | Recall relevant context | `POST /v1/recall` |
109
+ | Get a turn-sized memory packet | `POST /v1/capsule` |
110
+ | Check health | `GET /v1/status` |
111
+
112
+ ## What Ships
113
+
114
+ | Surface | Status |
115
+ |---|---|
116
+ | MCP stdio server | 19 tools, resources, and prompt templates |
117
+ | CLI | `doctor`, `demo`, `install`, `mcp-config`, `status`, `dream`, `reembed`, `observe-tool`, `promote` |
118
+ | REST API | Hono server with `/health`, `/openapi.json`, `/docs`, and `/v1/*` routes |
119
+ | JavaScript SDK | Direct TypeScript/Node import from `audrey` |
120
+ | Python client | `pip install audrey-memory`, calls the REST sidecar |
121
+ | Storage | Local SQLite plus `sqlite-vec`, no hosted database required |
122
+ | Deployment | npm package, Docker, Compose, host-specific MCP config generation |
123
+ | Safety loop | preflight warnings, reflexes, redacted tool traces, contradiction handling |
124
+
125
+ ## Memory Model
126
+
127
+ Audrey is built around the parts of memory that matter for agents:
128
+
129
+ - Episodic memory: specific observations, tool results, preferences, and session facts.
130
+ - Semantic memory: consolidated principles extracted from repeated evidence.
131
+ - Procedural memory: remembered ways to act, avoid, retry, or verify.
132
+ - Affect and salience: emotional weight and importance influence recall.
133
+ - Interference and decay: stale, conflicting, or low-confidence memories lose authority over time.
134
+ - Contradiction handling: competing claims are tracked instead of silently overwritten.
135
+ - Tool-trace learning: failed commands and risky actions become future preflight warnings.
136
+
137
+ The product bet is simple: the next generation of useful agents will not just retrieve facts. They will remember what happened, decide whether a memory is still trustworthy, and use that memory before touching tools.
138
+
81
139
  ## Use Audrey From Code
82
140
 
83
141
  ### JavaScript
@@ -112,50 +170,47 @@ pip install audrey-memory
112
170
  ```python
113
171
  from audrey_memory import Audrey
114
172
 
115
- brain = Audrey(
116
- base_url="http://127.0.0.1:3487",
117
- api_key="secret",
118
- agent="support-agent",
119
- )
120
-
121
- memory_id = brain.encode(
122
- "Stripe returns HTTP 429 above 100 req/s",
123
- source="direct-observation",
124
- )
173
+ brain = Audrey(base_url="http://127.0.0.1:7437", agent="support-agent")
174
+ memory_id = brain.encode("Stripe returns HTTP 429 above 100 req/s", source="direct-observation")
125
175
  results = brain.recall("stripe rate limit", limit=5)
126
176
  brain.close()
127
177
  ```
128
178
 
129
- ## Key Commands
179
+ ## Production Readiness
130
180
 
131
- ```bash
132
- # Setup
133
- npx audrey init
134
- npx audrey init hosted-fast
135
- npx audrey init ci-mock
136
- npx audrey init sidecar-prod
181
+ Audrey is close to a 1.0-ready local memory runtime, but production depends on how it is embedded. Treat it like stateful infrastructure.
137
182
 
138
- # Claude Code integration
139
- npx audrey install
140
- npx audrey hooks install
141
- npx audrey hooks uninstall
142
- npx audrey uninstall
183
+ Release gates used for this package:
143
184
 
144
- # Health and maintenance
185
+ ```bash
186
+ npm run build
187
+ npm run typecheck
188
+ npm run bench:memory:check
189
+ npm pack --dry-run
145
190
  npx audrey doctor
146
- npx audrey status
147
- npx audrey dream
148
- npx audrey reembed
191
+ npx audrey demo
192
+ ```
149
193
 
150
- # Versioning
151
- npx audrey snapshot
152
- npx audrey restore backup.json --force
194
+ Recommended runtime checks:
153
195
 
154
- # Sidecar
155
- npx audrey serve
156
- docker compose up -d --build
196
+ ```bash
197
+ npx audrey doctor --json
198
+ npx audrey status --json --fail-on-unhealthy
199
+ npx audrey install --host codex --dry-run
157
200
  ```
158
201
 
202
+ Production controls you still own:
203
+
204
+ - Set one `AUDREY_DATA_DIR` per tenant, environment, or isolation boundary.
205
+ - Pin `AUDREY_EMBEDDING_PROVIDER` and `AUDREY_LLM_PROVIDER` explicitly.
206
+ - Back up the SQLite data directory before provider or dimension changes.
207
+ - Keep API keys and raw credentials out of encoded memory content.
208
+ - Use `AUDREY_API_KEY` if the REST sidecar is reachable beyond the local process boundary.
209
+ - Run `npx audrey dream` on a schedule so consolidation and decay stay current.
210
+ - Add application-level encryption, retention, access control, and audit logging for regulated environments.
211
+
212
+ Read the full guide: [docs/production-readiness.md](docs/production-readiness.md).
213
+
159
214
  ## Benchmarks
160
215
 
161
216
  Audrey ships with a benchmark harness and release gate:
@@ -165,59 +220,57 @@ npm run bench:memory
165
220
  npm run bench:memory:check
166
221
  ```
167
222
 
168
- The benchmark suite measures:
169
-
170
- - retrieval behavior
171
- - update and overwrite behavior
172
- - delete and abstain behavior
173
- - semantic and procedural merge behavior
174
-
175
223
  Current repo snapshot:
176
224
 
177
225
  ![Audrey local benchmark](docs/assets/benchmarks/local-benchmark.svg)
178
226
 
179
- For detailed methodology, published comparison anchors, and generated reports, see [docs/benchmarking.md](docs/benchmarking.md).
227
+ The benchmark suite covers retrieval behavior, overwrite behavior, delete/abstain behavior, and semantic/procedural merge behavior. For methodology and comparison anchors, see [docs/benchmarking.md](docs/benchmarking.md).
180
228
 
181
- ## Production
229
+ ## Command Reference
182
230
 
183
- Audrey is strongest in workflows where memory must stay local, reviewable, and durable. It already fits well as a sidecar for internal agents in operational domains like financial services and healthcare operations, but it is a memory layer, not a compliance boundary.
184
-
185
- Production guide: [docs/production-readiness.md](docs/production-readiness.md)
186
-
187
- Examples:
188
-
189
- - [examples/fintech-ops-demo.js](examples/fintech-ops-demo.js)
190
- - [examples/healthcare-ops-demo.js](examples/healthcare-ops-demo.js)
191
- - [examples/stripe-demo.js](examples/stripe-demo.js)
192
-
193
- ## Environment
231
+ ```bash
232
+ # First contact
233
+ npx audrey doctor
234
+ npx audrey demo
194
235
 
195
- Starter config:
236
+ # MCP setup
237
+ npx audrey install --host codex --dry-run
238
+ npx audrey mcp-config codex
239
+ npx audrey mcp-config generic
240
+ npx audrey install
241
+ npx audrey uninstall
196
242
 
197
- - [.env.example](.env.example)
198
- - [.env.docker.example](.env.docker.example)
243
+ # Health and maintenance
244
+ npx audrey status
245
+ npx audrey status --json --fail-on-unhealthy
246
+ npx audrey dream
247
+ npx audrey reembed
199
248
 
200
- Key environment variables:
249
+ # Tool-trace learning
250
+ npx audrey observe-tool --event PostToolUse --tool Bash --outcome failed
251
+ npx audrey promote --dry-run
201
252
 
202
- - `AUDREY_DATA_DIR`
203
- - `AUDREY_EMBEDDING_PROVIDER`
204
- - `AUDREY_LLM_PROVIDER`
205
- - `AUDREY_DEVICE`
206
- - `AUDREY_API_KEY`
207
- - `AUDREY_HOST`
208
- - `AUDREY_PORT`
253
+ # REST sidecar
254
+ npx audrey serve
255
+ docker compose up -d --build
256
+ ```
209
257
 
210
258
  ## Documentation
211
259
 
212
- - [docs/benchmarking.md](docs/benchmarking.md)
213
- - [docs/production-readiness.md](docs/production-readiness.md)
214
- - [CONTRIBUTING.md](CONTRIBUTING.md)
215
- - [SECURITY.md](SECURITY.md)
260
+ - [Audrey for Dummies](docs/audrey-for-dummies.md)
261
+ - [MCP host guide](docs/mcp-hosts.md)
262
+ - [Ollama and local agents](docs/ollama-local-agents.md)
263
+ - [Production readiness](docs/production-readiness.md)
264
+ - [Future of LLM memory](docs/future-of-llm-memory.md)
265
+ - [Benchmarking](docs/benchmarking.md)
266
+ - [Security policy](SECURITY.md)
216
267
 
217
268
  ## Development
218
269
 
219
270
  ```bash
220
271
  npm ci
272
+ npm run build
273
+ npm run typecheck
221
274
  npm test
222
275
  npm run bench:memory:check
223
276
  npm run pack:check
@@ -225,6 +278,8 @@ python -m unittest discover -s python/tests -v
225
278
  python -m build --no-isolation python
226
279
  ```
227
280
 
281
+ On some locked-down Windows hosts, Vitest/Vite can fail before tests start with `spawn EPERM`. That is an environment process-spawn blocker, not an Audrey runtime failure. Use build, typecheck, benchmark, pack dry-run, direct `dist/` smokes, and GitHub Actions as the release evidence path.
282
+
228
283
  ## License
229
284
 
230
285
  MIT. See [LICENSE](LICENSE).
@@ -1,8 +1,23 @@
1
1
  import type { AudreyConfig, EmbeddingConfig, LLMConfig } from '../src/types.js';
2
- export declare const VERSION = "0.20.0";
2
+ export declare const VERSION = "0.21.0";
3
3
  export declare const SERVER_NAME = "audrey-memory";
4
+ export declare const DEFAULT_AGENT = "local-agent";
4
5
  export declare const DEFAULT_DATA_DIR: string;
5
6
  export declare const MCP_ENTRYPOINT: string;
7
+ export declare const HOST_AGENT_NAMES: {
8
+ readonly generic: "local-agent";
9
+ readonly codex: "codex";
10
+ readonly 'claude-code': "claude-code";
11
+ readonly 'claude-desktop': "claude-desktop";
12
+ readonly cursor: "cursor";
13
+ readonly windsurf: "windsurf";
14
+ readonly vscode: "vscode-copilot";
15
+ readonly jetbrains: "jetbrains";
16
+ };
17
+ export type AudreyHost = keyof typeof HOST_AGENT_NAMES;
18
+ interface McpEnvOptions {
19
+ includeSecrets?: boolean;
20
+ }
6
21
  export declare function resolveDataDir(env?: Record<string, string | undefined>): string;
7
22
  /**
8
23
  * Resolves which embedding provider to use.
@@ -16,5 +31,14 @@ export declare function resolveLLMProvider(env: Record<string, string | undefine
16
31
  apiKey?: string;
17
32
  }) | null;
18
33
  export declare function buildAudreyConfig(): AudreyConfig;
34
+ export declare function resolveHostAgent(host: string | undefined): string;
35
+ export declare function buildAudreyMcpEnv(env?: Record<string, string | undefined>, agent?: string, options?: McpEnvOptions): Record<string, string>;
36
+ export declare function buildStdioMcpServerConfig(env?: Record<string, string | undefined>, host?: string | undefined): {
37
+ command: string;
38
+ args: string[];
39
+ env: Record<string, string>;
40
+ };
41
+ export declare function formatMcpHostConfig(host?: string | undefined, env?: Record<string, string | undefined>): string;
19
42
  export declare function buildInstallArgs(env?: Record<string, string | undefined>): string[];
43
+ export {};
20
44
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../mcp-server/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEhF,eAAO,MAAM,OAAO,WAAW,CAAC;AAChC,eAAO,MAAM,WAAW,kBAAkB,CAAC;AAC3C,eAAO,MAAM,gBAAgB,QAAqC,CAAC;AACnE,eAAO,MAAM,cAAc,QAAwD,CAAC;AAyBpF,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,MAAM,CAE5F;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,QAAQ,GAAE,MAAM,GAAG,SAA4C,GAC9D,eAAe,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAkB1C;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,QAAQ,GAAE,MAAM,GAAG,SAAsC,GACxD,CAAC,SAAS,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,IAAI,CAoB1C;AAED,wBAAgB,iBAAiB,IAAI,Y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CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAIjE;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EACrD,KAAK,SAAuC,EAC5C,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAyCxB;AAED,wBAAgB,yBAAyB,CACvC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EACrD,IAAI,GAAE,MAAM,GAAG,SAAqB,GACnC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAOlE;AA6BD,wBAAgB,mBAAmB,CACjC,IAAI,GAAE,MAAM,GAAG,SAAqB,EACpC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,MAAM,CAgBR;AAED,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,MAAM,EAAE,CAShG"}
@@ -1,10 +1,21 @@
1
1
  import { homedir } from 'node:os';
2
2
  import { join } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
- export const VERSION = '0.20.0';
4
+ export const VERSION = '0.21.0';
5
5
  export const SERVER_NAME = 'audrey-memory';
6
+ export const DEFAULT_AGENT = 'local-agent';
6
7
  export const DEFAULT_DATA_DIR = join(homedir(), '.audrey', 'data');
7
8
  export const MCP_ENTRYPOINT = fileURLToPath(new URL('./index.js', import.meta.url));
9
+ export const HOST_AGENT_NAMES = {
10
+ generic: DEFAULT_AGENT,
11
+ codex: 'codex',
12
+ 'claude-code': 'claude-code',
13
+ 'claude-desktop': 'claude-desktop',
14
+ cursor: 'cursor',
15
+ windsurf: 'windsurf',
16
+ vscode: 'vscode-copilot',
17
+ jetbrains: 'jetbrains',
18
+ };
8
19
  const VALID_EMBEDDING_PROVIDERS = new Set(['mock', 'local', 'gemini', 'openai']);
9
20
  const VALID_LLM_PROVIDERS = new Set(['mock', 'anthropic', 'openai']);
10
21
  function assertValidProvider(provider, validProviders, envVar) {
@@ -75,7 +86,7 @@ export function resolveLLMProvider(env, explicit = env['AUDREY_LLM_PROVIDER']) {
75
86
  }
76
87
  export function buildAudreyConfig() {
77
88
  const dataDir = resolveDataDir(process.env);
78
- const agent = process.env['AUDREY_AGENT'] || 'claude-code';
89
+ const agent = process.env['AUDREY_AGENT'] || DEFAULT_AGENT;
79
90
  const explicitProvider = process.env['AUDREY_EMBEDDING_PROVIDER'];
80
91
  const embedding = resolveEmbeddingProvider(process.env, explicitProvider);
81
92
  const llm = resolveLLMProvider(process.env, process.env['AUDREY_LLM_PROVIDER']);
@@ -86,38 +97,112 @@ export function buildAudreyConfig() {
86
97
  }
87
98
  return config;
88
99
  }
89
- export function buildInstallArgs(env = process.env) {
100
+ export function resolveHostAgent(host) {
101
+ if (!host)
102
+ return HOST_AGENT_NAMES.generic;
103
+ if (host in HOST_AGENT_NAMES)
104
+ return HOST_AGENT_NAMES[host];
105
+ throw new Error(`Unsupported MCP host "${host}". Supported hosts: ${Object.keys(HOST_AGENT_NAMES).join(', ')}`);
106
+ }
107
+ export function buildAudreyMcpEnv(env = process.env, agent = env['AUDREY_AGENT'] || DEFAULT_AGENT, options = {}) {
108
+ const includeSecrets = options.includeSecrets ?? true;
109
+ const providerEnv = includeSecrets
110
+ ? env
111
+ : {
112
+ ...env,
113
+ ANTHROPIC_API_KEY: undefined,
114
+ GOOGLE_API_KEY: undefined,
115
+ GEMINI_API_KEY: undefined,
116
+ OPENAI_API_KEY: undefined,
117
+ };
90
118
  const envPairs = new Map();
91
119
  const addEnv = (key, value) => {
92
120
  if (value === undefined || value === null || value === '')
93
121
  return;
94
- envPairs.set(key, `${key}=${value}`);
122
+ envPairs.set(key, value);
95
123
  };
96
124
  addEnv('AUDREY_DATA_DIR', resolveDataDir(env));
97
- const embedding = resolveEmbeddingProvider(env, env['AUDREY_EMBEDDING_PROVIDER']);
125
+ addEnv('AUDREY_AGENT', agent);
126
+ const embedding = resolveEmbeddingProvider(providerEnv, env['AUDREY_EMBEDDING_PROVIDER']);
98
127
  addEnv('AUDREY_EMBEDDING_PROVIDER', embedding.provider);
99
128
  if (embedding.provider === 'local') {
100
129
  addEnv('AUDREY_DEVICE', embedding.device || env['AUDREY_DEVICE'] || 'gpu');
101
130
  }
102
131
  else if (embedding.provider === 'gemini') {
103
- addEnv('GOOGLE_API_KEY', embedding.apiKey);
132
+ if (includeSecrets)
133
+ addEnv('GOOGLE_API_KEY', embedding.apiKey);
104
134
  }
105
135
  else if (embedding.provider === 'openai') {
106
- addEnv('OPENAI_API_KEY', embedding.apiKey);
136
+ if (includeSecrets)
137
+ addEnv('OPENAI_API_KEY', embedding.apiKey);
107
138
  }
108
- const llm = resolveLLMProvider(env, env['AUDREY_LLM_PROVIDER']);
139
+ const llm = resolveLLMProvider(providerEnv, env['AUDREY_LLM_PROVIDER']);
109
140
  if (llm) {
110
141
  addEnv('AUDREY_LLM_PROVIDER', llm.provider);
111
142
  if (llm.provider === 'anthropic') {
112
- addEnv('ANTHROPIC_API_KEY', llm.apiKey);
143
+ if (includeSecrets)
144
+ addEnv('ANTHROPIC_API_KEY', llm.apiKey);
113
145
  }
114
146
  else if (llm.provider === 'openai') {
115
- addEnv('OPENAI_API_KEY', llm.apiKey);
147
+ if (includeSecrets)
148
+ addEnv('OPENAI_API_KEY', llm.apiKey);
116
149
  }
117
150
  }
151
+ return Object.fromEntries(envPairs);
152
+ }
153
+ export function buildStdioMcpServerConfig(env = process.env, host = 'generic') {
154
+ const agent = env['AUDREY_AGENT'] || resolveHostAgent(host);
155
+ return {
156
+ command: process.execPath,
157
+ args: [MCP_ENTRYPOINT],
158
+ env: buildAudreyMcpEnv(env, agent, { includeSecrets: false }),
159
+ };
160
+ }
161
+ function jsonHostConfig(host, env) {
162
+ const config = buildStdioMcpServerConfig(env, host);
163
+ if (host === 'vscode') {
164
+ return {
165
+ servers: {
166
+ [SERVER_NAME]: {
167
+ type: 'stdio',
168
+ ...config,
169
+ },
170
+ },
171
+ };
172
+ }
173
+ return {
174
+ mcpServers: {
175
+ [SERVER_NAME]: {
176
+ type: 'stdio',
177
+ ...config,
178
+ },
179
+ },
180
+ };
181
+ }
182
+ function tomlString(value) {
183
+ return `"${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
184
+ }
185
+ export function formatMcpHostConfig(host = 'generic', env = process.env) {
186
+ const normalizedHost = host || 'generic';
187
+ if (normalizedHost === 'codex') {
188
+ const config = buildStdioMcpServerConfig(env, normalizedHost);
189
+ const lines = [
190
+ `[mcp_servers.${SERVER_NAME}]`,
191
+ `command = ${tomlString(config.command)}`,
192
+ `args = [${config.args.map(tomlString).join(', ')}]`,
193
+ '',
194
+ `[mcp_servers.${SERVER_NAME}.env]`,
195
+ ...Object.entries(config.env).map(([key, value]) => `${key} = ${tomlString(value)}`),
196
+ ];
197
+ return lines.join('\n');
198
+ }
199
+ return JSON.stringify(jsonHostConfig(normalizedHost, env), null, 2);
200
+ }
201
+ export function buildInstallArgs(env = process.env) {
202
+ const envPairs = buildAudreyMcpEnv(env, env['AUDREY_AGENT'] || HOST_AGENT_NAMES['claude-code'], { includeSecrets: true });
118
203
  const args = ['mcp', 'add', '-s', 'user', SERVER_NAME];
119
- for (const pair of envPairs.values()) {
120
- args.push('-e', pair);
204
+ for (const [key, value] of Object.entries(envPairs)) {
205
+ args.push('-e', `${key}=${value}`);
121
206
  }
122
207
  args.push('--', process.execPath, MCP_ENTRYPOINT);
123
208
  return args;
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../mcp-server/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI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