turnloop 0.1.12__tar.gz → 0.1.13__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 (161) hide show
  1. {turnloop-0.1.12 → turnloop-0.1.13}/.gitignore +2 -0
  2. {turnloop-0.1.12 → turnloop-0.1.13}/PKG-INFO +7 -6
  3. {turnloop-0.1.12 → turnloop-0.1.13}/README.md +5 -4
  4. {turnloop-0.1.12 → turnloop-0.1.13}/pyproject.toml +97 -97
  5. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_hooks_mcp_commands.py +58 -0
  6. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_loop.py +487 -447
  7. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_permissions.py +68 -0
  8. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_webfetch.py +46 -0
  9. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/__init__.py +3 -3
  10. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/agent/loop.py +41 -13
  11. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/cli.py +638 -602
  12. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/configio.py +1 -1
  13. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/hooks/runner.py +19 -9
  14. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/mcp/client.py +333 -302
  15. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/permissions/engine.py +264 -211
  16. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/permissions/rules.py +381 -325
  17. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/base.py +292 -290
  18. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/bash.py +112 -11
  19. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/webfetch.py +55 -13
  20. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tui/app.py +3 -23
  21. {turnloop-0.1.12 → turnloop-0.1.13}/tests/conftest.py +0 -0
  22. {turnloop-0.1.12 → turnloop-0.1.13}/tests/fixtures/anthropic_tool_call.sse +0 -0
  23. {turnloop-0.1.12 → turnloop-0.1.13}/tests/fixtures/github_chrome.html +0 -0
  24. {turnloop-0.1.12 → turnloop-0.1.13}/tests/fixtures/github_page.html +0 -0
  25. {turnloop-0.1.12 → turnloop-0.1.13}/tests/fixtures/glm_tool_call.sse +0 -0
  26. {turnloop-0.1.12 → turnloop-0.1.13}/tests/fixtures/mcp_echo_server.py +0 -0
  27. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_bash.py +0 -0
  28. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_compaction.py +0 -0
  29. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_config.py +0 -0
  30. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_config_screen.py +0 -0
  31. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_configio.py +0 -0
  32. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_experiments.py +0 -0
  33. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_providers.py +0 -0
  34. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_skills_install.py +0 -0
  35. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_subagent_extras.py +0 -0
  36. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_system_prompt_layout.py +0 -0
  37. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_tools_files.py +0 -0
  38. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_tui.py +0 -0
  39. {turnloop-0.1.12 → turnloop-0.1.13}/tests/test_websearch.py +0 -0
  40. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/__main__.py +0 -0
  41. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/agent/__init__.py +0 -0
  42. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/agent/factory.py +0 -0
  43. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/agent/headless.py +0 -0
  44. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/agent/subagent.py +0 -0
  45. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/agent/system_prompt.py +0 -0
  46. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/commands/__init__.py +0 -0
  47. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/commands/dispatch.py +0 -0
  48. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/commands/loader.py +0 -0
  49. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/config.py +0 -0
  50. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/context/__init__.py +0 -0
  51. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/context/budget.py +0 -0
  52. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/context/compaction.py +0 -0
  53. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/context/memory.py +0 -0
  54. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/core/__init__.py +0 -0
  55. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/core/events.py +0 -0
  56. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/core/ids.py +0 -0
  57. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/core/messages.py +0 -0
  58. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/core/tokens.py +0 -0
  59. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/diagnostics.py +0 -0
  60. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/errors.py +0 -0
  61. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/__init__.py +0 -0
  62. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/configs/bakeoff.yaml +0 -0
  63. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/configs/ceiling-check.yaml +0 -0
  64. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/configs/context-glm.yaml +0 -0
  65. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/configs/context.yaml +0 -0
  66. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/configs/glm-selfhosted.yaml +0 -0
  67. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/configs/groq-free.yaml +0 -0
  68. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/configs/hard-calibration.yaml +0 -0
  69. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/configs/hard-glm.yaml +0 -0
  70. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/configs/loop.yaml +0 -0
  71. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/configs/nvidia-smoke.yaml +0 -0
  72. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/configs/reliability.yaml +0 -0
  73. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/configs/rewrite-calibration.yaml +0 -0
  74. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/configs/smoke.yaml +0 -0
  75. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/graders.py +0 -0
  76. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/report.py +0 -0
  77. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/runner.py +0 -0
  78. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/default.yaml +0 -0
  79. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/bulky/module_1.py +0 -0
  80. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/bulky/module_2.py +0 -0
  81. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/bulky/module_3.py +0 -0
  82. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/bulky/module_4.py +0 -0
  83. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/bulky/module_5.py +0 -0
  84. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/bulky/module_6.py +0 -0
  85. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/bulky/module_7.py +0 -0
  86. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/bulky/module_8.py +0 -0
  87. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/circular_import/models.py +0 -0
  88. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/circular_import/services.py +0 -0
  89. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/circular_import/test_cancel.py +0 -0
  90. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/cli_flag/app.py +0 -0
  91. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/cross_file_contract/decode.py +0 -0
  92. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/cross_file_contract/encode.py +0 -0
  93. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/cross_file_contract/test_roundtrip.py +0 -0
  94. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/cross_file_contract/test_wire_format.py +0 -0
  95. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/empty/.keep +0 -0
  96. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/failing_test/calc.py +0 -0
  97. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/failing_test/test_calc.py +0 -0
  98. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/generate_bulky.py +0 -0
  99. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/grep_edit/ingest.py +0 -0
  100. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/grep_edit/load.py +0 -0
  101. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/grep_edit/transform.py +0 -0
  102. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/misleading_traceback/checkout.py +0 -0
  103. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/misleading_traceback/invoice.py +0 -0
  104. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/misleading_traceback/pricing.py +0 -0
  105. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/misleading_traceback/test_checkout.py +0 -0
  106. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/misleading_traceback/test_invoice.py +0 -0
  107. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/needle/inventory.py +0 -0
  108. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/needle/pricing.py +0 -0
  109. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/needle/shipping.py +0 -0
  110. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/regression_trap/test_validators.py +0 -0
  111. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/regression_trap/validators.py +0 -0
  112. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/rename/billing.py +0 -0
  113. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/rename/report.py +0 -0
  114. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/rename/test_billing.py +0 -0
  115. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/spec/parser.py +0 -0
  116. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/spec/test_parser.py +0 -0
  117. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/subtle_spec_edge/leaderboard.py +0 -0
  118. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/subtle_spec_edge/test_leaderboard.py +0 -0
  119. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/experiments/suite/fixtures/util/util.py +0 -0
  120. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/hooks/__init__.py +0 -0
  121. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/mcp/__init__.py +0 -0
  122. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/mcp/adapter.py +0 -0
  123. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/permissions/__init__.py +0 -0
  124. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/providers/__init__.py +0 -0
  125. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/providers/anthropic.py +0 -0
  126. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/providers/base.py +0 -0
  127. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/providers/gemini.py +0 -0
  128. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/providers/mock.py +0 -0
  129. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/providers/openai_compat.py +0 -0
  130. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/providers/pricing.py +0 -0
  131. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/providers/registry.py +0 -0
  132. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/providers/sse.py +0 -0
  133. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/sessions/__init__.py +0 -0
  134. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/sessions/models.py +0 -0
  135. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/sessions/store.py +0 -0
  136. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/skills_install.py +0 -0
  137. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/__init__.py +0 -0
  138. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/ask.py +0 -0
  139. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/builtin.py +0 -0
  140. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/edit.py +0 -0
  141. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/glob.py +0 -0
  142. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/grep.py +0 -0
  143. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/read.py +0 -0
  144. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/runner.py +0 -0
  145. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/shell.py +0 -0
  146. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/skill.py +0 -0
  147. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/task.py +0 -0
  148. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/textio.py +0 -0
  149. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/todo.py +0 -0
  150. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/websearch.py +0 -0
  151. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tools/write.py +0 -0
  152. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tui/__init__.py +0 -0
  153. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tui/app.tcss +0 -0
  154. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tui/bridge.py +0 -0
  155. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tui/config_screen.py +0 -0
  156. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tui/mcp_screen.py +0 -0
  157. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tui/session_screen.py +0 -0
  158. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tui/widgets/__init__.py +0 -0
  159. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tui/widgets/permission.py +0 -0
  160. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tui/widgets/status.py +0 -0
  161. {turnloop-0.1.12 → turnloop-0.1.13}/turnloop/tui/widgets/transcript.py +0 -0
