@scemoon/cdh 1.0.6 → 1.0.7

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 (550) hide show
  1. package/package.json +2 -2
  2. package/ai-dlc-skill/SKILL.md +0 -77
  3. package/ai-dlc-skill/agents/deliver-agent.md +0 -24
  4. package/ai-dlc-skill/agents/master.md +0 -50
  5. package/ai-dlc-skill/agents/plan-agent.md +0 -23
  6. package/ai-dlc-skill/agents/understand-agent.md +0 -23
  7. package/ai-dlc-skill/agents/verify-agent.md +0 -27
  8. package/ai-dlc-skill/architecture/project-structure.md +0 -78
  9. package/ai-dlc-skill/brownfield/README.md +0 -30
  10. package/ai-dlc-skill/brownfield/generate-context.sh +0 -64
  11. package/ai-dlc-skill/brownfield/scripts/deps.sh +0 -27
  12. package/ai-dlc-skill/brownfield/scripts/discover.sh +0 -34
  13. package/ai-dlc-skill/brownfield/scripts/extract-api.sh +0 -45
  14. package/ai-dlc-skill/components/backend.md +0 -34
  15. package/ai-dlc-skill/components/desktop.md +0 -30
  16. package/ai-dlc-skill/components/mya.md +0 -29
  17. package/ai-dlc-skill/components/native.md +0 -30
  18. package/ai-dlc-skill/components/tta.md +0 -29
  19. package/ai-dlc-skill/components/web.md +0 -31
  20. package/ai-dlc-skill/components/wxa.md +0 -29
  21. package/ai-dlc-skill/contracts/README.md +0 -25
  22. package/ai-dlc-skill/core/adaptive-flow.md +0 -36
  23. package/ai-dlc-skill/core/security.md +0 -29
  24. package/ai-dlc-skill/cross-tool/cline/export.sh +0 -31
  25. package/ai-dlc-skill/cross-tool/copilot/export.sh +0 -47
  26. package/ai-dlc-skill/cross-tool/cursor/export.sh +0 -32
  27. package/ai-dlc-skill/cross-tool/export.sh +0 -22
  28. package/ai-dlc-skill/cross-tool/onecode/config.yaml.tpl +0 -17
  29. package/ai-dlc-skill/cross-tool/onecode/export-skills.sh +0 -35
  30. package/ai-dlc-skill/cross-tool/onecode/export.sh +0 -54
  31. package/ai-dlc-skill/phases/deliver/entry.md +0 -26
  32. package/ai-dlc-skill/phases/deliver/lifecycle.md +0 -185
  33. package/ai-dlc-skill/phases/deliver/prompt.md +0 -40
  34. package/ai-dlc-skill/phases/deliver/rules.md +0 -61
  35. package/ai-dlc-skill/phases/plan/entry.md +0 -25
  36. package/ai-dlc-skill/phases/plan/lifecycle.md +0 -204
  37. package/ai-dlc-skill/phases/plan/prompt.md +0 -38
  38. package/ai-dlc-skill/phases/plan/rules.md +0 -25
  39. package/ai-dlc-skill/phases/understand/entry.md +0 -26
  40. package/ai-dlc-skill/phases/understand/lifecycle.md +0 -184
  41. package/ai-dlc-skill/phases/understand/prompt.md +0 -41
  42. package/ai-dlc-skill/phases/understand/rules.md +0 -37
  43. package/ai-dlc-skill/phases/verify/entry.md +0 -26
  44. package/ai-dlc-skill/phases/verify/lifecycle.md +0 -192
  45. package/ai-dlc-skill/phases/verify/prompt.md +0 -43
  46. package/ai-dlc-skill/phases/verify/rules.md +0 -73
  47. package/ai-dlc-skill/practices/bdd.md +0 -91
  48. package/ai-dlc-skill/practices/sdd.md +0 -84
  49. package/ai-dlc-skill/practices/tdd.md +0 -95
  50. package/ai-dlc-skill/providers/README.md +0 -114
  51. package/ai-dlc-skill/providers/aliyun/deployment.yaml +0 -66
  52. package/ai-dlc-skill/providers/aliyun/preview.yaml +0 -84
  53. package/ai-dlc-skill/providers/aliyun/provider.yaml +0 -160
  54. package/ai-dlc-skill/providers/tcb/deployment.yaml +0 -69
  55. package/ai-dlc-skill/providers/tcb/preview.yaml +0 -83
  56. package/ai-dlc-skill/providers/tcb/provider.yaml +0 -172
  57. package/ai-dlc-skill/requirements.md +0 -140
  58. package/ai-dlc-skill/skill.yaml +0 -147
  59. package/ai-dlc-skill/templates/integration/CHANGELOG.md +0 -41
  60. package/ai-dlc-skill/templates/integration/asyncapi.yaml +0 -43
  61. package/ai-dlc-skill/templates/integration/contract-diff.md +0 -63
  62. package/ai-dlc-skill/templates/integration/contract-spec.md +0 -49
  63. package/ai-dlc-skill/templates/integration/openapi.yaml +0 -18
  64. package/ai-dlc-skill/templates/integration/runtime-contract.yaml +0 -36
  65. package/ai-dlc-skill/templates/plan/design.md +0 -49
  66. package/ai-dlc-skill/templates/plan/task-list.md +0 -32
  67. package/ai-dlc-skill/templates/project/README.md +0 -126
  68. package/ai-dlc-skill/templates/project/template.md +0 -119
  69. package/ai-dlc-skill/templates/understand/feature.feature +0 -23
  70. package/ai-dlc-skill/templates/understand/intent.md +0 -29
  71. package/ai-dlc-skill/templates/understand/spec-delta.md +0 -47
  72. package/ai-dlc-skill/templates/verify/test-unit.py +0 -27
  73. package/ai-dlc-skill/walkthrough/collect.sh +0 -50
  74. package/ai-dlc-skill/walkthrough/template.md +0 -54
  75. package/ai-dlc-skill/workflows/ai-dlc.yaml +0 -110
  76. package/ai-dlc-skill/workflows/deployment.yaml +0 -199
  77. package/cdh/__init__.py +0 -0
  78. package/cdh/__main__.py +0 -4
  79. package/cdh/__pycache__/__init__.cpython-314.pyc +0 -0
  80. package/cdh/__pycache__/cdh_mcp_injector.cpython-314.pyc +0 -0
  81. package/cdh/__pycache__/cdh_mcp_loader.cpython-314.pyc +0 -0
  82. package/cdh/__pycache__/cdh_mcp_manager.cpython-314.pyc +0 -0
  83. package/cdh/__pycache__/cdh_session_aggregator.cpython-314.pyc +0 -0
  84. package/cdh/__pycache__/cdh_skill_loader.cpython-314.pyc +0 -0
  85. package/cdh/__pycache__/cdh_skill_manager.cpython-314.pyc +0 -0
  86. package/cdh/__pycache__/cli.cpython-313.pyc +0 -0
  87. package/cdh/__pycache__/cli.cpython-314.pyc +0 -0
  88. package/cdh/__pycache__/scaffold.cpython-314.pyc +0 -0
  89. package/cdh/cdh_mcp_injector.py +0 -115
  90. package/cdh/cdh_mcp_loader.py +0 -67
  91. package/cdh/cdh_mcp_manager.py +0 -73
  92. package/cdh/cdh_session_aggregator.py +0 -258
  93. package/cdh/cdh_skill_manager.py +0 -105
  94. package/cdh/cli.py +0 -807
  95. package/cdh/scaffold.py +0 -728
  96. package/onecode/__init__.py +0 -1
  97. package/onecode/__main__.py +0 -4
  98. package/onecode/__pycache__/__init__.cpython-314.pyc +0 -0
  99. package/onecode/__pycache__/cli.cpython-314.pyc +0 -0
  100. package/onecode/__pycache__/commands.cpython-314.pyc +0 -0
  101. package/onecode/__pycache__/config.cpython-314.pyc +0 -0
  102. package/onecode/__pycache__/config_screen.cpython-314.pyc +0 -0
  103. package/onecode/__pycache__/migrate.cpython-314.pyc +0 -0
  104. package/onecode/agent/__init__.py +0 -0
  105. package/onecode/agent/__pycache__/__init__.cpython-314.pyc +0 -0
  106. package/onecode/agent/__pycache__/cdh_loader.cpython-314.pyc +0 -0
  107. package/onecode/agent/__pycache__/context.cpython-314.pyc +0 -0
  108. package/onecode/agent/__pycache__/engine.cpython-314.pyc +0 -0
  109. package/onecode/agent/__pycache__/hooks.cpython-314.pyc +0 -0
  110. package/onecode/agent/__pycache__/onecode_agent_acp.cpython-314.pyc +0 -0
  111. package/onecode/agent/__pycache__/permissions.cpython-314.pyc +0 -0
  112. package/onecode/agent/__pycache__/permissions_store.cpython-314.pyc +0 -0
  113. package/onecode/agent/__pycache__/project_doc.cpython-314.pyc +0 -0
  114. package/onecode/agent/__pycache__/session.cpython-314.pyc +0 -0
  115. package/onecode/agent/agents/__init__.py +0 -29
  116. package/onecode/agent/agents/__pycache__/__init__.cpython-314.pyc +0 -0
  117. package/onecode/agent/agents/__pycache__/types.cpython-314.pyc +0 -0
  118. package/onecode/agent/agents/types.py +0 -589
  119. package/onecode/agent/attachments.py +0 -112
  120. package/onecode/agent/cdh_loader.py +0 -267
  121. package/onecode/agent/context.py +0 -343
  122. package/onecode/agent/engine.py +0 -2700
  123. package/onecode/agent/hooks.py +0 -86
  124. package/onecode/agent/onecode_agent_acp.py +0 -2743
  125. package/onecode/agent/onecode_agent_acp.py.bak +0 -2447
  126. package/onecode/agent/permissions.py +0 -150
  127. package/onecode/agent/permissions_store.py +0 -62
  128. package/onecode/agent/project_doc.py +0 -19
  129. package/onecode/agent/session.py +0 -195
  130. package/onecode/agent/snapshot.py +0 -144
  131. package/onecode/agent/tools/__init__.py +0 -17
  132. package/onecode/agent/tools/__pycache__/__init__.cpython-314.pyc +0 -0
  133. package/onecode/agent/tools/__pycache__/agent_tools.cpython-314.pyc +0 -0
  134. package/onecode/agent/tools/__pycache__/apply_patch_tool.cpython-314.pyc +0 -0
  135. package/onecode/agent/tools/__pycache__/bash_tool.cpython-314.pyc +0 -0
  136. package/onecode/agent/tools/__pycache__/communication_tools.cpython-314.pyc +0 -0
  137. package/onecode/agent/tools/__pycache__/config_tool.cpython-314.pyc +0 -0
  138. package/onecode/agent/tools/__pycache__/cron_tools.cpython-314.pyc +0 -0
  139. package/onecode/agent/tools/__pycache__/errors.cpython-314.pyc +0 -0
  140. package/onecode/agent/tools/__pycache__/file_ops.cpython-314.pyc +0 -0
  141. package/onecode/agent/tools/__pycache__/file_tools.cpython-314.pyc +0 -0
  142. package/onecode/agent/tools/__pycache__/git_tools.cpython-314.pyc +0 -0
  143. package/onecode/agent/tools/__pycache__/lsp_tools.cpython-314.pyc +0 -0
  144. package/onecode/agent/tools/__pycache__/mcp_tools.cpython-314.pyc +0 -0
  145. package/onecode/agent/tools/__pycache__/permission_handler.cpython-314.pyc +0 -0
  146. package/onecode/agent/tools/__pycache__/permissions.cpython-314.pyc +0 -0
  147. package/onecode/agent/tools/__pycache__/protocol.cpython-314.pyc +0 -0
  148. package/onecode/agent/tools/__pycache__/registry.cpython-314.pyc +0 -0
  149. package/onecode/agent/tools/__pycache__/sandbox.cpython-314.pyc +0 -0
  150. package/onecode/agent/tools/__pycache__/schema_validation.cpython-314.pyc +0 -0
  151. package/onecode/agent/tools/__pycache__/skill_tools.cpython-314.pyc +0 -0
  152. package/onecode/agent/tools/__pycache__/todo_tools.cpython-314.pyc +0 -0
  153. package/onecode/agent/tools/__pycache__/web_tools.cpython-314.pyc +0 -0
  154. package/onecode/agent/tools/agent_tools.py +0 -132
  155. package/onecode/agent/tools/apply_patch_tool.py +0 -138
  156. package/onecode/agent/tools/bash_tool.py +0 -111
  157. package/onecode/agent/tools/communication_tools.py +0 -148
  158. package/onecode/agent/tools/config_tool.py +0 -130
  159. package/onecode/agent/tools/cron_tools.py +0 -178
  160. package/onecode/agent/tools/errors.py +0 -17
  161. package/onecode/agent/tools/file_ops.py +0 -221
  162. package/onecode/agent/tools/file_tools.py +0 -225
  163. package/onecode/agent/tools/git_tools.py +0 -88
  164. package/onecode/agent/tools/lsp_tools.py +0 -404
  165. package/onecode/agent/tools/mcp_tools.py +0 -127
  166. package/onecode/agent/tools/permission_handler.py +0 -46
  167. package/onecode/agent/tools/permissions.py +0 -77
  168. package/onecode/agent/tools/protocol.py +0 -20
  169. package/onecode/agent/tools/registry.py +0 -201
  170. package/onecode/agent/tools/sandbox.py +0 -358
  171. package/onecode/agent/tools/schema_validation.py +0 -100
  172. package/onecode/agent/tools/skill_tools.py +0 -52
  173. package/onecode/agent/tools/todo_tools.py +0 -207
  174. package/onecode/agent/tools/web_tools.py +0 -169
  175. package/onecode/builtin_skills/agent-browser/SKILL.md +0 -212
  176. package/onecode/builtin_skills/agent-browser/skill.yaml +0 -8
  177. package/onecode/builtin_skills/git/SKILL.md +0 -64
  178. package/onecode/builtin_skills/git/skill.yaml +0 -7
  179. package/onecode/builtin_skills/shell/SKILL.md +0 -58
  180. package/onecode/builtin_skills/shell/skill.yaml +0 -8
  181. package/onecode/builtin_skills/skill-creator/SKILL.md +0 -106
  182. package/onecode/builtin_skills/skill-creator/skill.yaml +0 -8
  183. package/onecode/cli.py +0 -935
  184. package/onecode/cloud/__init__.py +0 -0
  185. package/onecode/cloud/base.py +0 -20
  186. package/onecode/codebase/__init__.py +0 -69
  187. package/onecode/codebase/__pycache__/__init__.cpython-314.pyc +0 -0
  188. package/onecode/codebase/__pycache__/chunker.cpython-314.pyc +0 -0
  189. package/onecode/codebase/__pycache__/indexer.cpython-314.pyc +0 -0
  190. package/onecode/codebase/__pycache__/retriever.cpython-314.pyc +0 -0
  191. package/onecode/codebase/__pycache__/storage.cpython-314.pyc +0 -0
  192. package/onecode/codebase/__pycache__/tools.cpython-314.pyc +0 -0
  193. package/onecode/codebase/chunker.py +0 -125
  194. package/onecode/codebase/indexer.py +0 -149
  195. package/onecode/codebase/retriever.py +0 -203
  196. package/onecode/codebase/storage.py +0 -131
  197. package/onecode/codebase/tools.py +0 -59
  198. package/onecode/commands.py +0 -596
  199. package/onecode/config.py +0 -314
  200. package/onecode/config_screen.py +0 -600
  201. package/onecode/cron/__init__.py +0 -3
  202. package/onecode/lsp/__init__.py +0 -3
  203. package/onecode/mcp/__init__.py +0 -4
  204. package/onecode/mcp/__pycache__/__init__.cpython-314.pyc +0 -0
  205. package/onecode/mcp/__pycache__/client.cpython-314.pyc +0 -0
  206. package/onecode/mcp/__pycache__/manager.cpython-314.pyc +0 -0
  207. package/onecode/mcp/client.py +0 -193
  208. package/onecode/mcp/manager.py +0 -190
  209. package/onecode/memory/__init__.py +0 -49
  210. package/onecode/memory/__pycache__/__init__.cpython-314.pyc +0 -0
  211. package/onecode/memory/__pycache__/backend.cpython-314.pyc +0 -0
  212. package/onecode/memory/__pycache__/offload.cpython-314.pyc +0 -0
  213. package/onecode/memory/__pycache__/pyramid.cpython-314.pyc +0 -0
  214. package/onecode/memory/__pycache__/recall.cpython-314.pyc +0 -0
  215. package/onecode/memory/__pycache__/symbolic.cpython-314.pyc +0 -0
  216. package/onecode/memory/backend.py +0 -159
  217. package/onecode/memory/pyramid.py +0 -133
  218. package/onecode/memory/recall.py +0 -203
  219. package/onecode/migrate.py +0 -122
  220. package/onecode/models/__init__.py +0 -4
  221. package/onecode/models/__pycache__/__init__.cpython-314.pyc +0 -0
  222. package/onecode/models/__pycache__/errors.cpython-314.pyc +0 -0
  223. package/onecode/models/__pycache__/messages.cpython-314.pyc +0 -0
  224. package/onecode/models/__pycache__/provider.cpython-314.pyc +0 -0
  225. package/onecode/models/__pycache__/registry.cpython-314.pyc +0 -0
  226. package/onecode/models/errors.py +0 -104
  227. package/onecode/models/messages.py +0 -739
  228. package/onecode/models/provider.py +0 -699
  229. package/onecode/models/providers/__init__.py +0 -17
  230. package/onecode/models/providers/__pycache__/__init__.cpython-314.pyc +0 -0
  231. package/onecode/models/providers/__pycache__/anthropic_provider.cpython-314.pyc +0 -0
  232. package/onecode/models/providers/__pycache__/deepseek_provider.cpython-314.pyc +0 -0
  233. package/onecode/models/providers/__pycache__/glm_provider.cpython-314.pyc +0 -0
  234. package/onecode/models/providers/__pycache__/minimax_provider.cpython-314.pyc +0 -0
  235. package/onecode/models/providers/__pycache__/minimaxi_provider.cpython-314.pyc +0 -0
  236. package/onecode/models/providers/__pycache__/ollama_provider.cpython-314.pyc +0 -0
  237. package/onecode/models/providers/__pycache__/openai_provider.cpython-314.pyc +0 -0
  238. package/onecode/models/providers/anthropic_provider.py +0 -273
  239. package/onecode/models/providers/deepseek_provider.py +0 -212
  240. package/onecode/models/providers/glm_provider.py +0 -195
  241. package/onecode/models/providers/minimax_provider.py +0 -158
  242. package/onecode/models/providers/minimaxi_provider.py +0 -417
  243. package/onecode/models/providers/ollama_provider.py +0 -100
  244. package/onecode/models/providers/openai_provider.py +0 -237
  245. package/onecode/models/registry.py +0 -212
  246. package/onecode/server/__init__.py +0 -3
  247. package/onecode/server/app.py +0 -224
  248. package/onecode/skills/__init__.py +0 -11
  249. package/onecode/skills/__pycache__/__init__.cpython-314.pyc +0 -0
  250. package/onecode/skills/__pycache__/argument_substitution.cpython-314.pyc +0 -0
  251. package/onecode/skills/__pycache__/bootstrap.cpython-314.pyc +0 -0
  252. package/onecode/skills/__pycache__/create.cpython-314.pyc +0 -0
  253. package/onecode/skills/__pycache__/frontmatter.cpython-314.pyc +0 -0
  254. package/onecode/skills/__pycache__/loader.cpython-314.pyc +0 -0
  255. package/onecode/skills/__pycache__/manager.cpython-314.pyc +0 -0
  256. package/onecode/skills/__pycache__/model.cpython-314.pyc +0 -0
  257. package/onecode/skills/argument_substitution.py +0 -38
  258. package/onecode/skills/bootstrap.py +0 -124
  259. package/onecode/skills/create.py +0 -56
  260. package/onecode/skills/frontmatter.py +0 -33
  261. package/onecode/skills/loader.py +0 -139
  262. package/onecode/skills/manager.py +0 -75
  263. package/onecode/skills/model.py +0 -43
  264. package/onecode/storage/__init__.py +0 -0
  265. package/onecode/storage/activity.py +0 -63
  266. package/onecode/storage/project.py +0 -54
  267. package/onecode/storage/session.py +0 -112
  268. package/onecode/tasks/__init__.py +0 -26
  269. package/onecode/tasks/manager.py +0 -232
  270. package/onecode/tasks/models.py +0 -240
  271. package/onecode/trace/__init__.py +0 -0
  272. package/onecode/trace/tracer.py +0 -173
  273. package/onecode/utils/__init__.py +0 -0
  274. package/onecode/utils/helpers.py +0 -20
  275. package/pyproject.toml +0 -74
  276. package/tui/__init__.py +0 -46
  277. package/tui/__main__.py +0 -4
  278. package/tui/__pycache__/__init__.cpython-314.pyc +0 -0
  279. package/tui/__pycache__/_loop.cpython-314.pyc +0 -0
  280. package/tui/__pycache__/_path_fuzzy_search.cpython-314.pyc +0 -0
  281. package/tui/__pycache__/_path_match.cpython-314.pyc +0 -0
  282. package/tui/__pycache__/about.cpython-314.pyc +0 -0
  283. package/tui/__pycache__/agent.cpython-314.pyc +0 -0
  284. package/tui/__pycache__/agent_schema.cpython-314.pyc +0 -0
  285. package/tui/__pycache__/agents.cpython-314.pyc +0 -0
  286. package/tui/__pycache__/answer.cpython-314.pyc +0 -0
  287. package/tui/__pycache__/app.cpython-313.pyc +0 -0
  288. package/tui/__pycache__/app.cpython-314.pyc +0 -0
  289. package/tui/__pycache__/atomic.cpython-314.pyc +0 -0
  290. package/tui/__pycache__/complete.cpython-314.pyc +0 -0
  291. package/tui/__pycache__/constants.cpython-314.pyc +0 -0
  292. package/tui/__pycache__/conversation_markdown.cpython-314.pyc +0 -0
  293. package/tui/__pycache__/danger.cpython-314.pyc +0 -0
  294. package/tui/__pycache__/db.cpython-314.pyc +0 -0
  295. package/tui/__pycache__/dec.cpython-314.pyc +0 -0
  296. package/tui/__pycache__/directory.cpython-314.pyc +0 -0
  297. package/tui/__pycache__/directory_suggester.cpython-314.pyc +0 -0
  298. package/tui/__pycache__/directory_watcher.cpython-314.pyc +0 -0
  299. package/tui/__pycache__/format_path.cpython-314.pyc +0 -0
  300. package/tui/__pycache__/fuzzy.cpython-314.pyc +0 -0
  301. package/tui/__pycache__/fuzzy_index.cpython-314.pyc +0 -0
  302. package/tui/__pycache__/history.cpython-314.pyc +0 -0
  303. package/tui/__pycache__/jsonrpc.cpython-314.pyc +0 -0
  304. package/tui/__pycache__/menus.cpython-314.pyc +0 -0
  305. package/tui/__pycache__/message_log.cpython-314.pyc +0 -0
  306. package/tui/__pycache__/messages.cpython-314.pyc +0 -0
  307. package/tui/__pycache__/path_complete.cpython-314.pyc +0 -0
  308. package/tui/__pycache__/path_filter.cpython-314.pyc +0 -0
  309. package/tui/__pycache__/paths.cpython-314.pyc +0 -0
  310. package/tui/__pycache__/pill.cpython-314.pyc +0 -0
  311. package/tui/__pycache__/platform_commands.cpython-314.pyc +0 -0
  312. package/tui/__pycache__/protocol.cpython-314.pyc +0 -0
  313. package/tui/__pycache__/session_tracker.cpython-314.pyc +0 -0
  314. package/tui/__pycache__/settings.cpython-314.pyc +0 -0
  315. package/tui/__pycache__/settings_schema.cpython-314.pyc +0 -0
  316. package/tui/__pycache__/shell.cpython-314.pyc +0 -0
  317. package/tui/__pycache__/shell_read.cpython-314.pyc +0 -0
  318. package/tui/__pycache__/slash_command.cpython-314.pyc +0 -0
  319. package/tui/__pycache__/version.cpython-314.pyc +0 -0
  320. package/tui/_loop.py +0 -86
  321. package/tui/_path_fuzzy_search.py +0 -48
  322. package/tui/_path_match.py +0 -141
  323. package/tui/about.py +0 -95
  324. package/tui/acp/__pycache__/agent.cpython-314.pyc +0 -0
  325. package/tui/acp/__pycache__/api.cpython-314.pyc +0 -0
  326. package/tui/acp/__pycache__/encode_tool_call_id.cpython-314.pyc +0 -0
  327. package/tui/acp/__pycache__/messages.cpython-314.pyc +0 -0
  328. package/tui/acp/__pycache__/prompt.cpython-314.pyc +0 -0
  329. package/tui/acp/__pycache__/protocol.cpython-314.pyc +0 -0
  330. package/tui/acp/agent.py +0 -1002
  331. package/tui/acp/api.py +0 -73
  332. package/tui/acp/encode_tool_call_id.py +0 -12
  333. package/tui/acp/messages.py +0 -203
  334. package/tui/acp/prompt.py +0 -53
  335. package/tui/acp/protocol.py +0 -499
  336. package/tui/agent.py +0 -70
  337. package/tui/agent_schema.py +0 -76
  338. package/tui/agents.py +0 -46
  339. package/tui/ansi/__init__.py +0 -1
  340. package/tui/ansi/__pycache__/__init__.cpython-314.pyc +0 -0
  341. package/tui/ansi/__pycache__/_ansi.cpython-314.pyc +0 -0
  342. package/tui/ansi/__pycache__/_ansi_colors.cpython-314.pyc +0 -0
  343. package/tui/ansi/__pycache__/_control_codes.cpython-314.pyc +0 -0
  344. package/tui/ansi/__pycache__/_keys.cpython-314.pyc +0 -0
  345. package/tui/ansi/__pycache__/_sgr_styles.cpython-314.pyc +0 -0
  346. package/tui/ansi/__pycache__/_stream_parser.cpython-314.pyc +0 -0
  347. package/tui/ansi/_ansi.py +0 -1689
  348. package/tui/ansi/_ansi_colors.py +0 -264
  349. package/tui/ansi/_control_codes.py +0 -37
  350. package/tui/ansi/_keys.py +0 -251
  351. package/tui/ansi/_sgr_styles.py +0 -64
  352. package/tui/ansi/_stream_parser.py +0 -418
  353. package/tui/answer.py +0 -12
  354. package/tui/app.py +0 -1266
  355. package/tui/atomic.py +0 -37
  356. package/tui/cli.py +0 -313
  357. package/tui/code_analyze.py +0 -27
  358. package/tui/complete.py +0 -38
  359. package/tui/constants.py +0 -61
  360. package/tui/conversation_markdown.py +0 -30
  361. package/tui/danger.py +0 -372
  362. package/tui/data/agents/ampcode.com.toml +0 -52
  363. package/tui/data/agents/augmentcode.com.toml +0 -41
  364. package/tui/data/agents/cdh.cloud-dev-harness.toml +0 -23
  365. package/tui/data/agents/claude.com.toml +0 -41
  366. package/tui/data/agents/copilot.github.com.toml +0 -29
  367. package/tui/data/agents/crowai.dev.toml +0 -36
  368. package/tui/data/agents/cursor.com.toml +0 -38
  369. package/tui/data/agents/deepagents.langchain.com +0 -34
  370. package/tui/data/agents/docker.com.toml +0 -60
  371. package/tui/data/agents/geminicli.com.toml +0 -28
  372. package/tui/data/agents/goose.ai.toml +0 -52
  373. package/tui/data/agents/inference.huggingface.co.toml +0 -41
  374. package/tui/data/agents/kimi.com.toml +0 -35
  375. package/tui/data/agents/kiro.dev.toml +0 -43
  376. package/tui/data/agents/onecode.dev.toml +0 -22
  377. package/tui/data/agents/openai.com.toml +0 -53
  378. package/tui/data/agents/openclaw.ai.toml +0 -37
  379. package/tui/data/agents/opencode.ai.toml +0 -39
  380. package/tui/data/agents/openhands.dev.toml +0 -46
  381. package/tui/data/agents/stakpak.dev.toml +0 -62
  382. package/tui/data/agents/vibe.mistral.ai.toml +0 -31
  383. package/tui/data/agents/vtcode.dev.toml +0 -63
  384. package/tui/data/images/frog.png +0 -0
  385. package/tui/data/sounds/question.wav +0 -0
  386. package/tui/data/sounds/turn-over.wav +0 -0
  387. package/tui/db.py +0 -213
  388. package/tui/dec.py +0 -332
  389. package/tui/directory.py +0 -234
  390. package/tui/directory_suggester.py +0 -93
  391. package/tui/directory_watcher.py +0 -231
  392. package/tui/format_path.py +0 -25
  393. package/tui/fuzzy.py +0 -140
  394. package/tui/fuzzy_index.py +0 -275
  395. package/tui/gist.py +0 -33
  396. package/tui/history.py +0 -138
  397. package/tui/jsonrpc.py +0 -578
  398. package/tui/menus.py +0 -14
  399. package/tui/message_log.py +0 -69
  400. package/tui/messages.py +0 -144
  401. package/tui/option_content.py +0 -51
  402. package/tui/os.py +0 -0
  403. package/tui/path_complete.py +0 -217
  404. package/tui/path_filter.py +0 -124
  405. package/tui/paths.py +0 -87
  406. package/tui/pill.py +0 -23
  407. package/tui/platform_commands.py +0 -52
  408. package/tui/prompt/__pycache__/extract.cpython-314.pyc +0 -0
  409. package/tui/prompt/__pycache__/resource.cpython-314.pyc +0 -0
  410. package/tui/prompt/extract.py +0 -19
  411. package/tui/prompt/resource.py +0 -68
  412. package/tui/protocol.py +0 -28
  413. package/tui/screens/__init__.py +0 -0
  414. package/tui/screens/__pycache__/__init__.cpython-314.pyc +0 -0
  415. package/tui/screens/__pycache__/agent_modal.cpython-314.pyc +0 -0
  416. package/tui/screens/__pycache__/component_picker.cpython-314.pyc +0 -0
  417. package/tui/screens/__pycache__/diff_screen.cpython-314.pyc +0 -0
  418. package/tui/screens/__pycache__/log.cpython-314.pyc +0 -0
  419. package/tui/screens/__pycache__/main.cpython-313.pyc +0 -0
  420. package/tui/screens/__pycache__/main.cpython-314.pyc +0 -0
  421. package/tui/screens/__pycache__/permissions.cpython-314.pyc +0 -0
  422. package/tui/screens/__pycache__/projects_app.cpython-314.pyc +0 -0
  423. package/tui/screens/__pycache__/projects_screen.cpython-314.pyc +0 -0
  424. package/tui/screens/__pycache__/sessions.cpython-314.pyc +0 -0
  425. package/tui/screens/__pycache__/store.cpython-314.pyc +0 -0
  426. package/tui/screens/__pycache__/tool_content_screen.cpython-314.pyc +0 -0
  427. package/tui/screens/action_modal.py +0 -94
  428. package/tui/screens/agent_modal.py +0 -175
  429. package/tui/screens/command_edit_modal.py +0 -74
  430. package/tui/screens/component_picker.py +0 -168
  431. package/tui/screens/diff_screen.py +0 -84
  432. package/tui/screens/log.py +0 -553
  433. package/tui/screens/main.py +0 -385
  434. package/tui/screens/main.tcss +0 -655
  435. package/tui/screens/permissions.py +0 -404
  436. package/tui/screens/permissions.tcss +0 -72
  437. package/tui/screens/projects.tcss +0 -80
  438. package/tui/screens/projects_app.py +0 -347
  439. package/tui/screens/projects_screen.py +0 -284
  440. package/tui/screens/session_resume_modal.py +0 -172
  441. package/tui/screens/session_resume_modal.tcss +0 -35
  442. package/tui/screens/sessions.py +0 -164
  443. package/tui/screens/sessions.tcss +0 -119
  444. package/tui/screens/settings.py +0 -254
  445. package/tui/screens/settings.tcss +0 -101
  446. package/tui/screens/store.py +0 -500
  447. package/tui/screens/store.tcss +0 -274
  448. package/tui/screens/tool_content_screen.py +0 -59
  449. package/tui/session_tracker.py +0 -123
  450. package/tui/settings.py +0 -353
  451. package/tui/settings_schema.py +0 -431
  452. package/tui/shell.py +0 -304
  453. package/tui/shell_read.py +0 -42
  454. package/tui/slash_command.py +0 -34
  455. package/tui/tui.tcss +0 -246
  456. package/tui/twitter.py +0 -38
  457. package/tui/version.py +0 -80
  458. package/tui/visuals/__init__.py +0 -0
  459. package/tui/visuals/__pycache__/__init__.cpython-314.pyc +0 -0
  460. package/tui/visuals/__pycache__/columns.cpython-314.pyc +0 -0
  461. package/tui/visuals/columns.py +0 -272
  462. package/tui/widgets/__init__.py +0 -0
  463. package/tui/widgets/__pycache__/__init__.cpython-314.pyc +0 -0
  464. package/tui/widgets/__pycache__/acp_content.cpython-314.pyc +0 -0
  465. package/tui/widgets/__pycache__/agent_response.cpython-314.pyc +0 -0
  466. package/tui/widgets/__pycache__/agent_thought.cpython-314.pyc +0 -0
  467. package/tui/widgets/__pycache__/ask_user.cpython-314.pyc +0 -0
  468. package/tui/widgets/__pycache__/condensed_path.cpython-314.pyc +0 -0
  469. package/tui/widgets/__pycache__/context_stats.cpython-314.pyc +0 -0
  470. package/tui/widgets/__pycache__/conversation.cpython-314.pyc +0 -0
  471. package/tui/widgets/__pycache__/diff_view.cpython-314.pyc +0 -0
  472. package/tui/widgets/__pycache__/directory_input.cpython-314.pyc +0 -0
  473. package/tui/widgets/__pycache__/flash.cpython-314.pyc +0 -0
  474. package/tui/widgets/__pycache__/future_text.cpython-314.pyc +0 -0
  475. package/tui/widgets/__pycache__/grid_select.cpython-314.pyc +0 -0
  476. package/tui/widgets/__pycache__/highlighted_textarea.cpython-314.pyc +0 -0
  477. package/tui/widgets/__pycache__/load_more.cpython-314.pyc +0 -0
  478. package/tui/widgets/__pycache__/mandelbrot.cpython-314.pyc +0 -0
  479. package/tui/widgets/__pycache__/markdown_note.cpython-314.pyc +0 -0
  480. package/tui/widgets/__pycache__/menu.cpython-314.pyc +0 -0
  481. package/tui/widgets/__pycache__/modified_files.cpython-314.pyc +0 -0
  482. package/tui/widgets/__pycache__/non_selectable_label.cpython-314.pyc +0 -0
  483. package/tui/widgets/__pycache__/note.cpython-314.pyc +0 -0
  484. package/tui/widgets/__pycache__/path_search.cpython-314.pyc +0 -0
  485. package/tui/widgets/__pycache__/plan.cpython-314.pyc +0 -0
  486. package/tui/widgets/__pycache__/project_directory_tree.cpython-314.pyc +0 -0
  487. package/tui/widgets/__pycache__/project_grid_select.cpython-314.pyc +0 -0
  488. package/tui/widgets/__pycache__/project_summary.cpython-314.pyc +0 -0
  489. package/tui/widgets/__pycache__/prompt.cpython-314.pyc +0 -0
  490. package/tui/widgets/__pycache__/question.cpython-314.pyc +0 -0
  491. package/tui/widgets/__pycache__/session_grid_select.cpython-314.pyc +0 -0
  492. package/tui/widgets/__pycache__/session_summary.cpython-314.pyc +0 -0
  493. package/tui/widgets/__pycache__/session_tabs.cpython-314.pyc +0 -0
  494. package/tui/widgets/__pycache__/shell_result.cpython-314.pyc +0 -0
  495. package/tui/widgets/__pycache__/shell_terminal.cpython-314.pyc +0 -0
  496. package/tui/widgets/__pycache__/side_bar.cpython-314.pyc +0 -0
  497. package/tui/widgets/__pycache__/slash_complete.cpython-314.pyc +0 -0
  498. package/tui/widgets/__pycache__/strike_text.cpython-314.pyc +0 -0
  499. package/tui/widgets/__pycache__/subagent.cpython-314.pyc +0 -0
  500. package/tui/widgets/__pycache__/subagent_screen.cpython-314.pyc +0 -0
  501. package/tui/widgets/__pycache__/terminal.cpython-314.pyc +0 -0
  502. package/tui/widgets/__pycache__/throbber.cpython-314.pyc +0 -0
  503. package/tui/widgets/__pycache__/tool_call.cpython-314.pyc +0 -0
  504. package/tui/widgets/__pycache__/user_input.cpython-314.pyc +0 -0
  505. package/tui/widgets/acp_content.py +0 -70
  506. package/tui/widgets/agent_response.py +0 -76
  507. package/tui/widgets/agent_thought.py +0 -167
  508. package/tui/widgets/ask_user.py +0 -264
  509. package/tui/widgets/command_pane.py +0 -223
  510. package/tui/widgets/condensed_path.py +0 -115
  511. package/tui/widgets/context_stats.py +0 -66
  512. package/tui/widgets/conversation.py +0 -2641
  513. package/tui/widgets/danger_warning.py +0 -65
  514. package/tui/widgets/diff_view.py +0 -69
  515. package/tui/widgets/directory_input.py +0 -8
  516. package/tui/widgets/flash.py +0 -81
  517. package/tui/widgets/future_text.py +0 -126
  518. package/tui/widgets/grid_select.py +0 -234
  519. package/tui/widgets/highlighted_textarea.py +0 -180
  520. package/tui/widgets/load_more.py +0 -24
  521. package/tui/widgets/mandelbrot.py +0 -294
  522. package/tui/widgets/markdown_note.py +0 -13
  523. package/tui/widgets/menu.py +0 -147
  524. package/tui/widgets/modified_files.py +0 -306
  525. package/tui/widgets/non_selectable_label.py +0 -5
  526. package/tui/widgets/note.py +0 -18
  527. package/tui/widgets/path_search.py +0 -492
  528. package/tui/widgets/plan.py +0 -285
  529. package/tui/widgets/project_directory_tree.py +0 -102
  530. package/tui/widgets/project_grid_select.py +0 -64
  531. package/tui/widgets/project_summary.py +0 -33
  532. package/tui/widgets/prompt.py +0 -795
  533. package/tui/widgets/question.py +0 -360
  534. package/tui/widgets/session_grid_select.py +0 -230
  535. package/tui/widgets/session_summary.py +0 -115
  536. package/tui/widgets/session_tabs.py +0 -188
  537. package/tui/widgets/shell_result.py +0 -35
  538. package/tui/widgets/shell_terminal.py +0 -40
  539. package/tui/widgets/side_bar.py +0 -124
  540. package/tui/widgets/slash_complete.py +0 -235
  541. package/tui/widgets/strike_text.py +0 -70
  542. package/tui/widgets/subagent.py +0 -287
  543. package/tui/widgets/subagent_screen.py +0 -709
  544. package/tui/widgets/terminal.py +0 -576
  545. package/tui/widgets/terminal_tool.py +0 -360
  546. package/tui/widgets/throbber.py +0 -100
  547. package/tui/widgets/tool_call.py +0 -398
  548. package/tui/widgets/user_input.py +0 -23
  549. package/tui/widgets/version.py +0 -5
  550. package/tui/widgets/welcome.py +0 -31
