@onenomad/engram-mcp 1.0.0-beta.11 → 1.0.0-beta.13

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.
@@ -1,15 +1,17 @@
1
1
  /**
2
- * CloudStorageAdapter — Pyre Cloud HTTP-backed storage. STUB.
2
+ * CloudStorageAdapter — Pyre Cloud HTTP-backed storage.
3
3
  *
4
- * The cloud storage adapter is the next PR. For now this file exists
5
- * solely so that the storage factory can construct an adapter when a
6
- * ~/.pyre/credentials.json is present without having to special-case
7
- * the wiring up through the rest of the codebase.
4
+ * Speaks the wire contract pyre-web exposes at /api/engram/*. Each
5
+ * StorageAdapter method maps to a single HTTP request pyre-web is
6
+ * a thin multi-tenant Postgres-over-HTTP shim that mirrors what
7
+ * PostgresStorageAdapter does locally.
8
8
  *
9
- * Every method throws with a clear "not yet implemented" message.
10
- * That's a feature, not a bug: a user who runs `engram-mcp login`
11
- * today should see an explicit failure instead of silently falling
12
- * back to local file mode and having two stores diverge.
9
+ * Auth: Bearer token from credentials.json. The server derives the
10
+ * tenant_id from the api-key; the adapter never plumbs it.
11
+ *
12
+ * Error envelope: pyre-web emits `{ "error": { "code", "message" } }`
13
+ * on non-2xx. errorBody() unpacks it; failures bubble up as Error
14
+ * with that text so the rest of the engram pipeline reports cleanly.
13
15
  */
14
16
  import type { StorageAdapter, StoredChunk, ListChunksOpts, HandoffNote, HandoffSummary, QueryTriplesOpts, TripleStats, VectorHit, ReadDiaryOpts } from './storage-adapter.js';
15
17
  import type { DailyLogEntry, ProceduralRule, KnowledgeTriple, DiaryEntry } from './types.js';
@@ -18,44 +20,51 @@ export interface CloudStorageOptions {
18
20
  apiKey: string;
19
21
  label?: string;
20
22
  scopes?: string[];
23
+ fetch?: typeof fetch;
21
24
  }
