robert-github-agent 0.1.0b1__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.
- robert_agent/__init__.py +1 -0
- robert_agent/acceptance.py +394 -0
- robert_agent/acceptance_suite.py +287 -0
- robert_agent/audit_result.py +501 -0
- robert_agent/authorize.py +117 -0
- robert_agent/board.py +538 -0
- robert_agent/chat_status.py +338 -0
- robert_agent/cli/__init__.py +1 -0
- robert_agent/cli/exit_codes.py +5 -0
- robert_agent/cli/main.py +535 -0
- robert_agent/cli/output.py +20 -0
- robert_agent/common.py +6 -0
- robert_agent/controlled_e2e_acceptance.py +394 -0
- robert_agent/daemon.py +607 -0
- robert_agent/daemon_state.py +319 -0
- robert_agent/diagnostics.py +119 -0
- robert_agent/discover.py +775 -0
- robert_agent/dispatch.py +217 -0
- robert_agent/doctor.py +94 -0
- robert_agent/github_api.py +12 -0
- robert_agent/init_config.py +126 -0
- robert_agent/integrations/__init__.py +1 -0
- robert_agent/integrations/openclaw.py +285 -0
- robert_agent/live_discovery_acceptance.py +70 -0
- robert_agent/live_worker_acceptance.py +363 -0
- robert_agent/live_worktree_acceptance.py +344 -0
- robert_agent/loop_engine.py +285 -0
- robert_agent/memory_curator.py +105 -0
- robert_agent/migrate.py +157 -0
- robert_agent/notify.py +74 -0
- robert_agent/paths.py +16 -0
- robert_agent/production_write_canary.py +254 -0
- robert_agent/project_memory.py +503 -0
- robert_agent/publish.py +743 -0
- robert_agent/publish_dedupe_acceptance.py +270 -0
- robert_agent/redaction.py +41 -0
- robert_agent/render_prompt.py +544 -0
- robert_agent/resource_files.py +8 -0
- robert_agent/resources/__init__.py +1 -0
- robert_agent/resources/acceptance-matrix.md +120 -0
- robert_agent/resources/classifier.md +19 -0
- robert_agent/resources/command-matrix.md +38 -0
- robert_agent/resources/config.example.yml +20 -0
- robert_agent/resources/db/migrations/001_legacy_dd_to_robert.sql +14 -0
- robert_agent/resources/db/schema.sql +479 -0
- robert_agent/resources/failure-modes.md +36 -0
- robert_agent/resources/fixtures/actor-permission.json +1 -0
- robert_agent/resources/fixtures/discovery.json +1 -0
- robert_agent/resources/fixtures/redaction.json +1 -0
- robert_agent/resources/fixtures/review-followup.json +1 -0
- robert_agent/resources/fixtures/worker-results.json +1 -0
- robert_agent/resources/fixtures/workstreams.json +1 -0
- robert_agent/resources/github-events.md +77 -0
- robert_agent/resources/kanban-control.md +165 -0
- robert_agent/resources/redaction.md +29 -0
- robert_agent/resources/result-contract.md +56 -0
- robert_agent/resources/routes.yml +82 -0
- robert_agent/resources/schemas/config.schema.json +123 -0
- robert_agent/resources/schemas/event.schema.json +18 -0
- robert_agent/resources/schemas/result.schema.json +99 -0
- robert_agent/resources/schemas/route.schema.json +23 -0
- robert_agent/resources/schemas/snapshot.schema.json +17 -0
- robert_agent/resources/schemas/task.schema.json +15 -0
- robert_agent/resources/trust-model.md +16 -0
- robert_agent/resources/worker-prompt.md +121 -0
- robert_agent/resources/worker-protocol.md +47 -0
- robert_agent/resources/workflow.yml +50 -0
- robert_agent/resources/workstream-model.md +17 -0
- robert_agent/route.py +232 -0
- robert_agent/route_config.py +64 -0
- robert_agent/run_once.py +5375 -0
- robert_agent/runtime_knowledge.py +392 -0
- robert_agent/service.py +161 -0
- robert_agent/skills.py +28 -0
- robert_agent/status.py +1051 -0
- robert_agent/storage.py +376 -0
- robert_agent/summarize.py +100 -0
- robert_agent/supervise.py +72 -0
- robert_agent/usage.py +192 -0
- robert_agent/validate_config.py +616 -0
- robert_agent/wakeup.py +261 -0
- robert_agent/web.py +2893 -0
- robert_agent/web_assets/board.css +255 -0
- robert_agent/web_assets/board.html +165 -0
- robert_agent/web_assets/board.js +660 -0
- robert_agent/web_assets/github-shell.css +122 -0
- robert_agent/web_assets/index.html +103 -0
- robert_agent/web_assets/operations.css +168 -0
- robert_agent/web_assets/workbench.css +131 -0
- robert_agent/web_assets/workbench.js +581 -0
- robert_agent/work_items.py +1016 -0
- robert_agent/workbench.py +701 -0
- robert_agent/worker/__init__.py +1 -0
- robert_agent/worker/heartbeat.py +190 -0
- robert_agent/worker/result.py +321 -0
- robert_agent/worker/snapshot.py +98 -0
- robert_agent/worker_adapters/__init__.py +138 -0
- robert_agent/worker_adapters/cbc.py +68 -0
- robert_agent/worker_adapters/codex.py +56 -0
- robert_agent/worker_adapters/command.py +33 -0
- robert_agent/worker_adapters/tcodex.py +56 -0
- robert_agent/worker_heartbeat.py +6 -0
- robert_agent/worker_result.py +6 -0
- robert_agent/worker_snapshot.py +6 -0
- robert_agent/workstream.py +55 -0
- robert_agent/worktree.py +297 -0
- robert_github_agent-0.1.0b1.dist-info/METADATA +217 -0
- robert_github_agent-0.1.0b1.dist-info/RECORD +111 -0
- robert_github_agent-0.1.0b1.dist-info/WHEEL +4 -0
- robert_github_agent-0.1.0b1.dist-info/entry_points.txt +2 -0
- robert_github_agent-0.1.0b1.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import argparse
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import sqlite3
|
|
5
|
+
|
|
6
|
+
from robert_agent.common import emit
|
|
7
|
+
from robert_agent import web
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _value(value, empty="-"):
|
|
11
|
+
if value is None or value == "":
|
|
12
|
+
return empty
|
|
13
|
+
if isinstance(value, list):
|
|
14
|
+
return ", ".join(str(item) for item in value) if value else empty
|
|
15
|
+
return str(value)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _field(label, value):
|
|
19
|
+
return f"- {label}: {_value(value)}"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _find_by_id(items, key, value):
|
|
23
|
+
for item in items:
|
|
24
|
+
if item.get(key) == value:
|
|
25
|
+
return item
|
|
26
|
+
return None
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _format_next_step(step):
|
|
30
|
+
label = f"{step.get('severity', 'info')} {step.get('target_kind')} {step.get('target_id')}"
|
|
31
|
+
parts = [label, step.get("next_action"), step.get("reason")]
|
|
32
|
+
line = " - ".join(_value(part) for part in parts if part)
|
|
33
|
+
if step.get("safe_error"):
|
|
34
|
+
line = f"{line}: {step['safe_error']}"
|
|
35
|
+
if step.get("command"):
|
|
36
|
+
line = f"{line} | command: {step['command']}"
|
|
37
|
+
return f"- {line}"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _format_task_line(task):
|
|
41
|
+
source = task.get("source_key") or task.get("workstream_id")
|
|
42
|
+
route = task.get("route_id") or task.get("expected_output") or "unrouted"
|
|
43
|
+
return (
|
|
44
|
+
f"- {task['task_id']} [{task.get('operator_state', 'unknown')}] "
|
|
45
|
+
f"{route} {task.get('priority', '')} source={_value(source)}"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def format_status(data):
|
|
50
|
+
summary = data.get("summary") or {}
|
|
51
|
+
state_counts = data.get("operator_state_counts") or {}
|
|
52
|
+
wakeup_summary = data.get("wakeup_summary") or {}
|
|
53
|
+
acceptance_metrics = data.get("acceptance_metrics") or {}
|
|
54
|
+
latest_loop = data.get("latest_loop") or {}
|
|
55
|
+
alerts = data.get("operator_alerts") or []
|
|
56
|
+
steps = data.get("operator_next_steps") or []
|
|
57
|
+
tasks = data.get("recent_tasks") or []
|
|
58
|
+
runs = data.get("recent_runs") or []
|
|
59
|
+
|
|
60
|
+
lines = [
|
|
61
|
+
"## Robert status",
|
|
62
|
+
"",
|
|
63
|
+
(
|
|
64
|
+
f"Repos: {summary.get('repos', 0)} | "
|
|
65
|
+
f"Workstreams: {summary.get('workstreams', 0)} | "
|
|
66
|
+
f"Tasks: {summary.get('tasks', 0)} | "
|
|
67
|
+
f"Events: {summary.get('github_events', 0)}"
|
|
68
|
+
),
|
|
69
|
+
(
|
|
70
|
+
f"Needs attention: {state_counts.get('needs_attention', 0)} | "
|
|
71
|
+
f"Waiting publish: {state_counts.get('waiting_publish', 0)} | "
|
|
72
|
+
f"Worker stale: {state_counts.get('worker_stale', 0)} | "
|
|
73
|
+
f"Waiting worker: {state_counts.get('waiting_worker', 0)}"
|
|
74
|
+
),
|
|
75
|
+
]
|
|
76
|
+
if wakeup_summary.get("available"):
|
|
77
|
+
lines.append(
|
|
78
|
+
f"Wakeups pending: {wakeup_summary.get('pending', 0)} | "
|
|
79
|
+
f"Due: {wakeup_summary.get('due', 0)}"
|
|
80
|
+
)
|
|
81
|
+
if acceptance_metrics:
|
|
82
|
+
lines.append(
|
|
83
|
+
f"Results accepted: {acceptance_metrics.get('accepted_results', 0)} | "
|
|
84
|
+
f"Rejected: {acceptance_metrics.get('rejected_results', 0)} | "
|
|
85
|
+
f"Usage: {'available' if acceptance_metrics.get('usage_available') else 'unavailable'}"
|
|
86
|
+
)
|
|
87
|
+
if latest_loop:
|
|
88
|
+
lines.append(
|
|
89
|
+
f"Latest loop: {latest_loop.get('stop_reason', 'unknown')} | "
|
|
90
|
+
f"Cycles: {latest_loop.get('cycles', 0)}"
|
|
91
|
+
)
|
|
92
|
+
daemon = data.get("daemon") or {}
|
|
93
|
+
latest_daemon_run = daemon.get("latest_run") or {}
|
|
94
|
+
latest_daemon_event = daemon.get("latest_event") or {}
|
|
95
|
+
if latest_daemon_run or latest_daemon_event:
|
|
96
|
+
lines.append(
|
|
97
|
+
"Daemon: "
|
|
98
|
+
f"{latest_daemon_run.get('status', 'unknown')} | "
|
|
99
|
+
f"Last event: {latest_daemon_event.get('event_type', 'none')}"
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
if alerts:
|
|
103
|
+
lines.extend(["", "### Alerts"])
|
|
104
|
+
for alert in alerts[:8]:
|
|
105
|
+
lines.append(
|
|
106
|
+
"- "
|
|
107
|
+
f"{alert['severity']} {alert['alert_type']}: "
|
|
108
|
+
f"{alert['count']} -> {alert['next_action']}"
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
if steps:
|
|
112
|
+
lines.extend(["", "### Next steps"])
|
|
113
|
+
lines.extend(_format_next_step(step) for step in steps[:8])
|
|
114
|
+
|
|
115
|
+
if tasks:
|
|
116
|
+
lines.extend(["", "### Recent tasks"])
|
|
117
|
+
lines.extend(_format_task_line(task) for task in tasks[:8])
|
|
118
|
+
|
|
119
|
+
if runs:
|
|
120
|
+
latest = runs[0]
|
|
121
|
+
lines.extend(
|
|
122
|
+
[
|
|
123
|
+
"",
|
|
124
|
+
"### Latest run",
|
|
125
|
+
_field("Run", latest.get("run_id")),
|
|
126
|
+
_field("Status", latest.get("status")),
|
|
127
|
+
_field("Started", latest.get("started_at")),
|
|
128
|
+
_field("Finished", latest.get("finished_at")),
|
|
129
|
+
]
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
return "\n".join(lines)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def format_task(data, task_id):
|
|
136
|
+
task = _find_by_id(data.get("recent_tasks") or [], "task_id", task_id)
|
|
137
|
+
if not task:
|
|
138
|
+
return None
|
|
139
|
+
|
|
140
|
+
source_number = (
|
|
141
|
+
f"{task.get('source_type') or '-'} #{task.get('source_number') or '-'}"
|
|
142
|
+
)
|
|
143
|
+
lines = [
|
|
144
|
+
f"## Task {task['task_id']}",
|
|
145
|
+
"",
|
|
146
|
+
_field("Operator state", task.get("operator_state")),
|
|
147
|
+
_field("Lifecycle", task.get("lifecycle")),
|
|
148
|
+
_field("Workstream", task.get("workstream_id")),
|
|
149
|
+
_field("Workstream lifecycle", task.get("workstream_lifecycle")),
|
|
150
|
+
_field("Priority", task.get("priority")),
|
|
151
|
+
_field("Route", task.get("route_id") or task.get("expected_output")),
|
|
152
|
+
_field("Route confidence", task.get("route_confidence")),
|
|
153
|
+
_field("Latest attempt", task.get("latest_attempt_status")),
|
|
154
|
+
_field("Heartbeat", task.get("latest_attempt_heartbeat_at")),
|
|
155
|
+
_field("Updated", task.get("updated_at")),
|
|
156
|
+
_field("Source key", task.get("source_key")),
|
|
157
|
+
_field("Source", source_number),
|
|
158
|
+
_field("GitHub", task.get("github_url")),
|
|
159
|
+
_field("Trigger", task.get("trigger_event_fingerprint")),
|
|
160
|
+
_field("Next action", task.get("next_action")),
|
|
161
|
+
_field("Allowed actions", task.get("allowed_github_actions") or []),
|
|
162
|
+
_field("Recommended skills", task.get("recommended_skills") or []),
|
|
163
|
+
]
|
|
164
|
+
|
|
165
|
+
notification = task.get("latest_notification")
|
|
166
|
+
if notification:
|
|
167
|
+
lines.extend(
|
|
168
|
+
[
|
|
169
|
+
"",
|
|
170
|
+
"### Latest notification",
|
|
171
|
+
_field("Type", notification.get("notification_type")),
|
|
172
|
+
_field("Status", notification.get("status")),
|
|
173
|
+
_field("Channel", notification.get("channel")),
|
|
174
|
+
_field("Created", notification.get("created_at")),
|
|
175
|
+
]
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
artifacts = task.get("artifacts") or {}
|
|
179
|
+
if artifacts:
|
|
180
|
+
lines.extend(["", "### Artifacts"])
|
|
181
|
+
for artifact_type, artifact in sorted(artifacts.items()):
|
|
182
|
+
lines.append(
|
|
183
|
+
f"- {artifact_type}: {artifact.get('bytes') or 'unknown'} bytes "
|
|
184
|
+
f"at {artifact.get('path') or '-'}"
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
return "\n".join(lines)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def format_run(data, run_id):
|
|
191
|
+
run = _find_by_id(data.get("recent_runs") or [], "run_id", run_id)
|
|
192
|
+
if not run:
|
|
193
|
+
return None
|
|
194
|
+
|
|
195
|
+
summary = run.get("summary") or {}
|
|
196
|
+
status = summary.get("overall_status") or run.get("status")
|
|
197
|
+
lines = [
|
|
198
|
+
f"## Run {run['run_id']}",
|
|
199
|
+
"",
|
|
200
|
+
_field("Status", status),
|
|
201
|
+
_field("Started", run.get("started_at")),
|
|
202
|
+
_field("Finished", run.get("finished_at")),
|
|
203
|
+
_field("Config", run.get("config_path")),
|
|
204
|
+
_field("Dry run", bool(run.get("dry_run"))),
|
|
205
|
+
]
|
|
206
|
+
if run.get("error"):
|
|
207
|
+
lines.append(_field("Error", run.get("error")))
|
|
208
|
+
repo_summaries = summary.get("repo_summaries") or []
|
|
209
|
+
if repo_summaries:
|
|
210
|
+
lines.extend(["", "Repos:"])
|
|
211
|
+
for repo in repo_summaries[:8]:
|
|
212
|
+
lines.append(
|
|
213
|
+
f"- {repo.get('full_name') or repo.get('repo_id')}: {repo.get('status')}"
|
|
214
|
+
)
|
|
215
|
+
steps = run.get("steps") or []
|
|
216
|
+
if steps:
|
|
217
|
+
lines.extend(["", "### Steps"])
|
|
218
|
+
for step in steps:
|
|
219
|
+
line = f"- {step['step_key']}: {step['status']}"
|
|
220
|
+
if step.get("error"):
|
|
221
|
+
line = f"{line} error={step['error']}"
|
|
222
|
+
lines.append(line)
|
|
223
|
+
return "\n".join(lines)
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def format_artifact(preview):
|
|
227
|
+
if not preview:
|
|
228
|
+
return None
|
|
229
|
+
if preview.get("missing"):
|
|
230
|
+
return None
|
|
231
|
+
content = preview.get("content") or ""
|
|
232
|
+
fence = "```"
|
|
233
|
+
if fence in content:
|
|
234
|
+
fence = "````"
|
|
235
|
+
lines = [
|
|
236
|
+
f"## Artifact {preview['artifact_type']} for {preview['task_id']}",
|
|
237
|
+
"",
|
|
238
|
+
_field("Path", preview.get("path")),
|
|
239
|
+
_field("Bytes", preview.get("bytes")),
|
|
240
|
+
_field("Truncated", bool(preview.get("truncated"))),
|
|
241
|
+
"",
|
|
242
|
+
f"{fence}text",
|
|
243
|
+
content,
|
|
244
|
+
fence,
|
|
245
|
+
]
|
|
246
|
+
return "\n".join(lines)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def _success(command, message):
|
|
250
|
+
return {
|
|
251
|
+
"ok": True,
|
|
252
|
+
"status": "ready",
|
|
253
|
+
"command": command,
|
|
254
|
+
"format": "markdown",
|
|
255
|
+
"message": message,
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def _not_found(safe_error):
|
|
260
|
+
return {"ok": False, "status": "not_found", "safe_error": safe_error}
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def _load_data(db_path, history_limit):
|
|
264
|
+
path = Path(db_path).expanduser()
|
|
265
|
+
if not path.is_file():
|
|
266
|
+
return None, {
|
|
267
|
+
"ok": False,
|
|
268
|
+
"status": "missing_database",
|
|
269
|
+
"safe_error": f"database not found: {path}",
|
|
270
|
+
}
|
|
271
|
+
try:
|
|
272
|
+
return web.build_dashboard_data(path, history_limit=history_limit), None
|
|
273
|
+
except sqlite3.Error as exc:
|
|
274
|
+
return None, {"ok": False, "status": "database_error", "safe_error": str(exc)}
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def main(argv=None):
|
|
278
|
+
parser = argparse.ArgumentParser()
|
|
279
|
+
parser.add_argument("--db", required=True)
|
|
280
|
+
parser.add_argument("--history-limit", type=int, default=20)
|
|
281
|
+
parser.add_argument("--max-bytes", type=int, default=8192)
|
|
282
|
+
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
283
|
+
|
|
284
|
+
subparsers.add_parser("status")
|
|
285
|
+
|
|
286
|
+
task_parser = subparsers.add_parser("task")
|
|
287
|
+
task_parser.add_argument("task_id")
|
|
288
|
+
|
|
289
|
+
run_parser = subparsers.add_parser("run")
|
|
290
|
+
run_parser.add_argument("run_id")
|
|
291
|
+
|
|
292
|
+
artifact_parser = subparsers.add_parser("artifact")
|
|
293
|
+
artifact_parser.add_argument("task_id")
|
|
294
|
+
artifact_parser.add_argument("artifact_type")
|
|
295
|
+
|
|
296
|
+
args = parser.parse_args(argv)
|
|
297
|
+
data, error = _load_data(args.db, args.history_limit)
|
|
298
|
+
if error:
|
|
299
|
+
return emit(error, exit_code=3)
|
|
300
|
+
|
|
301
|
+
if args.command == "status":
|
|
302
|
+
return emit(_success("status", format_status(data)))
|
|
303
|
+
|
|
304
|
+
if args.command == "task":
|
|
305
|
+
message = format_task(data, args.task_id)
|
|
306
|
+
if not message:
|
|
307
|
+
safe_error = f"task not found in dashboard history: {args.task_id}"
|
|
308
|
+
return emit(_not_found(safe_error), exit_code=3)
|
|
309
|
+
return emit(_success("task", message))
|
|
310
|
+
|
|
311
|
+
if args.command == "run":
|
|
312
|
+
message = format_run(data, args.run_id)
|
|
313
|
+
if not message:
|
|
314
|
+
safe_error = f"run not found in dashboard history: {args.run_id}"
|
|
315
|
+
return emit(_not_found(safe_error), exit_code=3)
|
|
316
|
+
return emit(_success("run", message))
|
|
317
|
+
|
|
318
|
+
if args.command == "artifact":
|
|
319
|
+
preview = web.load_artifact_preview(
|
|
320
|
+
Path(args.db).expanduser(),
|
|
321
|
+
args.task_id,
|
|
322
|
+
args.artifact_type,
|
|
323
|
+
max_bytes=args.max_bytes,
|
|
324
|
+
)
|
|
325
|
+
message = format_artifact(preview)
|
|
326
|
+
if not message:
|
|
327
|
+
safe_error = f"artifact not found: {args.task_id} {args.artifact_type}"
|
|
328
|
+
return emit(_not_found(safe_error), exit_code=3)
|
|
329
|
+
return emit(_success("artifact", message))
|
|
330
|
+
|
|
331
|
+
return emit(
|
|
332
|
+
{"ok": False, "status": "unsupported", "safe_error": args.command},
|
|
333
|
+
exit_code=3,
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
if __name__ == "__main__":
|
|
338
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|