@bendyline/gezel-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +60 -0
- package/dist/index.d.ts +365 -0
- package/dist/index.js +911 -0
- package/dist/lint-contracts.d.ts +21 -0
- package/dist/lint-contracts.js +71 -0
- package/dist/server.d.ts +24 -0
- package/dist/server.js +11256 -0
- package/package.json +76 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bendyline
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @bendyline/gezel-mcp
|
|
2
|
+
|
|
3
|
+
The [Model Context Protocol](https://modelcontextprotocol.io) server that gives
|
|
4
|
+
[gezel](https://github.com/bendyline/gezel) agents their hands.
|
|
5
|
+
|
|
6
|
+
Every tool a gezel can call lives here: memory search and save, workspace file
|
|
7
|
+
operations, project artifacts, the shared document library, script and
|
|
8
|
+
Playwright execution, task management, team and project management, image
|
|
9
|
+
rendering, and history search.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @bendyline/gezel-mcp
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
It speaks stdio, so any MCP client can run it:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"gezel": {
|
|
21
|
+
"command": "npx",
|
|
22
|
+
"args": ["-y", "@bendyline/gezel-mcp"],
|
|
23
|
+
"env": {
|
|
24
|
+
"GEZEL_BASE_URL": "https://127.0.0.1:8080",
|
|
25
|
+
"GEZEL_TOKEN": "…",
|
|
26
|
+
"GEZEL_AGENT_ID": "…",
|
|
27
|
+
"GEZEL_PROJECT_ID": "default"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The server is a thin front end: it calls back into a running `gezeld` over
|
|
35
|
+
HTTP using the environment variables above. It runs as a child process with a
|
|
36
|
+
fresh Node environment, so those variables are its only connection to the
|
|
37
|
+
service — nothing else is inherited implicitly.
|
|
38
|
+
|
|
39
|
+
## Tool categories
|
|
40
|
+
|
|
41
|
+
Memory · workspace files · project artifacts · shared documents · script and
|
|
42
|
+
Playwright execution · package installation · team and project management ·
|
|
43
|
+
tasks · user questions · history search · image rendering.
|
|
44
|
+
|
|
45
|
+
Run the server and call `tools/list` for the authoritative, current inventory.
|
|
46
|
+
|
|
47
|
+
## Entry points
|
|
48
|
+
|
|
49
|
+
| Subpath | Contents |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `@bendyline/gezel-mcp` | Server construction helpers |
|
|
52
|
+
| `@bendyline/gezel-mcp/lint-contracts` | Tool-contract linting used by the eval harness |
|
|
53
|
+
| `@bendyline/gezel-mcp/dist/server.js` | The stdio entry point. Resolved by string from `packages/service/src/chat/manager.ts` — removing this export makes chat sessions silently run with no tools |
|
|
54
|
+
|
|
55
|
+
## Stability
|
|
56
|
+
|
|
57
|
+
Public API under semver. Tool names and argument schemas are part of that
|
|
58
|
+
contract: removing a tool or narrowing an argument is a breaking change.
|
|
59
|
+
|
|
60
|
+
MIT © Bendyline
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frozen inventory of every MCP tool the gezel-mcp server registers.
|
|
3
|
+
*
|
|
4
|
+
* This list is the contract between gezels (their prompts, especially the
|
|
5
|
+
* Meester's, teach specific tool names), the OpenAI provider's `mcp-bridge`
|
|
6
|
+
* (which translates these into OpenAI function-tool shape), and the on-disk
|
|
7
|
+
* gezel state the tools mutate.
|
|
8
|
+
*
|
|
9
|
+
* Adding a tool? Append its name here and `inventory.test.ts` will pass.
|
|
10
|
+
* Renaming or removing a tool? Update this list in the same change so the
|
|
11
|
+
* test doesn't lie about the surface.
|
|
12
|
+
*
|
|
13
|
+
* Tools grouped only as a reading aid — the order doesn't matter to the
|
|
14
|
+
* test; the test compares as a set.
|
|
15
|
+
*
|
|
16
|
+
* Project-type script tools (`GEZEL_SCRIPT_TOOLS`, see script-tools.ts)
|
|
17
|
+
* are deliberately NOT listed: they're per-project dynamic registrations
|
|
18
|
+
* whose names come from the applied type's manifest, not from this frozen
|
|
19
|
+
* contract. Registration guards them against colliding with these names.
|
|
20
|
+
*/
|
|
21
|
+
declare const ALWAYS_REGISTERED_TOOLS: readonly ["search_memory", "save_memory", "list_memories", "list_dir", "read_file", "read_files", "stat", "write_file", "append_to_file", "replace_in_file", "replace_lines", "apply_patch", "insert_at_marker", "delete_path", "make_dir", "rename", "copy_artifact_to_workspace", "validate", "npm_install", "list_package_scripts", "run_package_script", "run_npx", "run_nodejs_script", "derive_file", "list_packages", "run_playwright_script", "list_artifacts", "read_artifact", "write_artifact", "grep_artifact", "browser_find_page_element", "list_documents", "read_document", "write_document", "delete_document", "search_documents", "list_gezels", "create_gezel", "list_gilde", "list_project_types", "apply_project_type", "start_project_from_type", "export_project_type", "import_project_type", "ensure_gezel", "update_gezel", "message_gezel", "ask_gezel", "ask_specialist", "delegate_developer", "consult_developer", "delegate_designer", "consult_designer", "delegate_reviewer", "consult_reviewer", "delegate_planner", "consult_planner", "delegate_researcher", "consult_researcher", "delegate_builder", "consult_builder", "delegate_writer", "consult_writer", "delegate_image_generator", "consult_image_generator", "delegate_voorman", "consult_voorman", "delegate_meester", "consult_meester", "ask_user_question", "list_projects", "start_project", "fetch_repo", "fetch_diff", "update_project", "list_project_gezels", "add_gezel_to_project", "remove_gezel_from_project", "list_suggested_work", "enable_suggested_work", "disable_suggested_work", "list_tasks", "get_task", "create_task", "start_plan", "update_task", "set_outcomes", "verify_outcome", "add_verification_step", "spawn_task_instances", "list_task_children", "set_task_status", "activate_task", "assign_task", "add_task_step", "advance_task_step", "read_task_notes", "write_task_note", "search_history", "search_sessions", "how_do_i", "render_image", "generate_image", "describe_image", "read_image_metadata", "generate_video", "transcribe_audio", "synthesize_speech", "fetch_url", "web_search", "wikipedia_search", "grep_files", "find_files", "diff_files", "read_image_as_base64", "outline_file", "find_symbol", "read_symbol", "find_references", "map_repo", "search_code", "file_review", "list_file_issues", "security_scan", "security_overview", "scan_findings", "map_attack_surface", "list_dependencies", "trace_taint", "search_docs", "read_doc_as_markdown", "search_images", "find_similar_images", "describe_folder", "find_entity", "list_entity_mentions", "list_archive", "extract_archive", "run_git", "list_scripts", "run_installed_script", "get_script_run", "list_craftbooks", "suggest_craftbook", "invoke_craftbook", "import_skill", "craftbook_read", "craftbook_write", "craftbook_add_step", "set_step_deliverable", "craftbook_remove_step", "craftbook_reorder_steps", "craftbook_set_entry", "craftbook_update", "export_task_craftbook", "github_pr_list", "github_pr_view", "github_pr_files", "github_pr_diff", "github_pr_comments", "github_pr_comment", "github_pr_create", "github_workflow_runs", "github_check_status"];
|
|
22
|
+
/**
|
|
23
|
+
* Tools registered only when their feature or session-context gate is set
|
|
24
|
+
* in the env. Keep contextual/compatibility tools here so inventory users
|
|
25
|
+
* can distinguish them from the ordinary model-facing surface.
|
|
26
|
+
*/
|
|
27
|
+
declare const CONDITIONALLY_REGISTERED_TOOLS: {
|
|
28
|
+
readonly create_gezel_from_gilde: {
|
|
29
|
+
readonly envVar: "GEZEL_MCP_LEGACY_TOOLS";
|
|
30
|
+
readonly envValue: "1";
|
|
31
|
+
readonly modelFacing: false;
|
|
32
|
+
};
|
|
33
|
+
readonly start_job: {
|
|
34
|
+
readonly envVar: "GEZEL_MCP_LEGACY_TOOLS";
|
|
35
|
+
readonly envValue: "1";
|
|
36
|
+
readonly modelFacing: false;
|
|
37
|
+
};
|
|
38
|
+
readonly list_project_local_gezels: {
|
|
39
|
+
readonly envVar: "GEZEL_MCP_LEGACY_TOOLS";
|
|
40
|
+
readonly envValue: "1";
|
|
41
|
+
readonly modelFacing: false;
|
|
42
|
+
};
|
|
43
|
+
readonly craftbook_create: {
|
|
44
|
+
readonly envVar: "GEZEL_MCP_LEGACY_TOOLS";
|
|
45
|
+
readonly envValue: "1";
|
|
46
|
+
readonly modelFacing: false;
|
|
47
|
+
};
|
|
48
|
+
readonly craftbook_replace: {
|
|
49
|
+
readonly envVar: "GEZEL_MCP_LEGACY_TOOLS";
|
|
50
|
+
readonly envValue: "1";
|
|
51
|
+
readonly modelFacing: false;
|
|
52
|
+
};
|
|
53
|
+
readonly craftbook_update_step: {
|
|
54
|
+
readonly envVar: "GEZEL_CRAFTBOOK_ID";
|
|
55
|
+
readonly envValue: "*";
|
|
56
|
+
readonly modelFacing: true;
|
|
57
|
+
};
|
|
58
|
+
readonly request_tool_permission: {
|
|
59
|
+
readonly envVar: "GEZEL_PERMISSION_PROMPT";
|
|
60
|
+
readonly envValue: "1";
|
|
61
|
+
readonly modelFacing: false;
|
|
62
|
+
};
|
|
63
|
+
readonly draft_email: {
|
|
64
|
+
readonly envVar: "GEZEL_MAIL_ENABLED";
|
|
65
|
+
readonly envValue: "1";
|
|
66
|
+
readonly modelFacing: true;
|
|
67
|
+
};
|
|
68
|
+
readonly queue_email: {
|
|
69
|
+
readonly envVar: "GEZEL_MAIL_ENABLED";
|
|
70
|
+
readonly envValue: "1";
|
|
71
|
+
readonly modelFacing: true;
|
|
72
|
+
};
|
|
73
|
+
readonly send_email: {
|
|
74
|
+
readonly envVar: "GEZEL_MAIL_ENABLED";
|
|
75
|
+
readonly envValue: "1";
|
|
76
|
+
readonly modelFacing: true;
|
|
77
|
+
};
|
|
78
|
+
readonly draft_connector_action: {
|
|
79
|
+
readonly envVar: "GEZEL_CONNECTORS_ENABLED";
|
|
80
|
+
readonly envValue: "1";
|
|
81
|
+
readonly modelFacing: true;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
type AlwaysRegisteredToolName = (typeof ALWAYS_REGISTERED_TOOLS)[number];
|
|
85
|
+
type ConditionallyRegisteredToolName = keyof typeof CONDITIONALLY_REGISTERED_TOOLS;
|
|
86
|
+
/**
|
|
87
|
+
* Legacy spelling → canonical name for every tool renamed in the
|
|
88
|
+
* snake_case standardization. The old names never appear in `tools/list`
|
|
89
|
+
* (zero prompt cost) but stay callable forever: pinned gilde role
|
|
90
|
+
* templates teach some of them in prose, and lower-capability models
|
|
91
|
+
* guess them from training priors. Dispatch-time resolution lives in
|
|
92
|
+
* server.ts (stdio callers) and mcp-bridge.ts (bridged providers).
|
|
93
|
+
*
|
|
94
|
+
* `GEZEL_MCP_TOOL_NAMING=legacy` flips registration back to these
|
|
95
|
+
* spellings — an A/B lever for the naming experiment, not a supported
|
|
96
|
+
* production mode.
|
|
97
|
+
*/
|
|
98
|
+
declare const RENAMED_TOOLS: {
|
|
99
|
+
readonly readdir: "list_dir";
|
|
100
|
+
readonly readFile: "read_file";
|
|
101
|
+
readonly read_multiple_files: "read_files";
|
|
102
|
+
readonly writeFile: "write_file";
|
|
103
|
+
readonly appendToFile: "append_to_file";
|
|
104
|
+
readonly replaceInFile: "replace_in_file";
|
|
105
|
+
readonly replaceLines: "replace_lines";
|
|
106
|
+
readonly applyPatch: "apply_patch";
|
|
107
|
+
readonly insertAtMarker: "insert_at_marker";
|
|
108
|
+
readonly rm: "delete_path";
|
|
109
|
+
readonly mkdir: "make_dir";
|
|
110
|
+
readonly draftEmail: "draft_email";
|
|
111
|
+
readonly queueEmail: "queue_email";
|
|
112
|
+
readonly sendEmail: "send_email";
|
|
113
|
+
readonly search_files: "grep_files";
|
|
114
|
+
readonly run_script: "run_installed_script";
|
|
115
|
+
};
|
|
116
|
+
type LegacyToolName = keyof typeof RENAMED_TOOLS;
|
|
117
|
+
/**
|
|
118
|
+
* Removed, foreign-agent, or UI/client spellings that must never be taught as
|
|
119
|
+
* model-callable MCP tools. Unlike RENAMED_TOOLS these are not dispatch
|
|
120
|
+
* aliases; the registry keeps them only so every model-facing linter shares
|
|
121
|
+
* the same tombstones and replacement guidance.
|
|
122
|
+
*/
|
|
123
|
+
declare const TOOL_NAME_TOMBSTONES: {
|
|
124
|
+
readonly update_task_step: {
|
|
125
|
+
readonly replacement: undefined;
|
|
126
|
+
readonly reason: "no such MCP tool";
|
|
127
|
+
};
|
|
128
|
+
readonly commitProjectGit: {
|
|
129
|
+
readonly replacement: undefined;
|
|
130
|
+
readonly reason: "UI/client method, not an MCP tool";
|
|
131
|
+
};
|
|
132
|
+
readonly pushProjectGit: {
|
|
133
|
+
readonly replacement: undefined;
|
|
134
|
+
readonly reason: "UI/client method, not an MCP tool";
|
|
135
|
+
};
|
|
136
|
+
readonly listAudioVoices: {
|
|
137
|
+
readonly replacement: undefined;
|
|
138
|
+
readonly reason: "UI/client method, not an MCP tool";
|
|
139
|
+
};
|
|
140
|
+
readonly create_project: {
|
|
141
|
+
readonly replacement: "start_project";
|
|
142
|
+
readonly reason: "removed project-creation tool";
|
|
143
|
+
};
|
|
144
|
+
readonly inspect_git_workdir: {
|
|
145
|
+
readonly replacement: "run_git";
|
|
146
|
+
readonly reason: "foreign coding-agent tool";
|
|
147
|
+
};
|
|
148
|
+
readonly ensureGezel: {
|
|
149
|
+
readonly replacement: "ensure_gezel";
|
|
150
|
+
readonly reason: "client method, not an MCP tool";
|
|
151
|
+
};
|
|
152
|
+
readonly pushProjectGithub: {
|
|
153
|
+
readonly replacement: undefined;
|
|
154
|
+
readonly reason: "client method, not an MCP tool";
|
|
155
|
+
};
|
|
156
|
+
readonly AskUserQuestion: {
|
|
157
|
+
readonly replacement: "ask_user_question";
|
|
158
|
+
readonly reason: "foreign coding-agent tool";
|
|
159
|
+
};
|
|
160
|
+
readonly WebSearch: {
|
|
161
|
+
readonly replacement: "web_search";
|
|
162
|
+
readonly reason: "foreign coding-agent tool";
|
|
163
|
+
};
|
|
164
|
+
readonly Grep: {
|
|
165
|
+
readonly replacement: "grep_files";
|
|
166
|
+
readonly reason: "foreign coding-agent tool";
|
|
167
|
+
};
|
|
168
|
+
readonly Read: {
|
|
169
|
+
readonly replacement: "read_file";
|
|
170
|
+
readonly reason: "foreign coding-agent tool";
|
|
171
|
+
};
|
|
172
|
+
readonly Edit: {
|
|
173
|
+
readonly replacement: "replace_in_file";
|
|
174
|
+
readonly reason: "foreign coding-agent tool";
|
|
175
|
+
};
|
|
176
|
+
readonly Agent: {
|
|
177
|
+
readonly replacement: "message_gezel";
|
|
178
|
+
readonly reason: "foreign coding-agent tool";
|
|
179
|
+
};
|
|
180
|
+
readonly Bash: {
|
|
181
|
+
readonly replacement: undefined;
|
|
182
|
+
readonly reason: "foreign shell tool; no unrestricted shell is exposed";
|
|
183
|
+
};
|
|
184
|
+
readonly ExitPlanMode: {
|
|
185
|
+
readonly replacement: undefined;
|
|
186
|
+
readonly reason: "foreign coding-agent control tool";
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
type ToolNameTombstone = keyof typeof TOOL_NAME_TOMBSTONES;
|
|
190
|
+
type CanonicalToolName = AlwaysRegisteredToolName | ConditionallyRegisteredToolName;
|
|
191
|
+
interface ToolRegistrationGate {
|
|
192
|
+
readonly envVar: string;
|
|
193
|
+
/** `*` means any non-empty value enables the registration. */
|
|
194
|
+
readonly envValue: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Linter- and registration-friendly metadata for one canonical built-in.
|
|
198
|
+
*
|
|
199
|
+
* `aliases` are hidden callable spellings: they normally do not appear in
|
|
200
|
+
* `tools/list`, though the legacy naming experiment may advertise one in
|
|
201
|
+
* place of the canonical name. `advertisedByDefault` describes the ordinary
|
|
202
|
+
* environment before platform/provider/role filters are applied.
|
|
203
|
+
*/
|
|
204
|
+
interface CanonicalToolRegistryEntry {
|
|
205
|
+
readonly canonicalName: CanonicalToolName;
|
|
206
|
+
readonly registration: 'always' | 'conditional';
|
|
207
|
+
readonly gate?: ToolRegistrationGate;
|
|
208
|
+
readonly aliases: readonly LegacyToolName[];
|
|
209
|
+
readonly advertisedByDefault: boolean;
|
|
210
|
+
readonly modelFacing: boolean;
|
|
211
|
+
}
|
|
212
|
+
/** Canonical built-in names, with conditional names included exactly once. */
|
|
213
|
+
declare const CANONICAL_TOOL_NAMES: readonly CanonicalToolName[];
|
|
214
|
+
/** Hidden callable compatibility spellings, never canonical names. */
|
|
215
|
+
declare const LEGACY_TOOL_NAMES: readonly LegacyToolName[];
|
|
216
|
+
/**
|
|
217
|
+
* Single canonical registry for built-in tool-name consumers such as prompt
|
|
218
|
+
* linters. It unifies ordinary and contextual registrations with every
|
|
219
|
+
* hidden alias, so consumers do not need to recreate joins between the
|
|
220
|
+
* compatibility exports above.
|
|
221
|
+
*/
|
|
222
|
+
declare const TOOL_REGISTRY: Readonly<Record<CanonicalToolName, CanonicalToolRegistryEntry>>;
|
|
223
|
+
/**
|
|
224
|
+
* Every name reserved by a built-in, including hidden aliases. Dynamic
|
|
225
|
+
* project script tools must not claim any of these spellings because alias
|
|
226
|
+
* dispatch could otherwise route a call to the wrong handler.
|
|
227
|
+
*/
|
|
228
|
+
declare const BUILTIN_TOOL_NAMES: readonly (CanonicalToolName | LegacyToolName)[];
|
|
229
|
+
/**
|
|
230
|
+
* Every spelling a dynamic tool must not claim. Tombstones are not callable,
|
|
231
|
+
* but reserving their namespace prevents a project script from reintroducing
|
|
232
|
+
* a removed/foreign name that model-facing prompts are required to reject.
|
|
233
|
+
*/
|
|
234
|
+
declare const RESERVED_TOOL_NAMES: readonly (CanonicalToolName | LegacyToolName | ToolNameTombstone)[];
|
|
235
|
+
/** Canonical name → legacy spelling (inverse of {@link RENAMED_TOOLS}). */
|
|
236
|
+
declare const LEGACY_SPELLING_BY_CANONICAL: Readonly<Record<string, string>>;
|
|
237
|
+
/** Normalized key used by forgiving dispatch and dynamic-name reservation. */
|
|
238
|
+
declare function normalizeToolNameSpelling(name: string): string;
|
|
239
|
+
/**
|
|
240
|
+
* Resolve any spelling of a built-in tool name to its canonical form.
|
|
241
|
+
* Unknown names (third-party toolset tools, project script tools) pass
|
|
242
|
+
* through unchanged — this maps only the frozen rename table plus
|
|
243
|
+
* case/punctuation variants of it, never fuzzy near-misses.
|
|
244
|
+
*/
|
|
245
|
+
declare function canonicalToolName(name: string): string;
|
|
246
|
+
/**
|
|
247
|
+
* Resolve a requested tool name to whatever spelling is live in
|
|
248
|
+
* `knownNames`. Exact hits win; then the frozen rename table in both
|
|
249
|
+
* directions (so `writeFile` resolves when `write_file` is live, and
|
|
250
|
+
* `write_file` resolves in the legacy A/B arm where `writeFile` is
|
|
251
|
+
* live); then a case/punctuation-insensitive match against the live
|
|
252
|
+
* names — `WriteFile`, `write-file`, and `read_dir` all land. Never
|
|
253
|
+
* fuzzy: names that don't resolve return unchanged so "tool not found"
|
|
254
|
+
* errors stay honest. Both the stdio server's dispatch and the
|
|
255
|
+
* service's McpBridge route through this, which is what lets every
|
|
256
|
+
* name-keyed gate downstream assume a single spelling.
|
|
257
|
+
*/
|
|
258
|
+
declare function resolveToolNameSpelling(requested: string, knownNames: ReadonlySet<string>): string;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Structured file validation for the `validate` MCP tool.
|
|
262
|
+
*
|
|
263
|
+
* Sibling to [source-validation.ts](./source-validation.ts) — but where
|
|
264
|
+
* that module returns a single pass/fail string for `write_file` to gate
|
|
265
|
+
* the write, this module returns a per-check structured result a model
|
|
266
|
+
* can act on. The model calls `validate({ path })`, gets back a typed
|
|
267
|
+
* list of checks (each with name, status, optional location + excerpt +
|
|
268
|
+
* fix hint), and decides what to patch.
|
|
269
|
+
*
|
|
270
|
+
* Design priorities (in order):
|
|
271
|
+
*
|
|
272
|
+
* 1. **The model can act on the output without further reads.** Every
|
|
273
|
+
* failure carries a 5-line code excerpt with line numbers and an
|
|
274
|
+
* arrow on the failing line — same shape compilers print. The
|
|
275
|
+
* model patterns-match this and produces a fix without re-fetching
|
|
276
|
+
* the file.
|
|
277
|
+
* 2. **Fix hints route to the right tool.** When the failure mode
|
|
278
|
+
* points at a specific repair (binary corrupted by JSON round-trip
|
|
279
|
+
* → `copy_artifact_to_workspace`), the hint says so. Closes the
|
|
280
|
+
* verification-gate loop: the model gathers evidence here, then
|
|
281
|
+
* cites it back to `set_task_status`.
|
|
282
|
+
* 3. **Passes are one-liners.** Don't waste tokens on success — the
|
|
283
|
+
* model needs to know what's BROKEN, not what's fine.
|
|
284
|
+
*
|
|
285
|
+
* Dispatch is purely by file extension. Unknown extensions get the
|
|
286
|
+
* `file-non-empty` check and nothing else.
|
|
287
|
+
*/
|
|
288
|
+
type ValidateCheck = {
|
|
289
|
+
ok: true;
|
|
290
|
+
name: string;
|
|
291
|
+
detail?: string;
|
|
292
|
+
} | {
|
|
293
|
+
ok: null;
|
|
294
|
+
name: string;
|
|
295
|
+
detail: string;
|
|
296
|
+
} | {
|
|
297
|
+
ok: false;
|
|
298
|
+
name: string;
|
|
299
|
+
message: string;
|
|
300
|
+
location?: {
|
|
301
|
+
line: number;
|
|
302
|
+
col?: number;
|
|
303
|
+
};
|
|
304
|
+
excerpt?: string;
|
|
305
|
+
fixHint?: string;
|
|
306
|
+
};
|
|
307
|
+
interface ValidateResult {
|
|
308
|
+
path: string;
|
|
309
|
+
checks: ValidateCheck[];
|
|
310
|
+
}
|
|
311
|
+
interface FileContent {
|
|
312
|
+
/** Present for text-shaped files (html/js/json/css/md). */
|
|
313
|
+
text?: string;
|
|
314
|
+
/** Present for binary-shaped files (png/jpg/webp/svg/pdf/…). */
|
|
315
|
+
bytes?: Uint8Array;
|
|
316
|
+
/** Total bytes on disk regardless of which representation is set. */
|
|
317
|
+
totalBytes: number;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Pick the validation routine for a path. Returns an empty `checks`
|
|
321
|
+
* array if we have no opinion (e.g. unknown extension); the caller can
|
|
322
|
+
* surface that as "no validators registered for .ext".
|
|
323
|
+
*/
|
|
324
|
+
declare function validateFile(path: string, content: FileContent): ValidateResult;
|
|
325
|
+
/**
|
|
326
|
+
* Format a `ValidateResult` into the model-facing string. The shape:
|
|
327
|
+
*
|
|
328
|
+
* validate <path> — PASS | FAIL (X of Y checks failed)
|
|
329
|
+
*
|
|
330
|
+
* ✗ <check>: <message>
|
|
331
|
+
* <excerpt>
|
|
332
|
+
* Fix hint: <hint>
|
|
333
|
+
*
|
|
334
|
+
* ✓ <check>: <detail or "ok">
|
|
335
|
+
*
|
|
336
|
+
* Failures come first so the model reads them without scrolling.
|
|
337
|
+
*/
|
|
338
|
+
declare function formatValidateResult(result: ValidateResult): string;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Mirror the service's executable Linux probe at MCP registration time.
|
|
342
|
+
* Finding systemd-run is not enough: this checks that the user manager really
|
|
343
|
+
* applies RestrictAddressFamilies and rejects an AF_INET socket.
|
|
344
|
+
*/
|
|
345
|
+
declare function canUseLinuxSystemdDenyNet(): boolean;
|
|
346
|
+
declare function unavailableToolsForPlatform(platform: NodeJS.Platform, options?: {
|
|
347
|
+
linuxSystemdAvailable?: boolean;
|
|
348
|
+
}): readonly string[];
|
|
349
|
+
|
|
350
|
+
interface PullWithHeadRef {
|
|
351
|
+
headRef: string;
|
|
352
|
+
}
|
|
353
|
+
interface BranchPrioritizedPulls<T extends PullWithHeadRef> {
|
|
354
|
+
pulls: T[];
|
|
355
|
+
currentBranch?: string;
|
|
356
|
+
matchingCount: number;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Put open PRs for the checked-out branch first without disturbing the
|
|
360
|
+
* provider's order inside either group. Callers can then safely treat the
|
|
361
|
+
* first result as the default only when `matchingCount > 0`.
|
|
362
|
+
*/
|
|
363
|
+
declare function prioritizePullsForCurrentBranch<T extends PullWithHeadRef>(pulls: readonly T[], currentBranch?: string): BranchPrioritizedPulls<T>;
|
|
364
|
+
|
|
365
|
+
export { ALWAYS_REGISTERED_TOOLS, type AlwaysRegisteredToolName, BUILTIN_TOOL_NAMES, type BranchPrioritizedPulls, CANONICAL_TOOL_NAMES, CONDITIONALLY_REGISTERED_TOOLS, type CanonicalToolName, type CanonicalToolRegistryEntry, type ConditionallyRegisteredToolName, type FileContent, LEGACY_SPELLING_BY_CANONICAL, LEGACY_TOOL_NAMES, type LegacyToolName, type PullWithHeadRef, RENAMED_TOOLS, RESERVED_TOOL_NAMES, TOOL_NAME_TOMBSTONES, TOOL_REGISTRY, type ToolNameTombstone, type ToolRegistrationGate, type ValidateCheck, type ValidateResult, canUseLinuxSystemdDenyNet, canonicalToolName, formatValidateResult, normalizeToolNameSpelling, prioritizePullsForCurrentBranch, resolveToolNameSpelling, unavailableToolsForPlatform, validateFile };
|