@agentikos/omega-os 0.2.0 → 0.19.6

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 (376) hide show
  1. package/README.md +33 -3
  2. package/bootstrap/lib/__pycache__/claude-code-settings.cpython-313.pyc +0 -0
  3. package/bootstrap/lib/__pycache__/llm-clis.cpython-313.pyc +0 -0
  4. package/bootstrap/lib/__pycache__/manifest-helpers.cpython-313.pyc +0 -0
  5. package/bootstrap/lib/claude-code-settings.py +176 -0
  6. package/bootstrap/lib/common.sh +457 -1
  7. package/bootstrap/lib/llm-clis.py +341 -0
  8. package/bootstrap/lib/manifest-helpers.py +384 -0
  9. package/bootstrap/lib/steps.sh +790 -21
  10. package/bootstrap/manifest.example.yaml +87 -1
  11. package/bootstrap/templates/aisb/CLAUDE.md +305 -0
  12. package/bootstrap/templates/aisb/architect.md +204 -0
  13. package/bootstrap/templates/aisb/checkers/CLAUDE.md +9 -0
  14. package/bootstrap/templates/aisb/checkers/checker-architect.md +151 -0
  15. package/bootstrap/templates/aisb/checkers/checker-common.md +171 -0
  16. package/bootstrap/templates/aisb/checkers/checker-construct.md +129 -0
  17. package/bootstrap/templates/aisb/checkers/checker-keymaker.md +204 -0
  18. package/bootstrap/templates/aisb/checkers/checker-link.md +205 -0
  19. package/bootstrap/templates/aisb/checkers/checker-merovingian.md +219 -0
  20. package/bootstrap/templates/aisb/checkers/checker-morpheus.md +211 -0
  21. package/bootstrap/templates/aisb/checkers/checker-neo.md +177 -0
  22. package/bootstrap/templates/aisb/checkers/checker-niobe.md +156 -0
  23. package/bootstrap/templates/aisb/checkers/checker-oracle.md +164 -0
  24. package/bootstrap/templates/aisb/checkers/checker-seraph.md +187 -0
  25. package/bootstrap/templates/aisb/checkers/checker-smith.md +195 -0
  26. package/bootstrap/templates/aisb/checkers/checker-zion.md +113 -0
  27. package/bootstrap/templates/aisb/construct.md +135 -0
  28. package/bootstrap/templates/aisb/keymaker.md +227 -0
  29. package/bootstrap/templates/aisb/link.md +170 -0
  30. package/bootstrap/templates/aisb/lmc-protocol.md +57 -0
  31. package/bootstrap/templates/aisb/merovingian.md +159 -0
  32. package/bootstrap/templates/aisb/morpheus.md +243 -0
  33. package/bootstrap/templates/aisb/neo.md +147 -0
  34. package/bootstrap/templates/aisb/niobe.md +197 -0
  35. package/bootstrap/templates/aisb/oracle.md +244 -0
  36. package/bootstrap/templates/aisb/protocols/handoff-templates.md +204 -0
  37. package/bootstrap/templates/aisb/protocols/shared-protocol.md +248 -0
  38. package/bootstrap/templates/aisb/pythia.md +153 -0
  39. package/bootstrap/templates/aisb/seraph.md +315 -0
  40. package/bootstrap/templates/aisb/smith.md +202 -0
  41. package/bootstrap/templates/aisb/zion.md +172 -0
  42. package/bootstrap/templates/autonomous/audit-patrol.yaml +41 -0
  43. package/bootstrap/templates/autonomous/smith-reflect.yaml +43 -0
  44. package/bootstrap/templates/autonomous/ssh-key-rotate.yaml +46 -0
  45. package/bootstrap/templates/autonomous/support-agent.yaml +38 -0
  46. package/docs/AUDITS.md +85 -0
  47. package/docs/GAP-ANALYSIS.md +214 -0
  48. package/docs/INSTALL.md +47 -9
  49. package/docs/MCP-AND-PLUGINS.md +31 -4
  50. package/docs/SIMULATION.md +171 -0
  51. package/docs/simulate.sh +211 -0
  52. package/install.sh +164 -17
  53. package/omega/Agentik_Engine/README.md +4 -2
  54. package/omega/Agentik_Engine/omega_engine/__init__.py +147 -1
  55. package/omega/Agentik_Engine/omega_engine/__pycache__/__init__.cpython-313.pyc +0 -0
  56. package/omega/Agentik_Engine/omega_engine/__pycache__/account.cpython-313.pyc +0 -0
  57. package/omega/Agentik_Engine/omega_engine/__pycache__/agent_messages.cpython-313.pyc +0 -0
  58. package/omega/Agentik_Engine/omega_engine/__pycache__/aisb_chat.cpython-313.pyc +0 -0
  59. package/omega/Agentik_Engine/omega_engine/__pycache__/audit.cpython-313.pyc +0 -0
  60. package/omega/Agentik_Engine/omega_engine/__pycache__/audit_arsenal.cpython-313.pyc +0 -0
  61. package/omega/Agentik_Engine/omega_engine/__pycache__/audit_diff.cpython-313.pyc +0 -0
  62. package/omega/Agentik_Engine/omega_engine/__pycache__/audit_gate.cpython-313.pyc +0 -0
  63. package/omega/Agentik_Engine/omega_engine/__pycache__/auto_update.cpython-313.pyc +0 -0
  64. package/omega/Agentik_Engine/omega_engine/__pycache__/autonomous.cpython-313.pyc +0 -0
  65. package/omega/Agentik_Engine/omega_engine/__pycache__/backup.cpython-313.pyc +0 -0
  66. package/omega/Agentik_Engine/omega_engine/__pycache__/barrier.cpython-313.pyc +0 -0
  67. package/omega/Agentik_Engine/omega_engine/__pycache__/bus.cpython-313.pyc +0 -0
  68. package/omega/Agentik_Engine/omega_engine/__pycache__/cadence.cpython-313.pyc +0 -0
  69. package/omega/Agentik_Engine/omega_engine/__pycache__/classifier.cpython-313.pyc +0 -0
  70. package/omega/Agentik_Engine/omega_engine/__pycache__/cleanup.cpython-313.pyc +0 -0
  71. package/omega/Agentik_Engine/omega_engine/__pycache__/cli.cpython-313.pyc +0 -0
  72. package/omega/Agentik_Engine/omega_engine/__pycache__/completions.cpython-313.pyc +0 -0
  73. package/omega/Agentik_Engine/omega_engine/__pycache__/costs.cpython-313.pyc +0 -0
  74. package/omega/Agentik_Engine/omega_engine/__pycache__/done_signal.cpython-313.pyc +0 -0
  75. package/omega/Agentik_Engine/omega_engine/__pycache__/envelope.cpython-313.pyc +0 -0
  76. package/omega/Agentik_Engine/omega_engine/__pycache__/events.cpython-313.pyc +0 -0
  77. package/omega/Agentik_Engine/omega_engine/__pycache__/executor.cpython-313.pyc +0 -0
  78. package/omega/Agentik_Engine/omega_engine/__pycache__/handoff.cpython-313.pyc +0 -0
  79. package/omega/Agentik_Engine/omega_engine/__pycache__/hermes.cpython-313.pyc +0 -0
  80. package/omega/Agentik_Engine/omega_engine/__pycache__/hermes_bootstrap.cpython-313.pyc +0 -0
  81. package/omega/Agentik_Engine/omega_engine/__pycache__/hermes_desktop.cpython-313.pyc +0 -0
  82. package/omega/Agentik_Engine/omega_engine/__pycache__/learning.cpython-313.pyc +0 -0
  83. package/omega/Agentik_Engine/omega_engine/__pycache__/managed_agent.cpython-313.pyc +0 -0
  84. package/omega/Agentik_Engine/omega_engine/__pycache__/memory.cpython-313.pyc +0 -0
  85. package/omega/Agentik_Engine/omega_engine/__pycache__/menu.cpython-313.pyc +0 -0
  86. package/omega/Agentik_Engine/omega_engine/__pycache__/mission.cpython-313.pyc +0 -0
  87. package/omega/Agentik_Engine/omega_engine/__pycache__/plan.cpython-313.pyc +0 -0
  88. package/omega/Agentik_Engine/omega_engine/__pycache__/progress.cpython-313.pyc +0 -0
  89. package/omega/Agentik_Engine/omega_engine/__pycache__/project.cpython-313.pyc +0 -0
  90. package/omega/Agentik_Engine/omega_engine/__pycache__/prompts.cpython-313.pyc +0 -0
  91. package/omega/Agentik_Engine/omega_engine/__pycache__/provider.cpython-313.pyc +0 -0
  92. package/omega/Agentik_Engine/omega_engine/__pycache__/prune.cpython-313.pyc +0 -0
  93. package/omega/Agentik_Engine/omega_engine/__pycache__/pursue.cpython-313.pyc +0 -0
  94. package/omega/Agentik_Engine/omega_engine/__pycache__/reducer.cpython-313.pyc +0 -0
  95. package/omega/Agentik_Engine/omega_engine/__pycache__/report.cpython-313.pyc +0 -0
  96. package/omega/Agentik_Engine/omega_engine/__pycache__/router.cpython-313.pyc +0 -0
  97. package/omega/Agentik_Engine/omega_engine/__pycache__/skill_routing.cpython-313.pyc +0 -0
  98. package/omega/Agentik_Engine/omega_engine/__pycache__/smoke.cpython-313.pyc +0 -0
  99. package/omega/Agentik_Engine/omega_engine/__pycache__/store.cpython-313.pyc +0 -0
  100. package/omega/Agentik_Engine/omega_engine/__pycache__/supervisor.cpython-313.pyc +0 -0
  101. package/omega/Agentik_Engine/omega_engine/__pycache__/sync.cpython-313.pyc +0 -0
  102. package/omega/Agentik_Engine/omega_engine/__pycache__/task.cpython-313.pyc +0 -0
  103. package/omega/Agentik_Engine/omega_engine/__pycache__/telegram.cpython-313.pyc +0 -0
  104. package/omega/Agentik_Engine/omega_engine/__pycache__/telegram_history.cpython-313.pyc +0 -0
  105. package/omega/Agentik_Engine/omega_engine/__pycache__/tmux.cpython-313.pyc +0 -0
  106. package/omega/Agentik_Engine/omega_engine/__pycache__/tools.cpython-313.pyc +0 -0
  107. package/omega/Agentik_Engine/omega_engine/__pycache__/understand_anything.cpython-313.pyc +0 -0
  108. package/omega/Agentik_Engine/omega_engine/__pycache__/updater.cpython-313.pyc +0 -0
  109. package/omega/Agentik_Engine/omega_engine/__pycache__/validate.cpython-313.pyc +0 -0
  110. package/omega/Agentik_Engine/omega_engine/__pycache__/vault.cpython-313.pyc +0 -0
  111. package/omega/Agentik_Engine/omega_engine/__pycache__/webhooks.cpython-313.pyc +0 -0
  112. package/omega/Agentik_Engine/omega_engine/__pycache__/worker.cpython-313.pyc +0 -0
  113. package/omega/Agentik_Engine/omega_engine/account.py +28 -31
  114. package/omega/Agentik_Engine/omega_engine/agent_messages.py +167 -0
  115. package/omega/Agentik_Engine/omega_engine/aisb_chat.py +128 -0
  116. package/omega/Agentik_Engine/omega_engine/audit_diff.py +99 -0
  117. package/omega/Agentik_Engine/omega_engine/audit_gate.py +149 -0
  118. package/omega/Agentik_Engine/omega_engine/audits/__init__.py +60 -0
  119. package/omega/Agentik_Engine/omega_engine/audits/__pycache__/__init__.cpython-313.pyc +0 -0
  120. package/omega/Agentik_Engine/omega_engine/audits/__pycache__/batcher.cpython-313.pyc +0 -0
  121. package/omega/Agentik_Engine/omega_engine/audits/__pycache__/dispatcher.cpython-313.pyc +0 -0
  122. package/omega/Agentik_Engine/omega_engine/audits/__pycache__/generator.cpython-313.pyc +0 -0
  123. package/omega/Agentik_Engine/omega_engine/audits/__pycache__/history.cpython-313.pyc +0 -0
  124. package/omega/Agentik_Engine/omega_engine/audits/__pycache__/pipeline.cpython-313.pyc +0 -0
  125. package/omega/Agentik_Engine/omega_engine/audits/batcher.py +218 -0
  126. package/omega/Agentik_Engine/omega_engine/audits/dispatcher.py +92 -0
  127. package/omega/Agentik_Engine/omega_engine/audits/generator.py +234 -0
  128. package/omega/Agentik_Engine/omega_engine/audits/history.py +168 -0
  129. package/omega/Agentik_Engine/omega_engine/audits/pipeline.py +198 -0
  130. package/omega/Agentik_Engine/omega_engine/auto_update.py +339 -0
  131. package/omega/Agentik_Engine/omega_engine/backup.py +215 -0
  132. package/omega/Agentik_Engine/omega_engine/cadence.py +158 -0
  133. package/omega/Agentik_Engine/omega_engine/classifier.py +215 -0
  134. package/omega/Agentik_Engine/omega_engine/cleanup.py +673 -0
  135. package/omega/Agentik_Engine/omega_engine/cli.py +4156 -86
  136. package/omega/Agentik_Engine/omega_engine/completions.py +260 -0
  137. package/omega/Agentik_Engine/omega_engine/costs.py +100 -0
  138. package/omega/Agentik_Engine/omega_engine/daemons/__pycache__/__init__.cpython-313.pyc +0 -0
  139. package/omega/Agentik_Engine/omega_engine/daemons/__pycache__/autonomous.cpython-313.pyc +0 -0
  140. package/omega/Agentik_Engine/omega_engine/daemons/__pycache__/engine.cpython-313.pyc +0 -0
  141. package/omega/Agentik_Engine/omega_engine/daemons/__pycache__/telegram.cpython-313.pyc +0 -0
  142. package/omega/Agentik_Engine/omega_engine/daemons/engine.py +53 -4
  143. package/omega/Agentik_Engine/omega_engine/daemons/telegram.py +101 -17
  144. package/omega/Agentik_Engine/omega_engine/done_signal.py +154 -0
  145. package/omega/Agentik_Engine/omega_engine/educators/__pycache__/__init__.cpython-313.pyc +0 -0
  146. package/omega/Agentik_Engine/omega_engine/educators/__pycache__/artifact.cpython-313.pyc +0 -0
  147. package/omega/Agentik_Engine/omega_engine/educators/__pycache__/automation.cpython-313.pyc +0 -0
  148. package/omega/Agentik_Engine/omega_engine/educators/__pycache__/base.cpython-313.pyc +0 -0
  149. package/omega/Agentik_Engine/omega_engine/educators/__pycache__/claudecode.cpython-313.pyc +0 -0
  150. package/omega/Agentik_Engine/omega_engine/educators/__pycache__/connection.cpython-313.pyc +0 -0
  151. package/omega/Agentik_Engine/omega_engine/educators/__pycache__/coworker.cpython-313.pyc +0 -0
  152. package/omega/Agentik_Engine/omega_engine/educators/__pycache__/loop.cpython-313.pyc +0 -0
  153. package/omega/Agentik_Engine/omega_engine/educators/__pycache__/prompt.cpython-313.pyc +0 -0
  154. package/omega/Agentik_Engine/omega_engine/educators/__pycache__/skill.cpython-313.pyc +0 -0
  155. package/omega/Agentik_Engine/omega_engine/envelope.py +219 -0
  156. package/omega/Agentik_Engine/omega_engine/executor.py +149 -10
  157. package/omega/Agentik_Engine/omega_engine/genesis/__init__.py +134 -0
  158. package/omega/Agentik_Engine/omega_engine/genesis/__pycache__/__init__.cpython-313.pyc +0 -0
  159. package/omega/Agentik_Engine/omega_engine/genesis/__pycache__/orchestrator.cpython-313.pyc +0 -0
  160. package/omega/Agentik_Engine/omega_engine/genesis/__pycache__/phases.cpython-313.pyc +0 -0
  161. package/omega/Agentik_Engine/omega_engine/genesis/__pycache__/stack.cpython-313.pyc +0 -0
  162. package/omega/Agentik_Engine/omega_engine/genesis/__pycache__/state.cpython-313.pyc +0 -0
  163. package/omega/Agentik_Engine/omega_engine/genesis/orchestrator.py +262 -0
  164. package/omega/Agentik_Engine/omega_engine/genesis/phases.py +950 -0
  165. package/omega/Agentik_Engine/omega_engine/genesis/stack.py +324 -0
  166. package/omega/Agentik_Engine/omega_engine/genesis/state.py +353 -0
  167. package/omega/Agentik_Engine/omega_engine/handoff.py +459 -0
  168. package/omega/Agentik_Engine/omega_engine/hermes.py +426 -0
  169. package/omega/Agentik_Engine/omega_engine/hermes_bootstrap.py +382 -0
  170. package/omega/Agentik_Engine/omega_engine/hermes_desktop.py +469 -0
  171. package/omega/Agentik_Engine/omega_engine/integrations/__init__.py +30 -0
  172. package/omega/Agentik_Engine/omega_engine/integrations/__pycache__/__init__.cpython-313.pyc +0 -0
  173. package/omega/Agentik_Engine/omega_engine/integrations/__pycache__/graphify.cpython-313.pyc +0 -0
  174. package/omega/Agentik_Engine/omega_engine/integrations/graphify.py +234 -0
  175. package/omega/Agentik_Engine/omega_engine/learning.py +268 -0
  176. package/omega/Agentik_Engine/omega_engine/managed_agent.py +467 -0
  177. package/omega/Agentik_Engine/omega_engine/memory.py +271 -0
  178. package/omega/Agentik_Engine/omega_engine/menu.py +1065 -0
  179. package/omega/Agentik_Engine/omega_engine/migrations/__init__.py +144 -0
  180. package/omega/Agentik_Engine/omega_engine/migrations/__pycache__/__init__.cpython-313.pyc +0 -0
  181. package/omega/Agentik_Engine/omega_engine/migrations/__pycache__/v0_14_0.cpython-313.pyc +0 -0
  182. package/omega/Agentik_Engine/omega_engine/migrations/v0_14_0.py +29 -0
  183. package/omega/Agentik_Engine/omega_engine/mission.py +16 -13
  184. package/omega/Agentik_Engine/omega_engine/plan.py +846 -0
  185. package/omega/Agentik_Engine/omega_engine/prompts.py +158 -0
  186. package/omega/Agentik_Engine/omega_engine/provider.py +161 -12
  187. package/omega/Agentik_Engine/omega_engine/prune.py +151 -0
  188. package/omega/Agentik_Engine/omega_engine/pursue.py +205 -0
  189. package/omega/Agentik_Engine/omega_engine/rag/__pycache__/__init__.cpython-313.pyc +0 -0
  190. package/omega/Agentik_Engine/omega_engine/rag/__pycache__/agentic.cpython-313.pyc +0 -0
  191. package/omega/Agentik_Engine/omega_engine/rag/__pycache__/base.cpython-313.pyc +0 -0
  192. package/omega/Agentik_Engine/omega_engine/rag/__pycache__/corrective.cpython-313.pyc +0 -0
  193. package/omega/Agentik_Engine/omega_engine/rag/__pycache__/graph.cpython-313.pyc +0 -0
  194. package/omega/Agentik_Engine/omega_engine/rag/__pycache__/hybrid.cpython-313.pyc +0 -0
  195. package/omega/Agentik_Engine/omega_engine/rag/__pycache__/multimodal.cpython-313.pyc +0 -0
  196. package/omega/Agentik_Engine/omega_engine/rag/__pycache__/router.cpython-313.pyc +0 -0
  197. package/omega/Agentik_Engine/omega_engine/router.py +28 -0
  198. package/omega/Agentik_Engine/omega_engine/skill_discovery/__init__.py +48 -0
  199. package/omega/Agentik_Engine/omega_engine/skill_discovery/__pycache__/__init__.cpython-313.pyc +0 -0
  200. package/omega/Agentik_Engine/omega_engine/skill_discovery/__pycache__/auditor.cpython-313.pyc +0 -0
  201. package/omega/Agentik_Engine/omega_engine/skill_discovery/__pycache__/finder.cpython-313.pyc +0 -0
  202. package/omega/Agentik_Engine/omega_engine/skill_discovery/__pycache__/installer.cpython-313.pyc +0 -0
  203. package/omega/Agentik_Engine/omega_engine/skill_discovery/__pycache__/marketplaces.cpython-313.pyc +0 -0
  204. package/omega/Agentik_Engine/omega_engine/skill_discovery/auditor.py +232 -0
  205. package/omega/Agentik_Engine/omega_engine/skill_discovery/finder.py +94 -0
  206. package/omega/Agentik_Engine/omega_engine/skill_discovery/installer.py +129 -0
  207. package/omega/Agentik_Engine/omega_engine/skill_discovery/marketplaces.py +80 -0
  208. package/omega/Agentik_Engine/omega_engine/skill_routing.py +388 -0
  209. package/omega/Agentik_Engine/omega_engine/smoke.py +81 -0
  210. package/omega/Agentik_Engine/omega_engine/store.py +88 -41
  211. package/omega/Agentik_Engine/omega_engine/sync.py +142 -1
  212. package/omega/Agentik_Engine/omega_engine/telegram_history.py +260 -0
  213. package/omega/Agentik_Engine/omega_engine/tmux.py +526 -0
  214. package/omega/Agentik_Engine/omega_engine/understand_anything.py +275 -0
  215. package/omega/Agentik_Engine/omega_engine/updater.py +70 -0
  216. package/omega/Agentik_Engine/omega_engine/validate.py +186 -0
  217. package/omega/Agentik_Engine/omega_engine/vault.py +342 -0
  218. package/omega/Agentik_Engine/omega_engine/webhooks.py +262 -0
  219. package/omega/Agentik_Engine/omega_engine/worker.py +526 -0
  220. package/omega/Agentik_Engine/pyproject.toml +1 -1
  221. package/omega/Agentik_Engine/tests/__pycache__/test_account.cpython-313-pytest-8.4.2.pyc +0 -0
  222. package/omega/Agentik_Engine/tests/__pycache__/test_account.cpython-313.pyc +0 -0
  223. package/omega/Agentik_Engine/tests/__pycache__/test_adversarial.cpython-313-pytest-8.4.2.pyc +0 -0
  224. package/omega/Agentik_Engine/tests/__pycache__/test_adversarial.cpython-313.pyc +0 -0
  225. package/omega/Agentik_Engine/tests/__pycache__/test_agents_envelope.cpython-313-pytest-8.4.2.pyc +0 -0
  226. package/omega/Agentik_Engine/tests/__pycache__/test_agents_envelope.cpython-313.pyc +0 -0
  227. package/omega/Agentik_Engine/tests/__pycache__/test_audit_arsenal.cpython-313-pytest-8.4.2.pyc +0 -0
  228. package/omega/Agentik_Engine/tests/__pycache__/test_audit_arsenal.cpython-313.pyc +0 -0
  229. package/omega/Agentik_Engine/tests/__pycache__/test_audits_pipeline.cpython-313-pytest-8.4.2.pyc +0 -0
  230. package/omega/Agentik_Engine/tests/__pycache__/test_audits_pipeline.cpython-313.pyc +0 -0
  231. package/omega/Agentik_Engine/tests/__pycache__/test_auto_update_and_migrations.cpython-313-pytest-8.4.2.pyc +0 -0
  232. package/omega/Agentik_Engine/tests/__pycache__/test_auto_update_and_migrations.cpython-313.pyc +0 -0
  233. package/omega/Agentik_Engine/tests/__pycache__/test_autonomous.cpython-313-pytest-8.4.2.pyc +0 -0
  234. package/omega/Agentik_Engine/tests/__pycache__/test_autonomous.cpython-313.pyc +0 -0
  235. package/omega/Agentik_Engine/tests/__pycache__/test_educators.cpython-313-pytest-8.4.2.pyc +0 -0
  236. package/omega/Agentik_Engine/tests/__pycache__/test_educators.cpython-313.pyc +0 -0
  237. package/omega/Agentik_Engine/tests/__pycache__/test_executor.cpython-313-pytest-8.4.2.pyc +0 -0
  238. package/omega/Agentik_Engine/tests/__pycache__/test_executor.cpython-313.pyc +0 -0
  239. package/omega/Agentik_Engine/tests/__pycache__/test_genesis_and_plan.cpython-313-pytest-8.4.2.pyc +0 -0
  240. package/omega/Agentik_Engine/tests/__pycache__/test_genesis_and_plan.cpython-313.pyc +0 -0
  241. package/omega/Agentik_Engine/tests/__pycache__/test_graphify.cpython-313-pytest-8.4.2.pyc +0 -0
  242. package/omega/Agentik_Engine/tests/__pycache__/test_graphify.cpython-313.pyc +0 -0
  243. package/omega/Agentik_Engine/tests/__pycache__/test_handoff.cpython-313-pytest-8.4.2.pyc +0 -0
  244. package/omega/Agentik_Engine/tests/__pycache__/test_handoff.cpython-313.pyc +0 -0
  245. package/omega/Agentik_Engine/tests/__pycache__/test_hermes_and_ua.cpython-313-pytest-8.4.2.pyc +0 -0
  246. package/omega/Agentik_Engine/tests/__pycache__/test_hermes_and_ua.cpython-313.pyc +0 -0
  247. package/omega/Agentik_Engine/tests/__pycache__/test_hermes_bootstrap_and_desktop.cpython-313-pytest-8.4.2.pyc +0 -0
  248. package/omega/Agentik_Engine/tests/__pycache__/test_hermes_bootstrap_and_desktop.cpython-313.pyc +0 -0
  249. package/omega/Agentik_Engine/tests/__pycache__/test_install_steps.cpython-313-pytest-8.4.2.pyc +0 -0
  250. package/omega/Agentik_Engine/tests/__pycache__/test_install_steps.cpython-313.pyc +0 -0
  251. package/omega/Agentik_Engine/tests/__pycache__/test_install_ux.cpython-313-pytest-8.4.2.pyc +0 -0
  252. package/omega/Agentik_Engine/tests/__pycache__/test_install_ux.cpython-313.pyc +0 -0
  253. package/omega/Agentik_Engine/tests/__pycache__/test_installer_wiring.cpython-313-pytest-8.4.2.pyc +0 -0
  254. package/omega/Agentik_Engine/tests/__pycache__/test_installer_wiring.cpython-313.pyc +0 -0
  255. package/omega/Agentik_Engine/tests/__pycache__/test_intelligence.cpython-313-pytest-8.4.2.pyc +0 -0
  256. package/omega/Agentik_Engine/tests/__pycache__/test_intelligence.cpython-313.pyc +0 -0
  257. package/omega/Agentik_Engine/tests/__pycache__/test_llm_clis_and_uninstall.cpython-313-pytest-8.4.2.pyc +0 -0
  258. package/omega/Agentik_Engine/tests/__pycache__/test_llm_clis_and_uninstall.cpython-313.pyc +0 -0
  259. package/omega/Agentik_Engine/tests/__pycache__/test_managed_agent.cpython-313-pytest-8.4.2.pyc +0 -0
  260. package/omega/Agentik_Engine/tests/__pycache__/test_managed_agent.cpython-313.pyc +0 -0
  261. package/omega/Agentik_Engine/tests/__pycache__/test_max_provider_and_menu.cpython-313-pytest-8.4.2.pyc +0 -0
  262. package/omega/Agentik_Engine/tests/__pycache__/test_max_provider_and_menu.cpython-313.pyc +0 -0
  263. package/omega/Agentik_Engine/tests/__pycache__/test_menu_coverage.cpython-313-pytest-8.4.2.pyc +0 -0
  264. package/omega/Agentik_Engine/tests/__pycache__/test_menu_coverage.cpython-313.pyc +0 -0
  265. package/omega/Agentik_Engine/tests/__pycache__/test_mission.cpython-313-pytest-8.4.2.pyc +0 -0
  266. package/omega/Agentik_Engine/tests/__pycache__/test_mission.cpython-313.pyc +0 -0
  267. package/omega/Agentik_Engine/tests/__pycache__/test_progress.cpython-313-pytest-8.4.2.pyc +0 -0
  268. package/omega/Agentik_Engine/tests/__pycache__/test_progress.cpython-313.pyc +0 -0
  269. package/omega/Agentik_Engine/tests/__pycache__/test_project.cpython-313-pytest-8.4.2.pyc +0 -0
  270. package/omega/Agentik_Engine/tests/__pycache__/test_project.cpython-313.pyc +0 -0
  271. package/omega/Agentik_Engine/tests/__pycache__/test_pursue_cadence.cpython-313-pytest-8.4.2.pyc +0 -0
  272. package/omega/Agentik_Engine/tests/__pycache__/test_pursue_cadence.cpython-313.pyc +0 -0
  273. package/omega/Agentik_Engine/tests/__pycache__/test_rag.cpython-313-pytest-8.4.2.pyc +0 -0
  274. package/omega/Agentik_Engine/tests/__pycache__/test_rag.cpython-313.pyc +0 -0
  275. package/omega/Agentik_Engine/tests/__pycache__/test_reducer.cpython-313-pytest-8.4.2.pyc +0 -0
  276. package/omega/Agentik_Engine/tests/__pycache__/test_reducer.cpython-313.pyc +0 -0
  277. package/omega/Agentik_Engine/tests/__pycache__/test_report.cpython-313-pytest-8.4.2.pyc +0 -0
  278. package/omega/Agentik_Engine/tests/__pycache__/test_report.cpython-313.pyc +0 -0
  279. package/omega/Agentik_Engine/tests/__pycache__/test_role_aliases_and_ssot.cpython-313-pytest-8.4.2.pyc +0 -0
  280. package/omega/Agentik_Engine/tests/__pycache__/test_role_aliases_and_ssot.cpython-313.pyc +0 -0
  281. package/omega/Agentik_Engine/tests/__pycache__/test_skill_discovery_and_gate.cpython-313-pytest-8.4.2.pyc +0 -0
  282. package/omega/Agentik_Engine/tests/__pycache__/test_skill_discovery_and_gate.cpython-313.pyc +0 -0
  283. package/omega/Agentik_Engine/tests/__pycache__/test_skill_power.cpython-313-pytest-8.4.2.pyc +0 -0
  284. package/omega/Agentik_Engine/tests/__pycache__/test_skill_power.cpython-313.pyc +0 -0
  285. package/omega/Agentik_Engine/tests/__pycache__/test_skill_routing.cpython-313-pytest-8.4.2.pyc +0 -0
  286. package/omega/Agentik_Engine/tests/__pycache__/test_skill_routing.cpython-313.pyc +0 -0
  287. package/omega/Agentik_Engine/tests/__pycache__/test_snapshot_partial.cpython-313-pytest-8.4.2.pyc +0 -0
  288. package/omega/Agentik_Engine/tests/__pycache__/test_snapshot_partial.cpython-313.pyc +0 -0
  289. package/omega/Agentik_Engine/tests/__pycache__/test_telegram_history.cpython-313-pytest-8.4.2.pyc +0 -0
  290. package/omega/Agentik_Engine/tests/__pycache__/test_telegram_history.cpython-313.pyc +0 -0
  291. package/omega/Agentik_Engine/tests/__pycache__/test_tmux_and_aisb_chat.cpython-313-pytest-8.4.2.pyc +0 -0
  292. package/omega/Agentik_Engine/tests/__pycache__/test_tmux_and_aisb_chat.cpython-313.pyc +0 -0
  293. package/omega/Agentik_Engine/tests/__pycache__/test_tools_and_sync.cpython-313-pytest-8.4.2.pyc +0 -0
  294. package/omega/Agentik_Engine/tests/__pycache__/test_tools_and_sync.cpython-313.pyc +0 -0
  295. package/omega/Agentik_Engine/tests/__pycache__/test_v06_features.cpython-313-pytest-8.4.2.pyc +0 -0
  296. package/omega/Agentik_Engine/tests/__pycache__/test_v06_features.cpython-313.pyc +0 -0
  297. package/omega/Agentik_Engine/tests/__pycache__/test_vault.cpython-313-pytest-8.4.2.pyc +0 -0
  298. package/omega/Agentik_Engine/tests/__pycache__/test_vault.cpython-313.pyc +0 -0
  299. package/omega/Agentik_Engine/tests/__pycache__/test_webhooks_and_readiness.cpython-313-pytest-8.4.2.pyc +0 -0
  300. package/omega/Agentik_Engine/tests/__pycache__/test_webhooks_and_readiness.cpython-313.pyc +0 -0
  301. package/omega/Agentik_Engine/tests/__pycache__/test_worker_and_cleanup.cpython-313-pytest-8.4.2.pyc +0 -0
  302. package/omega/Agentik_Engine/tests/__pycache__/test_worker_and_cleanup.cpython-313.pyc +0 -0
  303. package/omega/Agentik_Engine/tests/test_account.py +8 -3
  304. package/omega/Agentik_Engine/tests/test_adversarial.py +351 -0
  305. package/omega/Agentik_Engine/tests/test_agents_envelope.py +274 -0
  306. package/omega/Agentik_Engine/tests/test_audits_pipeline.py +348 -0
  307. package/omega/Agentik_Engine/tests/test_auto_update_and_migrations.py +394 -0
  308. package/omega/Agentik_Engine/tests/test_genesis_and_plan.py +573 -0
  309. package/omega/Agentik_Engine/tests/test_graphify.py +190 -0
  310. package/omega/Agentik_Engine/tests/test_handoff.py +311 -0
  311. package/omega/Agentik_Engine/tests/test_hermes_and_ua.py +387 -0
  312. package/omega/Agentik_Engine/tests/test_hermes_bootstrap_and_desktop.py +358 -0
  313. package/omega/Agentik_Engine/tests/test_install_steps.py +359 -0
  314. package/omega/Agentik_Engine/tests/test_install_ux.py +151 -0
  315. package/omega/Agentik_Engine/tests/test_installer_wiring.py +496 -0
  316. package/omega/Agentik_Engine/tests/test_intelligence.py +285 -0
  317. package/omega/Agentik_Engine/tests/test_llm_clis_and_uninstall.py +228 -0
  318. package/omega/Agentik_Engine/tests/test_managed_agent.py +363 -0
  319. package/omega/Agentik_Engine/tests/test_max_provider_and_menu.py +231 -0
  320. package/omega/Agentik_Engine/tests/test_menu_coverage.py +72 -0
  321. package/omega/Agentik_Engine/tests/test_pursue_cadence.py +217 -0
  322. package/omega/Agentik_Engine/tests/test_role_aliases_and_ssot.py +207 -0
  323. package/omega/Agentik_Engine/tests/test_skill_discovery_and_gate.py +337 -0
  324. package/omega/Agentik_Engine/tests/test_skill_power.py +259 -0
  325. package/omega/Agentik_Engine/tests/test_skill_routing.py +189 -0
  326. package/omega/Agentik_Engine/tests/test_telegram_history.py +209 -0
  327. package/omega/Agentik_Engine/tests/test_tmux_and_aisb_chat.py +223 -0
  328. package/omega/Agentik_Engine/tests/test_v06_features.py +370 -0
  329. package/omega/Agentik_Engine/tests/test_vault.py +173 -0
  330. package/omega/Agentik_Engine/tests/test_webhooks_and_readiness.py +277 -0
  331. package/omega/Agentik_Engine/tests/test_worker_and_cleanup.py +541 -0
  332. package/omega/Agentik_Extra/etc/secrets/.vault-key +3 -0
  333. package/omega/Agentik_Extra/etc/secrets/.vault-pub +1 -0
  334. package/omega/Agentik_Runtime/audits.db +0 -0
  335. package/omega/Agentik_SSOT/VERSION +1 -1
  336. package/omega/Agentik_SSOT/claude-plugins/claude-plugins.yaml +100 -0
  337. package/omega/Agentik_SSOT/docs/LAYERS.md +90 -0
  338. package/omega/Agentik_SSOT/docs/USER-JOURNEY.md +283 -0
  339. package/omega/Agentik_SSOT/docs/quality-arsenal/ARSENAL-INTERCONNECTIONS.md +283 -0
  340. package/omega/Agentik_SSOT/docs/quality-arsenal/ARSENAL-ORCHESTRATION-PLAYBOOK.md +364 -0
  341. package/omega/Agentik_SSOT/docs/quality-arsenal/AUDIT-VERIFICATION-CONTRACT.md +272 -0
  342. package/omega/Agentik_SSOT/docs/quality-arsenal/QUALITY-ARSENAL-PREAMBLE.md +462 -0
  343. package/omega/Agentik_SSOT/marketplaces/design-discipline.yaml +86 -0
  344. package/omega/Agentik_SSOT/skills/a11yaudit/SKILL.md +161 -0
  345. package/omega/Agentik_SSOT/skills/apiaudit/SKILL.md +157 -0
  346. package/omega/Agentik_SSOT/skills/audit-orchestrator.md +212 -0
  347. package/omega/Agentik_SSOT/skills/audit-pilot.md +466 -0
  348. package/omega/Agentik_SSOT/skills/audit-tracker.md +147 -0
  349. package/omega/Agentik_SSOT/skills/automationaudit/SKILL.md +161 -0
  350. package/omega/Agentik_SSOT/skills/cadence/SKILL.md +76 -0
  351. package/omega/Agentik_SSOT/skills/codeaudit/SKILL.md +153 -0
  352. package/omega/Agentik_SSOT/skills/copyaudit/SKILL.md +161 -0
  353. package/omega/Agentik_SSOT/skills/dataaudit/SKILL.md +157 -0
  354. package/omega/Agentik_SSOT/skills/debugaudit/SKILL.md +161 -0
  355. package/omega/Agentik_SSOT/skills/dispatch/SKILL.md +79 -0
  356. package/omega/Agentik_SSOT/skills/dxaudit/SKILL.md +161 -0
  357. package/omega/Agentik_SSOT/skills/featureaudit/SKILL.md +161 -0
  358. package/omega/Agentik_SSOT/skills/flowaudit/SKILL.md +165 -0
  359. package/omega/Agentik_SSOT/skills/genesis/SKILL.md +116 -0
  360. package/omega/Agentik_SSOT/skills/handoff/SKILL.md +117 -0
  361. package/omega/Agentik_SSOT/skills/logicaudit/SKILL.md +165 -0
  362. package/omega/Agentik_SSOT/skills/motionaudit/SKILL.md +165 -0
  363. package/omega/Agentik_SSOT/skills/newcmd.md +300 -0
  364. package/omega/Agentik_SSOT/skills/perfaudit/SKILL.md +161 -0
  365. package/omega/Agentik_SSOT/skills/plan/SKILL.md +127 -0
  366. package/omega/Agentik_SSOT/skills/pursue/SKILL.md +68 -0
  367. package/omega/Agentik_SSOT/skills/quality-arsenal.md +180 -0
  368. package/omega/Agentik_SSOT/skills/rag-route.md +9 -0
  369. package/omega/Agentik_SSOT/skills/refontaudit/SKILL.md +165 -0
  370. package/omega/Agentik_SSOT/skills/retentionaudit/SKILL.md +165 -0
  371. package/omega/Agentik_SSOT/skills/secaudit/SKILL.md +157 -0
  372. package/omega/Agentik_SSOT/skills/seoaudit/SKILL.md +161 -0
  373. package/omega/Agentik_SSOT/skills/skill-auditor/SKILL.md +83 -0
  374. package/omega/Agentik_SSOT/skills/skill-finder/SKILL.md +116 -0
  375. package/omega/Agentik_SSOT/skills/uiuxaudit/SKILL.md +165 -0
  376. package/package.json +2 -2
