code-puppy 0.0.83__py3-none-any.whl → 0.0.85__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.
- code_puppy/__init__.py +1 -0
- code_puppy/agent.py +8 -35
- code_puppy/agent_prompts.py +1 -3
- code_puppy/command_line/motd.py +1 -1
- code_puppy/main.py +24 -13
- code_puppy/message_history_processor.py +128 -36
- code_puppy/model_factory.py +20 -14
- code_puppy/state_management.py +9 -5
- code_puppy/summarization_agent.py +2 -4
- code_puppy/tools/__init__.py +4 -1
- code_puppy/tools/command_runner.py +355 -116
- code_puppy/tools/file_modifications.py +3 -1
- code_puppy/tools/file_operations.py +30 -23
- {code_puppy-0.0.83.dist-info → code_puppy-0.0.85.dist-info}/METADATA +1 -1
- code_puppy-0.0.85.dist-info/RECORD +30 -0
- code_puppy/session_memory.py +0 -83
- code_puppy-0.0.83.dist-info/RECORD +0 -31
- {code_puppy-0.0.83.data → code_puppy-0.0.85.data}/data/code_puppy/models.json +0 -0
- {code_puppy-0.0.83.dist-info → code_puppy-0.0.85.dist-info}/WHEEL +0 -0
- {code_puppy-0.0.83.dist-info → code_puppy-0.0.85.dist-info}/entry_points.txt +0 -0
- {code_puppy-0.0.83.dist-info → code_puppy-0.0.85.dist-info}/licenses/LICENSE +0 -0
code_puppy/session_memory.py
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
from datetime import datetime, timedelta
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
from typing import Any, Dict, List, Optional
|
|
5
|
-
|
|
6
|
-
DEFAULT_MEMORY_PATH = Path(".puppy_session_memory.json")
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class SessionMemory:
|
|
10
|
-
"""
|
|
11
|
-
Simple persistent memory for Code Puppy agent sessions.
|
|
12
|
-
Stores short histories of tasks, notes, user preferences, and watched files.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
def __init__(
|
|
16
|
-
self, storage_path: Path = DEFAULT_MEMORY_PATH, memory_limit: int = 128
|
|
17
|
-
):
|
|
18
|
-
self.storage_path = storage_path
|
|
19
|
-
self.memory_limit = memory_limit
|
|
20
|
-
self._data = {
|
|
21
|
-
"history": [], # List of task/event dicts
|
|
22
|
-
"user_preferences": {},
|
|
23
|
-
"watched_files": [],
|
|
24
|
-
}
|
|
25
|
-
self._load()
|
|
26
|
-
|
|
27
|
-
def _load(self):
|
|
28
|
-
if self.storage_path.exists():
|
|
29
|
-
try:
|
|
30
|
-
self._data = json.loads(self.storage_path.read_text())
|
|
31
|
-
except Exception:
|
|
32
|
-
self._data = {
|
|
33
|
-
"history": [],
|
|
34
|
-
"user_preferences": {},
|
|
35
|
-
"watched_files": [],
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
def _save(self):
|
|
39
|
-
try:
|
|
40
|
-
self.storage_path.write_text(json.dumps(self._data, indent=2))
|
|
41
|
-
except Exception:
|
|
42
|
-
pass # Don't crash the agent for memory fails
|
|
43
|
-
|
|
44
|
-
def log_task(self, description: str, extras: Optional[Dict[str, Any]] = None):
|
|
45
|
-
entry = {
|
|
46
|
-
"timestamp": datetime.utcnow().isoformat(),
|
|
47
|
-
"description": description,
|
|
48
|
-
}
|
|
49
|
-
if extras:
|
|
50
|
-
entry.update(extras)
|
|
51
|
-
self._data["history"].append(entry)
|
|
52
|
-
# Trim memory
|
|
53
|
-
self._data["history"] = self._data["history"][-self.memory_limit :]
|
|
54
|
-
self._save()
|
|
55
|
-
|
|
56
|
-
def get_history(self, within_minutes: Optional[int] = None) -> List[Dict[str, Any]]:
|
|
57
|
-
if not within_minutes:
|
|
58
|
-
return list(self._data["history"])
|
|
59
|
-
cutoff = datetime.utcnow() - timedelta(minutes=within_minutes)
|
|
60
|
-
return [
|
|
61
|
-
h
|
|
62
|
-
for h in self._data["history"]
|
|
63
|
-
if datetime.fromisoformat(h["timestamp"]) >= cutoff
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
def set_preference(self, key: str, value: Any):
|
|
67
|
-
self._data["user_preferences"][key] = value
|
|
68
|
-
self._save()
|
|
69
|
-
|
|
70
|
-
def get_preference(self, key: str, default: Any = None) -> Any:
|
|
71
|
-
return self._data["user_preferences"].get(key, default)
|
|
72
|
-
|
|
73
|
-
def add_watched_file(self, path: str):
|
|
74
|
-
if path not in self._data["watched_files"]:
|
|
75
|
-
self._data["watched_files"].append(path)
|
|
76
|
-
self._save()
|
|
77
|
-
|
|
78
|
-
def list_watched_files(self) -> List[str]:
|
|
79
|
-
return list(self._data["watched_files"])
|
|
80
|
-
|
|
81
|
-
def clear(self):
|
|
82
|
-
self._data = {"history": [], "user_preferences": {}, "watched_files": []}
|
|
83
|
-
self._save()
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
code_puppy/__init__.py,sha256=oDE4GhaqOHsYi9XCGp6A2-PqhDqxJiYP_XmxmoKWoPU,168
|
|
2
|
-
code_puppy/agent.py,sha256=E-wXWYESbGvcEIqqZQm0gXeWec2eVlsvMG8RmtntFx4,3931
|
|
3
|
-
code_puppy/agent_prompts.py,sha256=13YIpTZa3R3lg60-fdkll7t7hgSBtQL0M53wcE1gzyQ,6834
|
|
4
|
-
code_puppy/config.py,sha256=r5nw5ChOP8xd_K5yo8U5OtO2gy2bFhARiyNtDp1JrwQ,5013
|
|
5
|
-
code_puppy/main.py,sha256=uKMG0WNrFjEbsiEb_OwL_fNJbqMyTgztGjPKIOoYdSs,10444
|
|
6
|
-
code_puppy/message_history_processor.py,sha256=MNsr3irynhqS02n7nRtp4WKMVPJsXmjpgjMwvkjqtdA,6152
|
|
7
|
-
code_puppy/model_factory.py,sha256=3j7AcJfZAHbx_plL9oOxjGJO0MMTRaQFThCErg8VpH8,10909
|
|
8
|
-
code_puppy/models.json,sha256=jr0-LW87aJS79GosVwoZdHeeq5eflPzgdPoMbcqpVA8,2728
|
|
9
|
-
code_puppy/session_memory.py,sha256=4sgAAjbXdLSi8hETpd56tgtrG6hqMUuZWDlJOu6BQjA,2735
|
|
10
|
-
code_puppy/state_management.py,sha256=1QycApDBbXjayxXsYRecJib8TQ-MYMTeYvN5P_1Ipdg,1747
|
|
11
|
-
code_puppy/summarization_agent.py,sha256=N1UZg_R3wJFb7ZdVexDqx7L_8yxQ5m5nMOwGsLNfvKM,2744
|
|
12
|
-
code_puppy/version_checker.py,sha256=aRGulzuY4C4CdFvU1rITduyL-1xTFsn4GiD1uSfOl_Y,396
|
|
13
|
-
code_puppy/command_line/__init__.py,sha256=y7WeRemfYppk8KVbCGeAIiTuiOszIURCDjOMZv_YRmU,45
|
|
14
|
-
code_puppy/command_line/file_path_completion.py,sha256=gw8NpIxa6GOpczUJRyh7VNZwoXKKn-yvCqit7h2y6Gg,2931
|
|
15
|
-
code_puppy/command_line/meta_command_handler.py,sha256=L7qP2g0Faz0V7bMH4YK3s03OWWuQFtK7Sh-Kt2zmmEQ,6182
|
|
16
|
-
code_puppy/command_line/model_picker_completion.py,sha256=NkyZZG7IhcVWSJ3ADytwCA5f8DpNeVs759Qtqs4fQtY,3733
|
|
17
|
-
code_puppy/command_line/motd.py,sha256=7ICNgfL4EgSrmCAHIsCK72R19obSQXkK8l7XGJBkvrQ,1571
|
|
18
|
-
code_puppy/command_line/prompt_toolkit_completion.py,sha256=_gP0FIOgHDNHTTWLNL0XNzr6sO0ISe7Mec1uQNo9kcM,8337
|
|
19
|
-
code_puppy/command_line/utils.py,sha256=7eyxDHjPjPB9wGDJQQcXV_zOsGdYsFgI0SGCetVmTqE,1251
|
|
20
|
-
code_puppy/tools/__init__.py,sha256=ozIGpLM7pKSjH4UeojkTodhfVYZeNzMsLtK_oyw41HA,456
|
|
21
|
-
code_puppy/tools/command_runner.py,sha256=NFCL35x44McMzSUNHQyg5q4Zx7wkvqD-nH4_YAU8N2s,7229
|
|
22
|
-
code_puppy/tools/common.py,sha256=M53zhiXZAmPdvi1Y_bzCxgvEmifOvRRJvYPARYRZqHw,2253
|
|
23
|
-
code_puppy/tools/file_modifications.py,sha256=nGI8gRD6Vtkg8EzBkErsv3khE3VI-_M1z_PdQLvjfLo,13847
|
|
24
|
-
code_puppy/tools/file_operations.py,sha256=eftkN-MxsRGQc8c1iIoNmN5r-Ppld5YJRT7a89kxpkM,11207
|
|
25
|
-
code_puppy/tools/ts_code_map.py,sha256=o-u8p5vsYwitfDtVEoPS-7MwWn2xHzwtIQLo1_WMhQs,17647
|
|
26
|
-
code_puppy-0.0.83.data/data/code_puppy/models.json,sha256=jr0-LW87aJS79GosVwoZdHeeq5eflPzgdPoMbcqpVA8,2728
|
|
27
|
-
code_puppy-0.0.83.dist-info/METADATA,sha256=aVwdGS5myGEKw0pnRGYG4hSG6qM1S0Y7CL5j1AMhCdw,6351
|
|
28
|
-
code_puppy-0.0.83.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
29
|
-
code_puppy-0.0.83.dist-info/entry_points.txt,sha256=d8YkBvIUxF-dHNJAj-x4fPEqizbY5d_TwvYpc01U5kw,58
|
|
30
|
-
code_puppy-0.0.83.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
|
|
31
|
-
code_puppy-0.0.83.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|