@@ -11,3 +11,5 @@ venv/
11
11
  .turnloop/sessions/
12
12
  .turnloop/experiments/
13
13
  .env
14
+ PROJECT.md
15
+ post.txt
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: turnloop
3
- Version: 0.1.12
3
+ Version: 0.1.13
4
4
  Summary: A local-first agentic coding harness: streaming tool loop, permission gating, context compaction, subagents, and any LLM provider.
5
5
  Project-URL: Homepage, https://github.com/Pranesh-2005/turnloop
6
6
  Author: Pranesh
@@ -44,12 +44,13 @@ tl # TUI, mock provider, zero cost
44
44
  tl -p "fix the failing test" # headless, one turn, prints and exits
45
45
  tl --provider glm # the self-hosted endpoint
46
46
  tl doctor # diagnose shell, providers, context budget
47
+ tl permissions check "git push" # explain the verdict a command would get
47
48
  tl experiment run smoke # a measurement run, offline and free
48
49
  ```
49
50
 
50
- Four runtime dependencies: `textual`, `pydantic`, `httpx`, `pyyaml`. No vendor
51
+ Five runtime dependencies: `textual`, `pydantic`, `httpx`, `pyyaml`, `anyio`. No vendor
51
52
  SDKs, no agent framework — the loop is the point, so the loop is written here.
52
- ~21,900 lines of Python, 383 tests, no network in the default test run.
53
+ ~21,300 lines of Python, 427 tests, no network in the default test run.
53
54
 
54
55
  ---
55
56
 
@@ -117,7 +118,7 @@ point.
117
118
  Verify:
118
119
 
119
120
  ```bash
