theodosia 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. theodosia-0.1.0/.githooks/pre-commit +13 -0
  2. theodosia-0.1.0/.github/workflows/docs.yml +38 -0
  3. theodosia-0.1.0/.github/workflows/release.yml +37 -0
  4. theodosia-0.1.0/.gitignore +29 -0
  5. theodosia-0.1.0/.python-version +1 -0
  6. theodosia-0.1.0/LICENSE +202 -0
  7. theodosia-0.1.0/NOTICE.md +9 -0
  8. theodosia-0.1.0/PKG-INFO +239 -0
  9. theodosia-0.1.0/README.md +203 -0
  10. theodosia-0.1.0/SECURITY.md +77 -0
  11. theodosia-0.1.0/bench/P0-design.md +113 -0
  12. theodosia-0.1.0/bench/_drivers.py +197 -0
  13. theodosia-0.1.0/bench/judge.py +287 -0
  14. theodosia-0.1.0/bench/rubrics/doc-coauthoring.md +86 -0
  15. theodosia-0.1.0/bench/rubrics/security-audit.md +100 -0
  16. theodosia-0.1.0/bench/run_p0.py +307 -0
  17. theodosia-0.1.0/bench/smoke_p0.py +241 -0
  18. theodosia-0.1.0/bench/workflows.py +109 -0
  19. theodosia-0.1.0/demos/demo.gif +0 -0
  20. theodosia-0.1.0/demos/demo.tape +28 -0
  21. theodosia-0.1.0/demos/observability.gif +0 -0
  22. theodosia-0.1.0/demos/observability.tape +58 -0
  23. theodosia-0.1.0/demos/watch.gif +0 -0
  24. theodosia-0.1.0/demos/watch.tape +37 -0
  25. theodosia-0.1.0/examples/adaptive_crag.py +478 -0
  26. theodosia-0.1.0/examples/adventure.py +166 -0
  27. theodosia-0.1.0/examples/async_hooks.py +214 -0
  28. theodosia-0.1.0/examples/async_persister.py +183 -0
  29. theodosia-0.1.0/examples/bob.example.json +159 -0
  30. theodosia-0.1.0/examples/burr_map_parallel.py +390 -0
  31. theodosia-0.1.0/examples/caller_sample.py +136 -0
  32. theodosia-0.1.0/examples/chargen.py +244 -0
  33. theodosia-0.1.0/examples/class_action.py +211 -0
  34. theodosia-0.1.0/examples/claude-code.example.json +159 -0
  35. theodosia-0.1.0/examples/codebase_security.py +958 -0
  36. theodosia-0.1.0/examples/coffee_order.py +154 -0
  37. theodosia-0.1.0/examples/combinatoric_testing.py +259 -0
  38. theodosia-0.1.0/examples/combo_testing.py +278 -0
  39. theodosia-0.1.0/examples/custom_telemetry.py +185 -0
  40. theodosia-0.1.0/examples/data/codebase_security/vuln_demo/README.md +17 -0
  41. theodosia-0.1.0/examples/data/codebase_security/vuln_demo/app/admin.py +16 -0
  42. theodosia-0.1.0/examples/data/codebase_security/vuln_demo/app/crypto.py +13 -0
  43. theodosia-0.1.0/examples/data/codebase_security/vuln_demo/app/db.py +14 -0
  44. theodosia-0.1.0/examples/data/codebase_security/vuln_demo/app/serde.py +13 -0
  45. theodosia-0.1.0/examples/data/codebase_security/vuln_demo/config.py +10 -0
  46. theodosia-0.1.0/examples/data/combinatoric_testing/dag.py +66 -0
  47. theodosia-0.1.0/examples/data/combinatoric_testing/sut.py +57 -0
  48. theodosia-0.1.0/examples/data/combo_testing/checkout.py +115 -0
  49. theodosia-0.1.0/examples/data/combo_testing/dag.py +85 -0
  50. theodosia-0.1.0/examples/data/hamilton_features/features.py +84 -0
  51. theodosia-0.1.0/examples/data/incident_response/alert.json +42 -0
  52. theodosia-0.1.0/examples/data/incident_response/api-gateway.log +60 -0
  53. theodosia-0.1.0/examples/data/incident_response/deploys.json +41 -0
  54. theodosia-0.1.0/examples/data/local_shell/config.yaml +10 -0
  55. theodosia-0.1.0/examples/data/local_shell/data.csv +8 -0
  56. theodosia-0.1.0/examples/data/local_shell/notes/welcome.md +5 -0
  57. theodosia-0.1.0/examples/data/parallel_research/faqs/deployments.md +27 -0
  58. theodosia-0.1.0/examples/data/parallel_research/faqs/oncall.md +27 -0
  59. theodosia-0.1.0/examples/data/parallel_research/faqs/secrets.md +28 -0
  60. theodosia-0.1.0/examples/data/parallel_research/runbooks/auth-debug.md +26 -0
  61. theodosia-0.1.0/examples/data/parallel_research/runbooks/deploy-rollback.md +28 -0
  62. theodosia-0.1.0/examples/data/parallel_research/runbooks/incident-response.md +25 -0
  63. theodosia-0.1.0/examples/data/parallel_research/services/auth.md +27 -0
  64. theodosia-0.1.0/examples/data/parallel_research/services/billing.md +27 -0
  65. theodosia-0.1.0/examples/data/parallel_research/services/deploy.md +24 -0
  66. theodosia-0.1.0/examples/differential_review.py +634 -0
  67. theodosia-0.1.0/examples/doc_coauthoring.py +746 -0
  68. theodosia-0.1.0/examples/elicit_confirm.py +118 -0
  69. theodosia-0.1.0/examples/fp_check.py +583 -0
  70. theodosia-0.1.0/examples/full_logger.py +112 -0
  71. theodosia-0.1.0/examples/git_review.py +215 -0
  72. theodosia-0.1.0/examples/granite_guardian.py +360 -0
  73. theodosia-0.1.0/examples/granite_oncall.py +402 -0
  74. theodosia-0.1.0/examples/hamilton_features.py +371 -0
  75. theodosia-0.1.0/examples/http_serve.py +45 -0
  76. theodosia-0.1.0/examples/incident_response.py +533 -0
  77. theodosia-0.1.0/examples/local_shell.py +200 -0
  78. theodosia-0.1.0/examples/mcphost.example.json +30 -0
  79. theodosia-0.1.0/examples/mellea_qiskit_migration.py +444 -0
  80. theodosia-0.1.0/examples/ml_training.py +459 -0
  81. theodosia-0.1.0/examples/multi_graph.py +99 -0
  82. theodosia-0.1.0/examples/parallel_research.py +352 -0
  83. theodosia-0.1.0/examples/partition_key_tenants.py +149 -0
  84. theodosia-0.1.0/examples/pipeline_hooks.py +230 -0
  85. theodosia-0.1.0/examples/pydantic_actions.py +258 -0
  86. theodosia-0.1.0/examples/scripts/demo_play.py +53 -0
  87. theodosia-0.1.0/examples/scripts/demo_recorded_trace.txt +40 -0
  88. theodosia-0.1.0/examples/scripts/demo_walk.py +123 -0
  89. theodosia-0.1.0/examples/scripts/seed_coffee_session.py +54 -0
  90. theodosia-0.1.0/examples/security_audit.py +516 -0
  91. theodosia-0.1.0/examples/skills/README.md +37 -0
  92. theodosia-0.1.0/examples/skills/claude-api/ATTRIBUTION.md +13 -0
  93. theodosia-0.1.0/examples/skills/claude-api/SKILL.md +324 -0
  94. theodosia-0.1.0/examples/skills/differential-review/ATTRIBUTION.md +27 -0
  95. theodosia-0.1.0/examples/skills/differential-review/SKILL.md +228 -0
  96. theodosia-0.1.0/examples/skills/differential-review/adversarial.md +203 -0
  97. theodosia-0.1.0/examples/skills/differential-review/methodology.md +234 -0
  98. theodosia-0.1.0/examples/skills/differential-review/patterns.md +300 -0
  99. theodosia-0.1.0/examples/skills/differential-review/reporting.md +369 -0
  100. theodosia-0.1.0/examples/skills/doc-coauthoring/ATTRIBUTION.md +13 -0
  101. theodosia-0.1.0/examples/skills/doc-coauthoring/SKILL.md +375 -0
  102. theodosia-0.1.0/examples/skills/fp-check/ATTRIBUTION.md +24 -0
  103. theodosia-0.1.0/examples/skills/fp-check/SKILL.md +112 -0
  104. theodosia-0.1.0/examples/skills/fp-check/bug-class-verification.md +114 -0
  105. theodosia-0.1.0/examples/skills/fp-check/deep-verification.md +143 -0
  106. theodosia-0.1.0/examples/skills/fp-check/evidence-templates.md +91 -0
  107. theodosia-0.1.0/examples/skills/fp-check/false-positive-patterns.md +115 -0
  108. theodosia-0.1.0/examples/skills/fp-check/standard-verification.md +78 -0
  109. theodosia-0.1.0/examples/skills/mcp-builder/ATTRIBUTION.md +13 -0
  110. theodosia-0.1.0/examples/skills/mcp-builder/SKILL.md +236 -0
  111. theodosia-0.1.0/examples/skills/security-audit/ATTRIBUTION.md +13 -0
  112. theodosia-0.1.0/examples/skills/security-audit/SKILL.md +600 -0
  113. theodosia-0.1.0/examples/skills/skill-creator/ATTRIBUTION.md +13 -0
  114. theodosia-0.1.0/examples/skills/skill-creator/SKILL.md +485 -0
  115. theodosia-0.1.0/examples/skills/webapp-testing/ATTRIBUTION.md +13 -0
  116. theodosia-0.1.0/examples/skills/webapp-testing/SKILL.md +96 -0
  117. theodosia-0.1.0/examples/sqlite_persister.py +347 -0
  118. theodosia-0.1.0/examples/sse_serve.py +39 -0
  119. theodosia-0.1.0/examples/state_forking.py +230 -0
  120. theodosia-0.1.0/examples/streaming_hooks.py +220 -0
  121. theodosia-0.1.0/examples/streaming_narrate.py +81 -0
  122. theodosia-0.1.0/examples/subgraph_composition.py +204 -0
  123. theodosia-0.1.0/examples/subgraphs.py +96 -0
  124. theodosia-0.1.0/examples/trace_decorator.py +184 -0
  125. theodosia-0.1.0/examples/triage.py +123 -0
  126. theodosia-0.1.0/examples/typed_state_loan.py +274 -0
  127. theodosia-0.1.0/examples/unix_health.py +701 -0
  128. theodosia-0.1.0/examples/upstream_filesystem.py +187 -0
  129. theodosia-0.1.0/examples/webapp_testing.py +413 -0
  130. theodosia-0.1.0/examples/with_middleware.py +153 -0
  131. theodosia-0.1.0/examples/with_otel.py +78 -0
  132. theodosia-0.1.0/pyproject.toml +136 -0
  133. theodosia-0.1.0/scripts/voice_lint.py +198 -0
  134. theodosia-0.1.0/src/theodosia/__init__.py +63 -0
  135. theodosia-0.1.0/src/theodosia/_experimental/__init__.py +7 -0
  136. theodosia-0.1.0/src/theodosia/_experimental/modes.py +381 -0
  137. theodosia-0.1.0/src/theodosia/adapter.py +2659 -0
  138. theodosia-0.1.0/src/theodosia/cli.py +1159 -0
  139. theodosia-0.1.0/src/theodosia/doctor.py +547 -0
  140. theodosia-0.1.0/src/theodosia/importing.py +280 -0
  141. theodosia-0.1.0/src/theodosia/upstream.py +157 -0
  142. theodosia-0.1.0/tests/__init__.py +0 -0
  143. theodosia-0.1.0/tests/conftest.py +50 -0
  144. theodosia-0.1.0/tests/smoke/__init__.py +0 -0
  145. theodosia-0.1.0/tests/smoke/_helpers.py +182 -0
  146. theodosia-0.1.0/tests/smoke/conftest.py +61 -0
  147. theodosia-0.1.0/tests/smoke/test_bench_walk.py +161 -0
  148. theodosia-0.1.0/tests/smoke/test_caller_sample.py +60 -0
  149. theodosia-0.1.0/tests/smoke/test_demos.py +122 -0
  150. theodosia-0.1.0/tests/smoke/test_elicit_confirm.py +65 -0
  151. theodosia-0.1.0/tests/smoke/test_skill_workflows.py +282 -0
  152. theodosia-0.1.0/tests/smoke/test_upstream_filesystem_live.py +124 -0
  153. theodosia-0.1.0/tests/test_action_surface_instructions.py +118 -0
  154. theodosia-0.1.0/tests/test_adaptive_crag.py +431 -0
  155. theodosia-0.1.0/tests/test_adventure.py +109 -0
  156. theodosia-0.1.0/tests/test_async_hooks.py +105 -0
  157. theodosia-0.1.0/tests/test_async_persister.py +87 -0
  158. theodosia-0.1.0/tests/test_branching.py +86 -0
  159. theodosia-0.1.0/tests/test_burr_map_parallel.py +286 -0
  160. theodosia-0.1.0/tests/test_caller_sample.py +103 -0
  161. theodosia-0.1.0/tests/test_chargen.py +185 -0
  162. theodosia-0.1.0/tests/test_class_action.py +146 -0
  163. theodosia-0.1.0/tests/test_cli.py +255 -0
  164. theodosia-0.1.0/tests/test_cli_sessions.py +279 -0
  165. theodosia-0.1.0/tests/test_codebase_security.py +473 -0
  166. theodosia-0.1.0/tests/test_coffee_order.py +120 -0
  167. theodosia-0.1.0/tests/test_combinatoric_testing.py +249 -0
  168. theodosia-0.1.0/tests/test_combo_testing.py +307 -0
  169. theodosia-0.1.0/tests/test_custom_telemetry.py +78 -0
  170. theodosia-0.1.0/tests/test_differential_review.py +334 -0
  171. theodosia-0.1.0/tests/test_doc_coauthoring.py +496 -0
  172. theodosia-0.1.0/tests/test_doctor.py +372 -0
  173. theodosia-0.1.0/tests/test_elicit_confirm.py +86 -0
  174. theodosia-0.1.0/tests/test_eviction.py +106 -0
  175. theodosia-0.1.0/tests/test_external_tools.py +138 -0
  176. theodosia-0.1.0/tests/test_fork_at.py +159 -0
  177. theodosia-0.1.0/tests/test_fork_from_past.py +176 -0
  178. theodosia-0.1.0/tests/test_fp_check.py +243 -0
  179. theodosia-0.1.0/tests/test_full_logger.py +68 -0
  180. theodosia-0.1.0/tests/test_git_review.py +90 -0
  181. theodosia-0.1.0/tests/test_granite_guardian.py +177 -0
  182. theodosia-0.1.0/tests/test_granite_oncall.py +211 -0
  183. theodosia-0.1.0/tests/test_graph_resource.py +129 -0
  184. theodosia-0.1.0/tests/test_hamilton_features.py +275 -0
  185. theodosia-0.1.0/tests/test_hardening.py +164 -0
  186. theodosia-0.1.0/tests/test_history.py +101 -0
  187. theodosia-0.1.0/tests/test_http_transport.py +123 -0
  188. theodosia-0.1.0/tests/test_importing.py +301 -0
  189. theodosia-0.1.0/tests/test_incident_response.py +202 -0
  190. theodosia-0.1.0/tests/test_input_coercion.py +184 -0
  191. theodosia-0.1.0/tests/test_introspection.py +66 -0
  192. theodosia-0.1.0/tests/test_local_shell.py +183 -0
  193. theodosia-0.1.0/tests/test_mellea_qiskit_migration.py +331 -0
  194. theodosia-0.1.0/tests/test_ml_training.py +242 -0
  195. theodosia-0.1.0/tests/test_mount_multi.py +155 -0
  196. theodosia-0.1.0/tests/test_next_hint.py +263 -0
  197. theodosia-0.1.0/tests/test_otel.py +167 -0
  198. theodosia-0.1.0/tests/test_parallel_research.py +280 -0
  199. theodosia-0.1.0/tests/test_partition_key_tenants.py +105 -0
  200. theodosia-0.1.0/tests/test_per_action_timeout.py +150 -0
  201. theodosia-0.1.0/tests/test_per_session.py +93 -0
  202. theodosia-0.1.0/tests/test_pipeline_hooks.py +148 -0
  203. theodosia-0.1.0/tests/test_polish.py +150 -0
  204. theodosia-0.1.0/tests/test_pydantic_actions.py +157 -0
  205. theodosia-0.1.0/tests/test_reset_session.py +201 -0
  206. theodosia-0.1.0/tests/test_resume_v19.py +238 -0
  207. theodosia-0.1.0/tests/test_security_audit.py +268 -0
  208. theodosia-0.1.0/tests/test_session_resource.py +130 -0
  209. theodosia-0.1.0/tests/test_sqlite_persister.py +314 -0
  210. theodosia-0.1.0/tests/test_state_forking.py +102 -0
  211. theodosia-0.1.0/tests/test_step_mode.py +94 -0
  212. theodosia-0.1.0/tests/test_streaming.py +75 -0
  213. theodosia-0.1.0/tests/test_streaming_hooks.py +99 -0
  214. theodosia-0.1.0/tests/test_subgraph_composition.py +134 -0
  215. theodosia-0.1.0/tests/test_subgraphs.py +175 -0
  216. theodosia-0.1.0/tests/test_timeouts.py +153 -0
  217. theodosia-0.1.0/tests/test_trace.py +128 -0
  218. theodosia-0.1.0/tests/test_trace_decorator.py +83 -0
  219. theodosia-0.1.0/tests/test_typed_state.py +102 -0
  220. theodosia-0.1.0/tests/test_typed_state_loan.py +171 -0
  221. theodosia-0.1.0/tests/test_unix_health.py +445 -0
  222. theodosia-0.1.0/tests/test_upstream.py +125 -0
  223. theodosia-0.1.0/tests/test_validation.py +278 -0
  224. theodosia-0.1.0/tests/test_webapp_testing.py +195 -0
  225. theodosia-0.1.0/tests/test_with_middleware.py +60 -0
  226. theodosia-0.1.0/uv.lock +3102 -0
  227. theodosia-0.1.0/website/.gitignore +21 -0
  228. theodosia-0.1.0/website/.vscode/extensions.json +4 -0
  229. theodosia-0.1.0/website/.vscode/launch.json +11 -0
  230. theodosia-0.1.0/website/README.md +49 -0
  231. theodosia-0.1.0/website/astro.config.mjs +28 -0
  232. theodosia-0.1.0/website/package-lock.json +7581 -0
  233. theodosia-0.1.0/website/package.json +18 -0
  234. theodosia-0.1.0/website/public/favicon.svg +1 -0
  235. theodosia-0.1.0/website/src/assets/houston.webp +0 -0
  236. theodosia-0.1.0/website/src/content/docs/architecture.md +99 -0
  237. theodosia-0.1.0/website/src/content/docs/cli.md +179 -0
  238. theodosia-0.1.0/website/src/content/docs/compatibility.md +87 -0
  239. theodosia-0.1.0/website/src/content/docs/index.md +38 -0
  240. theodosia-0.1.0/website/src/content/docs/observability.md +64 -0
  241. theodosia-0.1.0/website/src/content/docs/upstream.md +65 -0
  242. theodosia-0.1.0/website/src/content.config.ts +7 -0
  243. theodosia-0.1.0/website/tsconfig.json +5 -0
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env bash
2
+ # Pre-commit hook: run voice lint against staged files.
3
+ #
4
+ # Enable with:
5
+ # git config core.hooksPath .githooks
6
+ #
7
+ # Disable for a single commit:
8
+ # git commit --no-verify
9
+
10
+ set -euo pipefail
11
+
12
+ REPO_ROOT="$(git rev-parse --show-toplevel)"
13
+ exec "$REPO_ROOT/.venv/bin/python" "$REPO_ROOT/scripts/voice_lint.py" --staged
@@ -0,0 +1,38 @@
1
+ name: docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - website/**
8
+ - .github/workflows/docs.yml
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+ pages: write
14
+ id-token: write
15
+
16
+ concurrency:
17
+ group: pages
18
+ cancel-in-progress: false
19
+
20
+ jobs:
21
+ build:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - uses: withastro/action@v3
26
+ with:
27
+ path: website
28
+ node-version: 22
29
+
30
+ deploy:
31
+ needs: build
32
+ runs-on: ubuntu-latest
33
+ environment:
34
+ name: github-pages
35
+ url: ${{ steps.deployment.outputs.page_url }}
36
+ steps:
37
+ - id: deployment
38
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,37 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: astral-sh/setup-uv@v5
17
+ - run: uv build
18
+ - run: uvx twine check dist/*
19
+ - uses: actions/upload-artifact@v4
20
+ with:
21
+ name: dist
22
+ path: dist/
23
+
24
+ publish:
25
+ needs: build
26
+ runs-on: ubuntu-latest
27
+ environment:
28
+ name: pypi
29
+ url: https://pypi.org/project/theodosia/
30
+ permissions:
31
+ id-token: write
32
+ steps:
33
+ - uses: actions/download-artifact@v4
34
+ with:
35
+ name: dist
36
+ path: dist/
37
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,29 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ *.pyo
5
+ *.egg-info/
6
+ build/
7
+ dist/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .mypy_cache/
11
+ .coverage
12
+ htmlcov/
13
+ .burr/
14
+ ~/.burr/
15
+
16
+ # Local notes; intentionally not tracked.
17
+ CLAUDE.md
18
+
19
+ # Agent-generated scratch docs from bench runs (written to cwd by SKILL-arm agents)
20
+ /auth-*.md
21
+ /decision-doc*.md
22
+ # Machine-local MCP/client config
23
+ .claude/settings.json
24
+ # Benchmark run outputs (regenerable; curated sets attach to GitHub releases, not main)
25
+ bench/traces/
26
+ site/
27
+
28
+ # VHS Screenshot verification frames (regenerable from the .tape files)
29
+ demos/*.png
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,9 @@
1
+ # Notice
2
+
3
+ Theodosia is independent open-source work by Adam Munawar Rahman. It does not represent the views, positions, or technology roadmap of IBM Corporation or any other employer, past or present.
4
+
5
+ Theodosia ships example demos that integrate with open-source projects originated at IBM (notably IBM Granite via Ollama, and Mellea). These demos are illustrative of integration patterns and are not endorsements, promotional material, or official integrations on behalf of IBM.
6
+
7
+ Theodosia builds on Apache Burr and FastMCP. It is not affiliated with, endorsed by, or sponsored by the Apache Software Foundation, DAGWorks, the Apache Burr project, or the FastMCP project.
8
+
9
+ Trademarks and project names referenced in this repository remain the property of their respective owners.
@@ -0,0 +1,239 @@
1
+ Metadata-Version: 2.4
2
+ Name: theodosia
3
+ Version: 0.1.0
4
+ Summary: Mount Burr state-machine Applications as MCP servers.
5
+ Author-email: Adam Munawar Rahman <msrahmanadam@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ License-File: NOTICE.md
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Requires-Python: <3.14,>=3.11
17
+ Requires-Dist: apache-burr[tracking]<0.43,>=0.42
18
+ Requires-Dist: fastmcp<3.4,>=3.3
19
+ Requires-Dist: pydantic<3,>=2
20
+ Requires-Dist: typer<1.0,>=0.12
21
+ Provides-Extra: all
22
+ Requires-Dist: apache-burr[opentelemetry]<0.43,>=0.42; extra == 'all'
23
+ Requires-Dist: apache-burr[start]<0.43,>=0.42; extra == 'all'
24
+ Requires-Dist: mellea>=0.1; extra == 'all'
25
+ Requires-Dist: opentelemetry-api>=1.20; extra == 'all'
26
+ Requires-Dist: opentelemetry-sdk>=1.20; extra == 'all'
27
+ Provides-Extra: mellea
28
+ Requires-Dist: mellea>=0.1; extra == 'mellea'
29
+ Provides-Extra: observability
30
+ Requires-Dist: apache-burr[opentelemetry]<0.43,>=0.42; extra == 'observability'
31
+ Requires-Dist: opentelemetry-api>=1.20; extra == 'observability'
32
+ Requires-Dist: opentelemetry-sdk>=1.20; extra == 'observability'
33
+ Provides-Extra: ui
34
+ Requires-Dist: apache-burr[start]<0.43,>=0.42; extra == 'ui'
35
+ Description-Content-Type: text/markdown
36
+
37
+ # Theodosia
38
+
39
+ [![PyPI](https://img.shields.io/pypi/v/theodosia.svg)](https://pypi.org/project/theodosia/)
40
+ [![Python](https://img.shields.io/pypi/pyversions/theodosia.svg)](https://pypi.org/project/theodosia/)
41
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
42
+ [![Docs](https://img.shields.io/badge/docs-msradam.github.io%2Ftheodosia-31748f.svg)](https://msradam.github.io/theodosia/)
43
+ [![Built on Apache Burr](https://img.shields.io/badge/built%20on-Apache%20Burr-31748f.svg)](https://github.com/apache/burr)
44
+ [![Built on FastMCP](https://img.shields.io/badge/built%20on-FastMCP-c4a7e7.svg)](https://github.com/jlowin/fastmcp)
45
+
46
+ Theodosia gives an AI agent a stateful, auditable workflow it cannot step outside of. You define the workflow as a [Burr](https://burr.dagworks.io/) state machine; Theodosia serves it over [MCP](https://modelcontextprotocol.io/) so the agent advances it one transition at a time.
47
+
48
+ Each Burr `@action` is reachable through one `step(action, inputs)` MCP tool. State lives on the server. The server enforces transitions: if the agent calls an action that isn't reachable from the current state, the response is a structured refusal listing the actions that are reachable. Every step is recorded to a replayable trace.
49
+
50
+ ![demo](demos/demo.gif)
51
+
52
+ ```python
53
+ from theodosia import mount
54
+
55
+ server = mount(application)
56
+ server.run()
57
+ ```
58
+
59
+ Full documentation: [msradam.github.io/theodosia](https://msradam.github.io/theodosia/).
60
+
61
+ ## Install
62
+
63
+ ```bash
64
+ uv pip install theodosia # or: pip install theodosia
65
+ ```
66
+
67
+ From source:
68
+
69
+ ```bash
70
+ git clone git@github.com:msradam/theodosia.git
71
+ cd theodosia
72
+ uv sync
73
+ ```
74
+
75
+ Python 3.11 through 3.13. Optional extras: `theodosia[observability]` (OpenTelemetry), `theodosia[ui]` (Burr web UI), `theodosia[all]`.
76
+
77
+ ## Quickstart
78
+
79
+ Build a Burr graph, mount it, point an agent at it.
80
+
81
+ ```python
82
+ from burr.core import action, ApplicationBuilder, State
83
+ from theodosia import mount, ServingMode
84
+
85
+ @action(reads=[], writes=["stage", "item", "qty"])
86
+ def take_order(state: State, item: str, qty: int = 1) -> State:
87
+ """Place a new coffee order."""
88
+ return state.update(stage="ordered", item=item, qty=qty)
89
+
90
+ @action(reads=["stage"], writes=["stage", "paid_amount"])
91
+ def pay(state: State, amount: float) -> State:
92
+ """Pay for the placed order."""
93
+ return state.update(stage="paid", paid_amount=amount)
94
+
95
+ @action(reads=["stage"], writes=["stage"])
96
+ def fulfill(state: State) -> State:
97
+ """Mark the order fulfilled. Terminal."""
98
+ return state.update(stage="fulfilled")
99
+
100
+ app = (
101
+ ApplicationBuilder()
102
+ .with_actions(take_order=take_order, pay=pay, fulfill=fulfill)
103
+ .with_transitions(("take_order", "pay"), ("pay", "fulfill"))
104
+ .with_state(stage="new")
105
+ .with_entrypoint("take_order")
106
+ .build()
107
+ )
108
+
109
+ mount(app, mode=ServingMode.STEP, name="coffee").run()
110
+ ```
111
+
112
+ A client that calls `pay` before `take_order` gets a structured refusal:
113
+
114
+ ```json
115
+ {
116
+ "error": "invalid_transition",
117
+ "valid_next_actions": ["take_order"],
118
+ "message": "action 'pay' is not reachable from current state. Valid actions now: ['take_order']."
119
+ }
120
+ ```
121
+
122
+ The list of valid actions rides on the response, so a client without its own model of the graph recovers from a single error. The shipped `examples/coffee_order.py` extends this with an `add_modifier` loop and a `cancel` escape, demonstrating loop, branch, and escape on top of the linear path.
123
+
124
+ ## Why this shape
125
+
126
+ The four-tool surface (`step`, `reset_session`, `fork_at`, `fork_from_past`) is constant regardless of FSM complexity. The agent reads the action namespace from `theodosia://graph`, calls `step(action=X)`, and the server refuses anything not reachable from the current state. The reachable action set is the graph, enforced at the protocol layer rather than asked of the model. Run `theodosia render <target>` to print that graph in the terminal, or `--mermaid` for a diagram. See [Architecture](https://msradam.github.io/theodosia/architecture/).
127
+
128
+ The integration boundary is Burr's `Application`: anything `ApplicationBuilder` supports (parallelism, persistence, typed state, hooks, telemetry, sub-applications) passes through `mount()` without adapter changes. See [What works through mount()](https://msradam.github.io/theodosia/compatibility/).
129
+
130
+ ## Observability
131
+
132
+ Add a tracker to the builder and every step is recorded to JSONL and replayable in the Burr UI:
133
+
134
+ ```python
135
+ from burr.tracking.client import LocalTrackingClient
136
+
137
+ app = ApplicationBuilder().with_tracker(LocalTrackingClient(project="coffee-demo")) # ...
138
+ ```
139
+
140
+ ![sessions](demos/observability.gif)
141
+
142
+ The agent reads its own audit trail through `theodosia://` resources (`graph`, `state`, `next`, `history`, `trace`, `session`, `subruns`). From the terminal, the CLI reads the same tracker store:
143
+
144
+ ```bash
145
+ theodosia sessions ls # recent sessions
146
+ theodosia sessions show <app-id> # full timeline: per-step state diff + timing
147
+ theodosia watch [app-id] # live-tail a running session
148
+ theodosia logs --refusals --plain # only steps that errored, pipe-friendly
149
+ ```
150
+
151
+ ![watch](demos/watch.gif)
152
+
153
+ Full surface (resources, CLI, UI, OpenTelemetry): [Observability](https://msradam.github.io/theodosia/observability/).
154
+
155
+ ## Driving other MCP servers
156
+
157
+ A Burr action can call tools on *other* MCP servers through Theodosia. Pass `mount(application, upstream={...})` a map of server name to a `fastmcp.Client` transport; inside an action body, `call_upstream(server, tool, args)` forwards to it.
158
+
159
+ ```python
160
+ from theodosia import call_upstream, mount
161
+
162
+ @action(reads=[], writes=["pods"])
163
+ async def survey(state):
164
+ pods = await call_upstream("k8s", "list_pods", {"namespace": "prod"})
165
+ return state.update(pods=pods)
166
+
167
+ server = mount(build_application, upstream={"k8s": {"command": "npx", "args": ["-y", "kubernetes-mcp-server"]}})
168
+ ```
169
+
170
+ The agent connects to one server (this one) and sees one tool (`step`). The upstream servers are reached from inside actions, so every upstream call advances state. See [Driving other MCP servers](https://msradam.github.io/theodosia/upstream/).
171
+
172
+ ## Shipping your own command
173
+
174
+ A package that ships an MCP graph can expose its own command with `build_cli`, baking in the graph so `serve` needs no target:
175
+
176
+ ```python
177
+ # my_fsm_mcp/cli.py
178
+ from theodosia.cli import build_cli, run
179
+ from my_fsm_mcp import build_application
180
+
181
+ cli = build_cli("my-fsm-mcp", application=build_application, help="My graph as an MCP server.")
182
+
183
+ def main() -> int:
184
+ return run(cli)
185
+ ```
186
+
187
+ Then `my-fsm-mcp serve`, `my-fsm-mcp doctor`, and `my-fsm-mcp sessions ls` all carry your name. See [CLI](https://msradam.github.io/theodosia/cli/).
188
+
189
+ ## Examples
190
+
191
+ `examples/` ships self-contained FSMs, each runnable as `uv run python examples/<file>.py` and wireable into a client via the shipped `examples/*.example.json` configs.
192
+
193
+ - **Pure FSM**: `coffee_order`, `triage`, `adventure`, `chargen`, `incident_response`, `local_shell`, `ml_training`, `subgraphs`.
194
+ - **Typed state, hooks, persistence**: `typed_state_loan`, `pydantic_actions`, `pipeline_hooks`, `async_hooks`, `streaming_hooks`, `sqlite_persister`, `async_persister`, `state_forking`.
195
+ - **Shellout / real tooling**: `unix_health`, `codebase_security`, `git_review`.
196
+ - **LLM-in-the-graph (local model runtime)**: `granite_oncall`, `adaptive_crag`, `granite_guardian`, `mellea_qiskit_migration`.
197
+ - **Caller-LLM / user-in-the-loop**: `caller_sample`, `elicit_confirm`.
198
+ - **Observability**: `with_otel`, `custom_telemetry`, `trace_decorator`, `full_logger`, `with_middleware`.
199
+ - **SKILL-to-FSM**: `security_audit`, `differential_review`, `fp_check`, `webapp_testing`.
200
+ - **Upstream**: `upstream_filesystem` drives the official filesystem MCP server.
201
+ - **Composition**: `multi_graph` serves two graphs from one server via `mount_multi` (namespaced tools + `theodosia://<app>/graph`).
202
+
203
+ Some demos need a runtime (Ollama with a Granite model; `bandit` / `detect-secrets` on PATH; a git repo). Each refuses at action time with a clear message when its runtime is missing.
204
+
205
+ ## Validate before mounting
206
+
207
+ ```bash
208
+ theodosia doctor module:attr # static validation
209
+ theodosia doctor module:attr --runtime # also probe the mounted wire shape
210
+ ```
211
+
212
+ `doctor` exits nonzero on failures, so it slots into CI. Importable too: `from theodosia.doctor import run_checks`.
213
+
214
+ ## Tests
215
+
216
+ ```bash
217
+ uv run pytest
218
+ ```
219
+
220
+ Six hundred and thirty-one tests, most in-process via FastMCP's in-memory client. `tests/smoke/` holds opt-in real-Claude tests (deselected by default).
221
+
222
+ ## Acknowledgements
223
+
224
+ Theodosia is glue between two libraries that do the hard parts:
225
+
226
+ - [Apache Burr](https://github.com/apache/burr) provides the state-machine `Application`, the transition graph, and the `LocalTrackingClient` / Burr UI replay.
227
+ - [FastMCP](https://github.com/jlowin/fastmcp) provides the MCP server, the resource and tool transforms, and the client used by the `upstream` feature.
228
+
229
+ The SKILL demos under `examples/skills/` are reproduced verbatim from Anthropic and Trail of Bits with attribution in each file.
230
+
231
+ Theodosia is an independent project. It is not affiliated with, endorsed by, or sponsored by the Apache Software Foundation, DAGWorks, the Apache Burr project, or the FastMCP project. "Apache Burr" and "FastMCP" are the property of their respective owners and are referenced here only to describe what Theodosia builds on.
232
+
233
+ ## License
234
+
235
+ Apache 2.0.
236
+
237
+ ## Notice
238
+
239
+ Theodosia is independent open-source work by Adam Munawar Rahman and does not represent the views, positions, or technology roadmap of IBM Corporation or any other employer. See [NOTICE.md](NOTICE.md).