hyperloop 0.7.0__tar.gz → 0.8.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 (83) hide show
  1. {hyperloop-0.7.0 → hyperloop-0.8.0}/.gitignore +1 -0
  2. {hyperloop-0.7.0 → hyperloop-0.8.0}/CHANGELOG.md +8 -0
  3. hyperloop-0.8.0/LICENSE +202 -0
  4. {hyperloop-0.7.0 → hyperloop-0.8.0}/PKG-INFO +68 -2
  5. {hyperloop-0.7.0 → hyperloop-0.8.0}/README.md +66 -1
  6. {hyperloop-0.7.0 → hyperloop-0.8.0}/pyproject.toml +1 -1
  7. hyperloop-0.8.0/src/hyperloop/adapters/matrix_setup.py +290 -0
  8. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/cli.py +9 -9
  9. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/config.py +9 -3
  10. {hyperloop-0.7.0 → hyperloop-0.8.0}/uv.lock +1 -1
  11. {hyperloop-0.7.0 → hyperloop-0.8.0}/.github/workflows/ci.yaml +0 -0
  12. {hyperloop-0.7.0 → hyperloop-0.8.0}/.github/workflows/release.yaml +0 -0
  13. {hyperloop-0.7.0 → hyperloop-0.8.0}/.pre-commit-config.yaml +0 -0
  14. {hyperloop-0.7.0 → hyperloop-0.8.0}/.python-version +0 -0
  15. {hyperloop-0.7.0 → hyperloop-0.8.0}/CLAUDE.md +0 -0
  16. {hyperloop-0.7.0 → hyperloop-0.8.0}/base/implementer.yaml +0 -0
  17. {hyperloop-0.7.0 → hyperloop-0.8.0}/base/kustomization.yaml +0 -0
  18. {hyperloop-0.7.0 → hyperloop-0.8.0}/base/pm.yaml +0 -0
  19. {hyperloop-0.7.0 → hyperloop-0.8.0}/base/process-improver.yaml +0 -0
  20. {hyperloop-0.7.0 → hyperloop-0.8.0}/base/process.yaml +0 -0
  21. {hyperloop-0.7.0 → hyperloop-0.8.0}/base/rebase-resolver.yaml +0 -0
  22. {hyperloop-0.7.0 → hyperloop-0.8.0}/base/verifier.yaml +0 -0
  23. {hyperloop-0.7.0 → hyperloop-0.8.0}/specs/observability.md +0 -0
  24. {hyperloop-0.7.0 → hyperloop-0.8.0}/specs/prompts/checklist.md +0 -0
  25. {hyperloop-0.7.0 → hyperloop-0.8.0}/specs/prompts/checks/check_result_file.sh +0 -0
  26. {hyperloop-0.7.0 → hyperloop-0.8.0}/specs/prompts/rules.md +0 -0
  27. {hyperloop-0.7.0 → hyperloop-0.8.0}/specs/spec.md +0 -0
  28. {hyperloop-0.7.0 → hyperloop-0.8.0}/specs/tasks/task-001.md +0 -0
  29. {hyperloop-0.7.0 → hyperloop-0.8.0}/specs/tasks/task-002.md +0 -0
  30. {hyperloop-0.7.0 → hyperloop-0.8.0}/specs/tasks/task-003.md +0 -0
  31. {hyperloop-0.7.0 → hyperloop-0.8.0}/specs/tasks/task-004.md +0 -0
  32. {hyperloop-0.7.0 → hyperloop-0.8.0}/specs/tasks/task-005.md +0 -0
  33. {hyperloop-0.7.0 → hyperloop-0.8.0}/specs/tasks/task-006.md +0 -0
  34. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/__init__.py +0 -0
  35. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/__main__.py +0 -0
  36. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/adapters/__init__.py +0 -0
  37. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/adapters/git_state.py +0 -0
  38. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/adapters/local.py +0 -0
  39. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/adapters/matrix_probe.py +0 -0
  40. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/adapters/probe.py +0 -0
  41. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/adapters/serial.py +0 -0
  42. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/adapters/structlog_probe.py +0 -0
  43. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/compose.py +0 -0
  44. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/domain/__init__.py +0 -0
  45. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/domain/decide.py +0 -0
  46. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/domain/deps.py +0 -0
  47. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/domain/model.py +0 -0
  48. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/domain/pipeline.py +0 -0
  49. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/logging.py +0 -0
  50. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/loop.py +0 -0
  51. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/ports/__init__.py +0 -0
  52. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/ports/pr.py +0 -0
  53. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/ports/probe.py +0 -0
  54. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/ports/runtime.py +0 -0
  55. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/ports/serial.py +0 -0
  56. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/ports/state.py +0 -0
  57. {hyperloop-0.7.0 → hyperloop-0.8.0}/src/hyperloop/pr.py +0 -0
  58. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/__init__.py +0 -0
  59. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/fakes/__init__.py +0 -0
  60. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/fakes/pr.py +0 -0
  61. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/fakes/probe.py +0 -0
  62. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/fakes/runtime.py +0 -0
  63. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/fakes/serial.py +0 -0
  64. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/fakes/state.py +0 -0
  65. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_cli.py +0 -0
  66. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_compose.py +0 -0
  67. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_config.py +0 -0
  68. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_decide.py +0 -0
  69. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_deps.py +0 -0
  70. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_e2e.py +0 -0
  71. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_fakes.py +0 -0
  72. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_git_state.py +0 -0
  73. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_local_runtime.py +0 -0
  74. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_loop.py +0 -0
  75. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_matrix_probe.py +0 -0
  76. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_model.py +0 -0
  77. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_pipeline.py +0 -0
  78. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_pr.py +0 -0
  79. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_probe.py +0 -0
  80. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_serial_agents.py +0 -0
  81. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_smoke.py +0 -0
  82. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_state_contract.py +0 -0
  83. {hyperloop-0.7.0 → hyperloop-0.8.0}/tests/test_structlog_probe.py +0 -0
