@agentikos/omega-os 0.2.0 → 0.19.5

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 (367) 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/marketplaces/design-discipline.yaml +86 -0
  340. package/omega/Agentik_SSOT/skills/a11yaudit/SKILL.md +161 -0
  341. package/omega/Agentik_SSOT/skills/apiaudit/SKILL.md +157 -0
  342. package/omega/Agentik_SSOT/skills/automationaudit/SKILL.md +161 -0
  343. package/omega/Agentik_SSOT/skills/cadence/SKILL.md +76 -0
  344. package/omega/Agentik_SSOT/skills/codeaudit/SKILL.md +153 -0
  345. package/omega/Agentik_SSOT/skills/copyaudit/SKILL.md +161 -0
  346. package/omega/Agentik_SSOT/skills/dataaudit/SKILL.md +157 -0
  347. package/omega/Agentik_SSOT/skills/debugaudit/SKILL.md +161 -0
  348. package/omega/Agentik_SSOT/skills/dispatch/SKILL.md +79 -0
  349. package/omega/Agentik_SSOT/skills/dxaudit/SKILL.md +161 -0
  350. package/omega/Agentik_SSOT/skills/featureaudit/SKILL.md +161 -0
  351. package/omega/Agentik_SSOT/skills/flowaudit/SKILL.md +165 -0
  352. package/omega/Agentik_SSOT/skills/genesis/SKILL.md +116 -0
  353. package/omega/Agentik_SSOT/skills/handoff/SKILL.md +117 -0
  354. package/omega/Agentik_SSOT/skills/logicaudit/SKILL.md +165 -0
  355. package/omega/Agentik_SSOT/skills/motionaudit/SKILL.md +165 -0
  356. package/omega/Agentik_SSOT/skills/perfaudit/SKILL.md +161 -0
  357. package/omega/Agentik_SSOT/skills/plan/SKILL.md +127 -0
  358. package/omega/Agentik_SSOT/skills/pursue/SKILL.md +68 -0
  359. package/omega/Agentik_SSOT/skills/rag-route.md +9 -0
  360. package/omega/Agentik_SSOT/skills/refontaudit/SKILL.md +165 -0
  361. package/omega/Agentik_SSOT/skills/retentionaudit/SKILL.md +165 -0
  362. package/omega/Agentik_SSOT/skills/secaudit/SKILL.md +157 -0
  363. package/omega/Agentik_SSOT/skills/seoaudit/SKILL.md +161 -0
  364. package/omega/Agentik_SSOT/skills/skill-auditor/SKILL.md +83 -0
  365. package/omega/Agentik_SSOT/skills/skill-finder/SKILL.md +116 -0
  366. package/omega/Agentik_SSOT/skills/uiuxaudit/SKILL.md +165 -0
  367. package/package.json +2 -2
@@ -0,0 +1,154 @@
1
+ """Worker `.done.json` — the structured completion signal.
2
+
3
+ Events are the source of truth (event-sourcing). But events are *facts about
4
+ state*, not *artifacts the worker produced*. The done file is the workspace
5
+ artifact: the worker's structured summary of what it did, what's still
6
+ pending, what failed.
7
+
8
+ Schema
9
+ ------
10
+ ::
11
+
12
+ {
13
+ "status": "done_clean" | "pending" | "failed",
14
+ "summary": str,
15
+ "files_changed": [str, ...],
16
+ "artifacts": {str: any},
17
+ "pending_actions": [str, ...],
18
+ "errors": [str, ...],
19
+ "audit": {...} # optional, set by the verifier
20
+ }
21
+
22
+ Where it lives
23
+ --------------
24
+ ::
25
+
26
+ $OMEGA_HOME/Agentik_Runtime/sessions/<task_id>/.done.json
27
+
28
+ The executor passes this path to the worker through the envelope; the worker
29
+ writes there when finished; the audit gate reads it back before flipping
30
+ VERIFIED. AISB / parent dispatchers can also read it to surface progress.
31
+ """
32
+ from __future__ import annotations
33
+
34
+ import json
35
+ import os
36
+ import threading
37
+ from dataclasses import asdict, dataclass, field
38
+ from pathlib import Path
39
+ from typing import Any
40
+
41
+
42
+ VALID_STATUSES = {"done_clean", "pending", "failed"}
43
+
44
+
45
+ class DoneSignalError(RuntimeError):
46
+ """The done file is missing, malformed, or claims an invalid status."""
47
+
48
+
49
+ @dataclass
50
+ class DoneSignal:
51
+ status: str = "pending"
52
+ summary: str = ""
53
+ files_changed: list[str] = field(default_factory=list)
54
+ artifacts: dict[str, Any] = field(default_factory=dict)
55
+ pending_actions: list[str] = field(default_factory=list)
56
+ errors: list[str] = field(default_factory=list)
57
+ audit: dict[str, Any] = field(default_factory=dict)
58
+
59
+ def to_json(self) -> str:
60
+ return json.dumps(asdict(self), indent=2, ensure_ascii=False)
61
+
62
+
63
+ def session_dir(omega_home: str | Path, task_id: str) -> Path:
64
+ """Per-task session directory; created on demand with mode 700."""
65
+ d = Path(omega_home) / "Agentik_Runtime" / "sessions" / task_id
66
+ d.mkdir(parents=True, exist_ok=True)
67
+ try:
68
+ os.chmod(d, 0o700)
69
+ except OSError:
70
+ pass
71
+ return d
72
+
73
+
74
+ def done_path(omega_home: str | Path, task_id: str) -> Path:
75
+ return session_dir(omega_home, task_id) / ".done.json"
76
+
77
+
78
+ def write_done(
79
+ omega_home: str | Path,
80
+ task_id: str,
81
+ signal: DoneSignal,
82
+ ) -> Path:
83
+ """Write a DoneSignal as JSON to the session dir, ATOMICALLY.
84
+
85
+ Atomicity matters here: ``read_done`` is polled by the audit gate, the
86
+ Telegram patrol, AISB, and a partial write would make the verifier read
87
+ half a JSON blob. We write to a temp file in the same dir, fsync, then
88
+ rename — rename within the same filesystem is atomic.
89
+ """
90
+ if signal.status not in VALID_STATUSES:
91
+ raise DoneSignalError(
92
+ f"invalid status {signal.status!r} — must be one of {VALID_STATUSES}"
93
+ )
94
+ path = done_path(omega_home, task_id)
95
+ # Unique tmp suffix per call so concurrent writers from different
96
+ # threads don't clobber each other's intermediate file.
97
+ tmp = path.with_suffix(
98
+ path.suffix + f".tmp.{os.getpid()}.{threading.get_ident()}"
99
+ )
100
+ # Write + fsync + close. `os.fdopen` takes ownership of `fd` so the
101
+ # `with` block is responsible for closing — we never double-close.
102
+ fd = os.open(str(tmp), os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)
103
+ with os.fdopen(fd, "w") as fh:
104
+ fh.write(signal.to_json())
105
+ fh.flush()
106
+ try:
107
+ os.fsync(fh.fileno())
108
+ except OSError:
109
+ # tmpfs / network FS may not support fsync — best-effort.
110
+ pass
111
+ # Atomic rename. POSIX guarantees same-dir rename is atomic; readers
112
+ # see either the old file or the new file, never a partial blob.
113
+ os.replace(tmp, path)
114
+ return path
115
+
116
+
117
+ def read_done(omega_home: str | Path, task_id: str) -> DoneSignal | None:
118
+ """Read a DoneSignal back. Returns None if the file is missing."""
119
+ path = done_path(omega_home, task_id)
120
+ if not path.exists():
121
+ return None
122
+ try:
123
+ data = json.loads(path.read_text())
124
+ except (json.JSONDecodeError, OSError) as exc:
125
+ raise DoneSignalError(f"unparseable done file at {path}: {exc}") from exc
126
+ if not isinstance(data, dict):
127
+ raise DoneSignalError(f"done file must be a JSON object, got {type(data)}")
128
+ status = data.get("status", "")
129
+ if status not in VALID_STATUSES:
130
+ raise DoneSignalError(
131
+ f"done file {path} has invalid status {status!r}"
132
+ )
133
+ return DoneSignal(
134
+ status=status,
135
+ summary=str(data.get("summary", "")),
136
+ files_changed=list(data.get("files_changed") or []),
137
+ artifacts=dict(data.get("artifacts") or {}),
138
+ pending_actions=list(data.get("pending_actions") or []),
139
+ errors=list(data.get("errors") or []),
140
+ audit=dict(data.get("audit") or {}),
141
+ )
142
+
143
+
144
+ def attach_audit_to_done(
145
+ omega_home: str | Path,
146
+ task_id: str,
147
+ audit: dict[str, Any],
148
+ ) -> None:
149
+ """Update an existing done file in place with the verifier's verdict."""
150
+ signal = read_done(omega_home, task_id)
151
+ if signal is None:
152
+ signal = DoneSignal(status="pending", summary="(audit-only)")
153
+ signal.audit = dict(audit)
154
+ write_done(omega_home, task_id, signal)
@@ -0,0 +1,219 @@
1
+ """Mission envelope — the bridge between a Task and the provider's request.
2
+
3
+ The executor used to send the agent ONLY a bare prompt ("subtask 1"). That's
4
+ not how AISB-style orchestration works: an Oracle needs to know who it is,
5
+ what the user asked for verbatim, what its parent already decided, and the
6
+ contract for declaring completion. The envelope is that wrapper.
7
+
8
+ Two things come out of ``build_envelope``:
9
+
10
+ * ``system`` — the role's full agent prompt (from ``omega_engine.prompts``)
11
+ plus the orchestration contract appended at the end. This goes in the
12
+ provider's ``system`` parameter.
13
+ * ``user`` — the user-visible content: the original intent, the parent
14
+ context, the plan-so-far, and any role-specific data. This goes in
15
+ ``messages``.
16
+
17
+ For programmatic roles (mock, educators, RAG sub-roles), the envelope still
18
+ works but the contract block is skipped — those agents don't dispatch.
19
+ """
20
+ from __future__ import annotations
21
+
22
+ import json
23
+ from dataclasses import dataclass, field
24
+ from pathlib import Path
25
+ from typing import Any
26
+
27
+
28
+ # Roles that DISPATCH (return a plan). They need the dispatcher contract.
29
+ DISPATCHER_ROLES = {
30
+ "aisb", "oracle", "manager", "architect", "keymaker", "morpheus",
31
+ }
32
+ # Roles that EXECUTE (return artifacts + claimed_done).
33
+ EXECUTOR_ROLES = {"worker", "construct", "link"}
34
+ # Roles that VERIFY (return a verdict).
35
+ VERIFIER_ROLES = {"audit", "verifier", "seraph"}
36
+ # Read-only roles — observe the system, propose, never act.
37
+ READ_ONLY_ROLES = {"pythia", "neo", "niobe", "merovingian", "zion"}
38
+ # Improvement / learning roles — analyse outcomes, propose tuning.
39
+ LEARNER_ROLES = {"smith"}
40
+
41
+
42
+ @dataclass
43
+ class EnvelopeContext:
44
+ """Everything the envelope needs to know about a task's place in the world."""
45
+
46
+ role: str
47
+ intent: str # user prompt verbatim
48
+ mission_id: str = ""
49
+ task_id: str = ""
50
+ parent_role: str | None = None
51
+ parent_intent: str | None = None
52
+ plan_so_far: list[dict[str, Any]] = field(default_factory=list)
53
+ sibling_states: dict[str, str] = field(default_factory=dict)
54
+ available_tools: list[str] = field(default_factory=list)
55
+ project: dict[str, Any] | None = None # name, slug, path
56
+ done_json_path: str | None = None # where the worker writes done
57
+ verify_cmd: str | None = None
58
+ extras: dict[str, Any] = field(default_factory=dict)
59
+
60
+
61
+ def _dispatcher_contract() -> str:
62
+ return (
63
+ "## ORCHESTRATION CONTRACT (dispatcher)\n\n"
64
+ "You are a DISPATCHER. You break the mission into atomic subtasks\n"
65
+ "and respond with a JSON array of child tasks. Format strictly:\n\n"
66
+ "```json\n"
67
+ "[\n"
68
+ ' {"role": "worker", "spec": {\n'
69
+ ' "task": "<one concrete actionable instruction>",\n'
70
+ ' "verify_cmd": "<shell command that returns 0 iff the task is truly done>",\n'
71
+ ' "files_owned": ["<path/glob>", ...],\n'
72
+ ' "context": {<any extra data the worker will need>}\n'
73
+ " }},\n"
74
+ " ...\n"
75
+ "]\n"
76
+ "```\n\n"
77
+ "Rules:\n"
78
+ "1. Preserve the user's intent verbatim — never paraphrase it away.\n"
79
+ "2. Each subtask MUST be small enough to fit in one worker context.\n"
80
+ "3. `verify_cmd` is the ground truth — if it exits 0, the worker is done.\n"
81
+ "4. JSON ONLY — no prose around the array. No code fences except the one above.\n"
82
+ "5. Your reply IS the plan. The engine will dispatch each child as a task.\n"
83
+ )
84
+
85
+
86
+ def _executor_contract(done_json_path: str | None) -> str:
87
+ path = done_json_path or "Agentik_Runtime/sessions/<task_id>/.done.json"
88
+ return (
89
+ "## ORCHESTRATION CONTRACT (executor / worker)\n\n"
90
+ "You are a WORKER. You produce concrete artifacts and prove you're done.\n"
91
+ f"When finished, you WRITE a JSON file at `{path}` with this exact schema:\n\n"
92
+ "```json\n"
93
+ "{\n"
94
+ ' "status": "done_clean" | "pending" | "failed",\n'
95
+ ' "summary": "<one-paragraph what you did and why>",\n'
96
+ ' "files_changed": ["<relative path>", ...],\n'
97
+ ' "artifacts": {"<key>": "<value>", ...},\n'
98
+ ' "pending_actions": ["<thing the next worker / human should do>", ...],\n'
99
+ ' "errors": ["<actionable error>", ...]\n'
100
+ "}\n"
101
+ "```\n\n"
102
+ "Rules:\n"
103
+ "1. NEVER write `done_clean` if a `verify_cmd` would fail. Run it first.\n"
104
+ "2. `pending` means you did real work but more is needed — list it.\n"
105
+ "3. `failed` is honest. The engine prefers honesty over fake success.\n"
106
+ "4. The completion-verification gate reads this file. Lying = REJECTED.\n"
107
+ )
108
+
109
+
110
+ def _verifier_contract() -> str:
111
+ return (
112
+ "## ORCHESTRATION CONTRACT (verifier)\n\n"
113
+ "You are a VERIFIER. The worker has just claimed done. Your job is to\n"
114
+ "prove or disprove that claim by running real checks (not just reading\n"
115
+ "code). Respond with a JSON object:\n\n"
116
+ "```json\n"
117
+ '{"verified": true|false, "score": 0-100, "confidence": "low|med|high",\n'
118
+ ' "findings": [{"audit":"...","severity":"low|med|high|crit","msg":"..."}],\n'
119
+ ' "fix_plan": ["<actionable, ordered>", ...]}\n'
120
+ "```\n\n"
121
+ "Rules:\n"
122
+ "1. Code lies, comments lie — only runtime tells the truth. Run things.\n"
123
+ "2. Bias toward `false` — earn a `true` with concrete evidence.\n"
124
+ "3. Every PASS must cite at least 3 concrete checks.\n"
125
+ )
126
+
127
+
128
+ def _section(title: str, body: str | None) -> str:
129
+ if not body:
130
+ return ""
131
+ return f"\n\n## {title}\n\n{body}"
132
+
133
+
134
+ def build_envelope(
135
+ omega_home: str | Path,
136
+ ctx: EnvelopeContext,
137
+ ) -> dict[str, str]:
138
+ """Return ``{system, user}`` strings ready to pass to a provider.
139
+
140
+ The ``system`` part loads the role's prompt from
141
+ ``Agentik_SSOT/agents/`` and appends the appropriate orchestration
142
+ contract. If no agent file exists for the role, a minimal generic
143
+ envelope is built (one line of identity + the contract).
144
+ """
145
+ # Local import to avoid cycles.
146
+ from omega_engine.prompts import load_agent_prompt
147
+
148
+ home = Path(omega_home)
149
+ agent_prompt = load_agent_prompt(home, ctx.role) or (
150
+ f"You are an Omega OS {ctx.role.upper()} agent."
151
+ )
152
+
153
+ if ctx.role in DISPATCHER_ROLES:
154
+ contract = _dispatcher_contract()
155
+ elif ctx.role in EXECUTOR_ROLES:
156
+ contract = _executor_contract(ctx.done_json_path)
157
+ elif ctx.role in VERIFIER_ROLES:
158
+ contract = _verifier_contract()
159
+ else:
160
+ # Programmatic / specialised roles use their own internal contract.
161
+ contract = ""
162
+
163
+ system_parts = [agent_prompt]
164
+ if contract:
165
+ system_parts.append(f"\n\n{contract}")
166
+ system = "".join(system_parts).strip()
167
+
168
+ # ---- user message ------------------------------------------------------
169
+ user_blocks: list[str] = []
170
+
171
+ user_blocks.append(f"# USER INTENT (verbatim)\n\n{ctx.intent.strip()}")
172
+
173
+ if ctx.parent_intent and ctx.parent_role:
174
+ user_blocks.append(
175
+ f"## Parent task ({ctx.parent_role})\n\n{ctx.parent_intent.strip()}"
176
+ )
177
+
178
+ if ctx.plan_so_far:
179
+ user_blocks.append(
180
+ "## Plan so far\n\n"
181
+ "```json\n" + json.dumps(ctx.plan_so_far, indent=2) + "\n```"
182
+ )
183
+
184
+ if ctx.sibling_states:
185
+ user_blocks.append(
186
+ "## Sibling states\n\n```json\n"
187
+ + json.dumps(ctx.sibling_states, indent=2)
188
+ + "\n```"
189
+ )
190
+
191
+ if ctx.available_tools:
192
+ user_blocks.append(
193
+ "## Available tools\n\n- " + "\n- ".join(ctx.available_tools)
194
+ )
195
+
196
+ if ctx.project:
197
+ user_blocks.append(
198
+ f"## Project context\n\nname: {ctx.project.get('name')}\n"
199
+ f"slug: {ctx.project.get('slug')}\n"
200
+ f"path: {ctx.project.get('path')}"
201
+ )
202
+
203
+ if ctx.verify_cmd:
204
+ user_blocks.append(
205
+ f"## Verify command\n\n```bash\n{ctx.verify_cmd}\n```"
206
+ )
207
+
208
+ if ctx.done_json_path and ctx.role in EXECUTOR_ROLES:
209
+ user_blocks.append(
210
+ f"## Done file\n\nWrite your completion JSON to: `{ctx.done_json_path}`"
211
+ )
212
+
213
+ if ctx.task_id:
214
+ user_blocks.append(f"## Task id\n\n`{ctx.task_id}`")
215
+ if ctx.mission_id:
216
+ user_blocks.append(f"## Mission id\n\n`{ctx.mission_id}`")
217
+
218
+ user = "\n\n".join(user_blocks)
219
+ return {"system": system, "user": user}
@@ -99,8 +99,17 @@ class Executor:
99
99
  return reduce_task(self._store.events_for(task_id))
100
100
 
101
101
  def _run(self, task: Task, mission_id: str) -> None:
102
- self._emit(task.id, EventType.CREATED,
103
- {"role": task.role, "kind": task.kind.value, "mission_id": mission_id})
102
+ # Carry the intent/task description in the CREATED payload so the
103
+ # event log + semantic memory have something searchable per task.
104
+ intent = (
105
+ task.spec.get("intent") or task.spec.get("task") or ""
106
+ )
107
+ self._emit(task.id, EventType.CREATED, {
108
+ "role": task.role,
109
+ "kind": task.kind.value,
110
+ "mission_id": mission_id,
111
+ "spec": {"intent": str(intent)[:500]} if intent else {},
112
+ })
104
113
  self._emit(task.id, EventType.DISPATCHED)
105
114
  self._emit(task.id, EventType.STARTED)
106
115
  if task.kind is Kind.EXECUTOR:
@@ -112,9 +121,8 @@ class Executor:
112
121
  def _run_dispatcher(self, task: Task, mission_id: str) -> None:
113
122
  provider = self._router.resolve(task.role)
114
123
  prompt = task.spec.get("intent") or task.spec.get("task") or task.role
115
- result = provider.run(
116
- AgentRequest(role=task.role, prompt=str(prompt), context=task.spec)
117
- )
124
+ result = provider.run(self._build_request(task, mission_id, str(prompt)))
125
+ self._emit_usage(task, provider, result, mission_id)
118
126
  children: list[Task] = []
