papayu/src-tauri/config/llm_response_schema_v2.json
Yuriy a88c34aa15 Protocol v2 schema plumbing (Commit 2)
- llm_response_schema_v2.json: object-only, PATCH_FILE, base_sha256
- PAPAYU_PROTOCOL_VERSION=1|2 (default 1)
- schema_version and schema_hash dynamic in trace/log
- compiled_response_schema uses v1 or v2 by protocol
- response_format sends v2 schema when protocol=2
- Tests: test_schema_v2_compiles, test_schema_hash_non_empty_v2
- trace_to_golden: schema_hash_for_version by trace schema_version

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 11:58:49 +03:00

153 lines
4.7 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"x_schema_version": 2,
"type": "object",
"additionalProperties": false,
"required": ["actions"],
"properties": {
"actions": {
"type": "array",
"items": { "$ref": "#/$defs/action" },
"maxItems": 200
},
"summary": { "type": "string" },
"context_requests": {
"type": "array",
"items": { "$ref": "#/$defs/context_request" }
},
"memory_patch": { "$ref": "#/$defs/memory_patch" }
},
"$defs": {
"action": {
"type": "object",
"additionalProperties": false,
"required": ["kind", "path"],
"properties": {
"kind": {
"type": "string",
"enum": [
"CREATE_FILE",
"CREATE_DIR",
"UPDATE_FILE",
"PATCH_FILE",
"DELETE_FILE",
"DELETE_DIR"
]
},
"path": { "type": "string" },
"content": { "type": "string" },
"patch": { "type": "string" },
"base_sha256": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
}
},
"allOf": [
{
"if": { "properties": { "kind": { "const": "CREATE_DIR" } } },
"then": {
"not": {
"anyOf": [
{ "required": ["content"] },
{ "required": ["patch"] },
{ "required": ["base_sha256"] }
]
}
}
},
{
"if": { "properties": { "kind": { "const": "DELETE_DIR" } } },
"then": {
"not": {
"anyOf": [
{ "required": ["content"] },
{ "required": ["patch"] },
{ "required": ["base_sha256"] }
]
}
}
},
{
"if": { "properties": { "kind": { "const": "DELETE_FILE" } } },
"then": {
"not": {
"anyOf": [
{ "required": ["content"] },
{ "required": ["patch"] },
{ "required": ["base_sha256"] }
]
}
}
},
{
"if": { "properties": { "kind": { "enum": ["CREATE_FILE", "UPDATE_FILE"] } } },
"then": {
"required": ["content"],
"not": {
"anyOf": [
{ "required": ["patch"] },
{ "required": ["base_sha256"] }
]
}
}
},
{
"if": { "properties": { "kind": { "const": "PATCH_FILE" } } },
"then": {
"required": ["patch", "base_sha256"],
"not": { "anyOf": [{ "required": ["content"] }] }
}
}
]
},
"context_request": {
"type": "object",
"additionalProperties": false,
"required": ["type"],
"properties": {
"type": { "type": "string", "enum": ["read_file", "search", "logs", "env"] },
"path": { "type": "string" },
"start_line": { "type": "integer", "minimum": 1 },
"end_line": { "type": "integer", "minimum": 1 },
"glob": { "type": "string" },
"query": { "type": "string" },
"source": { "type": "string" },
"last_n": { "type": "integer", "minimum": 1, "maximum": 5000 }
},
"allOf": [
{
"if": { "properties": { "type": { "const": "read_file" } } },
"then": { "required": ["path"] }
},
{
"if": { "properties": { "type": { "const": "search" } } },
"then": { "required": ["query"] }
},
{
"if": { "properties": { "type": { "const": "logs" } } },
"then": { "required": ["source"] }
}
]
},
"memory_patch": {
"type": "object",
"additionalProperties": false,
"properties": {
"user.preferred_style": { "type": "string" },
"user.ask_budget": { "type": "integer" },
"user.risk_tolerance": { "type": "string" },
"user.default_language": { "type": "string" },
"user.output_format": { "type": "string" },
"project.default_test_command": { "type": "string" },
"project.default_lint_command": { "type": "string" },
"project.default_format_command": { "type": "string" },
"project.package_manager": { "type": "string" },
"project.build_command": { "type": "string" },
"project.src_roots": { "type": "array", "items": { "type": "string" } },
"project.test_roots": { "type": "array", "items": { "type": "string" } },
"project.ci_notes": { "type": "string" }
}
}
}
}