getapo 0.2.0__tar.gz → 0.3.0__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.
Files changed (176) hide show
  1. {getapo-0.2.0/src/getapo.egg-info → getapo-0.3.0}/PKG-INFO +1 -1
  2. {getapo-0.2.0 → getapo-0.3.0}/src/apo/__init__.py +1 -1
  3. {getapo-0.2.0 → getapo-0.3.0}/src/apo/db.py +22 -7
  4. {getapo-0.2.0 → getapo-0.3.0}/src/apo/mcp_server.py +1 -2
  5. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/app.py +44 -1
  6. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/static/app.css +1 -0
  7. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/_work_status.html +3 -2
  8. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/decision.html +3 -2
  9. {getapo-0.2.0 → getapo-0.3.0/src/getapo.egg-info}/PKG-INFO +1 -1
  10. {getapo-0.2.0 → getapo-0.3.0}/src/getapo.egg-info/SOURCES.txt +1 -0
  11. {getapo-0.2.0 → getapo-0.3.0}/tests/test_background.py +6 -0
  12. {getapo-0.2.0 → getapo-0.3.0}/tests/test_entry_points.py +1 -1
  13. getapo-0.3.0/tests/test_station_read_api.py +131 -0
  14. {getapo-0.2.0 → getapo-0.3.0}/tests/test_task_page.py +46 -0
  15. {getapo-0.2.0 → getapo-0.3.0}/tests/test_wheel.py +1 -1
  16. {getapo-0.2.0 → getapo-0.3.0}/LICENSE +0 -0
  17. {getapo-0.2.0 → getapo-0.3.0}/README.md +0 -0
  18. {getapo-0.2.0 → getapo-0.3.0}/THIRD_PARTY_NOTICES.md +0 -0
  19. {getapo-0.2.0 → getapo-0.3.0}/pyproject.toml +0 -0
  20. {getapo-0.2.0 → getapo-0.3.0}/setup.cfg +0 -0
  21. {getapo-0.2.0 → getapo-0.3.0}/src/apo/__main__.py +0 -0
  22. {getapo-0.2.0 → getapo-0.3.0}/src/apo/changelog.py +0 -0
  23. {getapo-0.2.0 → getapo-0.3.0}/src/apo/claude_runtime.py +0 -0
  24. {getapo-0.2.0 → getapo-0.3.0}/src/apo/cli.py +0 -0
  25. {getapo-0.2.0 → getapo-0.3.0}/src/apo/config.py +0 -0
  26. {getapo-0.2.0 → getapo-0.3.0}/src/apo/credentials.py +0 -0
  27. {getapo-0.2.0 → getapo-0.3.0}/src/apo/installer.py +0 -0
  28. {getapo-0.2.0 → getapo-0.3.0}/src/apo/integrations/__init__.py +0 -0
  29. {getapo-0.2.0 → getapo-0.3.0}/src/apo/integrations/linear_client.py +0 -0
  30. {getapo-0.2.0 → getapo-0.3.0}/src/apo/integrations/linear_goals.py +0 -0
  31. {getapo-0.2.0 → getapo-0.3.0}/src/apo/integrations/sources.py +0 -0
  32. {getapo-0.2.0 → getapo-0.3.0}/src/apo/repo_writer.py +0 -0
  33. {getapo-0.2.0 → getapo-0.3.0}/src/apo/resources/guide.md +0 -0
  34. {getapo-0.2.0 → getapo-0.3.0}/src/apo/resources/hooks/session-decisions-nudge.sh +0 -0
  35. {getapo-0.2.0 → getapo-0.3.0}/src/apo/resources/skills/decisions/SKILL.md +0 -0
  36. {getapo-0.2.0 → getapo-0.3.0}/src/apo/transcripts.py +0 -0
  37. {getapo-0.2.0 → getapo-0.3.0}/src/apo/verify.py +0 -0
  38. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/__init__.py +0 -0
  39. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/static/app.js +0 -0
  40. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/static/fleet.js +0 -0
  41. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/static/live.js +0 -0
  42. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/static/notify.js +0 -0
  43. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/static/now.js +0 -0
  44. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/static/palette.js +0 -0
  45. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/static/round.js +0 -0
  46. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/_attachment_composer.html +0 -0
  47. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/_bulk.html +0 -0
  48. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/_icons.html +0 -0
  49. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/_macros.html +0 -0
  50. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/_merge_result.html +0 -0
  51. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/_now_item.html +0 -0
  52. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/_project_macros.html +0 -0
  53. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/_prompt_form.html +0 -0
  54. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/_resume_actions.html +0 -0
  55. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/_session_card.html +0 -0
  56. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/_work_location.html +0 -0
  57. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/_work_main.html +0 -0
  58. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/accept.html +0 -0
  59. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/all_activity.html +0 -0
  60. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/all_agents.html +0 -0
  61. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/all_decisions.html +0 -0
  62. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/all_overview.html +0 -0
  63. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/all_work.html +0 -0
  64. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/base.html +0 -0
  65. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/guide.html +0 -0
  66. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/now.html +0 -0
  67. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/outcome.html +0 -0
  68. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/project_activity.html +0 -0
  69. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/project_agents.html +0 -0
  70. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/project_decisions.html +0 -0
  71. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/project_overview.html +0 -0
  72. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/project_settings.html +0 -0
  73. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/project_work.html +0 -0
  74. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/projects_shell.html +0 -0
  75. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/report.html +0 -0
  76. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/round.html +0 -0
  77. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/search.html +0 -0
  78. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/session.html +0 -0
  79. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/settings.html +0 -0
  80. {getapo-0.2.0 → getapo-0.3.0}/src/apo/web/templates/week.html +0 -0
  81. {getapo-0.2.0 → getapo-0.3.0}/src/getapo.egg-info/dependency_links.txt +0 -0
  82. {getapo-0.2.0 → getapo-0.3.0}/src/getapo.egg-info/entry_points.txt +0 -0
  83. {getapo-0.2.0 → getapo-0.3.0}/src/getapo.egg-info/requires.txt +0 -0
  84. {getapo-0.2.0 → getapo-0.3.0}/src/getapo.egg-info/top_level.txt +0 -0
  85. {getapo-0.2.0 → getapo-0.3.0}/tests/test_action_spec_render.py +0 -0
  86. {getapo-0.2.0 → getapo-0.3.0}/tests/test_actions.py +0 -0
  87. {getapo-0.2.0 → getapo-0.3.0}/tests/test_answering.py +0 -0
  88. {getapo-0.2.0 → getapo-0.3.0}/tests/test_app.py +0 -0
  89. {getapo-0.2.0 → getapo-0.3.0}/tests/test_assets.py +0 -0
  90. {getapo-0.2.0 → getapo-0.3.0}/tests/test_autonomy_rules.py +0 -0
  91. {getapo-0.2.0 → getapo-0.3.0}/tests/test_browser.py +0 -0
  92. {getapo-0.2.0 → getapo-0.3.0}/tests/test_bugs.py +0 -0
  93. {getapo-0.2.0 → getapo-0.3.0}/tests/test_bulk_and_views.py +0 -0
  94. {getapo-0.2.0 → getapo-0.3.0}/tests/test_cancel_button.py +0 -0
  95. {getapo-0.2.0 → getapo-0.3.0}/tests/test_changelog.py +0 -0
  96. {getapo-0.2.0 → getapo-0.3.0}/tests/test_checklist_back.py +0 -0
  97. {getapo-0.2.0 → getapo-0.3.0}/tests/test_claude_runtime.py +0 -0
  98. {getapo-0.2.0 → getapo-0.3.0}/tests/test_cli.py +0 -0
  99. {getapo-0.2.0 → getapo-0.3.0}/tests/test_cli_hooks.py +0 -0
  100. {getapo-0.2.0 → getapo-0.3.0}/tests/test_close_rows.py +0 -0
  101. {getapo-0.2.0 → getapo-0.3.0}/tests/test_config.py +0 -0
  102. {getapo-0.2.0 → getapo-0.3.0}/tests/test_continue.py +0 -0
  103. {getapo-0.2.0 → getapo-0.3.0}/tests/test_court.py +0 -0
  104. {getapo-0.2.0 → getapo-0.3.0}/tests/test_credentials.py +0 -0
  105. {getapo-0.2.0 → getapo-0.3.0}/tests/test_cross_site.py +0 -0
  106. {getapo-0.2.0 → getapo-0.3.0}/tests/test_dashboard_cli.py +0 -0
  107. {getapo-0.2.0 → getapo-0.3.0}/tests/test_db.py +0 -0
  108. {getapo-0.2.0 → getapo-0.3.0}/tests/test_decisions_skill.py +0 -0
  109. {getapo-0.2.0 → getapo-0.3.0}/tests/test_decisions_tab.py +0 -0
  110. {getapo-0.2.0 → getapo-0.3.0}/tests/test_delivery.py +0 -0
  111. {getapo-0.2.0 → getapo-0.3.0}/tests/test_digest.py +0 -0
  112. {getapo-0.2.0 → getapo-0.3.0}/tests/test_due_stuck.py +0 -0
  113. {getapo-0.2.0 → getapo-0.3.0}/tests/test_edit_undo.py +0 -0
  114. {getapo-0.2.0 → getapo-0.3.0}/tests/test_events.py +0 -0
  115. {getapo-0.2.0 → getapo-0.3.0}/tests/test_folder_identity.py +0 -0
  116. {getapo-0.2.0 → getapo-0.3.0}/tests/test_guide.py +0 -0
  117. {getapo-0.2.0 → getapo-0.3.0}/tests/test_installer.py +0 -0
  118. {getapo-0.2.0 → getapo-0.3.0}/tests/test_item_folder.py +0 -0
  119. {getapo-0.2.0 → getapo-0.3.0}/tests/test_item_page.py +0 -0
  120. {getapo-0.2.0 → getapo-0.3.0}/tests/test_layout_fixes.py +0 -0
  121. {getapo-0.2.0 → getapo-0.3.0}/tests/test_linear_client.py +0 -0
  122. {getapo-0.2.0 → getapo-0.3.0}/tests/test_linear_goals.py +0 -0
  123. {getapo-0.2.0 → getapo-0.3.0}/tests/test_live_stream.py +0 -0
  124. {getapo-0.2.0 → getapo-0.3.0}/tests/test_mcp_instructions.py +0 -0
  125. {getapo-0.2.0 → getapo-0.3.0}/tests/test_mcp_server.py +0 -0
  126. {getapo-0.2.0 → getapo-0.3.0}/tests/test_merge_branches.py +0 -0
  127. {getapo-0.2.0 → getapo-0.3.0}/tests/test_names.py +0 -0
  128. {getapo-0.2.0 → getapo-0.3.0}/tests/test_navigation.py +0 -0
  129. {getapo-0.2.0 → getapo-0.3.0}/tests/test_new_work.py +0 -0
  130. {getapo-0.2.0 → getapo-0.3.0}/tests/test_notes_labels.py +0 -0
  131. {getapo-0.2.0 → getapo-0.3.0}/tests/test_notify.py +0 -0
  132. {getapo-0.2.0 → getapo-0.3.0}/tests/test_now.py +0 -0
  133. {getapo-0.2.0 → getapo-0.3.0}/tests/test_now_leads.py +0 -0
  134. {getapo-0.2.0 → getapo-0.3.0}/tests/test_outcome_pages.py +0 -0
  135. {getapo-0.2.0 → getapo-0.3.0}/tests/test_outcomes.py +0 -0
  136. {getapo-0.2.0 → getapo-0.3.0}/tests/test_overview_order.py +0 -0
  137. {getapo-0.2.0 → getapo-0.3.0}/tests/test_palette_js.py +0 -0
  138. {getapo-0.2.0 → getapo-0.3.0}/tests/test_poll_loop.py +0 -0
  139. {getapo-0.2.0 → getapo-0.3.0}/tests/test_preview_paths.py +0 -0
  140. {getapo-0.2.0 → getapo-0.3.0}/tests/test_priority_due.py +0 -0
  141. {getapo-0.2.0 → getapo-0.3.0}/tests/test_project_home.py +0 -0
  142. {getapo-0.2.0 → getapo-0.3.0}/tests/test_project_identity.py +0 -0
  143. {getapo-0.2.0 → getapo-0.3.0}/tests/test_project_overview.py +0 -0
  144. {getapo-0.2.0 → getapo-0.3.0}/tests/test_project_scope.py +0 -0
  145. {getapo-0.2.0 → getapo-0.3.0}/tests/test_project_settings.py +0 -0
  146. {getapo-0.2.0 → getapo-0.3.0}/tests/test_projects.py +0 -0
  147. {getapo-0.2.0 → getapo-0.3.0}/tests/test_prompt_answers.py +0 -0
  148. {getapo-0.2.0 → getapo-0.3.0}/tests/test_quiet_pages.py +0 -0
  149. {getapo-0.2.0 → getapo-0.3.0}/tests/test_rank_and_deps.py +0 -0
  150. {getapo-0.2.0 → getapo-0.3.0}/tests/test_repo_writer.py +0 -0
  151. {getapo-0.2.0 → getapo-0.3.0}/tests/test_resume_folder.py +0 -0
  152. {getapo-0.2.0 → getapo-0.3.0}/tests/test_round.py +0 -0
  153. {getapo-0.2.0 → getapo-0.3.0}/tests/test_scheduled_resume.py +0 -0
  154. {getapo-0.2.0 → getapo-0.3.0}/tests/test_schema.py +0 -0
  155. {getapo-0.2.0 → getapo-0.3.0}/tests/test_schema_upgrade.py +0 -0
  156. {getapo-0.2.0 → getapo-0.3.0}/tests/test_search.py +0 -0
  157. {getapo-0.2.0 → getapo-0.3.0}/tests/test_session_page.py +0 -0
  158. {getapo-0.2.0 → getapo-0.3.0}/tests/test_session_states.py +0 -0
  159. {getapo-0.2.0 → getapo-0.3.0}/tests/test_session_verdict.py +0 -0
  160. {getapo-0.2.0 → getapo-0.3.0}/tests/test_sessions.py +0 -0
  161. {getapo-0.2.0 → getapo-0.3.0}/tests/test_small_fixes.py +0 -0
  162. {getapo-0.2.0 → getapo-0.3.0}/tests/test_snooze.py +0 -0
  163. {getapo-0.2.0 → getapo-0.3.0}/tests/test_sources.py +0 -0
  164. {getapo-0.2.0 → getapo-0.3.0}/tests/test_status_export.py +0 -0
  165. {getapo-0.2.0 → getapo-0.3.0}/tests/test_sync_errors.py +0 -0
  166. {getapo-0.2.0 → getapo-0.3.0}/tests/test_task_attempts.py +0 -0
  167. {getapo-0.2.0 → getapo-0.3.0}/tests/test_task_effort.py +0 -0
  168. {getapo-0.2.0 → getapo-0.3.0}/tests/test_transcripts.py +0 -0
  169. {getapo-0.2.0 → getapo-0.3.0}/tests/test_ui_review.py +0 -0
  170. {getapo-0.2.0 → getapo-0.3.0}/tests/test_usage_limit.py +0 -0
  171. {getapo-0.2.0 → getapo-0.3.0}/tests/test_verify.py +0 -0
  172. {getapo-0.2.0 → getapo-0.3.0}/tests/test_week_and_trend.py +0 -0
  173. {getapo-0.2.0 → getapo-0.3.0}/tests/test_weekly_report.py +0 -0
  174. {getapo-0.2.0 → getapo-0.3.0}/tests/test_work_items.py +0 -0
  175. {getapo-0.2.0 → getapo-0.3.0}/tests/test_work_location.py +0 -0
  176. {getapo-0.2.0 → getapo-0.3.0}/tests/test_work_tab.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: getapo
