@agentikos/omega-os 0.1.0

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 (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +127 -0
  3. package/bin/omega-os.js +48 -0
  4. package/bootstrap/lib/common.sh +73 -0
  5. package/bootstrap/lib/steps.sh +153 -0
  6. package/bootstrap/manifest.example.yaml +45 -0
  7. package/docs/ACCOUNT-AND-BILLING.md +95 -0
  8. package/docs/ARCHITECTURE.md +225 -0
  9. package/docs/AUTONOMOUS-AGENTS.md +128 -0
  10. package/docs/ENGINE-SPEC.md +174 -0
  11. package/docs/INSTALL.md +106 -0
  12. package/docs/MCP-AND-PLUGINS.md +121 -0
  13. package/docs/RUNTIME-PLAN.md +63 -0
  14. package/install.sh +54 -0
  15. package/omega/Agentik_Coding/README.md +21 -0
  16. package/omega/Agentik_Engine/README.md +58 -0
  17. package/omega/Agentik_Engine/omega_engine/__init__.py +58 -0
  18. package/omega/Agentik_Engine/omega_engine/__pycache__/__init__.cpython-313.pyc +0 -0
  19. package/omega/Agentik_Engine/omega_engine/__pycache__/audit.cpython-313.pyc +0 -0
  20. package/omega/Agentik_Engine/omega_engine/__pycache__/audit_arsenal.cpython-313.pyc +0 -0
  21. package/omega/Agentik_Engine/omega_engine/__pycache__/barrier.cpython-313.pyc +0 -0
  22. package/omega/Agentik_Engine/omega_engine/__pycache__/bus.cpython-313.pyc +0 -0
  23. package/omega/Agentik_Engine/omega_engine/__pycache__/cli.cpython-313.pyc +0 -0
  24. package/omega/Agentik_Engine/omega_engine/__pycache__/events.cpython-313.pyc +0 -0
  25. package/omega/Agentik_Engine/omega_engine/__pycache__/executor.cpython-313.pyc +0 -0
  26. package/omega/Agentik_Engine/omega_engine/__pycache__/mission.cpython-313.pyc +0 -0
  27. package/omega/Agentik_Engine/omega_engine/__pycache__/progress.cpython-313.pyc +0 -0
  28. package/omega/Agentik_Engine/omega_engine/__pycache__/project.cpython-313.pyc +0 -0
  29. package/omega/Agentik_Engine/omega_engine/__pycache__/provider.cpython-313.pyc +0 -0
  30. package/omega/Agentik_Engine/omega_engine/__pycache__/reducer.cpython-313.pyc +0 -0
  31. package/omega/Agentik_Engine/omega_engine/__pycache__/report.cpython-313.pyc +0 -0
  32. package/omega/Agentik_Engine/omega_engine/__pycache__/router.cpython-313.pyc +0 -0
  33. package/omega/Agentik_Engine/omega_engine/__pycache__/store.cpython-313.pyc +0 -0
  34. package/omega/Agentik_Engine/omega_engine/__pycache__/supervisor.cpython-313.pyc +0 -0
  35. package/omega/Agentik_Engine/omega_engine/__pycache__/task.cpython-313.pyc +0 -0
  36. package/omega/Agentik_Engine/omega_engine/__pycache__/telegram.cpython-313.pyc +0 -0
  37. package/omega/Agentik_Engine/omega_engine/audit.py +96 -0
  38. package/omega/Agentik_Engine/omega_engine/audit_arsenal.py +314 -0
  39. package/omega/Agentik_Engine/omega_engine/barrier.py +45 -0
  40. package/omega/Agentik_Engine/omega_engine/bus.py +45 -0
  41. package/omega/Agentik_Engine/omega_engine/cli.py +158 -0
  42. package/omega/Agentik_Engine/omega_engine/events.py +60 -0
  43. package/omega/Agentik_Engine/omega_engine/executor.py +167 -0
  44. package/omega/Agentik_Engine/omega_engine/mission.py +145 -0
  45. package/omega/Agentik_Engine/omega_engine/progress.py +75 -0
  46. package/omega/Agentik_Engine/omega_engine/project.py +92 -0
  47. package/omega/Agentik_Engine/omega_engine/provider.py +139 -0
  48. package/omega/Agentik_Engine/omega_engine/reducer.py +76 -0
  49. package/omega/Agentik_Engine/omega_engine/report.py +146 -0
  50. package/omega/Agentik_Engine/omega_engine/router.py +34 -0
  51. package/omega/Agentik_Engine/omega_engine/store.py +97 -0
  52. package/omega/Agentik_Engine/omega_engine/supervisor.py +69 -0
  53. package/omega/Agentik_Engine/omega_engine/task.py +91 -0
  54. package/omega/Agentik_Engine/omega_engine/telegram.py +115 -0
  55. package/omega/Agentik_Engine/pyproject.toml +31 -0
  56. package/omega/Agentik_Engine/tests/__pycache__/test_audit_arsenal.cpython-313.pyc +0 -0
  57. package/omega/Agentik_Engine/tests/__pycache__/test_executor.cpython-313.pyc +0 -0
  58. package/omega/Agentik_Engine/tests/__pycache__/test_mission.cpython-313.pyc +0 -0
  59. package/omega/Agentik_Engine/tests/__pycache__/test_progress.cpython-313.pyc +0 -0
  60. package/omega/Agentik_Engine/tests/__pycache__/test_project.cpython-313.pyc +0 -0
  61. package/omega/Agentik_Engine/tests/__pycache__/test_reducer.cpython-313.pyc +0 -0
  62. package/omega/Agentik_Engine/tests/__pycache__/test_report.cpython-313.pyc +0 -0
  63. package/omega/Agentik_Engine/tests/test_audit_arsenal.py +80 -0
  64. package/omega/Agentik_Engine/tests/test_executor.py +96 -0
  65. package/omega/Agentik_Engine/tests/test_mission.py +64 -0
  66. package/omega/Agentik_Engine/tests/test_progress.py +69 -0
  67. package/omega/Agentik_Engine/tests/test_project.py +61 -0
  68. package/omega/Agentik_Engine/tests/test_reducer.py +144 -0
  69. package/omega/Agentik_Engine/tests/test_report.py +88 -0
  70. package/omega/Agentik_Extra/README.md +37 -0
  71. package/omega/Agentik_Extra/etc/agentik.env.example +19 -0
  72. package/omega/Agentik_Extra/etc/structure.yaml +46 -0
  73. package/omega/Agentik_Orchestration/README.md +43 -0
  74. package/omega/Agentik_Orchestration/autonomous/README.md +29 -0
  75. package/omega/Agentik_Orchestration/autonomous/example-agents.yaml +85 -0
  76. package/omega/Agentik_Orchestration/educators/README.md +55 -0
  77. package/omega/Agentik_Orchestration/topologies/aisb-oracle-worker.yaml +42 -0
  78. package/omega/Agentik_Orchestration/verifier/audit-router.yaml +26 -0
  79. package/omega/Agentik_Providers/README.md +62 -0
  80. package/omega/Agentik_Providers/claude/accounts.example.yaml +28 -0
  81. package/omega/Agentik_Providers/registry.yaml +30 -0
  82. package/omega/Agentik_Runtime/README.md +30 -0
  83. package/omega/Agentik_SSOT/README.md +36 -0
  84. package/omega/Agentik_SSOT/VERSION +1 -0
  85. package/omega/Agentik_SSOT/audits/a11yaudit.yaml +69 -0
  86. package/omega/Agentik_SSOT/audits/apiaudit.yaml +71 -0
  87. package/omega/Agentik_SSOT/audits/automationaudit.yaml +77 -0
  88. package/omega/Agentik_SSOT/audits/codeaudit.yaml +63 -0
  89. package/omega/Agentik_SSOT/audits/copyaudit.yaml +68 -0
  90. package/omega/Agentik_SSOT/audits/dataaudit.yaml +76 -0
  91. package/omega/Agentik_SSOT/audits/debugaudit.yaml +75 -0
  92. package/omega/Agentik_SSOT/audits/dxaudit.yaml +78 -0
  93. package/omega/Agentik_SSOT/audits/featureaudit.yaml +73 -0
  94. package/omega/Agentik_SSOT/audits/flowaudit.yaml +72 -0
  95. package/omega/Agentik_SSOT/audits/logicaudit.yaml +75 -0
  96. package/omega/Agentik_SSOT/audits/motionaudit.yaml +67 -0
  97. package/omega/Agentik_SSOT/audits/perfaudit.yaml +71 -0
  98. package/omega/Agentik_SSOT/audits/refontaudit.yaml +77 -0
  99. package/omega/Agentik_SSOT/audits/retentionaudit.yaml +84 -0
  100. package/omega/Agentik_SSOT/audits/secaudit.yaml +73 -0
  101. package/omega/Agentik_SSOT/audits/seoaudit.yaml +75 -0
  102. package/omega/Agentik_SSOT/audits/uiuxaudit.yaml +61 -0
  103. package/omega/Agentik_SSOT/mcp/mcp-catalog.yaml +136 -0
  104. package/omega/Agentik_SSOT/rules/constitution.md +44 -0
  105. package/omega/Agentik_SSOT/schemas/event.schema.json +45 -0
  106. package/omega/Agentik_SSOT/schemas/task.schema.json +54 -0
  107. package/omega/Agentik_Tools/README.md +42 -0
  108. package/omega/Agentik_Tools/registry.json +15 -0
  109. package/package.json +43 -0
@@ -0,0 +1,121 @@
1
+ # Omega OS — MCP Servers & Claude Code Plugins
2
+
3
+ > Where MCP lives, how the installer offers it, and how it reaches every
4
+ > provider.
5
+
6
+ ---
7
+
8
+ ## 1. An MCP is three things
9
+
10
+ An MCP server is not one artifact — it has three aspects, each with a natural
11
+ home in the 8-block rack:
12
+
13
+ | Aspect | Block | Why |
14
+ |---|---|---|
15
+ | The **server binary** (Composio, Higgsfield, filesystem…) | `Agentik_Tools/` | third-party installed software — like n8n or ollama |
16
+ | The **catalog + canonical config** (which MCP, args, scopes) | `Agentik_SSOT/mcp/` | truth/config — neutral, versioned, projected to each provider by its adapter |
17
+ | The **secrets** (API keys for Composio, GitHub tokens…) | `Agentik_Extra/etc/secrets/` | sensitive — encrypted vault, never in git |
18
+
19
+ So the answer to *"SSOT or Orchestration?"* is: **the catalog and config live in
20
+ `Agentik_SSOT/mcp/`** — it is truth/config, not orchestration logic. The
21
+ `connection-educator` (which lives in `Agentik_Orchestration/educators/`)
22
+ *generates and maintains* that config into the SSOT. Orchestration owns the
23
+ educator; the SSOT owns the artifact.
24
+
25
+ ---
26
+
27
+ ## 2. The catalog
28
+
29
+ `Agentik_SSOT/mcp/mcp-catalog.yaml` lists every MCP server (and Claude Code
30
+ plugin) the installer can offer. Each entry:
31
+
32
+ ```yaml
33
+ - id: composio
34
+ name: Composio
35
+ description: 250+ app integrations behind one MCP server
36
+ category: integrations
37
+ install: { method: npx, package: "@composio/mcp" }
38
+ secrets: [COMPOSIO_API_KEY]
39
+ recommended: true
40
+ ```
41
+
42
+ The installer's `40-mcp` step reads this catalog and presents it as a checklist
43
+ (interactive) or applies a selection from the manifest (headless).
44
+
45
+ ## 3. Canonical config → per-provider projection
46
+
47
+ The selected MCPs are written to `Agentik_SSOT/mcp/mcp-config.yaml` in a
48
+ neutral form. Each provider adapter *projects* it into that provider's native
49
+ shape:
50
+
51
+ ```
52
+ Agentik_SSOT/mcp/mcp-config.yaml (neutral, canonical)
53
+ │ provider adapter
54
+ ├──▶ claude → ~/.claude/.mcp.json / settings.json mcpServers
55
+ ├──▶ glm → <glm-native MCP config>
56
+ └──▶ openai → <openai-native tool/MCP config>
57
+ ```
58
+
59
+ Add a new LLM later → write one adapter projection; the MCP catalog and config
60
+ are reused as-is.
61
+
62
+ ---
63
+
64
+ ## 4. The curated catalog (shipped)
65
+
66
+ The installer ships a curated catalog. Defaults marked ✓ are pre-selected:
67
+
68
+ | MCP / Plugin | Category | Default |
69
+ |---|---|---|
70
+ | filesystem | core | ✓ |
71
+ | git | core | ✓ |
72
+ | github | dev | ✓ |
73
+ | Composio (250+ app connectors) | integrations | ✓ |
74
+ | Higgsfield (image / video generation) | media | |
75
+ | Notion | docs | |
76
+ | Slack | comms | |
77
+ | Linear | project mgmt | |
78
+ | Playwright (browser / runtime audits) | testing | ✓ |
79
+ | context7 (live library docs) | dev | ✓ |
80
+ | fetch (web fetch) | core | ✓ |
81
+ | memory (knowledge graph) | core | |
82
+ | sequential-thinking | reasoning | |
83
+ | Sentry | observability | |
84
+ | Postgres | data | |
85
+ | Brave Search | search | |
86
+
87
+ Plus the **Claude Code plugin marketplace** — the same plugins offered in the
88
+ Claude desktop app under *Connectors → Customize*. The installer queries the
89
+ marketplace and lists them in the same checklist, so a fresh VPS can be brought
90
+ up with the full plugin suite in one pass.
91
+
92
+ ---
93
+
94
+ ## 5. Install flow (`40-mcp` step)
95
+
96
+ ```
97
+ read Agentik_SSOT/mcp/mcp-catalog.yaml
98
+
99
+ ├─ interactive → TUI checklist (recommended pre-ticked)
100
+ └─ headless → apply `mcp:` list from the manifest
101
+
102
+ for each selected entry:
103
+ ├─ install the server binary into Agentik_Tools/<id>/
104
+ ├─ prompt for / read its secrets → Agentik_Extra/etc/secrets/ (vault)
105
+ └─ add it to Agentik_SSOT/mcp/mcp-config.yaml
106
+
107
+ omega sync → each provider adapter projects mcp-config.yaml to its native format
108
+ ```
109
+
110
+ The step is idempotent: re-running it adds new selections without disturbing
111
+ existing ones.
112
+
113
+ ---
114
+
115
+ ## 6. Security
116
+
117
+ MCP secrets never touch the git-tracked tree. They live in
118
+ `Agentik_Extra/etc/secrets/` — an encrypted vault (age/sops or the OS keyring).
119
+ The installer writes a *reference* to the secret in `mcp-config.yaml`
120
+ (`secret_ref: COMPOSIO_API_KEY`), never the value. Provider adapters resolve the
121
+ reference at projection time.
@@ -0,0 +1,63 @@
1
+ # Omega OS — Runtime Build Plan
2
+
3
+ > From "scaffold" to "runs a real mission". Every item below is **coded and
4
+ > tested**, not specified. Done = the e2e test passes and a real PDF is produced.
5
+
6
+ ## Goal
7
+
8
+ OmegaOS executes a real mission end-to-end — `AISB → Oracle → Manager → Worker →
9
+ Verifier → VERIFIED` — an Oracle finishing **always** emits a whitepaper PDF
10
+ report, progress is tracked live to Telegram topics with a progress bar, and
11
+ creating a project builds its structure + Telegram topic.
12
+
13
+ ## Phase A — the runtime core (missions actually run)
14
+
15
+ | Module | Role |
16
+ |---|---|
17
+ | `bus.py` | in-process event bus — append to store + push to subscribers |
18
+ | `provider.py` | `AgentProvider` contract + `MockProvider` (deterministic, testable) + `ClaudeProvider` (real Anthropic SDK) |
19
+ | `router.py` | model router — role → provider |
20
+ | `audit.py` | the audit gate — `CLAIMED_DONE → VERIFIED/REJECTED`, incl. a runtime audit |
21
+ | `executor.py` | **the topology executor** — runs the graph, scopes, join barrier, dispatch, audit |
22
+
23
+ **Done when:** `tests/test_executor.py` runs a full mission with `MockProvider`
24
+ and asserts it reaches `VERIFIED`, the barrier resolved, all events legal.
25
+
26
+ ## Phase B — reporting (Oracle → PDF, always)
27
+
28
+ | Module | Role |
29
+ |---|---|
30
+ | `report.py` | mission + event log → whitepaper JSON → `pdfgen` → PDF |
31
+ | Tools integration | `pdfgen` registered in `Agentik_Tools/` (registry + installer step) |
32
+
33
+ **Done when:** a finished mission produces a real `.pdf` via `pdfgen
34
+ --template=whitepaper --theme=agentik`, verified on disk.
35
+
36
+ ## Phase C — Telegram & progress
37
+
38
+ | Module | Role |
39
+ |---|---|
40
+ | `progress.py` | bus subscriber — per-mission progress model + progress-bar render |
41
+ | `telegram.py` | Telegram bridge — post/edit progress in a topic, deliver the PDF |
42
+
43
+ **Done when:** a live progress message posts and updates in a Telegram topic;
44
+ the PDF is delivered.
45
+
46
+ ## Phase D — projects
47
+
48
+ | Module | Role |
49
+ |---|---|
50
+ | `project.py` | `create_project(name)` — structure + registry + Telegram topic + routing |
51
+
52
+ **Done when:** `omega project create <name>` builds the project tree and a bound
53
+ Telegram topic.
54
+
55
+ ## Phase E — wire-up
56
+
57
+ `cli.py` gains `omega run`, `omega project`, `omega report`. The installer
58
+ registers `pdfgen`. Docs updated. Full verification re-run, green.
59
+
60
+ ## Test discipline
61
+
62
+ Every module ships with a test. The terminal proof is the e2e: a mission runs,
63
+ an Oracle finishes, a PDF lands. No module is "done" until its test passes.
package/install.sh ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env bash
2
+ # Omega OS — installer entry point.
3
+ #
4
+ # Usage:
5
+ # bash install.sh [--profile vps|workstation|minimal]
6
+ # [--manifest FILE] [--non-interactive] [--force]
7
+ #
8
+ # Idempotent and resumable: completed steps are recorded; re-running resumes.
9
+ set -euo pipefail
10
+
11
+ REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
+ # shellcheck source=bootstrap/lib/common.sh
13
+ source "$REPO_DIR/bootstrap/lib/common.sh"
14
+ # shellcheck source=bootstrap/lib/steps.sh
15
+ source "$REPO_DIR/bootstrap/lib/steps.sh"
16
+
17
+ PROFILE="vps"; MANIFEST=""; NONINTERACTIVE=0; FORCE=0
18
+ [ "$(uname -s)" = "Darwin" ] && PROFILE="workstation"
19
+
20
+ while [ $# -gt 0 ]; do
21
+ case "$1" in
22
+ --profile) PROFILE="${2:?}"; shift 2 ;;
23
+ --manifest) MANIFEST="${2:?}"; NONINTERACTIVE=1; shift 2 ;;
24
+ --non-interactive) NONINTERACTIVE=1; shift ;;
25
+ --force) FORCE=1; shift ;;
26
+ -h|--help) grep '^#' "$0" | tail -n +2 | sed 's/^#\{1,\} \{0,1\}//'; exit 0 ;;
27
+ *) die "unknown argument: $1" ;;
28
+ esac
29
+ done
30
+ export PROFILE MANIFEST NONINTERACTIVE FORCE OMEGA_REPO="$REPO_DIR"
31
+
32
+ detect_os
33
+ mkdir -p "$STATE_DIR/logs"
34
+ [ "$FORCE" = "1" ] && reset_state
35
+
36
+ echo
37
+ echo " Omega OS — installer"
38
+ echo " profile=$PROFILE os=$OMEGA_OS home=$OMEGA_HOME"
39
+ echo
40
+
41
+ run_step 00-preflight step_preflight
42
+ run_step 10-system-deps step_system_deps
43
+ run_step 20-structure step_structure
44
+ run_step 30-engine step_engine
45
+ run_step 40-mcp step_mcp
46
+ if [ "$PROFILE" != "minimal" ]; then
47
+ run_step 50-telegram step_telegram
48
+ fi
49
+ run_step 60-services step_services
50
+ run_step 70-doctor step_doctor
51
+
52
+ echo
53
+ ok "Omega OS installed at $OMEGA_HOME"
54
+ log " next: export OMEGA_HOME=$OMEGA_HOME && \"$OMEGA_HOME/Agentik_Tools/bin/omega\" status"
@@ -0,0 +1,21 @@
1
+ # Agentik_Coding — your projects
2
+
3
+ > **Nature:** your work · **Lifecycle:** very fluid · **Git:** each project is its own repo
4
+
5
+ Every project Omega OS works on lives here. One sub-folder per project; each
6
+ project maps to a **topic** in the Telegram forum group — reply in a topic and
7
+ the mission routes to that project.
8
+
9
+ ```
10
+ Agentik_Coding/
11
+ ├── projects/ one sub-folder per project (each its own git repo)
12
+ └── worktrees/ ephemeral git worktrees — workers check out here so parallel
13
+ workers never collide on the same working tree
14
+ ```
15
+
16
+ Both `projects/` and `worktrees/` are populated per deployment and are
17
+ git-ignored by the OmegaOS repo (they are *your* repos, not part of the product).
18
+
19
+ A worker that touches files in a project does so inside a dedicated worktree in
20
+ `worktrees/`; its file scope (`spec.scope.files_owned`) is the lock that lets the
21
+ Manager run scope-disjoint workers in parallel.
@@ -0,0 +1,58 @@
1
+ # Agentik_Engine — the orchestration engine
2
+
3
+ > **Nature:** the engine + runtime · **Lifecycle:** the core of the system · **Git:** dedicated repo
4
+
5
+ This block runs missions. It is business-agnostic: it executes graphs of `Task`s
6
+ with verified completion. *Who* is an oracle and *which* topology runs lives in
7
+ `Agentik_Orchestration/` — the engine never hard-codes it.
8
+
9
+ ## Modules — all implemented, all tested
10
+
11
+ | Module | Role |
12
+ |---|---|
13
+ | `task.py` | `Task` model, `TaskState` FSM, `Kind`, `Lifecycle`, `Trigger`, `Budget` |
14
+ | `events.py` | immutable `Event` + `EventType` — the source of truth |
15
+ | `reducer.py` | the **pure** reducer `(state, event) → state` + legal transition table |
16
+ | `barrier.py` | the join barrier — `RUNNING / PARTIAL / JOINABLE` |
17
+ | `store.py` | append-only `EventStore` + `SQLiteStore` (WAL, rowid-ordered) |
18
+ | `bus.py` | the event bus — append to the store, push to subscribers |
19
+ | `provider.py` | `AgentProvider` contract + `MockProvider` + `ClaudeProvider` |
20
+ | `router.py` | the model router — role → provider |
21
+ | `audit.py` | the simple audit gate — `CLAIMED_DONE → VERIFIED/REJECTED`, incl. a runtime audit |
22
+ | `audit_arsenal.py` | the Quality Arsenal — 18 forensic audits as the verification gate |
23
+ | `executor.py` | **the topology executor** — runs the mission graph, scopes, barrier |
24
+ | `progress.py` | live progress tracking — a bus subscriber → progress bar |
25
+ | `report.py` | mission → whitepaper JSON → `pdfgen` → PDF |
26
+ | `telegram.py` | the Telegram bridge — topics, live progress, PDF delivery |
27
+ | `project.py` | project creation — structure, registry, bound Telegram topic |
28
+ | `mission.py` | the mission coordinator — `run_mission()` ties it all together |
29
+ | `supervisor.py` | the deadman / watchdog — stall → `task.failed` |
30
+ | `cli.py` | the `omega` CLI — `run`, `project`, `doctor`, `status`, `account`, … |
31
+
32
+ ## Tests
33
+
34
+ ```bash
35
+ cd Agentik_Engine
36
+ for t in reducer executor progress project report mission; do
37
+ python3 tests/test_$t.py
38
+ done
39
+ ```
40
+
41
+ 23 tests, all green — including an **end-to-end mission** (a real mission runs to
42
+ `VERIFIED`) and **live PDF generation** through the `pdfgen` tool.
43
+
44
+ ## Run a mission
45
+
46
+ ```bash
47
+ omega run "fix the pricing bug" # Oracle plans → workers → verifier → PDF report
48
+ omega project "My Project" # structure + registry + Telegram topic
49
+ omega status # every task and its derived state
50
+ ```
51
+
52
+ `omega run` uses the real `ClaudeProvider` when `ANTHROPIC_API_KEY` is set,
53
+ otherwise the deterministic `MockProvider` — so it always works.
54
+
55
+ ## The one rule
56
+
57
+ No agent ever writes a `TaskState`. Agents append `Event`s; the state is always
58
+ `reduce_task(store.events_for(task_id))`.
@@ -0,0 +1,58 @@
1
+ """Omega OS orchestration engine.
2
+
3
+ Event-sourced, verified-completion agent graphs. The engine is business-agnostic:
4
+ it executes graphs of Tasks. Who is an "oracle" and which topology runs lives in
5
+ Agentik_Orchestration/, never here.
6
+ """
7
+ from omega_engine.audit import AuditFinding, AuditGate, AuditVerdict
8
+ from omega_engine.audit_arsenal import (
9
+ ArsenalGate,
10
+ ArsenalVerdict,
11
+ Audit,
12
+ AuditRegistry,
13
+ run_forensic_audit,
14
+ )
15
+ from omega_engine.barrier import ScopeStatus, scope_status
16
+ from omega_engine.bus import EventBus
17
+ from omega_engine.events import Event, EventType
18
+ from omega_engine.executor import Executor, MissionResult
19
+ from omega_engine.progress import MissionProgress, ProgressTracker
20
+ from omega_engine.provider import (
21
+ AgentProvider,
22
+ AgentRequest,
23
+ AgentResult,
24
+ ClaudeProvider,
25
+ MockProvider,
26
+ )
27
+ from omega_engine.reducer import IllegalTransition, reduce, reduce_task
28
+ from omega_engine.router import ModelRouter
29
+ from omega_engine.store import EventStore, SQLiteStore
30
+ from omega_engine.task import (
31
+ TERMINAL,
32
+ Budget,
33
+ Kind,
34
+ Lifecycle,
35
+ Task,
36
+ TaskState,
37
+ Trigger,
38
+ )
39
+
40
+ __version__ = "0.1.0"
41
+
42
+ __all__ = [
43
+ "__version__",
44
+ # task model + FSM
45
+ "Task", "TaskState", "TERMINAL", "Kind", "Lifecycle", "Trigger", "Budget",
46
+ # events + reducer
47
+ "Event", "EventType", "reduce", "reduce_task", "IllegalTransition",
48
+ # barrier
49
+ "ScopeStatus", "scope_status",
50
+ # store + bus
51
+ "EventStore", "SQLiteStore", "EventBus",
52
+ # providers + router
53
+ "AgentProvider", "AgentRequest", "AgentResult", "MockProvider",
54
+ "ClaudeProvider", "ModelRouter",
55
+ # audit + executor + progress
56
+ "AuditGate", "AuditVerdict", "AuditFinding",
57
+ "Executor", "MissionResult", "ProgressTracker", "MissionProgress",
58
+ ]
@@ -0,0 +1,96 @@
1
+ """The audit gate — the CLAIMED_DONE -> VERIFIED transition.
2
+
3
+ A task is VERIFIED only if the gate passes. The gate runs a set of audit checks
4
+ and aggregates a score. One check — the runtime audit — actually EXECUTES a
5
+ command (the real flow). The verifier is independent: it never trusts the
6
+ worker's claim, it observes the system running.
7
+ """
8
+ from __future__ import annotations
9
+
10
+ import subprocess
11
+ from dataclasses import dataclass, field
12
+ from typing import Any, Callable
13
+
14
+
15
+ @dataclass
16
+ class AuditFinding:
17
+ audit: str
18
+ score: int # 0-100
19
+ detail: str = ""
20
+
21
+
22
+ @dataclass
23
+ class AuditVerdict:
24
+ score: int # aggregate 0-100
25
+ verified: bool
26
+ findings: list[AuditFinding] = field(default_factory=list)
27
+
28
+
29
+ #: An audit check: inspect the task context, return a finding.
30
+ AuditCheck = Callable[[dict[str, Any]], AuditFinding]
31
+
32
+
33
+ def audit_artifacts_present(ctx: dict[str, Any]) -> AuditFinding:
34
+ """Static audit — the worker actually produced something."""
35
+ artifacts = ctx.get("artifacts", {}) or {}
36
+ ok = bool(artifacts.get("files") or artifacts.get("summary"))
37
+ return AuditFinding(
38
+ "artifacts-present",
39
+ 100 if ok else 0,
40
+ "artifacts found" if ok else "no artifacts produced",
41
+ )
42
+
43
+
44
+ def audit_runtime_flow(ctx: dict[str, Any]) -> AuditFinding:
45
+ """Runtime audit — RUN the real flow.
46
+
47
+ `ctx['runtime_cmd']` is executed; exit 0 = pass. This is validate-live: the
48
+ verifier does not read code and nod, it runs the thing. No command declared
49
+ is itself a finding (you cannot verify what you cannot run).
50
+ """
51
+ cmd = ctx.get("runtime_cmd")
52
+ if not cmd:
53
+ return AuditFinding("runtime-flow", 0, "no runtime command declared")
54
+ try:
55
+ proc = subprocess.run(
56
+ cmd, shell=True, capture_output=True, text=True, timeout=120
57
+ )
58
+ except subprocess.TimeoutExpired:
59
+ return AuditFinding("runtime-flow", 0, "runtime command timed out")
60
+ if proc.returncode == 0:
61
+ return AuditFinding("runtime-flow", 100, "live flow passed")
62
+ return AuditFinding(
63
+ "runtime-flow", 0,
64
+ f"exit {proc.returncode}: {(proc.stderr or proc.stdout)[:200]}",
65
+ )
66
+
67
+
68
+ class AuditGate:
69
+ """Runs the audit checks, aggregates, decides VERIFIED vs REJECTED.
70
+
71
+ Default gate = artifacts-present + runtime-flow. The runtime audit is what
72
+ makes completion un-fakeable: a task is VERIFIED only if its real flow ran.
73
+ """
74
+
75
+ def __init__(
76
+ self,
77
+ checks: list[AuditCheck] | None = None,
78
+ threshold: int = 85,
79
+ ) -> None:
80
+ self._checks: list[AuditCheck] = (
81
+ checks if checks is not None
82
+ else [audit_artifacts_present, audit_runtime_flow]
83
+ )
84
+ self._threshold = threshold
85
+
86
+ def verify(self, ctx: dict[str, Any]) -> AuditVerdict:
87
+ findings = [check(ctx) for check in self._checks]
88
+ score = (
89
+ round(sum(f.score for f in findings) / len(findings))
90
+ if findings else 0
91
+ )
92
+ return AuditVerdict(
93
+ score=score,
94
+ verified=score >= self._threshold,
95
+ findings=findings,
96
+ )