@@ -0,0 +1,260 @@
1
+ """Shell completion scripts for ``omega``.
2
+
3
+ Generates bash + zsh + fish completion files from the live argparse tree
4
+ so the file always reflects the current command surface — no hand-edited
5
+ completion list to drift.
6
+
7
+ Files land at:
8
+
9
+ * ``$OMEGA_HOME/Agentik_Tools/completions/omega.bash``
10
+ * ``$OMEGA_HOME/Agentik_Tools/completions/_omega`` (zsh)
11
+ * ``$OMEGA_HOME/Agentik_Tools/completions/omega.fish``
12
+
13
+ The ``omega completions install`` CLI sources / symlinks them into the
14
+ right place per shell. Idempotent.
15
+ """
16
+ from __future__ import annotations
17
+
18
+ import argparse
19
+ import os
20
+ import shutil
21
+ from dataclasses import dataclass
22
+ from pathlib import Path
23
+
24
+
25
+ @dataclass
26
+ class CommandNode:
27
+ """One node in the omega command tree."""
28
+ name: str
29
+ help_text: str = ""
30
+ subcommands: list["CommandNode"] = None # type: ignore[assignment]
31
+
32
+ def __post_init__(self) -> None:
33
+ if self.subcommands is None:
34
+ self.subcommands = []
35
+
36
+
37
+ def extract_tree(parser: argparse.ArgumentParser) -> CommandNode:
38
+ """Walk an argparse parser and produce a CommandNode tree."""
39
+ root = CommandNode(name="omega", help_text="Omega OS control CLI")
40
+ # The top-level parser has one subparsers action — find it.
41
+ for action in parser._actions: # noqa: SLF001
42
+ if isinstance(action, argparse._SubParsersAction): # noqa: SLF001
43
+ for name, sub_parser in action.choices.items():
44
+ root.subcommands.append(_walk(name, sub_parser))
45
+ break
46
+ return root
47
+
48
+
49
+ def _walk(name: str, parser: argparse.ArgumentParser) -> CommandNode:
50
+ node = CommandNode(name=name, help_text=(parser.description or "").strip())
51
+ for action in parser._actions: # noqa: SLF001
52
+ if isinstance(action, argparse._SubParsersAction): # noqa: SLF001
53
+ for sub_name, sub_parser in action.choices.items():
54
+ node.subcommands.append(_walk(sub_name, sub_parser))
55
+ break
56
+ return node
57
+
58
+
59
+ # ---------------------------------------------------------------------------
60
+ # Bash
61
+ # ---------------------------------------------------------------------------
62
+
63
+
64
+ def render_bash(root: CommandNode) -> str:
65
+ """Generate a bash completion script for the command tree."""
66
+ # Build a flat map: "omega" → first-level subs;
67
+ # "omega <sub>" → that sub's children, etc.
68
+ lines: list[str] = [
69
+ "#!/usr/bin/env bash",
70
+ "# omega — bash completion (auto-generated by omega completions)",
71
+ "",
72
+ "_omega_complete() {",
73
+ " local cur prev words cword",
74
+ " _init_completion || return",
75
+ "",
76
+ ]
77
+
78
+ # We compute completion by walking COMP_WORDS skipping flags.
79
+ lines += [
80
+ ' local commands="' + " ".join(s.name for s in root.subcommands) + '"',
81
+ ' if [ $cword -eq 1 ]; then',
82
+ ' COMPREPLY=( $(compgen -W "$commands" -- "$cur") )',
83
+ ' return 0',
84
+ ' fi',
85
+ ]
86
+
87
+ for sub in root.subcommands:
88
+ if not sub.subcommands:
89
+ continue
90
+ children = " ".join(c.name for c in sub.subcommands)
91
+ lines += [
92
+ f' if [ "${{words[1]}}" = "{sub.name}" ] && [ $cword -eq 2 ]; then',
93
+ f' COMPREPLY=( $(compgen -W "{children}" -- "$cur") )',
94
+ ' return 0',
95
+ ' fi',
96
+ ]
97
+
98
+ lines += [
99
+ ' COMPREPLY=( $(compgen -f -- "$cur") )',
100
+ "}",
101
+ "complete -F _omega_complete omega",
102
+ "",
103
+ ]
104
+ return "\n".join(lines)
105
+
106
+
107
+ # ---------------------------------------------------------------------------
108
+ # Zsh
109
+ # ---------------------------------------------------------------------------
110
+
111
+
112
+ def render_zsh(root: CommandNode) -> str:
113
+ """Generate a zsh completion script (uses _arguments / _describe)."""
114
+ lines: list[str] = [
115
+ "#compdef omega",
116
+ "# omega — zsh completion (auto-generated by omega completions)",
117
+ "",
118
+ "_omega() {",
119
+ " local context state line",
120
+ " typeset -A opt_args",
121
+ "",
122
+ ' _arguments -C \\',
123
+ " '1: :->command' \\",
124
+ " '*::arg:->args'",
125
+ "",
126
+ " case $state in",
127
+ " command)",
128
+ " local -a commands",
129
+ " commands=(",
130
+ ]
131
+ for sub in root.subcommands:
132
+ help_one = sub.help_text.split("\n")[0].replace("'", "'\\''")
133
+ lines.append(f" '{sub.name}:{help_one[:60]}'")
134
+ lines += [
135
+ " )",
136
+ " _describe -t commands 'omega command' commands",
137
+ " ;;",
138
+ " args)",
139
+ " case $line[1] in",
140
+ ]
141
+ for sub in root.subcommands:
142
+ if not sub.subcommands:
143
+ continue
144
+ lines += [
145
+ f" {sub.name})",
146
+ " local -a subs",
147
+ " subs=(",
148
+ ]
149
+ for child in sub.subcommands:
150
+ help_one = child.help_text.split("\n")[0].replace("'", "'\\''")
151
+ lines.append(f" '{child.name}:{help_one[:60]}'")
152
+ lines += [
153
+ " )",
154
+ f" _describe -t subcommands '{sub.name}' subs",
155
+ " ;;",
156
+ ]
157
+ lines += [
158
+ " esac",
159
+ " ;;",
160
+ " esac",
161
+ "}",
162
+ "",
163
+ "_omega \"$@\"",
164
+ "",
165
+ ]
166
+ return "\n".join(lines)
167
+
168
+
169
+ # ---------------------------------------------------------------------------
170
+ # Fish
171
+ # ---------------------------------------------------------------------------
172
+
173
+
174
+ def render_fish(root: CommandNode) -> str:
175
+ """Generate a fish completion script."""
176
+ lines: list[str] = [
177
+ "# omega — fish completion (auto-generated by omega completions)",
178
+ "",
179
+ ]
180
+ for sub in root.subcommands:
181
+ desc = sub.help_text.split("\n")[0].replace("'", "\\'")[:60]
182
+ lines.append(
183
+ f"complete -c omega -n '__fish_use_subcommand' -a '{sub.name}' "
184
+ f"-d '{desc}'"
185
+ )
186
+ for sub in root.subcommands:
187
+ if not sub.subcommands:
188
+ continue
189
+ for child in sub.subcommands:
190
+ desc = child.help_text.split("\n")[0].replace("'", "\\'")[:60]
191
+ lines.append(
192
+ f"complete -c omega -n '__fish_seen_subcommand_from "
193
+ f"{sub.name}' -a '{child.name}' -d '{desc}'"
194
+ )
195
+ lines.append("")
196
+ return "\n".join(lines)
197
+
198
+
199
+ # ---------------------------------------------------------------------------
200
+ # Install
201
+ # ---------------------------------------------------------------------------
202
+
203
+
204
+ def write_all(omega_home: str | Path, root: CommandNode) -> dict[str, Path]:
205
+ """Write all three completion files. Returns paths."""
206
+ out = Path(omega_home) / "Agentik_Tools" / "completions"
207
+ out.mkdir(parents=True, exist_ok=True)
208
+ bash = out / "omega.bash"
209
+ zsh = out / "_omega"
210
+ fish = out / "omega.fish"
211
+ bash.write_text(render_bash(root))
212
+ zsh.write_text(render_zsh(root))
213
+ fish.write_text(render_fish(root))
214
+ return {"bash": bash, "zsh": zsh, "fish": fish}
215
+
216
+
217
+ def install_for_shell(
218
+ omega_home: str | Path, shell: str,
219
+ ) -> dict[str, str]:
220
+ """Hook the completion into the operator's shell.
221
+
222
+ For each shell we know the conventional install location:
223
+
224
+ bash → ``~/.bash_completion.d/omega`` (if it exists) or sourced
225
+ from ``~/.bashrc``
226
+ zsh → ``~/.zsh/completion/_omega`` (fpath addition in ``~/.zshrc``)
227
+ fish → ``~/.config/fish/completions/omega.fish``
228
+
229
+ We never overwrite an existing operator file; we symlink. Returns a
230
+ summary dict.
231
+ """
232
+ home = Path(omega_home)
233
+ completions = home / "Agentik_Tools" / "completions"
234
+ if not completions.is_dir():
235
+ return {"status": "error",
236
+ "detail": f"{completions} does not exist — "
237
+ "run `omega completions write` first"}
238
+ shell = shell.lower()
239
+ if shell == "bash":
240
+ target_dir = Path.home() / ".bash_completion.d"
241
+ target_dir.mkdir(parents=True, exist_ok=True)
242
+ link = target_dir / "omega"
243
+ src = completions / "omega.bash"
244
+ elif shell == "zsh":
245
+ target_dir = Path.home() / ".zsh" / "completion"
246
+ target_dir.mkdir(parents=True, exist_ok=True)
247
+ link = target_dir / "_omega"
248
+ src = completions / "_omega"
249
+ elif shell == "fish":
250
+ target_dir = Path.home() / ".config" / "fish" / "completions"
251
+ target_dir.mkdir(parents=True, exist_ok=True)
252
+ link = target_dir / "omega.fish"
253
+ src = completions / "omega.fish"
254
+ else:
255
+ return {"status": "error", "detail": f"unknown shell: {shell}"}
256
+
257
+ if link.is_symlink() or link.exists():
258
+ link.unlink()
259
+ link.symlink_to(src)
260
+ return {"status": "ok", "link": str(link), "src": str(src), "shell": shell}
@@ -0,0 +1,100 @@
1
+ """Provider cost rate cards — turn token usage into $.
2
+
3
+ The ``BillingAggregator`` already aggregates input/output tokens per
4
+ account from the event log. This module multiplies by a per-provider
5
+ rate card and surfaces $ in the CLI.
6
+
7
+ Rate cards are kept in code (not a YAML the operator edits) because:
8
+
9
+ 1. Anthropic / OpenAI / Zhipu publish public list prices.
10
+ 2. An out-of-date rate card → wrong projections, but the underlying
11
+ usage numbers are unaffected. The risk is only in the dashboard,
12
+ not in any state we depend on.
13
+ 3. We document the rate card date so the operator knows when it was
14
+ last refreshed.
15
+
16
+ Updating the rate card is a one-line edit when a provider changes prices.
17
+ The doctor surfaces "rate card from <date>; check if your provider has
18
+ changed prices since" so it's never silent.
19
+
20
+ NOTE: Rates here are USD per million tokens, current at the date below.
21
+ """
22
+ from __future__ import annotations
23
+
24
+ from dataclasses import dataclass
25
+
26
+
27
+ RATE_CARD_DATE = "2026-05-23"
28
+
29
+
30
+ @dataclass(frozen=True)
31
+ class Rates:
32
+ """USD per MILLION tokens, input and output."""
33
+ input_per_million: float
34
+ output_per_million: float
35
+
36
+
37
+ # Most-common models per provider. The model field on the event payload
38
+ # determines which row we use; fall back to a sensible default per provider.
39
+ _RATES: dict[str, dict[str, Rates]] = {
40
+ "claude": {
41
+ "claude-opus-4-7": Rates(input_per_million=15.00, output_per_million=75.00),
42
+ "claude-sonnet-4-6": Rates(input_per_million= 3.00, output_per_million=15.00),
43
+ "claude-haiku-4-5": Rates(input_per_million= 0.25, output_per_million= 1.25),
44
+ # fallback
45
+ "default": Rates(input_per_million= 3.00, output_per_million=15.00),
46
+ },
47
+ "openai": {
48
+ "gpt-4o": Rates(input_per_million= 2.50, output_per_million=10.00),
49
+ "gpt-4o-mini": Rates(input_per_million= 0.15, output_per_million= 0.60),
50
+ "default": Rates(input_per_million= 2.50, output_per_million=10.00),
51
+ },
52
+ "glm": {
53
+ "glm-4-plus": Rates(input_per_million= 5.00, output_per_million=15.00),
54
+ "glm-4-flash": Rates(input_per_million= 0.00, output_per_million= 0.00),
55
+ "default": Rates(input_per_million= 1.00, output_per_million= 2.00),
56
+ },
57
+ "deepseek": {
58
+ "deepseek-chat": Rates(input_per_million=0.14, output_per_million=0.28),
59
+ "deepseek-reasoner": Rates(input_per_million=0.55, output_per_million=2.19),
60
+ "default": Rates(input_per_million=0.14, output_per_million=0.28),
61
+ },
62
+ }
63
+
64
+
65
+ def estimate_cost(
66
+ provider: str,
67
+ *,
68
+ input_tokens: int,
69
+ output_tokens: int,
70
+ model: str = "default",
71
+ ) -> float:
72
+ """Return cost in USD for the given usage."""
73
+ table = _RATES.get(provider.lower())
74
+ if not table:
75
+ return 0.0
76
+ rates = table.get(model) or table["default"]
77
+ return (
78
+ (input_tokens / 1_000_000) * rates.input_per_million
79
+ + (output_tokens / 1_000_000) * rates.output_per_million
80
+ )
81
+
82
+
83
+ def project_account_cost(
84
+ provider: str, account_totals: dict, model: str = "default",
85
+ ) -> float:
86
+ """Take a BillingAggregator row + a provider hint, return $."""
87
+ return estimate_cost(
88
+ provider,
89
+ input_tokens=int(account_totals.get("input_tokens", 0)),
90
+ output_tokens=int(account_totals.get("output_tokens", 0)),
91
+ model=model,
92
+ )
93
+
94
+
95
+ def rate_card_summary() -> dict:
96
+ """For the doctor: the date + which providers we cover."""
97
+ return {
98
+ "date": RATE_CARD_DATE,
99
+ "providers": sorted(_RATES.keys()),
100
+ }
@@ -77,6 +77,9 @@ class _EngineHandler(BaseHTTPRequestHandler):
77
77
  self._reply(404, {"error": "not found"})
