Skip to content

feat(tool): add MarkkitTool LLM agent tool (Everruns toolkit contract) - #19

Merged
chaliy merged 4 commits into
mainfrom
claude/project-thread-mwewa8
Oct 26, 2026
Merged

chaliy merged 4 commits into
mainfrom
claude/project-thread-mwewa8

Conversation

@chaliy

@chaliy chaliy commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Михайло · project thread

What changed

New opt-in tool feature exposes markkit::tool::MarkkitTool, an LLM agent tool with the same shape as bashkit's tool module (Everruns toolkit-library contract):

MarkkitToolBuilder → MarkkitTool (metadata, schemas) → single-use ToolExecution → ToolOutput.

  • Builder: locale (en-US/uk-UA), config(MarkkitBuilder), allow_url, max_output_chars (default 100 000); build_tool_definition() (OpenAI JSON), build_service() (tower::Service), build_input_schema()/build_output_schema().
  • One call = one document: exactly one of url, html, content_base64 (+ file_name/content_type hints), optional max_chars.
  • Result: {markdown, title, format, warnings, truncated}; metadata carries stats and length.
  • Errors: extraction/validation failures are UserFacing (safe for the model, localized prefix); I/O is Internal.
  • Also adds Markkit::extract_url_document (URL extraction with format/title/warnings/stats); extract_url now delegates to it.
  • New knowledge concept integrations/tool-contract.md; tool args added to the threat-model attack surface; example examples/agent_tool.rs runs in CI and just examples.

Feature is off by default (unlike bashkit) so plain library users don't pull tower.

Why

Roadmap initiative 8: agent tool (MCP server optional, later). Follow-ups: WASM package, Node options parity.

Before / After

Before: no tool layer; hosts hand-write schemas and wrappers.

After (cargo run -p markkit --features tool --example agent_tool):

markkit: converts web pages and documents to Markdown. Pass one of url, html, content_base64. Use max_chars to limit output.

{
  "format": "html",
  "markdown": "# Release notes\n\n- Agent tool\n- WASM\n",
  "title": null,
  "truncated": false,
  "warnings": []
}

Risk

  • Low: additive, behind a non-default feature. extract_url refactor keeps the same hint (response content type).
  • Security: tool args are untrusted. Validated before execution; base64 length bounded before decode; url goes through the existing SSRF guard (tested via the tool) and can be disabled; output capped.

Checklist

  • Tests added or updated (20 unit tests in tool::tests: metadata/locale, schema gating, sources, truncation, validation negatives, SSRF, error mapping, stream, service)
  • Backward compatibility considered

Opt-in `tool` feature adds markkit::tool: MarkkitToolBuilder -> MarkkitTool
-> single-use ToolExecution, mirroring bashkit's tool module. One call
converts a url, html or base64 document to Markdown; args validated before
execution, base64 bounded before decode, URL via the SSRF guard, output
capped by max_output_chars. Adds Markkit::extract_url_document.
@chaliy chaliy self-assigned this Oct 26, 2026
@chaliy chaliy mentioned this pull request Oct 26, 2026
2 tasks done
@chaliy
chaliy merged commit 0fa32d1 into main Oct 26, 2026
11 checks passed
chaliy added a commit that referenced this pull request Oct 27, 2026
wasm-bindgen build of markkit (html, docx, spreadsheet, tool) for wasm32-unknown-unknown: single-threaded, no COOP/COEP, no URL fetching. Markkit class with validated camelCase options plus MarkkitTool. Node tests, CI job gating Check, and an OIDC npm publisher. Untracks pkg/ build output committed in #19.
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