-
Notifications
You must be signed in to change notification settings - Fork 80
π feat: Add @librechat/dev-tools Package for Coding Tool Definitions #262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lia-by-librechat
wants to merge
1
commit into
main
Choose a base branch
from
lia/dev-tools-package
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| # `@librechat/dev-tools` | ||
|
|
||
| The LLM-visible surface of the harness-native coding tools: the canonical | ||
| tool names, JSON schemas, and descriptions the model sees β `execute_code`, | ||
| `bash_tool`, `run_tools_with_code`, `run_tools_with_bash`, `read_file`, and | ||
| the local-engine file/edit/search tools (`read_file`, `write_file`, | ||
| `edit_file`, `grep_search`, `glob_search`, `list_directory`, | ||
| `compile_check`). | ||
|
|
||
| This package is the single versioned source of truth for that surface. The | ||
| schemas describe the execution environments this service provides, so they | ||
| live next to the Code API rather than inside the agent harness: | ||
| `@librechat/agents` and LibreChat (BYOM provisioning) both depend on the | ||
| definitions without the harness owning them. | ||
|
|
||
| ## What is here | ||
|
|
||
| | Module | Contents | | ||
| | --- | --- | | ||
| | `constants` | Canonical `ToolNames`, `CONTENT_AND_ARTIFACT`, and the `CODE_EXECUTION_TOOLS` / `LOCAL_CODING_TOOL_NAMES` / `LOCAL_CODING_BUNDLE_NAMES` sets | | ||
| | `types` | `JsonSchemaType`, `ToolDefinition` (mirrors the agents SDK's `LCTool`), `AllowedCaller`, `OutcomePatch` | | ||
| | `intent` | The intent-label contract embedded in every schema: `INTENT_PROPERTY`, `withIntent`/`withoutIntent`, arg readers/strippers, and outcome resolution | | ||
| | `guidance` | Shared `/mnt/data` and bash guidance embedded across schemas and descriptions | | ||
| | `timeout` | The programmatic-run `timeout` schema with environment-resolved defaults and clamping | | ||
| | `execute-code`, `bash-tool`, `read-file` | Remote (Code API) engine tool surfaces, including the stateful and attached-workspace description/schema builders | | ||
| | `run-tools-with-code`, `run-tools-with-bash` | Remote programmatic tool calling surfaces, including attached-workspace builders | | ||
| | `local` | Local-engine surfaces: file/edit/search tools, `compile_check`, the local execution descriptions, and the local programmatic tool calling schemas | | ||
|
|
||
| Zero runtime dependencies: everything is plain data and pure functions, so | ||
| harness, host, and worker consumers pay nothing to read the schemas. | ||
|
|
||
| ## What is deliberately not here | ||
|
|
||
| Execution. The Code API client, `ToolNode` event dispatch, the local | ||
| execution engine, tool-result replay, and output shaping (artifact-delivery | ||
| warnings, code-session file summaries) remain harness-native in | ||
| `@librechat/agents`. This package answers one question: what does the LLM | ||
| see? The sibling `@librechat/code` package answers the other side of | ||
| provisioning β the worker that turns an operator-owned VM into a stateful, | ||
| fenced execution environment. | ||
|
|
||
| ## Provenance | ||
|
|
||
| Ported from `@librechat/agents` (`src/tools/`) with export-name parity so | ||
| the harness swap is mechanical. Intentional differences: | ||
|
|
||
| - `Constants` tool-name members became `ToolNames` (the agents 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 β the | ||
| package's purpose is sharing them. | ||
| - 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`) so every | ||
| schema type-checks as written. | ||
|
|
||
| Every ported string was verified byte-for-byte against the harness source at | ||
| port time; descriptions are prompt surface, so drift is behavior change. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```ts | ||
| import { | ||
| CodeExecutionToolDefinition, | ||
| LocalCodingBundleNames, | ||
| buildBashExecutionToolDescription, | ||
| } from '@librechat/dev-tools'; | ||
| ``` | ||
|
|
||
| Subpath exports mirror the module list above (`@librechat/dev-tools/local`, | ||
| `@librechat/dev-tools/intent`, and so on). Tests pin the canonical names, | ||
| required properties, intent-first property ordering, and the | ||
| stateful/attached description builders. | ||
|
|
||
| ## Development | ||
|
|
||
| ```bash | ||
| npm install | ||
| npm test | ||
| ``` | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| { | ||
| "name": "@librechat/dev-tools", | ||
| "version": "0.1.0", | ||
| "description": "LLM-visible definitions (names, schemas, descriptions) of the harness-native coding tools for LibreChat Code API", | ||
| "license": "Apache-2.0", | ||
| "type": "module", | ||
| "main": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "import": "./dist/index.js" | ||
| }, | ||
| "./constants": { | ||
| "types": "./dist/constants.d.ts", | ||
| "import": "./dist/constants.js" | ||
| }, | ||
| "./types": { | ||
| "types": "./dist/types.d.ts", | ||
| "import": "./dist/types.js" | ||
| }, | ||
| "./intent": { | ||
| "types": "./dist/intent.d.ts", | ||
| "import": "./dist/intent.js" | ||
| }, | ||
| "./guidance": { | ||
| "types": "./dist/guidance.d.ts", | ||
| "import": "./dist/guidance.js" | ||
| }, | ||
| "./timeout": { | ||
| "types": "./dist/timeout.d.ts", | ||
| "import": "./dist/timeout.js" | ||
| }, | ||
| "./execute-code": { | ||
| "types": "./dist/execute-code.d.ts", | ||
| "import": "./dist/execute-code.js" | ||
| }, | ||
| "./bash-tool": { | ||
| "types": "./dist/bash-tool.d.ts", | ||
| "import": "./dist/bash-tool.js" | ||
| }, | ||
| "./read-file": { | ||
| "types": "./dist/read-file.d.ts", | ||
| "import": "./dist/read-file.js" | ||
| }, | ||
| "./run-tools-with-code": { | ||
| "types": "./dist/run-tools-with-code.d.ts", | ||
| "import": "./dist/run-tools-with-code.js" | ||
| }, | ||
| "./run-tools-with-bash": { | ||
| "types": "./dist/run-tools-with-bash.d.ts", | ||
| "import": "./dist/run-tools-with-bash.js" | ||
| }, | ||
| "./local": { | ||
| "types": "./dist/local/index.d.ts", | ||
| "import": "./dist/local/index.js" | ||
| } | ||
| }, | ||
| "files": [ | ||
| "dist", | ||
| "!dist/*.test.*" | ||
| ], | ||
| "scripts": { | ||
| "build": "tsc -p tsconfig.json", | ||
| "test": "npm run build && node --test dist/*.test.js", | ||
| "prepack": "npm run build" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^22.5.5", | ||
| "typescript": "^5.5.4" | ||
| }, | ||
| "engines": { | ||
| "node": ">=20.11" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documented root import names
LocalCodingBundleNames, but the package exports onlyLOCAL_CODING_BUNDLE_NAMES. Copying this primary usage example therefore produces a missing-export error instead of compiling; update the example to use the actual exported identifier.Useful? React with πΒ / π.