Skip to content

feat(agent-tools): the built-in agent tools - the Node twin of the Python extension (RFC-0013 step 3) - #130

Merged
acn-ericlaw merged 4 commits into
mainfrom
feat/agent-tools
Nov 17, 2026
Merged

acn-ericlaw merged 4 commits into
mainfrom
feat/agent-tools

Conversation

@acn-ericlaw

Copy link
Copy Markdown
Contributor

What

extensions/agent-tools/agent-tools.mjs, the Node.js twin of mercury-python's extensions/agent-tools (RFC-0013 build plan step 3): the twelve composable functions an agent loop names in its tool catalog, with the same routes, rows, limits, statuses and messages as the Python pack.

  • Files inside one workspace (tools.file.root): file.read, file.write (write: true), file.list, file.search, and file.extract (PDF through pdfjs-dist, Word through mammoth, HTML and text, with page markers) when the two libraries are installed. Every path is relative to the root, resolved with symbolic links followed and refused outside it; hidden entries are invisible unless tools.file.hidden=true.
  • The web inside an allowlist (tools.web.allow): web.fetch and web.crawl over node:http/node:https with a pinned lookup (the request goes to the checked address, the TLS server name from the URL), every redirect re-checked, the body cut at tools.web.max.bytes, an in-house HTML tokenizer and reader (text or Markdown), an in-house robots.txt parser, a bounded same-host crawl.
  • The knowledge graph inside one database (tools.graph.uri, neo4j-driver): graph.schema (Neo4j's or Memgraph's procedures with counts), graph.query (read transaction, write clauses refused before sending, rows capped), graph.write (counters, the delete gate) and graph.ingest (a model's extraction merged idempotently, every value a parameter, the endpoints checked inside the transaction); managed transactions with the configured timeout server-side; the driver's failures mapped by code.
  • time.now on Intl.

The catalog files under extensions/agent-tools/catalog/ are byte for byte the Python pack's (one shared digest), the rows in the module are generated from them, and a test pins the two. describe prints every row and what registers; tools.health reports the routes, the workspace, the allowed sites and the graph's address. resources/application.yml (port 8090), dev/graph-up.sh / graph-down.sh, README, CHANGELOG, the root README's extension bullets; neo4j-driver, mammoth and pdfjs-dist as dev dependencies (pdf-parse v2 pulls a native canvas binding, so pdfjs-dist is used directly for text).

Why

RFC-0013 (Eric's rulings R1-R16, 2026-11-17) builds the essential tools in both packs in lockstep, so a graph's catalog row works whichever pack serves the route and the engines' documentation describes one contract. The Python build set the defaults (the spec's sections 13 and 14); this twin follows them. Three visible differences, recorded in the pack's memory: the HTML reader decodes the common named character references and every numeric one, a Word table renders through mammoth's HTML, and integers come back as JavaScript numbers.

Verification

  • npm test: 554 tests, 488 passed, 66 skipped (the gated live tests), 0 failed. test/agent-tools.test.mjs: 55 tests mirroring the Python suite, plus the live graph round trip against Neo4j 5 on Colima (ingest twice leaves one node; node, relationship and path rendering; the schema with counts; a syntax error by code; a missing endpoint refused; the delete gate): PASSED.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

acn-ericlaw and others added 4 commits November 17, 2026 19:10
…thon extension (RFC-0013 step 3)

extensions/agent-tools/agent-tools.mjs serves the twelve composable functions an agent loop names in its
tool catalog, in lockstep with mercury-python #63 and #64: the file tools inside tools.file.root (with
file.extract through pdfjs-dist and mammoth), the web tools inside tools.web.allow over node:http with a
pinned lookup, every redirect re-checked and an in-house HTML reader and robots.txt parser, the
knowledge-graph tools over neo4j-driver in managed transactions with the clause scan, the idempotent
ingest and the endpoint check, and time.now. A tool whose sandbox is not configured does not register;
every refusal is a 400 naming the rule. The catalog files are byte for byte the Python pack's, pinned by
a test; describe prints the rows and what registers. 55 tests mirroring the Python suite and a live
round trip on Neo4j.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
CI ran the Node 20 floor, where node:fs/promises has no glob (Node 22+). The directory walk of
file.list and file.search is in-house now: a pattern read as the Python pack's Path.glob reads it,
a bounded walk that never descends into a symbolic link. On Eric's ruling the CI tooling runs
Node 26, the current line; the published package's floor stays node >= 20.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… the current LTS, Node 26

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@acn-ericlaw
acn-ericlaw merged commit b8aad9f into main Nov 17, 2026
5 checks passed
@acn-ericlaw
acn-ericlaw deleted the feat/agent-tools branch November 17, 2026 11:19
acn-ericlaw added a commit that referenced this pull request Nov 17, 2026
…ilt-in agent tools is on main

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant