coder-agent 0.1.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.
- coder_agent-0.1.0.dist-info/METADATA +262 -0
- coder_agent-0.1.0.dist-info/RECORD +163 -0
- coder_agent-0.1.0.dist-info/WHEEL +5 -0
- coder_agent-0.1.0.dist-info/entry_points.txt +2 -0
- coder_agent-0.1.0.dist-info/licenses/LICENSE.md +21 -0
- coder_agent-0.1.0.dist-info/top_level.txt +1 -0
- coderagent/__init__.py +20 -0
- coderagent/compat/__init__.py +27 -0
- coderagent/compat/cache_control.py +69 -0
- coderagent/compat/config_spec.py +60 -0
- coderagent/compat/exceptions.py +20 -0
- coderagent/compat/retry.py +27 -0
- coderagent/compat/serialize.py +31 -0
- coderagent/config/__init__.py +1 -0
- coderagent/config/defaults.yaml +103 -0
- coderagent/config/loader.py +264 -0
- coderagent/config/schema.py +548 -0
- coderagent/config/writer.py +218 -0
- coderagent/core/__init__.py +1 -0
- coderagent/core/budget.py +47 -0
- coderagent/core/capabilities.py +136 -0
- coderagent/core/checkpoint.py +164 -0
- coderagent/core/content.py +156 -0
- coderagent/core/context.py +618 -0
- coderagent/core/events.py +83 -0
- coderagent/core/history.py +56 -0
- coderagent/core/instructions.py +99 -0
- coderagent/core/loop.py +702 -0
- coderagent/core/memory.py +56 -0
- coderagent/core/mentions.py +81 -0
- coderagent/core/os_sandbox.py +191 -0
- coderagent/core/otel.py +214 -0
- coderagent/core/protocols.py +38 -0
- coderagent/core/redact.py +49 -0
- coderagent/core/sandbox.py +82 -0
- coderagent/core/schema.py +107 -0
- coderagent/core/session.py +344 -0
- coderagent/core/shell_env.py +74 -0
- coderagent/core/subagent.py +474 -0
- coderagent/core/summarize.py +312 -0
- coderagent/core/telemetry.py +209 -0
- coderagent/core/tokens.py +132 -0
- coderagent/core/trust.py +301 -0
- coderagent/environments/__init__.py +11 -0
- coderagent/environments/bubblewrap.py +150 -0
- coderagent/environments/contree.py +146 -0
- coderagent/environments/docker.py +160 -0
- coderagent/environments/local.py +110 -0
- coderagent/environments/singularity.py +138 -0
- coderagent/environments/swerex_docker.py +79 -0
- coderagent/environments/swerex_modal.py +123 -0
- coderagent/eval/__init__.py +1 -0
- coderagent/eval/compare.py +190 -0
- coderagent/eval/report.py +141 -0
- coderagent/eval/runner.py +368 -0
- coderagent/eval/task.py +194 -0
- coderagent/extensions/__init__.py +1 -0
- coderagent/extensions/hooks.py +121 -0
- coderagent/extensions/plugins.py +217 -0
- coderagent/extensions/reflect.py +342 -0
- coderagent/models/__init__.py +33 -0
- coderagent/models/backends.py +218 -0
- coderagent/models/call.py +18 -0
- coderagent/models/check.py +139 -0
- coderagent/models/gateway.py +60 -0
- coderagent/models/litellm_config.py +70 -0
- coderagent/models/provider.py +98 -0
- coderagent/models/reasoning.py +28 -0
- coderagent/models/router.py +136 -0
- coderagent/models/settings.py +172 -0
- coderagent/models/streaming.py +122 -0
- coderagent/models/verbosity.py +14 -0
- coderagent/paths.py +31 -0
- coderagent/run.py +454 -0
- coderagent/skills/__init__.py +119 -0
- coderagent/skills/errors.py +11 -0
- coderagent/skills/install.py +340 -0
- coderagent/skills/presets/code-review/SKILL.md +35 -0
- coderagent/skills/presets/codebase-onboarding/SKILL.md +33 -0
- coderagent/skills/presets/data-analysis/SKILL.md +35 -0
- coderagent/skills/presets/deep-research/SKILL.md +38 -0
- coderagent/skills/presets/frontend-dev/SKILL.md +32 -0
- coderagent/skills/presets/long-document/SKILL.md +37 -0
- coderagent/skills/presets/long-document/scripts/pdf_text.py +37 -0
- coderagent/skills/presets/office-docx/SKILL.md +36 -0
- coderagent/skills/presets/office-docx/scripts/docx_text.py +36 -0
- coderagent/skills/presets/office-pptx/SKILL.md +32 -0
- coderagent/skills/presets/office-xlsx/SKILL.md +34 -0
- coderagent/skills/presets/office-xlsx/scripts/xlsx_text.py +72 -0
- coderagent/skills/presets/writing/SKILL.md +31 -0
- coderagent/skills/sandbox.py +269 -0
- coderagent/skills/sites.py +177 -0
- coderagent/skills/source.py +404 -0
- coderagent/testing/__init__.py +5 -0
- coderagent/testing/factory.py +59 -0
- coderagent/testing/scripted_model.py +54 -0
- coderagent/tools/__init__.py +1 -0
- coderagent/tools/base.py +54 -0
- coderagent/tools/bash_policy.py +486 -0
- coderagent/tools/builtin/__init__.py +35 -0
- coderagent/tools/builtin/fs.py +283 -0
- coderagent/tools/builtin/patch.py +279 -0
- coderagent/tools/builtin/search.py +242 -0
- coderagent/tools/builtin/shell.py +336 -0
- coderagent/tools/builtin/skill.py +41 -0
- coderagent/tools/builtin/task.py +53 -0
- coderagent/tools/builtin/todo.py +63 -0
- coderagent/tools/executor.py +243 -0
- coderagent/tools/mcp.py +317 -0
- coderagent/tools/permissions.py +472 -0
- coderagent/tools/registry.py +83 -0
- coderagent/tools/rules.py +138 -0
- coderagent/ui/__init__.py +1 -0
- coderagent/ui/cli.py +498 -0
- coderagent/ui/commands/__init__.py +109 -0
- coderagent/ui/commands/builtin.py +778 -0
- coderagent/ui/commands/compact.py +12 -0
- coderagent/ui/commands/resume.py +26 -0
- coderagent/ui/commands/review.py +73 -0
- coderagent/ui/commands/rewind.py +28 -0
- coderagent/ui/custom_commands.py +179 -0
- coderagent/ui/notify.py +46 -0
- coderagent/ui/open_file.py +48 -0
- coderagent/ui/render.py +62 -0
- coderagent/ui/spinner.py +68 -0
- coderagent/ui/tui.py +610 -0
- coderagent/ui/widgets/__init__.py +29 -0
- coderagent/ui/widgets/approval_prompt.py +129 -0
- coderagent/ui/widgets/diff_view.py +97 -0
- coderagent/ui/widgets/file_tree.py +105 -0
- coderagent/ui/widgets/markdown_message.py +44 -0
- coderagent/ui/widgets/markup.py +10 -0
- coderagent/ui/widgets/message_block.py +61 -0
- coderagent/ui/widgets/path_suggester.py +66 -0
- coderagent/ui/widgets/session_picker.py +49 -0
- coderagent/ui/widgets/status_bar.py +44 -0
- coderagent/ui/widgets/todo_panel.py +40 -0
- coderagent/ui/widgets/tool_card.py +104 -0
- coderagent/ui/widgets/working_dots.py +26 -0
- coderagent/version.py +7 -0
- coderagent/web/__init__.py +5 -0
- coderagent/web/api.py +449 -0
- coderagent/web/app.py +113 -0
- coderagent/web/approver.py +73 -0
- coderagent/web/config_api.py +53 -0
- coderagent/web/events.py +159 -0
- coderagent/web/files.py +115 -0
- coderagent/web/i18n.py +346 -0
- coderagent/web/server.py +100 -0
- coderagent/web/sessions.py +404 -0
- coderagent/web/skills_api.py +376 -0
- coderagent/web/static/app.css +283 -0
- coderagent/web/static/app.js +1466 -0
- coderagent/web/templates/en/base.html +31 -0
- coderagent/web/templates/en/chat.html +60 -0
- coderagent/web/templates/en/macros.html +9 -0
- coderagent/web/templates/en/settings.html +80 -0
- coderagent/web/templates/en/skills.html +64 -0
- coderagent/web/templates/zh/base.html +31 -0
- coderagent/web/templates/zh/chat.html +60 -0
- coderagent/web/templates/zh/macros.html +9 -0
- coderagent/web/templates/zh/settings.html +77 -0
- coderagent/web/templates/zh/skills.html +61 -0
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
"""The commands that are always available."""
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from coderagent.core.context import ContextEngine
|
|
7
|
+
from coderagent.core.subagent import effective_turns
|
|
8
|
+
from coderagent.models.backends import LiteLLMBackend
|
|
9
|
+
from coderagent.tools.permissions import PermissionMode
|
|
10
|
+
from coderagent.ui.commands import COMMANDS, Command, CommandContext, register
|
|
11
|
+
from coderagent.ui.commands.compact import compact
|
|
12
|
+
from coderagent.ui.commands.resume import fork as fork_session
|
|
13
|
+
from coderagent.ui.commands.resume import list_sessions
|
|
14
|
+
from coderagent.ui.commands.resume import resume as resume_session
|
|
15
|
+
from coderagent.ui.commands.rewind import list_checkpoints, rewind
|
|
16
|
+
|
|
17
|
+
AGENTS_TEMPLATE = """# {name}
|
|
18
|
+
|
|
19
|
+
{description}
|
|
20
|
+
|
|
21
|
+
AGENTS.md is read by the agents at the start of every session, so keep it short
|
|
22
|
+
and to the point.
|
|
23
|
+
|
|
24
|
+
## Layout
|
|
25
|
+
|
|
26
|
+
{layout}
|
|
27
|
+
|
|
28
|
+
## Conventions
|
|
29
|
+
|
|
30
|
+
- Keep the code small and readable; prefer the obvious solution.
|
|
31
|
+
- Every change comes with a test.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
MODES = "|".join(item.value for item in PermissionMode)
|
|
36
|
+
"""The modes of the permissions, as they are written."""
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _help(context: CommandContext, argument: str) -> None:
|
|
40
|
+
from coderagent.ui.commands import load_builtins
|
|
41
|
+
from coderagent.ui.custom_commands import load_custom_commands
|
|
42
|
+
|
|
43
|
+
load_builtins()
|
|
44
|
+
name = argument.lstrip("/").lower()
|
|
45
|
+
if name:
|
|
46
|
+
custom = next((item for item in load_custom_commands(context.cwd) if item.name.lower() == name), None)
|
|
47
|
+
if custom is not None:
|
|
48
|
+
context.say(f"/{custom.name}: {custom.description}" + _takes(custom.argument_hint))
|
|
49
|
+
return
|
|
50
|
+
command = next((item for item in COMMANDS if item.name == name), None)
|
|
51
|
+
if command is None:
|
|
52
|
+
context.say(f"No command '/{name}'.")
|
|
53
|
+
return
|
|
54
|
+
context.say(f"/{command.name}: {command.description}" + _takes(command.usage))
|
|
55
|
+
return
|
|
56
|
+
lines = [_line(command.name, command.description, command.usage) for command in COMMANDS]
|
|
57
|
+
custom = load_custom_commands(context.cwd)
|
|
58
|
+
if custom:
|
|
59
|
+
lines += ["", "The commands of this project:"]
|
|
60
|
+
lines += [_line(item.name, item.description, item.argument_hint) for item in custom]
|
|
61
|
+
context.say("\n".join(lines))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _takes(usage: str) -> str:
|
|
65
|
+
"""The line that says what a command takes."""
|
|
66
|
+
return f"\ntakes: {usage}" if usage else ""
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _line(name: str, description: str, usage: str) -> str:
|
|
70
|
+
line = f"/{name:<12} {description}".rstrip()
|
|
71
|
+
return f"{line} {usage}" if usage else line
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
MODEL_SETTINGS = ("name", "base", "key", "retries")
|
|
75
|
+
"""The settings of the model that `/model` can set."""
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _model(context: CommandContext, argument: str) -> None:
|
|
79
|
+
from coderagent.config import writer
|
|
80
|
+
from coderagent.models import check, settings
|
|
81
|
+
|
|
82
|
+
argument = argument.strip()
|
|
83
|
+
if not argument:
|
|
84
|
+
model = context.config.model
|
|
85
|
+
routing = ", ".join(f"{name} -> {target}" for name, target in model.routing.items())
|
|
86
|
+
context.say(
|
|
87
|
+
settings.view_text(settings.model_view_of(model), str(writer.user_config_path()))
|
|
88
|
+
+ f"\neffort: {model.reasoning_effort or 'the default of the model'}"
|
|
89
|
+
+ f"\nverbosity: {model.verbosity or 'the habit of the model'}"
|
|
90
|
+
+ (f"\nrouting: {routing}" if routing else "\n(no routing configured)")
|
|
91
|
+
)
|
|
92
|
+
return
|
|
93
|
+
if argument == "--test":
|
|
94
|
+
"""The try-out and the saving are two steps: the try-out writes nothing."""
|
|
95
|
+
report = check.test_connection(settings.effective_of(context.config.model, {}))
|
|
96
|
+
context.say(check.report_text(report))
|
|
97
|
+
return
|
|
98
|
+
if argument == "--save":
|
|
99
|
+
path = writer.write_user_model(_model_payload(context.config.model))
|
|
100
|
+
context.say(f"Wrote {path}")
|
|
101
|
+
return
|
|
102
|
+
if "=" in argument:
|
|
103
|
+
_set_model(context, argument)
|
|
104
|
+
return
|
|
105
|
+
context.config.model.model_name = argument
|
|
106
|
+
_rebuild_model(context)
|
|
107
|
+
context.say(f"model: {context.loop.model.backend.model_name}")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _model_payload(model) -> dict:
|
|
111
|
+
"""The settings of the session, as they are written down."""
|
|
112
|
+
payload = {
|
|
113
|
+
"model_name": model.model_name,
|
|
114
|
+
"api_base": model.api_base,
|
|
115
|
+
"max_retries": model.max_retries,
|
|
116
|
+
}
|
|
117
|
+
if model.api_key:
|
|
118
|
+
payload["api_key"] = model.api_key
|
|
119
|
+
return payload
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def _set_model(context: CommandContext, argument: str) -> None:
|
|
123
|
+
"""Set the settings of the session: `/model name=gpt-4o base=https://… key=sk-… retries=3`."""
|
|
124
|
+
from coderagent.models.settings import api_base_of
|
|
125
|
+
|
|
126
|
+
values = {}
|
|
127
|
+
for part in argument.split():
|
|
128
|
+
key, _, value = part.partition("=")
|
|
129
|
+
values[key.strip()] = value.strip()
|
|
130
|
+
unknown = [key for key in values if key not in MODEL_SETTINGS]
|
|
131
|
+
if unknown:
|
|
132
|
+
context.say(f"Unknown setting '{unknown[0]}'. Use one of: {', '.join(MODEL_SETTINGS)}.")
|
|
133
|
+
return
|
|
134
|
+
if "retries" in values and not values["retries"].isdigit():
|
|
135
|
+
context.say(f"'{values['retries']}' is not a number of retries.")
|
|
136
|
+
return
|
|
137
|
+
model = context.config.model
|
|
138
|
+
if "name" in values:
|
|
139
|
+
model.model_name = values["name"]
|
|
140
|
+
if "base" in values:
|
|
141
|
+
model.api_base = api_base_of(values["base"])
|
|
142
|
+
if "key" in values:
|
|
143
|
+
model.api_key = values["key"]
|
|
144
|
+
if "retries" in values:
|
|
145
|
+
model.max_retries = int(values["retries"])
|
|
146
|
+
_rebuild_model(context)
|
|
147
|
+
context.say(f"model: {context.loop.model.backend.model_name}")
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def _rebuild_model(context: CommandContext) -> None:
|
|
151
|
+
"""Build the backend of the session again: the name, the address or the key changed."""
|
|
152
|
+
model = context.config.model
|
|
153
|
+
backend = LiteLLMBackend(
|
|
154
|
+
model.model_name,
|
|
155
|
+
model_kwargs=model.model_kwargs,
|
|
156
|
+
litellm_config=model.litellm_config,
|
|
157
|
+
reasoning_effort=model.reasoning_effort,
|
|
158
|
+
max_retries=model.max_retries,
|
|
159
|
+
api_key=model.api_key,
|
|
160
|
+
api_base=model.api_base,
|
|
161
|
+
)
|
|
162
|
+
context.loop.model.backend = backend
|
|
163
|
+
if context.loop.router is not None:
|
|
164
|
+
context.loop.router.override = model.model_name
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def _mode(context: CommandContext, argument: str) -> None:
|
|
168
|
+
if not argument:
|
|
169
|
+
context.say(f"mode: {context.policy.mode.value}\nmodes: {MODES}")
|
|
170
|
+
return
|
|
171
|
+
name, _, flags = argument.partition(" ")
|
|
172
|
+
try:
|
|
173
|
+
mode = PermissionMode(name)
|
|
174
|
+
except ValueError:
|
|
175
|
+
context.say(f"Unknown mode '{name}'. Use one of: {', '.join(item.value for item in PermissionMode)}.")
|
|
176
|
+
return
|
|
177
|
+
if mode is PermissionMode.BYPASS and "--yes" not in flags.split():
|
|
178
|
+
"""Bypass takes the guards off, so it is not switched on by a slip of the fingers."""
|
|
179
|
+
context.say(
|
|
180
|
+
"Bypass mode asks nothing: every tool call goes through, even the ones that destroy "
|
|
181
|
+
"something. Run /mode bypass --yes to confirm."
|
|
182
|
+
)
|
|
183
|
+
return
|
|
184
|
+
context.policy.mode = mode
|
|
185
|
+
context.session.permission_mode = mode.value
|
|
186
|
+
context.say(f"mode: {mode.value}")
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def _plan(context: CommandContext, argument: str) -> None:
|
|
190
|
+
context.policy.mode = PermissionMode.PLAN
|
|
191
|
+
context.session.permission_mode = PermissionMode.PLAN.value
|
|
192
|
+
context.say("mode: plan (read only, the agent will not change anything)")
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def _compact(context: CommandContext, argument: str) -> None:
|
|
196
|
+
before = context.loop.context.estimated_tokens()
|
|
197
|
+
if not compact(context.loop.context):
|
|
198
|
+
context.say("Nothing to compact yet.")
|
|
199
|
+
return
|
|
200
|
+
context.say(f"Compacted the context: {before} -> {context.loop.context.estimated_tokens()} tokens.")
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def _recap(context: CommandContext, argument: str) -> None:
|
|
204
|
+
"""Summarize the conversation without changing it."""
|
|
205
|
+
summary = context.loop.context.recap()
|
|
206
|
+
if summary is None:
|
|
207
|
+
context.say("Nothing to summarize yet.")
|
|
208
|
+
return
|
|
209
|
+
context.say(summary.to_text())
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def _side(context: CommandContext, argument: str) -> None:
|
|
213
|
+
"""Ask a question that goes aside: the main conversation is not touched."""
|
|
214
|
+
if not argument:
|
|
215
|
+
context.say("What do you want to ask? Try /side <question>.")
|
|
216
|
+
return
|
|
217
|
+
if context.submit_side is None:
|
|
218
|
+
context.say("This interface cannot run a turn, so it cannot go aside.")
|
|
219
|
+
return
|
|
220
|
+
side = context.store.side(context.session.id)
|
|
221
|
+
context.say(f"A side conversation ({side.id}). This one stays as it is.")
|
|
222
|
+
context.submit_side(argument, side)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def _clear(context: CommandContext, argument: str) -> None:
|
|
226
|
+
from coderagent.run import settle
|
|
227
|
+
|
|
228
|
+
settle(context.loop, context.config, context.cwd)
|
|
229
|
+
session = context.store.create(context.cwd)
|
|
230
|
+
context.loop.switch_to(session)
|
|
231
|
+
context.session = session
|
|
232
|
+
context.say(f"New session: {session.id}")
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def _resume(context: CommandContext, argument: str) -> None:
|
|
236
|
+
if not argument:
|
|
237
|
+
sessions = list_sessions(context.store, context.cwd)
|
|
238
|
+
context.say(
|
|
239
|
+
"\n".join(f"{item.summary or item.id} {item.turn_count:>3} turns {item.cwd}" for item in sessions)
|
|
240
|
+
or "No sessions yet."
|
|
241
|
+
)
|
|
242
|
+
return
|
|
243
|
+
session = resume_session(context.store, argument)
|
|
244
|
+
context.loop.switch_to(session)
|
|
245
|
+
context.session = session
|
|
246
|
+
context.say(f"Resumed {session.id}")
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def _fork(context: CommandContext, argument: str) -> None:
|
|
250
|
+
session_id = argument or context.session.id
|
|
251
|
+
session = fork_session(context.store, session_id)
|
|
252
|
+
context.loop.switch_to(session)
|
|
253
|
+
context.session = session
|
|
254
|
+
context.say(f"Forked {session_id} into {session.id}")
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def _rename(context: CommandContext, argument: str) -> None:
|
|
258
|
+
"""Give the session a name."""
|
|
259
|
+
if not argument:
|
|
260
|
+
context.say(f"name: {context.session.name or '(none)'}")
|
|
261
|
+
return
|
|
262
|
+
if not context.store.persist:
|
|
263
|
+
context.say("The history is not saved, so the session has no name.")
|
|
264
|
+
return
|
|
265
|
+
if not context.store.rename(context.session.id, argument):
|
|
266
|
+
context.say("The session is not on the disk, so it has no name.")
|
|
267
|
+
return
|
|
268
|
+
context.session.name = argument
|
|
269
|
+
context.say(f"name: {argument}")
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def _archive(context: CommandContext, argument: str) -> None:
|
|
273
|
+
"""Put a session away, or take it out again."""
|
|
274
|
+
session_id = argument or context.session.id
|
|
275
|
+
session = context.store.rebuild(session_id)
|
|
276
|
+
if not context.store.archive(session_id, not session.archived):
|
|
277
|
+
context.say(f"No session '{session_id}'.")
|
|
278
|
+
return
|
|
279
|
+
context.say(f"{'Took out' if session.archived else 'Archived'} {session_id}.")
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def _delete(context: CommandContext, argument: str) -> None:
|
|
283
|
+
"""Remove a session and everything in it."""
|
|
284
|
+
if not argument:
|
|
285
|
+
context.say("Which session? Run /delete <session-id>.")
|
|
286
|
+
return
|
|
287
|
+
if argument == context.session.id:
|
|
288
|
+
context.say("You are in this session. Start a new one (/clear) before you delete it.")
|
|
289
|
+
return
|
|
290
|
+
if not context.store.delete(argument):
|
|
291
|
+
context.say(f"No session '{argument}'.")
|
|
292
|
+
return
|
|
293
|
+
context.say(f"Deleted {argument}.")
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
def _open(context: CommandContext, argument: str) -> None:
|
|
297
|
+
"""Open a file in the editor of the user."""
|
|
298
|
+
from coderagent.ui.open_file import open_path
|
|
299
|
+
|
|
300
|
+
if not argument:
|
|
301
|
+
context.say("Which file? Try /open <path>.")
|
|
302
|
+
return
|
|
303
|
+
path = Path(argument).expanduser()
|
|
304
|
+
if not path.is_absolute():
|
|
305
|
+
path = context.cwd / path
|
|
306
|
+
if not context.policy.within_bounds(str(path)):
|
|
307
|
+
context.say(f"'{path}' is outside the working directory {context.cwd}.")
|
|
308
|
+
return
|
|
309
|
+
context.say(open_path(argument, context.config.ui.file_opener, context.cwd))
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def _rewind(context: CommandContext, argument: str) -> None:
|
|
313
|
+
if context.checkpoints is None:
|
|
314
|
+
context.say("Checkpoints are not available.")
|
|
315
|
+
return
|
|
316
|
+
if not argument:
|
|
317
|
+
checkpoints = list_checkpoints(context.checkpoints, context.session.id)
|
|
318
|
+
context.say(
|
|
319
|
+
"\n".join(f"{item.id} turn {item.turn} {sorted(item.payload)}" for item in checkpoints)
|
|
320
|
+
or "No checkpoints yet."
|
|
321
|
+
)
|
|
322
|
+
return
|
|
323
|
+
changed, skipped = rewind(context.loop.context, context.checkpoints, argument, context.cwd)
|
|
324
|
+
context.say(f"Restored {len(changed)} file(s): {', '.join(changed) or 'nothing changed'}")
|
|
325
|
+
if skipped:
|
|
326
|
+
context.say(f"Not restored, they hold a secret: {', '.join(skipped)}")
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
def _diff(context: CommandContext, argument: str) -> None:
|
|
330
|
+
result = subprocess.run(["git", "diff", "--stat"], cwd=context.cwd, capture_output=True, text=True, check=False)
|
|
331
|
+
if result.returncode != 0:
|
|
332
|
+
context.say(f"Not a git repository: {context.cwd}")
|
|
333
|
+
return
|
|
334
|
+
context.say(result.stdout.strip() or "No changes in the working tree.")
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
def _review(context: CommandContext, argument: str) -> None:
|
|
338
|
+
"""Review the changes: the diff goes into the prompt of a turn."""
|
|
339
|
+
from coderagent.ui.commands.review import changes, prompt
|
|
340
|
+
|
|
341
|
+
if context.submit is None:
|
|
342
|
+
context.say("This interface cannot run a turn, so it cannot review.")
|
|
343
|
+
return
|
|
344
|
+
diff, untracked, error = changes(context.cwd, argument.strip())
|
|
345
|
+
if error:
|
|
346
|
+
context.say(error)
|
|
347
|
+
return
|
|
348
|
+
if not diff and not untracked:
|
|
349
|
+
context.say("No changes to review.")
|
|
350
|
+
return
|
|
351
|
+
context.submit(prompt(diff, untracked, argument.strip()), "review")
|
|
352
|
+
"""The review may run on a model of its own: `model.review_model`."""
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
def _image(context: CommandContext, argument: str) -> None:
|
|
356
|
+
"""Send an image to the model, with the text that goes with it."""
|
|
357
|
+
from coderagent.core.content import data_url, parts
|
|
358
|
+
|
|
359
|
+
if context.submit is None:
|
|
360
|
+
context.say("This interface cannot run a turn, so it cannot send an image.")
|
|
361
|
+
return
|
|
362
|
+
path_text, _, text = argument.strip().partition(" ")
|
|
363
|
+
if not path_text:
|
|
364
|
+
context.say("Which image? Try /image <path> [what to do with it].")
|
|
365
|
+
return
|
|
366
|
+
path = Path(path_text).expanduser()
|
|
367
|
+
if not path.is_absolute():
|
|
368
|
+
path = context.cwd / path
|
|
369
|
+
try:
|
|
370
|
+
url = data_url(path)
|
|
371
|
+
except (OSError, ValueError) as e:
|
|
372
|
+
context.say(str(e))
|
|
373
|
+
return
|
|
374
|
+
context.submit(parts(text.strip(), [url]))
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
def _mention(context: CommandContext, argument: str) -> None:
|
|
378
|
+
"""Send a file to the model, with the text that goes with it."""
|
|
379
|
+
if context.submit is None:
|
|
380
|
+
context.say("This interface cannot run a turn, so it cannot send a file.")
|
|
381
|
+
return
|
|
382
|
+
path_text, _, text = argument.strip().partition(" ")
|
|
383
|
+
if not path_text:
|
|
384
|
+
context.say("Which file? Try /mention <path> [what to do with it].")
|
|
385
|
+
return
|
|
386
|
+
mention = f"@{path_text}"
|
|
387
|
+
context.submit(f"{text.strip()}\n\n{mention}" if text.strip() else mention)
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def _init(context: CommandContext, argument: str) -> None:
|
|
391
|
+
target = context.cwd / "AGENTS.md"
|
|
392
|
+
if target.exists():
|
|
393
|
+
context.say(f"{target} already exists.")
|
|
394
|
+
return
|
|
395
|
+
entries = sorted(path.name + ("/" if path.is_dir() else "") for path in context.cwd.iterdir())
|
|
396
|
+
target.write_text(
|
|
397
|
+
AGENTS_TEMPLATE.format(
|
|
398
|
+
name=context.cwd.name,
|
|
399
|
+
description=f"Instructions for the agents working on {context.cwd.name}.",
|
|
400
|
+
layout="\n".join(f"- {entry}" for entry in entries[:40]),
|
|
401
|
+
),
|
|
402
|
+
encoding="utf-8",
|
|
403
|
+
)
|
|
404
|
+
context.say(f"Wrote {target}")
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
def _cost(context: CommandContext, argument: str) -> None:
|
|
408
|
+
from coderagent.core.telemetry import collect, money
|
|
409
|
+
|
|
410
|
+
loop = context.loop
|
|
411
|
+
metrics = collect(context.store.events(context.session.id))
|
|
412
|
+
priced = metrics.priced and loop.model.priced
|
|
413
|
+
note = "" if priced else "\nthis model has no price: the money is unknown, the budget is agent.token_limit"
|
|
414
|
+
context.say(
|
|
415
|
+
f"model: {context.config.model.model_name}\n"
|
|
416
|
+
f"calls: {metrics.model_calls}\n"
|
|
417
|
+
f"tokens in the context: {loop.context.estimated_tokens()}\n"
|
|
418
|
+
f"tokens spent: {loop.session.total_tokens}\n"
|
|
419
|
+
f"cost so far: {money(loop.session.total_cost, priced)}\n" + metrics.report() + note
|
|
420
|
+
)
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
def _todos(context: CommandContext, argument: str) -> None:
|
|
424
|
+
todos = context.session.metadata.get("todos") or []
|
|
425
|
+
if not todos:
|
|
426
|
+
context.say("No todos.")
|
|
427
|
+
return
|
|
428
|
+
context.say(
|
|
429
|
+
"\n".join(f"[{'x' if todo.get('status') == 'completed' else ' '}] {todo.get('content', '')}" for todo in todos)
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
def _mcp(context: CommandContext, argument: str) -> None:
|
|
434
|
+
servers = context.config.mcp.servers
|
|
435
|
+
if not servers:
|
|
436
|
+
context.say("No MCP servers configured.")
|
|
437
|
+
return
|
|
438
|
+
status = context.mcp.status() if context.mcp is not None else {}
|
|
439
|
+
context.say(
|
|
440
|
+
"\n".join(
|
|
441
|
+
f"{server.name:<16} {'disabled' if not server.enabled else status.get(server.name, 'not connected')}"
|
|
442
|
+
for server in servers
|
|
443
|
+
)
|
|
444
|
+
)
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
def _trust(context: CommandContext, argument: str) -> None:
|
|
448
|
+
"""Show the code of the project that waits for a decision, and trust it."""
|
|
449
|
+
from coderagent.config.loader import pending_code
|
|
450
|
+
from coderagent.core.trust import TRUSTED, remember
|
|
451
|
+
|
|
452
|
+
pending = pending_code(context.cwd, context.loop.context.user_home)
|
|
453
|
+
if not pending:
|
|
454
|
+
context.say("Nothing of the project waits for a decision.")
|
|
455
|
+
return
|
|
456
|
+
items = list(pending.items())
|
|
457
|
+
if not argument:
|
|
458
|
+
context.say(
|
|
459
|
+
"\n".join(f"{index} {key:<16} {command}" for index, (key, command) in enumerate(items, start=1))
|
|
460
|
+
+ "\nRun /trust <number> to trust one of them. It is used the next time the agent starts."
|
|
461
|
+
)
|
|
462
|
+
return
|
|
463
|
+
if not argument.isdigit() or not 1 <= int(argument) <= len(items):
|
|
464
|
+
context.say(f"'{argument}' is not one of the numbers. Run /trust to see what waits.")
|
|
465
|
+
return
|
|
466
|
+
key, command = items[int(argument) - 1]
|
|
467
|
+
remember(context.cwd, key, TRUSTED, command, context.loop.context.user_home)
|
|
468
|
+
context.say(f"Trusted '{key}'. It is used the next time the agent starts.")
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
def _permissions(context: CommandContext, argument: str) -> None:
|
|
472
|
+
rules = context.policy.rules
|
|
473
|
+
lines = [f"mode: {context.policy.mode.value}", f"network: {context.policy.network}"]
|
|
474
|
+
lines += [
|
|
475
|
+
f"{rule.tool} {rule.pattern} -> {rule.decision}" + (f" ({rule.reason})" if rule.reason else "")
|
|
476
|
+
for rule in rules
|
|
477
|
+
]
|
|
478
|
+
context.say("\n".join(lines))
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
def _hooks(context: CommandContext, argument: str) -> None:
|
|
482
|
+
events = context.config.hooks.events
|
|
483
|
+
if not events:
|
|
484
|
+
context.say("No hooks configured.")
|
|
485
|
+
return
|
|
486
|
+
lines = []
|
|
487
|
+
for name, matchers in events.items():
|
|
488
|
+
for matcher in matchers:
|
|
489
|
+
for hook in matcher.hooks:
|
|
490
|
+
lines.append(f"{name} [{matcher.matcher or '*'}] -> {hook.command}")
|
|
491
|
+
context.say("\n".join(lines))
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
def _agents(context: CommandContext, argument: str) -> None:
|
|
495
|
+
specs = context.loop.subagents
|
|
496
|
+
if not specs:
|
|
497
|
+
context.say("No sub agents.")
|
|
498
|
+
return
|
|
499
|
+
ceiling = context.config.agent.subagent_max_turns
|
|
500
|
+
lines = []
|
|
501
|
+
for spec in specs.values():
|
|
502
|
+
turns = effective_turns(spec, ceiling)
|
|
503
|
+
limit = f"{turns} model calls" if turns else "no limit"
|
|
504
|
+
lines.append(
|
|
505
|
+
f"{spec.name:<16} {spec.model_purpose:<6} {', '.join(spec.tools)} ({limit})\n{'':<16} {spec.description}"
|
|
506
|
+
)
|
|
507
|
+
if ceiling:
|
|
508
|
+
lines.append(f"The configuration holds every sub agent to {ceiling} model calls.")
|
|
509
|
+
context.say("\n".join(lines))
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
def _skills(context: CommandContext, argument: str) -> None:
|
|
513
|
+
from coderagent.skills import load_skills
|
|
514
|
+
from coderagent.skills.errors import SkillError
|
|
515
|
+
from coderagent.skills.install import read_lock
|
|
516
|
+
|
|
517
|
+
skills = load_skills(context.cwd, context.loop.context.user_home)
|
|
518
|
+
if not skills:
|
|
519
|
+
context.say("No skills.")
|
|
520
|
+
return
|
|
521
|
+
try:
|
|
522
|
+
lock = read_lock(context.loop.context.user_home)
|
|
523
|
+
except SkillError:
|
|
524
|
+
lock = {}
|
|
525
|
+
lines = []
|
|
526
|
+
for skill in skills.values():
|
|
527
|
+
line = f"{skill.name:<16} {skill.description}\n{'':<16} {skill.directory}"
|
|
528
|
+
installed = lock.get(skill.name)
|
|
529
|
+
if installed is not None:
|
|
530
|
+
line += f"\n{'':<16} from {installed.source.describe()} (sha256 {installed.sha256[:12]})"
|
|
531
|
+
lines.append(line)
|
|
532
|
+
context.say("\n".join(lines))
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
def _plugins(context: CommandContext, argument: str) -> None:
|
|
536
|
+
from coderagent.extensions.plugins import TRUSTED, discover, remember, trust_decision
|
|
537
|
+
|
|
538
|
+
plugins = discover(context.cwd, context.loop.context.user_home)
|
|
539
|
+
if argument.startswith("trust "):
|
|
540
|
+
name = argument[len("trust ") :].strip()
|
|
541
|
+
plugin = next((item for item in plugins if item.name == name), None)
|
|
542
|
+
if plugin is None:
|
|
543
|
+
context.say(f"No plugin '{name}'.")
|
|
544
|
+
return
|
|
545
|
+
remember(name, TRUSTED, context.loop.context.user_home)
|
|
546
|
+
context.say(f"Trusted '{name}'. It is loaded the next time the agent starts.")
|
|
547
|
+
return
|
|
548
|
+
if not plugins:
|
|
549
|
+
context.say("No plugins.")
|
|
550
|
+
return
|
|
551
|
+
context.say(
|
|
552
|
+
"\n".join(
|
|
553
|
+
f"{plugin.name:<16} {trust_decision(plugin.name, context.loop.context.user_home) or 'not trusted'}"
|
|
554
|
+
f" {plugin.source}"
|
|
555
|
+
for plugin in plugins
|
|
556
|
+
)
|
|
557
|
+
)
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
def _memory(context: CommandContext, argument: str) -> None:
|
|
561
|
+
from coderagent.extensions.reflect import (
|
|
562
|
+
append_user_preferences,
|
|
563
|
+
clear_pending,
|
|
564
|
+
forget,
|
|
565
|
+
pending_path,
|
|
566
|
+
project_memory_path,
|
|
567
|
+
read_pending,
|
|
568
|
+
user_memory_path,
|
|
569
|
+
)
|
|
570
|
+
|
|
571
|
+
cwd = context.cwd
|
|
572
|
+
project = project_memory_path(cwd, context.config.memory)
|
|
573
|
+
pending = read_pending(cwd)
|
|
574
|
+
if argument == "confirm":
|
|
575
|
+
preferences = clear_pending(cwd)
|
|
576
|
+
written = append_user_preferences(user_memory_path(context.config.memory), preferences)
|
|
577
|
+
context.say(f"Wrote {len(written.written)} preference(s) to {user_memory_path(context.config.memory)}.")
|
|
578
|
+
return
|
|
579
|
+
if argument.startswith("forget "):
|
|
580
|
+
text = argument[len("forget ") :].strip()
|
|
581
|
+
removed = forget(project, text) or forget(pending_path(cwd), text)
|
|
582
|
+
context.say("Removed." if removed else "Nothing like that in the memory.")
|
|
583
|
+
return
|
|
584
|
+
lines = ["project memory:"]
|
|
585
|
+
lines += [f" {line}" for line in _lines_of(project)]
|
|
586
|
+
lines.append("pending preferences:")
|
|
587
|
+
lines += [f" {item}" for item in pending] if pending else [" none"]
|
|
588
|
+
lines.append("user memory:")
|
|
589
|
+
lines += [f" {line}" for line in _lines_of(user_memory_path(context.config.memory))]
|
|
590
|
+
context.say("\n".join(lines))
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
def _lines_of(path: Path) -> list[str]:
|
|
594
|
+
if not path.exists():
|
|
595
|
+
return []
|
|
596
|
+
return [line for line in path.read_text(encoding="utf-8").splitlines() if line.strip()]
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
def _status(context: CommandContext, argument: str) -> None:
|
|
600
|
+
from coderagent.core.telemetry import money
|
|
601
|
+
|
|
602
|
+
session = context.session
|
|
603
|
+
context.say(
|
|
604
|
+
f"session: {session.id}\n"
|
|
605
|
+
f"name: {session.name or '(none)'}\n"
|
|
606
|
+
f"state: {session.state.value}\n"
|
|
607
|
+
f"turns: {session.turn_count}\n"
|
|
608
|
+
f"cost: {money(session.total_cost, context.loop.model.priced)}\n"
|
|
609
|
+
f"cwd: {session.cwd}\n"
|
|
610
|
+
f"mode: {context.policy.mode.value}\n"
|
|
611
|
+
f"sandbox: {context.config.sandbox.type} ({context.config.sandbox.mode})"
|
|
612
|
+
)
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
def _sandbox(context: CommandContext, argument: str) -> None:
|
|
616
|
+
"""Show where the commands of the agent run."""
|
|
617
|
+
from coderagent.core.sandbox import describe
|
|
618
|
+
|
|
619
|
+
sandbox = context.config.sandbox
|
|
620
|
+
lines = [f"type: {sandbox.type}", f"mode: {sandbox.mode}"]
|
|
621
|
+
lines += [f"{key}: {value}" for key, value in (sandbox.model_extra or {}).items()]
|
|
622
|
+
lines.append(f"environment: {describe(context.loop.sandbox, sandbox.type, sandbox.mode)}")
|
|
623
|
+
context.say("\n".join(lines))
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
def _export(context: CommandContext, argument: str) -> None:
|
|
627
|
+
from coderagent.core.content import describe_message
|
|
628
|
+
|
|
629
|
+
target = Path(argument) if argument else context.cwd / "conversation.md"
|
|
630
|
+
lines = ["# Conversation", ""]
|
|
631
|
+
for message in context.loop.context.history.messages:
|
|
632
|
+
role = message.get("role", "")
|
|
633
|
+
content = message.get("content")
|
|
634
|
+
if not isinstance(content, str):
|
|
635
|
+
"""A message with an image is named, not dumped: the file stays readable."""
|
|
636
|
+
content = describe_message(content)
|
|
637
|
+
lines += [f"## {role}", "", content, ""]
|
|
638
|
+
target.write_text("\n".join(lines), encoding="utf-8")
|
|
639
|
+
context.say(f"Wrote {target}")
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
def _context(context: CommandContext, argument: str) -> None:
|
|
643
|
+
engine: ContextEngine = context.loop.context
|
|
644
|
+
context.say(
|
|
645
|
+
f"messages: {len(engine.history.messages)}\n"
|
|
646
|
+
f"tokens: {engine.estimated_tokens()}\n"
|
|
647
|
+
f"summary: {'yes' if engine.summary else 'no'}"
|
|
648
|
+
)
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
def _exit(context: CommandContext, argument: str) -> None:
|
|
652
|
+
"""Leave the interface."""
|
|
653
|
+
if context.quit is None:
|
|
654
|
+
context.say("The server keeps running. Stop it with ctrl+c where it was started.")
|
|
655
|
+
return
|
|
656
|
+
context.quit()
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
register(Command(name="help", description="List the commands", handler=_help, usage="[name]"))
|
|
660
|
+
register(
|
|
661
|
+
Command(
|
|
662
|
+
name="model",
|
|
663
|
+
description="Show or switch the model",
|
|
664
|
+
handler=_model,
|
|
665
|
+
aliases=["m"],
|
|
666
|
+
usage="[model-name|name=… base=… key=… retries=…|--test|--save]",
|
|
667
|
+
)
|
|
668
|
+
)
|
|
669
|
+
register(Command(name="mode", description="Show or switch the permission mode", handler=_mode, usage=f"[{MODES}]"))
|
|
670
|
+
register(Command(name="plan", description="Switch to plan mode, where nothing is changed", handler=_plan))
|
|
671
|
+
register(Command(name="compact", description="Compact the conversation now", handler=_compact))
|
|
672
|
+
register(Command(name="recap", description="Summarize the conversation without changing it", handler=_recap))
|
|
673
|
+
register(
|
|
674
|
+
Command(
|
|
675
|
+
name="side",
|
|
676
|
+
description="Ask a question that goes aside, in a conversation of its own",
|
|
677
|
+
handler=_side,
|
|
678
|
+
usage="<question>",
|
|
679
|
+
)
|
|
680
|
+
)
|
|
681
|
+
register(Command(name="clear", description="Start a new session", handler=_clear))
|
|
682
|
+
register(Command(name="resume", description="List the sessions or resume one", handler=_resume, usage="[session-id]"))
|
|
683
|
+
register(Command(name="fork", description="Copy the session into a new one", handler=_fork, usage="[session-id]"))
|
|
684
|
+
register(Command(name="rename", description="Give the session a name", handler=_rename, usage="[name]"))
|
|
685
|
+
register(
|
|
686
|
+
Command(
|
|
687
|
+
name="archive",
|
|
688
|
+
description="Put a session away, or take it out again",
|
|
689
|
+
handler=_archive,
|
|
690
|
+
usage="[session-id]",
|
|
691
|
+
)
|
|
692
|
+
)
|
|
693
|
+
register(
|
|
694
|
+
Command(
|
|
695
|
+
name="delete",
|
|
696
|
+
description="Remove a session and everything in it",
|
|
697
|
+
handler=_delete,
|
|
698
|
+
usage="<session-id>",
|
|
699
|
+
)
|
|
700
|
+
)
|
|
701
|
+
register(
|
|
702
|
+
Command(
|
|
703
|
+
name="open",
|
|
704
|
+
description="Open a file in the editor of the user",
|
|
705
|
+
handler=_open,
|
|
706
|
+
usage="<path>",
|
|
707
|
+
)
|
|
708
|
+
)
|
|
709
|
+
register(
|
|
710
|
+
Command(
|
|
711
|
+
name="rewind",
|
|
712
|
+
description="Show the checkpoints or roll back to one",
|
|
713
|
+
handler=_rewind,
|
|
714
|
+
usage="[checkpoint-id]",
|
|
715
|
+
)
|
|
716
|
+
)
|
|
717
|
+
register(Command(name="diff", description="Show the changes in the working tree", handler=_diff))
|
|
718
|
+
register(
|
|
719
|
+
Command(
|
|
720
|
+
name="image",
|
|
721
|
+
description="Send an image to the agent",
|
|
722
|
+
handler=_image,
|
|
723
|
+
usage="<path> [what to do with it]",
|
|
724
|
+
)
|
|
725
|
+
)
|
|
726
|
+
register(
|
|
727
|
+
Command(
|
|
728
|
+
name="review",
|
|
729
|
+
description="Review the changes, or the changes of a range",
|
|
730
|
+
handler=_review,
|
|
731
|
+
usage="[main..HEAD]",
|
|
732
|
+
)
|
|
733
|
+
)
|
|
734
|
+
register(
|
|
735
|
+
Command(
|
|
736
|
+
name="mention",
|
|
737
|
+
description="Send a file to the agent, with its content",
|
|
738
|
+
handler=_mention,
|
|
739
|
+
usage="<path> [what to do with it]",
|
|
740
|
+
)
|
|
741
|
+
)
|
|
742
|
+
register(Command(name="init", description="Write an AGENTS.md for this project", handler=_init))
|
|
743
|
+
register(Command(name="cost", description="Show the tokens and the money spent", handler=_cost))
|
|
744
|
+
register(Command(name="todos", description="Show the task list", handler=_todos))
|
|
745
|
+
register(Command(name="mcp", description="Show the MCP servers", handler=_mcp))
|
|
746
|
+
register(
|
|
747
|
+
Command(
|
|
748
|
+
name="trust",
|
|
749
|
+
description="Show the code of the project that waits for a decision",
|
|
750
|
+
handler=_trust,
|
|
751
|
+
usage="[number]",
|
|
752
|
+
)
|
|
753
|
+
)
|
|
754
|
+
register(Command(name="permissions", description="Show the rules that are in effect", handler=_permissions))
|
|
755
|
+
register(Command(name="hooks", description="Show the hooks that are loaded", handler=_hooks))
|
|
756
|
+
register(Command(name="agents", description="Show the sub agents that are available", handler=_agents))
|
|
757
|
+
register(Command(name="skills", description="Show the skills that are available", handler=_skills))
|
|
758
|
+
register(
|
|
759
|
+
Command(
|
|
760
|
+
name="plugins",
|
|
761
|
+
description="Show the plugins, or trust one of them",
|
|
762
|
+
handler=_plugins,
|
|
763
|
+
usage="[trust <name>]",
|
|
764
|
+
)
|
|
765
|
+
)
|
|
766
|
+
register(
|
|
767
|
+
Command(
|
|
768
|
+
name="memory",
|
|
769
|
+
description="Show the memory of the project and of the user",
|
|
770
|
+
handler=_memory,
|
|
771
|
+
usage="[confirm|forget <text>]",
|
|
772
|
+
)
|
|
773
|
+
)
|
|
774
|
+
register(Command(name="status", description="Show the state of the session", handler=_status))
|
|
775
|
+
register(Command(name="sandbox", description="Show where the commands run", handler=_sandbox))
|
|
776
|
+
register(Command(name="export", description="Write the conversation to a file", handler=_export, usage="[path]"))
|
|
777
|
+
register(Command(name="context", description="Show the size of the context", handler=_context))
|
|
778
|
+
register(Command(name="exit", description="Leave the interface", handler=_exit, aliases=["quit"]))
|