@yahyahammad/venastine 0.3.8 → 0.3.10
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 +19 -19
- package/CONFIG_ARCHITECTURE.md +2139 -2002
- package/LICENSE +201 -201
- package/README.md +1043 -1034
- package/agents/builtin/compactor.md +75 -75
- package/agents/builtin/explore.md +77 -77
- package/agents/builtin/pipeline-reviewer.md +100 -100
- package/agents/builtin/plan.md +106 -106
- package/agents/builtin/review.md +74 -74
- package/agents/manager.py +261 -261
- package/agents/subagent_tool.py +472 -472
- package/agents/tui_commands.py +238 -146
- package/bin/venastine.mjs +584 -528
- package/bin/venastine.py +73 -71
- package/cli_commands.py +848 -835
- package/config.yaml +64 -0
- package/config_edit.py +1301 -1301
- package/config_schema.py +987 -966
- package/config_update.py +749 -749
- package/core/agent_activity.py +256 -256
- package/core/ansi.py +452 -452
- package/core/approval.py +137 -137
- package/core/call_view.py +364 -364
- package/core/cancel.py +121 -121
- package/core/chatgpt_auth.py +747 -747
- package/core/claims_view.py +107 -107
- package/core/client.py +2756 -2715
- package/core/commands.py +464 -454
- package/core/compaction.py +1735 -1735
- package/core/config_loader.py +1982 -1982
- package/core/connect.py +686 -686
- package/core/events.py +123 -123
- package/core/file_mentions.py +280 -280
- package/core/interaction.py +411 -411
- package/core/loop.py +2566 -2566
- package/core/memory.py +482 -482
- package/core/pipeline_models.py +190 -190
- package/core/provider_errors.py +274 -234
- package/core/reasoning/authorization.py +130 -130
- package/core/reasoning/base.py +219 -219
- package/core/reasoning/confidence_scoring.py +484 -484
- package/core/reasoning/events.py +149 -149
- package/core/reasoning/orchestrator.py +1561 -1561
- package/core/reasoning/output_writer.py +345 -345
- package/core/reasoning/payload_validation.py +524 -524
- package/core/reasoning/pipeline_storage.py +427 -427
- package/core/reasoning/scholar.py +467 -458
- package/core/reasoning/source_corpus.py +433 -433
- package/core/reasoning/source_scoring.py +855 -855
- package/core/replay.py +315 -315
- package/core/shell_sessions.py +1553 -1553
- package/credentials.py +307 -307
- package/database.py +333 -333
- package/docs/PRIVACY.md +78 -78
- package/docs/SECURITY.md +114 -108
- package/docs/THIRD_PARTY_NOTICES.md +148 -148
- package/env_secrets.py +118 -118
- package/json_store.py +343 -343
- package/logging_setup.py +295 -295
- package/main.py +3433 -3433
- package/mcp_client/client.py +780 -733
- package/mcp_client/config.py +484 -484
- package/mcp_client/registration.py +343 -343
- package/memories/manager.py +147 -147
- package/memories/tui_commands.py +319 -239
- package/package.json +303 -303
- package/project_init/config_files.py +282 -282
- package/project_init/generator.py +728 -728
- package/project_init/manifest.py +418 -418
- package/project_init/tui_commands.py +147 -147
- package/prompts/critic_pass.md +24 -24
- package/prompts/revalidate.md +25 -25
- package/prompts/revise.md +17 -17
- package/prompts/source_grounding.md +66 -66
- package/prompts/system_prompts.py +316 -316
- package/providers.json.example +94 -94
- package/pyproject.toml +149 -149
- package/requirements.txt +314 -295
- package/safety/policy_enforcement.py +1082 -1082
- package/security/askpass.py +419 -419
- package/security/capability.py +207 -207
- package/security/confine.py +484 -484
- package/security/hosted.py +182 -182
- package/security/permissions.py +237 -237
- package/security/protected_paths.py +501 -501
- package/security/sandbox.py +4108 -4108
- 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 -110
- package/storage.py +1338 -1338
- package/tools/base.py +465 -465
- package/tools/builtin/_math_common.py +667 -667
- package/tools/builtin/_net_common.py +1145 -267
- package/tools/builtin/_page_text.py +490 -0
- package/tools/builtin/_pdf_text.py +113 -0
- package/tools/builtin/arxiv.py +685 -681
- package/tools/builtin/fetch_url.py +639 -371
- package/tools/builtin/file_ops.py +720 -720
- package/tools/builtin/geometry.py +184 -184
- package/tools/builtin/load_skill.py +76 -76
- package/tools/builtin/pin.py +227 -227
- package/tools/builtin/probability_stats.py +224 -224
- package/tools/builtin/project_docs.py +464 -464
- package/tools/builtin/remember.py +175 -175
- package/tools/builtin/shell.py +980 -980
- package/tools/builtin/todo.py +149 -149
- package/tools/builtin/web_search.py +402 -328
- package/tools/context.py +159 -159
- package/tools/isolation.py +387 -387
- package/tools/registry.py +1252 -1242
- package/tui/app.py +8372 -8307
- package/tui/app.tcss +754 -739
- package/tui/commands.py +26 -26
- package/tui/diffs.py +286 -286
- package/tui/history.py +128 -128
- package/tui/hosted_driver.py +102 -102
- package/tui/markdown.py +1329 -1329
- package/tui/meters.py +364 -364
- package/tui/ravens.py +146 -146
- package/tui/screens.py +1255 -1197
- package/tui/themes.py +599 -599
- package/tui/widgets.py +3861 -3796
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
"""
|
|
2
|
-
core/reasoning/authorization.py
|
|
3
|
-
|
|
4
|
-
ROADMAP_v2 §25. The pipeline's POLICY about pre-flight grants -- which
|
|
5
|
-
tools may be offered, and how a user's answer is parsed.
|
|
6
|
-
|
|
7
|
-
core/approval.py holds the data shapes and core/loop.py enforces them.
|
|
8
|
-
This file answers the two questions that are specific to the research
|
|
9
|
-
pipeline, and both shells (main.py's flag, tui/app.py's picker) consume it
|
|
10
|
-
so the CLI and the TUI cannot drift into offering different sets.
|
|
11
|
-
|
|
12
|
-
Why the pipeline needs its own answer at all: it is the harness's highest
|
|
13
|
-
prompt-injection surface by construction. It fetches web pages and feeds
|
|
14
|
-
them to a model that then chooses tools, unattended, across ten passes.
|
|
15
|
-
§23 reasoned the same way when it decided the question tool denies
|
|
16
|
-
headless -- "an injected question from fetched web content would be least
|
|
17
|
-
noticed" there.
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
import logging
|
|
21
|
-
|
|
22
|
-
logger = logging.getLogger(__name__)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# What both shells say when nothing in this run can be granted (#106).
|
|
26
|
-
#
|
|
27
|
-
# One string, two callers, for the same reason the module exists: they
|
|
28
|
-
# drifted, and the TUI's version was FALSE where it fired. It said "no
|
|
29
|
-
# approval-gated tool is AVAILABLE to this run" when two were -- they
|
|
30
|
-
# simply could not be pre-granted, which is a different sentence and the
|
|
31
|
-
# only one either shell is in a position to make.
|
|
32
|
-
#
|
|
33
|
-
# This module already kept the two from offering different SETS. What it
|
|
34
|
-
# had never been given is what they say about an empty one.
|
|
35
|
-
NOTHING_TO_GRANT = (
|
|
36
|
-
"No approval-gated tool in this run can be granted up front, so there "
|
|
37
|
-
"is nothing to authorise. Gated tools are still asked about per call "
|
|
38
|
-
"wherever something can answer."
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
# "The flag was given with no value -- ask me which." A distinct object
|
|
43
|
-
# rather than "" so an explicitly empty list (--grant-tools "") stays an
|
|
44
|
-
# empty GRANT rather than becoming a prompt. Defined here, not in either
|
|
45
|
-
# shell, because both compare against it and two sentinels would compare
|
|
46
|
-
# unequal while looking identical.
|
|
47
|
-
GRANT_PICKER = object()
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def candidates(context=None) -> list[tuple[str, str]]:
|
|
51
|
-
"""(name, description) for every tool a pipeline grant could cover.
|
|
52
|
-
|
|
53
|
-
Three filters, and the composition is the point:
|
|
54
|
-
* advertised and approval-gated -- i.e. exactly what the headless
|
|
55
|
-
rule hides today. Offering anything else would be offering a grant
|
|
56
|
-
for a tool that never needed one.
|
|
57
|
-
* registry.grantable -- a param-dependent gate was never consented
|
|
58
|
-
to by name (R2).
|
|
59
|
-
* grant_policy is GRANT_ANYWHERE (R13). This is the STRICT half of
|
|
60
|
-
the pair: a GRANT_SIGNOFF_ONLY tool may be pre-granted by a human
|
|
61
|
-
answering about one named agent for one turn, and may not be
|
|
62
|
-
pre-granted to ten unattended passes on one launch-time tick.
|
|
63
|
-
|
|
64
|
-
That third filter used to be a frozenset in this module, which is
|
|
65
|
-
exactly how #67 and #133 happened: agents/manager.py could not see it,
|
|
66
|
-
so the §18 sign-off and this function held different ideas of what a
|
|
67
|
-
grant covers, and a tool registered after the set was written
|
|
68
|
-
(write_project_doc, §24) joined the picker without anyone being asked.
|
|
69
|
-
The answer now lives on the tool and both callers read it.
|
|
70
|
-
|
|
71
|
-
On a default install this returns an EMPTY list, and that is correct
|
|
72
|
-
rather than a regression: every built-in is either ungated, param-
|
|
73
|
-
dependent, or excluded by policy. The population this exists for is
|
|
74
|
-
MCP tools -- allowed but approval-gated by default (§17 decision D),
|
|
75
|
-
no approval_check, and named at connection time.
|
|
76
|
-
|
|
77
|
-
Descriptions come from the tool's own schema because they are the only
|
|
78
|
-
signal available: MCP exposes no read-only/write metadata, so nothing
|
|
79
|
-
can tell the user that one granted tool searches a library and another
|
|
80
|
-
posts to a channel. Showing what a tool says it does is the whole of
|
|
81
|
-
informed consent here, which is also why the grant is per-tool (R1)
|
|
82
|
-
rather than one yes covering the set.
|
|
83
|
-
"""
|
|
84
|
-
from tools.base import GRANT_ANYWHERE
|
|
85
|
-
from tools.registry import registry
|
|
86
|
-
|
|
87
|
-
out = []
|
|
88
|
-
for name in sorted(registry.headless_hidden(context)):
|
|
89
|
-
if (not registry.grantable(name)
|
|
90
|
-
or registry.grant_policy(name) != GRANT_ANYWHERE):
|
|
91
|
-
continue
|
|
92
|
-
spec = registry._tools.get(name)
|
|
93
|
-
description = ""
|
|
94
|
-
if spec is not None:
|
|
95
|
-
description = (spec.schema or {}).get("description", "") or ""
|
|
96
|
-
out.append((name, description.strip().splitlines()[0]
|
|
97
|
-
if description.strip() else ""))
|
|
98
|
-
return out
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
class GrantSpecError(ValueError):
|
|
102
|
-
"""A --grant-tools value naming something that cannot be granted."""
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def parse_grant_spec(text: str, offered) -> set:
|
|
106
|
-
"""Turn a comma-separated --grant-tools value into a set of names.
|
|
107
|
-
|
|
108
|
-
RAISES on an unknown name rather than dropping it. A typo'd tool would
|
|
109
|
-
otherwise produce an empty or partial grant, the run would proceed
|
|
110
|
-
looking authorised, and the pass would report that a tool it was
|
|
111
|
-
supposed to have was unavailable -- with the actual cause three layers
|
|
112
|
-
away. The same argument D24 settled for undeclared permissions: an
|
|
113
|
-
authorization mistake must be loud at the point it is made.
|
|
114
|
-
|
|
115
|
-
`offered` is candidates()' output (or any iterable of names), so what a
|
|
116
|
-
flag may name and what a picker may show are the same set by
|
|
117
|
-
construction.
|
|
118
|
-
"""
|
|
119
|
-
allowed = {n if isinstance(n, str) else n[0] for n in offered}
|
|
120
|
-
names = {part.strip() for part in (text or "").split(",") if part.strip()}
|
|
121
|
-
unknown = sorted(names - allowed)
|
|
122
|
-
if unknown:
|
|
123
|
-
raise GrantSpecError(
|
|
124
|
-
f"cannot grant {', '.join(unknown)}: "
|
|
125
|
-
+ (f"grantable tools are {', '.join(sorted(allowed))}"
|
|
126
|
-
if allowed else
|
|
127
|
-
"no tool in this run needs a grant, so there is nothing to "
|
|
128
|
-
"authorise")
|
|
129
|
-
)
|
|
130
|
-
return names
|
|
1
|
+
"""
|
|
2
|
+
core/reasoning/authorization.py
|
|
3
|
+
|
|
4
|
+
ROADMAP_v2 §25. The pipeline's POLICY about pre-flight grants -- which
|
|
5
|
+
tools may be offered, and how a user's answer is parsed.
|
|
6
|
+
|
|
7
|
+
core/approval.py holds the data shapes and core/loop.py enforces them.
|
|
8
|
+
This file answers the two questions that are specific to the research
|
|
9
|
+
pipeline, and both shells (main.py's flag, tui/app.py's picker) consume it
|
|
10
|
+
so the CLI and the TUI cannot drift into offering different sets.
|
|
11
|
+
|
|
12
|
+
Why the pipeline needs its own answer at all: it is the harness's highest
|
|
13
|
+
prompt-injection surface by construction. It fetches web pages and feeds
|
|
14
|
+
them to a model that then chooses tools, unattended, across ten passes.
|
|
15
|
+
§23 reasoned the same way when it decided the question tool denies
|
|
16
|
+
headless -- "an injected question from fetched web content would be least
|
|
17
|
+
noticed" there.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
import logging
|
|
21
|
+
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# What both shells say when nothing in this run can be granted (#106).
|
|
26
|
+
#
|
|
27
|
+
# One string, two callers, for the same reason the module exists: they
|
|
28
|
+
# drifted, and the TUI's version was FALSE where it fired. It said "no
|
|
29
|
+
# approval-gated tool is AVAILABLE to this run" when two were -- they
|
|
30
|
+
# simply could not be pre-granted, which is a different sentence and the
|
|
31
|
+
# only one either shell is in a position to make.
|
|
32
|
+
#
|
|
33
|
+
# This module already kept the two from offering different SETS. What it
|
|
34
|
+
# had never been given is what they say about an empty one.
|
|
35
|
+
NOTHING_TO_GRANT = (
|
|
36
|
+
"No approval-gated tool in this run can be granted up front, so there "
|
|
37
|
+
"is nothing to authorise. Gated tools are still asked about per call "
|
|
38
|
+
"wherever something can answer."
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# "The flag was given with no value -- ask me which." A distinct object
|
|
43
|
+
# rather than "" so an explicitly empty list (--grant-tools "") stays an
|
|
44
|
+
# empty GRANT rather than becoming a prompt. Defined here, not in either
|
|
45
|
+
# shell, because both compare against it and two sentinels would compare
|
|
46
|
+
# unequal while looking identical.
|
|
47
|
+
GRANT_PICKER = object()
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def candidates(context=None) -> list[tuple[str, str]]:
|
|
51
|
+
"""(name, description) for every tool a pipeline grant could cover.
|
|
52
|
+
|
|
53
|
+
Three filters, and the composition is the point:
|
|
54
|
+
* advertised and approval-gated -- i.e. exactly what the headless
|
|
55
|
+
rule hides today. Offering anything else would be offering a grant
|
|
56
|
+
for a tool that never needed one.
|
|
57
|
+
* registry.grantable -- a param-dependent gate was never consented
|
|
58
|
+
to by name (R2).
|
|
59
|
+
* grant_policy is GRANT_ANYWHERE (R13). This is the STRICT half of
|
|
60
|
+
the pair: a GRANT_SIGNOFF_ONLY tool may be pre-granted by a human
|
|
61
|
+
answering about one named agent for one turn, and may not be
|
|
62
|
+
pre-granted to ten unattended passes on one launch-time tick.
|
|
63
|
+
|
|
64
|
+
That third filter used to be a frozenset in this module, which is
|
|
65
|
+
exactly how #67 and #133 happened: agents/manager.py could not see it,
|
|
66
|
+
so the §18 sign-off and this function held different ideas of what a
|
|
67
|
+
grant covers, and a tool registered after the set was written
|
|
68
|
+
(write_project_doc, §24) joined the picker without anyone being asked.
|
|
69
|
+
The answer now lives on the tool and both callers read it.
|
|
70
|
+
|
|
71
|
+
On a default install this returns an EMPTY list, and that is correct
|
|
72
|
+
rather than a regression: every built-in is either ungated, param-
|
|
73
|
+
dependent, or excluded by policy. The population this exists for is
|
|
74
|
+
MCP tools -- allowed but approval-gated by default (§17 decision D),
|
|
75
|
+
no approval_check, and named at connection time.
|
|
76
|
+
|
|
77
|
+
Descriptions come from the tool's own schema because they are the only
|
|
78
|
+
signal available: MCP exposes no read-only/write metadata, so nothing
|
|
79
|
+
can tell the user that one granted tool searches a library and another
|
|
80
|
+
posts to a channel. Showing what a tool says it does is the whole of
|
|
81
|
+
informed consent here, which is also why the grant is per-tool (R1)
|
|
82
|
+
rather than one yes covering the set.
|
|
83
|
+
"""
|
|
84
|
+
from tools.base import GRANT_ANYWHERE
|
|
85
|
+
from tools.registry import registry
|
|
86
|
+
|
|
87
|
+
out = []
|
|
88
|
+
for name in sorted(registry.headless_hidden(context)):
|
|
89
|
+
if (not registry.grantable(name)
|
|
90
|
+
or registry.grant_policy(name) != GRANT_ANYWHERE):
|
|
91
|
+
continue
|
|
92
|
+
spec = registry._tools.get(name)
|
|
93
|
+
description = ""
|
|
94
|
+
if spec is not None:
|
|
95
|
+
description = (spec.schema or {}).get("description", "") or ""
|
|
96
|
+
out.append((name, description.strip().splitlines()[0]
|
|
97
|
+
if description.strip() else ""))
|
|
98
|
+
return out
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class GrantSpecError(ValueError):
|
|
102
|
+
"""A --grant-tools value naming something that cannot be granted."""
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def parse_grant_spec(text: str, offered) -> set:
|
|
106
|
+
"""Turn a comma-separated --grant-tools value into a set of names.
|
|
107
|
+
|
|
108
|
+
RAISES on an unknown name rather than dropping it. A typo'd tool would
|
|
109
|
+
otherwise produce an empty or partial grant, the run would proceed
|
|
110
|
+
looking authorised, and the pass would report that a tool it was
|
|
111
|
+
supposed to have was unavailable -- with the actual cause three layers
|
|
112
|
+
away. The same argument D24 settled for undeclared permissions: an
|
|
113
|
+
authorization mistake must be loud at the point it is made.
|
|
114
|
+
|
|
115
|
+
`offered` is candidates()' output (or any iterable of names), so what a
|
|
116
|
+
flag may name and what a picker may show are the same set by
|
|
117
|
+
construction.
|
|
118
|
+
"""
|
|
119
|
+
allowed = {n if isinstance(n, str) else n[0] for n in offered}
|
|
120
|
+
names = {part.strip() for part in (text or "").split(",") if part.strip()}
|
|
121
|
+
unknown = sorted(names - allowed)
|
|
122
|
+
if unknown:
|
|
123
|
+
raise GrantSpecError(
|
|
124
|
+
f"cannot grant {', '.join(unknown)}: "
|
|
125
|
+
+ (f"grantable tools are {', '.join(sorted(allowed))}"
|
|
126
|
+
if allowed else
|
|
127
|
+
"no tool in this run needs a grant, so there is nothing to "
|
|
128
|
+
"authorise")
|
|
129
|
+
)
|
|
130
|
+
return names
|