@@ -1,132 +0,0 @@
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 Tool, ToolRegistry, ToolSpec
7
-
8
-
9
- class AgentTool(Tool):
10
- def __init__(self, registry: ToolRegistry, permission_checker=None):
11
- self._registry = registry
12
- self._permission_checker = permission_checker
13
-
14
- def spec(self) -> ToolSpec:
15
- return ToolSpec(
16
- name="Agent",
17
- description="Execute a sequence of tool calls as a single atomic agent step.",
18
- input_schema={
19
- "type": "object",
20
- "properties": {
21
- "calls": {
22
- "type": "array",
23
- "items": {
24
- "type": "object",
25
- "properties": {
26
- "name": {"type": "string", "description": "Tool name"},
27
- "input": {"type": "object", "description": "Tool input arguments"},
28
- },
29
- "required": ["name", "input"],
30
- },
31
- },
32
- "stop_on_error": {
33
- "type": "boolean",
34
- "description": "Stop execution on first error",
35
- },
36
- },
37
- "required": ["calls"],
38
- },
39
- )
40
-
41
- def run(self, tool_input: dict[str, Any]) -> ToolResult:
42
- calls = tool_input.get("calls", [])
43
- stop_on_error = bool(tool_input.get("stop_on_error", True))
44
- if not isinstance(calls, list):
45
- return ToolResult(name="Agent", output={"error": "calls must be an array"}, is_error=True)
46
- results = []
47
- any_error = False
48
- for idx, call in enumerate(calls):
49
- if not isinstance(call, dict):
50
- return ToolResult(name="Agent", output={"error": f"calls[{idx}] must be an object"}, is_error=True)
51
- sub_name = call.get("name", "")
52
- if sub_name == "Agent":
53
- results.append({"name": sub_name, "is_error": True, "output": "Agent tool cannot be nested"})
54
- any_error = True
55
- if stop_on_error:
56
- break
57
- continue
58
- sub_input = call.get("input", {})
59
- if self._permission_checker:
60
- denied = self._permission_checker(sub_name, sub_input)
61
- if denied:
62
- results.append({"name": sub_name, "is_error": True, "output": denied})
63
- any_error = True
64
- if stop_on_error:
65
- break
66
- continue
67
- from onecode.agent.tools.protocol import ToolCall
68
- sub_result = self._registry.dispatch(ToolCall(name=sub_name, input=sub_input, tool_use_id=f"agent_{idx}"))
69
- sub_error = sub_result.is_error
70
- results.append({"name": sub_name, "is_error": sub_error, "output": sub_result.output})
71
- any_error = any_error or sub_error
72
- if sub_error and stop_on_error:
73
- break
74
- return ToolResult(name="Agent", output={"results": results}, is_error=any_error)
75
-
76
-
77
-
78
- class TaskTool(Tool):
79
- VALID_AGENT_TYPES: tuple[str, ...] = (
80
- "general", "explore", "scout",
81
- "build", "plan", "solo",
82
- )
83
-
84
- def __init__(self, spawn_fn):
85
- self._spawn = spawn_fn
86
-
87
- def spec(self) -> ToolSpec:
88
- return ToolSpec(
89
- name="Spawn",
90
- description="Delegate a subtask to a specialized subagent. Use for complex multi-step work or work that benefits from an isolated context.",
91
- input_schema={
92
- "type": "object",
93
- "properties": {
94
- "agent_type": {
95
- "type": "string",
96
- "enum": list(self.VALID_AGENT_TYPES),
97
- "description": "general (implementation) | explore (code search) | scout (research) | build (full dev) | plan (analysis) | solo (autonomous). Default: general. Choose based on subtask nature.",
98
- },
99
- "prompt": {"type": "string", "description": "Detailed task description for the subagent. Include context, goals, and expected output format."},
100
- },
101
- "required": ["prompt"],
102
- },
103
- )
104
-
105
- def run(self, tool_input: dict[str, Any]) -> ToolResult:
106
- agent_type = tool_input.get("agent_type", "general")
107
- prompt = tool_input.get("prompt", "")
108
- if agent_type not in self.VALID_AGENT_TYPES:
109
- return ToolResult(
110
- name="Spawn",
111
- output={
112
- "error": (
113
- f"Unknown agent_type '{agent_type}'. "
114
- f"Valid types: {', '.join(self.VALID_AGENT_TYPES)}"
115
- ),
116
- },
117
- is_error=True,
118
- )
119
- import asyncio
120
- try:
121
- loop = asyncio.get_event_loop()
122
- if loop.is_running():
123
- future = asyncio.run_coroutine_threadsafe(
124
- self._spawn(agent_type, prompt), loop
125
- )
126
- result = future.result(timeout=300)
127
- else:
128
- result = asyncio.run(self._spawn(agent_type, prompt))
129
- except Exception as e:
130
- return ToolResult(name="Spawn", output={"error": str(e)}, is_error=True)
131
- return ToolResult(name="Spawn", output=str(result))
132
-
@@ -1,138 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import re
4
- from typing import Any
5
-
6
- from onecode.agent.tools.file_ops import FileOps
7
- from onecode.agent.tools.protocol import ToolResult
8
- from onecode.agent.tools.registry import Tool, ToolSpec
9
-
10
-
11
- class ApplyPatchTool(Tool):
12
- def __init__(self, file_ops: FileOps):
13
- self._file_ops = file_ops
14
-
15
- def spec(self) -> ToolSpec:
16
- return ToolSpec(
17
- name="ApplyPatch",
18
- description="Apply a patch to files. Supports creating, updating, moving, and deleting files via patch format.",
19
- input_schema={
20
- "type": "object",
21
- "properties": {
22
- "patch": {
23
- "type": "string",
24
- "description": "Patch content with marker lines:\n"
25
- "*** Add File: <path>\n"
26
- "*** Update File: <path>\n"
27
- "*** Move to: <path>\n"
28
- "*** Delete File: <path>",
29
- },
30
- },
31
- "required": ["patch"],
32
- },
33
- is_destructive=True,
34
- max_result_size_chars=50_000,
35
- )
36
-
37
- def run(self, tool_input: dict[str, Any]) -> ToolResult:
38
- patch = tool_input.get("patch", "")
39
- if not patch:
40
- return ToolResult(name="ApplyPatch", output={"error": "patch is required"}, is_error=True)
41
-
42
- results = []
43
- current_file: str | None = None
44
- current_content: list[str] = []
45
-
46
- lines = patch.split("\n")
47
- i = 0
48
- while i < len(lines):
49
- line = lines[i].rstrip()
50
-
51
- add_match = re.match(r"^\*\*\*\s*Add File:\s*(.+)$", line)
52
- update_match = re.match(r"^\*\*\*\s*Update File:\s*(.+)$", line)
53
- move_match = re.match(r"^\*\*\*\s*Move to:\s*(.+)$", line)
54
- delete_match = re.match(r"^\*\*\*\s*Delete File:\s*(.+)$", line)
55
-
56
- if add_match:
57
- if current_file and current_content:
58
- result = self._write_file(current_file, "\n".join(current_content))
59
- results.append(result)
60
- current_file = add_match.group(1).strip()
61
- current_content = []
62
-
63
- elif update_match:
64
- if current_file and current_content:
65
- result = self._write_file(current_file, "\n".join(current_content))
66
- results.append(result)
67
- current_file = update_match.group(1).strip()
68
- current_content = []
69
-
70
- elif move_match:
71
- target = move_match.group(1).strip()
72
- if current_file:
73
- result = self._move_file(current_file, target)
74
- results.append(result)
75
- current_file = target
76
-
77
- elif delete_match:
78
- target = delete_match.group(1).strip()
79
- result = self._delete_file(target)
80
- results.append(result)
81
- current_file = None
82
- current_content = []
83
-
84
- else:
85
- if current_file is not None:
86
- current_content.append(line)
87
-
88
- i += 1
89
-
90
- if current_file and current_content:
91
- result = self._write_file(current_file, "\n".join(current_content))
92
- results.append(result)
93
-
94
- if not results:
95
- return ToolResult(name="ApplyPatch", output={"error": "No patches applied"}, is_error=True)
96
-
97
- success_count = sum(1 for r in results if r.get("success"))
98
- return ToolResult(
99
- name="ApplyPatch",
100
- output={"applied": len(results), "success": success_count, "results": results},
101
- is_error=False,
102
- )
103
-
104
- def _write_file(self, path: str, content: str) -> dict:
105
- return self._file_ops.write(path, content)
106
-
107
- def _move_file(self, src: str, dst: str) -> dict:
108
- p_src = self._file_ops._resolve(src)
109
- p_dst = self._file_ops._resolve(dst)
110
-
111
- if not p_src.exists():
112
- return {"success": False, "error": f"Source file not found: {src}"}
113
-
114
- if not self._file_ops._is_within_workspace(p_dst):
115
- return {"success": False, "error": "Path outside workspace"}
116
-
117
- try:
118
- p_dst.parent.mkdir(parents=True, exist_ok=True)
119
- p_src.rename(p_dst)
120
- return {"success": True, "operation": "move", "from": src, "to": dst}
121
- except Exception as e:
122
- return {"success": False, "error": str(e)}
123
-
124
- def _delete_file(self, path: str) -> dict:
125
- p = self._file_ops._resolve(path)
126
-
127
- if not p.exists():
128
- return {"success": False, "error": f"File not found: {path}"}
129
-
130
- if not self._file_ops._is_within_workspace(p):
131
- return {"success": False, "error": "Path outside workspace"}
132
-
133
- try:
134
- p.unlink()
135
- return {"success": True, "operation": "delete", "path": path}
136
- except Exception as e:
137
- return {"success": False, "error": str(e)}
138
-
@@ -1,111 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import re
4
- from typing import Any, Callable
5
-
6
- from onecode.agent.tools.file_ops import ShellTool
7
- from onecode.agent.tools.protocol import ToolResult
8
- from onecode.agent.tools.registry import Tool, ToolSpec
9
-
10
-
11
- _DANGEROUS_PATTERNS = [
12
- re.compile(r"\bsudo\b", re.IGNORECASE),
13
- re.compile(r"\bshutdown\b", re.IGNORECASE),
14
- re.compile(r"\breboot\b", re.IGNORECASE),
15
- re.compile(r"\bmkfs\b", re.IGNORECASE),
16
- re.compile(r"\bdd\b\s+if=", re.IGNORECASE),
17
- re.compile(r"\brm\b.*\s+-rf\s+/\s*$", re.IGNORECASE),
18
- re.compile(r"\brm\b.*\s+-rf\s+/\s+"),
19
- re.compile(r":\(\)\s*\{\s*:\s*\|\s*:\s*&\s*\}\s*;\s*:", re.IGNORECASE),
20
- ]
21
-
22
-
23
- class BashTool(Tool):
24
- def __init__(self, shell: ShellTool):
25
- self._shell = shell
26
-
27
- def spec(self) -> ToolSpec:
28
- return ToolSpec(
29
- name="Bash",
30
- description="Execute a shell command and return stdout/stderr.",
31
- input_schema={
32
- "type": "object",
33
- "properties": {
34
- "command": {"type": "string", "description": "Shell command to execute"},
35
- "timeout": {"type": "integer", "description": "Timeout in seconds", "default": 60},
36
- },
37
- "required": ["command"],
38
- },
39
- is_destructive=True,
40
- max_result_size_chars=50_000,
41
- )
42
-
43
- def run(self, tool_input: dict[str, Any]) -> ToolResult:
44
- command = tool_input.get("command", "")
45
- timeout = tool_input.get("timeout", 60)
46
-
47
- error = self._validate(command)
48
- if error:
49
- return error
50
-
51
- result = self._shell.exec(command, timeout=timeout)
52
- return self._to_tool_result(result, tool_input)
53
-
54
- async def run_async(
55
- self, tool_input: dict[str, Any],
56
- cancel_check: Callable[[], bool] | None = None,
57
- ) -> ToolResult:
58
- command = tool_input.get("command", "")
59
- timeout = tool_input.get("timeout", 60)
60
-
61
- error = self._validate(command)
62
- if error:
63
- return error
64
-
65
- result = await self._shell.exec_async(command, timeout=timeout, cancel_check=cancel_check)
66
- return self._to_tool_result(result, tool_input)
67
-
68
- def _validate(self, command: str) -> ToolResult | None:
69
- if not isinstance(command, str) or not command.strip():
70
- return ToolResult(name="Bash", output="command must be a non-empty string", is_error=True, content_type="text")
71
- if "\x00" in command:
72
- return ToolResult(name="Bash", output="command contains NUL byte", is_error=True, content_type="text")
73
- for pat in _DANGEROUS_PATTERNS:
74
- if pat.search(command):
75
- return ToolResult(name="Bash", output="refusing to run potentially dangerous command", is_error=True, content_type="text")
76
- return None
77
-
78
- def _to_tool_result(self, result: dict, tool_input: dict) -> ToolResult:
79
- is_error = not result.get("success", True)
80
- stdout = result.get("stdout", "") or ""
81
- stderr = result.get("stderr", "") or ""
82
- error_msg = result.get("error", "") or ""
83
- formatted = self._format_bash_output(stdout, stderr, error_msg, is_error)
84
- return ToolResult(
85
- name="Bash",
86
- output=formatted,
87
- is_error=is_error,
88
- content_type="text",
89
- tool_use_id=tool_input.get("tool_use_id"),
90
- )
91
-
92
- @staticmethod
93
- def _format_bash_output(stdout: str, stderr: str, error: str, is_error: bool) -> str:
94
- """Format shell stdout / stderr as a single text block for the TUI.
95
-
96
- Stderr is rendered first when present so failures are visible,
97
- the underlying ``error`` string is included for non-zero exits /
98
- transport failures, and the result is fenced so the TUI renders
99
- it as a code block with bash syntax highlighting.
100
- """
101
- parts: list[str] = []
102
- if error.strip():
103
- parts.append(f"[error] {error.strip()}")
104
- if stderr.strip():
105
- parts.append(f"[stderr]\n{stderr.rstrip()}")
106
- if stdout.strip():
107
- parts.append(stdout.rstrip())
108
- if not parts:
109
- return "(no output)" if not is_error else "(failed with no output)"
110
- return "```bash\n" + "\n\n".join(parts) + "\n```"
111
-
@@ -1,148 +0,0 @@
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 Tool, ToolRegistry, ToolSpec
7
-
8
-
9
- class SendMessageTool(Tool):
10
- def __init__(self):
11
- self.last_message: str = ""
12
-
13
- def spec(self) -> ToolSpec:
14
- return ToolSpec(
15
- name="SendMessage",
16
- description="Send a user-visible message with optional file attachments.",
17
- input_schema={
18
- "type": "object",
19
- "properties": {
20
- "message": {"type": "string", "description": "The message to show to the user"},
21
- "attachments": {
22
- "type": "array",
23
- "items": {"type": "string"},
24
- "description": "Optional file paths to attach",
25
- },
26
- },
27
- "required": ["message"],
28
- },
29
- is_read_only=True,
30
- )
31
-
32
- def run(self, tool_input: dict[str, Any]) -> ToolResult:
33
- message = tool_input.get("message", "")
34
- attachments = tool_input.get("attachments", [])
35
- self.last_message = message
36
- return ToolResult(name="SendMessage", output={"message": message, "attachments": attachments})
37
-
38
-
39
-
40
- _OPTION_SCHEMA = {
41
- "type": "object",
42
- "properties": {
43
- "label": {"type": "string", "description": "Display text for the option"},
44
- "value": {"type": "string", "description": "Value returned when selected"},
45
- "description": {"type": "string", "description": "Optional explanation of the choice"},
46
- "key": {"type": "string", "description": "Optional keyboard shortcut (e.g. 'y', 'n')"},
47
- "default": {"type": "boolean", "description": "Auto-select if user doesn't respond"},
48
- },
49
- "required": ["label", "value"],
50
- }
51
-
52
- _QUESTION_SCHEMA = {
53
- "type": "object",
54
- "properties": {
55
- "header": {"type": "string", "description": "Short label (max 30 chars) for this question"},
56
- "question": {"type": "string", "description": "The question text shown to the user"},
57
- "type": {
58
- "type": "string",
59
- "enum": ["single", "multiple", "confirm"],
60
- "description": "Question type: single=one choice, multiple=multi-select, confirm=yes/no",
61
- },
62
- "options": {
63
- "type": "array",
64
- "items": _OPTION_SCHEMA,
65
- "description": "Predefined choices. For 'confirm' type, omit to get default Yes/No options.",
66
- },
67
- },
68
- "required": ["question"],
69
- }
70
-
71
-
72
- class AskUserTool(Tool):
73
- def spec(self) -> ToolSpec:
74
- return ToolSpec(
75
- name="AskUser",
76
- description="Ask the user one or more questions with optional predefined choices.",
77
- input_schema={
78
- "type": "object",
79
- "properties": {
80
- "question": {"type": "string", "description": "[DEPRECATED] Single question text. Use 'questions' instead."},
81
- "header": {"type": "string", "description": "[DEPRECATED] Short label for single question."},
82
- "context": {"type": "string", "description": "Additional context"},
83
- "options": {
84
- "type": "array",
85
- "items": _OPTION_SCHEMA,
86
- "description": "[DEPRECATED] Options for single question. Use 'questions' instead.",
87
- },
88
- "questions": {
89
- "type": "array",
90
- "items": _QUESTION_SCHEMA,
91
- "minItems": 1,
92
- "maxItems": 6,
93
- "description": "One or more questions to ask the user. Supports single choice, multiple selection, and confirm types.",
94
- },
95
- },
96
- "oneOf": [
97
- {"required": ["question"]},
98
- {"required": ["questions"]},
99
- ],
100
- },
101
- is_read_only=True,
102
- )
103
-
104
- def run(self, tool_input: dict[str, Any]) -> ToolResult:
105
- question = tool_input.get("question", "")
106
- header = tool_input.get("header", "")
107
- context = tool_input.get("context", "")
108
- options = tool_input.get("options", [])
109
- questions = tool_input.get("questions", [])
110
- return ToolResult(name="AskUser", output={
111
- "question": question,
112
- "header": header,
113
- "context": context,
114
- "options": options,
115
- "questions": questions,
116
- })
117
-
118
-
119
-
120
- class ToolSearchTool(Tool):
121
- def __init__(self, registry: ToolRegistry):
122
- self._registry = registry
123
-
124
- def spec(self) -> ToolSpec:
125
- return ToolSpec(
126
- name="ToolSearch",
127
- description="Search for available tools by keyword.",
128
- input_schema={
129
- "type": "object",
130
- "properties": {
131
- "query": {"type": "string", "description": "Search keyword to find relevant tools"},
132
- },
133
- "required": ["query"],
134
- },
135
- is_read_only=True,
136
- )
137
-
138
- def run(self, tool_input: dict[str, Any]) -> ToolResult:
139
- query = tool_input.get("query", "").lower()
140
- specs = self._registry.list_specs()
141
- matches = []
142
- for spec in specs:
143
- if query in spec.name.lower() or query in spec.description.lower():
144
- matches.append({"name": spec.name, "description": spec.description})
145
- if not matches:
146
- matches = [{"name": s.name, "description": s.description[:80]} for s in specs[:10]]
147
- return ToolResult(name="ToolSearch", output={"matches": matches[:20]})
148
-
@@ -1,130 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import logging
4
- from typing import Any
5
-
6
- from onecode.agent.tools.protocol import ToolResult
7
- from onecode.agent.tools.registry import Tool, ToolSpec
8
- from onecode.config import GlobalConfig
9
-
10
- logger = logging.getLogger("onecode.tools.config")
11
-
12
-
13
- class ConfigReadTool(Tool):
14
- """Read configuration values accessible to the LLM (Clawd-Code pattern)."""
15
-
16
- def __init__(self, config: GlobalConfig):
17
- self._config = config
18
-
19
- def spec(self) -> ToolSpec:
20
- return ToolSpec(
21
- name="ConfigRead",
22
- description="Read configuration values. Returns current config for the specified path (e.g. 'default_model', 'default_provider', 'tui.theme').",
23
- input_schema={
24
- "type": "object",
25
- "properties": {
26
- "key": {
27
- "type": "string",
28
- "description": "Config key path (e.g. 'default_model', 'tui.theme'). Empty returns all.",
29
- },
30
- },
31
- },
32
- )
33
-
34
- def run(self, tool_input: dict[str, Any]) -> ToolResult:
35
- key = tool_input.get("key", "")
36
- if not key:
37
- return ToolResult(name="ConfigRead", output={"config": self._config_to_dict()})
38
- parts = key.split(".")
39
- val = self._resolve(self._config, parts)
40
- if val is None:
41
- return ToolResult(name="ConfigRead", output={"error": f"config key '{key}' not found"}, is_error=True)
42
- return ToolResult(name="ConfigRead", output={"key": key, "value": val})
43
-
44
- def _config_to_dict(self) -> dict:
45
- return {
46
- "default_model": self._config.default_model,
47
- "default_provider": self._config.default_provider,
48
- "default_mode": self._config.default_mode,
49
- "current_project": self._config.current_project,
50
- "tui.theme": self._config.tui.theme if self._config.tui else None,
51
- "log_level": self._config.log_level,
52
- }
53
-
54
- def _resolve(self, obj: Any, parts: list[str]) -> Any:
55
- current = obj
56
- for part in parts:
57
- if hasattr(current, part):
58
- current = getattr(current, part)
59
- elif isinstance(current, dict):
60
- current = current.get(part)
61
- else:
62
- return None
63
- return current
64
-
65
-
66
-
67
- class ConfigWriteTool(Tool):
68
- """Write configuration values accessible to the LLM (Clawd-Code pattern)."""
69
-
70
- def __init__(self, config: GlobalConfig, save_fn=None):
71
- self._config = config
72
- self._save_fn = save_fn
73
-
74
- def spec(self) -> ToolSpec:
75
- return ToolSpec(
76
- name="ConfigWrite",
77
- description="Set a configuration value. Path supports dot notation (e.g. 'tui.theme'). Only string/numeric values. Does NOT expose API keys or secrets.",
78
- input_schema={
79
- "type": "object",
80
- "properties": {
81
- "key": {"type": "string", "description": "Config key path (e.g. 'default_model', 'tui.theme')"},
82
- "value": {"type": "string", "description": "Value to set"},
83
- },
84
- "required": ["key", "value"],
85
- },
86
- )
87
-
88
- ALLOWED_KEYS = {
89
- "default_model", "default_provider", "default_mode",
90
- "tui.theme", "log_level", "current_project",
91
- }
92
-
93
- def run(self, tool_input: dict[str, Any]) -> ToolResult:
94
- key = tool_input.get("key", "")
95
- value = tool_input.get("value", "")
96
- if key not in self.ALLOWED_KEYS:
97
- return ToolResult(
98
- name="ConfigWrite",
99
- output={"error": f"key '{key}' is not writable via this tool. Allowed: {sorted(self.ALLOWED_KEYS)}"},
100
- is_error=True,
101
- )
102
- parts = key.split(".")
103
- try:
104
- self._set(self._config, parts, value)
105
- except Exception as e:
106
- return ToolResult(name="ConfigWrite", output={"error": str(e)}, is_error=True)
107
- if self._save_fn:
108
- try:
109
- self._save_fn(self._config)
110
- except Exception as e:
111
- logger.warning("Config save failed: %s", e)
112
- return ToolResult(name="ConfigWrite", output={"key": key, "value": value, "status": "updated"})
113
-
114
- def _set(self, obj: Any, parts: list[str], value: Any) -> None:
115
- current = obj
116
- for part in parts[:-1]:
117
- if hasattr(current, part):
118
- current = getattr(current, part)
119
- last = parts[-1]
120
- if hasattr(current, last):
121
- field_type = type(getattr(current, last))
122
- if field_type is int:
123
- setattr(current, last, int(value))
124
- elif field_type is float:
125
- setattr(current, last, float(value))
126
- elif field_type is bool:
127
- setattr(current, last, value.lower() in ("true", "1", "yes"))
128
- else:
129
- setattr(current, last, value)
130
-