93 lines
2.4 KiB
JSON
93 lines
2.4 KiB
JSON
|
|
{
|
||
|
|
"openapi": "3.1.0",
|
||
|
|
"info": {
|
||
|
|
"title": "Container Code Runner",
|
||
|
|
"version": "1.0.0",
|
||
|
|
"description": "run source code inside a sandboxed container. important: provide pure source code only; do not wrap code in shell commands or pipelines."
|
||
|
|
},
|
||
|
|
"paths": {
|
||
|
|
"/execute": {
|
||
|
|
"post": {
|
||
|
|
"operationId": "execute",
|
||
|
|
"summary": "Run code in a sandboxed container",
|
||
|
|
"description": "use the language directly, not bash + the language. e.g., `#include...` (good) vs `echo '#include...' && gcc` (bad). pass only pure source text in `code`.",
|
||
|
|
"requestBody": {
|
||
|
|
"required": true,
|
||
|
|
"content": {
|
||
|
|
"application/json": {
|
||
|
|
"schema": {
|
||
|
|
"type": "object",
|
||
|
|
"properties": {
|
||
|
|
"language": {
|
||
|
|
"type": "string",
|
||
|
|
"enum": "Object.keys(LANGS)",
|
||
|
|
"description": "the programming language to run. do not use 'bash' to wrap or invoke compilers/interpreters; select the actual language (e.g., 'c', 'cpp', 'python')."
|
||
|
|
},
|
||
|
|
"code": {
|
||
|
|
"type": "string",
|
||
|
|
"description": "pure source code only. do not include shell commands, redirections, pipes, or `echo`/`printf` wrappers. examples:\n\tgood: `print('hi')`;\n\tbad: `echo \"print('hi')\" | python`."
|
||
|
|
},
|
||
|
|
"args": {
|
||
|
|
"type": "array",
|
||
|
|
"items": {
|
||
|
|
"type": "string"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"files": {
|
||
|
|
"type": "array",
|
||
|
|
"items": {
|
||
|
|
"type": "object",
|
||
|
|
"properties": {
|
||
|
|
"path": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"content": {
|
||
|
|
"type": "string"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"required": [
|
||
|
|
"path",
|
||
|
|
"content"
|
||
|
|
],
|
||
|
|
"description": "optional supporting files. contents must be pure file text, not shell commands."
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"required": [
|
||
|
|
"language",
|
||
|
|
"code"
|
||
|
|
]
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"responses": {
|
||
|
|
"200": {
|
||
|
|
"description": "Execution result",
|
||
|
|
"content": {
|
||
|
|
"application/json": {
|
||
|
|
"schema": {
|
||
|
|
"type": "object",
|
||
|
|
"properties": {
|
||
|
|
"stdout": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"stderr": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"exitCode": {
|
||
|
|
"type": "integer"
|
||
|
|
},
|
||
|
|
"timedOut": {
|
||
|
|
"type": "boolean"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|