@yahyahammad/venastine 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/.env.example +14 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +14 -0
  4. package/PRIVACY.md +66 -0
  5. package/README.md +878 -0
  6. package/SECURITY.md +88 -0
  7. package/THIRD_PARTY_NOTICES.md +100 -0
  8. package/agents/builtin/compactor.md +75 -0
  9. package/agents/builtin/explore.md +77 -0
  10. package/agents/builtin/grill-me.md +27 -0
  11. package/agents/builtin/initializer.md +94 -0
  12. package/agents/builtin/pipeline-reviewer.md +100 -0
  13. package/agents/builtin/plan.md +88 -0
  14. package/agents/builtin/review.md +74 -0
  15. package/agents/manager.py +195 -0
  16. package/agents/subagent_tool.py +215 -0
  17. package/agents/tui_commands.py +136 -0
  18. package/bin/venastine.mjs +382 -0
  19. package/config.py +1198 -0
  20. package/core/__init__.py +0 -0
  21. package/core/approval.py +115 -0
  22. package/core/client.py +1548 -0
  23. package/core/compaction.py +959 -0
  24. package/core/config_loader.py +1563 -0
  25. package/core/events.py +61 -0
  26. package/core/interaction.py +328 -0
  27. package/core/loop.py +1353 -0
  28. package/core/memory.py +370 -0
  29. package/core/model_windows.py +175 -0
  30. package/core/pipeline_models.py +176 -0
  31. package/core/reasoning/__init__.py +0 -0
  32. package/core/reasoning/authorization.py +130 -0
  33. package/core/reasoning/base.py +219 -0
  34. package/core/reasoning/confidence_scoring.py +468 -0
  35. package/core/reasoning/events.py +149 -0
  36. package/core/reasoning/json_retry.py +219 -0
  37. package/core/reasoning/orchestrator.py +1382 -0
  38. package/core/reasoning/output_writer.py +286 -0
  39. package/core/reasoning/payload_validation.py +398 -0
  40. package/core/reasoning/pipeline_storage.py +361 -0
  41. package/core/reasoning/review.py +615 -0
  42. package/core/reasoning/scholar.py +434 -0
  43. package/core/reasoning/source_corpus.py +327 -0
  44. package/core/reasoning/source_scoring.py +855 -0
  45. package/core/replay.py +167 -0
  46. package/core/session.py +153 -0
  47. package/core/workspace_trust.py +207 -0
  48. package/credentials.py +180 -0
  49. package/database.py +252 -0
  50. package/env_secrets.py +77 -0
  51. package/json_store.py +123 -0
  52. package/logging_setup.py +185 -0
  53. package/main.py +1959 -0
  54. package/mcp_client/__init__.py +15 -0
  55. package/mcp_client/client.py +499 -0
  56. package/mcp_client/config.py +379 -0
  57. package/mcp_client/registration.py +182 -0
  58. package/memories/manager.py +132 -0
  59. package/memories/tui_commands.py +232 -0
  60. package/package.json +73 -0
  61. package/project_init/config_files.py +278 -0
  62. package/project_init/doc_sets.py +330 -0
  63. package/project_init/generator.py +564 -0
  64. package/project_init/manifest.py +406 -0
  65. package/project_init/tui_commands.py +144 -0
  66. package/prompts/__init__.py +0 -0
  67. package/prompts/annotate.md +14 -0
  68. package/prompts/assumption_audit.md +27 -0
  69. package/prompts/claim_extraction.md +34 -0
  70. package/prompts/completeness.md +18 -0
  71. package/prompts/confidence_tiers.md +23 -0
  72. package/prompts/critic_pass.md +24 -0
  73. package/prompts/final_synthesis.md +13 -0
  74. package/prompts/initial_generation.md +14 -0
  75. package/prompts/preliminary_plan.md +23 -0
  76. package/prompts/revalidate.md +25 -0
  77. package/prompts/revise.md +15 -0
  78. package/prompts/source_grounding.md +66 -0
  79. package/prompts/system_prompts.py +262 -0
  80. package/prompts/universal_system_prompt +7 -0
  81. package/prompts/untrusted_content +1 -0
  82. package/providers.json.example +92 -0
  83. package/pyproject.toml +100 -0
  84. package/requirements.txt +72 -0
  85. package/safety/__init__.py +0 -0
  86. package/safety/policy_enforcement.py +682 -0
  87. package/security/__init__.py +0 -0
  88. package/security/capability.py +177 -0
  89. package/security/permissions.py +190 -0
  90. package/security/posture.py +302 -0
  91. package/security/protected_paths.py +309 -0
  92. package/security/sandbox.py +985 -0
  93. package/skills/builtin/crypto/cryptography-verification.md +66 -0
  94. package/skills/builtin/math/formal-specification.md +67 -0
  95. package/skills/builtin/math/numerical-methods.md +66 -0
  96. package/skills/builtin/math/proof-writing.md +61 -0
  97. package/skills/builtin/research/experiment-design.md +62 -0
  98. package/skills/builtin/research/literature-review.md +65 -0
  99. package/skills/builtin/research/reproducibility.md +55 -0
  100. package/skills/builtin/research/source-evaluation.md +70 -0
  101. package/skills/builtin/research/statistical-inference.md +63 -0
  102. package/skills/builtin/research/technical-writing.md +59 -0
  103. package/skills/builtin/security/cybersecurity-research.md +63 -0
  104. package/skills/builtin/software/code-review.md +61 -0
  105. package/skills/builtin/software/debugging.md +61 -0
  106. package/skills/builtin/software/test-design.md +67 -0
  107. package/skills/manager.py +138 -0
  108. package/skills/tui_commands.py +111 -0
  109. package/storage.py +1005 -0
  110. package/tools/base.py +305 -0
  111. package/tools/builtin/__init__.py +0 -0
  112. package/tools/builtin/_math_common.py +377 -0
  113. package/tools/builtin/_net_common.py +61 -0
  114. package/tools/builtin/arxiv.py +223 -0
  115. package/tools/builtin/ask_user.py +213 -0
  116. package/tools/builtin/discrete_math.py +134 -0
  117. package/tools/builtin/fetch_url.py +153 -0
  118. package/tools/builtin/file_ops.py +412 -0
  119. package/tools/builtin/geometry.py +148 -0
  120. package/tools/builtin/get_time.py +20 -0
  121. package/tools/builtin/linear_algebra.py +155 -0
  122. package/tools/builtin/load_skill.py +66 -0
  123. package/tools/builtin/logic.py +96 -0
  124. package/tools/builtin/pin.py +193 -0
  125. package/tools/builtin/probability_stats.py +228 -0
  126. package/tools/builtin/project_docs.py +405 -0
  127. package/tools/builtin/remember.py +158 -0
  128. package/tools/builtin/shell.py +461 -0
  129. package/tools/builtin/symbolic_math.py +119 -0
  130. package/tools/builtin/todo.py +147 -0
  131. package/tools/builtin/web_search.py +151 -0
  132. package/tools/context.py +136 -0
  133. package/tools/isolation.py +314 -0
  134. package/tools/registry.py +897 -0
  135. package/tui/app.py +3423 -0
  136. package/tui/app.tcss +458 -0
  137. package/tui/commands.py +61 -0
  138. package/tui/diffs.py +265 -0
  139. package/tui/preferences.py +182 -0
  140. package/tui/ravens.py +146 -0
  141. package/tui/screens.py +943 -0
  142. package/tui/themes.py +366 -0
  143. package/tui/widgets.py +1239 -0
