turnloop 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 (148) hide show
  1. turnloop-0.1.0/.github/workflows/ci.yml +36 -0
  2. turnloop-0.1.0/.gitignore +13 -0
  3. turnloop-0.1.0/.turnloop/.gitignore +2 -0
  4. turnloop-0.1.0/PKG-INFO +916 -0
  5. turnloop-0.1.0/README.md +887 -0
  6. turnloop-0.1.0/pyproject.toml +84 -0
  7. turnloop-0.1.0/tests/conftest.py +95 -0
  8. turnloop-0.1.0/tests/fixtures/anthropic_tool_call.sse +36 -0
  9. turnloop-0.1.0/tests/fixtures/glm_tool_call.sse +18 -0
  10. turnloop-0.1.0/tests/fixtures/mcp_echo_server.py +83 -0
  11. turnloop-0.1.0/tests/test_bash.py +150 -0
  12. turnloop-0.1.0/tests/test_compaction.py +276 -0
  13. turnloop-0.1.0/tests/test_config.py +201 -0
  14. turnloop-0.1.0/tests/test_experiments.py +508 -0
  15. turnloop-0.1.0/tests/test_hooks_mcp_commands.py +379 -0
  16. turnloop-0.1.0/tests/test_loop.py +372 -0
  17. turnloop-0.1.0/tests/test_permissions.py +213 -0
  18. turnloop-0.1.0/tests/test_providers.py +424 -0
  19. turnloop-0.1.0/tests/test_tools_files.py +296 -0
  20. turnloop-0.1.0/tests/test_tui.py +170 -0
  21. turnloop-0.1.0/turnloop/__init__.py +3 -0
  22. turnloop-0.1.0/turnloop/__main__.py +4 -0
  23. turnloop-0.1.0/turnloop/agent/__init__.py +0 -0
  24. turnloop-0.1.0/turnloop/agent/factory.py +175 -0
  25. turnloop-0.1.0/turnloop/agent/headless.py +150 -0
  26. turnloop-0.1.0/turnloop/agent/loop.py +396 -0
  27. turnloop-0.1.0/turnloop/agent/subagent.py +182 -0
  28. turnloop-0.1.0/turnloop/agent/system_prompt.py +263 -0
  29. turnloop-0.1.0/turnloop/cli.py +202 -0
  30. turnloop-0.1.0/turnloop/commands/__init__.py +0 -0
  31. turnloop-0.1.0/turnloop/commands/dispatch.py +428 -0
  32. turnloop-0.1.0/turnloop/commands/loader.py +140 -0
  33. turnloop-0.1.0/turnloop/config.py +425 -0
  34. turnloop-0.1.0/turnloop/context/__init__.py +0 -0
  35. turnloop-0.1.0/turnloop/context/budget.py +74 -0
  36. turnloop-0.1.0/turnloop/context/compaction.py +441 -0
  37. turnloop-0.1.0/turnloop/context/memory.py +120 -0
  38. turnloop-0.1.0/turnloop/core/__init__.py +0 -0
  39. turnloop-0.1.0/turnloop/core/events.py +145 -0
  40. turnloop-0.1.0/turnloop/core/ids.py +29 -0
  41. turnloop-0.1.0/turnloop/core/messages.py +217 -0
  42. turnloop-0.1.0/turnloop/core/tokens.py +104 -0
  43. turnloop-0.1.0/turnloop/diagnostics.py +233 -0
  44. turnloop-0.1.0/turnloop/errors.py +64 -0
  45. turnloop-0.1.0/turnloop/experiments/__init__.py +0 -0
  46. turnloop-0.1.0/turnloop/experiments/configs/bakeoff.yaml +50 -0
  47. turnloop-0.1.0/turnloop/experiments/configs/ceiling-check.yaml +31 -0
  48. turnloop-0.1.0/turnloop/experiments/configs/context-glm.yaml +59 -0
  49. turnloop-0.1.0/turnloop/experiments/configs/context.yaml +65 -0
  50. turnloop-0.1.0/turnloop/experiments/configs/glm-selfhosted.yaml +36 -0
  51. turnloop-0.1.0/turnloop/experiments/configs/groq-free.yaml +28 -0
  52. turnloop-0.1.0/turnloop/experiments/configs/hard-calibration.yaml +26 -0
  53. turnloop-0.1.0/turnloop/experiments/configs/hard-glm.yaml +41 -0
  54. turnloop-0.1.0/turnloop/experiments/configs/loop.yaml +34 -0
  55. turnloop-0.1.0/turnloop/experiments/configs/nvidia-smoke.yaml +22 -0
  56. turnloop-0.1.0/turnloop/experiments/configs/reliability.yaml +44 -0
  57. turnloop-0.1.0/turnloop/experiments/configs/rewrite-calibration.yaml +24 -0
  58. turnloop-0.1.0/turnloop/experiments/configs/smoke.yaml +22 -0
  59. turnloop-0.1.0/turnloop/experiments/graders.py +209 -0
  60. turnloop-0.1.0/turnloop/experiments/report.py +371 -0
  61. turnloop-0.1.0/turnloop/experiments/runner.py +495 -0
  62. turnloop-0.1.0/turnloop/experiments/suite/default.yaml +185 -0
  63. turnloop-0.1.0/turnloop/experiments/suite/fixtures/bulky/module_1.py +670 -0
  64. turnloop-0.1.0/turnloop/experiments/suite/fixtures/bulky/module_2.py +670 -0
  65. turnloop-0.1.0/turnloop/experiments/suite/fixtures/bulky/module_3.py +670 -0
  66. turnloop-0.1.0/turnloop/experiments/suite/fixtures/bulky/module_4.py +670 -0
  67. turnloop-0.1.0/turnloop/experiments/suite/fixtures/bulky/module_5.py +670 -0
  68. turnloop-0.1.0/turnloop/experiments/suite/fixtures/bulky/module_6.py +672 -0
  69. turnloop-0.1.0/turnloop/experiments/suite/fixtures/bulky/module_7.py +670 -0
  70. turnloop-0.1.0/turnloop/experiments/suite/fixtures/bulky/module_8.py +670 -0
  71. turnloop-0.1.0/turnloop/experiments/suite/fixtures/circular_import/models.py +11 -0
  72. turnloop-0.1.0/turnloop/experiments/suite/fixtures/circular_import/services.py +15 -0
  73. turnloop-0.1.0/turnloop/experiments/suite/fixtures/circular_import/test_cancel.py +12 -0
  74. turnloop-0.1.0/turnloop/experiments/suite/fixtures/cli_flag/app.py +16 -0
  75. turnloop-0.1.0/turnloop/experiments/suite/fixtures/cross_file_contract/decode.py +7 -0
  76. turnloop-0.1.0/turnloop/experiments/suite/fixtures/cross_file_contract/encode.py +10 -0
  77. turnloop-0.1.0/turnloop/experiments/suite/fixtures/cross_file_contract/test_roundtrip.py +11 -0
  78. turnloop-0.1.0/turnloop/experiments/suite/fixtures/cross_file_contract/test_wire_format.py +7 -0
  79. turnloop-0.1.0/turnloop/experiments/suite/fixtures/empty/.keep +1 -0
  80. turnloop-0.1.0/turnloop/experiments/suite/fixtures/failing_test/calc.py +14 -0
  81. turnloop-0.1.0/turnloop/experiments/suite/fixtures/failing_test/test_calc.py +17 -0
  82. turnloop-0.1.0/turnloop/experiments/suite/fixtures/generate_bulky.py +80 -0
  83. turnloop-0.1.0/turnloop/experiments/suite/fixtures/grep_edit/ingest.py +5 -0
  84. turnloop-0.1.0/turnloop/experiments/suite/fixtures/grep_edit/load.py +5 -0
  85. turnloop-0.1.0/turnloop/experiments/suite/fixtures/grep_edit/transform.py +5 -0
  86. turnloop-0.1.0/turnloop/experiments/suite/fixtures/misleading_traceback/checkout.py +21 -0
  87. turnloop-0.1.0/turnloop/experiments/suite/fixtures/misleading_traceback/invoice.py +8 -0
  88. turnloop-0.1.0/turnloop/experiments/suite/fixtures/misleading_traceback/pricing.py +11 -0
  89. turnloop-0.1.0/turnloop/experiments/suite/fixtures/misleading_traceback/test_checkout.py +12 -0
  90. turnloop-0.1.0/turnloop/experiments/suite/fixtures/misleading_traceback/test_invoice.py +6 -0
  91. turnloop-0.1.0/turnloop/experiments/suite/fixtures/needle/inventory.py +18 -0
  92. turnloop-0.1.0/turnloop/experiments/suite/fixtures/needle/pricing.py +17 -0
  93. turnloop-0.1.0/turnloop/experiments/suite/fixtures/needle/shipping.py +13 -0
  94. turnloop-0.1.0/turnloop/experiments/suite/fixtures/regression_trap/test_validators.py +14 -0
  95. turnloop-0.1.0/turnloop/experiments/suite/fixtures/regression_trap/validators.py +23 -0
  96. turnloop-0.1.0/turnloop/experiments/suite/fixtures/rename/billing.py +7 -0
  97. turnloop-0.1.0/turnloop/experiments/suite/fixtures/rename/report.py +5 -0
  98. turnloop-0.1.0/turnloop/experiments/suite/fixtures/rename/test_billing.py +11 -0
  99. turnloop-0.1.0/turnloop/experiments/suite/fixtures/spec/parser.py +19 -0
  100. turnloop-0.1.0/turnloop/experiments/suite/fixtures/spec/test_parser.py +28 -0
  101. turnloop-0.1.0/turnloop/experiments/suite/fixtures/subtle_spec_edge/leaderboard.py +12 -0
  102. turnloop-0.1.0/turnloop/experiments/suite/fixtures/subtle_spec_edge/test_leaderboard.py +28 -0
  103. turnloop-0.1.0/turnloop/experiments/suite/fixtures/util/util.py +9 -0
  104. turnloop-0.1.0/turnloop/hooks/__init__.py +0 -0
  105. turnloop-0.1.0/turnloop/hooks/runner.py +221 -0
  106. turnloop-0.1.0/turnloop/mcp/__init__.py +0 -0
  107. turnloop-0.1.0/turnloop/mcp/adapter.py +109 -0
  108. turnloop-0.1.0/turnloop/mcp/client.py +299 -0
  109. turnloop-0.1.0/turnloop/permissions/__init__.py +0 -0
  110. turnloop-0.1.0/turnloop/permissions/engine.py +211 -0
  111. turnloop-0.1.0/turnloop/permissions/rules.py +325 -0
  112. turnloop-0.1.0/turnloop/providers/__init__.py +0 -0
  113. turnloop-0.1.0/turnloop/providers/anthropic.py +318 -0
  114. turnloop-0.1.0/turnloop/providers/base.py +329 -0
  115. turnloop-0.1.0/turnloop/providers/gemini.py +217 -0
  116. turnloop-0.1.0/turnloop/providers/mock.py +226 -0
  117. turnloop-0.1.0/turnloop/providers/openai_compat.py +357 -0
  118. turnloop-0.1.0/turnloop/providers/pricing.py +148 -0
  119. turnloop-0.1.0/turnloop/providers/registry.py +75 -0
  120. turnloop-0.1.0/turnloop/providers/sse.py +114 -0
  121. turnloop-0.1.0/turnloop/sessions/__init__.py +0 -0
  122. turnloop-0.1.0/turnloop/sessions/models.py +139 -0
  123. turnloop-0.1.0/turnloop/sessions/store.py +271 -0
  124. turnloop-0.1.0/turnloop/tools/__init__.py +0 -0
  125. turnloop-0.1.0/turnloop/tools/ask.py +133 -0
  126. turnloop-0.1.0/turnloop/tools/base.py +286 -0
  127. turnloop-0.1.0/turnloop/tools/bash.py +423 -0
  128. turnloop-0.1.0/turnloop/tools/builtin.py +63 -0
  129. turnloop-0.1.0/turnloop/tools/edit.py +238 -0
  130. turnloop-0.1.0/turnloop/tools/glob.py +235 -0
  131. turnloop-0.1.0/turnloop/tools/grep.py +314 -0
  132. turnloop-0.1.0/turnloop/tools/read.py +151 -0
  133. turnloop-0.1.0/turnloop/tools/runner.py +284 -0
  134. turnloop-0.1.0/turnloop/tools/shell.py +222 -0
  135. turnloop-0.1.0/turnloop/tools/skill.py +89 -0
  136. turnloop-0.1.0/turnloop/tools/task.py +161 -0
  137. turnloop-0.1.0/turnloop/tools/textio.py +87 -0
  138. turnloop-0.1.0/turnloop/tools/todo.py +140 -0
  139. turnloop-0.1.0/turnloop/tools/webfetch.py +235 -0
  140. turnloop-0.1.0/turnloop/tools/write.py +97 -0
  141. turnloop-0.1.0/turnloop/tui/__init__.py +0 -0
  142. turnloop-0.1.0/turnloop/tui/app.py +330 -0
  143. turnloop-0.1.0/turnloop/tui/app.tcss +84 -0
  144. turnloop-0.1.0/turnloop/tui/bridge.py +142 -0
  145. turnloop-0.1.0/turnloop/tui/widgets/__init__.py +0 -0
  146. turnloop-0.1.0/turnloop/tui/widgets/permission.py +131 -0
  147. turnloop-0.1.0/turnloop/tui/widgets/status.py +110 -0
  148. turnloop-0.1.0/turnloop/tui/widgets/transcript.py +146 -0
@@ -0,0 +1,36 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ # Windows is not optional here: shell resolution and process-tree kill are
14
+ # platform-specific and are exactly where this project's bugs live.
15
+ os: [ubuntu-latest, windows-latest]
16
+ python: ["3.11", "3.13"]
17
+ runs-on: ${{ matrix.os }}
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python }}
24
+
25
+ - run: pip install -e ".[dev]"
26
+
27
+ - name: Tests
28
+ # Network is blocked at the transport layer by conftest, so `not live` is
29
+ # belt and braces rather than the only guard.
30
+ run: pytest -m "not live"
31
+
32
+ - name: Lint
33
+ run: ruff check turnloop tests
34
+
35
+ - name: Types
36
+ run: mypy turnloop
@@ -0,0 +1,13 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ build/
5
+ dist/
6
+ .venv/
7
+ venv/
8
+ .pytest_cache/
9
+ .mypy_cache/
10
+ .ruff_cache/
11
+ .turnloop/sessions/
12
+ .turnloop/experiments/
13
+ .env
@@ -0,0 +1,2 @@
1
+ sessions/
2
+ settings.local.json