Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(openapi): type every success response with route-declared zod schemas (#23217)

Arvin Xu48b847e43b8d
diff --git a/packages/openapi/openapi.yml b/packages/openapi/openapi.yml
index 67b13e5b71a..eb37590dbc9 100644
--- a/packages/openapi/openapi.yml
+++ b/packages/openapi/openapi.yml
@@ -2,212 +2,204 @@ openapi: 3.1.0
components:
schemas:
ApiError:
- additionalProperties: false
+ type: object
properties:
error:
type: string
success:
- const: false
type: boolean
+ const: false
timestamp:
- format: date-time
type: string
+ format: date-time
required:
- error
- success
- timestamp
- type: object
- AgentAccount:
additionalProperties: false
+ AgentGroup:
+ type: object
properties:
- accessedAt:
+ createdAt:
+ type: string
format: date-time
+ id:
type: string
- agentId:
+ name:
+ type: string
+ sort:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ updatedAt:
type: string
- capabilities:
- additionalProperties: false
- properties:
- login:
- type:
- - boolean
- - "null"
- receive:
- type: boolean
- send:
- type: boolean
- sign:
- type:
- - boolean
- - "null"
- required:
- - receive
- - send
- type: object
- createdAt:
format: date-time
+ required:
+ - createdAt
+ - id
+ - name
+ - sort
+ - updatedAt
+ additionalProperties: false
+ CreatedAgentGroup:
+ type: object
+ properties:
+ id:
type: string
- credentialHint:
- additionalProperties: true
- type:
- - object
- - "null"
- displayName:
- type:
- - string
- - "null"
- hasCredential:
+ required:
+ - id
+ additionalProperties: false
+ DeletedResource:
+ type: object
+ properties:
+ deleted:
type: boolean
+ const: true
id:
type: string
- identifier:
- type: string
- kind:
- enum:
- - mail
- - wallet
- - service
- - phone
- type: string
- metadata:
- additionalProperties: true
+ required:
+ - deleted
+ - id
+ additionalProperties: false
+ AgentList:
+ type: object
+ properties:
+ agents:
+ type: array
+ items:
+ $ref: "#/components/schemas/Agent"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - agents
+ - total
+ additionalProperties: false
+ Agent:
+ type: object
+ properties:
+ agencyConfig:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ avatar:
type:
- - object
+ - string
- "null"
- provider:
+ chatConfig:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ createdAt:
type: string
- revokedAt:
format: date-time
+ description:
type:
- string
- "null"
- settings:
- additionalProperties: true
- properties:
- wake:
- additionalProperties: true
- properties:
- digestMinutes:
- maximum: 1440
- minimum: 5
- type: integer
- mode:
- enum:
- - on
- - off
- type: string
- wakeSenders:
- items:
- type: string
- type: array
- type: object
- type: object
- status:
- enum:
- - provisioning
- - active
- - suspended
- - revoked
- type: string
- updatedAt:
- format: date-time
- type: string
- userId:
+ id:
type: string
- workspaceId:
+ model:
type:
- string
- "null"
- required:
- - id
- - agentId
- - kind
- - identifier
- - provider
- - status
- - capabilities
- - hasCredential
- - accessedAt
- - createdAt
- - updatedAt
- type: object
- ApiKey:
- additionalProperties: false
- properties:
- createdAt:
- format: date-time
- type: string
- enabled:
+ params:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ personal:
+ type: boolean
+ plugins:
+ type: array
+ items:
+ $ref: "#/components/schemas/AgentPlugin"
+ provider:
type:
- - boolean
+ - string
- "null"
- expiresAt:
- format: date-time
+ slug:
type:
- string
- "null"
- id:
- type: string
- lastUsedAt:
- format: date-time
+ systemRole:
type:
- string
- "null"
- name:
- type: string
- scopes:
- items:
- enum:
- - "*"
- - agent:read
- - agent:write
- - agent:credential:write
- - eval:read
- - eval:write
- - chat:read
- - chat:write
- - model:invoke
- - model:read
- - model:write
- - file:read
- - file:write
- - knowledge:read
- - knowledge:write
- - mcp:read
- - mcp:write
- - usage:read
- - workspace:read
- - workspace:write
- - user:read
- - user:write
- type: string
+ title:
type:
- - array
+ - string
- "null"
updatedAt:
- format: date-time
type: string
+ format: date-time
required:
- - id
- - name
+ - agencyConfig
+ - avatar
+ - chatConfig
- createdAt
+ - description
+ - id
+ - model
+ - params
+ - personal
+ - plugins
+ - provider
+ - slug
+ - systemRole
+ - title
- updatedAt
+ additionalProperties: false
+ AgentPlugin:
type: object
- Agent:
+ properties:
+ identifier:
+ type: string
+ mode:
+ type: string
+ enum:
+ - pinned
+ - auto
+ - disabled
+ required:
+ - identifier
+ - mode
additionalProperties: false
+ AgentDetail:
+ type: object
properties:
+ agencyConfig:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
avatar:
type:
- string
- "null"
chatConfig:
- additionalProperties: true
- type:
- - object
- - "null"
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
createdAt:
- format: date-time
type: string
+ format: date-time
description:
type:
- string
@@ -219,29 +211,18 @@ components:
- string
- "null"
params:
- additionalProperties: true
- type:
- - object
- - "null"
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
personal:
type: boolean
plugins:
type: array
items:
- type: object
- additionalProperties: false
- properties:
- identifier:
- type: string
- mode:
- type: string
- enum:
- - pinned
- - auto
- - disabled
- required:
- - identifier
- - mode
+ $ref: "#/components/schemas/AgentPlugin"
provider:
type:
- string
@@ -259,4031 +240,8942 @@ components:
- string
- "null"
updatedAt:
- format: date-time
type: string
+ format: date-time
+ files:
+ type: array
+ items:
+ $ref: "#/components/schemas/AgentFile"
+ knowledgeBases:
+ type: array
+ items:
+ $ref: "#/components/schemas/AgentKnowledgeBase"
required:
- - id
+ - agencyConfig
+ - avatar
+ - chatConfig
- createdAt
+ - description
+ - id
+ - model
+ - params
+ - personal
+ - plugins
+ - provider
+ - slug
+ - systemRole
+ - title
- updatedAt
- type: object
- AgentGroup:
+ - files
+ - knowledgeBases
additionalProperties: false
+ AgentFile:
+ type: object
properties:
createdAt:
+ type: string
format: date-time
+ enabled:
+ type:
+ - boolean
+ - "null"
+ fileType:
type: string
id:
type: string
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
name:
type: string
- sort:
+ parentId:
+ type:
+ - string
+ - "null"
+ size:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ source:
type:
- - integer
+ - string
- "null"
updatedAt:
+ type: string
format: date-time
+ url:
+ type: string
+ visibility:
type: string
+ enum:
+ - private
+ - public
required:
+ - createdAt
+ - enabled
+ - fileType
- id
+ - metadata
- name
- - createdAt
+ - parentId
+ - size
+ - source
- updatedAt
- type: object
- ChatGroup:
+ - url
+ - visibility
additionalProperties: false
+ AgentKnowledgeBase:
+ type: object
properties:
avatar:
type:
- string
- "null"
- backgroundColor:
- type:
- - string
- - "null"
createdAt:
- format: date-time
type: string
+ format: date-time
description:
type:
- string
- "null"
+ enabled:
+ type:
+ - boolean
+ - "null"
id:
type: string
- members:
- items:
- additionalProperties: false
- properties:
- agentId:
- type: string
- enabled:
- type:
- - boolean
- - "null"
- order:
- type:
- - integer
- - "null"
- role:
- enum:
- - supervisor
- - participant
- - assistant
- - null
- type:
- - string
- - "null"
- required:
- - agentId
- - enabled
- - order
- - role
- type: object
- type: array
- personal:
- type: boolean
- pinned:
+ isPublic:
type:
- boolean
- "null"
- title:
+ name:
+ type: string
+ settings:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ type:
type:
- string
- "null"
updatedAt:
+ type: string
format: date-time
+ visibility:
type: string
+ enum:
+ - private
+ - public
required:
- - id
- - title
- - description
- avatar
- - backgroundColor
- - personal
- - pinned
- - members
- createdAt
+ - description
+ - enabled
+ - id
+ - isPublic
+ - name
+ - settings
+ - type
- updatedAt
- type: object
- ChatResponse:
+ - visibility
additionalProperties: false
+ AgentAccountList:
+ type: object
properties:
- content:
- type: string
- model:
- type:
- - string
- - "null"
- provider:
- type:
- - string
- - "null"
- usage:
- additionalProperties: false
- properties:
- completion_tokens:
- type:
- - integer
- - "null"
- prompt_tokens:
- type:
- - integer
- - "null"
- total_tokens:
- type:
- - integer
- - "null"
- type:
- - object
- - "null"
+ accounts:
+ type: array
+ items:
+ $ref: "#/components/schemas/AgentAccount"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
required:
- - content
- type: object
- EvalRun:
+ - accounts
+ - total
additionalProperties: false
+ AgentAccount:
+ type: object
properties:
- createdAt:
- format: date-time
+ accessedAt:
type: string
- datasetId:
+ format: date-time
+ agentId:
type: string
- id:
+ capabilities:
+ $ref: "#/components/schemas/AgentAccountCapabilities"
+ createdAt:
type: string
- metrics:
- additionalProperties: true
- type:
- - object
- - "null"
- name:
- type:
- - string
- - "null"
- startedAt:
format: date-time
+ credentialHint:
+ anyOf:
+ - type: object
+ properties:
+ expiresAt:
+ type: string
+ masked:
+ type: string
+ rotatedAt:
+ type: string
+ username:
+ type: string
+ - type: "null"
+ displayName:
type:
- string
- "null"
+ hasCredential:
+ type: boolean
+ id:
+ type: string
+ identifier:
+ type: string
+ kind:
+ type: string
+ enum:
+ - mail
+ - wallet
+ - service
+ - phone
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ provider:
+ type: string
+ revokedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ settings:
+ type: object
+ properties:
+ wake:
+ type: object
+ properties:
+ digestMinutes:
+ type: integer
+ minimum: 5
+ maximum: 1440
+ mode:
+ type: string
+ enum:
+ - on
+ - off
+ wakeSenders:
+ type: array
+ items:
+ type: string
status:
+ type: string
enum:
- - idle
- - pending
- - running
- - completed
- - failed
- - aborted
- - external
+ - provisioning
+ - active
+ - suspended
+ - revoked
+ updatedAt:
type: string
- targetAgentId:
+ format: date-time
+ userId:
+ type: string
+ workspaceId:
type:
- string
- "null"
- updatedAt:
- format: date-time
- type: string
required:
+ - accessedAt
+ - agentId
+ - capabilities
+ - createdAt
+ - credentialHint
+ - displayName
+ - hasCredential
- id
- - datasetId
+ - identifier
+ - kind
+ - metadata
+ - provider
+ - revokedAt
+ - settings
- status
- - createdAt
- updatedAt
- type: object
- EvalRunResult:
+ - userId
+ - workspaceId
additionalProperties: false
+ AgentAccountCapabilities:
+ type: object
+ properties:
+ login:
+ type: boolean
+ receive:
+ type: boolean
+ send:
+ type: boolean
+ sign:
+ type: boolean
+ required:
+ - receive
+ - send
+ ApiKey:
+ type: object
properties:
createdAt:
- format: date-time
type: string
- input:
- type: string
- passed:
+ format: date-time
+ enabled:
type:
- boolean
- "null"
- result:
- additionalProperties: true
- type:
- - object
- - "null"
- score:
- type:
- - number
- - "null"
- status:
- type:
- - string
- - "null"
- testCaseId:
+ expiresAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ id:
type: string
- topicId:
+ lastUsedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ name:
type: string
+ scopes:
+ anyOf:
+ - type: array
+ items:
+ type: string
+ enum:
+ - "*"
+ - agent:read
+ - agent:write
+ - agent:credential:write
+ - eval:read
+ - eval:write
+ - chat:read
+ - chat:write
+ - model:invoke
+ - model:read
+ - model:write
+ - file:read
+ - file:write
+ - knowledge:read
+ - knowledge:write
+ - mcp:read
+ - mcp:write
+ - usage:read
+ - workspace:read
+ - workspace:write
+ - user:read
+ - user:write
+ - type: "null"
+ updatedAt:
+ type: string
+ format: date-time
required:
- - testCaseId
- - topicId
- - input
- createdAt
+ - enabled
+ - expiresAt
+ - id
+ - lastUsedAt
+ - name
+ - scopes
+ - updatedAt
+ additionalProperties: false
+ CreatedApiKey:
type: object
- File:
- additionalProperties: true
properties:
createdAt:
- format: date-time
- type: string
- fileType:
- type: string
- id:
type: string
- metadata:
- additionalProperties: true
+ format: date-time
+ enabled:
type:
- - object
+ - boolean
- "null"
- name:
+ expiresAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ id:
type: string
- parentId:
- type:
- - string
- - "null"
- size:
- type: integer
- source:
- type:
- - string
- - "null"
- updatedAt:
- format: date-time
+ lastUsedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ name:
type: string
- url:
+ scopes:
+ anyOf:
+ - type: array
+ items:
+ type: string
+ enum:
+ - "*"
+ - agent:read
+ - agent:write
+ - agent:credential:write
+ - eval:read
+ - eval:write
+ - chat:read
+ - chat:write
+ - model:invoke
+ - model:read
+ - model:write
+ - file:read
+ - file:write
+ - knowledge:read
+ - knowledge:write
+ - mcp:read
+ - mcp:write
+ - usage:read
+ - workspace:read
+ - workspace:write
+ - user:read
+ - user:write
+ - type: "null"
+ updatedAt:
type: string
- visibility:
- enum:
- - private
- - public
+ format: date-time
+ key:
type: string
required:
+ - createdAt
+ - enabled
+ - expiresAt
- id
- - fileType
+ - lastUsedAt
- name
- - size
- - url
- - createdAt
+ - scopes
- updatedAt
+ - key
+ additionalProperties: false
+ ChatResponse:
+ type: object
+ properties:
+ content:
+ type: string
+ model:
+ type: string
+ provider:
+ type: string
+ usage:
+ type: object
+ properties:
+ completion_tokens:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ prompt_tokens:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ total_tokens:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ required:
+ - content
+ - model
+ - provider
+ additionalProperties: false
+ ChatTranslateResponse:
+ type: object
+ properties:
+ translatedText:
+ type: string
+ required:
+ - translatedText
+ additionalProperties: false
+ ChatGenerateReplyResponse:
+ type: object
+ properties:
+ reply:
+ type: string
+ required:
+ - reply
+ additionalProperties: false
+ ChatGroupList:
+ type: object
+ properties:
+ chatGroups:
+ type: array
+ items:
+ $ref: "#/components/schemas/ChatGroup"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - chatGroups
+ - total
+ additionalProperties: false
+ ChatGroup:
type: object
- KnowledgeBase:
- additionalProperties: true
properties:
avatar:
type:
- string
- "null"
+ backgroundColor:
+ type:
+ - string
+ - "null"
createdAt:
- format: date-time
type: string
+ format: date-time
description:
type:
- string
- "null"
id:
type: string
- isPublic:
+ members:
+ type: array
+ items:
+ $ref: "#/components/schemas/ChatGroupMember"
+ personal:
+ type: boolean
+ pinned:
type:
- boolean
- "null"
- name:
- type: string
- settings:
- additionalProperties: true
- type:
- - object
- - "null"
- type:
+ title:
type:
- string
- "null"
updatedAt:
- format: date-time
- type: string
- visibility:
- enum:
- - private
- - public
type: string
+ format: date-time
required:
- - id
- - name
+ - avatar
+ - backgroundColor
- createdAt
+ - description
+ - id
+ - members
+ - personal
+ - pinned
+ - title
- updatedAt
+ additionalProperties: false
+ ChatGroupMember:
type: object
- Message:
- additionalProperties: true
properties:
agentId:
+ type: string
+ enabled:
type:
- - string
- - "null"
- content:
- type:
- - string
+ - boolean
- "null"
+ order:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ role:
+ anyOf:
+ - type: string
+ enum:
+ - supervisor
+ - participant
+ - assistant
+ - type: "null"
+ required:
+ - agentId
+ - enabled
+ - order
+ - role
+ additionalProperties: false
+ EvalRun:
+ type: object
+ properties:
+ config:
+ type: object
+ properties:
+ caseSelection:
+ type: object
+ properties:
+ caseIds:
+ type: array
+ items:
+ type: string
+ mode:
+ type: string
+ enum:
+ - all
+ - include
+ - exclude
+ required:
+ - mode
+ additionalProperties: false
+ k:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ maxConcurrency:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ maxSteps:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ timeout:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ required:
+ - k
+ additionalProperties: false
createdAt:
+ type: string
format: date-time
+ datasetId:
type: string
- error:
- additionalProperties: true
- type:
- - object
- - "null"
- favorite:
- type:
- - boolean
- - "null"
- id:
+ executionMode:
type: string
- metadata:
- additionalProperties: true
- type:
- - object
- - "null"
- model:
+ enum:
+ - internal
+ - external
+ experimentId:
type:
- string
- "null"
- parentId:
+ id:
+ type: string
+ metrics:
+ anyOf:
+ - $ref: "#/components/schemas/EvalRunMetrics"
+ - type: "null"
+ name:
type:
- string
- "null"
- provider:
+ parentRunId:
type:
- string
- "null"
- reasoning:
- additionalProperties: true
- type:
- - object
- - "null"
- role:
+ startedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ status:
type: string
- search:
- additionalProperties: true
- type:
- - object
- - "null"
- threadId:
- type:
- - string
- - "null"
- tools:
- additionalProperties: true
- type:
- - object
- - "null"
- topicId:
+ enum:
+ - idle
+ - pending
+ - running
+ - completed
+ - failed
+ - aborted
+ - external
+ targetAgentId:
type:
- string
- "null"
updatedAt:
- format: date-time
type: string
- usage:
- additionalProperties: true
- type:
- - object
- - "null"
+ format: date-time
required:
- - id
- - role
+ - config
- createdAt
+ - datasetId
+ - executionMode
+ - experimentId
+ - id
+ - metrics
+ - name
+ - parentRunId
+ - startedAt
+ - status
+ - targetAgentId
- updatedAt
- type: object
- McpServer:
additionalProperties: false
+ EvalRunMetrics:
+ type: object
+ properties:
+ averageScore:
+ type: number
+ completedCases:
+ type: number
+ cost:
+ type: number
+ duration:
+ type: number
+ errorCases:
+ type: number
+ externalCases:
+ type: number
+ failedCases:
+ type: number
+ judgeErrorCases:
+ type: number
+ llmCalls:
+ type: number
+ passAllAt:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: number
+ passAllK:
+ type: number
+ passAnyAt:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: number
+ passAtK:
+ type: number
+ passedCases:
+ type: number
+ passRate:
+ type: number
+ perCaseCost:
+ type: number
+ perCaseLlmCalls:
+ type: number
+ perCaseSteps:
+ type: number
+ perCaseTokens:
+ type: number
+ perCaseToolCalls:
+ type: number
+ rubricScores:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: number
+ steps:
+ type: number
+ timeoutCases:
+ type: number
+ tokens:
+ type: number
+ toolCalls:
+ type: number
+ totalCases:
+ type: number
+ totalCost:
+ type: number
+ totalDuration:
+ type: number
+ totalTokens:
+ type: number
+ EvalRunTopic:
+ type: object
properties:
createdAt:
+ type: string
format: date-time
+ evalResult:
+ anyOf:
+ - $ref: "#/components/schemas/EvalStoredResult"
+ - type: "null"
+ input:
type: string
- description:
+ passed:
type:
- - string
+ - boolean
- "null"
- hasCredentials:
- type: boolean
- id:
- format: uuid
- type: string
- identifier:
+ runId:
type: string
- isEnabled:
+ score:
+ type:
+ - number
+ - "null"
+ status:
+ anyOf:
+ - type: string
+ enum:
+ - pending
+ - running
+ - passed
+ - failed
+ - error
+ - timeout
+ - external
+ - completed
+ - judge_error
+ - type: "null"
+ testCaseId:
+ type: string
+ topicId:
+ type: string
+ required:
+ - createdAt
+ - evalResult
+ - input
+ - passed
+ - runId
+ - score
+ - status
+ - testCaseId
+ - topicId
+ additionalProperties: false
+ EvalStoredResult:
+ type: object
+ properties:
+ awaitingExternalEval:
type: boolean
- name:
+ completionReason:
type: string
- serverUrl:
- format: uri
+ cost:
+ type: number
+ duration:
+ type: number
+ error:
type: string
- status:
- enum:
- - connected
- - disconnected
- - error
+ externalResult:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ externalThreadResults:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ extractedAnswer:
type: string
- tools:
+ llmCalls:
+ type: number
+ passAllK:
+ type: boolean
+ passAtK:
+ type: boolean
+ rubricScores:
+ type: array
items:
- additionalProperties: false
+ $ref: "#/components/schemas/EvalRubricScore"
+ steps:
+ type: number
+ threads:
+ type: array
+ items:
+ type: object
properties:
- description:
- type:
- - string
- - "null"
- id:
- format: uuid
+ completionReason:
type: string
- inputSchema:
- additionalProperties: true
- type:
- - object
- - "null"
- name:
+ cost:
+ type: number
+ duration:
+ type: number
+ error:
+ type: string
+ llmCalls:
+ type: number
+ passed:
+ type: boolean
+ rubricScores:
+ type: array
+ items:
+ $ref: "#/components/schemas/EvalRubricScore"
+ score:
+ type: number
+ status:
type: string
- permission:
enum:
- - auto
- - needs_approval
- - disabled
+ - error
+ - external
+ - failed
+ - passed
+ - running
+ - timeout
+ - completed
+ - judge_error
+ steps:
+ type: number
+ threadId:
+ type: string
+ tokens:
+ type: number
+ toolCalls:
+ type: number
+ errorPhase:
+ type: string
+ const: judge
+ executionId:
+ type: string
+ judgeError:
+ type: string
+ judges:
+ type: array
+ items:
+ type: object
+ properties:
+ model:
+ type: string
+ provider:
+ type: string
+ required:
+ - model
+ - provider
+ additionalProperties: false
+ memorySnapshot:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ operationId:
type: string
required:
- - id
- - name
- - permission
- type: object
+ - threadId
+ tokens:
+ type: number
+ toolCalls:
+ type: number
+ totalCost:
+ type: number
+ totalDuration:
+ type: number
+ totalTokens:
+ type: number
+ dispatchedAt:
+ type: string
+ errorDetail: {}
+ errorPhase:
+ type: string
+ const: judge
+ executionId:
+ type: string
+ judgeError:
+ type: string
+ judges:
type: array
- updatedAt:
- format: date-time
+ items:
+ type: object
+ properties:
+ model:
+ type: string
+ provider:
+ type: string
+ required:
+ - model
+ - provider
+ additionalProperties: false
+ memorySnapshot:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ operationId:
type: string
- required:
- - id
- - identifier
- - name
- - serverUrl
- - status
- - isEnabled
- - hasCredentials
- - tools
- - createdAt
- - updatedAt
+ EvalRubricScore:
type: object
- Model:
+ properties:
+ reason:
+ type: string
+ rubricId:
+ type: string
+ score:
+ type: number
+ verdicts:
+ type: array
+ items:
+ type: object
+ properties:
+ reason:
+ type: string
+ rule:
+ type: string
+ verdict:
+ type: string
+ enum:
+ - satisfied
+ - unverifiable
+ - violated
+ required:
+ - rule
+ - verdict
+ additionalProperties: false
+ required:
+ - rubricId
+ - score
additionalProperties: false
+ EvalRunResult:
+ type: object
properties:
- abilities:
- additionalProperties: true
- type:
- - object
- - "null"
- config:
- additionalProperties: true
- type:
- - object
- - "null"
- contextWindowTokens:
- type:
- - integer
- - "null"
createdAt:
+ type: string
format: date-time
+ input:
type: string
- description:
- type:
- - string
- - "null"
- displayName:
- type:
- - string
- - "null"
- enabled:
+ passed:
type:
- boolean
- "null"
- id:
- type: string
- organization:
- type:
- - string
- - "null"
- parameters:
- additionalProperties: true
- type:
- - object
- - "null"
- pricing:
- additionalProperties: true
- type:
- - object
- - "null"
- providerId:
- type: string
- releasedAt:
- type:
- - string
- - "null"
- settings:
- additionalProperties: true
- type:
- - object
- - "null"
- sort:
- type:
- - integer
- - "null"
- source:
+ result:
+ anyOf:
+ - $ref: "#/components/schemas/EvalCaseResult"
+ - type: "null"
+ score:
type:
- - string
+ - number
- "null"
- type:
+ status:
+ anyOf:
+ - type: string
+ enum:
+ - pending
+ - running
+ - passed
+ - failed
+ - error
+ - timeout
+ - external
+ - completed
+ - judge_error
+ - type: "null"
+ testCaseId:
type: string
- updatedAt:
- format: date-time
+ topicId:
type: string
required:
- - id
- - providerId
- - type
- createdAt
- - updatedAt
- type: object
- Permission:
+ - input
+ - passed
+ - result
+ - score
+ - status
+ - testCaseId
+ - topicId
additionalProperties: false
+ EvalCaseResult:
+ type: object
properties:
- category:
+ awaitingExternalEval:
+ type: boolean
+ completionReason:
type: string
- code:
+ cost:
+ type: number
+ duration:
+ type: number
+ error:
type: string
- createdAt:
- format: date-time
+ externalResult:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ externalThreadResults:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ extractedAnswer:
type: string
- description:
- type:
- - string
- - "null"
- id:
+ llmCalls:
+ type: number
+ passAllK:
+ type: boolean
+ passAtK:
+ type: boolean
+ rubricScores:
+ type: array
+ items:
+ $ref: "#/components/schemas/EvalRubricScore"
+ steps:
+ type: number
+ threads:
+ type: array
+ items:
+ $ref: "#/components/schemas/EvalThreadResult"
+ tokens:
+ type: number
+ toolCalls:
+ type: number
+ totalCost:
+ type: number
+ totalDuration:
+ type: number
+ totalTokens:
+ type: number
+ additionalProperties: false
+ EvalThreadResult:
+ type: object
+ properties:
+ completionReason:
type: string
- isActive:
- type:
- - boolean
- - "null"
- name:
+ cost:
+ type: number
+ duration:
+ type: number
+ error:
type: string
- updatedAt:
- format: date-time
+ llmCalls:
+ type: number
+ passed:
+ type: boolean
+ rubricScores:
+ type: array
+ items:
+ $ref: "#/components/schemas/EvalRubricScore"
+ score:
+ type: number
+ status:
type: string
+ enum:
+ - error
+ - external
+ - failed
+ - passed
+ - running
+ - timeout
+ - completed
+ - judge_error
+ steps:
+ type: number
+ threadId:
+ type: string
+ tokens:
+ type: number
+ toolCalls:
+ type: number
required:
- - id
- - code
- - name
- - category
- - createdAt
- - updatedAt
- type: object
- Provider:
+ - threadId
additionalProperties: false
+ EvalBenchmark:
+ type: object
properties:
- checkModel:
- type:
- - string
- - "null"
- config:
- additionalProperties: true
- type:
- - object
- - "null"
createdAt:
- format: date-time
type: string
+ format: date-time
description:
type:
- string
- "null"
- enabled:
- type:
- - boolean
- - "null"
- fetchOnClient:
- type:
- - boolean
- - "null"
id:
type: string
- logo:
- type:
- - string
- - "null"
+ identifier:
+ type: string
+ isSystem:
+ type: boolean
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
name:
+ type: string
+ referenceUrl:
type:
- string
- "null"
- settings:
- additionalProperties: true
- type:
- - object
- - "null"
- sort:
- type:
- - integer
- - "null"
- source:
- type:
- - string
- - "null"
+ rubrics:
+ type: array
+ items:
+ $ref: "#/components/schemas/EvalBenchmarkRubric"
updatedAt:
- format: date-time
type: string
+ format: date-time
required:
- - id
- createdAt
+ - description
+ - id
+ - identifier
+ - isSystem
+ - metadata
+ - name
+ - referenceUrl
+ - rubrics
- updatedAt
- type: object
- Role:
additionalProperties: false
+ EvalBenchmarkRubric:
+ type: object
properties:
- createdAt:
- format: date-time
- type: string
- description:
- type:
- - string
- - "null"
- displayName:
- type: string
+ config:
+ anyOf:
+ - type: object
+ properties:
+ value:
+ type: string
+ threshold:
+ type: number
+ required:
+ - value
+ additionalProperties: false
+ - type: object
+ properties:
+ value:
+ type: number
+ tolerance:
+ type: number
+ required:
+ - value
+ - type: object
+ properties:
+ pattern:
+ type: string
+ required:
+ - pattern
+ - type: object
+ properties:
+ code:
+ type: string
+ required:
+ - code
+ - type: object
+ properties:
+ criteria:
+ type: string
+ model:
+ type: string
+ provider:
+ type: string
+ systemRole:
+ type: string
+ required:
+ - criteria
+ - type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ caseSensitive:
+ type: boolean
+ required:
+ - values
+ additionalProperties: false
+ - type: object
+ properties:
+ schema:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ required:
+ - schema
+ additionalProperties: false
+ - type: object
+ properties:
+ extractor:
+ oneOf:
+ - type: object
+ properties:
+ type:
+ type: string
+ const: regex
+ pattern:
+ type: string
+ group:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - type
+ - pattern
+ additionalProperties: false
+ - type: object
+ properties:
+ type:
+ type: string
+ const: delimiter
+ delimiter:
+ type: string
+ position:
+ type: string
+ enum:
+ - first
+ - last
+ required:
+ - type
+ - delimiter
+ additionalProperties: false
+ - type: object
+ properties:
+ type:
+ type: string
+ const: last-line
+ trim:
+ type: boolean
+ required:
+ - type
+ additionalProperties: false
+ - type: object
+ properties:
+ type:
+ type: string
+ const: choice-index
+ labels:
+ type: array
+ items:
+ type: string
+ pattern:
+ type: string
+ required:
+ - type
+ additionalProperties: false
+ innerMatcher:
+ type: string
+ enum:
+ - equals
+ - contains
+ - regex
+ - starts-with
+ - ends-with
+ - any-of
+ - numeric
+ - extract-match
+ - json-schema
+ - javascript
+ - python
+ - llm-rubric
+ - factuality
+ - answer-relevance
+ - similar
+ - levenshtein
+ - rubric
+ - external
+ required:
+ - extractor
+ additionalProperties: false
+ extractor:
+ oneOf:
+ - type: object
+ properties:
+ type:
+ type: string
+ const: regex
+ pattern:
+ type: string
+ group:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - type
+ - pattern
+ additionalProperties: false
+ - type: object
+ properties:
+ type:
+ type: string
+ const: delimiter
+ delimiter:
+ type: string
+ position:
+ type: string
+ enum:
+ - first
+ - last
+ required:
+ - type
+ - delimiter
+ additionalProperties: false
+ - type: object
+ properties:
+ type:
+ type: string
+ const: last-line
+ trim:
+ type: boolean
+ required:
+ - type
+ additionalProperties: false
+ - type: object
+ properties:
+ type:
+ type: string
+ const: choice-index
+ labels:
+ type: array
+ items:
+ type: string
+ pattern:
+ type: string
+ required:
+ - type
+ additionalProperties: false
id:
type: string
- isActive:
- type:
- - boolean
- - "null"
- isSystem:
- type:
- - boolean
- - "null"
name:
type: string
- updatedAt:
- format: date-time
+ threshold:
+ type: number
+ type:
type: string
+ enum:
+ - equals
+ - contains
+ - regex
+ - starts-with
+ - ends-with
+ - any-of
+ - numeric
+ - extract-match
+ - json-schema
+ - javascript
+ - python
+ - llm-rubric
+ - rule-checklist
+ - factuality
+ - answer-relevance
+ - similar
+ - levenshtein
+ - rubric
+ - external
+ weight:
+ type: number
required:
+ - config
- id
- name
- - displayName
- - createdAt
- - updatedAt
+ - type
+ - weight
+ additionalProperties: false
+ EvalDataset:
type: object
- Topic:
- additionalProperties: true
properties:
- agentId:
- type:
- - string
- - "null"
- completedAt:
- format: date-time
- type:
- - string
- - "null"
- content:
+ benchmarkId:
type:
- string
- "null"
- cost:
- additionalProperties: true
- type:
- - object
- - "null"
createdAt:
- format: date-time
type: string
+ format: date-time
description:
type:
- string
- "null"
- favorite:
- type:
- - boolean
- - "null"
- groupId:
- type:
- - string
- - "null"
- historySummary:
- type:
- - string
- - "null"
+ evalConfig:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ evalMode:
+ anyOf:
+ - type: string
+ enum:
+ - equals
+ - contains
+ - regex
+ - starts-with
+ - ends-with
+ - any-of
+ - numeric
+ - extract-match
+ - json-schema
+ - javascript
+ - python
+ - llm-rubric
+ - rule-checklist
+ - factuality
+ - answer-relevance
+ - similar
+ - levenshtein
+ - rubric
+ - external
+ - type: "null"
id:
type: string
+ identifier:
+ type: string
metadata:
- additionalProperties: true
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ name:
+ type: string
+ sourceExperimentId:
type:
- - object
- - "null"
- mode:
- type:
- - string
- - "null"
- model:
- type:
- - string
- - "null"
- provider:
- type:
- - string
- - "null"
- sessionId:
- type:
- - string
- - "null"
- status:
- type:
- - string
- - "null"
- title:
- type:
- - string
- - "null"
- totalCost:
- type:
- - number
- - "null"
- totalInputTokens:
- type:
- - integer
- - "null"
- totalOutputTokens:
- type:
- - integer
- - "null"
- totalTokens:
- type:
- - integer
- - "null"
- trigger:
- type:
- - string
+ - string
- "null"
+ testCaseCount:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
updatedAt:
- format: date-time
type: string
- usage:
- additionalProperties: true
- type:
- - object
- - "null"
+ format: date-time
required:
- - id
+ - benchmarkId
- createdAt
+ - description
+ - evalConfig
+ - evalMode
+ - id
+ - identifier
+ - metadata
+ - name
+ - sourceExperimentId
+ - testCaseCount
- updatedAt
+ additionalProperties: false
+ EvalTestCase:
type: object
- User:
- additionalProperties: true
properties:
- avatar:
- type:
- - string
- - "null"
+ caseId:
+ type: string
+ category:
+ type: string
+ choices:
+ type: array
+ items:
+ type: string
+ content:
+ type: object
+ properties:
+ category:
+ type: string
+ choices:
+ type: array
+ items:
+ type: string
+ environment:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ expected:
+ type: string
+ input:
+ type: string
+ messages:
+ type: array
+ items:
+ type: object
+ properties:
+ content:
+ type: string
+ role:
+ type: string
+ enum:
+ - user
+ - assistant
+ - system
+ - tool
+ id:
+ type: string
+ minLength: 1
+ maxLength: 128
+ parentId:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 128
+ - type: "null"
+ model:
+ type: string
+ provider:
+ type: string
+ createdAt:
+ type:
+ - string
+ - number
+ updatedAt:
+ type:
+ - string
+ - number
+ tools:
+ type: array
+ items:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ tool_call_id:
+ type: string
+ metadata:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ reasoning:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ plugin:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ pluginState:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ pluginError:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ pluginIntervention:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ error:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ search:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ required:
+ - content
+ - role
+ required:
+ - input
createdAt:
+ type: string
format: date-time
+ datasetId:
+ type: string
+ environment:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ evalConfig:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ evalMode:
+ anyOf:
+ - type: string
+ enum:
+ - equals
+ - contains
+ - regex
+ - starts-with
+ - ends-with
+ - any-of
+ - numeric
+ - extract-match
+ - json-schema
+ - javascript
+ - python
+ - llm-rubric
+ - rule-checklist
+ - factuality
+ - answer-relevance
+ - similar
+ - levenshtein
+ - rubric
+ - external
+ - type: "null"
+ expected:
type: string
- email:
- type:
- - string
- - "null"
- firstName:
- type:
- - string
- - "null"
- fullName:
- type:
- - string
- - "null"
id:
type: string
- isOnboarded:
- type:
- - boolean
- - "null"
- lastName:
- type:
- - string
- - "null"
- phone:
- type:
- - string
- - "null"
+ input:
+ type: string
+ messages:
+ type: array
+ items:
+ type: object
+ properties:
+ content:
+ type: string
+ role:
+ type: string
+ enum:
+ - user
+ - assistant
+ - system
+ - tool
+ id:
+ type: string
+ minLength: 1
+ maxLength: 128
+ parentId:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 128
+ - type: "null"
+ model:
+ type: string
+ provider:
+ type: string
+ createdAt:
+ type:
+ - string
+ - number
+ updatedAt:
+ type:
+ - string
+ - number
+ tools:
+ type: array
+ items:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ tool_call_id:
+ type: string
+ metadata:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ reasoning:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ plugin:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ pluginState:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ pluginError:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ pluginIntervention:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ error:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ search:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ required:
+ - content
+ - role
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ sortOrder:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
updatedAt:
- format: date-time
type: string
- username:
- type:
- - string
- - "null"
+ format: date-time
required:
- - id
+ - content
- createdAt
+ - datasetId
+ - evalConfig
+ - evalMode
+ - id
+ - input
+ - metadata
+ - sortOrder
- updatedAt
+ additionalProperties: false
+ EvalRetryErrors:
type: object
- Usage:
+ properties:
+ retryCount:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ runId:
+ type: string
+ required:
+ - retryCount
+ - runId
additionalProperties: false
+ EvalReportResult:
+ type: object
properties:
- available:
+ idempotent:
type: boolean
- currency:
- const: USD
+ reportedThreads:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ runId:
type: string
- daily:
+ success:
+ type: boolean
+ const: true
+ threadId:
+ type: string
+ topicFinalized:
+ type: boolean
+ topicId:
+ type: string
+ totalThreads:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ runStatus:
+ type: string
+ enum:
+ - idle
+ - pending
+ - running
+ - completed
+ - failed
+ - aborted
+ - external
+ required:
+ - idempotent
+ - reportedThreads
+ - runId
+ - success
+ - topicFinalized
+ - topicId
+ - totalThreads
+ - runStatus
+ additionalProperties: false
+ EvalBatchReportResult:
+ type: object
+ properties:
+ items:
+ type: array
items:
- additionalProperties: false
- properties:
- date:
- type: string
- value:
- type: number
- required:
- - date
- - value
- type: object
+ $ref: "#/components/schemas/EvalReportReceipt"
+ runId:
+ type: string
+ runStatus:
+ type: string
+ enum:
+ - idle
+ - pending
+ - running
+ - completed
+ - failed
+ - aborted
+ - external
+ success:
+ type: boolean
+ const: true
+ required:
+ - items
+ - runId
+ - runStatus
+ - success
+ additionalProperties: false
+ EvalReportReceipt:
+ type: object
+ properties:
+ idempotent:
+ type: boolean
+ reportedThreads:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ runId:
+ type: string
+ success:
+ type: boolean
+ const: true
+ threadId:
+ type: string
+ topicFinalized:
+ type: boolean
+ topicId:
+ type: string
+ totalThreads:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - idempotent
+ - reportedThreads
+ - runId
+ - success
+ - topicFinalized
+ - topicId
+ - totalThreads
+ additionalProperties: false
+ InstalledPluginList:
+ type: object
+ properties:
+ plugins:
type: array
- period:
- additionalProperties: false
- properties:
- since:
- format: date-time
- type: string
- until:
- format: date-time
- type: string
- required:
- - since
- - until
- type: object
- quota:
- additionalProperties: false
- properties:
- limit:
- type:
- - number
- - "null"
- remaining:
- type:
- - number
- - "null"
- resetsAt:
- format: date-time
- type:
- - string
- - "null"
- source:
- enum:
- - personal
- - workspace_pool
- - member_budget
- type: string
- used:
- type: number
- usedRatio:
- type:
- - number
- - "null"
- required:
- - limit
- - remaining
- - resetsAt
- - source
- - used
- - usedRatio
+ items:
+ $ref: "#/components/schemas/InstalledPlugin"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - plugins
+ - total
+ additionalProperties: false
+ InstalledPlugin:
+ type: object
+ properties:
+ createdAt:
+ type: string
+ format: date-time
+ identifier:
+ type: string
+ type:
+ type: string
+ enum:
+ - plugin
+ - customPlugin
+ updatedAt:
+ type: string
+ format: date-time
+ required:
+ - createdAt
+ - identifier
+ - type
+ - updatedAt
+ additionalProperties: false
+ FileList:
+ type: object
+ properties:
+ files:
+ type: array
+ items:
+ $ref: "#/components/schemas/FileListItem"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ totalSize:
+ type: string
+ required:
+ - files
+ - total
+ - totalSize
+ additionalProperties: false
+ FileListItem:
+ type: object
+ properties:
+ createdAt:
+ type: string
+ format: date-time
+ fileType:
+ type: string
+ id:
+ type: string
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ name:
+ type: string
+ parentId:
type:
- - object
+ - string
- "null"
- remainingBalance:
+ size:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ source:
type:
- - number
+ - string
- "null"
- scope:
- enum:
- - personal
- - workspace
+ updatedAt:
type: string
- spent:
- type: number
- usageByType:
+ format: date-time
+ url:
+ type: string
+ visibility:
+ type: string
+ enum:
+ - private
+ - public
+ chunking:
+ anyOf:
+ - $ref: "#/components/schemas/FileAsyncTask"
+ - type: "null"
+ embedding:
+ anyOf:
+ - $ref: "#/components/schemas/FileAsyncTask"
+ - type: "null"
+ knowledgeBases:
+ type: array
items:
- additionalProperties: false
- properties:
- count:
- type:
- - integer
- - "null"
- spend:
- type: number
- type:
- type: string
- required:
- - count
- - spend
- - type
- type: object
+ $ref: "#/components/schemas/FileKnowledgeBaseRef"
+ users:
type: array
+ items:
+ $ref: "#/components/schemas/FileUser"
required:
- - available
- - currency
- - daily
- - period
- - quota
- - remainingBalance
- - scope
- - spent
- - usageByType
+ - createdAt
+ - fileType
+ - id
+ - metadata
+ - name
+ - parentId
+ - size
+ - source
+ - updatedAt
+ - url
+ - visibility
+ - chunking
+ - embedding
+ - knowledgeBases
+ - users
+ additionalProperties: false
+ FileAsyncTask:
type: object
- securitySchemes:
- bearerAuth:
- bearerFormat: API Key (sk-lh-...) or OIDC JWT
- scheme: bearer
- type: http
-info:
- title: LobeHub API
- description: LobeHub platform REST API. Generated from `packages/openapi` routes
- — do not edit openapi.yml by hand; run `bun generate:openapi` instead.
- version: 1.0.0
-security:
- - bearerAuth: []
-servers:
- - description: LobeHub Cloud
- url: https://app.lobehub.com
-paths:
- /api/v1/health:
- get:
- operationId: getApiV1Health
- summary: Health check
- tags:
- - health
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- service:
- type: string
- status:
- const: ok
- type: string
- timestamp:
- format: date-time
- type: string
- required:
- - service
- - status
- - timestamp
- type: object
- description: Successful response
- "400":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Invalid request
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- /api/v1/agent-groups:
- get:
- operationId: getApiV1AgentGroups
- summary: Get agent group list
- tags:
- - agent-groups
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- items:
- $ref: "#/components/schemas/AgentGroup"
- type: array
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Invalid request
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- post:
- operationId: postApiV1AgentGroups
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
+ properties:
+ count:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ error:
+ anyOf:
+ - $ref: "#/components/schemas/AsyncTaskError"
+ - type: "null"
+ id:
+ type: string
+ status:
+ anyOf:
+ - type: string
+ enum:
+ - error
+ - pending
+ - processing
+ - success
+ - type: "null"
+ type:
+ type: string
+ enum:
+ - chunk
+ - embedding
+ required:
+ - error
+ - status
+ additionalProperties: false
+ AsyncTaskError:
+ type: object
+ properties:
+ body:
+ anyOf:
+ - type: string
+ - type: object
properties:
- name:
+ detail:
type: string
- minLength: 1
- sort:
- type:
- - number
- - "null"
+ retryAt:
+ type: string
+ format: date-time
required:
- - name
- responses:
- "201":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- additionalProperties: false
- properties:
- id:
- type: string
- required:
- - id
- type: object
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - agent-groups
- /api/v1/agent-groups/{id}:
- get:
- operationId: getApiV1AgentGroupsById
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $ref: "#/components/schemas/AgentGroup"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - agent-groups
- patch:
- operationId: patchApiV1AgentGroupsById
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
- requestBody:
- required: true
+ - detail
+ name:
+ type: string
+ required:
+ - body
+ - name
+ FileKnowledgeBaseRef:
+ type: object
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ description:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ name:
+ type: string
+ required:
+ - avatar
+ - description
+ - id
+ - name
+ additionalProperties: false
+ FileUser:
+ type: object
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ email:
+ type:
+ - string
+ - "null"
+ fullName:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ username:
+ type:
+ - string
+ - "null"
+ required:
+ - avatar
+ - email
+ - fullName
+ - id
+ - username
+ additionalProperties: false
+ FileDetail:
+ type: object
+ properties:
+ file:
+ $ref: "#/components/schemas/File"
+ parsed:
+ $ref: "#/components/schemas/FileParseResult"
+ required:
+ - file
+ additionalProperties: false
+ File:
+ type: object
+ properties:
+ createdAt:
+ type: string
+ format: date-time
+ fileType:
+ type: string
+ id:
+ type: string
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ name:
+ type: string
+ parentId:
+ type:
+ - string
+ - "null"
+ size:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ source:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ type: string
+ format: date-time
+ url:
+ type: string
+ visibility:
+ type: string
+ enum:
+ - private
+ - public
+ required:
+ - createdAt
+ - fileType
+ - id
+ - metadata
+ - name
+ - parentId
+ - size
+ - source
+ - updatedAt
+ - url
+ - visibility
+ additionalProperties: false
+ FileParseResult:
+ type: object
+ properties:
content:
- application/json:
- schema:
- type: object
- properties:
- name:
- anyOf:
- - type: string
- minLength: 1
- - type: "null"
- sort:
- type:
- - number
- - "null"
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $ref: "#/components/schemas/AgentGroup"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - agent-groups
- delete:
- operationId: deleteApiV1AgentGroupsById
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- additionalProperties: true
- type:
- - object
- - "null"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - agent-groups
- /api/v1/agents:
- get:
- operationId: getApiV1Agents
- parameters:
- - in: query
- name: keyword
- schema:
- type: string
- - in: query
- name: page
- schema:
- type: string
- - in: query
- name: pageSize
- schema:
- type: string
- - in: query
- name: personal
- schema:
- type: string
- enum:
- - "true"
- - "false"
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- additionalProperties: true
- properties:
- agents:
- items:
- $ref: "#/components/schemas/Agent"
- type: array
- total:
- minimum: 0
- type: integer
- required:
- - agents
- type: object
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - agents
- post:
- operationId: postApiV1Agents
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- agencyConfig:
- anyOf:
- - type: object
- properties:
- enableGraphMode:
- type:
- - boolean
- - "null"
- graph:
- anyOf:
- - type: object
- properties:
- description:
- type: string
- fields:
- type: object
- propertyNames:
- type: string
- additionalProperties:
- type: object
- properties:
- desc:
- type: string
- minLength: 1
- schema:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- required:
- - desc
- - schema
- maxInstructionCount:
- type: integer
- exclusiveMinimum: 0
- maximum: 9007199254740991
- name:
- type: string
- minLength: 1
- nodes:
- type: object
- propertyNames:
- type: string
- additionalProperties:
- oneOf:
- - type: object
- properties:
- allowedToolApiNames:
- type: array
- items:
- type: string
- minLength: 1
- maxAgentSteps:
- type: integer
- exclusiveMinimum: 0
- maximum: 9007199254740991
- type:
- type: string
- const: agent
- required:
- - type
- - type: object
- properties:
- type:
- type: string
- const: llm
- required:
- - type
- terminal:
- type: string
- minLength: 1
- edges:
- type: array
- items:
- type: object
- properties:
- condition:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- from:
- type: string
- input:
- type: object
- properties:
- fields:
- type: array
- items:
- type: object
- properties:
- desc:
- type: string
- minLength: 1
- field:
- type: string
- minLength: 1
- required:
- type: boolean
- from:
- type: string
- minLength: 1
- required:
- - field
- - from
- output:
- type: object
- properties:
- fields:
- type: array
- items:
- type: object
- properties:
- desc:
- type: string
- minLength: 1
- field:
- type: string
- minLength: 1
- required:
- type: boolean
- required:
- - field
- instruction:
- type: string
- minLength: 1
- instruction:
- type: string
- minLength: 1
- maxTraversals:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- to:
- type: string
- required:
- - from
- - instruction
- - to
- required:
- - fields
- - name
- - nodes
- - terminal
- - edges
- - type: "null"
- - type: "null"
- avatar:
- type:
- - string
- - "null"
- chatConfig:
- anyOf:
- - type: object
- properties:
- disableContextCaching:
- type:
- - boolean
- - "null"
- displayMode:
- anyOf:
- - type: string
- enum:
- - chat
- - docs
- - type: "null"
- enableCompressHistory:
- type:
- - boolean
- - "null"
- enableHistoryCount:
- type:
- - boolean
- - "null"
- enableMaxTokens:
- type:
- - boolean
- - "null"
- enableReasoning:
- type:
- - boolean
- - "null"
- enableReasoningEffort:
- type:
- - boolean
- - "null"
- historyCount:
- type:
- - number
- - "null"
- reasoningBudgetToken:
- type:
- - number
- - "null"
- reasoningEffort:
- anyOf:
- - type: string
- enum:
- - low
- - medium
- - high
- - type: "null"
- searchFCModel:
- type:
- - string
- - "null"
- searchMode:
- anyOf:
- - type: string
- enum:
- - disabled
- - enabled
- - type: "null"
- useModelBuiltinSearch:
- type:
- - boolean
- - "null"
- - type: "null"
- description:
- type:
- - string
- - "null"
- model:
- type:
- - string
- - "null"
- plugins:
- maxItems: 100
- type: array
- items:
- type: object
- properties:
- identifier:
- type: string
- minLength: 1
- maxLength: 255
- mode:
- type: string
- enum:
- - pinned
- - auto
- - disabled
- required:
- - identifier
- additionalProperties: false
- params:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- personal:
- type: boolean
- provider:
- type:
- - string
- - "null"
- systemRole:
- type:
- - string
- - "null"
- title:
- type: string
- minLength: 1
- required:
- - title
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $ref: "#/components/schemas/Agent"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - agents
- /api/v1/agents/{id}:
- get:
- operationId: getApiV1AgentsById
- parameters:
- - in: path
- name: id
- schema:
+ type:
+ - string
+ - "null"
+ error:
+ type: string
+ fileId:
+ type: string
+ fileType:
+ type: string
+ metadata:
+ type: object
+ properties:
+ pages:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ title:
+ type: string
+ totalCharCount:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ totalLineCount:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ required:
+ - pages
+ additionalProperties: false
+ name:
+ type: string
+ parseStatus:
+ type: string
+ enum:
+ - completed
+ - failed
+ parsedAt:
+ type: string
+ format: date-time
+ required:
+ - fileId
+ - fileType
+ - name
+ - parseStatus
+ additionalProperties: false
+ FileUrl:
+ type: object
+ properties:
+ expiresAt:
+ type: string
+ format: date-time
+ expiresIn:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ fileId:
+ type: string
+ name:
+ type: string
+ url:
+ type: string
+ required:
+ - expiresAt
+ - expiresIn
+ - fileId
+ - name
+ - url
+ additionalProperties: false
+ FileChunkTask:
+ type: object
+ properties:
+ chunkTaskId:
+ type:
+ - string
+ - "null"
+ embeddingTaskId:
+ type:
+ - string
+ - "null"
+ fileId:
+ type: string
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ required:
+ - chunkTaskId
+ - embeddingTaskId
+ - fileId
+ - message
+ - success
+ additionalProperties: false
+ FileChunkStatus:
+ type: object
+ properties:
+ chunkCount:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ chunkingError:
+ anyOf:
+ - $ref: "#/components/schemas/AsyncTaskError"
+ - type: "null"
+ chunkingStatus:
+ anyOf:
+ - type: string
+ enum:
+ - error
+ - pending
+ - processing
+ - success
+ - type: "null"
+ embeddingError:
+ anyOf:
+ - $ref: "#/components/schemas/AsyncTaskError"
+ - type: "null"
+ embeddingStatus:
+ anyOf:
+ - type: string
+ enum:
+ - error
+ - pending
+ - processing
+ - success
+ - type: "null"
+ finishEmbedding:
+ type: boolean
+ required:
+ - chunkCount
+ - chunkingError
+ - chunkingStatus
+ - embeddingError
+ - embeddingStatus
+ - finishEmbedding
+ additionalProperties: false
+ BatchFileUploadResult:
+ type: object
+ properties:
+ failed:
+ type: array
+ items:
+ type: object
+ properties:
+ error:
+ type: string
+ name:
+ type: string
+ required:
+ - error
+ - name
+ additionalProperties: false
+ successful:
+ type: array
+ items:
+ $ref: "#/components/schemas/FileDetail"
+ summary:
+ type: object
+ properties:
+ failed:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ successful:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - failed
+ - successful
+ - total
+ additionalProperties: false
+ required:
+ - failed
+ - successful
+ - summary
+ additionalProperties: false
+ BatchGetFilesResult:
+ type: object
+ properties:
+ failed:
+ type: array
+ items:
+ type: object
+ properties:
+ error:
+ type: string
+ fileId:
+ type: string
+ required:
+ - error
+ - fileId
+ additionalProperties: false
+ files:
+ type: array
+ items:
+ $ref: "#/components/schemas/FileDetail"
+ success:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - failed
+ - files
+ - success
+ - total
+ additionalProperties: false
+ GoalList:
+ type: object
+ properties:
+ goals:
+ type: array
+ items:
+ $ref: "#/components/schemas/GoalListItem"
+ total:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ required:
+ - goals
+ - total
+ additionalProperties: false
+ GoalListItem:
+ type: object
+ properties:
+ findingCount:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ goal:
+ $ref: "#/components/schemas/Goal"
+ pendingDecisions:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ signedOff:
+ type: boolean
+ taskDone:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ taskTotal:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ totalRunCost:
+ type: number
+ totalRunDuration:
+ type: number
+ required:
+ - findingCount
+ - goal
+ - pendingDecisions
+ - signedOff
+ - taskDone
+ - taskTotal
+ - totalRunCost
+ - totalRunDuration
+ additionalProperties: false
+ Goal:
+ type: object
+ properties:
+ agentId:
+ type:
+ - string
+ - "null"
+ archivedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ completedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ config:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ createdAt:
+ type: string
+ format: date-time
+ deletedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ id:
+ type: string
+ isDeleted:
+ type:
+ - boolean
+ - "null"
+ maxRounds:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ maxTotalCost:
+ type:
+ - number
+ - "null"
+ projectId:
+ type:
+ - string
+ - "null"
+ requirement:
+ type:
+ - string
+ - "null"
+ startedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ status:
+ type: string
+ enum:
+ - draft
+ - planning
+ - running
+ - verifying
+ - review
+ - paused
+ - achieved
+ - failed
+ - canceled
+ subjectId:
+ type:
+ - string
+ - "null"
+ subjectType:
+ anyOf:
+ - type: string
+ enum:
+ - task
+ - topic
+ - standalone
+ - type: "null"
+ title:
+ type: string
+ updatedAt:
+ type: string
+ format: date-time
+ userId:
+ type: string
+ visibility:
+ type: string
+ enum:
+ - private
+ - public
+ workspaceId:
+ type:
+ - string
+ - "null"
+ required:
+ - agentId
+ - archivedAt
+ - completedAt
+ - config
+ - createdAt
+ - deletedAt
+ - id
+ - isDeleted
+ - maxRounds
+ - maxTotalCost
+ - projectId
+ - requirement
+ - startedAt
+ - status
+ - subjectId
+ - subjectType
+ - title
+ - updatedAt
+ - userId
+ - visibility
+ - workspaceId
+ additionalProperties: false
+ GoalGraphSnapshot:
+ type: object
+ properties:
+ decisions:
+ type: array
+ items:
+ $ref: "#/components/schemas/GoalGraphDecision"
+ edges:
+ type: array
+ items:
+ $ref: "#/components/schemas/GoalGraphEdge"
+ events:
+ type: array
+ items:
+ $ref: "#/components/schemas/GoalGraphEvent"
+ goal:
+ $ref: "#/components/schemas/Goal"
+ nodes:
+ type: array
+ items:
+ $ref: "#/components/schemas/GoalGraphNode"
+ workVersions:
+ type: array
+ items:
+ $ref: "#/components/schemas/GoalGraphWorkVersionLink"
+ required:
+ - decisions
+ - edges
+ - events
+ - goal
+ - nodes
+ - workVersions
+ additionalProperties: false
+ GoalGraphDecision:
+ type: object
+ properties:
+ accessedAt:
+ type: string
+ format: date-time
+ authority:
+ type: string
+ enum:
+ - agent
+ - user
+ - project_role
+ canceledAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ createdAt:
+ type: string
+ format: date-time
+ id:
+ type: string
+ nodeId:
+ type: string
+ options:
+ anyOf:
+ - type: array
+ items:
+ $ref: "#/components/schemas/GoalDecisionOption"
+ - type: "null"
+ question:
+ type: string
+ recommendedOptionId:
+ type:
+ - string
+ - "null"
+ requestedProjectRole:
+ type:
+ - string
+ - "null"
+ requestedUserId:
+ type:
+ - string
+ - "null"
+ resolution:
+ type:
+ - string
+ - "null"
+ resolvedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ resolvedByAgentId:
+ type:
+ - string
+ - "null"
+ resolvedByUserId:
+ type:
+ - string
+ - "null"
+ resolvedOptionId:
+ type:
+ - string
+ - "null"
+ status:
+ type: string
+ enum:
+ - pending
+ - resolved
+ - canceled
+ updatedAt:
+ type: string
+ format: date-time
+ required:
+ - accessedAt
+ - authority
+ - canceledAt
+ - createdAt
+ - id
+ - nodeId
+ - options
+ - question
+ - recommendedOptionId
+ - requestedProjectRole
+ - requestedUserId
+ - resolution
+ - resolvedAt
+ - resolvedByAgentId
+ - resolvedByUserId
+ - resolvedOptionId
+ - status
+ - updatedAt
+ additionalProperties: false
+ GoalDecisionOption:
+ type: object
+ properties:
+ alsoRetires:
+ type: array
+ items:
+ type: object
+ properties:
+ nodeId:
+ type: string
+ title:
+ type: string
+ required:
+ - nodeId
+ - title
+ additionalProperties: false
+ description:
+ type: string
+ effect:
+ type: string
+ enum:
+ - retry
+ - retire
+ - retry_after_reset
+ id:
+ type: string
+ label:
+ type: string
+ required:
+ - id
+ - label
+ additionalProperties: false
+ GoalGraphEdge:
+ type: object
+ properties:
+ createdAt:
+ type: string
+ format: date-time
+ goalId:
+ type: string
+ id:
+ type: string
+ kind:
+ type: string
+ enum:
+ - contains
+ - answers
+ - decomposes
+ - depends_on
+ - derived_from
+ - revises
+ - investigates
+ - produces
+ - supports
+ - contradicts
+ - leads_to
+ - confirms
+ - refutes
+ sourceNodeId:
+ type: string
+ targetNodeId:
+ type: string
+ required:
+ - createdAt
+ - goalId
+ - id
+ - kind
+ - sourceNodeId
+ - targetNodeId
+ additionalProperties: false
+ GoalGraphEvent:
+ type: object
+ properties:
+ actorId:
+ type:
+ - string
+ - "null"
+ actorType:
+ type: string
+ enum:
+ - agent
+ - user
+ - system
+ createdAt:
+ type: string
+ format: date-time
+ entityId:
+ type: string
+ entityType:
+ type: string
+ enum:
+ - goal
+ - node
+ - edge
+ - decision
+ - task
+ eventType:
+ type: string
+ enum:
+ - created
+ - updated
+ - activated
+ - resolved
+ - rejected
+ - retired
+ - linked
+ - unlinked
+ goalId:
+ type: string
+ id:
+ type: string
+ operationId:
+ type:
+ - string
+ - "null"
+ reason:
+ type:
+ - string
+ - "null"
+ taskId:
+ type:
+ - string
+ - "null"
+ required:
+ - actorId
+ - actorType
+ - createdAt
+ - entityId
+ - entityType
+ - eventType
+ - goalId
+ - id
+ - operationId
+ - reason
+ - taskId
+ additionalProperties: false
+ GoalGraphNode:
+ type: object
+ properties:
+ accessedAt:
+ type: string
+ format: date-time
+ confidence:
+ type:
+ - string
+ - "null"
+ createdAt:
+ type: string
+ format: date-time
+ createdByAgentId:
+ type:
+ - string
+ - "null"
+ createdByUserId:
+ type:
+ - string
+ - "null"
+ description:
+ type:
+ - string
+ - "null"
+ goalId:
+ type: string
+ id:
+ type: string
+ kind:
+ type: string
+ enum:
+ - problem
+ - experiment
+ - task
+ - finding
+ - decision
+ - batch
+ - pattern
+ - tool
+ - hazard
+ - dead_end
+ - template
+ priority:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ resolvedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ status:
+ type: string
+ enum:
+ - proposed
+ - active
+ - waiting
+ - resolved
+ - rejected
+ - retired
+ taskId:
+ type:
+ - string
+ - "null"
+ title:
+ type: string
+ updatedAt:
+ type: string
+ format: date-time
+ required:
+ - accessedAt
+ - confidence
+ - createdAt
+ - createdByAgentId
+ - createdByUserId
+ - description
+ - goalId
+ - id
+ - kind
+ - priority
+ - resolvedAt
+ - status
+ - taskId
+ - title
+ - updatedAt
+ additionalProperties: false
+ GoalGraphWorkVersionLink:
+ type: object
+ properties:
+ createdAt:
+ type: string
+ format: date-time
+ id:
+ type: string
+ nodeId:
+ type: string
+ relation:
+ type: string
+ enum:
+ - input
+ - produced
+ - supports
+ - contradicts
+ work:
+ type: object
+ properties:
+ agentDocumentId:
+ type: string
+ fileId:
+ type: string
+ fileSize:
+ type: number
+ fileUrl:
+ type: string
+ identifier:
+ type:
+ - string
+ - "null"
+ mimeType:
+ type: string
+ resourceId:
+ type:
+ - string
+ - "null"
+ resourceType:
+ type: string
+ enum:
+ - canvas
+ - document
+ - github_issue
+ - github_pull_request
+ - linear_document
+ - linear_issue
+ - file
+ - goal_report
+ - task
+ status:
+ type:
+ - string
+ - "null"
+ title:
+ type:
+ - string
+ - "null"
+ type:
+ type: string
+ enum:
+ - canvas
+ - document
+ - external
+ - file
+ - goal_report
+ - task
+ url:
+ type:
+ - string
+ - "null"
+ workId:
+ type: string
+ required:
+ - identifier
+ - resourceId
+ - status
+ - title
+ - type
+ - url
+ - workId
+ additionalProperties: false
+ workVersionId:
+ type: string
+ required:
+ - createdAt
+ - id
+ - nodeId
+ - relation
+ - workVersionId
+ additionalProperties: false
+ GoalGraph:
+ type: object
+ properties:
+ decisions:
+ type: array
+ items:
+ $ref: "#/components/schemas/GoalGraphDecision"
+ edges:
+ type: array
+ items:
+ $ref: "#/components/schemas/GoalGraphEdge"
+ events:
+ type: array
+ items:
+ $ref: "#/components/schemas/GoalGraphEvent"
+ goal:
+ $ref: "#/components/schemas/Goal"
+ nodes:
+ type: array
+ items:
+ $ref: "#/components/schemas/GoalGraphNode"
+ workVersions:
+ type: array
+ items:
+ $ref: "#/components/schemas/GoalGraphWorkVersionLink"
+ acceptances:
+ type: object
+ propertyNames:
type: string
- minLength: 1
- required: true
- responses:
- "200":
- content:
- application/json:
- schema:
+ additionalProperties:
+ type: object
+ properties:
+ checks:
+ type: object
+ properties:
+ failed:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ passed:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ total:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ unjudged:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ required:
+ - failed
+ - passed
+ - total
+ - unjudged
additionalProperties: false
+ id:
+ type: string
+ status:
+ type: string
+ enum:
+ - pending
+ - planned
+ - verifying
+ - repairing
+ - delivered
+ - accepted
+ - closed
+ - rejected
+ - errored
+ required:
+ - id
+ - status
+ additionalProperties: false
+ assignees:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: string
+ deliveredAt:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: string
+ format: date-time
+ metricCriteria:
+ type: object
+ properties:
+ allMet:
+ type: boolean
+ criteria:
+ type: array
+ items:
+ type: object
properties:
- data:
- $ref: "#/components/schemas/Agent"
- message:
+ key:
type: string
- success:
- const: true
+ met:
type: boolean
- timestamp:
- format: date-time
+ observedAt:
+ type: number
+ op:
type: string
+ target:
+ type: number
+ value:
+ type:
+ - number
+ - "null"
required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - agents
- patch:
- operationId: patchApiV1AgentsById
- parameters:
- - in: path
- name: id
- schema:
+ - key
+ - met
+ - op
+ - target
+ - value
+ additionalProperties: false
+ required:
+ - allMet
+ - criteria
+ additionalProperties: false
+ quotaRetryAt:
+ type: object
+ propertyNames:
type: string
- minLength: 1
- required: true
- requestBody:
- required: true
- content:
- application/json:
- schema:
+ additionalProperties:
+ type: string
+ format: date-time
+ report:
+ type: object
+ properties:
+ dispatch:
type: object
- properties:
- agencyConfig:
- anyOf:
- - type: object
- properties:
- enableGraphMode:
- type:
- - boolean
- - "null"
- graph:
- anyOf:
- - type: object
- properties:
- description:
- type: string
- fields:
- type: object
- propertyNames:
- type: string
- additionalProperties:
- type: object
- properties:
- desc:
- type: string
- minLength: 1
- schema:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- required:
- - desc
- - schema
- maxInstructionCount:
- type: integer
- exclusiveMinimum: 0
- maximum: 9007199254740991
- name:
- type: string
- minLength: 1
- nodes:
- type: object
- propertyNames:
- type: string
- additionalProperties:
- oneOf:
- - type: object
- properties:
- allowedToolApiNames:
- type: array
- items:
- type: string
- minLength: 1
- maxAgentSteps:
- type: integer
- exclusiveMinimum: 0
- maximum: 9007199254740991
- type:
- type: string
- const: agent
- required:
- - type
- - type: object
- properties:
- type:
- type: string
- const: llm
- required:
- - type
- terminal:
- type: string
- minLength: 1
- edges:
- type: array
- items:
- type: object
- properties:
- condition:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- from:
- type: string
- input:
- type: object
- properties:
- fields:
- type: array
- items:
- type: object
- properties:
- desc:
- type: string
- minLength: 1
- field:
- type: string
- minLength: 1
- required:
- type: boolean
- from:
- type: string
- minLength: 1
- required:
- - field
- - from
- output:
- type: object
- properties:
- fields:
- type: array
- items:
- type: object
- properties:
- desc:
- type: string
- minLength: 1
- field:
- type: string
- minLength: 1
- required:
- type: boolean
- required:
- - field
- instruction:
- type: string
- minLength: 1
- instruction:
- type: string
- minLength: 1
- maxTraversals:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- to:
- type: string
- required:
- - from
- - instruction
- - to
- required:
- - fields
- - name
- - nodes
- - terminal
- - edges
- - type: "null"
- - type: "null"
- avatar:
+ properties:
+ acceptanceKey:
+ type: string
+ dispatchedAt:
+ type: string
+ format: date-time
+ error:
+ type: string
+ nodeId:
+ type: string
+ operationId:
+ type: string
+ taskId:
+ type: string
+ trigger:
+ type: string
+ enum:
+ - accepted
+ - acceptance_failed
+ - goal_canceled
+ - goal_failed
+ required:
+ - acceptanceKey
+ - dispatchedAt
+ - nodeId
+ - trigger
+ additionalProperties: false
+ latest:
+ type: object
+ properties:
+ content:
type:
- string
- "null"
- chatConfig:
- anyOf:
- - type: object
+ createdAt:
+ type: string
+ format: date-time
+ metadata:
+ type: object
+ properties:
+ chapters:
+ minItems: 1
+ maxItems: 30
+ type: array
+ items:
+ type: object
+ properties:
+ detours:
+ default: []
+ maxItems: 20
+ type: array
+ items:
+ type: object
+ properties:
+ kind:
+ type: string
+ enum:
+ - dead_end
+ - superseded
+ - retry
+ lesson:
+ type: string
+ minLength: 1
+ maxLength: 2000
+ nodeIds:
+ minItems: 1
+ maxItems: 200
+ type: array
+ items:
+ type: string
+ minLength: 1
+ reason:
+ type: string
+ minLength: 1
+ maxLength: 2000
+ title:
+ type: string
+ minLength: 1
+ maxLength: 200
+ required:
+ - kind
+ - lesson
+ - nodeIds
+ - reason
+ - title
+ additionalProperties: false
+ findingIds:
+ default: []
+ maxItems: 200
+ type: array
+ items:
+ type: string
+ minLength: 1
+ narrative:
+ type: string
+ minLength: 1
+ maxLength: 8000
+ nodeIds:
+ default: []
+ maxItems: 200
+ type: array
+ items:
+ type: string
+ minLength: 1
+ title:
+ type: string
+ minLength: 1
+ maxLength: 200
+ workVersionIds:
+ default: []
+ maxItems: 200
+ type: array
+ items:
+ type: string
+ minLength: 1
+ required:
+ - narrative
+ - title
+ additionalProperties: false
+ deliverableWorkId:
+ type: string
+ minLength: 1
+ graphCursor:
+ type: string
+ minLength: 1
+ headline:
+ type: string
+ minLength: 1
+ maxLength: 500
+ mainline:
+ type: object
properties:
- disableContextCaching:
- type:
- - boolean
- - "null"
- displayMode:
- anyOf:
- - type: string
- enum:
- - chat
- - docs
- - type: "null"
- enableCompressHistory:
- type:
- - boolean
- - "null"
- enableHistoryCount:
- type:
- - boolean
- - "null"
- enableMaxTokens:
- type:
- - boolean
- - "null"
- enableReasoning:
- type:
- - boolean
- - "null"
- enableReasoningEffort:
- type:
- - boolean
- - "null"
- historyCount:
- type:
- - number
- - "null"
- reasoningBudgetToken:
- type:
- - number
- - "null"
- reasoningEffort:
- anyOf:
- - type: string
- enum:
- - low
- - medium
- - high
- - type: "null"
- searchFCModel:
- type:
- - string
- - "null"
- searchMode:
- anyOf:
- - type: string
- enum:
- - disabled
- - enabled
- - type: "null"
- useModelBuiltinSearch:
- type:
- - boolean
- - "null"
- - type: "null"
- description:
- type:
- - string
- - "null"
- model:
- type:
- - string
- - "null"
- plugins:
- maxItems: 100
- type: array
- items:
- type: object
- properties:
- identifier:
- type: string
- minLength: 1
- maxLength: 255
- mode:
- type: string
- enum:
- - pinned
- - auto
- - disabled
- required:
- - identifier
- additionalProperties: false
- params:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- personal:
- type: boolean
- provider:
- type:
- - string
- - "null"
- systemRole:
- type:
- - string
- - "null"
- title:
+ edgeIds:
+ default: []
+ maxItems: 200
+ type: array
+ items:
+ type: string
+ minLength: 1
+ nodeIds:
+ minItems: 1
+ maxItems: 200
+ type: array
+ items:
+ type: string
+ minLength: 1
+ required:
+ - nodeIds
+ additionalProperties: false
+ nextSteps:
+ default: []
+ maxItems: 20
+ type: array
+ items:
+ type: object
+ properties:
+ nodeIds:
+ maxItems: 200
+ type: array
+ items:
+ type: string
+ minLength: 1
+ reason:
+ type: string
+ minLength: 1
+ maxLength: 2000
+ title:
+ type: string
+ minLength: 1
+ maxLength: 200
+ required:
+ - reason
+ - title
+ additionalProperties: false
+ required:
+ - chapters
+ - graphCursor
+ - headline
+ additionalProperties: false
+ pageDocumentId:
type: string
- minLength: 1
- responses:
- "200":
- content:
- application/json:
- schema:
+ version:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ workId:
+ type: string
+ workVersionId:
+ type: string
+ required:
+ - content
+ - createdAt
+ - metadata
+ - version
+ - workId
+ - workVersionId
+ additionalProperties: false
+ status:
+ type: string
+ enum:
+ - completed
+ - failed
+ - running
+ required:
+ - dispatch
+ - status
+ additionalProperties: false
+ runHeartbeats:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: string
+ format: date-time
+ spend:
+ type: object
+ properties:
+ byTask:
+ type: array
+ items:
+ type: object
+ properties:
+ runs:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ taskId:
+ type: string
+ totalCost:
+ type: number
+ totalInputTokens:
+ type: number
+ totalOutputTokens:
+ type: number
+ totalTokens:
+ type: number
+ required:
+ - runs
+ - taskId
+ - totalCost
+ - totalInputTokens
+ - totalOutputTokens
+ - totalTokens
additionalProperties: false
+ runs:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ totalCost:
+ type: number
+ totalInputTokens:
+ type: number
+ totalOutputTokens:
+ type: number
+ totalTokens:
+ type: number
+ required:
+ - byTask
+ - runs
+ - totalCost
+ - totalInputTokens
+ - totalOutputTokens
+ - totalTokens
+ additionalProperties: false
+ required:
+ - decisions
+ - edges
+ - events
+ - goal
+ - nodes
+ - workVersions
+ - metricCriteria
+ - spend
+ additionalProperties: false
+ GoalSupervision:
+ type: object
+ properties:
+ enabled:
+ type: boolean
+ state:
+ type: object
+ properties:
+ agentId:
+ type: string
+ incidents:
+ type: array
+ items:
+ type: object
properties:
- data:
- $ref: "#/components/schemas/Agent"
- message:
+ createdAt:
+ type: string
+ format: date-time
+ eligible:
+ type: boolean
+ failedOperationId:
+ type: string
+ id:
+ type: string
+ inspected:
+ type: object
+ properties:
+ artifactVersionIds:
+ type: array
+ items:
+ type: string
+ goal:
+ type: boolean
+ task:
+ type: boolean
+ additionalProperties: false
+ nodeId:
+ type: string
+ reason:
+ type: string
+ recoveryInstruction:
+ type: string
+ recoveryOperationId:
+ type: string
+ resolution:
+ type: object
+ properties:
+ action:
+ type: string
+ enum:
+ - retry
+ - escalate
+ instruction:
+ type: string
+ reason:
+ type: string
+ toolCallId:
+ type: string
+ required:
+ - action
+ - instruction
+ - reason
+ - toolCallId
+ additionalProperties: false
+ resolvedAt:
type: string
- success:
- const: true
- type: boolean
- timestamp:
format: date-time
+ status:
+ type: string
+ enum:
+ - diagnosing
+ - retrying
+ - recovered
+ - escalated
+ - unsuccessful
+ - human_resumed
+ supervisorOperationId:
+ type: string
+ taskId:
+ type: string
+ taskStatus:
type: string
required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
+ - createdAt
+ - eligible
+ - failedOperationId
+ - id
+ - nodeId
+ - reason
+ - status
+ - taskId
+ additionalProperties: false
+ revision:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ topicId:
+ type: string
+ required:
+ - agentId
+ - incidents
+ - revision
+ - topicId
+ additionalProperties: false
+ required:
+ - enabled
+ additionalProperties: false
+ GoalAdvanceResult:
+ type: object
+ properties:
+ goalId:
+ type: string
+ message:
+ type: string
+ nodeId:
+ type: string
+ outcome:
+ type: string
+ enum:
+ - advanced
+ - achieved
+ - waiting_human
+ - waiting_external
+ - no_progress
+ - failed
+ taskId:
+ type: string
+ ticks:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ required:
+ - goalId
+ - message
+ - outcome
+ - ticks
+ additionalProperties: false
+ GoalRestartResult:
+ type: object
+ properties:
+ goal:
+ $ref: "#/components/schemas/Goal"
+ restartedTaskIds:
+ type: array
+ items:
+ type: string
+ required:
+ - goal
+ - restartedTaskIds
+ additionalProperties: false
+ ImSendResult:
+ type: object
+ properties:
+ accepted:
+ type: boolean
+ operationId:
+ type:
+ - string
+ - "null"
+ topicId:
+ type: string
+ userMessage:
+ $ref: "#/components/schemas/ImMessage"
+ required:
+ - accepted
+ - operationId
+ - topicId
+ - userMessage
+ additionalProperties: false
+ ImMessage:
+ type: object
+ properties:
+ agentId:
+ type:
+ - string
+ - "null"
+ content:
+ type: string
+ createdAt:
+ type: string
+ format: date-time
+ error:
+ type: boolean
+ files:
+ type: array
+ items:
+ type: object
+ properties:
+ fileType:
+ type: string
+ id:
+ type: string
+ name:
+ type: string
+ size:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ url:
+ type: string
+ required:
+ - fileType
+ - id
+ - name
+ - size
+ - url
+ additionalProperties: false
+ id:
+ type: string
+ role:
+ type: string
+ enum:
+ - assistant
+ - user
+ required:
+ - agentId
+ - content
+ - createdAt
+ - error
+ - id
+ - role
+ additionalProperties: false
+ ImSyncResult:
+ type: object
+ properties:
+ cursor:
+ type: string
+ messages:
+ type: array
+ items:
+ $ref: "#/components/schemas/ImMessage"
+ readUpTo:
+ anyOf:
+ - type: object
+ properties:
+ messageId:
+ type: string
+ readAt:
+ type: string
+ format: date-time
+ required:
+ - messageId
+ - readAt
+ additionalProperties: false
+ - type: "null"
+ state:
+ type: string
+ typing:
+ type: boolean
+ unread:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - cursor
+ - messages
+ - readUpTo
+ - state
+ - typing
+ - unread
+ additionalProperties: false
+ ImReadResult:
+ type: object
+ properties:
+ unread:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - unread
+ additionalProperties: false
+ KnowledgeBaseList:
+ type: object
+ properties:
+ knowledgeBases:
+ type: array
+ items:
+ $ref: "#/components/schemas/KnowledgeBaseListItem"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - knowledgeBases
+ - total
+ additionalProperties: false
+ KnowledgeBaseListItem:
+ type: object
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ createdAt:
+ type: string
+ format: date-time
+ description:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ isPublic:
+ type:
+ - boolean
+ - "null"
+ name:
+ type: string
+ settings:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ type:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ type: string
+ format: date-time
+ visibility:
+ type: string
+ enum:
+ - private
+ - public
+ accessType:
+ type: string
+ enum:
+ - owner
+ - userGrant
+ - roleGrant
+ - public
+ required:
+ - avatar
+ - createdAt
+ - description
+ - id
+ - isPublic
+ - name
+ - settings
+ - type
+ - updatedAt
+ - visibility
+ - accessType
+ additionalProperties: false
+ KnowledgeBaseDetail:
+ type: object
+ properties:
+ knowledgeBase:
+ $ref: "#/components/schemas/KnowledgeBase"
+ required:
+ - knowledgeBase
+ additionalProperties: false
+ KnowledgeBase:
+ type: object
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ createdAt:
+ type: string
+ format: date-time
+ description:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ isPublic:
+ type:
+ - boolean
+ - "null"
+ name:
+ type: string
+ settings:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ type:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ type: string
+ format: date-time
+ visibility:
+ type: string
+ enum:
+ - private
+ - public
+ required:
+ - avatar
+ - createdAt
+ - description
+ - id
+ - isPublic
+ - name
+ - settings
+ - type
+ - updatedAt
+ - visibility
+ additionalProperties: false
+ KnowledgeBaseFileOperationResult:
+ type: object
+ properties:
+ failed:
+ type: array
+ items:
+ type: object
+ properties:
+ fileId:
+ type: string
+ reason:
+ type: string
+ required:
+ - fileId
+ - reason
+ additionalProperties: false
+ successed:
+ type: array
+ items:
+ type: string
+ required:
+ - failed
+ - successed
+ additionalProperties: false
+ McpServer:
+ type: object
+ properties:
+ createdAt:
+ type: string
+ format: date-time
+ description:
+ type:
+ - string
+ - "null"
+ hasCredentials:
+ type: boolean
+ id:
+ type: string
+ format: uuid
+ identifier:
+ type: string
+ isEnabled:
+ type: boolean
+ name:
+ type: string
+ serverUrl:
+ type: string
+ format: uri
+ status:
+ type: string
+ enum:
+ - connected
+ - disconnected
+ - error
+ tools:
+ type: array
+ items:
+ $ref: "#/components/schemas/McpServerTool"
+ updatedAt:
+ type: string
+ format: date-time
+ required:
+ - createdAt
+ - description
+ - hasCredentials
+ - id
+ - identifier
+ - isEnabled
+ - name
+ - serverUrl
+ - status
+ - tools
+ - updatedAt
+ additionalProperties: false
+ McpServerTool:
+ type: object
+ properties:
+ description:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ format: uuid
+ inputSchema:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ name:
+ type: string
+ permission:
+ type: string
+ enum:
+ - auto
+ - disabled
+ - needs_approval
+ required:
+ - description
+ - id
+ - inputSchema
+ - name
+ - permission
+ additionalProperties: false
+ McpServerSyncResult:
+ type: object
+ properties:
+ id:
+ type: string
+ format: uuid
+ status:
+ type: string
+ const: connected
+ toolCount:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - id
+ - status
+ - toolCount
+ additionalProperties: false
+ MemoryPersona:
+ type: object
+ properties:
+ content:
+ type: string
+ summary:
+ type: string
+ required:
+ - content
+ - summary
+ additionalProperties: false
+ MemoryPersonaVersion:
+ type: object
+ properties:
+ createdAt:
+ type: string
+ format: date-time
+ id:
+ type: string
+ nextVersion:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ previousVersion:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ snapshotPersona:
+ type:
+ - string
+ - "null"
+ snapshotTagline:
+ type:
+ - string
+ - "null"
+ required:
+ - createdAt
+ - id
+ - nextVersion
+ - previousVersion
+ - snapshotPersona
+ - snapshotTagline
+ additionalProperties: false
+ DeletedResources:
+ type: object
+ properties:
+ count:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ deleted:
+ type: boolean
+ const: true
+ required:
+ - count
+ - deleted
+ additionalProperties: false
+ MemoryCategoryEntries:
+ anyOf:
+ - type: array
+ items:
+ $ref: "#/components/schemas/MemoryIdentity"
+ - type: array
+ items:
+ $ref: "#/components/schemas/MemoryPreference"
+ - type: array
+ items:
+ $ref: "#/components/schemas/MemoryContext"
+ - type: array
+ items:
+ $ref: "#/components/schemas/MemoryActivity"
+ - type: array
+ items:
+ $ref: "#/components/schemas/MemoryExperience"
+ MemoryIdentity:
+ type: object
+ properties:
+ accessedAt:
+ type: string
+ format: date-time
+ capturedAt:
+ type: string
+ format: date-time
+ createdAt:
+ type: string
+ format: date-time
+ id:
+ type: string
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ tags:
+ anyOf:
+ - type: array
+ items:
+ type: string
+ - type: "null"
+ type:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ type: string
+ format: date-time
+ userId:
+ type:
+ - string
+ - "null"
+ description:
+ type:
+ - string
+ - "null"
+ entityId:
+ type:
+ - string
+ - "null"
+ episodicDate:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ relationship:
+ type:
+ - string
+ - "null"
+ role:
+ type:
+ - string
+ - "null"
+ userMemoryId:
+ type:
+ - string
+ - "null"
+ required:
+ - accessedAt
+ - capturedAt
+ - createdAt
+ - id
+ - metadata
+ - tags
+ - type
+ - updatedAt
+ - userId
+ - description
+ - entityId
+ - episodicDate
+ - relationship
+ - role
+ - userMemoryId
+ additionalProperties: false
+ MemoryPreference:
+ type: object
+ properties:
+ accessedAt:
+ type: string
+ format: date-time
+ capturedAt:
+ type: string
+ format: date-time
+ createdAt:
+ type: string
+ format: date-time
+ id:
+ type: string
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ tags:
+ anyOf:
+ - type: array
+ items:
+ type: string
+ - type: "null"
+ type:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ type: string
+ format: date-time
+ userId:
+ type:
+ - string
+ - "null"
+ appliesToEntityId:
+ type:
+ - string
+ - "null"
+ conclusionDirectives:
+ type:
+ - string
+ - "null"
+ evidenceCount:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ evidenceSource:
+ anyOf:
+ - type: string
+ enum:
+ - stated
+ - reported
+ - inferred
+ - type: "null"
+ holderEntityId:
+ type:
+ - string
+ - "null"
+ lastEvidenceAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ scope:
+ type:
+ - string
+ - "null"
+ scorePriority:
+ type:
+ - number
+ - "null"
+ suggestions:
+ type:
+ - string
+ - "null"
+ userMemoryId:
+ type:
+ - string
+ - "null"
+ required:
+ - accessedAt
+ - capturedAt
+ - createdAt
+ - id
+ - metadata
+ - tags
+ - type
+ - updatedAt
+ - userId
+ - appliesToEntityId
+ - conclusionDirectives
+ - evidenceCount
+ - evidenceSource
+ - holderEntityId
+ - lastEvidenceAt
+ - scope
+ - scorePriority
+ - suggestions
+ - userMemoryId
+ additionalProperties: false
+ MemoryContext:
+ type: object
+ properties:
+ accessedAt:
+ type: string
+ format: date-time
+ capturedAt:
+ type: string
+ format: date-time
+ createdAt:
+ type: string
+ format: date-time
+ id:
+ type: string
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ tags:
+ anyOf:
+ - type: array
+ items:
+ type: string
+ - type: "null"
+ type:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ type: string
+ format: date-time
+ userId:
+ type:
+ - string
+ - "null"
+ associatedObjects:
+ anyOf:
+ - type: array
+ items:
type: object
properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - agents
- delete:
- operationId: deleteApiV1AgentsById
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- additionalProperties: true
- type:
- - object
- - "null"
- message:
+ extra:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ name:
type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
+ type:
type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - agents
- /api/v1/agents/{id}/duplicate:
- post:
- operationId: postApiV1AgentsByIdDuplicate
- summary: Duplicate agent
- tags:
- - agents
- responses:
- "201":
- content:
- application/json:
- schema:
additionalProperties: false
+ - type: "null"
+ associatedSubjects:
+ anyOf:
+ - type: array
+ items:
+ type: object
properties:
- data:
- additionalProperties: true
+ extra:
type: object
- message:
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ name:
type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
+ type:
type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
- requestBody:
- required: true
+ additionalProperties: false
+ - type: "null"
+ currentStatus:
+ type:
+ - string
+ - "null"
+ description:
+ type:
+ - string
+ - "null"
+ firstSeenAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ lastEvidenceAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ nextSteps:
+ anyOf:
+ - type: array
+ items:
+ type: string
+ - type: "null"
+ now:
+ type:
+ - string
+ - "null"
+ openQuestions:
+ anyOf:
+ - type: array
+ items:
+ type: string
+ - type: "null"
+ scoreImpact:
+ type:
+ - number
+ - "null"
+ scoreUrgency:
+ type:
+ - number
+ - "null"
+ synthesizedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ title:
+ type:
+ - string
+ - "null"
+ userMemoryId:
+ type:
+ - string
+ - "null"
+ userMemoryIds:
+ anyOf:
+ - type: array
+ items:
+ type: string
+ - type: "null"
+ required:
+ - accessedAt
+ - capturedAt
+ - createdAt
+ - id
+ - metadata
+ - tags
+ - type
+ - updatedAt
+ - userId
+ - associatedObjects
+ - associatedSubjects
+ - currentStatus
+ - description
+ - firstSeenAt
+ - lastEvidenceAt
+ - nextSteps
+ - now
+ - openQuestions
+ - scoreImpact
+ - scoreUrgency
+ - synthesizedAt
+ - title
+ - userMemoryId
+ - userMemoryIds
+ additionalProperties: false
+ MemoryActivity:
+ type: object
+ properties:
+ accessedAt:
+ type: string
+ format: date-time
+ capturedAt:
+ type: string
+ format: date-time
+ createdAt:
+ type: string
+ format: date-time
+ id:
+ type: string
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ tags:
+ anyOf:
+ - type: array
+ items:
+ type: string
+ - type: "null"
+ type:
+ type: string
+ updatedAt:
+ type: string
+ format: date-time
+ userId:
+ type:
+ - string
+ - "null"
+ associatedLocations:
+ anyOf:
+ - type: array
+ items:
+ type: object
+ properties:
+ address:
+ type: string
+ name:
+ type: string
+ tags:
+ type: array
+ items:
+ type: string
+ type:
+ type: string
+ additionalProperties: false
+ - type: "null"
+ associatedObjects:
+ anyOf:
+ - type: array
+ items:
+ type: object
+ properties:
+ extra:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ name:
+ type: string
+ type:
+ type: string
+ additionalProperties: false
+ - type: "null"
+ associatedSubjects:
+ anyOf:
+ - type: array
+ items:
+ type: object
+ properties:
+ extra:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ name:
+ type: string
+ type:
+ type: string
+ additionalProperties: false
+ - type: "null"
+ dossierId:
+ type:
+ - string
+ - "null"
+ endsAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ feedback:
+ type:
+ - string
+ - "null"
+ injectable:
+ type: boolean
+ narrative:
+ type:
+ - string
+ - "null"
+ notes:
+ type:
+ - string
+ - "null"
+ startsAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ status:
+ type: string
+ timezone:
+ type:
+ - string
+ - "null"
+ userMemoryId:
+ type:
+ - string
+ - "null"
+ required:
+ - accessedAt
+ - capturedAt
+ - createdAt
+ - id
+ - metadata
+ - tags
+ - type
+ - updatedAt
+ - userId
+ - associatedLocations
+ - associatedObjects
+ - associatedSubjects
+ - dossierId
+ - endsAt
+ - feedback
+ - injectable
+ - narrative
+ - notes
+ - startsAt
+ - status
+ - timezone
+ - userMemoryId
+ additionalProperties: false
+ MemoryExperience:
+ type: object
+ properties:
+ accessedAt:
+ type: string
+ format: date-time
+ capturedAt:
+ type: string
+ format: date-time
+ createdAt:
+ type: string
+ format: date-time
+ id:
+ type: string
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ tags:
+ anyOf:
+ - type: array
+ items:
+ type: string
+ - type: "null"
+ type:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ type: string
+ format: date-time
+ userId:
+ type:
+ - string
+ - "null"
+ action:
+ type:
+ - string
+ - "null"
+ keyLearning:
+ type:
+ - string
+ - "null"
+ possibleOutcome:
+ type:
+ - string
+ - "null"
+ reasoning:
+ type:
+ - string
+ - "null"
+ scoreConfidence:
+ type:
+ - number
+ - "null"
+ situation:
+ type:
+ - string
+ - "null"
+ userMemoryId:
+ type:
+ - string
+ - "null"
+ required:
+ - accessedAt
+ - capturedAt
+ - createdAt
+ - id
+ - metadata
+ - tags
+ - type
+ - updatedAt
+ - userId
+ - action
+ - keyLearning
+ - possibleOutcome
+ - reasoning
+ - scoreConfidence
+ - situation
+ - userMemoryId
+ additionalProperties: false
+ MessageTranslationWrite:
+ type: object
+ properties:
content:
- application/json:
- schema:
- type: object
+ type: string
+ from:
+ type: string
+ id:
+ type: string
+ to:
+ type: string
+ userId:
+ type: string
+ required:
+ - id
+ - to
+ - userId
+ additionalProperties: false
+ MessageTranslation:
+ type: object
+ properties:
+ clientId:
+ type:
+ - string
+ - "null"
+ content:
+ type:
+ - string
+ - "null"
+ from:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ to:
+ type:
+ - string
+ - "null"
+ userId:
+ type: string
+ required:
+ - clientId
+ - content
+ - from
+ - id
+ - to
+ - userId
+ additionalProperties: false
+ Message:
+ type: object
+ properties:
+ agentId:
+ type:
+ - string
+ - "null"
+ content:
+ type:
+ - string
+ - "null"
+ createdAt:
+ type: string
+ format: date-time
+ error:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ favorite:
+ type:
+ - boolean
+ - "null"
+ files:
+ type: array
+ items:
+ type: object
+ properties:
+ createdAt:
+ type: string
+ format: date-time
+ fileType:
+ type: string
+ id:
+ type: string
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ name:
+ type: string
+ parentId:
+ type:
+ - string
+ - "null"
+ size:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ source:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ type: string
+ format: date-time
+ url:
+ type: string
+ visibility:
+ type: string
+ enum:
+ - private
+ - public
+ required:
+ - createdAt
+ - fileType
+ - id
+ - metadata
+ - name
+ - parentId
+ - size
+ - source
+ - updatedAt
+ - url
+ - visibility
+ additionalProperties: false
+ groupId:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ messageGroupId:
+ type:
+ - string
+ - "null"
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ model:
+ type:
+ - string
+ - "null"
+ observationId:
+ type:
+ - string
+ - "null"
+ parentId:
+ type:
+ - string
+ - "null"
+ provider:
+ type:
+ - string
+ - "null"
+ quotaId:
+ type:
+ - string
+ - "null"
+ reasoning:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ role:
+ type: string
+ search:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ session:
+ anyOf:
+ - type: object
properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ backgroundColor:
+ type:
+ - string
+ - "null"
+ createdAt:
+ type: string
+ format: date-time
+ description:
+ type:
+ - string
+ - "null"
+ groupId:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ pinned:
+ type:
+ - boolean
+ - "null"
+ slug:
+ type: string
title:
+ type:
+ - string
+ - "null"
+ type:
+ anyOf:
+ - type: string
+ enum:
+ - agent
+ - group
+ - type: "null"
+ updatedAt:
type: string
- minLength: 1
- maxLength: 255
+ format: date-time
+ required:
+ - avatar
+ - backgroundColor
+ - createdAt
+ - description
+ - groupId
+ - id
+ - pinned
+ - slug
+ - title
+ - type
+ - updatedAt
additionalProperties: false
- /api/v1/agents/{id}/accounts:
- get:
- operationId: listAgentAccounts
- tags:
- - agents
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- additionalProperties: false
- properties:
- accounts:
- items:
- $ref: "#/components/schemas/AgentAccount"
- type: array
- total:
- minimum: 0
- type: integer
- required:
- - accounts
- - total
- type: object
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
- - in: query
- name: kind
- schema:
- type: string
- enum:
- - mail
- - wallet
- - service
- - in: query
- name: provider
- schema:
- type: string
- minLength: 1
- post:
- operationId: createAgentAccount
- tags:
- - agents
- responses:
- "201":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $ref: "#/components/schemas/AgentAccount"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
- requestBody:
- required: true
+ - type: "null"
+ sessionId:
+ type:
+ - string
+ - "null"
+ summary:
+ type:
+ - string
+ - "null"
+ targetId:
+ type:
+ - string
+ - "null"
+ threadId:
+ type:
+ - string
+ - "null"
+ tools:
+ anyOf:
+ - type: array
+ items:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ topic:
+ anyOf:
+ - $ref: "#/components/schemas/TopicSummary"
+ - type: "null"
+ topicId:
+ type:
+ - string
+ - "null"
+ traceId:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ type: string
+ format: date-time
+ usage:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ required:
+ - agentId
+ - content
+ - createdAt
+ - error
+ - favorite
+ - files
+ - groupId
+ - id
+ - messageGroupId
+ - metadata
+ - model
+ - observationId
+ - parentId
+ - provider
+ - quotaId
+ - reasoning
+ - role
+ - search
+ - session
+ - sessionId
+ - summary
+ - targetId
+ - threadId
+ - tools
+ - topic
+ - topicId
+ - traceId
+ - updatedAt
+ - usage
+ additionalProperties: false
+ TopicSummary:
+ type: object
+ properties:
+ agentId:
+ type:
+ - string
+ - "null"
+ completedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
content:
- application/json:
- schema:
- anyOf:
- - type: object
+ type:
+ - string
+ - "null"
+ cost:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ createdAt:
+ type: string
+ format: date-time
+ description:
+ type:
+ - string
+ - "null"
+ favorite:
+ type:
+ - boolean
+ - "null"
+ groupId:
+ type:
+ - string
+ - "null"
+ historySummary:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ mode:
+ type:
+ - string
+ - "null"
+ model:
+ type:
+ - string
+ - "null"
+ provider:
+ type:
+ - string
+ - "null"
+ sessionId:
+ type:
+ - string
+ - "null"
+ status:
+ anyOf:
+ - type: string
+ enum:
+ - active
+ - running
+ - waitingForHuman
+ - scheduled
+ - failed
+ - completed
+ - archived
+ - unread
+ - type: "null"
+ title:
+ type:
+ - string
+ - "null"
+ totalCost:
+ type:
+ - number
+ - "null"
+ totalInputTokens:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ totalOutputTokens:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ totalTokens:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ trigger:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ type: string
+ format: date-time
+ usage:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ required:
+ - agentId
+ - completedAt
+ - content
+ - cost
+ - createdAt
+ - description
+ - favorite
+ - groupId
+ - historySummary
+ - id
+ - metadata
+ - mode
+ - model
+ - provider
+ - sessionId
+ - status
+ - title
+ - totalCost
+ - totalInputTokens
+ - totalOutputTokens
+ - totalTokens
+ - trigger
+ - updatedAt
+ - usage
+ additionalProperties: false
+ Model:
+ type: object
+ properties:
+ abilities:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ config:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ contextWindowTokens:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ createdAt:
+ type: string
+ format: date-time
+ description:
+ type:
+ - string
+ - "null"
+ displayName:
+ type:
+ - string
+ - "null"
+ enabled:
+ type:
+ - boolean
+ - "null"
+ id:
+ type: string
+ organization:
+ type:
+ - string
+ - "null"
+ parameters:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ pricing:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ providerId:
+ type: string
+ releasedAt:
+ type:
+ - string
+ - "null"
+ settings:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ sort:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ source:
+ anyOf:
+ - type: string
+ enum:
+ - remote
+ - custom
+ - builtin
+ - type: "null"
+ type:
+ type: string
+ updatedAt:
+ type: string
+ format: date-time
+ required:
+ - abilities
+ - config
+ - contextWindowTokens
+ - createdAt
+ - description
+ - displayName
+ - enabled
+ - id
+ - organization
+ - parameters
+ - pricing
+ - providerId
+ - releasedAt
+ - settings
+ - sort
+ - source
+ - type
+ - updatedAt
+ additionalProperties: false
+ Notification:
+ type: object
+ properties:
+ actionUrl:
+ type:
+ - string
+ - "null"
+ category:
+ type: string
+ content:
+ type: string
+ context:
+ type:
+ - string
+ - "null"
+ createdAt:
+ type: string
+ format: date-time
+ dedupeKey:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ isArchived:
+ type: boolean
+ isRead:
+ type: boolean
+ metadata:
+ anyOf:
+ - type: object
+ properties:
+ actor:
+ type: object
properties:
- capabilities:
- type: object
- properties:
- login:
- type: boolean
- receive:
- type: boolean
- send:
- type: boolean
- sign:
- type: boolean
- required:
- - receive
- - send
- displayName:
+ avatar:
type: string
- minLength: 1
- identifier:
+ name:
type: string
- minLength: 1
- kind:
+ userId:
+ type: string
+ additionalProperties: false
+ agent:
+ type: object
+ properties:
+ avatar:
+ type: string
+ backgroundColor:
+ type: string
+ id:
+ type: string
+ name:
+ type: string
+ required:
+ - id
+ additionalProperties: false
+ transfer:
+ type: object
+ properties:
+ requestId:
+ type: string
+ required:
+ - requestId
+ additionalProperties: false
+ additionalProperties: false
+ - type: "null"
+ title:
+ type: string
+ type:
+ type: string
+ updatedAt:
+ type: string
+ format: date-time
+ userId:
+ type: string
+ workspaceId:
+ type:
+ - string
+ - "null"
+ required:
+ - actionUrl
+ - category
+ - content
+ - context
+ - createdAt
+ - dedupeKey
+ - id
+ - isArchived
+ - isRead
+ - metadata
+ - title
+ - type
+ - updatedAt
+ - userId
+ - workspaceId
+ additionalProperties: false
+ NotificationSettings:
+ type: object
+ properties:
+ content:
+ type: object
+ properties:
+ scheduledTaskSummary:
+ type: boolean
+ additionalProperties: false
+ email:
+ type: object
+ properties:
+ enabled:
+ type: boolean
+ items:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: boolean
+ additionalProperties: false
+ im:
+ type: object
+ properties:
+ enabled:
+ type: boolean
+ items:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: boolean
+ platforms:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: object
+ properties:
+ enabled:
+ type: boolean
+ items:
+ type: object
+ propertyNames:
type: string
- enum:
- - mail
- - wallet
- - service
- metadata:
+ additionalProperties:
type: object
propertyNames:
type: string
- additionalProperties: {}
- provider:
+ additionalProperties:
+ type: boolean
+ tenantId:
+ type: string
+ additionalProperties: false
+ additionalProperties: false
+ inbox:
+ type: object
+ properties:
+ enabled:
+ type: boolean
+ items:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: boolean
+ additionalProperties: false
+ push:
+ type: object
+ properties:
+ enabled:
+ type: boolean
+ items:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: boolean
+ additionalProperties: false
+ additionalProperties: false
+ NotificationUnreadCount:
+ type: object
+ properties:
+ count:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ required:
+ - count
+ additionalProperties: false
+ NotificationCategoryCount:
+ type: object
+ properties:
+ category:
+ type: string
+ readCount:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ totalCount:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ unreadCount:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ required:
+ - category
+ - readCount
+ - totalCount
+ - unreadCount
+ additionalProperties: false
+ PermissionList:
+ type: object
+ properties:
+ permissions:
+ type: array
+ items:
+ $ref: "#/components/schemas/Permission"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - permissions
+ - total
+ additionalProperties: false
+ Permission:
+ type: object
+ properties:
+ category:
+ type: string
+ code:
+ type: string
+ createdAt:
+ type: string
+ format: date-time
+ description:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ isActive:
+ type: boolean
+ name:
+ type: string
+ updatedAt:
+ type: string
+ format: date-time
+ required:
+ - category
+ - code
+ - createdAt
+ - description
+ - id
+ - isActive
+ - name
+ - updatedAt
+ additionalProperties: false
+ Provider:
+ type: object
+ properties:
+ checkModel:
+ type:
+ - string
+ - "null"
+ config:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ createdAt:
+ type: string
+ format: date-time
+ description:
+ type:
+ - string
+ - "null"
+ enabled:
+ type:
+ - boolean
+ - "null"
+ fetchOnClient:
+ type:
+ - boolean
+ - "null"
+ id:
+ type: string
+ logo:
+ type:
+ - string
+ - "null"
+ name:
+ type:
+ - string
+ - "null"
+ settings:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ sort:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ source:
+ anyOf:
+ - type: string
+ enum:
+ - builtin
+ - custom
+ - type: "null"
+ updatedAt:
+ type: string
+ format: date-time
+ required:
+ - checkModel
+ - config
+ - createdAt
+ - description
+ - enabled
+ - fetchOnClient
+ - id
+ - logo
+ - name
+ - settings
+ - sort
+ - source
+ - updatedAt
+ additionalProperties: false
+ PushTokenRegistration:
+ type: object
+ properties:
+ deviceId:
+ type: string
+ platform:
+ type: string
+ required:
+ - deviceId
+ - platform
+ additionalProperties: false
+ ResponseObject:
+ type: object
+ properties:
+ background:
+ type: boolean
+ completed_at:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ created_at:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ error:
+ anyOf:
+ - $ref: "#/components/schemas/ResponseError"
+ - type: "null"
+ frequency_penalty:
+ type: number
+ id:
+ type: string
+ incomplete_details:
+ anyOf:
+ - type: object
+ properties:
+ reason:
+ type: string
+ required:
+ - reason
+ additionalProperties: false
+ - type: "null"
+ instructions:
+ type:
+ - string
+ - "null"
+ max_output_tokens:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ max_tool_calls:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ metadata:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: string
+ model:
+ type: string
+ object:
+ type: string
+ const: response
+ output:
+ type: array
+ items:
+ $ref: "#/components/schemas/ResponseOutputItem"
+ output_text:
+ type: string
+ parallel_tool_calls:
+ type: boolean
+ presence_penalty:
+ type: number
+ previous_response_id:
+ type:
+ - string
+ - "null"
+ prompt_cache_key:
+ type:
+ - string
+ - "null"
+ reasoning:
+ anyOf:
+ - type: object
+ properties:
+ effort:
+ type: string
+ enum:
+ - low
+ - medium
+ - high
+ additionalProperties: false
+ - type: "null"
+ safety_identifier:
+ type:
+ - string
+ - "null"
+ service_tier:
+ type: string
+ status:
+ type: string
+ enum:
+ - completed
+ - failed
+ - in_progress
+ - incomplete
+ - queued
+ store:
+ type: boolean
+ temperature:
+ type: number
+ text:
+ type: object
+ properties:
+ format:
+ type: object
+ properties:
+ type:
+ type: string
+ const: text
+ required:
+ - type
+ additionalProperties: false
+ required:
+ - format
+ additionalProperties: false
+ tool_choice:
+ anyOf:
+ - type: string
+ enum:
+ - auto
+ - required
+ - none
+ - type: object
+ properties:
+ name:
+ type: string
+ type:
+ type: string
+ const: function
+ required:
+ - name
+ - type
+ additionalProperties: false
+ tools:
+ type: array
+ items:
+ anyOf:
+ - type: object
+ properties:
+ description:
+ type: string
+ name:
+ type: string
+ parameters:
+ type: object
+ propertyNames:
type: string
- minLength: 1
- required:
- - identifier
- - kind
- - provider
- - type: object
+ additionalProperties: {}
+ strict:
+ type:
+ - boolean
+ - "null"
+ type:
+ type: string
+ const: function
+ required:
+ - name
+ - strict
+ - type
+ additionalProperties: false
+ - type: object
+ properties:
+ strict:
+ type: "null"
+ type:
+ type: string
+ required:
+ - strict
+ - type
+ additionalProperties: false
+ top_logprobs:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ top_p:
+ type: number
+ truncation:
+ type: string
+ enum:
+ - auto
+ - disabled
+ usage:
+ $ref: "#/components/schemas/ResponseUsage"
+ user:
+ type:
+ - string
+ - "null"
+ required:
+ - background
+ - completed_at
+ - created_at
+ - error
+ - frequency_penalty
+ - id
+ - incomplete_details
+ - instructions
+ - max_output_tokens
+ - max_tool_calls
+ - metadata
+ - model
+ - object
+ - output
+ - output_text
+ - parallel_tool_calls
+ - presence_penalty
+ - previous_response_id
+ - prompt_cache_key
+ - reasoning
+ - safety_identifier
+ - service_tier
+ - status
+ - store
+ - temperature
+ - text
+ - tool_choice
+ - tools
+ - top_logprobs
+ - top_p
+ - truncation
+ - usage
+ - user
+ additionalProperties: false
+ ResponseError:
+ type: object
+ properties:
+ code:
+ type: string
+ enum:
+ - server_error
+ - invalid_request_error
+ - not_found
+ - model_error
+ - rate_limit_error
+ message:
+ type: string
+ required:
+ - code
+ - message
+ additionalProperties: false
+ ResponseOutputItem:
+ oneOf:
+ - $ref: "#/components/schemas/ResponseOutputMessage"
+ - $ref: "#/components/schemas/ResponseFunctionCall"
+ - $ref: "#/components/schemas/ResponseFunctionCallOutput"
+ ResponseOutputMessage:
+ type: object
+ properties:
+ content:
+ type: array
+ items:
+ $ref: "#/components/schemas/ResponseOutputText"
+ id:
+ type: string
+ role:
+ type: string
+ const: assistant
+ status:
+ type: string
+ enum:
+ - completed
+ - in_progress
+ type:
+ type: string
+ const: message
+ required:
+ - content
+ - id
+ - role
+ - status
+ - type
+ additionalProperties: false
+ ResponseOutputText:
+ type: object
+ properties:
+ annotations:
+ type: array
+ items:
+ anyOf:
+ - type: object
+ properties:
+ end_index:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ start_index:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ title:
+ type: string
+ type:
+ type: string
+ const: url_citation
+ url:
+ type: string
+ required:
+ - end_index
+ - start_index
+ - title
+ - type
+ - url
+ additionalProperties: false
+ - type: object
+ properties:
+ file_id:
+ type: string
+ filename:
+ type: string
+ index:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ type:
+ type: string
+ const: file_citation
+ required:
+ - file_id
+ - filename
+ - index
+ - type
+ additionalProperties: false
+ logprobs:
+ type: array
+ items:
+ type: object
+ properties:
+ bytes:
+ type: array
+ items:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ logprob:
+ type: number
+ token:
+ type: string
+ top_logprobs:
+ type: array
+ items:
+ type: object
properties:
- displayName:
- type: string
- minLength: 1
- provider:
+ bytes:
+ type: array
+ items:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ logprob:
+ type: number
+ token:
type: string
- minLength: 1
required:
- - provider
+ - bytes
+ - logprob
+ - token
additionalProperties: false
- /api/v1/agents/{id}/accounts/{accountId}:
- get:
- operationId: getAgentAccount
- tags:
- - agents
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
+ required:
+ - bytes
+ - logprob
+ - token
+ - top_logprobs
+ additionalProperties: false
+ text:
+ type: string
+ type:
+ type: string
+ const: output_text
+ required:
+ - annotations
+ - logprobs
+ - text
+ - type
+ additionalProperties: false
+ ResponseFunctionCall:
+ type: object
+ properties:
+ arguments:
+ type: string
+ call_id:
+ type: string
+ id:
+ type: string
+ name:
+ type: string
+ status:
+ type: string
+ enum:
+ - completed
+ - in_progress
+ type:
+ type: string
+ const: function_call
+ required:
+ - arguments
+ - call_id
+ - id
+ - name
+ - status
+ - type
+ additionalProperties: false
+ ResponseFunctionCallOutput:
+ type: object
+ properties:
+ call_id:
+ type: string
+ id:
+ type: string
+ output:
+ type: string
+ status:
+ type: string
+ enum:
+ - completed
+ - in_progress
+ type:
+ type: string
+ const: function_call_output
+ required:
+ - call_id
+ - id
+ - output
+ - status
+ - type
+ additionalProperties: false
+ ResponseUsage:
+ type: object
+ properties:
+ input_tokens:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ input_tokens_details:
+ type: object
+ properties:
+ cached_tokens:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - cached_tokens
+ additionalProperties: false
+ output_tokens:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ output_tokens_details:
+ type: object
+ properties:
+ reasoning_tokens:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - reasoning_tokens
+ additionalProperties: false
+ total_tokens:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - input_tokens
+ - input_tokens_details
+ - output_tokens
+ - output_tokens_details
+ - total_tokens
+ additionalProperties: false
+ RoleList:
+ type: object
+ properties:
+ roles:
+ type: array
+ items:
+ $ref: "#/components/schemas/Role"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - roles
+ - total
+ additionalProperties: false
+ Role:
+ type: object
+ properties:
+ createdAt:
+ type: string
+ format: date-time
+ description:
+ type:
+ - string
+ - "null"
+ displayName:
+ type: string
+ id:
+ type: string
+ isActive:
+ type: boolean
+ isSystem:
+ type: boolean
+ name:
+ type: string
+ updatedAt:
+ type: string
+ format: date-time
+ required:
+ - createdAt
+ - description
+ - displayName
+ - id
+ - isActive
+ - isSystem
+ - name
+ - updatedAt
+ additionalProperties: false
+ RolePermissionList:
+ type: object
+ properties:
+ permissions:
+ type: array
+ items:
+ $ref: "#/components/schemas/RolePermission"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - permissions
+ - total
+ additionalProperties: false
+ RolePermission:
+ type: object
+ properties:
+ category:
+ type: string
+ code:
+ type: string
+ description:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ isActive:
+ type: boolean
+ name:
+ type: string
+ required:
+ - category
+ - code
+ - description
+ - id
+ - isActive
+ - name
+ additionalProperties: false
+ RolePermissionsUpdateResult:
+ type: object
+ properties:
+ granted:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ revoked:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ roleId:
+ type: string
+ required:
+ - granted
+ - revoked
+ - roleId
+ additionalProperties: false
+ AgentSignalEmission:
+ type: object
+ properties:
+ accepted:
+ type: boolean
+ scopeKey:
+ type: string
+ workflowRunId:
+ type: string
+ required:
+ - accepted
+ - scopeKey
+ - workflowRunId
+ additionalProperties: false
+ AgentSignalReceiptList:
+ type: object
+ properties:
+ cursor:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ receipts:
+ type: array
+ items:
+ $ref: "#/components/schemas/AgentSignalReceipt"
+ required:
+ - receipts
+ additionalProperties: false
+ AgentSignalReceipt:
+ type: object
+ properties:
+ agentId:
+ type: string
+ anchorMessageId:
+ type: string
+ createdAt:
+ type: number
+ detail:
+ type: string
+ id:
+ type: string
+ kind:
+ type: string
+ enum:
+ - memory
+ - review
+ - skill
+ metadata:
+ type: object
+ properties:
+ actionCount:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ actionStatus:
+ type: string
+ enum:
+ - applied
+ - deduped
+ - failed
+ - proposed
+ - skipped
+ actionType:
+ type: string
+ enum:
+ - write_memory
+ - create_skill
+ - refine_skill
+ - refine_prompt
+ - consolidate_skill
+ - noop
+ - proposal_only
+ agentDocumentId:
+ type: string
+ documentId:
+ type: string
+ evidenceRefs:
+ type: array
+ items:
+ type: object
properties:
- data:
- $ref: "#/components/schemas/AgentAccount"
- message:
+ id:
type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
+ summary:
+ type: string
+ type:
type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
enum:
- - false
- error:
- type: array
- items: {}
- data: {}
+ - topic
+ - message
+ - operation
+ - source
+ - receipt
+ - tool_call
+ - task
+ - agent_document
+ - memory
required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- parameters:
- - in: path
- name: accountId
- schema:
- type: string
- minLength: 1
- required: true
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
- patch:
- operationId: updateAgentAccount
- tags:
- - agents
- responses:
- "200":
- content:
- application/json:
- schema:
+ - id
+ - type
additionalProperties: false
- properties:
- data:
- $ref: "#/components/schemas/AgentAccount"
- message:
+ expectedCurrentDocumentUpdatedAt:
+ type: string
+ format: date-time
+ historyId:
+ type: string
+ localDate:
+ type: string
+ reviewScope:
+ type: string
+ enum:
+ - nightly
+ - self_feedback
+ - self_reflection
+ rollbackStatus:
+ type: string
+ enum:
+ - available
+ - conflict
+ - failed
+ - not_found
+ - rolled_back
+ - unsupported
+ scopeId:
+ type: string
+ scopeType:
+ type: string
+ selfIteration:
+ type: object
+ properties:
+ ideas:
+ type: array
+ items:
+ type: object
+ properties:
+ evidenceRefs:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: string
+ summary:
+ type: string
+ type:
+ type: string
+ enum:
+ - topic
+ - message
+ - operation
+ - source
+ - receipt
+ - tool_call
+ - task
+ - agent_document
+ - memory
+ required:
+ - id
+ - type
+ additionalProperties: false
+ idempotencyKey:
+ type: string
+ rationale:
+ type: string
+ risk:
+ type: string
+ enum:
+ - high
+ - low
+ - medium
+ target:
+ type: object
+ properties:
+ memoryId:
+ type: string
+ readonly:
+ type: boolean
+ skillDocumentId:
+ type: string
+ skillName:
+ type: string
+ taskIds:
+ type: array
+ items:
+ type: string
+ topicIds:
+ type: array
+ items:
+ type: string
+ additionalProperties: false
+ title:
+ type: string
+ required:
+ - evidenceRefs
+ - idempotencyKey
+ - rationale
+ - risk
+ additionalProperties: false
+ intents:
+ type: array
+ items:
+ type: object
+ properties:
+ evidenceRefs:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: string
+ summary:
+ type: string
+ type:
+ type: string
+ enum:
+ - topic
+ - message
+ - operation
+ - source
+ - receipt
+ - tool_call
+ - task
+ - agent_document
+ - memory
+ required:
+ - id
+ - type
+ additionalProperties: false
+ idempotencyKey:
+ type: string
+ rationale:
+ type: string
+ risk:
+ type: string
+ enum:
+ - high
+ - low
+ - medium
+ target:
+ type: object
+ properties:
+ memoryId:
+ type: string
+ readonly:
+ type: boolean
+ skillDocumentId:
+ type: string
+ skillName:
+ type: string
+ taskIds:
+ type: array
+ items:
+ type: string
+ topicIds:
+ type: array
+ items:
+ type: string
+ additionalProperties: false
+ title:
+ type: string
+ actionType:
+ type: string
+ confidence:
+ type: number
+ downgradeReason:
+ type: string
+ enum:
+ - approval_required
+ - low_confidence
+ - unsupported_in_reflection
+ intentType:
+ type: string
+ enum:
+ - memory
+ - skill
+ - tooling
+ - workflow
+ mode:
+ type: string
+ const: reflection
+ operation:
+ oneOf:
+ - type: object
+ properties:
+ domain:
+ type: string
+ const: memory
+ input:
+ type: object
+ properties:
+ content:
+ type: string
+ userId:
+ type: string
+ required:
+ - content
+ - userId
+ additionalProperties: false
+ operation:
+ type: string
+ const: write
+ required:
+ - domain
+ - input
+ - operation
+ additionalProperties: false
+ - type: object
+ properties:
+ domain:
+ type: string
+ const: skill
+ input:
+ type: object
+ properties:
+ bodyMarkdown:
+ type: string
+ description:
+ type: string
+ name:
+ type: string
+ title:
+ type: string
+ userId:
+ type: string
+ required:
+ - userId
+ additionalProperties: false
+ operation:
+ type: string
+ const: create
+ required:
+ - domain
+ - input
+ - operation
+ additionalProperties: false
+ - type: object
+ properties:
+ domain:
+ type: string
+ const: skill
+ input:
+ type: object
+ properties:
+ bodyMarkdown:
+ type: string
+ description:
+ type: string
+ skillDocumentId:
+ type: string
+ userId:
+ type: string
+ required:
+ - bodyMarkdown
+ - skillDocumentId
+ - userId
+ additionalProperties: false
+ operation:
+ type: string
+ const: refine
+ required:
+ - domain
+ - input
+ - operation
+ additionalProperties: false
+ - type: object
+ properties:
+ domain:
+ type: string
+ const: skill
+ input:
+ type: object
+ properties:
+ bodyMarkdown:
+ type: string
+ canonicalSkillDocumentId:
+ type: string
+ description:
+ type: string
+ sourceSkillIds:
+ type: array
+ items:
+ type: string
+ userId:
+ type: string
+ required:
+ - canonicalSkillDocumentId
+ - sourceSkillIds
+ - userId
+ additionalProperties: false
+ operation:
+ type: string
+ const: consolidate
+ required:
+ - domain
+ - input
+ - operation
+ additionalProperties: false
+ urgency:
+ type: string
+ enum:
+ - immediate
+ - later
+ - soon
+ required:
+ - evidenceRefs
+ - idempotencyKey
+ - rationale
+ - risk
+ - confidence
+ - intentType
+ - mode
+ - urgency
+ additionalProperties: false
+ mode:
+ type: string
+ enum:
+ - feedback
+ - reflection
+ - review
+ reason:
+ type: string
+ scope:
+ type: object
+ properties:
+ id:
+ type: string
+ type:
+ type: string
+ required:
+ - id
+ - type
+ additionalProperties: false
+ sourceId:
+ type: string
+ toolCallId:
+ type: string
+ window:
+ type: object
+ properties:
+ end:
+ type: string
+ format: date-time
+ start:
+ type: string
+ format: date-time
+ required:
+ - end
+ - start
+ additionalProperties: false
+ required:
+ - mode
+ - sourceId
+ additionalProperties: false
+ sourceType:
+ type: string
+ timezone:
+ type: string
+ additionalProperties: false
+ operationId:
+ type: string
+ sourceId:
+ type: string
+ sourceType:
+ type: string
+ status:
+ type: string
+ enum:
+ - applied
+ - completed
+ - failed
+ - proposed
+ - skipped
+ - updated
+ target:
+ type: object
+ properties:
+ agentDocumentId:
+ type: string
+ documentId:
+ type: string
+ id:
+ type: string
+ memoryId:
+ type: string
+ memoryLayer:
+ type: string
+ enum:
+ - activity
+ - context
+ - experience
+ - identity
+ - preference
+ operation:
+ type: string
+ enum:
+ - create
+ - remove
+ - update
+ summary:
+ type: string
+ title:
+ type: string
+ type:
+ type: string
+ enum:
+ - memory
+ - skill
+ required:
+ - type
+ additionalProperties: false
+ title:
+ type: string
+ topicId:
+ type: string
+ triggerMessageId:
+ type: string
+ userId:
+ type: string
+ required:
+ - agentId
+ - createdAt
+ - detail
+ - id
+ - kind
+ - sourceId
+ - sourceType
+ - status
+ - title
+ - topicId
+ - userId
+ additionalProperties: false
+ TaskList:
+ type: object
+ properties:
+ tasks:
+ type: array
+ items:
+ $ref: "#/components/schemas/TaskListItem"
+ total:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ required:
+ - tasks
+ - total
+ additionalProperties: false
+ TaskListItem:
+ type: object
+ properties:
+ accessedAt:
+ type: string
+ format: date-time
+ archivedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ assigneeAgentId:
+ type:
+ - string
+ - "null"
+ assigneeUserId:
+ type:
+ - string
+ - "null"
+ automationMode:
+ anyOf:
+ - type: string
+ enum:
+ - heartbeat
+ - schedule
+ - type: "null"
+ completedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ config:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ context:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ createdAt:
+ type: string
+ format: date-time
+ createdByAgentId:
+ type:
+ - string
+ - "null"
+ createdByUserId:
+ type: string
+ currentTopicId:
+ type:
+ - string
+ - "null"
+ deletedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ description:
+ type:
+ - string
+ - "null"
+ editorData: {}
+ error:
+ type:
+ - string
+ - "null"
+ heartbeatInterval:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ heartbeatTimeout:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ id:
+ type: string
+ identifier:
+ type: string
+ instruction:
+ type: string
+ isDeleted:
+ type:
+ - boolean
+ - "null"
+ lastHeartbeatAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ maxTopics:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ name:
+ type:
+ - string
+ - "null"
+ parentTaskId:
+ type:
+ - string
+ - "null"
+ priority:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ projectId:
+ type:
+ - string
+ - "null"
+ schedulePattern:
+ type:
+ - string
+ - "null"
+ scheduleTimezone:
+ type:
+ - string
+ - "null"
+ seq:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ sortOrder:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ startedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ status:
+ type: string
+ enum:
+ - backlog
+ - running
+ - scheduled
+ - paused
+ - completed
+ - failed
+ - canceled
+ totalTopics:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ updatedAt:
+ type: string
+ format: date-time
+ visibility:
+ type: string
+ enum:
+ - private
+ - public
+ workspaceId:
+ type:
+ - string
+ - "null"
+ labels:
+ type: array
+ items:
+ $ref: "#/components/schemas/TaskLabelRef"
+ subtaskProgress:
+ type: object
+ properties:
+ completed:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ total:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ required:
+ - completed
+ - total
+ additionalProperties: false
+ required:
+ - accessedAt
+ - archivedAt
+ - assigneeAgentId
+ - assigneeUserId
+ - automationMode
+ - completedAt
+ - config
+ - context
+ - createdAt
+ - createdByAgentId
+ - createdByUserId
+ - currentTopicId
+ - deletedAt
+ - description
+ - editorData
+ - error
+ - heartbeatInterval
+ - heartbeatTimeout
+ - id
+ - identifier
+ - instruction
+ - isDeleted
+ - lastHeartbeatAt
+ - maxTopics
+ - name
+ - parentTaskId
+ - priority
+ - projectId
+ - schedulePattern
+ - scheduleTimezone
+ - seq
+ - sortOrder
+ - startedAt
+ - status
+ - totalTopics
+ - updatedAt
+ - visibility
+ - workspaceId
+ - labels
+ additionalProperties: false
+ TaskLabelRef:
+ type: object
+ properties:
+ color:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ name:
+ type: string
+ parentId:
+ type:
+ - string
+ - "null"
+ required:
+ - id
+ - name
+ additionalProperties: false
+ Task:
+ type: object
+ properties:
+ accessedAt:
+ type: string
+ format: date-time
+ archivedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ assigneeAgentId:
+ type:
+ - string
+ - "null"
+ assigneeUserId:
+ type:
+ - string
+ - "null"
+ automationMode:
+ anyOf:
+ - type: string
+ enum:
+ - heartbeat
+ - schedule
+ - type: "null"
+ completedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ config:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ context:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ createdAt:
+ type: string
+ format: date-time
+ createdByAgentId:
+ type:
+ - string
+ - "null"
+ createdByUserId:
+ type: string
+ currentTopicId:
+ type:
+ - string
+ - "null"
+ deletedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ description:
+ type:
+ - string
+ - "null"
+ editorData: {}
+ error:
+ type:
+ - string
+ - "null"
+ heartbeatInterval:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ heartbeatTimeout:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ id:
+ type: string
+ identifier:
+ type: string
+ instruction:
+ type: string
+ isDeleted:
+ type:
+ - boolean
+ - "null"
+ lastHeartbeatAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ maxTopics:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ name:
+ type:
+ - string
+ - "null"
+ parentTaskId:
+ type:
+ - string
+ - "null"
+ priority:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ projectId:
+ type:
+ - string
+ - "null"
+ schedulePattern:
+ type:
+ - string
+ - "null"
+ scheduleTimezone:
+ type:
+ - string
+ - "null"
+ seq:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ sortOrder:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ startedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ status:
+ type: string
+ enum:
+ - backlog
+ - running
+ - scheduled
+ - paused
+ - completed
+ - failed
+ - canceled
+ totalTopics:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ updatedAt:
+ type: string
+ format: date-time
+ visibility:
+ type: string
+ enum:
+ - private
+ - public
+ workspaceId:
+ type:
+ - string
+ - "null"
+ required:
+ - accessedAt
+ - archivedAt
+ - assigneeAgentId
+ - assigneeUserId
+ - automationMode
+ - completedAt
+ - config
+ - context
+ - createdAt
+ - createdByAgentId
+ - createdByUserId
+ - currentTopicId
+ - deletedAt
+ - description
+ - editorData
+ - error
+ - heartbeatInterval
+ - heartbeatTimeout
+ - id
+ - identifier
+ - instruction
+ - isDeleted
+ - lastHeartbeatAt
+ - maxTopics
+ - name
+ - parentTaskId
+ - priority
+ - projectId
+ - schedulePattern
+ - scheduleTimezone
+ - seq
+ - sortOrder
+ - startedAt
+ - status
+ - totalTopics
+ - updatedAt
+ - visibility
+ - workspaceId
+ additionalProperties: false
+ TaskDetail:
+ type: object
+ properties:
+ activities:
+ type: array
+ items:
+ $ref: "#/components/schemas/TaskDetailActivity"
+ agentId:
+ type:
+ - string
+ - "null"
+ archivedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ automationMode:
+ anyOf:
+ - type: string
+ enum:
+ - heartbeat
+ - schedule
+ - type: "null"
+ checkpoint:
+ type: object
+ properties:
+ onAgentRequest:
+ type: boolean
+ tasks:
+ type: object
+ properties:
+ afterIds:
+ type: array
+ items:
type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
+ afterTasks:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: string
+ identifier:
+ type: string
+ required:
+ - id
+ - identifier
+ additionalProperties: false
+ beforeIds:
+ type: array
+ items:
type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- parameters:
- - in: path
- name: accountId
- schema:
- type: string
- minLength: 1
- required: true
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
- requestBody:
- required: true
- content:
- application/json:
- schema:
+ beforeTasks:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: string
+ identifier:
+ type: string
+ required:
+ - id
+ - identifier
+ additionalProperties: false
+ additionalProperties: false
+ topic:
type: object
properties:
- capabilities:
- type: object
- properties:
- login:
- type: boolean
- receive:
- type: boolean
- send:
- type: boolean
- sign:
- type: boolean
- required:
- - receive
- - send
- displayName:
+ after:
+ type: boolean
+ before:
+ type: boolean
+ additionalProperties: false
+ additionalProperties: false
+ config:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ createdAt:
+ type: string
+ format: date-time
+ createdByUserId:
+ type:
+ - string
+ - "null"
+ dependencies:
+ type: array
+ items:
+ type: object
+ properties:
+ dependsOn:
+ type: string
+ dependsOnId:
+ type: string
+ type:
+ type: string
+ required:
+ - dependsOn
+ - type
+ additionalProperties: false
+ description:
+ type:
+ - string
+ - "null"
+ editorData: {}
+ error:
+ type:
+ - string
+ - "null"
+ files:
+ type: array
+ items:
+ type: object
+ properties:
+ content:
+ type: string
+ downloadUrl:
+ type: string
+ fileType:
+ type: string
+ id:
+ type: string
+ inaccessible:
+ type: boolean
+ name:
+ type: string
+ originalCharCount:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ size:
+ type: number
+ url:
+ type: string
+ required:
+ - fileType
+ - id
+ - name
+ - size
+ - url
+ additionalProperties: false
+ goal:
+ anyOf:
+ - type: object
+ properties:
+ id:
+ type: string
+ title:
+ type: string
+ required:
+ - id
+ - title
+ additionalProperties: false
+ - type: "null"
+ heartbeat:
+ type: object
+ properties:
+ interval:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ lastAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ scheduledAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ timeout:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ additionalProperties: false
+ id:
+ type: string
+ identifier:
+ type: string
+ instruction:
+ type: string
+ labels:
+ type: array
+ items:
+ $ref: "#/components/schemas/TaskLabelRef"
+ name:
+ type:
+ - string
+ - "null"
+ parent:
+ anyOf:
+ - type: object
+ properties:
+ agentId:
type:
- string
- "null"
- metadata:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- delete:
- operationId: revokeAgentAccount
- tags:
- - agents
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $ref: "#/components/schemas/AgentAccount"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- parameters:
- - in: path
- name: accountId
- schema:
- type: string
- minLength: 1
- required: true
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
- - in: query
- name: purgeCredential
- schema:
- type: string
- enum:
- - "true"
- - "false"
- - in: query
- name: release
- schema:
- type: string
- enum:
- - "true"
- - "false"
- /api/v1/agents/{id}/accounts/{accountId}/credential:
- put:
- operationId: setAgentAccountCredential
- tags:
- - agents
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $ref: "#/components/schemas/AgentAccount"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- parameters:
- - in: path
- name: accountId
- schema:
- type: string
- minLength: 1
- required: true
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
- requestBody:
- required: true
+ id:
+ type: string
+ identifier:
+ type: string
+ name:
+ type:
+ - string
+ - "null"
+ required:
+ - identifier
+ - name
+ additionalProperties: false
+ - type: "null"
+ priority:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ projectId:
+ type:
+ - string
+ - "null"
+ schedule:
+ type: object
+ properties:
+ maxExecutions:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ pattern:
+ type:
+ - string
+ - "null"
+ timezone:
+ type:
+ - string
+ - "null"
+ additionalProperties: false
+ startedAt:
+ type: string
+ format: date-time
+ status:
+ type: string
+ subtasks:
+ type: array
+ items:
+ $ref: "#/components/schemas/TaskDetailSubtask"
+ topicCount:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ updatedAt:
+ type: string
+ format: date-time
+ userId:
+ type:
+ - string
+ - "null"
+ verify:
+ anyOf:
+ - type: object
+ properties:
+ enabled:
+ type: boolean
+ maxIterations:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ requirement:
+ type: string
+ verifierAgentId:
+ type: string
+ verifyCriteriaIds:
+ type: array
+ items:
+ type: string
+ verifyRubricId:
+ type: string
+ additionalProperties: false
+ - type: "null"
+ visibility:
+ type: string
+ enum:
+ - private
+ - public
+ workspace:
+ type: array
+ items:
+ $ref: "#/components/schemas/TaskDetailWorkspaceNode"
+ workspaceId:
+ type:
+ - string
+ - "null"
+ required:
+ - identifier
+ - instruction
+ - status
+ TaskDetailActivity:
+ type: object
+ properties:
+ actions: {}
+ agent:
+ anyOf:
+ - type: object
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ backgroundColor:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ name:
+ type:
+ - string
+ - "null"
+ title:
+ type:
+ - string
+ - "null"
+ required:
+ - avatar
+ - backgroundColor
+ - id
+ - title
+ additionalProperties: false
+ - type: "null"
+ agentId:
+ type:
+ - string
+ - "null"
+ artifacts:
+ anyOf:
+ - type: object
+ properties:
+ documents:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: string
+ kind:
+ type:
+ - string
+ - "null"
+ title:
+ type:
+ - string
+ - "null"
+ required:
+ - id
+ - kind
+ - title
+ additionalProperties: false
+ additionalProperties: false
+ - type: "null"
+ assignment:
+ type: object
+ properties:
+ from:
+ anyOf:
+ - type: object
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ name:
+ type:
+ - string
+ - "null"
+ type:
+ type: string
+ enum:
+ - agent
+ - user
+ unresolved:
+ type: boolean
+ required:
+ - id
+ - type
+ additionalProperties: false
+ - type: "null"
+ kind:
+ type: string
+ enum:
+ - agent
+ - member
+ to:
+ anyOf:
+ - type: object
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ name:
+ type:
+ - string
+ - "null"
+ type:
+ type: string
+ enum:
+ - agent
+ - user
+ unresolved:
+ type: boolean
+ required:
+ - id
+ - type
+ additionalProperties: false
+ - type: "null"
+ required:
+ - kind
+ additionalProperties: false
+ author:
+ type: object
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ name:
+ type:
+ - string
+ - "null"
+ type:
+ type: string
+ enum:
+ - agent
+ - user
+ unresolved:
+ type: boolean
+ required:
+ - id
+ - type
+ additionalProperties: false
+ briefType:
+ type: string
+ completedAt:
+ type: string
+ format: date-time
content:
- application/json:
- schema:
- type: object
+ type: string
+ cost:
+ type:
+ - number
+ - "null"
+ createdAt:
+ type: string
+ format: date-time
+ cronJobId:
+ type:
+ - string
+ - "null"
+ editorData: {}
+ files:
+ type: array
+ items:
+ type: object
+ properties:
+ content:
+ type: string
+ downloadUrl:
+ type: string
+ fileType:
+ type: string
+ id:
+ type: string
+ inaccessible:
+ type: boolean
+ name:
+ type: string
+ originalCharCount:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ size:
+ type: number
+ url:
+ type: string
+ required:
+ - fileType
+ - id
+ - name
+ - size
+ - url
+ additionalProperties: false
+ id:
+ type: string
+ operationId:
+ type:
+ - string
+ - "null"
+ priority:
+ type:
+ - string
+ - "null"
+ propertyChange:
+ anyOf:
+ - type: object
+ properties:
+ field:
+ type: string
+ const: automation
+ from:
+ anyOf:
+ - type: object
+ properties:
+ heartbeatInterval:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ maxExecutions:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ mode:
+ anyOf:
+ - type: string
+ enum:
+ - heartbeat
+ - schedule
+ - type: "null"
+ schedulePattern:
+ type:
+ - string
+ - "null"
+ scheduleTimezone:
+ type:
+ - string
+ - "null"
+ required:
+ - heartbeatInterval
+ - maxExecutions
+ - mode
+ - schedulePattern
+ - scheduleTimezone
+ additionalProperties: false
+ - type: "null"
+ to:
+ anyOf:
+ - type: object
+ properties:
+ heartbeatInterval:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ maxExecutions:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ mode:
+ anyOf:
+ - type: string
+ enum:
+ - heartbeat
+ - schedule
+ - type: "null"
+ schedulePattern:
+ type:
+ - string
+ - "null"
+ scheduleTimezone:
+ type:
+ - string
+ - "null"
+ required:
+ - heartbeatInterval
+ - maxExecutions
+ - mode
+ - schedulePattern
+ - scheduleTimezone
+ additionalProperties: false
+ - type: "null"
+ required:
+ - field
+ - from
+ - to
+ additionalProperties: false
+ - type: object
properties:
- credential:
- type: object
- propertyNames:
- type: string
- additionalProperties:
- type: string
- hint:
- type: object
- properties:
- expiresAt:
- type: string
- masked:
- type: string
- username:
- type: string
+ field:
+ type: string
+ const: priority
+ from:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ to:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
required:
- - credential
- /api/v1/api-keys:
- get:
- operationId: getApiV1ApiKeys
- summary: List API keys
- tags:
- - api-keys
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- items:
- $ref: "#/components/schemas/ApiKey"
- type: array
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Invalid request
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- post:
- operationId: postApiV1ApiKeys
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
+ - field
+ - from
+ - to
+ additionalProperties: false
+ - type: object
properties:
- expiresAt:
+ field:
+ type: string
+ const: status
+ from:
anyOf:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
+ enum:
+ - backlog
+ - running
+ - scheduled
+ - paused
+ - completed
+ - failed
+ - canceled
- type: "null"
- name:
+ to:
+ type: string
+ enum:
+ - backlog
+ - running
+ - scheduled
+ - paused
+ - completed
+ - failed
+ - canceled
+ required:
+ - field
+ - from
+ - to
+ additionalProperties: false
+ readAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ resolvedAction:
+ type:
+ - string
+ - "null"
+ resolvedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ resolvedComment:
+ type:
+ - string
+ - "null"
+ runningOperation:
+ anyOf:
+ - type: object
+ properties:
+ assistantMessageId:
+ type: string
+ heteroType:
+ type:
+ - string
+ - "null"
+ operationId:
+ type: string
+ scope:
+ type: string
+ threadId:
+ type:
+ - string
+ - "null"
+ required:
+ - assistantMessageId
+ - operationId
+ additionalProperties: false
+ - type: "null"
+ seq:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ sourceTaskId:
+ type:
+ - string
+ - "null"
+ sourceTaskIdentifier:
+ type:
+ - string
+ - "null"
+ sourceTaskName:
+ type:
+ - string
+ - "null"
+ status:
+ type:
+ - string
+ - "null"
+ summary:
+ type: string
+ taskId:
+ type:
+ - string
+ - "null"
+ time:
+ type: string
+ format: date-time
+ title:
+ type: string
+ topicId:
+ type:
+ - string
+ - "null"
+ trigger:
+ anyOf:
+ - type: string
+ enum:
+ - manual
+ - schedule
+ - heartbeat
+ - goal
+ - type: "null"
+ type:
+ type: string
+ enum:
+ - assignment
+ - brief
+ - comment
+ - created
+ - property
+ - topic
+ userId:
+ type:
+ - string
+ - "null"
+ verify:
+ anyOf:
+ - type: object
+ properties:
+ acceptanceId:
+ type:
+ - string
+ - "null"
+ passed:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ roundIndex:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ runId:
+ type: string
+ status:
+ type:
+ - string
+ - "null"
+ total:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ required:
+ - acceptanceId
+ - passed
+ - roundIndex
+ - runId
+ - status
+ - total
+ additionalProperties: false
+ - type: "null"
+ required:
+ - type
+ TaskDetailSubtask:
+ type: object
+ properties:
+ archivedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ assignee:
+ anyOf:
+ - type: object
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ backgroundColor:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ title:
+ type:
+ - string
+ - "null"
+ required:
+ - avatar
+ - backgroundColor
+ - id
+ - title
+ additionalProperties: false
+ - type: "null"
+ assigneeUserId:
+ type:
+ - string
+ - "null"
+ automationMode:
+ anyOf:
+ - type: string
+ enum:
+ - heartbeat
+ - schedule
+ - type: "null"
+ blockedBy:
+ type: string
+ blockedById:
+ type: string
+ children:
+ type: array
+ items:
+ $ref: "#/components/schemas/TaskDetailSubtask"
+ createdByUserId:
+ type: string
+ heartbeat:
+ type: object
+ properties:
+ interval:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ additionalProperties: false
+ id:
+ type: string
+ identifier:
+ type: string
+ name:
+ type:
+ - string
+ - "null"
+ priority:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ runningTopic:
+ anyOf:
+ - type: object
+ properties:
+ id:
type: string
- minLength: 1
- maxLength: 256
- scopes:
- anyOf:
- - minItems: 1
- type: array
- items:
- type: string
- enum:
- - "*"
- - agent:read
- - agent:write
- - agent:credential:write
- - eval:read
- - eval:write
- - chat:read
- - chat:write
- - model:invoke
- - model:read
- - model:write
- - file:read
- - file:write
- - knowledge:read
- - knowledge:write
- - mcp:read
- - mcp:write
- - usage:read
- - workspace:read
- - workspace:write
- - user:read
- - user:write
- - type: "null"
+ operationId:
+ type:
+ - string
+ - "null"
required:
- - name
+ - id
additionalProperties: false
- responses:
- "201":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- additionalProperties: false
- properties:
- createdAt:
- format: date-time
- type: string
- enabled:
- type:
- - boolean
- - "null"
- expiresAt:
- format: date-time
- type:
- - string
- - "null"
- id:
- type: string
- lastUsedAt:
- format: date-time
- type:
- - string
- - "null"
- name:
- type: string
- scopes:
- items:
- enum:
- - "*"
- - agent:read
- - agent:write
- - agent:credential:write
- - eval:read
- - eval:write
- - chat:read
- - chat:write
- - model:invoke
- - model:read
- - model:write
- - file:read
- - file:write
- - knowledge:read
- - knowledge:write
- - mcp:read
- - mcp:write
- - usage:read
- - workspace:read
- - workspace:write
- - user:read
- - user:write
- type: string
- type:
- - array
- - "null"
- updatedAt:
- format: date-time
- type: string
- key:
- type: string
- required:
- - id
- - name
- - key
- - createdAt
- - updatedAt
- type: object
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - api-keys
- /api/v1/api-keys/{id}:
- get:
- operationId: getApiV1ApiKeysById
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 16
- maxLength: 16
- required: true
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $ref: "#/components/schemas/ApiKey"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - api-keys
- patch:
- operationId: patchApiV1ApiKeysById
- parameters:
- - in: path
- name: id
- schema:
+ - type: "null"
+ schedule:
+ type: object
+ properties:
+ pattern:
+ type:
+ - string
+ - "null"
+ timezone:
+ type:
+ - string
+ - "null"
+ additionalProperties: false
+ status:
+ type: string
+ updatedAt:
+ type: string
+ format: date-time
+ visibility:
+ type: string
+ enum:
+ - private
+ - public
+ required:
+ - identifier
+ - status
+ additionalProperties: false
+ TaskDetailWorkspaceNode:
+ type: object
+ properties:
+ children:
+ type: array
+ items:
+ $ref: "#/components/schemas/TaskDetailWorkspaceNode"
+ createdAt:
+ type: string
+ format: date-time
+ documentId:
+ type: string
+ fileType:
+ type: string
+ inaccessible:
+ type: boolean
+ size:
+ type:
+ - number
+ - "null"
+ sourceTaskId:
+ type: string
+ sourceTaskIdentifier:
+ type:
+ - string
+ - "null"
+ title:
+ type: string
+ required:
+ - documentId
+ additionalProperties: false
+ TaskStatusUpdateResult:
+ type: object
+ properties:
+ allSubtasksDone:
+ type: boolean
+ checkpointTriggered:
+ type: boolean
+ completionDeferred:
+ type: boolean
+ parentTaskId:
+ type:
+ - string
+ - "null"
+ paused:
+ type: array
+ items:
type: string
- minLength: 16
- maxLength: 16
- required: true
- requestBody:
- required: true
+ pausedTasks:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: string
+ identifier:
+ type: string
+ required:
+ - id
+ - identifier
+ additionalProperties: false
+ skippedRunning:
+ type: boolean
+ task:
+ $ref: "#/components/schemas/Task"
+ unlocked:
+ type: array
+ items:
+ type: string
+ unlockedTasks:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: string
+ identifier:
+ type: string
+ required:
+ - id
+ - identifier
+ additionalProperties: false
+ required:
+ - paused
+ - task
+ - unlocked
+ additionalProperties: false
+ TaskRunStarted:
+ type: object
+ properties:
+ agentId:
+ type: string
+ assistantMessageId:
+ type: string
+ autoStarted:
+ type: boolean
+ createdAt:
+ type: string
+ format: date-time
+ createdThreadId:
+ type: string
+ error:
+ type: string
+ errorData:
+ type: object
+ properties:
+ code:
+ type: string
+ const: DEVICE_NOT_FOUND
+ deviceId:
+ type: string
+ retryable:
+ type: boolean
+ const: true
+ scope:
+ type: string
+ enum:
+ - personal
+ - workspace
+ workspaceId:
+ type: string
+ required:
+ - code
+ - deviceId
+ - retryable
+ - scope
+ additionalProperties: false
+ groupMemberContinuation:
+ type: boolean
+ heteroType:
+ type:
+ - string
+ - "null"
+ memberOperationId:
+ type: string
+ message:
+ type: string
+ messageId:
+ type: string
+ operationId:
+ type: string
+ status:
+ type: string
+ success:
+ type: boolean
+ supervisorOperationId:
+ type: string
+ taskId:
+ type: string
+ taskIdentifier:
+ type: string
+ terminalReported:
+ type: boolean
+ timestamp:
+ type: string
+ format: date-time
+ token:
+ type: string
+ topicId:
+ type: string
+ userMessageId:
+ type: string
+ required:
+ - agentId
+ - assistantMessageId
+ - autoStarted
+ - createdAt
+ - message
+ - operationId
+ - status
+ - success
+ - taskId
+ - taskIdentifier
+ - timestamp
+ - topicId
+ - userMessageId
+ additionalProperties: false
+ TaskRun:
+ type: object
+ properties:
+ agentId:
+ type:
+ - string
+ - "null"
+ completedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
content:
- application/json:
- schema:
- type: object
+ type:
+ - string
+ - "null"
+ createdAt:
+ type: string
+ format: date-time
+ keyFindings:
+ type: array
+ items:
+ type: string
+ nextAction:
+ type:
+ - string
+ - "null"
+ notable:
+ type:
+ - boolean
+ - "null"
+ seq:
+ type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ status:
+ type: string
+ summary:
+ type:
+ - string
+ - "null"
+ title:
+ type:
+ - string
+ - "null"
+ topicId:
+ type:
+ - string
+ - "null"
+ trigger:
+ anyOf:
+ - type: string
+ enum:
+ - manual
+ - schedule
+ - heartbeat
+ - goal
+ - type: "null"
+ required:
+ - agentId
+ - completedAt
+ - content
+ - createdAt
+ - keyFindings
+ - nextAction
+ - notable
+ - seq
+ - status
+ - summary
+ - title
+ - topicId
+ - trigger
+ additionalProperties: false
+ Topic:
+ type: object
+ properties:
+ agentId:
+ type:
+ - string
+ - "null"
+ completedAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ content:
+ type:
+ - string
+ - "null"
+ cost:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ createdAt:
+ type: string
+ format: date-time
+ description:
+ type:
+ - string
+ - "null"
+ favorite:
+ type:
+ - boolean
+ - "null"
+ groupId:
+ type:
+ - string
+ - "null"
+ historySummary:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ mode:
+ type:
+ - string
+ - "null"
+ model:
+ type:
+ - string
+ - "null"
+ provider:
+ type:
+ - string
+ - "null"
+ sessionId:
+ type:
+ - string
+ - "null"
+ status:
+ anyOf:
+ - type: string
+ enum:
+ - active
+ - running
+ - waitingForHuman
+ - scheduled
+ - failed
+ - completed
+ - archived
+ - unread
+ - type: "null"
+ title:
+ type:
+ - string
+ - "null"
+ totalCost:
+ type:
+ - number
+ - "null"
+ totalInputTokens:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ totalOutputTokens:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ totalTokens:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ trigger:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ type: string
+ format: date-time
+ usage:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ messageCount:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ user:
+ type: object
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ createdAt:
+ type: string
+ format: date-time
+ email:
+ type:
+ - string
+ - "null"
+ firstName:
+ type:
+ - string
+ - "null"
+ fullName:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ isOnboarded:
+ type:
+ - boolean
+ - "null"
+ lastName:
+ type:
+ - string
+ - "null"
+ phone:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ type: string
+ format: date-time
+ username:
+ type:
+ - string
+ - "null"
+ required:
+ - avatar
+ - createdAt
+ - email
+ - firstName
+ - fullName
+ - id
+ - isOnboarded
+ - lastName
+ - phone
+ - updatedAt
+ - username
+ additionalProperties: false
+ required:
+ - agentId
+ - completedAt
+ - content
+ - cost
+ - createdAt
+ - description
+ - favorite
+ - groupId
+ - historySummary
+ - id
+ - metadata
+ - mode
+ - model
+ - provider
+ - sessionId
+ - status
+ - title
+ - totalCost
+ - totalInputTokens
+ - totalOutputTokens
+ - totalTokens
+ - trigger
+ - updatedAt
+ - usage
+ - messageCount
+ - user
+ additionalProperties: false
+ TopicThread:
+ type: object
+ properties:
+ createdAt:
+ type: string
+ format: date-time
+ id:
+ type: string
+ parentThreadId:
+ type:
+ - string
+ - "null"
+ status:
+ anyOf:
+ - type: string
+ enum:
+ - active
+ - processing
+ - pending
+ - inReview
+ - todo
+ - cancel
+ - completed
+ - failed
+ - type: "null"
+ title:
+ type:
+ - string
+ - "null"
+ topicId:
+ type: string
+ type:
+ type: string
+ enum:
+ - continuation
+ - standalone
+ - isolation
+ - eval
+ updatedAt:
+ type: string
+ format: date-time
+ required:
+ - createdAt
+ - id
+ - parentThreadId
+ - status
+ - title
+ - topicId
+ - type
+ - updatedAt
+ additionalProperties: false
+ User:
+ type: object
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ createdAt:
+ type: string
+ format: date-time
+ email:
+ type:
+ - string
+ - "null"
+ firstName:
+ type:
+ - string
+ - "null"
+ fullName:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ isOnboarded:
+ type:
+ - boolean
+ - "null"
+ lastName:
+ type:
+ - string
+ - "null"
+ messageCount:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ phone:
+ type:
+ - string
+ - "null"
+ roles:
+ type: array
+ items:
+ $ref: "#/components/schemas/Role"
+ updatedAt:
+ type: string
+ format: date-time
+ username:
+ type:
+ - string
+ - "null"
+ required:
+ - avatar
+ - createdAt
+ - email
+ - firstName
+ - fullName
+ - id
+ - isOnboarded
+ - lastName
+ - phone
+ - roles
+ - updatedAt
+ - username
+ additionalProperties: false
+ UserIdentity:
+ type: object
+ properties:
+ id:
+ type: string
+ required:
+ - id
+ additionalProperties: false
+ UserList:
+ type: object
+ properties:
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ users:
+ type: array
+ items:
+ $ref: "#/components/schemas/User"
+ required:
+ - total
+ - users
+ additionalProperties: false
+ UserRole:
+ type: object
+ properties:
+ expiresAt:
+ anyOf:
+ - type: string
+ format: date-time
+ - type: "null"
+ roleDisplayName:
+ type: string
+ roleId:
+ type: string
+ roleName:
+ type: string
+ required:
+ - expiresAt
+ - roleDisplayName
+ - roleId
+ - roleName
+ additionalProperties: false
+ Usage:
+ type: object
+ properties:
+ available:
+ type: boolean
+ currency:
+ type: string
+ const: USD
+ daily:
+ type: array
+ items:
+ type: object
+ properties:
+ date:
+ type: string
+ value:
+ type: number
+ required:
+ - date
+ - value
+ additionalProperties: false
+ period:
+ type: object
+ properties:
+ since:
+ type: string
+ format: date-time
+ until:
+ type: string
+ format: date-time
+ required:
+ - since
+ - until
+ additionalProperties: false
+ quota:
+ anyOf:
+ - type: object
properties:
- enabled:
- type: boolean
- expiresAt:
+ limit:
+ type:
+ - number
+ - "null"
+ remaining:
+ type:
+ - number
+ - "null"
+ resetsAt:
anyOf:
- type: string
format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
- type: "null"
- name:
+ source:
type: string
- minLength: 1
- maxLength: 256
+ enum:
+ - personal
+ - workspace_pool
+ - member_budget
+ used:
+ type: number
+ usedRatio:
+ type:
+ - number
+ - "null"
+ required:
+ - limit
+ - remaining
+ - resetsAt
+ - source
+ - used
+ - usedRatio
additionalProperties: false
+ - type: "null"
+ remainingBalance:
+ type:
+ - number
+ - "null"
+ scope:
+ type: string
+ enum:
+ - personal
+ - workspace
+ spent:
+ type: number
+ usageByType:
+ type: array
+ items:
+ type: object
+ properties:
+ count:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ spend:
+ type: number
+ type:
+ type: string
+ required:
+ - count
+ - spend
+ - type
+ additionalProperties: false
+ required:
+ - available
+ - currency
+ - daily
+ - period
+ - quota
+ - remainingBalance
+ - scope
+ - spent
+ - usageByType
+ additionalProperties: false
+ securitySchemes:
+ bearerAuth:
+ bearerFormat: API Key (sk-lh-...) or OIDC JWT
+ scheme: bearer
+ type: http
+info:
+ title: LobeHub API
+ description: LobeHub platform REST API. Generated from `packages/openapi` routes
+ — do not edit openapi.yml by hand; run `bun generate:openapi` instead.
+ version: 1.0.0
+security:
+ - bearerAuth: []
+servers:
+ - description: LobeHub Cloud
+ url: https://app.lobehub.com
+paths:
+ /api/v1/health:
+ get:
+ operationId: getApiV1Health
+ summary: Health check
+ tags:
+ - health
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
- data:
- $ref: "#/components/schemas/ApiKey"
- message:
+ service:
type: string
- success:
- const: true
- type: boolean
+ status:
+ type: string
+ const: ok
timestamp:
- format: date-time
type: string
+ format: date-time
required:
- - success
+ - service
+ - status
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
+ /api/v1/agent-groups:
+ get:
+ operationId: getApiV1AgentGroups
+ summary: List agent groups
tags:
- - api-keys
- delete:
- operationId: deleteApiV1ApiKeysById
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 16
- maxLength: 16
- required: true
+ - agent-groups
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - object
- - "null"
+ type: array
+ items:
+ $ref: "#/components/schemas/AgentGroup"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - api-keys
- /api/v1/audio/speech:
- post:
- operationId: postApiV1AudioSpeech
- description: "OpenAI-compatible text-to-speech. Point an OpenAI SDK at `/api/v1`
- and call `audio.speech.create`. `model` takes `provider/model` (for
- example `lobehub/speech-2.8-hd`) or a bare model id; the optional
- `provider` and `params` (emotion, pitch, volume, sampleRate) are LobeHub
- extensions. Returns the audio bytes; usage is reported in `X-LobeHub-*`
- headers. Synthesis errors use OpenAI's `{ error: { message, type, code,
- param } }` body; authentication and permission errors use the platform
- `ApiError` envelope."
- responses:
- "200":
- content:
- audio/aac:
- schema:
- format: binary
- type: string
- audio/mpeg:
- schema:
- format: binary
- type: string
- audio/opus:
- schema:
- format: binary
- type: string
- description: Synthesized audio
- "400":
- content:
- application/json:
- schema:
- properties:
- error:
- properties:
- code:
- type:
- - string
- - "null"
- message:
- type: string
- param:
- type:
- - string
- - "null"
- type:
- type: string
- required:
- - message
- - type
- type: object
- required:
- - error
- type: object
- description: Invalid request, unsupported format or invalid params
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "402":
- content:
- application/json:
- schema:
- properties:
- error:
- properties:
- code:
- type:
- - string
- - "null"
- message:
- type: string
- param:
- type:
- - string
- - "null"
- type:
- type: string
- required:
- - message
- - type
- type: object
- required:
- - error
- type: object
- description: Insufficient balance
- "403":
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
+ description: Authentication required
+ "403":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
+ description: Insufficient permission
+ "500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Internal server error
+ post:
+ operationId: postApiV1AgentGroups
+ summary: Create an agent group
+ tags:
+ - agent-groups
+ responses:
+ "201":
content:
application/json:
schema:
+ type: object
properties:
- error:
- properties:
- code:
- type:
- - string
- - "null"
- message:
- type: string
- param:
- type:
- - string
- - "null"
- type:
- type: string
- required:
- - message
- - type
- type: object
+ data:
+ $ref: "#/components/schemas/CreatedAgentGroup"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
required:
- - error
- type: object
- description: Upstream provider rate limit
- "500":
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Internal server error
- "502":
+ description: Invalid request
+ "401":
content:
application/json:
schema:
- properties:
- error:
- properties:
- code:
- type:
- - string
- - "null"
- message:
- type: string
- param:
- type:
- - string
- - "null"
- type:
- type: string
- required:
- - message
- - type
- type: object
- required:
- - error
- type: object
- description: Upstream provider error
- summary: Create speech
- tags:
- - audio
- /api/v1/chat:
- post:
- operationId: postApiV1Chat
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
requestBody:
required: true
content:
@@ -4291,109 +9183,50 @@ paths:
schema:
type: object
properties:
- frequency_penalty:
- type: number
- minimum: -2
- maximum: 2
- max_tokens:
- anyOf:
- - type: integer
- minimum: 1
- maximum: 1000000
- - type: "null"
- messages:
- minItems: 1
- maxItems: 1000
- type: array
- items:
- type: object
- properties:
- content:
- type: string
- minLength: 1
- maxLength: 1000000
- role:
- type: string
- enum:
- - user
- - assistant
- - system
- required:
- - content
- - role
- model:
- anyOf:
- - type: string
- minLength: 1
- maxLength: 150
- - type: "null"
- presence_penalty:
- type: number
- minimum: -2
- maximum: 2
- provider:
- anyOf:
- - type: string
- minLength: 1
- maxLength: 64
- - type: "null"
- stream:
+ name:
+ type: string
+ minLength: 1
+ sort:
type:
- - boolean
+ - number
- "null"
- temperature:
- anyOf:
- - type: number
- minimum: 0
- maximum: 2
- - type: "null"
- top_p:
- type: number
- minimum: 0
- maximum: 1
required:
- - messages
+ - name
+ /api/v1/agent-groups/{id}:
+ get:
+ operationId: getApiV1AgentGroupsById
+ summary: Get an agent group
+ tags:
+ - agent-groups
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/ChatResponse"
+ $ref: "#/components/schemas/AgentGroup"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -4412,110 +9245,53 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - chat
- /api/v1/chat/translate:
- post:
- operationId: postApiV1ChatTranslate
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- from:
- type: string
- minLength: 1
- maxLength: 32
- model:
- anyOf:
- - type: string
- minLength: 1
- maxLength: 150
- - type: "null"
- provider:
- anyOf:
- - type: string
- minLength: 1
- maxLength: 64
- - type: "null"
- text:
- type: string
- minLength: 1
- maxLength: 1000000
- to:
- type: string
- minLength: 1
- maxLength: 32
- required:
- - text
- - to
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ required: true
+ patch:
+ operationId: patchApiV1AgentGroupsById
+ summary: Update an agent group
+ tags:
+ - agent-groups
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: false
- properties:
- translatedText:
- type: string
- required:
- - translatedText
- type: object
+ $ref: "#/components/schemas/AgentGroup"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -4528,35 +9304,19 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - chat
- /api/v1/chat/generate-reply:
- post:
- operationId: postApiV1ChatGenerateReply
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ required: true
requestBody:
required: true
content:
@@ -4564,183 +9324,49 @@ paths:
schema:
type: object
properties:
- agentId:
- anyOf:
- - type: string
- minLength: 1
- maxLength: 64
- - type: "null"
- chatConfig:
- anyOf:
- - type: object
- properties:
- disableContextCaching:
- type:
- - boolean
- - "null"
- displayMode:
- anyOf:
- - type: string
- enum:
- - chat
- - docs
- - type: "null"
- enableCompressHistory:
- type:
- - boolean
- - "null"
- enableHistoryCount:
- type:
- - boolean
- - "null"
- enableMaxTokens:
- type:
- - boolean
- - "null"
- enableReasoning:
- type:
- - boolean
- - "null"
- enableReasoningEffort:
- type:
- - boolean
- - "null"
- historyCount:
- anyOf:
- - type: integer
- minimum: 0
- maximum: 1000
- - type: "null"
- inputTemplate:
- anyOf:
- - type: string
- maxLength: 100000
- - type: "null"
- reasoningBudgetToken:
- anyOf:
- - type: integer
- minimum: 0
- maximum: 1000000
- - type: "null"
- reasoningEffort:
- anyOf:
- - type: string
- enum:
- - low
- - medium
- - high
- - type: "null"
- searchMode:
- anyOf:
- - type: string
- enum:
- - off
- - on
- - auto
- - type: "null"
- thinkingBudget:
- anyOf:
- - type: integer
- minimum: 0
- maximum: 1000000
- - type: "null"
- useModelBuiltinSearch:
- type:
- - boolean
- - "null"
- - type: "null"
- conversationHistory:
- maxItems: 1000
- type: array
- items:
- type: object
- properties:
- content:
- type: string
- minLength: 1
- maxLength: 1000000
- role:
- type: string
- enum:
- - user
- - assistant
- - system
- required:
- - content
- - role
- model:
- anyOf:
- - type: string
- minLength: 1
- maxLength: 150
- - type: "null"
- provider:
- anyOf:
- - type: string
- minLength: 1
- maxLength: 64
- - type: "null"
- sessionId:
+ name:
anyOf:
- type: string
minLength: 1
- maxLength: 64
- type: "null"
- userMessage:
- type: string
- minLength: 1
- maxLength: 1000000
- required:
- - conversationHistory
- - sessionId
- - userMessage
+ sort:
+ type:
+ - number
+ - "null"
+ delete:
+ operationId: deleteApiV1AgentGroupsById
+ summary: Delete an agent group
+ tags:
+ - agent-groups
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: false
- properties:
- reply:
- type: string
- required:
- - reply
- type: object
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -4753,36 +9379,77 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ required: true
+ /api/v1/agents:
+ get:
+ operationId: getApiV1Agents
+ summary: List agents
+ tags:
+ - agents
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/AgentList"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
+ description: Invalid request
+ "401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Authentication required
+ "403":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Insufficient permission
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - chat
- /api/v1/chat-groups:
- get:
- operationId: getApiV1ChatGroups
parameters:
+ - in: query
+ name: keyword
+ schema:
+ type: string
- in: query
name: page
schema:
@@ -4798,58 +9465,40 @@ paths:
enum:
- "true"
- "false"
+ post:
+ operationId: postApiV1Agents
+ summary: Create an agent
+ tags:
+ - agents
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- properties:
- chatGroups:
- items:
- $ref: "#/components/schemas/ChatGroup"
- type: array
- total:
- minimum: 0
- type: integer
- required:
- - chatGroups
- type: object
+ $ref: "#/components/schemas/Agent"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -4862,34 +9511,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - chat-groups
- post:
- operationId: postApiV1ChatGroups
requestBody:
required: true
content:
@@ -4897,83 +9524,308 @@ paths:
schema:
type: object
properties:
+ agencyConfig:
+ anyOf:
+ - type: object
+ properties:
+ enableGraphMode:
+ type:
+ - boolean
+ - "null"
+ graph:
+ anyOf:
+ - type: object
+ properties:
+ description:
+ type: string
+ fields:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: object
+ properties:
+ desc:
+ type: string
+ minLength: 1
+ schema:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ required:
+ - desc
+ - schema
+ maxInstructionCount:
+ type: integer
+ exclusiveMinimum: 0
+ maximum: 9007199254740991
+ name:
+ type: string
+ minLength: 1
+ nodes:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ oneOf:
+ - type: object
+ properties:
+ allowedToolApiNames:
+ type: array
+ items:
+ type: string
+ minLength: 1
+ maxAgentSteps:
+ type: integer
+ exclusiveMinimum: 0
+ maximum: 9007199254740991
+ type:
+ type: string
+ const: agent
+ required:
+ - type
+ - type: object
+ properties:
+ type:
+ type: string
+ const: llm
+ required:
+ - type
+ terminal:
+ type: string
+ minLength: 1
+ edges:
+ type: array
+ items:
+ type: object
+ properties:
+ condition:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ from:
+ type: string
+ input:
+ type: object
+ properties:
+ fields:
+ type: array
+ items:
+ type: object
+ properties:
+ desc:
+ type: string
+ minLength: 1
+ field:
+ type: string
+ minLength: 1
+ required:
+ type: boolean
+ from:
+ type: string
+ minLength: 1
+ required:
+ - field
+ - from
+ output:
+ type: object
+ properties:
+ fields:
+ type: array
+ items:
+ type: object
+ properties:
+ desc:
+ type: string
+ minLength: 1
+ field:
+ type: string
+ minLength: 1
+ required:
+ type: boolean
+ required:
+ - field
+ instruction:
+ type: string
+ minLength: 1
+ instruction:
+ type: string
+ minLength: 1
+ maxTraversals:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ to:
+ type: string
+ required:
+ - from
+ - instruction
+ - to
+ required:
+ - fields
+ - name
+ - nodes
+ - terminal
+ - edges
+ - type: "null"
+ - type: "null"
avatar:
type:
- string
- "null"
- backgroundColor:
+ chatConfig:
+ anyOf:
+ - type: object
+ properties:
+ disableContextCaching:
+ type:
+ - boolean
+ - "null"
+ displayMode:
+ anyOf:
+ - type: string
+ enum:
+ - chat
+ - docs
+ - type: "null"
+ enableCompressHistory:
+ type:
+ - boolean
+ - "null"
+ enableHistoryCount:
+ type:
+ - boolean
+ - "null"
+ enableMaxTokens:
+ type:
+ - boolean
+ - "null"
+ enableReasoning:
+ type:
+ - boolean
+ - "null"
+ enableReasoningEffort:
+ type:
+ - boolean
+ - "null"
+ historyCount:
+ type:
+ - number
+ - "null"
+ reasoningBudgetToken:
+ type:
+ - number
+ - "null"
+ reasoningEffort:
+ anyOf:
+ - type: string
+ enum:
+ - low
+ - medium
+ - high
+ - type: "null"
+ searchFCModel:
+ type:
+ - string
+ - "null"
+ searchMode:
+ anyOf:
+ - type: string
+ enum:
+ - disabled
+ - enabled
+ - type: "null"
+ useModelBuiltinSearch:
+ type:
+ - boolean
+ - "null"
+ - type: "null"
+ description:
type:
- string
- "null"
- clientId:
+ model:
type:
- string
- "null"
- members:
- maxItems: 50
+ plugins:
+ maxItems: 100
type: array
items:
type: object
properties:
- agentId:
+ identifier:
type: string
minLength: 1
- role:
+ maxLength: 255
+ mode:
type: string
enum:
- - participant
- - assistant
+ - pinned
+ - auto
+ - disabled
required:
- - agentId
+ - identifier
+ additionalProperties: false
+ params:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
personal:
type: boolean
+ provider:
+ type:
+ - string
+ - "null"
+ systemRole:
+ type:
+ - string
+ - "null"
title:
type: string
minLength: 1
required:
- - members
- title
+ /api/v1/agents/{id}:
+ get:
+ operationId: getApiV1AgentsById
+ summary: Get an agent with its mounted files and knowledge bases
+ tags:
+ - agents
responses:
- "201":
+ "200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/ChatGroup"
+ $ref: "#/components/schemas/AgentDetail"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -4992,29 +9844,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - chat-groups
- /api/v1/chat-groups/{id}:
- get:
- operationId: getApiV1ChatGroupsById
parameters:
- in: path
name: id
@@ -5022,47 +9857,40 @@ paths:
type: string
minLength: 1
required: true
+ patch:
+ operationId: patchApiV1AgentsById
+ summary: Update an agent
+ tags:
+ - agents
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/ChatGroup"
+ $ref: "#/components/schemas/Agent"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -5075,34 +9903,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - chat-groups
- patch:
- operationId: patchApiV1ChatGroupsById
parameters:
- in: path
name: id
@@ -5117,157 +9923,305 @@ paths:
schema:
type: object
properties:
+ agencyConfig:
+ anyOf:
+ - type: object
+ properties:
+ enableGraphMode:
+ type:
+ - boolean
+ - "null"
+ graph:
+ anyOf:
+ - type: object
+ properties:
+ description:
+ type: string
+ fields:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: object
+ properties:
+ desc:
+ type: string
+ minLength: 1
+ schema:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ required:
+ - desc
+ - schema
+ maxInstructionCount:
+ type: integer
+ exclusiveMinimum: 0
+ maximum: 9007199254740991
+ name:
+ type: string
+ minLength: 1
+ nodes:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ oneOf:
+ - type: object
+ properties:
+ allowedToolApiNames:
+ type: array
+ items:
+ type: string
+ minLength: 1
+ maxAgentSteps:
+ type: integer
+ exclusiveMinimum: 0
+ maximum: 9007199254740991
+ type:
+ type: string
+ const: agent
+ required:
+ - type
+ - type: object
+ properties:
+ type:
+ type: string
+ const: llm
+ required:
+ - type
+ terminal:
+ type: string
+ minLength: 1
+ edges:
+ type: array
+ items:
+ type: object
+ properties:
+ condition:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ from:
+ type: string
+ input:
+ type: object
+ properties:
+ fields:
+ type: array
+ items:
+ type: object
+ properties:
+ desc:
+ type: string
+ minLength: 1
+ field:
+ type: string
+ minLength: 1
+ required:
+ type: boolean
+ from:
+ type: string
+ minLength: 1
+ required:
+ - field
+ - from
+ output:
+ type: object
+ properties:
+ fields:
+ type: array
+ items:
+ type: object
+ properties:
+ desc:
+ type: string
+ minLength: 1
+ field:
+ type: string
+ minLength: 1
+ required:
+ type: boolean
+ required:
+ - field
+ instruction:
+ type: string
+ minLength: 1
+ instruction:
+ type: string
+ minLength: 1
+ maxTraversals:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ to:
+ type: string
+ required:
+ - from
+ - instruction
+ - to
+ required:
+ - fields
+ - name
+ - nodes
+ - terminal
+ - edges
+ - type: "null"
+ - type: "null"
avatar:
type:
- string
- "null"
- backgroundColor:
+ chatConfig:
+ anyOf:
+ - type: object
+ properties:
+ disableContextCaching:
+ type:
+ - boolean
+ - "null"
+ displayMode:
+ anyOf:
+ - type: string
+ enum:
+ - chat
+ - docs
+ - type: "null"
+ enableCompressHistory:
+ type:
+ - boolean
+ - "null"
+ enableHistoryCount:
+ type:
+ - boolean
+ - "null"
+ enableMaxTokens:
+ type:
+ - boolean
+ - "null"
+ enableReasoning:
+ type:
+ - boolean
+ - "null"
+ enableReasoningEffort:
+ type:
+ - boolean
+ - "null"
+ historyCount:
+ type:
+ - number
+ - "null"
+ reasoningBudgetToken:
+ type:
+ - number
+ - "null"
+ reasoningEffort:
+ anyOf:
+ - type: string
+ enum:
+ - low
+ - medium
+ - high
+ - type: "null"
+ searchFCModel:
+ type:
+ - string
+ - "null"
+ searchMode:
+ anyOf:
+ - type: string
+ enum:
+ - disabled
+ - enabled
+ - type: "null"
+ useModelBuiltinSearch:
+ type:
+ - boolean
+ - "null"
+ - type: "null"
+ description:
type:
- string
- "null"
- description:
+ model:
type:
- string
- "null"
+ plugins:
+ maxItems: 100
+ type: array
+ items:
+ type: object
+ properties:
+ identifier:
+ type: string
+ minLength: 1
+ maxLength: 255
+ mode:
+ type: string
+ enum:
+ - pinned
+ - auto
+ - disabled
+ required:
+ - identifier
+ additionalProperties: false
+ params:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
personal:
type: boolean
- pinned:
- type: boolean
- title:
- type: string
- minLength: 1
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $ref: "#/components/schemas/ChatGroup"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - chat-groups
+ provider:
+ type:
+ - string
+ - "null"
+ systemRole:
+ type:
+ - string
+ - "null"
+ title:
+ type: string
+ minLength: 1
delete:
- operationId: deleteApiV1ChatGroupsById
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
+ operationId: deleteApiV1AgentsById
+ summary: Delete an agent
+ tags:
+ - agents
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - object
- - "null"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -5280,35 +10234,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - chat-groups
- /api/v1/chat-groups/{id}/members:
- post:
- operationId: postApiV1ChatGroupsByIdMembers
parameters:
- in: path
name: id
@@ -5316,63 +10247,41 @@ paths:
type: string
minLength: 1
required: true
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- agentIds:
- minItems: 1
- maxItems: 50
- type: array
- items:
- type: string
- minLength: 1
- required:
- - agentIds
+ /api/v1/agents/{id}/duplicate:
+ post:
+ operationId: postApiV1AgentsByIdDuplicate
+ summary: Duplicate an agent
+ tags:
+ - agents
responses:
- "200":
+ "201":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/ChatGroup"
+ $ref: "#/components/schemas/AgentDetail"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -5391,28 +10300,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - chat-groups
- delete:
- operationId: deleteApiV1ChatGroupsByIdMembers
parameters:
- in: path
name: id
@@ -5427,56 +10320,46 @@ paths:
schema:
type: object
properties:
- agentIds:
- minItems: 1
- maxItems: 50
- type: array
- items:
- type: string
- minLength: 1
- required:
- - agentIds
+ title:
+ type: string
+ minLength: 1
+ maxLength: 255
+ additionalProperties: false
+ /api/v1/agents/{id}/accounts:
+ get:
+ operationId: listAgentAccounts
+ summary: List an agent's accounts
+ tags:
+ - agents
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/ChatGroup"
+ $ref: "#/components/schemas/AgentAccountList"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -5492,156 +10375,69 @@ paths:
"404":
content:
application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - chat-groups
- /api/v1/eval/runs:
- post:
- operationId: postApiV1EvalRuns
- description: Queues an asynchronous QStash-backed evaluation run and returns
- immediately.
- summary: Create an eval run
- tags:
- - eval
- responses:
- "202":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- config:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- executionMode:
- type: string
- enum:
- - internal
- - external
- datasetId:
- type: string
- experimentId:
- type:
- - string
- - "null"
- parentRunId:
- type:
- - string
- - "null"
- status:
- type: string
- enum:
- - idle
- - pending
- - running
- - external
- - completed
- - failed
- - aborted
- targetAgentId:
- type:
- - string
- - "null"
- name:
- type:
- - string
- - "null"
- metrics:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- startedAt:
- anyOf:
- - type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- - type: "null"
- required:
- - id
- - createdAt
- - updatedAt
- - config
- - executionMode
- - datasetId
- - experimentId
- - parentRunId
- - status
- - targetAgentId
- - name
- - metrics
- - startedAt
- additionalProperties: false
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ required: true
+ - in: query
+ name: kind
+ schema:
+ type: string
+ enum:
+ - mail
+ - wallet
+ - service
+ - in: query
+ name: provider
+ schema:
+ type: string
+ minLength: 1
+ post:
+ operationId: createAgentAccount
+ summary: Mount or provision an agent account
+ tags:
+ - agents
+ responses:
+ "201":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/AgentAccount"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -5666,239 +10462,111 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ required: true
requestBody:
required: true
content:
application/json:
schema:
- type: object
- properties:
- config:
- type: object
+ anyOf:
+ - type: object
properties:
- maxConcurrency:
- type: integer
- minimum: 1
- maximum: 100
- caseSelection:
- oneOf:
- - type: object
- properties:
- mode:
- type: string
- const: all
- required:
- - mode
- additionalProperties: false
- - type: object
- properties:
- mode:
- type: string
- enum:
- - include
- - exclude
- caseIds:
- minItems: 1
- maxItems: 10000
- type: array
- items:
- type: string
- minLength: 1
- required:
- - mode
- - caseIds
- additionalProperties: false
- k:
- type: integer
- minimum: 1
- maximum: 10
- maxSteps:
- type: integer
- minimum: 1
- maximum: 1000
- timeout:
- type: integer
- minimum: 60000
- maximum: 21600000
+ capabilities:
+ type: object
+ properties:
+ login:
+ type: boolean
+ receive:
+ type: boolean
+ send:
+ type: boolean
+ sign:
+ type: boolean
+ required:
+ - receive
+ - send
+ displayName:
+ type: string
+ minLength: 1
+ identifier:
+ type: string
+ minLength: 1
+ kind:
+ type: string
+ enum:
+ - mail
+ - wallet
+ - service
+ metadata:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ provider:
+ type: string
+ minLength: 1
+ required:
+ - identifier
+ - kind
+ - provider
+ - type: object
+ properties:
+ displayName:
+ type: string
+ minLength: 1
+ provider:
+ type: string
+ minLength: 1
+ required:
+ - provider
additionalProperties: false
- executionMode:
- type: string
- enum:
- - internal
- - external
- experimentId:
- type: string
- minLength: 1
- maxLength: 128
- datasetId:
- type: string
- minLength: 1
- maxLength: 128
- id:
- type: string
- minLength: 1
- maxLength: 128
- name:
- type: string
- minLength: 1
- maxLength: 255
- targetAgentId:
- type: string
- minLength: 1
- maxLength: 128
- required:
- - datasetId
- - targetAgentId
- additionalProperties: false
+ /api/v1/agents/{id}/accounts/{accountId}:
get:
- operationId: getApiV1EvalRuns
- summary: List eval runs
+ operationId: getAgentAccount
+ summary: Get an agent account
tags:
- - eval
+ - agents
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- runs:
- type: array
- items:
- type: object
- properties:
- id:
- type: string
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- config:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- executionMode:
- type: string
- enum:
- - internal
- - external
- datasetId:
- type: string
- experimentId:
- type:
- - string
- - "null"
- parentRunId:
- type:
- - string
- - "null"
- status:
- type: string
- enum:
- - idle
- - pending
- - running
- - external
- - completed
- - failed
- - aborted
- targetAgentId:
- type:
- - string
- - "null"
- name:
- type:
- - string
- - "null"
- metrics:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- startedAt:
- anyOf:
- - type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- - type: "null"
- required:
- - id
- - createdAt
- - updatedAt
- - config
- - executionMode
- - datasetId
- - experimentId
- - parentRunId
- - status
- - targetAgentId
- - name
- - metrics
- - startedAt
- additionalProperties: false
- total:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- required:
- - runs
- - total
- additionalProperties: false
+ $ref: "#/components/schemas/AgentAccount"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -5917,18 +10585,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -5936,161 +10592,52 @@ paths:
$ref: "#/components/schemas/ApiError"
description: Internal server error
parameters:
- - in: query
- name: limit
- schema:
- type: integer
- minimum: 1
- maximum: 100
- - in: query
- name: offset
- schema:
- type: integer
- minimum: 0
- maximum: 1000000
- - in: query
- name: page
- schema:
- type: integer
- minimum: 1
- maximum: 1000000
- - in: query
- name: pageSize
- schema:
- type: integer
- minimum: 1
- maximum: 100
- - in: query
- name: experimentId
+ - in: path
+ name: accountId
schema:
type: string
minLength: 1
- maxLength: 128
- - in: query
- name: datasetId
+ required: true
+ - in: path
+ name: id
schema:
type: string
minLength: 1
- maxLength: 128
- - in: query
- name: status
- schema:
- type: string
- enum:
- - idle
- - pending
- - running
- - completed
- - failed
- - aborted
- - external
- /api/v1/eval/runs/{id}/topics:
- get:
- operationId: getApiV1EvalRunsByIdTopics
- summary: List topic results of an eval run
+ required: true
+ patch:
+ operationId: updateAgentAccount
+ summary: Update an agent account
tags:
- - eval
+ - agents
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- topics:
- type: array
- items:
- type: object
- properties:
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- evalResult:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- passed:
- type:
- - boolean
- - "null"
- runId:
- type: string
- score:
- type:
- - number
- - "null"
- status:
- type:
- - string
- - "null"
- testCaseId:
- type: string
- topicId:
- type: string
- input:
- type: string
- required:
- - createdAt
- - evalResult
- - passed
- - runId
- - score
- - status
- - testCaseId
- - topicId
- - input
- additionalProperties: false
- total:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- runId:
- type: string
- required:
- - topics
- - total
- - runId
- additionalProperties: false
+ $ref: "#/components/schemas/AgentAccount"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -6115,12 +10662,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -6129,166 +10670,83 @@ paths:
description: Internal server error
parameters:
- in: path
- name: id
+ name: accountId
schema:
type: string
minLength: 1
- maxLength: 128
required: true
- - in: query
- name: limit
- schema:
- type: integer
- minimum: 1
- maximum: 100
- - in: query
- name: offset
- schema:
- type: integer
- minimum: 0
- maximum: 1000000
- - in: query
- name: page
- schema:
- type: integer
- minimum: 1
- maximum: 1000000
- - in: query
- name: pageSize
- schema:
- type: integer
- minimum: 1
- maximum: 100
- /api/v1/eval/runs/{id}:
- get:
- operationId: getApiV1EvalRunsById
- parameters:
- in: path
name: id
schema:
type: string
minLength: 1
- maxLength: 128
required: true
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- config:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- executionMode:
- type: string
- enum:
- - internal
- - external
- datasetId:
- type: string
- experimentId:
- type:
- - string
- - "null"
- parentRunId:
- type:
- - string
- - "null"
- status:
- type: string
- enum:
- - idle
- - pending
- - running
- - external
- - completed
- - failed
- - aborted
- targetAgentId:
- type:
- - string
- - "null"
- name:
- type:
- - string
- - "null"
- metrics:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- startedAt:
- anyOf:
- - type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- - type: "null"
- required:
- - id
- - createdAt
- - updatedAt
- - config
- - executionMode
- - datasetId
- - experimentId
- - parentRunId
- - status
- - targetAgentId
- - name
- - metrics
- - startedAt
- additionalProperties: false
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ capabilities:
+ type: object
+ properties:
+ login:
+ type: boolean
+ receive:
+ type: boolean
+ send:
+ type: boolean
+ sign:
+ type: boolean
+ required:
+ - receive
+ - send
+ displayName:
+ type:
+ - string
+ - "null"
+ metadata:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ delete:
+ operationId: revokeAgentAccount
+ description: Releases the account and marks it revoked. The row is kept for
+ audit, so the response is the revoked account.
+ summary: Revoke an agent account
+ tags:
+ - agents
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/AgentAccount"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -6307,159 +10765,76 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - eval
- /api/v1/eval/runs/{id}/results:
- get:
- operationId: getApiV1EvalRunsByIdResults
parameters:
- in: path
- name: id
+ name: accountId
schema:
type: string
minLength: 1
- maxLength: 128
required: true
- - in: query
- name: limit
- schema:
- type: integer
- minimum: 1
- maximum: 100
- - in: query
- name: offset
+ - in: path
+ name: id
schema:
- type: integer
- minimum: 0
- maximum: 1000000
+ type: string
+ minLength: 1
+ required: true
- in: query
- name: page
+ name: purgeCredential
schema:
- type: integer
- minimum: 1
- maximum: 1000000
+ type: string
+ enum:
+ - "true"
+ - "false"
- in: query
- name: pageSize
+ name: release
schema:
- type: integer
- minimum: 1
- maximum: 100
+ type: string
+ enum:
+ - "true"
+ - "false"
+ /api/v1/agents/{id}/accounts/{accountId}/credential:
+ put:
+ operationId: setAgentAccountCredential
+ description: "Write-only: the response carries the non-secret hint and
+ `hasCredential`, never the secret."
+ summary: Write an agent account credential
+ tags:
+ - agents
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- results:
- type: array
- items:
- type: object
- properties:
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- passed:
- type:
- - boolean
- - "null"
- score:
- type:
- - number
- - "null"
- status:
- type:
- - string
- - "null"
- testCaseId:
- type: string
- topicId:
- type: string
- input:
- type: string
- result:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- required:
- - createdAt
- - passed
- - score
- - status
- - testCaseId
- - topicId
- - input
- - result
- additionalProperties: false
- total:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- runId:
- type: string
- required:
- - results
- - total
- - runId
- additionalProperties: false
+ $ref: "#/components/schemas/AgentAccount"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -6478,123 +10853,80 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
+ parameters:
+ - in: path
+ name: accountId
+ schema:
+ type: string
+ minLength: 1
+ required: true
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ required: true
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ credential:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties:
+ type: string
+ hint:
+ type: object
+ properties:
+ expiresAt:
+ type: string
+ masked:
+ type: string
+ username:
+ type: string
+ required:
+ - credential
+ /api/v1/api-keys:
+ get:
+ operationId: getApiV1ApiKeys
+ summary: List API keys
tags:
- - eval
- post:
- operationId: postApiV1EvalRunsByIdResults
- summary: reportBatch
- tags:
- - eval
- description: "Claim: one pending worker succeeds, others receive 409. Reports:
- identical replays succeed; different results conflict. Batches are
- atomic. External workers can supply testCaseId to associate their own
- topic with a dataset case on first report. Retry: only terminal runs,
- concurrent repeats conflict."
+ - api-keys
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- items:
- type: array
- items:
- type: object
- properties:
- idempotent:
- type: boolean
- reportedThreads:
- type: number
- runId:
- type: string
- runStatus:
- type: string
- success:
- type: boolean
- threadId:
- type: string
- topicFinalized:
- type: boolean
- topicId:
- type: string
- totalThreads:
- type: number
- required:
- - idempotent
- - reportedThreads
- - runId
- - success
- - topicFinalized
- - topicId
- - totalThreads
- additionalProperties: false
- runId:
- type: string
- runStatus:
- type: string
- success:
- type: boolean
- required:
- - items
- - runId
- - runStatus
- - success
- additionalProperties: false
+ type: array
+ items:
+ $ref: "#/components/schemas/ApiKey"
message:
type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
required:
- - success
- - error
- data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
"401":
content:
application/json:
@@ -6607,38 +10939,65 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
+ "500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
+ description: Internal server error
+ post:
+ operationId: postApiV1ApiKeys
+ description: The plaintext key is returned only in this response.
+ summary: Create an API key
+ tags:
+ - api-keys
+ responses:
+ "201":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/CreatedApiKey"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Invalid request
+ "401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- maxLength: 128
- required: true
requestBody:
required: true
content:
@@ -6646,397 +11005,84 @@ paths:
schema:
type: object
properties:
- items:
- minItems: 1
- maxItems: 100
- type: array
- items:
- type: object
- properties:
- testCaseId:
- type: string
- minLength: 1
- maxLength: 128
- correct:
- type: boolean
- score:
- type: number
- result:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- threadId:
- type: string
- minLength: 1
- maxLength: 128
- topicId:
- type: string
- minLength: 1
- maxLength: 128
- required:
- - correct
- - score
- - topicId
- additionalProperties: false
- required:
- - items
- additionalProperties: false
- /api/v1/eval/benchmarks:
- post:
- operationId: postApiV1EvalBenchmarks
- summary: createBenchmark
- description: "Creates accept an optional id: an identical replay returns the
- resource; conflicting id or identifier returns 409. Lists are
- paginated."
- tags:
- - eval
- responses:
- "201":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- identifier:
- type: string
- minLength: 1
- maxLength: 255
- name:
- type: string
- minLength: 1
- maxLength: 255
- description:
- type:
- - string
- - "null"
- metadata:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- referenceUrl:
- type:
- - string
- - "null"
- rubrics:
- default: []
- maxItems: 100
- type: array
- items:
- type: object
- properties:
- id:
- type: string
- minLength: 1
- maxLength: 128
- name:
- type: string
- minLength: 1
- maxLength: 255
- type:
- type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- weight:
- type: number
- minimum: 0
- threshold:
- type: number
- extractor:
- oneOf:
- - type: object
- properties:
- type:
- type: string
- const: regex
- pattern:
- type: string
- group:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- required:
- - type
- - pattern
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: delimiter
- delimiter:
- type: string
- position:
- type: string
- enum:
- - first
- - last
- required:
- - type
- - delimiter
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: last-line
- trim:
- type: boolean
- required:
- - type
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: choice-index
- labels:
- type: array
- items:
- type: string
- pattern:
- type: string
- required:
- - type
- additionalProperties: false
- config:
- anyOf:
- - type: object
- properties:
- value:
- type: string
- threshold:
- type: number
- required:
- - value
- additionalProperties: false
- - type: object
- properties:
- value:
- type: number
- tolerance:
- type: number
- required:
- - value
- additionalProperties: false
- - type: object
- properties:
- pattern:
- type: string
- required:
- - pattern
- additionalProperties: false
- - type: object
- properties:
- code:
- type: string
- required:
- - code
- additionalProperties: false
- - type: object
- properties:
- criteria:
- type: string
- model:
- type: string
- provider:
- type: string
- systemRole:
- type: string
- required:
- - criteria
- additionalProperties: false
- - type: object
- properties:
- values:
- type: array
- items:
- type: string
- caseSensitive:
- type: boolean
- required:
- - values
- additionalProperties: false
- - type: object
- properties:
- schema:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- required:
- - schema
- additionalProperties: false
- - type: object
- properties:
- extractor:
- oneOf:
- - type: object
- properties:
- type:
- type: string
- const: regex
- pattern:
- type: string
- group:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- required:
- - type
- - pattern
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: delimiter
- delimiter:
- type: string
- position:
- type: string
- enum:
- - first
- - last
- required:
- - type
- - delimiter
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: last-line
- trim:
- type: boolean
- required:
- - type
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: choice-index
- labels:
- type: array
- items:
- type: string
- pattern:
- type: string
- required:
- - type
- additionalProperties: false
- innerMatcher:
- type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- required:
- - extractor
- additionalProperties: false
- required:
- - id
- - name
- - type
- - weight
- - config
- additionalProperties: false
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
+ expiresAt:
+ anyOf:
+ - type: string
+ format: date-time
+ pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
+ - type: "null"
+ name:
+ type: string
+ minLength: 1
+ maxLength: 256
+ scopes:
+ anyOf:
+ - minItems: 1
+ type: array
+ items:
type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- isSystem:
- type: boolean
- required:
- - id
- - identifier
- - name
- - description
- - metadata
- - referenceUrl
- - rubrics
- - createdAt
- - updatedAt
- - isSystem
- additionalProperties: false
+ enum:
+ - "*"
+ - agent:read
+ - agent:write
+ - agent:credential:write
+ - eval:read
+ - eval:write
+ - chat:read
+ - chat:write
+ - model:invoke
+ - model:read
+ - model:write
+ - file:read
+ - file:write
+ - knowledge:read
+ - knowledge:write
+ - mcp:read
+ - mcp:write
+ - usage:read
+ - workspace:read
+ - workspace:write
+ - user:read
+ - user:write
+ - type: "null"
+ required:
+ - name
+ additionalProperties: false
+ /api/v1/api-keys/{id}:
+ get:
+ operationId: getApiV1ApiKeysById
+ summary: Get an API key
+ tags:
+ - api-keys
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/ApiKey"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -7055,24 +11101,86 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
+ "500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 16
+ maxLength: 16
+ required: true
+ patch:
+ operationId: patchApiV1ApiKeysById
+ summary: Update an API key
+ tags:
+ - api-keys
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/ApiKey"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 16
+ maxLength: 16
+ required: true
requestBody:
required: true
content:
@@ -7080,297 +11188,1504 @@ paths:
schema:
type: object
properties:
- id:
- type: string
- minLength: 1
- maxLength: 128
- identifier:
- type: string
- minLength: 1
- maxLength: 255
- name:
- type: string
- minLength: 1
- maxLength: 255
- description:
+ enabled:
+ type: boolean
+ expiresAt:
anyOf:
- type: string
- maxLength: 10000
+ format: date-time
+ pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
- type: "null"
- metadata:
- anyOf:
- - type: object
- propertyNames:
+ name:
+ type: string
+ minLength: 1
+ maxLength: 256
+ additionalProperties: false
+ delete:
+ operationId: deleteApiV1ApiKeysById
+ summary: Delete an API key
+ tags:
+ - api-keys
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/DeletedResource"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 16
+ maxLength: 16
+ required: true
+ /api/v1/audio/speech:
+ post:
+ operationId: postApiV1AudioSpeech
+ description: "OpenAI-compatible text-to-speech. Point an OpenAI SDK at `/api/v1`
+ and call `audio.speech.create`. `model` takes `provider/model` (for
+ example `lobehub/speech-2.8-hd`) or a bare model id; the optional
+ `provider` and `params` (emotion, pitch, volume, sampleRate) are LobeHub
+ extensions. Returns the audio bytes; usage is reported in `X-LobeHub-*`
+ headers. Synthesis errors use OpenAI's `{ error: { message, type, code,
+ param } }` body; authentication and permission errors use the platform
+ `ApiError` envelope."
+ responses:
+ "200":
+ content:
+ audio/aac:
+ schema:
+ format: binary
+ type: string
+ audio/mpeg:
+ schema:
+ format: binary
+ type: string
+ audio/opus:
+ schema:
+ format: binary
+ type: string
+ description: Synthesized audio
+ "400":
+ content:
+ application/json:
+ schema:
+ properties:
+ error:
+ properties:
+ code:
+ type:
+ - string
+ - "null"
+ message:
type: string
- additionalProperties: {}
- - type: "null"
- referenceUrl:
- anyOf:
- - type: string
- format: uri
- - type: "null"
- rubrics:
- default: []
- maxItems: 100
- type: array
- items:
+ param:
+ type:
+ - string
+ - "null"
+ type:
+ type: string
+ required:
+ - message
+ - type
type: object
+ required:
+ - error
+ type: object
+ description: Invalid request, unsupported format or invalid params
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "402":
+ content:
+ application/json:
+ schema:
+ properties:
+ error:
properties:
- id:
- type: string
- minLength: 1
- maxLength: 128
- name:
+ code:
+ type:
+ - string
+ - "null"
+ message:
type: string
- minLength: 1
- maxLength: 255
+ param:
+ type:
+ - string
+ - "null"
type:
type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- weight:
- type: number
- minimum: 0
- threshold:
- type: number
- extractor:
- oneOf:
- - type: object
- properties:
- type:
- type: string
- const: regex
- pattern:
- type: string
- group:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- required:
- - type
- - pattern
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: delimiter
- delimiter:
- type: string
- position:
- type: string
- enum:
- - first
- - last
- required:
- - type
- - delimiter
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: last-line
- trim:
- type: boolean
- required:
- - type
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: choice-index
- labels:
- type: array
- items:
- type: string
- pattern:
- type: string
- required:
- - type
- additionalProperties: false
- config:
- anyOf:
- - type: object
- properties:
- value:
- type: string
- threshold:
- type: number
- required:
- - value
- additionalProperties: false
- - type: object
- properties:
- value:
- type: number
- tolerance:
- type: number
- required:
- - value
- - type: object
- properties:
- pattern:
- type: string
- required:
- - pattern
- - type: object
- properties:
- code:
- type: string
- required:
- - code
- - type: object
- properties:
- criteria:
- type: string
- model:
- type: string
- provider:
- type: string
- systemRole:
- type: string
- required:
- - criteria
- - type: object
- properties:
- values:
- type: array
- items:
- type: string
- caseSensitive:
- type: boolean
- required:
- - values
- additionalProperties: false
- - type: object
- properties:
- schema:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- required:
- - schema
- additionalProperties: false
- - type: object
- properties:
- extractor:
- oneOf:
- - type: object
- properties:
- type:
- type: string
- const: regex
- pattern:
- type: string
- group:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- required:
- - type
- - pattern
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: delimiter
- delimiter:
- type: string
- position:
- type: string
- enum:
- - first
- - last
- required:
- - type
- - delimiter
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: last-line
- trim:
- type: boolean
- required:
- - type
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: choice-index
- labels:
- type: array
- items:
- type: string
- pattern:
- type: string
- required:
- - type
- additionalProperties: false
- innerMatcher:
+ required:
+ - message
+ - type
+ type: object
+ required:
+ - error
+ type: object
+ description: Insufficient balance
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "429":
+ content:
+ application/json:
+ schema:
+ properties:
+ error:
+ properties:
+ code:
+ type:
+ - string
+ - "null"
+ message:
+ type: string
+ param:
+ type:
+ - string
+ - "null"
+ type:
+ type: string
+ required:
+ - message
+ - type
+ type: object
+ required:
+ - error
+ type: object
+ description: Upstream provider rate limit
+ "500":
+ content:
+ application/json:
+ schema:
+ properties:
+ error:
+ properties:
+ code:
+ type:
+ - string
+ - "null"
+ message:
+ type: string
+ param:
+ type:
+ - string
+ - "null"
+ type:
+ type: string
+ required:
+ - message
+ - type
+ type: object
+ required:
+ - error
+ type: object
+ description: Text-to-speech failed
+ "502":
+ content:
+ application/json:
+ schema:
+ properties:
+ error:
+ properties:
+ code:
+ type:
+ - string
+ - "null"
+ message:
+ type: string
+ param:
+ type:
+ - string
+ - "null"
+ type:
+ type: string
+ required:
+ - message
+ - type
+ type: object
+ required:
+ - error
+ type: object
+ description: Upstream provider error
+ summary: Create speech
+ tags:
+ - audio
+ /api/v1/chat:
+ post:
+ operationId: postApiV1Chat
+ summary: Run a non-streaming chat completion
+ tags:
+ - chat
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/ChatResponse"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ frequency_penalty:
+ type: number
+ minimum: -2
+ maximum: 2
+ max_tokens:
+ anyOf:
+ - type: integer
+ minimum: 1
+ maximum: 1000000
+ - type: "null"
+ messages:
+ minItems: 1
+ maxItems: 1000
+ type: array
+ items:
+ type: object
+ properties:
+ content:
+ type: string
+ minLength: 1
+ maxLength: 1000000
+ role:
+ type: string
+ enum:
+ - user
+ - assistant
+ - system
+ required:
+ - content
+ - role
+ model:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 150
+ - type: "null"
+ presence_penalty:
+ type: number
+ minimum: -2
+ maximum: 2
+ provider:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 64
+ - type: "null"
+ stream:
+ type:
+ - boolean
+ - "null"
+ temperature:
+ anyOf:
+ - type: number
+ minimum: 0
+ maximum: 2
+ - type: "null"
+ top_p:
+ type: number
+ minimum: 0
+ maximum: 1
+ required:
+ - messages
+ /api/v1/chat/translate:
+ post:
+ operationId: postApiV1ChatTranslate
+ summary: Translate text
+ tags:
+ - chat
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/ChatTranslateResponse"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ from:
+ type: string
+ minLength: 1
+ maxLength: 32
+ model:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 150
+ - type: "null"
+ provider:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 64
+ - type: "null"
+ text:
+ type: string
+ minLength: 1
+ maxLength: 1000000
+ to:
+ type: string
+ minLength: 1
+ maxLength: 32
+ required:
+ - text
+ - to
+ /api/v1/chat/generate-reply:
+ post:
+ operationId: postApiV1ChatGenerateReply
+ summary: Generate a reply to a message
+ tags:
+ - chat
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/ChatGenerateReplyResponse"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ agentId:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 64
+ - type: "null"
+ chatConfig:
+ anyOf:
+ - type: object
+ properties:
+ disableContextCaching:
+ type:
+ - boolean
+ - "null"
+ displayMode:
+ anyOf:
+ - type: string
+ enum:
+ - chat
+ - docs
+ - type: "null"
+ enableCompressHistory:
+ type:
+ - boolean
+ - "null"
+ enableHistoryCount:
+ type:
+ - boolean
+ - "null"
+ enableMaxTokens:
+ type:
+ - boolean
+ - "null"
+ enableReasoning:
+ type:
+ - boolean
+ - "null"
+ enableReasoningEffort:
+ type:
+ - boolean
+ - "null"
+ historyCount:
+ anyOf:
+ - type: integer
+ minimum: 0
+ maximum: 1000
+ - type: "null"
+ inputTemplate:
+ anyOf:
+ - type: string
+ maxLength: 100000
+ - type: "null"
+ reasoningBudgetToken:
+ anyOf:
+ - type: integer
+ minimum: 0
+ maximum: 1000000
+ - type: "null"
+ reasoningEffort:
+ anyOf:
+ - type: string
+ enum:
+ - low
+ - medium
+ - high
+ - type: "null"
+ searchMode:
+ anyOf:
+ - type: string
+ enum:
+ - off
+ - on
+ - auto
+ - type: "null"
+ thinkingBudget:
+ anyOf:
+ - type: integer
+ minimum: 0
+ maximum: 1000000
+ - type: "null"
+ useModelBuiltinSearch:
+ type:
+ - boolean
+ - "null"
+ - type: "null"
+ conversationHistory:
+ maxItems: 1000
+ type: array
+ items:
+ type: object
+ properties:
+ content:
+ type: string
+ minLength: 1
+ maxLength: 1000000
+ role:
+ type: string
+ enum:
+ - user
+ - assistant
+ - system
+ required:
+ - content
+ - role
+ model:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 150
+ - type: "null"
+ provider:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 64
+ - type: "null"
+ sessionId:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 64
+ - type: "null"
+ userMessage:
+ type: string
+ minLength: 1
+ maxLength: 1000000
+ required:
+ - conversationHistory
+ - sessionId
+ - userMessage
+ /api/v1/chat-groups:
+ get:
+ operationId: getApiV1ChatGroups
+ summary: List chat groups
+ tags:
+ - chat-groups
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/ChatGroupList"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: query
+ name: page
+ schema:
+ type: string
+ - in: query
+ name: pageSize
+ schema:
+ type: string
+ - in: query
+ name: personal
+ schema:
+ type: string
+ enum:
+ - "true"
+ - "false"
+ post:
+ operationId: postApiV1ChatGroups
+ summary: Create a chat group with its supervisor and members
+ tags:
+ - chat-groups
+ responses:
+ "201":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/ChatGroup"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ backgroundColor:
+ type:
+ - string
+ - "null"
+ clientId:
+ type:
+ - string
+ - "null"
+ members:
+ maxItems: 50
+ type: array
+ items:
+ type: object
+ properties:
+ agentId:
+ type: string
+ minLength: 1
+ role:
+ type: string
+ enum:
+ - participant
+ - assistant
+ required:
+ - agentId
+ personal:
+ type: boolean
+ title:
+ type: string
+ minLength: 1
+ required:
+ - members
+ - title
+ /api/v1/chat-groups/{id}:
+ get:
+ operationId: getApiV1ChatGroupsById
+ summary: Get a chat group
+ tags:
+ - chat-groups
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/ChatGroup"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ required: true
+ patch:
+ operationId: patchApiV1ChatGroupsById
+ summary: Update a chat group
+ tags:
+ - chat-groups
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/ChatGroup"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ required: true
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ backgroundColor:
+ type:
+ - string
+ - "null"
+ description:
+ type:
+ - string
+ - "null"
+ personal:
+ type: boolean
+ pinned:
+ type: boolean
+ title:
+ type: string
+ minLength: 1
+ delete:
+ operationId: deleteApiV1ChatGroupsById
+ summary: Delete a chat group
+ tags:
+ - chat-groups
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/DeletedResource"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ required: true
+ /api/v1/chat-groups/{id}/members:
+ post:
+ operationId: postApiV1ChatGroupsByIdMembers
+ summary: Add members to a chat group
+ tags:
+ - chat-groups
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/ChatGroup"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ required: true
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ agentIds:
+ minItems: 1
+ maxItems: 50
+ type: array
+ items:
+ type: string
+ minLength: 1
+ required:
+ - agentIds
+ delete:
+ operationId: deleteApiV1ChatGroupsByIdMembers
+ description: Detaches the agents and answers with the updated group.
+ summary: Remove members from a chat group
+ tags:
+ - chat-groups
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/ChatGroup"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ required: true
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ agentIds:
+ minItems: 1
+ maxItems: 50
+ type: array
+ items:
+ type: string
+ minLength: 1
+ required:
+ - agentIds
+ /api/v1/eval/runs:
+ post:
+ operationId: postApiV1EvalRuns
+ description: Queues an asynchronous QStash-backed evaluation run and returns
+ immediately.
+ summary: Create an eval run
+ tags:
+ - eval
+ responses:
+ "202":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/EvalRun"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ config:
+ type: object
+ properties:
+ maxConcurrency:
+ type: integer
+ minimum: 1
+ maximum: 100
+ caseSelection:
+ oneOf:
+ - type: object
+ properties:
+ mode:
+ type: string
+ const: all
+ required:
+ - mode
+ additionalProperties: false
+ - type: object
+ properties:
+ mode:
+ type: string
+ enum:
+ - include
+ - exclude
+ caseIds:
+ minItems: 1
+ maxItems: 10000
+ type: array
+ items:
type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- required:
- - extractor
- additionalProperties: false
- required:
- - id
- - name
- - type
- - weight
- - config
- additionalProperties: false
+ minLength: 1
+ required:
+ - mode
+ - caseIds
+ additionalProperties: false
+ k:
+ type: integer
+ minimum: 1
+ maximum: 10
+ maxSteps:
+ type: integer
+ minimum: 1
+ maximum: 1000
+ timeout:
+ type: integer
+ minimum: 60000
+ maximum: 21600000
+ additionalProperties: false
+ executionMode:
+ type: string
+ enum:
+ - internal
+ - external
+ experimentId:
+ type: string
+ minLength: 1
+ maxLength: 128
+ datasetId:
+ type: string
+ minLength: 1
+ maxLength: 128
+ id:
+ type: string
+ minLength: 1
+ maxLength: 128
+ name:
+ type: string
+ minLength: 1
+ maxLength: 255
+ targetAgentId:
+ type: string
+ minLength: 1
+ maxLength: 128
required:
- - identifier
- - name
+ - datasetId
+ - targetAgentId
additionalProperties: false
get:
- operationId: getApiV1EvalBenchmarks
- summary: listBenchmarks
- description: "Creates accept an optional id: an identical replay returns the
- resource; conflicting id or identifier returns 409. Lists are
- paginated."
+ operationId: getApiV1EvalRuns
+ summary: List eval runs
+ tags:
+ - eval
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ runs:
+ type: array
+ items:
+ $ref: "#/components/schemas/EvalRun"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - runs
+ - total
+ additionalProperties: false
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: query
+ name: limit
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 100
+ - in: query
+ name: offset
+ schema:
+ type: integer
+ minimum: 0
+ maximum: 1000000
+ - in: query
+ name: page
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 1000000
+ - in: query
+ name: pageSize
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 100
+ - in: query
+ name: experimentId
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 128
+ - in: query
+ name: datasetId
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 128
+ - in: query
+ name: status
+ schema:
+ type: string
+ enum:
+ - idle
+ - pending
+ - running
+ - completed
+ - failed
+ - aborted
+ - external
+ /api/v1/eval/runs/{id}/topics:
+ get:
+ operationId: getApiV1EvalRunsByIdTopics
+ summary: List topic results of an eval run
tags:
- eval
responses:
@@ -7378,360 +12693,137 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
type: object
properties:
- benchmarks:
+ runId:
+ type: string
+ topics:
type: array
items:
- type: object
- properties:
- id:
- type: string
- identifier:
- type: string
- minLength: 1
- maxLength: 255
- name:
- type: string
- minLength: 1
- maxLength: 255
- description:
- type:
- - string
- - "null"
- metadata:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- referenceUrl:
- type:
- - string
- - "null"
- rubrics:
- default: []
- maxItems: 100
- type: array
- items:
- type: object
- properties:
- id:
- type: string
- minLength: 1
- maxLength: 128
- name:
- type: string
- minLength: 1
- maxLength: 255
- type:
- type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- weight:
- type: number
- minimum: 0
- threshold:
- type: number
- extractor:
- oneOf:
- - type: object
- properties:
- type:
- type: string
- const: regex
- pattern:
- type: string
- group:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- required:
- - type
- - pattern
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: delimiter
- delimiter:
- type: string
- position:
- type: string
- enum:
- - first
- - last
- required:
- - type
- - delimiter
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: last-line
- trim:
- type: boolean
- required:
- - type
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: choice-index
- labels:
- type: array
- items:
- type: string
- pattern:
- type: string
- required:
- - type
- additionalProperties: false
- config:
- anyOf:
- - type: object
- properties:
- value:
- type: string
- threshold:
- type: number
- required:
- - value
- additionalProperties: false
- - type: object
- properties:
- value:
- type: number
- tolerance:
- type: number
- required:
- - value
- additionalProperties: false
- - type: object
- properties:
- pattern:
- type: string
- required:
- - pattern
- additionalProperties: false
- - type: object
- properties:
- code:
- type: string
- required:
- - code
- additionalProperties: false
- - type: object
- properties:
- criteria:
- type: string
- model:
- type: string
- provider:
- type: string
- systemRole:
- type: string
- required:
- - criteria
- additionalProperties: false
- - type: object
- properties:
- values:
- type: array
- items:
- type: string
- caseSensitive:
- type: boolean
- required:
- - values
- additionalProperties: false
- - type: object
- properties:
- schema:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- required:
- - schema
- additionalProperties: false
- - type: object
- properties:
- extractor:
- oneOf:
- - type: object
- properties:
- type:
- type: string
- const: regex
- pattern:
- type: string
- group:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- required:
- - type
- - pattern
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: delimiter
- delimiter:
- type: string
- position:
- type: string
- enum:
- - first
- - last
- required:
- - type
- - delimiter
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: last-line
- trim:
- type: boolean
- required:
- - type
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: choice-index
- labels:
- type: array
- items:
- type: string
- pattern:
- type: string
- required:
- - type
- additionalProperties: false
- innerMatcher:
- type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- required:
- - extractor
- additionalProperties: false
- required:
- - id
- - name
- - type
- - weight
- - config
- additionalProperties: false
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- isSystem:
- type: boolean
- required:
- - id
- - identifier
- - name
- - description
- - metadata
- - referenceUrl
- - rubrics
- - createdAt
- - updatedAt
- - isSystem
- additionalProperties: false
+ $ref: "#/components/schemas/EvalRunTopic"
total:
type: integer
minimum: 0
maximum: 9007199254740991
required:
- - benchmarks
+ - runId
+ - topics
- total
additionalProperties: false
message:
type: string
success:
- const: true
type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 128
+ required: true
+ - in: query
+ name: limit
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 100
+ - in: query
+ name: offset
+ schema:
+ type: integer
+ minimum: 0
+ maximum: 1000000
+ - in: query
+ name: page
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 1000000
+ - in: query
+ name: pageSize
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 100
+ /api/v1/eval/runs/{id}:
+ get:
+ operationId: getApiV1EvalRunsById
+ summary: Get an eval run
+ tags:
+ - eval
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/EvalRun"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -7750,18 +12842,89 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
+ "500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 128
+ required: true
+ /api/v1/eval/runs/{id}/results:
+ get:
+ operationId: getApiV1EvalRunsByIdResults
+ summary: List case results of an eval run
+ tags:
+ - eval
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ results:
+ type: array
+ items:
+ $ref: "#/components/schemas/EvalRunResult"
+ runId:
+ type: string
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - results
+ - runId
+ - total
+ additionalProperties: false
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
"500":
content:
application/json:
@@ -7769,6 +12932,13 @@ paths:
$ref: "#/components/schemas/ApiError"
description: Internal server error
parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 128
+ required: true
- in: query
name: limit
schema:
@@ -7793,13 +12963,14 @@ paths:
type: integer
minimum: 1
maximum: 100
- /api/v1/eval/benchmarks/{id}:
- get:
- operationId: getApiV1EvalBenchmarksById
- summary: getBenchmark
- description: "Creates accept an optional id: an identical replay returns the
- resource; conflicting id or identifier returns 409. Lists are
- paginated."
+ post:
+ operationId: postApiV1EvalRunsByIdResults
+ description: "Claim: one pending worker succeeds, others receive 409. Reports:
+ identical replays succeed; different results conflict. Batches are
+ atomic. External workers can supply testCaseId to associate their own
+ topic with a dataset case on first report. Retry: only terminal runs,
+ concurrent repeats conflict."
+ summary: Report results for a batch of run topics
tags:
- eval
responses:
@@ -7807,347 +12978,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- identifier:
- type: string
- minLength: 1
- maxLength: 255
- name:
- type: string
- minLength: 1
- maxLength: 255
- description:
- type:
- - string
- - "null"
- metadata:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- referenceUrl:
- type:
- - string
- - "null"
- rubrics:
- default: []
- maxItems: 100
- type: array
- items:
- type: object
- properties:
- id:
- type: string
- minLength: 1
- maxLength: 128
- name:
- type: string
- minLength: 1
- maxLength: 255
- type:
- type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- weight:
- type: number
- minimum: 0
- threshold:
- type: number
- extractor:
- oneOf:
- - type: object
- properties:
- type:
- type: string
- const: regex
- pattern:
- type: string
- group:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- required:
- - type
- - pattern
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: delimiter
- delimiter:
- type: string
- position:
- type: string
- enum:
- - first
- - last
- required:
- - type
- - delimiter
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: last-line
- trim:
- type: boolean
- required:
- - type
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: choice-index
- labels:
- type: array
- items:
- type: string
- pattern:
- type: string
- required:
- - type
- additionalProperties: false
- config:
- anyOf:
- - type: object
- properties:
- value:
- type: string
- threshold:
- type: number
- required:
- - value
- additionalProperties: false
- - type: object
- properties:
- value:
- type: number
- tolerance:
- type: number
- required:
- - value
- additionalProperties: false
- - type: object
- properties:
- pattern:
- type: string
- required:
- - pattern
- additionalProperties: false
- - type: object
- properties:
- code:
- type: string
- required:
- - code
- additionalProperties: false
- - type: object
- properties:
- criteria:
- type: string
- model:
- type: string
- provider:
- type: string
- systemRole:
- type: string
- required:
- - criteria
- additionalProperties: false
- - type: object
- properties:
- values:
- type: array
- items:
- type: string
- caseSensitive:
- type: boolean
- required:
- - values
- additionalProperties: false
- - type: object
- properties:
- schema:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- required:
- - schema
- additionalProperties: false
- - type: object
- properties:
- extractor:
- oneOf:
- - type: object
- properties:
- type:
- type: string
- const: regex
- pattern:
- type: string
- group:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- required:
- - type
- - pattern
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: delimiter
- delimiter:
- type: string
- position:
- type: string
- enum:
- - first
- - last
- required:
- - type
- - delimiter
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: last-line
- trim:
- type: boolean
- required:
- - type
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: choice-index
- labels:
- type: array
- items:
- type: string
- pattern:
- type: string
- required:
- - type
- additionalProperties: false
- innerMatcher:
- type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- required:
- - extractor
- additionalProperties: false
- required:
- - id
- - name
- - type
- - weight
- - config
- additionalProperties: false
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- isSystem:
- type: boolean
- required:
- - id
- - identifier
- - name
- - description
- - metadata
- - referenceUrl
- - rubrics
- - createdAt
- - updatedAt
- - isSystem
- additionalProperties: false
+ $ref: "#/components/schemas/EvalBatchReportResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -8171,13 +13025,7 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Resource conflict
"500":
content:
application/json:
@@ -8192,360 +13040,87 @@ paths:
minLength: 1
maxLength: 128
required: true
- patch:
- operationId: patchApiV1EvalBenchmarksById
- summary: updateBenchmark
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ items:
+ minItems: 1
+ maxItems: 100
+ type: array
+ items:
+ type: object
+ properties:
+ testCaseId:
+ type: string
+ minLength: 1
+ maxLength: 128
+ correct:
+ type: boolean
+ score:
+ type: number
+ result:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ threadId:
+ type: string
+ minLength: 1
+ maxLength: 128
+ topicId:
+ type: string
+ minLength: 1
+ maxLength: 128
+ required:
+ - correct
+ - score
+ - topicId
+ additionalProperties: false
+ required:
+ - items
+ additionalProperties: false
+ /api/v1/eval/benchmarks:
+ post:
+ operationId: postApiV1EvalBenchmarks
description: "Creates accept an optional id: an identical replay returns the
resource; conflicting id or identifier returns 409. Lists are
paginated."
+ summary: Create a benchmark
tags:
- eval
responses:
- "200":
+ "201":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- identifier:
- type: string
- minLength: 1
- maxLength: 255
- name:
- type: string
- minLength: 1
- maxLength: 255
- description:
- type:
- - string
- - "null"
- metadata:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- referenceUrl:
- type:
- - string
- - "null"
- rubrics:
- default: []
- maxItems: 100
- type: array
- items:
- type: object
- properties:
- id:
- type: string
- minLength: 1
- maxLength: 128
- name:
- type: string
- minLength: 1
- maxLength: 255
- type:
- type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- weight:
- type: number
- minimum: 0
- threshold:
- type: number
- extractor:
- oneOf:
- - type: object
- properties:
- type:
- type: string
- const: regex
- pattern:
- type: string
- group:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- required:
- - type
- - pattern
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: delimiter
- delimiter:
- type: string
- position:
- type: string
- enum:
- - first
- - last
- required:
- - type
- - delimiter
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: last-line
- trim:
- type: boolean
- required:
- - type
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: choice-index
- labels:
- type: array
- items:
- type: string
- pattern:
- type: string
- required:
- - type
- additionalProperties: false
- config:
- anyOf:
- - type: object
- properties:
- value:
- type: string
- threshold:
- type: number
- required:
- - value
- additionalProperties: false
- - type: object
- properties:
- value:
- type: number
- tolerance:
- type: number
- required:
- - value
- additionalProperties: false
- - type: object
- properties:
- pattern:
- type: string
- required:
- - pattern
- additionalProperties: false
- - type: object
- properties:
- code:
- type: string
- required:
- - code
- additionalProperties: false
- - type: object
- properties:
- criteria:
- type: string
- model:
- type: string
- provider:
- type: string
- systemRole:
- type: string
- required:
- - criteria
- additionalProperties: false
- - type: object
- properties:
- values:
- type: array
- items:
- type: string
- caseSensitive:
- type: boolean
- required:
- - values
- additionalProperties: false
- - type: object
- properties:
- schema:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- required:
- - schema
- additionalProperties: false
- - type: object
- properties:
- extractor:
- oneOf:
- - type: object
- properties:
- type:
- type: string
- const: regex
- pattern:
- type: string
- group:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- required:
- - type
- - pattern
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: delimiter
- delimiter:
- type: string
- position:
- type: string
- enum:
- - first
- - last
- required:
- - type
- - delimiter
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: last-line
- trim:
- type: boolean
- required:
- - type
- additionalProperties: false
- - type: object
- properties:
- type:
- type: string
- const: choice-index
- labels:
- type: array
- items:
- type: string
- pattern:
- type: string
- required:
- - type
- additionalProperties: false
- innerMatcher:
- type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- required:
- - extractor
- additionalProperties: false
- required:
- - id
- - name
- - type
- - weight
- - config
- additionalProperties: false
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- isSystem:
- type: boolean
- required:
- - id
- - identifier
- - name
- - description
- - metadata
- - referenceUrl
- - rubrics
- - createdAt
- - updatedAt
- - isSystem
- additionalProperties: false
+ $ref: "#/components/schemas/EvalBenchmark"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -8558,38 +13133,18 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
"409":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- maxLength: 128
- required: true
requestBody:
required: true
content:
@@ -8597,6 +13152,10 @@ paths:
schema:
type: object
properties:
+ id:
+ type: string
+ minLength: 1
+ maxLength: 128
identifier:
type: string
minLength: 1
@@ -8874,13 +13433,110 @@ paths:
- weight
- config
additionalProperties: false
+ required:
+ - identifier
+ - name
additionalProperties: false
- delete:
- operationId: deleteApiV1EvalBenchmarksById
- summary: deleteBenchmark
+ get:
+ operationId: getApiV1EvalBenchmarks
+ description: "Creates accept an optional id: an identical replay returns the
+ resource; conflicting id or identifier returns 409. Lists are
+ paginated."
+ summary: List benchmarks
+ tags:
+ - eval
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ benchmarks:
+ type: array
+ items:
+ $ref: "#/components/schemas/EvalBenchmark"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - benchmarks
+ - total
+ additionalProperties: false
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: query
+ name: limit
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 100
+ - in: query
+ name: offset
+ schema:
+ type: integer
+ minimum: 0
+ maximum: 1000000
+ - in: query
+ name: page
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 1000000
+ - in: query
+ name: pageSize
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 100
+ /api/v1/eval/benchmarks/{id}:
+ get:
+ operationId: getApiV1EvalBenchmarksById
description: "Creates accept an optional id: an identical replay returns the
resource; conflicting id or identifier returns 409. Lists are
paginated."
+ summary: Get a benchmark
tags:
- eval
responses:
@@ -8888,49 +13544,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- required:
- - id
- additionalProperties: false
+ $ref: "#/components/schemas/EvalBenchmark"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -8949,18 +13586,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -8975,124 +13600,43 @@ paths:
minLength: 1
maxLength: 128
required: true
- /api/v1/eval/datasets:
- post:
- operationId: postApiV1EvalDatasets
- summary: createDataset
+ patch:
+ operationId: patchApiV1EvalBenchmarksById
description: "Creates accept an optional id: an identical replay returns the
resource; conflicting id or identifier returns 409. Lists are
paginated."
+ summary: Update a benchmark
tags:
- eval
responses:
- "201":
+ "200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- identifier:
- type: string
- minLength: 1
- maxLength: 255
- name:
- type: string
- minLength: 1
- maxLength: 255
- benchmarkId:
- type:
- - string
- - "null"
- description:
- type:
- - string
- - "null"
- metadata:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- evalConfig:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- evalMode:
- type:
- - string
- - "null"
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- sourceExperimentId:
- type:
- - string
- - "null"
- testCaseCount:
- type: integer
- minimum: -9007199254740991
- maximum: 9007199254740991
- required:
- - id
- - identifier
- - name
- - benchmarkId
- - description
- - metadata
- - evalConfig
- - evalMode
- - createdAt
- - updatedAt
- - sourceExperimentId
- - testCaseCount
- additionalProperties: false
+ $ref: "#/components/schemas/EvalBenchmark"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -9117,18 +13661,20 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 128
+ required: true
requestBody:
required: true
content:
@@ -9136,10 +13682,6 @@ paths:
schema:
type: object
properties:
- id:
- type: string
- minLength: 1
- maxLength: 128
identifier:
type: string
minLength: 1
@@ -9148,12 +13690,6 @@ paths:
type: string
minLength: 1
maxLength: 255
- benchmarkId:
- anyOf:
- - type: string
- minLength: 1
- maxLength: 128
- - type: "null"
description:
anyOf:
- type: string
@@ -9166,244 +13702,270 @@ paths:
type: string
additionalProperties: {}
- type: "null"
- evalConfig:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- evalMode:
+ referenceUrl:
anyOf:
- type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
+ format: uri
- type: "null"
- required:
- - identifier
- - name
- additionalProperties: false
- get:
- operationId: getApiV1EvalDatasets
- summary: listDatasets
- description: "Creates accept an optional id: an identical replay returns the
- resource; conflicting id or identifier returns 409. Lists are
- paginated."
- tags:
- - eval
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $schema: https://json-schema.org/draft/2020-12/schema
+ rubrics:
+ default: []
+ maxItems: 100
+ type: array
+ items:
type: object
- properties:
- datasets:
- type: array
- items:
- type: object
- properties:
- id:
- type: string
- identifier:
- type: string
- minLength: 1
- maxLength: 255
- name:
- type: string
- minLength: 1
- maxLength: 255
- benchmarkId:
+ properties:
+ id:
+ type: string
+ minLength: 1
+ maxLength: 128
+ name:
+ type: string
+ minLength: 1
+ maxLength: 255
+ type:
+ type: string
+ enum:
+ - equals
+ - contains
+ - regex
+ - starts-with
+ - ends-with
+ - any-of
+ - numeric
+ - extract-match
+ - json-schema
+ - javascript
+ - python
+ - llm-rubric
+ - factuality
+ - answer-relevance
+ - similar
+ - levenshtein
+ - rubric
+ - external
+ weight:
+ type: number
+ minimum: 0
+ threshold:
+ type: number
+ extractor:
+ oneOf:
+ - type: object
+ properties:
type:
- - string
- - "null"
- description:
+ type: string
+ const: regex
+ pattern:
+ type: string
+ group:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - type
+ - pattern
+ additionalProperties: false
+ - type: object
+ properties:
type:
- - string
- - "null"
- metadata:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- evalConfig:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- evalMode:
+ type: string
+ const: delimiter
+ delimiter:
+ type: string
+ position:
+ type: string
+ enum:
+ - first
+ - last
+ required:
+ - type
+ - delimiter
+ additionalProperties: false
+ - type: object
+ properties:
type:
- - string
- - "null"
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- sourceExperimentId:
+ type: string
+ const: last-line
+ trim:
+ type: boolean
+ required:
+ - type
+ additionalProperties: false
+ - type: object
+ properties:
type:
- - string
- - "null"
- testCaseCount:
- type: integer
- minimum: -9007199254740991
- maximum: 9007199254740991
- required:
- - id
- - identifier
- - name
- - benchmarkId
- - description
- - metadata
- - evalConfig
- - evalMode
- - createdAt
- - updatedAt
- - sourceExperimentId
- - testCaseCount
- additionalProperties: false
- total:
- type: integer
- minimum: 0
- maximum: 9007199254740991
+ type: string
+ const: choice-index
+ labels:
+ type: array
+ items:
+ type: string
+ pattern:
+ type: string
+ required:
+ - type
+ additionalProperties: false
+ config:
+ anyOf:
+ - type: object
+ properties:
+ value:
+ type: string
+ threshold:
+ type: number
+ required:
+ - value
+ additionalProperties: false
+ - type: object
+ properties:
+ value:
+ type: number
+ tolerance:
+ type: number
+ required:
+ - value
+ - type: object
+ properties:
+ pattern:
+ type: string
+ required:
+ - pattern
+ - type: object
+ properties:
+ code:
+ type: string
+ required:
+ - code
+ - type: object
+ properties:
+ criteria:
+ type: string
+ model:
+ type: string
+ provider:
+ type: string
+ systemRole:
+ type: string
+ required:
+ - criteria
+ - type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ caseSensitive:
+ type: boolean
+ required:
+ - values
+ additionalProperties: false
+ - type: object
+ properties:
+ schema:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ required:
+ - schema
+ additionalProperties: false
+ - type: object
+ properties:
+ extractor:
+ oneOf:
+ - type: object
+ properties:
+ type:
+ type: string
+ const: regex
+ pattern:
+ type: string
+ group:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - type
+ - pattern
+ additionalProperties: false
+ - type: object
+ properties:
+ type:
+ type: string
+ const: delimiter
+ delimiter:
+ type: string
+ position:
+ type: string
+ enum:
+ - first
+ - last
+ required:
+ - type
+ - delimiter
+ additionalProperties: false
+ - type: object
+ properties:
+ type:
+ type: string
+ const: last-line
+ trim:
+ type: boolean
+ required:
+ - type
+ additionalProperties: false
+ - type: object
+ properties:
+ type:
+ type: string
+ const: choice-index
+ labels:
+ type: array
+ items:
+ type: string
+ pattern:
+ type: string
+ required:
+ - type
+ additionalProperties: false
+ innerMatcher:
+ type: string
+ enum:
+ - equals
+ - contains
+ - regex
+ - starts-with
+ - ends-with
+ - any-of
+ - numeric
+ - extract-match
+ - json-schema
+ - javascript
+ - python
+ - llm-rubric
+ - factuality
+ - answer-relevance
+ - similar
+ - levenshtein
+ - rubric
+ - external
+ required:
+ - extractor
+ additionalProperties: false
required:
- - datasets
- - total
+ - id
+ - name
+ - type
+ - weight
+ - config
additionalProperties: false
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- parameters:
- - in: query
- name: limit
- schema:
- type: integer
- minimum: 1
- maximum: 100
- - in: query
- name: offset
- schema:
- type: integer
- minimum: 0
- maximum: 1000000
- - in: query
- name: page
- schema:
- type: integer
- minimum: 1
- maximum: 1000000
- - in: query
- name: pageSize
- schema:
- type: integer
- minimum: 1
- maximum: 100
- - in: query
- name: benchmarkId
- schema:
- type: string
- minLength: 1
- maxLength: 128
- /api/v1/eval/datasets/{id}:
- get:
- operationId: getApiV1EvalDatasetsById
- summary: getDataset
+ additionalProperties: false
+ delete:
+ operationId: deleteApiV1EvalBenchmarksById
description: "Creates accept an optional id: an identical replay returns the
resource; conflicting id or identifier returns 409. Lists are
paginated."
+ summary: Delete a benchmark
tags:
- eval
responses:
@@ -9411,110 +13973,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- identifier:
- type: string
- minLength: 1
- maxLength: 255
- name:
- type: string
- minLength: 1
- maxLength: 255
- benchmarkId:
- type:
- - string
- - "null"
- description:
- type:
- - string
- - "null"
- metadata:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- evalConfig:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- evalMode:
- type:
- - string
- - "null"
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- sourceExperimentId:
- type:
- - string
- - "null"
- testCaseCount:
- type: integer
- minimum: -9007199254740991
- maximum: 9007199254740991
- required:
- - id
- - identifier
- - name
- - benchmarkId
- - description
- - metadata
- - evalConfig
- - evalMode
- - createdAt
- - updatedAt
- - sourceExperimentId
- - testCaseCount
- additionalProperties: false
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -9533,18 +14015,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -9555,127 +14025,48 @@ paths:
- in: path
name: id
schema:
- type: string
- minLength: 1
- maxLength: 128
- required: true
- patch:
- operationId: patchApiV1EvalDatasetsById
- summary: updateDataset
- description: "Creates accept an optional id: an identical replay returns the
- resource; conflicting id or identifier returns 409. Lists are
- paginated."
- tags:
- - eval
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- identifier:
- type: string
- minLength: 1
- maxLength: 255
- name:
- type: string
- minLength: 1
- maxLength: 255
- benchmarkId:
- type:
- - string
- - "null"
- description:
- type:
- - string
- - "null"
- metadata:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- evalConfig:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- evalMode:
- type:
- - string
- - "null"
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- sourceExperimentId:
- type:
- - string
- - "null"
- testCaseCount:
- type: integer
- minimum: -9007199254740991
- maximum: 9007199254740991
- required:
- - id
- - identifier
- - name
- - benchmarkId
- - description
- - metadata
- - evalConfig
- - evalMode
- - createdAt
- - updatedAt
- - sourceExperimentId
- - testCaseCount
- additionalProperties: false
+ type: string
+ minLength: 1
+ maxLength: 128
+ required: true
+ /api/v1/eval/datasets:
+ post:
+ operationId: postApiV1EvalDatasets
+ description: "Creates accept an optional id: an identical replay returns the
+ resource; conflicting id or identifier returns 409. Lists are
+ paginated."
+ summary: Create a dataset
+ tags:
+ - eval
+ responses:
+ "201":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/EvalDataset"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -9700,26 +14091,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- maxLength: 128
- required: true
requestBody:
required: true
content:
@@ -9727,6 +14104,10 @@ paths:
schema:
type: object
properties:
+ id:
+ type: string
+ minLength: 1
+ maxLength: 128
identifier:
type: string
minLength: 1
@@ -9783,13 +14164,16 @@ paths:
- rubric
- external
- type: "null"
+ required:
+ - identifier
+ - name
additionalProperties: false
- delete:
- operationId: deleteApiV1EvalDatasetsById
- summary: deleteDataset
+ get:
+ operationId: getApiV1EvalDatasets
description: "Creates accept an optional id: an identical replay returns the
resource; conflicting id or identifier returns 409. Lists are
paginated."
+ summary: List datasets
tags:
- eval
responses:
@@ -9797,49 +14181,43 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
type: object
properties:
- id:
- type: string
+ datasets:
+ type: array
+ items:
+ $ref: "#/components/schemas/EvalDataset"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
required:
- - id
+ - datasets
+ - total
additionalProperties: false
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -9852,24 +14230,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -9877,260 +14237,143 @@ paths:
$ref: "#/components/schemas/ApiError"
description: Internal server error
parameters:
- - in: path
- name: id
+ - in: query
+ name: limit
schema:
- type: string
- minLength: 1
- maxLength: 128
- required: true
- /api/v1/eval/datasets/{datasetId}/test-cases:
- post:
- operationId: postApiV1EvalDatasetsByDatasetIdTestCases
- summary: createTestCase
- description: "Creates accept an optional id: an identical replay returns the
- resource; conflicting id or identifier returns 409. Lists are
- paginated."
- tags:
- - eval
- responses:
- "201":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- input:
- type: string
- expected:
- type: string
- category:
- type: string
- choices:
- type: array
- items:
- type: string
- environment:
- type: object
- properties:
- envPrompt:
- type: string
- toolForwarding:
- type: object
- propertyNames:
- type: string
- additionalProperties:
- type: object
- properties:
- endpoint:
- type: string
- format: uri
- timeoutMs:
- type: integer
- exclusiveMinimum: 0
- maximum: 9007199254740991
- required:
- - endpoint
- additionalProperties: false
- additionalProperties: false
- messages:
- maxItems: 1000
- type: array
- items:
- type: object
- properties:
- content:
- type: string
- role:
- type: string
- enum:
- - user
- - assistant
- - system
- - tool
- id:
- type: string
- minLength: 1
- maxLength: 128
- parentId:
- anyOf:
- - type: string
- minLength: 1
- maxLength: 128
- - type: "null"
- model:
- type: string
- provider:
- type: string
- createdAt:
- type:
- - string
- - number
- updatedAt:
- type:
- - string
- - number
- tools:
- type: array
- items:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- tool_call_id:
- type: string
- metadata:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- reasoning:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- plugin:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginState:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginError:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginIntervention:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- error:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- search:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- required:
- - content
- - role
- additionalProperties: false
- caseId:
- type: string
- minLength: 1
- maxLength: 128
- sortOrder:
- type:
- - number
- - "null"
- evalMode:
- anyOf:
- - type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- - type: "null"
- evalConfig:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- datasetId:
- type: string
- content:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- metadata:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- required:
- - id
- - input
- - sortOrder
- - createdAt
- - updatedAt
- - datasetId
- - content
- - metadata
- additionalProperties: false
+ type: integer
+ minimum: 1
+ maximum: 100
+ - in: query
+ name: offset
+ schema:
+ type: integer
+ minimum: 0
+ maximum: 1000000
+ - in: query
+ name: page
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 1000000
+ - in: query
+ name: pageSize
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 100
+ - in: query
+ name: benchmarkId
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 128
+ /api/v1/eval/datasets/{id}:
+ get:
+ operationId: getApiV1EvalDatasetsById
+ description: "Creates accept an optional id: an identical replay returns the
+ resource; conflicting id or identifier returns 409. Lists are
+ paginated."
+ summary: Get a dataset
+ tags:
+ - eval
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/EvalDataset"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 128
+ required: true
+ patch:
+ operationId: patchApiV1EvalDatasetsById
+ description: "Creates accept an optional id: an identical replay returns the
+ resource; conflicting id or identifier returns 409. Lists are
+ paginated."
+ summary: Update a dataset
+ tags:
+ - eval
+ responses:
+ "200":
content:
application/json:
schema:
type: object
properties:
+ data:
+ $ref: "#/components/schemas/EvalDataset"
+ message:
+ type: string
success:
type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
+ const: true
+ timestamp:
+ type: string
+ format: date-time
required:
- - success
- - error
- data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -10155,12 +14398,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -10169,154 +14406,52 @@ paths:
description: Internal server error
parameters:
- in: path
- name: datasetId
+ name: id
schema:
type: string
minLength: 1
maxLength: 128
required: true
requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- id:
- type: string
- minLength: 1
- maxLength: 128
- input:
- type: string
- expected:
- type: string
- category:
- type: string
- choices:
- type: array
- items:
- type: string
- environment:
- type: object
- properties:
- envPrompt:
- type: string
- toolForwarding:
- type: object
- propertyNames:
- type: string
- additionalProperties:
- type: object
- properties:
- endpoint:
- type: string
- format: uri
- timeoutMs:
- type: integer
- exclusiveMinimum: 0
- maximum: 9007199254740991
- required:
- - endpoint
- additionalProperties: false
- additionalProperties: false
- messages:
- maxItems: 1000
- type: array
- items:
- type: object
- properties:
- content:
- type: string
- role:
- type: string
- enum:
- - user
- - assistant
- - system
- - tool
- id:
- type: string
- minLength: 1
- maxLength: 128
- parentId:
- anyOf:
- - type: string
- minLength: 1
- maxLength: 128
- - type: "null"
- model:
- type: string
- provider:
- type: string
- createdAt:
- type:
- - string
- - number
- updatedAt:
- type:
- - string
- - number
- tools:
- type: array
- items:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- tool_call_id:
- type: string
- metadata:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- reasoning:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- plugin:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginState:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginError:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginIntervention:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- error:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- search:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- required:
- - content
- - role
- additionalProperties: false
- caseId:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ identifier:
type: string
minLength: 1
- maxLength: 128
- sortOrder:
- type: integer
- minimum: 0
- maximum: 9007199254740991
+ maxLength: 255
+ name:
+ type: string
+ minLength: 1
+ maxLength: 255
+ benchmarkId:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 128
+ - type: "null"
+ description:
+ anyOf:
+ - type: string
+ maxLength: 10000
+ - type: "null"
+ metadata:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
+ evalConfig:
+ anyOf:
+ - type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ - type: "null"
evalMode:
anyOf:
- type: string
@@ -10340,22 +14475,13 @@ paths:
- rubric
- external
- type: "null"
- evalConfig:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- required:
- - input
additionalProperties: false
- get:
- operationId: getApiV1EvalDatasetsByDatasetIdTestCases
- summary: listTestCases
+ delete:
+ operationId: deleteApiV1EvalDatasetsById
description: "Creates accept an optional id: an identical replay returns the
resource; conflicting id or identifier returns 409. Lists are
paginated."
+ summary: Delete a dataset
tags:
- eval
responses:
@@ -10363,252 +14489,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- testCases:
- type: array
- items:
- type: object
- properties:
- id:
- type: string
- input:
- type: string
- expected:
- type: string
- category:
- type: string
- choices:
- type: array
- items:
- type: string
- environment:
- type: object
- properties:
- envPrompt:
- type: string
- toolForwarding:
- type: object
- propertyNames:
- type: string
- additionalProperties:
- type: object
- properties:
- endpoint:
- type: string
- format: uri
- timeoutMs:
- type: integer
- exclusiveMinimum: 0
- maximum: 9007199254740991
- required:
- - endpoint
- additionalProperties: false
- additionalProperties: false
- messages:
- maxItems: 1000
- type: array
- items:
- type: object
- properties:
- content:
- type: string
- role:
- type: string
- enum:
- - user
- - assistant
- - system
- - tool
- id:
- type: string
- minLength: 1
- maxLength: 128
- parentId:
- anyOf:
- - type: string
- minLength: 1
- maxLength: 128
- - type: "null"
- model:
- type: string
- provider:
- type: string
- createdAt:
- type:
- - string
- - number
- updatedAt:
- type:
- - string
- - number
- tools:
- type: array
- items:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- tool_call_id:
- type: string
- metadata:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- reasoning:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- plugin:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginState:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginError:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginIntervention:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- error:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- search:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- required:
- - content
- - role
- additionalProperties: false
- caseId:
- type: string
- minLength: 1
- maxLength: 128
- sortOrder:
- type:
- - number
- - "null"
- evalMode:
- anyOf:
- - type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- - type: "null"
- evalConfig:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- datasetId:
- type: string
- content:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- metadata:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- required:
- - id
- - input
- - sortOrder
- - createdAt
- - updatedAt
- - datasetId
- - content
- - metadata
- additionalProperties: false
- total:
- type: integer
- minimum: 0
- maximum: 9007199254740991
- required:
- - testCases
- - total
- additionalProperties: false
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -10627,18 +14531,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -10647,283 +14539,313 @@ paths:
description: Internal server error
parameters:
- in: path
- name: datasetId
+ name: id
schema:
type: string
minLength: 1
maxLength: 128
required: true
- - in: query
- name: limit
- schema:
- type: integer
- minimum: 1
- maximum: 100
- - in: query
- name: offset
- schema:
- type: integer
- minimum: 0
- maximum: 1000000
- - in: query
- name: page
- schema:
- type: integer
- minimum: 1
- maximum: 1000000
- - in: query
- name: pageSize
- schema:
- type: integer
- minimum: 1
- maximum: 100
- /api/v1/eval/test-cases/{id}:
- get:
- operationId: getApiV1EvalTestCasesById
- summary: getTestCase
+ /api/v1/eval/datasets/{datasetId}/test-cases:
+ post:
+ operationId: postApiV1EvalDatasetsByDatasetIdTestCases
description: "Creates accept an optional id: an identical replay returns the
resource; conflicting id or identifier returns 409. Lists are
paginated."
+ summary: Create a test case
tags:
- eval
responses:
- "200":
+ "201":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/EvalTestCase"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
content:
application/json:
schema:
- additionalProperties: false
- properties:
- data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- input:
- type: string
- expected:
- type: string
- category:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: datasetId
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 128
+ required: true
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: string
+ minLength: 1
+ maxLength: 128
+ input:
+ type: string
+ expected:
+ type: string
+ category:
+ type: string
+ choices:
+ type: array
+ items:
+ type: string
+ environment:
+ type: object
+ properties:
+ envPrompt:
+ type: string
+ toolForwarding:
+ type: object
+ propertyNames:
type: string
- choices:
- type: array
- items:
- type: string
- environment:
+ additionalProperties:
type: object
properties:
- envPrompt:
+ endpoint:
type: string
- toolForwarding:
- type: object
- propertyNames:
- type: string
- additionalProperties:
- type: object
- properties:
- endpoint:
- type: string
- format: uri
- timeoutMs:
- type: integer
- exclusiveMinimum: 0
- maximum: 9007199254740991
- required:
- - endpoint
- additionalProperties: false
+ format: uri
+ timeoutMs:
+ type: integer
+ exclusiveMinimum: 0
+ maximum: 9007199254740991
+ required:
+ - endpoint
additionalProperties: false
- messages:
- maxItems: 1000
- type: array
- items:
- type: object
- properties:
- content:
- type: string
- role:
- type: string
- enum:
- - user
- - assistant
- - system
- - tool
- id:
- type: string
- minLength: 1
- maxLength: 128
- parentId:
- anyOf:
- - type: string
- minLength: 1
- maxLength: 128
- - type: "null"
- model:
- type: string
- provider:
- type: string
- createdAt:
- type:
- - string
- - number
- updatedAt:
- type:
- - string
- - number
- tools:
- type: array
- items:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- tool_call_id:
- type: string
- metadata:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- reasoning:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- plugin:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginState:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginError:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginIntervention:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- error:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- search:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- required:
- - content
- - role
- additionalProperties: false
- caseId:
+ additionalProperties: false
+ messages:
+ maxItems: 1000
+ type: array
+ items:
+ type: object
+ properties:
+ content:
+ type: string
+ role:
+ type: string
+ enum:
+ - user
+ - assistant
+ - system
+ - tool
+ id:
type: string
minLength: 1
maxLength: 128
- sortOrder:
- type:
- - number
- - "null"
- evalMode:
+ parentId:
anyOf:
- type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- - type: "null"
- evalConfig:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
+ minLength: 1
+ maxLength: 128
- type: "null"
- createdAt:
+ model:
type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
+ provider:
+ type: string
+ createdAt:
+ type:
+ - string
+ - number
updatedAt:
+ type:
+ - string
+ - number
+ tools:
+ type: array
+ items:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ tool_call_id:
type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- datasetId:
+ metadata:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ reasoning:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ plugin:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ pluginState:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ pluginError:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ pluginIntervention:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ error:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ search:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ required:
+ - content
+ - role
+ additionalProperties: false
+ caseId:
+ type: string
+ minLength: 1
+ maxLength: 128
+ sortOrder:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ evalMode:
+ anyOf:
+ - type: string
+ enum:
+ - equals
+ - contains
+ - regex
+ - starts-with
+ - ends-with
+ - any-of
+ - numeric
+ - extract-match
+ - json-schema
+ - javascript
+ - python
+ - llm-rubric
+ - factuality
+ - answer-relevance
+ - similar
+ - levenshtein
+ - rubric
+ - external
+ - type: "null"
+ evalConfig:
+ anyOf:
+ - type: object
+ propertyNames:
type: string
- content:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- metadata:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
+ additionalProperties: {}
+ - type: "null"
+ required:
+ - input
+ additionalProperties: false
+ get:
+ operationId: getApiV1EvalDatasetsByDatasetIdTestCases
+ description: "Creates accept an optional id: an identical replay returns the
+ resource; conflicting id or identifier returns 409. Lists are
+ paginated."
+ summary: List test cases of a dataset
+ tags:
+ - eval
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ testCases:
+ type: array
+ items:
+ $ref: "#/components/schemas/EvalTestCase"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
required:
- - id
- - input
- - sortOrder
- - createdAt
- - updatedAt
- - datasetId
- - content
- - metadata
+ - testCases
+ - total
additionalProperties: false
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -10942,18 +14864,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -10962,18 +14872,43 @@ paths:
description: Internal server error
parameters:
- in: path
- name: id
+ name: datasetId
schema:
type: string
minLength: 1
maxLength: 128
required: true
- patch:
- operationId: patchApiV1EvalTestCasesById
- summary: updateTestCase
+ - in: query
+ name: limit
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 100
+ - in: query
+ name: offset
+ schema:
+ type: integer
+ minimum: 0
+ maximum: 1000000
+ - in: query
+ name: page
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 1000000
+ - in: query
+ name: pageSize
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 100
+ /api/v1/eval/test-cases/{id}:
+ get:
+ operationId: getApiV1EvalTestCasesById
description: "Creates accept an optional id: an identical replay returns the
resource; conflicting id or identifier returns 409. Lists are
paginated."
+ summary: Get a test case
tags:
- eval
responses:
@@ -10981,239 +14916,99 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- input:
- type: string
- expected:
- type: string
- category:
- type: string
- choices:
- type: array
- items:
- type: string
- environment:
- type: object
- properties:
- envPrompt:
- type: string
- toolForwarding:
- type: object
- propertyNames:
- type: string
- additionalProperties:
- type: object
- properties:
- endpoint:
- type: string
- format: uri
- timeoutMs:
- type: integer
- exclusiveMinimum: 0
- maximum: 9007199254740991
- required:
- - endpoint
- additionalProperties: false
- additionalProperties: false
- messages:
- maxItems: 1000
- type: array
- items:
- type: object
- properties:
- content:
- type: string
- role:
- type: string
- enum:
- - user
- - assistant
- - system
- - tool
- id:
- type: string
- minLength: 1
- maxLength: 128
- parentId:
- anyOf:
- - type: string
- minLength: 1
- maxLength: 128
- - type: "null"
- model:
- type: string
- provider:
- type: string
- createdAt:
- type:
- - string
- - number
- updatedAt:
- type:
- - string
- - number
- tools:
- type: array
- items:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- tool_call_id:
- type: string
- metadata:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- reasoning:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- plugin:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginState:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginError:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- pluginIntervention:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- error:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- search:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- required:
- - content
- - role
- additionalProperties: false
- caseId:
- type: string
- minLength: 1
- maxLength: 128
- sortOrder:
- type:
- - number
- - "null"
- evalMode:
- anyOf:
- - type: string
- enum:
- - equals
- - contains
- - regex
- - starts-with
- - ends-with
- - any-of
- - numeric
- - extract-match
- - json-schema
- - javascript
- - python
- - llm-rubric
- - factuality
- - answer-relevance
- - similar
- - levenshtein
- - rubric
- - external
- - type: "null"
- evalConfig:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- datasetId:
- type: string
- content:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- metadata:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- required:
- - id
- - input
- - sortOrder
- - createdAt
- - updatedAt
- - datasetId
- - content
- - metadata
- additionalProperties: false
+ $ref: "#/components/schemas/EvalTestCase"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 128
+ required: true
+ patch:
+ operationId: patchApiV1EvalTestCasesById
+ description: "Creates accept an optional id: an identical replay returns the
+ resource; conflicting id or identifier returns 409. Lists are
+ paginated."
+ summary: Update a test case
+ tags:
+ - eval
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/EvalTestCase"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -11232,18 +15027,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -11429,10 +15212,10 @@ paths:
additionalProperties: false
delete:
operationId: deleteApiV1EvalTestCasesById
- summary: deleteTestCase
description: "Creates accept an optional id: an identical replay returns the
resource; conflicting id or identifier returns 409. Lists are
paginated."
+ summary: Delete a test case
tags:
- eval
responses:
@@ -11440,49 +15223,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- required:
- - id
- additionalProperties: false
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -11501,18 +15265,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -11530,133 +15282,43 @@ paths:
/api/v1/eval/runs/{id}/claim:
post:
operationId: postApiV1EvalRunsByIdClaim
- summary: claim
- tags:
- - eval
description: "Claim: one pending worker succeeds, others receive 409. Reports:
identical replays succeed; different results conflict. Batches are
atomic. External workers can supply testCaseId to associate their own
topic with a dataset case on first report. Retry: only terminal runs,
concurrent repeats conflict."
+ summary: Claim a pending external eval run
+ tags:
+ - eval
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- config:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- executionMode:
- type: string
- enum:
- - internal
- - external
- datasetId:
- type: string
- experimentId:
- type:
- - string
- - "null"
- parentRunId:
- type:
- - string
- - "null"
- status:
- type: string
- enum:
- - idle
- - pending
- - running
- - external
- - completed
- - failed
- - aborted
- targetAgentId:
- type:
- - string
- - "null"
- name:
- type:
- - string
- - "null"
- metrics:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- startedAt:
- anyOf:
- - type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- - type: "null"
- required:
- - id
- - createdAt
- - updatedAt
- - config
- - executionMode
- - datasetId
- - experimentId
- - parentRunId
- - status
- - targetAgentId
- - name
- - metrics
- - startedAt
- additionalProperties: false
+ $ref: "#/components/schemas/EvalRun"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -11681,12 +15343,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -11704,133 +15360,43 @@ paths:
/api/v1/eval/runs/{id}/status:
patch:
operationId: patchApiV1EvalRunsByIdStatus
- summary: setStatus
- tags:
- - eval
description: "Claim: one pending worker succeeds, others receive 409. Reports:
identical replays succeed; different results conflict. Batches are
atomic. External workers can supply testCaseId to associate their own
topic with a dataset case on first report. Retry: only terminal runs,
concurrent repeats conflict."
+ summary: Set the status of an external eval run
+ tags:
+ - eval
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- id:
- type: string
- createdAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- updatedAt:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- config:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- executionMode:
- type: string
- enum:
- - internal
- - external
- datasetId:
- type: string
- experimentId:
- type:
- - string
- - "null"
- parentRunId:
- type:
- - string
- - "null"
- status:
- type: string
- enum:
- - idle
- - pending
- - running
- - external
- - completed
- - failed
- - aborted
- targetAgentId:
- type:
- - string
- - "null"
- name:
- type:
- - string
- - "null"
- metrics:
- anyOf:
- - type: object
- propertyNames:
- type: string
- additionalProperties: {}
- - type: "null"
- startedAt:
- anyOf:
- - type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- - type: "null"
- required:
- - id
- - createdAt
- - updatedAt
- - config
- - executionMode
- - datasetId
- - experimentId
- - parentRunId
- - status
- - targetAgentId
- - name
- - metrics
- - startedAt
- additionalProperties: false
+ $ref: "#/components/schemas/EvalRun"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -11855,12 +15421,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -11896,65 +15456,43 @@ paths:
/api/v1/eval/runs/{id}/retry-errors:
post:
operationId: postApiV1EvalRunsByIdRetryErrors
- summary: retryErrors
- tags:
- - eval
description: "Claim: one pending worker succeeds, others receive 409. Reports:
identical replays succeed; different results conflict. Batches are
atomic. External workers can supply testCaseId to associate their own
topic with a dataset case on first report. Retry: only terminal runs,
concurrent repeats conflict."
+ summary: Retry the errored cases of an eval run
+ tags:
+ - eval
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- runId:
- type: string
- retryCount:
- type: number
- required:
- - runId
- - retryCount
- additionalProperties: false
+ $ref: "#/components/schemas/EvalRetryErrors"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -11979,12 +15517,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -12002,84 +15534,43 @@ paths:
/api/v1/eval/runs/{runId}/topics/{topicId}/result:
put:
operationId: putApiV1EvalRunsByRunIdTopicsByTopicIdResult
- summary: report
- tags:
- - eval
description: "Claim: one pending worker succeeds, others receive 409. Reports:
identical replays succeed; different results conflict. Batches are
atomic. External workers can supply testCaseId to associate their own
topic with a dataset case on first report. Retry: only terminal runs,
concurrent repeats conflict."
+ summary: Report the result of one run topic
+ tags:
+ - eval
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $schema: https://json-schema.org/draft/2020-12/schema
- type: object
- properties:
- idempotent:
- type: boolean
- reportedThreads:
- type: number
- runId:
- type: string
- runStatus:
- type: string
- success:
- type: boolean
- threadId:
- type: string
- topicFinalized:
- type: boolean
- topicId:
- type: string
- totalThreads:
- type: number
- required:
- - idempotent
- - reportedThreads
- - runId
- - success
- - topicFinalized
- - topicId
- - totalThreads
- additionalProperties: false
+ $ref: "#/components/schemas/EvalReportResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -12104,12 +15595,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -12170,64 +15655,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- type: object
- properties:
- plugins:
- type: array
- items:
- type: object
- additionalProperties: false
- properties:
- identifier:
- type: string
- type:
- type: string
- createdAt:
- format: date-time
- type: string
- updatedAt:
- format: date-time
- type: string
- total:
- type: integer
- required:
- - plugins
- - total
+ $ref: "#/components/schemas/InstalledPluginList"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -12240,24 +15691,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -12292,99 +15725,38 @@ paths:
/api/v1/files:
get:
operationId: getApiV1Files
- parameters:
- - in: query
- name: keyword
- schema:
- type: string
- - in: query
- name: page
- schema:
- type: string
- - in: query
- name: pageSize
- schema:
- type: string
- - in: query
- name: fileType
- schema:
- type: string
- - in: query
- name: knowledgeBaseId
- schema:
- type: string
- - in: query
- name: queryAll
- schema:
- type: string
- - in: query
- name: updatedAtEnd
- schema:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- - in: query
- name: updatedAtStart
- schema:
- type: string
- format: date-time
- pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
- - in: query
- name: userId
- schema:
- type: string
+ summary: List files
+ tags:
+ - files
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- properties:
- files:
- items:
- $ref: "#/components/schemas/File"
- type: array
- total:
- minimum: 0
- type: integer
- required:
- - files
- type: object
+ $ref: "#/components/schemas/FileList"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -12397,32 +15769,53 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - files
+ parameters:
+ - in: query
+ name: keyword
+ schema:
+ type: string
+ - in: query
+ name: page
+ schema:
+ type: string
+ - in: query
+ name: pageSize
+ schema:
+ type: string
+ - in: query
+ name: fileType
+ schema:
+ type: string
+ - in: query
+ name: knowledgeBaseId
+ schema:
+ type: string
+ - in: query
+ name: queryAll
+ schema:
+ type: string
+ - in: query
+ name: updatedAtEnd
+ schema:
+ type: string
+ format: date-time
+ pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
+ - in: query
+ name: updatedAtStart
+ schema:
+ type: string
+ format: date-time
+ pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
+ - in: query
+ name: userId
+ schema:
+ type: string
post:
operationId: postApiV1Files
requestBody:
@@ -12457,30 +15850,23 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: false
- properties:
- file:
- $ref: "#/components/schemas/File"
- parsed:
- type: object
- required:
- - file
- type: object
+ $ref: "#/components/schemas/FileDetail"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
content:
@@ -12500,24 +15886,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -12527,62 +15895,40 @@ paths:
/api/v1/files/{id}:
get:
operationId: getApiV1FilesById
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
+ description: Non-image files include their parse result. A file that does not
+ exist answers 400.
+ summary: Get a file
+ tags:
+ - files
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: false
- properties:
- file:
- $ref: "#/components/schemas/File"
- parsed:
- type: object
- required:
- - file
- type: object
+ $ref: "#/components/schemas/FileDetail"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -12595,34 +15941,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - files
- patch:
- operationId: patchApiV1FilesById
parameters:
- in: path
name: id
@@ -12630,58 +15954,40 @@ paths:
type: string
minLength: 1
required: true
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- knowledgeBaseId:
- type:
- - string
- - "null"
+ patch:
+ operationId: patchApiV1FilesById
+ summary: Update a file
+ tags:
+ - files
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/File"
+ $ref: "#/components/schemas/FileDetail"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -12700,28 +16006,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - files
- delete:
- operationId: deleteApiV1FilesById
parameters:
- in: path
name: id
@@ -12729,50 +16019,51 @@ paths:
type: string
minLength: 1
required: true
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ knowledgeBaseId:
+ type:
+ - string
+ - "null"
+ delete:
+ operationId: deleteApiV1FilesById
+ summary: Delete a file
+ tags:
+ - files
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - object
- - "null"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -12785,35 +16076,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - files
- /api/v1/files/{id}/url:
- get:
- operationId: getApiV1FilesByIdUrl
parameters:
- in: path
name: id
@@ -12821,54 +16089,41 @@ paths:
type: string
minLength: 1
required: true
- - in: query
- name: expiresIn
- schema:
- type:
- - string
- - "null"
+ /api/v1/files/{id}/url:
+ get:
+ operationId: getApiV1FilesByIdUrl
+ summary: Get a pre-signed file URL
+ tags:
+ - files
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ $ref: "#/components/schemas/FileUrl"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -12881,35 +16136,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - files
- /api/v1/files/{id}/parses:
- post:
- operationId: postApiV1FilesByIdParses
parameters:
- in: path
name: id
@@ -12918,53 +16150,46 @@ paths:
minLength: 1
required: true
- in: query
- name: skipExist
+ name: expiresIn
schema:
type:
- string
- "null"
+ /api/v1/files/{id}/parses:
+ post:
+ operationId: postApiV1FilesByIdParses
+ summary: Parse file content
+ tags:
+ - files
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ $ref: "#/components/schemas/FileParseResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -12977,35 +16202,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - files
- /api/v1/files/{id}/chunks:
- post:
- operationId: postApiV1FilesByIdChunks
parameters:
- in: path
name: id
@@ -13013,59 +16215,47 @@ paths:
type: string
minLength: 1
required: true
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- autoEmbedding:
- type: boolean
- skipExist:
- type: boolean
+ - in: query
+ name: skipExist
+ schema:
+ type:
+ - string
+ - "null"
+ /api/v1/files/{id}/chunks:
+ post:
+ operationId: postApiV1FilesByIdChunks
+ summary: Start a file chunking task
+ tags:
+ - files
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ $ref: "#/components/schemas/FileChunkTask"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -13078,34 +16268,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - files
- get:
- operationId: getApiV1FilesByIdChunks
parameters:
- in: path
name: id
@@ -13113,48 +16281,51 @@ paths:
type: string
minLength: 1
required: true
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ autoEmbedding:
+ type: boolean
+ skipExist:
+ type: boolean
+ get:
+ operationId: getApiV1FilesByIdChunks
+ summary: Get file chunking status
+ tags:
+ - files
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ $ref: "#/components/schemas/FileChunkStatus"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -13167,32 +16338,19 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - files
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ required: true
/api/v1/files/batches:
post:
operationId: postApiV1FilesBatches
@@ -13230,70 +16388,23 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
- properties:
- data:
- additionalProperties: false
- properties:
- failed:
- items:
- additionalProperties: false
- properties:
- error:
- type: string
- name:
- type: string
- required:
- - error
- - name
- type: object
- type: array
- successful:
- items:
- additionalProperties: false
- properties:
- file:
- $ref: "#/components/schemas/File"
- parsed:
- type: object
- required:
- - file
- type: object
- type: array
- summary:
- additionalProperties: false
- properties:
- failed:
- minimum: 0
- type: integer
- successful:
- minimum: 0
- type: integer
- total:
- minimum: 0
- type: integer
- required:
- - failed
- - successful
- - total
- type: object
- required:
- - failed
- - successful
- - summary
- type: object
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/BatchFileUploadResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
content:
@@ -13313,33 +16424,65 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
+ "500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
+ description: Internal server error
+ /api/v1/files/queries:
+ post:
+ operationId: postApiV1FilesQueries
+ summary: Get several files
+ tags:
+ - files
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/BatchGetFilesResult"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Invalid request
+ "401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- /api/v1/files/queries:
- post:
- operationId: postApiV1FilesQueries
requestBody:
required: true
content:
@@ -13355,85 +16498,41 @@ paths:
minLength: 1
required:
- fileIds
+ /api/v1/goals:
+ get:
+ operationId: getApiV1Goals
+ summary: List goals
+ tags:
+ - goals
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: false
- properties:
- failed:
- items:
- additionalProperties: false
- properties:
- error:
- type: string
- fileId:
- type: string
- required:
- - error
- - fileId
- type: object
- type: array
- files:
- items:
- additionalProperties: false
- properties:
- file:
- $ref: "#/components/schemas/File"
- parsed:
- type: object
- required:
- - file
- type: object
- type: array
- success:
- minimum: 0
- type: integer
- total:
- minimum: 0
- type: integer
- required:
- - failed
- - files
- - success
- - total
- type: object
+ $ref: "#/components/schemas/GoalList"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -13446,35 +16545,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - files
- /api/v1/goals:
- get:
- operationId: getApiV1Goals
parameters:
- in: query
name: agentId
@@ -13504,51 +16580,41 @@ paths:
name: topicId
schema:
type: string
+ post:
+ operationId: postApiV1Goals
+ description: Creates the goal graph and hands it to the coordinator.
+ summary: Create a goal
+ tags:
+ - goals
responses:
- "200":
+ "201":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/GoalGraphSnapshot"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -13567,28 +16633,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - goals
- post:
- operationId: postApiV1Goals
requestBody:
required: true
content:
@@ -13650,51 +16700,41 @@ paths:
minLength: 1
required:
- title
+ /api/v1/goals/{id}:
+ get:
+ operationId: getApiV1GoalsById
+ summary: Get a goal and its graph
+ tags:
+ - goals
responses:
- "201":
+ "200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/GoalGraph"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -13713,29 +16753,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - goals
- /api/v1/goals/{id}:
- get:
- operationId: getApiV1GoalsById
parameters:
- in: path
name: id
@@ -13743,51 +16766,40 @@ paths:
type: string
minLength: 1
required: true
+ patch:
+ operationId: patchApiV1GoalsById
+ summary: Update a goal requirement or budget
+ tags:
+ - goals
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/GoalGraph"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -13806,28 +16818,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - goals
- patch:
- operationId: patchApiV1GoalsById
parameters:
- in: path
name: id
@@ -13889,51 +16885,40 @@ paths:
requirement:
type: string
minLength: 1
+ delete:
+ operationId: deleteApiV1GoalsById
+ summary: Delete a goal
+ tags:
+ - goals
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -13958,22 +16943,18 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
+ "412":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Precondition failed
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - goals
- delete:
- operationId: deleteApiV1GoalsById
parameters:
- in: path
name: id
@@ -13981,92 +16962,10 @@ paths:
type: string
minLength: 1
required: true
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - goals
/api/v1/goals/{id}/supervision:
get:
operationId: getGoalSupervision
+ summary: Get goal supervision state
tags:
- goals
responses:
@@ -14074,46 +16973,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/GoalSupervision"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -14132,18 +17015,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -14160,6 +17031,7 @@ paths:
/api/v1/goals/{id}/advance:
post:
operationId: advanceGoal
+ summary: Run the goal coordinator now
tags:
- goals
responses:
@@ -14167,46 +17039,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/GoalAdvanceResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -14225,18 +17081,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -14253,6 +17097,7 @@ paths:
/api/v1/goals/{id}/pause:
post:
operationId: pauseGoal
+ summary: Pause a goal
tags:
- goals
responses:
@@ -14260,46 +17105,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/Goal"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -14324,12 +17153,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
+ "412":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Precondition failed
"500":
content:
application/json:
@@ -14346,6 +17175,7 @@ paths:
/api/v1/goals/{id}/resume:
post:
operationId: resumeGoal
+ summary: Resume a paused goal
tags:
- goals
responses:
@@ -14353,46 +17183,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/Goal"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -14417,12 +17231,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
+ "412":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Precondition failed
"500":
content:
application/json:
@@ -14439,6 +17253,7 @@ paths:
/api/v1/goals/{id}/restart:
post:
operationId: restartGoal
+ summary: Restart every unfinished task of a goal
tags:
- goals
responses:
@@ -14446,46 +17261,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/GoalRestartResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -14504,18 +17303,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ "412":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Precondition failed
"500":
content:
application/json:
@@ -14550,108 +17343,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: false
- properties:
- accepted:
- type: boolean
- operationId:
- type:
- - string
- - "null"
- topicId:
- type: string
- userMessage:
- additionalProperties: false
- properties:
- agentId:
- type:
- - string
- - "null"
- content:
- type: string
- createdAt:
- format: date-time
- type: string
- error:
- type: boolean
- files:
- type: array
- items:
- type: object
- additionalProperties: false
- properties:
- id:
- type: string
- name:
- type: string
- fileType:
- type: string
- size:
- type: number
- url:
- type: string
- required:
- - id
- - name
- - fileType
- - size
- - url
- id:
- type: string
- role:
- enum:
- - assistant
- - user
- type: string
- required:
- - agentId
- - content
- - createdAt
- - error
- - id
- - role
- type: object
- required:
- - accepted
- - operationId
- - topicId
- - userMessage
- type: object
+ $ref: "#/components/schemas/ImSendResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -14676,12 +17391,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -14761,127 +17470,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: false
- properties:
- cursor:
- type: string
- messages:
- items:
- additionalProperties: false
- properties:
- agentId:
- type:
- - string
- - "null"
- content:
- type: string
- createdAt:
- format: date-time
- type: string
- error:
- type: boolean
- files:
- type: array
- items:
- type: object
- additionalProperties: false
- properties:
- id:
- type: string
- name:
- type: string
- fileType:
- type: string
- size:
- type: number
- url:
- type: string
- required:
- - id
- - name
- - fileType
- - size
- - url
- id:
- type: string
- role:
- enum:
- - assistant
- - user
- type: string
- required:
- - agentId
- - content
- - createdAt
- - error
- - id
- - role
- type: object
- type: array
- readUpTo:
- anyOf:
- - additionalProperties: false
- properties:
- messageId:
- type: string
- readAt:
- format: date-time
- type: string
- required:
- - messageId
- - readAt
- type: object
- - type: "null"
- state:
- type: string
- typing:
- type: boolean
- unread:
- minimum: 0
- type: integer
- required:
- - cursor
- - messages
- - readUpTo
- - state
- - typing
- - unread
- type: object
+ $ref: "#/components/schemas/ImSyncResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -14900,18 +17512,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -14958,49 +17558,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: false
- properties:
- unread:
- minimum: 0
- type: integer
- required:
- - unread
- type: object
+ $ref: "#/components/schemas/ImReadResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -15019,46 +17600,84 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: topicId
+ schema:
+ type: string
+ minLength: 1
+ required: true
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ messageId:
+ type: string
+ minLength: 1
+ required:
+ - messageId
+ /api/v1/knowledge-bases:
+ get:
+ operationId: getApiV1KnowledgeBases
+ summary: List knowledge bases
+ tags:
+ - knowledge-bases
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/KnowledgeBaseList"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Authentication required
+ "403":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Insufficient permission
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- parameters:
- - in: path
- name: topicId
- schema:
- type: string
- minLength: 1
- required: true
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- messageId:
- type: string
- minLength: 1
- required:
- - messageId
- /api/v1/knowledge-bases:
- get:
- operationId: getApiV1KnowledgeBases
parameters:
- in: query
name: keyword
@@ -15072,58 +17691,40 @@ paths:
name: pageSize
schema:
type: string
+ post:
+ operationId: postApiV1KnowledgeBases
+ summary: Create a knowledge base
+ tags:
+ - knowledge-bases
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- properties:
- knowledgeBases:
- items:
- $ref: "#/components/schemas/KnowledgeBase"
- type: array
- total:
- minimum: 0
- type: integer
- required:
- - knowledgeBases
- type: object
+ $ref: "#/components/schemas/KnowledgeBaseDetail"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -15136,34 +17737,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - knowledge-bases
- post:
- operationId: postApiV1KnowledgeBases
requestBody:
required: true
content:
@@ -15183,47 +17762,41 @@ paths:
maxLength: 255
required:
- name
+ /api/v1/knowledge-bases/{id}:
+ get:
+ operationId: getApiV1KnowledgeBasesById
+ summary: Get a knowledge base
+ tags:
+ - knowledge-bases
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/KnowledgeBase"
+ $ref: "#/components/schemas/KnowledgeBaseDetail"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -15242,29 +17815,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - knowledge-bases
- /api/v1/knowledge-bases/{id}:
- get:
- operationId: getApiV1KnowledgeBasesById
parameters:
- in: path
name: id
@@ -15272,47 +17828,40 @@ paths:
type: string
minLength: 1
required: true
+ patch:
+ operationId: patchApiV1KnowledgeBasesById
+ summary: Update a knowledge base
+ tags:
+ - knowledge-bases
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/KnowledgeBase"
+ $ref: "#/components/schemas/KnowledgeBaseDetail"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -15331,28 +17880,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - knowledge-bases
- patch:
- operationId: patchApiV1KnowledgeBasesById
parameters:
- in: path
name: id
@@ -15377,47 +17910,41 @@ paths:
type: string
minLength: 1
maxLength: 255
+ delete:
+ operationId: deleteApiV1KnowledgeBasesById
+ description: Also deletes the files that belong to no other knowledge base.
+ summary: Delete a knowledge base
+ tags:
+ - knowledge-bases
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/KnowledgeBase"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -15436,28 +17963,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - knowledge-bases
- delete:
- operationId: deleteApiV1KnowledgeBasesById
parameters:
- in: path
name: id
@@ -15465,50 +17976,41 @@ paths:
type: string
minLength: 1
required: true
+ /api/v1/knowledge-bases/{id}/files:
+ get:
+ operationId: getApiV1KnowledgeBasesByIdFiles
+ summary: List the files of a knowledge base
+ tags:
+ - knowledge-bases
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - object
- - "null"
+ $ref: "#/components/schemas/FileList"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -15520,36 +18022,19 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Insufficient permission
+ "404":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Resource not found
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - knowledge-bases
- /api/v1/knowledge-bases/{id}/files:
- get:
- operationId: getApiV1KnowledgeBasesByIdFiles
parameters:
- in: path
name: id
@@ -15575,48 +18060,41 @@ paths:
type:
- string
- "null"
+ /api/v1/knowledge-bases/{id}/files/batch:
+ post:
+ operationId: postApiV1KnowledgeBasesByIdFilesBatch
+ summary: Add files to a knowledge base
+ tags:
+ - knowledge-bases
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ $ref: "#/components/schemas/KnowledgeBaseFileOperationResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -15635,29 +18113,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - knowledge-bases
- /api/v1/knowledge-bases/{id}/files/batch:
- post:
- operationId: postApiV1KnowledgeBasesByIdFilesBatch
parameters:
- in: path
name: id
@@ -15680,48 +18141,42 @@ paths:
minLength: 1
required:
- fileIds
+ delete:
+ operationId: deleteApiV1KnowledgeBasesByIdFilesBatch
+ description: Detaches the files from the knowledge base without deleting them,
+ and reports per file which ones were detached.
+ summary: Remove files from a knowledge base
+ tags:
+ - knowledge-bases
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ $ref: "#/components/schemas/KnowledgeBaseFileOperationResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -15740,28 +18195,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - knowledge-bases
- delete:
- operationId: deleteApiV1KnowledgeBasesByIdFilesBatch
parameters:
- in: path
name: id
@@ -15784,50 +18223,41 @@ paths:
minLength: 1
required:
- fileIds
+ /api/v1/knowledge-bases/{id}/files/move:
+ post:
+ operationId: postApiV1KnowledgeBasesByIdFilesMove
+ summary: Move files to another knowledge base
+ tags:
+ - knowledge-bases
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - object
- - "null"
+ $ref: "#/components/schemas/KnowledgeBaseFileOperationResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -15846,29 +18276,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - knowledge-bases
- /api/v1/knowledge-bases/{id}/files/move:
- post:
- operationId: postApiV1KnowledgeBasesByIdFilesMove
parameters:
- in: path
name: id
@@ -15895,86 +18308,6 @@ paths:
required:
- fileIds
- targetKnowledgeBaseId
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- additionalProperties: true
- type: object
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - knowledge-bases
/api/v1/mcp-servers:
get:
operationId: getApiV1McpServers
@@ -15986,61 +18319,38 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
+ type: array
items:
$ref: "#/components/schemas/McpServer"
- type: array
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
- "400":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Invalid request
"401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ "403":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Insufficient permission
"500":
content:
application/json:
@@ -16057,42 +18367,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/McpServer"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -16105,24 +18403,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
"409":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -16209,55 +18495,38 @@ paths:
/api/v1/mcp-servers/{id}:
get:
operationId: getApiV1McpServersById
- parameters:
- - in: path
- name: id
- schema:
- type: string
- format: uuid
- pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
- required: true
+ summary: Get a remote MCP server
+ tags:
+ - mcp-servers
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/McpServer"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -16276,28 +18545,80 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
+ "500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ format: uuid
+ pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
+ required: true
+ patch:
+ operationId: patchApiV1McpServersById
+ description: Changing `serverUrl` or `credentials` resets the status to
+ `disconnected`.
+ summary: Update a remote MCP server
+ tags:
+ - mcp-servers
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/McpServer"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - mcp-servers
- patch:
- operationId: patchApiV1McpServersById
parameters:
- in: path
name: id
@@ -16377,139 +18698,40 @@ paths:
maxLength: 2048
format: uri
additionalProperties: false
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $ref: "#/components/schemas/McpServer"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - mcp-servers
delete:
operationId: deleteApiV1McpServersById
- parameters:
- - in: path
- name: id
- schema:
- type: string
- format: uuid
- pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
- required: true
+ summary: Delete a remote MCP server
+ tags:
+ - mcp-servers
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - object
- - "null"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -16527,27 +18749,21 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Resource not found
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - mcp-servers
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ format: uuid
+ pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
+ required: true
/api/v1/mcp-servers/{id}/sync:
post:
operationId: postApiV1McpServersByIdSync
@@ -16559,57 +18775,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: false
- properties:
- id:
- format: uuid
- type: string
- status:
- const: connected
- type: string
- toolCount:
- minimum: 0
- type: integer
- required:
- - id
- - status
- - toolCount
- type: object
+ $ref: "#/components/schemas/McpServerSyncResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -16628,18 +18817,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -16657,6 +18834,7 @@ paths:
/api/v1/memories/persona:
get:
operationId: getMemoryPersona
+ description: "`data` is null until a persona has been written."
summary: Get the current persona document
tags:
- memories
@@ -16665,33 +18843,26 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ anyOf:
+ - $ref: "#/components/schemas/MemoryPersona"
+ - type: "null"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
- "400":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Invalid request
"401":
content:
application/json:
@@ -16704,24 +18875,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -16739,33 +18892,26 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ type: array
+ items:
+ $ref: "#/components/schemas/MemoryPersonaVersion"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
- "400":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Invalid request
"401":
content:
application/json:
@@ -16778,34 +18924,65 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
+ "500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
+ description: Internal server error
+ /api/v1/memories:
+ delete:
+ operationId: deleteAllMemories
+ description: Removes every memory, the persona and the per-topic extraction
+ status; `count` is the number of memories removed.
+ summary: Delete all memory entries
+ tags:
+ - memories
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/DeletedResources"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Authentication required
+ "403":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Insufficient permission
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- /api/v1/memories:
+ /api/v1/memories/{category}/{id}:
delete:
- operationId: deleteAllMemories
- summary: Delete all memory entries
+ operationId: deleteMemoryEntry
+ summary: Delete a memory entry
tags:
- memories
responses:
@@ -16813,26 +18990,23 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
content:
@@ -16858,27 +19032,36 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- /api/v1/memories/{category}/{id}:
- delete:
- operationId: deleteMemoryEntry
+ parameters:
+ - in: path
+ name: category
+ schema:
+ type: string
+ enum:
+ - identities
+ - preferences
+ - contexts
+ - activities
+ - experiences
+ required: true
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ required: true
+ /api/v1/memories/{category}:
+ get:
+ operationId: listMemoryCategory
+ description: Every identity, or the newest entries of the other categories; the
+ array shape follows `category`.
+ summary: List the entries of a memory category
tags:
- memories
responses:
@@ -16886,46 +19069,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/MemoryCategoryEntries"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -16938,24 +19105,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -16974,62 +19123,41 @@ paths:
- activities
- experiences
required: true
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- required: true
- /api/v1/memories/{category}:
- get:
- operationId: listMemoryCategory
+ /api/v1/message-translations/{messageId}:
+ post:
+ operationId: postApiV1MessageTranslationsByMessageId
+ summary: Translate a message
tags:
- - memories
+ - message-translations
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/MessageTranslationWrite"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -17042,45 +19170,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- parameters:
- - in: path
- name: category
- schema:
- type: string
- enum:
- - identities
- - preferences
- - contexts
- - activities
- - experiences
- required: true
- /api/v1/message-translations/{messageId}:
- post:
- operationId: postApiV1MessageTranslationsByMessageId
parameters:
- in: path
name: messageId
@@ -17110,48 +19205,43 @@ paths:
minLength: 1
required:
- to
+ get:
+ operationId: getApiV1MessageTranslationsByMessageId
+ description: "`null` when the message has no stored translation."
+ summary: Get a message's translation
+ tags:
+ - message-translations
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ anyOf:
+ - $ref: "#/components/schemas/MessageTranslation"
+ - type: "null"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -17164,34 +19254,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - message-translations
- get:
- operationId: getApiV1MessageTranslationsByMessageId
parameters:
- in: path
name: messageId
@@ -17199,48 +19267,40 @@ paths:
type: string
minLength: 1
required: true
+ patch:
+ operationId: patchApiV1MessageTranslationsByMessageId
+ summary: Set a message's translation
+ tags:
+ - message-translations
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ $ref: "#/components/schemas/MessageTranslationWrite"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -17253,34 +19313,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - message-translations
- patch:
- operationId: patchApiV1MessageTranslationsByMessageId
parameters:
- in: path
name: messageId
@@ -17312,48 +19350,41 @@ paths:
type: string
required:
- to
+ delete:
+ operationId: deleteApiV1MessageTranslationsByMessageId
+ description: "`id` is the id of the message whose translation was removed."
+ summary: Delete a message's translation
+ tags:
+ - message-translations
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -17372,28 +19403,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - message-translations
- delete:
- operationId: deleteApiV1MessageTranslationsByMessageId
parameters:
- in: path
name: messageId
@@ -17401,48 +19416,49 @@ paths:
type: string
minLength: 1
required: true
+ /api/v1/messages/count:
+ get:
+ operationId: getApiV1MessagesCount
+ summary: Count messages
+ tags:
+ - messages
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
type: object
+ properties:
+ count:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - count
+ additionalProperties: false
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -17454,36 +19470,13 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Insufficient permission
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - message-translations
- /api/v1/messages/count:
- get:
- operationId: getApiV1MessagesCount
parameters:
- in: query
name: topicId
@@ -17507,54 +19500,54 @@ paths:
type:
- string
- "null"
+ /api/v1/messages:
+ get:
+ operationId: getApiV1Messages
+ summary: List messages
+ tags:
+ - messages
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: false
+ type: object
properties:
- count:
- minimum: 0
+ messages:
+ type: array
+ items:
+ $ref: "#/components/schemas/Message"
+ total:
type: integer
+ minimum: 0
+ maximum: 9007199254740991
required:
- - count
- type: object
+ - messages
+ - total
+ additionalProperties: false
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -17567,35 +19560,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - messages
- /api/v1/messages:
- get:
- operationId: getApiV1Messages
parameters:
- in: query
name: threadId
@@ -17653,58 +19623,40 @@ paths:
type: integer
minimum: 0
maximum: 1000000
+ post:
+ operationId: postApiV1Messages
+ summary: Create a message
+ tags:
+ - messages
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- properties:
- messages:
- items:
- $ref: "#/components/schemas/Message"
- type: array
- total:
- minimum: 0
- type: integer
- required:
- - messages
- type: object
+ $ref: "#/components/schemas/Message"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -17717,34 +19669,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - messages
- post:
- operationId: postApiV1Messages
requestBody:
required: true
content:
@@ -17832,47 +19762,42 @@ paths:
required:
- content
- role
+ delete:
+ operationId: deleteApiV1Messages
+ description: "Best effort: ids the caller may not delete or that no longer exist
+ are skipped. `count` is the number of messages actually removed."
+ summary: Delete messages in batch
+ tags:
+ - messages
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/Message"
+ $ref: "#/components/schemas/DeletedResources"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -17885,34 +19810,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - messages
- delete:
- operationId: deleteApiV1Messages
requestBody:
required: true
content:
@@ -17928,50 +19831,41 @@ paths:
minLength: 1
required:
- messageIds
+ /api/v1/messages/{id}:
+ get:
+ operationId: getApiV1MessagesById
+ summary: Get a message
+ tags:
+ - messages
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - object
- - "null"
+ $ref: "#/components/schemas/Message"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -17990,29 +19884,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - messages
- /api/v1/messages/{id}:
- get:
- operationId: getApiV1MessagesById
parameters:
- in: path
name: id
@@ -18020,47 +19897,40 @@ paths:
type: string
minLength: 1
required: true
+ delete:
+ operationId: deleteApiV1MessagesById
+ summary: Delete a message
+ tags:
+ - messages
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/Message"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -18079,28 +19949,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - messages
- delete:
- operationId: deleteApiV1MessagesById
parameters:
- in: path
name: id
@@ -18108,50 +19962,45 @@ paths:
type: string
minLength: 1
required: true
+ /api/v1/messages/replies:
+ post:
+ operationId: postApiV1MessagesReplies
+ description: Stores the user message, then generates and stores the assistant
+ reply. Answers with the reply; `null` only if it could not be read back.
+ summary: Create a user message and generate an AI reply
+ tags:
+ - messages
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - object
- - "null"
+ anyOf:
+ - $ref: "#/components/schemas/Message"
+ - type: "null"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -18164,35 +20013,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - messages
- /api/v1/messages/replies:
- post:
- operationId: postApiV1MessagesReplies
requestBody:
required: true
content:
@@ -18276,49 +20102,54 @@ paths:
required:
- content
- role
+ /api/v1/models:
+ get:
+ operationId: getApiV1Models
+ summary: List models
+ tags:
+ - models
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- anyOf:
- - $ref: "#/components/schemas/Message"
- - type: "null"
+ type: object
+ properties:
+ models:
+ type: array
+ items:
+ $ref: "#/components/schemas/Model"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - models
+ - total
+ additionalProperties: false
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -18331,35 +20162,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - messages
- /api/v1/models:
- get:
- operationId: getApiV1Models
parameters:
- in: query
name: keyword
@@ -18404,58 +20212,40 @@ paths:
- decision
- stt
- type: "null"
+ post:
+ operationId: postApiV1Models
+ summary: Create a model
+ tags:
+ - models
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- properties:
- models:
- items:
- $ref: "#/components/schemas/Model"
- type: array
- total:
- minimum: 0
- type: integer
- required:
- - models
- type: object
+ $ref: "#/components/schemas/Model"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -18468,34 +20258,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - models
- post:
- operationId: postApiV1Models
requestBody:
required: true
content:
@@ -18597,47 +20365,41 @@ paths:
- displayName
- id
- providerId
+ /api/v1/models/{providerId}/{modelId}:
+ get:
+ operationId: getApiV1ModelsByProviderIdByModelId
+ summary: Get a model
+ tags:
+ - models
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/Model"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -18656,29 +20418,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - models
- /api/v1/models/{providerId}/{modelId}:
- get:
- operationId: getApiV1ModelsByProviderIdByModelId
parameters:
- in: path
name: modelId
@@ -18694,48 +20439,40 @@ paths:
minLength: 1
maxLength: 64
required: true
+ patch:
+ operationId: patchApiV1ModelsByProviderIdByModelId
+ summary: Update a model
+ tags:
+ - models
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ $ref: "#/components/schemas/Model"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -18754,28 +20491,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - models
- patch:
- operationId: patchApiV1ModelsByProviderIdByModelId
parameters:
- in: path
name: modelId
@@ -18880,48 +20601,45 @@ paths:
- decision
- stt
- type: "null"
+ /api/v1/notifications:
+ get:
+ operationId: getApiV1Notifications
+ description: Unarchived notifications, newest first; pass the last `id` as
+ `cursor` for the next page.
+ summary: List notifications
+ tags:
+ - notifications
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ type: array
+ items:
+ $ref: "#/components/schemas/Notification"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -18934,35 +20652,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - models
- /api/v1/notifications:
- get:
- operationId: getApiV1Notifications
parameters:
- in: query
name: category
@@ -18996,89 +20691,6 @@ paths:
enum:
- "true"
- "false"
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - notifications
/api/v1/notifications/settings:
get:
operationId: getNotificationSettings
@@ -19090,46 +20702,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/NotificationSettings"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -19142,24 +20738,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -19177,6 +20755,7 @@ paths:
- workspace
patch:
operationId: updateNotificationSettings
+ description: Answers with the merged settings now stored for the scope.
summary: Update notification delivery settings
tags:
- notifications
@@ -19185,46 +20764,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/NotificationSettings"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -19237,24 +20800,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -19381,33 +20926,24 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/NotificationUnreadCount"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
- "400":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Invalid request
"401":
content:
application/json:
@@ -19420,24 +20956,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -19455,33 +20973,26 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ type: array
+ items:
+ $ref: "#/components/schemas/NotificationCategoryCount"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
- "400":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Invalid request
"401":
content:
application/json:
@@ -19494,24 +21005,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -19521,6 +21014,7 @@ paths:
/api/v1/notifications/read:
post:
operationId: markNotificationsRead
+ summary: Mark notifications as read
tags:
- notifications
responses:
@@ -19528,46 +21022,28 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
- data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - message
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -19580,24 +21056,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -19630,33 +21088,22 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
- data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - message
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
- "400":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Invalid request
"401":
content:
application/json:
@@ -19669,24 +21116,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -19704,33 +21133,22 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
- data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - message
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
- "400":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Invalid request
"401":
content:
application/json:
@@ -19743,24 +21161,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -19770,6 +21170,7 @@ paths:
/api/v1/notifications/{id}/archive:
post:
operationId: archiveNotification
+ summary: Archive a notification
tags:
- notifications
responses:
@@ -19777,46 +21178,28 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
- data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - message
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -19829,24 +21212,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -19863,6 +21228,56 @@ paths:
/api/v1/permissions:
get:
operationId: getApiV1Permissions
+ summary: List permissions
+ tags:
+ - permissions
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/PermissionList"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
parameters:
- in: query
name: active
@@ -19889,58 +21304,40 @@ paths:
name: pageSize
schema:
type: string
+ post:
+ operationId: postApiV1Permissions
+ summary: Create a permission
+ tags:
+ - permissions
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- properties:
- permissions:
- items:
- $ref: "#/components/schemas/Permission"
- type: array
- total:
- minimum: 0
- type: integer
- required:
- - permissions
- type: object
+ $ref: "#/components/schemas/Permission"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -19953,34 +21350,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - permissions
- post:
- operationId: postApiV1Permissions
requestBody:
required: true
content:
@@ -20010,47 +21385,41 @@ paths:
- category
- code
- name
+ /api/v1/permissions/{id}:
+ get:
+ operationId: getApiV1PermissionsById
+ summary: Get a permission
+ tags:
+ - permissions
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/Permission"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -20069,29 +21438,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - permissions
- /api/v1/permissions/{id}:
- get:
- operationId: getApiV1PermissionsById
parameters:
- in: path
name: id
@@ -20100,47 +21452,40 @@ paths:
minLength: 16
maxLength: 16
required: true
+ patch:
+ operationId: patchApiV1PermissionsById
+ summary: Update a permission
+ tags:
+ - permissions
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/Permission"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -20159,28 +21504,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - permissions
- patch:
- operationId: patchApiV1PermissionsById
parameters:
- in: path
name: id
@@ -20214,47 +21543,40 @@ paths:
name:
type: string
minLength: 1
+ delete:
+ operationId: deleteApiV1PermissionsById
+ summary: Delete a permission
+ tags:
+ - permissions
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/Permission"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -20273,28 +21595,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - permissions
- delete:
- operationId: deleteApiV1PermissionsById
parameters:
- in: path
name: id
@@ -20303,91 +21609,72 @@ paths:
minLength: 16
maxLength: 16
required: true
+ /api/v1/providers:
+ get:
+ operationId: getApiV1Providers
+ summary: List providers
+ tags:
+ - providers
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - object
- - "null"
+ type: object
+ properties:
+ providers:
+ type: array
+ items:
+ $ref: "#/components/schemas/Provider"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - providers
+ - total
+ additionalProperties: false
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
+ description: Invalid request
+ "401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Authentication required
+ "403":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Insufficient permission
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - permissions
- /api/v1/providers:
- get:
- operationId: getApiV1Providers
parameters:
- in: query
name: keyword
@@ -20405,58 +21692,40 @@ paths:
name: enabled
schema:
type: boolean
+ post:
+ operationId: postApiV1Providers
+ summary: Create a provider
+ tags:
+ - providers
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- properties:
- providers:
- items:
- $ref: "#/components/schemas/Provider"
- type: array
- total:
- minimum: 0
- type: integer
- required:
- - providers
- type: object
+ $ref: "#/components/schemas/Provider"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -20469,34 +21738,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - providers
- post:
- operationId: postApiV1Providers
requestBody:
required: true
content:
@@ -20559,47 +21806,41 @@ paths:
minLength: 1
required:
- id
+ /api/v1/providers/{id}:
+ get:
+ operationId: getApiV1ProvidersById
+ summary: Get a provider
+ tags:
+ - providers
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/Provider"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -20618,29 +21859,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - providers
- /api/v1/providers/{id}:
- get:
- operationId: getApiV1ProvidersById
parameters:
- in: path
name: id
@@ -20649,47 +21873,40 @@ paths:
minLength: 1
maxLength: 64
required: true
+ patch:
+ operationId: patchApiV1ProvidersById
+ summary: Update a provider
+ tags:
+ - providers
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/Provider"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -20708,28 +21925,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - providers
- patch:
- operationId: patchApiV1ProvidersById
parameters:
- in: path
name: id
@@ -20773,163 +21974,65 @@ paths:
type: string
- type: "null"
logo:
- type:
- - string
- - "null"
- name:
- anyOf:
- - type: string
- minLength: 1
- - type: "null"
- settings:
- type: object
- propertyNames:
- type: string
- additionalProperties: {}
- sort:
- anyOf:
- - type: integer
- minimum: -9007199254740991
- maximum: 9007199254740991
- - type: "null"
- source:
- type: string
- enum:
- - builtin
- - custom
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- $ref: "#/components/schemas/Provider"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - providers
+ type:
+ - string
+ - "null"
+ name:
+ anyOf:
+ - type: string
+ minLength: 1
+ - type: "null"
+ settings:
+ type: object
+ propertyNames:
+ type: string
+ additionalProperties: {}
+ sort:
+ anyOf:
+ - type: integer
+ minimum: -9007199254740991
+ maximum: 9007199254740991
+ - type: "null"
+ source:
+ type: string
+ enum:
+ - builtin
+ - custom
delete:
operationId: deleteApiV1ProvidersById
- parameters:
- - in: path
- name: id
- schema:
- type: string
- minLength: 1
- maxLength: 64
- required: true
+ description: Also removes the models configured under the provider.
+ summary: Delete a provider
+ tags:
+ - providers
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - object
- - "null"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -20948,26 +22051,20 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - providers
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 64
+ required: true
/api/v1/push-tokens/{deviceId}:
put:
operationId: registerPushToken
@@ -20979,51 +22076,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: false
- properties:
- deviceId:
- type: string
- platform:
- type: string
- required:
- - deviceId
- - platform
- type: object
+ $ref: "#/components/schemas/PushTokenRegistration"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -21036,24 +22112,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -21095,6 +22153,8 @@ paths:
- platform
delete:
operationId: unregisterPushToken
+ description: "`id` is the device id. Idempotent: a stale `expoToken` removes
+ nothing and leaves the rotated registration in place."
summary: Stop pushing to this device (sign-out)
tags:
- push-tokens
@@ -21103,42 +22163,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- type: "null"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -21151,24 +22199,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -21192,6 +22222,48 @@ paths:
/api/v1/responses:
post:
operationId: postApiV1Responses
+ description: 'OpenResponses-compatible: `model` takes an agent id. Without
+ `stream` the response object is the whole JSON body (no success
+ envelope); a run that fails still answers 200 with `status: "failed"`
+ and `error`. With `stream: true` the same object arrives through
+ `response.*` server-sent events.'
+ summary: Create a model response
+ tags:
+ - responses
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ResponseObject"
+ text/event-stream:
+ schema:
+ type: string
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
requestBody:
required: true
content:
@@ -21465,98 +22537,59 @@ paths:
- input
- model
additionalProperties: {}
+ /api/v1/roles:
+ get:
+ operationId: getApiV1Roles
+ summary: List roles
+ tags:
+ - roles
responses:
"200":
- content:
- application/json:
- schema:
- additionalProperties: true
- properties:
- id:
- type: string
- object:
- const: response
- type: string
- output:
- items:
- type: object
- type: array
- status:
- type: string
- usage:
- type:
- - object
- - "null"
- required:
- - id
- - object
- - output
- - status
- type: object
- text/event-stream:
- schema:
- type: string
- description: Successful response
- "400":
- description: Validation Error
content:
application/json:
schema:
type: object
properties:
+ data:
+ $ref: "#/components/schemas/RoleList"
+ message:
+ type: string
success:
type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
+ description: Invalid request
+ "401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Authentication required
+ "403":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Insufficient permission
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - responses
- /api/v1/roles:
- get:
- operationId: getApiV1Roles
parameters:
- in: query
name: active
@@ -21582,58 +22615,40 @@ paths:
name: pageSize
schema:
type: string
+ post:
+ operationId: postApiV1Roles
+ summary: Create a role
+ tags:
+ - roles
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- properties:
- roles:
- items:
- $ref: "#/components/schemas/Role"
- type: array
- total:
- minimum: 0
- type: integer
- required:
- - roles
- type: object
+ $ref: "#/components/schemas/Role"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -21646,34 +22661,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - roles
- post:
- operationId: postApiV1Roles
requestBody:
required: true
content:
@@ -21704,47 +22697,41 @@ paths:
required:
- displayName
- name
+ /api/v1/roles/{id}:
+ get:
+ operationId: getApiV1RolesById
+ summary: Get a role
+ tags:
+ - roles
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/Role"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -21763,29 +22750,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - roles
- /api/v1/roles/{id}:
- get:
- operationId: getApiV1RolesById
parameters:
- in: path
name: id
@@ -21793,47 +22763,40 @@ paths:
type: string
minLength: 1
required: true
+ patch:
+ operationId: patchApiV1RolesById
+ summary: Update a role
+ tags:
+ - roles
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/Role"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -21852,28 +22815,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - roles
- patch:
- operationId: patchApiV1RolesById
parameters:
- in: path
name: id
@@ -21908,47 +22855,40 @@ paths:
name:
type: string
minLength: 1
+ delete:
+ operationId: deleteApiV1RolesById
+ summary: Delete a role
+ tags:
+ - roles
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/Role"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -21967,28 +22907,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - roles
- delete:
- operationId: deleteApiV1RolesById
parameters:
- in: path
name: id
@@ -21996,91 +22920,59 @@ paths:
type: string
minLength: 1
required: true
+ /api/v1/roles/{id}/permissions:
+ get:
+ operationId: getApiV1RolesByIdPermissions
+ summary: List a role's permissions
+ tags:
+ - roles
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - object
- - "null"
+ $ref: "#/components/schemas/RolePermissionList"
message:
type: string
success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
+ description: Invalid request
+ "401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Authentication required
+ "403":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Insufficient permission
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - roles
- /api/v1/roles/{id}/permissions:
- get:
- operationId: getApiV1RolesByIdPermissions
parameters:
- in: path
name: id
@@ -22100,48 +22992,41 @@ paths:
name: pageSize
schema:
type: string
+ patch:
+ operationId: patchApiV1RolesByIdPermissions
+ description: Grants and revokes permissions by id; returns how many mappings changed.
+ summary: Update a role's permissions
+ tags:
+ - roles
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ $ref: "#/components/schemas/RolePermissionsUpdateResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -22160,28 +23045,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - roles
- patch:
- operationId: patchApiV1RolesByIdPermissions
parameters:
- in: path
name: id
@@ -22210,48 +23079,41 @@ paths:
type: string
minLength: 1
- type: "null"
+ delete:
+ operationId: deleteApiV1RolesByIdPermissions
+ description: "`count` is the number of permission mappings removed."
+ summary: Clear a role's permissions
+ tags:
+ - roles
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ $ref: "#/components/schemas/DeletedResources"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -22270,28 +23132,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - roles
- delete:
- operationId: deleteApiV1RolesByIdPermissions
parameters:
- in: path
name: id
@@ -22299,91 +23145,10 @@ paths:
type: string
minLength: 1
required: true
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- additionalProperties: true
- type:
- - object
- - "null"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - roles
/api/v1/signals/source-events:
post:
operationId: emitSourceEvent
+ summary: Emit an agent signal source event
tags:
- signals
responses:
@@ -22391,46 +23156,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/AgentSignalEmission"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -22449,18 +23198,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -22502,6 +23239,7 @@ paths:
/api/v1/signals/trigger:
post:
operationId: triggerSourceEvent
+ summary: Trigger a synthesized agent signal source event
tags:
- signals
responses:
@@ -22509,46 +23247,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/AgentSignalEmission"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -22566,13 +23288,7 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
+ description: Resource not found
"429":
content:
application/json:
@@ -22621,6 +23337,7 @@ paths:
/api/v1/signals/receipts:
get:
operationId: listSignalReceipts
+ summary: List agent signal receipts for a topic
tags:
- signals
responses:
@@ -22628,46 +23345,30 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/AgentSignalReceiptList"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -22680,24 +23381,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
@@ -22738,6 +23421,56 @@ paths:
/api/v1/tasks:
get:
operationId: getApiV1Tasks
+ summary: List tasks
+ tags:
+ - tasks
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/TaskList"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
parameters:
- in: query
name: assigneeAgentId
@@ -22763,51 +23496,40 @@ paths:
name: statuses
schema:
type: string
+ post:
+ operationId: postApiV1Tasks
+ summary: Create a task
+ tags:
+ - tasks
responses:
- "200":
+ "201":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/Task"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -22826,28 +23548,18 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ "412":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Precondition failed
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - tasks
- post:
- operationId: postApiV1Tasks
requestBody:
required: true
content:
@@ -22897,51 +23609,41 @@ paths:
- public
required:
- instruction
+ /api/v1/tasks/{id}:
+ get:
+ operationId: getApiV1TasksById
+ summary: Get a task
+ tags:
+ - tasks
responses:
- "201":
+ "200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/TaskDetail"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -22960,29 +23662,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - tasks
- /api/v1/tasks/{id}:
- get:
- operationId: getApiV1TasksById
parameters:
- in: path
name: id
@@ -22990,51 +23675,40 @@ paths:
type: string
minLength: 1
required: true
+ patch:
+ operationId: patchApiV1TasksById
+ summary: Update a task
+ tags:
+ - tasks
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/Task"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -23059,22 +23733,18 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
+ "412":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Precondition failed
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - tasks
- patch:
- operationId: patchApiV1TasksById
parameters:
- in: path
name: id
@@ -23142,51 +23812,40 @@ paths:
- string
- "null"
additionalProperties: false
+ delete:
+ operationId: deleteApiV1TasksById
+ summary: Delete a task
+ tags:
+ - tasks
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -23211,22 +23870,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - tasks
- delete:
- operationId: deleteApiV1TasksById
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
parameters:
- in: path
name: id
@@ -23234,51 +23883,41 @@ paths:
type: string
minLength: 1
required: true
+ /api/v1/tasks/{id}/status:
+ patch:
+ operationId: patchApiV1TasksByIdStatus
+ summary: Change a task status
+ tags:
+ - tasks
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/TaskStatusUpdateResult"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -23303,23 +23942,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - tasks
- /api/v1/tasks/{id}/status:
- patch:
- operationId: patchApiV1TasksByIdStatus
parameters:
- in: path
name: id
@@ -23348,51 +23976,43 @@ paths:
- canceled
required:
- status
+ /api/v1/tasks/{id}/runs:
+ post:
+ operationId: postApiV1TasksByIdRuns
+ description: Starts the run and answers once the agent operation is accepted;
+ follow it with `operationId`.
+ summary: Run a task now
+ tags:
+ - tasks
responses:
- "200":
+ "202":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ $ref: "#/components/schemas/TaskRunStarted"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -23417,23 +24037,18 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource conflict
- "429":
+ "412":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Precondition failed
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - tasks
- /api/v1/tasks/{id}/runs:
- post:
- operationId: postApiV1TasksByIdRuns
parameters:
- in: path
name: id
@@ -23452,51 +24067,42 @@ paths:
type: string
minLength: 1
additionalProperties: false
+ get:
+ operationId: getApiV1TasksByIdRuns
+ summary: List past runs of a task
+ tags:
+ - tasks
responses:
- "202":
+ "200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ type: array
+ items:
+ $ref: "#/components/schemas/TaskRun"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -23515,28 +24121,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - tasks
- get:
- operationId: getApiV1TasksByIdRuns
parameters:
- in: path
name: id
@@ -23550,51 +24140,54 @@ paths:
type: integer
minimum: 1
maximum: 100
+ /api/v1/topics:
+ get:
+ operationId: getApiV1Topics
+ summary: List topics
+ tags:
+ - topics
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - array
- - object
- - "null"
+ type: object
+ properties:
+ topics:
+ type: array
+ items:
+ $ref: "#/components/schemas/Topic"
+ total:
+ type: integer
+ minimum: 0
+ maximum: 9007199254740991
+ required:
+ - topics
+ - total
+ additionalProperties: false
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -23607,35 +24200,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - tasks
- /api/v1/topics:
- get:
- operationId: getApiV1Topics
parameters:
- in: query
name: agentId
@@ -23677,58 +24247,40 @@ paths:
name: pageSize
schema:
type: string
+ post:
+ operationId: postApiV1Topics
+ summary: Create a topic
+ tags:
+ - topics
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- properties:
- topics:
- items:
- $ref: "#/components/schemas/Topic"
- type: array
- total:
- minimum: 0
- type: integer
- required:
- - topics
- type: object
+ $ref: "#/components/schemas/Topic"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -23741,34 +24293,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - topics
- post:
- operationId: postApiV1Topics
requestBody:
required: true
content:
@@ -23793,47 +24323,41 @@ paths:
minLength: 1
required:
- title
+ /api/v1/topics/{id}:
+ get:
+ operationId: getApiV1TopicsById
+ summary: Get a topic
+ tags:
+ - topics
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/Topic"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -23852,29 +24376,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - topics
- /api/v1/topics/{id}:
- get:
- operationId: getApiV1TopicsById
parameters:
- in: path
name: id
@@ -23882,47 +24389,40 @@ paths:
type: string
minLength: 1
required: true
+ patch:
+ operationId: patchApiV1TopicsById
+ summary: Update a topic
+ tags:
+ - topics
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/Topic"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -23941,28 +24441,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - topics
- patch:
- operationId: patchApiV1TopicsById
parameters:
- in: path
name: id
@@ -23995,47 +24479,40 @@ paths:
title:
type: string
minLength: 1
+ delete:
+ operationId: deleteApiV1TopicsById
+ summary: Delete a topic
+ tags:
+ - topics
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/Topic"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -24054,28 +24531,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - topics
- delete:
- operationId: deleteApiV1TopicsById
parameters:
- in: path
name: id
@@ -24083,88 +24544,6 @@ paths:
type: string
minLength: 1
required: true
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- additionalProperties: true
- type:
- - object
- - "null"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - topics
/api/v1/topics/{topicId}/threads:
get:
operationId: getApiV1TopicsByTopicIdThreads
@@ -24176,7 +24555,7 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
type: object
@@ -24184,70 +24563,35 @@ paths:
threads:
type: array
items:
- type: object
- additionalProperties: false
- properties:
- id:
- type: string
- topicId:
- type: string
- title:
- type:
- - string
- - "null"
- type:
- type: string
- status:
- type:
- - string
- - "null"
- parentThreadId:
- type:
- - string
- - "null"
- createdAt:
- format: date-time
- type: string
- updatedAt:
- format: date-time
- type: string
+ $ref: "#/components/schemas/TopicThread"
total:
type: integer
+ minimum: 0
+ maximum: 9007199254740991
required:
- threads
- total
+ additionalProperties: false
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -24259,25 +24603,13 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Insufficient permission
+ "404":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Resource not found
"500":
content:
application/json:
@@ -24318,6 +24650,9 @@ paths:
/api/v1/users/me:
get:
operationId: getApiV1UsersMe
+ description: Reachable by every authenticated caller. An API key without
+ `user:read` receives only `{ id }`; `messageCount` is included only with
+ `?includeCount=1` and `chat:read`.
summary: Get current authenticated user
tags:
- users
@@ -24326,37 +24661,26 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
anyOf:
- $ref: "#/components/schemas/User"
- - additionalProperties: false
- properties:
- id:
- type: string
- required:
- - id
- type: object
+ - $ref: "#/components/schemas/UserIdentity"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
- "400":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Invalid request
"401":
content:
application/json:
@@ -24375,27 +24699,65 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
+ "500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Internal server error
+ /api/v1/users:
+ get:
+ operationId: getApiV1Users
+ summary: List users
+ tags:
+ - users
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/UserList"
+ message:
+ type: string
+ success:
+ type: boolean
+ const: true
+ timestamp:
+ type: string
+ format: date-time
+ required:
+ - data
+ - success
+ - timestamp
+ additionalProperties: false
+ description: Successful response
+ "400":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- /api/v1/users:
- get:
- operationId: getApiV1Users
parameters:
- in: query
name: keyword
@@ -24409,58 +24771,40 @@ paths:
name: pageSize
schema:
type: string
+ post:
+ operationId: postApiV1Users
+ summary: Create a user
+ tags:
+ - users
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- properties:
- users:
- items:
- $ref: "#/components/schemas/User"
- type: array
- total:
- minimum: 0
- type: integer
- required:
- - users
- type: object
+ $ref: "#/components/schemas/User"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -24473,34 +24817,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - users
- post:
- operationId: postApiV1Users
requestBody:
required: true
content:
@@ -24550,47 +24872,41 @@ paths:
- type: string
minLength: 1
- type: "null"
+ /api/v1/users/{id}:
+ get:
+ operationId: getApiV1UsersById
+ summary: Get a user
+ tags:
+ - users
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/User"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -24609,29 +24925,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - users
- /api/v1/users/{id}:
- get:
- operationId: getApiV1UsersById
parameters:
- in: path
name: id
@@ -24639,47 +24938,40 @@ paths:
type: string
minLength: 1
required: true
+ patch:
+ operationId: patchApiV1UsersById
+ summary: Update a user
+ tags:
+ - users
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/User"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -24698,28 +24990,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - users
- patch:
- operationId: patchApiV1UsersById
parameters:
- in: path
name: id
@@ -24780,87 +25056,64 @@ paths:
- type: string
minLength: 1
- type: "null"
+ delete:
+ operationId: deleteApiV1UsersById
+ summary: Delete a user
+ tags:
+ - users
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- $ref: "#/components/schemas/User"
+ $ref: "#/components/schemas/DeletedResource"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
+ "403":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
+ description: Insufficient permission
+ "404":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
+ description: Resource not found
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - users
- delete:
- operationId: deleteApiV1UsersById
parameters:
- in: path
name: id
@@ -24868,50 +25121,43 @@ paths:
type: string
minLength: 1
required: true
+ /api/v1/users/{id}/roles:
+ get:
+ operationId: getApiV1UsersByIdRoles
+ summary: List a user's roles
+ tags:
+ - users
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type:
- - object
- - "null"
+ type: array
+ items:
+ $ref: "#/components/schemas/UserRole"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -24930,29 +25176,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - users
- /api/v1/users/{id}/roles:
- get:
- operationId: getApiV1UsersByIdRoles
parameters:
- in: path
name: id
@@ -24960,48 +25189,43 @@ paths:
type: string
minLength: 1
required: true
+ patch:
+ operationId: patchApiV1UsersByIdRoles
+ description: Adds and removes role assignments, then returns all of the user's roles.
+ summary: Update a user's roles
+ tags:
+ - users
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ type: array
+ items:
+ $ref: "#/components/schemas/UserRole"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -25020,28 +25244,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - users
- patch:
- operationId: patchApiV1UsersByIdRoles
parameters:
- in: path
name: id
@@ -25081,48 +25289,41 @@ paths:
type: string
minLength: 1
- type: "null"
+ delete:
+ operationId: deleteApiV1UsersByIdRoles
+ description: "`count` is the number of role assignments removed."
+ summary: Clear a user's roles
+ tags:
+ - users
responses:
"200":
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
- additionalProperties: true
- type: object
+ $ref: "#/components/schemas/DeletedResources"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
"400":
- description: Validation Error
content:
application/json:
schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
"401":
content:
application/json:
@@ -25141,28 +25342,12 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
description: Internal server error
- tags:
- - users
- delete:
- operationId: deleteApiV1UsersByIdRoles
parameters:
- in: path
name: id
@@ -25170,88 +25355,6 @@ paths:
type: string
minLength: 1
required: true
- responses:
- "200":
- content:
- application/json:
- schema:
- additionalProperties: false
- properties:
- data:
- additionalProperties: true
- type:
- - object
- - "null"
- message:
- type: string
- success:
- const: true
- type: boolean
- timestamp:
- format: date-time
- type: string
- required:
- - success
- - timestamp
- type: object
- description: Successful response
- "400":
- description: Validation Error
- content:
- application/json:
- schema:
- type: object
- properties:
- success:
- type: boolean
- enum:
- - false
- error:
- type: array
- items: {}
- data: {}
- required:
- - success
- - error
- - data
- "401":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Authentication required
- "403":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
- "500":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Internal server error
- tags:
- - users
/api/v1/usage:
get:
operationId: getApiV1Usage
@@ -25263,29 +25366,24 @@ paths:
content:
application/json:
schema:
- additionalProperties: false
+ type: object
properties:
data:
$ref: "#/components/schemas/Usage"
message:
type: string
success:
- const: true
type: boolean
+ const: true
timestamp:
- format: date-time
type: string
+ format: date-time
required:
+ - data
- success
- timestamp
- type: object
+ additionalProperties: false
description: Successful response
- "400":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Invalid request
"401":
content:
application/json:
@@ -25298,24 +25396,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiError"
description: Insufficient permission
- "404":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource not found
- "409":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Resource conflict
- "429":
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApiError"
- description: Rate limit exceeded
"500":
content:
application/json:
diff --git a/packages/openapi/scripts/generate-openapi.test.ts b/packages/openapi/scripts/generate-openapi.test.ts
index a37a36d8035..d5a684a1df3 100644
--- a/packages/openapi/scripts/generate-openapi.test.ts
+++ b/packages/openapi/scripts/generate-openapi.test.ts
@@ -42,7 +42,7 @@ describe('generate-openapi', () => {
expect(spec.components.schemas.ChatResponse.additionalProperties).toBe(false);
expect(spec.components.schemas.McpServer.properties).not.toHaveProperty('credentials');
expect(spec.components.schemas.McpServer.properties).not.toHaveProperty('oidcConfig');
- expect(spec.components.schemas.ApiKey.properties.scopes.items.enum).toEqual(
+ expect(spec.components.schemas.ApiKey.properties.scopes.anyOf[0].items.enum).toEqual(
expect.arrayContaining(['mcp:read', 'mcp:write', 'usage:read']),
);
expect(
@@ -62,7 +62,9 @@ describe('generate-openapi', () => {
expect(operations.length).toBeGreaterThanOrEqual(97);
// Every response object must carry a description (required by OpenAPI).
- for (const item of Object.values(spec.paths as Record<string, Record<string, any>>)) {
+ // Authenticated routes share 401/403/500; route-specific errors (404, 409,
+ // …) are declared only where the handler can produce them.
+ for (const [path, item] of Object.entries(spec.paths as Record<string, Record<string, any>>)) {
for (const op of Object.values(item)) {
if (!op.responses) continue;
expect(
@@ -70,13 +72,11 @@ describe('generate-openapi', () => {
op.responses['201']?.content ??
op.responses['202']?.content,
).toBeTruthy();
- expect(op.responses['400']?.content).toBeTruthy();
- expect(op.responses['401']?.content).toBeTruthy();
- expect(op.responses['403']?.content).toBeTruthy();
- expect(op.responses['404']?.content).toBeTruthy();
- expect(op.responses['409']?.content).toBeTruthy();
- expect(op.responses['429']?.content).toBeTruthy();
- expect(op.responses['500']?.content).toBeTruthy();
+ if (path !== '/api/v1/health') {
+ expect(op.responses['401']?.content).toBeTruthy();
+ expect(op.responses['403']?.content).toBeTruthy();
+ expect(op.responses['500']?.content).toBeTruthy();
+ }
for (const response of Object.values(
op.responses as Record<string, { description?: string }>,
)) {
@@ -100,6 +100,10 @@ describe('generate-openapi', () => {
expect(successStatuses('post', '/api/v1/tasks')).toEqual(['201']);
expect(successStatuses('post', '/api/v1/signals/source-events')).toEqual(['202']);
expect(successStatuses('post', '/api/v1/signals/trigger')).toEqual(['202']);
+ expect(successStatuses('post', '/api/v1/tasks/{id}/runs')).toEqual(['202']);
+ expect(successStatuses('post', '/api/v1/eval/runs')).toEqual(['202']);
+ expect(successStatuses('post', '/api/v1/agents/{id}/duplicate')).toEqual(['201']);
+ expect(successStatuses('get', '/api/v1/goals')).toEqual(['200']);
// Exactly one success status per operation: a leftover placeholder 200 next
// to the real 201/202 is the same wrong contract, just harder to spot.
diff --git a/packages/openapi/src/app.ts b/packages/openapi/src/app.ts
index 99bc2321bf0..cf293ea7cef 100644
--- a/packages/openapi/src/app.ts
+++ b/packages/openapi/src/app.ts
@@ -6,8 +6,9 @@ import { cors } from 'hono/cors';
import { HTTPException } from 'hono/http-exception';
import { logger } from 'hono/logger';
import { prettyJSON } from 'hono/pretty-json';
-import { describeRoute } from 'hono-openapi';
+import { z } from 'zod';
+import { routeDoc } from './common/openapi';
import { SCALAR_CUSTOM_CSS } from './docs-theme';
// Import user authentication middleware (supports both OIDC and API Key authentication)
import { userAuthMiddleware } from './middleware/auth';
@@ -15,6 +16,7 @@ import { workspaceAuthMiddleware } from './middleware/workspace';
// Import routes
import routes from './routes';
import { buildSpecDocument } from './spec';
+import { dateTimeSchema } from './types/common.type';
// Create Hono app instance
const app = new Hono().basePath('/api/v1');
@@ -40,13 +42,31 @@ app.onError((error: Error, c) => {
});
// Health check endpoint
-app.get('/health', describeRoute({ summary: 'Health check', tags: ['health'] }), (c) => {
- return c.json({
- service: 'lobe-chat-api',
- status: 'ok',
- timestamp: new Date().toISOString(),
- });
-});
+const HealthSchema = z
+ .object({
+ service: z.string(),
+ status: z.literal('ok'),
+ timestamp: dateTimeSchema,
+ })
+ .strict();
+
+app.get(
+ '/health',
+ routeDoc({
+ data: HealthSchema,
+ envelope: false,
+ public: true,
+ summary: 'Health check',
+ tags: ['health'],
+ }),
+ (c) => {
+ return c.json({
+ service: 'lobe-chat-api',
+ status: 'ok',
+ timestamp: new Date().toISOString(),
+ });
+ },
+);
// API documentation (public, like the API spec itself).
// The spec is rebuilt from the live routes on first request and cached, so it
diff --git a/packages/openapi/src/common/openapi.ts b/packages/openapi/src/common/openapi.ts
new file mode 100644
index 00000000000..774084f66fd
--- /dev/null
+++ b/packages/openapi/src/common/openapi.ts
@@ -0,0 +1,121 @@
+import type { DescribeRouteOptions } from 'hono-openapi';
+import { describeRoute, resolver } from 'hono-openapi';
+import { z } from 'zod';
+
+import { dateTimeSchema } from '../types/common.type';
+
+/**
+ * The error envelope every handler answers with — `BaseController.error`,
+ * `app.onError` and the shared validator all produce exactly this shape.
+ */
+export const ApiErrorSchema = z
+ .object({
+ error: z.string(),
+ success: z.literal(false),
+ timestamp: dateTimeSchema,
+ })
+ .strict();
+
+/** Registered as `components/schemas/ApiError` by `buildSpecDocument`. */
+export const API_ERROR_REF = '#/components/schemas/ApiError';
+
+export type SuccessStatus = 200 | 201 | 202;
+
+/**
+ * Error statuses a route may declare on top of the ones every authenticated
+ * route shares. `400` is also derived automatically for any route with a
+ * request validator, so declare it only when the handler itself rejects input.
+ */
+export type RouteErrorStatus = 400 | 402 | 404 | 409 | 412 | 413 | 422 | 429 | 502 | 503;
+
+const ERROR_DESCRIPTIONS: Record<number, string> = {
+ 400: 'Invalid request',
+ 401: 'Authentication required',
+ 402: 'Payment required',
+ 403: 'Insufficient permission',
+ 404: 'Resource not found',
+ 409: 'Resource conflict',
+ 412: 'Precondition failed',
+ 413: 'Payload too large',
+ 422: 'Unprocessable content',
+ 429: 'Rate limit exceeded',
+ 500: 'Internal server error',
+ 502: 'Upstream error',
+ 503: 'Service unavailable',
+};
+
+/**
+ * Raised by every authenticated route regardless of its handler: the auth and
+ * workspace middleware answer 401/403, and `BaseController.handleError` turns
+ * any unexpected throw into a 500.
+ */
+const AUTHENTICATED_ERRORS = [401, 403, 500] as const;
+
+export const errorResponse = (status: number) => ({
+ content: { 'application/json': { schema: { $ref: API_ERROR_REF } } },
+ description: ERROR_DESCRIPTIONS[status] ?? 'Error',
+});
+
+/** The success envelope produced by `BaseController.success`. */
+export const successEnvelope = <T extends z.ZodType>(data: T) =>
+ z
+ .object({
+ data,
+ message: z.string().optional(),
+ success: z.literal(true),
+ timestamp: dateTimeSchema,
+ })
+ .strict();
+
+export interface RouteDocOptions extends Omit<DescribeRouteOptions, 'responses'> {
+ /**
+ * Payload schema. Wrapped in the `{ success, data, message, timestamp }`
+ * envelope unless `envelope: false`.
+ */
+ data: z.ZodType;
+ /** Set to `false` when the handler answers with `data` as the whole body. */
+ envelope?: boolean;
+ /** Errors this handler can produce beyond the shared authenticated set. */
+ errors?: RouteErrorStatus[];
+ /** Public routes skip the shared authenticated errors (401/403/500). */
+ public?: boolean;
+ /** The success status the handler answers with. Defaults to 200. */
+ status?: SuccessStatus;
+ /** Extra success media types, e.g. `text/event-stream` for streaming routes. */
+ streamContent?: Record<string, { schema: Record<string, unknown> }>;
+ summary: string;
+}
+
+/**
+ * Self-declared OpenAPI documentation for one route: its success status and
+ * concrete payload schema, plus only the error codes it can actually return.
+ * The spec is generated from these declarations — nothing is guessed from the
+ * path afterwards, so a route without one fails `buildSpecDocument`.
+ */
+export const routeDoc = ({
+ data,
+ envelope = true,
+ errors = [],
+ public: isPublic = false,
+ status = 200,
+ streamContent,
+ ...rest
+}: RouteDocOptions) => {
+ const errorStatuses = new Set<number>([...(isPublic ? [] : AUTHENTICATED_ERRORS), ...errors]);
+
+ return describeRoute({
+ ...rest,
+ responses: {
+ [status]: {
+ content: {
+ 'application/json': { schema: resolver(envelope ? successEnvelope(data) : data) },
+ ...streamContent,
+ },
+ description: 'Successful response',
+ },
+ ...Object.fromEntries(
+ [...errorStatuses].sort().map((code) => [code, errorResponse(code)] as const),
+ ),
+ },
+ });
+};
diff --git a/packages/openapi/src/controllers/agent-group.controller.ts b/packages/openapi/src/controllers/agent-group.controller.ts
index b5c39a97b42..cde1724a2d4 100644
--- a/packages/openapi/src/controllers/agent-group.controller.ts
+++ b/packages/openapi/src/controllers/agent-group.controller.ts
@@ -7,6 +7,7 @@ import type {
DeleteAgentGroupRequest,
UpdateAgentGroupRequest,
} from '../types/agent-group.type';
+import type { DeletedResource } from '../types/common.type';
/**
* AgentGroup controller class
@@ -117,9 +118,9 @@ export class AgentGroupController extends BaseController {
this.getUserId(c),
this.getWorkspaceId(c),
);
- await agentGroupService.updateAgentGroup(request);
+ const updated = await agentGroupService.updateAgentGroup(request);
- return this.success(c, null, 'Agent category updated successfully');
+ return this.success(c, updated, 'Agent category updated successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -151,7 +152,11 @@ export class AgentGroupController extends BaseController {
);
await agentGroupService.deleteAgentGroup(request);
- return this.success(c, null, 'Agent category deleted successfully');
+ return this.success(
+ c,
+ { deleted: true, id: groupId } satisfies DeletedResource,
+ 'Agent category deleted successfully',
+ );
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/agent.controller.ts b/packages/openapi/src/controllers/agent.controller.ts
index b0b07cd9c30..6a7bc82cb4c 100644
--- a/packages/openapi/src/controllers/agent.controller.ts
+++ b/packages/openapi/src/controllers/agent.controller.ts
@@ -8,6 +8,7 @@ import type {
GetAgentsRequest,
UpdateAgentRequest,
} from '../types/agent.type';
+import type { DeletedResource } from '../types/common.type';
/**
* Agent controller class
@@ -110,7 +111,11 @@ export class AgentController extends BaseController {
const agentService = new AgentService(db, this.getUserId(c), this.getWorkspaceId(c));
await agentService.deleteAgent(request);
- return this.success(c, null, 'Agent deleted successfully');
+ return this.success(
+ c,
+ { deleted: true, id } satisfies DeletedResource,
+ 'Agent deleted successfully',
+ );
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/chat-group.controller.ts b/packages/openapi/src/controllers/chat-group.controller.ts
index d8024507c85..7a4669d54a6 100644
--- a/packages/openapi/src/controllers/chat-group.controller.ts
+++ b/packages/openapi/src/controllers/chat-group.controller.ts
@@ -8,6 +8,7 @@ import type {
GetChatGroupsRequest,
UpdateChatGroupRequest,
} from '../types/chat-group.type';
+import type { DeletedResource } from '../types/common.type';
export class ChatGroupController extends BaseController {
private async getService(c: Context) {
@@ -65,7 +66,7 @@ export class ChatGroupController extends BaseController {
const { id } = this.getParams<{ id: string }>(c);
const service = await this.getService(c);
await service.deleteChatGroup(id);
- return this.success(c, null, 'Chat group deleted');
+ return this.success(c, { deleted: true, id } satisfies DeletedResource, 'Chat group deleted');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/goal.controller.ts b/packages/openapi/src/controllers/goal.controller.ts
index 9113c308471..1c3fefe5b1c 100644
--- a/packages/openapi/src/controllers/goal.controller.ts
+++ b/packages/openapi/src/controllers/goal.controller.ts
@@ -80,8 +80,7 @@ export class GoalController extends BaseController {
try {
const { id } = this.getParams<GoalIdParam>(c);
const service = await this.service(c);
- await service.deleteGoal(id);
- return this.success(c, undefined, 'Goal deleted');
+ return this.success(c, await service.deleteGoal(id), 'Goal deleted');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/im.controller.ts b/packages/openapi/src/controllers/im.controller.ts
index 145988bb5e4..91af8d55a62 100644
--- a/packages/openapi/src/controllers/im.controller.ts
+++ b/packages/openapi/src/controllers/im.controller.ts
@@ -2,6 +2,7 @@ import type { Context } from 'hono';
import { BaseController } from '../common/base.controller';
import { ImRestService } from '../services/im.service';
+import type { DeletedResource } from '../types/common.type';
import type {
ImReadRequest,
ImSendRequest,
@@ -72,7 +73,13 @@ export class ImController extends BaseController {
const { expoToken } = this.getQuery<PushTokenUnregisterQuery>(c);
const service = await this.service(c);
await service.unregisterPushToken(deviceId, expoToken);
- return this.success(c, undefined, 'Device unregistered');
+ // Idempotent sign-out: answers the device id either way. With a stale
+ // `expoToken` nothing is removed and the rotated registration stays.
+ return this.success<DeletedResource>(
+ c,
+ { deleted: true, id: deviceId },
+ 'Device unregistered',
+ );
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/memory.controller.ts b/packages/openapi/src/controllers/memory.controller.ts
index c7dd3075cf4..c6345485ea7 100644
--- a/packages/openapi/src/controllers/memory.controller.ts
+++ b/packages/openapi/src/controllers/memory.controller.ts
@@ -50,8 +50,7 @@ export class MemoryController extends BaseController {
try {
const { category, id } = this.getParams<MemoryEntryIdParam & { category: MemoryCategory }>(c);
const service = await this.service(c);
- await service.deleteEntry(category, id);
- return this.success(c, undefined, 'Memory entry deleted');
+ return this.success(c, await service.deleteEntry(category, id), 'Memory entry deleted');
} catch (error) {
return this.handleError(c, error);
}
@@ -61,8 +60,7 @@ export class MemoryController extends BaseController {
async deleteAll(c: Context): Promise<Response> {
try {
const service = await this.service(c);
- await service.deleteAll();
- return this.success(c, undefined, 'All memories deleted');
+ return this.success(c, await service.deleteAll(), 'All memories deleted');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/message.controller.ts b/packages/openapi/src/controllers/message.controller.ts
index c0d83db868e..4c3dab765a2 100644
--- a/packages/openapi/src/controllers/message.controller.ts
+++ b/packages/openapi/src/controllers/message.controller.ts
@@ -2,6 +2,7 @@ import type { Context } from 'hono';
import { BaseController } from '../common/base.controller';
import { MessageService } from '../services/message.service';
+import type { DeletedResource } from '../types/common.type';
import type {
MessagesCountQuery,
MessagesCreateRequest,
@@ -132,9 +133,14 @@ export class MessageController extends BaseController {
const db = await this.getDatabase();
const messageService = new MessageService(db, userId, this.getWorkspaceId(c));
- await messageService.deleteMessage(id);
-
- return this.success(c, null, 'Message deleted successfully');
+ const removed = await messageService.deleteMessage(id);
+ if (!removed) return this.error(c, 'Message not found', 404);
+
+ return this.success<DeletedResource>(
+ c,
+ { deleted: true, id },
+ 'Message deleted successfully',
+ );
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/task.controller.ts b/packages/openapi/src/controllers/task.controller.ts
index e9593a306b7..9ae9959aeca 100644
--- a/packages/openapi/src/controllers/task.controller.ts
+++ b/packages/openapi/src/controllers/task.controller.ts
@@ -104,8 +104,7 @@ export class TaskController extends BaseController {
try {
const { id } = this.getParams<TaskIdParam>(c);
const service = await this.service(c);
- await service.deleteTask(id);
- return this.success(c, undefined, 'Task deleted');
+ return this.success(c, await service.deleteTask(id), 'Task deleted');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/topic.controller.ts b/packages/openapi/src/controllers/topic.controller.ts
index 118b1275f0e..d429bf2799d 100644
--- a/packages/openapi/src/controllers/topic.controller.ts
+++ b/packages/openapi/src/controllers/topic.controller.ts
@@ -2,6 +2,7 @@ import type { Context } from 'hono';
import { BaseController } from '../common/base.controller';
import { TopicService } from '../services/topic.service';
+import type { DeletedResource } from '../types/common.type';
import type { TopicCreateRequest, TopicListQuery, TopicUpdateRequest } from '../types/topic.type';
export class TopicController extends BaseController {
@@ -101,7 +102,11 @@ export class TopicController extends BaseController {
const topicService = new TopicService(db, userId, this.getWorkspaceId(c));
await topicService.deleteTopic(topicId);
- return this.success(c, null, 'Topic deleted successfully');
+ return this.success<DeletedResource>(
+ c,
+ { deleted: true, id: topicId },
+ 'Topic deleted successfully',
+ );
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/user.controller.test.ts b/packages/openapi/src/controllers/user.controller.test.ts
index f47e6ec1fed..975124a9f0b 100644
--- a/packages/openapi/src/controllers/user.controller.test.ts
+++ b/packages/openapi/src/controllers/user.controller.test.ts
@@ -12,6 +12,7 @@ vi.mock('../services', () => ({
}));
const { UserController } = await import('./user.controller');
+const { CurrentUserSchema, UserIdentitySchema } = await import('../types/user.type');
/**
* `/me` is open to any authenticated caller so a key can resolve its own
@@ -56,7 +57,11 @@ describe('UserController.getCurrentUser', () => {
contextFor({ authType: 'apikey', scopes: ['model:invoke'] }),
);
- await expect(bodyOf(res)).resolves.toEqual({ id: 'user-1' });
+ const body = await bodyOf(res);
+ expect(body).toEqual({ id: 'user-1' });
+ // The narrowed body is the documented `UserIdentity` branch of `/me`.
+ expect(() => UserIdentitySchema.parse(body)).not.toThrow();
+ expect(() => CurrentUserSchema.parse(body)).not.toThrow();
});
it('returns the full profile to a key holding user:read', async () => {
diff --git a/packages/openapi/src/routes/agent-groups.route.test.ts b/packages/openapi/src/routes/agent-groups.route.test.ts
new file mode 100644
index 00000000000..31b43e66017
--- /dev/null
+++ b/packages/openapi/src/routes/agent-groups.route.test.ts
@@ -0,0 +1,87 @@
+// @vitest-environment node
+import { eq } from 'drizzle-orm';
+import { Hono } from 'hono';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { getTestDB } from '@/database/core/getTestDB';
+import { sessionGroups, users } from '@/database/schemas';
+
+const db = await getTestDB();
+
+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: async () => db }));
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = async () => true;
+ },
+}));
+vi.mock('../middleware/auth', () => ({
+ requireAuth: async (_c: any, next: any) => next(),
+}));
+
+const { default: AgentGroupRoutes } = await import('./agent-groups.route');
+const { AgentGroupSchema, CreatedAgentGroupSchema } = await import('../types/agent-group.type');
+const { DeletedResourceSchema } = await import('../types/common.type');
+
+const USER = 'agent-group-user';
+
+const request = (path: string, init: { body?: unknown; method?: string } = {}) => {
+ const app = new Hono();
+
+ app.use('*', async (c, next) => {
+ c.set('userId' as never, USER as never);
+ await next();
+ });
+ app.route('/', AgentGroupRoutes);
+
+ return app.request(path, {
+ ...(init.body === undefined
+ ? {}
+ : { body: JSON.stringify(init.body), headers: { 'content-type': 'application/json' } }),
+ method: init.method ?? 'GET',
+ });
+};
+
+const json = async (res: Response) => ((await res.json()) as { data: any }).data;
+
+beforeEach(async () => {
+ await db.delete(sessionGroups);
+ await db.delete(users);
+ await db.insert(users).values({ id: USER });
+});
+
+describe('agent groups', () => {
+ it('creates, reads and lists a group in the documented shapes', async () => {
+ const res = await request('/', { body: { name: 'Work', sort: 1 }, method: 'POST' });
+ expect(res.status).toBe(201);
+ const created = await json(res);
+ expect(() => CreatedAgentGroupSchema.parse(created)).not.toThrow();
+
+ const detail = await json(await request(`/${created.id}`));
+ expect(detail).toMatchObject({ id: created.id, name: 'Work', sort: 1 });
+ expect(() => AgentGroupSchema.parse(detail)).not.toThrow();
+
+ const list = await json(await request('/'));
+ expect(() => AgentGroupSchema.array().parse(list)).not.toThrow();
+ });
+
+ it('answers an update with the updated group', async () => {
+ const { id } = await json(await request('/', { body: { name: 'Old' }, method: 'POST' }));
+
+ const res = await request(`/${id}`, { body: { name: 'New' }, method: 'PATCH' });
+ expect(res.status).toBe(200);
+ const updated = await json(res);
+ expect(updated).toMatchObject({ id, name: 'New' });
+ expect(() => AgentGroupSchema.parse(updated)).not.toThrow();
+ });
+
+ it('answers a delete with the id that is now gone', async () => {
+ const { id } = await json(await request('/', { body: { name: 'Doomed' }, method: 'POST' }));
+
+ const res = await request(`/${id}`, { method: 'DELETE' });
+ expect(res.status).toBe(200);
+ const deleted = await json(res);
+ expect(deleted).toEqual({ deleted: true, id });
+ expect(() => DeletedResourceSchema.parse(deleted)).not.toThrow();
+ expect(await db.select().from(sessionGroups).where(eq(sessionGroups.id, id))).toHaveLength(0);
+ });
+});
diff --git a/packages/openapi/src/routes/agent-groups.route.ts b/packages/openapi/src/routes/agent-groups.route.ts
index 9eb9e33cebe..7f11a621cb5 100644
--- a/packages/openapi/src/routes/agent-groups.route.ts
+++ b/packages/openapi/src/routes/agent-groups.route.ts
@@ -1,17 +1,21 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
+import { z } from 'zod';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { AgentGroupController } from '../controllers/agent-group.controller';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermission } from '../middleware/permission-check';
import {
AgentGroupIdParamSchema,
+ AgentGroupSchema,
CreateAgentGroupRequestSchema,
+ CreatedAgentGroupSchema,
UpdateAgentGroupRequestSchema,
} from '../types/agent-group.type';
+import { DeletedResourceSchema } from '../types/common.type';
// AgentGroup-related routes (agent groups)
const AgentGroupRoutes = new Hono();
@@ -23,7 +27,11 @@ const AgentGroupRoutes = new Hono();
*/
AgentGroupRoutes.get(
'/',
- describeRoute({ summary: 'Get agent group list', tags: ['agent-groups'] }),
+ routeDoc({
+ data: z.array(AgentGroupSchema),
+ summary: 'List agent groups',
+ tags: ['agent-groups'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AGENT_READ'),
@@ -42,6 +50,12 @@ AgentGroupRoutes.get(
*/
AgentGroupRoutes.post(
'/',
+ routeDoc({
+ data: CreatedAgentGroupSchema,
+ status: 201,
+ summary: 'Create an agent group',
+ tags: ['agent-groups'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AGENT_CREATE'),
@@ -61,6 +75,12 @@ AgentGroupRoutes.post(
*/
AgentGroupRoutes.get(
'/:id',
+ routeDoc({
+ data: AgentGroupSchema,
+ errors: [404],
+ summary: 'Get an agent group',
+ tags: ['agent-groups'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AGENT_READ'),
@@ -80,6 +100,11 @@ AgentGroupRoutes.get(
*/
AgentGroupRoutes.patch(
'/:id',
+ routeDoc({
+ data: AgentGroupSchema,
+ summary: 'Update an agent group',
+ tags: ['agent-groups'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AGENT_UPDATE'),
@@ -104,6 +129,11 @@ AgentGroupRoutes.patch(
*/
AgentGroupRoutes.delete(
'/:id',
+ routeDoc({
+ data: DeletedResourceSchema,
+ summary: 'Delete an agent group',
+ tags: ['agent-groups'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AGENT_DELETE'),
diff --git a/packages/openapi/src/routes/agents.accounts.route.test.ts b/packages/openapi/src/routes/agents.accounts.route.test.ts
index 7e1d67a8275..fabb1c6a171 100644
--- a/packages/openapi/src/routes/agents.accounts.route.test.ts
+++ b/packages/openapi/src/routes/agents.accounts.route.test.ts
@@ -48,6 +48,7 @@ const { AgentAccountModel } = await import('@/database/models/agentAccount');
const { hashApiKey } = await import('@lobechat/utils/server');
const { KeyVaultsGateKeeper } = await import('@/server/modules/KeyVaultsEncrypt');
const { userAuthMiddleware } = await import('../middleware/auth');
+const { AgentAccountListSchema, AgentAccountSchema } = await import('../types/agent-account.type');
const { workspaceAuthMiddleware } = await import('../middleware/workspace');
const AgentRoutes = (await import('./agents.route')).default;
const { eq } = await import('drizzle-orm');
@@ -182,6 +183,7 @@ describe('agent account control plane — end to end', () => {
status: 'active',
});
expect(created.data).not.toHaveProperty('credentials');
+ expect(() => AgentAccountSchema.parse(created.data)).not.toThrow();
// 2. The list is an inventory, not a place to hand out secrets.
const listRes = await call(`/agents/${AGENT}/accounts`, { key: CREDENTIAL_KEY });
@@ -192,6 +194,7 @@ describe('agent account control plane — end to end', () => {
);
expect(listed.data.total).toBe(1);
expect(listed.data.accounts[0]).not.toHaveProperty('credentials');
+ expect(() => AgentAccountListSchema.parse(listed.data)).not.toThrow();
// 3. An `agent:write` key may manage accounts but NOT install a credential.
const refused = await call(`/agents/${AGENT}/accounts/${id}/credential`, {
@@ -235,6 +238,7 @@ describe('agent account control plane — end to end', () => {
expect(JSON.stringify(writtenBody)).not.toContain(SECRET);
expect(writtenBody.data).not.toHaveProperty('credentials');
expect(writtenBody.data.credentialHint).not.toHaveProperty('password');
+ expect(() => AgentAccountSchema.parse(writtenBody.data)).not.toThrow();
// 5. The column holds AES-GCM ciphertext, and only the internal read decrypts.
const [row] = await serverDB
@@ -278,6 +282,8 @@ describe('agent account control plane — end to end', () => {
const revokedBody = await json(revoked);
expect(revoked.status).toBe(200);
expect(revokedBody.data).toMatchObject({ hasCredential: false, status: 'revoked' });
+ // Revocation keeps the row for audit, so the DELETE answers with the revoked account.
+ expect(() => AgentAccountSchema.parse(revokedBody.data)).not.toThrow();
const [afterRevoke] = await serverDB
.select({ credentials: agentAccounts.credentials })
.from(agentAccounts)
diff --git a/packages/openapi/src/routes/agents.route.test.ts b/packages/openapi/src/routes/agents.route.test.ts
index 73a2cbb7ae3..9435da5c7b7 100644
--- a/packages/openapi/src/routes/agents.route.test.ts
+++ b/packages/openapi/src/routes/agents.route.test.ts
@@ -19,6 +19,8 @@ vi.mock('../middleware/auth', () => ({
}));
const { default: AgentRoutes } = await import('./agents.route');
+const { AgentDetailSchema, AgentListSchema, AgentSchema } = await import('../types/agent.type');
+const { DeletedResourceSchema } = await import('../types/common.type');
const USER = 'personal-agent-user';
@@ -54,6 +56,7 @@ describe('personal agents', () => {
expect(res.status).toBe(200);
const agent = await json(res);
expect(agent.personal).toBe(true);
+ expect(() => AgentSchema.parse(agent)).not.toThrow();
const [row] = await db.select().from(agents).where(eq(agents.id, agent.id));
expect(row.metadata).toEqual({ personal: true });
@@ -77,6 +80,7 @@ describe('personal agents', () => {
expect(personal.total).toBe(1);
expect(others.agents.map((agent: any) => agent.title)).toEqual(['Writer']);
expect(all.total).toBe(2);
+ expect(() => AgentListSchema.parse(all)).not.toThrow();
});
it('treats a non-boolean metadata.personal as not personal instead of failing', async () => {
@@ -105,6 +109,7 @@ describe('personal agents', () => {
expect(copy.id).not.toBe(agent.id);
expect(copy.personal).toBe(true);
+ expect(() => AgentDetailSchema.parse(copy)).not.toThrow();
expect((await json(await request('/?personal=true'))).total).toBe(2);
});
@@ -135,3 +140,26 @@ describe('personal agents', () => {
expect(row.metadata).toEqual({ personal: false, source: 'import' });
});
});
+
+describe('agent detail and deletion', () => {
+ it('returns the agent with its mounted knowledge', async () => {
+ const agent = await json(await request('/', { body: { title: 'Writer' }, method: 'POST' }));
+
+ const res = await request(`/${agent.id}`);
+ expect(res.status).toBe(200);
+ const detail = await json(res);
+ expect(detail).toMatchObject({ files: [], id: agent.id, knowledgeBases: [] });
+ expect(() => AgentDetailSchema.parse(detail)).not.toThrow();
+ });
+
+ it('answers a delete with the id that is now gone', async () => {
+ const agent = await json(await request('/', { body: { title: 'Doomed' }, method: 'POST' }));
+
+ const res = await request(`/${agent.id}`, { method: 'DELETE' });
+ expect(res.status).toBe(200);
+ const deleted = await json(res);
+ expect(deleted).toEqual({ deleted: true, id: agent.id });
+ expect(() => DeletedResourceSchema.parse(deleted)).not.toThrow();
+ expect(await db.select().from(agents).where(eq(agents.id, agent.id))).toHaveLength(0);
+ });
+});
diff --git a/packages/openapi/src/routes/agents.route.ts b/packages/openapi/src/routes/agents.route.ts
index 1d5dc010c4a..ac633e4df64 100644
--- a/packages/openapi/src/routes/agents.route.ts
+++ b/packages/openapi/src/routes/agents.route.ts
@@ -1,15 +1,18 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
import { getAllScopePermissions, getScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { AgentController } from '../controllers/agent.controller';
import { AgentAccountController } from '../controllers/agent-account.controller';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermission, requireApiKeyScope } from '../middleware/permission-check';
import {
+ AgentDetailSchema,
AgentIdParamSchema,
+ AgentListSchema,
+ AgentSchema,
CreateAgentRequestSchema,
DuplicateAgentSchema,
GetAgentsQuerySchema,
@@ -19,11 +22,14 @@ import {
AgentAccountAgentParamSchema,
AgentAccountIdParamSchema,
AgentAccountListQuerySchema,
+ AgentAccountListSchema,
+ AgentAccountSchema,
CreateAgentAccountRequestSchema,
RevokeAgentAccountQuerySchema,
SetAgentAccountCredentialRequestSchema,
UpdateAgentAccountRequestSchema,
} from '../types/agent-account.type';
+import { DeletedResourceSchema } from '../types/common.type';
// Agent-related routes
const AgentRoutes = new Hono();
@@ -35,6 +41,7 @@ const AgentRoutes = new Hono();
*/
AgentRoutes.get(
'/',
+ routeDoc({ data: AgentListSchema, summary: 'List agents', tags: ['agents'] }),
requireAuth,
requireAnyPermission(
getScopePermissions('AGENT_READ', ['ALL', 'OWNER']),
@@ -54,6 +61,7 @@ AgentRoutes.get(
*/
AgentRoutes.post(
'/',
+ routeDoc({ data: AgentSchema, summary: 'Create an agent', tags: ['agents'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AGENT_CREATE'),
@@ -73,6 +81,12 @@ AgentRoutes.post(
*/
AgentRoutes.get(
'/:id',
+ routeDoc({
+ data: AgentDetailSchema,
+ errors: [404],
+ summary: 'Get an agent with its mounted files and knowledge bases',
+ tags: ['agents'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AGENT_READ'),
@@ -92,6 +106,7 @@ AgentRoutes.get(
*/
AgentRoutes.patch(
'/:id',
+ routeDoc({ data: AgentSchema, summary: 'Update an agent', tags: ['agents'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AGENT_UPDATE'),
@@ -112,6 +127,7 @@ AgentRoutes.patch(
*/
AgentRoutes.delete(
'/:id',
+ routeDoc({ data: DeletedResourceSchema, summary: 'Delete an agent', tags: ['agents'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AGENT_DELETE'),
@@ -126,7 +142,13 @@ AgentRoutes.delete(
AgentRoutes.post(
'/:id/duplicate',
- describeRoute({ summary: 'Duplicate agent', tags: ['agents'] }),
+ routeDoc({
+ data: AgentDetailSchema,
+ errors: [404],
+ status: 201,
+ summary: 'Duplicate an agent',
+ tags: ['agents'],
+ }),
requireAuth,
requireAnyPermission(getAllScopePermissions('AGENT_FORK')),
zValidator('param', AgentIdParamSchema),
@@ -163,7 +185,13 @@ const agentAccountCredentialScope = requireApiKeyScope('agent:credential:write')
/** GET /api/v1/agents/:id/accounts — never returns a credential. */
AgentRoutes.get(
'/:id/accounts',
- describeRoute({ operationId: 'listAgentAccounts', tags: ['agents'] }),
+ routeDoc({
+ data: AgentAccountListSchema,
+ errors: [404],
+ operationId: 'listAgentAccounts',
+ summary: "List an agent's accounts",
+ tags: ['agents'],
+ }),
requireAuth,
agentAccountRead,
zValidator('param', AgentAccountAgentParamSchema),
@@ -174,7 +202,14 @@ AgentRoutes.get(
/** POST /api/v1/agents/:id/accounts — mount an existing handle, or provision one. */
AgentRoutes.post(
'/:id/accounts',
- describeRoute({ operationId: 'createAgentAccount', tags: ['agents'] }),
+ routeDoc({
+ data: AgentAccountSchema,
+ errors: [404, 409],
+ operationId: 'createAgentAccount',
+ status: 201,
+ summary: 'Mount or provision an agent account',
+ tags: ['agents'],
+ }),
requireAuth,
agentAccountWrite,
zValidator('param', AgentAccountAgentParamSchema),
@@ -185,7 +220,13 @@ AgentRoutes.post(
/** GET /api/v1/agents/:id/accounts/:accountId */
AgentRoutes.get(
'/:id/accounts/:accountId',
- describeRoute({ operationId: 'getAgentAccount', tags: ['agents'] }),
+ routeDoc({
+ data: AgentAccountSchema,
+ errors: [404],
+ operationId: 'getAgentAccount',
+ summary: 'Get an agent account',
+ tags: ['agents'],
+ }),
requireAuth,
agentAccountRead,
zValidator('param', AgentAccountIdParamSchema),
@@ -195,7 +236,13 @@ AgentRoutes.get(
/** PATCH /api/v1/agents/:id/accounts/:accountId — non-secret fields only. */
AgentRoutes.patch(
'/:id/accounts/:accountId',
- describeRoute({ operationId: 'updateAgentAccount', tags: ['agents'] }),
+ routeDoc({
+ data: AgentAccountSchema,
+ errors: [404, 409],
+ operationId: 'updateAgentAccount',
+ summary: 'Update an agent account',
+ tags: ['agents'],
+ }),
requireAuth,
agentAccountWrite,
zValidator('param', AgentAccountIdParamSchema),
@@ -211,7 +258,15 @@ AgentRoutes.patch(
*/
AgentRoutes.put(
'/:id/accounts/:accountId/credential',
- describeRoute({ operationId: 'setAgentAccountCredential', tags: ['agents'] }),
+ routeDoc({
+ data: AgentAccountSchema,
+ description:
+ 'Write-only: the response carries the non-secret hint and `hasCredential`, never the secret.',
+ errors: [404],
+ operationId: 'setAgentAccountCredential',
+ summary: 'Write an agent account credential',
+ tags: ['agents'],
+ }),
requireAuth,
agentAccountCredentialIssuer,
agentAccountCredentialScope,
@@ -223,7 +278,15 @@ AgentRoutes.put(
/** DELETE /api/v1/agents/:id/accounts/:accountId — release and revoke. */
AgentRoutes.delete(
'/:id/accounts/:accountId',
- describeRoute({ operationId: 'revokeAgentAccount', tags: ['agents'] }),
+ routeDoc({
+ data: AgentAccountSchema,
+ description:
+ 'Releases the account and marks it revoked. The row is kept for audit, so the response is the revoked account.',
+ errors: [404],
+ operationId: 'revokeAgentAccount',
+ summary: 'Revoke an agent account',
+ tags: ['agents'],
+ }),
requireAuth,
agentAccountWrite,
zValidator('param', AgentAccountIdParamSchema),
diff --git a/packages/openapi/src/routes/api-keys.route.ts b/packages/openapi/src/routes/api-keys.route.ts
index 6d4a1bed715..9f251f2f729 100644
--- a/packages/openapi/src/routes/api-keys.route.ts
+++ b/packages/openapi/src/routes/api-keys.route.ts
@@ -1,8 +1,9 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
+import { z } from 'zod';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { ApiKeyController } from '../controllers/api-key.controller';
import { requireAuth } from '../middleware/auth';
@@ -10,9 +11,12 @@ import { requireAnyPermission } from '../middleware/permission-check';
import { requireWorkspaceRoleWhenScoped } from '../middleware/workspace';
import {
ApiKeyIdParamSchema,
+ ApiKeySchema,
CreateApiKeyRequestSchema,
+ CreatedApiKeySchema,
UpdateApiKeyRequestSchema,
} from '../types/api-key.type';
+import { DeletedResourceSchema } from '../types/common.type';
const app = new Hono();
@@ -24,7 +28,7 @@ const requireWorkspaceAdmin = requireWorkspaceRoleWhenScoped('admin');
app.get(
'/',
- describeRoute({ summary: 'List API keys', tags: ['api-keys'] }),
+ routeDoc({ data: z.array(ApiKeySchema), summary: 'List API keys', tags: ['api-keys'] }),
requireAuth,
requireWorkspaceAdmin,
requireAnyPermission(getAllScopePermissions('API_KEY_READ')),
@@ -33,6 +37,13 @@ app.get(
app.post(
'/',
+ routeDoc({
+ data: CreatedApiKeySchema,
+ description: 'The plaintext key is returned only in this response.',
+ status: 201,
+ summary: 'Create an API key',
+ tags: ['api-keys'],
+ }),
requireAuth,
requireWorkspaceAdmin,
requireAnyPermission(getAllScopePermissions('API_KEY_CREATE')),
@@ -42,6 +53,7 @@ app.post(
app.get(
'/:id',
+ routeDoc({ data: ApiKeySchema, errors: [404], summary: 'Get an API key', tags: ['api-keys'] }),
requireAuth,
requireWorkspaceAdmin,
requireAnyPermission(getAllScopePermissions('API_KEY_READ')),
@@ -51,6 +63,12 @@ app.get(
app.patch(
'/:id',
+ routeDoc({
+ data: ApiKeySchema,
+ errors: [404],
+ summary: 'Update an API key',
+ tags: ['api-keys'],
+ }),
requireAuth,
requireWorkspaceAdmin,
requireAnyPermission(getAllScopePermissions('API_KEY_UPDATE')),
@@ -61,6 +79,12 @@ app.patch(
app.delete(
'/:id',
+ routeDoc({
+ data: DeletedResourceSchema,
+ errors: [404],
+ summary: 'Delete an API key',
+ tags: ['api-keys'],
+ }),
requireAuth,
requireWorkspaceAdmin,
requireAnyPermission(getAllScopePermissions('API_KEY_DELETE')),
diff --git a/packages/openapi/src/routes/audio.route.ts b/packages/openapi/src/routes/audio.route.ts
index 60ad71970de..9cea8d26302 100644
--- a/packages/openapi/src/routes/audio.route.ts
+++ b/packages/openapi/src/routes/audio.route.ts
@@ -4,6 +4,7 @@ import { describeRoute } from 'hono-openapi';
import { getAllScopePermissions } from '@/utils/rbac';
+import { errorResponse } from '../common/openapi';
import { AudioController } from '../controllers/audio.controller';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermission } from '../middleware/permission-check';
@@ -36,6 +37,8 @@ const openAIError = (description: string): RouteResponse => ({
});
const app = new Hono();
+// The success body is the audio bytes, not JSON, which `routeDoc` (JSON-only)
+// cannot express — so this route declares its responses with `describeRoute`.
// Synthesis spends model credits: API keys need `model:invoke`, members the invoke permission.
const requireModelInvoke = requireAnyPermission(getAllScopePermissions('AI_MODEL_INVOKE'));
@@ -59,8 +62,12 @@ app.post(
description: 'Synthesized audio',
},
400: openAIError('Invalid request, unsupported format or invalid params'),
+ // Raised by `requireAuth` / the permission gate before the handler runs.
+ 401: errorResponse(401),
402: openAIError('Insufficient balance'),
+ 403: errorResponse(403),
429: openAIError('Upstream provider rate limit'),
+ 500: openAIError('Text-to-speech failed'),
502: openAIError('Upstream provider error'),
},
summary: 'Create speech',
diff --git a/packages/openapi/src/routes/chat-groups.route.test.ts b/packages/openapi/src/routes/chat-groups.route.test.ts
index 85a1de6d1f1..30c752d5356 100644
--- a/packages/openapi/src/routes/chat-groups.route.test.ts
+++ b/packages/openapi/src/routes/chat-groups.route.test.ts
@@ -19,6 +19,8 @@ vi.mock('../middleware/auth', () => ({
}));
const { default: ChatGroupRoutes } = await import('./chat-groups.route');
+const { ChatGroupListSchema, ChatGroupSchema } = await import('../types/chat-group.type');
+const { DeletedResourceSchema } = await import('../types/common.type');
const USER = 'chat-group-user';
const OTHER = 'chat-group-other';
@@ -105,6 +107,7 @@ describe('POST /chat-groups', () => {
{ agentId: 'agt_a', enabled: true, order: 0, role: 'participant' },
{ agentId: 'agt_b', enabled: true, order: 1, role: 'assistant' },
]);
+ expect(() => ChatGroupSchema.parse(group)).not.toThrow();
});
it('rolls the group back when a member is not visible to the caller', async () => {
@@ -232,6 +235,7 @@ describe('/chat-groups/:id/members', () => {
await request(`/${group.id}/members`, { body: { agentIds: ['agt_b'] }, method: 'DELETE' }),
);
expect(removed.members.map((m: any) => m.agentId).slice(1)).toEqual(['agt_a', 'agt_c']);
+ expect(() => ChatGroupSchema.parse(removed)).not.toThrow();
expect(await db.select().from(agents).where(eq(agents.id, 'agt_b'))).toHaveLength(1);
});
@@ -276,6 +280,9 @@ describe('DELETE /chat-groups/:id', () => {
const res = await request(`/${group.id}`, { method: 'DELETE' });
expect(res.status).toBe(200);
+ const deleted = await json(res);
+ expect(deleted).toEqual({ deleted: true, id: group.id });
+ expect(() => DeletedResourceSchema.parse(deleted)).not.toThrow();
expect((await request(`/${group.id}`)).status).toBe(404);
expect(await db.select().from(agents).where(eq(agents.id, supervisorId))).toHaveLength(0);
expect(await db.select().from(agents).where(eq(agents.id, 'agt_a'))).toHaveLength(1);
@@ -310,6 +317,8 @@ describe('personal chat groups', () => {
const ids = async (query: string) =>
(await json(await request(`/${query}`))).chatGroups.map((group: { id: string }) => group.id);
+ const list = await json(await request('/'));
+ expect(() => ChatGroupListSchema.parse(list)).not.toThrow();
expect(await ids('?personal=true')).toEqual([personal.id]);
expect(await ids('?personal=false')).toEqual([other.id]);
expect((await ids('')).sort()).toEqual([personal.id, other.id].sort());
diff --git a/packages/openapi/src/routes/chat-groups.route.ts b/packages/openapi/src/routes/chat-groups.route.ts
index 8226bb231ed..33e2279cd4e 100644
--- a/packages/openapi/src/routes/chat-groups.route.ts
+++ b/packages/openapi/src/routes/chat-groups.route.ts
@@ -2,6 +2,7 @@ import { Hono } from 'hono';
import { getAllScopePermissions, getScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { ChatGroupController } from '../controllers/chat-group.controller';
import { requireAuth } from '../middleware/auth';
@@ -9,10 +10,13 @@ import { requireAnyPermission } from '../middleware/permission-check';
import {
ChatGroupIdParamSchema,
ChatGroupListQuerySchema,
+ ChatGroupListSchema,
ChatGroupMembersRequestSchema,
+ ChatGroupSchema,
CreateChatGroupRequestSchema,
UpdateChatGroupRequestSchema,
} from '../types/chat-group.type';
+import { DeletedResourceSchema } from '../types/common.type';
// Multi-agent chat groups (`chat_groups`). Not to be confused with
// `agent-groups`, which are the sidebar folders.
@@ -25,6 +29,7 @@ const chatGroupWrite = requireAnyPermission(
ChatGroupRoutes.get(
'/',
+ routeDoc({ data: ChatGroupListSchema, summary: 'List chat groups', tags: ['chat-groups'] }),
requireAuth,
requireAnyPermission(
getScopePermissions('AGENT_READ', ['ALL', 'OWNER']),
@@ -36,6 +41,13 @@ ChatGroupRoutes.get(
ChatGroupRoutes.post(
'/',
+ routeDoc({
+ data: ChatGroupSchema,
+ errors: [404, 409],
+ status: 201,
+ summary: 'Create a chat group with its supervisor and members',
+ tags: ['chat-groups'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AGENT_CREATE'),
@@ -47,6 +59,12 @@ ChatGroupRoutes.post(
ChatGroupRoutes.get(
'/:id',
+ routeDoc({
+ data: ChatGroupSchema,
+ errors: [404],
+ summary: 'Get a chat group',
+ tags: ['chat-groups'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AGENT_READ'),
@@ -58,6 +76,12 @@ ChatGroupRoutes.get(
ChatGroupRoutes.patch(
'/:id',
+ routeDoc({
+ data: ChatGroupSchema,
+ errors: [404, 409],
+ summary: 'Update a chat group',
+ tags: ['chat-groups'],
+ }),
requireAuth,
chatGroupWrite,
zValidator('param', ChatGroupIdParamSchema),
@@ -67,6 +91,12 @@ ChatGroupRoutes.patch(
ChatGroupRoutes.delete(
'/:id',
+ routeDoc({
+ data: DeletedResourceSchema,
+ errors: [404],
+ summary: 'Delete a chat group',
+ tags: ['chat-groups'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AGENT_DELETE'),
@@ -78,6 +108,12 @@ ChatGroupRoutes.delete(
ChatGroupRoutes.post(
'/:id/members',
+ routeDoc({
+ data: ChatGroupSchema,
+ errors: [404],
+ summary: 'Add members to a chat group',
+ tags: ['chat-groups'],
+ }),
requireAuth,
chatGroupWrite,
zValidator('param', ChatGroupIdParamSchema),
@@ -87,6 +123,13 @@ ChatGroupRoutes.post(
ChatGroupRoutes.delete(
'/:id/members',
+ routeDoc({
+ data: ChatGroupSchema,
+ description: 'Detaches the agents and answers with the updated group.',
+ errors: [404, 409],
+ summary: 'Remove members from a chat group',
+ tags: ['chat-groups'],
+ }),
requireAuth,
chatGroupWrite,
zValidator('param', ChatGroupIdParamSchema),
diff --git a/packages/openapi/src/routes/chat.route.ts b/packages/openapi/src/routes/chat.route.ts
index 4d08884d337..e9929cd0a49 100644
--- a/packages/openapi/src/routes/chat.route.ts
+++ b/packages/openapi/src/routes/chat.route.ts
@@ -2,12 +2,16 @@ import { Hono } from 'hono';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { ChatController } from '../controllers/chat.controller';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermission } from '../middleware/permission-check';
import {
+ ChatGenerateReplyResponseSchema,
+ ChatResponseSchema,
ChatServiceParamsSchema,
+ ChatTranslateResponseSchema,
MessageGenerationParamsSchema,
TranslateServiceParamsSchema,
} from '../types/chat.type';
@@ -17,6 +21,11 @@ const requireModelInvoke = requireAnyPermission(getAllScopePermissions('AI_MODEL
app.post(
'/',
+ routeDoc({
+ data: ChatResponseSchema,
+ summary: 'Run a non-streaming chat completion',
+ tags: ['chat'],
+ }),
requireAuth,
requireModelInvoke,
zValidator('json', ChatServiceParamsSchema),
@@ -25,6 +34,7 @@ app.post(
app.post(
'/translate',
+ routeDoc({ data: ChatTranslateResponseSchema, summary: 'Translate text', tags: ['chat'] }),
requireAuth,
requireModelInvoke,
zValidator('json', TranslateServiceParamsSchema),
@@ -33,6 +43,11 @@ app.post(
app.post(
'/generate-reply',
+ routeDoc({
+ data: ChatGenerateReplyResponseSchema,
+ summary: 'Generate a reply to a message',
+ tags: ['chat'],
+ }),
requireAuth,
requireModelInvoke,
zValidator('json', MessageGenerationParamsSchema),
diff --git a/packages/openapi/src/routes/eval.route.test.ts b/packages/openapi/src/routes/eval.route.test.ts
index f0c71eb1540..b7056869555 100644
--- a/packages/openapi/src/routes/eval.route.test.ts
+++ b/packages/openapi/src/routes/eval.route.test.ts
@@ -27,7 +27,17 @@ vi.mock('../controllers/eval.controller', () => ({
},
}));
+vi.mock('../services/eval-resource.service', () => ({
+ EvalResourceService: class {
+ async deleteBenchmark(id: string) {
+ return { deleted: true, id };
+ }
+ },
+}));
+
const { default: EvalRoutes } = await import('./eval.route');
+const { successEnvelope } = await import('../common/openapi');
+const { DeletedResourceSchema } = await import('../types/common.type');
/**
* `/eval/runs` queues an internal run, which pre-creates real chat topics via
@@ -66,3 +76,21 @@ describe('POST /eval/runs API-key scopes', () => {
expect(res.status).toBe(200);
});
});
+
+describe('DELETE /eval/benchmarks/:id', () => {
+ it('answers with the unified deleted-resource payload', async () => {
+ const app = new Hono();
+ app.use('*', async (c, next) => {
+ c.set('userId' as never, 'user-1' as never);
+ await next();
+ });
+ app.route('/', EvalRoutes);
+
+ const res = await app.request('/benchmarks/bm-1', { method: 'DELETE' });
+ const body = await res.json();
+
+ expect(res.status).toBe(200);
+ expect(body.data).toEqual({ deleted: true, id: 'bm-1' });
+ expect(() => successEnvelope(DeletedResourceSchema).parse(body)).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/routes/eval.route.ts b/packages/openapi/src/routes/eval.route.ts
index 2707c953df7..b70443a0bef 100644
--- a/packages/openapi/src/routes/eval.route.ts
+++ b/packages/openapi/src/routes/eval.route.ts
@@ -1,8 +1,8 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { EvalController } from '../controllers/eval.controller';
import { EvalResourceController } from '../controllers/eval-resource.controller';
@@ -11,6 +11,7 @@ import {
requireAnyPermissionWithApiKeyScope,
requireApiKeyScope,
} from '../middleware/permission-check';
+import { DeletedResourceSchema } from '../types/common.type';
import {
CreateEvalRunRequestSchema,
EvalBatchReportSchema,
@@ -33,6 +34,26 @@ import {
UpdateDatasetSchema,
UpdateTestCaseSchema,
} from '../types/eval-resource.type';
+import {
+ EvalBatchReportResultSchema,
+ EvalBenchmarkListSchema,
+ EvalBenchmarkSchema,
+ EvalDatasetListSchema,
+ EvalDatasetSchema,
+ EvalReportResultSchema,
+ EvalRetryErrorsSchema,
+ EvalRunListSchema,
+ EvalRunResultListSchema,
+ EvalRunSchema,
+ EvalRunTopicListSchema,
+ EvalTestCaseListSchema,
+ EvalTestCaseSchema,
+} from '../types/eval-response.type';
+
+const RESOURCE_DESCRIPTION =
+ 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.';
+const LIFECYCLE_DESCRIPTION =
+ 'Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.';
const app = new Hono();
const requireRead = requireAnyPermissionWithApiKeyScope(
@@ -46,8 +67,11 @@ const requireWrite = requireAnyPermissionWithApiKeyScope(
app.post(
'/runs',
- describeRoute({
+ routeDoc({
+ data: EvalRunSchema,
description: 'Queues an asynchronous QStash-backed evaluation run and returns immediately.',
+ errors: [404, 409],
+ status: 202,
summary: 'Create an eval run',
tags: ['eval'],
}),
@@ -65,7 +89,11 @@ app.post(
app.get(
'/runs',
- describeRoute({ summary: 'List eval runs', tags: ['eval'] }),
+ routeDoc({
+ data: EvalRunListSchema,
+ summary: 'List eval runs',
+ tags: ['eval'],
+ }),
requireAuth,
requireRead,
zValidator('query', EvalRunListQuerySchema),
@@ -74,7 +102,12 @@ app.get(
app.get(
'/runs/:id/topics',
- describeRoute({ summary: 'List topic results of an eval run', tags: ['eval'] }),
+ routeDoc({
+ data: EvalRunTopicListSchema,
+ errors: [404],
+ summary: 'List topic results of an eval run',
+ tags: ['eval'],
+ }),
requireAuth,
requireRead,
zValidator('param', EvalRunIdParamSchema),
@@ -84,6 +117,12 @@ app.get(
app.get(
'/runs/:id',
+ routeDoc({
+ data: EvalRunSchema,
+ errors: [404],
+ summary: 'Get an eval run',
+ tags: ['eval'],
+ }),
requireAuth,
requireRead,
zValidator('param', EvalRunIdParamSchema),
@@ -92,6 +131,12 @@ app.get(
app.get(
'/runs/:id/results',
+ routeDoc({
+ data: EvalRunResultListSchema,
+ errors: [404],
+ summary: 'List case results of an eval run',
+ tags: ['eval'],
+ }),
requireAuth,
requireRead,
zValidator('param', EvalRunIdParamSchema),
@@ -101,10 +146,12 @@ app.get(
app.post(
'/benchmarks',
- describeRoute({
- summary: 'createBenchmark',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: EvalBenchmarkSchema,
+ description: RESOURCE_DESCRIPTION,
+ errors: [409],
+ status: 201,
+ summary: 'Create a benchmark',
tags: ['eval'],
}),
requireAuth,
@@ -115,10 +162,10 @@ app.post(
app.get(
'/benchmarks',
- describeRoute({
- summary: 'listBenchmarks',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: EvalBenchmarkListSchema,
+ description: RESOURCE_DESCRIPTION,
+ summary: 'List benchmarks',
tags: ['eval'],
}),
requireAuth,
@@ -129,10 +176,11 @@ app.get(
app.get(
'/benchmarks/:id',
- describeRoute({
- summary: 'getBenchmark',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: EvalBenchmarkSchema,
+ description: RESOURCE_DESCRIPTION,
+ errors: [404],
+ summary: 'Get a benchmark',
tags: ['eval'],
}),
requireAuth,
@@ -143,10 +191,11 @@ app.get(
app.patch(
'/benchmarks/:id',
- describeRoute({
- summary: 'updateBenchmark',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: EvalBenchmarkSchema,
+ description: RESOURCE_DESCRIPTION,
+ errors: [404, 409],
+ summary: 'Update a benchmark',
tags: ['eval'],
}),
requireAuth,
@@ -158,10 +207,11 @@ app.patch(
app.delete(
'/benchmarks/:id',
- describeRoute({
- summary: 'deleteBenchmark',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: DeletedResourceSchema,
+ description: RESOURCE_DESCRIPTION,
+ errors: [404],
+ summary: 'Delete a benchmark',
tags: ['eval'],
}),
requireAuth,
@@ -172,10 +222,12 @@ app.delete(
app.post(
'/datasets',
- describeRoute({
- summary: 'createDataset',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: EvalDatasetSchema,
+ description: RESOURCE_DESCRIPTION,
+ errors: [404, 409],
+ status: 201,
+ summary: 'Create a dataset',
tags: ['eval'],
}),
requireAuth,
@@ -186,10 +238,10 @@ app.post(
app.get(
'/datasets',
- describeRoute({
- summary: 'listDatasets',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: EvalDatasetListSchema,
+ description: RESOURCE_DESCRIPTION,
+ summary: 'List datasets',
tags: ['eval'],
}),
requireAuth,
@@ -200,10 +252,11 @@ app.get(
app.get(
'/datasets/:id',
- describeRoute({
- summary: 'getDataset',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: EvalDatasetSchema,
+ description: RESOURCE_DESCRIPTION,
+ errors: [404],
+ summary: 'Get a dataset',
tags: ['eval'],
}),
requireAuth,
@@ -214,10 +267,11 @@ app.get(
app.patch(
'/datasets/:id',
- describeRoute({
- summary: 'updateDataset',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: EvalDatasetSchema,
+ description: RESOURCE_DESCRIPTION,
+ errors: [404, 409],
+ summary: 'Update a dataset',
tags: ['eval'],
}),
requireAuth,
@@ -229,10 +283,11 @@ app.patch(
app.delete(
'/datasets/:id',
- describeRoute({
- summary: 'deleteDataset',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: DeletedResourceSchema,
+ description: RESOURCE_DESCRIPTION,
+ errors: [404],
+ summary: 'Delete a dataset',
tags: ['eval'],
}),
requireAuth,
@@ -243,10 +298,12 @@ app.delete(
app.post(
'/datasets/:datasetId/test-cases',
- describeRoute({
- summary: 'createTestCase',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: EvalTestCaseSchema,
+ description: RESOURCE_DESCRIPTION,
+ errors: [404, 409],
+ status: 201,
+ summary: 'Create a test case',
tags: ['eval'],
}),
requireAuth,
@@ -258,10 +315,11 @@ app.post(
app.get(
'/datasets/:datasetId/test-cases',
- describeRoute({
- summary: 'listTestCases',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: EvalTestCaseListSchema,
+ description: RESOURCE_DESCRIPTION,
+ errors: [404],
+ summary: 'List test cases of a dataset',
tags: ['eval'],
}),
requireAuth,
@@ -273,10 +331,11 @@ app.get(
app.get(
'/test-cases/:id',
- describeRoute({
- summary: 'getTestCase',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: EvalTestCaseSchema,
+ description: RESOURCE_DESCRIPTION,
+ errors: [404],
+ summary: 'Get a test case',
tags: ['eval'],
}),
requireAuth,
@@ -287,10 +346,11 @@ app.get(
app.patch(
'/test-cases/:id',
- describeRoute({
- summary: 'updateTestCase',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: EvalTestCaseSchema,
+ description: RESOURCE_DESCRIPTION,
+ errors: [404],
+ summary: 'Update a test case',
tags: ['eval'],
}),
requireAuth,
@@ -302,10 +362,11 @@ app.patch(
app.delete(
'/test-cases/:id',
- describeRoute({
- summary: 'deleteTestCase',
- description:
- 'Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.',
+ routeDoc({
+ data: DeletedResourceSchema,
+ description: RESOURCE_DESCRIPTION,
+ errors: [404],
+ summary: 'Delete a test case',
tags: ['eval'],
}),
requireAuth,
@@ -316,11 +377,12 @@ app.delete(
app.post(
'/runs/:id/claim',
- describeRoute({
- summary: 'claim',
+ routeDoc({
+ data: EvalRunSchema,
+ description: LIFECYCLE_DESCRIPTION,
+ errors: [404, 409],
+ summary: 'Claim a pending external eval run',
tags: ['eval'],
- description:
- 'Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.',
}),
requireAuth,
requireWrite,
@@ -330,11 +392,12 @@ app.post(
app.patch(
'/runs/:id/status',
- describeRoute({
- summary: 'setStatus',
+ routeDoc({
+ data: EvalRunSchema,
+ description: LIFECYCLE_DESCRIPTION,
+ errors: [404, 409],
+ summary: 'Set the status of an external eval run',
tags: ['eval'],
- description:
- 'Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.',
}),
requireAuth,
requireWrite,
@@ -345,11 +408,12 @@ app.patch(
app.post(
'/runs/:id/retry-errors',
- describeRoute({
- summary: 'retryErrors',
+ routeDoc({
+ data: EvalRetryErrorsSchema,
+ description: LIFECYCLE_DESCRIPTION,
+ errors: [404, 409],
+ summary: 'Retry the errored cases of an eval run',
tags: ['eval'],
- description:
- 'Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.',
}),
requireAuth,
requireWrite,
@@ -359,11 +423,12 @@ app.post(
app.put(
'/runs/:runId/topics/:topicId/result',
- describeRoute({
- summary: 'report',
+ routeDoc({
+ data: EvalReportResultSchema,
+ description: LIFECYCLE_DESCRIPTION,
+ errors: [404, 409],
+ summary: 'Report the result of one run topic',
tags: ['eval'],
- description:
- 'Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.',
}),
requireAuth,
requireWrite,
@@ -374,11 +439,12 @@ app.put(
app.post(
'/runs/:id/results',
- describeRoute({
- summary: 'reportBatch',
+ routeDoc({
+ data: EvalBatchReportResultSchema,
+ description: LIFECYCLE_DESCRIPTION,
+ errors: [404, 409],
+ summary: 'Report results for a batch of run topics',
tags: ['eval'],
- description:
- 'Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.',
}),
requireAuth,
requireWrite,
diff --git a/packages/openapi/src/routes/files.route.test.ts b/packages/openapi/src/routes/files.route.test.ts
new file mode 100644
index 00000000000..74e999b3374
--- /dev/null
+++ b/packages/openapi/src/routes/files.route.test.ts
@@ -0,0 +1,46 @@
+import { Hono } from 'hono';
+import { describe, expect, it, vi } from 'vitest';
+
+import { successEnvelope } from '../common/openapi';
+import { DeletedResourceSchema } from '../types/common.type';
+
+// The route and the real controller run; only the db, auth and the file
+// service behind the controller are stubbed.
+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: vi.fn() }));
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = async () => true;
+ },
+}));
+vi.mock('../middleware/auth', () => ({
+ requireAuth: async (_c: any, next: any) => next(),
+}));
+vi.mock('../services/file.service', () => ({
+ FileUploadService: class {
+ deleteFile = async (id: string) => ({ deleted: true, id });
+ },
+}));
+
+const { default: FileRoutes } = await import('./files.route');
+
+const request = (path: string, method: string) => {
+ const app = new Hono();
+ app.use('*', async (c, next) => {
+ c.set('userId' as never, 'user-1' as never);
+ c.set('authType' as never, 'oidc' as never);
+ await next();
+ });
+ app.route('/', FileRoutes);
+ return app.request(path, { method });
+};
+
+describe('DELETE /files/:id', () => {
+ it('answers with the deleted file id inside the success envelope', async () => {
+ const res = await request('/file-1', 'DELETE');
+ const body = await res.json();
+
+ expect(res.status).toBe(200);
+ expect(body.data).toEqual({ deleted: true, id: 'file-1' });
+ expect(() => successEnvelope(DeletedResourceSchema).parse(body)).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/routes/files.route.ts b/packages/openapi/src/routes/files.route.ts
index bfae1f4c8d2..4512992b8d5 100644
--- a/packages/openapi/src/routes/files.route.ts
+++ b/packages/openapi/src/routes/files.route.ts
@@ -1,19 +1,28 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { FileController } from '../controllers/file.controller';
import { requireAnyPermission } from '../middleware';
import { requireAuth } from '../middleware/auth';
+import { DeletedResourceSchema } from '../types/common.type';
import {
+ BatchFileUploadResponseSchema,
BatchGetFilesRequestSchema,
+ BatchGetFilesResponseSchema,
FileChunkRequestSchema,
+ FileChunkStatusResponseSchema,
+ FileChunkTaskResponseSchema,
+ FileDetailSchema,
FileIdParamSchema,
FileListQuerySchema,
+ FileListResponseSchema,
FileParseRequestSchema,
+ FileParseResultSchema,
FileUrlRequestSchema,
+ FileUrlResponseSchema,
UpdateFileSchema,
} from '../types/file.type';
@@ -35,6 +44,7 @@ const app = new Hono();
*/
app.get(
'/',
+ routeDoc({ data: FileListResponseSchema, summary: 'List files', tags: ['files'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('FILE_READ'),
@@ -64,7 +74,9 @@ app.get(
*/
app.post(
'/',
- describeRoute({
+ routeDoc({
+ data: FileDetailSchema,
+ errors: [400],
requestBody: {
content: {
'multipart/form-data': {
@@ -108,6 +120,13 @@ app.post(
*/
app.get(
'/:id',
+ routeDoc({
+ data: FileDetailSchema,
+ description:
+ 'Non-image files include their parse result. A file that does not exist answers 400.',
+ summary: 'Get a file',
+ tags: ['files'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('FILE_READ'),
@@ -132,6 +151,11 @@ app.get(
*/
app.get(
'/:id/url',
+ routeDoc({
+ data: FileUrlResponseSchema,
+ summary: 'Get a pre-signed file URL',
+ tags: ['files'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('FILE_READ'),
@@ -159,6 +183,12 @@ app.get(
*/
app.patch(
'/:id',
+ routeDoc({
+ data: FileDetailSchema,
+ errors: [404],
+ summary: 'Update a file',
+ tags: ['files'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('FILE_UPDATE'),
@@ -181,6 +211,7 @@ app.patch(
*/
app.delete(
'/:id',
+ routeDoc({ data: DeletedResourceSchema, summary: 'Delete a file', tags: ['files'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('FILE_DELETE'),
@@ -209,6 +240,7 @@ app.delete(
*/
app.post(
'/:id/parses',
+ routeDoc({ data: FileParseResultSchema, summary: 'Parse file content', tags: ['files'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('FILE_UPDATE'),
@@ -235,6 +267,11 @@ app.post(
*/
app.post(
'/:id/chunks',
+ routeDoc({
+ data: FileChunkTaskResponseSchema,
+ summary: 'Start a file chunking task',
+ tags: ['files'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('FILE_UPDATE'),
@@ -262,6 +299,11 @@ app.post(
*/
app.get(
'/:id/chunks',
+ routeDoc({
+ data: FileChunkStatusResponseSchema,
+ summary: 'Get file chunking status',
+ tags: ['files'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('FILE_READ'),
@@ -290,7 +332,9 @@ app.get(
*/
app.post(
'/batches',
- describeRoute({
+ routeDoc({
+ data: BatchFileUploadResponseSchema,
+ errors: [400],
requestBody: {
content: {
'multipart/form-data': {
@@ -345,6 +389,11 @@ app.post(
*/
app.post(
'/queries',
+ routeDoc({
+ data: BatchGetFilesResponseSchema,
+ summary: 'Get several files',
+ tags: ['files'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('FILE_READ'),
diff --git a/packages/openapi/src/routes/goals.route.ts b/packages/openapi/src/routes/goals.route.ts
index ec4a30c2e4f..c689ed47044 100644
--- a/packages/openapi/src/routes/goals.route.ts
+++ b/packages/openapi/src/routes/goals.route.ts
@@ -1,16 +1,24 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { GoalController } from '../controllers/goal.controller';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermission } from '../middleware/permission-check';
+import { DeletedResourceSchema } from '../types/common.type';
import {
CreateGoalRequestSchema,
+ GoalAdvanceResultSchema,
+ GoalGraphSchema,
+ GoalGraphSnapshotSchema,
GoalIdParamSchema,
GoalListQuerySchema,
+ GoalListResponseSchema,
+ GoalRestartResultSchema,
+ GoalSchema,
+ GoalSupervisionSchema,
RestartGoalRequestSchema,
UpdateGoalRequestSchema,
} from '../types/goal.type';
@@ -35,13 +43,27 @@ const goalWrite = requireAnyPermission(
);
/** GET /api/v1/goals — list goals with their graph roll-up. */
-GoalRoutes.get('/', requireAuth, goalRead, zValidator('query', GoalListQuerySchema), async (c) =>
- new GoalController().listGoals(c),
+GoalRoutes.get(
+ '/',
+ routeDoc({ data: GoalListResponseSchema, summary: 'List goals', tags: ['goals'] }),
+ requireAuth,
+ goalRead,
+ zValidator('query', GoalListQuerySchema),
+ async (c) => new GoalController().listGoals(c),
);
/** POST /api/v1/goals — create a goal and start its coordinator. */
GoalRoutes.post(
'/',
+ routeDoc({
+ data: GoalGraphSnapshotSchema,
+ description: 'Creates the goal graph and hands it to the coordinator.',
+ // The supervising agent or the project named in the body may not exist.
+ errors: [404],
+ status: 201,
+ summary: 'Create a goal',
+ tags: ['goals'],
+ }),
requireAuth,
goalWrite,
zValidator('json', CreateGoalRequestSchema),
@@ -49,14 +71,30 @@ GoalRoutes.post(
);
/** GET /api/v1/goals/:id — the goal and its whole graph. */
-GoalRoutes.get('/:id', requireAuth, goalRead, zValidator('param', GoalIdParamSchema), async (c) =>
- new GoalController().getGoal(c),
+GoalRoutes.get(
+ '/:id',
+ routeDoc({
+ data: GoalGraphSchema,
+ errors: [404],
+ summary: 'Get a goal and its graph',
+ tags: ['goals'],
+ }),
+ requireAuth,
+ goalRead,
+ zValidator('param', GoalIdParamSchema),
+ async (c) => new GoalController().getGoal(c),
);
/** GET /api/v1/goals/:id/supervision — supervision toggle and current state. */
GoalRoutes.get(
'/:id/supervision',
- describeRoute({ operationId: 'getGoalSupervision', tags: ['goals'] }),
+ routeDoc({
+ data: GoalSupervisionSchema,
+ errors: [404],
+ operationId: 'getGoalSupervision',
+ summary: 'Get goal supervision state',
+ tags: ['goals'],
+ }),
requireAuth,
goalRead,
zValidator('param', GoalIdParamSchema),
@@ -66,6 +104,12 @@ GoalRoutes.get(
/** PATCH /api/v1/goals/:id — update the acceptance requirement and/or budget. */
GoalRoutes.patch(
'/:id',
+ routeDoc({
+ data: GoalGraphSchema,
+ errors: [404],
+ summary: 'Update a goal requirement or budget',
+ tags: ['goals'],
+ }),
requireAuth,
goalWrite,
zValidator('param', GoalIdParamSchema),
@@ -76,6 +120,13 @@ GoalRoutes.patch(
/** DELETE /api/v1/goals/:id — stop the goal and cascade its graph. */
GoalRoutes.delete(
'/:id',
+ routeDoc({
+ data: DeletedResourceSchema,
+ // 409 / 412: a supervised or managed goal whose live turn cannot be fenced off.
+ errors: [404, 409, 412],
+ summary: 'Delete a goal',
+ tags: ['goals'],
+ }),
requireAuth,
goalWrite,
zValidator('param', GoalIdParamSchema),
@@ -85,7 +136,13 @@ GoalRoutes.delete(
/** POST /api/v1/goals/:id/advance — run the coordinator now. */
GoalRoutes.post(
'/:id/advance',
- describeRoute({ operationId: 'advanceGoal', tags: ['goals'] }),
+ routeDoc({
+ data: GoalAdvanceResultSchema,
+ errors: [404],
+ operationId: 'advanceGoal',
+ summary: 'Run the goal coordinator now',
+ tags: ['goals'],
+ }),
requireAuth,
goalWrite,
zValidator('param', GoalIdParamSchema),
@@ -95,7 +152,14 @@ GoalRoutes.post(
/** POST /api/v1/goals/:id/pause */
GoalRoutes.post(
'/:id/pause',
- describeRoute({ operationId: 'pauseGoal', tags: ['goals'] }),
+ routeDoc({
+ data: GoalSchema,
+ // 409: a draft never started; 412: an archived goal stays put.
+ errors: [404, 409, 412],
+ operationId: 'pauseGoal',
+ summary: 'Pause a goal',
+ tags: ['goals'],
+ }),
requireAuth,
goalWrite,
zValidator('param', GoalIdParamSchema),
@@ -105,7 +169,14 @@ GoalRoutes.post(
/** POST /api/v1/goals/:id/resume */
GoalRoutes.post(
'/:id/resume',
- describeRoute({ operationId: 'resumeGoal', tags: ['goals'] }),
+ routeDoc({
+ data: GoalSchema,
+ // 409: a draft, or the goal changed while resuming; 412: an archived goal.
+ errors: [404, 409, 412],
+ operationId: 'resumeGoal',
+ summary: 'Resume a paused goal',
+ tags: ['goals'],
+ }),
requireAuth,
goalWrite,
zValidator('param', GoalIdParamSchema),
@@ -115,7 +186,14 @@ GoalRoutes.post(
/** POST /api/v1/goals/:id/restart — start every unfinished task node over. */
GoalRoutes.post(
'/:id/restart',
- describeRoute({ operationId: 'restartGoal', tags: ['goals'] }),
+ routeDoc({
+ data: GoalRestartResultSchema,
+ // 412: an archived goal is not restarted.
+ errors: [404, 412],
+ operationId: 'restartGoal',
+ summary: 'Restart every unfinished task of a goal',
+ tags: ['goals'],
+ }),
requireAuth,
goalWrite,
zValidator('param', GoalIdParamSchema),
diff --git a/packages/openapi/src/routes/im.route.ts b/packages/openapi/src/routes/im.route.ts
index 735ad294f11..083cdafc99f 100644
--- a/packages/openapi/src/routes/im.route.ts
+++ b/packages/openapi/src/routes/im.route.ts
@@ -1,16 +1,19 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { ImController } from '../controllers/im.controller';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermission, requireApiKeyScope } from '../middleware/permission-check';
import {
ImReadRequestSchema,
+ ImReadResultSchema,
ImSendRequestSchema,
+ ImSendResultSchema,
ImSyncQuerySchema,
+ ImSyncResultSchema,
ImTopicParamSchema,
} from '../types/im.type';
@@ -37,7 +40,9 @@ const messageWrite = requireAnyPermission(
*/
ImRoutes.post(
'/messages',
- describeRoute({
+ routeDoc({
+ data: ImSendResultSchema,
+ errors: [404, 409],
operationId: 'sendImMessage',
summary: 'Send a message to an agent; the reply arrives asynchronously via sync',
tags: ['im'],
@@ -54,7 +59,9 @@ ImRoutes.post(
/** GET /api/v1/im/topics/:topicId/sync — whole new messages, typing and read state (long-poll). */
ImRoutes.get(
'/topics/:topicId/sync',
- describeRoute({
+ routeDoc({
+ data: ImSyncResultSchema,
+ errors: [404],
operationId: 'syncImTopic',
summary: 'Long-poll a conversation for whole new messages, typing and read receipts',
tags: ['im'],
@@ -70,7 +77,9 @@ ImRoutes.get(
/** POST /api/v1/im/topics/:topicId/read — move the user's read cursor forward. */
ImRoutes.post(
'/topics/:topicId/read',
- describeRoute({
+ routeDoc({
+ data: ImReadResultSchema,
+ errors: [404],
operationId: 'markImTopicRead',
summary: "Mark the agent's messages read up to a message",
tags: ['im'],
diff --git a/packages/openapi/src/routes/knowledge-bases.route.test.ts b/packages/openapi/src/routes/knowledge-bases.route.test.ts
new file mode 100644
index 00000000000..79c251abd6f
--- /dev/null
+++ b/packages/openapi/src/routes/knowledge-bases.route.test.ts
@@ -0,0 +1,46 @@
+import { Hono } from 'hono';
+import { describe, expect, it, vi } from 'vitest';
+
+import { successEnvelope } from '../common/openapi';
+import { DeletedResourceSchema } from '../types/common.type';
+
+// The route and the real controller run; only the db, auth and the knowledge
+// base service behind the controller are stubbed.
+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: vi.fn() }));
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = async () => true;
+ },
+}));
+vi.mock('../middleware/auth', () => ({
+ requireAuth: async (_c: any, next: any) => next(),
+}));
+vi.mock('../services/knowledge-base.service', () => ({
+ KnowledgeBaseService: class {
+ deleteKnowledgeBase = async (id: string) => ({ deleted: true, id });
+ },
+}));
+
+const { default: KnowledgeBaseRoutes } = await import('./knowledge-bases.route');
+
+const request = (path: string, method: string) => {
+ const app = new Hono();
+ app.use('*', async (c, next) => {
+ c.set('userId' as never, 'user-1' as never);
+ c.set('authType' as never, 'oidc' as never);
+ await next();
+ });
+ app.route('/', KnowledgeBaseRoutes);
+ return app.request(path, { method });
+};
+
+describe('DELETE /knowledge-bases/:id', () => {
+ it('answers with the deleted knowledge base id inside the success envelope', async () => {
+ const res = await request('/kb-1', 'DELETE');
+ const body = await res.json();
+
+ expect(res.status).toBe(200);
+ expect(body.data).toEqual({ deleted: true, id: 'kb-1' });
+ expect(() => successEnvelope(DeletedResourceSchema).parse(body)).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/routes/knowledge-bases.route.ts b/packages/openapi/src/routes/knowledge-bases.route.ts
index 463ed1b35c4..a77da83862e 100644
--- a/packages/openapi/src/routes/knowledge-bases.route.ts
+++ b/packages/openapi/src/routes/knowledge-bases.route.ts
@@ -2,16 +2,22 @@ import { Hono } from 'hono';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { KnowledgeBaseController } from '../controllers/knowledge-base.controller';
import { requireAnyPermission } from '../middleware';
import { requireAuth } from '../middleware/auth';
+import { DeletedResourceSchema } from '../types/common.type';
+import { FileListResponseSchema } from '../types/file.type';
import {
CreateKnowledgeBaseSchema,
+ KnowledgeBaseDetailResponseSchema,
KnowledgeBaseFileBatchSchema,
KnowledgeBaseFileListQuerySchema,
+ KnowledgeBaseFileOperationResultSchema,
KnowledgeBaseIdParamSchema,
KnowledgeBaseListQuerySchema,
+ KnowledgeBaseListResponseSchema,
MoveKnowledgeBaseFilesSchema,
UpdateKnowledgeBaseSchema,
} from '../types/knowledge-base.type';
@@ -29,6 +35,11 @@ const app = new Hono();
*/
app.get(
'/',
+ routeDoc({
+ data: KnowledgeBaseListResponseSchema,
+ summary: 'List knowledge bases',
+ tags: ['knowledge-bases'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('KNOWLEDGE_BASE_READ'),
@@ -55,6 +66,11 @@ app.get(
*/
app.post(
'/',
+ routeDoc({
+ data: KnowledgeBaseDetailResponseSchema,
+ summary: 'Create a knowledge base',
+ tags: ['knowledge-bases'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('KNOWLEDGE_BASE_CREATE'),
@@ -76,6 +92,12 @@ app.post(
*/
app.get(
'/:id',
+ routeDoc({
+ data: KnowledgeBaseDetailResponseSchema,
+ errors: [404],
+ summary: 'Get a knowledge base',
+ tags: ['knowledge-bases'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('KNOWLEDGE_BASE_READ'),
@@ -105,6 +127,12 @@ app.get(
*/
app.patch(
'/:id',
+ routeDoc({
+ data: KnowledgeBaseDetailResponseSchema,
+ errors: [404],
+ summary: 'Update a knowledge base',
+ tags: ['knowledge-bases'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('KNOWLEDGE_BASE_UPDATE'),
@@ -127,6 +155,13 @@ app.patch(
*/
app.delete(
'/:id',
+ routeDoc({
+ data: DeletedResourceSchema,
+ description: 'Also deletes the files that belong to no other knowledge base.',
+ errors: [404],
+ summary: 'Delete a knowledge base',
+ tags: ['knowledge-bases'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('KNOWLEDGE_BASE_DELETE'),
@@ -157,6 +192,12 @@ app.delete(
*/
app.get(
'/:id/files',
+ routeDoc({
+ data: FileListResponseSchema,
+ errors: [404],
+ summary: 'List the files of a knowledge base',
+ tags: ['knowledge-bases'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('KNOWLEDGE_BASE_READ'),
@@ -176,6 +217,12 @@ app.get(
*/
app.post(
'/:id/files/batch',
+ routeDoc({
+ data: KnowledgeBaseFileOperationResultSchema,
+ errors: [404],
+ summary: 'Add files to a knowledge base',
+ tags: ['knowledge-bases'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('KNOWLEDGE_BASE_UPDATE'),
@@ -195,6 +242,14 @@ app.post(
*/
app.delete(
'/:id/files/batch',
+ routeDoc({
+ data: KnowledgeBaseFileOperationResultSchema,
+ description:
+ 'Detaches the files from the knowledge base without deleting them, and reports per file which ones were detached.',
+ errors: [404],
+ summary: 'Remove files from a knowledge base',
+ tags: ['knowledge-bases'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('KNOWLEDGE_BASE_UPDATE'),
@@ -214,6 +269,12 @@ app.delete(
*/
app.post(
'/:id/files/move',
+ routeDoc({
+ data: KnowledgeBaseFileOperationResultSchema,
+ errors: [404],
+ summary: 'Move files to another knowledge base',
+ tags: ['knowledge-bases'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('KNOWLEDGE_BASE_UPDATE'),
diff --git a/packages/openapi/src/routes/mcp-servers.route.ts b/packages/openapi/src/routes/mcp-servers.route.ts
index 4f4674efe8b..2c2f219b8f1 100644
--- a/packages/openapi/src/routes/mcp-servers.route.ts
+++ b/packages/openapi/src/routes/mcp-servers.route.ts
@@ -1,15 +1,19 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
+import { z } from 'zod';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { McpServerController } from '../controllers/mcp-server.controller';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermissionWithApiKeyScope } from '../middleware/permission-check';
+import { DeletedResourceSchema } from '../types/common.type';
import {
CreateMcpServerRequestSchema,
McpServerIdParamSchema,
+ McpServerSchema,
+ McpServerSyncResultSchema,
UpdateMcpServerRequestSchema,
} from '../types/mcp-server.type';
@@ -25,7 +29,11 @@ const requireWrite = requireAnyPermissionWithApiKeyScope(
app.get(
'/',
- describeRoute({ summary: 'List remote MCP servers', tags: ['mcp-servers'] }),
+ routeDoc({
+ data: z.array(McpServerSchema),
+ summary: 'List remote MCP servers',
+ tags: ['mcp-servers'],
+ }),
requireAuth,
requireRead,
async (c) => new McpServerController().listServers(c),
@@ -33,19 +41,42 @@ app.get(
app.post(
'/',
- describeRoute({ summary: 'Add a remote MCP server', tags: ['mcp-servers'] }),
+ routeDoc({
+ data: McpServerSchema,
+ errors: [409],
+ status: 201,
+ summary: 'Add a remote MCP server',
+ tags: ['mcp-servers'],
+ }),
requireAuth,
requireWrite,
zValidator('json', CreateMcpServerRequestSchema),
async (c) => new McpServerController().createServer(c),
);
-app.get('/:id', requireAuth, requireRead, zValidator('param', McpServerIdParamSchema), async (c) =>
- new McpServerController().getServer(c),
+app.get(
+ '/:id',
+ routeDoc({
+ data: McpServerSchema,
+ errors: [404],
+ summary: 'Get a remote MCP server',
+ tags: ['mcp-servers'],
+ }),
+ requireAuth,
+ requireRead,
+ zValidator('param', McpServerIdParamSchema),
+ async (c) => new McpServerController().getServer(c),
);
app.patch(
'/:id',
+ routeDoc({
+ data: McpServerSchema,
+ description: 'Changing `serverUrl` or `credentials` resets the status to `disconnected`.',
+ errors: [404],
+ summary: 'Update a remote MCP server',
+ tags: ['mcp-servers'],
+ }),
requireAuth,
requireWrite,
zValidator('param', McpServerIdParamSchema),
@@ -55,6 +86,12 @@ app.patch(
app.delete(
'/:id',
+ routeDoc({
+ data: DeletedResourceSchema,
+ errors: [404],
+ summary: 'Delete a remote MCP server',
+ tags: ['mcp-servers'],
+ }),
requireAuth,
requireWrite,
zValidator('param', McpServerIdParamSchema),
@@ -63,7 +100,12 @@ app.delete(
app.post(
'/:id/sync',
- describeRoute({ summary: 'Discover and sync MCP tools', tags: ['mcp-servers'] }),
+ routeDoc({
+ data: McpServerSyncResultSchema,
+ errors: [404],
+ summary: 'Discover and sync MCP tools',
+ tags: ['mcp-servers'],
+ }),
requireAuth,
requireWrite,
zValidator('param', McpServerIdParamSchema),
diff --git a/packages/openapi/src/routes/memories.route.test.ts b/packages/openapi/src/routes/memories.route.test.ts
index 5013117bb34..da0b4f96083 100644
--- a/packages/openapi/src/routes/memories.route.test.ts
+++ b/packages/openapi/src/routes/memories.route.test.ts
@@ -24,10 +24,10 @@ vi.mock('../controllers/memory.controller', () => ({
return c.json({ data: [], success: true });
}
deleteAll(c: any) {
- return c.json({ data: { success: true }, success: true });
+ return c.json({ data: { count: 2, deleted: true }, success: true });
}
deleteEntry(c: any) {
- return c.json({ data: { success: true }, success: true });
+ return c.json({ data: { deleted: true, id: c.req.param('id') }, success: true });
}
listCategory(c: any) {
return c.json({ data: [], success: true });
@@ -36,6 +36,7 @@ vi.mock('../controllers/memory.controller', () => ({
}));
const { default: MemoryRoutes } = await import('./memories.route');
+const { DeletedResourceSchema, DeletedResourcesSchema } = await import('../types/common.type');
/** A request authenticated as an API key holding exactly `scopes`. */
const requestAs = (scopes: string[], path: string, init?: { method?: string }) => {
@@ -89,6 +90,8 @@ describe('destructive memory routes', () => {
const res = await requestAs(['user:write'], '/', { method: 'DELETE' });
expect(res.status).toBe(200);
+ const body = await res.json();
+ expect(() => DeletedResourcesSchema.parse(body.data)).not.toThrow();
});
it('refuses a chat-only key on DELETE /memories/:category/:id', async () => {
@@ -101,5 +104,7 @@ describe('destructive memory routes', () => {
const res = await requestAs(['user:write'], '/identities/mem-1', { method: 'DELETE' });
expect(res.status).toBe(200);
+ const body = await res.json();
+ expect(DeletedResourceSchema.parse(body.data)).toEqual({ deleted: true, id: 'mem-1' });
});
});
diff --git a/packages/openapi/src/routes/memories.route.ts b/packages/openapi/src/routes/memories.route.ts
index 82dafc4ce8a..a81c3e968a4 100644
--- a/packages/openapi/src/routes/memories.route.ts
+++ b/packages/openapi/src/routes/memories.route.ts
@@ -1,8 +1,9 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
+import { z } from 'zod';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { MemoryController } from '../controllers/memory.controller';
import { requireAuth } from '../middleware/auth';
@@ -10,7 +11,14 @@ import {
requireAnyPermissionWithApiKeyScope,
requireApiKeyScope,
} from '../middleware/permission-check';
-import { MemoryCategoryParamSchema, MemoryEntryPathParamSchema } from '../types/memory.type';
+import { DeletedResourceSchema, DeletedResourcesSchema } from '../types/common.type';
+import {
+ MemoryCategoryEntriesSchema,
+ MemoryCategoryParamSchema,
+ MemoryEntryPathParamSchema,
+ MemoryPersonaSchema,
+ MemoryPersonaVersionSchema,
+} from '../types/memory.type';
/**
* User memory routes.
@@ -38,7 +46,9 @@ const memoryRead = requireApiKeyScope('user:read');
/** GET /api/v1/memories/persona */
MemoryRoutes.get(
'/persona',
- describeRoute({
+ routeDoc({
+ data: MemoryPersonaSchema.nullable(),
+ description: '`data` is null until a persona has been written.',
operationId: 'getMemoryPersona',
summary: 'Get the current persona document',
tags: ['memories'],
@@ -51,7 +61,8 @@ MemoryRoutes.get(
/** GET /api/v1/memories/persona/versions */
MemoryRoutes.get(
'/persona/versions',
- describeRoute({
+ routeDoc({
+ data: z.array(MemoryPersonaVersionSchema),
operationId: 'listMemoryPersonaVersions',
summary: 'List persona document versions',
tags: ['memories'],
@@ -64,7 +75,10 @@ MemoryRoutes.get(
/** DELETE /api/v1/memories — purge everything and allow re-extraction. */
MemoryRoutes.delete(
'/',
- describeRoute({
+ routeDoc({
+ data: DeletedResourcesSchema,
+ description:
+ 'Removes every memory, the persona and the per-topic extraction status; `count` is the number of memories removed.',
operationId: 'deleteAllMemories',
summary: 'Delete all memory entries',
tags: ['memories'],
@@ -77,7 +91,13 @@ MemoryRoutes.delete(
/** DELETE /api/v1/memories/:category/:id */
MemoryRoutes.delete(
'/:category/:id',
- describeRoute({ operationId: 'deleteMemoryEntry', tags: ['memories'] }),
+ routeDoc({
+ data: DeletedResourceSchema,
+ errors: [404],
+ operationId: 'deleteMemoryEntry',
+ summary: 'Delete a memory entry',
+ tags: ['memories'],
+ }),
requireAuth,
memoryWrite,
zValidator('param', MemoryEntryPathParamSchema),
@@ -87,7 +107,14 @@ MemoryRoutes.delete(
/** GET /api/v1/memories/:category */
MemoryRoutes.get(
'/:category',
- describeRoute({ operationId: 'listMemoryCategory', tags: ['memories'] }),
+ routeDoc({
+ data: MemoryCategoryEntriesSchema,
+ description:
+ 'Every identity, or the newest entries of the other categories; the array shape follows `category`.',
+ operationId: 'listMemoryCategory',
+ summary: 'List the entries of a memory category',
+ tags: ['memories'],
+ }),
requireAuth,
memoryRead,
zValidator('param', MemoryCategoryParamSchema),
diff --git a/packages/openapi/src/routes/message-translations.route.test.ts b/packages/openapi/src/routes/message-translations.route.test.ts
new file mode 100644
index 00000000000..90202781421
--- /dev/null
+++ b/packages/openapi/src/routes/message-translations.route.test.ts
@@ -0,0 +1,95 @@
+// @vitest-environment node
+import { Hono } from 'hono';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { getTestDB } from '@/database/core/getTestDB';
+import { messages, users } from '@/database/schemas';
+
+import { DeletedResourceSchema } from '../types/common.type';
+import {
+ MessageTranslationSchema,
+ MessageTranslationWriteSchema,
+} from '../types/message-translations.type';
+
+const db = await getTestDB();
+
+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: async () => db }));
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = async () => true;
+ },
+}));
+vi.mock('../middleware/auth', () => ({
+ requireAuth: async (_c: any, next: any) => next(),
+}));
+vi.mock('../services/chat.service', () => ({
+ ChatService: class {
+ translate = async () => 'Bonjour';
+ },
+}));
+
+const { default: Routes } = await import('./message-translations.route');
+
+const USER = 'translation-route-user';
+
+const request = (path: string, init: { body?: unknown; method?: string } = {}) => {
+ const app = new Hono();
+ app.use('*', async (c, next) => {
+ c.set('userId' as never, USER as never);
+ await next();
+ });
+ app.route('/', Routes);
+
+ return app.request(path, {
+ ...(init.body === undefined
+ ? {}
+ : { body: JSON.stringify(init.body), headers: { 'content-type': 'application/json' } }),
+ method: init.method ?? 'GET',
+ });
+};
+
+const json = async (res: Response) => ((await res.json()) as { data: any }).data;
+
+const MESSAGE = 'msg_translation_route';
+
+beforeEach(async () => {
+ await db.delete(users);
+ await db.insert(users).values({ id: USER });
+ await db.insert(messages).values({ content: 'Hello', id: MESSAGE, role: 'user', userId: USER });
+});
+
+describe('message translation routes answer their documented payloads', () => {
+ it('answers null before a translation exists', async () => {
+ const res = await request(`/${MESSAGE}`);
+ expect(res.status).toBe(200);
+ expect(MessageTranslationSchema.nullable().parse(await json(res))).toBeNull();
+ });
+
+ it('translates, edits, reads and deletes a translation', async () => {
+ const translated = await json(
+ await request(`/${MESSAGE}`, { body: { to: 'fr-FR' }, method: 'POST' }),
+ );
+ expect(MessageTranslationWriteSchema.parse(translated)).toEqual({
+ content: 'Bonjour',
+ id: MESSAGE,
+ to: 'fr-FR',
+ userId: USER,
+ });
+
+ const edited = await json(
+ await request(`/${MESSAGE}`, { body: { from: 'en-US', to: 'de-DE' }, method: 'PATCH' }),
+ );
+ expect(() => MessageTranslationWriteSchema.parse(edited)).not.toThrow();
+
+ const stored = await json(await request(`/${MESSAGE}`));
+ expect(MessageTranslationSchema.parse(stored)).toMatchObject({ id: MESSAGE, to: 'de-DE' });
+
+ const deleted = await request(`/${MESSAGE}`, { method: 'DELETE' });
+ expect(deleted.status).toBe(200);
+ expect(DeletedResourceSchema.parse(await json(deleted))).toEqual({
+ deleted: true,
+ id: MESSAGE,
+ });
+ expect((await request(`/${MESSAGE}`, { method: 'DELETE' })).status).toBe(404);
+ });
+});
diff --git a/packages/openapi/src/routes/message-translations.route.ts b/packages/openapi/src/routes/message-translations.route.ts
index 9a3cb6b5350..69502c47ffe 100644
--- a/packages/openapi/src/routes/message-translations.route.ts
+++ b/packages/openapi/src/routes/message-translations.route.ts
@@ -2,14 +2,18 @@ import { Hono } from 'hono';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { MessageTranslationController } from '../controllers';
import { requireAuth } from '../middleware';
import { requireAnyPermission, requireApiKeyScope } from '../middleware/permission-check';
+import { DeletedResourceSchema } from '../types/common.type';
import {
MessageTranslateInfoUpdateSchema,
MessageTranslateQueryRequestSchema,
MessageTranslateTriggerRequestSchema,
+ MessageTranslationSchema,
+ MessageTranslationWriteSchema,
} from '../types/message-translations.type';
// Message Translate related routes
@@ -18,6 +22,11 @@ const MessageTranslationRoutes = new Hono();
// POST /api/v1/message-translates - Translate specified message
MessageTranslationRoutes.post(
'/:messageId',
+ routeDoc({
+ data: MessageTranslationWriteSchema,
+ summary: 'Translate a message',
+ tags: ['message-translations'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('MESSAGE_READ'),
@@ -40,6 +49,12 @@ MessageTranslationRoutes.post(
// GET /api/v1/message-translates - Get translation info for specified message
MessageTranslationRoutes.get(
'/:messageId',
+ routeDoc({
+ data: MessageTranslationSchema.nullable(),
+ description: '`null` when the message has no stored translation.',
+ summary: "Get a message's translation",
+ tags: ['message-translations'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('MESSAGE_READ'),
@@ -59,6 +74,11 @@ MessageTranslationRoutes.get(
// PUT /api/v1/message-translates/:messageId - Update message translation info
MessageTranslationRoutes.patch(
'/:messageId',
+ routeDoc({
+ data: MessageTranslationWriteSchema,
+ summary: "Set a message's translation",
+ tags: ['message-translations'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('MESSAGE_UPDATE'),
@@ -79,6 +99,13 @@ MessageTranslationRoutes.patch(
// DELETE /api/v1/message-translates/:messageId - Delete message translation info
MessageTranslationRoutes.delete(
'/:messageId',
+ routeDoc({
+ data: DeletedResourceSchema,
+ description: '`id` is the id of the message whose translation was removed.',
+ errors: [404],
+ summary: "Delete a message's translation",
+ tags: ['message-translations'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('TRANSLATION_DELETE'),
diff --git a/packages/openapi/src/routes/messages.route.test.ts b/packages/openapi/src/routes/messages.route.test.ts
new file mode 100644
index 00000000000..6ab7664cdab
--- /dev/null
+++ b/packages/openapi/src/routes/messages.route.test.ts
@@ -0,0 +1,135 @@
+// @vitest-environment node
+import { Hono } from 'hono';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { getTestDB } from '@/database/core/getTestDB';
+import { files, messages, messagesFiles, sessions, topics, users } from '@/database/schemas';
+
+import { DeletedResourceSchema, DeletedResourcesSchema } from '../types/common.type';
+import { MessageCountSchema, MessageListSchema, MessageSchema } from '../types/message.type';
+
+const db = await getTestDB();
+
+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: async () => db }));
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = async () => true;
+ },
+}));
+vi.mock('../middleware/auth', () => ({
+ requireAuth: async (_c: any, next: any) => next(),
+}));
+vi.mock('@/server/services/file', () => ({
+ FileService: class {
+ getFullFileUrl = async (key: string) => `https://files.example.com/${key}`;
+ },
+}));
+
+const { default: MessageRoutes } = await import('./messages.route');
+
+const USER = 'message-route-user';
+const TOPIC = 'tpc_message_route';
+
+const request = (path: string, init: { body?: unknown; method?: string } = {}) => {
+ const app = new Hono();
+ app.use('*', async (c, next) => {
+ c.set('userId' as never, USER as never);
+ await next();
+ });
+ app.route('/', MessageRoutes);
+
+ return app.request(path, {
+ ...(init.body === undefined
+ ? {}
+ : { body: JSON.stringify(init.body), headers: { 'content-type': 'application/json' } }),
+ method: init.method ?? 'GET',
+ });
+};
+
+const json = async (res: Response) => ((await res.json()) as { data: any }).data;
+
+beforeEach(async () => {
+ await db.delete(users);
+ await db.insert(users).values({ id: USER });
+ await db.insert(sessions).values({ id: 'ssn_message_route', slug: 'route', userId: USER });
+ await db.insert(topics).values({ id: TOPIC, sessionId: 'ssn_message_route', userId: USER });
+ await db.insert(files).values({
+ fileType: 'image/png',
+ id: 'file_message_route',
+ name: 'a.png',
+ size: 3,
+ url: 'files/a.png',
+ userId: USER,
+ });
+ await db.insert(messages).values([
+ {
+ content: 'hello',
+ id: 'msg_route_1',
+ role: 'user',
+ sessionId: 'ssn_message_route',
+ topicId: TOPIC,
+ userId: USER,
+ },
+ { content: 'hi', id: 'msg_route_2', role: 'assistant', topicId: TOPIC, userId: USER },
+ ]);
+ await db
+ .insert(messagesFiles)
+ .values({ fileId: 'file_message_route', messageId: 'msg_route_1', userId: USER });
+});
+
+describe('message routes answer their documented payloads', () => {
+ it('GET /:id embeds files, session and topic', async () => {
+ const res = await request('/msg_route_1');
+ expect(res.status).toBe(200);
+
+ const message = await json(res);
+ expect(() => MessageSchema.parse(message)).not.toThrow();
+ expect(message.files.map((file: { url: string }) => file.url)).toEqual([
+ 'https://files.example.com/files/a.png',
+ ]);
+ expect(message.session.id).toBe('ssn_message_route');
+ expect(message.topic.id).toBe(TOPIC);
+ });
+
+ it('GET / and GET /count', async () => {
+ const list = await json(await request(`/?topicId=${TOPIC}`));
+ expect(() => MessageListSchema.parse(list)).not.toThrow();
+ expect(list.total).toBe(2);
+
+ const count = await json(await request(`/count?topicId=${TOPIC}`));
+ expect(MessageCountSchema.parse(count)).toEqual({ count: 2 });
+ });
+
+ it('POST / answers the stored message', async () => {
+ const res = await request('/', {
+ body: { content: 'new', role: 'user', topicId: TOPIC },
+ method: 'POST',
+ });
+ expect(res.status).toBe(200);
+ const message = await json(res);
+ expect(() => MessageSchema.parse(message)).not.toThrow();
+ });
+
+ it('DELETE /:id answers the deleted id', async () => {
+ const res = await request('/msg_route_2', { method: 'DELETE' });
+ expect(res.status).toBe(200);
+ expect(DeletedResourceSchema.parse(await json(res))).toEqual({
+ deleted: true,
+ id: 'msg_route_2',
+ });
+ });
+
+ it('DELETE /:id answers 404 for a message it did not delete', async () => {
+ const res = await request('/msg_missing', { method: 'DELETE' });
+ expect(res.status).toBe(404);
+ });
+
+ it('DELETE / counts only the messages it actually removed', async () => {
+ const res = await request('/', {
+ body: { messageIds: ['msg_route_1', 'msg_route_2', 'msg_missing'] },
+ method: 'DELETE',
+ });
+ expect(res.status).toBe(200);
+ expect(DeletedResourcesSchema.parse(await json(res))).toEqual({ count: 2, deleted: true });
+ });
+});
diff --git a/packages/openapi/src/routes/messages.route.ts b/packages/openapi/src/routes/messages.route.ts
index 18323a41615..0ca031c611d 100644
--- a/packages/openapi/src/routes/messages.route.ts
+++ b/packages/openapi/src/routes/messages.route.ts
@@ -2,12 +2,17 @@ import { Hono } from 'hono';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { MessageController } from '../controllers';
import { requireAuth } from '../middleware';
import { requireAnyPermission, requireApiKeyScope } from '../middleware/permission-check';
+import { DeletedResourceSchema, DeletedResourcesSchema } from '../types/common.type';
import {
+ MessageCountSchema,
MessageIdParamSchema,
+ MessageListSchema,
+ MessageSchema,
MessagesCountQuerySchema,
MessagesCreateRequestSchema,
MessagesCreateWithReplyRequestSchema,
@@ -21,6 +26,7 @@ const MessageRoutes = new Hono();
// GET /api/v1/messages/count - Get message count (supports various filter conditions)
MessageRoutes.get(
'/count',
+ routeDoc({ data: MessageCountSchema, summary: 'Count messages', tags: ['messages'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('MESSAGE_READ'),
@@ -36,6 +42,7 @@ MessageRoutes.get(
// GET /api/v1/messages - Get message list (supports various filters and search)
MessageRoutes.get(
'/',
+ routeDoc({ data: MessageListSchema, summary: 'List messages', tags: ['messages'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('MESSAGE_READ'),
@@ -51,6 +58,7 @@ MessageRoutes.get(
// GET /api/v1/messages/:id - Get message details by message ID (requires message read permission)
MessageRoutes.get(
'/:id',
+ routeDoc({ data: MessageSchema, errors: [404], summary: 'Get a message', tags: ['messages'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('MESSAGE_READ'),
@@ -66,6 +74,7 @@ MessageRoutes.get(
// POST /api/v1/messages - Create a new message (requires message write permission)
MessageRoutes.post(
'/',
+ routeDoc({ data: MessageSchema, summary: 'Create a message', tags: ['messages'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('MESSAGE_CREATE'),
@@ -83,6 +92,13 @@ MessageRoutes.post(
// Generating the reply invokes a model, so restricted API keys also need `model:invoke`
MessageRoutes.post(
'/replies',
+ routeDoc({
+ data: MessageSchema.nullable(),
+ description:
+ 'Stores the user message, then generates and stores the assistant reply. Answers with the reply; `null` only if it could not be read back.',
+ summary: 'Create a user message and generate an AI reply',
+ tags: ['messages'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('MESSAGE_CREATE'),
@@ -99,6 +115,12 @@ MessageRoutes.post(
// DELETE /api/v1/messages/:id - Delete a single message (requires message delete permission)
MessageRoutes.delete(
'/:id',
+ routeDoc({
+ data: DeletedResourceSchema,
+ errors: [404],
+ summary: 'Delete a message',
+ tags: ['messages'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('MESSAGE_DELETE'),
@@ -114,6 +136,13 @@ MessageRoutes.delete(
// DELETE /api/v1/messages - Batch delete messages (requires message delete permission)
MessageRoutes.delete(
'/',
+ routeDoc({
+ data: DeletedResourcesSchema,
+ description:
+ 'Best effort: ids the caller may not delete or that no longer exist are skipped. `count` is the number of messages actually removed.',
+ summary: 'Delete messages in batch',
+ tags: ['messages'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('MESSAGE_DELETE'),
diff --git a/packages/openapi/src/routes/models.route.test.ts b/packages/openapi/src/routes/models.route.test.ts
new file mode 100644
index 00000000000..2950a0a9367
--- /dev/null
+++ b/packages/openapi/src/routes/models.route.test.ts
@@ -0,0 +1,79 @@
+// @vitest-environment node
+import { Hono } from 'hono';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { getTestDB } from '@/database/core/getTestDB';
+import { aiModels, users } from '@/database/schemas';
+
+import { ModelListSchema, ModelSchema } from '../types/model.type';
+
+const db = await getTestDB();
+
+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: async () => db }));
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = async () => true;
+ },
+}));
+vi.mock('../middleware/auth', () => ({
+ requireAuth: async (_c: any, next: any) => next(),
+}));
+
+const { default: Routes } = await import('./models.route');
+
+const USER = 'model-route-user';
+
+const request = (path: string, init: { body?: unknown; method?: string } = {}) => {
+ const app = new Hono();
+ app.use('*', async (c, next) => {
+ c.set('userId' as never, USER as never);
+ await next();
+ });
+ app.route('/', Routes);
+
+ return app.request(path, {
+ ...(init.body === undefined
+ ? {}
+ : { body: JSON.stringify(init.body), headers: { 'content-type': 'application/json' } }),
+ method: init.method ?? 'GET',
+ });
+};
+
+const json = async (res: Response) => ((await res.json()) as { data: any }).data;
+
+beforeEach(async () => {
+ await db.delete(aiModels);
+ await db.delete(users);
+ await db.insert(users).values({ id: USER });
+});
+
+describe('model routes answer their documented payloads', () => {
+ it('creates, lists, reads and updates a model', async () => {
+ const created = await request('/', {
+ body: {
+ abilities: { vision: true },
+ displayName: 'My Model',
+ id: 'my-model',
+ providerId: 'my-provider',
+ type: 'stt',
+ },
+ method: 'POST',
+ });
+ expect(created.status).toBe(200);
+ expect(ModelSchema.parse(await json(created)).type).toBe('asr');
+
+ const list = await json(await request('/'));
+ expect(() => ModelListSchema.parse(list)).not.toThrow();
+ expect(list.total).toBe(1);
+
+ const detail = await json(await request('/my-provider/my-model'));
+ expect(() => ModelSchema.parse(detail)).not.toThrow();
+
+ const updated = await json(
+ await request('/my-provider/my-model', { body: { displayName: 'Renamed' }, method: 'PATCH' }),
+ );
+ expect(ModelSchema.parse(updated).displayName).toBe('Renamed');
+
+ expect((await request('/my-provider/missing')).status).toBe(404);
+ });
+});
diff --git a/packages/openapi/src/routes/models.route.ts b/packages/openapi/src/routes/models.route.ts
index c2d35060c45..75588050b4d 100644
--- a/packages/openapi/src/routes/models.route.ts
+++ b/packages/openapi/src/routes/models.route.ts
@@ -2,6 +2,7 @@ import { Hono } from 'hono';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { ModelController } from '../controllers';
import { requireAuth } from '../middleware';
@@ -9,6 +10,8 @@ import { requireAnyPermission } from '../middleware/permission-check';
import {
CreateModelRequestSchema,
ModelIdParamSchema,
+ ModelListSchema,
+ ModelSchema,
ModelsListQuerySchema,
UpdateModelRequestSchema,
} from '../types/model.type';
@@ -19,6 +22,7 @@ const ModelRoutes = new Hono();
// GET /api/v1/models - Get model list (supports pagination, filtering, and grouping)
ModelRoutes.get(
'/',
+ routeDoc({ data: ModelListSchema, summary: 'List models', tags: ['models'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AI_MODEL_READ'),
@@ -34,6 +38,7 @@ ModelRoutes.get(
// POST /api/v1/models - Create a model
ModelRoutes.post(
'/',
+ routeDoc({ data: ModelSchema, summary: 'Create a model', tags: ['models'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AI_MODEL_CREATE'),
@@ -49,6 +54,7 @@ ModelRoutes.post(
// GET /api/v1/models/:providerId/:modelId - Get model details
ModelRoutes.get(
'/:providerId/:modelId',
+ routeDoc({ data: ModelSchema, errors: [404], summary: 'Get a model', tags: ['models'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AI_MODEL_READ'),
@@ -64,6 +70,7 @@ ModelRoutes.get(
// PATCH /api/v1/models/:providerId/:modelId - Update a model
ModelRoutes.patch(
'/:providerId/:modelId',
+ routeDoc({ data: ModelSchema, errors: [404], summary: 'Update a model', tags: ['models'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AI_MODEL_UPDATE'),
diff --git a/packages/openapi/src/routes/notifications.route.ts b/packages/openapi/src/routes/notifications.route.ts
index 93250438741..f26cdcd56de 100644
--- a/packages/openapi/src/routes/notifications.route.ts
+++ b/packages/openapi/src/routes/notifications.route.ts
@@ -1,17 +1,23 @@
import { Hono, type MiddlewareHandler } from 'hono';
-import { describeRoute } from 'hono-openapi';
+import { z } from 'zod';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { NotificationController } from '../controllers/notification.controller';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermission, requireApiKeyScope } from '../middleware/permission-check';
import {
MarkNotificationsReadRequestSchema,
+ NotificationAcknowledgementSchema,
+ NotificationCategoryCountSchema,
NotificationIdParamSchema,
NotificationListQuerySchema,
+ NotificationSchema,
NotificationSettingsQuerySchema,
+ NotificationSettingsResponseSchema,
+ NotificationUnreadCountSchema,
UpdateNotificationSettingsRequestSchema,
} from '../types/notification.type';
@@ -37,6 +43,13 @@ const notificationWrite = requireAnyPermission(
/** GET /api/v1/notifications */
NotificationRoutes.get(
'/',
+ routeDoc({
+ data: z.array(NotificationSchema),
+ description:
+ 'Unarchived notifications, newest first; pass the last `id` as `cursor` for the next page.',
+ summary: 'List notifications',
+ tags: ['notifications'],
+ }),
requireAuth,
zValidator('query', NotificationListQuerySchema),
async (c) => new NotificationController().listNotifications(c),
@@ -52,7 +65,8 @@ const settingsApiKeyScope =
/** GET /api/v1/notifications/settings */
NotificationRoutes.get(
'/settings',
- describeRoute({
+ routeDoc({
+ data: NotificationSettingsResponseSchema,
operationId: 'getNotificationSettings',
summary: 'Get notification delivery settings',
tags: ['notifications'],
@@ -66,7 +80,9 @@ NotificationRoutes.get(
/** PATCH /api/v1/notifications/settings — merges the patch; untouched switches keep their value. */
NotificationRoutes.patch(
'/settings',
- describeRoute({
+ routeDoc({
+ data: NotificationSettingsResponseSchema,
+ description: 'Answers with the merged settings now stored for the scope.',
operationId: 'updateNotificationSettings',
summary: 'Update notification delivery settings',
tags: ['notifications'],
@@ -81,7 +97,8 @@ NotificationRoutes.patch(
/** GET /api/v1/notifications/unread-count */
NotificationRoutes.get(
'/unread-count',
- describeRoute({
+ routeDoc({
+ data: NotificationUnreadCountSchema,
operationId: 'getUnreadNotificationCount',
summary: 'Get the unread notification count',
tags: ['notifications'],
@@ -93,7 +110,8 @@ NotificationRoutes.get(
/** GET /api/v1/notifications/counts — per-category read/unread/total tallies. */
NotificationRoutes.get(
'/counts',
- describeRoute({
+ routeDoc({
+ data: z.array(NotificationCategoryCountSchema),
operationId: 'getNotificationCounts',
summary: 'Get per-category notification counts',
tags: ['notifications'],
@@ -105,7 +123,14 @@ NotificationRoutes.get(
/** POST /api/v1/notifications/read */
NotificationRoutes.post(
'/read',
- describeRoute({ operationId: 'markNotificationsRead', tags: ['notifications'] }),
+ routeDoc({
+ data: NotificationAcknowledgementSchema,
+ // Nothing to report back: the body is the success envelope without `data`.
+ envelope: false,
+ operationId: 'markNotificationsRead',
+ summary: 'Mark notifications as read',
+ tags: ['notifications'],
+ }),
requireAuth,
notificationWrite,
zValidator('json', MarkNotificationsReadRequestSchema),
@@ -115,7 +140,10 @@ NotificationRoutes.post(
/** POST /api/v1/notifications/read-all */
NotificationRoutes.post(
'/read-all',
- describeRoute({
+ routeDoc({
+ data: NotificationAcknowledgementSchema,
+ // Nothing to report back: the body is the success envelope without `data`.
+ envelope: false,
operationId: 'markAllNotificationsRead',
summary: 'Mark every notification as read',
tags: ['notifications'],
@@ -128,7 +156,10 @@ NotificationRoutes.post(
/** POST /api/v1/notifications/archive-all */
NotificationRoutes.post(
'/archive-all',
- describeRoute({
+ routeDoc({
+ data: NotificationAcknowledgementSchema,
+ // Nothing to report back: the body is the success envelope without `data`.
+ envelope: false,
operationId: 'archiveAllNotifications',
summary: 'Archive every notification',
tags: ['notifications'],
@@ -141,7 +172,14 @@ NotificationRoutes.post(
/** POST /api/v1/notifications/:id/archive */
NotificationRoutes.post(
'/:id/archive',
- describeRoute({ operationId: 'archiveNotification', tags: ['notifications'] }),
+ routeDoc({
+ data: NotificationAcknowledgementSchema,
+ // Nothing to report back: the body is the success envelope without `data`.
+ envelope: false,
+ operationId: 'archiveNotification',
+ summary: 'Archive a notification',
+ tags: ['notifications'],
+ }),
requireAuth,
notificationWrite,
zValidator('param', NotificationIdParamSchema),
diff --git a/packages/openapi/src/routes/permissions.route.ts b/packages/openapi/src/routes/permissions.route.ts
index d997e9dbeec..03575e47009 100644
--- a/packages/openapi/src/routes/permissions.route.ts
+++ b/packages/openapi/src/routes/permissions.route.ts
@@ -2,13 +2,17 @@ import { Hono } from 'hono';
import { getScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { PermissionController } from '../controllers/permission.controller';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermission } from '../middleware/permission-check';
+import { DeletedResourceSchema } from '../types/common.type';
import {
CreatePermissionRequestSchema,
PermissionIdParamSchema,
+ PermissionListSchema,
+ PermissionSchema,
PermissionsListQuerySchema,
UpdatePermissionRequestSchema,
} from '../types/permission.type';
@@ -21,6 +25,7 @@ const PermissionsRoutes = new Hono();
*/
PermissionsRoutes.get(
'/',
+ routeDoc({ data: PermissionListSchema, summary: 'List permissions', tags: ['permissions'] }),
requireAuth,
requireAnyPermission(
getScopePermissions('RBAC_PERMISSION_READ', ['ALL']),
@@ -40,6 +45,12 @@ PermissionsRoutes.get(
*/
PermissionsRoutes.get(
'/:id',
+ routeDoc({
+ data: PermissionSchema,
+ errors: [404],
+ summary: 'Get a permission',
+ tags: ['permissions'],
+ }),
requireAuth,
requireAnyPermission(
getScopePermissions('RBAC_PERMISSION_READ', ['ALL']),
@@ -59,6 +70,7 @@ PermissionsRoutes.get(
*/
PermissionsRoutes.post(
'/',
+ routeDoc({ data: PermissionSchema, summary: 'Create a permission', tags: ['permissions'] }),
requireAuth,
requireAnyPermission(
getScopePermissions('RBAC_PERMISSION_CREATE', ['ALL']),
@@ -78,6 +90,12 @@ PermissionsRoutes.post(
*/
PermissionsRoutes.patch(
'/:id',
+ routeDoc({
+ data: PermissionSchema,
+ errors: [404],
+ summary: 'Update a permission',
+ tags: ['permissions'],
+ }),
requireAuth,
requireAnyPermission(
getScopePermissions('RBAC_PERMISSION_UPDATE', ['ALL']),
@@ -98,6 +116,12 @@ PermissionsRoutes.patch(
*/
PermissionsRoutes.delete(
'/:id',
+ routeDoc({
+ data: DeletedResourceSchema,
+ errors: [404],
+ summary: 'Delete a permission',
+ tags: ['permissions'],
+ }),
requireAuth,
requireAnyPermission(
getScopePermissions('RBAC_PERMISSION_DELETE', ['ALL']),
diff --git a/packages/openapi/src/routes/plugins.route.ts b/packages/openapi/src/routes/plugins.route.ts
index ab00c13b7e1..73abca57a5a 100644
--- a/packages/openapi/src/routes/plugins.route.ts
+++ b/packages/openapi/src/routes/plugins.route.ts
@@ -1,18 +1,20 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { EvalContextController } from '../controllers/eval-context.controller';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermission } from '../middleware/permission-check';
import { EvalPaginationSchema } from '../types/eval-resource.type';
+import { InstalledPluginListSchema } from '../types/plugin.type';
export const PluginsRoutes = new Hono();
PluginsRoutes.get(
'/',
- describeRoute({
+ routeDoc({
+ data: InstalledPluginListSchema,
summary: 'List installed plugins in the current workspace or personal scope',
tags: ['plugins'],
}),
diff --git a/packages/openapi/src/routes/providers.route.test.ts b/packages/openapi/src/routes/providers.route.test.ts
new file mode 100644
index 00000000000..acda28e8c31
--- /dev/null
+++ b/packages/openapi/src/routes/providers.route.test.ts
@@ -0,0 +1,80 @@
+// @vitest-environment node
+import { Hono } from 'hono';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { getTestDB } from '@/database/core/getTestDB';
+import { aiProviders, users } from '@/database/schemas';
+
+import { DeletedResourceSchema } from '../types/common.type';
+import { ProviderListSchema, ProviderSchema } from '../types/provider.type';
+
+const db = await getTestDB();
+
+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: async () => db }));
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = async () => true;
+ },
+}));
+vi.mock('../middleware/auth', () => ({
+ requireAuth: async (_c: any, next: any) => next(),
+}));
+
+const { default: Routes } = await import('./providers.route');
+
+const USER = 'provider-route-user';
+
+const request = (path: string, init: { body?: unknown; method?: string } = {}) => {
+ const app = new Hono();
+ app.use('*', async (c, next) => {
+ c.set('userId' as never, USER as never);
+ await next();
+ });
+ app.route('/', Routes);
+
+ return app.request(path, {
+ ...(init.body === undefined
+ ? {}
+ : { body: JSON.stringify(init.body), headers: { 'content-type': 'application/json' } }),
+ method: init.method ?? 'GET',
+ });
+};
+
+const json = async (res: Response) => ((await res.json()) as { data: any }).data;
+
+beforeEach(async () => {
+ await db.delete(aiProviders);
+ await db.delete(users);
+ await db.insert(users).values({ id: USER });
+});
+
+describe('provider routes answer their documented payloads', () => {
+ it('creates, lists, reads, updates and deletes a provider', async () => {
+ const created = await request('/', {
+ body: { id: 'my-provider', name: 'Mine', settings: { sdkType: 'openai' } },
+ method: 'POST',
+ });
+ expect(created.status).toBe(200);
+ expect(ProviderSchema.parse(await json(created)).id).toBe('my-provider');
+
+ const list = await json(await request('/'));
+ expect(() => ProviderListSchema.parse(list)).not.toThrow();
+ expect(list.total).toBe(1);
+
+ const detail = await json(await request('/my-provider'));
+ expect(ProviderSchema.parse(detail).source).toBe('custom');
+
+ const updated = await json(
+ await request('/my-provider', { body: { name: 'Renamed' }, method: 'PATCH' }),
+ );
+ expect(ProviderSchema.parse(updated).name).toBe('Renamed');
+
+ const deleted = await request('/my-provider', { method: 'DELETE' });
+ expect(deleted.status).toBe(200);
+ expect(DeletedResourceSchema.parse(await json(deleted))).toEqual({
+ deleted: true,
+ id: 'my-provider',
+ });
+ expect((await request('/my-provider', { method: 'DELETE' })).status).toBe(404);
+ });
+});
diff --git a/packages/openapi/src/routes/providers.route.ts b/packages/openapi/src/routes/providers.route.ts
index fbf8ca8ec8c..9f24c88d81e 100644
--- a/packages/openapi/src/routes/providers.route.ts
+++ b/packages/openapi/src/routes/providers.route.ts
@@ -2,14 +2,18 @@ import { Hono } from 'hono';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { ProviderController } from '../controllers/provider.controller';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermission } from '../middleware/permission-check';
+import { DeletedResourceSchema } from '../types/common.type';
import {
CreateProviderRequestSchema,
ProviderIdParamSchema,
ProviderListQuerySchema,
+ ProviderListSchema,
+ ProviderSchema,
UpdateProviderRequestSchema,
} from '../types/provider.type';
@@ -17,6 +21,7 @@ const ProviderRoutes = new Hono();
ProviderRoutes.get(
'/',
+ routeDoc({ data: ProviderListSchema, summary: 'List providers', tags: ['providers'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AI_PROVIDER_READ'),
@@ -31,6 +36,7 @@ ProviderRoutes.get(
ProviderRoutes.get(
'/:id',
+ routeDoc({ data: ProviderSchema, errors: [404], summary: 'Get a provider', tags: ['providers'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AI_PROVIDER_READ'),
@@ -45,6 +51,7 @@ ProviderRoutes.get(
ProviderRoutes.post(
'/',
+ routeDoc({ data: ProviderSchema, summary: 'Create a provider', tags: ['providers'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AI_PROVIDER_CREATE'),
@@ -59,6 +66,12 @@ ProviderRoutes.post(
ProviderRoutes.patch(
'/:id',
+ routeDoc({
+ data: ProviderSchema,
+ errors: [404],
+ summary: 'Update a provider',
+ tags: ['providers'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AI_PROVIDER_UPDATE'),
@@ -74,6 +87,13 @@ ProviderRoutes.patch(
ProviderRoutes.delete(
'/:id',
+ routeDoc({
+ data: DeletedResourceSchema,
+ description: 'Also removes the models configured under the provider.',
+ errors: [404],
+ summary: 'Delete a provider',
+ tags: ['providers'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('AI_PROVIDER_DELETE'),
diff --git a/packages/openapi/src/routes/push-tokens.route.test.ts b/packages/openapi/src/routes/push-tokens.route.test.ts
new file mode 100644
index 00000000000..cbc0faaf792
--- /dev/null
+++ b/packages/openapi/src/routes/push-tokens.route.test.ts
@@ -0,0 +1,70 @@
+// @vitest-environment node
+import { Hono } from 'hono';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { getTestDB } from '@/database/core/getTestDB';
+import { pushTokens, users } from '@/database/schemas';
+
+import { DeletedResourceSchema } from '../types/common.type';
+import { PushTokenRegistrationSchema } from '../types/im.type';
+
+const db = await getTestDB();
+
+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: async () => db }));
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = async () => true;
+ },
+}));
+vi.mock('../middleware/auth', () => ({
+ requireAuth: async (_c: any, next: any) => next(),
+}));
+
+const { default: Routes } = await import('./push-tokens.route');
+
+const USER = 'push-token-route-user';
+
+const request = (path: string, init: { body?: unknown; method?: string } = {}) => {
+ const app = new Hono();
+ app.use('*', async (c, next) => {
+ c.set('userId' as never, USER as never);
+ await next();
+ });
+ app.route('/', Routes);
+
+ return app.request(path, {
+ ...(init.body === undefined
+ ? {}
+ : { body: JSON.stringify(init.body), headers: { 'content-type': 'application/json' } }),
+ method: init.method ?? 'GET',
+ });
+};
+
+const json = async (res: Response) => ((await res.json()) as { data: any }).data;
+
+beforeEach(async () => {
+ await db.delete(users);
+ await db.insert(users).values({ id: USER });
+});
+
+describe('push token routes answer their documented payloads', () => {
+ it('registers a device, then unregisters it with the device id', async () => {
+ const registered = await request('/device-1', {
+ body: { expoToken: 'ExponentPushToken[aaa]', platform: 'android' },
+ method: 'PUT',
+ });
+ expect(registered.status).toBe(200);
+ expect(PushTokenRegistrationSchema.parse(await json(registered))).toEqual({
+ deviceId: 'device-1',
+ platform: 'android',
+ });
+
+ const deleted = await request('/device-1', { method: 'DELETE' });
+ expect(deleted.status).toBe(200);
+ expect(DeletedResourceSchema.parse(await json(deleted))).toEqual({
+ deleted: true,
+ id: 'device-1',
+ });
+ expect(await db.select().from(pushTokens)).toEqual([]);
+ });
+});
diff --git a/packages/openapi/src/routes/push-tokens.route.ts b/packages/openapi/src/routes/push-tokens.route.ts
index 7be64ed8c1e..d52e2fc20e5 100644
--- a/packages/openapi/src/routes/push-tokens.route.ts
+++ b/packages/openapi/src/routes/push-tokens.route.ts
@@ -1,13 +1,15 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { ImController } from '../controllers/im.controller';
import { requireAuth } from '../middleware/auth';
import { requireApiKeyScope } from '../middleware/permission-check';
+import { DeletedResourceSchema } from '../types/common.type';
import {
PushTokenParamSchema,
PushTokenRegisterRequestSchema,
+ PushTokenRegistrationSchema,
PushTokenUnregisterQuerySchema,
} from '../types/im.type';
@@ -28,7 +30,8 @@ const pushScope = requireApiKeyScope('chat:read');
/** PUT /api/v1/push-tokens/:deviceId */
PushTokenRoutes.put(
'/:deviceId',
- describeRoute({
+ routeDoc({
+ data: PushTokenRegistrationSchema,
operationId: 'registerPushToken',
summary: "Register or rotate this device's push token",
tags: ['push-tokens'],
@@ -43,7 +46,10 @@ PushTokenRoutes.put(
/** DELETE /api/v1/push-tokens/:deviceId */
PushTokenRoutes.delete(
'/:deviceId',
- describeRoute({
+ routeDoc({
+ data: DeletedResourceSchema,
+ description:
+ '`id` is the device id. Idempotent: a stale `expoToken` removes nothing and leaves the rotated registration in place.',
operationId: 'unregisterPushToken',
summary: 'Stop pushing to this device (sign-out)',
tags: ['push-tokens'],
diff --git a/packages/openapi/src/routes/responses.route.test.ts b/packages/openapi/src/routes/responses.route.test.ts
new file mode 100644
index 00000000000..030148a133f
--- /dev/null
+++ b/packages/openapi/src/routes/responses.route.test.ts
@@ -0,0 +1,94 @@
+import { Hono } from 'hono';
+import { describe, expect, it, vi } from 'vitest';
+
+import { ResponseObjectSchema } from '../types/responses.type';
+
+const { createResponseMock } = vi.hoisted(() => ({ createResponseMock: vi.fn() }));
+
+// The route and the real controller run; only the db, auth and the responses
+// service behind the controller are stubbed.
+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: vi.fn() }));
+vi.mock('../middleware/auth', () => ({
+ requireAuth: async (_c: any, next: any) => next(),
+}));
+vi.mock('../services/responses.service', () => ({
+ ResponsesService: class {
+ createResponse = createResponseMock;
+ },
+}));
+
+const { default: ResponsesRoutes } = await import('./responses.route');
+
+const responseObject = {
+ background: false,
+ completed_at: 1_700_000_001,
+ created_at: 1_700_000_000,
+ error: null,
+ frequency_penalty: 0,
+ id: 'tpc_1',
+ incomplete_details: null,
+ instructions: null,
+ max_output_tokens: null,
+ max_tool_calls: null,
+ metadata: {},
+ model: 'agt_1',
+ object: 'response',
+ output: [
+ {
+ content: [{ annotations: [], logprobs: [], text: 'Hi', type: 'output_text' }],
+ id: 'msg_tpc_1_0',
+ role: 'assistant',
+ status: 'completed',
+ type: 'message',
+ },
+ ],
+ output_text: 'Hi',
+ parallel_tool_calls: true,
+ presence_penalty: 0,
+ previous_response_id: null,
+ prompt_cache_key: null,
+ reasoning: null,
+ safety_identifier: null,
+ service_tier: 'default',
+ status: 'completed',
+ store: true,
+ temperature: 1,
+ text: { format: { type: 'text' } },
+ tool_choice: 'auto',
+ tools: [],
+ top_logprobs: 0,
+ top_p: 1,
+ truncation: 'disabled',
+ usage: {
+ input_tokens: 1,
+ input_tokens_details: { cached_tokens: 0 },
+ output_tokens: 1,
+ output_tokens_details: { reasoning_tokens: 0 },
+ total_tokens: 2,
+ },
+ user: null,
+};
+
+describe('POST /responses', () => {
+ it('answers with the bare response object, not the success envelope', async () => {
+ createResponseMock.mockResolvedValue(responseObject);
+ const app = new Hono();
+ app.use('*', async (c, next) => {
+ c.set('userId' as never, 'user-1' as never);
+ c.set('authType' as never, 'oidc' as never);
+ await next();
+ });
+ app.route('/', ResponsesRoutes);
+
+ const res = await app.request('/', {
+ body: JSON.stringify({ input: 'hi', model: 'agt_1' }),
+ headers: { 'content-type': 'application/json' },
+ method: 'POST',
+ });
+ const body = await res.json();
+
+ expect(res.status).toBe(200);
+ expect(body).not.toHaveProperty('success');
+ expect(() => ResponseObjectSchema.parse(body)).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/routes/responses.route.ts b/packages/openapi/src/routes/responses.route.ts
index 31e771506cb..98f9ce09d20 100644
--- a/packages/openapi/src/routes/responses.route.ts
+++ b/packages/openapi/src/routes/responses.route.ts
@@ -1,10 +1,11 @@
import { Hono } from 'hono';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { ResponsesController } from '../controllers/responses.controller';
import { requireAuth } from '../middleware/auth';
import { requireApiKeyScope } from '../middleware/permission-check';
-import { CreateResponseRequestSchema } from '../types/responses.type';
+import { CreateResponseRequestSchema, ResponseObjectSchema } from '../types/responses.type';
const ResponsesRoutes = new Hono();
@@ -19,6 +20,16 @@ const ResponsesRoutes = new Hono();
*/
ResponsesRoutes.post(
'/',
+ routeDoc({
+ data: ResponseObjectSchema,
+ description:
+ 'OpenResponses-compatible: `model` takes an agent id. Without `stream` the response object is the whole JSON body (no success envelope); a run that fails still answers 200 with `status: "failed"` and `error`. With `stream: true` the same object arrives through `response.*` server-sent events.',
+ // The handler answers `c.json(response)` directly, not `this.success(...)`.
+ envelope: false,
+ streamContent: { 'text/event-stream': { schema: { type: 'string' } } },
+ summary: 'Create a model response',
+ tags: ['responses'],
+ }),
requireAuth,
requireApiKeyScope('model:invoke'),
requireApiKeyScope('chat:write'),
diff --git a/packages/openapi/src/routes/roles.route.ts b/packages/openapi/src/routes/roles.route.ts
index 17e6190559e..c9c1ca500b5 100644
--- a/packages/openapi/src/routes/roles.route.ts
+++ b/packages/openapi/src/routes/roles.route.ts
@@ -2,14 +2,20 @@ import { Hono } from 'hono';
import { getScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { RoleController } from '../controllers/role.controller';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermission } from '../middleware/permission-check';
+import { DeletedResourceSchema, DeletedResourcesSchema } from '../types/common.type';
import {
CreateRoleRequestSchema,
RoleIdParamSchema,
+ RoleListSchema,
+ RolePermissionListSchema,
RolePermissionsListQuerySchema,
+ RolePermissionsUpdateResultSchema,
+ RoleSchema,
RolesListQuerySchema,
UpdateRolePermissionsRequestSchema,
UpdateRoleRequestSchema,
@@ -24,6 +30,7 @@ const RolesRoutes = new Hono();
*/
RolesRoutes.get(
'/',
+ routeDoc({ data: RoleListSchema, summary: 'List roles', tags: ['roles'] }),
requireAuth,
requireAnyPermission(
getScopePermissions('RBAC_ROLE_READ', ['ALL']),
@@ -43,6 +50,7 @@ RolesRoutes.get(
*/
RolesRoutes.post(
'/',
+ routeDoc({ data: RoleSchema, summary: 'Create a role', tags: ['roles'] }),
requireAuth,
requireAnyPermission(
getScopePermissions('RBAC_ROLE_CREATE', ['ALL']),
@@ -63,6 +71,7 @@ RolesRoutes.post(
*/
RolesRoutes.get(
'/:id',
+ routeDoc({ data: RoleSchema, errors: [404], summary: 'Get a role', tags: ['roles'] }),
requireAuth,
requireAnyPermission(
getScopePermissions('RBAC_ROLE_READ', ['ALL']),
@@ -82,6 +91,11 @@ RolesRoutes.get(
*/
RolesRoutes.get(
'/:id/permissions',
+ routeDoc({
+ data: RolePermissionListSchema,
+ summary: "List a role's permissions",
+ tags: ['roles'],
+ }),
requireAuth,
requireAnyPermission(
getScopePermissions('RBAC_ROLE_READ', ['ALL']),
@@ -102,6 +116,13 @@ RolesRoutes.get(
*/
RolesRoutes.patch(
'/:id/permissions',
+ routeDoc({
+ data: RolePermissionsUpdateResultSchema,
+ description: 'Grants and revokes permissions by id; returns how many mappings changed.',
+ errors: [404],
+ summary: "Update a role's permissions",
+ tags: ['roles'],
+ }),
requireAuth,
requireAnyPermission(
getScopePermissions('RBAC_ROLE_UPDATE', ['ALL']),
@@ -122,6 +143,13 @@ RolesRoutes.patch(
*/
RolesRoutes.delete(
'/:id/permissions',
+ routeDoc({
+ data: DeletedResourcesSchema,
+ description: '`count` is the number of permission mappings removed.',
+ errors: [404],
+ summary: "Clear a role's permissions",
+ tags: ['roles'],
+ }),
requireAuth,
requireAnyPermission(
getScopePermissions('RBAC_ROLE_UPDATE', ['ALL']),
@@ -142,6 +170,7 @@ RolesRoutes.delete(
*/
RolesRoutes.patch(
'/:id',
+ routeDoc({ data: RoleSchema, errors: [404], summary: 'Update a role', tags: ['roles'] }),
requireAuth,
requireAnyPermission(
getScopePermissions('RBAC_ROLE_UPDATE', ['ALL']),
@@ -162,6 +191,12 @@ RolesRoutes.patch(
*/
RolesRoutes.delete(
'/:id',
+ routeDoc({
+ data: DeletedResourceSchema,
+ errors: [404],
+ summary: 'Delete a role',
+ tags: ['roles'],
+ }),
requireAuth,
requireAnyPermission(
getScopePermissions('RBAC_ROLE_DELETE', ['ALL']),
diff --git a/packages/openapi/src/routes/signals.route.ts b/packages/openapi/src/routes/signals.route.ts
index ba5d66dca2e..9d1fce4c9d3 100644
--- a/packages/openapi/src/routes/signals.route.ts
+++ b/packages/openapi/src/routes/signals.route.ts
@@ -1,8 +1,8 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { AgentSignalController } from '../controllers/agent-signal.controller';
import { requireAuth } from '../middleware/auth';
@@ -11,6 +11,8 @@ import {
requireApiKeyScope,
} from '../middleware/permission-check';
import {
+ AgentSignalEmissionSchema,
+ AgentSignalReceiptListSchema,
EmitSourceEventRequestSchema,
ListReceiptsQuerySchema,
TriggerSourceEventRequestSchema,
@@ -44,7 +46,15 @@ const signalRead = requireApiKeyScope('agent:read');
/** POST /api/v1/signals/source-events — emit a client-side event. */
AgentSignalRoutes.post(
'/source-events',
- describeRoute({ operationId: 'emitSourceEvent', tags: ['signals'] }),
+ routeDoc({
+ data: AgentSignalEmissionSchema,
+ // 404: the agent named in the payload is not usable by the caller.
+ errors: [404],
+ operationId: 'emitSourceEvent',
+ status: 202,
+ summary: 'Emit an agent signal source event',
+ tags: ['signals'],
+ }),
requireAuth,
signalWrite,
signalRun,
@@ -55,7 +65,16 @@ AgentSignalRoutes.post(
/** POST /api/v1/signals/trigger — synthesise and enqueue a trigger event. */
AgentSignalRoutes.post(
'/trigger',
- describeRoute({ operationId: 'triggerSourceEvent', tags: ['signals'] }),
+ routeDoc({
+ data: AgentSignalEmissionSchema,
+ // 404: the target agent is not usable by the caller; 429: the hourly
+ // manual-trigger budget is spent.
+ errors: [404, 429],
+ operationId: 'triggerSourceEvent',
+ status: 202,
+ summary: 'Trigger a synthesized agent signal source event',
+ tags: ['signals'],
+ }),
requireAuth,
signalWrite,
signalRun,
@@ -66,7 +85,12 @@ AgentSignalRoutes.post(
/** GET /api/v1/signals/receipts — processed-event receipts for a topic. */
AgentSignalRoutes.get(
'/receipts',
- describeRoute({ operationId: 'listSignalReceipts', tags: ['signals'] }),
+ routeDoc({
+ data: AgentSignalReceiptListSchema,
+ operationId: 'listSignalReceipts',
+ summary: 'List agent signal receipts for a topic',
+ tags: ['signals'],
+ }),
requireAuth,
signalRead,
zValidator('query', ListReceiptsQuerySchema),
diff --git a/packages/openapi/src/routes/tasks.route.ts b/packages/openapi/src/routes/tasks.route.ts
index daf08bed77c..3dc44393ee0 100644
--- a/packages/openapi/src/routes/tasks.route.ts
+++ b/packages/openapi/src/routes/tasks.route.ts
@@ -1,17 +1,26 @@
import { Hono } from 'hono';
+import { z } from 'zod';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { TaskController } from '../controllers/task.controller';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermission } from '../middleware/permission-check';
+import { DeletedResourceSchema } from '../types/common.type';
import {
CreateTaskRequestSchema,
RunTaskRequestSchema,
+ TaskDetailSchema,
TaskIdParamSchema,
TaskListQuerySchema,
+ TaskListResponseSchema,
TaskRunListQuerySchema,
+ TaskRunSchema,
+ TaskRunStartedSchema,
+ TaskSchema,
+ TaskStatusUpdateResultSchema,
UpdateTaskRequestSchema,
UpdateTaskStatusRequestSchema,
} from '../types/task.type';
@@ -35,13 +44,27 @@ const taskWrite = requireAnyPermission(
);
/** GET /api/v1/tasks */
-TaskRoutes.get('/', requireAuth, taskRead, zValidator('query', TaskListQuerySchema), async (c) =>
- new TaskController().listTasks(c),
+TaskRoutes.get(
+ '/',
+ routeDoc({ data: TaskListResponseSchema, summary: 'List tasks', tags: ['tasks'] }),
+ requireAuth,
+ taskRead,
+ zValidator('query', TaskListQuerySchema),
+ async (c) => new TaskController().listTasks(c),
);
/** POST /api/v1/tasks */
TaskRoutes.post(
'/',
+ routeDoc({
+ data: TaskSchema,
+ // 404: the parent task or assignee agent does not exist; 412: a precise
+ // schedule the plan does not allow.
+ errors: [404, 412],
+ status: 201,
+ summary: 'Create a task',
+ tags: ['tasks'],
+ }),
requireAuth,
taskWrite,
zValidator('json', CreateTaskRequestSchema),
@@ -49,13 +72,26 @@ TaskRoutes.post(
);
/** GET /api/v1/tasks/:id */
-TaskRoutes.get('/:id', requireAuth, taskRead, zValidator('param', TaskIdParamSchema), async (c) =>
- new TaskController().getTask(c),
+TaskRoutes.get(
+ '/:id',
+ routeDoc({ data: TaskDetailSchema, errors: [404], summary: 'Get a task', tags: ['tasks'] }),
+ requireAuth,
+ taskRead,
+ zValidator('param', TaskIdParamSchema),
+ async (c) => new TaskController().getTask(c),
);
/** PATCH /api/v1/tasks/:id */
TaskRoutes.patch(
'/:id',
+ routeDoc({
+ data: TaskSchema,
+ // 409: the assignee is being changed concurrently; 412: a precise schedule
+ // the plan does not allow.
+ errors: [404, 409, 412],
+ summary: 'Update a task',
+ tags: ['tasks'],
+ }),
requireAuth,
taskWrite,
zValidator('param', TaskIdParamSchema),
@@ -66,6 +102,13 @@ TaskRoutes.patch(
/** PATCH /api/v1/tasks/:id/status */
TaskRoutes.patch(
'/:id/status',
+ routeDoc({
+ data: TaskStatusUpdateResultSchema,
+ // 409: the running operation could not be confirmed stopped.
+ errors: [404, 409],
+ summary: 'Change a task status',
+ tags: ['tasks'],
+ }),
requireAuth,
taskWrite,
zValidator('param', TaskIdParamSchema),
@@ -76,6 +119,17 @@ TaskRoutes.patch(
/** POST /api/v1/tasks/:id/runs — start a run now, the API twin of the in-app "Run now". */
TaskRoutes.post(
'/:id/runs',
+ routeDoc({
+ data: TaskRunStartedSchema,
+ description:
+ 'Starts the run and answers once the agent operation is accepted; follow it with `operationId`.',
+ // 409: the task is already running or changed while starting; 412: an
+ // archived task must be restored before it runs.
+ errors: [404, 409, 412],
+ status: 202,
+ summary: 'Run a task now',
+ tags: ['tasks'],
+ }),
requireAuth,
taskWrite,
zValidator('param', TaskIdParamSchema),
@@ -86,6 +140,12 @@ TaskRoutes.post(
/** GET /api/v1/tasks/:id/runs — past runs, newest first, each with its handoff result. */
TaskRoutes.get(
'/:id/runs',
+ routeDoc({
+ data: z.array(TaskRunSchema),
+ errors: [404],
+ summary: 'List past runs of a task',
+ tags: ['tasks'],
+ }),
requireAuth,
taskRead,
zValidator('param', TaskIdParamSchema),
@@ -96,6 +156,13 @@ TaskRoutes.get(
/** DELETE /api/v1/tasks/:id */
TaskRoutes.delete(
'/:id',
+ routeDoc({
+ data: DeletedResourceSchema,
+ // 409: a live run could not be stopped before the delete.
+ errors: [404, 409],
+ summary: 'Delete a task',
+ tags: ['tasks'],
+ }),
requireAuth,
taskWrite,
zValidator('param', TaskIdParamSchema),
diff --git a/packages/openapi/src/routes/topics.route.test.ts b/packages/openapi/src/routes/topics.route.test.ts
new file mode 100644
index 00000000000..fe4542b1ca6
--- /dev/null
+++ b/packages/openapi/src/routes/topics.route.test.ts
@@ -0,0 +1,101 @@
+// @vitest-environment node
+import { Hono } from 'hono';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { getTestDB } from '@/database/core/getTestDB';
+import { messages, threads, topics, users } from '@/database/schemas';
+
+import { DeletedResourceSchema } from '../types/common.type';
+import { TopicListSchema, TopicSchema, TopicThreadListSchema } from '../types/topic.type';
+
+const db = await getTestDB();
+
+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: async () => db }));
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = async () => true;
+ },
+}));
+vi.mock('../middleware/auth', () => ({
+ requireAuth: async (_c: any, next: any) => next(),
+}));
+
+const { default: TopicRoutes } = await import('./topics.route');
+
+const USER = 'topic-route-user';
+const TOPIC = 'tpc_topic_route';
+
+const request = (path: string, init: { body?: unknown; method?: string } = {}) => {
+ const app = new Hono();
+ app.use('*', async (c, next) => {
+ c.set('userId' as never, USER as never);
+ await next();
+ });
+ app.route('/', TopicRoutes);
+
+ return app.request(path, {
+ ...(init.body === undefined
+ ? {}
+ : { body: JSON.stringify(init.body), headers: { 'content-type': 'application/json' } }),
+ method: init.method ?? 'GET',
+ });
+};
+
+const json = async (res: Response) => ((await res.json()) as { data: any }).data;
+
+beforeEach(async () => {
+ await db.delete(users);
+ await db.insert(users).values({ email: '[email protected]', id: USER });
+ await db.insert(topics).values({
+ id: TOPIC,
+ metadata: { model: 'gpt-x' },
+ status: 'active',
+ title: 'Route topic',
+ totalCost: 0.25,
+ userId: USER,
+ });
+ await db
+ .insert(messages)
+ .values({ content: 'hi', id: 'msg_topic_route', role: 'user', topicId: TOPIC, userId: USER });
+ await db
+ .insert(threads)
+ .values({ id: 'thd_topic_route', topicId: TOPIC, type: 'standalone', userId: USER });
+});
+
+describe('topic routes answer their documented payloads', () => {
+ it('GET / and GET /:id carry the message count and the owner', async () => {
+ const list = await json(await request('/'));
+ expect(() => TopicListSchema.parse(list)).not.toThrow();
+ expect(list.total).toBe(1);
+
+ const res = await request(`/${TOPIC}`);
+ expect(res.status).toBe(200);
+ const topic = await json(res);
+ expect(() => TopicSchema.parse(topic)).not.toThrow();
+ expect(topic).toMatchObject({ messageCount: 1, totalCost: 0.25, user: { id: USER } });
+ });
+
+ it('POST / and PATCH /:id answer the whole topic', async () => {
+ const created = await json(await request('/', { body: { title: 'New' }, method: 'POST' }));
+ expect(() => TopicSchema.parse(created)).not.toThrow();
+
+ const updated = await json(
+ await request(`/${created.id}`, { body: { title: 'Renamed' }, method: 'PATCH' }),
+ );
+ expect(TopicSchema.parse(updated).title).toBe('Renamed');
+ });
+
+ it('GET /:topicId/threads', async () => {
+ const page = await json(await request(`/${TOPIC}/threads`));
+ expect(() => TopicThreadListSchema.parse(page)).not.toThrow();
+ expect(page.total).toBe(1);
+ });
+
+ it('DELETE /:id answers the deleted id, then 404s', async () => {
+ const res = await request(`/${TOPIC}`, { method: 'DELETE' });
+ expect(res.status).toBe(200);
+ expect(DeletedResourceSchema.parse(await json(res))).toEqual({ deleted: true, id: TOPIC });
+
+ expect((await request(`/${TOPIC}`, { method: 'DELETE' })).status).toBe(404);
+ });
+});
diff --git a/packages/openapi/src/routes/topics.route.ts b/packages/openapi/src/routes/topics.route.ts
index 0bf515676ed..fd1640ed6b7 100644
--- a/packages/openapi/src/routes/topics.route.ts
+++ b/packages/openapi/src/routes/topics.route.ts
@@ -1,20 +1,24 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
import { z } from 'zod';
import { getAllScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { TopicController } from '../controllers';
import { EvalContextController } from '../controllers/eval-context.controller';
import { requireAuth } from '../middleware';
import { requireAnyPermission } from '../middleware/permission-check';
+import { DeletedResourceSchema } from '../types/common.type';
import { EvalPaginationSchema } from '../types/eval-resource.type';
import {
TopicCreateRequestSchema,
TopicDeleteParamSchema,
TopicGetParamSchema,
TopicListQuerySchema,
+ TopicListSchema,
+ TopicSchema,
+ TopicThreadListSchema,
TopicUpdateParamSchema,
TopicUpdateRequestSchema,
} from '../types/topic.type';
@@ -25,6 +29,7 @@ const TopicsRoutes = new Hono();
// GET /api/v1/topics - Get topic list (supports pagination and agent/group filtering)
TopicsRoutes.get(
'/',
+ routeDoc({ data: TopicListSchema, summary: 'List topics', tags: ['topics'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('TOPIC_READ'),
@@ -40,6 +45,7 @@ TopicsRoutes.get(
// POST /api/v1/topics - Create a new topic
TopicsRoutes.post(
'/',
+ routeDoc({ data: TopicSchema, summary: 'Create a topic', tags: ['topics'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('TOPIC_CREATE'),
@@ -55,6 +61,7 @@ TopicsRoutes.post(
// GET /api/v1/topics/:id - Get topic by ID
TopicsRoutes.get(
'/:id',
+ routeDoc({ data: TopicSchema, errors: [404], summary: 'Get a topic', tags: ['topics'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('TOPIC_READ'),
@@ -70,6 +77,7 @@ TopicsRoutes.get(
// PATCH /api/v1/topics/:id - Update topic
TopicsRoutes.patch(
'/:id',
+ routeDoc({ data: TopicSchema, errors: [404], summary: 'Update a topic', tags: ['topics'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('TOPIC_UPDATE'),
@@ -86,6 +94,12 @@ TopicsRoutes.patch(
// DELETE /api/v1/topics/:id - Delete topic
TopicsRoutes.delete(
'/:id',
+ routeDoc({
+ data: DeletedResourceSchema,
+ errors: [404],
+ summary: 'Delete a topic',
+ tags: ['topics'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('TOPIC_DELETE'),
@@ -100,7 +114,12 @@ TopicsRoutes.delete(
TopicsRoutes.get(
'/:topicId/threads',
- describeRoute({ summary: 'List topic threads', tags: ['topics'] }),
+ routeDoc({
+ data: TopicThreadListSchema,
+ errors: [404],
+ summary: 'List topic threads',
+ tags: ['topics'],
+ }),
requireAuth,
requireAnyPermission(getAllScopePermissions('MESSAGE_READ')),
zValidator('param', z.object({ topicId: z.string().min(1) })),
diff --git a/packages/openapi/src/routes/usage.route.ts b/packages/openapi/src/routes/usage.route.ts
index 4dbaefbe5da..e80e2e24195 100644
--- a/packages/openapi/src/routes/usage.route.ts
+++ b/packages/openapi/src/routes/usage.route.ts
@@ -1,15 +1,16 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
+import { routeDoc } from '../common/openapi';
import { UsageController } from '../controllers/usage.controller';
import { requireAuth } from '../middleware/auth';
import { requireApiKeyScope } from '../middleware/permission-check';
+import { UsageSchema } from '../types/usage.type';
const app = new Hono();
app.get(
'/',
- describeRoute({ summary: 'Get usage and quota summary', tags: ['usage'] }),
+ routeDoc({ data: UsageSchema, summary: 'Get usage and quota summary', tags: ['usage'] }),
requireAuth,
// Every workspace member, viewers included, may read the pool balance and
// their own allowance: `workspaceAuthMiddleware` has already checked the
diff --git a/packages/openapi/src/routes/users.route.ts b/packages/openapi/src/routes/users.route.ts
index f88ad22cfc1..aa176390729 100644
--- a/packages/openapi/src/routes/users.route.ts
+++ b/packages/openapi/src/routes/users.route.ts
@@ -1,17 +1,23 @@
import { Hono } from 'hono';
-import { describeRoute } from 'hono-openapi';
+import { z } from 'zod';
import { getAllScopePermissions, getScopePermissions } from '@/utils/rbac';
+import { routeDoc } from '../common/openapi';
import { zValidator } from '../common/validator';
import { UserController } from '../controllers';
import { requireAuth } from '../middleware/auth';
import { requireAnyPermission } from '../middleware/permission-check';
+import { DeletedResourceSchema, DeletedResourcesSchema } from '../types/common.type';
import {
CreateUserRequestSchema,
+ CurrentUserSchema,
UpdateUserRequestSchema,
UpdateUserRolesRequestSchema,
UserIdParamSchema,
+ UserListSchema,
+ UserRoleSchema,
+ UserSchema,
UserSearchRequestSchema,
} from '../types/user.type';
@@ -24,7 +30,14 @@ const UserRoutes = new Hono();
*/
UserRoutes.get(
'/me',
- describeRoute({ summary: 'Get current authenticated user', tags: ['users'] }),
+ routeDoc({
+ data: CurrentUserSchema,
+ description:
+ 'Reachable by every authenticated caller. An API key without `user:read` receives only `{ id }`; `messageCount` is included only with `?includeCount=1` and `chat:read`.',
+ errors: [404],
+ summary: 'Get current authenticated user',
+ tags: ['users'],
+ }),
requireAuth,
// Deliberately reachable by every authenticated caller, including restricted
// API keys holding no `user:read` — please do not add a scope gate here.
@@ -51,6 +64,7 @@ UserRoutes.get(
*/
UserRoutes.get(
'/',
+ routeDoc({ data: UserListSchema, summary: 'List users', tags: ['users'] }),
requireAuth,
requireAnyPermission(
getScopePermissions('USER_READ', ['ALL']),
@@ -70,6 +84,7 @@ UserRoutes.get(
*/
UserRoutes.post(
'/',
+ routeDoc({ data: UserSchema, summary: 'Create a user', tags: ['users'] }),
requireAuth,
requireAnyPermission(
getScopePermissions('USER_CREATE', ['ALL']),
@@ -89,6 +104,7 @@ UserRoutes.post(
*/
UserRoutes.get(
'/:id',
+ routeDoc({ data: UserSchema, errors: [404], summary: 'Get a user', tags: ['users'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('USER_READ'),
@@ -108,6 +124,7 @@ UserRoutes.get(
*/
UserRoutes.patch(
'/:id',
+ routeDoc({ data: UserSchema, errors: [404], summary: 'Update a user', tags: ['users'] }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('USER_UPDATE'),
@@ -128,6 +145,12 @@ UserRoutes.patch(
*/
UserRoutes.delete(
'/:id',
+ routeDoc({
+ data: DeletedResourceSchema,
+ errors: [404],
+ summary: 'Delete a user',
+ tags: ['users'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('USER_DELETE'),
@@ -147,6 +170,12 @@ UserRoutes.delete(
*/
UserRoutes.get(
'/:id/roles',
+ routeDoc({
+ data: z.array(UserRoleSchema),
+ errors: [404],
+ summary: "List a user's roles",
+ tags: ['users'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('RBAC_USER_ROLE_READ'),
@@ -166,6 +195,13 @@ UserRoutes.get(
*/
UserRoutes.patch(
'/:id/roles',
+ routeDoc({
+ data: z.array(UserRoleSchema),
+ description: "Adds and removes role assignments, then returns all of the user's roles.",
+ errors: [404],
+ summary: "Update a user's roles",
+ tags: ['users'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('RBAC_USER_ROLE_UPDATE'),
@@ -186,6 +222,13 @@ UserRoutes.patch(
*/
UserRoutes.delete(
'/:id/roles',
+ routeDoc({
+ data: DeletedResourcesSchema,
+ description: '`count` is the number of role assignments removed.',
+ errors: [404],
+ summary: "Clear a user's roles",
+ tags: ['users'],
+ }),
requireAuth,
requireAnyPermission(
getAllScopePermissions('RBAC_USER_ROLE_UPDATE'),
diff --git a/packages/openapi/src/services/__tests__/file.service.test.ts b/packages/openapi/src/services/__tests__/file.service.test.ts
new file mode 100644
index 00000000000..103da072695
--- /dev/null
+++ b/packages/openapi/src/services/__tests__/file.service.test.ts
@@ -0,0 +1,104 @@
+import { describe, expect, it, vi } from 'vitest';
+
+import { DeletedResourceSchema } from '../../types/common.type';
+import {
+ FileChunkStatusResponseSchema,
+ FileDetailSchema,
+ FileUrlResponseSchema,
+} from '../../types/file.type';
+import { FileUploadService } from '../file.service';
+
+// Only the collaborators the service builds in its constructor are stubbed;
+// the projection and response assembly under test stay real.
+vi.mock('@/database/models/rbac', () => ({ RbacModel: class {} }));
+vi.mock('@/database/models/file', () => ({ FileModel: class {} }));
+vi.mock('@/database/models/document', () => ({ DocumentModel: class {} }));
+vi.mock('@/database/models/chunk', () => ({ ChunkModel: class {} }));
+vi.mock('@/database/models/asyncTask', () => ({ AsyncTaskModel: class {} }));
+vi.mock('@/database/models/knowledgeBase', () => ({ KnowledgeBaseModel: class {} }));
+vi.mock('@/server/modules/S3', () => ({ FileS3: class {} }));
+vi.mock('@/server/services/document', () => ({ DocumentService: class {} }));
+vi.mock('@/server/services/file', () => ({ FileService: class {} }));
+vi.mock('@/business/server/lambda-routers/file', () => ({ businessFileUploadCheck: vi.fn() }));
+
+/** A full `files` row, private columns included, as the database returns it. */
+const fileRow = {
+ accessedAt: new Date('2024-01-03T00:00:00Z'),
+ chunkTaskId: 'task-chunk',
+ clientId: null,
+ createdAt: new Date('2024-01-01T00:00:00Z'),
+ deletedAt: null,
+ deletedBy: null,
+ embeddingTaskId: null,
+ fileHash: 'hash',
+ fileType: 'image/png',
+ id: 'file-1',
+ metadata: { path: 'files/a.png' },
+ name: 'a.png',
+ parentId: null,
+ size: 12,
+ source: null,
+ updatedAt: new Date('2024-01-02T00:00:00Z'),
+ url: 'https://cdn.example.com/files/a.png',
+ userId: 'user-1',
+ visibility: 'public',
+ workspaceId: null,
+};
+
+const buildService = () => {
+ const service = new FileUploadService({} as any, 'user-1') as any;
+ service.resolveOperationPermission = vi.fn().mockResolvedValue({ isPermitted: true });
+ service.findFileByIdWithPermission = vi.fn().mockResolvedValue(fileRow);
+ return service;
+};
+
+// Round-trip through JSON the way `c.json` does; `structuredClone` would keep the `Date` objects.
+// oxlint-disable-next-line unicorn/prefer-structured-clone
+const asJson = (value: unknown) => JSON.parse(JSON.stringify(value));
+
+describe('FileUploadService response payloads', () => {
+ // Regression: DELETE /files/:id answered with no `data` at all.
+ it('reports the deleted file id', async () => {
+ const service = buildService();
+ service.coreFileService = { deleteFile: vi.fn() };
+ service.fileModel = { delete: vi.fn() };
+
+ const result = await service.deleteFile('file-1');
+
+ expect(result).toEqual({ deleted: true, id: 'file-1' });
+ expect(service.fileModel.delete).toHaveBeenCalledWith('file-1');
+ expect(() => DeletedResourceSchema.parse(result)).not.toThrow();
+ });
+
+ it('returns only the public file columns in a file detail', async () => {
+ const result = asJson(await buildService().getFileDetail('file-1'));
+
+ expect(() => FileDetailSchema.parse(result)).not.toThrow();
+ expect(result.file).not.toHaveProperty('userId');
+ });
+
+ it('matches the documented pre-signed URL payload', async () => {
+ const service = buildService();
+ service.s3Service = { createPreSignedUrlForPreview: vi.fn().mockResolvedValue('https://s') };
+
+ const result = await service.getFileUrl('file-1', { expiresIn: 60 });
+
+ expect(() => FileUrlResponseSchema.parse(result)).not.toThrow();
+ });
+
+ it('matches the documented chunk status payload', async () => {
+ const service = buildService();
+ service.chunkModel = { countByFileId: vi.fn().mockResolvedValue(3) };
+ service.asyncTaskModel = {
+ findById: vi.fn().mockResolvedValue({
+ error: { body: { detail: 'boom' }, name: 'ChunkError' },
+ id: 'task-chunk',
+ status: 'error',
+ }),
+ };
+
+ const result = asJson(await service.getFileChunkStatus('file-1'));
+
+ expect(() => FileChunkStatusResponseSchema.parse(result)).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/services/__tests__/im.service.test.ts b/packages/openapi/src/services/__tests__/im.service.test.ts
index 187b15ee129..3869bba5de7 100644
--- a/packages/openapi/src/services/__tests__/im.service.test.ts
+++ b/packages/openapi/src/services/__tests__/im.service.test.ts
@@ -19,7 +19,13 @@ import {
} from '@/database/schemas';
import { ForeignLiveRunError } from '@/server/services/aiAgent/topicStartReservation';
-import { ImSendRequestSchema } from '../../types/im.type';
+import {
+ ImReadResultSchema,
+ ImSendRequestSchema,
+ ImSendResultSchema,
+ ImSyncResultSchema,
+ PushTokenRegistrationSchema,
+} from '../../types/im.type';
import { ImRestService } from '../im.service';
const { execAgentMock, execGroupAgentMock } = vi.hoisted(() => ({
@@ -131,11 +137,11 @@ describe('ImRestService.sync — whole-message delivery', () => {
.insert(messagesFiles)
.values({ fileId: 'file_reply', messageId: 'msg_file_reply', userId: USER });
const result = await service.sync(TOPIC, {});
+ expect(() => ImSyncResultSchema.parse(result)).not.toThrow();
expect(result.messages[0]).toMatchObject({ content: '', files: [{ id: 'file_reply' }] });
expect(result.unread).toBe(1);
- await expect(service.markRead(TOPIC, { messageId: 'msg_file_reply' })).resolves.toEqual({
- unread: 0,
- });
+ const read = await service.markRead(TOPIC, { messageId: 'msg_file_reply' });
+ expect(ImReadResultSchema.parse(read)).toEqual({ unread: 0 });
});
it('returns attachment metadata with an attachment-only user message', async () => {
await db.insert(files).values({
@@ -574,6 +580,7 @@ describe('ImRestService.send', () => {
}),
);
expect(execGroupAgentMock).not.toHaveBeenCalled();
+ expect(() => ImSendResultSchema.parse(result)).not.toThrow();
expect(result).toMatchObject({
accepted: true,
operationId: 'op_1',
@@ -892,10 +899,14 @@ describe('ImRestService.send', () => {
describe('ImRestService push tokens', () => {
it('registers, rotates and unregisters a device', async () => {
- await service.registerPushToken('device-1', {
+ const registered = await service.registerPushToken('device-1', {
expoToken: 'ExponentPushToken[aaa]',
platform: 'ios',
});
+ expect(PushTokenRegistrationSchema.parse(registered)).toEqual({
+ deviceId: 'device-1',
+ platform: 'ios',
+ });
await service.registerPushToken('device-1', {
expoToken: 'ExponentPushToken[bbb]',
platform: 'ios',
diff --git a/packages/openapi/src/services/__tests__/knowledge-base.service.test.ts b/packages/openapi/src/services/__tests__/knowledge-base.service.test.ts
new file mode 100644
index 00000000000..2831f8cbbb8
--- /dev/null
+++ b/packages/openapi/src/services/__tests__/knowledge-base.service.test.ts
@@ -0,0 +1,96 @@
+import { describe, expect, it, vi } from 'vitest';
+
+import { DeletedResourceSchema } from '../../types/common.type';
+import {
+ KnowledgeBaseDetailResponseSchema,
+ KnowledgeBaseListResponseSchema,
+} from '../../types/knowledge-base.type';
+import { KnowledgeBaseService } from '../knowledge-base.service';
+
+const { deleteWithFilesMock, deleteFilesMock, findByIdMock } = vi.hoisted(() => ({
+ deleteFilesMock: vi.fn(),
+ deleteWithFilesMock: vi.fn(),
+ findByIdMock: vi.fn(),
+}));
+
+vi.mock('@/database/models/rbac', () => ({ RbacModel: class {} }));
+vi.mock('@/database/models/knowledgeBase', () => ({
+ KnowledgeBaseModel: class {
+ deleteWithFiles = deleteWithFilesMock;
+ findById = findByIdMock;
+ },
+}));
+vi.mock('@/server/services/file', () => ({
+ FileService: class {
+ deleteFiles = deleteFilesMock;
+ },
+}));
+
+/** A full `knowledge_bases` row, private columns included. */
+const knowledgeBaseRow = {
+ accessedAt: new Date('2024-01-03T00:00:00Z'),
+ avatar: null,
+ clientId: null,
+ createdAt: new Date('2024-01-01T00:00:00Z'),
+ deletedAt: null,
+ deletedBy: null,
+ description: 'Docs',
+ id: 'kb-1',
+ isPublic: false,
+ name: 'Docs',
+ settings: null,
+ type: null,
+ updatedAt: new Date('2024-01-02T00:00:00Z'),
+ userId: 'user-1',
+ visibility: 'public',
+ workspaceId: null,
+};
+
+const buildService = (db: unknown = {}) => {
+ const service = new KnowledgeBaseService(db as any, 'user-1') as any;
+ service.resolveOperationPermission = vi.fn().mockResolvedValue({ isPermitted: true });
+ return service;
+};
+
+// A JSON round-trip on purpose: `structuredClone` would keep the `Date` objects.
+// oxlint-disable-next-line unicorn/prefer-structured-clone
+const asJson = (value: unknown) => JSON.parse(JSON.stringify(value));
+
+describe('KnowledgeBaseService response payloads', () => {
+ // Regression: DELETE /knowledge-bases/:id answered `{ success, message }`
+ // instead of naming the knowledge base it removed.
+ it('reports the deleted knowledge base id', async () => {
+ deleteWithFilesMock.mockResolvedValue({ deletedFiles: [{ id: 'f', url: 'files/f' }] });
+ const db = {
+ query: { knowledgeBases: { findFirst: vi.fn().mockResolvedValue(knowledgeBaseRow) } },
+ };
+
+ const result = await buildService(db).deleteKnowledgeBase('kb-1');
+
+ expect(result).toEqual({ deleted: true, id: 'kb-1' });
+ expect(deleteFilesMock).toHaveBeenCalledWith(['files/f']);
+ expect(() => DeletedResourceSchema.parse(result)).not.toThrow();
+ });
+
+ it('returns only the public knowledge base columns in a detail', async () => {
+ findByIdMock.mockResolvedValue(knowledgeBaseRow);
+
+ const result = asJson(await buildService().getKnowledgeBaseDetail('kb-1'));
+
+ expect(() => KnowledgeBaseDetailResponseSchema.parse(result)).not.toThrow();
+ expect(result.knowledgeBase).not.toHaveProperty('userId');
+ });
+
+ it('matches the documented list payload', async () => {
+ const chain = { from: () => ({ where: () => Promise.resolve([{ count: 1 }]) }) };
+ const db = {
+ query: { knowledgeBases: { findMany: vi.fn().mockResolvedValue([knowledgeBaseRow]) } },
+ select: () => chain,
+ };
+
+ const result = asJson(await buildService(db).getKnowledgeBaseList({}));
+
+ expect(() => KnowledgeBaseListResponseSchema.parse(result)).not.toThrow();
+ expect(result.knowledgeBases[0].accessType).toBe('owner');
+ });
+});
diff --git a/packages/openapi/src/services/__tests__/responses.streaming.test.ts b/packages/openapi/src/services/__tests__/responses.streaming.test.ts
index cf36a4148ce..9f7859f8444 100644
--- a/packages/openapi/src/services/__tests__/responses.streaming.test.ts
+++ b/packages/openapi/src/services/__tests__/responses.streaming.test.ts
@@ -2,6 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import { InMemoryStreamEventManager } from '@/server/modules/AgentRuntime/InMemoryStreamEventManager';
+import { ResponseObjectSchema } from '../../types/responses.type';
import type * as ResumeModule from '../client-tool-resume.responses';
import { ResponsesService } from '../responses.service';
@@ -178,6 +179,7 @@ describe('ResponsesService function call outputs', () => {
topicId: 'tpc_1',
});
expect(response).toMatchObject({ id: 'tpc_1', status: 'completed' });
+ expect(() => ResponseObjectSchema.parse(response)).not.toThrow();
});
it('streams the resumed run on the same response id', async () => {
@@ -216,6 +218,7 @@ describe('ResponsesService function call outputs', () => {
output: [{ call_id: 'call_9', name: 'get_weather', type: 'function_call' }],
status: 'incomplete',
});
+ expect(() => ResponseObjectSchema.parse(response)).not.toThrow();
});
it('falls back to a new turn when nothing is parked on the topic', async () => {
@@ -251,6 +254,7 @@ describe('ResponsesService function call outputs', () => {
status: 'failed',
error: { code: 'invalid_request_error' },
});
+ expect(() => ResponseObjectSchema.parse(response)).not.toThrow();
expect(execAgentMock).not.toHaveBeenCalled();
expect(executeResponseRunMock).not.toHaveBeenCalled();
},
@@ -281,6 +285,7 @@ describe('ResponsesService function call outputs', () => {
tools_mode: 'exclusive',
});
expect(response.status).toBe('completed');
+ expect(() => ResponseObjectSchema.parse(response)).not.toThrow();
expect(execAgentMock).toHaveBeenCalledWith(
expect.objectContaining({
exclusivePluginIds: ['lobe-agent-documents'],
@@ -289,3 +294,42 @@ describe('ResponsesService function call outputs', () => {
);
});
});
+
+describe('ResponsesService non-streaming response object', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ execAgentMock.mockResolvedValue({ operationId: 'op_1', success: true, topicId: 'tpc_9' });
+ });
+
+ it('matches the documented OpenResponses object for every output item kind', async () => {
+ executeResponseRunMock.mockResolvedValue({
+ messages: [
+ {
+ content: 'Checking.',
+ role: 'assistant',
+ tool_calls: [{ function: { arguments: '{}', name: 'search____query' }, id: 'call_1' }],
+ },
+ { content: 'result', role: 'tool', tool_call_id: 'call_1' },
+ { content: 'Done.', role: 'assistant' },
+ ],
+ status: 'done',
+ usage: { llm: { tokens: { input: 5, output: 7, total: 12 } } },
+ });
+
+ const response = await buildService().createResponse({
+ input: 'hi',
+ metadata: { source: 'test' },
+ model: 'agt_1',
+ tool_choice: { name: 'lookup', type: 'function' },
+ });
+
+ expect(response.output.map((item: { type: string }) => item.type)).toEqual([
+ 'message',
+ 'function_call',
+ 'function_call_output',
+ 'message',
+ ]);
+ expect(response.usage).toMatchObject({ input_tokens: 5, output_tokens: 7, total_tokens: 12 });
+ expect(() => ResponseObjectSchema.parse(response)).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/services/agent-group.service.ts b/packages/openapi/src/services/agent-group.service.ts
index 91a5aab8a2a..1d0e896057d 100644
--- a/packages/openapi/src/services/agent-group.service.ts
+++ b/packages/openapi/src/services/agent-group.service.ts
@@ -135,7 +135,9 @@ export class AgentGroupService extends BaseService {
* @param request Update request parameters
* @returns Update result
*/
- async updateAgentGroup(request: UpdateAgentGroupRequest): ServiceResult<void> {
+ async updateAgentGroup(
+ request: UpdateAgentGroupRequest,
+ ): ServiceResult<AgentGroupListResponse[0]> {
this.log('info', 'Updating agent group', { id: request.id, name: request.name });
try {
@@ -153,14 +155,18 @@ export class AgentGroupService extends BaseService {
throw this.createBusinessError(`助理分类 ID "${id}" 不存在`);
}
- await this.db
+ // Answer with the row the update wrote, under the same scope it used.
+ const [updated] = await this.db
.update(sessionGroups)
.set({ ...updateData, updatedAt: new Date() })
- .where(and(eq(sessionGroups.id, id), this.buildWorkspaceWhere(sessionGroups)));
+ .where(and(eq(sessionGroups.id, id), this.buildWorkspaceWhere(sessionGroups)))
+ .returning();
+ if (!updated) throw this.createBusinessError(`助理分类 ID "${id}" 不存在`);
this.log('info', 'Agent group updated successfully', { id });
+ return projectPublicAgentGroup(updated);
} catch (error) {
- this.handleServiceError(error, '更新助理分类');
+ return this.handleServiceError(error, '更新助理分类');
}
}
diff --git a/packages/openapi/src/services/agent.service.ts b/packages/openapi/src/services/agent.service.ts
index 4e0a9920252..44d0404daa7 100644
--- a/packages/openapi/src/services/agent.service.ts
+++ b/packages/openapi/src/services/agent.service.ts
@@ -55,7 +55,11 @@ export class AgentService extends BaseService {
.where(eq(agents.id, result.agentId));
}
- return this.getAgentById(result.agentId);
+ // The copy was just written in the caller's scope, so it is readable; a
+ // miss here would mean the copy vanished, which is still "not found".
+ const duplicated = await this.getAgentById(result.agentId);
+ if (!duplicated) throw this.createNotFoundError('Duplicated agent not found');
+ return duplicated;
}
/**
diff --git a/packages/openapi/src/services/api-key.service.ts b/packages/openapi/src/services/api-key.service.ts
index 6032954452d..8a2f8a99ce4 100644
--- a/packages/openapi/src/services/api-key.service.ts
+++ b/packages/openapi/src/services/api-key.service.ts
@@ -10,6 +10,7 @@ import type {
CreatedApiKeyResponse,
UpdateApiKeyRequest,
} from '../types/api-key.type';
+import type { DeletedResource } from '../types/common.type';
const projectApiKey = (value: ApiKeyItem): ApiKeyResponse => ({
createdAt: value.createdAt,
@@ -58,11 +59,11 @@ export class ApiKeyService extends BaseService {
return this.getApiKey(id);
}
- async deleteApiKey(id: string): Promise<{ id: string }> {
+ async deleteApiKey(id: string): Promise<DeletedResource> {
const existing = await this.apiKeyModel.findById(id);
if (!existing) throw this.createNotFoundError('API key not found');
await this.apiKeyModel.delete(id);
- return { id };
+ return { deleted: true, id };
}
}
diff --git a/packages/openapi/src/services/eval-lifecycle.service.test.ts b/packages/openapi/src/services/eval-lifecycle.service.test.ts
index 06ae03063c4..c349ac223b5 100644
--- a/packages/openapi/src/services/eval-lifecycle.service.test.ts
+++ b/packages/openapi/src/services/eval-lifecycle.service.test.ts
@@ -11,8 +11,17 @@ import {
users,
} from '@/database/schemas';
+import {
+ EvalBatchReportResultSchema,
+ EvalReportResultSchema,
+ EvalRetryErrorsSchema,
+ EvalRunSchema,
+} from '../types/eval-response.type';
import { EvalLifecycleService } from './eval-lifecycle.service';
+/** What the client receives: `c.json` serializes Dates and drops undefined keys. */
+const toJson = (value: unknown) => JSON.parse(JSON.stringify(value));
+
vi.mock('@/server/workflows/agentEvalRun', () => ({
AgentEvalRunWorkflow: { triggerRunBenchmark: vi.fn() },
}));
@@ -79,7 +88,8 @@ describe('external run lifecycle', () => {
.values(
['shared-topic-1', 'shared-topic-2'].map((id) => ({ id, userId: 'lifecycle-owner' })),
);
- await owner.claim('shared-case-run');
+ const claimed = await owner.claim('shared-case-run');
+ expect(() => EvalRunSchema.parse(toJson(claimed))).not.toThrow();
await expect(
owner.report('shared-case-run', 'shared-topic-1', {
testCaseId: 'lifecycle-case',
@@ -87,13 +97,13 @@ describe('external run lifecycle', () => {
correct: true,
}),
).rejects.toMatchObject({ name: 'NotFoundError' });
- expect(
- await owner.report('shared-case-run', 'shared-topic-1', {
- testCaseId: 'shared-case-1',
- score: 1,
- correct: true,
- }),
- ).toMatchObject({ runStatus: 'running' });
+ const firstReport = await owner.report('shared-case-run', 'shared-topic-1', {
+ testCaseId: 'shared-case-1',
+ score: 1,
+ correct: true,
+ });
+ expect(firstReport).toMatchObject({ runStatus: 'running' });
+ expect(() => EvalReportResultSchema.parse(toJson(firstReport))).not.toThrow();
const first = (await db.select().from(agentEvalRuns)).find(
(run) => run.id === 'shared-case-run',
);
@@ -138,9 +148,12 @@ describe('external run lifecycle', () => {
await expect(owner.setStatus('status-run', { status: 'completed' })).rejects.toMatchObject({
name: 'ConflictError',
});
- expect(await owner.setStatus('status-run', { status: 'aborted' })).toMatchObject({
- status: 'aborted',
- });
+ const aborted = await owner.setStatus('status-run', { status: 'aborted' });
+ expect(aborted).toMatchObject({ status: 'aborted' });
+ expect(() => EvalRunSchema.parse(toJson(aborted))).not.toThrow();
+ const retried = await owner.retryErrors('status-run');
+ expect(retried).toEqual({ retryCount: 0, runId: 'status-run' });
+ expect(() => EvalRetryErrorsSchema.parse(retried)).not.toThrow();
expect(await owner.setStatus('status-run', { status: 'aborted' })).toMatchObject({
status: 'aborted',
});
@@ -164,10 +177,9 @@ describe('external run lifecycle', () => {
).rejects.toMatchObject({ name: 'NotFoundError' });
const row = await db.select().from(agentEvalRunTopics);
expect(row.find((r) => r.runId === 'report-run')?.score).toBeNull();
- expect(await owner.reportBatch('report-run', { items: [result] })).toMatchObject({
- items: [{ idempotent: false }],
- runStatus: 'completed',
- });
+ const batch = await owner.reportBatch('report-run', { items: [result] });
+ expect(batch).toMatchObject({ items: [{ idempotent: false }], runStatus: 'completed' });
+ expect(() => EvalBatchReportResultSchema.parse(toJson(batch))).not.toThrow();
expect(await owner.reportBatch('report-run', { items: [result] })).toMatchObject({
items: [{ idempotent: true }],
});
diff --git a/packages/openapi/src/services/eval-resource.service.test.ts b/packages/openapi/src/services/eval-resource.service.test.ts
index 2daf1a4b1de..ecd65abf767 100644
--- a/packages/openapi/src/services/eval-resource.service.test.ts
+++ b/packages/openapi/src/services/eval-resource.service.test.ts
@@ -3,13 +3,25 @@ import { beforeAll, describe, expect, it } from 'vitest';
import { getTestDB } from '@/database/core/getTestDB';
import { users, workspaces } from '@/database/schemas';
+import { DeletedResourceSchema } from '../types/common.type';
import {
CreateBenchmarkSchema,
CreateTestCaseSchema,
EvalPaginationSchema,
} from '../types/eval-resource.type';
+import {
+ EvalBenchmarkListSchema,
+ EvalBenchmarkSchema,
+ EvalDatasetListSchema,
+ EvalDatasetSchema,
+ EvalTestCaseListSchema,
+ EvalTestCaseSchema,
+} from '../types/eval-response.type';
import { EvalResourceService } from './eval-resource.service';
+/** What the client receives: `c.json` serializes Dates and drops undefined keys. */
+const toJson = (value: unknown) => JSON.parse(JSON.stringify(value));
+
const db = await getTestDB();
const owner = new EvalResourceService(db, 'eval-api-owner', 'eval-api-workspace');
const member = new EvalResourceService(db, 'eval-api-member', 'eval-api-workspace');
@@ -84,10 +96,23 @@ describe('public eval resources', () => {
expected: 'Updated',
messages: content.messages,
});
- await member.deleteTestCase(testCase.id);
+ const [benchmarks, datasetList, testCases] = await Promise.all([
+ owner.listBenchmarks({}),
+ owner.listDatasets({}),
+ owner.listTestCases(dataset.id, {}),
+ ]);
+ expect(() => EvalBenchmarkSchema.parse(toJson(benchmark))).not.toThrow();
+ expect(() => EvalBenchmarkListSchema.parse(toJson(benchmarks))).not.toThrow();
+ expect(() => EvalDatasetSchema.parse(toJson(dataset))).not.toThrow();
+ expect(() => EvalDatasetListSchema.parse(toJson(datasetList))).not.toThrow();
+ expect(() => EvalTestCaseSchema.parse(toJson(testCase))).not.toThrow();
+ expect(() => EvalTestCaseListSchema.parse(toJson(testCases))).not.toThrow();
+ const deletedCase = await member.deleteTestCase(testCase.id);
+ expect(deletedCase).toEqual({ deleted: true, id: testCase.id });
+ expect(() => DeletedResourceSchema.parse(deletedCase)).not.toThrow();
await expect(owner.getTestCase(testCase.id)).rejects.toMatchObject({ name: 'NotFoundError' });
- await owner.deleteDataset(dataset.id);
- await owner.deleteBenchmark(benchmark.id);
+ expect(await owner.deleteDataset(dataset.id)).toEqual({ deleted: true, id: dataset.id });
+ expect(await owner.deleteBenchmark(benchmark.id)).toEqual({ deleted: true, id: benchmark.id });
});
it('rejects paths in messages and unbounded pagination', () => {
expect(
diff --git a/packages/openapi/src/services/eval-resource.service.ts b/packages/openapi/src/services/eval-resource.service.ts
index 7521e0561d2..5a4f42252c6 100644
--- a/packages/openapi/src/services/eval-resource.service.ts
+++ b/packages/openapi/src/services/eval-resource.service.ts
@@ -10,6 +10,7 @@ import {
import { BaseService } from '../common/base.service';
import { projectPublicEvalDataset, projectPublicEvalTestCase } from '../helpers/public-fields';
+import type { DeletedResource } from '../types/common.type';
import type {
CreateBenchmark,
CreateDataset,
@@ -132,7 +133,7 @@ export class EvalResourceService extends BaseService {
if (!row) throw this.createNotFoundError('Benchmark not found');
return projectBenchmark(row);
}
- async deleteBenchmark(id: string) {
+ async deleteBenchmark(id: string): Promise<DeletedResource> {
await this.getBenchmark(id, true);
await this.db
.delete(benchmarks)
@@ -143,7 +144,7 @@ export class EvalResourceService extends BaseService {
eq(benchmarks.isSystem, false),
),
);
- return { id };
+ return { deleted: true, id };
}
async getDataset(id: string, mutable = false) {
const [row] = await this.db
@@ -216,12 +217,12 @@ export class EvalResourceService extends BaseService {
if (!row) throw this.createNotFoundError('Dataset not found');
return this.getDataset(row.id);
}
- async deleteDataset(id: string) {
+ async deleteDataset(id: string): Promise<DeletedResource> {
await this.getDataset(id, true);
await this.db
.delete(datasets)
.where(and(eq(datasets.id, id), this.buildWorkspaceWhere(datasets)));
- return { id };
+ return { deleted: true, id };
}
async getTestCase(id: string, mutable = false) {
const [row] = await this.db
@@ -302,9 +303,9 @@ export class EvalResourceService extends BaseService {
if (!row) throw this.createNotFoundError('Test case not found');
return projectTestCase(row);
}
- async deleteTestCase(id: string) {
+ async deleteTestCase(id: string): Promise<DeletedResource> {
await this.getTestCase(id, true);
await this.db.delete(cases).where(and(eq(cases.id, id), this.buildWorkspaceWhere(cases)));
- return { id };
+ return { deleted: true, id };
}
}
diff --git a/packages/openapi/src/services/eval.service.test.ts b/packages/openapi/src/services/eval.service.test.ts
index 9fba132b692..8df957daa57 100644
--- a/packages/openapi/src/services/eval.service.test.ts
+++ b/packages/openapi/src/services/eval.service.test.ts
@@ -3,8 +3,16 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import type { LobeChatDatabase } from '@/database/type';
+import {
+ EvalRunListSchema,
+ EvalRunResultListSchema,
+ EvalRunTopicListSchema,
+} from '../types/eval-response.type';
import { EvalService } from './eval.service';
+/** What the client receives: `c.json` serializes Dates and drops undefined keys. */
+const toJson = (value: unknown) => JSON.parse(JSON.stringify(value));
+
const {
datasetCountMock,
datasetFindByIdMock,
@@ -136,6 +144,7 @@ describe('EvalService.listRuns', () => {
expect(result.runs[0]).not.toHaveProperty('workspaceId');
expect(result.runs[0]).not.toHaveProperty('clientId');
expect(result.runs[0]).toMatchObject({ datasetId: 'ds-1', id: 'run-1', status: 'completed' });
+ expect(() => EvalRunListSchema.parse(toJson(result))).not.toThrow();
});
});
@@ -254,5 +263,37 @@ describe('EvalService.getRunTopics', () => {
testCaseId: 'tc-1',
topicId: 'topic-1',
});
+ expect(() => EvalRunTopicListSchema.parse(toJson(result))).not.toThrow();
+ });
+});
+
+describe('EvalService.getRunResults', () => {
+ it('projects each case result to the documented public shape', async () => {
+ runFindByIdMock.mockResolvedValue(runRow);
+ runTopicFindByRunIdMock.mockResolvedValue([
+ {
+ createdAt: now,
+ evalResult: {
+ executionId: 'internal-execution',
+ externalResult: { answer: 'ok' },
+ rubricScores: [{ rubricId: 'external', score: 1 }],
+ threads: [{ executionId: 'internal', score: 1, status: 'passed', threadId: 'th-1' }],
+ },
+ passed: true,
+ runId: 'run-1',
+ score: 1,
+ status: 'passed',
+ testCase: { content: { input: 'q1' }, id: 'tc-1' },
+ testCaseId: 'tc-1',
+ topicId: 'topic-1',
+ },
+ ]);
+ runTopicCountByRunIdMock.mockResolvedValue(1);
+
+ const result = toJson(await service().getRunResults('run-1'));
+
+ expect(result.results[0].result).not.toHaveProperty('executionId');
+ expect(result.results[0].result.threads[0]).not.toHaveProperty('executionId');
+ expect(() => EvalRunResultListSchema.parse(result)).not.toThrow();
});
});
diff --git a/packages/openapi/src/services/file.service.ts b/packages/openapi/src/services/file.service.ts
index 4f14549656d..57bf1a305b8 100644
--- a/packages/openapi/src/services/file.service.ts
+++ b/packages/openapi/src/services/file.service.ts
@@ -31,6 +31,7 @@ import { nanoid } from '@/utils/uuid';
import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
import { projectPublicFile, projectPublicUser } from '../helpers/public-fields';
+import type { DeletedResource } from '../types/common.type';
import type {
AsyncTaskErrorResponse,
BatchFileUploadRequest,
@@ -1054,9 +1055,8 @@ export class FileUploadService extends BaseService {
/**
* Delete file
*/
- async deleteFile(fileId: string): Promise<void> {
+ async deleteFile(fileId: string): Promise<DeletedResource> {
try {
- // Permission check
const permissionResult = await this.resolveOperationPermission('FILE_DELETE', {
targetFileId: fileId,
});
@@ -1075,7 +1075,7 @@ export class FileUploadService extends BaseService {
this.log('info', 'File deleted successfully', { fileId, key: file.url });
- return;
+ return { deleted: true, id: fileId };
} catch (error) {
this.handleServiceError(error, '删除文件');
}
diff --git a/packages/openapi/src/services/goal.service.test.ts b/packages/openapi/src/services/goal.service.test.ts
index 3605a71d6e5..c3472c31656 100644
--- a/packages/openapi/src/services/goal.service.test.ts
+++ b/packages/openapi/src/services/goal.service.test.ts
@@ -122,7 +122,7 @@ describe('GoalRestService creator gate on restart/delete', () => {
const svc = service(WORKSPACE);
await expect(svc.restartGoal('goal-1', {})).resolves.toEqual({ restartedTaskIds: ['task-1'] });
- await expect(svc.deleteGoal('goal-1')).resolves.toBeUndefined();
+ await expect(svc.deleteGoal('goal-1')).resolves.toEqual({ deleted: true, id: 'goal-1' });
expect(deleteGoalMock).toHaveBeenCalledWith('goal-1');
});
diff --git a/packages/openapi/src/services/goal.service.ts b/packages/openapi/src/services/goal.service.ts
index 1f0dc6e89ad..0abe15a7cb9 100644
--- a/packages/openapi/src/services/goal.service.ts
+++ b/packages/openapi/src/services/goal.service.ts
@@ -7,6 +7,7 @@ import { scheduleGoalAdvance } from '@/server/services/goal/scheduler';
import { BaseService } from '../common/base.service';
import type { ServiceResult } from '../types';
+import type { DeletedResource } from '../types/common.type';
import type {
CreateGoalRequest,
GoalListQuery,
@@ -178,11 +179,12 @@ export class GoalRestService extends BaseService {
return this.goalService.graph(id);
}
- async deleteGoal(id: string): ServiceResult<void> {
+ async deleteGoal(id: string): ServiceResult<DeletedResource> {
const goal = await this.requireGoal(id);
// Same rule as `restart`: visibility is not manageability, so only the
// goal's creator (or a workspace owner) may cascade its graph away.
await this.assertRowManageable(goal.userId, 'AGENT_UPDATE', 'goal');
await this.goalService.delete(id);
+ return { deleted: true, id };
}
}
diff --git a/packages/openapi/src/services/im.service.ts b/packages/openapi/src/services/im.service.ts
index 4a215168119..f4608fa9599 100644
--- a/packages/openapi/src/services/im.service.ts
+++ b/packages/openapi/src/services/im.service.ts
@@ -19,11 +19,13 @@ import type { ServiceResult } from '../types';
import type {
ImMessage,
ImReadRequest,
+ ImReadResult,
ImSendRequest,
ImSendResult,
ImSyncQuery,
ImSyncResult,
PushTokenRegisterRequest,
+ PushTokenRegistration,
} from '../types/im.type';
import { IM_SYNC_MAX_WAIT_MS } from '../types/im.type';
@@ -286,7 +288,7 @@ export class ImRestService extends BaseService {
}
}
- async markRead(topicId: string, input: ImReadRequest): ServiceResult<{ unread: number }> {
+ async markRead(topicId: string, input: ImReadRequest): ServiceResult<ImReadResult> {
await this.requireTopic(topicId);
const message = await this.findOwnMessage(input.messageId);
@@ -319,10 +321,7 @@ export class ImRestService extends BaseService {
async registerPushToken(
deviceId: string,
input: PushTokenRegisterRequest,
- ): ServiceResult<{
- deviceId: string;
- platform: string;
- }> {
+ ): ServiceResult<PushTokenRegistration> {
this.assertPersonalPushScope();
const row = await new PushTokenModel(this.db, this.userId).upsert({
diff --git a/packages/openapi/src/services/knowledge-base.service.ts b/packages/openapi/src/services/knowledge-base.service.ts
index d5b8d030ade..9007520fa91 100644
--- a/packages/openapi/src/services/knowledge-base.service.ts
+++ b/packages/openapi/src/services/knowledge-base.service.ts
@@ -9,10 +9,10 @@ import { FileService as CoreFileService } from '@/server/services/file';
import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
import { projectPublicKnowledgeBase } from '../helpers/public-fields';
+import type { DeletedResource } from '../types/common.type';
import type {
CreateKnowledgeBaseRequest,
CreateKnowledgeBaseResponse,
- DeleteKnowledgeBaseResponse,
KnowledgeBaseAccessType,
KnowledgeBaseDetailResponse,
KnowledgeBaseListItem,
@@ -230,7 +230,7 @@ export class KnowledgeBaseService extends BaseService {
/**
* Delete knowledge base
*/
- async deleteKnowledgeBase(id: string): Promise<DeleteKnowledgeBaseResponse> {
+ async deleteKnowledgeBase(id: string): Promise<DeletedResource> {
try {
// Permission check
const permissionResult = await this.resolveOperationPermission('KNOWLEDGE_BASE_DELETE');
@@ -265,10 +265,7 @@ export class KnowledgeBaseService extends BaseService {
this.log('info', 'Knowledge base deleted successfully', { id });
- return {
- message: 'Knowledge base deleted successfully',
- success: true,
- };
+ return { deleted: true, id };
} catch (error) {
this.handleServiceError(error, '删除知识库');
}
diff --git a/packages/openapi/src/services/mcp-server.service.test.ts b/packages/openapi/src/services/mcp-server.service.test.ts
index 1415e470667..c1782a62936 100644
--- a/packages/openapi/src/services/mcp-server.service.test.ts
+++ b/packages/openapi/src/services/mcp-server.service.test.ts
@@ -3,6 +3,8 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import type { LobeChatDatabase } from '@/database/type';
+import { DeletedResourceSchema } from '../types/common.type';
+import { McpServerSchema, McpServerSyncResultSchema } from '../types/mcp-server.type';
import { McpServerService } from './mcp-server.service';
const { claimMock, connectorInstances, hasAnyPermissionMock, syncConnectorToolsByIdMock } =
@@ -102,7 +104,20 @@ describe('McpServerService row-level manage checks', () => {
it('allows a workspace-wide (:all scope) caller to manage another member row', async () => {
hasAnyPermissionMock.mockResolvedValue(true);
- await expect(service().deleteServer('mcp-1')).resolves.toEqual({ id: 'mcp-1' });
+ const deleted = await service().deleteServer('mcp-1');
+
+ expect(deleted).toEqual({ deleted: true, id: 'mcp-1' });
+ expect(() => DeletedResourceSchema.parse(deleted)).not.toThrow();
+ });
+
+ it('answers sync with the documented result shape', async () => {
+ hasAnyPermissionMock.mockResolvedValue(true);
+ syncConnectorToolsByIdMock.mockResolvedValue({ toolCount: 3 });
+
+ const result = await service().syncServer('mcp-1');
+
+ expect(result).toEqual({ id: 'mcp-1', status: 'connected', toolCount: 3 });
+ expect(() => McpServerSyncResultSchema.parse(result)).not.toThrow();
});
it('allows managing a row the caller created', async () => {
@@ -118,7 +133,7 @@ describe('McpServerService row-level manage checks', () => {
}),
);
- await expect(svc.deleteServer('mcp-1')).resolves.toEqual({ id: 'mcp-1' });
+ await expect(svc.deleteServer('mcp-1')).resolves.toEqual({ deleted: true, id: 'mcp-1' });
});
// The list route only surfaces base connectors (`agent_id IS NULL`), and the
@@ -179,3 +194,35 @@ describe('McpServerService.createServer', () => {
expect(connectorInstances.every((it) => it.create.mock.calls.length === 0)).toBe(true);
});
});
+
+describe('McpServerService response projection', () => {
+ it('projects a server into the documented McpServer shape without credentials', async () => {
+ const svc = new McpServerService({} as LobeChatDatabase, OWNER, WORKSPACE);
+ const now = new Date('2026-01-01T00:00:00.000Z');
+ connectorInstances.forEach((it) =>
+ it.findPublicById.mockResolvedValue({
+ agentId: null,
+ avatar: null,
+ createdAt: now,
+ description: 'Fetch pages',
+ hasCredentials: true,
+ id: '00000000-0000-4000-8000-000000000001',
+ identifier: 'fetch-mcp',
+ isEnabled: true,
+ mcpConnectionType: 'http',
+ mcpServerUrl: 'https://example.com/mcp',
+ mountedByAgentId: null,
+ name: 'Fetch',
+ sourceType: 'custom',
+ status: 'disconnected',
+ updatedAt: now,
+ userId: OWNER,
+ }),
+ );
+
+ const server = await svc.getServer('00000000-0000-4000-8000-000000000001');
+
+ // Dates leave the API as ISO strings, which is what the schema describes.
+ expect(() => McpServerSchema.parse(JSON.parse(JSON.stringify(server)))).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/services/mcp-server.service.ts b/packages/openapi/src/services/mcp-server.service.ts
index 223ac3070e3..97a704be15e 100644
--- a/packages/openapi/src/services/mcp-server.service.ts
+++ b/packages/openapi/src/services/mcp-server.service.ts
@@ -10,6 +10,7 @@ import { KeyVaultsGateKeeper } from '@/server/modules/KeyVaultsEncrypt';
import { syncConnectorToolsById } from '@/server/services/connector/sync';
import { BaseService } from '../common/base.service';
+import type { DeletedResource } from '../types/common.type';
import type {
CreateMcpServerRequest,
McpServerResponse,
@@ -154,10 +155,10 @@ export class McpServerService extends BaseService {
return this.getServer(id);
}
- async deleteServer(id: string): Promise<{ id: string }> {
+ async deleteServer(id: string): Promise<DeletedResource> {
await this.requireManageableServer(id);
await this.connectorModel.delete(id);
- return { id };
+ return { deleted: true, id };
}
async syncServer(id: string): Promise<{ id: string; status: string; toolCount: number }> {
diff --git a/packages/openapi/src/services/memory.service.test.ts b/packages/openapi/src/services/memory.service.test.ts
new file mode 100644
index 00000000000..3f52c801627
--- /dev/null
+++ b/packages/openapi/src/services/memory.service.test.ts
@@ -0,0 +1,95 @@
+// @vitest-environment node
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import type { LobeChatDatabase } from '@/database/type';
+
+import { DeletedResourceSchema, DeletedResourcesSchema } from '../types/common.type';
+import { MemoryRestService } from './memory.service';
+
+const {
+ deleteAllMock,
+ deletePersonaMock,
+ preferenceDeleteMock,
+ removeIdentityEntryMock,
+ resetMemoryExtractStatusMock,
+} = vi.hoisted(() => ({
+ deleteAllMock: vi.fn(),
+ deletePersonaMock: vi.fn(),
+ preferenceDeleteMock: vi.fn(),
+ removeIdentityEntryMock: vi.fn(),
+ resetMemoryExtractStatusMock: vi.fn(),
+}));
+
+vi.mock('@/database/models/rbac', () => ({ RbacModel: class {} }));
+vi.mock('@/database/models/topic', () => ({
+ TopicModel: class {
+ resetMemoryExtractStatus = resetMemoryExtractStatusMock;
+ },
+}));
+vi.mock('@/database/models/userMemory', () => {
+ const layer = class {
+ delete = vi.fn();
+ };
+ return {
+ UserMemoryActivityModel: layer,
+ UserMemoryContextModel: layer,
+ UserMemoryExperienceModel: layer,
+ UserMemoryModel: class {
+ deleteAll = deleteAllMock;
+ removeIdentityEntry = removeIdentityEntryMock;
+ },
+ UserMemoryPreferenceModel: class {
+ delete = preferenceDeleteMock;
+ },
+ };
+});
+vi.mock('@/database/models/userMemory/persona', () => ({
+ UserPersonaModel: class {
+ deletePersona = deletePersonaMock;
+ },
+}));
+vi.mock('@/database/models/userMemory/where', () => ({ buildUserMemoryWhere: vi.fn() }));
+
+/** A db whose transaction runs the callback on a tx that counts `rows` memories. */
+const fakeDb = (rows: number) => {
+ const tx = {
+ select: () => ({ from: () => ({ where: async () => [{ count: rows }] }) }),
+ };
+ return {
+ transaction: async (fn: (t: typeof tx) => unknown) => fn(tx),
+ } as unknown as LobeChatDatabase;
+};
+
+describe('MemoryRestService deletes', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it('answers an entry delete with the removed id', async () => {
+ removeIdentityEntryMock.mockResolvedValue(true);
+
+ const result = await new MemoryRestService(fakeDb(0), 'user-1').deleteEntry(
+ 'identities',
+ 'idn-1',
+ );
+
+ expect(DeletedResourceSchema.parse(result)).toEqual({ deleted: true, id: 'idn-1' });
+ });
+
+ it('reports an entry the caller does not have as not found', async () => {
+ preferenceDeleteMock.mockResolvedValue({ success: false });
+
+ await expect(
+ new MemoryRestService(fakeDb(0), 'user-1').deleteEntry('preferences', 'pref-1'),
+ ).rejects.toThrow(/Memory entry not found/);
+ });
+
+ it('counts the memories a purge removed and still resets persona and extraction', async () => {
+ const result = await new MemoryRestService(fakeDb(3), 'user-1').deleteAll();
+
+ expect(DeletedResourcesSchema.parse(result)).toEqual({ count: 3, deleted: true });
+ expect(deleteAllMock).toHaveBeenCalledTimes(1);
+ expect(deletePersonaMock).toHaveBeenCalledTimes(1);
+ expect(resetMemoryExtractStatusMock).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/packages/openapi/src/services/memory.service.ts b/packages/openapi/src/services/memory.service.ts
index decbf9441f1..425e18befc6 100644
--- a/packages/openapi/src/services/memory.service.ts
+++ b/packages/openapi/src/services/memory.service.ts
@@ -1,3 +1,5 @@
+import { count as countRows } from 'drizzle-orm';
+
import { TopicModel } from '@/database/models/topic';
import {
UserMemoryActivityModel,
@@ -7,10 +9,13 @@ import {
UserMemoryPreferenceModel,
} from '@/database/models/userMemory';
import { UserPersonaModel } from '@/database/models/userMemory/persona';
+import { buildUserMemoryWhere } from '@/database/models/userMemory/where';
+import { userMemories } from '@/database/schemas';
import type { LobeChatDatabase } from '@/database/type';
import { BaseService } from '../common/base.service';
import type { ServiceResult } from '../types';
+import type { DeletedResource, DeletedResources } from '../types/common.type';
import type { MemoryCategory } from '../types/memory.type';
/**
@@ -74,22 +79,30 @@ export class MemoryRestService extends BaseService {
}
}
- async deleteEntry(category: MemoryCategory, id: string): ServiceResult<unknown> {
+ async deleteEntry(category: MemoryCategory, id: string): ServiceResult<DeletedResource> {
+ const removed = await this.removeEntry(category, id);
+ // The models report a miss instead of throwing; an entry that is not the
+ // caller's (or is already gone) must not read as deleted.
+ if (!removed) throw this.createNotFoundError('Memory entry not found');
+ return { deleted: true, id };
+ }
+
+ private async removeEntry(category: MemoryCategory, id: string): Promise<boolean> {
switch (category) {
case 'identities': {
return this.userMemoryModel.removeIdentityEntry(id);
}
case 'preferences': {
- return this.preferenceModel.delete(id);
+ return (await this.preferenceModel.delete(id)).success;
}
case 'contexts': {
- return this.contextModel.delete(id);
+ return (await this.contextModel.delete(id)).success;
}
case 'activities': {
- return this.activityModel.delete(id);
+ return (await this.activityModel.delete(id)).success;
}
case 'experiences': {
- return this.experienceModel.delete(id);
+ return (await this.experienceModel.delete(id)).success;
}
}
}
@@ -99,9 +112,19 @@ export class MemoryRestService extends BaseService {
* extraction status. Resetting the status matters — without it every topic
* stays marked "extracted" and the purged memories can never come back.
*/
- async deleteAll(): ServiceResult<void> {
- await this.userMemoryModel.deleteAll();
+ async deleteAll(): ServiceResult<DeletedResources> {
+ // `count` is the number of memories actually removed: counted inside the
+ // same transaction as the delete, with the predicate the model deletes by.
+ const count = await this.db.transaction(async (tx) => {
+ const [row] = await tx
+ .select({ count: countRows() })
+ .from(userMemories)
+ .where(buildUserMemoryWhere(tx, this.userId, userMemories));
+ await new UserMemoryModel(tx, this.userId).deleteAll();
+ return Number(row?.count ?? 0);
+ });
await this.personaModel.deletePersona();
await this.topicModel.resetMemoryExtractStatus();
+ return { count, deleted: true };
}
}
diff --git a/packages/openapi/src/services/message-translations.service.ts b/packages/openapi/src/services/message-translations.service.ts
index d53073fea61..325d1a4f7e5 100644
--- a/packages/openapi/src/services/message-translations.service.ts
+++ b/packages/openapi/src/services/message-translations.service.ts
@@ -6,15 +6,15 @@ import type { LobeChatDatabase } from '@/database/type';
import { BaseService } from '../common/base.service';
import { removeSystemContext } from '../helpers/translate';
import type { ServiceResult } from '../types';
+import type { DeletedResource } from '../types/common.type';
import type {
MessageTranslateInfoUpdate,
MessageTranslateResponse,
MessageTranslateTriggerRequest,
+ MessageTranslateWriteResponse,
} from '../types/message-translations.type';
import { ChatService } from './chat.service';
-type MessageTranslateItem = typeof messageTranslates.$inferSelect;
-
export class MessageTranslateService extends BaseService {
constructor(db: LobeChatDatabase, userId: string | null, workspaceId?: string) {
super(db, userId, workspaceId);
@@ -66,7 +66,7 @@ export class MessageTranslateService extends BaseService {
*/
async translateMessage(
translateData: MessageTranslateTriggerRequest,
- ): ServiceResult<Partial<MessageTranslateItem>> {
+ ): ServiceResult<MessageTranslateWriteResponse> {
// Permission check is already done in the route layer (MESSAGE_READ + TRANSLATION_CREATE)
this.log('info', '开始翻译消息', {
@@ -113,7 +113,7 @@ export class MessageTranslateService extends BaseService {
*/
async updateTranslateInfo(
data: MessageTranslateInfoUpdate,
- ): ServiceResult<Partial<MessageTranslateItem>> {
+ ): ServiceResult<MessageTranslateWriteResponse> {
// Permission check is already done in the route layer (MESSAGE_UPDATE + TRANSLATION_UPDATE)
try {
@@ -163,9 +163,7 @@ export class MessageTranslateService extends BaseService {
* @param messageId Message ID
* @returns Deletion result
*/
- async deleteTranslateByMessageId(
- messageId: string,
- ): ServiceResult<{ deleted: boolean; messageId: string }> {
+ async deleteTranslateByMessageId(messageId: string): ServiceResult<DeletedResource> {
// Permission check is already done in the route layer (TRANSLATION_DELETE)
try {
@@ -187,7 +185,7 @@ export class MessageTranslateService extends BaseService {
and(eq(messageTranslates.id, messageId), this.buildWorkspaceWhere(messageTranslates)),
);
- return { deleted: true, messageId };
+ return { deleted: true, id: messageId };
} catch (error) {
this.handleServiceError(error, '删除翻译信息');
}
diff --git a/packages/openapi/src/services/message.service.ts b/packages/openapi/src/services/message.service.ts
index 9aa975f4ef4..5a7c0c85455 100644
--- a/packages/openapi/src/services/message.service.ts
+++ b/packages/openapi/src/services/message.service.ts
@@ -14,6 +14,7 @@ import {
projectPublicTopic,
} from '../helpers/public-fields';
import type { ServiceResult } from '../types';
+import type { DeletedResources } from '../types/common.type';
import { evalPagination as processPaginationConditions } from '../types/eval-resource.type';
import type {
MessageListResponse,
@@ -647,9 +648,9 @@ export class MessageService extends BaseService {
/**
* Delete a single message
* @param messageId Message ID
- * @returns Promise<void>
+ * @returns Whether a message row was actually removed
*/
- async deleteMessage(messageId: string): Promise<void> {
+ async deleteMessage(messageId: string): Promise<boolean> {
try {
// Permission check
const permissionResult = await this.resolveOperationPermission('MESSAGE_DELETE', {
@@ -668,54 +669,50 @@ export class MessageService extends BaseService {
if (permissionWhere) whereConditions.push(permissionWhere);
// Use a transaction to delete messages and their associations with files
- await this.db.transaction(async (trx) => {
- await trx.delete(messages).where(and(...whereConditions));
+ const removed = await this.db.transaction(async (trx) => {
+ const rows = await trx
+ .delete(messages)
+ .where(and(...whereConditions))
+ .returning({ id: messages.id });
+ // Only unlink files of a message this caller actually deleted.
+ if (rows.length === 0) return false;
await trx.delete(messagesFiles).where(eq(messagesFiles.messageId, messageId));
+ return true;
});
- this.log('info', '消息删除成功', { messageId });
+ this.log('info', '消息删除成功', { messageId, removed });
+ return removed;
} catch (error) {
return this.handleServiceError(error, '删除消息');
}
}
/**
- * Delete messages in batch
+ * Delete messages in batch. Best effort: an id the caller may not delete (or
+ * that no longer exists) is skipped rather than failing the whole batch.
* @param messageIds Message ID array
- * @returns Promise<{ success: number; failed: number; errors: any[] }>
+ * @returns `count` = message rows actually removed by this call
*/
- async deleteBatchMessages(messageIds: string[]): Promise<{
- errors: Array<{ error: string; messageId: string }>;
- failed: number;
- success: number;
- }> {
+ async deleteBatchMessages(messageIds: string[]): Promise<DeletedResources> {
try {
- const result = {
- errors: [] as Array<{ error: string; messageId: string }>,
- failed: 0,
- success: 0,
- };
+ let count = 0;
+ let failed = 0;
for (const messageId of messageIds) {
try {
- await this.deleteMessage(messageId);
- result.success++;
+ if (await this.deleteMessage(messageId)) count++;
} catch (error) {
- result.failed++;
- result.errors.push({
+ failed++;
+ this.log('warn', '批量删除消息时跳过一条', {
error: error instanceof Error ? error.message : String(error),
messageId,
});
}
}
- this.log('info', '批量删除消息完成', {
- failed: result.failed,
- success: result.success,
- total: messageIds.length,
- });
+ this.log('info', '批量删除消息完成', { count, failed, total: messageIds.length });
- return result;
+ return { count, deleted: true };
} catch (error) {
return this.handleServiceError(error, '批量删除消息');
}
diff --git a/packages/openapi/src/services/permission.service.test.ts b/packages/openapi/src/services/permission.service.test.ts
new file mode 100644
index 00000000000..a8427b43812
--- /dev/null
+++ b/packages/openapi/src/services/permission.service.test.ts
@@ -0,0 +1,63 @@
+// @vitest-environment node
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import type { LobeChatDatabase } from '@/database/type';
+
+import { DeletedResourceSchema } from '../types/common.type';
+import { PermissionListSchema, PermissionSchema } from '../types/permission.type';
+import { PermissionService } from './permission.service';
+
+vi.mock('@/database/models/rbac', () => ({ RbacModel: class {} }));
+
+const now = new Date('2026-01-01T00:00:00.000Z');
+const PERMISSION_ROW = {
+ category: 'agent',
+ code: 'agent:read:all',
+ createdAt: now,
+ description: null,
+ id: 'perm-0000000001',
+ isActive: true,
+ name: 'Read agents',
+ updatedAt: now,
+};
+
+const json = (value: unknown) => JSON.parse(JSON.stringify(value));
+
+describe('PermissionService response payloads', () => {
+ let db: any;
+
+ beforeEach(() => {
+ db = {
+ delete: vi.fn(() => ({
+ where: vi.fn(() => ({ returning: vi.fn().mockResolvedValue([{ id: PERMISSION_ROW.id }]) })),
+ })),
+ query: {
+ permissions: {
+ findFirst: vi.fn().mockResolvedValue(PERMISSION_ROW),
+ findMany: vi.fn().mockResolvedValue([PERMISSION_ROW]),
+ },
+ rolePermissions: { findFirst: vi.fn().mockResolvedValue(undefined) },
+ },
+ select: vi.fn(() => ({
+ from: vi.fn(() => ({ where: vi.fn().mockResolvedValue([{ count: 1 }]) })),
+ })),
+ };
+ });
+
+ const service = () => new PermissionService(db as LobeChatDatabase, 'user-1');
+
+ it('returns permissions in the documented shapes', async () => {
+ const list = await service().getPermissions({});
+ const detail = await service().getPermissionById(PERMISSION_ROW.id);
+
+ expect(() => PermissionListSchema.parse(json(list))).not.toThrow();
+ expect(() => PermissionSchema.parse(json(detail))).not.toThrow();
+ });
+
+ it('deletes a permission and answers with the deleted id', async () => {
+ const result = await service().deletePermission(PERMISSION_ROW.id);
+
+ expect(result).toEqual({ deleted: true, id: PERMISSION_ROW.id });
+ expect(() => DeletedResourceSchema.parse(result)).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/services/permission.service.ts b/packages/openapi/src/services/permission.service.ts
index d51d6d0f409..249d72a19b2 100644
--- a/packages/openapi/src/services/permission.service.ts
+++ b/packages/openapi/src/services/permission.service.ts
@@ -7,6 +7,7 @@ import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
import { projectPublicPermission, type PublicPermission } from '../helpers/public-fields';
import type { ServiceResult } from '../types';
+import type { DeletedResource } from '../types/common.type';
import type {
CreatePermissionRequest,
PermissionsListQuery,
@@ -169,7 +170,7 @@ export class PermissionService extends BaseService {
/**
* Delete permission by ID
*/
- async deletePermission(id: string): ServiceResult<{ id: string }> {
+ async deletePermission(id: string): ServiceResult<DeletedResource> {
try {
const existingPermission = await this.db.query.permissions.findFirst({
where: eq(permissions.id, id),
@@ -197,7 +198,7 @@ export class PermissionService extends BaseService {
throw this.createBusinessError('Failed to delete permission');
}
- return deleted;
+ return { deleted: true, id: deleted.id };
} catch (error) {
this.handleServiceError(error, '删除权限');
}
diff --git a/packages/openapi/src/services/provider.service.ts b/packages/openapi/src/services/provider.service.ts
index cd0e6c9a8d1..87196959e31 100644
--- a/packages/openapi/src/services/provider.service.ts
+++ b/packages/openapi/src/services/provider.service.ts
@@ -10,6 +10,7 @@ import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
import { projectPublicProvider } from '../helpers/public-fields';
import type { ServiceResult } from '../types';
+import type { DeletedResource } from '../types/common.type';
import type {
CreateProviderRequest,
DeleteProviderRequest,
@@ -303,7 +304,7 @@ export class ProviderService extends BaseService {
}
}
- async deleteProvider(request: DeleteProviderRequest): ServiceResult<{ id: string }> {
+ async deleteProvider(request: DeleteProviderRequest): ServiceResult<DeletedResource> {
this.log('info', '删除 Provider', {
id: request.id,
userId: this.userId,
@@ -354,7 +355,7 @@ export class ProviderService extends BaseService {
id: request.id,
});
- return { id: request.id };
+ return { deleted: true, id: request.id };
} catch (error) {
this.handleServiceError(error, '删除 Provider');
}
diff --git a/packages/openapi/src/services/role.service.test.ts b/packages/openapi/src/services/role.service.test.ts
new file mode 100644
index 00000000000..98230140a4c
--- /dev/null
+++ b/packages/openapi/src/services/role.service.test.ts
@@ -0,0 +1,92 @@
+// @vitest-environment node
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import type { LobeChatDatabase } from '@/database/type';
+
+import { DeletedResourceSchema, DeletedResourcesSchema } from '../types/common.type';
+import { RoleListSchema, RolePermissionsUpdateResultSchema } from '../types/role.type';
+import { RoleService } from './role.service';
+
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = vi.fn().mockResolvedValue(true);
+ },
+}));
+
+const now = new Date('2026-01-01T00:00:00.000Z');
+const ROLE_ROW = {
+ createdAt: now,
+ description: null,
+ displayName: 'Editor',
+ id: 'role-1',
+ isActive: true,
+ isSystem: false,
+ metadata: {},
+ name: 'editor',
+ updatedAt: now,
+ workspaceId: null,
+};
+
+/** A `delete(...).where(...).returning(...)` chain resolving to `rows`. */
+const deleteReturning = (rows: unknown[]) =>
+ vi.fn(() => ({ where: vi.fn(() => ({ returning: vi.fn().mockResolvedValue(rows) })) }));
+
+const json = (value: unknown) => JSON.parse(JSON.stringify(value));
+
+describe('RoleService response payloads', () => {
+ let db: any;
+
+ beforeEach(() => {
+ db = {
+ delete: deleteReturning([]),
+ query: {
+ permissions: { findMany: vi.fn().mockResolvedValue([]) },
+ roles: {
+ findFirst: vi.fn().mockResolvedValue(ROLE_ROW),
+ findMany: vi.fn().mockResolvedValue([ROLE_ROW]),
+ },
+ userRoles: { findFirst: vi.fn().mockResolvedValue(undefined) },
+ },
+ select: vi.fn(() => ({
+ from: vi.fn(() => ({ where: vi.fn().mockResolvedValue([{ count: 1 }]) })),
+ })),
+ };
+ db.transaction = vi.fn((run: (tx: unknown) => unknown) => run(db));
+ });
+
+ const service = () => new RoleService(db as LobeChatDatabase, 'user-1');
+
+ it('lists roles as the public projection', async () => {
+ const result = await service().getRoles({});
+
+ expect(result.roles[0]).not.toHaveProperty('workspaceId');
+ expect(() => RoleListSchema.parse(json(result))).not.toThrow();
+ });
+
+ it('deletes a role and answers with the deleted id', async () => {
+ db.delete = deleteReturning([{ id: 'role-1' }]);
+
+ const result = await service().deleteRole('role-1');
+
+ expect(result).toEqual({ deleted: true, id: 'role-1' });
+ expect(() => DeletedResourceSchema.parse(result)).not.toThrow();
+ });
+
+ it('clears role permissions and counts the mappings it removed', async () => {
+ db.delete = deleteReturning([{ permissionId: 'p-1' }, { permissionId: 'p-2' }]);
+
+ const result = await service().clearRolePermissions('role-1');
+
+ expect(result).toEqual({ count: 2, deleted: true });
+ expect(() => DeletedResourcesSchema.parse(result)).not.toThrow();
+ });
+
+ it('reports revoked permission mappings in the documented shape', async () => {
+ db.delete = deleteReturning([{ permissionId: 'p-1' }]);
+
+ const result = await service().updateRolePermissions('role-1', { revoke: ['p-1'] });
+
+ expect(result).toEqual({ granted: 0, revoked: 1, roleId: 'role-1' });
+ expect(() => RolePermissionsUpdateResultSchema.parse(result)).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/services/role.service.ts b/packages/openapi/src/services/role.service.ts
index 5d562240b3f..1a1f1ae8cc0 100644
--- a/packages/openapi/src/services/role.service.ts
+++ b/packages/openapi/src/services/role.service.ts
@@ -1,5 +1,5 @@
import type { SQL } from 'drizzle-orm';
-import { and, count, eq, ilike, inArray, isNull, or, sql } from 'drizzle-orm';
+import { and, count, eq, ilike, inArray, isNull, or } from 'drizzle-orm';
import { permissions, rolePermissions, roles, userRoles } from '@/database/schemas/rbac';
import type { LobeChatDatabase } from '@/database/type';
@@ -8,6 +8,7 @@ import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
import { projectPublicRole, type PublicRole } from '../helpers/public-fields';
import type { ServiceResult } from '../types';
+import type { DeletedResource, DeletedResources } from '../types/common.type';
import type {
CreateRoleRequest,
RolePermissionsListRequest,
@@ -463,7 +464,7 @@ export class RoleService extends BaseService {
/**
* Clear a role's permission mappings
*/
- async clearRolePermissions(roleId: string): ServiceResult<{ removed: number; roleId: string }> {
+ async clearRolePermissions(roleId: string): ServiceResult<DeletedResources> {
this.log('info', 'clear role permissions', { roleId });
// Permission check
@@ -483,15 +484,13 @@ export class RoleService extends BaseService {
throw this.createNotFoundError(`Role ID "${roleId}" not found`);
}
- // Count and delete
- const before = await this.db
- .select({ count: sql<number>`count(*)` })
- .from(rolePermissions)
- .where(eq(rolePermissions.roleId, roleId));
+ // `count` is the number of mappings this call actually removed.
+ const removed = await this.db
+ .delete(rolePermissions)
+ .where(eq(rolePermissions.roleId, roleId))
+ .returning({ permissionId: rolePermissions.permissionId });
- await this.db.delete(rolePermissions).where(eq(rolePermissions.roleId, roleId));
-
- return { removed: Number(before[0]?.count || 0), roleId };
+ return { count: removed.length, deleted: true };
} catch (error) {
this.handleServiceError(error, 'clear role permissions');
}
@@ -500,7 +499,7 @@ export class RoleService extends BaseService {
/**
* Delete role by ID
*/
- async deleteRole(id: string): ServiceResult<{ deleted: boolean; id: string }> {
+ async deleteRole(id: string): ServiceResult<DeletedResource> {
this.log('info', 'delete role', { roleId: id });
const permissionResult = await this.resolveOperationPermission('RBAC_ROLE_DELETE');
diff --git a/packages/openapi/src/services/task.service.test.ts b/packages/openapi/src/services/task.service.test.ts
index 575a70e695c..d14217d4a0f 100644
--- a/packages/openapi/src/services/task.service.test.ts
+++ b/packages/openapi/src/services/task.service.test.ts
@@ -4,6 +4,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import type { LobeChatDatabase } from '@/database/type';
+import { DeletedResourceSchema } from '../types/common.type';
import { TaskRestService } from './task.service';
const {
@@ -102,6 +103,15 @@ const CALLER = 'me';
const WORKSPACE = 'ws-1';
describe('TaskRestService delete scope', () => {
+ it('answers with the resolved row id when the path carries the identifier', async () => {
+ resolveMock.mockResolvedValue({ createdByUserId: CALLER, id: 'task-1' });
+ deleteTaskMock.mockResolvedValue({ id: 'task-1' });
+
+ const result = await new TaskRestService({} as LobeChatDatabase, CALLER).deleteTask('T-1');
+
+ expect(DeletedResourceSchema.parse(result)).toEqual({ deleted: true, id: 'task-1' });
+ });
+
const service = (workspaceId?: string) =>
new TaskRestService({} as LobeChatDatabase, CALLER, workspaceId);
@@ -114,7 +124,10 @@ describe('TaskRestService delete scope', () => {
it('deletes a visible task created by another workspace member', async () => {
deleteTaskMock.mockResolvedValue({ id: 'task-1' });
- await expect(service(WORKSPACE).deleteTask('task-1')).resolves.toEqual({ id: 'task-1' });
+ await expect(service(WORKSPACE).deleteTask('task-1')).resolves.toEqual({
+ deleted: true,
+ id: 'task-1',
+ });
expect(deleteTaskMock).toHaveBeenCalledWith('task-1');
});
@@ -129,7 +142,10 @@ describe('TaskRestService delete scope', () => {
resolveMock.mockResolvedValue({ createdByUserId: CALLER, id: 'task-1' });
deleteTaskMock.mockResolvedValue({ id: 'task-1' });
- await expect(service(WORKSPACE).deleteTask('task-1')).resolves.toEqual({ id: 'task-1' });
+ await expect(service(WORKSPACE).deleteTask('task-1')).resolves.toEqual({
+ deleted: true,
+ id: 'task-1',
+ });
expect(deleteTaskMock).toHaveBeenCalledWith('task-1');
});
});
diff --git a/packages/openapi/src/services/task.service.ts b/packages/openapi/src/services/task.service.ts
index f15508e48fa..129617c7d57 100644
--- a/packages/openapi/src/services/task.service.ts
+++ b/packages/openapi/src/services/task.service.ts
@@ -17,6 +17,7 @@ import { TaskRunnerService } from '@/server/services/taskRunner';
import { BaseService } from '../common/base.service';
import type { ServiceResult } from '../types';
+import type { DeletedResource } from '../types/common.type';
import type {
CreateTaskRequest,
RunTaskRequest,
@@ -186,11 +187,13 @@ export class TaskRestService extends BaseService {
return rows.map(toPublicRun);
}
- async deleteTask(id: string): ServiceResult<unknown> {
+ async deleteTask(id: string): ServiceResult<DeletedResource> {
// Same scope as the tRPC delete: the route's `agent:update` gate plus the
// model's visibility-aware `resolve`, whoever created the task.
const task = await this.taskModel.resolve(id);
if (!task) throw this.createNotFoundError('Task not found');
- return this.taskService.deleteTask(task.id);
+ await this.taskService.deleteTask(task.id);
+ // The path may carry the display identifier (`T-12`); answer with the row id.
+ return { deleted: true, id: task.id };
}
}
diff --git a/packages/openapi/src/services/user.service.test.ts b/packages/openapi/src/services/user.service.test.ts
new file mode 100644
index 00000000000..73816182dac
--- /dev/null
+++ b/packages/openapi/src/services/user.service.test.ts
@@ -0,0 +1,106 @@
+// @vitest-environment node
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import type { LobeChatDatabase } from '@/database/type';
+
+import { DeletedResourceSchema, DeletedResourcesSchema } from '../types/common.type';
+import { UserRoleSchema, UserSchema } from '../types/user.type';
+import { UserService } from './user.service';
+
+const deleteUserMock = vi.hoisted(() => vi.fn());
+
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = vi.fn().mockResolvedValue(true);
+ },
+}));
+vi.mock('@/database/models/user', () => ({ UserModel: { deleteUser: deleteUserMock } }));
+
+const now = new Date('2026-01-01T00:00:00.000Z');
+const USER_ROW = {
+ avatar: null,
+ createdAt: now,
+ email: '[email protected]',
+ firstName: null,
+ fullName: 'Someone',
+ id: 'user-1',
+ isOnboarded: true,
+ lastName: null,
+ phone: null,
+ preference: { language: 'en-US' },
+ updatedAt: now,
+ username: 'someone',
+};
+const ROLE_ROW = {
+ createdAt: now,
+ description: null,
+ displayName: 'Editor',
+ id: 'role-1',
+ isActive: true,
+ isSystem: false,
+ metadata: {},
+ name: 'editor',
+ updatedAt: now,
+ workspaceId: null,
+};
+
+const json = (value: unknown) => JSON.parse(JSON.stringify(value));
+
+/** A select chain (`from` / `innerJoin` / `where`) that resolves to `rows`. */
+const selectResolving = (rows: unknown[]) => {
+ const chain: any = {};
+ chain.from = vi.fn(() => chain);
+ chain.innerJoin = vi.fn(() => chain);
+ chain.where = vi.fn().mockResolvedValue(rows);
+ return vi.fn(() => chain);
+};
+
+describe('UserService response payloads', () => {
+ let db: any;
+
+ beforeEach(() => {
+ deleteUserMock.mockReset();
+ db = {
+ delete: vi.fn(() => ({
+ where: vi.fn(() => ({
+ returning: vi.fn().mockResolvedValue([{ id: 'assignment-1' }, { id: 'assignment-2' }]),
+ })),
+ })),
+ query: { users: { findFirst: vi.fn().mockResolvedValue(USER_ROW) } },
+ select: selectResolving([{ roles: ROLE_ROW }]),
+ };
+ });
+
+ const service = () => new UserService(db as LobeChatDatabase, 'user-1');
+
+ it('returns a user as the public projection with roles', async () => {
+ const user = await service().getUserById('user-1');
+
+ expect(user).not.toHaveProperty('preference');
+ expect(() => UserSchema.parse(json(user))).not.toThrow();
+ });
+
+ it('returns user role assignments in the documented shape', async () => {
+ db.select = selectResolving([{ role: ROLE_ROW, userRole: { expiresAt: null } }]);
+
+ const roles = await service().getUserRoles('user-1');
+
+ expect(() => UserRoleSchema.array().parse(json(roles))).not.toThrow();
+ });
+
+ it('deletes a user and answers with the deleted id', async () => {
+ deleteUserMock.mockResolvedValue({ rowCount: 1 });
+
+ const result = await service().deleteUser('user-1');
+
+ expect(result).toEqual({ deleted: true, id: 'user-1' });
+ expect(() => DeletedResourceSchema.parse(result)).not.toThrow();
+ });
+
+ it('clears user roles and counts the assignments it removed', async () => {
+ const result = await service().clearUserRoles('user-1');
+
+ expect(result).toEqual({ count: 2, deleted: true });
+ expect(() => DeletedResourcesSchema.parse(result)).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/services/user.service.ts b/packages/openapi/src/services/user.service.ts
index 1b5de3e2d7d..5cd3dd75fd6 100644
--- a/packages/openapi/src/services/user.service.ts
+++ b/packages/openapi/src/services/user.service.ts
@@ -12,6 +12,7 @@ import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
import { projectPublicRole, projectPublicUser } from '../helpers/public-fields';
import type { ServiceResult } from '../types';
+import type { DeletedResource, DeletedResources } from '../types/common.type';
import type {
CreateUserRequest,
UpdateUserRequest,
@@ -322,7 +323,7 @@ export class UserService extends BaseService {
* @param userId User ID
* @returns Delete operation result
*/
- async deleteUser(userId: string): ServiceResult<{ id: string }> {
+ async deleteUser(userId: string): ServiceResult<DeletedResource> {
this.log('info', '删除用户', { userId });
try {
@@ -354,7 +355,7 @@ export class UserService extends BaseService {
this.log('info', '用户删除成功', { userId });
- return { id: userId };
+ return { deleted: true, id: userId };
} catch (error) {
return this.handleServiceError(error, '删除用户');
}
@@ -557,7 +558,7 @@ export class UserService extends BaseService {
/**
* Clear all roles for a user
*/
- async clearUserRoles(userId: string): ServiceResult<{ removed: number; userId: string }> {
+ async clearUserRoles(userId: string): ServiceResult<DeletedResources> {
this.log('info', '清空用户角色', { userId });
try {
@@ -576,17 +577,13 @@ export class UserService extends BaseService {
throw this.createNotFoundError(`用户 ${userId} 不存在`);
}
- // Count and delete
- const beforeCount = await this.db
- .select({ count: count() })
- .from(userRoles)
- .where(and(eq(userRoles.userId, userId), this.buildPermissionWhere(userRoles, { userId })));
-
- await this.db
+ // `count` is the number of assignments this call actually removed.
+ const removed = await this.db
.delete(userRoles)
- .where(and(eq(userRoles.userId, userId), this.buildPermissionWhere(userRoles, { userId })));
+ .where(and(eq(userRoles.userId, userId), this.buildPermissionWhere(userRoles, { userId })))
+ .returning({ id: userRoles.id });
- return { removed: beforeCount[0]?.count || 0, userId };
+ return { count: removed.length, deleted: true };
} catch (error) {
return this.handleServiceError(error, '清空用户角色');
}
diff --git a/packages/openapi/src/spec.test.ts b/packages/openapi/src/spec.test.ts
index 9960e51f3f6..d537acb0452 100644
--- a/packages/openapi/src/spec.test.ts
+++ b/packages/openapi/src/spec.test.ts
@@ -1,28 +1,190 @@
import { Hono } from 'hono';
import { describeRoute } from 'hono-openapi';
-import { describe, expect, it } from 'vitest';
+import { beforeAll, describe, expect, it } from 'vitest';
+import { z } from 'zod';
-import { buildSpecDocument } from './spec';
+import { routeDoc } from './common/openapi';
+import { buildSpecDocument, collectSpecDocument } from './spec';
-describe('public eval creation response contracts', () => {
- it('documents resource creation and agent duplication as 201, and run acceptance as 202', async () => {
- const app = new Hono();
- const paths = [
- '/api/v1/eval/benchmarks',
- '/api/v1/eval/datasets',
- '/api/v1/eval/datasets/:datasetId/test-cases',
- '/api/v1/agents/:id/duplicate',
- ];
- for (const path of paths)
- app.post(path, describeRoute({ summary: 'Create resource' }), (c) => c.json({}, 201));
- app.post('/api/v1/eval/runs', describeRoute({ summary: 'Create run' }), (c) => c.json({}, 202));
- const spec = await buildSpecDocument(app);
- for (const path of paths) {
- const key = path.replaceAll(/:([^/]+)/g, '{$1}');
- const responses = spec.paths![key].post!.responses!;
- expect(responses).toHaveProperty('201');
- expect(responses).not.toHaveProperty('200');
+type Schema = Record<string, unknown>;
+type Spec = Awaited<ReturnType<typeof buildSpecDocument>>;
+
+/**
+ * Success responses allowed to stay open-ended, keyed `METHOD path` with the
+ * reason. Empty on purpose: every operation declares a concrete payload. Add an
+ * entry only for a payload whose keys are genuinely owned by the caller, and
+ * say why in the value.
+ */
+const OPEN_RESPONSE_ALLOWLIST: Record<string, string> = {};
+
+const HTTP_METHODS = new Set(['delete', 'get', 'patch', 'post', 'put']);
+
+const loadAppSpec = async (): Promise<Spec> => {
+ // Same safe defaults as `scripts/generate-openapi.ts`: importing the app must
+ // not reach real infrastructure.
+ process.env.KEY_VAULTS_SECRET ??= 'openapi-spec-test';
+ process.env.CLOUD_DATABASE_URL ??= 'postgresql://mock:mock@localhost:5432/mock';
+ process.env.QSTASH_TOKEN ??= 'mock-qstash-token';
+ const { honoApp } = await import('./app');
+ return buildSpecDocument(honoApp);
+};
+
+const resolveRef = (spec: Spec, schema: Schema): Schema => {
+ const ref = schema.$ref;
+ if (typeof ref !== 'string') return schema;
+ const name = ref.replace('#/components/schemas/', '');
+ return (spec.components?.schemas?.[name] ?? {}) as Schema;
+};
+
+/** A schema that says nothing about its keys: `{}` / `additionalProperties` with no properties. */
+const isOpaque = (schema: Schema) => {
+ const keys = Object.keys(schema).filter((key) => key !== 'description');
+ if (keys.length === 0) return true;
+ if (schema.properties) return false;
+ return (
+ schema.additionalProperties === true ||
+ (typeof schema.additionalProperties === 'object' &&
+ Object.keys(schema.additionalProperties as Schema).length === 0 &&
+ !schema.anyOf &&
+ !schema.oneOf)
+ );
+};
+
+/** Every location under `schema` that admits arbitrary undeclared keys (`additionalProperties: true`). */
+const findOpenNodes = (spec: Spec, schema: Schema, at: string, seen = new Set<string>()) => {
+ const found: string[] = [];
+ const visit = (node: unknown, path: string) => {
+ if (!node || typeof node !== 'object') return;
+ const current = node as Schema;
+ if (typeof current.$ref === 'string') {
+ if (seen.has(current.$ref)) return;
+ seen.add(current.$ref);
+ visit(resolveRef(spec, current), `${path}→${current.$ref.split('/').pop()}`);
+ return;
+ }
+ if (current.additionalProperties === true) found.push(path);
+ for (const [key, value] of Object.entries(current)) {
+ if (Array.isArray(value))
+ value.forEach((item, index) => visit(item, `${path}.${key}[${index}]`));
+ else if (value && typeof value === 'object') visit(value, `${path}.${key}`);
}
- expect(spec.paths!['/api/v1/eval/runs'].post!.responses).toHaveProperty('202');
+ };
+ visit(schema, at);
+ return found;
+};
+
+/** The payload a client reads: `data` of the success envelope, or the whole body. */
+const payloadOf = (spec: Spec, body: Schema): Schema => {
+ const resolved = resolveRef(spec, body);
+ const properties = resolved.properties as Record<string, Schema> | undefined;
+ return properties?.success && properties.data ? resolveRef(spec, properties.data) : resolved;
+};
+
+const successResponses = (spec: Spec) =>
+ Object.entries(spec.paths ?? {}).flatMap(([path, item]) =>
+ Object.entries(item as Record<string, { responses?: Record<string, any> }>)
+ .filter(([method]) => HTTP_METHODS.has(method))
+ .flatMap(([method, op]) =>
+ Object.entries(op.responses ?? {})
+ .filter(([status]) => status.startsWith('2'))
+ .map(([status, response]) => ({
+ binary: Object.entries(response.content ?? {}).some(
+ ([media, body]: [string, any]) =>
+ media !== 'application/json' && body?.schema?.format === 'binary',
+ ),
+ key: `${method.toUpperCase()} ${path}`,
+ schema: response.content?.['application/json']?.schema as Schema | undefined,
+ status,
+ })),
+ ),
+ );
+
+describe('generated OpenAPI document', () => {
+ let spec: Spec;
+
+ beforeAll(async () => {
+ spec = await loadAppSpec();
+ }, 60_000);
+
+ // Binary bodies (synthesized audio) are the one non-JSON success shape.
+ it('gives every operation a JSON or binary success response', () => {
+ const missing = successResponses(spec)
+ .filter(({ binary, schema }) => !schema && !binary)
+ .map(({ key }) => key);
+ expect(missing).toEqual([]);
+ });
+
+ it('declares no open-ended success payloads outside the allowlist', () => {
+ const violations = successResponses(spec)
+ .filter(({ key }) => !(key in OPEN_RESPONSE_ALLOWLIST))
+ .flatMap(({ key, schema, status }) => {
+ if (!schema) return [];
+ const payload = payloadOf(spec, schema);
+ const items = payload.type === 'array' ? resolveRef(spec, payload.items as Schema) : null;
+ const opaqueRoot = isOpaque(payload) || (items && isOpaque(items));
+ return [
+ ...(opaqueRoot ? [`${key} ${status}: payload is opaque`] : []),
+ ...findOpenNodes(spec, schema, `${key} ${status}`).map(
+ (at) => `${at}: additionalProperties: true`,
+ ),
+ ];
+ });
+
+ expect(violations).toEqual([]);
+ });
+
+ it('keeps the allowlist free of stale entries', () => {
+ const operations = new Set(successResponses(spec).map(({ key }) => key));
+ expect(Object.keys(OPEN_RESPONSE_ALLOWLIST).filter((key) => !operations.has(key))).toEqual([]);
+ });
+
+ // A `$defs` ref (what `z.toJSONSchema` emits for a schema carrying a meta id)
+ // is unresolvable for the SDK generator, which crashes on it.
+ it('references components only, never local $defs', () => {
+ expect(JSON.stringify(spec)).not.toContain('#/$defs/');
+ });
+});
+
+describe('route-declared responses', () => {
+ const buildApp = () => {
+ const app = new Hono();
+ app.post(
+ '/api/v1/things',
+ routeDoc({ data: z.object({ id: z.string() }), status: 201, summary: 'Create a thing' }),
+ (c) => c.json({}, 201),
+ );
+ app.post(
+ '/api/v1/things/:id/runs',
+ routeDoc({
+ data: z.object({ runId: z.string() }),
+ errors: [404, 409],
+ status: 202,
+ summary: 'Run a thing',
+ }),
+ (c) => c.json({}, 202),
+ );
+ return app;
+ };
+
+ it('documents the declared success status and nothing else', async () => {
+ const spec = await buildSpecDocument(buildApp());
+ const created = (spec.paths?.['/api/v1/things'] as any).post.responses;
+ const accepted = (spec.paths?.['/api/v1/things/{id}/runs'] as any).post.responses;
+
+ expect(Object.keys(created)).toEqual(['201', '401', '403', '500']);
+ expect(Object.keys(accepted)).toEqual(['202', '401', '403', '404', '409', '500']);
+ expect(created['201'].content['application/json'].schema.properties.data).toMatchObject({
+ properties: { id: { type: 'string' } },
+ required: ['id'],
+ });
+ });
+
+ it('refuses to emit a route without a declared success response', async () => {
+ const app = buildApp();
+ app.get('/api/v1/vague', describeRoute({ summary: 'Vague' }), (c) => c.json({}));
+
+ const { undocumented } = await collectSpecDocument(app);
+ expect(undocumented).toEqual(['GET /api/v1/vague']);
+ await expect(buildSpecDocument(app)).rejects.toThrow('GET /api/v1/vague');
});
});
diff --git a/packages/openapi/src/spec.ts b/packages/openapi/src/spec.ts
index e99bc250f80..7f0892d917c 100644
--- a/packages/openapi/src/spec.ts
+++ b/packages/openapi/src/spec.ts
@@ -1,16 +1,8 @@
-import {
- AGENT_ACCOUNT_DIGEST_MINUTES_RANGE,
- AGENT_ACCOUNT_PERSISTED_KINDS,
- AGENT_ACCOUNT_STATUSES,
- AGENT_ACCOUNT_WAKE_MODES,
-} from '@lobechat/types';
import { API_KEY_PREFIX } from '@lobechat/utils/apiKey';
import { generateSpecs } from 'hono-openapi';
+import { z } from 'zod';
-import { API_KEY_SCOPES } from '@/const/apiKeyScope';
-import type { AgentAccountView } from '@/database/models/agentAccount';
-
-import { evalResponseSchema } from './types/eval-response.type';
+import { ApiErrorSchema, errorResponse } from './common/openapi';
const HTTP_METHODS = new Set(['DELETE', 'GET', 'PATCH', 'POST', 'PUT']);
@@ -18,1043 +10,52 @@ type GenerateSpecsApp = Parameters<typeof generateSpecs>[0];
interface OperationObject {
operationId?: string;
- responses?: Record<string, unknown>;
+ responses?: Record<string, { content?: unknown; description?: string }>;
tags?: string[];
}
-type SchemaObject = Record<string, unknown>;
-
-const dateTime = { format: 'date-time', type: 'string' } as const;
-const nullableString = { type: ['string', 'null'] } as const;
-const nullableBoolean = { type: ['boolean', 'null'] } as const;
-const nullableNumber = { type: ['number', 'null'] } as const;
-const nullableObject = { additionalProperties: true, type: ['object', 'null'] } as const;
+const { $schema: _, ...apiErrorJsonSchema } = z.toJSONSchema(ApiErrorSchema) as Record<
+ string,
+ unknown
+>;
/**
- * Every field an account view carries. Typed against the view so a column added
- * to it fails type-checking here rather than being silently dropped from the
- * SDK — the schema sets `additionalProperties: false`, so a missing field also
- * makes strict response validators reject real payloads.
- */
-const agentAccountProperties = {
- /** Last time the account was read or used — every account view carries it. */
- accessedAt: dateTime,
- agentId: { type: 'string' },
- capabilities: {
- additionalProperties: false,
- properties: {
- login: nullableBoolean,
- receive: { type: 'boolean' },
- send: { type: 'boolean' },
- sign: nullableBoolean,
- },
- required: ['receive', 'send'],
- type: 'object',
- },
- createdAt: dateTime,
- credentialHint: nullableObject,
- displayName: nullableString,
- /** Whether a secret is installed. Never the secret itself. */
- hasCredential: { type: 'boolean' },
- id: { type: 'string' },
- identifier: { type: 'string' },
- // The persisted kinds, not just the creatable ones: an unfiltered read still
- // returns retired-kind rows, and the response contract must not exclude a
- // value the API actually returns.
- kind: { enum: AGENT_ACCOUNT_PERSISTED_KINDS, type: 'string' },
- metadata: nullableObject,
- provider: { type: 'string' },
- revokedAt: { ...dateTime, type: ['string', 'null'] },
- // The owner's own settings. Stored JSON, so a field a later build adds may appear.
- settings: {
- additionalProperties: true,
- properties: {
- wake: {
- additionalProperties: true,
- properties: {
- digestMinutes: {
- maximum: AGENT_ACCOUNT_DIGEST_MINUTES_RANGE.max,
- minimum: AGENT_ACCOUNT_DIGEST_MINUTES_RANGE.min,
- type: 'integer',
- },
- mode: { enum: AGENT_ACCOUNT_WAKE_MODES, type: 'string' },
- wakeSenders: { items: { type: 'string' }, type: 'array' },
- },
- type: 'object',
- },
- },
- type: 'object',
- },
- status: { enum: AGENT_ACCOUNT_STATUSES, type: 'string' },
- updatedAt: dateTime,
- userId: { type: 'string' },
- workspaceId: nullableString,
-} satisfies Record<keyof AgentAccountView, SchemaObject>;
-
-const resourceSchemas: Record<string, SchemaObject> = {
- AgentAccount: {
- additionalProperties: false,
- properties: agentAccountProperties,
- required: [
- 'id',
- 'agentId',
- 'kind',
- 'identifier',
- 'provider',
- 'status',
- 'capabilities',
- 'hasCredential',
- 'accessedAt',
- 'createdAt',
- 'updatedAt',
- ],
- type: 'object',
- },
- ApiKey: {
- additionalProperties: false,
- properties: {
- createdAt: dateTime,
- enabled: nullableBoolean,
- expiresAt: { ...dateTime, type: ['string', 'null'] },
- id: { type: 'string' },
- lastUsedAt: { ...dateTime, type: ['string', 'null'] },
- name: { type: 'string' },
- scopes: { items: { enum: API_KEY_SCOPES, type: 'string' }, type: ['array', 'null'] },
- updatedAt: dateTime,
- },
- required: ['id', 'name', 'createdAt', 'updatedAt'],
- type: 'object',
- },
- Agent: {
- additionalProperties: false,
- properties: {
- avatar: nullableString,
- chatConfig: nullableObject,
- createdAt: dateTime,
- description: nullableString,
- id: { type: 'string' },
- model: nullableString,
- params: nullableObject,
- personal: { type: 'boolean' },
- plugins: {
- type: 'array',
- items: {
- type: 'object',
- additionalProperties: false,
- properties: {
- identifier: { type: 'string' },
- mode: { type: 'string', enum: ['pinned', 'auto', 'disabled'] },
- },
- required: ['identifier', 'mode'],
- },
- },
- provider: nullableString,
- slug: nullableString,
- systemRole: nullableString,
- title: nullableString,
- updatedAt: dateTime,
- },
- required: ['id', 'createdAt', 'updatedAt'],
- type: 'object',
- },
- AgentGroup: {
- additionalProperties: false,
- properties: {
- createdAt: dateTime,
- id: { type: 'string' },
- name: { type: 'string' },
- sort: { type: ['integer', 'null'] },
- updatedAt: dateTime,
- },
- required: ['id', 'name', 'createdAt', 'updatedAt'],
- type: 'object',
- },
- ChatGroup: {
- additionalProperties: false,
- properties: {
- avatar: nullableString,
- backgroundColor: nullableString,
- createdAt: dateTime,
- description: nullableString,
- id: { type: 'string' },
- members: {
- items: {
- additionalProperties: false,
- properties: {
- agentId: { type: 'string' },
- enabled: nullableBoolean,
- order: { type: ['integer', 'null'] },
- role: {
- enum: ['supervisor', 'participant', 'assistant', null],
- type: ['string', 'null'],
- },
- },
- required: ['agentId', 'enabled', 'order', 'role'],
- type: 'object',
- },
- type: 'array',
- },
- personal: { type: 'boolean' },
- pinned: nullableBoolean,
- title: nullableString,
- updatedAt: dateTime,
- },
- required: [
- 'id',
- 'title',
- 'description',
- 'avatar',
- 'backgroundColor',
- 'personal',
- 'pinned',
- 'members',
- 'createdAt',
- 'updatedAt',
- ],
- type: 'object',
- },
- ChatResponse: {
- additionalProperties: false,
- properties: {
- content: { type: 'string' },
- model: nullableString,
- provider: nullableString,
- usage: {
- additionalProperties: false,
- properties: {
- completion_tokens: { type: ['integer', 'null'] },
- prompt_tokens: { type: ['integer', 'null'] },
- total_tokens: { type: ['integer', 'null'] },
- },
- type: ['object', 'null'],
- },
- },
- required: ['content'],
- type: 'object',
- },
- EvalRun: {
- additionalProperties: false,
- properties: {
- createdAt: dateTime,
- datasetId: { type: 'string' },
- id: { type: 'string' },
- metrics: nullableObject,
- name: nullableString,
- startedAt: { ...dateTime, type: ['string', 'null'] },
- status: {
- enum: ['idle', 'pending', 'running', 'completed', 'failed', 'aborted', 'external'],
- type: 'string',
- },
- targetAgentId: nullableString,
- updatedAt: dateTime,
- },
- required: ['id', 'datasetId', 'status', 'createdAt', 'updatedAt'],
- type: 'object',
- },
- EvalRunResult: {
- additionalProperties: false,
- properties: {
- createdAt: dateTime,
- input: { type: 'string' },
- passed: nullableBoolean,
- result: nullableObject,
- score: nullableNumber,
- status: nullableString,
- testCaseId: { type: 'string' },
- topicId: { type: 'string' },
- },
- required: ['testCaseId', 'topicId', 'input', 'createdAt'],
- type: 'object',
- },
- File: {
- additionalProperties: true,
- properties: {
- createdAt: dateTime,
- fileType: { type: 'string' },
- id: { type: 'string' },
- metadata: nullableObject,
- name: { type: 'string' },
- parentId: nullableString,
- size: { type: 'integer' },
- source: nullableString,
- updatedAt: dateTime,
- url: { type: 'string' },
- visibility: { enum: ['private', 'public'], type: 'string' },
- },
- required: ['id', 'fileType', 'name', 'size', 'url', 'createdAt', 'updatedAt'],
- type: 'object',
- },
- KnowledgeBase: {
- additionalProperties: true,
- properties: {
- avatar: nullableString,
- createdAt: dateTime,
- description: nullableString,
- id: { type: 'string' },
- isPublic: nullableBoolean,
- name: { type: 'string' },
- settings: nullableObject,
- type: nullableString,
- updatedAt: dateTime,
- visibility: { enum: ['private', 'public'], type: 'string' },
- },
- required: ['id', 'name', 'createdAt', 'updatedAt'],
- type: 'object',
- },
- Message: {
- additionalProperties: true,
- properties: {
- agentId: nullableString,
- content: nullableString,
- createdAt: dateTime,
- error: nullableObject,
- favorite: nullableBoolean,
- id: { type: 'string' },
- metadata: nullableObject,
- model: nullableString,
- parentId: nullableString,
- provider: nullableString,
- reasoning: nullableObject,
- role: { type: 'string' },
- search: nullableObject,
- threadId: nullableString,
- tools: nullableObject,
- topicId: nullableString,
- updatedAt: dateTime,
- usage: nullableObject,
- },
- required: ['id', 'role', 'createdAt', 'updatedAt'],
- type: 'object',
- },
- McpServer: {
- additionalProperties: false,
- properties: {
- createdAt: dateTime,
- description: nullableString,
- hasCredentials: { type: 'boolean' },
- id: { format: 'uuid', type: 'string' },
- identifier: { type: 'string' },
- isEnabled: { type: 'boolean' },
- name: { type: 'string' },
- serverUrl: { format: 'uri', type: 'string' },
- status: { enum: ['connected', 'disconnected', 'error'], type: 'string' },
- tools: {
- items: {
- additionalProperties: false,
- properties: {
- description: nullableString,
- id: { format: 'uuid', type: 'string' },
- inputSchema: nullableObject,
- name: { type: 'string' },
- permission: { enum: ['auto', 'needs_approval', 'disabled'], type: 'string' },
- },
- required: ['id', 'name', 'permission'],
- type: 'object',
- },
- type: 'array',
- },
- updatedAt: dateTime,
- },
- required: [
- 'id',
- 'identifier',
- 'name',
- 'serverUrl',
- 'status',
- 'isEnabled',
- 'hasCredentials',
- 'tools',
- 'createdAt',
- 'updatedAt',
- ],
- type: 'object',
- },
- Model: {
- additionalProperties: false,
- properties: {
- abilities: nullableObject,
- config: nullableObject,
- contextWindowTokens: { type: ['integer', 'null'] },
- createdAt: dateTime,
- description: nullableString,
- displayName: nullableString,
- enabled: nullableBoolean,
- id: { type: 'string' },
- organization: nullableString,
- parameters: nullableObject,
- pricing: nullableObject,
- providerId: { type: 'string' },
- releasedAt: nullableString,
- settings: nullableObject,
- sort: { type: ['integer', 'null'] },
- source: nullableString,
- type: { type: 'string' },
- updatedAt: dateTime,
- },
- required: ['id', 'providerId', 'type', 'createdAt', 'updatedAt'],
- type: 'object',
- },
- Permission: {
- additionalProperties: false,
- properties: {
- category: { type: 'string' },
- code: { type: 'string' },
- createdAt: dateTime,
- description: nullableString,
- id: { type: 'string' },
- isActive: nullableBoolean,
- name: { type: 'string' },
- updatedAt: dateTime,
- },
- required: ['id', 'code', 'name', 'category', 'createdAt', 'updatedAt'],
- type: 'object',
- },
- Provider: {
- additionalProperties: false,
- properties: {
- checkModel: nullableString,
- config: nullableObject,
- createdAt: dateTime,
- description: nullableString,
- enabled: nullableBoolean,
- fetchOnClient: nullableBoolean,
- id: { type: 'string' },
- logo: nullableString,
- name: nullableString,
- settings: nullableObject,
- sort: { type: ['integer', 'null'] },
- source: nullableString,
- updatedAt: dateTime,
- },
- required: ['id', 'createdAt', 'updatedAt'],
- type: 'object',
- },
- Role: {
- additionalProperties: false,
- properties: {
- createdAt: dateTime,
- description: nullableString,
- displayName: { type: 'string' },
- id: { type: 'string' },
- isActive: nullableBoolean,
- isSystem: nullableBoolean,
- name: { type: 'string' },
- updatedAt: dateTime,
- },
- required: ['id', 'name', 'displayName', 'createdAt', 'updatedAt'],
- type: 'object',
- },
- Topic: {
- additionalProperties: true,
- properties: {
- agentId: nullableString,
- completedAt: { ...dateTime, type: ['string', 'null'] },
- content: nullableString,
- cost: nullableObject,
- createdAt: dateTime,
- description: nullableString,
- favorite: nullableBoolean,
- groupId: nullableString,
- historySummary: nullableString,
- id: { type: 'string' },
- metadata: nullableObject,
- mode: nullableString,
- model: nullableString,
- provider: nullableString,
- sessionId: nullableString,
- status: nullableString,
- title: nullableString,
- totalCost: nullableNumber,
- totalInputTokens: { type: ['integer', 'null'] },
- totalOutputTokens: { type: ['integer', 'null'] },
- totalTokens: { type: ['integer', 'null'] },
- trigger: nullableString,
- updatedAt: dateTime,
- usage: nullableObject,
- },
- required: ['id', 'createdAt', 'updatedAt'],
- type: 'object',
- },
- User: {
- additionalProperties: true,
- properties: {
- avatar: nullableString,
- createdAt: dateTime,
- email: nullableString,
- firstName: nullableString,
- fullName: nullableString,
- id: { type: 'string' },
- isOnboarded: nullableBoolean,
- lastName: nullableString,
- phone: nullableString,
- updatedAt: dateTime,
- username: nullableString,
- },
- required: ['id', 'createdAt', 'updatedAt'],
- type: 'object',
- },
- Usage: {
- additionalProperties: false,
- properties: {
- available: { type: 'boolean' },
- currency: { const: 'USD', type: 'string' },
- daily: {
- items: {
- additionalProperties: false,
- properties: { date: { type: 'string' }, value: { type: 'number' } },
- required: ['date', 'value'],
- type: 'object',
- },
- type: 'array',
- },
- period: {
- additionalProperties: false,
- properties: { since: dateTime, until: dateTime },
- required: ['since', 'until'],
- type: 'object',
- },
- quota: {
- additionalProperties: false,
- properties: {
- limit: nullableNumber,
- remaining: nullableNumber,
- resetsAt: { ...dateTime, type: ['string', 'null'] },
- source: { enum: ['personal', 'workspace_pool', 'member_budget'], type: 'string' },
- used: { type: 'number' },
- usedRatio: nullableNumber,
- },
- required: ['limit', 'remaining', 'resetsAt', 'source', 'used', 'usedRatio'],
- type: ['object', 'null'],
- },
- remainingBalance: nullableNumber,
- scope: { enum: ['personal', 'workspace'], type: 'string' },
- spent: { type: 'number' },
- usageByType: {
- items: {
- additionalProperties: false,
- properties: {
- count: { type: ['integer', 'null'] },
- spend: { type: 'number' },
- type: { type: 'string' },
- },
- required: ['count', 'spend', 'type'],
- type: 'object',
- },
- type: 'array',
- },
- },
- required: [
- 'available',
- 'currency',
- 'daily',
- 'period',
- 'quota',
- 'remainingBalance',
- 'scope',
- 'spent',
- 'usageByType',
- ],
- type: 'object',
- },
-};
-
-const groupResources: Record<string, { listKey: string; schema: string }> = {
- 'agent-groups': { listKey: 'agentGroups', schema: 'AgentGroup' },
- 'agents': { listKey: 'agents', schema: 'Agent' },
- 'api-keys': { listKey: 'apiKeys', schema: 'ApiKey' },
- 'chat-groups': { listKey: 'chatGroups', schema: 'ChatGroup' },
- 'files': { listKey: 'files', schema: 'File' },
- 'knowledge-bases': { listKey: 'knowledgeBases', schema: 'KnowledgeBase' },
- 'messages': { listKey: 'messages', schema: 'Message' },
- 'mcp-servers': { listKey: 'mcpServers', schema: 'McpServer' },
- 'models': { listKey: 'models', schema: 'Model' },
- 'permissions': { listKey: 'permissions', schema: 'Permission' },
- 'providers': { listKey: 'providers', schema: 'Provider' },
- 'roles': { listKey: 'roles', schema: 'Role' },
- 'topics': { listKey: 'topics', schema: 'Topic' },
- 'users': { listKey: 'users', schema: 'User' },
- 'usage': { listKey: 'usage', schema: 'Usage' },
-};
-
-const ref = (schema: string): SchemaObject => ({ $ref: `#/components/schemas/${schema}` });
-
-/** One chat bubble of the IM channel — whole, never a partial stream. */
-const imMessageSchema: SchemaObject = {
- additionalProperties: false,
- properties: {
- agentId: nullableString,
- content: { type: 'string' },
- createdAt: dateTime,
- error: { type: 'boolean' },
- files: {
- type: 'array',
- items: {
- type: 'object',
- additionalProperties: false,
- properties: {
- id: { type: 'string' },
- name: { type: 'string' },
- fileType: { type: 'string' },
- size: { type: 'number' },
- url: { type: 'string' },
- },
- required: ['id', 'name', 'fileType', 'size', 'url'],
- },
- },
- id: { type: 'string' },
- role: { enum: ['assistant', 'user'], type: 'string' },
- },
- required: ['agentId', 'content', 'createdAt', 'error', 'id', 'role'],
- type: 'object',
-};
-
-const imResponseSchema = (method: string, rest: string): SchemaObject => {
- if (method === 'post' && rest === 'messages') {
- return {
- additionalProperties: false,
- properties: {
- accepted: { type: 'boolean' },
- operationId: nullableString,
- topicId: { type: 'string' },
- userMessage: imMessageSchema,
- },
- required: ['accepted', 'operationId', 'topicId', 'userMessage'],
- type: 'object',
- };
- }
-
- if (rest.endsWith('/read')) {
- return {
- additionalProperties: false,
- properties: { unread: { minimum: 0, type: 'integer' } },
- required: ['unread'],
- type: 'object',
- };
- }
-
- return {
- additionalProperties: false,
- properties: {
- cursor: { type: 'string' },
- messages: { items: imMessageSchema, type: 'array' },
- readUpTo: {
- anyOf: [
- {
- additionalProperties: false,
- properties: { messageId: { type: 'string' }, readAt: dateTime },
- required: ['messageId', 'readAt'],
- type: 'object',
- },
- { type: 'null' },
- ],
- },
- state: { type: 'string' },
- typing: { type: 'boolean' },
- unread: { minimum: 0, type: 'integer' },
- },
- required: ['cursor', 'messages', 'readUpTo', 'state', 'typing', 'unread'],
- type: 'object',
- };
-};
-
-/**
- * Personal-agent resources whose payload is coordinator / inbox state rather
- * than a stable CRUD row (a goal's graph snapshot, a category of memory
- * entries, a page of receipts). The spec stays deliberately vague for these —
- * same policy as unnamed sub-operations: `additionalProperties` over a guessed
- * shape, so a generated client is never confidently mistyped.
- */
-const PERSONAL_AGENT_GROUPS = new Set(['goals', 'memories', 'notifications', 'signals', 'tasks']);
-
-/**
- * Handlers whose success status is not 200. A controller's return code is not
- * visible to the generator, so every non-200 success has to be declared here —
- * otherwise the document (and the SDK generated from it) advertises a status
- * the runtime never sends, and status-discriminating clients branch wrongly.
+ * Build the OpenAPI 3.1 document from the live Hono app.
+ *
+ * Shared by the runtime `GET /api/v1/openapi.json` endpoint (see `app.ts`)
+ * and the `scripts/generate-openapi.ts` emitter, so the served spec and the
+ * committed `openapi.yml` always come from the same logic.
+ *
+ * Every response — success status, payload schema and error codes — comes from
+ * the route's own `routeDoc()` declaration. Nothing is inferred from the path:
+ * an operation that does not declare a typed success response fails the build
+ * instead of being documented with a guessed or open-ended shape.
*/
-const CREATED_OPERATIONS = new Set([
- 'POST agent-groups',
- 'POST agents/{id}/duplicate',
- 'POST agents/{id}/accounts',
- 'POST api-keys',
- 'POST chat-groups',
- 'POST eval/benchmarks',
- 'POST eval/datasets',
- 'POST eval/datasets/{datasetId}/test-cases',
- 'POST goals',
- 'POST mcp-servers',
- 'POST tasks',
-]);
-
-const ACCEPTED_OPERATIONS = new Set([
- 'POST eval/runs',
- 'POST signals/source-events',
- 'POST signals/trigger',
- 'POST tasks/{id}/runs',
-]);
-
-const successStatusFor = (group: string, rest: string, method: string): number => {
- const operation = `${method.toUpperCase()} ${group}${rest ? `/${rest}` : ''}`;
- if (ACCEPTED_OPERATIONS.has(operation)) return 202;
- if (CREATED_OPERATIONS.has(operation)) return 201;
- return 200;
-};
-
-const successEnvelope = (data: SchemaObject): SchemaObject => ({
- additionalProperties: false,
- properties: {
- data,
- message: { type: 'string' },
- success: { const: true, type: 'boolean' },
- timestamp: dateTime,
- },
- required: ['success', 'timestamp'],
- type: 'object',
-});
-
-const getSuccessSchema = (group: string, rest: string, method: string): SchemaObject => {
- if (group === 'health') {
- return {
- additionalProperties: false,
- properties: {
- service: { type: 'string' },
- status: { const: 'ok', type: 'string' },
- timestamp: dateTime,
- },
- required: ['service', 'status', 'timestamp'],
- type: 'object',
- };
- }
-
- if (PERSONAL_AGENT_GROUPS.has(group)) {
- return successEnvelope({ additionalProperties: true, type: ['array', 'object', 'null'] });
- }
-
- if (group === 'responses') {
- return {
- additionalProperties: true,
- properties: {
- id: { type: 'string' },
- object: { const: 'response', type: 'string' },
- output: { items: { type: 'object' }, type: 'array' },
- status: { type: 'string' },
- usage: { type: ['object', 'null'] },
- },
- required: ['id', 'object', 'output', 'status'],
- type: 'object',
- };
- }
-
- if (group === 'chat') {
- if (rest === 'translate') {
- return successEnvelope({
- additionalProperties: false,
- properties: { translatedText: { type: 'string' } },
- required: ['translatedText'],
- type: 'object',
- });
- }
-
- if (rest === 'generate-reply') {
- return successEnvelope({
- additionalProperties: false,
- properties: { reply: { type: 'string' } },
- required: ['reply'],
- type: 'object',
- });
- }
-
- return successEnvelope(ref('ChatResponse'));
- }
-
- if (group === 'eval') return successEnvelope(evalResponseSchema(method, rest));
-
- if (group === 'topics' && rest.endsWith('/threads'))
- return successEnvelope({
- type: 'object',
- properties: {
- threads: {
- type: 'array',
- items: {
- type: 'object',
- additionalProperties: false,
- properties: {
- id: { type: 'string' },
- topicId: { type: 'string' },
- title: nullableString,
- type: { type: 'string' },
- status: nullableString,
- parentThreadId: nullableString,
- createdAt: dateTime,
- updatedAt: dateTime,
- },
- },
- },
- total: { type: 'integer' },
- },
- required: ['threads', 'total'],
- });
- if (group === 'plugins')
- return successEnvelope({
- type: 'object',
- properties: {
- plugins: {
- type: 'array',
- items: {
- type: 'object',
- additionalProperties: false,
- properties: {
- identifier: { type: 'string' },
- type: { type: 'string' },
- createdAt: dateTime,
- updatedAt: dateTime,
- },
- },
- },
- total: { type: 'integer' },
- },
- required: ['plugins', 'total'],
- });
-
- if (group === 'im') return successEnvelope(imResponseSchema(method, rest));
-
- if (group === 'push-tokens') {
- if (method === 'delete') return successEnvelope({ type: 'null' });
- return successEnvelope({
- additionalProperties: false,
- properties: { deviceId: { type: 'string' }, platform: { type: 'string' } },
- required: ['deviceId', 'platform'],
- type: 'object',
- });
- }
-
- /**
- * Agent identity assets: `/agents/{id}/accounts`. Every route answers with an
- * `AgentAccount` (the collection GET wraps them), and none of them can carry
- * a credential — the write-only sub-resource answers with the hint plus
- * `hasCredential`, never the secret.
- */
- if (group === 'agents') {
- if (rest === '{id}/accounts') {
- if (method === 'get') {
- return successEnvelope({
- additionalProperties: false,
- properties: {
- accounts: { items: ref('AgentAccount'), type: 'array' },
- total: { minimum: 0, type: 'integer' },
- },
- required: ['accounts', 'total'],
- type: 'object',
- });
- }
-
- return successEnvelope(ref('AgentAccount'));
- }
-
- if (rest === '{id}/accounts/{accountId}' || rest === '{id}/accounts/{accountId}/credential') {
- return successEnvelope(ref('AgentAccount'));
- }
- }
-
- const resource = groupResources[group];
- if (!resource) return successEnvelope({ additionalProperties: true, type: 'object' });
-
- if (group === 'usage') return successEnvelope(ref('Usage'));
-
- const isRootList = method === 'get' && rest === '';
- if (isRootList) {
- if (group === 'agent-groups' || group === 'api-keys' || group === 'mcp-servers') {
- return successEnvelope({ items: ref(resource.schema), type: 'array' });
- }
-
- return successEnvelope({
- additionalProperties: true,
- properties: {
- [resource.listKey]: { items: ref(resource.schema), type: 'array' },
- total: { minimum: 0, type: 'integer' },
- },
- required: [resource.listKey],
- type: 'object',
- });
- }
-
- if (group === 'chat-groups' && rest === '{id}/members') {
- return successEnvelope(ref('ChatGroup'));
- }
-
- if (method === 'delete') {
- return successEnvelope({ additionalProperties: true, type: ['object', 'null'] });
- }
-
- if (group === 'agent-groups' && method === 'post' && rest === '') {
- return successEnvelope({
- additionalProperties: false,
- properties: { id: { type: 'string' } },
- required: ['id'],
- type: 'object',
- });
- }
-
- if (group === 'api-keys' && method === 'post' && rest === '') {
- const apiKey = resourceSchemas.ApiKey as { properties: Record<string, unknown> };
- return successEnvelope({
- additionalProperties: false,
- properties: { ...apiKey.properties, key: { type: 'string' } },
- required: ['id', 'name', 'key', 'createdAt', 'updatedAt'],
- type: 'object',
- });
- }
-
- if (group === 'mcp-servers' && method === 'post' && rest.endsWith('/sync')) {
- return successEnvelope({
- additionalProperties: false,
- properties: {
- id: { format: 'uuid', type: 'string' },
- status: { const: 'connected', type: 'string' },
- toolCount: { minimum: 0, type: 'integer' },
- },
- required: ['id', 'status', 'toolCount'],
- type: 'object',
- });
- }
-
- // The file controllers wrap their payloads instead of returning the bare
- // resource, so the one-segment fallback below would advertise `File` and make
- // generated clients mistype every one of these. Keep these explicit.
- if (group === 'files') {
- const fileDetail: SchemaObject = {
- additionalProperties: false,
- properties: { file: ref('File'), parsed: { type: 'object' } },
- required: ['file'],
- type: 'object',
- };
-
- if ((method === 'post' && rest === '') || (method === 'get' && rest === '{id}')) {
- return successEnvelope(fileDetail);
- }
-
- if (method === 'post' && rest === 'batches') {
- return successEnvelope({
- additionalProperties: false,
- properties: {
- failed: {
- items: {
- additionalProperties: false,
- properties: { error: { type: 'string' }, name: { type: 'string' } },
- required: ['error', 'name'],
- type: 'object',
- },
- type: 'array',
- },
- successful: { items: fileDetail, type: 'array' },
- summary: {
- additionalProperties: false,
- properties: {
- failed: { minimum: 0, type: 'integer' },
- successful: { minimum: 0, type: 'integer' },
- total: { minimum: 0, type: 'integer' },
- },
- required: ['failed', 'successful', 'total'],
- type: 'object',
- },
- },
- required: ['failed', 'successful', 'summary'],
- type: 'object',
- });
- }
-
- if (method === 'post' && rest === 'queries') {
- return successEnvelope({
- additionalProperties: false,
- properties: {
- failed: {
- items: {
- additionalProperties: false,
- properties: { error: { type: 'string' }, fileId: { type: 'string' } },
- required: ['error', 'fileId'],
- type: 'object',
- },
- type: 'array',
- },
- files: { items: fileDetail, type: 'array' },
- success: { minimum: 0, type: 'integer' },
- total: { minimum: 0, type: 'integer' },
- },
- required: ['failed', 'files', 'success', 'total'],
- type: 'object',
- });
- }
- }
-
- if (group === 'messages' && rest === 'count') {
- return successEnvelope({
- additionalProperties: false,
- properties: { count: { minimum: 0, type: 'integer' } },
- required: ['count'],
- type: 'object',
- });
- }
-
- // Returns the created message, or nothing when generation produced no reply.
- if (group === 'messages' && rest === 'replies') {
- return successEnvelope({ anyOf: [ref('Message'), { type: 'null' }] });
- }
+export const buildSpecDocument = async (app: GenerateSpecsApp) => {
+ const { spec, undocumented } = await collectSpecDocument(app);
- // A caller without `user:read` deliberately receives only `{ id }`.
- if (group === 'users' && rest === 'me') {
- return successEnvelope({
- anyOf: [
- ref('User'),
- {
- additionalProperties: false,
- properties: { id: { type: 'string' } },
- required: ['id'],
- type: 'object',
- },
- ],
- });
+ if (undocumented.length > 0) {
+ throw new Error(
+ `Routes without a declared success response (attach routeDoc() from src/common/openapi.ts):\n${undocumented.map((op) => ` - ${op}`).join('\n')}`,
+ );
}
- // Only true resource operations get the resource schema: the collection root
- // and the `{id}` item. Every other single segment is a named sub-operation
- // (`count`, `me`, `batches`, …) whose payload is its own shape, so it must be
- // described explicitly above — falling back to a permissive object here keeps
- // an undescribed route merely vague rather than confidently wrong.
- const isResourceOperation = rest === '' || rest === '{id}';
- return isResourceOperation
- ? successEnvelope(ref(resource.schema))
- : successEnvelope({ additionalProperties: true, type: 'object' });
+ return spec;
};
-const errorResponse = (description: string) => ({
- content: { 'application/json': { schema: ref('ApiError') } },
- description,
-});
-
/**
- * Build the OpenAPI 3.1 document from the live Hono app.
- *
- * Shared by the runtime `GET /api/v1/openapi.json` endpoint (see `app.ts`)
- * and the `scripts/generate-openapi.ts` emitter, so the served spec and the
- * committed `openapi.yml` always come from the same logic.
+ * The document plus every operation that lacks a typed success response.
+ * `buildSpecDocument` refuses to emit a document with any; tests and tooling
+ * use this to report them.
*/
-export const buildSpecDocument = async (app: GenerateSpecsApp) => {
+export const collectSpecDocument = async (app: GenerateSpecsApp) => {
const spec = await generateSpecs(app, {
+ // Routes with a request validator can answer 400 through `zValidator`,
+ // which uses the shared error envelope.
+ defaultValidationErrorResponse: errorResponse(400),
documentation: {
components: {
- schemas: {
- ApiError: {
- additionalProperties: false,
- properties: {
- error: { type: 'string' },
- success: { const: false, type: 'boolean' },
- timestamp: dateTime,
- },
- required: ['error', 'success', 'timestamp'],
- type: 'object',
- },
- ...resourceSchemas,
- },
+ schemas: { ApiError: apiErrorJsonSchema },
securitySchemes: {
bearerAuth: {
bearerFormat: `API Key (${API_KEY_PREFIX}...) or OIDC JWT`,
@@ -1075,6 +76,7 @@ export const buildSpecDocument = async (app: GenerateSpecsApp) => {
});
const paths = (spec.paths ?? {}) as Record<string, Record<string, OperationObject>>;
+ const undocumented: string[] = [];
for (const [path, item] of Object.entries(paths)) {
// '/api/v1/agent-groups/{id}' -> group 'agent-groups', rest '{id}'
@@ -1087,45 +89,16 @@ export const buildSpecDocument = async (app: GenerateSpecsApp) => {
op.tags ??= [group];
op.operationId ??= `${group}.${method}${rest ? `_${rest.replaceAll(/[{}]/g, '').replaceAll('/', '_')}` : ''}`;
- op.responses ??= {};
- const successSchema = getSuccessSchema(group, rest, method);
- const successContent: Record<string, unknown> = {
- 'application/json': { schema: successSchema },
- };
- if (group === 'responses') {
- successContent['text/event-stream'] = { schema: { type: 'string' } };
- }
- const successStatus = successStatusFor(group, rest, method);
- // `hono-openapi` fills a contentless 200 into operations that declare a
- // request body but no responses. When the handler actually answers
- // 201/202 that placeholder is not a real response and must go, or the
- // document keeps advertising a status the runtime never sends.
- const placeholder200 = op.responses[200] as { content?: unknown } | undefined;
- if (successStatus !== 200 && placeholder200 && !placeholder200.content) {
- delete op.responses[200];
- }
- const currentSuccess = (op.responses[successStatus] ?? {}) as Record<string, unknown>;
- op.responses[successStatus] = {
- ...currentSuccess,
- content: currentSuccess.content ?? successContent,
- description: currentSuccess.description ?? 'Successful response',
- };
+ const responses = op.responses ?? {};
+ const hasTypedSuccess = Object.entries(responses).some(
+ ([status, response]) => status.startsWith('2') && response.content,
+ );
+ if (!hasTypedSuccess) undocumented.push(`${method.toUpperCase()} ${path}`);
- op.responses[400] ??= errorResponse('Invalid request');
- op.responses[401] ??= errorResponse('Authentication required');
- op.responses[403] ??= errorResponse('Insufficient permission');
- op.responses[404] ??= errorResponse('Resource not found');
- op.responses[409] ??= errorResponse('Resource conflict');
- op.responses[429] ??= errorResponse('Rate limit exceeded');
- op.responses[500] ??= errorResponse('Internal server error');
-
- for (const response of Object.values(op.responses)) {
- const responseObject = response as { description?: string };
- responseObject.description ??= 'Response';
- }
+ for (const response of Object.values(responses)) response.description ??= 'Response';
}
}
- return spec;
+ return { spec, undocumented };
};
diff --git a/packages/openapi/src/types/agent-account.type.ts b/packages/openapi/src/types/agent-account.type.ts
index 158f2b03355..0d0f0f08852 100644
--- a/packages/openapi/src/types/agent-account.type.ts
+++ b/packages/openapi/src/types/agent-account.type.ts
@@ -1,6 +1,16 @@
-import { AGENT_ACCOUNT_KINDS } from '@lobechat/types';
+import {
+ AGENT_ACCOUNT_DIGEST_MINUTES_RANGE,
+ AGENT_ACCOUNT_KINDS,
+ AGENT_ACCOUNT_PERSISTED_KINDS,
+ AGENT_ACCOUNT_STATUSES,
+ AGENT_ACCOUNT_WAKE_MODES,
+} from '@lobechat/types';
import { z } from 'zod';
+import type { AgentAccountView } from '@/database/models/agentAccount';
+
+import { dateTimeSchema, jsonObjectSchema } from './common.type';
+
// ==================== Path / Query Schemas ====================
/** `/agents/:id` — the agent whose identity assets these are. */
@@ -117,3 +127,75 @@ export const SetAgentAccountCredentialRequestSchema = z.object({
export type SetAgentAccountCredentialRequest = z.infer<
typeof SetAgentAccountCredentialRequestSchema
>;
+
+// ==================== Response Schemas ====================
+
+/**
+ * Every field an account view carries. Typed against the view so a column added
+ * to it fails type-checking here rather than being silently dropped from the
+ * SDK — the schema is strict, so a missing field would also make strict
+ * response validators reject real payloads.
+ */
+const agentAccountShape = {
+ /** Last time the account was read or used — every account view carries it. */
+ accessedAt: dateTimeSchema,
+ agentId: z.string(),
+ /** Stored JSON declared by the provider (or the mounting caller). */
+ capabilities: z
+ .object({
+ login: z.boolean().optional(),
+ receive: z.boolean(),
+ send: z.boolean(),
+ sign: z.boolean().optional(),
+ })
+ .meta({ id: 'AgentAccountCapabilities' }),
+ createdAt: dateTimeSchema,
+ /** Non-secret display facts about the installed credential. */
+ credentialHint: z
+ .object({
+ expiresAt: z.string().optional(),
+ masked: z.string().optional(),
+ rotatedAt: z.string().optional(),
+ username: z.string().optional(),
+ })
+ .nullable(),
+ displayName: z.string().nullable(),
+ /** Whether a secret is installed. Never the secret itself. */
+ hasCredential: z.boolean(),
+ id: z.string(),
+ identifier: z.string(),
+ // The persisted kinds, not just the creatable ones: an unfiltered read still
+ // returns retired-kind rows, and the response contract must not exclude a
+ // value the API actually returns.
+ kind: z.enum(AGENT_ACCOUNT_PERSISTED_KINDS),
+ /** Provider-side non-secret handles (inboxId, chatId, …), owned by the provider. */
+ metadata: jsonObjectSchema.nullable(),
+ provider: z.string(),
+ revokedAt: dateTimeSchema.nullable(),
+ /** The owner's own settings, such as wake rules. */
+ settings: z.object({
+ wake: z
+ .object({
+ digestMinutes: z
+ .number()
+ .int()
+ .min(AGENT_ACCOUNT_DIGEST_MINUTES_RANGE.min)
+ .max(AGENT_ACCOUNT_DIGEST_MINUTES_RANGE.max)
+ .optional(),
+ mode: z.enum(AGENT_ACCOUNT_WAKE_MODES).optional(),
+ wakeSenders: z.array(z.string()).optional(),
+ })
+ .optional(),
+ }),
+ status: z.enum(AGENT_ACCOUNT_STATUSES),
+ updatedAt: dateTimeSchema,
+ userId: z.string(),
+ workspaceId: z.string().nullable(),
+} satisfies Record<keyof AgentAccountView, z.ZodType>;
+
+export const AgentAccountSchema = z.object(agentAccountShape).strict().meta({ id: 'AgentAccount' });
+
+export const AgentAccountListSchema = z
+ .object({ accounts: z.array(AgentAccountSchema), total: z.number().int().min(0) })
+ .strict()
+ .meta({ id: 'AgentAccountList' });
diff --git a/packages/openapi/src/types/agent-group.type.ts b/packages/openapi/src/types/agent-group.type.ts
index b68310aaa3e..722d643e28e 100644
--- a/packages/openapi/src/types/agent-group.type.ts
+++ b/packages/openapi/src/types/agent-group.type.ts
@@ -1,6 +1,8 @@
import { z } from 'zod';
import type { PublicAgentGroup } from '../helpers/public-fields';
+import { dateTimeSchema } from './common.type';
+
// ==================== Agent Group CRUD Types ====================
// Agent group (stored in sessionGroups table) related type definitions
@@ -50,3 +52,23 @@ export type AgentGroupListResponse = PublicAgentGroup[];
export const AgentGroupIdParamSchema = z.object({
id: z.string().min(1, 'Agent category ID cannot be empty'),
});
+
+// ==================== Response Schemas ====================
+
+/** `projectPublicAgentGroup` output — a sidebar folder (`session_groups` row). */
+export const AgentGroupSchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ id: z.string(),
+ name: z.string(),
+ sort: z.number().int().nullable(),
+ updatedAt: dateTimeSchema,
+ } satisfies Record<keyof PublicAgentGroup, z.ZodType>)
+ .strict()
+ .meta({ id: 'AgentGroup' });
+
+/** `POST /agent-groups` answers with the new folder's id only. */
+export const CreatedAgentGroupSchema = z
+ .object({ id: z.string() })
+ .strict()
+ .meta({ id: 'CreatedAgentGroup' });
diff --git a/packages/openapi/src/types/agent-signal.type.test.ts b/packages/openapi/src/types/agent-signal.type.test.ts
new file mode 100644
index 00000000000..2e06531e9ce
--- /dev/null
+++ b/packages/openapi/src/types/agent-signal.type.test.ts
@@ -0,0 +1,49 @@
+import { describe, expect, it, vi } from 'vitest';
+
+// The request enum is read from this service; stubbing it keeps the test off
+// the agent-signal service graph.
+vi.mock('@/server/services/agentSignal/triggerSourceEvent', () => ({
+ AGENT_SIGNAL_TRIGGER_SOURCE_TYPES: ['manual'],
+}));
+
+const { AgentSignalEmissionSchema, AgentSignalReceiptListSchema } =
+ await import('./agent-signal.type');
+
+describe('agent signal response schemas', () => {
+ it('accepts an accepted and a dropped emission', () => {
+ expect(() =>
+ AgentSignalEmissionSchema.parse({ accepted: true, scopeKey: 'topic:t', workflowRunId: 'r' }),
+ ).not.toThrow();
+ expect(() =>
+ AgentSignalEmissionSchema.parse({ accepted: false, scopeKey: 'topic:t', workflowRunId: '' }),
+ ).not.toThrow();
+ });
+
+ it('accepts a receipt page', () => {
+ const page = {
+ cursor: 20,
+ receipts: [
+ {
+ agentId: 'agt-1',
+ createdAt: 1_763_366_400_000,
+ detail: 'Saved a preference',
+ id: 'rcp-1',
+ kind: 'memory',
+ metadata: {
+ actionType: 'write_memory',
+ evidenceRefs: [{ id: 'msg-1', type: 'message' }],
+ },
+ sourceId: 'src-1',
+ sourceType: 'agent.user.message',
+ status: 'applied',
+ target: { memoryLayer: 'preference', operation: 'create', type: 'memory' },
+ title: 'Memory updated',
+ topicId: 'tpc-1',
+ userId: 'user-1',
+ },
+ ],
+ };
+
+ expect(() => AgentSignalReceiptListSchema.parse(page)).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/types/agent-signal.type.ts b/packages/openapi/src/types/agent-signal.type.ts
index 967923eafdd..06eaa5ea7e3 100644
--- a/packages/openapi/src/types/agent-signal.type.ts
+++ b/packages/openapi/src/types/agent-signal.type.ts
@@ -1,8 +1,23 @@
import { AGENT_SIGNAL_CLIENT_SOURCE_TYPES } from '@lobechat/agent-signal/source';
+import { LayersEnum } from '@lobechat/types';
import { z } from 'zod';
+import type { QueuedAgentSignalEmissionResult } from '@/server/services/agentSignal/enqueue';
+import type {
+ AgentSignalReceipt,
+ AgentSignalReceiptListResult,
+ AgentSignalReceiptMetadata,
+} from '@/server/services/agentSignal/services/receiptService';
+import type {
+ EvidenceRef,
+ Idea,
+ IterationTarget,
+ SelfFeedbackIntent,
+} from '@/server/services/agentSignal/services/selfIteration/types';
import { AGENT_SIGNAL_TRIGGER_SOURCE_TYPES } from '@/server/services/agentSignal/triggerSourceEvent';
+import { dateTimeSchema } from './common.type';
+
/** Source event types the client is allowed to emit directly. */
export const AgentSignalClientSourceSchema = z.enum(AGENT_SIGNAL_CLIENT_SOURCE_TYPES);
/** Source event types the server can synthesise a trigger for. */
@@ -49,3 +64,223 @@ export const RollbackReceiptRequestSchema = z.object({
receiptId: z.string().min(1),
});
export type RollbackReceiptRequest = z.infer<typeof RollbackReceiptRequestSchema>;
+
+// ==================== Response Schemas ====================
+
+/**
+ * What an emission answers with. `accepted: false` (with an empty
+ * `workflowRunId`) means Agent Signal is turned off for the caller, so the
+ * event was dropped rather than queued.
+ */
+export const AgentSignalEmissionSchema = z
+ .object({
+ accepted: z.boolean(),
+ /** The normalized scope the event was (or would have been) routed under. */
+ scopeKey: z.string(),
+ /** The workflow run processing the event; empty when not accepted. */
+ workflowRunId: z.string(),
+ } satisfies Record<keyof QueuedAgentSignalEmissionResult, z.ZodType>)
+ .strict()
+ .meta({ id: 'AgentSignalEmission' });
+
+const EvidenceRefSchema = z
+ .object({
+ id: z.string(),
+ summary: z.string().optional(),
+ type: z.enum([
+ 'topic',
+ 'message',
+ 'operation',
+ 'source',
+ 'receipt',
+ 'tool_call',
+ 'task',
+ 'agent_document',
+ 'memory',
+ ]),
+ } satisfies Record<keyof EvidenceRef, z.ZodType>)
+ .strict();
+
+const IterationTargetSchema = z
+ .object({
+ memoryId: z.string().optional(),
+ readonly: z.boolean().optional(),
+ skillDocumentId: z.string().optional(),
+ skillName: z.string().optional(),
+ taskIds: z.array(z.string()).optional(),
+ topicIds: z.array(z.string()).optional(),
+ } satisfies Record<keyof IterationTarget, z.ZodType>)
+ .strict();
+
+const ideaShape = {
+ evidenceRefs: z.array(EvidenceRefSchema),
+ idempotencyKey: z.string(),
+ rationale: z.string(),
+ risk: z.enum(['high', 'low', 'medium']),
+ target: IterationTargetSchema.optional(),
+ title: z.string().optional(),
+} satisfies Record<keyof Idea, z.ZodType>;
+
+const SelfFeedbackIntentSchema = z
+ .object({
+ ...ideaShape,
+ actionType: z.string().optional(),
+ confidence: z.number(),
+ downgradeReason: z
+ .enum(['approval_required', 'low_confidence', 'unsupported_in_reflection'])
+ .optional(),
+ intentType: z.enum(['memory', 'skill', 'tooling', 'workflow']),
+ mode: z.literal('reflection'),
+ operation: z
+ .discriminatedUnion('operation', [
+ z
+ .object({
+ domain: z.literal('memory'),
+ input: z.object({ content: z.string(), userId: z.string() }).strict(),
+ operation: z.literal('write'),
+ })
+ .strict(),
+ z
+ .object({
+ domain: z.literal('skill'),
+ input: z
+ .object({
+ bodyMarkdown: z.string().optional(),
+ description: z.string().optional(),
+ name: z.string().optional(),
+ title: z.string().optional(),
+ userId: z.string(),
+ })
+ .strict(),
+ operation: z.literal('create'),
+ })
+ .strict(),
+ z
+ .object({
+ domain: z.literal('skill'),
+ input: z
+ .object({
+ bodyMarkdown: z.string(),
+ description: z.string().optional(),
+ skillDocumentId: z.string(),
+ userId: z.string(),
+ })
+ .strict(),
+ operation: z.literal('refine'),
+ })
+ .strict(),
+ z
+ .object({
+ domain: z.literal('skill'),
+ input: z
+ .object({
+ bodyMarkdown: z.string().optional(),
+ canonicalSkillDocumentId: z.string(),
+ description: z.string().optional(),
+ sourceSkillIds: z.array(z.string()),
+ userId: z.string(),
+ })
+ .strict(),
+ operation: z.literal('consolidate'),
+ })
+ .strict(),
+ ])
+ .optional(),
+ urgency: z.enum(['immediate', 'later', 'soon']),
+ } satisfies Record<keyof SelfFeedbackIntent, z.ZodType>)
+ .strict();
+
+const AgentSignalReceiptMetadataSchema = z
+ .object({
+ actionCount: z.number().int().optional(),
+ actionStatus: z.enum(['applied', 'deduped', 'failed', 'proposed', 'skipped']).optional(),
+ actionType: z
+ .enum([
+ 'write_memory',
+ 'create_skill',
+ 'refine_skill',
+ 'refine_prompt',
+ 'consolidate_skill',
+ 'noop',
+ 'proposal_only',
+ ])
+ .optional(),
+ agentDocumentId: z.string().optional(),
+ documentId: z.string().optional(),
+ evidenceRefs: z.array(EvidenceRefSchema).optional(),
+ expectedCurrentDocumentUpdatedAt: dateTimeSchema.optional(),
+ historyId: z.string().optional(),
+ localDate: z.string().optional(),
+ reviewScope: z.enum(['nightly', 'self_feedback', 'self_reflection']).optional(),
+ rollbackStatus: z
+ .enum(['available', 'conflict', 'failed', 'not_found', 'rolled_back', 'unsupported'])
+ .optional(),
+ scopeId: z.string().optional(),
+ scopeType: z.string().optional(),
+ selfIteration: z
+ .object({
+ ideas: z.array(z.object(ideaShape).strict()).optional(),
+ intents: z.array(SelfFeedbackIntentSchema).optional(),
+ mode: z.enum(['feedback', 'reflection', 'review']),
+ reason: z.string().optional(),
+ scope: z.object({ id: z.string(), type: z.string() }).strict().optional(),
+ sourceId: z.string(),
+ toolCallId: z.string().optional(),
+ window: z.object({ end: dateTimeSchema, start: dateTimeSchema }).strict().optional(),
+ } satisfies Record<keyof NonNullable<AgentSignalReceiptMetadata['selfIteration']>, z.ZodType>)
+ .strict()
+ .optional(),
+ sourceType: z.string().optional(),
+ timezone: z.string().optional(),
+ } satisfies Record<keyof AgentSignalReceiptMetadata, z.ZodType>)
+ .strict();
+
+export const AgentSignalReceiptSchema = z
+ .object({
+ agentId: z.string(),
+ /** Assistant message the receipt renders under, when known. */
+ anchorMessageId: z.string().optional(),
+ /** Epoch milliseconds. */
+ createdAt: z.number(),
+ /** Fallback detail copy for clients without locale keys. */
+ detail: z.string(),
+ id: z.string(),
+ kind: z.enum(['memory', 'review', 'skill']),
+ metadata: AgentSignalReceiptMetadataSchema.optional(),
+ operationId: z.string().optional(),
+ sourceId: z.string(),
+ sourceType: z.string(),
+ status: z.enum(['applied', 'completed', 'failed', 'proposed', 'skipped', 'updated']),
+ /** Snapshot of the resource the receipt affected when it was produced. */
+ target: z
+ .object({
+ agentDocumentId: z.string().optional(),
+ documentId: z.string().optional(),
+ id: z.string().optional(),
+ memoryId: z.string().optional(),
+ memoryLayer: z.enum(LayersEnum).optional(),
+ operation: z.enum(['create', 'remove', 'update']).optional(),
+ summary: z.string().optional(),
+ title: z.string().optional(),
+ type: z.enum(['memory', 'skill']),
+ } satisfies Record<keyof NonNullable<AgentSignalReceipt['target']>, z.ZodType>)
+ .strict()
+ .optional(),
+ /** Fallback title copy for clients without locale keys. */
+ title: z.string(),
+ topicId: z.string(),
+ triggerMessageId: z.string().optional(),
+ userId: z.string(),
+ } satisfies Record<keyof AgentSignalReceipt, z.ZodType>)
+ .strict()
+ .meta({ id: 'AgentSignalReceipt' });
+
+/** One newest-first page of receipts. */
+export const AgentSignalReceiptListSchema = z
+ .object({
+ /** Offset to pass as `cursor` for the next page; absent on the last page. */
+ cursor: z.number().int().optional(),
+ receipts: z.array(AgentSignalReceiptSchema),
+ } satisfies Record<keyof AgentSignalReceiptListResult, z.ZodType>)
+ .strict()
+ .meta({ id: 'AgentSignalReceiptList' });
diff --git a/packages/openapi/src/types/agent.type.ts b/packages/openapi/src/types/agent.type.ts
index 53a615ce92d..524d58b066e 100644
--- a/packages/openapi/src/types/agent.type.ts
+++ b/packages/openapi/src/types/agent.type.ts
@@ -1,10 +1,13 @@
import type { LobeAgentAgencyConfig, LobeAgentChatConfig } from '@lobechat/types';
+import { AgentPluginModeSchema } from '@lobechat/types';
import { AgentGraphSchema } from '@lobechat/types/agent/graph';
import { z } from 'zod';
+import { KNOWLEDGE_BASE_VISIBILITY } from '@/database/schemas';
+
import type { PublicAgent, PublicFile, PublicKnowledgeBase } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
-import { PaginationQuerySchema } from './common.type';
+import { dateTimeSchema, jsonObjectSchema, PaginationQuerySchema } from './common.type';
// ==================== Agent CRUD Types ====================
@@ -210,3 +213,88 @@ export const AgentIdParamSchema = z.object({
export const DuplicateAgentSchema = z
.object({ title: z.string().trim().min(1).max(255).optional() })
.strict();
+
+// ==================== Response Schemas ====================
+
+/** One `plugins[]` entry as `parsePluginEntry` normalizes it: legacy strings become `pinned`. */
+const AgentPluginSchema = z
+ .object({ identifier: z.string(), mode: AgentPluginModeSchema })
+ .strict()
+ .meta({ id: 'AgentPlugin' });
+
+/**
+ * `projectPublicAgent` output. Tied to `PublicAgent` so a field added to the
+ * projection fails type-checking here instead of silently leaving the spec.
+ */
+const agentShape = {
+ /** Stored graph/permission settings; keys are written by several features. */
+ agencyConfig: jsonObjectSchema.nullable(),
+ avatar: z.string().nullable(),
+ /** Stored `LobeAgentChatConfig`; the product adds keys over time. */
+ chatConfig: jsonObjectSchema.nullable(),
+ createdAt: dateTimeSchema,
+ description: z.string().nullable(),
+ id: z.string(),
+ model: z.string().nullable(),
+ /** Stored model parameters (temperature, top_p, …), owned by the client. */
+ params: jsonObjectSchema.nullable(),
+ personal: z.boolean(),
+ plugins: z.array(AgentPluginSchema),
+ provider: z.string().nullable(),
+ slug: z.string().nullable(),
+ systemRole: z.string().nullable(),
+ title: z.string().nullable(),
+ updatedAt: dateTimeSchema,
+} satisfies Record<keyof PublicAgent, z.ZodType>;
+
+export const AgentSchema = z.object(agentShape).strict().meta({ id: 'Agent' });
+
+/** A file mounted on an agent: `projectPublicFile` plus the mount's `enabled` flag. */
+export const AgentFileSchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ enabled: z.boolean().nullable(),
+ fileType: z.string(),
+ id: z.string(),
+ metadata: jsonObjectSchema.nullable(),
+ name: z.string(),
+ parentId: z.string().nullable(),
+ size: z.number().int(),
+ source: z.string().nullable(),
+ updatedAt: dateTimeSchema,
+ url: z.string(),
+ visibility: z.enum(['private', 'public']),
+ } satisfies Record<keyof PublicFile | 'enabled', z.ZodType>)
+ .strict()
+ .meta({ id: 'AgentFile' });
+
+/** A knowledge base mounted on an agent: `projectPublicKnowledgeBase` plus `enabled`. */
+export const AgentKnowledgeBaseSchema = z
+ .object({
+ avatar: z.string().nullable(),
+ createdAt: dateTimeSchema,
+ description: z.string().nullable(),
+ enabled: z.boolean().nullable(),
+ id: z.string(),
+ isPublic: z.boolean().nullable(),
+ name: z.string(),
+ settings: jsonObjectSchema.nullable(),
+ type: z.string().nullable(),
+ updatedAt: dateTimeSchema,
+ visibility: z.enum(KNOWLEDGE_BASE_VISIBILITY),
+ } satisfies Record<keyof PublicKnowledgeBase | 'enabled', z.ZodType>)
+ .strict()
+ .meta({ id: 'AgentKnowledgeBase' });
+
+/** `GET /agents/:id` and `POST /agents/:id/duplicate`: the agent plus its mounted knowledge. */
+export const AgentDetailSchema = AgentSchema.extend({
+ files: z.array(AgentFileSchema),
+ knowledgeBases: z.array(AgentKnowledgeBaseSchema),
+})
+ .strict()
+ .meta({ id: 'AgentDetail' });
+
+export const AgentListSchema = z
+ .object({ agents: z.array(AgentSchema), total: z.number().int().min(0) })
+ .strict()
+ .meta({ id: 'AgentList' });
diff --git a/packages/openapi/src/types/api-key.type.ts b/packages/openapi/src/types/api-key.type.ts
index 1627b959ebb..37a20d842e6 100644
--- a/packages/openapi/src/types/api-key.type.ts
+++ b/packages/openapi/src/types/api-key.type.ts
@@ -1,6 +1,8 @@
import { API_KEY_FULL_ACCESS_SCOPE, API_KEY_SCOPES } from '@lobechat/const';
import { z } from 'zod';
+import { dateTimeSchema } from './common.type';
+
const ApiKeyScopesSchema = z
.array(z.enum(API_KEY_SCOPES, { error: 'Unknown API key scope' }))
.min(1)
@@ -54,3 +56,26 @@ export interface CreatedApiKeyResponse extends ApiKeyResponse {
/** Plaintext is returned only by the create operation. */
key: string;
}
+
+// ==================== Response Schemas ====================
+
+export const ApiKeySchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ enabled: z.boolean().nullable(),
+ expiresAt: dateTimeSchema.nullable(),
+ id: z.string(),
+ lastUsedAt: dateTimeSchema.nullable(),
+ name: z.string(),
+ scopes: z.array(z.enum(API_KEY_SCOPES)).nullable(),
+ updatedAt: dateTimeSchema,
+ })
+ .strict()
+ .meta({ id: 'ApiKey' });
+
+export const CreatedApiKeySchema = ApiKeySchema.extend({
+ /** Plaintext is returned only by the create operation. */
+ key: z.string(),
+})
+ .strict()
+ .meta({ id: 'CreatedApiKey' });
diff --git a/packages/openapi/src/types/chat-group.type.ts b/packages/openapi/src/types/chat-group.type.ts
index 8f931c4cd02..e5eedea705b 100644
--- a/packages/openapi/src/types/chat-group.type.ts
+++ b/packages/openapi/src/types/chat-group.type.ts
@@ -1,8 +1,8 @@
import { z } from 'zod';
-import type { PublicChatGroup } from '../helpers/public-fields';
+import type { PublicChatGroup, PublicChatGroupMember } from '../helpers/public-fields';
import type { IPaginationQuery } from './common.type';
-import { PaginationQuerySchema } from './common.type';
+import { dateTimeSchema, PaginationQuerySchema } from './common.type';
// The supervisor is the group's own synthetic agent, created with the group;
// an existing agent can never be promoted into that role.
@@ -67,3 +67,39 @@ export interface ChatGroupListResponse {
chatGroups: PublicChatGroup[];
total: number;
}
+
+// ==================== Response Schemas ====================
+
+/** One `chat_groups_agents` row as `projectPublicChatGroup` exposes it. */
+export const ChatGroupMemberSchema = z
+ .object({
+ agentId: z.string(),
+ enabled: z.boolean().nullable(),
+ order: z.number().int().nullable(),
+ // `supervisor` is the group's own synthetic agent; callers can only assign the other two.
+ role: z.enum(['supervisor', ...CHAT_GROUP_MEMBER_ROLES]).nullable(),
+ } satisfies Record<keyof PublicChatGroupMember, z.ZodType>)
+ .strict()
+ .meta({ id: 'ChatGroupMember' });
+
+export const ChatGroupSchema = z
+ .object({
+ avatar: z.string().nullable(),
+ backgroundColor: z.string().nullable(),
+ createdAt: dateTimeSchema,
+ description: z.string().nullable(),
+ id: z.string(),
+ /** The supervisor first, then members by `order`. */
+ members: z.array(ChatGroupMemberSchema),
+ personal: z.boolean(),
+ pinned: z.boolean().nullable(),
+ title: z.string().nullable(),
+ updatedAt: dateTimeSchema,
+ } satisfies Record<keyof PublicChatGroup, z.ZodType>)
+ .strict()
+ .meta({ id: 'ChatGroup' });
+
+export const ChatGroupListSchema = z
+ .object({ chatGroups: z.array(ChatGroupSchema), total: z.number().int().min(0) })
+ .strict()
+ .meta({ id: 'ChatGroupList' });
diff --git a/packages/openapi/src/types/chat.type.ts b/packages/openapi/src/types/chat.type.ts
index 93d7002bfe2..a03d10406a6 100644
--- a/packages/openapi/src/types/chat.type.ts
+++ b/packages/openapi/src/types/chat.type.ts
@@ -166,3 +166,36 @@ export interface ChatServiceConfig {
defaultProvider?: string;
timeout?: number;
}
+
+// ==================== Response Schemas ====================
+
+/**
+ * `POST /chat`. `model` / `provider` are the resolved values (request or the
+ * product defaults), so they are always present. `usage` is the provider's own
+ * usage object when it answered with JSON; a streamed upstream reply carries none.
+ */
+export const ChatResponseSchema = z
+ .object({
+ content: z.string(),
+ model: z.string(),
+ provider: z.string(),
+ usage: z
+ .object({
+ completion_tokens: z.number().int().optional(),
+ prompt_tokens: z.number().int().optional(),
+ total_tokens: z.number().int().optional(),
+ })
+ .optional(),
+ })
+ .strict()
+ .meta({ id: 'ChatResponse' });
+
+export const ChatTranslateResponseSchema = z
+ .object({ translatedText: z.string() })
+ .strict()
+ .meta({ id: 'ChatTranslateResponse' });
+
+export const ChatGenerateReplyResponseSchema = z
+ .object({ reply: z.string() })
+ .strict()
+ .meta({ id: 'ChatGenerateReplyResponse' });
diff --git a/packages/openapi/src/types/common.type.ts b/packages/openapi/src/types/common.type.ts
index 2b2f4ac42eb..e086c5de01b 100644
--- a/packages/openapi/src/types/common.type.ts
+++ b/packages/openapi/src/types/common.type.ts
@@ -39,3 +39,30 @@ export const PaginationQuerySchema = z.object({
export type PaginationQueryResponse<T = any> = {
total: number;
} & T;
+
+// ==================== Common Response Schemas ====================
+
+/** Timestamps leave the API as ISO 8601 strings (`Date` serialized by `c.json`). */
+export const dateTimeSchema = z.string().meta({ format: 'date-time' });
+
+/** A stored JSON object column whose keys are owned by the client or a plugin. */
+export const jsonObjectSchema = z.record(z.string(), z.unknown());
+
+/**
+ * What a single-resource DELETE answers with: the id that is now gone. Every
+ * DELETE returns this (or `DeletedResources` for bulk removals) instead of an
+ * empty body, so clients can confirm which resource the call removed.
+ */
+export const DeletedResourceSchema = z
+ .object({ deleted: z.literal(true), id: z.string() })
+ .strict()
+ .meta({ id: 'DeletedResource' });
+
+/** What a bulk DELETE answers with: how many rows the call removed. */
+export const DeletedResourcesSchema = z
+ .object({ count: z.number().int().min(0), deleted: z.literal(true) })
+ .strict()
+ .meta({ id: 'DeletedResources' });
+
+export type DeletedResource = z.infer<typeof DeletedResourceSchema>;
+export type DeletedResources = z.infer<typeof DeletedResourcesSchema>;
diff --git a/packages/openapi/src/types/eval-resource.type.ts b/packages/openapi/src/types/eval-resource.type.ts
index dc64809be91..f1ccb3224f2 100644
--- a/packages/openapi/src/types/eval-resource.type.ts
+++ b/packages/openapi/src/types/eval-resource.type.ts
@@ -35,7 +35,7 @@ export const EvalModeSchema = z.enum([
]);
const json = z.record(z.string(), z.unknown());
const name = z.string().trim().min(1).max(255);
-const AnswerExtractorSchema = z.discriminatedUnion('type', [
+export const AnswerExtractorSchema = z.discriminatedUnion('type', [
z
.object({
type: z.literal('regex'),
@@ -59,6 +59,27 @@ const AnswerExtractorSchema = z.discriminatedUnion('type', [
})
.strict(),
]);
+/** Evaluator options of one rubric, shared by the request and response schemas. */
+export const RubricConfigSchema = z.union([
+ z.object({ value: z.string(), threshold: z.number().optional() }).strict(),
+ z.object({ value: z.number(), tolerance: z.number().optional() }),
+ z.object({ pattern: z.string() }),
+ z.object({ code: z.string() }),
+ z.object({
+ criteria: z.string(),
+ model: z.string().optional(),
+ provider: z.string().optional(),
+ systemRole: z.string().optional(),
+ }),
+ z.object({ values: z.array(z.string()), caseSensitive: z.boolean().optional() }).strict(),
+ z.object({ schema: json }).strict(),
+ z
+ .object({
+ extractor: AnswerExtractorSchema,
+ innerMatcher: EvalModeSchema.optional(),
+ })
+ .strict(),
+]);
export const CreateBenchmarkSchema = z
.object({
id: EvalIdSchema.optional(),
@@ -77,28 +98,7 @@ export const CreateBenchmarkSchema = z
weight: z.number().min(0),
threshold: z.number().optional(),
extractor: AnswerExtractorSchema.optional(),
- config: z.union([
- z.object({ value: z.string(), threshold: z.number().optional() }).strict(),
- z.object({ value: z.number(), tolerance: z.number().optional() }),
- z.object({ pattern: z.string() }),
- z.object({ code: z.string() }),
- z.object({
- criteria: z.string(),
- model: z.string().optional(),
- provider: z.string().optional(),
- systemRole: z.string().optional(),
- }),
- z
- .object({ values: z.array(z.string()), caseSensitive: z.boolean().optional() })
- .strict(),
- z.object({ schema: json }).strict(),
- z
- .object({
- extractor: AnswerExtractorSchema,
- innerMatcher: EvalModeSchema.optional(),
- })
- .strict(),
- ]),
+ config: RubricConfigSchema,
})
.strict(),
)
diff --git a/packages/openapi/src/types/eval-response.type.ts b/packages/openapi/src/types/eval-response.type.ts
index c1a045b71f2..a1d80373c7f 100644
--- a/packages/openapi/src/types/eval-response.type.ts
+++ b/packages/openapi/src/types/eval-response.type.ts
@@ -1,116 +1,426 @@
import { z } from 'zod';
-import {
- CreateBenchmarkSchema,
- CreateDatasetSchema,
- CreateTestCaseSchema,
-} from './eval-resource.type';
-
-const id = z.string();
-const timestamp = z.iso.datetime();
-const json = z.record(z.string(), z.unknown());
-const dates = { createdAt: timestamp, updatedAt: timestamp };
-const nullable = z.string().nullable();
-const benchmark = CreateBenchmarkSchema.extend({
- id,
- ...dates,
- isSystem: z.boolean(),
- description: nullable,
- metadata: json.nullable(),
- referenceUrl: nullable,
-});
-const dataset = CreateDatasetSchema.extend({
- id,
- ...dates,
- benchmarkId: nullable,
- sourceExperimentId: nullable,
- description: nullable,
- evalMode: nullable,
- evalConfig: json.nullable(),
- metadata: json.nullable(),
- testCaseCount: z.number().int(),
-});
-const testCase = CreateTestCaseSchema.extend({
- id,
- ...dates,
- datasetId: id,
- content: json,
- metadata: json.nullable(),
- sortOrder: z.number().nullable(),
+import { dateTimeSchema, jsonObjectSchema } from './common.type';
+import { AnswerExtractorSchema, EvalMessageSchema, RubricConfigSchema } from './eval-resource.type';
+
+// ==================== Response Schemas ====================
+
+const total = z.number().int().min(0);
+
+/** Every evaluator a stored rubric / dataset / case can name (the DB enum). */
+const StoredEvalModeSchema = z.enum([
+ 'equals',
+ 'contains',
+ 'regex',
+ 'starts-with',
+ 'ends-with',
+ 'any-of',
+ 'numeric',
+ 'extract-match',
+ 'json-schema',
+ 'javascript',
+ 'python',
+ 'llm-rubric',
+ 'rule-checklist',
+ 'factuality',
+ 'answer-relevance',
+ 'similar',
+ 'levenshtein',
+ 'rubric',
+ 'external',
+]);
+
+const RunStatusSchema = z.enum([
+ 'idle',
+ 'pending',
+ 'running',
+ 'completed',
+ 'failed',
+ 'aborted',
+ 'external',
+]);
+
+const RunTopicStatusSchema = z.enum([
+ 'pending',
+ 'running',
+ 'passed',
+ 'failed',
+ 'error',
+ 'timeout',
+ 'external',
+ 'completed',
+ 'judge_error',
+]);
+
+// ---------- Resources (benchmarks / datasets / test cases) ----------
+
+export const EvalBenchmarkRubricSchema = z
+ .object({
+ config: RubricConfigSchema,
+ extractor: AnswerExtractorSchema.optional(),
+ id: z.string(),
+ name: z.string(),
+ threshold: z.number().optional(),
+ type: StoredEvalModeSchema,
+ weight: z.number(),
+ })
+ .strict()
+ .meta({ id: 'EvalBenchmarkRubric' });
+
+/** `projectBenchmark` in eval-resource.service. */
+export const EvalBenchmarkSchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ description: z.string().nullable(),
+ id: z.string(),
+ identifier: z.string(),
+ isSystem: z.boolean(),
+ metadata: jsonObjectSchema.nullable(),
+ name: z.string(),
+ referenceUrl: z.string().nullable(),
+ rubrics: z.array(EvalBenchmarkRubricSchema),
+ updatedAt: dateTimeSchema,
+ })
+ .strict()
+ .meta({ id: 'EvalBenchmark' });
+
+export const EvalBenchmarkListSchema = z
+ .object({ benchmarks: z.array(EvalBenchmarkSchema), total })
+ .strict();
+
+/** `projectPublicEvalDataset` + the dataset's case count (eval-resource.service). */
+export const EvalDatasetSchema = z
+ .object({
+ benchmarkId: z.string().nullable(),
+ createdAt: dateTimeSchema,
+ description: z.string().nullable(),
+ evalConfig: jsonObjectSchema.nullable(),
+ evalMode: StoredEvalModeSchema.nullable(),
+ id: z.string(),
+ identifier: z.string(),
+ metadata: jsonObjectSchema.nullable(),
+ name: z.string(),
+ sourceExperimentId: z.string().nullable(),
+ testCaseCount: total,
+ updatedAt: dateTimeSchema,
+ })
+ .strict()
+ .meta({ id: 'EvalDataset' });
+
+export const EvalDatasetListSchema = z
+ .object({ datasets: z.array(EvalDatasetSchema), total })
+ .strict();
+
+/** A history message restored before the case input (`ImportedMessage`). */
+const EvalStoredMessageSchema = z.object(EvalMessageSchema.shape);
+
+/** The stored case content (`EvalTestCaseContent`). */
+const EvalTestCaseContentSchema = z.object({
+ category: z.string().optional(),
+ choices: z.array(z.string()).optional(),
+ /** Per-case runtime configuration (`EvalCaseEnvironment`). */
+ environment: jsonObjectSchema.optional(),
+ expected: z.string().optional(),
+ input: z.string(),
+ messages: z.array(EvalStoredMessageSchema).optional(),
});
-const run = z
+
+/**
+ * `projectTestCase` in eval-resource.service: the public columns plus the
+ * content fields lifted to the top level. Lifted fields absent from the stored
+ * content are omitted.
+ */
+export const EvalTestCaseSchema = z
.object({
- id,
- ...dates,
- config: json,
- executionMode: z.enum(['internal', 'external']),
- datasetId: id,
- experimentId: nullable,
- parentRunId: nullable,
- status: z.enum(['idle', 'pending', 'running', 'external', 'completed', 'failed', 'aborted']),
- targetAgentId: nullable,
- name: nullable,
- metrics: json.nullable(),
- startedAt: timestamp.nullable(),
+ caseId: z.string().optional(),
+ category: z.string().optional(),
+ choices: z.array(z.string()).optional(),
+ content: EvalTestCaseContentSchema,
+ createdAt: dateTimeSchema,
+ datasetId: z.string(),
+ environment: jsonObjectSchema.optional(),
+ evalConfig: jsonObjectSchema.nullable(),
+ evalMode: StoredEvalModeSchema.nullable(),
+ expected: z.string().optional(),
+ id: z.string(),
+ input: z.string(),
+ messages: z.array(EvalStoredMessageSchema).optional(),
+ metadata: jsonObjectSchema.nullable(),
+ sortOrder: z.number().int().nullable(),
+ updatedAt: dateTimeSchema,
+ })
+ .strict()
+ .meta({ id: 'EvalTestCase' });
+
+export const EvalTestCaseListSchema = z
+ .object({ testCases: z.array(EvalTestCaseSchema), total })
+ .strict();
+
+// ---------- Runs ----------
+
+/** Run aggregates (`EvalRunMetrics`); a run that was reset may carry only progress fields. */
+export const EvalRunMetricsSchema = z
+ .object({
+ averageScore: z.number().optional(),
+ completedCases: z.number().optional(),
+ cost: z.number().optional(),
+ duration: z.number().optional(),
+ errorCases: z.number().optional(),
+ externalCases: z.number().optional(),
+ failedCases: z.number().optional(),
+ judgeErrorCases: z.number().optional(),
+ llmCalls: z.number().optional(),
+ passAllAt: z.record(z.string(), z.number()).optional(),
+ passAllK: z.number().optional(),
+ passAnyAt: z.record(z.string(), z.number()).optional(),
+ passAtK: z.number().optional(),
+ passedCases: z.number().optional(),
+ passRate: z.number().optional(),
+ perCaseCost: z.number().optional(),
+ perCaseLlmCalls: z.number().optional(),
+ perCaseSteps: z.number().optional(),
+ perCaseTokens: z.number().optional(),
+ perCaseToolCalls: z.number().optional(),
+ rubricScores: z.record(z.string(), z.number()).optional(),
+ steps: z.number().optional(),
+ timeoutCases: z.number().optional(),
+ tokens: z.number().optional(),
+ toolCalls: z.number().optional(),
+ totalCases: z.number().optional(),
+ totalCost: z.number().optional(),
+ totalDuration: z.number().optional(),
+ totalTokens: z.number().optional(),
+ })
+ .meta({ id: 'EvalRunMetrics' });
+
+const EvalCaseSelectionSchema = z
+ .object({
+ caseIds: z.array(z.string()).optional(),
+ mode: z.enum(['all', 'include', 'exclude']),
})
.strict();
-const runTopic = z
+
+/** `projectRun` in helpers/eval-run. */
+export const EvalRunSchema = z
.object({
- createdAt: timestamp,
- evalResult: json.nullable(),
+ config: z
+ .object({
+ caseSelection: EvalCaseSelectionSchema.optional(),
+ k: z.number().int(),
+ maxConcurrency: z.number().int().optional(),
+ maxSteps: z.number().int().optional(),
+ timeout: z.number().int().optional(),
+ })
+ .strict(),
+ createdAt: dateTimeSchema,
+ datasetId: z.string(),
+ executionMode: z.enum(['internal', 'external']),
+ experimentId: z.string().nullable(),
+ id: z.string(),
+ metrics: EvalRunMetricsSchema.nullable(),
+ name: z.string().nullable(),
+ parentRunId: z.string().nullable(),
+ startedAt: dateTimeSchema.nullable(),
+ status: RunStatusSchema,
+ targetAgentId: z.string().nullable(),
+ updatedAt: dateTimeSchema,
+ })
+ .strict()
+ .meta({ id: 'EvalRun' });
+
+export const EvalRunListSchema = z.object({ runs: z.array(EvalRunSchema), total }).strict();
+
+export const EvalRubricScoreSchema = z
+ .object({
+ reason: z.string().optional(),
+ rubricId: z.string(),
+ score: z.number(),
+ verdicts: z
+ .array(
+ z
+ .object({
+ reason: z.string().optional(),
+ rule: z.string(),
+ verdict: z.enum(['satisfied', 'unverifiable', 'violated']),
+ })
+ .strict(),
+ )
+ .optional(),
+ })
+ .strict()
+ .meta({ id: 'EvalRubricScore' });
+
+/** One pass@k attempt, as `projectResult` in eval.service exposes it. */
+export const EvalThreadResultSchema = z
+ .object({
+ completionReason: z.string().optional(),
+ cost: z.number().optional(),
+ duration: z.number().optional(),
+ error: z.string().optional(),
+ llmCalls: z.number().optional(),
+ passed: z.boolean().optional(),
+ rubricScores: z.array(EvalRubricScoreSchema).optional(),
+ score: z.number().optional(),
+ status: z
+ .enum([
+ 'error',
+ 'external',
+ 'failed',
+ 'passed',
+ 'running',
+ 'timeout',
+ 'completed',
+ 'judge_error',
+ ])
+ .optional(),
+ steps: z.number().optional(),
+ threadId: z.string(),
+ tokens: z.number().optional(),
+ toolCalls: z.number().optional(),
+ })
+ .strict()
+ .meta({ id: 'EvalThreadResult' });
+
+const evalResultFields = {
+ awaitingExternalEval: z.boolean().optional(),
+ completionReason: z.string().optional(),
+ cost: z.number().optional(),
+ duration: z.number().optional(),
+ error: z.string().optional(),
+ /** Opaque evidence reported by an external evaluator. */
+ externalResult: jsonObjectSchema.optional(),
+ /** Per-thread external evidence for k > 1 runs, keyed by thread id. */
+ externalThreadResults: jsonObjectSchema.optional(),
+ extractedAnswer: z.string().optional(),
+ llmCalls: z.number().optional(),
+ passAllK: z.boolean().optional(),
+ passAtK: z.boolean().optional(),
+ rubricScores: z.array(EvalRubricScoreSchema).optional(),
+ steps: z.number().optional(),
+ threads: z.array(EvalThreadResultSchema).optional(),
+ tokens: z.number().optional(),
+ toolCalls: z.number().optional(),
+ totalCost: z.number().optional(),
+ totalDuration: z.number().optional(),
+ totalTokens: z.number().optional(),
+};
+
+/** The scored outcome of one case, projected by `projectResult` in eval.service. */
+export const EvalCaseResultSchema = z
+ .object(evalResultFields)
+ .strict()
+ .meta({ id: 'EvalCaseResult' });
+
+const judgesSchema = z.array(z.object({ model: z.string(), provider: z.string() }).strict());
+
+/** A stored pass@k attempt (`EvalThreadResult`), including execution bookkeeping. */
+const EvalStoredThreadResultSchema = z.object({
+ ...EvalThreadResultSchema.shape,
+ errorPhase: z.literal('judge').optional(),
+ executionId: z.string().optional(),
+ judgeError: z.string().optional(),
+ judges: judgesSchema.optional(),
+ memorySnapshot: jsonObjectSchema.optional(),
+ operationId: z.string().optional(),
+});
+
+/**
+ * The stored `evalResult` column (`EvalRunTopicResult`) as `GET /runs/{id}/topics`
+ * returns it unprojected: the scored fields plus execution bookkeeping.
+ */
+export const EvalStoredResultSchema = z
+ .object({
+ ...evalResultFields,
+ dispatchedAt: z.string().optional(),
+ errorDetail: z.unknown().optional(),
+ errorPhase: z.literal('judge').optional(),
+ executionId: z.string().optional(),
+ judgeError: z.string().optional(),
+ judges: judgesSchema.optional(),
+ /** Final state of the attempt's isolated Memory. */
+ memorySnapshot: jsonObjectSchema.optional(),
+ operationId: z.string().optional(),
+ threads: z.array(EvalStoredThreadResultSchema).optional(),
+ })
+ .meta({ id: 'EvalStoredResult' });
+
+/** One case of a run in `GET /runs/{id}/results`. */
+export const EvalRunResultSchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ input: z.string(),
passed: z.boolean().nullable(),
- runId: id,
+ result: EvalCaseResultSchema.nullable(),
score: z.number().nullable(),
- status: nullable,
- testCaseId: id,
- topicId: id,
- input: z.string(),
+ status: RunTopicStatusSchema.nullable(),
+ testCaseId: z.string(),
+ topicId: z.string(),
})
+ .strict()
+ .meta({ id: 'EvalRunResult' });
+
+export const EvalRunResultListSchema = z
+ .object({ results: z.array(EvalRunResultSchema), runId: z.string(), total })
.strict();
-const runResult = runTopic
- .omit({ evalResult: true, runId: true })
- .extend({ result: json.nullable() });
-const receipt = z
+
+/** One case topic of a run in `GET /runs/{id}/topics`. */
+export const EvalRunTopicSchema = z
.object({
- idempotent: z.boolean(),
- reportedThreads: z.number(),
- runId: id,
- runStatus: z.string().optional(),
- success: z.boolean(),
- threadId: id.optional(),
- topicFinalized: z.boolean(),
- topicId: id,
- totalThreads: z.number(),
+ createdAt: dateTimeSchema,
+ evalResult: EvalStoredResultSchema.nullable(),
+ input: z.string(),
+ passed: z.boolean().nullable(),
+ runId: z.string(),
+ score: z.number().nullable(),
+ status: RunTopicStatusSchema.nullable(),
+ testCaseId: z.string(),
+ topicId: z.string(),
})
+ .strict()
+ .meta({ id: 'EvalRunTopic' });
+
+export const EvalRunTopicListSchema = z
+ .object({ runId: z.string(), topics: z.array(EvalRunTopicSchema), total })
.strict();
-const page = (key: string, schema: z.ZodType) =>
- z.object({ [key]: z.array(schema), total: z.number().int().min(0) });
-
-export const evalResponseSchema = (method: string, rest: string) => {
- if (method === 'delete') return z.toJSONSchema(z.object({ id }).strict());
- if (rest.endsWith('/retry-errors'))
- return z.toJSONSchema(z.object({ runId: id, retryCount: z.number() }).strict());
- if (rest.endsWith('/result')) return z.toJSONSchema(receipt);
- if (rest.endsWith('/results') && method === 'post')
- return z.toJSONSchema(
- z
- .object({ items: z.array(receipt), runId: id, runStatus: z.string(), success: z.boolean() })
- .strict(),
- );
- if (rest.endsWith('/results'))
- return z.toJSONSchema(page('results', runResult).extend({ runId: id }));
- if (rest.endsWith('/topics'))
- return z.toJSONSchema(page('topics', runTopic).extend({ runId: id }));
- if (rest.endsWith('/test-cases'))
- return z.toJSONSchema(method === 'get' ? page('testCases', testCase) : testCase);
- if (rest.startsWith('test-cases/')) return z.toJSONSchema(testCase);
- if (rest.startsWith('benchmarks'))
- return z.toJSONSchema(
- rest === 'benchmarks' && method === 'get' ? page('benchmarks', benchmark) : benchmark,
- );
- if (rest.startsWith('datasets'))
- return z.toJSONSchema(
- rest === 'datasets' && method === 'get' ? page('datasets', dataset) : dataset,
- );
- return z.toJSONSchema(rest === 'runs' && method === 'get' ? page('runs', run) : run);
+
+// ---------- External worker lifecycle ----------
+
+export const EvalRetryErrorsSchema = z
+ .object({ retryCount: total, runId: z.string() })
+ .strict()
+ .meta({ id: 'EvalRetryErrors' });
+
+const reportReceiptFields = {
+ /** True when the call replayed a result that was already recorded. */
+ idempotent: z.boolean(),
+ reportedThreads: total,
+ runId: z.string(),
+ success: z.literal(true),
+ /** Echoes the request's `threadId`; absent when none was sent. */
+ threadId: z.string().optional(),
+ topicFinalized: z.boolean(),
+ topicId: z.string(),
+ totalThreads: total,
};
+
+/** What `applyReportResult` answers for one reported item of a batch. */
+export const EvalReportReceiptSchema = z
+ .object(reportReceiptFields)
+ .strict()
+ .meta({ id: 'EvalReportReceipt' });
+
+/** `PUT /runs/{runId}/topics/{topicId}/result`: the receipt plus the run's status after it. */
+export const EvalReportResultSchema = z
+ .object({ ...reportReceiptFields, runStatus: RunStatusSchema })
+ .strict()
+ .meta({ id: 'EvalReportResult' });
+
+export const EvalBatchReportResultSchema = z
+ .object({
+ items: z.array(EvalReportReceiptSchema),
+ runId: z.string(),
+ runStatus: RunStatusSchema,
+ success: z.literal(true),
+ })
+ .strict()
+ .meta({ id: 'EvalBatchReportResult' });
diff --git a/packages/openapi/src/types/file.type.ts b/packages/openapi/src/types/file.type.ts
index 3c554a2b104..3c3661e4a29 100644
--- a/packages/openapi/src/types/file.type.ts
+++ b/packages/openapi/src/types/file.type.ts
@@ -1,8 +1,8 @@
import { z } from 'zod';
-import type { PublicFile, PublicKnowledgeBase } from '../helpers/public-fields';
+import type { PUBLIC_FILE_FIELDS, PublicFile, PublicKnowledgeBase } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
-import { PaginationQuerySchema } from './common.type';
+import { dateTimeSchema, jsonObjectSchema, PaginationQuerySchema } from './common.type';
// ==================== File Upload Types ====================
@@ -396,3 +396,185 @@ export interface UpdateFileRequest {
export const UpdateFileSchema = z.object({
knowledgeBaseId: z.string().nullish(),
});
+
+// ==================== Response Schemas ====================
+
+const ASYNC_TASK_STATUSES = ['error', 'pending', 'processing', 'success'] as const;
+
+/** Every column `projectPublicFile` copies, so a new public field fails to compile here. */
+const fileShape = {
+ createdAt: dateTimeSchema,
+ fileType: z.string(),
+ id: z.string(),
+ metadata: jsonObjectSchema.nullable(),
+ name: z.string(),
+ parentId: z.string().nullable(),
+ size: z.number().int(),
+ source: z.string().nullable(),
+ updatedAt: dateTimeSchema,
+ /** Full URL: relative storage keys are expanded before the file is returned. */
+ url: z.string(),
+ visibility: z.enum(['private', 'public']),
+} satisfies Record<(typeof PUBLIC_FILE_FIELDS)[number], z.ZodType>;
+
+export const FileSchema = z.object(fileShape).strict().meta({ id: 'File' });
+
+/** How an async chunking / embedding task failed, as stored on the task row. */
+export const AsyncTaskErrorSchema = z
+ .object({
+ body: z.union([
+ z.string(),
+ z.object({ detail: z.string(), retryAt: dateTimeSchema.optional() }),
+ ]),
+ name: z.string(),
+ })
+ .meta({ id: 'AsyncTaskError' });
+
+export const FileAsyncTaskSchema = z
+ .object({
+ /** Chunk count; only reported on the chunking task. */
+ count: z.number().int().nullable().optional(),
+ error: AsyncTaskErrorSchema.nullable(),
+ /** Absent when the file has chunks but its chunking task row is gone. */
+ id: z.string().optional(),
+ status: z.enum(ASYNC_TASK_STATUSES).nullable(),
+ type: z.enum(['chunk', 'embedding']).optional(),
+ })
+ .strict()
+ .meta({ id: 'FileAsyncTask' });
+
+/** Knowledge base a listed file belongs to (only the columns the list joins). */
+export const FileKnowledgeBaseRefSchema = z
+ .object({
+ avatar: z.string().nullable(),
+ description: z.string().nullable(),
+ id: z.string(),
+ name: z.string(),
+ })
+ .strict()
+ .meta({ id: 'FileKnowledgeBaseRef' });
+
+/** Owner of a listed file (every owner of the same content when the caller has global read). */
+export const FileUserSchema = z
+ .object({
+ avatar: z.string().nullable(),
+ email: z.string().nullable(),
+ fullName: z.string().nullable(),
+ id: z.string(),
+ username: z.string().nullable(),
+ })
+ .strict()
+ .meta({ id: 'FileUser' });
+
+export const FileListItemSchema = FileSchema.extend({
+ chunking: FileAsyncTaskSchema.nullable(),
+ embedding: FileAsyncTaskSchema.nullable(),
+ knowledgeBases: z.array(FileKnowledgeBaseRefSchema),
+ users: z.array(FileUserSchema),
+})
+ .strict()
+ .meta({ id: 'FileListItem' });
+
+export const FileListResponseSchema = z
+ .object({
+ /** Files sharing the same content hash are listed once. */
+ files: z.array(FileListItemSchema),
+ total: z.number().int().min(0),
+ /** Sum of the matched files' sizes in bytes, as a decimal string. */
+ totalSize: z.string(),
+ })
+ .strict()
+ .meta({ id: 'FileList' });
+
+export const FileParseResultSchema = z
+ .object({
+ /** Absent when the detail lookup could not parse the file; null for an empty stored document. */
+ content: z.string().nullable().optional(),
+ error: z.string().optional(),
+ fileId: z.string(),
+ fileType: z.string(),
+ metadata: z
+ .object({
+ pages: z.number().int().min(0),
+ title: z.string().optional(),
+ totalCharCount: z.number().int().optional(),
+ totalLineCount: z.number().int().optional(),
+ })
+ .strict()
+ .optional(),
+ name: z.string(),
+ parseStatus: z.enum(['completed', 'failed']),
+ parsedAt: dateTimeSchema.optional(),
+ })
+ .strict()
+ .meta({ id: 'FileParseResult' });
+
+export const FileDetailSchema = z
+ .object({
+ file: FileSchema,
+ /** Parse result; absent for images, which are never parsed. */
+ parsed: FileParseResultSchema.optional(),
+ })
+ .strict()
+ .meta({ id: 'FileDetail' });
+
+export const FileUrlResponseSchema = z
+ .object({
+ expiresAt: dateTimeSchema,
+ expiresIn: z.number().int(),
+ fileId: z.string(),
+ name: z.string(),
+ /** Pre-signed URL, valid for `expiresIn` seconds. */
+ url: z.string(),
+ })
+ .strict()
+ .meta({ id: 'FileUrl' });
+
+export const BatchFileUploadResponseSchema = z
+ .object({
+ failed: z.array(z.object({ error: z.string(), name: z.string() }).strict()),
+ successful: z.array(FileDetailSchema),
+ summary: z
+ .object({
+ failed: z.number().int().min(0),
+ successful: z.number().int().min(0),
+ total: z.number().int().min(0),
+ })
+ .strict(),
+ })
+ .strict()
+ .meta({ id: 'BatchFileUploadResult' });
+
+export const BatchGetFilesResponseSchema = z
+ .object({
+ failed: z.array(z.object({ error: z.string(), fileId: z.string() }).strict()),
+ files: z.array(FileDetailSchema),
+ success: z.number().int().min(0),
+ total: z.number().int().min(0),
+ })
+ .strict()
+ .meta({ id: 'BatchGetFilesResult' });
+
+export const FileChunkTaskResponseSchema = z
+ .object({
+ chunkTaskId: z.string().nullable(),
+ /** Set only when `autoEmbedding` was requested. */
+ embeddingTaskId: z.string().nullable(),
+ fileId: z.string(),
+ message: z.string(),
+ success: z.literal(true),
+ })
+ .strict()
+ .meta({ id: 'FileChunkTask' });
+
+export const FileChunkStatusResponseSchema = z
+ .object({
+ chunkCount: z.number().int().min(0),
+ chunkingError: AsyncTaskErrorSchema.nullable(),
+ chunkingStatus: z.enum(ASYNC_TASK_STATUSES).nullable(),
+ embeddingError: AsyncTaskErrorSchema.nullable(),
+ embeddingStatus: z.enum(ASYNC_TASK_STATUSES).nullable(),
+ finishEmbedding: z.boolean(),
+ })
+ .strict()
+ .meta({ id: 'FileChunkStatus' });
diff --git a/packages/openapi/src/types/goal.type.test.ts b/packages/openapi/src/types/goal.type.test.ts
new file mode 100644
index 00000000000..173318c5fa8
--- /dev/null
+++ b/packages/openapi/src/types/goal.type.test.ts
@@ -0,0 +1,208 @@
+import { describe, expect, it } from 'vitest';
+
+import {
+ GoalAdvanceResultSchema,
+ GoalGraphSchema,
+ GoalGraphSnapshotSchema,
+ GoalListResponseSchema,
+ GoalSupervisionSchema,
+} from './goal.type';
+
+/** What `c.json` does to a payload: Dates become ISO strings, `undefined` keys vanish. */
+// A JSON round trip on purpose: `structuredClone` would keep the Dates the wire turns into strings.
+// eslint-disable-next-line unicorn/prefer-structured-clone
+const wire = <T>(value: T) => JSON.parse(JSON.stringify(value));
+
+const now = new Date('2026-11-17T08:00:00.000Z');
+
+const goalRow = {
+ agentId: 'agt-1',
+ archivedAt: null,
+ completedAt: null,
+ config: { supervision: { enabled: true } },
+ createdAt: now,
+ deletedAt: null,
+ id: 'goal-1',
+ isDeleted: null,
+ maxRounds: null,
+ maxTotalCost: 5,
+ projectId: null,
+ requirement: 'Ship it',
+ startedAt: now,
+ status: 'running',
+ subjectId: null,
+ subjectType: 'standalone',
+ title: 'Ship the personal agent',
+ updatedAt: now,
+ userId: 'user-1',
+ visibility: 'public',
+ workspaceId: null,
+};
+
+const snapshot = {
+ decisions: [
+ {
+ accessedAt: now,
+ authority: 'user',
+ canceledAt: null,
+ createdAt: now,
+ id: 'dec-1',
+ nodeId: 'node-2',
+ options: [{ effect: 'retry', id: 'retry', label: 'Retry' }],
+ question: 'Retry the task?',
+ recommendedOptionId: 'retry',
+ requestedProjectRole: null,
+ requestedUserId: null,
+ resolution: null,
+ resolvedAt: null,
+ resolvedByAgentId: null,
+ resolvedByUserId: null,
+ resolvedOptionId: null,
+ status: 'pending',
+ updatedAt: now,
+ },
+ ],
+ edges: [
+ {
+ createdAt: now,
+ goalId: 'goal-1',
+ id: 'edge-1',
+ kind: 'depends_on',
+ sourceNodeId: 'node-1',
+ targetNodeId: 'node-2',
+ },
+ ],
+ events: [
+ {
+ actorId: 'user-1',
+ actorType: 'user',
+ createdAt: now,
+ entityId: 'goal-1',
+ entityType: 'goal',
+ eventType: 'created',
+ goalId: 'goal-1',
+ id: 'evt-1',
+ operationId: null,
+ reason: null,
+ taskId: null,
+ },
+ ],
+ goal: goalRow,
+ nodes: [
+ {
+ accessedAt: now,
+ confidence: '0.800',
+ createdAt: now,
+ createdByAgentId: null,
+ createdByUserId: 'user-1',
+ description: null,
+ goalId: 'goal-1',
+ id: 'node-1',
+ kind: 'task',
+ priority: 0,
+ resolvedAt: null,
+ status: 'active',
+ taskId: 'task-1',
+ title: 'Draft the plan',
+ updatedAt: now,
+ },
+ ],
+ workVersions: [
+ {
+ createdAt: now,
+ id: 'link-1',
+ nodeId: 'node-1',
+ relation: 'produced',
+ work: {
+ identifier: null,
+ resourceId: 'doc-1',
+ status: null,
+ title: 'Plan',
+ type: 'document',
+ url: null,
+ workId: 'work-1',
+ },
+ workVersionId: 'wv-1',
+ },
+ ],
+};
+
+describe('goal response schemas', () => {
+ it('accepts a write-path graph snapshot as it leaves the API', () => {
+ expect(() => GoalGraphSnapshotSchema.parse(wire(snapshot))).not.toThrow();
+ });
+
+ it('accepts a fetched graph with its read-time roll-ups', () => {
+ const graph = {
+ ...snapshot,
+ acceptances: { 'node-1': { id: 'acc-1', status: 'verifying' } },
+ assignees: { 'node-1': 'agt-2' },
+ metricCriteria: { allMet: false, criteria: [] },
+ runHeartbeats: { 'node-1': now },
+ spend: {
+ byTask: [
+ {
+ runs: 1,
+ taskId: 'task-1',
+ totalCost: 0.1,
+ totalInputTokens: 10,
+ totalOutputTokens: 5,
+ totalTokens: 15,
+ },
+ ],
+ runs: 1,
+ totalCost: 0.1,
+ totalInputTokens: 10,
+ totalOutputTokens: 5,
+ totalTokens: 15,
+ },
+ };
+
+ expect(() => GoalGraphSchema.parse(wire(graph))).not.toThrow();
+ });
+
+ it('refuses a graph that drops the spend roll-up `graph()` always attaches', () => {
+ expect(GoalGraphSchema.safeParse(wire(snapshot)).success).toBe(false);
+ });
+
+ it('accepts the list roll-up rows', () => {
+ const list = {
+ goals: [
+ {
+ findingCount: 0,
+ goal: goalRow,
+ pendingDecisions: 1,
+ signedOff: false,
+ taskDone: 0,
+ taskTotal: 1,
+ totalRunCost: 0,
+ totalRunDuration: 0,
+ },
+ ],
+ total: 1,
+ };
+
+ expect(() => GoalListResponseSchema.parse(wire(list))).not.toThrow();
+ });
+
+ it('accepts supervision with and without a ledger', () => {
+ expect(() => GoalSupervisionSchema.parse({ enabled: false })).not.toThrow();
+ expect(() =>
+ GoalSupervisionSchema.parse({
+ enabled: true,
+ state: { agentId: 'agt-1', incidents: [], revision: 1, topicId: 'tpc-1' },
+ }),
+ ).not.toThrow();
+ });
+
+ it('accepts the advance outcome with its tick count', () => {
+ expect(() =>
+ GoalAdvanceResultSchema.parse({
+ goalId: 'goal-1',
+ message: 'waiting on a person',
+ outcome: 'waiting_human',
+ ticks: 2,
+ }),
+ ).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/types/goal.type.ts b/packages/openapi/src/types/goal.type.ts
index f912b81d682..f3e0ed34dcf 100644
--- a/packages/openapi/src/types/goal.type.ts
+++ b/packages/openapi/src/types/goal.type.ts
@@ -1,6 +1,45 @@
+import type { GoalMetricCriteriaState } from '@lobechat/agent-tracing';
+import type {
+ AcceptanceStatus,
+ GoalDecisionAuthority,
+ GoalDecisionOption,
+ GoalDecisionOptionEffect,
+ GoalDecisionStatus,
+ GoalEdgeKind,
+ GoalEventActorType,
+ GoalEventEntityType,
+ GoalEventType,
+ GoalGraphDecision,
+ GoalGraphEdge,
+ GoalGraphEvent,
+ GoalGraphNode,
+ GoalGraphSnapshot,
+ GoalGraphWorkVersionDisplay,
+ GoalGraphWorkVersionLink,
+ GoalNodeAcceptance,
+ GoalNodeKind,
+ GoalNodeStatus,
+ GoalNodeWorkVersionRelation,
+ GoalReportState,
+ GoalReportStatus,
+ GoalReportTrigger,
+ GoalSpend,
+ GoalSupervisionIncident,
+ GoalSupervisionState,
+ GoalTickOutcome,
+ GoalTickResult,
+ VerifyCheckTally,
+ WorkResourceType,
+ WorkType,
+} from '@lobechat/types';
+import { GOAL_VISIBILITIES, GoalReportMetadataSchema } from '@lobechat/types';
import { z } from 'zod';
-import { goalStatuses } from '@/const/goal';
+import { goalStatuses, goalSubjectTypes } from '@/const/goal';
+import type { GoalListItem } from '@/database/models/goal';
+import type { GoalItem as GoalRow } from '@/database/schemas';
+
+import { dateTimeSchema, jsonObjectSchema } from './common.type';
// ==================== Path / Query Schemas ====================
@@ -101,3 +140,524 @@ export const RestartGoalRequestSchema = z.object({
agentId: z.string().min(1).optional(),
});
export type RestartGoalRequest = z.infer<typeof RestartGoalRequestSchema>;
+
+// ==================== Response Schemas ====================
+
+/**
+ * A `z.enum` over a TS string union that fails to compile when the union gains
+ * a member the list does not name, so the documented vocabulary cannot drift
+ * from the one the coordinator writes.
+ */
+const unionEnum =
+ <T extends string>() =>
+ <const A extends readonly [T, ...T[]]>(
+ values: A &
+ ([Exclude<T, A[number]>] extends [never] ? unknown : { missing: Exclude<T, A[number]> }),
+ ) =>
+ z.enum(values);
+
+const GoalNodeKindSchema = unionEnum<GoalNodeKind>()([
+ 'problem',
+ 'experiment',
+ 'task',
+ 'finding',
+ 'decision',
+ 'batch',
+ 'pattern',
+ 'tool',
+ 'hazard',
+ 'dead_end',
+ 'template',
+]);
+const GoalNodeStatusSchema = unionEnum<GoalNodeStatus>()([
+ 'proposed',
+ 'active',
+ 'waiting',
+ 'resolved',
+ 'rejected',
+ 'retired',
+]);
+const GoalEdgeKindSchema = unionEnum<GoalEdgeKind>()([
+ 'contains',
+ 'answers',
+ 'decomposes',
+ 'depends_on',
+ 'derived_from',
+ 'revises',
+ 'investigates',
+ 'produces',
+ 'supports',
+ 'contradicts',
+ 'leads_to',
+ 'confirms',
+ 'refutes',
+]);
+const GoalDecisionAuthoritySchema = unionEnum<GoalDecisionAuthority>()([
+ 'agent',
+ 'user',
+ 'project_role',
+]);
+const GoalDecisionStatusSchema = unionEnum<GoalDecisionStatus>()([
+ 'pending',
+ 'resolved',
+ 'canceled',
+]);
+const GoalEventTypeSchema = unionEnum<GoalEventType>()([
+ 'created',
+ 'updated',
+ 'activated',
+ 'resolved',
+ 'rejected',
+ 'retired',
+ 'linked',
+ 'unlinked',
+]);
+const GoalEventEntityTypeSchema = unionEnum<GoalEventEntityType>()([
+ 'goal',
+ 'node',
+ 'edge',
+ 'decision',
+ 'task',
+]);
+const GoalEventActorTypeSchema = unionEnum<GoalEventActorType>()(['agent', 'user', 'system']);
+const GoalNodeWorkVersionRelationSchema = unionEnum<GoalNodeWorkVersionRelation>()([
+ 'input',
+ 'produced',
+ 'supports',
+ 'contradicts',
+]);
+const WorkTypeSchema = unionEnum<WorkType>()([
+ 'canvas',
+ 'document',
+ 'external',
+ 'file',
+ 'goal_report',
+ 'task',
+]);
+const WorkResourceTypeSchema = unionEnum<WorkResourceType>()([
+ 'canvas',
+ 'document',
+ 'github_issue',
+ 'github_pull_request',
+ 'linear_document',
+ 'linear_issue',
+ 'file',
+ 'goal_report',
+ 'task',
+]);
+const AcceptanceStatusSchema = unionEnum<AcceptanceStatus>()([
+ 'pending',
+ 'planned',
+ 'verifying',
+ 'repairing',
+ 'delivered',
+ 'accepted',
+ 'closed',
+ 'rejected',
+ 'errored',
+]);
+
+/** A `goals` row exactly as `select()` reads it (soft-delete columns included). */
+export const GoalSchema = z
+ .object({
+ agentId: z.string().nullable(),
+ archivedAt: dateTimeSchema.nullable(),
+ completedAt: dateTimeSchema.nullable(),
+ /**
+ * Coordinator-owned runtime policy and state (budget, supervision, manager
+ * and rollout pockets). Its keys move with the coordinator, so it is
+ * documented as an open JSON object rather than pinned here.
+ */
+ config: jsonObjectSchema.nullable(),
+ createdAt: dateTimeSchema,
+ deletedAt: dateTimeSchema.nullable(),
+ id: z.string(),
+ isDeleted: z.boolean().nullable(),
+ maxRounds: z.number().int().nullable(),
+ maxTotalCost: z.number().nullable(),
+ projectId: z.string().nullable(),
+ requirement: z.string().nullable(),
+ startedAt: dateTimeSchema.nullable(),
+ status: z.enum(goalStatuses),
+ subjectId: z.string().nullable(),
+ subjectType: z.enum(goalSubjectTypes).nullable(),
+ title: z.string(),
+ updatedAt: dateTimeSchema,
+ userId: z.string(),
+ visibility: z.enum(GOAL_VISIBILITIES),
+ workspaceId: z.string().nullable(),
+ } satisfies Record<keyof GoalRow, z.ZodType>)
+ .strict()
+ .meta({ id: 'Goal' });
+
+/** One goal-list row: the goal plus the graph roll-up the list renders. */
+export const GoalListItemSchema = z
+ .object({
+ findingCount: z.number().int(),
+ goal: GoalSchema,
+ /** Decision gates waiting on a human right now. */
+ pendingDecisions: z.number().int(),
+ /** Achieved and accepted by its owner. */
+ signedOff: z.boolean(),
+ /** Task nodes in a terminal status (resolved / rejected / retired). */
+ taskDone: z.number().int(),
+ taskTotal: z.number().int(),
+ totalRunCost: z.number(),
+ /** Milliseconds across every finished run. */
+ totalRunDuration: z.number(),
+ } satisfies Record<keyof GoalListItem, z.ZodType>)
+ .strict()
+ .meta({ id: 'GoalListItem' });
+
+export const GoalListResponseSchema = z
+ .object({ goals: z.array(GoalListItemSchema), total: z.number().int() })
+ .strict()
+ .meta({ id: 'GoalList' });
+
+export const GoalGraphNodeSchema = z
+ .object({
+ accessedAt: dateTimeSchema,
+ /** Numeric(4,3) confidence from 0 to 1, serialized as a decimal string. */
+ confidence: z.string().nullable(),
+ createdAt: dateTimeSchema,
+ createdByAgentId: z.string().nullable(),
+ createdByUserId: z.string().nullable(),
+ description: z.string().nullable(),
+ goalId: z.string(),
+ id: z.string(),
+ kind: GoalNodeKindSchema,
+ priority: z.number().int(),
+ resolvedAt: dateTimeSchema.nullable(),
+ status: GoalNodeStatusSchema,
+ taskId: z.string().nullable(),
+ title: z.string(),
+ updatedAt: dateTimeSchema,
+ } satisfies Record<keyof GoalGraphNode | 'accessedAt', z.ZodType>)
+ .strict()
+ .meta({ id: 'GoalGraphNode' });
+
+export const GoalGraphEdgeSchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ goalId: z.string(),
+ id: z.string(),
+ kind: GoalEdgeKindSchema,
+ sourceNodeId: z.string(),
+ targetNodeId: z.string(),
+ } satisfies Record<keyof GoalGraphEdge, z.ZodType>)
+ .strict()
+ .meta({ id: 'GoalGraphEdge' });
+
+export const GoalDecisionOptionSchema = z
+ .object({
+ /** Unfinished tasks a `retire` effect takes along. */
+ alsoRetires: z.array(z.object({ nodeId: z.string(), title: z.string() }).strict()).optional(),
+ description: z.string().optional(),
+ effect: unionEnum<GoalDecisionOptionEffect>()([
+ 'retry',
+ 'retire',
+ 'retry_after_reset',
+ ]).optional(),
+ id: z.string(),
+ label: z.string(),
+ } satisfies Record<keyof GoalDecisionOption, z.ZodType>)
+ .strict()
+ .meta({ id: 'GoalDecisionOption' });
+
+export const GoalGraphDecisionSchema = z
+ .object({
+ accessedAt: dateTimeSchema,
+ authority: GoalDecisionAuthoritySchema,
+ canceledAt: dateTimeSchema.nullable(),
+ createdAt: dateTimeSchema,
+ id: z.string(),
+ nodeId: z.string(),
+ options: z.array(GoalDecisionOptionSchema).nullable(),
+ question: z.string(),
+ recommendedOptionId: z.string().nullable(),
+ requestedProjectRole: z.string().nullable(),
+ requestedUserId: z.string().nullable(),
+ resolution: z.string().nullable(),
+ resolvedAt: dateTimeSchema.nullable(),
+ resolvedByAgentId: z.string().nullable(),
+ resolvedByUserId: z.string().nullable(),
+ resolvedOptionId: z.string().nullable(),
+ status: GoalDecisionStatusSchema,
+ updatedAt: dateTimeSchema,
+ } satisfies Record<keyof GoalGraphDecision | 'accessedAt', z.ZodType>)
+ .strict()
+ .meta({ id: 'GoalGraphDecision' });
+
+export const GoalGraphEventSchema = z
+ .object({
+ actorId: z.string().nullable(),
+ actorType: GoalEventActorTypeSchema,
+ createdAt: dateTimeSchema,
+ entityId: z.string(),
+ entityType: GoalEventEntityTypeSchema,
+ eventType: GoalEventTypeSchema,
+ goalId: z.string(),
+ id: z.string(),
+ operationId: z.string().nullable(),
+ reason: z.string().nullable(),
+ taskId: z.string().nullable(),
+ } satisfies Record<keyof GoalGraphEvent, z.ZodType>)
+ .strict()
+ .meta({ id: 'GoalGraphEvent' });
+
+const GoalGraphWorkVersionDisplaySchema = z
+ .object({
+ agentDocumentId: z.string().optional(),
+ fileId: z.string().optional(),
+ fileSize: z.number().optional(),
+ fileUrl: z.string().optional(),
+ identifier: z.string().nullable(),
+ mimeType: z.string().optional(),
+ resourceId: z.string().nullable(),
+ resourceType: WorkResourceTypeSchema.optional(),
+ status: z.string().nullable(),
+ title: z.string().nullable(),
+ type: WorkTypeSchema,
+ url: z.string().nullable(),
+ workId: z.string(),
+ } satisfies Record<keyof GoalGraphWorkVersionDisplay, z.ZodType>)
+ .strict();
+
+export const GoalGraphWorkVersionLinkSchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ id: z.string(),
+ nodeId: z.string(),
+ relation: GoalNodeWorkVersionRelationSchema,
+ /** Display snapshot of the linked version; absent only when the version row is gone. */
+ work: GoalGraphWorkVersionDisplaySchema.optional(),
+ workVersionId: z.string(),
+ } satisfies Record<keyof GoalGraphWorkVersionLink, z.ZodType>)
+ .strict()
+ .meta({ id: 'GoalGraphWorkVersionLink' });
+
+const GoalNodeAcceptanceSchema = z
+ .object({
+ checks: z
+ .object({
+ failed: z.number().int(),
+ passed: z.number().int(),
+ total: z.number().int(),
+ unjudged: z.number().int(),
+ } satisfies Record<keyof VerifyCheckTally, z.ZodType>)
+ .strict()
+ .optional(),
+ id: z.string(),
+ status: AcceptanceStatusSchema,
+ } satisfies Record<keyof GoalNodeAcceptance, z.ZodType>)
+ .strict();
+
+const GoalReportStateSchema = z
+ .object({
+ dispatch: z
+ .object({
+ acceptanceKey: z.string(),
+ dispatchedAt: dateTimeSchema,
+ error: z.string().optional(),
+ nodeId: z.string(),
+ operationId: z.string().optional(),
+ taskId: z.string().optional(),
+ trigger: unionEnum<GoalReportTrigger>()([
+ 'accepted',
+ 'acceptance_failed',
+ 'goal_canceled',
+ 'goal_failed',
+ ]),
+ } satisfies Record<keyof GoalReportState['dispatch'], z.ZodType>)
+ .strict(),
+ latest: z
+ .object({
+ content: z.string().nullable(),
+ createdAt: dateTimeSchema,
+ metadata: GoalReportMetadataSchema,
+ pageDocumentId: z.string().optional(),
+ version: z.number().int(),
+ workId: z.string(),
+ workVersionId: z.string(),
+ } satisfies Record<keyof NonNullable<GoalReportState['latest']>, z.ZodType>)
+ .strict()
+ .optional(),
+ status: unionEnum<GoalReportStatus>()(['completed', 'failed', 'running']),
+ } satisfies Record<keyof GoalReportState, z.ZodType>)
+ .strict();
+
+const GoalSpendSchema = z
+ .object({
+ byTask: z.array(
+ z
+ .object({
+ runs: z.number().int(),
+ taskId: z.string(),
+ totalCost: z.number(),
+ totalInputTokens: z.number(),
+ totalOutputTokens: z.number(),
+ totalTokens: z.number(),
+ })
+ .strict(),
+ ),
+ runs: z.number().int(),
+ /** USD across the Task runs plus the supervisor's and manager's own runs. */
+ totalCost: z.number(),
+ /** Input tokens across the Task runs only. */
+ totalInputTokens: z.number(),
+ /** Output tokens across the Task runs only. */
+ totalOutputTokens: z.number(),
+ totalTokens: z.number(),
+ } satisfies Record<keyof GoalSpend | 'totalInputTokens' | 'totalOutputTokens', z.ZodType>)
+ .strict();
+
+const GoalMetricCriteriaStateSchema = z
+ .object({
+ allMet: z.boolean(),
+ criteria: z.array(
+ z
+ .object({
+ key: z.string(),
+ met: z.boolean(),
+ /** Epoch milliseconds of the recorded observation; absent when nothing was measured. */
+ observedAt: z.number().optional(),
+ op: z.string(),
+ target: z.number(),
+ value: z.number().nullable(),
+ } satisfies Record<keyof GoalMetricCriteriaState['criteria'][number], z.ZodType>)
+ .strict(),
+ ),
+ } satisfies Record<keyof GoalMetricCriteriaState, z.ZodType>)
+ .strict();
+
+const graphShape = {
+ decisions: z.array(GoalGraphDecisionSchema),
+ edges: z.array(GoalGraphEdgeSchema),
+ /** The newest graph events (capped); page older ones through the event feed. */
+ events: z.array(GoalGraphEventSchema),
+ goal: GoalSchema,
+ nodes: z.array(GoalGraphNodeSchema),
+ workVersions: z.array(GoalGraphWorkVersionLinkSchema),
+};
+
+/**
+ * The graph a write returns: the goal, its nodes, edges, decisions, events and
+ * linked Work versions, without the read-time roll-ups.
+ */
+export const GoalGraphSnapshotSchema = z
+ .object(graphShape)
+ .strict()
+ .meta({ id: 'GoalGraphSnapshot' });
+
+/** A fetched graph: the snapshot plus the per-node live state and roll-ups `graph()` attaches. */
+export const GoalGraphSchema = z
+ .object({
+ ...graphShape,
+ /** Verification state per task node id. */
+ acceptances: z.record(z.string(), GoalNodeAcceptanceSchema).optional(),
+ /** Agent each dispatched task node is assigned to, keyed by node id. */
+ assignees: z.record(z.string(), z.string()).optional(),
+ /** When an active node's newest run delivered, while it waits on verification. */
+ deliveredAt: z.record(z.string(), dateTimeSchema).optional(),
+ /** Numeric acceptance clauses as they read now. */
+ metricCriteria: GoalMetricCriteriaStateSchema,
+ /** When the coordinator retries each node a usage window refused. */
+ quotaRetryAt: z.record(z.string(), dateTimeSchema).optional(),
+ /** The wrap-up report state; absent until a wrap-up was dispatched. */
+ report: GoalReportStateSchema.optional(),
+ /** Live run heartbeat per active task node id. */
+ runHeartbeats: z.record(z.string(), dateTimeSchema).optional(),
+ spend: GoalSpendSchema,
+ } satisfies Record<keyof GoalGraphSnapshot | 'metricCriteria', z.ZodType>)
+ .strict()
+ .meta({ id: 'GoalGraph' });
+
+const GoalSupervisionIncidentSchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ eligible: z.boolean(),
+ failedOperationId: z.string(),
+ id: z.string(),
+ inspected: z
+ .object({
+ artifactVersionIds: z.array(z.string()).optional(),
+ goal: z.boolean().optional(),
+ task: z.boolean().optional(),
+ })
+ .strict()
+ .optional(),
+ nodeId: z.string(),
+ reason: z.string(),
+ recoveryInstruction: z.string().optional(),
+ recoveryOperationId: z.string().optional(),
+ resolution: z
+ .object({
+ action: z.enum(['retry', 'escalate']),
+ instruction: z.string(),
+ reason: z.string(),
+ toolCallId: z.string(),
+ })
+ .strict()
+ .optional(),
+ resolvedAt: dateTimeSchema.optional(),
+ status: z.enum([
+ 'diagnosing',
+ 'retrying',
+ 'recovered',
+ 'escalated',
+ 'unsuccessful',
+ 'human_resumed',
+ ]),
+ supervisorOperationId: z.string().optional(),
+ taskId: z.string(),
+ taskStatus: z.string().optional(),
+ } satisfies Record<keyof GoalSupervisionIncident, z.ZodType>)
+ .strict();
+
+export const GoalSupervisionSchema = z
+ .object({
+ /** Whether the recovery supervisor runs for this goal. */
+ enabled: z.boolean(),
+ /** Supervisor topic and incident ledger; absent until the supervisor first ran. */
+ state: z
+ .object({
+ agentId: z.string(),
+ incidents: z.array(GoalSupervisionIncidentSchema),
+ revision: z.number().int(),
+ topicId: z.string(),
+ } satisfies Record<keyof GoalSupervisionState, z.ZodType>)
+ .strict()
+ .optional(),
+ })
+ .strict()
+ .meta({ id: 'GoalSupervision' });
+
+/** Where a manual advance stopped: the last coordinator tick plus how many ran. */
+export const GoalAdvanceResultSchema = z
+ .object({
+ goalId: z.string(),
+ message: z.string(),
+ nodeId: z.string().optional(),
+ outcome: unionEnum<GoalTickOutcome>()([
+ 'advanced',
+ 'achieved',
+ 'waiting_human',
+ 'waiting_external',
+ 'no_progress',
+ 'failed',
+ ]),
+ taskId: z.string().optional(),
+ /** Coordinator ticks this call ran before it stopped. */
+ ticks: z.number().int(),
+ } satisfies Record<keyof GoalTickResult | 'ticks', z.ZodType>)
+ .strict()
+ .meta({ id: 'GoalAdvanceResult' });
+
+export const GoalRestartResultSchema = z
+ .object({
+ goal: GoalSchema,
+ /** Task ids put back to `backlog` for the coordinator to dispatch afresh. */
+ restartedTaskIds: z.array(z.string()),
+ })
+ .strict()
+ .meta({ id: 'GoalRestartResult' });
diff --git a/packages/openapi/src/types/im.type.ts b/packages/openapi/src/types/im.type.ts
index 976a0042c8a..ce983b84b8b 100644
--- a/packages/openapi/src/types/im.type.ts
+++ b/packages/openapi/src/types/im.type.ts
@@ -1,5 +1,7 @@
import { z } from 'zod';
+import { dateTimeSchema } from './common.type';
+
/**
* The IM channel: a messaging-app view of one agent conversation.
*
@@ -147,3 +149,89 @@ export const PushTokenUnregisterQuerySchema = z.object({
expoToken: z.string().min(1).max(512).optional(),
});
export type PushTokenUnregisterQuery = z.infer<typeof PushTokenUnregisterQuerySchema>;
+
+// ==================== Response Schemas ====================
+
+type ShapeOf<T> = Record<keyof T, z.ZodType>;
+
+const ImAttachmentSchema = z
+ .object({
+ fileType: z.string(),
+ id: z.string(),
+ name: z.string(),
+ size: z.number().int().min(0),
+ /** Absolute, fetchable URL. */
+ url: z.string(),
+ } satisfies ShapeOf<ImAttachment>)
+ .strict();
+
+/** One chat bubble of the IM channel — whole, never a partial stream. */
+export const ImMessageSchema = z
+ .object({
+ /** The agent that wrote the message; null on user messages. */
+ agentId: z.string().nullable(),
+ content: z.string(),
+ createdAt: dateTimeSchema,
+ /** Set when the agent's turn failed; the client shows a retry affordance. */
+ error: z.boolean(),
+ /** Present only when the message carries attachments. */
+ files: z.array(ImAttachmentSchema).optional(),
+ id: z.string(),
+ role: z.enum(['assistant', 'user']),
+ } satisfies ShapeOf<ImMessage>)
+ .strict()
+ .meta({ id: 'ImMessage' });
+
+export const ImSendResultSchema = z
+ .object({
+ /** `false` when this was an idempotent retry of an already-received message. */
+ accepted: z.boolean(),
+ /** The agent run that will answer; null on an idempotent retry. */
+ operationId: z.string().nullable(),
+ topicId: z.string(),
+ userMessage: ImMessageSchema,
+ } satisfies ShapeOf<ImSendResult>)
+ .strict()
+ .meta({ id: 'ImSendResult' });
+
+export const ImSyncResultSchema = z
+ .object({
+ /** Pass back as `cursor` to receive only what is new. */
+ cursor: z.string(),
+ /** Whole messages newer than the cursor, oldest first. */
+ messages: z.array(ImMessageSchema),
+ /** The newest user message the agent has picked up (the "read" receipt). */
+ readUpTo: z.object({ messageId: z.string(), readAt: dateTimeSchema }).strict().nullable(),
+ /** Pass back as `state` to long-poll for a change. */
+ state: z.string(),
+ /** The agent is working on a reply ("typing…"). */
+ typing: z.boolean(),
+ /** Agent messages newer than the user's read cursor. */
+ unread: z.number().int().min(0),
+ } satisfies ShapeOf<ImSyncResult>)
+ .strict()
+ .meta({ id: 'ImSyncResult' });
+
+export interface ImReadResult {
+ /** Agent messages still newer than the read cursor. */
+ unread: number;
+}
+
+export const ImReadResultSchema = z
+ .object({ unread: z.number().int().min(0) } satisfies ShapeOf<ImReadResult>)
+ .strict()
+ .meta({ id: 'ImReadResult' });
+
+export interface PushTokenRegistration {
+ deviceId: string;
+ platform: string;
+}
+
+export const PushTokenRegistrationSchema = z
+ .object({
+ deviceId: z.string(),
+ /** `ios` or `android`. */
+ platform: z.string(),
+ } satisfies ShapeOf<PushTokenRegistration>)
+ .strict()
+ .meta({ id: 'PushTokenRegistration' });
diff --git a/packages/openapi/src/types/knowledge-base.type.ts b/packages/openapi/src/types/knowledge-base.type.ts
index 4d21e7ccd93..a88e726ded0 100644
--- a/packages/openapi/src/types/knowledge-base.type.ts
+++ b/packages/openapi/src/types/knowledge-base.type.ts
@@ -1,8 +1,8 @@
import { z } from 'zod';
-import type { PublicKnowledgeBase } from '../helpers/public-fields';
+import type { PUBLIC_KNOWLEDGE_BASE_FIELDS, PublicKnowledgeBase } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
-import { PaginationQuerySchema } from './common.type';
+import { dateTimeSchema, jsonObjectSchema, PaginationQuerySchema } from './common.type';
// ==================== Knowledge Base Query Types ====================
@@ -162,12 +162,58 @@ export interface KnowledgeBaseDetailResponse {
knowledgeBase: PublicKnowledgeBase;
}
+// ==================== Response Schemas ====================
+
+/** Every column `projectPublicKnowledgeBase` copies, so a new public field fails to compile here. */
+const knowledgeBaseShape = {
+ avatar: z.string().nullable(),
+ createdAt: dateTimeSchema,
+ description: z.string().nullable(),
+ id: z.string(),
+ isPublic: z.boolean().nullable(),
+ name: z.string(),
+ settings: jsonObjectSchema.nullable(),
+ /** `agent` / `project` for a dedicated library; null for an ordinary one. */
+ type: z.string().nullable(),
+ updatedAt: dateTimeSchema,
+ visibility: z.enum(['private', 'public']),
+} satisfies Record<(typeof PUBLIC_KNOWLEDGE_BASE_FIELDS)[number], z.ZodType>;
+
+export const KnowledgeBaseSchema = z
+ .object(knowledgeBaseShape)
+ .strict()
+ .meta({ id: 'KnowledgeBase' });
+
+export const KnowledgeBaseListItemSchema = KnowledgeBaseSchema.extend({
+ /** How the caller reaches this knowledge base. */
+ accessType: z.enum(['owner', 'userGrant', 'roleGrant', 'public']),
+})
+ .strict()
+ .meta({ id: 'KnowledgeBaseListItem' });
+
+export const KnowledgeBaseListResponseSchema = z
+ .object({
+ knowledgeBases: z.array(KnowledgeBaseListItemSchema),
+ total: z.number().int().min(0),
+ })
+ .strict()
+ .meta({ id: 'KnowledgeBaseList' });
+
+/** Detail, create and update all wrap the knowledge base under `knowledgeBase`. */
+export const KnowledgeBaseDetailResponseSchema = z
+ .object({ knowledgeBase: KnowledgeBaseSchema })
+ .strict()
+ .meta({ id: 'KnowledgeBaseDetail' });
+
/**
- * Delete knowledge base response type
+ * Outcome of adding, removing or moving file associations. Files the caller
+ * cannot reach are reported in `failed` instead of failing the whole call.
*/
-export interface DeleteKnowledgeBaseResponse {
- /** Response message */
- message?: string;
- /** Whether the deletion was successful */
- success: boolean;
-}
+export const KnowledgeBaseFileOperationResultSchema = z
+ .object({
+ failed: z.array(z.object({ fileId: z.string(), reason: z.string() }).strict()),
+ /** Ids of the files the operation applied to (spelling kept for compatibility). */
+ successed: z.array(z.string()),
+ })
+ .strict()
+ .meta({ id: 'KnowledgeBaseFileOperationResult' });
diff --git a/packages/openapi/src/types/mcp-server.type.ts b/packages/openapi/src/types/mcp-server.type.ts
index e403932aaa3..60e836999a5 100644
--- a/packages/openapi/src/types/mcp-server.type.ts
+++ b/packages/openapi/src/types/mcp-server.type.ts
@@ -1,5 +1,7 @@
import { z } from 'zod';
+import { dateTimeSchema, jsonObjectSchema } from './common.type';
+
const HttpMcpServerUrlSchema = z
.url()
.max(2048)
@@ -79,3 +81,53 @@ export interface McpServerResponse {
tools: McpServerToolResponse[];
updatedAt: Date;
}
+
+// ==================== Response Schemas ====================
+
+/** Connector and tool ids are Postgres `uuid` columns. */
+const uuidSchema = z.string().meta({ format: 'uuid' });
+
+/** Values of `ConnectorToolPermission`, the only ones the column ever stores. */
+const MCP_TOOL_PERMISSIONS = ['auto', 'disabled', 'needs_approval'] as const;
+
+/** Values of `ConnectorStatus`, the only ones the connector column ever stores. */
+const MCP_SERVER_STATUSES = ['connected', 'disconnected', 'error'] as const;
+
+export const McpServerToolSchema = z
+ .object({
+ description: z.string().nullable(),
+ id: uuidSchema,
+ /** The JSON Schema the MCP server advertised for the tool's input. */
+ inputSchema: jsonObjectSchema.nullable(),
+ name: z.string(),
+ permission: z.enum(MCP_TOOL_PERMISSIONS),
+ })
+ .strict()
+ .meta({ id: 'McpServerTool' });
+
+/** Credentials are write-only: only `hasCredentials` is ever returned. */
+export const McpServerSchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ description: z.string().nullable(),
+ hasCredentials: z.boolean(),
+ id: uuidSchema,
+ identifier: z.string(),
+ isEnabled: z.boolean(),
+ name: z.string(),
+ serverUrl: z.url(),
+ status: z.enum(MCP_SERVER_STATUSES),
+ tools: z.array(McpServerToolSchema),
+ updatedAt: dateTimeSchema,
+ })
+ .strict()
+ .meta({ id: 'McpServer' });
+
+export const McpServerSyncResultSchema = z
+ .object({
+ id: uuidSchema,
+ status: z.literal('connected'),
+ toolCount: z.number().int().min(0),
+ })
+ .strict()
+ .meta({ id: 'McpServerSyncResult' });
diff --git a/packages/openapi/src/types/memory.type.test.ts b/packages/openapi/src/types/memory.type.test.ts
new file mode 100644
index 00000000000..3bd1e86e9ef
--- /dev/null
+++ b/packages/openapi/src/types/memory.type.test.ts
@@ -0,0 +1,83 @@
+import { describe, expect, it } from 'vitest';
+
+import {
+ MemoryCategoryEntriesSchema,
+ MemoryPersonaSchema,
+ MemoryPersonaVersionSchema,
+} from './memory.type';
+
+// A JSON round trip on purpose: `structuredClone` would keep the Dates the wire turns into strings.
+// eslint-disable-next-line unicorn/prefer-structured-clone
+const wire = <T>(value: T) => JSON.parse(JSON.stringify(value));
+const now = new Date('2026-11-17T08:00:00.000Z');
+
+const base = {
+ accessedAt: now,
+ capturedAt: now,
+ createdAt: now,
+ id: 'mem-1',
+ metadata: null,
+ tags: ['work'],
+ type: 'personal',
+ updatedAt: now,
+ userId: 'user-1',
+};
+
+describe('memory response schemas', () => {
+ it('accepts the persona and its versions', () => {
+ expect(() => MemoryPersonaSchema.nullable().parse(null)).not.toThrow();
+ expect(() => MemoryPersonaSchema.parse({ content: 'Builder', summary: 'Ships' })).not.toThrow();
+ expect(() =>
+ MemoryPersonaVersionSchema.parse(
+ wire({
+ createdAt: now,
+ id: 'hist-1',
+ nextVersion: 2,
+ previousVersion: 1,
+ snapshotPersona: 'Builder',
+ snapshotTagline: null,
+ }),
+ ),
+ ).not.toThrow();
+ });
+
+ it('accepts identity rows without their vectors', () => {
+ const identity = {
+ ...base,
+ description: 'Engineer',
+ entityId: null,
+ episodicDate: null,
+ relationship: 'self',
+ role: 'engineer',
+ userMemoryId: 'um-1',
+ };
+
+ expect(() => MemoryCategoryEntriesSchema.parse(wire([identity]))).not.toThrow();
+ expect(
+ MemoryCategoryEntriesSchema.safeParse(wire([{ ...identity, descriptionVector: [0.1] }]))
+ .success,
+ ).toBe(false);
+ });
+
+ it('accepts activity rows', () => {
+ const activity = {
+ ...base,
+ associatedLocations: [{ name: 'Osaka' }],
+ associatedObjects: null,
+ associatedSubjects: null,
+ dossierId: null,
+ endsAt: null,
+ feedback: null,
+ injectable: true,
+ narrative: 'Visited Osaka',
+ notes: null,
+ startsAt: now,
+ status: 'completed',
+ timezone: 'Asia/Tokyo',
+ type: 'travel',
+ userMemoryId: 'um-2',
+ };
+
+ expect(() => MemoryCategoryEntriesSchema.parse(wire([activity]))).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/types/memory.type.ts b/packages/openapi/src/types/memory.type.ts
index 318f7a8f3f8..7a751d21446 100644
--- a/packages/openapi/src/types/memory.type.ts
+++ b/packages/openapi/src/types/memory.type.ts
@@ -1,5 +1,15 @@
+import type {
+ UserMemoryActivityWithoutVectors,
+ UserMemoryContextWithoutVectors,
+ UserMemoryExperienceWithoutVectors,
+ UserMemoryIdentityWithoutVectors,
+ UserMemoryPreferenceWithoutVectors,
+ UserPersonaDocumentHistory,
+} from '@lobechat/types';
import { z } from 'zod';
+import { dateTimeSchema, jsonObjectSchema } from './common.type';
+
/** Id of a single memory entry inside its category. */
export const MemoryEntryIdParamSchema = z.object({
id: z.string().min(1),
@@ -26,3 +36,164 @@ export const MemoryEntryPathParamSchema = MemoryCategoryParamSchema.extend(
MemoryEntryIdParamSchema.shape,
);
export type MemoryEntryPathParam = z.infer<typeof MemoryEntryPathParamSchema>;
+
+// ==================== Response Schemas ====================
+
+/** The current persona document: its prose plus the one-line tagline. */
+export const MemoryPersonaSchema = z
+ .object({ content: z.string(), summary: z.string() })
+ .strict()
+ .meta({ id: 'MemoryPersona' });
+
+/** One persona revision, newest first. */
+export const MemoryPersonaVersionSchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ id: z.string(),
+ nextVersion: z.number().int().nullable(),
+ previousVersion: z.number().int().nullable(),
+ snapshotPersona: z.string().nullable(),
+ snapshotTagline: z.string().nullable(),
+ } satisfies Record<
+ keyof Pick<
+ UserPersonaDocumentHistory,
+ 'createdAt' | 'id' | 'nextVersion' | 'previousVersion' | 'snapshotPersona' | 'snapshotTagline'
+ >,
+ z.ZodType
+ >)
+ .strict()
+ .meta({ id: 'MemoryPersonaVersion' });
+
+const memoryEntryBase = {
+ accessedAt: dateTimeSchema,
+ capturedAt: dateTimeSchema,
+ createdAt: dateTimeSchema,
+ id: z.string(),
+ /** Free-form extraction metadata (source topic, model…). */
+ metadata: jsonObjectSchema.nullable(),
+ tags: z.array(z.string()).nullable(),
+ type: z.string().nullable(),
+ updatedAt: dateTimeSchema,
+ userId: z.string().nullable(),
+};
+
+const associatedEntitySchema = z
+ .object({
+ extra: jsonObjectSchema.optional(),
+ name: z.string().optional(),
+ type: z.string().optional(),
+ })
+ .strict();
+
+export const MemoryIdentitySchema = z
+ .object({
+ ...memoryEntryBase,
+ description: z.string().nullable(),
+ entityId: z.string().nullable(),
+ episodicDate: dateTimeSchema.nullable(),
+ relationship: z.string().nullable(),
+ role: z.string().nullable(),
+ userMemoryId: z.string().nullable(),
+ } satisfies Record<keyof UserMemoryIdentityWithoutVectors, z.ZodType>)
+ .strict()
+ .meta({ id: 'MemoryIdentity' });
+
+export const MemoryPreferenceSchema = z
+ .object({
+ ...memoryEntryBase,
+ appliesToEntityId: z.string().nullable(),
+ conclusionDirectives: z.string().nullable(),
+ evidenceCount: z.number().int(),
+ evidenceSource: z.enum(['stated', 'reported', 'inferred']).nullable(),
+ holderEntityId: z.string().nullable(),
+ lastEvidenceAt: dateTimeSchema.nullable(),
+ scope: z.string().nullable(),
+ scorePriority: z.number().nullable(),
+ suggestions: z.string().nullable(),
+ userMemoryId: z.string().nullable(),
+ } satisfies Record<keyof UserMemoryPreferenceWithoutVectors, z.ZodType>)
+ .strict()
+ .meta({ id: 'MemoryPreference' });
+
+export const MemoryContextSchema = z
+ .object({
+ ...memoryEntryBase,
+ associatedObjects: z.array(associatedEntitySchema).nullable(),
+ associatedSubjects: z.array(associatedEntitySchema).nullable(),
+ currentStatus: z.string().nullable(),
+ description: z.string().nullable(),
+ firstSeenAt: dateTimeSchema.nullable(),
+ lastEvidenceAt: dateTimeSchema.nullable(),
+ nextSteps: z.array(z.string()).nullable(),
+ now: z.string().nullable(),
+ openQuestions: z.array(z.string()).nullable(),
+ scoreImpact: z.number().nullable(),
+ scoreUrgency: z.number().nullable(),
+ synthesizedAt: dateTimeSchema.nullable(),
+ title: z.string().nullable(),
+ userMemoryId: z.string().nullable(),
+ userMemoryIds: z.array(z.string()).nullable(),
+ } satisfies Record<keyof UserMemoryContextWithoutVectors, z.ZodType>)
+ .strict()
+ .meta({ id: 'MemoryContext' });
+
+export const MemoryActivitySchema = z
+ .object({
+ ...memoryEntryBase,
+ associatedLocations: z
+ .array(
+ z
+ .object({
+ address: z.string().optional(),
+ name: z.string().optional(),
+ tags: z.array(z.string()).optional(),
+ type: z.string().optional(),
+ })
+ .strict(),
+ )
+ .nullable(),
+ associatedObjects: z.array(associatedEntitySchema).nullable(),
+ associatedSubjects: z.array(associatedEntitySchema).nullable(),
+ dossierId: z.string().nullable(),
+ endsAt: dateTimeSchema.nullable(),
+ feedback: z.string().nullable(),
+ injectable: z.boolean(),
+ narrative: z.string().nullable(),
+ notes: z.string().nullable(),
+ startsAt: dateTimeSchema.nullable(),
+ status: z.string(),
+ timezone: z.string().nullable(),
+ type: z.string(),
+ userMemoryId: z.string().nullable(),
+ } satisfies Record<keyof UserMemoryActivityWithoutVectors, z.ZodType>)
+ .strict()
+ .meta({ id: 'MemoryActivity' });
+
+export const MemoryExperienceSchema = z
+ .object({
+ ...memoryEntryBase,
+ action: z.string().nullable(),
+ keyLearning: z.string().nullable(),
+ possibleOutcome: z.string().nullable(),
+ reasoning: z.string().nullable(),
+ scoreConfidence: z.number().nullable(),
+ situation: z.string().nullable(),
+ userMemoryId: z.string().nullable(),
+ } satisfies Record<keyof UserMemoryExperienceWithoutVectors, z.ZodType>)
+ .strict()
+ .meta({ id: 'MemoryExperience' });
+
+/**
+ * The entries of the requested category: every identity, or the newest few
+ * entries of any other layer. Which array shape comes back is decided by the
+ * `category` path parameter.
+ */
+export const MemoryCategoryEntriesSchema = z
+ .union([
+ z.array(MemoryIdentitySchema),
+ z.array(MemoryPreferenceSchema),
+ z.array(MemoryContextSchema),
+ z.array(MemoryActivitySchema),
+ z.array(MemoryExperienceSchema),
+ ])
+ .meta({ id: 'MemoryCategoryEntries' });
diff --git a/packages/openapi/src/types/message-translations.type.ts b/packages/openapi/src/types/message-translations.type.ts
index 85d5b5a4ac6..936e9b040f8 100644
--- a/packages/openapi/src/types/message-translations.type.ts
+++ b/packages/openapi/src/types/message-translations.type.ts
@@ -68,3 +68,43 @@ export interface MessageTranslateResponse {
to: string | null;
userId: string;
}
+
+/**
+ * What a translate (POST) or a manual edit (PATCH) answers with: the values
+ * just written. `content` is absent on a PATCH that did not send it, `from`
+ * when the caller left the source language to detection.
+ */
+export interface MessageTranslateWriteResponse {
+ content?: string;
+ from?: string;
+ id: string;
+ to: string;
+ userId: string;
+}
+
+// ==================== Response Schemas ====================
+
+export const MessageTranslationSchema = z
+ .object({
+ clientId: z.string().nullable(),
+ content: z.string().nullable(),
+ from: z.string().nullable(),
+ /** The id of the translated message. */
+ id: z.string(),
+ to: z.string().nullable(),
+ userId: z.string(),
+ } satisfies Record<keyof MessageTranslateResponse, z.ZodType>)
+ .strict()
+ .meta({ id: 'MessageTranslation' });
+
+export const MessageTranslationWriteSchema = z
+ .object({
+ content: z.string().optional(),
+ from: z.string().optional(),
+ /** The id of the translated message. */
+ id: z.string(),
+ to: z.string(),
+ userId: z.string(),
+ } satisfies Record<keyof MessageTranslateWriteResponse, z.ZodType>)
+ .strict()
+ .meta({ id: 'MessageTranslationWrite' });
diff --git a/packages/openapi/src/types/message.type.ts b/packages/openapi/src/types/message.type.ts
index dbd9994b84f..0d84a1c1ede 100644
--- a/packages/openapi/src/types/message.type.ts
+++ b/packages/openapi/src/types/message.type.ts
@@ -1,5 +1,8 @@
import { z } from 'zod';
+import { files } from '@/database/schemas/file';
+import { SESSION_TYPE } from '@/database/schemas/session';
+
import type {
PublicFile,
PublicMessage,
@@ -7,8 +10,9 @@ import type {
PublicTopic,
} from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
-import { PaginationQuerySchema } from './common.type';
+import { dateTimeSchema, jsonObjectSchema, PaginationQuerySchema } from './common.type';
import { EvalPaginationSchema } from './eval-resource.type';
+import { TopicSummarySchema } from './topic.type';
// ==================== Message Query Types ====================
@@ -235,3 +239,84 @@ export type MessageListResponse = PaginationQueryResponse<{
export const MessageIdParamSchema = z.object({
id: z.string().min(1, 'Message ID cannot be empty'),
});
+
+// ==================== Response Schemas ====================
+
+type ShapeOf<T> = Record<keyof T, z.ZodType>;
+
+/** A file attached to a message, projected through `PUBLIC_FILE_FIELDS`; `url` is absolute. */
+const MessageFileSchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ fileType: z.string(),
+ id: z.string(),
+ metadata: jsonObjectSchema.nullable(),
+ name: z.string(),
+ parentId: z.string().nullable(),
+ size: z.number().int(),
+ source: z.string().nullable(),
+ updatedAt: dateTimeSchema,
+ url: z.string(),
+ visibility: z.enum(files.visibility.enumValues),
+ } satisfies ShapeOf<PublicFile>)
+ .strict();
+
+/** The legacy session a message belongs to, projected through `PUBLIC_SESSION_FIELDS`. */
+const MessageSessionSchema = z
+ .object({
+ avatar: z.string().nullable(),
+ backgroundColor: z.string().nullable(),
+ createdAt: dateTimeSchema,
+ description: z.string().nullable(),
+ groupId: z.string().nullable(),
+ id: z.string(),
+ pinned: z.boolean().nullable(),
+ slug: z.string(),
+ title: z.string().nullable(),
+ type: z.enum(SESSION_TYPE).nullable(),
+ updatedAt: dateTimeSchema,
+ } satisfies ShapeOf<PublicSession>)
+ .strict();
+
+export const MessageSchema = z
+ .object({
+ agentId: z.string().nullable(),
+ content: z.string().nullable(),
+ createdAt: dateTimeSchema,
+ error: jsonObjectSchema.nullable(),
+ favorite: z.boolean().nullable(),
+ /** Attached files; empty when the message has none. */
+ files: z.array(MessageFileSchema),
+ groupId: z.string().nullable(),
+ id: z.string(),
+ messageGroupId: z.string().nullable(),
+ metadata: jsonObjectSchema.nullable(),
+ model: z.string().nullable(),
+ observationId: z.string().nullable(),
+ parentId: z.string().nullable(),
+ provider: z.string().nullable(),
+ quotaId: z.string().nullable(),
+ reasoning: jsonObjectSchema.nullable(),
+ role: z.string(),
+ search: jsonObjectSchema.nullable(),
+ session: MessageSessionSchema.nullable(),
+ sessionId: z.string().nullable(),
+ summary: z.string().nullable(),
+ targetId: z.string().nullable(),
+ threadId: z.string().nullable(),
+ /** Tool calls the message made. */
+ tools: z.array(jsonObjectSchema).nullable(),
+ topic: TopicSummarySchema.nullable(),
+ topicId: z.string().nullable(),
+ traceId: z.string().nullable(),
+ updatedAt: dateTimeSchema,
+ usage: jsonObjectSchema.nullable(),
+ } satisfies ShapeOf<MessageResponse>)
+ .strict()
+ .meta({ id: 'Message' });
+
+export const MessageListSchema = z
+ .object({ messages: z.array(MessageSchema), total: z.number().int().min(0) })
+ .strict();
+
+export const MessageCountSchema = z.object({ count: z.number().int().min(0) }).strict();
diff --git a/packages/openapi/src/types/model.type.ts b/packages/openapi/src/types/model.type.ts
index 4c3a8f59790..016477f0311 100644
--- a/packages/openapi/src/types/model.type.ts
+++ b/packages/openapi/src/types/model.type.ts
@@ -2,7 +2,7 @@ import { z } from 'zod';
import type { PublicModel } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
-import { PaginationQuerySchema } from './common.type';
+import { dateTimeSchema, jsonObjectSchema, PaginationQuerySchema } from './common.type';
// ==================== Model List Query Types ====================
@@ -45,7 +45,7 @@ export const ModelsListQuerySchema = PaginationQuerySchema.extend({
// ==================== Model Response Types ====================
export type GetModelsResponse = PaginationQueryResponse<{
- models?: PublicModel[];
+ models: PublicModel[];
}>;
// ==================== Model Detail / Mutation Types ====================
@@ -95,3 +95,36 @@ export const ModelIdParamSchema = z.object({
.min(1, 'Provider ID cannot be empty')
.max(64, 'Provider ID cannot exceed 64 characters'),
});
+
+// ==================== Response Schemas ====================
+
+/** A model row projected through `PUBLIC_MODEL_FIELDS`; every field is always present. */
+export const ModelSchema = z
+ .object({
+ abilities: jsonObjectSchema.nullable(),
+ config: jsonObjectSchema.nullable(),
+ contextWindowTokens: z.number().int().nullable(),
+ createdAt: dateTimeSchema,
+ description: z.string().nullable(),
+ displayName: z.string().nullable(),
+ enabled: z.boolean().nullable(),
+ id: z.string(),
+ organization: z.string().nullable(),
+ parameters: jsonObjectSchema.nullable(),
+ pricing: jsonObjectSchema.nullable(),
+ providerId: z.string(),
+ /** `YYYY-MM-DD`. */
+ releasedAt: z.string().nullable(),
+ settings: jsonObjectSchema.nullable(),
+ sort: z.number().int().nullable(),
+ source: z.enum(['remote', 'custom', 'builtin']).nullable(),
+ /** One of the model types; a legacy `stt` row is reported as `asr`. */
+ type: z.string(),
+ updatedAt: dateTimeSchema,
+ } satisfies Record<keyof PublicModel, z.ZodType>)
+ .strict()
+ .meta({ id: 'Model' });
+
+export const ModelListSchema = z
+ .object({ models: z.array(ModelSchema), total: z.number().int().min(0) })
+ .strict();
diff --git a/packages/openapi/src/types/notification.type.test.ts b/packages/openapi/src/types/notification.type.test.ts
new file mode 100644
index 00000000000..a0688f8681a
--- /dev/null
+++ b/packages/openapi/src/types/notification.type.test.ts
@@ -0,0 +1,58 @@
+import { describe, expect, it } from 'vitest';
+
+import {
+ NotificationAcknowledgementSchema,
+ NotificationCategoryCountSchema,
+ NotificationSchema,
+ NotificationSettingsResponseSchema,
+} from './notification.type';
+
+// A JSON round trip on purpose: `structuredClone` would keep the Dates the wire turns into strings.
+// eslint-disable-next-line unicorn/prefer-structured-clone
+const wire = <T>(value: T) => JSON.parse(JSON.stringify(value));
+const now = new Date('2026-11-17T08:00:00.000Z');
+
+describe('notification response schemas', () => {
+ it('accepts an inbox row with its actor snapshot', () => {
+ const row = {
+ actionUrl: '/tasks/T-1',
+ category: 'task',
+ content: 'T-1 finished',
+ context: null,
+ createdAt: now,
+ dedupeKey: null,
+ id: 'ntf-1',
+ isArchived: false,
+ isRead: false,
+ metadata: { agent: { id: 'agt-1', name: 'Lobe' } },
+ title: 'Task finished',
+ type: 'task_completed',
+ updatedAt: now,
+ userId: 'user-1',
+ workspaceId: null,
+ };
+
+ expect(() => NotificationSchema.parse(wire(row))).not.toThrow();
+ });
+
+ it('accepts category counts, settings and the data-less acknowledgement', () => {
+ expect(() =>
+ NotificationCategoryCountSchema.parse({
+ category: 'pending',
+ readCount: 0,
+ totalCount: 2,
+ unreadCount: 2,
+ }),
+ ).not.toThrow();
+ expect(() =>
+ NotificationSettingsResponseSchema.parse({ email: { enabled: false } }),
+ ).not.toThrow();
+ expect(() =>
+ NotificationAcknowledgementSchema.parse({
+ message: 'Notification archived',
+ success: true,
+ timestamp: now.toISOString(),
+ }),
+ ).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/types/notification.type.ts b/packages/openapi/src/types/notification.type.ts
index c31bb12bf56..168c9192a9c 100644
--- a/packages/openapi/src/types/notification.type.ts
+++ b/packages/openapi/src/types/notification.type.ts
@@ -1,6 +1,12 @@
+import type { NotificationMetadata } from '@lobechat/types';
import { NotificationSettingsSchema } from '@lobechat/types';
import { z } from 'zod';
+import type { NotificationItem } from '@/database/schemas';
+import type { NotificationNavigationCount } from '@/server/services/notification/inboxCounts';
+
+import { dateTimeSchema } from './common.type';
+
export const NotificationIdParamSchema = z.object({
id: z.string().min(1),
});
@@ -43,3 +49,86 @@ export const UpdateNotificationSettingsRequestSchema = NotificationSettingsSchem
export type UpdateNotificationSettingsRequest = z.infer<
typeof UpdateNotificationSettingsRequestSchema
>;
+
+// ==================== Response Schemas ====================
+
+const NotificationMetadataSchema = z
+ .object({
+ /** The person who triggered a user-driven notification, snapshotted at send time. */
+ actor: z
+ .object({
+ avatar: z.string().optional(),
+ name: z.string().optional(),
+ userId: z.string().optional(),
+ })
+ .strict()
+ .optional(),
+ /** The agent behind an agent-driven notification, snapshotted at send time. */
+ agent: z
+ .object({
+ avatar: z.string().optional(),
+ backgroundColor: z.string().optional(),
+ id: z.string(),
+ name: z.string().optional(),
+ })
+ .strict()
+ .optional(),
+ /** The resource-transfer request this notification is about. */
+ transfer: z.object({ requestId: z.string() }).strict().optional(),
+ } satisfies Record<keyof NotificationMetadata, z.ZodType>)
+ .strict();
+
+/** An inbox row as the model reads it. */
+export const NotificationSchema = z
+ .object({
+ actionUrl: z.string().nullable(),
+ category: z.string(),
+ content: z.string(),
+ context: z.string().nullable(),
+ createdAt: dateTimeSchema,
+ dedupeKey: z.string().nullable(),
+ id: z.string(),
+ isArchived: z.boolean(),
+ isRead: z.boolean(),
+ metadata: NotificationMetadataSchema.nullable(),
+ title: z.string(),
+ type: z.string(),
+ updatedAt: dateTimeSchema,
+ userId: z.string(),
+ workspaceId: z.string().nullable(),
+ } satisfies Record<keyof NotificationItem, z.ZodType>)
+ .strict()
+ .meta({ id: 'Notification' });
+
+export const NotificationUnreadCountSchema = z
+ .object({ count: z.number().int() })
+ .strict()
+ .meta({ id: 'NotificationUnreadCount' });
+
+/** Read / unread / total tallies of one category, live transfer requests included. */
+export const NotificationCategoryCountSchema = z
+ .object({
+ category: z.string(),
+ readCount: z.number().int(),
+ totalCount: z.number().int(),
+ unreadCount: z.number().int(),
+ } satisfies Record<keyof NotificationNavigationCount, z.ZodType>)
+ .strict()
+ .meta({ id: 'NotificationCategoryCount' });
+
+/** The stored settings of the requested scope; switches never set are absent. */
+export const NotificationSettingsResponseSchema = NotificationSettingsSchema.meta({
+ id: 'NotificationSettings',
+});
+
+/**
+ * The whole body of a transition that has nothing to report back (mark read,
+ * archive): the success envelope without `data`.
+ */
+export const NotificationAcknowledgementSchema = z
+ .object({
+ message: z.string(),
+ success: z.literal(true),
+ timestamp: dateTimeSchema,
+ })
+ .strict();
diff --git a/packages/openapi/src/types/permission.type.ts b/packages/openapi/src/types/permission.type.ts
index e5078f2173a..72044aa08c9 100644
--- a/packages/openapi/src/types/permission.type.ts
+++ b/packages/openapi/src/types/permission.type.ts
@@ -2,7 +2,7 @@ import { z } from 'zod';
import type { PublicPermission } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
-import { PaginationQuerySchema } from './common.type';
+import { dateTimeSchema, PaginationQuerySchema } from './common.type';
// ==================== Permission Query Types ====================
@@ -62,3 +62,25 @@ export const UpdatePermissionRequestSchema = CreatePermissionRequestSchema.parti
export const PermissionIdParamSchema = z.object({
id: z.string().length(16, 'Permission ID must be 16 characters'),
});
+
+// ==================== Response Schemas ====================
+
+/** `PUBLIC_PERMISSION_FIELDS` projection of an `rbac_permissions` row. */
+export const PermissionSchema = z
+ .object({
+ category: z.string(),
+ code: z.string(),
+ createdAt: dateTimeSchema,
+ description: z.string().nullable(),
+ id: z.string(),
+ isActive: z.boolean(),
+ name: z.string(),
+ updatedAt: dateTimeSchema,
+ })
+ .strict()
+ .meta({ id: 'Permission' });
+
+export const PermissionListSchema = z
+ .object({ permissions: z.array(PermissionSchema), total: z.number().int().min(0) })
+ .strict()
+ .meta({ id: 'PermissionList' });
diff --git a/packages/openapi/src/types/plugin.type.ts b/packages/openapi/src/types/plugin.type.ts
new file mode 100644
index 00000000000..a9bad0efc44
--- /dev/null
+++ b/packages/openapi/src/types/plugin.type.ts
@@ -0,0 +1,25 @@
+import { z } from 'zod';
+
+import { dateTimeSchema } from './common.type';
+
+// ==================== Response Schemas ====================
+
+/**
+ * An installed plugin as `GET /plugins` exposes it: the inventory only.
+ * Credentials, settings, custom connection parameters and manifests are not
+ * public capability metadata and are never selected.
+ */
+export const InstalledPluginSchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ identifier: z.string(),
+ type: z.enum(['plugin', 'customPlugin']),
+ updatedAt: dateTimeSchema,
+ })
+ .strict()
+ .meta({ id: 'InstalledPlugin' });
+
+export const InstalledPluginListSchema = z
+ .object({ plugins: z.array(InstalledPluginSchema), total: z.number().int().min(0) })
+ .strict()
+ .meta({ id: 'InstalledPluginList' });
diff --git a/packages/openapi/src/types/provider.type.ts b/packages/openapi/src/types/provider.type.ts
index 4f1e77341b9..5ee523f79d1 100644
--- a/packages/openapi/src/types/provider.type.ts
+++ b/packages/openapi/src/types/provider.type.ts
@@ -4,7 +4,7 @@ import type { AiProviderConfig, AiProviderSettings } from '@/types/aiProvider';
import type { PublicProvider } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
-import { PaginationQuerySchema } from './common.type';
+import { dateTimeSchema, jsonObjectSchema, PaginationQuerySchema } from './common.type';
// ==================== Provider Common Types ====================
@@ -110,3 +110,32 @@ export const ProviderIdParamSchema = z.object({
});
export type ProviderIdParam = z.infer<typeof ProviderIdParamSchema>;
+
+// ==================== Response Schemas ====================
+
+/**
+ * A provider row projected through `PUBLIC_PROVIDER_FIELDS`; every field is
+ * always present. The encrypted key vault is never part of the response.
+ */
+export const ProviderSchema = z
+ .object({
+ checkModel: z.string().nullable(),
+ config: jsonObjectSchema.nullable(),
+ createdAt: dateTimeSchema,
+ description: z.string().nullable(),
+ enabled: z.boolean().nullable(),
+ fetchOnClient: z.boolean().nullable(),
+ id: z.string(),
+ logo: z.string().nullable(),
+ name: z.string().nullable(),
+ settings: jsonObjectSchema.nullable(),
+ sort: z.number().int().nullable(),
+ source: z.enum(['builtin', 'custom']).nullable(),
+ updatedAt: dateTimeSchema,
+ } satisfies Record<keyof PublicProvider, z.ZodType>)
+ .strict()
+ .meta({ id: 'Provider' });
+
+export const ProviderListSchema = z
+ .object({ providers: z.array(ProviderSchema), total: z.number().int().min(0) })
+ .strict();
diff --git a/packages/openapi/src/types/responses.type.ts b/packages/openapi/src/types/responses.type.ts
index 349d03e76f9..bcfa02a8549 100644
--- a/packages/openapi/src/types/responses.type.ts
+++ b/packages/openapi/src/types/responses.type.ts
@@ -1,5 +1,7 @@
import { z } from 'zod';
+import { jsonObjectSchema } from './common.type';
+
// ==================== Content Types ====================
export const InputTextContentSchema = z.object({
@@ -209,6 +211,7 @@ export interface ResponseObject {
incomplete_details?: { reason: string } | null;
instructions?: string | null;
max_output_tokens?: number | null;
+ max_tool_calls?: number | null;
metadata?: Record<string, string> | null;
model: string;
object: 'response';
@@ -217,7 +220,9 @@ export interface ResponseObject {
parallel_tool_calls?: boolean | null;
presence_penalty?: number | null;
previous_response_id?: string | null;
+ prompt_cache_key?: string | null;
reasoning?: ReasoningConfig | null;
+ safety_identifier?: string | null;
service_tier?: string | null;
status: ResponseStatus;
store?: boolean | null;
@@ -225,6 +230,7 @@ export interface ResponseObject {
text?: { format?: { type: string } };
tool_choice?: CreateResponseRequest['tool_choice'];
tools?: Tool[];
+ top_logprobs?: number;
top_p?: number | null;
truncation?: string | null;
usage?: ResponseUsage | null;
@@ -377,3 +383,184 @@ export type ResponseStreamEvent =
| ResponseFailedEvent
| ResponseInProgressEvent
| ResponseIncompleteEvent;
+
+// ==================== Response Schemas ====================
+//
+// The non-streaming `POST /responses` body, typed after the OpenResponses
+// `response` object and narrowed to what `ResponsesService.buildResponseObject`
+// actually emits. Streaming sends the same object inside the SSE events.
+
+const UrlCitationAnnotationSchema = z
+ .object({
+ end_index: z.number().int(),
+ start_index: z.number().int(),
+ title: z.string(),
+ type: z.literal('url_citation'),
+ url: z.string(),
+ })
+ .strict();
+
+const FileCitationAnnotationSchema = z
+ .object({
+ file_id: z.string(),
+ filename: z.string(),
+ index: z.number().int(),
+ type: z.literal('file_citation'),
+ })
+ .strict();
+
+const TokenLogprobSchema = z
+ .object({ bytes: z.array(z.number().int()), logprob: z.number(), token: z.string() })
+ .strict();
+
+export const ResponseOutputTextSchema = z
+ .object({
+ /** Always empty today: the agent runtime does not surface citations here. */
+ annotations: z.array(z.union([UrlCitationAnnotationSchema, FileCitationAnnotationSchema])),
+ /** Always empty today: token log probabilities are not reported. */
+ logprobs: z.array(
+ TokenLogprobSchema.extend({ top_logprobs: z.array(TokenLogprobSchema) }).strict(),
+ ),
+ text: z.string(),
+ type: z.literal('output_text'),
+ })
+ .strict()
+ .meta({ id: 'ResponseOutputText' });
+
+const outputItemStatusSchema = z.enum(['completed', 'in_progress']);
+
+export const ResponseOutputMessageSchema = z
+ .object({
+ content: z.array(ResponseOutputTextSchema),
+ id: z.string(),
+ role: z.literal('assistant'),
+ status: outputItemStatusSchema,
+ type: z.literal('message'),
+ })
+ .strict()
+ .meta({ id: 'ResponseOutputMessage' });
+
+export const ResponseFunctionCallSchema = z
+ .object({
+ /** JSON-encoded arguments. */
+ arguments: z.string(),
+ /** Answer it with a `function_call_output` item carrying the same `call_id`. */
+ call_id: z.string(),
+ id: z.string(),
+ name: z.string(),
+ status: outputItemStatusSchema,
+ type: z.literal('function_call'),
+ })
+ .strict()
+ .meta({ id: 'ResponseFunctionCall' });
+
+export const ResponseFunctionCallOutputSchema = z
+ .object({
+ call_id: z.string(),
+ id: z.string(),
+ output: z.string(),
+ status: outputItemStatusSchema,
+ type: z.literal('function_call_output'),
+ })
+ .strict()
+ .meta({ id: 'ResponseFunctionCallOutput' });
+
+export const ResponseOutputItemSchema = z
+ .discriminatedUnion('type', [
+ ResponseOutputMessageSchema,
+ ResponseFunctionCallSchema,
+ ResponseFunctionCallOutputSchema,
+ ])
+ .meta({ id: 'ResponseOutputItem' });
+
+export const ResponseUsageSchema = z
+ .object({
+ input_tokens: z.number().int().min(0),
+ input_tokens_details: z.object({ cached_tokens: z.number().int().min(0) }).strict(),
+ output_tokens: z.number().int().min(0),
+ output_tokens_details: z.object({ reasoning_tokens: z.number().int().min(0) }).strict(),
+ total_tokens: z.number().int().min(0),
+ })
+ .strict()
+ .meta({ id: 'ResponseUsage' });
+
+export const ResponseErrorSchema = z
+ .object({
+ code: z.enum([
+ 'server_error',
+ 'invalid_request_error',
+ 'not_found',
+ 'model_error',
+ 'rate_limit_error',
+ ]),
+ message: z.string(),
+ })
+ .strict()
+ .meta({ id: 'ResponseError' });
+
+const ResponseFunctionToolSchema = z
+ .object({
+ description: z.string().optional(),
+ name: z.string(),
+ /** JSON Schema of the function arguments, as the caller declared it. */
+ parameters: jsonObjectSchema.optional(),
+ strict: z.boolean().nullable(),
+ type: z.literal('function'),
+ })
+ .strict();
+
+const ResponseHostedToolSchema = z
+ .object({
+ strict: z.null(),
+ /** A LobeHub hosted tool id (`lobe-…`). */
+ type: z.string(),
+ })
+ .strict();
+
+export const ResponseObjectSchema = z
+ .object({
+ background: z.boolean(),
+ /** Unix seconds; null while the run is parked on the caller's tools or failed. */
+ completed_at: z.number().int().nullable(),
+ /** Unix seconds. */
+ created_at: z.number().int(),
+ error: ResponseErrorSchema.nullable(),
+ frequency_penalty: z.number(),
+ /** The topic id; pass it as `previous_response_id` to continue the conversation. */
+ id: z.string(),
+ /** Set when `status` is `incomplete`, e.g. `client_tool_execution`. */
+ incomplete_details: z.object({ reason: z.string() }).strict().nullable(),
+ instructions: z.string().nullable(),
+ max_output_tokens: z.number().int().nullable(),
+ max_tool_calls: z.number().int().nullable(),
+ metadata: z.record(z.string(), z.string()),
+ /** The agent id the request named. */
+ model: z.string(),
+ object: z.literal('response'),
+ output: z.array(ResponseOutputItemSchema),
+ /** Text of the last assistant message. */
+ output_text: z.string(),
+ parallel_tool_calls: z.boolean(),
+ presence_penalty: z.number(),
+ previous_response_id: z.string().nullable(),
+ prompt_cache_key: z.string().nullable(),
+ reasoning: ReasoningConfigSchema.strict().nullable(),
+ safety_identifier: z.string().nullable(),
+ service_tier: z.string(),
+ status: z.enum(['completed', 'failed', 'in_progress', 'incomplete', 'queued']),
+ store: z.boolean(),
+ temperature: z.number(),
+ text: z.object({ format: z.object({ type: z.literal('text') }).strict() }).strict(),
+ tool_choice: z.union([
+ z.enum(['auto', 'required', 'none']),
+ z.object({ name: z.string(), type: z.literal('function') }).strict(),
+ ]),
+ tools: z.array(z.union([ResponseFunctionToolSchema, ResponseHostedToolSchema])),
+ top_logprobs: z.number().int(),
+ top_p: z.number(),
+ truncation: z.enum(['auto', 'disabled']),
+ usage: ResponseUsageSchema,
+ user: z.string().nullable(),
+ })
+ .strict()
+ .meta({ id: 'ResponseObject' });
diff --git a/packages/openapi/src/types/role.type.ts b/packages/openapi/src/types/role.type.ts
index 8cd342ce7e7..5b830c297f2 100644
--- a/packages/openapi/src/types/role.type.ts
+++ b/packages/openapi/src/types/role.type.ts
@@ -2,7 +2,7 @@ import { z } from 'zod';
import type { PublicPermission, PublicRole } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
-import { PaginationQuerySchema } from './common.type';
+import { dateTimeSchema, PaginationQuerySchema } from './common.type';
// ==================== Role Query Types ====================
@@ -104,3 +104,54 @@ export const RoleIdParamSchema = z.object({
});
export { PaginationQuerySchema as RolePermissionsListQuerySchema } from './common.type';
+
+// ==================== Response Schemas ====================
+
+/** `PUBLIC_ROLE_FIELDS` projection of an `rbac_roles` row. */
+export const RoleSchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ description: z.string().nullable(),
+ displayName: z.string(),
+ id: z.string(),
+ isActive: z.boolean(),
+ isSystem: z.boolean(),
+ name: z.string(),
+ updatedAt: dateTimeSchema,
+ })
+ .strict()
+ .meta({ id: 'Role' });
+
+export const RoleListSchema = z
+ .object({ roles: z.array(RoleSchema), total: z.number().int().min(0) })
+ .strict()
+ .meta({ id: 'RoleList' });
+
+/** The permission columns `GET /roles/:id/permissions` selects (no timestamps). */
+export const RolePermissionSchema = z
+ .object({
+ category: z.string(),
+ code: z.string(),
+ description: z.string().nullable(),
+ id: z.string(),
+ isActive: z.boolean(),
+ name: z.string(),
+ })
+ .strict()
+ .meta({ id: 'RolePermission' });
+
+export const RolePermissionListSchema = z
+ .object({ permissions: z.array(RolePermissionSchema), total: z.number().int().min(0) })
+ .strict()
+ .meta({ id: 'RolePermissionList' });
+
+export const RolePermissionsUpdateResultSchema = z
+ .object({
+ /** Mappings newly inserted (already-granted ids are not counted). */
+ granted: z.number().int().min(0),
+ /** Mappings actually removed. */
+ revoked: z.number().int().min(0),
+ roleId: z.string(),
+ })
+ .strict()
+ .meta({ id: 'RolePermissionsUpdateResult' });
diff --git a/packages/openapi/src/types/task.type.test.ts b/packages/openapi/src/types/task.type.test.ts
index 47d87d639ab..1cf92021206 100644
--- a/packages/openapi/src/types/task.type.test.ts
+++ b/packages/openapi/src/types/task.type.test.ts
@@ -1,6 +1,13 @@
import { describe, expect, it } from 'vitest';
-import { CreateTaskRequestSchema, UpdateTaskRequestSchema } from './task.type';
+import {
+ CreateTaskRequestSchema,
+ TaskDetailSchema,
+ TaskListResponseSchema,
+ TaskRunSchema,
+ TaskSchema,
+ UpdateTaskRequestSchema,
+} from './task.type';
/**
* A schedule the dispatcher cannot evaluate must be refused at the boundary:
@@ -56,3 +63,110 @@ describe('task project field schemas', () => {
expect(UpdateTaskRequestSchema.parse({ name: 'x' })).not.toHaveProperty('projectId');
});
});
+
+// A JSON round trip on purpose: `structuredClone` would keep the Dates the wire turns into strings.
+// eslint-disable-next-line unicorn/prefer-structured-clone
+const wire = <T>(value: T) => JSON.parse(JSON.stringify(value));
+const now = new Date('2026-11-17T08:00:00.000Z');
+
+const taskRow = {
+ accessedAt: now,
+ archivedAt: null,
+ assigneeAgentId: 'agt-1',
+ assigneeUserId: null,
+ automationMode: null,
+ completedAt: null,
+ config: {},
+ context: {},
+ createdAt: now,
+ createdByAgentId: null,
+ createdByUserId: 'user-1',
+ currentTopicId: null,
+ deletedAt: null,
+ description: null,
+ editorData: null,
+ error: null,
+ heartbeatInterval: null,
+ heartbeatTimeout: null,
+ id: 'task-1',
+ identifier: 'T-1',
+ instruction: 'ship it',
+ isDeleted: null,
+ lastHeartbeatAt: null,
+ maxTopics: null,
+ name: 'Ship',
+ parentTaskId: null,
+ priority: 0,
+ projectId: null,
+ schedulePattern: null,
+ scheduleTimezone: 'UTC',
+ seq: 1,
+ sortOrder: 0,
+ startedAt: null,
+ status: 'backlog',
+ totalTopics: 0,
+ updatedAt: now,
+ visibility: 'public',
+ workspaceId: null,
+};
+
+describe('task response schemas', () => {
+ it('accepts a task row as it leaves the API', () => {
+ expect(() => TaskSchema.parse(wire(taskRow))).not.toThrow();
+ });
+
+ it('accepts a list page with labels and subtask progress', () => {
+ const page = {
+ tasks: [
+ {
+ ...taskRow,
+ labels: [{ color: '#f00', id: 'lbl-1', name: 'Bug' }],
+ subtaskProgress: { completed: 1, total: 2 },
+ },
+ ],
+ total: 1,
+ };
+
+ expect(() => TaskListResponseSchema.parse(wire(page))).not.toThrow();
+ });
+
+ it('accepts a detail with nested subtasks and a topic activity', () => {
+ const detail = {
+ activities: [{ status: 'completed', topicId: 'tpc-1', trigger: 'manual', type: 'topic' }],
+ identifier: 'T-1',
+ instruction: 'ship it',
+ status: 'running',
+ subtasks: [
+ {
+ children: [{ identifier: 'T-3', status: 'backlog' }],
+ identifier: 'T-2',
+ status: 'running',
+ },
+ ],
+ };
+
+ expect(() => TaskDetailSchema.parse(detail)).not.toThrow();
+ });
+
+ it('accepts a past run', () => {
+ expect(() =>
+ TaskRunSchema.parse(
+ wire({
+ agentId: 'agt-1',
+ completedAt: now,
+ content: null,
+ createdAt: now,
+ keyFindings: [],
+ nextAction: null,
+ notable: true,
+ seq: 1,
+ status: 'completed',
+ summary: 'Done',
+ title: 'Run 1',
+ topicId: 'tpc-1',
+ trigger: 'schedule',
+ }),
+ ),
+ ).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/types/task.type.ts b/packages/openapi/src/types/task.type.ts
index 41dda17a9d4..789e7384b07 100644
--- a/packages/openapi/src/types/task.type.ts
+++ b/packages/openapi/src/types/task.type.ts
@@ -1,4 +1,19 @@
import { TASK_STATUSES } from '@lobechat/builtin-tool-task';
+import type {
+ ChatFileItem,
+ CheckpointConfig,
+ ExecAgentResult,
+ TaskDetailActivity,
+ TaskDetailActivityAgent,
+ TaskDetailActivityAuthor,
+ TaskDetailData,
+ TaskDetailSubtask,
+ TaskDetailWorkspaceNode,
+ TaskItem,
+ TaskLabelRef,
+ TaskRunVerifySummary,
+ TaskVerifyConfig,
+} from '@lobechat/types';
import { z } from 'zod';
import {
@@ -6,6 +21,8 @@ import {
scheduleTimezoneSchema,
} from '@/server/services/task/scheduleValidation';
+import { dateTimeSchema, jsonObjectSchema } from './common.type';
+
export const TaskIdParamSchema = z.object({
id: z.string().min(1),
});
@@ -101,3 +118,509 @@ export const TaskRunListQuerySchema = z.object({
limit: z.coerce.number().int().min(1).max(100).optional(),
});
export type TaskRunListQuery = z.infer<typeof TaskRunListQuerySchema>;
+
+// ==================== Response Schemas ====================
+
+const TaskAutomationModeSchema = z.enum(['heartbeat', 'schedule']);
+const TaskRunTriggerSchema = z.enum(['manual', 'schedule', 'heartbeat', 'goal']);
+const TaskVisibilitySchema = z.enum(['private', 'public']);
+
+export const TaskLabelRefSchema = z
+ .object({
+ color: z.string().nullable().optional(),
+ id: z.string(),
+ name: z.string(),
+ parentId: z.string().nullable().optional(),
+ } satisfies Record<keyof TaskLabelRef, z.ZodType>)
+ .strict()
+ .meta({ id: 'TaskLabelRef' });
+
+const taskRowShape = {
+ accessedAt: dateTimeSchema,
+ archivedAt: dateTimeSchema.nullable(),
+ assigneeAgentId: z.string().nullable(),
+ assigneeUserId: z.string().nullable(),
+ automationMode: TaskAutomationModeSchema.nullable(),
+ completedAt: dateTimeSchema.nullable(),
+ /** Task configuration pockets (checkpoint, verify, execution, model…), stored as JSON. */
+ config: jsonObjectSchema.nullable(),
+ /** Runtime state pockets (scheduler, lifecycle audit, origin), stored as JSON. */
+ context: jsonObjectSchema.nullable(),
+ createdAt: dateTimeSchema,
+ createdByAgentId: z.string().nullable(),
+ createdByUserId: z.string(),
+ currentTopicId: z.string().nullable(),
+ deletedAt: dateTimeSchema.nullable(),
+ description: z.string().nullable(),
+ /** Rich-editor JSON state of the instruction. */
+ editorData: z.unknown(),
+ error: z.string().nullable(),
+ heartbeatInterval: z.number().int().nullable(),
+ heartbeatTimeout: z.number().int().nullable(),
+ id: z.string(),
+ /** Display identifier, e.g. `T-12`. */
+ identifier: z.string(),
+ instruction: z.string(),
+ isDeleted: z.boolean().nullable(),
+ lastHeartbeatAt: dateTimeSchema.nullable(),
+ maxTopics: z.number().int().nullable(),
+ name: z.string().nullable(),
+ parentTaskId: z.string().nullable(),
+ priority: z.number().int().nullable(),
+ projectId: z.string().nullable(),
+ schedulePattern: z.string().nullable(),
+ scheduleTimezone: z.string().nullable(),
+ seq: z.number().int(),
+ sortOrder: z.number().int().nullable(),
+ startedAt: dateTimeSchema.nullable(),
+ status: z.enum(TASK_STATUSES),
+ totalTopics: z.number().int().nullable(),
+ updatedAt: dateTimeSchema,
+ visibility: TaskVisibilitySchema,
+ workspaceId: z.string().nullable(),
+};
+
+/**
+ * A `tasks` row exactly as the model reads or writes it. The read-time extras
+ * on `TaskItem` (labels, progress, run totals) are only attached by list reads.
+ */
+export const TaskSchema = z
+ .object(
+ taskRowShape satisfies Record<
+ | Exclude<keyof TaskItem, 'labels' | 'subtaskProgress' | 'totalRunCost' | 'totalRunDuration'>
+ | 'deletedAt'
+ | 'isDeleted',
+ z.ZodType
+ >,
+ )
+ .strict()
+ .meta({ id: 'Task' });
+
+export const TaskListItemSchema = z
+ .object({
+ ...taskRowShape,
+ labels: z.array(TaskLabelRefSchema),
+ /** Recursive descendant progress; absent for a task without subtasks. */
+ subtaskProgress: z
+ .object({ completed: z.number().int(), total: z.number().int() })
+ .strict()
+ .optional(),
+ })
+ .strict()
+ .meta({ id: 'TaskListItem' });
+
+export const TaskListResponseSchema = z
+ .object({ tasks: z.array(TaskListItemSchema), total: z.number().int() })
+ .strict()
+ .meta({ id: 'TaskList' });
+
+const ChatFileItemSchema = z
+ .object({
+ content: z.string().optional(),
+ downloadUrl: z.string().optional(),
+ fileType: z.string(),
+ id: z.string(),
+ /** The viewer lost access to the file; the row is a tombstone. */
+ inaccessible: z.boolean().optional(),
+ name: z.string(),
+ originalCharCount: z.number().int().optional(),
+ size: z.number(),
+ url: z.string(),
+ } satisfies Record<keyof ChatFileItem, z.ZodType>)
+ .strict();
+
+const CheckpointTaskRefSchema = z.object({ id: z.string(), identifier: z.string() }).strict();
+
+const CheckpointConfigSchema = z
+ .object({
+ onAgentRequest: z.boolean().optional(),
+ tasks: z
+ .object({
+ afterIds: z.array(z.string()).optional(),
+ afterTasks: z.array(CheckpointTaskRefSchema).optional(),
+ beforeIds: z.array(z.string()).optional(),
+ beforeTasks: z.array(CheckpointTaskRefSchema).optional(),
+ })
+ .strict()
+ .optional(),
+ topic: z
+ .object({ after: z.boolean().optional(), before: z.boolean().optional() })
+ .strict()
+ .optional(),
+ } satisfies Record<keyof CheckpointConfig, z.ZodType>)
+ .strict();
+
+const TaskVerifyConfigSchema = z
+ .object({
+ enabled: z.boolean().optional(),
+ maxIterations: z.number().int().optional(),
+ requirement: z.string().optional(),
+ verifierAgentId: z.string().optional(),
+ verifyCriteriaIds: z.array(z.string()).optional(),
+ verifyRubricId: z.string().optional(),
+ } satisfies Record<keyof TaskVerifyConfig, z.ZodType>)
+ .strict();
+
+const TaskDetailSubtaskSchema: z.ZodType<TaskDetailSubtask> = z
+ .object({
+ archivedAt: dateTimeSchema.nullable().optional(),
+ assignee: z
+ .object({
+ avatar: z.string().nullable(),
+ backgroundColor: z.string().nullable(),
+ id: z.string(),
+ title: z.string().nullable(),
+ })
+ .strict()
+ .nullable()
+ .optional(),
+ assigneeUserId: z.string().nullable().optional(),
+ automationMode: TaskAutomationModeSchema.nullable().optional(),
+ blockedBy: z.string().optional(),
+ blockedById: z.string().optional(),
+ get children() {
+ return z.array(TaskDetailSubtaskSchema).optional();
+ },
+ createdByUserId: z.string().optional(),
+ heartbeat: z.object({ interval: z.number().int().nullable().optional() }).strict().optional(),
+ id: z.string().optional(),
+ identifier: z.string(),
+ name: z.string().nullable().optional(),
+ priority: z.number().int().nullable().optional(),
+ runningTopic: z
+ .object({ id: z.string(), operationId: z.string().nullable().optional() })
+ .strict()
+ .nullable()
+ .optional(),
+ schedule: z
+ .object({
+ pattern: z.string().nullable().optional(),
+ timezone: z.string().nullable().optional(),
+ })
+ .strict()
+ .optional(),
+ status: z.string(),
+ updatedAt: dateTimeSchema.optional(),
+ visibility: TaskVisibilitySchema.optional(),
+ } satisfies Record<keyof TaskDetailSubtask, z.ZodType>)
+ .strict()
+ .meta({ id: 'TaskDetailSubtask' });
+
+const TaskDetailWorkspaceNodeSchema: z.ZodType<TaskDetailWorkspaceNode> = z
+ .object({
+ get children() {
+ return z.array(TaskDetailWorkspaceNodeSchema).optional();
+ },
+ createdAt: dateTimeSchema.optional(),
+ documentId: z.string(),
+ fileType: z.string().optional(),
+ /** The viewer lost access to the pinned document; render a placeholder. */
+ inaccessible: z.boolean().optional(),
+ size: z.number().nullable().optional(),
+ sourceTaskId: z.string().optional(),
+ sourceTaskIdentifier: z.string().nullable().optional(),
+ title: z.string().optional(),
+ } satisfies Record<keyof TaskDetailWorkspaceNode, z.ZodType>)
+ .strict()
+ .meta({ id: 'TaskDetailWorkspaceNode' });
+
+const TaskDetailActivityAuthorSchema = z
+ .object({
+ avatar: z.string().nullable().optional(),
+ id: z.string(),
+ name: z.string().nullable().optional(),
+ type: z.enum(['agent', 'user']),
+ /** The id is recorded but no live row backs it any more. */
+ unresolved: z.boolean().optional(),
+ } satisfies Record<keyof TaskDetailActivityAuthor, z.ZodType>)
+ .strict();
+
+const TaskAutomationSnapshotSchema = z
+ .object({
+ heartbeatInterval: z.number().int().nullable(),
+ maxExecutions: z.number().int().nullable(),
+ mode: TaskAutomationModeSchema.nullable(),
+ schedulePattern: z.string().nullable(),
+ scheduleTimezone: z.string().nullable(),
+ })
+ .strict();
+
+const TaskDetailActivitySchema = z
+ .object({
+ /** Brief-only: the actions a brief offers, as the brief stored them. */
+ actions: z.unknown().optional(),
+ agent: z
+ .object({
+ avatar: z.string().nullable(),
+ backgroundColor: z.string().nullable(),
+ id: z.string(),
+ name: z.string().nullable().optional(),
+ title: z.string().nullable(),
+ } satisfies Record<keyof TaskDetailActivityAgent, z.ZodType>)
+ .strict()
+ .nullable()
+ .optional(),
+ agentId: z.string().nullable().optional(),
+ artifacts: z
+ .object({
+ documents: z
+ .array(
+ z
+ .object({ id: z.string(), kind: z.string().nullable(), title: z.string().nullable() })
+ .strict(),
+ )
+ .optional(),
+ })
+ .strict()
+ .nullable()
+ .optional(),
+ assignment: z
+ .object({
+ from: TaskDetailActivityAuthorSchema.nullable().optional(),
+ kind: z.enum(['agent', 'member']),
+ to: TaskDetailActivityAuthorSchema.nullable().optional(),
+ })
+ .strict()
+ .optional(),
+ author: TaskDetailActivityAuthorSchema.optional(),
+ briefType: z.string().optional(),
+ completedAt: dateTimeSchema.optional(),
+ content: z.string().optional(),
+ cost: z.number().nullable().optional(),
+ createdAt: dateTimeSchema.optional(),
+ cronJobId: z.string().nullable().optional(),
+ /** Comment-only: rich Lexical JSON state. */
+ editorData: z.unknown().optional(),
+ files: z.array(ChatFileItemSchema).optional(),
+ id: z.string().optional(),
+ operationId: z.string().nullable().optional(),
+ priority: z.string().nullable().optional(),
+ propertyChange: z
+ .union([
+ z
+ .object({
+ field: z.literal('automation'),
+ from: TaskAutomationSnapshotSchema.nullable(),
+ to: TaskAutomationSnapshotSchema.nullable(),
+ })
+ .strict(),
+ z
+ .object({
+ field: z.literal('priority'),
+ from: z.number().int().nullable(),
+ to: z.number().int().nullable(),
+ })
+ .strict(),
+ z
+ .object({
+ field: z.literal('status'),
+ from: z.enum(TASK_STATUSES).nullable(),
+ to: z.enum(TASK_STATUSES),
+ })
+ .strict(),
+ ])
+ .optional(),
+ readAt: dateTimeSchema.nullable().optional(),
+ resolvedAction: z.string().nullable().optional(),
+ resolvedAt: dateTimeSchema.nullable().optional(),
+ resolvedComment: z.string().nullable().optional(),
+ runningOperation: z
+ .object({
+ assistantMessageId: z.string(),
+ heteroType: z.string().nullable().optional(),
+ operationId: z.string(),
+ scope: z.string().optional(),
+ threadId: z.string().nullable().optional(),
+ })
+ .strict()
+ .nullable()
+ .optional(),
+ seq: z.number().int().nullable().optional(),
+ sourceTaskId: z.string().nullable().optional(),
+ sourceTaskIdentifier: z.string().nullable().optional(),
+ sourceTaskName: z.string().nullable().optional(),
+ status: z.string().nullable().optional(),
+ summary: z.string().optional(),
+ taskId: z.string().nullable().optional(),
+ time: dateTimeSchema.optional(),
+ title: z.string().optional(),
+ topicId: z.string().nullable().optional(),
+ trigger: TaskRunTriggerSchema.nullable().optional(),
+ type: z.enum(['assignment', 'brief', 'comment', 'created', 'property', 'topic']),
+ userId: z.string().nullable().optional(),
+ verify: z
+ .object({
+ acceptanceId: z.string().nullable(),
+ passed: z.number().int(),
+ roundIndex: z.number().int().nullable(),
+ runId: z.string(),
+ status: z.string().nullable(),
+ total: z.number().int(),
+ } satisfies Record<keyof TaskRunVerifySummary, z.ZodType>)
+ .strict()
+ .nullable()
+ .optional(),
+ } satisfies Record<keyof TaskDetailActivity, z.ZodType>)
+ .meta({ id: 'TaskDetailActivity' });
+
+/**
+ * The task as the detail page reads it: the row projected for display plus its
+ * activity feed, subtasks, dependencies, pinned documents and verification.
+ */
+export const TaskDetailSchema = z
+ .object({
+ activities: z.array(TaskDetailActivitySchema).optional(),
+ agentId: z.string().nullable().optional(),
+ archivedAt: dateTimeSchema.nullable().optional(),
+ automationMode: TaskAutomationModeSchema.nullable().optional(),
+ checkpoint: CheckpointConfigSchema.optional(),
+ /** Task configuration pockets, stored as JSON. */
+ config: jsonObjectSchema.optional(),
+ createdAt: dateTimeSchema.optional(),
+ createdByUserId: z.string().nullable().optional(),
+ dependencies: z
+ .array(
+ z
+ .object({ dependsOn: z.string(), dependsOnId: z.string().optional(), type: z.string() })
+ .strict(),
+ )
+ .optional(),
+ description: z.string().nullable().optional(),
+ /** Rich-editor JSON state of the instruction. */
+ editorData: z.unknown().optional(),
+ error: z.string().nullable().optional(),
+ files: z.array(ChatFileItemSchema).optional(),
+ goal: z.object({ id: z.string(), title: z.string() }).strict().nullable().optional(),
+ heartbeat: z
+ .object({
+ interval: z.number().int().nullable().optional(),
+ lastAt: dateTimeSchema.nullable().optional(),
+ scheduledAt: dateTimeSchema.nullable().optional(),
+ timeout: z.number().int().nullable().optional(),
+ })
+ .strict()
+ .optional(),
+ id: z.string().optional(),
+ identifier: z.string(),
+ instruction: z.string(),
+ labels: z.array(TaskLabelRefSchema).optional(),
+ name: z.string().nullable().optional(),
+ parent: z
+ .object({
+ agentId: z.string().nullable().optional(),
+ id: z.string().optional(),
+ identifier: z.string(),
+ name: z.string().nullable(),
+ })
+ .strict()
+ .nullable()
+ .optional(),
+ priority: z.number().int().nullable().optional(),
+ projectId: z.string().nullable().optional(),
+ schedule: z
+ .object({
+ maxExecutions: z.number().int().nullable().optional(),
+ pattern: z.string().nullable().optional(),
+ timezone: z.string().nullable().optional(),
+ })
+ .strict()
+ .optional(),
+ startedAt: dateTimeSchema.optional(),
+ status: z.string(),
+ subtasks: z.array(TaskDetailSubtaskSchema).optional(),
+ topicCount: z.number().int().optional(),
+ updatedAt: dateTimeSchema.optional(),
+ userId: z.string().nullable().optional(),
+ verify: TaskVerifyConfigSchema.nullable().optional(),
+ visibility: TaskVisibilitySchema.optional(),
+ workspace: z.array(TaskDetailWorkspaceNodeSchema).optional(),
+ workspaceId: z.string().nullable().optional(),
+ } satisfies Record<keyof TaskDetailData, z.ZodType>)
+ .meta({ id: 'TaskDetail' });
+
+const TaskBriefSchema = z.object({ id: z.string(), identifier: z.string() }).strict();
+
+/** What a status transition did: the updated task plus the tasks it paused or unlocked. */
+export const TaskStatusUpdateResultSchema = z
+ .object({
+ allSubtasksDone: z.boolean().optional(),
+ checkpointTriggered: z.boolean().optional(),
+ /** Completion was requested by the task's own run and lands when that run ends. */
+ completionDeferred: z.boolean().optional(),
+ parentTaskId: z.string().nullable().optional(),
+ paused: z.array(z.string()),
+ pausedTasks: z.array(TaskBriefSchema).optional(),
+ /** The task was running and left unchanged. */
+ skippedRunning: z.boolean().optional(),
+ task: TaskSchema,
+ unlocked: z.array(z.string()),
+ unlockedTasks: z.array(TaskBriefSchema).optional(),
+ })
+ .strict()
+ .meta({ id: 'TaskStatusUpdateResult' });
+
+/**
+ * The run that was started: the agent operation (connect to its stream with
+ * `operationId` / `token`) plus the task it belongs to. A run that fails to
+ * start is answered with an error, never with `success: false` here.
+ */
+export const TaskRunStartedSchema = z
+ .object({
+ agentId: z.string(),
+ assistantMessageId: z.string(),
+ autoStarted: z.boolean(),
+ createdAt: dateTimeSchema,
+ createdThreadId: z.string().optional(),
+ error: z.string().optional(),
+ errorData: z
+ .object({
+ code: z.literal('DEVICE_NOT_FOUND'),
+ deviceId: z.string(),
+ retryable: z.literal(true),
+ scope: z.enum(['personal', 'workspace']),
+ workspaceId: z.string().optional(),
+ })
+ .strict()
+ .optional(),
+ groupMemberContinuation: z.boolean().optional(),
+ heteroType: z.string().nullable().optional(),
+ memberOperationId: z.string().optional(),
+ message: z.string(),
+ messageId: z.string().optional(),
+ operationId: z.string(),
+ status: z.string(),
+ success: z.boolean(),
+ supervisorOperationId: z.string().optional(),
+ taskId: z.string(),
+ taskIdentifier: z.string(),
+ terminalReported: z.boolean().optional(),
+ timestamp: dateTimeSchema,
+ token: z.string().optional(),
+ topicId: z.string(),
+ userMessageId: z.string(),
+ } satisfies Record<keyof ExecAgentResult | 'taskId' | 'taskIdentifier', z.ZodType>)
+ .strict()
+ .meta({ id: 'TaskRunStarted' });
+
+/** One past run of a task with the handoff its lifecycle wrote. */
+export const TaskRunSchema = z
+ .object({
+ /** The agent that actually ran this topic. */
+ agentId: z.string().nullable(),
+ completedAt: dateTimeSchema.nullable(),
+ /** Raw output of the run, captured on completion. */
+ content: z.string().nullable(),
+ createdAt: dateTimeSchema,
+ keyFindings: z.array(z.string()),
+ nextAction: z.string().nullable(),
+ /** Whether the lifecycle judged this run worth surfacing; null when it never judged. */
+ notable: z.boolean().nullable(),
+ seq: z.number().int(),
+ status: z.string(),
+ summary: z.string().nullable(),
+ title: z.string().nullable(),
+ topicId: z.string().nullable(),
+ trigger: TaskRunTriggerSchema.nullable(),
+ })
+ .strict()
+ .meta({ id: 'TaskRun' });
diff --git a/packages/openapi/src/types/topic.type.ts b/packages/openapi/src/types/topic.type.ts
index 09130657bf4..fb9be75ec05 100644
--- a/packages/openapi/src/types/topic.type.ts
+++ b/packages/openapi/src/types/topic.type.ts
@@ -1,9 +1,11 @@
import type { ChatTopicMetadata } from '@lobechat/types';
import { z } from 'zod';
+import { THREAD_STATUS, THREAD_TYPE, topics } from '@/database/schemas/topic';
+
import type { PublicTopic, PublicUser } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
-import { PaginationQuerySchema } from './common.type';
+import { dateTimeSchema, jsonObjectSchema, PaginationQuerySchema } from './common.type';
// ==================== Topic Query Types ====================
@@ -94,3 +96,85 @@ export const TopicDeleteParamSchema = z.object({
export const TopicUpdateParamSchema = z.object({
id: z.string().min(1, 'Topic ID cannot be empty'),
});
+
+// ==================== Response Schemas ====================
+
+type ShapeOf<T> = Record<keyof T, z.ZodType>;
+
+/** The owner of a topic, projected through `PUBLIC_USER_FIELDS`. */
+const TopicOwnerSchema = z
+ .object({
+ avatar: z.string().nullable(),
+ createdAt: dateTimeSchema,
+ email: z.string().nullable(),
+ firstName: z.string().nullable(),
+ fullName: z.string().nullable(),
+ id: z.string(),
+ isOnboarded: z.boolean().nullable(),
+ lastName: z.string().nullable(),
+ phone: z.string().nullable(),
+ updatedAt: dateTimeSchema,
+ username: z.string().nullable(),
+ } satisfies ShapeOf<PublicUser>)
+ .strict();
+
+/** A topic row projected through `PUBLIC_TOPIC_FIELDS` — what a message embeds. */
+export const TopicSummarySchema = z
+ .object({
+ agentId: z.string().nullable(),
+ completedAt: dateTimeSchema.nullable(),
+ content: z.string().nullable(),
+ cost: jsonObjectSchema.nullable(),
+ createdAt: dateTimeSchema,
+ description: z.string().nullable(),
+ favorite: z.boolean().nullable(),
+ groupId: z.string().nullable(),
+ historySummary: z.string().nullable(),
+ id: z.string(),
+ metadata: jsonObjectSchema.nullable(),
+ mode: z.string().nullable(),
+ model: z.string().nullable(),
+ provider: z.string().nullable(),
+ sessionId: z.string().nullable(),
+ status: z.enum(topics.status.enumValues).nullable(),
+ title: z.string().nullable(),
+ totalCost: z.number().nullable(),
+ totalInputTokens: z.number().int().nullable(),
+ totalOutputTokens: z.number().int().nullable(),
+ totalTokens: z.number().int().nullable(),
+ trigger: z.string().nullable(),
+ updatedAt: dateTimeSchema,
+ usage: jsonObjectSchema.nullable(),
+ } satisfies ShapeOf<PublicTopic>)
+ .strict()
+ .meta({ id: 'TopicSummary' });
+
+export const TopicSchema = TopicSummarySchema.extend({
+ /** Messages stored in the topic. */
+ messageCount: z.number().int().min(0),
+ user: TopicOwnerSchema,
+})
+ .strict()
+ .meta({ id: 'Topic' });
+
+export const TopicListSchema = z
+ .object({ topics: z.array(TopicSchema), total: z.number().int().min(0) })
+ .strict();
+
+export const TopicThreadSchema = z
+ .object({
+ createdAt: dateTimeSchema,
+ id: z.string(),
+ parentThreadId: z.string().nullable(),
+ status: z.enum(THREAD_STATUS).nullable(),
+ title: z.string().nullable(),
+ topicId: z.string(),
+ type: z.enum(THREAD_TYPE),
+ updatedAt: dateTimeSchema,
+ })
+ .strict()
+ .meta({ id: 'TopicThread' });
+
+export const TopicThreadListSchema = z
+ .object({ threads: z.array(TopicThreadSchema), total: z.number().int().min(0) })
+ .strict();
diff --git a/packages/openapi/src/types/usage.type.test.ts b/packages/openapi/src/types/usage.type.test.ts
new file mode 100644
index 00000000000..c53eb329e9e
--- /dev/null
+++ b/packages/openapi/src/types/usage.type.test.ts
@@ -0,0 +1,38 @@
+import { describe, expect, it } from 'vitest';
+
+import { getOpenApiUsage } from '@/business/server/openapiUsage';
+
+import { UsageSchema } from './usage.type';
+
+describe('UsageSchema', () => {
+ it('accepts the personal and workspace summaries', async () => {
+ const personal = await getOpenApiUsage({ userId: 'user-1' });
+ const workspace = await getOpenApiUsage({ userId: 'user-1', workspaceId: 'ws-1' });
+
+ expect(UsageSchema.parse(personal).scope).toBe('personal');
+ expect(UsageSchema.parse(workspace).scope).toBe('workspace');
+ });
+
+ it('accepts a metered quota', () => {
+ expect(() =>
+ UsageSchema.parse({
+ available: true,
+ currency: 'USD',
+ daily: [{ date: '2026-11-01', value: 1.5 }],
+ period: { since: '2026-10-18T00:00:00.000Z', until: '2026-11-17T00:00:00.000Z' },
+ quota: {
+ limit: 10,
+ remaining: 8.5,
+ resetsAt: '2026-12-01T00:00:00.000Z',
+ source: 'workspace_pool',
+ used: 1.5,
+ usedRatio: 0.15,
+ },
+ remainingBalance: 8.5,
+ scope: 'workspace',
+ spent: 1.5,
+ usageByType: [{ count: 3, spend: 1.5, type: 'chat' }],
+ }),
+ ).not.toThrow();
+ });
+});
diff --git a/packages/openapi/src/types/usage.type.ts b/packages/openapi/src/types/usage.type.ts
new file mode 100644
index 00000000000..85dee5082af
--- /dev/null
+++ b/packages/openapi/src/types/usage.type.ts
@@ -0,0 +1,49 @@
+import { z } from 'zod';
+
+import type { OpenApiUsageSummary } from '@/business/server/openapiUsage';
+
+import { dateTimeSchema } from './common.type';
+
+type ShapeOf<T> = Record<keyof T, z.ZodType>;
+
+// ==================== Response Schemas ====================
+
+const UsageQuotaSchema = z
+ .object({
+ /** The allowance for the cycle in USD; `null` when uncapped or unknown. */
+ limit: z.number().nullable(),
+ remaining: z.number().nullable(),
+ /** Next reset of a recurring allowance; `null` when none recurs. */
+ resetsAt: dateTimeSchema.nullable(),
+ source: z.enum(['personal', 'workspace_pool', 'member_budget']),
+ used: z.number(),
+ /** `used / limit`, clamped to `0..1`; `null` when `limit` is. */
+ usedRatio: z.number().nullable(),
+ } satisfies ShapeOf<NonNullable<OpenApiUsageSummary['quota']>>)
+ .strict();
+
+/**
+ * The caller's spend and allowance for the current window. Tied to
+ * `OpenApiUsageSummary` so a field added to the summary fails type-checking
+ * here instead of drifting out of the SDK.
+ */
+export const UsageSchema = z
+ .object({
+ /** `false` when the deployment has no metered budget provider. */
+ available: z.boolean(),
+ currency: z.literal('USD'),
+ daily: z.array(z.object({ date: z.string(), value: z.number() }).strict()),
+ period: z.object({ since: dateTimeSchema, until: dateTimeSchema }).strict(),
+ /** `null` when the deployment has no metered budget provider. */
+ quota: UsageQuotaSchema.nullable(),
+ remainingBalance: z.number().nullable(),
+ scope: z.enum(['personal', 'workspace']),
+ spent: z.number(),
+ usageByType: z.array(
+ z
+ .object({ count: z.number().int().nullable(), spend: z.number(), type: z.string() })
+ .strict(),
+ ),
+ } satisfies ShapeOf<OpenApiUsageSummary>)
+ .strict()
+ .meta({ id: 'Usage' });
diff --git a/packages/openapi/src/types/user.type.ts b/packages/openapi/src/types/user.type.ts
index f408f123a73..f8713175190 100644
--- a/packages/openapi/src/types/user.type.ts
+++ b/packages/openapi/src/types/user.type.ts
@@ -4,6 +4,8 @@ import type { UserRoleItem } from '@/database/schemas';
import type { PublicRole, PublicUser } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
+import { dateTimeSchema } from './common.type';
+import { RoleSchema } from './role.type';
// ==================== User Base Types ====================
@@ -181,3 +183,53 @@ export interface UserRoleOperationResult {
export const UserIdParamSchema = z.object({
id: z.string().min(1, 'User ID cannot be empty'),
});
+
+// ==================== Response Schemas ====================
+
+/**
+ * `PUBLIC_USER_FIELDS` projection of a `users` row plus the caller-visible
+ * roles (`UserWithRoles`). `messageCount` is present in the user list and in
+ * `GET /users/me?includeCount=1`; the other operations leave it out.
+ */
+export const UserSchema = z
+ .object({
+ avatar: z.string().nullable(),
+ createdAt: dateTimeSchema,
+ email: z.string().nullable(),
+ firstName: z.string().nullable(),
+ fullName: z.string().nullable(),
+ id: z.string(),
+ isOnboarded: z.boolean().nullable(),
+ lastName: z.string().nullable(),
+ messageCount: z.number().int().min(0).optional(),
+ phone: z.string().nullable(),
+ roles: z.array(RoleSchema),
+ updatedAt: dateTimeSchema,
+ username: z.string().nullable(),
+ })
+ .strict()
+ .meta({ id: 'User' });
+
+/** What `GET /users/me` answers a caller whose key lacks `user:read` with. */
+export const UserIdentitySchema = z
+ .object({ id: z.string() })
+ .strict()
+ .meta({ id: 'UserIdentity' });
+
+export const CurrentUserSchema = z.union([UserSchema, UserIdentitySchema]);
+
+export const UserListSchema = z
+ .object({ total: z.number().int().min(0), users: z.array(UserSchema) })
+ .strict()
+ .meta({ id: 'UserList' });
+
+/** One role assignment as `GET|PATCH /users/:id/roles` reports it. */
+export const UserRoleSchema = z
+ .object({
+ expiresAt: dateTimeSchema.nullable(),
+ roleDisplayName: z.string(),
+ roleId: z.string(),
+ roleName: z.string(),
+ })
+ .strict()
+ .meta({ id: 'UserRole' });
diff --git a/packages/openapi/vitest.config.mts b/packages/openapi/vitest.config.mts
index eae247b395e..fb233d44cc8 100644
--- a/packages/openapi/vitest.config.mts
+++ b/packages/openapi/vitest.config.mts
@@ -1,8 +1,50 @@
+import { existsSync } from 'node:fs';
import { resolve } from 'node:path';
import { defineConfig } from 'vitest/config';
+/**
+ * Root tsconfig maps these prefixes to a package first and the app `src` second.
+ * Vite aliases have no fallback, so resolve the app-level module when the
+ * package does not have it (the spec test imports the whole app).
+ */
+const FALLBACK_PREFIXES: Record<string, [string, string]> = {
+ '@/business/server/': ['../business-server/src/', '../../src/business/server/'],
+ '@/config/': ['../app-config/src/', '../../src/config/'],
+ '@/const/': ['../const/src/', '../../src/const/'],
+ '@/envs/': ['../env/src/', '../../src/envs/'],
+ '@/libs/trpc/': ['../trpc/src/', '../../src/libs/trpc/'],
+ '@/locales/': ['../locales/src/', '../../src/locales/'],
+ '@/types/': ['../types/src/', '../../src/types/'],
+ '@/utils/': ['../utils/src/', '../../src/utils/'],
+};
+const EXTENSIONS = ['', '.ts', '.tsx', '/index.ts', '/index.tsx'];
+const exists = (base: string) => EXTENSIONS.some((ext) => existsSync(`${base}${ext}`));
+
export default defineConfig({
+ plugins: [
+ {
+ enforce: 'pre',
+ name: 'tsconfig-path-fallback',
+ // Runs after the aliases below, so it sees the package path they produced.
+ resolveId(id) {
+ for (const [primary, fallback] of Object.values(FALLBACK_PREFIXES)) {
+ const primaryDir = resolve(__dirname, primary);
+ if (!id.startsWith(`${primaryDir}/`) || exists(id)) continue;
+ const candidate = resolve(__dirname, fallback, id.slice(primaryDir.length + 1));
+ if (exists(candidate)) return this.resolve(candidate);
+ }
+ },
+ },
+ // The spec test imports the whole app, which reaches agent templates that
+ // import Markdown; keep Vite from parsing it as JavaScript.
+ {
+ name: 'raw-md',
+ transform(_, id) {
+ if (id.endsWith('.md')) return { code: 'export default ""', map: null };
+ },
+ },
+ ],
resolve: {
alias: {
// mirror the root tsconfig paths: package sources first, app src as fallback
diff --git a/packages/sdk/src/generated/index.ts b/packages/sdk/src/generated/index.ts
index 3017af65edb..6cc9a7b6f00 100644
--- a/packages/sdk/src/generated/index.ts
+++ b/packages/sdk/src/generated/index.ts
@@ -1,4 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
-export { AgentGroups, Agents, ApiKeys, Chat, ChatGroups, Eval, Files, Goals, Health, Im, KnowledgeBases, LobeHub, McpServers, Memories, Messages, MessageTranslations, Models, Notifications, type Options, Permissions, Plugins, Providers, PushTokens, Responses, Roles, Signals, Tasks, Topics, Usage as Usage2, Users } from './sdk.gen';
-export type { Agent, AgentAccount, AgentGroup, ApiError, ApiKey, ChatGroup, ChatResponse, ClientOptions, DeleteApiV1AgentGroupsByIdData, DeleteApiV1AgentGroupsByIdError, DeleteApiV1AgentGroupsByIdErrors, DeleteApiV1AgentGroupsByIdResponse, DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentsByIdAccountsByAccountIdData, DeleteApiV1AgentsByIdAccountsByAccountIdError, DeleteApiV1AgentsByIdAccountsByAccountIdErrors, DeleteApiV1AgentsByIdAccountsByAccountIdResponse, DeleteApiV1AgentsByIdAccountsByAccountIdResponses, DeleteApiV1AgentsByIdData, DeleteApiV1AgentsByIdError, DeleteApiV1AgentsByIdErrors, DeleteApiV1AgentsByIdResponse, DeleteApiV1AgentsByIdResponses, DeleteApiV1ApiKeysByIdData, DeleteApiV1ApiKeysByIdError, DeleteApiV1ApiKeysByIdErrors, DeleteApiV1ApiKeysByIdResponse, DeleteApiV1ApiKeysByIdResponses, DeleteApiV1ChatGroupsByIdData, DeleteApiV1ChatGroupsByIdError, DeleteApiV1ChatGroupsByIdErrors, DeleteApiV1ChatGroupsByIdMembersData, DeleteApiV1ChatGroupsByIdMembersError, DeleteApiV1ChatGroupsByIdMembersErrors, DeleteApiV1ChatGroupsByIdMembersResponse, DeleteApiV1ChatGroupsByIdMembersResponses, DeleteApiV1ChatGroupsByIdResponse, DeleteApiV1ChatGroupsByIdResponses, DeleteApiV1EvalBenchmarksByIdData, DeleteApiV1EvalBenchmarksByIdError, DeleteApiV1EvalBenchmarksByIdErrors, DeleteApiV1EvalBenchmarksByIdResponse, DeleteApiV1EvalBenchmarksByIdResponses, DeleteApiV1EvalDatasetsByIdData, DeleteApiV1EvalDatasetsByIdError, DeleteApiV1EvalDatasetsByIdErrors, DeleteApiV1EvalDatasetsByIdResponse, DeleteApiV1EvalDatasetsByIdResponses, DeleteApiV1EvalTestCasesByIdData, DeleteApiV1EvalTestCasesByIdError, DeleteApiV1EvalTestCasesByIdErrors, DeleteApiV1EvalTestCasesByIdResponse, DeleteApiV1EvalTestCasesByIdResponses, DeleteApiV1FilesByIdData, DeleteApiV1FilesByIdError, DeleteApiV1FilesByIdErrors, DeleteApiV1FilesByIdResponse, DeleteApiV1FilesByIdResponses, DeleteApiV1GoalsByIdData, DeleteApiV1GoalsByIdError, DeleteApiV1GoalsByIdErrors, DeleteApiV1GoalsByIdResponse, DeleteApiV1GoalsByIdResponses, DeleteApiV1KnowledgeBasesByIdData, DeleteApiV1KnowledgeBasesByIdError, DeleteApiV1KnowledgeBasesByIdErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchData, DeleteApiV1KnowledgeBasesByIdFilesBatchError, DeleteApiV1KnowledgeBasesByIdFilesBatchErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchResponse, DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdResponse, DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1McpServersByIdData, DeleteApiV1McpServersByIdError, DeleteApiV1McpServersByIdErrors, DeleteApiV1McpServersByIdResponse, DeleteApiV1McpServersByIdResponses, DeleteApiV1MemoriesByCategoryByIdData, DeleteApiV1MemoriesByCategoryByIdError, DeleteApiV1MemoriesByCategoryByIdErrors, DeleteApiV1MemoriesByCategoryByIdResponse, DeleteApiV1MemoriesByCategoryByIdResponses, DeleteApiV1MemoriesData, DeleteApiV1MemoriesError, DeleteApiV1MemoriesErrors, DeleteApiV1MemoriesResponse, DeleteApiV1MemoriesResponses, DeleteApiV1MessagesByIdData, DeleteApiV1MessagesByIdError, DeleteApiV1MessagesByIdErrors, DeleteApiV1MessagesByIdResponse, DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesData, DeleteApiV1MessagesError, DeleteApiV1MessagesErrors, DeleteApiV1MessagesResponse, DeleteApiV1MessagesResponses, DeleteApiV1MessageTranslationsByMessageIdData, DeleteApiV1MessageTranslationsByMessageIdError, DeleteApiV1MessageTranslationsByMessageIdErrors, DeleteApiV1MessageTranslationsByMessageIdResponse, DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1PermissionsByIdData, DeleteApiV1PermissionsByIdError, DeleteApiV1PermissionsByIdErrors, DeleteApiV1PermissionsByIdResponse, DeleteApiV1PermissionsByIdResponses, DeleteApiV1ProvidersByIdData, DeleteApiV1ProvidersByIdError, DeleteApiV1ProvidersByIdErrors, DeleteApiV1ProvidersByIdResponse, DeleteApiV1ProvidersByIdResponses, DeleteApiV1PushTokensByDeviceIdData, DeleteApiV1PushTokensByDeviceIdError, DeleteApiV1PushTokensByDeviceIdErrors, DeleteApiV1PushTokensByDeviceIdResponse, DeleteApiV1PushTokensByDeviceIdResponses, DeleteApiV1RolesByIdData, DeleteApiV1RolesByIdError, DeleteApiV1RolesByIdErrors, DeleteApiV1RolesByIdPermissionsData, DeleteApiV1RolesByIdPermissionsError, DeleteApiV1RolesByIdPermissionsErrors, DeleteApiV1RolesByIdPermissionsResponse, DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdResponse, DeleteApiV1RolesByIdResponses, DeleteApiV1TasksByIdData, DeleteApiV1TasksByIdError, DeleteApiV1TasksByIdErrors, DeleteApiV1TasksByIdResponse, DeleteApiV1TasksByIdResponses, DeleteApiV1TopicsByIdData, DeleteApiV1TopicsByIdError, DeleteApiV1TopicsByIdErrors, DeleteApiV1TopicsByIdResponse, DeleteApiV1TopicsByIdResponses, DeleteApiV1UsersByIdData, DeleteApiV1UsersByIdError, DeleteApiV1UsersByIdErrors, DeleteApiV1UsersByIdResponse, DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdRolesData, DeleteApiV1UsersByIdRolesError, DeleteApiV1UsersByIdRolesErrors, DeleteApiV1UsersByIdRolesResponse, DeleteApiV1UsersByIdRolesResponses, EvalRun, EvalRunResult, File, GetApiV1AgentGroupsByIdData, GetApiV1AgentGroupsByIdError, GetApiV1AgentGroupsByIdErrors, GetApiV1AgentGroupsByIdResponse, GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsData, GetApiV1AgentGroupsError, GetApiV1AgentGroupsErrors, GetApiV1AgentGroupsResponse, GetApiV1AgentGroupsResponses, GetApiV1AgentsByIdAccountsByAccountIdData, GetApiV1AgentsByIdAccountsByAccountIdError, GetApiV1AgentsByIdAccountsByAccountIdErrors, GetApiV1AgentsByIdAccountsByAccountIdResponse, GetApiV1AgentsByIdAccountsByAccountIdResponses, GetApiV1AgentsByIdAccountsData, GetApiV1AgentsByIdAccountsError, GetApiV1AgentsByIdAccountsErrors, GetApiV1AgentsByIdAccountsResponse, GetApiV1AgentsByIdAccountsResponses, GetApiV1AgentsByIdData, GetApiV1AgentsByIdError, GetApiV1AgentsByIdErrors, GetApiV1AgentsByIdResponse, GetApiV1AgentsByIdResponses, GetApiV1AgentsData, GetApiV1AgentsError, GetApiV1AgentsErrors, GetApiV1AgentsResponse, GetApiV1AgentsResponses, GetApiV1ApiKeysByIdData, GetApiV1ApiKeysByIdError, GetApiV1ApiKeysByIdErrors, GetApiV1ApiKeysByIdResponse, GetApiV1ApiKeysByIdResponses, GetApiV1ApiKeysData, GetApiV1ApiKeysError, GetApiV1ApiKeysErrors, GetApiV1ApiKeysResponse, GetApiV1ApiKeysResponses, GetApiV1ChatGroupsByIdData, GetApiV1ChatGroupsByIdError, GetApiV1ChatGroupsByIdErrors, GetApiV1ChatGroupsByIdResponse, GetApiV1ChatGroupsByIdResponses, GetApiV1ChatGroupsData, GetApiV1ChatGroupsError, GetApiV1ChatGroupsErrors, GetApiV1ChatGroupsResponse, GetApiV1ChatGroupsResponses, GetApiV1EvalBenchmarksByIdData, GetApiV1EvalBenchmarksByIdError, GetApiV1EvalBenchmarksByIdErrors, GetApiV1EvalBenchmarksByIdResponse, GetApiV1EvalBenchmarksByIdResponses, GetApiV1EvalBenchmarksData, GetApiV1EvalBenchmarksError, GetApiV1EvalBenchmarksErrors, GetApiV1EvalBenchmarksResponse, GetApiV1EvalBenchmarksResponses, GetApiV1EvalDatasetsByDatasetIdTestCasesData, GetApiV1EvalDatasetsByDatasetIdTestCasesError, GetApiV1EvalDatasetsByDatasetIdTestCasesErrors, GetApiV1EvalDatasetsByDatasetIdTestCasesResponse, GetApiV1EvalDatasetsByDatasetIdTestCasesResponses, GetApiV1EvalDatasetsByIdData, GetApiV1EvalDatasetsByIdError, GetApiV1EvalDatasetsByIdErrors, GetApiV1EvalDatasetsByIdResponse, GetApiV1EvalDatasetsByIdResponses, GetApiV1EvalDatasetsData, GetApiV1EvalDatasetsError, GetApiV1EvalDatasetsErrors, GetApiV1EvalDatasetsResponse, GetApiV1EvalDatasetsResponses, GetApiV1EvalRunsByIdData, GetApiV1EvalRunsByIdError, GetApiV1EvalRunsByIdErrors, GetApiV1EvalRunsByIdResponse, GetApiV1EvalRunsByIdResponses, GetApiV1EvalRunsByIdResultsData, GetApiV1EvalRunsByIdResultsError, GetApiV1EvalRunsByIdResultsErrors, GetApiV1EvalRunsByIdResultsResponse, GetApiV1EvalRunsByIdResultsResponses, GetApiV1EvalRunsByIdTopicsData, GetApiV1EvalRunsByIdTopicsError, GetApiV1EvalRunsByIdTopicsErrors, GetApiV1EvalRunsByIdTopicsResponse, GetApiV1EvalRunsByIdTopicsResponses, GetApiV1EvalRunsData, GetApiV1EvalRunsError, GetApiV1EvalRunsErrors, GetApiV1EvalRunsResponse, GetApiV1EvalRunsResponses, GetApiV1EvalTestCasesByIdData, GetApiV1EvalTestCasesByIdError, GetApiV1EvalTestCasesByIdErrors, GetApiV1EvalTestCasesByIdResponse, GetApiV1EvalTestCasesByIdResponses, GetApiV1FilesByIdChunksData, GetApiV1FilesByIdChunksError, GetApiV1FilesByIdChunksErrors, GetApiV1FilesByIdChunksResponse, GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdData, GetApiV1FilesByIdError, GetApiV1FilesByIdErrors, GetApiV1FilesByIdResponse, GetApiV1FilesByIdResponses, GetApiV1FilesByIdUrlData, GetApiV1FilesByIdUrlError, GetApiV1FilesByIdUrlErrors, GetApiV1FilesByIdUrlResponse, GetApiV1FilesByIdUrlResponses, GetApiV1FilesData, GetApiV1FilesError, GetApiV1FilesErrors, GetApiV1FilesResponse, GetApiV1FilesResponses, GetApiV1GoalsByIdData, GetApiV1GoalsByIdError, GetApiV1GoalsByIdErrors, GetApiV1GoalsByIdResponse, GetApiV1GoalsByIdResponses, GetApiV1GoalsByIdSupervisionData, GetApiV1GoalsByIdSupervisionError, GetApiV1GoalsByIdSupervisionErrors, GetApiV1GoalsByIdSupervisionResponse, GetApiV1GoalsByIdSupervisionResponses, GetApiV1GoalsData, GetApiV1GoalsError, GetApiV1GoalsErrors, GetApiV1GoalsResponse, GetApiV1GoalsResponses, GetApiV1HealthData, GetApiV1HealthError, GetApiV1HealthErrors, GetApiV1HealthResponse, GetApiV1HealthResponses, GetApiV1ImTopicsByTopicIdSyncData, GetApiV1ImTopicsByTopicIdSyncError, GetApiV1ImTopicsByTopicIdSyncErrors, GetApiV1ImTopicsByTopicIdSyncResponse, GetApiV1ImTopicsByTopicIdSyncResponses, GetApiV1KnowledgeBasesByIdData, GetApiV1KnowledgeBasesByIdError, GetApiV1KnowledgeBasesByIdErrors, GetApiV1KnowledgeBasesByIdFilesData, GetApiV1KnowledgeBasesByIdFilesError, GetApiV1KnowledgeBasesByIdFilesErrors, GetApiV1KnowledgeBasesByIdFilesResponse, GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdResponse, GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesData, GetApiV1KnowledgeBasesError, GetApiV1KnowledgeBasesErrors, GetApiV1KnowledgeBasesResponse, GetApiV1KnowledgeBasesResponses, GetApiV1McpServersByIdData, GetApiV1McpServersByIdError, GetApiV1McpServersByIdErrors, GetApiV1McpServersByIdResponse, GetApiV1McpServersByIdResponses, GetApiV1McpServersData, GetApiV1McpServersError, GetApiV1McpServersErrors, GetApiV1McpServersResponse, GetApiV1McpServersResponses, GetApiV1MemoriesByCategoryData, GetApiV1MemoriesByCategoryError, GetApiV1MemoriesByCategoryErrors, GetApiV1MemoriesByCategoryResponse, GetApiV1MemoriesByCategoryResponses, GetApiV1MemoriesPersonaData, GetApiV1MemoriesPersonaError, GetApiV1MemoriesPersonaErrors, GetApiV1MemoriesPersonaResponse, GetApiV1MemoriesPersonaResponses, GetApiV1MemoriesPersonaVersionsData, GetApiV1MemoriesPersonaVersionsError, GetApiV1MemoriesPersonaVersionsErrors, GetApiV1MemoriesPersonaVersionsResponse, GetApiV1MemoriesPersonaVersionsResponses, GetApiV1MessagesByIdData, GetApiV1MessagesByIdError, GetApiV1MessagesByIdErrors, GetApiV1MessagesByIdResponse, GetApiV1MessagesByIdResponses, GetApiV1MessagesCountData, GetApiV1MessagesCountError, GetApiV1MessagesCountErrors, GetApiV1MessagesCountResponse, GetApiV1MessagesCountResponses, GetApiV1MessagesData, GetApiV1MessagesError, GetApiV1MessagesErrors, GetApiV1MessagesResponse, GetApiV1MessagesResponses, GetApiV1MessageTranslationsByMessageIdData, GetApiV1MessageTranslationsByMessageIdError, GetApiV1MessageTranslationsByMessageIdErrors, GetApiV1MessageTranslationsByMessageIdResponse, GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1ModelsByProviderIdByModelIdData, GetApiV1ModelsByProviderIdByModelIdError, GetApiV1ModelsByProviderIdByModelIdErrors, GetApiV1ModelsByProviderIdByModelIdResponse, GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsData, GetApiV1ModelsError, GetApiV1ModelsErrors, GetApiV1ModelsResponse, GetApiV1ModelsResponses, GetApiV1NotificationsCountsData, GetApiV1NotificationsCountsError, GetApiV1NotificationsCountsErrors, GetApiV1NotificationsCountsResponse, GetApiV1NotificationsCountsResponses, GetApiV1NotificationsData, GetApiV1NotificationsError, GetApiV1NotificationsErrors, GetApiV1NotificationsResponse, GetApiV1NotificationsResponses, GetApiV1NotificationsSettingsData, GetApiV1NotificationsSettingsError, GetApiV1NotificationsSettingsErrors, GetApiV1NotificationsSettingsResponse, GetApiV1NotificationsSettingsResponses, GetApiV1NotificationsUnreadCountData, GetApiV1NotificationsUnreadCountError, GetApiV1NotificationsUnreadCountErrors, GetApiV1NotificationsUnreadCountResponse, GetApiV1NotificationsUnreadCountResponses, GetApiV1PermissionsByIdData, GetApiV1PermissionsByIdError, GetApiV1PermissionsByIdErrors, GetApiV1PermissionsByIdResponse, GetApiV1PermissionsByIdResponses, GetApiV1PermissionsData, GetApiV1PermissionsError, GetApiV1PermissionsErrors, GetApiV1PermissionsResponse, GetApiV1PermissionsResponses, GetApiV1PluginsData, GetApiV1PluginsError, GetApiV1PluginsErrors, GetApiV1PluginsResponse, GetApiV1PluginsResponses, GetApiV1ProvidersByIdData, GetApiV1ProvidersByIdError, GetApiV1ProvidersByIdErrors, GetApiV1ProvidersByIdResponse, GetApiV1ProvidersByIdResponses, GetApiV1ProvidersData, GetApiV1ProvidersError, GetApiV1ProvidersErrors, GetApiV1ProvidersResponse, GetApiV1ProvidersResponses, GetApiV1RolesByIdData, GetApiV1RolesByIdError, GetApiV1RolesByIdErrors, GetApiV1RolesByIdPermissionsData, GetApiV1RolesByIdPermissionsError, GetApiV1RolesByIdPermissionsErrors, GetApiV1RolesByIdPermissionsResponse, GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdResponse, GetApiV1RolesByIdResponses, GetApiV1RolesData, GetApiV1RolesError, GetApiV1RolesErrors, GetApiV1RolesResponse, GetApiV1RolesResponses, GetApiV1SignalsReceiptsData, GetApiV1SignalsReceiptsError, GetApiV1SignalsReceiptsErrors, GetApiV1SignalsReceiptsResponse, GetApiV1SignalsReceiptsResponses, GetApiV1TasksByIdData, GetApiV1TasksByIdError, GetApiV1TasksByIdErrors, GetApiV1TasksByIdResponse, GetApiV1TasksByIdResponses, GetApiV1TasksByIdRunsData, GetApiV1TasksByIdRunsError, GetApiV1TasksByIdRunsErrors, GetApiV1TasksByIdRunsResponse, GetApiV1TasksByIdRunsResponses, GetApiV1TasksData, GetApiV1TasksError, GetApiV1TasksErrors, GetApiV1TasksResponse, GetApiV1TasksResponses, GetApiV1TopicsByIdData, GetApiV1TopicsByIdError, GetApiV1TopicsByIdErrors, GetApiV1TopicsByIdResponse, GetApiV1TopicsByIdResponses, GetApiV1TopicsByTopicIdThreadsData, GetApiV1TopicsByTopicIdThreadsError, GetApiV1TopicsByTopicIdThreadsErrors, GetApiV1TopicsByTopicIdThreadsResponse, GetApiV1TopicsByTopicIdThreadsResponses, GetApiV1TopicsData, GetApiV1TopicsError, GetApiV1TopicsErrors, GetApiV1TopicsResponse, GetApiV1TopicsResponses, GetApiV1UsageData, GetApiV1UsageError, GetApiV1UsageErrors, GetApiV1UsageResponse, GetApiV1UsageResponses, GetApiV1UsersByIdData, GetApiV1UsersByIdError, GetApiV1UsersByIdErrors, GetApiV1UsersByIdResponse, GetApiV1UsersByIdResponses, GetApiV1UsersByIdRolesData, GetApiV1UsersByIdRolesError, GetApiV1UsersByIdRolesErrors, GetApiV1UsersByIdRolesResponse, GetApiV1UsersByIdRolesResponses, GetApiV1UsersData, GetApiV1UsersError, GetApiV1UsersErrors, GetApiV1UsersMeData, GetApiV1UsersMeError, GetApiV1UsersMeErrors, GetApiV1UsersMeResponse, GetApiV1UsersMeResponses, GetApiV1UsersResponse, GetApiV1UsersResponses, KnowledgeBase, McpServer, Message, Model, PatchApiV1AgentGroupsByIdData, PatchApiV1AgentGroupsByIdError, PatchApiV1AgentGroupsByIdErrors, PatchApiV1AgentGroupsByIdResponse, PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentsByIdAccountsByAccountIdData, PatchApiV1AgentsByIdAccountsByAccountIdError, PatchApiV1AgentsByIdAccountsByAccountIdErrors, PatchApiV1AgentsByIdAccountsByAccountIdResponse, PatchApiV1AgentsByIdAccountsByAccountIdResponses, PatchApiV1AgentsByIdData, PatchApiV1AgentsByIdError, PatchApiV1AgentsByIdErrors, PatchApiV1AgentsByIdResponse, PatchApiV1AgentsByIdResponses, PatchApiV1ApiKeysByIdData, PatchApiV1ApiKeysByIdError, PatchApiV1ApiKeysByIdErrors, PatchApiV1ApiKeysByIdResponse, PatchApiV1ApiKeysByIdResponses, PatchApiV1ChatGroupsByIdData, PatchApiV1ChatGroupsByIdError, PatchApiV1ChatGroupsByIdErrors, PatchApiV1ChatGroupsByIdResponse, PatchApiV1ChatGroupsByIdResponses, PatchApiV1EvalBenchmarksByIdData, PatchApiV1EvalBenchmarksByIdError, PatchApiV1EvalBenchmarksByIdErrors, PatchApiV1EvalBenchmarksByIdResponse, PatchApiV1EvalBenchmarksByIdResponses, PatchApiV1EvalDatasetsByIdData, PatchApiV1EvalDatasetsByIdError, PatchApiV1EvalDatasetsByIdErrors, PatchApiV1EvalDatasetsByIdResponse, PatchApiV1EvalDatasetsByIdResponses, PatchApiV1EvalRunsByIdStatusData, PatchApiV1EvalRunsByIdStatusError, PatchApiV1EvalRunsByIdStatusErrors, PatchApiV1EvalRunsByIdStatusResponse, PatchApiV1EvalRunsByIdStatusResponses, PatchApiV1EvalTestCasesByIdData, PatchApiV1EvalTestCasesByIdError, PatchApiV1EvalTestCasesByIdErrors, PatchApiV1EvalTestCasesByIdResponse, PatchApiV1EvalTestCasesByIdResponses, PatchApiV1FilesByIdData, PatchApiV1FilesByIdError, PatchApiV1FilesByIdErrors, PatchApiV1FilesByIdResponse, PatchApiV1FilesByIdResponses, PatchApiV1GoalsByIdData, PatchApiV1GoalsByIdError, PatchApiV1GoalsByIdErrors, PatchApiV1GoalsByIdResponse, PatchApiV1GoalsByIdResponses, PatchApiV1KnowledgeBasesByIdData, PatchApiV1KnowledgeBasesByIdError, PatchApiV1KnowledgeBasesByIdErrors, PatchApiV1KnowledgeBasesByIdResponse, PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1McpServersByIdData, PatchApiV1McpServersByIdError, PatchApiV1McpServersByIdErrors, PatchApiV1McpServersByIdResponse, PatchApiV1McpServersByIdResponses, PatchApiV1MessageTranslationsByMessageIdData, PatchApiV1MessageTranslationsByMessageIdError, PatchApiV1MessageTranslationsByMessageIdErrors, PatchApiV1MessageTranslationsByMessageIdResponse, PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1ModelsByProviderIdByModelIdData, PatchApiV1ModelsByProviderIdByModelIdError, PatchApiV1ModelsByProviderIdByModelIdErrors, PatchApiV1ModelsByProviderIdByModelIdResponse, PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1NotificationsSettingsData, PatchApiV1NotificationsSettingsError, PatchApiV1NotificationsSettingsErrors, PatchApiV1NotificationsSettingsResponse, PatchApiV1NotificationsSettingsResponses, PatchApiV1PermissionsByIdData, PatchApiV1PermissionsByIdError, PatchApiV1PermissionsByIdErrors, PatchApiV1PermissionsByIdResponse, PatchApiV1PermissionsByIdResponses, PatchApiV1ProvidersByIdData, PatchApiV1ProvidersByIdError, PatchApiV1ProvidersByIdErrors, PatchApiV1ProvidersByIdResponse, PatchApiV1ProvidersByIdResponses, PatchApiV1RolesByIdData, PatchApiV1RolesByIdError, PatchApiV1RolesByIdErrors, PatchApiV1RolesByIdPermissionsData, PatchApiV1RolesByIdPermissionsError, PatchApiV1RolesByIdPermissionsErrors, PatchApiV1RolesByIdPermissionsResponse, PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdResponse, PatchApiV1RolesByIdResponses, PatchApiV1TasksByIdData, PatchApiV1TasksByIdError, PatchApiV1TasksByIdErrors, PatchApiV1TasksByIdResponse, PatchApiV1TasksByIdResponses, PatchApiV1TasksByIdStatusData, PatchApiV1TasksByIdStatusError, PatchApiV1TasksByIdStatusErrors, PatchApiV1TasksByIdStatusResponse, PatchApiV1TasksByIdStatusResponses, PatchApiV1TopicsByIdData, PatchApiV1TopicsByIdError, PatchApiV1TopicsByIdErrors, PatchApiV1TopicsByIdResponse, PatchApiV1TopicsByIdResponses, PatchApiV1UsersByIdData, PatchApiV1UsersByIdError, PatchApiV1UsersByIdErrors, PatchApiV1UsersByIdResponse, PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdRolesData, PatchApiV1UsersByIdRolesError, PatchApiV1UsersByIdRolesErrors, PatchApiV1UsersByIdRolesResponse, PatchApiV1UsersByIdRolesResponses, Permission, PostApiV1AgentGroupsData, PostApiV1AgentGroupsError, PostApiV1AgentGroupsErrors, PostApiV1AgentGroupsResponse, PostApiV1AgentGroupsResponses, PostApiV1AgentsByIdAccountsData, PostApiV1AgentsByIdAccountsError, PostApiV1AgentsByIdAccountsErrors, PostApiV1AgentsByIdAccountsResponse, PostApiV1AgentsByIdAccountsResponses, PostApiV1AgentsByIdDuplicateData, PostApiV1AgentsByIdDuplicateError, PostApiV1AgentsByIdDuplicateErrors, PostApiV1AgentsByIdDuplicateResponse, PostApiV1AgentsByIdDuplicateResponses, PostApiV1AgentsData, PostApiV1AgentsError, PostApiV1AgentsErrors, PostApiV1AgentsResponse, PostApiV1AgentsResponses, PostApiV1ApiKeysData, PostApiV1ApiKeysError, PostApiV1ApiKeysErrors, PostApiV1ApiKeysResponse, PostApiV1ApiKeysResponses, PostApiV1ChatData, PostApiV1ChatError, PostApiV1ChatErrors, PostApiV1ChatGenerateReplyData, PostApiV1ChatGenerateReplyError, PostApiV1ChatGenerateReplyErrors, PostApiV1ChatGenerateReplyResponse, PostApiV1ChatGenerateReplyResponses, PostApiV1ChatGroupsByIdMembersData, PostApiV1ChatGroupsByIdMembersError, PostApiV1ChatGroupsByIdMembersErrors, PostApiV1ChatGroupsByIdMembersResponse, PostApiV1ChatGroupsByIdMembersResponses, PostApiV1ChatGroupsData, PostApiV1ChatGroupsError, PostApiV1ChatGroupsErrors, PostApiV1ChatGroupsResponse, PostApiV1ChatGroupsResponses, PostApiV1ChatResponse, PostApiV1ChatResponses, PostApiV1ChatTranslateData, PostApiV1ChatTranslateError, PostApiV1ChatTranslateErrors, PostApiV1ChatTranslateResponse, PostApiV1ChatTranslateResponses, PostApiV1EvalBenchmarksData, PostApiV1EvalBenchmarksError, PostApiV1EvalBenchmarksErrors, PostApiV1EvalBenchmarksResponse, PostApiV1EvalBenchmarksResponses, PostApiV1EvalDatasetsByDatasetIdTestCasesData, PostApiV1EvalDatasetsByDatasetIdTestCasesError, PostApiV1EvalDatasetsByDatasetIdTestCasesErrors, PostApiV1EvalDatasetsByDatasetIdTestCasesResponse, PostApiV1EvalDatasetsByDatasetIdTestCasesResponses, PostApiV1EvalDatasetsData, PostApiV1EvalDatasetsError, PostApiV1EvalDatasetsErrors, PostApiV1EvalDatasetsResponse, PostApiV1EvalDatasetsResponses, PostApiV1EvalRunsByIdClaimData, PostApiV1EvalRunsByIdClaimError, PostApiV1EvalRunsByIdClaimErrors, PostApiV1EvalRunsByIdClaimResponse, PostApiV1EvalRunsByIdClaimResponses, PostApiV1EvalRunsByIdResultsData, PostApiV1EvalRunsByIdResultsError, PostApiV1EvalRunsByIdResultsErrors, PostApiV1EvalRunsByIdResultsResponse, PostApiV1EvalRunsByIdResultsResponses, PostApiV1EvalRunsByIdRetryErrorsData, PostApiV1EvalRunsByIdRetryErrorsError, PostApiV1EvalRunsByIdRetryErrorsErrors, PostApiV1EvalRunsByIdRetryErrorsResponse, PostApiV1EvalRunsByIdRetryErrorsResponses, PostApiV1EvalRunsData, PostApiV1EvalRunsError, PostApiV1EvalRunsErrors, PostApiV1EvalRunsResponse, PostApiV1EvalRunsResponses, PostApiV1FilesBatchesData, PostApiV1FilesBatchesError, PostApiV1FilesBatchesErrors, PostApiV1FilesBatchesResponse, PostApiV1FilesBatchesResponses, PostApiV1FilesByIdChunksData, PostApiV1FilesByIdChunksError, PostApiV1FilesByIdChunksErrors, PostApiV1FilesByIdChunksResponse, PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdParsesData, PostApiV1FilesByIdParsesError, PostApiV1FilesByIdParsesErrors, PostApiV1FilesByIdParsesResponse, PostApiV1FilesByIdParsesResponses, PostApiV1FilesData, PostApiV1FilesError, PostApiV1FilesErrors, PostApiV1FilesQueriesData, PostApiV1FilesQueriesError, PostApiV1FilesQueriesErrors, PostApiV1FilesQueriesResponse, PostApiV1FilesQueriesResponses, PostApiV1FilesResponse, PostApiV1FilesResponses, PostApiV1GoalsByIdAdvanceData, PostApiV1GoalsByIdAdvanceError, PostApiV1GoalsByIdAdvanceErrors, PostApiV1GoalsByIdAdvanceResponse, PostApiV1GoalsByIdAdvanceResponses, PostApiV1GoalsByIdPauseData, PostApiV1GoalsByIdPauseError, PostApiV1GoalsByIdPauseErrors, PostApiV1GoalsByIdPauseResponse, PostApiV1GoalsByIdPauseResponses, PostApiV1GoalsByIdRestartData, PostApiV1GoalsByIdRestartError, PostApiV1GoalsByIdRestartErrors, PostApiV1GoalsByIdRestartResponse, PostApiV1GoalsByIdRestartResponses, PostApiV1GoalsByIdResumeData, PostApiV1GoalsByIdResumeError, PostApiV1GoalsByIdResumeErrors, PostApiV1GoalsByIdResumeResponse, PostApiV1GoalsByIdResumeResponses, PostApiV1GoalsData, PostApiV1GoalsError, PostApiV1GoalsErrors, PostApiV1GoalsResponse, PostApiV1GoalsResponses, PostApiV1ImMessagesData, PostApiV1ImMessagesError, PostApiV1ImMessagesErrors, PostApiV1ImMessagesResponse, PostApiV1ImMessagesResponses, PostApiV1ImTopicsByTopicIdReadData, PostApiV1ImTopicsByTopicIdReadError, PostApiV1ImTopicsByTopicIdReadErrors, PostApiV1ImTopicsByTopicIdReadResponse, PostApiV1ImTopicsByTopicIdReadResponses, PostApiV1KnowledgeBasesByIdFilesBatchData, PostApiV1KnowledgeBasesByIdFilesBatchError, PostApiV1KnowledgeBasesByIdFilesBatchErrors, PostApiV1KnowledgeBasesByIdFilesBatchResponse, PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesMoveData, PostApiV1KnowledgeBasesByIdFilesMoveError, PostApiV1KnowledgeBasesByIdFilesMoveErrors, PostApiV1KnowledgeBasesByIdFilesMoveResponse, PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesData, PostApiV1KnowledgeBasesError, PostApiV1KnowledgeBasesErrors, PostApiV1KnowledgeBasesResponse, PostApiV1KnowledgeBasesResponses, PostApiV1McpServersByIdSyncData, PostApiV1McpServersByIdSyncError, PostApiV1McpServersByIdSyncErrors, PostApiV1McpServersByIdSyncResponse, PostApiV1McpServersByIdSyncResponses, PostApiV1McpServersData, PostApiV1McpServersError, PostApiV1McpServersErrors, PostApiV1McpServersResponse, PostApiV1McpServersResponses, PostApiV1MessagesData, PostApiV1MessagesError, PostApiV1MessagesErrors, PostApiV1MessagesRepliesData, PostApiV1MessagesRepliesError, PostApiV1MessagesRepliesErrors, PostApiV1MessagesRepliesResponse, PostApiV1MessagesRepliesResponses, PostApiV1MessagesResponse, PostApiV1MessagesResponses, PostApiV1MessageTranslationsByMessageIdData, PostApiV1MessageTranslationsByMessageIdError, PostApiV1MessageTranslationsByMessageIdErrors, PostApiV1MessageTranslationsByMessageIdResponse, PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1ModelsData, PostApiV1ModelsError, PostApiV1ModelsErrors, PostApiV1ModelsResponse, PostApiV1ModelsResponses, PostApiV1NotificationsArchiveAllData, PostApiV1NotificationsArchiveAllError, PostApiV1NotificationsArchiveAllErrors, PostApiV1NotificationsArchiveAllResponse, PostApiV1NotificationsArchiveAllResponses, PostApiV1NotificationsByIdArchiveData, PostApiV1NotificationsByIdArchiveError, PostApiV1NotificationsByIdArchiveErrors, PostApiV1NotificationsByIdArchiveResponse, PostApiV1NotificationsByIdArchiveResponses, PostApiV1NotificationsReadAllData, PostApiV1NotificationsReadAllError, PostApiV1NotificationsReadAllErrors, PostApiV1NotificationsReadAllResponse, PostApiV1NotificationsReadAllResponses, PostApiV1NotificationsReadData, PostApiV1NotificationsReadError, PostApiV1NotificationsReadErrors, PostApiV1NotificationsReadResponse, PostApiV1NotificationsReadResponses, PostApiV1PermissionsData, PostApiV1PermissionsError, PostApiV1PermissionsErrors, PostApiV1PermissionsResponse, PostApiV1PermissionsResponses, PostApiV1ProvidersData, PostApiV1ProvidersError, PostApiV1ProvidersErrors, PostApiV1ProvidersResponse, PostApiV1ProvidersResponses, PostApiV1ResponsesData, PostApiV1ResponsesError, PostApiV1ResponsesErrors, PostApiV1ResponsesResponse, PostApiV1ResponsesResponses, PostApiV1RolesData, PostApiV1RolesError, PostApiV1RolesErrors, PostApiV1RolesResponse, PostApiV1RolesResponses, PostApiV1SignalsSourceEventsData, PostApiV1SignalsSourceEventsError, PostApiV1SignalsSourceEventsErrors, PostApiV1SignalsSourceEventsResponse, PostApiV1SignalsSourceEventsResponses, PostApiV1SignalsTriggerData, PostApiV1SignalsTriggerError, PostApiV1SignalsTriggerErrors, PostApiV1SignalsTriggerResponse, PostApiV1SignalsTriggerResponses, PostApiV1TasksByIdRunsData, PostApiV1TasksByIdRunsError, PostApiV1TasksByIdRunsErrors, PostApiV1TasksByIdRunsResponse, PostApiV1TasksByIdRunsResponses, PostApiV1TasksData, PostApiV1TasksError, PostApiV1TasksErrors, PostApiV1TasksResponse, PostApiV1TasksResponses, PostApiV1TopicsData, PostApiV1TopicsError, PostApiV1TopicsErrors, PostApiV1TopicsResponse, PostApiV1TopicsResponses, PostApiV1UsersData, PostApiV1UsersError, PostApiV1UsersErrors, PostApiV1UsersResponse, PostApiV1UsersResponses, Provider, PutApiV1AgentsByIdAccountsByAccountIdCredentialData, PutApiV1AgentsByIdAccountsByAccountIdCredentialError, PutApiV1AgentsByIdAccountsByAccountIdCredentialErrors, PutApiV1AgentsByIdAccountsByAccountIdCredentialResponse, PutApiV1AgentsByIdAccountsByAccountIdCredentialResponses, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultData, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultError, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultErrors, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultResponse, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultResponses, PutApiV1PushTokensByDeviceIdData, PutApiV1PushTokensByDeviceIdError, PutApiV1PushTokensByDeviceIdErrors, PutApiV1PushTokensByDeviceIdResponse, PutApiV1PushTokensByDeviceIdResponses, Role, Topic, Usage, User } from './types.gen';
+export { AgentGroups, Agents, ApiKeys, Audio, Chat, ChatGroups, Eval, Files, Goals, Health, Im, KnowledgeBases, LobeHub, McpServers, Memories, Messages, MessageTranslations, Models, Notifications, type Options, Permissions, Plugins, Providers, PushTokens, Responses, Roles, Signals, Tasks, Topics, Usage as Usage2, Users } from './sdk.gen';
+export type { Agent, AgentAccount, AgentAccountCapabilities, AgentAccountList, AgentDetail, AgentFile, AgentGroup, AgentKnowledgeBase, AgentList, AgentPlugin, AgentSignalEmission, AgentSignalReceipt, AgentSignalReceiptList, ApiError, ApiKey, AsyncTaskError, BatchFileUploadResult, BatchGetFilesResult, ChatGenerateReplyResponse, ChatGroup, ChatGroupList, ChatGroupMember, ChatResponse, ChatTranslateResponse, ClientOptions, CreatedAgentGroup, CreatedApiKey, DeleteApiV1AgentGroupsByIdData, DeleteApiV1AgentGroupsByIdError, DeleteApiV1AgentGroupsByIdErrors, DeleteApiV1AgentGroupsByIdResponse, DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentsByIdAccountsByAccountIdData, DeleteApiV1AgentsByIdAccountsByAccountIdError, DeleteApiV1AgentsByIdAccountsByAccountIdErrors, DeleteApiV1AgentsByIdAccountsByAccountIdResponse, DeleteApiV1AgentsByIdAccountsByAccountIdResponses, DeleteApiV1AgentsByIdData, DeleteApiV1AgentsByIdError, DeleteApiV1AgentsByIdErrors, DeleteApiV1AgentsByIdResponse, DeleteApiV1AgentsByIdResponses, DeleteApiV1ApiKeysByIdData, DeleteApiV1ApiKeysByIdError, DeleteApiV1ApiKeysByIdErrors, DeleteApiV1ApiKeysByIdResponse, DeleteApiV1ApiKeysByIdResponses, DeleteApiV1ChatGroupsByIdData, DeleteApiV1ChatGroupsByIdError, DeleteApiV1ChatGroupsByIdErrors, DeleteApiV1ChatGroupsByIdMembersData, DeleteApiV1ChatGroupsByIdMembersError, DeleteApiV1ChatGroupsByIdMembersErrors, DeleteApiV1ChatGroupsByIdMembersResponse, DeleteApiV1ChatGroupsByIdMembersResponses, DeleteApiV1ChatGroupsByIdResponse, DeleteApiV1ChatGroupsByIdResponses, DeleteApiV1EvalBenchmarksByIdData, DeleteApiV1EvalBenchmarksByIdError, DeleteApiV1EvalBenchmarksByIdErrors, DeleteApiV1EvalBenchmarksByIdResponse, DeleteApiV1EvalBenchmarksByIdResponses, DeleteApiV1EvalDatasetsByIdData, DeleteApiV1EvalDatasetsByIdError, DeleteApiV1EvalDatasetsByIdErrors, DeleteApiV1EvalDatasetsByIdResponse, DeleteApiV1EvalDatasetsByIdResponses, DeleteApiV1EvalTestCasesByIdData, DeleteApiV1EvalTestCasesByIdError, DeleteApiV1EvalTestCasesByIdErrors, DeleteApiV1EvalTestCasesByIdResponse, DeleteApiV1EvalTestCasesByIdResponses, DeleteApiV1FilesByIdData, DeleteApiV1FilesByIdError, DeleteApiV1FilesByIdErrors, DeleteApiV1FilesByIdResponse, DeleteApiV1FilesByIdResponses, DeleteApiV1GoalsByIdData, DeleteApiV1GoalsByIdError, DeleteApiV1GoalsByIdErrors, DeleteApiV1GoalsByIdResponse, DeleteApiV1GoalsByIdResponses, DeleteApiV1KnowledgeBasesByIdData, DeleteApiV1KnowledgeBasesByIdError, DeleteApiV1KnowledgeBasesByIdErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchData, DeleteApiV1KnowledgeBasesByIdFilesBatchError, DeleteApiV1KnowledgeBasesByIdFilesBatchErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchResponse, DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdResponse, DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1McpServersByIdData, DeleteApiV1McpServersByIdError, DeleteApiV1McpServersByIdErrors, DeleteApiV1McpServersByIdResponse, DeleteApiV1McpServersByIdResponses, DeleteApiV1MemoriesByCategoryByIdData, DeleteApiV1MemoriesByCategoryByIdError, DeleteApiV1MemoriesByCategoryByIdErrors, DeleteApiV1MemoriesByCategoryByIdResponse, DeleteApiV1MemoriesByCategoryByIdResponses, DeleteApiV1MemoriesData, DeleteApiV1MemoriesError, DeleteApiV1MemoriesErrors, DeleteApiV1MemoriesResponse, DeleteApiV1MemoriesResponses, DeleteApiV1MessagesByIdData, DeleteApiV1MessagesByIdError, DeleteApiV1MessagesByIdErrors, DeleteApiV1MessagesByIdResponse, DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesData, DeleteApiV1MessagesError, DeleteApiV1MessagesErrors, DeleteApiV1MessagesResponse, DeleteApiV1MessagesResponses, DeleteApiV1MessageTranslationsByMessageIdData, DeleteApiV1MessageTranslationsByMessageIdError, DeleteApiV1MessageTranslationsByMessageIdErrors, DeleteApiV1MessageTranslationsByMessageIdResponse, DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1PermissionsByIdData, DeleteApiV1PermissionsByIdError, DeleteApiV1PermissionsByIdErrors, DeleteApiV1PermissionsByIdResponse, DeleteApiV1PermissionsByIdResponses, DeleteApiV1ProvidersByIdData, DeleteApiV1ProvidersByIdError, DeleteApiV1ProvidersByIdErrors, DeleteApiV1ProvidersByIdResponse, DeleteApiV1ProvidersByIdResponses, DeleteApiV1PushTokensByDeviceIdData, DeleteApiV1PushTokensByDeviceIdError, DeleteApiV1PushTokensByDeviceIdErrors, DeleteApiV1PushTokensByDeviceIdResponse, DeleteApiV1PushTokensByDeviceIdResponses, DeleteApiV1RolesByIdData, DeleteApiV1RolesByIdError, DeleteApiV1RolesByIdErrors, DeleteApiV1RolesByIdPermissionsData, DeleteApiV1RolesByIdPermissionsError, DeleteApiV1RolesByIdPermissionsErrors, DeleteApiV1RolesByIdPermissionsResponse, DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdResponse, DeleteApiV1RolesByIdResponses, DeleteApiV1TasksByIdData, DeleteApiV1TasksByIdError, DeleteApiV1TasksByIdErrors, DeleteApiV1TasksByIdResponse, DeleteApiV1TasksByIdResponses, DeleteApiV1TopicsByIdData, DeleteApiV1TopicsByIdError, DeleteApiV1TopicsByIdErrors, DeleteApiV1TopicsByIdResponse, DeleteApiV1TopicsByIdResponses, DeleteApiV1UsersByIdData, DeleteApiV1UsersByIdError, DeleteApiV1UsersByIdErrors, DeleteApiV1UsersByIdResponse, DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdRolesData, DeleteApiV1UsersByIdRolesError, DeleteApiV1UsersByIdRolesErrors, DeleteApiV1UsersByIdRolesResponse, DeleteApiV1UsersByIdRolesResponses, DeletedResource, DeletedResources, EvalBatchReportResult, EvalBenchmark, EvalBenchmarkRubric, EvalCaseResult, EvalDataset, EvalReportReceipt, EvalReportResult, EvalRetryErrors, EvalRubricScore, EvalRun, EvalRunMetrics, EvalRunResult, EvalRunTopic, EvalStoredResult, EvalTestCase, EvalThreadResult, File, FileAsyncTask, FileChunkStatus, FileChunkTask, FileDetail, FileKnowledgeBaseRef, FileList, FileListItem, FileParseResult, FileUrl, FileUser, GetApiV1AgentGroupsByIdData, GetApiV1AgentGroupsByIdError, GetApiV1AgentGroupsByIdErrors, GetApiV1AgentGroupsByIdResponse, GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsData, GetApiV1AgentGroupsError, GetApiV1AgentGroupsErrors, GetApiV1AgentGroupsResponse, GetApiV1AgentGroupsResponses, GetApiV1AgentsByIdAccountsByAccountIdData, GetApiV1AgentsByIdAccountsByAccountIdError, GetApiV1AgentsByIdAccountsByAccountIdErrors, GetApiV1AgentsByIdAccountsByAccountIdResponse, GetApiV1AgentsByIdAccountsByAccountIdResponses, GetApiV1AgentsByIdAccountsData, GetApiV1AgentsByIdAccountsError, GetApiV1AgentsByIdAccountsErrors, GetApiV1AgentsByIdAccountsResponse, GetApiV1AgentsByIdAccountsResponses, GetApiV1AgentsByIdData, GetApiV1AgentsByIdError, GetApiV1AgentsByIdErrors, GetApiV1AgentsByIdResponse, GetApiV1AgentsByIdResponses, GetApiV1AgentsData, GetApiV1AgentsError, GetApiV1AgentsErrors, GetApiV1AgentsResponse, GetApiV1AgentsResponses, GetApiV1ApiKeysByIdData, GetApiV1ApiKeysByIdError, GetApiV1ApiKeysByIdErrors, GetApiV1ApiKeysByIdResponse, GetApiV1ApiKeysByIdResponses, GetApiV1ApiKeysData, GetApiV1ApiKeysError, GetApiV1ApiKeysErrors, GetApiV1ApiKeysResponse, GetApiV1ApiKeysResponses, GetApiV1ChatGroupsByIdData, GetApiV1ChatGroupsByIdError, GetApiV1ChatGroupsByIdErrors, GetApiV1ChatGroupsByIdResponse, GetApiV1ChatGroupsByIdResponses, GetApiV1ChatGroupsData, GetApiV1ChatGroupsError, GetApiV1ChatGroupsErrors, GetApiV1ChatGroupsResponse, GetApiV1ChatGroupsResponses, GetApiV1EvalBenchmarksByIdData, GetApiV1EvalBenchmarksByIdError, GetApiV1EvalBenchmarksByIdErrors, GetApiV1EvalBenchmarksByIdResponse, GetApiV1EvalBenchmarksByIdResponses, GetApiV1EvalBenchmarksData, GetApiV1EvalBenchmarksError, GetApiV1EvalBenchmarksErrors, GetApiV1EvalBenchmarksResponse, GetApiV1EvalBenchmarksResponses, GetApiV1EvalDatasetsByDatasetIdTestCasesData, GetApiV1EvalDatasetsByDatasetIdTestCasesError, GetApiV1EvalDatasetsByDatasetIdTestCasesErrors, GetApiV1EvalDatasetsByDatasetIdTestCasesResponse, GetApiV1EvalDatasetsByDatasetIdTestCasesResponses, GetApiV1EvalDatasetsByIdData, GetApiV1EvalDatasetsByIdError, GetApiV1EvalDatasetsByIdErrors, GetApiV1EvalDatasetsByIdResponse, GetApiV1EvalDatasetsByIdResponses, GetApiV1EvalDatasetsData, GetApiV1EvalDatasetsError, GetApiV1EvalDatasetsErrors, GetApiV1EvalDatasetsResponse, GetApiV1EvalDatasetsResponses, GetApiV1EvalRunsByIdData, GetApiV1EvalRunsByIdError, GetApiV1EvalRunsByIdErrors, GetApiV1EvalRunsByIdResponse, GetApiV1EvalRunsByIdResponses, GetApiV1EvalRunsByIdResultsData, GetApiV1EvalRunsByIdResultsError, GetApiV1EvalRunsByIdResultsErrors, GetApiV1EvalRunsByIdResultsResponse, GetApiV1EvalRunsByIdResultsResponses, GetApiV1EvalRunsByIdTopicsData, GetApiV1EvalRunsByIdTopicsError, GetApiV1EvalRunsByIdTopicsErrors, GetApiV1EvalRunsByIdTopicsResponse, GetApiV1EvalRunsByIdTopicsResponses, GetApiV1EvalRunsData, GetApiV1EvalRunsError, GetApiV1EvalRunsErrors, GetApiV1EvalRunsResponse, GetApiV1EvalRunsResponses, GetApiV1EvalTestCasesByIdData, GetApiV1EvalTestCasesByIdError, GetApiV1EvalTestCasesByIdErrors, GetApiV1EvalTestCasesByIdResponse, GetApiV1EvalTestCasesByIdResponses, GetApiV1FilesByIdChunksData, GetApiV1FilesByIdChunksError, GetApiV1FilesByIdChunksErrors, GetApiV1FilesByIdChunksResponse, GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdData, GetApiV1FilesByIdError, GetApiV1FilesByIdErrors, GetApiV1FilesByIdResponse, GetApiV1FilesByIdResponses, GetApiV1FilesByIdUrlData, GetApiV1FilesByIdUrlError, GetApiV1FilesByIdUrlErrors, GetApiV1FilesByIdUrlResponse, GetApiV1FilesByIdUrlResponses, GetApiV1FilesData, GetApiV1FilesError, GetApiV1FilesErrors, GetApiV1FilesResponse, GetApiV1FilesResponses, GetApiV1GoalsByIdData, GetApiV1GoalsByIdError, GetApiV1GoalsByIdErrors, GetApiV1GoalsByIdResponse, GetApiV1GoalsByIdResponses, GetApiV1GoalsByIdSupervisionData, GetApiV1GoalsByIdSupervisionError, GetApiV1GoalsByIdSupervisionErrors, GetApiV1GoalsByIdSupervisionResponse, GetApiV1GoalsByIdSupervisionResponses, GetApiV1GoalsData, GetApiV1GoalsError, GetApiV1GoalsErrors, GetApiV1GoalsResponse, GetApiV1GoalsResponses, GetApiV1HealthData, GetApiV1HealthResponse, GetApiV1HealthResponses, GetApiV1ImTopicsByTopicIdSyncData, GetApiV1ImTopicsByTopicIdSyncError, GetApiV1ImTopicsByTopicIdSyncErrors, GetApiV1ImTopicsByTopicIdSyncResponse, GetApiV1ImTopicsByTopicIdSyncResponses, GetApiV1KnowledgeBasesByIdData, GetApiV1KnowledgeBasesByIdError, GetApiV1KnowledgeBasesByIdErrors, GetApiV1KnowledgeBasesByIdFilesData, GetApiV1KnowledgeBasesByIdFilesError, GetApiV1KnowledgeBasesByIdFilesErrors, GetApiV1KnowledgeBasesByIdFilesResponse, GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdResponse, GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesData, GetApiV1KnowledgeBasesError, GetApiV1KnowledgeBasesErrors, GetApiV1KnowledgeBasesResponse, GetApiV1KnowledgeBasesResponses, GetApiV1McpServersByIdData, GetApiV1McpServersByIdError, GetApiV1McpServersByIdErrors, GetApiV1McpServersByIdResponse, GetApiV1McpServersByIdResponses, GetApiV1McpServersData, GetApiV1McpServersError, GetApiV1McpServersErrors, GetApiV1McpServersResponse, GetApiV1McpServersResponses, GetApiV1MemoriesByCategoryData, GetApiV1MemoriesByCategoryError, GetApiV1MemoriesByCategoryErrors, GetApiV1MemoriesByCategoryResponse, GetApiV1MemoriesByCategoryResponses, GetApiV1MemoriesPersonaData, GetApiV1MemoriesPersonaError, GetApiV1MemoriesPersonaErrors, GetApiV1MemoriesPersonaResponse, GetApiV1MemoriesPersonaResponses, GetApiV1MemoriesPersonaVersionsData, GetApiV1MemoriesPersonaVersionsError, GetApiV1MemoriesPersonaVersionsErrors, GetApiV1MemoriesPersonaVersionsResponse, GetApiV1MemoriesPersonaVersionsResponses, GetApiV1MessagesByIdData, GetApiV1MessagesByIdError, GetApiV1MessagesByIdErrors, GetApiV1MessagesByIdResponse, GetApiV1MessagesByIdResponses, GetApiV1MessagesCountData, GetApiV1MessagesCountError, GetApiV1MessagesCountErrors, GetApiV1MessagesCountResponse, GetApiV1MessagesCountResponses, GetApiV1MessagesData, GetApiV1MessagesError, GetApiV1MessagesErrors, GetApiV1MessagesResponse, GetApiV1MessagesResponses, GetApiV1MessageTranslationsByMessageIdData, GetApiV1MessageTranslationsByMessageIdError, GetApiV1MessageTranslationsByMessageIdErrors, GetApiV1MessageTranslationsByMessageIdResponse, GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1ModelsByProviderIdByModelIdData, GetApiV1ModelsByProviderIdByModelIdError, GetApiV1ModelsByProviderIdByModelIdErrors, GetApiV1ModelsByProviderIdByModelIdResponse, GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsData, GetApiV1ModelsError, GetApiV1ModelsErrors, GetApiV1ModelsResponse, GetApiV1ModelsResponses, GetApiV1NotificationsCountsData, GetApiV1NotificationsCountsError, GetApiV1NotificationsCountsErrors, GetApiV1NotificationsCountsResponse, GetApiV1NotificationsCountsResponses, GetApiV1NotificationsData, GetApiV1NotificationsError, GetApiV1NotificationsErrors, GetApiV1NotificationsResponse, GetApiV1NotificationsResponses, GetApiV1NotificationsSettingsData, GetApiV1NotificationsSettingsError, GetApiV1NotificationsSettingsErrors, GetApiV1NotificationsSettingsResponse, GetApiV1NotificationsSettingsResponses, GetApiV1NotificationsUnreadCountData, GetApiV1NotificationsUnreadCountError, GetApiV1NotificationsUnreadCountErrors, GetApiV1NotificationsUnreadCountResponse, GetApiV1NotificationsUnreadCountResponses, GetApiV1PermissionsByIdData, GetApiV1PermissionsByIdError, GetApiV1PermissionsByIdErrors, GetApiV1PermissionsByIdResponse, GetApiV1PermissionsByIdResponses, GetApiV1PermissionsData, GetApiV1PermissionsError, GetApiV1PermissionsErrors, GetApiV1PermissionsResponse, GetApiV1PermissionsResponses, GetApiV1PluginsData, GetApiV1PluginsError, GetApiV1PluginsErrors, GetApiV1PluginsResponse, GetApiV1PluginsResponses, GetApiV1ProvidersByIdData, GetApiV1ProvidersByIdError, GetApiV1ProvidersByIdErrors, GetApiV1ProvidersByIdResponse, GetApiV1ProvidersByIdResponses, GetApiV1ProvidersData, GetApiV1ProvidersError, GetApiV1ProvidersErrors, GetApiV1ProvidersResponse, GetApiV1ProvidersResponses, GetApiV1RolesByIdData, GetApiV1RolesByIdError, GetApiV1RolesByIdErrors, GetApiV1RolesByIdPermissionsData, GetApiV1RolesByIdPermissionsError, GetApiV1RolesByIdPermissionsErrors, GetApiV1RolesByIdPermissionsResponse, GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdResponse, GetApiV1RolesByIdResponses, GetApiV1RolesData, GetApiV1RolesError, GetApiV1RolesErrors, GetApiV1RolesResponse, GetApiV1RolesResponses, GetApiV1SignalsReceiptsData, GetApiV1SignalsReceiptsError, GetApiV1SignalsReceiptsErrors, GetApiV1SignalsReceiptsResponse, GetApiV1SignalsReceiptsResponses, GetApiV1TasksByIdData, GetApiV1TasksByIdError, GetApiV1TasksByIdErrors, GetApiV1TasksByIdResponse, GetApiV1TasksByIdResponses, GetApiV1TasksByIdRunsData, GetApiV1TasksByIdRunsError, GetApiV1TasksByIdRunsErrors, GetApiV1TasksByIdRunsResponse, GetApiV1TasksByIdRunsResponses, GetApiV1TasksData, GetApiV1TasksError, GetApiV1TasksErrors, GetApiV1TasksResponse, GetApiV1TasksResponses, GetApiV1TopicsByIdData, GetApiV1TopicsByIdError, GetApiV1TopicsByIdErrors, GetApiV1TopicsByIdResponse, GetApiV1TopicsByIdResponses, GetApiV1TopicsByTopicIdThreadsData, GetApiV1TopicsByTopicIdThreadsError, GetApiV1TopicsByTopicIdThreadsErrors, GetApiV1TopicsByTopicIdThreadsResponse, GetApiV1TopicsByTopicIdThreadsResponses, GetApiV1TopicsData, GetApiV1TopicsError, GetApiV1TopicsErrors, GetApiV1TopicsResponse, GetApiV1TopicsResponses, GetApiV1UsageData, GetApiV1UsageError, GetApiV1UsageErrors, GetApiV1UsageResponse, GetApiV1UsageResponses, GetApiV1UsersByIdData, GetApiV1UsersByIdError, GetApiV1UsersByIdErrors, GetApiV1UsersByIdResponse, GetApiV1UsersByIdResponses, GetApiV1UsersByIdRolesData, GetApiV1UsersByIdRolesError, GetApiV1UsersByIdRolesErrors, GetApiV1UsersByIdRolesResponse, GetApiV1UsersByIdRolesResponses, GetApiV1UsersData, GetApiV1UsersError, GetApiV1UsersErrors, GetApiV1UsersMeData, GetApiV1UsersMeError, GetApiV1UsersMeErrors, GetApiV1UsersMeResponse, GetApiV1UsersMeResponses, GetApiV1UsersResponse, GetApiV1UsersResponses, Goal, GoalAdvanceResult, GoalDecisionOption, GoalGraph, GoalGraphDecision, GoalGraphEdge, GoalGraphEvent, GoalGraphNode, GoalGraphSnapshot, GoalGraphWorkVersionLink, GoalList, GoalListItem, GoalRestartResult, GoalSupervision, ImMessage, ImReadResult, ImSendResult, ImSyncResult, InstalledPlugin, InstalledPluginList, KnowledgeBase, KnowledgeBaseDetail, KnowledgeBaseFileOperationResult, KnowledgeBaseList, KnowledgeBaseListItem, McpServer, McpServerSyncResult, McpServerTool, MemoryActivity, MemoryCategoryEntries, MemoryContext, MemoryExperience, MemoryIdentity, MemoryPersona, MemoryPersonaVersion, MemoryPreference, Message, MessageTranslation, MessageTranslationWrite, Model, Notification, NotificationCategoryCount, NotificationSettings, NotificationUnreadCount, PatchApiV1AgentGroupsByIdData, PatchApiV1AgentGroupsByIdError, PatchApiV1AgentGroupsByIdErrors, PatchApiV1AgentGroupsByIdResponse, PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentsByIdAccountsByAccountIdData, PatchApiV1AgentsByIdAccountsByAccountIdError, PatchApiV1AgentsByIdAccountsByAccountIdErrors, PatchApiV1AgentsByIdAccountsByAccountIdResponse, PatchApiV1AgentsByIdAccountsByAccountIdResponses, PatchApiV1AgentsByIdData, PatchApiV1AgentsByIdError, PatchApiV1AgentsByIdErrors, PatchApiV1AgentsByIdResponse, PatchApiV1AgentsByIdResponses, PatchApiV1ApiKeysByIdData, PatchApiV1ApiKeysByIdError, PatchApiV1ApiKeysByIdErrors, PatchApiV1ApiKeysByIdResponse, PatchApiV1ApiKeysByIdResponses, PatchApiV1ChatGroupsByIdData, PatchApiV1ChatGroupsByIdError, PatchApiV1ChatGroupsByIdErrors, PatchApiV1ChatGroupsByIdResponse, PatchApiV1ChatGroupsByIdResponses, PatchApiV1EvalBenchmarksByIdData, PatchApiV1EvalBenchmarksByIdError, PatchApiV1EvalBenchmarksByIdErrors, PatchApiV1EvalBenchmarksByIdResponse, PatchApiV1EvalBenchmarksByIdResponses, PatchApiV1EvalDatasetsByIdData, PatchApiV1EvalDatasetsByIdError, PatchApiV1EvalDatasetsByIdErrors, PatchApiV1EvalDatasetsByIdResponse, PatchApiV1EvalDatasetsByIdResponses, PatchApiV1EvalRunsByIdStatusData, PatchApiV1EvalRunsByIdStatusError, PatchApiV1EvalRunsByIdStatusErrors, PatchApiV1EvalRunsByIdStatusResponse, PatchApiV1EvalRunsByIdStatusResponses, PatchApiV1EvalTestCasesByIdData, PatchApiV1EvalTestCasesByIdError, PatchApiV1EvalTestCasesByIdErrors, PatchApiV1EvalTestCasesByIdResponse, PatchApiV1EvalTestCasesByIdResponses, PatchApiV1FilesByIdData, PatchApiV1FilesByIdError, PatchApiV1FilesByIdErrors, PatchApiV1FilesByIdResponse, PatchApiV1FilesByIdResponses, PatchApiV1GoalsByIdData, PatchApiV1GoalsByIdError, PatchApiV1GoalsByIdErrors, PatchApiV1GoalsByIdResponse, PatchApiV1GoalsByIdResponses, PatchApiV1KnowledgeBasesByIdData, PatchApiV1KnowledgeBasesByIdError, PatchApiV1KnowledgeBasesByIdErrors, PatchApiV1KnowledgeBasesByIdResponse, PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1McpServersByIdData, PatchApiV1McpServersByIdError, PatchApiV1McpServersByIdErrors, PatchApiV1McpServersByIdResponse, PatchApiV1McpServersByIdResponses, PatchApiV1MessageTranslationsByMessageIdData, PatchApiV1MessageTranslationsByMessageIdError, PatchApiV1MessageTranslationsByMessageIdErrors, PatchApiV1MessageTranslationsByMessageIdResponse, PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1ModelsByProviderIdByModelIdData, PatchApiV1ModelsByProviderIdByModelIdError, PatchApiV1ModelsByProviderIdByModelIdErrors, PatchApiV1ModelsByProviderIdByModelIdResponse, PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1NotificationsSettingsData, PatchApiV1NotificationsSettingsError, PatchApiV1NotificationsSettingsErrors, PatchApiV1NotificationsSettingsResponse, PatchApiV1NotificationsSettingsResponses, PatchApiV1PermissionsByIdData, PatchApiV1PermissionsByIdError, PatchApiV1PermissionsByIdErrors, PatchApiV1PermissionsByIdResponse, PatchApiV1PermissionsByIdResponses, PatchApiV1ProvidersByIdData, PatchApiV1ProvidersByIdError, PatchApiV1ProvidersByIdErrors, PatchApiV1ProvidersByIdResponse, PatchApiV1ProvidersByIdResponses, PatchApiV1RolesByIdData, PatchApiV1RolesByIdError, PatchApiV1RolesByIdErrors, PatchApiV1RolesByIdPermissionsData, PatchApiV1RolesByIdPermissionsError, PatchApiV1RolesByIdPermissionsErrors, PatchApiV1RolesByIdPermissionsResponse, PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdResponse, PatchApiV1RolesByIdResponses, PatchApiV1TasksByIdData, PatchApiV1TasksByIdError, PatchApiV1TasksByIdErrors, PatchApiV1TasksByIdResponse, PatchApiV1TasksByIdResponses, PatchApiV1TasksByIdStatusData, PatchApiV1TasksByIdStatusError, PatchApiV1TasksByIdStatusErrors, PatchApiV1TasksByIdStatusResponse, PatchApiV1TasksByIdStatusResponses, PatchApiV1TopicsByIdData, PatchApiV1TopicsByIdError, PatchApiV1TopicsByIdErrors, PatchApiV1TopicsByIdResponse, PatchApiV1TopicsByIdResponses, PatchApiV1UsersByIdData, PatchApiV1UsersByIdError, PatchApiV1UsersByIdErrors, PatchApiV1UsersByIdResponse, PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdRolesData, PatchApiV1UsersByIdRolesError, PatchApiV1UsersByIdRolesErrors, PatchApiV1UsersByIdRolesResponse, PatchApiV1UsersByIdRolesResponses, Permission, PermissionList, PostApiV1AgentGroupsData, PostApiV1AgentGroupsError, PostApiV1AgentGroupsErrors, PostApiV1AgentGroupsResponse, PostApiV1AgentGroupsResponses, PostApiV1AgentsByIdAccountsData, PostApiV1AgentsByIdAccountsError, PostApiV1AgentsByIdAccountsErrors, PostApiV1AgentsByIdAccountsResponse, PostApiV1AgentsByIdAccountsResponses, PostApiV1AgentsByIdDuplicateData, PostApiV1AgentsByIdDuplicateError, PostApiV1AgentsByIdDuplicateErrors, PostApiV1AgentsByIdDuplicateResponse, PostApiV1AgentsByIdDuplicateResponses, PostApiV1AgentsData, PostApiV1AgentsError, PostApiV1AgentsErrors, PostApiV1AgentsResponse, PostApiV1AgentsResponses, PostApiV1ApiKeysData, PostApiV1ApiKeysError, PostApiV1ApiKeysErrors, PostApiV1ApiKeysResponse, PostApiV1ApiKeysResponses, PostApiV1AudioSpeechData, PostApiV1AudioSpeechError, PostApiV1AudioSpeechErrors, PostApiV1AudioSpeechResponse, PostApiV1AudioSpeechResponses, PostApiV1ChatData, PostApiV1ChatError, PostApiV1ChatErrors, PostApiV1ChatGenerateReplyData, PostApiV1ChatGenerateReplyError, PostApiV1ChatGenerateReplyErrors, PostApiV1ChatGenerateReplyResponse, PostApiV1ChatGenerateReplyResponses, PostApiV1ChatGroupsByIdMembersData, PostApiV1ChatGroupsByIdMembersError, PostApiV1ChatGroupsByIdMembersErrors, PostApiV1ChatGroupsByIdMembersResponse, PostApiV1ChatGroupsByIdMembersResponses, PostApiV1ChatGroupsData, PostApiV1ChatGroupsError, PostApiV1ChatGroupsErrors, PostApiV1ChatGroupsResponse, PostApiV1ChatGroupsResponses, PostApiV1ChatResponse, PostApiV1ChatResponses, PostApiV1ChatTranslateData, PostApiV1ChatTranslateError, PostApiV1ChatTranslateErrors, PostApiV1ChatTranslateResponse, PostApiV1ChatTranslateResponses, PostApiV1EvalBenchmarksData, PostApiV1EvalBenchmarksError, PostApiV1EvalBenchmarksErrors, PostApiV1EvalBenchmarksResponse, PostApiV1EvalBenchmarksResponses, PostApiV1EvalDatasetsByDatasetIdTestCasesData, PostApiV1EvalDatasetsByDatasetIdTestCasesError, PostApiV1EvalDatasetsByDatasetIdTestCasesErrors, PostApiV1EvalDatasetsByDatasetIdTestCasesResponse, PostApiV1EvalDatasetsByDatasetIdTestCasesResponses, PostApiV1EvalDatasetsData, PostApiV1EvalDatasetsError, PostApiV1EvalDatasetsErrors, PostApiV1EvalDatasetsResponse, PostApiV1EvalDatasetsResponses, PostApiV1EvalRunsByIdClaimData, PostApiV1EvalRunsByIdClaimError, PostApiV1EvalRunsByIdClaimErrors, PostApiV1EvalRunsByIdClaimResponse, PostApiV1EvalRunsByIdClaimResponses, PostApiV1EvalRunsByIdResultsData, PostApiV1EvalRunsByIdResultsError, PostApiV1EvalRunsByIdResultsErrors, PostApiV1EvalRunsByIdResultsResponse, PostApiV1EvalRunsByIdResultsResponses, PostApiV1EvalRunsByIdRetryErrorsData, PostApiV1EvalRunsByIdRetryErrorsError, PostApiV1EvalRunsByIdRetryErrorsErrors, PostApiV1EvalRunsByIdRetryErrorsResponse, PostApiV1EvalRunsByIdRetryErrorsResponses, PostApiV1EvalRunsData, PostApiV1EvalRunsError, PostApiV1EvalRunsErrors, PostApiV1EvalRunsResponse, PostApiV1EvalRunsResponses, PostApiV1FilesBatchesData, PostApiV1FilesBatchesError, PostApiV1FilesBatchesErrors, PostApiV1FilesBatchesResponse, PostApiV1FilesBatchesResponses, PostApiV1FilesByIdChunksData, PostApiV1FilesByIdChunksError, PostApiV1FilesByIdChunksErrors, PostApiV1FilesByIdChunksResponse, PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdParsesData, PostApiV1FilesByIdParsesError, PostApiV1FilesByIdParsesErrors, PostApiV1FilesByIdParsesResponse, PostApiV1FilesByIdParsesResponses, PostApiV1FilesData, PostApiV1FilesError, PostApiV1FilesErrors, PostApiV1FilesQueriesData, PostApiV1FilesQueriesError, PostApiV1FilesQueriesErrors, PostApiV1FilesQueriesResponse, PostApiV1FilesQueriesResponses, PostApiV1FilesResponse, PostApiV1FilesResponses, PostApiV1GoalsByIdAdvanceData, PostApiV1GoalsByIdAdvanceError, PostApiV1GoalsByIdAdvanceErrors, PostApiV1GoalsByIdAdvanceResponse, PostApiV1GoalsByIdAdvanceResponses, PostApiV1GoalsByIdPauseData, PostApiV1GoalsByIdPauseError, PostApiV1GoalsByIdPauseErrors, PostApiV1GoalsByIdPauseResponse, PostApiV1GoalsByIdPauseResponses, PostApiV1GoalsByIdRestartData, PostApiV1GoalsByIdRestartError, PostApiV1GoalsByIdRestartErrors, PostApiV1GoalsByIdRestartResponse, PostApiV1GoalsByIdRestartResponses, PostApiV1GoalsByIdResumeData, PostApiV1GoalsByIdResumeError, PostApiV1GoalsByIdResumeErrors, PostApiV1GoalsByIdResumeResponse, PostApiV1GoalsByIdResumeResponses, PostApiV1GoalsData, PostApiV1GoalsError, PostApiV1GoalsErrors, PostApiV1GoalsResponse, PostApiV1GoalsResponses, PostApiV1ImMessagesData, PostApiV1ImMessagesError, PostApiV1ImMessagesErrors, PostApiV1ImMessagesResponse, PostApiV1ImMessagesResponses, PostApiV1ImTopicsByTopicIdReadData, PostApiV1ImTopicsByTopicIdReadError, PostApiV1ImTopicsByTopicIdReadErrors, PostApiV1ImTopicsByTopicIdReadResponse, PostApiV1ImTopicsByTopicIdReadResponses, PostApiV1KnowledgeBasesByIdFilesBatchData, PostApiV1KnowledgeBasesByIdFilesBatchError, PostApiV1KnowledgeBasesByIdFilesBatchErrors, PostApiV1KnowledgeBasesByIdFilesBatchResponse, PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesMoveData, PostApiV1KnowledgeBasesByIdFilesMoveError, PostApiV1KnowledgeBasesByIdFilesMoveErrors, PostApiV1KnowledgeBasesByIdFilesMoveResponse, PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesData, PostApiV1KnowledgeBasesError, PostApiV1KnowledgeBasesErrors, PostApiV1KnowledgeBasesResponse, PostApiV1KnowledgeBasesResponses, PostApiV1McpServersByIdSyncData, PostApiV1McpServersByIdSyncError, PostApiV1McpServersByIdSyncErrors, PostApiV1McpServersByIdSyncResponse, PostApiV1McpServersByIdSyncResponses, PostApiV1McpServersData, PostApiV1McpServersError, PostApiV1McpServersErrors, PostApiV1McpServersResponse, PostApiV1McpServersResponses, PostApiV1MessagesData, PostApiV1MessagesError, PostApiV1MessagesErrors, PostApiV1MessagesRepliesData, PostApiV1MessagesRepliesError, PostApiV1MessagesRepliesErrors, PostApiV1MessagesRepliesResponse, PostApiV1MessagesRepliesResponses, PostApiV1MessagesResponse, PostApiV1MessagesResponses, PostApiV1MessageTranslationsByMessageIdData, PostApiV1MessageTranslationsByMessageIdError, PostApiV1MessageTranslationsByMessageIdErrors, PostApiV1MessageTranslationsByMessageIdResponse, PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1ModelsData, PostApiV1ModelsError, PostApiV1ModelsErrors, PostApiV1ModelsResponse, PostApiV1ModelsResponses, PostApiV1NotificationsArchiveAllData, PostApiV1NotificationsArchiveAllError, PostApiV1NotificationsArchiveAllErrors, PostApiV1NotificationsArchiveAllResponse, PostApiV1NotificationsArchiveAllResponses, PostApiV1NotificationsByIdArchiveData, PostApiV1NotificationsByIdArchiveError, PostApiV1NotificationsByIdArchiveErrors, PostApiV1NotificationsByIdArchiveResponse, PostApiV1NotificationsByIdArchiveResponses, PostApiV1NotificationsReadAllData, PostApiV1NotificationsReadAllError, PostApiV1NotificationsReadAllErrors, PostApiV1NotificationsReadAllResponse, PostApiV1NotificationsReadAllResponses, PostApiV1NotificationsReadData, PostApiV1NotificationsReadError, PostApiV1NotificationsReadErrors, PostApiV1NotificationsReadResponse, PostApiV1NotificationsReadResponses, PostApiV1PermissionsData, PostApiV1PermissionsError, PostApiV1PermissionsErrors, PostApiV1PermissionsResponse, PostApiV1PermissionsResponses, PostApiV1ProvidersData, PostApiV1ProvidersError, PostApiV1ProvidersErrors, PostApiV1ProvidersResponse, PostApiV1ProvidersResponses, PostApiV1ResponsesData, PostApiV1ResponsesError, PostApiV1ResponsesErrors, PostApiV1ResponsesResponse, PostApiV1ResponsesResponses, PostApiV1RolesData, PostApiV1RolesError, PostApiV1RolesErrors, PostApiV1RolesResponse, PostApiV1RolesResponses, PostApiV1SignalsSourceEventsData, PostApiV1SignalsSourceEventsError, PostApiV1SignalsSourceEventsErrors, PostApiV1SignalsSourceEventsResponse, PostApiV1SignalsSourceEventsResponses, PostApiV1SignalsTriggerData, PostApiV1SignalsTriggerError, PostApiV1SignalsTriggerErrors, PostApiV1SignalsTriggerResponse, PostApiV1SignalsTriggerResponses, PostApiV1TasksByIdRunsData, PostApiV1TasksByIdRunsError, PostApiV1TasksByIdRunsErrors, PostApiV1TasksByIdRunsResponse, PostApiV1TasksByIdRunsResponses, PostApiV1TasksData, PostApiV1TasksError, PostApiV1TasksErrors, PostApiV1TasksResponse, PostApiV1TasksResponses, PostApiV1TopicsData, PostApiV1TopicsError, PostApiV1TopicsErrors, PostApiV1TopicsResponse, PostApiV1TopicsResponses, PostApiV1UsersData, PostApiV1UsersError, PostApiV1UsersErrors, PostApiV1UsersResponse, PostApiV1UsersResponses, Provider, PushTokenRegistration, PutApiV1AgentsByIdAccountsByAccountIdCredentialData, PutApiV1AgentsByIdAccountsByAccountIdCredentialError, PutApiV1AgentsByIdAccountsByAccountIdCredentialErrors, PutApiV1AgentsByIdAccountsByAccountIdCredentialResponse, PutApiV1AgentsByIdAccountsByAccountIdCredentialResponses, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultData, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultError, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultErrors, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultResponse, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultResponses, PutApiV1PushTokensByDeviceIdData, PutApiV1PushTokensByDeviceIdError, PutApiV1PushTokensByDeviceIdErrors, PutApiV1PushTokensByDeviceIdResponse, PutApiV1PushTokensByDeviceIdResponses, ResponseError, ResponseFunctionCall, ResponseFunctionCallOutput, ResponseObject, ResponseOutputItem, ResponseOutputMessage, ResponseOutputText, ResponseUsage, Role, RoleList, RolePermission, RolePermissionList, RolePermissionsUpdateResult, Task, TaskDetail, TaskDetailActivity, TaskDetailSubtask, TaskDetailWorkspaceNode, TaskLabelRef, TaskList, TaskListItem, TaskRun, TaskRunStarted, TaskStatusUpdateResult, Topic, TopicSummary, TopicThread, Usage, User, UserIdentity, UserList, UserRole } from './types.gen';
diff --git a/packages/sdk/src/generated/sdk.gen.ts b/packages/sdk/src/generated/sdk.gen.ts
index b1b41e45230..850daf255c2 100644
--- a/packages/sdk/src/generated/sdk.gen.ts
+++ b/packages/sdk/src/generated/sdk.gen.ts
@@ -2,7 +2,7 @@
import { type Client, type ClientMeta, formDataBodySerializer, type Options as Options2, type RequestResult, type TDataShape } from './client';
import { client } from './client.gen';
-import type { DeleteApiV1AgentGroupsByIdData, DeleteApiV1AgentGroupsByIdErrors, DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentsByIdAccountsByAccountIdData, DeleteApiV1AgentsByIdAccountsByAccountIdErrors, DeleteApiV1AgentsByIdAccountsByAccountIdResponses, DeleteApiV1AgentsByIdData, DeleteApiV1AgentsByIdErrors, DeleteApiV1AgentsByIdResponses, DeleteApiV1ApiKeysByIdData, DeleteApiV1ApiKeysByIdErrors, DeleteApiV1ApiKeysByIdResponses, DeleteApiV1ChatGroupsByIdData, DeleteApiV1ChatGroupsByIdErrors, DeleteApiV1ChatGroupsByIdMembersData, DeleteApiV1ChatGroupsByIdMembersErrors, DeleteApiV1ChatGroupsByIdMembersResponses, DeleteApiV1ChatGroupsByIdResponses, DeleteApiV1EvalBenchmarksByIdData, DeleteApiV1EvalBenchmarksByIdErrors, DeleteApiV1EvalBenchmarksByIdResponses, DeleteApiV1EvalDatasetsByIdData, DeleteApiV1EvalDatasetsByIdErrors, DeleteApiV1EvalDatasetsByIdResponses, DeleteApiV1EvalTestCasesByIdData, DeleteApiV1EvalTestCasesByIdErrors, DeleteApiV1EvalTestCasesByIdResponses, DeleteApiV1FilesByIdData, DeleteApiV1FilesByIdErrors, DeleteApiV1FilesByIdResponses, DeleteApiV1GoalsByIdData, DeleteApiV1GoalsByIdErrors, DeleteApiV1GoalsByIdResponses, DeleteApiV1KnowledgeBasesByIdData, DeleteApiV1KnowledgeBasesByIdErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchData, DeleteApiV1KnowledgeBasesByIdFilesBatchErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1McpServersByIdData, DeleteApiV1McpServersByIdErrors, DeleteApiV1McpServersByIdResponses, DeleteApiV1MemoriesByCategoryByIdData, DeleteApiV1MemoriesByCategoryByIdErrors, DeleteApiV1MemoriesByCategoryByIdResponses, DeleteApiV1MemoriesData, DeleteApiV1MemoriesErrors, DeleteApiV1MemoriesResponses, DeleteApiV1MessagesByIdData, DeleteApiV1MessagesByIdErrors, DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesData, DeleteApiV1MessagesErrors, DeleteApiV1MessagesResponses, DeleteApiV1MessageTranslationsByMessageIdData, DeleteApiV1MessageTranslationsByMessageIdErrors, DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1PermissionsByIdData, DeleteApiV1PermissionsByIdErrors, DeleteApiV1PermissionsByIdResponses, DeleteApiV1ProvidersByIdData, DeleteApiV1ProvidersByIdErrors, DeleteApiV1ProvidersByIdResponses, DeleteApiV1PushTokensByDeviceIdData, DeleteApiV1PushTokensByDeviceIdErrors, DeleteApiV1PushTokensByDeviceIdResponses, DeleteApiV1RolesByIdData, DeleteApiV1RolesByIdErrors, DeleteApiV1RolesByIdPermissionsData, DeleteApiV1RolesByIdPermissionsErrors, DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdResponses, DeleteApiV1TasksByIdData, DeleteApiV1TasksByIdErrors, DeleteApiV1TasksByIdResponses, DeleteApiV1TopicsByIdData, DeleteApiV1TopicsByIdErrors, DeleteApiV1TopicsByIdResponses, DeleteApiV1UsersByIdData, DeleteApiV1UsersByIdErrors, DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdRolesData, DeleteApiV1UsersByIdRolesErrors, DeleteApiV1UsersByIdRolesResponses, GetApiV1AgentGroupsByIdData, GetApiV1AgentGroupsByIdErrors, GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsData, GetApiV1AgentGroupsErrors, GetApiV1AgentGroupsResponses, GetApiV1AgentsByIdAccountsByAccountIdData, GetApiV1AgentsByIdAccountsByAccountIdErrors, GetApiV1AgentsByIdAccountsByAccountIdResponses, GetApiV1AgentsByIdAccountsData, GetApiV1AgentsByIdAccountsErrors, GetApiV1AgentsByIdAccountsResponses, GetApiV1AgentsByIdData, GetApiV1AgentsByIdErrors, GetApiV1AgentsByIdResponses, GetApiV1AgentsData, GetApiV1AgentsErrors, GetApiV1AgentsResponses, GetApiV1ApiKeysByIdData, GetApiV1ApiKeysByIdErrors, GetApiV1ApiKeysByIdResponses, GetApiV1ApiKeysData, GetApiV1ApiKeysErrors, GetApiV1ApiKeysResponses, GetApiV1ChatGroupsByIdData, GetApiV1ChatGroupsByIdErrors, GetApiV1ChatGroupsByIdResponses, GetApiV1ChatGroupsData, GetApiV1ChatGroupsErrors, GetApiV1ChatGroupsResponses, GetApiV1EvalBenchmarksByIdData, GetApiV1EvalBenchmarksByIdErrors, GetApiV1EvalBenchmarksByIdResponses, GetApiV1EvalBenchmarksData, GetApiV1EvalBenchmarksErrors, GetApiV1EvalBenchmarksResponses, GetApiV1EvalDatasetsByDatasetIdTestCasesData, GetApiV1EvalDatasetsByDatasetIdTestCasesErrors, GetApiV1EvalDatasetsByDatasetIdTestCasesResponses, GetApiV1EvalDatasetsByIdData, GetApiV1EvalDatasetsByIdErrors, GetApiV1EvalDatasetsByIdResponses, GetApiV1EvalDatasetsData, GetApiV1EvalDatasetsErrors, GetApiV1EvalDatasetsResponses, GetApiV1EvalRunsByIdData, GetApiV1EvalRunsByIdErrors, GetApiV1EvalRunsByIdResponses, GetApiV1EvalRunsByIdResultsData, GetApiV1EvalRunsByIdResultsErrors, GetApiV1EvalRunsByIdResultsResponses, GetApiV1EvalRunsByIdTopicsData, GetApiV1EvalRunsByIdTopicsErrors, GetApiV1EvalRunsByIdTopicsResponses, GetApiV1EvalRunsData, GetApiV1EvalRunsErrors, GetApiV1EvalRunsResponses, GetApiV1EvalTestCasesByIdData, GetApiV1EvalTestCasesByIdErrors, GetApiV1EvalTestCasesByIdResponses, GetApiV1FilesByIdChunksData, GetApiV1FilesByIdChunksErrors, GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdData, GetApiV1FilesByIdErrors, GetApiV1FilesByIdResponses, GetApiV1FilesByIdUrlData, GetApiV1FilesByIdUrlErrors, GetApiV1FilesByIdUrlResponses, GetApiV1FilesData, GetApiV1FilesErrors, GetApiV1FilesResponses, GetApiV1GoalsByIdData, GetApiV1GoalsByIdErrors, GetApiV1GoalsByIdResponses, GetApiV1GoalsByIdSupervisionData, GetApiV1GoalsByIdSupervisionErrors, GetApiV1GoalsByIdSupervisionResponses, GetApiV1GoalsData, GetApiV1GoalsErrors, GetApiV1GoalsResponses, GetApiV1HealthData, GetApiV1HealthErrors, GetApiV1HealthResponses, GetApiV1ImTopicsByTopicIdSyncData, GetApiV1ImTopicsByTopicIdSyncErrors, GetApiV1ImTopicsByTopicIdSyncResponses, GetApiV1KnowledgeBasesByIdData, GetApiV1KnowledgeBasesByIdErrors, GetApiV1KnowledgeBasesByIdFilesData, GetApiV1KnowledgeBasesByIdFilesErrors, GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesData, GetApiV1KnowledgeBasesErrors, GetApiV1KnowledgeBasesResponses, GetApiV1McpServersByIdData, GetApiV1McpServersByIdErrors, GetApiV1McpServersByIdResponses, GetApiV1McpServersData, GetApiV1McpServersErrors, GetApiV1McpServersResponses, GetApiV1MemoriesByCategoryData, GetApiV1MemoriesByCategoryErrors, GetApiV1MemoriesByCategoryResponses, GetApiV1MemoriesPersonaData, GetApiV1MemoriesPersonaErrors, GetApiV1MemoriesPersonaResponses, GetApiV1MemoriesPersonaVersionsData, GetApiV1MemoriesPersonaVersionsErrors, GetApiV1MemoriesPersonaVersionsResponses, GetApiV1MessagesByIdData, GetApiV1MessagesByIdErrors, GetApiV1MessagesByIdResponses, GetApiV1MessagesCountData, GetApiV1MessagesCountErrors, GetApiV1MessagesCountResponses, GetApiV1MessagesData, GetApiV1MessagesErrors, GetApiV1MessagesResponses, GetApiV1MessageTranslationsByMessageIdData, GetApiV1MessageTranslationsByMessageIdErrors, GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1ModelsByProviderIdByModelIdData, GetApiV1ModelsByProviderIdByModelIdErrors, GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsData, GetApiV1ModelsErrors, GetApiV1ModelsResponses, GetApiV1NotificationsCountsData, GetApiV1NotificationsCountsErrors, GetApiV1NotificationsCountsResponses, GetApiV1NotificationsData, GetApiV1NotificationsErrors, GetApiV1NotificationsResponses, GetApiV1NotificationsSettingsData, GetApiV1NotificationsSettingsErrors, GetApiV1NotificationsSettingsResponses, GetApiV1NotificationsUnreadCountData, GetApiV1NotificationsUnreadCountErrors, GetApiV1NotificationsUnreadCountResponses, GetApiV1PermissionsByIdData, GetApiV1PermissionsByIdErrors, GetApiV1PermissionsByIdResponses, GetApiV1PermissionsData, GetApiV1PermissionsErrors, GetApiV1PermissionsResponses, GetApiV1PluginsData, GetApiV1PluginsErrors, GetApiV1PluginsResponses, GetApiV1ProvidersByIdData, GetApiV1ProvidersByIdErrors, GetApiV1ProvidersByIdResponses, GetApiV1ProvidersData, GetApiV1ProvidersErrors, GetApiV1ProvidersResponses, GetApiV1RolesByIdData, GetApiV1RolesByIdErrors, GetApiV1RolesByIdPermissionsData, GetApiV1RolesByIdPermissionsErrors, GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdResponses, GetApiV1RolesData, GetApiV1RolesErrors, GetApiV1RolesResponses, GetApiV1SignalsReceiptsData, GetApiV1SignalsReceiptsErrors, GetApiV1SignalsReceiptsResponses, GetApiV1TasksByIdData, GetApiV1TasksByIdErrors, GetApiV1TasksByIdResponses, GetApiV1TasksByIdRunsData, GetApiV1TasksByIdRunsErrors, GetApiV1TasksByIdRunsResponses, GetApiV1TasksData, GetApiV1TasksErrors, GetApiV1TasksResponses, GetApiV1TopicsByIdData, GetApiV1TopicsByIdErrors, GetApiV1TopicsByIdResponses, GetApiV1TopicsByTopicIdThreadsData, GetApiV1TopicsByTopicIdThreadsErrors, GetApiV1TopicsByTopicIdThreadsResponses, GetApiV1TopicsData, GetApiV1TopicsErrors, GetApiV1TopicsResponses, GetApiV1UsageData, GetApiV1UsageErrors, GetApiV1UsageResponses, GetApiV1UsersByIdData, GetApiV1UsersByIdErrors, GetApiV1UsersByIdResponses, GetApiV1UsersByIdRolesData, GetApiV1UsersByIdRolesErrors, GetApiV1UsersByIdRolesResponses, GetApiV1UsersData, GetApiV1UsersErrors, GetApiV1UsersMeData, GetApiV1UsersMeErrors, GetApiV1UsersMeResponses, GetApiV1UsersResponses, PatchApiV1AgentGroupsByIdData, PatchApiV1AgentGroupsByIdErrors, PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentsByIdAccountsByAccountIdData, PatchApiV1AgentsByIdAccountsByAccountIdErrors, PatchApiV1AgentsByIdAccountsByAccountIdResponses, PatchApiV1AgentsByIdData, PatchApiV1AgentsByIdErrors, PatchApiV1AgentsByIdResponses, PatchApiV1ApiKeysByIdData, PatchApiV1ApiKeysByIdErrors, PatchApiV1ApiKeysByIdResponses, PatchApiV1ChatGroupsByIdData, PatchApiV1ChatGroupsByIdErrors, PatchApiV1ChatGroupsByIdResponses, PatchApiV1EvalBenchmarksByIdData, PatchApiV1EvalBenchmarksByIdErrors, PatchApiV1EvalBenchmarksByIdResponses, PatchApiV1EvalDatasetsByIdData, PatchApiV1EvalDatasetsByIdErrors, PatchApiV1EvalDatasetsByIdResponses, PatchApiV1EvalRunsByIdStatusData, PatchApiV1EvalRunsByIdStatusErrors, PatchApiV1EvalRunsByIdStatusResponses, PatchApiV1EvalTestCasesByIdData, PatchApiV1EvalTestCasesByIdErrors, PatchApiV1EvalTestCasesByIdResponses, PatchApiV1FilesByIdData, PatchApiV1FilesByIdErrors, PatchApiV1FilesByIdResponses, PatchApiV1GoalsByIdData, PatchApiV1GoalsByIdErrors, PatchApiV1GoalsByIdResponses, PatchApiV1KnowledgeBasesByIdData, PatchApiV1KnowledgeBasesByIdErrors, PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1McpServersByIdData, PatchApiV1McpServersByIdErrors, PatchApiV1McpServersByIdResponses, PatchApiV1MessageTranslationsByMessageIdData, PatchApiV1MessageTranslationsByMessageIdErrors, PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1ModelsByProviderIdByModelIdData, PatchApiV1ModelsByProviderIdByModelIdErrors, PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1NotificationsSettingsData, PatchApiV1NotificationsSettingsErrors, PatchApiV1NotificationsSettingsResponses, PatchApiV1PermissionsByIdData, PatchApiV1PermissionsByIdErrors, PatchApiV1PermissionsByIdResponses, PatchApiV1ProvidersByIdData, PatchApiV1ProvidersByIdErrors, PatchApiV1ProvidersByIdResponses, PatchApiV1RolesByIdData, PatchApiV1RolesByIdErrors, PatchApiV1RolesByIdPermissionsData, PatchApiV1RolesByIdPermissionsErrors, PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdResponses, PatchApiV1TasksByIdData, PatchApiV1TasksByIdErrors, PatchApiV1TasksByIdResponses, PatchApiV1TasksByIdStatusData, PatchApiV1TasksByIdStatusErrors, PatchApiV1TasksByIdStatusResponses, PatchApiV1TopicsByIdData, PatchApiV1TopicsByIdErrors, PatchApiV1TopicsByIdResponses, PatchApiV1UsersByIdData, PatchApiV1UsersByIdErrors, PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdRolesData, PatchApiV1UsersByIdRolesErrors, PatchApiV1UsersByIdRolesResponses, PostApiV1AgentGroupsData, PostApiV1AgentGroupsErrors, PostApiV1AgentGroupsResponses, PostApiV1AgentsByIdAccountsData, PostApiV1AgentsByIdAccountsErrors, PostApiV1AgentsByIdAccountsResponses, PostApiV1AgentsByIdDuplicateData, PostApiV1AgentsByIdDuplicateErrors, PostApiV1AgentsByIdDuplicateResponses, PostApiV1AgentsData, PostApiV1AgentsErrors, PostApiV1AgentsResponses, PostApiV1ApiKeysData, PostApiV1ApiKeysErrors, PostApiV1ApiKeysResponses, PostApiV1ChatData, PostApiV1ChatErrors, PostApiV1ChatGenerateReplyData, PostApiV1ChatGenerateReplyErrors, PostApiV1ChatGenerateReplyResponses, PostApiV1ChatGroupsByIdMembersData, PostApiV1ChatGroupsByIdMembersErrors, PostApiV1ChatGroupsByIdMembersResponses, PostApiV1ChatGroupsData, PostApiV1ChatGroupsErrors, PostApiV1ChatGroupsResponses, PostApiV1ChatResponses, PostApiV1ChatTranslateData, PostApiV1ChatTranslateErrors, PostApiV1ChatTranslateResponses, PostApiV1EvalBenchmarksData, PostApiV1EvalBenchmarksErrors, PostApiV1EvalBenchmarksResponses, PostApiV1EvalDatasetsByDatasetIdTestCasesData, PostApiV1EvalDatasetsByDatasetIdTestCasesErrors, PostApiV1EvalDatasetsByDatasetIdTestCasesResponses, PostApiV1EvalDatasetsData, PostApiV1EvalDatasetsErrors, PostApiV1EvalDatasetsResponses, PostApiV1EvalRunsByIdClaimData, PostApiV1EvalRunsByIdClaimErrors, PostApiV1EvalRunsByIdClaimResponses, PostApiV1EvalRunsByIdResultsData, PostApiV1EvalRunsByIdResultsErrors, PostApiV1EvalRunsByIdResultsResponses, PostApiV1EvalRunsByIdRetryErrorsData, PostApiV1EvalRunsByIdRetryErrorsErrors, PostApiV1EvalRunsByIdRetryErrorsResponses, PostApiV1EvalRunsData, PostApiV1EvalRunsErrors, PostApiV1EvalRunsResponses, PostApiV1FilesBatchesData, PostApiV1FilesBatchesErrors, PostApiV1FilesBatchesResponses, PostApiV1FilesByIdChunksData, PostApiV1FilesByIdChunksErrors, PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdParsesData, PostApiV1FilesByIdParsesErrors, PostApiV1FilesByIdParsesResponses, PostApiV1FilesData, PostApiV1FilesErrors, PostApiV1FilesQueriesData, PostApiV1FilesQueriesErrors, PostApiV1FilesQueriesResponses, PostApiV1FilesResponses, PostApiV1GoalsByIdAdvanceData, PostApiV1GoalsByIdAdvanceErrors, PostApiV1GoalsByIdAdvanceResponses, PostApiV1GoalsByIdPauseData, PostApiV1GoalsByIdPauseErrors, PostApiV1GoalsByIdPauseResponses, PostApiV1GoalsByIdRestartData, PostApiV1GoalsByIdRestartErrors, PostApiV1GoalsByIdRestartResponses, PostApiV1GoalsByIdResumeData, PostApiV1GoalsByIdResumeErrors, PostApiV1GoalsByIdResumeResponses, PostApiV1GoalsData, PostApiV1GoalsErrors, PostApiV1GoalsResponses, PostApiV1ImMessagesData, PostApiV1ImMessagesErrors, PostApiV1ImMessagesResponses, PostApiV1ImTopicsByTopicIdReadData, PostApiV1ImTopicsByTopicIdReadErrors, PostApiV1ImTopicsByTopicIdReadResponses, PostApiV1KnowledgeBasesByIdFilesBatchData, PostApiV1KnowledgeBasesByIdFilesBatchErrors, PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesMoveData, PostApiV1KnowledgeBasesByIdFilesMoveErrors, PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesData, PostApiV1KnowledgeBasesErrors, PostApiV1KnowledgeBasesResponses, PostApiV1McpServersByIdSyncData, PostApiV1McpServersByIdSyncErrors, PostApiV1McpServersByIdSyncResponses, PostApiV1McpServersData, PostApiV1McpServersErrors, PostApiV1McpServersResponses, PostApiV1MessagesData, PostApiV1MessagesErrors, PostApiV1MessagesRepliesData, PostApiV1MessagesRepliesErrors, PostApiV1MessagesRepliesResponses, PostApiV1MessagesResponses, PostApiV1MessageTranslationsByMessageIdData, PostApiV1MessageTranslationsByMessageIdErrors, PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1ModelsData, PostApiV1ModelsErrors, PostApiV1ModelsResponses, PostApiV1NotificationsArchiveAllData, PostApiV1NotificationsArchiveAllErrors, PostApiV1NotificationsArchiveAllResponses, PostApiV1NotificationsByIdArchiveData, PostApiV1NotificationsByIdArchiveErrors, PostApiV1NotificationsByIdArchiveResponses, PostApiV1NotificationsReadAllData, PostApiV1NotificationsReadAllErrors, PostApiV1NotificationsReadAllResponses, PostApiV1NotificationsReadData, PostApiV1NotificationsReadErrors, PostApiV1NotificationsReadResponses, PostApiV1PermissionsData, PostApiV1PermissionsErrors, PostApiV1PermissionsResponses, PostApiV1ProvidersData, PostApiV1ProvidersErrors, PostApiV1ProvidersResponses, PostApiV1ResponsesData, PostApiV1ResponsesErrors, PostApiV1ResponsesResponses, PostApiV1RolesData, PostApiV1RolesErrors, PostApiV1RolesResponses, PostApiV1SignalsSourceEventsData, PostApiV1SignalsSourceEventsErrors, PostApiV1SignalsSourceEventsResponses, PostApiV1SignalsTriggerData, PostApiV1SignalsTriggerErrors, PostApiV1SignalsTriggerResponses, PostApiV1TasksByIdRunsData, PostApiV1TasksByIdRunsErrors, PostApiV1TasksByIdRunsResponses, PostApiV1TasksData, PostApiV1TasksErrors, PostApiV1TasksResponses, PostApiV1TopicsData, PostApiV1TopicsErrors, PostApiV1TopicsResponses, PostApiV1UsersData, PostApiV1UsersErrors, PostApiV1UsersResponses, PutApiV1AgentsByIdAccountsByAccountIdCredentialData, PutApiV1AgentsByIdAccountsByAccountIdCredentialErrors, PutApiV1AgentsByIdAccountsByAccountIdCredentialResponses, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultData, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultErrors, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultResponses, PutApiV1PushTokensByDeviceIdData, PutApiV1PushTokensByDeviceIdErrors, PutApiV1PushTokensByDeviceIdResponses } from './types.gen';
+import type { DeleteApiV1AgentGroupsByIdData, DeleteApiV1AgentGroupsByIdErrors, DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentsByIdAccountsByAccountIdData, DeleteApiV1AgentsByIdAccountsByAccountIdErrors, DeleteApiV1AgentsByIdAccountsByAccountIdResponses, DeleteApiV1AgentsByIdData, DeleteApiV1AgentsByIdErrors, DeleteApiV1AgentsByIdResponses, DeleteApiV1ApiKeysByIdData, DeleteApiV1ApiKeysByIdErrors, DeleteApiV1ApiKeysByIdResponses, DeleteApiV1ChatGroupsByIdData, DeleteApiV1ChatGroupsByIdErrors, DeleteApiV1ChatGroupsByIdMembersData, DeleteApiV1ChatGroupsByIdMembersErrors, DeleteApiV1ChatGroupsByIdMembersResponses, DeleteApiV1ChatGroupsByIdResponses, DeleteApiV1EvalBenchmarksByIdData, DeleteApiV1EvalBenchmarksByIdErrors, DeleteApiV1EvalBenchmarksByIdResponses, DeleteApiV1EvalDatasetsByIdData, DeleteApiV1EvalDatasetsByIdErrors, DeleteApiV1EvalDatasetsByIdResponses, DeleteApiV1EvalTestCasesByIdData, DeleteApiV1EvalTestCasesByIdErrors, DeleteApiV1EvalTestCasesByIdResponses, DeleteApiV1FilesByIdData, DeleteApiV1FilesByIdErrors, DeleteApiV1FilesByIdResponses, DeleteApiV1GoalsByIdData, DeleteApiV1GoalsByIdErrors, DeleteApiV1GoalsByIdResponses, DeleteApiV1KnowledgeBasesByIdData, DeleteApiV1KnowledgeBasesByIdErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchData, DeleteApiV1KnowledgeBasesByIdFilesBatchErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1McpServersByIdData, DeleteApiV1McpServersByIdErrors, DeleteApiV1McpServersByIdResponses, DeleteApiV1MemoriesByCategoryByIdData, DeleteApiV1MemoriesByCategoryByIdErrors, DeleteApiV1MemoriesByCategoryByIdResponses, DeleteApiV1MemoriesData, DeleteApiV1MemoriesErrors, DeleteApiV1MemoriesResponses, DeleteApiV1MessagesByIdData, DeleteApiV1MessagesByIdErrors, DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesData, DeleteApiV1MessagesErrors, DeleteApiV1MessagesResponses, DeleteApiV1MessageTranslationsByMessageIdData, DeleteApiV1MessageTranslationsByMessageIdErrors, DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1PermissionsByIdData, DeleteApiV1PermissionsByIdErrors, DeleteApiV1PermissionsByIdResponses, DeleteApiV1ProvidersByIdData, DeleteApiV1ProvidersByIdErrors, DeleteApiV1ProvidersByIdResponses, DeleteApiV1PushTokensByDeviceIdData, DeleteApiV1PushTokensByDeviceIdErrors, DeleteApiV1PushTokensByDeviceIdResponses, DeleteApiV1RolesByIdData, DeleteApiV1RolesByIdErrors, DeleteApiV1RolesByIdPermissionsData, DeleteApiV1RolesByIdPermissionsErrors, DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdResponses, DeleteApiV1TasksByIdData, DeleteApiV1TasksByIdErrors, DeleteApiV1TasksByIdResponses, DeleteApiV1TopicsByIdData, DeleteApiV1TopicsByIdErrors, DeleteApiV1TopicsByIdResponses, DeleteApiV1UsersByIdData, DeleteApiV1UsersByIdErrors, DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdRolesData, DeleteApiV1UsersByIdRolesErrors, DeleteApiV1UsersByIdRolesResponses, GetApiV1AgentGroupsByIdData, GetApiV1AgentGroupsByIdErrors, GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsData, GetApiV1AgentGroupsErrors, GetApiV1AgentGroupsResponses, GetApiV1AgentsByIdAccountsByAccountIdData, GetApiV1AgentsByIdAccountsByAccountIdErrors, GetApiV1AgentsByIdAccountsByAccountIdResponses, GetApiV1AgentsByIdAccountsData, GetApiV1AgentsByIdAccountsErrors, GetApiV1AgentsByIdAccountsResponses, GetApiV1AgentsByIdData, GetApiV1AgentsByIdErrors, GetApiV1AgentsByIdResponses, GetApiV1AgentsData, GetApiV1AgentsErrors, GetApiV1AgentsResponses, GetApiV1ApiKeysByIdData, GetApiV1ApiKeysByIdErrors, GetApiV1ApiKeysByIdResponses, GetApiV1ApiKeysData, GetApiV1ApiKeysErrors, GetApiV1ApiKeysResponses, GetApiV1ChatGroupsByIdData, GetApiV1ChatGroupsByIdErrors, GetApiV1ChatGroupsByIdResponses, GetApiV1ChatGroupsData, GetApiV1ChatGroupsErrors, GetApiV1ChatGroupsResponses, GetApiV1EvalBenchmarksByIdData, GetApiV1EvalBenchmarksByIdErrors, GetApiV1EvalBenchmarksByIdResponses, GetApiV1EvalBenchmarksData, GetApiV1EvalBenchmarksErrors, GetApiV1EvalBenchmarksResponses, GetApiV1EvalDatasetsByDatasetIdTestCasesData, GetApiV1EvalDatasetsByDatasetIdTestCasesErrors, GetApiV1EvalDatasetsByDatasetIdTestCasesResponses, GetApiV1EvalDatasetsByIdData, GetApiV1EvalDatasetsByIdErrors, GetApiV1EvalDatasetsByIdResponses, GetApiV1EvalDatasetsData, GetApiV1EvalDatasetsErrors, GetApiV1EvalDatasetsResponses, GetApiV1EvalRunsByIdData, GetApiV1EvalRunsByIdErrors, GetApiV1EvalRunsByIdResponses, GetApiV1EvalRunsByIdResultsData, GetApiV1EvalRunsByIdResultsErrors, GetApiV1EvalRunsByIdResultsResponses, GetApiV1EvalRunsByIdTopicsData, GetApiV1EvalRunsByIdTopicsErrors, GetApiV1EvalRunsByIdTopicsResponses, GetApiV1EvalRunsData, GetApiV1EvalRunsErrors, GetApiV1EvalRunsResponses, GetApiV1EvalTestCasesByIdData, GetApiV1EvalTestCasesByIdErrors, GetApiV1EvalTestCasesByIdResponses, GetApiV1FilesByIdChunksData, GetApiV1FilesByIdChunksErrors, GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdData, GetApiV1FilesByIdErrors, GetApiV1FilesByIdResponses, GetApiV1FilesByIdUrlData, GetApiV1FilesByIdUrlErrors, GetApiV1FilesByIdUrlResponses, GetApiV1FilesData, GetApiV1FilesErrors, GetApiV1FilesResponses, GetApiV1GoalsByIdData, GetApiV1GoalsByIdErrors, GetApiV1GoalsByIdResponses, GetApiV1GoalsByIdSupervisionData, GetApiV1GoalsByIdSupervisionErrors, GetApiV1GoalsByIdSupervisionResponses, GetApiV1GoalsData, GetApiV1GoalsErrors, GetApiV1GoalsResponses, GetApiV1HealthData, GetApiV1HealthResponses, GetApiV1ImTopicsByTopicIdSyncData, GetApiV1ImTopicsByTopicIdSyncErrors, GetApiV1ImTopicsByTopicIdSyncResponses, GetApiV1KnowledgeBasesByIdData, GetApiV1KnowledgeBasesByIdErrors, GetApiV1KnowledgeBasesByIdFilesData, GetApiV1KnowledgeBasesByIdFilesErrors, GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesData, GetApiV1KnowledgeBasesErrors, GetApiV1KnowledgeBasesResponses, GetApiV1McpServersByIdData, GetApiV1McpServersByIdErrors, GetApiV1McpServersByIdResponses, GetApiV1McpServersData, GetApiV1McpServersErrors, GetApiV1McpServersResponses, GetApiV1MemoriesByCategoryData, GetApiV1MemoriesByCategoryErrors, GetApiV1MemoriesByCategoryResponses, GetApiV1MemoriesPersonaData, GetApiV1MemoriesPersonaErrors, GetApiV1MemoriesPersonaResponses, GetApiV1MemoriesPersonaVersionsData, GetApiV1MemoriesPersonaVersionsErrors, GetApiV1MemoriesPersonaVersionsResponses, GetApiV1MessagesByIdData, GetApiV1MessagesByIdErrors, GetApiV1MessagesByIdResponses, GetApiV1MessagesCountData, GetApiV1MessagesCountErrors, GetApiV1MessagesCountResponses, GetApiV1MessagesData, GetApiV1MessagesErrors, GetApiV1MessagesResponses, GetApiV1MessageTranslationsByMessageIdData, GetApiV1MessageTranslationsByMessageIdErrors, GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1ModelsByProviderIdByModelIdData, GetApiV1ModelsByProviderIdByModelIdErrors, GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsData, GetApiV1ModelsErrors, GetApiV1ModelsResponses, GetApiV1NotificationsCountsData, GetApiV1NotificationsCountsErrors, GetApiV1NotificationsCountsResponses, GetApiV1NotificationsData, GetApiV1NotificationsErrors, GetApiV1NotificationsResponses, GetApiV1NotificationsSettingsData, GetApiV1NotificationsSettingsErrors, GetApiV1NotificationsSettingsResponses, GetApiV1NotificationsUnreadCountData, GetApiV1NotificationsUnreadCountErrors, GetApiV1NotificationsUnreadCountResponses, GetApiV1PermissionsByIdData, GetApiV1PermissionsByIdErrors, GetApiV1PermissionsByIdResponses, GetApiV1PermissionsData, GetApiV1PermissionsErrors, GetApiV1PermissionsResponses, GetApiV1PluginsData, GetApiV1PluginsErrors, GetApiV1PluginsResponses, GetApiV1ProvidersByIdData, GetApiV1ProvidersByIdErrors, GetApiV1ProvidersByIdResponses, GetApiV1ProvidersData, GetApiV1ProvidersErrors, GetApiV1ProvidersResponses, GetApiV1RolesByIdData, GetApiV1RolesByIdErrors, GetApiV1RolesByIdPermissionsData, GetApiV1RolesByIdPermissionsErrors, GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdResponses, GetApiV1RolesData, GetApiV1RolesErrors, GetApiV1RolesResponses, GetApiV1SignalsReceiptsData, GetApiV1SignalsReceiptsErrors, GetApiV1SignalsReceiptsResponses, GetApiV1TasksByIdData, GetApiV1TasksByIdErrors, GetApiV1TasksByIdResponses, GetApiV1TasksByIdRunsData, GetApiV1TasksByIdRunsErrors, GetApiV1TasksByIdRunsResponses, GetApiV1TasksData, GetApiV1TasksErrors, GetApiV1TasksResponses, GetApiV1TopicsByIdData, GetApiV1TopicsByIdErrors, GetApiV1TopicsByIdResponses, GetApiV1TopicsByTopicIdThreadsData, GetApiV1TopicsByTopicIdThreadsErrors, GetApiV1TopicsByTopicIdThreadsResponses, GetApiV1TopicsData, GetApiV1TopicsErrors, GetApiV1TopicsResponses, GetApiV1UsageData, GetApiV1UsageErrors, GetApiV1UsageResponses, GetApiV1UsersByIdData, GetApiV1UsersByIdErrors, GetApiV1UsersByIdResponses, GetApiV1UsersByIdRolesData, GetApiV1UsersByIdRolesErrors, GetApiV1UsersByIdRolesResponses, GetApiV1UsersData, GetApiV1UsersErrors, GetApiV1UsersMeData, GetApiV1UsersMeErrors, GetApiV1UsersMeResponses, GetApiV1UsersResponses, PatchApiV1AgentGroupsByIdData, PatchApiV1AgentGroupsByIdErrors, PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentsByIdAccountsByAccountIdData, PatchApiV1AgentsByIdAccountsByAccountIdErrors, PatchApiV1AgentsByIdAccountsByAccountIdResponses, PatchApiV1AgentsByIdData, PatchApiV1AgentsByIdErrors, PatchApiV1AgentsByIdResponses, PatchApiV1ApiKeysByIdData, PatchApiV1ApiKeysByIdErrors, PatchApiV1ApiKeysByIdResponses, PatchApiV1ChatGroupsByIdData, PatchApiV1ChatGroupsByIdErrors, PatchApiV1ChatGroupsByIdResponses, PatchApiV1EvalBenchmarksByIdData, PatchApiV1EvalBenchmarksByIdErrors, PatchApiV1EvalBenchmarksByIdResponses, PatchApiV1EvalDatasetsByIdData, PatchApiV1EvalDatasetsByIdErrors, PatchApiV1EvalDatasetsByIdResponses, PatchApiV1EvalRunsByIdStatusData, PatchApiV1EvalRunsByIdStatusErrors, PatchApiV1EvalRunsByIdStatusResponses, PatchApiV1EvalTestCasesByIdData, PatchApiV1EvalTestCasesByIdErrors, PatchApiV1EvalTestCasesByIdResponses, PatchApiV1FilesByIdData, PatchApiV1FilesByIdErrors, PatchApiV1FilesByIdResponses, PatchApiV1GoalsByIdData, PatchApiV1GoalsByIdErrors, PatchApiV1GoalsByIdResponses, PatchApiV1KnowledgeBasesByIdData, PatchApiV1KnowledgeBasesByIdErrors, PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1McpServersByIdData, PatchApiV1McpServersByIdErrors, PatchApiV1McpServersByIdResponses, PatchApiV1MessageTranslationsByMessageIdData, PatchApiV1MessageTranslationsByMessageIdErrors, PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1ModelsByProviderIdByModelIdData, PatchApiV1ModelsByProviderIdByModelIdErrors, PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1NotificationsSettingsData, PatchApiV1NotificationsSettingsErrors, PatchApiV1NotificationsSettingsResponses, PatchApiV1PermissionsByIdData, PatchApiV1PermissionsByIdErrors, PatchApiV1PermissionsByIdResponses, PatchApiV1ProvidersByIdData, PatchApiV1ProvidersByIdErrors, PatchApiV1ProvidersByIdResponses, PatchApiV1RolesByIdData, PatchApiV1RolesByIdErrors, PatchApiV1RolesByIdPermissionsData, PatchApiV1RolesByIdPermissionsErrors, PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdResponses, PatchApiV1TasksByIdData, PatchApiV1TasksByIdErrors, PatchApiV1TasksByIdResponses, PatchApiV1TasksByIdStatusData, PatchApiV1TasksByIdStatusErrors, PatchApiV1TasksByIdStatusResponses, PatchApiV1TopicsByIdData, PatchApiV1TopicsByIdErrors, PatchApiV1TopicsByIdResponses, PatchApiV1UsersByIdData, PatchApiV1UsersByIdErrors, PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdRolesData, PatchApiV1UsersByIdRolesErrors, PatchApiV1UsersByIdRolesResponses, PostApiV1AgentGroupsData, PostApiV1AgentGroupsErrors, PostApiV1AgentGroupsResponses, PostApiV1AgentsByIdAccountsData, PostApiV1AgentsByIdAccountsErrors, PostApiV1AgentsByIdAccountsResponses, PostApiV1AgentsByIdDuplicateData, PostApiV1AgentsByIdDuplicateErrors, PostApiV1AgentsByIdDuplicateResponses, PostApiV1AgentsData, PostApiV1AgentsErrors, PostApiV1AgentsResponses, PostApiV1ApiKeysData, PostApiV1ApiKeysErrors, PostApiV1ApiKeysResponses, PostApiV1AudioSpeechData, PostApiV1AudioSpeechErrors, PostApiV1AudioSpeechResponses, PostApiV1ChatData, PostApiV1ChatErrors, PostApiV1ChatGenerateReplyData, PostApiV1ChatGenerateReplyErrors, PostApiV1ChatGenerateReplyResponses, PostApiV1ChatGroupsByIdMembersData, PostApiV1ChatGroupsByIdMembersErrors, PostApiV1ChatGroupsByIdMembersResponses, PostApiV1ChatGroupsData, PostApiV1ChatGroupsErrors, PostApiV1ChatGroupsResponses, PostApiV1ChatResponses, PostApiV1ChatTranslateData, PostApiV1ChatTranslateErrors, PostApiV1ChatTranslateResponses, PostApiV1EvalBenchmarksData, PostApiV1EvalBenchmarksErrors, PostApiV1EvalBenchmarksResponses, PostApiV1EvalDatasetsByDatasetIdTestCasesData, PostApiV1EvalDatasetsByDatasetIdTestCasesErrors, PostApiV1EvalDatasetsByDatasetIdTestCasesResponses, PostApiV1EvalDatasetsData, PostApiV1EvalDatasetsErrors, PostApiV1EvalDatasetsResponses, PostApiV1EvalRunsByIdClaimData, PostApiV1EvalRunsByIdClaimErrors, PostApiV1EvalRunsByIdClaimResponses, PostApiV1EvalRunsByIdResultsData, PostApiV1EvalRunsByIdResultsErrors, PostApiV1EvalRunsByIdResultsResponses, PostApiV1EvalRunsByIdRetryErrorsData, PostApiV1EvalRunsByIdRetryErrorsErrors, PostApiV1EvalRunsByIdRetryErrorsResponses, PostApiV1EvalRunsData, PostApiV1EvalRunsErrors, PostApiV1EvalRunsResponses, PostApiV1FilesBatchesData, PostApiV1FilesBatchesErrors, PostApiV1FilesBatchesResponses, PostApiV1FilesByIdChunksData, PostApiV1FilesByIdChunksErrors, PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdParsesData, PostApiV1FilesByIdParsesErrors, PostApiV1FilesByIdParsesResponses, PostApiV1FilesData, PostApiV1FilesErrors, PostApiV1FilesQueriesData, PostApiV1FilesQueriesErrors, PostApiV1FilesQueriesResponses, PostApiV1FilesResponses, PostApiV1GoalsByIdAdvanceData, PostApiV1GoalsByIdAdvanceErrors, PostApiV1GoalsByIdAdvanceResponses, PostApiV1GoalsByIdPauseData, PostApiV1GoalsByIdPauseErrors, PostApiV1GoalsByIdPauseResponses, PostApiV1GoalsByIdRestartData, PostApiV1GoalsByIdRestartErrors, PostApiV1GoalsByIdRestartResponses, PostApiV1GoalsByIdResumeData, PostApiV1GoalsByIdResumeErrors, PostApiV1GoalsByIdResumeResponses, PostApiV1GoalsData, PostApiV1GoalsErrors, PostApiV1GoalsResponses, PostApiV1ImMessagesData, PostApiV1ImMessagesErrors, PostApiV1ImMessagesResponses, PostApiV1ImTopicsByTopicIdReadData, PostApiV1ImTopicsByTopicIdReadErrors, PostApiV1ImTopicsByTopicIdReadResponses, PostApiV1KnowledgeBasesByIdFilesBatchData, PostApiV1KnowledgeBasesByIdFilesBatchErrors, PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesMoveData, PostApiV1KnowledgeBasesByIdFilesMoveErrors, PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesData, PostApiV1KnowledgeBasesErrors, PostApiV1KnowledgeBasesResponses, PostApiV1McpServersByIdSyncData, PostApiV1McpServersByIdSyncErrors, PostApiV1McpServersByIdSyncResponses, PostApiV1McpServersData, PostApiV1McpServersErrors, PostApiV1McpServersResponses, PostApiV1MessagesData, PostApiV1MessagesErrors, PostApiV1MessagesRepliesData, PostApiV1MessagesRepliesErrors, PostApiV1MessagesRepliesResponses, PostApiV1MessagesResponses, PostApiV1MessageTranslationsByMessageIdData, PostApiV1MessageTranslationsByMessageIdErrors, PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1ModelsData, PostApiV1ModelsErrors, PostApiV1ModelsResponses, PostApiV1NotificationsArchiveAllData, PostApiV1NotificationsArchiveAllErrors, PostApiV1NotificationsArchiveAllResponses, PostApiV1NotificationsByIdArchiveData, PostApiV1NotificationsByIdArchiveErrors, PostApiV1NotificationsByIdArchiveResponses, PostApiV1NotificationsReadAllData, PostApiV1NotificationsReadAllErrors, PostApiV1NotificationsReadAllResponses, PostApiV1NotificationsReadData, PostApiV1NotificationsReadErrors, PostApiV1NotificationsReadResponses, PostApiV1PermissionsData, PostApiV1PermissionsErrors, PostApiV1PermissionsResponses, PostApiV1ProvidersData, PostApiV1ProvidersErrors, PostApiV1ProvidersResponses, PostApiV1ResponsesData, PostApiV1ResponsesErrors, PostApiV1ResponsesResponses, PostApiV1RolesData, PostApiV1RolesErrors, PostApiV1RolesResponses, PostApiV1SignalsSourceEventsData, PostApiV1SignalsSourceEventsErrors, PostApiV1SignalsSourceEventsResponses, PostApiV1SignalsTriggerData, PostApiV1SignalsTriggerErrors, PostApiV1SignalsTriggerResponses, PostApiV1TasksByIdRunsData, PostApiV1TasksByIdRunsErrors, PostApiV1TasksByIdRunsResponses, PostApiV1TasksData, PostApiV1TasksErrors, PostApiV1TasksResponses, PostApiV1TopicsData, PostApiV1TopicsErrors, PostApiV1TopicsResponses, PostApiV1UsersData, PostApiV1UsersErrors, PostApiV1UsersResponses, PutApiV1AgentsByIdAccountsByAccountIdCredentialData, PutApiV1AgentsByIdAccountsByAccountIdCredentialErrors, PutApiV1AgentsByIdAccountsByAccountIdCredentialResponses, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultData, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultErrors, PutApiV1EvalRunsByRunIdTopicsByTopicIdResultResponses, PutApiV1PushTokensByDeviceIdData, PutApiV1PushTokensByDeviceIdErrors, PutApiV1PushTokensByDeviceIdResponses } from './types.gen';
const mergeMethodHeaders = (
defaults: Record<string, unknown>,
@@ -65,8 +65,8 @@ export class Health extends HeyApiClient {
/**
* Health check
*/
- public check<ThrowOnError extends boolean = false>(options?: Options<GetApiV1HealthData, ThrowOnError>): RequestResult<GetApiV1HealthResponses, GetApiV1HealthErrors, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1HealthResponses, GetApiV1HealthErrors, ThrowOnError>({
+ public check<ThrowOnError extends boolean = false>(options?: Options<GetApiV1HealthData, ThrowOnError>): RequestResult<GetApiV1HealthResponses, unknown, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1HealthResponses, unknown, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/health',
...options
@@ -76,7 +76,7 @@ export class Health extends HeyApiClient {
export class AgentGroups extends HeyApiClient {
/**
- * Get agent group list
+ * List agent groups
*/
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1AgentGroupsData, ThrowOnError>): RequestResult<GetApiV1AgentGroupsResponses, GetApiV1AgentGroupsErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1AgentGroupsResponses, GetApiV1AgentGroupsErrors, ThrowOnError>({
@@ -86,6 +86,9 @@ export class AgentGroups extends HeyApiClient {
});
}
+ /**
+ * Create an agent group
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1AgentGroupsData, ThrowOnError>): RequestResult<PostApiV1AgentGroupsResponses, PostApiV1AgentGroupsErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1AgentGroupsResponses, PostApiV1AgentGroupsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -95,6 +98,9 @@ export class AgentGroups extends HeyApiClient {
});
}
+ /**
+ * Delete an agent group
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1AgentGroupsByIdData, ThrowOnError>): RequestResult<DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentGroupsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentGroupsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -103,6 +109,9 @@ export class AgentGroups extends HeyApiClient {
});
}
+ /**
+ * Get an agent group
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1AgentGroupsByIdData, ThrowOnError>): RequestResult<GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -111,6 +120,9 @@ export class AgentGroups extends HeyApiClient {
});
}
+ /**
+ * Update an agent group
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1AgentGroupsByIdData, ThrowOnError>): RequestResult<PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentGroupsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentGroupsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -122,6 +134,9 @@ export class AgentGroups extends HeyApiClient {
}
export class Agents extends HeyApiClient {
+ /**
+ * List agents
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1AgentsData, ThrowOnError>): RequestResult<GetApiV1AgentsResponses, GetApiV1AgentsErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1AgentsResponses, GetApiV1AgentsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -130,6 +145,9 @@ export class Agents extends HeyApiClient {
});
}
+ /**
+ * Create an agent
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1AgentsData, ThrowOnError>): RequestResult<PostApiV1AgentsResponses, PostApiV1AgentsErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1AgentsResponses, PostApiV1AgentsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -139,6 +157,9 @@ export class Agents extends HeyApiClient {
});
}
+ /**
+ * Delete an agent
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1AgentsByIdData, ThrowOnError>): RequestResult<DeleteApiV1AgentsByIdResponses, DeleteApiV1AgentsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1AgentsByIdResponses, DeleteApiV1AgentsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -147,6 +168,9 @@ export class Agents extends HeyApiClient {
});
}
+ /**
+ * Get an agent with its mounted files and knowledge bases
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1AgentsByIdData, ThrowOnError>): RequestResult<GetApiV1AgentsByIdResponses, GetApiV1AgentsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1AgentsByIdResponses, GetApiV1AgentsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -155,6 +179,9 @@ export class Agents extends HeyApiClient {
});
}
+ /**
+ * Update an agent
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1AgentsByIdData, ThrowOnError>): RequestResult<PatchApiV1AgentsByIdResponses, PatchApiV1AgentsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1AgentsByIdResponses, PatchApiV1AgentsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -165,7 +192,7 @@ export class Agents extends HeyApiClient {
}
/**
- * Duplicate agent
+ * Duplicate an agent
*/
public createDuplicate<ThrowOnError extends boolean = false>(options: Options<PostApiV1AgentsByIdDuplicateData, ThrowOnError>): RequestResult<PostApiV1AgentsByIdDuplicateResponses, PostApiV1AgentsByIdDuplicateErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1AgentsByIdDuplicateResponses, PostApiV1AgentsByIdDuplicateErrors, ThrowOnError>({
@@ -176,6 +203,9 @@ export class Agents extends HeyApiClient {
});
}
+ /**
+ * List an agent's accounts
+ */
public listAccounts<ThrowOnError extends boolean = false>(options: Options<GetApiV1AgentsByIdAccountsData, ThrowOnError>): RequestResult<GetApiV1AgentsByIdAccountsResponses, GetApiV1AgentsByIdAccountsErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1AgentsByIdAccountsResponses, GetApiV1AgentsByIdAccountsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -184,6 +214,9 @@ export class Agents extends HeyApiClient {
});
}
+ /**
+ * Mount or provision an agent account
+ */
public createAccount<ThrowOnError extends boolean = false>(options: Options<PostApiV1AgentsByIdAccountsData, ThrowOnError>): RequestResult<PostApiV1AgentsByIdAccountsResponses, PostApiV1AgentsByIdAccountsErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1AgentsByIdAccountsResponses, PostApiV1AgentsByIdAccountsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -193,6 +226,11 @@ export class Agents extends HeyApiClient {
});
}
+ /**
+ * Revoke an agent account
+ *
+ * Releases the account and marks it revoked. The row is kept for audit, so the response is the revoked account.
+ */
public deleteAccount<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1AgentsByIdAccountsByAccountIdData, ThrowOnError>): RequestResult<DeleteApiV1AgentsByIdAccountsByAccountIdResponses, DeleteApiV1AgentsByIdAccountsByAccountIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1AgentsByIdAccountsByAccountIdResponses, DeleteApiV1AgentsByIdAccountsByAccountIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -201,6 +239,9 @@ export class Agents extends HeyApiClient {
});
}
+ /**
+ * Get an agent account
+ */
public getAccount<ThrowOnError extends boolean = false>(options: Options<GetApiV1AgentsByIdAccountsByAccountIdData, ThrowOnError>): RequestResult<GetApiV1AgentsByIdAccountsByAccountIdResponses, GetApiV1AgentsByIdAccountsByAccountIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1AgentsByIdAccountsByAccountIdResponses, GetApiV1AgentsByIdAccountsByAccountIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -209,6 +250,9 @@ export class Agents extends HeyApiClient {
});
}
+ /**
+ * Update an agent account
+ */
public updateAccount<ThrowOnError extends boolean = false>(options: Options<PatchApiV1AgentsByIdAccountsByAccountIdData, ThrowOnError>): RequestResult<PatchApiV1AgentsByIdAccountsByAccountIdResponses, PatchApiV1AgentsByIdAccountsByAccountIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1AgentsByIdAccountsByAccountIdResponses, PatchApiV1AgentsByIdAccountsByAccountIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -218,6 +262,11 @@ export class Agents extends HeyApiClient {
});
}
+ /**
+ * Write an agent account credential
+ *
+ * Write-only: the response carries the non-secret hint and `hasCredential`, never the secret.
+ */
public updateAccountCredential<ThrowOnError extends boolean = false>(options: Options<PutApiV1AgentsByIdAccountsByAccountIdCredentialData, ThrowOnError>): RequestResult<PutApiV1AgentsByIdAccountsByAccountIdCredentialResponses, PutApiV1AgentsByIdAccountsByAccountIdCredentialErrors, ThrowOnError> {
return (options.client ?? this.client).put<PutApiV1AgentsByIdAccountsByAccountIdCredentialResponses, PutApiV1AgentsByIdAccountsByAccountIdCredentialErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -240,6 +289,11 @@ export class ApiKeys extends HeyApiClient {
});
}
+ /**
+ * Create an API key
+ *
+ * The plaintext key is returned only in this response.
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ApiKeysData, ThrowOnError>): RequestResult<PostApiV1ApiKeysResponses, PostApiV1ApiKeysErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1ApiKeysResponses, PostApiV1ApiKeysErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -249,6 +303,9 @@ export class ApiKeys extends HeyApiClient {
});
}
+ /**
+ * Delete an API key
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1ApiKeysByIdData, ThrowOnError>): RequestResult<DeleteApiV1ApiKeysByIdResponses, DeleteApiV1ApiKeysByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1ApiKeysByIdResponses, DeleteApiV1ApiKeysByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -257,6 +314,9 @@ export class ApiKeys extends HeyApiClient {
});
}
+ /**
+ * Get an API key
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1ApiKeysByIdData, ThrowOnError>): RequestResult<GetApiV1ApiKeysByIdResponses, GetApiV1ApiKeysByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1ApiKeysByIdResponses, GetApiV1ApiKeysByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -265,6 +325,9 @@ export class ApiKeys extends HeyApiClient {
});
}
+ /**
+ * Update an API key
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1ApiKeysByIdData, ThrowOnError>): RequestResult<PatchApiV1ApiKeysByIdResponses, PatchApiV1ApiKeysByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1ApiKeysByIdResponses, PatchApiV1ApiKeysByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -275,7 +338,25 @@ export class ApiKeys extends HeyApiClient {
}
}
+export class Audio extends HeyApiClient {
+ /**
+ * Create speech
+ *
+ * OpenAI-compatible text-to-speech. Point an OpenAI SDK at `/api/v1` and call `audio.speech.create`. `model` takes `provider/model` (for example `lobehub/speech-2.8-hd`) or a bare model id; the optional `provider` and `params` (emotion, pitch, volume, sampleRate) are LobeHub extensions. Returns the audio bytes; usage is reported in `X-LobeHub-*` headers. Synthesis errors use OpenAI's `{ error: { message, type, code, param } }` body; authentication and permission errors use the platform `ApiError` envelope.
+ */
+ public createSpeech<ThrowOnError extends boolean = false>(options?: Options<PostApiV1AudioSpeechData, ThrowOnError>): RequestResult<PostApiV1AudioSpeechResponses, PostApiV1AudioSpeechErrors, ThrowOnError> {
+ return (options?.client ?? this.client).post<PostApiV1AudioSpeechResponses, PostApiV1AudioSpeechErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/audio/speech',
+ ...options
+ });
+ }
+}
+
export class Chat extends HeyApiClient {
+ /**
+ * Run a non-streaming chat completion
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatData, ThrowOnError>): RequestResult<PostApiV1ChatResponses, PostApiV1ChatErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1ChatResponses, PostApiV1ChatErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -285,6 +366,9 @@ export class Chat extends HeyApiClient {
});
}
+ /**
+ * Translate text
+ */
public createTranslate<ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatTranslateData, ThrowOnError>): RequestResult<PostApiV1ChatTranslateResponses, PostApiV1ChatTranslateErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1ChatTranslateResponses, PostApiV1ChatTranslateErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -294,6 +378,9 @@ export class Chat extends HeyApiClient {
});
}
+ /**
+ * Generate a reply to a message
+ */
public createGenerateReply<ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatGenerateReplyData, ThrowOnError>): RequestResult<PostApiV1ChatGenerateReplyResponses, PostApiV1ChatGenerateReplyErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1ChatGenerateReplyResponses, PostApiV1ChatGenerateReplyErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -305,6 +392,9 @@ export class Chat extends HeyApiClient {
}
export class ChatGroups extends HeyApiClient {
+ /**
+ * List chat groups
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1ChatGroupsData, ThrowOnError>): RequestResult<GetApiV1ChatGroupsResponses, GetApiV1ChatGroupsErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1ChatGroupsResponses, GetApiV1ChatGroupsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -313,6 +403,9 @@ export class ChatGroups extends HeyApiClient {
});
}
+ /**
+ * Create a chat group with its supervisor and members
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatGroupsData, ThrowOnError>): RequestResult<PostApiV1ChatGroupsResponses, PostApiV1ChatGroupsErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1ChatGroupsResponses, PostApiV1ChatGroupsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -322,6 +415,9 @@ export class ChatGroups extends HeyApiClient {
});
}
+ /**
+ * Delete a chat group
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1ChatGroupsByIdData, ThrowOnError>): RequestResult<DeleteApiV1ChatGroupsByIdResponses, DeleteApiV1ChatGroupsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1ChatGroupsByIdResponses, DeleteApiV1ChatGroupsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -330,6 +426,9 @@ export class ChatGroups extends HeyApiClient {
});
}
+ /**
+ * Get a chat group
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1ChatGroupsByIdData, ThrowOnError>): RequestResult<GetApiV1ChatGroupsByIdResponses, GetApiV1ChatGroupsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1ChatGroupsByIdResponses, GetApiV1ChatGroupsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -338,6 +437,9 @@ export class ChatGroups extends HeyApiClient {
});
}
+ /**
+ * Update a chat group
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1ChatGroupsByIdData, ThrowOnError>): RequestResult<PatchApiV1ChatGroupsByIdResponses, PatchApiV1ChatGroupsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1ChatGroupsByIdResponses, PatchApiV1ChatGroupsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -347,6 +449,11 @@ export class ChatGroups extends HeyApiClient {
});
}
+ /**
+ * Remove members from a chat group
+ *
+ * Detaches the agents and answers with the updated group.
+ */
public removeMembers<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1ChatGroupsByIdMembersData, ThrowOnError>): RequestResult<DeleteApiV1ChatGroupsByIdMembersResponses, DeleteApiV1ChatGroupsByIdMembersErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1ChatGroupsByIdMembersResponses, DeleteApiV1ChatGroupsByIdMembersErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -356,6 +463,9 @@ export class ChatGroups extends HeyApiClient {
});
}
+ /**
+ * Add members to a chat group
+ */
public addMembers<ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatGroupsByIdMembersData, ThrowOnError>): RequestResult<PostApiV1ChatGroupsByIdMembersResponses, PostApiV1ChatGroupsByIdMembersErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1ChatGroupsByIdMembersResponses, PostApiV1ChatGroupsByIdMembersErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -403,6 +513,9 @@ export class Eval extends HeyApiClient {
});
}
+ /**
+ * Get an eval run
+ */
public getRuns<ThrowOnError extends boolean = false>(options: Options<GetApiV1EvalRunsByIdData, ThrowOnError>): RequestResult<GetApiV1EvalRunsByIdResponses, GetApiV1EvalRunsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1EvalRunsByIdResponses, GetApiV1EvalRunsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -411,6 +524,9 @@ export class Eval extends HeyApiClient {
});
}
+ /**
+ * List case results of an eval run
+ */
public listRunsResults<ThrowOnError extends boolean = false>(options: Options<GetApiV1EvalRunsByIdResultsData, ThrowOnError>): RequestResult<GetApiV1EvalRunsByIdResultsResponses, GetApiV1EvalRunsByIdResultsErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1EvalRunsByIdResultsResponses, GetApiV1EvalRunsByIdResultsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -420,7 +536,7 @@ export class Eval extends HeyApiClient {
}
/**
- * reportBatch
+ * Report results for a batch of run topics
*
* Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.
*/
@@ -434,7 +550,7 @@ export class Eval extends HeyApiClient {
}
/**
- * listBenchmarks
+ * List benchmarks
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -447,7 +563,7 @@ export class Eval extends HeyApiClient {
}
/**
- * createBenchmark
+ * Create a benchmark
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -461,7 +577,7 @@ export class Eval extends HeyApiClient {
}
/**
- * deleteBenchmark
+ * Delete a benchmark
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -474,7 +590,7 @@ export class Eval extends HeyApiClient {
}
/**
- * getBenchmark
+ * Get a benchmark
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -487,7 +603,7 @@ export class Eval extends HeyApiClient {
}
/**
- * updateBenchmark
+ * Update a benchmark
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -501,7 +617,7 @@ export class Eval extends HeyApiClient {
}
/**
- * listDatasets
+ * List datasets
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -514,7 +630,7 @@ export class Eval extends HeyApiClient {
}
/**
- * createDataset
+ * Create a dataset
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -528,7 +644,7 @@ export class Eval extends HeyApiClient {
}
/**
- * deleteDataset
+ * Delete a dataset
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -541,7 +657,7 @@ export class Eval extends HeyApiClient {
}
/**
- * getDataset
+ * Get a dataset
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -554,7 +670,7 @@ export class Eval extends HeyApiClient {
}
/**
- * updateDataset
+ * Update a dataset
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -568,7 +684,7 @@ export class Eval extends HeyApiClient {
}
/**
- * listTestCases
+ * List test cases of a dataset
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -581,7 +697,7 @@ export class Eval extends HeyApiClient {
}
/**
- * createTestCase
+ * Create a test case
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -595,7 +711,7 @@ export class Eval extends HeyApiClient {
}
/**
- * deleteTestCase
+ * Delete a test case
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -608,7 +724,7 @@ export class Eval extends HeyApiClient {
}
/**
- * getTestCase
+ * Get a test case
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -621,7 +737,7 @@ export class Eval extends HeyApiClient {
}
/**
- * updateTestCase
+ * Update a test case
*
* Creates accept an optional id: an identical replay returns the resource; conflicting id or identifier returns 409. Lists are paginated.
*/
@@ -635,7 +751,7 @@ export class Eval extends HeyApiClient {
}
/**
- * claim
+ * Claim a pending external eval run
*
* Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.
*/
@@ -648,7 +764,7 @@ export class Eval extends HeyApiClient {
}
/**
- * setStatus
+ * Set the status of an external eval run
*
* Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.
*/
@@ -662,7 +778,7 @@ export class Eval extends HeyApiClient {
}
/**
- * retryErrors
+ * Retry the errored cases of an eval run
*
* Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.
*/
@@ -675,7 +791,7 @@ export class Eval extends HeyApiClient {
}
/**
- * report
+ * Report the result of one run topic
*
* Claim: one pending worker succeeds, others receive 409. Reports: identical replays succeed; different results conflict. Batches are atomic. External workers can supply testCaseId to associate their own topic with a dataset case on first report. Retry: only terminal runs, concurrent repeats conflict.
*/
@@ -703,6 +819,9 @@ export class Plugins extends HeyApiClient {
}
export class Files extends HeyApiClient {
+ /**
+ * List files
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1FilesData, ThrowOnError>): RequestResult<GetApiV1FilesResponses, GetApiV1FilesErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1FilesResponses, GetApiV1FilesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -724,6 +843,9 @@ export class Files extends HeyApiClient {
});
}
+ /**
+ * Delete a file
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1FilesByIdData, ThrowOnError>): RequestResult<DeleteApiV1FilesByIdResponses, DeleteApiV1FilesByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1FilesByIdResponses, DeleteApiV1FilesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -732,6 +854,11 @@ export class Files extends HeyApiClient {
});
}
+ /**
+ * Get a file
+ *
+ * Non-image files include their parse result. A file that does not exist answers 400.
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1FilesByIdData, ThrowOnError>): RequestResult<GetApiV1FilesByIdResponses, GetApiV1FilesByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1FilesByIdResponses, GetApiV1FilesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -740,6 +867,9 @@ export class Files extends HeyApiClient {
});
}
+ /**
+ * Update a file
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1FilesByIdData, ThrowOnError>): RequestResult<PatchApiV1FilesByIdResponses, PatchApiV1FilesByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1FilesByIdResponses, PatchApiV1FilesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -749,6 +879,9 @@ export class Files extends HeyApiClient {
});
}
+ /**
+ * Get a pre-signed file URL
+ */
public getUrl<ThrowOnError extends boolean = false>(options: Options<GetApiV1FilesByIdUrlData, ThrowOnError>): RequestResult<GetApiV1FilesByIdUrlResponses, GetApiV1FilesByIdUrlErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1FilesByIdUrlResponses, GetApiV1FilesByIdUrlErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -757,6 +890,9 @@ export class Files extends HeyApiClient {
});
}
+ /**
+ * Parse file content
+ */
public parse<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesByIdParsesData, ThrowOnError>): RequestResult<PostApiV1FilesByIdParsesResponses, PostApiV1FilesByIdParsesErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1FilesByIdParsesResponses, PostApiV1FilesByIdParsesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -765,6 +901,9 @@ export class Files extends HeyApiClient {
});
}
+ /**
+ * Get file chunking status
+ */
public listChunks<ThrowOnError extends boolean = false>(options: Options<GetApiV1FilesByIdChunksData, ThrowOnError>): RequestResult<GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdChunksErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdChunksErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -773,6 +912,9 @@ export class Files extends HeyApiClient {
});
}
+ /**
+ * Start a file chunking task
+ */
public createChunks<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesByIdChunksData, ThrowOnError>): RequestResult<PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdChunksErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdChunksErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -795,6 +937,9 @@ export class Files extends HeyApiClient {
});
}
+ /**
+ * Get several files
+ */
public query<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesQueriesData, ThrowOnError>): RequestResult<PostApiV1FilesQueriesResponses, PostApiV1FilesQueriesErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1FilesQueriesResponses, PostApiV1FilesQueriesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -806,6 +951,9 @@ export class Files extends HeyApiClient {
}
export class Goals extends HeyApiClient {
+ /**
+ * List goals
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1GoalsData, ThrowOnError>): RequestResult<GetApiV1GoalsResponses, GetApiV1GoalsErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1GoalsResponses, GetApiV1GoalsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -814,6 +962,11 @@ export class Goals extends HeyApiClient {
});
}
+ /**
+ * Create a goal
+ *
+ * Creates the goal graph and hands it to the coordinator.
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1GoalsData, ThrowOnError>): RequestResult<PostApiV1GoalsResponses, PostApiV1GoalsErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1GoalsResponses, PostApiV1GoalsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -823,6 +976,9 @@ export class Goals extends HeyApiClient {
});
}
+ /**
+ * Delete a goal
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1GoalsByIdData, ThrowOnError>): RequestResult<DeleteApiV1GoalsByIdResponses, DeleteApiV1GoalsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1GoalsByIdResponses, DeleteApiV1GoalsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -831,6 +987,9 @@ export class Goals extends HeyApiClient {
});
}
+ /**
+ * Get a goal and its graph
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1GoalsByIdData, ThrowOnError>): RequestResult<GetApiV1GoalsByIdResponses, GetApiV1GoalsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1GoalsByIdResponses, GetApiV1GoalsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -839,6 +998,9 @@ export class Goals extends HeyApiClient {
});
}
+ /**
+ * Update a goal requirement or budget
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1GoalsByIdData, ThrowOnError>): RequestResult<PatchApiV1GoalsByIdResponses, PatchApiV1GoalsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1GoalsByIdResponses, PatchApiV1GoalsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -848,6 +1010,9 @@ export class Goals extends HeyApiClient {
});
}
+ /**
+ * Get goal supervision state
+ */
public getSupervision<ThrowOnError extends boolean = false>(options: Options<GetApiV1GoalsByIdSupervisionData, ThrowOnError>): RequestResult<GetApiV1GoalsByIdSupervisionResponses, GetApiV1GoalsByIdSupervisionErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1GoalsByIdSupervisionResponses, GetApiV1GoalsByIdSupervisionErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -856,6 +1021,9 @@ export class Goals extends HeyApiClient {
});
}
+ /**
+ * Run the goal coordinator now
+ */
public advance<ThrowOnError extends boolean = false>(options: Options<PostApiV1GoalsByIdAdvanceData, ThrowOnError>): RequestResult<PostApiV1GoalsByIdAdvanceResponses, PostApiV1GoalsByIdAdvanceErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1GoalsByIdAdvanceResponses, PostApiV1GoalsByIdAdvanceErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -864,6 +1032,9 @@ export class Goals extends HeyApiClient {
});
}
+ /**
+ * Pause a goal
+ */
public pause<ThrowOnError extends boolean = false>(options: Options<PostApiV1GoalsByIdPauseData, ThrowOnError>): RequestResult<PostApiV1GoalsByIdPauseResponses, PostApiV1GoalsByIdPauseErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1GoalsByIdPauseResponses, PostApiV1GoalsByIdPauseErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -872,6 +1043,9 @@ export class Goals extends HeyApiClient {
});
}
+ /**
+ * Resume a paused goal
+ */
public resume<ThrowOnError extends boolean = false>(options: Options<PostApiV1GoalsByIdResumeData, ThrowOnError>): RequestResult<PostApiV1GoalsByIdResumeResponses, PostApiV1GoalsByIdResumeErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1GoalsByIdResumeResponses, PostApiV1GoalsByIdResumeErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -880,6 +1054,9 @@ export class Goals extends HeyApiClient {
});
}
+ /**
+ * Restart every unfinished task of a goal
+ */
public restart<ThrowOnError extends boolean = false>(options: Options<PostApiV1GoalsByIdRestartData, ThrowOnError>): RequestResult<PostApiV1GoalsByIdRestartResponses, PostApiV1GoalsByIdRestartErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1GoalsByIdRestartResponses, PostApiV1GoalsByIdRestartErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -928,6 +1105,9 @@ export class Im extends HeyApiClient {
}
export class KnowledgeBases extends HeyApiClient {
+ /**
+ * List knowledge bases
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1KnowledgeBasesData, ThrowOnError>): RequestResult<GetApiV1KnowledgeBasesResponses, GetApiV1KnowledgeBasesErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1KnowledgeBasesResponses, GetApiV1KnowledgeBasesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -936,6 +1116,9 @@ export class KnowledgeBases extends HeyApiClient {
});
}
+ /**
+ * Create a knowledge base
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1KnowledgeBasesData, ThrowOnError>): RequestResult<PostApiV1KnowledgeBasesResponses, PostApiV1KnowledgeBasesErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1KnowledgeBasesResponses, PostApiV1KnowledgeBasesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -945,6 +1128,11 @@ export class KnowledgeBases extends HeyApiClient {
});
}
+ /**
+ * Delete a knowledge base
+ *
+ * Also deletes the files that belong to no other knowledge base.
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1KnowledgeBasesByIdData, ThrowOnError>): RequestResult<DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1KnowledgeBasesByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1KnowledgeBasesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -953,6 +1141,9 @@ export class KnowledgeBases extends HeyApiClient {
});
}
+ /**
+ * Get a knowledge base
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1KnowledgeBasesByIdData, ThrowOnError>): RequestResult<GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -961,6 +1152,9 @@ export class KnowledgeBases extends HeyApiClient {
});
}
+ /**
+ * Update a knowledge base
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1KnowledgeBasesByIdData, ThrowOnError>): RequestResult<PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1KnowledgeBasesByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1KnowledgeBasesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -970,6 +1164,9 @@ export class KnowledgeBases extends HeyApiClient {
});
}
+ /**
+ * List the files of a knowledge base
+ */
public listFiles<ThrowOnError extends boolean = false>(options: Options<GetApiV1KnowledgeBasesByIdFilesData, ThrowOnError>): RequestResult<GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdFilesErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdFilesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -978,6 +1175,11 @@ export class KnowledgeBases extends HeyApiClient {
});
}
+ /**
+ * Remove files from a knowledge base
+ *
+ * Detaches the files from the knowledge base without deleting them, and reports per file which ones were detached.
+ */
public removeFiles<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1KnowledgeBasesByIdFilesBatchData, ThrowOnError>): RequestResult<DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdFilesBatchErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdFilesBatchErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -987,6 +1189,9 @@ export class KnowledgeBases extends HeyApiClient {
});
}
+ /**
+ * Add files to a knowledge base
+ */
public addFiles<ThrowOnError extends boolean = false>(options: Options<PostApiV1KnowledgeBasesByIdFilesBatchData, ThrowOnError>): RequestResult<PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesBatchErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesBatchErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -996,6 +1201,9 @@ export class KnowledgeBases extends HeyApiClient {
});
}
+ /**
+ * Move files to another knowledge base
+ */
public moveFiles<ThrowOnError extends boolean = false>(options: Options<PostApiV1KnowledgeBasesByIdFilesMoveData, ThrowOnError>): RequestResult<PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesByIdFilesMoveErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesByIdFilesMoveErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1030,6 +1238,9 @@ export class McpServers extends HeyApiClient {
});
}
+ /**
+ * Delete a remote MCP server
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1McpServersByIdData, ThrowOnError>): RequestResult<DeleteApiV1McpServersByIdResponses, DeleteApiV1McpServersByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1McpServersByIdResponses, DeleteApiV1McpServersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1038,6 +1249,9 @@ export class McpServers extends HeyApiClient {
});
}
+ /**
+ * Get a remote MCP server
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1McpServersByIdData, ThrowOnError>): RequestResult<GetApiV1McpServersByIdResponses, GetApiV1McpServersByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1McpServersByIdResponses, GetApiV1McpServersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1046,6 +1260,11 @@ export class McpServers extends HeyApiClient {
});
}
+ /**
+ * Update a remote MCP server
+ *
+ * Changing `serverUrl` or `credentials` resets the status to `disconnected`.
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1McpServersByIdData, ThrowOnError>): RequestResult<PatchApiV1McpServersByIdResponses, PatchApiV1McpServersByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1McpServersByIdResponses, PatchApiV1McpServersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1070,6 +1289,8 @@ export class McpServers extends HeyApiClient {
export class Memories extends HeyApiClient {
/**
* Get the current persona document
+ *
+ * `data` is null until a persona has been written.
*/
public getPersona<ThrowOnError extends boolean = false>(options?: Options<GetApiV1MemoriesPersonaData, ThrowOnError>): RequestResult<GetApiV1MemoriesPersonaResponses, GetApiV1MemoriesPersonaErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1MemoriesPersonaResponses, GetApiV1MemoriesPersonaErrors, ThrowOnError>({
@@ -1092,6 +1313,8 @@ export class Memories extends HeyApiClient {
/**
* Delete all memory entries
+ *
+ * Removes every memory, the persona and the per-topic extraction status; `count` is the number of memories removed.
*/
public deleteAll<ThrowOnError extends boolean = false>(options?: Options<DeleteApiV1MemoriesData, ThrowOnError>): RequestResult<DeleteApiV1MemoriesResponses, DeleteApiV1MemoriesErrors, ThrowOnError> {
return (options?.client ?? this.client).delete<DeleteApiV1MemoriesResponses, DeleteApiV1MemoriesErrors, ThrowOnError>({
@@ -1101,6 +1324,9 @@ export class Memories extends HeyApiClient {
});
}
+ /**
+ * Delete a memory entry
+ */
public deleteEntry<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MemoriesByCategoryByIdData, ThrowOnError>): RequestResult<DeleteApiV1MemoriesByCategoryByIdResponses, DeleteApiV1MemoriesByCategoryByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1MemoriesByCategoryByIdResponses, DeleteApiV1MemoriesByCategoryByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1109,6 +1335,11 @@ export class Memories extends HeyApiClient {
});
}
+ /**
+ * List the entries of a memory category
+ *
+ * Every identity, or the newest entries of the other categories; the array shape follows `category`.
+ */
public listCategory<ThrowOnError extends boolean = false>(options: Options<GetApiV1MemoriesByCategoryData, ThrowOnError>): RequestResult<GetApiV1MemoriesByCategoryResponses, GetApiV1MemoriesByCategoryErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1MemoriesByCategoryResponses, GetApiV1MemoriesByCategoryErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1119,6 +1350,11 @@ export class Memories extends HeyApiClient {
}
export class MessageTranslations extends HeyApiClient {
+ /**
+ * Delete a message's translation
+ *
+ * `id` is the id of the message whose translation was removed.
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1MessageTranslationsByMessageIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1MessageTranslationsByMessageIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1127,6 +1363,11 @@ export class MessageTranslations extends HeyApiClient {
});
}
+ /**
+ * Get a message's translation
+ *
+ * `null` when the message has no stored translation.
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1MessageTranslationsByMessageIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1MessageTranslationsByMessageIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1135,6 +1376,9 @@ export class MessageTranslations extends HeyApiClient {
});
}
+ /**
+ * Set a message's translation
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1MessageTranslationsByMessageIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1MessageTranslationsByMessageIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1144,6 +1388,9 @@ export class MessageTranslations extends HeyApiClient {
});
}
+ /**
+ * Translate a message
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1MessageTranslationsByMessageIdErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1MessageTranslationsByMessageIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1155,6 +1402,9 @@ export class MessageTranslations extends HeyApiClient {
}
export class Messages extends HeyApiClient {
+ /**
+ * Count messages
+ */
public getCount<ThrowOnError extends boolean = false>(options?: Options<GetApiV1MessagesCountData, ThrowOnError>): RequestResult<GetApiV1MessagesCountResponses, GetApiV1MessagesCountErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1MessagesCountResponses, GetApiV1MessagesCountErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1163,6 +1413,11 @@ export class Messages extends HeyApiClient {
});
}
+ /**
+ * Delete messages in batch
+ *
+ * Best effort: ids the caller may not delete or that no longer exist are skipped. `count` is the number of messages actually removed.
+ */
public deleteMany<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MessagesData, ThrowOnError>): RequestResult<DeleteApiV1MessagesResponses, DeleteApiV1MessagesErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1MessagesResponses, DeleteApiV1MessagesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1172,6 +1427,9 @@ export class Messages extends HeyApiClient {
});
}
+ /**
+ * List messages
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1MessagesData, ThrowOnError>): RequestResult<GetApiV1MessagesResponses, GetApiV1MessagesErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1MessagesResponses, GetApiV1MessagesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1180,6 +1438,9 @@ export class Messages extends HeyApiClient {
});
}
+ /**
+ * Create a message
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1MessagesData, ThrowOnError>): RequestResult<PostApiV1MessagesResponses, PostApiV1MessagesErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1MessagesResponses, PostApiV1MessagesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1189,6 +1450,9 @@ export class Messages extends HeyApiClient {
});
}
+ /**
+ * Delete a message
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MessagesByIdData, ThrowOnError>): RequestResult<DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1197,6 +1461,9 @@ export class Messages extends HeyApiClient {
});
}
+ /**
+ * Get a message
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1MessagesByIdData, ThrowOnError>): RequestResult<GetApiV1MessagesByIdResponses, GetApiV1MessagesByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1MessagesByIdResponses, GetApiV1MessagesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1205,6 +1472,11 @@ export class Messages extends HeyApiClient {
});
}
+ /**
+ * Create a user message and generate an AI reply
+ *
+ * Stores the user message, then generates and stores the assistant reply. Answers with the reply; `null` only if it could not be read back.
+ */
public createReply<ThrowOnError extends boolean = false>(options: Options<PostApiV1MessagesRepliesData, ThrowOnError>): RequestResult<PostApiV1MessagesRepliesResponses, PostApiV1MessagesRepliesErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1MessagesRepliesResponses, PostApiV1MessagesRepliesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1216,6 +1488,9 @@ export class Messages extends HeyApiClient {
}
export class Models extends HeyApiClient {
+ /**
+ * List models
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1ModelsData, ThrowOnError>): RequestResult<GetApiV1ModelsResponses, GetApiV1ModelsErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1ModelsResponses, GetApiV1ModelsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1224,6 +1499,9 @@ export class Models extends HeyApiClient {
});
}
+ /**
+ * Create a model
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ModelsData, ThrowOnError>): RequestResult<PostApiV1ModelsResponses, PostApiV1ModelsErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1ModelsResponses, PostApiV1ModelsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1233,6 +1511,9 @@ export class Models extends HeyApiClient {
});
}
+ /**
+ * Get a model
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1ModelsByProviderIdByModelIdData, ThrowOnError>): RequestResult<GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsByProviderIdByModelIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsByProviderIdByModelIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1241,6 +1522,9 @@ export class Models extends HeyApiClient {
});
}
+ /**
+ * Update a model
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1ModelsByProviderIdByModelIdData, ThrowOnError>): RequestResult<PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1ModelsByProviderIdByModelIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1ModelsByProviderIdByModelIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1252,6 +1536,11 @@ export class Models extends HeyApiClient {
}
export class Notifications extends HeyApiClient {
+ /**
+ * List notifications
+ *
+ * Unarchived notifications, newest first; pass the last `id` as `cursor` for the next page.
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1NotificationsData, ThrowOnError>): RequestResult<GetApiV1NotificationsResponses, GetApiV1NotificationsErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1NotificationsResponses, GetApiV1NotificationsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1273,6 +1562,8 @@ export class Notifications extends HeyApiClient {
/**
* Update notification delivery settings
+ *
+ * Answers with the merged settings now stored for the scope.
*/
public updateSettings<ThrowOnError extends boolean = false>(options: Options<PatchApiV1NotificationsSettingsData, ThrowOnError>): RequestResult<PatchApiV1NotificationsSettingsResponses, PatchApiV1NotificationsSettingsErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1NotificationsSettingsResponses, PatchApiV1NotificationsSettingsErrors, ThrowOnError>({
@@ -1305,6 +1596,9 @@ export class Notifications extends HeyApiClient {
});
}
+ /**
+ * Mark notifications as read
+ */
public markRead<ThrowOnError extends boolean = false>(options: Options<PostApiV1NotificationsReadData, ThrowOnError>): RequestResult<PostApiV1NotificationsReadResponses, PostApiV1NotificationsReadErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1NotificationsReadResponses, PostApiV1NotificationsReadErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1336,6 +1630,9 @@ export class Notifications extends HeyApiClient {
});
}
+ /**
+ * Archive a notification
+ */
public archive<ThrowOnError extends boolean = false>(options: Options<PostApiV1NotificationsByIdArchiveData, ThrowOnError>): RequestResult<PostApiV1NotificationsByIdArchiveResponses, PostApiV1NotificationsByIdArchiveErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1NotificationsByIdArchiveResponses, PostApiV1NotificationsByIdArchiveErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1346,6 +1643,9 @@ export class Notifications extends HeyApiClient {
}
export class Permissions extends HeyApiClient {
+ /**
+ * List permissions
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1PermissionsData, ThrowOnError>): RequestResult<GetApiV1PermissionsResponses, GetApiV1PermissionsErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1PermissionsResponses, GetApiV1PermissionsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1354,6 +1654,9 @@ export class Permissions extends HeyApiClient {
});
}
+ /**
+ * Create a permission
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1PermissionsData, ThrowOnError>): RequestResult<PostApiV1PermissionsResponses, PostApiV1PermissionsErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1PermissionsResponses, PostApiV1PermissionsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1363,6 +1666,9 @@ export class Permissions extends HeyApiClient {
});
}
+ /**
+ * Delete a permission
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1PermissionsByIdData, ThrowOnError>): RequestResult<DeleteApiV1PermissionsByIdResponses, DeleteApiV1PermissionsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1PermissionsByIdResponses, DeleteApiV1PermissionsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1371,6 +1677,9 @@ export class Permissions extends HeyApiClient {
});
}
+ /**
+ * Get a permission
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1PermissionsByIdData, ThrowOnError>): RequestResult<GetApiV1PermissionsByIdResponses, GetApiV1PermissionsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1PermissionsByIdResponses, GetApiV1PermissionsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1379,6 +1688,9 @@ export class Permissions extends HeyApiClient {
});
}
+ /**
+ * Update a permission
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1PermissionsByIdData, ThrowOnError>): RequestResult<PatchApiV1PermissionsByIdResponses, PatchApiV1PermissionsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1PermissionsByIdResponses, PatchApiV1PermissionsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1390,6 +1702,9 @@ export class Permissions extends HeyApiClient {
}
export class Providers extends HeyApiClient {
+ /**
+ * List providers
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1ProvidersData, ThrowOnError>): RequestResult<GetApiV1ProvidersResponses, GetApiV1ProvidersErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1ProvidersResponses, GetApiV1ProvidersErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1398,6 +1713,9 @@ export class Providers extends HeyApiClient {
});
}
+ /**
+ * Create a provider
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ProvidersData, ThrowOnError>): RequestResult<PostApiV1ProvidersResponses, PostApiV1ProvidersErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1ProvidersResponses, PostApiV1ProvidersErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1407,6 +1725,11 @@ export class Providers extends HeyApiClient {
});
}
+ /**
+ * Delete a provider
+ *
+ * Also removes the models configured under the provider.
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1ProvidersByIdData, ThrowOnError>): RequestResult<DeleteApiV1ProvidersByIdResponses, DeleteApiV1ProvidersByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1ProvidersByIdResponses, DeleteApiV1ProvidersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1415,6 +1738,9 @@ export class Providers extends HeyApiClient {
});
}
+ /**
+ * Get a provider
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1ProvidersByIdData, ThrowOnError>): RequestResult<GetApiV1ProvidersByIdResponses, GetApiV1ProvidersByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1ProvidersByIdResponses, GetApiV1ProvidersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1423,6 +1749,9 @@ export class Providers extends HeyApiClient {
});
}
+ /**
+ * Update a provider
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1ProvidersByIdData, ThrowOnError>): RequestResult<PatchApiV1ProvidersByIdResponses, PatchApiV1ProvidersByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1ProvidersByIdResponses, PatchApiV1ProvidersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1436,6 +1765,8 @@ export class Providers extends HeyApiClient {
export class PushTokens extends HeyApiClient {
/**
* Stop pushing to this device (sign-out)
+ *
+ * `id` is the device id. Idempotent: a stale `expoToken` removes nothing and leaves the rotated registration in place.
*/
public unregister<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1PushTokensByDeviceIdData, ThrowOnError>): RequestResult<DeleteApiV1PushTokensByDeviceIdResponses, DeleteApiV1PushTokensByDeviceIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1PushTokensByDeviceIdResponses, DeleteApiV1PushTokensByDeviceIdErrors, ThrowOnError>({
@@ -1459,6 +1790,11 @@ export class PushTokens extends HeyApiClient {
}
export class Responses extends HeyApiClient {
+ /**
+ * Create a model response
+ *
+ * OpenResponses-compatible: `model` takes an agent id. Without `stream` the response object is the whole JSON body (no success envelope); a run that fails still answers 200 with `status: "failed"` and `error`. With `stream: true` the same object arrives through `response.*` server-sent events.
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ResponsesData, ThrowOnError>): RequestResult<PostApiV1ResponsesResponses, PostApiV1ResponsesErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1ResponsesResponses, PostApiV1ResponsesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1470,6 +1806,9 @@ export class Responses extends HeyApiClient {
}
export class Roles extends HeyApiClient {
+ /**
+ * List roles
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1RolesData, ThrowOnError>): RequestResult<GetApiV1RolesResponses, GetApiV1RolesErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1RolesResponses, GetApiV1RolesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1478,6 +1817,9 @@ export class Roles extends HeyApiClient {
});
}
+ /**
+ * Create a role
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1RolesData, ThrowOnError>): RequestResult<PostApiV1RolesResponses, PostApiV1RolesErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1RolesResponses, PostApiV1RolesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1487,6 +1829,9 @@ export class Roles extends HeyApiClient {
});
}
+ /**
+ * Delete a role
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1RolesByIdData, ThrowOnError>): RequestResult<DeleteApiV1RolesByIdResponses, DeleteApiV1RolesByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1RolesByIdResponses, DeleteApiV1RolesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1495,6 +1840,9 @@ export class Roles extends HeyApiClient {
});
}
+ /**
+ * Get a role
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1RolesByIdData, ThrowOnError>): RequestResult<GetApiV1RolesByIdResponses, GetApiV1RolesByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1RolesByIdResponses, GetApiV1RolesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1503,6 +1851,9 @@ export class Roles extends HeyApiClient {
});
}
+ /**
+ * Update a role
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1RolesByIdData, ThrowOnError>): RequestResult<PatchApiV1RolesByIdResponses, PatchApiV1RolesByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1RolesByIdResponses, PatchApiV1RolesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1512,6 +1863,11 @@ export class Roles extends HeyApiClient {
});
}
+ /**
+ * Clear a role's permissions
+ *
+ * `count` is the number of permission mappings removed.
+ */
public deletePermissions<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1RolesByIdPermissionsData, ThrowOnError>): RequestResult<DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdPermissionsErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdPermissionsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1520,6 +1876,9 @@ export class Roles extends HeyApiClient {
});
}
+ /**
+ * List a role's permissions
+ */
public listPermissions<ThrowOnError extends boolean = false>(options: Options<GetApiV1RolesByIdPermissionsData, ThrowOnError>): RequestResult<GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdPermissionsErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdPermissionsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1528,6 +1887,11 @@ export class Roles extends HeyApiClient {
});
}
+ /**
+ * Update a role's permissions
+ *
+ * Grants and revokes permissions by id; returns how many mappings changed.
+ */
public updatePermissions<ThrowOnError extends boolean = false>(options: Options<PatchApiV1RolesByIdPermissionsData, ThrowOnError>): RequestResult<PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdPermissionsErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdPermissionsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1539,6 +1903,9 @@ export class Roles extends HeyApiClient {
}
export class Signals extends HeyApiClient {
+ /**
+ * Emit an agent signal source event
+ */
public emit<ThrowOnError extends boolean = false>(options: Options<PostApiV1SignalsSourceEventsData, ThrowOnError>): RequestResult<PostApiV1SignalsSourceEventsResponses, PostApiV1SignalsSourceEventsErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1SignalsSourceEventsResponses, PostApiV1SignalsSourceEventsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1548,6 +1915,9 @@ export class Signals extends HeyApiClient {
});
}
+ /**
+ * Trigger a synthesized agent signal source event
+ */
public trigger<ThrowOnError extends boolean = false>(options: Options<PostApiV1SignalsTriggerData, ThrowOnError>): RequestResult<PostApiV1SignalsTriggerResponses, PostApiV1SignalsTriggerErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1SignalsTriggerResponses, PostApiV1SignalsTriggerErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1557,6 +1927,9 @@ export class Signals extends HeyApiClient {
});
}
+ /**
+ * List agent signal receipts for a topic
+ */
public listReceipts<ThrowOnError extends boolean = false>(options: Options<GetApiV1SignalsReceiptsData, ThrowOnError>): RequestResult<GetApiV1SignalsReceiptsResponses, GetApiV1SignalsReceiptsErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1SignalsReceiptsResponses, GetApiV1SignalsReceiptsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1567,6 +1940,9 @@ export class Signals extends HeyApiClient {
}
export class Tasks extends HeyApiClient {
+ /**
+ * List tasks
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1TasksData, ThrowOnError>): RequestResult<GetApiV1TasksResponses, GetApiV1TasksErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1TasksResponses, GetApiV1TasksErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1575,6 +1951,9 @@ export class Tasks extends HeyApiClient {
});
}
+ /**
+ * Create a task
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1TasksData, ThrowOnError>): RequestResult<PostApiV1TasksResponses, PostApiV1TasksErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1TasksResponses, PostApiV1TasksErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1584,6 +1963,9 @@ export class Tasks extends HeyApiClient {
});
}
+ /**
+ * Delete a task
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1TasksByIdData, ThrowOnError>): RequestResult<DeleteApiV1TasksByIdResponses, DeleteApiV1TasksByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1TasksByIdResponses, DeleteApiV1TasksByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1592,6 +1974,9 @@ export class Tasks extends HeyApiClient {
});
}
+ /**
+ * Get a task
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1TasksByIdData, ThrowOnError>): RequestResult<GetApiV1TasksByIdResponses, GetApiV1TasksByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1TasksByIdResponses, GetApiV1TasksByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1600,6 +1985,9 @@ export class Tasks extends HeyApiClient {
});
}
+ /**
+ * Update a task
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1TasksByIdData, ThrowOnError>): RequestResult<PatchApiV1TasksByIdResponses, PatchApiV1TasksByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1TasksByIdResponses, PatchApiV1TasksByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1609,6 +1997,9 @@ export class Tasks extends HeyApiClient {
});
}
+ /**
+ * Change a task status
+ */
public updateStatus<ThrowOnError extends boolean = false>(options: Options<PatchApiV1TasksByIdStatusData, ThrowOnError>): RequestResult<PatchApiV1TasksByIdStatusResponses, PatchApiV1TasksByIdStatusErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1TasksByIdStatusResponses, PatchApiV1TasksByIdStatusErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1618,6 +2009,9 @@ export class Tasks extends HeyApiClient {
});
}
+ /**
+ * List past runs of a task
+ */
public listRuns<ThrowOnError extends boolean = false>(options: Options<GetApiV1TasksByIdRunsData, ThrowOnError>): RequestResult<GetApiV1TasksByIdRunsResponses, GetApiV1TasksByIdRunsErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1TasksByIdRunsResponses, GetApiV1TasksByIdRunsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1626,6 +2020,11 @@ export class Tasks extends HeyApiClient {
});
}
+ /**
+ * Run a task now
+ *
+ * Starts the run and answers once the agent operation is accepted; follow it with `operationId`.
+ */
public run<ThrowOnError extends boolean = false>(options: Options<PostApiV1TasksByIdRunsData, ThrowOnError>): RequestResult<PostApiV1TasksByIdRunsResponses, PostApiV1TasksByIdRunsErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1TasksByIdRunsResponses, PostApiV1TasksByIdRunsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1637,6 +2036,9 @@ export class Tasks extends HeyApiClient {
}
export class Topics extends HeyApiClient {
+ /**
+ * List topics
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1TopicsData, ThrowOnError>): RequestResult<GetApiV1TopicsResponses, GetApiV1TopicsErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1TopicsResponses, GetApiV1TopicsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1645,6 +2047,9 @@ export class Topics extends HeyApiClient {
});
}
+ /**
+ * Create a topic
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1TopicsData, ThrowOnError>): RequestResult<PostApiV1TopicsResponses, PostApiV1TopicsErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1TopicsResponses, PostApiV1TopicsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1654,6 +2059,9 @@ export class Topics extends HeyApiClient {
});
}
+ /**
+ * Delete a topic
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1TopicsByIdData, ThrowOnError>): RequestResult<DeleteApiV1TopicsByIdResponses, DeleteApiV1TopicsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1TopicsByIdResponses, DeleteApiV1TopicsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1662,6 +2070,9 @@ export class Topics extends HeyApiClient {
});
}
+ /**
+ * Get a topic
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1TopicsByIdData, ThrowOnError>): RequestResult<GetApiV1TopicsByIdResponses, GetApiV1TopicsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1TopicsByIdResponses, GetApiV1TopicsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1670,6 +2081,9 @@ export class Topics extends HeyApiClient {
});
}
+ /**
+ * Update a topic
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1TopicsByIdData, ThrowOnError>): RequestResult<PatchApiV1TopicsByIdResponses, PatchApiV1TopicsByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1TopicsByIdResponses, PatchApiV1TopicsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1694,6 +2108,8 @@ export class Topics extends HeyApiClient {
export class Users extends HeyApiClient {
/**
* Get current authenticated user
+ *
+ * Reachable by every authenticated caller. An API key without `user:read` receives only `{ id }`; `messageCount` is included only with `?includeCount=1` and `chat:read`.
*/
public me<ThrowOnError extends boolean = false>(options?: Options<GetApiV1UsersMeData, ThrowOnError>): RequestResult<GetApiV1UsersMeResponses, GetApiV1UsersMeErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1UsersMeResponses, GetApiV1UsersMeErrors, ThrowOnError>({
@@ -1703,6 +2119,9 @@ export class Users extends HeyApiClient {
});
}
+ /**
+ * List users
+ */
public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1UsersData, ThrowOnError>): RequestResult<GetApiV1UsersResponses, GetApiV1UsersErrors, ThrowOnError> {
return (options?.client ?? this.client).get<GetApiV1UsersResponses, GetApiV1UsersErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1711,6 +2130,9 @@ export class Users extends HeyApiClient {
});
}
+ /**
+ * Create a user
+ */
public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1UsersData, ThrowOnError>): RequestResult<PostApiV1UsersResponses, PostApiV1UsersErrors, ThrowOnError> {
return (options.client ?? this.client).post<PostApiV1UsersResponses, PostApiV1UsersErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1720,6 +2142,9 @@ export class Users extends HeyApiClient {
});
}
+ /**
+ * Delete a user
+ */
public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1UsersByIdData, ThrowOnError>): RequestResult<DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1728,6 +2153,9 @@ export class Users extends HeyApiClient {
});
}
+ /**
+ * Get a user
+ */
public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1UsersByIdData, ThrowOnError>): RequestResult<GetApiV1UsersByIdResponses, GetApiV1UsersByIdErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1UsersByIdResponses, GetApiV1UsersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1736,6 +2164,9 @@ export class Users extends HeyApiClient {
});
}
+ /**
+ * Update a user
+ */
public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1UsersByIdData, ThrowOnError>): RequestResult<PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1745,6 +2176,11 @@ export class Users extends HeyApiClient {
});
}
+ /**
+ * Clear a user's roles
+ *
+ * `count` is the number of role assignments removed.
+ */
public deleteRoles<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1UsersByIdRolesData, ThrowOnError>): RequestResult<DeleteApiV1UsersByIdRolesResponses, DeleteApiV1UsersByIdRolesErrors, ThrowOnError> {
return (options.client ?? this.client).delete<DeleteApiV1UsersByIdRolesResponses, DeleteApiV1UsersByIdRolesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1753,6 +2189,9 @@ export class Users extends HeyApiClient {
});
}
+ /**
+ * List a user's roles
+ */
public listRoles<ThrowOnError extends boolean = false>(options: Options<GetApiV1UsersByIdRolesData, ThrowOnError>): RequestResult<GetApiV1UsersByIdRolesResponses, GetApiV1UsersByIdRolesErrors, ThrowOnError> {
return (options.client ?? this.client).get<GetApiV1UsersByIdRolesResponses, GetApiV1UsersByIdRolesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1761,6 +2200,11 @@ export class Users extends HeyApiClient {
});
}
+ /**
+ * Update a user's roles
+ *
+ * Adds and removes role assignments, then returns all of the user's roles.
+ */
public updateRoles<ThrowOnError extends boolean = false>(options: Options<PatchApiV1UsersByIdRolesData, ThrowOnError>): RequestResult<PatchApiV1UsersByIdRolesResponses, PatchApiV1UsersByIdRolesErrors, ThrowOnError> {
return (options.client ?? this.client).patch<PatchApiV1UsersByIdRolesResponses, PatchApiV1UsersByIdRolesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
@@ -1815,6 +2259,11 @@ export class LobeHub extends HeyApiClient {
return this._apiKeys ??= new ApiKeys({ client: this.client });
}
+ private _audio?: Audio;
+ get audio(): Audio {
+ return this._audio ??= new Audio({ client: this.client });
+ }
+
private _chat?: Chat;
get chat(): Chat {
return this._chat ??= new Chat({ client: this.client });
diff --git a/packages/sdk/src/generated/types.gen.ts b/packages/sdk/src/generated/types.gen.ts
index 4927c391246..ac13ba4b5fa 100644
--- a/packages/sdk/src/generated/types.gen.ts
+++ b/packages/sdk/src/generated/types.gen.ts
@@ -10,76 +10,207 @@ export type ApiError = {
timestamp: string;
};
-export type AgentAccount = {
- accessedAt: string;
- agentId: string;
- capabilities: {
- login?: boolean | null;
- receive: boolean;
- send: boolean;
- sign?: boolean | null;
- };
+export type AgentGroup = {
createdAt: string;
- credentialHint?: {
+ id: string;
+ name: string;
+ sort: number | null;
+ updatedAt: string;
+};
+
+export type CreatedAgentGroup = {
+ id: string;
+};
+
+export type DeletedResource = {
+ deleted: true;
+ id: string;
+};
+
+export type AgentList = {
+ agents: Array<Agent>;
+ total: number;
+};
+
+export type Agent = {
+ agencyConfig: {
[key: string]: unknown;
} | null;
- displayName?: string | null;
- hasCredential: boolean;
+ avatar: string | null;
+ chatConfig: {
+ [key: string]: unknown;
+ } | null;
+ createdAt: string;
+ description: string | null;
id: string;
+ model: string | null;
+ params: {
+ [key: string]: unknown;
+ } | null;
+ personal: boolean;
+ plugins: Array<AgentPlugin>;
+ provider: string | null;
+ slug: string | null;
+ systemRole: string | null;
+ title: string | null;
+ updatedAt: string;
+};
+
+export type AgentPlugin = {
identifier: string;
- kind: 'mail' | 'wallet' | 'service' | 'phone';
- metadata?: {
+ mode: 'pinned' | 'auto' | 'disabled';
+};
+
+export type AgentDetail = {
+ agencyConfig: {
[key: string]: unknown;
} | null;
- provider: string;
- revokedAt?: string | null;
- status: 'provisioning' | 'active' | 'suspended' | 'revoked';
+ avatar: string | null;
+ chatConfig: {
+ [key: string]: unknown;
+ } | null;
+ createdAt: string;
+ description: string | null;
+ id: string;
+ model: string | null;
+ params: {
+ [key: string]: unknown;
+ } | null;
+ personal: boolean;
+ plugins: Array<AgentPlugin>;
+ provider: string | null;
+ slug: string | null;
+ systemRole: string | null;
+ title: string | null;
updatedAt: string;
- userId?: string;
- workspaceId?: string | null;
+ files: Array<AgentFile>;
+ knowledgeBases: Array<AgentKnowledgeBase>;
};
-export type ApiKey = {
+export type AgentFile = {
createdAt: string;
- enabled?: boolean | null;
- expiresAt?: string | null;
+ enabled: boolean | null;
+ fileType: string;
id: string;
- lastUsedAt?: string | null;
+ metadata: {
+ [key: string]: unknown;
+ } | null;
name: string;
- scopes?: Array<'*' | 'agent:read' | 'agent:write' | 'agent:credential:write' | 'eval:read' | 'eval:write' | 'chat:read' | 'chat:write' | 'model:invoke' | 'model:read' | 'model:write' | 'file:read' | 'file:write' | 'knowledge:read' | 'knowledge:write' | 'mcp:read' | 'mcp:write' | 'usage:read' | 'workspace:read' | 'workspace:write' | 'user:read' | 'user:write'> | null;
+ parentId: string | null;
+ size: number;
+ source: string | null;
updatedAt: string;
+ url: string;
+ visibility: 'private' | 'public';
};
-export type Agent = {
- avatar?: string | null;
- chatConfig?: {
+export type AgentKnowledgeBase = {
+ avatar: string | null;
+ createdAt: string;
+ description: string | null;
+ enabled: boolean | null;
+ id: string;
+ isPublic: boolean | null;
+ name: string;
+ settings: {
[key: string]: unknown;
} | null;
+ type: string | null;
+ updatedAt: string;
+ visibility: 'private' | 'public';
+};
+
+export type AgentAccountList = {
+ accounts: Array<AgentAccount>;
+ total: number;
+};
+
+export type AgentAccount = {
+ accessedAt: string;
+ agentId: string;
+ capabilities: AgentAccountCapabilities;
createdAt: string;
- description?: string | null;
+ credentialHint: {
+ expiresAt?: string;
+ masked?: string;
+ rotatedAt?: string;
+ username?: string;
+ } | null;
+ displayName: string | null;
+ hasCredential: boolean;
id: string;
- model?: string | null;
- params?: {
+ identifier: string;
+ kind: 'mail' | 'wallet' | 'service' | 'phone';
+ metadata: {
[key: string]: unknown;
} | null;
- personal?: boolean;
- plugins?: Array<{
- identifier: string;
- mode: 'pinned' | 'auto' | 'disabled';
- }>;
- provider?: string | null;
- slug?: string | null;
- systemRole?: string | null;
- title?: string | null;
+ provider: string;
+ revokedAt: string | null;
+ settings: {
+ wake?: {
+ digestMinutes?: number;
+ mode?: 'on' | 'off';
+ wakeSenders?: Array<string>;
+ };
+ };
+ status: 'provisioning' | 'active' | 'suspended' | 'revoked';
updatedAt: string;
+ userId: string;
+ workspaceId: string | null;
};
-export type AgentGroup = {
+export type AgentAccountCapabilities = {
+ login?: boolean;
+ receive: boolean;
+ send: boolean;
+ sign?: boolean;
+};
+
+export type ApiKey = {
+ createdAt: string;
+ enabled: boolean | null;
+ expiresAt: string | null;
+ id: string;
+ lastUsedAt: string | null;
+ name: string;
+ scopes: Array<'*' | 'agent:read' | 'agent:write' | 'agent:credential:write' | 'eval:read' | 'eval:write' | 'chat:read' | 'chat:write' | 'model:invoke' | 'model:read' | 'model:write' | 'file:read' | 'file:write' | 'knowledge:read' | 'knowledge:write' | 'mcp:read' | 'mcp:write' | 'usage:read' | 'workspace:read' | 'workspace:write' | 'user:read' | 'user:write'> | null;
+ updatedAt: string;
+};
+
+export type CreatedApiKey = {
createdAt: string;
+ enabled: boolean | null;
+ expiresAt: string | null;
id: string;
+ lastUsedAt: string | null;
name: string;
- sort?: number | null;
+ scopes: Array<'*' | 'agent:read' | 'agent:write' | 'agent:credential:write' | 'eval:read' | 'eval:write' | 'chat:read' | 'chat:write' | 'model:invoke' | 'model:read' | 'model:write' | 'file:read' | 'file:write' | 'knowledge:read' | 'knowledge:write' | 'mcp:read' | 'mcp:write' | 'usage:read' | 'workspace:read' | 'workspace:write' | 'user:read' | 'user:write'> | null;
updatedAt: string;
+ key: string;
+};
+
+export type ChatResponse = {
+ content: string;
+ model: string;
+ provider: string;
+ usage?: {
+ completion_tokens?: number;
+ prompt_tokens?: number;
+ total_tokens?: number;
+ };
+};
+
+export type ChatTranslateResponse = {
+ translatedText: string;
+};
+
+export type ChatGenerateReplyResponse = {
+ reply: string;
+};
+
+export type ChatGroupList = {
+ chatGroups: Array<ChatGroup>;
+ total: number;
};
export type ChatGroup = {
@@ -88,265 +219,2341 @@ export type ChatGroup = {
createdAt: string;
description: string | null;
id: string;
- members: Array<{
- agentId: string;
- enabled: boolean | null;
- order: number | null;
- role: 'supervisor' | 'participant' | 'assistant' | null;
- }>;
+ members: Array<ChatGroupMember>;
personal: boolean;
pinned: boolean | null;
title: string | null;
updatedAt: string;
};
-export type ChatResponse = {
- content: string;
- model?: string | null;
- provider?: string | null;
- usage?: {
- completion_tokens?: number | null;
- prompt_tokens?: number | null;
- total_tokens?: number | null;
- } | null;
+export type ChatGroupMember = {
+ agentId: string;
+ enabled: boolean | null;
+ order: number | null;
+ role: 'supervisor' | 'participant' | 'assistant' | null;
};
export type EvalRun = {
+ config: {
+ caseSelection?: {
+ caseIds?: Array<string>;
+ mode: 'all' | 'include' | 'exclude';
+ };
+ k: number;
+ maxConcurrency?: number;
+ maxSteps?: number;
+ timeout?: number;
+ };
createdAt: string;
datasetId: string;
+ executionMode: 'internal' | 'external';
+ experimentId: string | null;
id: string;
- metrics?: {
- [key: string]: unknown;
- } | null;
- name?: string | null;
- startedAt?: string | null;
+ metrics: EvalRunMetrics | null;
+ name: string | null;
+ parentRunId: string | null;
+ startedAt: string | null;
status: 'idle' | 'pending' | 'running' | 'completed' | 'failed' | 'aborted' | 'external';
- targetAgentId?: string | null;
+ targetAgentId: string | null;
updatedAt: string;
};
-export type EvalRunResult = {
+export type EvalRunMetrics = {
+ averageScore?: number;
+ completedCases?: number;
+ cost?: number;
+ duration?: number;
+ errorCases?: number;
+ externalCases?: number;
+ failedCases?: number;
+ judgeErrorCases?: number;
+ llmCalls?: number;
+ passAllAt?: {
+ [key: string]: number;
+ };
+ passAllK?: number;
+ passAnyAt?: {
+ [key: string]: number;
+ };
+ passAtK?: number;
+ passedCases?: number;
+ passRate?: number;
+ perCaseCost?: number;
+ perCaseLlmCalls?: number;
+ perCaseSteps?: number;
+ perCaseTokens?: number;
+ perCaseToolCalls?: number;
+ rubricScores?: {
+ [key: string]: number;
+ };
+ steps?: number;
+ timeoutCases?: number;
+ tokens?: number;
+ toolCalls?: number;
+ totalCases?: number;
+ totalCost?: number;
+ totalDuration?: number;
+ totalTokens?: number;
+};
+
+export type EvalRunTopic = {
createdAt: string;
+ evalResult: EvalStoredResult | null;
input: string;
- passed?: boolean | null;
- result?: {
+ passed: boolean | null;
+ runId: string;
+ score: number | null;
+ status: 'pending' | 'running' | 'passed' | 'failed' | 'error' | 'timeout' | 'external' | 'completed' | 'judge_error' | null;
+ testCaseId: string;
+ topicId: string;
+};
+
+export type EvalStoredResult = {
+ awaitingExternalEval?: boolean;
+ completionReason?: string;
+ cost?: number;
+ duration?: number;
+ error?: string;
+ externalResult?: {
[key: string]: unknown;
- } | null;
- score?: number | null;
- status?: string | null;
+ };
+ externalThreadResults?: {
+ [key: string]: unknown;
+ };
+ extractedAnswer?: string;
+ llmCalls?: number;
+ passAllK?: boolean;
+ passAtK?: boolean;
+ rubricScores?: Array<EvalRubricScore>;
+ steps?: number;
+ threads?: Array<{
+ completionReason?: string;
+ cost?: number;
+ duration?: number;
+ error?: string;
+ llmCalls?: number;
+ passed?: boolean;
+ rubricScores?: Array<EvalRubricScore>;
+ score?: number;
+ status?: 'error' | 'external' | 'failed' | 'passed' | 'running' | 'timeout' | 'completed' | 'judge_error';
+ steps?: number;
+ threadId: string;
+ tokens?: number;
+ toolCalls?: number;
+ errorPhase?: 'judge';
+ executionId?: string;
+ judgeError?: string;
+ judges?: Array<{
+ model: string;
+ provider: string;
+ }>;
+ memorySnapshot?: {
+ [key: string]: unknown;
+ };
+ operationId?: string;
+ }>;
+ tokens?: number;
+ toolCalls?: number;
+ totalCost?: number;
+ totalDuration?: number;
+ totalTokens?: number;
+ dispatchedAt?: string;
+ errorDetail?: unknown;
+ errorPhase?: 'judge';
+ executionId?: string;
+ judgeError?: string;
+ judges?: Array<{
+ model: string;
+ provider: string;
+ }>;
+ memorySnapshot?: {
+ [key: string]: unknown;
+ };
+ operationId?: string;
+};
+
+export type EvalRubricScore = {
+ reason?: string;
+ rubricId: string;
+ score: number;
+ verdicts?: Array<{
+ reason?: string;
+ rule: string;
+ verdict: 'satisfied' | 'unverifiable' | 'violated';
+ }>;
+};
+
+export type EvalRunResult = {
+ createdAt: string;
+ input: string;
+ passed: boolean | null;
+ result: EvalCaseResult | null;
+ score: number | null;
+ status: 'pending' | 'running' | 'passed' | 'failed' | 'error' | 'timeout' | 'external' | 'completed' | 'judge_error' | null;
testCaseId: string;
topicId: string;
};
-export type File = {
+export type EvalCaseResult = {
+ awaitingExternalEval?: boolean;
+ completionReason?: string;
+ cost?: number;
+ duration?: number;
+ error?: string;
+ externalResult?: {
+ [key: string]: unknown;
+ };
+ externalThreadResults?: {
+ [key: string]: unknown;
+ };
+ extractedAnswer?: string;
+ llmCalls?: number;
+ passAllK?: boolean;
+ passAtK?: boolean;
+ rubricScores?: Array<EvalRubricScore>;
+ steps?: number;
+ threads?: Array<EvalThreadResult>;
+ tokens?: number;
+ toolCalls?: number;
+ totalCost?: number;
+ totalDuration?: number;
+ totalTokens?: number;
+};
+
+export type EvalThreadResult = {
+ completionReason?: string;
+ cost?: number;
+ duration?: number;
+ error?: string;
+ llmCalls?: number;
+ passed?: boolean;
+ rubricScores?: Array<EvalRubricScore>;
+ score?: number;
+ status?: 'error' | 'external' | 'failed' | 'passed' | 'running' | 'timeout' | 'completed' | 'judge_error';
+ steps?: number;
+ threadId: string;
+ tokens?: number;
+ toolCalls?: number;
+};
+
+export type EvalBenchmark = {
createdAt: string;
- fileType: string;
+ description: string | null;
id: string;
- metadata?: {
+ identifier: string;
+ isSystem: boolean;
+ metadata: {
[key: string]: unknown;
} | null;
name: string;
- parentId?: string | null;
- size: number;
- source?: string | null;
+ referenceUrl: string | null;
+ rubrics: Array<EvalBenchmarkRubric>;
updatedAt: string;
- url: string;
- visibility?: 'private' | 'public';
- [key: string]: unknown;
};
-export type KnowledgeBase = {
- avatar?: string | null;
- createdAt: string;
- description?: string | null;
+export type EvalBenchmarkRubric = {
+ config: {
+ value: string;
+ threshold?: number;
+ } | {
+ value: number;
+ tolerance?: number;
+ } | {
+ pattern: string;
+ } | {
+ code: string;
+ } | {
+ criteria: string;
+ model?: string;
+ provider?: string;
+ systemRole?: string;
+ } | {
+ values: Array<string>;
+ caseSensitive?: boolean;
+ } | {
+ schema: {
+ [key: string]: unknown;
+ };
+ } | {
+ extractor: {
+ type: 'regex';
+ pattern: string;
+ group?: number;
+ } | {
+ type: 'delimiter';
+ delimiter: string;
+ position?: 'first' | 'last';
+ } | {
+ type: 'last-line';
+ trim?: boolean;
+ } | {
+ type: 'choice-index';
+ labels?: Array<string>;
+ pattern?: string;
+ };
+ innerMatcher?: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external';
+ };
+ extractor?: {
+ type: 'regex';
+ pattern: string;
+ group?: number;
+ } | {
+ type: 'delimiter';
+ delimiter: string;
+ position?: 'first' | 'last';
+ } | {
+ type: 'last-line';
+ trim?: boolean;
+ } | {
+ type: 'choice-index';
+ labels?: Array<string>;
+ pattern?: string;
+ };
id: string;
- isPublic?: boolean | null;
name: string;
- settings?: {
- [key: string]: unknown;
- } | null;
- type?: string | null;
- updatedAt: string;
- visibility?: 'private' | 'public';
- [key: string]: unknown;
+ threshold?: number;
+ type: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'rule-checklist' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external';
+ weight: number;
};
-export type Message = {
- agentId?: string | null;
- content?: string | null;
+export type EvalDataset = {
+ benchmarkId: string | null;
createdAt: string;
- error?: {
+ description: string | null;
+ evalConfig: {
[key: string]: unknown;
} | null;
- favorite?: boolean | null;
+ evalMode: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'rule-checklist' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external' | null;
id: string;
- metadata?: {
- [key: string]: unknown;
- } | null;
- model?: string | null;
- parentId?: string | null;
- provider?: string | null;
- reasoning?: {
+ identifier: string;
+ metadata: {
[key: string]: unknown;
} | null;
- role: string;
- search?: {
+ name: string;
+ sourceExperimentId: string | null;
+ testCaseCount: number;
+ updatedAt: string;
+};
+
+export type EvalTestCase = {
+ caseId?: string;
+ category?: string;
+ choices?: Array<string>;
+ content: {
+ category?: string;
+ choices?: Array<string>;
+ environment?: {
+ [key: string]: unknown;
+ };
+ expected?: string;
+ input: string;
+ messages?: Array<{
+ content: string;
+ role: 'user' | 'assistant' | 'system' | 'tool';
+ id?: string;
+ parentId?: string | null;
+ model?: string;
+ provider?: string;
+ createdAt?: string | number;
+ updatedAt?: string | number;
+ tools?: Array<{
+ [key: string]: unknown;
+ }>;
+ tool_call_id?: string;
+ metadata?: {
+ [key: string]: unknown;
+ };
+ reasoning?: {
+ [key: string]: unknown;
+ };
+ plugin?: {
+ [key: string]: unknown;
+ };
+ pluginState?: {
+ [key: string]: unknown;
+ };
+ pluginError?: {
+ [key: string]: unknown;
+ };
+ pluginIntervention?: {
+ [key: string]: unknown;
+ };
+ error?: {
+ [key: string]: unknown;
+ };
+ search?: {
+ [key: string]: unknown;
+ };
+ }>;
+ };
+ createdAt: string;
+ datasetId: string;
+ environment?: {
[key: string]: unknown;
- } | null;
- threadId?: string | null;
- tools?: {
+ };
+ evalConfig: {
[key: string]: unknown;
} | null;
- topicId?: string | null;
- updatedAt: string;
- usage?: {
- [key: string]: unknown;
+ evalMode: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'rule-checklist' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external' | null;
+ expected?: string;
+ id: string;
+ input: string;
+ messages?: Array<{
+ content: string;
+ role: 'user' | 'assistant' | 'system' | 'tool';
+ id?: string;
+ parentId?: string | null;
+ model?: string;
+ provider?: string;
+ createdAt?: string | number;
+ updatedAt?: string | number;
+ tools?: Array<{
+ [key: string]: unknown;
+ }>;
+ tool_call_id?: string;
+ metadata?: {
+ [key: string]: unknown;
+ };
+ reasoning?: {
+ [key: string]: unknown;
+ };
+ plugin?: {
+ [key: string]: unknown;
+ };
+ pluginState?: {
+ [key: string]: unknown;
+ };
+ pluginError?: {
+ [key: string]: unknown;
+ };
+ pluginIntervention?: {
+ [key: string]: unknown;
+ };
+ error?: {
+ [key: string]: unknown;
+ };
+ search?: {
+ [key: string]: unknown;
+ };
+ }>;
+ metadata: {
+ [key: string]: unknown;
+ } | null;
+ sortOrder: number | null;
+ updatedAt: string;
+};
+
+export type EvalRetryErrors = {
+ retryCount: number;
+ runId: string;
+};
+
+export type EvalReportResult = {
+ idempotent: boolean;
+ reportedThreads: number;
+ runId: string;
+ success: true;
+ threadId?: string;
+ topicFinalized: boolean;
+ topicId: string;
+ totalThreads: number;
+ runStatus: 'idle' | 'pending' | 'running' | 'completed' | 'failed' | 'aborted' | 'external';
+};
+
+export type EvalBatchReportResult = {
+ items: Array<EvalReportReceipt>;
+ runId: string;
+ runStatus: 'idle' | 'pending' | 'running' | 'completed' | 'failed' | 'aborted' | 'external';
+ success: true;
+};
+
+export type EvalReportReceipt = {
+ idempotent: boolean;
+ reportedThreads: number;
+ runId: string;
+ success: true;
+ threadId?: string;
+ topicFinalized: boolean;
+ topicId: string;
+ totalThreads: number;
+};
+
+export type InstalledPluginList = {
+ plugins: Array<InstalledPlugin>;
+ total: number;
+};
+
+export type InstalledPlugin = {
+ createdAt: string;
+ identifier: string;
+ type: 'plugin' | 'customPlugin';
+ updatedAt: string;
+};
+
+export type FileList = {
+ files: Array<FileListItem>;
+ total: number;
+ totalSize: string;
+};
+
+export type FileListItem = {
+ createdAt: string;
+ fileType: string;
+ id: string;
+ metadata: {
+ [key: string]: unknown;
+ } | null;
+ name: string;
+ parentId: string | null;
+ size: number;
+ source: string | null;
+ updatedAt: string;
+ url: string;
+ visibility: 'private' | 'public';
+ chunking: FileAsyncTask | null;
+ embedding: FileAsyncTask | null;
+ knowledgeBases: Array<FileKnowledgeBaseRef>;
+ users: Array<FileUser>;
+};
+
+export type FileAsyncTask = {
+ count?: number | null;
+ error: AsyncTaskError | null;
+ id?: string;
+ status: 'error' | 'pending' | 'processing' | 'success' | null;
+ type?: 'chunk' | 'embedding';
+};
+
+export type AsyncTaskError = {
+ body: string | {
+ detail: string;
+ retryAt?: string;
+ };
+ name: string;
+};
+
+export type FileKnowledgeBaseRef = {
+ avatar: string | null;
+ description: string | null;
+ id: string;
+ name: string;
+};
+
+export type FileUser = {
+ avatar: string | null;
+ email: string | null;
+ fullName: string | null;
+ id: string;
+ username: string | null;
+};
+
+export type FileDetail = {
+ file: File;
+ parsed?: FileParseResult;
+};
+
+export type File = {
+ createdAt: string;
+ fileType: string;
+ id: string;
+ metadata: {
+ [key: string]: unknown;
+ } | null;
+ name: string;
+ parentId: string | null;
+ size: number;
+ source: string | null;
+ updatedAt: string;
+ url: string;
+ visibility: 'private' | 'public';
+};
+
+export type FileParseResult = {
+ content?: string | null;
+ error?: string;
+ fileId: string;
+ fileType: string;
+ metadata?: {
+ pages: number;
+ title?: string;
+ totalCharCount?: number;
+ totalLineCount?: number;
+ };
+ name: string;
+ parseStatus: 'completed' | 'failed';
+ parsedAt?: string;
+};
+
+export type FileUrl = {
+ expiresAt: string;
+ expiresIn: number;
+ fileId: string;
+ name: string;
+ url: string;
+};
+
+export type FileChunkTask = {
+ chunkTaskId: string | null;
+ embeddingTaskId: string | null;
+ fileId: string;
+ message: string;
+ success: true;
+};
+
+export type FileChunkStatus = {
+ chunkCount: number;
+ chunkingError: AsyncTaskError | null;
+ chunkingStatus: 'error' | 'pending' | 'processing' | 'success' | null;
+ embeddingError: AsyncTaskError | null;
+ embeddingStatus: 'error' | 'pending' | 'processing' | 'success' | null;
+ finishEmbedding: boolean;
+};
+
+export type BatchFileUploadResult = {
+ failed: Array<{
+ error: string;
+ name: string;
+ }>;
+ successful: Array<FileDetail>;
+ summary: {
+ failed: number;
+ successful: number;
+ total: number;
+ };
+};
+
+export type BatchGetFilesResult = {
+ failed: Array<{
+ error: string;
+ fileId: string;
+ }>;
+ files: Array<FileDetail>;
+ success: number;
+ total: number;
+};
+
+export type GoalList = {
+ goals: Array<GoalListItem>;
+ total: number;
+};
+
+export type GoalListItem = {
+ findingCount: number;
+ goal: Goal;
+ pendingDecisions: number;
+ signedOff: boolean;
+ taskDone: number;
+ taskTotal: number;
+ totalRunCost: number;
+ totalRunDuration: number;
+};
+
+export type Goal = {
+ agentId: string | null;
+ archivedAt: string | null;
+ completedAt: string | null;
+ config: {
+ [key: string]: unknown;
+ } | null;
+ createdAt: string;
+ deletedAt: string | null;
+ id: string;
+ isDeleted: boolean | null;
+ maxRounds: number | null;
+ maxTotalCost: number | null;
+ projectId: string | null;
+ requirement: string | null;
+ startedAt: string | null;
+ status: 'draft' | 'planning' | 'running' | 'verifying' | 'review' | 'paused' | 'achieved' | 'failed' | 'canceled';
+ subjectId: string | null;
+ subjectType: 'task' | 'topic' | 'standalone' | null;
+ title: string;
+ updatedAt: string;
+ userId: string;
+ visibility: 'private' | 'public';
+ workspaceId: string | null;
+};
+
+export type GoalGraphSnapshot = {
+ decisions: Array<GoalGraphDecision>;
+ edges: Array<GoalGraphEdge>;
+ events: Array<GoalGraphEvent>;
+ goal: Goal;
+ nodes: Array<GoalGraphNode>;
+ workVersions: Array<GoalGraphWorkVersionLink>;
+};
+
+export type GoalGraphDecision = {
+ accessedAt: string;
+ authority: 'agent' | 'user' | 'project_role';
+ canceledAt: string | null;
+ createdAt: string;
+ id: string;
+ nodeId: string;
+ options: Array<GoalDecisionOption> | null;
+ question: string;
+ recommendedOptionId: string | null;
+ requestedProjectRole: string | null;
+ requestedUserId: string | null;
+ resolution: string | null;
+ resolvedAt: string | null;
+ resolvedByAgentId: string | null;
+ resolvedByUserId: string | null;
+ resolvedOptionId: string | null;
+ status: 'pending' | 'resolved' | 'canceled';
+ updatedAt: string;
+};
+
+export type GoalDecisionOption = {
+ alsoRetires?: Array<{
+ nodeId: string;
+ title: string;
+ }>;
+ description?: string;
+ effect?: 'retry' | 'retire' | 'retry_after_reset';
+ id: string;
+ label: string;
+};
+
+export type GoalGraphEdge = {
+ createdAt: string;
+ goalId: string;
+ id: string;
+ kind: 'contains' | 'answers' | 'decomposes' | 'depends_on' | 'derived_from' | 'revises' | 'investigates' | 'produces' | 'supports' | 'contradicts' | 'leads_to' | 'confirms' | 'refutes';
+ sourceNodeId: string;
+ targetNodeId: string;
+};
+
+export type GoalGraphEvent = {
+ actorId: string | null;
+ actorType: 'agent' | 'user' | 'system';
+ createdAt: string;
+ entityId: string;
+ entityType: 'goal' | 'node' | 'edge' | 'decision' | 'task';
+ eventType: 'created' | 'updated' | 'activated' | 'resolved' | 'rejected' | 'retired' | 'linked' | 'unlinked';
+ goalId: string;
+ id: string;
+ operationId: string | null;
+ reason: string | null;
+ taskId: string | null;
+};
+
+export type GoalGraphNode = {
+ accessedAt: string;
+ confidence: string | null;
+ createdAt: string;
+ createdByAgentId: string | null;
+ createdByUserId: string | null;
+ description: string | null;
+ goalId: string;
+ id: string;
+ kind: 'problem' | 'experiment' | 'task' | 'finding' | 'decision' | 'batch' | 'pattern' | 'tool' | 'hazard' | 'dead_end' | 'template';
+ priority: number;
+ resolvedAt: string | null;
+ status: 'proposed' | 'active' | 'waiting' | 'resolved' | 'rejected' | 'retired';
+ taskId: string | null;
+ title: string;
+ updatedAt: string;
+};
+
+export type GoalGraphWorkVersionLink = {
+ createdAt: string;
+ id: string;
+ nodeId: string;
+ relation: 'input' | 'produced' | 'supports' | 'contradicts';
+ work?: {
+ agentDocumentId?: string;
+ fileId?: string;
+ fileSize?: number;
+ fileUrl?: string;
+ identifier: string | null;
+ mimeType?: string;
+ resourceId: string | null;
+ resourceType?: 'canvas' | 'document' | 'github_issue' | 'github_pull_request' | 'linear_document' | 'linear_issue' | 'file' | 'goal_report' | 'task';
+ status: string | null;
+ title: string | null;
+ type: 'canvas' | 'document' | 'external' | 'file' | 'goal_report' | 'task';
+ url: string | null;
+ workId: string;
+ };
+ workVersionId: string;
+};
+
+export type GoalGraph = {
+ decisions: Array<GoalGraphDecision>;
+ edges: Array<GoalGraphEdge>;
+ events: Array<GoalGraphEvent>;
+ goal: Goal;
+ nodes: Array<GoalGraphNode>;
+ workVersions: Array<GoalGraphWorkVersionLink>;
+ acceptances?: {
+ [key: string]: {
+ checks?: {
+ failed: number;
+ passed: number;
+ total: number;
+ unjudged: number;
+ };
+ id: string;
+ status: 'pending' | 'planned' | 'verifying' | 'repairing' | 'delivered' | 'accepted' | 'closed' | 'rejected' | 'errored';
+ };
+ };
+ assignees?: {
+ [key: string]: string;
+ };
+ deliveredAt?: {
+ [key: string]: string;
+ };
+ metricCriteria: {
+ allMet: boolean;
+ criteria: Array<{
+ key: string;
+ met: boolean;
+ observedAt?: number;
+ op: string;
+ target: number;
+ value: number | null;
+ }>;
+ };
+ quotaRetryAt?: {
+ [key: string]: string;
+ };
+ report?: {
+ dispatch: {
+ acceptanceKey: string;
+ dispatchedAt: string;
+ error?: string;
+ nodeId: string;
+ operationId?: string;
+ taskId?: string;
+ trigger: 'accepted' | 'acceptance_failed' | 'goal_canceled' | 'goal_failed';
+ };
+ latest?: {
+ content: string | null;
+ createdAt: string;
+ metadata: {
+ chapters: Array<{
+ detours?: Array<{
+ kind: 'dead_end' | 'superseded' | 'retry';
+ lesson: string;
+ nodeIds: Array<string>;
+ reason: string;
+ title: string;
+ }>;
+ findingIds?: Array<string>;
+ narrative: string;
+ nodeIds?: Array<string>;
+ title: string;
+ workVersionIds?: Array<string>;
+ }>;
+ deliverableWorkId?: string;
+ graphCursor: string;
+ headline: string;
+ mainline?: {
+ edgeIds?: Array<string>;
+ nodeIds: Array<string>;
+ };
+ nextSteps?: Array<{
+ nodeIds?: Array<string>;
+ reason: string;
+ title: string;
+ }>;
+ };
+ pageDocumentId?: string;
+ version: number;
+ workId: string;
+ workVersionId: string;
+ };
+ status: 'completed' | 'failed' | 'running';
+ };
+ runHeartbeats?: {
+ [key: string]: string;
+ };
+ spend: {
+ byTask: Array<{
+ runs: number;
+ taskId: string;
+ totalCost: number;
+ totalInputTokens: number;
+ totalOutputTokens: number;
+ totalTokens: number;
+ }>;
+ runs: number;
+ totalCost: number;
+ totalInputTokens: number;
+ totalOutputTokens: number;
+ totalTokens: number;
+ };
+};
+
+export type GoalSupervision = {
+ enabled: boolean;
+ state?: {
+ agentId: string;
+ incidents: Array<{
+ createdAt: string;
+ eligible: boolean;
+ failedOperationId: string;
+ id: string;
+ inspected?: {
+ artifactVersionIds?: Array<string>;
+ goal?: boolean;
+ task?: boolean;
+ };
+ nodeId: string;
+ reason: string;
+ recoveryInstruction?: string;
+ recoveryOperationId?: string;
+ resolution?: {
+ action: 'retry' | 'escalate';
+ instruction: string;
+ reason: string;
+ toolCallId: string;
+ };
+ resolvedAt?: string;
+ status: 'diagnosing' | 'retrying' | 'recovered' | 'escalated' | 'unsuccessful' | 'human_resumed';
+ supervisorOperationId?: string;
+ taskId: string;
+ taskStatus?: string;
+ }>;
+ revision: number;
+ topicId: string;
+ };
+};
+
+export type GoalAdvanceResult = {
+ goalId: string;
+ message: string;
+ nodeId?: string;
+ outcome: 'advanced' | 'achieved' | 'waiting_human' | 'waiting_external' | 'no_progress' | 'failed';
+ taskId?: string;
+ ticks: number;
+};
+
+export type GoalRestartResult = {
+ goal: Goal;
+ restartedTaskIds: Array<string>;
+};
+
+export type ImSendResult = {
+ accepted: boolean;
+ operationId: string | null;
+ topicId: string;
+ userMessage: ImMessage;
+};
+
+export type ImMessage = {
+ agentId: string | null;
+ content: string;
+ createdAt: string;
+ error: boolean;
+ files?: Array<{
+ fileType: string;
+ id: string;
+ name: string;
+ size: number;
+ url: string;
+ }>;
+ id: string;
+ role: 'assistant' | 'user';
+};
+
+export type ImSyncResult = {
+ cursor: string;
+ messages: Array<ImMessage>;
+ readUpTo: {
+ messageId: string;
+ readAt: string;
+ } | null;
+ state: string;
+ typing: boolean;
+ unread: number;
+};
+
+export type ImReadResult = {
+ unread: number;
+};
+
+export type KnowledgeBaseList = {
+ knowledgeBases: Array<KnowledgeBaseListItem>;
+ total: number;
+};
+
+export type KnowledgeBaseListItem = {
+ avatar: string | null;
+ createdAt: string;
+ description: string | null;
+ id: string;
+ isPublic: boolean | null;
+ name: string;
+ settings: {
+ [key: string]: unknown;
+ } | null;
+ type: string | null;
+ updatedAt: string;
+ visibility: 'private' | 'public';
+ accessType: 'owner' | 'userGrant' | 'roleGrant' | 'public';
+};
+
+export type KnowledgeBaseDetail = {
+ knowledgeBase: KnowledgeBase;
+};
+
+export type KnowledgeBase = {
+ avatar: string | null;
+ createdAt: string;
+ description: string | null;
+ id: string;
+ isPublic: boolean | null;
+ name: string;
+ settings: {
+ [key: string]: unknown;
+ } | null;
+ type: string | null;
+ updatedAt: string;
+ visibility: 'private' | 'public';
+};
+
+export type KnowledgeBaseFileOperationResult = {
+ failed: Array<{
+ fileId: string;
+ reason: string;
+ }>;
+ successed: Array<string>;
+};
+
+export type McpServer = {
+ createdAt: string;
+ description: string | null;
+ hasCredentials: boolean;
+ id: string;
+ identifier: string;
+ isEnabled: boolean;
+ name: string;
+ serverUrl: string;
+ status: 'connected' | 'disconnected' | 'error';
+ tools: Array<McpServerTool>;
+ updatedAt: string;
+};
+
+export type McpServerTool = {
+ description: string | null;
+ id: string;
+ inputSchema: {
+ [key: string]: unknown;
+ } | null;
+ name: string;
+ permission: 'auto' | 'disabled' | 'needs_approval';
+};
+
+export type McpServerSyncResult = {
+ id: string;
+ status: 'connected';
+ toolCount: number;
+};
+
+export type MemoryPersona = {
+ content: string;
+ summary: string;
+};
+
+export type MemoryPersonaVersion = {
+ createdAt: string;
+ id: string;
+ nextVersion: number | null;
+ previousVersion: number | null;
+ snapshotPersona: string | null;
+ snapshotTagline: string | null;
+};
+
+export type DeletedResources = {
+ count: number;
+ deleted: true;
+};
+
+export type MemoryCategoryEntries = Array<MemoryIdentity> | Array<MemoryPreference> | Array<MemoryContext> | Array<MemoryActivity> | Array<MemoryExperience>;
+
+export type MemoryIdentity = {
+ accessedAt: string;
+ capturedAt: string;
+ createdAt: string;
+ id: string;
+ metadata: {
+ [key: string]: unknown;
+ } | null;
+ tags: Array<string> | null;
+ type: string | null;
+ updatedAt: string;
+ userId: string | null;
+ description: string | null;
+ entityId: string | null;
+ episodicDate: string | null;
+ relationship: string | null;
+ role: string | null;
+ userMemoryId: string | null;
+};
+
+export type MemoryPreference = {
+ accessedAt: string;
+ capturedAt: string;
+ createdAt: string;
+ id: string;
+ metadata: {
+ [key: string]: unknown;
+ } | null;
+ tags: Array<string> | null;
+ type: string | null;
+ updatedAt: string;
+ userId: string | null;
+ appliesToEntityId: string | null;
+ conclusionDirectives: string | null;
+ evidenceCount: number;
+ evidenceSource: 'stated' | 'reported' | 'inferred' | null;
+ holderEntityId: string | null;
+ lastEvidenceAt: string | null;
+ scope: string | null;
+ scorePriority: number | null;
+ suggestions: string | null;
+ userMemoryId: string | null;
+};
+
+export type MemoryContext = {
+ accessedAt: string;
+ capturedAt: string;
+ createdAt: string;
+ id: string;
+ metadata: {
+ [key: string]: unknown;
+ } | null;
+ tags: Array<string> | null;
+ type: string | null;
+ updatedAt: string;
+ userId: string | null;
+ associatedObjects: Array<{
+ extra?: {
+ [key: string]: unknown;
+ };
+ name?: string;
+ type?: string;
+ }> | null;
+ associatedSubjects: Array<{
+ extra?: {
+ [key: string]: unknown;
+ };
+ name?: string;
+ type?: string;
+ }> | null;
+ currentStatus: string | null;
+ description: string | null;
+ firstSeenAt: string | null;
+ lastEvidenceAt: string | null;
+ nextSteps: Array<string> | null;
+ now: string | null;
+ openQuestions: Array<string> | null;
+ scoreImpact: number | null;
+ scoreUrgency: number | null;
+ synthesizedAt: string | null;
+ title: string | null;
+ userMemoryId: string | null;
+ userMemoryIds: Array<string> | null;
+};
+
+export type MemoryActivity = {
+ accessedAt: string;
+ capturedAt: string;
+ createdAt: string;
+ id: string;
+ metadata: {
+ [key: string]: unknown;
+ } | null;
+ tags: Array<string> | null;
+ type: string;
+ updatedAt: string;
+ userId: string | null;
+ associatedLocations: Array<{
+ address?: string;
+ name?: string;
+ tags?: Array<string>;
+ type?: string;
+ }> | null;
+ associatedObjects: Array<{
+ extra?: {
+ [key: string]: unknown;
+ };
+ name?: string;
+ type?: string;
+ }> | null;
+ associatedSubjects: Array<{
+ extra?: {
+ [key: string]: unknown;
+ };
+ name?: string;
+ type?: string;
+ }> | null;
+ dossierId: string | null;
+ endsAt: string | null;
+ feedback: string | null;
+ injectable: boolean;
+ narrative: string | null;
+ notes: string | null;
+ startsAt: string | null;
+ status: string;
+ timezone: string | null;
+ userMemoryId: string | null;
+};
+
+export type MemoryExperience = {
+ accessedAt: string;
+ capturedAt: string;
+ createdAt: string;
+ id: string;
+ metadata: {
+ [key: string]: unknown;
+ } | null;
+ tags: Array<string> | null;
+ type: string | null;
+ updatedAt: string;
+ userId: string | null;
+ action: string | null;
+ keyLearning: string | null;
+ possibleOutcome: string | null;
+ reasoning: string | null;
+ scoreConfidence: number | null;
+ situation: string | null;
+ userMemoryId: string | null;
+};
+
+export type MessageTranslationWrite = {
+ content?: string;
+ from?: string;
+ id: string;
+ to: string;
+ userId: string;
+};
+
+export type MessageTranslation = {
+ clientId: string | null;
+ content: string | null;
+ from: string | null;
+ id: string;
+ to: string | null;
+ userId: string;
+};
+
+export type Message = {
+ agentId: string | null;
+ content: string | null;
+ createdAt: string;
+ error: {
+ [key: string]: unknown;
+ } | null;
+ favorite: boolean | null;
+ files: Array<{
+ createdAt: string;
+ fileType: string;
+ id: string;
+ metadata: {
+ [key: string]: unknown;
+ } | null;
+ name: string;
+ parentId: string | null;
+ size: number;
+ source: string | null;
+ updatedAt: string;
+ url: string;
+ visibility: 'private' | 'public';
+ }>;
+ groupId: string | null;
+ id: string;
+ messageGroupId: string | null;
+ metadata: {
+ [key: string]: unknown;
+ } | null;
+ model: string | null;
+ observationId: string | null;
+ parentId: string | null;
+ provider: string | null;
+ quotaId: string | null;
+ reasoning: {
+ [key: string]: unknown;
+ } | null;
+ role: string;
+ search: {
+ [key: string]: unknown;
+ } | null;
+ session: {
+ avatar: string | null;
+ backgroundColor: string | null;
+ createdAt: string;
+ description: string | null;
+ groupId: string | null;
+ id: string;
+ pinned: boolean | null;
+ slug: string;
+ title: string | null;
+ type: 'agent' | 'group' | null;
+ updatedAt: string;
+ } | null;
+ sessionId: string | null;
+ summary: string | null;
+ targetId: string | null;
+ threadId: string | null;
+ tools: Array<{
+ [key: string]: unknown;
+ }> | null;
+ topic: TopicSummary | null;
+ topicId: string | null;
+ traceId: string | null;
+ updatedAt: string;
+ usage: {
+ [key: string]: unknown;
+ } | null;
+};
+
+export type TopicSummary = {
+ agentId: string | null;
+ completedAt: string | null;
+ content: string | null;
+ cost: {
+ [key: string]: unknown;
+ } | null;
+ createdAt: string;
+ description: string | null;
+ favorite: boolean | null;
+ groupId: string | null;
+ historySummary: string | null;
+ id: string;
+ metadata: {
+ [key: string]: unknown;
+ } | null;
+ mode: string | null;
+ model: string | null;
+ provider: string | null;
+ sessionId: string | null;
+ status: 'active' | 'running' | 'waitingForHuman' | 'scheduled' | 'failed' | 'completed' | 'archived' | 'unread' | null;
+ title: string | null;
+ totalCost: number | null;
+ totalInputTokens: number | null;
+ totalOutputTokens: number | null;
+ totalTokens: number | null;
+ trigger: string | null;
+ updatedAt: string;
+ usage: {
+ [key: string]: unknown;
+ } | null;
+};
+
+export type Model = {
+ abilities: {
+ [key: string]: unknown;
+ } | null;
+ config: {
+ [key: string]: unknown;
+ } | null;
+ contextWindowTokens: number | null;
+ createdAt: string;
+ description: string | null;
+ displayName: string | null;
+ enabled: boolean | null;
+ id: string;
+ organization: string | null;
+ parameters: {
+ [key: string]: unknown;
+ } | null;
+ pricing: {
+ [key: string]: unknown;
+ } | null;
+ providerId: string;
+ releasedAt: string | null;
+ settings: {
+ [key: string]: unknown;
+ } | null;
+ sort: number | null;
+ source: 'remote' | 'custom' | 'builtin' | null;
+ type: string;
+ updatedAt: string;
+};
+
+export type Notification = {
+ actionUrl: string | null;
+ category: string;
+ content: string;
+ context: string | null;
+ createdAt: string;
+ dedupeKey: string | null;
+ id: string;
+ isArchived: boolean;
+ isRead: boolean;
+ metadata: {
+ actor?: {
+ avatar?: string;
+ name?: string;
+ userId?: string;
+ };
+ agent?: {
+ avatar?: string;
+ backgroundColor?: string;
+ id: string;
+ name?: string;
+ };
+ transfer?: {
+ requestId: string;
+ };
+ } | null;
+ title: string;
+ type: string;
+ updatedAt: string;
+ userId: string;
+ workspaceId: string | null;
+};
+
+export type NotificationSettings = {
+ content?: {
+ scheduledTaskSummary?: boolean;
+ };
+ email?: {
+ enabled?: boolean;
+ items?: {
+ [key: string]: {
+ [key: string]: boolean;
+ };
+ };
+ };
+ im?: {
+ enabled?: boolean;
+ items?: {
+ [key: string]: {
+ [key: string]: boolean;
+ };
+ };
+ platforms?: {
+ [key: string]: {
+ enabled?: boolean;
+ items?: {
+ [key: string]: {
+ [key: string]: boolean;
+ };
+ };
+ tenantId?: string;
+ };
+ };
+ };
+ inbox?: {
+ enabled?: boolean;
+ items?: {
+ [key: string]: {
+ [key: string]: boolean;
+ };
+ };
+ };
+ push?: {
+ enabled?: boolean;
+ items?: {
+ [key: string]: {
+ [key: string]: boolean;
+ };
+ };
+ };
+};
+
+export type NotificationUnreadCount = {
+ count: number;
+};
+
+export type NotificationCategoryCount = {
+ category: string;
+ readCount: number;
+ totalCount: number;
+ unreadCount: number;
+};
+
+export type PermissionList = {
+ permissions: Array<Permission>;
+ total: number;
+};
+
+export type Permission = {
+ category: string;
+ code: string;
+ createdAt: string;
+ description: string | null;
+ id: string;
+ isActive: boolean;
+ name: string;
+ updatedAt: string;
+};
+
+export type Provider = {
+ checkModel: string | null;
+ config: {
+ [key: string]: unknown;
+ } | null;
+ createdAt: string;
+ description: string | null;
+ enabled: boolean | null;
+ fetchOnClient: boolean | null;
+ id: string;
+ logo: string | null;
+ name: string | null;
+ settings: {
+ [key: string]: unknown;
+ } | null;
+ sort: number | null;
+ source: 'builtin' | 'custom' | null;
+ updatedAt: string;
+};
+
+export type PushTokenRegistration = {
+ deviceId: string;
+ platform: string;
+};
+
+export type ResponseObject = {
+ background: boolean;
+ completed_at: number | null;
+ created_at: number;
+ error: ResponseError | null;
+ frequency_penalty: number;
+ id: string;
+ incomplete_details: {
+ reason: string;
+ } | null;
+ instructions: string | null;
+ max_output_tokens: number | null;
+ max_tool_calls: number | null;
+ metadata: {
+ [key: string]: string;
+ };
+ model: string;
+ object: 'response';
+ output: Array<ResponseOutputItem>;
+ output_text: string;
+ parallel_tool_calls: boolean;
+ presence_penalty: number;
+ previous_response_id: string | null;
+ prompt_cache_key: string | null;
+ reasoning: {
+ effort?: 'low' | 'medium' | 'high';
+ } | null;
+ safety_identifier: string | null;
+ service_tier: string;
+ status: 'completed' | 'failed' | 'in_progress' | 'incomplete' | 'queued';
+ store: boolean;
+ temperature: number;
+ text: {
+ format: {
+ type: 'text';
+ };
+ };
+ tool_choice: 'auto' | 'required' | 'none' | {
+ name: string;
+ type: 'function';
+ };
+ tools: Array<{
+ description?: string;
+ name: string;
+ parameters?: {
+ [key: string]: unknown;
+ };
+ strict: boolean | null;
+ type: 'function';
+ } | {
+ strict: null;
+ type: string;
+ }>;
+ top_logprobs: number;
+ top_p: number;
+ truncation: 'auto' | 'disabled';
+ usage: ResponseUsage;
+ user: string | null;
+};
+
+export type ResponseError = {
+ code: 'server_error' | 'invalid_request_error' | 'not_found' | 'model_error' | 'rate_limit_error';
+ message: string;
+};
+
+export type ResponseOutputItem = ResponseOutputMessage | ResponseFunctionCall | ResponseFunctionCallOutput;
+
+export type ResponseOutputMessage = {
+ content: Array<ResponseOutputText>;
+ id: string;
+ role: 'assistant';
+ status: 'completed' | 'in_progress';
+ type: 'message';
+};
+
+export type ResponseOutputText = {
+ annotations: Array<{
+ end_index: number;
+ start_index: number;
+ title: string;
+ type: 'url_citation';
+ url: string;
+ } | {
+ file_id: string;
+ filename: string;
+ index: number;
+ type: 'file_citation';
+ }>;
+ logprobs: Array<{
+ bytes: Array<number>;
+ logprob: number;
+ token: string;
+ top_logprobs: Array<{
+ bytes: Array<number>;
+ logprob: number;
+ token: string;
+ }>;
+ }>;
+ text: string;
+ type: 'output_text';
+};
+
+export type ResponseFunctionCall = {
+ arguments: string;
+ call_id: string;
+ id: string;
+ name: string;
+ status: 'completed' | 'in_progress';
+ type: 'function_call';
+};
+
+export type ResponseFunctionCallOutput = {
+ call_id: string;
+ id: string;
+ output: string;
+ status: 'completed' | 'in_progress';
+ type: 'function_call_output';
+};
+
+export type ResponseUsage = {
+ input_tokens: number;
+ input_tokens_details: {
+ cached_tokens: number;
+ };
+ output_tokens: number;
+ output_tokens_details: {
+ reasoning_tokens: number;
+ };
+ total_tokens: number;
+};
+
+export type RoleList = {
+ roles: Array<Role>;
+ total: number;
+};
+
+export type Role = {
+ createdAt: string;
+ description: string | null;
+ displayName: string;
+ id: string;
+ isActive: boolean;
+ isSystem: boolean;
+ name: string;
+ updatedAt: string;
+};
+
+export type RolePermissionList = {
+ permissions: Array<RolePermission>;
+ total: number;
+};
+
+export type RolePermission = {
+ category: string;
+ code: string;
+ description: string | null;
+ id: string;
+ isActive: boolean;
+ name: string;
+};
+
+export type RolePermissionsUpdateResult = {
+ granted: number;
+ revoked: number;
+ roleId: string;
+};
+
+export type AgentSignalEmission = {
+ accepted: boolean;
+ scopeKey: string;
+ workflowRunId: string;
+};
+
+export type AgentSignalReceiptList = {
+ cursor?: number;
+ receipts: Array<AgentSignalReceipt>;
+};
+
+export type AgentSignalReceipt = {
+ agentId: string;
+ anchorMessageId?: string;
+ createdAt: number;
+ detail: string;
+ id: string;
+ kind: 'memory' | 'review' | 'skill';
+ metadata?: {
+ actionCount?: number;
+ actionStatus?: 'applied' | 'deduped' | 'failed' | 'proposed' | 'skipped';
+ actionType?: 'write_memory' | 'create_skill' | 'refine_skill' | 'refine_prompt' | 'consolidate_skill' | 'noop' | 'proposal_only';
+ agentDocumentId?: string;
+ documentId?: string;
+ evidenceRefs?: Array<{
+ id: string;
+ summary?: string;
+ type: 'topic' | 'message' | 'operation' | 'source' | 'receipt' | 'tool_call' | 'task' | 'agent_document' | 'memory';
+ }>;
+ expectedCurrentDocumentUpdatedAt?: string;
+ historyId?: string;
+ localDate?: string;
+ reviewScope?: 'nightly' | 'self_feedback' | 'self_reflection';
+ rollbackStatus?: 'available' | 'conflict' | 'failed' | 'not_found' | 'rolled_back' | 'unsupported';
+ scopeId?: string;
+ scopeType?: string;
+ selfIteration?: {
+ ideas?: Array<{
+ evidenceRefs: Array<{
+ id: string;
+ summary?: string;
+ type: 'topic' | 'message' | 'operation' | 'source' | 'receipt' | 'tool_call' | 'task' | 'agent_document' | 'memory';
+ }>;
+ idempotencyKey: string;
+ rationale: string;
+ risk: 'high' | 'low' | 'medium';
+ target?: {
+ memoryId?: string;
+ readonly?: boolean;
+ skillDocumentId?: string;
+ skillName?: string;
+ taskIds?: Array<string>;
+ topicIds?: Array<string>;
+ };
+ title?: string;
+ }>;
+ intents?: Array<{
+ evidenceRefs: Array<{
+ id: string;
+ summary?: string;
+ type: 'topic' | 'message' | 'operation' | 'source' | 'receipt' | 'tool_call' | 'task' | 'agent_document' | 'memory';
+ }>;
+ idempotencyKey: string;
+ rationale: string;
+ risk: 'high' | 'low' | 'medium';
+ target?: {
+ memoryId?: string;
+ readonly?: boolean;
+ skillDocumentId?: string;
+ skillName?: string;
+ taskIds?: Array<string>;
+ topicIds?: Array<string>;
+ };
+ title?: string;
+ actionType?: string;
+ confidence: number;
+ downgradeReason?: 'approval_required' | 'low_confidence' | 'unsupported_in_reflection';
+ intentType: 'memory' | 'skill' | 'tooling' | 'workflow';
+ mode: 'reflection';
+ operation?: {
+ domain: 'memory';
+ input: {
+ content: string;
+ userId: string;
+ };
+ operation: 'write';
+ } | {
+ domain: 'skill';
+ input: {
+ bodyMarkdown?: string;
+ description?: string;
+ name?: string;
+ title?: string;
+ userId: string;
+ };
+ operation: 'create';
+ } | {
+ domain: 'skill';
+ input: {
+ bodyMarkdown: string;
+ description?: string;
+ skillDocumentId: string;
+ userId: string;
+ };
+ operation: 'refine';
+ } | {
+ domain: 'skill';
+ input: {
+ bodyMarkdown?: string;
+ canonicalSkillDocumentId: string;
+ description?: string;
+ sourceSkillIds: Array<string>;
+ userId: string;
+ };
+ operation: 'consolidate';
+ };
+ urgency: 'immediate' | 'later' | 'soon';
+ }>;
+ mode: 'feedback' | 'reflection' | 'review';
+ reason?: string;
+ scope?: {
+ id: string;
+ type: string;
+ };
+ sourceId: string;
+ toolCallId?: string;
+ window?: {
+ end: string;
+ start: string;
+ };
+ };
+ sourceType?: string;
+ timezone?: string;
+ };
+ operationId?: string;
+ sourceId: string;
+ sourceType: string;
+ status: 'applied' | 'completed' | 'failed' | 'proposed' | 'skipped' | 'updated';
+ target?: {
+ agentDocumentId?: string;
+ documentId?: string;
+ id?: string;
+ memoryId?: string;
+ memoryLayer?: 'activity' | 'context' | 'experience' | 'identity' | 'preference';
+ operation?: 'create' | 'remove' | 'update';
+ summary?: string;
+ title?: string;
+ type: 'memory' | 'skill';
+ };
+ title: string;
+ topicId: string;
+ triggerMessageId?: string;
+ userId: string;
+};
+
+export type TaskList = {
+ tasks: Array<TaskListItem>;
+ total: number;
+};
+
+export type TaskListItem = {
+ accessedAt: string;
+ archivedAt: string | null;
+ assigneeAgentId: string | null;
+ assigneeUserId: string | null;
+ automationMode: 'heartbeat' | 'schedule' | null;
+ completedAt: string | null;
+ config: {
+ [key: string]: unknown;
+ } | null;
+ context: {
+ [key: string]: unknown;
+ } | null;
+ createdAt: string;
+ createdByAgentId: string | null;
+ createdByUserId: string;
+ currentTopicId: string | null;
+ deletedAt: string | null;
+ description: string | null;
+ editorData: unknown;
+ error: string | null;
+ heartbeatInterval: number | null;
+ heartbeatTimeout: number | null;
+ id: string;
+ identifier: string;
+ instruction: string;
+ isDeleted: boolean | null;
+ lastHeartbeatAt: string | null;
+ maxTopics: number | null;
+ name: string | null;
+ parentTaskId: string | null;
+ priority: number | null;
+ projectId: string | null;
+ schedulePattern: string | null;
+ scheduleTimezone: string | null;
+ seq: number;
+ sortOrder: number | null;
+ startedAt: string | null;
+ status: 'backlog' | 'running' | 'scheduled' | 'paused' | 'completed' | 'failed' | 'canceled';
+ totalTopics: number | null;
+ updatedAt: string;
+ visibility: 'private' | 'public';
+ workspaceId: string | null;
+ labels: Array<TaskLabelRef>;
+ subtaskProgress?: {
+ completed: number;
+ total: number;
+ };
+};
+
+export type TaskLabelRef = {
+ color?: string | null;
+ id: string;
+ name: string;
+ parentId?: string | null;
+};
+
+export type Task = {
+ accessedAt: string;
+ archivedAt: string | null;
+ assigneeAgentId: string | null;
+ assigneeUserId: string | null;
+ automationMode: 'heartbeat' | 'schedule' | null;
+ completedAt: string | null;
+ config: {
+ [key: string]: unknown;
+ } | null;
+ context: {
+ [key: string]: unknown;
+ } | null;
+ createdAt: string;
+ createdByAgentId: string | null;
+ createdByUserId: string;
+ currentTopicId: string | null;
+ deletedAt: string | null;
+ description: string | null;
+ editorData: unknown;
+ error: string | null;
+ heartbeatInterval: number | null;
+ heartbeatTimeout: number | null;
+ id: string;
+ identifier: string;
+ instruction: string;
+ isDeleted: boolean | null;
+ lastHeartbeatAt: string | null;
+ maxTopics: number | null;
+ name: string | null;
+ parentTaskId: string | null;
+ priority: number | null;
+ projectId: string | null;
+ schedulePattern: string | null;
+ scheduleTimezone: string | null;
+ seq: number;
+ sortOrder: number | null;
+ startedAt: string | null;
+ status: 'backlog' | 'running' | 'scheduled' | 'paused' | 'completed' | 'failed' | 'canceled';
+ totalTopics: number | null;
+ updatedAt: string;
+ visibility: 'private' | 'public';
+ workspaceId: string | null;
+};
+
+export type TaskDetail = {
+ activities?: Array<TaskDetailActivity>;
+ agentId?: string | null;
+ archivedAt?: string | null;
+ automationMode?: 'heartbeat' | 'schedule' | null;
+ checkpoint?: {
+ onAgentRequest?: boolean;
+ tasks?: {
+ afterIds?: Array<string>;
+ afterTasks?: Array<{
+ id: string;
+ identifier: string;
+ }>;
+ beforeIds?: Array<string>;
+ beforeTasks?: Array<{
+ id: string;
+ identifier: string;
+ }>;
+ };
+ topic?: {
+ after?: boolean;
+ before?: boolean;
+ };
+ };
+ config?: {
+ [key: string]: unknown;
+ };
+ createdAt?: string;
+ createdByUserId?: string | null;
+ dependencies?: Array<{
+ dependsOn: string;
+ dependsOnId?: string;
+ type: string;
+ }>;
+ description?: string | null;
+ editorData?: unknown;
+ error?: string | null;
+ files?: Array<{
+ content?: string;
+ downloadUrl?: string;
+ fileType: string;
+ id: string;
+ inaccessible?: boolean;
+ name: string;
+ originalCharCount?: number;
+ size: number;
+ url: string;
+ }>;
+ goal?: {
+ id: string;
+ title: string;
+ } | null;
+ heartbeat?: {
+ interval?: number | null;
+ lastAt?: string | null;
+ scheduledAt?: string | null;
+ timeout?: number | null;
+ };
+ id?: string;
+ identifier: string;
+ instruction: string;
+ labels?: Array<TaskLabelRef>;
+ name?: string | null;
+ parent?: {
+ agentId?: string | null;
+ id?: string;
+ identifier: string;
+ name: string | null;
+ } | null;
+ priority?: number | null;
+ projectId?: string | null;
+ schedule?: {
+ maxExecutions?: number | null;
+ pattern?: string | null;
+ timezone?: string | null;
+ };
+ startedAt?: string;
+ status: string;
+ subtasks?: Array<TaskDetailSubtask>;
+ topicCount?: number;
+ updatedAt?: string;
+ userId?: string | null;
+ verify?: {
+ enabled?: boolean;
+ maxIterations?: number;
+ requirement?: string;
+ verifierAgentId?: string;
+ verifyCriteriaIds?: Array<string>;
+ verifyRubricId?: string;
+ } | null;
+ visibility?: 'private' | 'public';
+ workspace?: Array<TaskDetailWorkspaceNode>;
+ workspaceId?: string | null;
+};
+
+export type TaskDetailActivity = {
+ actions?: unknown;
+ agent?: {
+ avatar: string | null;
+ backgroundColor: string | null;
+ id: string;
+ name?: string | null;
+ title: string | null;
+ } | null;
+ agentId?: string | null;
+ artifacts?: {
+ documents?: Array<{
+ id: string;
+ kind: string | null;
+ title: string | null;
+ }>;
+ } | null;
+ assignment?: {
+ from?: {
+ avatar?: string | null;
+ id: string;
+ name?: string | null;
+ type: 'agent' | 'user';
+ unresolved?: boolean;
+ } | null;
+ kind: 'agent' | 'member';
+ to?: {
+ avatar?: string | null;
+ id: string;
+ name?: string | null;
+ type: 'agent' | 'user';
+ unresolved?: boolean;
+ } | null;
+ };
+ author?: {
+ avatar?: string | null;
+ id: string;
+ name?: string | null;
+ type: 'agent' | 'user';
+ unresolved?: boolean;
+ };
+ briefType?: string;
+ completedAt?: string;
+ content?: string;
+ cost?: number | null;
+ createdAt?: string;
+ cronJobId?: string | null;
+ editorData?: unknown;
+ files?: Array<{
+ content?: string;
+ downloadUrl?: string;
+ fileType: string;
+ id: string;
+ inaccessible?: boolean;
+ name: string;
+ originalCharCount?: number;
+ size: number;
+ url: string;
+ }>;
+ id?: string;
+ operationId?: string | null;
+ priority?: string | null;
+ propertyChange?: {
+ field: 'automation';
+ from: {
+ heartbeatInterval: number | null;
+ maxExecutions: number | null;
+ mode: 'heartbeat' | 'schedule' | null;
+ schedulePattern: string | null;
+ scheduleTimezone: string | null;
+ } | null;
+ to: {
+ heartbeatInterval: number | null;
+ maxExecutions: number | null;
+ mode: 'heartbeat' | 'schedule' | null;
+ schedulePattern: string | null;
+ scheduleTimezone: string | null;
+ } | null;
+ } | {
+ field: 'priority';
+ from: number | null;
+ to: number | null;
+ } | {
+ field: 'status';
+ from: 'backlog' | 'running' | 'scheduled' | 'paused' | 'completed' | 'failed' | 'canceled' | null;
+ to: 'backlog' | 'running' | 'scheduled' | 'paused' | 'completed' | 'failed' | 'canceled';
+ };
+ readAt?: string | null;
+ resolvedAction?: string | null;
+ resolvedAt?: string | null;
+ resolvedComment?: string | null;
+ runningOperation?: {
+ assistantMessageId: string;
+ heteroType?: string | null;
+ operationId: string;
+ scope?: string;
+ threadId?: string | null;
+ } | null;
+ seq?: number | null;
+ sourceTaskId?: string | null;
+ sourceTaskIdentifier?: string | null;
+ sourceTaskName?: string | null;
+ status?: string | null;
+ summary?: string;
+ taskId?: string | null;
+ time?: string;
+ title?: string;
+ topicId?: string | null;
+ trigger?: 'manual' | 'schedule' | 'heartbeat' | 'goal' | null;
+ type: 'assignment' | 'brief' | 'comment' | 'created' | 'property' | 'topic';
+ userId?: string | null;
+ verify?: {
+ acceptanceId: string | null;
+ passed: number;
+ roundIndex: number | null;
+ runId: string;
+ status: string | null;
+ total: number;
+ } | null;
+};
+
+export type TaskDetailSubtask = {
+ archivedAt?: string | null;
+ assignee?: {
+ avatar: string | null;
+ backgroundColor: string | null;
+ id: string;
+ title: string | null;
} | null;
- [key: string]: unknown;
+ assigneeUserId?: string | null;
+ automationMode?: 'heartbeat' | 'schedule' | null;
+ blockedBy?: string;
+ blockedById?: string;
+ children?: Array<TaskDetailSubtask>;
+ createdByUserId?: string;
+ heartbeat?: {
+ interval?: number | null;
+ };
+ id?: string;
+ identifier: string;
+ name?: string | null;
+ priority?: number | null;
+ runningTopic?: {
+ id: string;
+ operationId?: string | null;
+ } | null;
+ schedule?: {
+ pattern?: string | null;
+ timezone?: string | null;
+ };
+ status: string;
+ updatedAt?: string;
+ visibility?: 'private' | 'public';
};
-export type McpServer = {
- createdAt: string;
- description?: string | null;
- hasCredentials: boolean;
- id: string;
- identifier: string;
- isEnabled: boolean;
- name: string;
- serverUrl: string;
- status: 'connected' | 'disconnected' | 'error';
- tools: Array<{
- description?: string | null;
+export type TaskDetailWorkspaceNode = {
+ children?: Array<TaskDetailWorkspaceNode>;
+ createdAt?: string;
+ documentId: string;
+ fileType?: string;
+ inaccessible?: boolean;
+ size?: number | null;
+ sourceTaskId?: string;
+ sourceTaskIdentifier?: string | null;
+ title?: string;
+};
+
+export type TaskStatusUpdateResult = {
+ allSubtasksDone?: boolean;
+ checkpointTriggered?: boolean;
+ completionDeferred?: boolean;
+ parentTaskId?: string | null;
+ paused: Array<string>;
+ pausedTasks?: Array<{
id: string;
- inputSchema?: {
- [key: string]: unknown;
- } | null;
- name: string;
- permission: 'auto' | 'needs_approval' | 'disabled';
+ identifier: string;
+ }>;
+ skippedRunning?: boolean;
+ task: Task;
+ unlocked: Array<string>;
+ unlockedTasks?: Array<{
+ id: string;
+ identifier: string;
}>;
- updatedAt: string;
};
-export type Model = {
- abilities?: {
- [key: string]: unknown;
- } | null;
- config?: {
- [key: string]: unknown;
- } | null;
- contextWindowTokens?: number | null;
+export type TaskRunStarted = {
+ agentId: string;
+ assistantMessageId: string;
+ autoStarted: boolean;
createdAt: string;
- description?: string | null;
- displayName?: string | null;
- enabled?: boolean | null;
- id: string;
- organization?: string | null;
- parameters?: {
- [key: string]: unknown;
- } | null;
- pricing?: {
- [key: string]: unknown;
- } | null;
- providerId: string;
- releasedAt?: string | null;
- settings?: {
- [key: string]: unknown;
- } | null;
- sort?: number | null;
- source?: string | null;
- type: string;
- updatedAt: string;
+ createdThreadId?: string;
+ error?: string;
+ errorData?: {
+ code: 'DEVICE_NOT_FOUND';
+ deviceId: string;
+ retryable: true;
+ scope: 'personal' | 'workspace';
+ workspaceId?: string;
+ };
+ groupMemberContinuation?: boolean;
+ heteroType?: string | null;
+ memberOperationId?: string;
+ message: string;
+ messageId?: string;
+ operationId: string;
+ status: string;
+ success: boolean;
+ supervisorOperationId?: string;
+ taskId: string;
+ taskIdentifier: string;
+ terminalReported?: boolean;
+ timestamp: string;
+ token?: string;
+ topicId: string;
+ userMessageId: string;
};
-export type Permission = {
- category: string;
- code: string;
+export type TaskRun = {
+ agentId: string | null;
+ completedAt: string | null;
+ content: string | null;
createdAt: string;
- description?: string | null;
- id: string;
- isActive?: boolean | null;
- name: string;
- updatedAt: string;
+ keyFindings: Array<string>;
+ nextAction: string | null;
+ notable: boolean | null;
+ seq: number;
+ status: string;
+ summary: string | null;
+ title: string | null;
+ topicId: string | null;
+ trigger: 'manual' | 'schedule' | 'heartbeat' | 'goal' | null;
};
-export type Provider = {
- checkModel?: string | null;
- config?: {
+export type Topic = {
+ agentId: string | null;
+ completedAt: string | null;
+ content: string | null;
+ cost: {
[key: string]: unknown;
} | null;
createdAt: string;
- description?: string | null;
- enabled?: boolean | null;
- fetchOnClient?: boolean | null;
+ description: string | null;
+ favorite: boolean | null;
+ groupId: string | null;
+ historySummary: string | null;
id: string;
- logo?: string | null;
- name?: string | null;
- settings?: {
+ metadata: {
[key: string]: unknown;
} | null;
- sort?: number | null;
- source?: string | null;
+ mode: string | null;
+ model: string | null;
+ provider: string | null;
+ sessionId: string | null;
+ status: 'active' | 'running' | 'waitingForHuman' | 'scheduled' | 'failed' | 'completed' | 'archived' | 'unread' | null;
+ title: string | null;
+ totalCost: number | null;
+ totalInputTokens: number | null;
+ totalOutputTokens: number | null;
+ totalTokens: number | null;
+ trigger: string | null;
updatedAt: string;
+ usage: {
+ [key: string]: unknown;
+ } | null;
+ messageCount: number;
+ user: {
+ avatar: string | null;
+ createdAt: string;
+ email: string | null;
+ firstName: string | null;
+ fullName: string | null;
+ id: string;
+ isOnboarded: boolean | null;
+ lastName: string | null;
+ phone: string | null;
+ updatedAt: string;
+ username: string | null;
+ };
};
-export type Role = {
+export type TopicThread = {
createdAt: string;
- description?: string | null;
- displayName: string;
id: string;
- isActive?: boolean | null;
- isSystem?: boolean | null;
- name: string;
+ parentThreadId: string | null;
+ status: 'active' | 'processing' | 'pending' | 'inReview' | 'todo' | 'cancel' | 'completed' | 'failed' | null;
+ title: string | null;
+ topicId: string;
+ type: 'continuation' | 'standalone' | 'isolation' | 'eval';
updatedAt: string;
};
-export type Topic = {
- agentId?: string | null;
- completedAt?: string | null;
- content?: string | null;
- cost?: {
- [key: string]: unknown;
- } | null;
+export type User = {
+ avatar: string | null;
createdAt: string;
- description?: string | null;
- favorite?: boolean | null;
- groupId?: string | null;
- historySummary?: string | null;
+ email: string | null;
+ firstName: string | null;
+ fullName: string | null;
id: string;
- metadata?: {
- [key: string]: unknown;
- } | null;
- mode?: string | null;
- model?: string | null;
- provider?: string | null;
- sessionId?: string | null;
- status?: string | null;
- title?: string | null;
- totalCost?: number | null;
- totalInputTokens?: number | null;
- totalOutputTokens?: number | null;
- totalTokens?: number | null;
- trigger?: string | null;
+ isOnboarded: boolean | null;
+ lastName: string | null;
+ messageCount?: number;
+ phone: string | null;
+ roles: Array<Role>;
updatedAt: string;
- usage?: {
- [key: string]: unknown;
- } | null;
- [key: string]: unknown;
+ username: string | null;
};
-export type User = {
- avatar?: string | null;
- createdAt: string;
- email?: string | null;
- firstName?: string | null;
- fullName?: string | null;
+export type UserIdentity = {
id: string;
- isOnboarded?: boolean | null;
- lastName?: string | null;
- phone?: string | null;
- updatedAt: string;
- username?: string | null;
- [key: string]: unknown;
+};
+
+export type UserList = {
+ total: number;
+ users: Array<User>;
+};
+
+export type UserRole = {
+ expiresAt: string | null;
+ roleDisplayName: string;
+ roleId: string;
+ roleName: string;
};
export type Usage = {
@@ -385,39 +2592,6 @@ export type GetApiV1HealthData = {
url: '/api/v1/health';
};
-export type GetApiV1HealthErrors = {
- /**
- * Invalid request
- */
- 400: ApiError;
- /**
- * Authentication required
- */
- 401: ApiError;
- /**
- * Insufficient permission
- */
- 403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
- /**
- * Internal server error
- */
- 500: ApiError;
-};
-
-export type GetApiV1HealthError = GetApiV1HealthErrors[keyof GetApiV1HealthErrors];
-
export type GetApiV1HealthResponses = {
/**
* Successful response
@@ -439,10 +2613,6 @@ export type GetApiV1AgentGroupsData = {
};
export type GetApiV1AgentGroupsErrors = {
- /**
- * Invalid request
- */
- 400: ApiError;
/**
* Authentication required
*/
@@ -451,18 +2621,6 @@ export type GetApiV1AgentGroupsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -476,7 +2634,7 @@ export type GetApiV1AgentGroupsResponses = {
* Successful response
*/
200: {
- data?: Array<AgentGroup>;
+ data: Array<AgentGroup>;
message?: string;
success: true;
timestamp: string;
@@ -497,13 +2655,9 @@ export type PostApiV1AgentGroupsData = {
export type PostApiV1AgentGroupsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -512,18 +2666,6 @@ export type PostApiV1AgentGroupsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -537,9 +2679,7 @@ export type PostApiV1AgentGroupsResponses = {
* Successful response
*/
201: {
- data?: {
- id: string;
- };
+ data: CreatedAgentGroup;
message?: string;
success: true;
timestamp: string;
@@ -559,13 +2699,9 @@ export type DeleteApiV1AgentGroupsByIdData = {
export type DeleteApiV1AgentGroupsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -574,18 +2710,6 @@ export type DeleteApiV1AgentGroupsByIdErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -599,9 +2723,7 @@ export type DeleteApiV1AgentGroupsByIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -621,13 +2743,9 @@ export type GetApiV1AgentGroupsByIdData = {
export type GetApiV1AgentGroupsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -640,14 +2758,6 @@ export type GetApiV1AgentGroupsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -661,7 +2771,7 @@ export type GetApiV1AgentGroupsByIdResponses = {
* Successful response
*/
200: {
- data?: AgentGroup;
+ data: AgentGroup;
message?: string;
success: true;
timestamp: string;
@@ -684,13 +2794,9 @@ export type PatchApiV1AgentGroupsByIdData = {
export type PatchApiV1AgentGroupsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -699,18 +2805,6 @@ export type PatchApiV1AgentGroupsByIdErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -724,7 +2818,7 @@ export type PatchApiV1AgentGroupsByIdResponses = {
* Successful response
*/
200: {
- data?: AgentGroup;
+ data: AgentGroup;
message?: string;
success: true;
timestamp: string;
@@ -747,13 +2841,9 @@ export type GetApiV1AgentsData = {
export type GetApiV1AgentsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -762,18 +2852,6 @@ export type GetApiV1AgentsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -787,11 +2865,7 @@ export type GetApiV1AgentsResponses = {
* Successful response
*/
200: {
- data?: {
- agents: Array<Agent>;
- total?: number;
- [key: string]: unknown;
- };
+ data: AgentList;
message?: string;
success: true;
timestamp: string;
@@ -890,13 +2964,9 @@ export type PostApiV1AgentsData = {
export type PostApiV1AgentsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -905,18 +2975,6 @@ export type PostApiV1AgentsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -930,7 +2988,7 @@ export type PostApiV1AgentsResponses = {
* Successful response
*/
200: {
- data?: Agent;
+ data: Agent;
message?: string;
success: true;
timestamp: string;
@@ -950,33 +3008,17 @@ export type DeleteApiV1AgentsByIdData = {
export type DeleteApiV1AgentsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
401: ApiError;
/**
- * Insufficient permission
- */
- 403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
+ * Insufficient permission
*/
- 429: ApiError;
+ 403: ApiError;
/**
* Internal server error
*/
@@ -990,9 +3032,7 @@ export type DeleteApiV1AgentsByIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -1012,13 +3052,9 @@ export type GetApiV1AgentsByIdData = {
export type GetApiV1AgentsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -1031,14 +3067,6 @@ export type GetApiV1AgentsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1052,7 +3080,7 @@ export type GetApiV1AgentsByIdResponses = {
* Successful response
*/
200: {
- data?: Agent;
+ data: AgentDetail;
message?: string;
success: true;
timestamp: string;
@@ -1153,13 +3181,9 @@ export type PatchApiV1AgentsByIdData = {
export type PatchApiV1AgentsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -1168,18 +3192,6 @@ export type PatchApiV1AgentsByIdErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1193,7 +3205,7 @@ export type PatchApiV1AgentsByIdResponses = {
* Successful response
*/
200: {
- data?: Agent;
+ data: Agent;
message?: string;
success: true;
timestamp: string;
@@ -1215,13 +3227,9 @@ export type PostApiV1AgentsByIdDuplicateData = {
export type PostApiV1AgentsByIdDuplicateErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -1234,14 +3242,6 @@ export type PostApiV1AgentsByIdDuplicateErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1255,9 +3255,7 @@ export type PostApiV1AgentsByIdDuplicateResponses = {
* Successful response
*/
201: {
- data?: {
- [key: string]: unknown;
- };
+ data: AgentDetail;
message?: string;
success: true;
timestamp: string;
@@ -1280,13 +3278,9 @@ export type GetApiV1AgentsByIdAccountsData = {
export type GetApiV1AgentsByIdAccountsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -1299,14 +3293,6 @@ export type GetApiV1AgentsByIdAccountsErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1320,10 +3306,7 @@ export type GetApiV1AgentsByIdAccountsResponses = {
* Successful response
*/
200: {
- data?: {
- accounts: Array<AgentAccount>;
- total: number;
- };
+ data: AgentAccountList;
message?: string;
success: true;
timestamp: string;
@@ -1360,13 +3343,9 @@ export type PostApiV1AgentsByIdAccountsData = {
export type PostApiV1AgentsByIdAccountsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -1383,10 +3362,6 @@ export type PostApiV1AgentsByIdAccountsErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1400,7 +3375,7 @@ export type PostApiV1AgentsByIdAccountsResponses = {
* Successful response
*/
201: {
- data?: AgentAccount;
+ data: AgentAccount;
message?: string;
success: true;
timestamp: string;
@@ -1424,13 +3399,9 @@ export type DeleteApiV1AgentsByIdAccountsByAccountIdData = {
export type DeleteApiV1AgentsByIdAccountsByAccountIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -1443,14 +3414,6 @@ export type DeleteApiV1AgentsByIdAccountsByAccountIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1464,7 +3427,7 @@ export type DeleteApiV1AgentsByIdAccountsByAccountIdResponses = {
* Successful response
*/
200: {
- data?: AgentAccount;
+ data: AgentAccount;
message?: string;
success: true;
timestamp: string;
@@ -1485,13 +3448,9 @@ export type GetApiV1AgentsByIdAccountsByAccountIdData = {
export type GetApiV1AgentsByIdAccountsByAccountIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -1504,14 +3463,6 @@ export type GetApiV1AgentsByIdAccountsByAccountIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1525,7 +3476,7 @@ export type GetApiV1AgentsByIdAccountsByAccountIdResponses = {
* Successful response
*/
200: {
- data?: AgentAccount;
+ data: AgentAccount;
message?: string;
success: true;
timestamp: string;
@@ -1557,13 +3508,9 @@ export type PatchApiV1AgentsByIdAccountsByAccountIdData = {
export type PatchApiV1AgentsByIdAccountsByAccountIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -1580,10 +3527,6 @@ export type PatchApiV1AgentsByIdAccountsByAccountIdErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1597,7 +3540,7 @@ export type PatchApiV1AgentsByIdAccountsByAccountIdResponses = {
* Successful response
*/
200: {
- data?: AgentAccount;
+ data: AgentAccount;
message?: string;
success: true;
timestamp: string;
@@ -1627,13 +3570,9 @@ export type PutApiV1AgentsByIdAccountsByAccountIdCredentialData = {
export type PutApiV1AgentsByIdAccountsByAccountIdCredentialErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -1646,14 +3585,6 @@ export type PutApiV1AgentsByIdAccountsByAccountIdCredentialErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1667,7 +3598,7 @@ export type PutApiV1AgentsByIdAccountsByAccountIdCredentialResponses = {
* Successful response
*/
200: {
- data?: AgentAccount;
+ data: AgentAccount;
message?: string;
success: true;
timestamp: string;
@@ -1684,10 +3615,6 @@ export type GetApiV1ApiKeysData = {
};
export type GetApiV1ApiKeysErrors = {
- /**
- * Invalid request
- */
- 400: ApiError;
/**
* Authentication required
*/
@@ -1696,18 +3623,6 @@ export type GetApiV1ApiKeysErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1721,7 +3636,7 @@ export type GetApiV1ApiKeysResponses = {
* Successful response
*/
200: {
- data?: Array<ApiKey>;
+ data: Array<ApiKey>;
message?: string;
success: true;
timestamp: string;
@@ -1743,13 +3658,9 @@ export type PostApiV1ApiKeysData = {
export type PostApiV1ApiKeysErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -1758,18 +3669,6 @@ export type PostApiV1ApiKeysErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1783,17 +3682,7 @@ export type PostApiV1ApiKeysResponses = {
* Successful response
*/
201: {
- data?: {
- createdAt: string;
- enabled?: boolean | null;
- expiresAt?: string | null;
- id: string;
- lastUsedAt?: string | null;
- name: string;
- scopes?: Array<'*' | 'agent:read' | 'agent:write' | 'agent:credential:write' | 'eval:read' | 'eval:write' | 'chat:read' | 'chat:write' | 'model:invoke' | 'model:read' | 'model:write' | 'file:read' | 'file:write' | 'knowledge:read' | 'knowledge:write' | 'mcp:read' | 'mcp:write' | 'usage:read' | 'workspace:read' | 'workspace:write' | 'user:read' | 'user:write'> | null;
- updatedAt: string;
- key: string;
- };
+ data: CreatedApiKey;
message?: string;
success: true;
timestamp: string;
@@ -1813,13 +3702,9 @@ export type DeleteApiV1ApiKeysByIdData = {
export type DeleteApiV1ApiKeysByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -1832,14 +3717,6 @@ export type DeleteApiV1ApiKeysByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1853,9 +3730,7 @@ export type DeleteApiV1ApiKeysByIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -1875,13 +3750,9 @@ export type GetApiV1ApiKeysByIdData = {
export type GetApiV1ApiKeysByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -1894,14 +3765,6 @@ export type GetApiV1ApiKeysByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1915,7 +3778,7 @@ export type GetApiV1ApiKeysByIdResponses = {
* Successful response
*/
200: {
- data?: ApiKey;
+ data: ApiKey;
message?: string;
success: true;
timestamp: string;
@@ -1939,13 +3802,9 @@ export type PatchApiV1ApiKeysByIdData = {
export type PatchApiV1ApiKeysByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -1958,14 +3817,6 @@ export type PatchApiV1ApiKeysByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -1979,7 +3830,7 @@ export type PatchApiV1ApiKeysByIdResponses = {
* Successful response
*/
200: {
- data?: ApiKey;
+ data: ApiKey;
message?: string;
success: true;
timestamp: string;
@@ -1988,6 +3839,90 @@ export type PatchApiV1ApiKeysByIdResponses = {
export type PatchApiV1ApiKeysByIdResponse = PatchApiV1ApiKeysByIdResponses[keyof PatchApiV1ApiKeysByIdResponses];
+export type PostApiV1AudioSpeechData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v1/audio/speech';
+};
+
+export type PostApiV1AudioSpeechErrors = {
+ /**
+ * Invalid request, unsupported format or invalid params
+ */
+ 400: {
+ error: {
+ code?: string | null;
+ message: string;
+ param?: string | null;
+ type: string;
+ };
+ };
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient balance
+ */
+ 402: {
+ error: {
+ code?: string | null;
+ message: string;
+ param?: string | null;
+ type: string;
+ };
+ };
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Upstream provider rate limit
+ */
+ 429: {
+ error: {
+ code?: string | null;
+ message: string;
+ param?: string | null;
+ type: string;
+ };
+ };
+ /**
+ * Text-to-speech failed
+ */
+ 500: {
+ error: {
+ code?: string | null;
+ message: string;
+ param?: string | null;
+ type: string;
+ };
+ };
+ /**
+ * Upstream provider error
+ */
+ 502: {
+ error: {
+ code?: string | null;
+ message: string;
+ param?: string | null;
+ type: string;
+ };
+ };
+};
+
+export type PostApiV1AudioSpeechError = PostApiV1AudioSpeechErrors[keyof PostApiV1AudioSpeechErrors];
+
+export type PostApiV1AudioSpeechResponses = {
+ /**
+ * Synthesized audio
+ */
+ 200: Blob | File;
+};
+
+export type PostApiV1AudioSpeechResponse = PostApiV1AudioSpeechResponses[keyof PostApiV1AudioSpeechResponses];
+
export type PostApiV1ChatData = {
body: {
frequency_penalty?: number;
@@ -2010,13 +3945,9 @@ export type PostApiV1ChatData = {
export type PostApiV1ChatErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2025,18 +3956,6 @@ export type PostApiV1ChatErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2050,7 +3969,7 @@ export type PostApiV1ChatResponses = {
* Successful response
*/
200: {
- data?: ChatResponse;
+ data: ChatResponse;
message?: string;
success: true;
timestamp: string;
@@ -2074,13 +3993,9 @@ export type PostApiV1ChatTranslateData = {
export type PostApiV1ChatTranslateErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2089,18 +4004,6 @@ export type PostApiV1ChatTranslateErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2114,9 +4017,7 @@ export type PostApiV1ChatTranslateResponses = {
* Successful response
*/
200: {
- data?: {
- translatedText: string;
- };
+ data: ChatTranslateResponse;
message?: string;
success: true;
timestamp: string;
@@ -2160,13 +4061,9 @@ export type PostApiV1ChatGenerateReplyData = {
export type PostApiV1ChatGenerateReplyErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2175,18 +4072,6 @@ export type PostApiV1ChatGenerateReplyErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2200,9 +4085,7 @@ export type PostApiV1ChatGenerateReplyResponses = {
* Successful response
*/
200: {
- data?: {
- reply: string;
- };
+ data: ChatGenerateReplyResponse;
message?: string;
success: true;
timestamp: string;
@@ -2224,13 +4107,9 @@ export type GetApiV1ChatGroupsData = {
export type GetApiV1ChatGroupsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2239,18 +4118,6 @@ export type GetApiV1ChatGroupsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2264,11 +4131,7 @@ export type GetApiV1ChatGroupsResponses = {
* Successful response
*/
200: {
- data?: {
- chatGroups: Array<ChatGroup>;
- total?: number;
- [key: string]: unknown;
- };
+ data: ChatGroupList;
message?: string;
success: true;
timestamp: string;
@@ -2296,13 +4159,9 @@ export type PostApiV1ChatGroupsData = {
export type PostApiV1ChatGroupsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2319,10 +4178,6 @@ export type PostApiV1ChatGroupsErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2336,7 +4191,7 @@ export type PostApiV1ChatGroupsResponses = {
* Successful response
*/
201: {
- data?: ChatGroup;
+ data: ChatGroup;
message?: string;
success: true;
timestamp: string;
@@ -2356,13 +4211,9 @@ export type DeleteApiV1ChatGroupsByIdData = {
export type DeleteApiV1ChatGroupsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2375,14 +4226,6 @@ export type DeleteApiV1ChatGroupsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2396,9 +4239,7 @@ export type DeleteApiV1ChatGroupsByIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -2418,13 +4259,9 @@ export type GetApiV1ChatGroupsByIdData = {
export type GetApiV1ChatGroupsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2437,14 +4274,6 @@ export type GetApiV1ChatGroupsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2458,7 +4287,7 @@ export type GetApiV1ChatGroupsByIdResponses = {
* Successful response
*/
200: {
- data?: ChatGroup;
+ data: ChatGroup;
message?: string;
success: true;
timestamp: string;
@@ -2485,13 +4314,9 @@ export type PatchApiV1ChatGroupsByIdData = {
export type PatchApiV1ChatGroupsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2508,10 +4333,6 @@ export type PatchApiV1ChatGroupsByIdErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2525,7 +4346,7 @@ export type PatchApiV1ChatGroupsByIdResponses = {
* Successful response
*/
200: {
- data?: ChatGroup;
+ data: ChatGroup;
message?: string;
success: true;
timestamp: string;
@@ -2547,13 +4368,9 @@ export type DeleteApiV1ChatGroupsByIdMembersData = {
export type DeleteApiV1ChatGroupsByIdMembersErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2570,10 +4387,6 @@ export type DeleteApiV1ChatGroupsByIdMembersErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2587,7 +4400,7 @@ export type DeleteApiV1ChatGroupsByIdMembersResponses = {
* Successful response
*/
200: {
- data?: ChatGroup;
+ data: ChatGroup;
message?: string;
success: true;
timestamp: string;
@@ -2609,13 +4422,9 @@ export type PostApiV1ChatGroupsByIdMembersData = {
export type PostApiV1ChatGroupsByIdMembersErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2628,14 +4437,6 @@ export type PostApiV1ChatGroupsByIdMembersErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2649,7 +4450,7 @@ export type PostApiV1ChatGroupsByIdMembersResponses = {
* Successful response
*/
200: {
- data?: ChatGroup;
+ data: ChatGroup;
message?: string;
success: true;
timestamp: string;
@@ -2675,13 +4476,9 @@ export type GetApiV1EvalRunsData = {
export type GetApiV1EvalRunsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2690,18 +4487,6 @@ export type GetApiV1EvalRunsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2715,26 +4500,8 @@ export type GetApiV1EvalRunsResponses = {
* Successful response
*/
200: {
- data?: {
- runs: Array<{
- id: string;
- createdAt: string;
- updatedAt: string;
- config: {
- [key: string]: unknown;
- };
- executionMode: 'internal' | 'external';
- datasetId: string;
- experimentId: string | null;
- parentRunId: string | null;
- status: 'idle' | 'pending' | 'running' | 'external' | 'completed' | 'failed' | 'aborted';
- targetAgentId: string | null;
- name: string | null;
- metrics: {
- [key: string]: unknown;
- } | null;
- startedAt: string | null;
- }>;
+ data: {
+ runs: Array<EvalRun>;
total: number;
};
message?: string;
@@ -2773,13 +4540,9 @@ export type PostApiV1EvalRunsData = {
export type PostApiV1EvalRunsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2796,10 +4559,6 @@ export type PostApiV1EvalRunsErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2813,25 +4572,7 @@ export type PostApiV1EvalRunsResponses = {
* Successful response
*/
202: {
- data?: {
- id: string;
- createdAt: string;
- updatedAt: string;
- config: {
- [key: string]: unknown;
- };
- executionMode: 'internal' | 'external';
- datasetId: string;
- experimentId: string | null;
- parentRunId: string | null;
- status: 'idle' | 'pending' | 'running' | 'external' | 'completed' | 'failed' | 'aborted';
- targetAgentId: string | null;
- name: string | null;
- metrics: {
- [key: string]: unknown;
- } | null;
- startedAt: string | null;
- };
+ data: EvalRun;
message?: string;
success: true;
timestamp: string;
@@ -2856,13 +4597,9 @@ export type GetApiV1EvalRunsByIdTopicsData = {
export type GetApiV1EvalRunsByIdTopicsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2875,14 +4612,6 @@ export type GetApiV1EvalRunsByIdTopicsErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2896,22 +4625,10 @@ export type GetApiV1EvalRunsByIdTopicsResponses = {
* Successful response
*/
200: {
- data?: {
- topics: Array<{
- createdAt: string;
- evalResult: {
- [key: string]: unknown;
- } | null;
- passed: boolean | null;
- runId: string;
- score: number | null;
- status: string | null;
- testCaseId: string;
- topicId: string;
- input: string;
- }>;
- total: number;
+ data: {
runId: string;
+ topics: Array<EvalRunTopic>;
+ total: number;
};
message?: string;
success: true;
@@ -2932,13 +4649,9 @@ export type GetApiV1EvalRunsByIdData = {
export type GetApiV1EvalRunsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -2951,14 +4664,6 @@ export type GetApiV1EvalRunsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -2972,25 +4677,7 @@ export type GetApiV1EvalRunsByIdResponses = {
* Successful response
*/
200: {
- data?: {
- id: string;
- createdAt: string;
- updatedAt: string;
- config: {
- [key: string]: unknown;
- };
- executionMode: 'internal' | 'external';
- datasetId: string;
- experimentId: string | null;
- parentRunId: string | null;
- status: 'idle' | 'pending' | 'running' | 'external' | 'completed' | 'failed' | 'aborted';
- targetAgentId: string | null;
- name: string | null;
- metrics: {
- [key: string]: unknown;
- } | null;
- startedAt: string | null;
- };
+ data: EvalRun;
message?: string;
success: true;
timestamp: string;
@@ -3015,13 +4702,9 @@ export type GetApiV1EvalRunsByIdResultsData = {
export type GetApiV1EvalRunsByIdResultsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -3034,14 +4717,6 @@ export type GetApiV1EvalRunsByIdResultsErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -3055,21 +4730,10 @@ export type GetApiV1EvalRunsByIdResultsResponses = {
* Successful response
*/
200: {
- data?: {
- results: Array<{
- createdAt: string;
- passed: boolean | null;
- score: number | null;
- status: string | null;
- testCaseId: string;
- topicId: string;
- input: string;
- result: {
- [key: string]: unknown;
- } | null;
- }>;
- total: number;
+ data: {
+ results: Array<EvalRunResult>;
runId: string;
+ total: number;
};
message?: string;
success: true;
@@ -3101,13 +4765,9 @@ export type PostApiV1EvalRunsByIdResultsData = {
export type PostApiV1EvalRunsByIdResultsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -3124,10 +4784,6 @@ export type PostApiV1EvalRunsByIdResultsErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -3141,22 +4797,7 @@ export type PostApiV1EvalRunsByIdResultsResponses = {
* Successful response
*/
200: {
- data?: {
- items: Array<{
- idempotent: boolean;
- reportedThreads: number;
- runId: string;
- runStatus?: string;
- success: boolean;
- threadId?: string;
- topicFinalized: boolean;
- topicId: string;
- totalThreads: number;
- }>;
- runId: string;
- runStatus: string;
- success: boolean;
- };
+ data: EvalBatchReportResult;
message?: string;
success: true;
timestamp: string;
@@ -3179,13 +4820,9 @@ export type GetApiV1EvalBenchmarksData = {
export type GetApiV1EvalBenchmarksErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -3194,109 +4831,21 @@ export type GetApiV1EvalBenchmarksErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
500: ApiError;
};
-export type GetApiV1EvalBenchmarksError = GetApiV1EvalBenchmarksErrors[keyof GetApiV1EvalBenchmarksErrors];
-
-export type GetApiV1EvalBenchmarksResponses = {
- /**
- * Successful response
- */
- 200: {
- data?: {
- benchmarks: Array<{
- id: string;
- identifier: string;
- name: string;
- description: string | null;
- metadata: {
- [key: string]: unknown;
- } | null;
- referenceUrl: string | null;
- rubrics: Array<{
- id: string;
- name: string;
- type: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external';
- weight: number;
- threshold?: number;
- extractor?: {
- type: 'regex';
- pattern: string;
- group?: number;
- } | {
- type: 'delimiter';
- delimiter: string;
- position?: 'first' | 'last';
- } | {
- type: 'last-line';
- trim?: boolean;
- } | {
- type: 'choice-index';
- labels?: Array<string>;
- pattern?: string;
- };
- config: {
- value: string;
- threshold?: number;
- } | {
- value: number;
- tolerance?: number;
- } | {
- pattern: string;
- } | {
- code: string;
- } | {
- criteria: string;
- model?: string;
- provider?: string;
- systemRole?: string;
- } | {
- values: Array<string>;
- caseSensitive?: boolean;
- } | {
- schema: {
- [key: string]: unknown;
- };
- } | {
- extractor: {
- type: 'regex';
- pattern: string;
- group?: number;
- } | {
- type: 'delimiter';
- delimiter: string;
- position?: 'first' | 'last';
- } | {
- type: 'last-line';
- trim?: boolean;
- } | {
- type: 'choice-index';
- labels?: Array<string>;
- pattern?: string;
- };
- innerMatcher?: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external';
- };
- }>;
- createdAt: string;
- updatedAt: string;
- isSystem: boolean;
- }>;
+export type GetApiV1EvalBenchmarksError = GetApiV1EvalBenchmarksErrors[keyof GetApiV1EvalBenchmarksErrors];
+
+export type GetApiV1EvalBenchmarksResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data: {
+ benchmarks: Array<EvalBenchmark>;
total: number;
};
message?: string;
@@ -3389,13 +4938,9 @@ export type PostApiV1EvalBenchmarksData = {
export type PostApiV1EvalBenchmarksErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -3404,18 +4949,10 @@ export type PostApiV1EvalBenchmarksErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
/**
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -3429,83 +4966,7 @@ export type PostApiV1EvalBenchmarksResponses = {
* Successful response
*/
201: {
- data?: {
- id: string;
- identifier: string;
- name: string;
- description: string | null;
- metadata: {
- [key: string]: unknown;
- } | null;
- referenceUrl: string | null;
- rubrics: Array<{
- id: string;
- name: string;
- type: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external';
- weight: number;
- threshold?: number;
- extractor?: {
- type: 'regex';
- pattern: string;
- group?: number;
- } | {
- type: 'delimiter';
- delimiter: string;
- position?: 'first' | 'last';
- } | {
- type: 'last-line';
- trim?: boolean;
- } | {
- type: 'choice-index';
- labels?: Array<string>;
- pattern?: string;
- };
- config: {
- value: string;
- threshold?: number;
- } | {
- value: number;
- tolerance?: number;
- } | {
- pattern: string;
- } | {
- code: string;
- } | {
- criteria: string;
- model?: string;
- provider?: string;
- systemRole?: string;
- } | {
- values: Array<string>;
- caseSensitive?: boolean;
- } | {
- schema: {
- [key: string]: unknown;
- };
- } | {
- extractor: {
- type: 'regex';
- pattern: string;
- group?: number;
- } | {
- type: 'delimiter';
- delimiter: string;
- position?: 'first' | 'last';
- } | {
- type: 'last-line';
- trim?: boolean;
- } | {
- type: 'choice-index';
- labels?: Array<string>;
- pattern?: string;
- };
- innerMatcher?: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external';
- };
- }>;
- createdAt: string;
- updatedAt: string;
- isSystem: boolean;
- };
+ data: EvalBenchmark;
message?: string;
success: true;
timestamp: string;
@@ -3525,13 +4986,9 @@ export type DeleteApiV1EvalBenchmarksByIdData = {
export type DeleteApiV1EvalBenchmarksByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -3544,14 +5001,6 @@ export type DeleteApiV1EvalBenchmarksByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -3565,9 +5014,7 @@ export type DeleteApiV1EvalBenchmarksByIdResponses = {
* Successful response
*/
200: {
- data?: {
- id: string;
- };
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -3587,13 +5034,9 @@ export type GetApiV1EvalBenchmarksByIdData = {
export type GetApiV1EvalBenchmarksByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -3606,14 +5049,6 @@ export type GetApiV1EvalBenchmarksByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -3627,83 +5062,7 @@ export type GetApiV1EvalBenchmarksByIdResponses = {
* Successful response
*/
200: {
- data?: {
- id: string;
- identifier: string;
- name: string;
- description: string | null;
- metadata: {
- [key: string]: unknown;
- } | null;
- referenceUrl: string | null;
- rubrics: Array<{
- id: string;
- name: string;
- type: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external';
- weight: number;
- threshold?: number;
- extractor?: {
- type: 'regex';
- pattern: string;
- group?: number;
- } | {
- type: 'delimiter';
- delimiter: string;
- position?: 'first' | 'last';
- } | {
- type: 'last-line';
- trim?: boolean;
- } | {
- type: 'choice-index';
- labels?: Array<string>;
- pattern?: string;
- };
- config: {
- value: string;
- threshold?: number;
- } | {
- value: number;
- tolerance?: number;
- } | {
- pattern: string;
- } | {
- code: string;
- } | {
- criteria: string;
- model?: string;
- provider?: string;
- systemRole?: string;
- } | {
- values: Array<string>;
- caseSensitive?: boolean;
- } | {
- schema: {
- [key: string]: unknown;
- };
- } | {
- extractor: {
- type: 'regex';
- pattern: string;
- group?: number;
- } | {
- type: 'delimiter';
- delimiter: string;
- position?: 'first' | 'last';
- } | {
- type: 'last-line';
- trim?: boolean;
- } | {
- type: 'choice-index';
- labels?: Array<string>;
- pattern?: string;
- };
- innerMatcher?: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external';
- };
- }>;
- createdAt: string;
- updatedAt: string;
- isSystem: boolean;
- };
+ data: EvalBenchmark;
message?: string;
success: true;
timestamp: string;
@@ -3795,13 +5154,9 @@ export type PatchApiV1EvalBenchmarksByIdData = {
export type PatchApiV1EvalBenchmarksByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -3818,10 +5173,6 @@ export type PatchApiV1EvalBenchmarksByIdErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -3835,83 +5186,7 @@ export type PatchApiV1EvalBenchmarksByIdResponses = {
* Successful response
*/
200: {
- data?: {
- id: string;
- identifier: string;
- name: string;
- description: string | null;
- metadata: {
- [key: string]: unknown;
- } | null;
- referenceUrl: string | null;
- rubrics: Array<{
- id: string;
- name: string;
- type: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external';
- weight: number;
- threshold?: number;
- extractor?: {
- type: 'regex';
- pattern: string;
- group?: number;
- } | {
- type: 'delimiter';
- delimiter: string;
- position?: 'first' | 'last';
- } | {
- type: 'last-line';
- trim?: boolean;
- } | {
- type: 'choice-index';
- labels?: Array<string>;
- pattern?: string;
- };
- config: {
- value: string;
- threshold?: number;
- } | {
- value: number;
- tolerance?: number;
- } | {
- pattern: string;
- } | {
- code: string;
- } | {
- criteria: string;
- model?: string;
- provider?: string;
- systemRole?: string;
- } | {
- values: Array<string>;
- caseSensitive?: boolean;
- } | {
- schema: {
- [key: string]: unknown;
- };
- } | {
- extractor: {
- type: 'regex';
- pattern: string;
- group?: number;
- } | {
- type: 'delimiter';
- delimiter: string;
- position?: 'first' | 'last';
- } | {
- type: 'last-line';
- trim?: boolean;
- } | {
- type: 'choice-index';
- labels?: Array<string>;
- pattern?: string;
- };
- innerMatcher?: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external';
- };
- }>;
- createdAt: string;
- updatedAt: string;
- isSystem: boolean;
- };
+ data: EvalBenchmark;
message?: string;
success: true;
timestamp: string;
@@ -3935,13 +5210,9 @@ export type GetApiV1EvalDatasetsData = {
export type GetApiV1EvalDatasetsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -3950,18 +5221,6 @@ export type GetApiV1EvalDatasetsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -3975,25 +5234,8 @@ export type GetApiV1EvalDatasetsResponses = {
* Successful response
*/
200: {
- data?: {
- datasets: Array<{
- id: string;
- identifier: string;
- name: string;
- benchmarkId: string | null;
- description: string | null;
- metadata: {
- [key: string]: unknown;
- } | null;
- evalConfig: {
- [key: string]: unknown;
- } | null;
- evalMode: string | null;
- createdAt: string;
- updatedAt: string;
- sourceExperimentId: string | null;
- testCaseCount: number;
- }>;
+ data: {
+ datasets: Array<EvalDataset>;
total: number;
};
message?: string;
@@ -4026,13 +5268,9 @@ export type PostApiV1EvalDatasetsData = {
export type PostApiV1EvalDatasetsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -4049,10 +5287,6 @@ export type PostApiV1EvalDatasetsErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -4066,24 +5300,7 @@ export type PostApiV1EvalDatasetsResponses = {
* Successful response
*/
201: {
- data?: {
- id: string;
- identifier: string;
- name: string;
- benchmarkId: string | null;
- description: string | null;
- metadata: {
- [key: string]: unknown;
- } | null;
- evalConfig: {
- [key: string]: unknown;
- } | null;
- evalMode: string | null;
- createdAt: string;
- updatedAt: string;
- sourceExperimentId: string | null;
- testCaseCount: number;
- };
+ data: EvalDataset;
message?: string;
success: true;
timestamp: string;
@@ -4103,13 +5320,9 @@ export type DeleteApiV1EvalDatasetsByIdData = {
export type DeleteApiV1EvalDatasetsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -4122,14 +5335,6 @@ export type DeleteApiV1EvalDatasetsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -4143,9 +5348,7 @@ export type DeleteApiV1EvalDatasetsByIdResponses = {
* Successful response
*/
200: {
- data?: {
- id: string;
- };
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -4165,13 +5368,9 @@ export type GetApiV1EvalDatasetsByIdData = {
export type GetApiV1EvalDatasetsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -4184,14 +5383,6 @@ export type GetApiV1EvalDatasetsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -4204,25 +5395,8 @@ export type GetApiV1EvalDatasetsByIdResponses = {
/**
* Successful response
*/
- 200: {
- data?: {
- id: string;
- identifier: string;
- name: string;
- benchmarkId: string | null;
- description: string | null;
- metadata: {
- [key: string]: unknown;
- } | null;
- evalConfig: {
- [key: string]: unknown;
- } | null;
- evalMode: string | null;
- createdAt: string;
- updatedAt: string;
- sourceExperimentId: string | null;
- testCaseCount: number;
- };
+ 200: {
+ data: EvalDataset;
message?: string;
success: true;
timestamp: string;
@@ -4254,13 +5428,9 @@ export type PatchApiV1EvalDatasetsByIdData = {
export type PatchApiV1EvalDatasetsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -4277,10 +5447,6 @@ export type PatchApiV1EvalDatasetsByIdErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -4294,24 +5460,7 @@ export type PatchApiV1EvalDatasetsByIdResponses = {
* Successful response
*/
200: {
- data?: {
- id: string;
- identifier: string;
- name: string;
- benchmarkId: string | null;
- description: string | null;
- metadata: {
- [key: string]: unknown;
- } | null;
- evalConfig: {
- [key: string]: unknown;
- } | null;
- evalMode: string | null;
- createdAt: string;
- updatedAt: string;
- sourceExperimentId: string | null;
- testCaseCount: number;
- };
+ data: EvalDataset;
message?: string;
success: true;
timestamp: string;
@@ -4336,13 +5485,9 @@ export type GetApiV1EvalDatasetsByDatasetIdTestCasesData = {
export type GetApiV1EvalDatasetsByDatasetIdTestCasesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -4355,14 +5500,6 @@ export type GetApiV1EvalDatasetsByDatasetIdTestCasesErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -4376,76 +5513,8 @@ export type GetApiV1EvalDatasetsByDatasetIdTestCasesResponses = {
* Successful response
*/
200: {
- data?: {
- testCases: Array<{
- id: string;
- input: string;
- expected?: string;
- category?: string;
- choices?: Array<string>;
- environment?: {
- envPrompt?: string;
- toolForwarding?: {
- [key: string]: {
- endpoint: string;
- timeoutMs?: number;
- };
- };
- };
- messages?: Array<{
- content: string;
- role: 'user' | 'assistant' | 'system' | 'tool';
- id?: string;
- parentId?: string | null;
- model?: string;
- provider?: string;
- createdAt?: string | number;
- updatedAt?: string | number;
- tools?: Array<{
- [key: string]: unknown;
- }>;
- tool_call_id?: string;
- metadata?: {
- [key: string]: unknown;
- };
- reasoning?: {
- [key: string]: unknown;
- };
- plugin?: {
- [key: string]: unknown;
- };
- pluginState?: {
- [key: string]: unknown;
- };
- pluginError?: {
- [key: string]: unknown;
- };
- pluginIntervention?: {
- [key: string]: unknown;
- };
- error?: {
- [key: string]: unknown;
- };
- search?: {
- [key: string]: unknown;
- };
- }>;
- caseId?: string;
- sortOrder: number | null;
- evalMode?: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external' | null;
- evalConfig?: {
- [key: string]: unknown;
- } | null;
- createdAt: string;
- updatedAt: string;
- datasetId: string;
- content: {
- [key: string]: unknown;
- };
- metadata: {
- [key: string]: unknown;
- } | null;
- }>;
+ data: {
+ testCases: Array<EvalTestCase>;
total: number;
};
message?: string;
@@ -4526,13 +5595,9 @@ export type PostApiV1EvalDatasetsByDatasetIdTestCasesData = {
export type PostApiV1EvalDatasetsByDatasetIdTestCasesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -4549,10 +5614,6 @@ export type PostApiV1EvalDatasetsByDatasetIdTestCasesErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -4566,75 +5627,7 @@ export type PostApiV1EvalDatasetsByDatasetIdTestCasesResponses = {
* Successful response
*/
201: {
- data?: {
- id: string;
- input: string;
- expected?: string;
- category?: string;
- choices?: Array<string>;
- environment?: {
- envPrompt?: string;
- toolForwarding?: {
- [key: string]: {
- endpoint: string;
- timeoutMs?: number;
- };
- };
- };
- messages?: Array<{
- content: string;
- role: 'user' | 'assistant' | 'system' | 'tool';
- id?: string;
- parentId?: string | null;
- model?: string;
- provider?: string;
- createdAt?: string | number;
- updatedAt?: string | number;
- tools?: Array<{
- [key: string]: unknown;
- }>;
- tool_call_id?: string;
- metadata?: {
- [key: string]: unknown;
- };
- reasoning?: {
- [key: string]: unknown;
- };
- plugin?: {
- [key: string]: unknown;
- };
- pluginState?: {
- [key: string]: unknown;
- };
- pluginError?: {
- [key: string]: unknown;
- };
- pluginIntervention?: {
- [key: string]: unknown;
- };
- error?: {
- [key: string]: unknown;
- };
- search?: {
- [key: string]: unknown;
- };
- }>;
- caseId?: string;
- sortOrder: number | null;
- evalMode?: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external' | null;
- evalConfig?: {
- [key: string]: unknown;
- } | null;
- createdAt: string;
- updatedAt: string;
- datasetId: string;
- content: {
- [key: string]: unknown;
- };
- metadata: {
- [key: string]: unknown;
- } | null;
- };
+ data: EvalTestCase;
message?: string;
success: true;
timestamp: string;
@@ -4654,13 +5647,9 @@ export type DeleteApiV1EvalTestCasesByIdData = {
export type DeleteApiV1EvalTestCasesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -4673,14 +5662,6 @@ export type DeleteApiV1EvalTestCasesByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -4694,9 +5675,7 @@ export type DeleteApiV1EvalTestCasesByIdResponses = {
* Successful response
*/
200: {
- data?: {
- id: string;
- };
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -4716,13 +5695,9 @@ export type GetApiV1EvalTestCasesByIdData = {
export type GetApiV1EvalTestCasesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -4735,14 +5710,6 @@ export type GetApiV1EvalTestCasesByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -4756,75 +5723,7 @@ export type GetApiV1EvalTestCasesByIdResponses = {
* Successful response
*/
200: {
- data?: {
- id: string;
- input: string;
- expected?: string;
- category?: string;
- choices?: Array<string>;
- environment?: {
- envPrompt?: string;
- toolForwarding?: {
- [key: string]: {
- endpoint: string;
- timeoutMs?: number;
- };
- };
- };
- messages?: Array<{
- content: string;
- role: 'user' | 'assistant' | 'system' | 'tool';
- id?: string;
- parentId?: string | null;
- model?: string;
- provider?: string;
- createdAt?: string | number;
- updatedAt?: string | number;
- tools?: Array<{
- [key: string]: unknown;
- }>;
- tool_call_id?: string;
- metadata?: {
- [key: string]: unknown;
- };
- reasoning?: {
- [key: string]: unknown;
- };
- plugin?: {
- [key: string]: unknown;
- };
- pluginState?: {
- [key: string]: unknown;
- };
- pluginError?: {
- [key: string]: unknown;
- };
- pluginIntervention?: {
- [key: string]: unknown;
- };
- error?: {
- [key: string]: unknown;
- };
- search?: {
- [key: string]: unknown;
- };
- }>;
- caseId?: string;
- sortOrder: number | null;
- evalMode?: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external' | null;
- evalConfig?: {
- [key: string]: unknown;
- } | null;
- createdAt: string;
- updatedAt: string;
- datasetId: string;
- content: {
- [key: string]: unknown;
- };
- metadata: {
- [key: string]: unknown;
- } | null;
- };
+ data: EvalTestCase;
message?: string;
success: true;
timestamp: string;
@@ -4902,13 +5801,9 @@ export type PatchApiV1EvalTestCasesByIdData = {
export type PatchApiV1EvalTestCasesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -4921,14 +5816,6 @@ export type PatchApiV1EvalTestCasesByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -4942,75 +5829,7 @@ export type PatchApiV1EvalTestCasesByIdResponses = {
* Successful response
*/
200: {
- data?: {
- id: string;
- input: string;
- expected?: string;
- category?: string;
- choices?: Array<string>;
- environment?: {
- envPrompt?: string;
- toolForwarding?: {
- [key: string]: {
- endpoint: string;
- timeoutMs?: number;
- };
- };
- };
- messages?: Array<{
- content: string;
- role: 'user' | 'assistant' | 'system' | 'tool';
- id?: string;
- parentId?: string | null;
- model?: string;
- provider?: string;
- createdAt?: string | number;
- updatedAt?: string | number;
- tools?: Array<{
- [key: string]: unknown;
- }>;
- tool_call_id?: string;
- metadata?: {
- [key: string]: unknown;
- };
- reasoning?: {
- [key: string]: unknown;
- };
- plugin?: {
- [key: string]: unknown;
- };
- pluginState?: {
- [key: string]: unknown;
- };
- pluginError?: {
- [key: string]: unknown;
- };
- pluginIntervention?: {
- [key: string]: unknown;
- };
- error?: {
- [key: string]: unknown;
- };
- search?: {
- [key: string]: unknown;
- };
- }>;
- caseId?: string;
- sortOrder: number | null;
- evalMode?: 'equals' | 'contains' | 'regex' | 'starts-with' | 'ends-with' | 'any-of' | 'numeric' | 'extract-match' | 'json-schema' | 'javascript' | 'python' | 'llm-rubric' | 'factuality' | 'answer-relevance' | 'similar' | 'levenshtein' | 'rubric' | 'external' | null;
- evalConfig?: {
- [key: string]: unknown;
- } | null;
- createdAt: string;
- updatedAt: string;
- datasetId: string;
- content: {
- [key: string]: unknown;
- };
- metadata: {
- [key: string]: unknown;
- } | null;
- };
+ data: EvalTestCase;
message?: string;
success: true;
timestamp: string;
@@ -5030,13 +5849,9 @@ export type PostApiV1EvalRunsByIdClaimData = {
export type PostApiV1EvalRunsByIdClaimErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -5053,10 +5868,6 @@ export type PostApiV1EvalRunsByIdClaimErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5070,25 +5881,7 @@ export type PostApiV1EvalRunsByIdClaimResponses = {
* Successful response
*/
200: {
- data?: {
- id: string;
- createdAt: string;
- updatedAt: string;
- config: {
- [key: string]: unknown;
- };
- executionMode: 'internal' | 'external';
- datasetId: string;
- experimentId: string | null;
- parentRunId: string | null;
- status: 'idle' | 'pending' | 'running' | 'external' | 'completed' | 'failed' | 'aborted';
- targetAgentId: string | null;
- name: string | null;
- metrics: {
- [key: string]: unknown;
- } | null;
- startedAt: string | null;
- };
+ data: EvalRun;
message?: string;
success: true;
timestamp: string;
@@ -5110,13 +5903,9 @@ export type PatchApiV1EvalRunsByIdStatusData = {
export type PatchApiV1EvalRunsByIdStatusErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -5133,10 +5922,6 @@ export type PatchApiV1EvalRunsByIdStatusErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5150,25 +5935,7 @@ export type PatchApiV1EvalRunsByIdStatusResponses = {
* Successful response
*/
200: {
- data?: {
- id: string;
- createdAt: string;
- updatedAt: string;
- config: {
- [key: string]: unknown;
- };
- executionMode: 'internal' | 'external';
- datasetId: string;
- experimentId: string | null;
- parentRunId: string | null;
- status: 'idle' | 'pending' | 'running' | 'external' | 'completed' | 'failed' | 'aborted';
- targetAgentId: string | null;
- name: string | null;
- metrics: {
- [key: string]: unknown;
- } | null;
- startedAt: string | null;
- };
+ data: EvalRun;
message?: string;
success: true;
timestamp: string;
@@ -5188,13 +5955,9 @@ export type PostApiV1EvalRunsByIdRetryErrorsData = {
export type PostApiV1EvalRunsByIdRetryErrorsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -5211,10 +5974,6 @@ export type PostApiV1EvalRunsByIdRetryErrorsErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5228,10 +5987,7 @@ export type PostApiV1EvalRunsByIdRetryErrorsResponses = {
* Successful response
*/
200: {
- data?: {
- runId: string;
- retryCount: number;
- };
+ data: EvalRetryErrors;
message?: string;
success: true;
timestamp: string;
@@ -5260,13 +6016,9 @@ export type PutApiV1EvalRunsByRunIdTopicsByTopicIdResultData = {
export type PutApiV1EvalRunsByRunIdTopicsByTopicIdResultErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -5283,10 +6035,6 @@ export type PutApiV1EvalRunsByRunIdTopicsByTopicIdResultErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5300,17 +6048,7 @@ export type PutApiV1EvalRunsByRunIdTopicsByTopicIdResultResponses = {
* Successful response
*/
200: {
- data?: {
- idempotent: boolean;
- reportedThreads: number;
- runId: string;
- runStatus?: string;
- success: boolean;
- threadId?: string;
- topicFinalized: boolean;
- topicId: string;
- totalThreads: number;
- };
+ data: EvalReportResult;
message?: string;
success: true;
timestamp: string;
@@ -5333,13 +6071,9 @@ export type GetApiV1PluginsData = {
export type GetApiV1PluginsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -5348,18 +6082,6 @@ export type GetApiV1PluginsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5373,15 +6095,7 @@ export type GetApiV1PluginsResponses = {
* Successful response
*/
200: {
- data?: {
- plugins: Array<{
- identifier?: string;
- type?: string;
- createdAt?: string;
- updatedAt?: string;
- }>;
- total: number;
- };
+ data: InstalledPluginList;
message?: string;
success: true;
timestamp: string;
@@ -5409,13 +6123,9 @@ export type GetApiV1FilesData = {
export type GetApiV1FilesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -5424,18 +6134,6 @@ export type GetApiV1FilesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5449,11 +6147,7 @@ export type GetApiV1FilesResponses = {
* Successful response
*/
200: {
- data?: {
- files: Array<File>;
- total?: number;
- [key: string]: unknown;
- };
+ data: FileList;
message?: string;
success: true;
timestamp: string;
@@ -5490,18 +6184,6 @@ export type PostApiV1FilesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5515,12 +6197,7 @@ export type PostApiV1FilesResponses = {
* Successful response
*/
200: {
- data?: {
- file: File;
- parsed?: {
- [key: string]: unknown;
- };
- };
+ data: FileDetail;
message?: string;
success: true;
timestamp: string;
@@ -5540,13 +6217,9 @@ export type DeleteApiV1FilesByIdData = {
export type DeleteApiV1FilesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -5555,18 +6228,6 @@ export type DeleteApiV1FilesByIdErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5580,9 +6241,7 @@ export type DeleteApiV1FilesByIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -5602,13 +6261,9 @@ export type GetApiV1FilesByIdData = {
export type GetApiV1FilesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -5617,18 +6272,6 @@ export type GetApiV1FilesByIdErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5642,12 +6285,7 @@ export type GetApiV1FilesByIdResponses = {
* Successful response
*/
200: {
- data?: {
- file: File;
- parsed?: {
- [key: string]: unknown;
- };
- };
+ data: FileDetail;
message?: string;
success: true;
timestamp: string;
@@ -5669,13 +6307,9 @@ export type PatchApiV1FilesByIdData = {
export type PatchApiV1FilesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -5688,14 +6322,6 @@ export type PatchApiV1FilesByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5709,7 +6335,7 @@ export type PatchApiV1FilesByIdResponses = {
* Successful response
*/
200: {
- data?: File;
+ data: FileDetail;
message?: string;
success: true;
timestamp: string;
@@ -5731,13 +6357,9 @@ export type GetApiV1FilesByIdUrlData = {
export type GetApiV1FilesByIdUrlErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -5746,18 +6368,6 @@ export type GetApiV1FilesByIdUrlErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5771,9 +6381,7 @@ export type GetApiV1FilesByIdUrlResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: FileUrl;
message?: string;
success: true;
timestamp: string;
@@ -5795,13 +6403,9 @@ export type PostApiV1FilesByIdParsesData = {
export type PostApiV1FilesByIdParsesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -5810,18 +6414,6 @@ export type PostApiV1FilesByIdParsesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5835,9 +6427,7 @@ export type PostApiV1FilesByIdParsesResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: FileParseResult;
message?: string;
success: true;
timestamp: string;
@@ -5857,13 +6447,9 @@ export type GetApiV1FilesByIdChunksData = {
export type GetApiV1FilesByIdChunksErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -5872,18 +6458,6 @@ export type GetApiV1FilesByIdChunksErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5897,9 +6471,7 @@ export type GetApiV1FilesByIdChunksResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: FileChunkStatus;
message?: string;
success: true;
timestamp: string;
@@ -5922,13 +6494,9 @@ export type PostApiV1FilesByIdChunksData = {
export type PostApiV1FilesByIdChunksErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -5937,18 +6505,6 @@ export type PostApiV1FilesByIdChunksErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -5962,9 +6518,7 @@ export type PostApiV1FilesByIdChunksResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: FileChunkTask;
message?: string;
success: true;
timestamp: string;
@@ -6000,18 +6554,6 @@ export type PostApiV1FilesBatchesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -6025,23 +6567,7 @@ export type PostApiV1FilesBatchesResponses = {
* Successful response
*/
200: {
- data?: {
- failed: Array<{
- error: string;
- name: string;
- }>;
- successful: Array<{
- file: File;
- parsed?: {
- [key: string]: unknown;
- };
- }>;
- summary: {
- failed: number;
- successful: number;
- total: number;
- };
- };
+ data: BatchFileUploadResult;
message?: string;
success: true;
timestamp: string;
@@ -6061,13 +6587,9 @@ export type PostApiV1FilesQueriesData = {
export type PostApiV1FilesQueriesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6076,18 +6598,6 @@ export type PostApiV1FilesQueriesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -6101,20 +6611,7 @@ export type PostApiV1FilesQueriesResponses = {
* Successful response
*/
200: {
- data?: {
- failed: Array<{
- error: string;
- fileId: string;
- }>;
- files: Array<{
- file: File;
- parsed?: {
- [key: string]: unknown;
- };
- }>;
- success: number;
- total: number;
- };
+ data: BatchGetFilesResult;
message?: string;
success: true;
timestamp: string;
@@ -6139,13 +6636,9 @@ export type GetApiV1GoalsData = {
export type GetApiV1GoalsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6154,18 +6647,6 @@ export type GetApiV1GoalsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -6179,9 +6660,7 @@ export type GetApiV1GoalsResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: GoalList;
message?: string;
success: true;
timestamp: string;
@@ -6219,13 +6698,9 @@ export type PostApiV1GoalsData = {
export type PostApiV1GoalsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6233,19 +6708,11 @@ export type PostApiV1GoalsErrors = {
/**
* Insufficient permission
*/
- 403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
+ 403: ApiError;
/**
- * Rate limit exceeded
+ * Resource not found
*/
- 429: ApiError;
+ 404: ApiError;
/**
* Internal server error
*/
@@ -6259,9 +6726,7 @@ export type PostApiV1GoalsResponses = {
* Successful response
*/
201: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: GoalGraphSnapshot;
message?: string;
success: true;
timestamp: string;
@@ -6281,13 +6746,9 @@ export type DeleteApiV1GoalsByIdData = {
export type DeleteApiV1GoalsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6305,9 +6766,9 @@ export type DeleteApiV1GoalsByIdErrors = {
*/
409: ApiError;
/**
- * Rate limit exceeded
+ * Precondition failed
*/
- 429: ApiError;
+ 412: ApiError;
/**
* Internal server error
*/
@@ -6321,9 +6782,7 @@ export type DeleteApiV1GoalsByIdResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -6343,13 +6802,9 @@ export type GetApiV1GoalsByIdData = {
export type GetApiV1GoalsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6362,14 +6817,6 @@ export type GetApiV1GoalsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -6383,9 +6830,7 @@ export type GetApiV1GoalsByIdResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: GoalGraph;
message?: string;
success: true;
timestamp: string;
@@ -6417,13 +6862,9 @@ export type PatchApiV1GoalsByIdData = {
export type PatchApiV1GoalsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6436,14 +6877,6 @@ export type PatchApiV1GoalsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -6457,9 +6890,7 @@ export type PatchApiV1GoalsByIdResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: GoalGraph;
message?: string;
success: true;
timestamp: string;
@@ -6479,13 +6910,9 @@ export type GetApiV1GoalsByIdSupervisionData = {
export type GetApiV1GoalsByIdSupervisionErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6498,14 +6925,6 @@ export type GetApiV1GoalsByIdSupervisionErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -6519,9 +6938,7 @@ export type GetApiV1GoalsByIdSupervisionResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: GoalSupervision;
message?: string;
success: true;
timestamp: string;
@@ -6541,13 +6958,9 @@ export type PostApiV1GoalsByIdAdvanceData = {
export type PostApiV1GoalsByIdAdvanceErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6560,14 +6973,6 @@ export type PostApiV1GoalsByIdAdvanceErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -6581,9 +6986,7 @@ export type PostApiV1GoalsByIdAdvanceResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: GoalAdvanceResult;
message?: string;
success: true;
timestamp: string;
@@ -6603,13 +7006,9 @@ export type PostApiV1GoalsByIdPauseData = {
export type PostApiV1GoalsByIdPauseErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6627,9 +7026,9 @@ export type PostApiV1GoalsByIdPauseErrors = {
*/
409: ApiError;
/**
- * Rate limit exceeded
+ * Precondition failed
*/
- 429: ApiError;
+ 412: ApiError;
/**
* Internal server error
*/
@@ -6643,9 +7042,7 @@ export type PostApiV1GoalsByIdPauseResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: Goal;
message?: string;
success: true;
timestamp: string;
@@ -6665,13 +7062,9 @@ export type PostApiV1GoalsByIdResumeData = {
export type PostApiV1GoalsByIdResumeErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6689,9 +7082,9 @@ export type PostApiV1GoalsByIdResumeErrors = {
*/
409: ApiError;
/**
- * Rate limit exceeded
+ * Precondition failed
*/
- 429: ApiError;
+ 412: ApiError;
/**
* Internal server error
*/
@@ -6705,9 +7098,7 @@ export type PostApiV1GoalsByIdResumeResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: Goal;
message?: string;
success: true;
timestamp: string;
@@ -6729,13 +7120,9 @@ export type PostApiV1GoalsByIdRestartData = {
export type PostApiV1GoalsByIdRestartErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6749,13 +7136,9 @@ export type PostApiV1GoalsByIdRestartErrors = {
*/
404: ApiError;
/**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
+ * Precondition failed
*/
- 429: ApiError;
+ 412: ApiError;
/**
* Internal server error
*/
@@ -6769,9 +7152,7 @@ export type PostApiV1GoalsByIdRestartResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: GoalRestartResult;
message?: string;
success: true;
timestamp: string;
@@ -6803,13 +7184,9 @@ export type PostApiV1ImMessagesData = {
export type PostApiV1ImMessagesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6826,10 +7203,6 @@ export type PostApiV1ImMessagesErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -6843,26 +7216,7 @@ export type PostApiV1ImMessagesResponses = {
* Successful response
*/
200: {
- data?: {
- accepted: boolean;
- operationId: string | null;
- topicId: string;
- userMessage: {
- agentId: string | null;
- content: string;
- createdAt: string;
- error: boolean;
- files?: Array<{
- id: string;
- name: string;
- fileType: string;
- size: number;
- url: string;
- }>;
- id: string;
- role: 'assistant' | 'user';
- };
- };
+ data: ImSendResult;
message?: string;
success: true;
timestamp: string;
@@ -6887,13 +7241,9 @@ export type GetApiV1ImTopicsByTopicIdSyncData = {
export type GetApiV1ImTopicsByTopicIdSyncErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6906,14 +7256,6 @@ export type GetApiV1ImTopicsByTopicIdSyncErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -6927,31 +7269,7 @@ export type GetApiV1ImTopicsByTopicIdSyncResponses = {
* Successful response
*/
200: {
- data?: {
- cursor: string;
- messages: Array<{
- agentId: string | null;
- content: string;
- createdAt: string;
- error: boolean;
- files?: Array<{
- id: string;
- name: string;
- fileType: string;
- size: number;
- url: string;
- }>;
- id: string;
- role: 'assistant' | 'user';
- }>;
- readUpTo: {
- messageId: string;
- readAt: string;
- } | null;
- state: string;
- typing: boolean;
- unread: number;
- };
+ data: ImSyncResult;
message?: string;
success: true;
timestamp: string;
@@ -6973,13 +7291,9 @@ export type PostApiV1ImTopicsByTopicIdReadData = {
export type PostApiV1ImTopicsByTopicIdReadErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -6992,14 +7306,6 @@ export type PostApiV1ImTopicsByTopicIdReadErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7013,9 +7319,7 @@ export type PostApiV1ImTopicsByTopicIdReadResponses = {
* Successful response
*/
200: {
- data?: {
- unread: number;
- };
+ data: ImReadResult;
message?: string;
success: true;
timestamp: string;
@@ -7037,13 +7341,9 @@ export type GetApiV1KnowledgeBasesData = {
export type GetApiV1KnowledgeBasesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7052,18 +7352,6 @@ export type GetApiV1KnowledgeBasesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7077,11 +7365,7 @@ export type GetApiV1KnowledgeBasesResponses = {
* Successful response
*/
200: {
- data?: {
- knowledgeBases: Array<KnowledgeBase>;
- total?: number;
- [key: string]: unknown;
- };
+ data: KnowledgeBaseList;
message?: string;
success: true;
timestamp: string;
@@ -7103,13 +7387,9 @@ export type PostApiV1KnowledgeBasesData = {
export type PostApiV1KnowledgeBasesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7118,18 +7398,6 @@ export type PostApiV1KnowledgeBasesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7143,7 +7411,7 @@ export type PostApiV1KnowledgeBasesResponses = {
* Successful response
*/
200: {
- data?: KnowledgeBase;
+ data: KnowledgeBaseDetail;
message?: string;
success: true;
timestamp: string;
@@ -7163,13 +7431,9 @@ export type DeleteApiV1KnowledgeBasesByIdData = {
export type DeleteApiV1KnowledgeBasesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7182,14 +7446,6 @@ export type DeleteApiV1KnowledgeBasesByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7203,9 +7459,7 @@ export type DeleteApiV1KnowledgeBasesByIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -7225,13 +7479,9 @@ export type GetApiV1KnowledgeBasesByIdData = {
export type GetApiV1KnowledgeBasesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7244,14 +7494,6 @@ export type GetApiV1KnowledgeBasesByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7265,7 +7507,7 @@ export type GetApiV1KnowledgeBasesByIdResponses = {
* Successful response
*/
200: {
- data?: KnowledgeBase;
+ data: KnowledgeBaseDetail;
message?: string;
success: true;
timestamp: string;
@@ -7289,13 +7531,9 @@ export type PatchApiV1KnowledgeBasesByIdData = {
export type PatchApiV1KnowledgeBasesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7308,14 +7546,6 @@ export type PatchApiV1KnowledgeBasesByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7329,7 +7559,7 @@ export type PatchApiV1KnowledgeBasesByIdResponses = {
* Successful response
*/
200: {
- data?: KnowledgeBase;
+ data: KnowledgeBaseDetail;
message?: string;
success: true;
timestamp: string;
@@ -7354,13 +7584,9 @@ export type GetApiV1KnowledgeBasesByIdFilesData = {
export type GetApiV1KnowledgeBasesByIdFilesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7373,14 +7599,6 @@ export type GetApiV1KnowledgeBasesByIdFilesErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7394,9 +7612,7 @@ export type GetApiV1KnowledgeBasesByIdFilesResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: FileList;
message?: string;
success: true;
timestamp: string;
@@ -7418,13 +7634,9 @@ export type DeleteApiV1KnowledgeBasesByIdFilesBatchData = {
export type DeleteApiV1KnowledgeBasesByIdFilesBatchErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7437,14 +7649,6 @@ export type DeleteApiV1KnowledgeBasesByIdFilesBatchErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7458,9 +7662,7 @@ export type DeleteApiV1KnowledgeBasesByIdFilesBatchResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: KnowledgeBaseFileOperationResult;
message?: string;
success: true;
timestamp: string;
@@ -7482,13 +7684,9 @@ export type PostApiV1KnowledgeBasesByIdFilesBatchData = {
export type PostApiV1KnowledgeBasesByIdFilesBatchErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7500,15 +7698,7 @@ export type PostApiV1KnowledgeBasesByIdFilesBatchErrors = {
/**
* Resource not found
*/
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
+ 404: ApiError;
/**
* Internal server error
*/
@@ -7522,9 +7712,7 @@ export type PostApiV1KnowledgeBasesByIdFilesBatchResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: KnowledgeBaseFileOperationResult;
message?: string;
success: true;
timestamp: string;
@@ -7547,13 +7735,9 @@ export type PostApiV1KnowledgeBasesByIdFilesMoveData = {
export type PostApiV1KnowledgeBasesByIdFilesMoveErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7566,14 +7750,6 @@ export type PostApiV1KnowledgeBasesByIdFilesMoveErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7587,9 +7763,7 @@ export type PostApiV1KnowledgeBasesByIdFilesMoveResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: KnowledgeBaseFileOperationResult;
message?: string;
success: true;
timestamp: string;
@@ -7606,10 +7780,6 @@ export type GetApiV1McpServersData = {
};
export type GetApiV1McpServersErrors = {
- /**
- * Invalid request
- */
- 400: ApiError;
/**
* Authentication required
*/
@@ -7618,18 +7788,6 @@ export type GetApiV1McpServersErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7643,7 +7801,7 @@ export type GetApiV1McpServersResponses = {
* Successful response
*/
200: {
- data?: Array<McpServer>;
+ data: Array<McpServer>;
message?: string;
success: true;
timestamp: string;
@@ -7679,13 +7837,9 @@ export type PostApiV1McpServersData = {
export type PostApiV1McpServersErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7694,18 +7848,10 @@ export type PostApiV1McpServersErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
/**
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7719,7 +7865,7 @@ export type PostApiV1McpServersResponses = {
* Successful response
*/
201: {
- data?: McpServer;
+ data: McpServer;
message?: string;
success: true;
timestamp: string;
@@ -7739,13 +7885,9 @@ export type DeleteApiV1McpServersByIdData = {
export type DeleteApiV1McpServersByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7758,14 +7900,6 @@ export type DeleteApiV1McpServersByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7779,9 +7913,7 @@ export type DeleteApiV1McpServersByIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -7801,13 +7933,9 @@ export type GetApiV1McpServersByIdData = {
export type GetApiV1McpServersByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7820,14 +7948,6 @@ export type GetApiV1McpServersByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7841,7 +7961,7 @@ export type GetApiV1McpServersByIdResponses = {
* Successful response
*/
200: {
- data?: McpServer;
+ data: McpServer;
message?: string;
success: true;
timestamp: string;
@@ -7878,13 +7998,9 @@ export type PatchApiV1McpServersByIdData = {
export type PatchApiV1McpServersByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7897,14 +8013,6 @@ export type PatchApiV1McpServersByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7918,7 +8026,7 @@ export type PatchApiV1McpServersByIdResponses = {
* Successful response
*/
200: {
- data?: McpServer;
+ data: McpServer;
message?: string;
success: true;
timestamp: string;
@@ -7938,13 +8046,9 @@ export type PostApiV1McpServersByIdSyncData = {
export type PostApiV1McpServersByIdSyncErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -7957,14 +8061,6 @@ export type PostApiV1McpServersByIdSyncErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -7978,11 +8074,7 @@ export type PostApiV1McpServersByIdSyncResponses = {
* Successful response
*/
200: {
- data?: {
- id: string;
- status: 'connected';
- toolCount: number;
- };
+ data: McpServerSyncResult;
message?: string;
success: true;
timestamp: string;
@@ -7999,10 +8091,6 @@ export type GetApiV1MemoriesPersonaData = {
};
export type GetApiV1MemoriesPersonaErrors = {
- /**
- * Invalid request
- */
- 400: ApiError;
/**
* Authentication required
*/
@@ -8011,18 +8099,6 @@ export type GetApiV1MemoriesPersonaErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8036,9 +8112,7 @@ export type GetApiV1MemoriesPersonaResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: MemoryPersona | null;
message?: string;
success: true;
timestamp: string;
@@ -8055,10 +8129,6 @@ export type GetApiV1MemoriesPersonaVersionsData = {
};
export type GetApiV1MemoriesPersonaVersionsErrors = {
- /**
- * Invalid request
- */
- 400: ApiError;
/**
* Authentication required
*/
@@ -8067,18 +8137,6 @@ export type GetApiV1MemoriesPersonaVersionsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8092,9 +8150,7 @@ export type GetApiV1MemoriesPersonaVersionsResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: Array<MemoryPersonaVersion>;
message?: string;
success: true;
timestamp: string;
@@ -8111,10 +8167,6 @@ export type DeleteApiV1MemoriesData = {
};
export type DeleteApiV1MemoriesErrors = {
- /**
- * Invalid request
- */
- 400: ApiError;
/**
* Authentication required
*/
@@ -8123,18 +8175,6 @@ export type DeleteApiV1MemoriesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8148,9 +8188,7 @@ export type DeleteApiV1MemoriesResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: DeletedResources;
message?: string;
success: true;
timestamp: string;
@@ -8171,13 +8209,9 @@ export type DeleteApiV1MemoriesByCategoryByIdData = {
export type DeleteApiV1MemoriesByCategoryByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -8190,14 +8224,6 @@ export type DeleteApiV1MemoriesByCategoryByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8211,9 +8237,7 @@ export type DeleteApiV1MemoriesByCategoryByIdResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -8233,13 +8257,9 @@ export type GetApiV1MemoriesByCategoryData = {
export type GetApiV1MemoriesByCategoryErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -8248,18 +8268,6 @@ export type GetApiV1MemoriesByCategoryErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8273,9 +8281,7 @@ export type GetApiV1MemoriesByCategoryResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: MemoryCategoryEntries;
message?: string;
success: true;
timestamp: string;
@@ -8295,13 +8301,9 @@ export type DeleteApiV1MessageTranslationsByMessageIdData = {
export type DeleteApiV1MessageTranslationsByMessageIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -8314,14 +8316,6 @@ export type DeleteApiV1MessageTranslationsByMessageIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8335,9 +8329,7 @@ export type DeleteApiV1MessageTranslationsByMessageIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -8357,13 +8349,9 @@ export type GetApiV1MessageTranslationsByMessageIdData = {
export type GetApiV1MessageTranslationsByMessageIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -8372,18 +8360,6 @@ export type GetApiV1MessageTranslationsByMessageIdErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8397,9 +8373,7 @@ export type GetApiV1MessageTranslationsByMessageIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: MessageTranslation | null;
message?: string;
success: true;
timestamp: string;
@@ -8425,13 +8399,9 @@ export type PatchApiV1MessageTranslationsByMessageIdData = {
export type PatchApiV1MessageTranslationsByMessageIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -8440,18 +8410,6 @@ export type PatchApiV1MessageTranslationsByMessageIdErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8465,9 +8423,7 @@ export type PatchApiV1MessageTranslationsByMessageIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: MessageTranslationWrite;
message?: string;
success: true;
timestamp: string;
@@ -8492,13 +8448,9 @@ export type PostApiV1MessageTranslationsByMessageIdData = {
export type PostApiV1MessageTranslationsByMessageIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -8507,18 +8459,6 @@ export type PostApiV1MessageTranslationsByMessageIdErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8532,9 +8472,7 @@ export type PostApiV1MessageTranslationsByMessageIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: MessageTranslationWrite;
message?: string;
success: true;
timestamp: string;
@@ -8557,13 +8495,9 @@ export type GetApiV1MessagesCountData = {
export type GetApiV1MessagesCountErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -8572,18 +8506,6 @@ export type GetApiV1MessagesCountErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8597,7 +8519,7 @@ export type GetApiV1MessagesCountResponses = {
* Successful response
*/
200: {
- data?: {
+ data: {
count: number;
};
message?: string;
@@ -8619,13 +8541,9 @@ export type DeleteApiV1MessagesData = {
export type DeleteApiV1MessagesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -8634,18 +8552,6 @@ export type DeleteApiV1MessagesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8659,9 +8565,7 @@ export type DeleteApiV1MessagesResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResources;
message?: string;
success: true;
timestamp: string;
@@ -8689,13 +8593,9 @@ export type GetApiV1MessagesData = {
export type GetApiV1MessagesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -8704,18 +8604,6 @@ export type GetApiV1MessagesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8729,10 +8617,9 @@ export type GetApiV1MessagesResponses = {
* Successful response
*/
200: {
- data?: {
+ data: {
messages: Array<Message>;
- total?: number;
- [key: string]: unknown;
+ total: number;
};
message?: string;
success: true;
@@ -8770,13 +8657,9 @@ export type PostApiV1MessagesData = {
export type PostApiV1MessagesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -8785,18 +8668,6 @@ export type PostApiV1MessagesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8810,7 +8681,7 @@ export type PostApiV1MessagesResponses = {
* Successful response
*/
200: {
- data?: Message;
+ data: Message;
message?: string;
success: true;
timestamp: string;
@@ -8830,13 +8701,9 @@ export type DeleteApiV1MessagesByIdData = {
export type DeleteApiV1MessagesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -8849,14 +8716,6 @@ export type DeleteApiV1MessagesByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8870,9 +8729,7 @@ export type DeleteApiV1MessagesByIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -8892,13 +8749,9 @@ export type GetApiV1MessagesByIdData = {
export type GetApiV1MessagesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -8911,14 +8764,6 @@ export type GetApiV1MessagesByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -8932,7 +8777,7 @@ export type GetApiV1MessagesByIdResponses = {
* Successful response
*/
200: {
- data?: Message;
+ data: Message;
message?: string;
success: true;
timestamp: string;
@@ -8969,13 +8814,9 @@ export type PostApiV1MessagesRepliesData = {
export type PostApiV1MessagesRepliesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -8984,18 +8825,6 @@ export type PostApiV1MessagesRepliesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9009,7 +8838,7 @@ export type PostApiV1MessagesRepliesResponses = {
* Successful response
*/
200: {
- data?: Message | null;
+ data: Message | null;
message?: string;
success: true;
timestamp: string;
@@ -9034,13 +8863,9 @@ export type GetApiV1ModelsData = {
export type GetApiV1ModelsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -9049,18 +8874,6 @@ export type GetApiV1ModelsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9074,10 +8887,9 @@ export type GetApiV1ModelsResponses = {
* Successful response
*/
200: {
- data?: {
+ data: {
models: Array<Model>;
- total?: number;
- [key: string]: unknown;
+ total: number;
};
message?: string;
success: true;
@@ -9120,13 +8932,9 @@ export type PostApiV1ModelsData = {
export type PostApiV1ModelsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -9135,18 +8943,6 @@ export type PostApiV1ModelsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9160,7 +8956,7 @@ export type PostApiV1ModelsResponses = {
* Successful response
*/
200: {
- data?: Model;
+ data: Model;
message?: string;
success: true;
timestamp: string;
@@ -9181,13 +8977,9 @@ export type GetApiV1ModelsByProviderIdByModelIdData = {
export type GetApiV1ModelsByProviderIdByModelIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -9200,14 +8992,6 @@ export type GetApiV1ModelsByProviderIdByModelIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9221,9 +9005,7 @@ export type GetApiV1ModelsByProviderIdByModelIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: Model;
message?: string;
success: true;
timestamp: string;
@@ -9266,13 +9048,9 @@ export type PatchApiV1ModelsByProviderIdByModelIdData = {
export type PatchApiV1ModelsByProviderIdByModelIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -9285,14 +9063,6 @@ export type PatchApiV1ModelsByProviderIdByModelIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9306,9 +9076,7 @@ export type PatchApiV1ModelsByProviderIdByModelIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: Model;
message?: string;
success: true;
timestamp: string;
@@ -9332,13 +9100,9 @@ export type GetApiV1NotificationsData = {
export type GetApiV1NotificationsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -9347,18 +9111,6 @@ export type GetApiV1NotificationsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9372,9 +9124,7 @@ export type GetApiV1NotificationsResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: Array<Notification>;
message?: string;
success: true;
timestamp: string;
@@ -9394,13 +9144,9 @@ export type GetApiV1NotificationsSettingsData = {
export type GetApiV1NotificationsSettingsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -9409,18 +9155,6 @@ export type GetApiV1NotificationsSettingsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9434,9 +9168,7 @@ export type GetApiV1NotificationsSettingsResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: NotificationSettings;
message?: string;
success: true;
timestamp: string;
@@ -9503,13 +9235,9 @@ export type PatchApiV1NotificationsSettingsData = {
export type PatchApiV1NotificationsSettingsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -9518,18 +9246,6 @@ export type PatchApiV1NotificationsSettingsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9543,9 +9259,7 @@ export type PatchApiV1NotificationsSettingsResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: NotificationSettings;
message?: string;
success: true;
timestamp: string;
@@ -9562,10 +9276,6 @@ export type GetApiV1NotificationsUnreadCountData = {
};
export type GetApiV1NotificationsUnreadCountErrors = {
- /**
- * Invalid request
- */
- 400: ApiError;
/**
* Authentication required
*/
@@ -9574,18 +9284,6 @@ export type GetApiV1NotificationsUnreadCountErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9599,9 +9297,7 @@ export type GetApiV1NotificationsUnreadCountResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: NotificationUnreadCount;
message?: string;
success: true;
timestamp: string;
@@ -9618,10 +9314,6 @@ export type GetApiV1NotificationsCountsData = {
};
export type GetApiV1NotificationsCountsErrors = {
- /**
- * Invalid request
- */
- 400: ApiError;
/**
* Authentication required
*/
@@ -9629,19 +9321,7 @@ export type GetApiV1NotificationsCountsErrors = {
/**
* Insufficient permission
*/
- 403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
+ 403: ApiError;
/**
* Internal server error
*/
@@ -9655,9 +9335,7 @@ export type GetApiV1NotificationsCountsResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: Array<NotificationCategoryCount>;
message?: string;
success: true;
timestamp: string;
@@ -9677,13 +9355,9 @@ export type PostApiV1NotificationsReadData = {
export type PostApiV1NotificationsReadErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -9692,18 +9366,6 @@ export type PostApiV1NotificationsReadErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9717,10 +9379,7 @@ export type PostApiV1NotificationsReadResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
- message?: string;
+ message: string;
success: true;
timestamp: string;
};
@@ -9736,10 +9395,6 @@ export type PostApiV1NotificationsReadAllData = {
};
export type PostApiV1NotificationsReadAllErrors = {
- /**
- * Invalid request
- */
- 400: ApiError;
/**
* Authentication required
*/
@@ -9748,18 +9403,6 @@ export type PostApiV1NotificationsReadAllErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9773,10 +9416,7 @@ export type PostApiV1NotificationsReadAllResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
- message?: string;
+ message: string;
success: true;
timestamp: string;
};
@@ -9792,10 +9432,6 @@ export type PostApiV1NotificationsArchiveAllData = {
};
export type PostApiV1NotificationsArchiveAllErrors = {
- /**
- * Invalid request
- */
- 400: ApiError;
/**
* Authentication required
*/
@@ -9804,18 +9440,6 @@ export type PostApiV1NotificationsArchiveAllErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9829,10 +9453,7 @@ export type PostApiV1NotificationsArchiveAllResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
- message?: string;
+ message: string;
success: true;
timestamp: string;
};
@@ -9851,13 +9472,9 @@ export type PostApiV1NotificationsByIdArchiveData = {
export type PostApiV1NotificationsByIdArchiveErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -9866,18 +9483,6 @@ export type PostApiV1NotificationsByIdArchiveErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9891,10 +9496,7 @@ export type PostApiV1NotificationsByIdArchiveResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
- message?: string;
+ message: string;
success: true;
timestamp: string;
};
@@ -9917,13 +9519,9 @@ export type GetApiV1PermissionsData = {
export type GetApiV1PermissionsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -9932,18 +9530,6 @@ export type GetApiV1PermissionsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -9957,11 +9543,7 @@ export type GetApiV1PermissionsResponses = {
* Successful response
*/
200: {
- data?: {
- permissions: Array<Permission>;
- total?: number;
- [key: string]: unknown;
- };
+ data: PermissionList;
message?: string;
success: true;
timestamp: string;
@@ -9985,13 +9567,9 @@ export type PostApiV1PermissionsData = {
export type PostApiV1PermissionsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10000,18 +9578,6 @@ export type PostApiV1PermissionsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10025,7 +9591,7 @@ export type PostApiV1PermissionsResponses = {
* Successful response
*/
200: {
- data?: Permission;
+ data: Permission;
message?: string;
success: true;
timestamp: string;
@@ -10045,13 +9611,9 @@ export type DeleteApiV1PermissionsByIdData = {
export type DeleteApiV1PermissionsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10064,14 +9626,6 @@ export type DeleteApiV1PermissionsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10085,9 +9639,7 @@ export type DeleteApiV1PermissionsByIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -10107,13 +9659,9 @@ export type GetApiV1PermissionsByIdData = {
export type GetApiV1PermissionsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10126,14 +9674,6 @@ export type GetApiV1PermissionsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10147,7 +9687,7 @@ export type GetApiV1PermissionsByIdResponses = {
* Successful response
*/
200: {
- data?: Permission;
+ data: Permission;
message?: string;
success: true;
timestamp: string;
@@ -10173,13 +9713,9 @@ export type PatchApiV1PermissionsByIdData = {
export type PatchApiV1PermissionsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10192,14 +9728,6 @@ export type PatchApiV1PermissionsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10213,7 +9741,7 @@ export type PatchApiV1PermissionsByIdResponses = {
* Successful response
*/
200: {
- data?: Permission;
+ data: Permission;
message?: string;
success: true;
timestamp: string;
@@ -10236,13 +9764,9 @@ export type GetApiV1ProvidersData = {
export type GetApiV1ProvidersErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10251,18 +9775,6 @@ export type GetApiV1ProvidersErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10276,10 +9788,9 @@ export type GetApiV1ProvidersResponses = {
* Successful response
*/
200: {
- data?: {
+ data: {
providers: Array<Provider>;
- total?: number;
- [key: string]: unknown;
+ total: number;
};
message?: string;
success: true;
@@ -10317,13 +9828,9 @@ export type PostApiV1ProvidersData = {
export type PostApiV1ProvidersErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10332,18 +9839,6 @@ export type PostApiV1ProvidersErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10357,7 +9852,7 @@ export type PostApiV1ProvidersResponses = {
* Successful response
*/
200: {
- data?: Provider;
+ data: Provider;
message?: string;
success: true;
timestamp: string;
@@ -10377,13 +9872,9 @@ export type DeleteApiV1ProvidersByIdData = {
export type DeleteApiV1ProvidersByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10396,14 +9887,6 @@ export type DeleteApiV1ProvidersByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10417,9 +9900,7 @@ export type DeleteApiV1ProvidersByIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -10439,13 +9920,9 @@ export type GetApiV1ProvidersByIdData = {
export type GetApiV1ProvidersByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10458,14 +9935,6 @@ export type GetApiV1ProvidersByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10479,7 +9948,7 @@ export type GetApiV1ProvidersByIdResponses = {
* Successful response
*/
200: {
- data?: Provider;
+ data: Provider;
message?: string;
success: true;
timestamp: string;
@@ -10517,13 +9986,9 @@ export type PatchApiV1ProvidersByIdData = {
export type PatchApiV1ProvidersByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10536,14 +10001,6 @@ export type PatchApiV1ProvidersByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10557,7 +10014,7 @@ export type PatchApiV1ProvidersByIdResponses = {
* Successful response
*/
200: {
- data?: Provider;
+ data: Provider;
message?: string;
success: true;
timestamp: string;
@@ -10579,13 +10036,9 @@ export type DeleteApiV1PushTokensByDeviceIdData = {
export type DeleteApiV1PushTokensByDeviceIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10594,18 +10047,6 @@ export type DeleteApiV1PushTokensByDeviceIdErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10619,7 +10060,7 @@ export type DeleteApiV1PushTokensByDeviceIdResponses = {
* Successful response
*/
200: {
- data?: null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -10644,13 +10085,9 @@ export type PutApiV1PushTokensByDeviceIdData = {
export type PutApiV1PushTokensByDeviceIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10659,18 +10096,6 @@ export type PutApiV1PushTokensByDeviceIdErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10684,10 +10109,7 @@ export type PutApiV1PushTokensByDeviceIdResponses = {
* Successful response
*/
200: {
- data?: {
- deviceId: string;
- platform: string;
- };
+ data: PushTokenRegistration;
message?: string;
success: true;
timestamp: string;
@@ -10780,13 +10202,9 @@ export type PostApiV1ResponsesData = {
export type PostApiV1ResponsesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10795,18 +10213,6 @@ export type PostApiV1ResponsesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10819,18 +10225,7 @@ export type PostApiV1ResponsesResponses = {
/**
* Successful response
*/
- 200: {
- id: string;
- object: 'response';
- output: Array<{
- [key: string]: unknown;
- }>;
- status: string;
- usage?: {
- [key: string]: unknown;
- } | null;
- [key: string]: unknown;
- };
+ 200: ResponseObject;
};
export type PostApiV1ResponsesResponse = PostApiV1ResponsesResponses[keyof PostApiV1ResponsesResponses];
@@ -10850,13 +10245,9 @@ export type GetApiV1RolesData = {
export type GetApiV1RolesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10865,18 +10256,6 @@ export type GetApiV1RolesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10890,11 +10269,7 @@ export type GetApiV1RolesResponses = {
* Successful response
*/
200: {
- data?: {
- roles: Array<Role>;
- total?: number;
- [key: string]: unknown;
- };
+ data: RoleList;
message?: string;
success: true;
timestamp: string;
@@ -10918,13 +10293,9 @@ export type PostApiV1RolesData = {
export type PostApiV1RolesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10933,18 +10304,6 @@ export type PostApiV1RolesErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -10958,7 +10317,7 @@ export type PostApiV1RolesResponses = {
* Successful response
*/
200: {
- data?: Role;
+ data: Role;
message?: string;
success: true;
timestamp: string;
@@ -10978,13 +10337,9 @@ export type DeleteApiV1RolesByIdData = {
export type DeleteApiV1RolesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -10997,14 +10352,6 @@ export type DeleteApiV1RolesByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -11018,9 +10365,7 @@ export type DeleteApiV1RolesByIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -11040,13 +10385,9 @@ export type GetApiV1RolesByIdData = {
export type GetApiV1RolesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11059,14 +10400,6 @@ export type GetApiV1RolesByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -11080,7 +10413,7 @@ export type GetApiV1RolesByIdResponses = {
* Successful response
*/
200: {
- data?: Role;
+ data: Role;
message?: string;
success: true;
timestamp: string;
@@ -11106,13 +10439,9 @@ export type PatchApiV1RolesByIdData = {
export type PatchApiV1RolesByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11125,14 +10454,6 @@ export type PatchApiV1RolesByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -11146,7 +10467,7 @@ export type PatchApiV1RolesByIdResponses = {
* Successful response
*/
200: {
- data?: Role;
+ data: Role;
message?: string;
success: true;
timestamp: string;
@@ -11166,13 +10487,9 @@ export type DeleteApiV1RolesByIdPermissionsData = {
export type DeleteApiV1RolesByIdPermissionsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11185,14 +10502,6 @@ export type DeleteApiV1RolesByIdPermissionsErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -11206,9 +10515,7 @@ export type DeleteApiV1RolesByIdPermissionsResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResources;
message?: string;
success: true;
timestamp: string;
@@ -11232,13 +10539,9 @@ export type GetApiV1RolesByIdPermissionsData = {
export type GetApiV1RolesByIdPermissionsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11247,18 +10550,6 @@ export type GetApiV1RolesByIdPermissionsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -11272,9 +10563,7 @@ export type GetApiV1RolesByIdPermissionsResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: RolePermissionList;
message?: string;
success: true;
timestamp: string;
@@ -11297,13 +10586,9 @@ export type PatchApiV1RolesByIdPermissionsData = {
export type PatchApiV1RolesByIdPermissionsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11316,14 +10601,6 @@ export type PatchApiV1RolesByIdPermissionsErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -11337,9 +10614,7 @@ export type PatchApiV1RolesByIdPermissionsResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: RolePermissionsUpdateResult;
message?: string;
success: true;
timestamp: string;
@@ -11365,13 +10640,9 @@ export type PostApiV1SignalsSourceEventsData = {
export type PostApiV1SignalsSourceEventsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11384,14 +10655,6 @@ export type PostApiV1SignalsSourceEventsErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -11405,9 +10668,7 @@ export type PostApiV1SignalsSourceEventsResponses = {
* Successful response
*/
202: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: AgentSignalEmission;
message?: string;
success: true;
timestamp: string;
@@ -11435,13 +10696,9 @@ export type PostApiV1SignalsTriggerData = {
export type PostApiV1SignalsTriggerErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11454,10 +10711,6 @@ export type PostApiV1SignalsTriggerErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
/**
* Rate limit exceeded
*/
@@ -11475,9 +10728,7 @@ export type PostApiV1SignalsTriggerResponses = {
* Successful response
*/
202: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: AgentSignalEmission;
message?: string;
success: true;
timestamp: string;
@@ -11501,13 +10752,9 @@ export type GetApiV1SignalsReceiptsData = {
export type GetApiV1SignalsReceiptsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11516,18 +10763,6 @@ export type GetApiV1SignalsReceiptsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -11541,9 +10776,7 @@ export type GetApiV1SignalsReceiptsResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: AgentSignalReceiptList;
message?: string;
success: true;
timestamp: string;
@@ -11567,13 +10800,9 @@ export type GetApiV1TasksData = {
export type GetApiV1TasksErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11582,18 +10811,6 @@ export type GetApiV1TasksErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -11607,9 +10824,7 @@ export type GetApiV1TasksResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: TaskList;
message?: string;
success: true;
timestamp: string;
@@ -11644,13 +10859,9 @@ export type PostApiV1TasksData = {
export type PostApiV1TasksErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11664,13 +10875,9 @@ export type PostApiV1TasksErrors = {
*/
404: ApiError;
/**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
+ * Precondition failed
*/
- 429: ApiError;
+ 412: ApiError;
/**
* Internal server error
*/
@@ -11684,9 +10891,7 @@ export type PostApiV1TasksResponses = {
* Successful response
*/
201: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: Task;
message?: string;
success: true;
timestamp: string;
@@ -11706,13 +10911,9 @@ export type DeleteApiV1TasksByIdData = {
export type DeleteApiV1TasksByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11729,10 +10930,6 @@ export type DeleteApiV1TasksByIdErrors = {
* Resource conflict
*/
409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -11746,9 +10943,7 @@ export type DeleteApiV1TasksByIdResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -11768,13 +10963,9 @@ export type GetApiV1TasksByIdData = {
export type GetApiV1TasksByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11787,14 +10978,6 @@ export type GetApiV1TasksByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -11808,9 +10991,7 @@ export type GetApiV1TasksByIdResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: TaskDetail;
message?: string;
success: true;
timestamp: string;
@@ -11833,6 +11014,7 @@ export type PatchApiV1TasksByIdData = {
name?: string;
parentTaskId?: string | null;
priority?: number;
+ projectId?: string | null;
schedulePattern?: string | null;
scheduleTimezone?: string | null;
};
@@ -11845,13 +11027,9 @@ export type PatchApiV1TasksByIdData = {
export type PatchApiV1TasksByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11869,9 +11047,9 @@ export type PatchApiV1TasksByIdErrors = {
*/
409: ApiError;
/**
- * Rate limit exceeded
+ * Precondition failed
*/
- 429: ApiError;
+ 412: ApiError;
/**
* Internal server error
*/
@@ -11885,9 +11063,7 @@ export type PatchApiV1TasksByIdResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: Task;
message?: string;
success: true;
timestamp: string;
@@ -11910,13 +11086,9 @@ export type PatchApiV1TasksByIdStatusData = {
export type PatchApiV1TasksByIdStatusErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11930,13 +11102,9 @@ export type PatchApiV1TasksByIdStatusErrors = {
*/
404: ApiError;
/**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
+ * Resource conflict
*/
- 429: ApiError;
+ 409: ApiError;
/**
* Internal server error
*/
@@ -11950,9 +11118,7 @@ export type PatchApiV1TasksByIdStatusResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: TaskStatusUpdateResult;
message?: string;
success: true;
timestamp: string;
@@ -11974,13 +11140,9 @@ export type GetApiV1TasksByIdRunsData = {
export type GetApiV1TasksByIdRunsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -11993,14 +11155,6 @@ export type GetApiV1TasksByIdRunsErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12014,9 +11168,7 @@ export type GetApiV1TasksByIdRunsResponses = {
* Successful response
*/
200: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: Array<TaskRun>;
message?: string;
success: true;
timestamp: string;
@@ -12038,13 +11190,9 @@ export type PostApiV1TasksByIdRunsData = {
export type PostApiV1TasksByIdRunsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12062,9 +11210,9 @@ export type PostApiV1TasksByIdRunsErrors = {
*/
409: ApiError;
/**
- * Rate limit exceeded
+ * Precondition failed
*/
- 429: ApiError;
+ 412: ApiError;
/**
* Internal server error
*/
@@ -12078,9 +11226,7 @@ export type PostApiV1TasksByIdRunsResponses = {
* Successful response
*/
202: {
- data?: Array<unknown> | {
- [key: string]: unknown;
- } | null;
+ data: TaskRunStarted;
message?: string;
success: true;
timestamp: string;
@@ -12107,13 +11253,9 @@ export type GetApiV1TopicsData = {
export type GetApiV1TopicsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12122,18 +11264,6 @@ export type GetApiV1TopicsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12147,10 +11277,9 @@ export type GetApiV1TopicsResponses = {
* Successful response
*/
200: {
- data?: {
+ data: {
topics: Array<Topic>;
- total?: number;
- [key: string]: unknown;
+ total: number;
};
message?: string;
success: true;
@@ -12175,13 +11304,9 @@ export type PostApiV1TopicsData = {
export type PostApiV1TopicsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12190,18 +11315,6 @@ export type PostApiV1TopicsErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12215,7 +11328,7 @@ export type PostApiV1TopicsResponses = {
* Successful response
*/
200: {
- data?: Topic;
+ data: Topic;
message?: string;
success: true;
timestamp: string;
@@ -12235,13 +11348,9 @@ export type DeleteApiV1TopicsByIdData = {
export type DeleteApiV1TopicsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12254,14 +11363,6 @@ export type DeleteApiV1TopicsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12275,9 +11376,7 @@ export type DeleteApiV1TopicsByIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -12297,13 +11396,9 @@ export type GetApiV1TopicsByIdData = {
export type GetApiV1TopicsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12316,14 +11411,6 @@ export type GetApiV1TopicsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12337,7 +11424,7 @@ export type GetApiV1TopicsByIdResponses = {
* Successful response
*/
200: {
- data?: Topic;
+ data: Topic;
message?: string;
success: true;
timestamp: string;
@@ -12367,13 +11454,9 @@ export type PatchApiV1TopicsByIdData = {
export type PatchApiV1TopicsByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12386,14 +11469,6 @@ export type PatchApiV1TopicsByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12407,7 +11482,7 @@ export type PatchApiV1TopicsByIdResponses = {
* Successful response
*/
200: {
- data?: Topic;
+ data: Topic;
message?: string;
success: true;
timestamp: string;
@@ -12432,13 +11507,9 @@ export type GetApiV1TopicsByTopicIdThreadsData = {
export type GetApiV1TopicsByTopicIdThreadsErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12451,14 +11522,6 @@ export type GetApiV1TopicsByTopicIdThreadsErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12472,17 +11535,8 @@ export type GetApiV1TopicsByTopicIdThreadsResponses = {
* Successful response
*/
200: {
- data?: {
- threads: Array<{
- id?: string;
- topicId?: string;
- title?: string | null;
- type?: string;
- status?: string | null;
- parentThreadId?: string | null;
- createdAt?: string;
- updatedAt?: string;
- }>;
+ data: {
+ threads: Array<TopicThread>;
total: number;
};
message?: string;
@@ -12501,10 +11555,6 @@ export type GetApiV1UsersMeData = {
};
export type GetApiV1UsersMeErrors = {
- /**
- * Invalid request
- */
- 400: ApiError;
/**
* Authentication required
*/
@@ -12517,14 +11567,6 @@ export type GetApiV1UsersMeErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12538,9 +11580,7 @@ export type GetApiV1UsersMeResponses = {
* Successful response
*/
200: {
- data?: User | {
- id: string;
- };
+ data: User | UserIdentity;
message?: string;
success: true;
timestamp: string;
@@ -12562,13 +11602,9 @@ export type GetApiV1UsersData = {
export type GetApiV1UsersErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12577,18 +11613,6 @@ export type GetApiV1UsersErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12602,11 +11626,7 @@ export type GetApiV1UsersResponses = {
* Successful response
*/
200: {
- data?: {
- users: Array<User>;
- total?: number;
- [key: string]: unknown;
- };
+ data: UserList;
message?: string;
success: true;
timestamp: string;
@@ -12634,13 +11654,9 @@ export type PostApiV1UsersData = {
export type PostApiV1UsersErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12649,18 +11665,6 @@ export type PostApiV1UsersErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12674,7 +11678,7 @@ export type PostApiV1UsersResponses = {
* Successful response
*/
200: {
- data?: User;
+ data: User;
message?: string;
success: true;
timestamp: string;
@@ -12694,13 +11698,9 @@ export type DeleteApiV1UsersByIdData = {
export type DeleteApiV1UsersByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12713,14 +11713,6 @@ export type DeleteApiV1UsersByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12734,9 +11726,7 @@ export type DeleteApiV1UsersByIdResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResource;
message?: string;
success: true;
timestamp: string;
@@ -12756,13 +11746,9 @@ export type GetApiV1UsersByIdData = {
export type GetApiV1UsersByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12775,14 +11761,6 @@ export type GetApiV1UsersByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12796,7 +11774,7 @@ export type GetApiV1UsersByIdResponses = {
* Successful response
*/
200: {
- data?: User;
+ data: User;
message?: string;
success: true;
timestamp: string;
@@ -12827,13 +11805,9 @@ export type PatchApiV1UsersByIdData = {
export type PatchApiV1UsersByIdErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12846,14 +11820,6 @@ export type PatchApiV1UsersByIdErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12867,7 +11833,7 @@ export type PatchApiV1UsersByIdResponses = {
* Successful response
*/
200: {
- data?: User;
+ data: User;
message?: string;
success: true;
timestamp: string;
@@ -12887,13 +11853,9 @@ export type DeleteApiV1UsersByIdRolesData = {
export type DeleteApiV1UsersByIdRolesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12906,14 +11868,6 @@ export type DeleteApiV1UsersByIdRolesErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12927,9 +11881,7 @@ export type DeleteApiV1UsersByIdRolesResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- } | null;
+ data: DeletedResources;
message?: string;
success: true;
timestamp: string;
@@ -12949,13 +11901,9 @@ export type GetApiV1UsersByIdRolesData = {
export type GetApiV1UsersByIdRolesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -12968,14 +11916,6 @@ export type GetApiV1UsersByIdRolesErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -12989,9 +11929,7 @@ export type GetApiV1UsersByIdRolesResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: Array<UserRole>;
message?: string;
success: true;
timestamp: string;
@@ -13017,13 +11955,9 @@ export type PatchApiV1UsersByIdRolesData = {
export type PatchApiV1UsersByIdRolesErrors = {
/**
- * Validation Error
+ * Invalid request
*/
- 400: {
- success: false;
- error: Array<unknown>;
- data: unknown;
- };
+ 400: ApiError;
/**
* Authentication required
*/
@@ -13036,14 +11970,6 @@ export type PatchApiV1UsersByIdRolesErrors = {
* Resource not found
*/
404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -13057,9 +11983,7 @@ export type PatchApiV1UsersByIdRolesResponses = {
* Successful response
*/
200: {
- data?: {
- [key: string]: unknown;
- };
+ data: Array<UserRole>;
message?: string;
success: true;
timestamp: string;
@@ -13076,10 +12000,6 @@ export type GetApiV1UsageData = {
};
export type GetApiV1UsageErrors = {
- /**
- * Invalid request
- */
- 400: ApiError;
/**
* Authentication required
*/
@@ -13088,18 +12008,6 @@ export type GetApiV1UsageErrors = {
* Insufficient permission
*/
403: ApiError;
- /**
- * Resource not found
- */
- 404: ApiError;
- /**
- * Resource conflict
- */
- 409: ApiError;
- /**
- * Rate limit exceeded
- */
- 429: ApiError;
/**
* Internal server error
*/
@@ -13113,7 +12021,7 @@ export type GetApiV1UsageResponses = {
* Successful response
*/
200: {
- data?: Usage;
+ data: Usage;
message?: string;
success: true;
timestamp: string;
diff --git a/tests/openapi/knowledge-base-delete.test.ts b/tests/openapi/knowledge-base-delete.test.ts
index b3a84abc402..23455445830 100644
--- a/tests/openapi/knowledge-base-delete.test.ts
+++ b/tests/openapi/knowledge-base-delete.test.ts
@@ -53,8 +53,8 @@ describe('KnowledgeBaseService.deleteKnowledgeBase', () => {
});
await expect(service.deleteKnowledgeBase('kb-1')).resolves.toEqual({
- message: 'Knowledge base deleted successfully',
- success: true,
+ deleted: true,
+ id: 'kb-1',
});
expect(deleteWithFilesSpy).toHaveBeenCalledWith('kb-1');