@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.
Files changed (152) hide show
  1. package/.env.example +9 -4
  2. package/CONFIG_ARCHITECTURE.md +2030 -0
  3. package/LICENSE +201 -201
  4. package/NOTICE +1 -1
  5. package/README.md +1034 -895
  6. package/agents/builtin/build.md +73 -0
  7. package/agents/builtin/compactor.md +75 -75
  8. package/agents/builtin/explore.md +77 -77
  9. package/agents/builtin/general.md +80 -0
  10. package/agents/builtin/pipeline-reviewer.md +100 -100
  11. package/agents/builtin/plan.md +106 -88
  12. package/agents/builtin/review.md +74 -74
  13. package/agents/builtin/test.md +65 -0
  14. package/agents/builtin/writer.md +67 -0
  15. package/agents/manager.py +68 -2
  16. package/agents/subagent_tool.py +472 -238
  17. package/agents/tui_commands.py +238 -151
  18. package/bin/venastine.mjs +150 -4
  19. package/bin/venastine.py +71 -0
  20. package/cli_commands.py +838 -0
  21. package/config.py +95 -1198
  22. package/config.yaml +1103 -0
  23. package/config_edit.py +1301 -0
  24. package/config_schema.py +971 -0
  25. package/config_update.py +749 -0
  26. package/core/agent_activity.py +256 -118
  27. package/core/ansi.py +452 -0
  28. package/core/approval.py +137 -115
  29. package/core/call_view.py +364 -0
  30. package/core/cancel.py +121 -0
  31. package/core/chatgpt_auth.py +747 -0
  32. package/core/claims_view.py +107 -0
  33. package/core/client.py +2715 -1559
  34. package/core/commands.py +460 -0
  35. package/core/compaction.py +1735 -971
  36. package/core/config_loader.py +1982 -1563
  37. package/core/connect.py +686 -0
  38. package/core/events.py +123 -61
  39. package/core/file_mentions.py +280 -0
  40. package/core/interaction.py +411 -328
  41. package/core/line_pattern.py +128 -0
  42. package/core/loop.py +2566 -1490
  43. package/core/memory.py +482 -370
  44. package/core/pipeline_models.py +190 -176
  45. package/core/provider_errors.py +234 -0
  46. package/core/reasoning/authorization.py +130 -130
  47. package/core/reasoning/base.py +219 -219
  48. package/core/reasoning/confidence_scoring.py +484 -468
  49. package/core/reasoning/events.py +149 -149
  50. package/core/reasoning/json_retry.py +19 -1
  51. package/core/reasoning/orchestrator.py +1561 -1382
  52. package/core/reasoning/output_writer.py +345 -286
  53. package/core/reasoning/payload_validation.py +524 -398
  54. package/core/reasoning/pipeline_storage.py +88 -22
  55. package/core/reasoning/review.py +659 -615
  56. package/core/reasoning/scholar.py +458 -434
  57. package/core/reasoning/source_corpus.py +433 -327
  58. package/core/reasoning/source_scoring.py +855 -855
  59. package/core/replay.py +315 -183
  60. package/core/session.py +36 -12
  61. package/core/session_view.py +259 -0
  62. package/core/session_wake.py +259 -0
  63. package/core/shell_sessions.py +1553 -0
  64. package/core/workspace_trust.py +1 -1
  65. package/credentials.py +148 -20
  66. package/database.py +333 -252
  67. package/{PRIVACY.md → docs/PRIVACY.md} +78 -66
  68. package/docs/SECURITY.md +108 -0
  69. package/docs/THIRD_PARTY_NOTICES.md +148 -0
  70. package/env_secrets.py +50 -9
  71. package/json_store.py +343 -123
  72. package/logging_setup.py +295 -185
  73. package/main.py +3433 -1961
  74. package/mcp_client/client.py +733 -499
  75. package/mcp_client/config.py +126 -21
  76. package/mcp_client/registration.py +343 -182
  77. package/memories/manager.py +147 -132
  78. package/memories/tui_commands.py +319 -244
  79. package/package.json +303 -73
  80. package/project_init/config_files.py +282 -278
  81. package/project_init/generator.py +728 -564
  82. package/project_init/manifest.py +18 -6
  83. package/project_init/tui_commands.py +147 -144
  84. package/prompts/critic_pass.md +24 -24
  85. package/prompts/revalidate.md +25 -25
  86. package/prompts/revise.md +2 -0
  87. package/prompts/source_grounding.md +66 -66
  88. package/prompts/system_prompts.py +316 -262
  89. package/providers.json.example +4 -2
  90. package/pyproject.toml +149 -100
  91. package/requirements.txt +295 -72
  92. package/safety/policy_enforcement.py +1082 -746
  93. package/security/askpass.py +419 -0
  94. package/security/capability.py +207 -177
  95. package/security/confine.py +484 -0
  96. package/security/hosted.py +182 -0
  97. package/security/permissions.py +237 -190
  98. package/security/posture.py +124 -12
  99. package/security/protected_paths.py +501 -309
  100. package/security/sandbox.py +4108 -985
  101. package/security/secrets.py +855 -0
  102. package/skills/builtin/math/formal-specification.md +67 -67
  103. package/skills/builtin/math/numerical-methods.md +66 -66
  104. package/skills/builtin/research/experiment-design.md +62 -62
  105. package/skills/builtin/research/reproducibility.md +55 -55
  106. package/skills/builtin/research/source-evaluation.md +70 -70
  107. package/skills/builtin/research/statistical-inference.md +63 -63
  108. package/skills/builtin/research/technical-writing.md +59 -59
  109. package/skills/builtin/software/code-review.md +61 -61
  110. package/skills/builtin/software/debugging.md +61 -61
  111. package/skills/builtin/software/test-design.md +67 -67
  112. package/skills/tui_commands.py +110 -111
  113. package/storage.py +1338 -1005
  114. package/tools/base.py +161 -1
  115. package/tools/builtin/_math_common.py +667 -377
  116. package/tools/builtin/_net_common.py +225 -19
  117. package/tools/builtin/arxiv.py +497 -39
  118. package/tools/builtin/ask_user.py +231 -213
  119. package/tools/builtin/discrete_math.py +35 -4
  120. package/tools/builtin/fetch_url.py +371 -153
  121. package/tools/builtin/file_ops.py +720 -412
  122. package/tools/builtin/geometry.py +48 -12
  123. package/tools/builtin/get_time.py +2 -2
  124. package/tools/builtin/linear_algebra.py +66 -23
  125. package/tools/builtin/load_skill.py +76 -66
  126. package/tools/builtin/logic.py +171 -12
  127. package/tools/builtin/pin.py +227 -193
  128. package/tools/builtin/probability_stats.py +12 -16
  129. package/tools/builtin/project_docs.py +464 -405
  130. package/tools/builtin/remember.py +175 -158
  131. package/tools/builtin/shell.py +980 -461
  132. package/tools/builtin/shell_sessions.py +613 -0
  133. package/tools/builtin/symbolic_math.py +80 -10
  134. package/tools/builtin/todo.py +149 -147
  135. package/tools/builtin/web_search.py +191 -13
  136. package/tools/context.py +159 -136
  137. package/tools/isolation.py +107 -34
  138. package/tools/registry.py +1242 -925
  139. package/tui/app.py +8318 -4100
  140. package/tui/app.tcss +747 -556
  141. package/tui/commands.py +26 -170
  142. package/tui/diffs.py +34 -13
  143. package/tui/history.py +128 -128
  144. package/tui/hosted_driver.py +102 -0
  145. package/tui/markdown.py +1329 -1279
  146. package/tui/meters.py +364 -268
  147. package/tui/ravens.py +146 -146
  148. package/tui/screens.py +1255 -943
  149. package/tui/themes.py +599 -559
  150. package/tui/widgets.py +3813 -2332
  151. package/SECURITY.md +0 -88
  152. package/THIRD_PARTY_NOTICES.md +0 -100
