teddy-cli 0.2.3.dev1530__py3-none-any.whl → 0.2.3.dev1532__py3-none-any.whl
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.
- {teddy_cli-0.2.3.dev1530.dist-info → teddy_cli-0.2.3.dev1532.dist-info}/METADATA +30 -1
- {teddy_cli-0.2.3.dev1530.dist-info → teddy_cli-0.2.3.dev1532.dist-info}/RECORD +18 -18
- teddy_executor/__main__.py +9 -2
- teddy_executor/adapters/inbound/session_cli_handlers.py +26 -10
- teddy_executor/adapters/inbound/textual_plan_reviewer_helpers.py +21 -10
- teddy_executor/adapters/inbound/textual_plan_reviewer_logic.py +2 -1
- teddy_executor/core/domain/models/config_schema.py +8 -0
- teddy_executor/core/domain/models/project_context.py +2 -0
- teddy_executor/core/ports/inbound/get_context_use_case.py +4 -1
- teddy_executor/core/services/context_service.py +14 -8
- teddy_executor/core/services/planning_service.py +3 -1
- teddy_executor/core/services/session_orchestrator.py +1 -0
- teddy_executor/core/services/update_checker.py +15 -9
- teddy_executor/core/utils/markdown.py +40 -7
- teddy_executor/resources/config/config.yaml +3 -0
- {teddy_cli-0.2.3.dev1530.dist-info → teddy_cli-0.2.3.dev1532.dist-info}/WHEEL +0 -0
- {teddy_cli-0.2.3.dev1530.dist-info → teddy_cli-0.2.3.dev1532.dist-info}/entry_points.txt +0 -0
- {teddy_cli-0.2.3.dev1530.dist-info → teddy_cli-0.2.3.dev1532.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: teddy-cli
|
|
3
|
-
Version: 0.2.3.
|
|
3
|
+
Version: 0.2.3.dev1532
|
|
4
4
|
Summary: The local-first, test-driven agentic engineering harness. Because you should own the means of development.
|
|
5
5
|
Author: Raphael Atteritano
|
|
6
6
|
License: AGPL-3.0-only
|
|
@@ -194,6 +194,35 @@ uv tool install teddy-cli --pre --force
|
|
|
194
194
|
> [!WARNING]
|
|
195
195
|
> Experimental versions are published as PEP 440 dev pre-releases on PyPI and may include breaking changes or unstable features.
|
|
196
196
|
|
|
197
|
+
### Installing From a Fork or Private Index
|
|
198
|
+
|
|
199
|
+
TeDDy can run from a fork or a private package index, and the update check can follow the same source. Because the version check reads the installed `teddy-cli` distribution metadata, every install shape must keep the distribution name `teddy-cli` — a git install, a local wheel, and a private index all do. Only a public PyPI upload under a different name would need a second knob.
|
|
200
|
+
|
|
201
|
+
Install from a git URL:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
uv tool install git+https://github.com/<you>/teddy
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Install from a private index:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
uv tool install teddy-cli --default-index https://packages.example.com/simple
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Then point the update check at your own source by setting `update.index_url` in `.teddy/config.yaml`:
|
|
214
|
+
|
|
215
|
+
```yaml
|
|
216
|
+
update:
|
|
217
|
+
index_url: "https://packages.example.com/pypi/teddy-cli/json"
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
The source only needs to be PyPI-JSON-shaped. A static `version.json` served from your fork's repository works too, as long as it carries `{"info": {"version": "x.y.z"}}`. That `info.version` fallback ignores `--experimental`, so a static source reports the same version with or without the flag.
|
|
221
|
+
|
|
222
|
+
`uv tool upgrade teddy-cli` re-resolves the upgrade from the index recorded in its install receipt, so a fork installed from a private index upgrades in place. A git install upgrades by reinstalling from the same git URL.
|
|
223
|
+
|
|
224
|
+
`teddy update` reads `.teddy/config.yaml` from the current directory, so run it from the project root. The `checks.update: false` toggle silences the startup notice only; the background fetch still runs, and `teddy update` always compares against the configured source.
|
|
225
|
+
|
|
197
226
|
### Initialize
|
|
198
227
|
|
|
199
228
|
```bash
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
teddy_executor/__init__.py,sha256=xZ4r3lFwNLQ4C4vOl7Q_-5dh3TlWw3-nXR8O8yjV2o0,58
|
|
2
|
-
teddy_executor/__main__.py,sha256=
|
|
2
|
+
teddy_executor/__main__.py,sha256=GFCEQ-huv7Yuqr2CY0KhXLORPoJGuL-caa6jnA-07kE,22721
|
|
3
3
|
teddy_executor/container.py,sha256=84cvKQJ3Rxg5gqTdTMSYgzehzKtIzS8dItgrpQ3qH14,16366
|
|
4
4
|
teddy_executor/prompts.py,sha256=GXYGu4RuNhv67fbdREHUvPapi2JH9fKqBe8rhDR6z6U,2150
|
|
5
5
|
teddy_executor/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
teddy_executor/adapters/inbound/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
teddy_executor/adapters/inbound/cli_formatter.py,sha256=9bWL2S-3vZFBJZPd4RG2xTBYWu1Tim6U0AMGRjcUHB8,3548
|
|
8
8
|
teddy_executor/adapters/inbound/cli_helpers.py,sha256=yXGJYEPPMCmH2AKBwEhW-CkWmHGf7OgDTOE-qMLR4d0,9377
|
|
9
|
-
teddy_executor/adapters/inbound/session_cli_handlers.py,sha256=
|
|
9
|
+
teddy_executor/adapters/inbound/session_cli_handlers.py,sha256=D0Mefeq-3GcEzNQdp99Q7P7-MnpgHRfZEAS4VsHp0tc,62609
|
|
10
10
|
teddy_executor/adapters/inbound/textual_plan_reviewer.py,sha256=lJHoqaJShuvTVz7SvEdikHN_rMCXPbgolUVlYVkoc4s,3678
|
|
11
11
|
teddy_executor/adapters/inbound/textual_plan_reviewer_app.py,sha256=ipOw8QLoOfoGcZdo3R4-zaMBQ2RuHilk2dXsMGoYrBc,15209
|
|
12
12
|
teddy_executor/adapters/inbound/textual_plan_reviewer_editor.py,sha256=LbYlIXSoEc3PQ8o28O4lzybMBig9r0QKYFNKg90iso0,22235
|
|
13
13
|
teddy_executor/adapters/inbound/textual_plan_reviewer_execution.py,sha256=QjkAB4aP7URG1lAOShHrojtAbLWEXZINIHfIrAM8lIA,7322
|
|
14
|
-
teddy_executor/adapters/inbound/textual_plan_reviewer_helpers.py,sha256=
|
|
15
|
-
teddy_executor/adapters/inbound/textual_plan_reviewer_logic.py,sha256=
|
|
14
|
+
teddy_executor/adapters/inbound/textual_plan_reviewer_helpers.py,sha256=IoCfxDIqn1iVw-ijefFe8tjztlzU0KBo8GqVUMnsTLo,12068
|
|
15
|
+
teddy_executor/adapters/inbound/textual_plan_reviewer_logic.py,sha256=En3jzsr0M_LwvEN2q0ZL8QhI8AmgRhI0QUnAhJJygQk,11460
|
|
16
16
|
teddy_executor/adapters/inbound/textual_plan_reviewer_previews.py,sha256=lNg0drAVGkQ40fmlK-IcDKh4tLCKzsSsXFq2gdjPBW0,12017
|
|
17
17
|
teddy_executor/adapters/inbound/textual_plan_reviewer_widgets.py,sha256=_-pfFY_71m0s3tDKzqH_l28fF563V0h3cZXYPKvS2kI,7356
|
|
18
18
|
teddy_executor/adapters/outbound/__init__.py,sha256=YN-oxkFQlMVrj3YdAJoLKXA_uo91cSU4llc3UHJ1Ckg,157
|
|
@@ -40,14 +40,14 @@ teddy_executor/core/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
40
40
|
teddy_executor/core/domain/models/__init__.py,sha256=yok7EZ3_cUwVGPGjBwTLg-zL4XTyQs2xAi_4VPKdKCk,1062
|
|
41
41
|
teddy_executor/core/domain/models/action_ports.py,sha256=vCMBtLS1thqT1YcGRScwapQ9MXKbvKg3zWeEGpJ5IhE,733
|
|
42
42
|
teddy_executor/core/domain/models/change_set.py,sha256=FgR553--lmcX-3tqjEkRhpwPpvEnLXWZ14Vkc2XgV_k,207
|
|
43
|
-
teddy_executor/core/domain/models/config_schema.py,sha256=
|
|
43
|
+
teddy_executor/core/domain/models/config_schema.py,sha256=rPNxZH6HpfLIAdmDiqpwQ0uxU1_nMQ_0S_7kwb6LSXI,12575
|
|
44
44
|
teddy_executor/core/domain/models/drift_report.py,sha256=K1R6OkySD2RfKU9bV0D5mVGl1PMfwlIKgFp5YSBJm0E,1406
|
|
45
45
|
teddy_executor/core/domain/models/exceptions.py,sha256=kR6-vUECe06kVem0KoeHo9OEdQIFFB2AP58eWNo9qYs,1243
|
|
46
46
|
teddy_executor/core/domain/models/execution_report.py,sha256=1jUI1YHhx0FruuMh6gYyOTlRye9ubFtnxpEgLNdu53g,1801
|
|
47
47
|
teddy_executor/core/domain/models/orchestrator_ports.py,sha256=aBnyC2KYBpBz1khLiQ9n9fPOrqt07xYyjNXDugh0r80,1165
|
|
48
48
|
teddy_executor/core/domain/models/plan.py,sha256=J2fgkY2OOOJ2HXHmfrey0O8rDPCezw-047us-3V3qGc,2284
|
|
49
49
|
teddy_executor/core/domain/models/planning_ports.py,sha256=vZ0e4LRJHSCEMRApX-M1PmUvuSlhLQ1NCPfzBSpn4ko,2199
|
|
50
|
-
teddy_executor/core/domain/models/project_context.py,sha256=
|
|
50
|
+
teddy_executor/core/domain/models/project_context.py,sha256=gZc2SaKDUR7KNC47PZVLCj57RPfJxIPv9LFGkDRjOYU,1827
|
|
51
51
|
teddy_executor/core/domain/models/report_assembly_data.py,sha256=HuLqpha3cZ_V7BZ8pdsdIxnxVvCJ8_-o30PQVdkydrE,432
|
|
52
52
|
teddy_executor/core/domain/models/session.py,sha256=hiAhnvtAD1VawCWtbkIu6wvRt2_th3PcCClLJ6CwcAo,385
|
|
53
53
|
teddy_executor/core/domain/models/shell_output.py,sha256=yUmK9_tobgWAVr8_J47FGH7x8GpkwYfaH1CLFp6l-ls,486
|
|
@@ -55,7 +55,7 @@ teddy_executor/core/domain/models/web_search_results.py,sha256=ZugVr76XB2QdS-vum
|
|
|
55
55
|
teddy_executor/core/ports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
56
|
teddy_executor/core/ports/inbound/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
57
|
teddy_executor/core/ports/inbound/edit_simulator.py,sha256=Pu4tBJxK4ensZO1gH_YE_NuVMG99qzy6v5Q4pN_VT5s,1087
|
|
58
|
-
teddy_executor/core/ports/inbound/get_context_use_case.py,sha256=
|
|
58
|
+
teddy_executor/core/ports/inbound/get_context_use_case.py,sha256=JYYvG6f0UYh0CTcJ39oTUvAR9UfYifiu1lSeWHR9tlA,1324
|
|
59
59
|
teddy_executor/core/ports/inbound/init.py,sha256=3iJH2I2ljpZq2-f-XditbmRySUgFuBFUF_j7UkY6p_E,2496
|
|
60
60
|
teddy_executor/core/ports/inbound/plan_parser.py,sha256=BaH1XQM23ys6l4YMcb2VTXs7IjW2TgklUqQ-8dthSYQ,1603
|
|
61
61
|
teddy_executor/core/ports/inbound/plan_reviewer.py,sha256=iHJfl4P7P6kOr2QERBAuXRaQwtgE7eiqOdQDpeMotmY,1247
|
|
@@ -89,7 +89,7 @@ teddy_executor/core/services/action_executor.py,sha256=kjlQM3Hx4Cmq95HKQyeYM3M0Y
|
|
|
89
89
|
teddy_executor/core/services/action_factory.py,sha256=-FV_V4sy7CcuuPU8Xb3mqvQp_-BaoVodorVcVjUjzVo,9305
|
|
90
90
|
teddy_executor/core/services/action_parser_complex.py,sha256=7vDUsHFvclElkdngCypZdzka1fZy0O4f__q4-MsulPI,6848
|
|
91
91
|
teddy_executor/core/services/action_parser_strategies.py,sha256=o_aBiMRiHsepmsNveYxmr1_Ll73KVhMSBaUA7nBE604,2705
|
|
92
|
-
teddy_executor/core/services/context_service.py,sha256=
|
|
92
|
+
teddy_executor/core/services/context_service.py,sha256=Buri7h1GXs1dXhQaIZEtB-JxrN3-SbtXgoRt4YXFdAg,21585
|
|
93
93
|
teddy_executor/core/services/edit_simulator.py,sha256=5Z_SCBfGHTaGi-JVIgyIDeTGr-5Pulm6A5Ifqn7SSmU,5512
|
|
94
94
|
teddy_executor/core/services/execution_orchestrator.py,sha256=jnfUR52_JKsDep0BVTTAhokiEQIOUx1WSjl9_d4y-qU,15047
|
|
95
95
|
teddy_executor/core/services/execution_report_assembler.py,sha256=227YExXeAtf0GQLnc4IDLKqZi1QsxOYKqvMcWSs2NVo,2396
|
|
@@ -100,17 +100,17 @@ teddy_executor/core/services/parser_infrastructure.py,sha256=joDtWf3rXsEaDSasTff
|
|
|
100
100
|
teddy_executor/core/services/parser_metadata.py,sha256=HEbzQpISeEQqD8xGiXQhaOtV8FdJz5pOnkb9hk1cVII,8493
|
|
101
101
|
teddy_executor/core/services/parser_reporting.py,sha256=shD3UAiFTooQH_AvLk5GR3rZmqoXmIZXuxymqxwggwQ,9988
|
|
102
102
|
teddy_executor/core/services/plan_validator.py,sha256=fHCuMo3ETkJgP5Nbcy0JuFGucUyk5Pgo-GoQB7XPiT0,2906
|
|
103
|
-
teddy_executor/core/services/planning_service.py,sha256=
|
|
103
|
+
teddy_executor/core/services/planning_service.py,sha256=1Ah4roSn8nSVdNhxJlrNVeUoxkYBjXsBEjMfy9cAqFA,11945
|
|
104
104
|
teddy_executor/core/services/prompt_manager.py,sha256=NJpgeqxwPaYfrmC5ZrGfmIs-HC4bHoTwu3uaKcfFSxA,10613
|
|
105
105
|
teddy_executor/core/services/session_lifecycle_manager.py,sha256=AzbjYzlc968bEGVH8257s-dYYW5yTqHYS1y0PJ4XEPo,36213
|
|
106
106
|
teddy_executor/core/services/session_loop_guard.py,sha256=_z45KXaF7VQJTXQT18M6QR5Lq6VCzKqrbhugXg7UWVk,4480
|
|
107
|
-
teddy_executor/core/services/session_orchestrator.py,sha256=
|
|
107
|
+
teddy_executor/core/services/session_orchestrator.py,sha256=_NIXCgd8sRjbBwgcxLN-99SqDkoubGWVPxN_w_sjOJk,27683
|
|
108
108
|
teddy_executor/core/services/session_planner.py,sha256=hrb3EBXzNAfV1qyCKR159oUMRB29Vv02ZmyPwLhcYpc,1695
|
|
109
109
|
teddy_executor/core/services/session_pruning_service.py,sha256=ZufCk452G3V1iYUbFpGNq6mZZHG6Zwk_6QvXYqx1tgk,16100
|
|
110
110
|
teddy_executor/core/services/session_replanner.py,sha256=-6r0wGSz9TMOPZi9rKe2OWMhufQso45yrA93z4FA6Fc,2629
|
|
111
111
|
teddy_executor/core/services/session_repository.py,sha256=vgcXOrHQ0xoUVvLE-t_QNpxXIDe3vM0eWwbJTcSBbeQ,9356
|
|
112
112
|
teddy_executor/core/services/session_service.py,sha256=FFfaDvxLrlzzSBRIWdHSoHQ1haI5l5sZ7xE0Q104qvQ,25649
|
|
113
|
-
teddy_executor/core/services/update_checker.py,sha256=
|
|
113
|
+
teddy_executor/core/services/update_checker.py,sha256=rdH8NhF6ndICEij6Stb3E4GDUQ5HUoWXH1tJS8EJaoQ,7223
|
|
114
114
|
teddy_executor/core/services/templates/execution_report.md.j2,sha256=j40t2RYuI87Bjqzu4XWWjMKoRPNKUh1h3Pmz7XI2Ylg,12895
|
|
115
115
|
teddy_executor/core/services/validation_rules/__init__.py,sha256=Pe0dCWgssakypne3Yi0R1UK_T7gn6WZjjAk7YHcLUT8,128
|
|
116
116
|
teddy_executor/core/services/validation_rules/edit.py,sha256=uVHrbmxXQXQuVXDCR-1fsEsdyCpkjL5kau0HWf2d7bA,7712
|
|
@@ -126,7 +126,7 @@ teddy_executor/core/utils/editor_names.py,sha256=Z1OSyNYLexgGmt7tcxyjb43_DsY14cC
|
|
|
126
126
|
teddy_executor/core/utils/interrupt_guard.py,sha256=T-HnfIaQl-X_xVIORu76K-z5BpvOcfwqL2yfG0X9eq4,6072
|
|
127
127
|
teddy_executor/core/utils/interruptible_call.py,sha256=9Q_9a3cD9krbdoimx5GGIIUjplK1of2JaqxEu5APOnE,1749
|
|
128
128
|
teddy_executor/core/utils/io.py,sha256=rK5GyhPXKqkl6R-HNAMezJwNeMsC3Ae18g32rMKcMpk,4058
|
|
129
|
-
teddy_executor/core/utils/markdown.py,sha256=
|
|
129
|
+
teddy_executor/core/utils/markdown.py,sha256=aA92YkiXc5FnBXQEGjt6Lv0Oyg2j-FUFjtjBKN20dx4,10433
|
|
130
130
|
teddy_executor/core/utils/message_renderer.py,sha256=nn1be_BctJK2aw0GPIQsABi-HJE5_Lfz7xDyKzHlT_w,2598
|
|
131
131
|
teddy_executor/core/utils/paths.py,sha256=iDRNcqtWEUvJVZOFLPEcoPdwtRCmqF5HHhV050GPsas,3421
|
|
132
132
|
teddy_executor/core/utils/serialization.py,sha256=V_1jyPeRm670HlbIKhrW8LP1s6O4UCc8xo0kmky9EDs,1237
|
|
@@ -141,7 +141,7 @@ teddy_executor/registries/validators.py,sha256=82SNpawuzWV2dtJcMAVP7wOpjoJ0hViR2
|
|
|
141
141
|
teddy_executor/resources/MRP.md,sha256=j9Z_UZRxZpDTK5vtG6yuwhCThgYGpaDvMU17YJntbVs,16722
|
|
142
142
|
teddy_executor/resources/__init__.py,sha256=h835ykuoc9Xv0E4UIaHmi8iVnhPKYqhwkLzHV5jRQEs,45
|
|
143
143
|
teddy_executor/resources/config/__init__.py,sha256=R96a_JS3GOty_5vsGg8AcR3cQYotYXCELrIzWFhn4kE,61
|
|
144
|
-
teddy_executor/resources/config/config.yaml,sha256=
|
|
144
|
+
teddy_executor/resources/config/config.yaml,sha256=IzSxhQyGxu_HJSOS04mV97KRGjGyo7TxqfrxLfGKr4c,3239
|
|
145
145
|
teddy_executor/resources/config/init.context,sha256=9J70exhvHAzqHX8kin2PuVtPi2JZp-TAzZr-PV8EYSg,87
|
|
146
146
|
teddy_executor/resources/config/prompts/architect.md,sha256=aVU16aeCmTCon_Qvo8eiozujTBfuoLD_3UsnP-qKj4o,7517
|
|
147
147
|
teddy_executor/resources/config/prompts/assistant.md,sha256=GKlQ-JJ08zTcb-gWjuZtv2TDK8AqbIlEiS4Ov4r1J1A,2466
|
|
@@ -159,8 +159,8 @@ teddy_executor/resources/templates/milestone.md,sha256=PwHedgzqRQnKQq4M4GILmmv7Y
|
|
|
159
159
|
teddy_executor/resources/templates/pre-commit.md,sha256=NqllfAw8Z0yvt51QJ6OBW18dccrJniLGibSylkatvRM,7684
|
|
160
160
|
teddy_executor/resources/templates/specification-document.md,sha256=skYPZ7E0m2n2STEWOKCHeiuqNtsshYzI49rmsNSKAuA,671
|
|
161
161
|
teddy_executor/resources/templates/vertical-slice.md,sha256=Cn8Y_rb6BZvy9bKBDNXhGfoSgMpsZbIBfyFQgrdx8Jg,5563
|
|
162
|
-
teddy_cli-0.2.3.
|
|
163
|
-
teddy_cli-0.2.3.
|
|
164
|
-
teddy_cli-0.2.3.
|
|
165
|
-
teddy_cli-0.2.3.
|
|
166
|
-
teddy_cli-0.2.3.
|
|
162
|
+
teddy_cli-0.2.3.dev1532.dist-info/METADATA,sha256=oBVGtssz0FumXYgKkCGxNoX_gzejxpUus6aLRwtIuyM,32268
|
|
163
|
+
teddy_cli-0.2.3.dev1532.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
164
|
+
teddy_cli-0.2.3.dev1532.dist-info/entry_points.txt,sha256=3KaK1-CWsscLZeHduI6Jgime9aw_gfmdQZ7AUkA0QDg,54
|
|
165
|
+
teddy_cli-0.2.3.dev1532.dist-info/licenses/LICENSE,sha256=HBL2C3ynq_mk-EYtJI7aXEc6gXnXgKJ-K6KZ13N0Ojs,35270
|
|
166
|
+
teddy_cli-0.2.3.dev1532.dist-info/RECORD,,
|
teddy_executor/__main__.py
CHANGED
|
@@ -400,12 +400,19 @@ def update(
|
|
|
400
400
|
fetch_latest_version,
|
|
401
401
|
compare_versions,
|
|
402
402
|
is_prerelease,
|
|
403
|
-
|
|
403
|
+
resolve_index_url,
|
|
404
404
|
)
|
|
405
405
|
|
|
406
|
+
# The check resolves configuration read-only: it never anchors or
|
|
407
|
+
# initializes a project, so a missing `.teddy/config.yaml` falls back to
|
|
408
|
+
# the bundled defaults and the official endpoint.
|
|
409
|
+
container = get_container()
|
|
410
|
+
config_service = _resolve_config_or_exit(container)
|
|
411
|
+
index_url = resolve_index_url(config_service.get_setting("update.index_url"))
|
|
412
|
+
|
|
406
413
|
# Dev pre-releases are published to PyPI (see .github/workflows/publish.yml),
|
|
407
414
|
# so --experimental only widens the check to include prereleases.
|
|
408
|
-
latest = fetch_latest_version(
|
|
415
|
+
latest = fetch_latest_version(index_url, stable_only=not experimental)
|
|
409
416
|
|
|
410
417
|
if latest is None:
|
|
411
418
|
typer.echo("Could not check for updates: network error.")
|
|
@@ -35,6 +35,7 @@ from teddy_executor.core.services.update_checker import (
|
|
|
35
35
|
get_current_version,
|
|
36
36
|
is_prerelease,
|
|
37
37
|
read_update_cache,
|
|
38
|
+
resolve_index_url,
|
|
38
39
|
)
|
|
39
40
|
|
|
40
41
|
|
|
@@ -406,17 +407,21 @@ def _update_cache_path() -> Path:
|
|
|
406
407
|
return find_project_root() / ".teddy" / ".update_cache.json"
|
|
407
408
|
|
|
408
409
|
|
|
409
|
-
def _start_background_update_check() -> None:
|
|
410
|
+
def _start_background_update_check(container: Container) -> None:
|
|
410
411
|
"""Start the daemon version fetch that fills the cache for the next run.
|
|
411
412
|
|
|
412
|
-
The fetch never blocks startup and never prints. The
|
|
413
|
-
the
|
|
413
|
+
The fetch never blocks startup and never prints. The configured source
|
|
414
|
+
resolves before the thread spawns, so the daemon never touches the
|
|
415
|
+
container. The startup preamble emits the notice from the cache this fetch
|
|
416
|
+
leaves behind.
|
|
414
417
|
"""
|
|
415
418
|
import threading
|
|
416
419
|
|
|
420
|
+
config_service = container.resolve(IConfigService)
|
|
421
|
+
index_url = resolve_index_url(config_service.get_setting("update.index_url"))
|
|
417
422
|
thread = threading.Thread(
|
|
418
423
|
target=background_check,
|
|
419
|
-
args=(_update_cache_path(),),
|
|
424
|
+
args=(_update_cache_path(), index_url),
|
|
420
425
|
daemon=True,
|
|
421
426
|
)
|
|
422
427
|
thread.start()
|
|
@@ -800,9 +805,6 @@ def _display_update_notification(container: Container, cache_path: Path) -> list
|
|
|
800
805
|
)
|
|
801
806
|
return ["checks.update"]
|
|
802
807
|
except Exception:
|
|
803
|
-
import logging
|
|
804
|
-
|
|
805
|
-
logger = logging.getLogger(__name__)
|
|
806
808
|
logger.debug("Failed to display update notification", exc_info=True)
|
|
807
809
|
return []
|
|
808
810
|
|
|
@@ -823,7 +825,7 @@ def handle_new_session( # noqa: PLR0913
|
|
|
823
825
|
max_cost: Optional[float] = None,
|
|
824
826
|
):
|
|
825
827
|
"""Logic for the 'start' command."""
|
|
826
|
-
_start_background_update_check()
|
|
828
|
+
_start_background_update_check(container)
|
|
827
829
|
|
|
828
830
|
try:
|
|
829
831
|
# 0. An empty or whitespace-only -m means the flag was omitted: the
|
|
@@ -1401,6 +1403,18 @@ def detect_session_context() -> Optional[Dict[str, Sequence[str]]]:
|
|
|
1401
1403
|
return None
|
|
1402
1404
|
|
|
1403
1405
|
|
|
1406
|
+
def detect_session_root() -> Optional[str]:
|
|
1407
|
+
"""Resolves the current session's root, or None outside a session.
|
|
1408
|
+
|
|
1409
|
+
Derives from `detect_session_context` so the three-file session gate lives
|
|
1410
|
+
in one place. The scope map that function returns must not be reused as a
|
|
1411
|
+
path source, because `--only` and `-c` override it.
|
|
1412
|
+
"""
|
|
1413
|
+
if detect_session_context() is None:
|
|
1414
|
+
return None
|
|
1415
|
+
return str(Path.cwd().parent)
|
|
1416
|
+
|
|
1417
|
+
|
|
1404
1418
|
def _default_context_paths(container: Container) -> list[str]:
|
|
1405
1419
|
"""Resolves the default `.teddy/*.context` entries outside a session."""
|
|
1406
1420
|
file_system_manager = container.resolve(IFileSystemManager)
|
|
@@ -1436,7 +1450,9 @@ def handle_context_gathering(
|
|
|
1436
1450
|
|
|
1437
1451
|
# Performance: Formatting context for Markdown doesn't use tokens, so we skip them.
|
|
1438
1452
|
context_result = context_service.get_context(
|
|
1439
|
-
context_files=context_files,
|
|
1453
|
+
context_files=context_files,
|
|
1454
|
+
include_tokens=False,
|
|
1455
|
+
session_root=detect_session_root(),
|
|
1440
1456
|
)
|
|
1441
1457
|
formatted_context = format_project_context(context_result)
|
|
1442
1458
|
echo_and_copy(formatted_context, no_copy=no_copy)
|
|
@@ -1515,7 +1531,7 @@ def handle_resume_session( # noqa: PLR0913
|
|
|
1515
1531
|
max_cost: Optional[float] = None,
|
|
1516
1532
|
):
|
|
1517
1533
|
"""Logic for the 'resume' command."""
|
|
1518
|
-
_start_background_update_check()
|
|
1534
|
+
_start_background_update_check(container)
|
|
1519
1535
|
|
|
1520
1536
|
try:
|
|
1521
1537
|
# 1. Shared startup preamble (preflight only; workspace repairs are start-only)
|
|
@@ -77,18 +77,22 @@ def populate_context_detail(app: "ReviewerApp", pane: Any, data: Any) -> None:
|
|
|
77
77
|
f"{(app.project_context.system_prompt_tokens + system_info_tokens) / 1000.0:.1f}k",
|
|
78
78
|
)
|
|
79
79
|
)
|
|
80
|
+
session_root = app.project_context.session_root
|
|
80
81
|
session_tokens = sum(
|
|
81
82
|
i.token_count
|
|
82
83
|
for i in selected_items
|
|
83
|
-
if i.scope == "Session"
|
|
84
|
+
if i.scope == "Session"
|
|
85
|
+
and not is_session_history_path(i.path, session_root)
|
|
84
86
|
)
|
|
85
87
|
turn_tokens = sum(
|
|
86
88
|
i.token_count
|
|
87
89
|
for i in selected_items
|
|
88
|
-
if i.scope == "Turn" and not is_session_history_path(i.path)
|
|
90
|
+
if i.scope == "Turn" and not is_session_history_path(i.path, session_root)
|
|
89
91
|
)
|
|
90
92
|
history_tokens = sum(
|
|
91
|
-
i.token_count
|
|
93
|
+
i.token_count
|
|
94
|
+
for i in selected_items
|
|
95
|
+
if is_session_history_path(i.path, session_root)
|
|
92
96
|
)
|
|
93
97
|
|
|
94
98
|
pane.append(DetailItem("• Session", f"{session_tokens / 1000.0:.1f}k"))
|
|
@@ -99,7 +103,9 @@ def populate_context_detail(app: "ReviewerApp", pane: Any, data: Any) -> None:
|
|
|
99
103
|
# Editor helpers moved to textual_plan_reviewer_editor.py
|
|
100
104
|
|
|
101
105
|
|
|
102
|
-
def format_context_item_label(
|
|
106
|
+
def format_context_item_label(
|
|
107
|
+
item: "ContextItem", session_root: str | None = None
|
|
108
|
+
) -> str:
|
|
103
109
|
"""Format a context item label according to UI standards."""
|
|
104
110
|
status_colors = {
|
|
105
111
|
"M": "yellow",
|
|
@@ -119,7 +125,7 @@ def format_context_item_label(item: "ContextItem") -> str:
|
|
|
119
125
|
|
|
120
126
|
from teddy_executor.core.utils.markdown import get_session_history_display_name
|
|
121
127
|
|
|
122
|
-
disp_name = get_session_history_display_name(item.path)
|
|
128
|
+
disp_name = get_session_history_display_name(item.path, session_root)
|
|
123
129
|
display_path = disp_name if disp_name else item.path
|
|
124
130
|
|
|
125
131
|
if not item.selected:
|
|
@@ -139,11 +145,12 @@ def build_context_section(app: "ReviewerApp", tree: Any) -> Any:
|
|
|
139
145
|
HISTORY_LABEL,
|
|
140
146
|
)
|
|
141
147
|
from teddy_executor.core.utils.markdown import (
|
|
142
|
-
|
|
148
|
+
is_own_session_path,
|
|
143
149
|
is_session_history_path,
|
|
144
150
|
get_session_history_sort_key,
|
|
145
151
|
)
|
|
146
152
|
|
|
153
|
+
session_root = app.project_context.session_root
|
|
147
154
|
con_root = tree.root.add("[bold]Context[/]", data=CONTEXT_ROOT, expand=False)
|
|
148
155
|
con_root.add_leaf("[#888888 italic]System:[/]", data=SYSTEM_LABEL)
|
|
149
156
|
token_str = f" [#888888]{app.project_context.system_prompt_tokens / 1000.0:.1f}k[/]"
|
|
@@ -161,21 +168,25 @@ def build_context_section(app: "ReviewerApp", tree: Any) -> Any:
|
|
|
161
168
|
con_root.add_leaf(f"[#888888 italic]{scope}:[/]", data=label)
|
|
162
169
|
count = 0
|
|
163
170
|
for item in app.project_context.items:
|
|
164
|
-
if item.scope == scope and not
|
|
165
|
-
con_root.add_leaf(
|
|
171
|
+
if item.scope == scope and not is_own_session_path(item.path, session_root):
|
|
172
|
+
con_root.add_leaf(
|
|
173
|
+
format_context_item_label(item, session_root), data=item
|
|
174
|
+
)
|
|
166
175
|
count += 1
|
|
167
176
|
if count == 0:
|
|
168
177
|
con_root.add_leaf(" [#888888](None)[/]", data=label)
|
|
169
178
|
|
|
170
179
|
# Chronological history turns
|
|
171
180
|
history_items = [
|
|
172
|
-
item
|
|
181
|
+
item
|
|
182
|
+
for item in app.project_context.items
|
|
183
|
+
if is_session_history_path(item.path, session_root)
|
|
173
184
|
]
|
|
174
185
|
if history_items:
|
|
175
186
|
con_root.add_leaf("[#888888 italic]History:[/]", data=HISTORY_LABEL)
|
|
176
187
|
history_items.sort(key=lambda x: get_session_history_sort_key(x.path))
|
|
177
188
|
for item in history_items:
|
|
178
|
-
con_root.add_leaf(format_context_item_label(item), data=item)
|
|
189
|
+
con_root.add_leaf(format_context_item_label(item, session_root), data=item)
|
|
179
190
|
|
|
180
191
|
return con_root
|
|
181
192
|
|
|
@@ -184,7 +184,8 @@ def refresh_node_logic(app: ReviewerApp, node: Any) -> None:
|
|
|
184
184
|
if isinstance(node.data, ActionData):
|
|
185
185
|
node.label = format_node_label(node.data)
|
|
186
186
|
elif isinstance(node.data, ContextItem):
|
|
187
|
-
|
|
187
|
+
session_root = app.project_context.session_root if app.project_context else None
|
|
188
|
+
node.label = format_context_item_label(node.data, session_root)
|
|
188
189
|
|
|
189
190
|
|
|
190
191
|
def on_mount_logic(app: Any) -> None:
|
|
@@ -65,6 +65,11 @@ class ChecksConfig:
|
|
|
65
65
|
update: bool = True
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
@dataclass(frozen=True)
|
|
69
|
+
class UpdateConfig:
|
|
70
|
+
index_url: str = ""
|
|
71
|
+
|
|
72
|
+
|
|
68
73
|
@dataclass(frozen=True)
|
|
69
74
|
class AutoPruningConfig:
|
|
70
75
|
enabled: bool = True
|
|
@@ -93,6 +98,7 @@ class AppConfig:
|
|
|
93
98
|
context: ContextConfig = field(default_factory=ContextConfig)
|
|
94
99
|
research: ResearchConfig = field(default_factory=ResearchConfig)
|
|
95
100
|
checks: ChecksConfig = field(default_factory=ChecksConfig)
|
|
101
|
+
update: UpdateConfig = field(default_factory=UpdateConfig)
|
|
96
102
|
auto_pruning: AutoPruningConfig = field(default_factory=AutoPruningConfig)
|
|
97
103
|
guardrails: GuardrailsConfig = field(default_factory=GuardrailsConfig)
|
|
98
104
|
editor: str = ""
|
|
@@ -224,6 +230,7 @@ _SCHEMA_FIELDS: tuple[_FieldSpec, ...] = (
|
|
|
224
230
|
_FieldSpec("checks.prompts", "checks", "prompts", bool),
|
|
225
231
|
_FieldSpec("checks.templates", "checks", "templates", bool),
|
|
226
232
|
_FieldSpec("checks.update", "checks", "update", bool),
|
|
233
|
+
_FieldSpec("update.index_url", "update", "index_url", str),
|
|
227
234
|
_FieldSpec("auto_pruning.enabled", "auto_pruning", "enabled", bool),
|
|
228
235
|
_FieldSpec(
|
|
229
236
|
"auto_pruning.turn_context_threshold",
|
|
@@ -360,6 +367,7 @@ def construct_app_config(merged: Mapping[str, Any]) -> AppConfig:
|
|
|
360
367
|
context=ContextConfig(**group_overrides.get("context", {})),
|
|
361
368
|
research=ResearchConfig(**group_overrides.get("research", {})),
|
|
362
369
|
checks=ChecksConfig(**group_overrides.get("checks", {})),
|
|
370
|
+
update=UpdateConfig(**group_overrides.get("update", {})),
|
|
363
371
|
auto_pruning=AutoPruningConfig(**group_overrides.get("auto_pruning", {})),
|
|
364
372
|
guardrails=GuardrailsConfig(**group_overrides.get("guardrails", {})),
|
|
365
373
|
**top_level_overrides,
|
|
@@ -43,6 +43,7 @@ class ProjectContext:
|
|
|
43
43
|
agent_name: Name of the active agent.
|
|
44
44
|
system_prompt_tokens: Token count of the system prompt.
|
|
45
45
|
total_window: Total context window for the model.
|
|
46
|
+
session_root: Optional root of the session the context was assembled for.
|
|
46
47
|
"""
|
|
47
48
|
|
|
48
49
|
header: str
|
|
@@ -54,3 +55,4 @@ class ProjectContext:
|
|
|
54
55
|
system_prompt_tokens: int = 0
|
|
55
56
|
content_tokens: int = 0
|
|
56
57
|
total_window: int = 0
|
|
58
|
+
session_root: Optional[str] = None
|
|
@@ -8,7 +8,7 @@ class IGetContextUseCase(Protocol):
|
|
|
8
8
|
This defines the contract for the primary entry point for gathering project context.
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
-
def get_context(
|
|
11
|
+
def get_context( # noqa: PLR0913 - inbound-port seam; additive keyword
|
|
12
12
|
self,
|
|
13
13
|
context_files: Optional[Dict[str, Sequence[str]]] = None,
|
|
14
14
|
include_tokens: bool = True,
|
|
@@ -17,6 +17,7 @@ class IGetContextUseCase(Protocol):
|
|
|
17
17
|
cache_dir: Optional[str] = None,
|
|
18
18
|
current_turn: Optional[str] = None,
|
|
19
19
|
system_prompt_tokens: int = 0,
|
|
20
|
+
session_root: Optional[str] = None,
|
|
20
21
|
) -> ProjectContext:
|
|
21
22
|
"""
|
|
22
23
|
Gathers all project context information.
|
|
@@ -25,6 +26,8 @@ class IGetContextUseCase(Protocol):
|
|
|
25
26
|
context_files: Optional mapping of scope names to .context files.
|
|
26
27
|
current_turn: Optional 2-digit turn number to include in the header.
|
|
27
28
|
system_prompt_tokens: Token count of the system prompt (pre-computed).
|
|
29
|
+
session_root: Optional root of the rendering session, used to gate
|
|
30
|
+
session-history classification.
|
|
28
31
|
|
|
29
32
|
Returns:
|
|
30
33
|
ProjectContext: A data object containing the aggregated context.
|
|
@@ -6,7 +6,8 @@ from teddy_executor.core.domain.models import ProjectContext, ContextItem
|
|
|
6
6
|
from teddy_executor.core.utils.markdown import (
|
|
7
7
|
embed_in_fence,
|
|
8
8
|
get_language_from_path,
|
|
9
|
-
|
|
9
|
+
is_own_session_path,
|
|
10
|
+
is_session_history_path,
|
|
10
11
|
get_session_history_display_name,
|
|
11
12
|
get_session_history_sort_key,
|
|
12
13
|
)
|
|
@@ -53,6 +54,7 @@ class ContextService(IGetContextUseCase):
|
|
|
53
54
|
cache_dir: Optional[str] = None,
|
|
54
55
|
current_turn: Optional[str] = None,
|
|
55
56
|
system_prompt_tokens: int = 0,
|
|
57
|
+
session_root: Optional[str] = None,
|
|
56
58
|
) -> ProjectContext:
|
|
57
59
|
"""
|
|
58
60
|
Gathers all project context information by orchestrating its dependencies.
|
|
@@ -108,7 +110,7 @@ class ContextService(IGetContextUseCase):
|
|
|
108
110
|
web_cache = {}
|
|
109
111
|
|
|
110
112
|
content = self._format_content(
|
|
111
|
-
repo_tree, scoped_paths, file_contents, git_status
|
|
113
|
+
repo_tree, scoped_paths, file_contents, git_status, session_root
|
|
112
114
|
)
|
|
113
115
|
content_tokens = (
|
|
114
116
|
self._llm_client.get_text_token_count(content) if include_tokens else 0
|
|
@@ -126,6 +128,7 @@ class ContextService(IGetContextUseCase):
|
|
|
126
128
|
total_window=total_window,
|
|
127
129
|
system_prompt_tokens=system_prompt_tokens,
|
|
128
130
|
content_tokens=content_tokens,
|
|
131
|
+
session_root=session_root,
|
|
129
132
|
)
|
|
130
133
|
|
|
131
134
|
def _cap_plan_contents(
|
|
@@ -391,6 +394,7 @@ class ContextService(IGetContextUseCase):
|
|
|
391
394
|
scoped_paths: Dict[str, List[str]],
|
|
392
395
|
file_contents: Dict[str, Optional[str]],
|
|
393
396
|
git_status: Optional[str] = None,
|
|
397
|
+
session_root: Optional[str] = None,
|
|
394
398
|
) -> str:
|
|
395
399
|
"""Formats the main content section of the context report."""
|
|
396
400
|
# Gather all unique paths
|
|
@@ -400,9 +404,10 @@ class ContextService(IGetContextUseCase):
|
|
|
400
404
|
if p not in all_paths:
|
|
401
405
|
all_paths.append(p)
|
|
402
406
|
|
|
403
|
-
# Partition
|
|
404
|
-
|
|
405
|
-
session_paths = [p for p in all_paths if
|
|
407
|
+
# Partition this session's own artifacts from ordinary resources. A path
|
|
408
|
+
# read from another session is a resource, not our own history.
|
|
409
|
+
session_paths = [p for p in all_paths if is_own_session_path(p, session_root)]
|
|
410
|
+
workspace_paths = [p for p in all_paths if p not in session_paths]
|
|
406
411
|
|
|
407
412
|
git_status_body = (
|
|
408
413
|
embed_in_fence(git_status, "")
|
|
@@ -424,7 +429,7 @@ class ContextService(IGetContextUseCase):
|
|
|
424
429
|
|
|
425
430
|
# Prepend Session History section first (after header's System Information)
|
|
426
431
|
session_history_parts = self._format_session_history(
|
|
427
|
-
session_paths, file_contents
|
|
432
|
+
session_paths, file_contents, session_root
|
|
428
433
|
)
|
|
429
434
|
if session_history_parts:
|
|
430
435
|
content_parts = session_history_parts + content_parts
|
|
@@ -514,13 +519,14 @@ class ContextService(IGetContextUseCase):
|
|
|
514
519
|
self,
|
|
515
520
|
session_paths: List[str],
|
|
516
521
|
file_contents: Dict[str, Optional[str]],
|
|
522
|
+
session_root: Optional[str] = None,
|
|
517
523
|
) -> List[str]:
|
|
518
524
|
"""Formats the session history section."""
|
|
519
525
|
if not session_paths:
|
|
520
526
|
return []
|
|
521
527
|
|
|
522
528
|
recognized_session_paths = [
|
|
523
|
-
p for p in session_paths if
|
|
529
|
+
p for p in session_paths if is_session_history_path(p, session_root)
|
|
524
530
|
]
|
|
525
531
|
if not recognized_session_paths:
|
|
526
532
|
return []
|
|
@@ -528,7 +534,7 @@ class ContextService(IGetContextUseCase):
|
|
|
528
534
|
recognized_session_paths.sort(key=get_session_history_sort_key)
|
|
529
535
|
parts = ["\n## Session History"]
|
|
530
536
|
for path in recognized_session_paths:
|
|
531
|
-
disp_name = get_session_history_display_name(path)
|
|
537
|
+
disp_name = get_session_history_display_name(path, session_root)
|
|
532
538
|
content = file_contents.get(path) or ""
|
|
533
539
|
content_str = content.strip()
|
|
534
540
|
lang = get_language_from_path(path)
|
|
@@ -72,12 +72,14 @@ class PlanningService(IPlanningUseCase):
|
|
|
72
72
|
except Exception:
|
|
73
73
|
system_token_count = 0
|
|
74
74
|
|
|
75
|
+
session_root = str(Path(turn_dir).parent)
|
|
75
76
|
context = self._context_service.get_context(
|
|
76
77
|
context_files=resolved_context_files,
|
|
77
78
|
agent_name=agent_name,
|
|
78
79
|
current_turn=Path(turn_dir).name,
|
|
79
80
|
system_prompt_tokens=system_token_count,
|
|
80
|
-
cache_dir=
|
|
81
|
+
cache_dir=session_root,
|
|
82
|
+
session_root=session_root,
|
|
81
83
|
)
|
|
82
84
|
|
|
83
85
|
# Context is purely project state (including initial_request.md via session.context).
|
|
@@ -8,6 +8,7 @@ functions use stdlib only (plus the
|
|
|
8
8
|
|
|
9
9
|
from __future__ import annotations
|
|
10
10
|
|
|
11
|
+
import logging
|
|
11
12
|
from pathlib import Path
|
|
12
13
|
from typing import TYPE_CHECKING, Optional
|
|
13
14
|
|
|
@@ -16,6 +17,8 @@ from packaging.version import Version
|
|
|
16
17
|
if TYPE_CHECKING:
|
|
17
18
|
import ssl
|
|
18
19
|
|
|
20
|
+
logger = logging.getLogger(__name__)
|
|
21
|
+
|
|
19
22
|
# --- Constants ---
|
|
20
23
|
|
|
21
24
|
PYPI_URL = "https://pypi.org/pypi/teddy-cli/json"
|
|
@@ -54,6 +57,18 @@ def _create_ssl_context() -> ssl.SSLContext:
|
|
|
54
57
|
# --- Public API ---
|
|
55
58
|
|
|
56
59
|
|
|
60
|
+
def resolve_index_url(configured: Optional[str]) -> str:
|
|
61
|
+
"""Resolve the configured update source, falling back to the official endpoint.
|
|
62
|
+
|
|
63
|
+
``None``, an empty string, or a whitespace-only value means "unset", so the
|
|
64
|
+
official ``PYPI_URL`` is returned. Any other value is stripped of
|
|
65
|
+
surrounding whitespace, because a stray space would otherwise make
|
|
66
|
+
``urllib`` fail with no visible cause.
|
|
67
|
+
"""
|
|
68
|
+
stripped = (configured or "").strip()
|
|
69
|
+
return stripped or PYPI_URL
|
|
70
|
+
|
|
71
|
+
|
|
57
72
|
def get_current_version() -> str:
|
|
58
73
|
"""
|
|
59
74
|
Read installed version from importlib.metadata.
|
|
@@ -118,9 +133,6 @@ def fetch_latest_version(
|
|
|
118
133
|
highest = max(valid_versions)
|
|
119
134
|
return str(highest)
|
|
120
135
|
except (urllib.error.URLError, OSError, json.JSONDecodeError, KeyError) as e:
|
|
121
|
-
import logging
|
|
122
|
-
|
|
123
|
-
logger = logging.getLogger(__name__)
|
|
124
136
|
logger.debug("fetch_latest_version failed: %s", e)
|
|
125
137
|
return None
|
|
126
138
|
|
|
@@ -196,9 +208,6 @@ def write_update_cache(cache_path: Path, latest_version: str) -> None:
|
|
|
196
208
|
)
|
|
197
209
|
tmp_path.rename(cache_path)
|
|
198
210
|
except OSError as e:
|
|
199
|
-
import logging
|
|
200
|
-
|
|
201
|
-
logger = logging.getLogger(__name__)
|
|
202
211
|
logger.debug("Failed to write update cache: %s", e)
|
|
203
212
|
if tmp_path.exists():
|
|
204
213
|
tmp_path.unlink()
|
|
@@ -211,12 +220,9 @@ def background_check(cache_path: Path, index_url: str = PYPI_URL) -> None:
|
|
|
211
220
|
and writes it to cache. Every error is swallowed and logged at debug
|
|
212
221
|
level, so a late cache write can never fail the owning process.
|
|
213
222
|
"""
|
|
214
|
-
import logging
|
|
215
|
-
|
|
216
223
|
try:
|
|
217
224
|
latest = fetch_latest_version(index_url)
|
|
218
225
|
if latest is not None:
|
|
219
226
|
write_update_cache(cache_path, latest)
|
|
220
227
|
except Exception as e:
|
|
221
|
-
logger = logging.getLogger(__name__)
|
|
222
228
|
logger.debug("background_check failed: %s", e)
|
|
@@ -229,11 +229,42 @@ def embed_in_fence(content: str, lang: str) -> str:
|
|
|
229
229
|
return f"{fence}{lang}\n{sanitized}\n{fence}"
|
|
230
230
|
|
|
231
231
|
|
|
232
|
-
def
|
|
232
|
+
def _normalize_session_path(path: str) -> str:
|
|
233
|
+
"""Normalize a path to POSIX slashes with any leading './' removed."""
|
|
234
|
+
return path.replace("\\", "/").lstrip("./")
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def _session_directory_name(session_root: str) -> str:
|
|
238
|
+
"""Return the final path component of a session root (its directory name)."""
|
|
239
|
+
return _normalize_session_path(session_root).rstrip("/").rsplit("/", 1)[-1]
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def is_own_session_path(path: str, session_root: str | None) -> bool:
|
|
243
|
+
"""
|
|
244
|
+
Determines whether ``path`` belongs to the session at ``session_root``.
|
|
245
|
+
|
|
246
|
+
Falls back to the coarse ``is_session_file_path`` test when no root is
|
|
247
|
+
supplied, so legacy callers keep their session-agnostic partition.
|
|
248
|
+
"""
|
|
249
|
+
if not is_session_file_path(path):
|
|
250
|
+
return False
|
|
251
|
+
if not session_root:
|
|
252
|
+
return True
|
|
253
|
+
session_name = _session_directory_name(session_root)
|
|
254
|
+
return session_name in _normalize_session_path(path).split("/")
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def get_session_history_display_name(
|
|
258
|
+
path: str, session_root: str | None = None
|
|
259
|
+
) -> str | None:
|
|
233
260
|
"""
|
|
234
261
|
Returns human-readable display name if it's a recognized session history file.
|
|
262
|
+
|
|
263
|
+
When ``session_root`` is supplied, a path outside that session is not history.
|
|
235
264
|
"""
|
|
236
|
-
|
|
265
|
+
if session_root and not is_own_session_path(path, session_root):
|
|
266
|
+
return None
|
|
267
|
+
clean_path = _normalize_session_path(path)
|
|
237
268
|
if "initial_request.md" in clean_path:
|
|
238
269
|
return "Initial Request"
|
|
239
270
|
plan_match = re.search(r"sessions/[^/]+/(\d+)/plan.md$", clean_path)
|
|
@@ -248,22 +279,24 @@ def get_session_history_display_name(path: str) -> str | None:
|
|
|
248
279
|
def is_session_file_path(path: str) -> bool:
|
|
249
280
|
"""
|
|
250
281
|
Determines if a path is inside .teddy/sessions/.
|
|
282
|
+
|
|
283
|
+
Normalizes backslashes first, so a Windows-style path is recognized too.
|
|
251
284
|
"""
|
|
252
|
-
return "sessions/" in path
|
|
285
|
+
return "sessions/" in _normalize_session_path(path)
|
|
253
286
|
|
|
254
287
|
|
|
255
|
-
def is_session_history_path(path: str) -> bool:
|
|
288
|
+
def is_session_history_path(path: str, session_root: str | None = None) -> bool:
|
|
256
289
|
"""
|
|
257
|
-
Determines if a path is a session history file
|
|
290
|
+
Determines if a path is a session history file for ``session_root``.
|
|
258
291
|
"""
|
|
259
|
-
return get_session_history_display_name(path) is not None
|
|
292
|
+
return get_session_history_display_name(path, session_root) is not None
|
|
260
293
|
|
|
261
294
|
|
|
262
295
|
def get_session_history_sort_key(path: str) -> tuple[int, int]:
|
|
263
296
|
"""
|
|
264
297
|
Sort key for chronological session history: (turn_number, sub_order).
|
|
265
298
|
"""
|
|
266
|
-
clean_path = path
|
|
299
|
+
clean_path = _normalize_session_path(path)
|
|
267
300
|
if "initial_request.md" in clean_path:
|
|
268
301
|
return (0, 0)
|
|
269
302
|
plan_match = re.search(r"sessions/[^/]+/(\d+)/plan.md$", clean_path)
|
|
@@ -32,6 +32,9 @@ checks:
|
|
|
32
32
|
templates: true # Warn when local docs/templates/ differ from bundled defaults.
|
|
33
33
|
update: true # Warn when a newer TeDDy release is available on PyPI.
|
|
34
34
|
|
|
35
|
+
# update:
|
|
36
|
+
# index_url: "" # Override the PyPI JSON endpoint for the update check (a fork's index or a static version.json); empty uses official PyPI.
|
|
37
|
+
|
|
35
38
|
yolo_default: false # When true, skips the plan review by default; overridden per-command by -n / --no-yolo.
|
|
36
39
|
|
|
37
40
|
guardrails: # Limits for yolo runs (--yolo) and pipeline runs. Counters reset on 'teddy resume' and on message turns if message_reset: true.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|