deepwrap 0.2.2__tar.gz → 0.2.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.
- {deepwrap-0.2.2 → deepwrap-0.2.3}/PKG-INFO +2 -2
- {deepwrap-0.2.2 → deepwrap-0.2.3}/README.md +1 -1
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/client.py +9 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/config.py +1 -1
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/memory.py +16 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap.egg-info/PKG-INFO +2 -2
- {deepwrap-0.2.2 → deepwrap-0.2.3}/pyproject.toml +1 -1
- {deepwrap-0.2.2 → deepwrap-0.2.3}/tests/test_memory.py +41 -4
- {deepwrap-0.2.2 → deepwrap-0.2.3}/LICENSE +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/__init__.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/__main__.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/api/__init__.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/api/base.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/api/chat_session.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/api/chats.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/api/files.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/api/pow.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/core/__init__.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/core/auth.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/core/session_manager.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/function_calling.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/interfaces/__init__.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/interfaces/api.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/interfaces/cli.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/modules/__init__.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/modules/pow_asm.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/native_tools.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/project_intelligence.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/py.typed +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/bearer_token_extractor.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/browser_finder.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/browser_process.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/cdp_client.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/config_store.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/dev_tools_http.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/port_finder.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap.egg-info/SOURCES.txt +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap.egg-info/dependency_links.txt +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap.egg-info/entry_points.txt +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap.egg-info/requires.txt +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap.egg-info/top_level.txt +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/setup.cfg +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/tests/test_agent_acceptance.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/tests/test_chat_session.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/tests/test_cli_agent_tools.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/tests/test_cli_markdown.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/tests/test_native_tools.py +0 -0
- {deepwrap-0.2.2 → deepwrap-0.2.3}/tests/test_project_intelligence.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepwrap
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Python SDK, CLI, and local FastAPI wrapper for DeepSeek Chat.
|
|
5
5
|
Author-email: Nika Kudukhashvili <nikakuduxashvili0@gmail.com>
|
|
6
6
|
Maintainer-email: Nika Kudukhashvili <nikakuduxashvili0@gmail.com>
|
|
@@ -749,7 +749,7 @@ Example response:
|
|
|
749
749
|
{
|
|
750
750
|
"ok": true,
|
|
751
751
|
"app": "deepwrap",
|
|
752
|
-
"version": "0.2.
|
|
752
|
+
"version": "0.2.3",
|
|
753
753
|
"token_configured": true,
|
|
754
754
|
"cached_clients": 1,
|
|
755
755
|
"active_sessions": 0
|
|
@@ -96,6 +96,7 @@ class Client:
|
|
|
96
96
|
|
|
97
97
|
self._conversations: dict[str, ChatSession] = {}
|
|
98
98
|
self._responses: dict[str, str] = {}
|
|
99
|
+
self._loaded_sessions: set[str] = set()
|
|
99
100
|
|
|
100
101
|
def register_tool(
|
|
101
102
|
self,
|
|
@@ -145,6 +146,14 @@ class Client:
|
|
|
145
146
|
return ""
|
|
146
147
|
sections: list[str] = []
|
|
147
148
|
if session_id:
|
|
149
|
+
if session_id not in self._loaded_sessions:
|
|
150
|
+
self._loaded_sessions.add(session_id)
|
|
151
|
+
priority_mems = self.memory.get_priority_memories(limit=20, min_importance=0.9)
|
|
152
|
+
if priority_mems:
|
|
153
|
+
sections.append(
|
|
154
|
+
"[PRIORITY MEMORIES]\n"
|
|
155
|
+
+ "\n".join(f"- ({item['id']}) {item['content']}" for item in priority_mems)
|
|
156
|
+
)
|
|
148
157
|
context = self.memory.session_context(session_id, limit=20)
|
|
149
158
|
if context:
|
|
150
159
|
sections.append("[RESUMED SESSION]\n" + context)
|
|
@@ -146,6 +146,22 @@ class MemoryStore:
|
|
|
146
146
|
).fetchall()
|
|
147
147
|
return [self._row(row) for row in rows]
|
|
148
148
|
|
|
149
|
+
def get_priority_memories(self, limit: int = 20, min_importance: float = 0.9) -> list[dict[str, Any]]:
|
|
150
|
+
with self._lock:
|
|
151
|
+
rows = self._connection.execute(
|
|
152
|
+
"SELECT * FROM memories WHERE namespace = ? AND importance >= ? ORDER BY updated_at DESC LIMIT ?",
|
|
153
|
+
(self.namespace, min_importance, limit),
|
|
154
|
+
).fetchall()
|
|
155
|
+
return [self._row(row) for row in rows]
|
|
156
|
+
|
|
157
|
+
def has_turns(self, session_id: str) -> bool:
|
|
158
|
+
with self._lock:
|
|
159
|
+
row = self._connection.execute(
|
|
160
|
+
"SELECT COUNT(*) FROM turns WHERE session_id = ?",
|
|
161
|
+
(session_id,),
|
|
162
|
+
).fetchone()
|
|
163
|
+
return row[0] > 0 if row else False
|
|
164
|
+
|
|
149
165
|
def forget(self, memory_id: str) -> dict[str, Any]:
|
|
150
166
|
memory = self.get(memory_id)
|
|
151
167
|
with self._lock, self._connection:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepwrap
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Python SDK, CLI, and local FastAPI wrapper for DeepSeek Chat.
|
|
5
5
|
Author-email: Nika Kudukhashvili <nikakuduxashvili0@gmail.com>
|
|
6
6
|
Maintainer-email: Nika Kudukhashvili <nikakuduxashvili0@gmail.com>
|
|
@@ -749,7 +749,7 @@ Example response:
|
|
|
749
749
|
{
|
|
750
750
|
"ok": true,
|
|
751
751
|
"app": "deepwrap",
|
|
752
|
-
"version": "0.2.
|
|
752
|
+
"version": "0.2.3",
|
|
753
753
|
"token_configured": true,
|
|
754
754
|
"cached_clients": 1,
|
|
755
755
|
"active_sessions": 0
|
|
@@ -55,10 +55,47 @@ class MemoryStoreTests(unittest.TestCase):
|
|
|
55
55
|
{tool.name for tool in self.memory.definitions},
|
|
56
56
|
{"remember", "recall", "list_memories", "forget", "list_sessions"},
|
|
57
57
|
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
)
|
|
58
|
+
def test_priority_memories_and_turns(self):
|
|
59
|
+
# 1. Test has_turns
|
|
60
|
+
session_id = self.memory.create_session("expert")
|
|
61
|
+
self.assertFalse(self.memory.has_turns(session_id))
|
|
62
|
+
self.memory.add_turn(session_id, "user", "hi")
|
|
63
|
+
self.assertTrue(self.memory.has_turns(session_id))
|
|
64
|
+
|
|
65
|
+
# 2. Test get_priority_memories
|
|
66
|
+
self.memory.remember("Low priority memory", importance=0.5)
|
|
67
|
+
high1 = self.memory.remember("High priority memory 1", importance=0.9)
|
|
68
|
+
high2 = self.memory.remember("High priority memory 2", importance=0.95)
|
|
69
|
+
|
|
70
|
+
priority = self.memory.get_priority_memories(limit=10, min_importance=0.9)
|
|
71
|
+
self.assertEqual(len(priority), 2)
|
|
72
|
+
# Verify ordering is updated_at DESC (last inserted first)
|
|
73
|
+
self.assertEqual(priority[0]["id"], high2["id"])
|
|
74
|
+
self.assertEqual(priority[1]["id"], high1["id"])
|
|
75
|
+
|
|
76
|
+
def test_client_memory_context_priority_load(self):
|
|
77
|
+
from deepwrap.client import Client
|
|
78
|
+
|
|
79
|
+
# Write some memories
|
|
80
|
+
self.memory.remember("Low priority", importance=0.5)
|
|
81
|
+
self.memory.remember("High priority 1", importance=0.9)
|
|
82
|
+
self.memory.remember("High priority 2", importance=0.95)
|
|
83
|
+
|
|
84
|
+
client = Client(api_key="test-key", memory_path=self.path, memory_namespace="project-a")
|
|
85
|
+
session_id = client.memory.create_session("expert")
|
|
86
|
+
|
|
87
|
+
# 1. First load of a session
|
|
88
|
+
context = client.memory_context("query", session_id)
|
|
89
|
+
self.assertIn("[PRIORITY MEMORIES]", context)
|
|
90
|
+
self.assertIn("High priority 1", context)
|
|
91
|
+
self.assertIn("High priority 2", context)
|
|
92
|
+
self.assertNotIn("Low priority", context)
|
|
93
|
+
|
|
94
|
+
# 2. Second load of the same session -> should not load priority memories again
|
|
95
|
+
context2 = client.memory_context("query", session_id)
|
|
96
|
+
self.assertNotIn("[PRIORITY MEMORIES]", context2)
|
|
97
|
+
|
|
98
|
+
|
|
62
99
|
|
|
63
100
|
|
|
64
101
|
if __name__ == "__main__":
|
|
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
|
|
File without changes
|