78
78
 
79
79
  def do_POST(self) -> None: # noqa: N802
80
+ # /webhook/<id> — inbound HMAC-signed webhooks (GitHub/Linear/generic)
81
+ if self.path.startswith("/webhook/"):
82
+ return self._handle_webhook()
80
83
  if self.path != "/mission":
81
84
  self._reply(404, {"error": "not found"})
82
85
  return
@@ -112,12 +115,46 @@ class _EngineHandler(BaseHTTPRequestHandler):
112
115
  logger.exception("engine HTTP: mission failed")
113
116
  self._reply(500, {"error": str(exc)})
114
117
 
118
+ def _handle_webhook(self) -> None:
119
+ """Inbound webhook gate: verify signature → wake supervisor charters."""
120
+ from omega_engine.webhooks import handle_webhook
121
+ length = int(self.headers.get("Content-Length", "0"))
122
+ body = self.rfile.read(length) if length else b""
123
+ # Collect headers as a plain dict for the gate.
124
+ headers = {k: v for k, v in self.headers.items()}
125
+ # The engine daemon's supervisor is built in main() and exposed
126
+ # via the handler class attribute (set just before serving).
127
+ supervisor = getattr(self.server, "supervisor", None)
128
+ try:
129
+ result = handle_webhook(
130
+ _omega_home(), path=self.path,
131
+ headers=headers, body=body, supervisor=supervisor,
132
+ )
133
+ except Exception as exc: # noqa: BLE001
134
+ logger.exception("engine HTTP: webhook failed")
135
+ self._reply(500, {"ok": False, "error": str(exc)})
136
+ return
137
+ self._reply(result["status"], {
138
+ "ok": result["ok"],
139
+ "reason": result.get("reason", ""),
140
+ "fired": result.get("fired", []),
141
+ })
115
142
 