3
- Version: 0.2.0
3
+ Version: 0.3.0
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/
@@ -1,3 +1,3 @@
1
1
  """apo (AI Project Orchestration): a local dashboard and MCP server for Claude Code."""
2
2
 
3
- __version__ = "0.2.0"
3
+ __version__ = "0.3.0"
@@ -2282,19 +2282,24 @@ def work_location_phrase(location: dict | None) -> str | None:
2282
2282
  return f"{where} — {'merged' if location['merged'] else 'not merged'} into `{default}`"
2283
2283
 
2284
2284
 
2285
+ def with_work_state(conn: sqlite3.Connection, items: list[dict], project_id: int | None = None) -> list[dict]:
2286
+ """Adds blocked_by (open_blockers) and claim_stale (in stuck_claims) to each item,
2287
+ in place. project_id only narrows the stuck-claims lookup."""
2288
+ stale = {t["id"] for t in stuck_claims(conn, project_id)}
2289
+ for item in items:
2290
+ item["blocked_by"] = open_blockers(conn, item["id"])
2291
+ item["claim_stale"] = item["id"] in stale
2292
+ return items
2293
+
2294
+
2285
2295
  def list_tasks(conn: sqlite3.Connection, project_id: int) -> list[dict]:
2286
- """Agent tasks not done yet, ready ones first."""
2296
+ """Agent tasks not done yet, ready ones first, with_work_state."""
2287
2297
  rows = conn.execute(
2288
2298
  "SELECT id FROM decision_requests WHERE project_id = ? AND kind = 'task' AND status IN ('open', 'in_progress') "
2289
2299
  "ORDER BY status = 'in_progress', work_rank IS NULL, work_rank, COALESCE(outcome_id, 0), COALESCE(sort_order, 0), id",
2290
2300
  (project_id,),
2291
2301
  ).fetchall()
