@hasna/mementos 0.14.71 → 0.14.72
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/bun.lock +2 -2
- package/dist/cli/commands/memory-cmd-recall-exit.d.ts +3 -0
- package/dist/cli/commands/memory-cmd-recall-exit.d.ts.map +1 -0
- package/dist/cli/commands/memory-cmd-recall.d.ts.map +1 -1
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/index.js +60 -24
- package/dist/index.js +16 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/hasna.contract.json +64 -6
- package/package.json +8 -3
package/bun.lock
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@ai-sdk/anthropic": "^3.0.82",
|
|
9
9
|
"@ai-sdk/openai": "^3.0.69",
|
|
10
10
|
"@ai-sdk/openai-compatible": "^2.0.48",
|
|
11
|
-
"@hasna/contracts": "0.
|
|
11
|
+
"@hasna/contracts": "0.8.5",
|
|
12
12
|
"@hasna/events": "^0.1.6",
|
|
13
13
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
14
14
|
"ai": "^6.0.199",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
|
|
45
45
|
"@alcalzone/ansi-tokenize": ["@alcalzone/ansi-tokenize@0.1.3", "", { "dependencies": { "ansi-styles": "^6.2.1", "is-fullwidth-code-point": "^4.0.0" } }, "sha512-3yWxPTq3UQ/FY9p1ErPxIyfT64elWaMvM9lIHnaqpyft63tkxodF5aUElYHrdisWve5cETkh1+KBw1yJuW0aRw=="],
|
|
46
46
|
|
|
47
|
-
"@hasna/contracts": ["@hasna/contracts@0.
|
|
47
|
+
"@hasna/contracts": ["@hasna/contracts@0.8.5", "", { "dependencies": { "commander": "^13.1.0", "zod": "^3.25.76" }, "bin": { "contracts": "dist/cli/index.js", "contracts-cli": "dist/cli/contracts-cli.js" } }, "sha512-Iyk5srD6J3R7ci2g0gkyt+MCa6Da/lghPosGtgWBRgtJeGYCIAAnHF1yweoXnnqGAWZajFuDgJEWDVH11qpUhA=="],
|
|
48
48
|
|
|
49
49
|
"@hasna/events": ["@hasna/events@0.1.6", "", { "dependencies": { "commander": "^13.1.0" }, "bin": { "events": "dist/cli/index.js", "hasna-events": "dist/cli/index.js" } }, "sha512-rKLxjBIat45UxciUwh9hKM63l/mcurJXAhgVkYHvrsGnOK9HwExrwgOlylNzDBDb+huiQw9DWdLb31q5oWDfIw=="],
|
|
50
50
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-cmd-recall-exit.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/memory-cmd-recall-exit.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,iBAAiB,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-cmd-recall.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/memory-cmd-recall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"memory-cmd-recall.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/memory-cmd-recall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwF5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EACV,MAAM,EACN,cAAc,EACd,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAM5D,wBAAgB,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
|
+
const data = JSON.parse(readFileSync2(configPath, "utf-8"));
|
|
6540
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
6541
|
+
throw new Error("expected a JSON object");
|
|
6542
|
+
}
|
|
6543
|
+
return data;
|
|
6544
|
+
} catch (error) {
|
|
6545
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
6546
|
+
throw new Error(`Cannot update global config at ${configPath}: ${detail}`);
|
|
6542
6547
|
}
|
|
6543
6548
|
}
|
|
6544
6549
|
function writeFileConfig(data) {
|
|
@@ -60574,9 +60579,15 @@ init_search();
|
|
|
60574
60579
|
init_helpers();
|
|
60575
60580
|
import chalk11 from "chalk";
|
|
60576
60581
|
import { resolve as resolve6 } from "path";
|
|
60582
|
+
|
|
60583
|
+
// src/cli/commands/memory-cmd-recall-exit.ts
|
|
60584
|
+
var RECALL_EXIT_NOT_FOUND = 1;
|
|
60585
|
+
var RECALL_EXIT_FUZZY = 2;
|
|
60586
|
+
|
|
60587
|
+
// src/cli/commands/memory-cmd-recall.ts
|
|
60577
60588
|
function registerRecallCommand(program2) {
|
|
60578
60589
|
const handleError = makeHandleError(program2);
|
|
60579
|
-
program2.command("recall <key>").description("Recall a memory by key").option("--scope <scope>", "Scope filter").option("--agent <name>", "Agent filter").option("--project <path>", "Project filter").action((key, opts) => {
|
|
60590
|
+
program2.command("recall <key>").alias("get").description("Recall a memory by exact key (use --fuzzy to fall back to the nearest match)").option("--scope <scope>", "Scope filter").option("--agent <name>", "Agent filter").option("--project <path>", "Project filter").option("--fuzzy", "If the exact key is absent, return the nearest match instead (exits 2)").action((key, opts) => {
|
|
60580
60591
|
try {
|
|
60581
60592
|
const globalOpts = program2.opts();
|
|
60582
60593
|
const agentId = opts.agent || globalOpts.agent;
|
|
@@ -60588,7 +60599,7 @@ function registerRecallCommand(program2) {
|
|
|
60588
60599
|
projectId = project.id;
|
|
60589
60600
|
}
|
|
60590
60601
|
const memory = getMemoryByKey(key, opts.scope, agentId, projectId);
|
|
60591
|
-
if (memory) {
|
|
60602
|
+
if (memory && memory.key === key) {
|
|
60592
60603
|
touchMemory(memory.id);
|
|
60593
60604
|
if (globalOpts.json) {
|
|
60594
60605
|
outputJson(memory);
|
|
@@ -60597,29 +60608,39 @@ function registerRecallCommand(program2) {
|
|
|
60597
60608
|
}
|
|
60598
60609
|
return;
|
|
60599
60610
|
}
|
|
60600
|
-
|
|
60601
|
-
|
|
60602
|
-
|
|
60603
|
-
|
|
60604
|
-
|
|
60605
|
-
|
|
60606
|
-
|
|
60607
|
-
|
|
60608
|
-
|
|
60609
|
-
|
|
60610
|
-
|
|
60611
|
-
|
|
60612
|
-
|
|
60613
|
-
|
|
60611
|
+
if (opts.fuzzy) {
|
|
60612
|
+
const results = searchMemories(key, {
|
|
60613
|
+
scope: opts.scope,
|
|
60614
|
+
agent_id: agentId,
|
|
60615
|
+
project_id: projectId,
|
|
60616
|
+
limit: 1
|
|
60617
|
+
});
|
|
60618
|
+
if (results.length > 0) {
|
|
60619
|
+
const best = results[0];
|
|
60620
|
+
touchMemory(best.memory.id);
|
|
60621
|
+
if (globalOpts.json) {
|
|
60622
|
+
outputJson({
|
|
60623
|
+
fuzzy_match: true,
|
|
60624
|
+
requested_key: key,
|
|
60625
|
+
returned_key: best.memory.key,
|
|
60626
|
+
score: best.score,
|
|
60627
|
+
match_type: best.match_type,
|
|
60628
|
+
memory: best.memory
|
|
60629
|
+
});
|
|
60630
|
+
} else {
|
|
60631
|
+
console.error(chalk11.yellow(`No memory with key "${key}". Showing the nearest match "${best.memory.key}" ` + `(score: ${best.score.toFixed(2)}, match: ${best.match_type}) \u2014 this is a DIFFERENT record.`));
|
|
60632
|
+
console.log(formatMemoryDetail(best.memory));
|
|
60633
|
+
}
|
|
60634
|
+
process.exit(RECALL_EXIT_FUZZY);
|
|
60614
60635
|
}
|
|
60615
|
-
return;
|
|
60616
60636
|
}
|
|
60637
|
+
const message = opts.fuzzy ? `No memory found for key: ${key}` : `No memory found for key: ${key} (exact match; pass --fuzzy to return the nearest record instead)`;
|
|
60617
60638
|
if (globalOpts.json) {
|
|
60618
|
-
outputJson({ error:
|
|
60639
|
+
outputJson({ error: message, requested_key: key });
|
|
60619
60640
|
} else {
|
|
60620
|
-
console.error(chalk11.yellow(
|
|
60641
|
+
console.error(chalk11.yellow(message));
|
|
60621
60642
|
}
|
|
60622
|
-
process.exit(
|
|
60643
|
+
process.exit(RECALL_EXIT_NOT_FOUND);
|
|
60623
60644
|
} catch (e) {
|
|
60624
60645
|
handleError(e);
|
|
60625
60646
|
}
|
|
@@ -61489,6 +61510,21 @@ function readGlobalConfig() {
|
|
|
61489
61510
|
return {};
|
|
61490
61511
|
}
|
|
61491
61512
|
}
|
|
61513
|
+
function readGlobalConfigForWrite() {
|
|
61514
|
+
const p = globalConfigPath();
|
|
61515
|
+
if (!existsSync4(p))
|
|
61516
|
+
return {};
|
|
61517
|
+
try {
|
|
61518
|
+
const data = JSON.parse(readFileSync4(p, "utf-8"));
|
|
61519
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
61520
|
+
throw new Error("expected a JSON object");
|
|
61521
|
+
}
|
|
61522
|
+
return data;
|
|
61523
|
+
} catch (error) {
|
|
61524
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
61525
|
+
throw new Error(`Cannot update global config at ${p}: ${detail}`);
|
|
61526
|
+
}
|
|
61527
|
+
}
|
|
61492
61528
|
function writeGlobalConfig(data) {
|
|
61493
61529
|
const p = globalConfigPath();
|
|
61494
61530
|
ensureDir2(dirname3(p));
|
|
@@ -61502,7 +61538,7 @@ function getActiveProfile() {
|
|
|
61502
61538
|
return cfg["active_profile"] || null;
|
|
61503
61539
|
}
|
|
61504
61540
|
function setActiveProfile(name) {
|
|
61505
|
-
const cfg =
|
|
61541
|
+
const cfg = readGlobalConfigForWrite();
|
|
61506
61542
|
if (name === null) {
|
|
61507
61543
|
delete cfg["active_profile"];
|
|
61508
61544
|
} else {
|
package/dist/index.js
CHANGED
|
@@ -51717,6 +51717,21 @@ function readGlobalConfig() {
|
|
|
51717
51717
|
return {};
|
|
51718
51718
|
}
|
|
51719
51719
|
}
|
|
51720
|
+
function readGlobalConfigForWrite() {
|
|
51721
|
+
const p = globalConfigPath();
|
|
51722
|
+
if (!existsSync3(p))
|
|
51723
|
+
return {};
|
|
51724
|
+
try {
|
|
51725
|
+
const data = JSON.parse(readFileSync2(p, "utf-8"));
|
|
51726
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
51727
|
+
throw new Error("expected a JSON object");
|
|
51728
|
+
}
|
|
51729
|
+
return data;
|
|
51730
|
+
} catch (error) {
|
|
51731
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
51732
|
+
throw new Error(`Cannot update global config at ${p}: ${detail}`);
|
|
51733
|
+
}
|
|
51734
|
+
}
|
|
51720
51735
|
function writeGlobalConfig(data) {
|
|
51721
51736
|
const p = globalConfigPath();
|
|
51722
51737
|
ensureDir2(dirname2(p));
|
|
@@ -51730,7 +51745,7 @@ function getActiveProfile() {
|
|
|
51730
51745
|
return cfg["active_profile"] || null;
|
|
51731
51746
|
}
|
|
51732
51747
|
function setActiveProfile(name) {
|
|
51733
|
-
const cfg =
|
|
51748
|
+
const cfg = readGlobalConfigForWrite();
|
|
51734
51749
|
if (name === null) {
|
|
51735
51750
|
delete cfg["active_profile"];
|
|
51736
51751
|
} else {
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAA+B,MAAM,UAAU,CAAC;AAc5E,eAAO,MAAM,cAAc,EAAE,cA4B5B,CAAC;AA4DF,wBAAgB,UAAU,IAAI,cAAc,CAwC3C;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAA+B,MAAM,UAAU,CAAC;AAc5E,eAAO,MAAM,cAAc,EAAE,cA4B5B,CAAC;AA4DF,wBAAgB,UAAU,IAAI,cAAc,CAwC3C;AA2FD,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAMhD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAQ1D;AAED,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAOvC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED,wBAAgB,SAAS,IAAI,MAAM,CAmDlC"}
|
package/hasna.contract.json
CHANGED
|
@@ -2,15 +2,73 @@
|
|
|
2
2
|
"$schema": "./node_modules/@hasna/contracts/dist/hasna.contract.schema.json",
|
|
3
3
|
"schema": "hasna.service_contract.v1",
|
|
4
4
|
"name": "mementos",
|
|
5
|
-
"class": "
|
|
5
|
+
"class": "cli-with-store",
|
|
6
6
|
"contractVersion": "v1",
|
|
7
|
-
"kitVersion": "0.
|
|
8
|
-
"description": "Universal memory system for AI agents — CLI
|
|
9
|
-
"bins": [
|
|
7
|
+
"kitVersion": "0.8.5",
|
|
8
|
+
"description": "Universal memory system for AI agents — CLI, MCP server, REST API, and TypeScript SDK over one SQLite or PostgreSQL store.",
|
|
9
|
+
"bins": [
|
|
10
|
+
"mementos",
|
|
11
|
+
"mementos-mcp",
|
|
12
|
+
"mementos-serve"
|
|
13
|
+
],
|
|
14
|
+
"hosting": [
|
|
15
|
+
"user-hosted"
|
|
16
|
+
],
|
|
17
|
+
"serviceSurfaces": [
|
|
18
|
+
{
|
|
19
|
+
"name": "http-api",
|
|
20
|
+
"kind": "api",
|
|
21
|
+
"status": "supported",
|
|
22
|
+
"bin": "mementos-serve",
|
|
23
|
+
"authMode": "api-key",
|
|
24
|
+
"health": { "method": "GET", "path": "/health", "public": true },
|
|
25
|
+
"readiness": { "method": "GET", "path": "/ready", "public": true },
|
|
26
|
+
"version": { "method": "GET", "path": "/version", "public": true },
|
|
27
|
+
"apiBasePath": "/v1",
|
|
28
|
+
"openApiPath": "/v1/openapi.json"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "typescript-sdk",
|
|
32
|
+
"kind": "sdk",
|
|
33
|
+
"status": "supported",
|
|
34
|
+
"authMode": "api-key",
|
|
35
|
+
"exportSubpath": "./sdk",
|
|
36
|
+
"clientClassName": "MementosClient"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "mcp",
|
|
40
|
+
"kind": "mcp",
|
|
41
|
+
"status": "supported",
|
|
42
|
+
"mcpBin": "mementos-mcp",
|
|
43
|
+
"authMode": "local-only"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "cli",
|
|
47
|
+
"kind": "cli",
|
|
48
|
+
"status": "supported",
|
|
49
|
+
"bin": "mementos",
|
|
50
|
+
"authMode": "local-only"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
10
53
|
"storage": {
|
|
11
|
-
"mode": "
|
|
54
|
+
"mode": "sqlite",
|
|
55
|
+
"engines": [
|
|
56
|
+
"sqlite",
|
|
57
|
+
"postgres"
|
|
58
|
+
],
|
|
12
59
|
"envPrefix": "HASNA_MEMENTOS_",
|
|
13
60
|
"aliasEnvPrefix": "MEMENTOS_",
|
|
14
|
-
"
|
|
61
|
+
"sqlitePath": "~/.hasna/mementos/mementos.db",
|
|
62
|
+
"pgTestGate": {
|
|
63
|
+
"envVar": "MEMENTOS_TEST_DATABASE_URL",
|
|
64
|
+
"command": "bun run test:pg"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"metadata": {
|
|
68
|
+
"release": {
|
|
69
|
+
"artifactScan": {
|
|
70
|
+
"script": "scan-artifact"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
15
73
|
}
|
|
16
74
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/mementos",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.72",
|
|
4
4
|
"description": "Universal memory system for AI agents - CLI + MCP server + library API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -38,9 +38,14 @@
|
|
|
38
38
|
"clean": "rm -rf dist",
|
|
39
39
|
"build": "bun run clean && bun build src/cli/index.tsx --outdir dist/cli --target bun --external ink --external react --external chalk --external @modelcontextprotocol/sdk --external @hasna/contracts --external @hasna/contracts/schemas --external @hasna/contracts/auth --external pg && bun build src/mcp/index.ts --outdir dist/mcp --target bun --external @modelcontextprotocol/sdk --external @hasna/contracts --external @hasna/contracts/schemas --external @hasna/contracts/auth --external pg && bun build src/server/index.ts --outdir dist/server --target bun --external @hasna/contracts --external @hasna/contracts/schemas --external @hasna/contracts/auth --external pg && bun build src/index.ts src/storage.ts src/pg-sync-worker.ts --outdir dist --target bun --external @hasna/contracts --external @hasna/contracts/schemas --external @hasna/contracts/auth --external pg && bun build src/sdk/index.ts --outdir dist/sdk --target bun && tsc --emitDeclarationOnly --outDir dist",
|
|
40
40
|
"prepare": "bun run build",
|
|
41
|
-
"
|
|
41
|
+
"prepack": "bun run build && bun run scan-artifact",
|
|
42
|
+
"prepublishOnly": "bun run typecheck && bun run test && bun run contracts:conformance && contracts no-cloud-scan .",
|
|
43
|
+
"scan-artifact": "bun scripts/scan-artifact.ts",
|
|
44
|
+
"contract:check": "bun run build && contracts repo-conformance .",
|
|
45
|
+
"contracts:conformance": "contracts conformance fixtures",
|
|
42
46
|
"typecheck": "tsc --noEmit",
|
|
43
47
|
"test": "bun test --isolate --timeout=10000",
|
|
48
|
+
"test:pg": "bun scripts/pg-test-gate.ts",
|
|
44
49
|
"dev:cli": "bun run src/cli/index.tsx",
|
|
45
50
|
"dev:mcp": "bun run src/mcp/index.ts",
|
|
46
51
|
"dev:serve": "bun run src/server/index.ts",
|
|
@@ -79,7 +84,7 @@
|
|
|
79
84
|
"@ai-sdk/anthropic": "^3.0.82",
|
|
80
85
|
"@ai-sdk/openai": "^3.0.69",
|
|
81
86
|
"@ai-sdk/openai-compatible": "^2.0.48",
|
|
82
|
-
"@hasna/contracts": "0.
|
|
87
|
+
"@hasna/contracts": "0.8.5",
|
|
83
88
|
"@hasna/events": "^0.1.6",
|
|
84
89
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
85
90
|
"ai": "^6.0.199",
|