Skip to content

Commit f51a8ae

Browse files
committed
feat: Add @librechat/dev-tools Package for Coding Tool Definitions
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.
1 parent dc48249 commit f51a8ae

28 files changed

Lines changed: 2829 additions & 0 deletions

‎.github/workflows/ci.yml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,27 @@ jobs:
194194
- name: Tests
195195
run: npm test
196196

197+
dev-tools-package-tests:
198+
name: Dev Tools Package Tests
199+
runs-on: ubuntu-latest
200+
defaults:
201+
run:
202+
working-directory: packages/dev-tools
203+
steps:
204+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
205+
206+
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
207+
with:
208+
node-version: 22.21.0
209+
cache: npm
210+
cache-dependency-path: packages/dev-tools/package-lock.json
211+
212+
- name: Install dependencies
213+
run: npm ci
214+
215+
- name: Tests
216+
run: npm test
217+
197218
macos-storage-tests:
198219
name: macOS Storage ACL Tests
199220
runs-on: macos-14

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Code Interpreter (internally `codeapi`, the prefix used by its env vars, images,
1717
development
1818
- **Remote Code Bridge** - Lets an operator-owned VM connect outbound and serve
1919
as a fenced, stateful sandbox through the `@librechat/code` worker
20+
- **Coding Tool Definitions** - The `@librechat/dev-tools` npm package: the
21+
LLM-visible surface (canonical names, schemas, descriptions) of the
22+
harness-native coding tools, shared by `@librechat/agents` and LibreChat
23+
provisioning
2024

2125
## Architecture
2226

‎packages/dev-tools/README.md‎

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# `@librechat/dev-tools`
2+
3+
The LLM-visible surface of the harness-native coding tools: the canonical
4+
tool names, JSON schemas, and descriptions the model sees — `execute_code`,
5+
`bash_tool`, `run_tools_with_code`, `run_tools_with_bash`, `read_file`, and
6+
the local-engine file/edit/search tools (`read_file`, `write_file`,
7+
`edit_file`, `grep_search`, `glob_search`, `list_directory`,
8+
`compile_check`).
9+
10+
This package is the single versioned source of truth for that surface. The
11+
schemas describe the execution environments this service provides, so they
12+
live next to the Code API rather than inside the agent harness:
13+
`@librechat/agents` and LibreChat (BYOM provisioning) both depend on the
14+
definitions without the harness owning them.
15+
16+
## What is here
17+
18+
| Module | Contents |
19+
| --- | --- |
20+
| `constants` | Canonical `ToolNames`, `CONTENT_AND_ARTIFACT`, and the `CODE_EXECUTION_TOOLS` / `LOCAL_CODING_TOOL_NAMES` / `LOCAL_CODING_BUNDLE_NAMES` sets |
21+
| `types` | `JsonSchemaType`, `ToolDefinition` (mirrors the agents SDK's `LCTool`), `AllowedCaller`, `OutcomePatch` |
22+
| `intent` | The intent-label contract embedded in every schema: `INTENT_PROPERTY`, `withIntent`/`withoutIntent`, arg readers/strippers, and outcome resolution |
23+
| `guidance` | Shared `/mnt/data` and bash guidance embedded across schemas and descriptions |
24+
| `timeout` | The programmatic-run `timeout` schema with environment-resolved defaults and clamping |
25+
| `execute-code`, `bash-tool`, `read-file` | Remote (Code API) engine tool surfaces, including the stateful and attached-workspace description/schema builders |
26+
| `run-tools-with-code`, `run-tools-with-bash` | Remote programmatic tool calling surfaces, including attached-workspace builders |
27+
| `local` | Local-engine surfaces: file/edit/search tools, `compile_check`, the local execution descriptions, and the local programmatic tool calling schemas |
28+
29+
Zero runtime dependencies: everything is plain data and pure functions, so
30+
harness, host, and worker consumers pay nothing to read the schemas.
31+
32+
## What is deliberately not here
33+
34+
Execution. The Code API client, `ToolNode` event dispatch, the local
35+
execution engine, tool-result replay, and output shaping (artifact-delivery
36+
warnings, code-session file summaries) remain harness-native in
37+
`@librechat/agents`. This package answers one question: what does the LLM
38+
see? The sibling `@librechat/code` package answers the other side of
39+
provisioning — the worker that turns an operator-owned VM into a stateful,
40+
fenced execution environment.
41+
42+
## Provenance
43+
44+
Ported from `@librechat/agents` (`src/tools/`) with export-name parity so
45+
the harness swap is mechanical. Intentional differences:
46+
47+
- `Constants` tool-name members became `ToolNames` (the agents enum mixes
48+
orchestration constants; only the coding-tool members moved).
49+
- Schemas that were module-private in the harness (`CompileCheckSchema`, the
50+
local programmatic tool calling schema builders) are exported here — the
51+
package's purpose is sharing them.
52+
- Local-engine descriptions that lived inline inside tool factories are
53+
first-class `Local*ToolDescription` constants.
54+
- `JsonSchemaType` is widened with the JSON-Schema keywords these schemas
55+
use (`minLength`, `minimum`, `maximum`, `default`, `uniqueItems`) so every
56+
schema type-checks as written.
57+
58+
Every ported string was verified byte-for-byte against the harness source at
59+
port time; descriptions are prompt surface, so drift is behavior change.
60+
61+
## Usage
62+
63+
```ts
64+
import {
65+
CodeExecutionToolDefinition,
66+
LocalCodingBundleNames,
67+
buildBashExecutionToolDescription,
68+
} from '@librechat/dev-tools';
69+
```
70+
71+
Subpath exports mirror the module list above (`@librechat/dev-tools/local`,
72+
`@librechat/dev-tools/intent`, and so on). Tests pin the canonical names,
73+
required properties, intent-first property ordering, and the
74+
stateful/attached description builders.
75+
76+
## Development
77+
78+
```bash
79+
npm install
80+
npm test
81+
```

‎packages/dev-tools/package-lock.json‎

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/dev-tools/package.json‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "@librechat/dev-tools",
3+
"version": "0.1.0",
4+
"description": "LLM-visible definitions (names, schemas, descriptions) of the harness-native coding tools for LibreChat Code API",
5+
"license": "Apache-2.0",
6+
"type": "module",
7+
"main": "./dist/index.js",
8+
"types": "./dist/index.d.ts",
9+
"exports": {
10+
".": {
11+
"types": "./dist/index.d.ts",
12+
"import": "./dist/index.js"
13+
},
14+
"./constants": {
15+
"types": "./dist/constants.d.ts",
16+
"import": "./dist/constants.js"
17+
},
18+
"./types": {
19+
"types": "./dist/types.d.ts",
20+
"import": "./dist/types.js"
21+
},
22+
"./intent": {
23+
"types": "./dist/intent.d.ts",
24+
"import": "./dist/intent.js"
25+
},
26+
"./guidance": {
27+
"types": "./dist/guidance.d.ts",
28+
"import": "./dist/guidance.js"
29+
},
30+
"./timeout": {
31+
"types": "./dist/timeout.d.ts",
32+
"import": "./dist/timeout.js"
33+
},
34+
"./execute-code": {
35+
"types": "./dist/execute-code.d.ts",
36+
"import": "./dist/execute-code.js"
37+
},
38+
"./bash-tool": {
39+
"types": "./dist/bash-tool.d.ts",
40+
"import": "./dist/bash-tool.js"
41+
},
42+
"./read-file": {
43+
"types": "./dist/read-file.d.ts",
44+
"import": "./dist/read-file.js"
45+
},
46+
"./run-tools-with-code": {
47+
"types": "./dist/run-tools-with-code.d.ts",
48+
"import": "./dist/run-tools-with-code.js"
49+
},
50+
"./run-tools-with-bash": {
51+
"types": "./dist/run-tools-with-bash.d.ts",
52+
"import": "./dist/run-tools-with-bash.js"
53+
},
54+
"./local": {
55+
"types": "./dist/local/index.d.ts",
56+
"import": "./dist/local/index.js"
57+
}
58+
},
59+
"files": [
60+
"dist",
61+
"!dist/*.test.*"
62+
],
63+
"scripts": {
64+
"build": "tsc -p tsconfig.json",
65+
"test": "npm run build && node --test dist/*.test.js",
66+
"prepack": "npm run build"
67+
},
68+
"devDependencies": {
69+
"@types/node": "^22.5.5",
70+
"typescript": "^5.5.4"
71+
},
72+
"engines": {
73+
"node": ">=20.11"
74+
}
75+
}

0 commit comments

Comments
 (0)