llmcode-cli 1.0.0__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.
Files changed (212) hide show
  1. llm_code/__init__.py +2 -0
  2. llm_code/analysis/__init__.py +6 -0
  3. llm_code/analysis/cache.py +33 -0
  4. llm_code/analysis/engine.py +256 -0
  5. llm_code/analysis/go_rules.py +114 -0
  6. llm_code/analysis/js_rules.py +84 -0
  7. llm_code/analysis/python_rules.py +311 -0
  8. llm_code/analysis/rules.py +140 -0
  9. llm_code/analysis/rust_rules.py +108 -0
  10. llm_code/analysis/universal_rules.py +111 -0
  11. llm_code/api/__init__.py +0 -0
  12. llm_code/api/client.py +90 -0
  13. llm_code/api/errors.py +73 -0
  14. llm_code/api/openai_compat.py +390 -0
  15. llm_code/api/provider.py +35 -0
  16. llm_code/api/sse.py +52 -0
  17. llm_code/api/types.py +140 -0
  18. llm_code/cli/__init__.py +0 -0
  19. llm_code/cli/commands.py +70 -0
  20. llm_code/cli/image.py +122 -0
  21. llm_code/cli/render.py +214 -0
  22. llm_code/cli/status_line.py +79 -0
  23. llm_code/cli/streaming.py +92 -0
  24. llm_code/cli/tui_main.py +220 -0
  25. llm_code/computer_use/__init__.py +11 -0
  26. llm_code/computer_use/app_detect.py +49 -0
  27. llm_code/computer_use/app_tier.py +57 -0
  28. llm_code/computer_use/coordinator.py +99 -0
  29. llm_code/computer_use/input_control.py +71 -0
  30. llm_code/computer_use/screenshot.py +93 -0
  31. llm_code/cron/__init__.py +13 -0
  32. llm_code/cron/parser.py +145 -0
  33. llm_code/cron/scheduler.py +135 -0
  34. llm_code/cron/storage.py +126 -0
  35. llm_code/enterprise/__init__.py +1 -0
  36. llm_code/enterprise/audit.py +59 -0
  37. llm_code/enterprise/auth.py +26 -0
  38. llm_code/enterprise/oidc.py +95 -0
  39. llm_code/enterprise/rbac.py +65 -0
  40. llm_code/harness/__init__.py +5 -0
  41. llm_code/harness/config.py +33 -0
  42. llm_code/harness/engine.py +129 -0
  43. llm_code/harness/guides.py +41 -0
  44. llm_code/harness/sensors.py +68 -0
  45. llm_code/harness/templates.py +84 -0
  46. llm_code/hida/__init__.py +1 -0
  47. llm_code/hida/classifier.py +187 -0
  48. llm_code/hida/engine.py +49 -0
  49. llm_code/hida/profiles.py +95 -0
  50. llm_code/hida/types.py +28 -0
  51. llm_code/ide/__init__.py +1 -0
  52. llm_code/ide/bridge.py +80 -0
  53. llm_code/ide/detector.py +76 -0
  54. llm_code/ide/server.py +169 -0
  55. llm_code/logging.py +29 -0
  56. llm_code/lsp/__init__.py +0 -0
  57. llm_code/lsp/client.py +298 -0
  58. llm_code/lsp/detector.py +42 -0
  59. llm_code/lsp/manager.py +56 -0
  60. llm_code/lsp/tools.py +288 -0
  61. llm_code/marketplace/__init__.py +0 -0
  62. llm_code/marketplace/builtin_registry.py +102 -0
  63. llm_code/marketplace/installer.py +162 -0
  64. llm_code/marketplace/plugin.py +78 -0
  65. llm_code/marketplace/registry.py +360 -0
  66. llm_code/mcp/__init__.py +0 -0
  67. llm_code/mcp/bridge.py +87 -0
  68. llm_code/mcp/client.py +117 -0
  69. llm_code/mcp/health.py +120 -0
  70. llm_code/mcp/manager.py +214 -0
  71. llm_code/mcp/oauth.py +219 -0
  72. llm_code/mcp/transport.py +254 -0
  73. llm_code/mcp/types.py +53 -0
  74. llm_code/remote/__init__.py +0 -0
  75. llm_code/remote/client.py +136 -0
  76. llm_code/remote/protocol.py +22 -0
  77. llm_code/remote/server.py +275 -0
  78. llm_code/remote/ssh_proxy.py +56 -0
  79. llm_code/runtime/__init__.py +0 -0
  80. llm_code/runtime/auto_commit.py +56 -0
  81. llm_code/runtime/auto_diagnose.py +62 -0
  82. llm_code/runtime/checkpoint.py +70 -0
  83. llm_code/runtime/checkpoint_recovery.py +142 -0
  84. llm_code/runtime/compaction.py +35 -0
  85. llm_code/runtime/compressor.py +415 -0
  86. llm_code/runtime/config.py +533 -0
  87. llm_code/runtime/context.py +49 -0
  88. llm_code/runtime/conversation.py +921 -0
  89. llm_code/runtime/cost_tracker.py +126 -0
  90. llm_code/runtime/dream.py +127 -0
  91. llm_code/runtime/file_protection.py +150 -0
  92. llm_code/runtime/hardware.py +85 -0
  93. llm_code/runtime/hooks.py +223 -0
  94. llm_code/runtime/indexer.py +230 -0
  95. llm_code/runtime/knowledge_compiler.py +232 -0
  96. llm_code/runtime/memory.py +132 -0
  97. llm_code/runtime/memory_layers.py +467 -0
  98. llm_code/runtime/memory_lint.py +252 -0
  99. llm_code/runtime/model_aliases.py +37 -0
  100. llm_code/runtime/ollama.py +93 -0
  101. llm_code/runtime/overlay.py +124 -0
  102. llm_code/runtime/permissions.py +200 -0
  103. llm_code/runtime/plan.py +45 -0
  104. llm_code/runtime/prompt.py +238 -0
  105. llm_code/runtime/repo_map.py +174 -0
  106. llm_code/runtime/sandbox.py +116 -0
  107. llm_code/runtime/session.py +268 -0
  108. llm_code/runtime/skill_resolver.py +61 -0
  109. llm_code/runtime/skills.py +133 -0
  110. llm_code/runtime/speculative.py +75 -0
  111. llm_code/runtime/streaming_executor.py +216 -0
  112. llm_code/runtime/telemetry.py +196 -0
  113. llm_code/runtime/token_budget.py +26 -0
  114. llm_code/runtime/vcr.py +142 -0
  115. llm_code/runtime/vision.py +102 -0
  116. llm_code/swarm/__init__.py +1 -0
  117. llm_code/swarm/backend_subprocess.py +108 -0
  118. llm_code/swarm/backend_tmux.py +103 -0
  119. llm_code/swarm/backend_worktree.py +306 -0
  120. llm_code/swarm/checkpoint.py +74 -0
  121. llm_code/swarm/coordinator.py +236 -0
  122. llm_code/swarm/mailbox.py +88 -0
  123. llm_code/swarm/manager.py +202 -0
  124. llm_code/swarm/memory_sync.py +80 -0
  125. llm_code/swarm/recovery.py +21 -0
  126. llm_code/swarm/team.py +67 -0
  127. llm_code/swarm/types.py +31 -0
  128. llm_code/task/__init__.py +16 -0
  129. llm_code/task/diagnostics.py +93 -0
  130. llm_code/task/manager.py +162 -0
  131. llm_code/task/types.py +112 -0
  132. llm_code/task/verifier.py +104 -0
  133. llm_code/tools/__init__.py +0 -0
  134. llm_code/tools/agent.py +145 -0
  135. llm_code/tools/agent_roles.py +82 -0
  136. llm_code/tools/base.py +94 -0
  137. llm_code/tools/bash.py +565 -0
  138. llm_code/tools/computer_use_tools.py +278 -0
  139. llm_code/tools/coordinator_tool.py +75 -0
  140. llm_code/tools/cron_create.py +90 -0
  141. llm_code/tools/cron_delete.py +49 -0
  142. llm_code/tools/cron_list.py +51 -0
  143. llm_code/tools/deferred.py +92 -0
  144. llm_code/tools/dump.py +116 -0
  145. llm_code/tools/edit_file.py +282 -0
  146. llm_code/tools/git_tools.py +531 -0
  147. llm_code/tools/glob_search.py +112 -0
  148. llm_code/tools/grep_search.py +144 -0
  149. llm_code/tools/ide_diagnostics.py +59 -0
  150. llm_code/tools/ide_open.py +58 -0
  151. llm_code/tools/ide_selection.py +52 -0
  152. llm_code/tools/memory_tools.py +138 -0
  153. llm_code/tools/multi_edit.py +143 -0
  154. llm_code/tools/notebook_edit.py +107 -0
  155. llm_code/tools/notebook_read.py +81 -0
  156. llm_code/tools/parsing.py +63 -0
  157. llm_code/tools/read_file.py +154 -0
  158. llm_code/tools/registry.py +58 -0
  159. llm_code/tools/search_backends/__init__.py +56 -0
  160. llm_code/tools/search_backends/brave.py +56 -0
  161. llm_code/tools/search_backends/duckduckgo.py +129 -0
  162. llm_code/tools/search_backends/searxng.py +71 -0
  163. llm_code/tools/search_backends/tavily.py +73 -0
  164. llm_code/tools/swarm_create.py +109 -0
  165. llm_code/tools/swarm_delete.py +95 -0
  166. llm_code/tools/swarm_list.py +44 -0
  167. llm_code/tools/swarm_message.py +109 -0
  168. llm_code/tools/task_close.py +79 -0
  169. llm_code/tools/task_plan.py +79 -0
  170. llm_code/tools/task_verify.py +90 -0
  171. llm_code/tools/tool_search.py +65 -0
  172. llm_code/tools/web_common.py +258 -0
  173. llm_code/tools/web_fetch.py +223 -0
  174. llm_code/tools/web_search.py +280 -0
  175. llm_code/tools/write_file.py +118 -0
  176. llm_code/tui/__init__.py +1 -0
  177. llm_code/tui/app.py +2432 -0
  178. llm_code/tui/chat_view.py +82 -0
  179. llm_code/tui/chat_widgets.py +309 -0
  180. llm_code/tui/header_bar.py +46 -0
  181. llm_code/tui/input_bar.py +349 -0
  182. llm_code/tui/keybindings.py +142 -0
  183. llm_code/tui/marketplace.py +210 -0
  184. llm_code/tui/status_bar.py +72 -0
  185. llm_code/tui/theme.py +96 -0
  186. llm_code/utils/__init__.py +0 -0
  187. llm_code/utils/diff.py +111 -0
  188. llm_code/utils/errors.py +70 -0
  189. llm_code/utils/hyperlink.py +73 -0
  190. llm_code/utils/notebook.py +179 -0
  191. llm_code/utils/search.py +69 -0
  192. llm_code/utils/text_normalize.py +28 -0
  193. llm_code/utils/version_check.py +62 -0
  194. llm_code/vim/__init__.py +4 -0
  195. llm_code/vim/engine.py +51 -0
  196. llm_code/vim/motions.py +172 -0
  197. llm_code/vim/operators.py +183 -0
  198. llm_code/vim/text_objects.py +139 -0
  199. llm_code/vim/transitions.py +279 -0
  200. llm_code/vim/types.py +68 -0
  201. llm_code/voice/__init__.py +1 -0
  202. llm_code/voice/languages.py +43 -0
  203. llm_code/voice/recorder.py +136 -0
  204. llm_code/voice/stt.py +36 -0
  205. llm_code/voice/stt_anthropic.py +66 -0
  206. llm_code/voice/stt_google.py +32 -0
  207. llm_code/voice/stt_whisper.py +52 -0
  208. llmcode_cli-1.0.0.dist-info/METADATA +524 -0
  209. llmcode_cli-1.0.0.dist-info/RECORD +212 -0
  210. llmcode_cli-1.0.0.dist-info/WHEEL +4 -0
  211. llmcode_cli-1.0.0.dist-info/entry_points.txt +2 -0
  212. llmcode_cli-1.0.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,82 @@