119
127
  for item in result.plan:
120
128
  child_role = item.get("role", "worker")
@@ -176,12 +184,12 @@ class Executor:
176
184
 
177
185
  def _run_worker(self, task: Task) -> None:
178
186
  provider = self._router.resolve(task.role)
187
+ prompt = str(task.spec.get("task", task.role))
188
+ mission_id = task.spec.get("mission_id", "")
179
189
  for attempt in range(task.budget.max_iterations):
180
- result = provider.run(AgentRequest(
181
- role=task.role,
182
- prompt=str(task.spec.get("task", task.role)),
183
- context=task.spec,
184
- ))
190
+ result = provider.run(self._build_request(task, mission_id, prompt))
191
+ self._maybe_persist_done(task, result)
192
+ self._emit_usage(task, provider, result, mission_id)
185
193
  self._emit(task.id, EventType.CLAIMED_DONE, {"attempt": attempt + 1})
186
194
  self._emit(task.id, EventType.VERIFYING)
187
195
  verdict = self._audit.verify({
@@ -191,6 +199,7 @@ class Executor:
191
199
  "changed": result.artifacts.get("files", []),
192
200
  "path": str(task.spec.get("path", ".")),
193
201
  })
202
+ self._attach_audit_to_done(task.id, verdict)
194
203
  if verdict.verified:
