beacon-ai 0.63.4__py3-none-win_amd64.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.
Files changed (298) hide show
  1. beacon_ai-0.63.4.data/purelib/beacon_cli/__init__.py +14 -0
  2. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/bridge_detect.mjs +112 -0
  3. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/bridge_detect.test.mjs +171 -0
  4. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/bus-autonomous-content.mjs +248 -0
  5. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/bus-budget.mjs +173 -0
  6. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/bus-context-usage.mjs +56 -0
  7. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/bus-envelope.mjs +87 -0
  8. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/bus-heartbeat.mjs +159 -0
  9. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/bus-local-heartbeat.mjs +82 -0
  10. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/bus-qualgate.mjs +134 -0
  11. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/bus-state-marker.mjs +70 -0
  12. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/bus-state-marker.test.mjs +109 -0
  13. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/bus.mjs +1878 -0
  14. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/package-lock.json +1180 -0
  15. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/package.json +11 -0
  16. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/profile-resolver.mjs +166 -0
  17. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_channel/trek-rate.mjs +93 -0
  18. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/__init__.py +11 -0
  19. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/_file_lock.py +236 -0
  20. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/agent.py +278 -0
  21. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/api_client.py +1575 -0
  22. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/attack_list.py +144 -0
  23. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/attention.py +236 -0
  24. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/auth.py +742 -0
  25. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/backend_authoring.py +63 -0
  26. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/backoffice_seed.py +128 -0
  27. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/beacon_bin_resolver.py +342 -0
  28. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/branch.py +108 -0
  29. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/bus_delivery.py +217 -0
  30. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/bus_liveness.py +227 -0
  31. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/bus_protocol.py +283 -0
  32. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/capability_ledger.py +1821 -0
  33. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/claim_view.py +383 -0
  34. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/claims.py +803 -0
  35. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cli_surface.py +46 -0
  36. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cloud_run_port.py +78 -0
  37. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cloud_write_guard.py +221 -0
  38. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_acquisition.py +1010 -0
  39. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_attention.py +125 -0
  40. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_bus.py +1933 -0
  41. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_claim.py +569 -0
  42. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_decision.py +313 -0
  43. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_deliverable.py +316 -0
  44. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_deploy.py +760 -0
  45. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_doc.py +970 -0
  46. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_incident.py +157 -0
  47. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_issue.py +131 -0
  48. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_log.py +292 -0
  49. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_milestone.py +1648 -0
  50. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_note.py +155 -0
  51. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_operation.py +680 -0
  52. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_org.py +898 -0
  53. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_pr.py +1183 -0
  54. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_project.py +836 -0
  55. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_push.py +181 -0
  56. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_retro.py +338 -0
  57. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_session.py +911 -0
  58. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_sessions.py +84 -0
  59. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_target.py +1884 -0
  60. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_task.py +504 -0
  61. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_trek.py +3636 -0
  62. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_trigger.py +1628 -0
  63. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cmd_view.py +272 -0
  64. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/code_graph.py +292 -0
  65. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/code_graph_curate.py +105 -0
  66. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/code_graph_derive.py +401 -0
  67. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/code_graph_query.py +133 -0
  68. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/code_graph_reconcile.py +61 -0
  69. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/code_graph_seed.py +173 -0
  70. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/code_graph_store.py +23 -0
  71. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/code_graph_zoom.py +101 -0
  72. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/codex_receive_loop.py +637 -0
  73. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/codex_session.py +245 -0
  74. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/commands.py +11092 -0
  75. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/commands_shared.py +2913 -0
  76. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/core.py +3778 -0
  77. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/cycle.py +326 -0
  78. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/deadline.py +158 -0
  79. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/decision_derive.py +102 -0
  80. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/decision_vocab.py +32 -0
  81. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/deliverable_capture.py +103 -0
  82. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/deliverable_changelog.py +438 -0
  83. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/deliverable_doc_sync.py +66 -0
  84. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/deliverable_map.py +215 -0
  85. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/deliverable_resolve.py +182 -0
  86. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/deploy_health.py +210 -0
  87. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/desktop_notify.py +97 -0
  88. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/disclosure.py +106 -0
  89. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/dm_consent.py +505 -0
  90. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/dm_pending.py +293 -0
  91. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/dm_qualgate.py +134 -0
  92. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/dm_untrusted.py +255 -0
  93. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/dogfood_coverage.py +95 -0
  94. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/firebase_config.json.example +10 -0
  95. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/gh_port.py +133 -0
  96. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/git_read_port.py +151 -0
  97. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/git_write_port.py +76 -0
  98. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/invitations.py +268 -0
  99. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/inward_inject.py +142 -0
  100. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/local_writer.py +155 -0
  101. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/master_binding.py +132 -0
  102. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/master_identity.py +285 -0
  103. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/master_projection.py +517 -0
  104. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/master_store.py +216 -0
  105. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/morning.py +290 -0
  106. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/occupation.py +2768 -0
  107. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/operation_activation.py +274 -0
  108. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/operation_period.py +77 -0
  109. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/operations.py +1010 -0
  110. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/org.py +345 -0
  111. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/org_store.py +104 -0
  112. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/phantom_done_evidence.py +333 -0
  113. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/principal.py +264 -0
  114. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/profile.py +364 -0
  115. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/project_cleanup.py +354 -0
  116. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/project_ref.py +103 -0
  117. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/report_primitive.py +340 -0
  118. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/retro_query.py +538 -0
  119. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/review_nodes.py +70 -0
  120. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/review_spine.py +594 -0
  121. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/rollback.py +449 -0
  122. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/root_target.py +397 -0
  123. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/sales_entities.py +4247 -0
  124. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/scenario_bisect.py +284 -0
  125. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/scenario_cloud.py +155 -0
  126. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/scenario_regression.py +126 -0
  127. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/scenario_runner.py +470 -0
  128. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/scenario_store.py +121 -0
  129. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/search.py +715 -0
  130. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/session.py +1398 -0
  131. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/session_log.py +359 -0
  132. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/session_state_hook.py +108 -0
  133. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/skill_converter.py +438 -0
  134. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/stop_signal.py +765 -0
  135. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/store.py +429 -0
  136. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/store_api.py +563 -0
  137. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/store_local.py +534 -0
  138. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/store_migrate.py +181 -0
  139. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/store_sqlite.py +547 -0
  140. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/stuck_detect.py +193 -0
  141. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/table_doc.py +406 -0
  142. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/table_type.py +196 -0
  143. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/target_completion.py +78 -0
  144. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/target_descriptor.py +1440 -0
  145. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/target_disclosure.py +63 -0
  146. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/target_engine.py +918 -0
  147. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/target_state.py +863 -0
  148. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/tick_health.py +182 -0
  149. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/tick_scheduler.py +166 -0
  150. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/tool_effect.py +179 -0
  151. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/transition_approval.py +658 -0
  152. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/trek.py +4969 -0
  153. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/trek_scheduler.py +1901 -0
  154. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/trek_slots.py +467 -0
  155. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/trek_status.py +141 -0
  156. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/trek_store.py +123 -0
  157. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/untrusted_frame.py +140 -0
  158. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/untrusted_turn.py +504 -0
  159. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/v3_schema.py +111 -0
  160. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/verb_ledger.py +162 -0
  161. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/verb_ledger_data.py +538 -0
  162. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/version_rules.py +287 -0
  163. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/version_skew.py +341 -0
  164. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/view_model.py +244 -0
  165. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/work_base.py +146 -0
  166. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/work_model.py +615 -0
  167. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/working_target.py +401 -0
  168. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/worktree.py +127 -0
  169. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_lib/ws_client.py +213 -0
  170. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/backfill_trek_session_history.py +173 -0
  171. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/bcodex-watcher.py +305 -0
  172. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/beacon-bin-resolver.py +70 -0
  173. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/beacon-code-graph-edit-hook.py +57 -0
  174. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/build-codex-plugin-skills.py +122 -0
  175. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-arm-fixed-timestamp.py +130 -0
  176. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-branch-focus-divergence.py +122 -0
  177. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-capability-scope.py +1296 -0
  178. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-cli-help-drift.py +1346 -0
  179. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-frontend-drift.py +268 -0
  180. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-graph-drift.py +146 -0
  181. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-install-md.py +284 -0
  182. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-map-drift.py +394 -0
  183. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-mcp-receive-capability.py +77 -0
  184. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-server-lib-collision.py +115 -0
  185. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-skill-drift.py +289 -0
  186. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-ui-japanese-text.py +132 -0
  187. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-verb-ledger.py +78 -0
  188. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/check-viewer-name-drift.py +101 -0
  189. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/codex-halt-check-hook.py +247 -0
  190. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/codex-inbox-hook.py +425 -0
  191. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/codex-post-tool-use-hook.py +41 -0
  192. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/codex-receive-loop.py +771 -0
  193. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/deploy-health-monitor.py +316 -0
  194. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/graph-curate.py +97 -0
  195. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/graph-migration-coverage.py +95 -0
  196. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/graph-navigate.py +174 -0
  197. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/migrate_members_session_keyed.py +197 -0
  198. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/open-board.py +200 -0
  199. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/release.py +545 -0
  200. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/revert_members_session_keyed.py +103 -0
  201. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/review-gate-ci.py +329 -0
  202. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/seed-application-map-deliverables.py +262 -0
  203. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/seed-code-graph.py +197 -0
  204. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/session-start-deadlines.py +90 -0
  205. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/session-start-dm-inbox.py +135 -0
  206. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/session-start-trek-status.py +80 -0
  207. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/smoke-concurrent.py +176 -0
  208. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_scripts/tick-health-monitor.py +203 -0
  209. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/_beacon-retrospect-methodology.md +205 -0
  210. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/_beacon-review-methodology.md +218 -0
  211. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/_beacon-spec-methodology.md +228 -0
  212. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/ax-review/SKILL.md +144 -0
  213. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/ax-review/principles.md +216 -0
  214. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-archaeology.md +228 -0
  215. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-bus-armed.md +193 -0
  216. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-cloud.md +463 -0
  217. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-deploy.md +299 -0
  218. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-dispatch.md +848 -0
  219. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-dm-respond.md +341 -0
  220. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-dm-send.md +682 -0
  221. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-drift-check.md +148 -0
  222. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-incident-report.md +201 -0
  223. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-init.md +508 -0
  224. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-log.md +582 -0
  225. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-map.md +206 -0
  226. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-member.md +392 -0
  227. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-note.md +139 -0
  228. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-onboard.md +236 -0
  229. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-operation-execute.md +275 -0
  230. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-operation-review.md +216 -0
  231. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-operation-setup.md +424 -0
  232. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-pr-create.md +325 -0
  233. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-push.md +382 -0
  234. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-retro.md +299 -0
  235. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-retrospect.md +232 -0
  236. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-review-apply.md +216 -0
  237. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-review-meta.md +163 -0
  238. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-review-run.md +377 -0
  239. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-review-uc.md +156 -0
  240. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-review.md +179 -0
  241. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-roadmap.md +350 -0
  242. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-card.md +108 -0
  243. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-cockpit.md +188 -0
  244. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-communication.md +173 -0
  245. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-dossier.md +198 -0
  246. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-drive.md +134 -0
  247. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-email.md +327 -0
  248. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-meeting-confirm.md +152 -0
  249. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-meeting-detect.md +174 -0
  250. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-meeting-wrap.md +199 -0
  251. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-opportunity.md +137 -0
  252. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-outreach.md +155 -0
  253. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-reply-watch.md +183 -0
  254. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-schedule.md +267 -0
  255. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-sales-standup-intake.md +127 -0
  256. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-scenario-gen.md +141 -0
  257. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-scope-classify.md +187 -0
  258. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-session-end.md +388 -0
  259. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-session-fork.md +151 -0
  260. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-session-merge-back.md +152 -0
  261. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-session-start.md +884 -0
  262. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-spec.md +490 -0
  263. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-task.md +243 -0
  264. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-trek-execute.md +247 -0
  265. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-trek-finalize.md +211 -0
  266. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-trek-pulse.md +322 -0
  267. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-trek-review.md +222 -0
  268. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/beacon-vision.md +367 -0
  269. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/decision-verification/principles.md +41 -0
  270. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/maintainability-review/SKILL.md +132 -0
  271. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/maintainability-review/principles.md +173 -0
  272. beacon_ai-0.63.4.data/purelib/beacon_cli/_bundled_skills/philosophy-review/SKILL.md +164 -0
  273. beacon_ai-0.63.4.data/purelib/beacon_cli/_version.py +8 -0
  274. beacon_ai-0.63.4.data/purelib/beacon_cli/bclaude.py +238 -0
  275. beacon_ai-0.63.4.data/purelib/beacon_cli/dispatch.py +6041 -0
  276. beacon_ai-0.63.4.data/purelib/beacon_cli/find_root.py +49 -0
  277. beacon_ai-0.63.4.data/purelib/beacon_cli/hooks/__init__.py +13 -0
  278. beacon_ai-0.63.4.data/purelib/beacon_cli/hooks/context_monitor.py +633 -0
  279. beacon_ai-0.63.4.data/purelib/beacon_cli/hooks/halt_check.py +161 -0
  280. beacon_ai-0.63.4.data/purelib/beacon_cli/hooks/post_commit.py +341 -0
  281. beacon_ai-0.63.4.data/purelib/beacon_cli/hooks/postcompact.py +223 -0
  282. beacon_ai-0.63.4.data/purelib/beacon_cli/hooks/save_hook.py +179 -0
  283. beacon_ai-0.63.4.data/purelib/beacon_cli/hooks/session_start.py +444 -0
  284. beacon_ai-0.63.4.data/purelib/beacon_cli/main.py +269 -0
  285. beacon_ai-0.63.4.data/purelib/beacon_cli/skills_helpers/__init__.py +20 -0
  286. beacon_ai-0.63.4.data/purelib/beacon_cli/skills_helpers/bridge_status.py +85 -0
  287. beacon_ai-0.63.4.data/purelib/beacon_cli/skills_helpers/dm_discover.py +374 -0
  288. beacon_ai-0.63.4.data/purelib/beacon_cli/skills_helpers/dm_reply.py +268 -0
  289. beacon_ai-0.63.4.data/purelib/beacon_cli/skills_helpers/dm_send.py +454 -0
  290. beacon_ai-0.63.4.data/purelib/beacon_cli/skills_helpers/identity_resolve.py +360 -0
  291. beacon_ai-0.63.4.data/scripts/beacon-view +0 -0
  292. beacon_ai-0.63.4.data/scripts/beacon-view.exe +0 -0
  293. beacon_ai-0.63.4.dist-info/METADATA +681 -0
  294. beacon_ai-0.63.4.dist-info/RECORD +298 -0
  295. beacon_ai-0.63.4.dist-info/WHEEL +5 -0
  296. beacon_ai-0.63.4.dist-info/entry_points.txt +10 -0
  297. beacon_ai-0.63.4.dist-info/licenses/LICENSE +21 -0
  298. beacon_ai-0.63.4.dist-info/top_level.txt +1 -0