File without changes
@@ -0,0 +1,115 @@
1
+ """
2
+ core/approval.py
3
+
4
+ ROADMAP_v2 §25. How a run obtains human authorization for a tool call,
5
+ as data rather than as a mechanism baked into one shell.
6
+
7
+ There are exactly two ways an approval-gated call can proceed, and they
8
+ compose:
9
+
10
+ * a GRANT -- the user said yes before the run started, naming tools.
11
+ * a PROVIDER -- the user is present and can be asked, per call.
12
+
13
+ Neither is a policy relaxation. security/permissions.py still decides
14
+ whether a tool is allowed at all and whether a call needs approval (D14,
15
+ "stricter wins"); this module only carries the human's answer to the
16
+ question that policy raised. That is why a grant lives on RunInfo and not
17
+ in ToolContext.approval_overrides -- those OR, so they can only tighten.
18
+
19
+ §23 CARRIED OUT the generalisation this module used to anticipate.
20
+ `ApprovalProvider` and `ReviewConsent` both lived here and are gone: they
21
+ were two caller-supplied ways to ask a question and block for an answer,
22
+ and they are now one, `core.interaction.ResponseChannel`. What remains
23
+ here is authorization DATA -- what the human already decided and how much
24
+ of it is left to spend -- which is a different thing from the means of
25
+ asking, and is why the two are separate modules rather than one.
26
+
27
+ `RunAuthorization.provider` therefore holds a ResponseChannel now. The
28
+ field keeps its name because it plays the same role in the bundle: the
29
+ route by which a run can obtain an answer it does not already have.
30
+
31
+ Deliberately a leaf module with no project imports -- core/interaction.py
32
+ is imported for typing only, and it is itself a leaf. core/loop.py,
33
+ main.py, tui/app.py and core/reasoning/ all depend on both; neither
34
+ depends on them.
35
+ """
36
+
37
+ from dataclasses import dataclass, field
38
+ from typing import TYPE_CHECKING, Optional
39
+
40
+ if TYPE_CHECKING: # pragma: no cover - typing only, never imported at runtime
41
+ from core.interaction import ResponseChannel
42
+
43
+
44
+ class GrantBudget:
45
+ """A ceiling on how many pre-granted calls one run may make.
46
+
47
+ Pre-flight authorization trades a per-call decision for a single
48
+ up-front one, so the thing it gives up is the natural bound on how
49
+ many times a granted tool runs. A ten-pass pipeline reading
50
+ attacker-controlled web pages is exactly where an injected loop would
51
+ spend that authority, and where nobody is watching it happen.
52
+
53
+ ONE instance per pipeline run, shared across all ten passes BY
54
+ REFERENCE -- a budget rebuilt per pass would multiply the ceiling by
55
+ ten and read as if it were enforcing one.
56
+
57
+ Exhaustion is not a failure: take() returning False means the grant
58
+ stops applying, so the call falls back to being ASKED. With a provider
59
+ present the run continues under supervision; without one it is denied,
60
+ which is what a headless run does with any gated tool anyway.
61
+ """
62
+
63
+ def __init__(self, limit: int) -> None:
64
+ self.limit = limit
65
+ self.used = 0
66
+
67
+ def take(self) -> bool:
68
+ """Consume one unit. False when the ceiling is reached."""
69
+ if self.used >= self.limit:
70
+ return False
71
+ self.used += 1
72
+ return True
73
+
74
+ @property
75
+ def exhausted(self) -> bool:
76
+ return self.used >= self.limit
77
+
78
+
79
+ @dataclass
80
+ class RunAuthorization:
81
+ """Everything a run needs to answer "may this gated call proceed?".
82
+
83
+ Bundled rather than passed as three parameters because it threads
84
+ through four layers -- shell, orchestrator, pass entry point, loop --
85
+ and three of those only forward it. A bundle means adding a fourth
86
+ kind of authorization later touches the layers that USE it, not every
87
+ layer it passes through.
88
+
89
+ granted_tools: names authorised before the run. Only meaningful for
90
+ tools the registry reports as grantable; the loop re-checks rather
91
+ than trusting the set, so a stale or hand-edited name cannot widen
92
+ anything.
93
+ provider: a core.interaction.ResponseChannel, present iff someone can
94
+ be asked during the run. §23 replaced ApprovalProvider here; the
95
+ field name stays because its role in the bundle is unchanged.
96
+ budget: shared across every pass of one pipeline run.
97
+ """
98
+
99
+ granted_tools: set = field(default_factory=set)
100
+ provider: Optional["ResponseChannel"] = None
101
+ budget: Optional[GrantBudget] = None
102
+ # Calls that proceeded on the grant, accumulated across every pass of
103
+ # one run. Lives here rather than in module state or a per-pass return
104
+ # value for the same reason the budget does: the bundle is already
105
+ # shared by reference, and what the authorization was SPENT ON is
106
+ # authorization state. The orchestrator points PipelineRun.granted_calls
107
+ # at THIS SAME LIST at the start of the run, so the trail is on the run
108
+ # at every §5 checkpoint and on the failure path.
109
+ #
110
+ # Not a copy taken at the end -- this comment used to say it was, which
111
+ # is the design §25 rejected and the opposite of what the code does
112
+ # (audit #83). Copying at the end would lose the trail on exactly the
113
+ # runs most worth auditing; unit 9 mutated the share into `list(...)`
114
+ # and it went red.
115
+ granted_calls: list = field(default_factory=list)