Skip to content

📐 feat: Add @librechat/dev-tools Package for Coding Tool Definitions - #262

Open
lia-by-librechat[bot] wants to merge 1 commit into
mainfrom
lia/dev-tools-package
Open

lia-by-librechat[bot] wants to merge 1 commit into
mainfrom
lia/dev-tools-package

Conversation

@lia-by-librechat

Copy link
Copy Markdown
Contributor

Summary

Port the LLM-visible surface of the harness-native coding tools from @librechat/agents into this repository as a new package, @librechat/dev-tools — the code-interpreter side of moving the coding tool definitions next to the Code API that provides their execution environments.

The package holds exactly what the LLM sees:

  • Canonical tool names (ToolNames) and the CODE_EXECUTION_TOOLS / LOCAL_CODING_TOOL_NAMES / LOCAL_CODING_BUNDLE_NAMES sets
  • JSON schemas and descriptions for the remote-engine tools: execute_code, bash_tool, run_tools_with_code, run_tools_with_bash, read_file — including the stateful, attached-workspace, and tool-output-reference description/schema builders
  • Schemas, descriptions, and registry definitions for the local-engine tools: read_file, write_file, edit_file, grep_search, glob_search, list_directory, compile_check
  • The intent-label contract embedded in every schema: INTENT_PROPERTY, withIntent/withoutIntent, arg readers/strippers, and outcome resolution
  • The shared /mnt/data and bash guidance
  • The programmatic-run timeout schema with environment-resolved defaults and clamping

Why

The schemas describe the execution environments this service provides, so they live here rather than inside the agent harness: @librechat/agents and LibreChat (BYOM provisioning) consume the definitions without the harness owning them. Zero runtime dependencies — everything is plain data and pure functions.

Execution stays harness-native in @librechat/agents (Code API client, ToolNode event dispatch, the local engine, result replay, and output shaping). The sibling @librechat/code package covers the worker side of provisioning.

Provenance and fidelity

Ported from @librechat/agents src/tools/ with export-name parity so the agents-side swap is mechanical. Intentional differences:

  • Constants tool-name members became ToolNames (the harness enum mixes orchestration constants; only the coding-tool members moved)
  • Schemas that were module-private in the harness (CompileCheckSchema, the local programmatic tool calling schema builders) are exported here — sharing them is the package's purpose
  • Local-engine descriptions that lived inline inside tool factories are first-class Local*ToolDescription constants
  • JsonSchemaType is widened with the JSON-Schema keywords these schemas use (minLength, minimum, maximum, default, uniqueItems)

Every ported string was verified byte-for-byte against the harness source at port time — full-file diffs for the intent and timeout modules, block diffs for the schema builders, extraction-and-compare for every description constant. Descriptions are prompt surface, so drift is behavior change.

Verification

  • npm test in packages/dev-tools: 42 tests pass — canonical names and sets, intent-first property ordering, required properties, timeout bounds and env resolution, and the stateful/attached description and schema builders
  • npx tsc --noEmit clean
  • Prettier (repo config) clean on all new files
  • CI adds a dev-tools-package-tests job on Node 22.21.0 — pure TypeScript with zero runtime deps, so no matrix and no native tooling

Not in this PR

The agents-side swap (importing @librechat/dev-tools from the harness) comes in a follow-up against the agents repository.

Port the LLM-visible surface of the harness-native coding tools from
@librechat/agents into packages/dev-tools, published as
@librechat/dev-tools: canonical tool names, the JSON schemas and
descriptions for the remote-engine tools (execute_code, bash_tool,
run_tools_with_code, run_tools_with_bash, read_file) and the
local-engine tools (read_file, write_file, edit_file, grep_search,
glob_search, list_directory, compile_check), the intent-label contract
embedded in every schema, the /mnt/data and bash guidance, and the
timeout schema with its environment-resolved defaults.

The package has zero runtime dependencies: everything is plain data and
pure functions, so the agent harness and BYOM provisioning consume the
definitions without the harness owning them. Execution stays
harness-native in @librechat/agents; the definitions describe the
execution environments this service provides.

Ported with export-name parity so the agents-side swap is mechanical;
every ported string was verified byte-for-byte against the harness
source. Tests pin the canonical names, intent-first property ordering,
required properties, and the stateful/attached description builders.
CI runs the package tests on Node 22.21.0.
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