@yahyahammad/venastine 0.3.9 → 0.3.11
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/CONFIG_ARCHITECTURE.md +109 -0
- package/NOTICE +5 -3
- package/README.md +13 -4
- package/bin/venastine.mjs +62 -6
- package/bin/venastine.py +3 -1
- package/cli_commands.py +10 -0
- package/config.yaml +51 -0
- package/config_schema.py +16 -0
- package/core/client.py +45 -4
- package/core/commands.py +4 -0
- package/core/provider_errors.py +40 -0
- package/core/reasoning/scholar.py +14 -5
- package/docs/SECURITY.md +6 -0
- package/docs/THIRD_PARTY_NOTICES.md +133 -60
- package/mcp_client/client.py +49 -2
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/requirements.txt +19 -0
- package/tools/builtin/_net_common.py +878 -0
- package/tools/builtin/_page_text.py +490 -0
- package/tools/builtin/_pdf_text.py +113 -0
- package/tools/builtin/arxiv.py +5 -1
- package/tools/builtin/fetch_url.py +388 -120
- package/tools/builtin/web_search.py +81 -7
- package/tools/registry.py +10 -0
- package/tui/app.py +54 -0
- package/tui/app.tcss +7 -0
- package/tui/widgets.py +48 -0
|
@@ -51,7 +51,8 @@ import re
|
|
|
51
51
|
from datetime import date, timedelta
|
|
52
52
|
|
|
53
53
|
import config
|
|
54
|
-
from tools.builtin
|
|
54
|
+
from tools.builtin import _net_common
|
|
55
|
+
from tools.builtin._net_common import NetworkLimitReached, TTLCache
|
|
55
56
|
|
|
56
57
|
logger = logging.getLogger(__name__)
|
|
57
58
|
|
|
@@ -233,9 +234,11 @@ class ScholarLookup:
|
|
|
233
234
|
INJECTABLE, and every test injects: the suite runs offline, and a
|
|
234
235
|
scoring rule tested through a real socket is a scoring rule tested
|
|
235
236
|
on somebody's connection.
|
|
236
|
-
"""
|
|
237
|
-
import httpx
|
|
238
237
|
|
|
238
|
+
`_net_common.get` is `httpx.get`, admitted and counted against the
|
|
239
|
+
tool meter (ROADMAP_v3 §53), which imports httpx lazily for the
|
|
240
|
+
reason this function used to.
|
|
241
|
+
"""
|
|
239
242
|
from safety.policy_enforcement import is_url_permitted
|
|
240
243
|
|
|
241
244
|
url = f"{config.SCHOLAR_API_URL.rstrip('/')}/{path.lstrip('/')}"
|
|
@@ -247,9 +250,9 @@ class ScholarLookup:
|
|
|
247
250
|
# git config or an environment variable is not a rate-limit
|
|
248
251
|
# optimisation, it is an unasked-for disclosure.
|
|
249
252
|
params = {**params, "mailto": config.SCHOLAR_MAILTO}
|
|
250
|
-
response =
|
|
253
|
+
response = _net_common.get(
|
|
251
254
|
url, params=params, timeout=config.SCHOLAR_TIMEOUT_S,
|
|
252
|
-
headers={"User-Agent":
|
|
255
|
+
headers={"User-Agent": _net_common.USER_AGENT},
|
|
253
256
|
follow_redirects=True)
|
|
254
257
|
response.raise_for_status()
|
|
255
258
|
return response.json()
|
|
@@ -267,6 +270,12 @@ class ScholarLookup:
|
|
|
267
270
|
for _ in range(config.SCHOLAR_MAX_RETRIES + 1):
|
|
268
271
|
try:
|
|
269
272
|
payload = self._fetch(path, params)
|
|
273
|
+
except NetworkLimitReached as exc:
|
|
274
|
+
# §53. Refused the same way on every attempt, so not
|
|
275
|
+
# retried; the lookup degrades for this run as an outage
|
|
276
|
+
# does, and the meter has already said why, once.
|
|
277
|
+
last = exc
|
|
278
|
+
break
|
|
270
279
|
except Exception as exc: # noqa: BLE001 - degraded, never fatal
|
|
271
280
|
last = exc
|
|
272
281
|
continue
|
package/docs/SECURITY.md
CHANGED
|
@@ -92,6 +92,12 @@ Note that all of these settings live in `config.yaml` (`shell_approval_mode`, `t
|
|
|
92
92
|
|
|
93
93
|
**What the hosted demo runs is a commit of `main` that passed every CI check, and the deploy holds one token (ROADMAP_v3 §79, HD9, amended in batch 169).** `.github/workflows/deploy-demo.yml` deploys the Hugging Face Space only after `scripts/deploy_gate.py` has read GitHub's record of the commit and found every check run on it success or skipped -- including a job its workflow lets fail and a scheduled run on the same commit -- every workflow a push to `main` runs passed, and the commit still `main`'s tip. The gate's job holds no secret; the deploy job is the only one in the `demo` environment, which holds `HF_TOKEN` (fine-grained, write access to the one Space) and releases it to `main` only. A `workflow_run` job's `github.ref` is always the default branch, so the gate itself refuses anything but a push to `main` in this repository -- a fork's pull request from a branch named `main` included -- and no event value is pasted into a shell line. Before anything is sent, the bundle is scanned by gitleaks from its own root and its locks audited by pip-audit; a finding is accepted only by ID, with its reason, while its version is pinned. The ModelScope Studio is deployed by the owner with the same script and gate, because ModelScope's tokens are account-wide and it offers no trusted CI. **Whoever can merge to `main` decides the code that runs beside every live visitor's sign-in.** And no code scanning alert of security severity high or critical may be open on `main` (batch 170): CodeQL on a push uploads its alerts and fails nothing -- the `CodeQL` check is posted on pull requests only -- so the gate reads the alerts itself, and an alert list it cannot read stops the deploy.
|
|
94
94
|
|
|
95
|
+
**A network limit bounds an allowance, not an attacker (ROADMAP_v3 §53).** With a ceiling set in `config.yaml`, the harness counts what its own network tools, its model-provider calls and its HTTP MCP servers send and receive, and refuses a call that would pass the ceiling. What it CANNOT count is written here rather than left to be discovered (IO5): shell commands -- containers, WSL and SSH open their own sockets, and `--network none` is the control on that path -- `stdio` MCP servers, sign-in and token-refresh traffic, TLS and TCP overhead, and bytes already in a socket buffer when a read stopped early. `web_search`'s figure is a measured estimate, because its client has no hook. A ceiling is not an authority key and not a security boundary. In scope: a route by which model output or repository content raises or bypasses a ceiling the user set, for traffic the meter does count. Out of scope: anything on the list above.
|
|
96
|
+
|
|
97
|
+
**A fetched PDF is parsed in a separate, killable process (ROADMAP_v3 §92, PT5).** PDF parsers have a long history of hostile files that make them loop or exhaust memory, so `fetch_url` never parses one in the agent's process: pypdf runs in the child `tools/isolation.py` starts for the maths tools, under `tool_compute_timeout_s` and, on POSIX, CPU and address-space limits. A PDF over `fetch_max_pdf_mb` is not downloaded. In scope: a PDF or page that makes `fetch_url` hang the agent, read outside its bounds, or hand the model text the redactor never saw.
|
|
98
|
+
|
|
99
|
+
**An installed runtime's files are copies, never links into a package cache (ROADMAP_v3 §93, UV4).** The GitHub installers and the npm launcher build their Python environment under `~/.config/venastine/runtime`, inside the user tier the harness protects from tool writes, and since batch 241 they build it with uv when uv is on PATH. uv's default on Linux and Windows hardlinks every file out of its cache, which would make the harness's imported code the same inode as a file under `~/.cache/uv` -- a directory nothing protects, and one a sandboxed command can write when the workspace contains the home directory. So uv is always told `--link-mode copy` (measured: `st_nlink` 2 under the default, 1 copied; an integration test holds it on both platforms), and a uv that fails hands over to pip, whose installs were always copies.
|
|
100
|
+
|
|
95
101
|
## No bounty
|
|
96
102
|
|
|
97
103
|
This is an independent research project with no funding — **we cannot offer monetary rewards, bounties, or swag.** We will credit you publicly if you want, and we will prioritize a fix. If you need a bounty, please use a third-party program that covers this repo, or treat the report as a voluntary disclosure.
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
# Third-Party Notices
|
|
2
2
|
|
|
3
|
-
This project is licensed under the **Apache License 2.0** — see [LICENSE](
|
|
4
|
-
|
|
5
|
-
The
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
>
|
|
3
|
+
This project is licensed under the **Apache License 2.0** — see [LICENSE](../LICENSE) and [NOTICE](../NOTICE) (Copyright 2026 Yahya Hammad).
|
|
4
|
+
|
|
5
|
+
The tables record the declared core, test, optional, build and hosted dependencies.
|
|
6
|
+
Their project-level licenses are permissive; this is not a license assessment of
|
|
7
|
+
all transitive packages or embedded native libraries. Declarations and the
|
|
8
|
+
license corrections below were checked on 2026-11-07 against the manifests,
|
|
9
|
+
PyPI release metadata and the relevant wheel license files.
|
|
10
|
+
|
|
11
|
+
> **Distribution scope.** Git source archives, the GitHub installers and npm
|
|
12
|
+
> carry first-party source and notices; Python dependencies are fetched separately.
|
|
13
|
+
> The hosted terminal **does deliver third-party JavaScript and CSS** to browsers.
|
|
14
|
+
> Its notices accompany the JavaScript response and are linked from the terminal.
|
|
15
|
+
> A built ModelScope container contains installed dependencies and Debian packages;
|
|
16
|
+
> distributing that image requires a separate review of the exact image layers.
|
|
17
|
+
|
|
18
|
+
> **Transitive dependencies.** These tables are not a full resolved inventory.
|
|
19
|
+
> For example, HTTP clients bring certifi (MPL-2.0), hosted installs bring tqdm
|
|
20
|
+
> (MPL-2.0 AND MIT) and Gradio brings orjson (MPL-2.0 AND (Apache-2.0 OR MIT)).
|
|
21
|
+
> `httpx2` (BSD-3-Clause) and SQLAlchemy (MIT) are imported directly by the
|
|
22
|
+
> harness but supplied transitively by the SDKs/MCP and SQLModel, respectively.
|
|
23
|
+
> Versions selected by ranges can change; use the exact installed artifacts
|
|
24
|
+
> when reviewing a redistributed environment.
|
|
12
25
|
|
|
13
26
|
## Runtime / core dependencies
|
|
14
27
|
|
|
@@ -31,12 +44,18 @@ The dependencies listed below are **not** part of the project's own source but a
|
|
|
31
44
|
| google-re2 | `==1.1.20251105` | BSD-3-Clause | Yes | https://pypi.org/project/google-re2/ |
|
|
32
45
|
| cryptography | `>=50.0.0,<52` | Apache-2.0 OR BSD-3-Clause | Yes | https://pypi.org/project/cryptography/ |
|
|
33
46
|
| PyJWT | `>=2.15.0,<3` | MIT | Yes | https://pypi.org/project/PyJWT/ |
|
|
47
|
+
| defusedxml | `==0.7.1` | PSF-2.0 | Yes | https://pypi.org/project/defusedxml/ |
|
|
48
|
+
| pypdf | `==6.21.4` | BSD-3-Clause | Yes | https://pypi.org/project/pypdf/ |
|
|
34
49
|
|
|
35
|
-
`google-re2`
|
|
36
|
-
|
|
37
|
-
|
|
50
|
+
`google-re2` and `cryptography` ship compiled native code. RE2's wheels
|
|
51
|
+
include the RE2 C++ library (BSD-3-Clause) and Abseil (Apache-2.0).
|
|
52
|
+
Cryptography's wheels include a Rust extension and OpenSSL (Apache-2.0).
|
|
53
|
+
The source installers fetch these wheels onto the user's machine; a distributor
|
|
54
|
+
of an installed environment must inspect their bundled notices separately.
|
|
55
|
+
Declaring cryptography did not introduce it to the install closure: Google
|
|
56
|
+
Auth already required it through Google Gen AI.
|
|
38
57
|
|
|
39
|
-
`pillow` was declared on 2026-10-28 (batch 201), as a floor under what `matplotlib` pulled in, and removed with `matplotlib` in batch 212:
|
|
58
|
+
`pillow` was declared on 2026-10-28 (batch 201), as a floor under what `matplotlib` pulled in, and removed with `matplotlib` in batch 212: the default harness install no longer reaches it; optional document/PDF dependencies can still bring it. The hosted demo's Gradio bridge still installs it, in an environment of its own (`deploy/hosted/requirements.txt`).
|
|
40
59
|
|
|
41
60
|
## Test dependencies (not used by end users during runtime, only for CI and developer testing)
|
|
42
61
|
|
|
@@ -46,24 +65,39 @@ The dependencies listed below are **not** part of the project's own source but a
|
|
|
46
65
|
| pytest-mock | `>=3.14` | MIT | Yes |
|
|
47
66
|
| pytest-asyncio | `>=1.0` | Apache-2.0 | Yes |
|
|
48
67
|
| pytest-xdist | `>=3.6` | MIT | Yes |
|
|
68
|
+
| starlette | `>=0.40` | BSD-3-Clause | Yes |
|
|
49
69
|
| execnet | transitive (via `pytest-xdist`) | MIT | Yes |
|
|
50
70
|
|
|
51
|
-
`execnet` is listed although nothing declares it: it is `pytest-xdist`'s only dependency and the process that actually runs each worker, so a reader auditing what a `pip install -r requirements.txt` puts on the machine would otherwise have to go and find it.
|
|
71
|
+
`execnet` is listed although nothing declares it: it is `pytest-xdist`'s only dependency and the process that actually runs each worker, so a reader auditing what a `pip install -r requirements-test.txt` puts on the machine would otherwise have to go and find it. It belongs to the test environment rather than the default runtime.
|
|
52
72
|
|
|
53
73
|
## Optional dependencies (`pyproject.toml` extras)
|
|
54
74
|
|
|
55
75
|
| Package | Version (as pinned) | Primary License | Apache 2.0 Compatible | Notes |
|
|
56
76
|
|---|---|---|---|---|
|
|
57
77
|
| markitdown | `==0.1.9` (extra `documents`) | MIT | Yes | Permissive; only reachable behind `read`/`write`/`edit` (globally denied). |
|
|
58
|
-
| protobuf | `==7.36.2` (extra `documents`) | BSD-3-Clause
|
|
78
|
+
| protobuf | `==7.36.2` (extra `documents`) | BSD-3-Clause | Yes | Permissive; transitive via `markitdown`→`onnxruntime`. |
|
|
59
79
|
| markdown | unpinned (extra `pdf`) | BSD-3-Clause | Yes | Permissive |
|
|
60
|
-
| weasyprint | unpinned (extra `pdf`) | BSD-3-Clause (package) | Yes (with caveats) | Package itself BSD-3-Clause;
|
|
80
|
+
| weasyprint | unpinned (extra `pdf`) | BSD-3-Clause (package) | Yes (with caveats) | Package itself BSD-3-Clause; Pyphen has alternative GPL/LGPL/MPL code terms and separate dictionary terms; system libraries have their own licenses. |
|
|
81
|
+
|
|
82
|
+
`weasyprint` is BSD-3-Clause itself. Its Python closure includes Pyphen with
|
|
83
|
+
alternative GPL/LGPL/MPL code licenses and separately licensed dictionaries.
|
|
84
|
+
Its native stack includes Pango (LGPL) and HarfBuzz (MIT-style); current
|
|
85
|
+
WeasyPrint uses pydyf for PDF output. Review exact Python and OS artifacts
|
|
86
|
+
before redistributing a PDF-capable environment. Windows MCP installs also
|
|
87
|
+
bring pywin32, whose adodbapi component has LGPL-2.1 terms.
|
|
61
88
|
|
|
62
|
-
|
|
89
|
+
## Build backend
|
|
90
|
+
|
|
91
|
+
| Package | Declaration | Primary License | Source |
|
|
92
|
+
|---|---|---|---|
|
|
93
|
+
| setuptools | `>=77` in `pyproject.toml` | MIT, with separate vendor notices | https://pypi.org/project/setuptools/ |
|
|
63
94
|
|
|
64
95
|
## Hosted demo (`deploy/`, ROADMAP_v3 §79)
|
|
65
96
|
|
|
66
|
-
|
|
97
|
+
The bridge runs separately from the harness's session environment. These
|
|
98
|
+
packages are installed by the hosting platform or generated Docker build;
|
|
99
|
+
`deploy/` is excluded from npm and the metadata-only Python wheel. Installing
|
|
100
|
+
packages on the server and sending their assets to browsers are distinct paths.
|
|
67
101
|
|
|
68
102
|
| Package | Version (as pinned) | Primary License | Apache 2.0 Compatible | Where |
|
|
69
103
|
|---|---|---|---|---|
|
|
@@ -73,38 +107,65 @@ What the bridge -- the process that serves a Space's or Studio's page and relays
|
|
|
73
107
|
| gradio | `==6.30.0` | Apache-2.0 | Yes | installed by the Space at the README's `sdk_version`; in the Studio's `bridge.lock` |
|
|
74
108
|
| spaces | `==0.51.3` | Apache-2.0 | Yes | installed by the Space itself; in the Studio's `bridge.lock` |
|
|
75
109
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
110
|
+
### Browser assets
|
|
111
|
+
|
|
112
|
+
The bridge serves only `js/textual.js`, `css/xterm.css` and `NOTICE.txt` under
|
|
113
|
+
`/venastine-static/`. It does not expose the wheel's unused Roboto Mono fonts
|
|
114
|
+
or background image. The font name tables in Textual Serve 1.1.3 identify
|
|
115
|
+
Apache-2.0; blocking those URLs avoids delivering unneeded font copies.
|
|
116
|
+
The terminal's external Google Fonts stylesheet is a separate delivery by Google.
|
|
117
|
+
|
|
118
|
+
The reviewed wheel SHA-256 is
|
|
119
|
+
`207a472bc6604e725b1adab4ab8bf12f4c4dc25b04eea31e4d04731d8bf30f18`.
|
|
120
|
+
The bridge checks the original JS and CSS hashes before serving them and adds
|
|
121
|
+
[full browser notices](../deploy/hosted/browser-NOTICES.txt) to every JS response.
|
|
122
|
+
The same text is available at `/venastine-static/NOTICE.txt` and linked from the
|
|
123
|
+
terminal. The CSS retains its full MIT notice. Embedded components identified
|
|
124
|
+
in the JS include xterm.js and its addons (MIT), js-base64 3.7.7 (BSD-3-Clause),
|
|
125
|
+
and webpack loader/runtime code (MIT), as well as Textual Serve (MIT).
|
|
126
|
+
Upstream supplies no frontend lockfile, so exact versions of every embedded
|
|
127
|
+
component are not established. A changed asset hash requires a renewed review.
|
|
128
|
+
|
|
129
|
+
### Installed images and native components
|
|
130
|
+
|
|
131
|
+
The ModelScope recipe installs the bridge and session packages into a
|
|
132
|
+
Debian-based Python image. This review did not obtain the deployed image or
|
|
133
|
+
establish its delivery terms. It therefore makes no claim of image compliance
|
|
134
|
+
or violation. Before supplying an image copy, inspect its exact wheels and OS
|
|
135
|
+
packages, preserve bundled LICENSE/NOTICE files, and satisfy applicable source
|
|
136
|
+
availability and license requirements for MPL/LGPL/GPL-covered components.
|
|
137
|
+
Include OpenSSL, Abseil, native libraries bundled in wheels and Debian packages
|
|
138
|
+
in that review. Platform-managed Hugging Face packages, including GPU wheels,
|
|
139
|
+
are not a fixed inventory established by the source manifests alone.
|
|
140
|
+
|
|
141
|
+
## Development and deployment tooling
|
|
142
|
+
|
|
143
|
+
These tools run in CI or the operator's environment; they are not npm runtime
|
|
144
|
+
dependencies. Entries describe the primary project licenses, not every vendored
|
|
145
|
+
component or service agreement.
|
|
146
|
+
|
|
147
|
+
| Package | Declaration / use | Primary License |
|
|
148
|
+
|---|---|---|
|
|
149
|
+
| huggingface_hub | `==2.2.0`, deployment CI | Apache-2.0 |
|
|
150
|
+
| pip-audit | `==2.10.1`, dependency audit | Apache-2.0 |
|
|
151
|
+
| bandit | `==1.9.4`, security scan | Apache-2.0 |
|
|
152
|
+
| ruff | `==0.15.21`, lint | MIT |
|
|
153
|
+
| uv | `==0.13.4`, CI and hosted setup | MIT OR Apache-2.0 |
|
|
154
|
+
| modelscope | optional operator login CLI, unpinned | Apache-2.0 |
|
|
155
|
+
| gitleaks | `8.30.1`, secret scan | MIT |
|
|
156
|
+
|
|
157
|
+
CPython, Node.js/npm, GitHub Actions, CodeQL and optional Docker/Podman and SSH
|
|
158
|
+
helpers have their own project, bundled-component and, for CodeQL, service/tool
|
|
159
|
+
terms. They are execution tools rather than dependencies embedded in the source
|
|
160
|
+
package. Do not infer their complete license inventory from the Python tables.
|
|
84
161
|
|
|
85
162
|
## Non-code third-party material
|
|
86
163
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
(`config.yaml`, `pyproject.toml`, the three requirements files, `package.json`, `pytest.ini`, the
|
|
93
|
-
`.github/` workflows, issue templates and scanner configuration, the dotfiles), the two prompt
|
|
94
|
-
texts, `bin/venastine.mjs` and `scripts/prepublish-check.mjs`, `docs/assets/research-mode-birds-eye.mermaid`,
|
|
95
|
-
`tui/app.tcss`, the two `.example` templates, the hosted demo's four page templates in
|
|
96
|
-
`deploy/hosted/`, one screenshot of this project's own interface, and its cover image with the
|
|
97
|
-
page it is rendered from. **No third-party fonts, images or data files are bundled.** The
|
|
98
|
-
cover's text is set in Cascadia Mono, Microsoft's font under the SIL Open Font License: the PNG
|
|
99
|
-
holds rendered glyphs, and its page names the font, and neither carries a copy of it.
|
|
100
|
-
|
|
101
|
-
*(Counts restated in batch 83. The figure had been 166 against 200, the enumeration named
|
|
102
|
-
five of the thirty-four, and the closing sentence said there were no images at all while the
|
|
103
|
-
screenshot was tracked. The claim itself held throughout; only its arithmetic had drifted.)*
|
|
104
|
-
|
|
105
|
-
*(Restated again in batch 198, when the cover joined: 200 and 34 had become 277 and 43 as the
|
|
106
|
-
project grew. Both sweeps were run again and found nothing new, and every file added since
|
|
107
|
-
batch 83 is first-party.)*
|
|
164
|
+
The repository does not vendor dependency wheels, third-party fonts or browser
|
|
165
|
+
bundles. The hosted bridge reads the browser bundle from its installed wheel
|
|
166
|
+
and adds the reproduced license texts in `deploy/hosted/browser-NOTICES.txt`.
|
|
167
|
+
The cover image contains rendered glyphs from Cascadia Mono (SIL Open Font
|
|
168
|
+
License); it does not carry the font file.
|
|
108
169
|
|
|
109
170
|
What the repository *does* reproduce is third-party **text**:
|
|
110
171
|
|
|
@@ -128,21 +189,33 @@ What the repository *does* reproduce is third-party **text**:
|
|
|
128
189
|
|
|
129
190
|
## What this means
|
|
130
191
|
|
|
131
|
-
*
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
* The
|
|
135
|
-
|
|
192
|
+
* The harness's Apache-2.0 license does not replace the licenses of dependencies,
|
|
193
|
+
browser components, fonts or native libraries. Permissive direct dependencies
|
|
194
|
+
do not imply that the full installed closure contains no copyleft components.
|
|
195
|
+
* The source channels fetch Python packages separately. The npm launcher uses
|
|
196
|
+
Node built-ins and declares no npm dependencies or bundled dependencies.
|
|
197
|
+
Do not add wheels or installed dependency directories to the npm tarball.
|
|
198
|
+
* Hosted JS and CSS are copies delivered to visitors. Their notices must
|
|
199
|
+
accompany those copies; a LICENSE file only in server-side wheel metadata
|
|
200
|
+
does not accompany the browser response.
|
|
201
|
+
* A redistributed installed image needs its own artifact inventory, notices
|
|
202
|
+
and any applicable source availability arrangements. A source-only assessment
|
|
203
|
+
does not establish compliance for that image.
|
|
204
|
+
* The root [NOTICE](../NOTICE) describes these delivery paths. The first-party
|
|
205
|
+
copyright notice is voluntary; recipients must still retain applicable
|
|
206
|
+
third-party notices when redistributing their covered components.
|
|
136
207
|
|
|
137
208
|
## How to regenerate
|
|
138
209
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
210
|
+
Read `requirements.txt`, `requirements-test.txt`, the build backend and extras
|
|
211
|
+
in `pyproject.toml`, `deploy/hosted/requirements.txt`, and generated platform
|
|
212
|
+
inputs in `scripts/build_demo_bundle.py`. Inspect the exact resolved wheels
|
|
213
|
+
and their license files, including vendor notices; metadata alone can omit them.
|
|
214
|
+
`pip-licenses --format markdown --with-urls --with-license-file` can help list
|
|
215
|
+
an installed environment, but does not inventory browser bundles or OS layers.
|
|
144
216
|
|
|
145
|
-
When a
|
|
217
|
+
When a declaration changes, update its table row and review the actual delivery
|
|
218
|
+
path. For a Textual Serve repin, inspect the bundle components and fonts, update
|
|
219
|
+
browser notices and the reviewed asset hashes, and verify the served responses.
|
|
146
220
|
|
|
147
|
-
|
|
148
|
-
*Last updated: 2026-08-27. If any row's upstream re-licenses, this file must be updated.*
|
|
221
|
+
*Last checked: 2026-11-07.*
|
package/mcp_client/client.py
CHANGED
|
@@ -57,6 +57,7 @@ from mcp.shared.exceptions import MCPError
|
|
|
57
57
|
|
|
58
58
|
import config as _harness_config
|
|
59
59
|
from safety.policy_enforcement import TOKEN_CHARS, fragment_end
|
|
60
|
+
from tools.builtin import _net_common
|
|
60
61
|
|
|
61
62
|
logger = logging.getLogger(__name__)
|
|
62
63
|
|
|
@@ -143,6 +144,20 @@ _thread: Optional[threading.Thread] = None
|
|
|
143
144
|
_loop_lock = threading.Lock()
|
|
144
145
|
|
|
145
146
|
|
|
147
|
+
def _metered_mcp_client(headers=None, timeout=None, auth=None):
|
|
148
|
+
"""The SDK's own MCP client, with the MCP meter's hooks on it (§53).
|
|
149
|
+
|
|
150
|
+
`sse_client`'s `httpx_client_factory` signature, so the one function
|
|
151
|
+
serves both HTTP transports. The SDK builds the client -- its timeouts,
|
|
152
|
+
its redirect rule -- and `event_hooks` is public on an httpx2 client,
|
|
153
|
+
so nothing here re-states what the SDK already decides.
|
|
154
|
+
"""
|
|
155
|
+
client = create_mcp_http_client(headers=headers, timeout=timeout,
|
|
156
|
+
auth=auth)
|
|
157
|
+
client.event_hooks = _net_common.mcp_event_hooks()
|
|
158
|
+
return client
|
|
159
|
+
|
|
160
|
+
|
|
146
161
|
def _ensure_loop() -> asyncio.AbstractEventLoop:
|
|
147
162
|
"""The one MCP event loop, created on first use."""
|
|
148
163
|
global _loop, _thread
|
|
@@ -425,6 +440,16 @@ class MCPClient:
|
|
|
425
440
|
# create_mcp_http_client defaults -- so an Authorization
|
|
426
441
|
# header authenticates here too, never discarded (M19's
|
|
427
442
|
# property holds on both HTTP transports).
|
|
443
|
+
#
|
|
444
|
+
# ROADMAP_v3 §53: with the MCP meter on, the SDK's own factory
|
|
445
|
+
# builds the client and the meter's hooks go on it, so its
|
|
446
|
+
# timeouts are the SDK's and only the counting is ours.
|
|
447
|
+
if _net_common.MCP.enabled():
|
|
448
|
+
return sse_client(
|
|
449
|
+
cfg.url,
|
|
450
|
+
headers=dict(cfg.headers) or None,
|
|
451
|
+
httpx_client_factory=_metered_mcp_client,
|
|
452
|
+
)
|
|
428
453
|
return sse_client(
|
|
429
454
|
cfg.url,
|
|
430
455
|
headers=dict(cfg.headers) or None,
|
|
@@ -449,10 +474,20 @@ class MCPClient:
|
|
|
449
474
|
# whole (CONFIG_ARCHITECTURE.md has the measurement). The legacy
|
|
450
475
|
# "sse" branch above keeps the SDK's fixed 1 MiB: `sse_client`
|
|
451
476
|
# takes no size.
|
|
477
|
+
#
|
|
478
|
+
# ROADMAP_v3 §53: with the MCP meter on there is ALWAYS a client
|
|
479
|
+
# of ours, headers or not, because the hooks have to be on it.
|
|
480
|
+
# Built by the SDK's helper either way, so its timeouts hold.
|
|
481
|
+
if _net_common.MCP.enabled():
|
|
482
|
+
http_client = _metered_mcp_client(
|
|
483
|
+
headers=dict(cfg.headers) or None)
|
|
484
|
+
elif cfg.headers:
|
|
485
|
+
http_client = create_mcp_http_client(headers=dict(cfg.headers))
|
|
486
|
+
else:
|
|
487
|
+
http_client = None
|
|
452
488
|
return streamable_http_client(
|
|
453
489
|
cfg.url,
|
|
454
|
-
http_client=
|
|
455
|
-
if cfg.headers else None),
|
|
490
|
+
http_client=http_client,
|
|
456
491
|
max_sse_event_size=_harness_config.MCP_MAX_EVENT_BYTES,
|
|
457
492
|
)
|
|
458
493
|
raise ValueError(cfg.error or "unusable server configuration")
|
|
@@ -617,6 +652,18 @@ class MCPClient:
|
|
|
617
652
|
reason = self.failures.get(server_name, "not connected")
|
|
618
653
|
return {"error": f"MCP server {server_name!r} is unavailable: {reason}"}
|
|
619
654
|
|
|
655
|
+
# ROADMAP_v3 §53 (IO11). Admitted HERE, before anything is sent, and
|
|
656
|
+
# never in the HTTP hooks: a refusal raised inside the SDK would
|
|
657
|
+
# surface in its background writer and read as a timeout. Only the
|
|
658
|
+
# servers the meter can see are asked -- a "stdio" server's traffic
|
|
659
|
+
# is its own process's, and IO5 says so rather than pretending.
|
|
660
|
+
cfg = self.server_configs.get(server_name)
|
|
661
|
+
if getattr(cfg, "transport", None) in ("http", "sse"):
|
|
662
|
+
try:
|
|
663
|
+
_net_common.MCP.admit(_net_common.mcp_call_bytes(params))
|
|
664
|
+
except _net_common.NetworkLimitReached as e:
|
|
665
|
+
return {"error": e.reason}
|
|
666
|
+
|
|
620
667
|
loop = _ensure_loop()
|
|
621
668
|
protocol_timeout = max(1.0, timeout - _TIMEOUT_MARGIN_S)
|
|
622
669
|
coro = client.call_tool(tool_name, params,
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
@@ -18,7 +18,7 @@ build-backend = "setuptools.build_meta"
|
|
|
18
18
|
|
|
19
19
|
[project]
|
|
20
20
|
name = "venastine-research-harness"
|
|
21
|
-
version = "0.3.
|
|
21
|
+
version = "0.3.11"
|
|
22
22
|
description = "A from-scratch agentic harness: tool-using chat plus a ten-pass self-critiquing research pipeline."
|
|
23
23
|
readme = "README.md"
|
|
24
24
|
requires-python = ">=3.11"
|
package/requirements.txt
CHANGED
|
@@ -288,6 +288,25 @@ PyJWT>=2.15.0,<3
|
|
|
288
288
|
# parser's refusals are exactly what a silent minor bump could change.
|
|
289
289
|
defusedxml==0.7.1
|
|
290
290
|
|
|
291
|
+
# Batch 240, the owner's choice: fetch_url reads PDFs, and pypdf is what it
|
|
292
|
+
# reads them with (tools/builtin/_pdf_text.py, in tools/isolation's killable
|
|
293
|
+
# child). MEASURED against markitdown[pdf] on three arXiv papers: pypdf kept
|
|
294
|
+
# every probe sentence whole on a one-column and a two-column paper and ran
|
|
295
|
+
# 0.8% of words together on the 77-page Llama 2 report; markitdown ran words
|
|
296
|
+
# together on all three (22% on Llama 2) and turned BERT's two columns into a
|
|
297
|
+
# table of fragments. pypdf is pure Python with no dependencies on 3.11+
|
|
298
|
+
# (4.1 MB); markitdown[pdf] is 188 MB.
|
|
299
|
+
#
|
|
300
|
+
# 6.21.4, NOT the two-weeks-old 6.21.2, the owner's choice: pip-audit found
|
|
301
|
+
# seven advisories in 6.21.2 -- crafted PDFs that loop forever or exhaust
|
|
302
|
+
# memory (CVE-2026-119203 to -119209), which is precisely what a tool reading
|
|
303
|
+
# strangers' PDFs parses -- all fixed by 6.21.4 (2026-10-28), which audits
|
|
304
|
+
# clean and extracted the three papers identically. The rule gives way to a
|
|
305
|
+
# security fix, as it did for mcp 2.2.0 in batch 165. Exact, for defusedxml's
|
|
306
|
+
# reason: a parser of hostile input is where a silent bump changes what is
|
|
307
|
+
# refused.
|
|
308
|
+
pypdf==6.21.4
|
|
309
|
+
|
|
291
310
|
# Test dependencies live in requirements-test.txt, NOT here (S18-07,
|
|
292
311
|
# batch 136). pyproject.toml reads THIS file for `[project].dependencies`
|
|
293
312
|
# via `dynamic`, so anything below this line is a hard requirement of the
|