116
- def _serve_http(port: int, stop: threading.Event) -> None:
117
- """Run the HTTP API until ``stop`` is set."""
143
+
144
+ def _serve_http(
145
+ port: int, stop: threading.Event, supervisor=None,
146
+ ) -> None:
147
+ """Run the HTTP API until ``stop`` is set.
148
+
149
+ The ``supervisor`` is exposed as a server attribute so the
150
+ ``/webhook/<id>`` handler can fire charters on a verified inbound.
151
+ """
118
152
  httpd = ThreadingHTTPServer(("127.0.0.1", port), _EngineHandler)
119
153
  httpd.timeout = 1.0
120
- logger.info("engine HTTP API on 127.0.0.1:%d", port)
154
+ # Stash on the server so the handler can find it via self.server.
155
+ httpd.supervisor = supervisor # type: ignore[attr-defined]
156
+ logger.info("engine HTTP API on 127.0.0.1:%d (webhooks: %s)",
157
+ port, "wired" if supervisor else "disabled")
121
158
  while not stop.is_set():
122
159
  httpd.handle_request()
123
160
  httpd.server_close()
@@ -145,8 +182,20 @@ def main() -> int:
145
182
  signal.signal(signal.SIGINT, lambda *_: stop.set())
146
183
 
147
184
  port = int(os.environ.get("OMEGA_ENGINE_PORT", "8731"))
