@hasna/mementos 0.14.21 → 0.14.22

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 (239) hide show
  1. package/LICENSE +3 -189
  2. package/README.md +15 -27
  3. package/dist/agent-setup.d.ts +34 -0
  4. package/dist/agent-setup.d.ts.map +1 -0
  5. package/dist/cli.d.ts +3 -0
  6. package/dist/cli.d.ts.map +1 -0
  7. package/dist/cli.js +517 -0
  8. package/dist/index.d.ts +3 -27
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +455 -14652
  11. package/dist/mcp-runtime.d.ts +23 -0
  12. package/dist/mcp-runtime.d.ts.map +1 -0
  13. package/dist/mcp.d.ts +3 -0
  14. package/dist/mcp.d.ts.map +1 -0
  15. package/dist/mcp.js +300 -0
  16. package/dist/remote-client.d.ts +44 -0
  17. package/dist/remote-client.d.ts.map +1 -0
  18. package/package.json +13 -53
  19. package/dashboard/dist/assets/index-DqyMbv89.js +0 -270
  20. package/dashboard/dist/assets/index-UBCddFo_.css +0 -1
  21. package/dashboard/dist/index.html +0 -13
  22. package/dist/cli/brains.d.ts +0 -3
  23. package/dist/cli/brains.d.ts.map +0 -1
  24. package/dist/cli/index.d.ts +0 -3
  25. package/dist/cli/index.d.ts.map +0 -1
  26. package/dist/cli/index.js +0 -25738
  27. package/dist/db/acl.d.ts +0 -34
  28. package/dist/db/acl.d.ts.map +0 -1
  29. package/dist/db/agents.d.ts +0 -15
  30. package/dist/db/agents.d.ts.map +0 -1
  31. package/dist/db/audit.d.ts +0 -39
  32. package/dist/db/audit.d.ts.map +0 -1
  33. package/dist/db/database.d.ts +0 -10
  34. package/dist/db/database.d.ts.map +0 -1
  35. package/dist/db/entities.d.ts +0 -62
  36. package/dist/db/entities.d.ts.map +0 -1
  37. package/dist/db/entity-memories.d.ts +0 -34
  38. package/dist/db/entity-memories.d.ts.map +0 -1
  39. package/dist/db/locks.d.ts +0 -63
  40. package/dist/db/locks.d.ts.map +0 -1
  41. package/dist/db/machines.d.ts +0 -16
  42. package/dist/db/machines.d.ts.map +0 -1
  43. package/dist/db/memories.d.ts +0 -40
  44. package/dist/db/memories.d.ts.map +0 -1
  45. package/dist/db/pg-migrations.d.ts +0 -8
  46. package/dist/db/pg-migrations.d.ts.map +0 -1
  47. package/dist/db/projects.d.ts +0 -6
  48. package/dist/db/projects.d.ts.map +0 -1
  49. package/dist/db/ratings.d.ts +0 -23
  50. package/dist/db/ratings.d.ts.map +0 -1
  51. package/dist/db/relations.d.ts +0 -29
  52. package/dist/db/relations.d.ts.map +0 -1
  53. package/dist/db/session-jobs.d.ts +0 -49
  54. package/dist/db/session-jobs.d.ts.map +0 -1
  55. package/dist/db/synthesis.d.ts +0 -101
  56. package/dist/db/synthesis.d.ts.map +0 -1
  57. package/dist/db/tool-events.d.ts +0 -27
  58. package/dist/db/tool-events.d.ts.map +0 -1
  59. package/dist/db/webhook_hooks.d.ts +0 -25
  60. package/dist/db/webhook_hooks.d.ts.map +0 -1
  61. package/dist/lib/activation-matcher.d.ts +0 -16
  62. package/dist/lib/activation-matcher.d.ts.map +0 -1
  63. package/dist/lib/asmr/categorizer.d.ts +0 -31
  64. package/dist/lib/asmr/categorizer.d.ts.map +0 -1
  65. package/dist/lib/asmr/context-agent.d.ts +0 -4
  66. package/dist/lib/asmr/context-agent.d.ts.map +0 -1
  67. package/dist/lib/asmr/ensemble.d.ts +0 -23
  68. package/dist/lib/asmr/ensemble.d.ts.map +0 -1
  69. package/dist/lib/asmr/fact-agent.d.ts +0 -4
  70. package/dist/lib/asmr/fact-agent.d.ts.map +0 -1
  71. package/dist/lib/asmr/index.d.ts +0 -7
  72. package/dist/lib/asmr/index.d.ts.map +0 -1
  73. package/dist/lib/asmr/orchestrator.d.ts +0 -4
  74. package/dist/lib/asmr/orchestrator.d.ts.map +0 -1
  75. package/dist/lib/asmr/temporal-agent.d.ts +0 -4
  76. package/dist/lib/asmr/temporal-agent.d.ts.map +0 -1
  77. package/dist/lib/asmr/types.d.ts +0 -27
  78. package/dist/lib/asmr/types.d.ts.map +0 -1
  79. package/dist/lib/auto-inject-orchestrator.d.ts +0 -57
  80. package/dist/lib/auto-inject-orchestrator.d.ts.map +0 -1
  81. package/dist/lib/auto-memory-queue.d.ts +0 -46
  82. package/dist/lib/auto-memory-queue.d.ts.map +0 -1
  83. package/dist/lib/auto-memory.d.ts +0 -18
  84. package/dist/lib/auto-memory.d.ts.map +0 -1
  85. package/dist/lib/bench.d.ts +0 -20
  86. package/dist/lib/bench.d.ts.map +0 -1
  87. package/dist/lib/built-in-hooks.d.ts +0 -12
  88. package/dist/lib/built-in-hooks.d.ts.map +0 -1
  89. package/dist/lib/channel-pusher.d.ts +0 -39
  90. package/dist/lib/channel-pusher.d.ts.map +0 -1
  91. package/dist/lib/config.d.ts +0 -9
  92. package/dist/lib/config.d.ts.map +0 -1
  93. package/dist/lib/connectors/files.d.ts +0 -8
  94. package/dist/lib/connectors/files.d.ts.map +0 -1
  95. package/dist/lib/connectors/github.d.ts +0 -7
  96. package/dist/lib/connectors/github.d.ts.map +0 -1
  97. package/dist/lib/connectors/index.d.ts +0 -12
  98. package/dist/lib/connectors/index.d.ts.map +0 -1
  99. package/dist/lib/connectors/notion.d.ts +0 -7
  100. package/dist/lib/connectors/notion.d.ts.map +0 -1
  101. package/dist/lib/connectors/types.d.ts +0 -27
  102. package/dist/lib/connectors/types.d.ts.map +0 -1
  103. package/dist/lib/context-extractor.d.ts +0 -14
  104. package/dist/lib/context-extractor.d.ts.map +0 -1
  105. package/dist/lib/context.d.ts +0 -35
  106. package/dist/lib/context.d.ts.map +0 -1
  107. package/dist/lib/contradiction.d.ts +0 -50
  108. package/dist/lib/contradiction.d.ts.map +0 -1
  109. package/dist/lib/decay.d.ts +0 -35
  110. package/dist/lib/decay.d.ts.map +0 -1
  111. package/dist/lib/dedup.d.ts +0 -33
  112. package/dist/lib/dedup.d.ts.map +0 -1
  113. package/dist/lib/duration.d.ts +0 -28
  114. package/dist/lib/duration.d.ts.map +0 -1
  115. package/dist/lib/embeddings.d.ts +0 -20
  116. package/dist/lib/embeddings.d.ts.map +0 -1
  117. package/dist/lib/export-v1.d.ts +0 -30
  118. package/dist/lib/export-v1.d.ts.map +0 -1
  119. package/dist/lib/extractor.d.ts +0 -9
  120. package/dist/lib/extractor.d.ts.map +0 -1
  121. package/dist/lib/extractors/audio.d.ts +0 -8
  122. package/dist/lib/extractors/audio.d.ts.map +0 -1
  123. package/dist/lib/extractors/index.d.ts +0 -12
  124. package/dist/lib/extractors/index.d.ts.map +0 -1
  125. package/dist/lib/extractors/ocr.d.ts +0 -7
  126. package/dist/lib/extractors/ocr.d.ts.map +0 -1
  127. package/dist/lib/extractors/pdf.d.ts +0 -7
  128. package/dist/lib/extractors/pdf.d.ts.map +0 -1
  129. package/dist/lib/extractors/types.d.ts +0 -12
  130. package/dist/lib/extractors/types.d.ts.map +0 -1
  131. package/dist/lib/file-deps.d.ts +0 -27
  132. package/dist/lib/file-deps.d.ts.map +0 -1
  133. package/dist/lib/focus.d.ts +0 -58
  134. package/dist/lib/focus.d.ts.map +0 -1
  135. package/dist/lib/gatherer.d.ts +0 -16
  136. package/dist/lib/gatherer.d.ts.map +0 -1
  137. package/dist/lib/gdpr.d.ts +0 -24
  138. package/dist/lib/gdpr.d.ts.map +0 -1
  139. package/dist/lib/hooks.d.ts +0 -50
  140. package/dist/lib/hooks.d.ts.map +0 -1
  141. package/dist/lib/importers/index.d.ts +0 -38
  142. package/dist/lib/importers/index.d.ts.map +0 -1
  143. package/dist/lib/injector.d.ts +0 -86
  144. package/dist/lib/injector.d.ts.map +0 -1
  145. package/dist/lib/matryoshka.d.ts +0 -50
  146. package/dist/lib/matryoshka.d.ts.map +0 -1
  147. package/dist/lib/memory-lock.d.ts +0 -58
  148. package/dist/lib/memory-lock.d.ts.map +0 -1
  149. package/dist/lib/model-config.d.ts +0 -14
  150. package/dist/lib/model-config.d.ts.map +0 -1
  151. package/dist/lib/open-sessions-connector.d.ts +0 -60
  152. package/dist/lib/open-sessions-connector.d.ts.map +0 -1
  153. package/dist/lib/poisoning.d.ts +0 -19
  154. package/dist/lib/poisoning.d.ts.map +0 -1
  155. package/dist/lib/poll.d.ts +0 -17
  156. package/dist/lib/poll.d.ts.map +0 -1
  157. package/dist/lib/procedural-extractor.d.ts +0 -21
  158. package/dist/lib/procedural-extractor.d.ts.map +0 -1
  159. package/dist/lib/profile-sync.d.ts +0 -20
  160. package/dist/lib/profile-sync.d.ts.map +0 -1
  161. package/dist/lib/profile-synthesizer.d.ts +0 -20
  162. package/dist/lib/profile-synthesizer.d.ts.map +0 -1
  163. package/dist/lib/project-detect.d.ts +0 -18
  164. package/dist/lib/project-detect.d.ts.map +0 -1
  165. package/dist/lib/providers/anthropic.d.ts +0 -21
  166. package/dist/lib/providers/anthropic.d.ts.map +0 -1
  167. package/dist/lib/providers/base.d.ts +0 -96
  168. package/dist/lib/providers/base.d.ts.map +0 -1
  169. package/dist/lib/providers/cerebras.d.ts +0 -20
  170. package/dist/lib/providers/cerebras.d.ts.map +0 -1
  171. package/dist/lib/providers/grok.d.ts +0 -19
  172. package/dist/lib/providers/grok.d.ts.map +0 -1
  173. package/dist/lib/providers/index.d.ts +0 -7
  174. package/dist/lib/providers/index.d.ts.map +0 -1
  175. package/dist/lib/providers/openai-compat.d.ts +0 -18
  176. package/dist/lib/providers/openai-compat.d.ts.map +0 -1
  177. package/dist/lib/providers/openai.d.ts +0 -20
  178. package/dist/lib/providers/openai.d.ts.map +0 -1
  179. package/dist/lib/providers/registry.d.ts +0 -38
  180. package/dist/lib/providers/registry.d.ts.map +0 -1
  181. package/dist/lib/quality.d.ts +0 -16
  182. package/dist/lib/quality.d.ts.map +0 -1
  183. package/dist/lib/redact.d.ts +0 -10
  184. package/dist/lib/redact.d.ts.map +0 -1
  185. package/dist/lib/remote-sync.d.ts +0 -49
  186. package/dist/lib/remote-sync.d.ts.map +0 -1
  187. package/dist/lib/retention.d.ts +0 -17
  188. package/dist/lib/retention.d.ts.map +0 -1
  189. package/dist/lib/search.d.ts +0 -52
  190. package/dist/lib/search.d.ts.map +0 -1
  191. package/dist/lib/session-auto-resolve.d.ts +0 -28
  192. package/dist/lib/session-auto-resolve.d.ts.map +0 -1
  193. package/dist/lib/session-processor.d.ts +0 -38
  194. package/dist/lib/session-processor.d.ts.map +0 -1
  195. package/dist/lib/session-queue.d.ts +0 -28
  196. package/dist/lib/session-queue.d.ts.map +0 -1
  197. package/dist/lib/session-registry.d.ts +0 -47
  198. package/dist/lib/session-registry.d.ts.map +0 -1
  199. package/dist/lib/session-start-briefing.d.ts +0 -10
  200. package/dist/lib/session-start-briefing.d.ts.map +0 -1
  201. package/dist/lib/session-watcher.d.ts +0 -30
  202. package/dist/lib/session-watcher.d.ts.map +0 -1
  203. package/dist/lib/sync.d.ts +0 -10
  204. package/dist/lib/sync.d.ts.map +0 -1
  205. package/dist/lib/synthesis/corpus-builder.d.ts +0 -30
  206. package/dist/lib/synthesis/corpus-builder.d.ts.map +0 -1
  207. package/dist/lib/synthesis/executor.d.ts +0 -14
  208. package/dist/lib/synthesis/executor.d.ts.map +0 -1
  209. package/dist/lib/synthesis/index.d.ts +0 -37
  210. package/dist/lib/synthesis/index.d.ts.map +0 -1
  211. package/dist/lib/synthesis/llm-analyzer.d.ts +0 -18
  212. package/dist/lib/synthesis/llm-analyzer.d.ts.map +0 -1
  213. package/dist/lib/synthesis/metrics.d.ts +0 -13
  214. package/dist/lib/synthesis/metrics.d.ts.map +0 -1
  215. package/dist/lib/synthesis/scheduler.d.ts +0 -18
  216. package/dist/lib/synthesis/scheduler.d.ts.map +0 -1
  217. package/dist/lib/synthesis/validator.d.ts +0 -19
  218. package/dist/lib/synthesis/validator.d.ts.map +0 -1
  219. package/dist/lib/tool-lesson-extractor.d.ts +0 -24
  220. package/dist/lib/tool-lesson-extractor.d.ts.map +0 -1
  221. package/dist/lib/tool-memory-synthesizer.d.ts +0 -28
  222. package/dist/lib/tool-memory-synthesizer.d.ts.map +0 -1
  223. package/dist/lib/topic-clusterer.d.ts +0 -21
  224. package/dist/lib/topic-clusterer.d.ts.map +0 -1
  225. package/dist/lib/when-to-use-generator.d.ts +0 -22
  226. package/dist/lib/when-to-use-generator.d.ts.map +0 -1
  227. package/dist/mcp/index.d.ts +0 -5
  228. package/dist/mcp/index.d.ts.map +0 -1
  229. package/dist/mcp/index.js +0 -30113
  230. package/dist/mcp/memory-broadcast.d.ts +0 -12
  231. package/dist/mcp/memory-broadcast.d.ts.map +0 -1
  232. package/dist/sdk/index.js +0 -397
  233. package/dist/server/index.d.ts +0 -7
  234. package/dist/server/index.d.ts.map +0 -1
  235. package/dist/server/index.js +0 -18221
  236. package/dist/types/hooks.d.ts +0 -136
  237. package/dist/types/hooks.d.ts.map +0 -1
  238. package/dist/types/index.d.ts +0 -345
  239. package/dist/types/index.d.ts.map +0 -1
@@ -1,12 +0,0 @@
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
@@ -1 +0,0 @@
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"}
package/dist/sdk/index.js DELETED
@@ -1,397 +0,0 @@
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
- };
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
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"}