2292
- tasks = []
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
2302
+ return with_work_state(conn, [get_decision_request(conn, row["id"]) for row in rows], project_id)
2298
2303
 
2299
2304
 
2300
2305
  def cancel_request(conn: sqlite3.Connection, item_id: int, reason: str) -> bool:
@@ -3913,6 +3918,16 @@ def dispatch_in_flight(conn: sqlite3.Connection, decision: dict) -> bool:
3913
3918
  ).fetchone() is None
3914
3919
 
3915
3920
 
3921
+ def dispatched_session(conn: sqlite3.Connection, decision: dict) -> dict | None:
3922
+ """The session a background start on this item became, once `claude agents` has
3923
+ reported it under the agent id the start returned."""
3924
+ if not decision.get("dispatch_agent_id"):
3925
+ return None
3926
+ row = conn.execute("SELECT * FROM sessions WHERE agent_id = ? ORDER BY last_seen_at DESC LIMIT 1",
3927
+ (decision["dispatch_agent_id"],)).fetchone()
3928
+ return dict(row) if row else None
3929
+
3930
+
3916
3931
  def get_session(conn: sqlite3.Connection, claude_session_id: str) -> dict | None:
3917
3932
  row = conn.execute("SELECT * FROM sessions WHERE claude_session_id = ?", (claude_session_id,)).fetchone()