120
- tl --version # turnloop 0.1.12
121
+ tl --version # turnloop 0.1.13
121
122
  tl doctor # every provider, key presence, shell, context budget
122
123
  ```
123
124
 
@@ -1029,7 +1030,7 @@ one-line edit in a CRLF checkout does not produce a whole-file diff.
1029
1030
  ## Testing
1030
1031
 
1031
1032
  ```bash
1032
- pytest # 383 tests, no network
1033
+ pytest # 427 tests, no network
1033
1034
  ruff check turnloop
1034
1035
  mypy turnloop
1035
1036
  ```
@@ -15,12 +15,13 @@ tl # TUI, mock provider, zero cost
15
15
  tl -p "fix the failing test" # headless, one turn, prints and exits
16
16
  tl --provider glm # the self-hosted endpoint
17
17
  tl doctor # diagnose shell, providers, context budget
18
+ tl permissions check "git push" # explain the verdict a command would get
18
19
  tl experiment run smoke # a measurement run, offline and free
19
20
  ```
20
21
 
21
- Four runtime dependencies: `textual`, `pydantic`, `httpx`, `pyyaml`. No vendor
22
+ Five runtime dependencies: `textual`, `pydantic`, `httpx`, `pyyaml`, `anyio`. No vendor
22
23
  SDKs, no agent framework — the loop is the point, so the loop is written here.
23
- ~21,900 lines of Python, 383 tests, no network in the default test run.
24
+ ~21,300 lines of Python, 427 tests, no network in the default test run.
24
25
 
25
26
  ---
26
27
 
@@ -88,7 +89,7 @@ point.
88
89
  Verify:
