heropen 1.3.0__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.
- heropen-1.3.0/PKG-INFO +62 -0
- heropen-1.3.0/README.md +38 -0
- heropen-1.3.0/pyproject.toml +47 -0
- heropen-1.3.0/src/heropen/__init__.py +41 -0
- heropen-1.3.0/src/heropen/cli.py +147 -0
- heropen-1.3.0/src/heropen/cli_commands.py +642 -0
- heropen-1.3.0/src/heropen/core.py +979 -0
- heropen-1.3.0/src/heropen/core.py.bak +826 -0
- heropen-1.3.0/src/heropen/install.py +613 -0
- heropen-1.3.0/src/heropen/mcp_server.py +292 -0
- heropen-1.3.0/src/heropen/skills/__init__.py +0 -0
- heropen-1.3.0/src/heropen/skills/file_search.py +558 -0
- heropen-1.3.0/uv.lock +1938 -0
heropen-1.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: heropen
|
|
3
|
+
Version: 1.3.0
|
|
4
|
+
Summary: HeroPen — AI Agent Long-term Memory System
|
|
5
|
+
Project-URL: Homepage, https://ksmn.cc/heropen
|
|
6
|
+
Project-URL: Documentation, https://ksmn.cc/heropen/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/koradji88/heropen
|
|
8
|
+
Author-email: KSMN Studio <hello@ksmn.cc>
|
|
9
|
+
License: MIT
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Requires-Dist: requests>=2.28
|
|
15
|
+
Provides-Extra: all
|
|
16
|
+
Requires-Dist: fastembed>=0.6; extra == 'all'
|
|
17
|
+
Requires-Dist: mcp>=1.6; extra == 'all'
|
|
18
|
+
Requires-Dist: rich>=13.0; extra == 'all'
|
|
19
|
+
Provides-Extra: embedding
|
|
20
|
+
Requires-Dist: fastembed>=0.6; extra == 'embedding'
|
|
21
|
+
Provides-Extra: ui
|
|
22
|
+
Requires-Dist: rich>=13.0; extra == 'ui'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# heropen
|
|
26
|
+
|
|
27
|
+
Persistent memory for AI agents — self-hosted, MCP-native.
|
|
28
|
+
|
|
29
|
+
## 安装
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# 仅用 CLI(不需要 MCP server)
|
|
33
|
+
pip install heropen
|
|
34
|
+
|
|
35
|
+
# 需要 MCP server 支持
|
|
36
|
+
pip install heropen[all]
|
|
37
|
+
|
|
38
|
+
# 需要本地 embedding(fastembed)
|
|
39
|
+
pip install heropen[embedding]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`heropen[all]` 包含 `heropen[embedding]` + `mcp>=1.6`,安装这个就够了。
|
|
43
|
+
|
|
44
|
+
## 使用
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# 初始化
|
|
48
|
+
heropen init
|
|
49
|
+
|
|
50
|
+
# 导入已有记忆(JSON 行格式)
|
|
51
|
+
heropen bootstrap --agent xiaokai < memory.jsonl
|
|
52
|
+
|
|
53
|
+
# 搜索记忆
|
|
54
|
+
heropen search "关键词"
|
|
55
|
+
|
|
56
|
+
# 启动 MCP server
|
|
57
|
+
heropen-mcp
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 项目地址
|
|
61
|
+
|
|
62
|
+
<https://ksmn.cc/heropen>
|
heropen-1.3.0/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# heropen
|
|
2
|
+
|
|
3
|
+
Persistent memory for AI agents — self-hosted, MCP-native.
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 仅用 CLI(不需要 MCP server)
|
|
9
|
+
pip install heropen
|
|
10
|
+
|
|
11
|
+
# 需要 MCP server 支持
|
|
12
|
+
pip install heropen[all]
|
|
13
|
+
|
|
14
|
+
# 需要本地 embedding(fastembed)
|
|
15
|
+
pip install heropen[embedding]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`heropen[all]` 包含 `heropen[embedding]` + `mcp>=1.6`,安装这个就够了。
|
|
19
|
+
|
|
20
|
+
## 使用
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# 初始化
|
|
24
|
+
heropen init
|
|
25
|
+
|
|
26
|
+
# 导入已有记忆(JSON 行格式)
|
|
27
|
+
heropen bootstrap --agent xiaokai < memory.jsonl
|
|
28
|
+
|
|
29
|
+
# 搜索记忆
|
|
30
|
+
heropen search "关键词"
|
|
31
|
+
|
|
32
|
+
# 启动 MCP server
|
|
33
|
+
heropen-mcp
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 项目地址
|
|
37
|
+
|
|
38
|
+
<https://ksmn.cc/heropen>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "heropen"
|
|
7
|
+
version = "1.3.0"
|
|
8
|
+
description = "HeroPen — AI Agent Long-term Memory System"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "KSMN Studio", email = "hello@ksmn.cc"},
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
dependencies = [
|
|
22
|
+
"requests>=2.28",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
embedding = [
|
|
27
|
+
"fastembed>=0.6",
|
|
28
|
+
]
|
|
29
|
+
ui = [
|
|
30
|
+
"rich>=13.0",
|
|
31
|
+
]
|
|
32
|
+
all = [
|
|
33
|
+
"heropen[embedding]",
|
|
34
|
+
"heropen[ui]",
|
|
35
|
+
"mcp>=1.6",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.scripts]
|
|
39
|
+
heropen = "heropen.cli:main"
|
|
40
|
+
|
|
41
|
+
[tool.hatch.build.targets.wheel]
|
|
42
|
+
packages = ["src/heropen"]
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://ksmn.cc/heropen"
|
|
46
|
+
Documentation = "https://ksmn.cc/heropen/docs"
|
|
47
|
+
Repository = "https://github.com/koradji88/heropen"
|
|
@@ -0,0 +1,41 @@
|
|
|
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.2.1"
|
|
9
|
+
__all__ = [
|
|
10
|
+
"add_entry", "update_entry",
|
|
11
|
+
"search_vector", "search_fts", "search_graph",
|
|
12
|
+
"search_by_date", "search_by_tag", "search_recent",
|
|
13
|
+
"search_with_date_filter",
|
|
14
|
+
"auto_backup", "integrity_check", "startup_self_heal",
|
|
15
|
+
"init_db", "conn", "db_path",
|
|
16
|
+
"get_embedding", "cosine_similarity",
|
|
17
|
+
"capture_session_content",
|
|
18
|
+
"AGENTS",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
from heropen.core import (
|
|
22
|
+
add_entry,
|
|
23
|
+
update_entry,
|
|
24
|
+
search_vector,
|
|
25
|
+
search_fts,
|
|
26
|
+
search_graph,
|
|
27
|
+
search_by_date,
|
|
28
|
+
search_by_tag,
|
|
29
|
+
search_recent,
|
|
30
|
+
search_with_date_filter,
|
|
31
|
+
auto_backup,
|
|
32
|
+
integrity_check,
|
|
33
|
+
startup_self_heal,
|
|
34
|
+
init_db,
|
|
35
|
+
conn,
|
|
36
|
+
db_path,
|
|
37
|
+
get_embedding,
|
|
38
|
+
cosine_similarity,
|
|
39
|
+
capture_session_content,
|
|
40
|
+
AGENTS,
|
|
41
|
+
)
|
|
@@ -0,0 +1,147 @@
|
|
|
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
|
+
elif cmd in ("session",):
|
|
100
|
+
from heropen.cli_commands import cmd_session
|
|
101
|
+
cmd_session(args[1:])
|
|
102
|
+
else:
|
|
103
|
+
print(f"heropen: unknown command '{cmd}'")
|
|
104
|
+
print_help()
|
|
105
|
+
sys.exit(1)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def print_help():
|
|
109
|
+
help_text = f"""
|
|
110
|
+
HeroPen v1.2.0 — AI Agent Long-term Memory System
|
|
111
|
+
|
|
112
|
+
Usage:
|
|
113
|
+
heropen <command> [options]
|
|
114
|
+
|
|
115
|
+
Commands:
|
|
116
|
+
install Interactive install wizard (NEW in v1.2.0)
|
|
117
|
+
init Initialize agent memory database
|
|
118
|
+
add Add a new memory entry
|
|
119
|
+
recall Search and recall memories
|
|
120
|
+
search Search memories (alias for recall)
|
|
121
|
+
list List memory stats (alias for status)
|
|
122
|
+
status Database statistics
|
|
123
|
+
entities View knowledge graph
|
|
124
|
+
bootstrap Agent memory startup summary
|
|
125
|
+
capture Auto-capture key sentences from stdin
|
|
126
|
+
sync Sync from diary.md to database
|
|
127
|
+
embed Generate embeddings for existing entries
|
|
128
|
+
backup Export memories to JSON
|
|
129
|
+
restore Import memories from JSON backup
|
|
130
|
+
delete Delete a memory entry
|
|
131
|
+
health Check system health (alias for status)
|
|
132
|
+
session Save or recover session checkpoint
|
|
133
|
+
mcp Start MCP server
|
|
134
|
+
help Show this help message
|
|
135
|
+
version Show version
|
|
136
|
+
|
|
137
|
+
Options:
|
|
138
|
+
-h, --help Show this help message
|
|
139
|
+
-V, --version Show version
|
|
140
|
+
|
|
141
|
+
Data directory: {HERO_PEN_DIR}
|
|
142
|
+
"""
|
|
143
|
+
print(help_text.strip())
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
if __name__ == "__main__":
|
|
147
|
+
main()
|