letitloop 0.7.0__tar.gz → 0.7.3__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 (141) hide show
  1. {letitloop-0.7.0 → letitloop-0.7.3}/.github/workflows/ci.yml +4 -4
  2. {letitloop-0.7.0 → letitloop-0.7.3}/.github/workflows/pr-health-guard.yml +1 -1
  3. {letitloop-0.7.0 → letitloop-0.7.3}/.github/workflows/release-drafter.yml +1 -1
  4. {letitloop-0.7.0 → letitloop-0.7.3}/.github/workflows/release-pypi.yml +2 -2
  5. {letitloop-0.7.0 → letitloop-0.7.3}/.github/workflows/scorecard.yml +1 -1
  6. {letitloop-0.7.0 → letitloop-0.7.3}/CHANGELOG.md +44 -0
  7. letitloop-0.7.3/PKG-INFO +251 -0
  8. letitloop-0.7.3/README.md +208 -0
  9. letitloop-0.7.3/docs/ARCHITECTURE_AND_TRADE_OFFS.md +45 -0
  10. letitloop-0.7.3/docs/adr/README.md +4 -0
  11. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/__init__.py +1 -1
  12. letitloop-0.7.3/letitloop/adapters/__init__.py +71 -0
  13. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/adapters/autogen.py +6 -13
  14. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/adapters/crewai.py +6 -8
  15. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/adapters/fastapi.py +3 -7
  16. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/adapters/langgraph.py +26 -37
  17. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/adapters/smolagents.py +17 -11
  18. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/atomic_wal_adapter.py +1 -1
  19. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/in_memory_adapter.py +1 -1
  20. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/snapshot_graph_adapter.py +1 -1
  21. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/harness/runner.py +11 -9
  22. letitloop-0.7.3/letitloop.egg-info/PKG-INFO +251 -0
  23. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop.egg-info/SOURCES.txt +6 -31
  24. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop.egg-info/requires.txt +4 -0
  25. letitloop-0.7.3/letitloop.egg-info/top_level.txt +2 -0
  26. {letitloop-0.7.0 → letitloop-0.7.3}/orchestrator/__init__.py +13 -1
  27. {letitloop-0.7.0 → letitloop-0.7.3}/orchestrator/cli.py +17 -19
  28. letitloop-0.7.3/orchestrator/codecs.py +210 -0
  29. {letitloop-0.7.0 → letitloop-0.7.3}/orchestrator/decorators.py +157 -79
  30. {letitloop-0.7.0 → letitloop-0.7.3}/orchestrator/lock.py +52 -22
  31. {letitloop-0.7.0 → letitloop-0.7.3}/orchestrator/state.py +80 -12
  32. {letitloop-0.7.0 → letitloop-0.7.3}/orchestrator/supervisor/liveness.py +37 -11
  33. {letitloop-0.7.0 → letitloop-0.7.3}/pyproject.toml +7 -3
  34. {letitloop-0.7.0 → letitloop-0.7.3}/requirements-ci.txt +2 -2
  35. {letitloop-0.7.0 → letitloop-0.7.3}/tests/adapters/test_adapters_init.py +14 -0
  36. {letitloop-0.7.0 → letitloop-0.7.3}/tests/adapters/test_langgraph.py +8 -2
  37. {letitloop-0.7.0 → letitloop-0.7.3}/tests/adapters/test_smolagents.py +21 -0
  38. letitloop-0.7.3/tests/test_atomic_marker_concurrency.py +142 -0
  39. letitloop-0.7.3/tests/test_codecs.py +234 -0
  40. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_durable_async.py +35 -0
  41. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_durable_decorator.py +82 -0
  42. letitloop-0.7.3/tests/test_interactive_demo.py +146 -0
  43. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_lock.py +46 -0
  44. letitloop-0.7.3/tests/test_playwright_scraper_cookbook.py +138 -0
  45. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_state.py +78 -0
  46. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_supervise.py +51 -0
  47. letitloop-0.7.0/.github/workflows/all-contributors.yml +0 -23
  48. letitloop-0.7.0/.github/workflows/issue-claim.yml +0 -123
  49. letitloop-0.7.0/.github/workflows/stale.yml +0 -29
  50. letitloop-0.7.0/PKG-INFO +0 -306
  51. letitloop-0.7.0/README.md +0 -266
  52. letitloop-0.7.0/conformance/adapters/atomic_wal_adapter.py +0 -101
  53. letitloop-0.7.0/conformance/adapters/autogen_adapter.py +0 -32
  54. letitloop-0.7.0/conformance/adapters/base.py +0 -22
  55. letitloop-0.7.0/conformance/adapters/crewai_adapter.py +0 -31
  56. letitloop-0.7.0/conformance/adapters/in_memory_adapter.py +0 -82
  57. letitloop-0.7.0/conformance/adapters/langgraph_adapter.py +0 -43
  58. letitloop-0.7.0/conformance/adapters/letitloop_adapter.py +0 -9
  59. letitloop-0.7.0/conformance/adapters/raw_python_adapter.py +0 -30
  60. letitloop-0.7.0/conformance/adapters/snapshot_graph_adapter.py +0 -98
  61. letitloop-0.7.0/conformance/adapters/unmanaged_script_adapter.py +0 -80
  62. letitloop-0.7.0/conformance/harness/injector.py +0 -90
  63. letitloop-0.7.0/conformance/harness/runner.py +0 -286
  64. letitloop-0.7.0/conformance/harness/schema.py +0 -31
  65. letitloop-0.7.0/conformance/harness/synthetic_engine.py +0 -88
  66. letitloop-0.7.0/docs/MCP_GUIDE.md +0 -179
  67. letitloop-0.7.0/docs/MCP_SETUP.md +0 -78
  68. letitloop-0.7.0/docs/SKILL_GUIDE.md +0 -81
  69. letitloop-0.7.0/docs/V033_SCORECARD.md +0 -184
  70. letitloop-0.7.0/docs/adr/0002-deterministic-verifiers.md +0 -41
  71. letitloop-0.7.0/docs/adr/0003-headless-cli-adapters.md +0 -45
  72. letitloop-0.7.0/docs/adr/0004-format-aware-acceptance-checks.md +0 -27
  73. letitloop-0.7.0/docs/adr/README.md +0 -21
  74. letitloop-0.7.0/docs/auto_healing.md +0 -92
  75. letitloop-0.7.0/letitloop/adapters/__init__.py +0 -50
  76. letitloop-0.7.0/letitloop/conformance/__init__.py +0 -1
  77. letitloop-0.7.0/letitloop/conformance/harness/__init__.py +0 -5
  78. letitloop-0.7.0/letitloop/conformance/scenarios/__init__.py +0 -40
  79. letitloop-0.7.0/letitloop/mcp/__init__.py +0 -33
  80. letitloop-0.7.0/letitloop/mcp/__main__.py +0 -6
  81. letitloop-0.7.0/letitloop-action/scripts/verify_ast.py +0 -140
  82. letitloop-0.7.0/letitloop.egg-info/PKG-INFO +0 -306
  83. letitloop-0.7.0/letitloop.egg-info/top_level.txt +0 -4
  84. {letitloop-0.7.0 → letitloop-0.7.3}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  85. {letitloop-0.7.0 → letitloop-0.7.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  86. {letitloop-0.7.0 → letitloop-0.7.3}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  87. {letitloop-0.7.0 → letitloop-0.7.3}/.github/dependabot.yml +0 -0
  88. {letitloop-0.7.0 → letitloop-0.7.3}/.github/release-drafter.config.yml +0 -0
  89. {letitloop-0.7.0 → letitloop-0.7.3}/.github/release-drafter.yml +0 -0
  90. {letitloop-0.7.0 → letitloop-0.7.3}/.github/workflows/codeql.yml +0 -0
  91. {letitloop-0.7.0 → letitloop-0.7.3}/.github/workflows/dependency-review.yml +0 -0
  92. {letitloop-0.7.0 → letitloop-0.7.3}/.github/workflows/pages.yml +0 -0
  93. {letitloop-0.7.0 → letitloop-0.7.3}/LICENSE +0 -0
  94. {letitloop-0.7.0 → letitloop-0.7.3}/MANIFEST.in +0 -0
  95. {letitloop-0.7.0 → letitloop-0.7.3}/docs/adapters.md +0 -0
  96. {letitloop-0.7.0 → letitloop-0.7.3}/docs/adr/0001-write-ahead-logging.md +0 -0
  97. {letitloop-0.7.0 → letitloop-0.7.3}/docs/adr/template.md +0 -0
  98. {letitloop-0.7.0 → letitloop-0.7.3}/docs/state_machine.md +0 -0
  99. {letitloop-0.7.0 → letitloop-0.7.3/letitloop}/conformance/__init__.py +0 -0
  100. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/__init__.py +0 -0
  101. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/_durable_mixin.py +0 -0
  102. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/autogen_adapter.py +0 -0
  103. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/base.py +0 -0
  104. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/crewai_adapter.py +0 -0
  105. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/json_checkpoint_adapter.py +0 -0
  106. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/langgraph_adapter.py +0 -0
  107. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/letitloop_adapter.py +0 -0
  108. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/llamaindex_adapter.py +0 -0
  109. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/raw_python_adapter.py +0 -0
  110. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/sqlite_wal_adapter.py +0 -0
  111. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/swarm_adapter.py +0 -0
  112. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/adapters/unmanaged_script_adapter.py +0 -0
  113. {letitloop-0.7.0 → letitloop-0.7.3/letitloop}/conformance/harness/__init__.py +0 -0
  114. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/harness/injector.py +0 -0
  115. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/harness/schema.py +0 -0
  116. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/harness/synthetic_engine.py +0 -0
  117. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop/conformance/reporter.py +0 -0
  118. {letitloop-0.7.0 → letitloop-0.7.3/letitloop}/conformance/scenarios/__init__.py +0 -0
  119. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop.egg-info/dependency_links.txt +0 -0
  120. {letitloop-0.7.0 → letitloop-0.7.3}/letitloop.egg-info/entry_points.txt +0 -0
  121. {letitloop-0.7.0 → letitloop-0.7.3}/orchestrator/exceptions.py +0 -0
  122. {letitloop-0.7.0 → letitloop-0.7.3}/orchestrator/process_guard.py +0 -0
  123. {letitloop-0.7.0 → letitloop-0.7.3}/orchestrator/supervisor/__init__.py +0 -0
  124. {letitloop-0.7.0 → letitloop-0.7.3}/orchestrator/token_gate.py +0 -0
  125. {letitloop-0.7.0 → letitloop-0.7.3}/pytest.ini +0 -0
  126. {letitloop-0.7.0 → letitloop-0.7.3}/setup.cfg +0 -0
  127. {letitloop-0.7.0 → letitloop-0.7.3}/tests/__init__.py +0 -0
  128. {letitloop-0.7.0 → letitloop-0.7.3}/tests/adapters/__init__.py +0 -0
  129. {letitloop-0.7.0 → letitloop-0.7.3}/tests/adapters/test_autogen.py +0 -0
  130. {letitloop-0.7.0 → letitloop-0.7.3}/tests/adapters/test_crewai.py +0 -0
  131. {letitloop-0.7.0 → letitloop-0.7.3}/tests/adapters/test_fastapi.py +0 -0
  132. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_browser_use_cookbook.py +0 -0
  133. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_cli_watch.py +0 -0
  134. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_conformance_benchmark.py +0 -0
  135. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_cookbooks.py +0 -0
  136. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_fuzz_wal_corruptions.py +0 -0
  137. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_process_guard.py +0 -0
  138. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_step_failclosed.py +0 -0
  139. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_token_gate.py +0 -0
  140. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_wal_corruption_recovery.py +0 -0
  141. {letitloop-0.7.0 → letitloop-0.7.3}/tests/test_wal_v2_checksums.py +0 -0
@@ -28,7 +28,7 @@ jobs:
28
28
  - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29
29
 
30
30
  - name: Set up Python ${{ matrix.python-version }}
31
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
31
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
32
32
  with:
33
33
  python-version: ${{ matrix.python-version }}
34
34
  cache: 'pip'
@@ -66,7 +66,7 @@ jobs:
66
66
  - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
67
67
 
68
68
  - name: Set up Python 3.11
69
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
69
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
70
70
  with:
71
71
  python-version: '3.11'
72
72
  cache: 'pip'
@@ -88,7 +88,7 @@ jobs:
88
88
  - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
89
89
 
90
90
  - name: Set up Python 3.11
91
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
91
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
92
92
  with:
93
93
  python-version: '3.11'
94
94
  cache: 'pip'
@@ -110,7 +110,7 @@ jobs:
110
110
  - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
111
111
 
112
112
  - name: Set up Python 3.11
113
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
113
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
114
114
  with:
115
115
  python-version: '3.11'
116
116
  cache: 'pip'
@@ -13,7 +13,7 @@ jobs:
13
13
  runs-on: ubuntu-latest
14
14
  steps:
15
15
  - name: Inspect PR Health
16
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
16
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
17
17
  with:
18
18
  github-token: ${{ secrets.GITHUB_TOKEN }}
19
19
  script: |
@@ -15,7 +15,7 @@ jobs:
15
15
  update_release_draft:
16
16
  runs-on: ubuntu-latest
17
17
  steps:
18
- - uses: release-drafter/release-drafter@v6
18
+ - uses: release-drafter/release-drafter@v7
19
19
  with:
20
20
  config-name: release-drafter.yml
21
21
  env:
@@ -1,4 +1,4 @@
1
- name: Publish Python Distribution to PyPI
1
+ name: Publish Python Distribution to PyPI
2
2
 
3
3
  on:
4
4
  release:
@@ -19,7 +19,7 @@ jobs:
19
19
  steps:
20
20
  - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21
21
  - name: Set up Python
22
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
22
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
23
23
  with:
24
24
  python-version: '3.11'
25
25
  - name: Install build dependencies
@@ -27,7 +27,7 @@ jobs:
27
27
  persist-credentials: false
28
28
 
29
29
  - name: "Run analysis"
30
- uses: ossf/scorecard-action@v2.4.1
30
+ uses: ossf/scorecard-action@v2.6.0
31
31
  with:
32
32
  results_file: results.sarif
33
33
  results_format: sarif
@@ -3,6 +3,50 @@
3
3
  All notable changes to this project are documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [0.7.3] - 2026-11-23
7
+
8
+ ### 🔧 CI Determinism, Metadata Alignment & Workflow Maintenance
9
+ - **Deterministic Async Concurrency Test (`tests/test_durable_async.py`)**: Replaced the wall-clock `< 0.35s` timing assertion in `test_async_steps_gather_runs_truly_concurrently` with a deterministic 3-task `asyncio.Event` entry barrier (`max_in_flight == 3`), eliminating false CI flakes caused by Windows NTFS `fsync()` jitter.
10
+ - **Package & CLI Description Alignment (`pyproject.toml`, `orchestrator/cli.py`)**: Aligned PyPI package summary and CLI help text to the single-process local `LILWAL02` WAL & process supervisor contract.
11
+ - **CI Dependency & Action Upgrades**: Updated `actions/setup-python` (`v7.1.0`), `actions/github-script` (`v9.0.0`), `release-drafter` (`v7`), `ossf/scorecard-action` (`v2.6.0`), `coverage` (`>=7.17.3`), and `pytest-benchmark` (`>=5.3.1`).
12
+
13
+ ---
14
+
15
+ ## [0.7.2] - 2026-11-23
16
+
17
+ ### 🔒 Kernel Correctness Fixes, Async Parallelism & Protocol Hardening
18
+ - **True `asyncio.gather()` Concurrency (`orchestrator/decorators.py`)**: Scoped `DurableAsyncContext._lock` strictly to WAL commit and cache mutation rather than holding the lock across `await async_fn(...)`, allowing parallel `async_step()` calls in `asyncio.gather()` to execute concurrently.
19
+ - **WAL Key Deletion Replay Fix (`orchestrator/state.py`)**: Fixed `_apply_event` sentinel comparison (`v == _DELETE_SENTINEL` instead of object identity `is`), preventing deleted state keys from resurrecting after JSON deserialization on WAL replay.
20
+ - **$O(1)$ In-Memory Delta Rollback (`orchestrator/state.py`)**: Eliminated per-step `copy.deepcopy(self.data)` and `copy.deepcopy(self.events)` on `DATA_PATCH` events, preserving $O(1)$ per-step memory and CPU overhead for multi-hundred-step pipelines.
21
+ - **Nested `@durable` Context Preservation (`orchestrator/decorators.py`)**: Restores prior active thread-local context on exit instead of unconditionally resetting to `None`.
22
+ - **Live Process Lock Preservation (`orchestrator/lock.py`)**: Prevents `_lock_is_stale` and `FileLock._lock_file_is_stale` from stealing locks held by a demonstrably live local process with a matching OS process start token after 300 seconds.
23
+ - **Orphaned `.pending.<pid>` Reclamation & NTFS Retry (`orchestrator/decorators.py`)**: `atomic_marker` now sweeps orphaned `.pending.<dead_pid>` files left by `SIGKILL` crashes and applies a 6-attempt exponential backoff around `os.replace` on Windows NTFS.
24
+ - **Recursive Custom Codec Hydration (`orchestrator/codecs.py`)**: Custom codecs registered via `register_codec()` now recursively encode and hydrate nested built-in types (`datetime`, `uuid.UUID`, `pathlib.Path`, `tuple`) with full cycle detection.
25
+ - **Adapter Hardening & Lazy Spec Detection (`letitloop/adapters/*`)**:
26
+ - Replaced eager package imports in `get_available_adapters()` with `importlib.util.find_spec()`, reducing availability detection overhead from ~40s to <1ms.
27
+ - Updated `LetItLoopCheckpointSaver` (`langgraph.py`) to use `DurableCodecRegistry` instead of `pickle`, yield an async iterator from `alist()`, support `task_path` in `put_writes()`/`aput_writes()`, and preserve `parent_checkpoint_id=None` on root checkpoints.
28
+ - Updated `SmolagentsWALCallback.wrap_agent()` (`smolagents.py`) to register with `smolagents 1.26+` `CallbackRegistry` objects without overwriting them with a raw list.
29
+ - Added `LILWAL02` CRC32 frame verification to `lil inspect` (`orchestrator/cli.py`).
30
+ - **Bounded SHA-256 Markers (`SEC-PROTO-01` & `SEC-PROTO-02`)**: Replaced regex identifier sanitization with canonical SHA-256 digest filenames (`m-{sha256[:32]}`). Eliminates identifier collisions (`stripe/charge` vs `stripe_charge`), path traversal attempts (`../../`), and Windows NTFS `MAX_PATH` (>260 char) crashes.
31
+ - **Strict Directory Jailing**: Legacy marker compatibility lookups now strictly verify containment within `markers_dir` via `os.path.commonpath`, preventing path hijacking.
32
+ - **Split-Brain Elimination in `FileLock.release()` (`SEC-PROTO-03`)**: Added CAS-style lock ownership token (`process_start_token` + PID) verification before unlinking lock files. Prevents stolen or replaced locks from being blindly deleted by slow contender processes.
33
+ - **Codec Recursion & Cycle Protection**: Added in-flight visited object cycle detection and maximum recursion depth (256) guards to `DurableCodecRegistry.encode()`, failing closed with `DurableCodecError` instead of leaking raw unhandled `RecursionError`.
34
+ - **Safe Hydration Exception Handling**: Wrapped tagged payload hydration in `DurableCodecRegistry.decode()` to catch malformed payload data (invalid tuple iterables, malformed datetime/uuid strings) and fail closed with `DurableCodecError`.
35
+ - **Timestamp Sanity & Replay Preservation**: Added ISO-8601 parsing validation and clock-drift bounds on live appends, while maintaining clean backward compatibility for offline replay of historical WAL files.
36
+ - **Durability Contract Boundary Transparency**: Formally clarified in documentation that `atomic_marker` guarantees serialized execution and durable local completion records; recommended upstream `Idempotency-Key` headers for remote non-idempotent HTTP API side-effects.
37
+
38
+ ---
39
+
40
+ ## [0.7.1] - 2026-10-12
41
+
42
+ ### 🛡️ Concurrency Mutex, O(N) WAL Compaction & Type Preservation
43
+ - **2-Tier `atomic_marker` Mutex**: Upgraded atomic step markers with process-local `threading.Lock` and cross-process `FileLock` mutual exclusion, moving `.committed` checks inside the acquired lock and publishing markers via atomic tempfile `os.replace` (`os.fsync` + atomic rename) to eliminate multi-process and multi-thread race conditions.
44
+ - **Elimination of $O(N^2)$ Write Amplification**: Replaced full-dictionary serialization in `step()` and `async_step()` with discrete subkey delta patching under `step_outputs`. Compresses WAL size by 168x (from 83.2 MB down to 378 KB for 1,000 steps) and accelerates replay recovery by 17.6x (down to 72.39 $\mu$s/step).
45
+ - **Safe Type Preservation (`DurableCodecRegistry`)**: Introduced safe, extensible codec registry for standard Python objects (`datetime`, `uuid.UUID`, `pathlib.Path`, `tuple`, dataclasses, and Pydantic models). Enforces zero dynamic import execution and fails closed with `DurableSerializationError` on unhandled types.
46
+ - **Conformance Transparency (DCP-2.0)**: Added explicit `adapter_kind` (`native_kernel` vs `simulated_archetype`) and `framework_executed` flags to DCP-2.0 conformance receipts to distinguish native micro-kernel executions from simulated baseline archetypes.
47
+
48
+ ---
49
+
6
50
  ## [0.7.0] - 2026-10-07
7
51
 
8
52
  ### ⚡ The SQLite of Durable Execution (Micro-Kernel Architecture)
@@ -0,0 +1,251 @@
1
+ Metadata-Version: 2.4
2
+ Name: letitloop
3
+ Version: 0.7.3
4
+ Summary: Single-process local Write-Ahead Log (LILWAL02) and process supervisor for Python scripts.
5
+ Author-email: sdageltc <sdageltc@users.noreply.github.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://sdageltc.github.io/letitloop/
8
+ Project-URL: Documentation, https://github.com/sdageltc/letitloop#readme
9
+ Project-URL: Repository, https://github.com/sdageltc/letitloop
10
+ Project-URL: Bug Tracker, https://github.com/sdageltc/letitloop/issues
11
+ Project-URL: Discussions, https://github.com/sdageltc/letitloop/discussions
12
+ Keywords: durable-execution,wal,crash-resilience,agentic-ai,supervisor,langgraph,browser-use,pydantic-ai,dspy,zero-daemon
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Topic :: Software Development :: Testing
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Requires-Python: >=3.11
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: psutil>=5.9.0
28
+ Provides-Extra: adapters
29
+ Requires-Dist: fastapi>=0.100.0; extra == "adapters"
30
+ Requires-Dist: langgraph<2,>=1.2; extra == "adapters"
31
+ Provides-Extra: financial-agent
32
+ Requires-Dist: langgraph<2,>=1.2; extra == "financial-agent"
33
+ Requires-Dist: yfinance>=0.2.40; extra == "financial-agent"
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.0; extra == "dev"
36
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
37
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
38
+ Requires-Dist: pytest-xdist>=3.0; extra == "dev"
39
+ Requires-Dist: hypothesis>=6.100.0; extra == "dev"
40
+ Requires-Dist: langgraph<2,>=1.2; extra == "dev"
41
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
42
+ Dynamic: license-file
43
+
44
+ <p align="center">
45
+ <img src="assets/logo.png" alt="let it loop (LIL)" width="320" style="border-radius: 20px;">
46
+ </p>
47
+
48
+ <div align="center">
49
+
50
+ # let it loop (LIL)
51
+
52
+ **Single-Process Local Write-Ahead Log (`LILWAL02`) & Process Supervisor for Python Scripts (`v0.7.3`)**
53
+
54
+ [![Official Website](https://img.shields.io/badge/Website-LetItLoop-0284c7?logo=googlechrome&logoColor=white)](https://sdageltc.github.io/letitloop/)
55
+ [![PyPI version](https://img.shields.io/pypi/v/letitloop.svg?color=blue)](https://pypi.org/project/letitloop/)
56
+ [![CI Matrix](https://github.com/sdageltc/letitloop/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/sdageltc/letitloop/actions/workflows/ci.yml)
57
+ [![GitHub Action v2](https://img.shields.io/badge/Action-LetItLoop_v2-blue?logo=github)](https://github.com/sdageltc/letitloop-action)
58
+ [![Benchmark](https://img.shields.io/badge/Harness-DCP--2.0-blue)](https://sdageltc.github.io/agent-durability-bench/)
59
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%20%7C%203.12-blue.svg)](https://www.python.org/downloads/)
60
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
61
+
62
+ **[Official Website](https://sdageltc.github.io/letitloop/)** • **[Architecture & Trade-Offs](docs/ARCHITECTURE_AND_TRADE_OFFS.md)** • **[DCP-2.0 Simulation Harness](https://sdageltc.github.io/agent-durability-bench/)** • **[PyPI Package](https://pypi.org/project/letitloop/)**
63
+
64
+ </div>
65
+
66
+ ---
67
+
68
+ > **Status & Scope**: `letitloop` is a single-maintainer, single-writer local filesystem Write-Ahead Log (`LILWAL02`) and process supervisor (`lil watch` / `@supervise`) for Python functions, scrapers, and batch scripts. It requires only `psutil>=5.9.0` and stores state in human-readable, CRC32-framed JSONL files.
69
+
70
+ ---
71
+
72
+ <p align="center">
73
+ <img src="docs/assets/crash_recovery_demo.gif" alt="LetItLoop Process Crash & WAL Recovery Demo" width="100%">
74
+ </p>
75
+
76
+ ## ⚡ Quickstart
77
+
78
+ ```python
79
+ from letitloop import atomic_marker, durable, step
80
+
81
+
82
+ @durable(goal_id="customer_sync", wal_dir=".durable_wal")
83
+ def sync_workflow():
84
+ # If this process crashes or receives SIGKILL midway,
85
+ # completed steps are skipped from the local WAL on restart.
86
+ user = step("fetch_user", fetch_crm_record, user_id=123)
87
+ summary = step("summarize", call_llm_model, user)
88
+
89
+ # Guard local side effects with a 2-phase file marker
90
+ with atomic_marker("slack_notification") as should_execute:
91
+ if should_execute:
92
+ step("notify", send_slack, summary)
93
+
94
+ return summary
95
+
96
+
97
+ if __name__ == "__main__":
98
+ sync_workflow()
99
+ ```
100
+
101
+ ```bash
102
+ pip install letitloop
103
+ ```
104
+
105
+ For asynchronous pipelines, use `@durable_async` and `await async_step(...)` with `ContextVar` isolation across `asyncio.gather()`.
106
+
107
+ ### Interactive Crash-Recovery Visualizer
108
+
109
+ Run the local Streamlit visualizer (uses deterministic local steps, zero external API calls):
110
+
111
+ ```bash
112
+ python -m pip install -e .
113
+ python -m pip install -r examples/interactive_demo/requirements.txt
114
+ streamlit run examples/interactive_demo/app.py
115
+ ```
116
+
117
+ ---
118
+
119
+ ## 🧭 When to Use LetItLoop (and When Not To)
120
+
121
+ | Workload / Requirement | Recommended Tool | Why |
122
+ |---|---|---|
123
+ | **Single-writer local Python script, scraper, or CLI job** | **LetItLoop (`@durable` + `lil watch`)** | Zero external daemon, human-readable JSONL WAL (`LILWAL02`) with CRC32 + SHA-256 hash chain, and built-in subprocess crash supervision (`lil watch`). |
124
+ | **SQLite / PostgreSQL transactional workflows with durable `sleep` & queues** | **[DBOS (`dbos`)](https://github.com/dbos-inc/dbos-transact-py)** | Runs in-process on SQLite by default with a production PostgreSQL upgrade path and official PydanticAI / OpenAI Agents SDK integrations. |
125
+ | **LangGraph graph or `@entrypoint` / `@task` pipelines** | **[LangGraph `SqliteSaver`](https://pypi.org/project/langgraph-checkpoint-sqlite/)** | Native checkpointer maintained by the LangGraph core team. |
126
+ | **Data engineering DAGs & scheduled flows** | **[Prefect](https://github.com/PrefectHQ/prefect)** | Mature Python `@flow` / `@task` engine with ephemeral local SQLite mode and observability UI. |
127
+ | **Multi-node distributed microservices & multi-day timers** | **[Temporal](https://github.com/temporalio/sdk-python)** or **[Restate](https://github.com/restatedev/sdk-python)** | Dedicated workflow server clusters with distributed event histories and multi-language workers. |
128
+
129
+ See [docs/ARCHITECTURE_AND_TRADE_OFFS.md](docs/ARCHITECTURE_AND_TRADE_OFFS.md) for a detailed architectural analysis and contract boundaries.
130
+
131
+ ---
132
+
133
+ ## 🔄 Process Liveness: Auto-Supervision & CLI Watcher
134
+
135
+ LetItLoop pairs **State Durability** (saving step outputs to disk) with **Process Liveness** (restarting a script after `SIGKILL 137` or an unhandled crash):
136
+
137
+ ### 1. Terminal Watcher (`lil watch`)
138
+ Supervise any Python script with sliding-window rapid-failure circuit breaking and clean signal forwarding:
139
+
140
+ ```bash
141
+ lil watch agent_pipeline.py --max-restarts 10 --backoff 1.0
142
+ ```
143
+
144
+ ### 2. Entrypoint Decorator (`@supervise`)
145
+ ```python
146
+ from letitloop import durable, step, supervise
147
+
148
+
149
+ @supervise(max_restarts=5, backoff=1.0)
150
+ @durable(goal_id="equity_analyst", wal_dir=".equity_wal")
151
+ def run_pipeline():
152
+ user = step("fetch_data", fetch_financials)
153
+ report = step("generate_report", analyze, user)
154
+ return report
155
+
156
+
157
+ if __name__ == "__main__":
158
+ run_pipeline()
159
+ ```
160
+
161
+ ---
162
+
163
+ ## 💎 Core Design Guarantees & Contract Boundaries
164
+
165
+ 1. **CRC32-Framed Append-Only WAL (`LILWAL02`)**:
166
+ Each step delta is framed as `\nLILWAL02:<byte_len_hex>:<crc32_hex>:<canonical_json>\n` and linked via a sequential SHA-256 hash chain (`prev_hash` -> `event_hash`). Torn tail writes from mid-append power loss or `SIGKILL` are truncated back to the last valid frame on replay, while mid-file corruption fails closed with `StateError`.
167
+ 2. **$O(1)$ Delta Patching & Atomic Snapshots**:
168
+ Step outputs append discrete delta patches under `step_outputs` and write periodic atomic snapshots (`state.json` via tempfile + `os.fsync` + 6-attempt Windows NTFS `os.replace` retry + POSIX directory fsync).
169
+ 3. **2-Tier Mutex (`atomic_marker`)**:
170
+ Combines a process-local `threading.Lock` and a cross-process `FileLock` (with PID start-time token verification to prevent PID-reuse lock false positives) and sweeps orphaned `.pending.<dead_pid>` markers on recovery.
171
+ > **External API Boundary**: No local filesystem marker can prevent duplicate execution if `SIGKILL` strikes after an HTTP request leaves the host NIC but before the response is committed to disk. For non-idempotent remote APIs (e.g. Stripe charges), pass an upstream `Idempotency-Key` header derived from `f"{goal_id}:{marker_id}"`.
172
+ 4. **Allowlist-Only Type Hydration (`DurableCodecRegistry`)**:
173
+ Preserves `datetime`, `uuid.UUID`, `pathlib.Path`, `tuple`, and custom types registered via `register_codec()` across initial execution and WAL replay without using `pickle` or dynamic code imports.
174
+
175
+ ---
176
+
177
+ ## 🍳 Runnable Examples & Cookbooks
178
+
179
+ Self-contained examples in [`examples/`](examples/):
180
+
181
+ | Target | Example / Cookbook | Description |
182
+ |---|---|---|
183
+ | **Playwright** | [`examples/cookbooks/playwright_scraper.py`](examples/cookbooks/playwright_scraper.py) | Multi-page scraper with `@durable_async` checkpointing that skips already-scraped pages on resume |
184
+ | **Streamlit UI** | [`examples/interactive_demo/app.py`](examples/interactive_demo/README.md) | Local crash injection and WAL replay visualizer |
185
+ | **Browser-Use** | [`examples/cookbooks/browser_use_durable.py`](examples/cookbooks/browser_use_durable.py) | Release digest workflow with step-level crash recovery |
186
+ | **LangGraph** | [`examples/cookbooks/langgraph_financial_analyst.py`](examples/cookbooks/langgraph_financial_analyst.py) | 4-step financial analyst pipeline with offline and live DeepSeek modes |
187
+ | **DSPy** | [`examples/cookbooks/dspy_durable_optimize.py`](examples/cookbooks/dspy_durable_optimize.py) | Prompt optimizer pipeline with step-level checkpointing |
188
+ | **Pydantic AI** | [`examples/cookbooks/pydantic_ai_durable.py`](examples/cookbooks/pydantic_ai_durable.py) | Type-safe agent workflow wrapped with LetItLoop step persistence |
189
+ | **FastAPI** | [`examples/fastapi_durable_background.py`](examples/fastapi_durable_background.py) | Single-worker durable background task queue backed by local WAL |
190
+ | **CrewAI / LlamaIndex** | [`examples/crewai_durable_tools.py`](examples/crewai_durable_tools.py) • [`examples/llamaindex_durable_workflow.py`](examples/llamaindex_durable_workflow.py) | Tool-call and step wrapper examples |
191
+
192
+ Run the financial analyst cookbook offline without API keys:
193
+
194
+ ```bash
195
+ python -m pip install -e ".[financial-agent]"
196
+ python examples/cookbooks/langgraph_financial_analyst.py --ticker AAPL --offline
197
+ python examples/cookbooks/langgraph_financial_analyst.py --ticker AAPL --offline --demo
198
+ ```
199
+
200
+ ---
201
+
202
+ ## 🛡️ GitHub Action CI Gate (`letitloop-action@v2`)
203
+
204
+ Verify `LILWAL02` frame checksums and Python AST syntax in GitHub Actions:
205
+
206
+ ```yaml
207
+ name: Verify WAL & Python AST
208
+ on: [pull_request]
209
+
210
+ jobs:
211
+ verify:
212
+ runs-on: ubuntu-latest
213
+ steps:
214
+ - uses: actions/checkout@v4
215
+ - uses: sdageltc/letitloop-action@v2
216
+ with:
217
+ token: ${{ secrets.GITHUB_TOKEN }}
218
+ mode: 'gate'
219
+ wal-dir: '.bench_wal'
220
+ workspace: '.'
221
+ ```
222
+
223
+ ---
224
+
225
+ ## 📜 Architecture Documentation
226
+
227
+ - [**Architecture & Trade-Offs**](docs/ARCHITECTURE_AND_TRADE_OFFS.md): Single-writer design contract, failure modes, and comparison with DBOS, LangGraph, and Temporal.
228
+ - [**ADR-0001**](docs/adr/0001-write-ahead-logging.md): Write-Ahead Logging (`LILWAL02`) & Torn-Tail Recovery.
229
+ - [**State Machine Specification**](docs/state_machine.md): Event-sourced state transitions and replay rules.
230
+ - [**Adapter Reference**](docs/adapters.md): Optional adapter shims under `letitloop.adapters`.
231
+
232
+ ---
233
+
234
+ ## 👥 Contributors
235
+
236
+ <table>
237
+ <tbody>
238
+ <tr>
239
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/sdageltc"><img src="https://avatars.githubusercontent.com/u/268154463?v=4" width="100px;" alt="sdageltc"/><br /><sub><b>sdageltc</b></sub></a></td>
240
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/h4syy"><img src="https://avatars.githubusercontent.com/u/59239840?v=4" width="100px;" alt="Yash Paudel"/><br /><sub><b>Yash Paudel</b></sub></a></td>
241
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/wangshen-tech"><img src="https://avatars.githubusercontent.com/u/190895315?v=4" width="100px;" alt="wangshen-tech"/><br /><sub><b>wangshen-tech</b></sub></a></td>
242
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/MagMueller"><img src="https://github.com/MagMueller.png" width="100px;" alt="MagMueller"/><br /><sub><b>MagMueller</b></sub></a></td>
243
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/darkseidpaul"><img src="https://github.com/darkseidpaul.png" width="100px;" alt="darkseidpaul"/><br /><sub><b>darkseidpaul</b></sub></a></td>
244
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/Aaqibhafeezkhan"><img src="https://github.com/Aaqibhafeezkhan.png" width="100px;" alt="Aaqibhafeezkhan"/><br /><sub><b>Aaqibhafeezkhan</b></sub></a></td>
245
+ </tr>
246
+ </tbody>
247
+ </table>
248
+
249
+ ## License
250
+
251
+ Distributed under the MIT License. Copyright (c) 2026 sdageltc. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,208 @@
1
+ <p align="center">
2
+ <img src="assets/logo.png" alt="let it loop (LIL)" width="320" style="border-radius: 20px;">
3
+ </p>
4
+
5
+ <div align="center">
6
+
7
+ # let it loop (LIL)
8
+
9
+ **Single-Process Local Write-Ahead Log (`LILWAL02`) & Process Supervisor for Python Scripts (`v0.7.3`)**
10
+
11
+ [![Official Website](https://img.shields.io/badge/Website-LetItLoop-0284c7?logo=googlechrome&logoColor=white)](https://sdageltc.github.io/letitloop/)
12
+ [![PyPI version](https://img.shields.io/pypi/v/letitloop.svg?color=blue)](https://pypi.org/project/letitloop/)
13
+ [![CI Matrix](https://github.com/sdageltc/letitloop/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/sdageltc/letitloop/actions/workflows/ci.yml)
14
+ [![GitHub Action v2](https://img.shields.io/badge/Action-LetItLoop_v2-blue?logo=github)](https://github.com/sdageltc/letitloop-action)
15
+ [![Benchmark](https://img.shields.io/badge/Harness-DCP--2.0-blue)](https://sdageltc.github.io/agent-durability-bench/)
16
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%20%7C%203.12-blue.svg)](https://www.python.org/downloads/)
17
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
18
+
19
+ **[Official Website](https://sdageltc.github.io/letitloop/)** • **[Architecture & Trade-Offs](docs/ARCHITECTURE_AND_TRADE_OFFS.md)** • **[DCP-2.0 Simulation Harness](https://sdageltc.github.io/agent-durability-bench/)** • **[PyPI Package](https://pypi.org/project/letitloop/)**
20
+
21
+ </div>
22
+
23
+ ---
24
+
25
+ > **Status & Scope**: `letitloop` is a single-maintainer, single-writer local filesystem Write-Ahead Log (`LILWAL02`) and process supervisor (`lil watch` / `@supervise`) for Python functions, scrapers, and batch scripts. It requires only `psutil>=5.9.0` and stores state in human-readable, CRC32-framed JSONL files.
26
+
27
+ ---
28
+
29
+ <p align="center">
30
+ <img src="docs/assets/crash_recovery_demo.gif" alt="LetItLoop Process Crash & WAL Recovery Demo" width="100%">
31
+ </p>
32
+
33
+ ## ⚡ Quickstart
34
+
35
+ ```python
36
+ from letitloop import atomic_marker, durable, step
37
+
38
+
39
+ @durable(goal_id="customer_sync", wal_dir=".durable_wal")
40
+ def sync_workflow():
41
+ # If this process crashes or receives SIGKILL midway,
42
+ # completed steps are skipped from the local WAL on restart.
43
+ user = step("fetch_user", fetch_crm_record, user_id=123)
44
+ summary = step("summarize", call_llm_model, user)
45
+
46
+ # Guard local side effects with a 2-phase file marker
47
+ with atomic_marker("slack_notification") as should_execute:
48
+ if should_execute:
49
+ step("notify", send_slack, summary)
50
+
51
+ return summary
52
+
53
+
54
+ if __name__ == "__main__":
55
+ sync_workflow()
56
+ ```
57
+
58
+ ```bash
59
+ pip install letitloop
60
+ ```
61
+
62
+ For asynchronous pipelines, use `@durable_async` and `await async_step(...)` with `ContextVar` isolation across `asyncio.gather()`.
63
+
64
+ ### Interactive Crash-Recovery Visualizer
65
+
66
+ Run the local Streamlit visualizer (uses deterministic local steps, zero external API calls):
67
+
68
+ ```bash
69
+ python -m pip install -e .
70
+ python -m pip install -r examples/interactive_demo/requirements.txt
71
+ streamlit run examples/interactive_demo/app.py
72
+ ```
73
+
74
+ ---
75
+
76
+ ## 🧭 When to Use LetItLoop (and When Not To)
77
+
78
+ | Workload / Requirement | Recommended Tool | Why |
79
+ |---|---|---|
80
+ | **Single-writer local Python script, scraper, or CLI job** | **LetItLoop (`@durable` + `lil watch`)** | Zero external daemon, human-readable JSONL WAL (`LILWAL02`) with CRC32 + SHA-256 hash chain, and built-in subprocess crash supervision (`lil watch`). |
81
+ | **SQLite / PostgreSQL transactional workflows with durable `sleep` & queues** | **[DBOS (`dbos`)](https://github.com/dbos-inc/dbos-transact-py)** | Runs in-process on SQLite by default with a production PostgreSQL upgrade path and official PydanticAI / OpenAI Agents SDK integrations. |
82
+ | **LangGraph graph or `@entrypoint` / `@task` pipelines** | **[LangGraph `SqliteSaver`](https://pypi.org/project/langgraph-checkpoint-sqlite/)** | Native checkpointer maintained by the LangGraph core team. |
83
+ | **Data engineering DAGs & scheduled flows** | **[Prefect](https://github.com/PrefectHQ/prefect)** | Mature Python `@flow` / `@task` engine with ephemeral local SQLite mode and observability UI. |
84
+ | **Multi-node distributed microservices & multi-day timers** | **[Temporal](https://github.com/temporalio/sdk-python)** or **[Restate](https://github.com/restatedev/sdk-python)** | Dedicated workflow server clusters with distributed event histories and multi-language workers. |
85
+
86
+ See [docs/ARCHITECTURE_AND_TRADE_OFFS.md](docs/ARCHITECTURE_AND_TRADE_OFFS.md) for a detailed architectural analysis and contract boundaries.
87
+
88
+ ---
89
+
90
+ ## 🔄 Process Liveness: Auto-Supervision & CLI Watcher
91
+
92
+ LetItLoop pairs **State Durability** (saving step outputs to disk) with **Process Liveness** (restarting a script after `SIGKILL 137` or an unhandled crash):
93
+
94
+ ### 1. Terminal Watcher (`lil watch`)
95
+ Supervise any Python script with sliding-window rapid-failure circuit breaking and clean signal forwarding:
96
+
97
+ ```bash
98
+ lil watch agent_pipeline.py --max-restarts 10 --backoff 1.0
99
+ ```
100
+
101
+ ### 2. Entrypoint Decorator (`@supervise`)
102
+ ```python
103
+ from letitloop import durable, step, supervise
104
+
105
+
106
+ @supervise(max_restarts=5, backoff=1.0)
107
+ @durable(goal_id="equity_analyst", wal_dir=".equity_wal")
108
+ def run_pipeline():
109
+ user = step("fetch_data", fetch_financials)
110
+ report = step("generate_report", analyze, user)
111
+ return report
112
+
113
+
114
+ if __name__ == "__main__":
115
+ run_pipeline()
116
+ ```
117
+
118
+ ---
119
+
120
+ ## 💎 Core Design Guarantees & Contract Boundaries
121
+
122
+ 1. **CRC32-Framed Append-Only WAL (`LILWAL02`)**:
123
+ Each step delta is framed as `\nLILWAL02:<byte_len_hex>:<crc32_hex>:<canonical_json>\n` and linked via a sequential SHA-256 hash chain (`prev_hash` -> `event_hash`). Torn tail writes from mid-append power loss or `SIGKILL` are truncated back to the last valid frame on replay, while mid-file corruption fails closed with `StateError`.
124
+ 2. **$O(1)$ Delta Patching & Atomic Snapshots**:
125
+ Step outputs append discrete delta patches under `step_outputs` and write periodic atomic snapshots (`state.json` via tempfile + `os.fsync` + 6-attempt Windows NTFS `os.replace` retry + POSIX directory fsync).
126
+ 3. **2-Tier Mutex (`atomic_marker`)**:
127
+ Combines a process-local `threading.Lock` and a cross-process `FileLock` (with PID start-time token verification to prevent PID-reuse lock false positives) and sweeps orphaned `.pending.<dead_pid>` markers on recovery.
128
+ > **External API Boundary**: No local filesystem marker can prevent duplicate execution if `SIGKILL` strikes after an HTTP request leaves the host NIC but before the response is committed to disk. For non-idempotent remote APIs (e.g. Stripe charges), pass an upstream `Idempotency-Key` header derived from `f"{goal_id}:{marker_id}"`.
129
+ 4. **Allowlist-Only Type Hydration (`DurableCodecRegistry`)**:
130
+ Preserves `datetime`, `uuid.UUID`, `pathlib.Path`, `tuple`, and custom types registered via `register_codec()` across initial execution and WAL replay without using `pickle` or dynamic code imports.
131
+
132
+ ---
133
+
134
+ ## 🍳 Runnable Examples & Cookbooks
135
+
136
+ Self-contained examples in [`examples/`](examples/):
137
+
138
+ | Target | Example / Cookbook | Description |
139
+ |---|---|---|
140
+ | **Playwright** | [`examples/cookbooks/playwright_scraper.py`](examples/cookbooks/playwright_scraper.py) | Multi-page scraper with `@durable_async` checkpointing that skips already-scraped pages on resume |
141
+ | **Streamlit UI** | [`examples/interactive_demo/app.py`](examples/interactive_demo/README.md) | Local crash injection and WAL replay visualizer |
142
+ | **Browser-Use** | [`examples/cookbooks/browser_use_durable.py`](examples/cookbooks/browser_use_durable.py) | Release digest workflow with step-level crash recovery |
143
+ | **LangGraph** | [`examples/cookbooks/langgraph_financial_analyst.py`](examples/cookbooks/langgraph_financial_analyst.py) | 4-step financial analyst pipeline with offline and live DeepSeek modes |
144
+ | **DSPy** | [`examples/cookbooks/dspy_durable_optimize.py`](examples/cookbooks/dspy_durable_optimize.py) | Prompt optimizer pipeline with step-level checkpointing |
145
+ | **Pydantic AI** | [`examples/cookbooks/pydantic_ai_durable.py`](examples/cookbooks/pydantic_ai_durable.py) | Type-safe agent workflow wrapped with LetItLoop step persistence |
146
+ | **FastAPI** | [`examples/fastapi_durable_background.py`](examples/fastapi_durable_background.py) | Single-worker durable background task queue backed by local WAL |
147
+ | **CrewAI / LlamaIndex** | [`examples/crewai_durable_tools.py`](examples/crewai_durable_tools.py) • [`examples/llamaindex_durable_workflow.py`](examples/llamaindex_durable_workflow.py) | Tool-call and step wrapper examples |
148
+
149
+ Run the financial analyst cookbook offline without API keys:
150
+
151
+ ```bash
152
+ python -m pip install -e ".[financial-agent]"
153
+ python examples/cookbooks/langgraph_financial_analyst.py --ticker AAPL --offline
154
+ python examples/cookbooks/langgraph_financial_analyst.py --ticker AAPL --offline --demo
155
+ ```
156
+
157
+ ---
158
+
159
+ ## 🛡️ GitHub Action CI Gate (`letitloop-action@v2`)
160
+
161
+ Verify `LILWAL02` frame checksums and Python AST syntax in GitHub Actions:
162
+
163
+ ```yaml
164
+ name: Verify WAL & Python AST
165
+ on: [pull_request]
166
+
167
+ jobs:
168
+ verify:
169
+ runs-on: ubuntu-latest
170
+ steps:
171
+ - uses: actions/checkout@v4
172
+ - uses: sdageltc/letitloop-action@v2
173
+ with:
174
+ token: ${{ secrets.GITHUB_TOKEN }}
175
+ mode: 'gate'
176
+ wal-dir: '.bench_wal'
177
+ workspace: '.'
178
+ ```
179
+
180
+ ---
181
+
182
+ ## 📜 Architecture Documentation
183
+
184
+ - [**Architecture & Trade-Offs**](docs/ARCHITECTURE_AND_TRADE_OFFS.md): Single-writer design contract, failure modes, and comparison with DBOS, LangGraph, and Temporal.
185
+ - [**ADR-0001**](docs/adr/0001-write-ahead-logging.md): Write-Ahead Logging (`LILWAL02`) & Torn-Tail Recovery.
186
+ - [**State Machine Specification**](docs/state_machine.md): Event-sourced state transitions and replay rules.
187
+ - [**Adapter Reference**](docs/adapters.md): Optional adapter shims under `letitloop.adapters`.
188
+
189
+ ---
190
+
191
+ ## 👥 Contributors
192
+
193
+ <table>
194
+ <tbody>
195
+ <tr>
196
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/sdageltc"><img src="https://avatars.githubusercontent.com/u/268154463?v=4" width="100px;" alt="sdageltc"/><br /><sub><b>sdageltc</b></sub></a></td>
197
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/h4syy"><img src="https://avatars.githubusercontent.com/u/59239840?v=4" width="100px;" alt="Yash Paudel"/><br /><sub><b>Yash Paudel</b></sub></a></td>
198
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/wangshen-tech"><img src="https://avatars.githubusercontent.com/u/190895315?v=4" width="100px;" alt="wangshen-tech"/><br /><sub><b>wangshen-tech</b></sub></a></td>
199
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/MagMueller"><img src="https://github.com/MagMueller.png" width="100px;" alt="MagMueller"/><br /><sub><b>MagMueller</b></sub></a></td>
200
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/darkseidpaul"><img src="https://github.com/darkseidpaul.png" width="100px;" alt="darkseidpaul"/><br /><sub><b>darkseidpaul</b></sub></a></td>
201
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/Aaqibhafeezkhan"><img src="https://github.com/Aaqibhafeezkhan.png" width="100px;" alt="Aaqibhafeezkhan"/><br /><sub><b>Aaqibhafeezkhan</b></sub></a></td>
202
+ </tr>
203
+ </tbody>
204
+ </table>
205
+
206
+ ## License
207
+
208
+ Distributed under the MIT License. Copyright (c) 2026 sdageltc. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,45 @@
1
+ # Architectural Design, Contract Boundaries & Trade-Offs (`v0.7.3`)
2
+
3
+ This document specifies what `letitloop` guarantees, where its single-process local filesystem model stops, and when you should use an established database-backed workflow engine instead.
4
+
5
+ ---
6
+
7
+ ## 1. Core Mechanism (`LILWAL02`)
8
+
9
+ `letitloop` persists step execution state in a local directory (`wal_dir`, defaulting to `.durable_wal`):
10
+ - **Write-Ahead Log (`state.wal.jsonl`)**: Every completed `step()` or `async_step()` appends an event record encoded in `LILWAL02` framing:
11
+ ```text
12
+ \nLILWAL02:<byte_len_hex>:<crc32_hex>:<canonical_json_payload>\n
13
+ ```
14
+ Each event includes a monotonic sequence number (`seq >= 1`, starting with `INIT`) and an unkeyed SHA-256 hash chain (`prev_hash` -> `event_hash`) followed by `f.flush()` and `os.fsync()`.
15
+ - **Periodic Atomic Snapshots (`state.json`)**: Every 50 steps and on clean context exit (`close()`), the projected state is written to a PID/timestamped temporary file in the same directory, flushed with `os.fsync()`, atomically swapped into `state.json` via `os.replace()` (with a 6-attempt exponential backoff loop on Windows NTFS to survive transient antivirus/indexer handles), and followed by a parent directory `fsync` on POSIX.
16
+ - **Crash Recovery**: On restart, `load_state()` reads `state.wal.jsonl`. If the final frame was torn mid-write by `SIGKILL` or power loss, the corrupt tail is truncated back to the last valid byte offset (`good_end`). Any corruption *prior* to the final frame raises `StateError` (fail-closed).
17
+
18
+ ---
19
+
20
+ ## 2. Explicit Contract Boundaries & Limitations
21
+
22
+ 1. **Single-Writer Local Filesystem Contract**:
23
+ - `letitloop` is designed for a **single active process per `wal_dir`** on a local POSIX or Windows NTFS volume.
24
+ - Do not place `wal_dir` on network filesystems (NFS, SMB, cloud-synced FUSE mounts) where `O_CREAT | O_EXCL` or `os.replace()` atomicity is not guaranteed.
25
+ 2. **Step Identity (`step_id`)**:
26
+ - `step(step_id, fn, *args, **kwargs)` keys completed outputs strictly by `step_id` within `wal_dir`.
27
+ - Inside loops, assign a distinct `step_id` per iteration (for example, `step(f"scrape_page_{i}", scrape, url)`).
28
+ - To run a completed workflow again from scratch with new inputs, either pass a distinct `wal_dir` per run ID (`wal_dir=f".wal/{run_id}"`) or remove the prior `wal_dir`.
29
+ 3. **Integrity vs. Cryptographic Authentication**:
30
+ - `LILWAL02` uses **CRC32** frame checksums and an **unkeyed SHA-256 hash chain** to detect accidental disk corruption and torn writes. It does not perform keyed HMAC authentication on WAL frames; any local process with write permissions to `wal_dir` can rewrite the file.
31
+ 4. **External Side Effects (`atomic_marker`)**:
32
+ - `atomic_marker(marker_id)` serializes local execution via a two-tier lock (thread lock + `FileLock` with OS process start-time token verification) and records `.pending.<pid>` before yielding and `.committed` after the block succeeds.
33
+ - If `SIGKILL` strikes *after* an outbound HTTP request leaves the machine but *before* `.committed` is written, the block will yield `True` again on restart. Always pair non-idempotent remote HTTP calls with an upstream `Idempotency-Key` header.
34
+
35
+ ---
36
+
37
+ ## 3. Why We Narrowed Scope (November 2026 Landscape Note)
38
+
39
+ `letitloop` began in 2024 as a 70-file autonomous coding-agent harness before being stripped down in October 2026 (`v0.7.0`) into a single-dependency (`psutil`) local durability kernel.
40
+
41
+ By late 2026, two major shifts occurred across the Python AI ecosystem:
42
+ 1. **In-process SQLite workflow engines matured**: **DBOS (`dbos`)** runs zero-daemon on embedded SQLite by default with `@DBOS.workflow()` / `@DBOS.step()`, durable timers (`DBOS.sleep`), queues, a zero-code upgrade path to PostgreSQL, and official integrations with PydanticAI and the OpenAI Agents SDK. **Prefect** similarly offers an ephemeral local SQLite mode.
43
+ 2. **Agent frameworks shipped native local checkpointers**: **LangGraph** (`SqliteSaver` + `@entrypoint` / `@task`), **CrewAI** (`@persist` Flows on SQLite), **Google ADK** (`DatabaseSessionService`), **OpenAI Agents SDK** (`SQLiteSession`), and **LlamaIndex** (`WorkflowCheckpointer`) all provide built-in state persistence.
44
+
45
+ Consequently, `letitloop` does not attempt to compete with DBOS, Temporal, or native framework savers. It remains a compact, auditable reference implementation (~2,000 lines of core Python in `orchestrator/`) for developers who want a zero-SQLite, human-readable JSONL Write-Ahead Log and a cross-platform CLI crash supervisor (`lil watch`) with one dependency.