185
+ # Build the supervisor once at startup so the HTTP server can fire
186
+ # webhook-triggered charters. Best-effort: if no charters are
187
+ # configured, the supervisor is still safe to pass — wake_webhook
188
+ # just returns an empty list.
189
+ supervisor = None
190
+ try:
191
+ from omega_engine.autonomous import build_supervisor_from_home
192
+ supervisor = build_supervisor_from_home(home)
193
+ except Exception: # noqa: BLE001
194
+ logger.warning("engine daemon: supervisor unavailable — webhooks disabled",
195
+ exc_info=True)
148
196
  http_thread = threading.Thread(
149
- target=_serve_http, args=(port, stop), daemon=True, name="omega-engine-http",
197
+ target=_serve_http, args=(port, stop, supervisor),
198
+ daemon=True, name="omega-engine-http",
150
199
  )
151
200
  http_thread.start()
152
201
 
@@ -8,7 +8,18 @@ message:
8
8
  → :meth:`AutonomousSupervisor.on_channel_message` (the agent handles it).
9
9
  2. Else, if the topic is a *project* topic registered in
10
10
  ``Agentik_Coding/projects.json`` → :func:`run_mission` with that topic id.
11
- 3. Else → log and ignore.
11
+ 3. Else (no topic, just a DM to the bot) → log and ignore.
12
+
13
+ History: every routed message is persisted to
14
+ ``Agentik_Runtime/telegram-history.db`` via
15
+ :mod:`omega_engine.telegram_history`. When a topic message arrives, the
16
+ last N exchanges are prepended to the intent — that's the "the bot has
17
+ memory of the conversation" fix.
18
+
19
+ Routing rule: notifications NEVER go to the AISB DM. They go into the
20
+ project topic the mission was triggered from. The daemon enforces this by
21
+ refusing to start a mission for a message that came in without a
22
+ ``message_thread_id``.
12
23
 
