aps-agent/contracts/schemas/http.schema.json

540 lines
11 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"$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
},
"ExecutionTraceEntry": {
"type": "object",
"required": [
"seq",
"ts",
"event",
"actorUserId"
],
"properties": {
"seq": {
"type": "integer"
},
"ts": {
"type": "integer"
},
"event": {
"type": "string"
},
"actorUserId": {
"type": "string"
},
"capabilityId": {
"type": "string"
},
"providerId": {
"type": "string"
},
"paramsDigest": {
"type": "string"
},
"decision": {
"type": "string"
},
"detail": {
"type": "object"
}
},
"additionalProperties": false
},
"ExecutionApprovalRecord": {
"type": "object",
"required": [
"approvalId",
"status",
"revision",
"expiresAt"
],
"properties": {
"approvalId": {
"type": "string"
},
"status": {
"type": "string"
},
"decision": {
"type": "string",
"enum": [
"approved",
"rejected",
"expired"
]
},
"decidedBy": {
"type": "string"
},
"decidedAt": {
"type": "integer"
},
"revision": {
"type": "integer"
},
"expiresAt": {
"type": "integer"
}
},
"additionalProperties": false
},
"ExecutionTraceResponse": {
"type": "object",
"required": [
"executionId",
"approval",
"entries",
"chainOk"
],
"properties": {
"executionId": {
"type": "string"
},
"approval": {
"anyOf": [
{
"$ref": "#/$defs/ExecutionApprovalRecord"
},
{
"type": "null"
}
]
},
"entries": {
"type": "array",
"items": {
"$ref": "#/$defs/ExecutionTraceEntry"
}
},
"chainOk": {
"type": "boolean"
},
"receipt": {
"$ref": "receipt.schema.json#/$defs/ExecutionReceipt"
}
},
"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
},
"BindingSummary": {
"type": "object",
"required": [
"providerId",
"accountId",
"displayName",
"status"
],
"properties": {
"providerId": {
"type": "string"
},
"accountId": {
"type": [
"string",
"null"
]
},
"displayName": {
"type": [
"string",
"null"
]
},
"status": {
"type": "string",
"enum": [
"active",
"expired",
"disabled",
"unbound"
]
},
"authKind": {
"type": "string",
"enum": [
"oauth",
"password-exchange",
"apikey"
]
},
"updatedAt": {
"type": "integer"
}
},
"additionalProperties": false
},
"BindingStartResponse": {
"type": "object",
"required": [
"providerId",
"authKind"
],
"properties": {
"providerId": {
"type": "string"
},
"authKind": {
"type": "string",
"enum": [
"oauth",
"password-exchange",
"apikey"
]
},
"authorizationUrl": {
"type": "string"
}
},
"additionalProperties": false
},
"BindingCompleteRequest": {
"type": "object",
"required": [
"accountId"
],
"properties": {
"accountId": {
"type": "string"
},
"password": {
"type": "string"
},
"code": {
"type": "string"
},
"state": {
"type": "string"
}
},
"additionalProperties": false
},
"BindingCompleteResponse": {
"type": "object",
"required": [
"binding"
],
"properties": {
"binding": {
"$ref": "#/$defs/BindingSummary"
}
},
"additionalProperties": false
},
"BindingListResponse": {
"type": "object",
"required": [
"bindings"
],
"properties": {
"bindings": {
"type": "array",
"items": {
"$ref": "#/$defs/BindingSummary"
}
}
},
"additionalProperties": false
},
"BindingDeleteResponse": {
"type": "object",
"required": [
"providerId",
"removed"
],
"properties": {
"providerId": {
"type": "string"
},
"removed": {
"type": "boolean"
}
},
"additionalProperties": false
}
}
}