3918
3933
  return dict(row) if row else 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["id"] in stale}
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":
@@ -2597,7 +2610,37 @@ def api_create_decision(payload: dict):
2597
2610
  def api_list_decisions(project: str | None = None, status: str | None = None):
2598
2611
  conn = db.get_connection()
2599
2612
  rows = db.list_decision_requests(conn, project_name=project, status=status)
2600
- return [dict(row) for row in rows]
2613
+ return db.with_work_state(conn, [dict(row) for row in rows])
2614
+
2615
+
2616
+ @app.get("/api/outcomes")
2617
+ def api_list_outcomes(project: str | None = None, status: str | None = None):
2618
+ """Goals with their steps. status: one of OUTCOME_STATUSES, or "all"; by default
2619
+ the live ones (active, paused), as the dashboard shows them."""
2620
+ if status == "all":
2621
+ statuses = db.OUTCOME_STATUSES
2622
+ elif status is None:
2623
+ statuses = ("active", "paused")
2624
+ elif status in db.OUTCOME_STATUSES:
2625
+ statuses = (status,)
2626
+ else:
2627
+ raise HTTPException(status_code=400, detail=f"status must be all or one of {', '.join(db.OUTCOME_STATUSES)}")
2628
+ conn = db.get_connection()
2629
+ project_id = None
2630
+ if project:
2631
+ found = db.find_project(conn, project)
2632
+ if found is None:
2633
+ return []
2634
+ project_id = found["id"]
2635
+ return [
2636
+ {"id": o["id"], "project": o["project_name"], "title": o["title"], "status": o["status"],
2637
+ "done_when": o["done_when"], "description": o["description"], "due_on": o["due_on"],
2638
+ "created_at": o["created_at"], "updated_at": o["updated_at"], "achieved_at": o["achieved_at"],
2639
+ "done": o["progress"]["done"], "total": o["progress"]["total"],
2640
+ "steps": [{"id": s["id"], "title": s["title"], "owner": s["owner"], "kind": s["kind"], "status": s["status"],
2641
+ "done": s["done"], "blocked_by": s["blocked_by"]} for s in o["progress"]["steps"]]}
2642
+ for o in db.list_outcomes(conn, project_id=project_id, statuses=statuses)
2643
+ ]
2601
2644
 
