@hasna/mementos 0.14.30 → 0.14.32

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 (240) hide show
  1. package/LICENSE +190 -3
  2. package/README.md +34 -34
  3. package/dist/cli/brains.d.ts +3 -0
  4. package/dist/cli/brains.d.ts.map +1 -0
  5. package/dist/cli/index.d.ts +3 -0
  6. package/dist/cli/index.d.ts.map +1 -0
  7. package/dist/cli/index.js +25767 -0
  8. package/dist/db/acl.d.ts +34 -0
  9. package/dist/db/acl.d.ts.map +1 -0
  10. package/dist/db/agents.d.ts +15 -0
  11. package/dist/db/agents.d.ts.map +1 -0
  12. package/dist/db/audit.d.ts +39 -0
  13. package/dist/db/audit.d.ts.map +1 -0
  14. package/dist/db/database.d.ts +10 -0
  15. package/dist/db/database.d.ts.map +1 -0
  16. package/dist/db/entities.d.ts +62 -0
  17. package/dist/db/entities.d.ts.map +1 -0
  18. package/dist/db/entity-memories.d.ts +34 -0
  19. package/dist/db/entity-memories.d.ts.map +1 -0
  20. package/dist/db/locks.d.ts +63 -0
  21. package/dist/db/locks.d.ts.map +1 -0
  22. package/dist/db/machines.d.ts +16 -0
  23. package/dist/db/machines.d.ts.map +1 -0
  24. package/dist/db/memories.d.ts +40 -0
  25. package/dist/db/memories.d.ts.map +1 -0
  26. package/dist/db/pg-migrate.d.ts +14 -0
  27. package/dist/db/pg-migrate.d.ts.map +1 -0
  28. package/dist/db/pg-migrations.d.ts +8 -0
  29. package/dist/db/pg-migrations.d.ts.map +1 -0
  30. package/dist/db/projects.d.ts +6 -0
  31. package/dist/db/projects.d.ts.map +1 -0
  32. package/dist/db/ratings.d.ts +23 -0
  33. package/dist/db/ratings.d.ts.map +1 -0
  34. package/dist/db/relations.d.ts +29 -0
  35. package/dist/db/relations.d.ts.map +1 -0
  36. package/dist/db/session-jobs.d.ts +49 -0
  37. package/dist/db/session-jobs.d.ts.map +1 -0
  38. package/dist/db/synthesis.d.ts +101 -0
  39. package/dist/db/synthesis.d.ts.map +1 -0
  40. package/dist/db/tool-events.d.ts +27 -0
  41. package/dist/db/tool-events.d.ts.map +1 -0
  42. package/dist/db/webhook_hooks.d.ts +25 -0
  43. package/dist/db/webhook_hooks.d.ts.map +1 -0
  44. package/dist/index.d.ts +27 -4
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +14642 -1006
  47. package/dist/lib/activation-matcher.d.ts +16 -0
  48. package/dist/lib/activation-matcher.d.ts.map +1 -0
  49. package/dist/lib/asmr/categorizer.d.ts +31 -0
  50. package/dist/lib/asmr/categorizer.d.ts.map +1 -0
  51. package/dist/lib/asmr/context-agent.d.ts +4 -0
  52. package/dist/lib/asmr/context-agent.d.ts.map +1 -0
  53. package/dist/lib/asmr/ensemble.d.ts +23 -0
  54. package/dist/lib/asmr/ensemble.d.ts.map +1 -0
  55. package/dist/lib/asmr/fact-agent.d.ts +4 -0
  56. package/dist/lib/asmr/fact-agent.d.ts.map +1 -0
  57. package/dist/lib/asmr/index.d.ts +7 -0
  58. package/dist/lib/asmr/index.d.ts.map +1 -0
  59. package/dist/lib/asmr/orchestrator.d.ts +4 -0
  60. package/dist/lib/asmr/orchestrator.d.ts.map +1 -0
  61. package/dist/lib/asmr/temporal-agent.d.ts +4 -0
  62. package/dist/lib/asmr/temporal-agent.d.ts.map +1 -0
  63. package/dist/lib/asmr/types.d.ts +27 -0
  64. package/dist/lib/asmr/types.d.ts.map +1 -0
  65. package/dist/lib/auto-inject-orchestrator.d.ts +57 -0
  66. package/dist/lib/auto-inject-orchestrator.d.ts.map +1 -0
  67. package/dist/lib/auto-memory-queue.d.ts +46 -0
  68. package/dist/lib/auto-memory-queue.d.ts.map +1 -0
  69. package/dist/lib/auto-memory.d.ts +18 -0
  70. package/dist/lib/auto-memory.d.ts.map +1 -0
  71. package/dist/lib/bench.d.ts +20 -0
  72. package/dist/lib/bench.d.ts.map +1 -0
  73. package/dist/lib/built-in-hooks.d.ts +12 -0
  74. package/dist/lib/built-in-hooks.d.ts.map +1 -0
  75. package/dist/lib/channel-pusher.d.ts +39 -0
  76. package/dist/lib/channel-pusher.d.ts.map +1 -0
  77. package/dist/lib/config.d.ts +9 -0
  78. package/dist/lib/config.d.ts.map +1 -0
  79. package/dist/lib/connectors/files.d.ts +8 -0
  80. package/dist/lib/connectors/files.d.ts.map +1 -0
  81. package/dist/lib/connectors/github.d.ts +7 -0
  82. package/dist/lib/connectors/github.d.ts.map +1 -0
  83. package/dist/lib/connectors/index.d.ts +12 -0
  84. package/dist/lib/connectors/index.d.ts.map +1 -0
  85. package/dist/lib/connectors/notion.d.ts +7 -0
  86. package/dist/lib/connectors/notion.d.ts.map +1 -0
  87. package/dist/lib/connectors/types.d.ts +27 -0
  88. package/dist/lib/connectors/types.d.ts.map +1 -0
  89. package/dist/lib/context-extractor.d.ts +14 -0
  90. package/dist/lib/context-extractor.d.ts.map +1 -0
  91. package/dist/lib/context.d.ts +35 -0
  92. package/dist/lib/context.d.ts.map +1 -0
  93. package/dist/lib/contradiction.d.ts +50 -0
  94. package/dist/lib/contradiction.d.ts.map +1 -0
  95. package/dist/lib/decay.d.ts +35 -0
  96. package/dist/lib/decay.d.ts.map +1 -0
  97. package/dist/lib/dedup.d.ts +33 -0
  98. package/dist/lib/dedup.d.ts.map +1 -0
  99. package/dist/lib/duration.d.ts +28 -0
  100. package/dist/lib/duration.d.ts.map +1 -0
  101. package/dist/lib/embeddings.d.ts +20 -0
  102. package/dist/lib/embeddings.d.ts.map +1 -0
  103. package/dist/lib/export-v1.d.ts +30 -0
  104. package/dist/lib/export-v1.d.ts.map +1 -0
  105. package/dist/lib/extractor.d.ts +9 -0
  106. package/dist/lib/extractor.d.ts.map +1 -0
  107. package/dist/lib/extractors/audio.d.ts +8 -0
  108. package/dist/lib/extractors/audio.d.ts.map +1 -0
  109. package/dist/lib/extractors/index.d.ts +12 -0
  110. package/dist/lib/extractors/index.d.ts.map +1 -0
  111. package/dist/lib/extractors/ocr.d.ts +7 -0
  112. package/dist/lib/extractors/ocr.d.ts.map +1 -0
  113. package/dist/lib/extractors/pdf.d.ts +7 -0
  114. package/dist/lib/extractors/pdf.d.ts.map +1 -0
  115. package/dist/lib/extractors/types.d.ts +12 -0
  116. package/dist/lib/extractors/types.d.ts.map +1 -0
  117. package/dist/lib/file-deps.d.ts +27 -0
  118. package/dist/lib/file-deps.d.ts.map +1 -0
  119. package/dist/lib/focus.d.ts +58 -0
  120. package/dist/lib/focus.d.ts.map +1 -0
  121. package/dist/lib/gatherer.d.ts +16 -0
  122. package/dist/lib/gatherer.d.ts.map +1 -0
  123. package/dist/lib/gdpr.d.ts +24 -0
  124. package/dist/lib/gdpr.d.ts.map +1 -0
  125. package/dist/lib/hooks.d.ts +50 -0
  126. package/dist/lib/hooks.d.ts.map +1 -0
  127. package/dist/lib/importers/index.d.ts +38 -0
  128. package/dist/lib/importers/index.d.ts.map +1 -0
  129. package/dist/lib/injector.d.ts +86 -0
  130. package/dist/lib/injector.d.ts.map +1 -0
  131. package/dist/lib/matryoshka.d.ts +50 -0
  132. package/dist/lib/matryoshka.d.ts.map +1 -0
  133. package/dist/lib/memory-lock.d.ts +58 -0
  134. package/dist/lib/memory-lock.d.ts.map +1 -0
  135. package/dist/lib/model-config.d.ts +14 -0
  136. package/dist/lib/model-config.d.ts.map +1 -0
  137. package/dist/lib/open-sessions-connector.d.ts +60 -0
  138. package/dist/lib/open-sessions-connector.d.ts.map +1 -0
  139. package/dist/lib/poisoning.d.ts +19 -0
  140. package/dist/lib/poisoning.d.ts.map +1 -0
  141. package/dist/lib/poll.d.ts +17 -0
  142. package/dist/lib/poll.d.ts.map +1 -0
  143. package/dist/lib/procedural-extractor.d.ts +21 -0
  144. package/dist/lib/procedural-extractor.d.ts.map +1 -0
  145. package/dist/lib/profile-sync.d.ts +20 -0
  146. package/dist/lib/profile-sync.d.ts.map +1 -0
  147. package/dist/lib/profile-synthesizer.d.ts +20 -0
  148. package/dist/lib/profile-synthesizer.d.ts.map +1 -0
  149. package/dist/lib/project-detect.d.ts +18 -0
  150. package/dist/lib/project-detect.d.ts.map +1 -0
  151. package/dist/lib/providers/anthropic.d.ts +21 -0
  152. package/dist/lib/providers/anthropic.d.ts.map +1 -0
  153. package/dist/lib/providers/base.d.ts +96 -0
  154. package/dist/lib/providers/base.d.ts.map +1 -0
  155. package/dist/lib/providers/cerebras.d.ts +20 -0
  156. package/dist/lib/providers/cerebras.d.ts.map +1 -0
  157. package/dist/lib/providers/grok.d.ts +19 -0
  158. package/dist/lib/providers/grok.d.ts.map +1 -0
  159. package/dist/lib/providers/index.d.ts +7 -0
  160. package/dist/lib/providers/index.d.ts.map +1 -0
  161. package/dist/lib/providers/openai-compat.d.ts +18 -0
  162. package/dist/lib/providers/openai-compat.d.ts.map +1 -0
  163. package/dist/lib/providers/openai.d.ts +20 -0
  164. package/dist/lib/providers/openai.d.ts.map +1 -0
  165. package/dist/lib/providers/registry.d.ts +38 -0
  166. package/dist/lib/providers/registry.d.ts.map +1 -0
  167. package/dist/lib/quality.d.ts +16 -0
  168. package/dist/lib/quality.d.ts.map +1 -0
  169. package/dist/lib/redact.d.ts +10 -0
  170. package/dist/lib/redact.d.ts.map +1 -0
  171. package/dist/lib/remote-sync.d.ts +49 -0
  172. package/dist/lib/remote-sync.d.ts.map +1 -0
  173. package/dist/lib/retention.d.ts +17 -0
  174. package/dist/lib/retention.d.ts.map +1 -0
  175. package/dist/lib/search.d.ts +52 -0
  176. package/dist/lib/search.d.ts.map +1 -0
  177. package/dist/lib/session-auto-resolve.d.ts +28 -0
  178. package/dist/lib/session-auto-resolve.d.ts.map +1 -0
  179. package/dist/lib/session-processor.d.ts +38 -0
  180. package/dist/lib/session-processor.d.ts.map +1 -0
  181. package/dist/lib/session-queue.d.ts +28 -0
  182. package/dist/lib/session-queue.d.ts.map +1 -0
  183. package/dist/lib/session-registry.d.ts +47 -0
  184. package/dist/lib/session-registry.d.ts.map +1 -0
  185. package/dist/lib/session-start-briefing.d.ts +10 -0
  186. package/dist/lib/session-start-briefing.d.ts.map +1 -0
  187. package/dist/lib/session-watcher.d.ts +30 -0
  188. package/dist/lib/session-watcher.d.ts.map +1 -0
  189. package/dist/lib/sync.d.ts +10 -0
  190. package/dist/lib/sync.d.ts.map +1 -0
  191. package/dist/lib/synthesis/corpus-builder.d.ts +30 -0
  192. package/dist/lib/synthesis/corpus-builder.d.ts.map +1 -0
  193. package/dist/lib/synthesis/executor.d.ts +14 -0
  194. package/dist/lib/synthesis/executor.d.ts.map +1 -0
  195. package/dist/lib/synthesis/index.d.ts +37 -0
  196. package/dist/lib/synthesis/index.d.ts.map +1 -0
  197. package/dist/lib/synthesis/llm-analyzer.d.ts +18 -0
  198. package/dist/lib/synthesis/llm-analyzer.d.ts.map +1 -0
  199. package/dist/lib/synthesis/metrics.d.ts +13 -0
  200. package/dist/lib/synthesis/metrics.d.ts.map +1 -0
  201. package/dist/lib/synthesis/scheduler.d.ts +18 -0
  202. package/dist/lib/synthesis/scheduler.d.ts.map +1 -0
  203. package/dist/lib/synthesis/validator.d.ts +19 -0
  204. package/dist/lib/synthesis/validator.d.ts.map +1 -0
  205. package/dist/lib/tool-lesson-extractor.d.ts +24 -0
  206. package/dist/lib/tool-lesson-extractor.d.ts.map +1 -0
  207. package/dist/lib/tool-memory-synthesizer.d.ts +28 -0
  208. package/dist/lib/tool-memory-synthesizer.d.ts.map +1 -0
  209. package/dist/lib/topic-clusterer.d.ts +21 -0
  210. package/dist/lib/topic-clusterer.d.ts.map +1 -0
  211. package/dist/lib/when-to-use-generator.d.ts +22 -0
  212. package/dist/lib/when-to-use-generator.d.ts.map +1 -0
  213. package/dist/mcp/index.d.ts +5 -0
  214. package/dist/mcp/index.d.ts.map +1 -0
  215. package/dist/mcp/index.js +30258 -0
  216. package/dist/mcp/memory-broadcast.d.ts +12 -0
  217. package/dist/mcp/memory-broadcast.d.ts.map +1 -0
  218. package/dist/sdk/index.js +397 -0
  219. package/dist/server/index.d.ts +7 -0
  220. package/dist/server/index.d.ts.map +1 -0
  221. package/dist/server/index.js +18250 -0
  222. package/dist/types/hooks.d.ts +136 -0
  223. package/dist/types/hooks.d.ts.map +1 -0
  224. package/dist/types/index.d.ts +345 -0
  225. package/dist/types/index.d.ts.map +1 -0
  226. package/package.json +53 -13
  227. package/dist/agent-setup.d.ts +0 -51
  228. package/dist/agent-setup.d.ts.map +0 -1
  229. package/dist/bridge.d.ts +0 -50
  230. package/dist/bridge.d.ts.map +0 -1
  231. package/dist/cli.d.ts +0 -3
  232. package/dist/cli.d.ts.map +0 -1
  233. package/dist/cli.js +0 -1362
  234. package/dist/mcp-runtime.d.ts +0 -24
  235. package/dist/mcp-runtime.d.ts.map +0 -1
  236. package/dist/mcp.d.ts +0 -3
  237. package/dist/mcp.d.ts.map +0 -1
  238. package/dist/mcp.js +0 -354
  239. package/dist/remote-client.d.ts +0 -49
  240. package/dist/remote-client.d.ts.map +0 -1
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Memory broadcast utility — notifies active agents when shared memories are saved.
3
+ * Uses the conversations MCP service if available.
4
+ * Non-blocking: failures are silently ignored.
5
+ */
6
+ import type { Memory } from '../types/index.js';
7
+ /**
8
+ * Broadcast a newly saved shared memory to all active agents on the project
9
+ * via the conversations MCP send_message endpoint.
10
+ */
11
+ export declare function broadcastSharedMemory(memory: Memory, savingAgentId: string): Promise<void>;
12
+ //# sourceMappingURL=memory-broadcast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-broadcast.d.ts","sourceRoot":"","sources":["../../src/mcp/memory-broadcast.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAIhD;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BhG"}
@@ -0,0 +1,397 @@
1
+ // @bun
2
+ // src/sdk/index.ts
3
+ class MementosError extends Error {
4
+ status;
5
+ details;
6
+ constructor(message, status, details) {
7
+ super(message);
8
+ this.status = status;
9
+ this.details = details;
10
+ this.name = "MementosError";
11
+ }
12
+ }
13
+
14
+ class MementosClient {
15
+ baseUrl;
16
+ _fetch;
17
+ constructor(config = {}) {
18
+ this.baseUrl = (config.baseUrl ?? "http://localhost:19428").replace(/\/$/, "");
19
+ this._fetch = config.fetch ?? globalThis.fetch.bind(globalThis);
20
+ }
21
+ static fromEnv(overrides = {}) {
22
+ const envUrl = typeof process !== "undefined" ? process.env?.["MEMENTOS_URL"] : undefined;
23
+ const baseUrl = envUrl ?? "http://localhost:19428";
24
+ return new MementosClient({ baseUrl, ...overrides });
25
+ }
26
+ async request(method, path, body, query) {
27
+ let url = `${this.baseUrl}${path}`;
28
+ if (query) {
29
+ const params = new URLSearchParams;
30
+ for (const [k, v] of Object.entries(query)) {
31
+ if (v !== undefined)
32
+ params.set(k, String(v));
33
+ }
34
+ const qs = params.toString();
35
+ if (qs)
36
+ url += `?${qs}`;
37
+ }
38
+ const res = await this._fetch(url, {
39
+ method,
40
+ headers: body !== undefined ? { "Content-Type": "application/json" } : {},
41
+ body: body !== undefined ? JSON.stringify(body) : undefined
42
+ });
43
+ if (!res.ok) {
44
+ let errBody = {};
45
+ try {
46
+ errBody = await res.json();
47
+ } catch {}
48
+ throw new MementosError(errBody.error ?? `HTTP ${res.status}`, res.status, errBody.details);
49
+ }
50
+ if (res.status === 204)
51
+ return;
52
+ return res.json();
53
+ }
54
+ get(path, query) {
55
+ return this.request("GET", path, undefined, query);
56
+ }
57
+ post(path, body) {
58
+ return this.request("POST", path, body);
59
+ }
60
+ patch(path, body) {
61
+ return this.request("PATCH", path, body);
62
+ }
63
+ delete(path) {
64
+ return this.request("DELETE", path);
65
+ }
66
+ async listMemories(filter = {}) {
67
+ const q = {};
68
+ if (filter.scope)
69
+ q["scope"] = filter.scope;
70
+ if (filter.category)
71
+ q["category"] = filter.category;
72
+ if (filter.tags?.length)
73
+ q["tags"] = filter.tags.join(",");
74
+ if (filter.min_importance !== undefined)
75
+ q["min_importance"] = filter.min_importance;
76
+ if (filter.pinned !== undefined)
77
+ q["pinned"] = filter.pinned;
78
+ if (filter.agent_id)
79
+ q["agent_id"] = filter.agent_id;
80
+ if (filter.project_id)
81
+ q["project_id"] = filter.project_id;
82
+ if (filter.session_id)
83
+ q["session_id"] = filter.session_id;
84
+ if (filter.namespace)
85
+ q["namespace"] = filter.namespace;
86
+ if (filter.status)
87
+ q["status"] = filter.status;
88
+ if (filter.limit !== undefined)
89
+ q["limit"] = filter.limit;
90
+ if (filter.offset !== undefined)
91
+ q["offset"] = filter.offset;
92
+ if (filter.fields?.length)
93
+ q["fields"] = filter.fields.join(",");
94
+ return this.get("/api/memories", q);
95
+ }
96
+ getStats() {
97
+ return this.get("/api/memories/stats");
98
+ }
99
+ getHealth() {
100
+ return this.get("/api/health");
101
+ }
102
+ getReport(options) {
103
+ return this.get("/api/report", options);
104
+ }
105
+ getStaleMemories(options) {
106
+ return this.get("/api/memories/stale", options);
107
+ }
108
+ getActivity(options) {
109
+ return this.get("/api/activity", options);
110
+ }
111
+ searchMemories(input) {
112
+ const body = typeof input === "string" ? { query: input } : input;
113
+ return this.post("/api/memories/search", body);
114
+ }
115
+ exportMemories(input = {}) {
116
+ return this.post("/api/memories/export", input);
117
+ }
118
+ importMemories(input) {
119
+ return this.post("/api/memories/import", input);
120
+ }
121
+ cleanExpired() {
122
+ return this.post("/api/memories/clean");
123
+ }
124
+ extractFromSession(input) {
125
+ return this.post("/api/memories/extract", input);
126
+ }
127
+ saveMemory(input) {
128
+ return this.post("/api/memories", input);
129
+ }
130
+ getMemory(id) {
131
+ return this.get(`/api/memories/${id}`);
132
+ }
133
+ getMemoryVersions(id) {
134
+ return this.get(`/api/memories/${id}/versions`);
135
+ }
136
+ updateMemory(id, input) {
137
+ return this.patch(`/api/memories/${id}`, input);
138
+ }
139
+ deleteMemory(id) {
140
+ return this.delete(`/api/memories/${id}`);
141
+ }
142
+ listAgents() {
143
+ return this.get("/api/agents");
144
+ }
145
+ registerAgent(input) {
146
+ return this.post("/api/agents", input);
147
+ }
148
+ getAgent(idOrName) {
149
+ return this.get(`/api/agents/${idOrName}`);
150
+ }
151
+ updateAgent(idOrName, updates) {
152
+ return this.patch(`/api/agents/${idOrName}`, updates);
153
+ }
154
+ listAgentsByProject(projectId) {
155
+ return this.get(`/api/agents`, { project_id: projectId });
156
+ }
157
+ listProjects() {
158
+ return this.get("/api/projects");
159
+ }
160
+ registerProject(input) {
161
+ return this.post("/api/projects", input);
162
+ }
163
+ getProject(idOrName) {
164
+ return this.get(`/api/projects/${encodeURIComponent(idOrName)}`);
165
+ }
166
+ getProjectAgents(idOrName) {
167
+ return this.get(`/api/projects/${encodeURIComponent(idOrName)}/agents`);
168
+ }
169
+ listEntities(filter) {
170
+ return this.get("/api/entities", filter);
171
+ }
172
+ createEntity(input) {
173
+ return this.post("/api/entities", input);
174
+ }
175
+ mergeEntities(input) {
176
+ return this.post("/api/entities/merge", input);
177
+ }
178
+ getEntity(id) {
179
+ return this.get(`/api/entities/${id}`);
180
+ }
181
+ updateEntity(id, input) {
182
+ return this.patch(`/api/entities/${id}`, input);
183
+ }
184
+ deleteEntity(id) {
185
+ return this.delete(`/api/entities/${id}`);
186
+ }
187
+ getEntityMemories(entityId) {
188
+ return this.get(`/api/entities/${entityId}/memories`);
189
+ }
190
+ linkEntityMemory(entityId, input) {
191
+ return this.post(`/api/entities/${entityId}/memories`, input);
192
+ }
193
+ unlinkEntityMemory(entityId, memoryId) {
194
+ return this.delete(`/api/entities/${entityId}/memories/${memoryId}`);
195
+ }
196
+ getEntityRelations(entityId, filter) {
197
+ return this.get(`/api/entities/${entityId}/relations`, filter);
198
+ }
199
+ createRelation(input) {
200
+ return this.post("/api/relations", input);
201
+ }
202
+ getRelation(id) {
203
+ return this.get(`/api/relations/${id}`);
204
+ }
205
+ deleteRelation(id) {
206
+ return this.delete(`/api/relations/${id}`);
207
+ }
208
+ getGraph(entityId, options) {
209
+ const q = {};
210
+ if (options?.depth !== undefined)
211
+ q["depth"] = options.depth;
212
+ if (options?.relation_types?.length)
213
+ q["relation_types"] = options.relation_types.join(",");
214
+ return this.get(`/api/graph/${entityId}`, q);
215
+ }
216
+ findPath(fromId, toId) {
217
+ return this.get("/api/graph/path", { from: fromId, to: toId });
218
+ }
219
+ getGraphStats() {
220
+ return this.get("/api/graph/stats");
221
+ }
222
+ async acquireLock(input) {
223
+ try {
224
+ return await this.post("/api/locks", input);
225
+ } catch (e) {
226
+ if (e instanceof Error && e.message.includes("409"))
227
+ return null;
228
+ throw e;
229
+ }
230
+ }
231
+ checkLock(resourceType, resourceId, lockType) {
232
+ const params = { resource_type: resourceType, resource_id: resourceId };
233
+ if (lockType)
234
+ params["lock_type"] = lockType;
235
+ return this.get("/api/locks", params);
236
+ }
237
+ releaseLock(lockId, agentId) {
238
+ return this.request("DELETE", `/api/locks/${lockId}`, { agent_id: agentId });
239
+ }
240
+ listAgentLocks(agentId) {
241
+ return this.get(`/api/agents/${agentId}/locks`);
242
+ }
243
+ releaseAllAgentLocks(agentId) {
244
+ return this.request("DELETE", `/api/agents/${agentId}/locks`);
245
+ }
246
+ cleanExpiredLocks() {
247
+ return this.post("/api/locks/clean", {});
248
+ }
249
+ createTask(input) {
250
+ return this.post("/api/tasks", input);
251
+ }
252
+ listTasks(filter = {}) {
253
+ const q = {};
254
+ if (filter.status)
255
+ q["status"] = filter.status;
256
+ if (filter.priority)
257
+ q["priority"] = filter.priority;
258
+ if (filter.assigned_agent_id)
259
+ q["assigned_agent_id"] = filter.assigned_agent_id;
260
+ if (filter.project_id)
261
+ q["project_id"] = filter.project_id;
262
+ if (filter.session_id)
263
+ q["session_id"] = filter.session_id;
264
+ if (filter.parent_task_id !== undefined) {
265
+ q["parent_task_id"] = filter.parent_task_id ?? "null";
266
+ }
267
+ if (filter.tags?.length)
268
+ q["tags"] = filter.tags.join(",");
269
+ if (filter.limit !== undefined)
270
+ q["limit"] = filter.limit;
271
+ if (filter.offset !== undefined)
272
+ q["offset"] = filter.offset;
273
+ return this.get("/api/tasks", q);
274
+ }
275
+ getTaskStats(options) {
276
+ return this.get("/api/tasks/stats", options);
277
+ }
278
+ getTask(id) {
279
+ return this.get(`/api/tasks/${id}`);
280
+ }
281
+ updateTask(id, input) {
282
+ return this.patch(`/api/tasks/${id}`, input);
283
+ }
284
+ deleteTask(id) {
285
+ return this.delete(`/api/tasks/${id}`);
286
+ }
287
+ listTaskComments(taskId) {
288
+ return this.get(`/api/tasks/${taskId}/comments`);
289
+ }
290
+ addTaskComment(taskId, body, agentId) {
291
+ return this.post(`/api/tasks/${taskId}/comments`, { body, agent_id: agentId });
292
+ }
293
+ deleteTaskComment(taskId, commentId) {
294
+ return this.delete(`/api/tasks/${taskId}/comments/${commentId}`);
295
+ }
296
+ getContext(options) {
297
+ return this.get("/api/inject", options);
298
+ }
299
+ processConversationTurn(turn, context) {
300
+ return this.post("/api/auto-memory/process", { turn, ...context });
301
+ }
302
+ getAutoMemoryStatus() {
303
+ return this.get("/api/auto-memory/status");
304
+ }
305
+ configureAutoMemory(config) {
306
+ return this.request("PATCH", "/api/auto-memory/config", config);
307
+ }
308
+ testExtraction(turn, options) {
309
+ return this.post("/api/auto-memory/test", { turn, ...options });
310
+ }
311
+ listHooks(type) {
312
+ const params = type ? `?type=${encodeURIComponent(type)}` : "";
313
+ return this.get(`/api/hooks${params}`);
314
+ }
315
+ getHookStats() {
316
+ return this.get("/api/hooks/stats");
317
+ }
318
+ listWebhooks(filter) {
319
+ const params = new URLSearchParams;
320
+ if (filter?.type)
321
+ params.set("type", filter.type);
322
+ if (filter?.enabled !== undefined)
323
+ params.set("enabled", String(filter.enabled));
324
+ const qs = params.toString() ? `?${params.toString()}` : "";
325
+ return this.get(`/api/webhooks${qs}`);
326
+ }
327
+ createWebhook(input) {
328
+ return this.post("/api/webhooks", input);
329
+ }
330
+ getWebhook(id) {
331
+ return this.get(`/api/webhooks/${id}`);
332
+ }
333
+ updateWebhook(id, updates) {
334
+ return this.request("PATCH", `/api/webhooks/${id}`, updates);
335
+ }
336
+ deleteWebhook(id) {
337
+ return this.request("DELETE", `/api/webhooks/${id}`);
338
+ }
339
+ enableWebhook(id) {
340
+ return this.updateWebhook(id, { enabled: true });
341
+ }
342
+ disableWebhook(id) {
343
+ return this.updateWebhook(id, { enabled: false });
344
+ }
345
+ runSynthesis(options) {
346
+ return this.post("/api/synthesis/run", options ?? {});
347
+ }
348
+ listSynthesisRuns(filter) {
349
+ const params = new URLSearchParams;
350
+ if (filter?.project_id)
351
+ params.set("project_id", filter.project_id);
352
+ if (filter?.limit)
353
+ params.set("limit", String(filter.limit));
354
+ const qs = params.toString() ? `?${params.toString()}` : "";
355
+ return this.get(`/api/synthesis/runs${qs}`);
356
+ }
357
+ getSynthesisStatus(options) {
358
+ const params = new URLSearchParams;
359
+ if (options?.project_id)
360
+ params.set("project_id", options.project_id);
361
+ if (options?.run_id)
362
+ params.set("run_id", options.run_id);
363
+ const qs = params.toString() ? `?${params.toString()}` : "";
364
+ return this.get(`/api/synthesis/status${qs}`);
365
+ }
366
+ rollbackSynthesis(runId) {
367
+ return this.post(`/api/synthesis/rollback/${runId}`, {});
368
+ }
369
+ ingestSession(input) {
370
+ return this.post("/api/sessions/ingest", input);
371
+ }
372
+ getSessionJob(jobId) {
373
+ return this.get(`/api/sessions/jobs/${jobId}`);
374
+ }
375
+ listSessionJobs(filter) {
376
+ const params = new URLSearchParams;
377
+ if (filter?.agent_id)
378
+ params.set("agent_id", filter.agent_id);
379
+ if (filter?.project_id)
380
+ params.set("project_id", filter.project_id);
381
+ if (filter?.status)
382
+ params.set("status", filter.status);
383
+ if (filter?.limit)
384
+ params.set("limit", String(filter.limit));
385
+ const qs = params.toString() ? `?${params.toString()}` : "";
386
+ return this.get(`/api/sessions/jobs${qs}`);
387
+ }
388
+ getSessionQueueStats() {
389
+ return this.get("/api/sessions/queue/stats");
390
+ }
391
+ }
392
+ var sdk_default = MementosClient;
393
+ export {
394
+ sdk_default as default,
395
+ MementosError,
396
+ MementosClient
397
+ };
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * Mementos REST API server.
4
+ * Usage: mementos-serve [--port 19428]
5
+ */
6
+ export declare function startServer(port: number): void;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AA6rDH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAkI9C"}