195
204
  self._emit(task.id, EventType.VERIFIED, {
196
205
  "score": verdict.score,
@@ -205,3 +214,133 @@ class Executor:
205
214
  self._emit(task.id, EventType.STARTED)
206
215
  # budget exhausted — honest failure, the deadman clause terminates it
207
216
  self._emit(task.id, EventType.FAILED, {"reason": "audit budget exhausted"})
217
+
218
+ # ---- envelope + done.json plumbing -------------------------------------
219
+
220
+ def _build_request(self, task: Task, mission_id: str, prompt: str) -> AgentRequest:
221
+ """Build a request enriched with the role's system prompt + context.
222
+
223
+ Failures here MUST NOT crash the executor — the engine has always
224
+ worked with a bare prompt, and old test providers don't read
225
+ ``request.system``. So we fall back to the legacy AgentRequest if
226
+ the envelope build fails for any reason.
227
+ """
228
+ try:
229
+ import os
230
+ from pathlib import Path
231
+ from omega_engine.envelope import (
232
+ EnvelopeContext, build_envelope,
233
+ )
234
+ from omega_engine.done_signal import done_path
235
+
236
+ omega_home = Path(os.environ.get(
237
+ "OMEGA_HOME", str(Path.home() / "Omega"),
238
+ ))
239
+ parent = self._tasks.get(task.parent_id or "")
240
+ parent_role = parent.role if parent else None
241
+ parent_intent = (
242
+ parent.spec.get("intent") if parent else None
243
+ ) or (parent.spec.get("task") if parent else None)
244
+
245
+ ctx = EnvelopeContext(
246
+ role=task.role,
247
+ intent=prompt,
248
+ mission_id=mission_id,
249
+ task_id=task.id,
250
+ parent_role=parent_role,
251
+ parent_intent=parent_intent,
252
+ verify_cmd=task.spec.get("verify_cmd"),
253
+ done_json_path=str(done_path(omega_home, task.id)),
254
+ project=task.spec.get("project"),
255
+ )
256
+ env = build_envelope(omega_home, ctx)
257
+ return AgentRequest(
258
+ role=task.role, prompt=env["user"], context=task.spec,
259
+ system=env["system"],
260
+ )
261
+ except Exception: # noqa: BLE001
262
+ return AgentRequest(
263
+ role=task.role, prompt=prompt, context=task.spec,
264
+ )
265
+
266
+ def _emit_usage(
267
+ self, task: Task, provider, result, mission_id: str,
268
+ ) -> None:
269
+ """Emit a ``task.usage`` event so the BillingAggregator sees real
270
+ per-account cost — only when the provider returned non-zero usage.
271
+
272
+ ClaudeMaxProvider returns a ``cost_usd`` from Claude Code's own
273
+ billing computation; we propagate it as-is. Provider id is the
274
+ ``account_id`` fallback when the operator hasn't pinned this task
275
+ to a specific account.
276
+ """
277
+ try:
278
+ usage = dict(getattr(result, "usage", {}) or {})
279
+ if not usage:
280
+ return
281
+ if not usage.get("account_id"):
282
+ # Best-effort: use the provider id as the account label.
283
+ # When the operator wires multiple Claude Max accounts,
284
+ # whatever picks one explicitly should also set
285
+ # account_id on the AgentResult.usage.
286
+ usage["account_id"] = getattr(provider, "id", "default")
287
+ self._emit(task.id, EventType.HEARTBEAT, {
288
+ "kind": "usage", "mission_id": mission_id,
289
+ "usage": usage, "role": task.role,
290
+ })
291
+ except Exception: # noqa: BLE001 — usage emit must never break the loop
292
+ pass
293
+
294
+ def _maybe_persist_done(self, task: Task, result) -> None:
295
+ """If the provider returned a structured artifact and no done file
296
+ exists yet, write one so the audit gate / AISB always have something
297
+ to read."""
298
+ try:
299
+ import os
300
+ from pathlib import Path
301
+ from omega_engine.done_signal import (
302
+ DoneSignal, done_path, read_done, write_done,
303
+ )
304
+ omega_home = Path(os.environ.get(
305
+ "OMEGA_HOME", str(Path.home() / "Omega"),
306
+ ))
307
+ # If the worker (or the provider stub) already wrote the file,
308
+ # respect it.
309
+ existing = None
310
+ try:
311
+ existing = read_done(omega_home, task.id)
312
+ except Exception: # noqa: BLE001
313
+ existing = None
314
+ if existing is not None:
315
+ return
316
+ # Build a synthetic done from the provider result.
317
+ arts = getattr(result, "artifacts", None) or {}
318
+ signal = DoneSignal(
319
+ status="done_clean" if getattr(result, "claimed_done", False)
320
+ else "failed",
321
+ summary=str(arts.get("summary") or getattr(result, "text", "")),
322
+ files_changed=list(arts.get("files") or []),
323
+ artifacts=arts,
324
+ )
325
+ write_done(omega_home, task.id, signal)
326
+ except Exception: # noqa: BLE001
327
+ pass
328
+
329
+ def _attach_audit_to_done(self, task_id: str, verdict) -> None:
330
+ try:
331
+ import os
332
+ from pathlib import Path
333
+ from omega_engine.done_signal import attach_audit_to_done
334
+ omega_home = Path(os.environ.get(
335
+ "OMEGA_HOME", str(Path.home() / "Omega"),
336
+ ))
337
+ attach_audit_to_done(omega_home, task_id, {
338
+ "verified": bool(getattr(verdict, "verified", False)),
339
+ "score": int(getattr(verdict, "score", 0) or 0),
340
+ "findings": [
341
+ getattr(f, "audit", str(f))
342
+ for f in getattr(verdict, "findings", []) or []
343
+ ],
344
+ })
345
+ except Exception: # noqa: BLE001
346
+ pass