@yahyahammad/venastine 0.2.0 → 0.3.9
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.
- package/.env.example +9 -4
- package/CONFIG_ARCHITECTURE.md +2030 -0
- package/LICENSE +201 -201
- package/NOTICE +1 -1
- package/README.md +1034 -895
- package/agents/builtin/build.md +73 -0
- package/agents/builtin/compactor.md +75 -75
- package/agents/builtin/explore.md +77 -77
- package/agents/builtin/general.md +80 -0
- package/agents/builtin/pipeline-reviewer.md +100 -100
- package/agents/builtin/plan.md +106 -88
- package/agents/builtin/review.md +74 -74
- package/agents/builtin/test.md +65 -0
- package/agents/builtin/writer.md +67 -0
- package/agents/manager.py +68 -2
- package/agents/subagent_tool.py +472 -238
- package/agents/tui_commands.py +238 -151
- package/bin/venastine.mjs +150 -4
- package/bin/venastine.py +71 -0
- package/cli_commands.py +838 -0
- package/config.py +95 -1198
- package/config.yaml +1103 -0
- package/config_edit.py +1301 -0
- package/config_schema.py +971 -0
- package/config_update.py +749 -0
- package/core/agent_activity.py +256 -118
- package/core/ansi.py +452 -0
- package/core/approval.py +137 -115
- package/core/call_view.py +364 -0
- package/core/cancel.py +121 -0
- package/core/chatgpt_auth.py +747 -0
- package/core/claims_view.py +107 -0
- package/core/client.py +2715 -1559
- package/core/commands.py +460 -0
- package/core/compaction.py +1735 -971
- package/core/config_loader.py +1982 -1563
- package/core/connect.py +686 -0
- package/core/events.py +123 -61
- package/core/file_mentions.py +280 -0
- package/core/interaction.py +411 -328
- package/core/line_pattern.py +128 -0
- package/core/loop.py +2566 -1490
- package/core/memory.py +482 -370
- package/core/pipeline_models.py +190 -176
- package/core/provider_errors.py +234 -0
- package/core/reasoning/authorization.py +130 -130
- package/core/reasoning/base.py +219 -219
- package/core/reasoning/confidence_scoring.py +484 -468
- package/core/reasoning/events.py +149 -149
- package/core/reasoning/json_retry.py +19 -1
- package/core/reasoning/orchestrator.py +1561 -1382
- package/core/reasoning/output_writer.py +345 -286
- package/core/reasoning/payload_validation.py +524 -398
- package/core/reasoning/pipeline_storage.py +88 -22
- package/core/reasoning/review.py +659 -615
- package/core/reasoning/scholar.py +458 -434
- package/core/reasoning/source_corpus.py +433 -327
- package/core/reasoning/source_scoring.py +855 -855
- package/core/replay.py +315 -183
- package/core/session.py +36 -12
- package/core/session_view.py +259 -0
- package/core/session_wake.py +259 -0
- package/core/shell_sessions.py +1553 -0
- package/core/workspace_trust.py +1 -1
- package/credentials.py +148 -20
- package/database.py +333 -252
- package/{PRIVACY.md → docs/PRIVACY.md} +78 -66
- package/docs/SECURITY.md +108 -0
- package/docs/THIRD_PARTY_NOTICES.md +148 -0
- package/env_secrets.py +50 -9
- package/json_store.py +343 -123
- package/logging_setup.py +295 -185
- package/main.py +3433 -1961
- package/mcp_client/client.py +733 -499
- package/mcp_client/config.py +126 -21
- package/mcp_client/registration.py +343 -182
- package/memories/manager.py +147 -132
- package/memories/tui_commands.py +319 -244
- package/package.json +303 -73
- package/project_init/config_files.py +282 -278
- package/project_init/generator.py +728 -564
- package/project_init/manifest.py +18 -6
- package/project_init/tui_commands.py +147 -144
- package/prompts/critic_pass.md +24 -24
- package/prompts/revalidate.md +25 -25
- package/prompts/revise.md +2 -0
- package/prompts/source_grounding.md +66 -66
- package/prompts/system_prompts.py +316 -262
- package/providers.json.example +4 -2
- package/pyproject.toml +149 -100
- package/requirements.txt +295 -72
- package/safety/policy_enforcement.py +1082 -746
- package/security/askpass.py +419 -0
- package/security/capability.py +207 -177
- package/security/confine.py +484 -0
- package/security/hosted.py +182 -0
- package/security/permissions.py +237 -190
- package/security/posture.py +124 -12
- package/security/protected_paths.py +501 -309
- package/security/sandbox.py +4108 -985
- package/security/secrets.py +855 -0
- package/skills/builtin/math/formal-specification.md +67 -67
- package/skills/builtin/math/numerical-methods.md +66 -66
- package/skills/builtin/research/experiment-design.md +62 -62
- package/skills/builtin/research/reproducibility.md +55 -55
- package/skills/builtin/research/source-evaluation.md +70 -70
- package/skills/builtin/research/statistical-inference.md +63 -63
- package/skills/builtin/research/technical-writing.md +59 -59
- package/skills/builtin/software/code-review.md +61 -61
- package/skills/builtin/software/debugging.md +61 -61
- package/skills/builtin/software/test-design.md +67 -67
- package/skills/tui_commands.py +110 -111
- package/storage.py +1338 -1005
- package/tools/base.py +161 -1
- package/tools/builtin/_math_common.py +667 -377
- package/tools/builtin/_net_common.py +225 -19
- package/tools/builtin/arxiv.py +497 -39
- package/tools/builtin/ask_user.py +231 -213
- package/tools/builtin/discrete_math.py +35 -4
- package/tools/builtin/fetch_url.py +371 -153
- package/tools/builtin/file_ops.py +720 -412
- package/tools/builtin/geometry.py +48 -12
- package/tools/builtin/get_time.py +2 -2
- package/tools/builtin/linear_algebra.py +66 -23
- package/tools/builtin/load_skill.py +76 -66
- package/tools/builtin/logic.py +171 -12
- package/tools/builtin/pin.py +227 -193
- package/tools/builtin/probability_stats.py +12 -16
- package/tools/builtin/project_docs.py +464 -405
- package/tools/builtin/remember.py +175 -158
- package/tools/builtin/shell.py +980 -461
- package/tools/builtin/shell_sessions.py +613 -0
- package/tools/builtin/symbolic_math.py +80 -10
- package/tools/builtin/todo.py +149 -147
- package/tools/builtin/web_search.py +191 -13
- package/tools/context.py +159 -136
- package/tools/isolation.py +107 -34
- package/tools/registry.py +1242 -925
- package/tui/app.py +8318 -4100
- package/tui/app.tcss +747 -556
- package/tui/commands.py +26 -170
- package/tui/diffs.py +34 -13
- package/tui/history.py +128 -128
- package/tui/hosted_driver.py +102 -0
- package/tui/markdown.py +1329 -1279
- package/tui/meters.py +364 -268
- package/tui/ravens.py +146 -146
- package/tui/screens.py +1255 -943
- package/tui/themes.py +599 -559
- package/tui/widgets.py +3813 -2332
- package/SECURITY.md +0 -88
- package/THIRD_PARTY_NOTICES.md +0 -100
|
@@ -1,309 +1,501 @@
|
|
|
1
|
-
"""
|
|
2
|
-
security/protected_paths.py
|
|
3
|
-
|
|
4
|
-
The trees a sandboxed command must never be able to WRITE: the harness's
|
|
5
|
-
own source, and the user-tier state that decides what the harness trusts
|
|
6
|
-
and what it spawns.
|
|
7
|
-
|
|
8
|
-
WHY THIS EXISTS. security/sandbox.py's Docker backend binds
|
|
9
|
-
config.WORKSPACE_DIR read-write at /workspace and never asked what was on
|
|
10
|
-
the other side of that mount. A SANDBOXED command under CONTAINED with no
|
|
11
|
-
network is AUTO-APPROVED (security/capability.auto_approved), so nothing
|
|
12
|
-
prompts -- which meant a workspace pointed at the harness's own directory
|
|
13
|
-
handed every run unattended read-write access to the code it was about to
|
|
14
|
-
execute next, and a workspace pointed at a home directory did the same to
|
|
15
|
-
`~/.config/venastine/`. That directory holds `trusted_projects.json` (the
|
|
16
|
-
D17 gate: a write there marks arbitrary projects trusted) and `mcp.json`
|
|
17
|
-
(which NAMES COMMANDS the harness spawns at startup). Neither is a file
|
|
18
|
-
the model should be able to edit through a tool it did not have to ask
|
|
19
|
-
about.
|
|
20
|
-
|
|
21
|
-
The agent cannot cause this by itself -- WORKSPACE_DIR is bound once at
|
|
22
|
-
import (config.py) and a child shell's `export` dies with the subprocess,
|
|
23
|
-
which was measured rather than assumed. This is a MISCONFIGURATION
|
|
24
|
-
boundary: it makes a workspace that overlaps the harness a startup error
|
|
25
|
-
instead of a silent grant.
|
|
26
|
-
|
|
27
|
-
TWO CLASSES, and the split is the design rather than tidiness:
|
|
28
|
-
|
|
29
|
-
CRITICAL the harness install tree and the user config dir. A
|
|
30
|
-
workspace that IS one of these, or sits inside one, is
|
|
31
|
-
refused outright -- there is no mount arrangement that
|
|
32
|
-
rescues it, and nobody has such a layout on purpose.
|
|
33
|
-
|
|
34
|
-
SENSITIVE providers.json, the database, the log directory. These are
|
|
35
|
-
ro-mounted when they fall inside the workspace but NEVER
|
|
36
|
-
refuse it, because each is user-configurable to anywhere:
|
|
37
|
-
AGENT_LOG_FILE can legitimately point at a file in $HOME,
|
|
38
|
-
and letting that refuse a $HOME workspace would turn a
|
|
39
|
-
logging preference into a launch failure.
|
|
40
|
-
|
|
41
|
-
This generalises security/sandbox._venastine_readonly_mount, which does
|
|
42
|
-
the same job for a `.venastine/` nested in the workspace and whose
|
|
43
|
-
docstring already named this gap: "does not cover ... the harness's own
|
|
44
|
-
`agents/builtin` when the workspace is the harness repo."
|
|
45
|
-
|
|
46
|
-
THE PROTECTED SEGMENT at the bottom of this file is the module's second
|
|
47
|
-
job, added because everything above answered only half the question. The
|
|
48
|
-
trees and ro-mounts stop a SANDBOXED command from writing what it should
|
|
49
|
-
not; nothing stopped the agent's own read/write/edit tools from reaching
|
|
50
|
-
the same material once AGENT_WORKSPACE was pointed at the project --
|
|
51
|
-
workspace membership is the only rule those tools apply, so `.venastine/`
|
|
52
|
-
was an auto-approved path the moment it sat inside one. PROTECTED_SEGMENTS
|
|
53
|
-
is the one list every consumer reads (the file tools' refusal_check and
|
|
54
|
-
handlers, and shell.py's approval check), so the segment cannot drift
|
|
55
|
-
between them.
|
|
56
|
-
|
|
57
|
-
KNOWN LIMITS, stated because a half-understood control is worse than
|
|
58
|
-
none. This covers WRITES on the DOCKER path. It does not cover reads, and
|
|
59
|
-
it does not cover the subprocess fallback, which mounts nothing and has
|
|
60
|
-
no filesystem isolation at all -- see SECURITY.md, where that combination
|
|
61
|
-
is recorded as a documented risk rather than a defect.
|
|
62
|
-
"""
|
|
63
|
-
|
|
64
|
-
from __future__ import annotations
|
|
65
|
-
|
|
66
|
-
import logging
|
|
67
|
-
import os
|
|
68
|
-
import re
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
import
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
81
|
-
#
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
`
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
1
|
+
"""
|
|
2
|
+
security/protected_paths.py
|
|
3
|
+
|
|
4
|
+
The trees a sandboxed command must never be able to WRITE: the harness's
|
|
5
|
+
own source, and the user-tier state that decides what the harness trusts
|
|
6
|
+
and what it spawns.
|
|
7
|
+
|
|
8
|
+
WHY THIS EXISTS. security/sandbox.py's Docker backend binds
|
|
9
|
+
config.WORKSPACE_DIR read-write at /workspace and never asked what was on
|
|
10
|
+
the other side of that mount. A SANDBOXED command under CONTAINED with no
|
|
11
|
+
network is AUTO-APPROVED (security/capability.auto_approved), so nothing
|
|
12
|
+
prompts -- which meant a workspace pointed at the harness's own directory
|
|
13
|
+
handed every run unattended read-write access to the code it was about to
|
|
14
|
+
execute next, and a workspace pointed at a home directory did the same to
|
|
15
|
+
`~/.config/venastine/`. That directory holds `trusted_projects.json` (the
|
|
16
|
+
D17 gate: a write there marks arbitrary projects trusted) and `mcp.json`
|
|
17
|
+
(which NAMES COMMANDS the harness spawns at startup). Neither is a file
|
|
18
|
+
the model should be able to edit through a tool it did not have to ask
|
|
19
|
+
about.
|
|
20
|
+
|
|
21
|
+
The agent cannot cause this by itself -- WORKSPACE_DIR is bound once at
|
|
22
|
+
import (config.py) and a child shell's `export` dies with the subprocess,
|
|
23
|
+
which was measured rather than assumed. This is a MISCONFIGURATION
|
|
24
|
+
boundary: it makes a workspace that overlaps the harness a startup error
|
|
25
|
+
instead of a silent grant.
|
|
26
|
+
|
|
27
|
+
TWO CLASSES, and the split is the design rather than tidiness:
|
|
28
|
+
|
|
29
|
+
CRITICAL the harness install tree and the user config dir. A
|
|
30
|
+
workspace that IS one of these, or sits inside one, is
|
|
31
|
+
refused outright -- there is no mount arrangement that
|
|
32
|
+
rescues it, and nobody has such a layout on purpose.
|
|
33
|
+
|
|
34
|
+
SENSITIVE providers.json, the database, the log directory. These are
|
|
35
|
+
ro-mounted when they fall inside the workspace but NEVER
|
|
36
|
+
refuse it, because each is user-configurable to anywhere:
|
|
37
|
+
AGENT_LOG_FILE can legitimately point at a file in $HOME,
|
|
38
|
+
and letting that refuse a $HOME workspace would turn a
|
|
39
|
+
logging preference into a launch failure.
|
|
40
|
+
|
|
41
|
+
This generalises security/sandbox._venastine_readonly_mount, which does
|
|
42
|
+
the same job for a `.venastine/` nested in the workspace and whose
|
|
43
|
+
docstring already named this gap: "does not cover ... the harness's own
|
|
44
|
+
`agents/builtin` when the workspace is the harness repo."
|
|
45
|
+
|
|
46
|
+
THE PROTECTED SEGMENT at the bottom of this file is the module's second
|
|
47
|
+
job, added because everything above answered only half the question. The
|
|
48
|
+
trees and ro-mounts stop a SANDBOXED command from writing what it should
|
|
49
|
+
not; nothing stopped the agent's own read/write/edit tools from reaching
|
|
50
|
+
the same material once AGENT_WORKSPACE was pointed at the project --
|
|
51
|
+
workspace membership is the only rule those tools apply, so `.venastine/`
|
|
52
|
+
was an auto-approved path the moment it sat inside one. PROTECTED_SEGMENTS
|
|
53
|
+
is the one list every consumer reads (the file tools' refusal_check and
|
|
54
|
+
handlers, and shell.py's approval check), so the segment cannot drift
|
|
55
|
+
between them.
|
|
56
|
+
|
|
57
|
+
KNOWN LIMITS, stated because a half-understood control is worse than
|
|
58
|
+
none. This covers WRITES on the DOCKER path. It does not cover reads, and
|
|
59
|
+
it does not cover the subprocess fallback, which mounts nothing and has
|
|
60
|
+
no filesystem isolation at all -- see SECURITY.md, where that combination
|
|
61
|
+
is recorded as a documented risk rather than a defect.
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
from __future__ import annotations
|
|
65
|
+
|
|
66
|
+
import logging
|
|
67
|
+
import os
|
|
68
|
+
import re
|
|
69
|
+
import stat
|
|
70
|
+
|
|
71
|
+
import config
|
|
72
|
+
import credentials
|
|
73
|
+
|
|
74
|
+
logger = logging.getLogger(__name__)
|
|
75
|
+
|
|
76
|
+
# The directories inside the install tree that the harness itself writes
|
|
77
|
+
# artifacts to, and which therefore stay usable as a workspace. This is
|
|
78
|
+
# an ALLOWLIST and that direction is load-bearing: a module added in a
|
|
79
|
+
# later batch is protected the day it lands, whereas a denylist of source
|
|
80
|
+
# directories would leave it mounted read-write until somebody remembered
|
|
81
|
+
# to extend the list. `./workspace` is also the shipped default, so this
|
|
82
|
+
# is the branch that keeps the ordinary layout working.
|
|
83
|
+
WRITABLE_INSIDE_HARNESS = ("workspace", "output")
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def harness_root() -> str:
|
|
87
|
+
"""The install tree of the harness that is RUNNING, not any copy.
|
|
88
|
+
|
|
89
|
+
Derived from this file rather than from the cwd, so it is correct
|
|
90
|
+
under every launch route: `python main.py` from a clone, and
|
|
91
|
+
bin/venastine.mjs spawning `python <ROOT>/main.py` from a global npm
|
|
92
|
+
install while the user's cwd is somewhere else entirely.
|
|
93
|
+
|
|
94
|
+
That it names the running install is deliberate and is what keeps
|
|
95
|
+
development workable. An npm-installed harness aimed at a separate
|
|
96
|
+
clone of its own source sees two disjoint trees and allows it: writing
|
|
97
|
+
to a clone you are not executing cannot escalate the privileges of the
|
|
98
|
+
process doing the writing. Only pointing the workspace at the tree
|
|
99
|
+
currently being executed is refused.
|
|
100
|
+
"""
|
|
101
|
+
return os.path.realpath(os.path.dirname(os.path.dirname(
|
|
102
|
+
os.path.abspath(__file__))))
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def user_config_dir() -> str:
|
|
106
|
+
"""`~/.config/venastine`, resolved at CALL time.
|
|
107
|
+
|
|
108
|
+
Mirrors core.config_loader._user_config_dir rather than importing it.
|
|
109
|
+
security/ imports config, credentials and the stdlib; reaching into
|
|
110
|
+
core/ from here would invert the layering the sandbox module's
|
|
111
|
+
`_within` docstring sets out. The duplication is pinned by
|
|
112
|
+
`TestTheMirroredResolversMatchTheirOwners` in tests/test_shell.py, so
|
|
113
|
+
drift is a test failure rather than a silent hole.
|
|
114
|
+
|
|
115
|
+
That sentence named a private function without its underscore and a
|
|
116
|
+
test that has never existed under the name given, for two batches --
|
|
117
|
+
the guard was real and the citation was not, which is the worse half
|
|
118
|
+
of the pair to get wrong: a reader who greps the name finds nothing
|
|
119
|
+
and concludes the duplication is unguarded.
|
|
120
|
+
"""
|
|
121
|
+
return os.path.realpath(os.path.expanduser("~/.config/venastine"))
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def _log_dir() -> str:
|
|
125
|
+
"""The directory the rotating log handler writes into.
|
|
126
|
+
|
|
127
|
+
Mirrors logging_setup's resolution -- AGENT_LOG_FILE, else
|
|
128
|
+
`logs/app.log` -- rather than importing it, and here the reason is
|
|
129
|
+
concrete rather than stylistic: logging_setup imports
|
|
130
|
+
safety.policy_enforcement, so an import would be the first
|
|
131
|
+
`security/ -> safety/` edge in the project.
|
|
132
|
+
|
|
133
|
+
The DIRECTORY, not the file: RotatingFileHandler writes `app.log.1`,
|
|
134
|
+
`.2` and so on beside it, and protecting only the live file would
|
|
135
|
+
leave every rotated copy writable -- which is the half that matters
|
|
136
|
+
if what you are worried about is a run editing its own trail.
|
|
137
|
+
"""
|
|
138
|
+
log_file = os.environ.get("AGENT_LOG_FILE", "logs/app.log")
|
|
139
|
+
return os.path.realpath(os.path.dirname(log_file) or ".")
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def critical_paths() -> list[tuple[str, str]]:
|
|
143
|
+
"""(realpath, label) for the trees that also REFUSE a workspace."""
|
|
144
|
+
return [
|
|
145
|
+
(harness_root(), "the harness's own install tree"),
|
|
146
|
+
(user_config_dir(), "the user config directory"),
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def sensitive_paths() -> list[tuple[str, str]]:
|
|
151
|
+
"""(realpath, label) for the paths that are only ever ro-mounted."""
|
|
152
|
+
return [
|
|
153
|
+
(os.path.realpath(credentials.LLM_PROVIDERS_FILE),
|
|
154
|
+
"the provider credentials file"),
|
|
155
|
+
(os.path.realpath(config.DB_PATH), "the conversation database"),
|
|
156
|
+
(_log_dir(), "the log directory"),
|
|
157
|
+
]
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def _relation(candidate: str, other: str) -> str:
|
|
161
|
+
"""How *candidate* sits against *other*: equal, inside, contains, or
|
|
162
|
+
disjoint. Both are realpath'd by the callers already.
|
|
163
|
+
|
|
164
|
+
`+ os.sep` on both comparisons for the reason test_file_ops.py:314
|
|
165
|
+
records about `_is_within_workspace`: a bare startswith makes
|
|
166
|
+
`/workspace-evil` look like it is inside `/workspace`.
|
|
167
|
+
"""
|
|
168
|
+
if candidate == other:
|
|
169
|
+
return "equal"
|
|
170
|
+
if candidate.startswith(other + os.sep):
|
|
171
|
+
return "inside"
|
|
172
|
+
if other.startswith(candidate + os.sep):
|
|
173
|
+
return "contains"
|
|
174
|
+
return "disjoint"
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def _exempt_from_harness_refusal(workspace_real: str) -> bool:
|
|
178
|
+
"""Whether a workspace inside the install tree is one of the harness's
|
|
179
|
+
own artifact directories (or something under one)."""
|
|
180
|
+
root = harness_root()
|
|
181
|
+
for name in WRITABLE_INSIDE_HARNESS:
|
|
182
|
+
allowed = os.path.realpath(os.path.join(root, name))
|
|
183
|
+
if _relation(workspace_real, allowed) in ("equal", "inside"):
|
|
184
|
+
return True
|
|
185
|
+
return False
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def check_workspace(workspace_dir: str) -> str | None:
|
|
189
|
+
"""Why *workspace_dir* may not be used as a sandbox workspace, or None.
|
|
190
|
+
|
|
191
|
+
Returns a REASON STRING rather than raising, so the two callers can
|
|
192
|
+
fail in the shape each needs -- main.py prints it and exits, and
|
|
193
|
+
security/sandbox.py raises SandboxUnavailable. Raising a sandbox
|
|
194
|
+
exception from here would mean importing sandbox.py, which imports
|
|
195
|
+
this module.
|
|
196
|
+
|
|
197
|
+
The message is written for the person who has to fix it, and names
|
|
198
|
+
both what overlaps and what to do instead: a workspace refusal is
|
|
199
|
+
always a configuration error, never something the model did.
|
|
200
|
+
|
|
201
|
+
AN EMPTY NAME IS REFUSED BEFORE IT IS RESOLVED (TECHNICAL_DEBT 93,
|
|
202
|
+
batch 160), because `os.path.realpath("")` is the LAUNCH DIRECTORY.
|
|
203
|
+
`config_schema._overlay_env` honours a variable that is set at all --
|
|
204
|
+
`if override is not None`, deliberately generic over its table -- so
|
|
205
|
+
`AGENT_WORKSPACE=` made the launch directory the auto-approved
|
|
206
|
+
workspace, and `WORKSPACE_DIR_EXPLICIT`, which reads the variable's
|
|
207
|
+
presence and never its value, made it the project as well. Measured
|
|
208
|
+
in batch 146: `_file_approval_check('write', ...)` answered no-prompt
|
|
209
|
+
for a file in the launch directory. Here rather than in the merge, so
|
|
210
|
+
the merge stays generic and the one place a bad workspace is refused
|
|
211
|
+
stays the one place; `main()` calls this before anything reads the
|
|
212
|
+
workspace or the project.
|
|
213
|
+
"""
|
|
214
|
+
if not workspace_dir or not workspace_dir.strip():
|
|
215
|
+
return (
|
|
216
|
+
"The workspace is an empty path -- AGENT_WORKSPACE is set to an "
|
|
217
|
+
"empty value, or workspace_dir in config.yaml is blank -- and an "
|
|
218
|
+
"empty path resolves to the directory this was launched from, "
|
|
219
|
+
"which would make it the auto-approved workspace and the "
|
|
220
|
+
"project. Unset AGENT_WORKSPACE, or name a directory; the "
|
|
221
|
+
"default is ./workspace."
|
|
222
|
+
)
|
|
223
|
+
workspace_real = os.path.realpath(workspace_dir)
|
|
224
|
+
|
|
225
|
+
for protected, label in critical_paths():
|
|
226
|
+
relation = _relation(workspace_real, protected)
|
|
227
|
+
if relation not in ("equal", "inside"):
|
|
228
|
+
continue
|
|
229
|
+
if protected == harness_root() and _exempt_from_harness_refusal(
|
|
230
|
+
workspace_real):
|
|
231
|
+
continue
|
|
232
|
+
where = (label if relation == "equal"
|
|
233
|
+
else f"inside {label} ({protected})")
|
|
234
|
+
return (
|
|
235
|
+
f"AGENT_WORKSPACE ({workspace_real}) is {where}. The sandbox "
|
|
236
|
+
f"mounts the workspace read-write and non-inert commands are "
|
|
237
|
+
f"auto-approved inside it, so this would let a shell command "
|
|
238
|
+
f"rewrite the harness's own code, or the state that decides "
|
|
239
|
+
f"what it trusts and what it spawns. Point AGENT_WORKSPACE at "
|
|
240
|
+
f"a directory outside it -- the default is ./workspace."
|
|
241
|
+
)
|
|
242
|
+
return None
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def check_project(project_path: str) -> str | None:
|
|
246
|
+
"""Why *project_path* may not be the PROJECT, or None (debt item 26).
|
|
247
|
+
|
|
248
|
+
The project is what `config_loader.get_project_path()` resolves, and
|
|
249
|
+
everything downstream follows it: D17 workspace trust, the
|
|
250
|
+
`.venastine/` config tier, `/init`'s destination and `UserMemory`'s
|
|
251
|
+
project scope (WS7, D25/M12). It may not be the harness's own install
|
|
252
|
+
tree.
|
|
253
|
+
|
|
254
|
+
THE DISPARITY THIS CLOSES, and it is why this is a guard rather than a
|
|
255
|
+
convention. Naming that directory was ALREADY refused --
|
|
256
|
+
`check_workspace` above returns a reason for `AGENT_WORKSPACE=<harness
|
|
257
|
+
root>`, and for every non-exempt subfolder of it. But `main()` falls
|
|
258
|
+
back to `os.getcwd()` when nothing names a workspace as the project, so
|
|
259
|
+
launching from a clone reached the same state by saying nothing:
|
|
260
|
+
measured in batch 96 from an owner report and reproduced in batch 107,
|
|
261
|
+
the trust prompt listed the harness's own `AGENTS.md`. The rule was
|
|
262
|
+
enforced when you said it and skipped when you did not.
|
|
263
|
+
|
|
264
|
+
THE MESSAGE NAMES THREE WAYS OUT since batch 111, and used to name two
|
|
265
|
+
and a trap. It said `workspace_dir` in `config.yaml` "is not enough on
|
|
266
|
+
its own" -- true, and no help at all to the person reading it, who had
|
|
267
|
+
just written the directory they meant into the file this refusal is
|
|
268
|
+
about. `workspace_is_project` is the third way (TECHNICAL_DEBT 28), and
|
|
269
|
+
the sentence is now about what to do rather than about what does not
|
|
270
|
+
work.
|
|
271
|
+
|
|
272
|
+
EQUALITY, NOT CONTAINMENT, which is the one place this deliberately
|
|
273
|
+
differs from `check_workspace`. That one is a WRITE boundary and
|
|
274
|
+
refuses anything inside the tree except `workspace/` and `output/`;
|
|
275
|
+
this one answers "is the project the harness", and `<harness>/workspace`
|
|
276
|
+
is a perfectly good project. It is the shipped layout, and it is the
|
|
277
|
+
answer for someone working on the harness itself.
|
|
278
|
+
|
|
279
|
+
A REASON STRING rather than an exception, for `check_workspace`'s
|
|
280
|
+
reason: the caller prints it and exits. REALPATH'D HERE rather than at
|
|
281
|
+
the caller, because `main()`'s implicit branch hands over a bare
|
|
282
|
+
`os.getcwd()` -- and because the realpath is what makes this a question
|
|
283
|
+
about a directory instead of about a spelling. `_relation` compares
|
|
284
|
+
strings, so `<root>/workspace/..` and a Windows path differing only in
|
|
285
|
+
case both read as `disjoint` to it; `os.path.realpath` resolves the
|
|
286
|
+
first on every platform and canonicalises the second on Windows
|
|
287
|
+
(measured, batch 107).
|
|
288
|
+
"""
|
|
289
|
+
root = harness_root()
|
|
290
|
+
if _relation(os.path.realpath(project_path), root) != "equal":
|
|
291
|
+
return None
|
|
292
|
+
return (
|
|
293
|
+
f"The project would be the harness's own install tree ({root}), "
|
|
294
|
+
f"because nothing named a workspace as the project and this was "
|
|
295
|
+
f"launched from there. Workspace trust, .venastine/, /init's "
|
|
296
|
+
f"destination and project-scoped memories all follow the project, "
|
|
297
|
+
f"so the harness would be asked to trust its own AGENTS.md and "
|
|
298
|
+
f"/init would scaffold documentation into its own source. Three "
|
|
299
|
+
f"ways out, any one of them enough: launch from the directory you "
|
|
300
|
+
f"want to work in; set AGENT_WORKSPACE to it; or, if you have "
|
|
301
|
+
f"already written it as workspace_dir in config.yaml, set "
|
|
302
|
+
f"workspace_is_project: true beside it. To work on the harness "
|
|
303
|
+
f"itself, AGENT_WORKSPACE=./workspace."
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
def readonly_mounts(workspace_real: str) -> list[str]:
|
|
308
|
+
"""Docker `-v` arguments binding every protected path NESTED inside
|
|
309
|
+
*workspace_real* read-only, in the order docker expects them.
|
|
310
|
+
|
|
311
|
+
Only what already EXISTS is mounted, copying the `isdir` half of
|
|
312
|
+
_venastine_readonly_mount and for the same reason: docker CREATES a
|
|
313
|
+
missing bind source as a root-owned directory on the host, so an
|
|
314
|
+
unconditional mount would conjure a `.config/venastine/` into the
|
|
315
|
+
user's tree, or an `app.db` that is a DIRECTORY where the harness
|
|
316
|
+
expects a SQLite file.
|
|
317
|
+
|
|
318
|
+
Nested protected paths are collapsed to the outermost -- the database
|
|
319
|
+
and the log directory both live under `~/.config/venastine` on a
|
|
320
|
+
global install -- because a second bind underneath a read-only one
|
|
321
|
+
buys nothing and only makes the command line harder to read.
|
|
322
|
+
"""
|
|
323
|
+
candidates = []
|
|
324
|
+
for protected, _label in critical_paths() + sensitive_paths():
|
|
325
|
+
if _relation(protected, workspace_real) != "inside":
|
|
326
|
+
continue
|
|
327
|
+
if not os.path.exists(protected):
|
|
328
|
+
continue
|
|
329
|
+
candidates.append(protected)
|
|
330
|
+
|
|
331
|
+
# Shortest first, so an ancestor is always decided before anything
|
|
332
|
+
# underneath it and the collapse below only ever has to look backwards.
|
|
333
|
+
kept: list[str] = []
|
|
334
|
+
for protected in sorted(set(candidates), key=len):
|
|
335
|
+
if any(_relation(protected, outer) == "inside" for outer in kept):
|
|
336
|
+
continue
|
|
337
|
+
kept.append(protected)
|
|
338
|
+
|
|
339
|
+
args: list[str] = []
|
|
340
|
+
for protected in kept:
|
|
341
|
+
rel = os.path.relpath(protected, workspace_real).replace(os.sep, "/")
|
|
342
|
+
args.extend(["-v", f"{protected}:/workspace/{rel}:ro"])
|
|
343
|
+
return args
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
# ===========================================================================
|
|
347
|
+
# ---- Protected path segments ----------------------------------------------
|
|
348
|
+
# ===========================================================================
|
|
349
|
+
|
|
350
|
+
# Path components the agent's own tools may never touch, wherever they sit
|
|
351
|
+
# in a RESOLVED path. `.venastine/` holds settings.json and mcp.json --
|
|
352
|
+
# which names commands the harness spawns at startup -- and, under skills/
|
|
353
|
+
# and agents/, content that is injected into system prompts. The trees
|
|
354
|
+
# above answer what a SANDBOXED command may write; this answers what the
|
|
355
|
+
# agent's read/write/edit tools may reach at all, which workspace
|
|
356
|
+
# membership alone does not: with AGENT_WORKSPACE pointed at the project,
|
|
357
|
+
# `.venastine/` is inside the workspace and file_ops'
|
|
358
|
+
# `_file_approval_check` auto-approves it.
|
|
359
|
+
#
|
|
360
|
+
# ONE LIST, THREE CONSUMERS -- the same discipline as the local-secret
|
|
361
|
+
# exclusion lists, which exist because three copies of one fact drift.
|
|
362
|
+
# tools/builtin/file_ops.py refuses any path carrying one of these
|
|
363
|
+
# segments (refusal_check AND the three handlers); tools/builtin/shell.py
|
|
364
|
+
# forces a prompt for any command whose tokens name one; and
|
|
365
|
+
# project_docs.py unions this set into its own wider denylist rather than
|
|
366
|
+
# re-spelling the segment.
|
|
367
|
+
#
|
|
368
|
+
# AND ONE COMPARISON, since batch 146 -- `folded_segments` below, because
|
|
369
|
+
# the fact is not the spelling on its own but the spelling together with
|
|
370
|
+
# how a filesystem will match it. Two of the three consumers had their own
|
|
371
|
+
# comparison and only one of them folded case, which is not a thing either
|
|
372
|
+
# file said; it was a thing you could only find by writing `.VENASTINE/`.
|
|
373
|
+
#
|
|
374
|
+
# KNOWN LIMITS, in the house style. The file tools DENY; the shell only
|
|
375
|
+
# ever ASKS, because a token check that learned shell syntax would be a
|
|
376
|
+
# parser whose bugs auto-approve (G2), and an approval prompt leaves the
|
|
377
|
+
# whole command text in front of a human instead. The auto-approved INERT
|
|
378
|
+
# tier executes argv with no shell (§46 EP5), so its tokens ARE its
|
|
379
|
+
# arguments and a token check is sound there; under `tiered` every tier
|
|
380
|
+
# that could expand a glob or a variable into the segment is asked about
|
|
381
|
+
# anyway. That sentence was FALSE until §48 (CE1): a contained command was
|
|
382
|
+
# auto-approved, and `cat .ven*/settings.json; true` read the file unasked.
|
|
383
|
+
# Under `contained` and `never` it is still not true -- such a spelling,
|
|
384
|
+
# or code that opens the file, runs unasked; the ro mount stops a write,
|
|
385
|
+
# and the read is recorded in SECURITY.md as documented risk.
|
|
386
|
+
# MCP servers exposing their own file tools are a separate surface this
|
|
387
|
+
# list does not reach, and the user-tier `~/.config/venastine` stays
|
|
388
|
+
# where it always was -- outside a default workspace it is prompt-gated
|
|
389
|
+
# by the workspace boundary, not denied.
|
|
390
|
+
PROTECTED_SEGMENTS = frozenset({".venastine"})
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
def hardlinked_segment(resolved_path: str, roots) -> str | None:
|
|
394
|
+
"""The protected segment a HARD LINK at *resolved_path* is a second
|
|
395
|
+
name for, or None (TECHNICAL_DEBT 90, batch 160).
|
|
396
|
+
|
|
397
|
+
`protected_segment` reads a resolved PATH, and a hardlink is not a link
|
|
398
|
+
to anything: `realpath` returns the name it was given and `islink` is
|
|
399
|
+
False, so a second name for `.venastine/settings.json` sitting in the
|
|
400
|
+
workspace read as an ordinary file. A `read` through one served the
|
|
401
|
+
protected file -- measured in batch 146, along with the write half that
|
|
402
|
+
`write_text_atomic` already closed by replacing the name.
|
|
403
|
+
|
|
404
|
+
SAME FILE, NOT SAME NAME: a file with more than one name is compared by
|
|
405
|
+
`(st_dev, st_ino)` against every file under the `.venastine/` of each of
|
|
406
|
+
*roots* -- the project and the workspace, which are the directories that
|
|
407
|
+
tree is read from. Both fields are real on Windows as well as POSIX
|
|
408
|
+
(measured: an NTFS hardlink pair reports `st_nlink == 2` and one file
|
|
409
|
+
id). The two rejected alternatives are why it is this one: enumerating a
|
|
410
|
+
file's other names is per-platform, and refusing every `st_nlink > 1`
|
|
411
|
+
denies ordinary files to protect against a layout the write path
|
|
412
|
+
already handled. A file with one name pays one `stat`.
|
|
413
|
+
|
|
414
|
+
A `.venastine/` elsewhere on the disk is not looked for, so a hardlink
|
|
415
|
+
into some other project's tree is not caught; the deny exists for the
|
|
416
|
+
one this harness reads.
|
|
417
|
+
"""
|
|
418
|
+
try:
|
|
419
|
+
target = os.stat(resolved_path)
|
|
420
|
+
except OSError:
|
|
421
|
+
return None
|
|
422
|
+
if not stat.S_ISREG(target.st_mode) or target.st_nlink < 2:
|
|
423
|
+
return None
|
|
424
|
+
identity = (target.st_dev, target.st_ino)
|
|
425
|
+
for root in roots:
|
|
426
|
+
try:
|
|
427
|
+
entries = os.listdir(root)
|
|
428
|
+
except OSError:
|
|
429
|
+
continue
|
|
430
|
+
for entry in entries:
|
|
431
|
+
if entry.casefold() not in PROTECTED_SEGMENTS_FOLDED:
|
|
432
|
+
continue
|
|
433
|
+
for dirpath, _dirnames, filenames in os.walk(
|
|
434
|
+
os.path.join(root, entry)):
|
|
435
|
+
for name in filenames:
|
|
436
|
+
try:
|
|
437
|
+
other = os.stat(os.path.join(dirpath, name))
|
|
438
|
+
except OSError:
|
|
439
|
+
continue
|
|
440
|
+
if (other.st_dev, other.st_ino) == identity:
|
|
441
|
+
return entry
|
|
442
|
+
return None
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
def folded_segments(names) -> frozenset:
|
|
446
|
+
"""`names` prepared for the comparison a filesystem will actually make.
|
|
447
|
+
|
|
448
|
+
THE ONE SPELLING OF THE FOLD (batch 146). Both consumers that compare a
|
|
449
|
+
path's segments against a denylist call this -- `protected_segment`
|
|
450
|
+
below and `project_docs._is_readable_doc` -- because the alternative is
|
|
451
|
+
what was there before: two comparisons, one of them case-sensitive, and
|
|
452
|
+
nothing in either file able to say they disagreed.
|
|
453
|
+
|
|
454
|
+
`casefold` rather than `lower`, which is the comparison Python offers
|
|
455
|
+
for "are these the same name to a human"; for ASCII segment names they
|
|
456
|
+
are identical and the difference costs nothing.
|
|
457
|
+
"""
|
|
458
|
+
return frozenset(name.casefold() for name in names)
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
#: PUBLIC, because `shell.py`'s raw-token branch compares against it too
|
|
462
|
+
#: and a second `folded_segments(PROTECTED_SEGMENTS)` at that module's top
|
|
463
|
+
#: would be one derived value computed twice.
|
|
464
|
+
PROTECTED_SEGMENTS_FOLDED = folded_segments(PROTECTED_SEGMENTS)
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
def protected_segment(resolved_path: str) -> str | None:
|
|
468
|
+
"""The protected segment *resolved_path* carries, or None.
|
|
469
|
+
|
|
470
|
+
Callers pass a realpath'd path (file_ops' ``resolve_path``, the
|
|
471
|
+
sandbox's ``_within``), so `..` travel and symlinks are already
|
|
472
|
+
collapsed: a link pointing at `.venastine/settings.json` arrives here
|
|
473
|
+
as the real thing. Split on both separators because a raw shell token
|
|
474
|
+
may carry either.
|
|
475
|
+
|
|
476
|
+
CASE-FOLDED ON EVERY PLATFORM, and the word "realpath" above is exactly
|
|
477
|
+
why it has to be (batch 146). This used to say that on Windows a
|
|
478
|
+
case-spelled path "arrives here as the real thing" too, and that is
|
|
479
|
+
true only where the path ALREADY EXISTS for realpath to canonicalise --
|
|
480
|
+
which is not the state a `write` is in. With no `.venastine/` yet,
|
|
481
|
+
`.VENASTINE/mcp.json` resolved to itself, carried no known segment, was
|
|
482
|
+
auto-approved, and created the protected directory under the spelling
|
|
483
|
+
the guard did not know. After that realpath canonicalised every later
|
|
484
|
+
path to the ON-DISK name, so BOTH spellings were admitted in that
|
|
485
|
+
project from then on, and the file `config_loader` opens at startup was
|
|
486
|
+
one of them. Measured, including the control: a project whose directory
|
|
487
|
+
was created lowercase refuses both.
|
|
488
|
+
|
|
489
|
+
Folding unconditionally rather than per platform is the fail-closed
|
|
490
|
+
direction and costs what it costs: on a case-SENSITIVE filesystem a
|
|
491
|
+
directory genuinely named `.VENASTINE` is now denied to the file tools
|
|
492
|
+
with no prompt and no override, because for them this list is the hard
|
|
493
|
+
deny rather than a reason to ask. The shell consumer only ever ASKS, so
|
|
494
|
+
there the same fold costs one prompt.
|
|
495
|
+
"""
|
|
496
|
+
for part in re.split(r"[\\/]", resolved_path):
|
|
497
|
+
if part.casefold() in PROTECTED_SEGMENTS_FOLDED:
|
|
498
|
+
# The spelling from the PATH, not from the list, so the refusal
|
|
499
|
+
# names what the caller actually wrote.
|
|
500
|
+
return part
|
|
501
|
+
return None
|