89
90
 
90
91
  ```bash
91
- tl --version # turnloop 0.1.12
92
+ tl --version # turnloop 0.1.13
92
93
  tl doctor # every provider, key presence, shell, context budget
93
94
  ```
94
95
 
@@ -1000,7 +1001,7 @@ one-line edit in a CRLF checkout does not produce a whole-file diff.
1000
1001
  ## Testing
1001
1002
 
1002
1003
  ```bash
1003
- pytest # 383 tests, no network
1004
+ pytest # 427 tests, no network
1004
1005
  ruff check turnloop
1005
1006
  mypy turnloop
1006
1007
  ```
@@ -1,97 +1,97 @@
1
- [build-system]
2
- requires = ["hatchling"]
3
- build-backend = "hatchling.build"
4
-
5
- [project]
6
- name = "turnloop"
7
- version = "0.1.12"
8
- description = "A local-first agentic coding harness: streaming tool loop, permission gating, context compaction, subagents, and any LLM provider."
9
- readme = "README.md"
10
- requires-python = ">=3.11"
11
- license = { text = "MIT" }
12
- authors = [{ name = "Pranesh" }]
13
- keywords = ["agent", "llm", "cli", "coding-agent", "harness", "tool-use"]
14
- classifiers = [
15
- "Development Status :: 3 - Alpha",
16
- "Environment :: Console",
17
- "Intended Audience :: Developers",
18
- "Programming Language :: Python :: 3.11",
19
- "Programming Language :: Python :: 3.12",
20
- "Programming Language :: Python :: 3.13",
21
- "Topic :: Software Development :: Code Generators",
22
- ]
23
- dependencies = [
24
- "textual>=0.80",
25
- "pydantic>=2.7",
26
- "httpx>=0.27",
27
- "pyyaml>=6.0",
28
- # Already pulled in transitively by httpx, but the loop, subprocess handling and
29
- # cancellation all use it directly, so it is declared.
30
- "anyio>=4.2",
31
- ]
32
-
33
- [project.optional-dependencies]
34
- dev = [
35
- "pytest>=8.0",
36
- "pytest-asyncio>=0.23",
37
- "pytest-textual-snapshot>=1.0",
38
- # Pinned to a minor range, not floated. Ruff adds lint rules in minor releases,
39
- # so `>=0.6` means a build that is green today goes red tomorrow with no commit
40
- # in between — which is how this CI first broke. Bump deliberately.
41
- "ruff>=0.16.1,<0.17",
42
- # Must match what is actually run locally, or CI type-checks with a different
43
- # tool than the author does — which is exactly how this broke.
44
- "mypy>=2.1,<3",
45
- ]
46
-
47
- [project.scripts]
48
- turnloop = "turnloop.cli:main"
49
- tl = "turnloop.cli:main"
50
-
51
- [project.urls]
52
- Homepage = "https://github.com/Pranesh-2005/turnloop"
53
-
54
- [tool.hatch.build.targets.wheel]
55
- packages = ["turnloop"]
56
-
57
- # Without an explicit include, the sdist sweeps up whatever happens to be sitting
58
- # in the working tree. A stray `git clone` left behind by a failed skill install
59
- # put 157 of 317 entries — 4.2 MB of an unrelated repository — into the 0.1.8
60
- # sdist before this was pinned down. An allowlist fails closed: new junk is not
61
- # published, and a genuinely new top-level path has to be added here on purpose.
62
- [tool.hatch.build.targets.sdist]
63
- include = ["turnloop", "tests", "README.md", "pyproject.toml", "LICENSE"]
64
-
65
- [tool.ruff]
66
- line-length = 100
67
- target-version = "py311"
68
-
69
- [tool.ruff.lint]
70
- select = ["E", "F", "I", "UP", "B", "BLE", "ASYNC", "RUF"]
71
- ignore = [
72
- "E501", # line length is the formatter's business
73
- "B008", # pydantic Field() in defaults is the intended idiom
74
- "RUF012", # Textual's BINDINGS/CSS_PATH are plain class lists by API contract
75
- "RUF001", # ambiguous glyphs (›, ⏵, ⤺) are deliberate UI characters
76
- "RUF002",
77
- "RUF003",
78
- ]
79
-
80
- [tool.mypy]
81
- python_version = "3.11"
82
- # Task fixtures are deliberately broken Python — they are inputs, not code.
83
- exclude = "turnloop/experiments/suite/fixtures/"
84
- warn_unused_ignores = true
85
- warn_redundant_casts = true
86
- no_implicit_optional = true
87
- disallow_untyped_defs = false
88
- ignore_missing_imports = true
89
-
90
- [tool.pytest.ini_options]
91
- testpaths = ["tests"]
92
- asyncio_mode = "auto"
93
- markers = [
94
- "live: hits a real network endpoint; deselected by default",
95
- "slow: takes more than a few seconds",
96
- ]
97
- addopts = "-m 'not live' -q"
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "turnloop"
7
+ version = "0.1.13"
8
+ description = "A local-first agentic coding harness: streaming tool loop, permission gating, context compaction, subagents, and any LLM provider."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "Pranesh" }]
13
+ keywords = ["agent", "llm", "cli", "coding-agent", "harness", "tool-use"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Environment :: Console",
17
+ "Intended Audience :: Developers",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Topic :: Software Development :: Code Generators",
22
+ ]
23
+ dependencies = [
24
+ "textual>=0.80",
25
+ "pydantic>=2.7",
26
+ "httpx>=0.27",
27
+ "pyyaml>=6.0",
28
+ # Already pulled in transitively by httpx, but the loop, subprocess handling and
29
+ # cancellation all use it directly, so it is declared.
30
+ "anyio>=4.2",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ dev = [
35
+ "pytest>=8.0",
36
+ "pytest-asyncio>=0.23",
37
+ "pytest-textual-snapshot>=1.0",
38
+ # Pinned to a minor range, not floated. Ruff adds lint rules in minor releases,
39
+ # so `>=0.6` means a build that is green today goes red tomorrow with no commit
40
+ # in between — which is how this CI first broke. Bump deliberately.
41
+ "ruff>=0.16.1,<0.17",
42
+ # Must match what is actually run locally, or CI type-checks with a different
43
+ # tool than the author does — which is exactly how this broke.
44
+ "mypy>=2.1,<3",
45
+ ]
46
+
47
+ [project.scripts]
48
+ turnloop = "turnloop.cli:main"
49
+ tl = "turnloop.cli:main"
50
+
51
+ [project.urls]
52
+ Homepage = "https://github.com/Pranesh-2005/turnloop"
53
+
54
+ [tool.hatch.build.targets.wheel]
55
+ packages = ["turnloop"]
56
+
57
+ # Without an explicit include, the sdist sweeps up whatever happens to be sitting
58
+ # in the working tree. A stray `git clone` left behind by a failed skill install
59
+ # put 157 of 317 entries — 4.2 MB of an unrelated repository — into the 0.1.8
60
+ # sdist before this was pinned down. An allowlist fails closed: new junk is not
61
+ # published, and a genuinely new top-level path has to be added here on purpose.
62
+ [tool.hatch.build.targets.sdist]
63
+ include = ["turnloop", "tests", "README.md", "pyproject.toml", "LICENSE"]
64
+
65
+ [tool.ruff]
66
+ line-length = 100
67
+ target-version = "py311"
68
+
69
+ [tool.ruff.lint]
70
+ select = ["E", "F", "I", "UP", "B", "BLE", "ASYNC", "RUF"]
71
+ ignore = [
72
+ "E501", # line length is the formatter's business
73
+ "B008", # pydantic Field() in defaults is the intended idiom
74
+ "RUF012", # Textual's BINDINGS/CSS_PATH are plain class lists by API contract
75
+ "RUF001", # ambiguous glyphs (›, ⏵, ⤺) are deliberate UI characters
76
+ "RUF002",
77
+ "RUF003",
78
+ ]
79
+
80
+ [tool.mypy]
81
+ python_version = "3.11"
82
+ # Task fixtures are deliberately broken Python — they are inputs, not code.
83
+ exclude = "turnloop/experiments/suite/fixtures/"
84
+ warn_unused_ignores = true
85
+ warn_redundant_casts = true
86
+ no_implicit_optional = true
87
+ disallow_untyped_defs = false
88
+ ignore_missing_imports = true
89
+
90
+ [tool.pytest.ini_options]
91
+ testpaths = ["tests"]
92
+ asyncio_mode = "auto"
93
+ markers = [
94
+ "live: hits a real network endpoint; deselected by default",
95
+ "slow: takes more than a few seconds",
96
+ ]
97
+ addopts = "-m 'not live' -q"
@@ -535,3 +535,61 @@ async def test_slash_skills_reports_the_rejected_skill_and_why(settings, project
535
535
  assert str(skill_dir / "SKILL.md") in outcome.message
536
536
  assert "description" in outcome.message
537
537
  assert "ignored" in outcome.message
538
+
539
+
540
+ async def test_mcp_stdio_keeps_partial_lines_and_answers_server_requests():
541
+ """A chunk can end mid-way through the next message; that tail must survive
542
+ into the next request. Server-initiated pings must be answered."""
543
+ import json
544
+
545
+ import anyio
546
+
547
+ from turnloop.config import MCPServerConfig
548
+ from turnloop.mcp.client import MCPClient
549
+
550
+ r1 = json.dumps({"jsonrpc": "2.0", "id": 1, "result": {"n": 1}}).encode()
551
+ ping = json.dumps({"jsonrpc": "2.0", "id": "s1", "method": "ping"}).encode()
552
+ r2 = json.dumps({"jsonrpc": "2.0", "id": 2, "result": {"n": 2}}).encode()
553
+ stream = r1 + b"\n" + ping + b"\n" + r2 + b"\n"
554
+ chunks = [stream[: len(r1) + 1 + len(ping) + 5], stream[len(r1) + 1 + len(ping) + 5 :]]
555
+
556
+ class Out:
557
+ async def receive(self):
558
+ if not chunks:
559
+ raise anyio.EndOfStream
560
+ return chunks.pop(0)
561
+
562
+ class In:
563
+ sent: list[bytes] = []
564
+
565
+ async def send(self, data):
566
+ self.sent.append(data)
567
+
568
+ class Proc:
569
+ stdout = Out()
570
+ stdin = In()
571
+
572
+ client = MCPClient(name="fake", config=MCPServerConfig(command="x"))
573
+ client._process = Proc()
574
+ assert await client._request("a", {}) == {"n": 1}
575
+ assert await client._request("b", {}) == {"n": 2}
576
+ replies = [json.loads(b) for b in Proc.stdin.sent]
577
+ assert {"jsonrpc": "2.0", "id": "s1", "result": {}} in replies
578
+
579
+
580
+ async def test_hook_flooding_stderr_before_stdout_does_not_deadlock(settings, project, ctx):
581
+ """stdout and stderr must drain concurrently: 256KB of stderr fills the pipe
582
+ buffer, and a runner reading stdout to EOF first would hang to the timeout."""
583
+ code = (
584
+ "import sys\n"
585
+ "sys.stderr.write('x' * 262144)\nsys.stderr.flush()\n"
586
+ "sys.stdout.write('done')\nsys.exit(2)\n"
587
+ )
588
+ settings.hooks = {
589
+ "PreToolUse": [HookMatcher(matcher="*", hooks=[python_hook(code, project, timeout=10)])]
590
+ }
591
+ runner = HookRunner(settings, project)
592
+
593
+ outcome = await runner.run_pre_tool("Read", ReadArgs(file_path="a.py"), ctx)
594
+
595
+ assert outcome is not None and outcome.blocked