Files
plugins/packages/agy-cli/test
yetone 6646797e15 agy-cli 0.1.46: a catalog over agy's tool budget keeps every tool (#1140)
Since #989 every client tool is listed always-loaded, so all of them go
into agy's customization budget: 20,000 tokens counted as
ceil(UTF-8 bytes / 3). Past it, agy drops whole tools, the largest first,
and with tools: [] the model has no other way to reach them. tungloong's
131-tool catalog (~25,000 tokens) lost bash and 12 Paper tools.

Proc.listTools() now hands agy the catalog through fitTools
(tool-budget.mjs), aiming at 18,000 tokens to leave agy room for its name
prefix and serialization:
- within the budget, the catalog goes as it is (the same array);
- else $schema, title and examples come out where they are keywords (a
  property named "title" is the client's and stays);
- else every description is capped at the highest level L that fits,
  found by binary search: a property's at L bytes, a tool's own at 2.5L,
  a contract property's (an object with no properties, or tool-schema's
  Variants/Accepts anyOf text) at 11L. A cut drops a trailing Examples
  block first, ends on a sentence or a whole code point, and adds "…";
- at L = 0 the properties' descriptions go and the room left goes to the
  tools' own.
Names, property names, types, enum, const, required, items, anyOf and
bounds are never touched, and this.tools / toolsSignature stay as the
client sent them. The trimmed list is kept per catalog.

Run (WSL magpie-desktop, temp HOME; mote was at load 178 and mica's disk
is full): bun test 21 pass; node --test conversation-key, step-usage,
usage-settlement, repeat-batch, compat, tool-schema, catalog,
tool-budget, steer-in-session, windows-nc: 198 pass, 0 fail;
bun scripts/check.mjs agy-cli ok; npm pack --dry-run ships
tool-budget.mjs. With main's index.mjs the new bridge test fails (31,690
tokens reach agy). Not tried with a real agy: the budget and its
counting are the reporter's reading of agy 1.5.8, not checked here.
2026-11-14 18:34:29 +08:00
..