@@ -8,3 +8,4 @@ dist/
8
8
  build/
9
9
  .venv/
10
10
  worktrees/
11
+ .hyperloop/
@@ -2,6 +2,14 @@
2
2
 
3
3
  <!-- version list -->
4
4
 
5
+ ## v0.8.0 (2026-04-15)
6
+
7
+ ### Features
8
+
9
+ - **matrix**: Auto-register bot and create room
10
+ ([`fc0d2dd`](https://github.com/jsell-rh/hyperloop/commit/fc0d2dd77cfc11f392af635ec516b3f131bc5a81))
11
+
12
+
5
13
  ## v0.7.0 (2026-04-15)
6
14
 
7
15
  ### Features
@@ -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.
@@ -1,7 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperloop
3
- Version: 0.7.0
3
+ Version: 0.8.0
4
4
  Summary: Orchestrator that walks tasks through composable process pipelines using AI agents
5
+ License-File: LICENSE
5
6
  Requires-Python: >=3.12
6
7
  Requires-Dist: httpx>=0.27
7
8
  Requires-Dist: pyyaml>=6.0.3
@@ -244,13 +245,78 @@ merge:
244
245
  poll_interval: 30 # seconds between orchestrator cycles
245
246
  max_rounds: 50 # max retry rounds per task before failure
246
247
  max_rebase_attempts: 3 # max rebase retries before full loop retry
248
+
249
+ observability:
250
+ log_format: console # console (human-readable) | json (for log aggregators)
251
+ log_level: info # debug | info | warning | error
252
+
253
+ matrix: # optional — omit entire section to disable
254
+ homeserver: https://matrix.example.com
255
+ registration_token_env: MATRIX_REGISTRATION_TOKEN # env var — auto-registers bot + creates room
256
+ # bot_username: hyperloop-bot # override default (hyperloop-{repo_name})
257
+ # room_id: "!abc123:example.com" # override auto-created room
258
+ # token_env: MATRIX_ACCESS_TOKEN # override auto-registered token
259
+ verbose: false # true: send worker_spawned, cycle_completed, etc.
260
+ ```
261
+
262
+ ## Observability
263
+
264
+ Hyperloop uses structured logging via [structlog](https://www.structlog.org/). Every interesting moment in the orchestrator lifecycle emits a typed probe call that gets rendered as a structured log entry.
265
+
266
+ ### Log output
267
+
268
+ Console mode (default):
269
+ ```
270
+ 2026-04-15T14:23:01Z [info ] worker_reaped cycle=7 duration_s=142.3 role=verifier spec_ref=specs/persistence.md task_id=task-003 verdict=pass
271
+ 2026-04-15T14:23:01Z [warning ] task_looped_back cycle=7 findings_count=3 round=2 spec_ref=specs/widget.md task_id=task-001
247
272
  ```
248
273
 
274
+ JSON mode (`log_format: json`):
275
+ ```json
276
+ {"timestamp": "2026-04-15T14:23:01Z", "level": "info", "event": "worker_reaped", "task_id": "task-003", "role": "verifier", "verdict": "pass", "cycle": 7, "duration_s": 142.3}
277
+ ```
278
+
279
+ ### Matrix notifications
280
+
281
+ Send real-time status updates to a [Matrix](https://matrix.org/) room. Each task's messages are threaded together.
282
+
283
+ **Quickstart (auto-setup):** Just provide a homeserver and a registration token. Hyperloop registers a bot user and creates a room automatically:
284
+
285
+ ```bash
286
+ export MATRIX_REGISTRATION_TOKEN=your_synapse_registration_token
287
+ ```
288
+ ```yaml
289
+ # .hyperloop.yaml
290
+ observability:
291
+ matrix:
292
+ homeserver: https://matrix.example.com
293
+ registration_token_env: MATRIX_REGISTRATION_TOKEN
294
+ ```
295
+
296
+ Credentials and room ID are cached in `.hyperloop/matrix-state.json` (gitignored) so registration only happens once.
297
+
298
+ **Manual setup:** If you already have a bot account and room, provide them directly:
299
+
300
+ ```bash
301
+ export MATRIX_ACCESS_TOKEN=syt_your_token_here
302
+ ```
303
+ ```yaml
304
+ observability:
305
+ matrix:
306
+ homeserver: https://matrix.example.com
307
+ room_id: "!abc123:example.com"
308
+ token_env: MATRIX_ACCESS_TOKEN
309
+ ```
310
+
311
+ High-signal events are always sent (worker results, task completions/failures, merge outcomes, orchestrator halt). Set `verbose: true` to also see worker spawns, cycle completions, and intake runs. Noisy events (cycle starts, gate polls, phase transitions) are never sent to Matrix.
312
+
313
+ Matrix failures are logged and swallowed — a Matrix outage never stalls the orchestrator.
314
+
249
315
  ## Development
250
316
 
251
317
  ```bash
252
318
  uv sync --all-extras
253
- uv run pytest # run tests (280 tests)
319
+ uv run pytest # run tests (~390 tests)
254
320
  uv run ruff check . # lint
255
321
  uv run ruff format --check . # format check
256
322
  uv run pyright # type check
@@ -227,13 +227,78 @@ merge:
227
227
  poll_interval: 30 # seconds between orchestrator cycles
228
228
  max_rounds: 50 # max retry rounds per task before failure
229
229
  max_rebase_attempts: 3 # max rebase retries before full loop retry
230
+
231
+ observability:
232
+ log_format: console # console (human-readable) | json (for log aggregators)
233
+ log_level: info # debug | info | warning | error
234
+
235
+ matrix: # optional — omit entire section to disable
236
+ homeserver: https://matrix.example.com
237
+ registration_token_env: MATRIX_REGISTRATION_TOKEN # env var — auto-registers bot + creates room
238
+ # bot_username: hyperloop-bot # override default (hyperloop-{repo_name})
239
+ # room_id: "!abc123:example.com" # override auto-created room
240
+ # token_env: MATRIX_ACCESS_TOKEN # override auto-registered token
241
+ verbose: false # true: send worker_spawned, cycle_completed, etc.
242
+ ```
243
+
244
+ ## Observability
245
+
246
+ Hyperloop uses structured logging via [structlog](https://www.structlog.org/). Every interesting moment in the orchestrator lifecycle emits a typed probe call that gets rendered as a structured log entry.
247
+
248
+ ### Log output
249
+
250
+ Console mode (default):
251
+ ```
252
+ 2026-04-15T14:23:01Z [info ] worker_reaped cycle=7 duration_s=142.3 role=verifier spec_ref=specs/persistence.md task_id=task-003 verdict=pass
253
+ 2026-04-15T14:23:01Z [warning ] task_looped_back cycle=7 findings_count=3 round=2 spec_ref=specs/widget.md task_id=task-001
230
254
  ```
231
255
 
256
+ JSON mode (`log_format: json`):
257
+ ```json
258
+ {"timestamp": "2026-04-15T14:23:01Z", "level": "info", "event": "worker_reaped", "task_id": "task-003", "role": "verifier", "verdict": "pass", "cycle": 7, "duration_s": 142.3}
259
+ ```
260
+
261
+ ### Matrix notifications
262
+
263
+ Send real-time status updates to a [Matrix](https://matrix.org/) room. Each task's messages are threaded together.
264
+
265
+ **Quickstart (auto-setup):** Just provide a homeserver and a registration token. Hyperloop registers a bot user and creates a room automatically:
266
+
267
+ ```bash
268
+ export MATRIX_REGISTRATION_TOKEN=your_synapse_registration_token
269
+ ```
270
+ ```yaml
271
+ # .hyperloop.yaml
272
+ observability:
273
+ matrix:
274
+ homeserver: https://matrix.example.com
275
+ registration_token_env: MATRIX_REGISTRATION_TOKEN
276
+ ```
277
+
278
+ Credentials and room ID are cached in `.hyperloop/matrix-state.json` (gitignored) so registration only happens once.
279
+
280
+ **Manual setup:** If you already have a bot account and room, provide them directly:
281
+
282
+ ```bash
283
+ export MATRIX_ACCESS_TOKEN=syt_your_token_here
284
+ ```
285
+ ```yaml
286
+ observability:
287
+ matrix:
288
+ homeserver: https://matrix.example.com
289
+ room_id: "!abc123:example.com"
290
+ token_env: MATRIX_ACCESS_TOKEN
291
+ ```
292
+
293
+ High-signal events are always sent (worker results, task completions/failures, merge outcomes, orchestrator halt). Set `verbose: true` to also see worker spawns, cycle completions, and intake runs. Noisy events (cycle starts, gate polls, phase transitions) are never sent to Matrix.
294
+
295
+ Matrix failures are logged and swallowed — a Matrix outage never stalls the orchestrator.
296
+
232
297
  ## Development
233
298
 
234
299
  ```bash
235
300
  uv sync --all-extras
236
- uv run pytest # run tests (280 tests)
301
+ uv run pytest # run tests (~390 tests)
237
302
  uv run ruff check . # lint
238
303
  uv run ruff format --check . # format check
239
304
  uv run pyright # type check
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hyperloop"
3
- version = "0.7.0"
3
+ version = "0.8.0"
4
4
  description = "Orchestrator that walks tasks through composable process pipelines using AI agents"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -0,0 +1,290 @@
1
+ """Matrix auto-setup — bot registration, room creation, credential caching.
2
+
3
+ On first run: registers a bot user via the Matrix registration API, creates
4
+ a notification room, and caches credentials in ``.hyperloop/matrix-state.json``.
5
+ On subsequent runs: loads from cache and skips registration/room-creation.
6
+
7
+ Explicit ``token_env`` and ``room_id`` in config always take precedence over
8
+ auto-setup and cache.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import json
14
+ import logging
15
+ import secrets
16
+ from typing import TYPE_CHECKING, cast
17
+
18
+ import httpx
19
+
20
+ if TYPE_CHECKING:
21
+ from pathlib import Path
22
+
23
+ from hyperloop.config import MatrixConfig
24
+
25
+ _log = logging.getLogger(__name__)
26
+
27
+ _CACHE_FILE = ".hyperloop/matrix-state.json"
28
+
29
+
30
+ # ---------------------------------------------------------------------------
31
+ # Cache
32
+ # ---------------------------------------------------------------------------
33
+
34
+
35
+ def _load_cache(repo_path: Path, homeserver: str) -> dict[str, str] | None:
36
+ """Load cached Matrix credentials if they match the current homeserver."""
37
+ cache_path = repo_path / _CACHE_FILE
38
+ if not cache_path.is_file():
39
+ return None
40
+ try:
41
+ raw: object = json.loads(cache_path.read_text())
42
+ if not isinstance(raw, dict):
43
+ return None
44
+ data: dict[str, object] = cast("dict[str, object]", raw)
45
+ if data.get("homeserver") != homeserver:
46
+ return None
47
+ return {k: str(v) for k, v in data.items()}
48
+ except (json.JSONDecodeError, OSError):
49
+ return None
50
+
51
+
52
+ def _save_cache(
53
+ repo_path: Path,
54
+ *,
55
+ homeserver: str,
56
+ user_id: str,
57
+ access_token: str,
58
+ room_id: str,
59
+ password: str,
60
+ ) -> None:
61
+ """Persist Matrix credentials to the cache file."""
62
+ cache_path = repo_path / _CACHE_FILE
63
+ cache_path.parent.mkdir(parents=True, exist_ok=True)
64
+ cache_path.write_text(
65
+ json.dumps(
66
+ {
67
+ "homeserver": homeserver,
68
+ "user_id": user_id,
69
+ "access_token": access_token,
70
+ "room_id": room_id,
71
+ "password": password,
72
+ },
73
+ indent=2,
74
+ )
75
+ + "\n"
76
+ )
77
+
78
+
79
+ # ---------------------------------------------------------------------------
80
+ # Matrix API calls
81
+ # ---------------------------------------------------------------------------
82
+
83
+
84
+ def _register_bot(
85
+ client: httpx.Client,
86
+ homeserver: str,
87
+ registration_token: str,
88
+ username: str,
89
+ password: str,
90
+ ) -> tuple[str, str]:
91
+ """Register a bot user. Returns (user_id, access_token).
92
+
93
+ Uses Synapse's shared-secret registration flow. If the user already
94
+ exists (HTTP 400), falls back to login with the given password.
95
+ """
96
+ url = f"{homeserver}/_matrix/client/v3/register"
97
+ body = {
98
+ "username": username,
99
+ "password": password,
100
+ "auth": {
101
+ "type": "m.login.registration_token",
102
+ "token": registration_token,
103
+ },
104
+ "initial_device_display_name": "hyperloop",
105
+ "inhibit_login": False,
106
+ }
107
+
108
+ resp = client.post(url, json=body)
109
+
110
+ if resp.status_code == 200:
111
+ data = resp.json()
112
+ return str(data["user_id"]), str(data["access_token"])
113
+
114
+ if resp.status_code == 401:
115
+ # Server requires a different auth flow — try the flows it offers
116
+ data = resp.json()
117
+ flows = data.get("flows", [])
118
+ session = data.get("session", "")
119
+
120
+ # Check if m.login.registration_token is among the available flows
121
+ for flow in flows:
122
+ stages = flow.get("stages", [])
123
+ if "m.login.registration_token" in stages:
124
+ body["auth"] = {
125
+ "type": "m.login.registration_token",
126
+ "token": registration_token,
127
+ "session": session,
128
+ }
129
+ resp = client.post(url, json=body)
130
+ if resp.status_code == 200:
131
+ data = resp.json()
132
+ return str(data["user_id"]), str(data["access_token"])
133
+
134
+ if resp.status_code == 400:
135
+ # User likely already exists — try login
136
+ return _login(client, homeserver, username, password)
137
+
138
+ resp.raise_for_status()
139
+ msg = f"Unexpected registration response: {resp.status_code}"
140
+ raise RuntimeError(msg)
141
+
142
+
143
+ def _login(
144
+ client: httpx.Client,
145
+ homeserver: str,
146
+ username: str,
147
+ password: str,
148
+ ) -> tuple[str, str]:
149
+ """Log in with username/password. Returns (user_id, access_token)."""
150
+ url = f"{homeserver}/_matrix/client/v3/login"
151
+ body = {
152
+ "type": "m.login.password",
153
+ "identifier": {"type": "m.id.user", "user": username},
154
+ "password": password,
155
+ "initial_device_display_name": "hyperloop",
156
+ }
157
+
158
+ resp = client.post(url, json=body)
159
+ resp.raise_for_status()
160
+ data = resp.json()
161
+ return str(data["user_id"]), str(data["access_token"])
162
+
163
+
164
+ def _create_room(
165
+ client: httpx.Client,
166
+ homeserver: str,
167
+ access_token: str,
168
+ room_name: str,
169
+ ) -> str:
170
+ """Create a private Matrix room. Returns the room_id."""
171
+ url = f"{homeserver}/_matrix/client/v3/createRoom"
172
+ body = {
173
+ "name": room_name,
174
+ "topic": "hyperloop orchestrator notifications",
175
+ "visibility": "private",
176
+ "preset": "private_chat",
177
+ }
178
+
179
+ resp = client.post(
180
+ url,
181
+ json=body,
182
+ headers={"Authorization": f"Bearer {access_token}"},
183
+ )
184
+ resp.raise_for_status()
185
+ data = resp.json()
186
+ return str(data["room_id"])
187
+
188
+
189
+ # ---------------------------------------------------------------------------
190
+ # Public API
191
+ # ---------------------------------------------------------------------------
192
+
193
+
194
+ def ensure_matrix_ready(
195
+ config: MatrixConfig,
196
+ repo_path: Path,
197
+ ) -> tuple[str, str]:
198
+ """Ensure Matrix credentials and room are available.
199
+
200
+ Resolution order:
201
+ 1. Explicit ``token_env`` + ``room_id`` in config → use directly (no setup).
202
+ 2. Cached credentials in ``.hyperloop/matrix-state.json`` → reuse.
203
+ 3. ``registration_token`` → register bot, create room, cache.
204
+
205
+ Returns:
206
+ (access_token, room_id) tuple. Either or both may be empty string
207
+ if Matrix cannot be set up (logged as warning, never raises).
208
+ """
209
+ import os
210
+
211
+ homeserver = config.homeserver.rstrip("/")
212
+
213
+ # 1. Explicit token from env takes precedence
214
+ explicit_token = os.environ.get(config.token_env) if config.token_env else ""
215
+ explicit_room = config.room_id
216
+
217
+ if explicit_token and explicit_room:
218
+ return explicit_token, explicit_room
219
+
220
+ # 2. Try cache
221
+ cache = _load_cache(repo_path, homeserver)
222
+ if cache is not None:
223
+ cached_token = cache.get("access_token", "")
224
+ cached_room = cache.get("room_id", "")
225
+ # Allow explicit overrides to supplement cache
226
+ token = explicit_token or cached_token
227
+ room_id = explicit_room or cached_room
228
+ if token and room_id:
229
+ return token, room_id
230
+
231
+ # 3. Auto-setup via registration_token from env
232
+ registration_token = (
233
+ os.environ.get(config.registration_token_env) if config.registration_token_env else ""
234
+ )
235
+ if not registration_token:
236
+ _log.warning(
237
+ "Matrix: no access token, no cached credentials, and no registration token — skipping"
238
+ )
239
+ return "", ""
240
+
241
+ try:
242
+ return _auto_setup(config, repo_path, homeserver, registration_token, cache)
243
+ except Exception:
244
+ _log.exception("Matrix auto-setup failed — skipping Matrix notifications")
245
+ return "", ""
246
+
247
+
248
+ def _auto_setup(
249
+ config: MatrixConfig,
250
+ repo_path: Path,
251
+ homeserver: str,
252
+ registration_token: str,
253
+ cache: dict[str, str] | None,
254
+ ) -> tuple[str, str]:
255
+ """Register bot, create room, cache credentials. Returns (token, room_id)."""
256
+ # Derive bot username
257
+ repo_name = repo_path.name
258
+ username = config.bot_username or f"hyperloop-{repo_name}"
259
+
260
+ # Reuse cached password if available, otherwise generate one
261
+ password = cache.get("password", "") if cache else ""
262
+ if not password:
263
+ password = secrets.token_urlsafe(32)
264
+
265
+ client = httpx.Client(timeout=30.0)
266
+ try:
267
+ # Register or login
268
+ user_id, access_token = _register_bot(
269
+ client, homeserver, registration_token, username, password
270
+ )
271
+
272
+ # Create room if needed
273
+ room_id = config.room_id
274
+ if not room_id:
275
+ room_id = _create_room(client, homeserver, access_token, f"hyperloop-{repo_name}")
276
+
277
+ # Cache for next run
278
+ _save_cache(
279
+ repo_path,
280
+ homeserver=homeserver,
281
+ user_id=user_id,
282
+ access_token=access_token,
283
+ room_id=room_id,
284
+ password=password,
285
+ )
286
+
287
+ _log.info("Matrix auto-setup complete: user=%s room=%s", user_id, room_id)
288
+ return access_token, room_id
289
+ finally:
290
+ client.close()
@@ -95,11 +95,12 @@ def _make_composer(cfg: Config, state: StateStore) -> tuple[PromptComposer, Proc
95
95
  return PromptComposer.load_from_kustomize(cfg.overlay, state, base_ref=cfg.base_ref)
96
96
 
97
97
 
98
- def _build_probe(obs_cfg: ObservabilityConfig) -> OrchestratorProbe:
98
+ def _build_probe(obs_cfg: ObservabilityConfig, repo_path: Path) -> OrchestratorProbe:
99
99
  """Construct an OrchestratorProbe from observability config.
100
100
 
101
101
  Always includes a StructlogProbe. Optionally adds a MatrixProbe if
102
- Matrix config is present and the access token is set.
102
+ Matrix config is present and credentials can be resolved (explicit
103
+ token, cached credentials, or auto-registration).
103
104
  """
104
105
  from hyperloop.adapters.probe import MultiProbe
105
106
  from hyperloop.adapters.structlog_probe import StructlogProbe
@@ -110,17 +111,16 @@ def _build_probe(obs_cfg: ObservabilityConfig) -> OrchestratorProbe:
110
111
  probes: list[OrchestratorProbe] = [StructlogProbe()]
111
112
 
112
113
  if obs_cfg.matrix is not None:
113
- import os
114
-
115
114
  from hyperloop.adapters.matrix_probe import MatrixProbe
115
+ from hyperloop.adapters.matrix_setup import ensure_matrix_ready
116
116
 
117
- token = os.environ.get(obs_cfg.matrix.token_env)
118
- if token:
117
+ access_token, room_id = ensure_matrix_ready(obs_cfg.matrix, repo_path)
118
+ if access_token and room_id:
119
119
  probes.append(
120
120
  MatrixProbe(
121
121
  homeserver=obs_cfg.matrix.homeserver,
122
- room_id=obs_cfg.matrix.room_id,
123
- access_token=token,
122
+ room_id=room_id,
123
+ access_token=access_token,
124
124
  verbose=obs_cfg.matrix.verbose,
125
125
  )
126
126
  )
@@ -246,7 +246,7 @@ def run(
246
246
  # Build observability probe
247
247
  obs_cfg = getattr(cfg, "observability", None)
248
248
  if obs_cfg is not None:
249
- probe = _build_probe(obs_cfg)
249
+ probe = _build_probe(obs_cfg, repo_path)
250
250
  else:
251
251
  from hyperloop.adapters.probe import NullProbe
252
252
 
@@ -30,6 +30,8 @@ class MatrixConfig:
30
30
  room_id: str
31
31
  token_env: str
32
32
  verbose: bool
33
+ registration_token_env: str # env var holding the registration token
34
+ bot_username: str
33
35
 
34
36
 
35
37
  @dataclass(frozen=True)
@@ -141,6 +143,8 @@ def _flatten_yaml(raw: dict[str, object]) -> dict[str, object]:
141
143
  flat["matrix_room_id"] = mx.get("room_id", "")
142
144
  flat["matrix_token_env"] = mx.get("token_env", "")
143
145
  flat["matrix_verbose"] = mx.get("verbose", False)
146
+ flat["matrix_registration_token_env"] = mx.get("registration_token_env", "")
147
+ flat["matrix_bot_username"] = mx.get("bot_username", "")
144
148
 
145
149
  return flat
146
150
 
@@ -195,14 +199,16 @@ def load_config(
195
199
  # Build ObservabilityConfig
196
200
  matrix_cfg: MatrixConfig | None = None
197
201
  homeserver = str(values.get("matrix_homeserver", ""))
198
- room_id = str(values.get("matrix_room_id", ""))
199
202
  token_env = str(values.get("matrix_token_env", ""))
200
- if homeserver and room_id and token_env:
203
+ registration_token_env = str(values.get("matrix_registration_token_env", ""))
204
+ if homeserver and (token_env or registration_token_env):
201
205
  matrix_cfg = MatrixConfig(
202
206
  homeserver=homeserver,
203
- room_id=room_id,
207
+ room_id=str(values.get("matrix_room_id", "")),
204
208
  token_env=token_env,
205
209
  verbose=bool(values.get("matrix_verbose", False)),
210
+ registration_token_env=registration_token_env,
211
+ bot_username=str(values.get("matrix_bot_username", "")),
206
212
  )
207
213
 
208
214
  obs_cfg = ObservabilityConfig(
@@ -120,7 +120,7 @@ wheels = [
120
120
 
121
121
  [[package]]
122
122
  name = "hyperloop"
123
- version = "0.6.1"
123
+ version = "0.7.0"
124
124
  source = { editable = "." }
125
125
  dependencies = [
126
126
  { name = "httpx" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes