getapo 0.2.0__tar.gz → 0.3.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.
- {getapo-0.2.0/src/getapo.egg-info → getapo-0.3.1}/PKG-INFO +1 -1
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/__init__.py +1 -1
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/db.py +109 -19
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/mcp_server.py +1 -2
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/app.py +46 -2
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/static/app.css +1 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/static/app.js +0 -23
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/_attachment_composer.html +1 -2
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/_work_status.html +3 -2
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/decision.html +3 -2
- {getapo-0.2.0 → getapo-0.3.1/src/getapo.egg-info}/PKG-INFO +1 -1
- {getapo-0.2.0 → getapo-0.3.1}/src/getapo.egg-info/SOURCES.txt +1 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_answering.py +20 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_background.py +6 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_browser.py +20 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_entry_points.py +1 -1
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_folder_identity.py +131 -0
- getapo-0.3.1/tests/test_station_read_api.py +131 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_task_page.py +46 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_wheel.py +1 -1
- {getapo-0.2.0 → getapo-0.3.1}/LICENSE +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/README.md +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/THIRD_PARTY_NOTICES.md +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/pyproject.toml +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/setup.cfg +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/__main__.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/changelog.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/claude_runtime.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/cli.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/config.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/credentials.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/installer.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/integrations/__init__.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/integrations/linear_client.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/integrations/linear_goals.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/integrations/sources.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/repo_writer.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/resources/guide.md +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/resources/hooks/session-decisions-nudge.sh +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/resources/skills/decisions/SKILL.md +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/transcripts.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/verify.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/__init__.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/static/fleet.js +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/static/live.js +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/static/notify.js +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/static/now.js +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/static/palette.js +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/static/round.js +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/_bulk.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/_icons.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/_macros.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/_merge_result.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/_now_item.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/_project_macros.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/_prompt_form.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/_resume_actions.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/_session_card.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/_work_location.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/_work_main.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/accept.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/all_activity.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/all_agents.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/all_decisions.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/all_overview.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/all_work.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/base.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/guide.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/now.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/outcome.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/project_activity.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/project_agents.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/project_decisions.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/project_overview.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/project_settings.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/project_work.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/projects_shell.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/report.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/round.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/search.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/session.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/settings.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/apo/web/templates/week.html +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/getapo.egg-info/dependency_links.txt +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/getapo.egg-info/entry_points.txt +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/getapo.egg-info/requires.txt +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/src/getapo.egg-info/top_level.txt +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_action_spec_render.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_actions.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_app.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_assets.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_autonomy_rules.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_bugs.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_bulk_and_views.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_cancel_button.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_changelog.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_checklist_back.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_claude_runtime.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_cli.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_cli_hooks.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_close_rows.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_config.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_continue.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_court.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_credentials.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_cross_site.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_dashboard_cli.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_db.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_decisions_skill.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_decisions_tab.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_delivery.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_digest.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_due_stuck.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_edit_undo.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_events.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_guide.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_installer.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_item_folder.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_item_page.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_layout_fixes.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_linear_client.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_linear_goals.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_live_stream.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_mcp_instructions.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_mcp_server.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_merge_branches.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_names.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_navigation.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_new_work.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_notes_labels.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_notify.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_now.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_now_leads.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_outcome_pages.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_outcomes.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_overview_order.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_palette_js.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_poll_loop.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_preview_paths.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_priority_due.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_project_home.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_project_identity.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_project_overview.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_project_scope.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_project_settings.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_projects.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_prompt_answers.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_quiet_pages.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_rank_and_deps.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_repo_writer.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_resume_folder.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_round.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_scheduled_resume.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_schema.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_schema_upgrade.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_search.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_session_page.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_session_states.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_session_verdict.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_sessions.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_small_fixes.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_snooze.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_sources.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_status_export.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_sync_errors.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_task_attempts.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_task_effort.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_transcripts.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_ui_review.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_usage_limit.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_verify.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_week_and_trend.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_weekly_report.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_work_items.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_work_location.py +0 -0
- {getapo-0.2.0 → getapo-0.3.1}/tests/test_work_tab.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: getapo
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: apo (AI Project Orchestration): a local dashboard and MCP server for Claude Code. Agents ask instead of stopping; you answer every project's questions from one queue.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://getapo.pages.dev/
|
|
@@ -20,7 +20,7 @@ from typing import Iterable
|
|
|
20
20
|
from apo import config
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
SCHEMA_VERSION =
|
|
23
|
+
SCHEMA_VERSION = 25
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
def data_version(conn: sqlite3.Connection) -> int:
|
|
@@ -343,6 +343,51 @@ def _drop_home_directory_registrations(conn: sqlite3.Connection) -> None:
|
|
|
343
343
|
conn.execute("DELETE FROM projects WHERE id = ?", (project_id,))
|
|
344
344
|
|
|
345
345
|
|
|
346
|
+
def _drop_folder_of_projects_registrations(conn: sqlite3.Connection) -> None:
|
|
347
|
+
"""Undo folders of projects (~/projects) auto-registered by a session started there.
|
|
348
|
+
Only ones nothing was ever filed against, as for ~ at 6. Their sessions go to the
|
|
349
|
+
folder each one ran in, registering it as any session start would now."""
|
|
350
|
+
for repo in conn.execute("SELECT * FROM repositories").fetchall():
|
|
351
|
+
if not _is_folder_of_projects(repo["local_path"]):
|
|
352
|
+
continue
|
|
353
|
+
project_id = repo["project_id"]
|
|
354
|
+
on_record = conn.execute(
|
|
355
|
+
"SELECT 1 FROM decision_requests WHERE repository_id = ? OR project_id = ? UNION ALL "
|
|
356
|
+
"SELECT 1 FROM outcomes WHERE project_id = ? UNION ALL "
|
|
357
|
+
"SELECT 1 FROM standing_rules WHERE project_id = ? LIMIT 1",
|
|
358
|
+
(repo["id"], project_id, project_id, project_id),
|
|
359
|
+
).fetchone()
|
|
360
|
+
if on_record:
|
|
361
|
+
continue
|
|
362
|
+
moving = [r["claude_session_id"] for r in conn.execute(
|
|
363
|
+
"SELECT claude_session_id FROM sessions WHERE repository_id = ?", (repo["id"],))]
|
|
364
|
+
conn.execute("UPDATE sessions SET repository_id = NULL, project_id = NULL WHERE repository_id = ?",
|
|
365
|
+
(repo["id"],))
|
|
366
|
+
conn.execute("DELETE FROM repositories WHERE id = ?", (repo["id"],))
|
|
367
|
+
project_gone = not conn.execute(
|
|
368
|
+
"SELECT 1 FROM repositories WHERE project_id = ?", (project_id,)).fetchone()
|
|
369
|
+
if project_gone:
|
|
370
|
+
moving += [r["claude_session_id"] for r in conn.execute(
|
|
371
|
+
"SELECT claude_session_id FROM sessions WHERE project_id = ?", (project_id,))]
|
|
372
|
+
conn.execute("UPDATE sessions SET repository_id = NULL, project_id = NULL WHERE project_id = ?",
|
|
373
|
+
(project_id,))
|
|
374
|
+
for claude_session_id in moving:
|
|
375
|
+
cwd = conn.execute("SELECT cwd FROM sessions WHERE claude_session_id = ?",
|
|
376
|
+
(claude_session_id,)).fetchone()["cwd"]
|
|
377
|
+
home = None
|
|
378
|
+
if cwd and Path(cwd).is_dir():
|
|
379
|
+
home = find_repository_by_path(conn, cwd) or _auto_register_repository_for_cwd(conn, cwd, commit=False)
|
|
380
|
+
if home is not None:
|
|
381
|
+
conn.execute("UPDATE sessions SET project_id = ?, repository_id = ? WHERE claude_session_id = ?",
|
|
382
|
+
(home["project_id"], home["id"], claude_session_id))
|
|
383
|
+
conn.execute("UPDATE events SET project_id = ? WHERE session_id = ? AND project_id = ?",
|
|
384
|
+
(home["project_id"] if home else None, claude_session_id, project_id))
|
|
385
|
+
if project_gone:
|
|
386
|
+
conn.execute("UPDATE events SET project_id = NULL WHERE project_id = ?", (project_id,))
|
|
387
|
+
conn.execute("DELETE FROM project_aliases WHERE project_id = ?", (project_id,))
|
|
388
|
+
conn.execute("DELETE FROM projects WHERE id = ?", (project_id,))
|
|
389
|
+
|
|
390
|
+
|
|
346
391
|
def _backfill_events(conn: sqlite3.Connection) -> None:
|
|
347
392
|
"""Rebuild the event history from the per-decision audit log and session rows,
|
|
348
393
|
in time order, so Activity isn't empty on day one."""
|
|
@@ -396,6 +441,7 @@ _DATA_MIGRATIONS = {
|
|
|
396
441
|
12: lambda conn: conn.execute("UPDATE decision_requests SET assignee = 'human' WHERE assignee IS NULL"),
|
|
397
442
|
14: lambda conn: rebuild_search_index(conn, commit=False),
|
|
398
443
|
18: _square_linear_closings,
|
|
444
|
+
25: _drop_folder_of_projects_registrations,
|
|
399
445
|
9: lambda conn: conn.execute(
|
|
400
446
|
"UPDATE decision_requests SET delivery = CASE "
|
|
401
447
|
"WHEN status = 'answered' THEN 'pending' "
|
|
@@ -696,14 +742,15 @@ def find_project(conn: sqlite3.Connection, name: str) -> sqlite3.Row | None:
|
|
|
696
742
|
return None
|
|
697
743
|
|
|
698
744
|
|
|
699
|
-
def get_or_create_project(conn: sqlite3.Connection, name: str) -> sqlite3.Row:
|
|
745
|
+
def get_or_create_project(conn: sqlite3.Connection, name: str, commit: bool = True) -> sqlite3.Row:
|
|
700
746
|
row = find_project(conn, name)
|
|
701
747
|
if row:
|
|
702
748
|
return row
|
|
703
749
|
conn.execute(
|
|
704
750
|
"INSERT INTO projects (name, created_at) VALUES (?, ?)", (name, _now())
|
|
705
751
|
)
|
|
706
|
-
|
|
752
|
+
if commit:
|
|
753
|
+
conn.commit()
|
|
707
754
|
return conn.execute("SELECT * FROM projects WHERE name = ?", (name,)).fetchone()
|
|
708
755
|
|
|
709
756
|
|
|
@@ -1637,12 +1684,15 @@ def _desc(iso_ts: str) -> tuple:
|
|
|
1637
1684
|
return tuple(-ord(ch) for ch in iso_ts)
|
|
1638
1685
|
|
|
1639
1686
|
|
|
1640
|
-
def create_repository(
|
|
1687
|
+
def create_repository(
|
|
1688
|
+
conn: sqlite3.Connection, project_id: int, name: str, local_path: str, commit: bool = True,
|
|
1689
|
+
) -> sqlite3.Row:
|
|
1641
1690
|
conn.execute(
|
|
1642
1691
|
"INSERT INTO repositories (project_id, name, local_path, created_at) VALUES (?, ?, ?, ?)",
|
|
1643
1692
|
(project_id, name, local_path, _now()),
|
|
1644
1693
|
)
|
|
1645
|
-
|
|
1694
|
+
if commit:
|
|
1695
|
+
conn.commit()
|
|
1646
1696
|
return conn.execute(
|
|
1647
1697
|
"SELECT * FROM repositories WHERE project_id = ? AND name = ?", (project_id, name)
|
|
1648
1698
|
).fetchone()
|
|
@@ -2282,19 +2332,24 @@ def work_location_phrase(location: dict | None) -> str | None:
|
|
|
2282
2332
|
return f"{where} — {'merged' if location['merged'] else 'not merged'} into `{default}`"
|
|
2283
2333
|
|
|
2284
2334
|
|
|
2335
|
+
def with_work_state(conn: sqlite3.Connection, items: list[dict], project_id: int | None = None) -> list[dict]:
|
|
2336
|
+
"""Adds blocked_by (open_blockers) and claim_stale (in stuck_claims) to each item,
|
|
2337
|
+
in place. project_id only narrows the stuck-claims lookup."""
|
|
2338
|
+
stale = {t["id"] for t in stuck_claims(conn, project_id)}
|
|
2339
|
+
for item in items:
|
|
2340
|
+
item["blocked_by"] = open_blockers(conn, item["id"])
|
|
2341
|
+
item["claim_stale"] = item["id"] in stale
|
|
2342
|
+
return items
|
|
2343
|
+
|
|
2344
|
+
|
|
2285
2345
|
def list_tasks(conn: sqlite3.Connection, project_id: int) -> list[dict]:
|
|
2286
|
-
"""Agent tasks not done yet, ready ones first."""
|
|
2346
|
+
"""Agent tasks not done yet, ready ones first, with_work_state."""
|
|
2287
2347
|
rows = conn.execute(
|
|
2288
2348
|
"SELECT id FROM decision_requests WHERE project_id = ? AND kind = 'task' AND status IN ('open', 'in_progress') "
|
|
2289
2349
|
"ORDER BY status = 'in_progress', work_rank IS NULL, work_rank, COALESCE(outcome_id, 0), COALESCE(sort_order, 0), id",
|
|
2290
2350
|
(project_id,),
|
|
2291
2351
|
).fetchall()
|
|
2292
|
-
|
|
2293
|
-
for row in rows:
|
|
2294
|
-
task = get_decision_request(conn, row["id"])
|
|
2295
|
-
task["blocked_by"] = open_blockers(conn, task["id"])
|
|
2296
|
-
tasks.append(task)
|
|
2297
|
-
return tasks
|
|
2352
|
+
return with_work_state(conn, [get_decision_request(conn, row["id"]) for row in rows], project_id)
|
|
2298
2353
|
|
|
2299
2354
|
|
|
2300
2355
|
def cancel_request(conn: sqlite3.Connection, item_id: int, reason: str) -> bool:
|
|
@@ -3450,7 +3505,9 @@ def get_repository(conn: sqlite3.Connection, repository_id: int) -> sqlite3.Row
|
|
|
3450
3505
|
return conn.execute("SELECT * FROM repositories WHERE id = ?", (repository_id,)).fetchone()
|
|
3451
3506
|
|
|
3452
3507
|
|
|
3453
|
-
def get_or_create_repository(
|
|
3508
|
+
def get_or_create_repository(
|
|
3509
|
+
conn: sqlite3.Connection, project_id: int, local_path: str, commit: bool = True,
|
|
3510
|
+
) -> sqlite3.Row:
|
|
3454
3511
|
row = conn.execute(
|
|
3455
3512
|
"SELECT * FROM repositories WHERE project_id = ? AND local_path = ?",
|
|
3456
3513
|
(project_id, local_path),
|
|
@@ -3463,7 +3520,7 @@ def get_or_create_repository(conn: sqlite3.Connection, project_id: int, local_pa
|
|
|
3463
3520
|
).fetchone()
|
|
3464
3521
|
if collision:
|
|
3465
3522
|
name = local_path
|
|
3466
|
-
return create_repository(conn, project_id, name, local_path)
|
|
3523
|
+
return create_repository(conn, project_id, name, local_path, commit=commit)
|
|
3467
3524
|
|
|
3468
3525
|
|
|
3469
3526
|
def get_repository_for_project(conn: sqlite3.Connection, project_id: int) -> sqlite3.Row | None:
|
|
@@ -3547,7 +3604,7 @@ def ensure_repository_for_project(conn: sqlite3.Connection, project_id: int, hin
|
|
|
3547
3604
|
owner = find_repository_by_path(conn, hint_path)
|
|
3548
3605
|
if owner is not None:
|
|
3549
3606
|
return owner["id"] if owner["project_id"] == project_id else None
|
|
3550
|
-
if _is_home_or_above(hint_path):
|
|
3607
|
+
if _is_home_or_above(hint_path) or _is_folder_of_projects(hint_path):
|
|
3551
3608
|
return None
|
|
3552
3609
|
has_any_repository = conn.execute(
|
|
3553
3610
|
"SELECT 1 FROM repositories WHERE project_id = ?", (project_id,)
|
|
@@ -3913,6 +3970,16 @@ def dispatch_in_flight(conn: sqlite3.Connection, decision: dict) -> bool:
|
|
|
3913
3970
|
).fetchone() is None
|
|
3914
3971
|
|
|
3915
3972
|
|
|
3973
|
+
def dispatched_session(conn: sqlite3.Connection, decision: dict) -> dict | None:
|
|
3974
|
+
"""The session a background start on this item became, once `claude agents` has
|
|
3975
|
+
reported it under the agent id the start returned."""
|
|
3976
|
+
if not decision.get("dispatch_agent_id"):
|
|
3977
|
+
return None
|
|
3978
|
+
row = conn.execute("SELECT * FROM sessions WHERE agent_id = ? ORDER BY last_seen_at DESC LIMIT 1",
|
|
3979
|
+
(decision["dispatch_agent_id"],)).fetchone()
|
|
3980
|
+
return dict(row) if row else None
|
|
3981
|
+
|
|
3982
|
+
|
|
3916
3983
|
def get_session(conn: sqlite3.Connection, claude_session_id: str) -> dict | None:
|
|
3917
3984
|
row = conn.execute("SELECT * FROM sessions WHERE claude_session_id = ?", (claude_session_id,)).fetchone()
|
|
3918
3985
|
return dict(row) if row else None
|
|
@@ -3978,6 +4045,24 @@ def git_root(path: str) -> str | None:
|
|
|
3978
4045
|
return None
|
|
3979
4046
|
|
|
3980
4047
|
|
|
4048
|
+
def _is_repository_root(folder: Path) -> bool:
|
|
4049
|
+
marker = folder / ".git"
|
|
4050
|
+
return (marker / "HEAD").is_file() or marker.is_file()
|
|
4051
|
+
|
|
4052
|
+
|
|
4053
|
+
def _is_folder_of_projects(path: str) -> bool:
|
|
4054
|
+
"""A folder outside any git repository that holds git repositories (~/projects,
|
|
4055
|
+
~/code) is where projects live, not one. Registered, it would claim every project
|
|
4056
|
+
started in it before its `git init`, and the answers to whatever those file."""
|
|
4057
|
+
if git_root(path) is not None:
|
|
4058
|
+
return False
|
|
4059
|
+
try:
|
|
4060
|
+
with os.scandir(path) as entries:
|
|
4061
|
+
return any(entry.is_dir() and _is_repository_root(Path(entry.path)) for entry in entries)
|
|
4062
|
+
except OSError:
|
|
4063
|
+
return False
|
|
4064
|
+
|
|
4065
|
+
|
|
3981
4066
|
def find_repository_by_path(conn: sqlite3.Connection, path: str) -> dict | None:
|
|
3982
4067
|
"""Match a filesystem path against a registered repository's local_path, by exact
|
|
3983
4068
|
match or by the repository being an ancestor directory of path — so starting a
|
|
@@ -4870,23 +4955,28 @@ def _turn_guard(event_at: str) -> tuple[str, tuple]:
|
|
|
4870
4955
|
return "(last_stop_at IS NULL OR last_stop_at <= ?)", (event_at,)
|
|
4871
4956
|
|
|
4872
4957
|
|
|
4873
|
-
def _auto_register_repository_for_cwd(
|
|
4958
|
+
def _auto_register_repository_for_cwd(
|
|
4959
|
+
conn: sqlite3.Connection, cwd: str, commit: bool = True,
|
|
4960
|
+
) -> sqlite3.Row | None:
|
|
4874
4961
|
"""A session whose cwd matches no registered repository gets one created on the
|
|
4875
4962
|
spot, named from the folder's own basename — the same name a human would use to
|
|
4876
4963
|
refer to it — rather than sitting in the fleet view's "Unregistered" bucket
|
|
4877
4964
|
forever just because nothing's filed a decision from that project yet. The folder
|
|
4878
4965
|
is the git repository root when there is one (a session started in src/api is the
|
|
4879
4966
|
repo's, and a worktree is its main repo's). Attaches to an existing same-name
|
|
4880
|
-
project instead of making a duplicate. None for the home directory or above
|
|
4967
|
+
project instead of making a duplicate. None for the home directory or above, and
|
|
4968
|
+
for a folder of projects."""
|
|
4881
4969
|
if _is_home_or_above(cwd):
|
|
4882
4970
|
return None
|
|
4883
4971
|
folder = git_root(cwd) or cwd.rstrip("/")
|
|
4884
4972
|
repository = find_repository_by_path(conn, folder)
|
|
4885
4973
|
if repository is not None:
|
|
4886
4974
|
return repository
|
|
4975
|
+
if _is_folder_of_projects(folder):
|
|
4976
|
+
return None
|
|
4887
4977
|
name = os.path.basename(folder) or folder
|
|
4888
|
-
project = get_or_create_project(conn, name)
|
|
4889
|
-
return get_or_create_repository(conn, project["id"], folder)
|
|
4978
|
+
project = get_or_create_project(conn, name, commit=commit)
|
|
4979
|
+
return get_or_create_repository(conn, project["id"], folder, commit=commit)
|
|
4890
4980
|
|
|
4891
4981
|
|
|
4892
4982
|
def _repository_for_session_cwd(conn: sqlite3.Connection, cwd: str | None):
|
|
@@ -375,11 +375,10 @@ def list_tasks(project: str | None = None) -> list[dict]:
|
|
|
375
375
|
proj = _project_for(conn, project)
|
|
376
376
|
if proj is None:
|
|
377
377
|
return []
|
|
378
|
-
stale = {t["id"] for t in db.stuck_claims(conn, proj["id"])}
|
|
379
378
|
return [
|
|
380
379
|
{"id": t["id"], "title": t["title"], "detail": t["question"], "status": t["status"],
|
|
381
380
|
"claimed_by_session_id": t["claimed_by_session_id"], "outcome_id": t["outcome_id"],
|
|
382
|
-
"blocked_by": t["blocked_by"], "claim_stale": t["
|
|
381
|
+
"blocked_by": t["blocked_by"], "claim_stale": t["claim_stale"]}
|
|
383
382
|
for t in db.list_tasks(conn, proj["id"])
|
|
384
383
|
]
|
|
385
384
|
|
|
@@ -2376,6 +2376,7 @@ def decision_detail(request: Request, decision_id: int, unverified: str | None =
|
|
|
2376
2376
|
"effort_text": db.effort_text(db.task_effort(conn, decision_id)),
|
|
2377
2377
|
"claim_stale": decision["kind"] == "task" and any(t["id"] == decision_id for t in db.stuck_claims(conn)),
|
|
2378
2378
|
"dispatch_in_flight": db.dispatch_in_flight(conn, decision),
|
|
2379
|
+
"watch_href": _watch_href(conn, decision),
|
|
2379
2380
|
"folders": folders,
|
|
2380
2381
|
"dependencies": db.item_dependencies(conn, decision_id),
|
|
2381
2382
|
"dependency_candidates": db.dependency_candidates(conn, decision_id)
|
|
@@ -2387,6 +2388,18 @@ def decision_detail(request: Request, decision_id: int, unverified: str | None =
|
|
|
2387
2388
|
)
|
|
2388
2389
|
|
|
2389
2390
|
|
|
2391
|
+
def _watch_href(conn, decision: dict) -> str | None:
|
|
2392
|
+
"""Where the background session started on this item is working: its card on the
|
|
2393
|
+
project's Agents tab, or its own page once it has ended."""
|
|
2394
|
+
if not decision.get("dispatched_at"):
|
|
2395
|
+
return None
|
|
2396
|
+
session = db.dispatched_session(conn, decision)
|
|
2397
|
+
if session and session["status"] == "ended":
|
|
2398
|
+
return f"/sessions/{session['id']}"
|
|
2399
|
+
agents = f"/projects/{decision['project_id']}/agents"
|
|
2400
|
+
return f"{agents}#session-card-{session['id']}" if session else agents
|
|
2401
|
+
|
|
2402
|
+
|
|
2390
2403
|
def _rule_draft(decision: dict) -> str | None:
|
|
2391
2404
|
"""A first wording for "make this a standing rule", from an answered decision."""
|
|
2392
2405
|
if decision["kind"] != "decision" or not decision.get("answer_text") or decision.get("answer_source") == "archive":
|
|
@@ -2487,7 +2500,8 @@ async def answer_decision(
|
|
|
2487
2500
|
if not db.answer_decision_request(conn, decision_id, text, answer_kind=kind, answer_option=chosen):
|
|
2488
2501
|
db.clear_undo(conn, decision_id)
|
|
2489
2502
|
return RedirectResponse(back, status_code=303)
|
|
2490
|
-
return _with_undo(RedirectResponse(back, status_code=303), decision_id,
|
|
2503
|
+
return _with_undo(RedirectResponse(back, status_code=303), decision_id,
|
|
2504
|
+
"Answer sent — it's been written to the repo for the next session to pick up")
|
|
2491
2505
|
|
|
2492
2506
|
|
|
2493
2507
|
def _attachment_json(attachment: dict) -> dict:
|
|
@@ -2597,7 +2611,37 @@ def api_create_decision(payload: dict):
|
|
|
2597
2611
|
def api_list_decisions(project: str | None = None, status: str | None = None):
|
|
2598
2612
|
conn = db.get_connection()
|
|
2599
2613
|
rows = db.list_decision_requests(conn, project_name=project, status=status)
|
|
2600
|
-
return [dict(row) for row in rows]
|
|
2614
|
+
return db.with_work_state(conn, [dict(row) for row in rows])
|
|
2615
|
+
|
|
2616
|
+
|
|
2617
|
+
@app.get("/api/outcomes")
|
|
2618
|
+
def api_list_outcomes(project: str | None = None, status: str | None = None):
|
|
2619
|
+
"""Goals with their steps. status: one of OUTCOME_STATUSES, or "all"; by default
|
|
2620
|
+
the live ones (active, paused), as the dashboard shows them."""
|
|
2621
|
+
if status == "all":
|
|
2622
|
+
statuses = db.OUTCOME_STATUSES
|
|
2623
|
+
elif status is None:
|
|
2624
|
+
statuses = ("active", "paused")
|
|
2625
|
+
elif status in db.OUTCOME_STATUSES:
|
|
2626
|
+
statuses = (status,)
|
|
2627
|
+
else:
|
|
2628
|
+
raise HTTPException(status_code=400, detail=f"status must be all or one of {', '.join(db.OUTCOME_STATUSES)}")
|
|
2629
|
+
conn = db.get_connection()
|
|
2630
|
+
project_id = None
|
|
2631
|
+
if project:
|
|
2632
|
+
found = db.find_project(conn, project)
|
|
2633
|
+
if found is None:
|
|
2634
|
+
return []
|
|
2635
|
+
project_id = found["id"]
|
|
2636
|
+
return [
|
|
2637
|
+
{"id": o["id"], "project": o["project_name"], "title": o["title"], "status": o["status"],
|
|
2638
|
+
"done_when": o["done_when"], "description": o["description"], "due_on": o["due_on"],
|
|
2639
|
+
"created_at": o["created_at"], "updated_at": o["updated_at"], "achieved_at": o["achieved_at"],
|
|
2640
|
+
"done": o["progress"]["done"], "total": o["progress"]["total"],
|
|
2641
|
+
"steps": [{"id": s["id"], "title": s["title"], "owner": s["owner"], "kind": s["kind"], "status": s["status"],
|
|
2642
|
+
"done": s["done"], "blocked_by": s["blocked_by"]} for s in o["progress"]["steps"]]}
|
|
2643
|
+
for o in db.list_outcomes(conn, project_id=project_id, statuses=statuses)
|
|
2644
|
+
]
|
|
2601
2645
|
|
|
2602
2646
|
|
|
2603
2647
|
@app.patch("/api/decisions/{decision_id}")
|
|
@@ -518,6 +518,7 @@ a.badge:hover { border-color: var(--tone); }
|
|
|
518
518
|
transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
|
|
519
519
|
}
|
|
520
520
|
.session-card:hover { border-color: var(--border-strong); }
|
|
521
|
+
.session-card:target { border-color: var(--accent-border); box-shadow: var(--shadow-sm), 0 0 0 3px var(--accent-soft); scroll-margin-top: var(--s-8); }
|
|
521
522
|
.session-card.status-blocked_decision { border-color: var(--warning-border); box-shadow: var(--shadow-sm), 0 0 0 3px color-mix(in srgb, var(--warning-soft) 70%, transparent); }
|
|
522
523
|
.session-card.status-blocked_action { border-color: var(--violet-border); box-shadow: var(--shadow-sm), 0 0 0 3px color-mix(in srgb, var(--violet-soft) 70%, transparent); }
|
|
523
524
|
.session-card.status-ended { background: transparent; box-shadow: none; }
|
|
@@ -67,27 +67,6 @@
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
// A message to show after a POST → redirect lands, keyed to the page it
|
|
71
|
-
// should land on so an unrelated page (or an error response) never shows it.
|
|
72
|
-
var FLASH_KEY = "apo-flash";
|
|
73
|
-
|
|
74
|
-
function setFlash(message, path) {
|
|
75
|
-
try { sessionStorage.setItem(FLASH_KEY, JSON.stringify({ message: message, path: path })); } catch (e) {}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function consumeFlash() {
|
|
79
|
-
var raw;
|
|
80
|
-
try {
|
|
81
|
-
raw = sessionStorage.getItem(FLASH_KEY);
|
|
82
|
-
sessionStorage.removeItem(FLASH_KEY);
|
|
83
|
-
} catch (e) { return; }
|
|
84
|
-
if (!raw) return;
|
|
85
|
-
try {
|
|
86
|
-
var flash = JSON.parse(raw);
|
|
87
|
-
if (!flash.path || flash.path === location.pathname) toast(flash.message, "success");
|
|
88
|
-
} catch (e) {}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
70
|
// Done, Cancel, Snooze and answers leave a short-lived cookie naming the item; show an
|
|
92
71
|
// Undo toast for it once, wherever the redirect landed.
|
|
93
72
|
function consumeUndo() {
|
|
@@ -174,7 +153,6 @@
|
|
|
174
153
|
// After the browser has built the form data: a button disabled during the
|
|
175
154
|
// submit event is left out of it, and the clicked button IS the answer.
|
|
176
155
|
setTimeout(function () { setLoading(button, opts.loadingText || form.dataset.loadingText); }, 0);
|
|
177
|
-
if (form.dataset.flash) setFlash(form.dataset.flash, form.dataset.flashPath);
|
|
178
156
|
// No preventDefault: the browser's normal POST+redirect navigation still
|
|
179
157
|
// happens, this just gives the user feedback before the page unloads.
|
|
180
158
|
});
|
|
@@ -1163,7 +1141,6 @@
|
|
|
1163
1141
|
ensureLiveRegions();
|
|
1164
1142
|
initThemeToggle();
|
|
1165
1143
|
autoEnhance(document);
|
|
1166
|
-
consumeFlash();
|
|
1167
1144
|
consumeUndo();
|
|
1168
1145
|
openHashTarget();
|
|
1169
1146
|
});
|
|
@@ -37,8 +37,7 @@
|
|
|
37
37
|
{% if composer_thumb_compact %}data-thumb-size="compact"{% endif %}>
|
|
38
38
|
{% if composer_editable %}
|
|
39
39
|
<form method="post" action="/decisions/{{ composer_decision_id }}/answer" data-enhance="indicate" data-secret-check
|
|
40
|
-
data-loading-text="Sending…"
|
|
41
|
-
data-flash-path="/decisions/{{ composer_decision_id }}">
|
|
40
|
+
data-loading-text="Sending…">
|
|
42
41
|
{% if composer_next %}<input type="hidden" name="next" value="{{ composer_next }}">{% endif %}
|
|
43
42
|
{% set d = composer_decision %}
|
|
44
43
|
{% set is_action_composer = d and d.kind == "action" %}
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
{% if decision.dispatched_at %}
|
|
39
39
|
<p class="delivery">
|
|
40
40
|
{{ icon("terminal") }}
|
|
41
|
-
<span>Started in the background {{ decision.dispatched_at | ago }}
|
|
42
|
-
<
|
|
41
|
+
<span>Started in the background {{ decision.dispatched_at | ago }} —
|
|
42
|
+
<a class="watch-agent" href="{{ watch_href }}">watch it in Agents</a>{% if decision.dispatch_agent_id %},
|
|
43
|
+
or <code>claude attach {{ decision.dispatch_agent_id }}</code>{% endif %}.</span>
|
|
43
44
|
</p>
|
|
44
45
|
{% endif %}
|
|
45
46
|
{% if launch_error %}
|
|
@@ -118,8 +118,9 @@
|
|
|
118
118
|
{% if decision.status == 'answered' and decision.dispatched_at %}
|
|
119
119
|
<p class="delivery">
|
|
120
120
|
{{ icon("terminal") }}
|
|
121
|
-
<span>Applying in background since {{ decision.dispatched_at | ago }}
|
|
122
|
-
<
|
|
121
|
+
<span>Applying in background since {{ decision.dispatched_at | ago }} —
|
|
122
|
+
<a class="watch-agent" href="{{ watch_href }}">watch it in Agents</a>{% if decision.dispatch_agent_id %},
|
|
123
|
+
or <code>claude attach {{ decision.dispatch_agent_id }}</code>{% endif %}.</span>
|
|
123
124
|
</p>
|
|
124
125
|
{% endif %}
|
|
125
126
|
{% if apply and not apply.error and transit and not transit.live_session %}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: getapo
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: apo (AI Project Orchestration): a local dashboard and MCP server for Claude Code. Agents ask instead of stopping; you answer every project's questions from one queue.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://getapo.pages.dev/
|
|
@@ -119,6 +119,26 @@ def test_the_server_refuses_a_secret_shaped_answer_unless_confirmed(db_path):
|
|
|
119
119
|
assert db.get_decision_request(conn, decision_id)["answer_text"].startswith("sk_live_")
|
|
120
120
|
|
|
121
121
|
|
|
122
|
+
def test_an_answer_leaves_one_undo_toast_that_says_where_it_went(db_path):
|
|
123
|
+
"""The Undo toast is the only confirmation: the form no longer queues a second one."""
|
|
124
|
+
import json
|
|
125
|
+
from urllib.parse import unquote
|
|
126
|
+
|
|
127
|
+
from fastapi.testclient import TestClient
|
|
128
|
+
|
|
129
|
+
from apo.web import app
|
|
130
|
+
|
|
131
|
+
client = TestClient(app.app)
|
|
132
|
+
conn = db.get_connection()
|
|
133
|
+
decision_id = _decision(conn)
|
|
134
|
+
page = client.get(f"/decisions/{decision_id}").text
|
|
135
|
+
assert "data-flash=" not in page
|
|
136
|
+
|
|
137
|
+
r = client.post(f"/decisions/{decision_id}/answer", data={"answer_text": "Postgres"}, follow_redirects=False)
|
|
138
|
+
label = json.loads(unquote(r.cookies["apo_undo"]))["label"]
|
|
139
|
+
assert label.startswith("Answer sent") and "written to the repo" in label
|
|
140
|
+
|
|
141
|
+
|
|
122
142
|
def test_answer_forms_carry_the_secret_check(db_path):
|
|
123
143
|
from fastapi.testclient import TestClient
|
|
124
144
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
start one on a work item, stop one. Only answers given locally may
|
|
3
3
|
start an agent on their own — a Linear comment needs one dashboard click first,
|
|
4
4
|
which is the boundary that retired the old dispatcher."""
|
|
5
|
+
import re
|
|
5
6
|
import stat
|
|
6
7
|
from pathlib import Path
|
|
7
8
|
|
|
@@ -140,6 +141,11 @@ def test_apply_route_launches_and_records_the_dispatch(client, fake_claude, tmp_
|
|
|
140
141
|
verbs = [e["verb"] for e in db.list_events(conn, decision_id=decision_id)]
|
|
141
142
|
assert "delivery.dispatched" in verbs
|
|
142
143
|
assert "Applying in background" in client.get(f"/decisions/{decision_id}").text
|
|
144
|
+
db.register_session(conn, "sess-1", str(tmp_path))
|
|
145
|
+
db.reconcile_live_sessions(conn, [{"id": "3f2a9c1b", "kind": "background", "sessionId": "sess-1",
|
|
146
|
+
"cwd": str(tmp_path), "status": "busy"}])
|
|
147
|
+
card = f'/projects/{decision["project_id"]}/agents#session-card-{db.get_session(conn, "sess-1")["id"]}'
|
|
148
|
+
assert re.search(rf'<a class="watch-agent" href="{card}"', client.get(f"/decisions/{decision_id}").text)
|
|
143
149
|
|
|
144
150
|
|
|
145
151
|
def test_apply_route_does_not_launch_twice(client, fake_claude, tmp_path):
|
|
@@ -125,6 +125,26 @@ def test_clicking_the_first_option_answers_with_it(server, tmp_path):
|
|
|
125
125
|
assert db.get_decision_request(db.get_connection(), decision_id)["answer_text"].startswith("Chose option 1: Postgres")
|
|
126
126
|
|
|
127
127
|
|
|
128
|
+
def test_answering_shows_one_toast_with_the_full_message_and_undo(server, tmp_path):
|
|
129
|
+
"""The form queued its own "Answer sent — written to the repo" toast and the server
|
|
130
|
+
sent an "Answer sent." Undo toast, so every answer showed two."""
|
|
131
|
+
conn = db.get_connection()
|
|
132
|
+
decision_id = db.create_decision_request(conn, project_id=_project(conn, tmp_path)["id"], title="Queue",
|
|
133
|
+
question="Which?", options=[{"label": "Postgres"}, {"label": "SQLite"}])
|
|
134
|
+
|
|
135
|
+
async def act(js):
|
|
136
|
+
await js('document.querySelector(\'button[name="option"][value="0"]\').click()')
|
|
137
|
+
await asyncio.sleep(2)
|
|
138
|
+
return await js("Array.from(document.querySelectorAll('#app-toast-stack .toast'))"
|
|
139
|
+
".map(t => ({text: t.querySelector('.toast-msg').textContent, undo: !!t.querySelector('.toast-undo')}))")
|
|
140
|
+
|
|
141
|
+
toasts = _in_browser(f"{server}/decisions/{decision_id}", 'button[name="option"][value="0"]', act)
|
|
142
|
+
|
|
143
|
+
assert len(toasts) == 1, toasts
|
|
144
|
+
assert toasts[0]["undo"]
|
|
145
|
+
assert "written to the repo" in toasts[0]["text"]
|
|
146
|
+
|
|
147
|
+
|
|
128
148
|
def test_clicking_done_on_an_action_marks_it_done(server, tmp_path):
|
|
129
149
|
conn = db.get_connection()
|
|
130
150
|
action_id = db.create_action_request(conn, project_id=_project(conn, tmp_path)["id"], title="Add DNS",
|
|
@@ -27,7 +27,7 @@ def test_version(db_path):
|
|
|
27
27
|
result = _run(["-m", "apo", "--version"], _env(db_path))
|
|
28
28
|
|
|
29
29
|
assert result.stdout.strip() == f"apo {apo.__version__}"
|
|
30
|
-
assert apo.__version__ == "0.
|
|
30
|
+
assert apo.__version__ == "0.3.1"
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
def test_there_is_no_ado_command_any_more():
|