367 lines
12 KiB
JSON
367 lines
12 KiB
JSON
{
|
|
"openapi": "3.0.3",
|
|
"info": {
|
|
"title": "ollie-httpgw",
|
|
"description": "HTTP gateway for ollie session management. Supports D-Bus (default) and 9P backend modes.",
|
|
"version": "2.0.0"
|
|
},
|
|
"servers": [
|
|
{ "url": "http://localhost:8011", "description": "Default local gateway" }
|
|
],
|
|
"paths": {
|
|
"/sessions": {
|
|
"get": {
|
|
"tags": ["dbus"],
|
|
"summary": "List sessions",
|
|
"description": "Returns all active sessions with their id, state, model, and agent.",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Session list",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/components/schemas/SessionSummary" }
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"502": { "$ref": "#/components/responses/Error" }
|
|
}
|
|
},
|
|
"post": {
|
|
"tags": ["dbus"],
|
|
"summary": "Create a new session",
|
|
"requestBody": {
|
|
"required": false,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": { "$ref": "#/components/schemas/CreateSessionRequest" }
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"description": "Session created",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": { "id": { "type": "string" } },
|
|
"required": ["id"]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": { "$ref": "#/components/responses/Error" },
|
|
"502": { "$ref": "#/components/responses/Error" }
|
|
}
|
|
}
|
|
},
|
|
"/sessions/{id}": {
|
|
"parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
|
|
"get": {
|
|
"tags": ["dbus"],
|
|
"summary": "Get session config/detail",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Session config as key-value object",
|
|
"content": { "application/json": { "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"tags": ["dbus"],
|
|
"summary": "Kill session",
|
|
"responses": {
|
|
"204": { "description": "Session killed" },
|
|
"404": { "$ref": "#/components/responses/Error" }
|
|
}
|
|
},
|
|
"patch": {
|
|
"tags": ["dbus"],
|
|
"summary": "Rename session",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": { "name": { "type": "string" } },
|
|
"required": ["name"]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"204": { "description": "Renamed" },
|
|
"404": { "$ref": "#/components/responses/Error" }
|
|
}
|
|
}
|
|
},
|
|
"/sessions/{id}/submit": {
|
|
"parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
|
|
"post": {
|
|
"tags": ["dbus"],
|
|
"summary": "Submit a prompt to the session",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": { "prompt": { "type": "string" } },
|
|
"required": ["prompt"]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": { "description": "Submitted", "content": { "application/json": { "schema": { "type": "object", "properties": { "submitted": { "type": "boolean" } } } } } },
|
|
"404": { "$ref": "#/components/responses/Error" }
|
|
}
|
|
}
|
|
},
|
|
"/sessions/{id}/interrupt": {
|
|
"parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
|
|
"post": {
|
|
"tags": ["dbus"],
|
|
"summary": "Interrupt the running session",
|
|
"responses": {
|
|
"200": { "description": "Interrupted", "content": { "application/json": { "schema": { "type": "object", "properties": { "interrupted": { "type": "boolean" } } } } } },
|
|
"404": { "$ref": "#/components/responses/Error" }
|
|
}
|
|
}
|
|
},
|
|
"/sessions/{id}/state": {
|
|
"parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
|
|
"get": {
|
|
"tags": ["dbus"],
|
|
"summary": "Get session state",
|
|
"responses": {
|
|
"200": { "description": "State", "content": { "application/json": { "schema": { "type": "object", "properties": { "state": { "type": "string" } } } } } }
|
|
}
|
|
}
|
|
},
|
|
"/sessions/{id}/chat": {
|
|
"parameters": [
|
|
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } },
|
|
{ "name": "offset", "in": "query", "required": false, "schema": { "type": "integer", "format": "int64", "default": 0 }, "description": "Byte offset to resume from" }
|
|
],
|
|
"get": {
|
|
"tags": ["dbus"],
|
|
"summary": "Get chat transcript",
|
|
"description": "Returns chat text from the given offset. The X-Chat-Offset response header contains the new offset for subsequent requests.",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Chat text",
|
|
"headers": {
|
|
"X-Chat-Offset": { "schema": { "type": "integer", "format": "int64" }, "description": "New byte offset for next poll" }
|
|
},
|
|
"content": { "text/plain": { "schema": { "type": "string" } } }
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/sessions/{id}/usage": {
|
|
"parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
|
|
"get": {
|
|
"tags": ["dbus"],
|
|
"summary": "Get token usage",
|
|
"responses": {
|
|
"200": { "description": "Usage string", "content": { "application/json": { "schema": { "type": "object", "properties": { "usage": { "type": "string" } } } } } }
|
|
}
|
|
}
|
|
},
|
|
"/sessions/{id}/cost": {
|
|
"parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
|
|
"get": {
|
|
"tags": ["dbus"],
|
|
"summary": "Get session cost",
|
|
"responses": {
|
|
"200": { "description": "Cost string", "content": { "application/json": { "schema": { "type": "object", "properties": { "cost": { "type": "string" } } } } } }
|
|
}
|
|
}
|
|
},
|
|
"/sessions/{id}/config": {
|
|
"parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
|
|
"get": {
|
|
"tags": ["dbus"],
|
|
"summary": "Get session config",
|
|
"responses": {
|
|
"200": { "description": "Config as key-value", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }
|
|
}
|
|
},
|
|
"post": {
|
|
"tags": ["dbus"],
|
|
"summary": "Set a config value",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"key": { "type": "string" },
|
|
"value": { "type": "string" }
|
|
},
|
|
"required": ["key", "value"]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" } } } } } },
|
|
"400": { "$ref": "#/components/responses/Error" }
|
|
}
|
|
}
|
|
},
|
|
"/sessions/{id}/context": {
|
|
"parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
|
|
"get": {
|
|
"tags": ["dbus"],
|
|
"summary": "Get message context (JSONL)",
|
|
"responses": {
|
|
"200": { "description": "JSONL messages", "content": { "application/x-ndjson": { "schema": { "type": "string" } } } }
|
|
}
|
|
}
|
|
},
|
|
"/sessions/{id}/models": {
|
|
"parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
|
|
"get": {
|
|
"tags": ["dbus"],
|
|
"summary": "List models for session's backend",
|
|
"responses": {
|
|
"200": { "description": "Model list", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "string" } } } } }
|
|
}
|
|
}
|
|
},
|
|
"/sessions/{id}/peers": {
|
|
"parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
|
|
"get": {
|
|
"tags": ["dbus"],
|
|
"summary": "List peers",
|
|
"responses": {
|
|
"200": { "description": "Peer IDs", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "string" } } } } }
|
|
}
|
|
},
|
|
"post": {
|
|
"tags": ["dbus"],
|
|
"summary": "Add a peer",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": { "peer_id": { "type": "string" } },
|
|
"required": ["peer_id"]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"201": { "description": "Peer added" },
|
|
"400": { "$ref": "#/components/responses/Error" }
|
|
}
|
|
}
|
|
},
|
|
"/sessions/{id}/peers/{peer_id}": {
|
|
"parameters": [
|
|
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } },
|
|
{ "name": "peer_id", "in": "path", "required": true, "schema": { "type": "string" } }
|
|
],
|
|
"delete": {
|
|
"tags": ["dbus"],
|
|
"summary": "Remove a peer",
|
|
"responses": {
|
|
"204": { "description": "Peer removed" },
|
|
"404": { "$ref": "#/components/responses/Error" }
|
|
}
|
|
}
|
|
},
|
|
"/sessions/{id}/peers/{peer_id}/submit": {
|
|
"parameters": [
|
|
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } },
|
|
{ "name": "peer_id", "in": "path", "required": true, "schema": { "type": "string" } }
|
|
],
|
|
"post": {
|
|
"tags": ["dbus"],
|
|
"summary": "Submit prompt to a peer session",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": { "prompt": { "type": "string" } },
|
|
"required": ["prompt"]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": { "description": "Submitted" },
|
|
"404": { "$ref": "#/components/responses/Error" }
|
|
}
|
|
}
|
|
},
|
|
"/backends": {
|
|
"get": {
|
|
"tags": ["dbus"],
|
|
"summary": "List available backends",
|
|
"responses": {
|
|
"200": { "description": "Backend names", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "string" } } } } }
|
|
}
|
|
}
|
|
},
|
|
"/agents": {
|
|
"get": {
|
|
"tags": ["dbus"],
|
|
"summary": "List available agents",
|
|
"responses": {
|
|
"200": { "description": "Agent names", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "string" } } } } }
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"SessionSummary": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": { "type": "string" },
|
|
"state": { "type": "string" },
|
|
"model": { "type": "string" },
|
|
"agent": { "type": "string" }
|
|
},
|
|
"required": ["id", "state", "model", "agent"]
|
|
},
|
|
"CreateSessionRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"cwd": { "type": "string", "description": "Working directory (defaults to $HOME)" },
|
|
"backend": { "type": "string", "description": "Backend name (e.g. ollama, anthropic)" },
|
|
"model": { "type": "string", "description": "Model name" },
|
|
"agent": { "type": "string", "description": "Agent name (default: 'default')" }
|
|
}
|
|
},
|
|
"Error": {
|
|
"type": "object",
|
|
"properties": { "error": { "type": "string" } },
|
|
"required": ["error"]
|
|
}
|
|
},
|
|
"responses": {
|
|
"Error": {
|
|
"description": "Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": { "$ref": "#/components/schemas/Error" }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|