@scemoon/cdh 1.0.0 → 1.0.4
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.
- package/cdh/__pycache__/cli.cpython-314.pyc +0 -0
- package/cdh/__pycache__/scaffold.cpython-314.pyc +0 -0
- package/cdh/cli.py +473 -87
- package/cdh/scaffold.py +386 -121
- package/onecode/__pycache__/cli.cpython-314.pyc +0 -0
- package/onecode/__pycache__/commands.cpython-314.pyc +0 -0
- package/onecode/__pycache__/config.cpython-314.pyc +0 -0
- package/onecode/agent/__pycache__/cdh_loader.cpython-314.pyc +0 -0
- package/onecode/agent/__pycache__/engine.cpython-314.pyc +0 -0
- package/onecode/agent/__pycache__/onecode_agent_acp.cpython-314.pyc +0 -0
- package/onecode/agent/__pycache__/session.cpython-314.pyc +0 -0
- package/onecode/agent/agents/__pycache__/types.cpython-314.pyc +0 -0
- package/onecode/agent/agents/types.py +123 -79
- package/onecode/agent/cdh_loader.py +26 -13
- package/onecode/agent/engine.py +426 -235
- package/onecode/agent/onecode_agent_acp.py +202 -75
- package/onecode/agent/session.py +8 -13
- package/onecode/agent/tools/__pycache__/agent_tools.cpython-314.pyc +0 -0
- package/onecode/agent/tools/__pycache__/todo_tools.cpython-314.pyc +0 -0
- package/onecode/agent/tools/agent_tools.py +4 -4
- package/onecode/agent/tools/todo_tools.py +188 -0
- package/onecode/cli.py +3 -3
- package/onecode/commands.py +439 -194
- package/onecode/config.py +3 -3
- package/onecode/config_screen.py +4 -2
- package/onecode/models/__pycache__/errors.cpython-314.pyc +0 -0
- package/onecode/models/__pycache__/messages.cpython-314.pyc +0 -0
- package/onecode/models/__pycache__/provider.cpython-314.pyc +0 -0
- package/onecode/models/errors.py +11 -1
- package/onecode/models/messages.py +35 -16
- package/onecode/models/provider.py +243 -12
- package/onecode/models/providers/__pycache__/anthropic_provider.cpython-314.pyc +0 -0
- package/onecode/models/providers/__pycache__/deepseek_provider.cpython-314.pyc +0 -0
- package/onecode/models/providers/__pycache__/glm_provider.cpython-314.pyc +0 -0
- package/onecode/models/providers/__pycache__/minimax_provider.cpython-314.pyc +0 -0
- package/onecode/models/providers/__pycache__/minimaxi_provider.cpython-314.pyc +0 -0
- package/onecode/models/providers/__pycache__/ollama_provider.cpython-314.pyc +0 -0
- package/onecode/models/providers/__pycache__/openai_provider.cpython-314.pyc +0 -0
- package/onecode/models/providers/anthropic_provider.py +4 -2
- package/onecode/models/providers/deepseek_provider.py +2 -0
- package/onecode/models/providers/glm_provider.py +2 -1
- package/onecode/models/providers/minimax_provider.py +2 -1
- package/onecode/models/providers/minimaxi_provider.py +76 -25
- package/onecode/models/providers/ollama_provider.py +2 -1
- package/onecode/models/providers/openai_provider.py +4 -0
- package/onecode/tasks/manager.py +1 -1
- package/package.json +1 -1
- package/pyproject.toml +10 -0
- package/run.js +24 -7
- package/tui/__pycache__/agents.cpython-314.pyc +0 -0
- package/tui/__pycache__/app.cpython-314.pyc +0 -0
- package/tui/__pycache__/db.cpython-314.pyc +0 -0
- package/tui/__pycache__/directory_watcher.cpython-314.pyc +0 -0
- package/tui/__pycache__/messages.cpython-314.pyc +0 -0
- package/tui/__pycache__/paths.cpython-314.pyc +0 -0
- package/tui/__pycache__/settings_schema.cpython-314.pyc +0 -0
- package/tui/acp/__pycache__/agent.cpython-314.pyc +0 -0
- package/tui/acp/__pycache__/api.cpython-314.pyc +0 -0
- package/tui/acp/__pycache__/messages.cpython-314.pyc +0 -0
- package/tui/acp/__pycache__/prompt.cpython-314.pyc +0 -0
- package/tui/acp/__pycache__/protocol.cpython-314.pyc +0 -0
- package/tui/acp/agent.py +60 -11
- package/tui/acp/api.py +6 -0
- package/tui/acp/messages.py +11 -0
- package/tui/acp/prompt.py +1 -1
- package/tui/acp/protocol.py +31 -0
- package/tui/agents.py +8 -7
- package/tui/app.py +60 -8
- package/tui/data/agents/ampcode.com.toml +1 -0
- package/tui/data/agents/augmentcode.com.toml +1 -0
- package/tui/data/agents/cdh.cloud-dev-harness.toml +3 -2
- package/tui/data/agents/crowai.dev.toml +1 -0
- package/tui/data/agents/deepagents.langchain.com +1 -0
- package/tui/data/agents/docker.com.toml +1 -0
- package/tui/data/agents/goose.ai.toml +1 -0
- package/tui/data/agents/inference.huggingface.co.toml +1 -1
- package/tui/data/agents/kiro.dev.toml +1 -0
- package/tui/data/agents/onecode.dev.toml +22 -0
- package/tui/data/agents/openclaw.ai.toml +1 -1
- package/tui/data/agents/openhands.dev.toml +1 -0
- package/tui/data/agents/stakpak.dev.toml +1 -0
- package/tui/data/agents/vibe.mistral.ai.toml +1 -0
- package/tui/data/agents/vtcode.dev.toml +1 -0
- package/tui/db.py +23 -0
- package/tui/directory_watcher.py +35 -1
- package/tui/messages.py +4 -1
- package/tui/paths.py +3 -3
- package/tui/screens/__pycache__/main.cpython-314.pyc +0 -0
- package/tui/screens/component_picker.py +148 -0
- package/tui/screens/main.py +47 -95
- package/tui/screens/projects.tcss +10 -0
- package/tui/screens/projects_app.py +33 -5
- package/tui/screens/projects_screen.py +171 -9
- package/tui/screens/store.py +1 -1
- package/tui/settings_schema.py +1 -1
- package/tui/widgets/__pycache__/ask_user.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/conversation.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/modified_files.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/plan.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/project_directory_tree.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/question.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/subagent.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/tool_call.cpython-314.pyc +0 -0
- package/tui/widgets/ask_user.py +1 -1
- package/tui/widgets/conversation.py +99 -42
- package/tui/widgets/modified_files.py +191 -65
- package/tui/widgets/plan.py +22 -0
- package/tui/widgets/project_directory_tree.py +22 -10
- package/tui/widgets/project_grid_select.py +23 -1
- package/tui/widgets/question.py +1 -1
- package/tui/widgets/subagent.py +202 -36
- package/tui/widgets/subagent_screen.py +186 -0
- package/tui/widgets/tool_call.py +5 -8
- package/cdh/__pycache__/__init__.cpython-313.pyc +0 -0
- package/cdh/__pycache__/scaffold.cpython-313.pyc +0 -0
- package/onecode/__pycache__/config_screen.cpython-314.pyc +0 -0
- package/onecode/__pycache__/mock_data.cpython-314.pyc +0 -0
- package/onecode/agent/__pycache__/cdh_agent_acp.cpython-313.pyc +0 -0
- package/onecode/agent/__pycache__/cdh_agent_acp.cpython-314.pyc +0 -0
- package/onecode/agent/__pycache__/harness_skill.cpython-314.pyc +0 -0
- package/onecode/agent/tools/__pycache__/task_tools.cpython-314.pyc +0 -0
- package/onecode/agent/tools/task_tools.py +0 -249
- package/onecode/codebase/__pycache__/config.cpython-314.pyc +0 -0
- package/onecode/models/providers/__pycache__/mock_provider.cpython-314.pyc +0 -0
- package/onecode/skills/__pycache__/manager.cpython-314.pyc +0 -0
- package/tui/__pycache__/danger.cpython-314.pyc +0 -0
- package/tui/__pycache__/directory_suggester.cpython-314.pyc +0 -0
- package/tui/screens/__pycache__/log.cpython-314.pyc +0 -0
- package/tui/screens/__pycache__/projects_screen.cpython-314.pyc +0 -0
- package/tui/screens/__pycache__/sessions.cpython-314.pyc +0 -0
- package/tui/screens/__pycache__/settings.cpython-314.pyc +0 -0
- package/tui/screens/__pycache__/store.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/acp_content.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/conversation.cpython-313.pyc +0 -0
- package/tui/widgets/__pycache__/diff_view.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/directory_input.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/future_text.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/grid_select.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/mandelbrot.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/markdown_note.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/project_grid_select.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/project_summary.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/session_grid_select.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/session_summary.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/shell_result.cpython-314.pyc +0 -0
- package/tui/widgets/__pycache__/terminal.cpython-313.pyc +0 -0
- package/tui/widgets/__pycache__/tool_call.cpython-313.pyc +0 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from onecode.agent.tools.protocol import ToolResult
|
|
6
|
+
from onecode.agent.tools.registry import ToolSpec
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TodoCreateTool:
|
|
10
|
+
def __init__(self, todo_manager):
|
|
11
|
+
self._tm = todo_manager
|
|
12
|
+
|
|
13
|
+
def spec(self) -> ToolSpec:
|
|
14
|
+
return ToolSpec(
|
|
15
|
+
name="TodoCreate",
|
|
16
|
+
description=(
|
|
17
|
+
"Create a todo (lightweight checklist item) for tracking progress "
|
|
18
|
+
"in the sidebar. Use for SIMPLE / single-step work (1-3 tool calls). "
|
|
19
|
+
"For complex multi-step work, prefer delegating via `Spawn` subagent "
|
|
20
|
+
"and use TodoCreate only to surface the overall plan. Returns todo id."
|
|
21
|
+
),
|
|
22
|
+
input_schema={
|
|
23
|
+
"type": "object",
|
|
24
|
+
"properties": {
|
|
25
|
+
"subject": {"type": "string", "description": "Short, action-oriented title (verb + noun, e.g. 'Create User model')"},
|
|
26
|
+
"description": {"type": "string", "description": "What needs to be done + acceptance criteria"},
|
|
27
|
+
"activeForm": {"type": "string", "description": "Active form description"},
|
|
28
|
+
"metadata": {"type": "object", "description": 'Optional metadata. Supports priority (high/medium/low), effort (small/medium/large), and delegate_to (general|explore|scout|main) to flag complex todos for Spawn subagent execution.'},
|
|
29
|
+
},
|
|
30
|
+
"required": ["subject", "description"],
|
|
31
|
+
},
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
def run(self, tool_input: dict[str, Any]) -> ToolResult:
|
|
35
|
+
todo = self._tm.create_todo(
|
|
36
|
+
subject=tool_input.get("subject", ""),
|
|
37
|
+
description=tool_input.get("description", ""),
|
|
38
|
+
active_form=tool_input.get("activeForm", ""),
|
|
39
|
+
metadata=tool_input.get("metadata"),
|
|
40
|
+
)
|
|
41
|
+
return ToolResult(name="TodoCreate", output={"task": {"id": todo["id"], "subject": todo["subject"]}})
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class TodoGetTool:
|
|
46
|
+
def __init__(self, todo_manager):
|
|
47
|
+
self._tm = todo_manager
|
|
48
|
+
|
|
49
|
+
def spec(self) -> ToolSpec:
|
|
50
|
+
return ToolSpec(
|
|
51
|
+
name="TodoGet",
|
|
52
|
+
description="Retrieve a todo by ID.",
|
|
53
|
+
input_schema={
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"taskId": {"type": "string", "description": "Todo id to retrieve"},
|
|
57
|
+
},
|
|
58
|
+
"required": ["taskId"],
|
|
59
|
+
},
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def run(self, tool_input: dict[str, Any]) -> ToolResult:
|
|
63
|
+
todo_id = tool_input.get("taskId", "")
|
|
64
|
+
todo = self._tm.get_todo(todo_id)
|
|
65
|
+
if todo is None:
|
|
66
|
+
return ToolResult(name="TodoGet", output={"task": None})
|
|
67
|
+
info = {k: todo[k] for k in ("id", "subject", "description", "status", "blocks", "blockedBy")}
|
|
68
|
+
return ToolResult(name="TodoGet", output={"task": info})
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class TodoListTool:
|
|
73
|
+
def __init__(self, todo_manager):
|
|
74
|
+
self._tm = todo_manager
|
|
75
|
+
|
|
76
|
+
def spec(self) -> ToolSpec:
|
|
77
|
+
return ToolSpec(
|
|
78
|
+
name="TodoList",
|
|
79
|
+
description="List all todos with their current status and dependencies.",
|
|
80
|
+
input_schema={"type": "object", "properties": {}, "required": []},
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
def run(self, tool_input: dict[str, Any]) -> ToolResult:
|
|
84
|
+
todos = self._tm.list_todos()
|
|
85
|
+
if not todos:
|
|
86
|
+
return ToolResult(name="TodoList", output={"tasks": []})
|
|
87
|
+
summaries = []
|
|
88
|
+
for t in todos:
|
|
89
|
+
s = {"id": t["id"], "subject": t["subject"], "status": t["status"]}
|
|
90
|
+
if t.get("owner"):
|
|
91
|
+
s["owner"] = t["owner"]
|
|
92
|
+
s["blockedBy"] = list(t.get("blockedBy") or [])
|
|
93
|
+
summaries.append(s)
|
|
94
|
+
return ToolResult(name="TodoList", output={"tasks": summaries})
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class TodoUpdateTool:
|
|
99
|
+
def __init__(self, todo_manager):
|
|
100
|
+
self._tm = todo_manager
|
|
101
|
+
|
|
102
|
+
def spec(self) -> ToolSpec:
|
|
103
|
+
return ToolSpec(
|
|
104
|
+
name="TodoUpdate",
|
|
105
|
+
description="Update a todo: subject, description, status, owner, dependencies, output.",
|
|
106
|
+
input_schema={
|
|
107
|
+
"type": "object",
|
|
108
|
+
"properties": {
|
|
109
|
+
"taskId": {"type": "string", "description": "Todo id to update"},
|
|
110
|
+
"subject": {"type": "string"},
|
|
111
|
+
"description": {"type": "string"},
|
|
112
|
+
"activeForm": {"type": "string"},
|
|
113
|
+
"status": {"type": "string", "description": "pending|in_progress|completed|deleted"},
|
|
114
|
+
"owner": {"type": "string"},
|
|
115
|
+
"addBlocks": {"type": "array", "items": {"type": "string"}, "description": "Todo IDs this todo blocks"},
|
|
116
|
+
"addBlockedBy": {"type": "array", "items": {"type": "string"}, "description": "Todo IDs that block this"},
|
|
117
|
+
"metadata": {"type": "object"},
|
|
118
|
+
"output": {"type": "string", "description": "Key results to pass to downstream todos"},
|
|
119
|
+
},
|
|
120
|
+
"required": ["taskId"],
|
|
121
|
+
},
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
def run(self, tool_input: dict[str, Any]) -> ToolResult:
|
|
125
|
+
todo_id = tool_input.get("taskId", "")
|
|
126
|
+
updates = {k: v for k, v in tool_input.items() if k != "taskId" and v is not None}
|
|
127
|
+
if "subject" not in updates and "title" in updates:
|
|
128
|
+
updates["subject"] = updates.pop("title")
|
|
129
|
+
if "addBlocks" not in updates and "blocks" in updates and isinstance(updates.get("blocks"), list):
|
|
130
|
+
updates["addBlocks"] = updates.pop("blocks")
|
|
131
|
+
result = self._tm.update_todo(todo_id, **updates)
|
|
132
|
+
if result is None:
|
|
133
|
+
return ToolResult(name="TodoUpdate", output={"success": False, "taskId": todo_id, "error": "Todo not found"}, is_error=True)
|
|
134
|
+
if result.get("deleted"):
|
|
135
|
+
return ToolResult(name="TodoUpdate", output={"success": True, "taskId": todo_id, "updatedFields": ["deleted"]})
|
|
136
|
+
return ToolResult(name="TodoUpdate", output={"success": True, "taskId": todo_id, "task": {"id": result["id"], "subject": result["subject"], "status": result["status"]}})
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class TodoOutputTool:
|
|
141
|
+
def __init__(self, todo_manager):
|
|
142
|
+
self._tm = todo_manager
|
|
143
|
+
|
|
144
|
+
def spec(self) -> ToolSpec:
|
|
145
|
+
return ToolSpec(
|
|
146
|
+
name="TodoOutput",
|
|
147
|
+
description="Get output for a todo.",
|
|
148
|
+
input_schema={
|
|
149
|
+
"type": "object",
|
|
150
|
+
"properties": {
|
|
151
|
+
"task_id": {"type": "string", "description": "Todo id to get output for"},
|
|
152
|
+
},
|
|
153
|
+
"required": ["task_id"],
|
|
154
|
+
},
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
def run(self, tool_input: dict[str, Any]) -> ToolResult:
|
|
158
|
+
todo_id = tool_input.get("task_id", "")
|
|
159
|
+
result = self._tm.get_todo_output(todo_id)
|
|
160
|
+
return ToolResult(name="TodoOutput", output=result)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class TodoStopTool:
|
|
165
|
+
def __init__(self, todo_manager):
|
|
166
|
+
self._tm = todo_manager
|
|
167
|
+
|
|
168
|
+
def spec(self) -> ToolSpec:
|
|
169
|
+
return ToolSpec(
|
|
170
|
+
name="TodoStop",
|
|
171
|
+
description="Stop/cancel a running todo.",
|
|
172
|
+
input_schema={
|
|
173
|
+
"type": "object",
|
|
174
|
+
"properties": {
|
|
175
|
+
"task_id": {"type": "string", "description": "Todo id to stop"},
|
|
176
|
+
},
|
|
177
|
+
"required": ["task_id"],
|
|
178
|
+
},
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
def run(self, tool_input: dict[str, Any]) -> ToolResult:
|
|
182
|
+
todo_id = tool_input.get("task_id", "")
|
|
183
|
+
result = self._tm.update_todo(todo_id, status="completed")
|
|
184
|
+
if result is None:
|
|
185
|
+
return ToolResult(name="TodoStop", output={"success": False, "stopped": False, "error": "Todo not found"}, is_error=True)
|
|
186
|
+
if result.get("deleted"):
|
|
187
|
+
return ToolResult(name="TodoStop", output={"success": True, "stopped": True, "task_id": todo_id})
|
|
188
|
+
return ToolResult(name="TodoStop", output={"success": True, "stopped": True, "task_id": todo_id})
|
package/onecode/cli.py
CHANGED
|
@@ -6,7 +6,7 @@ from typing import Optional
|
|
|
6
6
|
|
|
7
7
|
from onecode.config import ensure_dirs, load_config, save_config
|
|
8
8
|
|
|
9
|
-
LOG_DIR = Path.home() / ".
|
|
9
|
+
LOG_DIR = Path.home() / ".cdh" / "logs"
|
|
10
10
|
LOG_FILE = LOG_DIR / "cdh.log"
|
|
11
11
|
LOG_BACKUP_COUNT = 7 # keep 7 days of history
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ _VALID_LOG_LEVELS = {"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"}
|
|
|
16
16
|
def setup_logging(log_level: str = "INFO") -> logging.Logger:
|
|
17
17
|
"""Configure root logging to write to a daily-rotated ``cdh.log`` file.
|
|
18
18
|
|
|
19
|
-
The active log is always ``~/.
|
|
19
|
+
The active log is always ``~/.cdh/logs/cdh.log``; at midnight it is
|
|
20
20
|
rolled to ``cdh.log.YYYY-MM-DD`` and a fresh file is started. Up to
|
|
21
21
|
:data:`LOG_BACKUP_COUNT` days of history are retained.
|
|
22
22
|
|
|
@@ -67,7 +67,7 @@ def setup_logging(log_level: str = "INFO") -> logging.Logger:
|
|
|
67
67
|
default="INFO",
|
|
68
68
|
show_default=True,
|
|
69
69
|
envvar="CDH_LOG_LEVEL",
|
|
70
|
-
help="Root logger verbosity. Defaults to INFO; daily-rotated to ~/.
|
|
70
|
+
help="Root logger verbosity. Defaults to INFO; daily-rotated to ~/.cdh/logs/cdh.log.",
|
|
71
71
|
)
|
|
72
72
|
def cli(log_level: str):
|
|
73
73
|
"""CDH Agent CLI - Cloud Dev Harness Agent commands."""
|