deeptutor-memory 1.7.0__py3-none-any.whl
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.
- deeptutor/agents/loop/native_memory.py +24 -0
- deeptutor/api/routers/memory.py +785 -0
- deeptutor/services/memory/__init__.py +42 -0
- deeptutor/services/memory/consolidator/__init__.py +62 -0
- deeptutor/services/memory/consolidator/chunker.py +131 -0
- deeptutor/services/memory/consolidator/guards.py +104 -0
- deeptutor/services/memory/consolidator/line_doc.py +486 -0
- deeptutor/services/memory/consolidator/meta.py +194 -0
- deeptutor/services/memory/consolidator/modes/__init__.py +31 -0
- deeptutor/services/memory/consolidator/modes/_runtime.py +319 -0
- deeptutor/services/memory/consolidator/modes/_shims.py +129 -0
- deeptutor/services/memory/consolidator/modes/audit.py +481 -0
- deeptutor/services/memory/consolidator/modes/dedup.py +228 -0
- deeptutor/services/memory/consolidator/modes/merge.py +227 -0
- deeptutor/services/memory/consolidator/modes/update.py +706 -0
- deeptutor/services/memory/consolidator/parse.py +135 -0
- deeptutor/services/memory/consolidator/prompts/en/_meta.yaml +36 -0
- deeptutor/services/memory/consolidator/prompts/en/audit_l2.yaml +42 -0
- deeptutor/services/memory/consolidator/prompts/en/audit_l3.yaml +38 -0
- deeptutor/services/memory/consolidator/prompts/en/dedup.yaml +37 -0
- deeptutor/services/memory/consolidator/prompts/en/update_l2.yaml +45 -0
- deeptutor/services/memory/consolidator/prompts/en/update_l3.yaml +51 -0
- deeptutor/services/memory/consolidator/prompts/zh/_meta.yaml +35 -0
- deeptutor/services/memory/consolidator/prompts/zh/audit_l2.yaml +40 -0
- deeptutor/services/memory/consolidator/prompts/zh/audit_l3.yaml +34 -0
- deeptutor/services/memory/consolidator/prompts/zh/dedup.yaml +34 -0
- deeptutor/services/memory/consolidator/prompts/zh/update_l2.yaml +40 -0
- deeptutor/services/memory/consolidator/prompts/zh/update_l3.yaml +43 -0
- deeptutor/services/memory/consolidator/references.py +388 -0
- deeptutor/services/memory/consolidator/runs.py +405 -0
- deeptutor/services/memory/document.py +235 -0
- deeptutor/services/memory/ids.py +80 -0
- deeptutor/services/memory/ops.py +149 -0
- deeptutor/services/memory/paths.py +104 -0
- deeptutor/services/memory/prompts/en.yaml +156 -0
- deeptutor/services/memory/prompts/zh.yaml +144 -0
- deeptutor/services/memory/recall.py +237 -0
- deeptutor/services/memory/settings.py +198 -0
- deeptutor/services/memory/snapshot/__init__.py +127 -0
- deeptutor/services/memory/snapshot/adapters.py +690 -0
- deeptutor/services/memory/snapshot/diff.py +67 -0
- deeptutor/services/memory/snapshot/entity.py +92 -0
- deeptutor/services/memory/snapshot/store.py +113 -0
- deeptutor/services/memory/store.py +453 -0
- deeptutor/services/memory/trace.py +153 -0
- deeptutor_cli/memory.py +99 -0
- deeptutor_memory-1.7.0.dist-info/METADATA +6 -0
- deeptutor_memory-1.7.0.dist-info/RECORD +50 -0
- deeptutor_memory-1.7.0.dist-info/WHEEL +5 -0
- deeptutor_memory-1.7.0.dist-info/top_level.txt +2 -0
deeptutor_cli/memory.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""CLI memory commands for the three-layer memory subsystem (v2)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from rich.console import Console
|
|
6
|
+
from rich.markdown import Markdown
|
|
7
|
+
from rich.panel import Panel
|
|
8
|
+
import typer
|
|
9
|
+
|
|
10
|
+
from deeptutor.services.memory import (
|
|
11
|
+
L3_SLOTS,
|
|
12
|
+
SURFACES,
|
|
13
|
+
get_memory_store,
|
|
14
|
+
paths,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
console = Console()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def register(app: typer.Typer) -> None:
|
|
21
|
+
@app.command("show")
|
|
22
|
+
def memory_show(
|
|
23
|
+
target: str = typer.Argument(
|
|
24
|
+
"L3",
|
|
25
|
+
help="What to show: 'L3' (all four global docs), 'L2' (all seven surface docs), or a single doc name (e.g. 'profile', 'chat').",
|
|
26
|
+
),
|
|
27
|
+
) -> None:
|
|
28
|
+
"""Display memory document content."""
|
|
29
|
+
store = get_memory_store()
|
|
30
|
+
|
|
31
|
+
if target == "L3":
|
|
32
|
+
text = store.read_l3_concat()
|
|
33
|
+
console.print(Panel(Markdown(text), title="[bold]L3 (concatenated)[/]"))
|
|
34
|
+
return
|
|
35
|
+
|
|
36
|
+
if target == "L2":
|
|
37
|
+
for surface in SURFACES:
|
|
38
|
+
content = store.read_raw("L2", surface)
|
|
39
|
+
if content.strip():
|
|
40
|
+
console.print(Panel(Markdown(content), title=f"[bold]L2/{surface}.md[/]"))
|
|
41
|
+
else:
|
|
42
|
+
console.print(f"[dim]L2/{surface}.md: (empty)[/]")
|
|
43
|
+
return
|
|
44
|
+
|
|
45
|
+
# Single doc name — resolve to L2 or L3.
|
|
46
|
+
if target in L3_SLOTS:
|
|
47
|
+
content = store.read_raw("L3", target)
|
|
48
|
+
label = f"L3/{target}.md"
|
|
49
|
+
elif target in SURFACES:
|
|
50
|
+
content = store.read_raw("L2", target)
|
|
51
|
+
label = f"L2/{target}.md"
|
|
52
|
+
else:
|
|
53
|
+
console.print(
|
|
54
|
+
f"[red]Unknown doc: {target}. Use 'L2', 'L3', a surface ({', '.join(SURFACES)}), or a slot ({', '.join(L3_SLOTS)}).[/]"
|
|
55
|
+
)
|
|
56
|
+
raise typer.Exit(1)
|
|
57
|
+
|
|
58
|
+
if content.strip():
|
|
59
|
+
console.print(Panel(Markdown(content), title=f"[bold]{label}[/]"))
|
|
60
|
+
else:
|
|
61
|
+
console.print(f"[dim]{label}: (empty)[/]")
|
|
62
|
+
|
|
63
|
+
@app.command("clear")
|
|
64
|
+
def memory_clear(
|
|
65
|
+
target: str = typer.Argument(
|
|
66
|
+
"all",
|
|
67
|
+
help="What to clear: 'all' (entire memory), 'trace' (all L1 trace), or a surface name to clear that surface's L1.",
|
|
68
|
+
),
|
|
69
|
+
force: bool = typer.Option(False, "--force", "-f", help="Skip confirmation."),
|
|
70
|
+
) -> None:
|
|
71
|
+
"""Clear memory (use 'all' for a full reset, or a surface name for L1 only)."""
|
|
72
|
+
if target != "all" and target != "trace" and target not in SURFACES:
|
|
73
|
+
console.print(f"[red]Unknown target: {target}[/]")
|
|
74
|
+
raise typer.Exit(1)
|
|
75
|
+
|
|
76
|
+
if not force:
|
|
77
|
+
label = "all memory" if target == "all" else f"L1 trace for {target}"
|
|
78
|
+
if not typer.confirm(f"Clear {label}?"):
|
|
79
|
+
raise typer.Abort()
|
|
80
|
+
|
|
81
|
+
if target == "all":
|
|
82
|
+
root = paths.memory_root()
|
|
83
|
+
for entry in root.iterdir() if root.exists() else []:
|
|
84
|
+
if entry.is_file():
|
|
85
|
+
entry.unlink()
|
|
86
|
+
elif entry.is_dir() and entry.name in {"trace", "L2", "L3"}:
|
|
87
|
+
for child in entry.rglob("*"):
|
|
88
|
+
if child.is_file():
|
|
89
|
+
child.unlink()
|
|
90
|
+
console.print("[green]Cleared all memory.[/]")
|
|
91
|
+
elif target == "trace":
|
|
92
|
+
for surface in SURFACES:
|
|
93
|
+
for f in paths.trace_dir(surface).glob("*.jsonl"):
|
|
94
|
+
f.unlink()
|
|
95
|
+
console.print("[green]Cleared all L1 trace.[/]")
|
|
96
|
+
else:
|
|
97
|
+
for f in paths.trace_dir(target).glob("*.jsonl"): # type: ignore[arg-type]
|
|
98
|
+
f.unlink()
|
|
99
|
+
console.print(f"[green]Cleared L1 trace for {target}.[/]")
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
deeptutor/agents/loop/native_memory.py,sha256=JC1-jl3ThT6oz46oDQEWssD7DpzMAUQbVF18M-Dd33g,857
|
|
2
|
+
deeptutor/api/routers/memory.py,sha256=MaPlFRxIshqSxC_zqiVUM5SupLJ7Y4BH27MSokf8MdY,26305
|
|
3
|
+
deeptutor/services/memory/__init__.py,sha256=ARou8XCxeXZ9Ci6MYp5xjLmg8n7RtjrNpIaDYbCw7Ss,1248
|
|
4
|
+
deeptutor/services/memory/document.py,sha256=jnwTVKSGjzxBCRTmGPn_vB8hBy5t33mBKwI8bXmbalA,8249
|
|
5
|
+
deeptutor/services/memory/ids.py,sha256=9NeGCXlbLQJdCZeFLTNLPVJWY9kjgFVqCEtnyV_Ztfc,2670
|
|
6
|
+
deeptutor/services/memory/ops.py,sha256=OOA4j4SCcjFBhu-_maBvYCFycbJDNmRQ1OEWyggWL-0,5237
|
|
7
|
+
deeptutor/services/memory/paths.py,sha256=uG7TPD68rW2pvJvHdvYuVWOq8lG31yo595jO0wUrpRQ,3027
|
|
8
|
+
deeptutor/services/memory/recall.py,sha256=GEs9n1KGPfKDX8mawMUy0VhyG73PUoZNiuL3HAtc14c,8527
|
|
9
|
+
deeptutor/services/memory/settings.py,sha256=ZMaI83iipDakC8-6vlWhzjqidlZbGllHkvP4Psm960w,6123
|
|
10
|
+
deeptutor/services/memory/store.py,sha256=_spHZS7NP7ghVyNYcPi1LGzxuz7SofSTzkLUmBF_qUA,17468
|
|
11
|
+
deeptutor/services/memory/trace.py,sha256=ci0wxweeHNPA_0TAAvUJ-A9ohOz9CxF359EO5IBBQWQ,4832
|
|
12
|
+
deeptutor/services/memory/consolidator/__init__.py,sha256=2ixbdCtGmjQM3-vR5T8Bf-hkCVD0YuOsnvnIXar_NRs,2183
|
|
13
|
+
deeptutor/services/memory/consolidator/chunker.py,sha256=O15nxQhGP5JZIvLDKJos_sh_K2SVOtilrPNNpKfmnAE,4507
|
|
14
|
+
deeptutor/services/memory/consolidator/guards.py,sha256=rZ2tz50apMUMIhVQh1BM1bMBeQB7RAOZfpnlLBLKCrQ,2889
|
|
15
|
+
deeptutor/services/memory/consolidator/line_doc.py,sha256=3kJMvlhi0VyPa-oP20gzN0_qfoFYcGJjP5vyFFXw0G8,17278
|
|
16
|
+
deeptutor/services/memory/consolidator/meta.py,sha256=Nu8QZDbihvKayYQgFeJNWn9rFEFKQfk7nglSxc3wXKA,5331
|
|
17
|
+
deeptutor/services/memory/consolidator/parse.py,sha256=n9PTs8yg4olQtDNq9NIGcumpWYXKOUouFhpytsdfxZk,4545
|
|
18
|
+
deeptutor/services/memory/consolidator/references.py,sha256=ufTe81DkVb_dSLKnMwgsNYRO9FYCcRfWvQb6YCcaOO0,13406
|
|
19
|
+
deeptutor/services/memory/consolidator/runs.py,sha256=6ZwHMOTxaLICXpmL-yzHUegaIHhyoLtHa3_gYAVFlyA,13135
|
|
20
|
+
deeptutor/services/memory/consolidator/modes/__init__.py,sha256=SepvFsZBMM-0tesy4ViSJfh2mbOP1EkNUTj8RTcnl_g,1116
|
|
21
|
+
deeptutor/services/memory/consolidator/modes/_runtime.py,sha256=_a2NWX-5qVG176HZzYT1Xi7i7WBs-JXLtnP7k0Ama20,10405
|
|
22
|
+
deeptutor/services/memory/consolidator/modes/_shims.py,sha256=5T03hkkDeUAuFZgoZYX_izpswPcC88HFCVUNjSzbePg,4404
|
|
23
|
+
deeptutor/services/memory/consolidator/modes/audit.py,sha256=LR3aHRvpkM0QRjiA2zn-i5truO2Jql8xQJf33bdGlY4,15328
|
|
24
|
+
deeptutor/services/memory/consolidator/modes/dedup.py,sha256=d4n-qeNtCfYZuM9AnZgo-90ZQjFc5acxsnvZ1-J2yTs,6582
|
|
25
|
+
deeptutor/services/memory/consolidator/modes/merge.py,sha256=Dfab0qHMQ5-55Ql4Yv0NUD20V0eygnW52j_R4DF-LZw,7748
|
|
26
|
+
deeptutor/services/memory/consolidator/modes/update.py,sha256=Gxj2PUZr-Z9eeu8fSSgswpGcXA546myFgspe4mFldvU,22709
|
|
27
|
+
deeptutor/services/memory/consolidator/prompts/en/_meta.yaml,sha256=tEBZbpVjeqS-iT57jgpOWNqv0fP82sEJ8keWvHi_jzs,2078
|
|
28
|
+
deeptutor/services/memory/consolidator/prompts/en/audit_l2.yaml,sha256=-xsYIddIpP3nIZFl6dGipOt97Jx8VQa5RFf8a22Y94M,1697
|
|
29
|
+
deeptutor/services/memory/consolidator/prompts/en/audit_l3.yaml,sha256=Q78e4hMqMEUcjHd6GqZmNhlcmIHtETc57mXP8ecdNBY,1422
|
|
30
|
+
deeptutor/services/memory/consolidator/prompts/en/dedup.yaml,sha256=jZcCR7w76w52y88H8htG4PXuPys6WIewFFCdRRZGa00,1453
|
|
31
|
+
deeptutor/services/memory/consolidator/prompts/en/update_l2.yaml,sha256=DQh5dEDDi3GK9a1O-ljVTWwQ5YRjqhvSN_fIBqYKUIE,1757
|
|
32
|
+
deeptutor/services/memory/consolidator/prompts/en/update_l3.yaml,sha256=zlMfoFzd8_FmqpA_97LvNSvjV8peGmqAoSyqJAMc7Nc,2054
|
|
33
|
+
deeptutor/services/memory/consolidator/prompts/zh/_meta.yaml,sha256=trtwobOQWGT9Gk9Kif05eDkzz_Ko7VgD9UeFHTkPj7M,1741
|
|
34
|
+
deeptutor/services/memory/consolidator/prompts/zh/audit_l2.yaml,sha256=6StwN3gGwoK6x7GxNLXjlVrk7EUgmHJTXnysFgSpIBE,1518
|
|
35
|
+
deeptutor/services/memory/consolidator/prompts/zh/audit_l3.yaml,sha256=m5mUur6T9laXRwFphJ72UdINaXJP3DFQ-by87_EGFGc,1180
|
|
36
|
+
deeptutor/services/memory/consolidator/prompts/zh/dedup.yaml,sha256=S5bpTjSiBRjbxvhF3W7rgYgmoQ9fFFO31LKlSmtZk9U,1238
|
|
37
|
+
deeptutor/services/memory/consolidator/prompts/zh/update_l2.yaml,sha256=zuf8QGEnIytO8GIe7_m4eoYTP34XSX34ENoWuEt8O30,1690
|
|
38
|
+
deeptutor/services/memory/consolidator/prompts/zh/update_l3.yaml,sha256=EbM3uqvtkoSGPuI9eK74sL3XFnxiVnVX-S8gwsBuo7Y,1898
|
|
39
|
+
deeptutor/services/memory/prompts/en.yaml,sha256=szrLCfDoB7__CUNCtL7qZVR06u6FLVsAZAksQSXtxIo,6074
|
|
40
|
+
deeptutor/services/memory/prompts/zh.yaml,sha256=yuCToM-yGIxpT0pk2Kr-qWASLAleZjJjKD7ySqdkKwo,5741
|
|
41
|
+
deeptutor/services/memory/snapshot/__init__.py,sha256=p2vI5Mba8g6p_y2QiiuZZxLIgP6L0ULsYfK4FCowcDA,4169
|
|
42
|
+
deeptutor/services/memory/snapshot/adapters.py,sha256=M7BgmMOrw9-BJ95-cf90Uu7Hu2mBDpkp4hubDpdFt9M,27142
|
|
43
|
+
deeptutor/services/memory/snapshot/diff.py,sha256=jQDPc-QdLROqHqwHRsw3fIEEq4KXyNWaLEjgTdE3lKQ,2152
|
|
44
|
+
deeptutor/services/memory/snapshot/entity.py,sha256=F6BXWEgeG25A8rz56rmtQSfpcAF69fH6vhgqgl8ebmM,2764
|
|
45
|
+
deeptutor/services/memory/snapshot/store.py,sha256=KE-qLY_qcmqdfFoesEuYazzghpAZTb4kOJ-F5Rfd6R8,3503
|
|
46
|
+
deeptutor_cli/memory.py,sha256=YzGImZf-k28FmMnOAmM3I1D9oe9ScO-0IzmSTiPMxTU,3674
|
|
47
|
+
deeptutor_memory-1.7.0.dist-info/METADATA,sha256=8H4Bo1wFpq1bq8y9wQlXVPG2YPBIu-FjpB3jH0uYPk8,155
|
|
48
|
+
deeptutor_memory-1.7.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
49
|
+
deeptutor_memory-1.7.0.dist-info/top_level.txt,sha256=J6ORXwc7UnijwSqfUkl8JAiAiAoZAd3pFNwq8jm5_uY,24
|
|
50
|
+
deeptutor_memory-1.7.0.dist-info/RECORD,,
|