13
24
  The daemon shares no in-process state with the engine daemon — it talks to it
14
25
  through the engine's HTTP API when a mission has to run (avoids two parallel
@@ -103,41 +114,95 @@ def _project_topic_map(home: Path) -> dict[int, str]:
103
114
  return out
104
115
 
105
116
 
106
- def _extract_message_fields(update: dict[str, Any]) -> tuple[int | None, int | None, str | None]:
107
- """Pull (topic_id, message_id, text) from an update — None if not relevant."""
117
+ def _extract_message_fields(
118
+ update: dict[str, Any],
119
+ ) -> tuple[int | None, int | None, str | None, int | None]:
120
+ """Pull (topic_id, message_id, text, chat_id) from an update.
121
+
122
+ Returns all four; any may be None when the update isn't a text message.
123
+ We DON'T short-circuit on missing topic_id any more — DM messages now
124
+ flow through for logging + the operator-may-add-routing later.
125
+ """
108
126
  msg = update.get("message") or update.get("edited_message") or {}
109
127
  text = msg.get("text")
110
128
  if not text:
111
- return None, None, None
129
+ return None, None, None, None
112
130
  topic_id = msg.get("message_thread_id")
113
131
  message_id = msg.get("message_id")
114
- return topic_id, message_id, text
132
+ chat = msg.get("chat") or {}
133
+ chat_id = chat.get("id")
134
+ return topic_id, message_id, text, chat_id
115
135
 
