omni-cortex 1.3.0__py3-none-any.whl → 1.11.3__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.
- omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/.env.example +12 -0
- omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/backfill_summaries.py +280 -0
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/chat_service.py +19 -10
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/database.py +97 -18
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/image_service.py +21 -12
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/logging_config.py +34 -4
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/main.py +390 -13
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/models.py +64 -12
- omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/prompt_security.py +111 -0
- omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/security.py +104 -0
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/websocket_manager.py +24 -2
- omni_cortex-1.11.3.data/data/share/omni-cortex/hooks/post_tool_use.py +429 -0
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/hooks/pre_tool_use.py +52 -2
- omni_cortex-1.11.3.data/data/share/omni-cortex/hooks/session_utils.py +186 -0
- {omni_cortex-1.3.0.dist-info → omni_cortex-1.11.3.dist-info}/METADATA +237 -8
- omni_cortex-1.11.3.dist-info/RECORD +25 -0
- omni_cortex-1.3.0.data/data/share/omni-cortex/hooks/post_tool_use.py +0 -160
- omni_cortex-1.3.0.dist-info/RECORD +0 -20
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/project_config.py +0 -0
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/project_scanner.py +0 -0
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/pyproject.toml +0 -0
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/uv.lock +0 -0
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/hooks/stop.py +0 -0
- {omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/hooks/subagent_stop.py +0 -0
- {omni_cortex-1.3.0.dist-info → omni_cortex-1.11.3.dist-info}/WHEEL +0 -0
- {omni_cortex-1.3.0.dist-info → omni_cortex-1.11.3.dist-info}/entry_points.txt +0 -0
- {omni_cortex-1.3.0.dist-info → omni_cortex-1.11.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""PostToolUse hook - logs tool result after execution.
|
|
3
|
-
|
|
4
|
-
This hook is called by Claude Code after each tool completes.
|
|
5
|
-
It logs the tool output, duration, and success/error status.
|
|
6
|
-
|
|
7
|
-
Hook configuration for settings.json:
|
|
8
|
-
{
|
|
9
|
-
"hooks": {
|
|
10
|
-
"PostToolUse": [
|
|
11
|
-
{
|
|
12
|
-
"type": "command",
|
|
13
|
-
"command": "python hooks/post_tool_use.py"
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
import json
|
|
21
|
-
import sys
|
|
22
|
-
import os
|
|
23
|
-
import sqlite3
|
|
24
|
-
from datetime import datetime, timezone
|
|
25
|
-
from pathlib import Path
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def get_db_path() -> Path:
|
|
29
|
-
"""Get the database path for the current project."""
|
|
30
|
-
project_path = os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd())
|
|
31
|
-
return Path(project_path) / ".omni-cortex" / "cortex.db"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def ensure_database(db_path: Path) -> sqlite3.Connection:
|
|
35
|
-
"""Ensure database exists and is initialized.
|
|
36
|
-
|
|
37
|
-
Auto-creates the database and schema if it doesn't exist.
|
|
38
|
-
This enables 'out of the box' functionality.
|
|
39
|
-
"""
|
|
40
|
-
db_path.parent.mkdir(parents=True, exist_ok=True)
|
|
41
|
-
conn = sqlite3.connect(str(db_path))
|
|
42
|
-
|
|
43
|
-
# Check if schema exists
|
|
44
|
-
cursor = conn.cursor()
|
|
45
|
-
cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='activities'")
|
|
46
|
-
if cursor.fetchone() is None:
|
|
47
|
-
# Apply minimal schema for activities (full schema applied by MCP)
|
|
48
|
-
conn.executescript("""
|
|
49
|
-
CREATE TABLE IF NOT EXISTS activities (
|
|
50
|
-
id TEXT PRIMARY KEY,
|
|
51
|
-
session_id TEXT,
|
|
52
|
-
agent_id TEXT,
|
|
53
|
-
timestamp TEXT NOT NULL,
|
|
54
|
-
event_type TEXT NOT NULL,
|
|
55
|
-
tool_name TEXT,
|
|
56
|
-
tool_input TEXT,
|
|
57
|
-
tool_output TEXT,
|
|
58
|
-
duration_ms INTEGER,
|
|
59
|
-
success INTEGER DEFAULT 1,
|
|
60
|
-
error_message TEXT,
|
|
61
|
-
project_path TEXT,
|
|
62
|
-
file_path TEXT,
|
|
63
|
-
metadata TEXT
|
|
64
|
-
);
|
|
65
|
-
CREATE INDEX IF NOT EXISTS idx_activities_timestamp ON activities(timestamp DESC);
|
|
66
|
-
CREATE INDEX IF NOT EXISTS idx_activities_tool ON activities(tool_name);
|
|
67
|
-
""")
|
|
68
|
-
conn.commit()
|
|
69
|
-
|
|
70
|
-
return conn
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def generate_id() -> str:
|
|
74
|
-
"""Generate a unique activity ID."""
|
|
75
|
-
timestamp_ms = int(datetime.now().timestamp() * 1000)
|
|
76
|
-
random_hex = os.urandom(4).hex()
|
|
77
|
-
return f"act_{timestamp_ms}_{random_hex}"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
def truncate(text: str, max_length: int = 10000) -> str:
|
|
81
|
-
"""Truncate text to max length."""
|
|
82
|
-
if len(text) <= max_length:
|
|
83
|
-
return text
|
|
84
|
-
return text[:max_length - 20] + "\n... [truncated]"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def main():
|
|
88
|
-
"""Process PostToolUse hook."""
|
|
89
|
-
try:
|
|
90
|
-
# Read all input at once (more reliable than json.load on stdin)
|
|
91
|
-
raw_input = sys.stdin.read()
|
|
92
|
-
if not raw_input or not raw_input.strip():
|
|
93
|
-
print(json.dumps({}))
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
input_data = json.loads(raw_input)
|
|
97
|
-
|
|
98
|
-
# Extract data from hook input
|
|
99
|
-
tool_name = input_data.get("tool_name")
|
|
100
|
-
tool_input = input_data.get("tool_input", {})
|
|
101
|
-
tool_output = input_data.get("tool_output", {})
|
|
102
|
-
agent_id = input_data.get("agent_id")
|
|
103
|
-
|
|
104
|
-
# Determine success/error
|
|
105
|
-
is_error = input_data.get("is_error", False)
|
|
106
|
-
error_message = None
|
|
107
|
-
if is_error and isinstance(tool_output, dict):
|
|
108
|
-
error_message = tool_output.get("error") or tool_output.get("message")
|
|
109
|
-
|
|
110
|
-
# Skip logging our own tools to prevent recursion
|
|
111
|
-
# MCP tools are named like "mcp__omni-cortex__cortex_remember"
|
|
112
|
-
if tool_name and ("cortex_" in tool_name or "omni-cortex" in tool_name):
|
|
113
|
-
print(json.dumps({}))
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
session_id = os.environ.get("CLAUDE_SESSION_ID")
|
|
117
|
-
project_path = os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd())
|
|
118
|
-
|
|
119
|
-
# Auto-initialize database (creates if not exists)
|
|
120
|
-
db_path = get_db_path()
|
|
121
|
-
conn = ensure_database(db_path)
|
|
122
|
-
|
|
123
|
-
# Insert activity record
|
|
124
|
-
cursor = conn.cursor()
|
|
125
|
-
cursor.execute(
|
|
126
|
-
"""
|
|
127
|
-
INSERT INTO activities (
|
|
128
|
-
id, session_id, agent_id, timestamp, event_type,
|
|
129
|
-
tool_name, tool_input, tool_output, success, error_message, project_path
|
|
130
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
131
|
-
""",
|
|
132
|
-
(
|
|
133
|
-
generate_id(),
|
|
134
|
-
session_id,
|
|
135
|
-
agent_id,
|
|
136
|
-
datetime.now(timezone.utc).isoformat(),
|
|
137
|
-
"post_tool_use",
|
|
138
|
-
tool_name,
|
|
139
|
-
truncate(json.dumps(tool_input, default=str)),
|
|
140
|
-
truncate(json.dumps(tool_output, default=str)),
|
|
141
|
-
0 if is_error else 1,
|
|
142
|
-
error_message,
|
|
143
|
-
project_path,
|
|
144
|
-
),
|
|
145
|
-
)
|
|
146
|
-
conn.commit()
|
|
147
|
-
conn.close()
|
|
148
|
-
|
|
149
|
-
# Return empty response (no modification)
|
|
150
|
-
print(json.dumps({}))
|
|
151
|
-
|
|
152
|
-
except Exception as e:
|
|
153
|
-
# Hooks should never block - log error but continue
|
|
154
|
-
print(json.dumps({"systemMessage": f"Cortex post_tool_use: {e}"}))
|
|
155
|
-
|
|
156
|
-
sys.exit(0)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if __name__ == "__main__":
|
|
160
|
-
main()
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/hooks/post_tool_use.py,sha256=zXy30KNDW6UoWP0nwq5n320r1wFa-tE6V4QuSdDzx8w,5106
|
|
2
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/hooks/pre_tool_use.py,sha256=SlvvEKsIkolDG5Y_35VezY2e7kRpbj1GiDlBW-naj2g,4900
|
|
3
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/hooks/stop.py,sha256=T1bwcmbTLj0gzjrVvFBT1zB6wff4J2YkYBAY-ZxZI5g,5336
|
|
4
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/hooks/subagent_stop.py,sha256=V9HQSFGNOfkg8ZCstPEy4h5V8BP4AbrVr8teFzN1kNk,3314
|
|
5
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/dashboard/backend/chat_service.py,sha256=xEuMLkr0nAG_BlpOa1H5iJ3grpoO711XNjFD6wUXiJI,8641
|
|
6
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/dashboard/backend/database.py,sha256=Liw4Kztabz4iLCjTpxCKCBi5Jg2Zb56bDquL6tFwgPM,31892
|
|
7
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/dashboard/backend/image_service.py,sha256=usyY8TUc-MzQLAuezSvrcmtPe52VcKUZfA9QBXRoJto,18523
|
|
8
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/dashboard/backend/logging_config.py,sha256=dFcNqfw2jTfUjFERV_Pr5r5PjY9wSQGXEYPf0AyR5Yk,2869
|
|
9
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/dashboard/backend/main.py,sha256=QSWqe3JJ9iDQn__wIUQTzYw1DsP2hb-5Dq4W6lWZzRc,32497
|
|
10
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/dashboard/backend/models.py,sha256=lWb4Rvy6E-x21CGAeahSdVRzxGCVrEgYdc5vKbfo6_A,5671
|
|
11
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/dashboard/backend/project_config.py,sha256=ZxGoeRpHvN5qQyf2hRxrAZiHrPSwdQp59f0di6O1LKM,4352
|
|
12
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/dashboard/backend/project_scanner.py,sha256=lwFXS8iJbOoxf7FAyo2TjH25neaMHiJ8B3jS57XxtDI,5713
|
|
13
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/dashboard/backend/pyproject.toml,sha256=9pbbGQXLe1Xd06nZAtDySCHIlfMWvPaB-C6tGZR6umc,502
|
|
14
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/dashboard/backend/uv.lock,sha256=miB9zGGSirBkjDE-OZTPCnv43Yc98xuAz_Ne8vTNFHg,186004
|
|
15
|
-
omni_cortex-1.3.0.data/data/share/omni-cortex/dashboard/backend/websocket_manager.py,sha256=fv16XkRkgN4SDNwTiP_p9qFnWta9lIpAXgKbFETZ7uM,2770
|
|
16
|
-
omni_cortex-1.3.0.dist-info/METADATA,sha256=-F_KhxEBwaZtqvVIPKvx3WANM50RQDKekkr7OZuhoxc,9855
|
|
17
|
-
omni_cortex-1.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
18
|
-
omni_cortex-1.3.0.dist-info/entry_points.txt,sha256=rohx4mFH2ffZmMb9QXPZmFf-ZGjA3jpKVDVeET-ttiM,150
|
|
19
|
-
omni_cortex-1.3.0.dist-info/licenses/LICENSE,sha256=oG_397owMmi-Umxp5sYocJ6RPohp9_bDNnnEu9OUphg,1072
|
|
20
|
-
omni_cortex-1.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/uv.lock
RENAMED
|
File without changes
|
|
File without changes
|
{omni_cortex-1.3.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/hooks/subagent_stop.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|