1
+ """Specialized agent role definitions for constrained sub-agents."""
2
+ from __future__ import annotations
3
+
4
+ from dataclasses import dataclass
5
+
6
+
7
+ @dataclass(frozen=True)
8
+ class AgentRole:
9
+ name: str
10
+ description: str
11
+ system_prompt_prefix: str
12
+ allowed_tools: frozenset[str]
13
+ model_key: str # key in config.model_routing
14
+
15
+
16
+ EXPLORE_ROLE = AgentRole(
17
+ name="explore",
18
+ description="Read-only code exploration agent",
19
+ system_prompt_prefix=(
20
+ "You are a read-only exploration agent. You MUST NOT create, modify, or delete any files. "
21
+ "Only use read-only tools to explore the codebase."
22
+ ),
23
+ allowed_tools=frozenset({
24
+ "read_file",
25
+ "glob_search",
26
+ "grep_search",
27
+ "git_status",
28
+ "git_diff",
29
+ "git_log",
30
+ "lsp_goto_definition",
31
+ "lsp_find_references",
32
+ "lsp_diagnostics",
33
+ }),
34
+ model_key="sub_agent",
35
+ )
36
+
37
+ PLAN_ROLE = AgentRole(
38
+ name="plan",
39
+ description="Planning-only agent that analyzes and plans but never executes changes",
40
+ system_prompt_prefix=(
41
+ "You are a planning agent. Analyze the codebase and create a detailed plan. "
42
+ "Do NOT execute any changes — only describe what should be done, which files to modify, "
43
+ "and what the implementation should look like."
44
+ ),
45
+ allowed_tools=frozenset({
46
+ "read_file",
47
+ "glob_search",
48
+ "grep_search",
49
+ "git_status",
50
+ "git_diff",
51
+ "git_log",
52
+ "memory_recall",
53
+ "memory_list",
54
+ }),
55
+ model_key="sub_agent",
56
+ )
57
+
58
+ VERIFICATION_ROLE = AgentRole(
59
+ name="verify",
60
+ description="Adversarial verification agent that tries to find problems",
61
+ system_prompt_prefix=(
62
+ "You are a verification agent. Your job is to find problems.\n"
63
+ "Run tests, linters, and type checkers. Check exit codes and output carefully.\n"
64
+ "Do NOT trust the implementer's claims. Verify independently.\n"
65
+ "Report VERDICT: PASS, FAIL, or PARTIAL with evidence for each check."
66
+ ),
67
+ allowed_tools=frozenset({
68
+ "read_file",
69
+ "glob_search",
70
+ "grep_search",
71
+ "bash",
72
+ "git_status",
73
+ "git_diff",
74
+ }),
75
+ model_key="sub_agent",
76
+ )
77
+
78
+ BUILT_IN_ROLES: dict[str, AgentRole] = {
79
+ "explore": EXPLORE_ROLE,
80
+ "plan": PLAN_ROLE,
81
+ "verify": VERIFICATION_ROLE,
82
+ }
llm_code/tools/base.py ADDED
@@ -0,0 +1,94 @@
1
+ """Abstract base classes for tools."""
2
+ from __future__ import annotations
3
+
4
+ import dataclasses
5
+ from abc import ABC, abstractmethod
6
+ from enum import Enum
7
+ from typing import Callable
8
+
9
+ from pydantic import BaseModel
10
+
11
+ from llm_code.api.types import ToolDefinition
12
+
13
+
14
+ class PermissionLevel(Enum):
15
+ READ_ONLY = "read_only"
16
+ WORKSPACE_WRITE = "workspace_write"
17
+ FULL_ACCESS = "full_access"
18
+
19
+
20
+ @dataclasses.dataclass(frozen=True)
21
+ class ToolResult:
22
+ output: str
23
+ is_error: bool = False
24
+ metadata: dict | None = None
25
+
26
+
27
+ @dataclasses.dataclass(frozen=True)
28
+ class ToolProgress:
29
+ tool_name: str
30
+ message: str
31
+ percent: float | None = None
32
+
33
+
34
+ class Tool(ABC):
35
+ """Abstract base class for all tools."""
36
+
37
+ @property
38
+ @abstractmethod
39
+ def name(self) -> str: ...
40
+
41
+ @property
42
+ @abstractmethod
43
+ def description(self) -> str: ...
44
+
45
+ @property
46
+ @abstractmethod
47
+ def input_schema(self) -> dict: ...
48
+
49
+ @property
50
+ @abstractmethod
51
+ def required_permission(self) -> PermissionLevel: ...
52
+
53
+ @abstractmethod
54
+ def execute(self, args: dict) -> ToolResult: ...
55
+
56
+ @property
57
+ def input_model(self) -> type[BaseModel] | None:
58
+ """Return the Pydantic model class for input validation, or None."""
59
+ return None
60
+
61
+ def is_read_only(self, args: dict) -> bool:
62
+ """Return True if this operation only reads data (never writes)."""
63
+ return False
64
+
65
+ def is_destructive(self, args: dict) -> bool:
66
+ """Return True if this operation can cause irreversible data loss."""
67
+ return False
68
+
69
+ def is_concurrency_safe(self, args: dict) -> bool:
70
+ """Return True if this operation is safe to run concurrently."""
71
+ return False
72
+
73
+ def validate_input(self, args: dict) -> dict:
74
+ """Validate args against input_model; return coerced dict or raise ValidationError."""
75
+ model_cls = self.input_model
76
+ if model_cls is None:
77
+ return args
78
+ validated = model_cls(**args)
79
+ return validated.model_dump()
80
+
81
+ def execute_with_progress(
82
+ self,
83
+ args: dict,
84
+ on_progress: Callable[[ToolProgress], None],
85
+ ) -> ToolResult:
86
+ """Execute the tool, optionally emitting progress events via on_progress."""
87
+ return self.execute(args)
88
+
89
+ def to_definition(self) -> ToolDefinition:
90
+ return ToolDefinition(
91
+ name=self.name,
92
+ description=self.description,
93
+ input_schema=self.input_schema,
94
+ )