deja-cli 0.1.2__tar.gz → 0.1.3__tar.gz
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.
- {deja_cli-0.1.2 → deja_cli-0.1.3}/PKG-INFO +1 -1
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/core/store.py +16 -7
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/cli/memory.py +2 -2
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/mcp_server.py +4 -4
- {deja_cli-0.1.2 → deja_cli-0.1.3}/pyproject.toml +1 -1
- {deja_cli-0.1.2 → deja_cli-0.1.3}/.gitignore +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/LICENSE +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/README.pypi.md +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/config/default.yaml +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/__init__.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/cloud.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/config.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/core/__init__.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/core/extractor.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/core/reflection.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/ingest/__init__.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/ingest/watchers/__init__.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/ingest/watchers/base.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/ingest/watchers/claude_code.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/ingest/watchers/codex_cli.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/ingest/watchers/gemini_cli.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/__init__.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/cli/__init__.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/cli/_helpers.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/cli/backfill.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/cli/cloud.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/cli/maintenance.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/cli/session.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/cli/setup.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/cli/transfer.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/cli/watch.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/web.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/interfaces/web_ui/index.html +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/llm/__init__.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/llm/base.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/llm/embedding.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/llm/factory.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/llm/providers/__init__.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/llm/providers/anthropic.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/llm/providers/ollama.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/deja/main.py +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/hooks/deja-post-fail.sh +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/hooks/deja-precompact.sh +0 -0
- {deja_cli-0.1.2 → deja_cli-0.1.3}/hooks/deja-recall.sh +0 -0
|
@@ -5,7 +5,7 @@ import struct
|
|
|
5
5
|
import sys
|
|
6
6
|
from datetime import datetime, timezone, timedelta
|
|
7
7
|
from pathlib import Path
|
|
8
|
-
from typing import Any, Optional
|
|
8
|
+
from typing import Any, NamedTuple, Optional
|
|
9
9
|
|
|
10
10
|
import aiosqlite
|
|
11
11
|
from ulid import ULID
|
|
@@ -138,6 +138,14 @@ def _parse_dt(dt_str: str) -> datetime:
|
|
|
138
138
|
|
|
139
139
|
# ── store ──────────────────────────────────────────────────────────────────────
|
|
140
140
|
|
|
141
|
+
|
|
142
|
+
class SaveResult(NamedTuple):
|
|
143
|
+
"""Return type for MemoryStore.save()."""
|
|
144
|
+
id: str
|
|
145
|
+
is_new: bool
|
|
146
|
+
cloud_data: dict
|
|
147
|
+
|
|
148
|
+
|
|
141
149
|
_GLOBAL_PROJECT_KEY = "__global__"
|
|
142
150
|
|
|
143
151
|
|
|
@@ -302,15 +310,16 @@ class MemoryStore:
|
|
|
302
310
|
pass # column already exists
|
|
303
311
|
await db.commit()
|
|
304
312
|
|
|
305
|
-
async def save(self, memory: dict, embedding: Optional[bytes] = None) ->
|
|
313
|
+
async def save(self, memory: dict, embedding: Optional[bytes] = None) -> SaveResult:
|
|
306
314
|
"""Save a memory, deduplicating if an existing memory is >80% similar.
|
|
307
315
|
|
|
308
316
|
embedding: pre-computed embedding bytes (from EmbeddingAdapter.to_bytes()).
|
|
309
317
|
Pass None if no embedding provider is configured.
|
|
310
318
|
|
|
311
|
-
Returns
|
|
312
|
-
|
|
313
|
-
|
|
319
|
+
Returns a SaveResult with:
|
|
320
|
+
.id — the memory ID (new or existing dedup match)
|
|
321
|
+
.is_new — True if a new record was inserted, False if deduplicated
|
|
322
|
+
.cloud_data — full current state of the saved/updated memory (no embedding blob)
|
|
314
323
|
"""
|
|
315
324
|
db = await self._get_db()
|
|
316
325
|
content = memory["content"]
|
|
@@ -362,7 +371,7 @@ class MemoryStore:
|
|
|
362
371
|
"last_confirmed": now,
|
|
363
372
|
"updated_at": now,
|
|
364
373
|
}
|
|
365
|
-
return candidate["id"], False, cloud_data
|
|
374
|
+
return SaveResult(candidate["id"], False, cloud_data)
|
|
366
375
|
|
|
367
376
|
# Insert new memory
|
|
368
377
|
now = _now_iso()
|
|
@@ -408,7 +417,7 @@ class MemoryStore:
|
|
|
408
417
|
"updated_at": now,
|
|
409
418
|
"last_confirmed": now,
|
|
410
419
|
}
|
|
411
|
-
return mem_id, True, cloud_data
|
|
420
|
+
return SaveResult(mem_id, True, cloud_data)
|
|
412
421
|
|
|
413
422
|
async def confirm_memories(self, ids: list[str]) -> None:
|
|
414
423
|
"""Stamp last_confirmed = now on a list of memory IDs. Called after load."""
|
|
@@ -149,8 +149,8 @@ def register(app: typer.Typer) -> None:
|
|
|
149
149
|
"confidence": confidence,
|
|
150
150
|
"trigger": trigger,
|
|
151
151
|
}
|
|
152
|
-
|
|
153
|
-
return
|
|
152
|
+
result = await store.save(memory, embedding=embedding_bytes)
|
|
153
|
+
return result.id, result.cloud_data
|
|
154
154
|
finally:
|
|
155
155
|
await store.close()
|
|
156
156
|
|
|
@@ -73,7 +73,7 @@ async def memory_save(
|
|
|
73
73
|
import sys
|
|
74
74
|
print(f"[deja] Warning: embedding generation failed, memory saved without embedding: {e}", file=sys.stderr)
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
result = await store.save(
|
|
77
77
|
{
|
|
78
78
|
"content": content,
|
|
79
79
|
"type": type,
|
|
@@ -90,12 +90,12 @@ async def memory_save(
|
|
|
90
90
|
if config.cloud.sync_on_save:
|
|
91
91
|
from deja.cloud import get_token, push_memory
|
|
92
92
|
if get_token(config):
|
|
93
|
-
trigger_str = cloud_data.get("trigger") or ""
|
|
94
|
-
push_payload = {**cloud_data, "triggerCmds": [t.strip() for t in trigger_str.split(",") if t.strip()]}
|
|
93
|
+
trigger_str = result.cloud_data.get("trigger") or ""
|
|
94
|
+
push_payload = {**result.cloud_data, "triggerCmds": [t.strip() for t in trigger_str.split(",") if t.strip()]}
|
|
95
95
|
push_payload.pop("trigger", None)
|
|
96
96
|
push_memory(push_payload, config)
|
|
97
97
|
|
|
98
|
-
return json.dumps({"id":
|
|
98
|
+
return json.dumps({"id": result.id, "status": "saved"})
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
@mcp.tool()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|