heropen 1.2.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.
heropen/__init__.py ADDED
@@ -0,0 +1,39 @@
1
+ """
2
+ heropen — Persistent memory for AI agents.
3
+
4
+ Self-hosted, MCP-native memory system with vector + FTS + LIKE search,
5
+ automatic backup, crash recovery, and multi-agent isolation.
6
+ """
7
+
8
+ __version__ = "1.1.0"
9
+ __all__ = [
10
+ "add_entry", "update_entry",
11
+ "search_vector", "search_fts", "search_graph",
12
+ "search_by_date", "search_by_tag", "search_recent",
13
+ "auto_backup", "integrity_check", "startup_self_heal",
14
+ "init_db", "conn", "db_path",
15
+ "get_embedding", "cosine_similarity",
16
+ "capture_session_content",
17
+ "AGENTS",
18
+ ]
19
+
20
+ from heropen.core import (
21
+ add_entry,
22
+ update_entry,
23
+ search_vector,
24
+ search_fts,
25
+ search_graph,
26
+ search_by_date,
27
+ search_by_tag,
28
+ search_recent,
29
+ auto_backup,
30
+ integrity_check,
31
+ startup_self_heal,
32
+ init_db,
33
+ conn,
34
+ db_path,
35
+ get_embedding,
36
+ cosine_similarity,
37
+ capture_session_content,
38
+ AGENTS,
39
+ )
heropen/cli.py ADDED
@@ -0,0 +1,143 @@
1
+ """
2
+ heropen.cli — Command-line interface for HeroPen.
3
+
4
+ Usage:
5
+ heropen --help
6
+ heropen install # new in v1.2.0
7
+ heropen init ...
8
+ heropen recall ...
9
+ heropen add ...
10
+ heropen bootstrap ...
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import sys
16
+ from pathlib import Path
17
+
18
+ from heropen.core import HERO_PEN_DIR
19
+
20
+
21
+ def main():
22
+ args = sys.argv[1:]
23
+ if not args:
24
+ print_help()
25
+ return
26
+
27
+ cmd = args[0].lower()
28
+
29
+ # ── Install wizard (v1.2.0) ────────────────────────
30
+ if cmd in ("install", "setup"):
31
+ # Lazy import to avoid loading rich unless needed
32
+ from heropen.install import cmd_install
33
+ cmd_install(args[1:])
34
+ return
35
+
36
+ # ── Existing commands (all lazy-loaded) ─────────────
37
+ if cmd == "init":
38
+ from heropen.cli_commands import cmd_init
39
+ cmd_init(args[1:])
40
+ elif cmd == "recall":
41
+ from heropen.cli_commands import cmd_recall
42
+ cmd_recall(args[1:])
43
+ elif cmd == "add":
44
+ from heropen.cli_commands import cmd_add
45
+ cmd_add(args[1:])
46
+ elif cmd == "bootstrap":
47
+ from heropen.cli_commands import cmd_bootstrap
48
+ cmd_bootstrap(args[1:])
49
+ elif cmd == "health":
50
+ from heropen.cli_commands import cmd_status
51
+ cmd_status(args[1:])
52
+ elif cmd == "search":
53
+ from heropen.cli_commands import cmd_recall
54
+ cmd_recall(args[1:])
55
+ elif cmd == "list":
56
+ from heropen.cli_commands import cmd_status
57
+ cmd_status(args[1:])
58
+ elif cmd == "embed":
59
+ from heropen.cli_commands import cmd_embed
60
+ cmd_embed(args[1:])
61
+ elif cmd == "backup":
62
+ from heropen.cli_commands import cmd_export
63
+ cmd_export(args[1:])
64
+ elif cmd == "restore":
65
+ from heropen.cli_commands import cmd_import
66
+ cmd_import(args[1:])
67
+ elif cmd == "mcp":
68
+ from heropen.mcp_server import main as mcp_main
69
+ mcp_main()
70
+ elif cmd in ("--help", "-h", "help"):
71
+ print_help()
72
+ elif cmd in ("--version", "-V", "version"):
73
+ from heropen.core import __version__
74
+ print(f"heropen {__version__}")
75
+ elif cmd == "status":
76
+ from heropen.cli_commands import cmd_status
77
+ cmd_status(args[1:])
78
+ elif cmd in ("entities",):
79
+ from heropen.cli_commands import cmd_entities
80
+ cmd_entities(args[1:])
81
+ elif cmd in ("capture",):
82
+ from heropen.cli_commands import cmd_capture
83
+ cmd_capture(args[1:])
84
+ elif cmd in ("sync",):
85
+ from heropen.cli_commands import cmd_sync
86
+ cmd_sync(args[1:])
87
+ elif cmd in ("init-all",):
88
+ from heropen.cli_commands import cmd_init_all
89
+ cmd_init_all(args[1:])
90
+ elif cmd in ("export",):
91
+ from heropen.cli_commands import cmd_export
92
+ cmd_export(args[1:])
93
+ elif cmd in ("import",):
94
+ from heropen.cli_commands import cmd_import
95
+ cmd_import(args[1:])
96
+ elif cmd in ("delete",):
97
+ from heropen.cli_commands import cmd_delete
98
+ cmd_delete(args[1:])
99
+ else:
100
+ print(f"heropen: unknown command '{cmd}'")
101
+ print_help()
102
+ sys.exit(1)
103
+
104
+
105
+ def print_help():
106
+ help_text = f"""
107
+ HeroPen v1.2.0 — AI Agent Long-term Memory System
108
+
109
+ Usage:
110
+ heropen <command> [options]
111
+
112
+ Commands:
113
+ install Interactive install wizard (NEW in v1.2.0)
114
+ init Initialize agent memory database
115
+ add Add a new memory entry
116
+ recall Search and recall memories
117
+ search Search memories (alias for recall)
118
+ list List memory stats (alias for status)
119
+ status Database statistics
120
+ entities View knowledge graph
121
+ bootstrap Agent memory startup summary
122
+ capture Auto-capture key sentences from stdin
123
+ sync Sync from diary.md to database
124
+ embed Generate embeddings for existing entries
125
+ backup Export memories to JSON
126
+ restore Import memories from JSON backup
127
+ delete Delete a memory entry
128
+ health Check system health (alias for status)
129
+ mcp Start MCP server
130
+ help Show this help message
131
+ version Show version
132
+
133
+ Options:
134
+ -h, --help Show this help message
135
+ -V, --version Show version
136
+
137
+ Data directory: {HERO_PEN_DIR}
138
+ """
139
+ print(help_text.strip())
140
+
141
+
142
+ if __name__ == "__main__":
143
+ main()