@@ -0,0 +1,107 @@
1
+ """
2
+ core/claims_view.py
3
+
4
+ What a research run's claims view shows (ROADMAP_v2 §26), for either shell.
5
+
6
+ Moved out of `tui/screens.py` by ROADMAP_v3 §89 (#8), when the CLI got a
7
+ `/claims` of its own: which claims come first, which fields are shown and
8
+ how a malformed stored field reads are decisions about the RUN, not about
9
+ a modal, and the CLI printing its own copy of them is the disagreement
10
+ `core/replay.py` exists to prevent. The TUI's ClaimsScreen and the CLI's
11
+ `/claims` both draw what this returns.
12
+
13
+ Plain dicts, not Claim objects: the sources are `vars(c)` for a finished
14
+ in-session run, `pipeline_storage.load_pipeline_run()` for a stored one,
15
+ and the partial picture assembled from PipelineEvents mid-run.
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ # Tier order for the claims view: worst first. A reader opening this is
21
+ # looking for what NOT to trust, and burying the unverified claims under
22
+ # the confident ones makes them the hardest thing to find.
23
+ TIER_ORDER = ("UNVERIFIED", "UNVERIFIED_COVERAGE", "LOW", "MEDIUM", "HIGH")
24
+
25
+
26
+ def as_display_list(value) -> list:
27
+ """The members of a model-supplied list field, as text.
28
+
29
+ EVERY FIELD THIS GUARDS IS MODEL DATA READ BACK FROM A STORED RUN, AND
30
+ A STORED RUN MAY HAVE FAILED (batch 149). The orchestrator's except
31
+ block persists a snapshot before it re-raises, so a run that died in
32
+ Pass 5 on `assumption_flags: 123` leaves that value in the record --
33
+ and `/claims <run id>` then rendered it. `'; '.join(map(str, 123))`
34
+ raises TypeError inside `compose()`, which is NOT covered by the
35
+ containment batch 145 put at the `/` dispatch site: `push_screen`
36
+ returns an `await_mount`, so compose runs in the message pump rather
37
+ than in the handler's call stack, and the exception reaches Textual's
38
+ `_handle_exception` and takes the whole app down. Measured against the
39
+ real ClaimsScreen in a minimal host app.
40
+
41
+ The payload boundary now rejects each of these shapes at the pass that
42
+ sent them (§66 A25), which closes the producer -- but not for a record
43
+ written before it did, and this view's whole job is reading those.
44
+
45
+ A value that is not a list is shown as the one value it is, rather
46
+ than dropped: the reader asked what the run recorded, and "123" is the
47
+ answer.
48
+ """
49
+ if isinstance(value, (list, tuple)):
50
+ return [str(member) for member in value]
51
+ return [str(value)]
52
+
53
+
54
+ def claims_header(title: str, count: int, partial: bool) -> str:
55
+ """The view's first line: the run, how many claims, and whether the
56
+ run is still going.
57
+
58
+ The partial note is said rather than left to inference: mid-run, only
59
+ id, text and tier have been broadcast as events, and thin rows with no
60
+ note would read as a pipeline that recorded nothing.
61
+ """
62
+ header = f"{title} ({count})"
63
+ if partial:
64
+ header += " — run in progress, metadata incomplete"
65
+ return header
66
+
67
+
68
+ def render_claims(claims: list) -> str:
69
+ if not claims:
70
+ return "No claims recorded for this run."
71
+
72
+ def _rank(claim):
73
+ tier = claim.get("confidence_tier")
74
+ return TIER_ORDER.index(tier) if tier in TIER_ORDER else len(TIER_ORDER)
75
+
76
+ out = []
77
+ for claim in sorted(claims, key=_rank):
78
+ tier = claim.get("confidence_tier") or "—"
79
+ head = f"{tier:<20} {claim.get('id', '?')} {claim.get('type') or ''}"
80
+ if claim.get("retry_count"):
81
+ head += f" revised x{claim['retry_count']}"
82
+ out.append(head.rstrip())
83
+ # final_text is what the claim carries into the report; text is
84
+ # what Pass 2 extracted. Showing final_text when they differ means
85
+ # the view matches the report rather than the draft behind it.
86
+ out.append(f" {claim.get('final_text') or claim.get('text') or ''}")
87
+ if claim.get("entities"):
88
+ out.append(" entities: "
89
+ + ", ".join(as_display_list(claim["entities"])))
90
+ if claim.get("grounding_status") or claim.get("grounding_sources"):
91
+ sources = len(as_display_list(claim.get("grounding_sources")
92
+ or ()))
93
+ out.append(f" grounding: {claim.get('grounding_status') or 'none'}"
94
+ f" ({sources} source{'s' if sources != 1 else ''})")
95
+ for field, label in (("fallacies", "fallacies"),
96
+ ("contradictions", "contradictions"),
97
+ ("assumption_flags", "assumptions")):
98
+ if claim.get(field):
99
+ out.append(f" {label}: "
100
+ + "; ".join(as_display_list(claim[field])))
101
+ if claim.get("score_breakdown"):
102
+ out.append(" score: " + ", ".join(
103
+ f"{k}={v}" for k, v in claim["score_breakdown"].items()))
104
+ if claim.get("annotation"):
105
+ out.append(f" {claim['annotation']}")
106
+ out.append("")
107
+ return "\n".join(out).rstrip()