@hunt-labs/bytekit-mcp 0.2.8 → 0.3.1
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/CHANGELOG.md +46 -0
- package/dist/docs-bundle/body-bound.d.ts +76 -0
- package/dist/docs-bundle/body-bound.js +102 -0
- package/dist/docs-bundle/docs-bundle.json +50 -25
- package/dist/tools/get-doc.js +12 -2
- package/dist/tools/search-docs.js +42 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,52 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.3.1] - 2026-08-25
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **The bundled docs now carry a landing page for every documentation section** (#3473).
|
|
18
|
+
`/docs/billing`, `/docs/guides`, `/docs/libraries` and `/docs/sdk` had no page of their own
|
|
19
|
+
and returned 404, so `list_docs` never offered them and `get_doc` could not fetch them. Each
|
|
20
|
+
is now an overview page linking that section's own pages, and the bundle grows from 103 to
|
|
21
|
+
107 entries. No tool, argument, or response shape changes.
|
|
22
|
+
|
|
23
|
+
- Refreshed the bundled documentation snapshot (#3459). The bundled `changelog` page is the docs
|
|
24
|
+
site's changelog, which concatenates four package changelogs in order — `@hunt-labs/bytekit-sdk`,
|
|
25
|
+
the Python `bytekit-sdk`, the CLI, then this package — and every bundled page is bound to 16,384
|
|
26
|
+
bytes (#3233), so that page carries the newest TypeScript SDK entries down to the cut and nothing
|
|
27
|
+
after it. What the refresh actually brings offline is that section's 0.9.1 entry, with the
|
|
28
|
+
corrected `topup_balance_bytes` description: the value is the remaining purchased top-up bytes,
|
|
29
|
+
already net of any overage consumed against them. The Python SDK, CLI and MCP sections are **not
|
|
30
|
+
in the bundle at all** — the Python section alone begins roughly 43 KB into the page, far past
|
|
31
|
+
the bound — so their release notes are not reachable through `get_doc` or `search_docs`, and
|
|
32
|
+
full-text search never sees them. Read the whole changelog at
|
|
33
|
+
https://bytekit.com/docs/changelog. Bundled content only: no tool, schema or transport change.
|
|
34
|
+
|
|
35
|
+
## [0.3.0] - 2026-08-20
|
|
36
|
+
|
|
37
|
+
### Removed
|
|
38
|
+
|
|
39
|
+
- **BREAKING: the bundled docs no longer describe `cookies` or `headers` as capture request
|
|
40
|
+
fields** (#3242). Those fields were removed from `/v1/scrape`, `/v1/scrape/bulk`,
|
|
41
|
+
`/v1/screenshots`, `/v1/recordings` and `/v1/schema`; a request carrying either is rejected
|
|
42
|
+
with `400 validation_error`. Tools that composed request bodies from the bundle will no longer
|
|
43
|
+
see the fields offered.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- **`get_doc` now returns a bounded body, and says when it cut one** (#3233). A page above
|
|
48
|
+
16,384 bytes comes back cut short, ending in a notice that names the limit, the page's full
|
|
49
|
+
size, and the docs URL that serves all of it — a caller can never mistake a partial page for a
|
|
50
|
+
complete one. Every page under the limit is returned byte for byte, in the same
|
|
51
|
+
`{ title, section, body }` envelope as before, so nothing else about the tool changes. The cap
|
|
52
|
+
is advertised in the tool's own description.
|
|
53
|
+
- **The bundled offline docs no longer ship an unbounded page** (#3233). The harvest step applies
|
|
54
|
+
the same 16,384-byte per-page bound. The generated `changelog` page was 46.5% of the whole
|
|
55
|
+
bundle on its own; it is still a bundled page, so `list_docs` lists it and `search_docs` ranks
|
|
56
|
+
it, but full-text search now reaches only the releases above the cut. The docs site keeps the
|
|
57
|
+
whole changelog.
|
|
58
|
+
|
|
13
59
|
## [0.2.8] - 2026-08-19
|
|
14
60
|
|
|
15
61
|
### Changed
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-page byte bound on a bundled documentation body (issue #3233).
|
|
3
|
+
*
|
|
4
|
+
* WHY A BOUND EXISTS
|
|
5
|
+
* ------------------
|
|
6
|
+
* Every page in the bundle is a *retrieval unit*: `get_doc` returns one whole body into a
|
|
7
|
+
* caller's context, and the bundle itself ships inside the published `@hunt-labs/bytekit-mcp`
|
|
8
|
+
* tarball and the gateway Docker image. Both costs are per-entry, so both are bounded per-entry.
|
|
9
|
+
* At 96d5f3873 the generated `changelog` page was 135,687 bytes — 46.5% of the whole bundle and
|
|
10
|
+
* 14× the largest other page — and `get_doc("changelog")` handed all of it back uncapped.
|
|
11
|
+
*
|
|
12
|
+
* WHY 16 KiB, AND WHY PER-ENTRY
|
|
13
|
+
* -----------------------------
|
|
14
|
+
* Measured over the committed bundle at 96d5f3873 (103 entries): median body 744 bytes, p95
|
|
15
|
+
* 5,027, largest legitimate page 9,607 (`guides/monitors`), then a 14× jump straight to the
|
|
16
|
+
* changelog's 135,687. The threshold sits inside that gap:
|
|
17
|
+
*
|
|
18
|
+
* - 16,384 bytes is 1.7× the largest legitimate page, so every page written today passes with
|
|
19
|
+
* room to keep growing, and a page has to nearly double before it is flagged;
|
|
20
|
+
* - it is 8.3× below the changelog, so the entry this bound exists for is flagged decisively;
|
|
21
|
+
* - it is roughly 4k tokens — a page an agent can read inside a normal context budget, which
|
|
22
|
+
* is the property the ticket's Expected section asks for.
|
|
23
|
+
*
|
|
24
|
+
* The unit is PER-ENTRY, not whole-bundle, deliberately: a whole-bundle cap makes an innocent
|
|
25
|
+
* page start failing the moment unrelated pages are added, which punishes the wrong author and
|
|
26
|
+
* says nothing about whether any single retrieval is usable. A per-entry cap is a statement
|
|
27
|
+
* about the one thing a caller receives.
|
|
28
|
+
*
|
|
29
|
+
* WHERE IT IS APPLIED
|
|
30
|
+
* -------------------
|
|
31
|
+
* Twice, from this one definition:
|
|
32
|
+
* - `scripts/build-docs-bundle.ts`, at the harvest step, so the committed artifact never holds
|
|
33
|
+
* an oversized entry (that is the 46%-of-the-bundle half of the defect);
|
|
34
|
+
* - `src/tools/get-doc.ts`, at the read, so the tool's contract holds for whatever bundle is
|
|
35
|
+
* on disk rather than only for one this repo generated (that is the uncapped-read half).
|
|
36
|
+
* Applying it at the read is idempotent over an already-harvest-bounded body: the second call
|
|
37
|
+
* sees a body under the limit and returns it untouched.
|
|
38
|
+
*
|
|
39
|
+
* The cut is never silent — see {@link truncationNotice}.
|
|
40
|
+
*/
|
|
41
|
+
export declare const MAX_DOC_BODY_BYTES: number;
|
|
42
|
+
/** Public docs origin, the same one `llms.txt` publishes page URLs under. */
|
|
43
|
+
export declare const DOCS_BASE_URL = "https://bytekit.com/docs";
|
|
44
|
+
/**
|
|
45
|
+
* The notice appended in place of the content that was cut.
|
|
46
|
+
*
|
|
47
|
+
* It carries four things a caller needs and cannot otherwise recover: that the body is
|
|
48
|
+
* incomplete, how large the page is in full, that the cut text is outside `search_docs` as well
|
|
49
|
+
* as outside this response, and where to read the whole of it. A truncation with no marker would
|
|
50
|
+
* reproduce this bug's own failure mode — an agent reasoning confidently over a partial page —
|
|
51
|
+
* in a new place.
|
|
52
|
+
*
|
|
53
|
+
* WHY THE SEARCH SENTENCE IS HERE (issue #3307)
|
|
54
|
+
* ---------------------------------------------
|
|
55
|
+
* `search_docs` matches over the same harvested bodies this bound cuts, so the bound narrowed
|
|
56
|
+
* SEARCH as well as retrieval — on the `changelog` page 88.3% of the text stopped being
|
|
57
|
+
* matchable at all. #3307 weighed restoring that coverage against stating plainly what is
|
|
58
|
+
* missing, and took the second: the bound is #3233's precedence rule and is not reopened here,
|
|
59
|
+
* and indexing more than `get_doc` will return would let a search hit land in bytes the reader
|
|
60
|
+
* is then refused. So the honest defect — a caller could not tell what they were NOT seeing —
|
|
61
|
+
* is answered where the caller is already looking, in the bytes they were handed.
|
|
62
|
+
*
|
|
63
|
+
* Its length depends only on `originalBytes` and `urlPath`, both known before the cut, so the
|
|
64
|
+
* budget left for content is computable in one pass.
|
|
65
|
+
*/
|
|
66
|
+
export declare function truncationNotice(originalBytes: number, urlPath: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Bounds one documentation body at {@link MAX_DOC_BODY_BYTES}, announcing the cut in the bytes
|
|
69
|
+
* it returns. A body already under the limit is returned unchanged, byte for byte.
|
|
70
|
+
*
|
|
71
|
+
* `urlPath` is the bundle key (e.g. `guides/monitors`), used to point at the full page.
|
|
72
|
+
*/
|
|
73
|
+
export declare function boundDocBody(body: string, urlPath: string): {
|
|
74
|
+
body: string;
|
|
75
|
+
truncated: boolean;
|
|
76
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-page byte bound on a bundled documentation body (issue #3233).
|
|
3
|
+
*
|
|
4
|
+
* WHY A BOUND EXISTS
|
|
5
|
+
* ------------------
|
|
6
|
+
* Every page in the bundle is a *retrieval unit*: `get_doc` returns one whole body into a
|
|
7
|
+
* caller's context, and the bundle itself ships inside the published `@hunt-labs/bytekit-mcp`
|
|
8
|
+
* tarball and the gateway Docker image. Both costs are per-entry, so both are bounded per-entry.
|
|
9
|
+
* At 96d5f3873 the generated `changelog` page was 135,687 bytes — 46.5% of the whole bundle and
|
|
10
|
+
* 14× the largest other page — and `get_doc("changelog")` handed all of it back uncapped.
|
|
11
|
+
*
|
|
12
|
+
* WHY 16 KiB, AND WHY PER-ENTRY
|
|
13
|
+
* -----------------------------
|
|
14
|
+
* Measured over the committed bundle at 96d5f3873 (103 entries): median body 744 bytes, p95
|
|
15
|
+
* 5,027, largest legitimate page 9,607 (`guides/monitors`), then a 14× jump straight to the
|
|
16
|
+
* changelog's 135,687. The threshold sits inside that gap:
|
|
17
|
+
*
|
|
18
|
+
* - 16,384 bytes is 1.7× the largest legitimate page, so every page written today passes with
|
|
19
|
+
* room to keep growing, and a page has to nearly double before it is flagged;
|
|
20
|
+
* - it is 8.3× below the changelog, so the entry this bound exists for is flagged decisively;
|
|
21
|
+
* - it is roughly 4k tokens — a page an agent can read inside a normal context budget, which
|
|
22
|
+
* is the property the ticket's Expected section asks for.
|
|
23
|
+
*
|
|
24
|
+
* The unit is PER-ENTRY, not whole-bundle, deliberately: a whole-bundle cap makes an innocent
|
|
25
|
+
* page start failing the moment unrelated pages are added, which punishes the wrong author and
|
|
26
|
+
* says nothing about whether any single retrieval is usable. A per-entry cap is a statement
|
|
27
|
+
* about the one thing a caller receives.
|
|
28
|
+
*
|
|
29
|
+
* WHERE IT IS APPLIED
|
|
30
|
+
* -------------------
|
|
31
|
+
* Twice, from this one definition:
|
|
32
|
+
* - `scripts/build-docs-bundle.ts`, at the harvest step, so the committed artifact never holds
|
|
33
|
+
* an oversized entry (that is the 46%-of-the-bundle half of the defect);
|
|
34
|
+
* - `src/tools/get-doc.ts`, at the read, so the tool's contract holds for whatever bundle is
|
|
35
|
+
* on disk rather than only for one this repo generated (that is the uncapped-read half).
|
|
36
|
+
* Applying it at the read is idempotent over an already-harvest-bounded body: the second call
|
|
37
|
+
* sees a body under the limit and returns it untouched.
|
|
38
|
+
*
|
|
39
|
+
* The cut is never silent — see {@link truncationNotice}.
|
|
40
|
+
*/
|
|
41
|
+
export const MAX_DOC_BODY_BYTES = 16 * 1024;
|
|
42
|
+
/** Public docs origin, the same one `llms.txt` publishes page URLs under. */
|
|
43
|
+
export const DOCS_BASE_URL = 'https://bytekit.com/docs';
|
|
44
|
+
/**
|
|
45
|
+
* The notice appended in place of the content that was cut.
|
|
46
|
+
*
|
|
47
|
+
* It carries four things a caller needs and cannot otherwise recover: that the body is
|
|
48
|
+
* incomplete, how large the page is in full, that the cut text is outside `search_docs` as well
|
|
49
|
+
* as outside this response, and where to read the whole of it. A truncation with no marker would
|
|
50
|
+
* reproduce this bug's own failure mode — an agent reasoning confidently over a partial page —
|
|
51
|
+
* in a new place.
|
|
52
|
+
*
|
|
53
|
+
* WHY THE SEARCH SENTENCE IS HERE (issue #3307)
|
|
54
|
+
* ---------------------------------------------
|
|
55
|
+
* `search_docs` matches over the same harvested bodies this bound cuts, so the bound narrowed
|
|
56
|
+
* SEARCH as well as retrieval — on the `changelog` page 88.3% of the text stopped being
|
|
57
|
+
* matchable at all. #3307 weighed restoring that coverage against stating plainly what is
|
|
58
|
+
* missing, and took the second: the bound is #3233's precedence rule and is not reopened here,
|
|
59
|
+
* and indexing more than `get_doc` will return would let a search hit land in bytes the reader
|
|
60
|
+
* is then refused. So the honest defect — a caller could not tell what they were NOT seeing —
|
|
61
|
+
* is answered where the caller is already looking, in the bytes they were handed.
|
|
62
|
+
*
|
|
63
|
+
* Its length depends only on `originalBytes` and `urlPath`, both known before the cut, so the
|
|
64
|
+
* budget left for content is computable in one pass.
|
|
65
|
+
*/
|
|
66
|
+
export function truncationNotice(originalBytes, urlPath) {
|
|
67
|
+
return (`\n\n---\n[Truncated to the ${MAX_DOC_BODY_BYTES}-byte per-page limit — ` +
|
|
68
|
+
`this page is ${originalBytes} bytes in full. ` +
|
|
69
|
+
`The text cut here is not searchable either: search_docs matches only the part kept above. ` +
|
|
70
|
+
`Read all of it at ${DOCS_BASE_URL}/${urlPath}]`);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Slices `text` to at most `maxBytes` UTF-8 bytes, dropping any incomplete trailing multi-byte
|
|
74
|
+
* sequence so the result is always valid UTF-8.
|
|
75
|
+
*
|
|
76
|
+
* Deliberately local rather than lifted out of `src/lib/truncate.ts`: that module's slicer is
|
|
77
|
+
* private to a truncator with reserve-block and dangling-delimiter semantics that mean nothing
|
|
78
|
+
* for a docs page, and exporting it would widen this change into a module with invariants of its
|
|
79
|
+
* own. Six lines of duplication is the cheaper trade.
|
|
80
|
+
*/
|
|
81
|
+
function sliceToBytes(text, maxBytes) {
|
|
82
|
+
if (maxBytes <= 0)
|
|
83
|
+
return '';
|
|
84
|
+
let out = Buffer.from(text, 'utf8').subarray(0, maxBytes).toString('utf8');
|
|
85
|
+
while (out.endsWith('�'))
|
|
86
|
+
out = out.slice(0, -1);
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Bounds one documentation body at {@link MAX_DOC_BODY_BYTES}, announcing the cut in the bytes
|
|
91
|
+
* it returns. A body already under the limit is returned unchanged, byte for byte.
|
|
92
|
+
*
|
|
93
|
+
* `urlPath` is the bundle key (e.g. `guides/monitors`), used to point at the full page.
|
|
94
|
+
*/
|
|
95
|
+
export function boundDocBody(body, urlPath) {
|
|
96
|
+
const originalBytes = Buffer.byteLength(body, 'utf8');
|
|
97
|
+
if (originalBytes <= MAX_DOC_BODY_BYTES)
|
|
98
|
+
return { body, truncated: false };
|
|
99
|
+
const notice = truncationNotice(originalBytes, urlPath);
|
|
100
|
+
const kept = sliceToBytes(body, MAX_DOC_BODY_BYTES - Buffer.byteLength(notice, 'utf8'));
|
|
101
|
+
return { body: kept + notice, truncated: true };
|
|
102
|
+
}
|