@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.
- package/.env.example +14 -0
- package/LICENSE +201 -0
- package/NOTICE +14 -0
- package/PRIVACY.md +66 -0
- package/README.md +878 -0
- package/SECURITY.md +88 -0
- package/THIRD_PARTY_NOTICES.md +100 -0
- package/agents/builtin/compactor.md +75 -0
- package/agents/builtin/explore.md +77 -0
- package/agents/builtin/grill-me.md +27 -0
- package/agents/builtin/initializer.md +94 -0
- package/agents/builtin/pipeline-reviewer.md +100 -0
- package/agents/builtin/plan.md +88 -0
- package/agents/builtin/review.md +74 -0
- package/agents/manager.py +195 -0
- package/agents/subagent_tool.py +215 -0
- package/agents/tui_commands.py +136 -0
- package/bin/venastine.mjs +382 -0
- package/config.py +1198 -0
- package/core/__init__.py +0 -0
- package/core/approval.py +115 -0
- package/core/client.py +1548 -0
- package/core/compaction.py +959 -0
- package/core/config_loader.py +1563 -0
- package/core/events.py +61 -0
- package/core/interaction.py +328 -0
- package/core/loop.py +1353 -0
- package/core/memory.py +370 -0
- package/core/model_windows.py +175 -0
- package/core/pipeline_models.py +176 -0
- package/core/reasoning/__init__.py +0 -0
- package/core/reasoning/authorization.py +130 -0
- package/core/reasoning/base.py +219 -0
- package/core/reasoning/confidence_scoring.py +468 -0
- package/core/reasoning/events.py +149 -0
- package/core/reasoning/json_retry.py +219 -0
- package/core/reasoning/orchestrator.py +1382 -0
- package/core/reasoning/output_writer.py +286 -0
- package/core/reasoning/payload_validation.py +398 -0
- package/core/reasoning/pipeline_storage.py +361 -0
- package/core/reasoning/review.py +615 -0
- package/core/reasoning/scholar.py +434 -0
- package/core/reasoning/source_corpus.py +327 -0
- package/core/reasoning/source_scoring.py +855 -0
- package/core/replay.py +167 -0
- package/core/session.py +153 -0
- package/core/workspace_trust.py +207 -0
- package/credentials.py +180 -0
- package/database.py +252 -0
- package/env_secrets.py +77 -0
- package/json_store.py +123 -0
- package/logging_setup.py +185 -0
- package/main.py +1959 -0
- package/mcp_client/__init__.py +15 -0
- package/mcp_client/client.py +499 -0
- package/mcp_client/config.py +379 -0
- package/mcp_client/registration.py +182 -0
- package/memories/manager.py +132 -0
- package/memories/tui_commands.py +232 -0
- package/package.json +73 -0
- package/project_init/config_files.py +278 -0
- package/project_init/doc_sets.py +330 -0
- package/project_init/generator.py +564 -0
- package/project_init/manifest.py +406 -0
- package/project_init/tui_commands.py +144 -0
- package/prompts/__init__.py +0 -0
- package/prompts/annotate.md +14 -0
- package/prompts/assumption_audit.md +27 -0
- package/prompts/claim_extraction.md +34 -0
- package/prompts/completeness.md +18 -0
- package/prompts/confidence_tiers.md +23 -0
- package/prompts/critic_pass.md +24 -0
- package/prompts/final_synthesis.md +13 -0
- package/prompts/initial_generation.md +14 -0
- package/prompts/preliminary_plan.md +23 -0
- package/prompts/revalidate.md +25 -0
- package/prompts/revise.md +15 -0
- package/prompts/source_grounding.md +66 -0
- package/prompts/system_prompts.py +262 -0
- package/prompts/universal_system_prompt +7 -0
- package/prompts/untrusted_content +1 -0
- package/providers.json.example +92 -0
- package/pyproject.toml +100 -0
- package/requirements.txt +72 -0
- package/safety/__init__.py +0 -0
- package/safety/policy_enforcement.py +682 -0
- package/security/__init__.py +0 -0
- package/security/capability.py +177 -0
- package/security/permissions.py +190 -0
- package/security/posture.py +302 -0
- package/security/protected_paths.py +309 -0
- package/security/sandbox.py +985 -0
- package/skills/builtin/crypto/cryptography-verification.md +66 -0
- package/skills/builtin/math/formal-specification.md +67 -0
- package/skills/builtin/math/numerical-methods.md +66 -0
- package/skills/builtin/math/proof-writing.md +61 -0
- package/skills/builtin/research/experiment-design.md +62 -0
- package/skills/builtin/research/literature-review.md +65 -0
- package/skills/builtin/research/reproducibility.md +55 -0
- package/skills/builtin/research/source-evaluation.md +70 -0
- package/skills/builtin/research/statistical-inference.md +63 -0
- package/skills/builtin/research/technical-writing.md +59 -0
- package/skills/builtin/security/cybersecurity-research.md +63 -0
- package/skills/builtin/software/code-review.md +61 -0
- package/skills/builtin/software/debugging.md +61 -0
- package/skills/builtin/software/test-design.md +67 -0
- package/skills/manager.py +138 -0
- package/skills/tui_commands.py +111 -0
- package/storage.py +1005 -0
- package/tools/base.py +305 -0
- package/tools/builtin/__init__.py +0 -0
- package/tools/builtin/_math_common.py +377 -0
- package/tools/builtin/_net_common.py +61 -0
- package/tools/builtin/arxiv.py +223 -0
- package/tools/builtin/ask_user.py +213 -0
- package/tools/builtin/discrete_math.py +134 -0
- package/tools/builtin/fetch_url.py +153 -0
- package/tools/builtin/file_ops.py +412 -0
- package/tools/builtin/geometry.py +148 -0
- package/tools/builtin/get_time.py +20 -0
- package/tools/builtin/linear_algebra.py +155 -0
- package/tools/builtin/load_skill.py +66 -0
- package/tools/builtin/logic.py +96 -0
- package/tools/builtin/pin.py +193 -0
- package/tools/builtin/probability_stats.py +228 -0
- package/tools/builtin/project_docs.py +405 -0
- package/tools/builtin/remember.py +158 -0
- package/tools/builtin/shell.py +461 -0
- package/tools/builtin/symbolic_math.py +119 -0
- package/tools/builtin/todo.py +147 -0
- package/tools/builtin/web_search.py +151 -0
- package/tools/context.py +136 -0
- package/tools/isolation.py +314 -0
- package/tools/registry.py +897 -0
- package/tui/app.py +3423 -0
- package/tui/app.tcss +458 -0
- package/tui/commands.py +61 -0
- package/tui/diffs.py +265 -0
- package/tui/preferences.py +182 -0
- package/tui/ravens.py +146 -0
- package/tui/screens.py +943 -0
- package/tui/themes.py +366 -0
- package/tui/widgets.py +1239 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
"""
|
|
2
|
+
core/reasoning/source_corpus.py
|
|
3
|
+
|
|
4
|
+
What a claim was actually grounded IN, kept for the length of one run.
|
|
5
|
+
|
|
6
|
+
ROADMAP_v2 §45 (SQ2). Pass 3a's `sources` list has always been URLs and two
|
|
7
|
+
model-invented floats. The text those URLs served reached the model, was
|
|
8
|
+
stringified into the pass thread, and was then unreachable: nothing in
|
|
9
|
+
`03_grounding.json` could say what a page had said, so `similarity_score`
|
|
10
|
+
could not be checked against anything and a quote could not be checked at
|
|
11
|
+
all. `fetch_url.py`'s own comment already describes the artifact this
|
|
12
|
+
builds ("output_writer builds each run's sources/ directory from it") --
|
|
13
|
+
that directory has existed and been empty since §12.
|
|
14
|
+
|
|
15
|
+
WHY A SECOND SINK RATHER THAN A CHANGE TO _translate. The orchestrator
|
|
16
|
+
already sees every tool result and deliberately forwards only `ok` plus an
|
|
17
|
+
error string to the UI, because a successful result body is not
|
|
18
|
+
observability. That boundary is unchanged. This is a different consumer
|
|
19
|
+
with a different need, attached beside it -- the corpus is read by the
|
|
20
|
+
scoring stage and written to the run directory, and neither is a
|
|
21
|
+
transcript.
|
|
22
|
+
|
|
23
|
+
REDACTED ON ENTRY, THOUGH IT ARRIVES REDACTED. `registry.dispatch` runs
|
|
24
|
+
every result through `check_output_policy` before the loop emits it, so
|
|
25
|
+
what lands here has already been through `redact_output_text`. It is run
|
|
26
|
+
again anyway, and for `_translate`'s stated reason: one rule owned at one
|
|
27
|
+
boundary -- nothing is stored by this module unredacted -- beats depending
|
|
28
|
+
on a guarantee made two layers away that a later refactor could quietly
|
|
29
|
+
drop. The second pass is a no-op on already-clean text.
|
|
30
|
+
|
|
31
|
+
THIS MODULE OWNS URL IDENTITY for the pipeline. Two spellings of one arXiv
|
|
32
|
+
paper are one source, and a model that cites `/abs/2005.14165v3` after
|
|
33
|
+
fetching `/abs/2005.14165` must not be told its own citation has no text.
|
|
34
|
+
`scholar.py` resolves the same URLs and imports `arxiv_id_from_url` from
|
|
35
|
+
here rather than re-deriving it -- a second copy of "what counts as the
|
|
36
|
+
same paper" is how the corpus and the scholarly lookup come to disagree
|
|
37
|
+
about one source in one artifact.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
from __future__ import annotations
|
|
41
|
+
|
|
42
|
+
import hashlib
|
|
43
|
+
import logging
|
|
44
|
+
import re
|
|
45
|
+
from dataclasses import dataclass, field
|
|
46
|
+
from datetime import datetime, timezone
|
|
47
|
+
from urllib.parse import urlsplit, urlunsplit
|
|
48
|
+
|
|
49
|
+
from safety.policy_enforcement import redact_output_text
|
|
50
|
+
|
|
51
|
+
logger = logging.getLogger(__name__)
|
|
52
|
+
|
|
53
|
+
# Bounds, not tuning. A research pass calls fetch_url a bounded number of
|
|
54
|
+
# times (§31 budgets), so these are a backstop against a pathological run
|
|
55
|
+
# rather than a knob anyone is expected to turn: the corpus is held in
|
|
56
|
+
# memory for the length of a run and then written to disk.
|
|
57
|
+
#
|
|
58
|
+
# MAX_DOCUMENT_CHARS is deliberately well ABOVE fetch_url's own
|
|
59
|
+
# MAX_CONTENT_CHARS (5000). It bounds this module against a future tool
|
|
60
|
+
# that returns more; it is not a second truncation of the tools that exist,
|
|
61
|
+
# because a cap that bites in normal operation would silently shorten the
|
|
62
|
+
# text a similarity score is computed from.
|
|
63
|
+
MAX_DOCUMENTS = 200
|
|
64
|
+
MAX_DOCUMENT_CHARS = 20_000
|
|
65
|
+
|
|
66
|
+
# Below this, a "document" is a title and a fragment -- a web_search
|
|
67
|
+
# snippet for a result nobody fetched. Kept, because a 300-char snippet is
|
|
68
|
+
# still the only text some cited URLs ever have, and scoring a claim
|
|
69
|
+
# against it is better than reporting no evidence at all. The constant
|
|
70
|
+
# exists to reject the empty and near-empty case, not the short one.
|
|
71
|
+
MIN_DOCUMENT_CHARS = 16
|
|
72
|
+
|
|
73
|
+
_ARXIV_HOSTS = {"arxiv.org", "www.arxiv.org", "export.arxiv.org"}
|
|
74
|
+
# `2005.14165`, `2005.14165v3`, and the pre-2007 `math.GT/0309136` form --
|
|
75
|
+
# whose archive prefix contains a SLASH, which is why the id group cannot
|
|
76
|
+
# simply exclude one. A path with any further segment is not an arXiv id.
|
|
77
|
+
_ARXIV_PATH_RE = re.compile(
|
|
78
|
+
r"^/(?:abs|pdf)/"
|
|
79
|
+
r"(?P<id>(?:[a-z-]+(?:\.[A-Za-z]{2})?/)?[^/?#]+?)"
|
|
80
|
+
r"(?:v\d+)?(?:\.pdf)?$",
|
|
81
|
+
re.IGNORECASE,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@dataclass
|
|
86
|
+
class SourceDocument:
|
|
87
|
+
"""One URL's best available text, and where it came from.
|
|
88
|
+
|
|
89
|
+
`tool` and `retrieved_at` are provenance rather than decoration: a
|
|
90
|
+
similarity score computed from a 300-char search snippet and one
|
|
91
|
+
computed from a fetched page are not the same measurement, and a
|
|
92
|
+
reader of the artifact has to be able to tell which they are looking
|
|
93
|
+
at.
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
url: str
|
|
97
|
+
text: str
|
|
98
|
+
title: str = ""
|
|
99
|
+
tool: str = ""
|
|
100
|
+
retrieved_at: str = ""
|
|
101
|
+
|
|
102
|
+
@property
|
|
103
|
+
def sha256(self) -> str:
|
|
104
|
+
return hashlib.sha256(self.text.encode("utf-8")).hexdigest()
|
|
105
|
+
|
|
106
|
+
def as_artifact(self) -> dict:
|
|
107
|
+
return {
|
|
108
|
+
"url": self.url,
|
|
109
|
+
"title": self.title,
|
|
110
|
+
"tool": self.tool,
|
|
111
|
+
"retrieved_at": self.retrieved_at,
|
|
112
|
+
"sha256": self.sha256,
|
|
113
|
+
"chars": len(self.text),
|
|
114
|
+
"text": self.text,
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def _now() -> str:
|
|
119
|
+
return datetime.now(timezone.utc).isoformat(timespec="seconds")
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def arxiv_id_from_url(url: str) -> str | None:
|
|
123
|
+
"""The bare arXiv id in `url`, version stripped, or None.
|
|
124
|
+
|
|
125
|
+
Version stripped because a version is not a different paper for any
|
|
126
|
+
purpose this pipeline has: the corpus keys on it, and OpenAlex's DOI
|
|
127
|
+
for `2005.14165v3` is `10.48550/arXiv.2005.14165`.
|
|
128
|
+
"""
|
|
129
|
+
try:
|
|
130
|
+
parts = urlsplit(url)
|
|
131
|
+
except ValueError:
|
|
132
|
+
return None
|
|
133
|
+
if parts.hostname is None or parts.hostname.lower() not in _ARXIV_HOSTS:
|
|
134
|
+
return None
|
|
135
|
+
match = _ARXIV_PATH_RE.match(parts.path)
|
|
136
|
+
return match.group("id") if match else None
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def normalize_url(url: str) -> str:
|
|
140
|
+
"""The key two spellings of one source have to share.
|
|
141
|
+
|
|
142
|
+
Case-folds the scheme and host, drops the fragment, drops a default
|
|
143
|
+
port, drops a bare trailing slash, and collapses every arXiv `abs`/`pdf`
|
|
144
|
+
spelling onto one canonical `abs` URL. The QUERY IS KEPT: `?id=7` is a
|
|
145
|
+
different page on most sites, and dropping it would merge sources that
|
|
146
|
+
say different things.
|
|
147
|
+
|
|
148
|
+
An unparseable URL is returned stripped rather than raising. This runs
|
|
149
|
+
on model-supplied strings; a malformed one should fail to match a
|
|
150
|
+
document, not fail the run.
|
|
151
|
+
"""
|
|
152
|
+
raw = (url or "").strip()
|
|
153
|
+
if not raw:
|
|
154
|
+
return ""
|
|
155
|
+
|
|
156
|
+
arxiv_id = arxiv_id_from_url(raw)
|
|
157
|
+
if arxiv_id:
|
|
158
|
+
return f"https://arxiv.org/abs/{arxiv_id}"
|
|
159
|
+
|
|
160
|
+
try:
|
|
161
|
+
parts = urlsplit(raw)
|
|
162
|
+
except ValueError:
|
|
163
|
+
return raw
|
|
164
|
+
|
|
165
|
+
host = (parts.hostname or "").lower()
|
|
166
|
+
if not host:
|
|
167
|
+
return raw
|
|
168
|
+
if parts.port and not (
|
|
169
|
+
(parts.scheme == "http" and parts.port == 80)
|
|
170
|
+
or (parts.scheme == "https" and parts.port == 443)
|
|
171
|
+
):
|
|
172
|
+
host = f"{host}:{parts.port}"
|
|
173
|
+
|
|
174
|
+
path = parts.path
|
|
175
|
+
if path == "/":
|
|
176
|
+
path = ""
|
|
177
|
+
|
|
178
|
+
return urlunsplit((parts.scheme.lower(), host, path, parts.query, ""))
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
@dataclass
|
|
182
|
+
class SourceCorpus:
|
|
183
|
+
"""Every source text one run retrieved, keyed by normalized URL.
|
|
184
|
+
|
|
185
|
+
Run-scoped and passed by reference, the way `run.granted_calls` is
|
|
186
|
+
(§25): one object means the corpus is already complete at the moment
|
|
187
|
+
the scoring stage reads it, rather than being assembled at the end by a
|
|
188
|
+
run that reached the end.
|
|
189
|
+
|
|
190
|
+
THE LONGEST TEXT WINS. One URL can arrive three times -- as a 300-char
|
|
191
|
+
web_search snippet, as a 600-char arXiv abstract, and as 5000 chars
|
|
192
|
+
from fetch_url -- and the question every consumer asks is "what is the
|
|
193
|
+
most this run knows about this page". Last-write-wins would make the
|
|
194
|
+
answer depend on the order the model happened to call its tools in.
|
|
195
|
+
"""
|
|
196
|
+
|
|
197
|
+
documents: dict = field(default_factory=dict)
|
|
198
|
+
dropped: int = 0
|
|
199
|
+
|
|
200
|
+
# -- ingest ----------------------------------------------------------
|
|
201
|
+
|
|
202
|
+
def add(self, tool_name: str, result) -> int:
|
|
203
|
+
"""Absorb one tool result. Returns how many documents it added or
|
|
204
|
+
improved.
|
|
205
|
+
|
|
206
|
+
Anything unrecognised is ignored silently: this is attached to
|
|
207
|
+
EVERY tool result a research pass produces, and a `todo_write`
|
|
208
|
+
return value is not a defect worth a log line. A recognised tool
|
|
209
|
+
whose result is the error shape is also ignored -- `arxiv.py` and
|
|
210
|
+
`web_search.py` both return errors rather than raising, so an
|
|
211
|
+
error dict is an ordinary occurrence here.
|
|
212
|
+
"""
|
|
213
|
+
if not isinstance(result, dict) or "error" in result:
|
|
214
|
+
return 0
|
|
215
|
+
if tool_name == "fetch_url":
|
|
216
|
+
return self._add_fetch_url(result)
|
|
217
|
+
if tool_name == "arxiv_search":
|
|
218
|
+
return self._add_arxiv(result)
|
|
219
|
+
if tool_name == "web_search":
|
|
220
|
+
return self._add_web_search(result)
|
|
221
|
+
return 0
|
|
222
|
+
|
|
223
|
+
def _add_fetch_url(self, result: dict) -> int:
|
|
224
|
+
# `url` is the URL that ANSWERED, after redirects -- which is what
|
|
225
|
+
# fetch_url.py:89-95 says the grounding pass attributes the text
|
|
226
|
+
# to, and therefore what the model will cite.
|
|
227
|
+
return self._store(
|
|
228
|
+
url=result.get("url"),
|
|
229
|
+
text=result.get("content"),
|
|
230
|
+
title="",
|
|
231
|
+
tool="fetch_url",
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
def _add_arxiv(self, result: dict) -> int:
|
|
235
|
+
added = 0
|
|
236
|
+
for entry in result.get("results") or ():
|
|
237
|
+
if not isinstance(entry, dict):
|
|
238
|
+
continue
|
|
239
|
+
arxiv_id = (entry.get("arxiv_id") or "").strip()
|
|
240
|
+
if not arxiv_id:
|
|
241
|
+
continue
|
|
242
|
+
title = (entry.get("title") or "").strip()
|
|
243
|
+
summary = (entry.get("summary") or "").strip()
|
|
244
|
+
# Title AND abstract, joined. The title carries the paper's
|
|
245
|
+
# subject in the compressed form a claim is usually phrased in,
|
|
246
|
+
# and a 600-char abstract that opens on background prose can
|
|
247
|
+
# otherwise match a claim about the paper's own topic poorly.
|
|
248
|
+
text = "\n\n".join(p for p in (title, summary) if p)
|
|
249
|
+
added += self._store(
|
|
250
|
+
url=f"https://arxiv.org/abs/{arxiv_id}",
|
|
251
|
+
text=text,
|
|
252
|
+
title=title,
|
|
253
|
+
tool="arxiv_search",
|
|
254
|
+
)
|
|
255
|
+
return added
|
|
256
|
+
|
|
257
|
+
def _add_web_search(self, result: dict) -> int:
|
|
258
|
+
added = 0
|
|
259
|
+
for entry in result.get("results") or ():
|
|
260
|
+
if not isinstance(entry, dict):
|
|
261
|
+
continue
|
|
262
|
+
title = (entry.get("title") or "").strip()
|
|
263
|
+
snippet = (entry.get("snippet") or "").strip()
|
|
264
|
+
text = "\n\n".join(p for p in (title, snippet) if p)
|
|
265
|
+
added += self._store(
|
|
266
|
+
url=entry.get("url"),
|
|
267
|
+
text=text,
|
|
268
|
+
title=title,
|
|
269
|
+
tool="web_search",
|
|
270
|
+
)
|
|
271
|
+
return added
|
|
272
|
+
|
|
273
|
+
def _store(self, url, text, title: str, tool: str) -> int:
|
|
274
|
+
if not isinstance(url, str) or not isinstance(text, str):
|
|
275
|
+
return 0
|
|
276
|
+
key = normalize_url(url)
|
|
277
|
+
if not key:
|
|
278
|
+
return 0
|
|
279
|
+
|
|
280
|
+
cleaned = redact_output_text(text).strip()
|
|
281
|
+
if len(cleaned) < MIN_DOCUMENT_CHARS:
|
|
282
|
+
return 0
|
|
283
|
+
cleaned = cleaned[:MAX_DOCUMENT_CHARS]
|
|
284
|
+
|
|
285
|
+
existing = self.documents.get(key)
|
|
286
|
+
if existing is not None and len(existing.text) >= len(cleaned):
|
|
287
|
+
return 0
|
|
288
|
+
if existing is None and len(self.documents) >= MAX_DOCUMENTS:
|
|
289
|
+
# Counted rather than logged per drop: a run that hits this is
|
|
290
|
+
# hitting it repeatedly, and the count is what the trace line
|
|
291
|
+
# at the end of the stage reports.
|
|
292
|
+
self.dropped += 1
|
|
293
|
+
return 0
|
|
294
|
+
|
|
295
|
+
self.documents[key] = SourceDocument(
|
|
296
|
+
url=key, text=cleaned, title=title or (existing.title if existing else ""),
|
|
297
|
+
tool=tool, retrieved_at=_now(),
|
|
298
|
+
)
|
|
299
|
+
return 1
|
|
300
|
+
|
|
301
|
+
# -- read ------------------------------------------------------------
|
|
302
|
+
|
|
303
|
+
def get(self, url: str):
|
|
304
|
+
"""The document held for `url`, or None. Normalizes first, so a
|
|
305
|
+
caller passing the model's spelling gets the fetched page."""
|
|
306
|
+
return self.documents.get(normalize_url(url))
|
|
307
|
+
|
|
308
|
+
def text_for(self, url: str) -> str:
|
|
309
|
+
document = self.get(url)
|
|
310
|
+
return document.text if document is not None else ""
|
|
311
|
+
|
|
312
|
+
def __len__(self) -> int:
|
|
313
|
+
return len(self.documents)
|
|
314
|
+
|
|
315
|
+
def __bool__(self) -> bool:
|
|
316
|
+
# Explicit, because __len__ alone would make an empty corpus
|
|
317
|
+
# falsy and every `if corpus:` guard in the orchestrator would
|
|
318
|
+
# then mean "if anything was fetched" rather than "if a corpus is
|
|
319
|
+
# being collected at all". Those are different questions and the
|
|
320
|
+
# first one is never the one being asked.
|
|
321
|
+
return True
|
|
322
|
+
|
|
323
|
+
def artifact_entries(self) -> list[dict]:
|
|
324
|
+
"""Every document, newest spelling of each URL, sorted for a
|
|
325
|
+
stable diff between runs."""
|
|
326
|
+
return [self.documents[key].as_artifact()
|
|
327
|
+
for key in sorted(self.documents)]
|