codee-agent 0.8.1__tar.gz → 0.9.1__tar.gz
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.
- {codee_agent-0.8.1 → codee_agent-0.9.1}/PKG-INFO +1 -1
- {codee_agent-0.8.1 → codee_agent-0.9.1}/pyproject.toml +1 -1
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/admin.py +204 -16
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/admin_service.py +38 -2
- codee_agent-0.9.1/src/codee/lib/test_trigger_email_skills.py +140 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/trigger_email_skills.py +100 -19
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/test_admin.py +96 -1
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/test_admin_service.py +82 -4
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_abstract/acp.py +2 -2
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_abstract/provider.py +52 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_abstract/test.py +66 -2
- codee_agent-0.9.1/src/codee_agent_abstract/transcript.py +77 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_claude_code/credentials.py +7 -3
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_claude_code/provider.py +67 -1
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_claude_code/test.py +78 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_codex/provider.py +77 -2
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_codex/test.py +51 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_github_copilot/provider.py +81 -3
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_github_copilot/test.py +105 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_opencode/provider.py +3 -2
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_opencode/test.py +13 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_tasks_jira/provider.py +30 -19
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_tasks_jira/test.py +31 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/LICENSE +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/README.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/.gitignore +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/__init__.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/admin_api.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/admin_cli.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/agent_cli.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/coding_agents.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/executor.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/init_cli.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/__init__.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/claude_key_rotation.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/cron_describe.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/mcp_config.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/runs_db.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/runtime_control.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/test_claude_key_rotation.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/test_mcp_config.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/test_runs_db.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/test_trigger_cron_skills.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/test_trigger_issue_skills.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/trigger_aws_sqs_skills.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/trigger_cron_skills.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/lib/trigger_issue_skills.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/mail_server.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/setup_wizard.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/start_cli.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/tasks_providers.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/AGENTS.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/CLAUDE.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/skills/aws-sqs-alarm-response/SKILL.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/skills/cron-research-5xx-errors/SKILL.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/skills/story-code-reviewer/SKILL.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/skills/story-developer/SKILL.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/skills/story-planner/SKILL.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/skills/story-planner/assets/readme-template.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/skills/story-qa/SKILL.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/skills/story-security-reviewer/SKILL.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/skills/task-code-reviewer/SKILL.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/skills/task-developer/SKILL.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/skills/task-qa/SKILL.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/templates/skills/task-security-reviewer/SKILL.md +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/test_admin_api.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/test_admin_cli.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/test_agent_cli.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/test_coding_agents.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/test_executor.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/test_init_cli.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/test_memory_index.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/test_setup_wizard.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/test_start_cli.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee/workflow_graph.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_admin/__init__.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_admin/codee_admin.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_abstract/__init__.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_claude_code/__init__.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_claude_code/account.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_claude_code/oauth.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_claude_code/usage.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_codex/__init__.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_github_copilot/__init__.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_agent_opencode/__init__.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_database/__init__.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_database/claude_code_accounts.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_database/database.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_database/oauth_tokens.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_main_context/__init__.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_main_context/context.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_main_context/logging.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_main_context/test_context.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_main_context/test_logging.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_tasks_abstract/__init__.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_tasks_abstract/provider.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_tasks_azure_devops/__init__.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_tasks_azure_devops/oauth.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_tasks_azure_devops/provider.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_tasks_azure_devops/test.py +0 -0
- {codee_agent-0.8.1 → codee_agent-0.9.1}/src/codee_tasks_jira/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codee-agent
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.1
|
|
4
4
|
Summary: A virtual co-worker that picks up Jira and Azure DevOps tasks and solves them with coding agents.
|
|
5
5
|
Keywords: ai,agent,jira,azure-devops,claude-code,github-copilot,codex,opencode,automation
|
|
6
6
|
Author: Denis Kibalko
|
|
@@ -22,6 +22,8 @@ RUNS_PAGE_SIZE = 20
|
|
|
22
22
|
# The agents a skill can be run by, as the editor's picker lists them. Built
|
|
23
23
|
# once: which agents exist is decided by this build, not by the settings.
|
|
24
24
|
DEFAULT_AGENT_OPTION = "Default agent"
|
|
25
|
+
# How many of a running session's last steps the Peep dialog shows.
|
|
26
|
+
PEEP_STEPS = 10
|
|
25
27
|
# The effort picker's value for "no effort set": a select item can't be empty.
|
|
26
28
|
EFFORT_DEFAULT = "__default__"
|
|
27
29
|
AGENT_NAMES = {agent["code"]: agent["name"] for agent in SERVICE.list_agents()}
|
|
@@ -60,6 +62,14 @@ def _model_option(models: list["ModelOption"],
|
|
|
60
62
|
return None
|
|
61
63
|
|
|
62
64
|
|
|
65
|
+
def _effort_options(model: "ModelOption | None", effort: str) -> list[str]:
|
|
66
|
+
"""The levels ``model`` takes, plus ``effort`` when the model lacks it."""
|
|
67
|
+
options = list(model.efforts) if model else []
|
|
68
|
+
if effort and effort not in options:
|
|
69
|
+
options.append(effort)
|
|
70
|
+
return options
|
|
71
|
+
|
|
72
|
+
|
|
63
73
|
def _usage_row(account: Any) -> "ClaudeAccount":
|
|
64
74
|
"""One account's dashboard row, with its percentages rounded to whole numbers.
|
|
65
75
|
|
|
@@ -113,13 +123,15 @@ class ModelOption(BaseModel):
|
|
|
113
123
|
|
|
114
124
|
``efforts`` are the reasoning effort levels the model takes, empty when it
|
|
115
125
|
has none, and ``default_effort`` the one it runs at when the skill sets
|
|
116
|
-
none, empty when the agent doesn't say.
|
|
126
|
+
none, empty when the agent doesn't say. ``effort_label`` names levels that
|
|
127
|
+
aren't a reasoning effort (Copilot Auto's tiers), empty otherwise.
|
|
117
128
|
"""
|
|
118
129
|
|
|
119
130
|
id: str
|
|
120
131
|
name: str
|
|
121
132
|
efforts: list[str] = []
|
|
122
133
|
default_effort: str = ""
|
|
134
|
+
effort_label: str = ""
|
|
123
135
|
|
|
124
136
|
|
|
125
137
|
class ConversationMessage(BaseModel):
|
|
@@ -192,6 +204,18 @@ class ActiveJob(BaseModel):
|
|
|
192
204
|
model: str = ""
|
|
193
205
|
|
|
194
206
|
|
|
207
|
+
class PeepStep(BaseModel):
|
|
208
|
+
"""One recent step of a running session in the Peep dialog.
|
|
209
|
+
|
|
210
|
+
``kind`` is ``thinking``, ``text`` or ``tool``; ``timestamp`` is ISO, empty
|
|
211
|
+
when the agent logged none.
|
|
212
|
+
"""
|
|
213
|
+
|
|
214
|
+
kind: str
|
|
215
|
+
text: str
|
|
216
|
+
timestamp: str = ""
|
|
217
|
+
|
|
218
|
+
|
|
195
219
|
def _active_job(job: dict[str, Any]) -> ActiveJob:
|
|
196
220
|
"""One in-flight run as its dashboard row reads it.
|
|
197
221
|
|
|
@@ -394,6 +418,13 @@ class AdminState(rx.State):
|
|
|
394
418
|
# row index can belong to another session by the time "Kill" is pressed.
|
|
395
419
|
kill_job_id: int = 0
|
|
396
420
|
kill_job_label: str = ""
|
|
421
|
+
# The session the Peep dialog shows, held for the same reason, with the
|
|
422
|
+
# last steps read from its transcript. ``peep_note`` says why there are
|
|
423
|
+
# none, or that the session has finished since.
|
|
424
|
+
peep_job_id: int = 0
|
|
425
|
+
peep_job_label: str = ""
|
|
426
|
+
peep_steps: list[PeepStep] = []
|
|
427
|
+
peep_note: str = ""
|
|
397
428
|
paused: bool = False
|
|
398
429
|
total_runs: int = 0
|
|
399
430
|
last_24h_runs: int = 0
|
|
@@ -565,15 +596,41 @@ class AdminState(rx.State):
|
|
|
565
596
|
effort the skill already carries is always listed, so a value written by
|
|
566
597
|
hand stays visible and can be cleared rather than being dropped unseen.
|
|
567
598
|
"""
|
|
599
|
+
return _effort_options(
|
|
600
|
+
_model_option(self.agent_models, self.skill_model),
|
|
601
|
+
self.skill_effort)
|
|
602
|
+
|
|
603
|
+
@rx.var
|
|
604
|
+
def skill_effort_choices(self) -> list[list[str]]:
|
|
605
|
+
"""``[value, label]`` for each effort option; a tier reads capitalized."""
|
|
606
|
+
model = _model_option(self.agent_models, self.skill_model)
|
|
607
|
+
tiered = bool(model and model.effort_label)
|
|
608
|
+
return [[option, option.capitalize() if tiered else option]
|
|
609
|
+
for option in _effort_options(model, self.skill_effort)]
|
|
610
|
+
|
|
611
|
+
@rx.var
|
|
612
|
+
def skill_effort_label(self) -> str:
|
|
613
|
+
"""The picker's title: what the picked model calls its levels."""
|
|
614
|
+
model = _model_option(self.agent_models, self.skill_model)
|
|
615
|
+
return (model.effort_label if model and model.effort_label
|
|
616
|
+
else "Reasoning effort")
|
|
617
|
+
|
|
618
|
+
@rx.var
|
|
619
|
+
def skill_effort_has_default(self) -> bool:
|
|
620
|
+
"""Whether the picker offers "Model default".
|
|
621
|
+
|
|
622
|
+
A tier always has a value, so for a tiered model the picker shows its
|
|
623
|
+
default level selected instead.
|
|
624
|
+
"""
|
|
568
625
|
model = _model_option(self.agent_models, self.skill_model)
|
|
569
|
-
|
|
570
|
-
if self.skill_effort and self.skill_effort not in options:
|
|
571
|
-
options.append(self.skill_effort)
|
|
572
|
-
return options
|
|
626
|
+
return not (model and model.effort_label)
|
|
573
627
|
|
|
574
628
|
@rx.var
|
|
575
629
|
def skill_effort_value(self) -> str:
|
|
576
630
|
"""The effort picker's value; the select can't hold an empty one."""
|
|
631
|
+
model = _model_option(self.agent_models, self.skill_model)
|
|
632
|
+
if not self.skill_effort and model and model.effort_label:
|
|
633
|
+
return model.default_effort
|
|
577
634
|
return self.skill_effort or EFFORT_DEFAULT
|
|
578
635
|
|
|
579
636
|
@rx.var
|
|
@@ -942,6 +999,48 @@ class AdminState(rx.State):
|
|
|
942
999
|
self._refresh_dashboard()
|
|
943
1000
|
return rx.toast.success(f"Killed {label}")
|
|
944
1001
|
|
|
1002
|
+
def open_peep(self, job_id: int, label: str) -> None:
|
|
1003
|
+
self.peep_job_id = job_id
|
|
1004
|
+
self.peep_job_label = label
|
|
1005
|
+
self.peep_steps = []
|
|
1006
|
+
self._load_peep()
|
|
1007
|
+
|
|
1008
|
+
def set_peep_dialog_open(self, is_open: bool) -> None:
|
|
1009
|
+
if not is_open:
|
|
1010
|
+
self.peep_job_id = 0
|
|
1011
|
+
self.peep_job_label = ""
|
|
1012
|
+
self.peep_steps = []
|
|
1013
|
+
self.peep_note = ""
|
|
1014
|
+
|
|
1015
|
+
def refresh_peep(self) -> None:
|
|
1016
|
+
if self.peep_job_id:
|
|
1017
|
+
self._load_peep()
|
|
1018
|
+
|
|
1019
|
+
def _load_peep(self) -> None:
|
|
1020
|
+
"""Read the session's last steps, or say why there are none.
|
|
1021
|
+
|
|
1022
|
+
A session that finished keeps the steps already on screen, so the
|
|
1023
|
+
last look at it isn't wiped by the refresh that found it gone.
|
|
1024
|
+
"""
|
|
1025
|
+
try:
|
|
1026
|
+
peep = SERVICE.peep_job(self.peep_job_id, PEEP_STEPS)
|
|
1027
|
+
except Exception as error:
|
|
1028
|
+
self.peep_note = f"Could not read the session: {error}"
|
|
1029
|
+
return
|
|
1030
|
+
if peep is None:
|
|
1031
|
+
self.peep_note = ("This session has finished. Its response is "
|
|
1032
|
+
"under Runs.")
|
|
1033
|
+
return
|
|
1034
|
+
if peep["entries"] is None:
|
|
1035
|
+
self.peep_steps = []
|
|
1036
|
+
self.peep_note = (f"Peep isn't available for {peep['agent']} "
|
|
1037
|
+
"sessions yet.")
|
|
1038
|
+
return
|
|
1039
|
+
self.peep_steps = [PeepStep(**entry) for entry in peep["entries"]]
|
|
1040
|
+
self.peep_note = ("" if self.peep_steps else
|
|
1041
|
+
"Nothing to show yet. The agent may still be "
|
|
1042
|
+
"starting up.")
|
|
1043
|
+
|
|
945
1044
|
@rx.event(background=True)
|
|
946
1045
|
async def poll_dashboard(self) -> None:
|
|
947
1046
|
"""Keep the dashboard live for as long as it is the page on screen.
|
|
@@ -2103,6 +2202,12 @@ def active_job_row(job: ActiveJob) -> rx.Component:
|
|
|
2103
2202
|
aria_label="View session", color=ACCENT, display="flex",
|
|
2104
2203
|
align_items="center"),
|
|
2105
2204
|
),
|
|
2205
|
+
rx.icon_button(
|
|
2206
|
+
rx.icon("eye", size=14),
|
|
2207
|
+
size="1", variant="ghost",
|
|
2208
|
+
aria_label="Peep at session", title="Peep at session",
|
|
2209
|
+
on_click=AdminState.open_peep(job.id, job.message),
|
|
2210
|
+
),
|
|
2106
2211
|
rx.icon_button(
|
|
2107
2212
|
rx.icon("square", size=14),
|
|
2108
2213
|
size="1", variant="ghost", color_scheme="red",
|
|
@@ -2146,6 +2251,70 @@ def kill_job_dialog() -> rx.Component:
|
|
|
2146
2251
|
)
|
|
2147
2252
|
|
|
2148
2253
|
|
|
2254
|
+
def peep_step(step: PeepStep) -> rx.Component:
|
|
2255
|
+
"""One step: what kind it is and when, then what the agent wrote or ran.
|
|
2256
|
+
|
|
2257
|
+
Thinking and replies are markdown, with raw HTML and math off as on the
|
|
2258
|
+
Runs page. A tool call is one line of code.
|
|
2259
|
+
"""
|
|
2260
|
+
return rx.vstack(
|
|
2261
|
+
rx.hstack(
|
|
2262
|
+
rx.badge(
|
|
2263
|
+
rx.match(step.kind, ("thinking", "Thinking"),
|
|
2264
|
+
("tool", "Tool call"), "Message"),
|
|
2265
|
+
color_scheme=rx.match(step.kind, ("thinking", "gray"),
|
|
2266
|
+
("tool", "blue"), "green"),
|
|
2267
|
+
variant="soft"),
|
|
2268
|
+
rx.cond(step.timestamp != "",
|
|
2269
|
+
rx.text(local_datetime(step.timestamp), color=MUTED,
|
|
2270
|
+
font_size="0.75rem")),
|
|
2271
|
+
spacing="2", align="center"),
|
|
2272
|
+
rx.cond(
|
|
2273
|
+
step.kind == "tool",
|
|
2274
|
+
rx.code(step.text, font_family=MONO, font_size="0.8rem",
|
|
2275
|
+
white_space="pre-wrap", overflow_wrap="anywhere",
|
|
2276
|
+
width="100%", color_scheme="gray"),
|
|
2277
|
+
rx.box(rx.markdown(step.text, use_raw=False, use_math=False,
|
|
2278
|
+
use_katex=False),
|
|
2279
|
+
color=rx.cond(step.kind == "thinking", MUTED, TEXT),
|
|
2280
|
+
font_style=rx.cond(step.kind == "thinking", "italic",
|
|
2281
|
+
"normal"),
|
|
2282
|
+
font_size="0.88rem", width="100%", overflow_x="auto")),
|
|
2283
|
+
spacing="1", align="start", width="100%",
|
|
2284
|
+
padding_bottom="0.75rem", border_bottom=BORDER,
|
|
2285
|
+
)
|
|
2286
|
+
|
|
2287
|
+
|
|
2288
|
+
def peep_dialog() -> rx.Component:
|
|
2289
|
+
"""The last steps of one running session, read again on Refresh."""
|
|
2290
|
+
return rx.dialog.root(
|
|
2291
|
+
rx.dialog.content(
|
|
2292
|
+
rx.dialog.title("Peep"),
|
|
2293
|
+
rx.dialog.description(
|
|
2294
|
+
rx.text(AdminState.peep_job_label, font_family=MONO,
|
|
2295
|
+
font_size="0.85rem", overflow="hidden",
|
|
2296
|
+
text_overflow="ellipsis", white_space="nowrap"),
|
|
2297
|
+
color=MUTED),
|
|
2298
|
+
rx.vstack(
|
|
2299
|
+
rx.foreach(AdminState.peep_steps, peep_step),
|
|
2300
|
+
rx.cond(AdminState.peep_note != "",
|
|
2301
|
+
rx.text(AdminState.peep_note, color=MUTED,
|
|
2302
|
+
font_size="0.85rem")),
|
|
2303
|
+
spacing="3", width="100%", max_height="60vh",
|
|
2304
|
+
overflow_y="auto", margin_top="1rem", padding_right="0.25rem"),
|
|
2305
|
+
rx.hstack(
|
|
2306
|
+
rx.button(rx.icon("refresh-cw", size=14), "Refresh",
|
|
2307
|
+
variant="soft", on_click=AdminState.refresh_peep),
|
|
2308
|
+
rx.dialog.close(rx.button("Close", variant="soft",
|
|
2309
|
+
color_scheme="gray")),
|
|
2310
|
+
spacing="3", justify="end", margin_top="1.25rem",
|
|
2311
|
+
width="100%"),
|
|
2312
|
+
max_width="48rem"),
|
|
2313
|
+
open=AdminState.peep_job_id != 0,
|
|
2314
|
+
on_open_change=AdminState.set_peep_dialog_open,
|
|
2315
|
+
)
|
|
2316
|
+
|
|
2317
|
+
|
|
2149
2318
|
def running_tile() -> rx.Component:
|
|
2150
2319
|
"""Stat tile that lights up while sessions are in flight."""
|
|
2151
2320
|
running = AdminState.active_jobs.length()
|
|
@@ -2215,6 +2384,7 @@ def running_panel() -> rx.Component:
|
|
|
2215
2384
|
),
|
|
2216
2385
|
),
|
|
2217
2386
|
kill_job_dialog(),
|
|
2387
|
+
peep_dialog(),
|
|
2218
2388
|
padding="1.25rem",
|
|
2219
2389
|
background=SURFACE,
|
|
2220
2390
|
border=rx.cond(is_running, f"1px solid {ACCENT}", BORDER),
|
|
@@ -2562,21 +2732,25 @@ def effort_picker() -> rx.Component:
|
|
|
2562
2732
|
return rx.cond(
|
|
2563
2733
|
AdminState.skill_effort_options.length() > 0,
|
|
2564
2734
|
rx.box(field(
|
|
2565
|
-
|
|
2735
|
+
AdminState.skill_effort_label,
|
|
2566
2736
|
rx.select.root(
|
|
2567
2737
|
rx.select.trigger(width="100%"),
|
|
2568
2738
|
rx.select.content(
|
|
2569
|
-
rx.
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2739
|
+
rx.cond(AdminState.skill_effort_has_default,
|
|
2740
|
+
rx.select.item(
|
|
2741
|
+
AdminState.skill_effort_default_label,
|
|
2742
|
+
value=EFFORT_DEFAULT)),
|
|
2743
|
+
rx.foreach(AdminState.skill_effort_choices,
|
|
2744
|
+
lambda choice: rx.select.item(
|
|
2745
|
+
choice[1], value=choice[0]))),
|
|
2574
2746
|
value=AdminState.skill_effort_value,
|
|
2575
2747
|
on_change=AdminState.set_skill_effort),
|
|
2576
2748
|
rx.text(
|
|
2577
2749
|
rx.cond(
|
|
2578
2750
|
AdminState.skill_effort == "",
|
|
2579
|
-
|
|
2751
|
+
rx.cond(AdminState.skill_effort_has_default,
|
|
2752
|
+
"Runs at the model's own effort.",
|
|
2753
|
+
"Runs on the default tier."),
|
|
2580
2754
|
rx.cond(
|
|
2581
2755
|
AdminState.skill_effort_unlisted,
|
|
2582
2756
|
rx.fragment(
|
|
@@ -3740,8 +3914,8 @@ def claude_code_setting() -> rx.Component:
|
|
|
3740
3914
|
|
|
3741
3915
|
def github_copilot_setting() -> rx.Component:
|
|
3742
3916
|
"""Settings used only by GitHub Copilot CLI runs."""
|
|
3743
|
-
return rx.
|
|
3744
|
-
rx.
|
|
3917
|
+
return rx.vstack(
|
|
3918
|
+
rx.text("GitHub Copilot", font_size="0.9rem", font_weight="600"),
|
|
3745
3919
|
field(
|
|
3746
3920
|
"Prompt prefix",
|
|
3747
3921
|
rx.text_area(
|
|
@@ -3757,7 +3931,18 @@ def github_copilot_setting() -> rx.Component:
|
|
|
3757
3931
|
font_size="0.82rem",
|
|
3758
3932
|
),
|
|
3759
3933
|
),
|
|
3760
|
-
|
|
3934
|
+
spacing="3", width="100%")
|
|
3935
|
+
|
|
3936
|
+
|
|
3937
|
+
def coding_agent_advanced() -> rx.Component:
|
|
3938
|
+
"""Collapsed by default: agent-specific tweaks most setups never touch."""
|
|
3939
|
+
return rx.accordion.root(
|
|
3940
|
+
rx.accordion.item(
|
|
3941
|
+
header=rx.text("Advanced", font_size="0.9rem", font_weight="600"),
|
|
3942
|
+
content=rx.box(github_copilot_setting(), padding="1rem 0.25rem",
|
|
3943
|
+
width="100%"),
|
|
3944
|
+
),
|
|
3945
|
+
type="single", collapsible=True, variant="ghost", width="100%")
|
|
3761
3946
|
|
|
3762
3947
|
|
|
3763
3948
|
def conversation_message(message: ConversationMessage) -> rx.Component:
|
|
@@ -3931,13 +4116,16 @@ def settings_page() -> rx.Component:
|
|
|
3931
4116
|
type="number", min=1, width="100%"),
|
|
3932
4117
|
rx.text("How many task agents may run at once.",
|
|
3933
4118
|
color=MUTED, font_size="0.82rem")),
|
|
4119
|
+
# Only Copilot has advanced settings so far, so the section
|
|
4120
|
+
# would be empty on a machine without it.
|
|
4121
|
+
coding_agent_advanced() if GITHUB_COPILOT_AVAILABLE
|
|
4122
|
+
else rx.fragment(),
|
|
3934
4123
|
spacing="4", width="100%"),
|
|
3935
4124
|
padding="1.25rem", background=SURFACE, border=BORDER, width="100%"),
|
|
3936
4125
|
# Decided when the page is built rather than with an rx.cond, because
|
|
3937
4126
|
# which agents a machine has is not state: there is no event that could
|
|
3938
4127
|
# ever flip it, and nothing on the page should be able to.
|
|
3939
4128
|
claude_code_setting() if CLAUDE_CODE_AVAILABLE else rx.fragment(),
|
|
3940
|
-
github_copilot_setting() if GITHUB_COPILOT_AVAILABLE else rx.fragment(),
|
|
3941
4129
|
rx.box(
|
|
3942
4130
|
rx.heading("Tasks provider", size="4", margin_bottom="1rem"),
|
|
3943
4131
|
field("Provider", rx.select(["jira", "azure_devops"], value=AdminState.tasks_provider,
|
|
@@ -1022,10 +1022,15 @@ class AdminService:
|
|
|
1022
1022
|
print(f"[admin] Failed to list models for "
|
|
1023
1023
|
f"{agent_key.value}: {error}")
|
|
1024
1024
|
models = []
|
|
1025
|
-
|
|
1025
|
+
# An empty catalog is usually a CLI that couldn't be started or
|
|
1026
|
+
# wasn't signed in yet, so it is asked again next time rather
|
|
1027
|
+
# than left empty until a restart.
|
|
1028
|
+
if models:
|
|
1029
|
+
self._models_cache[agent_key] = models
|
|
1026
1030
|
return [{"id": model.id, "name": model.name,
|
|
1027
1031
|
"efforts": list(model.efforts),
|
|
1028
|
-
"default_effort": model.default_effort
|
|
1032
|
+
"default_effort": model.default_effort,
|
|
1033
|
+
"effort_label": model.effort_label}
|
|
1029
1034
|
for model in models]
|
|
1030
1035
|
|
|
1031
1036
|
def resolve_skill_slug(self, label: str) -> str:
|
|
@@ -2074,6 +2079,37 @@ class AdminService:
|
|
|
2074
2079
|
"""Stop a running session. False if it had already finished."""
|
|
2075
2080
|
return runs_db.kill_job(job_id, main_context=self.context)
|
|
2076
2081
|
|
|
2082
|
+
def peep_job(self, job_id: int, limit: int = 10) -> dict[str, Any] | None:
|
|
2083
|
+
"""The last ``limit`` steps of a running session. None once it finished.
|
|
2084
|
+
|
|
2085
|
+
``entries`` is None rather than a list when the session's agent keeps
|
|
2086
|
+
no transcript Codee can read. A row that names no agent, from before
|
|
2087
|
+
the dashboard recorded one, is read as the default agent's.
|
|
2088
|
+
"""
|
|
2089
|
+
job = next((job for job in runs_db.active_jobs(main_context=self.context)
|
|
2090
|
+
if job["id"] == job_id), None)
|
|
2091
|
+
if job is None:
|
|
2092
|
+
return None
|
|
2093
|
+
agent = (resolve_agent_code(job.get("agent") or "")
|
|
2094
|
+
or self.context.settings.coding_agent)
|
|
2095
|
+
implementation = CODING_AGENTS.get(agent)
|
|
2096
|
+
entries = None
|
|
2097
|
+
if implementation is not None:
|
|
2098
|
+
try:
|
|
2099
|
+
entries = implementation.peep(job["session_id"], self.root,
|
|
2100
|
+
limit)
|
|
2101
|
+
except Exception as error:
|
|
2102
|
+
print(f"[admin] Could not read job {job_id}'s transcript: "
|
|
2103
|
+
f"{error}")
|
|
2104
|
+
entries = []
|
|
2105
|
+
return {
|
|
2106
|
+
"agent": agent_label(agent),
|
|
2107
|
+
"entries": (None if entries is None else
|
|
2108
|
+
[{"kind": entry.kind, "text": entry.text,
|
|
2109
|
+
"timestamp": entry.timestamp}
|
|
2110
|
+
for entry in entries]),
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2077
2113
|
def set_paused(self, paused: bool) -> bool:
|
|
2078
2114
|
"""Allow or prevent future automated agent runs."""
|
|
2079
2115
|
set_paused(self.context, paused)
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import tempfile
|
|
2
|
+
import unittest
|
|
3
|
+
from email.message import EmailMessage
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from unittest.mock import MagicMock, patch
|
|
6
|
+
|
|
7
|
+
from codee_main_context.context import CodeeMainContext
|
|
8
|
+
|
|
9
|
+
from codee.lib import trigger_email_skills as module
|
|
10
|
+
from codee.lib.trigger_email_skills import trigger_email_skills
|
|
11
|
+
|
|
12
|
+
ADDRESS = "inbox@codee.example.com"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _raw(sender="dev@example.com", to=ADDRESS, subject="Bug") -> bytes:
|
|
16
|
+
msg = EmailMessage()
|
|
17
|
+
msg["From"] = sender
|
|
18
|
+
msg["To"] = to
|
|
19
|
+
msg["Subject"] = subject
|
|
20
|
+
msg.set_content("Checkout fails with a 500.")
|
|
21
|
+
return msg.as_bytes()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class FakeMailpit:
|
|
25
|
+
"""Just enough of the Mailpit API: search, raw message, delete."""
|
|
26
|
+
|
|
27
|
+
def __init__(self, messages):
|
|
28
|
+
# ID -> (Created, recipients, raw)
|
|
29
|
+
self.messages = dict(messages)
|
|
30
|
+
self.deleted = []
|
|
31
|
+
self.queries = []
|
|
32
|
+
|
|
33
|
+
def get(self, url, params=None, auth=None, timeout=None):
|
|
34
|
+
resp = MagicMock()
|
|
35
|
+
if url.endswith("/search"):
|
|
36
|
+
self.queries.append((params["query"], auth))
|
|
37
|
+
address = params["query"].split('"')[1]
|
|
38
|
+
hits = [{"ID": i, "Created": c}
|
|
39
|
+
for i, (c, rcpts, _) in self.messages.items() if address in rcpts]
|
|
40
|
+
hits.sort(key=lambda m: m["Created"], reverse=True) # newest first
|
|
41
|
+
resp.json.return_value = {"messages": hits}
|
|
42
|
+
else:
|
|
43
|
+
message_id = url.rsplit("/", 2)[-2]
|
|
44
|
+
resp.content = self.messages[message_id][2]
|
|
45
|
+
return resp
|
|
46
|
+
|
|
47
|
+
def delete(self, url, json=None, auth=None, timeout=None):
|
|
48
|
+
self.deleted.extend(json["IDs"])
|
|
49
|
+
for message_id in json["IDs"]:
|
|
50
|
+
self.messages.pop(message_id, None)
|
|
51
|
+
return MagicMock()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class EmailTriggerTests(unittest.TestCase):
|
|
55
|
+
def setUp(self):
|
|
56
|
+
self.tmp = Path(tempfile.mkdtemp())
|
|
57
|
+
skill_dir = self.tmp / "skills" / "inbox"
|
|
58
|
+
skill_dir.mkdir(parents=True)
|
|
59
|
+
(skill_dir / "SKILL.md").write_text(
|
|
60
|
+
"---\n"
|
|
61
|
+
"name: inbox\n"
|
|
62
|
+
"disable-model-invocation: true\n"
|
|
63
|
+
"x-codee-trigger: email\n"
|
|
64
|
+
f"x-codee-email-address: {ADDRESS}\n"
|
|
65
|
+
"---\n"
|
|
66
|
+
"Mail:\n\n{CONTENT}\n")
|
|
67
|
+
self.emails_dir = self.tmp / "emails"
|
|
68
|
+
self.prompts = []
|
|
69
|
+
patch.object(module, "ALLOWED_SENDER_DOMAINS", ("example.com",)).start()
|
|
70
|
+
patch.object(module.runs_db, "record_run").start()
|
|
71
|
+
self.addCleanup(patch.stopall)
|
|
72
|
+
|
|
73
|
+
def run_claude(self, prompt, session_id, model, agent, effort=""):
|
|
74
|
+
self.prompts.append(prompt)
|
|
75
|
+
return "ok"
|
|
76
|
+
|
|
77
|
+
def tick(self, env=None):
|
|
78
|
+
with patch.dict(module.os.environ, env or {}, clear=False):
|
|
79
|
+
if not env:
|
|
80
|
+
module.os.environ.pop("MAILPIT_API_URL", None)
|
|
81
|
+
trigger_email_skills(self.run_claude, skills_dir=self.tmp / "skills",
|
|
82
|
+
emails_dir=self.emails_dir,
|
|
83
|
+
main_context=CodeeMainContext(data_dir=self.tmp))
|
|
84
|
+
|
|
85
|
+
def test_directory_source_runs_skill_and_removes_file(self):
|
|
86
|
+
self.emails_dir.mkdir()
|
|
87
|
+
(self.emails_dir / "a.eml").write_bytes(_raw())
|
|
88
|
+
|
|
89
|
+
self.tick()
|
|
90
|
+
|
|
91
|
+
self.assertEqual(len(self.prompts), 1)
|
|
92
|
+
self.assertIn("Checkout fails with a 500.", self.prompts[0])
|
|
93
|
+
self.assertEqual(list(self.emails_dir.glob("*.eml")), [])
|
|
94
|
+
|
|
95
|
+
def test_mailpit_source_only_touches_skill_mail_oldest_first(self):
|
|
96
|
+
mailpit = FakeMailpit({
|
|
97
|
+
"new": ("2026-10-08T06:22:00Z", [ADDRESS], _raw(subject="second")),
|
|
98
|
+
"old": ("2026-10-08T06:17:00Z", [ADDRESS], _raw(subject="first")),
|
|
99
|
+
"qa": ("2026-10-08T05:00:00Z", ["qa@codee.example.com"],
|
|
100
|
+
_raw(to="qa@codee.example.com")),
|
|
101
|
+
})
|
|
102
|
+
env = {"MAILPIT_API_URL": "http://mailpit/api/v1/",
|
|
103
|
+
"MAILPIT_AUTH": "user:secret"}
|
|
104
|
+
with patch.object(module.requests, "get", mailpit.get), \
|
|
105
|
+
patch.object(module.requests, "delete", mailpit.delete):
|
|
106
|
+
self.tick(env)
|
|
107
|
+
|
|
108
|
+
self.assertEqual(mailpit.queries, [(f'addressed:"{ADDRESS}"', ("user", "secret"))])
|
|
109
|
+
self.assertEqual(["Subject: first" in p for p in self.prompts], [True, False])
|
|
110
|
+
self.assertEqual(mailpit.deleted, ["old", "new"])
|
|
111
|
+
self.assertIn("qa", mailpit.messages)
|
|
112
|
+
|
|
113
|
+
def test_mailpit_envelope_only_recipient_still_routes(self):
|
|
114
|
+
# Bcc'd: Mailpit matched the envelope, the raw headers don't name us.
|
|
115
|
+
mailpit = FakeMailpit({
|
|
116
|
+
"bcc": ("2026-10-08T06:00:00Z", [ADDRESS], _raw(to="someone@example.com")),
|
|
117
|
+
})
|
|
118
|
+
with patch.object(module.requests, "get", mailpit.get), \
|
|
119
|
+
patch.object(module.requests, "delete", mailpit.delete):
|
|
120
|
+
self.tick({"MAILPIT_API_URL": "http://mailpit/api/v1"})
|
|
121
|
+
|
|
122
|
+
self.assertEqual(len(self.prompts), 1)
|
|
123
|
+
self.assertEqual(mailpit.deleted, ["bcc"])
|
|
124
|
+
|
|
125
|
+
def test_mailpit_failed_run_keeps_message(self):
|
|
126
|
+
mailpit = FakeMailpit({"m": ("2026-10-08T06:00:00Z", [ADDRESS], _raw())})
|
|
127
|
+
|
|
128
|
+
def boom(*args, **kwargs):
|
|
129
|
+
raise RuntimeError("agent crashed")
|
|
130
|
+
|
|
131
|
+
self.run_claude = boom
|
|
132
|
+
with patch.object(module.requests, "get", mailpit.get), \
|
|
133
|
+
patch.object(module.requests, "delete", mailpit.delete):
|
|
134
|
+
self.tick({"MAILPIT_API_URL": "http://mailpit/api/v1"})
|
|
135
|
+
|
|
136
|
+
self.assertEqual(mailpit.deleted, [])
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
if __name__ == "__main__":
|
|
140
|
+
unittest.main()
|