2602
2645
 
2603
2646
  @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; }
@@ -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 }}{% if decision.dispatch_agent_id %} —
42
- <code>claude attach {{ decision.dispatch_agent_id }}</code> to watch it{% endif %}.</span>
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 }}{% if decision.dispatch_agent_id %} —
122
- <code>claude attach {{ decision.dispatch_agent_id }}</code> to watch it{% endif %}.</span>
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.2.0
3
+ Version: 0.3.0
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/
@@ -156,6 +156,7 @@ tests/test_sessions.py
156
156
  tests/test_small_fixes.py
157
157
  tests/test_snooze.py
158
158
  tests/test_sources.py
159
+ tests/test_station_read_api.py
159
160
  tests/test_status_export.py
160
161
  tests/test_sync_errors.py
161
162
  tests/test_task_attempts.py
@@ -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):
@@ -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.2.0"
30
+ assert apo.__version__ == "0.3.0"
31
31
 
32
32
 
33
33
  def test_there_is_no_ado_command_any_more():
@@ -0,0 +1,131 @@
1
+ """Read-only JSON for a local dashboard polling apo: each item's blockers and claim
2
+ state on /api/decisions, and a project's outcomes with their steps on /api/outcomes."""
3
+ import pytest
4
+ from fastapi.testclient import TestClient
5
+
6
+ from apo import db
7
+ from apo.web import app as app_module
8
+
9
+
10
+ @pytest.fixture
11
+ def acme(db_path, tmp_path):
12
+ conn = db.get_connection()
13
+ project = db.get_or_create_project(conn, "acme")
14
+ db.ensure_repository_for_project(conn, project["id"], str(tmp_path))
15
+ return conn, project, TestClient(app_module.app)
16
+
17
+
18
+ def _row(client, item_id, **params):
19
+ return next(r for r in client.get("/api/decisions", params=params).json() if r["id"] == item_id)
20
+
21
+
22
+ def test_decision_rows_carry_outcome_blockers_and_claim_state(acme):
23
+ conn, project, client = acme
24
+ outcome = db.create_outcome(conn, project["id"], "Launch")
25
+ first = db.add_step(conn, outcome, "Build", owner="agent")
26
+ second = db.add_step(conn, outcome, "Deploy", owner="agent", blocked_by=[first])
27
+
28
+ row = _row(client, second, project="acme")
29
+ assert row["outcome_id"] == outcome
30
+ assert row["blocked_by"] == [first]
31
+ assert row["claimed_by_session_id"] is None
32
+ assert row["claim_stale"] is False
33
+ assert "dispatched_at" in row and row["dispatched_at"] is None
34
+
35
+ db.complete_task(conn, first, note="built")
36
+ assert _row(client, second, project="acme")["blocked_by"] == []
37
+
38
+
39
+ def test_a_claim_whose_session_ended_is_stale(acme):
40
+ conn, project, client = acme
41
+ task = db.create_task(conn, project_id=project["id"], title="Rate limit")
42
+ db.claim_task(conn, task, "s1")
43
+ db.register_session(conn, "s1", None)
44
+
45
+ row = _row(client, task, project="acme")
46
+ assert row["claimed_by_session_id"] == "s1" and row["claim_stale"] is False
47
+
48
+ conn.execute("UPDATE sessions SET status = 'ended' WHERE claude_session_id = 's1'")
49
+ conn.commit()
50
+ assert _row(client, task, project="acme")["claim_stale"] is True
51
+ assert _row(client, task)["claim_stale"] is True
52
+
53
+
54
+ def test_existing_decision_fields_are_unchanged(acme):
55
+ _, _, client = acme
56
+ decision_id = client.post("/api/decisions", json={"project": "acme", "title": "T", "question": "Q?"}).json()["id"]
57
+ row = _row(client, decision_id, project="acme")
58
+ for field in ("title", "question", "status", "kind", "project_name", "created_at", "options"):
59
+ assert field in row
60
+ assert row["outcome_id"] is None and row["blocked_by"] == [] and row["claim_stale"] is False
61
+
62
+
63
+ def test_mcp_list_tasks_reports_the_same_state(acme, monkeypatch):
64
+ from apo import mcp_server
65
+
66
+ conn, project, client = acme
67
+ first = db.create_task(conn, project_id=project["id"], title="A")
68
+ second = db.create_task(conn, project_id=project["id"], title="B", blocked_by=[first])
69
+ db.claim_task(conn, first, "s1")
70
+ db.register_session(conn, "s1", None)
71
+ conn.execute("UPDATE sessions SET status = 'ended' WHERE claude_session_id = 's1'")
72
+ conn.commit()
73
+
74
+ listed = {t["id"]: t for t in mcp_server.list_tasks(project="acme")}
75
+ for item_id in (first, second):
76
+ row = _row(client, item_id, project="acme")
77
+ assert listed[item_id]["blocked_by"] == row["blocked_by"]
78
+ assert listed[item_id]["claim_stale"] == row["claim_stale"]
79
+ assert listed[first]["claim_stale"] is True and listed[second]["blocked_by"] == [first]
80
+
81
+
82
+ def test_outcomes_list_steps_with_owner_kind_status_and_counts(acme):
83
+ conn, project, client = acme
84
+ outcome = db.create_outcome(conn, project["id"], "Launch the site", done_when="Live with a real payment")
85
+ build = db.add_step(conn, outcome, "Configure the build", owner="agent")
86
+ dns = db.add_step(conn, outcome, "Add the DNS record", owner="me", blocked_by=[build])
87
+ wait = db.add_step(conn, outcome, "DNS propagation", owner="external", waiting_on="Cloudflare")
88
+ dropped = db.add_step(conn, outcome, "Old idea", owner="agent")
89
+ db.cancel_request(conn, dropped, "not needed")
90
+ db.complete_step(conn, build, by="agent")
91
+
92
+ response = client.get("/api/outcomes", params={"project": "acme"})
93
+ assert response.status_code == 200
94
+ [goal] = response.json()
95
+ assert goal["id"] == outcome and goal["title"] == "Launch the site"
96
+ assert goal["project"] == "acme" and goal["status"] == "active"
97
+ assert goal["done_when"] == "Live with a real payment"
98
+ assert goal["created_at"] and goal["updated_at"]
99
+ assert goal["done"] == 1 and goal["total"] == 3
100
+ assert [(s["id"], s["owner"], s["kind"]) for s in goal["steps"]] == [
101
+ (build, "agent", "task"), (dns, "me", "action"), (wait, "external", "wait"), (dropped, "agent", "task")]
102
+ steps = {s["id"]: s for s in goal["steps"]}
103
+ assert steps[build]["status"] == "resolved" and steps[build]["done"] is True
104
+ assert steps[dns]["status"] == "open" and steps[dns]["blocked_by"] == []
105
+ assert steps[dropped]["status"] == "cancelled" and steps[dropped]["done"] is False
106
+ assert steps[dns]["title"] == "Add the DNS record"
107
+
108
+
109
+ def test_outcomes_are_filtered_by_project_and_status(acme):
110
+ conn, project, client = acme
111
+ other = db.get_or_create_project(conn, "other")
112
+ mine = db.create_outcome(conn, project["id"], "Mine")
113
+ db.create_outcome(conn, other["id"], "Theirs")
114
+ achieved = db.create_outcome(conn, project["id"], "Shipped")
115
+ db.set_outcome_status(conn, achieved, "achieved")
116
+
117
+ assert [g["id"] for g in client.get("/api/outcomes", params={"project": "acme"}).json()] == [mine]
118
+ everything = client.get("/api/outcomes", params={"project": "acme", "status": "all"}).json()
119
+ assert [g["id"] for g in everything] == [mine, achieved]
120
+ assert everything[1]["status"] == "achieved"
121
+ only = client.get("/api/outcomes", params={"project": "acme", "status": "achieved"}).json()
122
+ assert [g["id"] for g in only] == [achieved]
123
+ assert {g["title"] for g in client.get("/api/outcomes").json()} == {"Mine", "Theirs"}
124
+ assert client.get("/api/outcomes", params={"project": "nope"}).json() == []
125
+
126
+
127
+ def test_outcomes_reject_an_unknown_status(acme):
128
+ _, _, client = acme
129
+ response = client.get("/api/outcomes", params={"status": "bogus"})
130
+ assert response.status_code == 400
131
+ assert "detail" in response.json()
@@ -138,6 +138,52 @@ def test_starting_a_ready_task_in_the_background(client, project, launches):
138
138
  assert "claude attach 3f2a9c1b" in client.get(f"/decisions/{task_id}").text
