diff --git a/README.md b/README.md index 835376d..95fcbaa 100644 --- a/README.md +++ b/README.md @@ -35,3 +35,8 @@ The authenticated WebAssembly plugin lifecycle uses the manifest, install, and installed-response contracts. Fixtures contain only synthetic package metadata and no executable module or secret. +Command simulation uses `bot-command-simulate-request.json` and +`bot-command-simulate-response.json`. A sample response is the default and +real network requests require an explicit `use_real_request` flag; fixtures +contain only local synthetic data. + diff --git a/contracts/v1/bot-command-simulate-request.json b/contracts/v1/bot-command-simulate-request.json new file mode 100644 index 0000000..9b40b3e --- /dev/null +++ b/contracts/v1/bot-command-simulate-request.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://trixie.invalid/contracts/v1/bot-command-simulate-request.json", + "title": "Trixie bot command simulation request", + "type": "object", + "additionalProperties": false, + "required": ["template"], + "properties": { + "template": { "type": "string", "minLength": 1, "maxLength": 2000 }, + "variables": { "type": "object", "additionalProperties": { "type": "string", "maxLength": 2000 } }, + "web_request": { "type": ["object", "null"] }, + "sample_response": {}, + "use_real_request": { "type": "boolean", "default": false }, + "response_fields": { + "type": "array", + "maxItems": 128, + "items": { + "type": "array", + "prefixItems": [ + { "type": "string", "minLength": 1, "maxLength": 64 }, + { "type": "string", "minLength": 1, "maxLength": 256 } + ], + "items": false, + "minItems": 2, + "maxItems": 2 + } + } + } +} diff --git a/contracts/v1/bot-command-simulate-response.json b/contracts/v1/bot-command-simulate-response.json new file mode 100644 index 0000000..5ea50ff --- /dev/null +++ b/contracts/v1/bot-command-simulate-response.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://trixie.invalid/contracts/v1/bot-command-simulate-response.json", + "title": "Trixie bot command simulation response", + "type": "object", + "additionalProperties": false, + "required": ["status", "extracted_variables"], + "properties": { + "status": { "const": "ok" }, + "rendered": { "type": ["string", "null"], "maxLength": 2000 }, + "extracted_variables": { "type": "object", "additionalProperties": { "type": "string" } }, + "error": { "type": ["string", "null"], "maxLength": 500 } + } +} diff --git a/fixtures/v1/bot-command-simulate-request.json b/fixtures/v1/bot-command-simulate-request.json new file mode 100644 index 0000000..b6cfcb1 --- /dev/null +++ b/fixtures/v1/bot-command-simulate-request.json @@ -0,0 +1,7 @@ +{ + "template": "Hello ${user_name}; status=${status}", + "variables": { "user_name": "PreviewUser" }, + "sample_response": { "status": "ok" }, + "use_real_request": false, + "response_fields": [["status", "$.status"]] +} diff --git a/fixtures/v1/bot-command-simulate-response.json b/fixtures/v1/bot-command-simulate-response.json new file mode 100644 index 0000000..94bb9ac --- /dev/null +++ b/fixtures/v1/bot-command-simulate-response.json @@ -0,0 +1,6 @@ +{ + "status": "ok", + "rendered": "Hello PreviewUser; status=ok", + "extracted_variables": { "status": "ok" }, + "error": null +}