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.
Files changed (48) hide show
  1. {deepwrap-0.2.2 → deepwrap-0.2.3}/PKG-INFO +2 -2
  2. {deepwrap-0.2.2 → deepwrap-0.2.3}/README.md +1 -1
  3. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/client.py +9 -0
  4. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/config.py +1 -1
  5. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/memory.py +16 -0
  6. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap.egg-info/PKG-INFO +2 -2
  7. {deepwrap-0.2.2 → deepwrap-0.2.3}/pyproject.toml +1 -1
  8. {deepwrap-0.2.2 → deepwrap-0.2.3}/tests/test_memory.py +41 -4
  9. {deepwrap-0.2.2 → deepwrap-0.2.3}/LICENSE +0 -0
  10. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/__init__.py +0 -0
  11. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/__main__.py +0 -0
  12. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/api/__init__.py +0 -0
  13. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/api/base.py +0 -0
  14. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/api/chat_session.py +0 -0
  15. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/api/chats.py +0 -0
  16. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/api/files.py +0 -0
  17. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/api/pow.py +0 -0
  18. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/core/__init__.py +0 -0
  19. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/core/auth.py +0 -0
  20. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/core/session_manager.py +0 -0
  21. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/function_calling.py +0 -0
  22. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/interfaces/__init__.py +0 -0
  23. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/interfaces/api.py +0 -0
  24. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/interfaces/cli.py +0 -0
  25. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/modules/__init__.py +0 -0
  26. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/modules/pow_asm.py +0 -0
  27. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/native_tools.py +0 -0
  28. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/project_intelligence.py +0 -0
  29. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/py.typed +0 -0
  30. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/bearer_token_extractor.py +0 -0
  31. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/browser_finder.py +0 -0
  32. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/browser_process.py +0 -0
  33. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/cdp_client.py +0 -0
  34. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/config_store.py +0 -0
  35. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/dev_tools_http.py +0 -0
  36. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap/utils/port_finder.py +0 -0
  37. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap.egg-info/SOURCES.txt +0 -0
  38. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap.egg-info/dependency_links.txt +0 -0
  39. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap.egg-info/entry_points.txt +0 -0
  40. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap.egg-info/requires.txt +0 -0
  41. {deepwrap-0.2.2 → deepwrap-0.2.3}/deepwrap.egg-info/top_level.txt +0 -0
  42. {deepwrap-0.2.2 → deepwrap-0.2.3}/setup.cfg +0 -0
  43. {deepwrap-0.2.2 → deepwrap-0.2.3}/tests/test_agent_acceptance.py +0 -0
  44. {deepwrap-0.2.2 → deepwrap-0.2.3}/tests/test_chat_session.py +0 -0
  45. {deepwrap-0.2.2 → deepwrap-0.2.3}/tests/test_cli_agent_tools.py +0 -0
  46. {deepwrap-0.2.2 → deepwrap-0.2.3}/tests/test_cli_markdown.py +0 -0
  47. {deepwrap-0.2.2 → deepwrap-0.2.3}/tests/test_native_tools.py +0 -0
  48. {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.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.2",
752
+ "version": "0.2.3",
753
753
  "token_configured": true,
754
754
  "cached_clients": 1,
755
755
  "active_sessions": 0
@@ -694,7 +694,7 @@ Example response:
694
694
  {
695
695
  "ok": true,
696
696
  "app": "deepwrap",
697
- "version": "0.2.2",
697
+ "version": "0.2.3",
698
698
  "token_configured": true,
699
699
  "cached_clients": 1,
700
700
  "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)
@@ -3,7 +3,7 @@ import os
3
3
  from dataclasses import dataclass, field
4
4
  from typing import Dict, Optional
5
5
 
6
- PROJECT_VERSION = "0.2.2"
6
+ PROJECT_VERSION = "0.2.3"
7
7
 
8
8
  @dataclass(frozen=True)
9
9
  class Settings:
@@ -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.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.2",
752
+ "version": "0.2.3",
753
753
  "token_configured": true,
754
754
  "cached_clients": 1,
755
755
  "active_sessions": 0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "deepwrap"
7
- version = "0.2.2"
7
+ version = "0.2.3"
8
8
  description = "Python SDK, CLI, and local FastAPI wrapper for DeepSeek Chat."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -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
- self.assertEqual(
59
- {tool.name for tool in self.memory.definitions},
60
- set(self.memory.functions),
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