116
136
 
117
137
  def _route_one(
118
138
  *,
119
- topic_id: int,
139
+ topic_id: int | None,
120
140
  text: str,
141
+ message_id: int | None,
142
+ chat_id: int | None,
121
143
  supervisor,
122
144
  project_map: dict[int, str],
123
145
  home: Path,
124
146
  telegram_bridge,
125
147
  ) -> str:
126
- """Route one inbound message; return a short tag for the log."""
148
+ """Route one inbound message; return a short tag for the log.
149
+
150
+ Now context-aware: every inbound + outbound exchange is persisted to
151
+ ``telegram-history`` so the Oracle sees the conversation, not just the
152
+ latest message.
153
+ """
154
+ from omega_engine import telegram_history
155
+
156
+ # DM (no topic) — log it, refuse to start a mission. AISB DM
157
+ # is NOT where the orchestration runs; it's where the operator
158
+ # talks to the bot 1:1. The mission must run inside a project topic.
159
+ if topic_id is None:
160
+ # We still record DM history so the operator's question + the
161
+ # bot's eventual reply (handled elsewhere) are linked.
162
+ telegram_history.record_inbound(
163
+ home, topic_id=0, text=text, message_id=message_id,
164
+ )
165
+ logger.info(
166
+ "telegram in: DM (chat=%s) text=%r — refusing to start a "
167
+ "mission from the DM; ask in a project topic instead",
168
+ chat_id, text[:80],
169
+ )
170
+ if telegram_bridge is not None and chat_id is not None:
171
+ try:
172
+ telegram_bridge._call("sendMessage", { # noqa: SLF001
173
+ "chat_id": str(chat_id),
174
+ "text": (
175
+ "Missions only run from a project topic in the "
176
+ "OmegaOS group — not the DM. Open the topic for "
177
+ "the project and re-send your request there."
178
+ ),
179
+ })
180
+ except Exception: # noqa: BLE001
181
+ logger.warning("telegram daemon: DM reply failed", exc_info=True)
182
+ return "dm:refused"
183
+
184
+ # Topic message — record + route.
185
+ telegram_history.record_inbound(
186
+ home, topic_id=topic_id, text=text, message_id=message_id,
187
+ )
188
+
127
189
  # 1. autonomous-agent channel match wins
