Step 227: Open-source model tool definitions
This commit is contained in:
36
tools/generic/adapter.json
Normal file
36
tools/generic/adapter.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"call_format": {
|
||||
"tool_call_tag": "tool_call",
|
||||
"name_attribute": "name",
|
||||
"payload": "json",
|
||||
"allow_whitespace": true,
|
||||
"max_calls_per_message": 1
|
||||
},
|
||||
"result_format": {
|
||||
"tool_result_tag": "tool_result",
|
||||
"name_attribute": "name",
|
||||
"payload": "json"
|
||||
},
|
||||
"parsing": {
|
||||
"strip_markdown_fences": true,
|
||||
"accept_action_prefix": "Action:",
|
||||
"accept_thought_prefix": "Thought:",
|
||||
"error_on_multiple_calls": true
|
||||
},
|
||||
"defaults": {
|
||||
"whetstone_generate_code": { "preferImports": true }
|
||||
},
|
||||
"mapping": {
|
||||
"whetstone_get_ast": "whetstone_get_ast",
|
||||
"whetstone_mutate": "whetstone_mutate",
|
||||
"whetstone_batch_mutate": "whetstone_batch_mutate",
|
||||
"whetstone_get_scope": "whetstone_get_scope",
|
||||
"whetstone_get_call_hierarchy": "whetstone_get_call_hierarchy",
|
||||
"whetstone_suggest_annotations": "whetstone_suggest_annotations",
|
||||
"whetstone_apply_annotation": "whetstone_apply_annotation",
|
||||
"whetstone_generate_code": "whetstone_generate_code",
|
||||
"whetstone_run_pipeline": "whetstone_run_pipeline",
|
||||
"whetstone_project_language": "whetstone_project_language"
|
||||
}
|
||||
}
|
||||
22
tools/generic/system_prompt.txt
Normal file
22
tools/generic/system_prompt.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
You are a Whetstone coding assistant for open-source LLMs. Use ReAct-style steps: think, then call tools.
|
||||
|
||||
Tool call format (XML):
|
||||
Thought: brief reasoning.
|
||||
Action: <tool_call name="TOOL_NAME">{JSON_ARGS}</tool_call>
|
||||
|
||||
Rules:
|
||||
- Use exactly one tool call per Action.
|
||||
- Emit valid JSON inside the tool call tag.
|
||||
- If no tool is needed, respond with a direct answer.
|
||||
|
||||
Available tools:
|
||||
- whetstone_get_ast: Return the current AST.
|
||||
- whetstone_mutate: Apply a single AST mutation.
|
||||
- whetstone_batch_mutate: Apply multiple mutations atomically.
|
||||
- whetstone_get_scope: List symbols in scope.
|
||||
- whetstone_get_call_hierarchy: Get call hierarchy for a function.
|
||||
- whetstone_suggest_annotations: Suggest memory annotations.
|
||||
- whetstone_apply_annotation: Apply memory annotations.
|
||||
- whetstone_generate_code: Generate code from a spec.
|
||||
- whetstone_run_pipeline: Run the full pipeline (source -> target).
|
||||
- whetstone_project_language: Project AST to a target language.
|
||||
106
tools/generic/tools.json
Normal file
106
tools/generic/tools.json
Normal file
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"provider": "generic",
|
||||
"call_format": {
|
||||
"type": "xml",
|
||||
"tag": "tool_call",
|
||||
"name_attribute": "name",
|
||||
"payload": "json",
|
||||
"example": "<tool_call name=\"whetstone_get_ast\">{}</tool_call>"
|
||||
},
|
||||
"tools": [
|
||||
{
|
||||
"name": "whetstone_get_ast",
|
||||
"description": "Return the current AST for the active buffer. Use before mutations.",
|
||||
"args": [],
|
||||
"defaults": {}
|
||||
},
|
||||
{
|
||||
"name": "whetstone_mutate",
|
||||
"description": "Apply a single AST mutation. Use setProperty, updateNode, deleteNode, or insertNode.",
|
||||
"args": [
|
||||
{ "name": "type", "type": "string", "required": true, "enum": ["setProperty", "updateNode", "deleteNode", "insertNode"] },
|
||||
{ "name": "nodeId", "type": "string", "required": false, "notes": "Required for setProperty, updateNode, deleteNode." },
|
||||
{ "name": "property", "type": "string", "required": false },
|
||||
{ "name": "value", "type": "string", "required": false },
|
||||
{ "name": "parentId", "type": "string", "required": false },
|
||||
{ "name": "role", "type": "string", "required": false },
|
||||
{ "name": "node", "type": "object", "required": false }
|
||||
],
|
||||
"defaults": {}
|
||||
},
|
||||
{
|
||||
"name": "whetstone_batch_mutate",
|
||||
"description": "Apply multiple mutations atomically.",
|
||||
"args": [
|
||||
{ "name": "mutations", "type": "array", "required": true }
|
||||
],
|
||||
"defaults": {}
|
||||
},
|
||||
{
|
||||
"name": "whetstone_get_scope",
|
||||
"description": "List symbols in scope for a node.",
|
||||
"args": [
|
||||
{ "name": "nodeId", "type": "string", "required": true }
|
||||
],
|
||||
"defaults": {}
|
||||
},
|
||||
{
|
||||
"name": "whetstone_get_call_hierarchy",
|
||||
"description": "Get call hierarchy for a function.",
|
||||
"args": [
|
||||
{ "name": "functionId", "type": "string", "required": true }
|
||||
],
|
||||
"defaults": {}
|
||||
},
|
||||
{
|
||||
"name": "whetstone_suggest_annotations",
|
||||
"description": "Suggest memory annotations for a node or line/col location.",
|
||||
"args": [
|
||||
{ "name": "nodeId", "type": "string", "required": false },
|
||||
{ "name": "line", "type": "integer", "required": false },
|
||||
{ "name": "col", "type": "integer", "required": false }
|
||||
],
|
||||
"defaults": {}
|
||||
},
|
||||
{
|
||||
"name": "whetstone_apply_annotation",
|
||||
"description": "Apply a memory annotation suggestion.",
|
||||
"args": [
|
||||
{ "name": "nodeId", "type": "string", "required": true },
|
||||
{ "name": "annotationType", "type": "string", "required": true },
|
||||
{ "name": "strategy", "type": "string", "required": true },
|
||||
{ "name": "reason", "type": "string", "required": false },
|
||||
{ "name": "confidence", "type": "number", "required": false }
|
||||
],
|
||||
"defaults": {}
|
||||
},
|
||||
{
|
||||
"name": "whetstone_generate_code",
|
||||
"description": "Generate code from a natural language spec.",
|
||||
"args": [
|
||||
{ "name": "spec", "type": "string", "required": true },
|
||||
{ "name": "preferImports", "type": "boolean", "required": false }
|
||||
],
|
||||
"defaults": { "preferImports": true }
|
||||
},
|
||||
{
|
||||
"name": "whetstone_run_pipeline",
|
||||
"description": "Run the full pipeline from source to target language.",
|
||||
"args": [
|
||||
{ "name": "source", "type": "string", "required": true },
|
||||
{ "name": "sourceLanguage", "type": "string", "required": true },
|
||||
{ "name": "targetLanguage", "type": "string", "required": true }
|
||||
],
|
||||
"defaults": {}
|
||||
},
|
||||
{
|
||||
"name": "whetstone_project_language",
|
||||
"description": "Project the current AST to a target language.",
|
||||
"args": [
|
||||
{ "name": "targetLanguage", "type": "string", "required": true }
|
||||
],
|
||||
"defaults": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user