22
25
  export declare class CloudStorageAdapter implements StorageAdapter {
23
26
  readonly apiUrl: string;
24
27
  readonly apiKey: string;
25
28
  readonly label: string | undefined;
26
29
  readonly scopes: readonly string[];
30
+ private readonly fetchImpl;
27
31
  constructor(opts: CloudStorageOptions);
32
+ private url;
33
+ private headers;
34
+ private request;
35
+ private send;
36
+ private sendJson;
28
37
  ensureReady(): Promise<void>;
29
38
  close(): Promise<void>;
30
- saveChunk(_chunk: StoredChunk): Promise<void>;
31
- saveChunks(_chunks: StoredChunk[]): Promise<void>;
32
- getChunk(_id: string): Promise<StoredChunk | null>;
33
- deleteChunk(_id: string): Promise<void>;
34
- listChunks(_opts?: ListChunksOpts): Promise<StoredChunk[]>;
35
- updateChunk(_id: string, _updates: Partial<StoredChunk>): Promise<void>;
39
+ saveChunk(chunk: StoredChunk): Promise<void>;
40
+ saveChunks(chunks: StoredChunk[]): Promise<void>;
41
+ getChunk(id: string): Promise<StoredChunk | null>;
42
+ deleteChunk(id: string): Promise<void>;
43
+ listChunks(opts?: ListChunksOpts): Promise<StoredChunk[]>;
44
+ updateChunk(id: string, updates: Partial<StoredChunk>): Promise<void>;
36
45
  chunkCount(): Promise<number>;
37
- vectorSearch(_q: number[], _limit: number, _filter?: string): Promise<VectorHit[]>;
46
+ vectorSearch(queryEmbedding: number[], limit: number, filter?: string): Promise<VectorHit[]>;
38
47
  getTaxonomy(): Promise<Record<string, Record<string, number>>>;
39
- appendDailyEntry(_date: string, _entry: DailyLogEntry): Promise<void>;
40
- getDailyLogs(_daysBack: number): Promise<Array<{
48
+ appendDailyEntry(date: string, entry: DailyLogEntry): Promise<void>;
49
+ getDailyLogs(daysBack: number): Promise<Array<{
41
50
  date: string;
42
51
  entries: DailyLogEntry[];
43
52
  }>>;
44
- saveRule(_rule: ProceduralRule): Promise<void>;
53
+ saveRule(rule: ProceduralRule): Promise<void>;
45
54
  getRules(): Promise<ProceduralRule[]>;
46
- deleteRule(_id: string): Promise<void>;
47
- saveTriple(_triple: KnowledgeTriple): Promise<void>;
48
- queryTriples(_opts?: QueryTriplesOpts): Promise<KnowledgeTriple[]>;
49
- invalidateTriple(_id: string): Promise<void>;
50
- getTripleTimeline(_entity: string): Promise<KnowledgeTriple[]>;
55
+ deleteRule(id: string): Promise<void>;
56
+ saveTriple(triple: KnowledgeTriple): Promise<void>;
57
+ queryTriples(opts?: QueryTriplesOpts): Promise<KnowledgeTriple[]>;
58
+ invalidateTriple(id: string): Promise<void>;
59
+ getTripleTimeline(entity: string): Promise<KnowledgeTriple[]>;
51
60
  getTripleStats(): Promise<TripleStats>;
52
- writeDiaryEntry(_content: string, _agent?: string): Promise<DiaryEntry>;
53
- readDiary(_opts?: ReadDiaryOpts): Promise<Array<{
61
+ writeDiaryEntry(content: string, agent?: string): Promise<DiaryEntry>;
62
+ readDiary(opts?: ReadDiaryOpts): Promise<Array<{
54
63
  date: string;
55
64
  entries: DiaryEntry[];
56
65
  }>>;
57
66
  listDiaryDates(): Promise<string[]>;
58
- writeHandoff(_note: Omit<HandoffNote, 'timestamp'>): Promise<HandoffNote>;
59
- readHandoff(_stamp?: string): Promise<HandoffNote | null>;
60
- listHandoffs(_limit?: number): Promise<HandoffSummary[]>;
67
+ writeHandoff(note: Omit<HandoffNote, 'timestamp'>): Promise<HandoffNote>;
68
+ readHandoff(stamp?: string): Promise<HandoffNote | null>;
69
+ listHandoffs(limit?: number): Promise<HandoffSummary[]>;
61
70
  }
@@ -1,67 +1,233 @@
1
- /**
2
- * CloudStorageAdapter Pyre Cloud HTTP-backed storage. STUB.
3
- *
4
- * The cloud storage adapter is the next PR. For now this file exists
5
- * solely so that the storage factory can construct an adapter when a
6
- * ~/.pyre/credentials.json is present without having to special-case
7
- * the wiring up through the rest of the codebase.
8
- *
9
- * Every method throws with a clear "not yet implemented" message.
10
- * That's a feature, not a bug: a user who runs `engram-mcp login`
11
- * today should see an explicit failure instead of silently falling
12
- * back to local file mode and having two stores diverge.
13
- */
14
- function notImplemented(method) {
15
- throw new Error(`CloudStorageAdapter.${method}: cloud storage backend is not yet implemented — ` +
16
- `the device-code login + credentials file landed first, the HTTP adapter ships in the next PR. ` +
17
- `Until then, unset STORAGE_BACKEND and remove ~/.pyre/credentials.json (or run \`engram-mcp logout\`) ` +
18
- `to use the local file backend.`);
1
+ async function errorBody(res) {
2
+ const text = await res.text().catch(() => '');
3
+ if (!text)
4
+ return `${res.status} ${res.statusText}`;
5
+ try {
6
+ const parsed = JSON.parse(text);
7
+ if (parsed.error?.message) {
8
+ return parsed.error.code
9
+ ? `${parsed.error.code}: ${parsed.error.message}`
10
+ : parsed.error.message;
11
+ }
12
+ }
13
+ catch {
14
+ /* raw text fallback */
15
+ }
16
+ return text.slice(0, 200);
19
17
  }
20
18
  export class CloudStorageAdapter {
21
19
  apiUrl;
22
20
  apiKey;
23
21
  label;
24
22
  scopes;
23
+ fetchImpl;
25
24
  constructor(opts) {
26
- this.apiUrl = opts.apiUrl;
25
+ this.apiUrl = opts.apiUrl.replace(/\/+$/, '');
27
26
  this.apiKey = opts.apiKey;
28
27
  this.label = opts.label;
29
28
  this.scopes = Object.freeze([...(opts.scopes ?? [])]);
29
+ this.fetchImpl = opts.fetch ?? fetch;
30
+ }
31
+ // ── HTTP helpers ───────────────────────────────────────────────────
32
+ url(path) {
33
+ return `${this.apiUrl}${path.startsWith('/') ? path : `/${path}`}`;
34
+ }
35
+ headers() {
36
+ return {
37
+ Authorization: `Bearer ${this.apiKey}`,
38
+ 'Content-Type': 'application/json',
39
+ Accept: 'application/json',
40
+ };
41
+ }
42
+ async request(method, path, body) {
43
+ const init = { method, headers: this.headers() };
44
+ if (body !== undefined)
45
+ init.body = JSON.stringify(body);
46
+ return await this.fetchImpl(this.url(path), init);
47
+ }
48
+ async send(method, path, body) {
49
+ const res = await this.request(method, path, body);
50
+ if (!res.ok) {
51
+ const msg = await errorBody(res);
52
+ throw new Error(`Engram cloud ${method} ${path} ${res.status}: ${msg}`);
53
+ }
54
+ return res;
55
+ }
56
+ async sendJson(method, path, body) {
57
+ const res = await this.send(method, path, body);
58
+ return (await res.json());
59
+ }
60
+ // ── Lifecycle ──────────────────────────────────────────────────────
61
+ async ensureReady() {
62
+ // Lightweight identity probe. Verifies credentials are live and the
63
+ // server is reachable before any pipeline work spins up. 401 here is
64
+ // a clean signal to re-run `engram-mcp login`.
65
+ const res = await this.request('GET', '/api/auth/whoami');
66
+ if (!res.ok) {
67
+ const msg = await errorBody(res);
68
+ if (res.status === 401) {
69
+ throw new Error(`Engram cloud: credentials invalid or expired (${msg}). Run \`engram-mcp login <url>\` again.`);
70
+ }
71
+ throw new Error(`Engram cloud: server check failed (${res.status}): ${msg}`);
72
+ }
73
+ }
74
+ async close() {
75
+ /* stateless HTTP client; nothing to close. */
76
+ }
77
+ // ── Chunks ─────────────────────────────────────────────────────────
78
+ async saveChunk(chunk) {
79
+ await this.send('POST', '/api/engram/chunks', chunk);
80
+ }
81
+ async saveChunks(chunks) {
82
+ if (chunks.length === 0)
83
+ return;
84
+ await this.send('POST', '/api/engram/chunks/batch', { chunks });
85
+ }
86
+ async getChunk(id) {
87
+ const res = await this.request('GET', `/api/engram/chunks/${encodeURIComponent(id)}`);
88
+ if (res.status === 404)
89
+ return null;
90
+ if (!res.ok) {
91
+ const msg = await errorBody(res);
92
+ throw new Error(`Engram cloud GET /chunks/${id} ${res.status}: ${msg}`);
93
+ }
94
+ return (await res.json());
95
+ }
96
+ async deleteChunk(id) {
97
+ await this.send('DELETE', `/api/engram/chunks/${encodeURIComponent(id)}`);
98
+ }
99
+ async listChunks(opts) {
100
+ const qs = new URLSearchParams();
101
+ if (opts?.excludeTiers && opts.excludeTiers.length > 0) {
102
+ qs.set('excludeTiers', opts.excludeTiers.join(','));
103
+ }
104
+ if (opts?.tier)
105
+ qs.set('tier', opts.tier);
106
+ if (opts?.cognitiveLayer)
107
+ qs.set('cognitiveLayer', opts.cognitiveLayer);
108
+ if (opts?.domain)
109
+ qs.set('domain', opts.domain);
110
+ if (opts?.topic)
111
+ qs.set('topic', opts.topic);
112
+ if (opts?.tag)
113
+ qs.set('tag', opts.tag);
114
+ const path = `/api/engram/chunks${qs.toString() ? `?${qs.toString()}` : ''}`;
115
+ const { chunks } = await this.sendJson('GET', path);
116
+ return chunks;
117
+ }
118
+ async updateChunk(id, updates) {
119
+ await this.send('PATCH', `/api/engram/chunks/${encodeURIComponent(id)}`, updates);
120
+ }
121
+ async chunkCount() {
122
+ const { count } = await this.sendJson('GET', '/api/engram/chunks/count');
123
+ return count;
124
+ }
125
+ async vectorSearch(queryEmbedding, limit, filter) {
126
+ const body = {
127
+ embedding: queryEmbedding,
128
+ limit,
129
+ };
130
+ if (filter)
131
+ body.filter = filter;
132
+ const { hits } = await this.sendJson('POST', '/api/engram/chunks/search', body);
133
+ return hits;
134
+ }
135
+ // ── Taxonomy ───────────────────────────────────────────────────────
136
+ async getTaxonomy() {
137
+ const { taxonomy } = await this.sendJson('GET', '/api/engram/taxonomy');
138
+ return taxonomy;
139
+ }
140
+ // ── Daily logs ─────────────────────────────────────────────────────
141
+ async appendDailyEntry(date, entry) {
142
+ await this.send('POST', '/api/engram/daily-logs', { date, entry });
143
+ }
144
+ async getDailyLogs(daysBack) {
145
+ const { days } = await this.sendJson('GET', `/api/engram/daily-logs?days_back=${daysBack}`);
146
+ return days;
147
+ }
148
+ // ── Procedural rules ───────────────────────────────────────────────
149
+ async saveRule(rule) {
150
+ await this.send('POST', '/api/engram/rules', rule);
151
+ }
152
+ async getRules() {
153
+ const { rules } = await this.sendJson('GET', '/api/engram/rules');
154
+ return rules;
155
+ }
156
+ async deleteRule(id) {
157
+ await this.send('DELETE', `/api/engram/rules/${encodeURIComponent(id)}`);
158
+ }
159
+ // ── Knowledge triples ──────────────────────────────────────────────
160
+ async saveTriple(triple) {
161
+ await this.send('POST', '/api/engram/triples', triple);
162
+ }
163
+ async queryTriples(opts) {
164
+ const qs = new URLSearchParams();
165
+ if (opts?.subject)
166
+ qs.set('subject', opts.subject);
167
+ if (opts?.predicate)
168
+ qs.set('predicate', opts.predicate);
169
+ if (opts?.object)
170
+ qs.set('object', opts.object);
171
+ if (opts?.activeOnly)
172
+ qs.set('active_only', 'true');
173
+ const path = `/api/engram/triples${qs.toString() ? `?${qs.toString()}` : ''}`;
174
+ const { triples } = await this.sendJson('GET', path);
175
+ return triples;
176
+ }
177
+ async invalidateTriple(id) {
178
+ await this.send('POST', `/api/engram/triples/${encodeURIComponent(id)}/invalidate`);
179
+ }
180
+ async getTripleTimeline(entity) {
181
+ const { triples } = await this.sendJson('GET', `/api/engram/triples/timeline/${encodeURIComponent(entity)}`);
182
+ return triples;
183
+ }
184
+ async getTripleStats() {
185
+ return await this.sendJson('GET', '/api/engram/triples/stats');
186
+ }
187
+ // ── Diary ──────────────────────────────────────────────────────────
188
+ async writeDiaryEntry(content, agent) {
189
+ return await this.sendJson('POST', '/api/engram/diary', { content, agent });
190
+ }
191
+ async readDiary(opts) {
192
+ const qs = new URLSearchParams();
193
+ if (opts?.date)
194
+ qs.set('date', opts.date);
195
+ else if (opts?.daysBack !== undefined)
196
+ qs.set('days_back', String(opts.daysBack));
197
+ if (opts?.agent)
198
+ qs.set('agent', opts.agent);
199
+ const path = `/api/engram/diary${qs.toString() ? `?${qs.toString()}` : ''}`;
200
+ const { days } = await this.sendJson('GET', path);
201
+ return days;
202
+ }
203
+ async listDiaryDates() {
204
+ const { dates } = await this.sendJson('GET', '/api/engram/diary/dates');
205
+ return dates;
206
+ }
207
+ // ── Handoffs ───────────────────────────────────────────────────────
208
+ async writeHandoff(note) {
209
+ // pyre-web returns { stamp, ...HandoffNote }. The local file adapter
210
+ // returns just HandoffNote, and downstream consumers don't depend on
211
+ // `stamp` from this method's return — strip it so the contract matches.
212
+ const full = await this.sendJson('POST', '/api/engram/handoffs', note);
213
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
214
+ const { stamp: _stamp, ...rest } = full;
215
+ return rest;
216
+ }
217
+ async readHandoff(stamp) {
218
+ const target = stamp ?? 'latest';
219
+ const res = await this.request('GET', `/api/engram/handoffs/${encodeURIComponent(target)}`);
220
+ if (res.status === 404)
221
+ return null;
222
+ if (!res.ok) {
223
+ const msg = await errorBody(res);
224
+ throw new Error(`Engram cloud GET /handoffs/${target} ${res.status}: ${msg}`);
225
+ }
226
+ return (await res.json());
227
+ }
228
+ async listHandoffs(limit = 10) {
229
+ const { handoffs } = await this.sendJson('GET', `/api/engram/handoffs?limit=${limit}`);
230
+ return handoffs;
30
231
  }
31
- // Lifecycle ─────────────────────────────────────────────────────────
32
- async ensureReady() { notImplemented('ensureReady'); }
33
- async close() { }
34
- // Chunks ────────────────────────────────────────────────────────────
35
- async saveChunk(_chunk) { notImplemented('saveChunk'); }
36
- async saveChunks(_chunks) { notImplemented('saveChunks'); }
37
- async getChunk(_id) { notImplemented('getChunk'); }
38
- async deleteChunk(_id) { notImplemented('deleteChunk'); }
39
- async listChunks(_opts) { notImplemented('listChunks'); }
40
- async updateChunk(_id, _updates) { notImplemented('updateChunk'); }
41
- async chunkCount() { notImplemented('chunkCount'); }
42
- async vectorSearch(_q, _limit, _filter) { notImplemented('vectorSearch'); }
43
- // Taxonomy ──────────────────────────────────────────────────────────
44
- async getTaxonomy() { notImplemented('getTaxonomy'); }
45
- // Daily logs ────────────────────────────────────────────────────────
46
- async appendDailyEntry(_date, _entry) { notImplemented('appendDailyEntry'); }
47
- async getDailyLogs(_daysBack) { notImplemented('getDailyLogs'); }
48
- // Procedural rules ──────────────────────────────────────────────────
49
- async saveRule(_rule) { notImplemented('saveRule'); }
50
- async getRules() { notImplemented('getRules'); }
51
- async deleteRule(_id) { notImplemented('deleteRule'); }
52
- // Knowledge triples ─────────────────────────────────────────────────
53
- async saveTriple(_triple) { notImplemented('saveTriple'); }
54
- async queryTriples(_opts) { notImplemented('queryTriples'); }
55
- async invalidateTriple(_id) { notImplemented('invalidateTriple'); }
56
- async getTripleTimeline(_entity) { notImplemented('getTripleTimeline'); }
57
- async getTripleStats() { notImplemented('getTripleStats'); }
58
- // Diary ─────────────────────────────────────────────────────────────
59
- async writeDiaryEntry(_content, _agent) { notImplemented('writeDiaryEntry'); }
60
- async readDiary(_opts) { notImplemented('readDiary'); }
61
- async listDiaryDates() { notImplemented('listDiaryDates'); }
62
- // Handoffs ──────────────────────────────────────────────────────────
63
- async writeHandoff(_note) { notImplemented('writeHandoff'); }
64
- async readHandoff(_stamp) { notImplemented('readHandoff'); }
65
- async listHandoffs(_limit) { notImplemented('listHandoffs'); }
66
232
  }
67
233
  //# sourceMappingURL=storage-cloud.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage-cloud.js","sourceRoot":"","sources":["../src/storage-cloud.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAYH,SAAS,cAAc,CAAC,MAAc;IACpC,MAAM,IAAI,KAAK,CACb,uBAAuB,MAAM,mDAAmD;QAChF,gGAAgG;QAChG,uGAAuG;QACvG,gCAAgC,CACjC,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,mBAAmB;IACrB,MAAM,CAAS;IACf,MAAM,CAAS;IACf,KAAK,CAAqB;IAC1B,MAAM,CAAoB;IAEnC,YAAY,IAAyB;QACnC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,sEAAsE;IACtE,KAAK,CAAC,WAAW,KAAoB,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IACrE,KAAK,CAAC,KAAK,KAA0D,CAAC;IAEtE,sEAAsE;IACtE,KAAK,CAAC,SAAS,CAAC,MAAmB,IAAmB,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IACpF,KAAK,CAAC,UAAU,CAAC,OAAsB,IAAmB,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACzF,KAAK,CAAC,QAAQ,CAAC,GAAW,IAAi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C,MAAM,KAAK,GAAG,EAAE,CAAC,CAAC;QAChF,CAAC;QACD,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAgB,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE;QACnC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CACtC,KAAK,EACL,8BAA8B,KAAK,EAAE,CACtC,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onenomad/engram-mcp",
3
- "version": "1.0.0-beta.11",
3
+ "version": "1.0.0-beta.13",
4
4
  "mcpName": "io.github.onenomad-llc/engram-mcp",
5
5
  "description": "Engram — memory MCP server for Claude Code, plus a library API for direct in-process use. LLM-powered extraction, hybrid ANN search, tier lifecycle, spreading activation, procedural rules, real-time ingest, Mem0, and session-state.",
6
6
  "type": "module",