128
190
  fired = supervisor.on_channel_message(topic_id, text)
129
191
  if fired:
130
192
  return f"autonomous:{','.join(fired)}"
131
- # 2. project topic → run_mission
193
+ # 2. project topic → run_mission with conversation context
132
194
  slug = project_map.get(topic_id)
133
195
  if slug:
134
- # we use run_mission directly here (in-process); the engine daemon's
135
- # HTTP API exists for *cross-process* dispatch, not for the daemon that
136
- # already lives in the right process.
196
+ # Build a context-aware intent that includes the last N exchanges
197
+ # in this topic the Oracle now sees the conversation, not just
198
+ # the new line. THIS is the "bot has memory" fix.
199
+ enriched = telegram_history.build_context_prompt(
200
+ home, topic_id=topic_id, new_intent=text, limit=10,
201
+ )
137
202
  from omega_engine.mission import run_mission
138
203
  try:
139
- run_mission(
140
- intent=text,
204
+ outcome = run_mission(
205
+ intent=enriched,
141
206
  omega_home=home,
142
207
  topic_id=topic_id,
143
208
  telegram=telegram_bridge,
@@ -145,8 +210,25 @@ def _route_one(
145
210
  except Exception: # noqa: BLE001
146
211
  logger.exception("telegram daemon: project mission failed")
147
212
  return f"project:{slug}:error"
213
+
214
+ # Record the bot's summary as an outbound message so the next
215
+ # inbound in this topic sees it as context.
216
+ summary = (
217
+ getattr(outcome, "summary", None)
218
+ or f"mission {getattr(outcome, 'mission_id', '?')} "
219
+ f"→ {getattr(getattr(outcome, 'final_state', None), 'value', '?')}"
220
+ )
221
+ telegram_history.record_outbound(
222
+ home, topic_id=topic_id, text=summary[:1000],
223
+ )
148
224
  return f"project:{slug}"
149
- return "ignored"
225
+
226
+ # 3. unknown topic — log only; don't start a mission for stranger topics
227
+ logger.info(
228
+ "telegram in: unknown topic %s text=%r — no project routes here",
229
+ topic_id, text[:80],
230
+ )
231
+ return "topic:unknown"
150
232
 
151
233
 
152
234
  # ─────────────────────────────────────────────────────────────────────────────
@@ -207,15 +289,17 @@ def main() -> int:
207
289
 
208
290
  for update in updates:
209
291
  offset = max(offset, int(update.get("update_id", 0)) + 1)
210
- topic_id, _message_id, text = _extract_message_fields(update)
211
- if topic_id is None or not text:
292
+ topic_id, message_id, text, chat_id = _extract_message_fields(update)
293
+ if not text:
212
294
  continue
213
295
  # refresh the project map periodically so newly created projects
214
296
  # become routable without restarting the daemon
215
297
  project_map = _project_topic_map(home)
216
298
  try:
217
299
  tag = _route_one(
218
- topic_id=topic_id, text=text, supervisor=supervisor,
300
+ topic_id=topic_id, text=text,
301
+ message_id=message_id, chat_id=chat_id,
302
+ supervisor=supervisor,
219
303
  project_map=project_map, home=home,
220
304
  telegram_bridge=telegram_bridge,
221
305
  )