139 lines
4.7 KiB
JSON
139 lines
4.7 KiB
JSON
|
|
{
|
|||
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|||
|
|
"$id": "https://aps.local/contracts/http.schema.json",
|
|||
|
|
"title": "HTTP payloads",
|
|||
|
|
"description": "HTTP 请求体与响应体的形状。端点、方法与状态码见 docs/spec/protocol.md;本文件只定义数据形状。带自己文件的类型(会话、能力、回执、审批请求、错误)不在这里重复。",
|
|||
|
|
"$defs": {
|
|||
|
|
"HealthResponse": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["status", "version", "protocolVersion"],
|
|||
|
|
"properties": {
|
|||
|
|
"status": { "const": "ok" },
|
|||
|
|
"version": { "type": "string" },
|
|||
|
|
"protocolVersion": { "type": "integer" }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
},
|
|||
|
|
"MeResponse": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["userId", "tenantId", "displayName", "clientKind"],
|
|||
|
|
"properties": {
|
|||
|
|
"userId": { "type": "string" },
|
|||
|
|
"tenantId": { "type": "string" },
|
|||
|
|
"displayName": { "type": "string" },
|
|||
|
|
"clientKind": { "type": "string", "enum": ["desktop", "browser"] }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
},
|
|||
|
|
"ProjectSummary": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["projectId", "name", "status", "writable"],
|
|||
|
|
"properties": {
|
|||
|
|
"projectId": { "type": "string" },
|
|||
|
|
"name": { "type": "string" },
|
|||
|
|
"status": { "type": "string", "enum": ["active", "archived"] },
|
|||
|
|
"writable": { "type": "boolean", "description": "项目内可写;个人会话只读(ADR-0003)" }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
},
|
|||
|
|
"ProjectListResponse": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["projects"],
|
|||
|
|
"properties": {
|
|||
|
|
"projects": { "type": "array", "items": { "$ref": "#/$defs/ProjectSummary" } }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
},
|
|||
|
|
"CapabilitiesResponse": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["capabilities"],
|
|||
|
|
"properties": {
|
|||
|
|
"capabilities": { "type": "array", "items": { "$ref": "capability.schema.json#/$defs/CapabilitySummary" } }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
},
|
|||
|
|
"ChatMessage": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["messageId", "role", "ts", "text"],
|
|||
|
|
"properties": {
|
|||
|
|
"messageId": { "type": "string" },
|
|||
|
|
"role": { "type": "string", "enum": ["user", "assistant", "system"] },
|
|||
|
|
"ts": { "type": "integer" },
|
|||
|
|
"text": { "type": "string" }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
},
|
|||
|
|
"CreateSessionRequest": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["scope"],
|
|||
|
|
"properties": {
|
|||
|
|
"projectId": { "type": "string" },
|
|||
|
|
"scope": { "type": "string", "enum": ["personal", "project"] },
|
|||
|
|
"title": { "type": "string" }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
},
|
|||
|
|
"CreateSessionResponse": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["session"],
|
|||
|
|
"properties": {
|
|||
|
|
"session": { "$ref": "session.schema.json#/$defs/SessionSummary" }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
},
|
|||
|
|
"SessionListResponse": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["sessions"],
|
|||
|
|
"properties": {
|
|||
|
|
"sessions": { "type": "array", "items": { "$ref": "session.schema.json#/$defs/SessionSummary" } }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
},
|
|||
|
|
"SessionDetailResponse": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["session", "messages"],
|
|||
|
|
"properties": {
|
|||
|
|
"session": { "$ref": "session.schema.json#/$defs/SessionSummary" },
|
|||
|
|
"messages": { "type": "array", "items": { "$ref": "#/$defs/ChatMessage" } }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
},
|
|||
|
|
"SendMessageRequest": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["text", "idempotencyKey"],
|
|||
|
|
"properties": {
|
|||
|
|
"text": { "type": "string", "minLength": 1 },
|
|||
|
|
"idempotencyKey": { "type": "string", "minLength": 8 }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
},
|
|||
|
|
"SendMessageResponse": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["accepted", "messageId", "runId"],
|
|||
|
|
"properties": {
|
|||
|
|
"accepted": { "const": true },
|
|||
|
|
"messageId": { "type": "string" },
|
|||
|
|
"runId": { "type": "string" }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
},
|
|||
|
|
"CancelResponse": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["state"],
|
|||
|
|
"properties": {
|
|||
|
|
"state": { "type": "string", "enum": ["cancelling", "idle"] }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
},
|
|||
|
|
"ApprovalDecisionResponse": {
|
|||
|
|
"type": "object",
|
|||
|
|
"required": ["approvalId", "decision"],
|
|||
|
|
"properties": {
|
|||
|
|
"approvalId": { "type": "string" },
|
|||
|
|
"decision": { "type": "string", "enum": ["approved", "rejected", "expired"] },
|
|||
|
|
"receipt": { "$ref": "receipt.schema.json#/$defs/ExecutionReceipt" }
|
|||
|
|
},
|
|||
|
|
"additionalProperties": false
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|