@@ -0,0 +1,14 @@
1
+ """Beacon CLI — cross-platform Python entry-point package.
2
+
3
+ This is a thin wrapper around the existing `lib/*.py` modules + `bin/beacon`
4
+ bash script. The goal is to make `pipx install beacon` work on every OS,
5
+ including Windows where the bash entry-point cannot run.
6
+
7
+ Status: ms-44 e-695 scaffold. Most commands still delegate to the bash
8
+ script via subprocess when bash is available. Full Python rewrite is
9
+ tracked under e-695.
10
+ """
11
+
12
+ from ._version import __version__
13
+
14
+ __all__ = ["__version__"]
@@ -0,0 +1,112 @@
1
+ // e-3858 — cold-start bridge-liveness detection for the force-mint decision.
2
+ //
3
+ // Extracted from bus.mjs so the "another alive bridge?" predicate is pure and
4
+ // unit-testable, and so the rule keys on the BRIDGE process liveness — not
5
+ // merely its parent bclaude.
6
+ //
7
+ // The bug this fixes: when a bridge is killed / crashes / is OOM-reaped, its
8
+ // `.beacon/bridges/<sid>.json` claim file is left behind (graceful shutdown is
9
+ // the only path that clears it). The old rule counted such a claim as "another
10
+ // alive bridge" whenever its recorded `parent_pid` (= the owning bclaude) was
11
+ // still alive — even though the bridge process itself was already dead. That
12
+ // made the next bridge in the same bclaude force-mint a fresh session_id, which
13
+ // diverged from the session_id the CLI resolves (from CLAUDE_CODE_SESSION_ID /
14
+ // session.json). The split broke DM round-trips: sends were stamped with one
15
+ // session as sender and replies routed back to a session with no live bridge.
16
+ //
17
+ // Keying on the bridge pid instead: a claim only blocks reuse (forces a mint)
18
+ // when the bridge process it names is actually running.
19
+ import fs from 'node:fs'
20
+ import path from 'node:path'
21
+
22
+ // True iff `pid` is a live process on this host. `process.kill(pid, 0)` sends
23
+ // no signal but throws ESRCH when the pid is dead. EPERM = the process exists
24
+ // but we may not signal it (another user) → still alive.
25
+ export function isPidAlive(pid) {
26
+ if (!Number.isInteger(pid) || pid <= 0) return false
27
+ try {
28
+ process.kill(pid, 0)
29
+ return true
30
+ } catch (e) {
31
+ return !!(e && e.code === 'EPERM')
32
+ }
33
+ }
34
+
35
+ // Decide whether one claim dict belongs to a DIFFERENT, currently-alive bridge
36
+ // (i.e. one that should force THIS bus.mjs to mint a fresh session_id).
37
+ //
38
+ // A claim is an "other alive bridge" iff ALL hold:
39
+ // - it has a usable bridge `pid` and that process is alive (`pidAlive`). A dead
40
+ // bridge's stale claim no longer counts (e-3858 — the original fix).
41
+ // - it is not mine: not my own bridge pid, not my own bclaude's parent pid.
42
+ // - it does not claim MY canonical session_id (`canonicalSid`) — the ms-165 rule.
43
+ // A claim without a usable `pid` cannot be confirmed running, so it does not block.
44
+ //
45
+ // ms-165 (restart hand-off race) — why the canonicalSid exclusion:
46
+ // During a bclaude restart the dying old bridge briefly overlaps my new bus.mjs
47
+ // startup. Its claim names my CANONICAL session_id, because the sid is minted on
48
+ // (project, machine, BEACON_PARENT_PID) and BEACON_PARENT_PID = the TERMINAL pid
49
+ // — a restart in the same terminal resolves the SAME sid. I must TAKE OVER that
50
+ // sid, NOT force-mint a divergent one; otherwise the bridge heartbeats under a
51
+ // fresh sid the CLI never resolves, so the session's DMs route to a bridge that
52
+ // isn't there and receive dies silently (the 2026-09-05 incident). A genuinely
53
+ // CONCURRENT bclaude runs in a DIFFERENT terminal → different BEACON_PARENT_PID →
54
+ // DIFFERENT sid, so it is NOT excluded and still forces a mint (dispatch mode).
55
+ // (Two LIVE processes sharing one canonical sid would require terminal-pid
56
+ // RECYCLING within a session's lifetime — negligible, and the server expires
57
+ // stale (project,machine,ppid) tuples by created_at/heartbeat. So "same
58
+ // canonical sid ⟹ my own restart" holds in practice; we deliberately do NOT try
59
+ // to disambiguate via parent_pid, since a legitimate restart ALSO has a
60
+ // different parent_pid and such a check would false-fire on every restart.)
61
+ //
62
+ // When `canonicalSid` is empty (the CLI could not resolve a sid) the exclusion is
63
+ // a no-op, preserving the pre-ms-165 behaviour. The caller is expected to surface
64
+ // that degraded state (the exclusion — and thus the restart protection — is off).
65
+ export function claimIsOtherAliveBridge(data, { myPpid, myPid, canonicalSid = '', pidAlive = isPidAlive }) {
66
+ if (!data || typeof data !== 'object') return false
67
+ const pp = Number.isInteger(data.parent_pid) ? data.parent_pid : 0
68
+ const bp = Number.isInteger(data.pid) ? data.pid : 0
69
+ if (!bp || bp === myPid) return false // no bridge pid, or it's my own bridge
70
+ if (pp && pp === myPpid) return false // my own bclaude's prior claim
71
+ if (canonicalSid && data.session_id === canonicalSid) return false // my own session restarting → take over
72
+ return pidAlive(bp) // the bridge process must be live
73
+ }
74
+
75
+ // Scan `bridgesDir` (per-sid claims) and the legacy single-claim `legacyPath`,
76
+ // returning the claims that belong to other, currently-alive bridges. Pure
77
+ // except for the fs reads it is given; `pidAlive` is injectable for tests.
78
+ export function detectOtherAliveBridges({ bridgesDir, legacyPath, myPpid, myPid, canonicalSid = '', pidAlive = isPidAlive, log = () => {} }) {
79
+ const found = []
80
+ const seen = new Set()
81
+ try {
82
+ if (bridgesDir && fs.existsSync(bridgesDir)) {
83
+ for (const f of fs.readdirSync(bridgesDir)) {
84
+ if (!f.endsWith('.json')) continue
85
+ let data
86
+ try {
87
+ data = JSON.parse(fs.readFileSync(path.join(bridgesDir, f), 'utf8'))
88
+ } catch {
89
+ continue
90
+ }
91
+ if (claimIsOtherAliveBridge(data, { myPpid, myPid, canonicalSid, pidAlive })) {
92
+ found.push(data)
93
+ if (data.session_id) seen.add(data.session_id)
94
+ }
95
+ }
96
+ }
97
+ } catch (e) {
98
+ log(`bridges scan failed (non-fatal): ${e.message}`)
99
+ }
100
+ // Legacy single-claim .beacon/bridge.json (no parent_pid) — same bridge-pid
101
+ // liveness rule; skip if the sid was already collected from bridges/.
102
+ try {
103
+ if (legacyPath && fs.existsSync(legacyPath)) {
104
+ const data = JSON.parse(fs.readFileSync(legacyPath, 'utf8'))
105
+ if (claimIsOtherAliveBridge(data, { myPpid, myPid, canonicalSid, pidAlive }) &&
106
+ !(data && data.session_id && seen.has(data.session_id))) {
107
+ found.push(data)
108
+ }
109
+ }
110
+ } catch {}
111
+ return found
112
+ }
@@ -0,0 +1,171 @@
1
+ // e-3858 — unit tests for the cold-start "another alive bridge?" predicate.
2
+ // Run: node --test channel/bridge_detect.test.mjs
3
+ import test from 'node:test'
4
+ import assert from 'node:assert/strict'
5
+ import fs from 'node:fs'
6
+ import os from 'node:os'
7
+ import path from 'node:path'
8
+
9
+ import { claimIsOtherAliveBridge, detectOtherAliveBridges } from './bridge_detect.mjs'
10
+
11
+ // Injected liveness: pids in this set are "alive", everything else "dead".
12
+ const aliveSet = (...pids) => {
13
+ const s = new Set(pids)
14
+ return (pid) => s.has(pid)
15
+ }
16
+
17
+ test('dead bridge pid is NOT another alive bridge, even if parent bclaude is alive (the e-3858 bug)', () => {
18
+ // The exact incident shape: bridge process killed (39892 dead) but its parent
19
+ // bclaude (31280) still alive. Old logic keyed on parent → force-minted →
20
+ // split. New logic keys on the bridge pid → must be false.
21
+ const claim = { session_id: 's1', pid: 39892, parent_pid: 31280 }
22
+ const pidAlive = aliveSet(31280) // parent alive, bridge dead
23
+ assert.equal(
24
+ claimIsOtherAliveBridge(claim, { myPpid: 30152, myPid: 15972, pidAlive }),
25
+ false,
26
+ )
27
+ })
28
+
29
+ test('alive bridge owned by a different bclaude IS another alive bridge', () => {
30
+ const claim = { session_id: 's2', pid: 5000, parent_pid: 4000 }
31
+ const pidAlive = aliveSet(5000, 4000)
32
+ assert.equal(
33
+ claimIsOtherAliveBridge(claim, { myPpid: 9999, myPid: 8888, pidAlive }),
34
+ true,
35
+ )
36
+ })
37
+
38
+ test('my own bridge (same pid) is not counted', () => {
39
+ const claim = { session_id: 's3', pid: 8888, parent_pid: 4000 }
40
+ const pidAlive = aliveSet(8888, 4000)
41
+ assert.equal(
42
+ claimIsOtherAliveBridge(claim, { myPpid: 9999, myPid: 8888, pidAlive }),
43
+ false,
44
+ )
45
+ })
46
+
47
+ test('my own bclaude (same parent_pid) prior claim is not counted', () => {
48
+ const claim = { session_id: 's4', pid: 5000, parent_pid: 9999 }
49
+ const pidAlive = aliveSet(5000, 9999)
50
+ assert.equal(
51
+ claimIsOtherAliveBridge(claim, { myPpid: 9999, myPid: 8888, pidAlive }),
52
+ false,
53
+ )
54
+ })
55
+
56
+ test('claim without a usable bridge pid does not block reuse', () => {
57
+ const claim = { session_id: 's5', parent_pid: 4000 } // no pid
58
+ const pidAlive = aliveSet(4000)
59
+ assert.equal(
60
+ claimIsOtherAliveBridge(claim, { myPpid: 9999, myPid: 8888, pidAlive }),
61
+ false,
62
+ )
63
+ })
64
+
65
+ test('ms-165: an alive bridge on MY canonical sid is NOT a competitor (restart hand-off)', () => {
66
+ // The 2026-09-05 incident shape: a bclaude restart. The dying old bridge
67
+ // (pid 87349, different parent) is briefly still alive and claims MY canonical
68
+ // session_id. Without the canonicalSid exclusion this forced a divergent mint → the
69
+ // new bridge heartbeat under a fresh sid the CLI never resolves → silent
70
+ // receive death. With canonicalSid set, my own session's bridge is excluded so I
71
+ // reuse (take over) the canonical sid.
72
+ const claim = { session_id: 'sv-mine', pid: 87349, parent_pid: 1533 }
73
+ const pidAlive = aliveSet(87349, 1533) // old bridge briefly still alive
74
+ assert.equal(
75
+ claimIsOtherAliveBridge(claim, { myPpid: 851, myPid: 94943, canonicalSid: 'sv-mine', pidAlive }),
76
+ false,
77
+ )
78
+ })
79
+
80
+ test('ms-165: an alive bridge on a DIFFERENT sid still forces a mint (concurrent bclaude)', () => {
81
+ // A genuinely concurrent bclaude in the same cwd (dispatch mode) owns a
82
+ // different sid — a fresh mint is still correct, canonicalSid must not suppress it.
83
+ const claim = { session_id: 'sv-other', pid: 5000, parent_pid: 4000 }
84
+ const pidAlive = aliveSet(5000, 4000)
85
+ assert.equal(
86
+ claimIsOtherAliveBridge(claim, { myPpid: 851, myPid: 94943, canonicalSid: 'sv-mine', pidAlive }),
87
+ true,
88
+ )
89
+ })
90
+
91
+ test('ms-165: empty canonicalSid preserves pre-ms-165 behaviour (any alive other bridge counts)', () => {
92
+ const claim = { session_id: 'sv-x', pid: 5000, parent_pid: 4000 }
93
+ const pidAlive = aliveSet(5000, 4000)
94
+ assert.equal(
95
+ claimIsOtherAliveBridge(claim, { myPpid: 851, myPid: 94943, canonicalSid: '', pidAlive }),
96
+ true,
97
+ )
98
+ })
99
+
100
+ test('ms-165: detectOtherAliveBridges drops my own-sid bridge, keeps a different-sid one', () => {
101
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bd-'))
102
+ try {
103
+ fs.writeFileSync(path.join(dir, 'mine-restart.json'),
104
+ JSON.stringify({ session_id: 'sv-mine', pid: 87349, parent_pid: 1533 }))
105
+ fs.writeFileSync(path.join(dir, 'concurrent.json'),
106
+ JSON.stringify({ session_id: 'sv-other', pid: 5000, parent_pid: 4000 }))
107
+ const pidAlive = aliveSet(87349, 1533, 5000, 4000) // ALL alive
108
+ const found = detectOtherAliveBridges({
109
+ bridgesDir: dir, legacyPath: null,
110
+ myPpid: 851, myPid: 94943, canonicalSid: 'sv-mine', pidAlive,
111
+ })
112
+ const sids = found.map(c => c.session_id).sort()
113
+ assert.deepEqual(sids, ['sv-other']) // my own restart bridge excluded, concurrent kept
114
+ } finally {
115
+ fs.rmSync(dir, { recursive: true, force: true })
116
+ }
117
+ })
118
+
119
+ test('ms-165: the legacy single-claim path also honours the canonicalSid exclusion', () => {
120
+ // The legacy .beacon/bridge.json branch must not be a hole: a same-canonical-sid
121
+ // alive claim there is my own restart too, and must be excluded.
122
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bd-'))
123
+ try {
124
+ const legacy = path.join(dir, 'bridge.json')
125
+ fs.writeFileSync(legacy, JSON.stringify({ session_id: 'sv-mine', pid: 87349, parent_pid: 1533 }))
126
+ const pidAlive = aliveSet(87349, 1533)
127
+ const excluded = detectOtherAliveBridges({
128
+ bridgesDir: null, legacyPath: legacy,
129
+ myPpid: 851, myPid: 94943, canonicalSid: 'sv-mine', pidAlive,
130
+ })
131
+ assert.deepEqual(excluded, []) // my own restart claim in the legacy path is excluded
132
+ // A different-sid legacy claim is still detected.
133
+ fs.writeFileSync(legacy, JSON.stringify({ session_id: 'sv-other', pid: 5000, parent_pid: 4000 }))
134
+ const kept = detectOtherAliveBridges({
135
+ bridgesDir: null, legacyPath: legacy,
136
+ myPpid: 851, myPid: 94943, canonicalSid: 'sv-mine', pidAlive: aliveSet(5000, 4000),
137
+ })
138
+ assert.deepEqual(kept.map(c => c.session_id), ['sv-other'])
139
+ } finally {
140
+ fs.rmSync(dir, { recursive: true, force: true })
141
+ }
142
+ })
143
+
144
+ test('detectOtherAliveBridges returns only claims with a live bridge process', () => {
145
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bd-'))
146
+ try {
147
+ fs.writeFileSync(path.join(dir, 'dead.json'),
148
+ JSON.stringify({ session_id: 'dead', pid: 39892, parent_pid: 31280 }))
149
+ fs.writeFileSync(path.join(dir, 'alive.json'),
150
+ JSON.stringify({ session_id: 'alive', pid: 5000, parent_pid: 4000 }))
151
+ fs.writeFileSync(path.join(dir, 'mine.json'),
152
+ JSON.stringify({ session_id: 'mine', pid: 8888, parent_pid: 9999 }))
153
+ const pidAlive = aliveSet(31280, 5000, 4000, 8888, 9999) // parents+all alive EXCEPT bridge 39892
154
+ const found = detectOtherAliveBridges({
155
+ bridgesDir: dir, legacyPath: null,
156
+ myPpid: 9999, myPid: 8888, pidAlive,
157
+ })
158
+ const sids = found.map(c => c.session_id).sort()
159
+ assert.deepEqual(sids, ['alive']) // dead bridge excluded, mine excluded
160
+ } finally {
161
+ fs.rmSync(dir, { recursive: true, force: true })
162
+ }
163
+ })
164
+
165
+ test('empty / missing bridges dir yields no detections', () => {
166
+ const found = detectOtherAliveBridges({
167
+ bridgesDir: path.join(os.tmpdir(), 'does-not-exist-bd'), legacyPath: null,
168
+ myPpid: 1, myPid: 2, pidAlive: () => true,
169
+ })
170
+ assert.deepEqual(found, [])
171
+ })
@@ -0,0 +1,248 @@
1
+ /**
2
+ * AUTONOMOUS ACTION imperative content builder + gating for the MCP push path.
3
+ *
4
+ * e-1417 (ms-60): historically the MCP `notifications/claude/channel` route
5
+ * only carried situational awareness ("a thing arrived") and the actual
6
+ * "Run this autonomously without asking the user first" imperative was added
7
+ * exclusively by the UserPromptSubmit hook side
8
+ * (`bin/beacon-bus-inbox-hook.py:_format_autonomous_action_block`). The
9
+ * consequence was a structural UX gap: even after a user `opt-in`'d an
10
+ * Operation via `beacon bus auto-execute add`, the Skill would not launch
11
+ * until the user typed at least one prompt to wake the hook. This broke the
12
+ * "set it and forget it" expectation surfaced in the PE cross-project
13
+ * dogfood (e-1413, 2026-06-10).
14
+ *
15
+ * This helper lets the MCP push route emit the same imperative block format
16
+ * so the AI harness sees the launch instruction regardless of which route
17
+ * delivered the event. The Python format must stay in lockstep — the
18
+ * accompanying test (`tests/test_channel_bus_autonomous_content.py`) pins
19
+ * the contract so a future divergence is loud, not silent.
20
+ *
21
+ * Opt-out: `BEACON_BRIDGE_MCP_AUTONOMOUS_DISABLE=1` returns false from the
22
+ * gate, restoring the slim-ping-only push behaviour for callers that hit a
23
+ * regression during the dogfood and need to roll back without redeploying.
24
+ *
25
+ * e-2069 (ms-75): extended to trek-progress-check / trek-trigger /
26
+ * trek-task-review channels. The CHANNEL_TO_SKILL mapping makes the Skill
27
+ * invocation structural — bus.mjs directly emits the launch directive based
28
+ * on the channel name, without depending on AI interpretation of the
29
+ * payload. This closes the silent-ack hole observed in the 2026-06-19
30
+ * dogfood (executor recognised the trek-progress-check event but skipped
31
+ * the Skill launch because compliance to the inbox-hook narrative depended
32
+ * on AI pattern-matching).
33
+ */
34
+
35
+ /**
36
+ * Hardcoded mapping from bus channel name to Claude Code Skill invocation.
37
+ * bus.mjs uses this to translate an incoming event into a "launch this Skill
38
+ * now" directive without depending on AI interpretation of the channel
39
+ * semantics. Add new channels here when introducing new autonomous flows.
40
+ */
41
+ export const CHANNEL_TO_SKILL = Object.freeze({
42
+ 'operation-trigger': '/beacon-operation-execute',
43
+ 'trek-progress-check': '/beacon-trek-execute',
44
+ 'trek-trigger': '/beacon-trek-execute',
45
+ 'trek-task-review': '/beacon-trek-review',
46
+ // ms-92 / e-2164 — leader-digest channel. Recipient is the trek
47
+ // leader's session; the digest carries aggregated per-executor
48
+ // status (= built from pulse-ack structured fields per e-2165) so
49
+ // the leader can spot stuck / idle / needs-leader-judgment sessions
50
+ // without polling. The Skill the leader's AI is expected to invoke
51
+ // is the same /beacon-trek-execute (= leader stance reminder lives
52
+ // inside that Skill, e-2166), but the dispatcher passes the digest
53
+ // payload through so the Skill can render structured output. If
54
+ // /beacon-trek-leader or a dedicated digest Skill is added later
55
+ // (= part of the Trek-leader stance work), retarget here.
56
+ 'trek-leader-digest': '/beacon-trek-execute',
57
+ })
58
+
59
+ function _buildOperationActionContent(evt) {
60
+ const payload = (evt && evt.payload) || {}
61
+ const opId = String(payload.op_id || '?')
62
+ const specDocId = String(payload.spec_doc_id || '')
63
+ const triggerName = String(payload.trigger_name || '')
64
+ const eventId = String((evt && evt.event_id) || '?')
65
+ const lines = [
66
+ '## AUTONOMOUS ACTION — operation autonomy active',
67
+ '',
68
+ '以下の operation-trigger event は `bus_auto_execute_channels` allowlist に登録済 (= 人間 opt-in 済) のため、**確認を取らず autonomous に実行する**。',
69
+ 'Run this autonomously without asking the user first.',
70
+ '',
71
+ `- event_id: ${eventId}`,
72
+ ` - op_id: ${opId}`,
73
+ ]
74
+ if (specDocId) lines.push(` - spec_doc_id: ${specDocId}`)
75
+ if (triggerName) lines.push(` - trigger_name: ${triggerName}`)
76
+ lines.push(` - launch: \`/beacon-operation-execute ${opId}\` (no confirmation prompt)`)
77
+ lines.push('')
78
+ lines.push('budget が枯渇していたら Skill 側 (Step 4.5) が自動で停止 → incident open → note 残しに降格する。')
79
+ return lines.join('\n')
80
+ }
81
+
82
+ function _buildTrekProgressContent(evt) {
83
+ const payload = (evt && evt.payload) || {}
84
+ const trekId = String(payload.trek_id || '?')
85
+ const triggerName = String(payload.trigger_name || '')
86
+ const eventId = String((evt && evt.event_id) || '?')
87
+ const channel = String((evt && evt.channel) || '?')
88
+ // ms-88 / e-2107: server passes the TTL deadline + last activity stamp so
89
+ // the narrative carries actionable "by when" data, not a soft recommendation.
90
+ // These fields are optional during Phase 1 land — the narrative degrades
91
+ // gracefully when the server hasn't been redeployed yet.
92
+ const ttlDeadline = String(payload.ttl_deadline_at || '')
93
+ const lastActivityAt = String(payload.last_activity_at || '')
94
+ const ttlMinutes = payload.ttl_minutes
95
+ // e-4117 (ms-88): the narrative TTL MUST match the real enforcement TTL.
96
+ // Enforcement is DEFAULT_WORKING_TTL_MINUTES = 1440 (24h; lib/trek_scheduler.py,
97
+ // re-relaxed from 12 min on 2026-06-28 after prep-waiting false-stalls). The
98
+ // old narrative hardcoded "12 分" — a 120× overstatement threatening a
99
+ // deadline Layer 3 no longer enforces, which is exactly the "AI learns the
100
+ // narrative is bluffing and ignores it" failure the 3-layer design warns of.
101
+ // Derive the display from the server-passed ttl_minutes, falling back to the
102
+ // enforcement default, so this can never drift from enforcement again.
103
+ const DEFAULT_TTL_MIN = 1440
104
+ const effTtlMin = (typeof ttlMinutes === 'number' && ttlMinutes > 0)
105
+ ? ttlMinutes
106
+ : DEFAULT_TTL_MIN
107
+ const ttlDisplay = (effTtlMin % 60 === 0)
108
+ ? `${effTtlMin / 60} 時間 (= ${effTtlMin} 分)`
109
+ : `${effTtlMin} 分`
110
+ // ms-88 / e-2105 (Phase 1 narrative 強化, ms-88 CORE doc 5nfTSmCDVUzD4SLzIhI5):
111
+ // 旧 narrative (= 「確認を取らず autonomous に実行する」) は AI compliance
112
+ // に依存する soft recommendation だった。 dogfood (= tk-40b0b27c) で executor
113
+ // が「Skill を起動してもしなくても罰則がない」 と internal narrative 化して
114
+ // silent halt する病理が露呈。 強い言い回し + 明示的 consequence + 期限を
115
+ // 添えて「無視できる推奨」 vs 「期限付き必須」 の区別を AI に渡す。
116
+ //
117
+ // 真の強制は server-side TTL safety net (= Layer 3 / e-2107) が担い、 ここは
118
+ // Layer 1 (= narrative) の責務に集中する。 「narrative だけで動く保証はない」
119
+ // ことを前提に、 narrative はあくまで 3 層の最も柔らかい層として機能する。
120
+ const lines = [
121
+ '## ⚠ TREK ACTION REQUIRED — ' + ttlDisplay + '以内に実行 (= 怠ると auto-stall)',
122
+ '',
123
+ '以下の ' + channel + ' event は Trek scope (= 缶詰の徹夜作業部屋、 事前承認スコープ) 内の作業継続経路。',
124
+ '',
125
+ '**必須アクション** (= ' + ttlDisplay + '以内、 怠ると server-side TTL safety net (= ms-88 / e-2107) が当該 session の **全 working task を一括 leader_review に強制遷移** し、 leader review DM を発火する):',
126
+ '',
127
+ ' a. `/beacon-trek-pulse ' + trekId + '` を起動 (= 推奨経路、 5 択 picker: terminal / continue / dm-leader / dm-peer (= 横向き相談、 ms-88 / e-2140 peer-first) / no-op)',
128
+ ' b. または `/beacon-trek-execute ' + trekId + '` を継続 (= 既存 executor loop)',
129
+ ' c. または `beacon trek task-state` で working stamp を更新 (= manual fallback)',
130
+ '',
131
+ 'いずれも取らない場合 = silent halt と扱い、 server が罰則 (= 上記 leader_review 強制遷移) を取ります。 「次 tick まで待つ」 は許可されません。',
132
+ '',
133
+ 'Trek scope (= MS / task / Operation) の作業は user 確認なしで進めてよい。 **例外: デプロイ / リリース / 不可逆 external write** のみ user 承認境界として escalate する (= state `user_review` に遷移)。',
134
+ '',
135
+ `- event_id: ${eventId}`,
136
+ ` - trek_id: ${trekId}`,
137
+ ]
138
+ if (triggerName) lines.push(` - trigger_name: ${triggerName}`)
139
+ if (lastActivityAt) lines.push(` - last_activity_at: ${lastActivityAt}`)
140
+ if (ttlDeadline) lines.push(` - ttl_deadline_at: ${ttlDeadline}`)
141
+ if (ttlMinutes !== undefined && ttlMinutes !== null) {
142
+ lines.push(` - ttl_minutes: ${ttlMinutes}`)
143
+ }
144
+ lines.push('')
145
+ lines.push('budget が枯渇していたら Skill 側 (Step 4.5) が自動で停止 → incident open → note 残しに降格する。Skill の責務なのでこの inject 側で事前判定はしない。')
146
+ lines.push('> Note (= e-4116 / ms-75): この Trek 内の member 間 DM (leader↔executor、同一ユーザーの複数 session を含む) は auto-reply budget を **消費しない** (= server 側で Trek-internal と判定されると bypass)。budget 枯渇の心配は Trek 外向きの送信だけに当たる。')
147
+ lines.push('')
148
+ lines.push('> Note (= ms-88 CORE 5nfTSmCDVUzD4SLzIhI5): この narrative は 3 層強制構造の Layer 1 (= 明示的 consequence 提示)。 Layer 2 (= /beacon-trek-pulse による observable ack) と Layer 3 (= server TTL 罰則) と組合さって初めて「実質的強制」 が成立する。 narrative 単独では AI compliance 依存。')
149
+ return lines.join('\n')
150
+ }
151
+
152
+ function _buildTrekTaskReviewContent(evt) {
153
+ const payload = (evt && evt.payload) || {}
154
+ const trekId = String(payload.trek_id || '?')
155
+ const taskId = String(payload.task_id || '?')
156
+ const state = String(payload.state || '?')
157
+ const note = String(payload.note || '').trim()
158
+ const eventId = String((evt && evt.event_id) || '?')
159
+ const lines = [
160
+ '## TREK ACTION — trek task review required',
161
+ '',
162
+ '以下の trek-task-review event は executor が terminal state を宣言した task の leader review 必須経路。**確認を取らず autonomous に実行する** (= forced 3-択 picker)。',
163
+ 'leader は approve / re-work / forward-to-user のいずれかを必ず選ぶ。 「後で見る」 は許可しない構造 (= leader bottleneck 病理の構造解消)。',
164
+ 'Run this autonomously without asking the user first.',
165
+ '',
166
+ `- event_id: ${eventId}`,
167
+ ` - trek_id: ${trekId}`,
168
+ ` - task_id: ${taskId}`,
169
+ ` - state: ${state}`,
170
+ ]
171
+ if (note) {
172
+ const notePreview = note.length > 200 ? note.slice(0, 200) + '…' : note
173
+ lines.push(` - executor note: ${notePreview}`)
174
+ }
175
+ lines.push(` - launch: \`/beacon-trek-review ${trekId} ${taskId}\` (no confirmation prompt)`)
176
+ lines.push('')
177
+ return lines.join('\n')
178
+ }
179
+
180
+ function _buildTrekLeaderDigestContent(evt) {
181
+ // ms-92 / e-2164 — leader-digest narrative. The payload itself carries
182
+ // the structured ``summary`` + ``sessions[]`` rendered by
183
+ // ``build_leader_digest_payload`` (= lib/trek_scheduler.py). The
184
+ // imperative wrapper tells the leader's AI the dispatch contract:
185
+ // "this is for you, you're the leader, render it for the user, then
186
+ // decide if you want to act on anyone in the stuck / needs-leader
187
+ // band."
188
+ const payload = (evt && evt.payload) || {}
189
+ const trekId = String(payload.trek_id || '?')
190
+ const eventId = String((evt && evt.event_id) || '?')
191
+ const summary = payload.summary || {}
192
+ const lines = [
193
+ '## TREK LEADER DIGEST — 集約 status surface (= ms-92 / e-2164)',
194
+ '',
195
+ '以下の trek-leader-digest event は Trek leader 専用の集約 surface。 同 Trek 内の全 executor (= 実行担当 session) の最新 status (= pulse-ack 構造化 payload、 e-2165) を 1 event に集約したスナップショットが届いている。 **確認を取らず autonomous に処理する** (= leader stance Skill 起動)。',
196
+ 'Run this autonomously without asking the user first.',
197
+ '',
198
+ `- event_id: ${eventId}`,
199
+ ` - trek_id: ${trekId}`,
200
+ ` - active=${summary.active ?? 0} stuck=${summary.stuck ?? 0} idle=${summary.idle ?? 0} needs_leader_judgment=${summary.needs_leader_judgment ?? 0}`,
201
+ ` - launch: \`/beacon-trek-execute ${trekId}\` (no confirmation prompt)`,
202
+ '',
203
+ 'leader として: stuck / needs_leader_judgment のあった executor session に DM で push、 全体が idle なら progress-check の cadence 見直し、 全部 working なら何もしない。 詳細 sessions[] は payload を参照。',
204
+ ]
205
+ return lines.join('\n')
206
+ }
207
+
208
+ /**
209
+ * Build the autonomous-action content block for the MCP push route.
210
+ *
211
+ * Dispatches on the channel name to produce a channel-specific imperative:
212
+ * - operation-trigger → AUTONOMOUS ACTION block (op launch)
213
+ * - trek-progress-check / trek-trigger → TREK ACTION (executor invocation)
214
+ * - trek-task-review → TREK ACTION (leader review picker)
215
+ * - trek-leader-digest → TREK LEADER DIGEST (ms-92 / e-2164)
216
+ *
217
+ * For backward compatibility, events without a recognised channel fall back
218
+ * to the operation-trigger format (the historical default).
219
+ */
220
+ export function buildAutonomousActionContent(evt) {
221
+ const ch = String((evt && evt.channel) || '')
222
+ if (ch === 'trek-progress-check' || ch === 'trek-trigger') {
223
+ return _buildTrekProgressContent(evt)
224
+ }
225
+ if (ch === 'trek-task-review') {
226
+ return _buildTrekTaskReviewContent(evt)
227
+ }
228
+ if (ch === 'trek-leader-digest') {
229
+ return _buildTrekLeaderDigestContent(evt)
230
+ }
231
+ return _buildOperationActionContent(evt)
232
+ }
233
+
234
+ /**
235
+ * Gate: only emit the autonomous-action imperative when the channel × delivery
236
+ * combination is one we have a hardcoded Skill mapping for, and the user has
237
+ * not opted out via `BEACON_BRIDGE_MCP_AUTONOMOUS_DISABLE`.
238
+ */
239
+ export function shouldEmitAutonomousImperative({
240
+ channel,
241
+ delivery,
242
+ autonomousImperativeDisabled,
243
+ }) {
244
+ if (autonomousImperativeDisabled) return false
245
+ if (delivery !== 'auto-execute') return false
246
+ if (!Object.prototype.hasOwnProperty.call(CHANNEL_TO_SKILL, channel)) return false
247
+ return true
248
+ }