@hasna/mementos 0.14.31 → 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.
- package/LICENSE +190 -3
- package/README.md +30 -41
- package/dist/cli/brains.d.ts +3 -0
- package/dist/cli/brains.d.ts.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +25767 -0
- package/dist/db/acl.d.ts +34 -0
- package/dist/db/acl.d.ts.map +1 -0
- package/dist/db/agents.d.ts +15 -0
- package/dist/db/agents.d.ts.map +1 -0
- package/dist/db/audit.d.ts +39 -0
- package/dist/db/audit.d.ts.map +1 -0
- package/dist/db/database.d.ts +10 -0
- package/dist/db/database.d.ts.map +1 -0
- package/dist/db/entities.d.ts +62 -0
- package/dist/db/entities.d.ts.map +1 -0
- package/dist/db/entity-memories.d.ts +34 -0
- package/dist/db/entity-memories.d.ts.map +1 -0
- package/dist/db/locks.d.ts +63 -0
- package/dist/db/locks.d.ts.map +1 -0
- package/dist/db/machines.d.ts +16 -0
- package/dist/db/machines.d.ts.map +1 -0
- package/dist/db/memories.d.ts +40 -0
- package/dist/db/memories.d.ts.map +1 -0
- package/dist/db/pg-migrate.d.ts +14 -0
- package/dist/db/pg-migrate.d.ts.map +1 -0
- package/dist/db/pg-migrations.d.ts +8 -0
- package/dist/db/pg-migrations.d.ts.map +1 -0
- package/dist/db/projects.d.ts +6 -0
- package/dist/db/projects.d.ts.map +1 -0
- package/dist/db/ratings.d.ts +23 -0
- package/dist/db/ratings.d.ts.map +1 -0
- package/dist/db/relations.d.ts +29 -0
- package/dist/db/relations.d.ts.map +1 -0
- package/dist/db/session-jobs.d.ts +49 -0
- package/dist/db/session-jobs.d.ts.map +1 -0
- package/dist/db/synthesis.d.ts +101 -0
- package/dist/db/synthesis.d.ts.map +1 -0
- package/dist/db/tool-events.d.ts +27 -0
- package/dist/db/tool-events.d.ts.map +1 -0
- package/dist/db/webhook_hooks.d.ts +25 -0
- package/dist/db/webhook_hooks.d.ts.map +1 -0
- package/dist/index.d.ts +27 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14642 -1018
- package/dist/lib/activation-matcher.d.ts +16 -0
- package/dist/lib/activation-matcher.d.ts.map +1 -0
- package/dist/lib/asmr/categorizer.d.ts +31 -0
- package/dist/lib/asmr/categorizer.d.ts.map +1 -0
- package/dist/lib/asmr/context-agent.d.ts +4 -0
- package/dist/lib/asmr/context-agent.d.ts.map +1 -0
- package/dist/lib/asmr/ensemble.d.ts +23 -0
- package/dist/lib/asmr/ensemble.d.ts.map +1 -0
- package/dist/lib/asmr/fact-agent.d.ts +4 -0
- package/dist/lib/asmr/fact-agent.d.ts.map +1 -0
- package/dist/lib/asmr/index.d.ts +7 -0
- package/dist/lib/asmr/index.d.ts.map +1 -0
- package/dist/lib/asmr/orchestrator.d.ts +4 -0
- package/dist/lib/asmr/orchestrator.d.ts.map +1 -0
- package/dist/lib/asmr/temporal-agent.d.ts +4 -0
- package/dist/lib/asmr/temporal-agent.d.ts.map +1 -0
- package/dist/lib/asmr/types.d.ts +27 -0
- package/dist/lib/asmr/types.d.ts.map +1 -0
- package/dist/lib/auto-inject-orchestrator.d.ts +57 -0
- package/dist/lib/auto-inject-orchestrator.d.ts.map +1 -0
- package/dist/lib/auto-memory-queue.d.ts +46 -0
- package/dist/lib/auto-memory-queue.d.ts.map +1 -0
- package/dist/lib/auto-memory.d.ts +18 -0
- package/dist/lib/auto-memory.d.ts.map +1 -0
- package/dist/lib/bench.d.ts +20 -0
- package/dist/lib/bench.d.ts.map +1 -0
- package/dist/lib/built-in-hooks.d.ts +12 -0
- package/dist/lib/built-in-hooks.d.ts.map +1 -0
- package/dist/lib/channel-pusher.d.ts +39 -0
- package/dist/lib/channel-pusher.d.ts.map +1 -0
- package/dist/lib/config.d.ts +9 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/connectors/files.d.ts +8 -0
- package/dist/lib/connectors/files.d.ts.map +1 -0
- package/dist/lib/connectors/github.d.ts +7 -0
- package/dist/lib/connectors/github.d.ts.map +1 -0
- package/dist/lib/connectors/index.d.ts +12 -0
- package/dist/lib/connectors/index.d.ts.map +1 -0
- package/dist/lib/connectors/notion.d.ts +7 -0
- package/dist/lib/connectors/notion.d.ts.map +1 -0
- package/dist/lib/connectors/types.d.ts +27 -0
- package/dist/lib/connectors/types.d.ts.map +1 -0
- package/dist/lib/context-extractor.d.ts +14 -0
- package/dist/lib/context-extractor.d.ts.map +1 -0
- package/dist/lib/context.d.ts +35 -0
- package/dist/lib/context.d.ts.map +1 -0
- package/dist/lib/contradiction.d.ts +50 -0
- package/dist/lib/contradiction.d.ts.map +1 -0
- package/dist/lib/decay.d.ts +35 -0
- package/dist/lib/decay.d.ts.map +1 -0
- package/dist/lib/dedup.d.ts +33 -0
- package/dist/lib/dedup.d.ts.map +1 -0
- package/dist/lib/duration.d.ts +28 -0
- package/dist/lib/duration.d.ts.map +1 -0
- package/dist/lib/embeddings.d.ts +20 -0
- package/dist/lib/embeddings.d.ts.map +1 -0
- package/dist/lib/export-v1.d.ts +30 -0
- package/dist/lib/export-v1.d.ts.map +1 -0
- package/dist/lib/extractor.d.ts +9 -0
- package/dist/lib/extractor.d.ts.map +1 -0
- package/dist/lib/extractors/audio.d.ts +8 -0
- package/dist/lib/extractors/audio.d.ts.map +1 -0
- package/dist/lib/extractors/index.d.ts +12 -0
- package/dist/lib/extractors/index.d.ts.map +1 -0
- package/dist/lib/extractors/ocr.d.ts +7 -0
- package/dist/lib/extractors/ocr.d.ts.map +1 -0
- package/dist/lib/extractors/pdf.d.ts +7 -0
- package/dist/lib/extractors/pdf.d.ts.map +1 -0
- package/dist/lib/extractors/types.d.ts +12 -0
- package/dist/lib/extractors/types.d.ts.map +1 -0
- package/dist/lib/file-deps.d.ts +27 -0
- package/dist/lib/file-deps.d.ts.map +1 -0
- package/dist/lib/focus.d.ts +58 -0
- package/dist/lib/focus.d.ts.map +1 -0
- package/dist/lib/gatherer.d.ts +16 -0
- package/dist/lib/gatherer.d.ts.map +1 -0
- package/dist/lib/gdpr.d.ts +24 -0
- package/dist/lib/gdpr.d.ts.map +1 -0
- package/dist/lib/hooks.d.ts +50 -0
- package/dist/lib/hooks.d.ts.map +1 -0
- package/dist/lib/importers/index.d.ts +38 -0
- package/dist/lib/importers/index.d.ts.map +1 -0
- package/dist/lib/injector.d.ts +86 -0
- package/dist/lib/injector.d.ts.map +1 -0
- package/dist/lib/matryoshka.d.ts +50 -0
- package/dist/lib/matryoshka.d.ts.map +1 -0
- package/dist/lib/memory-lock.d.ts +58 -0
- package/dist/lib/memory-lock.d.ts.map +1 -0
- package/dist/lib/model-config.d.ts +14 -0
- package/dist/lib/model-config.d.ts.map +1 -0
- package/dist/lib/open-sessions-connector.d.ts +60 -0
- package/dist/lib/open-sessions-connector.d.ts.map +1 -0
- package/dist/lib/poisoning.d.ts +19 -0
- package/dist/lib/poisoning.d.ts.map +1 -0
- package/dist/lib/poll.d.ts +17 -0
- package/dist/lib/poll.d.ts.map +1 -0
- package/dist/lib/procedural-extractor.d.ts +21 -0
- package/dist/lib/procedural-extractor.d.ts.map +1 -0
- package/dist/lib/profile-sync.d.ts +20 -0
- package/dist/lib/profile-sync.d.ts.map +1 -0
- package/dist/lib/profile-synthesizer.d.ts +20 -0
- package/dist/lib/profile-synthesizer.d.ts.map +1 -0
- package/dist/lib/project-detect.d.ts +18 -0
- package/dist/lib/project-detect.d.ts.map +1 -0
- package/dist/lib/providers/anthropic.d.ts +21 -0
- package/dist/lib/providers/anthropic.d.ts.map +1 -0
- package/dist/lib/providers/base.d.ts +96 -0
- package/dist/lib/providers/base.d.ts.map +1 -0
- package/dist/lib/providers/cerebras.d.ts +20 -0
- package/dist/lib/providers/cerebras.d.ts.map +1 -0
- package/dist/lib/providers/grok.d.ts +19 -0
- package/dist/lib/providers/grok.d.ts.map +1 -0
- package/dist/lib/providers/index.d.ts +7 -0
- package/dist/lib/providers/index.d.ts.map +1 -0
- package/dist/lib/providers/openai-compat.d.ts +18 -0
- package/dist/lib/providers/openai-compat.d.ts.map +1 -0
- package/dist/lib/providers/openai.d.ts +20 -0
- package/dist/lib/providers/openai.d.ts.map +1 -0
- package/dist/lib/providers/registry.d.ts +38 -0
- package/dist/lib/providers/registry.d.ts.map +1 -0
- package/dist/lib/quality.d.ts +16 -0
- package/dist/lib/quality.d.ts.map +1 -0
- package/dist/lib/redact.d.ts +10 -0
- package/dist/lib/redact.d.ts.map +1 -0
- package/dist/lib/remote-sync.d.ts +49 -0
- package/dist/lib/remote-sync.d.ts.map +1 -0
- package/dist/lib/retention.d.ts +17 -0
- package/dist/lib/retention.d.ts.map +1 -0
- package/dist/lib/search.d.ts +52 -0
- package/dist/lib/search.d.ts.map +1 -0
- package/dist/lib/session-auto-resolve.d.ts +28 -0
- package/dist/lib/session-auto-resolve.d.ts.map +1 -0
- package/dist/lib/session-processor.d.ts +38 -0
- package/dist/lib/session-processor.d.ts.map +1 -0
- package/dist/lib/session-queue.d.ts +28 -0
- package/dist/lib/session-queue.d.ts.map +1 -0
- package/dist/lib/session-registry.d.ts +47 -0
- package/dist/lib/session-registry.d.ts.map +1 -0
- package/dist/lib/session-start-briefing.d.ts +10 -0
- package/dist/lib/session-start-briefing.d.ts.map +1 -0
- package/dist/lib/session-watcher.d.ts +30 -0
- package/dist/lib/session-watcher.d.ts.map +1 -0
- package/dist/lib/sync.d.ts +10 -0
- package/dist/lib/sync.d.ts.map +1 -0
- package/dist/lib/synthesis/corpus-builder.d.ts +30 -0
- package/dist/lib/synthesis/corpus-builder.d.ts.map +1 -0
- package/dist/lib/synthesis/executor.d.ts +14 -0
- package/dist/lib/synthesis/executor.d.ts.map +1 -0
- package/dist/lib/synthesis/index.d.ts +37 -0
- package/dist/lib/synthesis/index.d.ts.map +1 -0
- package/dist/lib/synthesis/llm-analyzer.d.ts +18 -0
- package/dist/lib/synthesis/llm-analyzer.d.ts.map +1 -0
- package/dist/lib/synthesis/metrics.d.ts +13 -0
- package/dist/lib/synthesis/metrics.d.ts.map +1 -0
- package/dist/lib/synthesis/scheduler.d.ts +18 -0
- package/dist/lib/synthesis/scheduler.d.ts.map +1 -0
- package/dist/lib/synthesis/validator.d.ts +19 -0
- package/dist/lib/synthesis/validator.d.ts.map +1 -0
- package/dist/lib/tool-lesson-extractor.d.ts +24 -0
- package/dist/lib/tool-lesson-extractor.d.ts.map +1 -0
- package/dist/lib/tool-memory-synthesizer.d.ts +28 -0
- package/dist/lib/tool-memory-synthesizer.d.ts.map +1 -0
- package/dist/lib/topic-clusterer.d.ts +21 -0
- package/dist/lib/topic-clusterer.d.ts.map +1 -0
- package/dist/lib/when-to-use-generator.d.ts +22 -0
- package/dist/lib/when-to-use-generator.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +30258 -0
- package/dist/mcp/memory-broadcast.d.ts +12 -0
- package/dist/mcp/memory-broadcast.d.ts.map +1 -0
- package/dist/sdk/index.js +397 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +18250 -0
- package/dist/types/hooks.d.ts +136 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/index.d.ts +345 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +53 -13
- package/dist/agent-setup.d.ts +0 -51
- package/dist/agent-setup.d.ts.map +0 -1
- package/dist/bridge.d.ts +0 -50
- package/dist/bridge.d.ts.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -1434
- package/dist/mcp-runtime.d.ts +0 -24
- package/dist/mcp-runtime.d.ts.map +0 -1
- package/dist/mcp.d.ts +0 -3
- package/dist/mcp.d.ts.map +0 -1
- package/dist/mcp.js +0 -366
- package/dist/remote-client.d.ts +0 -51
- 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 @@
|
|
|
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"}
|