139
139
 
140
140
 
141
+ def _agents_link(html):
142
+ return re.search(r'<a [^>]*class="[^"]*watch-agent[^"]*"[^>]*href="([^"]+)"|'
143
+ r'<a [^>]*href="([^"]+)"[^>]*class="[^"]*watch-agent', html)
144
+
145
+
146
+ def _watch_href(html):
147
+ match = _agents_link(html)
148
+ assert match, "no link to where the agent is working"
149
+ return match.group(1) or match.group(2)
150
+
151
+
152
+ def test_a_started_task_links_to_the_agents_tab_before_its_session_shows_up(client, project, launches):
153
+ p, (_, dash) = project
154
+ task_id = db.create_task(db.get_connection(), project_id=p["id"], title="Station Review", repository_id=dash["id"])
155
+ client.post(f"/decisions/{task_id}/start")
156
+
157
+ assert _watch_href(client.get(f"/decisions/{task_id}").text) == f"/projects/{p['id']}/agents"
158
+
159
+
160
+ def test_a_started_task_links_to_its_sessions_card_once_it_is_running(client, project, launches):
161
+ p, (_, dash) = project
162
+ conn = db.get_connection()
163
+ task_id = db.create_task(conn, project_id=p["id"], title="Station Review", repository_id=dash["id"])
164
+ client.post(f"/decisions/{task_id}/start")
165
+ db.register_session(conn, "bg-1", dash["local_path"])
166
+ db.reconcile_live_sessions(conn, [{"id": "3f2a9c1b", "kind": "background", "sessionId": "bg-1",
167
+ "cwd": dash["local_path"], "status": "busy"}])
168
+ session = db.get_session(conn, "bg-1")
169
+
170
+ assert _watch_href(client.get(f"/decisions/{task_id}").text) == f"/projects/{p['id']}/agents#session-card-{session['id']}"
171
+
172
+
173
+ def test_a_started_task_whose_session_ended_links_to_that_session(client, project, launches):
174
+ p, (_, dash) = project
175
+ conn = db.get_connection()
176
+ task_id = db.create_task(conn, project_id=p["id"], title="Station Review", repository_id=dash["id"])
177
+ client.post(f"/decisions/{task_id}/start")
178
+ db.register_session(conn, "bg-1", dash["local_path"])
179
+ db.reconcile_live_sessions(conn, [{"id": "3f2a9c1b", "kind": "background", "sessionId": "bg-1",
180
+ "cwd": dash["local_path"], "status": "busy"}])
181
+ db.session_end(conn, "bg-1", "other")
182
+ session = db.get_session(conn, "bg-1")
183
+
184
+ assert _watch_href(client.get(f"/decisions/{task_id}").text) == f"/sessions/{session['id']}"
185
+
186
+
141
187
  def test_a_task_without_a_folder_cant_be_started(client, project, launches):
142
188
  p, _ = project
143
189
  task_id = db.create_task(db.get_connection(), project_id=p["id"], title="Station Review")
@@ -68,7 +68,7 @@ def test_the_wheel_carries_the_package_data(wheel):
68
68
  assert path in names, path
69
69
  assert not any(n.startswith(("tests/", "docs/", "scripts/", "site/")) for n in names)
70
70
  metadata = zipfile.ZipFile(wheel).read(next(n for n in names if n.endswith("METADATA"))).decode()
71
- assert "Name: getapo" in metadata and "Version: 0.2.0" in metadata
71
+ assert "Name: getapo" in metadata and "Version: 0.3.0" in metadata
72
72
  assert "License-Expression: MIT" in metadata
73
73
  assert {n.rsplit("/", 1)[-1] for n in names if "/licenses/" in n} == {"LICENSE", "THIRD_PARTY_NOTICES.md"}
74
74
  entry_points = zipfile.ZipFile(wheel).read(next(n for n in names if n.endswith("entry_points.txt"))).decode()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes