@hasna/mementos 0.10.1 → 0.10.2
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/dist/cli/index.js +50 -9
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/locks.d.ts +1 -1
- package/dist/db/locks.d.ts.map +1 -1
- package/dist/index.js +20 -0
- package/dist/mcp/index.js +27 -3
- package/dist/server/index.js +25 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -6,39 +6,60 @@ var __defProp = Object.defineProperty;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
function __accessProp(key) {
|
|
10
|
+
return this[key];
|
|
11
|
+
}
|
|
12
|
+
var __toESMCache_node;
|
|
13
|
+
var __toESMCache_esm;
|
|
9
14
|
var __toESM = (mod, isNodeMode, target) => {
|
|
15
|
+
var canCache = mod != null && typeof mod === "object";
|
|
16
|
+
if (canCache) {
|
|
17
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
18
|
+
var cached = cache.get(mod);
|
|
19
|
+
if (cached)
|
|
20
|
+
return cached;
|
|
21
|
+
}
|
|
10
22
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
11
23
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
12
24
|
for (let key of __getOwnPropNames(mod))
|
|
13
25
|
if (!__hasOwnProp.call(to, key))
|
|
14
26
|
__defProp(to, key, {
|
|
15
|
-
get: (
|
|
27
|
+
get: __accessProp.bind(mod, key),
|
|
16
28
|
enumerable: true
|
|
17
29
|
});
|
|
30
|
+
if (canCache)
|
|
31
|
+
cache.set(mod, to);
|
|
18
32
|
return to;
|
|
19
33
|
};
|
|
20
|
-
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
21
34
|
var __toCommonJS = (from) => {
|
|
22
|
-
var entry = __moduleCache.get(from), desc;
|
|
35
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
23
36
|
if (entry)
|
|
24
37
|
return entry;
|
|
25
38
|
entry = __defProp({}, "__esModule", { value: true });
|
|
26
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
40
|
+
for (var key of __getOwnPropNames(from))
|
|
41
|
+
if (!__hasOwnProp.call(entry, key))
|
|
42
|
+
__defProp(entry, key, {
|
|
43
|
+
get: __accessProp.bind(from, key),
|
|
44
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
45
|
+
});
|
|
46
|
+
}
|
|
31
47
|
__moduleCache.set(from, entry);
|
|
32
48
|
return entry;
|
|
33
49
|
};
|
|
50
|
+
var __moduleCache;
|
|
34
51
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
52
|
+
var __returnValue = (v) => v;
|
|
53
|
+
function __exportSetter(name, newValue) {
|
|
54
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
55
|
+
}
|
|
35
56
|
var __export = (target, all) => {
|
|
36
57
|
for (var name in all)
|
|
37
58
|
__defProp(target, name, {
|
|
38
59
|
get: all[name],
|
|
39
60
|
enumerable: true,
|
|
40
61
|
configurable: true,
|
|
41
|
-
set: (
|
|
62
|
+
set: __exportSetter.bind(all, name)
|
|
42
63
|
});
|
|
43
64
|
};
|
|
44
65
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -2543,6 +2564,26 @@ CREATE INDEX IF NOT EXISTS idx_session_memory_jobs_agent ON session_memory_jobs(
|
|
|
2543
2564
|
CREATE INDEX IF NOT EXISTS idx_session_memory_jobs_project ON session_memory_jobs(project_id);
|
|
2544
2565
|
CREATE INDEX IF NOT EXISTS idx_session_memory_jobs_session ON session_memory_jobs(session_id);
|
|
2545
2566
|
INSERT OR IGNORE INTO _migrations (id) VALUES (13);
|
|
2567
|
+
`,
|
|
2568
|
+
`
|
|
2569
|
+
ALTER TABLE resource_locks RENAME TO resource_locks_old;
|
|
2570
|
+
CREATE TABLE resource_locks (
|
|
2571
|
+
id TEXT PRIMARY KEY,
|
|
2572
|
+
resource_type TEXT NOT NULL CHECK(resource_type IN ('project', 'memory', 'entity', 'agent', 'connector', 'file')),
|
|
2573
|
+
resource_id TEXT NOT NULL,
|
|
2574
|
+
agent_id TEXT NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
|
|
2575
|
+
lock_type TEXT NOT NULL DEFAULT 'exclusive' CHECK(lock_type IN ('advisory', 'exclusive')),
|
|
2576
|
+
locked_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
2577
|
+
expires_at TEXT NOT NULL
|
|
2578
|
+
);
|
|
2579
|
+
INSERT INTO resource_locks SELECT * FROM resource_locks_old;
|
|
2580
|
+
DROP TABLE resource_locks_old;
|
|
2581
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_resource_locks_exclusive
|
|
2582
|
+
ON resource_locks(resource_type, resource_id)
|
|
2583
|
+
WHERE lock_type = 'exclusive';
|
|
2584
|
+
CREATE INDEX IF NOT EXISTS idx_resource_locks_agent ON resource_locks(agent_id);
|
|
2585
|
+
CREATE INDEX IF NOT EXISTS idx_resource_locks_expires ON resource_locks(expires_at);
|
|
2586
|
+
INSERT OR IGNORE INTO _migrations (id) VALUES (14);
|
|
2546
2587
|
`
|
|
2547
2588
|
];
|
|
2548
2589
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmCtC,wBAAgB,SAAS,IAAI,MAAM,CAkBlC;
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmCtC,wBAAgB,SAAS,IAAI,MAAM,CAkBlC;AA6ZD,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAerD;AA+BD,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED,wBAAgB,GAAG,IAAI,MAAM,CAE5B;AAED,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAef"}
|
package/dist/db/locks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Database } from "bun:sqlite";
|
|
2
|
-
export type ResourceType = "project" | "memory" | "entity" | "agent" | "connector";
|
|
2
|
+
export type ResourceType = "project" | "memory" | "entity" | "agent" | "connector" | "file";
|
|
3
3
|
export type LockType = "advisory" | "exclusive";
|
|
4
4
|
export interface ResourceLock {
|
|
5
5
|
id: string;
|
package/dist/db/locks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locks.d.ts","sourceRoot":"","sources":["../../src/db/locks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"locks.d.ts","sourceRoot":"","sources":["../../src/db/locks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM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cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,QAAQ,EACnB,EAAE,CAAC,EAAE,QAAQ,GACZ,YAAY,GAAG,IAAI,CAcrB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,YAAY,EAAE,CAS7E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CAIvD"}
|
package/dist/index.js
CHANGED
|
@@ -457,6 +457,26 @@ CREATE INDEX IF NOT EXISTS idx_session_memory_jobs_agent ON session_memory_jobs(
|
|
|
457
457
|
CREATE INDEX IF NOT EXISTS idx_session_memory_jobs_project ON session_memory_jobs(project_id);
|
|
458
458
|
CREATE INDEX IF NOT EXISTS idx_session_memory_jobs_session ON session_memory_jobs(session_id);
|
|
459
459
|
INSERT OR IGNORE INTO _migrations (id) VALUES (13);
|
|
460
|
+
`,
|
|
461
|
+
`
|
|
462
|
+
ALTER TABLE resource_locks RENAME TO resource_locks_old;
|
|
463
|
+
CREATE TABLE resource_locks (
|
|
464
|
+
id TEXT PRIMARY KEY,
|
|
465
|
+
resource_type TEXT NOT NULL CHECK(resource_type IN ('project', 'memory', 'entity', 'agent', 'connector', 'file')),
|
|
466
|
+
resource_id TEXT NOT NULL,
|
|
467
|
+
agent_id TEXT NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
|
|
468
|
+
lock_type TEXT NOT NULL DEFAULT 'exclusive' CHECK(lock_type IN ('advisory', 'exclusive')),
|
|
469
|
+
locked_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
470
|
+
expires_at TEXT NOT NULL
|
|
471
|
+
);
|
|
472
|
+
INSERT INTO resource_locks SELECT * FROM resource_locks_old;
|
|
473
|
+
DROP TABLE resource_locks_old;
|
|
474
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_resource_locks_exclusive
|
|
475
|
+
ON resource_locks(resource_type, resource_id)
|
|
476
|
+
WHERE lock_type = 'exclusive';
|
|
477
|
+
CREATE INDEX IF NOT EXISTS idx_resource_locks_agent ON resource_locks(agent_id);
|
|
478
|
+
CREATE INDEX IF NOT EXISTS idx_resource_locks_expires ON resource_locks(expires_at);
|
|
479
|
+
INSERT OR IGNORE INTO _migrations (id) VALUES (14);
|
|
460
480
|
`
|
|
461
481
|
];
|
|
462
482
|
var _db = null;
|
package/dist/mcp/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __returnValue = (v) => v;
|
|
5
|
+
function __exportSetter(name, newValue) {
|
|
6
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
7
|
+
}
|
|
4
8
|
var __export = (target, all) => {
|
|
5
9
|
for (var name in all)
|
|
6
10
|
__defProp(target, name, {
|
|
7
11
|
get: all[name],
|
|
8
12
|
enumerable: true,
|
|
9
13
|
configurable: true,
|
|
10
|
-
set: (
|
|
14
|
+
set: __exportSetter.bind(all, name)
|
|
11
15
|
});
|
|
12
16
|
};
|
|
13
17
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -514,6 +518,26 @@ CREATE INDEX IF NOT EXISTS idx_session_memory_jobs_agent ON session_memory_jobs(
|
|
|
514
518
|
CREATE INDEX IF NOT EXISTS idx_session_memory_jobs_project ON session_memory_jobs(project_id);
|
|
515
519
|
CREATE INDEX IF NOT EXISTS idx_session_memory_jobs_session ON session_memory_jobs(session_id);
|
|
516
520
|
INSERT OR IGNORE INTO _migrations (id) VALUES (13);
|
|
521
|
+
`,
|
|
522
|
+
`
|
|
523
|
+
ALTER TABLE resource_locks RENAME TO resource_locks_old;
|
|
524
|
+
CREATE TABLE resource_locks (
|
|
525
|
+
id TEXT PRIMARY KEY,
|
|
526
|
+
resource_type TEXT NOT NULL CHECK(resource_type IN ('project', 'memory', 'entity', 'agent', 'connector', 'file')),
|
|
527
|
+
resource_id TEXT NOT NULL,
|
|
528
|
+
agent_id TEXT NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
|
|
529
|
+
lock_type TEXT NOT NULL DEFAULT 'exclusive' CHECK(lock_type IN ('advisory', 'exclusive')),
|
|
530
|
+
locked_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
531
|
+
expires_at TEXT NOT NULL
|
|
532
|
+
);
|
|
533
|
+
INSERT INTO resource_locks SELECT * FROM resource_locks_old;
|
|
534
|
+
DROP TABLE resource_locks_old;
|
|
535
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_resource_locks_exclusive
|
|
536
|
+
ON resource_locks(resource_type, resource_id)
|
|
537
|
+
WHERE lock_type = 'exclusive';
|
|
538
|
+
CREATE INDEX IF NOT EXISTS idx_resource_locks_agent ON resource_locks(agent_id);
|
|
539
|
+
CREATE INDEX IF NOT EXISTS idx_resource_locks_expires ON resource_locks(expires_at);
|
|
540
|
+
INSERT OR IGNORE INTO _migrations (id) VALUES (14);
|
|
517
541
|
`
|
|
518
542
|
];
|
|
519
543
|
});
|
|
@@ -10902,7 +10926,7 @@ server.tool("memory_check_lock", "Check if a memory key is currently write-locke
|
|
|
10902
10926
|
});
|
|
10903
10927
|
server.tool("resource_lock", "Acquire a lock on any resource (project, memory, entity, agent, connector).", {
|
|
10904
10928
|
agent_id: exports_external.string(),
|
|
10905
|
-
resource_type: exports_external.enum(["project", "memory", "entity", "agent", "connector"]),
|
|
10929
|
+
resource_type: exports_external.enum(["project", "memory", "entity", "agent", "connector", "file"]),
|
|
10906
10930
|
resource_id: exports_external.string(),
|
|
10907
10931
|
lock_type: exports_external.enum(["advisory", "exclusive"]).optional().default("exclusive"),
|
|
10908
10932
|
ttl_seconds: exports_external.number().optional().default(300)
|
|
@@ -10928,7 +10952,7 @@ server.tool("resource_unlock", "Release a resource lock.", {
|
|
|
10928
10952
|
};
|
|
10929
10953
|
});
|
|
10930
10954
|
server.tool("resource_check_lock", "Check active locks on a resource.", {
|
|
10931
|
-
resource_type: exports_external.enum(["project", "memory", "entity", "agent", "connector"]),
|
|
10955
|
+
resource_type: exports_external.enum(["project", "memory", "entity", "agent", "connector", "file"]),
|
|
10932
10956
|
resource_id: exports_external.string(),
|
|
10933
10957
|
lock_type: exports_external.enum(["advisory", "exclusive"]).optional()
|
|
10934
10958
|
}, async (args) => {
|
package/dist/server/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __returnValue = (v) => v;
|
|
5
|
+
function __exportSetter(name, newValue) {
|
|
6
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
7
|
+
}
|
|
4
8
|
var __export = (target, all) => {
|
|
5
9
|
for (var name in all)
|
|
6
10
|
__defProp(target, name, {
|
|
7
11
|
get: all[name],
|
|
8
12
|
enumerable: true,
|
|
9
13
|
configurable: true,
|
|
10
|
-
set: (
|
|
14
|
+
set: __exportSetter.bind(all, name)
|
|
11
15
|
});
|
|
12
16
|
};
|
|
13
17
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -509,6 +513,26 @@ CREATE INDEX IF NOT EXISTS idx_session_memory_jobs_agent ON session_memory_jobs(
|
|
|
509
513
|
CREATE INDEX IF NOT EXISTS idx_session_memory_jobs_project ON session_memory_jobs(project_id);
|
|
510
514
|
CREATE INDEX IF NOT EXISTS idx_session_memory_jobs_session ON session_memory_jobs(session_id);
|
|
511
515
|
INSERT OR IGNORE INTO _migrations (id) VALUES (13);
|
|
516
|
+
`,
|
|
517
|
+
`
|
|
518
|
+
ALTER TABLE resource_locks RENAME TO resource_locks_old;
|
|
519
|
+
CREATE TABLE resource_locks (
|
|
520
|
+
id TEXT PRIMARY KEY,
|
|
521
|
+
resource_type TEXT NOT NULL CHECK(resource_type IN ('project', 'memory', 'entity', 'agent', 'connector', 'file')),
|
|
522
|
+
resource_id TEXT NOT NULL,
|
|
523
|
+
agent_id TEXT NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
|
|
524
|
+
lock_type TEXT NOT NULL DEFAULT 'exclusive' CHECK(lock_type IN ('advisory', 'exclusive')),
|
|
525
|
+
locked_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
526
|
+
expires_at TEXT NOT NULL
|
|
527
|
+
);
|
|
528
|
+
INSERT INTO resource_locks SELECT * FROM resource_locks_old;
|
|
529
|
+
DROP TABLE resource_locks_old;
|
|
530
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_resource_locks_exclusive
|
|
531
|
+
ON resource_locks(resource_type, resource_id)
|
|
532
|
+
WHERE lock_type = 'exclusive';
|
|
533
|
+
CREATE INDEX IF NOT EXISTS idx_resource_locks_agent ON resource_locks(agent_id);
|
|
534
|
+
CREATE INDEX IF NOT EXISTS idx_resource_locks_expires ON resource_locks(expires_at);
|
|
535
|
+
INSERT OR IGNORE INTO _migrations (id) VALUES (14);
|
|
512
536
|
`
|
|
513
537
|
];
|
|
514
538
|
});
|